@object-ui/plugin-ai 4.0.1 → 4.0.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @object-ui/plugin-ai
2
2
 
3
+ ## 4.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - d2b6ece: fix: externalize all bare imports in library builds
8
+
9
+ Library builds (vite lib mode) now externalize every non-relative import instead of bundling third-party CJS dependencies into the published dist. This avoids inlined `require("react")` / `require("react-dom")` calls that cause `Calling \`require\` for "react" in an environment that doesn't expose the \`require\` function` runtime errors when consumer apps re-bundle the published dist.
10
+
11
+ Specifically fixes:
12
+ - `@object-ui/plugin-dashboard` no longer inlines `react-grid-layout` (and its transitive `react-draggable` / `react-resizable` CJS bundles). `react-grid-layout` is now declared as a peer dependency so consumers install a single ESM-friendly copy.
13
+ - `@object-ui/components`, `@object-ui/plugin-calendar`, `@object-ui/plugin-charts`, `@object-ui/plugin-designer` no longer inline `react-i18next` / `i18next` / `use-sync-external-store` CJS shims.
14
+ - All plugin packages now use a unified `external: (id) => !/^[./]/.test(id) && !id.startsWith(__dirname)` rule, ensuring future additions of CJS deps are automatically externalized.
15
+
16
+ - Updated dependencies [d2b6ece]
17
+ - @object-ui/components@4.0.4
18
+ - @object-ui/types@4.0.4
19
+ - @object-ui/core@4.0.4
20
+ - @object-ui/react@4.0.4
21
+
22
+ ## 4.0.3
23
+
24
+ ### Patch Changes
25
+
26
+ - 4be43e2: **Page-mode record forms (`editMode: 'page'`).** New per-object metadata flag that opts a record's create/edit form into a dedicated full-screen route (`/apps/:appName/:objectName/new`, `/apps/:appName/:objectName/record/:recordId/edit`). Two new declarative actions `navigate_create` and `navigate_edit` open these routes from JSON action buttons. Default modal behavior is preserved for objects that do not set `editMode`.
27
+
28
+ **`@object-ui/plugin-list` & `@object-ui/plugin-detail`: `ComponentRegistry` singleton fix.** Both plugins' Vite configs now mark all `@object-ui/*` packages as external so each plugin no longer bundles its own private copy of `@object-ui/core`. Cross-plugin component lookups now resolve correctly from the same singleton registry. `plugin-list` dist shrank from multi-MB to 67 kB (gzip 16 kB); `plugin-detail` to 124 kB (gzip 28 kB).
29
+
30
+ **`@object-ui/app-shell` `CreateViewDialog` churn fix.** `existingSet` is now memoised on the joined string key of `existingLabels` rather than the raw array reference, preventing the name-suggest `useEffect` from re-firing on every parent render.
31
+
32
+ **CI fixes.** `ReportViewer` conditional-formatting test now accepts both `rgb(...)` and hex color representations. `ObjectView` i18n mocks rewritten to mirror the real hook shapes (`useObjectTranslation`, `useObjectLabel`).
33
+
34
+ - Updated dependencies [4be43e2]
35
+ - @object-ui/types@4.0.3
36
+ - @object-ui/core@4.0.3
37
+ - @object-ui/react@4.0.3
38
+ - @object-ui/components@4.0.3
39
+
3
40
  ## 4.0.1
4
41
 
5
42
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2,303 +2,126 @@ import { ComponentRegistry as e } from "@object-ui/core";
2
2
  import { useState as t } from "react";
3
3
  import { Badge as n, Button as r, Card as i, CardContent as a, CardHeader as o, CardTitle as s, Input as c } from "@object-ui/components";
4
4
  import { ArrowRight as l, Check as u, Clock as d, ExternalLink as f, Lightbulb as p, Loader2 as m, RefreshCw as h, Search as g, Sparkles as _, Star as v, Table as y, ThumbsDown as b, ThumbsUp as x, X as S } from "lucide-react";
5
- //#region \0rolldown/runtime.js
6
- var C = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), w = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
7
- if (typeof require < "u") return require.apply(this, arguments);
8
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
9
- }), T = /* @__PURE__ */ C(((e) => {
10
- var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
11
- function r(e, n, r) {
12
- var i = null;
13
- if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
14
- else r = n;
15
- return n = r.ref, {
16
- $$typeof: t,
17
- type: e,
18
- key: i,
19
- ref: n === void 0 ? null : n,
20
- props: r
21
- };
22
- }
23
- e.Fragment = n, e.jsx = r, e.jsxs = r;
24
- })), E = /* @__PURE__ */ C(((e) => {
25
- process.env.NODE_ENV !== "production" && (function() {
26
- function t(e) {
27
- if (e == null) return null;
28
- if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
29
- if (typeof e == "string") return e;
30
- switch (e) {
31
- case _: return "Fragment";
32
- case y: return "Profiler";
33
- case v: return "StrictMode";
34
- case C: return "Suspense";
35
- case T: return "SuspenseList";
36
- case O: return "Activity";
37
- }
38
- if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
39
- case g: return "Portal";
40
- case x: return e.displayName || "Context";
41
- case b: return (e._context.displayName || "Context") + ".Consumer";
42
- case S:
43
- var n = e.render;
44
- return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
45
- case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
46
- case D:
47
- n = e._payload, e = e._init;
48
- try {
49
- return t(e(n));
50
- } catch {}
51
- }
52
- return null;
53
- }
54
- function n(e) {
55
- return "" + e;
56
- }
57
- function r(e) {
58
- try {
59
- n(e);
60
- var t = !1;
61
- } catch {
62
- t = !0;
63
- }
64
- if (t) {
65
- t = console;
66
- var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
67
- return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
68
- }
69
- }
70
- function i(e) {
71
- if (e === _) return "<>";
72
- if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
73
- try {
74
- var n = t(e);
75
- return n ? "<" + n + ">" : "<...>";
76
- } catch {
77
- return "<...>";
78
- }
79
- }
80
- function a() {
81
- var e = A.A;
82
- return e === null ? null : e.getOwner();
83
- }
84
- function o() {
85
- return Error("react-stack-top-frame");
86
- }
87
- function s(e) {
88
- if (j.call(e, "key")) {
89
- var t = Object.getOwnPropertyDescriptor(e, "key").get;
90
- if (t && t.isReactWarning) return !1;
91
- }
92
- return e.key !== void 0;
93
- }
94
- function c(e, t) {
95
- function n() {
96
- P || (P = !0, console.error("%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)", t));
97
- }
98
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
99
- get: n,
100
- configurable: !0
101
- });
102
- }
103
- function l() {
104
- var e = t(this.type);
105
- return F[e] || (F[e] = !0, console.error("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.")), e = this.props.ref, e === void 0 ? null : e;
106
- }
107
- function u(e, t, n, r, i, a) {
108
- var o = n.ref;
109
- return e = {
110
- $$typeof: h,
111
- type: e,
112
- key: t,
113
- props: n,
114
- _owner: r
115
- }, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
116
- enumerable: !1,
117
- value: null
118
- }) : Object.defineProperty(e, "ref", {
119
- enumerable: !1,
120
- get: l
121
- }), e._store = {}, Object.defineProperty(e._store, "validated", {
122
- configurable: !1,
123
- enumerable: !1,
124
- writable: !0,
125
- value: 0
126
- }), Object.defineProperty(e, "_debugInfo", {
127
- configurable: !1,
128
- enumerable: !1,
129
- writable: !0,
130
- value: null
131
- }), Object.defineProperty(e, "_debugStack", {
132
- configurable: !1,
133
- enumerable: !1,
134
- writable: !0,
135
- value: i
136
- }), Object.defineProperty(e, "_debugTask", {
137
- configurable: !1,
138
- enumerable: !1,
139
- writable: !0,
140
- value: a
141
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
142
- }
143
- function d(e, n, i, o, l, d) {
144
- var p = n.children;
145
- if (p !== void 0) if (o) if (M(p)) {
146
- for (o = 0; o < p.length; o++) f(p[o]);
147
- Object.freeze && Object.freeze(p);
148
- } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
149
- else f(p);
150
- if (j.call(n, "key")) {
151
- p = t(e);
152
- var m = Object.keys(n).filter(function(e) {
153
- return e !== "key";
154
- });
155
- o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[p + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, p, m, p), R[p + o] = !0);
156
- }
157
- if (p = null, i !== void 0 && (r(i), p = "" + i), s(n) && (r(n.key), p = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
158
- else i = n;
159
- return p && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), u(e, p, i, a(), l, d);
160
- }
161
- function f(e) {
162
- p(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? p(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
163
- }
164
- function p(e) {
165
- return typeof e == "object" && !!e && e.$$typeof === h;
166
- }
167
- var m = w("react"), h = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), b = Symbol.for("react.consumer"), x = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
168
- return null;
169
- };
170
- m = { react_stack_bottom_frame: function(e) {
171
- return e();
172
- } };
173
- var P, F = {}, I = m.react_stack_bottom_frame.bind(m, o)(), L = N(i(o)), R = {};
174
- e.Fragment = _, e.jsx = function(e, t, n) {
175
- var r = 1e4 > A.recentlyCreatedOwnerStacks++;
176
- return d(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
177
- }, e.jsxs = function(e, t, n) {
178
- var r = 1e4 > A.recentlyCreatedOwnerStacks++;
179
- return d(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
180
- };
181
- })();
182
- })), D = (/* @__PURE__ */ C(((e, t) => {
183
- process.env.NODE_ENV === "production" ? t.exports = T() : t.exports = E();
184
- })))(), O = ({ schema: e, onApply: c, onRefresh: l }) => {
185
- let { suggestions: d = [], showConfidence: f = !0, showReasoning: m = !1, autoFill: g = !1 } = e, [v, y] = t(d), [b, x] = t(/* @__PURE__ */ new Set()), [C, w] = t(!1), [T, E] = t(!1), O = (e) => {
5
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
6
+ //#region src/AIFormAssist.tsx
7
+ var E = ({ schema: e, onApply: c, onRefresh: l }) => {
8
+ let { suggestions: d = [], showConfidence: f = !0, showReasoning: m = !1, autoFill: g = !1 } = e, [v, y] = t(d), [b, x] = t(/* @__PURE__ */ new Set()), [C, E] = t(!1), [D, O] = t(!1), k = (e) => {
186
9
  c?.(e), x((t) => new Set(t).add(e.fieldName));
187
- }, k = () => {
10
+ }, A = () => {
188
11
  v.forEach((e) => c?.(e)), x(new Set(v.map((e) => e.fieldName)));
189
- }, A = (e) => {
12
+ }, j = (e) => {
190
13
  y((t) => t.filter((t) => t.fieldName !== e));
191
- }, j = () => {
192
- E(!0), l && l(), setTimeout(() => E(!1), 1e3);
14
+ }, M = () => {
15
+ O(!0), l && l(), setTimeout(() => O(!1), 1e3);
193
16
  };
194
17
  if (C || v.length === 0) return null;
195
- let M = v.filter((e) => !b.has(e.fieldName)), N = (e) => e >= .8 ? "text-green-600" : e >= .5 ? "text-yellow-600" : "text-red-600";
196
- return /* @__PURE__ */ (0, D.jsxs)(i, {
18
+ let N = v.filter((e) => !b.has(e.fieldName)), P = (e) => e >= .8 ? "text-green-600" : e >= .5 ? "text-yellow-600" : "text-red-600";
19
+ return /* @__PURE__ */ T(i, {
197
20
  className: "border-blue-200 bg-blue-50/30",
198
- children: [/* @__PURE__ */ (0, D.jsx)(o, {
21
+ children: [/* @__PURE__ */ w(o, {
199
22
  className: "pb-2",
200
- children: /* @__PURE__ */ (0, D.jsxs)("div", {
23
+ children: /* @__PURE__ */ T("div", {
201
24
  className: "flex items-center justify-between",
202
- children: [/* @__PURE__ */ (0, D.jsxs)(s, {
25
+ children: [/* @__PURE__ */ T(s, {
203
26
  className: "text-sm flex items-center gap-2",
204
27
  children: [
205
- /* @__PURE__ */ (0, D.jsx)(_, { className: "h-4 w-4 text-blue-500" }),
28
+ /* @__PURE__ */ w(_, { className: "h-4 w-4 text-blue-500" }),
206
29
  "AI Suggestions",
207
- /* @__PURE__ */ (0, D.jsxs)(n, {
30
+ /* @__PURE__ */ T(n, {
208
31
  variant: "secondary",
209
32
  className: "text-xs",
210
33
  children: [
211
- M.length,
34
+ N.length,
212
35
  " suggestion",
213
- M.length === 1 ? "" : "s"
36
+ N.length === 1 ? "" : "s"
214
37
  ]
215
38
  })
216
39
  ]
217
- }), /* @__PURE__ */ (0, D.jsxs)("div", {
40
+ }), /* @__PURE__ */ T("div", {
218
41
  className: "flex items-center gap-1",
219
42
  children: [
220
- /* @__PURE__ */ (0, D.jsx)(r, {
43
+ /* @__PURE__ */ w(r, {
221
44
  variant: "ghost",
222
45
  size: "sm",
223
- onClick: j,
224
- disabled: T,
46
+ onClick: M,
47
+ disabled: D,
225
48
  className: "h-7",
226
- children: /* @__PURE__ */ (0, D.jsx)(h, { className: `h-3 w-3 ${T ? "animate-spin" : ""}` })
49
+ children: /* @__PURE__ */ w(h, { className: `h-3 w-3 ${D ? "animate-spin" : ""}` })
227
50
  }),
228
- M.length > 1 && /* @__PURE__ */ (0, D.jsx)(r, {
51
+ N.length > 1 && /* @__PURE__ */ w(r, {
229
52
  variant: "outline",
230
53
  size: "sm",
231
- onClick: k,
54
+ onClick: A,
232
55
  className: "h-7 text-xs",
233
56
  children: "Apply All"
234
57
  }),
235
- /* @__PURE__ */ (0, D.jsx)(r, {
58
+ /* @__PURE__ */ w(r, {
236
59
  variant: "ghost",
237
60
  size: "sm",
238
- onClick: () => w(!0),
61
+ onClick: () => E(!0),
239
62
  className: "h-7",
240
- children: /* @__PURE__ */ (0, D.jsx)(S, { className: "h-3 w-3" })
63
+ children: /* @__PURE__ */ w(S, { className: "h-3 w-3" })
241
64
  })
242
65
  ]
243
66
  })]
244
67
  })
245
- }), /* @__PURE__ */ (0, D.jsxs)(a, {
68
+ }), /* @__PURE__ */ T(a, {
246
69
  className: "space-y-2 pt-0",
247
- children: [M.map((e) => /* @__PURE__ */ (0, D.jsxs)("div", {
70
+ children: [N.map((e) => /* @__PURE__ */ T("div", {
248
71
  className: "flex items-center gap-3 p-2 rounded-md bg-white border text-sm",
249
72
  children: [
250
- /* @__PURE__ */ (0, D.jsx)(p, { className: "h-4 w-4 text-yellow-500 shrink-0" }),
251
- /* @__PURE__ */ (0, D.jsxs)("div", {
73
+ /* @__PURE__ */ w(p, { className: "h-4 w-4 text-yellow-500 shrink-0" }),
74
+ /* @__PURE__ */ T("div", {
252
75
  className: "flex-1 min-w-0",
253
76
  children: [
254
- /* @__PURE__ */ (0, D.jsxs)("div", {
77
+ /* @__PURE__ */ T("div", {
255
78
  className: "flex items-center gap-2",
256
79
  children: [
257
- /* @__PURE__ */ (0, D.jsx)("span", {
80
+ /* @__PURE__ */ w("span", {
258
81
  className: "font-medium",
259
82
  children: e.fieldName
260
83
  }),
261
- /* @__PURE__ */ (0, D.jsx)("span", {
84
+ /* @__PURE__ */ w("span", {
262
85
  className: "text-muted-foreground",
263
86
  children: "→"
264
87
  }),
265
- /* @__PURE__ */ (0, D.jsx)("span", {
88
+ /* @__PURE__ */ w("span", {
266
89
  className: "font-mono text-blue-600 truncate",
267
90
  children: typeof e.value == "object" ? JSON.stringify(e.value) : String(e.value)
268
91
  })
269
92
  ]
270
93
  }),
271
- f && /* @__PURE__ */ (0, D.jsxs)("div", {
272
- className: `text-xs ${N(e.confidence)}`,
94
+ f && /* @__PURE__ */ T("div", {
95
+ className: `text-xs ${P(e.confidence)}`,
273
96
  children: [Math.round(e.confidence * 100), "% confidence"]
274
97
  }),
275
- m && e.reasoning && /* @__PURE__ */ (0, D.jsx)("div", {
98
+ m && e.reasoning && /* @__PURE__ */ w("div", {
276
99
  className: "text-xs text-muted-foreground mt-1",
277
100
  children: e.reasoning
278
101
  })
279
102
  ]
280
103
  }),
281
- /* @__PURE__ */ (0, D.jsxs)("div", {
104
+ /* @__PURE__ */ T("div", {
282
105
  className: "flex items-center gap-1 shrink-0",
283
- children: [/* @__PURE__ */ (0, D.jsx)(r, {
106
+ children: [/* @__PURE__ */ w(r, {
284
107
  variant: "ghost",
285
108
  size: "sm",
286
109
  className: "h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50",
287
- onClick: () => O(e),
288
- children: /* @__PURE__ */ (0, D.jsx)(u, { className: "h-3.5 w-3.5" })
289
- }), /* @__PURE__ */ (0, D.jsx)(r, {
110
+ onClick: () => k(e),
111
+ children: /* @__PURE__ */ w(u, { className: "h-3.5 w-3.5" })
112
+ }), /* @__PURE__ */ w(r, {
290
113
  variant: "ghost",
291
114
  size: "sm",
292
115
  className: "h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50",
293
- onClick: () => A(e.fieldName),
294
- children: /* @__PURE__ */ (0, D.jsx)(S, { className: "h-3.5 w-3.5" })
116
+ onClick: () => j(e.fieldName),
117
+ children: /* @__PURE__ */ w(S, { className: "h-3.5 w-3.5" })
295
118
  })]
296
119
  })
297
120
  ]
298
- }, e.fieldName)), b.size > 0 && /* @__PURE__ */ (0, D.jsxs)("div", {
121
+ }, e.fieldName)), b.size > 0 && /* @__PURE__ */ T("div", {
299
122
  className: "text-xs text-green-600 flex items-center gap-1 pt-1",
300
123
  children: [
301
- /* @__PURE__ */ (0, D.jsx)(u, { className: "h-3 w-3" }),
124
+ /* @__PURE__ */ w(u, { className: "h-3 w-3" }),
302
125
  b.size,
303
126
  " suggestion",
304
127
  b.size === 1 ? "" : "s",
@@ -307,252 +130,252 @@ var C = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
307
130
  })]
308
131
  })]
309
132
  });
310
- }, k = ({ schema: e, onSelect: t, onDismiss: c }) => {
133
+ }, D = ({ schema: e, onSelect: t, onDismiss: c }) => {
311
134
  let { recommendations: l = [], showScores: u = !1, layout: d = "list", loading: p = !1, emptyMessage: m = "No recommendations available" } = e, h = (e) => {
312
135
  t?.(e);
313
136
  }, g = (e) => {
314
137
  c?.(e);
315
138
  };
316
- if (p) return /* @__PURE__ */ (0, D.jsx)(i, { children: /* @__PURE__ */ (0, D.jsxs)(a, {
139
+ if (p) return /* @__PURE__ */ w(i, { children: /* @__PURE__ */ T(a, {
317
140
  className: "p-8 text-center",
318
- children: [/* @__PURE__ */ (0, D.jsx)(_, { className: "h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse" }), /* @__PURE__ */ (0, D.jsx)("p", {
141
+ children: [/* @__PURE__ */ w(_, { className: "h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse" }), /* @__PURE__ */ w("p", {
319
142
  className: "text-sm text-muted-foreground",
320
143
  children: "Generating recommendations..."
321
144
  })]
322
145
  }) });
323
- if (l.length === 0) return /* @__PURE__ */ (0, D.jsx)(i, { children: /* @__PURE__ */ (0, D.jsx)(a, {
146
+ if (l.length === 0) return /* @__PURE__ */ w(i, { children: /* @__PURE__ */ w(a, {
324
147
  className: "p-8 text-center text-muted-foreground",
325
148
  children: m
326
149
  }) });
327
150
  let y = (e) => {
328
151
  if (!u) return null;
329
152
  let t = Math.round(e * 100);
330
- return /* @__PURE__ */ (0, D.jsxs)(n, {
153
+ return /* @__PURE__ */ T(n, {
331
154
  variant: e >= .7 ? "default" : e >= .4 ? "secondary" : "outline",
332
155
  className: "text-xs",
333
156
  children: [t, "%"]
334
157
  });
335
158
  };
336
- return /* @__PURE__ */ (0, D.jsxs)(i, { children: [/* @__PURE__ */ (0, D.jsx)(o, { children: /* @__PURE__ */ (0, D.jsxs)(s, {
159
+ return /* @__PURE__ */ T(i, { children: [/* @__PURE__ */ w(o, { children: /* @__PURE__ */ T(s, {
337
160
  className: "flex items-center gap-2 text-sm",
338
161
  children: [
339
- /* @__PURE__ */ (0, D.jsx)(_, { className: "h-4 w-4 text-blue-500" }),
162
+ /* @__PURE__ */ w(_, { className: "h-4 w-4 text-blue-500" }),
340
163
  "Recommendations",
341
- /* @__PURE__ */ (0, D.jsx)(n, {
164
+ /* @__PURE__ */ w(n, {
342
165
  variant: "secondary",
343
166
  className: "text-xs",
344
167
  children: l.length
345
168
  })
346
169
  ]
347
- }) }), /* @__PURE__ */ (0, D.jsx)(a, { children: d === "grid" ? /* @__PURE__ */ (0, D.jsx)("div", {
170
+ }) }), /* @__PURE__ */ w(a, { children: d === "grid" ? /* @__PURE__ */ w("div", {
348
171
  className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",
349
- children: l.map((e) => /* @__PURE__ */ (0, D.jsx)(i, {
172
+ children: l.map((e) => /* @__PURE__ */ w(i, {
350
173
  className: "cursor-pointer hover:shadow-md transition-shadow",
351
174
  onClick: () => h(e),
352
- children: /* @__PURE__ */ (0, D.jsxs)(a, {
175
+ children: /* @__PURE__ */ T(a, {
353
176
  className: "p-4",
354
177
  children: [
355
- /* @__PURE__ */ (0, D.jsxs)("div", {
178
+ /* @__PURE__ */ T("div", {
356
179
  className: "flex items-start justify-between mb-2",
357
- children: [/* @__PURE__ */ (0, D.jsx)(v, { className: "h-4 w-4 text-yellow-500" }), y(e.score)]
180
+ children: [/* @__PURE__ */ w(v, { className: "h-4 w-4 text-yellow-500" }), y(e.score)]
358
181
  }),
359
- /* @__PURE__ */ (0, D.jsx)("h4", {
182
+ /* @__PURE__ */ w("h4", {
360
183
  className: "font-medium text-sm mb-1",
361
184
  children: e.title
362
185
  }),
363
- e.description && /* @__PURE__ */ (0, D.jsx)("p", {
186
+ e.description && /* @__PURE__ */ w("p", {
364
187
  className: "text-xs text-muted-foreground line-clamp-3",
365
188
  children: e.description
366
189
  }),
367
- e.category && /* @__PURE__ */ (0, D.jsx)(n, {
190
+ e.category && /* @__PURE__ */ w(n, {
368
191
  variant: "outline",
369
192
  className: "text-xs mt-2",
370
193
  children: e.category
371
194
  }),
372
- /* @__PURE__ */ (0, D.jsxs)("div", {
195
+ /* @__PURE__ */ T("div", {
373
196
  className: "flex items-center gap-1 mt-3",
374
- children: [/* @__PURE__ */ (0, D.jsx)(r, {
197
+ children: [/* @__PURE__ */ w(r, {
375
198
  variant: "ghost",
376
199
  size: "sm",
377
200
  className: "h-6 w-6 p-0 text-green-600",
378
- children: /* @__PURE__ */ (0, D.jsx)(x, { className: "h-3 w-3" })
379
- }), /* @__PURE__ */ (0, D.jsx)(r, {
201
+ children: /* @__PURE__ */ w(x, { className: "h-3 w-3" })
202
+ }), /* @__PURE__ */ w(r, {
380
203
  variant: "ghost",
381
204
  size: "sm",
382
205
  className: "h-6 w-6 p-0 text-red-500",
383
- children: /* @__PURE__ */ (0, D.jsx)(b, { className: "h-3 w-3" })
206
+ children: /* @__PURE__ */ w(b, { className: "h-3 w-3" })
384
207
  })]
385
208
  })
386
209
  ]
387
210
  })
388
211
  }, e.id))
389
- }) : /* @__PURE__ */ (0, D.jsx)("div", {
212
+ }) : /* @__PURE__ */ w("div", {
390
213
  className: "space-y-2",
391
- children: l.map((e) => /* @__PURE__ */ (0, D.jsxs)("div", {
214
+ children: l.map((e) => /* @__PURE__ */ T("div", {
392
215
  className: "flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer",
393
216
  onClick: () => h(e),
394
217
  children: [
395
- /* @__PURE__ */ (0, D.jsx)("div", {
218
+ /* @__PURE__ */ w("div", {
396
219
  className: "mt-1 shrink-0",
397
- children: /* @__PURE__ */ (0, D.jsx)(v, { className: "h-4 w-4 text-yellow-500" })
220
+ children: /* @__PURE__ */ w(v, { className: "h-4 w-4 text-yellow-500" })
398
221
  }),
399
- /* @__PURE__ */ (0, D.jsxs)("div", {
222
+ /* @__PURE__ */ T("div", {
400
223
  className: "flex-1 min-w-0",
401
- children: [/* @__PURE__ */ (0, D.jsxs)("div", {
224
+ children: [/* @__PURE__ */ T("div", {
402
225
  className: "flex items-center gap-2 mb-1",
403
226
  children: [
404
- /* @__PURE__ */ (0, D.jsx)("span", {
227
+ /* @__PURE__ */ w("span", {
405
228
  className: "font-medium text-sm",
406
229
  children: e.title
407
230
  }),
408
- e.category && /* @__PURE__ */ (0, D.jsx)(n, {
231
+ e.category && /* @__PURE__ */ w(n, {
409
232
  variant: "outline",
410
233
  className: "text-xs",
411
234
  children: e.category
412
235
  }),
413
236
  y(e.score)
414
237
  ]
415
- }), e.description && /* @__PURE__ */ (0, D.jsx)("p", {
238
+ }), e.description && /* @__PURE__ */ w("p", {
416
239
  className: "text-xs text-muted-foreground line-clamp-2",
417
240
  children: e.description
418
241
  })]
419
242
  }),
420
- /* @__PURE__ */ (0, D.jsxs)("div", {
243
+ /* @__PURE__ */ T("div", {
421
244
  className: "flex items-center gap-1 shrink-0",
422
- children: [e.action && /* @__PURE__ */ (0, D.jsx)(r, {
245
+ children: [e.action && /* @__PURE__ */ w(r, {
423
246
  variant: "ghost",
424
247
  size: "sm",
425
248
  className: "h-7 w-7 p-0",
426
- children: /* @__PURE__ */ (0, D.jsx)(f, { className: "h-3.5 w-3.5" })
427
- }), /* @__PURE__ */ (0, D.jsx)(r, {
249
+ children: /* @__PURE__ */ w(f, { className: "h-3.5 w-3.5" })
250
+ }), /* @__PURE__ */ w(r, {
428
251
  variant: "ghost",
429
252
  size: "sm",
430
253
  className: "h-7 w-7 p-0 text-muted-foreground",
431
254
  onClick: (t) => {
432
255
  t.stopPropagation(), g(e);
433
256
  },
434
- children: /* @__PURE__ */ (0, D.jsx)(S, { className: "h-3.5 w-3.5" })
257
+ children: /* @__PURE__ */ w(S, { className: "h-3.5 w-3.5" })
435
258
  })]
436
259
  })
437
260
  ]
438
261
  }, e.id))
439
262
  }) })] });
440
- }, A = ({ schema: e, onSubmit: u }) => {
441
- let { placeholder: f = "Ask a question about your data...", result: p, suggestions: h = [], showHistory: v = !1, history: b = [], loading: x = !1 } = e, [S, C] = t(""), [w, T] = t(p), [E, O] = t(!1), k = E || x, A = (e) => {
263
+ }, O = ({ schema: e, onSubmit: u }) => {
264
+ let { placeholder: f = "Ask a question about your data...", result: p, suggestions: h = [], showHistory: v = !1, history: b = [], loading: x = !1 } = e, [S, E] = t(""), [D, O] = t(p), [k, A] = t(!1), j = k || x, M = (e) => {
442
265
  let t = e || S;
443
- t.trim() && (O(!0), u?.(t), u ? O(!1) : setTimeout(() => {
444
- T({
266
+ t.trim() && (A(!0), u?.(t), u ? A(!1) : setTimeout(() => {
267
+ O({
445
268
  query: t,
446
269
  summary: `Results for: "${t}"`,
447
270
  confidence: .85,
448
271
  data: [],
449
272
  columns: []
450
- }), O(!1);
273
+ }), A(!1);
451
274
  }, 1e3));
452
- }, j = (e) => {
453
- C(e), A(e);
275
+ }, N = (e) => {
276
+ E(e), M(e);
454
277
  };
455
- return /* @__PURE__ */ (0, D.jsxs)("div", {
278
+ return /* @__PURE__ */ T("div", {
456
279
  className: "space-y-4",
457
280
  children: [
458
- /* @__PURE__ */ (0, D.jsx)(i, { children: /* @__PURE__ */ (0, D.jsxs)(a, {
281
+ /* @__PURE__ */ w(i, { children: /* @__PURE__ */ T(a, {
459
282
  className: "p-4",
460
- children: [/* @__PURE__ */ (0, D.jsx)("div", {
283
+ children: [/* @__PURE__ */ w("div", {
461
284
  className: "flex items-center gap-2",
462
- children: /* @__PURE__ */ (0, D.jsxs)("div", {
285
+ children: /* @__PURE__ */ T("div", {
463
286
  className: "relative flex-1",
464
287
  children: [
465
- /* @__PURE__ */ (0, D.jsx)(g, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
466
- /* @__PURE__ */ (0, D.jsx)(c, {
288
+ /* @__PURE__ */ w(g, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
289
+ /* @__PURE__ */ w(c, {
467
290
  value: S,
468
- onChange: (e) => C(e.target.value),
469
- onKeyDown: (e) => e.key === "Enter" && A(),
291
+ onChange: (e) => E(e.target.value),
292
+ onKeyDown: (e) => e.key === "Enter" && M(),
470
293
  placeholder: f,
471
294
  className: "pl-10 pr-20",
472
- disabled: k
295
+ disabled: j
473
296
  }),
474
- /* @__PURE__ */ (0, D.jsx)("div", {
297
+ /* @__PURE__ */ w("div", {
475
298
  className: "absolute right-2 top-1/2 -translate-y-1/2",
476
- children: /* @__PURE__ */ (0, D.jsx)(r, {
299
+ children: /* @__PURE__ */ w(r, {
477
300
  size: "sm",
478
- onClick: () => A(),
479
- disabled: k || !S.trim(),
301
+ onClick: () => M(),
302
+ disabled: j || !S.trim(),
480
303
  className: "h-7",
481
- children: k ? /* @__PURE__ */ (0, D.jsx)(m, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, D.jsxs)(D.Fragment, { children: [/* @__PURE__ */ (0, D.jsx)(_, { className: "h-3.5 w-3.5 mr-1" }), "Ask"] })
304
+ children: j ? /* @__PURE__ */ w(m, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(_, { className: "h-3.5 w-3.5 mr-1" }), "Ask"] })
482
305
  })
483
306
  })
484
307
  ]
485
308
  })
486
- }), h.length > 0 && !w && /* @__PURE__ */ (0, D.jsx)("div", {
309
+ }), h.length > 0 && !D && /* @__PURE__ */ w("div", {
487
310
  className: "mt-3 flex flex-wrap gap-2",
488
- children: h.map((e, t) => /* @__PURE__ */ (0, D.jsx)("button", {
489
- onClick: () => j(e),
311
+ children: h.map((e, t) => /* @__PURE__ */ w("button", {
312
+ onClick: () => N(e),
490
313
  className: "text-xs px-2.5 py-1 rounded-full border bg-muted/30 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",
491
- disabled: k,
314
+ disabled: j,
492
315
  children: e
493
316
  }, t))
494
317
  })]
495
318
  }) }),
496
- w && /* @__PURE__ */ (0, D.jsxs)(i, { children: [/* @__PURE__ */ (0, D.jsx)(o, {
319
+ D && /* @__PURE__ */ T(i, { children: [/* @__PURE__ */ w(o, {
497
320
  className: "pb-2",
498
- children: /* @__PURE__ */ (0, D.jsxs)("div", {
321
+ children: /* @__PURE__ */ T("div", {
499
322
  className: "flex items-center justify-between",
500
- children: [/* @__PURE__ */ (0, D.jsxs)(s, {
323
+ children: [/* @__PURE__ */ T(s, {
501
324
  className: "text-sm flex items-center gap-2",
502
- children: [/* @__PURE__ */ (0, D.jsx)(y, { className: "h-4 w-4" }), "Results"]
503
- }), w.confidence !== void 0 && /* @__PURE__ */ (0, D.jsxs)(n, {
504
- variant: w.confidence >= .7 ? "default" : "secondary",
325
+ children: [/* @__PURE__ */ w(y, { className: "h-4 w-4" }), "Results"]
326
+ }), D.confidence !== void 0 && /* @__PURE__ */ T(n, {
327
+ variant: D.confidence >= .7 ? "default" : "secondary",
505
328
  className: "text-xs",
506
- children: [Math.round(w.confidence * 100), "% match"]
329
+ children: [Math.round(D.confidence * 100), "% match"]
507
330
  })]
508
331
  })
509
- }), /* @__PURE__ */ (0, D.jsxs)(a, { children: [
510
- w.summary && /* @__PURE__ */ (0, D.jsx)("p", {
332
+ }), /* @__PURE__ */ T(a, { children: [
333
+ D.summary && /* @__PURE__ */ w("p", {
511
334
  className: "text-sm text-muted-foreground mb-3",
512
- children: w.summary
335
+ children: D.summary
513
336
  }),
514
- w.data && w.data.length > 0 && w.columns && /* @__PURE__ */ (0, D.jsx)("div", {
337
+ D.data && D.data.length > 0 && D.columns && /* @__PURE__ */ w("div", {
515
338
  className: "border rounded-lg overflow-hidden",
516
- children: /* @__PURE__ */ (0, D.jsxs)("table", {
339
+ children: /* @__PURE__ */ T("table", {
517
340
  className: "w-full text-sm",
518
- children: [/* @__PURE__ */ (0, D.jsx)("thead", {
341
+ children: [/* @__PURE__ */ w("thead", {
519
342
  className: "bg-muted",
520
- children: /* @__PURE__ */ (0, D.jsx)("tr", { children: w.columns.map((e, t) => /* @__PURE__ */ (0, D.jsx)("th", {
343
+ children: /* @__PURE__ */ w("tr", { children: D.columns.map((e, t) => /* @__PURE__ */ w("th", {
521
344
  className: "px-4 py-2 text-left font-medium",
522
345
  children: e.label || e.name
523
346
  }, t)) })
524
- }), /* @__PURE__ */ (0, D.jsx)("tbody", { children: w.data.map((e, t) => /* @__PURE__ */ (0, D.jsx)("tr", {
347
+ }), /* @__PURE__ */ w("tbody", { children: D.data.map((e, t) => /* @__PURE__ */ w("tr", {
525
348
  className: "border-t",
526
- children: w.columns.map((t, n) => /* @__PURE__ */ (0, D.jsx)("td", {
349
+ children: D.columns.map((t, n) => /* @__PURE__ */ w("td", {
527
350
  className: "px-4 py-2",
528
351
  children: String(e[t.name] ?? "")
529
352
  }, n))
530
353
  }, t)) })]
531
354
  })
532
355
  }),
533
- (!w.data || w.data.length === 0) && /* @__PURE__ */ (0, D.jsx)("div", {
356
+ (!D.data || D.data.length === 0) && /* @__PURE__ */ w("div", {
534
357
  className: "text-center py-6 text-muted-foreground text-sm",
535
358
  children: "No matching records found"
536
359
  })
537
360
  ] })] }),
538
- v && b.length > 0 && /* @__PURE__ */ (0, D.jsxs)(i, { children: [/* @__PURE__ */ (0, D.jsx)(o, {
361
+ v && b.length > 0 && /* @__PURE__ */ T(i, { children: [/* @__PURE__ */ w(o, {
539
362
  className: "pb-2",
540
- children: /* @__PURE__ */ (0, D.jsxs)(s, {
363
+ children: /* @__PURE__ */ T(s, {
541
364
  className: "text-xs text-muted-foreground flex items-center gap-1",
542
- children: [/* @__PURE__ */ (0, D.jsx)(d, { className: "h-3 w-3" }), "Recent Queries"]
365
+ children: [/* @__PURE__ */ w(d, { className: "h-3 w-3" }), "Recent Queries"]
543
366
  })
544
- }), /* @__PURE__ */ (0, D.jsx)(a, {
367
+ }), /* @__PURE__ */ w(a, {
545
368
  className: "space-y-1",
546
- children: b.slice(0, 5).map((e, t) => /* @__PURE__ */ (0, D.jsxs)("button", {
547
- onClick: () => j(e.query),
369
+ children: b.slice(0, 5).map((e, t) => /* @__PURE__ */ T("button", {
370
+ onClick: () => N(e.query),
548
371
  className: "w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors",
549
372
  children: [
550
- /* @__PURE__ */ (0, D.jsx)(l, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
551
- /* @__PURE__ */ (0, D.jsx)("span", {
373
+ /* @__PURE__ */ w(l, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
374
+ /* @__PURE__ */ w("span", {
552
375
  className: "truncate",
553
376
  children: e.query
554
377
  }),
555
- /* @__PURE__ */ (0, D.jsx)("span", {
378
+ /* @__PURE__ */ w("span", {
556
379
  className: "text-xs text-muted-foreground shrink-0 ml-auto",
557
380
  children: new Date(e.timestamp).toLocaleDateString()
558
381
  })
@@ -562,7 +385,7 @@ var C = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
562
385
  ]
563
386
  });
564
387
  };
565
- e.register("ai-form-assist", O, {
388
+ e.register("ai-form-assist", E, {
566
389
  label: "AI Form Assist",
567
390
  category: "AI",
568
391
  inputs: [
@@ -605,7 +428,7 @@ e.register("ai-form-assist", O, {
605
428
  defaultValue: !1
606
429
  }
607
430
  ]
608
- }), e.register("ai-recommendations", k, {
431
+ }), e.register("ai-recommendations", D, {
609
432
  label: "AI Recommendations",
610
433
  category: "AI",
611
434
  inputs: [
@@ -657,7 +480,7 @@ e.register("ai-form-assist", O, {
657
480
  label: "Empty Message"
658
481
  }
659
482
  ]
660
- }), e.register("nl-query", A, {
483
+ }), e.register("nl-query", O, {
661
484
  label: "Natural Language Query",
662
485
  category: "AI",
663
486
  inputs: [
@@ -685,4 +508,4 @@ e.register("ai-form-assist", O, {
685
508
  ]
686
509
  });
687
510
  //#endregion
688
- export { O as AIFormAssist, k as AIRecommendations, A as NLQueryInput };
511
+ export { E as AIFormAssist, D as AIRecommendations, O as NLQueryInput };
@@ -1,6 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`lucide-react`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginAI={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.lucide_react))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=Object.create,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,l=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,d=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=c(t),a=0,l=i.length,d;a<l;a++)d=i[a],!u.call(e,d)&&d!==n&&o(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=s(t,d))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:a(l(e)),f(t||!e||!e.__esModule?o(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var p=d((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),m=d((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!0,console.error("%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)",t))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[e]=!0,console.error(`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.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,`validated`,{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,`_debugInfo`,{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,`_debugStack`,{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`);else f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
2
- let props = %s;
3
- <%s {...props} />
4
- React keys must be passed directly to JSX without using spread:
5
- let props = %s;
6
- <%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),h=d(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=p():t.exports=m()}))(),g=({schema:e,onApply:t,onRefresh:a})=>{let{suggestions:o=[],showConfidence:s=!0,showReasoning:c=!1,autoFill:l=!1}=e,[u,d]=(0,n.useState)(o),[f,p]=(0,n.useState)(new Set),[m,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)(!1),y=e=>{t?.(e),p(t=>new Set(t).add(e.fieldName))},b=()=>{u.forEach(e=>t?.(e)),p(new Set(u.map(e=>e.fieldName)))},x=e=>{d(t=>t.filter(t=>t.fieldName!==e))},S=()=>{v(!0),a&&a(),setTimeout(()=>v(!1),1e3)};if(m||u.length===0)return null;let C=u.filter(e=>!f.has(e.fieldName)),w=e=>e>=.8?`text-green-600`:e>=.5?`text-yellow-600`:`text-red-600`;return(0,h.jsxs)(r.Card,{className:`border-blue-200 bg-blue-50/30`,children:[(0,h.jsx)(r.CardHeader,{className:`pb-2`,children:(0,h.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,h.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,h.jsx)(i.Sparkles,{className:`h-4 w-4 text-blue-500`}),`AI Suggestions`,(0,h.jsxs)(r.Badge,{variant:`secondary`,className:`text-xs`,children:[C.length,` suggestion`,C.length===1?``:`s`]})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:S,disabled:_,className:`h-7`,children:(0,h.jsx)(i.RefreshCw,{className:`h-3 w-3 ${_?`animate-spin`:``}`})}),C.length>1&&(0,h.jsx)(r.Button,{variant:`outline`,size:`sm`,onClick:b,className:`h-7 text-xs`,children:`Apply All`}),(0,h.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>g(!0),className:`h-7`,children:(0,h.jsx)(i.X,{className:`h-3 w-3`})})]})]})}),(0,h.jsxs)(r.CardContent,{className:`space-y-2 pt-0`,children:[C.map(e=>(0,h.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-md bg-white border text-sm`,children:[(0,h.jsx)(i.Lightbulb,{className:`h-4 w-4 text-yellow-500 shrink-0`}),(0,h.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`font-medium`,children:e.fieldName}),(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,h.jsx)(`span`,{className:`font-mono text-blue-600 truncate`,children:typeof e.value==`object`?JSON.stringify(e.value):String(e.value)})]}),s&&(0,h.jsxs)(`div`,{className:`text-xs ${w(e.confidence)}`,children:[Math.round(e.confidence*100),`% confidence`]}),c&&e.reasoning&&(0,h.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:e.reasoning})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,h.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50`,onClick:()=>y(e),children:(0,h.jsx)(i.Check,{className:`h-3.5 w-3.5`})}),(0,h.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50`,onClick:()=>x(e.fieldName),children:(0,h.jsx)(i.X,{className:`h-3.5 w-3.5`})})]})]},e.fieldName)),f.size>0&&(0,h.jsxs)(`div`,{className:`text-xs text-green-600 flex items-center gap-1 pt-1`,children:[(0,h.jsx)(i.Check,{className:`h-3 w-3`}),f.size,` suggestion`,f.size===1?``:`s`,` applied`]})]})]})},_=({schema:e,onSelect:t,onDismiss:n})=>{let{recommendations:a=[],showScores:o=!1,layout:s=`list`,loading:c=!1,emptyMessage:l=`No recommendations available`}=e,u=e=>{t?.(e)},d=e=>{n?.(e)};if(c)return(0,h.jsx)(r.Card,{children:(0,h.jsxs)(r.CardContent,{className:`p-8 text-center`,children:[(0,h.jsx)(i.Sparkles,{className:`h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse`}),(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Generating recommendations...`})]})});if(a.length===0)return(0,h.jsx)(r.Card,{children:(0,h.jsx)(r.CardContent,{className:`p-8 text-center text-muted-foreground`,children:l})});let f=e=>{if(!o)return null;let t=Math.round(e*100);return(0,h.jsxs)(r.Badge,{variant:e>=.7?`default`:e>=.4?`secondary`:`outline`,className:`text-xs`,children:[t,`%`]})};return(0,h.jsxs)(r.Card,{children:[(0,h.jsx)(r.CardHeader,{children:(0,h.jsxs)(r.CardTitle,{className:`flex items-center gap-2 text-sm`,children:[(0,h.jsx)(i.Sparkles,{className:`h-4 w-4 text-blue-500`}),`Recommendations`,(0,h.jsx)(r.Badge,{variant:`secondary`,className:`text-xs`,children:a.length})]})}),(0,h.jsx)(r.CardContent,{children:s===`grid`?(0,h.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:a.map(e=>(0,h.jsx)(r.Card,{className:`cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>u(e),children:(0,h.jsxs)(r.CardContent,{className:`p-4`,children:[(0,h.jsxs)(`div`,{className:`flex items-start justify-between mb-2`,children:[(0,h.jsx)(i.Star,{className:`h-4 w-4 text-yellow-500`}),f(e.score)]}),(0,h.jsx)(`h4`,{className:`font-medium text-sm mb-1`,children:e.title}),e.description&&(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-3`,children:e.description}),e.category&&(0,h.jsx)(r.Badge,{variant:`outline`,className:`text-xs mt-2`,children:e.category}),(0,h.jsxs)(`div`,{className:`flex items-center gap-1 mt-3`,children:[(0,h.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-green-600`,children:(0,h.jsx)(i.ThumbsUp,{className:`h-3 w-3`})}),(0,h.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-red-500`,children:(0,h.jsx)(i.ThumbsDown,{className:`h-3 w-3`})})]})]})},e.id))}):(0,h.jsx)(`div`,{className:`space-y-2`,children:a.map(e=>(0,h.jsxs)(`div`,{className:`flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer`,onClick:()=>u(e),children:[(0,h.jsx)(`div`,{className:`mt-1 shrink-0`,children:(0,h.jsx)(i.Star,{className:`h-4 w-4 text-yellow-500`})}),(0,h.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,h.jsx)(`span`,{className:`font-medium text-sm`,children:e.title}),e.category&&(0,h.jsx)(r.Badge,{variant:`outline`,className:`text-xs`,children:e.category}),f(e.score)]}),e.description&&(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e.action&&(0,h.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,children:(0,h.jsx)(i.ExternalLink,{className:`h-3.5 w-3.5`})}),(0,h.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-muted-foreground`,onClick:t=>{t.stopPropagation(),d(e)},children:(0,h.jsx)(i.X,{className:`h-3.5 w-3.5`})})]})]},e.id))})})]})},v=({schema:e,onSubmit:t})=>{let{placeholder:a=`Ask a question about your data...`,result:o,suggestions:s=[],showHistory:c=!1,history:l=[],loading:u=!1}=e,[d,f]=(0,n.useState)(``),[p,m]=(0,n.useState)(o),[g,_]=(0,n.useState)(!1),v=g||u,y=e=>{let n=e||d;n.trim()&&(_(!0),t?.(n),t?_(!1):setTimeout(()=>{m({query:n,summary:`Results for: "${n}"`,confidence:.85,data:[],columns:[]}),_(!1)},1e3))},b=e=>{f(e),y(e)};return(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsx)(r.Card,{children:(0,h.jsxs)(r.CardContent,{className:`p-4`,children:[(0,h.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,h.jsxs)(`div`,{className:`relative flex-1`,children:[(0,h.jsx)(i.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,h.jsx)(r.Input,{value:d,onChange:e=>f(e.target.value),onKeyDown:e=>e.key===`Enter`&&y(),placeholder:a,className:`pl-10 pr-20`,disabled:v}),(0,h.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2`,children:(0,h.jsx)(r.Button,{size:`sm`,onClick:()=>y(),disabled:v||!d.trim(),className:`h-7`,children:v?(0,h.jsx)(i.Loader2,{className:`h-3.5 w-3.5 animate-spin`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(i.Sparkles,{className:`h-3.5 w-3.5 mr-1`}),`Ask`]})})})]})}),s.length>0&&!p&&(0,h.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:s.map((e,t)=>(0,h.jsx)(`button`,{onClick:()=>b(e),className:`text-xs px-2.5 py-1 rounded-full border bg-muted/30 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,disabled:v,children:e},t))})]})}),p&&(0,h.jsxs)(r.Card,{children:[(0,h.jsx)(r.CardHeader,{className:`pb-2`,children:(0,h.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,h.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,h.jsx)(i.Table,{className:`h-4 w-4`}),`Results`]}),p.confidence!==void 0&&(0,h.jsxs)(r.Badge,{variant:p.confidence>=.7?`default`:`secondary`,className:`text-xs`,children:[Math.round(p.confidence*100),`% match`]})]})}),(0,h.jsxs)(r.CardContent,{children:[p.summary&&(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:p.summary}),p.data&&p.data.length>0&&p.columns&&(0,h.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,h.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,h.jsx)(`thead`,{className:`bg-muted`,children:(0,h.jsx)(`tr`,{children:p.columns.map((e,t)=>(0,h.jsx)(`th`,{className:`px-4 py-2 text-left font-medium`,children:e.label||e.name},t))})}),(0,h.jsx)(`tbody`,{children:p.data.map((e,t)=>(0,h.jsx)(`tr`,{className:`border-t`,children:p.columns.map((t,n)=>(0,h.jsx)(`td`,{className:`px-4 py-2`,children:String(e[t.name]??``)},n))},t))})]})}),(!p.data||p.data.length===0)&&(0,h.jsx)(`div`,{className:`text-center py-6 text-muted-foreground text-sm`,children:`No matching records found`})]})]}),c&&l.length>0&&(0,h.jsxs)(r.Card,{children:[(0,h.jsx)(r.CardHeader,{className:`pb-2`,children:(0,h.jsxs)(r.CardTitle,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,h.jsx)(i.Clock,{className:`h-3 w-3`}),`Recent Queries`]})}),(0,h.jsx)(r.CardContent,{className:`space-y-1`,children:l.slice(0,5).map((e,t)=>(0,h.jsxs)(`button`,{onClick:()=>b(e.query),className:`w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors`,children:[(0,h.jsx)(i.ArrowRight,{className:`h-3 w-3 text-muted-foreground shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:e.query}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0 ml-auto`,children:new Date(e.timestamp).toLocaleDateString()})]},t))})]})]})};t.ComponentRegistry.register(`ai-form-assist`,g,{label:`AI Form Assist`,category:`AI`,inputs:[{name:`formId`,type:`string`,label:`Form ID`},{name:`objectName`,type:`string`,label:`Object Name`},{name:`fields`,type:`array`,label:`Fields to suggest`},{name:`suggestions`,type:`code`,label:`Suggestions Data`},{name:`autoFill`,type:`boolean`,label:`Auto Fill`,defaultValue:!1},{name:`showConfidence`,type:`boolean`,label:`Show Confidence`,defaultValue:!0},{name:`showReasoning`,type:`boolean`,label:`Show Reasoning`,defaultValue:!1}]}),t.ComponentRegistry.register(`ai-recommendations`,_,{label:`AI Recommendations`,category:`AI`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`},{name:`recommendations`,type:`code`,label:`Recommendations Data`},{name:`maxResults`,type:`number`,label:`Max Results`,defaultValue:10},{name:`showScores`,type:`boolean`,label:`Show Scores`,defaultValue:!1},{name:`layout`,type:`enum`,label:`Layout`,enum:[{label:`List`,value:`list`},{label:`Grid`,value:`grid`},{label:`Carousel`,value:`carousel`}],defaultValue:`list`},{name:`emptyMessage`,type:`string`,label:`Empty Message`}]}),t.ComponentRegistry.register(`nl-query`,v,{label:`Natural Language Query`,category:`AI`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`},{name:`placeholder`,type:`string`,label:`Placeholder Text`},{name:`suggestions`,type:`array`,label:`Example Queries`},{name:`showHistory`,type:`boolean`,label:`Show History`,defaultValue:!1}]}),e.AIFormAssist=g,e.AIRecommendations=_,e.NLQueryInput=v});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`lucide-react`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginAI={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.lucide_react,e.react_jsx_runtime))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:o(u(e)),f(t||!e||!e.__esModule?s(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var p=({schema:e,onApply:t,onRefresh:o})=>{let{suggestions:s=[],showConfidence:c=!0,showReasoning:l=!1,autoFill:u=!1}=e,[d,f]=(0,n.useState)(s),[p,m]=(0,n.useState)(new Set),[h,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)(!1),y=e=>{t?.(e),m(t=>new Set(t).add(e.fieldName))},b=()=>{d.forEach(e=>t?.(e)),m(new Set(d.map(e=>e.fieldName)))},x=e=>{f(t=>t.filter(t=>t.fieldName!==e))},S=()=>{v(!0),o&&o(),setTimeout(()=>v(!1),1e3)};if(h||d.length===0)return null;let C=d.filter(e=>!p.has(e.fieldName)),w=e=>e>=.8?`text-green-600`:e>=.5?`text-yellow-600`:`text-red-600`;return(0,a.jsxs)(r.Card,{className:`border-blue-200 bg-blue-50/30`,children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,a.jsx)(i.Sparkles,{className:`h-4 w-4 text-blue-500`}),`AI Suggestions`,(0,a.jsxs)(r.Badge,{variant:`secondary`,className:`text-xs`,children:[C.length,` suggestion`,C.length===1?``:`s`]})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:S,disabled:_,className:`h-7`,children:(0,a.jsx)(i.RefreshCw,{className:`h-3 w-3 ${_?`animate-spin`:``}`})}),C.length>1&&(0,a.jsx)(r.Button,{variant:`outline`,size:`sm`,onClick:b,className:`h-7 text-xs`,children:`Apply All`}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>g(!0),className:`h-7`,children:(0,a.jsx)(i.X,{className:`h-3 w-3`})})]})]})}),(0,a.jsxs)(r.CardContent,{className:`space-y-2 pt-0`,children:[C.map(e=>(0,a.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-md bg-white border text-sm`,children:[(0,a.jsx)(i.Lightbulb,{className:`h-4 w-4 text-yellow-500 shrink-0`}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`span`,{className:`font-medium`,children:e.fieldName}),(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,a.jsx)(`span`,{className:`font-mono text-blue-600 truncate`,children:typeof e.value==`object`?JSON.stringify(e.value):String(e.value)})]}),c&&(0,a.jsxs)(`div`,{className:`text-xs ${w(e.confidence)}`,children:[Math.round(e.confidence*100),`% confidence`]}),l&&e.reasoning&&(0,a.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:e.reasoning})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50`,onClick:()=>y(e),children:(0,a.jsx)(i.Check,{className:`h-3.5 w-3.5`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50`,onClick:()=>x(e.fieldName),children:(0,a.jsx)(i.X,{className:`h-3.5 w-3.5`})})]})]},e.fieldName)),p.size>0&&(0,a.jsxs)(`div`,{className:`text-xs text-green-600 flex items-center gap-1 pt-1`,children:[(0,a.jsx)(i.Check,{className:`h-3 w-3`}),p.size,` suggestion`,p.size===1?``:`s`,` applied`]})]})]})},m=({schema:e,onSelect:t,onDismiss:n})=>{let{recommendations:o=[],showScores:s=!1,layout:c=`list`,loading:l=!1,emptyMessage:u=`No recommendations available`}=e,d=e=>{t?.(e)},f=e=>{n?.(e)};if(l)return(0,a.jsx)(r.Card,{children:(0,a.jsxs)(r.CardContent,{className:`p-8 text-center`,children:[(0,a.jsx)(i.Sparkles,{className:`h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse`}),(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Generating recommendations...`})]})});if(o.length===0)return(0,a.jsx)(r.Card,{children:(0,a.jsx)(r.CardContent,{className:`p-8 text-center text-muted-foreground`,children:u})});let p=e=>{if(!s)return null;let t=Math.round(e*100);return(0,a.jsxs)(r.Badge,{variant:e>=.7?`default`:e>=.4?`secondary`:`outline`,className:`text-xs`,children:[t,`%`]})};return(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsxs)(r.CardTitle,{className:`flex items-center gap-2 text-sm`,children:[(0,a.jsx)(i.Sparkles,{className:`h-4 w-4 text-blue-500`}),`Recommendations`,(0,a.jsx)(r.Badge,{variant:`secondary`,className:`text-xs`,children:o.length})]})}),(0,a.jsx)(r.CardContent,{children:c===`grid`?(0,a.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:o.map(e=>(0,a.jsx)(r.Card,{className:`cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>d(e),children:(0,a.jsxs)(r.CardContent,{className:`p-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-start justify-between mb-2`,children:[(0,a.jsx)(i.Star,{className:`h-4 w-4 text-yellow-500`}),p(e.score)]}),(0,a.jsx)(`h4`,{className:`font-medium text-sm mb-1`,children:e.title}),e.description&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-3`,children:e.description}),e.category&&(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs mt-2`,children:e.category}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 mt-3`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-green-600`,children:(0,a.jsx)(i.ThumbsUp,{className:`h-3 w-3`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-red-500`,children:(0,a.jsx)(i.ThumbsDown,{className:`h-3 w-3`})})]})]})},e.id))}):(0,a.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,a.jsxs)(`div`,{className:`flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer`,onClick:()=>d(e),children:[(0,a.jsx)(`div`,{className:`mt-1 shrink-0`,children:(0,a.jsx)(i.Star,{className:`h-4 w-4 text-yellow-500`})}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,a.jsx)(`span`,{className:`font-medium text-sm`,children:e.title}),e.category&&(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs`,children:e.category}),p(e.score)]}),e.description&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e.action&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,children:(0,a.jsx)(i.ExternalLink,{className:`h-3.5 w-3.5`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-muted-foreground`,onClick:t=>{t.stopPropagation(),f(e)},children:(0,a.jsx)(i.X,{className:`h-3.5 w-3.5`})})]})]},e.id))})})]})},h=({schema:e,onSubmit:t})=>{let{placeholder:o=`Ask a question about your data...`,result:s,suggestions:c=[],showHistory:l=!1,history:u=[],loading:d=!1}=e,[f,p]=(0,n.useState)(``),[m,h]=(0,n.useState)(s),[g,_]=(0,n.useState)(!1),v=g||d,y=e=>{let n=e||f;n.trim()&&(_(!0),t?.(n),t?_(!1):setTimeout(()=>{h({query:n,summary:`Results for: "${n}"`,confidence:.85,data:[],columns:[]}),_(!1)},1e3))},b=e=>{p(e),y(e)};return(0,a.jsxs)(`div`,{className:`space-y-4`,children:[(0,a.jsx)(r.Card,{children:(0,a.jsxs)(r.CardContent,{className:`p-4`,children:[(0,a.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,a.jsxs)(`div`,{className:`relative flex-1`,children:[(0,a.jsx)(i.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,a.jsx)(r.Input,{value:f,onChange:e=>p(e.target.value),onKeyDown:e=>e.key===`Enter`&&y(),placeholder:o,className:`pl-10 pr-20`,disabled:v}),(0,a.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2`,children:(0,a.jsx)(r.Button,{size:`sm`,onClick:()=>y(),disabled:v||!f.trim(),className:`h-7`,children:v?(0,a.jsx)(i.Loader2,{className:`h-3.5 w-3.5 animate-spin`}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Sparkles,{className:`h-3.5 w-3.5 mr-1`}),`Ask`]})})})]})}),c.length>0&&!m&&(0,a.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:c.map((e,t)=>(0,a.jsx)(`button`,{onClick:()=>b(e),className:`text-xs px-2.5 py-1 rounded-full border bg-muted/30 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,disabled:v,children:e},t))})]})}),m&&(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,a.jsx)(i.Table,{className:`h-4 w-4`}),`Results`]}),m.confidence!==void 0&&(0,a.jsxs)(r.Badge,{variant:m.confidence>=.7?`default`:`secondary`,className:`text-xs`,children:[Math.round(m.confidence*100),`% match`]})]})}),(0,a.jsxs)(r.CardContent,{children:[m.summary&&(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:m.summary}),m.data&&m.data.length>0&&m.columns&&(0,a.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,a.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,a.jsx)(`thead`,{className:`bg-muted`,children:(0,a.jsx)(`tr`,{children:m.columns.map((e,t)=>(0,a.jsx)(`th`,{className:`px-4 py-2 text-left font-medium`,children:e.label||e.name},t))})}),(0,a.jsx)(`tbody`,{children:m.data.map((e,t)=>(0,a.jsx)(`tr`,{className:`border-t`,children:m.columns.map((t,n)=>(0,a.jsx)(`td`,{className:`px-4 py-2`,children:String(e[t.name]??``)},n))},t))})]})}),(!m.data||m.data.length===0)&&(0,a.jsx)(`div`,{className:`text-center py-6 text-muted-foreground text-sm`,children:`No matching records found`})]})]}),l&&u.length>0&&(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(r.CardTitle,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,a.jsx)(i.Clock,{className:`h-3 w-3`}),`Recent Queries`]})}),(0,a.jsx)(r.CardContent,{className:`space-y-1`,children:u.slice(0,5).map((e,t)=>(0,a.jsxs)(`button`,{onClick:()=>b(e.query),className:`w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors`,children:[(0,a.jsx)(i.ArrowRight,{className:`h-3 w-3 text-muted-foreground shrink-0`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.query}),(0,a.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0 ml-auto`,children:new Date(e.timestamp).toLocaleDateString()})]},t))})]})]})};t.ComponentRegistry.register(`ai-form-assist`,p,{label:`AI Form Assist`,category:`AI`,inputs:[{name:`formId`,type:`string`,label:`Form ID`},{name:`objectName`,type:`string`,label:`Object Name`},{name:`fields`,type:`array`,label:`Fields to suggest`},{name:`suggestions`,type:`code`,label:`Suggestions Data`},{name:`autoFill`,type:`boolean`,label:`Auto Fill`,defaultValue:!1},{name:`showConfidence`,type:`boolean`,label:`Show Confidence`,defaultValue:!0},{name:`showReasoning`,type:`boolean`,label:`Show Reasoning`,defaultValue:!1}]}),t.ComponentRegistry.register(`ai-recommendations`,m,{label:`AI Recommendations`,category:`AI`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`},{name:`recommendations`,type:`code`,label:`Recommendations Data`},{name:`maxResults`,type:`number`,label:`Max Results`,defaultValue:10},{name:`showScores`,type:`boolean`,label:`Show Scores`,defaultValue:!1},{name:`layout`,type:`enum`,label:`Layout`,enum:[{label:`List`,value:`list`},{label:`Grid`,value:`grid`},{label:`Carousel`,value:`carousel`}],defaultValue:`list`},{name:`emptyMessage`,type:`string`,label:`Empty Message`}]}),t.ComponentRegistry.register(`nl-query`,h,{label:`Natural Language Query`,category:`AI`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`},{name:`placeholder`,type:`string`,label:`Placeholder Text`},{name:`suggestions`,type:`array`,label:`Example Queries`},{name:`showHistory`,type:`boolean`,label:`Show History`,defaultValue:!1}]}),e.AIFormAssist=p,e.AIRecommendations=m,e.NLQueryInput=h});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-ai",
3
- "version": "4.0.1",
3
+ "version": "4.0.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.umd.cjs",
6
6
  "module": "dist/index.js",
@@ -26,10 +26,10 @@
26
26
  "clsx": "^2.1.1",
27
27
  "lucide-react": "^1.14.0",
28
28
  "tailwind-merge": "^3.5.0",
29
- "@object-ui/components": "4.0.1",
30
- "@object-ui/core": "4.0.1",
31
- "@object-ui/react": "4.0.1",
32
- "@object-ui/types": "4.0.1"
29
+ "@object-ui/components": "4.0.4",
30
+ "@object-ui/core": "4.0.4",
31
+ "@object-ui/react": "4.0.4",
32
+ "@object-ui/types": "4.0.4"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^25.6.0",