@factorialco/f0-react 1.413.0 → 1.414.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.
@@ -1 +1 @@
1
- .grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;left:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;touch-action:none}.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle,.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing,.grid-stack-animate .grid-stack-item.grid-stack-placeholder{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0%}.grid-stack-item .ui-resizable-handle{bottom:12px;right:12px;--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));overflow:hidden;border-radius:.625rem}.grid-stack-item .ui-resizable-se:after{content:"";position:absolute;inset:0;background-image:url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.1904 11.6904C17.4443 11.4366 17.8565 11.4366 18.1104 11.6904C18.3641 11.9443 18.3642 12.3565 18.1104 12.6104L12.6104 18.1104C12.3565 18.3642 11.9443 17.3641 11.6904 18.1104C11.4366 17.8565 11.4366 17.4443 11.6904 17.1904L17.1904 11.6904ZM16.1904 6.19043C16.4443 5.93659 16.8565 5.93659 17.1104 6.19043C17.3641 6.44427 17.3642 6.85653 17.1104 7.11035L7.11035 17.1104C6.85653 17.3642 6.44427 17.3641 6.19043 17.1104C5.93659 16.8565 5.93659 16.4443 6.19043 16.1904L16.1904 6.19043Z' fill='%23A1ABBD'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:center;background-size:contain;width:100%;height:100%;background-color:#fff}.ui-draggable-dragging>.grid-stack-item-content{background-color:transparent!important;--tw-shadow: 0 0 #0000 !important;--tw-shadow-colored: 0 0 #0000 !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.ui-draggable-dragging>.grid-stack-item-content>*{transform-origin:24px 24px;--tw-scale-x: .95 !important;--tw-scale-y: .95 !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important;cursor:grabbing;border-radius:.875rem;border-color:hsl(var(--neutral-40));--tw-shadow: 0 6px 12px 0 hsl(var(--shadow)/.06),0 16px 24px -12px hsl(var(--shadow)/.05);--tw-shadow-colored: 0 6px 12px 0 var(--tw-shadow-color), 0 16px 24px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.ui.draggable-dragging{cursor:grabbing!important}.grid-stack-placeholder>.placeholder-content{border-radius:.875rem;background-color:hsl(var(--neutral-100) / .05);opacity:.5;--tw-blur: blur(2px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.grid-stack-item>.grid-stack-item-content{overflow:visible!important}.ui-resizable-resizing>.grid-stack-item-content{border-radius:.875rem}._rfx31ssb:before{border-radius:50%}._15m6ys7w:before{border-color:var(--stroke-color)}._3l8810ly:before{border-width:var(--stroke-width)}._kzdanqa1:before{border-style:solid}._13y0usvi:before{box-sizing:border-box}._154ifghn{top:var(--line-main-axis-start)}._154ihv0e{top:var(--main-axis-offset)}._19wo70hn:before{bottom:var(--terminal-cross-axis-offset)}._1auk70hn:before{top:var(--terminal-cross-axis-offset)}._1aukuj5p:before{top:var(--terminal-main-axis-start)}._1bsb10ly{width:var(--stroke-width)}._1cs8stnw:before{position:absolute}._1e02fghn{inset-inline-start:var(--line-main-axis-start)}._1e0c1ule{display:block}._1kt9b3bt:before{content:""}._1ltvhv0e{left:var(--main-axis-offset)}._1mp4vjfa:before{width:var(--terminal-diameter)}._1pbykb7n{z-index:1}._1xi2hv0e{right:var(--main-axis-offset)}._4t3i10ly{height:var(--stroke-width)}._94n5hv0e{bottom:var(--main-axis-offset)}._94n5idpf{bottom:0}._bfhkys7w{background-color:var(--stroke-color)}._cfu11ld9:before{display:var(--terminal-display)}._kfgtvjfa:before{height:var(--terminal-diameter)}._kqswstnw{position:absolute}._lcxvglyw{pointer-events:none}._ooun70hn:before{right:var(--terminal-cross-axis-offset)}._qnec70hn:before{left:var(--terminal-cross-axis-offset)}._rjxpidpf{inset-inline-end:0}._z5wtuj5p:before{inset-inline-start:var(--terminal-main-axis-start)}
1
+ .grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;left:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;touch-action:none}.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle,.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing,.grid-stack-animate .grid-stack-item.grid-stack-placeholder{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0%}.grid-stack-item .ui-resizable-handle{bottom:12px;right:12px;--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));overflow:hidden;border-radius:.625rem}.grid-stack-item .ui-resizable-se:after{content:"";position:absolute;inset:0;background-image:url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.1904 11.6904C17.4443 11.4366 17.8565 11.4366 18.1104 11.6904C18.3641 11.9443 18.3642 12.3565 18.1104 12.6104L12.6104 18.1104C12.3565 18.3642 11.9443 17.3641 11.6904 18.1104C11.4366 17.8565 11.4366 17.4443 11.6904 17.1904L17.1904 11.6904ZM16.1904 6.19043C16.4443 5.93659 16.8565 5.93659 17.1104 6.19043C17.3641 6.44427 17.3642 6.85653 17.1104 7.11035L7.11035 17.1104C6.85653 17.3642 6.44427 17.3641 6.19043 17.1104C5.93659 16.8565 5.93659 16.4443 6.19043 16.1904L16.1904 6.19043Z' fill='%23A1ABBD'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:center;background-size:contain;width:100%;height:100%;background-color:#fff}.ui-draggable-dragging>.grid-stack-item-content{background-color:transparent!important;--tw-shadow: 0 0 #0000 !important;--tw-shadow-colored: 0 0 #0000 !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.ui-draggable-dragging>.grid-stack-item-content>*{transform-origin:24px 24px;--tw-scale-x: .95 !important;--tw-scale-y: .95 !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important;cursor:grabbing;border-radius:.875rem;border-color:hsl(var(--neutral-40));--tw-shadow: 0 6px 12px 0 hsl(var(--shadow)/.06),0 16px 24px -12px hsl(var(--shadow)/.05);--tw-shadow-colored: 0 6px 12px 0 var(--tw-shadow-color), 0 16px 24px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.ui.draggable-dragging{cursor:grabbing!important}.grid-stack-placeholder>.placeholder-content{border-radius:.875rem;background-color:hsl(var(--neutral-100) / .05);opacity:.5;--tw-blur: blur(2px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.grid-stack-item>.grid-stack-item-content{overflow:visible!important}.ui-resizable-resizing>.grid-stack-item-content{border-radius:.875rem}
@@ -346,8 +346,10 @@ declare module "@tiptap/core" {
346
346
 
347
347
  declare module "@tiptap/core" {
348
348
  interface Commands<ReturnType> {
349
- transcript: {
350
- insertTranscript: (data: TranscriptData) => ReturnType;
349
+ videoEmbed: {
350
+ setVideoEmbed: (options: {
351
+ src: string;
352
+ }) => ReturnType;
351
353
  };
352
354
  }
353
355
  }
@@ -355,10 +357,8 @@ declare module "@tiptap/core" {
355
357
 
356
358
  declare module "@tiptap/core" {
357
359
  interface Commands<ReturnType> {
358
- videoEmbed: {
359
- setVideoEmbed: (options: {
360
- src: string;
361
- }) => ReturnType;
360
+ transcript: {
361
+ insertTranscript: (data: TranscriptData) => ReturnType;
362
362
  };
363
363
  }
364
364
  }
@@ -1,4 +1,292 @@
1
- import { F as r } from "./F0ChatDashboard-e_oKQtbl.js";
1
+ import { jsx as $ } from "react/jsx-runtime";
2
+ import { useRef as w, useCallback as v, useState as j, useEffect as R, useMemo as D } from "react";
3
+ import { F as P } from "./F0AnalyticsDashboard-Doa70ufI.js";
4
+ function _(t, e, n) {
5
+ const r = w(null), y = w(), i = w(t);
6
+ i.current = t;
7
+ const l = w(e);
8
+ l.current = e;
9
+ const b = w(n);
10
+ b.current = n;
11
+ const u = v(
12
+ (h, f) => {
13
+ const S = `${b.current}:${JSON.stringify(f)}`;
14
+ if (r.current?.key === S)
15
+ return r.current.promise.then(
16
+ (d) => d.results[h] ?? { error: "No result for item" }
17
+ );
18
+ r.current?.controller.abort();
19
+ const o = new AbortController(), s = i.current, c = l.current, g = {};
20
+ for (const [d, m] of Object.entries(f))
21
+ Array.isArray(m) && m.length > 0 && (g[d] = m.map(String));
22
+ const a = {
23
+ fetchSpecs: s.fetchSpecs,
24
+ items: s.items,
25
+ filters: s.filters,
26
+ filterValues: Object.keys(g).length > 0 ? g : void 0
27
+ }, F = fetch(`${c.baseUrl}/dashboard/compute`, {
28
+ method: "POST",
29
+ credentials: "include",
30
+ headers: {
31
+ "Content-Type": "application/json",
32
+ ...c.headers
33
+ },
34
+ body: JSON.stringify(a),
35
+ signal: o.signal
36
+ }).then(async (d) => {
37
+ if (!d.ok) {
38
+ const k = await d.text().catch(() => "");
39
+ throw new Error(`Dashboard compute failed: ${d.status} ${k}`);
40
+ }
41
+ const m = await d.json();
42
+ return y.current = m, m;
43
+ });
44
+ return r.current = { key: S, promise: F, controller: o }, F.then(
45
+ (d) => d.results[h] ?? { error: "No result for item" }
46
+ );
47
+ },
48
+ []
49
+ ), p = v(
50
+ () => y.current?.filterOptions,
51
+ []
52
+ );
53
+ return { fetchItem: u, getFilterOptions: p };
54
+ }
55
+ function A(t) {
56
+ if (t)
57
+ switch (t.type) {
58
+ case "number":
59
+ return (e) => e.toLocaleString();
60
+ case "currency": {
61
+ const e = t.currency ?? "EUR";
62
+ return (n) => {
63
+ try {
64
+ return n.toLocaleString(void 0, {
65
+ style: "currency",
66
+ currency: e,
67
+ maximumFractionDigits: 0
68
+ });
69
+ } catch {
70
+ return `${n}`;
71
+ }
72
+ };
73
+ }
74
+ case "percent":
75
+ return (e) => `${e}%`;
76
+ case "compact":
77
+ return (e) => Math.abs(e) >= 1e6 ? `${(e / 1e6).toFixed(1)}M` : Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : `${e}`;
78
+ default:
79
+ return;
80
+ }
81
+ }
82
+ function I(t) {
83
+ const e = A(
84
+ "valueFormat" in t ? t.valueFormat : void 0
85
+ );
86
+ switch (t.type) {
87
+ case "bar": {
88
+ const { valueFormat: n, ...r } = t;
89
+ return { ...r, ...e ? { valueFormatter: e } : {} };
90
+ }
91
+ case "line": {
92
+ const { valueFormat: n, ...r } = t;
93
+ return { ...r, ...e ? { valueFormatter: e } : {} };
94
+ }
95
+ case "funnel": {
96
+ const { valueFormat: n, ...r } = t;
97
+ return { ...r, ...e ? { valueFormatter: e } : {} };
98
+ }
99
+ case "radar": {
100
+ const { valueFormat: n, ...r } = t;
101
+ return { ...r, ...e ? { valueFormatter: e } : {} };
102
+ }
103
+ case "pie": {
104
+ const { valueFormat: n, ...r } = t;
105
+ return { ...r, ...e ? { valueFormatter: e } : {} };
106
+ }
107
+ case "gauge": {
108
+ const { valueFormat: n, ...r } = t;
109
+ return { ...r, ...e ? { valueFormatter: e } : {} };
110
+ }
111
+ case "heatmap": {
112
+ const { valueFormat: n, ...r } = t;
113
+ return { ...r, ...e ? { valueFormatter: e } : {} };
114
+ }
115
+ }
116
+ }
117
+ const x = 20;
118
+ function C({
119
+ config: t,
120
+ apiConfig: e,
121
+ refreshKey: n = 0,
122
+ editMode: r,
123
+ onLayoutChange: y
124
+ }) {
125
+ const { fetchItem: i, getFilterOptions: l } = _(
126
+ t,
127
+ e,
128
+ n
129
+ ), [b, u] = j(), p = w(!1);
130
+ R(() => {
131
+ p.current = !1;
132
+ }, [n]), R(() => {
133
+ if (p.current) return;
134
+ const o = setInterval(() => {
135
+ const s = l();
136
+ s && (u(s), p.current = !0, clearInterval(o));
137
+ }, 100);
138
+ return () => clearInterval(o);
139
+ }, [l, n]);
140
+ const h = D(() => {
141
+ const o = t.filters;
142
+ if (!o || Object.keys(o).length === 0 || !b) return;
143
+ const s = {};
144
+ for (const [c, g] of Object.entries(o)) {
145
+ const a = b[c] ?? [];
146
+ a.length !== 0 && (s[c] = {
147
+ type: "in",
148
+ label: g.label,
149
+ options: {
150
+ options: a.map((F) => ({ value: F, label: F }))
151
+ }
152
+ });
153
+ }
154
+ if (Object.keys(s).length !== 0)
155
+ return s;
156
+ }, [t.filters, b]), f = v(
157
+ (o) => (s) => {
158
+ const c = {};
159
+ for (const [g, a] of Object.entries(s))
160
+ Array.isArray(a) && a.length > 0 && (c[g] = a);
161
+ return i(o, c).then((g) => {
162
+ const a = l();
163
+ return a && !p.current && (u(a), p.current = !0), g;
164
+ });
165
+ },
166
+ [i, l]
167
+ ), S = D(
168
+ () => t.items.map((o) => {
169
+ switch (o.type) {
170
+ case "chart":
171
+ return E(o, f(o.id));
172
+ case "metric":
173
+ return L(o, f(o.id));
174
+ case "collection":
175
+ return M(o, f(o.id));
176
+ }
177
+ }),
178
+ [t.items, f]
179
+ );
180
+ return /* @__PURE__ */ $(
181
+ P,
182
+ {
183
+ filters: h,
184
+ items: S,
185
+ editMode: r,
186
+ onLayoutChange: y
187
+ },
188
+ n
189
+ );
190
+ }
191
+ C.displayName = "F0ChatDashboard";
192
+ function E(t, e) {
193
+ return {
194
+ id: t.id,
195
+ title: t.title,
196
+ description: O(t.description, t.sourceDescription),
197
+ colSpan: t.colSpan,
198
+ rowSpan: t.rowSpan,
199
+ x: t.x,
200
+ y: t.y,
201
+ type: "chart",
202
+ chart: I(t.chart),
203
+ fetchData: (n) => e(n).then((r) => r.chart ?? { categories: [], series: [] })
204
+ };
205
+ }
206
+ function O(t, e) {
207
+ return e ? t ? `${t}
208
+ ${e}` : e : t;
209
+ }
210
+ function L(t, e) {
211
+ return {
212
+ id: t.id,
213
+ title: t.title,
214
+ description: O(t.description, t.sourceDescription),
215
+ colSpan: t.colSpan,
216
+ rowSpan: t.rowSpan,
217
+ x: t.x,
218
+ y: t.y,
219
+ type: "metric",
220
+ format: t.format,
221
+ decimals: t.decimals,
222
+ fetchData: (n) => e(n).then((r) => r.metric ?? { value: 0 })
223
+ };
224
+ }
225
+ function M(t, e) {
226
+ return {
227
+ id: t.id,
228
+ title: t.title,
229
+ description: O(t.description, t.sourceDescription),
230
+ colSpan: t.colSpan ?? 12,
231
+ rowSpan: t.rowSpan,
232
+ x: t.x,
233
+ y: t.y,
234
+ type: "collection",
235
+ createSource: (n) => {
236
+ let r = null;
237
+ const y = e(n).then((i) => (r = i.collection?.rows ?? [], r));
238
+ return {
239
+ dataAdapter: {
240
+ paginationType: "pages",
241
+ perPage: x,
242
+ fetchData: async ({
243
+ pagination: i,
244
+ search: l
245
+ }) => {
246
+ let u = r ?? await y;
247
+ if (l) {
248
+ const o = l.toLowerCase();
249
+ u = u.filter(
250
+ (s) => Object.values(s).some(
251
+ (c) => c != null && String(c).toLowerCase().includes(o)
252
+ )
253
+ );
254
+ }
255
+ const p = i?.currentPage ?? 1, h = i?.perPage ?? x, f = (p - 1) * h;
256
+ return {
257
+ type: "pages",
258
+ records: u.slice(f, f + h),
259
+ total: u.length,
260
+ currentPage: p,
261
+ perPage: h,
262
+ pagesCount: Math.ceil(u.length / h)
263
+ };
264
+ }
265
+ },
266
+ search: {
267
+ enabled: !0,
268
+ sync: !0
269
+ }
270
+ };
271
+ },
272
+ visualizations: [
273
+ {
274
+ type: "table",
275
+ options: {
276
+ columns: t.columns.map((n) => ({
277
+ label: n.label,
278
+ id: n.id,
279
+ ...n.width ? { width: n.width } : {},
280
+ render: (r) => {
281
+ const y = r[n.id];
282
+ return y == null ? "-" : String(y);
283
+ }
284
+ }))
285
+ }
286
+ }
287
+ ]
288
+ };
289
+ }
2
290
  export {
3
- r as F0ChatDashboard
291
+ C as F0ChatDashboard
4
292
  };