@feedmepos/mf-settings 0.0.74-dev.1 → 0.0.75-dev.1

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.
Files changed (39) hide show
  1. package/dist/App-35971c1b.js +4378 -0
  2. package/dist/Business-f606024e.js +11276 -0
  3. package/dist/{CreateBusiness-55e7de74.js → CreateBusiness-8709fcdc.js} +117 -149
  4. package/dist/FoodCourt-b54debb1.js +47800 -0
  5. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-6aab82f2.js → FormSection.vue_vue_type_script_setup_true_lang-f34c8596.js} +17 -16
  6. package/dist/{Tagging-3d10ba6e.js → Tagging-a5f9efca.js} +8 -9
  7. package/dist/app-3b03b910.js +4270 -0
  8. package/dist/app.js +3 -4
  9. package/dist/apps/mf-settings/src/app.d.ts +1 -1
  10. package/dist/apps/mf-settings/src/components/tagging/TaggingForm.vue.d.ts +6 -3
  11. package/dist/apps/mf-settings/src/extensions/business.d.ts +7 -2
  12. package/dist/apps/mf-settings/src/router/shared.d.ts +1 -1
  13. package/dist/apps/mf-settings/src/store/attributeSettings.d.ts +30 -15
  14. package/dist/apps/mf-settings/tsconfig.app.tsbuildinfo +1 -1
  15. package/dist/{business-1b85fe7e.js → business-1f49af71.js} +1 -1
  16. package/dist/dayjs.min-a3e17295.js +345 -0
  17. package/dist/index-406cc08d.js +19758 -0
  18. package/dist/{index-b9ef9a01.js → index-4d304b46.js} +5520 -5366
  19. package/dist/index-fdc00332.js +8047 -0
  20. package/dist/object-8ac0c0d8.js +63 -0
  21. package/dist/packages/shared/src/helpers/actionButton.d.ts +2 -2
  22. package/dist/rules-c9fa22f8.js +13 -0
  23. package/package.json +5 -4
  24. package/dist/App-44a7faee.js +0 -23266
  25. package/dist/Business-80eeb674.js +0 -11950
  26. package/dist/FoodCourt-c38eaa03.js +0 -72969
  27. package/dist/ReasonTemplate-b56a5a9d.js +0 -2235
  28. package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-8f929a2d.js +0 -38
  29. package/dist/_commonjs-dynamic-modules-bed80856.js +0 -6
  30. package/dist/_plugin-vue_export-helper-dad06003.js +0 -9
  31. package/dist/app-a734e3bb.js +0 -1853
  32. package/dist/apps/mf-settings/src/View/ReasonTemplate.vue.d.ts +0 -2
  33. package/dist/apps/mf-settings/src/components/reason/ReasonTemplateForm.vue.d.ts +0 -28
  34. package/dist/apps/mf-settings/src/types/reasonTemplate.d.ts +0 -9
  35. package/dist/createForm-d3b97d2e.js +0 -50
  36. package/dist/dayjs.min-6eec923a.js +0 -310
  37. package/dist/index-b1e448c9.js +0 -2395
  38. package/dist/object-27ce045b.js +0 -16
  39. package/dist/rules-2bee6632.js +0 -6
@@ -1,2235 +0,0 @@
1
- import { resolveComponent as oe, TransitionGroup as pn, defineComponent as et, h as Tt, nextTick as Yt, openBlock as U, createElementBlock as te, createElementVNode as O, toDisplayString as Q, createCommentVNode as _t, renderSlot as mt, ref as Ye, reactive as gn, computed as je, watch as jt, Fragment as Ut, normalizeProps as vn, guardReactiveProps as bn, createVNode as V, unref as x, withCtx as ie, normalizeClass as yn, createBlock as ht, createSlots as _n, getCurrentInstance as wn, renderList as En, withModifiers as Ct } from "vue";
2
- import { useI18n as Ht, RestaurantSelector as Dn } from "@feedmepos/mf-common";
3
- import { useSnackbar as Sn, components as Tn, useBreakpoints as Cn, useDialog as xn } from "@feedmepos/ui-library";
4
- import { _ as In } from "./ResponsiveFabButton.vue_vue_type_script_setup_true_lang-8f929a2d.js";
5
- import { _ as On, c as xt } from "./createForm-d3b97d2e.js";
6
- import { _ as It, c as Fn } from "./FormSection.vue_vue_type_script_setup_true_lang-6aab82f2.js";
7
- import { u as An, r as Pn, s as Nn } from "./index-b1e448c9.js";
8
- import "./index-b9ef9a01.js";
9
- import { r as kn } from "./rules-2bee6632.js";
10
- import "pinia";
11
- /**!
12
- * Sortable 1.14.0
13
- * @author RubaXa <trash@rubaxa.org>
14
- * @author owenm <owen23355@gmail.com>
15
- * @license MIT
16
- */
17
- function Ot(t, e) {
18
- var n = Object.keys(t);
19
- if (Object.getOwnPropertySymbols) {
20
- var o = Object.getOwnPropertySymbols(t);
21
- e && (o = o.filter(function(r) {
22
- return Object.getOwnPropertyDescriptor(t, r).enumerable;
23
- })), n.push.apply(n, o);
24
- }
25
- return n;
26
- }
27
- function le(t) {
28
- for (var e = 1; e < arguments.length; e++) {
29
- var n = arguments[e] != null ? arguments[e] : {};
30
- e % 2 ? Ot(Object(n), !0).forEach(function(o) {
31
- Rn(t, o, n[o]);
32
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Ot(Object(n)).forEach(function(o) {
33
- Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(n, o));
34
- });
35
- }
36
- return t;
37
- }
38
- function Ue(t) {
39
- "@babel/helpers - typeof";
40
- return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Ue = function(e) {
41
- return typeof e;
42
- } : Ue = function(e) {
43
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
44
- }, Ue(t);
45
- }
46
- function Rn(t, e, n) {
47
- return e in t ? Object.defineProperty(t, e, {
48
- value: n,
49
- enumerable: !0,
50
- configurable: !0,
51
- writable: !0
52
- }) : t[e] = n, t;
53
- }
54
- function de() {
55
- return de = Object.assign || function(t) {
56
- for (var e = 1; e < arguments.length; e++) {
57
- var n = arguments[e];
58
- for (var o in n)
59
- Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
60
- }
61
- return t;
62
- }, de.apply(this, arguments);
63
- }
64
- function Vn(t, e) {
65
- if (t == null)
66
- return {};
67
- var n = {}, o = Object.keys(t), r, i;
68
- for (i = 0; i < o.length; i++)
69
- r = o[i], !(e.indexOf(r) >= 0) && (n[r] = t[r]);
70
- return n;
71
- }
72
- function Mn(t, e) {
73
- if (t == null)
74
- return {};
75
- var n = Vn(t, e), o, r;
76
- if (Object.getOwnPropertySymbols) {
77
- var i = Object.getOwnPropertySymbols(t);
78
- for (r = 0; r < i.length; r++)
79
- o = i[r], !(e.indexOf(o) >= 0) && Object.prototype.propertyIsEnumerable.call(t, o) && (n[o] = t[o]);
80
- }
81
- return n;
82
- }
83
- var $n = "1.14.0";
84
- function ue(t) {
85
- if (typeof window < "u" && window.navigator)
86
- return !!/* @__PURE__ */ navigator.userAgent.match(t);
87
- }
88
- var fe = ue(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), Ve = ue(/Edge/i), Ft = ue(/firefox/i), Ae = ue(/safari/i) && !ue(/chrome/i) && !ue(/android/i), zt = ue(/iP(ad|od|hone)/i), Ln = ue(/chrome/i) && ue(/android/i), Wt = {
89
- capture: !1,
90
- passive: !1
91
- };
92
- function T(t, e, n) {
93
- t.addEventListener(e, n, !fe && Wt);
94
- }
95
- function D(t, e, n) {
96
- t.removeEventListener(e, n, !fe && Wt);
97
- }
98
- function qe(t, e) {
99
- if (e) {
100
- if (e[0] === ">" && (e = e.substring(1)), t)
101
- try {
102
- if (t.matches)
103
- return t.matches(e);
104
- if (t.msMatchesSelector)
105
- return t.msMatchesSelector(e);
106
- if (t.webkitMatchesSelector)
107
- return t.webkitMatchesSelector(e);
108
- } catch {
109
- return !1;
110
- }
111
- return !1;
112
- }
113
- }
114
- function Bn(t) {
115
- return t.host && t !== document && t.host.nodeType ? t.host : t.parentNode;
116
- }
117
- function ae(t, e, n, o) {
118
- if (t) {
119
- n = n || document;
120
- do {
121
- if (e != null && (e[0] === ">" ? t.parentNode === n && qe(t, e) : qe(t, e)) || o && t === n)
122
- return t;
123
- if (t === n)
124
- break;
125
- } while (t = Bn(t));
126
- }
127
- return null;
128
- }
129
- var At = /\s+/g;
130
- function G(t, e, n) {
131
- if (t && e)
132
- if (t.classList)
133
- t.classList[n ? "add" : "remove"](e);
134
- else {
135
- var o = (" " + t.className + " ").replace(At, " ").replace(" " + e + " ", " ");
136
- t.className = (o + (n ? " " + e : "")).replace(At, " ");
137
- }
138
- }
139
- function m(t, e, n) {
140
- var o = t && t.style;
141
- if (o) {
142
- if (n === void 0)
143
- return document.defaultView && document.defaultView.getComputedStyle ? n = document.defaultView.getComputedStyle(t, "") : t.currentStyle && (n = t.currentStyle), e === void 0 ? n : n[e];
144
- !(e in o) && e.indexOf("webkit") === -1 && (e = "-webkit-" + e), o[e] = n + (typeof n == "string" ? "" : "px");
145
- }
146
- }
147
- function Te(t, e) {
148
- var n = "";
149
- if (typeof t == "string")
150
- n = t;
151
- else
152
- do {
153
- var o = m(t, "transform");
154
- o && o !== "none" && (n = o + " " + n);
155
- } while (!e && (t = t.parentNode));
156
- var r = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
157
- return r && new r(n);
158
- }
159
- function Gt(t, e, n) {
160
- if (t) {
161
- var o = t.getElementsByTagName(e), r = 0, i = o.length;
162
- if (n)
163
- for (; r < i; r++)
164
- n(o[r], r);
165
- return o;
166
- }
167
- return [];
168
- }
169
- function se() {
170
- var t = document.scrollingElement;
171
- return t || document.documentElement;
172
- }
173
- function M(t, e, n, o, r) {
174
- if (!(!t.getBoundingClientRect && t !== window)) {
175
- var i, a, l, s, c, d, f;
176
- if (t !== window && t.parentNode && t !== se() ? (i = t.getBoundingClientRect(), a = i.top, l = i.left, s = i.bottom, c = i.right, d = i.height, f = i.width) : (a = 0, l = 0, s = window.innerHeight, c = window.innerWidth, d = window.innerHeight, f = window.innerWidth), (e || n) && t !== window && (r = r || t.parentNode, !fe))
177
- do
178
- if (r && r.getBoundingClientRect && (m(r, "transform") !== "none" || n && m(r, "position") !== "static")) {
179
- var y = r.getBoundingClientRect();
180
- a -= y.top + parseInt(m(r, "border-top-width")), l -= y.left + parseInt(m(r, "border-left-width")), s = a + i.height, c = l + i.width;
181
- break;
182
- }
183
- while (r = r.parentNode);
184
- if (o && t !== window) {
185
- var E = Te(r || t), _ = E && E.a, b = E && E.d;
186
- E && (a /= b, l /= _, f /= _, d /= b, s = a + d, c = l + f);
187
- }
188
- return {
189
- top: a,
190
- left: l,
191
- bottom: s,
192
- right: c,
193
- width: f,
194
- height: d
195
- };
196
- }
197
- }
198
- function Pt(t, e, n) {
199
- for (var o = ge(t, !0), r = M(t)[e]; o; ) {
200
- var i = M(o)[n], a = void 0;
201
- if (n === "top" || n === "left" ? a = r >= i : a = r <= i, !a)
202
- return o;
203
- if (o === se())
204
- break;
205
- o = ge(o, !1);
206
- }
207
- return !1;
208
- }
209
- function Ce(t, e, n, o) {
210
- for (var r = 0, i = 0, a = t.children; i < a.length; ) {
211
- if (a[i].style.display !== "none" && a[i] !== h.ghost && (o || a[i] !== h.dragged) && ae(a[i], n.draggable, t, !1)) {
212
- if (r === e)
213
- return a[i];
214
- r++;
215
- }
216
- i++;
217
- }
218
- return null;
219
- }
220
- function wt(t, e) {
221
- for (var n = t.lastElementChild; n && (n === h.ghost || m(n, "display") === "none" || e && !qe(n, e)); )
222
- n = n.previousElementSibling;
223
- return n || null;
224
- }
225
- function ee(t, e) {
226
- var n = 0;
227
- if (!t || !t.parentNode)
228
- return -1;
229
- for (; t = t.previousElementSibling; )
230
- t.nodeName.toUpperCase() !== "TEMPLATE" && t !== h.clone && (!e || qe(t, e)) && n++;
231
- return n;
232
- }
233
- function Nt(t) {
234
- var e = 0, n = 0, o = se();
235
- if (t)
236
- do {
237
- var r = Te(t), i = r.a, a = r.d;
238
- e += t.scrollLeft * i, n += t.scrollTop * a;
239
- } while (t !== o && (t = t.parentNode));
240
- return [e, n];
241
- }
242
- function Xn(t, e) {
243
- for (var n in t)
244
- if (t.hasOwnProperty(n)) {
245
- for (var o in e)
246
- if (e.hasOwnProperty(o) && e[o] === t[n][o])
247
- return Number(n);
248
- }
249
- return -1;
250
- }
251
- function ge(t, e) {
252
- if (!t || !t.getBoundingClientRect)
253
- return se();
254
- var n = t, o = !1;
255
- do
256
- if (n.clientWidth < n.scrollWidth || n.clientHeight < n.scrollHeight) {
257
- var r = m(n);
258
- if (n.clientWidth < n.scrollWidth && (r.overflowX == "auto" || r.overflowX == "scroll") || n.clientHeight < n.scrollHeight && (r.overflowY == "auto" || r.overflowY == "scroll")) {
259
- if (!n.getBoundingClientRect || n === document.body)
260
- return se();
261
- if (o || e)
262
- return n;
263
- o = !0;
264
- }
265
- }
266
- while (n = n.parentNode);
267
- return se();
268
- }
269
- function Yn(t, e) {
270
- if (t && e)
271
- for (var n in e)
272
- e.hasOwnProperty(n) && (t[n] = e[n]);
273
- return t;
274
- }
275
- function nt(t, e) {
276
- 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);
277
- }
278
- var Pe;
279
- function qt(t, e) {
280
- return function() {
281
- if (!Pe) {
282
- var n = arguments, o = this;
283
- n.length === 1 ? t.call(o, n[0]) : t.apply(o, n), Pe = setTimeout(function() {
284
- Pe = void 0;
285
- }, e);
286
- }
287
- };
288
- }
289
- function jn() {
290
- clearTimeout(Pe), Pe = void 0;
291
- }
292
- function Kt(t, e, n) {
293
- t.scrollLeft += e, t.scrollTop += n;
294
- }
295
- function Jt(t) {
296
- var e = window.Polymer, n = window.jQuery || window.Zepto;
297
- return e && e.dom ? e.dom(t).cloneNode(!0) : n ? n(t).clone(!0)[0] : t.cloneNode(!0);
298
- }
299
- var K = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
300
- function Un() {
301
- var t = [], e;
302
- return {
303
- captureAnimationState: function() {
304
- if (t = [], !!this.options.animation) {
305
- var o = [].slice.call(this.el.children);
306
- o.forEach(function(r) {
307
- if (!(m(r, "display") === "none" || r === h.ghost)) {
308
- t.push({
309
- target: r,
310
- rect: M(r)
311
- });
312
- var i = le({}, t[t.length - 1].rect);
313
- if (r.thisAnimationDuration) {
314
- var a = Te(r, !0);
315
- a && (i.top -= a.f, i.left -= a.e);
316
- }
317
- r.fromRect = i;
318
- }
319
- });
320
- }
321
- },
322
- addAnimationState: function(o) {
323
- t.push(o);
324
- },
325
- removeAnimationState: function(o) {
326
- t.splice(Xn(t, {
327
- target: o
328
- }), 1);
329
- },
330
- animateAll: function(o) {
331
- var r = this;
332
- if (!this.options.animation) {
333
- clearTimeout(e), typeof o == "function" && o();
334
- return;
335
- }
336
- var i = !1, a = 0;
337
- t.forEach(function(l) {
338
- var s = 0, c = l.target, d = c.fromRect, f = M(c), y = c.prevFromRect, E = c.prevToRect, _ = l.rect, b = Te(c, !0);
339
- b && (f.top -= b.f, f.left -= b.e), c.toRect = f, c.thisAnimationDuration && nt(y, f) && !nt(d, f) && // Make sure animatingRect is on line between toRect & fromRect
340
- (_.top - f.top) / (_.left - f.left) === (d.top - f.top) / (d.left - f.left) && (s = zn(_, y, E, r.options)), nt(f, d) || (c.prevFromRect = d, c.prevToRect = f, s || (s = r.options.animation), r.animate(c, _, f, s)), s && (i = !0, a = Math.max(a, s), clearTimeout(c.animationResetTimer), c.animationResetTimer = setTimeout(function() {
341
- c.animationTime = 0, c.prevFromRect = null, c.fromRect = null, c.prevToRect = null, c.thisAnimationDuration = null;
342
- }, s), c.thisAnimationDuration = s);
343
- }), clearTimeout(e), i ? e = setTimeout(function() {
344
- typeof o == "function" && o();
345
- }, a) : typeof o == "function" && o(), t = [];
346
- },
347
- animate: function(o, r, i, a) {
348
- if (a) {
349
- m(o, "transition", ""), m(o, "transform", "");
350
- var l = Te(this.el), s = l && l.a, c = l && l.d, d = (r.left - i.left) / (s || 1), f = (r.top - i.top) / (c || 1);
351
- o.animatingX = !!d, o.animatingY = !!f, m(o, "transform", "translate3d(" + d + "px," + f + "px,0)"), this.forRepaintDummy = Hn(o), m(o, "transition", "transform " + a + "ms" + (this.options.easing ? " " + this.options.easing : "")), m(o, "transform", "translate3d(0,0,0)"), typeof o.animated == "number" && clearTimeout(o.animated), o.animated = setTimeout(function() {
352
- m(o, "transition", ""), m(o, "transform", ""), o.animated = !1, o.animatingX = !1, o.animatingY = !1;
353
- }, a);
354
- }
355
- }
356
- };
357
- }
358
- function Hn(t) {
359
- return t.offsetWidth;
360
- }
361
- function zn(t, e, n, o) {
362
- return Math.sqrt(Math.pow(e.top - t.top, 2) + Math.pow(e.left - t.left, 2)) / Math.sqrt(Math.pow(e.top - n.top, 2) + Math.pow(e.left - n.left, 2)) * o.animation;
363
- }
364
- var we = [], ot = {
365
- initializeByDefault: !0
366
- }, Me = {
367
- mount: function(e) {
368
- for (var n in ot)
369
- ot.hasOwnProperty(n) && !(n in e) && (e[n] = ot[n]);
370
- we.forEach(function(o) {
371
- if (o.pluginName === e.pluginName)
372
- throw "Sortable: Cannot mount plugin ".concat(e.pluginName, " more than once");
373
- }), we.push(e);
374
- },
375
- pluginEvent: function(e, n, o) {
376
- var r = this;
377
- this.eventCanceled = !1, o.cancel = function() {
378
- r.eventCanceled = !0;
379
- };
380
- var i = e + "Global";
381
- we.forEach(function(a) {
382
- n[a.pluginName] && (n[a.pluginName][i] && n[a.pluginName][i](le({
383
- sortable: n
384
- }, o)), n.options[a.pluginName] && n[a.pluginName][e] && n[a.pluginName][e](le({
385
- sortable: n
386
- }, o)));
387
- });
388
- },
389
- initializePlugins: function(e, n, o, r) {
390
- we.forEach(function(l) {
391
- var s = l.pluginName;
392
- if (!(!e.options[s] && !l.initializeByDefault)) {
393
- var c = new l(e, n, e.options);
394
- c.sortable = e, c.options = e.options, e[s] = c, de(o, c.defaults);
395
- }
396
- });
397
- for (var i in e.options)
398
- if (e.options.hasOwnProperty(i)) {
399
- var a = this.modifyOption(e, i, e.options[i]);
400
- typeof a < "u" && (e.options[i] = a);
401
- }
402
- },
403
- getEventProperties: function(e, n) {
404
- var o = {};
405
- return we.forEach(function(r) {
406
- typeof r.eventProperties == "function" && de(o, r.eventProperties.call(n[r.pluginName], e));
407
- }), o;
408
- },
409
- modifyOption: function(e, n, o) {
410
- var r;
411
- return we.forEach(function(i) {
412
- e[i.pluginName] && i.optionListeners && typeof i.optionListeners[n] == "function" && (r = i.optionListeners[n].call(e[i.pluginName], o));
413
- }), r;
414
- }
415
- };
416
- function Wn(t) {
417
- var e = t.sortable, n = t.rootEl, o = t.name, r = t.targetEl, i = t.cloneEl, a = t.toEl, l = t.fromEl, s = t.oldIndex, c = t.newIndex, d = t.oldDraggableIndex, f = t.newDraggableIndex, y = t.originalEvent, E = t.putSortable, _ = t.extraEventProperties;
418
- if (e = e || n && n[K], !!e) {
419
- var b, X = e.options, w = "on" + o.charAt(0).toUpperCase() + o.substr(1);
420
- window.CustomEvent && !fe && !Ve ? b = new CustomEvent(o, {
421
- bubbles: !0,
422
- cancelable: !0
423
- }) : (b = document.createEvent("Event"), b.initEvent(o, !0, !0)), b.to = a || n, b.from = l || n, b.item = r || n, b.clone = i, b.oldIndex = s, b.newIndex = c, b.oldDraggableIndex = d, b.newDraggableIndex = f, b.originalEvent = y, b.pullMode = E ? E.lastPutMode : void 0;
424
- var g = le(le({}, _), Me.getEventProperties(o, e));
425
- for (var S in g)
426
- b[S] = g[S];
427
- n && n.dispatchEvent(b), X[w] && X[w].call(e, b);
428
- }
429
- }
430
- var Gn = ["evt"], z = function(e, n) {
431
- var o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = o.evt, i = Mn(o, Gn);
432
- Me.pluginEvent.bind(h)(e, n, le({
433
- dragEl: u,
434
- parentEl: P,
435
- ghostEl: v,
436
- rootEl: I,
437
- nextEl: _e,
438
- lastDownEl: He,
439
- cloneEl: N,
440
- cloneHidden: pe,
441
- dragStarted: Ie,
442
- putSortable: B,
443
- activeSortable: h.active,
444
- originalEvent: r,
445
- oldIndex: Se,
446
- oldDraggableIndex: Ne,
447
- newIndex: q,
448
- newDraggableIndex: he,
449
- hideGhostForTarget: tn,
450
- unhideGhostForTarget: nn,
451
- cloneNowHidden: function() {
452
- pe = !0;
453
- },
454
- cloneNowShown: function() {
455
- pe = !1;
456
- },
457
- dispatchSortableEvent: function(l) {
458
- j({
459
- sortable: n,
460
- name: l,
461
- originalEvent: r
462
- });
463
- }
464
- }, i));
465
- };
466
- function j(t) {
467
- Wn(le({
468
- putSortable: B,
469
- cloneEl: N,
470
- targetEl: u,
471
- rootEl: I,
472
- oldIndex: Se,
473
- oldDraggableIndex: Ne,
474
- newIndex: q,
475
- newDraggableIndex: he
476
- }, t));
477
- }
478
- var u, P, v, I, _e, He, N, pe, Se, q, Ne, he, $e, B, De = !1, Ke = !1, Je = [], be, ne, rt, it, kt, Rt, Ie, Ee, ke, Re = !1, Le = !1, ze, Y, at = [], pt = !1, Ze = [], tt = typeof document < "u", Be = zt, Vt = Ve || fe ? "cssFloat" : "float", qn = tt && !Ln && !zt && "draggable" in document.createElement("div"), Zt = function() {
479
- if (tt) {
480
- if (fe)
481
- return !1;
482
- var t = document.createElement("x");
483
- return t.style.cssText = "pointer-events:auto", t.style.pointerEvents === "auto";
484
- }
485
- }(), Qt = function(e, n) {
486
- var o = m(e), r = parseInt(o.width) - parseInt(o.paddingLeft) - parseInt(o.paddingRight) - parseInt(o.borderLeftWidth) - parseInt(o.borderRightWidth), i = Ce(e, 0, n), a = Ce(e, 1, n), l = i && m(i), s = a && m(a), c = l && parseInt(l.marginLeft) + parseInt(l.marginRight) + M(i).width, d = s && parseInt(s.marginLeft) + parseInt(s.marginRight) + M(a).width;
487
- if (o.display === "flex")
488
- return o.flexDirection === "column" || o.flexDirection === "column-reverse" ? "vertical" : "horizontal";
489
- if (o.display === "grid")
490
- return o.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
491
- if (i && l.float && l.float !== "none") {
492
- var f = l.float === "left" ? "left" : "right";
493
- return a && (s.clear === "both" || s.clear === f) ? "vertical" : "horizontal";
494
- }
495
- return i && (l.display === "block" || l.display === "flex" || l.display === "table" || l.display === "grid" || c >= r && o[Vt] === "none" || a && o[Vt] === "none" && c + d > r) ? "vertical" : "horizontal";
496
- }, Kn = function(e, n, o) {
497
- var r = o ? e.left : e.top, i = o ? e.right : e.bottom, a = o ? e.width : e.height, l = o ? n.left : n.top, s = o ? n.right : n.bottom, c = o ? n.width : n.height;
498
- return r === l || i === s || r + a / 2 === l + c / 2;
499
- }, Jn = function(e, n) {
500
- var o;
501
- return Je.some(function(r) {
502
- var i = r[K].options.emptyInsertThreshold;
503
- if (!(!i || wt(r))) {
504
- var a = M(r), l = e >= a.left - i && e <= a.right + i, s = n >= a.top - i && n <= a.bottom + i;
505
- if (l && s)
506
- return o = r;
507
- }
508
- }), o;
509
- }, en = function(e) {
510
- function n(i, a) {
511
- return function(l, s, c, d) {
512
- var f = l.options.group.name && s.options.group.name && l.options.group.name === s.options.group.name;
513
- if (i == null && (a || f))
514
- return !0;
515
- if (i == null || i === !1)
516
- return !1;
517
- if (a && i === "clone")
518
- return i;
519
- if (typeof i == "function")
520
- return n(i(l, s, c, d), a)(l, s, c, d);
521
- var y = (a ? l : s).options.group.name;
522
- return i === !0 || typeof i == "string" && i === y || i.join && i.indexOf(y) > -1;
523
- };
524
- }
525
- var o = {}, r = e.group;
526
- (!r || Ue(r) != "object") && (r = {
527
- name: r
528
- }), o.name = r.name, o.checkPull = n(r.pull, !0), o.checkPut = n(r.put), o.revertClone = r.revertClone, e.group = o;
529
- }, tn = function() {
530
- !Zt && v && m(v, "display", "none");
531
- }, nn = function() {
532
- !Zt && v && m(v, "display", "");
533
- };
534
- tt && document.addEventListener("click", function(t) {
535
- if (Ke)
536
- return t.preventDefault(), t.stopPropagation && t.stopPropagation(), t.stopImmediatePropagation && t.stopImmediatePropagation(), Ke = !1, !1;
537
- }, !0);
538
- var ye = function(e) {
539
- if (u) {
540
- e = e.touches ? e.touches[0] : e;
541
- var n = Jn(e.clientX, e.clientY);
542
- if (n) {
543
- var o = {};
544
- for (var r in e)
545
- e.hasOwnProperty(r) && (o[r] = e[r]);
546
- o.target = o.rootEl = n, o.preventDefault = void 0, o.stopPropagation = void 0, n[K]._onDragOver(o);
547
- }
548
- }
549
- }, Zn = function(e) {
550
- u && u.parentNode[K]._isOutsideThisEl(e.target);
551
- };
552
- function h(t, e) {
553
- if (!(t && t.nodeType && t.nodeType === 1))
554
- throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));
555
- this.el = t, this.options = e = de({}, e), t[K] = this;
556
- var n = {
557
- group: null,
558
- sort: !0,
559
- disabled: !1,
560
- store: null,
561
- handle: null,
562
- draggable: /^[uo]l$/i.test(t.nodeName) ? ">li" : ">*",
563
- swapThreshold: 1,
564
- // percentage; 0 <= x <= 1
565
- invertSwap: !1,
566
- // invert always
567
- invertedSwapThreshold: null,
568
- // will be set to same as swapThreshold if default
569
- removeCloneOnHide: !0,
570
- direction: function() {
571
- return Qt(t, this.options);
572
- },
573
- ghostClass: "sortable-ghost",
574
- chosenClass: "sortable-chosen",
575
- dragClass: "sortable-drag",
576
- ignore: "a, img",
577
- filter: null,
578
- preventOnFilter: !0,
579
- animation: 0,
580
- easing: null,
581
- setData: function(a, l) {
582
- a.setData("Text", l.textContent);
583
- },
584
- dropBubble: !1,
585
- dragoverBubble: !1,
586
- dataIdAttr: "data-id",
587
- delay: 0,
588
- delayOnTouchOnly: !1,
589
- touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
590
- forceFallback: !1,
591
- fallbackClass: "sortable-fallback",
592
- fallbackOnBody: !1,
593
- fallbackTolerance: 0,
594
- fallbackOffset: {
595
- x: 0,
596
- y: 0
597
- },
598
- supportPointer: h.supportPointer !== !1 && "PointerEvent" in window && !Ae,
599
- emptyInsertThreshold: 5
600
- };
601
- Me.initializePlugins(this, t, n);
602
- for (var o in n)
603
- !(o in e) && (e[o] = n[o]);
604
- en(e);
605
- for (var r in this)
606
- r.charAt(0) === "_" && typeof this[r] == "function" && (this[r] = this[r].bind(this));
607
- this.nativeDraggable = e.forceFallback ? !1 : qn, this.nativeDraggable && (this.options.touchStartThreshold = 1), e.supportPointer ? T(t, "pointerdown", this._onTapStart) : (T(t, "mousedown", this._onTapStart), T(t, "touchstart", this._onTapStart)), this.nativeDraggable && (T(t, "dragover", this), T(t, "dragenter", this)), Je.push(this.el), e.store && e.store.get && this.sort(e.store.get(this) || []), de(this, Un());
608
- }
609
- h.prototype = /** @lends Sortable.prototype */
610
- {
611
- constructor: h,
612
- _isOutsideThisEl: function(e) {
613
- !this.el.contains(e) && e !== this.el && (Ee = null);
614
- },
615
- _getDirection: function(e, n) {
616
- return typeof this.options.direction == "function" ? this.options.direction.call(this, e, n, u) : this.options.direction;
617
- },
618
- _onTapStart: function(e) {
619
- if (e.cancelable) {
620
- var n = this, o = this.el, r = this.options, i = r.preventOnFilter, a = e.type, l = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, s = (l || e).target, c = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || s, d = r.filter;
621
- if (ao(o), !u && !(/mousedown|pointerdown/.test(a) && e.button !== 0 || r.disabled) && !c.isContentEditable && !(!this.nativeDraggable && Ae && s && s.tagName.toUpperCase() === "SELECT") && (s = ae(s, r.draggable, o, !1), !(s && s.animated) && He !== s)) {
622
- if (Se = ee(s), Ne = ee(s, r.draggable), typeof d == "function") {
623
- if (d.call(this, e, s, this)) {
624
- j({
625
- sortable: n,
626
- rootEl: c,
627
- name: "filter",
628
- targetEl: s,
629
- toEl: o,
630
- fromEl: o
631
- }), z("filter", n, {
632
- evt: e
633
- }), i && e.cancelable && e.preventDefault();
634
- return;
635
- }
636
- } else if (d && (d = d.split(",").some(function(f) {
637
- if (f = ae(c, f.trim(), o, !1), f)
638
- return j({
639
- sortable: n,
640
- rootEl: f,
641
- name: "filter",
642
- targetEl: s,
643
- fromEl: o,
644
- toEl: o
645
- }), z("filter", n, {
646
- evt: e
647
- }), !0;
648
- }), d)) {
649
- i && e.cancelable && e.preventDefault();
650
- return;
651
- }
652
- r.handle && !ae(c, r.handle, o, !1) || this._prepareDragStart(e, l, s);
653
- }
654
- }
655
- },
656
- _prepareDragStart: function(e, n, o) {
657
- var r = this, i = r.el, a = r.options, l = i.ownerDocument, s;
658
- if (o && !u && o.parentNode === i) {
659
- var c = M(o);
660
- if (I = i, u = o, P = u.parentNode, _e = u.nextSibling, He = o, $e = a.group, h.dragged = u, be = {
661
- target: u,
662
- clientX: (n || e).clientX,
663
- clientY: (n || e).clientY
664
- }, kt = be.clientX - c.left, Rt = be.clientY - c.top, this._lastX = (n || e).clientX, this._lastY = (n || e).clientY, u.style["will-change"] = "all", s = function() {
665
- if (z("delayEnded", r, {
666
- evt: e
667
- }), h.eventCanceled) {
668
- r._onDrop();
669
- return;
670
- }
671
- r._disableDelayedDragEvents(), !Ft && r.nativeDraggable && (u.draggable = !0), r._triggerDragStart(e, n), j({
672
- sortable: r,
673
- name: "choose",
674
- originalEvent: e
675
- }), G(u, a.chosenClass, !0);
676
- }, a.ignore.split(",").forEach(function(d) {
677
- Gt(u, d.trim(), st);
678
- }), T(l, "dragover", ye), T(l, "mousemove", ye), T(l, "touchmove", ye), T(l, "mouseup", r._onDrop), T(l, "touchend", r._onDrop), T(l, "touchcancel", r._onDrop), Ft && this.nativeDraggable && (this.options.touchStartThreshold = 4, u.draggable = !0), z("delayStart", this, {
679
- evt: e
680
- }), a.delay && (!a.delayOnTouchOnly || n) && (!this.nativeDraggable || !(Ve || fe))) {
681
- if (h.eventCanceled) {
682
- this._onDrop();
683
- return;
684
- }
685
- T(l, "mouseup", r._disableDelayedDrag), T(l, "touchend", r._disableDelayedDrag), T(l, "touchcancel", r._disableDelayedDrag), T(l, "mousemove", r._delayedDragTouchMoveHandler), T(l, "touchmove", r._delayedDragTouchMoveHandler), a.supportPointer && T(l, "pointermove", r._delayedDragTouchMoveHandler), r._dragStartTimer = setTimeout(s, a.delay);
686
- } else
687
- s();
688
- }
689
- },
690
- _delayedDragTouchMoveHandler: function(e) {
691
- var n = e.touches ? e.touches[0] : e;
692
- 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();
693
- },
694
- _disableDelayedDrag: function() {
695
- u && st(u), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
696
- },
697
- _disableDelayedDragEvents: function() {
698
- var e = this.el.ownerDocument;
699
- D(e, "mouseup", this._disableDelayedDrag), D(e, "touchend", this._disableDelayedDrag), D(e, "touchcancel", this._disableDelayedDrag), D(e, "mousemove", this._delayedDragTouchMoveHandler), D(e, "touchmove", this._delayedDragTouchMoveHandler), D(e, "pointermove", this._delayedDragTouchMoveHandler);
700
- },
701
- _triggerDragStart: function(e, n) {
702
- n = n || e.pointerType == "touch" && e, !this.nativeDraggable || n ? this.options.supportPointer ? T(document, "pointermove", this._onTouchMove) : n ? T(document, "touchmove", this._onTouchMove) : T(document, "mousemove", this._onTouchMove) : (T(u, "dragend", this), T(I, "dragstart", this._onDragStart));
703
- try {
704
- document.selection ? We(function() {
705
- document.selection.empty();
706
- }) : window.getSelection().removeAllRanges();
707
- } catch {
708
- }
709
- },
710
- _dragStarted: function(e, n) {
711
- if (De = !1, I && u) {
712
- z("dragStarted", this, {
713
- evt: n
714
- }), this.nativeDraggable && T(document, "dragover", Zn);
715
- var o = this.options;
716
- !e && G(u, o.dragClass, !1), G(u, o.ghostClass, !0), h.active = this, e && this._appendGhost(), j({
717
- sortable: this,
718
- name: "start",
719
- originalEvent: n
720
- });
721
- } else
722
- this._nulling();
723
- },
724
- _emulateDragOver: function() {
725
- if (ne) {
726
- this._lastX = ne.clientX, this._lastY = ne.clientY, tn();
727
- for (var e = document.elementFromPoint(ne.clientX, ne.clientY), n = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(ne.clientX, ne.clientY), e !== n); )
728
- n = e;
729
- if (u.parentNode[K]._isOutsideThisEl(e), n)
730
- do {
731
- if (n[K]) {
732
- var o = void 0;
733
- if (o = n[K]._onDragOver({
734
- clientX: ne.clientX,
735
- clientY: ne.clientY,
736
- target: e,
737
- rootEl: n
738
- }), o && !this.options.dragoverBubble)
739
- break;
740
- }
741
- e = n;
742
- } while (n = n.parentNode);
743
- nn();
744
- }
745
- },
746
- _onTouchMove: function(e) {
747
- if (be) {
748
- var n = this.options, o = n.fallbackTolerance, r = n.fallbackOffset, i = e.touches ? e.touches[0] : e, a = v && Te(v, !0), l = v && a && a.a, s = v && a && a.d, c = Be && Y && Nt(Y), d = (i.clientX - be.clientX + r.x) / (l || 1) + (c ? c[0] - at[0] : 0) / (l || 1), f = (i.clientY - be.clientY + r.y) / (s || 1) + (c ? c[1] - at[1] : 0) / (s || 1);
749
- if (!h.active && !De) {
750
- if (o && Math.max(Math.abs(i.clientX - this._lastX), Math.abs(i.clientY - this._lastY)) < o)
751
- return;
752
- this._onDragStart(e, !0);
753
- }
754
- if (v) {
755
- a ? (a.e += d - (rt || 0), a.f += f - (it || 0)) : a = {
756
- a: 1,
757
- b: 0,
758
- c: 0,
759
- d: 1,
760
- e: d,
761
- f
762
- };
763
- var y = "matrix(".concat(a.a, ",").concat(a.b, ",").concat(a.c, ",").concat(a.d, ",").concat(a.e, ",").concat(a.f, ")");
764
- m(v, "webkitTransform", y), m(v, "mozTransform", y), m(v, "msTransform", y), m(v, "transform", y), rt = d, it = f, ne = i;
765
- }
766
- e.cancelable && e.preventDefault();
767
- }
768
- },
769
- _appendGhost: function() {
770
- if (!v) {
771
- var e = this.options.fallbackOnBody ? document.body : I, n = M(u, !0, Be, !0, e), o = this.options;
772
- if (Be) {
773
- for (Y = e; m(Y, "position") === "static" && m(Y, "transform") === "none" && Y !== document; )
774
- Y = Y.parentNode;
775
- Y !== document.body && Y !== document.documentElement ? (Y === document && (Y = se()), n.top += Y.scrollTop, n.left += Y.scrollLeft) : Y = se(), at = Nt(Y);
776
- }
777
- v = u.cloneNode(!0), G(v, o.ghostClass, !1), G(v, o.fallbackClass, !0), G(v, o.dragClass, !0), m(v, "transition", ""), m(v, "transform", ""), m(v, "box-sizing", "border-box"), m(v, "margin", 0), m(v, "top", n.top), m(v, "left", n.left), m(v, "width", n.width), m(v, "height", n.height), m(v, "opacity", "0.8"), m(v, "position", Be ? "absolute" : "fixed"), m(v, "zIndex", "100000"), m(v, "pointerEvents", "none"), h.ghost = v, e.appendChild(v), m(v, "transform-origin", kt / parseInt(v.style.width) * 100 + "% " + Rt / parseInt(v.style.height) * 100 + "%");
778
- }
779
- },
780
- _onDragStart: function(e, n) {
781
- var o = this, r = e.dataTransfer, i = o.options;
782
- if (z("dragStart", this, {
783
- evt: e
784
- }), h.eventCanceled) {
785
- this._onDrop();
786
- return;
787
- }
788
- z("setupClone", this), h.eventCanceled || (N = Jt(u), N.draggable = !1, N.style["will-change"] = "", this._hideClone(), G(N, this.options.chosenClass, !1), h.clone = N), o.cloneId = We(function() {
789
- z("clone", o), !h.eventCanceled && (o.options.removeCloneOnHide || I.insertBefore(N, u), o._hideClone(), j({
790
- sortable: o,
791
- name: "clone"
792
- }));
793
- }), !n && G(u, i.dragClass, !0), n ? (Ke = !0, o._loopId = setInterval(o._emulateDragOver, 50)) : (D(document, "mouseup", o._onDrop), D(document, "touchend", o._onDrop), D(document, "touchcancel", o._onDrop), r && (r.effectAllowed = "move", i.setData && i.setData.call(o, r, u)), T(document, "drop", o), m(u, "transform", "translateZ(0)")), De = !0, o._dragStartId = We(o._dragStarted.bind(o, n, e)), T(document, "selectstart", o), Ie = !0, Ae && m(document.body, "user-select", "none");
794
- },
795
- // Returns true - if no further action is needed (either inserted or another condition)
796
- _onDragOver: function(e) {
797
- var n = this.el, o = e.target, r, i, a, l = this.options, s = l.group, c = h.active, d = $e === s, f = l.sort, y = B || c, E, _ = this, b = !1;
798
- if (pt)
799
- return;
800
- function X(xe, mn) {
801
- z(xe, _, le({
802
- evt: e,
803
- isOwner: d,
804
- axis: E ? "vertical" : "horizontal",
805
- revert: a,
806
- dragRect: r,
807
- targetRect: i,
808
- canSort: f,
809
- fromSortable: y,
810
- target: o,
811
- completed: g,
812
- onMove: function(St, hn) {
813
- return Xe(I, n, u, r, St, M(St), e, hn);
814
- },
815
- changed: S
816
- }, mn));
817
- }
818
- function w() {
819
- X("dragOverAnimationCapture"), _.captureAnimationState(), _ !== y && y.captureAnimationState();
820
- }
821
- function g(xe) {
822
- return X("dragOverCompleted", {
823
- insertion: xe
824
- }), xe && (d ? c._hideClone() : c._showClone(_), _ !== y && (G(u, B ? B.options.ghostClass : c.options.ghostClass, !1), G(u, l.ghostClass, !0)), B !== _ && _ !== h.active ? B = _ : _ === h.active && B && (B = null), y === _ && (_._ignoreWhileAnimating = o), _.animateAll(function() {
825
- X("dragOverAnimationComplete"), _._ignoreWhileAnimating = null;
826
- }), _ !== y && (y.animateAll(), y._ignoreWhileAnimating = null)), (o === u && !u.animated || o === n && !o.animated) && (Ee = null), !l.dragoverBubble && !e.rootEl && o !== document && (u.parentNode[K]._isOutsideThisEl(e.target), !xe && ye(e)), !l.dragoverBubble && e.stopPropagation && e.stopPropagation(), b = !0;
827
- }
828
- function S() {
829
- q = ee(u), he = ee(u, l.draggable), j({
830
- sortable: _,
831
- name: "change",
832
- toEl: n,
833
- newIndex: q,
834
- newDraggableIndex: he,
835
- originalEvent: e
836
- });
837
- }
838
- if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), o = ae(o, l.draggable, n, !0), X("dragOver"), h.eventCanceled)
839
- return b;
840
- if (u.contains(e.target) || o.animated && o.animatingX && o.animatingY || _._ignoreWhileAnimating === o)
841
- return g(!1);
842
- if (Ke = !1, c && !l.disabled && (d ? f || (a = P !== I) : B === this || (this.lastPutMode = $e.checkPull(this, c, u, e)) && s.checkPut(this, c, u, e))) {
843
- if (E = this._getDirection(e, o) === "vertical", r = M(u), X("dragOverValid"), h.eventCanceled)
844
- return b;
845
- if (a)
846
- return P = I, w(), this._hideClone(), X("revert"), h.eventCanceled || (_e ? I.insertBefore(u, _e) : I.appendChild(u)), g(!0);
847
- var A = wt(n, l.draggable);
848
- if (!A || no(e, E, this) && !A.animated) {
849
- if (A === u)
850
- return g(!1);
851
- if (A && n === e.target && (o = A), o && (i = M(o)), Xe(I, n, u, r, o, i, e, !!o) !== !1)
852
- return w(), n.appendChild(u), P = n, S(), g(!0);
853
- } else if (A && to(e, E, this)) {
854
- var L = Ce(n, 0, l, !0);
855
- if (L === u)
856
- return g(!1);
857
- if (o = L, i = M(o), Xe(I, n, u, r, o, i, e, !1) !== !1)
858
- return w(), n.insertBefore(u, L), P = n, S(), g(!0);
859
- } else if (o.parentNode === n) {
860
- i = M(o);
861
- var R = 0, p, C = u.parentNode !== n, F = !Kn(u.animated && u.toRect || r, o.animated && o.toRect || i, E), J = E ? "top" : "left", re = Pt(o, "top", "top") || Pt(u, "top", "top"), me = re ? re.scrollTop : void 0;
862
- Ee !== o && (p = i[J], Re = !1, Le = !F && l.invertSwap || C), R = oo(e, o, i, E, F ? 1 : l.swapThreshold, l.invertedSwapThreshold == null ? l.swapThreshold : l.invertedSwapThreshold, Le, Ee === o);
863
- var Z;
864
- if (R !== 0) {
865
- var ce = ee(u);
866
- do
867
- ce -= R, Z = P.children[ce];
868
- while (Z && (m(Z, "display") === "none" || Z === v));
869
- }
870
- if (R === 0 || Z === o)
871
- return g(!1);
872
- Ee = o, ke = R;
873
- var $ = o.nextElementSibling, H = !1;
874
- H = R === 1;
875
- var W = Xe(I, n, u, r, o, i, e, H);
876
- if (W !== !1)
877
- return (W === 1 || W === -1) && (H = W === 1), pt = !0, setTimeout(eo, 30), w(), H && !$ ? n.appendChild(u) : o.parentNode.insertBefore(u, H ? $ : o), re && Kt(re, 0, me - re.scrollTop), P = u.parentNode, p !== void 0 && !Le && (ze = Math.abs(p - M(o)[J])), S(), g(!0);
878
- }
879
- if (n.contains(u))
880
- return g(!1);
881
- }
882
- return !1;
883
- },
884
- _ignoreWhileAnimating: null,
885
- _offMoveEvents: function() {
886
- D(document, "mousemove", this._onTouchMove), D(document, "touchmove", this._onTouchMove), D(document, "pointermove", this._onTouchMove), D(document, "dragover", ye), D(document, "mousemove", ye), D(document, "touchmove", ye);
887
- },
888
- _offUpEvents: function() {
889
- var e = this.el.ownerDocument;
890
- D(e, "mouseup", this._onDrop), D(e, "touchend", this._onDrop), D(e, "pointerup", this._onDrop), D(e, "touchcancel", this._onDrop), D(document, "selectstart", this);
891
- },
892
- _onDrop: function(e) {
893
- var n = this.el, o = this.options;
894
- if (q = ee(u), he = ee(u, o.draggable), z("drop", this, {
895
- evt: e
896
- }), P = u && u.parentNode, q = ee(u), he = ee(u, o.draggable), h.eventCanceled) {
897
- this._nulling();
898
- return;
899
- }
900
- De = !1, Le = !1, Re = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), gt(this.cloneId), gt(this._dragStartId), this.nativeDraggable && (D(document, "drop", this), D(n, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), Ae && m(document.body, "user-select", ""), m(u, "transform", ""), e && (Ie && (e.cancelable && e.preventDefault(), !o.dropBubble && e.stopPropagation()), v && v.parentNode && v.parentNode.removeChild(v), (I === P || B && B.lastPutMode !== "clone") && N && N.parentNode && N.parentNode.removeChild(N), u && (this.nativeDraggable && D(u, "dragend", this), st(u), u.style["will-change"] = "", Ie && !De && G(u, B ? B.options.ghostClass : this.options.ghostClass, !1), G(u, this.options.chosenClass, !1), j({
901
- sortable: this,
902
- name: "unchoose",
903
- toEl: P,
904
- newIndex: null,
905
- newDraggableIndex: null,
906
- originalEvent: e
907
- }), I !== P ? (q >= 0 && (j({
908
- rootEl: P,
909
- name: "add",
910
- toEl: P,
911
- fromEl: I,
912
- originalEvent: e
913
- }), j({
914
- sortable: this,
915
- name: "remove",
916
- toEl: P,
917
- originalEvent: e
918
- }), j({
919
- rootEl: P,
920
- name: "sort",
921
- toEl: P,
922
- fromEl: I,
923
- originalEvent: e
924
- }), j({
925
- sortable: this,
926
- name: "sort",
927
- toEl: P,
928
- originalEvent: e
929
- })), B && B.save()) : q !== Se && q >= 0 && (j({
930
- sortable: this,
931
- name: "update",
932
- toEl: P,
933
- originalEvent: e
934
- }), j({
935
- sortable: this,
936
- name: "sort",
937
- toEl: P,
938
- originalEvent: e
939
- })), h.active && ((q == null || q === -1) && (q = Se, he = Ne), j({
940
- sortable: this,
941
- name: "end",
942
- toEl: P,
943
- originalEvent: e
944
- }), this.save()))), this._nulling();
945
- },
946
- _nulling: function() {
947
- z("nulling", this), I = u = P = v = _e = N = He = pe = be = ne = Ie = q = he = Se = Ne = Ee = ke = B = $e = h.dragged = h.ghost = h.clone = h.active = null, Ze.forEach(function(e) {
948
- e.checked = !0;
949
- }), Ze.length = rt = it = 0;
950
- },
951
- handleEvent: function(e) {
952
- switch (e.type) {
953
- case "drop":
954
- case "dragend":
955
- this._onDrop(e);
956
- break;
957
- case "dragenter":
958
- case "dragover":
959
- u && (this._onDragOver(e), Qn(e));
960
- break;
961
- case "selectstart":
962
- e.preventDefault();
963
- break;
964
- }
965
- },
966
- /**
967
- * Serializes the item into an array of string.
968
- * @returns {String[]}
969
- */
970
- toArray: function() {
971
- for (var e = [], n, o = this.el.children, r = 0, i = o.length, a = this.options; r < i; r++)
972
- n = o[r], ae(n, a.draggable, this.el, !1) && e.push(n.getAttribute(a.dataIdAttr) || io(n));
973
- return e;
974
- },
975
- /**
976
- * Sorts the elements according to the array.
977
- * @param {String[]} order order of the items
978
- */
979
- sort: function(e, n) {
980
- var o = {}, r = this.el;
981
- this.toArray().forEach(function(i, a) {
982
- var l = r.children[a];
983
- ae(l, this.options.draggable, r, !1) && (o[i] = l);
984
- }, this), n && this.captureAnimationState(), e.forEach(function(i) {
985
- o[i] && (r.removeChild(o[i]), r.appendChild(o[i]));
986
- }), n && this.animateAll();
987
- },
988
- /**
989
- * Save the current sorting
990
- */
991
- save: function() {
992
- var e = this.options.store;
993
- e && e.set && e.set(this);
994
- },
995
- /**
996
- * 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.
997
- * @param {HTMLElement} el
998
- * @param {String} [selector] default: `options.draggable`
999
- * @returns {HTMLElement|null}
1000
- */
1001
- closest: function(e, n) {
1002
- return ae(e, n || this.options.draggable, this.el, !1);
1003
- },
1004
- /**
1005
- * Set/get option
1006
- * @param {string} name
1007
- * @param {*} [value]
1008
- * @returns {*}
1009
- */
1010
- option: function(e, n) {
1011
- var o = this.options;
1012
- if (n === void 0)
1013
- return o[e];
1014
- var r = Me.modifyOption(this, e, n);
1015
- typeof r < "u" ? o[e] = r : o[e] = n, e === "group" && en(o);
1016
- },
1017
- /**
1018
- * Destroy
1019
- */
1020
- destroy: function() {
1021
- z("destroy", this);
1022
- var e = this.el;
1023
- e[K] = null, D(e, "mousedown", this._onTapStart), D(e, "touchstart", this._onTapStart), D(e, "pointerdown", this._onTapStart), this.nativeDraggable && (D(e, "dragover", this), D(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(n) {
1024
- n.removeAttribute("draggable");
1025
- }), this._onDrop(), this._disableDelayedDragEvents(), Je.splice(Je.indexOf(this.el), 1), this.el = e = null;
1026
- },
1027
- _hideClone: function() {
1028
- if (!pe) {
1029
- if (z("hideClone", this), h.eventCanceled)
1030
- return;
1031
- m(N, "display", "none"), this.options.removeCloneOnHide && N.parentNode && N.parentNode.removeChild(N), pe = !0;
1032
- }
1033
- },
1034
- _showClone: function(e) {
1035
- if (e.lastPutMode !== "clone") {
1036
- this._hideClone();
1037
- return;
1038
- }
1039
- if (pe) {
1040
- if (z("showClone", this), h.eventCanceled)
1041
- return;
1042
- u.parentNode == I && !this.options.group.revertClone ? I.insertBefore(N, u) : _e ? I.insertBefore(N, _e) : I.appendChild(N), this.options.group.revertClone && this.animate(u, N), m(N, "display", ""), pe = !1;
1043
- }
1044
- }
1045
- };
1046
- function Qn(t) {
1047
- t.dataTransfer && (t.dataTransfer.dropEffect = "move"), t.cancelable && t.preventDefault();
1048
- }
1049
- function Xe(t, e, n, o, r, i, a, l) {
1050
- var s, c = t[K], d = c.options.onMove, f;
1051
- return window.CustomEvent && !fe && !Ve ? s = new CustomEvent("move", {
1052
- bubbles: !0,
1053
- cancelable: !0
1054
- }) : (s = document.createEvent("Event"), s.initEvent("move", !0, !0)), s.to = e, s.from = t, s.dragged = n, s.draggedRect = o, s.related = r || e, s.relatedRect = i || M(e), s.willInsertAfter = l, s.originalEvent = a, t.dispatchEvent(s), d && (f = d.call(c, s, a)), f;
1055
- }
1056
- function st(t) {
1057
- t.draggable = !1;
1058
- }
1059
- function eo() {
1060
- pt = !1;
1061
- }
1062
- function to(t, e, n) {
1063
- var o = M(Ce(n.el, 0, n.options, !0)), r = 10;
1064
- return e ? t.clientX < o.left - r || t.clientY < o.top && t.clientX < o.right : t.clientY < o.top - r || t.clientY < o.bottom && t.clientX < o.left;
1065
- }
1066
- function no(t, e, n) {
1067
- var o = M(wt(n.el, n.options.draggable)), r = 10;
1068
- return e ? t.clientX > o.right + r || t.clientX <= o.right && t.clientY > o.bottom && t.clientX >= o.left : t.clientX > o.right && t.clientY > o.top || t.clientX <= o.right && t.clientY > o.bottom + r;
1069
- }
1070
- function oo(t, e, n, o, r, i, a, l) {
1071
- var s = o ? t.clientY : t.clientX, c = o ? n.height : n.width, d = o ? n.top : n.left, f = o ? n.bottom : n.right, y = !1;
1072
- if (!a) {
1073
- if (l && ze < c * r) {
1074
- if (!Re && (ke === 1 ? s > d + c * i / 2 : s < f - c * i / 2) && (Re = !0), Re)
1075
- y = !0;
1076
- else if (ke === 1 ? s < d + ze : s > f - ze)
1077
- return -ke;
1078
- } else if (s > d + c * (1 - r) / 2 && s < f - c * (1 - r) / 2)
1079
- return ro(e);
1080
- }
1081
- return y = y || a, y && (s < d + c * i / 2 || s > f - c * i / 2) ? s > d + c / 2 ? 1 : -1 : 0;
1082
- }
1083
- function ro(t) {
1084
- return ee(u) < ee(t) ? 1 : -1;
1085
- }
1086
- function io(t) {
1087
- for (var e = t.tagName + t.className + t.src + t.href + t.textContent, n = e.length, o = 0; n--; )
1088
- o += e.charCodeAt(n);
1089
- return o.toString(36);
1090
- }
1091
- function ao(t) {
1092
- Ze.length = 0;
1093
- for (var e = t.getElementsByTagName("input"), n = e.length; n--; ) {
1094
- var o = e[n];
1095
- o.checked && Ze.push(o);
1096
- }
1097
- }
1098
- function We(t) {
1099
- return setTimeout(t, 0);
1100
- }
1101
- function gt(t) {
1102
- return clearTimeout(t);
1103
- }
1104
- tt && T(document, "touchmove", function(t) {
1105
- (h.active || De) && t.cancelable && t.preventDefault();
1106
- });
1107
- h.utils = {
1108
- on: T,
1109
- off: D,
1110
- css: m,
1111
- find: Gt,
1112
- is: function(e, n) {
1113
- return !!ae(e, n, e, !1);
1114
- },
1115
- extend: Yn,
1116
- throttle: qt,
1117
- closest: ae,
1118
- toggleClass: G,
1119
- clone: Jt,
1120
- index: ee,
1121
- nextTick: We,
1122
- cancelNextTick: gt,
1123
- detectDirection: Qt,
1124
- getChild: Ce
1125
- };
1126
- h.get = function(t) {
1127
- return t[K];
1128
- };
1129
- h.mount = function() {
1130
- for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
1131
- e[n] = arguments[n];
1132
- e[0].constructor === Array && (e = e[0]), e.forEach(function(o) {
1133
- if (!o.prototype || !o.prototype.constructor)
1134
- throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));
1135
- o.utils && (h.utils = le(le({}, h.utils), o.utils)), Me.mount(o);
1136
- });
1137
- };
1138
- h.create = function(t, e) {
1139
- return new h(t, e);
1140
- };
1141
- h.version = $n;
1142
- var k = [], Oe, vt, bt = !1, lt, ct, Qe, Fe;
1143
- function so() {
1144
- function t() {
1145
- this.defaults = {
1146
- scroll: !0,
1147
- forceAutoScrollFallback: !1,
1148
- scrollSensitivity: 30,
1149
- scrollSpeed: 10,
1150
- bubbleScroll: !0
1151
- };
1152
- for (var e in this)
1153
- e.charAt(0) === "_" && typeof this[e] == "function" && (this[e] = this[e].bind(this));
1154
- }
1155
- return t.prototype = {
1156
- dragStarted: function(n) {
1157
- var o = n.originalEvent;
1158
- this.sortable.nativeDraggable ? T(document, "dragover", this._handleAutoScroll) : this.options.supportPointer ? T(document, "pointermove", this._handleFallbackAutoScroll) : o.touches ? T(document, "touchmove", this._handleFallbackAutoScroll) : T(document, "mousemove", this._handleFallbackAutoScroll);
1159
- },
1160
- dragOverCompleted: function(n) {
1161
- var o = n.originalEvent;
1162
- !this.options.dragOverBubble && !o.rootEl && this._handleAutoScroll(o);
1163
- },
1164
- drop: function() {
1165
- this.sortable.nativeDraggable ? D(document, "dragover", this._handleAutoScroll) : (D(document, "pointermove", this._handleFallbackAutoScroll), D(document, "touchmove", this._handleFallbackAutoScroll), D(document, "mousemove", this._handleFallbackAutoScroll)), Mt(), Ge(), jn();
1166
- },
1167
- nulling: function() {
1168
- Qe = vt = Oe = bt = Fe = lt = ct = null, k.length = 0;
1169
- },
1170
- _handleFallbackAutoScroll: function(n) {
1171
- this._handleAutoScroll(n, !0);
1172
- },
1173
- _handleAutoScroll: function(n, o) {
1174
- var r = this, i = (n.touches ? n.touches[0] : n).clientX, a = (n.touches ? n.touches[0] : n).clientY, l = document.elementFromPoint(i, a);
1175
- if (Qe = n, o || this.options.forceAutoScrollFallback || Ve || fe || Ae) {
1176
- ut(n, this.options, l, o);
1177
- var s = ge(l, !0);
1178
- bt && (!Fe || i !== lt || a !== ct) && (Fe && Mt(), Fe = setInterval(function() {
1179
- var c = ge(document.elementFromPoint(i, a), !0);
1180
- c !== s && (s = c, Ge()), ut(n, r.options, c, o);
1181
- }, 10), lt = i, ct = a);
1182
- } else {
1183
- if (!this.options.bubbleScroll || ge(l, !0) === se()) {
1184
- Ge();
1185
- return;
1186
- }
1187
- ut(n, this.options, ge(l, !1), !1);
1188
- }
1189
- }
1190
- }, de(t, {
1191
- pluginName: "scroll",
1192
- initializeByDefault: !0
1193
- });
1194
- }
1195
- function Ge() {
1196
- k.forEach(function(t) {
1197
- clearInterval(t.pid);
1198
- }), k = [];
1199
- }
1200
- function Mt() {
1201
- clearInterval(Fe);
1202
- }
1203
- var ut = qt(function(t, e, n, o) {
1204
- if (e.scroll) {
1205
- var r = (t.touches ? t.touches[0] : t).clientX, i = (t.touches ? t.touches[0] : t).clientY, a = e.scrollSensitivity, l = e.scrollSpeed, s = se(), c = !1, d;
1206
- vt !== n && (vt = n, Ge(), Oe = e.scroll, d = e.scrollFn, Oe === !0 && (Oe = ge(n, !0)));
1207
- var f = 0, y = Oe;
1208
- do {
1209
- var E = y, _ = M(E), b = _.top, X = _.bottom, w = _.left, g = _.right, S = _.width, A = _.height, L = void 0, R = void 0, p = E.scrollWidth, C = E.scrollHeight, F = m(E), J = E.scrollLeft, re = E.scrollTop;
1210
- E === s ? (L = S < p && (F.overflowX === "auto" || F.overflowX === "scroll" || F.overflowX === "visible"), R = A < C && (F.overflowY === "auto" || F.overflowY === "scroll" || F.overflowY === "visible")) : (L = S < p && (F.overflowX === "auto" || F.overflowX === "scroll"), R = A < C && (F.overflowY === "auto" || F.overflowY === "scroll"));
1211
- var me = L && (Math.abs(g - r) <= a && J + S < p) - (Math.abs(w - r) <= a && !!J), Z = R && (Math.abs(X - i) <= a && re + A < C) - (Math.abs(b - i) <= a && !!re);
1212
- if (!k[f])
1213
- for (var ce = 0; ce <= f; ce++)
1214
- k[ce] || (k[ce] = {});
1215
- (k[f].vx != me || k[f].vy != Z || k[f].el !== E) && (k[f].el = E, k[f].vx = me, k[f].vy = Z, clearInterval(k[f].pid), (me != 0 || Z != 0) && (c = !0, k[f].pid = setInterval((function() {
1216
- o && this.layer === 0 && h.active._onTouchMove(Qe);
1217
- var $ = k[this.layer].vy ? k[this.layer].vy * l : 0, H = k[this.layer].vx ? k[this.layer].vx * l : 0;
1218
- typeof d == "function" && d.call(h.dragged.parentNode[K], H, $, t, Qe, k[this.layer].el) !== "continue" || Kt(k[this.layer].el, H, $);
1219
- }).bind({
1220
- layer: f
1221
- }), 24))), f++;
1222
- } while (e.bubbleScroll && y !== s && (y = ge(y, !1)));
1223
- bt = c;
1224
- }
1225
- }, 30), on = function(e) {
1226
- var n = e.originalEvent, o = e.putSortable, r = e.dragEl, i = e.activeSortable, a = e.dispatchSortableEvent, l = e.hideGhostForTarget, s = e.unhideGhostForTarget;
1227
- if (n) {
1228
- var c = o || i;
1229
- l();
1230
- var d = n.changedTouches && n.changedTouches.length ? n.changedTouches[0] : n, f = document.elementFromPoint(d.clientX, d.clientY);
1231
- s(), c && !c.el.contains(f) && (a("spill"), this.onSpill({
1232
- dragEl: r,
1233
- putSortable: o
1234
- }));
1235
- }
1236
- };
1237
- function Et() {
1238
- }
1239
- Et.prototype = {
1240
- startIndex: null,
1241
- dragStart: function(e) {
1242
- var n = e.oldDraggableIndex;
1243
- this.startIndex = n;
1244
- },
1245
- onSpill: function(e) {
1246
- var n = e.dragEl, o = e.putSortable;
1247
- this.sortable.captureAnimationState(), o && o.captureAnimationState();
1248
- var r = Ce(this.sortable.el, this.startIndex, this.options);
1249
- r ? this.sortable.el.insertBefore(n, r) : this.sortable.el.appendChild(n), this.sortable.animateAll(), o && o.animateAll();
1250
- },
1251
- drop: on
1252
- };
1253
- de(Et, {
1254
- pluginName: "revertOnSpill"
1255
- });
1256
- function Dt() {
1257
- }
1258
- Dt.prototype = {
1259
- onSpill: function(e) {
1260
- var n = e.dragEl, o = e.putSortable, r = o || this.sortable;
1261
- r.captureAnimationState(), n.parentNode && n.parentNode.removeChild(n), r.animateAll();
1262
- },
1263
- drop: on
1264
- };
1265
- de(Dt, {
1266
- pluginName: "removeOnSpill"
1267
- });
1268
- h.mount(new so());
1269
- h.mount(Dt, Et);
1270
- function dt(t) {
1271
- t.parentElement !== null && t.parentElement.removeChild(t);
1272
- }
1273
- function $t(t, e, n) {
1274
- const o = n === 0 ? t.children[0] : t.children[n - 1].nextSibling;
1275
- t.insertBefore(e, o);
1276
- }
1277
- function lo() {
1278
- return typeof window < "u" ? window.console : global.console;
1279
- }
1280
- const co = lo();
1281
- function uo(t) {
1282
- const e = /* @__PURE__ */ Object.create(null);
1283
- return function(o) {
1284
- return e[o] || (e[o] = t(o));
1285
- };
1286
- }
1287
- const fo = /-(\w)/g, mo = uo((t) => t.replace(fo, (e, n) => n.toUpperCase())), rn = ["Start", "Add", "Remove", "Update", "End"], an = ["Choose", "Unchoose", "Sort", "Filter", "Clone"], sn = ["Move"], ho = [sn, rn, an].flatMap((t) => t).map((t) => `on${t}`), yt = {
1288
- manage: sn,
1289
- manageAndEmit: rn,
1290
- emit: an
1291
- };
1292
- function po(t) {
1293
- return ho.indexOf(t) !== -1;
1294
- }
1295
- const go = [
1296
- "a",
1297
- "abbr",
1298
- "address",
1299
- "area",
1300
- "article",
1301
- "aside",
1302
- "audio",
1303
- "b",
1304
- "base",
1305
- "bdi",
1306
- "bdo",
1307
- "blockquote",
1308
- "body",
1309
- "br",
1310
- "button",
1311
- "canvas",
1312
- "caption",
1313
- "cite",
1314
- "code",
1315
- "col",
1316
- "colgroup",
1317
- "data",
1318
- "datalist",
1319
- "dd",
1320
- "del",
1321
- "details",
1322
- "dfn",
1323
- "dialog",
1324
- "div",
1325
- "dl",
1326
- "dt",
1327
- "em",
1328
- "embed",
1329
- "fieldset",
1330
- "figcaption",
1331
- "figure",
1332
- "footer",
1333
- "form",
1334
- "h1",
1335
- "h2",
1336
- "h3",
1337
- "h4",
1338
- "h5",
1339
- "h6",
1340
- "head",
1341
- "header",
1342
- "hgroup",
1343
- "hr",
1344
- "html",
1345
- "i",
1346
- "iframe",
1347
- "img",
1348
- "input",
1349
- "ins",
1350
- "kbd",
1351
- "label",
1352
- "legend",
1353
- "li",
1354
- "link",
1355
- "main",
1356
- "map",
1357
- "mark",
1358
- "math",
1359
- "menu",
1360
- "menuitem",
1361
- "meta",
1362
- "meter",
1363
- "nav",
1364
- "noscript",
1365
- "object",
1366
- "ol",
1367
- "optgroup",
1368
- "option",
1369
- "output",
1370
- "p",
1371
- "param",
1372
- "picture",
1373
- "pre",
1374
- "progress",
1375
- "q",
1376
- "rb",
1377
- "rp",
1378
- "rt",
1379
- "rtc",
1380
- "ruby",
1381
- "s",
1382
- "samp",
1383
- "script",
1384
- "section",
1385
- "select",
1386
- "slot",
1387
- "small",
1388
- "source",
1389
- "span",
1390
- "strong",
1391
- "style",
1392
- "sub",
1393
- "summary",
1394
- "sup",
1395
- "svg",
1396
- "table",
1397
- "tbody",
1398
- "td",
1399
- "template",
1400
- "textarea",
1401
- "tfoot",
1402
- "th",
1403
- "thead",
1404
- "time",
1405
- "title",
1406
- "tr",
1407
- "track",
1408
- "u",
1409
- "ul",
1410
- "var",
1411
- "video",
1412
- "wbr"
1413
- ];
1414
- function vo(t) {
1415
- return go.includes(t);
1416
- }
1417
- function bo(t) {
1418
- return ["transition-group", "TransitionGroup"].includes(t);
1419
- }
1420
- function ln(t) {
1421
- return ["id", "class", "role", "style"].includes(t) || t.startsWith("data-") || t.startsWith("aria-") || t.startsWith("on");
1422
- }
1423
- function cn(t) {
1424
- return t.reduce((e, [n, o]) => (e[n] = o, e), {});
1425
- }
1426
- function yo({ $attrs: t, componentData: e = {} }) {
1427
- return {
1428
- ...cn(
1429
- Object.entries(t).filter(([o, r]) => ln(o))
1430
- ),
1431
- ...e
1432
- };
1433
- }
1434
- function _o({ $attrs: t, callBackBuilder: e }) {
1435
- const n = cn(un(t));
1436
- Object.entries(e).forEach(([r, i]) => {
1437
- yt[r].forEach((a) => {
1438
- n[`on${a}`] = i(a);
1439
- });
1440
- });
1441
- const o = `[data-draggable]${n.draggable || ""}`;
1442
- return {
1443
- ...n,
1444
- draggable: o
1445
- };
1446
- }
1447
- function un(t) {
1448
- return Object.entries(t).filter(([e, n]) => !ln(e)).map(([e, n]) => [mo(e), n]).filter(([e, n]) => !po(e));
1449
- }
1450
- const Lt = ({ el: t }) => t, wo = (t, e) => t.__draggable_context = e, Bt = (t) => t.__draggable_context;
1451
- class Eo {
1452
- constructor({
1453
- nodes: { header: e, default: n, footer: o },
1454
- root: r,
1455
- realList: i
1456
- }) {
1457
- this.defaultNodes = n, this.children = [...e, ...n, ...o], this.externalComponent = r.externalComponent, this.rootTransition = r.transition, this.tag = r.tag, this.realList = i;
1458
- }
1459
- get _isRootComponent() {
1460
- return this.externalComponent || this.rootTransition;
1461
- }
1462
- render(e, n) {
1463
- const { tag: o, children: r, _isRootComponent: i } = this;
1464
- return e(o, n, i ? { default: () => r } : r);
1465
- }
1466
- updated() {
1467
- const { defaultNodes: e, realList: n } = this;
1468
- e.forEach((o, r) => {
1469
- wo(Lt(o), {
1470
- element: n[r],
1471
- index: r
1472
- });
1473
- });
1474
- }
1475
- getUnderlyingVm(e) {
1476
- return Bt(e);
1477
- }
1478
- getVmIndexFromDomIndex(e, n) {
1479
- const { defaultNodes: o } = this, { length: r } = o, i = n.children, a = i.item(e);
1480
- if (a === null)
1481
- return r;
1482
- const l = Bt(a);
1483
- if (l)
1484
- return l.index;
1485
- if (r === 0)
1486
- return 0;
1487
- const s = Lt(o[0]), c = [...i].findIndex(
1488
- (d) => d === s
1489
- );
1490
- return e < c ? 0 : r;
1491
- }
1492
- }
1493
- function Do(t, e) {
1494
- const n = t[e];
1495
- return n ? n() : [];
1496
- }
1497
- function So({ $slots: t, realList: e, getKey: n }) {
1498
- const o = e || [], [r, i] = ["header", "footer"].map(
1499
- (s) => Do(t, s)
1500
- ), { item: a } = t;
1501
- if (!a)
1502
- throw new Error("draggable element must have an item slot");
1503
- const l = o.flatMap(
1504
- (s, c) => a({ element: s, index: c }).map((d) => (d.key = n(s), d.props = { ...d.props || {}, "data-draggable": !0 }, d))
1505
- );
1506
- if (l.length !== o.length)
1507
- throw new Error("Item slot must have only one child");
1508
- return {
1509
- header: r,
1510
- footer: i,
1511
- default: l
1512
- };
1513
- }
1514
- function To(t) {
1515
- const e = bo(t), n = !vo(t) && !e;
1516
- return {
1517
- transition: e,
1518
- externalComponent: n,
1519
- tag: n ? oe(t) : e ? pn : t
1520
- };
1521
- }
1522
- function Co({ $slots: t, tag: e, realList: n, getKey: o }) {
1523
- const r = So({ $slots: t, realList: n, getKey: o }), i = To(e);
1524
- return new Eo({ nodes: r, root: i, realList: n });
1525
- }
1526
- function dn(t, e) {
1527
- Yt(() => this.$emit(t.toLowerCase(), e));
1528
- }
1529
- function fn(t) {
1530
- return (e, n) => {
1531
- if (this.realList !== null)
1532
- return this[`onDrag${t}`](e, n);
1533
- };
1534
- }
1535
- function xo(t) {
1536
- const e = fn.call(this, t);
1537
- return (n, o) => {
1538
- e.call(this, n, o), dn.call(this, t, n);
1539
- };
1540
- }
1541
- let ft = null;
1542
- const Io = {
1543
- list: {
1544
- type: Array,
1545
- required: !1,
1546
- default: null
1547
- },
1548
- modelValue: {
1549
- type: Array,
1550
- required: !1,
1551
- default: null
1552
- },
1553
- itemKey: {
1554
- type: [String, Function],
1555
- required: !0
1556
- },
1557
- clone: {
1558
- type: Function,
1559
- default: (t) => t
1560
- },
1561
- tag: {
1562
- type: String,
1563
- default: "div"
1564
- },
1565
- move: {
1566
- type: Function,
1567
- default: null
1568
- },
1569
- componentData: {
1570
- type: Object,
1571
- required: !1,
1572
- default: null
1573
- }
1574
- }, Oo = [
1575
- "update:modelValue",
1576
- "change",
1577
- ...[...yt.manageAndEmit, ...yt.emit].map((t) => t.toLowerCase())
1578
- ], Fo = et({
1579
- name: "draggable",
1580
- inheritAttrs: !1,
1581
- props: Io,
1582
- emits: Oo,
1583
- data() {
1584
- return {
1585
- error: !1
1586
- };
1587
- },
1588
- render() {
1589
- try {
1590
- this.error = !1;
1591
- const { $slots: t, $attrs: e, tag: n, componentData: o, realList: r, getKey: i } = this, a = Co({
1592
- $slots: t,
1593
- tag: n,
1594
- realList: r,
1595
- getKey: i
1596
- });
1597
- this.componentStructure = a;
1598
- const l = yo({ $attrs: e, componentData: o });
1599
- return a.render(Tt, l);
1600
- } catch (t) {
1601
- return this.error = !0, Tt("pre", { style: { color: "red" } }, t.stack);
1602
- }
1603
- },
1604
- created() {
1605
- this.list !== null && this.modelValue !== null && co.error(
1606
- "modelValue and list props are mutually exclusive! Please set one or another."
1607
- );
1608
- },
1609
- mounted() {
1610
- if (this.error)
1611
- return;
1612
- const { $attrs: t, $el: e, componentStructure: n } = this;
1613
- n.updated();
1614
- const o = _o({
1615
- $attrs: t,
1616
- callBackBuilder: {
1617
- manageAndEmit: (i) => xo.call(this, i),
1618
- emit: (i) => dn.bind(this, i),
1619
- manage: (i) => fn.call(this, i)
1620
- }
1621
- }), r = e.nodeType === 1 ? e : e.parentElement;
1622
- this._sortable = new h(r, o), this.targetDomElement = r, r.__draggable_component__ = this;
1623
- },
1624
- updated() {
1625
- this.componentStructure.updated();
1626
- },
1627
- beforeUnmount() {
1628
- this._sortable !== void 0 && this._sortable.destroy();
1629
- },
1630
- computed: {
1631
- realList() {
1632
- const { list: t } = this;
1633
- return t || this.modelValue;
1634
- },
1635
- getKey() {
1636
- const { itemKey: t } = this;
1637
- return typeof t == "function" ? t : (e) => e[t];
1638
- }
1639
- },
1640
- watch: {
1641
- $attrs: {
1642
- handler(t) {
1643
- const { _sortable: e } = this;
1644
- e && un(t).forEach(([n, o]) => {
1645
- e.option(n, o);
1646
- });
1647
- },
1648
- deep: !0
1649
- }
1650
- },
1651
- methods: {
1652
- getUnderlyingVm(t) {
1653
- return this.componentStructure.getUnderlyingVm(t) || null;
1654
- },
1655
- getUnderlyingPotencialDraggableComponent(t) {
1656
- return t.__draggable_component__;
1657
- },
1658
- emitChanges(t) {
1659
- Yt(() => this.$emit("change", t));
1660
- },
1661
- alterList(t) {
1662
- if (this.list) {
1663
- t(this.list);
1664
- return;
1665
- }
1666
- const e = [...this.modelValue];
1667
- t(e), this.$emit("update:modelValue", e);
1668
- },
1669
- spliceList() {
1670
- const t = (e) => e.splice(...arguments);
1671
- this.alterList(t);
1672
- },
1673
- updatePosition(t, e) {
1674
- const n = (o) => o.splice(e, 0, o.splice(t, 1)[0]);
1675
- this.alterList(n);
1676
- },
1677
- getRelatedContextFromMoveEvent({ to: t, related: e }) {
1678
- const n = this.getUnderlyingPotencialDraggableComponent(t);
1679
- if (!n)
1680
- return { component: n };
1681
- const o = n.realList, r = { list: o, component: n };
1682
- return t !== e && o ? { ...n.getUnderlyingVm(e) || {}, ...r } : r;
1683
- },
1684
- getVmIndexFromDomIndex(t) {
1685
- return this.componentStructure.getVmIndexFromDomIndex(
1686
- t,
1687
- this.targetDomElement
1688
- );
1689
- },
1690
- onDragStart(t) {
1691
- this.context = this.getUnderlyingVm(t.item), t.item._underlying_vm_ = this.clone(this.context.element), ft = t.item;
1692
- },
1693
- onDragAdd(t) {
1694
- const e = t.item._underlying_vm_;
1695
- if (e === void 0)
1696
- return;
1697
- dt(t.item);
1698
- const n = this.getVmIndexFromDomIndex(t.newIndex);
1699
- this.spliceList(n, 0, e);
1700
- const o = { element: e, newIndex: n };
1701
- this.emitChanges({ added: o });
1702
- },
1703
- onDragRemove(t) {
1704
- if ($t(this.$el, t.item, t.oldIndex), t.pullMode === "clone") {
1705
- dt(t.clone);
1706
- return;
1707
- }
1708
- const { index: e, element: n } = this.context;
1709
- this.spliceList(e, 1);
1710
- const o = { element: n, oldIndex: e };
1711
- this.emitChanges({ removed: o });
1712
- },
1713
- onDragUpdate(t) {
1714
- dt(t.item), $t(t.from, t.item, t.oldIndex);
1715
- const e = this.context.index, n = this.getVmIndexFromDomIndex(t.newIndex);
1716
- this.updatePosition(e, n);
1717
- const o = { element: this.context.element, oldIndex: e, newIndex: n };
1718
- this.emitChanges({ moved: o });
1719
- },
1720
- computeFutureIndex(t, e) {
1721
- if (!t.element)
1722
- return 0;
1723
- const n = [...e.to.children].filter(
1724
- (a) => a.style.display !== "none"
1725
- ), o = n.indexOf(e.related), r = t.component.getVmIndexFromDomIndex(
1726
- o
1727
- );
1728
- return n.indexOf(ft) !== -1 || !e.willInsertAfter ? r : r + 1;
1729
- },
1730
- onDragMove(t, e) {
1731
- const { move: n, realList: o } = this;
1732
- if (!n || !o)
1733
- return !0;
1734
- const r = this.getRelatedContextFromMoveEvent(t), i = this.computeFutureIndex(r, t), a = {
1735
- ...this.context,
1736
- futureIndex: i
1737
- }, l = {
1738
- ...t,
1739
- relatedContext: r,
1740
- draggedContext: a
1741
- };
1742
- return n(l, e);
1743
- },
1744
- onDragEnd() {
1745
- ft = null;
1746
- }
1747
- }
1748
- }), Ao = { class: "space-y-8" }, Po = { class: "flex items-center justify-between" }, No = { class: "space-y-8" }, ko = { class: "fm-typo-en-body-lg-600" }, Ro = {
1749
- key: 0,
1750
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1751
- }, Vo = /* @__PURE__ */ et({
1752
- __name: "FormItem",
1753
- props: {
1754
- label: {},
1755
- description: {}
1756
- },
1757
- setup(t) {
1758
- return (e, n) => (U(), te("div", Ao, [
1759
- O("div", Po, [
1760
- O("div", No, [
1761
- O("p", ko, Q(e.label), 1),
1762
- e.description ? (U(), te("p", Ro, Q(e.description), 1)) : _t("", !0)
1763
- ]),
1764
- mt(e.$slots, "append")
1765
- ]),
1766
- mt(e.$slots, "default")
1767
- ]));
1768
- }
1769
- });
1770
- var ve = /* @__PURE__ */ ((t) => (t.VOID = "VOID", t.REFUND = "REFUND", t.REJECT_ORDER = "REJECT_ORDER", t))(ve || {});
1771
- const Mo = { class: "fm-typo-en-title-md-600" }, $o = { class: "py-16 space-y-32" }, Lo = { class: "space-y-24" }, Bo = ["data-not-allow-sort"], Xo = {
1772
- key: 1,
1773
- class: "w-24"
1774
- }, Yo = { class: "flex-1" }, jo = { class: "space-y-24" }, Uo = { class: "flex gap-8 items-center justify-start" }, Xt = /* @__PURE__ */ et({
1775
- __name: "ReasonTemplateForm",
1776
- props: {
1777
- initialValue: {},
1778
- onSave: { type: Function }
1779
- },
1780
- setup(t, { expose: e }) {
1781
- var S, A, L, R;
1782
- const n = t, { t: o } = Ht(), r = Sn(), i = An(r), a = Ye(!1), l = () => {
1783
- var C;
1784
- const p = (C = n.initialValue) != null && C.reasons ? [...n.initialValue.reasons] : [];
1785
- return p.push(""), p.map((F, J) => ({
1786
- id: `${Date.now()}-${J}`,
1787
- value: F
1788
- }));
1789
- }, s = gn({
1790
- action: ((S = n.initialValue) == null ? void 0 : S.action) || ve.VOID,
1791
- reasons: (A = n.initialValue) != null && A.reasons ? [...n.initialValue.reasons] : [],
1792
- compulsory: ((L = n.initialValue) == null ? void 0 : L.compulsory) || !1,
1793
- allowOther: ((R = n.initialValue) == null ? void 0 : R.allowOther) || !1,
1794
- reasonItems: l()
1795
- }), c = je(() => n.initialValue ? o("settings.reasonTemplate.form.title.edit") : o("settings.reasonTemplate.form.title.add")), d = [
1796
- {
1797
- label: o("settings.reasonTemplate.actions.void"),
1798
- value: ve.VOID
1799
- },
1800
- {
1801
- label: o("settings.reasonTemplate.actions.refund"),
1802
- value: ve.REFUND
1803
- },
1804
- {
1805
- label: o("settings.reasonTemplate.actions.rejectOrder"),
1806
- value: ve.REJECT_ORDER
1807
- }
1808
- ];
1809
- function f(p) {
1810
- s.reasonItems = p, b();
1811
- }
1812
- function y(p, C) {
1813
- const F = s.reasonItems.findIndex((J) => J.id === p);
1814
- F !== -1 && (s.reasonItems[F].value = C, F === s.reasonItems.length - 1 && C.trim() && E()), b();
1815
- }
1816
- function E() {
1817
- s.reasonItems.push({
1818
- id: `${Date.now()}-${s.reasonItems.length}`,
1819
- value: ""
1820
- });
1821
- }
1822
- function _(p) {
1823
- s.reasonItems = s.reasonItems.filter((C) => C.id !== p), b();
1824
- }
1825
- function b() {
1826
- s.reasons = s.reasonItems.filter((p) => p.value.trim()).map((p) => p.value.trim());
1827
- }
1828
- function X(p) {
1829
- const C = p.draggedContext.futureIndex, F = p.relatedContext.list;
1830
- return C !== F.length - 1;
1831
- }
1832
- jt(
1833
- () => s.reasonItems,
1834
- (p) => {
1835
- (p.length === 0 || p[p.length - 1].value.trim()) && E();
1836
- },
1837
- { deep: !0 }
1838
- );
1839
- async function w() {
1840
- b(), i.minor(
1841
- async () => {
1842
- await n.onSave({
1843
- action: s.action,
1844
- reasons: s.reasons,
1845
- compulsory: s.compulsory,
1846
- allowOther: s.allowOther
1847
- }), a.value = !1;
1848
- },
1849
- {
1850
- successMessage: n.initialValue ? o("settings.reasonTemplate.form.message.updated") : o("settings.reasonTemplate.form.message.created")
1851
- }
1852
- );
1853
- }
1854
- function g() {
1855
- a.value = !a.value;
1856
- }
1857
- return e({ trigger: g }), (p, C) => {
1858
- const F = oe("FmSelect"), J = oe("FmIcon"), re = oe("FmTextField"), me = oe("FmSwitch"), Z = oe("FmButton"), ce = oe("FmSideSheet");
1859
- return U(), te(Ut, null, [
1860
- mt(p.$slots, "trigger", vn(bn({ trigger: g }))),
1861
- V(ce, {
1862
- modelValue: a.value,
1863
- "onUpdate:modelValue": C[4] || (C[4] = ($) => a.value = $),
1864
- "max-width": 560,
1865
- "is-container": x(Tn).FmForm,
1866
- "is-container-props": {
1867
- onValidationSuccess: w,
1868
- blameFormChildOnValidationFailed: !0
1869
- },
1870
- "dismiss-away": ""
1871
- }, {
1872
- "side-sheet-header": ie(() => [
1873
- O("p", Mo, Q(c.value), 1)
1874
- ]),
1875
- "side-sheet-footer": ie(() => [
1876
- O("div", Uo, [
1877
- V(Z, {
1878
- label: x(o)("common.save"),
1879
- size: "lg",
1880
- type: "submit",
1881
- variant: "primary"
1882
- }, null, 8, ["label"]),
1883
- V(Z, {
1884
- label: x(o)("common.cancel"),
1885
- size: "lg",
1886
- variant: "tertiary",
1887
- onClick: C[3] || (C[3] = ($) => a.value = !1)
1888
- }, null, 8, ["label"])
1889
- ])
1890
- ]),
1891
- default: ie(() => [
1892
- O("div", $o, [
1893
- V(It, {
1894
- title: x(o)("settings.reasonTemplate.form.sections.basic.title")
1895
- }, {
1896
- default: ie(() => [
1897
- O("div", Lo, [
1898
- V(F, {
1899
- label: x(o)("settings.reasonTemplate.form.sections.basic.action.label"),
1900
- modelValue: s.action,
1901
- "onUpdate:modelValue": C[0] || (C[0] = ($) => s.action = $),
1902
- items: d,
1903
- rules: [x(kn)],
1904
- "label-mark": "required"
1905
- }, null, 8, ["label", "modelValue", "rules"]),
1906
- V(Vo, {
1907
- label: x(o)("settings.reasonTemplate.form.sections.basic.reasons.label")
1908
- }, {
1909
- default: ie(() => [
1910
- O("div", null, [
1911
- V(x(Fo), {
1912
- "model-value": s.reasonItems,
1913
- move: X,
1914
- class: "space-y-16",
1915
- group: "reasons",
1916
- handle: ".handle",
1917
- "item-key": "id",
1918
- "onUpdate:modelValue": f
1919
- }, {
1920
- item: ie(({ element: $, index: H }) => [
1921
- O("div", {
1922
- class: yn(["flex items-center", "space-x-8"]),
1923
- "data-not-allow-sort": H === s.reasonItems.length - 1
1924
- }, [
1925
- H !== s.reasonItems.length - 1 ? (U(), ht(J, {
1926
- key: 0,
1927
- class: "handle cursor-move",
1928
- name: "drag_handle"
1929
- })) : H > 0 ? (U(), te("div", Xo)) : _t("", !0),
1930
- O("div", Yo, [
1931
- V(re, {
1932
- "model-value": $.value,
1933
- rules: [
1934
- () => !!s.reasonItems.filter((W) => W.value.trim()).length || x(o)("settings.reasonTemplate.form.sections.basic.reasons.min_required"),
1935
- (W) => H === s.reasonItems.length - 1 || W != null && W.trim() ? !0 : x(o)(
1936
- "settings.reasonTemplate.form.sections.basic.reasons.name_required"
1937
- )
1938
- ],
1939
- class: "flex-1",
1940
- placeholder: x(o)("settings.reasonTemplate.form.sections.basic.newReason.placeholder"),
1941
- "onUpdate:modelValue": (W) => y($.id, W)
1942
- }, _n({ _: 2 }, [
1943
- H !== s.reasonItems.length - 1 ? {
1944
- name: "append",
1945
- fn: ie(() => [
1946
- V(J, {
1947
- name: "close",
1948
- class: "cursor-pointer",
1949
- onClick: (W) => _($.id)
1950
- }, null, 8, ["onClick"])
1951
- ]),
1952
- key: "0"
1953
- } : void 0
1954
- ]), 1032, ["model-value", "rules", "placeholder", "onUpdate:modelValue"])
1955
- ])
1956
- ], 8, Bo)
1957
- ]),
1958
- _: 1
1959
- }, 8, ["model-value"])
1960
- ])
1961
- ]),
1962
- _: 1
1963
- }, 8, ["label"])
1964
- ])
1965
- ]),
1966
- _: 1
1967
- }, 8, ["title"]),
1968
- V(It, {
1969
- title: x(o)("settings.reasonTemplate.form.sections.options.title")
1970
- }, {
1971
- default: ie(() => [
1972
- O("div", jo, [
1973
- V(me, {
1974
- modelValue: s.compulsory,
1975
- "onUpdate:modelValue": C[1] || (C[1] = ($) => s.compulsory = $),
1976
- label: x(o)("settings.reasonTemplate.form.sections.options.compulsory.label"),
1977
- sublabel: x(o)("settings.reasonTemplate.form.sections.options.compulsory.sublabel"),
1978
- "label-placement": "right"
1979
- }, null, 8, ["modelValue", "label", "sublabel"]),
1980
- V(me, {
1981
- modelValue: s.allowOther,
1982
- "onUpdate:modelValue": C[2] || (C[2] = ($) => s.allowOther = $),
1983
- label: x(o)("settings.reasonTemplate.form.sections.options.allowOther.label"),
1984
- sublabel: x(o)("settings.reasonTemplate.form.sections.options.allowOther.sublabel"),
1985
- "label-placement": "right"
1986
- }, null, 8, ["modelValue", "label", "sublabel"])
1987
- ])
1988
- ]),
1989
- _: 1
1990
- }, 8, ["title"])
1991
- ])
1992
- ]),
1993
- _: 1
1994
- }, 8, ["modelValue", "is-container", "is-container-props"])
1995
- ], 64);
1996
- };
1997
- }
1998
- }), Ho = { class: "flex flex-1" }, zo = {
1999
- key: 0,
2000
- class: "flex gap-8"
2001
- }, Wo = { class: "space-y-24" }, Go = { class: "flex justify-start" }, qo = { class: "w-[400px]" }, Ko = { key: 0 }, Jo = {
2002
- key: 0,
2003
- class: "space-y-8"
2004
- }, Zo = {
2005
- key: 1,
2006
- class: "flex-1 pb-64 overflow-auto divide-y divide-fm-color-neutral-gray-100"
2007
- }, Qo = { key: 0 }, er = ["onClick"], tr = { class: "flex justify-between items-center" }, nr = { class: "fm-typo-en-body-lg-600" }, or = { class: "flex gap-8" }, rr = { class: "text-fm-color-typo-secondary" }, ir = { class: "text-fm-color-typo-secondary" }, ar = { class: "text-fm-color-typo-secondary" }, sr = {
2008
- key: 1,
2009
- class: "bg-fm-color-neutral-white shadow-light-300 flex max-h-dvh items-center justify-center gap-24 self-stretch p-24"
2010
- }, lr = { class: "flex flex-col items-center justify-center gap-16" }, cr = { class: "fm-typo-title-sm-700" }, ur = { class: "fm-typo-body-md-400 text-center text-gray-500" }, Er = /* @__PURE__ */ et({
2011
- __name: "ReasonTemplate",
2012
- setup(t) {
2013
- const { t: e } = Ht(), n = Cn(), o = xn(), r = je(() => n.breakpoints.value.xs), i = wn(), a = Ye(void 0), l = Ye(null), s = Ye(!1), c = je(() => {
2014
- var w;
2015
- return (w = l.value) != null && w.reasonTemplates ? l.value.reasonTemplates.map((g, S) => ({
2016
- ...g,
2017
- id: `${S}`
2018
- })) : [];
2019
- }), d = {
2020
- [ve.VOID]: e("settings.reasonTemplate.actions.void"),
2021
- [ve.REFUND]: e("settings.reasonTemplate.actions.refund"),
2022
- [ve.REJECT_ORDER]: e("settings.reasonTemplate.actions.rejectOrder")
2023
- }, f = je(() => [
2024
- {
2025
- header: e("settings.reasonTemplate.table.action"),
2026
- accessorKey: "action",
2027
- enableSorting: !1,
2028
- cell: (w) => {
2029
- const g = w.row.original.action;
2030
- return d[g] || g;
2031
- }
2032
- },
2033
- {
2034
- header: e("settings.reasonTemplate.table.reasons"),
2035
- accessorKey: "reasons",
2036
- enableSorting: !1,
2037
- cell: (w) => {
2038
- const g = w.row.original.reasons;
2039
- return g.length > 0 ? g.join(", ") : "--";
2040
- }
2041
- },
2042
- {
2043
- header: e("settings.reasonTemplate.table.compulsory"),
2044
- accessorKey: "compulsory",
2045
- enableSorting: !1,
2046
- cell: (w) => w.row.original.compulsory ? e("common.yes") : e("common.no")
2047
- },
2048
- {
2049
- header: e("settings.reasonTemplate.table.allowOther"),
2050
- accessorKey: "allowOther",
2051
- enableSorting: !1,
2052
- cell: (w) => w.row.original.allowOther ? e("common.yes") : e("common.no")
2053
- },
2054
- {
2055
- id: "action",
2056
- header: "",
2057
- size: 80,
2058
- cell: (w) => {
2059
- const g = w.row.original;
2060
- return Fn([
2061
- {
2062
- name: "edit",
2063
- onClick: () => b(g)
2064
- },
2065
- {
2066
- name: "delete",
2067
- onClick: () => {
2068
- const S = parseInt(g.id);
2069
- X(S);
2070
- }
2071
- }
2072
- ]);
2073
- }
2074
- }
2075
- ]);
2076
- async function y() {
2077
- if (!a.value) {
2078
- l.value = null;
2079
- return;
2080
- }
2081
- s.value = !0;
2082
- try {
2083
- l.value = await Pn(a.value);
2084
- } catch (w) {
2085
- console.error("Failed to load restaurant setting:", w), l.value = null;
2086
- } finally {
2087
- s.value = !1;
2088
- }
2089
- }
2090
- async function E(w) {
2091
- if (!a.value)
2092
- return;
2093
- const g = {
2094
- ...l.value,
2095
- _id: a.value,
2096
- reasonTemplates: w
2097
- };
2098
- try {
2099
- await Nn(a.value, g), l.value = g;
2100
- } catch (S) {
2101
- throw console.error("Failed to save restaurant setting:", S), S;
2102
- }
2103
- }
2104
- function _() {
2105
- xt(i, Xt, {
2106
- onSave: async (w) => {
2107
- var S;
2108
- const g = ((S = l.value) == null ? void 0 : S.reasonTemplates) || [];
2109
- await E([...g, w]);
2110
- }
2111
- });
2112
- }
2113
- function b(w) {
2114
- xt(i, Xt, {
2115
- initialValue: w,
2116
- onSave: async (g) => {
2117
- var R;
2118
- const S = ((R = l.value) == null ? void 0 : R.reasonTemplates) || [], A = parseInt(w.id), L = [...S];
2119
- L[A] = g, await E(L);
2120
- }
2121
- });
2122
- }
2123
- async function X(w) {
2124
- var A;
2125
- const g = ((A = l.value) == null ? void 0 : A.reasonTemplates) || [], S = g[w];
2126
- S && o.open({
2127
- title: e("settings.reasonTemplate.delete.title"),
2128
- message: e("settings.reasonTemplate.delete.message", {
2129
- action: d[S.action] || S.action
2130
- }),
2131
- primaryActions: {
2132
- text: e("common.delete"),
2133
- variant: "destructive",
2134
- close: !0
2135
- },
2136
- secondaryActions: {
2137
- text: e("common.cancel"),
2138
- close: !0
2139
- }
2140
- }).onPrimary(async () => {
2141
- const L = g.filter((R, p) => p !== w);
2142
- await E(L);
2143
- });
2144
- }
2145
- return jt(a, y, { immediate: !0 }), (w, g) => {
2146
- const S = oe("FmSpacer"), A = oe("FmButton"), L = oe("FmTable"), R = oe("FmCircularProgress");
2147
- return U(), ht(On, {
2148
- heading: x(e)("settings.reasonTemplate.title")
2149
- }, {
2150
- "append-heading": ie(() => [
2151
- O("div", Ho, [
2152
- V(S),
2153
- !r.value && a.value ? (U(), te("div", zo, [
2154
- V(A, {
2155
- onClick: _,
2156
- label: x(e)("settings.reasonTemplate.addTemplate"),
2157
- "prepend-icon": "add"
2158
- }, null, 8, ["label"])
2159
- ])) : a.value ? (U(), ht(In, {
2160
- key: 1,
2161
- onClick: _,
2162
- label: x(e)("settings.reasonTemplate.addTemplate"),
2163
- "prepend-icon": "add"
2164
- }, null, 8, ["label"])) : _t("", !0)
2165
- ])
2166
- ]),
2167
- default: ie(() => [
2168
- O("div", Wo, [
2169
- O("div", Go, [
2170
- O("div", qo, [
2171
- V(x(Dn), {
2172
- modelValue: a.value,
2173
- "onUpdate:modelValue": g[0] || (g[0] = (p) => a.value = p),
2174
- "managable-only": !0,
2175
- label: "Select Restaurant",
2176
- "auto-select-first": !0,
2177
- variant: "dark"
2178
- }, null, 8, ["modelValue"])
2179
- ])
2180
- ]),
2181
- a.value ? (U(), te("div", Ko, [
2182
- r.value ? (U(), te("div", Zo, [
2183
- s.value ? (U(), te("div", Qo, [
2184
- V(R, { size: "lg" })
2185
- ])) : (U(!0), te(Ut, { key: 1 }, En(c.value, (p) => (U(), te("div", {
2186
- key: p.id,
2187
- class: "py-12 px-16 space-y-4",
2188
- onClick: (C) => b(p)
2189
- }, [
2190
- O("div", tr, [
2191
- O("div", nr, Q(d[p.action] || p.action), 1),
2192
- O("div", or, [
2193
- V(A, {
2194
- icon: "edit",
2195
- "text-color": "neutral-gray-400",
2196
- variant: "tertiary",
2197
- onClick: Ct((C) => b(p), ["stop"])
2198
- }, null, 8, ["onClick"]),
2199
- V(A, {
2200
- icon: "delete",
2201
- "text-color": "neutral-gray-400",
2202
- variant: "tertiary",
2203
- onClick: Ct((C) => X(parseInt(p.id)), ["stop"])
2204
- }, null, 8, ["onClick"])
2205
- ])
2206
- ]),
2207
- O("div", rr, Q(x(e)("settings.reasonTemplate.table.reasons")) + ": " + Q(p.reasons.length > 0 ? p.reasons.join(", ") : "--"), 1),
2208
- O("div", ir, Q(x(e)("settings.reasonTemplate.table.compulsory")) + ": " + Q(p.compulsory ? x(e)("common.yes") : x(e)("common.no")), 1),
2209
- O("div", ar, Q(x(e)("settings.reasonTemplate.table.allowOther")) + ": " + Q(p.allowOther ? x(e)("common.yes") : x(e)("common.no")), 1)
2210
- ], 8, er))), 128))
2211
- ])) : (U(), te("div", Jo, [
2212
- V(L, {
2213
- "column-defs": f.value,
2214
- "row-data": c.value,
2215
- "shrink-at": !1,
2216
- loading: s.value,
2217
- onRowClick: g[1] || (g[1] = (p) => b(p.original))
2218
- }, null, 8, ["column-defs", "row-data", "loading"])
2219
- ]))
2220
- ])) : (U(), te("div", sr, [
2221
- O("div", lr, [
2222
- O("p", cr, Q(x(e)("settings.reasonTemplate.emptyState.title")), 1),
2223
- O("p", ur, Q(x(e)("settings.reasonTemplate.emptyState.description")), 1)
2224
- ])
2225
- ]))
2226
- ])
2227
- ]),
2228
- _: 1
2229
- }, 8, ["heading"]);
2230
- };
2231
- }
2232
- });
2233
- export {
2234
- Er as default
2235
- };