@object-ui/plugin-report 3.0.3 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
- import { ComponentRegistry as L } from "@object-ui/core";
2
- import ke, { useState as W } from "react";
3
- import { Card as B, CardHeader as ee, CardTitle as te, CardDescription as he, CardContent as z, Button as F, Label as b, Input as A, Tabs as Re, TabsList as Se, TabsTrigger as U, TabsContent as Y } from "@object-ui/components";
4
- import { SchemaRenderer as pe } from "@object-ui/react";
5
- import { RefreshCw as Ee, Printer as Te, Download as de, Calendar as je, Clock as Fe, Mail as _e, Settings as Ae, Layers as ue, Filter as $e, Plus as V, Trash2 as ae, Save as Oe } from "lucide-react";
6
- var me = { exports: {} }, Q = {};
1
+ import { ComponentRegistry as U } from "@object-ui/core";
2
+ import * as Ee from "react";
3
+ import ve, { useState as J } from "react";
4
+ import { Card as V, CardHeader as ae, CardTitle as se, CardDescription as he, CardContent as Y, Button as E, Skeleton as ne, Badge as Ae, Label as j, Input as M, Tabs as Fe, TabsList as _e, TabsTrigger as W, TabsContent as H, useConfigDraft as $e, ConfigPanelRenderer as Oe, Checkbox as Pe } from "@object-ui/components";
5
+ import { SchemaRenderer as xe } from "@object-ui/react";
6
+ import { RefreshCw as De, Printer as Le, Download as ue, Calendar as je, Clock as Be, Mail as Me, Settings as ze, Layers as me, Filter as Ie, Plus as G, Trash2 as X, Save as Ge } from "lucide-react";
7
+ var pe = { exports: {} }, ee = {};
7
8
  /**
8
9
  * @license React
9
10
  * react-jsx-runtime.production.js
@@ -13,29 +14,29 @@ var me = { exports: {} }, Q = {};
13
14
  * This source code is licensed under the MIT license found in the
14
15
  * LICENSE file in the root directory of this source tree.
15
16
  */
16
- var xe;
17
- function Pe() {
18
- if (xe) return Q;
19
- xe = 1;
20
- var r = Symbol.for("react.transitional.element"), i = Symbol.for("react.fragment");
21
- function s(c, d, p) {
22
- var f = null;
23
- if (p !== void 0 && (f = "" + p), d.key !== void 0 && (f = "" + d.key), "key" in d) {
24
- p = {};
25
- for (var n in d)
26
- n !== "key" && (p[n] = d[n]);
27
- } else p = d;
28
- return d = p.ref, {
29
- $$typeof: r,
30
- type: c,
31
- key: f,
32
- ref: d !== void 0 ? d : null,
33
- props: p
17
+ var fe;
18
+ function Ue() {
19
+ if (fe) return ee;
20
+ fe = 1;
21
+ var s = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
22
+ function a(o, c, x) {
23
+ var u = null;
24
+ if (x !== void 0 && (u = "" + x), c.key !== void 0 && (u = "" + c.key), "key" in c) {
25
+ x = {};
26
+ for (var t in c)
27
+ t !== "key" && (x[t] = c[t]);
28
+ } else x = c;
29
+ return c = x.ref, {
30
+ $$typeof: s,
31
+ type: o,
32
+ key: u,
33
+ ref: c !== void 0 ? c : null,
34
+ props: x
34
35
  };
35
36
  }
36
- return Q.Fragment = i, Q.jsx = s, Q.jsxs = s, Q;
37
+ return ee.Fragment = n, ee.jsx = a, ee.jsxs = a, ee;
37
38
  }
38
- var K = {};
39
+ var te = {};
39
40
  /**
40
41
  * @license React
41
42
  * react-jsx-runtime.development.js
@@ -45,311 +46,311 @@ var K = {};
45
46
  * This source code is licensed under the MIT license found in the
46
47
  * LICENSE file in the root directory of this source tree.
47
48
  */
48
- var fe;
49
- function Le() {
50
- return fe || (fe = 1, process.env.NODE_ENV !== "production" && function() {
51
- function r(t) {
52
- if (t == null) return null;
53
- if (typeof t == "function")
54
- return t.$$typeof === ne ? null : t.displayName || t.name || null;
55
- if (typeof t == "string") return t;
56
- switch (t) {
57
- case N:
49
+ var be;
50
+ function Ve() {
51
+ return be || (be = 1, process.env.NODE_ENV !== "production" && function() {
52
+ function s(l) {
53
+ if (l == null) return null;
54
+ if (typeof l == "function")
55
+ return l.$$typeof === Z ? null : l.displayName || l.name || null;
56
+ if (typeof l == "string") return l;
57
+ switch (l) {
58
+ case m:
58
59
  return "Fragment";
59
- case g:
60
+ case C:
60
61
  return "Profiler";
61
- case k:
62
+ case N:
62
63
  return "StrictMode";
63
- case O:
64
+ case $:
64
65
  return "Suspense";
65
- case q:
66
+ case P:
66
67
  return "SuspenseList";
67
- case J:
68
+ case B:
68
69
  return "Activity";
69
70
  }
70
- if (typeof t == "object")
71
- switch (typeof t.tag == "number" && console.error(
71
+ if (typeof l == "object")
72
+ switch (typeof l.tag == "number" && console.error(
72
73
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
73
- ), t.$$typeof) {
74
- case v:
74
+ ), l.$$typeof) {
75
+ case k:
75
76
  return "Portal";
77
+ case g:
78
+ return l.displayName || "Context";
79
+ case y:
80
+ return (l._context.displayName || "Context") + ".Consumer";
81
+ case T:
82
+ var b = l.render;
83
+ return l = l.displayName, l || (l = b.displayName || b.name || "", l = l !== "" ? "ForwardRef(" + l + ")" : "ForwardRef"), l;
76
84
  case D:
77
- return t.displayName || "Context";
78
- case _:
79
- return (t._context.displayName || "Context") + ".Consumer";
80
- case M:
81
- var x = t.render;
82
- return t = t.displayName, t || (t = x.displayName || x.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
83
- case H:
84
- return x = t.displayName || null, x !== null ? x : r(t.type) || "Memo";
85
- case I:
86
- x = t._payload, t = t._init;
85
+ return b = l.displayName || null, b !== null ? b : s(l.type) || "Memo";
86
+ case L:
87
+ b = l._payload, l = l._init;
87
88
  try {
88
- return r(t(x));
89
+ return s(l(b));
89
90
  } catch {
90
91
  }
91
92
  }
92
93
  return null;
93
94
  }
94
- function i(t) {
95
- return "" + t;
95
+ function n(l) {
96
+ return "" + l;
96
97
  }
97
- function s(t) {
98
+ function a(l) {
98
99
  try {
99
- i(t);
100
- var x = !1;
100
+ n(l);
101
+ var b = !1;
101
102
  } catch {
102
- x = !0;
103
+ b = !0;
103
104
  }
104
- if (x) {
105
- x = console;
106
- var C = x.error, S = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
107
- return C.call(
108
- x,
105
+ if (b) {
106
+ b = console;
107
+ var R = b.error, A = typeof Symbol == "function" && Symbol.toStringTag && l[Symbol.toStringTag] || l.constructor.name || "Object";
108
+ return R.call(
109
+ b,
109
110
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
110
- S
111
- ), i(t);
111
+ A
112
+ ), n(l);
112
113
  }
113
114
  }
114
- function c(t) {
115
- if (t === N) return "<>";
116
- if (typeof t == "object" && t !== null && t.$$typeof === I)
115
+ function o(l) {
116
+ if (l === m) return "<>";
117
+ if (typeof l == "object" && l !== null && l.$$typeof === L)
117
118
  return "<...>";
118
119
  try {
119
- var x = r(t);
120
- return x ? "<" + x + ">" : "<...>";
120
+ var b = s(l);
121
+ return b ? "<" + b + ">" : "<...>";
121
122
  } catch {
122
123
  return "<...>";
123
124
  }
124
125
  }
125
- function d() {
126
- var t = P.A;
127
- return t === null ? null : t.getOwner();
126
+ function c() {
127
+ var l = I.A;
128
+ return l === null ? null : l.getOwner();
128
129
  }
129
- function p() {
130
+ function x() {
130
131
  return Error("react-stack-top-frame");
131
132
  }
132
- function f(t) {
133
- if (se.call(t, "key")) {
134
- var x = Object.getOwnPropertyDescriptor(t, "key").get;
135
- if (x && x.isReactWarning) return !1;
133
+ function u(l) {
134
+ if (re.call(l, "key")) {
135
+ var b = Object.getOwnPropertyDescriptor(l, "key").get;
136
+ if (b && b.isReactWarning) return !1;
136
137
  }
137
- return t.key !== void 0;
138
+ return l.key !== void 0;
138
139
  }
139
- function n(t, x) {
140
- function C() {
141
- o || (o = !0, console.error(
140
+ function t(l, b) {
141
+ function R() {
142
+ h || (h = !0, console.error(
142
143
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
143
- x
144
+ b
144
145
  ));
145
146
  }
146
- C.isReactWarning = !0, Object.defineProperty(t, "key", {
147
- get: C,
147
+ R.isReactWarning = !0, Object.defineProperty(l, "key", {
148
+ get: R,
148
149
  configurable: !0
149
150
  });
150
151
  }
151
- function h() {
152
- var t = r(this.type);
153
- return u[t] || (u[t] = !0, console.error(
152
+ function i() {
153
+ var l = s(this.type);
154
+ return f[l] || (f[l] = !0, console.error(
154
155
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
155
- )), t = this.props.ref, t !== void 0 ? t : null;
156
+ )), l = this.props.ref, l !== void 0 ? l : null;
156
157
  }
157
- function l(t, x, C, S, re, ce) {
158
- var E = C.ref;
159
- return t = {
160
- $$typeof: m,
161
- type: t,
162
- key: x,
163
- props: C,
164
- _owner: S
165
- }, (E !== void 0 ? E : null) !== null ? Object.defineProperty(t, "ref", {
158
+ function r(l, b, R, A, le, ce) {
159
+ var F = R.ref;
160
+ return l = {
161
+ $$typeof: _,
162
+ type: l,
163
+ key: b,
164
+ props: R,
165
+ _owner: A
166
+ }, (F !== void 0 ? F : null) !== null ? Object.defineProperty(l, "ref", {
166
167
  enumerable: !1,
167
- get: h
168
- }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
168
+ get: i
169
+ }) : Object.defineProperty(l, "ref", { enumerable: !1, value: null }), l._store = {}, Object.defineProperty(l._store, "validated", {
169
170
  configurable: !1,
170
171
  enumerable: !1,
171
172
  writable: !0,
172
173
  value: 0
173
- }), Object.defineProperty(t, "_debugInfo", {
174
+ }), Object.defineProperty(l, "_debugInfo", {
174
175
  configurable: !1,
175
176
  enumerable: !1,
176
177
  writable: !0,
177
178
  value: null
178
- }), Object.defineProperty(t, "_debugStack", {
179
+ }), Object.defineProperty(l, "_debugStack", {
179
180
  configurable: !1,
180
181
  enumerable: !1,
181
182
  writable: !0,
182
- value: re
183
- }), Object.defineProperty(t, "_debugTask", {
183
+ value: le
184
+ }), Object.defineProperty(l, "_debugTask", {
184
185
  configurable: !1,
185
186
  enumerable: !1,
186
187
  writable: !0,
187
188
  value: ce
188
- }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
189
+ }), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l;
189
190
  }
190
- function j(t, x, C, S, re, ce) {
191
- var E = x.children;
192
- if (E !== void 0)
193
- if (S)
194
- if (ie(E)) {
195
- for (S = 0; S < E.length; S++)
196
- y(E[S]);
197
- Object.freeze && Object.freeze(E);
191
+ function p(l, b, R, A, le, ce) {
192
+ var F = b.children;
193
+ if (F !== void 0)
194
+ if (A)
195
+ if (ie(F)) {
196
+ for (A = 0; A < F.length; A++)
197
+ v(F[A]);
198
+ Object.freeze && Object.freeze(F);
198
199
  } else
199
200
  console.error(
200
201
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
201
202
  );
202
- else y(E);
203
- if (se.call(x, "key")) {
204
- E = r(t);
205
- var G = Object.keys(x).filter(function(Ce) {
206
- return Ce !== "key";
203
+ else v(F);
204
+ if (re.call(b, "key")) {
205
+ F = s(l);
206
+ var q = Object.keys(b).filter(function(Te) {
207
+ return Te !== "key";
207
208
  });
208
- S = 0 < G.length ? "{key: someKey, " + G.join(": ..., ") + ": ...}" : "{key: someKey}", Z[E + S] || (G = 0 < G.length ? "{" + G.join(": ..., ") + ": ...}" : "{}", console.error(
209
+ A = 0 < q.length ? "{key: someKey, " + q.join(": ..., ") + ": ...}" : "{key: someKey}", K[F + A] || (q = 0 < q.length ? "{" + q.join(": ..., ") + ": ...}" : "{}", console.error(
209
210
  `A props object containing a "key" prop is being spread into JSX:
210
211
  let props = %s;
211
212
  <%s {...props} />
212
213
  React keys must be passed directly to JSX without using spread:
213
214
  let props = %s;
214
215
  <%s key={someKey} {...props} />`,
215
- S,
216
- E,
217
- G,
218
- E
219
- ), Z[E + S] = !0);
216
+ A,
217
+ F,
218
+ q,
219
+ F
220
+ ), K[F + A] = !0);
220
221
  }
221
- if (E = null, C !== void 0 && (s(C), E = "" + C), f(x) && (s(x.key), E = "" + x.key), "key" in x) {
222
- C = {};
223
- for (var oe in x)
224
- oe !== "key" && (C[oe] = x[oe]);
225
- } else C = x;
226
- return E && n(
227
- C,
228
- typeof t == "function" ? t.displayName || t.name || "Unknown" : t
229
- ), l(
230
- t,
231
- E,
232
- C,
233
- d(),
234
- re,
222
+ if (F = null, R !== void 0 && (a(R), F = "" + R), u(b) && (a(b.key), F = "" + b.key), "key" in b) {
223
+ R = {};
224
+ for (var de in b)
225
+ de !== "key" && (R[de] = b[de]);
226
+ } else R = b;
227
+ return F && t(
228
+ R,
229
+ typeof l == "function" ? l.displayName || l.name || "Unknown" : l
230
+ ), r(
231
+ l,
232
+ F,
233
+ R,
234
+ c(),
235
+ le,
235
236
  ce
236
237
  );
237
238
  }
238
- function y(t) {
239
- R(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === I && (t._payload.status === "fulfilled" ? R(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
239
+ function v(l) {
240
+ S(l) ? l._store && (l._store.validated = 1) : typeof l == "object" && l !== null && l.$$typeof === L && (l._payload.status === "fulfilled" ? S(l._payload.value) && l._payload.value._store && (l._payload.value._store.validated = 1) : l._store && (l._store.validated = 1));
240
241
  }
241
- function R(t) {
242
- return typeof t == "object" && t !== null && t.$$typeof === m;
242
+ function S(l) {
243
+ return typeof l == "object" && l !== null && l.$$typeof === _;
243
244
  }
244
- var w = ke, m = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), k = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), D = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), O = Symbol.for("react.suspense"), q = Symbol.for("react.suspense_list"), H = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), J = Symbol.for("react.activity"), ne = Symbol.for("react.client.reference"), P = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, se = Object.prototype.hasOwnProperty, ie = Array.isArray, a = console.createTask ? console.createTask : function() {
245
+ var w = ve, _ = Symbol.for("react.transitional.element"), k = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), N = Symbol.for("react.strict_mode"), C = Symbol.for("react.profiler"), y = Symbol.for("react.consumer"), g = Symbol.for("react.context"), T = Symbol.for("react.forward_ref"), $ = Symbol.for("react.suspense"), P = Symbol.for("react.suspense_list"), D = Symbol.for("react.memo"), L = Symbol.for("react.lazy"), B = Symbol.for("react.activity"), Z = Symbol.for("react.client.reference"), I = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, re = Object.prototype.hasOwnProperty, ie = Array.isArray, d = console.createTask ? console.createTask : function() {
245
246
  return null;
246
247
  };
247
248
  w = {
248
- react_stack_bottom_frame: function(t) {
249
- return t();
249
+ react_stack_bottom_frame: function(l) {
250
+ return l();
250
251
  }
251
252
  };
252
- var o, u = {}, T = w.react_stack_bottom_frame.bind(
253
+ var h, f = {}, O = w.react_stack_bottom_frame.bind(
253
254
  w,
254
- p
255
- )(), X = a(c(p)), Z = {};
256
- K.Fragment = N, K.jsx = function(t, x, C) {
257
- var S = 1e4 > P.recentlyCreatedOwnerStacks++;
258
- return j(
259
- t,
260
- x,
261
- C,
255
+ x
256
+ )(), Q = d(o(x)), K = {};
257
+ te.Fragment = m, te.jsx = function(l, b, R) {
258
+ var A = 1e4 > I.recentlyCreatedOwnerStacks++;
259
+ return p(
260
+ l,
261
+ b,
262
+ R,
262
263
  !1,
263
- S ? Error("react-stack-top-frame") : T,
264
- S ? a(c(t)) : X
264
+ A ? Error("react-stack-top-frame") : O,
265
+ A ? d(o(l)) : Q
265
266
  );
266
- }, K.jsxs = function(t, x, C) {
267
- var S = 1e4 > P.recentlyCreatedOwnerStacks++;
268
- return j(
269
- t,
270
- x,
271
- C,
267
+ }, te.jsxs = function(l, b, R) {
268
+ var A = 1e4 > I.recentlyCreatedOwnerStacks++;
269
+ return p(
270
+ l,
271
+ b,
272
+ R,
272
273
  !0,
273
- S ? Error("react-stack-top-frame") : T,
274
- S ? a(c(t)) : X
274
+ A ? Error("react-stack-top-frame") : O,
275
+ A ? d(o(l)) : Q
275
276
  );
276
277
  };
277
- }()), K;
278
+ }()), te;
278
279
  }
279
- process.env.NODE_ENV === "production" ? me.exports = Pe() : me.exports = Le();
280
- var e = me.exports;
281
- const De = ({ schema: r }) => {
282
- var h;
283
- const { title: i, description: s, data: c, columns: d } = r;
284
- (h = r.chart) != null && h.type;
285
- const p = !!r.chart, n = !(process.env.NODE_ENV === "test");
286
- return /* @__PURE__ */ e.jsxs(B, { className: `h-full flex flex-col ${r.className || ""}`, children: [
287
- /* @__PURE__ */ e.jsxs(ee, { children: [
288
- i && /* @__PURE__ */ e.jsx(te, { children: i }),
289
- s && /* @__PURE__ */ e.jsx(he, { children: s })
280
+ process.env.NODE_ENV === "production" ? pe.exports = Ue() : pe.exports = Ve();
281
+ var e = pe.exports;
282
+ const Ye = ({ schema: s }) => {
283
+ var i;
284
+ const { title: n, description: a, data: o, columns: c } = s;
285
+ (i = s.chart) != null && i.type;
286
+ const x = !!s.chart, t = !(process.env.NODE_ENV === "test");
287
+ return /* @__PURE__ */ e.jsxs(V, { className: `h-full flex flex-col ${s.className || ""}`, children: [
288
+ /* @__PURE__ */ e.jsxs(ae, { children: [
289
+ n && /* @__PURE__ */ e.jsx(se, { children: n }),
290
+ a && /* @__PURE__ */ e.jsx(he, { children: a })
290
291
  ] }),
291
- /* @__PURE__ */ e.jsxs(z, { className: "flex-1 overflow-auto space-y-4", children: [
292
- p && (() => {
293
- var y;
294
- const l = (y = r.chart) == null ? void 0 : y.type;
295
- let j = l ? L.get(l) : null;
296
- return j || (j = L.get("chart")), j ? /* @__PURE__ */ e.jsx("div", { className: "min-h-[300px] border rounded-md p-4 bg-white/50", children: /* @__PURE__ */ e.jsx(j, { schema: { ...r.chart, data: r.chart.data || c } }) }) : /* @__PURE__ */ e.jsxs("div", { className: "min-h-[100px] border rounded-md p-4 bg-muted/20 text-muted-foreground flex items-center justify-center", children: [
292
+ /* @__PURE__ */ e.jsxs(Y, { className: "flex-1 overflow-auto space-y-4", children: [
293
+ x && (() => {
294
+ var v;
295
+ const r = (v = s.chart) == null ? void 0 : v.type;
296
+ let p = r ? U.get(r) : null;
297
+ return p || (p = U.get("chart")), p ? /* @__PURE__ */ e.jsx("div", { className: "min-h-[300px] border rounded-lg p-4 bg-background/50", children: /* @__PURE__ */ e.jsx(p, { schema: { ...s.chart, data: s.chart.data || o } }) }) : /* @__PURE__ */ e.jsxs("div", { className: "min-h-[100px] border rounded-md p-4 bg-muted/20 text-muted-foreground flex items-center justify-center", children: [
297
298
  "Unknown component type: ",
298
- l || "chart"
299
+ r || "chart"
299
300
  ] });
300
301
  })(),
301
- c && c.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "border rounded-md", children: (() => {
302
- const l = n ? L.get("aggrid") || L.get("table") : null;
303
- return l ? /* @__PURE__ */ e.jsx(
304
- l,
302
+ o && o.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "border rounded-lg", children: (() => {
303
+ const r = t ? U.get("aggrid") || U.get("table") : null;
304
+ return r ? /* @__PURE__ */ e.jsx(
305
+ r,
305
306
  {
306
307
  schema: {
307
308
  type: "aggrid",
308
- rowData: c,
309
- columnDefs: d,
309
+ rowData: o,
310
+ columnDefs: c,
310
311
  domLayout: "autoHeight"
311
312
  }
312
313
  }
313
314
  ) : (
314
315
  // Simple Fallback Table if Grid plugin missing
315
316
  /* @__PURE__ */ e.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm text-left", children: [
316
- /* @__PURE__ */ e.jsx("thead", { className: "text-xs uppercase bg-gray-50", children: /* @__PURE__ */ e.jsx("tr", { children: d == null ? void 0 : d.map((j) => /* @__PURE__ */ e.jsx("th", { className: "px-6 py-3", children: j.headerName || j.label || j.field }, j.field)) }) }),
317
- /* @__PURE__ */ e.jsx("tbody", { children: c.map((j, y) => /* @__PURE__ */ e.jsx("tr", { className: "bg-white border-b", children: d == null ? void 0 : d.map((R) => /* @__PURE__ */ e.jsx("td", { className: "px-6 py-4", children: j[R.field] }, R.field)) }, y)) })
317
+ /* @__PURE__ */ e.jsx("thead", { className: "text-xs uppercase bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children: c == null ? void 0 : c.map((p) => /* @__PURE__ */ e.jsx("th", { className: "px-6 py-3", children: p.headerName || p.label || p.field }, p.field)) }) }),
318
+ /* @__PURE__ */ e.jsx("tbody", { children: o.map((p, v) => /* @__PURE__ */ e.jsx("tr", { className: "bg-background border-b", children: c == null ? void 0 : c.map((S) => /* @__PURE__ */ e.jsx("td", { className: "px-6 py-4", children: p[S.field] }, S.field)) }, v)) })
318
319
  ] }) })
319
320
  );
320
321
  })() })
321
322
  ] })
322
323
  ] });
323
324
  };
324
- function Be(r, i, s) {
325
- const c = r.fields || [], d = c.map((n) => n.label || n.name), p = i.map((n) => c.map((h) => {
326
- let l = n[h.name];
327
- return l = ge(l), typeof l == "string" && (l.includes(",") || l.includes('"') || l.includes(`
328
- `)) ? `"${l.replace(/"/g, '""')}"` : l ?? "";
329
- })), f = [
330
- ...(s == null ? void 0 : s.includeHeaders) !== !1 ? [d.join(",")] : [],
331
- ...p.map((n) => n.join(","))
325
+ function qe(s, n, a) {
326
+ const o = s.fields || [], c = o.map((t) => t.label || t.name), x = n.map((t) => o.map((i) => {
327
+ let r = t[i.name];
328
+ return r = we(r), typeof r == "string" && (r.includes(",") || r.includes('"') || r.includes(`
329
+ `)) ? `"${r.replace(/"/g, '""')}"` : r ?? "";
330
+ })), u = [
331
+ ...(a == null ? void 0 : a.includeHeaders) !== !1 ? [c.join(",")] : [],
332
+ ...x.map((t) => t.join(","))
332
333
  ].join(`
333
334
  `);
334
- le(f, (s == null ? void 0 : s.filename) || `${r.title || "report"}.csv`, "text/csv");
335
+ oe(u, (a == null ? void 0 : a.filename) || `${s.title || "report"}.csv`, "text/csv");
335
336
  }
336
- function ze(r, i, s) {
337
- const c = {
338
- title: r.title,
339
- description: r.description,
337
+ function We(s, n, a) {
338
+ const o = {
339
+ title: s.title,
340
+ description: s.description,
340
341
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
341
- data: i
342
- }, d = JSON.stringify(c, null, 2);
343
- le(d, (s == null ? void 0 : s.filename) || `${r.title || "report"}.json`, "application/json");
342
+ data: n
343
+ }, c = JSON.stringify(o, null, 2);
344
+ oe(c, (a == null ? void 0 : a.filename) || `${s.title || "report"}.json`, "application/json");
344
345
  }
345
- function ve(r, i, s) {
346
- const c = r.fields || [], d = Ne(s == null ? void 0 : s.orientation), p = ye(s == null ? void 0 : s.pageSize), f = `<!DOCTYPE html>
346
+ function ye(s, n, a) {
347
+ const o = s.fields || [], c = ke(a == null ? void 0 : a.orientation), x = Ce(a == null ? void 0 : a.pageSize), u = `<!DOCTYPE html>
347
348
  <html>
348
349
  <head>
349
350
  <meta charset="utf-8">
350
- <title>${$(r.title || "Report")}</title>
351
+ <title>${z(s.title || "Report")}</title>
351
352
  <style>
352
- @page { size: ${p} ${d}; margin: 20mm; }
353
+ @page { size: ${x} ${c}; margin: 20mm; }
353
354
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
354
355
  h1 { font-size: 24px; margin-bottom: 8px; }
355
356
  .description { color: #666; margin-bottom: 24px; }
@@ -361,35 +362,35 @@ function ve(r, i, s) {
361
362
  </style>
362
363
  </head>
363
364
  <body>
364
- <h1>${$(r.title || "Report")}</h1>
365
- ${r.description ? `<p class="description">${$(r.description)}</p>` : ""}
365
+ <h1>${z(s.title || "Report")}</h1>
366
+ ${s.description ? `<p class="description">${z(s.description)}</p>` : ""}
366
367
  <p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
367
368
  <table>
368
- <thead><tr>${c.map((n) => `<th>${$(n.label || n.name)}</th>`).join("")}</tr></thead>
369
- <tbody>${i.map((n) => `<tr>${c.map((h) => `<td>${$(String(n[h.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
369
+ <thead><tr>${o.map((t) => `<th>${z(t.label || t.name)}</th>`).join("")}</tr></thead>
370
+ <tbody>${n.map((t) => `<tr>${o.map((i) => `<td>${z(String(t[i.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
370
371
  </table>
371
372
  </body>
372
373
  </html>`;
373
- le(f, (s == null ? void 0 : s.filename) || `${r.title || "report"}.html`, "text/html");
374
+ oe(u, (a == null ? void 0 : a.filename) || `${s.title || "report"}.html`, "text/html");
374
375
  }
375
- function Me(r, i, s) {
376
- var n;
377
- const c = r.fields || [], d = Ne(s == null ? void 0 : s.orientation), p = ye(s == null ? void 0 : s.pageSize), f = window.open("", "_blank");
378
- if (!f) {
379
- const h = {
380
- ...s,
381
- filename: ((n = s == null ? void 0 : s.filename) == null ? void 0 : n.replace(/\.pdf$/, ".html")) || `${r.title || "report"}.html`
376
+ function He(s, n, a) {
377
+ var t;
378
+ const o = s.fields || [], c = ke(a == null ? void 0 : a.orientation), x = Ce(a == null ? void 0 : a.pageSize), u = window.open("", "_blank");
379
+ if (!u) {
380
+ const i = {
381
+ ...a,
382
+ filename: ((t = a == null ? void 0 : a.filename) == null ? void 0 : t.replace(/\.pdf$/, ".html")) || `${s.title || "report"}.html`
382
383
  };
383
- ve(r, i, h);
384
+ ye(s, n, i);
384
385
  return;
385
386
  }
386
- f.document.write(`<!DOCTYPE html>
387
+ u.document.write(`<!DOCTYPE html>
387
388
  <html>
388
389
  <head>
389
390
  <meta charset="utf-8">
390
- <title>${$(r.title || "Report")}</title>
391
+ <title>${z(s.title || "Report")}</title>
391
392
  <style>
392
- @page { size: ${p} ${d}; margin: 20mm; }
393
+ @page { size: ${x} ${c}; margin: 20mm; }
393
394
  @media print { .no-print { display: none; } }
394
395
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
395
396
  h1 { font-size: 24px; margin-bottom: 8px; }
@@ -402,163 +403,237 @@ function Me(r, i, s) {
402
403
  </style>
403
404
  </head>
404
405
  <body>
405
- <h1>${$(r.title || "Report")}</h1>
406
- ${r.description ? `<p class="description">${$(r.description)}</p>` : ""}
406
+ <h1>${z(s.title || "Report")}</h1>
407
+ ${s.description ? `<p class="description">${z(s.description)}</p>` : ""}
407
408
  <p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
408
409
  <table>
409
- <thead><tr>${c.map((h) => `<th>${$(h.label || h.name)}</th>`).join("")}</tr></thead>
410
- <tbody>${i.map((h) => `<tr>${c.map((l) => `<td>${$(String(h[l.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
410
+ <thead><tr>${o.map((i) => `<th>${z(i.label || i.name)}</th>`).join("")}</tr></thead>
411
+ <tbody>${n.map((i) => `<tr>${o.map((r) => `<td>${z(String(i[r.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
411
412
  </table>
412
413
  </body>
413
- </html>`), f.document.close(), f.onload = () => {
414
- f.print();
414
+ </html>`), u.document.close(), u.onload = () => {
415
+ u.print();
415
416
  };
416
417
  }
417
- function Ie(r, i, s) {
418
- const c = r.fields || [], d = c.map((n) => n.label || n.name), p = i.map((n) => c.map((h) => {
419
- let l = n[h.name];
420
- return l = ge(l), typeof l == "string" && (l.includes(",") || l.includes('"') || l.includes(`
421
- `) || l.includes(" ")) ? `"${l.replace(/"/g, '""')}"` : l ?? "";
422
- })), f = "\uFEFF" + [
423
- ...(s == null ? void 0 : s.includeHeaders) !== !1 ? [d.join(" ")] : [],
424
- ...p.map((n) => n.join(" "))
418
+ function Je(s, n, a) {
419
+ const o = s.fields || [], c = o.map((t) => t.label || t.name), x = n.map((t) => o.map((i) => {
420
+ let r = t[i.name];
421
+ return r = we(r), typeof r == "string" && (r.includes(",") || r.includes('"') || r.includes(`
422
+ `) || r.includes(" ")) ? `"${r.replace(/"/g, '""')}"` : r ?? "";
423
+ })), u = "\uFEFF" + [
424
+ ...(a == null ? void 0 : a.includeHeaders) !== !1 ? [c.join(" ")] : [],
425
+ ...x.map((t) => t.join(" "))
425
426
  ].join(`
426
427
  `);
427
- le(f, (s == null ? void 0 : s.filename) || `${r.title || "report"}.tsv`, "text/tab-separated-values");
428
+ oe(u, (a == null ? void 0 : a.filename) || `${s.title || "report"}.tsv`, "text/tab-separated-values");
428
429
  }
429
- function be(r, i, s, c) {
430
- switch (r) {
430
+ function Ne(s, n, a, o) {
431
+ switch (s) {
431
432
  case "csv":
432
- Be(i, s, c);
433
+ qe(n, a, o);
433
434
  break;
434
435
  case "json":
435
- ze(i, s, c);
436
+ We(n, a, o);
436
437
  break;
437
438
  case "html":
438
- ve(i, s, c);
439
+ ye(n, a, o);
439
440
  break;
440
441
  case "pdf":
441
- Me(i, s, c);
442
+ He(n, a, o);
442
443
  break;
443
444
  case "excel":
444
- Ie(i, s, c);
445
+ Je(n, a, o);
445
446
  break;
446
447
  default:
447
- console.warn(`Unsupported export format: ${r}`);
448
+ console.warn(`Unsupported export format: ${s}`);
449
+ }
450
+ }
451
+ function z(s) {
452
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
453
+ }
454
+ function we(s) {
455
+ if (typeof s == "string" && s.length > 0) {
456
+ const n = s.charAt(0);
457
+ if (n === "=" || n === "+" || n === "-" || n === "@" || n === "|")
458
+ return ` ${s}`;
448
459
  }
460
+ return s;
461
+ }
462
+ function Ce(s) {
463
+ return ["A4", "A3", "Letter", "Legal"].includes(s || "") ? s : "A4";
449
464
  }
450
- function $(r) {
451
- return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
465
+ function ke(s) {
466
+ return s === "landscape" ? "landscape" : "portrait";
452
467
  }
453
- function ge(r) {
454
- if (typeof r == "string" && r.length > 0) {
455
- const i = r.charAt(0);
456
- if (i === "=" || i === "+" || i === "-" || i === "@" || i === "|")
457
- return ` ${r}`;
468
+ function oe(s, n, a) {
469
+ const o = new Blob([s], { type: `${a};charset=utf-8` }), c = URL.createObjectURL(o), x = document.createElement("a");
470
+ x.href = c, x.download = n, document.body.appendChild(x), x.click(), document.body.removeChild(x), URL.revokeObjectURL(c);
471
+ }
472
+ function ge(s, n) {
473
+ if (s == null || s === "") return "";
474
+ const a = n == null ? void 0 : n.type, o = n == null ? void 0 : n.format;
475
+ if (a === "date" || o === "date" || Xe(s))
476
+ return Ze(s);
477
+ if (a === "number" || typeof s == "number") {
478
+ const c = typeof s == "number" ? s : Number(s);
479
+ return isNaN(c) ? String(s) : o === "currency" || o === "currency_cny" ? `¥${c.toLocaleString("en-US", { minimumFractionDigits: 0, maximumFractionDigits: 0 })}` : o === "currency_usd" ? `$${c.toLocaleString("en-US", { minimumFractionDigits: 0, maximumFractionDigits: 0 })}` : o === "percent" ? `${c.toLocaleString("en-US", { minimumFractionDigits: 1, maximumFractionDigits: 1 })}%` : c.toLocaleString("en-US");
458
480
  }
459
- return r;
481
+ return String(s);
460
482
  }
461
- function ye(r) {
462
- return ["A4", "A3", "Letter", "Legal"].includes(r || "") ? r : "A4";
483
+ function Xe(s) {
484
+ return typeof s != "string" ? !1 : /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2})?/.test(s);
463
485
  }
464
- function Ne(r) {
465
- return r === "landscape" ? "landscape" : "portrait";
486
+ function Ze(s) {
487
+ try {
488
+ const n = new Date(s);
489
+ if (isNaN(n.getTime())) return String(s);
490
+ const a = n.getFullYear(), o = String(n.getMonth() + 1).padStart(2, "0"), c = String(n.getDate()).padStart(2, "0");
491
+ return `${a}-${o}-${c}`;
492
+ } catch {
493
+ return String(s);
494
+ }
466
495
  }
467
- function le(r, i, s) {
468
- const c = new Blob([r], { type: `${s};charset=utf-8` }), d = URL.createObjectURL(c), p = document.createElement("a");
469
- p.href = d, p.download = i, document.body.appendChild(p), p.click(), document.body.removeChild(p), URL.revokeObjectURL(d);
496
+ function Qe(s, n) {
497
+ if (!n || n.length === 0 || !s || s.length === 0) return null;
498
+ const a = n[0], o = a.field, c = /* @__PURE__ */ new Map();
499
+ for (const t of s) {
500
+ const i = String(t[o] ?? "(empty)");
501
+ c.has(i) || c.set(i, []), c.get(i).push(t);
502
+ }
503
+ const x = [];
504
+ for (const [t, i] of c)
505
+ x.push({ key: t, label: `${a.label || o}: ${t}`, rows: i });
506
+ const u = a.sort === "desc" ? -1 : 1;
507
+ return x.sort((t, i) => t.key.localeCompare(i.key) * u), x;
470
508
  }
471
- const we = ({ schema: r, onRefresh: i }) => {
472
- var R, w;
509
+ const Se = ({ schema: s, onRefresh: n }) => {
510
+ var _, k;
473
511
  const {
474
- report: s,
475
- data: c,
476
- showToolbar: d = !0,
477
- allowExport: p = !0,
478
- allowPrint: f = !0,
479
- loading: n = !1
480
- } = r, h = (m) => {
481
- var v;
482
- if (!s) {
512
+ report: a,
513
+ data: o,
514
+ showToolbar: c = !0,
515
+ allowExport: x = !0,
516
+ allowPrint: u = !0,
517
+ loading: t = !1
518
+ } = s, i = (m) => {
519
+ var N;
520
+ if (!a) {
483
521
  console.warn("ReportViewer: Cannot export, no report defined");
484
522
  return;
485
523
  }
486
- be(
524
+ Ne(
487
525
  m,
488
- s,
489
- c || [],
490
- (v = s.exportConfigs) == null ? void 0 : v[m]
526
+ a,
527
+ o || [],
528
+ (N = a.exportConfigs) == null ? void 0 : N[m]
491
529
  );
492
- }, l = () => {
530
+ }, r = () => {
493
531
  window.print();
494
- }, j = () => {
495
- i == null || i();
496
- }, y = (m, v) => {
497
- if (!c) return 0;
498
- const N = c.map((k) => Number(k[m]) || 0);
499
- switch (v) {
532
+ }, p = () => {
533
+ n == null || n();
534
+ }, v = (m, N) => {
535
+ if (!o) return 0;
536
+ const C = o.map((y) => Number(y[m]) || 0);
537
+ switch (N) {
500
538
  case "count":
501
- return c.length;
539
+ return o.length;
502
540
  case "sum":
503
- return N.reduce((k, g) => k + g, 0);
541
+ return C.reduce((y, g) => y + g, 0);
504
542
  case "avg":
505
- return N.length > 0 ? (N.reduce((k, g) => k + g, 0) / N.length).toFixed(2) : 0;
543
+ return C.length > 0 ? (C.reduce((y, g) => y + g, 0) / C.length).toFixed(2) : 0;
506
544
  case "min":
507
- return N.length > 0 ? Math.min(...N) : 0;
545
+ return C.length > 0 ? Math.min(...C) : 0;
508
546
  case "max":
509
- return N.length > 0 ? Math.max(...N) : 0;
547
+ return C.length > 0 ? Math.max(...C) : 0;
510
548
  default:
511
549
  return "";
512
550
  }
551
+ }, S = (m, N) => {
552
+ const C = a == null ? void 0 : a.conditionalFormatting;
553
+ if (!(!C || !Array.isArray(C)))
554
+ for (const y of C) {
555
+ if (y.field !== m) continue;
556
+ const g = String(N ?? ""), T = String(y.value ?? "");
557
+ let $ = !1;
558
+ switch (y.operator) {
559
+ case "equals":
560
+ $ = g === T;
561
+ break;
562
+ case "not_equals":
563
+ $ = g !== T;
564
+ break;
565
+ case "contains":
566
+ $ = g.includes(T);
567
+ break;
568
+ case "greater_than":
569
+ $ = Number(N) > Number(y.value);
570
+ break;
571
+ case "less_than":
572
+ $ = Number(N) < Number(y.value);
573
+ break;
574
+ }
575
+ if ($) {
576
+ const P = {};
577
+ return y.backgroundColor && (P.backgroundColor = y.backgroundColor), y.textColor && (P.color = y.textColor), P;
578
+ }
579
+ }
580
+ }, w = (m, N) => {
581
+ var C;
582
+ if (m == null || m === "") return "";
583
+ if (N.renderAs === "badge") {
584
+ const y = ((C = N.colorMap) == null ? void 0 : C[String(m)]) || "";
585
+ return /* @__PURE__ */ e.jsx(Ae, { className: y, children: String(m) });
586
+ }
587
+ return ge(m, N);
513
588
  };
514
- return s ? /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
515
- d && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-2 p-4 bg-card rounded-lg border", children: [
589
+ return a ? /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
590
+ c && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-2 p-4 bg-card rounded-lg border", children: [
516
591
  /* @__PURE__ */ e.jsxs("div", { children: [
517
- /* @__PURE__ */ e.jsx("h2", { className: "text-lg font-semibold", children: s.title }),
518
- s.description && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: s.description })
592
+ /* @__PURE__ */ e.jsx("h2", { className: "text-lg font-semibold", children: a.title }),
593
+ a.description && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: a.description })
519
594
  ] }),
520
595
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
521
- s.refreshInterval && /* @__PURE__ */ e.jsxs(F, { variant: "outline", size: "sm", onClick: j, children: [
522
- /* @__PURE__ */ e.jsx(Ee, { className: "h-4 w-4 mr-2" }),
596
+ a.refreshInterval && /* @__PURE__ */ e.jsxs(E, { variant: "outline", size: "sm", onClick: p, children: [
597
+ /* @__PURE__ */ e.jsx(De, { className: "h-4 w-4 mr-2" }),
523
598
  "Refresh"
524
599
  ] }),
525
- f && /* @__PURE__ */ e.jsxs(F, { variant: "outline", size: "sm", onClick: l, children: [
526
- /* @__PURE__ */ e.jsx(Te, { className: "h-4 w-4 mr-2" }),
600
+ u && /* @__PURE__ */ e.jsxs(E, { variant: "outline", size: "sm", onClick: r, children: [
601
+ /* @__PURE__ */ e.jsx(Le, { className: "h-4 w-4 mr-2" }),
527
602
  "Print"
528
603
  ] }),
529
- p && s.showExportButtons && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1", children: [
604
+ x && a.showExportButtons && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1", children: [
530
605
  /* @__PURE__ */ e.jsxs(
531
- F,
606
+ E,
532
607
  {
533
608
  variant: "outline",
534
609
  size: "sm",
535
- onClick: () => h("pdf"),
610
+ onClick: () => i("pdf"),
536
611
  children: [
537
- /* @__PURE__ */ e.jsx(de, { className: "h-4 w-4 mr-2" }),
612
+ /* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4 mr-2" }),
538
613
  "PDF"
539
614
  ]
540
615
  }
541
616
  ),
542
617
  /* @__PURE__ */ e.jsxs(
543
- F,
618
+ E,
544
619
  {
545
620
  variant: "outline",
546
621
  size: "sm",
547
- onClick: () => h("excel"),
622
+ onClick: () => i("excel"),
548
623
  children: [
549
- /* @__PURE__ */ e.jsx(de, { className: "h-4 w-4 mr-2" }),
624
+ /* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4 mr-2" }),
550
625
  "Excel"
551
626
  ]
552
627
  }
553
628
  ),
554
629
  /* @__PURE__ */ e.jsxs(
555
- F,
630
+ E,
556
631
  {
557
632
  variant: "outline",
558
633
  size: "sm",
559
- onClick: () => h("csv"),
634
+ onClick: () => i("csv"),
560
635
  children: [
561
- /* @__PURE__ */ e.jsx(de, { className: "h-4 w-4 mr-2" }),
636
+ /* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4 mr-2" }),
562
637
  "CSV"
563
638
  ]
564
639
  }
@@ -566,88 +641,121 @@ const we = ({ schema: r, onRefresh: i }) => {
566
641
  ] })
567
642
  ] })
568
643
  ] }),
569
- /* @__PURE__ */ e.jsxs(B, { children: [
570
- /* @__PURE__ */ e.jsxs(ee, { children: [
571
- !d && s.title && /* @__PURE__ */ e.jsx(te, { children: s.title }),
572
- !d && s.description && /* @__PURE__ */ e.jsx(he, { children: s.description })
644
+ /* @__PURE__ */ e.jsxs(V, { children: [
645
+ /* @__PURE__ */ e.jsxs(ae, { children: [
646
+ !c && a.title && /* @__PURE__ */ e.jsx(se, { children: a.title }),
647
+ !c && a.description && /* @__PURE__ */ e.jsx(he, { children: a.description })
573
648
  ] }),
574
- /* @__PURE__ */ e.jsxs(z, { className: "space-y-6", children: [
575
- n && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground", children: "Loading report data..." }),
576
- !n && ((R = s.sections) == null ? void 0 : R.map((m, v) => {
577
- var N, k;
649
+ /* @__PURE__ */ e.jsxs(Y, { className: "space-y-6", children: [
650
+ t && /* @__PURE__ */ e.jsxs("div", { className: "space-y-6", children: [
651
+ /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: [1, 2, 3].map((m) => /* @__PURE__ */ e.jsx(V, { children: /* @__PURE__ */ e.jsxs(Y, { className: "p-4 space-y-2", children: [
652
+ /* @__PURE__ */ e.jsx(ne, { className: "h-4 w-20" }),
653
+ /* @__PURE__ */ e.jsx(ne, { className: "h-8 w-28" })
654
+ ] }) }, m)) }),
655
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
656
+ /* @__PURE__ */ e.jsx(ne, { className: "h-10 w-full" }),
657
+ [1, 2, 3, 4, 5].map((m) => /* @__PURE__ */ e.jsx(ne, { className: "h-8 w-full" }, m))
658
+ ] })
659
+ ] }),
660
+ !t && ((_ = a.sections) == null ? void 0 : _.map((m, N) => {
661
+ var C, y;
578
662
  return m.visible === !1 ? null : /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
579
- m.title && /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold border-b pb-2", children: m.title }),
663
+ m.title && m.type !== "header" && /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold border-b pb-2", children: m.title }),
580
664
  m.type === "header" && m.title && /* @__PURE__ */ e.jsx("div", { className: "text-2xl font-bold py-4", children: m.title }),
581
- m.type === "summary" && /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: (N = s.fields) == null ? void 0 : N.filter((g) => g.showInSummary).map((g, _) => /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsxs(z, { className: "p-4", children: [
665
+ m.type === "summary" && /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: (C = a.fields) == null ? void 0 : C.filter((g) => g.showInSummary).map((g, T) => /* @__PURE__ */ e.jsx(V, { children: /* @__PURE__ */ e.jsxs(Y, { className: "p-4", children: [
582
666
  /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: g.label || g.name }),
583
- /* @__PURE__ */ e.jsx("div", { className: "text-2xl font-bold", children: y(g.name, g.aggregation) })
584
- ] }) }, _)) }),
667
+ /* @__PURE__ */ e.jsx("div", { className: "text-2xl font-bold", children: ge(v(g.name, g.aggregation), g) })
668
+ ] }) }, T)) }),
585
669
  m.type === "chart" && m.chart && /* @__PURE__ */ e.jsx("div", { className: "min-h-[300px]", children: (() => {
586
670
  let g = m.chart.type;
587
- const _ = !!m.chart.chartType;
588
- !g && _ && (g = "chart"), g && !!L.get(g) || (g = "chart");
589
- const O = g === "chart" ? {
671
+ const T = !!m.chart.chartType;
672
+ !g && T && (g = "chart"), g && !!U.get(g) || (g = "chart");
673
+ const D = g === "chart" ? {
590
674
  xAxisKey: m.chart.xAxisKey || m.chart.xAxisField || "name",
591
- series: m.chart.series || (m.chart.yAxisFields ? m.chart.yAxisFields.map((H) => ({ dataKey: H })) : []),
675
+ series: m.chart.series || (m.chart.yAxisFields ? m.chart.yAxisFields.map((B) => ({ dataKey: B })) : []),
592
676
  // Ensure chartType is passed if we are using the generic renderer
593
677
  chartType: m.chart.chartType || "bar"
594
- } : {}, q = {
678
+ } : {}, L = {
595
679
  ...m.chart,
596
680
  type: g,
597
- ...O,
598
- data: c || m.chart.data,
681
+ ...D,
682
+ data: o || m.chart.data,
599
683
  // Force explicit height to preventing Recharts "height(-1)" error
600
684
  className: m.chart.className || "w-full h-[350px]"
601
685
  };
602
- return /* @__PURE__ */ e.jsx(pe, { schema: q });
686
+ return /* @__PURE__ */ e.jsx(xe, { schema: L });
603
687
  })() }),
604
- m.type === "table" && /* @__PURE__ */ e.jsx("div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm", children: [
605
- /* @__PURE__ */ e.jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children: (k = m.columns) == null ? void 0 : k.map((g, _) => /* @__PURE__ */ e.jsx("th", { className: "px-4 py-2 text-left font-medium", children: g.label || g.name }, _)) }) }),
606
- /* @__PURE__ */ e.jsx("tbody", { children: c == null ? void 0 : c.map((g, _) => {
607
- var D;
608
- return /* @__PURE__ */ e.jsx("tr", { className: "border-t", children: (D = m.columns) == null ? void 0 : D.map((M, O) => /* @__PURE__ */ e.jsx("td", { className: "px-4 py-2", children: g[M.name] }, O)) }, _);
609
- }) })
688
+ m.type === "table" && /* @__PURE__ */ e.jsx("div", { className: "border rounded-lg overflow-x-auto", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm min-w-[600px]", children: [
689
+ /* @__PURE__ */ e.jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children: (y = m.columns) == null ? void 0 : y.map((g, T) => /* @__PURE__ */ e.jsx("th", { className: `px-4 py-2 font-medium ${g.type === "number" ? "text-right" : "text-left"}`, children: g.label || g.name }, T)) }) }),
690
+ /* @__PURE__ */ e.jsx("tbody", { children: (() => {
691
+ const g = Qe(o || [], a.groupBy || []);
692
+ return g ? g.map((T) => {
693
+ var $;
694
+ return /* @__PURE__ */ e.jsxs(ve.Fragment, { children: [
695
+ /* @__PURE__ */ e.jsx("tr", { className: "bg-muted/60", children: /* @__PURE__ */ e.jsxs(
696
+ "td",
697
+ {
698
+ colSpan: (($ = m.columns) == null ? void 0 : $.length) || 1,
699
+ className: "px-4 py-2 font-semibold text-sm",
700
+ children: [
701
+ T.label,
702
+ " (",
703
+ T.rows.length,
704
+ ")"
705
+ ]
706
+ }
707
+ ) }),
708
+ T.rows.map((P, D) => {
709
+ var L;
710
+ return /* @__PURE__ */ e.jsx("tr", { className: "border-t hover:bg-muted/50 even:bg-muted/20", children: (L = m.columns) == null ? void 0 : L.map((B, Z) => /* @__PURE__ */ e.jsx("td", { className: `px-4 py-2 ${B.type === "number" ? "text-right tabular-nums" : ""}`, style: S(B.name, P[B.name]), children: w(P[B.name], B) }, Z)) }, D);
711
+ })
712
+ ] }, T.key);
713
+ }) : o == null ? void 0 : o.map((T, $) => {
714
+ var P;
715
+ return /* @__PURE__ */ e.jsx("tr", { className: "border-t hover:bg-muted/50 even:bg-muted/20", children: (P = m.columns) == null ? void 0 : P.map((D, L) => /* @__PURE__ */ e.jsx("td", { className: `px-4 py-2 ${D.type === "number" ? "text-right tabular-nums" : ""}`, style: S(D.name, T[D.name]), children: w(T[D.name], D) }, L)) }, $);
716
+ });
717
+ })() })
610
718
  ] }) }),
611
719
  m.type === "text" && m.text && /* @__PURE__ */ e.jsx("div", { className: "prose max-w-none", children: /* @__PURE__ */ e.jsx("p", { children: m.text }) }),
612
720
  m.type === "page-break" && /* @__PURE__ */ e.jsx("div", { className: "border-t-2 border-dashed my-8 print:page-break-after-always" }),
613
- m.content && /* @__PURE__ */ e.jsx(pe, { schema: m.content })
614
- ] }, v);
721
+ m.content && /* @__PURE__ */ e.jsx(xe, { schema: m.content })
722
+ ] }, N);
615
723
  })),
616
- !s.sections && c && c.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm", children: [
617
- /* @__PURE__ */ e.jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children: (w = s.fields) == null ? void 0 : w.map((m, v) => /* @__PURE__ */ e.jsx("th", { className: "px-4 py-2 text-left font-medium", children: m.label || m.name }, v)) }) }),
618
- /* @__PURE__ */ e.jsx("tbody", { children: c.map((m, v) => {
619
- var N;
620
- return /* @__PURE__ */ e.jsx("tr", { className: "border-t", children: (N = s.fields) == null ? void 0 : N.map((k, g) => /* @__PURE__ */ e.jsx("td", { className: "px-4 py-2", children: m[k.name] }, g)) }, v);
724
+ !a.sections && o && o.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "border rounded-lg overflow-x-auto", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm min-w-[600px]", children: [
725
+ /* @__PURE__ */ e.jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children: (k = a.fields) == null ? void 0 : k.map((m, N) => /* @__PURE__ */ e.jsx("th", { className: `px-4 py-2 font-medium ${m.type === "number" ? "text-right" : "text-left"}`, children: m.label || m.name }, N)) }) }),
726
+ /* @__PURE__ */ e.jsx("tbody", { children: o.map((m, N) => {
727
+ var C;
728
+ return /* @__PURE__ */ e.jsx("tr", { className: "border-t hover:bg-muted/50 even:bg-muted/20", children: (C = a.fields) == null ? void 0 : C.map((y, g) => /* @__PURE__ */ e.jsx("td", { className: `px-4 py-2 ${y.type === "number" ? "text-right tabular-nums" : ""}`, style: S(y.name, m[y.name]), children: w(m[y.name], y) }, g)) }, N);
621
729
  }) })
622
730
  ] }) })
623
731
  ] })
624
732
  ] })
625
- ] }) : /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(z, { className: "p-8 text-center text-muted-foreground", children: "No report to display" }) });
626
- }, Ge = ({ schedule: r, onChange: i }) => {
627
- var h;
628
- const [s, c] = W(r || {
733
+ ] }) : /* @__PURE__ */ e.jsx(V, { children: /* @__PURE__ */ e.jsx(Y, { className: "p-8 text-center text-muted-foreground", children: "No report to display" }) });
734
+ }, Re = ({ schedule: s, onChange: n }) => {
735
+ var i;
736
+ const [a, o] = J(s || {
629
737
  enabled: !1,
630
738
  frequency: "weekly",
631
739
  time: "09:00",
632
740
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
633
741
  recipients: [],
634
742
  formats: ["pdf"]
635
- }), d = (l) => {
636
- const j = { ...s, ...l };
637
- c(j), i == null || i(j);
638
- }, p = [
743
+ }), c = (r) => {
744
+ const p = { ...a, ...r };
745
+ o(p), n == null || n(p);
746
+ }, x = [
639
747
  { value: "once", label: "Once" },
640
748
  { value: "daily", label: "Daily" },
641
749
  { value: "weekly", label: "Weekly" },
642
750
  { value: "monthly", label: "Monthly" },
643
751
  { value: "quarterly", label: "Quarterly" },
644
752
  { value: "yearly", label: "Yearly" }
645
- ], f = [
753
+ ], u = [
646
754
  { value: "pdf", label: "PDF" },
647
755
  { value: "excel", label: "Excel" },
648
756
  { value: "csv", label: "CSV" },
649
757
  { value: "html", label: "HTML" }
650
- ], n = [
758
+ ], t = [
651
759
  { value: 0, label: "Sunday" },
652
760
  { value: 1, label: "Monday" },
653
761
  { value: 2, label: "Tuesday" },
@@ -656,134 +764,134 @@ const we = ({ schema: r, onRefresh: i }) => {
656
764
  { value: 5, label: "Friday" },
657
765
  { value: 6, label: "Saturday" }
658
766
  ];
659
- return /* @__PURE__ */ e.jsxs(B, { children: [
660
- /* @__PURE__ */ e.jsx(ee, { children: /* @__PURE__ */ e.jsxs(te, { className: "flex items-center gap-2", children: [
767
+ return /* @__PURE__ */ e.jsxs(V, { children: [
768
+ /* @__PURE__ */ e.jsx(ae, { children: /* @__PURE__ */ e.jsxs(se, { className: "flex items-center gap-2", children: [
661
769
  /* @__PURE__ */ e.jsx(je, { className: "h-5 w-5" }),
662
770
  "Schedule Configuration"
663
771
  ] }) }),
664
- /* @__PURE__ */ e.jsxs(z, { className: "space-y-4", children: [
772
+ /* @__PURE__ */ e.jsxs(Y, { className: "space-y-4", children: [
665
773
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
666
774
  /* @__PURE__ */ e.jsx(
667
775
  "input",
668
776
  {
669
777
  type: "checkbox",
670
778
  id: "schedule-enabled",
671
- checked: s.enabled || !1,
672
- onChange: (l) => d({ enabled: l.target.checked }),
779
+ checked: a.enabled || !1,
780
+ onChange: (r) => c({ enabled: r.target.checked }),
673
781
  className: "rounded"
674
782
  }
675
783
  ),
676
- /* @__PURE__ */ e.jsx(b, { htmlFor: "schedule-enabled", children: "Enable Scheduled Report" })
784
+ /* @__PURE__ */ e.jsx(j, { htmlFor: "schedule-enabled", children: "Enable Scheduled Report" })
677
785
  ] }),
678
- s.enabled && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
786
+ a.enabled && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
679
787
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
680
- /* @__PURE__ */ e.jsx(b, { children: "Frequency" }),
788
+ /* @__PURE__ */ e.jsx(j, { children: "Frequency" }),
681
789
  /* @__PURE__ */ e.jsx(
682
790
  "select",
683
791
  {
684
792
  className: "w-full border rounded-md p-2 bg-background",
685
- value: s.frequency || "weekly",
686
- onChange: (l) => d({ frequency: l.target.value }),
687
- children: p.map((l) => /* @__PURE__ */ e.jsx("option", { value: l.value, children: l.label }, l.value))
793
+ value: a.frequency || "weekly",
794
+ onChange: (r) => c({ frequency: r.target.value }),
795
+ children: x.map((r) => /* @__PURE__ */ e.jsx("option", { value: r.value, children: r.label }, r.value))
688
796
  }
689
797
  )
690
798
  ] }),
691
- s.frequency === "weekly" && /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
692
- /* @__PURE__ */ e.jsx(b, { children: "Day of Week" }),
799
+ a.frequency === "weekly" && /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
800
+ /* @__PURE__ */ e.jsx(j, { children: "Day of Week" }),
693
801
  /* @__PURE__ */ e.jsx(
694
802
  "select",
695
803
  {
696
804
  className: "w-full border rounded-md p-2 bg-background",
697
- value: s.dayOfWeek ?? 1,
698
- onChange: (l) => d({ dayOfWeek: Number(l.target.value) }),
699
- children: n.map((l) => /* @__PURE__ */ e.jsx("option", { value: l.value, children: l.label }, l.value))
805
+ value: a.dayOfWeek ?? 1,
806
+ onChange: (r) => c({ dayOfWeek: Number(r.target.value) }),
807
+ children: t.map((r) => /* @__PURE__ */ e.jsx("option", { value: r.value, children: r.label }, r.value))
700
808
  }
701
809
  )
702
810
  ] }),
703
- s.frequency === "monthly" && /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
704
- /* @__PURE__ */ e.jsx(b, { children: "Day of Month" }),
811
+ a.frequency === "monthly" && /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
812
+ /* @__PURE__ */ e.jsx(j, { children: "Day of Month" }),
705
813
  /* @__PURE__ */ e.jsx(
706
- A,
814
+ M,
707
815
  {
708
816
  type: "number",
709
817
  min: 1,
710
818
  max: 31,
711
- value: s.dayOfMonth ?? 1,
712
- onChange: (l) => d({ dayOfMonth: Number(l.target.value) })
819
+ value: a.dayOfMonth ?? 1,
820
+ onChange: (r) => c({ dayOfMonth: Number(r.target.value) })
713
821
  }
714
822
  )
715
823
  ] }),
716
824
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
717
- /* @__PURE__ */ e.jsxs(b, { className: "flex items-center gap-2", children: [
718
- /* @__PURE__ */ e.jsx(Fe, { className: "h-4 w-4" }),
825
+ /* @__PURE__ */ e.jsxs(j, { className: "flex items-center gap-2", children: [
826
+ /* @__PURE__ */ e.jsx(Be, { className: "h-4 w-4" }),
719
827
  "Time"
720
828
  ] }),
721
829
  /* @__PURE__ */ e.jsx(
722
- A,
830
+ M,
723
831
  {
724
832
  type: "time",
725
- value: s.time || "09:00",
726
- onChange: (l) => d({ time: l.target.value })
833
+ value: a.time || "09:00",
834
+ onChange: (r) => c({ time: r.target.value })
727
835
  }
728
836
  )
729
837
  ] }),
730
838
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
731
- /* @__PURE__ */ e.jsx(b, { children: "Timezone" }),
839
+ /* @__PURE__ */ e.jsx(j, { children: "Timezone" }),
732
840
  /* @__PURE__ */ e.jsx(
733
- A,
841
+ M,
734
842
  {
735
- value: s.timezone || "",
736
- onChange: (l) => d({ timezone: l.target.value }),
843
+ value: a.timezone || "",
844
+ onChange: (r) => c({ timezone: r.target.value }),
737
845
  placeholder: "e.g. America/New_York"
738
846
  }
739
847
  )
740
848
  ] }),
741
849
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
742
- /* @__PURE__ */ e.jsx(b, { children: "Export Formats" }),
743
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-2", children: f.map((l) => {
744
- var j;
850
+ /* @__PURE__ */ e.jsx(j, { children: "Export Formats" }),
851
+ /* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-2", children: u.map((r) => {
852
+ var p;
745
853
  return /* @__PURE__ */ e.jsxs("label", { className: "flex items-center gap-1.5 px-3 py-1.5 border rounded-md cursor-pointer hover:bg-muted/50", children: [
746
854
  /* @__PURE__ */ e.jsx(
747
855
  "input",
748
856
  {
749
857
  type: "checkbox",
750
- checked: ((j = s.formats) == null ? void 0 : j.includes(l.value)) || !1,
751
- onChange: (y) => {
752
- const R = s.formats || [];
753
- d({
754
- formats: y.target.checked ? [...R, l.value] : R.filter((w) => w !== l.value)
858
+ checked: ((p = a.formats) == null ? void 0 : p.includes(r.value)) || !1,
859
+ onChange: (v) => {
860
+ const S = a.formats || [];
861
+ c({
862
+ formats: v.target.checked ? [...S, r.value] : S.filter((w) => w !== r.value)
755
863
  });
756
864
  },
757
865
  className: "rounded"
758
866
  }
759
867
  ),
760
- /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: l.label })
761
- ] }, l.value);
868
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: r.label })
869
+ ] }, r.value);
762
870
  }) })
763
871
  ] }),
764
872
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
765
- /* @__PURE__ */ e.jsxs(b, { className: "flex items-center gap-2", children: [
766
- /* @__PURE__ */ e.jsx(_e, { className: "h-4 w-4" }),
873
+ /* @__PURE__ */ e.jsxs(j, { className: "flex items-center gap-2", children: [
874
+ /* @__PURE__ */ e.jsx(Me, { className: "h-4 w-4" }),
767
875
  "Email Recipients"
768
876
  ] }),
769
877
  /* @__PURE__ */ e.jsx(
770
- A,
878
+ M,
771
879
  {
772
880
  placeholder: "email1@example.com, email2@example.com",
773
- value: ((h = s.recipients) == null ? void 0 : h.join(", ")) || "",
774
- onChange: (l) => d({
775
- recipients: l.target.value.split(",").map((j) => j.trim()).filter(Boolean)
881
+ value: ((i = a.recipients) == null ? void 0 : i.join(", ")) || "",
882
+ onChange: (r) => c({
883
+ recipients: r.target.value.split(",").map((p) => p.trim()).filter(Boolean)
776
884
  })
777
885
  }
778
886
  )
779
887
  ] }),
780
888
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
781
- /* @__PURE__ */ e.jsx(b, { children: "Email Subject" }),
889
+ /* @__PURE__ */ e.jsx(j, { children: "Email Subject" }),
782
890
  /* @__PURE__ */ e.jsx(
783
- A,
891
+ M,
784
892
  {
785
- value: s.subject || "",
786
- onChange: (l) => d({ subject: l.target.value }),
893
+ value: a.subject || "",
894
+ onChange: (r) => c({ subject: r.target.value }),
787
895
  placeholder: "Scheduled Report: {report_title}"
788
896
  }
789
897
  )
@@ -791,15 +899,15 @@ const we = ({ schema: r, onRefresh: i }) => {
791
899
  ] })
792
900
  ] })
793
901
  ] });
794
- }, Ue = ({ schema: r }) => {
902
+ }, Ke = ({ schema: s }) => {
795
903
  const {
796
- report: i,
797
- dataSources: s = [],
798
- availableFields: c = [],
799
- showPreview: d = !0,
800
- onSave: p,
801
- onCancel: f
802
- } = r, [n, h] = W(i || {
904
+ report: n,
905
+ dataSources: a = [],
906
+ availableFields: o = [],
907
+ showPreview: c = !0,
908
+ onSave: x,
909
+ onCancel: u
910
+ } = s, [t, i] = J(n || {
803
911
  type: "report",
804
912
  title: "New Report",
805
913
  fields: [],
@@ -808,145 +916,145 @@ const we = ({ schema: r, onRefresh: i }) => {
808
916
  sections: [],
809
917
  showExportButtons: !0,
810
918
  showPrintButton: !0
811
- }), [l, j] = W(n.fields || []), [y, R] = W(n.filters || []), [w, m] = W(n.groupBy || []), [v, N] = W(n.sections || []), k = () => {
812
- if (c.length > 0 && l.length < c.length) {
813
- const a = c.find(
814
- (o) => !l.some((u) => u.name === o.name)
919
+ }), [r, p] = J(t.fields || []), [v, S] = J(t.filters || []), [w, _] = J(t.groupBy || []), [k, m] = J(t.sections || []), N = () => {
920
+ if (o.length > 0 && r.length < o.length) {
921
+ const d = o.find(
922
+ (h) => !r.some((f) => f.name === h.name)
815
923
  );
816
- if (a) {
817
- const o = [...l, a];
818
- j(o), h({ ...n, fields: o });
924
+ if (d) {
925
+ const h = [...r, d];
926
+ p(h), i({ ...t, fields: h });
819
927
  }
820
928
  }
821
- }, g = (a) => {
822
- const o = l.filter((u, T) => T !== a);
823
- j(o), h({ ...n, fields: o });
824
- }, _ = (a, o) => {
825
- const u = [...l];
826
- u[a] = o, j(u), h({ ...n, fields: u });
827
- }, D = () => {
828
- var u;
829
- const a = {
830
- field: ((u = c[0]) == null ? void 0 : u.name) || "",
929
+ }, C = (d) => {
930
+ const h = r.filter((f, O) => O !== d);
931
+ p(h), i({ ...t, fields: h });
932
+ }, y = (d, h) => {
933
+ const f = [...r];
934
+ f[d] = h, p(f), i({ ...t, fields: f });
935
+ }, g = () => {
936
+ var f;
937
+ const d = {
938
+ field: ((f = o[0]) == null ? void 0 : f.name) || "",
831
939
  operator: "equals",
832
940
  value: ""
833
- }, o = [...y, a];
834
- R(o), h({ ...n, filters: o });
835
- }, M = (a) => {
836
- const o = y.filter((u, T) => T !== a);
837
- R(o), h({ ...n, filters: o });
838
- }, O = (a, o) => {
839
- const u = [...y];
840
- u[a] = o, R(u), h({ ...n, filters: u });
841
- }, q = () => {
842
- var u;
843
- const a = {
844
- field: ((u = c[0]) == null ? void 0 : u.name) || "",
941
+ }, h = [...v, d];
942
+ S(h), i({ ...t, filters: h });
943
+ }, T = (d) => {
944
+ const h = v.filter((f, O) => O !== d);
945
+ S(h), i({ ...t, filters: h });
946
+ }, $ = (d, h) => {
947
+ const f = [...v];
948
+ f[d] = h, S(f), i({ ...t, filters: f });
949
+ }, P = () => {
950
+ var f;
951
+ const d = {
952
+ field: ((f = o[0]) == null ? void 0 : f.name) || "",
845
953
  sort: "asc"
846
- }, o = [...w, a];
847
- m(o), h({ ...n, groupBy: o });
848
- }, H = (a) => {
849
- const o = w.filter((u, T) => T !== a);
850
- m(o), h({ ...n, groupBy: o });
851
- }, I = (a, o) => {
852
- const u = [...w];
853
- u[a] = o, m(u), h({ ...n, groupBy: u });
854
- }, J = (a) => {
855
- const o = {
856
- type: a,
857
- title: `New ${a} Section`
858
- }, u = [...v, o];
859
- N(u), h({ ...n, sections: u });
860
- }, ne = (a) => {
861
- const o = v.filter((u, T) => T !== a);
862
- N(o), h({ ...n, sections: o });
863
- }, P = (a, o) => {
864
- const u = [...v];
865
- u[a] = o, N(u), h({ ...n, sections: u });
866
- }, se = () => {
867
- console.log("Saving report:", n), p && alert("Report saved! (Handler: " + p + ")");
954
+ }, h = [...w, d];
955
+ _(h), i({ ...t, groupBy: h });
956
+ }, D = (d) => {
957
+ const h = w.filter((f, O) => O !== d);
958
+ _(h), i({ ...t, groupBy: h });
959
+ }, L = (d, h) => {
960
+ const f = [...w];
961
+ f[d] = h, _(f), i({ ...t, groupBy: f });
962
+ }, B = (d) => {
963
+ const h = {
964
+ type: d,
965
+ title: `New ${d} Section`
966
+ }, f = [...k, h];
967
+ m(f), i({ ...t, sections: f });
968
+ }, Z = (d) => {
969
+ const h = k.filter((f, O) => O !== d);
970
+ m(h), i({ ...t, sections: h });
971
+ }, I = (d, h) => {
972
+ const f = [...k];
973
+ f[d] = h, m(f), i({ ...t, sections: f });
974
+ }, re = () => {
975
+ console.log("Saving report:", t), x && alert("Report saved! (Handler: " + x + ")");
868
976
  }, ie = () => {
869
- f && console.log("Report cancelled:", f);
977
+ u && console.log("Report cancelled:", u);
870
978
  };
871
979
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
872
- /* @__PURE__ */ e.jsxs(B, { children: [
873
- /* @__PURE__ */ e.jsxs(ee, { children: [
874
- /* @__PURE__ */ e.jsx(te, { children: "Report Builder" }),
980
+ /* @__PURE__ */ e.jsxs(V, { children: [
981
+ /* @__PURE__ */ e.jsxs(ae, { children: [
982
+ /* @__PURE__ */ e.jsx(se, { children: "Report Builder" }),
875
983
  /* @__PURE__ */ e.jsx(he, { children: "Configure your report settings, fields, filters, and sections" })
876
984
  ] }),
877
- /* @__PURE__ */ e.jsxs(z, { children: [
878
- /* @__PURE__ */ e.jsxs(Re, { defaultValue: "basic", className: "w-full", children: [
879
- /* @__PURE__ */ e.jsxs(Se, { className: "grid w-full grid-cols-6", children: [
880
- /* @__PURE__ */ e.jsxs(U, { value: "basic", children: [
881
- /* @__PURE__ */ e.jsx(Ae, { className: "h-4 w-4 mr-2" }),
985
+ /* @__PURE__ */ e.jsxs(Y, { children: [
986
+ /* @__PURE__ */ e.jsxs(Fe, { defaultValue: "basic", className: "w-full", children: [
987
+ /* @__PURE__ */ e.jsxs(_e, { className: "grid w-full grid-cols-6", children: [
988
+ /* @__PURE__ */ e.jsxs(W, { value: "basic", children: [
989
+ /* @__PURE__ */ e.jsx(ze, { className: "h-4 w-4 mr-2" }),
882
990
  "Basic"
883
991
  ] }),
884
- /* @__PURE__ */ e.jsxs(U, { value: "fields", children: [
885
- /* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4 mr-2" }),
992
+ /* @__PURE__ */ e.jsxs(W, { value: "fields", children: [
993
+ /* @__PURE__ */ e.jsx(me, { className: "h-4 w-4 mr-2" }),
886
994
  "Fields"
887
995
  ] }),
888
- /* @__PURE__ */ e.jsxs(U, { value: "filters", children: [
889
- /* @__PURE__ */ e.jsx($e, { className: "h-4 w-4 mr-2" }),
996
+ /* @__PURE__ */ e.jsxs(W, { value: "filters", children: [
997
+ /* @__PURE__ */ e.jsx(Ie, { className: "h-4 w-4 mr-2" }),
890
998
  "Filters"
891
999
  ] }),
892
- /* @__PURE__ */ e.jsxs(U, { value: "grouping", children: [
893
- /* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4 mr-2" }),
1000
+ /* @__PURE__ */ e.jsxs(W, { value: "grouping", children: [
1001
+ /* @__PURE__ */ e.jsx(me, { className: "h-4 w-4 mr-2" }),
894
1002
  "Group By"
895
1003
  ] }),
896
- /* @__PURE__ */ e.jsxs(U, { value: "sections", children: [
897
- /* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4 mr-2" }),
1004
+ /* @__PURE__ */ e.jsxs(W, { value: "sections", children: [
1005
+ /* @__PURE__ */ e.jsx(me, { className: "h-4 w-4 mr-2" }),
898
1006
  "Sections"
899
1007
  ] }),
900
- /* @__PURE__ */ e.jsxs(U, { value: "schedule", children: [
1008
+ /* @__PURE__ */ e.jsxs(W, { value: "schedule", children: [
901
1009
  /* @__PURE__ */ e.jsx(je, { className: "h-4 w-4 mr-2" }),
902
1010
  "Schedule"
903
1011
  ] })
904
1012
  ] }),
905
- /* @__PURE__ */ e.jsx(Y, { value: "basic", className: "space-y-4 mt-4", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
1013
+ /* @__PURE__ */ e.jsx(H, { value: "basic", className: "space-y-4 mt-4", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
906
1014
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
907
- /* @__PURE__ */ e.jsx(b, { htmlFor: "report-title", children: "Report Title" }),
1015
+ /* @__PURE__ */ e.jsx(j, { htmlFor: "report-title", children: "Report Title" }),
908
1016
  /* @__PURE__ */ e.jsx(
909
- A,
1017
+ M,
910
1018
  {
911
1019
  id: "report-title",
912
- value: n.title || "",
913
- onChange: (a) => h({ ...n, title: a.target.value }),
1020
+ value: t.title || "",
1021
+ onChange: (d) => i({ ...t, title: d.target.value }),
914
1022
  placeholder: "Enter report title"
915
1023
  }
916
1024
  )
917
1025
  ] }),
918
1026
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
919
- /* @__PURE__ */ e.jsx(b, { htmlFor: "report-description", children: "Description" }),
1027
+ /* @__PURE__ */ e.jsx(j, { htmlFor: "report-description", children: "Description" }),
920
1028
  /* @__PURE__ */ e.jsx(
921
- A,
1029
+ M,
922
1030
  {
923
1031
  id: "report-description",
924
- value: n.description || "",
925
- onChange: (a) => h({ ...n, description: a.target.value }),
1032
+ value: t.description || "",
1033
+ onChange: (d) => i({ ...t, description: d.target.value }),
926
1034
  placeholder: "Enter report description"
927
1035
  }
928
1036
  )
929
1037
  ] }),
930
- s.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
931
- /* @__PURE__ */ e.jsx(b, { children: "Data Source" }),
1038
+ a.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
1039
+ /* @__PURE__ */ e.jsx(j, { children: "Data Source" }),
932
1040
  /* @__PURE__ */ e.jsxs("select", { className: "w-full border rounded-md p-2", children: [
933
1041
  /* @__PURE__ */ e.jsx("option", { value: "", children: "Select a data source" }),
934
- s.map((a, o) => /* @__PURE__ */ e.jsxs("option", { value: o, children: [
1042
+ a.map((d, h) => /* @__PURE__ */ e.jsxs("option", { value: h, children: [
935
1043
  "Data Source ",
936
- o + 1
937
- ] }, o))
1044
+ h + 1
1045
+ ] }, h))
938
1046
  ] })
939
1047
  ] }),
940
1048
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
941
- /* @__PURE__ */ e.jsx(b, { children: "Export Options" }),
1049
+ /* @__PURE__ */ e.jsx(j, { children: "Export Options" }),
942
1050
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
943
1051
  /* @__PURE__ */ e.jsxs("label", { className: "flex items-center gap-2", children: [
944
1052
  /* @__PURE__ */ e.jsx(
945
1053
  "input",
946
1054
  {
947
1055
  type: "checkbox",
948
- checked: n.showExportButtons || !1,
949
- onChange: (a) => h({ ...n, showExportButtons: a.target.checked })
1056
+ checked: t.showExportButtons || !1,
1057
+ onChange: (d) => i({ ...t, showExportButtons: d.target.checked })
950
1058
  }
951
1059
  ),
952
1060
  /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: "Show Export Buttons" })
@@ -956,8 +1064,8 @@ const we = ({ schema: r, onRefresh: i }) => {
956
1064
  "input",
957
1065
  {
958
1066
  type: "checkbox",
959
- checked: n.showPrintButton || !1,
960
- onChange: (a) => h({ ...n, showPrintButton: a.target.checked })
1067
+ checked: t.showPrintButton || !1,
1068
+ onChange: (d) => i({ ...t, showPrintButton: d.target.checked })
961
1069
  }
962
1070
  ),
963
1071
  /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: "Show Print Button" })
@@ -965,14 +1073,14 @@ const we = ({ schema: r, onRefresh: i }) => {
965
1073
  ] })
966
1074
  ] }),
967
1075
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
968
- /* @__PURE__ */ e.jsx(b, { htmlFor: "export-format", children: "Default Export Format" }),
1076
+ /* @__PURE__ */ e.jsx(j, { htmlFor: "export-format", children: "Default Export Format" }),
969
1077
  /* @__PURE__ */ e.jsxs(
970
1078
  "select",
971
1079
  {
972
1080
  id: "export-format",
973
1081
  className: "w-full border rounded-md p-2",
974
- value: n.defaultExportFormat || "pdf",
975
- onChange: (a) => h({ ...n, defaultExportFormat: a.target.value }),
1082
+ value: t.defaultExportFormat || "pdf",
1083
+ onChange: (d) => i({ ...t, defaultExportFormat: d.target.value }),
976
1084
  children: [
977
1085
  /* @__PURE__ */ e.jsx("option", { value: "pdf", children: "PDF" }),
978
1086
  /* @__PURE__ */ e.jsx("option", { value: "excel", children: "Excel" }),
@@ -984,48 +1092,48 @@ const we = ({ schema: r, onRefresh: i }) => {
984
1092
  )
985
1093
  ] })
986
1094
  ] }) }),
987
- /* @__PURE__ */ e.jsxs(Y, { value: "fields", className: "space-y-4 mt-4", children: [
1095
+ /* @__PURE__ */ e.jsxs(H, { value: "fields", className: "space-y-4 mt-4", children: [
988
1096
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
989
- /* @__PURE__ */ e.jsx(b, { children: "Report Fields" }),
1097
+ /* @__PURE__ */ e.jsx(j, { children: "Report Fields" }),
990
1098
  /* @__PURE__ */ e.jsxs(
991
- F,
1099
+ E,
992
1100
  {
993
1101
  size: "sm",
994
1102
  variant: "outline",
995
- onClick: k,
996
- disabled: l.length >= c.length,
1103
+ onClick: N,
1104
+ disabled: r.length >= o.length,
997
1105
  children: [
998
- /* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 mr-2" }),
1106
+ /* @__PURE__ */ e.jsx(G, { className: "h-4 w-4 mr-2" }),
999
1107
  "Add Field"
1000
1108
  ]
1001
1109
  }
1002
1110
  )
1003
1111
  ] }),
1004
1112
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
1005
- l.map((a, o) => /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2 p-3 border rounded-lg", children: /* @__PURE__ */ e.jsxs("div", { className: "flex-1 grid grid-cols-4 gap-2", children: [
1113
+ r.map((d, h) => /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2 p-3 border rounded-lg", children: /* @__PURE__ */ e.jsxs("div", { className: "flex-1 grid grid-cols-4 gap-2", children: [
1006
1114
  /* @__PURE__ */ e.jsxs("div", { children: [
1007
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Field Name" }),
1008
- /* @__PURE__ */ e.jsx("div", { className: "text-sm font-medium", children: a.name })
1115
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "Field Name" }),
1116
+ /* @__PURE__ */ e.jsx("div", { className: "text-sm font-medium", children: d.name })
1009
1117
  ] }),
1010
1118
  /* @__PURE__ */ e.jsxs("div", { children: [
1011
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Label" }),
1119
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "Label" }),
1012
1120
  /* @__PURE__ */ e.jsx(
1013
- A,
1121
+ M,
1014
1122
  {
1015
1123
  className: "h-8 text-sm",
1016
- value: a.label || a.name,
1017
- onChange: (u) => _(o, { ...a, label: u.target.value })
1124
+ value: d.label || d.name,
1125
+ onChange: (f) => y(h, { ...d, label: f.target.value })
1018
1126
  }
1019
1127
  )
1020
1128
  ] }),
1021
1129
  /* @__PURE__ */ e.jsxs("div", { children: [
1022
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Aggregation" }),
1130
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "Aggregation" }),
1023
1131
  /* @__PURE__ */ e.jsxs(
1024
1132
  "select",
1025
1133
  {
1026
1134
  className: "w-full border rounded-md h-8 text-sm px-2",
1027
- value: a.aggregation || "",
1028
- onChange: (u) => _(o, { ...a, aggregation: u.target.value }),
1135
+ value: d.aggregation || "",
1136
+ onChange: (f) => y(h, { ...d, aggregation: f.target.value }),
1029
1137
  children: [
1030
1138
  /* @__PURE__ */ e.jsx("option", { value: "", children: "None" }),
1031
1139
  /* @__PURE__ */ e.jsx("option", { value: "sum", children: "Sum" }),
@@ -1038,50 +1146,50 @@ const we = ({ schema: r, onRefresh: i }) => {
1038
1146
  )
1039
1147
  ] }),
1040
1148
  /* @__PURE__ */ e.jsx("div", { className: "flex items-end justify-end", children: /* @__PURE__ */ e.jsx(
1041
- F,
1149
+ E,
1042
1150
  {
1043
1151
  size: "sm",
1044
1152
  variant: "ghost",
1045
1153
  className: "text-red-500 hover:text-red-700 hover:bg-red-50",
1046
- onClick: () => g(o),
1047
- children: /* @__PURE__ */ e.jsx(ae, { className: "h-4 w-4" })
1154
+ onClick: () => C(h),
1155
+ children: /* @__PURE__ */ e.jsx(X, { className: "h-4 w-4" })
1048
1156
  }
1049
1157
  ) })
1050
- ] }) }, o)),
1051
- l.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg", children: 'No fields selected. Click "Add Field" to begin.' })
1158
+ ] }) }, h)),
1159
+ r.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg", children: 'No fields selected. Click "Add Field" to begin.' })
1052
1160
  ] })
1053
1161
  ] }),
1054
- /* @__PURE__ */ e.jsxs(Y, { value: "filters", className: "space-y-4 mt-4", children: [
1162
+ /* @__PURE__ */ e.jsxs(H, { value: "filters", className: "space-y-4 mt-4", children: [
1055
1163
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
1056
- /* @__PURE__ */ e.jsx(b, { children: "Report Filters" }),
1057
- /* @__PURE__ */ e.jsxs(F, { size: "sm", variant: "outline", onClick: D, children: [
1058
- /* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 mr-2" }),
1164
+ /* @__PURE__ */ e.jsx(j, { children: "Report Filters" }),
1165
+ /* @__PURE__ */ e.jsxs(E, { size: "sm", variant: "outline", onClick: g, children: [
1166
+ /* @__PURE__ */ e.jsx(G, { className: "h-4 w-4 mr-2" }),
1059
1167
  "Add Filter"
1060
1168
  ] })
1061
1169
  ] }),
1062
1170
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
1063
- y.map((a, o) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 p-3 border rounded-lg", children: [
1171
+ v.map((d, h) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 p-3 border rounded-lg", children: [
1064
1172
  /* @__PURE__ */ e.jsxs("div", { className: "flex-1 grid grid-cols-3 gap-2", children: [
1065
1173
  /* @__PURE__ */ e.jsxs("div", { children: [
1066
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Field" }),
1174
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "Field" }),
1067
1175
  /* @__PURE__ */ e.jsx(
1068
1176
  "select",
1069
1177
  {
1070
1178
  className: "w-full border rounded-md h-8 text-sm px-2",
1071
- value: a.field,
1072
- onChange: (u) => O(o, { ...a, field: u.target.value }),
1073
- children: c.map((u, T) => /* @__PURE__ */ e.jsx("option", { value: u.name, children: u.label || u.name }, T))
1179
+ value: d.field,
1180
+ onChange: (f) => $(h, { ...d, field: f.target.value }),
1181
+ children: o.map((f, O) => /* @__PURE__ */ e.jsx("option", { value: f.name, children: f.label || f.name }, O))
1074
1182
  }
1075
1183
  )
1076
1184
  ] }),
1077
1185
  /* @__PURE__ */ e.jsxs("div", { children: [
1078
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Operator" }),
1186
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "Operator" }),
1079
1187
  /* @__PURE__ */ e.jsxs(
1080
1188
  "select",
1081
1189
  {
1082
1190
  className: "w-full border rounded-md h-8 text-sm px-2",
1083
- value: a.operator,
1084
- onChange: (u) => O(o, { ...a, operator: u.target.value }),
1191
+ value: d.operator,
1192
+ onChange: (f) => $(h, { ...d, operator: f.target.value }),
1085
1193
  children: [
1086
1194
  /* @__PURE__ */ e.jsx("option", { value: "equals", children: "Equals" }),
1087
1195
  /* @__PURE__ */ e.jsx("option", { value: "contains", children: "Contains" }),
@@ -1093,62 +1201,62 @@ const we = ({ schema: r, onRefresh: i }) => {
1093
1201
  )
1094
1202
  ] }),
1095
1203
  /* @__PURE__ */ e.jsxs("div", { children: [
1096
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Value" }),
1204
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "Value" }),
1097
1205
  /* @__PURE__ */ e.jsx(
1098
- A,
1206
+ M,
1099
1207
  {
1100
1208
  className: "h-8 text-sm",
1101
- value: String(a.value),
1102
- onChange: (u) => O(o, { ...a, value: u.target.value })
1209
+ value: String(d.value),
1210
+ onChange: (f) => $(h, { ...d, value: f.target.value })
1103
1211
  }
1104
1212
  )
1105
1213
  ] })
1106
1214
  ] }),
1107
1215
  /* @__PURE__ */ e.jsx(
1108
- F,
1216
+ E,
1109
1217
  {
1110
1218
  size: "sm",
1111
1219
  variant: "ghost",
1112
1220
  className: "text-red-500 hover:text-red-700 hover:bg-red-50 self-end",
1113
- onClick: () => M(o),
1114
- children: /* @__PURE__ */ e.jsx(ae, { className: "h-4 w-4" })
1221
+ onClick: () => T(h),
1222
+ children: /* @__PURE__ */ e.jsx(X, { className: "h-4 w-4" })
1115
1223
  }
1116
1224
  )
1117
- ] }, o)),
1118
- y.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg", children: "No filters defined." })
1225
+ ] }, h)),
1226
+ v.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg", children: "No filters defined." })
1119
1227
  ] })
1120
1228
  ] }),
1121
- /* @__PURE__ */ e.jsxs(Y, { value: "grouping", className: "space-y-4 mt-4", children: [
1229
+ /* @__PURE__ */ e.jsxs(H, { value: "grouping", className: "space-y-4 mt-4", children: [
1122
1230
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
1123
- /* @__PURE__ */ e.jsx(b, { children: "Grouping Rules" }),
1124
- /* @__PURE__ */ e.jsxs(F, { size: "sm", variant: "outline", onClick: q, children: [
1125
- /* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 mr-2" }),
1231
+ /* @__PURE__ */ e.jsx(j, { children: "Grouping Rules" }),
1232
+ /* @__PURE__ */ e.jsxs(E, { size: "sm", variant: "outline", onClick: P, children: [
1233
+ /* @__PURE__ */ e.jsx(G, { className: "h-4 w-4 mr-2" }),
1126
1234
  "Add Group"
1127
1235
  ] })
1128
1236
  ] }),
1129
1237
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
1130
- w.map((a, o) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 p-3 border rounded-lg", children: [
1238
+ w.map((d, h) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 p-3 border rounded-lg", children: [
1131
1239
  /* @__PURE__ */ e.jsxs("div", { className: "flex-1 grid grid-cols-2 gap-2", children: [
1132
1240
  /* @__PURE__ */ e.jsxs("div", { children: [
1133
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Field" }),
1241
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "Field" }),
1134
1242
  /* @__PURE__ */ e.jsx(
1135
1243
  "select",
1136
1244
  {
1137
1245
  className: "w-full border rounded-md h-8 text-sm px-2",
1138
- value: a.field,
1139
- onChange: (u) => I(o, { ...a, field: u.target.value }),
1140
- children: c.map((u, T) => /* @__PURE__ */ e.jsx("option", { value: u.name, children: u.label || u.name }, T))
1246
+ value: d.field,
1247
+ onChange: (f) => L(h, { ...d, field: f.target.value }),
1248
+ children: o.map((f, O) => /* @__PURE__ */ e.jsx("option", { value: f.name, children: f.label || f.name }, O))
1141
1249
  }
1142
1250
  )
1143
1251
  ] }),
1144
1252
  /* @__PURE__ */ e.jsxs("div", { children: [
1145
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Sort Order" }),
1253
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "Sort Order" }),
1146
1254
  /* @__PURE__ */ e.jsxs(
1147
1255
  "select",
1148
1256
  {
1149
1257
  className: "w-full border rounded-md h-8 text-sm px-2",
1150
- value: a.sort || "asc",
1151
- onChange: (u) => I(o, { ...a, sort: u.target.value }),
1258
+ value: d.sort || "asc",
1259
+ onChange: (f) => L(h, { ...d, sort: f.target.value }),
1152
1260
  children: [
1153
1261
  /* @__PURE__ */ e.jsx("option", { value: "asc", children: "Ascending" }),
1154
1262
  /* @__PURE__ */ e.jsx("option", { value: "desc", children: "Descending" })
@@ -1158,92 +1266,92 @@ const we = ({ schema: r, onRefresh: i }) => {
1158
1266
  ] })
1159
1267
  ] }),
1160
1268
  /* @__PURE__ */ e.jsx(
1161
- F,
1269
+ E,
1162
1270
  {
1163
1271
  size: "sm",
1164
1272
  variant: "ghost",
1165
1273
  className: "text-red-500 hover:text-red-700 hover:bg-red-50 self-end",
1166
- onClick: () => H(o),
1167
- children: /* @__PURE__ */ e.jsx(ae, { className: "h-4 w-4" })
1274
+ onClick: () => D(h),
1275
+ children: /* @__PURE__ */ e.jsx(X, { className: "h-4 w-4" })
1168
1276
  }
1169
1277
  )
1170
- ] }, o)),
1278
+ ] }, h)),
1171
1279
  w.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg", children: "No grouping rules applied." })
1172
1280
  ] })
1173
1281
  ] }),
1174
- /* @__PURE__ */ e.jsxs(Y, { value: "sections", className: "space-y-4 mt-4", children: [
1282
+ /* @__PURE__ */ e.jsxs(H, { value: "sections", className: "space-y-4 mt-4", children: [
1175
1283
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
1176
- /* @__PURE__ */ e.jsx(b, { children: "Report Sections" }),
1284
+ /* @__PURE__ */ e.jsx(j, { children: "Report Sections" }),
1177
1285
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
1178
- /* @__PURE__ */ e.jsxs(F, { size: "sm", variant: "outline", onClick: () => J("header"), children: [
1179
- /* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 mr-2" }),
1286
+ /* @__PURE__ */ e.jsxs(E, { size: "sm", variant: "outline", onClick: () => B("header"), children: [
1287
+ /* @__PURE__ */ e.jsx(G, { className: "h-4 w-4 mr-2" }),
1180
1288
  "Header"
1181
1289
  ] }),
1182
- /* @__PURE__ */ e.jsxs(F, { size: "sm", variant: "outline", onClick: () => J("chart"), children: [
1183
- /* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 mr-2" }),
1290
+ /* @__PURE__ */ e.jsxs(E, { size: "sm", variant: "outline", onClick: () => B("chart"), children: [
1291
+ /* @__PURE__ */ e.jsx(G, { className: "h-4 w-4 mr-2" }),
1184
1292
  "Chart"
1185
1293
  ] }),
1186
- /* @__PURE__ */ e.jsxs(F, { size: "sm", variant: "outline", onClick: () => J("table"), children: [
1187
- /* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 mr-2" }),
1294
+ /* @__PURE__ */ e.jsxs(E, { size: "sm", variant: "outline", onClick: () => B("table"), children: [
1295
+ /* @__PURE__ */ e.jsx(G, { className: "h-4 w-4 mr-2" }),
1188
1296
  "Table"
1189
1297
  ] })
1190
1298
  ] })
1191
1299
  ] }),
1192
1300
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
1193
- v.map((a, o) => {
1194
- var u, T, X, Z;
1301
+ k.map((d, h) => {
1302
+ var f, O, Q, K;
1195
1303
  return /* @__PURE__ */ e.jsxs("div", { className: "p-3 border rounded-lg space-y-2", children: [
1196
1304
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
1197
1305
  /* @__PURE__ */ e.jsxs("div", { className: "font-medium flex items-center gap-2", children: [
1198
- /* @__PURE__ */ e.jsx("div", { className: "text-xs bg-muted px-2 py-0.5 rounded uppercase", children: a.type }),
1199
- a.title
1306
+ /* @__PURE__ */ e.jsx("div", { className: "text-xs bg-muted px-2 py-0.5 rounded uppercase", children: d.type }),
1307
+ d.title
1200
1308
  ] }),
1201
1309
  /* @__PURE__ */ e.jsx(
1202
- F,
1310
+ E,
1203
1311
  {
1204
1312
  size: "sm",
1205
1313
  variant: "ghost",
1206
1314
  className: "text-red-500 hover:text-red-700 hover:bg-red-50",
1207
- onClick: () => ne(o),
1208
- children: /* @__PURE__ */ e.jsx(ae, { className: "h-4 w-4" })
1315
+ onClick: () => Z(h),
1316
+ children: /* @__PURE__ */ e.jsx(X, { className: "h-4 w-4" })
1209
1317
  }
1210
1318
  )
1211
1319
  ] }),
1212
1320
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
1213
1321
  /* @__PURE__ */ e.jsxs("div", { children: [
1214
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Title" }),
1322
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "Title" }),
1215
1323
  /* @__PURE__ */ e.jsx(
1216
- A,
1324
+ M,
1217
1325
  {
1218
1326
  className: "h-8 text-sm",
1219
- value: a.title || "",
1220
- onChange: (t) => P(o, { ...a, title: t.target.value })
1327
+ value: d.title || "",
1328
+ onChange: (l) => I(h, { ...d, title: l.target.value })
1221
1329
  }
1222
1330
  )
1223
1331
  ] }),
1224
- a.type === "text" && /* @__PURE__ */ e.jsxs("div", { className: "col-span-2", children: [
1225
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Content" }),
1332
+ d.type === "text" && /* @__PURE__ */ e.jsxs("div", { className: "col-span-2", children: [
1333
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "Content" }),
1226
1334
  /* @__PURE__ */ e.jsx(
1227
- A,
1335
+ M,
1228
1336
  {
1229
1337
  className: "h-8 text-sm",
1230
- value: a.text || "",
1231
- onChange: (t) => P(o, { ...a, text: t.target.value })
1338
+ value: d.text || "",
1339
+ onChange: (l) => I(h, { ...d, text: l.target.value })
1232
1340
  }
1233
1341
  )
1234
1342
  ] }),
1235
- a.type === "chart" && /* @__PURE__ */ e.jsxs("div", { className: "col-span-2 grid grid-cols-2 gap-2 mt-2 p-2 bg-muted/20 rounded", children: [
1236
- /* @__PURE__ */ e.jsx("div", { className: "col-span-2", children: /* @__PURE__ */ e.jsx(b, { className: "text-xs font-semibold", children: "Chart Configuration" }) }),
1343
+ d.type === "chart" && /* @__PURE__ */ e.jsxs("div", { className: "col-span-2 grid grid-cols-2 gap-2 mt-2 p-2 bg-muted/20 rounded", children: [
1344
+ /* @__PURE__ */ e.jsx("div", { className: "col-span-2", children: /* @__PURE__ */ e.jsx(j, { className: "text-xs font-semibold", children: "Chart Configuration" }) }),
1237
1345
  /* @__PURE__ */ e.jsxs("div", { children: [
1238
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Chart Type" }),
1346
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "Chart Type" }),
1239
1347
  /* @__PURE__ */ e.jsxs(
1240
1348
  "select",
1241
1349
  {
1242
1350
  className: "flex h-8 w-full rounded-md border border-input bg-background px-3 py-1 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
1243
- value: ((u = a.chart) == null ? void 0 : u.chartType) || "bar",
1244
- onChange: (t) => P(o, {
1245
- ...a,
1246
- chart: { ...a.chart, type: "chart", chartType: t.target.value }
1351
+ value: ((f = d.chart) == null ? void 0 : f.chartType) || "bar",
1352
+ onChange: (l) => I(h, {
1353
+ ...d,
1354
+ chart: { ...d.chart, type: "chart", chartType: l.target.value }
1247
1355
  }),
1248
1356
  children: [
1249
1357
  /* @__PURE__ */ e.jsx("option", { value: "bar", children: "Bar" }),
@@ -1255,20 +1363,20 @@ const we = ({ schema: r, onRefresh: i }) => {
1255
1363
  )
1256
1364
  ] }),
1257
1365
  /* @__PURE__ */ e.jsxs("div", { children: [
1258
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "X-Axis Field" }),
1366
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "X-Axis Field" }),
1259
1367
  /* @__PURE__ */ e.jsxs(
1260
1368
  "select",
1261
1369
  {
1262
1370
  className: "flex h-8 w-full rounded-md border border-input bg-background px-3 py-1 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
1263
- value: ((T = a.chart) == null ? void 0 : T.xAxisField) || "",
1264
- onChange: (t) => P(o, {
1265
- ...a,
1266
- chart: { ...a.chart, type: "chart", xAxisField: t.target.value }
1371
+ value: ((O = d.chart) == null ? void 0 : O.xAxisField) || "",
1372
+ onChange: (l) => I(h, {
1373
+ ...d,
1374
+ chart: { ...d.chart, type: "chart", xAxisField: l.target.value }
1267
1375
  }),
1268
1376
  children: [
1269
1377
  /* @__PURE__ */ e.jsx("option", { value: "", children: "Select Field..." }),
1270
- c.map((t) => /* @__PURE__ */ e.jsx("option", { value: t.name, children: t.label || t.name }, t.name)),
1271
- c.length === 0 && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1378
+ o.map((l) => /* @__PURE__ */ e.jsx("option", { value: l.name, children: l.label || l.name }, l.name)),
1379
+ o.length === 0 && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1272
1380
  /* @__PURE__ */ e.jsx("option", { value: "name", children: "Name" }),
1273
1381
  /* @__PURE__ */ e.jsx("option", { value: "month", children: "Month" })
1274
1382
  ] })
@@ -1277,19 +1385,19 @@ const we = ({ schema: r, onRefresh: i }) => {
1277
1385
  )
1278
1386
  ] }),
1279
1387
  /* @__PURE__ */ e.jsxs("div", { className: "col-span-2", children: [
1280
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Y-Axis Fields (comma separated)" }),
1388
+ /* @__PURE__ */ e.jsx(j, { className: "text-xs", children: "Y-Axis Fields (comma separated)" }),
1281
1389
  /* @__PURE__ */ e.jsx(
1282
- A,
1390
+ M,
1283
1391
  {
1284
1392
  className: "h-8 text-sm",
1285
1393
  placeholder: "e.g. value, count",
1286
- value: ((Z = (X = a.chart) == null ? void 0 : X.yAxisFields) == null ? void 0 : Z.join(", ")) || "",
1287
- onChange: (t) => P(o, {
1288
- ...a,
1394
+ value: ((K = (Q = d.chart) == null ? void 0 : Q.yAxisFields) == null ? void 0 : K.join(", ")) || "",
1395
+ onChange: (l) => I(h, {
1396
+ ...d,
1289
1397
  chart: {
1290
- ...a.chart,
1398
+ ...d.chart,
1291
1399
  type: "chart",
1292
- yAxisFields: t.target.value.split(",").map((x) => x.trim()).filter(Boolean)
1400
+ yAxisFields: l.target.value.split(",").map((b) => b.trim()).filter(Boolean)
1293
1401
  }
1294
1402
  })
1295
1403
  }
@@ -1297,41 +1405,41 @@ const we = ({ schema: r, onRefresh: i }) => {
1297
1405
  ] })
1298
1406
  ] })
1299
1407
  ] })
1300
- ] }, o);
1408
+ ] }, h);
1301
1409
  }),
1302
- v.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg", children: "No customized sections. The default report layout will be used." })
1410
+ k.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg", children: "No customized sections. The default report layout will be used." })
1303
1411
  ] })
1304
1412
  ] }),
1305
- /* @__PURE__ */ e.jsx(Y, { value: "schedule", className: "space-y-4 mt-4", children: /* @__PURE__ */ e.jsx(
1306
- Ge,
1413
+ /* @__PURE__ */ e.jsx(H, { value: "schedule", className: "space-y-4 mt-4", children: /* @__PURE__ */ e.jsx(
1414
+ Re,
1307
1415
  {
1308
- schedule: n.schedule,
1309
- onChange: (a) => h({ ...n, schedule: a })
1416
+ schedule: t.schedule,
1417
+ onChange: (d) => i({ ...t, schedule: d })
1310
1418
  }
1311
1419
  ) })
1312
1420
  ] }),
1313
1421
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-end gap-2 mt-6 pt-4 border-t", children: [
1314
- /* @__PURE__ */ e.jsx(F, { variant: "outline", onClick: ie, children: "Cancel" }),
1315
- /* @__PURE__ */ e.jsxs(F, { onClick: se, children: [
1316
- /* @__PURE__ */ e.jsx(Oe, { className: "h-4 w-4 mr-2" }),
1422
+ /* @__PURE__ */ e.jsx(E, { variant: "outline", onClick: ie, children: "Cancel" }),
1423
+ /* @__PURE__ */ e.jsxs(E, { onClick: re, children: [
1424
+ /* @__PURE__ */ e.jsx(Ge, { className: "h-4 w-4 mr-2" }),
1317
1425
  "Save Report"
1318
1426
  ] })
1319
1427
  ] })
1320
1428
  ] })
1321
1429
  ] }),
1322
- d && /* @__PURE__ */ e.jsxs(B, { className: "mt-8 border-2 border-blue-100", children: [
1323
- /* @__PURE__ */ e.jsx(ee, { className: "bg-blue-50/50", children: /* @__PURE__ */ e.jsx(te, { className: "text-blue-900 text-sm uppercase tracking-wide", children: "Live Preview" }) }),
1324
- /* @__PURE__ */ e.jsx(z, { className: "pt-6", children: /* @__PURE__ */ e.jsx(
1325
- we,
1430
+ c && /* @__PURE__ */ e.jsxs(V, { className: "mt-8 border-2 border-blue-100", children: [
1431
+ /* @__PURE__ */ e.jsx(ae, { className: "bg-blue-50/50", children: /* @__PURE__ */ e.jsx(se, { className: "text-blue-900 text-sm uppercase tracking-wide", children: "Live Preview" }) }),
1432
+ /* @__PURE__ */ e.jsx(Y, { className: "pt-6", children: /* @__PURE__ */ e.jsx(
1433
+ Se,
1326
1434
  {
1327
1435
  schema: {
1328
1436
  type: "report-viewer",
1329
1437
  report: {
1330
- ...n,
1331
- fields: l,
1332
- filters: y,
1438
+ ...t,
1439
+ fields: r,
1440
+ filters: v,
1333
1441
  groupBy: w,
1334
- sections: v
1442
+ sections: k
1335
1443
  },
1336
1444
  // Mock data for preview
1337
1445
  data: [
@@ -1344,130 +1452,713 @@ const we = ({ schema: r, onRefresh: i }) => {
1344
1452
  ) })
1345
1453
  ] })
1346
1454
  ] });
1347
- };
1348
- async function Ye(r, i) {
1349
- var h;
1455
+ }, et = [
1456
+ { value: "", label: "None" },
1457
+ { value: "sum", label: "Sum" },
1458
+ { value: "count", label: "Count" },
1459
+ { value: "avg", label: "Average" },
1460
+ { value: "min", label: "Min" },
1461
+ { value: "max", label: "Max" }
1462
+ ];
1463
+ function tt({
1464
+ availableFields: s,
1465
+ value: n,
1466
+ onChange: a
1467
+ }) {
1468
+ const o = Array.isArray(n) ? n.map((t) => typeof t == "string" ? { name: t, label: t, type: "string" } : { name: t.name || t.field || t.value, label: t.label || t.name || "", type: t.type || "string", aggregation: t.aggregation }) : [], c = o.map((t) => t.name), x = (t) => {
1469
+ const i = c.includes(t);
1470
+ let r;
1471
+ if (i)
1472
+ r = o.filter((p) => p.name !== t);
1473
+ else {
1474
+ const p = s.find((v) => v.value === t);
1475
+ r = [...o, { name: t, label: (p == null ? void 0 : p.label) || t, type: (p == null ? void 0 : p.type) || "string" }];
1476
+ }
1477
+ a(r);
1478
+ }, u = (t, i) => {
1479
+ const r = o.map(
1480
+ (p) => p.name === t ? { ...p, aggregation: i || void 0, showInSummary: !!i } : p
1481
+ );
1482
+ a(r);
1483
+ };
1484
+ return s.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "text-xs text-muted-foreground py-2", "data-testid": "field-picker-empty", children: "No fields available" }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-1 py-1", "data-testid": "field-picker", children: s.map((t) => {
1485
+ const i = c.includes(t.value), r = o.find((p) => p.name === t.value);
1486
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 px-1 py-0.5 rounded hover:bg-muted/50 text-xs", children: [
1487
+ /* @__PURE__ */ e.jsxs("label", { className: "flex items-center gap-2 flex-1 cursor-pointer", children: [
1488
+ /* @__PURE__ */ e.jsx(
1489
+ Pe,
1490
+ {
1491
+ checked: i,
1492
+ onCheckedChange: () => x(t.value),
1493
+ "data-testid": `field-picker-${t.value}`
1494
+ }
1495
+ ),
1496
+ /* @__PURE__ */ e.jsx("span", { className: "flex-1", children: t.label }),
1497
+ t.type && /* @__PURE__ */ e.jsx("span", { className: "text-[10px] text-muted-foreground", children: t.type })
1498
+ ] }),
1499
+ i && /* @__PURE__ */ e.jsx(
1500
+ "select",
1501
+ {
1502
+ className: "h-5 text-[10px] border rounded px-1 bg-background",
1503
+ value: (r == null ? void 0 : r.aggregation) || "",
1504
+ onChange: (p) => u(t.value, p.target.value),
1505
+ "data-testid": `field-agg-${t.value}`,
1506
+ children: et.map((p) => /* @__PURE__ */ e.jsx("option", { value: p.value, children: p.label }, p.value))
1507
+ }
1508
+ )
1509
+ ] }, t.value);
1510
+ }) });
1511
+ }
1512
+ const at = [
1513
+ { value: "", label: "None" },
1514
+ { value: "bar", label: "Bar Chart" },
1515
+ { value: "line", label: "Line Chart" },
1516
+ { value: "pie", label: "Pie Chart" },
1517
+ { value: "area", label: "Area Chart" },
1518
+ { value: "donut", label: "Donut Chart" },
1519
+ { value: "scatter", label: "Scatter Plot" }
1520
+ ];
1521
+ function st({
1522
+ availableFields: s,
1523
+ value: n,
1524
+ onChange: a
1525
+ }) {
1526
+ var x;
1527
+ const o = n || {}, c = (u) => a({ ...o, ...u });
1528
+ return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2 py-1", "data-testid": "chart-config", children: [
1529
+ /* @__PURE__ */ e.jsxs("div", { children: [
1530
+ /* @__PURE__ */ e.jsx("label", { className: "text-[10px] text-muted-foreground", children: "Chart type" }),
1531
+ /* @__PURE__ */ e.jsx(
1532
+ "select",
1533
+ {
1534
+ className: "w-full h-7 text-xs border rounded px-2 bg-background",
1535
+ value: o.chartType || "",
1536
+ onChange: (u) => c({ chartType: u.target.value || void 0 }),
1537
+ "data-testid": "chart-type-select",
1538
+ children: at.map((u) => /* @__PURE__ */ e.jsx("option", { value: u.value, children: u.label }, u.value))
1539
+ }
1540
+ )
1541
+ ] }),
1542
+ o.chartType && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1543
+ /* @__PURE__ */ e.jsxs("div", { children: [
1544
+ /* @__PURE__ */ e.jsx("label", { className: "text-[10px] text-muted-foreground", children: "X-axis field" }),
1545
+ /* @__PURE__ */ e.jsxs(
1546
+ "select",
1547
+ {
1548
+ className: "w-full h-7 text-xs border rounded px-2 bg-background",
1549
+ value: o.xAxisField || "",
1550
+ onChange: (u) => c({ xAxisField: u.target.value || void 0 }),
1551
+ "data-testid": "chart-x-field",
1552
+ children: [
1553
+ /* @__PURE__ */ e.jsx("option", { value: "", children: "Select field…" }),
1554
+ s.map((u) => /* @__PURE__ */ e.jsx("option", { value: u.value, children: u.label }, u.value))
1555
+ ]
1556
+ }
1557
+ )
1558
+ ] }),
1559
+ /* @__PURE__ */ e.jsxs("div", { children: [
1560
+ /* @__PURE__ */ e.jsx("label", { className: "text-[10px] text-muted-foreground", children: "Y-axis field" }),
1561
+ /* @__PURE__ */ e.jsxs(
1562
+ "select",
1563
+ {
1564
+ className: "w-full h-7 text-xs border rounded px-2 bg-background",
1565
+ value: ((x = o.yAxisFields) == null ? void 0 : x[0]) || "",
1566
+ onChange: (u) => c({ yAxisFields: u.target.value ? [u.target.value] : [] }),
1567
+ "data-testid": "chart-y-field",
1568
+ children: [
1569
+ /* @__PURE__ */ e.jsx("option", { value: "", children: "Select field…" }),
1570
+ s.filter((u) => u.type === "number").map((u) => /* @__PURE__ */ e.jsx("option", { value: u.value, children: u.label }, u.value))
1571
+ ]
1572
+ }
1573
+ )
1574
+ ] })
1575
+ ] })
1576
+ ] });
1577
+ }
1578
+ const rt = [
1579
+ { value: "equals", label: "=" },
1580
+ { value: "not_equals", label: "≠" },
1581
+ { value: "greater_than", label: ">" },
1582
+ { value: "less_than", label: "<" },
1583
+ { value: "contains", label: "Contains" }
1584
+ ];
1585
+ function lt({
1586
+ availableFields: s,
1587
+ value: n,
1588
+ onChange: a
1589
+ }) {
1590
+ const o = Array.isArray(n) ? n : [], c = () => {
1591
+ var t;
1592
+ a([
1593
+ ...o,
1594
+ {
1595
+ field: ((t = s[0]) == null ? void 0 : t.value) || "",
1596
+ operator: "equals",
1597
+ value: "",
1598
+ backgroundColor: "#fef9c3",
1599
+ textColor: ""
1600
+ }
1601
+ ]);
1602
+ }, x = (t) => {
1603
+ a(o.filter((i, r) => r !== t));
1604
+ }, u = (t, i) => {
1605
+ a(o.map((r, p) => p === t ? { ...r, ...i } : r));
1606
+ };
1607
+ return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2 py-1", "data-testid": "conditional-format-rules", children: [
1608
+ o.map((t, i) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 text-[10px] p-1 border rounded bg-muted/20", children: [
1609
+ /* @__PURE__ */ e.jsx(
1610
+ "select",
1611
+ {
1612
+ className: "h-5 text-[10px] border rounded px-1 bg-background flex-1",
1613
+ value: t.field,
1614
+ onChange: (r) => u(i, { field: r.target.value }),
1615
+ "data-testid": `cf-rule-field-${i}`,
1616
+ children: s.map((r) => /* @__PURE__ */ e.jsx("option", { value: r.value, children: r.label }, r.value))
1617
+ }
1618
+ ),
1619
+ /* @__PURE__ */ e.jsx(
1620
+ "select",
1621
+ {
1622
+ className: "h-5 text-[10px] border rounded px-1 bg-background w-12",
1623
+ value: t.operator,
1624
+ onChange: (r) => u(i, { operator: r.target.value }),
1625
+ children: rt.map((r) => /* @__PURE__ */ e.jsx("option", { value: r.value, children: r.label }, r.value))
1626
+ }
1627
+ ),
1628
+ /* @__PURE__ */ e.jsx(
1629
+ "input",
1630
+ {
1631
+ className: "h-5 text-[10px] border rounded px-1 bg-background w-16",
1632
+ value: t.value,
1633
+ placeholder: "value",
1634
+ onChange: (r) => u(i, { value: r.target.value }),
1635
+ "data-testid": `cf-rule-value-${i}`
1636
+ }
1637
+ ),
1638
+ /* @__PURE__ */ e.jsx(
1639
+ "input",
1640
+ {
1641
+ type: "color",
1642
+ className: "h-5 w-5 rounded border cursor-pointer",
1643
+ value: t.backgroundColor || "#fef9c3",
1644
+ onChange: (r) => u(i, { backgroundColor: r.target.value }),
1645
+ title: "Background color"
1646
+ }
1647
+ ),
1648
+ /* @__PURE__ */ e.jsx(
1649
+ E,
1650
+ {
1651
+ type: "button",
1652
+ size: "sm",
1653
+ variant: "ghost",
1654
+ className: "h-5 w-5 p-0",
1655
+ onClick: () => x(i),
1656
+ "data-testid": `cf-rule-remove-${i}`,
1657
+ children: /* @__PURE__ */ e.jsx(X, { className: "h-3 w-3" })
1658
+ }
1659
+ )
1660
+ ] }, i)),
1661
+ /* @__PURE__ */ e.jsxs(
1662
+ E,
1663
+ {
1664
+ type: "button",
1665
+ size: "sm",
1666
+ variant: "outline",
1667
+ className: "h-6 text-[10px] w-full",
1668
+ onClick: c,
1669
+ "data-testid": "cf-add-rule",
1670
+ children: [
1671
+ /* @__PURE__ */ e.jsx(G, { className: "h-3 w-3 mr-1" }),
1672
+ "Add Rule"
1673
+ ]
1674
+ }
1675
+ )
1676
+ ] });
1677
+ }
1678
+ const nt = [
1679
+ { value: "header", label: "Header" },
1680
+ { value: "summary", label: "Summary" },
1681
+ { value: "table", label: "Table" },
1682
+ { value: "chart", label: "Chart" },
1683
+ { value: "text", label: "Text" }
1684
+ ];
1685
+ function ot({
1686
+ value: s,
1687
+ onChange: n
1688
+ }) {
1689
+ const a = Array.isArray(s) ? s : [], o = (t) => {
1690
+ n([...a, { type: t, title: `New ${t}`, visible: !0 }]);
1691
+ }, c = (t) => {
1692
+ n(a.filter((i, r) => r !== t));
1693
+ }, x = (t, i) => {
1694
+ n(a.map((r, p) => p === t ? { ...r, ...i } : r));
1695
+ }, u = (t, i) => {
1696
+ const r = t + i;
1697
+ if (r < 0 || r >= a.length) return;
1698
+ const p = [...a];
1699
+ [p[t], p[r]] = [p[r], p[t]], n(p);
1700
+ };
1701
+ return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2 py-1", "data-testid": "section-manager", children: [
1702
+ a.map((t, i) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 text-[10px] p-1.5 border rounded bg-muted/20", children: [
1703
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-0.5 mr-1", children: [
1704
+ /* @__PURE__ */ e.jsx(
1705
+ "button",
1706
+ {
1707
+ type: "button",
1708
+ className: "text-muted-foreground hover:text-foreground disabled:opacity-30",
1709
+ disabled: i === 0,
1710
+ onClick: () => u(i, -1),
1711
+ "data-testid": `section-up-${i}`,
1712
+ children: "▲"
1713
+ }
1714
+ ),
1715
+ /* @__PURE__ */ e.jsx(
1716
+ "button",
1717
+ {
1718
+ type: "button",
1719
+ className: "text-muted-foreground hover:text-foreground disabled:opacity-30",
1720
+ disabled: i === a.length - 1,
1721
+ onClick: () => u(i, 1),
1722
+ "data-testid": `section-down-${i}`,
1723
+ children: "▼"
1724
+ }
1725
+ )
1726
+ ] }),
1727
+ /* @__PURE__ */ e.jsx("span", { className: "text-[9px] bg-muted px-1.5 py-0.5 rounded uppercase font-medium shrink-0", children: t.type }),
1728
+ /* @__PURE__ */ e.jsx(
1729
+ "input",
1730
+ {
1731
+ className: "h-5 text-[10px] border rounded px-1 bg-background flex-1 min-w-0",
1732
+ value: t.title || "",
1733
+ placeholder: "Section title",
1734
+ onChange: (r) => x(i, { title: r.target.value }),
1735
+ "data-testid": `section-title-${i}`
1736
+ }
1737
+ ),
1738
+ /* @__PURE__ */ e.jsx(
1739
+ E,
1740
+ {
1741
+ type: "button",
1742
+ size: "sm",
1743
+ variant: "ghost",
1744
+ className: "h-5 w-5 p-0 shrink-0",
1745
+ onClick: () => c(i),
1746
+ "data-testid": `section-remove-${i}`,
1747
+ children: /* @__PURE__ */ e.jsx(X, { className: "h-3 w-3" })
1748
+ }
1749
+ )
1750
+ ] }, i)),
1751
+ /* @__PURE__ */ e.jsx("div", { className: "flex gap-1 flex-wrap", children: nt.map((t) => /* @__PURE__ */ e.jsxs(
1752
+ E,
1753
+ {
1754
+ type: "button",
1755
+ size: "sm",
1756
+ variant: "outline",
1757
+ className: "h-6 text-[10px]",
1758
+ onClick: () => o(t.value),
1759
+ "data-testid": `section-add-${t.value}`,
1760
+ children: [
1761
+ /* @__PURE__ */ e.jsx(G, { className: "h-3 w-3 mr-0.5" }),
1762
+ t.label
1763
+ ]
1764
+ },
1765
+ t.value
1766
+ )) })
1767
+ ] });
1768
+ }
1769
+ function it(s = []) {
1770
+ return {
1771
+ breadcrumb: ["Report", "Configuration"],
1772
+ sections: [
1773
+ {
1774
+ key: "basic",
1775
+ title: "Basic",
1776
+ fields: [
1777
+ {
1778
+ key: "title",
1779
+ label: "Title",
1780
+ type: "input",
1781
+ placeholder: "Report title"
1782
+ },
1783
+ {
1784
+ key: "description",
1785
+ label: "Description",
1786
+ type: "input",
1787
+ placeholder: "Report description"
1788
+ },
1789
+ {
1790
+ key: "reportType",
1791
+ label: "Report type",
1792
+ type: "select",
1793
+ defaultValue: "tabular",
1794
+ options: [
1795
+ { value: "tabular", label: "Tabular" },
1796
+ { value: "summary", label: "Summary" },
1797
+ { value: "matrix", label: "Matrix" }
1798
+ ],
1799
+ helpText: "Tabular: flat table. Summary: grouped with subtotals. Matrix: pivot table (planned)."
1800
+ }
1801
+ ]
1802
+ },
1803
+ {
1804
+ key: "data",
1805
+ title: "Data",
1806
+ collapsible: !0,
1807
+ fields: [
1808
+ {
1809
+ key: "objectName",
1810
+ label: "Data source",
1811
+ type: "input",
1812
+ placeholder: "e.g. opportunity",
1813
+ helpText: "Object name to query data from"
1814
+ },
1815
+ {
1816
+ key: "limit",
1817
+ label: "Row limit",
1818
+ type: "input",
1819
+ defaultValue: "100",
1820
+ placeholder: "e.g. 100"
1821
+ }
1822
+ ]
1823
+ },
1824
+ {
1825
+ key: "columns",
1826
+ title: "Columns",
1827
+ collapsible: !0,
1828
+ hint: "Select fields to display as report columns. Set aggregation per column for summary reports.",
1829
+ fields: [
1830
+ {
1831
+ key: "fields",
1832
+ label: "Report columns",
1833
+ type: "custom",
1834
+ render: (n, a) => /* @__PURE__ */ e.jsx(
1835
+ tt,
1836
+ {
1837
+ availableFields: s,
1838
+ value: n,
1839
+ onChange: a
1840
+ }
1841
+ )
1842
+ }
1843
+ ]
1844
+ },
1845
+ {
1846
+ key: "filters",
1847
+ title: "Filters",
1848
+ collapsible: !0,
1849
+ hint: "Define filter conditions for the report data",
1850
+ fields: [
1851
+ {
1852
+ key: "filters",
1853
+ label: "Conditions",
1854
+ type: "filter",
1855
+ fields: s
1856
+ }
1857
+ ]
1858
+ },
1859
+ {
1860
+ key: "groupBy",
1861
+ title: "Group By",
1862
+ collapsible: !0,
1863
+ hint: "Group report data and compute aggregations",
1864
+ fields: [
1865
+ {
1866
+ key: "groupBy",
1867
+ label: "Grouping",
1868
+ type: "sort",
1869
+ fields: s
1870
+ }
1871
+ ]
1872
+ },
1873
+ {
1874
+ key: "chart",
1875
+ title: "Chart",
1876
+ collapsible: !0,
1877
+ hint: "Add a chart visualization to the report",
1878
+ fields: [
1879
+ {
1880
+ key: "chartConfig",
1881
+ label: "Chart",
1882
+ type: "custom",
1883
+ render: (n, a) => /* @__PURE__ */ e.jsx(
1884
+ st,
1885
+ {
1886
+ availableFields: s,
1887
+ value: n,
1888
+ onChange: a
1889
+ }
1890
+ )
1891
+ }
1892
+ ]
1893
+ },
1894
+ {
1895
+ key: "conditionalFormatting",
1896
+ title: "Conditional Format",
1897
+ collapsible: !0,
1898
+ defaultCollapsed: !0,
1899
+ hint: "Highlight cells based on field value conditions",
1900
+ fields: [
1901
+ {
1902
+ key: "conditionalFormatting",
1903
+ label: "Rules",
1904
+ type: "custom",
1905
+ render: (n, a) => /* @__PURE__ */ e.jsx(
1906
+ lt,
1907
+ {
1908
+ availableFields: s,
1909
+ value: n,
1910
+ onChange: a
1911
+ }
1912
+ )
1913
+ }
1914
+ ]
1915
+ },
1916
+ {
1917
+ key: "sections",
1918
+ title: "Sections",
1919
+ collapsible: !0,
1920
+ defaultCollapsed: !0,
1921
+ hint: "Manage report layout blocks (header, table, chart, summary)",
1922
+ fields: [
1923
+ {
1924
+ key: "sections",
1925
+ label: "Report sections",
1926
+ type: "custom",
1927
+ render: (n, a) => /* @__PURE__ */ e.jsx(ot, { value: n, onChange: a })
1928
+ }
1929
+ ]
1930
+ },
1931
+ {
1932
+ key: "export",
1933
+ title: "Export",
1934
+ collapsible: !0,
1935
+ defaultCollapsed: !0,
1936
+ fields: [
1937
+ {
1938
+ key: "showExportButtons",
1939
+ label: "Show export buttons",
1940
+ type: "switch",
1941
+ defaultValue: !0
1942
+ },
1943
+ {
1944
+ key: "showPrintButton",
1945
+ label: "Show print button",
1946
+ type: "switch",
1947
+ defaultValue: !0
1948
+ },
1949
+ {
1950
+ key: "defaultExportFormat",
1951
+ label: "Default export format",
1952
+ type: "select",
1953
+ defaultValue: "pdf",
1954
+ options: [
1955
+ { value: "pdf", label: "PDF" },
1956
+ { value: "excel", label: "Excel" },
1957
+ { value: "csv", label: "CSV" },
1958
+ { value: "json", label: "JSON" },
1959
+ { value: "html", label: "HTML" }
1960
+ ]
1961
+ }
1962
+ ]
1963
+ },
1964
+ {
1965
+ key: "schedule",
1966
+ title: "Schedule",
1967
+ collapsible: !0,
1968
+ defaultCollapsed: !0,
1969
+ fields: [
1970
+ {
1971
+ key: "schedule",
1972
+ label: "Schedule",
1973
+ type: "custom",
1974
+ render: (n, a) => /* @__PURE__ */ e.jsx(Re, { schedule: n, onChange: a })
1975
+ }
1976
+ ]
1977
+ },
1978
+ {
1979
+ key: "appearance",
1980
+ title: "Appearance",
1981
+ collapsible: !0,
1982
+ defaultCollapsed: !0,
1983
+ fields: [
1984
+ {
1985
+ key: "showToolbar",
1986
+ label: "Show toolbar",
1987
+ type: "switch",
1988
+ defaultValue: !0
1989
+ },
1990
+ {
1991
+ key: "refreshInterval",
1992
+ label: "Refresh interval",
1993
+ type: "select",
1994
+ defaultValue: "0",
1995
+ options: [
1996
+ { value: "0", label: "Manual" },
1997
+ { value: "30", label: "30s" },
1998
+ { value: "60", label: "1 min" },
1999
+ { value: "300", label: "5 min" }
2000
+ ]
2001
+ }
2002
+ ]
2003
+ }
2004
+ ]
2005
+ };
2006
+ }
2007
+ function yt({
2008
+ open: s,
2009
+ onClose: n,
2010
+ config: a,
2011
+ onSave: o,
2012
+ onFieldChange: c,
2013
+ availableFields: x
2014
+ }) {
2015
+ const { draft: u, isDirty: t, updateField: i, discard: r, undo: p, redo: v, canUndo: S, canRedo: w } = $e(a, {
2016
+ onUpdate: c
2017
+ }), _ = Ee.useMemo(
2018
+ () => it(x),
2019
+ [x]
2020
+ );
2021
+ return /* @__PURE__ */ e.jsx(
2022
+ Oe,
2023
+ {
2024
+ open: s,
2025
+ onClose: n,
2026
+ schema: _,
2027
+ draft: u,
2028
+ isDirty: t,
2029
+ onFieldChange: i,
2030
+ onSave: () => o(u),
2031
+ onDiscard: r,
2032
+ onUndo: p,
2033
+ onRedo: v,
2034
+ canUndo: S,
2035
+ canRedo: w
2036
+ }
2037
+ );
2038
+ }
2039
+ async function ct(s, n) {
2040
+ var i;
1350
2041
  const {
1351
- dataSource: s,
1352
- resource: c,
1353
- queryParams: d,
1354
- format: p,
1355
- exportConfig: f
1356
- } = i, n = p || r.defaultExportFormat || "pdf";
2042
+ dataSource: a,
2043
+ resource: o,
2044
+ queryParams: c,
2045
+ format: x,
2046
+ exportConfig: u
2047
+ } = n, t = x || s.defaultExportFormat || "pdf";
1357
2048
  try {
1358
- const j = (await s.find(c, d)).data || [], y = {
1359
- format: n,
1360
- ...(h = r.exportConfigs) == null ? void 0 : h[n],
1361
- ...f
2049
+ const p = (await a.find(o, c)).data || [], v = {
2050
+ format: t,
2051
+ ...(i = s.exportConfigs) == null ? void 0 : i[t],
2052
+ ...u
1362
2053
  };
1363
- return be(n, r, j, y), {
2054
+ return Ne(t, s, p, v), {
1364
2055
  success: !0,
1365
- recordCount: j.length,
1366
- format: n
2056
+ recordCount: p.length,
2057
+ format: t
1367
2058
  };
1368
- } catch (l) {
2059
+ } catch (r) {
1369
2060
  return {
1370
2061
  success: !1,
1371
2062
  recordCount: 0,
1372
- format: n,
1373
- error: l.message
2063
+ format: t,
2064
+ error: r.message
1374
2065
  };
1375
2066
  }
1376
2067
  }
1377
- function st(r, i, s = {}) {
1378
- const { columns: c, filename: d, includeAggregationRow: p = !1 } = s, f = c || (r.fields || []).map(Ve), n = f.map((y) => y.header), h = i.map((y, R) => f.map((w) => {
2068
+ function Nt(s, n, a = {}) {
2069
+ const { columns: o, filename: c, includeAggregationRow: x = !1 } = a, u = o || (s.fields || []).map(dt), t = u.map((v) => v.header), i = n.map((v, S) => u.map((w) => {
1379
2070
  if (w.formula)
1380
- return w.formula.replace(/\{ROW\}/g, String(R + 2));
1381
- const m = y[w.name];
1382
- return We(m, w.numberFormat);
2071
+ return w.formula.replace(/\{ROW\}/g, String(S + 2));
2072
+ const _ = v[w.name];
2073
+ return ut(_, w.numberFormat);
1383
2074
  }));
1384
- if (p && i.length > 0) {
1385
- const y = f.map((R, w) => {
1386
- const m = (r.fields || []).find((v) => v.name === R.name);
1387
- if (m != null && m.aggregation) {
1388
- const v = He(w), N = 2, k = i.length + 1;
1389
- switch (m.aggregation) {
2075
+ if (x && n.length > 0) {
2076
+ const v = u.map((S, w) => {
2077
+ const _ = (s.fields || []).find((k) => k.name === S.name);
2078
+ if (_ != null && _.aggregation) {
2079
+ const k = pt(w), m = 2, N = n.length + 1;
2080
+ switch (_.aggregation) {
1390
2081
  case "sum":
1391
- return `=SUM(${v}${N}:${v}${k})`;
2082
+ return `=SUM(${k}${m}:${k}${N})`;
1392
2083
  case "avg":
1393
- return `=AVERAGE(${v}${N}:${v}${k})`;
2084
+ return `=AVERAGE(${k}${m}:${k}${N})`;
1394
2085
  case "count":
1395
- return `=COUNTA(${v}${N}:${v}${k})`;
2086
+ return `=COUNTA(${k}${m}:${k}${N})`;
1396
2087
  case "min":
1397
- return `=MIN(${v}${N}:${v}${k})`;
2088
+ return `=MIN(${k}${m}:${k}${N})`;
1398
2089
  case "max":
1399
- return `=MAX(${v}${N}:${v}${k})`;
2090
+ return `=MAX(${k}${m}:${k}${N})`;
1400
2091
  default:
1401
2092
  return "";
1402
2093
  }
1403
2094
  }
1404
2095
  return "";
1405
2096
  });
1406
- h.push(y);
2097
+ i.push(v);
1407
2098
  }
1408
- const l = "\uFEFF" + [
1409
- n.join(" "),
1410
- ...h.map((y) => y.join(" "))
2099
+ const r = "\uFEFF" + [
2100
+ t.join(" "),
2101
+ ...i.map((v) => v.join(" "))
1411
2102
  ].join(`
1412
- `), j = d || `${r.title || "report"}.tsv`;
1413
- Xe(l, j, "text/tab-separated-values");
2103
+ `), p = c || `${s.title || "report"}.tsv`;
2104
+ xt(r, p, "text/tab-separated-values");
1414
2105
  }
1415
- function rt(r, i, s, c) {
2106
+ function wt(s, n, a, o) {
1416
2107
  return async () => {
1417
- const d = r.schedule;
1418
- if (!(d != null && d.enabled))
2108
+ const c = s.schedule;
2109
+ if (!(c != null && c.enabled))
1419
2110
  return [];
1420
- const p = d.formats || [r.defaultExportFormat || "pdf"], f = [];
1421
- for (const n of p) {
1422
- const h = await Ye(r, {
1423
- dataSource: i,
1424
- resource: s,
1425
- format: n
2111
+ const x = c.formats || [s.defaultExportFormat || "pdf"], u = [];
2112
+ for (const t of x) {
2113
+ const i = await ct(s, {
2114
+ dataSource: n,
2115
+ resource: a,
2116
+ format: t
1426
2117
  });
1427
- f.push(h);
2118
+ u.push(i);
1428
2119
  }
1429
- return c(r, d), f;
2120
+ return o(s, c), u;
1430
2121
  };
1431
2122
  }
1432
- function Ve(r) {
2123
+ function dt(s) {
1433
2124
  return {
1434
- name: r.name,
1435
- header: r.label || r.name
2125
+ name: s.name,
2126
+ header: s.label || s.name
1436
2127
  };
1437
2128
  }
1438
- function We(r, i) {
1439
- return r == null ? "" : typeof r == "number" && i ? r.toLocaleString("en-US", qe(i)) : Je(String(r));
2129
+ function ut(s, n) {
2130
+ return s == null ? "" : typeof s == "number" && n ? s.toLocaleString("en-US", mt(n)) : ht(String(s));
1440
2131
  }
1441
- function qe(r) {
1442
- if (r.includes("%"))
2132
+ function mt(s) {
2133
+ if (s.includes("%"))
1443
2134
  return { style: "percent", minimumFractionDigits: 0 };
1444
- const i = (r.match(/0/g) || []).length;
2135
+ const n = (s.match(/0/g) || []).length;
1445
2136
  return {
1446
- minimumFractionDigits: Math.max(0, i - 1),
1447
- maximumFractionDigits: Math.max(0, i - 1)
2137
+ minimumFractionDigits: Math.max(0, n - 1),
2138
+ maximumFractionDigits: Math.max(0, n - 1)
1448
2139
  };
1449
2140
  }
1450
- function He(r) {
1451
- let i = "", s = r;
1452
- for (; s >= 0; )
1453
- i = String.fromCharCode(s % 26 + 65) + i, s = Math.floor(s / 26) - 1;
1454
- return i;
2141
+ function pt(s) {
2142
+ let n = "", a = s;
2143
+ for (; a >= 0; )
2144
+ n = String.fromCharCode(a % 26 + 65) + n, a = Math.floor(a / 26) - 1;
2145
+ return n;
1455
2146
  }
1456
- function Je(r) {
1457
- if (r.length > 0) {
1458
- const i = r.charAt(0);
1459
- if (i === "=" || i === "+" || i === "-" || i === "@" || i === "|")
1460
- return `'${r}`;
2147
+ function ht(s) {
2148
+ if (s.length > 0) {
2149
+ const n = s.charAt(0);
2150
+ if (n === "=" || n === "+" || n === "-" || n === "@" || n === "|")
2151
+ return `'${s}`;
1461
2152
  }
1462
- return r;
2153
+ return s;
1463
2154
  }
1464
- function Xe(r, i, s) {
1465
- const c = new Blob([r], { type: `${s};charset=utf-8` }), d = URL.createObjectURL(c), p = document.createElement("a");
1466
- p.href = d, p.download = i, document.body.appendChild(p), p.click(), document.body.removeChild(p), URL.revokeObjectURL(d);
2155
+ function xt(s, n, a) {
2156
+ const o = new Blob([s], { type: `${a};charset=utf-8` }), c = URL.createObjectURL(o), x = document.createElement("a");
2157
+ x.href = c, x.download = n, document.body.appendChild(x), x.click(), document.body.removeChild(x), URL.revokeObjectURL(c);
1467
2158
  }
1468
- L.register(
2159
+ U.register(
1469
2160
  "report",
1470
- De,
2161
+ Ye,
1471
2162
  {
1472
2163
  namespace: "report",
1473
2164
  label: "Report",
@@ -1479,9 +2170,9 @@ L.register(
1479
2170
  ]
1480
2171
  }
1481
2172
  );
1482
- L.register(
2173
+ U.register(
1483
2174
  "report-viewer",
1484
- we,
2175
+ Se,
1485
2176
  {
1486
2177
  namespace: "report",
1487
2178
  label: "Report Viewer",
@@ -1492,9 +2183,9 @@ L.register(
1492
2183
  ]
1493
2184
  }
1494
2185
  );
1495
- L.register(
2186
+ U.register(
1496
2187
  "report-builder",
1497
- Ue,
2188
+ Ke,
1498
2189
  {
1499
2190
  namespace: "report",
1500
2191
  label: "Report Builder",
@@ -1505,17 +2196,19 @@ L.register(
1505
2196
  }
1506
2197
  );
1507
2198
  export {
1508
- Ue as ReportBuilder,
1509
- De as ReportRenderer,
1510
- we as ReportViewer,
1511
- Ge as ScheduleConfig,
1512
- rt as createScheduleTrigger,
1513
- Be as exportAsCSV,
1514
- Ie as exportAsExcel,
1515
- ve as exportAsHTML,
1516
- ze as exportAsJSON,
1517
- Me as exportAsPDF,
1518
- st as exportExcelWithFormulas,
1519
- be as exportReport,
1520
- Ye as exportWithLiveData
2199
+ Ke as ReportBuilder,
2200
+ yt as ReportConfigPanel,
2201
+ Ye as ReportRenderer,
2202
+ Se as ReportViewer,
2203
+ Re as ScheduleConfig,
2204
+ wt as createScheduleTrigger,
2205
+ qe as exportAsCSV,
2206
+ Je as exportAsExcel,
2207
+ ye as exportAsHTML,
2208
+ We as exportAsJSON,
2209
+ He as exportAsPDF,
2210
+ Nt as exportExcelWithFormulas,
2211
+ Ne as exportReport,
2212
+ ct as exportWithLiveData,
2213
+ ge as formatValue
1521
2214
  };