@nice2dev/ui-ai 1.0.2

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.mjs ADDED
@@ -0,0 +1,1078 @@
1
+ import { jsx as x, jsxs as R } from "react/jsx-runtime";
2
+ import { useRef as E, useCallback as I, useMemo as s, useContext as Z, createContext as p, useState as O, useEffect as H, forwardRef as j } from "react";
3
+ class ee {
4
+ constructor(e = {}, n) {
5
+ this.timestamps = [], this.tokenCount = 0, this.warningEmitted = !1, this.config = {
6
+ maxRequestsPerMinute: e.maxRequestsPerMinute ?? 30,
7
+ maxTokensPerSession: e.maxTokensPerSession ?? 1e4,
8
+ warnThresholdPercent: e.warnThresholdPercent ?? 80
9
+ }, this.onWarning = n;
10
+ }
11
+ /** Check whether a new request is allowed. */
12
+ canRequest() {
13
+ return this.pruneOldTimestamps(), !(this.timestamps.length >= this.config.maxRequestsPerMinute || this.tokenCount >= this.config.maxTokensPerSession);
14
+ }
15
+ /** Record a new request. Returns false if rate-limited. */
16
+ recordRequest() {
17
+ return this.canRequest() ? (this.timestamps.push(Date.now()), !0) : !1;
18
+ }
19
+ /** Record token usage from a completed/streaming response. */
20
+ recordTokens(e) {
21
+ this.tokenCount += e, this.checkWarning();
22
+ }
23
+ /** Get current rate limit status. */
24
+ getStatus() {
25
+ this.pruneOldTimestamps();
26
+ const e = this.config.maxTokensPerSession > 0 ? this.tokenCount / this.config.maxTokensPerSession * 100 : 0, n = this.config.maxRequestsPerMinute > 0 ? this.timestamps.length / this.config.maxRequestsPerMinute * 100 : 0;
27
+ return {
28
+ requestsThisMinute: this.timestamps.length,
29
+ tokensThisSession: this.tokenCount,
30
+ isLimited: !this.canRequest(),
31
+ isWarning: e >= this.config.warnThresholdPercent || n >= this.config.warnThresholdPercent
32
+ };
33
+ }
34
+ /** Reset all counters. */
35
+ reset() {
36
+ this.timestamps = [], this.tokenCount = 0, this.warningEmitted = !1;
37
+ }
38
+ pruneOldTimestamps() {
39
+ const e = Date.now() - 6e4;
40
+ this.timestamps = this.timestamps.filter((n) => n > e);
41
+ }
42
+ checkWarning() {
43
+ var n;
44
+ if (this.warningEmitted) return;
45
+ this.getStatus().isWarning && (this.warningEmitted = !0, (n = this.onWarning) == null || n.call(this));
46
+ }
47
+ }
48
+ const B = p(null);
49
+ function ke({
50
+ config: r,
51
+ rateLimits: e,
52
+ enabled: n = !0,
53
+ onRateLimitWarning: i,
54
+ children: t
55
+ }) {
56
+ const a = E(null);
57
+ a.current || (a.current = new ee(e, i));
58
+ const u = I(() => a.current.getStatus(), []), w = s(
59
+ () => ({
60
+ config: r,
61
+ enabled: n,
62
+ rateLimiter: a.current,
63
+ getRateLimitStatus: u
64
+ }),
65
+ [r, n, u]
66
+ );
67
+ return /* @__PURE__ */ x(B.Provider, { value: w, children: t });
68
+ }
69
+ function Y() {
70
+ return Z(B);
71
+ }
72
+ async function* ne(r, e) {
73
+ var a, u, w, d, o, y, T, m, S;
74
+ const n = (a = r.body) == null ? void 0 : a.getReader();
75
+ if (!n)
76
+ throw new Error("Response body is not readable");
77
+ const i = new TextDecoder();
78
+ let t = "";
79
+ try {
80
+ for (; !(e != null && e.aborted); ) {
81
+ const { done: C, value: c } = await n.read();
82
+ if (C) break;
83
+ t += i.decode(c, { stream: !0 });
84
+ const P = t.split(`
85
+ `);
86
+ t = P.pop() ?? "";
87
+ for (const $ of P) {
88
+ const l = $.trim();
89
+ if (!(!l || l === ":")) {
90
+ if (l.startsWith("data:")) {
91
+ const f = l.slice(5).trim();
92
+ if (f === "[DONE]") {
93
+ yield { token: "", done: !0 };
94
+ return;
95
+ }
96
+ try {
97
+ const k = JSON.parse(f), h = ((d = (w = (u = k.choices) == null ? void 0 : u[0]) == null ? void 0 : w.delta) == null ? void 0 : d.content) ?? "", b = ((y = (o = k.choices) == null ? void 0 : o[0]) == null ? void 0 : y.finish_reason) === "stop";
98
+ (h || b) && (yield { token: h, done: b, usage: k.usage });
99
+ } catch {
100
+ f && (yield { token: f, done: !1 });
101
+ }
102
+ continue;
103
+ }
104
+ try {
105
+ const f = JSON.parse(l), k = f.text ?? f.content ?? f.token ?? "";
106
+ k && (yield { token: k, done: !1 });
107
+ } catch {
108
+ l && (yield { token: l, done: !1 });
109
+ }
110
+ }
111
+ }
112
+ }
113
+ if (t.trim()) {
114
+ const C = t.trim();
115
+ if (C.startsWith("data:")) {
116
+ const c = C.slice(5).trim();
117
+ if (c && c !== "[DONE]")
118
+ try {
119
+ const $ = ((S = (m = (T = JSON.parse(c).choices) == null ? void 0 : T[0]) == null ? void 0 : m.delta) == null ? void 0 : S.content) ?? "";
120
+ $ && (yield { token: $, done: !0 });
121
+ } catch {
122
+ yield { token: c, done: !0 };
123
+ }
124
+ }
125
+ }
126
+ } finally {
127
+ n.releaseLock();
128
+ }
129
+ }
130
+ async function re(r) {
131
+ var n, i, t, a;
132
+ const e = await r.json();
133
+ if ((t = (i = (n = e.choices) == null ? void 0 : n[0]) == null ? void 0 : i.message) != null && t.content)
134
+ return {
135
+ text: e.choices[0].message.content,
136
+ usage: e.usage
137
+ };
138
+ if ((a = e.message) != null && a.content)
139
+ return { text: e.message.content };
140
+ if (typeof e.text == "string")
141
+ return { text: e.text };
142
+ if (typeof e.content == "string")
143
+ return { text: e.content };
144
+ if (typeof e.response == "string")
145
+ return { text: e.response };
146
+ throw new Error("Unrecognized AI response format");
147
+ }
148
+ const z = /* @__PURE__ */ new Map();
149
+ function W(r, e) {
150
+ const n = e ? { ...r, fieldValue: void 0, formContext: void 0 } : r;
151
+ return JSON.stringify(n);
152
+ }
153
+ function ie(r, e) {
154
+ const n = [], i = e.systemPrompt ?? "You are a helpful assistant providing concise contextual hints for form fields. Keep responses short (1-3 sentences). Be specific and actionable.";
155
+ n.push({ role: "system", content: i });
156
+ const t = [];
157
+ if (r.fieldLabel && t.push(`Field: "${r.fieldLabel}"`), r.fieldType && t.push(`Type: ${r.fieldType}`), !e.privacyMode && r.fieldValue !== void 0) {
158
+ const u = typeof r.fieldValue == "string" ? r.fieldValue : JSON.stringify(r.fieldValue);
159
+ t.push(`Current value: ${u}`);
160
+ }
161
+ r.validationRules && Object.keys(r.validationRules).length > 0 && t.push(`Validation: ${JSON.stringify(r.validationRules)}`), r.schema && Object.keys(r.schema).length > 0 && t.push(`Schema: ${JSON.stringify(r.schema)}`), !e.privacyMode && r.formContext && Object.keys(r.formContext).length > 0 && t.push(`Form context: ${JSON.stringify(r.formContext)}`), r.customPrompt && t.push(r.customPrompt);
162
+ const a = t.length > 0 ? `Provide a helpful hint for this field:
163
+ ${t.join(`
164
+ `)}` : "Provide a helpful suggestion.";
165
+ return n.push({ role: "user", content: a }), n;
166
+ }
167
+ function g(r = {}, e = {}) {
168
+ r = r ?? {}, e = e ?? {};
169
+ const { debounceMs: n = 500, disabled: i = !1 } = e, t = Y(), [a, u] = O(""), [w, d] = O(!1), [o, y] = O(null), [T, m] = O(!1), S = E(null), C = E(0), c = I(async () => {
170
+ var J, V, q;
171
+ if (!t || !t.enabled || i) return;
172
+ const { config: l, rateLimiter: f } = t;
173
+ if (!f.recordRequest()) {
174
+ y("Rate limit exceeded. Please wait before requesting another hint.");
175
+ return;
176
+ }
177
+ const k = W(r, l.privacyMode ?? !1), h = z.get(k);
178
+ if (h) {
179
+ u(h), d(!1), y(null), m(!1);
180
+ return;
181
+ }
182
+ (J = S.current) == null || J.abort();
183
+ const b = new AbortController();
184
+ S.current = b, d(!0), y(null), u(""), m(!1);
185
+ const D = ie(r, l), M = l.stream !== !1;
186
+ try {
187
+ const L = {
188
+ "Content-Type": "application/json",
189
+ ...l.headers
190
+ };
191
+ l.apiKey && (L.Authorization = `Bearer ${l.apiKey}`);
192
+ const Q = JSON.stringify({
193
+ model: l.model ?? "gpt-3.5-turbo",
194
+ messages: D,
195
+ temperature: l.temperature ?? 0.7,
196
+ max_tokens: l.maxTokens ?? 256,
197
+ stream: M
198
+ }), N = await fetch(l.endpoint, {
199
+ method: "POST",
200
+ headers: L,
201
+ body: Q,
202
+ signal: b.signal
203
+ });
204
+ if (!N.ok) {
205
+ const v = await N.text().catch(() => N.statusText);
206
+ throw new Error(`AI request failed (${N.status}): ${v}`);
207
+ }
208
+ if (M) {
209
+ m(!0);
210
+ let v = "";
211
+ for await (const A of ne(N, b.signal))
212
+ if (b.signal.aborted || (v += A.token, u(v), (V = A.usage) != null && V.completion_tokens && f.recordTokens(A.usage.completion_tokens), A.done)) break;
213
+ if (v.length > 0) {
214
+ const A = Math.ceil(v.length / 4);
215
+ f.recordTokens(A);
216
+ }
217
+ z.set(k, v);
218
+ } else {
219
+ const v = await re(N);
220
+ u(v.text), z.set(k, v.text), (q = v.usage) != null && q.completion_tokens ? f.recordTokens(v.usage.completion_tokens) : f.recordTokens(Math.ceil(v.text.length / 4));
221
+ }
222
+ } catch (L) {
223
+ if (L instanceof DOMException && L.name === "AbortError") return;
224
+ y(L instanceof Error ? L.message : "AI hint request failed");
225
+ } finally {
226
+ b.signal.aborted || (d(!1), m(!1));
227
+ }
228
+ }, [t, r, i]);
229
+ H(() => {
230
+ if (!t || !t.enabled || i) return;
231
+ const l = setTimeout(c, n);
232
+ return () => clearTimeout(l);
233
+ }, [
234
+ // Only re-trigger on meaningful context changes
235
+ r == null ? void 0 : r.fieldLabel,
236
+ r == null ? void 0 : r.fieldType,
237
+ r == null ? void 0 : r.fieldValue,
238
+ r == null ? void 0 : r.customPrompt,
239
+ n,
240
+ i,
241
+ t == null ? void 0 : t.enabled,
242
+ C.current
243
+ ]), H(() => () => {
244
+ var l;
245
+ (l = S.current) == null || l.abort();
246
+ }, []);
247
+ const P = I(() => {
248
+ var l;
249
+ (l = S.current) == null || l.abort(), d(!1), m(!1);
250
+ }, []), $ = I(() => {
251
+ if (t) {
252
+ const l = W(r, t.config.privacyMode ?? !1);
253
+ z.delete(l);
254
+ }
255
+ C.current += 1, c();
256
+ }, [t, r, c]);
257
+ return !t || !t.enabled ? {
258
+ text: "",
259
+ loading: !1,
260
+ error: null,
261
+ streaming: !1,
262
+ abort: () => {
263
+ },
264
+ refresh: () => {
265
+ },
266
+ hint: null,
267
+ fetchHint: async () => {
268
+ }
269
+ } : { text: a, loading: w, error: o, streaming: T, abort: P, refresh: $, hint: a ? { content: a } : null, fetchHint: async () => {
270
+ await c();
271
+ } };
272
+ }
273
+ function te() {
274
+ return /* @__PURE__ */ R(
275
+ "svg",
276
+ {
277
+ xmlns: "http://www.w3.org/2000/svg",
278
+ viewBox: "0 0 24 24",
279
+ width: "16",
280
+ height: "16",
281
+ fill: "none",
282
+ stroke: "currentColor",
283
+ strokeWidth: 2,
284
+ strokeLinecap: "round",
285
+ strokeLinejoin: "round",
286
+ "aria-hidden": !0,
287
+ children: [
288
+ /* @__PURE__ */ x("path", { d: "M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5z" }),
289
+ /* @__PURE__ */ x("path", { d: "M19 15l.5 2 2 .5-2 .5-.5 2-.5-2-2-.5 2-.5z" }),
290
+ /* @__PURE__ */ x("path", { d: "M5 19l.5 1.5 1.5.5-1.5.5-.5 1.5-.5-1.5-1.5-.5 1.5-.5z" })
291
+ ]
292
+ }
293
+ );
294
+ }
295
+ function ae(r, e) {
296
+ if (r !== "auto" || !e) return r === "auto" ? "top" : r;
297
+ const n = e.top, i = window.innerHeight - e.bottom, t = e.left, a = window.innerWidth - e.right, u = Math.max(n, i, t, a);
298
+ return u === n ? "top" : u === i ? "bottom" : u === a ? "right" : "left";
299
+ }
300
+ function le(r) {
301
+ const e = {
302
+ position: "absolute",
303
+ zIndex: 9999,
304
+ minWidth: 200,
305
+ maxWidth: 320,
306
+ padding: "8px 12px",
307
+ borderRadius: 8,
308
+ fontSize: 13,
309
+ lineHeight: 1.5,
310
+ backgroundColor: "var(--ntd-ai-bg, #1e1e2e)",
311
+ color: "var(--ntd-ai-fg, #cdd6f4)",
312
+ border: "1px solid var(--ntd-ai-border, #45475a)",
313
+ boxShadow: "0 4px 16px rgba(0,0,0,0.25)",
314
+ wordWrap: "break-word"
315
+ };
316
+ switch (r) {
317
+ case "top":
318
+ return { ...e, bottom: "100%", left: "50%", transform: "translateX(-50%)", marginBottom: 6 };
319
+ case "bottom":
320
+ return { ...e, top: "100%", left: "50%", transform: "translateX(-50%)", marginTop: 6 };
321
+ case "left":
322
+ return { ...e, right: "100%", top: "50%", transform: "translateY(-50%)", marginRight: 6 };
323
+ case "right":
324
+ return { ...e, left: "100%", top: "50%", transform: "translateY(-50%)", marginLeft: 6 };
325
+ default:
326
+ return { ...e, bottom: "100%", left: "50%", transform: "translateX(-50%)", marginBottom: 6 };
327
+ }
328
+ }
329
+ const G = j(
330
+ ({
331
+ context: r,
332
+ position: e = "auto",
333
+ debounceMs: n = 500,
334
+ showOnHover: i = !1,
335
+ triggerIcon: t,
336
+ className: a,
337
+ style: u
338
+ }, w) => {
339
+ var k;
340
+ const d = Y(), [o, y] = O(!1), [T, m] = O(!1), S = E(null), C = E(null), c = g(r, {
341
+ debounceMs: n,
342
+ disabled: !T
343
+ });
344
+ H(() => {
345
+ if (!o) return;
346
+ const h = (b) => {
347
+ var M, J;
348
+ const D = b.target;
349
+ (M = S.current) != null && M.contains(D) || (J = C.current) != null && J.contains(D) || (y(!1), m(!1));
350
+ };
351
+ return document.addEventListener("mousedown", h), () => document.removeEventListener("mousedown", h);
352
+ }, [o]), H(() => {
353
+ if (!o) return;
354
+ const h = (b) => {
355
+ b.key === "Escape" && (y(!1), m(!1), c.abort());
356
+ };
357
+ return document.addEventListener("keydown", h), () => document.removeEventListener("keydown", h);
358
+ }, [o, c]);
359
+ const P = I(
360
+ (h) => {
361
+ if (h.stopPropagation(), i) return;
362
+ const b = !o;
363
+ y(b), m(b);
364
+ },
365
+ [o, i]
366
+ ), $ = I(() => {
367
+ i && (y(!0), m(!0));
368
+ }, [i]), l = I(() => {
369
+ i && (y(!1), m(!1));
370
+ }, [i]);
371
+ if (!d || !d.enabled) return null;
372
+ const f = ae(
373
+ e,
374
+ ((k = S.current) == null ? void 0 : k.getBoundingClientRect()) ?? null
375
+ );
376
+ return /* @__PURE__ */ R(
377
+ "span",
378
+ {
379
+ ref: w,
380
+ className: a,
381
+ style: {
382
+ position: "relative",
383
+ display: "inline-flex",
384
+ ...u
385
+ },
386
+ onMouseEnter: $,
387
+ onMouseLeave: l,
388
+ children: [
389
+ /* @__PURE__ */ x(
390
+ "button",
391
+ {
392
+ ref: S,
393
+ type: "button",
394
+ onClick: P,
395
+ "aria-label": "AI hint",
396
+ "aria-expanded": o,
397
+ className: "ntd-ai-trigger",
398
+ style: {
399
+ display: "inline-flex",
400
+ alignItems: "center",
401
+ justifyContent: "center",
402
+ border: "none",
403
+ background: "transparent",
404
+ cursor: "pointer",
405
+ padding: 2,
406
+ borderRadius: 4,
407
+ color: "var(--ntd-ai-trigger-color, #a78bfa)",
408
+ opacity: 0.7,
409
+ transition: "opacity 0.2s, transform 0.2s"
410
+ },
411
+ children: t ?? /* @__PURE__ */ x(te, {})
412
+ }
413
+ ),
414
+ o && /* @__PURE__ */ R(
415
+ "div",
416
+ {
417
+ ref: C,
418
+ role: "tooltip",
419
+ className: "ntd-ai-popover",
420
+ style: le(f),
421
+ children: [
422
+ c.loading && !c.text && /* @__PURE__ */ R("div", { className: "ntd-ai-loading", style: { display: "flex", alignItems: "center", gap: 6 }, children: [
423
+ /* @__PURE__ */ x(
424
+ "span",
425
+ {
426
+ style: {
427
+ display: "inline-block",
428
+ width: 12,
429
+ height: 12,
430
+ border: "2px solid var(--ntd-ai-border, #45475a)",
431
+ borderTopColor: "var(--ntd-ai-trigger-color, #a78bfa)",
432
+ borderRadius: "50%",
433
+ animation: "ntd-ai-spin 0.8s linear infinite"
434
+ }
435
+ }
436
+ ),
437
+ /* @__PURE__ */ x("span", { style: { opacity: 0.6 }, children: "Thinking..." })
438
+ ] }),
439
+ c.text && /* @__PURE__ */ R("div", { className: "ntd-ai-content", children: [
440
+ c.text,
441
+ c.streaming && /* @__PURE__ */ x(
442
+ "span",
443
+ {
444
+ className: "ntd-ai-cursor",
445
+ style: {
446
+ display: "inline-block",
447
+ width: 2,
448
+ height: "1em",
449
+ backgroundColor: "var(--ntd-ai-trigger-color, #a78bfa)",
450
+ marginLeft: 1,
451
+ animation: "ntd-ai-blink 0.8s step-end infinite",
452
+ verticalAlign: "text-bottom"
453
+ }
454
+ }
455
+ )
456
+ ] }),
457
+ c.error && /* @__PURE__ */ x("div", { className: "ntd-ai-error", style: { color: "var(--ntd-ai-error, #f38ba8)" }, children: c.error }),
458
+ c.text && !c.streaming && /* @__PURE__ */ R(
459
+ "div",
460
+ {
461
+ style: {
462
+ display: "flex",
463
+ justifyContent: "flex-end",
464
+ gap: 4,
465
+ marginTop: 6,
466
+ paddingTop: 6,
467
+ borderTop: "1px solid var(--ntd-ai-border, #45475a)"
468
+ },
469
+ children: [
470
+ /* @__PURE__ */ x(
471
+ "button",
472
+ {
473
+ type: "button",
474
+ onClick: () => c.refresh(),
475
+ className: "ntd-ai-action",
476
+ style: {
477
+ fontSize: 11,
478
+ padding: "2px 6px",
479
+ border: "1px solid var(--ntd-ai-border, #45475a)",
480
+ borderRadius: 4,
481
+ background: "transparent",
482
+ color: "inherit",
483
+ cursor: "pointer"
484
+ },
485
+ children: "↻ Refresh"
486
+ }
487
+ ),
488
+ /* @__PURE__ */ x(
489
+ "button",
490
+ {
491
+ type: "button",
492
+ onClick: () => {
493
+ var h;
494
+ (h = navigator.clipboard) == null || h.writeText(c.text);
495
+ },
496
+ className: "ntd-ai-action",
497
+ style: {
498
+ fontSize: 11,
499
+ padding: "2px 6px",
500
+ border: "1px solid var(--ntd-ai-border, #45475a)",
501
+ borderRadius: 4,
502
+ background: "transparent",
503
+ color: "inherit",
504
+ cursor: "pointer"
505
+ },
506
+ children: "⎘ Copy"
507
+ }
508
+ )
509
+ ]
510
+ }
511
+ )
512
+ ]
513
+ }
514
+ )
515
+ ]
516
+ }
517
+ );
518
+ }
519
+ );
520
+ G.displayName = "NiceAIHintBubble";
521
+ function F(r, e, n) {
522
+ return {
523
+ fieldLabel: r,
524
+ fieldType: "text",
525
+ fieldValue: e,
526
+ validationRules: {
527
+ ...(n == null ? void 0 : n.maxLength) != null ? { maxLength: n.maxLength } : {},
528
+ ...n != null && n.pattern ? { pattern: n.pattern } : {}
529
+ },
530
+ customPrompt: n != null && n.placeholder ? `Placeholder: "${n.placeholder}". Suggest content or correct grammar.` : "Suggest content, correct grammar, or auto-complete the text."
531
+ };
532
+ }
533
+ function K(r, e, n) {
534
+ return {
535
+ fieldLabel: r,
536
+ fieldType: "number",
537
+ fieldValue: e,
538
+ validationRules: {
539
+ ...(n == null ? void 0 : n.min) != null ? { min: n.min } : {},
540
+ ...(n == null ? void 0 : n.max) != null ? { max: n.max } : {},
541
+ ...(n == null ? void 0 : n.step) != null ? { step: n.step } : {}
542
+ },
543
+ customPrompt: n != null && n.unit ? `Unit: ${n.unit}. Suggest a reasonable value or range for this field.` : "Suggest a reasonable value or range for this field based on the label and constraints."
544
+ };
545
+ }
546
+ function _(r, e, n) {
547
+ return {
548
+ fieldLabel: r,
549
+ fieldType: n != null && n.multiple ? "multi-select" : "select",
550
+ fieldValue: e,
551
+ schema: n != null && n.options ? { availableOptions: n.options.slice(0, 20).map((i) => i.label) } : {},
552
+ customPrompt: "Suggest the most likely selection. Explain why this option is recommended."
553
+ };
554
+ }
555
+ function X(r, e, n) {
556
+ const i = e instanceof Date ? e.toISOString().split("T")[0] : e;
557
+ return {
558
+ fieldLabel: r,
559
+ fieldType: "date",
560
+ fieldValue: i,
561
+ validationRules: {
562
+ ...n != null && n.min ? { min: n.min } : {},
563
+ ...n != null && n.max ? { max: n.max } : {},
564
+ ...n != null && n.disableWeekends ? { noWeekends: !0 } : {}
565
+ },
566
+ customPrompt: 'Suggest a date. For example: "next business day", "end of month", "in 2 weeks". Explain your suggestion briefly.'
567
+ };
568
+ }
569
+ function U(r, e, n) {
570
+ return {
571
+ fieldLabel: r,
572
+ fieldType: "color",
573
+ fieldValue: e,
574
+ schema: n != null && n.palette ? { currentPalette: n.palette } : {},
575
+ customPrompt: n != null && n.industry ? `Industry: ${n.industry}. Suggest a color palette (3-5 hex colors) suitable for this context.` : "Suggest a color or palette of colors that works well for this context. Provide hex values."
576
+ };
577
+ }
578
+ function ve(r, e) {
579
+ return {
580
+ fieldLabel: r,
581
+ fieldType: "data-grid",
582
+ schema: {
583
+ ...e != null && e.columns ? { columns: e.columns } : {},
584
+ ...(e == null ? void 0 : e.rowCount) != null ? { totalRows: e.rowCount } : {}
585
+ },
586
+ formContext: {
587
+ ...e != null && e.currentFilters ? { filters: e.currentFilters } : {},
588
+ ...e != null && e.currentSorts ? { sorts: e.currentSorts } : {}
589
+ },
590
+ customPrompt: "Suggest column configuration, useful filters, or highlight potential data anomalies."
591
+ };
592
+ }
593
+ function we(r, e) {
594
+ return {
595
+ fieldLabel: r,
596
+ fieldType: "chart",
597
+ schema: {
598
+ ...e != null && e.currentType ? { chartType: e.currentType } : {},
599
+ ...(e == null ? void 0 : e.seriesCount) != null ? { series: e.seriesCount } : {},
600
+ ...(e == null ? void 0 : e.pointCount) != null ? { dataPoints: e.pointCount } : {}
601
+ },
602
+ customPrompt: e != null && e.dataDescription ? `Data: ${e.dataDescription}. Suggest the best chart type and labeling strategy.` : "Suggest the most effective chart type for this data. Explain your recommendation."
603
+ };
604
+ }
605
+ function ue(r, e) {
606
+ return {
607
+ fieldLabel: "Form auto-fill",
608
+ fieldType: "form",
609
+ schema: { fields: e },
610
+ customPrompt: `User description: "${r}"
611
+ Parse this description and return suggested values for each field as JSON: { ${e.map((n) => `"${n.label}": "value"`).join(", ")} }`
612
+ };
613
+ }
614
+ function ce(r, e, n, i, t) {
615
+ return {
616
+ fieldLabel: r,
617
+ fieldType: e,
618
+ fieldValue: n,
619
+ validationRules: t == null ? void 0 : t.rules,
620
+ customPrompt: `Current validation error: "${i}". Provide a friendly, specific error message with an example of a valid value. Do NOT say "field is required" — instead explain what the user should enter.`
621
+ };
622
+ }
623
+ function Te(r, e, n) {
624
+ const i = s(
625
+ () => F(r, e, n),
626
+ [r, e, n == null ? void 0 : n.placeholder, n == null ? void 0 : n.maxLength, n == null ? void 0 : n.pattern]
627
+ );
628
+ return g(i, n);
629
+ }
630
+ function $e(r, e, n) {
631
+ const i = s(
632
+ () => K(r, e, n),
633
+ [r, e, n == null ? void 0 : n.min, n == null ? void 0 : n.max, n == null ? void 0 : n.step, n == null ? void 0 : n.unit]
634
+ );
635
+ return g(i, n);
636
+ }
637
+ function Pe(r, e, n) {
638
+ const i = s(
639
+ () => _(r, e, n),
640
+ [r, e, n == null ? void 0 : n.multiple]
641
+ );
642
+ return g(i, n);
643
+ }
644
+ function Le(r, e, n) {
645
+ const i = s(
646
+ () => X(r, e, n),
647
+ [r, e, n == null ? void 0 : n.min, n == null ? void 0 : n.max, n == null ? void 0 : n.disableWeekends]
648
+ );
649
+ return g(i, n);
650
+ }
651
+ function Re(r, e, n) {
652
+ const i = s(
653
+ () => U(r, e, n),
654
+ [r, e, n == null ? void 0 : n.industry]
655
+ );
656
+ return g(i, n);
657
+ }
658
+ function Ie(r, e, n, i, t) {
659
+ const a = s(
660
+ () => i ? ce(r, e, n, i, t) : { fieldLabel: r, fieldType: e },
661
+ [r, e, n, i]
662
+ );
663
+ return g(a, { ...t, disabled: !i || (t == null ? void 0 : t.disabled) });
664
+ }
665
+ function Ne(r, e, n) {
666
+ const i = s(
667
+ () => r ? ue(r, e) : { fieldLabel: "Form" },
668
+ [r, e]
669
+ );
670
+ return g(i, {
671
+ ...n,
672
+ disabled: !r || (n == null ? void 0 : n.disabled)
673
+ });
674
+ }
675
+ function de(r, e, n) {
676
+ const t = (e == null ? void 0 : e.split(`
677
+ `)) ?? [], a = (n == null ? void 0 : n.cursorLine) != null ? t.slice(Math.max(0, n.cursorLine - 8), n.cursorLine + 3).join(`
678
+ `) : t.slice(0, 8 * 2).join(`
679
+ `);
680
+ return {
681
+ fieldLabel: `Code editor (${r})`,
682
+ fieldType: "code-editor",
683
+ fieldValue: a || e,
684
+ schema: {
685
+ language: r,
686
+ ...n != null && n.framework ? { framework: n.framework } : {},
687
+ ...(n == null ? void 0 : n.cursorLine) != null ? { cursorLine: n.cursorLine, cursorCol: n.cursorCol } : {}
688
+ },
689
+ customPrompt: `Language: ${r}${n != null && n.framework ? `, framework: ${n.framework}` : ""}.
690
+ Provide a concise inline completion or improvement hint for the code near the cursor. Limit response to ${(n == null ? void 0 : n.maxSuggestLines) ?? 5} lines of code. If unsure, suggest the most idiomatic approach for this language/framework.`
691
+ };
692
+ }
693
+ function se(r, e, n) {
694
+ var a;
695
+ const i = (n == null ? void 0 : n.mode) ?? "grammar", t = {
696
+ seo: "Analyze this HTML for SEO: missing meta tags, heading hierarchy (h1→h2→h3), keyword density, image alt attributes. Return a prioritized list of improvements.",
697
+ accessibility: "Audit this HTML for WCAG 2.1 AA issues: missing aria labels, alt text, heading structure, color contrast hints, keyboard navigation. List specific fixes.",
698
+ grammar: "Fix grammar, punctuation, and writing style in the visible text content. Return the corrected text only (no HTML tags in response).",
699
+ cleanup: "Clean up malformed, redundant, or overly nested HTML. Simplify structure while preserving semantics and content."
700
+ };
701
+ return {
702
+ fieldLabel: r,
703
+ fieldType: "html-editor",
704
+ fieldValue: e == null ? void 0 : e.slice(0, 2e3),
705
+ schema: {
706
+ mode: i,
707
+ ...(a = n == null ? void 0 : n.targetKeywords) != null && a.length ? { targetKeywords: n.targetKeywords } : {},
708
+ ...n != null && n.locale ? { locale: n.locale } : {}
709
+ },
710
+ customPrompt: t[i]
711
+ };
712
+ }
713
+ function oe(r, e) {
714
+ const n = (e == null ? void 0 : e.mode) ?? "tag", i = `"${r}"` + ((e == null ? void 0 : e.bpm) != null ? `, BPM: ${e.bpm}` : "") + (e != null && e.key ? `, Key: ${e.key}` : "") + (e != null && e.genre ? `, Genre: ${e.genre}` : "") + ((e == null ? void 0 : e.duration) != null ? `, Duration: ${e.duration}s` : ""), t = {
715
+ tag: `Audio: ${i}. Suggest genre tags, mood descriptors and playlist categories. Return as JSON array of strings.`,
716
+ bpm: `Audio: ${i}. Suggest likely BPM range and musical key based on metadata. Return as JSON: { bpm: number, key: string }.`,
717
+ mix: `Track: ${i}. Suggest EQ curve (JSON array of {freq, gain, q}), compression settings, and 2-3 compatible tracks for mixing.`,
718
+ transcribe: "Return a transcription of the spoken audio content as JSON: { transcript: string, language: string, confidence: number }."
719
+ };
720
+ return {
721
+ fieldLabel: `Audio: ${r}`,
722
+ fieldType: "audio",
723
+ schema: {
724
+ mode: n,
725
+ ...(e == null ? void 0 : e.bpm) != null ? { bpm: e.bpm } : {},
726
+ ...e != null && e.key ? { key: e.key } : {},
727
+ ...(e == null ? void 0 : e.duration) != null ? { duration: e.duration } : {},
728
+ ...e != null && e.genre ? { genre: e.genre } : {}
729
+ },
730
+ customPrompt: t[n]
731
+ };
732
+ }
733
+ function me(r, e) {
734
+ var a;
735
+ const n = (e == null ? void 0 : e.mode) ?? "material", i = (e == null ? void 0 : e.targetDevice) ?? "web", t = {
736
+ material: `Scene "${r}", ${(e == null ? void 0 : e.meshCount) ?? "?"} meshes. Materials: ${((a = e == null ? void 0 : e.materials) == null ? void 0 : a.join(", ")) || "none"}. Suggest PBR properties (roughness, metalness, baseColor) and texture maps for each material.`,
737
+ optimize: `Scene "${r}", triangles: ${(e == null ? void 0 : e.triangleCount) ?? "?"}, target: ${i}. Identify budget issues and suggest LOD levels, mesh merging, and texture atlas strategy.`,
738
+ lighting: `Scene "${r}", target: ${i}. Suggest a complete lighting setup (types, intensity, color, shadow settings) for realistic rendering.`,
739
+ animation: `Rig in scene "${r}". Suggest animation approach (FK/IK, bone count), keyframe timing and easing curves for natural movement.`
740
+ };
741
+ return {
742
+ fieldLabel: `3D scene: ${r}`,
743
+ fieldType: "3d-scene",
744
+ schema: {
745
+ mode: n,
746
+ ...(e == null ? void 0 : e.meshCount) != null ? { meshes: e.meshCount } : {},
747
+ ...(e == null ? void 0 : e.triangleCount) != null ? { triangles: e.triangleCount } : {},
748
+ ...e != null && e.targetDevice ? { target: e.targetDevice } : {}
749
+ },
750
+ customPrompt: t[n]
751
+ };
752
+ }
753
+ function ge(r, e) {
754
+ const n = (e == null ? void 0 : e.mode) ?? "palette", i = (e == null ? void 0 : e.width) != null ? `${e.width}×${e.height ?? "?"}px` : "unknown dimensions", t = {
755
+ filter: `Image "${r}" (${i}). Suggest CSS/SVG filter parameters (brightness, contrast, saturate, hue-rotate, blur) as JSON: { brightness, contrast, saturate, hueRotate, blur }.`,
756
+ palette: `Image "${r}". Extract or suggest a harmonious 5-color palette as JSON: { primary, secondary, accent, background, text }.`,
757
+ upscale: `Image "${r}" at ${i}. Recommend upscaling strategy: model (ESRGAN/RealSR/SRCNN), scale factor, and expected quality gain.`,
758
+ "style-transfer": `Image "${r}", target style: "${(e == null ? void 0 : e.targetStyle) ?? "artistic"}". Suggest style-transfer settings as JSON: { contentWeight, styleWeight, iterations, patchSize }.`
759
+ };
760
+ return {
761
+ fieldLabel: `Graphics: ${r}`,
762
+ fieldType: "graphics",
763
+ schema: {
764
+ mode: n,
765
+ ...(e == null ? void 0 : e.width) != null ? { width: e.width, height: e.height } : {},
766
+ ...e != null && e.targetStyle ? { targetStyle: e.targetStyle } : {}
767
+ },
768
+ customPrompt: t[n]
769
+ };
770
+ }
771
+ function fe(r, e) {
772
+ var n;
773
+ return {
774
+ fieldLabel: "Icon search",
775
+ fieldType: "icon-picker",
776
+ fieldValue: r,
777
+ schema: {
778
+ ...e != null && e.style ? { iconStyle: e.style } : {},
779
+ ...(e == null ? void 0 : e.limit) != null ? { maxResults: e.limit } : {},
780
+ ...(n = e == null ? void 0 : e.availableIcons) != null && n.length ? { sampleIcons: e.availableIcons.slice(0, 30) } : {}
781
+ },
782
+ customPrompt: `User query: "${r}"
783
+ Return the ${(e == null ? void 0 : e.limit) ?? 5} most semantically relevant icon names from the available set as a JSON array of strings, ordered by relevance. Prefer specific over generic names.`
784
+ };
785
+ }
786
+ function Ae(r, e, n) {
787
+ const i = s(
788
+ () => de(r, e, n),
789
+ // eslint-disable-next-line react-hooks/exhaustive-deps
790
+ [r, e, n == null ? void 0 : n.cursorLine, n == null ? void 0 : n.cursorCol, n == null ? void 0 : n.framework]
791
+ );
792
+ return g(i, n);
793
+ }
794
+ function Oe(r, e, n) {
795
+ const i = s(
796
+ () => se(r, e, n),
797
+ // eslint-disable-next-line react-hooks/exhaustive-deps
798
+ [r, e, n == null ? void 0 : n.mode, n == null ? void 0 : n.locale]
799
+ );
800
+ return g(i, n);
801
+ }
802
+ function Me(r, e) {
803
+ const n = s(
804
+ () => oe(r, e),
805
+ // eslint-disable-next-line react-hooks/exhaustive-deps
806
+ [r, e == null ? void 0 : e.bpm, e == null ? void 0 : e.key, e == null ? void 0 : e.duration, e == null ? void 0 : e.mode]
807
+ );
808
+ return g(n, e);
809
+ }
810
+ function Je(r, e) {
811
+ const n = s(
812
+ () => me(r, e),
813
+ // eslint-disable-next-line react-hooks/exhaustive-deps
814
+ [r, e == null ? void 0 : e.meshCount, e == null ? void 0 : e.triangleCount, e == null ? void 0 : e.targetDevice, e == null ? void 0 : e.mode]
815
+ );
816
+ return g(n, e);
817
+ }
818
+ function Ee(r, e) {
819
+ const n = s(
820
+ () => ge(r, e),
821
+ // eslint-disable-next-line react-hooks/exhaustive-deps
822
+ [r, e == null ? void 0 : e.width, e == null ? void 0 : e.height, e == null ? void 0 : e.mode, e == null ? void 0 : e.targetStyle]
823
+ );
824
+ return g(n, e);
825
+ }
826
+ function De(r, e) {
827
+ const n = s(
828
+ () => fe(r, e),
829
+ // eslint-disable-next-line react-hooks/exhaustive-deps
830
+ [r, e == null ? void 0 : e.limit, e == null ? void 0 : e.style]
831
+ );
832
+ return g(n, { ...e, disabled: !r || (e == null ? void 0 : e.disabled) });
833
+ }
834
+ function he(r, e) {
835
+ var a;
836
+ const n = (e == null ? void 0 : e.mode) ?? "npc-decision", i = (e == null ? void 0 : e.genre) ?? "fantasy", t = {
837
+ "npc-decision": `You are an AI game director. The NPC "${r}" must make a decision. Available BT nodes: ${JSON.stringify((e == null ? void 0 : e.btStatus) ?? [])}. Game state: ${JSON.stringify((e == null ? void 0 : e.gameState) ?? {})}. Return the name of the BT node to activate next, and one sentence of reasoning.`,
838
+ dialogue: `You are a ${i} RPG writer. Write a short in-character dialogue line for NPC "${r}". Game state: ${JSON.stringify((e == null ? void 0 : e.gameState) ?? {})}. Max 2 sentences, no narrative descriptions.`,
839
+ "procedural-level": `You are a ${i} game designer. Suggest a procedural level layout for a zone containing "${r}". Describe room count, enemy placement, loot, and one unique mechanic. Keep it under 150 words.`,
840
+ "quest-description": `You are a ${i} quest designer. Write a compelling quest description involving "${r}". Include: objective, giver NPC, rewards, and a short flavour paragraph. Keep it under 120 words.`,
841
+ "item-description": `You are a ${i} lore writer. Write a short item description for an item related to "${r}". Include: item name, rarity, flavour text, and one special property. Keep it under 80 words.`
842
+ };
843
+ return {
844
+ fieldLabel: r,
845
+ fieldType: `game-engine:${n}`,
846
+ fieldValue: e == null ? void 0 : e.gameState,
847
+ customPrompt: t[n],
848
+ schema: {
849
+ genre: i,
850
+ mode: n,
851
+ btNodes: (a = e == null ? void 0 : e.btStatus) == null ? void 0 : a.map((u) => u.node)
852
+ }
853
+ };
854
+ }
855
+ function ze(r, e) {
856
+ const n = s(
857
+ () => he(r, e),
858
+ // eslint-disable-next-line react-hooks/exhaustive-deps
859
+ [r, e == null ? void 0 : e.mode, e == null ? void 0 : e.genre, JSON.stringify(e == null ? void 0 : e.btStatus), JSON.stringify(e == null ? void 0 : e.gameState)]
860
+ );
861
+ return g(n, e);
862
+ }
863
+ function ye(r, e, n) {
864
+ const i = (n == null ? void 0 : n.mode) ?? "layout", t = (n == null ? void 0 : n.diagramType) ?? "flowchart", a = {
865
+ layout: `You are a diagram layout optimizer. Given this ${t} with ${r.length} nodes and ${e.length} edges, suggest optimal positions for each node to minimize edge crossings and improve readability. Return JSON: { suggestions: [{ id: string, x: number, y: number, reason: string }] }. Consider flow direction (top-to-bottom or left-to-right) and grouping related nodes.`,
866
+ structure: `You are a diagram analyst. Analyze this ${t} structure. Identify: 1) Missing connections, 2) Potential bottlenecks, 3) Orphan nodes, 4) Cycles or loops. Return JSON: { issues: [{ type: string, description: string, nodeIds: string[] }], score: number }`,
867
+ simplify: `You are a diagram simplifier. Suggest how to simplify this ${t} while preserving meaning. Identify: nodes that could be merged, redundant edges, or overly complex branches. Return JSON: { simplifications: [{ action: 'merge'|'remove'|'group', ids: string[], reason: string }] }`,
868
+ group: `You are a diagram organizer. Suggest logical groupings for nodes in this ${t}. Consider semantic relationships, data flow patterns, and visual clustering. Return JSON: { groups: [{ name: string, nodeIds: string[], color?: string }] }`
869
+ }, u = r.map((d) => {
870
+ var o;
871
+ return {
872
+ id: d.id,
873
+ type: d.type,
874
+ label: (o = d.label) == null ? void 0 : o.slice(0, 30),
875
+ pos: [Math.round(d.x), Math.round(d.y)]
876
+ };
877
+ }), w = e.map((d) => ({
878
+ id: d.id,
879
+ src: d.source,
880
+ tgt: d.target
881
+ }));
882
+ return {
883
+ fieldLabel: `Diagram (${t})`,
884
+ fieldType: `diagram:${i}`,
885
+ fieldValue: JSON.stringify({ nodes: u, edges: w }),
886
+ schema: {
887
+ diagramType: t,
888
+ mode: i,
889
+ nodeCount: r.length,
890
+ edgeCount: e.length,
891
+ containerSize: n == null ? void 0 : n.containerSize
892
+ },
893
+ customPrompt: a[i]
894
+ };
895
+ }
896
+ function He(r, e, n) {
897
+ const i = s(
898
+ () => ye(r, e, n),
899
+ // eslint-disable-next-line react-hooks/exhaustive-deps
900
+ [JSON.stringify(r), JSON.stringify(e), n == null ? void 0 : n.mode, n == null ? void 0 : n.diagramType]
901
+ );
902
+ return g(i, { ...n, disabled: r.length === 0 || (n == null ? void 0 : n.disabled) });
903
+ }
904
+ function be(r, e) {
905
+ const n = (e == null ? void 0 : e.mode) ?? "generate", i = (e == null ? void 0 : e.presentationType) ?? "business", t = (e == null ? void 0 : e.duration) ?? 15, a = Math.ceil(t / 2), u = {
906
+ generate: `You are a presentation designer. Create a ${i} presentation outline based on: "${r}". Target audience: ${(e == null ? void 0 : e.audience) ?? "general"}. Duration: ${t} minutes (~${a} slides). Return JSON: { title: string, slides: [{ title: string, layout: 'title'|'content'|'two-column'|'chart'|'image', bullets?: string[], chartType?: string, speakerNotes?: string }] }. Include: clear slide titles, 3-5 bullet points per content slide, and brief speaker notes.`,
907
+ summarize: `You are a presentation optimizer. Summarize this presentation to be more concise: "${r}". Reduce slide count by 30% while preserving key messages. Return JSON: { summary: string, reducedSlides: [{ title: string, keyPoints: string[] }] }`,
908
+ expand: `You are a presentation expert. Expand this brief outline into a detailed presentation: "${r}". Add supporting details, examples, and transitions. Target: ${a} slides. Return JSON: { slides: [{ title: string, content: string, transitions?: string, animations?: string[] }] }`,
909
+ improve: `You are a presentation coach. Review and improve this presentation structure: "${r}". Suggest: better flow, stronger opening/closing, clearer data visualization. Return JSON: { improvements: [{ slide: number, issue: string, suggestion: string }], score: number }`
910
+ };
911
+ return {
912
+ fieldLabel: `Presentation (${i})`,
913
+ fieldType: `presentation:${n}`,
914
+ fieldValue: r,
915
+ schema: {
916
+ presentationType: i,
917
+ mode: n,
918
+ duration: t,
919
+ slideCount: a,
920
+ audience: e == null ? void 0 : e.audience,
921
+ hasData: (e == null ? void 0 : e.dataContext) != null
922
+ },
923
+ customPrompt: u[n]
924
+ };
925
+ }
926
+ function Ve(r, e) {
927
+ const n = s(
928
+ () => be(r, e),
929
+ // eslint-disable-next-line react-hooks/exhaustive-deps
930
+ [r, e == null ? void 0 : e.mode, e == null ? void 0 : e.presentationType, e == null ? void 0 : e.duration, e == null ? void 0 : e.audience]
931
+ );
932
+ return g(n, { ...e, disabled: !r || (e == null ? void 0 : e.disabled) });
933
+ }
934
+ function xe(r, e) {
935
+ var t;
936
+ const n = (e == null ? void 0 : e.mode) ?? "all", i = {
937
+ alignment: "Analyze element alignment on this slide. Suggest adjustments to create visual harmony. Return JSON: { suggestions: [{ elementIndex: number, issue: string, fixX?: number, fixY?: number }] }",
938
+ contrast: "Analyze color contrast and readability. Suggest improvements for accessibility (WCAG AA). Return JSON: { suggestions: [{ area: string, currentContrast: number, suggestedFix: string }] }",
939
+ spacing: "Analyze whitespace and element spacing. Apply the rule of thirds and consistent margins. Return JSON: { suggestions: [{ elementIndex: number, issue: string, suggestedMargin: number }] }",
940
+ typography: "Analyze typography: hierarchy, font sizes, line heights, readability. Return JSON: { suggestions: [{ area: string, issue: string, suggestedFontSize?: number }] }",
941
+ all: "Perform a complete design review of this slide. Check alignment, contrast, spacing, and typography. Return JSON: { score: number, suggestions: [{ category: string, issue: string, fix: string }] }. Prioritize issues by impact on visual clarity."
942
+ };
943
+ return {
944
+ fieldLabel: r.title ?? "Slide Design",
945
+ fieldType: `slide-design:${n}`,
946
+ fieldValue: JSON.stringify(r),
947
+ schema: {
948
+ mode: n,
949
+ hasElements: (((t = r.elements) == null ? void 0 : t.length) ?? 0) > 0,
950
+ layout: r.layout,
951
+ brandColors: e == null ? void 0 : e.brandColors
952
+ },
953
+ customPrompt: i[n]
954
+ };
955
+ }
956
+ function qe(r, e) {
957
+ const n = s(
958
+ () => xe(r, e),
959
+ // eslint-disable-next-line react-hooks/exhaustive-deps
960
+ [JSON.stringify(r), e == null ? void 0 : e.mode, JSON.stringify(e == null ? void 0 : e.brandColors)]
961
+ );
962
+ return g(n, e);
963
+ }
964
+ function We(r, e, n) {
965
+ const i = j((t, a) => {
966
+ const {
967
+ aiEnabled: u = !0,
968
+ aiPosition: w = "right",
969
+ aiPrompt: d,
970
+ aiDebounceMs: o = 500,
971
+ aiShowOnHover: y = !1,
972
+ aiTriggerIcon: T,
973
+ ...m
974
+ } = t, S = s(() => {
975
+ const C = e(m);
976
+ return d && (C.customPrompt = d), C;
977
+ }, [m, d]);
978
+ return /* @__PURE__ */ R("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
979
+ /* @__PURE__ */ x(r, { ...m, ref: a }),
980
+ u && /* @__PURE__ */ x(
981
+ G,
982
+ {
983
+ context: S,
984
+ position: w,
985
+ debounceMs: o,
986
+ showOnHover: y,
987
+ triggerIcon: T
988
+ }
989
+ )
990
+ ] });
991
+ });
992
+ return i.displayName = n ?? `withAIHint(${r.displayName ?? r.name ?? "Component"})`, i;
993
+ }
994
+ function je(r) {
995
+ return F(
996
+ r.label ?? "Text",
997
+ r.value,
998
+ { placeholder: r.placeholder, maxLength: r.maxLength }
999
+ );
1000
+ }
1001
+ function Be(r) {
1002
+ return K(
1003
+ r.label ?? "Number",
1004
+ r.value,
1005
+ { min: r.min, max: r.max, step: r.step }
1006
+ );
1007
+ }
1008
+ function Ye(r) {
1009
+ return _(
1010
+ r.label ?? "Select",
1011
+ r.value,
1012
+ { options: r.options, multiple: r.multiple }
1013
+ );
1014
+ }
1015
+ function Ge(r) {
1016
+ return X(
1017
+ r.label ?? "Date",
1018
+ r.value,
1019
+ { min: r.min, max: r.max }
1020
+ );
1021
+ }
1022
+ function Fe(r) {
1023
+ return U(
1024
+ r.label ?? "Color",
1025
+ r.value
1026
+ );
1027
+ }
1028
+ export {
1029
+ G as NiceAIHintBubble,
1030
+ ke as NiceAIProvider,
1031
+ ee as RateLimiter,
1032
+ me as build3DSceneContext,
1033
+ oe as buildAudioContext,
1034
+ we as buildChartContext,
1035
+ de as buildCodeEditorContext,
1036
+ U as buildColorPickerContext,
1037
+ ve as buildDataGridContext,
1038
+ X as buildDatePickerContext,
1039
+ ye as buildDiagramLayoutContext,
1040
+ ue as buildFormFillContext,
1041
+ he as buildGameEngineContext,
1042
+ ge as buildGraphicsContext,
1043
+ se as buildHtmlEditorContext,
1044
+ fe as buildIconSearchContext,
1045
+ K as buildNumberInputContext,
1046
+ be as buildPresentationGenerateContext,
1047
+ _ as buildSelectContext,
1048
+ xe as buildSlideDesignContext,
1049
+ F as buildTextInputContext,
1050
+ ce as buildValidationContext,
1051
+ Fe as colorControlContext,
1052
+ Ge as dateControlContext,
1053
+ Be as numberControlContext,
1054
+ re as parseJSONResponse,
1055
+ ne as parseSSEStream,
1056
+ Ye as selectControlContext,
1057
+ je as textControlContext,
1058
+ Je as useAI3DHint,
1059
+ Me as useAIAudioHint,
1060
+ Ae as useAICodeHint,
1061
+ Re as useAIColorHint,
1062
+ Y as useAIContext,
1063
+ Le as useAIDateHint,
1064
+ He as useAIDiagramLayout,
1065
+ Ne as useAIFormFill,
1066
+ Ee as useAIGraphicsHint,
1067
+ Oe as useAIHtmlHint,
1068
+ De as useAIIconSearch,
1069
+ ze as useAINpcHint,
1070
+ $e as useAINumberHint,
1071
+ Ve as useAIPresentationGenerate,
1072
+ Pe as useAISelectHint,
1073
+ qe as useAISlideDesign,
1074
+ Te as useAITextHint,
1075
+ Ie as useAIValidation,
1076
+ g as useNiceAIHint,
1077
+ We as withAIHint
1078
+ };