@tenorlab/vue-dashboard 1.0.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.
@@ -0,0 +1,1936 @@
1
+ import { reactive as ie, computed as p, readonly as fe, defineComponent as b, createElementBlock as C, openBlock as d, normalizeClass as g, createElementVNode as o, createStaticVNode as te, withModifiers as N, normalizeStyle as se, renderSlot as z, mergeProps as G, createBlock as K, withCtx as W, unref as f, toDisplayString as j, ref as R, onMounted as Ce, onUnmounted as ve, defineAsyncComponent as we, resolveComponent as xe, Suspense as ye, resolveDynamicComponent as ae, createCommentVNode as O, Fragment as U, renderList as F, createVNode as I, createTextVNode as re, withKeys as oe, watch as be } from "vue";
2
+ import { blankDashboardConfig as ee, ensureContainersSequence as _e, getDistinctCssClasses as E, ensureZoomScaleIsWithinRange as ke, parseContainerTitle as de, dashboardSettingsUtils as $e, getWidgetMetaFromCatalog as Ie } from "./core.es.js";
3
+ const De = (t) => {
4
+ const s = t.widgets.filter((i) => i.includes("WidgetContainer")).map((i) => Number(i.split("_")[1].replace("container", "")));
5
+ return `container${s.length > 0 ? Math.max(...s) + 1 : 1}`;
6
+ }, We = (t, s) => {
7
+ const e = De(t);
8
+ return `${s}_${e}`;
9
+ }, Be = (t) => {
10
+ const { dashboardConfig: s, widgetKey: e, parentWidgetKey: i, noDuplicatedWidgets: n } = t;
11
+ if (i) {
12
+ if (n && s.childWidgetsConfig.find(
13
+ (r) => r.parentWidgetKey === i && r.widgetKey === e
14
+ ))
15
+ return {
16
+ success: !1,
17
+ message: `DashboardStore: addWidget: Widget already added (${e})`,
18
+ updatedDashboardConfig: s
19
+ };
20
+ const a = [
21
+ ...s.childWidgetsConfig,
22
+ { parentWidgetKey: i, widgetKey: e }
23
+ // new entry
24
+ ];
25
+ return {
26
+ success: !0,
27
+ updatedDashboardConfig: {
28
+ ...s,
29
+ childWidgetsConfig: a
30
+ }
31
+ };
32
+ } else {
33
+ if (n && s.widgets.includes(e))
34
+ return {
35
+ success: !1,
36
+ message: `DashboardStore: addWidget: Widget already added (${e})`,
37
+ updatedDashboardConfig: s
38
+ };
39
+ const a = [...s.widgets, e];
40
+ return {
41
+ success: !0,
42
+ updatedDashboardConfig: {
43
+ ...s,
44
+ widgets: a
45
+ }
46
+ };
47
+ }
48
+ }, Ke = (t, s, e) => {
49
+ if ((e || "").trim().length > 0) {
50
+ const i = t.childWidgetsConfig.filter(
51
+ (c) => c.parentWidgetKey !== e
52
+ ), n = t.childWidgetsConfig.filter(
53
+ (c) => c.parentWidgetKey === e && c.widgetKey !== s
54
+ ), a = [...i, ...n];
55
+ let r = {
56
+ ...t,
57
+ childWidgetsConfig: a
58
+ };
59
+ return `${s}`.includes("Container") && (r = _e(r)), {
60
+ success: !0,
61
+ updatedDashboardConfig: r
62
+ };
63
+ } else {
64
+ const i = t.widgets.filter((a) => a !== s), n = t.childWidgetsConfig.filter(
65
+ (a) => a.parentWidgetKey !== s
66
+ );
67
+ return {
68
+ success: !0,
69
+ updatedDashboardConfig: {
70
+ ...t,
71
+ widgets: i,
72
+ childWidgetsConfig: n
73
+ }
74
+ };
75
+ }
76
+ }, Me = (t, s, e, i) => {
77
+ if ((i || "").trim().length > 0) {
78
+ const n = t.childWidgetsConfig.filter(
79
+ (h) => h.parentWidgetKey !== i
80
+ );
81
+ let a = t.childWidgetsConfig.filter(
82
+ (h) => h.parentWidgetKey === i
83
+ );
84
+ const r = a.indexOf(e);
85
+ let w = r + s;
86
+ if (w = Math.max(0, w), w = Math.min(a.length - 1, w), w === r)
87
+ return {
88
+ success: !1,
89
+ message: `DashboardStore: moveWidget: Widget already at min/max position (${e})`,
90
+ updatedDashboardConfig: t
91
+ };
92
+ const c = [...a], [u] = c.splice(r, 1);
93
+ return c.splice(w, 0, u), {
94
+ success: !0,
95
+ updatedDashboardConfig: {
96
+ ...t,
97
+ childWidgetsConfig: [...n, ...c]
98
+ }
99
+ };
100
+ } else {
101
+ const n = t.widgets || [], a = n.indexOf(e);
102
+ let r = a + s;
103
+ if (r = Math.max(0, r), r = Math.min(n.length - 1, r), r === a)
104
+ return {
105
+ success: !1,
106
+ message: `DashboardStore: moveWidget: Widget already at min/max position (${e})`,
107
+ updatedDashboardConfig: t
108
+ };
109
+ const w = [...n], [c] = w.splice(a, 1);
110
+ return w.splice(r, 0, c), {
111
+ success: !0,
112
+ updatedDashboardConfig: {
113
+ ...t,
114
+ widgets: w
115
+ }
116
+ };
117
+ }
118
+ }, Se = () => ({
119
+ isLoading: !1,
120
+ // Start uninitialized/not loading
121
+ isEditing: !1,
122
+ allDashboardConfigs: [ee],
123
+ currentDashboardConfig: ee
124
+ }), y = ie(Se()), S = {
125
+ setIsLoading: (t) => y.isLoading = t,
126
+ setIsEditing: (t) => y.isEditing = t,
127
+ setTargetContainerKey: (t) => y.targetContainerKey = t,
128
+ setAllDashboardConfigs: (t) => y.allDashboardConfigs = t,
129
+ setCurrentDashboardConfig: (t) => {
130
+ const s = [
131
+ ...y.allDashboardConfigs.filter((e) => e.dashboardId !== t.dashboardId),
132
+ t
133
+ ];
134
+ return y.allDashboardConfigs = s, y.currentDashboardConfig = t, s;
135
+ },
136
+ addDashboardConfig: (t) => {
137
+ const s = [
138
+ ...y.allDashboardConfigs.filter((e) => e.dashboardId !== t.dashboardId),
139
+ t
140
+ ];
141
+ return y.allDashboardConfigs = s, y.currentDashboardConfig = t, s;
142
+ },
143
+ deleteDashboardConfigById: (t) => {
144
+ const s = [...y.allDashboardConfigs.filter((e) => e.dashboardId !== t)];
145
+ return y.allDashboardConfigs = s, y.currentDashboardConfig = s[0] || ee, s;
146
+ },
147
+ selectDashboardById: (t) => {
148
+ const s = y.allDashboardConfigs.find((e) => e.dashboardId === t);
149
+ return s && (y.currentDashboardConfig = s), s;
150
+ },
151
+ addWidget: (t) => {
152
+ const s = Be({
153
+ dashboardConfig: y.currentDashboardConfig,
154
+ ...t
155
+ }), e = [
156
+ ...y.allDashboardConfigs.filter(
157
+ (i) => i.dashboardId !== s.updatedDashboardConfig.dashboardId
158
+ ),
159
+ s.updatedDashboardConfig
160
+ ];
161
+ return s.success && (y.allDashboardConfigs = e, y.currentDashboardConfig = s.updatedDashboardConfig), {
162
+ ...s,
163
+ allUpdatedDashboardConfigs: e
164
+ };
165
+ },
166
+ removeWidget: (t, s) => {
167
+ const e = Ke(y.currentDashboardConfig, t, s), i = [
168
+ ...y.allDashboardConfigs.filter(
169
+ (n) => n.dashboardId !== e.updatedDashboardConfig.dashboardId
170
+ ),
171
+ e.updatedDashboardConfig
172
+ ];
173
+ return e.success && (y.allDashboardConfigs = i, y.currentDashboardConfig = e.updatedDashboardConfig), {
174
+ ...e,
175
+ allUpdatedDashboardConfigs: i
176
+ };
177
+ },
178
+ moveWidget: (t, s, e) => {
179
+ const i = Me(y.currentDashboardConfig, t, s, e), n = [
180
+ ...y.allDashboardConfigs.filter(
181
+ (a) => a.dashboardId !== i.updatedDashboardConfig.dashboardId
182
+ ),
183
+ i.updatedDashboardConfig
184
+ ];
185
+ return i.success && (y.allDashboardConfigs = n, y.currentDashboardConfig = i.updatedDashboardConfig), {
186
+ ...i,
187
+ allUpdatedDashboardConfigs: n
188
+ };
189
+ }
190
+ }, ne = {
191
+ setIsLoading: (t) => S.setIsLoading(t),
192
+ setIsEditing: (t) => (t || S.setTargetContainerKey(void 0), S.setIsEditing(t), t),
193
+ setTargetContainerKey: (t) => S.setTargetContainerKey(t),
194
+ setAllDashboardConfigs: (t) => S.setAllDashboardConfigs(t),
195
+ setCurrentDashboardConfig: (t) => S.setCurrentDashboardConfig(t),
196
+ addDashboardConfig: (t) => S.addDashboardConfig(t),
197
+ deleteDashboardConfigById: (t) => S.deleteDashboardConfigById(t),
198
+ selectDashboardById: (t) => S.selectDashboardById(t),
199
+ addWidget: (t) => S.addWidget(t),
200
+ removeWidget: (t, s) => S.removeWidget(t, s),
201
+ moveWidget: (t, s, e) => S.moveWidget(t, s, e)
202
+ }, Ee = {
203
+ getNextContainerKey: (t) => We(y.currentDashboardConfig, t),
204
+ getCurrentDashboardConfig: () => y.currentDashboardConfig,
205
+ getCurrentDashboardId: () => y.currentDashboardConfig.dashboardId,
206
+ getIsResponsive: () => y.currentDashboardConfig.responsiveGrid || !1,
207
+ getTargetContainerKey: () => y.targetContainerKey
208
+ }, Le = {
209
+ isLoading: p(() => y.isLoading),
210
+ isEditing: p(() => y.isEditing),
211
+ targetContainerKey: p(() => y.targetContainerKey),
212
+ currentDashboardConfig: p(() => y.currentDashboardConfig),
213
+ allDashboardConfigs: p(() => y.allDashboardConfigs.sort((t, s) => {
214
+ const e = t.dashboardId === "default", i = s.dashboardId === "default";
215
+ return e && !i ? -1 : i && !e ? 1 : t.dashboardId.localeCompare(s.dashboardId);
216
+ }))
217
+ }, Ne = {
218
+ ...ne,
219
+ actions: ne,
220
+ getters: Ee,
221
+ computed: Le
222
+ }, Ot = () => Ne, M = ie({
223
+ currentDashboardId: "",
224
+ undoHistory: {},
225
+ historyIndex: {}
226
+ }), q = (t) => M.undoHistory[t] || [], Z = (t) => M.historyIndex[t] ?? -1, X = (t, s) => {
227
+ M.historyIndex[t] = s;
228
+ }, Te = (t) => {
229
+ const s = t.dashboardId;
230
+ if (M.currentDashboardId !== s) {
231
+ M.currentDashboardId = s;
232
+ const e = {
233
+ undoIndex: 0,
234
+ config: t
235
+ };
236
+ X(s, 0), M.undoHistory[s] = [e];
237
+ }
238
+ }, je = (t) => {
239
+ const s = t.dashboardId, e = q(s), i = Z(s), n = e.slice(0, i + 1), a = {
240
+ undoIndex: n.length,
241
+ config: t
242
+ }, r = [...n, a];
243
+ M.undoHistory[s] = r, X(s, r.length - 1);
244
+ }, ze = (t) => {
245
+ delete M.undoHistory[t], delete M.historyIndex[t];
246
+ }, Ae = (t) => {
247
+ const s = q(t), e = Z(t), i = Math.max(0, e - 1);
248
+ if (i !== e)
249
+ return X(t, i), s[i]?.config;
250
+ }, He = (t) => {
251
+ const s = q(t), e = s.length, i = Z(t), n = Math.min(e - 1, i + 1);
252
+ if (n !== i)
253
+ return X(t, n), s[n]?.config;
254
+ }, le = () => {
255
+ const t = M.currentDashboardId || "", s = Z(t), e = q(t).length, i = s <= 0, n = s >= e - 1;
256
+ return {
257
+ isUndoDisabled: i,
258
+ isRedoDisabled: n,
259
+ // Optional debugging fields
260
+ _currentIndex: s,
261
+ _historyLength: e
262
+ };
263
+ }, Re = p(() => le()), Gt = () => ({
264
+ initializeHistoryForDashboard: Te,
265
+ resetAllHistory: () => {
266
+ M.undoHistory = {}, M.historyIndex = {};
267
+ },
268
+ addUndoEntry: je,
269
+ removeUndoHistoryForDashboard: ze,
270
+ getPreviousChanges: Ae,
271
+ getNextChanges: He,
272
+ computedUndoStatus: Re,
273
+ // Function that returns a Vue ComputedRef
274
+ getUndoStatus: le,
275
+ // for unit tests only
276
+ // Expose reactive state for debugging or advanced external use (optional)
277
+ historyState: fe(M)
278
+ });
279
+ function Q(t) {
280
+ return {
281
+ removeClick: (n, a) => {
282
+ t("removeClick", n, a);
283
+ },
284
+ moveClick: (n, a, r) => {
285
+ t("moveClick", n, a, r);
286
+ },
287
+ selectContainer: (n) => {
288
+ t("selectContainer", n);
289
+ }
290
+ };
291
+ }
292
+ const qt = /* @__PURE__ */ b({
293
+ __name: "AddIcon",
294
+ props: {
295
+ cssClass: {}
296
+ },
297
+ setup(t) {
298
+ return (s, e) => (d(), C("svg", {
299
+ xmlns: "http://www.w3.org/2000/svg",
300
+ width: "24",
301
+ height: "24",
302
+ viewBox: "0 0 24 24",
303
+ fill: "none",
304
+ stroke: "currentColor",
305
+ "stroke-width": "2",
306
+ "stroke-linecap": "round",
307
+ "stroke-linejoin": "round",
308
+ class: g(`lucide lucide-circle-plus-icon lucide-circle-plus ${t.cssClass || ""}`.trim())
309
+ }, [...e[0] || (e[0] = [
310
+ o("circle", {
311
+ cx: "12",
312
+ cy: "12",
313
+ r: "10"
314
+ }, null, -1),
315
+ o("path", { d: "M8 12h8" }, null, -1),
316
+ o("path", { d: "M12 8v8" }, null, -1)
317
+ ])], 2));
318
+ }
319
+ }), Zt = /* @__PURE__ */ b({
320
+ __name: "DeleteIcon",
321
+ props: {
322
+ cssClass: {}
323
+ },
324
+ setup(t) {
325
+ return (s, e) => (d(), C("svg", {
326
+ xmlns: "http://www.w3.org/2000/svg",
327
+ width: "24",
328
+ height: "24",
329
+ viewBox: "0 0 24 24",
330
+ fill: "none",
331
+ stroke: "currentColor",
332
+ "stroke-width": "2",
333
+ "stroke-linecap": "round",
334
+ "stroke-linejoin": "round",
335
+ class: g(`lucide lucide-trash2-icon lucide-trash-2 ${t.cssClass || ""}`.trim())
336
+ }, [...e[0] || (e[0] = [
337
+ te('<path d="M10 11v6"></path><path d="M14 11v6"></path><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"></path><path d="M3 6h18"></path><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>', 5)
338
+ ])], 2));
339
+ }
340
+ }), Xt = /* @__PURE__ */ b({
341
+ __name: "EditIcon",
342
+ props: {
343
+ cssClass: {}
344
+ },
345
+ setup(t) {
346
+ return (s, e) => (d(), C("svg", {
347
+ xmlns: "http://www.w3.org/2000/svg",
348
+ width: "24",
349
+ height: "24",
350
+ viewBox: "0 0 24 24",
351
+ fill: "none",
352
+ stroke: "currentColor",
353
+ "stroke-width": "2",
354
+ "stroke-linecap": "round",
355
+ "stroke-linejoin": "round",
356
+ class: g(`lucide lucide-square-pen-icon lucide-square-pen ${t.cssClass || ""}`.trim())
357
+ }, [...e[0] || (e[0] = [
358
+ o("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }, null, -1),
359
+ o("path", { d: "M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z" }, null, -1)
360
+ ])], 2));
361
+ }
362
+ }), Qt = /* @__PURE__ */ b({
363
+ __name: "GridIcon",
364
+ props: {
365
+ cssClass: {}
366
+ },
367
+ setup(t) {
368
+ return (s, e) => (d(), C("svg", {
369
+ xmlns: "http://www.w3.org/2000/svg",
370
+ width: "24",
371
+ height: "24",
372
+ viewBox: "0 0 24 24",
373
+ fill: "none",
374
+ stroke: "currentColor",
375
+ "stroke-width": "2",
376
+ "stroke-linecap": "round",
377
+ "stroke-linejoin": "round",
378
+ class: g(`lucide lucide-grid3x3-icon lucide-grid-3x3 ${t.cssClass || ""}`.trim())
379
+ }, [...e[0] || (e[0] = [
380
+ te('<rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="M3 9h18"></path><path d="M3 15h18"></path><path d="M9 3v18"></path><path d="M15 3v18"></path>', 5)
381
+ ])], 2));
382
+ }
383
+ }), Ve = /* @__PURE__ */ b({
384
+ __name: "SettingsIcon",
385
+ props: {
386
+ cssClass: {}
387
+ },
388
+ setup(t) {
389
+ return (s, e) => (d(), C("svg", {
390
+ xmlns: "http://www.w3.org/2000/svg",
391
+ width: "24",
392
+ height: "24",
393
+ viewBox: "0 0 24 24",
394
+ fill: "none",
395
+ stroke: "currentColor",
396
+ "stroke-width": "2",
397
+ "stroke-linecap": "round",
398
+ "stroke-linejoin": "round",
399
+ class: g(`lucide lucide-settings-icon lucide-settings ${t.cssClass || ""}`.trim())
400
+ }, [...e[0] || (e[0] = [
401
+ o("path", { d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" }, null, -1),
402
+ o("circle", {
403
+ cx: "12",
404
+ cy: "12",
405
+ r: "3"
406
+ }, null, -1)
407
+ ])], 2));
408
+ }
409
+ }), Yt = /* @__PURE__ */ b({
410
+ __name: "ZoomInIcon",
411
+ props: {
412
+ cssClass: {}
413
+ },
414
+ setup(t) {
415
+ return (s, e) => (d(), C("svg", {
416
+ xmlns: "http://www.w3.org/2000/svg",
417
+ width: "24",
418
+ height: "24",
419
+ viewBox: "0 0 24 24",
420
+ fill: "none",
421
+ stroke: "currentColor",
422
+ "stroke-width": "2",
423
+ "stroke-linecap": "round",
424
+ "stroke-linejoin": "round",
425
+ class: g(`lucide lucide-zoom-in-icon lucide-zoom-in ${t.cssClass || ""}`.trim())
426
+ }, [...e[0] || (e[0] = [
427
+ o("circle", {
428
+ cx: "11",
429
+ cy: "11",
430
+ r: "8"
431
+ }, null, -1),
432
+ o("line", {
433
+ x1: "21",
434
+ x2: "16.65",
435
+ y1: "21",
436
+ y2: "16.65"
437
+ }, null, -1),
438
+ o("line", {
439
+ x1: "11",
440
+ x2: "11",
441
+ y1: "8",
442
+ y2: "14"
443
+ }, null, -1),
444
+ o("line", {
445
+ x1: "8",
446
+ x2: "14",
447
+ y1: "11",
448
+ y2: "11"
449
+ }, null, -1)
450
+ ])], 2));
451
+ }
452
+ }), Jt = /* @__PURE__ */ b({
453
+ __name: "ZoomOutIcon",
454
+ props: {
455
+ cssClass: {}
456
+ },
457
+ setup(t) {
458
+ return (s, e) => (d(), C("svg", {
459
+ xmlns: "http://www.w3.org/2000/svg",
460
+ width: "24",
461
+ height: "24",
462
+ viewBox: "0 0 24 24",
463
+ fill: "none",
464
+ stroke: "currentColor",
465
+ "stroke-width": "2",
466
+ "stroke-linecap": "round",
467
+ "stroke-linejoin": "round",
468
+ class: g(`lucide lucide-zoom-out-icon lucide-zoom-out ${t.cssClass || ""}`.trim())
469
+ }, [...e[0] || (e[0] = [
470
+ o("circle", {
471
+ cx: "11",
472
+ cy: "11",
473
+ r: "8"
474
+ }, null, -1),
475
+ o("line", {
476
+ x1: "21",
477
+ x2: "16.65",
478
+ y1: "21",
479
+ y2: "16.65"
480
+ }, null, -1),
481
+ o("line", {
482
+ x1: "8",
483
+ x2: "14",
484
+ y1: "11",
485
+ y2: "11"
486
+ }, null, -1)
487
+ ])], 2));
488
+ }
489
+ }), ce = /* @__PURE__ */ b({
490
+ __name: "MoveLeftIcon",
491
+ props: {
492
+ cssClass: {}
493
+ },
494
+ setup(t) {
495
+ return (s, e) => (d(), C("svg", {
496
+ xmlns: "http://www.w3.org/2000/svg",
497
+ width: "24",
498
+ height: "24",
499
+ viewBox: "0 0 24 24",
500
+ fill: "none",
501
+ stroke: "currentColor",
502
+ "stroke-width": "2",
503
+ "stroke-linecap": "round",
504
+ "stroke-linejoin": "round",
505
+ class: g(
506
+ `lucide lucide-circle-arrow-left-icon lucide-circle-arrow-left ${t.cssClass || ""}`.trim()
507
+ )
508
+ }, [...e[0] || (e[0] = [
509
+ o("circle", {
510
+ cx: "12",
511
+ cy: "12",
512
+ r: "10"
513
+ }, null, -1),
514
+ o("path", { d: "m12 8-4 4 4 4" }, null, -1),
515
+ o("path", { d: "M16 12H8" }, null, -1)
516
+ ])], 2));
517
+ }
518
+ }), ue = /* @__PURE__ */ b({
519
+ __name: "MoveRightIcon",
520
+ props: {
521
+ cssClass: {}
522
+ },
523
+ setup(t) {
524
+ return (s, e) => (d(), C("svg", {
525
+ xmlns: "http://www.w3.org/2000/svg",
526
+ width: "24",
527
+ height: "24",
528
+ viewBox: "0 0 24 24",
529
+ fill: "none",
530
+ stroke: "currentColor",
531
+ "stroke-width": "2",
532
+ "stroke-linecap": "round",
533
+ "stroke-linejoin": "round",
534
+ class: g(
535
+ `lucide lucide-circle-arrow-right-icon lucide-circle-arrow-right ${t.cssClass || ""}`.trim()
536
+ )
537
+ }, [...e[0] || (e[0] = [
538
+ o("circle", {
539
+ cx: "12",
540
+ cy: "12",
541
+ r: "10"
542
+ }, null, -1),
543
+ o("path", { d: "m12 16 4-4-4-4" }, null, -1),
544
+ o("path", { d: "M8 12h8" }, null, -1)
545
+ ])], 2));
546
+ }
547
+ }), ge = /* @__PURE__ */ b({
548
+ __name: "XCircleIcon",
549
+ props: {
550
+ cssClass: {}
551
+ },
552
+ setup(t) {
553
+ return (s, e) => (d(), C("svg", {
554
+ xmlns: "http://www.w3.org/2000/svg",
555
+ width: "24",
556
+ height: "24",
557
+ viewBox: "0 0 24 24",
558
+ fill: "none",
559
+ stroke: "currentColor",
560
+ "stroke-width": "2",
561
+ "stroke-linecap": "round",
562
+ "stroke-linejoin": "round",
563
+ class: g(`lucide lucide-circle-x-icon lucide-circle-x ${t.cssClass || ""}`.trim())
564
+ }, [...e[0] || (e[0] = [
565
+ o("circle", {
566
+ cx: "12",
567
+ cy: "12",
568
+ r: "10"
569
+ }, null, -1),
570
+ o("path", { d: "m15 9-6 6" }, null, -1),
571
+ o("path", { d: "m9 9 6 6" }, null, -1)
572
+ ])], 2));
573
+ }
574
+ }), es = /* @__PURE__ */ b({
575
+ __name: "MonitorSmartphoneIcon",
576
+ props: {
577
+ cssClass: {}
578
+ },
579
+ setup(t) {
580
+ return (s, e) => (d(), C("svg", {
581
+ xmlns: "http://www.w3.org/2000/svg",
582
+ width: "24",
583
+ height: "24",
584
+ viewBox: "0 0 24 24",
585
+ fill: "none",
586
+ stroke: "currentColor",
587
+ "stroke-width": "2",
588
+ "stroke-linecap": "round",
589
+ "stroke-linejoin": "round",
590
+ class: g(
591
+ `lucide lucide-monitor-smartphone-icon lucide-monitor-smartphone ${t.cssClass || ""}`.trim()
592
+ )
593
+ }, [...e[0] || (e[0] = [
594
+ o("path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }, null, -1),
595
+ o("path", { d: "M10 19v-3.96 3.15" }, null, -1),
596
+ o("path", { d: "M7 19h5" }, null, -1),
597
+ o("rect", {
598
+ width: "6",
599
+ height: "10",
600
+ x: "16",
601
+ y: "12",
602
+ rx: "2"
603
+ }, null, -1)
604
+ ])], 2));
605
+ }
606
+ }), ts = /* @__PURE__ */ b({
607
+ __name: "TabletSmartphoneIcon",
608
+ props: {
609
+ cssClass: {}
610
+ },
611
+ setup(t) {
612
+ return (s, e) => (d(), C("svg", {
613
+ xmlns: "http://www.w3.org/2000/svg",
614
+ width: "24",
615
+ height: "24",
616
+ viewBox: "0 0 24 24",
617
+ fill: "none",
618
+ stroke: "currentColor",
619
+ "stroke-width": "2",
620
+ "stroke-linecap": "round",
621
+ "stroke-linejoin": "round",
622
+ class: g(
623
+ `lucide lucide-tablet-smartphone-icon lucide-tablet-smartphone ${t.cssClass || ""}`.trim()
624
+ )
625
+ }, [...e[0] || (e[0] = [
626
+ o("rect", {
627
+ width: "10",
628
+ height: "14",
629
+ x: "3",
630
+ y: "8",
631
+ rx: "2"
632
+ }, null, -1),
633
+ o("path", { d: "M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4" }, null, -1),
634
+ o("path", { d: "M8 18h.01" }, null, -1)
635
+ ])], 2));
636
+ }
637
+ }), ss = /* @__PURE__ */ b({
638
+ __name: "MonitorIcon",
639
+ props: {
640
+ cssClass: {}
641
+ },
642
+ setup(t) {
643
+ return (s, e) => (d(), C("svg", {
644
+ xmlns: "http://www.w3.org/2000/svg",
645
+ width: "24",
646
+ height: "24",
647
+ viewBox: "0 0 24 24",
648
+ fill: "none",
649
+ stroke: "currentColor",
650
+ "stroke-width": "2",
651
+ "stroke-linecap": "round",
652
+ "stroke-linejoin": "round",
653
+ class: g(`lucide lucide-monitor-icon lucide-monitor ${t.cssClass || ""}`.trim())
654
+ }, [...e[0] || (e[0] = [
655
+ o("rect", {
656
+ width: "20",
657
+ height: "14",
658
+ x: "2",
659
+ y: "3",
660
+ rx: "2"
661
+ }, null, -1),
662
+ o("line", {
663
+ x1: "8",
664
+ x2: "16",
665
+ y1: "21",
666
+ y2: "21"
667
+ }, null, -1),
668
+ o("line", {
669
+ x1: "12",
670
+ x2: "12",
671
+ y1: "17",
672
+ y2: "21"
673
+ }, null, -1)
674
+ ])], 2));
675
+ }
676
+ }), Ue = /* @__PURE__ */ b({
677
+ __name: "TimerResetIcon",
678
+ props: {
679
+ cssClass: {}
680
+ },
681
+ setup(t) {
682
+ return (s, e) => (d(), C("svg", {
683
+ xmlns: "http://www.w3.org/2000/svg",
684
+ width: "24",
685
+ height: "24",
686
+ viewBox: "0 0 24 24",
687
+ fill: "none",
688
+ stroke: "currentColor",
689
+ "stroke-width": "2",
690
+ "stroke-linecap": "round",
691
+ "stroke-linejoin": "round",
692
+ class: g(`lucide lucide-timer-reset-icon lucide-timer-reset ${t.cssClass || ""}`.trim())
693
+ }, [...e[0] || (e[0] = [
694
+ o("path", { d: "M10 2h4" }, null, -1),
695
+ o("path", { d: "M12 14v-4" }, null, -1),
696
+ o("path", { d: "M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6" }, null, -1),
697
+ o("path", { d: "M9 17H4v5" }, null, -1)
698
+ ])], 2));
699
+ }
700
+ }), Fe = /* @__PURE__ */ b({
701
+ __name: "UndoIcon",
702
+ props: {
703
+ cssClass: {}
704
+ },
705
+ setup(t) {
706
+ return (s, e) => (d(), C("svg", {
707
+ xmlns: "http://www.w3.org/2000/svg",
708
+ width: "24",
709
+ height: "24",
710
+ viewBox: "0 0 24 24",
711
+ fill: "none",
712
+ stroke: "currentColor",
713
+ "stroke-width": "2",
714
+ "stroke-linecap": "round",
715
+ "stroke-linejoin": "round",
716
+ class: g(`lucide lucide-undo-icon lucide-undo ${t.cssClass || ""}`.trim())
717
+ }, [...e[0] || (e[0] = [
718
+ o("path", { d: "M3 7v6h6" }, null, -1),
719
+ o("path", { d: "M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13" }, null, -1)
720
+ ])], 2));
721
+ }
722
+ }), Pe = /* @__PURE__ */ b({
723
+ __name: "RedoIcon",
724
+ props: {
725
+ cssClass: {}
726
+ },
727
+ setup(t) {
728
+ return (s, e) => (d(), C("svg", {
729
+ xmlns: "http://www.w3.org/2000/svg",
730
+ width: "24",
731
+ height: "24",
732
+ viewBox: "0 0 24 24",
733
+ fill: "none",
734
+ stroke: "currentColor",
735
+ "stroke-width": "2",
736
+ "stroke-linecap": "round",
737
+ "stroke-linejoin": "round",
738
+ class: g(`lucide lucide-redo-icon lucide-redo ${t.cssClass || ""}`.trim())
739
+ }, [...e[0] || (e[0] = [
740
+ o("path", { d: "M21 7v6h-6" }, null, -1),
741
+ o("path", { d: "M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7" }, null, -1)
742
+ ])], 2));
743
+ }
744
+ }), Oe = /* @__PURE__ */ b({
745
+ __name: "HandIcon",
746
+ props: {
747
+ cssClass: {}
748
+ },
749
+ setup(t) {
750
+ return (s, e) => (d(), C("svg", {
751
+ xmlns: "http://www.w3.org/2000/svg",
752
+ width: "24",
753
+ height: "24",
754
+ viewBox: "0 0 24 24",
755
+ fill: "none",
756
+ stroke: "currentColor",
757
+ "stroke-width": "2",
758
+ "stroke-linecap": "round",
759
+ "stroke-linejoin": "round",
760
+ class: g(`lucide lucide-hand-icon lucide-hand ${t.cssClass || ""}`.trim())
761
+ }, [...e[0] || (e[0] = [
762
+ o("path", { d: "M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2" }, null, -1),
763
+ o("path", { d: "M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2" }, null, -1),
764
+ o("path", { d: "M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8" }, null, -1),
765
+ o("path", { d: "M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15" }, null, -1)
766
+ ])], 2));
767
+ }
768
+ }), Ge = /* @__PURE__ */ b({
769
+ __name: "HandGrabIcon",
770
+ props: {
771
+ cssClass: {}
772
+ },
773
+ setup(t) {
774
+ return (s, e) => (d(), C("svg", {
775
+ xmlns: "http://www.w3.org/2000/svg",
776
+ width: "24",
777
+ height: "24",
778
+ viewBox: "0 0 24 24",
779
+ fill: "none",
780
+ stroke: "currentColor",
781
+ "stroke-width": "2",
782
+ "stroke-linecap": "round",
783
+ "stroke-linejoin": "round",
784
+ class: g(`lucide lucide-hand-grab-icon lucide-hand-grab ${t.cssClass || ""}`.trim())
785
+ }, [...e[0] || (e[0] = [
786
+ te('<path d="M18 11.5V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4"></path><path d="M14 10V8a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"></path><path d="M10 9.9V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5"></path><path d="M6 14a2 2 0 0 0-2-2a2 2 0 0 0-2 2"></path><path d="M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-4a8 8 0 0 1-8-8 2 2 0 1 1 4 0"></path>', 5)
787
+ ])], 2));
788
+ }
789
+ }), qe = /* @__PURE__ */ b({
790
+ __name: "CrosshairIcon",
791
+ props: {
792
+ cssClass: {}
793
+ },
794
+ setup(t) {
795
+ return (s, e) => (d(), C("svg", {
796
+ xmlns: "http://www.w3.org/2000/svg",
797
+ width: "24",
798
+ height: "24",
799
+ viewBox: "0 0 24 24",
800
+ fill: "none",
801
+ stroke: "currentColor",
802
+ "stroke-width": "2",
803
+ "stroke-linecap": "round",
804
+ "stroke-linejoin": "round",
805
+ class: g(`lucide lucide-crosshair-icon lucide-crosshair ${t.cssClass || ""}`.trim())
806
+ }, [...e[0] || (e[0] = [
807
+ o("line", {
808
+ x1: "22",
809
+ x2: "18",
810
+ y1: "12",
811
+ y2: "12"
812
+ }, null, -1),
813
+ o("line", {
814
+ x1: "6",
815
+ x2: "2",
816
+ y1: "12",
817
+ y2: "12"
818
+ }, null, -1),
819
+ o("line", {
820
+ x1: "12",
821
+ x2: "12",
822
+ y1: "6",
823
+ y2: "2"
824
+ }, null, -1),
825
+ o("line", {
826
+ x1: "12",
827
+ x2: "12",
828
+ y1: "22",
829
+ y2: "18"
830
+ }, null, -1)
831
+ ])], 2));
832
+ }
833
+ }), os = /* @__PURE__ */ b({
834
+ __name: "TargetIcon",
835
+ props: {
836
+ cssClass: {}
837
+ },
838
+ setup(t) {
839
+ return (s, e) => (d(), C("svg", {
840
+ xmlns: "http://www.w3.org/2000/svg",
841
+ width: "24",
842
+ height: "24",
843
+ viewBox: "0 0 24 24",
844
+ fill: "none",
845
+ stroke: "currentColor",
846
+ "stroke-width": "2",
847
+ "stroke-linecap": "round",
848
+ "stroke-linejoin": "round",
849
+ class: g(`lucide lucide-target-icon lucide-target ${t.cssClass || ""}`.trim())
850
+ }, [...e[0] || (e[0] = [
851
+ o("circle", {
852
+ cx: "12",
853
+ cy: "12",
854
+ r: "10"
855
+ }, null, -1),
856
+ o("circle", {
857
+ cx: "12",
858
+ cy: "12",
859
+ r: "6"
860
+ }, null, -1),
861
+ o("circle", {
862
+ cx: "12",
863
+ cy: "12",
864
+ r: "2"
865
+ }, null, -1)
866
+ ])], 2));
867
+ }
868
+ }), Ze = /* @__PURE__ */ b({
869
+ __name: "CircleQuestionMarkIcon",
870
+ props: {
871
+ cssClass: {}
872
+ },
873
+ setup(t) {
874
+ return (s, e) => (d(), C("svg", {
875
+ xmlns: "http://www.w3.org/2000/svg",
876
+ width: "24",
877
+ height: "24",
878
+ viewBox: "0 0 24 24",
879
+ fill: "none",
880
+ stroke: "currentColor",
881
+ "stroke-width": "2",
882
+ "stroke-linecap": "round",
883
+ "stroke-linejoin": "round",
884
+ class: g(
885
+ `lucide lucide-circle-question-mark-icon lucide-circle-question-mark ${t.cssClass || ""}`.trim()
886
+ )
887
+ }, [...e[0] || (e[0] = [
888
+ o("circle", {
889
+ cx: "12",
890
+ cy: "12",
891
+ r: "10"
892
+ }, null, -1),
893
+ o("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }, null, -1),
894
+ o("path", { d: "M12 17h.01" }, null, -1)
895
+ ])], 2));
896
+ }
897
+ }), Xe = ["title", "disabled"], T = /* @__PURE__ */ b({
898
+ __name: "Button",
899
+ props: {
900
+ disabled: { type: Boolean, default: !1 },
901
+ className: {},
902
+ tooltip: {},
903
+ isIconButton: { type: Boolean },
904
+ type: { default: "normal" },
905
+ category: { default: "primary" },
906
+ font: { default: "semibold" },
907
+ border: { default: 0 },
908
+ borderHover: { default: 1 },
909
+ borderColor: { default: "" },
910
+ px: { default: 0.7 },
911
+ py: { default: 0.25 },
912
+ justifyCss: { default: "justify-center" },
913
+ shadow: { default: "sm" },
914
+ shadowHover: { default: "md" },
915
+ addCss: { default: "" }
916
+ },
917
+ emits: ["click"],
918
+ setup(t, { emit: s }) {
919
+ const e = t, i = s, n = /* @__PURE__ */ new Map([
920
+ [
921
+ "normal",
922
+ "group bg-[category] content-[category] hover:bg-[category] group-hover:bg-[category] focus:outline-[category] focus:outline-offset-[category]"
923
+ ],
924
+ [
925
+ "ghost",
926
+ "group bg-transparent border-[category] text-[category] hover:text-[category] group-hover:text-[category] focus:outline-[category] focus:outline-offset-[category]"
927
+ ]
928
+ ]), a = p(() => {
929
+ const c = e.isIconButton || !1, u = e.category || "primary", h = e.type || "normal", x = e.disabled || !1, k = e.className || "", $ = e.font || "", D = Number((e.border || 0) > 0 ? e.border : 0);
930
+ let _ = (e.borderColor || "").trim();
931
+ _ = _.length > 0 ? _ : "";
932
+ const B = Number((e.borderHover || 0) > 0 ? e.borderHover : 0), H = e.shadow || "sm", L = e.shadowHover || "md", A = (e.addCss || "").trim(), m = e.justifyCss || "justify-center";
933
+ if (c)
934
+ return E(
935
+ "flex flex-row items-center",
936
+ x ? "text-disabled" : `text-${u} hover:brightness-110 cursor-pointer`,
937
+ k || ""
938
+ );
939
+ const l = [
940
+ "relative cursor-pointer",
941
+ "rounded-sm focus:outline-none focus:ring focus:ring-offset",
942
+ "transition-all duration-150",
943
+ "text-sm",
944
+ `font-${$}`
945
+ ];
946
+ if (x)
947
+ h === "ghost" ? l.push("text-disabled border-disabled cursor-not-allowed") : l.push("bg-disabled content-disabled border-disabled cursor-not-allowed");
948
+ else {
949
+ l.push("cursor-pointer");
950
+ let v = "";
951
+ n.has(h) ? v = `${n.get(h)}` : v = `${n.get("normal")}`, D < 1 && (v = v.replace("border-[category]", ""));
952
+ const V = v.replaceAll("[category]", u).trim();
953
+ l.push(V);
954
+ }
955
+ return D > 0 ? (l.push(`border-[${D}px]`), l.push(`border-${_}`)) : (l.push("border-[1px]"), l.push("border-transparent")), B > 0 ? (l.push(`hover:border-[${B}px] group-hover:border-[${B}px]`), l.push(`hover:border-${_} group-hover:border-${_}`)) : l.push("hover:border-[1px] group-hover:border-[1px]"), l.push(`shadow-${H}`), l.push(`hover:shadow-${L} group-hover:shadow-${L}`), A.length > 0 && l.push(A), A.indexOf("hidden") === -1 && l.push("inline-flex"), l.push(m), l.join(" ").trim();
956
+ }), r = p(() => ({
957
+ padding: e.isIconButton ? 0 : `${e.py}rem ${e.px}rem `
958
+ })), w = (c) => {
959
+ if (e.disabled) {
960
+ c.preventDefault();
961
+ return;
962
+ }
963
+ i("click", c);
964
+ };
965
+ return (c, u) => (d(), C("button", {
966
+ type: "button",
967
+ class: g(a.value),
968
+ style: se(r.value),
969
+ title: t.tooltip?.title,
970
+ disabled: t.disabled,
971
+ onClick: N(w, ["stop"])
972
+ }, [
973
+ z(c.$slots, "default")
974
+ ], 14, Xe));
975
+ }
976
+ }), Qe = ["data-testid"], Ye = /* @__PURE__ */ b({
977
+ __name: "Stack",
978
+ props: {
979
+ testId: {},
980
+ classNames: {},
981
+ direction: {},
982
+ style: {}
983
+ },
984
+ setup(t) {
985
+ const s = t, e = p(() => {
986
+ const { testId: n, classNames: a, direction: r, ...w } = s;
987
+ return w;
988
+ }), i = p(() => s.direction === "row" ? E("flex flex-row items-center gap-2", s.classNames || "") : E("flex flex-col gap-2 w-full", s.classNames || ""));
989
+ return (n, a) => (d(), C("div", G({
990
+ "data-testid": t.testId || "not-set",
991
+ class: i.value
992
+ }, e.value), [
993
+ z(n.$slots, "default")
994
+ ], 16, Qe));
995
+ }
996
+ }), ns = /* @__PURE__ */ b({
997
+ __name: "ListItem",
998
+ props: {
999
+ testId: {},
1000
+ classNames: {},
1001
+ direction: {},
1002
+ style: {},
1003
+ innerClass: {}
1004
+ },
1005
+ setup(t) {
1006
+ const s = t, e = p(() => {
1007
+ const { classNames: a, direction: r, innerClass: w, ...c } = s;
1008
+ return c;
1009
+ }), i = p(() => E(s.classNames || "", "w-full")), n = E(
1010
+ `w-full flex overflow-hidden justify-between items-center gap-0
1011
+ rounded-md border`,
1012
+ s.innerClass || ""
1013
+ );
1014
+ return (a, r) => (d(), K(Ye, G({
1015
+ direction: "row",
1016
+ class: i.value
1017
+ }, e.value), {
1018
+ default: W(() => [
1019
+ o("div", {
1020
+ class: g(f(n))
1021
+ }, [
1022
+ z(a.$slots, "default")
1023
+ ], 2)
1024
+ ]),
1025
+ _: 3
1026
+ }, 16, ["class"]));
1027
+ }
1028
+ }), Je = ["for"], et = ["id", "value", "placeholder", "aria-label"], tt = `
1029
+ block w-full rounded-md px-3 py-1.5 text-base
1030
+ bg-formfield content-formfield
1031
+ outline-1 -outline-offset-1 outline-primary
1032
+ placeholder:text-disabled
1033
+ focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-200 sm:text-sm/6
1034
+ `, he = /* @__PURE__ */ b({
1035
+ __name: "TextField",
1036
+ props: {
1037
+ label: {},
1038
+ size: { default: "medium" },
1039
+ modelValue: {},
1040
+ className: { default: "" },
1041
+ placeholder: { default: "" }
1042
+ },
1043
+ emits: ["update:modelValue", "keydown"],
1044
+ setup(t, { emit: s }) {
1045
+ const e = t, i = s, n = (c) => {
1046
+ i("update:modelValue", c.target.value);
1047
+ }, a = p(() => e.size === "small" ? "py-1.5 px-3 text-sm" : "py-2.5 px-4 text-base"), r = p(() => `flex flex-col mb-4 ${e.className}`), w = p(() => `${tt} ${a.value}`);
1048
+ return (c, u) => (d(), C("div", {
1049
+ class: g(r.value)
1050
+ }, [
1051
+ o("label", {
1052
+ for: e.label,
1053
+ class: "block text-sm/6 font-medium mb-1.5"
1054
+ }, j(e.label), 9, Je),
1055
+ o("input", {
1056
+ id: e.label,
1057
+ type: "text",
1058
+ value: e.modelValue,
1059
+ placeholder: e.placeholder,
1060
+ class: g(w.value),
1061
+ "aria-label": e.label,
1062
+ onInput: n,
1063
+ onKeydown: u[0] || (u[0] = (h) => i("keydown", h))
1064
+ }, null, 42, et)
1065
+ ], 2));
1066
+ }
1067
+ }), st = ["data-testid"], ot = /* @__PURE__ */ b({
1068
+ __name: "DraggablePanel",
1069
+ props: {
1070
+ testId: {},
1071
+ className: {},
1072
+ style: {},
1073
+ onDraggingChange: { type: Function }
1074
+ },
1075
+ emits: ["draggingChange"],
1076
+ setup(t, { emit: s }) {
1077
+ const e = t, i = s, n = R(null), a = R({ x: 0, y: 0 }), r = R({ x: 0, y: 0 }), w = R({ x: 0, y: 0 }), c = {
1078
+ // 1. Take it out of the document flow
1079
+ position: "fixed",
1080
+ // 2. Set initial viewport position (e.g., top right)
1081
+ top: "6rem",
1082
+ right: "1rem",
1083
+ // 3. Ensure it stacks above other content
1084
+ zIndex: 1,
1085
+ // Add your layout/appearance styles
1086
+ width: "360px",
1087
+ minHeight: "360px",
1088
+ borderStyle: "solid",
1089
+ borderWidth: "3px",
1090
+ boxShadow: "rgba(0, 0, 0, 0.5) 7px 7px 10px 0px"
1091
+ }, u = p(() => ({
1092
+ ...c,
1093
+ ...e.style || {},
1094
+ // Override top/right with CSS transform based on position state for dragging
1095
+ transform: `translate(${a.value.x}px, ${a.value.y}px)`,
1096
+ top: c.top,
1097
+ right: c.right,
1098
+ // When translating, setting 'left' and 'top' to 0 helps maintain consistent behavior
1099
+ left: "initial"
1100
+ })), h = ($) => {
1101
+ $.target.closest(".handle") && ($.preventDefault(), i("draggingChange", !0), r.value = { x: $.clientX, y: $.clientY }, w.value = { x: a.value.x, y: a.value.y }, window.addEventListener("mousemove", x), window.addEventListener("mouseup", k));
1102
+ }, x = ($) => {
1103
+ const D = $.clientX - r.value.x, _ = $.clientY - r.value.y;
1104
+ a.value = {
1105
+ x: w.value.x + D,
1106
+ y: w.value.y + _
1107
+ };
1108
+ }, k = () => {
1109
+ window.removeEventListener("mousemove", x), window.removeEventListener("mouseup", k), setTimeout(() => {
1110
+ i("draggingChange", !1);
1111
+ }, 100);
1112
+ };
1113
+ return Ce(() => {
1114
+ n.value && n.value.addEventListener("mousedown", h);
1115
+ }), ve(() => {
1116
+ n.value && n.value.removeEventListener("mousedown", h), window.removeEventListener("mousemove", x), window.removeEventListener("mouseup", k);
1117
+ }), ($, D) => (d(), C("div", {
1118
+ ref_key: "panelRef",
1119
+ ref: n,
1120
+ "data-testid": e.testId || "draggable-panel",
1121
+ class: g(e.className),
1122
+ style: se(u.value)
1123
+ }, [
1124
+ z($.$slots, "default")
1125
+ ], 14, st));
1126
+ }
1127
+ }), pe = (t, s) => {
1128
+ const e = t.__vccOpts || t;
1129
+ for (const [i, n] of s)
1130
+ e[i] = n;
1131
+ return e;
1132
+ }, nt = {}, it = {
1133
+ class: "w-full h-full flex-1 flex flex-col gap-2 items-end justify-end content-end",
1134
+ style: { "min-height": "140px" }
1135
+ };
1136
+ function at(t, s) {
1137
+ return d(), C("div", it, [
1138
+ z(t.$slots, "default")
1139
+ ]);
1140
+ }
1141
+ const is = /* @__PURE__ */ pe(nt, [["render", at]]), rt = {}, dt = { className: "w-full flex flex-col items-end" };
1142
+ function lt(t, s) {
1143
+ return d(), C("div", dt, [
1144
+ z(t.$slots, "default")
1145
+ ]);
1146
+ }
1147
+ const as = /* @__PURE__ */ pe(rt, [["render", lt]]), rs = (t) => {
1148
+ console.warn("showToast TODO", t);
1149
+ }, ds = /* @__PURE__ */ b({
1150
+ __name: "DashboardGrid",
1151
+ props: {
1152
+ isEditing: { type: Boolean },
1153
+ zoomScale: {},
1154
+ responsiveGrid: { type: Boolean }
1155
+ },
1156
+ setup(t) {
1157
+ const s = t, e = (a) => a < 0.8 ? 1 : a <= 1 ? 0 : a > 1 ? -1 : 0, i = p(() => {
1158
+ let a = ke(Number(s.zoomScale || 0));
1159
+ return {
1160
+ "--bwj-dashboard-transform-scale": a,
1161
+ "--bwj-dashboard-add-cols": e(a)
1162
+ };
1163
+ }), n = p(() => E(
1164
+ "dashboard-main-grid w-full",
1165
+ s.isEditing ? "editing" : "",
1166
+ s.responsiveGrid ? "responsive-grid" : "",
1167
+ `border border-dashed ${s.isEditing ? "border-primary border-opacity-50" : "border-transparent"}`
1168
+ ));
1169
+ return (a, r) => (d(), C("div", {
1170
+ class: g(n.value),
1171
+ style: se(i.value)
1172
+ }, [
1173
+ z(a.$slots, "default")
1174
+ ], 6));
1175
+ }
1176
+ }), ct = {
1177
+ key: 1,
1178
+ class: "flex"
1179
+ }, ls = /* @__PURE__ */ b({
1180
+ __name: "DynamicWidgetLoader",
1181
+ props: {
1182
+ index: {},
1183
+ maxIndex: {},
1184
+ widgetKey: {},
1185
+ parentWidgetKey: {},
1186
+ targetContainerKey: {},
1187
+ childWidgetsConfig: {},
1188
+ widgetCatalog: {},
1189
+ isEditing: { type: Boolean },
1190
+ extraProps: {}
1191
+ },
1192
+ emits: ["removeClick", "moveClick", "selectContainer"],
1193
+ setup(t, { emit: s }) {
1194
+ const e = t, n = Q(s), a = p(() => `${e.widgetKey}`.split("_")), r = p(() => a.value.length > 1), w = p(() => r.value ? a.value[0] : e.widgetKey), c = p(() => r.value ? de(e.widgetKey) : ""), u = p(() => e.widgetCatalog.get(w.value)), h = p(() => {
1195
+ const _ = u.value;
1196
+ return _ ? _.component ? _.component : _.loader ? we({
1197
+ loader: _.loader,
1198
+ // This is for testing loadign with delay:
1199
+ // loader: () =>
1200
+ // new Promise((resolve) => {
1201
+ // setTimeout(async () => {
1202
+ // //@ts-ignore
1203
+ // resolve(await entry.loader())
1204
+ // }, 750)
1205
+ // }),
1206
+ // Optional: Add a loading state component
1207
+ // loadingComponent: MySpinnerComponent,
1208
+ // While the chunk downloads:
1209
+ loadingComponent: {
1210
+ template: '<div class="p-8 text-center text-primary animate-pulse">Loading Widget...</div>'
1211
+ },
1212
+ // If the CDN or local chunk fails to load:
1213
+ errorComponent: {
1214
+ template: '<div class="p-8 text-error">Failed to load plugin.</div>'
1215
+ },
1216
+ delay: 200,
1217
+ timeout: 3e3
1218
+ }) : null : null;
1219
+ }), x = p(() => r.value ? (e.childWidgetsConfig || []).filter((_) => _.parentWidgetKey === e.widgetKey) : []), k = (_, B) => {
1220
+ n.removeClick(_, B);
1221
+ }, $ = (_, B, H) => {
1222
+ n.moveClick(_, B, H);
1223
+ }, D = (_) => {
1224
+ n.selectContainer(_);
1225
+ };
1226
+ return (_, B) => {
1227
+ const H = xe("DynamicWidgetLoader", !0);
1228
+ return d(), K(ye, null, {
1229
+ fallback: W(() => [
1230
+ o("div", null, "Loading " + j(u.value?.meta?.name || u.value?.title), 1)
1231
+ ]),
1232
+ default: W(() => [
1233
+ h.value ? (d(), K(ae(h.value), {
1234
+ key: 0,
1235
+ index: t.index,
1236
+ maxIndex: x.value.length - 1,
1237
+ widgetKey: t.widgetKey,
1238
+ parentWidgetKey: t.parentWidgetKey,
1239
+ widgetCatalog: t.widgetCatalog,
1240
+ isEditing: t.isEditing,
1241
+ highlight: r.value && t.targetContainerKey === t.widgetKey || !1,
1242
+ title: (r.value ? c.value : u.value?.meta?.name) || !1,
1243
+ extraProps: t.extraProps,
1244
+ onRemoveClick: k,
1245
+ onMoveClick: $,
1246
+ onSelectContainer: D
1247
+ }, {
1248
+ default: W(() => [
1249
+ r.value ? (d(!0), C(U, { key: 0 }, F(x.value, (L, A) => (d(), K(H, {
1250
+ key: `${L.widgetKey}_${A}`,
1251
+ index: A,
1252
+ maxIndex: x.value.length - 1,
1253
+ widgetKey: L.widgetKey,
1254
+ parentWidgetKey: L.parentWidgetKey,
1255
+ widgetCatalog: t.widgetCatalog,
1256
+ isEditing: t.isEditing,
1257
+ onRemoveClick: k,
1258
+ onMoveClick: $
1259
+ }, null, 8, ["index", "maxIndex", "widgetKey", "parentWidgetKey", "widgetCatalog", "isEditing"]))), 128)) : O("", !0)
1260
+ ]),
1261
+ _: 1
1262
+ }, 40, ["index", "maxIndex", "widgetKey", "parentWidgetKey", "widgetCatalog", "isEditing", "highlight", "title", "extraProps"])) : (d(), C("div", ct, [
1263
+ o("p", null, " Widget not found or loader failed:: " + j(u.value?.meta?.name || u.value?.title || t.widgetKey), 1)
1264
+ ]))
1265
+ ]),
1266
+ _: 1
1267
+ });
1268
+ };
1269
+ }
1270
+ }), ut = { class: "widget-title-wrapper w-full flex flex-row gap-2 items-center justify-between" }, gt = { class: "widget-title" }, ht = { "data-testid": "collapse-and-other-actions" }, pt = { class: "actions-inner" }, mt = { class: "actions-buttons-container" }, ft = { class: "widget-inner" }, Y = "size-5", cs = /* @__PURE__ */ b({
1271
+ __name: "DashboardWidgetBase",
1272
+ props: {
1273
+ index: {},
1274
+ maxIndex: {},
1275
+ widgetKey: {},
1276
+ parentWidgetKey: {},
1277
+ isEditing: { type: Boolean },
1278
+ highlight: { type: Boolean },
1279
+ testId: {},
1280
+ title: {},
1281
+ size: {},
1282
+ borderCssClasses: {},
1283
+ backgroundCssClasses: {},
1284
+ hideTitle: { type: Boolean },
1285
+ noShadow: { type: Boolean },
1286
+ noBorder: { type: Boolean },
1287
+ noPadding: { type: Boolean },
1288
+ direction: {},
1289
+ extraProps: {}
1290
+ },
1291
+ emits: ["removeClick", "moveClick", "selectContainer"],
1292
+ setup(t, { emit: s }) {
1293
+ const e = t, i = s, n = p(() => e.hideTitle && !e.isEditing), a = p(() => {
1294
+ const u = e.borderCssClasses || "", h = e.noBorder;
1295
+ let x = `dashboard-widget ${e.isEditing ? "editing" : ""} border border-solid`;
1296
+ return h ? x = `${x} border-transparent border-opacity-0` : (u || "").trim().length > 0 ? x = `${x} ${u}` : x = `${x} border-card-invert border-opacity-20`, e.noShadow && (x = `${x} no-shadow`), e.noPadding && (x = `${x} no-padding p-0`), (e.backgroundCssClasses || "").trim().length > 0 ? x = `${x} ${e.backgroundCssClasses}` : x = `${x} bg-card content-card`, ["large", "xlarge"].indexOf(e.size || "") > -1 && (x = `${x} ${e.size}-widget`), E(x);
1297
+ }), r = p(() => {
1298
+ const u = n.value;
1299
+ return E(
1300
+ "widget-header",
1301
+ u ? "hidden" : "flex items-center justify-between border-b border-solid border-card-invert",
1302
+ u ? "border-opacity-0" : "border-opacity-20"
1303
+ );
1304
+ }), w = () => {
1305
+ e.widgetKey && i("removeClick", e.widgetKey, e.parentWidgetKey);
1306
+ }, c = (u) => {
1307
+ e.widgetKey && i("moveClick", u, e.widgetKey, e.parentWidgetKey);
1308
+ };
1309
+ return (u, h) => (d(), C("div", {
1310
+ class: g(a.value)
1311
+ }, [
1312
+ o("div", {
1313
+ class: g(r.value)
1314
+ }, [
1315
+ o("div", ut, [
1316
+ o("h2", gt, j(e.title), 1),
1317
+ h[2] || (h[2] = o("div", null, null, -1))
1318
+ ]),
1319
+ o("div", ht, [
1320
+ o("div", pt, [
1321
+ h[3] || (h[3] = o("div", null, [
1322
+ o("span", { class: "hidden" }, "Widget")
1323
+ ], -1)),
1324
+ o("div", mt, [
1325
+ I(f(T), {
1326
+ "data-testid": `move-widget-left_${e.title}`,
1327
+ isIconButton: !0,
1328
+ disabled: e.index < 1,
1329
+ tooltip: {
1330
+ placement: "top",
1331
+ title: `${e.index < 1 ? "Already at min position" : "Move Widget to the left/up"}`
1332
+ },
1333
+ onClick: h[0] || (h[0] = N((x) => c(-1), ["stop"]))
1334
+ }, {
1335
+ default: W(() => [
1336
+ I(f(ce), {
1337
+ class: g(Y)
1338
+ })
1339
+ ]),
1340
+ _: 1
1341
+ }, 8, ["data-testid", "disabled", "tooltip"]),
1342
+ I(f(T), {
1343
+ "data-testid": `move-widget-right_${e.title}`,
1344
+ isIconButton: !0,
1345
+ disabled: e.index >= e.maxIndex,
1346
+ tooltip: {
1347
+ placement: "top",
1348
+ title: `${e.index >= e.maxIndex ? "Already at max position" : "Move Widget to the right/down"}`
1349
+ },
1350
+ onClick: h[1] || (h[1] = N((x) => c(1), ["stop"]))
1351
+ }, {
1352
+ default: W(() => [
1353
+ I(f(ue), {
1354
+ class: g(Y)
1355
+ })
1356
+ ]),
1357
+ _: 1
1358
+ }, 8, ["data-testid", "disabled", "tooltip"]),
1359
+ I(f(T), {
1360
+ "data-testid": `remove-container_${e.title}`,
1361
+ isIconButton: !0,
1362
+ tooltip: {
1363
+ placement: "top",
1364
+ title: "Remove Widget"
1365
+ },
1366
+ onClick: N(w, ["stop"])
1367
+ }, {
1368
+ default: W(() => [
1369
+ I(f(ge), {
1370
+ class: g(Y)
1371
+ })
1372
+ ]),
1373
+ _: 1
1374
+ }, 8, ["data-testid"])
1375
+ ])
1376
+ ])
1377
+ ])
1378
+ ], 2),
1379
+ o("div", ft, [
1380
+ z(u.$slots, "default")
1381
+ ])
1382
+ ], 2));
1383
+ }
1384
+ }), Ct = ["data-testid"], vt = { class: "text-sm font-semibold capitalize" }, wt = { "data-testid": "collapse-and-other-actions" }, xt = { class: "actions-inner" }, yt = { class: "actions-buttons-container" }, bt = ["data-testid"], P = "size-5", _t = "border-transparent", kt = "border-card-invert", me = /* @__PURE__ */ b({
1385
+ __name: "WidgetContainer",
1386
+ props: {
1387
+ index: {},
1388
+ maxIndex: {},
1389
+ widgetKey: { default: void 0 },
1390
+ parentWidgetKey: { default: void 0 },
1391
+ isEditing: { type: Boolean },
1392
+ highlight: { type: Boolean, default: !1 },
1393
+ testId: {},
1394
+ title: { default: "" },
1395
+ size: { default: "default" },
1396
+ borderCssClasses: {},
1397
+ backgroundCssClasses: {},
1398
+ hideTitle: { type: Boolean },
1399
+ noShadow: { type: Boolean },
1400
+ noBorder: { type: Boolean },
1401
+ noPadding: { type: Boolean },
1402
+ direction: { default: "column" },
1403
+ extraProps: {}
1404
+ },
1405
+ emits: ["removeClick", "moveClick", "selectContainer"],
1406
+ setup(t, { emit: s }) {
1407
+ const e = t, n = Q(s), a = p(() => e.maxIndex > -1), r = p(() => {
1408
+ const k = a.value;
1409
+ return e.highlight ? _t : e.isEditing && !k ? kt : "border-transparent";
1410
+ }), w = p(() => {
1411
+ const k = e.highlight || !1, $ = e.direction || "column", D = a.value, _ = e.isEditing || !1;
1412
+ let L = k ? "border-transparent" : _ ? "border-card-invert" : "border-transparent";
1413
+ const A = ["large", "xlarge"].includes(e.size || "");
1414
+ let m = "";
1415
+ ["large", "xlarge"].indexOf(e.size || "") > -1 && (m = `${e.size}-widget`);
1416
+ let l = "";
1417
+ return $ === "row" && !D ? l = "min-h-48" : $ === "column" && !D && (l = "min-h-96"), E(
1418
+ "dashboard-widget-container relative ",
1419
+ D ? "" : "has-no-children",
1420
+ _ ? "editing" : "",
1421
+ l,
1422
+ m,
1423
+ A ? "widget-container-grid" : "widget-container-flex",
1424
+ `direction-${$}`,
1425
+ `border ${L}`,
1426
+ `${k ? "highlight-container" : ""} ${L}`
1427
+ );
1428
+ }), c = p(() => `widget-container-header direction-${e.direction} flex items-center border ${r.value}`), u = () => {
1429
+ e.widgetKey && n.removeClick(e.widgetKey);
1430
+ }, h = (k) => {
1431
+ e.widgetKey && n.moveClick(k, e.widgetKey, e.parentWidgetKey);
1432
+ }, x = () => {
1433
+ e.widgetKey && n.selectContainer(e.widgetKey);
1434
+ };
1435
+ return (k, $) => (d(), C("div", {
1436
+ "data-testid": `container_${e.widgetKey}`,
1437
+ "data-change": "asd",
1438
+ class: g(w.value)
1439
+ }, [
1440
+ o("div", {
1441
+ class: g(c.value)
1442
+ }, [
1443
+ o("div", {
1444
+ class: "widget-title-wrapper w-full flex whitespace-nowrap",
1445
+ onClick: N(x, ["stop"])
1446
+ }, [
1447
+ o("span", vt, j(e.title), 1)
1448
+ ]),
1449
+ o("div", wt, [
1450
+ o("div", xt, [
1451
+ o("div", yt, [
1452
+ I(f(T), {
1453
+ "data-testid": `open-widgets-catalog-from-container_${e.title}`,
1454
+ isIconButton: !0,
1455
+ class: "whitespace-nowrap",
1456
+ tooltip: { placement: "top", title: "Target this Container" },
1457
+ onClick: N(x, ["stop"])
1458
+ }, {
1459
+ default: W(() => [
1460
+ I(f(qe), {
1461
+ class: g(`${P} ${e.highlight ? "text-success" : "text-disabled"}`)
1462
+ }, null, 8, ["class"])
1463
+ ]),
1464
+ _: 1
1465
+ }, 8, ["data-testid"]),
1466
+ I(f(T), {
1467
+ "data-testid": `move-container-left_${e.title}`,
1468
+ isIconButton: !0,
1469
+ disabled: e.index < 1,
1470
+ tooltip: {
1471
+ placement: "top",
1472
+ title: e.index < 1 ? "Already at min position" : "Move Container to the left/up"
1473
+ },
1474
+ onClick: $[0] || ($[0] = N((D) => h(-1), ["stop"]))
1475
+ }, {
1476
+ default: W(() => [
1477
+ I(f(ce), {
1478
+ class: g(P)
1479
+ })
1480
+ ]),
1481
+ _: 1
1482
+ }, 8, ["data-testid", "disabled", "tooltip"]),
1483
+ I(f(T), {
1484
+ "data-testid": `move-container-right_${e.title}`,
1485
+ isIconButton: !0,
1486
+ disabled: e.index >= e.maxIndex,
1487
+ tooltip: {
1488
+ placement: "top",
1489
+ title: e.index >= e.maxIndex ? "Already at max position" : "Move Container to the right/down"
1490
+ },
1491
+ onClick: $[1] || ($[1] = N((D) => h(1), ["stop"]))
1492
+ }, {
1493
+ default: W(() => [
1494
+ I(f(ue), {
1495
+ class: g(P)
1496
+ })
1497
+ ]),
1498
+ _: 1
1499
+ }, 8, ["data-testid", "disabled", "tooltip"]),
1500
+ I(f(T), {
1501
+ "data-testid": `remove-container_${e.title}`,
1502
+ isIconButton: !0,
1503
+ tooltip: { placement: "top", title: "Remove Container" },
1504
+ onClick: N(u, ["stop"])
1505
+ }, {
1506
+ default: W(() => [
1507
+ I(f(ge), {
1508
+ class: g(P)
1509
+ })
1510
+ ]),
1511
+ _: 1
1512
+ }, 8, ["data-testid"])
1513
+ ])
1514
+ ])
1515
+ ])
1516
+ ], 2),
1517
+ o("div", {
1518
+ "data-testid": `childrenwrapper_${e.widgetKey}`,
1519
+ class: "widget-container-inner"
1520
+ }, [
1521
+ z(k.$slots, "default")
1522
+ ], 8, bt)
1523
+ ], 10, Ct));
1524
+ }
1525
+ }), us = /* @__PURE__ */ b({
1526
+ __name: "WidgetContainerRow",
1527
+ props: {
1528
+ index: {},
1529
+ maxIndex: {},
1530
+ widgetKey: { default: void 0 },
1531
+ parentWidgetKey: { default: void 0 },
1532
+ isEditing: { type: Boolean },
1533
+ highlight: { type: Boolean, default: !1 },
1534
+ testId: {},
1535
+ title: { default: "" },
1536
+ size: { default: "default" },
1537
+ borderCssClasses: {},
1538
+ backgroundCssClasses: {},
1539
+ hideTitle: { type: Boolean },
1540
+ noShadow: { type: Boolean },
1541
+ noBorder: { type: Boolean },
1542
+ noPadding: { type: Boolean },
1543
+ direction: { default: "row" },
1544
+ extraProps: {}
1545
+ },
1546
+ emits: ["removeClick", "moveClick", "selectContainer"],
1547
+ setup(t, { emit: s }) {
1548
+ const e = t, i = s, { removeClick: n, moveClick: a, selectContainer: r } = Q(i), w = p(() => {
1549
+ const { direction: c, ...u } = e;
1550
+ return u;
1551
+ });
1552
+ return (c, u) => (d(), K(me, G({ direction: "row" }, w.value, {
1553
+ onRemoveClick: f(n),
1554
+ onMoveClick: f(a),
1555
+ onSelectContainer: f(r)
1556
+ }), {
1557
+ default: W(() => [
1558
+ z(c.$slots, "default")
1559
+ ]),
1560
+ _: 3
1561
+ }, 16, ["onRemoveClick", "onMoveClick", "onSelectContainer"]));
1562
+ }
1563
+ }), gs = /* @__PURE__ */ b({
1564
+ __name: "WidgetContainerLarge",
1565
+ props: {
1566
+ index: {},
1567
+ maxIndex: {},
1568
+ widgetKey: { default: void 0 },
1569
+ parentWidgetKey: { default: void 0 },
1570
+ isEditing: { type: Boolean },
1571
+ highlight: { type: Boolean, default: !1 },
1572
+ testId: {},
1573
+ title: { default: "" },
1574
+ size: { default: "large" },
1575
+ borderCssClasses: {},
1576
+ backgroundCssClasses: {},
1577
+ hideTitle: { type: Boolean },
1578
+ noShadow: { type: Boolean },
1579
+ noBorder: { type: Boolean },
1580
+ noPadding: { type: Boolean },
1581
+ direction: { default: "column" },
1582
+ extraProps: {}
1583
+ },
1584
+ emits: ["removeClick", "moveClick", "selectContainer"],
1585
+ setup(t, { emit: s }) {
1586
+ const e = t, i = s, { removeClick: n, moveClick: a, selectContainer: r } = Q(i), w = p(() => {
1587
+ const { size: c, ...u } = e;
1588
+ return u;
1589
+ });
1590
+ return (c, u) => (d(), K(me, G({ size: "large" }, w.value, {
1591
+ onRemoveClick: f(n),
1592
+ onMoveClick: f(a),
1593
+ onSelectContainer: f(r)
1594
+ }), {
1595
+ default: W(() => [
1596
+ z(c.$slots, "default")
1597
+ ]),
1598
+ _: 3
1599
+ }, 16, ["onRemoveClick", "onMoveClick", "onSelectContainer"]));
1600
+ }
1601
+ }), $t = { class: "w-full" }, It = { class: "flex flex-row items-center gap-2 justify-between" }, Dt = { class: "font-bold" }, Wt = { class: "text-xs" }, Bt = { class: "flex flex-col gap-2 text-xs" }, J = /* @__PURE__ */ b({
1602
+ __name: "WidgetListItem",
1603
+ props: {
1604
+ widgetKey: {},
1605
+ metaData: {},
1606
+ alreadyAdded: { type: Boolean }
1607
+ },
1608
+ emits: ["addWidget"],
1609
+ setup(t, { emit: s }) {
1610
+ const e = t, i = s, n = e.metaData?.icon || Ze, a = e.metaData?.name || "Unknown", r = e.metaData?.description || "---", w = e.metaData?.noDuplicatedWidgets || !1, c = p(() => w && e?.alreadyAdded), u = p(() => E(`
1611
+ flex flex-row gap-2 p-2 rounded-md border text-sm bg-card content-card backdrop-opacity-100
1612
+ ${c.value ? "border-disabled fill-disabled text-disabled" : "cursor-pointer border-primary fill-danger hover:fill-primary content-primary hover:brightness-110"}
1613
+ `)), h = () => {
1614
+ c.value || i("addWidget");
1615
+ };
1616
+ return (x, k) => (d(), C("div", {
1617
+ class: g(u.value),
1618
+ style: { width: "calc(100% - 1rem)" },
1619
+ onClick: h
1620
+ }, [
1621
+ (d(), K(ae(f(n)), { class: "" })),
1622
+ o("div", $t, [
1623
+ o("div", It, [
1624
+ o("span", Dt, j(f(a)), 1),
1625
+ o("div", Wt, j(c.value ? "(Added)" : ""), 1)
1626
+ ]),
1627
+ o("div", Bt, [
1628
+ o("div", null, j(f(r)), 1)
1629
+ ])
1630
+ ])
1631
+ ], 2));
1632
+ }
1633
+ }), Kt = { class: "w-full" }, Mt = { class: "flex flex-row items-center gap-2 justify-between" }, St = { class: "font-bold" }, Et = { class: "flex flex-col gap-2 text-xs" }, Lt = /* @__PURE__ */ b({
1634
+ __name: "SettingListItem",
1635
+ props: {
1636
+ item: {}
1637
+ },
1638
+ emits: ["settingChanged"],
1639
+ setup(t, { emit: s }) {
1640
+ const e = t, i = s, n = e.item.name || "Unknown", a = e.item.description || "---", r = E(`
1641
+ flex flex-row gap-2 p-2 rounded-md border text-sm bg-card content-card backdrop-opacity-100
1642
+ `), w = (u) => {
1643
+ i("settingChanged", {
1644
+ ...e.item,
1645
+ value: u || ""
1646
+ });
1647
+ }, c = (u) => {
1648
+ const h = $e.incrementOrDecrementValue(e.item, u);
1649
+ i("settingChanged", h);
1650
+ };
1651
+ return (u, h) => (d(), C("div", {
1652
+ class: g(f(r)),
1653
+ style: { width: "calc(100% - 1rem)" }
1654
+ }, [
1655
+ o("div", Kt, [
1656
+ o("div", Mt, [
1657
+ o("span", St, j(f(n)), 1)
1658
+ ]),
1659
+ o("div", Et, [
1660
+ o("div", null, j(f(a)), 1)
1661
+ ]),
1662
+ o("div", null, [
1663
+ h[2] || (h[2] = re(" Value: ", -1)),
1664
+ I(f(he), {
1665
+ label: "Filter...",
1666
+ size: "small",
1667
+ class: "w-full",
1668
+ modelValue: t.item.value,
1669
+ "onUpdate:modelValue": w,
1670
+ onKeydown: [
1671
+ h[0] || (h[0] = oe(N((x) => c(1), ["prevent"]), ["up"])),
1672
+ h[1] || (h[1] = oe(N((x) => c(-1), ["prevent"]), ["down"]))
1673
+ ]
1674
+ }, null, 8, ["modelValue"])
1675
+ ])
1676
+ ])
1677
+ ], 2));
1678
+ }
1679
+ }), Nt = { class: "flex flex-col gap-2 p-2" }, Tt = { class: "flex flex-row gap-2 justify-between" }, jt = { class: "handle flex-1 flex gap-2 w-full hover:text-primary cursor-grab" }, zt = ["title"], At = { class: "flex flex-row gap-2 items-center" }, Ht = { class: "flex border-b border-gray-200" }, Rt = { class: "flex items-center justify-between gap-1 w-full" }, Vt = {
1680
+ class: "flex flex-col gap-2 overflow-x-hidden overflow-y-auto",
1681
+ style: { "max-height": "360px" }
1682
+ }, Ut = { class: "mt-4 w-full flex flex-row justify-end pt-1" }, hs = /* @__PURE__ */ b({
1683
+ __name: "WidgetsCatalogFlyout",
1684
+ props: {
1685
+ targetContainerKey: {},
1686
+ widgetsCatalog: {},
1687
+ currentDashboardConfig: {},
1688
+ undoStatus: {},
1689
+ addWidget: { type: Function },
1690
+ addContainer: { type: Function },
1691
+ onSettingItemsUpdated: { type: Function },
1692
+ onResetToDefaultDashboardClick: { type: Function },
1693
+ onUndoOrRedo: { type: Function },
1694
+ onDoneClick: { type: Function }
1695
+ },
1696
+ setup(t) {
1697
+ const s = t, e = (m, l) => [
1698
+ ...l.widgets.filter((V) => V.indexOf("Container") === -1),
1699
+ ...l.childWidgetsConfig.map((V) => V.widgetKey)
1700
+ ].includes(m), i = R("Editing"), n = R(0), a = R(""), r = R(!1), w = p(() => Array.from(s.widgetsCatalog.keys())), c = p(() => w.value.map((m) => ({
1701
+ widgetKey: m,
1702
+ metaData: Ie(m, s.widgetsCatalog)
1703
+ }))), u = p(() => c.value.filter(
1704
+ (m) => m.metaData.categories.includes("Widget") && D(m.metaData)
1705
+ )), h = p(() => c.value.filter(
1706
+ (m) => m.metaData.categories.includes("Chart") && D(m.metaData)
1707
+ )), x = p(() => c.value.filter(
1708
+ (m) => m.metaData.categories.includes("Container") && D(m.metaData)
1709
+ )), k = p(() => !!s.targetContainerKey), $ = (m) => {
1710
+ a.value = m;
1711
+ }, D = (m) => {
1712
+ const l = a.value.trim().toLowerCase();
1713
+ return l.length < 1 ? !0 : m.name.trim().toLowerCase().includes(l) || m.description.toLowerCase().includes(l);
1714
+ }, _ = (m) => {
1715
+ const l = a.value.trim().toLowerCase();
1716
+ return l.length < 1 ? !0 : m.name.trim().toLowerCase().includes(l) || m.description.toLowerCase().includes(l);
1717
+ }, B = (m) => E(
1718
+ "px-4 py-2 font-medium cursor-pointer border-b-2 border-transparent hover:border-primary focus:outline-none",
1719
+ m === n.value ? "text-primary border-primary" : ""
1720
+ ), H = (m) => {
1721
+ k.value ? s.addWidget(m, s.targetContainerKey) : s.addWidget(m);
1722
+ }, L = (m) => {
1723
+ const l = (s.currentDashboardConfig.cssSettings || []).map((v) => v.key === m.key ? m : v);
1724
+ s.onSettingItemsUpdated(l);
1725
+ }, A = (m) => {
1726
+ r.value = m;
1727
+ };
1728
+ return be(
1729
+ () => s.targetContainerKey,
1730
+ (m) => {
1731
+ if (m) {
1732
+ n.value = 0;
1733
+ const l = de(m);
1734
+ i.value = `Editing ${l}`;
1735
+ } else
1736
+ i.value = "Editing Dashboard";
1737
+ },
1738
+ { immediate: !0 }
1739
+ ), (m, l) => (d(), K(f(ot), {
1740
+ testId: "dashboard-catalog-flyout",
1741
+ className: "bg-body content-body bg-opacity-70 border-2 border-primary",
1742
+ style: {
1743
+ width: "360px",
1744
+ minWidth: "360px",
1745
+ maxWidth: "360px",
1746
+ minHeight: "360px",
1747
+ backdropFilter: "blur(8px)"
1748
+ },
1749
+ onDraggingChange: A
1750
+ }, {
1751
+ default: W(() => [
1752
+ o("div", Nt, [
1753
+ o("div", Tt, [
1754
+ o("div", jt, [
1755
+ r.value ? (d(), K(f(Ge), {
1756
+ key: 0,
1757
+ class: "size-5"
1758
+ })) : (d(), K(f(Oe), {
1759
+ key: 1,
1760
+ class: "size-5"
1761
+ })),
1762
+ o("h2", {
1763
+ class: "flex-1 text-base margin-0 capitalize",
1764
+ title: k.value ? i.value : `Editing dashboard: ${t.currentDashboardConfig.dashboardName}`
1765
+ }, j(i.value), 9, zt)
1766
+ ]),
1767
+ o("div", At, [
1768
+ I(f(T), {
1769
+ "data-testid": "undo-dashboard-config-change",
1770
+ isIconButton: !0,
1771
+ tooltip: {
1772
+ placement: "bottom",
1773
+ title: "Undo"
1774
+ },
1775
+ disabled: t.undoStatus.isUndoDisabled,
1776
+ onClick: l[0] || (l[0] = (v) => t.onUndoOrRedo("Undo"))
1777
+ }, {
1778
+ default: W(() => [
1779
+ I(f(Fe), { class: "size-5" })
1780
+ ]),
1781
+ _: 1
1782
+ }, 8, ["disabled"]),
1783
+ I(f(T), {
1784
+ "data-testid": "redo-dashboard-config-change",
1785
+ isIconButton: !0,
1786
+ tooltip: {
1787
+ placement: "bottom",
1788
+ title: "Redo"
1789
+ },
1790
+ disabled: t.undoStatus.isRedoDisabled,
1791
+ onClick: l[1] || (l[1] = (v) => t.onUndoOrRedo("Redo"))
1792
+ }, {
1793
+ default: W(() => [
1794
+ I(f(Pe), { class: "size-5" })
1795
+ ]),
1796
+ _: 1
1797
+ }, 8, ["disabled"]),
1798
+ I(f(T), {
1799
+ "data-testid": "reset-dashboard-to-default",
1800
+ isIconButton: !0,
1801
+ tooltip: {
1802
+ placement: "bottom",
1803
+ title: "Reset this dashboard to the default configuration"
1804
+ },
1805
+ onClick: t.onResetToDefaultDashboardClick
1806
+ }, {
1807
+ default: W(() => [
1808
+ I(f(Ue), { class: "size-5" })
1809
+ ]),
1810
+ _: 1
1811
+ }, 8, ["onClick"])
1812
+ ])
1813
+ ]),
1814
+ o("div", Ht, [
1815
+ o("button", {
1816
+ onClick: l[2] || (l[2] = (v) => n.value = 0),
1817
+ class: g(B(0))
1818
+ }, "Widgets", 2),
1819
+ o("button", {
1820
+ onClick: l[3] || (l[3] = (v) => n.value = 1),
1821
+ class: g(B(1))
1822
+ }, "Charts", 2),
1823
+ k.value ? O("", !0) : (d(), C("button", {
1824
+ key: 0,
1825
+ onClick: l[4] || (l[4] = (v) => n.value = 2),
1826
+ class: g(B(2))
1827
+ }, " Containers ", 2)),
1828
+ k.value ? O("", !0) : (d(), C("button", {
1829
+ key: 1,
1830
+ onClick: l[5] || (l[5] = (v) => n.value = 3),
1831
+ class: g(B(3))
1832
+ }, [
1833
+ I(f(Ve))
1834
+ ], 2))
1835
+ ]),
1836
+ o("div", Rt, [
1837
+ I(f(he), {
1838
+ label: "Filter...",
1839
+ size: "small",
1840
+ class: "w-full",
1841
+ modelValue: a.value,
1842
+ "onUpdate:modelValue": [
1843
+ l[6] || (l[6] = (v) => a.value = v),
1844
+ $
1845
+ ]
1846
+ }, null, 8, ["modelValue"])
1847
+ ]),
1848
+ o("div", Vt, [
1849
+ n.value === 0 ? (d(!0), C(U, { key: 0 }, F(u.value, (v) => (d(), K(J, {
1850
+ key: v.widgetKey,
1851
+ widgetKey: v.widgetKey,
1852
+ metaData: v.metaData,
1853
+ alreadyAdded: e(v.widgetKey, t.currentDashboardConfig),
1854
+ onAddWidget: () => H(v.widgetKey)
1855
+ }, null, 8, ["widgetKey", "metaData", "alreadyAdded", "onAddWidget"]))), 128)) : n.value === 1 ? (d(!0), C(U, { key: 1 }, F(h.value, (v) => (d(), K(J, {
1856
+ key: v.widgetKey,
1857
+ widgetKey: v.widgetKey,
1858
+ metaData: v.metaData,
1859
+ alreadyAdded: e(v.widgetKey, t.currentDashboardConfig),
1860
+ onAddWidget: () => H(v.widgetKey)
1861
+ }, null, 8, ["widgetKey", "metaData", "alreadyAdded", "onAddWidget"]))), 128)) : n.value === 2 && !k.value ? (d(!0), C(U, { key: 2 }, F(x.value, (v) => (d(), K(J, {
1862
+ key: v.widgetKey,
1863
+ widgetKey: v.widgetKey,
1864
+ metaData: v.metaData,
1865
+ alreadyAdded: e(v.widgetKey, t.currentDashboardConfig),
1866
+ onAddWidget: () => t.addContainer(v.widgetKey)
1867
+ }, null, 8, ["widgetKey", "metaData", "alreadyAdded", "onAddWidget"]))), 128)) : n.value === 3 && !k.value ? (d(!0), C(U, { key: 3 }, F((t.currentDashboardConfig.cssSettings || []).filter(
1868
+ _
1869
+ ), (v) => (d(), K(Lt, {
1870
+ key: v.key,
1871
+ item: v,
1872
+ onSettingChanged: L
1873
+ }, null, 8, ["item"]))), 128)) : O("", !0)
1874
+ ]),
1875
+ o("div", Ut, [
1876
+ I(f(T), {
1877
+ class: "bg-opacity-100",
1878
+ tooltip: {
1879
+ placement: "bottom",
1880
+ title: "Click to exit edit mode"
1881
+ },
1882
+ onClick: t.onDoneClick
1883
+ }, {
1884
+ default: W(() => [...l[7] || (l[7] = [
1885
+ re(" Done ", -1)
1886
+ ])]),
1887
+ _: 1
1888
+ }, 8, ["onClick"])
1889
+ ])
1890
+ ])
1891
+ ]),
1892
+ _: 1
1893
+ }));
1894
+ }
1895
+ });
1896
+ export {
1897
+ qt as AddIcon,
1898
+ T as Button,
1899
+ Ze as CircleQuestionMarkIcon,
1900
+ qe as CrosshairIcon,
1901
+ ds as DashboardGrid,
1902
+ cs as DashboardWidgetBase,
1903
+ Zt as DeleteIcon,
1904
+ ot as DraggablePanel,
1905
+ ls as DynamicWidgetLoader,
1906
+ Xt as EditIcon,
1907
+ Qt as GridIcon,
1908
+ Ge as HandGrabIcon,
1909
+ Oe as HandIcon,
1910
+ ns as ListItem,
1911
+ ss as MonitorIcon,
1912
+ es as MonitorSmartphoneIcon,
1913
+ ce as MoveLeftIcon,
1914
+ ue as MoveRightIcon,
1915
+ Pe as RedoIcon,
1916
+ Ve as SettingsIcon,
1917
+ Ye as Stack,
1918
+ ts as TabletSmartphoneIcon,
1919
+ os as TargetIcon,
1920
+ he as TextField,
1921
+ Ue as TimerResetIcon,
1922
+ Fe as UndoIcon,
1923
+ me as WidgetContainerColumn,
1924
+ gs as WidgetContainerLarge,
1925
+ us as WidgetContainerRow,
1926
+ hs as WidgetsCatalogFlyout,
1927
+ is as WrapperColumnContent,
1928
+ as as WrapperColumnContentListItem,
1929
+ ge as XCircleIcon,
1930
+ Yt as ZoomInIcon,
1931
+ Jt as ZoomOutIcon,
1932
+ rs as showToast,
1933
+ Ot as useDashboardStore,
1934
+ Gt as useDashboardUndoService,
1935
+ Q as useWidgetEmits
1936
+ };