@aintela/chat 0.4.16 → 0.4.17
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/components.js +4738 -4727
- package/dist/components.js.map +1 -1
- package/dist/hooks.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/components/v2/TriggerDropdown.d.ts +6 -3
- package/dist/src/hooks/usePromptAssist.d.ts +1 -0
- package/dist/{useContainerWidth-35EL99CW.js → useContainerWidth-BYogfTRE.js} +139 -136
- package/dist/useContainerWidth-BYogfTRE.js.map +1 -0
- package/package.json +1 -1
- package/dist/useContainerWidth-35EL99CW.js.map +0 -1
package/dist/hooks.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { A as Y, a as Q, E as $, H as ee, I as ae, L as te, W as se } from "./ht
|
|
|
7
7
|
import { A as oe } from "./artifactHtmlHandler-CMQJf1cX.js";
|
|
8
8
|
import { H as ie, d as ce, r as le } from "./httpSessionService-B3CxFtl1.js";
|
|
9
9
|
import { APPBAR_HEIGHT as pe, APPBAR_HEIGHT as ge, ASK_USER_CANCELLED as Se, AgentActivity as Ce, AgentActivity as Ie, AiChat as he, AiChatDrawer as de, AiChatFloating as Pe, AiChatFloating as ue, AiChatPane as Ee, AiChatProvider as ve, AiChatServiceContext as Te, AiChatPane as me, AppBar as Le, AppBar as Re, AppRail as xe, AppRail as Me, AppShell as ye, AppShell as fe, ArtifactRender as De, AskUserDialog as Ue, AskUserSheet as _e, AttachmentPreviewModal as ke, BoxedPart as Be, BrainIcon as Ve, ChartIcon as be, ChatIcon as Fe, ChatPane as He, ChatsHistory as Ne, ChatsHistory as we, CheckIcon as Ge, ChevronIcon as Oe, ChevronRightIcon as We, CloseIcon as ze, CodeIcon as Je, ComposerIcon as Ke, CurrentMessage as je, DEFAULT_PART_RENDERERS as qe, DashboardIcon as Xe, DataExplorerIcon as Ze, DelayTextComponent as Ye, EnvironmentProvider as Qe, FileIcon as $e, FunctionPart as ea, GlobeIcon as aa, HistoryIcon as ta, IDLE_TIMEOUT as sa, InertEnvironmentProvider as na, JsxErrorBoundary as oa, LIVE_TSX_DEFAULT_MAX_CHARS_FOR_FULL as ra, LastPrompts as ia, LastPrompts as ca, LinearBackgroundProgress as la, LinearProgressBarWithMarkers as Aa, ListCheckIcon as pa, LiveJsxBlock as ga, LiveTsxConfigProvider as Sa, LlmResponseRender as Ca, LoadingDots as Ia, LockClosedIcon as ha, LockOpenIcon as da, MOBILE_NAV_DEFAULT as Pa, MarkdownExtended as ua, MentionPickerPanel as Ea, MenuIcon as va, Message as Ta, MobileDrawer as ma, MobileDrawer as La, PanelIcon as Ra, PaperclipIcon as xa, PauseIcon as Ma, PenIcon as ya, PinIcon as fa, PlusIcon as Da, Prompt as Ua, PromptDateMarkers as _a, PromptGhostHint as ka, Prompt as Ba, RotateIcon as Va, RunProgressPanel as ba, RunProgressPanel as Fa, RunProgressStrip as Ha, RunProgressStrip as Na, SearchIcon as wa, SendIcon as Ga, SessionStateManagerService as Oa, SessionUsage as Wa, SessionUsage as za, SparkleIcon as Ja, Sparkline as Ka, StopIcon as ja, Stopwatch as qa, SubAgentBox as Xa, SubAgentBox as Za, SuspendedPart as Ya, TableIcon as Qa, TaskList as $a, TaskList as et, TerminalIcon as at, TextPart as tt, ThoughtPart as st, ToolIcon as nt, TrashIcon as ot, TriggerDropdown as rt, TurnAwareButton as it, UiToolDispatcher as ct, UndoIcon as lt, UsersIcon as At, V2_CHART_PALETTE as pt, WARNING_THRESHOLD as gt, WaitingPart as St, ZoomInIcon as Ct, ZoomOutIcon as It, classifyPart as ht, configureFriendlyMapping as dt, createAiChatEngine as Pt, createAiChatSessionStore as ut, createAiChatSessionStore as Et, createUiToolRegistry as vt, disposeSharedAiChatEngine as Tt, engineKeyFor as mt, extendDefaultScope as Lt, extendModuleRegistry as Rt, getDefaultJsxScope as xt, getFriendlyLabel as Mt, getSharedAiChatEngine as yt, parseClientOutput as ft, parseContentBlocks as Dt, parseUiArgs as Ut, useAgentEngine as _t, useAiChatServices as kt, useAiChatSessionStore as Bt, useCoarsePointer as Vt, useEnvironment as bt, useEnvironmentOptional as Ft, useLiveTsxMaxCharsForFull as Ht, useParkedAskUser as Nt, useResponsiveLayout as wt, useTurnOpen as Gt, useVisualViewport as Ot, v2Card as Wt, v2Chip as zt, v2IconBtn as Jt, v2MonoMeta as Kt, v2SectionLabel as jt, v2Theme as qt } from "./components.js";
|
|
10
|
-
import { u as Zt, a as Yt, b as Qt } from "./useContainerWidth-
|
|
10
|
+
import { u as Zt, a as Yt, b as Qt } from "./useContainerWidth-BYogfTRE.js";
|
|
11
11
|
import { A as es, D as as, g as ts, b as ss, c as ns, d as os, e as rs, f as is, i as cs, r as ls } from "./environmentUtils-VZNTCzEE.js";
|
|
12
12
|
import { ALLOWED_DOMAINS as ps, ALLOWED_EMAILS as gs, AUTH_CONFIG as Ss, GOOGLE_CLIENT_ID as Cs, getAgentBaseUrl as Is, getArtifactsBaseUrl as hs, getDotNetBaseUrl as ds, getIconByName as Ps, iconCategories as us, materialIcons as Es, searchIcons as vs, setEbiContextData as Ts, setEbiContextSessionId as ms } from "./utils.js";
|
|
13
13
|
import { S as Rs, a as xs, b as Ms, c as ys, d as fs, e as Ds, f as Us, g as _s, h as ks, i as Bs, j as Vs, k as bs, l as Fs, p as Hs, m as Ns, s as ws, o as Gs, q as Os, t as Ws, r as zs } from "./predictionRows-CkZdmdsi.js";
|
|
@@ -32,8 +32,11 @@ export interface TriggerDropdownProps<T extends DropdownItem = DropdownItem> {
|
|
|
32
32
|
touch?: boolean;
|
|
33
33
|
/** Shown in place of the list when there is nothing to offer and nothing in flight. Omit to render nothing. */
|
|
34
34
|
emptyLabel?: string;
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/** Name the keys in the header ("↑↓ navegar · ↵ escolher"). Ignored on touch — there are no keys to name. */
|
|
36
|
+
keyHints?: boolean;
|
|
37
|
+
/** What the list is filtering on right now, shown in the header as the user typed it ("@mar", "flori"). The
|
|
38
|
+
* header only appears when there is an echo or a key legend to put in it. */
|
|
39
|
+
queryEcho?: string;
|
|
37
40
|
/** A line UNDER the rows, in the composer's own size, inviting more typing ("…ou continue digitando"). */
|
|
38
41
|
trailingNote?: string;
|
|
39
42
|
/** Layout overrides for the container — the docked panel uses this to fill its host box. */
|
|
@@ -54,4 +57,4 @@ export interface TriggerDropdownProps<T extends DropdownItem = DropdownItem> {
|
|
|
54
57
|
* the browser fires `pointercancel` the moment it claims the gesture for scrolling, which is the authoritative
|
|
55
58
|
* "this was a scroll, not a tap" signal. The slop check is a belt-and-braces for a shaky finger.
|
|
56
59
|
*/
|
|
57
|
-
export declare function TriggerDropdown<T extends DropdownItem = DropdownItem>({ items, highlight, onHighlight, onSelect, loading, personLabel, locationLabel, hotelLabel, touch, emptyLabel,
|
|
60
|
+
export declare function TriggerDropdown<T extends DropdownItem = DropdownItem>({ items, highlight, onHighlight, onSelect, loading, personLabel, locationLabel, hotelLabel, touch, emptyLabel, keyHints, queryEcho, trailingNote, sx, }: TriggerDropdownProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -103,6 +103,7 @@ export interface PromptAssistOptions {
|
|
|
103
103
|
export declare function usePromptAssist(adapter: PromptAssistAdapter, fetchers: PromptAssistFetchers, options?: PromptAssistOptions): {
|
|
104
104
|
predictions: PredictionItem[] | null;
|
|
105
105
|
predictionsRecents: boolean;
|
|
106
|
+
predictionQuery: string;
|
|
106
107
|
predictionHighlight: number;
|
|
107
108
|
setPredictionHighlight: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
108
109
|
applyPrediction: (p: PredictionItem) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var we = Object.defineProperty;
|
|
2
|
+
var y = (r, v) => we(r, "name", { value: v, configurable: !0 });
|
|
3
3
|
import { useState as f, useRef as o, useCallback as S, useEffect as ct } from "react";
|
|
4
|
-
const
|
|
4
|
+
const Kt = /* @__PURE__ */ y((r) => r.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), "foldForCompare"), zt = /* @__PURE__ */ y((r) => r.vertical ?? (Wt(r) ? "hotel" : "air"), "verticalOf"), Wt = /* @__PURE__ */ y((r) => r.placesExpected ?? r.hotelExpected ?? !1, "lodgingOf"), Mt = /* @__PURE__ */ y((r) => r.placesConfidence ?? r.hotelConfidence ?? 0, "lodgingScoreOf"), $e = /* @__PURE__ */ y((r) => r === "hotel" ? "Hotéis e locais" : r === "air" ? "Aeroportos" : void 0, "sectionLabel"), be = "Data", Gt = "Localização", wt = /* @__PURE__ */ y(() => ({
|
|
5
5
|
maxLocationConfidence: 0,
|
|
6
6
|
maxPersonConfidence: 0,
|
|
7
7
|
maxHotelConfidence: 0,
|
|
@@ -12,29 +12,31 @@ const Ft = /* @__PURE__ */ C((r) => r.normalize("NFD").replace(/[\u0300-\u036f]/
|
|
|
12
12
|
atOpened: !1,
|
|
13
13
|
atAccepted: null,
|
|
14
14
|
manualAt: !1
|
|
15
|
-
}), "emptyOutcome"),
|
|
15
|
+
}), "emptyOutcome"), Ut = /* @__PURE__ */ y(() => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `s-${Date.now()}-${Math.random()}`, "newSessionId"), _t = /* @__PURE__ */ y((r, v, T) => {
|
|
16
16
|
var s;
|
|
17
17
|
const b = r.length;
|
|
18
|
-
let l =
|
|
19
|
-
for (let
|
|
18
|
+
let l = v;
|
|
19
|
+
for (let k = 0; k < b; k++)
|
|
20
20
|
if (l = (l + T + b) % b, !((s = r[l]) != null && s.disabled)) return l;
|
|
21
|
-
return
|
|
21
|
+
return v;
|
|
22
22
|
}, "nextEnabledIndex");
|
|
23
|
-
function
|
|
24
|
-
const { debugGhostKey: b } = T, [l, s] = f(null), [
|
|
23
|
+
function Ee(r, v, T = {}) {
|
|
24
|
+
const { debugGhostKey: b } = T, [l, s] = f(null), [k, E] = f(null), [L, M] = f(!1), [st, G] = f(0), [Bt, Qt] = f(0), [jt, Vt] = f(!1), [Xt, Zt] = f("air"), [Jt, Yt] = f(0), [te, ee] = f(!1), [ne, re] = f(0), [oe, it] = f(!1), [ce, lt] = f(""), [at, K] = f(0), [se, $t] = f([]), [ie, bt] = f([]), [le, ut] = f(""), Y = o(""), U = o(null), _ = o(r);
|
|
25
25
|
_.current = r;
|
|
26
|
-
const z = o(
|
|
27
|
-
z.current =
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const W = o(null), B = o(null),
|
|
31
|
-
|
|
26
|
+
const z = o(v);
|
|
27
|
+
z.current = v;
|
|
28
|
+
const dt = o(T);
|
|
29
|
+
dt.current = T;
|
|
30
|
+
const W = o(null), B = o(null), Tt = o(0), At = o(0), ft = o(null), tt = o(""), Q = o(null), ht = o(null), gt = o(Ut()), j = o(null);
|
|
31
|
+
j.current = l;
|
|
32
32
|
const V = o(null);
|
|
33
|
-
V.current =
|
|
34
|
-
const X = o(0), et = o(null), Z = o(!1),
|
|
35
|
-
}), I = o(
|
|
36
|
-
|
|
37
|
-
}, []),
|
|
33
|
+
V.current = k;
|
|
34
|
+
const X = o(0), et = o(null), Z = o(!1), ae = 8, ue = 0.5, J = o(null), St = o(""), Et = o(() => {
|
|
35
|
+
}), I = o(wt()), O = o(!1), de = S(() => {
|
|
36
|
+
s(null), lt("");
|
|
37
|
+
}, []), fe = S(() => {
|
|
38
|
+
$t([]), bt([]), ut(""), Y.current = "", Q.current = null, gt.current = Ut(), I.current = wt(), O.current = !1, X.current = 0, et.current = null, Z.current = !1, E(null);
|
|
39
|
+
}, []), pt = S((t) => {
|
|
38
40
|
if (t.disabled) return;
|
|
39
41
|
I.current.suggestionAccepted = !0, t.kind === "location" && (O.current = !0), s(null);
|
|
40
42
|
const n = _.current, i = n.getTextarea();
|
|
@@ -42,16 +44,16 @@ function Ae(r, x, T = {}) {
|
|
|
42
44
|
const p = i.selectionStart ?? i.value.length, h = i.value.slice(0, p), D = i.value.slice(p), q = t.kind === "namedLocation" || t.kind === "location";
|
|
43
45
|
let e;
|
|
44
46
|
if (q) {
|
|
45
|
-
const d =
|
|
47
|
+
const d = St.current, g = h.replace(/\s+$/, "");
|
|
46
48
|
e = d && g.endsWith(d) ? g.slice(0, g.length - d.length) : h;
|
|
47
49
|
} else {
|
|
48
50
|
const d = h.search(/\S+$/), g = d === -1 ? "" : h.slice(d);
|
|
49
|
-
e = g.length > 0 && (t.kind === "date" && t.insert ?
|
|
51
|
+
e = g.length > 0 && (t.kind === "date" && t.insert ? Kt(t.insert).startsWith(Kt(g)) : /^[\d./-]+$/.test(g)) ? h.slice(0, d) : h;
|
|
50
52
|
}
|
|
51
53
|
const a = e.length > 0 && !/\s$/.test(e);
|
|
52
54
|
if (t.kind === "date") {
|
|
53
55
|
const d = `${a ? " " : ""}${t.insert} `, g = `${e}${d}${D}`;
|
|
54
|
-
n.setDraft(g), n.focusCaret(e.length + d.length), tt.current = g,
|
|
56
|
+
n.setDraft(g), n.focusCaret(e.length + d.length), tt.current = g, Q.current = null, Et.current();
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
59
|
if (t.kind === "namedLocation" && t.insert) {
|
|
@@ -64,53 +66,53 @@ function Ae(r, x, T = {}) {
|
|
|
64
66
|
const d = n.getTextarea();
|
|
65
67
|
d && n.syncTrigger(d);
|
|
66
68
|
});
|
|
67
|
-
}, []),
|
|
69
|
+
}, []), mt = S(async () => {
|
|
68
70
|
var h;
|
|
69
71
|
const t = z.current.resolveDates;
|
|
70
72
|
if (!t) return;
|
|
71
73
|
const n = tt.current;
|
|
72
74
|
if (n.trim() === "") {
|
|
73
|
-
|
|
75
|
+
Q.current = null;
|
|
74
76
|
return;
|
|
75
77
|
}
|
|
76
|
-
if (n ===
|
|
77
|
-
|
|
78
|
+
if (n === Q.current || n.split(" ").length <= 2) return;
|
|
79
|
+
Q.current = n, (h = ht.current) == null || h.abort();
|
|
78
80
|
const p = new AbortController();
|
|
79
|
-
|
|
81
|
+
ht.current = p;
|
|
80
82
|
try {
|
|
81
|
-
const { dates: D, locations: q } = await t(n,
|
|
83
|
+
const { dates: D, locations: q } = await t(n, gt.current, p.signal);
|
|
82
84
|
if (tt.current !== n) return;
|
|
83
85
|
const e = D.filter((u) => u.display).map((u) => ({ text: u.text, display: u.display }));
|
|
84
|
-
|
|
86
|
+
bt(e), $t(q.map((u) => u.text).filter((u) => u.trim().length > 0));
|
|
85
87
|
const a = e.map((u) => `${u.text}=${u.display}`).join("|");
|
|
86
|
-
e.length > 0 && a !== Y.current && (Y.current = a,
|
|
88
|
+
e.length > 0 && a !== Y.current && (Y.current = a, ut(e[e.length - 1].text), U.current != null && window.clearTimeout(U.current), U.current = window.setTimeout(() => ut(""), 2e3)), e.length === 0 && (Y.current = "");
|
|
87
89
|
} catch {
|
|
88
90
|
}
|
|
89
91
|
}, []);
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
if (tt.current = t, V.current !== null && (X.current += 1, X.current >=
|
|
92
|
+
Et.current = mt;
|
|
93
|
+
const he = S((t, n, i) => {
|
|
94
|
+
if (tt.current = t, V.current !== null && (X.current += 1, X.current >= ae && (Z.current = !0, E(null))), t.split(" ").length <= 2) return;
|
|
93
95
|
const h = z.current.analyze;
|
|
94
|
-
h && (!i ||
|
|
96
|
+
h && (!i || j.current !== null || V.current !== null) && (W.current != null && window.clearTimeout(W.current), W.current = window.setTimeout(async () => {
|
|
95
97
|
var q;
|
|
96
|
-
const D = ++
|
|
98
|
+
const D = ++Tt.current;
|
|
97
99
|
try {
|
|
98
100
|
const e = await h(t, n);
|
|
99
|
-
if (D !==
|
|
101
|
+
if (D !== Tt.current) return;
|
|
100
102
|
const a = _.current, u = a.getTextarea();
|
|
101
103
|
if (!u || u.value !== t) return;
|
|
102
|
-
|
|
104
|
+
Qt(e.personConfidence ?? 0), G(e.locationConfidence ?? 0), Vt(Wt(e)), Zt(zt(e)), Yt(Mt(e)), ee(e.hotelNameExpected ?? !1), re(e.hotelNameConfidence ?? 0);
|
|
103
105
|
const w = I.current;
|
|
104
|
-
w.maxPersonConfidence = Math.max(w.maxPersonConfidence, e.personConfidence ?? 0), w.maxLocationConfidence = Math.max(w.maxLocationConfidence, e.locationConfidence ?? 0), w.maxHotelConfidence = Math.max(w.maxHotelConfidence ?? 0,
|
|
105
|
-
const d = u.selectionStart ?? n, g = d === t.length, Ct = t.slice(0, d),
|
|
106
|
+
w.maxPersonConfidence = Math.max(w.maxPersonConfidence, e.personConfidence ?? 0), w.maxLocationConfidence = Math.max(w.maxLocationConfidence, e.locationConfidence ?? 0), w.maxHotelConfidence = Math.max(w.maxHotelConfidence ?? 0, Mt(e)), E(null);
|
|
107
|
+
const d = u.selectionStart ?? n, g = d === t.length, Ct = t.slice(0, d), Ce = t.slice(d), Dt = !g && /\s$/.test(Ct) && !/^\s*@/.test(Ce), xt = g || Dt, vt = a.hasAtQuery, Pt = a.isPickerOpen(), Ht = e.suggestions ?? [], { enableHashDatePicker: kt = !1, datePresets: xe = ["amanhã de manhã", "quarta-feira à noite"] } = dt.current;
|
|
106
108
|
let $ = e.category === "location" ? "location" : e.category === "date" ? "date" : e.locationExpected ? "location" : e.dateExpected ? "date" : null;
|
|
107
|
-
$ !== "location" && e.locationCount < 2 && z.current.suggest &&
|
|
108
|
-
const
|
|
109
|
-
let A =
|
|
110
|
-
if (A && e.locationCount >= 2 && e.locationPartialEmpty && (A = !1, $ = "date"),
|
|
111
|
-
const c = e.personConfidence ?? 0,
|
|
109
|
+
$ !== "location" && e.locationCount < 2 && z.current.suggest && j.current !== null && J.current === "location" && xt && /\s$/.test(Ct) && ($ = "location");
|
|
110
|
+
const It = e.secondary ?? "";
|
|
111
|
+
let A = kt && vt && ($ === "location" && It === "date" || $ === "date" && It === "location");
|
|
112
|
+
if (A && e.locationCount >= 2 && e.locationPartialEmpty && (A = !1, $ = "date"), dt.current.promptHint && xt && !Pt) {
|
|
113
|
+
const c = e.personConfidence ?? 0, C = e.locationConfidence ?? 0, P = $ === "location" && !A && !(e.locationCount >= 2 && e.locationPartialEmpty), x = $ === "date" && !A && kt, H = c >= ue && c >= C && !x ? "person" : x ? "date" : P ? "location" : null;
|
|
112
114
|
if (H) {
|
|
113
|
-
Z.current || (et.current = H, M(
|
|
115
|
+
Z.current || (et.current = H, M(Dt), E(H), w.ghostShown = !0, H === "location" && (w.locationGateFired = !0)), s(null), J.current = null;
|
|
114
116
|
return;
|
|
115
117
|
}
|
|
116
118
|
et.current = null;
|
|
@@ -119,40 +121,40 @@ function Ae(r, x, T = {}) {
|
|
|
119
121
|
s(null), J.current = null;
|
|
120
122
|
return;
|
|
121
123
|
}
|
|
122
|
-
if ($ === null || !(
|
|
124
|
+
if ($ === null || !(xt && !Pt && ($ === "location" ? vt : $ === "date"))) {
|
|
123
125
|
s(null), J.current = null;
|
|
124
126
|
return;
|
|
125
127
|
}
|
|
126
|
-
const
|
|
127
|
-
J.current =
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
for (const
|
|
133
|
-
P.push({ key: `date:${
|
|
128
|
+
const R = A ? "location" : $;
|
|
129
|
+
J.current = R, R === "location" && (w.locationGateFired = !0);
|
|
130
|
+
const Lt = Ht.filter((c) => c.kind === "location"), Ot = Ht.filter((c) => c.kind === "date").map((c) => c.value), nt = /* @__PURE__ */ y(({ quickDates: c }) => {
|
|
131
|
+
if (R !== "date" && !A) return [];
|
|
132
|
+
const C = A ? be : void 0, P = [];
|
|
133
|
+
if (kt && P.push({ key: "cal", label: "# Escolher no calendário", kind: "calendar", icon: "calendar", section: C }), c)
|
|
134
|
+
for (const x of Ot.length > 0 ? Ot : xe)
|
|
135
|
+
P.push({ key: `date:${x}`, label: x, kind: "date", icon: "date", insert: x, section: C });
|
|
134
136
|
return P;
|
|
135
|
-
}, "dateRows"),
|
|
136
|
-
if (
|
|
137
|
+
}, "dateRows"), ve = /* @__PURE__ */ y((c, C) => (C ? $e(c) : void 0) ?? (A ? Gt : void 0), "locSection"), N = [];
|
|
138
|
+
if (R === "location") {
|
|
137
139
|
N.push(...nt({ quickDates: !0 }));
|
|
138
|
-
for (const c of
|
|
140
|
+
for (const c of Lt)
|
|
139
141
|
N.push({
|
|
140
142
|
key: `loc:${c.value}`,
|
|
141
143
|
label: c.label,
|
|
142
144
|
kind: "namedLocation",
|
|
143
145
|
insert: c.value,
|
|
144
146
|
icon: "place",
|
|
145
|
-
section: A ?
|
|
147
|
+
section: A ? Gt : void 0
|
|
146
148
|
});
|
|
147
149
|
} else
|
|
148
150
|
N.push(...nt({ quickDates: !0 }));
|
|
149
|
-
const rt = z.current.suggest,
|
|
150
|
-
if (
|
|
151
|
-
if (!i && e.locationExpected && e.locationPartialEmpty && e.locationCount < 2 &&
|
|
152
|
-
const c = u.selectionStart ?? t.length,
|
|
153
|
-
if (!
|
|
154
|
-
const
|
|
155
|
-
O.current = !0, s(null), a.setDraft(`${
|
|
151
|
+
const rt = z.current.suggest, ke = R === "location" ? Lt.length > 0 : !0;
|
|
152
|
+
if (R === "location" && !ke && !rt && !A) {
|
|
153
|
+
if (!i && e.locationExpected && e.locationPartialEmpty && e.locationCount < 2 && vt && a.currentTriggerChar() !== "@") {
|
|
154
|
+
const c = u.selectionStart ?? t.length, C = t.slice(0, c), P = C.length > 0 && !/\s$/.test(C);
|
|
155
|
+
if (!C.endsWith("@")) {
|
|
156
|
+
const x = P ? " @" : "@";
|
|
157
|
+
O.current = !0, s(null), a.setDraft(`${C}${x}${t.slice(c)}`), a.focusCaret(c + x.length), requestAnimationFrame(() => {
|
|
156
158
|
const H = a.getTextarea();
|
|
157
159
|
H && a.syncTrigger(H);
|
|
158
160
|
});
|
|
@@ -162,22 +164,22 @@ function Ae(r, x, T = {}) {
|
|
|
162
164
|
s(null);
|
|
163
165
|
return;
|
|
164
166
|
}
|
|
165
|
-
if (rt ?
|
|
166
|
-
const c = t.slice(0, u.selectionStart ?? t.length),
|
|
167
|
-
|
|
168
|
-
const H =
|
|
169
|
-
(q =
|
|
170
|
-
const
|
|
171
|
-
|
|
167
|
+
if (rt ? j.current === null && N.length > 0 && (K(0), it(!0), s(N)) : (lt(""), N.length > 0 ? (K(0), it(!0), s(N)) : s(null)), rt) {
|
|
168
|
+
const c = t.slice(0, u.selectionStart ?? t.length), C = c.search(/[ \t\r\n](?=[^ \t\r\n]*$)/), P = C === -1 ? c : c.slice(C + 1), x = R === "location" && e.locationPartial !== void 0 ? e.locationPartial : P;
|
|
169
|
+
R === "location" && (St.current = x), lt(x);
|
|
170
|
+
const H = R === "location" ? [...t.matchAll(/@\(([A-Za-z]{3})\)/g)].map((ot) => ot[1].toUpperCase()) : void 0, Re = ++At.current;
|
|
171
|
+
(q = ft.current) == null || q.abort();
|
|
172
|
+
const qt = new AbortController();
|
|
173
|
+
ft.current = qt;
|
|
172
174
|
try {
|
|
173
|
-
const ot =
|
|
174
|
-
if (
|
|
175
|
-
const
|
|
176
|
-
if (!
|
|
175
|
+
const ot = R === "location" ? zt(e) : "air", Rt = await rt(x, R, qt.signal, H, ot);
|
|
176
|
+
if (Re !== At.current) return;
|
|
177
|
+
const Nt = a.getTextarea();
|
|
178
|
+
if (!Nt || Nt.value !== t || R === "location" && Rt.length === 0) return;
|
|
177
179
|
const F = [];
|
|
178
|
-
if (
|
|
180
|
+
if (R === "location") {
|
|
179
181
|
F.push(...nt({ quickDates: !0 }));
|
|
180
|
-
for (const m of
|
|
182
|
+
for (const m of Rt)
|
|
181
183
|
F.push({
|
|
182
184
|
key: `loc:${m.insert}`,
|
|
183
185
|
label: m.label,
|
|
@@ -189,37 +191,37 @@ function Ae(r, x, T = {}) {
|
|
|
189
191
|
// already in the prompt (same city) — greyed, not pickable
|
|
190
192
|
// An IATA code is what makes a row an AIRPORT; everything else is a place.
|
|
191
193
|
icon: m.iata ? "airport" : "place",
|
|
192
|
-
section:
|
|
194
|
+
section: ve(m.source, ot === "both")
|
|
193
195
|
});
|
|
194
196
|
} else {
|
|
195
197
|
F.push(...nt({ quickDates: !1 }));
|
|
196
|
-
for (const m of
|
|
198
|
+
for (const m of Rt)
|
|
197
199
|
F.push({ key: `date:${m.insert}`, label: m.label, kind: "date", icon: "date", insert: m.insert });
|
|
198
200
|
}
|
|
199
201
|
if (F.length === 0) {
|
|
200
202
|
s(null);
|
|
201
203
|
return;
|
|
202
204
|
}
|
|
203
|
-
const
|
|
204
|
-
K(
|
|
205
|
+
const Ft = F.findIndex((m) => !m.disabled);
|
|
206
|
+
K(Ft < 0 ? 0 : Ft), it(x.trim() === ""), s(F);
|
|
205
207
|
} catch {
|
|
206
208
|
}
|
|
207
209
|
}
|
|
208
210
|
} catch {
|
|
209
211
|
}
|
|
210
212
|
}, 200)), B.current != null && window.clearTimeout(B.current), B.current = window.setTimeout(() => {
|
|
211
|
-
|
|
213
|
+
mt();
|
|
212
214
|
}, 300);
|
|
213
|
-
}, [
|
|
215
|
+
}, [mt]), ge = S((t) => {
|
|
214
216
|
var i, p;
|
|
215
217
|
const n = t.trim();
|
|
216
|
-
n && ((p = (i = z.current).commitIntent) == null || p.call(i, n,
|
|
217
|
-
}, []),
|
|
218
|
+
n && ((p = (i = z.current).commitIntent) == null || p.call(i, n, gt.current, I.current)), I.current = wt(), O.current = !1;
|
|
219
|
+
}, []), pe = S(() => {
|
|
218
220
|
const t = I.current;
|
|
219
|
-
t.atOpened = !0, O.current ? O.current = !1 : V.current === null &&
|
|
220
|
-
}, []),
|
|
221
|
+
t.atOpened = !0, O.current ? O.current = !1 : V.current === null && j.current === null && (t.manualAt = !0);
|
|
222
|
+
}, []), me = S((t) => {
|
|
221
223
|
I.current.atAccepted = t ?? "location";
|
|
222
|
-
}, []),
|
|
224
|
+
}, []), yt = S(() => {
|
|
223
225
|
I.current.ghostAccepted = !0;
|
|
224
226
|
const t = V.current === "date" ? "#" : "@";
|
|
225
227
|
O.current = !0, X.current = 0, et.current = null, E(null);
|
|
@@ -230,63 +232,64 @@ function Ae(r, x, T = {}) {
|
|
|
230
232
|
const a = n.getTextarea();
|
|
231
233
|
a && n.syncTrigger(a);
|
|
232
234
|
});
|
|
233
|
-
}, []),
|
|
235
|
+
}, []), ye = S((t) => {
|
|
234
236
|
if (b && t.key === b && !t.ctrlKey && !t.metaKey && !t.altKey) {
|
|
235
237
|
t.preventDefault();
|
|
236
238
|
const n = _.current.getTextarea(), i = (n == null ? void 0 : n.selectionStart) ?? (n == null ? void 0 : n.value.length) ?? 0, p = n ? n.value.slice(i) : "";
|
|
237
|
-
return Z.current = !1, X.current = 0, M(p.trim().length > 0), E(
|
|
239
|
+
return Z.current = !1, X.current = 0, M(p.trim().length > 0), E(k === "location" ? "person" : "location"), !0;
|
|
238
240
|
}
|
|
239
|
-
if (
|
|
241
|
+
if (k !== null && (!l || l.length === 0)) {
|
|
240
242
|
if (t.key === "Tab" || t.key === "ArrowRight" && !L)
|
|
241
|
-
return t.preventDefault(),
|
|
243
|
+
return t.preventDefault(), yt(), !0;
|
|
242
244
|
if (t.key === "Escape")
|
|
243
245
|
return t.preventDefault(), Z.current = !0, E(null), !0;
|
|
244
246
|
}
|
|
245
247
|
if (!l || l.length === 0) return !1;
|
|
246
248
|
if (t.key === "ArrowDown")
|
|
247
|
-
return t.preventDefault(), K((n) =>
|
|
249
|
+
return t.preventDefault(), K((n) => _t(l, n, 1)), !0;
|
|
248
250
|
if (t.key === "ArrowUp")
|
|
249
|
-
return t.preventDefault(), K((n) =>
|
|
251
|
+
return t.preventDefault(), K((n) => _t(l, n, -1)), !0;
|
|
250
252
|
if (t.key === "Enter" || t.key === "Tab") {
|
|
251
253
|
t.preventDefault();
|
|
252
|
-
const n = l[
|
|
253
|
-
return n && !n.disabled &&
|
|
254
|
+
const n = l[at];
|
|
255
|
+
return n && !n.disabled && pt(n), !0;
|
|
254
256
|
}
|
|
255
257
|
return t.key === "Escape" ? (t.preventDefault(), s(null), !0) : !1;
|
|
256
|
-
}, [l,
|
|
258
|
+
}, [l, at, pt, k, L, yt, b]);
|
|
257
259
|
return ct(() => () => {
|
|
258
260
|
var t, n;
|
|
259
|
-
W.current != null && window.clearTimeout(W.current), B.current != null && window.clearTimeout(B.current), U.current != null && window.clearTimeout(U.current), (t =
|
|
261
|
+
W.current != null && window.clearTimeout(W.current), B.current != null && window.clearTimeout(B.current), U.current != null && window.clearTimeout(U.current), (t = ht.current) == null || t.abort(), (n = ft.current) == null || n.abort();
|
|
260
262
|
}, []), {
|
|
261
263
|
predictions: l,
|
|
262
|
-
predictionsRecents:
|
|
263
|
-
|
|
264
|
+
predictionsRecents: oe,
|
|
265
|
+
predictionQuery: ce,
|
|
266
|
+
predictionHighlight: at,
|
|
264
267
|
setPredictionHighlight: K,
|
|
265
|
-
applyPrediction:
|
|
266
|
-
clearPredictions:
|
|
267
|
-
hint:
|
|
268
|
+
applyPrediction: pt,
|
|
269
|
+
clearPredictions: de,
|
|
270
|
+
hint: k,
|
|
268
271
|
hintMidSentence: L,
|
|
269
|
-
acceptHint:
|
|
270
|
-
resolvedLocations:
|
|
271
|
-
resolvedDates:
|
|
272
|
-
forceTooltipText:
|
|
273
|
-
personConfidence:
|
|
272
|
+
acceptHint: yt,
|
|
273
|
+
resolvedLocations: se,
|
|
274
|
+
resolvedDates: ie,
|
|
275
|
+
forceTooltipText: le,
|
|
276
|
+
personConfidence: Bt,
|
|
274
277
|
locationConfidence: st,
|
|
275
278
|
hotelExpected: jt,
|
|
276
|
-
hotelConfidence:
|
|
277
|
-
vertical:
|
|
278
|
-
hotelNameExpected:
|
|
279
|
-
hotelNameConfidence:
|
|
280
|
-
scheduleAssist:
|
|
281
|
-
commit:
|
|
282
|
-
onKeyDown:
|
|
283
|
-
resetSession:
|
|
284
|
-
noteAtOpened:
|
|
285
|
-
noteAtAccepted:
|
|
279
|
+
hotelConfidence: Jt,
|
|
280
|
+
vertical: Xt,
|
|
281
|
+
hotelNameExpected: te,
|
|
282
|
+
hotelNameConfidence: ne,
|
|
283
|
+
scheduleAssist: he,
|
|
284
|
+
commit: ge,
|
|
285
|
+
onKeyDown: ye,
|
|
286
|
+
resetSession: fe,
|
|
287
|
+
noteAtOpened: pe,
|
|
288
|
+
noteAtAccepted: me
|
|
286
289
|
};
|
|
287
290
|
}
|
|
288
|
-
|
|
289
|
-
function
|
|
291
|
+
y(Ee, "usePromptAssist");
|
|
292
|
+
function De(r, v) {
|
|
290
293
|
const T = o(r), [b, l] = f(null);
|
|
291
294
|
return ct(() => {
|
|
292
295
|
T.current = r;
|
|
@@ -294,17 +297,17 @@ function Se(r, x) {
|
|
|
294
297
|
function s() {
|
|
295
298
|
T.current();
|
|
296
299
|
}
|
|
297
|
-
if (
|
|
298
|
-
const
|
|
299
|
-
return l(
|
|
300
|
-
clearInterval(
|
|
300
|
+
if (y(s, "tick"), v !== null) {
|
|
301
|
+
const k = setInterval(s, v);
|
|
302
|
+
return l(k), () => {
|
|
303
|
+
clearInterval(k);
|
|
301
304
|
};
|
|
302
305
|
}
|
|
303
|
-
}, [
|
|
306
|
+
}, [v]), b;
|
|
304
307
|
}
|
|
305
|
-
|
|
306
|
-
function
|
|
307
|
-
const [l, s] = f(T), [
|
|
308
|
+
y(De, "useInterval");
|
|
309
|
+
function Pe(r, v, T = 0, b = 0) {
|
|
310
|
+
const [l, s] = f(T), [k, E] = f(b);
|
|
308
311
|
return ct(() => {
|
|
309
312
|
const L = r.current;
|
|
310
313
|
if (!L) return;
|
|
@@ -313,12 +316,12 @@ function Ee(r, x, T = 0, b = 0) {
|
|
|
313
316
|
G && (E(G.contentRect.height), s(G.contentRect.width));
|
|
314
317
|
});
|
|
315
318
|
return M.observe(L), s(L.getBoundingClientRect().width), () => M.disconnect();
|
|
316
|
-
}, [r,
|
|
319
|
+
}, [r, v]), [l, k];
|
|
317
320
|
}
|
|
318
|
-
|
|
321
|
+
y(Pe, "useContainerRectangle");
|
|
319
322
|
export {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
+
De as a,
|
|
324
|
+
Ee as b,
|
|
325
|
+
Pe as u
|
|
323
326
|
};
|
|
324
|
-
//# sourceMappingURL=useContainerWidth-
|
|
327
|
+
//# sourceMappingURL=useContainerWidth-BYogfTRE.js.map
|