@prolibu-suite/cobalt-form-builder 0.2.0

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 (42) hide show
  1. package/dist/CobaltFormBuilder.vue.d.ts +200 -0
  2. package/dist/CobaltFormBuilder.vue.d.ts.map +1 -0
  3. package/dist/cobalt-form-builder.cjs +2 -0
  4. package/dist/cobalt-form-builder.cjs.map +1 -0
  5. package/dist/cobalt-form-builder.css +1 -0
  6. package/dist/cobalt-form-builder.js +3446 -0
  7. package/dist/cobalt-form-builder.js.map +1 -0
  8. package/dist/components/DesignerTab.vue.d.ts +4 -0
  9. package/dist/components/DesignerTab.vue.d.ts.map +1 -0
  10. package/dist/components/EditableText.vue.d.ts +19 -0
  11. package/dist/components/EditableText.vue.d.ts.map +1 -0
  12. package/dist/components/FieldCanvas.vue.d.ts +4 -0
  13. package/dist/components/FieldCanvas.vue.d.ts.map +1 -0
  14. package/dist/components/FieldCard.vue.d.ts +9 -0
  15. package/dist/components/FieldCard.vue.d.ts.map +1 -0
  16. package/dist/components/FieldCardExpanded.vue.d.ts +8 -0
  17. package/dist/components/FieldCardExpanded.vue.d.ts.map +1 -0
  18. package/dist/components/FieldToolbox.vue.d.ts +4 -0
  19. package/dist/components/FieldToolbox.vue.d.ts.map +1 -0
  20. package/dist/components/JsonTab.vue.d.ts +4 -0
  21. package/dist/components/JsonTab.vue.d.ts.map +1 -0
  22. package/dist/components/PageCard.vue.d.ts +7 -0
  23. package/dist/components/PageCard.vue.d.ts.map +1 -0
  24. package/dist/components/PreviewTab.vue.d.ts +4 -0
  25. package/dist/components/PreviewTab.vue.d.ts.map +1 -0
  26. package/dist/components/PropertiesPanel.vue.d.ts +4 -0
  27. package/dist/components/PropertiesPanel.vue.d.ts.map +1 -0
  28. package/dist/fieldCatalog.d.ts +17 -0
  29. package/dist/fieldCatalog.d.ts.map +1 -0
  30. package/dist/index.d.ts +29 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/stores/schema.d.ts +193 -0
  33. package/dist/stores/schema.d.ts.map +1 -0
  34. package/examples/01-contact-form.json +36 -0
  35. package/examples/02-nps-survey.json +59 -0
  36. package/examples/03-quiz-vue3.json +59 -0
  37. package/examples/04-event-registration.json +100 -0
  38. package/examples/05-themed-dark-form.json +56 -0
  39. package/examples/06-culture-survey.json +99 -0
  40. package/examples/07-crm-quotation.json +70 -0
  41. package/examples/08-landing-page-embed.json +142 -0
  42. package/package.json +54 -0
@@ -0,0 +1,3446 @@
1
+ import { ref as de, computed as F, reactive as Nn, inject as al, defineComponent as xe, openBlock as C, createElementBlock as D, createElementVNode as p, unref as b, normalizeClass as Ee, createStaticVNode as il, createVNode as x, toDisplayString as ce, createCommentVNode as U, Fragment as Q, renderList as De, watch as Ke, toRefs as rl, h as sl, getCurrentInstance as an, onMounted as An, nextTick as Pn, onUnmounted as ul, isRef as Bt, withModifiers as He, createBlock as Se, createTextVNode as Ye, withCtx as St, normalizeStyle as $n, mergeProps as dl, withDirectives as Fn, vModelText as cl, provide as pl, onBeforeUnmount as fl, renderSlot as mt, vShow as vl } from "vue";
2
+ import { CoInput as W, CoListItem as ml, CoSelect as Ue, CoIconButton as Et, CoButton as It, CoSwitch as it, CoRating as hl, CoSlider as Mn, CoTabGroup as jt, CoTab as zt, CoCheckbox as ht } from "@prolibu-suite/cobalt-vue";
3
+ import { defineCustomElements as gl } from "@prolibu-suite/cobalt-core/loader";
4
+ import { defineCustomElements as bl } from "@prolibu-suite/cobalt-form/loader";
5
+ import { resolveTheme as yl, isPagedSchema as Qt, toPagedSchema as pn, themeToStyles as _l, ACCENT_PRESET_HEX as gt } from "@prolibu-suite/cobalt-form-core";
6
+ const Cl = 50;
7
+ function Lt() {
8
+ return {
9
+ title: "Untitled Form",
10
+ description: "",
11
+ mode: "form",
12
+ pages: [
13
+ {
14
+ name: "page1",
15
+ title: "Page 1",
16
+ description: "",
17
+ fields: {
18
+ name: { type: "String", required: !0, label: "Nombre", full: !0 },
19
+ email: { type: "String", required: !0, format: "email", label: "Email" }
20
+ }
21
+ }
22
+ ],
23
+ theme: {}
24
+ };
25
+ }
26
+ const Kt = {
27
+ text: () => ({ type: "String" }),
28
+ textarea: () => ({ type: "String", uiCom: "TextArea" }),
29
+ number: () => ({ type: "Number" }),
30
+ date: () => ({ type: "Date" }),
31
+ boolean: () => ({ type: "Boolean" }),
32
+ select: () => ({ type: "String", enum: ["Option A", "Option B"] }),
33
+ ref: () => ({ type: "ObjectId", ref: "Company", displayName: "name" }),
34
+ rating: () => ({ type: "Number", uiCom: "Rating", max: 5 }),
35
+ slider: () => ({ type: "Number", uiCom: "Slider", min: 0, max: 100 }),
36
+ color: () => ({ type: "String", uiCom: "ColorPicker" }),
37
+ section: () => ({ uiCom: "Section" }),
38
+ file: () => ({ type: "String", uiCom: "File" })
39
+ };
40
+ function fn(e) {
41
+ return e.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/_/g, " ").toLowerCase().replace(/^./, (n) => n.toUpperCase());
42
+ }
43
+ function nt(e) {
44
+ return JSON.parse(JSON.stringify(e));
45
+ }
46
+ function Sl(e = {}) {
47
+ const n = e.onEvent ?? (() => {
48
+ }), t = de(Lt()), l = de({ kind: "page", pageIdx: 0, fieldName: null }), o = de([]), i = de([]), r = F(() => o.value.length > 0), s = F(() => i.value.length > 0), a = F(
49
+ () => t.value.pages[l.value.pageIdx] ?? null
50
+ ), g = F(() => {
51
+ const v = a.value, h = l.value.fieldName;
52
+ return !v || !h ? null : v.fields[h] ?? null;
53
+ });
54
+ function u(v) {
55
+ l.value = v, n({ type: "selection-changed", selection: v });
56
+ }
57
+ function d(v, h) {
58
+ u({
59
+ kind: h ? "field" : "page",
60
+ pageIdx: v,
61
+ fieldName: h
62
+ });
63
+ }
64
+ function T(v) {
65
+ u({ kind: "page", pageIdx: v, fieldName: null });
66
+ }
67
+ function w() {
68
+ u({ ...l.value, kind: "form" });
69
+ }
70
+ function y() {
71
+ o.value.push(nt(t.value)), o.value.length > Cl && o.value.shift(), i.value = [];
72
+ }
73
+ function k() {
74
+ const v = o.value.pop();
75
+ v && (i.value.push(nt(t.value)), t.value = v, j(), n({ type: "undo" }));
76
+ }
77
+ function B() {
78
+ const v = i.value.pop();
79
+ v && (o.value.push(nt(t.value)), t.value = v, j(), n({ type: "redo" }));
80
+ }
81
+ function j() {
82
+ const v = Math.min(l.value.pageIdx, t.value.pages.length - 1), h = t.value.pages[v], S = l.value.fieldName && h?.fields[l.value.fieldName] ? l.value.fieldName : null, $ = l.value.kind === "form" ? "form" : S ? "field" : "page";
83
+ l.value = { kind: $, pageIdx: Math.max(v, 0), fieldName: S };
84
+ }
85
+ function te(v) {
86
+ v !== t.value.title && (y(), t.value.title = v);
87
+ }
88
+ function z(v) {
89
+ v !== t.value.description && (y(), t.value.description = v);
90
+ }
91
+ function X(v) {
92
+ v !== t.value.mode && (y(), t.value.mode = v);
93
+ }
94
+ function O() {
95
+ y();
96
+ const v = t.value.pages.length + 1;
97
+ t.value.pages.push({
98
+ name: `page${v}`,
99
+ title: `Page ${v}`,
100
+ description: "",
101
+ fields: {}
102
+ });
103
+ const h = t.value.pages.length - 1;
104
+ T(h), n({ type: "page-added", pageIdx: h });
105
+ }
106
+ function se(v) {
107
+ t.value.pages.length <= 1 || (y(), t.value.pages.splice(v, 1), j(), n({ type: "page-removed", pageIdx: v }));
108
+ }
109
+ function J(v) {
110
+ const h = t.value.pages[v];
111
+ if (!h) return;
112
+ y();
113
+ const S = nt(h);
114
+ S.name = G(`${h.name}_copy`), S.title = `${h.title || h.name} (copy)`, t.value.pages.splice(v + 1, 0, S);
115
+ const $ = v + 1;
116
+ T($), n({ type: "page-duplicated", sourceIdx: v, newIdx: $ });
117
+ }
118
+ function ue(v, h) {
119
+ const S = t.value.pages[v];
120
+ S && (y(), Object.assign(S, h), n({ type: "page-updated", pageIdx: v, patch: h }));
121
+ }
122
+ function G(v) {
123
+ const h = new Set(t.value.pages.map(($) => $.name));
124
+ if (!h.has(v)) return v;
125
+ let S = 1;
126
+ for (; h.has(`${v}_${S}`); ) S++;
127
+ return `${v}_${S}`;
128
+ }
129
+ function E(v, h) {
130
+ const S = t.value.pages[v];
131
+ if (!S) return h;
132
+ let $ = h, ae = 1;
133
+ for (; $ in S.fields; ) $ = `${h}_${ae++}`;
134
+ return $;
135
+ }
136
+ function L(v, h = l.value.pageIdx) {
137
+ const S = t.value.pages[h];
138
+ if (!S) return;
139
+ const ae = (Kt[v] ?? (() => ({ type: "String" })))(), K = E(h, v);
140
+ if (K.startsWith("_")) throw new Error(`Reserved name "${K}"`);
141
+ y(), S.fields = { ...S.fields, [K]: { ...ae, label: fn(K) } }, d(h, K), n({ type: "field-added", pageIdx: h, fieldName: K, kind: v });
142
+ }
143
+ function Y(v, h, S) {
144
+ const $ = t.value.pages[v];
145
+ if (!$) return;
146
+ const K = (Kt[S] ?? (() => ({ type: "String" })))(), fe = E(v, S);
147
+ if (fe.startsWith("_")) throw new Error(`Reserved name "${fe}"`);
148
+ y();
149
+ const Ae = Object.entries($.fields), dn = Ae.findIndex(([ol]) => ol === h), cn = [fe, { ...K, label: fn(fe) }];
150
+ dn === -1 ? Ae.push(cn) : Ae.splice(dn + 1, 0, cn), $.fields = Object.fromEntries(Ae), d(v, fe), n({ type: "field-added", pageIdx: v, fieldName: fe, kind: S });
151
+ }
152
+ function le(v, h) {
153
+ const S = t.value.pages[v];
154
+ if (!S || !(h in S.fields)) return;
155
+ y();
156
+ const $ = { ...S.fields };
157
+ delete $[h], S.fields = $, l.value.pageIdx === v && l.value.fieldName === h && (l.value = { kind: "page", pageIdx: v, fieldName: null }), n({ type: "field-removed", pageIdx: v, fieldName: h });
158
+ }
159
+ function H(v, h) {
160
+ const S = t.value.pages[v];
161
+ if (!S || !(h in S.fields)) return;
162
+ y();
163
+ const $ = nt(S.fields[h]), ae = E(v, `${h}_copy`), K = {};
164
+ for (const [fe, Ae] of Object.entries(S.fields))
165
+ K[fe] = Ae, fe === h && (K[ae] = $);
166
+ S.fields = K, d(v, ae), n({ type: "field-duplicated", pageIdx: v, sourceName: h, newName: ae });
167
+ }
168
+ function N(v, h, S) {
169
+ const $ = t.value.pages[v];
170
+ !$ || !(h in $.fields) || (y(), $.fields = {
171
+ ...$.fields,
172
+ [h]: { ...$.fields[h], ...S }
173
+ }, n({ type: "field-updated", pageIdx: v, fieldName: h, patch: S }));
174
+ }
175
+ function c(v, h, S) {
176
+ const $ = t.value.pages[v];
177
+ !$ || !(h in $.fields) || (y(), $.fields = { ...$.fields, [h]: { ...S } }, n({ type: "field-updated", pageIdx: v, fieldName: h, patch: S }));
178
+ }
179
+ function m(v, h, S) {
180
+ if (h === S) return;
181
+ const $ = t.value.pages[v];
182
+ if (!$ || !(h in $.fields)) return;
183
+ if (S in $.fields) throw new Error(`Field "${S}" already exists`);
184
+ if (S.startsWith("_")) throw new Error(`Reserved name "${S}"`);
185
+ y();
186
+ const ae = {};
187
+ for (const [K, fe] of Object.entries($.fields))
188
+ ae[K === h ? S : K] = fe;
189
+ $.fields = ae, l.value.pageIdx === v && l.value.fieldName === h && (l.value = { kind: "field", pageIdx: v, fieldName: S }), n({ type: "field-renamed", pageIdx: v, oldName: h, newName: S });
190
+ }
191
+ function ge(v, h, S) {
192
+ const $ = t.value.pages[v];
193
+ if (!$) return;
194
+ const ae = Object.keys($.fields);
195
+ if (h === S || h < 0 || h >= ae.length || S < 0 || S >= ae.length) return;
196
+ y();
197
+ const [K] = ae.splice(h, 1);
198
+ ae.splice(S, 0, K);
199
+ const fe = {};
200
+ for (const Ae of ae) fe[Ae] = $.fields[Ae];
201
+ $.fields = fe, n({ type: "field-reordered", pageIdx: v, order: ae });
202
+ }
203
+ function we(v, h) {
204
+ const S = t.value.pages[v];
205
+ if (!S) return;
206
+ const $ = Object.keys(S.fields);
207
+ if (h.length !== $.length) return;
208
+ for (const K of h)
209
+ if (!$.includes(K)) return;
210
+ if ($.every((K, fe) => K === h[fe])) return;
211
+ y();
212
+ const ae = {};
213
+ for (const K of h) ae[K] = S.fields[K];
214
+ S.fields = ae, n({ type: "field-reordered", pageIdx: v, order: h });
215
+ }
216
+ const Me = F(() => yl(t.value.theme));
217
+ function Rt(v) {
218
+ y(), t.value.theme = { ...t.value.theme, ...v }, n({ type: "theme-changed", theme: t.value.theme });
219
+ }
220
+ function vt(v, h) {
221
+ y();
222
+ const S = t.value.theme[v] ?? {};
223
+ t.value.theme = {
224
+ ...t.value.theme,
225
+ [v]: { ...S, ...h }
226
+ }, n({ type: "theme-changed", theme: t.value.theme });
227
+ }
228
+ function I() {
229
+ y(), t.value.theme = {}, n({ type: "theme-changed", theme: t.value.theme });
230
+ }
231
+ function f(v) {
232
+ if (y(), Qt(v)) {
233
+ const h = pn(v);
234
+ t.value = {
235
+ title: v.title || t.value.title,
236
+ description: v.description || "",
237
+ mode: h.mode || "form",
238
+ pages: h.pages.map((S) => ({
239
+ name: S.name,
240
+ title: S.title,
241
+ description: S.description,
242
+ visibleIf: S.visibleIf,
243
+ hideTitle: S.hideTitle,
244
+ hideDescription: S.hideDescription,
245
+ fields: S.fields
246
+ })),
247
+ theme: h.theme || {}
248
+ };
249
+ } else
250
+ t.value = {
251
+ ...Lt(),
252
+ pages: [{ name: "page1", title: "Page 1", description: "", fields: v }]
253
+ };
254
+ l.value = { kind: "page", pageIdx: 0, fieldName: null }, n({ type: "schema-replaced" });
255
+ }
256
+ const M = F(() => {
257
+ const v = Object.keys(t.value.theme).length > 0;
258
+ return t.value.pages.length === 1 && !v ? t.value.pages[0].fields : {
259
+ title: t.value.title,
260
+ ...t.value.description ? { description: t.value.description } : {},
261
+ mode: t.value.mode,
262
+ pages: t.value.pages.map((h) => ({
263
+ name: h.name,
264
+ title: h.title,
265
+ description: h.description,
266
+ visibleIf: h.visibleIf,
267
+ ...h.hideTitle ? { hideTitle: !0 } : {},
268
+ ...h.hideDescription ? { hideDescription: !0 } : {},
269
+ fields: h.fields
270
+ })),
271
+ ...v ? { theme: t.value.theme } : {}
272
+ };
273
+ });
274
+ if (e.initialSchema && Object.keys(e.initialSchema).length > 0)
275
+ if (Qt(e.initialSchema)) {
276
+ const v = pn(e.initialSchema);
277
+ t.value = {
278
+ title: e.initialSchema.title || "Untitled Form",
279
+ description: e.initialSchema.description || "",
280
+ mode: v.mode || "form",
281
+ pages: v.pages.map((h) => ({
282
+ name: h.name,
283
+ title: h.title,
284
+ description: h.description,
285
+ visibleIf: h.visibleIf,
286
+ hideTitle: h.hideTitle,
287
+ hideDescription: h.hideDescription,
288
+ fields: h.fields
289
+ })),
290
+ theme: v.theme || {}
291
+ };
292
+ } else
293
+ t.value = {
294
+ ...Lt(),
295
+ pages: [{ name: "page1", title: "Page 1", description: "", fields: e.initialSchema }]
296
+ };
297
+ return Nn({
298
+ data: t,
299
+ selection: l,
300
+ currentPage: a,
301
+ selectedField: g,
302
+ canUndo: r,
303
+ canRedo: s,
304
+ exported: M,
305
+ resolvedTheme: Me,
306
+ selectField: d,
307
+ selectPage: T,
308
+ selectForm: w,
309
+ undo: k,
310
+ redo: B,
311
+ setTitle: te,
312
+ setDescription: z,
313
+ setMode: X,
314
+ setTheme: Rt,
315
+ setThemeSection: vt,
316
+ resetTheme: I,
317
+ addPage: O,
318
+ removePage: se,
319
+ duplicatePage: J,
320
+ updatePage: ue,
321
+ addField: L,
322
+ insertFieldAfter: Y,
323
+ removeField: le,
324
+ duplicateField: H,
325
+ updateField: N,
326
+ replaceFieldDef: c,
327
+ renameField: m,
328
+ moveField: ge,
329
+ reorderFieldsByNames: we,
330
+ replaceAll: f
331
+ });
332
+ }
333
+ const Rn = /* @__PURE__ */ Symbol(
334
+ "CobaltFormBuilder.schemaStore"
335
+ );
336
+ function ze() {
337
+ const e = al(Rn);
338
+ if (!e)
339
+ throw new Error(
340
+ "[cobalt-form-builder] useSchemaStore() must be called inside a <CobaltFormBuilder>. Make sure the component lives in the builder subtree, or call createSchemaStore() and provide it yourself."
341
+ );
342
+ return e;
343
+ }
344
+ const Z = [
345
+ // Inputs
346
+ { id: "text", label: "Single-line input", group: "inputs", aliases: ["text", "string"], icon: "text-aa" },
347
+ { id: "textarea", label: "Multi-line text", group: "inputs", aliases: ["textarea", "comment"], icon: "text-align-left" },
348
+ { id: "number", label: "Number", group: "inputs", aliases: ["integer", "numeric"], icon: "hash" },
349
+ { id: "date", label: "Date", group: "inputs", aliases: ["calendar"], icon: "calendar" },
350
+ // Choices
351
+ { id: "boolean", label: "Yes / No", group: "choices", aliases: ["switch", "toggle"], icon: "toggle-left" },
352
+ { id: "select", label: "Dropdown", group: "choices", aliases: ["dropdown", "enum"], icon: "caret-circle-down" },
353
+ { id: "ref", label: "Reference", group: "choices", aliases: ["lookup", "model"], icon: "link" },
354
+ // Advanced
355
+ { id: "rating", label: "Rating scale", group: "advanced", aliases: ["stars", "score"], icon: "star" },
356
+ { id: "slider", label: "Slider", group: "advanced", aliases: ["range"], icon: "sliders-horizontal" },
357
+ { id: "color", label: "Color picker", group: "advanced", aliases: ["hex", "palette"], icon: "palette" },
358
+ { id: "file", label: "File upload", group: "advanced", aliases: ["attachment"], icon: "paperclip" },
359
+ // Layout
360
+ { id: "section", label: "Section divider", group: "layout", aliases: ["header", "group"], icon: "minus" }
361
+ ], xl = {
362
+ inputs: "Inputs",
363
+ choices: "Choices",
364
+ advanced: "Advanced",
365
+ layout: "Layout"
366
+ }, wl = { class: "toolbox" }, kl = { class: "toolbox__search" }, Tl = { class: "toolbox__scroll" }, Dl = {
367
+ key: 0,
368
+ class: "toolbox__empty"
369
+ }, El = { class: "toolbox__group-label" }, Il = { class: "toolbox__list" }, Ol = ["onDragstart"], Nl = /* @__PURE__ */ xe({
370
+ __name: "FieldToolbox",
371
+ setup(e) {
372
+ const n = ze(), t = de(""), l = F(() => {
373
+ const s = t.value.trim().toLowerCase(), a = s ? Z.filter((u) => u.label.toLowerCase().includes(s) || u.id.toLowerCase().includes(s) ? !0 : (u.aliases || []).some((d) => d.toLowerCase().includes(s))) : Z, g = {};
374
+ for (const u of a)
375
+ g[u.group] || (g[u.group] = {
376
+ id: u.group,
377
+ label: xl[u.group],
378
+ items: []
379
+ }), g[u.group].items.push(u);
380
+ return Object.values(g);
381
+ });
382
+ function o(s, a) {
383
+ s.dataTransfer && (s.dataTransfer.setData("application/cobalt-field-kind", a), s.dataTransfer.effectAllowed = "copy");
384
+ }
385
+ function i(s) {
386
+ n.addField(s);
387
+ }
388
+ function r(s) {
389
+ const a = s.detail;
390
+ return a != null && typeof a == "object" && "value" in a ? a.value : a;
391
+ }
392
+ return (s, a) => (C(), D("div", wl, [
393
+ p("button", {
394
+ class: Ee(["toolbox__form-btn", { "is-active": b(n).selection.kind === "form" }]),
395
+ onClick: a[0] || (a[0] = (g) => b(n).selectForm())
396
+ }, [...a[2] || (a[2] = [
397
+ il('<span class="toolbox__form-btn-icon" data-v-8ac1929e><co-icon name="paint-brush" size="16" data-v-8ac1929e></co-icon></span><span class="toolbox__form-btn-body" data-v-8ac1929e><span class="toolbox__form-btn-label" data-v-8ac1929e>Theme</span><span class="toolbox__form-btn-sub" data-v-8ac1929e>Global form settings</span></span><co-icon name="caret-right" size="14" data-v-8ac1929e></co-icon>', 3)
398
+ ])], 2),
399
+ p("div", kl, [
400
+ x(b(W), {
401
+ placeholder: "Type to search…",
402
+ "icon-left": "magnifying-glass",
403
+ value: t.value,
404
+ onCoInput: a[1] || (a[1] = (g) => t.value = r(g) ?? "")
405
+ }, null, 8, ["value"])
406
+ ]),
407
+ p("div", Tl, [
408
+ l.value.length === 0 ? (C(), D("div", Dl, ' No matches for "' + ce(t.value) + '" ', 1)) : U("", !0),
409
+ (C(!0), D(Q, null, De(l.value, (g) => (C(), D("div", {
410
+ key: g.id,
411
+ class: "toolbox__group"
412
+ }, [
413
+ p("div", El, ce(g.label), 1),
414
+ p("ul", Il, [
415
+ (C(!0), D(Q, null, De(g.items, (u) => (C(), D("li", {
416
+ key: u.id,
417
+ draggable: "true",
418
+ class: "toolbox__row",
419
+ onDragstart: (d) => o(d, u.id)
420
+ }, [
421
+ x(b(ml), {
422
+ label: u.label,
423
+ icon: u.icon,
424
+ dense: "",
425
+ onCoSelect: (d) => i(u.id)
426
+ }, null, 8, ["label", "icon", "onCoSelect"])
427
+ ], 40, Ol))), 128))
428
+ ])
429
+ ]))), 128))
430
+ ])
431
+ ]));
432
+ }
433
+ }), Ie = (e, n) => {
434
+ const t = e.__vccOpts || e;
435
+ for (const [l, o] of n)
436
+ t[l] = o;
437
+ return t;
438
+ }, Al = /* @__PURE__ */ Ie(Nl, [["__scopeId", "data-v-8ac1929e"]]), Pl = ["data-placeholder"], $l = /* @__PURE__ */ xe({
439
+ __name: "EditableText",
440
+ props: {
441
+ modelValue: {},
442
+ placeholder: {},
443
+ multiline: { type: Boolean }
444
+ },
445
+ emits: ["update:modelValue"],
446
+ setup(e, { emit: n }) {
447
+ const t = e, l = n, o = de(null), i = de(!1);
448
+ Ke(
449
+ () => t.modelValue,
450
+ (d) => {
451
+ i.value || o.value && o.value.innerText !== d && (o.value.innerText = d);
452
+ },
453
+ { immediate: !1 }
454
+ );
455
+ function r() {
456
+ }
457
+ function s() {
458
+ if (!o.value) return;
459
+ const d = o.value.innerText.replace(/\n+$/, "");
460
+ d !== t.modelValue && l("update:modelValue", d);
461
+ }
462
+ function a() {
463
+ i.value = !1, s();
464
+ }
465
+ function g() {
466
+ i.value = !0;
467
+ }
468
+ function u(d) {
469
+ !t.multiline && d.key === "Enter" ? (d.preventDefault(), d.target.blur()) : d.key === "Escape" && (o.value && (o.value.innerText = t.modelValue), d.target.blur());
470
+ }
471
+ return (d, T) => (C(), D("span", {
472
+ ref_key: "el",
473
+ ref: o,
474
+ class: Ee(["editable", { "is-empty": !e.modelValue }]),
475
+ "data-placeholder": e.placeholder,
476
+ contenteditable: "plaintext-only",
477
+ spellcheck: "false",
478
+ onInput: r,
479
+ onBlur: a,
480
+ onFocus: g,
481
+ onKeydown: u
482
+ }, ce(e.modelValue), 43, Pl));
483
+ }
484
+ }), et = /* @__PURE__ */ Ie($l, [["__scopeId", "data-v-85570517"]]);
485
+ var Fl = Object.defineProperty, Ot = Object.getOwnPropertySymbols, Bn = Object.prototype.hasOwnProperty, jn = Object.prototype.propertyIsEnumerable, vn = (e, n, t) => n in e ? Fl(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, Ge = (e, n) => {
486
+ for (var t in n || (n = {}))
487
+ Bn.call(n, t) && vn(e, t, n[t]);
488
+ if (Ot)
489
+ for (var t of Ot(n))
490
+ jn.call(n, t) && vn(e, t, n[t]);
491
+ return e;
492
+ }, zn = (e, n) => {
493
+ var t = {};
494
+ for (var l in e)
495
+ Bn.call(e, l) && n.indexOf(l) < 0 && (t[l] = e[l]);
496
+ if (e != null && Ot)
497
+ for (var l of Ot(e))
498
+ n.indexOf(l) < 0 && jn.call(e, l) && (t[l] = e[l]);
499
+ return t;
500
+ };
501
+ const Ln = "[vue-draggable-plus]: ";
502
+ function Ml(e) {
503
+ console.warn(Ln + e);
504
+ }
505
+ function Rl(e) {
506
+ console.error(Ln + e);
507
+ }
508
+ function mn(e, n, t) {
509
+ return t >= 0 && t < e.length && e.splice(t, 0, e.splice(n, 1)[0]), e;
510
+ }
511
+ function Bl(e) {
512
+ return e.replace(/-(\w)/g, (n, t) => t ? t.toUpperCase() : "");
513
+ }
514
+ function jl(e) {
515
+ return Object.keys(e).reduce((n, t) => (typeof e[t] < "u" && (n[Bl(t)] = e[t]), n), {});
516
+ }
517
+ function hn(e, n) {
518
+ return Array.isArray(e) && e.splice(n, 1), e;
519
+ }
520
+ function gn(e, n, t) {
521
+ return Array.isArray(e) && e.splice(n, 0, t), e;
522
+ }
523
+ function zl(e) {
524
+ return typeof e > "u";
525
+ }
526
+ function Ll(e) {
527
+ return typeof e == "string";
528
+ }
529
+ function bn(e, n, t) {
530
+ const l = e.children[t];
531
+ e.insertBefore(n, l);
532
+ }
533
+ function Vt(e) {
534
+ e.parentNode && e.parentNode.removeChild(e);
535
+ }
536
+ function Vl(e, n = document) {
537
+ var t;
538
+ let l = null;
539
+ return typeof n?.querySelector == "function" ? l = (t = n?.querySelector) == null ? void 0 : t.call(n, e) : l = document.querySelector(e), l || Ml(`Element not found: ${e}`), l;
540
+ }
541
+ function Yl(e, n, t = null) {
542
+ return function(...l) {
543
+ return e.apply(t, l), n.apply(t, l);
544
+ };
545
+ }
546
+ function Ul(e, n) {
547
+ const t = Ge({}, e);
548
+ return Object.keys(n).forEach((l) => {
549
+ t[l] ? t[l] = Yl(e[l], n[l]) : t[l] = n[l];
550
+ }), t;
551
+ }
552
+ function Xl(e) {
553
+ return e instanceof HTMLElement;
554
+ }
555
+ function yn(e, n) {
556
+ Object.keys(e).forEach((t) => {
557
+ n(t, e[t]);
558
+ });
559
+ }
560
+ function Hl(e) {
561
+ return e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97);
562
+ }
563
+ const ql = Object.assign;
564
+ function _n(e, n) {
565
+ var t = Object.keys(e);
566
+ if (Object.getOwnPropertySymbols) {
567
+ var l = Object.getOwnPropertySymbols(e);
568
+ n && (l = l.filter(function(o) {
569
+ return Object.getOwnPropertyDescriptor(e, o).enumerable;
570
+ })), t.push.apply(t, l);
571
+ }
572
+ return t;
573
+ }
574
+ function Ne(e) {
575
+ for (var n = 1; n < arguments.length; n++) {
576
+ var t = arguments[n] != null ? arguments[n] : {};
577
+ n % 2 ? _n(Object(t), !0).forEach(function(l) {
578
+ Jl(e, l, t[l]);
579
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : _n(Object(t)).forEach(function(l) {
580
+ Object.defineProperty(e, l, Object.getOwnPropertyDescriptor(t, l));
581
+ });
582
+ }
583
+ return e;
584
+ }
585
+ function xt(e) {
586
+ "@babel/helpers - typeof";
587
+ return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? xt = function(n) {
588
+ return typeof n;
589
+ } : xt = function(n) {
590
+ return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
591
+ }, xt(e);
592
+ }
593
+ function Jl(e, n, t) {
594
+ return n in e ? Object.defineProperty(e, n, {
595
+ value: t,
596
+ enumerable: !0,
597
+ configurable: !0,
598
+ writable: !0
599
+ }) : e[n] = t, e;
600
+ }
601
+ function $e() {
602
+ return $e = Object.assign || function(e) {
603
+ for (var n = 1; n < arguments.length; n++) {
604
+ var t = arguments[n];
605
+ for (var l in t)
606
+ Object.prototype.hasOwnProperty.call(t, l) && (e[l] = t[l]);
607
+ }
608
+ return e;
609
+ }, $e.apply(this, arguments);
610
+ }
611
+ function Wl(e, n) {
612
+ if (e == null)
613
+ return {};
614
+ var t = {}, l = Object.keys(e), o, i;
615
+ for (i = 0; i < l.length; i++)
616
+ o = l[i], !(n.indexOf(o) >= 0) && (t[o] = e[o]);
617
+ return t;
618
+ }
619
+ function Gl(e, n) {
620
+ if (e == null)
621
+ return {};
622
+ var t = Wl(e, n), l, o;
623
+ if (Object.getOwnPropertySymbols) {
624
+ var i = Object.getOwnPropertySymbols(e);
625
+ for (o = 0; o < i.length; o++)
626
+ l = i[o], !(n.indexOf(l) >= 0) && Object.prototype.propertyIsEnumerable.call(e, l) && (t[l] = e[l]);
627
+ }
628
+ return t;
629
+ }
630
+ var Zl = "1.15.2";
631
+ function Pe(e) {
632
+ if (typeof window < "u" && window.navigator)
633
+ return !!/* @__PURE__ */ navigator.userAgent.match(e);
634
+ }
635
+ var Fe = Pe(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), pt = Pe(/Edge/i), Cn = Pe(/firefox/i), rt = Pe(/safari/i) && !Pe(/chrome/i) && !Pe(/android/i), Vn = Pe(/iP(ad|od|hone)/i), Yn = Pe(/chrome/i) && Pe(/android/i), Un = {
636
+ capture: !1,
637
+ passive: !1
638
+ };
639
+ function q(e, n, t) {
640
+ e.addEventListener(n, t, !Fe && Un);
641
+ }
642
+ function V(e, n, t) {
643
+ e.removeEventListener(n, t, !Fe && Un);
644
+ }
645
+ function Nt(e, n) {
646
+ if (n) {
647
+ if (n[0] === ">" && (n = n.substring(1)), e)
648
+ try {
649
+ if (e.matches)
650
+ return e.matches(n);
651
+ if (e.msMatchesSelector)
652
+ return e.msMatchesSelector(n);
653
+ if (e.webkitMatchesSelector)
654
+ return e.webkitMatchesSelector(n);
655
+ } catch {
656
+ return !1;
657
+ }
658
+ return !1;
659
+ }
660
+ }
661
+ function Ql(e) {
662
+ return e.host && e !== document && e.host.nodeType ? e.host : e.parentNode;
663
+ }
664
+ function Te(e, n, t, l) {
665
+ if (e) {
666
+ t = t || document;
667
+ do {
668
+ if (n != null && (n[0] === ">" ? e.parentNode === t && Nt(e, n) : Nt(e, n)) || l && e === t)
669
+ return e;
670
+ if (e === t)
671
+ break;
672
+ } while (e = Ql(e));
673
+ }
674
+ return null;
675
+ }
676
+ var Sn = /\s+/g;
677
+ function be(e, n, t) {
678
+ if (e && n)
679
+ if (e.classList)
680
+ e.classList[t ? "add" : "remove"](n);
681
+ else {
682
+ var l = (" " + e.className + " ").replace(Sn, " ").replace(" " + n + " ", " ");
683
+ e.className = (l + (t ? " " + n : "")).replace(Sn, " ");
684
+ }
685
+ }
686
+ function A(e, n, t) {
687
+ var l = e && e.style;
688
+ if (l) {
689
+ if (t === void 0)
690
+ return document.defaultView && document.defaultView.getComputedStyle ? t = document.defaultView.getComputedStyle(e, "") : e.currentStyle && (t = e.currentStyle), n === void 0 ? t : t[n];
691
+ !(n in l) && n.indexOf("webkit") === -1 && (n = "-webkit-" + n), l[n] = t + (typeof t == "string" ? "" : "px");
692
+ }
693
+ }
694
+ function Qe(e, n) {
695
+ var t = "";
696
+ if (typeof e == "string")
697
+ t = e;
698
+ else
699
+ do {
700
+ var l = A(e, "transform");
701
+ l && l !== "none" && (t = l + " " + t);
702
+ } while (!n && (e = e.parentNode));
703
+ var o = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
704
+ return o && new o(t);
705
+ }
706
+ function Xn(e, n, t) {
707
+ if (e) {
708
+ var l = e.getElementsByTagName(n), o = 0, i = l.length;
709
+ if (t)
710
+ for (; o < i; o++)
711
+ t(l[o], o);
712
+ return l;
713
+ }
714
+ return [];
715
+ }
716
+ function Oe() {
717
+ var e = document.scrollingElement;
718
+ return e || document.documentElement;
719
+ }
720
+ function re(e, n, t, l, o) {
721
+ if (!(!e.getBoundingClientRect && e !== window)) {
722
+ var i, r, s, a, g, u, d;
723
+ if (e !== window && e.parentNode && e !== Oe() ? (i = e.getBoundingClientRect(), r = i.top, s = i.left, a = i.bottom, g = i.right, u = i.height, d = i.width) : (r = 0, s = 0, a = window.innerHeight, g = window.innerWidth, u = window.innerHeight, d = window.innerWidth), (n || t) && e !== window && (o = o || e.parentNode, !Fe))
724
+ do
725
+ if (o && o.getBoundingClientRect && (A(o, "transform") !== "none" || t && A(o, "position") !== "static")) {
726
+ var T = o.getBoundingClientRect();
727
+ r -= T.top + parseInt(A(o, "border-top-width")), s -= T.left + parseInt(A(o, "border-left-width")), a = r + i.height, g = s + i.width;
728
+ break;
729
+ }
730
+ while (o = o.parentNode);
731
+ if (l && e !== window) {
732
+ var w = Qe(o || e), y = w && w.a, k = w && w.d;
733
+ w && (r /= k, s /= y, d /= y, u /= k, a = r + u, g = s + d);
734
+ }
735
+ return {
736
+ top: r,
737
+ left: s,
738
+ bottom: a,
739
+ right: g,
740
+ width: d,
741
+ height: u
742
+ };
743
+ }
744
+ }
745
+ function xn(e, n, t) {
746
+ for (var l = je(e, !0), o = re(e)[n]; l; ) {
747
+ var i = re(l)[t], r = void 0;
748
+ if (r = o >= i, !r)
749
+ return l;
750
+ if (l === Oe())
751
+ break;
752
+ l = je(l, !1);
753
+ }
754
+ return !1;
755
+ }
756
+ function tt(e, n, t, l) {
757
+ for (var o = 0, i = 0, r = e.children; i < r.length; ) {
758
+ if (r[i].style.display !== "none" && r[i] !== P.ghost && (l || r[i] !== P.dragged) && Te(r[i], t.draggable, e, !1)) {
759
+ if (o === n)
760
+ return r[i];
761
+ o++;
762
+ }
763
+ i++;
764
+ }
765
+ return null;
766
+ }
767
+ function rn(e, n) {
768
+ for (var t = e.lastElementChild; t && (t === P.ghost || A(t, "display") === "none" || n && !Nt(t, n)); )
769
+ t = t.previousElementSibling;
770
+ return t || null;
771
+ }
772
+ function Ce(e, n) {
773
+ var t = 0;
774
+ if (!e || !e.parentNode)
775
+ return -1;
776
+ for (; e = e.previousElementSibling; )
777
+ e.nodeName.toUpperCase() !== "TEMPLATE" && e !== P.clone && (!n || Nt(e, n)) && t++;
778
+ return t;
779
+ }
780
+ function wn(e) {
781
+ var n = 0, t = 0, l = Oe();
782
+ if (e)
783
+ do {
784
+ var o = Qe(e), i = o.a, r = o.d;
785
+ n += e.scrollLeft * i, t += e.scrollTop * r;
786
+ } while (e !== l && (e = e.parentNode));
787
+ return [n, t];
788
+ }
789
+ function Kl(e, n) {
790
+ for (var t in e)
791
+ if (e.hasOwnProperty(t)) {
792
+ for (var l in n)
793
+ if (n.hasOwnProperty(l) && n[l] === e[t][l])
794
+ return Number(t);
795
+ }
796
+ return -1;
797
+ }
798
+ function je(e, n) {
799
+ if (!e || !e.getBoundingClientRect)
800
+ return Oe();
801
+ var t = e, l = !1;
802
+ do
803
+ if (t.clientWidth < t.scrollWidth || t.clientHeight < t.scrollHeight) {
804
+ var o = A(t);
805
+ if (t.clientWidth < t.scrollWidth && (o.overflowX == "auto" || o.overflowX == "scroll") || t.clientHeight < t.scrollHeight && (o.overflowY == "auto" || o.overflowY == "scroll")) {
806
+ if (!t.getBoundingClientRect || t === document.body)
807
+ return Oe();
808
+ if (l || n)
809
+ return t;
810
+ l = !0;
811
+ }
812
+ }
813
+ while (t = t.parentNode);
814
+ return Oe();
815
+ }
816
+ function eo(e, n) {
817
+ if (e && n)
818
+ for (var t in n)
819
+ n.hasOwnProperty(t) && (e[t] = n[t]);
820
+ return e;
821
+ }
822
+ function Yt(e, n) {
823
+ return Math.round(e.top) === Math.round(n.top) && Math.round(e.left) === Math.round(n.left) && Math.round(e.height) === Math.round(n.height) && Math.round(e.width) === Math.round(n.width);
824
+ }
825
+ var st;
826
+ function Hn(e, n) {
827
+ return function() {
828
+ if (!st) {
829
+ var t = arguments, l = this;
830
+ t.length === 1 ? e.call(l, t[0]) : e.apply(l, t), st = setTimeout(function() {
831
+ st = void 0;
832
+ }, n);
833
+ }
834
+ };
835
+ }
836
+ function to() {
837
+ clearTimeout(st), st = void 0;
838
+ }
839
+ function qn(e, n, t) {
840
+ e.scrollLeft += n, e.scrollTop += t;
841
+ }
842
+ function Jn(e) {
843
+ var n = window.Polymer, t = window.jQuery || window.Zepto;
844
+ return n && n.dom ? n.dom(e).cloneNode(!0) : t ? t(e).clone(!0)[0] : e.cloneNode(!0);
845
+ }
846
+ function Wn(e, n, t) {
847
+ var l = {};
848
+ return Array.from(e.children).forEach(function(o) {
849
+ var i, r, s, a;
850
+ if (!(!Te(o, n.draggable, e, !1) || o.animated || o === t)) {
851
+ var g = re(o);
852
+ l.left = Math.min((i = l.left) !== null && i !== void 0 ? i : 1 / 0, g.left), l.top = Math.min((r = l.top) !== null && r !== void 0 ? r : 1 / 0, g.top), l.right = Math.max((s = l.right) !== null && s !== void 0 ? s : -1 / 0, g.right), l.bottom = Math.max((a = l.bottom) !== null && a !== void 0 ? a : -1 / 0, g.bottom);
853
+ }
854
+ }), l.width = l.right - l.left, l.height = l.bottom - l.top, l.x = l.left, l.y = l.top, l;
855
+ }
856
+ var _e = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
857
+ function no() {
858
+ var e = [], n;
859
+ return {
860
+ captureAnimationState: function() {
861
+ if (e = [], !!this.options.animation) {
862
+ var t = [].slice.call(this.el.children);
863
+ t.forEach(function(l) {
864
+ if (!(A(l, "display") === "none" || l === P.ghost)) {
865
+ e.push({
866
+ target: l,
867
+ rect: re(l)
868
+ });
869
+ var o = Ne({}, e[e.length - 1].rect);
870
+ if (l.thisAnimationDuration) {
871
+ var i = Qe(l, !0);
872
+ i && (o.top -= i.f, o.left -= i.e);
873
+ }
874
+ l.fromRect = o;
875
+ }
876
+ });
877
+ }
878
+ },
879
+ addAnimationState: function(t) {
880
+ e.push(t);
881
+ },
882
+ removeAnimationState: function(t) {
883
+ e.splice(Kl(e, {
884
+ target: t
885
+ }), 1);
886
+ },
887
+ animateAll: function(t) {
888
+ var l = this;
889
+ if (!this.options.animation) {
890
+ clearTimeout(n), typeof t == "function" && t();
891
+ return;
892
+ }
893
+ var o = !1, i = 0;
894
+ e.forEach(function(r) {
895
+ var s = 0, a = r.target, g = a.fromRect, u = re(a), d = a.prevFromRect, T = a.prevToRect, w = r.rect, y = Qe(a, !0);
896
+ y && (u.top -= y.f, u.left -= y.e), a.toRect = u, a.thisAnimationDuration && Yt(d, u) && !Yt(g, u) && // Make sure animatingRect is on line between toRect & fromRect
897
+ (w.top - u.top) / (w.left - u.left) === (g.top - u.top) / (g.left - u.left) && (s = oo(w, d, T, l.options)), Yt(u, g) || (a.prevFromRect = g, a.prevToRect = u, s || (s = l.options.animation), l.animate(a, w, u, s)), s && (o = !0, i = Math.max(i, s), clearTimeout(a.animationResetTimer), a.animationResetTimer = setTimeout(function() {
898
+ a.animationTime = 0, a.prevFromRect = null, a.fromRect = null, a.prevToRect = null, a.thisAnimationDuration = null;
899
+ }, s), a.thisAnimationDuration = s);
900
+ }), clearTimeout(n), o ? n = setTimeout(function() {
901
+ typeof t == "function" && t();
902
+ }, i) : typeof t == "function" && t(), e = [];
903
+ },
904
+ animate: function(t, l, o, i) {
905
+ if (i) {
906
+ A(t, "transition", ""), A(t, "transform", "");
907
+ var r = Qe(this.el), s = r && r.a, a = r && r.d, g = (l.left - o.left) / (s || 1), u = (l.top - o.top) / (a || 1);
908
+ t.animatingX = !!g, t.animatingY = !!u, A(t, "transform", "translate3d(" + g + "px," + u + "px,0)"), this.forRepaintDummy = lo(t), A(t, "transition", "transform " + i + "ms" + (this.options.easing ? " " + this.options.easing : "")), A(t, "transform", "translate3d(0,0,0)"), typeof t.animated == "number" && clearTimeout(t.animated), t.animated = setTimeout(function() {
909
+ A(t, "transition", ""), A(t, "transform", ""), t.animated = !1, t.animatingX = !1, t.animatingY = !1;
910
+ }, i);
911
+ }
912
+ }
913
+ };
914
+ }
915
+ function lo(e) {
916
+ return e.offsetWidth;
917
+ }
918
+ function oo(e, n, t, l) {
919
+ return Math.sqrt(Math.pow(n.top - e.top, 2) + Math.pow(n.left - e.left, 2)) / Math.sqrt(Math.pow(n.top - t.top, 2) + Math.pow(n.left - t.left, 2)) * l.animation;
920
+ }
921
+ var qe = [], Ut = {
922
+ initializeByDefault: !0
923
+ }, ft = {
924
+ mount: function(e) {
925
+ for (var n in Ut)
926
+ Ut.hasOwnProperty(n) && !(n in e) && (e[n] = Ut[n]);
927
+ qe.forEach(function(t) {
928
+ if (t.pluginName === e.pluginName)
929
+ throw "Sortable: Cannot mount plugin ".concat(e.pluginName, " more than once");
930
+ }), qe.push(e);
931
+ },
932
+ pluginEvent: function(e, n, t) {
933
+ var l = this;
934
+ this.eventCanceled = !1, t.cancel = function() {
935
+ l.eventCanceled = !0;
936
+ };
937
+ var o = e + "Global";
938
+ qe.forEach(function(i) {
939
+ n[i.pluginName] && (n[i.pluginName][o] && n[i.pluginName][o](Ne({
940
+ sortable: n
941
+ }, t)), n.options[i.pluginName] && n[i.pluginName][e] && n[i.pluginName][e](Ne({
942
+ sortable: n
943
+ }, t)));
944
+ });
945
+ },
946
+ initializePlugins: function(e, n, t, l) {
947
+ qe.forEach(function(r) {
948
+ var s = r.pluginName;
949
+ if (!(!e.options[s] && !r.initializeByDefault)) {
950
+ var a = new r(e, n, e.options);
951
+ a.sortable = e, a.options = e.options, e[s] = a, $e(t, a.defaults);
952
+ }
953
+ });
954
+ for (var o in e.options)
955
+ if (e.options.hasOwnProperty(o)) {
956
+ var i = this.modifyOption(e, o, e.options[o]);
957
+ typeof i < "u" && (e.options[o] = i);
958
+ }
959
+ },
960
+ getEventProperties: function(e, n) {
961
+ var t = {};
962
+ return qe.forEach(function(l) {
963
+ typeof l.eventProperties == "function" && $e(t, l.eventProperties.call(n[l.pluginName], e));
964
+ }), t;
965
+ },
966
+ modifyOption: function(e, n, t) {
967
+ var l;
968
+ return qe.forEach(function(o) {
969
+ e[o.pluginName] && o.optionListeners && typeof o.optionListeners[n] == "function" && (l = o.optionListeners[n].call(e[o.pluginName], t));
970
+ }), l;
971
+ }
972
+ };
973
+ function ao(e) {
974
+ var n = e.sortable, t = e.rootEl, l = e.name, o = e.targetEl, i = e.cloneEl, r = e.toEl, s = e.fromEl, a = e.oldIndex, g = e.newIndex, u = e.oldDraggableIndex, d = e.newDraggableIndex, T = e.originalEvent, w = e.putSortable, y = e.extraEventProperties;
975
+ if (n = n || t && t[_e], !!n) {
976
+ var k, B = n.options, j = "on" + l.charAt(0).toUpperCase() + l.substr(1);
977
+ window.CustomEvent && !Fe && !pt ? k = new CustomEvent(l, {
978
+ bubbles: !0,
979
+ cancelable: !0
980
+ }) : (k = document.createEvent("Event"), k.initEvent(l, !0, !0)), k.to = r || t, k.from = s || t, k.item = o || t, k.clone = i, k.oldIndex = a, k.newIndex = g, k.oldDraggableIndex = u, k.newDraggableIndex = d, k.originalEvent = T, k.pullMode = w ? w.lastPutMode : void 0;
981
+ var te = Ne(Ne({}, y), ft.getEventProperties(l, n));
982
+ for (var z in te)
983
+ k[z] = te[z];
984
+ t && t.dispatchEvent(k), B[j] && B[j].call(n, k);
985
+ }
986
+ }
987
+ var io = ["evt"], he = function(e, n) {
988
+ var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, l = t.evt, o = Gl(t, io);
989
+ ft.pluginEvent.bind(P)(e, n, Ne({
990
+ dragEl: _,
991
+ parentEl: oe,
992
+ ghostEl: R,
993
+ rootEl: ee,
994
+ nextEl: Xe,
995
+ lastDownEl: wt,
996
+ cloneEl: ne,
997
+ cloneHidden: Be,
998
+ dragStarted: lt,
999
+ putSortable: pe,
1000
+ activeSortable: P.active,
1001
+ originalEvent: l,
1002
+ oldIndex: Ze,
1003
+ oldDraggableIndex: ut,
1004
+ newIndex: ye,
1005
+ newDraggableIndex: Re,
1006
+ hideGhostForTarget: Kn,
1007
+ unhideGhostForTarget: el,
1008
+ cloneNowHidden: function() {
1009
+ Be = !0;
1010
+ },
1011
+ cloneNowShown: function() {
1012
+ Be = !1;
1013
+ },
1014
+ dispatchSortableEvent: function(i) {
1015
+ me({
1016
+ sortable: n,
1017
+ name: i,
1018
+ originalEvent: l
1019
+ });
1020
+ }
1021
+ }, o));
1022
+ };
1023
+ function me(e) {
1024
+ ao(Ne({
1025
+ putSortable: pe,
1026
+ cloneEl: ne,
1027
+ targetEl: _,
1028
+ rootEl: ee,
1029
+ oldIndex: Ze,
1030
+ oldDraggableIndex: ut,
1031
+ newIndex: ye,
1032
+ newDraggableIndex: Re
1033
+ }, e));
1034
+ }
1035
+ var _, oe, R, ee, Xe, wt, ne, Be, Ze, ye, ut, Re, bt, pe, We = !1, At = !1, Pt = [], Le, ke, Xt, Ht, kn, Tn, lt, Je, dt, ct = !1, yt = !1, kt, ve, qt = [], en = !1, $t = [], Mt = typeof document < "u", _t = Vn, Dn = pt || Fe ? "cssFloat" : "float", ro = Mt && !Yn && !Vn && "draggable" in document.createElement("div"), Gn = (function() {
1036
+ if (Mt) {
1037
+ if (Fe)
1038
+ return !1;
1039
+ var e = document.createElement("x");
1040
+ return e.style.cssText = "pointer-events:auto", e.style.pointerEvents === "auto";
1041
+ }
1042
+ })(), Zn = function(e, n) {
1043
+ var t = A(e), l = parseInt(t.width) - parseInt(t.paddingLeft) - parseInt(t.paddingRight) - parseInt(t.borderLeftWidth) - parseInt(t.borderRightWidth), o = tt(e, 0, n), i = tt(e, 1, n), r = o && A(o), s = i && A(i), a = r && parseInt(r.marginLeft) + parseInt(r.marginRight) + re(o).width, g = s && parseInt(s.marginLeft) + parseInt(s.marginRight) + re(i).width;
1044
+ if (t.display === "flex")
1045
+ return t.flexDirection === "column" || t.flexDirection === "column-reverse" ? "vertical" : "horizontal";
1046
+ if (t.display === "grid")
1047
+ return t.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
1048
+ if (o && r.float && r.float !== "none") {
1049
+ var u = r.float === "left" ? "left" : "right";
1050
+ return i && (s.clear === "both" || s.clear === u) ? "vertical" : "horizontal";
1051
+ }
1052
+ return o && (r.display === "block" || r.display === "flex" || r.display === "table" || r.display === "grid" || a >= l && t[Dn] === "none" || i && t[Dn] === "none" && a + g > l) ? "vertical" : "horizontal";
1053
+ }, so = function(e, n, t) {
1054
+ var l = t ? e.left : e.top, o = t ? e.right : e.bottom, i = t ? e.width : e.height, r = t ? n.left : n.top, s = t ? n.right : n.bottom, a = t ? n.width : n.height;
1055
+ return l === r || o === s || l + i / 2 === r + a / 2;
1056
+ }, uo = function(e, n) {
1057
+ var t;
1058
+ return Pt.some(function(l) {
1059
+ var o = l[_e].options.emptyInsertThreshold;
1060
+ if (!(!o || rn(l))) {
1061
+ var i = re(l), r = e >= i.left - o && e <= i.right + o, s = n >= i.top - o && n <= i.bottom + o;
1062
+ if (r && s)
1063
+ return t = l;
1064
+ }
1065
+ }), t;
1066
+ }, Qn = function(e) {
1067
+ function n(o, i) {
1068
+ return function(r, s, a, g) {
1069
+ var u = r.options.group.name && s.options.group.name && r.options.group.name === s.options.group.name;
1070
+ if (o == null && (i || u))
1071
+ return !0;
1072
+ if (o == null || o === !1)
1073
+ return !1;
1074
+ if (i && o === "clone")
1075
+ return o;
1076
+ if (typeof o == "function")
1077
+ return n(o(r, s, a, g), i)(r, s, a, g);
1078
+ var d = (i ? r : s).options.group.name;
1079
+ return o === !0 || typeof o == "string" && o === d || o.join && o.indexOf(d) > -1;
1080
+ };
1081
+ }
1082
+ var t = {}, l = e.group;
1083
+ (!l || xt(l) != "object") && (l = {
1084
+ name: l
1085
+ }), t.name = l.name, t.checkPull = n(l.pull, !0), t.checkPut = n(l.put), t.revertClone = l.revertClone, e.group = t;
1086
+ }, Kn = function() {
1087
+ !Gn && R && A(R, "display", "none");
1088
+ }, el = function() {
1089
+ !Gn && R && A(R, "display", "");
1090
+ };
1091
+ Mt && !Yn && document.addEventListener("click", function(e) {
1092
+ if (At)
1093
+ return e.preventDefault(), e.stopPropagation && e.stopPropagation(), e.stopImmediatePropagation && e.stopImmediatePropagation(), At = !1, !1;
1094
+ }, !0);
1095
+ var Ve = function(e) {
1096
+ if (_) {
1097
+ e = e.touches ? e.touches[0] : e;
1098
+ var n = uo(e.clientX, e.clientY);
1099
+ if (n) {
1100
+ var t = {};
1101
+ for (var l in e)
1102
+ e.hasOwnProperty(l) && (t[l] = e[l]);
1103
+ t.target = t.rootEl = n, t.preventDefault = void 0, t.stopPropagation = void 0, n[_e]._onDragOver(t);
1104
+ }
1105
+ }
1106
+ }, co = function(e) {
1107
+ _ && _.parentNode[_e]._isOutsideThisEl(e.target);
1108
+ };
1109
+ function P(e, n) {
1110
+ if (!(e && e.nodeType && e.nodeType === 1))
1111
+ throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));
1112
+ this.el = e, this.options = n = $e({}, n), e[_e] = this;
1113
+ var t = {
1114
+ group: null,
1115
+ sort: !0,
1116
+ disabled: !1,
1117
+ store: null,
1118
+ handle: null,
1119
+ draggable: /^[uo]l$/i.test(e.nodeName) ? ">li" : ">*",
1120
+ swapThreshold: 1,
1121
+ // percentage; 0 <= x <= 1
1122
+ invertSwap: !1,
1123
+ // invert always
1124
+ invertedSwapThreshold: null,
1125
+ // will be set to same as swapThreshold if default
1126
+ removeCloneOnHide: !0,
1127
+ direction: function() {
1128
+ return Zn(e, this.options);
1129
+ },
1130
+ ghostClass: "sortable-ghost",
1131
+ chosenClass: "sortable-chosen",
1132
+ dragClass: "sortable-drag",
1133
+ ignore: "a, img",
1134
+ filter: null,
1135
+ preventOnFilter: !0,
1136
+ animation: 0,
1137
+ easing: null,
1138
+ setData: function(i, r) {
1139
+ i.setData("Text", r.textContent);
1140
+ },
1141
+ dropBubble: !1,
1142
+ dragoverBubble: !1,
1143
+ dataIdAttr: "data-id",
1144
+ delay: 0,
1145
+ delayOnTouchOnly: !1,
1146
+ touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
1147
+ forceFallback: !1,
1148
+ fallbackClass: "sortable-fallback",
1149
+ fallbackOnBody: !1,
1150
+ fallbackTolerance: 0,
1151
+ fallbackOffset: {
1152
+ x: 0,
1153
+ y: 0
1154
+ },
1155
+ supportPointer: P.supportPointer !== !1 && "PointerEvent" in window && !rt,
1156
+ emptyInsertThreshold: 5
1157
+ };
1158
+ ft.initializePlugins(this, e, t);
1159
+ for (var l in t)
1160
+ !(l in n) && (n[l] = t[l]);
1161
+ Qn(n);
1162
+ for (var o in this)
1163
+ o.charAt(0) === "_" && typeof this[o] == "function" && (this[o] = this[o].bind(this));
1164
+ this.nativeDraggable = n.forceFallback ? !1 : ro, this.nativeDraggable && (this.options.touchStartThreshold = 1), n.supportPointer ? q(e, "pointerdown", this._onTapStart) : (q(e, "mousedown", this._onTapStart), q(e, "touchstart", this._onTapStart)), this.nativeDraggable && (q(e, "dragover", this), q(e, "dragenter", this)), Pt.push(this.el), n.store && n.store.get && this.sort(n.store.get(this) || []), $e(this, no());
1165
+ }
1166
+ P.prototype = /** @lends Sortable.prototype */
1167
+ {
1168
+ constructor: P,
1169
+ _isOutsideThisEl: function(e) {
1170
+ !this.el.contains(e) && e !== this.el && (Je = null);
1171
+ },
1172
+ _getDirection: function(e, n) {
1173
+ return typeof this.options.direction == "function" ? this.options.direction.call(this, e, n, _) : this.options.direction;
1174
+ },
1175
+ _onTapStart: function(e) {
1176
+ if (e.cancelable) {
1177
+ var n = this, t = this.el, l = this.options, o = l.preventOnFilter, i = e.type, r = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, s = (r || e).target, a = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || s, g = l.filter;
1178
+ if (yo(t), !_ && !(/mousedown|pointerdown/.test(i) && e.button !== 0 || l.disabled) && !a.isContentEditable && !(!this.nativeDraggable && rt && s && s.tagName.toUpperCase() === "SELECT") && (s = Te(s, l.draggable, t, !1), !(s && s.animated) && wt !== s)) {
1179
+ if (Ze = Ce(s), ut = Ce(s, l.draggable), typeof g == "function") {
1180
+ if (g.call(this, e, s, this)) {
1181
+ me({
1182
+ sortable: n,
1183
+ rootEl: a,
1184
+ name: "filter",
1185
+ targetEl: s,
1186
+ toEl: t,
1187
+ fromEl: t
1188
+ }), he("filter", n, {
1189
+ evt: e
1190
+ }), o && e.cancelable && e.preventDefault();
1191
+ return;
1192
+ }
1193
+ } else if (g && (g = g.split(",").some(function(u) {
1194
+ if (u = Te(a, u.trim(), t, !1), u)
1195
+ return me({
1196
+ sortable: n,
1197
+ rootEl: u,
1198
+ name: "filter",
1199
+ targetEl: s,
1200
+ fromEl: t,
1201
+ toEl: t
1202
+ }), he("filter", n, {
1203
+ evt: e
1204
+ }), !0;
1205
+ }), g)) {
1206
+ o && e.cancelable && e.preventDefault();
1207
+ return;
1208
+ }
1209
+ l.handle && !Te(a, l.handle, t, !1) || this._prepareDragStart(e, r, s);
1210
+ }
1211
+ }
1212
+ },
1213
+ _prepareDragStart: function(e, n, t) {
1214
+ var l = this, o = l.el, i = l.options, r = o.ownerDocument, s;
1215
+ if (t && !_ && t.parentNode === o) {
1216
+ var a = re(t);
1217
+ if (ee = o, _ = t, oe = _.parentNode, Xe = _.nextSibling, wt = t, bt = i.group, P.dragged = _, Le = {
1218
+ target: _,
1219
+ clientX: (n || e).clientX,
1220
+ clientY: (n || e).clientY
1221
+ }, kn = Le.clientX - a.left, Tn = Le.clientY - a.top, this._lastX = (n || e).clientX, this._lastY = (n || e).clientY, _.style["will-change"] = "all", s = function() {
1222
+ if (he("delayEnded", l, {
1223
+ evt: e
1224
+ }), P.eventCanceled) {
1225
+ l._onDrop();
1226
+ return;
1227
+ }
1228
+ l._disableDelayedDragEvents(), !Cn && l.nativeDraggable && (_.draggable = !0), l._triggerDragStart(e, n), me({
1229
+ sortable: l,
1230
+ name: "choose",
1231
+ originalEvent: e
1232
+ }), be(_, i.chosenClass, !0);
1233
+ }, i.ignore.split(",").forEach(function(g) {
1234
+ Xn(_, g.trim(), Jt);
1235
+ }), q(r, "dragover", Ve), q(r, "mousemove", Ve), q(r, "touchmove", Ve), q(r, "mouseup", l._onDrop), q(r, "touchend", l._onDrop), q(r, "touchcancel", l._onDrop), Cn && this.nativeDraggable && (this.options.touchStartThreshold = 4, _.draggable = !0), he("delayStart", this, {
1236
+ evt: e
1237
+ }), i.delay && (!i.delayOnTouchOnly || n) && (!this.nativeDraggable || !(pt || Fe))) {
1238
+ if (P.eventCanceled) {
1239
+ this._onDrop();
1240
+ return;
1241
+ }
1242
+ q(r, "mouseup", l._disableDelayedDrag), q(r, "touchend", l._disableDelayedDrag), q(r, "touchcancel", l._disableDelayedDrag), q(r, "mousemove", l._delayedDragTouchMoveHandler), q(r, "touchmove", l._delayedDragTouchMoveHandler), i.supportPointer && q(r, "pointermove", l._delayedDragTouchMoveHandler), l._dragStartTimer = setTimeout(s, i.delay);
1243
+ } else
1244
+ s();
1245
+ }
1246
+ },
1247
+ _delayedDragTouchMoveHandler: function(e) {
1248
+ var n = e.touches ? e.touches[0] : e;
1249
+ 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();
1250
+ },
1251
+ _disableDelayedDrag: function() {
1252
+ _ && Jt(_), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
1253
+ },
1254
+ _disableDelayedDragEvents: function() {
1255
+ var e = this.el.ownerDocument;
1256
+ V(e, "mouseup", this._disableDelayedDrag), V(e, "touchend", this._disableDelayedDrag), V(e, "touchcancel", this._disableDelayedDrag), V(e, "mousemove", this._delayedDragTouchMoveHandler), V(e, "touchmove", this._delayedDragTouchMoveHandler), V(e, "pointermove", this._delayedDragTouchMoveHandler);
1257
+ },
1258
+ _triggerDragStart: function(e, n) {
1259
+ n = n || e.pointerType == "touch" && e, !this.nativeDraggable || n ? this.options.supportPointer ? q(document, "pointermove", this._onTouchMove) : n ? q(document, "touchmove", this._onTouchMove) : q(document, "mousemove", this._onTouchMove) : (q(_, "dragend", this), q(ee, "dragstart", this._onDragStart));
1260
+ try {
1261
+ document.selection ? Tt(function() {
1262
+ document.selection.empty();
1263
+ }) : window.getSelection().removeAllRanges();
1264
+ } catch {
1265
+ }
1266
+ },
1267
+ _dragStarted: function(e, n) {
1268
+ if (We = !1, ee && _) {
1269
+ he("dragStarted", this, {
1270
+ evt: n
1271
+ }), this.nativeDraggable && q(document, "dragover", co);
1272
+ var t = this.options;
1273
+ !e && be(_, t.dragClass, !1), be(_, t.ghostClass, !0), P.active = this, e && this._appendGhost(), me({
1274
+ sortable: this,
1275
+ name: "start",
1276
+ originalEvent: n
1277
+ });
1278
+ } else
1279
+ this._nulling();
1280
+ },
1281
+ _emulateDragOver: function() {
1282
+ if (ke) {
1283
+ this._lastX = ke.clientX, this._lastY = ke.clientY, Kn();
1284
+ for (var e = document.elementFromPoint(ke.clientX, ke.clientY), n = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(ke.clientX, ke.clientY), e !== n); )
1285
+ n = e;
1286
+ if (_.parentNode[_e]._isOutsideThisEl(e), n)
1287
+ do {
1288
+ if (n[_e]) {
1289
+ var t = void 0;
1290
+ if (t = n[_e]._onDragOver({
1291
+ clientX: ke.clientX,
1292
+ clientY: ke.clientY,
1293
+ target: e,
1294
+ rootEl: n
1295
+ }), t && !this.options.dragoverBubble)
1296
+ break;
1297
+ }
1298
+ e = n;
1299
+ } while (n = n.parentNode);
1300
+ el();
1301
+ }
1302
+ },
1303
+ _onTouchMove: function(e) {
1304
+ if (Le) {
1305
+ var n = this.options, t = n.fallbackTolerance, l = n.fallbackOffset, o = e.touches ? e.touches[0] : e, i = R && Qe(R, !0), r = R && i && i.a, s = R && i && i.d, a = _t && ve && wn(ve), g = (o.clientX - Le.clientX + l.x) / (r || 1) + (a ? a[0] - qt[0] : 0) / (r || 1), u = (o.clientY - Le.clientY + l.y) / (s || 1) + (a ? a[1] - qt[1] : 0) / (s || 1);
1306
+ if (!P.active && !We) {
1307
+ if (t && Math.max(Math.abs(o.clientX - this._lastX), Math.abs(o.clientY - this._lastY)) < t)
1308
+ return;
1309
+ this._onDragStart(e, !0);
1310
+ }
1311
+ if (R) {
1312
+ i ? (i.e += g - (Xt || 0), i.f += u - (Ht || 0)) : i = {
1313
+ a: 1,
1314
+ b: 0,
1315
+ c: 0,
1316
+ d: 1,
1317
+ e: g,
1318
+ f: u
1319
+ };
1320
+ var d = "matrix(".concat(i.a, ",").concat(i.b, ",").concat(i.c, ",").concat(i.d, ",").concat(i.e, ",").concat(i.f, ")");
1321
+ A(R, "webkitTransform", d), A(R, "mozTransform", d), A(R, "msTransform", d), A(R, "transform", d), Xt = g, Ht = u, ke = o;
1322
+ }
1323
+ e.cancelable && e.preventDefault();
1324
+ }
1325
+ },
1326
+ _appendGhost: function() {
1327
+ if (!R) {
1328
+ var e = this.options.fallbackOnBody ? document.body : ee, n = re(_, !0, _t, !0, e), t = this.options;
1329
+ if (_t) {
1330
+ for (ve = e; A(ve, "position") === "static" && A(ve, "transform") === "none" && ve !== document; )
1331
+ ve = ve.parentNode;
1332
+ ve !== document.body && ve !== document.documentElement ? (ve === document && (ve = Oe()), n.top += ve.scrollTop, n.left += ve.scrollLeft) : ve = Oe(), qt = wn(ve);
1333
+ }
1334
+ R = _.cloneNode(!0), be(R, t.ghostClass, !1), be(R, t.fallbackClass, !0), be(R, t.dragClass, !0), A(R, "transition", ""), A(R, "transform", ""), A(R, "box-sizing", "border-box"), A(R, "margin", 0), A(R, "top", n.top), A(R, "left", n.left), A(R, "width", n.width), A(R, "height", n.height), A(R, "opacity", "0.8"), A(R, "position", _t ? "absolute" : "fixed"), A(R, "zIndex", "100000"), A(R, "pointerEvents", "none"), P.ghost = R, e.appendChild(R), A(R, "transform-origin", kn / parseInt(R.style.width) * 100 + "% " + Tn / parseInt(R.style.height) * 100 + "%");
1335
+ }
1336
+ },
1337
+ _onDragStart: function(e, n) {
1338
+ var t = this, l = e.dataTransfer, o = t.options;
1339
+ if (he("dragStart", this, {
1340
+ evt: e
1341
+ }), P.eventCanceled) {
1342
+ this._onDrop();
1343
+ return;
1344
+ }
1345
+ he("setupClone", this), P.eventCanceled || (ne = Jn(_), ne.removeAttribute("id"), ne.draggable = !1, ne.style["will-change"] = "", this._hideClone(), be(ne, this.options.chosenClass, !1), P.clone = ne), t.cloneId = Tt(function() {
1346
+ he("clone", t), !P.eventCanceled && (t.options.removeCloneOnHide || ee.insertBefore(ne, _), t._hideClone(), me({
1347
+ sortable: t,
1348
+ name: "clone"
1349
+ }));
1350
+ }), !n && be(_, o.dragClass, !0), n ? (At = !0, t._loopId = setInterval(t._emulateDragOver, 50)) : (V(document, "mouseup", t._onDrop), V(document, "touchend", t._onDrop), V(document, "touchcancel", t._onDrop), l && (l.effectAllowed = "move", o.setData && o.setData.call(t, l, _)), q(document, "drop", t), A(_, "transform", "translateZ(0)")), We = !0, t._dragStartId = Tt(t._dragStarted.bind(t, n, e)), q(document, "selectstart", t), lt = !0, rt && A(document.body, "user-select", "none");
1351
+ },
1352
+ // Returns true - if no further action is needed (either inserted or another condition)
1353
+ _onDragOver: function(e) {
1354
+ var n = this.el, t = e.target, l, o, i, r = this.options, s = r.group, a = P.active, g = bt === s, u = r.sort, d = pe || a, T, w = this, y = !1;
1355
+ if (en)
1356
+ return;
1357
+ function k(m, ge) {
1358
+ he(m, w, Ne({
1359
+ evt: e,
1360
+ isOwner: g,
1361
+ axis: T ? "vertical" : "horizontal",
1362
+ revert: i,
1363
+ dragRect: l,
1364
+ targetRect: o,
1365
+ canSort: u,
1366
+ fromSortable: d,
1367
+ target: t,
1368
+ completed: j,
1369
+ onMove: function(we, Me) {
1370
+ return Ct(ee, n, _, l, we, re(we), e, Me);
1371
+ },
1372
+ changed: te
1373
+ }, ge));
1374
+ }
1375
+ function B() {
1376
+ k("dragOverAnimationCapture"), w.captureAnimationState(), w !== d && d.captureAnimationState();
1377
+ }
1378
+ function j(m) {
1379
+ return k("dragOverCompleted", {
1380
+ insertion: m
1381
+ }), m && (g ? a._hideClone() : a._showClone(w), w !== d && (be(_, pe ? pe.options.ghostClass : a.options.ghostClass, !1), be(_, r.ghostClass, !0)), pe !== w && w !== P.active ? pe = w : w === P.active && pe && (pe = null), d === w && (w._ignoreWhileAnimating = t), w.animateAll(function() {
1382
+ k("dragOverAnimationComplete"), w._ignoreWhileAnimating = null;
1383
+ }), w !== d && (d.animateAll(), d._ignoreWhileAnimating = null)), (t === _ && !_.animated || t === n && !t.animated) && (Je = null), !r.dragoverBubble && !e.rootEl && t !== document && (_.parentNode[_e]._isOutsideThisEl(e.target), !m && Ve(e)), !r.dragoverBubble && e.stopPropagation && e.stopPropagation(), y = !0;
1384
+ }
1385
+ function te() {
1386
+ ye = Ce(_), Re = Ce(_, r.draggable), me({
1387
+ sortable: w,
1388
+ name: "change",
1389
+ toEl: n,
1390
+ newIndex: ye,
1391
+ newDraggableIndex: Re,
1392
+ originalEvent: e
1393
+ });
1394
+ }
1395
+ if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), t = Te(t, r.draggable, n, !0), k("dragOver"), P.eventCanceled)
1396
+ return y;
1397
+ if (_.contains(e.target) || t.animated && t.animatingX && t.animatingY || w._ignoreWhileAnimating === t)
1398
+ return j(!1);
1399
+ if (At = !1, a && !r.disabled && (g ? u || (i = oe !== ee) : pe === this || (this.lastPutMode = bt.checkPull(this, a, _, e)) && s.checkPut(this, a, _, e))) {
1400
+ if (T = this._getDirection(e, t) === "vertical", l = re(_), k("dragOverValid"), P.eventCanceled)
1401
+ return y;
1402
+ if (i)
1403
+ return oe = ee, B(), this._hideClone(), k("revert"), P.eventCanceled || (Xe ? ee.insertBefore(_, Xe) : ee.appendChild(_)), j(!0);
1404
+ var z = rn(n, r.draggable);
1405
+ if (!z || mo(e, T, this) && !z.animated) {
1406
+ if (z === _)
1407
+ return j(!1);
1408
+ if (z && n === e.target && (t = z), t && (o = re(t)), Ct(ee, n, _, l, t, o, e, !!t) !== !1)
1409
+ return B(), z && z.nextSibling ? n.insertBefore(_, z.nextSibling) : n.appendChild(_), oe = n, te(), j(!0);
1410
+ } else if (z && vo(e, T, this)) {
1411
+ var X = tt(n, 0, r, !0);
1412
+ if (X === _)
1413
+ return j(!1);
1414
+ if (t = X, o = re(t), Ct(ee, n, _, l, t, o, e, !1) !== !1)
1415
+ return B(), n.insertBefore(_, X), oe = n, te(), j(!0);
1416
+ } else if (t.parentNode === n) {
1417
+ o = re(t);
1418
+ var O = 0, se, J = _.parentNode !== n, ue = !so(_.animated && _.toRect || l, t.animated && t.toRect || o, T), G = T ? "top" : "left", E = xn(t, "top", "top") || xn(_, "top", "top"), L = E ? E.scrollTop : void 0;
1419
+ Je !== t && (se = o[G], ct = !1, yt = !ue && r.invertSwap || J), O = ho(e, t, o, T, ue ? 1 : r.swapThreshold, r.invertedSwapThreshold == null ? r.swapThreshold : r.invertedSwapThreshold, yt, Je === t);
1420
+ var Y;
1421
+ if (O !== 0) {
1422
+ var le = Ce(_);
1423
+ do
1424
+ le -= O, Y = oe.children[le];
1425
+ while (Y && (A(Y, "display") === "none" || Y === R));
1426
+ }
1427
+ if (O === 0 || Y === t)
1428
+ return j(!1);
1429
+ Je = t, dt = O;
1430
+ var H = t.nextElementSibling, N = !1;
1431
+ N = O === 1;
1432
+ var c = Ct(ee, n, _, l, t, o, e, N);
1433
+ if (c !== !1)
1434
+ return (c === 1 || c === -1) && (N = c === 1), en = !0, setTimeout(fo, 30), B(), N && !H ? n.appendChild(_) : t.parentNode.insertBefore(_, N ? H : t), E && qn(E, 0, L - E.scrollTop), oe = _.parentNode, se !== void 0 && !yt && (kt = Math.abs(se - re(t)[G])), te(), j(!0);
1435
+ }
1436
+ if (n.contains(_))
1437
+ return j(!1);
1438
+ }
1439
+ return !1;
1440
+ },
1441
+ _ignoreWhileAnimating: null,
1442
+ _offMoveEvents: function() {
1443
+ V(document, "mousemove", this._onTouchMove), V(document, "touchmove", this._onTouchMove), V(document, "pointermove", this._onTouchMove), V(document, "dragover", Ve), V(document, "mousemove", Ve), V(document, "touchmove", Ve);
1444
+ },
1445
+ _offUpEvents: function() {
1446
+ var e = this.el.ownerDocument;
1447
+ V(e, "mouseup", this._onDrop), V(e, "touchend", this._onDrop), V(e, "pointerup", this._onDrop), V(e, "touchcancel", this._onDrop), V(document, "selectstart", this);
1448
+ },
1449
+ _onDrop: function(e) {
1450
+ var n = this.el, t = this.options;
1451
+ if (ye = Ce(_), Re = Ce(_, t.draggable), he("drop", this, {
1452
+ evt: e
1453
+ }), oe = _ && _.parentNode, ye = Ce(_), Re = Ce(_, t.draggable), P.eventCanceled) {
1454
+ this._nulling();
1455
+ return;
1456
+ }
1457
+ We = !1, yt = !1, ct = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), tn(this.cloneId), tn(this._dragStartId), this.nativeDraggable && (V(document, "drop", this), V(n, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), rt && A(document.body, "user-select", ""), A(_, "transform", ""), e && (lt && (e.cancelable && e.preventDefault(), !t.dropBubble && e.stopPropagation()), R && R.parentNode && R.parentNode.removeChild(R), (ee === oe || pe && pe.lastPutMode !== "clone") && ne && ne.parentNode && ne.parentNode.removeChild(ne), _ && (this.nativeDraggable && V(_, "dragend", this), Jt(_), _.style["will-change"] = "", lt && !We && be(_, pe ? pe.options.ghostClass : this.options.ghostClass, !1), be(_, this.options.chosenClass, !1), me({
1458
+ sortable: this,
1459
+ name: "unchoose",
1460
+ toEl: oe,
1461
+ newIndex: null,
1462
+ newDraggableIndex: null,
1463
+ originalEvent: e
1464
+ }), ee !== oe ? (ye >= 0 && (me({
1465
+ rootEl: oe,
1466
+ name: "add",
1467
+ toEl: oe,
1468
+ fromEl: ee,
1469
+ originalEvent: e
1470
+ }), me({
1471
+ sortable: this,
1472
+ name: "remove",
1473
+ toEl: oe,
1474
+ originalEvent: e
1475
+ }), me({
1476
+ rootEl: oe,
1477
+ name: "sort",
1478
+ toEl: oe,
1479
+ fromEl: ee,
1480
+ originalEvent: e
1481
+ }), me({
1482
+ sortable: this,
1483
+ name: "sort",
1484
+ toEl: oe,
1485
+ originalEvent: e
1486
+ })), pe && pe.save()) : ye !== Ze && ye >= 0 && (me({
1487
+ sortable: this,
1488
+ name: "update",
1489
+ toEl: oe,
1490
+ originalEvent: e
1491
+ }), me({
1492
+ sortable: this,
1493
+ name: "sort",
1494
+ toEl: oe,
1495
+ originalEvent: e
1496
+ })), P.active && ((ye == null || ye === -1) && (ye = Ze, Re = ut), me({
1497
+ sortable: this,
1498
+ name: "end",
1499
+ toEl: oe,
1500
+ originalEvent: e
1501
+ }), this.save()))), this._nulling();
1502
+ },
1503
+ _nulling: function() {
1504
+ he("nulling", this), ee = _ = oe = R = Xe = ne = wt = Be = Le = ke = lt = ye = Re = Ze = ut = Je = dt = pe = bt = P.dragged = P.ghost = P.clone = P.active = null, $t.forEach(function(e) {
1505
+ e.checked = !0;
1506
+ }), $t.length = Xt = Ht = 0;
1507
+ },
1508
+ handleEvent: function(e) {
1509
+ switch (e.type) {
1510
+ case "drop":
1511
+ case "dragend":
1512
+ this._onDrop(e);
1513
+ break;
1514
+ case "dragenter":
1515
+ case "dragover":
1516
+ _ && (this._onDragOver(e), po(e));
1517
+ break;
1518
+ case "selectstart":
1519
+ e.preventDefault();
1520
+ break;
1521
+ }
1522
+ },
1523
+ /**
1524
+ * Serializes the item into an array of string.
1525
+ * @returns {String[]}
1526
+ */
1527
+ toArray: function() {
1528
+ for (var e = [], n, t = this.el.children, l = 0, o = t.length, i = this.options; l < o; l++)
1529
+ n = t[l], Te(n, i.draggable, this.el, !1) && e.push(n.getAttribute(i.dataIdAttr) || bo(n));
1530
+ return e;
1531
+ },
1532
+ /**
1533
+ * Sorts the elements according to the array.
1534
+ * @param {String[]} order order of the items
1535
+ */
1536
+ sort: function(e, n) {
1537
+ var t = {}, l = this.el;
1538
+ this.toArray().forEach(function(o, i) {
1539
+ var r = l.children[i];
1540
+ Te(r, this.options.draggable, l, !1) && (t[o] = r);
1541
+ }, this), n && this.captureAnimationState(), e.forEach(function(o) {
1542
+ t[o] && (l.removeChild(t[o]), l.appendChild(t[o]));
1543
+ }), n && this.animateAll();
1544
+ },
1545
+ /**
1546
+ * Save the current sorting
1547
+ */
1548
+ save: function() {
1549
+ var e = this.options.store;
1550
+ e && e.set && e.set(this);
1551
+ },
1552
+ /**
1553
+ * 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.
1554
+ * @param {HTMLElement} el
1555
+ * @param {String} [selector] default: `options.draggable`
1556
+ * @returns {HTMLElement|null}
1557
+ */
1558
+ closest: function(e, n) {
1559
+ return Te(e, n || this.options.draggable, this.el, !1);
1560
+ },
1561
+ /**
1562
+ * Set/get option
1563
+ * @param {string} name
1564
+ * @param {*} [value]
1565
+ * @returns {*}
1566
+ */
1567
+ option: function(e, n) {
1568
+ var t = this.options;
1569
+ if (n === void 0)
1570
+ return t[e];
1571
+ var l = ft.modifyOption(this, e, n);
1572
+ typeof l < "u" ? t[e] = l : t[e] = n, e === "group" && Qn(t);
1573
+ },
1574
+ /**
1575
+ * Destroy
1576
+ */
1577
+ destroy: function() {
1578
+ he("destroy", this);
1579
+ var e = this.el;
1580
+ e[_e] = null, V(e, "mousedown", this._onTapStart), V(e, "touchstart", this._onTapStart), V(e, "pointerdown", this._onTapStart), this.nativeDraggable && (V(e, "dragover", this), V(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(n) {
1581
+ n.removeAttribute("draggable");
1582
+ }), this._onDrop(), this._disableDelayedDragEvents(), Pt.splice(Pt.indexOf(this.el), 1), this.el = e = null;
1583
+ },
1584
+ _hideClone: function() {
1585
+ if (!Be) {
1586
+ if (he("hideClone", this), P.eventCanceled)
1587
+ return;
1588
+ A(ne, "display", "none"), this.options.removeCloneOnHide && ne.parentNode && ne.parentNode.removeChild(ne), Be = !0;
1589
+ }
1590
+ },
1591
+ _showClone: function(e) {
1592
+ if (e.lastPutMode !== "clone") {
1593
+ this._hideClone();
1594
+ return;
1595
+ }
1596
+ if (Be) {
1597
+ if (he("showClone", this), P.eventCanceled)
1598
+ return;
1599
+ _.parentNode == ee && !this.options.group.revertClone ? ee.insertBefore(ne, _) : Xe ? ee.insertBefore(ne, Xe) : ee.appendChild(ne), this.options.group.revertClone && this.animate(_, ne), A(ne, "display", ""), Be = !1;
1600
+ }
1601
+ }
1602
+ };
1603
+ function po(e) {
1604
+ e.dataTransfer && (e.dataTransfer.dropEffect = "move"), e.cancelable && e.preventDefault();
1605
+ }
1606
+ function Ct(e, n, t, l, o, i, r, s) {
1607
+ var a, g = e[_e], u = g.options.onMove, d;
1608
+ return window.CustomEvent && !Fe && !pt ? a = new CustomEvent("move", {
1609
+ bubbles: !0,
1610
+ cancelable: !0
1611
+ }) : (a = document.createEvent("Event"), a.initEvent("move", !0, !0)), a.to = n, a.from = e, a.dragged = t, a.draggedRect = l, a.related = o || n, a.relatedRect = i || re(n), a.willInsertAfter = s, a.originalEvent = r, e.dispatchEvent(a), u && (d = u.call(g, a, r)), d;
1612
+ }
1613
+ function Jt(e) {
1614
+ e.draggable = !1;
1615
+ }
1616
+ function fo() {
1617
+ en = !1;
1618
+ }
1619
+ function vo(e, n, t) {
1620
+ var l = re(tt(t.el, 0, t.options, !0)), o = Wn(t.el, t.options, R), i = 10;
1621
+ return n ? e.clientX < o.left - i || e.clientY < l.top && e.clientX < l.right : e.clientY < o.top - i || e.clientY < l.bottom && e.clientX < l.left;
1622
+ }
1623
+ function mo(e, n, t) {
1624
+ var l = re(rn(t.el, t.options.draggable)), o = Wn(t.el, t.options, R), i = 10;
1625
+ return n ? e.clientX > o.right + i || e.clientY > l.bottom && e.clientX > l.left : e.clientY > o.bottom + i || e.clientX > l.right && e.clientY > l.top;
1626
+ }
1627
+ function ho(e, n, t, l, o, i, r, s) {
1628
+ var a = l ? e.clientY : e.clientX, g = l ? t.height : t.width, u = l ? t.top : t.left, d = l ? t.bottom : t.right, T = !1;
1629
+ if (!r) {
1630
+ if (s && kt < g * o) {
1631
+ if (!ct && (dt === 1 ? a > u + g * i / 2 : a < d - g * i / 2) && (ct = !0), ct)
1632
+ T = !0;
1633
+ else if (dt === 1 ? a < u + kt : a > d - kt)
1634
+ return -dt;
1635
+ } else if (a > u + g * (1 - o) / 2 && a < d - g * (1 - o) / 2)
1636
+ return go(n);
1637
+ }
1638
+ return T = T || r, T && (a < u + g * i / 2 || a > d - g * i / 2) ? a > u + g / 2 ? 1 : -1 : 0;
1639
+ }
1640
+ function go(e) {
1641
+ return Ce(_) < Ce(e) ? 1 : -1;
1642
+ }
1643
+ function bo(e) {
1644
+ for (var n = e.tagName + e.className + e.src + e.href + e.textContent, t = n.length, l = 0; t--; )
1645
+ l += n.charCodeAt(t);
1646
+ return l.toString(36);
1647
+ }
1648
+ function yo(e) {
1649
+ $t.length = 0;
1650
+ for (var n = e.getElementsByTagName("input"), t = n.length; t--; ) {
1651
+ var l = n[t];
1652
+ l.checked && $t.push(l);
1653
+ }
1654
+ }
1655
+ function Tt(e) {
1656
+ return setTimeout(e, 0);
1657
+ }
1658
+ function tn(e) {
1659
+ return clearTimeout(e);
1660
+ }
1661
+ Mt && q(document, "touchmove", function(e) {
1662
+ (P.active || We) && e.cancelable && e.preventDefault();
1663
+ });
1664
+ P.utils = {
1665
+ on: q,
1666
+ off: V,
1667
+ css: A,
1668
+ find: Xn,
1669
+ is: function(e, n) {
1670
+ return !!Te(e, n, e, !1);
1671
+ },
1672
+ extend: eo,
1673
+ throttle: Hn,
1674
+ closest: Te,
1675
+ toggleClass: be,
1676
+ clone: Jn,
1677
+ index: Ce,
1678
+ nextTick: Tt,
1679
+ cancelNextTick: tn,
1680
+ detectDirection: Zn,
1681
+ getChild: tt
1682
+ };
1683
+ P.get = function(e) {
1684
+ return e[_e];
1685
+ };
1686
+ P.mount = function() {
1687
+ for (var e = arguments.length, n = new Array(e), t = 0; t < e; t++)
1688
+ n[t] = arguments[t];
1689
+ n[0].constructor === Array && (n = n[0]), n.forEach(function(l) {
1690
+ if (!l.prototype || !l.prototype.constructor)
1691
+ throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(l));
1692
+ l.utils && (P.utils = Ne(Ne({}, P.utils), l.utils)), ft.mount(l);
1693
+ });
1694
+ };
1695
+ P.create = function(e, n) {
1696
+ return new P(e, n);
1697
+ };
1698
+ P.version = Zl;
1699
+ var ie = [], ot, nn, ln = !1, Wt, Gt, Ft, at;
1700
+ function _o() {
1701
+ function e() {
1702
+ this.defaults = {
1703
+ scroll: !0,
1704
+ forceAutoScrollFallback: !1,
1705
+ scrollSensitivity: 30,
1706
+ scrollSpeed: 10,
1707
+ bubbleScroll: !0
1708
+ };
1709
+ for (var n in this)
1710
+ n.charAt(0) === "_" && typeof this[n] == "function" && (this[n] = this[n].bind(this));
1711
+ }
1712
+ return e.prototype = {
1713
+ dragStarted: function(n) {
1714
+ var t = n.originalEvent;
1715
+ this.sortable.nativeDraggable ? q(document, "dragover", this._handleAutoScroll) : this.options.supportPointer ? q(document, "pointermove", this._handleFallbackAutoScroll) : t.touches ? q(document, "touchmove", this._handleFallbackAutoScroll) : q(document, "mousemove", this._handleFallbackAutoScroll);
1716
+ },
1717
+ dragOverCompleted: function(n) {
1718
+ var t = n.originalEvent;
1719
+ !this.options.dragOverBubble && !t.rootEl && this._handleAutoScroll(t);
1720
+ },
1721
+ drop: function() {
1722
+ this.sortable.nativeDraggable ? V(document, "dragover", this._handleAutoScroll) : (V(document, "pointermove", this._handleFallbackAutoScroll), V(document, "touchmove", this._handleFallbackAutoScroll), V(document, "mousemove", this._handleFallbackAutoScroll)), En(), Dt(), to();
1723
+ },
1724
+ nulling: function() {
1725
+ Ft = nn = ot = ln = at = Wt = Gt = null, ie.length = 0;
1726
+ },
1727
+ _handleFallbackAutoScroll: function(n) {
1728
+ this._handleAutoScroll(n, !0);
1729
+ },
1730
+ _handleAutoScroll: function(n, t) {
1731
+ var l = this, o = (n.touches ? n.touches[0] : n).clientX, i = (n.touches ? n.touches[0] : n).clientY, r = document.elementFromPoint(o, i);
1732
+ if (Ft = n, t || this.options.forceAutoScrollFallback || pt || Fe || rt) {
1733
+ Zt(n, this.options, r, t);
1734
+ var s = je(r, !0);
1735
+ ln && (!at || o !== Wt || i !== Gt) && (at && En(), at = setInterval(function() {
1736
+ var a = je(document.elementFromPoint(o, i), !0);
1737
+ a !== s && (s = a, Dt()), Zt(n, l.options, a, t);
1738
+ }, 10), Wt = o, Gt = i);
1739
+ } else {
1740
+ if (!this.options.bubbleScroll || je(r, !0) === Oe()) {
1741
+ Dt();
1742
+ return;
1743
+ }
1744
+ Zt(n, this.options, je(r, !1), !1);
1745
+ }
1746
+ }
1747
+ }, $e(e, {
1748
+ pluginName: "scroll",
1749
+ initializeByDefault: !0
1750
+ });
1751
+ }
1752
+ function Dt() {
1753
+ ie.forEach(function(e) {
1754
+ clearInterval(e.pid);
1755
+ }), ie = [];
1756
+ }
1757
+ function En() {
1758
+ clearInterval(at);
1759
+ }
1760
+ var Zt = Hn(function(e, n, t, l) {
1761
+ if (n.scroll) {
1762
+ var o = (e.touches ? e.touches[0] : e).clientX, i = (e.touches ? e.touches[0] : e).clientY, r = n.scrollSensitivity, s = n.scrollSpeed, a = Oe(), g = !1, u;
1763
+ nn !== t && (nn = t, Dt(), ot = n.scroll, u = n.scrollFn, ot === !0 && (ot = je(t, !0)));
1764
+ var d = 0, T = ot;
1765
+ do {
1766
+ var w = T, y = re(w), k = y.top, B = y.bottom, j = y.left, te = y.right, z = y.width, X = y.height, O = void 0, se = void 0, J = w.scrollWidth, ue = w.scrollHeight, G = A(w), E = w.scrollLeft, L = w.scrollTop;
1767
+ w === a ? (O = z < J && (G.overflowX === "auto" || G.overflowX === "scroll" || G.overflowX === "visible"), se = X < ue && (G.overflowY === "auto" || G.overflowY === "scroll" || G.overflowY === "visible")) : (O = z < J && (G.overflowX === "auto" || G.overflowX === "scroll"), se = X < ue && (G.overflowY === "auto" || G.overflowY === "scroll"));
1768
+ var Y = O && (Math.abs(te - o) <= r && E + z < J) - (Math.abs(j - o) <= r && !!E), le = se && (Math.abs(B - i) <= r && L + X < ue) - (Math.abs(k - i) <= r && !!L);
1769
+ if (!ie[d])
1770
+ for (var H = 0; H <= d; H++)
1771
+ ie[H] || (ie[H] = {});
1772
+ (ie[d].vx != Y || ie[d].vy != le || ie[d].el !== w) && (ie[d].el = w, ie[d].vx = Y, ie[d].vy = le, clearInterval(ie[d].pid), (Y != 0 || le != 0) && (g = !0, ie[d].pid = setInterval((function() {
1773
+ l && this.layer === 0 && P.active._onTouchMove(Ft);
1774
+ var N = ie[this.layer].vy ? ie[this.layer].vy * s : 0, c = ie[this.layer].vx ? ie[this.layer].vx * s : 0;
1775
+ typeof u == "function" && u.call(P.dragged.parentNode[_e], c, N, e, Ft, ie[this.layer].el) !== "continue" || qn(ie[this.layer].el, c, N);
1776
+ }).bind({
1777
+ layer: d
1778
+ }), 24))), d++;
1779
+ } while (n.bubbleScroll && T !== a && (T = je(T, !1)));
1780
+ ln = g;
1781
+ }
1782
+ }, 30), tl = function(e) {
1783
+ var n = e.originalEvent, t = e.putSortable, l = e.dragEl, o = e.activeSortable, i = e.dispatchSortableEvent, r = e.hideGhostForTarget, s = e.unhideGhostForTarget;
1784
+ if (n) {
1785
+ var a = t || o;
1786
+ r();
1787
+ var g = n.changedTouches && n.changedTouches.length ? n.changedTouches[0] : n, u = document.elementFromPoint(g.clientX, g.clientY);
1788
+ s(), a && !a.el.contains(u) && (i("spill"), this.onSpill({
1789
+ dragEl: l,
1790
+ putSortable: t
1791
+ }));
1792
+ }
1793
+ };
1794
+ function sn() {
1795
+ }
1796
+ sn.prototype = {
1797
+ startIndex: null,
1798
+ dragStart: function(e) {
1799
+ var n = e.oldDraggableIndex;
1800
+ this.startIndex = n;
1801
+ },
1802
+ onSpill: function(e) {
1803
+ var n = e.dragEl, t = e.putSortable;
1804
+ this.sortable.captureAnimationState(), t && t.captureAnimationState();
1805
+ var l = tt(this.sortable.el, this.startIndex, this.options);
1806
+ l ? this.sortable.el.insertBefore(n, l) : this.sortable.el.appendChild(n), this.sortable.animateAll(), t && t.animateAll();
1807
+ },
1808
+ drop: tl
1809
+ };
1810
+ $e(sn, {
1811
+ pluginName: "revertOnSpill"
1812
+ });
1813
+ function un() {
1814
+ }
1815
+ un.prototype = {
1816
+ onSpill: function(e) {
1817
+ var n = e.dragEl, t = e.putSortable, l = t || this.sortable;
1818
+ l.captureAnimationState(), n.parentNode && n.parentNode.removeChild(n), l.animateAll();
1819
+ },
1820
+ drop: tl
1821
+ };
1822
+ $e(un, {
1823
+ pluginName: "removeOnSpill"
1824
+ });
1825
+ P.mount(new _o());
1826
+ P.mount(un, sn);
1827
+ function Co(e) {
1828
+ return e == null ? e : JSON.parse(JSON.stringify(e));
1829
+ }
1830
+ function So(e) {
1831
+ an() && ul(e);
1832
+ }
1833
+ function xo(e) {
1834
+ an() ? An(e) : Pn(e);
1835
+ }
1836
+ let nl = null, ll = null;
1837
+ function In(e = null, n = null) {
1838
+ nl = e, ll = n;
1839
+ }
1840
+ function wo() {
1841
+ return {
1842
+ data: nl,
1843
+ clonedData: ll
1844
+ };
1845
+ }
1846
+ const On = /* @__PURE__ */ Symbol("cloneElement");
1847
+ function ko(...e) {
1848
+ var n, t;
1849
+ const l = (n = an()) == null ? void 0 : n.proxy;
1850
+ let o = null;
1851
+ const i = e[0];
1852
+ let [, r, s] = e;
1853
+ Array.isArray(b(r)) || (s = r, r = null);
1854
+ let a = null;
1855
+ const {
1856
+ immediate: g = !0,
1857
+ clone: u = Co,
1858
+ forceFallback: d,
1859
+ fallbackOnBody: T,
1860
+ customUpdate: w
1861
+ } = (t = b(s)) != null ? t : {};
1862
+ function y(E) {
1863
+ var L;
1864
+ const { from: Y, oldIndex: le, item: H } = E, N = Array.from(Y.childNodes);
1865
+ o = d && !T ? N.slice(0, -1) : N;
1866
+ const c = b((L = b(r)) == null ? void 0 : L[le]), m = u(c);
1867
+ In(c, m), H[On] = m;
1868
+ }
1869
+ function k(E) {
1870
+ const L = E.item[On];
1871
+ if (!zl(L)) {
1872
+ if (Vt(E.item), Bt(r)) {
1873
+ const Y = [...b(r)];
1874
+ r.value = gn(Y, E.newDraggableIndex, L);
1875
+ return;
1876
+ }
1877
+ gn(b(r), E.newDraggableIndex, L);
1878
+ }
1879
+ }
1880
+ function B(E) {
1881
+ const { from: L, item: Y, oldIndex: le, oldDraggableIndex: H, pullMode: N, clone: c } = E;
1882
+ if (bn(L, Y, le), N === "clone") {
1883
+ Vt(c);
1884
+ return;
1885
+ }
1886
+ if (Bt(r)) {
1887
+ const m = [...b(r)];
1888
+ r.value = hn(m, H);
1889
+ return;
1890
+ }
1891
+ hn(b(r), H);
1892
+ }
1893
+ function j(E) {
1894
+ if (w) {
1895
+ w(E);
1896
+ return;
1897
+ }
1898
+ const { from: L, item: Y, oldIndex: le, oldDraggableIndex: H, newDraggableIndex: N } = E;
1899
+ if (Vt(Y), bn(L, Y, le), Bt(r)) {
1900
+ const c = [...b(r)];
1901
+ r.value = mn(
1902
+ c,
1903
+ H,
1904
+ N
1905
+ );
1906
+ return;
1907
+ }
1908
+ mn(b(r), H, N);
1909
+ }
1910
+ function te(E) {
1911
+ const { newIndex: L, oldIndex: Y, from: le, to: H } = E;
1912
+ let N = null;
1913
+ const c = L === Y && le === H;
1914
+ try {
1915
+ if (c) {
1916
+ let m = null;
1917
+ o?.some((ge, we) => {
1918
+ if (m && o?.length !== H.childNodes.length)
1919
+ return le.insertBefore(m, ge.nextSibling), !0;
1920
+ const Me = H.childNodes[we];
1921
+ m = H?.replaceChild(ge, Me);
1922
+ });
1923
+ }
1924
+ } catch (m) {
1925
+ N = m;
1926
+ } finally {
1927
+ o = null;
1928
+ }
1929
+ Pn(() => {
1930
+ if (In(), N)
1931
+ throw N;
1932
+ });
1933
+ }
1934
+ const z = {
1935
+ onUpdate: j,
1936
+ onStart: y,
1937
+ onAdd: k,
1938
+ onRemove: B,
1939
+ onEnd: te
1940
+ };
1941
+ function X(E) {
1942
+ const L = b(i);
1943
+ return E || (E = Ll(L) ? Vl(L, l?.$el) : L), E && !Xl(E) && (E = E.$el), E || Rl("Root element not found"), E;
1944
+ }
1945
+ function O() {
1946
+ var E;
1947
+ const L = (E = b(s)) != null ? E : {}, { immediate: Y, clone: le } = L, H = zn(L, ["immediate", "clone"]);
1948
+ return yn(H, (N, c) => {
1949
+ Hl(N) && (H[N] = (m, ...ge) => {
1950
+ const we = wo();
1951
+ return ql(m, we), c(m, ...ge);
1952
+ });
1953
+ }), Ul(
1954
+ r === null ? {} : z,
1955
+ H
1956
+ );
1957
+ }
1958
+ const se = (E) => {
1959
+ E = X(E), a && J.destroy(), a = new P(E, O());
1960
+ };
1961
+ Ke(
1962
+ () => s,
1963
+ () => {
1964
+ a && yn(O(), (E, L) => {
1965
+ a?.option(E, L);
1966
+ });
1967
+ },
1968
+ { deep: !0 }
1969
+ );
1970
+ const J = {
1971
+ option: (E, L) => a?.option(E, L),
1972
+ destroy: () => {
1973
+ a?.destroy(), a = null;
1974
+ },
1975
+ save: () => a?.save(),
1976
+ toArray: () => a?.toArray(),
1977
+ closest: (...E) => a?.closest(...E)
1978
+ }, ue = () => J?.option("disabled", !0), G = () => J?.option("disabled", !1);
1979
+ return xo(() => {
1980
+ g && se();
1981
+ }), So(J.destroy), Ge({ start: se, pause: ue, resume: G }, J);
1982
+ }
1983
+ const on = [
1984
+ "update",
1985
+ "start",
1986
+ "add",
1987
+ "remove",
1988
+ "choose",
1989
+ "unchoose",
1990
+ "end",
1991
+ "sort",
1992
+ "filter",
1993
+ "clone",
1994
+ "move",
1995
+ "change"
1996
+ ], To = [
1997
+ "clone",
1998
+ "animation",
1999
+ "ghostClass",
2000
+ "group",
2001
+ "sort",
2002
+ "disabled",
2003
+ "store",
2004
+ "handle",
2005
+ "draggable",
2006
+ "swapThreshold",
2007
+ "invertSwap",
2008
+ "invertedSwapThreshold",
2009
+ "removeCloneOnHide",
2010
+ "direction",
2011
+ "chosenClass",
2012
+ "dragClass",
2013
+ "ignore",
2014
+ "filter",
2015
+ "preventOnFilter",
2016
+ "easing",
2017
+ "setData",
2018
+ "dropBubble",
2019
+ "dragoverBubble",
2020
+ "dataIdAttr",
2021
+ "delay",
2022
+ "delayOnTouchOnly",
2023
+ "touchStartThreshold",
2024
+ "forceFallback",
2025
+ "fallbackClass",
2026
+ "fallbackOnBody",
2027
+ "fallbackTolerance",
2028
+ "fallbackOffset",
2029
+ "supportPointer",
2030
+ "emptyInsertThreshold",
2031
+ "scroll",
2032
+ "forceAutoScrollFallback",
2033
+ "scrollSensitivity",
2034
+ "scrollSpeed",
2035
+ "bubbleScroll",
2036
+ "modelValue",
2037
+ "tag",
2038
+ "target",
2039
+ "customUpdate",
2040
+ ...on.map((e) => `on${e.replace(/^\S/, (n) => n.toUpperCase())}`)
2041
+ ], Do = xe({
2042
+ name: "VueDraggable",
2043
+ model: {
2044
+ prop: "modelValue",
2045
+ event: "update:modelValue"
2046
+ },
2047
+ props: To,
2048
+ emits: ["update:modelValue", ...on],
2049
+ setup(e, { slots: n, emit: t, expose: l, attrs: o }) {
2050
+ const i = on.reduce((u, d) => {
2051
+ const T = `on${d.replace(/^\S/, (w) => w.toUpperCase())}`;
2052
+ return u[T] = (...w) => t(d, ...w), u;
2053
+ }, {}), r = F(() => {
2054
+ const u = rl(e), { modelValue: d } = u, T = zn(u, ["modelValue"]), w = Object.entries(T).reduce((y, [k, B]) => {
2055
+ const j = b(B);
2056
+ return j !== void 0 && (y[k] = j), y;
2057
+ }, {});
2058
+ return Ge(Ge({}, i), jl(Ge(Ge({}, o), w)));
2059
+ }), s = F({
2060
+ get: () => e.modelValue,
2061
+ set: (u) => t("update:modelValue", u)
2062
+ }), a = de(), g = Nn(
2063
+ ko(e.target || a, s, r)
2064
+ );
2065
+ return l(g), () => {
2066
+ var u;
2067
+ return sl(e.tag || "div", { ref: a }, (u = n?.default) == null ? void 0 : u.call(n, g));
2068
+ };
2069
+ }
2070
+ }), Eo = { class: "expanded" }, Io = { class: "expanded__head" }, Oo = { class: "expanded__icon" }, No = ["name"], Ao = { class: "expanded__title" }, Po = { class: "expanded__meta" }, $o = { class: "expanded__head-actions" }, Fo = { class: "expanded__body" }, Mo = { class: "expanded__preview" }, Ro = {
2071
+ key: 1,
2072
+ class: "expanded__options"
2073
+ }, Bo = ["onDragstart", "onDragover", "onDrop"], jo = { class: "expanded__options-foot" }, zo = ["name"], Lo = {
2074
+ key: 2,
2075
+ class: "expanded__preview"
2076
+ }, Vo = { class: "expanded__row" }, Yo = { class: "expanded__preview" }, Uo = { class: "expanded__row expanded__row--3" }, Xo = { class: "expanded__preview" }, Ho = { class: "expanded__row expanded__row--2" }, qo = { class: "expanded__preview" }, Jo = { class: "expanded__preview" }, Wo = { class: "expanded__section-preview" }, Go = { key: 0 }, Zo = { class: "expanded__foot" }, Qo = ["onClick"], Ko = ["name"], ea = /* @__PURE__ */ xe({
2077
+ __name: "FieldCardExpanded",
2078
+ props: {
2079
+ pageIdx: {},
2080
+ fieldName: {}
2081
+ },
2082
+ setup(e) {
2083
+ const n = e, t = ze(), l = F(
2084
+ () => t.data.pages[n.pageIdx]?.fields[n.fieldName] ?? {}
2085
+ ), o = F(() => {
2086
+ const I = l.value;
2087
+ return I.uiCom === "TextArea" ? Z.find((f) => f.id === "textarea") : I.uiCom === "Rating" ? Z.find((f) => f.id === "rating") : I.uiCom === "Slider" ? Z.find((f) => f.id === "slider") : I.uiCom === "ColorPicker" ? Z.find((f) => f.id === "color") : I.uiCom === "Section" ? Z.find((f) => f.id === "section") : I.uiCom === "File" ? Z.find((f) => f.id === "file") : I.ref ? Z.find((f) => f.id === "ref") : Array.isArray(I.enum) ? Z.find((f) => f.id === "select") : I.type === "Number" ? Z.find((f) => f.id === "number") : I.type === "Date" ? Z.find((f) => f.id === "date") : I.type === "Boolean" ? Z.find((f) => f.id === "boolean") : Z.find((f) => f.id === "text");
2088
+ }), i = F(() => o.value?.id ?? "text"), r = Z.map((I) => ({ label: I.label, value: I.id }));
2089
+ function s(I) {
2090
+ const f = I.detail;
2091
+ return f != null && typeof f == "object" && "value" in f ? f.value : f != null && typeof f == "object" && "checked" in f ? f.checked : f;
2092
+ }
2093
+ function a(I, f) {
2094
+ t.updateField(n.pageIdx, n.fieldName, { [I]: f });
2095
+ }
2096
+ function g(I) {
2097
+ if (!(!I || I === n.fieldName))
2098
+ try {
2099
+ t.renameField(n.pageIdx, n.fieldName, I);
2100
+ } catch (f) {
2101
+ console.warn("[builder] rename failed:", f.message);
2102
+ }
2103
+ }
2104
+ function u() {
2105
+ t.selectPage(n.pageIdx);
2106
+ }
2107
+ function d() {
2108
+ t.duplicateField(n.pageIdx, n.fieldName);
2109
+ }
2110
+ function T() {
2111
+ t.removeField(n.pageIdx, n.fieldName);
2112
+ }
2113
+ const w = [
2114
+ "label",
2115
+ "required",
2116
+ "helperText",
2117
+ "placeholder",
2118
+ "full",
2119
+ "hidden",
2120
+ "disabled",
2121
+ "readOnly",
2122
+ "visibleIf",
2123
+ "enableIf",
2124
+ "requiredIf"
2125
+ ];
2126
+ function y(I) {
2127
+ if (!I || I === i.value) return;
2128
+ const f = Kt[I], M = f ? f() : { type: "String" }, v = {};
2129
+ for (const h of w)
2130
+ l.value[h] !== void 0 && (v[h] = l.value[h]);
2131
+ t.replaceFieldDef(n.pageIdx, n.fieldName, {
2132
+ ...M,
2133
+ ...v
2134
+ });
2135
+ }
2136
+ const k = F(
2137
+ () => Array.isArray(l.value.enum) ? l.value.enum : []
2138
+ );
2139
+ function B(I, f) {
2140
+ const M = [...k.value];
2141
+ M[I] = f, a("enum", M);
2142
+ }
2143
+ function j(I) {
2144
+ const f = k.value.filter((M, v) => v !== I);
2145
+ a("enum", f.length ? f : void 0);
2146
+ }
2147
+ function te() {
2148
+ const I = [...k.value, `Option ${k.value.length + 1}`];
2149
+ a("enum", I);
2150
+ }
2151
+ const z = de(null), X = de(null);
2152
+ function O(I, f) {
2153
+ I.dataTransfer && (z.value = f, I.dataTransfer.setData("application/cobalt-option-move", String(f)), I.dataTransfer.effectAllowed = "move");
2154
+ }
2155
+ function se(I, f) {
2156
+ z.value !== null && (I.preventDefault(), I.dataTransfer && (I.dataTransfer.dropEffect = "move"), X.value = f);
2157
+ }
2158
+ function J() {
2159
+ X.value = null;
2160
+ }
2161
+ function ue(I, f) {
2162
+ I.preventDefault();
2163
+ const M = z.value;
2164
+ if (z.value = null, X.value = null, M === null || M === f) return;
2165
+ const v = [...k.value], [h] = v.splice(M, 1), S = M < f ? f - 1 : f;
2166
+ v.splice(S, 0, h), a("enum", v);
2167
+ }
2168
+ function G() {
2169
+ z.value = null, X.value = null;
2170
+ }
2171
+ const E = F(
2172
+ () => k.value.some((I) => String(I).trim().toLowerCase() === "other")
2173
+ );
2174
+ function L() {
2175
+ E.value ? a(
2176
+ "enum",
2177
+ k.value.filter((I) => String(I).trim().toLowerCase() !== "other")
2178
+ ) : a("enum", [...k.value, "Other"]);
2179
+ }
2180
+ const Y = de(!1), le = Z.filter(
2181
+ (I) => ["text", "textarea", "number", "date", "select", "boolean", "rating"].includes(I.id)
2182
+ );
2183
+ function H(I) {
2184
+ Y.value = !1, t.insertFieldAfter(n.pageIdx, n.fieldName, I);
2185
+ }
2186
+ function N() {
2187
+ Y.value = !1, t.insertFieldAfter(n.pageIdx, n.fieldName, "section");
2188
+ }
2189
+ const c = F(() => {
2190
+ switch (i.value) {
2191
+ case "number":
2192
+ return "number";
2193
+ case "date":
2194
+ return "date";
2195
+ case "color":
2196
+ return "color";
2197
+ case "file":
2198
+ return "file";
2199
+ default:
2200
+ return "text";
2201
+ }
2202
+ });
2203
+ function m(I) {
2204
+ if (I === "" || I == null) return;
2205
+ const f = Number(I);
2206
+ return Number.isFinite(f) ? f : void 0;
2207
+ }
2208
+ const ge = F(() => Number(l.value.min ?? 0)), we = F(() => Number(l.value.max ?? 100)), Me = F(() => Number(l.value.step ?? 1)), Rt = F(() => ge.value), vt = F(() => Number(l.value.max ?? 5));
2209
+ return (I, f) => (C(), D("div", {
2210
+ class: "expanded-wrap",
2211
+ onClick: f[14] || (f[14] = He(() => {
2212
+ }, ["stop"]))
2213
+ }, [
2214
+ p("div", Eo, [
2215
+ p("header", Io, [
2216
+ p("span", Oo, [
2217
+ o.value ? (C(), D("co-icon", {
2218
+ key: 0,
2219
+ name: o.value.icon,
2220
+ size: "20"
2221
+ }, null, 8, No)) : U("", !0)
2222
+ ]),
2223
+ p("div", Ao, [
2224
+ x(et, {
2225
+ class: "expanded__label",
2226
+ "model-value": l.value.label || "",
2227
+ placeholder: "Untitled field",
2228
+ "onUpdate:modelValue": f[0] || (f[0] = (M) => a("label", M))
2229
+ }, null, 8, ["model-value"]),
2230
+ p("div", Po, [
2231
+ x(et, {
2232
+ class: "expanded__id",
2233
+ "model-value": e.fieldName,
2234
+ placeholder: "field_id",
2235
+ "onUpdate:modelValue": g
2236
+ }, null, 8, ["model-value"]),
2237
+ f[15] || (f[15] = p("span", { class: "expanded__sep" }, "·", -1)),
2238
+ p("span", null, ce(o.value?.label || "Field"), 1)
2239
+ ])
2240
+ ]),
2241
+ p("div", $o, [
2242
+ x(b(Ue), {
2243
+ class: "expanded__type",
2244
+ options: JSON.stringify(b(r)),
2245
+ value: i.value,
2246
+ onCoChange: f[1] || (f[1] = (M) => y(s(M)))
2247
+ }, null, 8, ["options", "value"]),
2248
+ x(b(Et), {
2249
+ icon: "x",
2250
+ variant: "outlined",
2251
+ size: "sm",
2252
+ label: "Collapse",
2253
+ onClick: u
2254
+ })
2255
+ ])
2256
+ ]),
2257
+ p("div", Fo, [
2258
+ ["text", "textarea", "number", "date", "color", "file"].includes(i.value) ? (C(), D(Q, { key: 0 }, [
2259
+ x(b(W), {
2260
+ label: "Placeholder",
2261
+ value: l.value.placeholder || "",
2262
+ onCoInput: f[2] || (f[2] = (M) => a("placeholder", s(M)))
2263
+ }, null, 8, ["value"]),
2264
+ p("div", Mo, [
2265
+ f[16] || (f[16] = p("div", { class: "expanded__preview-label" }, "Preview", -1)),
2266
+ x(b(W), {
2267
+ label: l.value.label,
2268
+ placeholder: l.value.placeholder,
2269
+ "helper-text": l.value.helperText,
2270
+ type: c.value,
2271
+ multiline: i.value === "textarea" || void 0,
2272
+ required: !!l.value.required,
2273
+ disabled: ""
2274
+ }, null, 8, ["label", "placeholder", "helper-text", "type", "multiline", "required"])
2275
+ ])
2276
+ ], 64)) : i.value === "select" ? (C(), D("div", Ro, [
2277
+ f[20] || (f[20] = p("div", { class: "expanded__options-label" }, "Options", -1)),
2278
+ (C(!0), D(Q, null, De(k.value, (M, v) => (C(), D("div", {
2279
+ key: v,
2280
+ class: Ee(["expanded__option", {
2281
+ "is-drop-target": X.value === v && z.value !== v,
2282
+ "is-dragging": z.value === v
2283
+ }]),
2284
+ draggable: "true",
2285
+ onDragstart: (h) => O(h, v),
2286
+ onDragover: (h) => se(h, v),
2287
+ onDragleave: J,
2288
+ onDrop: (h) => ue(h, v),
2289
+ onDragend: G
2290
+ }, [
2291
+ f[17] || (f[17] = p("span", {
2292
+ class: "expanded__option-grip",
2293
+ "aria-hidden": "true"
2294
+ }, "⋮⋮", -1)),
2295
+ f[18] || (f[18] = p("span", {
2296
+ class: "expanded__option-bullet",
2297
+ "aria-hidden": "true"
2298
+ }, null, -1)),
2299
+ x(b(W), {
2300
+ class: "expanded__option-input",
2301
+ value: M,
2302
+ placeholder: `Option ${v + 1}`,
2303
+ onCoInput: (h) => B(v, s(h))
2304
+ }, null, 8, ["value", "placeholder", "onCoInput"]),
2305
+ x(b(Et), {
2306
+ icon: "x",
2307
+ variant: "outlined",
2308
+ size: "xs",
2309
+ label: "Remove option",
2310
+ onClick: (h) => j(v)
2311
+ }, null, 8, ["onClick"])
2312
+ ], 42, Bo))), 128)),
2313
+ p("div", jo, [
2314
+ x(b(It), {
2315
+ label: "Add option",
2316
+ variant: "stroke",
2317
+ size: "s",
2318
+ "icon-left": "plus",
2319
+ onClick: te
2320
+ }),
2321
+ p("button", {
2322
+ class: Ee(["expanded__other-toggle", { "is-active": E.value }]),
2323
+ onClick: L
2324
+ }, [
2325
+ p("co-icon", {
2326
+ name: E.value ? "check-square" : "square",
2327
+ size: "14"
2328
+ }, null, 8, zo),
2329
+ f[19] || (f[19] = p("span", null, 'Add "Other (describe)"', -1))
2330
+ ], 2)
2331
+ ])
2332
+ ])) : i.value === "boolean" ? (C(), D("div", Lo, [
2333
+ f[21] || (f[21] = p("div", { class: "expanded__preview-label" }, "Preview", -1)),
2334
+ x(b(it), {
2335
+ label: l.value.label || e.fieldName,
2336
+ "helper-text": l.value.helperText,
2337
+ disabled: ""
2338
+ }, null, 8, ["label", "helper-text"])
2339
+ ])) : i.value === "rating" ? (C(), D(Q, { key: 3 }, [
2340
+ p("div", Vo, [
2341
+ x(b(W), {
2342
+ label: "Max stars",
2343
+ type: "number",
2344
+ value: String(vt.value),
2345
+ onCoInput: f[3] || (f[3] = (M) => a("max", m(s(M)) ?? 5))
2346
+ }, null, 8, ["value"])
2347
+ ]),
2348
+ p("div", Yo, [
2349
+ f[22] || (f[22] = p("div", { class: "expanded__preview-label" }, "Preview", -1)),
2350
+ x(b(hl), {
2351
+ label: l.value.label || e.fieldName,
2352
+ max: vt.value,
2353
+ value: 0,
2354
+ "read-only": ""
2355
+ }, null, 8, ["label", "max"])
2356
+ ])
2357
+ ], 64)) : i.value === "slider" ? (C(), D(Q, { key: 4 }, [
2358
+ p("div", Uo, [
2359
+ x(b(W), {
2360
+ label: "Min",
2361
+ type: "number",
2362
+ value: String(ge.value),
2363
+ onCoInput: f[4] || (f[4] = (M) => a("min", m(s(M)) ?? 0))
2364
+ }, null, 8, ["value"]),
2365
+ x(b(W), {
2366
+ label: "Max",
2367
+ type: "number",
2368
+ value: String(we.value),
2369
+ onCoInput: f[5] || (f[5] = (M) => a("max", m(s(M)) ?? 100))
2370
+ }, null, 8, ["value"]),
2371
+ x(b(W), {
2372
+ label: "Step",
2373
+ type: "number",
2374
+ value: String(Me.value),
2375
+ onCoInput: f[6] || (f[6] = (M) => a("step", m(s(M)) ?? 1))
2376
+ }, null, 8, ["value"])
2377
+ ]),
2378
+ p("div", Xo, [
2379
+ f[23] || (f[23] = p("div", { class: "expanded__preview-label" }, "Preview", -1)),
2380
+ x(b(Mn), {
2381
+ label: l.value.label || e.fieldName,
2382
+ min: ge.value,
2383
+ max: we.value,
2384
+ step: Me.value,
2385
+ value: Rt.value,
2386
+ "show-value": "",
2387
+ disabled: ""
2388
+ }, null, 8, ["label", "min", "max", "step", "value"])
2389
+ ])
2390
+ ], 64)) : i.value === "ref" ? (C(), D(Q, { key: 5 }, [
2391
+ p("div", Ho, [
2392
+ x(b(W), {
2393
+ label: "Model",
2394
+ placeholder: "Company, User, Deal…",
2395
+ value: l.value.ref || "",
2396
+ onCoInput: f[7] || (f[7] = (M) => a("ref", s(M)))
2397
+ }, null, 8, ["value"]),
2398
+ x(b(W), {
2399
+ label: "Display field",
2400
+ placeholder: "name",
2401
+ value: l.value.displayName || "",
2402
+ onCoInput: f[8] || (f[8] = (M) => a("displayName", s(M)))
2403
+ }, null, 8, ["value"])
2404
+ ]),
2405
+ p("div", qo, [
2406
+ f[24] || (f[24] = p("div", { class: "expanded__preview-label" }, "Preview", -1)),
2407
+ x(b(W), {
2408
+ label: l.value.label || e.fieldName,
2409
+ placeholder: `Search ${l.value.ref || "model"}…`,
2410
+ "icon-left": "magnifying-glass",
2411
+ disabled: ""
2412
+ }, null, 8, ["label", "placeholder"])
2413
+ ])
2414
+ ], 64)) : i.value === "section" ? (C(), D(Q, { key: 6 }, [
2415
+ x(b(W), {
2416
+ label: "Description",
2417
+ multiline: "",
2418
+ placeholder: "Optional explanatory text shown under the section title.",
2419
+ value: l.value.helperText || "",
2420
+ onCoInput: f[9] || (f[9] = (M) => a("helperText", s(M)))
2421
+ }, null, 8, ["value"]),
2422
+ p("div", Jo, [
2423
+ f[25] || (f[25] = p("div", { class: "expanded__preview-label" }, "Preview", -1)),
2424
+ p("div", Wo, [
2425
+ p("h4", null, ce(l.value.label || "Section title"), 1),
2426
+ l.value.helperText ? (C(), D("p", Go, ce(l.value.helperText), 1)) : U("", !0)
2427
+ ])
2428
+ ])
2429
+ ], 64)) : U("", !0),
2430
+ i.value !== "section" ? (C(), Se(b(W), {
2431
+ key: 7,
2432
+ label: "Helper text",
2433
+ value: l.value.helperText || "",
2434
+ placeholder: "Optional helper / hint shown below the field",
2435
+ onCoInput: f[10] || (f[10] = (M) => a("helperText", s(M)))
2436
+ }, null, 8, ["value"])) : U("", !0)
2437
+ ]),
2438
+ p("footer", Zo, [
2439
+ x(b(it), {
2440
+ checked: !!l.value.required,
2441
+ label: "Required",
2442
+ onCoChange: f[11] || (f[11] = (M) => a("required", s(M)))
2443
+ }, null, 8, ["checked"]),
2444
+ f[28] || (f[28] = p("div", { class: "expanded__foot-spacer" }, null, -1)),
2445
+ p("button", {
2446
+ class: "expanded__foot-btn",
2447
+ onClick: d
2448
+ }, [...f[26] || (f[26] = [
2449
+ p("co-icon", {
2450
+ name: "copy",
2451
+ size: "14"
2452
+ }, null, -1),
2453
+ p("span", null, "Duplicate", -1)
2454
+ ])]),
2455
+ p("button", {
2456
+ class: "expanded__foot-btn expanded__foot-btn--danger",
2457
+ onClick: T
2458
+ }, [...f[27] || (f[27] = [
2459
+ p("co-icon", {
2460
+ name: "trash",
2461
+ size: "14"
2462
+ }, null, -1),
2463
+ p("span", null, "Delete", -1)
2464
+ ])])
2465
+ ])
2466
+ ]),
2467
+ p("aside", {
2468
+ class: Ee(["mini-toolbar", { "is-open": Y.value }])
2469
+ }, [
2470
+ p("button", {
2471
+ class: "mini-toolbar__btn",
2472
+ title: "Add field below",
2473
+ onClick: f[12] || (f[12] = He((M) => Y.value = !Y.value, ["stop"]))
2474
+ }, [...f[29] || (f[29] = [
2475
+ p("co-icon", {
2476
+ name: "plus",
2477
+ size: "16"
2478
+ }, null, -1)
2479
+ ])]),
2480
+ p("button", {
2481
+ class: "mini-toolbar__btn",
2482
+ title: "Add section below",
2483
+ onClick: N
2484
+ }, [...f[30] || (f[30] = [
2485
+ p("co-icon", {
2486
+ name: "minus",
2487
+ size: "16"
2488
+ }, null, -1)
2489
+ ])]),
2490
+ p("button", {
2491
+ class: "mini-toolbar__btn",
2492
+ title: "Duplicate",
2493
+ onClick: d
2494
+ }, [...f[31] || (f[31] = [
2495
+ p("co-icon", {
2496
+ name: "copy",
2497
+ size: "16"
2498
+ }, null, -1)
2499
+ ])]),
2500
+ Y.value ? (C(), D("div", {
2501
+ key: 0,
2502
+ class: "mini-popover",
2503
+ onClick: f[13] || (f[13] = He(() => {
2504
+ }, ["stop"]))
2505
+ }, [
2506
+ f[32] || (f[32] = p("div", { class: "mini-popover__label" }, "Insert field below", -1)),
2507
+ (C(!0), D(Q, null, De(b(le), (M) => (C(), D("button", {
2508
+ key: M.id,
2509
+ class: "mini-popover__item",
2510
+ onClick: (v) => H(M.id)
2511
+ }, [
2512
+ p("co-icon", {
2513
+ name: M.icon,
2514
+ size: "16"
2515
+ }, null, 8, Ko),
2516
+ p("span", null, ce(M.label), 1)
2517
+ ], 8, Qo))), 128))
2518
+ ])) : U("", !0)
2519
+ ], 2)
2520
+ ]));
2521
+ }
2522
+ }), ta = /* @__PURE__ */ Ie(ea, [["__scopeId", "data-v-d1c82738"]]), na = { class: "field__icon" }, la = ["name"], oa = { class: "field__body" }, aa = { class: "field__name" }, ia = {
2523
+ key: 0,
2524
+ class: "field__chip field__chip--warn"
2525
+ }, ra = {
2526
+ key: 1,
2527
+ class: "field__chip"
2528
+ }, sa = {
2529
+ key: 2,
2530
+ class: "field__chip"
2531
+ }, ua = { class: "field__meta" }, da = { class: "field__meta-id" }, ca = /* @__PURE__ */ xe({
2532
+ __name: "FieldCard",
2533
+ props: {
2534
+ pageIdx: {},
2535
+ fieldIdx: {},
2536
+ fieldName: {}
2537
+ },
2538
+ setup(e) {
2539
+ const n = e, t = ze(), l = F(() => t.data.pages[n.pageIdx]), o = F(
2540
+ () => l.value?.fields[n.fieldName] ?? {}
2541
+ ), i = F(
2542
+ () => t.selection.pageIdx === n.pageIdx && t.selection.fieldName === n.fieldName
2543
+ ), r = F(() => {
2544
+ const u = o.value;
2545
+ return u.uiCom === "TextArea" ? Z.find((d) => d.id === "textarea") : u.uiCom === "Rating" ? Z.find((d) => d.id === "rating") : u.uiCom === "Slider" ? Z.find((d) => d.id === "slider") : u.uiCom === "ColorPicker" ? Z.find((d) => d.id === "color") : u.uiCom === "Section" ? Z.find((d) => d.id === "section") : u.uiCom === "File" ? Z.find((d) => d.id === "file") : u.ref ? Z.find((d) => d.id === "ref") : Array.isArray(u.enum) ? Z.find((d) => d.id === "select") : u.type === "Number" ? Z.find((d) => d.id === "number") : u.type === "Date" ? Z.find((d) => d.id === "date") : u.type === "Boolean" ? Z.find((d) => d.id === "boolean") : Z.find((d) => d.id === "text");
2546
+ });
2547
+ function s() {
2548
+ t.selectField(n.pageIdx, n.fieldName);
2549
+ }
2550
+ function a(u) {
2551
+ u.stopPropagation(), t.duplicateField(n.pageIdx, n.fieldName);
2552
+ }
2553
+ function g(u) {
2554
+ u.stopPropagation(), t.removeField(n.pageIdx, n.fieldName);
2555
+ }
2556
+ return (u, d) => i.value ? (C(), Se(ta, {
2557
+ key: 0,
2558
+ "page-idx": e.pageIdx,
2559
+ "field-name": e.fieldName
2560
+ }, null, 8, ["page-idx", "field-name"])) : (C(), D("div", {
2561
+ key: 1,
2562
+ class: "field",
2563
+ onClick: He(s, ["stop"])
2564
+ }, [
2565
+ d[4] || (d[4] = p("span", {
2566
+ class: "field__grip",
2567
+ "aria-hidden": "true"
2568
+ }, "⋮⋮", -1)),
2569
+ p("span", na, [
2570
+ r.value ? (C(), D("co-icon", {
2571
+ key: 0,
2572
+ name: r.value.icon,
2573
+ size: "18"
2574
+ }, null, 8, la)) : U("", !0)
2575
+ ]),
2576
+ p("div", oa, [
2577
+ p("div", aa, [
2578
+ Ye(ce(o.value.label || e.fieldName) + " ", 1),
2579
+ o.value.required ? (C(), D("span", ia, "required")) : U("", !0),
2580
+ o.value.visibleIf ? (C(), D("span", ra, "visibleIf")) : U("", !0),
2581
+ o.value.full ? (C(), D("span", sa, "full")) : U("", !0)
2582
+ ]),
2583
+ p("div", ua, [
2584
+ p("span", da, ce(e.fieldName), 1),
2585
+ d[1] || (d[1] = p("span", { class: "field__meta-sep" }, "·", -1)),
2586
+ p("span", null, ce(r.value?.label || o.value.type || "String"), 1)
2587
+ ])
2588
+ ]),
2589
+ p("div", {
2590
+ class: "field__actions",
2591
+ onClick: d[0] || (d[0] = He(() => {
2592
+ }, ["stop"]))
2593
+ }, [
2594
+ p("button", {
2595
+ class: "field__action",
2596
+ title: "Duplicate",
2597
+ onClick: a
2598
+ }, [...d[2] || (d[2] = [
2599
+ p("co-icon", {
2600
+ name: "copy",
2601
+ size: "14"
2602
+ }, null, -1)
2603
+ ])]),
2604
+ p("button", {
2605
+ class: "field__action field__action--danger",
2606
+ title: "Delete",
2607
+ onClick: g
2608
+ }, [...d[3] || (d[3] = [
2609
+ p("co-icon", {
2610
+ name: "trash",
2611
+ size: "14"
2612
+ }, null, -1)
2613
+ ])])
2614
+ ])
2615
+ ]));
2616
+ }
2617
+ }), pa = /* @__PURE__ */ Ie(ca, [["__scopeId", "data-v-aad445c0"]]), fa = { class: "page__head" }, va = { class: "page__head-text" }, ma = { class: "page__head-pill" }, ha = ["disabled"], ga = {
2618
+ key: 0,
2619
+ class: "page__empty"
2620
+ }, ba = /* @__PURE__ */ xe({
2621
+ __name: "PageCard",
2622
+ props: {
2623
+ pageIdx: {}
2624
+ },
2625
+ setup(e) {
2626
+ const n = e, t = ze(), l = F(() => t.data.pages[n.pageIdx]), o = F(
2627
+ () => t.selection.pageIdx === n.pageIdx && t.selection.fieldName === null
2628
+ ), i = F({
2629
+ get: () => l.value ? Object.keys(l.value.fields) : [],
2630
+ set: (y) => t.reorderFieldsByNames(n.pageIdx, y)
2631
+ }), r = de(!1);
2632
+ function s() {
2633
+ t.selectPage(n.pageIdx);
2634
+ }
2635
+ function a(y) {
2636
+ y.stopPropagation(), t.duplicatePage(n.pageIdx);
2637
+ }
2638
+ function g(y) {
2639
+ y.stopPropagation(), !(t.data.pages.length <= 1) && t.removePage(n.pageIdx);
2640
+ }
2641
+ function u(y) {
2642
+ t.updatePage(n.pageIdx, y);
2643
+ }
2644
+ function d(y) {
2645
+ y.dataTransfer && Array.from(y.dataTransfer.types).includes("application/cobalt-field-kind") && (y.preventDefault(), y.dataTransfer.dropEffect = "copy", r.value = !0);
2646
+ }
2647
+ function T(y) {
2648
+ y.currentTarget === y.target && (r.value = !1);
2649
+ }
2650
+ function w(y) {
2651
+ r.value = !1;
2652
+ const k = y.dataTransfer?.getData("application/cobalt-field-kind");
2653
+ k && (y.preventDefault(), t.addField(k, n.pageIdx));
2654
+ }
2655
+ return (y, k) => l.value ? (C(), D("section", {
2656
+ key: 0,
2657
+ class: Ee(["page", { "is-selected": o.value, "is-toolbox-drag": r.value }]),
2658
+ onClick: s
2659
+ }, [
2660
+ p("header", fa, [
2661
+ p("div", va, [
2662
+ p("div", ma, "PAGE " + ce(e.pageIdx + 1), 1),
2663
+ x(et, {
2664
+ class: "page__title",
2665
+ "model-value": l.value.title || "",
2666
+ placeholder: "Untitled page",
2667
+ "onUpdate:modelValue": k[0] || (k[0] = (B) => u({ title: B }))
2668
+ }, null, 8, ["model-value"]),
2669
+ x(et, {
2670
+ class: "page__desc",
2671
+ "model-value": l.value.description || "",
2672
+ placeholder: "Add a description for this page (optional)",
2673
+ "onUpdate:modelValue": k[1] || (k[1] = (B) => u({ description: B }))
2674
+ }, null, 8, ["model-value"])
2675
+ ]),
2676
+ p("div", {
2677
+ class: "page__head-actions",
2678
+ onClick: k[2] || (k[2] = He(() => {
2679
+ }, ["stop"]))
2680
+ }, [
2681
+ p("button", {
2682
+ class: "page__action",
2683
+ title: "Duplicate page",
2684
+ onClick: a
2685
+ }, [...k[4] || (k[4] = [
2686
+ p("co-icon", {
2687
+ name: "copy",
2688
+ size: "14"
2689
+ }, null, -1),
2690
+ p("span", null, "Duplicate", -1)
2691
+ ])]),
2692
+ p("button", {
2693
+ class: "page__action page__action--danger",
2694
+ disabled: b(t).data.pages.length <= 1,
2695
+ title: "Delete page",
2696
+ onClick: g
2697
+ }, [...k[5] || (k[5] = [
2698
+ p("co-icon", {
2699
+ name: "trash",
2700
+ size: "14"
2701
+ }, null, -1),
2702
+ p("span", null, "Delete", -1)
2703
+ ])], 8, ha)
2704
+ ])
2705
+ ]),
2706
+ p("div", {
2707
+ class: "page__body",
2708
+ onDragover: d,
2709
+ onDragleave: T,
2710
+ onDrop: w
2711
+ }, [
2712
+ x(b(Do), {
2713
+ modelValue: i.value,
2714
+ "onUpdate:modelValue": k[3] || (k[3] = (B) => i.value = B),
2715
+ class: "page__sortable",
2716
+ animation: 140,
2717
+ "ghost-class": "page__ghost",
2718
+ "chosen-class": "page__chosen",
2719
+ "drag-class": "page__drag",
2720
+ handle: ".field__grip"
2721
+ }, {
2722
+ default: St(() => [
2723
+ (C(!0), D(Q, null, De(i.value, (B, j) => (C(), Se(pa, {
2724
+ key: B,
2725
+ "page-idx": e.pageIdx,
2726
+ "field-idx": j,
2727
+ "field-name": B
2728
+ }, null, 8, ["page-idx", "field-idx", "field-name"]))), 128))
2729
+ ]),
2730
+ _: 1
2731
+ }, 8, ["modelValue"]),
2732
+ i.value.length === 0 ? (C(), D("div", ga, [...k[6] || (k[6] = [
2733
+ p("co-icon", {
2734
+ name: "plus",
2735
+ size: "20"
2736
+ }, null, -1),
2737
+ p("span", null, "Drag a field here or click one in the toolbox", -1)
2738
+ ])])) : U("", !0)
2739
+ ], 32)
2740
+ ], 2)) : U("", !0);
2741
+ }
2742
+ }), ya = /* @__PURE__ */ Ie(ba, [["__scopeId", "data-v-c2fa3971"]]), _a = { class: "canvas__pages" }, Ca = /* @__PURE__ */ xe({
2743
+ __name: "FieldCanvas",
2744
+ setup(e) {
2745
+ const n = ze(), t = F(() => _l(n.resolvedTheme)), l = F(() => ({
2746
+ ...t.value.customProperties
2747
+ })), o = F(() => ({
2748
+ ...t.value.inlineStyles
2749
+ })), i = F(() => ({
2750
+ "data-theme": t.value.modifiers.colorScheme,
2751
+ "data-appearance": t.value.modifiers.appearance,
2752
+ "data-density": t.value.modifiers.density,
2753
+ "data-radius": t.value.modifiers.radius,
2754
+ ...t.value.modifiers.hideHeader ? { "data-hide-header": "" } : {}
2755
+ }));
2756
+ return (r, s) => (C(), D("div", {
2757
+ class: "canvas",
2758
+ style: $n(o.value)
2759
+ }, [
2760
+ p("div", dl({
2761
+ class: "canvas__inner",
2762
+ style: l.value
2763
+ }, i.value), [
2764
+ t.value.modifiers.hideHeader ? U("", !0) : (C(), D("header", {
2765
+ key: 0,
2766
+ class: Ee(["canvas__head", { "is-selected": b(n).selection.kind === "form" }]),
2767
+ onClick: s[2] || (s[2] = He((a) => b(n).selectForm(), ["stop"]))
2768
+ }, [
2769
+ x(et, {
2770
+ class: "canvas__title",
2771
+ "model-value": b(n).data.title,
2772
+ placeholder: "Untitled form",
2773
+ "onUpdate:modelValue": s[0] || (s[0] = (a) => b(n).setTitle(a))
2774
+ }, null, 8, ["model-value"]),
2775
+ x(et, {
2776
+ class: "canvas__desc",
2777
+ "model-value": b(n).data.description,
2778
+ placeholder: "Add a description (optional)",
2779
+ "onUpdate:modelValue": s[1] || (s[1] = (a) => b(n).setDescription(a))
2780
+ }, null, 8, ["model-value"])
2781
+ ], 2)),
2782
+ p("div", _a, [
2783
+ (C(!0), D(Q, null, De(b(n).data.pages, (a, g) => (C(), Se(ya, {
2784
+ key: b(n).data.pages[g].name + "-" + g,
2785
+ "page-idx": g
2786
+ }, null, 8, ["page-idx"]))), 128))
2787
+ ]),
2788
+ p("button", {
2789
+ class: "canvas__add-page",
2790
+ onClick: s[3] || (s[3] = (a) => b(n).addPage())
2791
+ }, [...s[4] || (s[4] = [
2792
+ p("co-icon", {
2793
+ name: "plus",
2794
+ size: "14"
2795
+ }, null, -1),
2796
+ p("span", null, "Add page", -1)
2797
+ ])])
2798
+ ], 16)
2799
+ ], 4));
2800
+ }
2801
+ }), Sa = /* @__PURE__ */ Ie(Ca, [["__scopeId", "data-v-c8380252"]]), xa = { class: "props" }, wa = { class: "props__head" }, ka = { class: "props__title" }, Ta = { class: "props__subtitle" }, Da = { class: "props__body" }, Ea = { class: "row" }, Ia = { class: "seg" }, Oa = { class: "row" }, Na = { class: "row__label" }, Aa = { class: "row" }, Pa = { class: "accent" }, $a = ["title", "onClick"], Fa = {
2802
+ key: 4,
2803
+ class: "row"
2804
+ }, Ma = ["value"], Ra = { class: "props__foot" }, Ba = { class: "props__body" }, ja = { class: "props__body" }, za = /* @__PURE__ */ xe({
2805
+ __name: "PropertiesPanel",
2806
+ setup(e) {
2807
+ const n = [
2808
+ { id: "general", label: "General", icon: "gear" },
2809
+ { id: "header", label: "Header", icon: "image" },
2810
+ { id: "background", label: "Background", icon: "paint-bucket" },
2811
+ { id: "appearance", label: "Appearance", icon: "paint-brush" },
2812
+ { id: "advanced", label: "Advanced", icon: "code" }
2813
+ ], t = [
2814
+ { id: "general", label: "General", icon: "gear" },
2815
+ { id: "logic", label: "Logic", icon: "git-branch" }
2816
+ ], l = [
2817
+ { id: "layout", label: "Layout", icon: "layout" },
2818
+ { id: "logic", label: "Logic", icon: "git-branch" },
2819
+ { id: "validation", label: "Validation", icon: "shield-check" }
2820
+ ], o = [
2821
+ { label: "Panels (default)", value: "panels" },
2822
+ { label: "Without panels", value: "flat" }
2823
+ ], i = [
2824
+ { label: "Comfortable", value: "comfortable" },
2825
+ { label: "Compact", value: "compact" }
2826
+ ], r = [
2827
+ { label: "Rounded", value: "rounded" },
2828
+ { label: "Sharp", value: "sharp" }
2829
+ ], s = [
2830
+ { label: "Auto", value: "auto" },
2831
+ { label: "Contain", value: "contain" },
2832
+ { label: "Cover", value: "cover" }
2833
+ ], a = [
2834
+ { label: "Scroll", value: "scroll" },
2835
+ { label: "Fixed", value: "fixed" }
2836
+ ], g = [
2837
+ { label: "(none)", value: "" },
2838
+ { label: "email", value: "email" },
2839
+ { label: "url", value: "url" },
2840
+ { label: "uuid", value: "uuid" }
2841
+ ], u = [
2842
+ { id: "azul", label: "Azul", hex: gt.azul },
2843
+ { id: "verde", label: "Verde", hex: gt.verde },
2844
+ { id: "amarillo", label: "Amarillo", hex: gt.amarillo },
2845
+ { id: "rosado", label: "Rosado", hex: gt.rosado }
2846
+ ], d = ze(), T = F(() => d.selection.kind), w = F(() => d.currentPage), y = F(() => d.selectedField || {}), k = F(() => d.selection.fieldName ?? ""), B = de("general"), j = de("general"), te = de("layout");
2847
+ Ke(T, (N) => {
2848
+ N === "form" ? B.value = "general" : N === "page" ? j.value = "general" : N === "field" && (te.value = "layout");
2849
+ });
2850
+ const z = F(() => d.data.theme), X = F(() => d.resolvedTheme);
2851
+ function O(N) {
2852
+ const c = N.detail;
2853
+ return c != null && typeof c == "object" && "value" in c ? c.value : c != null && typeof c == "object" && "checked" in c ? c.checked : c;
2854
+ }
2855
+ function se(N) {
2856
+ if (N === "" || N == null) return;
2857
+ const c = Number(N);
2858
+ return Number.isFinite(c) ? c : void 0;
2859
+ }
2860
+ function J(N, c) {
2861
+ d.updateField(d.selection.pageIdx, k.value, { [N]: c });
2862
+ }
2863
+ function ue(N, c) {
2864
+ d.updatePage(d.selection.pageIdx, { [N]: c });
2865
+ }
2866
+ function G(N, c) {
2867
+ d.setTheme({ [N]: c });
2868
+ }
2869
+ function E(N, c, m) {
2870
+ d.setThemeSection(N, { [c]: m });
2871
+ }
2872
+ function L(N) {
2873
+ G("accent", N);
2874
+ }
2875
+ function Y(N) {
2876
+ const c = N.trim();
2877
+ /^#[0-9a-fA-F]{3,8}$/.test(c) && d.setTheme({ accent: "custom", accentHex: c });
2878
+ }
2879
+ const le = F(() => T.value === "form" ? "Form" : T.value === "page" ? "Page" : "Field"), H = F(() => T.value === "form" ? d.data.title || "Untitled form" : T.value === "page" ? w.value?.name ?? "" : k.value);
2880
+ return (N, c) => (C(), D("div", xa, [
2881
+ p("header", wa, [
2882
+ p("div", ka, ce(le.value), 1),
2883
+ p("div", Ta, ce(H.value), 1)
2884
+ ]),
2885
+ T.value === "form" ? (C(), D(Q, { key: 0 }, [
2886
+ x(b(jt), {
2887
+ class: "props__tabs",
2888
+ value: B.value,
2889
+ onCoTabChange: c[0] || (c[0] = (m) => B.value = O(m) || B.value)
2890
+ }, {
2891
+ default: St(() => [
2892
+ (C(), D(Q, null, De(n, (m) => x(b(zt), {
2893
+ key: m.id,
2894
+ label: m.label,
2895
+ value: m.id,
2896
+ "icon-left": m.icon,
2897
+ size: "small"
2898
+ }, null, 8, ["label", "value", "icon-left"])), 64))
2899
+ ]),
2900
+ _: 1
2901
+ }, 8, ["value"]),
2902
+ p("div", Da, [
2903
+ B.value === "general" ? (C(), D(Q, { key: 0 }, [
2904
+ p("div", Ea, [
2905
+ c[39] || (c[39] = p("div", { class: "row__label" }, "Color scheme", -1)),
2906
+ p("div", Ia, [
2907
+ p("button", {
2908
+ class: Ee(["seg__btn", { "is-active": X.value.colorScheme === "light" }]),
2909
+ onClick: c[1] || (c[1] = (m) => G("colorScheme", "light"))
2910
+ }, [...c[37] || (c[37] = [
2911
+ p("co-icon", {
2912
+ name: "sun",
2913
+ size: "14"
2914
+ }, null, -1),
2915
+ p("span", null, "Light", -1)
2916
+ ])], 2),
2917
+ p("button", {
2918
+ class: Ee(["seg__btn", { "is-active": X.value.colorScheme === "dark" }]),
2919
+ onClick: c[2] || (c[2] = (m) => G("colorScheme", "dark"))
2920
+ }, [...c[38] || (c[38] = [
2921
+ p("co-icon", {
2922
+ name: "moon",
2923
+ size: "14"
2924
+ }, null, -1),
2925
+ p("span", null, "Dark", -1)
2926
+ ])], 2)
2927
+ ])
2928
+ ]),
2929
+ x(b(Ue), {
2930
+ label: "Question appearance",
2931
+ options: JSON.stringify(o),
2932
+ value: X.value.questionAppearance,
2933
+ onCoChange: c[3] || (c[3] = (m) => G("questionAppearance", O(m)))
2934
+ }, null, 8, ["options", "value"]),
2935
+ x(b(Ue), {
2936
+ label: "Density",
2937
+ options: JSON.stringify(i),
2938
+ value: X.value.density,
2939
+ onCoChange: c[4] || (c[4] = (m) => G("density", O(m)))
2940
+ }, null, 8, ["options", "value"]),
2941
+ x(b(Ue), {
2942
+ label: "Border radius",
2943
+ options: JSON.stringify(r),
2944
+ value: X.value.borderRadius,
2945
+ onCoChange: c[5] || (c[5] = (m) => G("borderRadius", O(m)))
2946
+ }, null, 8, ["options", "value"])
2947
+ ], 64)) : U("", !0),
2948
+ B.value === "header" ? (C(), D(Q, { key: 1 }, [
2949
+ x(b(it), {
2950
+ label: "Show header",
2951
+ checked: X.value.header.show,
2952
+ onCoChange: c[6] || (c[6] = (m) => E("header", "show", O(m)))
2953
+ }, null, 8, ["checked"]),
2954
+ x(b(W), {
2955
+ label: "Background color",
2956
+ placeholder: "#fff or rgb(...)",
2957
+ value: z.value.header?.backgroundColor || "",
2958
+ onCoInput: c[7] || (c[7] = (m) => E("header", "backgroundColor", O(m) || null))
2959
+ }, null, 8, ["value"]),
2960
+ x(b(W), {
2961
+ label: "Height",
2962
+ placeholder: "120px",
2963
+ "helper-text": "Any CSS length. Leave empty for auto.",
2964
+ value: z.value.header?.height || "",
2965
+ onCoInput: c[8] || (c[8] = (m) => E("header", "height", O(m) || null))
2966
+ }, null, 8, ["value"])
2967
+ ], 64)) : U("", !0),
2968
+ B.value === "background" ? (C(), D(Q, { key: 2 }, [
2969
+ x(b(W), {
2970
+ label: "Background color",
2971
+ placeholder: "#F3F3F3",
2972
+ value: z.value.background?.color || "",
2973
+ onCoInput: c[9] || (c[9] = (m) => E("background", "color", O(m) || null))
2974
+ }, null, 8, ["value"]),
2975
+ x(b(W), {
2976
+ label: "Background image URL",
2977
+ placeholder: "https://…",
2978
+ value: z.value.background?.imageUrl || "",
2979
+ onCoInput: c[10] || (c[10] = (m) => E("background", "imageUrl", O(m) || null))
2980
+ }, null, 8, ["value"]),
2981
+ x(b(Ue), {
2982
+ label: "Image size",
2983
+ options: JSON.stringify(s),
2984
+ value: X.value.background.imageSize,
2985
+ onCoChange: c[11] || (c[11] = (m) => E("background", "imageSize", O(m)))
2986
+ }, null, 8, ["options", "value"]),
2987
+ x(b(Ue), {
2988
+ label: "Image attachment",
2989
+ options: JSON.stringify(a),
2990
+ value: X.value.background.imageAttachment,
2991
+ onCoChange: c[12] || (c[12] = (m) => E("background", "imageAttachment", O(m)))
2992
+ }, null, 8, ["options", "value"]),
2993
+ p("div", Oa, [
2994
+ p("div", Na, "Opacity (" + ce(X.value.background.opacity) + "%)", 1),
2995
+ x(b(Mn), {
2996
+ min: 0,
2997
+ max: 100,
2998
+ step: 5,
2999
+ value: X.value.background.opacity,
3000
+ "show-value": "",
3001
+ onCoChange: c[13] || (c[13] = (m) => E("background", "opacity", O(m)))
3002
+ }, null, 8, ["value"])
3003
+ ])
3004
+ ], 64)) : U("", !0),
3005
+ B.value === "appearance" ? (C(), D(Q, { key: 3 }, [
3006
+ p("div", Aa, [
3007
+ c[41] || (c[41] = p("div", { class: "row__label" }, "Accent", -1)),
3008
+ p("div", Pa, [
3009
+ (C(), D(Q, null, De(u, (m) => p("button", {
3010
+ key: m.id,
3011
+ class: Ee(["accent__chip", { "is-active": X.value.accent === m.id }]),
3012
+ style: $n({ "--accent": m.hex }),
3013
+ title: m.label,
3014
+ onClick: (ge) => L(m.id)
3015
+ }, [
3016
+ c[40] || (c[40] = p("span", { class: "accent__chip-dot" }, null, -1)),
3017
+ p("span", null, ce(m.label), 1)
3018
+ ], 14, $a)), 64))
3019
+ ])
3020
+ ]),
3021
+ x(b(W), {
3022
+ label: "Custom accent (hex)",
3023
+ placeholder: "#2563EB",
3024
+ "helper-text": "Sets accent to Custom and overrides the primary.",
3025
+ value: X.value.accent === "custom" ? X.value.accentHex : "",
3026
+ onCoChange: c[14] || (c[14] = (m) => Y(O(m) ?? ""))
3027
+ }, null, 8, ["value"]),
3028
+ x(b(W), {
3029
+ label: "Font family",
3030
+ placeholder: "Inter, system-ui, sans-serif",
3031
+ "helper-text": "CSS font stack. Empty = Geist (Cobalt default).",
3032
+ value: z.value.fontFamily || "",
3033
+ onCoInput: c[15] || (c[15] = (m) => G("fontFamily", O(m) || void 0))
3034
+ }, null, 8, ["value"])
3035
+ ], 64)) : U("", !0),
3036
+ B.value === "advanced" ? (C(), D("div", Fa, [
3037
+ c[42] || (c[42] = p("div", { class: "row__label" }, "Custom CSS", -1)),
3038
+ p("textarea", {
3039
+ class: "codebox",
3040
+ spellcheck: "false",
3041
+ rows: "14",
3042
+ placeholder: '.co-form-wizard [data-co-field="email"] co-input { ... }',
3043
+ value: z.value.customCss || "",
3044
+ onInput: c[16] || (c[16] = (m) => G("customCss", m.target.value || void 0))
3045
+ }, null, 40, Ma),
3046
+ c[43] || (c[43] = p("p", { class: "props__hint" }, [
3047
+ Ye(" Injected scoped to the form. Target fields via "),
3048
+ p("code", null, '[data-co-field="name"]'),
3049
+ Ye(" or "),
3050
+ p("code", null, '[data-co-field-kind="select"]'),
3051
+ Ye(". "),
3052
+ p("code", null, "@import"),
3053
+ Ye(", inline scripts and "),
3054
+ p("code", null, "</style>"),
3055
+ Ye(" are stripped. ")
3056
+ ], -1))
3057
+ ])) : U("", !0)
3058
+ ]),
3059
+ p("footer", Ra, [
3060
+ x(b(It), {
3061
+ label: "Reset theme",
3062
+ variant: "stroke",
3063
+ size: "s",
3064
+ "icon-left": "arrow-counter-clockwise",
3065
+ onClick: b(d).resetTheme
3066
+ }, null, 8, ["onClick"])
3067
+ ])
3068
+ ], 64)) : T.value === "page" ? (C(), D(Q, { key: 1 }, [
3069
+ x(b(jt), {
3070
+ class: "props__tabs",
3071
+ value: j.value,
3072
+ onCoTabChange: c[17] || (c[17] = (m) => j.value = O(m) || j.value)
3073
+ }, {
3074
+ default: St(() => [
3075
+ (C(), D(Q, null, De(t, (m) => x(b(zt), {
3076
+ key: m.id,
3077
+ label: m.label,
3078
+ value: m.id,
3079
+ "icon-left": m.icon,
3080
+ size: "small"
3081
+ }, null, 8, ["label", "value", "icon-left"])), 64))
3082
+ ]),
3083
+ _: 1
3084
+ }, 8, ["value"]),
3085
+ p("div", Ba, [
3086
+ j.value === "general" ? (C(), D(Q, { key: 0 }, [
3087
+ x(b(W), {
3088
+ label: "Name (id)",
3089
+ value: w.value.name,
3090
+ "helper-text": "Used as the page key in the schema.",
3091
+ onCoInput: c[18] || (c[18] = (m) => ue("name", O(m)))
3092
+ }, null, 8, ["value"]),
3093
+ x(b(W), {
3094
+ label: "Title",
3095
+ value: w.value.title || "",
3096
+ "helper-text": "Also editable inline on the canvas.",
3097
+ onCoInput: c[19] || (c[19] = (m) => ue("title", O(m)))
3098
+ }, null, 8, ["value"]),
3099
+ x(b(it), {
3100
+ label: "Show title in form",
3101
+ checked: !w.value.hideTitle,
3102
+ onCoChange: c[20] || (c[20] = (m) => ue("hideTitle", O(m) ? void 0 : !0))
3103
+ }, null, 8, ["checked"]),
3104
+ x(b(W), {
3105
+ label: "Description",
3106
+ multiline: "",
3107
+ value: w.value.description || "",
3108
+ onCoInput: c[21] || (c[21] = (m) => ue("description", O(m)))
3109
+ }, null, 8, ["value"]),
3110
+ x(b(it), {
3111
+ label: "Show description in form",
3112
+ checked: !w.value.hideDescription,
3113
+ onCoChange: c[22] || (c[22] = (m) => ue("hideDescription", O(m) ? void 0 : !0))
3114
+ }, null, 8, ["checked"])
3115
+ ], 64)) : U("", !0),
3116
+ j.value === "logic" ? (C(), Se(b(W), {
3117
+ key: 1,
3118
+ label: "visibleIf",
3119
+ placeholder: "{customerType} == 'premium'",
3120
+ "helper-text": "Page hidden unless expression is truthy.",
3121
+ value: w.value.visibleIf || "",
3122
+ onCoInput: c[23] || (c[23] = (m) => ue("visibleIf", O(m) || void 0))
3123
+ }, null, 8, ["value"])) : U("", !0)
3124
+ ])
3125
+ ], 64)) : (C(), D(Q, { key: 2 }, [
3126
+ x(b(jt), {
3127
+ class: "props__tabs",
3128
+ value: te.value,
3129
+ onCoTabChange: c[24] || (c[24] = (m) => te.value = O(m) || te.value)
3130
+ }, {
3131
+ default: St(() => [
3132
+ (C(), D(Q, null, De(l, (m) => x(b(zt), {
3133
+ key: m.id,
3134
+ label: m.label,
3135
+ value: m.id,
3136
+ "icon-left": m.icon,
3137
+ size: "small"
3138
+ }, null, 8, ["label", "value", "icon-left"])), 64))
3139
+ ]),
3140
+ _: 1
3141
+ }, 8, ["value"]),
3142
+ p("div", ja, [
3143
+ te.value === "layout" ? (C(), D(Q, { key: 0 }, [
3144
+ x(b(ht), {
3145
+ label: "Full width (span all columns)",
3146
+ checked: !!y.value.full,
3147
+ onCoChange: c[25] || (c[25] = (m) => J("full", O(m)))
3148
+ }, null, 8, ["checked"]),
3149
+ x(b(ht), {
3150
+ label: "Hidden",
3151
+ checked: !!y.value.hidden,
3152
+ onCoChange: c[26] || (c[26] = (m) => J("hidden", O(m)))
3153
+ }, null, 8, ["checked"]),
3154
+ x(b(ht), {
3155
+ label: "Disabled",
3156
+ checked: !!y.value.disabled || !!y.value.readOnly,
3157
+ onCoChange: c[27] || (c[27] = (m) => J("disabled", O(m) || void 0))
3158
+ }, null, 8, ["checked"]),
3159
+ y.value.type === "String" ? (C(), Se(b(Ue), {
3160
+ key: 0,
3161
+ label: "Format",
3162
+ options: JSON.stringify(g),
3163
+ value: y.value.format || "",
3164
+ onCoChange: c[28] || (c[28] = (m) => J("format", O(m) || void 0))
3165
+ }, null, 8, ["options", "value"])) : U("", !0)
3166
+ ], 64)) : U("", !0),
3167
+ te.value === "logic" ? (C(), D(Q, { key: 1 }, [
3168
+ x(b(W), {
3169
+ label: "visibleIf",
3170
+ placeholder: "{type} == 'premium'",
3171
+ value: y.value.visibleIf || "",
3172
+ onCoInput: c[29] || (c[29] = (m) => J("visibleIf", O(m) || void 0))
3173
+ }, null, 8, ["value"]),
3174
+ x(b(W), {
3175
+ label: "enableIf",
3176
+ placeholder: "{accepted} == true",
3177
+ value: y.value.enableIf || "",
3178
+ onCoInput: c[30] || (c[30] = (m) => J("enableIf", O(m) || void 0))
3179
+ }, null, 8, ["value"]),
3180
+ x(b(W), {
3181
+ label: "requiredIf",
3182
+ placeholder: "{country} == 'US'",
3183
+ value: y.value.requiredIf || "",
3184
+ onCoInput: c[31] || (c[31] = (m) => J("requiredIf", O(m) || void 0))
3185
+ }, null, 8, ["value"]),
3186
+ c[44] || (c[44] = p("p", { class: "props__hint" }, [
3187
+ Ye(" Operators: "),
3188
+ p("code", null, "== != > < >= <= contains && ||")
3189
+ ], -1))
3190
+ ], 64)) : U("", !0),
3191
+ te.value === "validation" ? (C(), D(Q, { key: 2 }, [
3192
+ x(b(ht), {
3193
+ label: "Required",
3194
+ checked: !!y.value.required,
3195
+ onCoChange: c[32] || (c[32] = (m) => J("required", O(m)))
3196
+ }, null, 8, ["checked"]),
3197
+ y.value.type === "String" ? (C(), Se(b(W), {
3198
+ key: 0,
3199
+ label: "Min length",
3200
+ type: "number",
3201
+ value: y.value.minLength ?? "",
3202
+ onCoInput: c[33] || (c[33] = (m) => J("minLength", se(O(m))))
3203
+ }, null, 8, ["value"])) : U("", !0),
3204
+ y.value.type === "String" ? (C(), Se(b(W), {
3205
+ key: 1,
3206
+ label: "Max length",
3207
+ type: "number",
3208
+ value: y.value.maxLength ?? "",
3209
+ onCoInput: c[34] || (c[34] = (m) => J("maxLength", se(O(m))))
3210
+ }, null, 8, ["value"])) : U("", !0),
3211
+ y.value.type === "Number" ? (C(), Se(b(W), {
3212
+ key: 2,
3213
+ label: "Min",
3214
+ type: "number",
3215
+ value: y.value.min ?? "",
3216
+ onCoInput: c[35] || (c[35] = (m) => J("min", se(O(m))))
3217
+ }, null, 8, ["value"])) : U("", !0),
3218
+ y.value.type === "Number" ? (C(), Se(b(W), {
3219
+ key: 3,
3220
+ label: "Max",
3221
+ type: "number",
3222
+ value: y.value.max ?? "",
3223
+ onCoInput: c[36] || (c[36] = (m) => J("max", se(O(m))))
3224
+ }, null, 8, ["value"])) : U("", !0)
3225
+ ], 64)) : U("", !0)
3226
+ ])
3227
+ ], 64))
3228
+ ]));
3229
+ }
3230
+ }), La = /* @__PURE__ */ Ie(za, [["__scopeId", "data-v-eefaf8de"]]), Va = { class: "designer" }, Ya = { class: "designer__panel designer__panel--left" }, Ua = { class: "designer__canvas" }, Xa = { class: "designer__panel designer__panel--right" }, Ha = /* @__PURE__ */ xe({
3231
+ __name: "DesignerTab",
3232
+ setup(e) {
3233
+ return (n, t) => (C(), D("div", Va, [
3234
+ p("aside", Ya, [
3235
+ x(Al)
3236
+ ]),
3237
+ p("section", Ua, [
3238
+ x(Sa)
3239
+ ]),
3240
+ p("aside", Xa, [
3241
+ x(La)
3242
+ ])
3243
+ ]));
3244
+ }
3245
+ }), qa = /* @__PURE__ */ Ie(Ha, [["__scopeId", "data-v-d8b2c553"]]), Ja = { class: "json-tab" }, Wa = { class: "json-tab__bar" }, Ga = {
3246
+ key: 0,
3247
+ class: "json-tab__err"
3248
+ }, Za = /* @__PURE__ */ xe({
3249
+ __name: "JsonTab",
3250
+ setup(e) {
3251
+ const n = ze(), t = de(""), l = de(null), o = F(() => JSON.stringify(n.exported, null, 2));
3252
+ Ke(o, (s) => t.value = s, { immediate: !0 });
3253
+ function i() {
3254
+ try {
3255
+ const s = JSON.parse(t.value);
3256
+ if (!s || typeof s != "object")
3257
+ throw new Error("Schema must be a JSON object");
3258
+ n.replaceAll(s), l.value = null;
3259
+ } catch (s) {
3260
+ l.value = s.message;
3261
+ }
3262
+ }
3263
+ function r() {
3264
+ t.value = o.value, l.value = null;
3265
+ }
3266
+ return (s, a) => (C(), D("div", Ja, [
3267
+ p("div", Wa, [
3268
+ x(b(It), {
3269
+ label: "Apply",
3270
+ variant: "primary",
3271
+ size: "s",
3272
+ onClick: i
3273
+ }),
3274
+ x(b(It), {
3275
+ label: "Discard",
3276
+ variant: "stroke",
3277
+ size: "s",
3278
+ onClick: r
3279
+ }),
3280
+ l.value ? (C(), D("span", Ga, ce(l.value), 1)) : U("", !0),
3281
+ a[1] || (a[1] = p("span", { class: "json-tab__hint" }, " Plain editor — Monaco integration is a follow-up. ", -1))
3282
+ ]),
3283
+ Fn(p("textarea", {
3284
+ "onUpdate:modelValue": a[0] || (a[0] = (g) => t.value = g),
3285
+ class: "json-tab__area",
3286
+ spellcheck: "false"
3287
+ }, null, 512), [
3288
+ [cl, t.value]
3289
+ ])
3290
+ ]));
3291
+ }
3292
+ }), Qa = /* @__PURE__ */ Ie(Za, [["__scopeId", "data-v-6f8a102d"]]), Ka = { class: "preview" }, ei = { class: "preview__pane preview__pane--form" }, ti = ["schema", "theme"], ni = ["schema", "theme"], li = { class: "preview__pane preview__pane--side" }, oi = {
3293
+ key: 0,
3294
+ class: "preview__json"
3295
+ }, ai = {
3296
+ key: 1,
3297
+ class: "preview__empty"
3298
+ }, ii = /* @__PURE__ */ xe({
3299
+ __name: "PreviewTab",
3300
+ setup(e) {
3301
+ const n = ze(), t = F(() => n.exported), l = F(() => Qt(t.value)), o = F(() => JSON.stringify(t.value)), i = F(() => {
3302
+ const a = Object.keys(n.data.theme).length > 0 ? JSON.stringify(n.data.theme) : void 0;
3303
+ return console.log("[PreviewTab] themeJson →", a, "rawTheme:", n.data.theme, "isPaged:", l.value), a;
3304
+ }), r = de(null);
3305
+ function s(a) {
3306
+ const g = a.detail;
3307
+ r.value = g?.values ?? null;
3308
+ }
3309
+ return (a, g) => (C(), D("div", Ka, [
3310
+ p("div", ei, [
3311
+ l.value ? (C(), D("co-form-wizard", {
3312
+ key: o.value + (i.value ?? ""),
3313
+ schema: o.value,
3314
+ theme: i.value,
3315
+ layout: "grid",
3316
+ columns: "1",
3317
+ "on:coSubmit": s
3318
+ }, null, 40, ti)) : (C(), D("co-form", {
3319
+ key: o.value + (i.value ?? ""),
3320
+ schema: o.value,
3321
+ theme: i.value,
3322
+ layout: "grid",
3323
+ columns: "2",
3324
+ "on:coSubmit": s
3325
+ }, null, 40, ni))
3326
+ ]),
3327
+ p("aside", li, [
3328
+ g[0] || (g[0] = p("div", { class: "preview__pane-head" }, [
3329
+ p("h3", { class: "preview__title" }, "Last submit"),
3330
+ p("p", { class: "preview__desc" }, "Fill the form and press Submit to see the payload.")
3331
+ ], -1)),
3332
+ r.value ? (C(), D("pre", oi, ce(JSON.stringify(r.value, null, 2)), 1)) : (C(), D("div", ai, "No submissions yet."))
3333
+ ])
3334
+ ]));
3335
+ }
3336
+ }), ri = /* @__PURE__ */ Ie(ii, [["__scopeId", "data-v-275d3bfc"]]), si = { class: "shell" }, ui = { class: "shell__topbar" }, di = {
3337
+ key: 0,
3338
+ class: "shell__brand"
3339
+ }, ci = { class: "shell__brand-title" }, pi = { class: "shell__tabs" }, fi = ["onClick"], vi = { class: "shell__actions" }, mi = { class: "shell__content" }, hi = /* @__PURE__ */ xe({
3340
+ __name: "CobaltFormBuilder",
3341
+ props: {
3342
+ modelValue: { default: () => ({}) },
3343
+ tabs: { default: () => ["designer", "preview", "json"] },
3344
+ hideBrand: { type: Boolean, default: !1 },
3345
+ brandLabel: { default: "Cobalt Form Builder" },
3346
+ skipCobaltRegister: { type: Boolean, default: !1 }
3347
+ },
3348
+ emits: ["update:modelValue", "event", "field-added", "field-removed", "field-renamed", "field-updated", "field-duplicated", "field-reordered", "page-added", "page-removed", "page-duplicated", "page-updated", "theme-changed", "selection-changed", "schema-replaced", "undo", "redo"],
3349
+ setup(e, { emit: n }) {
3350
+ const t = e, l = n, o = {
3351
+ designer: { label: "Designer" },
3352
+ preview: { label: "Preview" },
3353
+ json: { label: "JSON Editor" }
3354
+ }, i = F(
3355
+ () => t.tabs.map((u) => ({ id: u, label: o[u].label }))
3356
+ ), r = de(t.tabs[0] ?? "designer");
3357
+ let s = !1;
3358
+ const a = Sl({
3359
+ initialSchema: t.modelValue,
3360
+ onEvent: (u) => {
3361
+ l("event", u), l(u.type, u);
3362
+ }
3363
+ });
3364
+ pl(Rn, a), Ke(
3365
+ () => a.exported,
3366
+ (u) => {
3367
+ s || l("update:modelValue", u);
3368
+ },
3369
+ { deep: !0 }
3370
+ ), Ke(
3371
+ () => t.modelValue,
3372
+ (u) => {
3373
+ if (!u) return;
3374
+ const d = JSON.stringify(u), T = JSON.stringify(a.exported);
3375
+ d !== T && (s = !0, a.replaceAll(u), s = !1);
3376
+ },
3377
+ { deep: !0 }
3378
+ ), An(() => {
3379
+ t.skipCobaltRegister || (gl(), bl()), window.addEventListener("keydown", g);
3380
+ }), fl(() => {
3381
+ window.removeEventListener("keydown", g);
3382
+ });
3383
+ function g(u) {
3384
+ if (u.key === "Escape") {
3385
+ const T = u.target;
3386
+ if (T?.isContentEditable || T?.tagName === "INPUT" || T?.tagName === "TEXTAREA" || T?.tagName === "SELECT") {
3387
+ T.blur();
3388
+ return;
3389
+ }
3390
+ a.selection.fieldName !== null && a.selectPage(a.selection.pageIdx);
3391
+ return;
3392
+ }
3393
+ (u.metaKey || u.ctrlKey) && (u.key === "z" && !u.shiftKey ? (u.preventDefault(), a.undo()) : (u.key === "z" && u.shiftKey || u.key === "y") && (u.preventDefault(), a.redo()));
3394
+ }
3395
+ return (u, d) => (C(), D("div", si, [
3396
+ mt(u.$slots, "before", {}, void 0, !0),
3397
+ p("header", ui, [
3398
+ mt(u.$slots, "brand", {}, () => [
3399
+ e.hideBrand ? U("", !0) : (C(), D("div", di, [
3400
+ d[2] || (d[2] = p("div", { class: "shell__brand-mark" }, "CF", -1)),
3401
+ p("h1", ci, ce(e.brandLabel), 1)
3402
+ ]))
3403
+ ], !0),
3404
+ p("nav", pi, [
3405
+ (C(!0), D(Q, null, De(i.value, (T) => (C(), D("button", {
3406
+ key: T.id,
3407
+ class: Ee(["shell__tab", { "is-active": r.value === T.id }]),
3408
+ onClick: (w) => r.value = T.id
3409
+ }, ce(T.label), 11, fi))), 128))
3410
+ ]),
3411
+ p("div", vi, [
3412
+ mt(u.$slots, "actions", { store: b(a) }, () => [
3413
+ x(b(Et), {
3414
+ icon: "arrow-counter-clockwise",
3415
+ variant: "outlined",
3416
+ size: "sm",
3417
+ label: "Undo (⌘Z)",
3418
+ disabled: !b(a).canUndo,
3419
+ onClick: d[0] || (d[0] = (T) => b(a).undo())
3420
+ }, null, 8, ["disabled"]),
3421
+ x(b(Et), {
3422
+ icon: "arrow-clockwise",
3423
+ variant: "outlined",
3424
+ size: "sm",
3425
+ label: "Redo (⌘⇧Z)",
3426
+ disabled: !b(a).canRedo,
3427
+ onClick: d[1] || (d[1] = (T) => b(a).redo())
3428
+ }, null, 8, ["disabled"])
3429
+ ], !0)
3430
+ ])
3431
+ ]),
3432
+ p("main", mi, [
3433
+ Fn(x(qa, null, null, 512), [
3434
+ [vl, r.value === "designer"]
3435
+ ]),
3436
+ r.value === "preview" ? (C(), Se(ri, { key: 0 })) : U("", !0),
3437
+ r.value === "json" ? (C(), Se(Qa, { key: 1 })) : U("", !0)
3438
+ ]),
3439
+ mt(u.$slots, "after", { store: b(a) }, void 0, !0)
3440
+ ]));
3441
+ }
3442
+ }), Si = /* @__PURE__ */ Ie(hi, [["__scopeId", "data-v-d5541509"]]);
3443
+ export {
3444
+ Si as CobaltFormBuilder
3445
+ };
3446
+ //# sourceMappingURL=cobalt-form-builder.js.map