@94ai/nf-virtual-select 3.3.50 → 3.3.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,6 +60,2191 @@ var _sfc_render$2 = function render() {
60
60
  var _sfc_staticRenderFns$2 = [];
61
61
  var __component__$2 = /* @__PURE__ */ normalizeComponent(_sfc_main$2, _sfc_render$2, _sfc_staticRenderFns$2, false, null, null, null, null);
62
62
  const ElOptionNode = __component__$2.exports;
63
+ /**!
64
+ * Sortable 1.15.2
65
+ * @author RubaXa <trash@rubaxa.org>
66
+ * @author owenm <owen23355@gmail.com>
67
+ * @license MIT
68
+ */
69
+ function ownKeys(object, enumerableOnly) {
70
+ var keys = Object.keys(object);
71
+ if (Object.getOwnPropertySymbols) {
72
+ var symbols = Object.getOwnPropertySymbols(object);
73
+ if (enumerableOnly) {
74
+ symbols = symbols.filter(function(sym) {
75
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
76
+ });
77
+ }
78
+ keys.push.apply(keys, symbols);
79
+ }
80
+ return keys;
81
+ }
82
+ function _objectSpread2(target) {
83
+ for (var i = 1; i < arguments.length; i++) {
84
+ var source = arguments[i] != null ? arguments[i] : {};
85
+ if (i % 2) {
86
+ ownKeys(Object(source), true).forEach(function(key) {
87
+ _defineProperty(target, key, source[key]);
88
+ });
89
+ } else if (Object.getOwnPropertyDescriptors) {
90
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
91
+ } else {
92
+ ownKeys(Object(source)).forEach(function(key) {
93
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
94
+ });
95
+ }
96
+ }
97
+ return target;
98
+ }
99
+ function _typeof(obj) {
100
+ "@babel/helpers - typeof";
101
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
102
+ _typeof = function(obj2) {
103
+ return typeof obj2;
104
+ };
105
+ } else {
106
+ _typeof = function(obj2) {
107
+ return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
108
+ };
109
+ }
110
+ return _typeof(obj);
111
+ }
112
+ function _defineProperty(obj, key, value) {
113
+ if (key in obj) {
114
+ Object.defineProperty(obj, key, {
115
+ value,
116
+ enumerable: true,
117
+ configurable: true,
118
+ writable: true
119
+ });
120
+ } else {
121
+ obj[key] = value;
122
+ }
123
+ return obj;
124
+ }
125
+ function _extends() {
126
+ _extends = Object.assign || function(target) {
127
+ for (var i = 1; i < arguments.length; i++) {
128
+ var source = arguments[i];
129
+ for (var key in source) {
130
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
131
+ target[key] = source[key];
132
+ }
133
+ }
134
+ }
135
+ return target;
136
+ };
137
+ return _extends.apply(this, arguments);
138
+ }
139
+ function _objectWithoutPropertiesLoose(source, excluded) {
140
+ if (source == null)
141
+ return {};
142
+ var target = {};
143
+ var sourceKeys = Object.keys(source);
144
+ var key, i;
145
+ for (i = 0; i < sourceKeys.length; i++) {
146
+ key = sourceKeys[i];
147
+ if (excluded.indexOf(key) >= 0)
148
+ continue;
149
+ target[key] = source[key];
150
+ }
151
+ return target;
152
+ }
153
+ function _objectWithoutProperties(source, excluded) {
154
+ if (source == null)
155
+ return {};
156
+ var target = _objectWithoutPropertiesLoose(source, excluded);
157
+ var key, i;
158
+ if (Object.getOwnPropertySymbols) {
159
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
160
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
161
+ key = sourceSymbolKeys[i];
162
+ if (excluded.indexOf(key) >= 0)
163
+ continue;
164
+ if (!Object.prototype.propertyIsEnumerable.call(source, key))
165
+ continue;
166
+ target[key] = source[key];
167
+ }
168
+ }
169
+ return target;
170
+ }
171
+ var version = "1.15.2";
172
+ function userAgent(pattern) {
173
+ if (typeof window !== "undefined" && window.navigator) {
174
+ return !!/* @__PURE__ */ navigator.userAgent.match(pattern);
175
+ }
176
+ }
177
+ var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
178
+ var Edge = userAgent(/Edge/i);
179
+ var FireFox = userAgent(/firefox/i);
180
+ var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
181
+ var IOS = userAgent(/iP(ad|od|hone)/i);
182
+ var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
183
+ var captureMode = {
184
+ capture: false,
185
+ passive: false
186
+ };
187
+ function on(el, event, fn) {
188
+ el.addEventListener(event, fn, !IE11OrLess && captureMode);
189
+ }
190
+ function off(el, event, fn) {
191
+ el.removeEventListener(event, fn, !IE11OrLess && captureMode);
192
+ }
193
+ function matches(el, selector) {
194
+ if (!selector)
195
+ return;
196
+ selector[0] === ">" && (selector = selector.substring(1));
197
+ if (el) {
198
+ try {
199
+ if (el.matches) {
200
+ return el.matches(selector);
201
+ } else if (el.msMatchesSelector) {
202
+ return el.msMatchesSelector(selector);
203
+ } else if (el.webkitMatchesSelector) {
204
+ return el.webkitMatchesSelector(selector);
205
+ }
206
+ } catch (_) {
207
+ return false;
208
+ }
209
+ }
210
+ return false;
211
+ }
212
+ function getParentOrHost(el) {
213
+ return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
214
+ }
215
+ function closest(el, selector, ctx, includeCTX) {
216
+ if (el) {
217
+ ctx = ctx || document;
218
+ do {
219
+ if (selector != null && (selector[0] === ">" ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
220
+ return el;
221
+ }
222
+ if (el === ctx)
223
+ break;
224
+ } while (el = getParentOrHost(el));
225
+ }
226
+ return null;
227
+ }
228
+ var R_SPACE = /\s+/g;
229
+ function toggleClass(el, name, state) {
230
+ if (el && name) {
231
+ if (el.classList) {
232
+ el.classList[state ? "add" : "remove"](name);
233
+ } else {
234
+ var className = (" " + el.className + " ").replace(R_SPACE, " ").replace(" " + name + " ", " ");
235
+ el.className = (className + (state ? " " + name : "")).replace(R_SPACE, " ");
236
+ }
237
+ }
238
+ }
239
+ function css(el, prop, val) {
240
+ var style = el && el.style;
241
+ if (style) {
242
+ if (val === void 0) {
243
+ if (document.defaultView && document.defaultView.getComputedStyle) {
244
+ val = document.defaultView.getComputedStyle(el, "");
245
+ } else if (el.currentStyle) {
246
+ val = el.currentStyle;
247
+ }
248
+ return prop === void 0 ? val : val[prop];
249
+ } else {
250
+ if (!(prop in style) && prop.indexOf("webkit") === -1) {
251
+ prop = "-webkit-" + prop;
252
+ }
253
+ style[prop] = val + (typeof val === "string" ? "" : "px");
254
+ }
255
+ }
256
+ }
257
+ function matrix(el, selfOnly) {
258
+ var appliedTransforms = "";
259
+ if (typeof el === "string") {
260
+ appliedTransforms = el;
261
+ } else {
262
+ do {
263
+ var transform = css(el, "transform");
264
+ if (transform && transform !== "none") {
265
+ appliedTransforms = transform + " " + appliedTransforms;
266
+ }
267
+ } while (!selfOnly && (el = el.parentNode));
268
+ }
269
+ var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
270
+ return matrixFn && new matrixFn(appliedTransforms);
271
+ }
272
+ function find(ctx, tagName, iterator) {
273
+ if (ctx) {
274
+ var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
275
+ if (iterator) {
276
+ for (; i < n; i++) {
277
+ iterator(list[i], i);
278
+ }
279
+ }
280
+ return list;
281
+ }
282
+ return [];
283
+ }
284
+ function getWindowScrollingElement() {
285
+ var scrollingElement = document.scrollingElement;
286
+ if (scrollingElement) {
287
+ return scrollingElement;
288
+ } else {
289
+ return document.documentElement;
290
+ }
291
+ }
292
+ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
293
+ if (!el.getBoundingClientRect && el !== window)
294
+ return;
295
+ var elRect, top, left, bottom, right, height, width;
296
+ if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
297
+ elRect = el.getBoundingClientRect();
298
+ top = elRect.top;
299
+ left = elRect.left;
300
+ bottom = elRect.bottom;
301
+ right = elRect.right;
302
+ height = elRect.height;
303
+ width = elRect.width;
304
+ } else {
305
+ top = 0;
306
+ left = 0;
307
+ bottom = window.innerHeight;
308
+ right = window.innerWidth;
309
+ height = window.innerHeight;
310
+ width = window.innerWidth;
311
+ }
312
+ if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
313
+ container = container || el.parentNode;
314
+ if (!IE11OrLess) {
315
+ do {
316
+ if (container && container.getBoundingClientRect && (css(container, "transform") !== "none" || relativeToNonStaticParent && css(container, "position") !== "static")) {
317
+ var containerRect = container.getBoundingClientRect();
318
+ top -= containerRect.top + parseInt(css(container, "border-top-width"));
319
+ left -= containerRect.left + parseInt(css(container, "border-left-width"));
320
+ bottom = top + elRect.height;
321
+ right = left + elRect.width;
322
+ break;
323
+ }
324
+ } while (container = container.parentNode);
325
+ }
326
+ }
327
+ if (undoScale && el !== window) {
328
+ var elMatrix = matrix(container || el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d;
329
+ if (elMatrix) {
330
+ top /= scaleY;
331
+ left /= scaleX;
332
+ width /= scaleX;
333
+ height /= scaleY;
334
+ bottom = top + height;
335
+ right = left + width;
336
+ }
337
+ }
338
+ return {
339
+ top,
340
+ left,
341
+ bottom,
342
+ right,
343
+ width,
344
+ height
345
+ };
346
+ }
347
+ function isScrolledPast(el, elSide, parentSide) {
348
+ var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide];
349
+ while (parent) {
350
+ var parentSideVal = getRect(parent)[parentSide], visible = void 0;
351
+ if (parentSide === "top" || parentSide === "left") {
352
+ visible = elSideVal >= parentSideVal;
353
+ } else {
354
+ visible = elSideVal <= parentSideVal;
355
+ }
356
+ if (!visible)
357
+ return parent;
358
+ if (parent === getWindowScrollingElement())
359
+ break;
360
+ parent = getParentAutoScrollElement(parent, false);
361
+ }
362
+ return false;
363
+ }
364
+ function getChild(el, childNum, options, includeDragEl) {
365
+ var currentChild = 0, i = 0, children = el.children;
366
+ while (i < children.length) {
367
+ if (children[i].style.display !== "none" && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
368
+ if (currentChild === childNum) {
369
+ return children[i];
370
+ }
371
+ currentChild++;
372
+ }
373
+ i++;
374
+ }
375
+ return null;
376
+ }
377
+ function lastChild(el, selector) {
378
+ var last = el.lastElementChild;
379
+ while (last && (last === Sortable.ghost || css(last, "display") === "none" || selector && !matches(last, selector))) {
380
+ last = last.previousElementSibling;
381
+ }
382
+ return last || null;
383
+ }
384
+ function index(el, selector) {
385
+ var index2 = 0;
386
+ if (!el || !el.parentNode) {
387
+ return -1;
388
+ }
389
+ while (el = el.previousElementSibling) {
390
+ if (el.nodeName.toUpperCase() !== "TEMPLATE" && el !== Sortable.clone && (!selector || matches(el, selector))) {
391
+ index2++;
392
+ }
393
+ }
394
+ return index2;
395
+ }
396
+ function getRelativeScrollOffset(el) {
397
+ var offsetLeft = 0, offsetTop = 0, winScroller = getWindowScrollingElement();
398
+ if (el) {
399
+ do {
400
+ var elMatrix = matrix(el), scaleX = elMatrix.a, scaleY = elMatrix.d;
401
+ offsetLeft += el.scrollLeft * scaleX;
402
+ offsetTop += el.scrollTop * scaleY;
403
+ } while (el !== winScroller && (el = el.parentNode));
404
+ }
405
+ return [offsetLeft, offsetTop];
406
+ }
407
+ function indexOfObject(arr, obj) {
408
+ for (var i in arr) {
409
+ if (!arr.hasOwnProperty(i))
410
+ continue;
411
+ for (var key in obj) {
412
+ if (obj.hasOwnProperty(key) && obj[key] === arr[i][key])
413
+ return Number(i);
414
+ }
415
+ }
416
+ return -1;
417
+ }
418
+ function getParentAutoScrollElement(el, includeSelf) {
419
+ if (!el || !el.getBoundingClientRect)
420
+ return getWindowScrollingElement();
421
+ var elem = el;
422
+ var gotSelf = false;
423
+ do {
424
+ if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
425
+ var elemCSS = css(elem);
426
+ if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == "auto" || elemCSS.overflowX == "scroll") || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == "auto" || elemCSS.overflowY == "scroll")) {
427
+ if (!elem.getBoundingClientRect || elem === document.body)
428
+ return getWindowScrollingElement();
429
+ if (gotSelf || includeSelf)
430
+ return elem;
431
+ gotSelf = true;
432
+ }
433
+ }
434
+ } while (elem = elem.parentNode);
435
+ return getWindowScrollingElement();
436
+ }
437
+ function extend(dst, src) {
438
+ if (dst && src) {
439
+ for (var key in src) {
440
+ if (src.hasOwnProperty(key)) {
441
+ dst[key] = src[key];
442
+ }
443
+ }
444
+ }
445
+ return dst;
446
+ }
447
+ function isRectEqual(rect1, rect2) {
448
+ return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);
449
+ }
450
+ var _throttleTimeout;
451
+ function throttle(callback, ms) {
452
+ return function() {
453
+ if (!_throttleTimeout) {
454
+ var args = arguments, _this = this;
455
+ if (args.length === 1) {
456
+ callback.call(_this, args[0]);
457
+ } else {
458
+ callback.apply(_this, args);
459
+ }
460
+ _throttleTimeout = setTimeout(function() {
461
+ _throttleTimeout = void 0;
462
+ }, ms);
463
+ }
464
+ };
465
+ }
466
+ function cancelThrottle() {
467
+ clearTimeout(_throttleTimeout);
468
+ _throttleTimeout = void 0;
469
+ }
470
+ function scrollBy(el, x, y) {
471
+ el.scrollLeft += x;
472
+ el.scrollTop += y;
473
+ }
474
+ function clone(el) {
475
+ var Polymer = window.Polymer;
476
+ var $ = window.jQuery || window.Zepto;
477
+ if (Polymer && Polymer.dom) {
478
+ return Polymer.dom(el).cloneNode(true);
479
+ } else if ($) {
480
+ return $(el).clone(true)[0];
481
+ } else {
482
+ return el.cloneNode(true);
483
+ }
484
+ }
485
+ function getChildContainingRectFromElement(container, options, ghostEl2) {
486
+ var rect = {};
487
+ Array.from(container.children).forEach(function(child) {
488
+ var _rect$left, _rect$top, _rect$right, _rect$bottom;
489
+ if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl2)
490
+ return;
491
+ var childRect = getRect(child);
492
+ rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
493
+ rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
494
+ rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
495
+ rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
496
+ });
497
+ rect.width = rect.right - rect.left;
498
+ rect.height = rect.bottom - rect.top;
499
+ rect.x = rect.left;
500
+ rect.y = rect.top;
501
+ return rect;
502
+ }
503
+ var expando = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
504
+ function AnimationStateManager() {
505
+ var animationStates = [], animationCallbackId;
506
+ return {
507
+ captureAnimationState: function captureAnimationState() {
508
+ animationStates = [];
509
+ if (!this.options.animation)
510
+ return;
511
+ var children = [].slice.call(this.el.children);
512
+ children.forEach(function(child) {
513
+ if (css(child, "display") === "none" || child === Sortable.ghost)
514
+ return;
515
+ animationStates.push({
516
+ target: child,
517
+ rect: getRect(child)
518
+ });
519
+ var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);
520
+ if (child.thisAnimationDuration) {
521
+ var childMatrix = matrix(child, true);
522
+ if (childMatrix) {
523
+ fromRect.top -= childMatrix.f;
524
+ fromRect.left -= childMatrix.e;
525
+ }
526
+ }
527
+ child.fromRect = fromRect;
528
+ });
529
+ },
530
+ addAnimationState: function addAnimationState(state) {
531
+ animationStates.push(state);
532
+ },
533
+ removeAnimationState: function removeAnimationState(target) {
534
+ animationStates.splice(indexOfObject(animationStates, {
535
+ target
536
+ }), 1);
537
+ },
538
+ animateAll: function animateAll(callback) {
539
+ var _this = this;
540
+ if (!this.options.animation) {
541
+ clearTimeout(animationCallbackId);
542
+ if (typeof callback === "function")
543
+ callback();
544
+ return;
545
+ }
546
+ var animating = false, animationTime = 0;
547
+ animationStates.forEach(function(state) {
548
+ var time = 0, target = state.target, fromRect = target.fromRect, toRect = getRect(target), prevFromRect = target.prevFromRect, prevToRect = target.prevToRect, animatingRect = state.rect, targetMatrix = matrix(target, true);
549
+ if (targetMatrix) {
550
+ toRect.top -= targetMatrix.f;
551
+ toRect.left -= targetMatrix.e;
552
+ }
553
+ target.toRect = toRect;
554
+ if (target.thisAnimationDuration) {
555
+ if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect
556
+ (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
557
+ time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
558
+ }
559
+ }
560
+ if (!isRectEqual(toRect, fromRect)) {
561
+ target.prevFromRect = fromRect;
562
+ target.prevToRect = toRect;
563
+ if (!time) {
564
+ time = _this.options.animation;
565
+ }
566
+ _this.animate(target, animatingRect, toRect, time);
567
+ }
568
+ if (time) {
569
+ animating = true;
570
+ animationTime = Math.max(animationTime, time);
571
+ clearTimeout(target.animationResetTimer);
572
+ target.animationResetTimer = setTimeout(function() {
573
+ target.animationTime = 0;
574
+ target.prevFromRect = null;
575
+ target.fromRect = null;
576
+ target.prevToRect = null;
577
+ target.thisAnimationDuration = null;
578
+ }, time);
579
+ target.thisAnimationDuration = time;
580
+ }
581
+ });
582
+ clearTimeout(animationCallbackId);
583
+ if (!animating) {
584
+ if (typeof callback === "function")
585
+ callback();
586
+ } else {
587
+ animationCallbackId = setTimeout(function() {
588
+ if (typeof callback === "function")
589
+ callback();
590
+ }, animationTime);
591
+ }
592
+ animationStates = [];
593
+ },
594
+ animate: function animate(target, currentRect, toRect, duration) {
595
+ if (duration) {
596
+ css(target, "transition", "");
597
+ css(target, "transform", "");
598
+ var elMatrix = matrix(this.el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d, translateX = (currentRect.left - toRect.left) / (scaleX || 1), translateY = (currentRect.top - toRect.top) / (scaleY || 1);
599
+ target.animatingX = !!translateX;
600
+ target.animatingY = !!translateY;
601
+ css(target, "transform", "translate3d(" + translateX + "px," + translateY + "px,0)");
602
+ this.forRepaintDummy = repaint(target);
603
+ css(target, "transition", "transform " + duration + "ms" + (this.options.easing ? " " + this.options.easing : ""));
604
+ css(target, "transform", "translate3d(0,0,0)");
605
+ typeof target.animated === "number" && clearTimeout(target.animated);
606
+ target.animated = setTimeout(function() {
607
+ css(target, "transition", "");
608
+ css(target, "transform", "");
609
+ target.animated = false;
610
+ target.animatingX = false;
611
+ target.animatingY = false;
612
+ }, duration);
613
+ }
614
+ }
615
+ };
616
+ }
617
+ function repaint(target) {
618
+ return target.offsetWidth;
619
+ }
620
+ function calculateRealTime(animatingRect, fromRect, toRect, options) {
621
+ return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
622
+ }
623
+ var plugins = [];
624
+ var defaults = {
625
+ initializeByDefault: true
626
+ };
627
+ var PluginManager = {
628
+ mount: function mount(plugin) {
629
+ for (var option2 in defaults) {
630
+ if (defaults.hasOwnProperty(option2) && !(option2 in plugin)) {
631
+ plugin[option2] = defaults[option2];
632
+ }
633
+ }
634
+ plugins.forEach(function(p) {
635
+ if (p.pluginName === plugin.pluginName) {
636
+ throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
637
+ }
638
+ });
639
+ plugins.push(plugin);
640
+ },
641
+ pluginEvent: function pluginEvent(eventName, sortable, evt) {
642
+ var _this = this;
643
+ this.eventCanceled = false;
644
+ evt.cancel = function() {
645
+ _this.eventCanceled = true;
646
+ };
647
+ var eventNameGlobal = eventName + "Global";
648
+ plugins.forEach(function(plugin) {
649
+ if (!sortable[plugin.pluginName])
650
+ return;
651
+ if (sortable[plugin.pluginName][eventNameGlobal]) {
652
+ sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
653
+ sortable
654
+ }, evt));
655
+ }
656
+ if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
657
+ sortable[plugin.pluginName][eventName](_objectSpread2({
658
+ sortable
659
+ }, evt));
660
+ }
661
+ });
662
+ },
663
+ initializePlugins: function initializePlugins(sortable, el, defaults2, options) {
664
+ plugins.forEach(function(plugin) {
665
+ var pluginName = plugin.pluginName;
666
+ if (!sortable.options[pluginName] && !plugin.initializeByDefault)
667
+ return;
668
+ var initialized = new plugin(sortable, el, sortable.options);
669
+ initialized.sortable = sortable;
670
+ initialized.options = sortable.options;
671
+ sortable[pluginName] = initialized;
672
+ _extends(defaults2, initialized.defaults);
673
+ });
674
+ for (var option2 in sortable.options) {
675
+ if (!sortable.options.hasOwnProperty(option2))
676
+ continue;
677
+ var modified = this.modifyOption(sortable, option2, sortable.options[option2]);
678
+ if (typeof modified !== "undefined") {
679
+ sortable.options[option2] = modified;
680
+ }
681
+ }
682
+ },
683
+ getEventProperties: function getEventProperties(name, sortable) {
684
+ var eventProperties = {};
685
+ plugins.forEach(function(plugin) {
686
+ if (typeof plugin.eventProperties !== "function")
687
+ return;
688
+ _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
689
+ });
690
+ return eventProperties;
691
+ },
692
+ modifyOption: function modifyOption(sortable, name, value) {
693
+ var modifiedValue;
694
+ plugins.forEach(function(plugin) {
695
+ if (!sortable[plugin.pluginName])
696
+ return;
697
+ if (plugin.optionListeners && typeof plugin.optionListeners[name] === "function") {
698
+ modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
699
+ }
700
+ });
701
+ return modifiedValue;
702
+ }
703
+ };
704
+ function dispatchEvent(_ref) {
705
+ var sortable = _ref.sortable, rootEl2 = _ref.rootEl, name = _ref.name, targetEl = _ref.targetEl, cloneEl2 = _ref.cloneEl, toEl = _ref.toEl, fromEl = _ref.fromEl, oldIndex2 = _ref.oldIndex, newIndex2 = _ref.newIndex, oldDraggableIndex2 = _ref.oldDraggableIndex, newDraggableIndex2 = _ref.newDraggableIndex, originalEvent = _ref.originalEvent, putSortable2 = _ref.putSortable, extraEventProperties = _ref.extraEventProperties;
706
+ sortable = sortable || rootEl2 && rootEl2[expando];
707
+ if (!sortable)
708
+ return;
709
+ var evt, options = sortable.options, onName = "on" + name.charAt(0).toUpperCase() + name.substr(1);
710
+ if (window.CustomEvent && !IE11OrLess && !Edge) {
711
+ evt = new CustomEvent(name, {
712
+ bubbles: true,
713
+ cancelable: true
714
+ });
715
+ } else {
716
+ evt = document.createEvent("Event");
717
+ evt.initEvent(name, true, true);
718
+ }
719
+ evt.to = toEl || rootEl2;
720
+ evt.from = fromEl || rootEl2;
721
+ evt.item = targetEl || rootEl2;
722
+ evt.clone = cloneEl2;
723
+ evt.oldIndex = oldIndex2;
724
+ evt.newIndex = newIndex2;
725
+ evt.oldDraggableIndex = oldDraggableIndex2;
726
+ evt.newDraggableIndex = newDraggableIndex2;
727
+ evt.originalEvent = originalEvent;
728
+ evt.pullMode = putSortable2 ? putSortable2.lastPutMode : void 0;
729
+ var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
730
+ for (var option2 in allEventProperties) {
731
+ evt[option2] = allEventProperties[option2];
732
+ }
733
+ if (rootEl2) {
734
+ rootEl2.dispatchEvent(evt);
735
+ }
736
+ if (options[onName]) {
737
+ options[onName].call(sortable, evt);
738
+ }
739
+ }
740
+ var _excluded = ["evt"];
741
+ var pluginEvent2 = function pluginEvent3(eventName, sortable) {
742
+ var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, originalEvent = _ref.evt, data = _objectWithoutProperties(_ref, _excluded);
743
+ PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
744
+ dragEl,
745
+ parentEl,
746
+ ghostEl,
747
+ rootEl,
748
+ nextEl,
749
+ lastDownEl,
750
+ cloneEl,
751
+ cloneHidden,
752
+ dragStarted: moved,
753
+ putSortable,
754
+ activeSortable: Sortable.active,
755
+ originalEvent,
756
+ oldIndex,
757
+ oldDraggableIndex,
758
+ newIndex,
759
+ newDraggableIndex,
760
+ hideGhostForTarget: _hideGhostForTarget,
761
+ unhideGhostForTarget: _unhideGhostForTarget,
762
+ cloneNowHidden: function cloneNowHidden() {
763
+ cloneHidden = true;
764
+ },
765
+ cloneNowShown: function cloneNowShown() {
766
+ cloneHidden = false;
767
+ },
768
+ dispatchSortableEvent: function dispatchSortableEvent(name) {
769
+ _dispatchEvent({
770
+ sortable,
771
+ name,
772
+ originalEvent
773
+ });
774
+ }
775
+ }, data));
776
+ };
777
+ function _dispatchEvent(info) {
778
+ dispatchEvent(_objectSpread2({
779
+ putSortable,
780
+ cloneEl,
781
+ targetEl: dragEl,
782
+ rootEl,
783
+ oldIndex,
784
+ oldDraggableIndex,
785
+ newIndex,
786
+ newDraggableIndex
787
+ }, info));
788
+ }
789
+ var dragEl, parentEl, ghostEl, rootEl, nextEl, lastDownEl, cloneEl, cloneHidden, oldIndex, newIndex, oldDraggableIndex, newDraggableIndex, activeGroup, putSortable, awaitingDragStarted = false, ignoreNextClick = false, sortables = [], tapEvt, touchEvt, lastDx, lastDy, tapDistanceLeft, tapDistanceTop, moved, lastTarget, lastDirection, pastFirstInvertThresh = false, isCircumstantialInvert = false, targetMoveDistance, ghostRelativeParent, ghostRelativeParentInitialScroll = [], _silent = false, savedInputChecked = [];
790
+ var documentExists = typeof document !== "undefined", PositionGhostAbsolutely = IOS, CSSFloatProperty = Edge || IE11OrLess ? "cssFloat" : "float", supportDraggable = documentExists && !ChromeForAndroid && !IOS && "draggable" in document.createElement("div"), supportCssPointerEvents = function() {
791
+ if (!documentExists)
792
+ return;
793
+ if (IE11OrLess) {
794
+ return false;
795
+ }
796
+ var el = document.createElement("x");
797
+ el.style.cssText = "pointer-events:auto";
798
+ return el.style.pointerEvents === "auto";
799
+ }(), _detectDirection = function _detectDirection2(el, options) {
800
+ var elCSS = css(el), elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth), child1 = getChild(el, 0, options), child2 = getChild(el, 1, options), firstChildCSS = child1 && css(child1), secondChildCSS = child2 && css(child2), firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
801
+ if (elCSS.display === "flex") {
802
+ return elCSS.flexDirection === "column" || elCSS.flexDirection === "column-reverse" ? "vertical" : "horizontal";
803
+ }
804
+ if (elCSS.display === "grid") {
805
+ return elCSS.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
806
+ }
807
+ if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== "none") {
808
+ var touchingSideChild2 = firstChildCSS["float"] === "left" ? "left" : "right";
809
+ return child2 && (secondChildCSS.clear === "both" || secondChildCSS.clear === touchingSideChild2) ? "vertical" : "horizontal";
810
+ }
811
+ return child1 && (firstChildCSS.display === "block" || firstChildCSS.display === "flex" || firstChildCSS.display === "table" || firstChildCSS.display === "grid" || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === "none" || child2 && elCSS[CSSFloatProperty] === "none" && firstChildWidth + secondChildWidth > elWidth) ? "vertical" : "horizontal";
812
+ }, _dragElInRowColumn = function _dragElInRowColumn2(dragRect, targetRect, vertical) {
813
+ var dragElS1Opp = vertical ? dragRect.left : dragRect.top, dragElS2Opp = vertical ? dragRect.right : dragRect.bottom, dragElOppLength = vertical ? dragRect.width : dragRect.height, targetS1Opp = vertical ? targetRect.left : targetRect.top, targetS2Opp = vertical ? targetRect.right : targetRect.bottom, targetOppLength = vertical ? targetRect.width : targetRect.height;
814
+ return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
815
+ }, _detectNearestEmptySortable = function _detectNearestEmptySortable2(x, y) {
816
+ var ret;
817
+ sortables.some(function(sortable) {
818
+ var threshold = sortable[expando].options.emptyInsertThreshold;
819
+ if (!threshold || lastChild(sortable))
820
+ return;
821
+ var rect = getRect(sortable), insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold, insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
822
+ if (insideHorizontally && insideVertically) {
823
+ return ret = sortable;
824
+ }
825
+ });
826
+ return ret;
827
+ }, _prepareGroup = function _prepareGroup2(options) {
828
+ function toFn(value, pull) {
829
+ return function(to, from, dragEl2, evt) {
830
+ var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
831
+ if (value == null && (pull || sameGroup)) {
832
+ return true;
833
+ } else if (value == null || value === false) {
834
+ return false;
835
+ } else if (pull && value === "clone") {
836
+ return value;
837
+ } else if (typeof value === "function") {
838
+ return toFn(value(to, from, dragEl2, evt), pull)(to, from, dragEl2, evt);
839
+ } else {
840
+ var otherGroup = (pull ? to : from).options.group.name;
841
+ return value === true || typeof value === "string" && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
842
+ }
843
+ };
844
+ }
845
+ var group = {};
846
+ var originalGroup = options.group;
847
+ if (!originalGroup || _typeof(originalGroup) != "object") {
848
+ originalGroup = {
849
+ name: originalGroup
850
+ };
851
+ }
852
+ group.name = originalGroup.name;
853
+ group.checkPull = toFn(originalGroup.pull, true);
854
+ group.checkPut = toFn(originalGroup.put);
855
+ group.revertClone = originalGroup.revertClone;
856
+ options.group = group;
857
+ }, _hideGhostForTarget = function _hideGhostForTarget2() {
858
+ if (!supportCssPointerEvents && ghostEl) {
859
+ css(ghostEl, "display", "none");
860
+ }
861
+ }, _unhideGhostForTarget = function _unhideGhostForTarget2() {
862
+ if (!supportCssPointerEvents && ghostEl) {
863
+ css(ghostEl, "display", "");
864
+ }
865
+ };
866
+ if (documentExists && !ChromeForAndroid) {
867
+ document.addEventListener("click", function(evt) {
868
+ if (ignoreNextClick) {
869
+ evt.preventDefault();
870
+ evt.stopPropagation && evt.stopPropagation();
871
+ evt.stopImmediatePropagation && evt.stopImmediatePropagation();
872
+ ignoreNextClick = false;
873
+ return false;
874
+ }
875
+ }, true);
876
+ }
877
+ var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent2(evt) {
878
+ if (dragEl) {
879
+ evt = evt.touches ? evt.touches[0] : evt;
880
+ var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
881
+ if (nearest) {
882
+ var event = {};
883
+ for (var i in evt) {
884
+ if (evt.hasOwnProperty(i)) {
885
+ event[i] = evt[i];
886
+ }
887
+ }
888
+ event.target = event.rootEl = nearest;
889
+ event.preventDefault = void 0;
890
+ event.stopPropagation = void 0;
891
+ nearest[expando]._onDragOver(event);
892
+ }
893
+ }
894
+ };
895
+ var _checkOutsideTargetEl = function _checkOutsideTargetEl2(evt) {
896
+ if (dragEl) {
897
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
898
+ }
899
+ };
900
+ function Sortable(el, options) {
901
+ if (!(el && el.nodeType && el.nodeType === 1)) {
902
+ throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
903
+ }
904
+ this.el = el;
905
+ this.options = options = _extends({}, options);
906
+ el[expando] = this;
907
+ var defaults2 = {
908
+ group: null,
909
+ sort: true,
910
+ disabled: false,
911
+ store: null,
912
+ handle: null,
913
+ draggable: /^[uo]l$/i.test(el.nodeName) ? ">li" : ">*",
914
+ swapThreshold: 1,
915
+ // percentage; 0 <= x <= 1
916
+ invertSwap: false,
917
+ // invert always
918
+ invertedSwapThreshold: null,
919
+ // will be set to same as swapThreshold if default
920
+ removeCloneOnHide: true,
921
+ direction: function direction() {
922
+ return _detectDirection(el, this.options);
923
+ },
924
+ ghostClass: "sortable-ghost",
925
+ chosenClass: "sortable-chosen",
926
+ dragClass: "sortable-drag",
927
+ ignore: "a, img",
928
+ filter: null,
929
+ preventOnFilter: true,
930
+ animation: 0,
931
+ easing: null,
932
+ setData: function setData(dataTransfer, dragEl2) {
933
+ dataTransfer.setData("Text", dragEl2.textContent);
934
+ },
935
+ dropBubble: false,
936
+ dragoverBubble: false,
937
+ dataIdAttr: "data-id",
938
+ delay: 0,
939
+ delayOnTouchOnly: false,
940
+ touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
941
+ forceFallback: false,
942
+ fallbackClass: "sortable-fallback",
943
+ fallbackOnBody: false,
944
+ fallbackTolerance: 0,
945
+ fallbackOffset: {
946
+ x: 0,
947
+ y: 0
948
+ },
949
+ supportPointer: Sortable.supportPointer !== false && "PointerEvent" in window && !Safari,
950
+ emptyInsertThreshold: 5
951
+ };
952
+ PluginManager.initializePlugins(this, el, defaults2);
953
+ for (var name in defaults2) {
954
+ !(name in options) && (options[name] = defaults2[name]);
955
+ }
956
+ _prepareGroup(options);
957
+ for (var fn in this) {
958
+ if (fn.charAt(0) === "_" && typeof this[fn] === "function") {
959
+ this[fn] = this[fn].bind(this);
960
+ }
961
+ }
962
+ this.nativeDraggable = options.forceFallback ? false : supportDraggable;
963
+ if (this.nativeDraggable) {
964
+ this.options.touchStartThreshold = 1;
965
+ }
966
+ if (options.supportPointer) {
967
+ on(el, "pointerdown", this._onTapStart);
968
+ } else {
969
+ on(el, "mousedown", this._onTapStart);
970
+ on(el, "touchstart", this._onTapStart);
971
+ }
972
+ if (this.nativeDraggable) {
973
+ on(el, "dragover", this);
974
+ on(el, "dragenter", this);
975
+ }
976
+ sortables.push(this.el);
977
+ options.store && options.store.get && this.sort(options.store.get(this) || []);
978
+ _extends(this, AnimationStateManager());
979
+ }
980
+ Sortable.prototype = /** @lends Sortable.prototype */
981
+ {
982
+ constructor: Sortable,
983
+ _isOutsideThisEl: function _isOutsideThisEl(target) {
984
+ if (!this.el.contains(target) && target !== this.el) {
985
+ lastTarget = null;
986
+ }
987
+ },
988
+ _getDirection: function _getDirection(evt, target) {
989
+ return typeof this.options.direction === "function" ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
990
+ },
991
+ _onTapStart: function _onTapStart(evt) {
992
+ if (!evt.cancelable)
993
+ return;
994
+ var _this = this, el = this.el, options = this.options, preventOnFilter = options.preventOnFilter, type = evt.type, touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === "touch" && evt, target = (touch || evt).target, originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target, filter = options.filter;
995
+ _saveInputCheckedState(el);
996
+ if (dragEl) {
997
+ return;
998
+ }
999
+ if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
1000
+ return;
1001
+ }
1002
+ if (originalTarget.isContentEditable) {
1003
+ return;
1004
+ }
1005
+ if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === "SELECT") {
1006
+ return;
1007
+ }
1008
+ target = closest(target, options.draggable, el, false);
1009
+ if (target && target.animated) {
1010
+ return;
1011
+ }
1012
+ if (lastDownEl === target) {
1013
+ return;
1014
+ }
1015
+ oldIndex = index(target);
1016
+ oldDraggableIndex = index(target, options.draggable);
1017
+ if (typeof filter === "function") {
1018
+ if (filter.call(this, evt, target, this)) {
1019
+ _dispatchEvent({
1020
+ sortable: _this,
1021
+ rootEl: originalTarget,
1022
+ name: "filter",
1023
+ targetEl: target,
1024
+ toEl: el,
1025
+ fromEl: el
1026
+ });
1027
+ pluginEvent2("filter", _this, {
1028
+ evt
1029
+ });
1030
+ preventOnFilter && evt.cancelable && evt.preventDefault();
1031
+ return;
1032
+ }
1033
+ } else if (filter) {
1034
+ filter = filter.split(",").some(function(criteria) {
1035
+ criteria = closest(originalTarget, criteria.trim(), el, false);
1036
+ if (criteria) {
1037
+ _dispatchEvent({
1038
+ sortable: _this,
1039
+ rootEl: criteria,
1040
+ name: "filter",
1041
+ targetEl: target,
1042
+ fromEl: el,
1043
+ toEl: el
1044
+ });
1045
+ pluginEvent2("filter", _this, {
1046
+ evt
1047
+ });
1048
+ return true;
1049
+ }
1050
+ });
1051
+ if (filter) {
1052
+ preventOnFilter && evt.cancelable && evt.preventDefault();
1053
+ return;
1054
+ }
1055
+ }
1056
+ if (options.handle && !closest(originalTarget, options.handle, el, false)) {
1057
+ return;
1058
+ }
1059
+ this._prepareDragStart(evt, touch, target);
1060
+ },
1061
+ _prepareDragStart: function _prepareDragStart(evt, touch, target) {
1062
+ var _this = this, el = _this.el, options = _this.options, ownerDocument = el.ownerDocument, dragStartFn;
1063
+ if (target && !dragEl && target.parentNode === el) {
1064
+ var dragRect = getRect(target);
1065
+ rootEl = el;
1066
+ dragEl = target;
1067
+ parentEl = dragEl.parentNode;
1068
+ nextEl = dragEl.nextSibling;
1069
+ lastDownEl = target;
1070
+ activeGroup = options.group;
1071
+ Sortable.dragged = dragEl;
1072
+ tapEvt = {
1073
+ target: dragEl,
1074
+ clientX: (touch || evt).clientX,
1075
+ clientY: (touch || evt).clientY
1076
+ };
1077
+ tapDistanceLeft = tapEvt.clientX - dragRect.left;
1078
+ tapDistanceTop = tapEvt.clientY - dragRect.top;
1079
+ this._lastX = (touch || evt).clientX;
1080
+ this._lastY = (touch || evt).clientY;
1081
+ dragEl.style["will-change"] = "all";
1082
+ dragStartFn = function dragStartFn2() {
1083
+ pluginEvent2("delayEnded", _this, {
1084
+ evt
1085
+ });
1086
+ if (Sortable.eventCanceled) {
1087
+ _this._onDrop();
1088
+ return;
1089
+ }
1090
+ _this._disableDelayedDragEvents();
1091
+ if (!FireFox && _this.nativeDraggable) {
1092
+ dragEl.draggable = true;
1093
+ }
1094
+ _this._triggerDragStart(evt, touch);
1095
+ _dispatchEvent({
1096
+ sortable: _this,
1097
+ name: "choose",
1098
+ originalEvent: evt
1099
+ });
1100
+ toggleClass(dragEl, options.chosenClass, true);
1101
+ };
1102
+ options.ignore.split(",").forEach(function(criteria) {
1103
+ find(dragEl, criteria.trim(), _disableDraggable);
1104
+ });
1105
+ on(ownerDocument, "dragover", nearestEmptyInsertDetectEvent);
1106
+ on(ownerDocument, "mousemove", nearestEmptyInsertDetectEvent);
1107
+ on(ownerDocument, "touchmove", nearestEmptyInsertDetectEvent);
1108
+ on(ownerDocument, "mouseup", _this._onDrop);
1109
+ on(ownerDocument, "touchend", _this._onDrop);
1110
+ on(ownerDocument, "touchcancel", _this._onDrop);
1111
+ if (FireFox && this.nativeDraggable) {
1112
+ this.options.touchStartThreshold = 4;
1113
+ dragEl.draggable = true;
1114
+ }
1115
+ pluginEvent2("delayStart", this, {
1116
+ evt
1117
+ });
1118
+ if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
1119
+ if (Sortable.eventCanceled) {
1120
+ this._onDrop();
1121
+ return;
1122
+ }
1123
+ on(ownerDocument, "mouseup", _this._disableDelayedDrag);
1124
+ on(ownerDocument, "touchend", _this._disableDelayedDrag);
1125
+ on(ownerDocument, "touchcancel", _this._disableDelayedDrag);
1126
+ on(ownerDocument, "mousemove", _this._delayedDragTouchMoveHandler);
1127
+ on(ownerDocument, "touchmove", _this._delayedDragTouchMoveHandler);
1128
+ options.supportPointer && on(ownerDocument, "pointermove", _this._delayedDragTouchMoveHandler);
1129
+ _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
1130
+ } else {
1131
+ dragStartFn();
1132
+ }
1133
+ }
1134
+ },
1135
+ _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(e) {
1136
+ var touch = e.touches ? e.touches[0] : e;
1137
+ if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
1138
+ this._disableDelayedDrag();
1139
+ }
1140
+ },
1141
+ _disableDelayedDrag: function _disableDelayedDrag() {
1142
+ dragEl && _disableDraggable(dragEl);
1143
+ clearTimeout(this._dragStartTimer);
1144
+ this._disableDelayedDragEvents();
1145
+ },
1146
+ _disableDelayedDragEvents: function _disableDelayedDragEvents() {
1147
+ var ownerDocument = this.el.ownerDocument;
1148
+ off(ownerDocument, "mouseup", this._disableDelayedDrag);
1149
+ off(ownerDocument, "touchend", this._disableDelayedDrag);
1150
+ off(ownerDocument, "touchcancel", this._disableDelayedDrag);
1151
+ off(ownerDocument, "mousemove", this._delayedDragTouchMoveHandler);
1152
+ off(ownerDocument, "touchmove", this._delayedDragTouchMoveHandler);
1153
+ off(ownerDocument, "pointermove", this._delayedDragTouchMoveHandler);
1154
+ },
1155
+ _triggerDragStart: function _triggerDragStart(evt, touch) {
1156
+ touch = touch || evt.pointerType == "touch" && evt;
1157
+ if (!this.nativeDraggable || touch) {
1158
+ if (this.options.supportPointer) {
1159
+ on(document, "pointermove", this._onTouchMove);
1160
+ } else if (touch) {
1161
+ on(document, "touchmove", this._onTouchMove);
1162
+ } else {
1163
+ on(document, "mousemove", this._onTouchMove);
1164
+ }
1165
+ } else {
1166
+ on(dragEl, "dragend", this);
1167
+ on(rootEl, "dragstart", this._onDragStart);
1168
+ }
1169
+ try {
1170
+ if (document.selection) {
1171
+ _nextTick(function() {
1172
+ document.selection.empty();
1173
+ });
1174
+ } else {
1175
+ window.getSelection().removeAllRanges();
1176
+ }
1177
+ } catch (err) {
1178
+ }
1179
+ },
1180
+ _dragStarted: function _dragStarted(fallback, evt) {
1181
+ awaitingDragStarted = false;
1182
+ if (rootEl && dragEl) {
1183
+ pluginEvent2("dragStarted", this, {
1184
+ evt
1185
+ });
1186
+ if (this.nativeDraggable) {
1187
+ on(document, "dragover", _checkOutsideTargetEl);
1188
+ }
1189
+ var options = this.options;
1190
+ !fallback && toggleClass(dragEl, options.dragClass, false);
1191
+ toggleClass(dragEl, options.ghostClass, true);
1192
+ Sortable.active = this;
1193
+ fallback && this._appendGhost();
1194
+ _dispatchEvent({
1195
+ sortable: this,
1196
+ name: "start",
1197
+ originalEvent: evt
1198
+ });
1199
+ } else {
1200
+ this._nulling();
1201
+ }
1202
+ },
1203
+ _emulateDragOver: function _emulateDragOver() {
1204
+ if (touchEvt) {
1205
+ this._lastX = touchEvt.clientX;
1206
+ this._lastY = touchEvt.clientY;
1207
+ _hideGhostForTarget();
1208
+ var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
1209
+ var parent = target;
1210
+ while (target && target.shadowRoot) {
1211
+ target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
1212
+ if (target === parent)
1213
+ break;
1214
+ parent = target;
1215
+ }
1216
+ dragEl.parentNode[expando]._isOutsideThisEl(target);
1217
+ if (parent) {
1218
+ do {
1219
+ if (parent[expando]) {
1220
+ var inserted = void 0;
1221
+ inserted = parent[expando]._onDragOver({
1222
+ clientX: touchEvt.clientX,
1223
+ clientY: touchEvt.clientY,
1224
+ target,
1225
+ rootEl: parent
1226
+ });
1227
+ if (inserted && !this.options.dragoverBubble) {
1228
+ break;
1229
+ }
1230
+ }
1231
+ target = parent;
1232
+ } while (parent = parent.parentNode);
1233
+ }
1234
+ _unhideGhostForTarget();
1235
+ }
1236
+ },
1237
+ _onTouchMove: function _onTouchMove(evt) {
1238
+ if (tapEvt) {
1239
+ var options = this.options, fallbackTolerance = options.fallbackTolerance, fallbackOffset = options.fallbackOffset, touch = evt.touches ? evt.touches[0] : evt, ghostMatrix = ghostEl && matrix(ghostEl, true), scaleX = ghostEl && ghostMatrix && ghostMatrix.a, scaleY = ghostEl && ghostMatrix && ghostMatrix.d, relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent), dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1), dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);
1240
+ if (!Sortable.active && !awaitingDragStarted) {
1241
+ if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
1242
+ return;
1243
+ }
1244
+ this._onDragStart(evt, true);
1245
+ }
1246
+ if (ghostEl) {
1247
+ if (ghostMatrix) {
1248
+ ghostMatrix.e += dx - (lastDx || 0);
1249
+ ghostMatrix.f += dy - (lastDy || 0);
1250
+ } else {
1251
+ ghostMatrix = {
1252
+ a: 1,
1253
+ b: 0,
1254
+ c: 0,
1255
+ d: 1,
1256
+ e: dx,
1257
+ f: dy
1258
+ };
1259
+ }
1260
+ var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
1261
+ css(ghostEl, "webkitTransform", cssMatrix);
1262
+ css(ghostEl, "mozTransform", cssMatrix);
1263
+ css(ghostEl, "msTransform", cssMatrix);
1264
+ css(ghostEl, "transform", cssMatrix);
1265
+ lastDx = dx;
1266
+ lastDy = dy;
1267
+ touchEvt = touch;
1268
+ }
1269
+ evt.cancelable && evt.preventDefault();
1270
+ }
1271
+ },
1272
+ _appendGhost: function _appendGhost() {
1273
+ if (!ghostEl) {
1274
+ var container = this.options.fallbackOnBody ? document.body : rootEl, rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), options = this.options;
1275
+ if (PositionGhostAbsolutely) {
1276
+ ghostRelativeParent = container;
1277
+ while (css(ghostRelativeParent, "position") === "static" && css(ghostRelativeParent, "transform") === "none" && ghostRelativeParent !== document) {
1278
+ ghostRelativeParent = ghostRelativeParent.parentNode;
1279
+ }
1280
+ if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
1281
+ if (ghostRelativeParent === document)
1282
+ ghostRelativeParent = getWindowScrollingElement();
1283
+ rect.top += ghostRelativeParent.scrollTop;
1284
+ rect.left += ghostRelativeParent.scrollLeft;
1285
+ } else {
1286
+ ghostRelativeParent = getWindowScrollingElement();
1287
+ }
1288
+ ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
1289
+ }
1290
+ ghostEl = dragEl.cloneNode(true);
1291
+ toggleClass(ghostEl, options.ghostClass, false);
1292
+ toggleClass(ghostEl, options.fallbackClass, true);
1293
+ toggleClass(ghostEl, options.dragClass, true);
1294
+ css(ghostEl, "transition", "");
1295
+ css(ghostEl, "transform", "");
1296
+ css(ghostEl, "box-sizing", "border-box");
1297
+ css(ghostEl, "margin", 0);
1298
+ css(ghostEl, "top", rect.top);
1299
+ css(ghostEl, "left", rect.left);
1300
+ css(ghostEl, "width", rect.width);
1301
+ css(ghostEl, "height", rect.height);
1302
+ css(ghostEl, "opacity", "0.8");
1303
+ css(ghostEl, "position", PositionGhostAbsolutely ? "absolute" : "fixed");
1304
+ css(ghostEl, "zIndex", "100000");
1305
+ css(ghostEl, "pointerEvents", "none");
1306
+ Sortable.ghost = ghostEl;
1307
+ container.appendChild(ghostEl);
1308
+ css(ghostEl, "transform-origin", tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + "% " + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + "%");
1309
+ }
1310
+ },
1311
+ _onDragStart: function _onDragStart(evt, fallback) {
1312
+ var _this = this;
1313
+ var dataTransfer = evt.dataTransfer;
1314
+ var options = _this.options;
1315
+ pluginEvent2("dragStart", this, {
1316
+ evt
1317
+ });
1318
+ if (Sortable.eventCanceled) {
1319
+ this._onDrop();
1320
+ return;
1321
+ }
1322
+ pluginEvent2("setupClone", this);
1323
+ if (!Sortable.eventCanceled) {
1324
+ cloneEl = clone(dragEl);
1325
+ cloneEl.removeAttribute("id");
1326
+ cloneEl.draggable = false;
1327
+ cloneEl.style["will-change"] = "";
1328
+ this._hideClone();
1329
+ toggleClass(cloneEl, this.options.chosenClass, false);
1330
+ Sortable.clone = cloneEl;
1331
+ }
1332
+ _this.cloneId = _nextTick(function() {
1333
+ pluginEvent2("clone", _this);
1334
+ if (Sortable.eventCanceled)
1335
+ return;
1336
+ if (!_this.options.removeCloneOnHide) {
1337
+ rootEl.insertBefore(cloneEl, dragEl);
1338
+ }
1339
+ _this._hideClone();
1340
+ _dispatchEvent({
1341
+ sortable: _this,
1342
+ name: "clone"
1343
+ });
1344
+ });
1345
+ !fallback && toggleClass(dragEl, options.dragClass, true);
1346
+ if (fallback) {
1347
+ ignoreNextClick = true;
1348
+ _this._loopId = setInterval(_this._emulateDragOver, 50);
1349
+ } else {
1350
+ off(document, "mouseup", _this._onDrop);
1351
+ off(document, "touchend", _this._onDrop);
1352
+ off(document, "touchcancel", _this._onDrop);
1353
+ if (dataTransfer) {
1354
+ dataTransfer.effectAllowed = "move";
1355
+ options.setData && options.setData.call(_this, dataTransfer, dragEl);
1356
+ }
1357
+ on(document, "drop", _this);
1358
+ css(dragEl, "transform", "translateZ(0)");
1359
+ }
1360
+ awaitingDragStarted = true;
1361
+ _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
1362
+ on(document, "selectstart", _this);
1363
+ moved = true;
1364
+ if (Safari) {
1365
+ css(document.body, "user-select", "none");
1366
+ }
1367
+ },
1368
+ // Returns true - if no further action is needed (either inserted or another condition)
1369
+ _onDragOver: function _onDragOver(evt) {
1370
+ var el = this.el, target = evt.target, dragRect, targetRect, revert, options = this.options, group = options.group, activeSortable = Sortable.active, isOwner = activeGroup === group, canSort = options.sort, fromSortable = putSortable || activeSortable, vertical, _this = this, completedFired = false;
1371
+ if (_silent)
1372
+ return;
1373
+ function dragOverEvent(name, extra) {
1374
+ pluginEvent2(name, _this, _objectSpread2({
1375
+ evt,
1376
+ isOwner,
1377
+ axis: vertical ? "vertical" : "horizontal",
1378
+ revert,
1379
+ dragRect,
1380
+ targetRect,
1381
+ canSort,
1382
+ fromSortable,
1383
+ target,
1384
+ completed,
1385
+ onMove: function onMove(target2, after2) {
1386
+ return _onMove(rootEl, el, dragEl, dragRect, target2, getRect(target2), evt, after2);
1387
+ },
1388
+ changed
1389
+ }, extra));
1390
+ }
1391
+ function capture() {
1392
+ dragOverEvent("dragOverAnimationCapture");
1393
+ _this.captureAnimationState();
1394
+ if (_this !== fromSortable) {
1395
+ fromSortable.captureAnimationState();
1396
+ }
1397
+ }
1398
+ function completed(insertion) {
1399
+ dragOverEvent("dragOverCompleted", {
1400
+ insertion
1401
+ });
1402
+ if (insertion) {
1403
+ if (isOwner) {
1404
+ activeSortable._hideClone();
1405
+ } else {
1406
+ activeSortable._showClone(_this);
1407
+ }
1408
+ if (_this !== fromSortable) {
1409
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
1410
+ toggleClass(dragEl, options.ghostClass, true);
1411
+ }
1412
+ if (putSortable !== _this && _this !== Sortable.active) {
1413
+ putSortable = _this;
1414
+ } else if (_this === Sortable.active && putSortable) {
1415
+ putSortable = null;
1416
+ }
1417
+ if (fromSortable === _this) {
1418
+ _this._ignoreWhileAnimating = target;
1419
+ }
1420
+ _this.animateAll(function() {
1421
+ dragOverEvent("dragOverAnimationComplete");
1422
+ _this._ignoreWhileAnimating = null;
1423
+ });
1424
+ if (_this !== fromSortable) {
1425
+ fromSortable.animateAll();
1426
+ fromSortable._ignoreWhileAnimating = null;
1427
+ }
1428
+ }
1429
+ if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
1430
+ lastTarget = null;
1431
+ }
1432
+ if (!options.dragoverBubble && !evt.rootEl && target !== document) {
1433
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
1434
+ !insertion && nearestEmptyInsertDetectEvent(evt);
1435
+ }
1436
+ !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
1437
+ return completedFired = true;
1438
+ }
1439
+ function changed() {
1440
+ newIndex = index(dragEl);
1441
+ newDraggableIndex = index(dragEl, options.draggable);
1442
+ _dispatchEvent({
1443
+ sortable: _this,
1444
+ name: "change",
1445
+ toEl: el,
1446
+ newIndex,
1447
+ newDraggableIndex,
1448
+ originalEvent: evt
1449
+ });
1450
+ }
1451
+ if (evt.preventDefault !== void 0) {
1452
+ evt.cancelable && evt.preventDefault();
1453
+ }
1454
+ target = closest(target, options.draggable, el, true);
1455
+ dragOverEvent("dragOver");
1456
+ if (Sortable.eventCanceled)
1457
+ return completedFired;
1458
+ if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
1459
+ return completed(false);
1460
+ }
1461
+ ignoreNextClick = false;
1462
+ if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
1463
+ vertical = this._getDirection(evt, target) === "vertical";
1464
+ dragRect = getRect(dragEl);
1465
+ dragOverEvent("dragOverValid");
1466
+ if (Sortable.eventCanceled)
1467
+ return completedFired;
1468
+ if (revert) {
1469
+ parentEl = rootEl;
1470
+ capture();
1471
+ this._hideClone();
1472
+ dragOverEvent("revert");
1473
+ if (!Sortable.eventCanceled) {
1474
+ if (nextEl) {
1475
+ rootEl.insertBefore(dragEl, nextEl);
1476
+ } else {
1477
+ rootEl.appendChild(dragEl);
1478
+ }
1479
+ }
1480
+ return completed(true);
1481
+ }
1482
+ var elLastChild = lastChild(el, options.draggable);
1483
+ if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
1484
+ if (elLastChild === dragEl) {
1485
+ return completed(false);
1486
+ }
1487
+ if (elLastChild && el === evt.target) {
1488
+ target = elLastChild;
1489
+ }
1490
+ if (target) {
1491
+ targetRect = getRect(target);
1492
+ }
1493
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
1494
+ capture();
1495
+ if (elLastChild && elLastChild.nextSibling) {
1496
+ el.insertBefore(dragEl, elLastChild.nextSibling);
1497
+ } else {
1498
+ el.appendChild(dragEl);
1499
+ }
1500
+ parentEl = el;
1501
+ changed();
1502
+ return completed(true);
1503
+ }
1504
+ } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
1505
+ var firstChild = getChild(el, 0, options, true);
1506
+ if (firstChild === dragEl) {
1507
+ return completed(false);
1508
+ }
1509
+ target = firstChild;
1510
+ targetRect = getRect(target);
1511
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
1512
+ capture();
1513
+ el.insertBefore(dragEl, firstChild);
1514
+ parentEl = el;
1515
+ changed();
1516
+ return completed(true);
1517
+ }
1518
+ } else if (target.parentNode === el) {
1519
+ targetRect = getRect(target);
1520
+ var direction = 0, targetBeforeFirstSwap, differentLevel = dragEl.parentNode !== el, differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical), side1 = vertical ? "top" : "left", scrolledPastTop = isScrolledPast(target, "top", "top") || isScrolledPast(dragEl, "top", "top"), scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
1521
+ if (lastTarget !== target) {
1522
+ targetBeforeFirstSwap = targetRect[side1];
1523
+ pastFirstInvertThresh = false;
1524
+ isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
1525
+ }
1526
+ direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
1527
+ var sibling;
1528
+ if (direction !== 0) {
1529
+ var dragIndex = index(dragEl);
1530
+ do {
1531
+ dragIndex -= direction;
1532
+ sibling = parentEl.children[dragIndex];
1533
+ } while (sibling && (css(sibling, "display") === "none" || sibling === ghostEl));
1534
+ }
1535
+ if (direction === 0 || sibling === target) {
1536
+ return completed(false);
1537
+ }
1538
+ lastTarget = target;
1539
+ lastDirection = direction;
1540
+ var nextSibling = target.nextElementSibling, after = false;
1541
+ after = direction === 1;
1542
+ var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
1543
+ if (moveVector !== false) {
1544
+ if (moveVector === 1 || moveVector === -1) {
1545
+ after = moveVector === 1;
1546
+ }
1547
+ _silent = true;
1548
+ setTimeout(_unsilent, 30);
1549
+ capture();
1550
+ if (after && !nextSibling) {
1551
+ el.appendChild(dragEl);
1552
+ } else {
1553
+ target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
1554
+ }
1555
+ if (scrolledPastTop) {
1556
+ scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
1557
+ }
1558
+ parentEl = dragEl.parentNode;
1559
+ if (targetBeforeFirstSwap !== void 0 && !isCircumstantialInvert) {
1560
+ targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
1561
+ }
1562
+ changed();
1563
+ return completed(true);
1564
+ }
1565
+ }
1566
+ if (el.contains(dragEl)) {
1567
+ return completed(false);
1568
+ }
1569
+ }
1570
+ return false;
1571
+ },
1572
+ _ignoreWhileAnimating: null,
1573
+ _offMoveEvents: function _offMoveEvents() {
1574
+ off(document, "mousemove", this._onTouchMove);
1575
+ off(document, "touchmove", this._onTouchMove);
1576
+ off(document, "pointermove", this._onTouchMove);
1577
+ off(document, "dragover", nearestEmptyInsertDetectEvent);
1578
+ off(document, "mousemove", nearestEmptyInsertDetectEvent);
1579
+ off(document, "touchmove", nearestEmptyInsertDetectEvent);
1580
+ },
1581
+ _offUpEvents: function _offUpEvents() {
1582
+ var ownerDocument = this.el.ownerDocument;
1583
+ off(ownerDocument, "mouseup", this._onDrop);
1584
+ off(ownerDocument, "touchend", this._onDrop);
1585
+ off(ownerDocument, "pointerup", this._onDrop);
1586
+ off(ownerDocument, "touchcancel", this._onDrop);
1587
+ off(document, "selectstart", this);
1588
+ },
1589
+ _onDrop: function _onDrop(evt) {
1590
+ var el = this.el, options = this.options;
1591
+ newIndex = index(dragEl);
1592
+ newDraggableIndex = index(dragEl, options.draggable);
1593
+ pluginEvent2("drop", this, {
1594
+ evt
1595
+ });
1596
+ parentEl = dragEl && dragEl.parentNode;
1597
+ newIndex = index(dragEl);
1598
+ newDraggableIndex = index(dragEl, options.draggable);
1599
+ if (Sortable.eventCanceled) {
1600
+ this._nulling();
1601
+ return;
1602
+ }
1603
+ awaitingDragStarted = false;
1604
+ isCircumstantialInvert = false;
1605
+ pastFirstInvertThresh = false;
1606
+ clearInterval(this._loopId);
1607
+ clearTimeout(this._dragStartTimer);
1608
+ _cancelNextTick(this.cloneId);
1609
+ _cancelNextTick(this._dragStartId);
1610
+ if (this.nativeDraggable) {
1611
+ off(document, "drop", this);
1612
+ off(el, "dragstart", this._onDragStart);
1613
+ }
1614
+ this._offMoveEvents();
1615
+ this._offUpEvents();
1616
+ if (Safari) {
1617
+ css(document.body, "user-select", "");
1618
+ }
1619
+ css(dragEl, "transform", "");
1620
+ if (evt) {
1621
+ if (moved) {
1622
+ evt.cancelable && evt.preventDefault();
1623
+ !options.dropBubble && evt.stopPropagation();
1624
+ }
1625
+ ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
1626
+ if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== "clone") {
1627
+ cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
1628
+ }
1629
+ if (dragEl) {
1630
+ if (this.nativeDraggable) {
1631
+ off(dragEl, "dragend", this);
1632
+ }
1633
+ _disableDraggable(dragEl);
1634
+ dragEl.style["will-change"] = "";
1635
+ if (moved && !awaitingDragStarted) {
1636
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
1637
+ }
1638
+ toggleClass(dragEl, this.options.chosenClass, false);
1639
+ _dispatchEvent({
1640
+ sortable: this,
1641
+ name: "unchoose",
1642
+ toEl: parentEl,
1643
+ newIndex: null,
1644
+ newDraggableIndex: null,
1645
+ originalEvent: evt
1646
+ });
1647
+ if (rootEl !== parentEl) {
1648
+ if (newIndex >= 0) {
1649
+ _dispatchEvent({
1650
+ rootEl: parentEl,
1651
+ name: "add",
1652
+ toEl: parentEl,
1653
+ fromEl: rootEl,
1654
+ originalEvent: evt
1655
+ });
1656
+ _dispatchEvent({
1657
+ sortable: this,
1658
+ name: "remove",
1659
+ toEl: parentEl,
1660
+ originalEvent: evt
1661
+ });
1662
+ _dispatchEvent({
1663
+ rootEl: parentEl,
1664
+ name: "sort",
1665
+ toEl: parentEl,
1666
+ fromEl: rootEl,
1667
+ originalEvent: evt
1668
+ });
1669
+ _dispatchEvent({
1670
+ sortable: this,
1671
+ name: "sort",
1672
+ toEl: parentEl,
1673
+ originalEvent: evt
1674
+ });
1675
+ }
1676
+ putSortable && putSortable.save();
1677
+ } else {
1678
+ if (newIndex !== oldIndex) {
1679
+ if (newIndex >= 0) {
1680
+ _dispatchEvent({
1681
+ sortable: this,
1682
+ name: "update",
1683
+ toEl: parentEl,
1684
+ originalEvent: evt
1685
+ });
1686
+ _dispatchEvent({
1687
+ sortable: this,
1688
+ name: "sort",
1689
+ toEl: parentEl,
1690
+ originalEvent: evt
1691
+ });
1692
+ }
1693
+ }
1694
+ }
1695
+ if (Sortable.active) {
1696
+ if (newIndex == null || newIndex === -1) {
1697
+ newIndex = oldIndex;
1698
+ newDraggableIndex = oldDraggableIndex;
1699
+ }
1700
+ _dispatchEvent({
1701
+ sortable: this,
1702
+ name: "end",
1703
+ toEl: parentEl,
1704
+ originalEvent: evt
1705
+ });
1706
+ this.save();
1707
+ }
1708
+ }
1709
+ }
1710
+ this._nulling();
1711
+ },
1712
+ _nulling: function _nulling() {
1713
+ pluginEvent2("nulling", this);
1714
+ rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
1715
+ savedInputChecked.forEach(function(el) {
1716
+ el.checked = true;
1717
+ });
1718
+ savedInputChecked.length = lastDx = lastDy = 0;
1719
+ },
1720
+ handleEvent: function handleEvent(evt) {
1721
+ switch (evt.type) {
1722
+ case "drop":
1723
+ case "dragend":
1724
+ this._onDrop(evt);
1725
+ break;
1726
+ case "dragenter":
1727
+ case "dragover":
1728
+ if (dragEl) {
1729
+ this._onDragOver(evt);
1730
+ _globalDragOver(evt);
1731
+ }
1732
+ break;
1733
+ case "selectstart":
1734
+ evt.preventDefault();
1735
+ break;
1736
+ }
1737
+ },
1738
+ /**
1739
+ * Serializes the item into an array of string.
1740
+ * @returns {String[]}
1741
+ */
1742
+ toArray: function toArray() {
1743
+ var order = [], el, children = this.el.children, i = 0, n = children.length, options = this.options;
1744
+ for (; i < n; i++) {
1745
+ el = children[i];
1746
+ if (closest(el, options.draggable, this.el, false)) {
1747
+ order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
1748
+ }
1749
+ }
1750
+ return order;
1751
+ },
1752
+ /**
1753
+ * Sorts the elements according to the array.
1754
+ * @param {String[]} order order of the items
1755
+ */
1756
+ sort: function sort(order, useAnimation) {
1757
+ var items = {}, rootEl2 = this.el;
1758
+ this.toArray().forEach(function(id, i) {
1759
+ var el = rootEl2.children[i];
1760
+ if (closest(el, this.options.draggable, rootEl2, false)) {
1761
+ items[id] = el;
1762
+ }
1763
+ }, this);
1764
+ useAnimation && this.captureAnimationState();
1765
+ order.forEach(function(id) {
1766
+ if (items[id]) {
1767
+ rootEl2.removeChild(items[id]);
1768
+ rootEl2.appendChild(items[id]);
1769
+ }
1770
+ });
1771
+ useAnimation && this.animateAll();
1772
+ },
1773
+ /**
1774
+ * Save the current sorting
1775
+ */
1776
+ save: function save() {
1777
+ var store = this.options.store;
1778
+ store && store.set && store.set(this);
1779
+ },
1780
+ /**
1781
+ * 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.
1782
+ * @param {HTMLElement} el
1783
+ * @param {String} [selector] default: `options.draggable`
1784
+ * @returns {HTMLElement|null}
1785
+ */
1786
+ closest: function closest$1(el, selector) {
1787
+ return closest(el, selector || this.options.draggable, this.el, false);
1788
+ },
1789
+ /**
1790
+ * Set/get option
1791
+ * @param {string} name
1792
+ * @param {*} [value]
1793
+ * @returns {*}
1794
+ */
1795
+ option: function option(name, value) {
1796
+ var options = this.options;
1797
+ if (value === void 0) {
1798
+ return options[name];
1799
+ } else {
1800
+ var modifiedValue = PluginManager.modifyOption(this, name, value);
1801
+ if (typeof modifiedValue !== "undefined") {
1802
+ options[name] = modifiedValue;
1803
+ } else {
1804
+ options[name] = value;
1805
+ }
1806
+ if (name === "group") {
1807
+ _prepareGroup(options);
1808
+ }
1809
+ }
1810
+ },
1811
+ /**
1812
+ * Destroy
1813
+ */
1814
+ destroy: function destroy() {
1815
+ pluginEvent2("destroy", this);
1816
+ var el = this.el;
1817
+ el[expando] = null;
1818
+ off(el, "mousedown", this._onTapStart);
1819
+ off(el, "touchstart", this._onTapStart);
1820
+ off(el, "pointerdown", this._onTapStart);
1821
+ if (this.nativeDraggable) {
1822
+ off(el, "dragover", this);
1823
+ off(el, "dragenter", this);
1824
+ }
1825
+ Array.prototype.forEach.call(el.querySelectorAll("[draggable]"), function(el2) {
1826
+ el2.removeAttribute("draggable");
1827
+ });
1828
+ this._onDrop();
1829
+ this._disableDelayedDragEvents();
1830
+ sortables.splice(sortables.indexOf(this.el), 1);
1831
+ this.el = el = null;
1832
+ },
1833
+ _hideClone: function _hideClone() {
1834
+ if (!cloneHidden) {
1835
+ pluginEvent2("hideClone", this);
1836
+ if (Sortable.eventCanceled)
1837
+ return;
1838
+ css(cloneEl, "display", "none");
1839
+ if (this.options.removeCloneOnHide && cloneEl.parentNode) {
1840
+ cloneEl.parentNode.removeChild(cloneEl);
1841
+ }
1842
+ cloneHidden = true;
1843
+ }
1844
+ },
1845
+ _showClone: function _showClone(putSortable2) {
1846
+ if (putSortable2.lastPutMode !== "clone") {
1847
+ this._hideClone();
1848
+ return;
1849
+ }
1850
+ if (cloneHidden) {
1851
+ pluginEvent2("showClone", this);
1852
+ if (Sortable.eventCanceled)
1853
+ return;
1854
+ if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
1855
+ rootEl.insertBefore(cloneEl, dragEl);
1856
+ } else if (nextEl) {
1857
+ rootEl.insertBefore(cloneEl, nextEl);
1858
+ } else {
1859
+ rootEl.appendChild(cloneEl);
1860
+ }
1861
+ if (this.options.group.revertClone) {
1862
+ this.animate(dragEl, cloneEl);
1863
+ }
1864
+ css(cloneEl, "display", "");
1865
+ cloneHidden = false;
1866
+ }
1867
+ }
1868
+ };
1869
+ function _globalDragOver(evt) {
1870
+ if (evt.dataTransfer) {
1871
+ evt.dataTransfer.dropEffect = "move";
1872
+ }
1873
+ evt.cancelable && evt.preventDefault();
1874
+ }
1875
+ function _onMove(fromEl, toEl, dragEl2, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
1876
+ var evt, sortable = fromEl[expando], onMoveFn = sortable.options.onMove, retVal;
1877
+ if (window.CustomEvent && !IE11OrLess && !Edge) {
1878
+ evt = new CustomEvent("move", {
1879
+ bubbles: true,
1880
+ cancelable: true
1881
+ });
1882
+ } else {
1883
+ evt = document.createEvent("Event");
1884
+ evt.initEvent("move", true, true);
1885
+ }
1886
+ evt.to = toEl;
1887
+ evt.from = fromEl;
1888
+ evt.dragged = dragEl2;
1889
+ evt.draggedRect = dragRect;
1890
+ evt.related = targetEl || toEl;
1891
+ evt.relatedRect = targetRect || getRect(toEl);
1892
+ evt.willInsertAfter = willInsertAfter;
1893
+ evt.originalEvent = originalEvent;
1894
+ fromEl.dispatchEvent(evt);
1895
+ if (onMoveFn) {
1896
+ retVal = onMoveFn.call(sortable, evt, originalEvent);
1897
+ }
1898
+ return retVal;
1899
+ }
1900
+ function _disableDraggable(el) {
1901
+ el.draggable = false;
1902
+ }
1903
+ function _unsilent() {
1904
+ _silent = false;
1905
+ }
1906
+ function _ghostIsFirst(evt, vertical, sortable) {
1907
+ var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
1908
+ var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
1909
+ var spacer = 10;
1910
+ return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
1911
+ }
1912
+ function _ghostIsLast(evt, vertical, sortable) {
1913
+ var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
1914
+ var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
1915
+ var spacer = 10;
1916
+ return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
1917
+ }
1918
+ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
1919
+ var mouseOnAxis = vertical ? evt.clientY : evt.clientX, targetLength = vertical ? targetRect.height : targetRect.width, targetS1 = vertical ? targetRect.top : targetRect.left, targetS2 = vertical ? targetRect.bottom : targetRect.right, invert = false;
1920
+ if (!invertSwap) {
1921
+ if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
1922
+ if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {
1923
+ pastFirstInvertThresh = true;
1924
+ }
1925
+ if (!pastFirstInvertThresh) {
1926
+ if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance : mouseOnAxis > targetS2 - targetMoveDistance) {
1927
+ return -lastDirection;
1928
+ }
1929
+ } else {
1930
+ invert = true;
1931
+ }
1932
+ } else {
1933
+ if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {
1934
+ return _getInsertDirection(target);
1935
+ }
1936
+ }
1937
+ }
1938
+ invert = invert || invertSwap;
1939
+ if (invert) {
1940
+ if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
1941
+ return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
1942
+ }
1943
+ }
1944
+ return 0;
1945
+ }
1946
+ function _getInsertDirection(target) {
1947
+ if (index(dragEl) < index(target)) {
1948
+ return 1;
1949
+ } else {
1950
+ return -1;
1951
+ }
1952
+ }
1953
+ function _generateId(el) {
1954
+ var str = el.tagName + el.className + el.src + el.href + el.textContent, i = str.length, sum = 0;
1955
+ while (i--) {
1956
+ sum += str.charCodeAt(i);
1957
+ }
1958
+ return sum.toString(36);
1959
+ }
1960
+ function _saveInputCheckedState(root) {
1961
+ savedInputChecked.length = 0;
1962
+ var inputs = root.getElementsByTagName("input");
1963
+ var idx = inputs.length;
1964
+ while (idx--) {
1965
+ var el = inputs[idx];
1966
+ el.checked && savedInputChecked.push(el);
1967
+ }
1968
+ }
1969
+ function _nextTick(fn) {
1970
+ return setTimeout(fn, 0);
1971
+ }
1972
+ function _cancelNextTick(id) {
1973
+ return clearTimeout(id);
1974
+ }
1975
+ if (documentExists) {
1976
+ on(document, "touchmove", function(evt) {
1977
+ if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
1978
+ evt.preventDefault();
1979
+ }
1980
+ });
1981
+ }
1982
+ Sortable.utils = {
1983
+ on,
1984
+ off,
1985
+ css,
1986
+ find,
1987
+ is: function is(el, selector) {
1988
+ return !!closest(el, selector, el, false);
1989
+ },
1990
+ extend,
1991
+ throttle,
1992
+ closest,
1993
+ toggleClass,
1994
+ clone,
1995
+ index,
1996
+ nextTick: _nextTick,
1997
+ cancelNextTick: _cancelNextTick,
1998
+ detectDirection: _detectDirection,
1999
+ getChild
2000
+ };
2001
+ Sortable.get = function(element) {
2002
+ return element[expando];
2003
+ };
2004
+ Sortable.mount = function() {
2005
+ for (var _len = arguments.length, plugins2 = new Array(_len), _key = 0; _key < _len; _key++) {
2006
+ plugins2[_key] = arguments[_key];
2007
+ }
2008
+ if (plugins2[0].constructor === Array)
2009
+ plugins2 = plugins2[0];
2010
+ plugins2.forEach(function(plugin) {
2011
+ if (!plugin.prototype || !plugin.prototype.constructor) {
2012
+ throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
2013
+ }
2014
+ if (plugin.utils)
2015
+ Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
2016
+ PluginManager.mount(plugin);
2017
+ });
2018
+ };
2019
+ Sortable.create = function(el, options) {
2020
+ return new Sortable(el, options);
2021
+ };
2022
+ Sortable.version = version;
2023
+ var autoScrolls = [], scrollEl, scrollRootEl, scrolling = false, lastAutoScrollX, lastAutoScrollY, touchEvt$1, pointerElemChangedInterval;
2024
+ function AutoScrollPlugin() {
2025
+ function AutoScroll() {
2026
+ this.defaults = {
2027
+ scroll: true,
2028
+ forceAutoScrollFallback: false,
2029
+ scrollSensitivity: 30,
2030
+ scrollSpeed: 10,
2031
+ bubbleScroll: true
2032
+ };
2033
+ for (var fn in this) {
2034
+ if (fn.charAt(0) === "_" && typeof this[fn] === "function") {
2035
+ this[fn] = this[fn].bind(this);
2036
+ }
2037
+ }
2038
+ }
2039
+ AutoScroll.prototype = {
2040
+ dragStarted: function dragStarted(_ref) {
2041
+ var originalEvent = _ref.originalEvent;
2042
+ if (this.sortable.nativeDraggable) {
2043
+ on(document, "dragover", this._handleAutoScroll);
2044
+ } else {
2045
+ if (this.options.supportPointer) {
2046
+ on(document, "pointermove", this._handleFallbackAutoScroll);
2047
+ } else if (originalEvent.touches) {
2048
+ on(document, "touchmove", this._handleFallbackAutoScroll);
2049
+ } else {
2050
+ on(document, "mousemove", this._handleFallbackAutoScroll);
2051
+ }
2052
+ }
2053
+ },
2054
+ dragOverCompleted: function dragOverCompleted(_ref2) {
2055
+ var originalEvent = _ref2.originalEvent;
2056
+ if (!this.options.dragOverBubble && !originalEvent.rootEl) {
2057
+ this._handleAutoScroll(originalEvent);
2058
+ }
2059
+ },
2060
+ drop: function drop3() {
2061
+ if (this.sortable.nativeDraggable) {
2062
+ off(document, "dragover", this._handleAutoScroll);
2063
+ } else {
2064
+ off(document, "pointermove", this._handleFallbackAutoScroll);
2065
+ off(document, "touchmove", this._handleFallbackAutoScroll);
2066
+ off(document, "mousemove", this._handleFallbackAutoScroll);
2067
+ }
2068
+ clearPointerElemChangedInterval();
2069
+ clearAutoScrolls();
2070
+ cancelThrottle();
2071
+ },
2072
+ nulling: function nulling() {
2073
+ touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
2074
+ autoScrolls.length = 0;
2075
+ },
2076
+ _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
2077
+ this._handleAutoScroll(evt, true);
2078
+ },
2079
+ _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
2080
+ var _this = this;
2081
+ var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, elem = document.elementFromPoint(x, y);
2082
+ touchEvt$1 = evt;
2083
+ if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
2084
+ autoScroll(evt, this.options, elem, fallback);
2085
+ var ogElemScroller = getParentAutoScrollElement(elem, true);
2086
+ if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
2087
+ pointerElemChangedInterval && clearPointerElemChangedInterval();
2088
+ pointerElemChangedInterval = setInterval(function() {
2089
+ var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
2090
+ if (newElem !== ogElemScroller) {
2091
+ ogElemScroller = newElem;
2092
+ clearAutoScrolls();
2093
+ }
2094
+ autoScroll(evt, _this.options, newElem, fallback);
2095
+ }, 10);
2096
+ lastAutoScrollX = x;
2097
+ lastAutoScrollY = y;
2098
+ }
2099
+ } else {
2100
+ if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
2101
+ clearAutoScrolls();
2102
+ return;
2103
+ }
2104
+ autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
2105
+ }
2106
+ }
2107
+ };
2108
+ return _extends(AutoScroll, {
2109
+ pluginName: "scroll",
2110
+ initializeByDefault: true
2111
+ });
2112
+ }
2113
+ function clearAutoScrolls() {
2114
+ autoScrolls.forEach(function(autoScroll2) {
2115
+ clearInterval(autoScroll2.pid);
2116
+ });
2117
+ autoScrolls = [];
2118
+ }
2119
+ function clearPointerElemChangedInterval() {
2120
+ clearInterval(pointerElemChangedInterval);
2121
+ }
2122
+ var autoScroll = throttle(function(evt, options, rootEl2, isFallback) {
2123
+ if (!options.scroll)
2124
+ return;
2125
+ var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, sens = options.scrollSensitivity, speed = options.scrollSpeed, winScroller = getWindowScrollingElement();
2126
+ var scrollThisInstance = false, scrollCustomFn;
2127
+ if (scrollRootEl !== rootEl2) {
2128
+ scrollRootEl = rootEl2;
2129
+ clearAutoScrolls();
2130
+ scrollEl = options.scroll;
2131
+ scrollCustomFn = options.scrollFn;
2132
+ if (scrollEl === true) {
2133
+ scrollEl = getParentAutoScrollElement(rootEl2, true);
2134
+ }
2135
+ }
2136
+ var layersOut = 0;
2137
+ var currentParent = scrollEl;
2138
+ do {
2139
+ var el = currentParent, rect = getRect(el), top = rect.top, bottom = rect.bottom, left = rect.left, right = rect.right, width = rect.width, height = rect.height, canScrollX = void 0, canScrollY = void 0, scrollWidth = el.scrollWidth, scrollHeight = el.scrollHeight, elCSS = css(el), scrollPosX = el.scrollLeft, scrollPosY = el.scrollTop;
2140
+ if (el === winScroller) {
2141
+ canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll" || elCSS.overflowX === "visible");
2142
+ canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll" || elCSS.overflowY === "visible");
2143
+ } else {
2144
+ canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll");
2145
+ canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll");
2146
+ }
2147
+ var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
2148
+ var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
2149
+ if (!autoScrolls[layersOut]) {
2150
+ for (var i = 0; i <= layersOut; i++) {
2151
+ if (!autoScrolls[i]) {
2152
+ autoScrolls[i] = {};
2153
+ }
2154
+ }
2155
+ }
2156
+ if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
2157
+ autoScrolls[layersOut].el = el;
2158
+ autoScrolls[layersOut].vx = vx;
2159
+ autoScrolls[layersOut].vy = vy;
2160
+ clearInterval(autoScrolls[layersOut].pid);
2161
+ if (vx != 0 || vy != 0) {
2162
+ scrollThisInstance = true;
2163
+ autoScrolls[layersOut].pid = setInterval((function() {
2164
+ if (isFallback && this.layer === 0) {
2165
+ Sortable.active._onTouchMove(touchEvt$1);
2166
+ }
2167
+ var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
2168
+ var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
2169
+ if (typeof scrollCustomFn === "function") {
2170
+ if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== "continue") {
2171
+ return;
2172
+ }
2173
+ }
2174
+ scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
2175
+ }).bind({
2176
+ layer: layersOut
2177
+ }), 24);
2178
+ }
2179
+ }
2180
+ layersOut++;
2181
+ } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
2182
+ scrolling = scrollThisInstance;
2183
+ }, 30);
2184
+ var drop = function drop2(_ref) {
2185
+ var originalEvent = _ref.originalEvent, putSortable2 = _ref.putSortable, dragEl2 = _ref.dragEl, activeSortable = _ref.activeSortable, dispatchSortableEvent = _ref.dispatchSortableEvent, hideGhostForTarget = _ref.hideGhostForTarget, unhideGhostForTarget = _ref.unhideGhostForTarget;
2186
+ if (!originalEvent)
2187
+ return;
2188
+ var toSortable = putSortable2 || activeSortable;
2189
+ hideGhostForTarget();
2190
+ var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
2191
+ var target = document.elementFromPoint(touch.clientX, touch.clientY);
2192
+ unhideGhostForTarget();
2193
+ if (toSortable && !toSortable.el.contains(target)) {
2194
+ dispatchSortableEvent("spill");
2195
+ this.onSpill({
2196
+ dragEl: dragEl2,
2197
+ putSortable: putSortable2
2198
+ });
2199
+ }
2200
+ };
2201
+ function Revert() {
2202
+ }
2203
+ Revert.prototype = {
2204
+ startIndex: null,
2205
+ dragStart: function dragStart(_ref2) {
2206
+ var oldDraggableIndex2 = _ref2.oldDraggableIndex;
2207
+ this.startIndex = oldDraggableIndex2;
2208
+ },
2209
+ onSpill: function onSpill(_ref3) {
2210
+ var dragEl2 = _ref3.dragEl, putSortable2 = _ref3.putSortable;
2211
+ this.sortable.captureAnimationState();
2212
+ if (putSortable2) {
2213
+ putSortable2.captureAnimationState();
2214
+ }
2215
+ var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
2216
+ if (nextSibling) {
2217
+ this.sortable.el.insertBefore(dragEl2, nextSibling);
2218
+ } else {
2219
+ this.sortable.el.appendChild(dragEl2);
2220
+ }
2221
+ this.sortable.animateAll();
2222
+ if (putSortable2) {
2223
+ putSortable2.animateAll();
2224
+ }
2225
+ },
2226
+ drop
2227
+ };
2228
+ _extends(Revert, {
2229
+ pluginName: "revertOnSpill"
2230
+ });
2231
+ function Remove() {
2232
+ }
2233
+ Remove.prototype = {
2234
+ onSpill: function onSpill2(_ref4) {
2235
+ var dragEl2 = _ref4.dragEl, putSortable2 = _ref4.putSortable;
2236
+ var parentSortable = putSortable2 || this.sortable;
2237
+ parentSortable.captureAnimationState();
2238
+ dragEl2.parentNode && dragEl2.parentNode.removeChild(dragEl2);
2239
+ parentSortable.animateAll();
2240
+ },
2241
+ drop
2242
+ };
2243
+ _extends(Remove, {
2244
+ pluginName: "removeOnSpill"
2245
+ });
2246
+ Sortable.mount(new AutoScrollPlugin());
2247
+ Sortable.mount(Remove, Revert);
63
2248
  const _sfc_main$1 = defineComponent({
64
2249
  name: "nf-virtual-select-container",
65
2250
  props: {
@@ -82,7 +2267,7 @@ const _sfc_main$1 = defineComponent({
82
2267
  render() {
83
2268
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
84
2269
  const Tag = this.tag;
85
- const on = this.$listeners;
2270
+ const on2 = this.$listeners;
86
2271
  return h(Tag, {
87
2272
  "ref": "nfVirtualSelect",
88
2273
  "props": {
@@ -93,7 +2278,7 @@ const _sfc_main$1 = defineComponent({
93
2278
  },
94
2279
  "on": {
95
2280
  ...{
96
- ...on,
2281
+ ...on2,
97
2282
  input: (val) => {
98
2283
  if (this.tag === "el-select" || this.tag === "custom-select-dropdown") {
99
2284
  this.$emit("update:value", val);
@@ -112,6 +2297,32 @@ const _sfc_main$1 = defineComponent({
112
2297
  }, [(_h = (_g = this.$scopedSlots).footer) == null ? void 0 : _h.call(_g, {})]), h("template", {
113
2298
  "slot": "header"
114
2299
  }, [(_j = (_i = this.$scopedSlots).header) == null ? void 0 : _j.call(_i, {})])]);
2300
+ },
2301
+ mounted() {
2302
+ if (this.config.multiple && !this.config["collapse-tags"]) {
2303
+ this.setSort();
2304
+ }
2305
+ },
2306
+ methods: {
2307
+ setSort() {
2308
+ var _a;
2309
+ const elSelectRef = this.$refs.nfVirtualSelect;
2310
+ const el = (_a = elSelectRef == null ? void 0 : elSelectRef.$el) == null ? void 0 : _a.querySelectorAll(".el-select__tags > span")[0];
2311
+ if (el) {
2312
+ Sortable.create(el, {
2313
+ ghostClass: "sortable-ghost",
2314
+ // Class name for the drop placeholder,
2315
+ setData: function(dataTransfer) {
2316
+ dataTransfer.setData("Text", "");
2317
+ },
2318
+ onEnd: (evt) => {
2319
+ const valueChange = this.value;
2320
+ const targetRow = valueChange.splice(evt.oldIndex, 1)[0];
2321
+ valueChange.splice(evt.newIndex, 0, targetRow);
2322
+ }
2323
+ });
2324
+ }
2325
+ }
115
2326
  }
116
2327
  });
117
2328
  const _sfc_render$1 = null;
@@ -463,9 +2674,9 @@ const _sfc_main = {
463
2674
  scrollToBottom() {
464
2675
  this.$refs.virtualSelectList.scrollToBottom();
465
2676
  },
466
- scrollToIndex(index) {
2677
+ scrollToIndex(index2) {
467
2678
  var _a;
468
- (_a = this.$refs.virtualSelectList) == null ? void 0 : _a.scrollToIndex(index);
2679
+ (_a = this.$refs.virtualSelectList) == null ? void 0 : _a.scrollToIndex(index2);
469
2680
  },
470
2681
  scrollToOffset(offset) {
471
2682
  this.$refs.virtualSelectList.scrollToOffset(offset);
@@ -530,9 +2741,9 @@ const _sfc_main = {
530
2741
  const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
531
2742
  this.selectArr = [...multiple_elements, ...this.selectArr.filter((item) => !multiple_elements.includes(item))];
532
2743
  } else {
533
- const index = this.selectArr.findIndex((item) => item.value === this.currentVal);
534
- if (index !== -1) {
535
- const obj = this.selectArr.splice(index, 1)[0];
2744
+ const index2 = this.selectArr.findIndex((item) => item.value === this.currentVal);
2745
+ if (index2 !== -1) {
2746
+ const obj = this.selectArr.splice(index2, 1)[0];
536
2747
  this.selectArr.unshift(obj);
537
2748
  }
538
2749
  }
@@ -681,9 +2892,9 @@ var _sfc_render = function render2() {
681
2892
  "slot": "footer"
682
2893
  }), _vm._t("header", null, {
683
2894
  "slot": "header"
684
- })], 2), _vm._t("default")] : [_vm._t("header"), _vm._l(_vm.selectArr, function(item, index) {
2895
+ })], 2), _vm._t("default")] : [_vm._t("header"), _vm._l(_vm.selectArr, function(item, index2) {
685
2896
  return _c("el-option", {
686
- key: item[_vm.keyValue[0]] + "_" + index,
2897
+ key: item[_vm.keyValue[0]] + "_" + index2,
687
2898
  attrs: {
688
2899
  "label": item[_vm.keyValue[0]],
689
2900
  "value": item[_vm.keyValue[1]],