@aintela/chat 0.2.27 → 0.2.29
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/{promptHighlight-BHSQkdFs.js → atMentions-DqhG_vde.js} +37 -17
- package/dist/atMentions-DqhG_vde.js.map +1 -0
- package/dist/{auth-GFZAFz7L.js → auth-BN22f1HF.js} +2 -2
- package/dist/{auth-GFZAFz7L.js.map → auth-BN22f1HF.js.map} +1 -1
- package/dist/components.js +4756 -4639
- package/dist/components.js.map +1 -1
- package/dist/hooks.js +1 -1
- package/dist/index.js +54 -52
- package/dist/src/ErrorBondary.d.ts +1 -1
- package/dist/src/components/v2/PromptV2.d.ts +11 -0
- package/dist/src/hooks/usePromptAssist.d.ts +1 -0
- package/dist/src/services/httpPromptAssistService.d.ts +5 -0
- package/dist/src/utils/atMentions.d.ts +28 -0
- package/dist/src/utils/atMentions.test.d.ts +1 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/useContainerWidth-D0CQQqZ2.js +262 -0
- package/dist/useContainerWidth-D0CQQqZ2.js.map +1 -0
- package/dist/utils.js +28 -26
- package/package.json +1 -1
- package/dist/promptHighlight-BHSQkdFs.js.map +0 -1
- package/dist/useContainerWidth-0EA-kdzl.js +0 -260
- package/dist/useContainerWidth-0EA-kdzl.js.map +0 -1
package/dist/hooks.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import { C as s, F as o, a as n, I as r, L as i, S as c, b as l, c as
|
|
3
|
-
import { A as T, a as u, C as L, M as x, b as P, S as
|
|
4
|
-
import { C as
|
|
2
|
+
import { C as s, F as o, a as n, I as r, L as i, S as c, b as l, c as S, d as p, e as A, T as C, f as d, g, h as I, i as v, s as E, j as h } from "./serializer-BPina6fX.js";
|
|
3
|
+
import { A as T, a as u, C as L, M as x, b as P, S as f, i as R } from "./Memory-DjLZqgbF.js";
|
|
4
|
+
import { C as U, C as y } from "./ClientMessage-EKgfuTp8.js";
|
|
5
5
|
import { C as D, P as B } from "./Prompt-DZb7OaPp.js";
|
|
6
6
|
import { A as F, a as b, b as k, c as N, d as H, e as G, C as O, f as W, D as w, E as z, g as J, G as j, h as q, M as K, i as X, R as Y, j as Q, S as Z, l as $, m as ee, n as ae, o as te, p as se, q as oe, r as ne, s as re, t as ie, u as ce } from "./environmentUtils-CUVZ6Dq1.js";
|
|
7
|
-
import { A as
|
|
7
|
+
import { A as Se, a as pe, E as Ae, H as Ce, I as de, L as ge, W as Ie } from "./httpArtifactService-B668XBHO.js";
|
|
8
8
|
import { A as Ee } from "./artifactHtmlHandler-CMQJf1cX.js";
|
|
9
9
|
import { H as me, d as Te } from "./httpSessionService-BuT5FlDc.js";
|
|
10
|
-
import { APPBAR_V2_HEIGHT as Le, AgentActivityV2 as xe, AiChat as Pe, AiChatDrawer as
|
|
11
|
-
import { u as Lt, a as xt, b as Pt, c as
|
|
12
|
-
import { A as
|
|
13
|
-
import { S as $t, c as es, a as as, e as ts, b as ss,
|
|
14
|
-
import { u as
|
|
15
|
-
import { Score as
|
|
10
|
+
import { APPBAR_V2_HEIGHT as Le, AgentActivityV2 as xe, AiChat as Pe, AiChatDrawer as fe, AiChatFloating as Re, AiChatFloatingV2 as Me, AiChatProvider as Ue, AiChatServiceContext as ye, AiChatV2Pane as _e, AppBarV2 as De, AppRailV2 as Be, AppShellV2 as Ve, ArtifactRender as Fe, BoxedPart as be, BrainIcon as ke, ChartIcon as Ne, ChatIcon as He, ChatPane as Ge, ChatsHistoryV2 as Oe, CheckIcon as We, ChevronIcon as we, ChevronRightIcon as ze, CloseIcon as Je, CodeIcon as je, ComposerIcon as qe, DEFAULT_PART_RENDERERS as Ke, DashboardIcon as Xe, DataExplorerIcon as Ye, DelayTextComponent as Qe, EnvironmentProvider as Ze, FileIcon as $e, FunctionPart as ea, GlobeIcon as aa, HistoryIcon as ta, IDLE_TIMEOUT as sa, InertEnvironmentProvider as oa, JsxErrorBoundary as na, LIVE_TSX_DEFAULT_MAX_CHARS_FOR_FULL as ra, LastPromptsV2 as ia, LinearBackgroundProgress as ca, LinearProgressBarWithMarkers as la, ListCheckIcon as Sa, LiveJsxBlock as pa, LiveTsxConfigProvider as Aa, LlmResponseRender as Ca, LoadingDots as da, LockClosedIcon as ga, LockOpenIcon as Ia, MOBILE_NAV_DEFAULT as va, MarkdownExtended as Ea, MenuIcon as ha, Message as ma, MobileDrawerV2 as Ta, PanelIcon as ua, PauseIcon as La, PinIcon as xa, PlusIcon as Pa, PromptDateMarkers as fa, PromptV2 as Ra, RunProgressPanelV2 as Ma, RunProgressStripV2 as Ua, SearchIcon as ya, SendIcon as _a, SessionStateManagerService as Da, SparkleIcon as Ba, Sparkline as Va, StopIcon as Fa, Stopwatch as ba, SubAgentBox as ka, SubAgentBoxV2 as Na, SuspendedPart as Ha, TableIcon as Ga, TaskListV2 as Oa, TerminalIcon as Wa, TextPart as wa, ThoughtPart as za, ToolIcon as Ja, TrashIcon as ja, UiToolDispatcher as qa, UsersIcon as Ka, V2_CHART_PALETTE as Xa, WARNING_THRESHOLD as Ya, WaitingPart as Qa, classifyPart as Za, configureFriendlyMapping as $a, createAiChatSessionStore as et, createAiChatSessionStore as at, createUiToolRegistry as tt, extendDefaultScope as st, extendModuleRegistry as ot, getDefaultJsxScope as nt, getFriendlyLabel as rt, parseClientOutput as it, parseContentBlocks as ct, parseUiArgs as lt, useAiChatServices as St, useAiChatSessionStore as pt, useEnvironment as At, useEnvironmentOptional as Ct, useLiveTsxMaxCharsForFull as dt, useResponsiveLayout as gt, v2Card as It, v2Chip as vt, v2IconBtn as Et, v2MonoMeta as ht, v2SectionLabel as mt, v2Theme as Tt } from "./components.js";
|
|
11
|
+
import { u as Lt, a as xt, b as Pt, c as ft } from "./useContainerWidth-D0CQQqZ2.js";
|
|
12
|
+
import { A as Mt, a as Ut, b as yt, G as _t, d as Dt, c as Bt, e as Vt, f as Ft, g as bt, h as kt, i as Nt, j as Ht, k as Gt, l as Ot, m as Wt, n as wt, o as zt, p as Jt, q as jt, r as qt, s as Kt, t as Xt, u as Yt, v as Qt } from "./auth-BN22f1HF.js";
|
|
13
|
+
import { S as $t, c as es, a as as, e as ts, b as ss, f as os, i as ns, d as rs, p as is, g as cs, s as ls, k as Ss, t as ps } from "./atMentions-DqhG_vde.js";
|
|
14
|
+
import { u as Cs } from "./useChatSessions-DsHPo0GV.js";
|
|
15
|
+
import { Score as gs } from "./interfaces.js";
|
|
16
16
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
Mt as ALLOWED_DOMAINS,
|
|
18
|
+
Ut as ALLOWED_EMAILS,
|
|
19
19
|
F as ANALYTICS_AGENT_NAME,
|
|
20
20
|
Le as APPBAR_V2_HEIGHT,
|
|
21
|
-
|
|
21
|
+
yt as AUTH_CONFIG,
|
|
22
22
|
T as Account,
|
|
23
23
|
xe as AgentActivityV2,
|
|
24
24
|
b as AgentConfig,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
Se as AgentGatewayService,
|
|
26
|
+
pe as AgentGatewayWSAsync,
|
|
27
27
|
u as AgentKind,
|
|
28
28
|
k as AgentMode,
|
|
29
29
|
N as AgentType,
|
|
30
30
|
Pe as AiChat,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
fe as AiChatDrawer,
|
|
32
|
+
Re as AiChatFloating,
|
|
33
|
+
Me as AiChatFloatingV2,
|
|
34
|
+
Ue as AiChatProvider,
|
|
35
|
+
ye as AiChatServiceContext,
|
|
36
36
|
_e as AiChatV2Pane,
|
|
37
37
|
De as AppBarV2,
|
|
38
38
|
Be as AppRailV2,
|
|
@@ -54,8 +54,8 @@ export {
|
|
|
54
54
|
We as CheckIcon,
|
|
55
55
|
we as ChevronIcon,
|
|
56
56
|
ze as ChevronRightIcon,
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
U as ClientMessage,
|
|
58
|
+
y as ClientMessageClass,
|
|
59
59
|
Je as CloseIcon,
|
|
60
60
|
je as CodeIcon,
|
|
61
61
|
qe as ComposerIcon,
|
|
@@ -66,7 +66,7 @@ export {
|
|
|
66
66
|
Ye as DataExplorerIcon,
|
|
67
67
|
Qe as DelayTextComponent,
|
|
68
68
|
Ze as EnvironmentProvider,
|
|
69
|
-
|
|
69
|
+
Ae as EventBusService,
|
|
70
70
|
z as EventType,
|
|
71
71
|
J as EventTypeDescriptions,
|
|
72
72
|
$e as FileIcon,
|
|
@@ -78,7 +78,7 @@ export {
|
|
|
78
78
|
q as GetEventTypeFromPythonName,
|
|
79
79
|
aa as GlobeIcon,
|
|
80
80
|
ta as HistoryIcon,
|
|
81
|
-
|
|
81
|
+
Ce as HttpArtifactService,
|
|
82
82
|
me as HttpSessionService,
|
|
83
83
|
sa as IDLE_TIMEOUT,
|
|
84
84
|
oa as InertEnvironmentProvider,
|
|
@@ -89,11 +89,11 @@ export {
|
|
|
89
89
|
ia as LastPromptsV2,
|
|
90
90
|
ca as LinearBackgroundProgress,
|
|
91
91
|
la as LinearProgressBarWithMarkers,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
Sa as ListCheckIcon,
|
|
93
|
+
pa as LiveJsxBlock,
|
|
94
|
+
Aa as LiveTsxConfigProvider,
|
|
95
95
|
i as LlmEvent,
|
|
96
|
-
|
|
96
|
+
Ca as LlmResponseRender,
|
|
97
97
|
da as LoadingDots,
|
|
98
98
|
ge as LocalStorageService,
|
|
99
99
|
ga as LockClosedIcon,
|
|
@@ -111,16 +111,16 @@ export {
|
|
|
111
111
|
La as PauseIcon,
|
|
112
112
|
xa as PinIcon,
|
|
113
113
|
Pa as PlusIcon,
|
|
114
|
-
|
|
114
|
+
fa as PromptDateMarkers,
|
|
115
115
|
B as PromptUtils,
|
|
116
|
-
|
|
116
|
+
Ra as PromptV2,
|
|
117
117
|
Y as ResponseType,
|
|
118
118
|
Q as RunMode,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
Ma as RunProgressPanelV2,
|
|
120
|
+
Ua as RunProgressStripV2,
|
|
121
|
+
f as SUB_AGENT_TERMINAL_STATUSES,
|
|
122
|
+
gs as Score,
|
|
123
|
+
ya as SearchIcon,
|
|
124
124
|
_a as SendIcon,
|
|
125
125
|
c as ServerEvent,
|
|
126
126
|
Da as SessionStateManagerService,
|
|
@@ -131,16 +131,16 @@ export {
|
|
|
131
131
|
Fa as StopIcon,
|
|
132
132
|
ba as Stopwatch,
|
|
133
133
|
l as StreamingFunctionCallUpdateContent,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
S as StreamingReasoningContent,
|
|
135
|
+
p as StreamingResponse,
|
|
136
|
+
A as StreamingTextContent,
|
|
137
137
|
ka as SubAgentBox,
|
|
138
138
|
Na as SubAgentBoxV2,
|
|
139
139
|
Ha as SuspendedPart,
|
|
140
140
|
Ga as TableIcon,
|
|
141
141
|
Oa as TaskListV2,
|
|
142
142
|
Wa as TerminalIcon,
|
|
143
|
-
|
|
143
|
+
C as TextContent,
|
|
144
144
|
wa as TextPart,
|
|
145
145
|
za as ThoughtPart,
|
|
146
146
|
Ja as ToolIcon,
|
|
@@ -173,6 +173,7 @@ export {
|
|
|
173
173
|
ot as extendModuleRegistry,
|
|
174
174
|
ts as extractInteractionId,
|
|
175
175
|
ss as extractLinkAction,
|
|
176
|
+
os as fetchAtMentions,
|
|
176
177
|
Nt as getAgentBaseUrl,
|
|
177
178
|
$ as getAgentServerBaseUrl,
|
|
178
179
|
Ht as getArtifactsBaseUrl,
|
|
@@ -189,17 +190,18 @@ export {
|
|
|
189
190
|
re as getServerClientBaseUrl,
|
|
190
191
|
Wt as iconCategories,
|
|
191
192
|
wt as isBase64Encoded,
|
|
193
|
+
ns as isSectionStart,
|
|
192
194
|
ie as isServer,
|
|
193
|
-
|
|
195
|
+
R as isSubAgentTerminalStatus,
|
|
194
196
|
zt as isUriEncoded,
|
|
195
|
-
|
|
197
|
+
rs as isValidInteractionId,
|
|
196
198
|
Jt as isValidUri,
|
|
197
199
|
jt as materialIcons,
|
|
198
|
-
|
|
200
|
+
is as parseAndValidateArtifactUrl,
|
|
199
201
|
qt as parseArtifactFromJson,
|
|
200
202
|
it as parseClientOutput,
|
|
201
203
|
ct as parseContentBlocks,
|
|
202
|
-
|
|
204
|
+
cs as parseKnownNumbers,
|
|
203
205
|
lt as parseUiArgs,
|
|
204
206
|
Kt as parseUriParams,
|
|
205
207
|
ce as resolveApiUrl,
|
|
@@ -208,19 +210,19 @@ export {
|
|
|
208
210
|
h as serializeEvent,
|
|
209
211
|
Yt as setEbiContextData,
|
|
210
212
|
Qt as setEbiContextSessionId,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
ls as splitBigLinesWithSpaces,
|
|
214
|
+
Ss as startsWithInteractionId,
|
|
215
|
+
ps as tokenizeForHighlight,
|
|
216
|
+
St as useAiChatServices,
|
|
217
|
+
pt as useAiChatSessionStore,
|
|
218
|
+
Cs as useChatSessions,
|
|
217
219
|
Lt as useContainerRectangle,
|
|
218
220
|
xt as useContainerWidth,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
+
At as useEnvironment,
|
|
222
|
+
Ct as useEnvironmentOptional,
|
|
221
223
|
Pt as useInterval,
|
|
222
224
|
dt as useLiveTsxMaxCharsForFull,
|
|
223
|
-
|
|
225
|
+
ft as usePromptAssist,
|
|
224
226
|
gt as useResponsiveLayout,
|
|
225
227
|
It as v2Card,
|
|
226
228
|
vt as v2Chip,
|
|
@@ -5,6 +5,6 @@ declare class ErrorBoundary extends Component {
|
|
|
5
5
|
hasError: boolean;
|
|
6
6
|
};
|
|
7
7
|
componentDidCatch(error: any, errorInfo: any): void;
|
|
8
|
-
render(): string | number | boolean | import("react/jsx-runtime").JSX.Element |
|
|
8
|
+
render(): string | number | boolean | Iterable<import('react').ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
9
9
|
}
|
|
10
10
|
export default ErrorBoundary;
|
|
@@ -125,6 +125,14 @@ interface PromptV2Props {
|
|
|
125
125
|
* don't have to branch internally.
|
|
126
126
|
*/
|
|
127
127
|
onAtQuery?: (query: string) => Promise<PromptTriggerItem[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Issue #112 — person/passenger source for the `@` trigger (e.g. a company-directory search). When wired, an
|
|
130
|
+
* active `@` fetches BOTH this and `onAtQuery` and shows a **sectioned** dropdown (Pessoas / Locais). The
|
|
131
|
+
* section order follows the server's person-intent confidence (from `onAnalyzePrompt`): person-first when the
|
|
132
|
+
* surrounding text reads as "who travels", location-first otherwise — one anchor, no opaque relevance merge.
|
|
133
|
+
* Return `@[Name](user:id)`-style values so the agent gets the passenger id without a lookup.
|
|
134
|
+
*/
|
|
135
|
+
onAtPersonQuery?: (query: string) => Promise<PromptTriggerItem[]>;
|
|
128
136
|
/**
|
|
129
137
|
* Live prompt-assist quick path (debounced ~300ms). Given the text + caret, the server
|
|
130
138
|
* (Qwen next-word + NER) categorizes what's coming so the composer can auto-open the `@`
|
|
@@ -160,6 +168,9 @@ interface PromptV2Props {
|
|
|
160
168
|
slashColor?: string;
|
|
161
169
|
/** Sibling of `slashColor` for `@`-led tokens. */
|
|
162
170
|
atColor?: string;
|
|
171
|
+
/** Section labels for the sectioned `@` dropdown (issue #112). Defaults to pt-BR ("Pessoas" / "Locais"). */
|
|
172
|
+
atPersonLabel?: string;
|
|
173
|
+
atLocationLabel?: string;
|
|
163
174
|
/** Sibling of `slashColor` for `#`-led tokens (rendered after the
|
|
164
175
|
* user picks a date — `#YYYY-MM-DD` by default). */
|
|
165
176
|
hashColor?: string;
|
|
@@ -57,6 +57,7 @@ export declare function usePromptAssist(adapter: PromptAssistAdapter, fetchers:
|
|
|
57
57
|
resolvedLocations: string[];
|
|
58
58
|
resolvedDates: ResolvedDateItem[];
|
|
59
59
|
forceTooltipText: string;
|
|
60
|
+
personConfidence: number;
|
|
60
61
|
scheduleAssist: (value: string, caret: number, isDeletion: boolean) => void;
|
|
61
62
|
commit: (finalText: string) => void;
|
|
62
63
|
onKeyDown: (e: KeyboardEvent<HTMLTextAreaElement>) => boolean;
|
|
@@ -37,6 +37,11 @@ export interface PromptAnalysis {
|
|
|
37
37
|
* Server-owned (LocationCueDetector) — the client uses it verbatim instead of re-guessing from whitespace.
|
|
38
38
|
* Optional for back-compat with an older server (falls back to the trailing-word heuristic). */
|
|
39
39
|
locationPartial?: string;
|
|
40
|
+
/** Issue #112 — the user is referring to a PERSON/passenger (embedding classifier). `personExpected` is the
|
|
41
|
+
* server's thresholded flag; `personConfidence` ∈ [0,1] lets the `@` picker order/section its sources. Both
|
|
42
|
+
* optional for back-compat with a server that predates the classifier (absent → treated as 0/false). */
|
|
43
|
+
personExpected?: boolean;
|
|
44
|
+
personConfidence?: number;
|
|
40
45
|
}
|
|
41
46
|
/** Slow-path resolved date — `start`/`length` anchor the chip; `display` is e.g. "quarta 8 de Jul". */
|
|
42
47
|
export interface ResolvedDate {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PromptTriggerItem } from '../components/v2/PromptV2';
|
|
2
|
+
export type MentionGroup = 'person' | 'location';
|
|
3
|
+
/** A trigger item tagged with the `@` section it belongs to. Undefined `group` ⇒ render flat (single source). */
|
|
4
|
+
export type AtMentionItem = PromptTriggerItem & {
|
|
5
|
+
group?: MentionGroup;
|
|
6
|
+
};
|
|
7
|
+
export interface AtMentionFetchers {
|
|
8
|
+
/** Location source (airports / cities). */
|
|
9
|
+
onAtQuery?: (query: string) => Promise<PromptTriggerItem[]>;
|
|
10
|
+
/** Person / passenger source (company directory). */
|
|
11
|
+
onAtPersonQuery?: (query: string) => Promise<PromptTriggerItem[]>;
|
|
12
|
+
}
|
|
13
|
+
export interface AtMentionOptions {
|
|
14
|
+
/** Person-intent confidence from the analyze pass; orders the two sections. Default 0. */
|
|
15
|
+
personConfidence?: number;
|
|
16
|
+
/** Confidence at/above which the person section leads. Default 0.5. */
|
|
17
|
+
personFirstThreshold?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Fetch `@` mention items from whichever sources are wired, as one flat list. When BOTH a location and a person
|
|
21
|
+
* source are present, items are tagged with their `group` and ordered by person-intent confidence — person-first
|
|
22
|
+
* when ≥ threshold (the text reads as "who travels"), location-first otherwise — so the host can render
|
|
23
|
+
* Pessoas / Locais sections. A single wired source returns an untagged flat list (unchanged behaviour). Each
|
|
24
|
+
* source is awaited in parallel and failures are isolated: one source erroring never sinks the other.
|
|
25
|
+
*/
|
|
26
|
+
export declare function fetchAtMentions(query: string, { onAtQuery, onAtPersonQuery }: AtMentionFetchers, { personConfidence, personFirstThreshold }?: AtMentionOptions): Promise<AtMentionItem[]>;
|
|
27
|
+
/** True when `items[idx]` opens a new `@` section (its group differs from the previous item's). */
|
|
28
|
+
export declare function isSectionStart(items: AtMentionItem[], idx: number): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -17,3 +17,5 @@ export { GOOGLE_CLIENT_ID, ALLOWED_DOMAINS, ALLOWED_EMAILS, AUTH_CONFIG } from '
|
|
|
17
17
|
export { default as SortableTable } from './sortable-table';
|
|
18
18
|
export { tokenizeForHighlight, chipLocations } from './promptHighlight';
|
|
19
19
|
export type { HighlightToken } from './promptHighlight';
|
|
20
|
+
export { fetchAtMentions, isSectionStart } from './atMentions';
|
|
21
|
+
export type { AtMentionItem, MentionGroup, AtMentionFetchers, AtMentionOptions } from './atMentions';
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
var At = Object.defineProperty;
|
|
2
|
+
var v = (a, c) => At(a, "name", { value: c, configurable: !0 });
|
|
3
|
+
import { useState as b, useRef as u, useCallback as P, useEffect as K } from "react";
|
|
4
|
+
const wt = /* @__PURE__ */ v(() => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `s-${Date.now()}-${Math.random()}`, "newSessionId"), $t = /* @__PURE__ */ v((a, c, g) => {
|
|
5
|
+
var h;
|
|
6
|
+
const l = a.length;
|
|
7
|
+
let n = c;
|
|
8
|
+
for (let p = 0; p < l; p++)
|
|
9
|
+
if (n = (n + g + l) % l, !((h = a[n]) != null && h.disabled)) return n;
|
|
10
|
+
return c;
|
|
11
|
+
}, "nextEnabledIndex"), It = /* @__PURE__ */ v((a) => {
|
|
12
|
+
const c = /* @__PURE__ */ new Date();
|
|
13
|
+
c.setDate(c.getDate() + a);
|
|
14
|
+
const g = String(c.getDate()).padStart(2, "0"), l = String(c.getMonth() + 1).padStart(2, "0");
|
|
15
|
+
return `${g}/${l}/${c.getFullYear()}`;
|
|
16
|
+
}, "plusDaysBR");
|
|
17
|
+
function zt(a, c, g = {}) {
|
|
18
|
+
const [l, n] = b(null), [h, p] = b(0), [q, R] = b(!1), [A, T] = b(0), [z, ct] = b([]), [yt, st] = b([]), [bt, J] = b(""), j = u(""), B = u(null), V = u(a);
|
|
19
|
+
V.current = a;
|
|
20
|
+
const I = u(c);
|
|
21
|
+
I.current = c;
|
|
22
|
+
const it = u(g);
|
|
23
|
+
it.current = g;
|
|
24
|
+
const U = u(null), W = u(null), lt = u(0), at = u(0), X = u(null), M = u(""), F = u(null), _ = u(null), tt = u(wt()), N = u(null);
|
|
25
|
+
N.current = l;
|
|
26
|
+
const Q = u(null), ut = u(""), dt = u(() => {
|
|
27
|
+
}), Rt = P(() => n(null), []), vt = P(() => {
|
|
28
|
+
ct([]), st([]), J(""), j.current = "", F.current = null, tt.current = wt();
|
|
29
|
+
}, []), et = P((t) => {
|
|
30
|
+
if (t.disabled) return;
|
|
31
|
+
n(null);
|
|
32
|
+
const e = V.current, f = e.getTextarea();
|
|
33
|
+
if (!f) return;
|
|
34
|
+
const $ = f.selectionStart ?? f.value.length, k = f.value.slice(0, $), x = f.value.slice($), r = t.kind === "namedLocation" || t.kind === "location";
|
|
35
|
+
let o;
|
|
36
|
+
if (r) {
|
|
37
|
+
const d = ut.current, w = k.replace(/\s+$/, "");
|
|
38
|
+
o = d && w.endsWith(d) ? w.slice(0, w.length - d.length) : k;
|
|
39
|
+
} else {
|
|
40
|
+
const d = k.search(/\S+$/);
|
|
41
|
+
o = d === -1 ? k : k.slice(0, d);
|
|
42
|
+
}
|
|
43
|
+
const s = o.length > 0 && !/\s$/.test(o);
|
|
44
|
+
if (t.kind === "date") {
|
|
45
|
+
const d = `${s ? " " : ""}${t.insert} `, w = `${o}${d}${x}`;
|
|
46
|
+
e.setDraft(w), e.focusCaret(o.length + d.length), M.current = w, F.current = null, dt.current();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (t.kind === "namedLocation" && t.insert) {
|
|
50
|
+
const d = `@${t.insert.replace(/ /g, " ")}`, w = `${s ? " " : ""}${d} `;
|
|
51
|
+
e.setDraft(`${o}${w}${x}`), e.focusCaret(o.length + w.length);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const Y = t.kind === "location" ? "@" : "#", H = `${s ? " " : ""}${Y}`;
|
|
55
|
+
e.setDraft(`${o}${H}${x}`), e.focusCaret(o.length + H.length), requestAnimationFrame(() => {
|
|
56
|
+
const d = e.getTextarea();
|
|
57
|
+
d && e.syncTrigger(d);
|
|
58
|
+
});
|
|
59
|
+
}, []), nt = P(async () => {
|
|
60
|
+
var $;
|
|
61
|
+
const t = I.current.resolveDates;
|
|
62
|
+
if (!t) return;
|
|
63
|
+
const e = M.current;
|
|
64
|
+
if (e.trim() === "") {
|
|
65
|
+
F.current = null;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (e === F.current) return;
|
|
69
|
+
F.current = e, ($ = _.current) == null || $.abort();
|
|
70
|
+
const f = new AbortController();
|
|
71
|
+
_.current = f;
|
|
72
|
+
try {
|
|
73
|
+
const { dates: k, locations: x } = await t(e, tt.current, f.signal);
|
|
74
|
+
if (M.current !== e) return;
|
|
75
|
+
const r = k.filter((s) => s.display).map((s) => ({ text: s.text, display: s.display }));
|
|
76
|
+
st(r), ct(x.map((s) => s.text).filter((s) => s.trim().length > 0));
|
|
77
|
+
const o = r.map((s) => `${s.text}=${s.display}`).join("|");
|
|
78
|
+
r.length > 0 && o !== j.current && (j.current = o, J(r[r.length - 1].text), B.current != null && window.clearTimeout(B.current), B.current = window.setTimeout(() => J(""), 2e3)), r.length === 0 && (j.current = "");
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
}, []);
|
|
82
|
+
dt.current = nt;
|
|
83
|
+
const kt = P((t, e, f) => {
|
|
84
|
+
M.current = t;
|
|
85
|
+
const $ = I.current.analyze;
|
|
86
|
+
$ && (!f || N.current !== null) && (U.current != null && window.clearTimeout(U.current), U.current = window.setTimeout(async () => {
|
|
87
|
+
var x;
|
|
88
|
+
const k = ++lt.current;
|
|
89
|
+
try {
|
|
90
|
+
const r = await $(t, e);
|
|
91
|
+
if (k !== lt.current) return;
|
|
92
|
+
const o = V.current, s = o.getTextarea();
|
|
93
|
+
if (!s || s.value !== t) return;
|
|
94
|
+
p(r.personConfidence ?? 0);
|
|
95
|
+
const Y = (s.selectionStart ?? e) === t.length, H = o.hasAtQuery, d = o.isPickerOpen(), w = r.suggestions ?? [], { enableHashDatePicker: Ct = !1, datePresets: Dt = ["amanhã de manhã", "quarta-feira à noite"] } = it.current;
|
|
96
|
+
let D = r.category === "location" ? "location" : r.category === "date" ? "date" : r.locationExpected ? "location" : r.dateExpected ? "date" : null;
|
|
97
|
+
if (D !== "location" && r.locationCount < 2 && I.current.suggest && N.current !== null && Q.current === "location" && Y && /\s$/.test(t) && (D = "location"), D === "location" && r.locationCount >= 2 && r.locationPartialEmpty) {
|
|
98
|
+
n(null), Q.current = null;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (D === null || !(Y && !d && (D === "location" ? H : D === "date"))) {
|
|
102
|
+
n(null), Q.current = null;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const y = D;
|
|
106
|
+
Q.current = y;
|
|
107
|
+
const rt = /* @__PURE__ */ v(() => y === "date" && Ct ? [{ key: "cal", label: `📅 no dia #${It(2)}`, kind: "calendar" }] : [], "genericTail"), ft = w.filter((i) => i.kind === "location"), gt = w.filter((i) => i.kind === "date").map((i) => i.value), C = [];
|
|
108
|
+
if (y === "location") {
|
|
109
|
+
for (const i of ft)
|
|
110
|
+
C.push({ key: `loc:${i.value}`, label: `📍 ${i.label}`, kind: "namedLocation", insert: i.value });
|
|
111
|
+
C.push(...rt());
|
|
112
|
+
} else {
|
|
113
|
+
for (const i of gt.length > 0 ? gt : Dt)
|
|
114
|
+
C.push({ key: `date:${i}`, label: `📅 ${i}`, kind: "date", insert: i });
|
|
115
|
+
C.push(...rt());
|
|
116
|
+
}
|
|
117
|
+
const Z = I.current.suggest, St = y === "location" ? ft.length > 0 : !0;
|
|
118
|
+
if (y === "location" && !St && !Z) {
|
|
119
|
+
if (!f && r.locationExpected && r.locationPartialEmpty && r.locationCount < 2 && H && o.currentTriggerChar() !== "@") {
|
|
120
|
+
const i = s.selectionStart ?? t.length, S = t.slice(0, i), ot = S.length > 0 && !/\s$/.test(S);
|
|
121
|
+
if (!S.endsWith("@")) {
|
|
122
|
+
const E = ot ? " @" : "@";
|
|
123
|
+
n(null), o.setDraft(`${S}${E}${t.slice(i)}`), o.focusCaret(i + E.length), requestAnimationFrame(() => {
|
|
124
|
+
const G = o.getTextarea();
|
|
125
|
+
G && o.syncTrigger(G);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
n(null);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (Z ? N.current === null && C.length > 0 && (T(0), R(!0), n(C)) : C.length > 0 ? (T(0), R(!0), n(C)) : n(null), Z) {
|
|
134
|
+
const i = t.slice(0, s.selectionStart ?? t.length), S = i.search(/[ \t\r\n](?=[^ \t\r\n]*$)/), ot = S === -1 ? i : i.slice(S + 1), E = y === "location" && r.locationPartial !== void 0 ? r.locationPartial : ot;
|
|
135
|
+
y === "location" && (ut.current = E);
|
|
136
|
+
const G = y === "location" ? [...t.matchAll(/@\(([A-Za-z]{3})\)/g)].map((O) => O[1].toUpperCase()) : void 0, Pt = ++at.current;
|
|
137
|
+
(x = X.current) == null || x.abort();
|
|
138
|
+
const ht = new AbortController();
|
|
139
|
+
X.current = ht;
|
|
140
|
+
try {
|
|
141
|
+
const O = await Z(E, y, ht.signal, G);
|
|
142
|
+
if (Pt !== at.current) return;
|
|
143
|
+
const mt = o.getTextarea();
|
|
144
|
+
if (!mt || mt.value !== t || y === "location" && O.length === 0) return;
|
|
145
|
+
const L = [];
|
|
146
|
+
if (y === "location")
|
|
147
|
+
for (const m of O)
|
|
148
|
+
L.push({
|
|
149
|
+
key: `loc:${m.insert}`,
|
|
150
|
+
label: `📍 ${m.label}`,
|
|
151
|
+
kind: "namedLocation",
|
|
152
|
+
insert: m.insert,
|
|
153
|
+
hint: [m.iata, m.region, m.country].filter(Boolean).join(" · ") || void 0,
|
|
154
|
+
// parity with the `@` picker
|
|
155
|
+
disabled: m.disabled
|
|
156
|
+
// already in the prompt (same city) — greyed, not pickable
|
|
157
|
+
});
|
|
158
|
+
else
|
|
159
|
+
for (const m of O)
|
|
160
|
+
L.push({ key: `date:${m.insert}`, label: `📅 ${m.label}`, kind: "date", insert: m.insert });
|
|
161
|
+
if (L.push(...rt()), L.length === 0) {
|
|
162
|
+
n(null);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const pt = L.findIndex((m) => !m.disabled);
|
|
166
|
+
T(pt < 0 ? 0 : pt), R(E.trim() === ""), n(L);
|
|
167
|
+
} catch {
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
} catch {
|
|
171
|
+
}
|
|
172
|
+
}, 200)), W.current != null && window.clearTimeout(W.current), W.current = window.setTimeout(() => {
|
|
173
|
+
nt();
|
|
174
|
+
}, 300);
|
|
175
|
+
}, [nt]), Tt = P((t) => {
|
|
176
|
+
var f, $;
|
|
177
|
+
const e = t.trim();
|
|
178
|
+
e && (($ = (f = I.current).commitIntent) == null || $.call(f, e, tt.current));
|
|
179
|
+
}, []), xt = P((t) => {
|
|
180
|
+
if (!l || l.length === 0) return !1;
|
|
181
|
+
if (t.key === "ArrowDown")
|
|
182
|
+
return t.preventDefault(), T((e) => $t(l, e, 1)), !0;
|
|
183
|
+
if (t.key === "ArrowUp")
|
|
184
|
+
return t.preventDefault(), T((e) => $t(l, e, -1)), !0;
|
|
185
|
+
if (t.key === "Enter" || t.key === "Tab") {
|
|
186
|
+
t.preventDefault();
|
|
187
|
+
const e = l[A];
|
|
188
|
+
return e && !e.disabled && et(e), !0;
|
|
189
|
+
}
|
|
190
|
+
return t.key === "Escape" ? (t.preventDefault(), n(null), !0) : !1;
|
|
191
|
+
}, [l, A, et]);
|
|
192
|
+
return K(() => () => {
|
|
193
|
+
var t, e;
|
|
194
|
+
U.current != null && window.clearTimeout(U.current), W.current != null && window.clearTimeout(W.current), B.current != null && window.clearTimeout(B.current), (t = _.current) == null || t.abort(), (e = X.current) == null || e.abort();
|
|
195
|
+
}, []), {
|
|
196
|
+
predictions: l,
|
|
197
|
+
predictionsRecents: q,
|
|
198
|
+
predictionHighlight: A,
|
|
199
|
+
setPredictionHighlight: T,
|
|
200
|
+
applyPrediction: et,
|
|
201
|
+
clearPredictions: Rt,
|
|
202
|
+
resolvedLocations: z,
|
|
203
|
+
resolvedDates: yt,
|
|
204
|
+
forceTooltipText: bt,
|
|
205
|
+
personConfidence: h,
|
|
206
|
+
scheduleAssist: kt,
|
|
207
|
+
commit: Tt,
|
|
208
|
+
onKeyDown: xt,
|
|
209
|
+
resetSession: vt
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
v(zt, "usePromptAssist");
|
|
213
|
+
function Bt(a, c) {
|
|
214
|
+
const g = u(a), [l, n] = b(null);
|
|
215
|
+
return K(() => {
|
|
216
|
+
g.current = a;
|
|
217
|
+
}, [a]), K(() => {
|
|
218
|
+
function h() {
|
|
219
|
+
g.current();
|
|
220
|
+
}
|
|
221
|
+
if (v(h, "tick"), c !== null) {
|
|
222
|
+
const p = setInterval(h, c);
|
|
223
|
+
return n(p), () => {
|
|
224
|
+
clearInterval(p);
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}, [c]), l;
|
|
228
|
+
}
|
|
229
|
+
v(Bt, "useInterval");
|
|
230
|
+
function Ut(a, c, g = 0) {
|
|
231
|
+
const [l, n] = b(g);
|
|
232
|
+
return K(() => {
|
|
233
|
+
const h = a.current;
|
|
234
|
+
if (!h) return;
|
|
235
|
+
const p = new ResizeObserver((q) => {
|
|
236
|
+
const R = q[0];
|
|
237
|
+
R && n(R.contentRect.width);
|
|
238
|
+
});
|
|
239
|
+
return p.observe(h), n(h.getBoundingClientRect().width), () => p.disconnect();
|
|
240
|
+
}, [a, c]), l;
|
|
241
|
+
}
|
|
242
|
+
v(Ut, "useContainerWidth");
|
|
243
|
+
function Wt(a, c, g = 0, l = 0) {
|
|
244
|
+
const [n, h] = b(g), [p, q] = b(l);
|
|
245
|
+
return K(() => {
|
|
246
|
+
const R = a.current;
|
|
247
|
+
if (!R) return;
|
|
248
|
+
const A = new ResizeObserver((T) => {
|
|
249
|
+
const z = T[0];
|
|
250
|
+
z && (q(z.contentRect.height), h(z.contentRect.width));
|
|
251
|
+
});
|
|
252
|
+
return A.observe(R), h(R.getBoundingClientRect().width), () => A.disconnect();
|
|
253
|
+
}, [a, c]), [n, p];
|
|
254
|
+
}
|
|
255
|
+
v(Wt, "useContainerRectangle");
|
|
256
|
+
export {
|
|
257
|
+
Ut as a,
|
|
258
|
+
Bt as b,
|
|
259
|
+
zt as c,
|
|
260
|
+
Wt as u
|
|
261
|
+
};
|
|
262
|
+
//# sourceMappingURL=useContainerWidth-D0CQQqZ2.js.map
|