@burdenoff/fe-libs 2026.1028.4 → 2026.1028.6
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/shared/assistant/appControls/grammar.d.ts +2 -0
- package/dist/shared/assistant/appControls/grammar.js +101 -93
- package/dist/shared/assistant/appControls/registry.d.ts +2 -0
- package/dist/shared/assistant/appControls/registry.js +20 -12
- package/dist/shared/assistant/commandCompletions.d.ts +9 -0
- package/dist/shared/assistant/commandCompletions.js +161 -0
- package/dist/shared/assistant/index.d.ts +5 -0
- package/dist/shared/assistant/localUiCommands.d.ts +16 -0
- package/dist/shared/assistant/localUiCommands.js +192 -105
- package/dist/shared/assistant/localeCommands/engine.d.ts +6 -0
- package/dist/shared/assistant/localeCommands/engine.js +212 -116
- package/dist/shared/assistant/ui/AiCreditBalance.d.ts +36 -0
- package/dist/shared/assistant/ui/AiCreditBalance.js +32 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +1594 -1502
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +8 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +142 -131
- package/dist/shared/assistant/ui/draftCommandCheck.d.ts +7 -0
- package/dist/shared/assistant/ui/draftCommandCheck.js +17 -0
- package/dist/shared/assistant/uiActions/backStack.d.ts +1 -0
- package/dist/shared/assistant/uiActions/backStack.js +13 -5
- package/dist/shared/assistant/uiActions/deixis.d.ts +2 -0
- package/dist/shared/assistant/uiActions/deixis.js +12 -1
- package/dist/shared/assistant/uiActions/draftPathname.d.ts +13 -0
- package/dist/shared/assistant/uiActions/draftPathname.js +31 -0
- package/dist/shared/assistant/uiActions/recordNames.js +33 -30
- package/dist/shared/assistant/useAiCreditStatus.d.ts +18 -0
- package/dist/shared/assistant/useAiCreditStatus.js +40 -0
- package/dist/shared/providers/shell/useAssistantShellLabels.d.ts +10 -0
- package/dist/shared/providers/shell/useAssistantShellLabels.js +9 -1
- package/dist/shared-assistant.js +331 -326
- package/package.json +1 -1
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hasCommandCompletion as e } from "./commandCompletions.js";
|
|
2
2
|
import { canonical as t } from "./appControls/text.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { uiLanguageWords as n } from "./appControls/languages.js";
|
|
4
|
+
import { navTargetPath as r } from "../navigation/navTargetPath.js";
|
|
5
|
+
import { appControlPrefixPatterns as i, matchAppControl as a } from "./appControls/grammar.js";
|
|
6
|
+
import { effectiveManifest as o, isEnabled as s } from "./localeCommands/gate.js";
|
|
7
|
+
import { carriesSymbolOrEmoticon as c } from "./localeCommands/symbols.js";
|
|
8
|
+
import { couldBeLocaleCommandPrefix as l, matchLocaleIntents as u, mayBeThereOrPick as d } from "./localeCommands/engine.js";
|
|
9
|
+
import { isBackRequest as f, isThereRequest as p, navigationPrefixPatterns as m, parseChoice as h } from "./uiActions/deixis.js";
|
|
10
|
+
import { parseRecordRequest as g } from "./uiActions/recordNames.js";
|
|
9
11
|
//#region src/shared/assistant/localUiCommands.ts
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
let r = t(e).replace(
|
|
12
|
+
var _ = /^(?:(?:hey|hi|so|now|and|then|you know|just|actually|basically)\b ?|(?:please|pls|kindly)\b ?|(?:can|could|would|will) (?:you|u)\b(?: please)? ?|i (?:want|would like|d like)(?: you)?(?: to)?\b ?|let s\b ?)/, v = /^(?:(?:hey|hi|so|ok|okay)\W+)*(?:please\W+)?(?:can|could|would|will) (?:you|u)\b/i, y = (e) => /[?¿؟][^\p{L}\p{N}]*$/u.test(e), b = (e) => y(e) && !v.test(e), x = /\b(?:um+|uh+|erm|er|hmm+)\b/g, S = RegExp(`^(?:${x.source})$`), C = / (?:please|pls|for me|now|thanks|thank you|right now)$/;
|
|
13
|
+
function w(e, n = {}) {
|
|
14
|
+
let r = t(e).replace(x, " ").replace(/\s+/g, " ").replace(/\b(\w+)(?: \1\b)+/g, "$1").trim();
|
|
13
15
|
for (;;) {
|
|
14
|
-
let e = r.replace(
|
|
15
|
-
if (n.keepEnding || (e = e.replace(
|
|
16
|
+
let e = r.replace(_, "");
|
|
17
|
+
if (n.keepEnding || (e = e.replace(C, "")), e = e.trim(), e === r) return r;
|
|
16
18
|
r = e;
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
|
-
var
|
|
21
|
+
var T = {
|
|
20
22
|
light: {
|
|
21
23
|
kind: "family",
|
|
22
24
|
family: "light"
|
|
@@ -57,27 +59,27 @@ var g = {
|
|
|
57
59
|
kind: "named",
|
|
58
60
|
theme: "system"
|
|
59
61
|
}
|
|
60
|
-
},
|
|
61
|
-
{ pattern: RegExp(`^(?:${
|
|
62
|
-
{ pattern: RegExp(`^${
|
|
62
|
+
}, E = "(light|dark|forest|ocean|sunset|high contrast|highcontrast|system|device)", D = "(?:(?:the|my) )?(?:(?:app|ui|screen|display|interface|site) )?(?:theme|colou?r scheme|colou?r mode|appearance)", O = "(mode|theme|colou?r scheme|colou?r mode|appearance)", k = "(?:switch|change|set|turn|put|make|flip)", A = [
|
|
63
|
+
{ pattern: RegExp(`^(?:${k}(?: (?:over|back))? (?:to|into) |go (?:back )?to |(?:turn|switch) on |(?:use|enable|activate|apply|try|turn|switch|set) )?(?:(?:the|a) )?${E} ${O}(?: on)?$`) },
|
|
64
|
+
{ pattern: RegExp(`^${k} ${D} (?:to|into|back to) (?:(?:the|a) )?${E}(?: ${O})?$`) },
|
|
63
65
|
{ pattern: /^(?:switch|change|go)(?: back)? to (light|dark)()$/ },
|
|
64
66
|
{
|
|
65
|
-
pattern: RegExp(`^(?:(?:turn|switch) off|disable|deactivate|exit|leave) (?:the )?(light|dark) ${
|
|
67
|
+
pattern: RegExp(`^(?:(?:turn|switch) off|disable|deactivate|exit|leave) (?:the )?(light|dark) ${O}$`),
|
|
66
68
|
invert: !0
|
|
67
69
|
},
|
|
68
70
|
{
|
|
69
|
-
pattern: RegExp(`^(?:(?:turn|switch|set) )?(?:the )?(light|dark) ${
|
|
71
|
+
pattern: RegExp(`^(?:(?:turn|switch|set) )?(?:the )?(light|dark) ${O} off$`),
|
|
70
72
|
invert: !0
|
|
71
73
|
},
|
|
72
74
|
{ pattern: /^(?:set|make|change) (?:the |my )?(?:theme|appearance) (?:to )?(?:follow|match|use) (?:my|the) (device|system|os)()(?: (?:theme|appearance))?$/ },
|
|
73
75
|
{ pattern: /^(?:follow|match|use) (?:my|the) (device|system|os)() (?:theme|appearance)$/ },
|
|
74
76
|
{ pattern: /^(?:turn on|switch on|enable|use|activate|switch to) (?:the )?(high contrast|highcontrast)()$/ }
|
|
75
77
|
];
|
|
76
|
-
function
|
|
77
|
-
for (let { pattern: t, invert: n } of
|
|
78
|
+
function j(e) {
|
|
79
|
+
for (let { pattern: t, invert: n } of A) {
|
|
78
80
|
let r = t.exec(e);
|
|
79
81
|
if (!r) continue;
|
|
80
|
-
let i =
|
|
82
|
+
let i = T[r[1] ?? ""];
|
|
81
83
|
if (i) return i.kind === "named" && i.theme === "system" && r[2] === "mode" ? null : n ? i.kind === "family" ? {
|
|
82
84
|
kind: "family",
|
|
83
85
|
family: i.family === "dark" ? "light" : "dark"
|
|
@@ -85,8 +87,8 @@ function S(e) {
|
|
|
85
87
|
}
|
|
86
88
|
return null;
|
|
87
89
|
}
|
|
88
|
-
var
|
|
89
|
-
function
|
|
90
|
+
var M = /^(?:delete|remove|erase) (?:this|the|my|the current) conversation$/, N = /^(?:(?:(?:go|navigate|take me|bring me|jump|head|get me|move|switch)(?: back| over)?|back) (?:to|too)|open(?: up)?|(?:pull|bring) up|visit|show me)\s+(.+)$/, P = /^(?:the )?(.+) (?:page|screen)$/, F = /(?:^| )(?:tasks?|issues?|tickets?|orders?|invoices?|alerts?|requests?|jobs?|incidents?|bugs?|cases?|deals?|items?|questions?|sessions?|positions?|pull requests?|prs?|work orders?|approvals?|actions?|applications?)$/, I = /^(?:ai|a i|api|a p i|id|data|source|access|banking|graph|search|telemetry|stack|house|field|fields|space|market|mic)$/, L = / (?:page|screen|section|tab)$/;
|
|
91
|
+
function R(e) {
|
|
90
92
|
let n = /* @__PURE__ */ new Map(), r = (e, t) => {
|
|
91
93
|
if (!e) return;
|
|
92
94
|
let r = n.get(e) ?? [];
|
|
@@ -99,7 +101,7 @@ function k(e) {
|
|
|
99
101
|
for (let [e, t] of [...n]) for (let n of t) r(`\u0000${e.replace(/ /g, "")}`, n);
|
|
100
102
|
return n;
|
|
101
103
|
}
|
|
102
|
-
var
|
|
104
|
+
var z = new Set([
|
|
103
105
|
"news",
|
|
104
106
|
"series",
|
|
105
107
|
"species",
|
|
@@ -118,18 +120,18 @@ var A = new Set([
|
|
|
118
120
|
"process",
|
|
119
121
|
"progress"
|
|
120
122
|
]);
|
|
121
|
-
function
|
|
123
|
+
function B(e) {
|
|
122
124
|
let t = e.split(" "), n = t.pop() ?? "";
|
|
123
125
|
if (n.length < 3) return [];
|
|
124
126
|
let r = /* @__PURE__ */ new Set();
|
|
125
|
-
return
|
|
127
|
+
return z.has(n) || (/[^aeiou]ies$/.test(n) && n.length > 4 ? r.add(`${n.slice(0, -3)}y`) : /(?:sses|shes|ches|xes|zes)$/.test(n) ? r.add(n.slice(0, -2)) : n.length >= 4 && /s$/.test(n) && !/(?:ss|us|is)$/.test(n) && r.add(n.slice(0, -1))), [...r].map((e) => [...t, e].join(" "));
|
|
126
128
|
}
|
|
127
|
-
function
|
|
128
|
-
let r =
|
|
129
|
+
function V(e, t, n) {
|
|
130
|
+
let r = N.exec(e) ?? P.exec(e);
|
|
129
131
|
if (!r) return null;
|
|
130
|
-
let i = r[1] ?? "", a = e.startsWith("show me "), o = /^open /.test(e), s = i.replace(/^(?:the|my|our) /, ""), c = s.replace(
|
|
131
|
-
if (a && !l || o && s === i && !l && (
|
|
132
|
-
let u =
|
|
132
|
+
let i = r[1] ?? "", a = e.startsWith("show me "), o = /^open /.test(e), s = i.replace(/^(?:the|my|our) /, ""), c = s.replace(L, ""), l = c !== s || P.test(e);
|
|
133
|
+
if (a && !l || o && s === i && !l && (F.test(s) || I.test(s) || /^\w{1,3}$/.test(s))) return null;
|
|
134
|
+
let u = R(t), d = (e) => {
|
|
133
135
|
let t = u.get(e);
|
|
134
136
|
if (t) return {
|
|
135
137
|
key: e,
|
|
@@ -141,7 +143,7 @@ function M(e, t, n) {
|
|
|
141
143
|
list: r
|
|
142
144
|
} : void 0;
|
|
143
145
|
}, f = c === s ? [s] : [s, c], p = f.reduce((e, t) => e ?? d(t), void 0);
|
|
144
|
-
if (!p && n && (p = f.flatMap(
|
|
146
|
+
if (!p && n && (p = f.flatMap(B).reduce((e, t) => e ?? d(t), void 0)), !p || p.list.length === 0) return null;
|
|
145
147
|
let m = p.list;
|
|
146
148
|
return m.length === 1 ? {
|
|
147
149
|
kind: "navigate",
|
|
@@ -152,42 +154,127 @@ function M(e, t, n) {
|
|
|
152
154
|
candidates: m
|
|
153
155
|
};
|
|
154
156
|
}
|
|
155
|
-
var
|
|
156
|
-
function
|
|
157
|
-
let
|
|
158
|
-
return
|
|
157
|
+
var H = (e) => e === void 0 || /^en(?:[-_]|$)/i.test(e.trim());
|
|
158
|
+
function U(e, t, n = {}, r = {}) {
|
|
159
|
+
let i = o(n.commandManifest);
|
|
160
|
+
return G(e, t, n, r, s(i, "en", "frames")) || q(e, t, n, r, i);
|
|
161
|
+
}
|
|
162
|
+
function W(r, a, u = {}, d = {}) {
|
|
163
|
+
if (!r.trim()) return !0;
|
|
164
|
+
if (c(r.normalize("NFKC"))) return !1;
|
|
165
|
+
let f = /* @__PURE__ */ new Map(), p = (e) => {
|
|
166
|
+
let t = f.get(e);
|
|
167
|
+
if (t !== void 0) return t;
|
|
168
|
+
let n = U(e, a, u, d), r = n !== null && n.kind !== "open-record" && (n.kind === "theme" ? d.executors?.theme !== !1 : n.kind === "app-control" ? d.executors?.appControl?.(n.request) !== !1 : n.kind === "conversation-delete" ? d.executors?.conversationDelete !== !1 : d.executors?.navigation !== !1);
|
|
169
|
+
return f.set(e, r), r;
|
|
170
|
+
};
|
|
171
|
+
if (p(r)) return !0;
|
|
172
|
+
if (y(r.normalize("NFKC").trim())) return !1;
|
|
173
|
+
let h = o(u.commandManifest), g = H(u.locale) || s(h, "en", "frames"), v = [
|
|
174
|
+
...A.map((e) => e.pattern),
|
|
175
|
+
M,
|
|
176
|
+
N,
|
|
177
|
+
P,
|
|
178
|
+
...m(d.backRunnable === !0, g && d.navigation != null, g && d.navigation?.pendingChoice != null),
|
|
179
|
+
...g && d.controls ? i(d.controls) : []
|
|
180
|
+
], b = new Set([...R(a).keys()].map((e) => e.startsWith("\0") ? e.slice(1) : e));
|
|
181
|
+
if (H(u.locale)) for (let e of [...b]) for (let t of [
|
|
182
|
+
e + "s",
|
|
183
|
+
e + "es",
|
|
184
|
+
e.replace(/y$/, "ies")
|
|
185
|
+
]) B(t).includes(e) && b.add(t);
|
|
186
|
+
for (let e of [...b]) for (let t of [
|
|
187
|
+
"",
|
|
188
|
+
"the ",
|
|
189
|
+
"my ",
|
|
190
|
+
"our "
|
|
191
|
+
]) {
|
|
192
|
+
b.add(t + e);
|
|
193
|
+
for (let n of [
|
|
194
|
+
"page",
|
|
195
|
+
"screen",
|
|
196
|
+
"section",
|
|
197
|
+
"tab"
|
|
198
|
+
]) b.add(`${t}${e} ${n}`);
|
|
199
|
+
}
|
|
200
|
+
let x = d.controls, T = x?.page;
|
|
201
|
+
for (let e of [
|
|
202
|
+
...(x?.sidebarEntries ?? []).map((e) => e.label),
|
|
203
|
+
...(T?.tabs ?? []).map((e) => e.label),
|
|
204
|
+
...(T?.openers ?? []).map((e) => e.label),
|
|
205
|
+
...(T?.sorts ?? []).map((e) => e.label),
|
|
206
|
+
...(T?.filters ?? []).flatMap((e) => [e.label, ...e.options.map((e) => e.label)]),
|
|
207
|
+
...[
|
|
208
|
+
"en",
|
|
209
|
+
"hi",
|
|
210
|
+
"ta",
|
|
211
|
+
"es",
|
|
212
|
+
"ar",
|
|
213
|
+
"zh"
|
|
214
|
+
].flatMap((e) => n(e).flatMap((e) => [
|
|
215
|
+
e,
|
|
216
|
+
`${e} language`,
|
|
217
|
+
`the ${e}`,
|
|
218
|
+
`the ${e} language`,
|
|
219
|
+
`a ${e}`,
|
|
220
|
+
`a ${e} language`
|
|
221
|
+
]))
|
|
222
|
+
]) b.add(t(e));
|
|
223
|
+
let E = [...b].sort((e, t) => e.length - t.length), D = (t) => v.some((n) => e(n, t, {
|
|
224
|
+
maxLength: 80,
|
|
225
|
+
names: E
|
|
226
|
+
}, p)), O = w(r);
|
|
227
|
+
if (D(O)) return !0;
|
|
228
|
+
let k = O.split(" "), j = k.pop();
|
|
229
|
+
if (j && (k.at(-1)?.startsWith(j) || e(S, j, { maxLength: 80 }, () => !0)) && D(k.join(" ")) || e(_, O, { maxLength: 80 }, () => D(""))) return !0;
|
|
230
|
+
for (let t = O.lastIndexOf(" "); t >= 0; t = O.lastIndexOf(" ", t - 1)) {
|
|
231
|
+
if (e(C, O.slice(t), { maxLength: 80 }, () => p(O.slice(0, t)))) return !0;
|
|
232
|
+
if (t === 0) break;
|
|
233
|
+
}
|
|
234
|
+
return l({
|
|
235
|
+
said: r.normalize("NFKC").trim(),
|
|
236
|
+
destinations: a,
|
|
237
|
+
uiLocale: u.uiLocale ?? u.locale,
|
|
238
|
+
inputLocale: u.inputLocale ?? u.locale,
|
|
239
|
+
commandLocales: u.commandLocales,
|
|
240
|
+
manifest: h,
|
|
241
|
+
themeWords: u.themeWords,
|
|
242
|
+
navigation: d.navigation != null,
|
|
243
|
+
backRunnable: d.backRunnable === !0,
|
|
244
|
+
controls: d.controls
|
|
245
|
+
}, p);
|
|
159
246
|
}
|
|
160
|
-
function
|
|
161
|
-
let
|
|
162
|
-
if (
|
|
163
|
-
let
|
|
164
|
-
if (!
|
|
165
|
-
if (
|
|
166
|
-
let
|
|
167
|
-
if (
|
|
247
|
+
function G(e, t, n, r, i) {
|
|
248
|
+
let o = e.normalize("NFKC").trim();
|
|
249
|
+
if (c(o) || b(o)) return null;
|
|
250
|
+
let s = w(e);
|
|
251
|
+
if (!s || s.length > 80) return null;
|
|
252
|
+
if (M.test(s)) return { kind: "conversation-delete" };
|
|
253
|
+
let l = j(s);
|
|
254
|
+
if (l) return n.themeWords === "mode-only" && /\b(?:theme|appearance|colou?r scheme)\b/.test(s) && !/\b(?:app|ui|interface)\b/.test(s) ? null : {
|
|
168
255
|
kind: "theme",
|
|
169
|
-
request:
|
|
256
|
+
request: l
|
|
170
257
|
};
|
|
171
|
-
if (
|
|
172
|
-
let
|
|
173
|
-
if (
|
|
174
|
-
let
|
|
175
|
-
if (
|
|
258
|
+
if (r.backRunnable && f(s)) return { kind: "back" };
|
|
259
|
+
let u = H(n.locale), d = u || i, p = d ? r.navigation ?? null : null, m = p ? ne(s, p) : null;
|
|
260
|
+
if (m) return m;
|
|
261
|
+
let h = d && r.controls ? a(s, o, r.controls) : null;
|
|
262
|
+
if (h && !h.weak) return {
|
|
176
263
|
kind: "app-control",
|
|
177
|
-
request:
|
|
264
|
+
request: h.request
|
|
178
265
|
};
|
|
179
|
-
let
|
|
180
|
-
if (
|
|
181
|
-
if (
|
|
182
|
-
if (
|
|
183
|
-
if (
|
|
266
|
+
let _ = V(w(e, { keepEnding: !0 }), t, u) ?? V(s, t, u), v = p ? re(s, p) : null;
|
|
267
|
+
if (v && _) return Z(v, _);
|
|
268
|
+
if (v) return v;
|
|
269
|
+
if (_) return _;
|
|
270
|
+
if (h) return {
|
|
184
271
|
kind: "app-control",
|
|
185
|
-
request:
|
|
272
|
+
request: h.request
|
|
186
273
|
};
|
|
187
|
-
if (!
|
|
274
|
+
if (!r.skipRecords && d && n.records?.length) {
|
|
188
275
|
let e;
|
|
189
276
|
try {
|
|
190
|
-
e =
|
|
277
|
+
e = g(s, n.records);
|
|
191
278
|
} catch {
|
|
192
279
|
e = null;
|
|
193
280
|
}
|
|
@@ -198,13 +285,13 @@ function F(e, t, r, i, o) {
|
|
|
198
285
|
}
|
|
199
286
|
return null;
|
|
200
287
|
}
|
|
201
|
-
function
|
|
288
|
+
function K(e, t, n) {
|
|
202
289
|
if (e.theme) return {
|
|
203
290
|
kind: "theme",
|
|
204
291
|
request: e.theme
|
|
205
292
|
};
|
|
206
293
|
if (n && e.back) return { kind: "back" };
|
|
207
|
-
let r = t && e.pick ?
|
|
294
|
+
let r = t && e.pick ? Y(e.pick, t) : null;
|
|
208
295
|
if (r) return r;
|
|
209
296
|
let i = e.control;
|
|
210
297
|
if (i && !i.weak) return {
|
|
@@ -218,17 +305,17 @@ function I(e, t, n) {
|
|
|
218
305
|
kind: "choose-destination",
|
|
219
306
|
query: e.goto.query,
|
|
220
307
|
candidates: e.goto.destinations
|
|
221
|
-
} : null, o = t && e.there ?
|
|
222
|
-
return o && a ?
|
|
308
|
+
} : null, o = t && e.there ? X(t) : null;
|
|
309
|
+
return o && a ? Z(o, a) : o || a || (i ? {
|
|
223
310
|
kind: "app-control",
|
|
224
311
|
request: i.request
|
|
225
312
|
} : null);
|
|
226
313
|
}
|
|
227
|
-
function
|
|
228
|
-
let
|
|
229
|
-
if (!
|
|
230
|
-
let
|
|
231
|
-
said:
|
|
314
|
+
function q(e, t, n, r, i) {
|
|
315
|
+
let a = e.normalize("NFKC").trim();
|
|
316
|
+
if (!a || c(a)) return null;
|
|
317
|
+
let o = u({
|
|
318
|
+
said: a,
|
|
232
319
|
destinations: t,
|
|
233
320
|
uiLocale: n.uiLocale ?? n.locale,
|
|
234
321
|
inputLocale: n.inputLocale ?? n.locale,
|
|
@@ -238,32 +325,32 @@ function L(e, t, n, r, i) {
|
|
|
238
325
|
navigation: r.navigation != null,
|
|
239
326
|
backRunnable: r.backRunnable === !0,
|
|
240
327
|
controls: r.controls
|
|
241
|
-
}).map((e) =>
|
|
242
|
-
if (!
|
|
243
|
-
let
|
|
244
|
-
return
|
|
328
|
+
}).map((e) => K(e.intents, r.navigation ?? null, r.backRunnable === !0)).filter((e) => e !== null), [s] = o;
|
|
329
|
+
if (!s) return null;
|
|
330
|
+
let l = JSON.stringify(s);
|
|
331
|
+
return o.every((e) => JSON.stringify(e) === l) ? s : null;
|
|
245
332
|
}
|
|
246
|
-
function
|
|
247
|
-
let n =
|
|
248
|
-
if (
|
|
249
|
-
let
|
|
250
|
-
return !
|
|
251
|
-
said:
|
|
333
|
+
function ee(e, t = {}) {
|
|
334
|
+
let n = w(e);
|
|
335
|
+
if (p(n) || h(n) !== null) return !0;
|
|
336
|
+
let r = o(t.commandManifest), i = e.normalize("NFKC").trim();
|
|
337
|
+
return !i || c(i) ? !1 : d({
|
|
338
|
+
said: i,
|
|
252
339
|
uiLocale: t.uiLocale ?? t.locale,
|
|
253
340
|
inputLocale: t.inputLocale ?? t.locale,
|
|
254
341
|
commandLocales: t.commandLocales,
|
|
255
|
-
manifest:
|
|
342
|
+
manifest: r,
|
|
256
343
|
themeWords: t.themeWords,
|
|
257
344
|
navigation: !0,
|
|
258
345
|
backRunnable: !1
|
|
259
346
|
});
|
|
260
347
|
}
|
|
261
|
-
var
|
|
262
|
-
function
|
|
263
|
-
let n =
|
|
264
|
-
return n ?
|
|
348
|
+
var te = 4, J = (e) => ` ${t(e)} `;
|
|
349
|
+
function ne(e, t) {
|
|
350
|
+
let n = h(e);
|
|
351
|
+
return n ? Y(n, t) : null;
|
|
265
352
|
}
|
|
266
|
-
function
|
|
353
|
+
function Y(e, t) {
|
|
267
354
|
let n = t.pendingChoice;
|
|
268
355
|
if (!n) return null;
|
|
269
356
|
let r = n.candidates;
|
|
@@ -276,7 +363,7 @@ function H(e, t) {
|
|
|
276
363
|
if (e.kind === "ordinal") i = r[e.position - 1];
|
|
277
364
|
else if (e.kind === "last") i = r[r.length - 1];
|
|
278
365
|
else {
|
|
279
|
-
let t =
|
|
366
|
+
let t = J(e.context), n = r.filter((e) => e !== null && [e.context, e.group].some((e) => e !== void 0 && J(e).includes(t)));
|
|
280
367
|
i = n.length === 1 ? n[0] : void 0;
|
|
281
368
|
}
|
|
282
369
|
return i === void 0 ? {
|
|
@@ -289,10 +376,10 @@ function H(e, t) {
|
|
|
289
376
|
via: "choice"
|
|
290
377
|
};
|
|
291
378
|
}
|
|
292
|
-
function
|
|
293
|
-
return
|
|
379
|
+
function re(e, t) {
|
|
380
|
+
return p(e) ? X(t) : null;
|
|
294
381
|
}
|
|
295
|
-
function
|
|
382
|
+
function X(e) {
|
|
296
383
|
if (e.pendingChoice) return {
|
|
297
384
|
kind: "pick-from-list",
|
|
298
385
|
candidates: e.pendingChoice.candidates,
|
|
@@ -319,7 +406,7 @@ function W(e) {
|
|
|
319
406
|
candidates: t.slice(0, 4)
|
|
320
407
|
};
|
|
321
408
|
}
|
|
322
|
-
function
|
|
409
|
+
function Z(e, t) {
|
|
323
410
|
let n = (e) => e.kind === "navigate" ? [e.destination] : e.kind === "choose-linked" || e.kind === "choose-destination" ? e.candidates : null, r = n(e), i = n(t);
|
|
324
411
|
if (!r || !i) return t;
|
|
325
412
|
let a = [];
|
|
@@ -334,23 +421,23 @@ function G(e, t) {
|
|
|
334
421
|
candidates: a.slice(0, 4)
|
|
335
422
|
};
|
|
336
423
|
}
|
|
337
|
-
var
|
|
338
|
-
function
|
|
339
|
-
let
|
|
340
|
-
for (let i of
|
|
341
|
-
let
|
|
342
|
-
!
|
|
424
|
+
var ie = /^__nav_more__:/;
|
|
425
|
+
function Q(e, t) {
|
|
426
|
+
let n = [];
|
|
427
|
+
for (let i of e) {
|
|
428
|
+
let e = ie.test(i.id), a = r(i);
|
|
429
|
+
!e && i.path.startsWith("/") && !i.path.startsWith("//") && a.startsWith("/") && !a.startsWith("//") && i.label.trim() && n.push({
|
|
343
430
|
id: i.id,
|
|
344
431
|
label: i.label,
|
|
345
432
|
path: a,
|
|
346
433
|
...a === i.path ? {} : { aliases: [i.path] },
|
|
347
|
-
...
|
|
434
|
+
...t ? { context: t } : {},
|
|
348
435
|
...i.group ? { group: i.group } : {}
|
|
349
|
-
}), i.children?.length &&
|
|
436
|
+
}), i.children?.length && n.push(...Q(i.children, e ? t : i.label));
|
|
350
437
|
}
|
|
351
|
-
return
|
|
438
|
+
return n;
|
|
352
439
|
}
|
|
353
|
-
function
|
|
440
|
+
function ae(e, t) {
|
|
354
441
|
return e.kind === "family" ? {
|
|
355
442
|
alreadyApplied: t.resolvedTheme === e.family,
|
|
356
443
|
mode: e.family
|
|
@@ -359,7 +446,7 @@ function J(e, t) {
|
|
|
359
446
|
mode: e.theme
|
|
360
447
|
};
|
|
361
448
|
}
|
|
362
|
-
function
|
|
449
|
+
function $(e, t) {
|
|
363
450
|
let n = (e) => {
|
|
364
451
|
let [t = ""] = e.split("#"), [n = "", r = ""] = t.split("?"), i = n.length > 1 ? n.replace(/\/+$/, "") : n, a = new URLSearchParams(r);
|
|
365
452
|
return a.sort(), {
|
|
@@ -369,11 +456,11 @@ function Y(e, t) {
|
|
|
369
456
|
}, r = n(e), i = n(t);
|
|
370
457
|
return r.pathname === i.pathname ? r.query === "" || r.query === i.query : !1;
|
|
371
458
|
}
|
|
372
|
-
function
|
|
373
|
-
let r = [e.path, ...e.aliases ?? []].find((e) =>
|
|
374
|
-
return r === void 0 ? !1 : r.includes("?") ? !0 : !n.some((e) => e.path !== r && e.path.includes("?") &&
|
|
459
|
+
function oe(e, t, n) {
|
|
460
|
+
let r = [e.path, ...e.aliases ?? []].find((e) => $(e, t));
|
|
461
|
+
return r === void 0 ? !1 : r.includes("?") ? !0 : !n.some((e) => e.path !== r && e.path.includes("?") && se(e.path, t));
|
|
375
462
|
}
|
|
376
|
-
function
|
|
463
|
+
function se(e, t) {
|
|
377
464
|
let n = (e) => {
|
|
378
465
|
let [t = ""] = e.split("#"), [n = "", r = ""] = t.split("?");
|
|
379
466
|
return {
|
|
@@ -386,4 +473,4 @@ function Z(e, t) {
|
|
|
386
473
|
return !0;
|
|
387
474
|
}
|
|
388
475
|
//#endregion
|
|
389
|
-
export {
|
|
476
|
+
export { te as LINKED_CHOICE_MAX, W as couldBeLocalUiCommand, oe as isAlreadyThere, $ as isCurrentPath, U as matchLocalUiCommand, ee as mayBeNavigationFollowUp, Q as navDestinations, w as normaliseUtterance, ae as planThemeChange, B as singularVariants };
|
|
@@ -87,3 +87,9 @@ export declare function matchLocaleIntents(input: LocaleEngineInput): LocaleRun[
|
|
|
87
87
|
* for such a sentence, so an ordinary send never parses a reply.
|
|
88
88
|
*/
|
|
89
89
|
export declare function mayBeThereOrPick(input: Omit<LocaleEngineInput, 'destinations' | 'controls'>): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Prefixes use the same compiled frames, active tables and live names as Send.
|
|
92
|
+
* A witness is accepted only by the outer command matcher, including ambiguity
|
|
93
|
+
* and family gates. Reading a name or a frame never invokes a control handler.
|
|
94
|
+
*/
|
|
95
|
+
export declare function couldBeLocaleCommandPrefix(input: LocaleEngineInput, accepts: (completion: string) => boolean): boolean;
|