@aintela/chat 0.4.22 → 0.4.24

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/hooks.js CHANGED
@@ -1,4 +1,4 @@
1
- import { u as a, a as t, b as o } from "./useContainerWidth-CMv4G1Po.js";
1
+ import { u as a, a as t, b as o } from "./useContainerWidth-q0Waamys.js";
2
2
  import { u } from "./useChatSessions-BzgPYfyj.js";
3
3
  export {
4
4
  u as useChatSessions,
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 Ee, AiChatPane as ue, 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 Ea, MentionPickerPanel as ua, 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 Et, createAiChatSessionStore as ut, 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, slotEnterSx as _t, useAgentEngine as kt, useAiChatServices as Bt, useAiChatSessionStore as Vt, useCoarsePointer as bt, useEnvironment as Ft, useEnvironmentOptional as Ht, useLiveTsxMaxCharsForFull as Nt, useParkedAskUser as wt, useResponsiveLayout as Gt, useTurnOpen as Ot, useVisualViewport as Wt, v2Card as zt, v2Chip as Jt, v2IconBtn as Kt, v2MonoMeta as jt, v2SectionLabel as qt, v2Theme as Xt } from "./components.js";
10
- import { u as Yt, a as Qt, b as $t } from "./useContainerWidth-CMv4G1Po.js";
10
+ import { u as Yt, a as Qt, b as $t } from "./useContainerWidth-q0Waamys.js";
11
11
  import { A as as, D as ts, g as ss, b as ns, c as os, d as rs, e as is, f as cs, i as ls, r as As } from "./environmentUtils-VZNTCzEE.js";
12
12
  import { ALLOWED_DOMAINS as gs, ALLOWED_EMAILS as Ss, AUTH_CONFIG as Cs, GOOGLE_CLIENT_ID as Is, getAgentBaseUrl as hs, getArtifactsBaseUrl as ds, getDotNetBaseUrl as Ps, getIconByName as Es, iconCategories as us, materialIcons as vs, searchIcons as Ts, setEbiContextData as ms, setEbiContextSessionId as Ls } from "./utils.js";
13
13
  import { S as xs, a as Ms, b as ys, c as fs, d as Ds, e as Us, f as _s, g as ks, h as Bs, i as Vs, j as bs, k as Fs, l as Hs, p as Ns, m as ws, s as Gs, o as Os, q as Ws, t as zs, r as Js } from "./predictionRows-CtyrlEUr.js";
@@ -33,7 +33,8 @@ export type GhostKind = 'location' | 'places' | 'hotelname' | 'person' | 'date'
33
33
  export type SlotDateOption = {
34
34
  id: string;
35
35
  label: string;
36
- /** What replaces the `@…` token. A date phrase, or "#" — which re-opens the calendar instead. */
36
+ /** What replaces the `@…` token — always carrying its own sigil, since the splice eats the one being replaced:
37
+ * a `#`-prefixed date phrase, or a bare "#", which re-opens the calendar instead. */
37
38
  value: string;
38
39
  kind: 'date' | 'calendar';
39
40
  section: string;
@@ -1,7 +1,7 @@
1
1
  var Pe = Object.defineProperty;
2
2
  var x = (o, C) => Pe(o, "name", { value: C, configurable: !0 });
3
- import { useState as u, useRef as s, useCallback as E, useEffect as ft } from "react";
4
- const jt = /* @__PURE__ */ x((o) => o.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), "foldForCompare"), Vt = /* @__PURE__ */ x((o) => o.vertical ?? (Ht(o) ? "hotel" : "air"), "verticalOf"), Ht = /* @__PURE__ */ x((o) => o.placesExpected ?? o.hotelExpected ?? !1, "lodgingOf"), Xt = /* @__PURE__ */ x((o) => o.placesConfidence ?? o.hotelConfidence ?? 0, "lodgingScoreOf"), He = /* @__PURE__ */ x((o) => o === "hotel" ? "Hotéis e locais" : o === "air" ? "Aeroportos" : void 0, "sectionLabel"), Dt = "Data", Zt = "Localização", Pt = /* @__PURE__ */ x(() => ({
3
+ import { useState as u, useRef as s, useCallback as D, useEffect as ft } from "react";
4
+ const jt = /* @__PURE__ */ x((o) => o.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), "foldForCompare"), Vt = /* @__PURE__ */ x((o) => o.vertical ?? (Ht(o) ? "hotel" : "air"), "verticalOf"), Ht = /* @__PURE__ */ x((o) => o.placesExpected ?? o.hotelExpected ?? !1, "lodgingOf"), Xt = /* @__PURE__ */ x((o) => o.placesConfidence ?? o.hotelConfidence ?? 0, "lodgingScoreOf"), He = /* @__PURE__ */ x((o) => o === "hotel" ? "Hotéis e locais" : o === "air" ? "Aeroportos" : void 0, "sectionLabel"), Et = "Data", Zt = "Localização", Pt = /* @__PURE__ */ x(() => ({
5
5
  maxLocationConfidence: 0,
6
6
  maxPersonConfidence: 0,
7
7
  maxHotelConfidence: 0,
@@ -21,134 +21,139 @@ const jt = /* @__PURE__ */ x((o) => o.normalize("NFD").replace(/[\u0300-\u036f]/
21
21
  return C;
22
22
  }, "nextEnabledIndex");
23
23
  function qe(o, C, A = {}) {
24
- const { debugGhostKey: T } = A, [v, a] = u(null), [k, S] = u(null), [L, K] = u(!1), [ht, V] = u(0), [te, ee] = u(0), [ne, re] = u(!1), [oe, ce] = u("air"), [se, ie] = u(0), [le, ae] = u(!1), [ue, de] = u(0), [fe, pt] = u(!1), [he, gt] = u(""), [pe, ge] = u([]), [mt, xt] = u(!1), D = s(null), [yt, z] = u(0), [me, It] = u([]), [xe, Lt] = u([]), [ye, Ct] = u(""), nt = s(""), X = s(null), M = s(o);
25
- M.current = o;
26
- const U = s(C);
27
- U.current = C;
28
- const rt = s(A);
29
- rt.current = A;
30
- const Z = s(null), J = s(null), Ot = s(0), qt = s(0), vt = s(null), ot = s(""), Y = s(null), kt = s(null), wt = s(Jt()), tt = s(null);
31
- tt.current = v;
32
- const W = s(null);
33
- W.current = k;
34
- const _ = s(0), B = s(null), Q = s(!1), Ce = 8, ve = 0.5, et = s(null), Nt = s(""), Ft = s(() => {
35
- }), I = s(Pt()), O = s(!1), ke = E(() => {
36
- a(null), gt(""), D.current = null;
37
- }, []), we = E(() => {
38
- It([]), Lt([]), Ct(""), nt.current = "", Y.current = null, wt.current = Jt(), I.current = Pt(), O.current = !1, D.current = null, xt(!1), _.current = 0, B.current = null, Q.current = !1, S(null);
39
- }, []), Rt = E((t) => {
24
+ const { debugGhostKey: T } = A, [v, a] = u(null), [k, S] = u(null), [L, z] = u(!1), [ht, X] = u(0), [te, ee] = u(0), [ne, re] = u(!1), [oe, ce] = u("air"), [se, ie] = u(0), [le, ae] = u(!1), [ue, de] = u(0), [fe, pt] = u(!1), [he, gt] = u(""), [pe, ge] = u([]), [mt, xt] = u(!1), E = s(null), [yt, M] = u(0), [me, It] = u([]), [xe, Lt] = u([]), [ye, Ct] = u(""), ot = s(""), Z = s(null), U = s(o);
25
+ U.current = o;
26
+ const W = s(C);
27
+ W.current = C;
28
+ const J = s(A);
29
+ J.current = A;
30
+ const Y = s(null), tt = s(null), Ot = s(0), qt = s(0), vt = s(null), ct = s(""), et = s(null), kt = s(null), wt = s(Jt()), nt = s(null);
31
+ nt.current = v;
32
+ const _ = s(null);
33
+ _.current = k;
34
+ const B = s(0), Q = s(null), j = s(!1), Ce = 8, ve = 0.5, rt = s(null), Nt = s(""), Ft = s(() => {
35
+ }), I = s(Pt()), O = s(!1), ke = D(() => {
36
+ a(null), gt(""), E.current = null;
37
+ }, []), we = D(() => {
38
+ It([]), Lt([]), Ct(""), ot.current = "", et.current = null, wt.current = Jt(), I.current = Pt(), O.current = !1, E.current = null, xt(!1), B.current = 0, Q.current = null, j.current = !1, S(null);
39
+ }, []), Rt = D((t) => {
40
40
  if (t.disabled) return;
41
- I.current.suggestionAccepted = !0, D.current = null, t.kind === "location" && (O.current = !0), a(null);
42
- const n = M.current, r = n.getTextarea();
41
+ I.current.suggestionAccepted = !0, E.current = null, t.kind === "location" && (O.current = !0), a(null);
42
+ const n = U.current, r = n.getTextarea();
43
43
  if (!r) return;
44
- const g = r.selectionStart ?? r.value.length, h = r.value.slice(0, g), P = r.value.slice(g), q = t.kind === "namedLocation" || t.kind === "location";
44
+ const g = r.selectionStart ?? r.value.length, f = r.value.slice(0, g), P = r.value.slice(g), q = t.kind === "namedLocation" || t.kind === "location";
45
45
  let e;
46
46
  if (q) {
47
- const f = Nt.current, p = h.replace(/\s+$/, "");
48
- e = f && p.endsWith(f) ? p.slice(0, p.length - f.length) : h;
47
+ const h = Nt.current, p = f.replace(/\s+$/, "");
48
+ e = h && p.endsWith(h) ? p.slice(0, p.length - h.length) : f;
49
49
  } else {
50
- const f = h.search(/\S+$/), p = f === -1 ? "" : h.slice(f);
51
- e = p.length > 0 && (t.kind === "date" && t.insert ? jt(t.insert).startsWith(jt(p)) : /^[\d./-]+$/.test(p)) ? h.slice(0, f) : h;
50
+ const h = f.search(/\S+$/), p = h === -1 ? "" : f.slice(h);
51
+ e = p.length > 0 && (t.kind === "date" && t.insert ? jt(t.insert).startsWith(jt(p)) : /^[\d./-]+$/.test(p)) ? f.slice(0, h) : f;
52
52
  }
53
53
  const i = e.length > 0 && !/\s$/.test(e);
54
54
  if (t.kind === "date") {
55
- const f = `${i ? " " : ""}${t.insert} `, p = `${e}${f}${P}`;
56
- n.setDraft(p), n.focusCaret(e.length + f.length), ot.current = p, Y.current = null, Ft.current();
55
+ const h = J.current.enableHashDatePicker ? "#" : "", p = `${i ? " " : ""}${h}${t.insert} `, N = `${e}${p}${P}`;
56
+ n.setDraft(N), n.focusCaret(e.length + p.length), ct.current = N, et.current = null, Ft.current();
57
57
  return;
58
58
  }
59
59
  if (t.kind === "namedLocation" && t.insert) {
60
- const f = `@${t.insert.replace(/ /g, " ")}`, p = `${i ? " " : ""}${f} `;
60
+ const h = `@${t.insert.replace(/ /g, " ")}`, p = `${i ? " " : ""}${h} `;
61
61
  n.setDraft(`${e}${p}${P}`), n.focusCaret(e.length + p.length);
62
62
  return;
63
63
  }
64
64
  const d = t.kind === "location" ? "@" : "#", y = `${i ? " " : ""}${d}`;
65
65
  n.setDraft(`${e}${y}${P}`), n.focusCaret(e.length + y.length), requestAnimationFrame(() => {
66
- const f = n.getTextarea();
67
- f && n.syncTrigger(f);
66
+ const h = n.getTextarea();
67
+ h && n.syncTrigger(h);
68
68
  });
69
- }, []), $t = E(async () => {
70
- var h;
71
- const t = U.current.resolveDates;
69
+ }, []), $t = D(async () => {
70
+ var f;
71
+ const t = W.current.resolveDates;
72
72
  if (!t) return;
73
- const n = ot.current;
73
+ const n = ct.current;
74
74
  if (n.trim() === "") {
75
- Y.current = null;
75
+ et.current = null;
76
76
  return;
77
77
  }
78
- if (n === Y.current || n.split(" ").length <= 2) return;
79
- Y.current = n, (h = kt.current) == null || h.abort();
78
+ if (n === et.current || n.split(" ").length <= 2) return;
79
+ et.current = n, (f = kt.current) == null || f.abort();
80
80
  const g = new AbortController();
81
81
  kt.current = g;
82
82
  try {
83
83
  const { dates: P, locations: q } = await t(n, wt.current, g.signal);
84
- if (ot.current !== n) return;
84
+ if (ct.current !== n) return;
85
85
  const e = P.filter((d) => d.display).map((d) => ({ text: d.text, display: d.display }));
86
86
  Lt(e), It(q.map((d) => d.text).filter((d) => d.trim().length > 0));
87
87
  const i = e.map((d) => `${d.text}=${d.display}`).join("|");
88
- e.length > 0 && i !== nt.current && (nt.current = i, Ct(e[e.length - 1].text), X.current != null && window.clearTimeout(X.current), X.current = window.setTimeout(() => Ct(""), 2e3)), e.length === 0 && (nt.current = "");
88
+ e.length > 0 && i !== ot.current && (ot.current = i, Ct(e[e.length - 1].text), Z.current != null && window.clearTimeout(Z.current), Z.current = window.setTimeout(() => Ct(""), 2e3)), e.length === 0 && (ot.current = "");
89
89
  } catch {
90
90
  }
91
91
  }, []);
92
92
  Ft.current = $t;
93
- const Re = E((t, n, r) => {
94
- if (ot.current = t, W.current !== null && (_.current += 1, _.current >= Ce && (Q.current = !0, S(null))), t.split(" ").length <= 2) return;
95
- const h = U.current.analyze;
96
- h && (!r || tt.current !== null || W.current !== null) && (Z.current != null && window.clearTimeout(Z.current), Z.current = window.setTimeout(async () => {
93
+ const Re = D((t, n, r) => {
94
+ if (ct.current = t, _.current !== null && (B.current += 1, B.current >= Ce && (j.current = !0, S(null))), t.split(" ").length <= 2) return;
95
+ const f = W.current.analyze;
96
+ f && (!r || nt.current !== null || _.current !== null) && (Y.current != null && window.clearTimeout(Y.current), Y.current = window.setTimeout(async () => {
97
97
  var q;
98
98
  const P = ++Ot.current;
99
99
  try {
100
- const e = await h(t, n);
100
+ const e = await f(t, n);
101
101
  if (P !== Ot.current) return;
102
- const i = M.current, d = i.getTextarea();
102
+ const i = U.current, d = i.getTextarea();
103
103
  if (!d || d.value !== t) return;
104
- ee(e.personConfidence ?? 0), V(e.locationConfidence ?? 0), re(Ht(e)), ce(Vt(e)), ie(Xt(e)), ae(e.hotelNameExpected ?? !1), de(e.hotelNameConfidence ?? 0);
104
+ ee(e.personConfidence ?? 0), X(e.locationConfidence ?? 0), re(Ht(e)), ce(Vt(e)), ie(Xt(e)), ae(e.hotelNameExpected ?? !1), de(e.hotelNameConfidence ?? 0);
105
105
  const y = I.current;
106
106
  y.maxPersonConfidence = Math.max(y.maxPersonConfidence, e.personConfidence ?? 0), y.maxLocationConfidence = Math.max(y.maxLocationConfidence, e.locationConfidence ?? 0), y.maxHotelConfidence = Math.max(y.maxHotelConfidence ?? 0, Xt(e)), S(null);
107
- const f = d.selectionStart ?? n, p = f === t.length, ct = t.slice(0, f), Ae = t.slice(f), Tt = !p && /\s$/.test(ct) && !/^\s*@/.test(Ae), st = p || Tt, St = i.hasAtQuery, it = i.isPickerOpen(), Gt = e.suggestions ?? [], { enableHashDatePicker: lt = !1, datePresets: Kt = ["amanhã de manhã", "quarta-feira à noite"] } = rt.current;
107
+ const h = d.selectionStart ?? n, p = h === t.length, N = t.slice(0, h), Ae = t.slice(h), Tt = !p && /\s$/.test(N) && !/^\s*@/.test(Ae), st = p || Tt, St = i.hasAtQuery, it = i.isPickerOpen(), Gt = e.suggestions ?? [], { enableHashDatePicker: lt = !1, datePresets: Kt = ["amanhã de manhã", "quarta-feira à noite"] } = J.current;
108
108
  let b = e.category === "location" ? "location" : e.category === "date" ? "date" : e.locationExpected ? "location" : e.dateExpected ? "date" : null;
109
- b !== "location" && e.locationCount < 2 && U.current.suggest && tt.current !== null && et.current === "location" && st && /\s$/.test(ct) && (b = "location");
109
+ b !== "location" && e.locationCount < 2 && W.current.suggest && nt.current !== null && rt.current === "location" && st && /\s$/.test(N) && (b = "location");
110
110
  const zt = e.secondary ?? "";
111
111
  let w = lt && St && (b === "location" && zt === "date" || b === "date" && zt === "location");
112
112
  if (w && e.locationCount >= 2 && e.locationPartialEmpty && (w = !1, b = "date"), !it) {
113
113
  const c = (e.suggestions ?? []).filter((l) => l.kind === "date").map((l) => l.value);
114
114
  ge(w ? [
115
- ...lt ? [{ id: "cal", label: "# Escolher no calendário", value: "#", kind: "calendar", section: Dt }] : [],
116
- ...(c.length > 0 ? c : Kt).map((l) => ({ id: `date:${l}`, label: l, value: l, kind: "date", section: Dt }))
115
+ ...lt ? [{ id: "cal", label: "# Escolher no calendário", value: "#", kind: "calendar", section: Et }] : [],
116
+ // "#"-prefixed, because this row REPLACES the "@" the user typed to open the picker
117
+ // (Issue 1190): the splice hands `value` the whole `@…` token, so a bare phrase ate the
118
+ // trigger and left the date wearing the wrong sigil — or none. `#` is the one the Data
119
+ // half of a mixed caret takes. Only reachable with the calendar wired (`mixed` requires
120
+ // `enableHashDatePicker`), so the character always has a picker behind it.
121
+ ...(c.length > 0 ? c : Kt).map((l) => ({ id: `date:${l}`, label: l, value: `#${l}`, kind: "date", section: Et }))
117
122
  ] : []);
118
123
  }
119
- const At = !!(w && rt.current.promptHint && st && !it);
120
- D.current !== null && !ct.startsWith(D.current) && (D.current = null), w || (D.current = null);
121
- const Mt = D.current !== null;
122
- if (xt(At && !Mt), At && !Mt && (Q.current || (B.current = "mixed", K(Tt), S("mixed"), y.ghostShown = !0, y.locationGateFired = !0)), rt.current.promptHint && st && !it && !At) {
123
- const c = e.personConfidence ?? 0, l = e.locationConfidence ?? 0, H = b === "location" && !w && !(e.locationCount >= 2 && e.locationPartialEmpty), $ = e.hotelNameExpected ?? !1 ? "hotelname" : Ht(e) ? "places" : "location", F = b === "date" && !w && lt, j = c >= ve && c >= l && !F ? "person" : F ? "date" : H ? $ : null;
124
- if (j) {
125
- Q.current || (B.current = j, K(Tt), S(j), y.ghostShown = !0, j === "location" && (y.locationGateFired = !0)), a(null), et.current = null;
124
+ const At = !!(w && J.current.promptHint && st && !it);
125
+ E.current !== null && !N.startsWith(E.current) && (E.current = null), w || (E.current = null);
126
+ const Mt = E.current !== null;
127
+ if (xt(At && !Mt), At && !Mt && (j.current || (Q.current = "mixed", z(Tt), S("mixed"), y.ghostShown = !0, y.locationGateFired = !0)), J.current.promptHint && st && !it && !At) {
128
+ const c = e.personConfidence ?? 0, l = e.locationConfidence ?? 0, H = b === "location" && !w && !(e.locationCount >= 2 && e.locationPartialEmpty), $ = e.hotelNameExpected ?? !1 ? "hotelname" : Ht(e) ? "places" : "location", G = b === "date" && !w && lt, V = c >= ve && c >= l && !G ? "person" : G ? "date" : H ? $ : null;
129
+ if (V) {
130
+ j.current || (Q.current = V, z(Tt), S(V), y.ghostShown = !0, V === "location" && (y.locationGateFired = !0)), a(null), rt.current = null;
126
131
  return;
127
132
  }
128
- B.current = null;
133
+ Q.current = null;
129
134
  }
130
135
  if (b === "location" && e.locationCount >= 2 && e.locationPartialEmpty) {
131
- a(null), et.current = null;
136
+ a(null), rt.current = null;
132
137
  return;
133
138
  }
134
139
  if (b === null || !(st && !it && (b === "location" ? St : b === "date"))) {
135
- a(null), et.current = null;
140
+ a(null), rt.current = null;
136
141
  return;
137
142
  }
138
143
  const R = w ? "location" : b;
139
- et.current = R, R === "location" && (y.locationGateFired = !0);
144
+ rt.current = R, R === "location" && (y.locationGateFired = !0);
140
145
  const Ut = Gt.filter((c) => c.kind === "location"), Wt = Gt.filter((c) => c.kind === "date").map((c) => c.value), at = /* @__PURE__ */ x(({ quickDates: c }) => {
141
146
  if (R !== "date" && !w) return [];
142
- const l = w ? Dt : void 0, H = [];
147
+ const l = w ? Et : void 0, H = [];
143
148
  if (lt && H.push({ key: "cal", label: "# Escolher no calendário", kind: "calendar", icon: "calendar", section: l }), c)
144
149
  for (const $ of Wt.length > 0 ? Wt : Kt)
145
150
  H.push({ key: `date:${$}`, label: $, kind: "date", icon: "date", insert: $, section: l });
146
151
  return H;
147
- }, "dateRows"), Ee = /* @__PURE__ */ x((c, l) => (l ? He(c) : void 0) ?? (w ? Zt : void 0), "locSection"), N = [];
152
+ }, "dateRows"), De = /* @__PURE__ */ x((c, l) => (l ? He(c) : void 0) ?? (w ? Zt : void 0), "locSection"), F = [];
148
153
  if (R === "location") {
149
- N.push(...at({ quickDates: !0 }));
154
+ F.push(...at({ quickDates: !0 }));
150
155
  for (const c of Ut)
151
- N.push({
156
+ F.push({
152
157
  key: `loc:${c.value}`,
153
158
  label: c.label,
154
159
  kind: "namedLocation",
@@ -157,16 +162,16 @@ function qe(o, C, A = {}) {
157
162
  section: w ? Zt : void 0
158
163
  });
159
164
  } else
160
- N.push(...at({ quickDates: !0 }));
161
- const ut = U.current.suggest, De = R === "location" ? Ut.length > 0 : !0;
162
- if (R === "location" && !De && !ut && !w) {
165
+ F.push(...at({ quickDates: !0 }));
166
+ const ut = W.current.suggest, Ee = R === "location" ? Ut.length > 0 : !0;
167
+ if (R === "location" && !Ee && !ut && !w) {
163
168
  if (!r && e.locationExpected && e.locationPartialEmpty && e.locationCount < 2 && St && i.currentTriggerChar() !== "@") {
164
169
  const c = d.selectionStart ?? t.length, l = t.slice(0, c), H = l.length > 0 && !/\s$/.test(l);
165
170
  if (!l.endsWith("@")) {
166
171
  const $ = H ? " @" : "@";
167
172
  O.current = !0, a(null), i.setDraft(`${l}${$}${t.slice(c)}`), i.focusCaret(c + $.length), requestAnimationFrame(() => {
168
- const F = i.getTextarea();
169
- F && i.syncTrigger(F);
173
+ const G = i.getTextarea();
174
+ G && i.syncTrigger(G);
170
175
  });
171
176
  }
172
177
  return;
@@ -174,23 +179,23 @@ function qe(o, C, A = {}) {
174
179
  a(null);
175
180
  return;
176
181
  }
177
- if (ut ? tt.current === null && N.length > 0 && (z(0), pt(!0), a(N)) : (gt(""), N.length > 0 ? (z(0), pt(!0), a(N)) : a(null)), ut) {
182
+ if (ut ? nt.current === null && F.length > 0 && (M(0), pt(!0), a(F)) : (gt(""), F.length > 0 ? (M(0), pt(!0), a(F)) : a(null)), ut) {
178
183
  const c = t.slice(0, d.selectionStart ?? t.length), l = c.search(/[ \t\r\n](?=[^ \t\r\n]*$)/), H = l === -1 ? c : c.slice(l + 1), $ = R === "location" && e.locationPartial !== void 0 ? e.locationPartial : H;
179
184
  R === "location" && (Nt.current = $), gt($);
180
- const F = R === "location" ? [...t.matchAll(/@\(([A-Za-z]{3})\)/g)].map((dt) => dt[1].toUpperCase()) : void 0, j = ++qt.current;
185
+ const G = R === "location" ? [...t.matchAll(/@\(([A-Za-z]{3})\)/g)].map((dt) => dt[1].toUpperCase()) : void 0, V = ++qt.current;
181
186
  (q = vt.current) == null || q.abort();
182
187
  const _t = new AbortController();
183
188
  vt.current = _t;
184
189
  try {
185
- const dt = R === "location" ? Vt(e) : "air", Et = await ut($, R, _t.signal, F, dt);
186
- if (j !== qt.current) return;
190
+ const dt = R === "location" ? Vt(e) : "air", Dt = await ut($, R, _t.signal, G, dt);
191
+ if (V !== qt.current) return;
187
192
  const Bt = i.getTextarea();
188
- if (!Bt || Bt.value !== t || R === "location" && Et.length === 0) return;
189
- const G = [];
193
+ if (!Bt || Bt.value !== t || R === "location" && Dt.length === 0) return;
194
+ const K = [];
190
195
  if (R === "location") {
191
- G.push(...at({ quickDates: !0 }));
192
- for (const m of Et)
193
- G.push({
196
+ K.push(...at({ quickDates: !0 }));
197
+ for (const m of Dt)
198
+ K.push({
194
199
  key: `loc:${m.insert}`,
195
200
  label: m.label,
196
201
  kind: "namedLocation",
@@ -201,69 +206,69 @@ function qe(o, C, A = {}) {
201
206
  // already in the prompt (same city) — greyed, not pickable
202
207
  // An IATA code is what makes a row an AIRPORT; everything else is a place.
203
208
  icon: m.iata ? "airport" : "place",
204
- section: Ee(m.source, dt === "both")
209
+ section: De(m.source, dt === "both")
205
210
  });
206
211
  } else {
207
- G.push(...at({ quickDates: !1 }));
208
- for (const m of Et)
209
- G.push({ key: `date:${m.insert}`, label: m.label, kind: "date", icon: "date", insert: m.insert });
212
+ K.push(...at({ quickDates: !1 }));
213
+ for (const m of Dt)
214
+ K.push({ key: `date:${m.insert}`, label: m.label, kind: "date", icon: "date", insert: m.insert });
210
215
  }
211
- if (G.length === 0) {
216
+ if (K.length === 0) {
212
217
  a(null);
213
218
  return;
214
219
  }
215
- const Qt = G.findIndex((m) => !m.disabled);
216
- z(Qt < 0 ? 0 : Qt), pt($.trim() === ""), a(G);
220
+ const Qt = K.findIndex((m) => !m.disabled);
221
+ M(Qt < 0 ? 0 : Qt), pt($.trim() === ""), a(K);
217
222
  } catch {
218
223
  }
219
224
  }
220
225
  } catch {
221
226
  }
222
- }, 200)), J.current != null && window.clearTimeout(J.current), J.current = window.setTimeout(() => {
227
+ }, 200)), tt.current != null && window.clearTimeout(tt.current), tt.current = window.setTimeout(() => {
223
228
  $t();
224
229
  }, 300);
225
- }, [$t]), $e = E((t) => {
230
+ }, [$t]), $e = D((t) => {
226
231
  var r, g;
227
232
  const n = t.trim();
228
- n && ((g = (r = U.current).commitIntent) == null || g.call(r, n, wt.current, I.current)), I.current = Pt(), O.current = !1;
229
- }, []), be = E(() => {
233
+ n && ((g = (r = W.current).commitIntent) == null || g.call(r, n, wt.current, I.current)), I.current = Pt(), O.current = !1;
234
+ }, []), be = D(() => {
230
235
  const t = I.current;
231
- t.atOpened = !0, O.current ? O.current = !1 : W.current === null && tt.current === null && (t.manualAt = !0);
232
- }, []), Te = E((t) => {
236
+ t.atOpened = !0, O.current ? O.current = !1 : _.current === null && nt.current === null && (t.manualAt = !0);
237
+ }, []), Te = D((t) => {
233
238
  I.current.atAccepted = t ?? "location";
234
- }, []), bt = E(() => {
235
- if (I.current.ghostAccepted = !0, W.current === "mixed") {
236
- const i = M.current.getTextarea();
237
- D.current = i ? i.value.slice(0, i.selectionStart ?? i.value.length) : "", xt(!1), _.current = 0, B.current = null, S(null);
239
+ }, []), bt = D(() => {
240
+ if (I.current.ghostAccepted = !0, _.current === "mixed") {
241
+ const i = U.current.getTextarea();
242
+ E.current = i ? i.value.slice(0, i.selectionStart ?? i.value.length) : "", xt(!1), B.current = 0, Q.current = null, S(null);
238
243
  return;
239
244
  }
240
- const t = W.current === "date" ? "#" : "@";
241
- O.current = !0, _.current = 0, B.current = null, S(null);
242
- const n = M.current, r = n.getTextarea();
245
+ const t = _.current === "date" ? "#" : "@";
246
+ O.current = !0, B.current = 0, Q.current = null, S(null);
247
+ const n = U.current, r = n.getTextarea();
243
248
  if (!r) return;
244
- const g = r.selectionStart ?? r.value.length, h = r.value.slice(0, g), P = r.value.slice(g), e = `${h.length > 0 && !/\s$/.test(h) ? " " : ""}${t}`;
245
- n.setDraft(`${h}${e}${P}`), n.focusCaret(g + e.length), requestAnimationFrame(() => {
249
+ const g = r.selectionStart ?? r.value.length, f = r.value.slice(0, g), P = r.value.slice(g), e = `${f.length > 0 && !/\s$/.test(f) ? " " : ""}${t}`;
250
+ n.setDraft(`${f}${e}${P}`), n.focusCaret(g + e.length), requestAnimationFrame(() => {
246
251
  const i = n.getTextarea();
247
252
  i && n.syncTrigger(i);
248
253
  });
249
- }, []), Se = E((t) => {
254
+ }, []), Se = D((t) => {
250
255
  const n = mt ? null : v;
251
256
  if (T && t.key === T && !t.ctrlKey && !t.metaKey && !t.altKey) {
252
257
  t.preventDefault();
253
- const r = M.current.getTextarea(), g = (r == null ? void 0 : r.selectionStart) ?? (r == null ? void 0 : r.value.length) ?? 0, h = r ? r.value.slice(g) : "";
254
- return Q.current = !1, _.current = 0, K(h.trim().length > 0), S(k === "location" ? "person" : "location"), !0;
258
+ const r = U.current.getTextarea(), g = (r == null ? void 0 : r.selectionStart) ?? (r == null ? void 0 : r.value.length) ?? 0, f = r ? r.value.slice(g) : "";
259
+ return j.current = !1, B.current = 0, z(f.trim().length > 0), S(k === "location" ? "person" : "location"), !0;
255
260
  }
256
261
  if (k !== null && (!n || n.length === 0)) {
257
262
  if (t.key === "Tab" || t.key === "ArrowRight" && !L)
258
263
  return t.preventDefault(), bt(), !0;
259
264
  if (t.key === "Escape")
260
- return t.preventDefault(), Q.current = !0, S(null), !0;
265
+ return t.preventDefault(), j.current = !0, S(null), !0;
261
266
  }
262
267
  if (!n || n.length === 0) return !1;
263
268
  if (t.key === "ArrowDown")
264
- return t.preventDefault(), z((r) => Yt(n, r, 1)), !0;
269
+ return t.preventDefault(), M((r) => Yt(n, r, 1)), !0;
265
270
  if (t.key === "ArrowUp")
266
- return t.preventDefault(), z((r) => Yt(n, r, -1)), !0;
271
+ return t.preventDefault(), M((r) => Yt(n, r, -1)), !0;
267
272
  if (t.key === "Enter" || t.key === "Tab") {
268
273
  t.preventDefault();
269
274
  const r = n[yt];
@@ -273,14 +278,14 @@ function qe(o, C, A = {}) {
273
278
  }, [v, mt, yt, Rt, k, L, bt, T]);
274
279
  return ft(() => () => {
275
280
  var t, n;
276
- Z.current != null && window.clearTimeout(Z.current), J.current != null && window.clearTimeout(J.current), X.current != null && window.clearTimeout(X.current), (t = kt.current) == null || t.abort(), (n = vt.current) == null || n.abort();
281
+ Y.current != null && window.clearTimeout(Y.current), tt.current != null && window.clearTimeout(tt.current), Z.current != null && window.clearTimeout(Z.current), (t = kt.current) == null || t.abort(), (n = vt.current) == null || n.abort();
277
282
  }, []), {
278
283
  predictions: mt ? null : v,
279
284
  predictionsRecents: fe,
280
285
  predictionQuery: he,
281
286
  slotDateOptions: pe,
282
287
  predictionHighlight: yt,
283
- setPredictionHighlight: z,
288
+ setPredictionHighlight: M,
284
289
  applyPrediction: Rt,
285
290
  clearPredictions: ke,
286
291
  hint: k,
@@ -327,11 +332,11 @@ function Fe(o, C, A = 0, T = 0) {
327
332
  return ft(() => {
328
333
  const L = o.current;
329
334
  if (!L) return;
330
- const K = new ResizeObserver((ht) => {
331
- const V = ht[0];
332
- V && (S(V.contentRect.height), a(V.contentRect.width));
335
+ const z = new ResizeObserver((ht) => {
336
+ const X = ht[0];
337
+ X && (S(X.contentRect.height), a(X.contentRect.width));
333
338
  });
334
- return K.observe(L), a(L.getBoundingClientRect().width), () => K.disconnect();
339
+ return z.observe(L), a(L.getBoundingClientRect().width), () => z.disconnect();
335
340
  }, [o, C]), [v, k];
336
341
  }
337
342
  x(Fe, "useContainerRectangle");
@@ -340,4 +345,4 @@ export {
340
345
  qe as b,
341
346
  Fe as u
342
347
  };
343
- //# sourceMappingURL=useContainerWidth-CMv4G1Po.js.map
348
+ //# sourceMappingURL=useContainerWidth-q0Waamys.js.map