@gengage/assistant-fe 0.6.12 → 0.6.13
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/agentic/adaptor/mount.d.ts +1 -0
- package/dist/agentic/context/context-store.d.ts +2 -1
- package/dist/agentic/context/persistence.d.ts +2 -1
- package/dist/agentic/index.d.ts +3 -2
- package/dist/agentic/index.js +244 -240
- package/dist/agentic/types.d.ts +28 -20
- package/dist/agentic/util/browser-memory.d.ts +2 -2
- package/dist/agentic/util/cache-key.d.ts +15 -0
- package/dist/agentic/worker/be-client.d.ts +3 -1
- package/dist/agentic/worker.d.ts +3 -2
- package/dist/agentic/worker.js +92 -86
- package/dist/agentic.iife.js +5 -5
- package/dist/{api-paths-Cth1szY1.js → api-paths-ChCMvKkx.js} +1 -1
- package/dist/{chat-CrEa2W-e.js → chat-BP-yXukW.js} +1 -1
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +17 -17
- package/dist/chat.js +2 -2
- package/dist/common/request-response-cache.d.ts +9 -0
- package/dist/{common-CmPjQ9RK.js → common-BD_DSsqY.js} +3 -3
- package/dist/common.js +7 -7
- package/dist/{connection-warning-Bx1TJaU9.js → connection-warning-CPeEsQ35.js} +1 -1
- package/dist/{fastIntent-nZXiT9DG.js → fastIntent-C1WeEqW8.js} +1 -1
- package/dist/index.js +12 -12
- package/dist/{native-webview-BlHM7cLs.js → native-webview-DbKq9lN8.js} +1 -1
- package/dist/native.iife.js +14 -14
- package/dist/native.js +1 -1
- package/dist/overlay.js +1 -1
- package/dist/{qna-BNvttR6s.js → qna-B3lMzHvS.js} +1 -1
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +13 -13
- package/dist/qna.js +2 -2
- package/dist/request-response-cache-zsgz3Awp.js +154 -0
- package/dist/request-text-su3Vlhrs.js +1318 -0
- package/dist/{runtime-xlTFF9HS.js → runtime-Dbwwd8yF.js} +38 -37
- package/dist/{runtime-B0v76aJ5.js → runtime-DclobJaN.js} +365 -364
- package/dist/{runtime-Dt6FUotQ.js → runtime-Duvrignh.js} +69 -68
- package/dist/{simbut-pTonQlCT.js → simbut-5C5EAfoM.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-C3ZJHVIW.js → simrel-DCcSBFez.js} +3 -3
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +12 -12
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-C6H3cDSW.js → widget-base-BolzGV28.js} +1 -1
- package/package.json +1 -1
- package/dist/agentic/flow/beauty-consulting-turn.d.ts +0 -1
- package/dist/similarity-qMH5-do-.js +0 -1262
- /package/dist/{overlay-fgrzmFTR.js → overlay-CyoB1K0w.js} +0 -0
- /package/dist/{price-formatter-xI3g9Cd4.js → price-formatter-CFsWT0lP.js} +0 -0
- /package/dist/{schemas-CLo8wCjs.js → schemas-Cq2blsO_.js} +0 -0
|
@@ -0,0 +1,1318 @@
|
|
|
1
|
+
import { t as ce } from "./request-response-cache-zsgz3Awp.js";
|
|
2
|
+
function se(e) {
|
|
3
|
+
return !!e && typeof e == "object" && e.type === "rpc.result";
|
|
4
|
+
}
|
|
5
|
+
function ue(e) {
|
|
6
|
+
return !!e && typeof e == "object" && e.type === "rpc.req";
|
|
7
|
+
}
|
|
8
|
+
function yt(e = self) {
|
|
9
|
+
let t = 1;
|
|
10
|
+
const r = /* @__PURE__ */ new Map();
|
|
11
|
+
return e.addEventListener("message", (n) => {
|
|
12
|
+
const o = n.data;
|
|
13
|
+
if (!se(o)) return;
|
|
14
|
+
const i = r.get(o.rpcId);
|
|
15
|
+
if (i) {
|
|
16
|
+
if (r.delete(o.rpcId), o.ok === !1) {
|
|
17
|
+
const a = typeof o.error == "object" ? o.error?.message : o.error;
|
|
18
|
+
i.reject(new Error(a || "RPC failed"));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
i.resolve(o.value);
|
|
22
|
+
}
|
|
23
|
+
}), function(o, i, a) {
|
|
24
|
+
const c = t++;
|
|
25
|
+
return e.postMessage({
|
|
26
|
+
type: "rpc.req",
|
|
27
|
+
rpcId: c,
|
|
28
|
+
method: o,
|
|
29
|
+
payload: i
|
|
30
|
+
}, a || []), new Promise((s, u) => {
|
|
31
|
+
r.set(c, {
|
|
32
|
+
resolve: (l) => s(l),
|
|
33
|
+
reject: u
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function gt({ worker: e, tools: t = {}, beacon: r, memory: n = sessionStorage }) {
|
|
39
|
+
e.addEventListener("message", (o) => {
|
|
40
|
+
const i = o.data;
|
|
41
|
+
ue(i) && le(e, i, {
|
|
42
|
+
tools: t,
|
|
43
|
+
beacon: r,
|
|
44
|
+
memory: n
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async function le(e, t, r) {
|
|
49
|
+
try {
|
|
50
|
+
const n = await me(t.method, t.payload, r);
|
|
51
|
+
e.postMessage({
|
|
52
|
+
type: "rpc.result",
|
|
53
|
+
rpcId: t.rpcId,
|
|
54
|
+
ok: !0,
|
|
55
|
+
value: n
|
|
56
|
+
});
|
|
57
|
+
} catch (n) {
|
|
58
|
+
e.postMessage({
|
|
59
|
+
type: "rpc.result",
|
|
60
|
+
rpcId: t.rpcId,
|
|
61
|
+
ok: !1,
|
|
62
|
+
error: { message: n instanceof Error ? n.message : String(n) }
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function fe(e) {
|
|
67
|
+
if (e && typeof e == "object" && typeof e.name == "string") return e;
|
|
68
|
+
throw new Error("tool.invoke requires { name, input }");
|
|
69
|
+
}
|
|
70
|
+
function de(e) {
|
|
71
|
+
if (e && typeof e == "object" && e.key !== void 0) return e;
|
|
72
|
+
throw new Error("memory.get requires { key }");
|
|
73
|
+
}
|
|
74
|
+
function pe(e) {
|
|
75
|
+
if (e && typeof e == "object" && e.key !== void 0) return e;
|
|
76
|
+
throw new Error("memory.set requires { key }");
|
|
77
|
+
}
|
|
78
|
+
async function me(e, t, { tools: r, beacon: n, memory: o }) {
|
|
79
|
+
if (e === "tool.invoke") {
|
|
80
|
+
const { name: i, input: a } = fe(t), c = r[i];
|
|
81
|
+
if (typeof c != "function") throw new Error(`Unknown tool: ${i}`);
|
|
82
|
+
return c(a);
|
|
83
|
+
}
|
|
84
|
+
if (e === "beacon.send")
|
|
85
|
+
return n?.(t), { sent: !0 };
|
|
86
|
+
if (e === "memory.get") {
|
|
87
|
+
const { key: i } = de(t), a = o.getItem(String(i));
|
|
88
|
+
return a ? JSON.parse(a) : null;
|
|
89
|
+
}
|
|
90
|
+
if (e === "memory.set") {
|
|
91
|
+
const { key: i, value: a } = pe(t);
|
|
92
|
+
return o.setItem(String(i), JSON.stringify(a ?? null)), { ok: !0 };
|
|
93
|
+
}
|
|
94
|
+
throw new Error(`Unknown RPC method: ${e}`);
|
|
95
|
+
}
|
|
96
|
+
function ye() {
|
|
97
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
98
|
+
}
|
|
99
|
+
function O(e) {
|
|
100
|
+
return Math.max(0, Math.round(performance.now() - e));
|
|
101
|
+
}
|
|
102
|
+
function E(e) {
|
|
103
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
104
|
+
}
|
|
105
|
+
function ge(e) {
|
|
106
|
+
const { accountId: t, locale: r = "en-GB", parentUrl: n = "", threadId: o, incomingContext: i } = e, a = E(i) ? i : {}, c = E(a.thread) ? a.thread : {}, s = E(a.panel) ? a.panel : {}, u = E(a.meta) ? a.meta : {}, l = Q(a.messages), f = {
|
|
107
|
+
id: String(o || c.id || self.crypto.randomUUID()),
|
|
108
|
+
started_at: String(c.started_at || ye()),
|
|
109
|
+
extensions: E(c.extensions) ? { ...c.extensions } : {}
|
|
110
|
+
}, m = String(u.locale || r), d = String(u.parentUrl || n || typeof self < "u" && self.location?.href || "");
|
|
111
|
+
return {
|
|
112
|
+
panel: { ...s },
|
|
113
|
+
messages: l,
|
|
114
|
+
thread: f,
|
|
115
|
+
meta: {
|
|
116
|
+
locale: m,
|
|
117
|
+
parentUrl: d,
|
|
118
|
+
accountId: t
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function he(e, t) {
|
|
123
|
+
const r = Q([t])[0];
|
|
124
|
+
return r ? {
|
|
125
|
+
...e,
|
|
126
|
+
messages: [...e.messages, r].slice(-50)
|
|
127
|
+
} : e;
|
|
128
|
+
}
|
|
129
|
+
function Q(e) {
|
|
130
|
+
return Array.isArray(e) ? e.map((t) => {
|
|
131
|
+
const r = t?.role;
|
|
132
|
+
return {
|
|
133
|
+
role: r === "model" ? "assistant" : typeof r == "string" ? r : "",
|
|
134
|
+
content: String(t?.content || "")
|
|
135
|
+
};
|
|
136
|
+
}).filter((t) => (t.role === "user" || t.role === "assistant") && !!t.content).slice(-50) : [];
|
|
137
|
+
}
|
|
138
|
+
var we = "gengage:agent:context:";
|
|
139
|
+
async function ke({ accountId: e, threadId: t, rpc: r }) {
|
|
140
|
+
const n = await r("memory.get", {
|
|
141
|
+
tier: "session",
|
|
142
|
+
key: Y(e, t)
|
|
143
|
+
});
|
|
144
|
+
return n && typeof n == "object" && !Array.isArray(n) ? n : {};
|
|
145
|
+
}
|
|
146
|
+
async function be({ accountId: e, threadId: t, extensions: r, panel: n, rpc: o }) {
|
|
147
|
+
await o("memory.set", {
|
|
148
|
+
tier: "session",
|
|
149
|
+
key: Y(e, t),
|
|
150
|
+
value: {
|
|
151
|
+
thread: { extensions: r },
|
|
152
|
+
...n && Object.keys(n).length > 0 ? { panel: n } : {}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function Y(e, t) {
|
|
157
|
+
return `${we}${e}:${t}`;
|
|
158
|
+
}
|
|
159
|
+
function g(e) {
|
|
160
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
161
|
+
}
|
|
162
|
+
var ht = class {
|
|
163
|
+
#e = /* @__PURE__ */ new Map();
|
|
164
|
+
#t;
|
|
165
|
+
#n;
|
|
166
|
+
#o;
|
|
167
|
+
#r;
|
|
168
|
+
#i;
|
|
169
|
+
constructor({ accountId: e, locale: t, parentUrl: r, rpc: n, persistentPanelKeys: o = [] }) {
|
|
170
|
+
this.#t = e, this.#n = t, this.#o = r, this.#r = n, this.#i = [...new Set(o.filter(Boolean))];
|
|
171
|
+
}
|
|
172
|
+
async load(e) {
|
|
173
|
+
const t = e?.meta?.threadId || e?.session_id || e?.sessionId, r = String(t || "default"), n = this.#e.get(r);
|
|
174
|
+
if (n) return n;
|
|
175
|
+
const o = await ke({
|
|
176
|
+
accountId: this.#t,
|
|
177
|
+
threadId: r,
|
|
178
|
+
rpc: this.#r
|
|
179
|
+
}), i = ge({
|
|
180
|
+
accountId: this.#t,
|
|
181
|
+
locale: e?.locale || this.#n,
|
|
182
|
+
parentUrl: this.#o,
|
|
183
|
+
threadId: r,
|
|
184
|
+
incomingContext: xe(o, e?.context)
|
|
185
|
+
});
|
|
186
|
+
return this.#e.set(r, i), i;
|
|
187
|
+
}
|
|
188
|
+
patch(e, t) {
|
|
189
|
+
const r = String(e || "default"), n = this.#e.get(r);
|
|
190
|
+
if (!n) return null;
|
|
191
|
+
const o = X(n, typeof t == "function" ? t(n) : t);
|
|
192
|
+
return this.#e.set(r, o), o;
|
|
193
|
+
}
|
|
194
|
+
appendUserMessage(e, t) {
|
|
195
|
+
const r = String(e || "default");
|
|
196
|
+
if (!t) return this.#e.get(r) ?? null;
|
|
197
|
+
const n = this.#e.get(r);
|
|
198
|
+
if (!n) return null;
|
|
199
|
+
const o = he(n, {
|
|
200
|
+
role: "user",
|
|
201
|
+
content: t
|
|
202
|
+
});
|
|
203
|
+
return this.#e.set(r, o), o;
|
|
204
|
+
}
|
|
205
|
+
async commit(e) {
|
|
206
|
+
const t = String(e || "default"), r = this.#e.get(t);
|
|
207
|
+
return r ? (await be({
|
|
208
|
+
accountId: this.#t,
|
|
209
|
+
threadId: t,
|
|
210
|
+
extensions: r.thread.extensions,
|
|
211
|
+
panel: Se(r.panel, this.#i),
|
|
212
|
+
rpc: this.#r
|
|
213
|
+
}), r) : null;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
function Se(e, t) {
|
|
217
|
+
if (!t.length || !g(e)) return;
|
|
218
|
+
const r = {};
|
|
219
|
+
for (const n of t) Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]);
|
|
220
|
+
return r;
|
|
221
|
+
}
|
|
222
|
+
function xe(e, t) {
|
|
223
|
+
return !g(e) && !g(t) ? {} : X(g(e) ? e : {}, g(t) ? t : {});
|
|
224
|
+
}
|
|
225
|
+
function X(e, t) {
|
|
226
|
+
if (!g(t)) return e;
|
|
227
|
+
const r = e, n = t, o = g(r.panel) ? r.panel : {}, i = g(n.panel) ? n.panel : {}, a = g(r.thread) ? r.thread : {}, c = g(n.thread) ? n.thread : {}, s = g(a.extensions) ? a.extensions : {}, u = g(c.extensions) ? c.extensions : {}, l = g(r.meta) ? r.meta : {}, f = g(n.meta) ? n.meta : {};
|
|
228
|
+
return {
|
|
229
|
+
...e,
|
|
230
|
+
...t,
|
|
231
|
+
panel: {
|
|
232
|
+
...o,
|
|
233
|
+
...i
|
|
234
|
+
},
|
|
235
|
+
thread: {
|
|
236
|
+
...a,
|
|
237
|
+
...c,
|
|
238
|
+
extensions: {
|
|
239
|
+
...s,
|
|
240
|
+
...u
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
meta: {
|
|
244
|
+
...l,
|
|
245
|
+
...f
|
|
246
|
+
},
|
|
247
|
+
messages: Array.isArray(n.messages) ? n.messages.slice(-50) : e.messages ?? []
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function Z(e) {
|
|
251
|
+
const t = String.fromCharCode(...e);
|
|
252
|
+
return btoa(t).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/u, "");
|
|
253
|
+
}
|
|
254
|
+
function K(e) {
|
|
255
|
+
return Z(new TextEncoder().encode(JSON.stringify(e)));
|
|
256
|
+
}
|
|
257
|
+
async function _e({ accountId: e, devJwtSecret: t, ttlS: r = 300 }) {
|
|
258
|
+
if (!t) throw new Error("devJwtSecret is required for local agent mode.");
|
|
259
|
+
const n = Math.floor(Date.now() / 1e3), o = `${K({
|
|
260
|
+
alg: "HS256",
|
|
261
|
+
typ: "JWT"
|
|
262
|
+
})}.${K({
|
|
263
|
+
sub: e,
|
|
264
|
+
iat: n,
|
|
265
|
+
exp: n + r,
|
|
266
|
+
scope: "invoke",
|
|
267
|
+
jti: crypto.randomUUID?.() || `${n}-${Math.random()}`
|
|
268
|
+
})}`, i = await crypto.subtle.importKey("raw", new TextEncoder().encode(t), {
|
|
269
|
+
name: "HMAC",
|
|
270
|
+
hash: "SHA-256"
|
|
271
|
+
}, !1, ["sign"]), a = await crypto.subtle.sign("HMAC", i, new TextEncoder().encode(o));
|
|
272
|
+
return `${o}.${Z(new Uint8Array(a))}`;
|
|
273
|
+
}
|
|
274
|
+
function Ae({ accountId: e, devJwtSecret: t, tokenBrokerUrl: r, tokenBrokerAudience: n, refreshSkewS: o = 30, fetchImpl: i = fetch }) {
|
|
275
|
+
let a = null;
|
|
276
|
+
return async ({ signal: c, parentUrl: s } = {}) => {
|
|
277
|
+
if (t) return _e({
|
|
278
|
+
accountId: e,
|
|
279
|
+
devJwtSecret: t
|
|
280
|
+
});
|
|
281
|
+
if (!r) throw new Error("tokenBrokerUrl is required for production agent mode.");
|
|
282
|
+
const u = Math.floor(Date.now() / 1e3);
|
|
283
|
+
return a?.token && a.expiresAtS - o > u || (a = await Te({
|
|
284
|
+
accountId: e,
|
|
285
|
+
tokenBrokerUrl: r,
|
|
286
|
+
tokenBrokerAudience: n,
|
|
287
|
+
parentUrl: s,
|
|
288
|
+
signal: c,
|
|
289
|
+
fetchImpl: i
|
|
290
|
+
})), a.token;
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
async function Te({ accountId: e, tokenBrokerUrl: t, tokenBrokerAudience: r, parentUrl: n, signal: o, fetchImpl: i }) {
|
|
294
|
+
const a = await i(t, {
|
|
295
|
+
method: "POST",
|
|
296
|
+
credentials: "include",
|
|
297
|
+
headers: {
|
|
298
|
+
accept: "application/json",
|
|
299
|
+
"content-type": "application/json"
|
|
300
|
+
},
|
|
301
|
+
body: JSON.stringify({
|
|
302
|
+
accountId: e,
|
|
303
|
+
scope: "invoke",
|
|
304
|
+
audience: r || void 0,
|
|
305
|
+
parentUrl: n || void 0
|
|
306
|
+
}),
|
|
307
|
+
...o ? { signal: o } : {}
|
|
308
|
+
});
|
|
309
|
+
if (!a.ok) throw new Error(`Token broker request failed (${a.status}).`);
|
|
310
|
+
const c = await a.json(), s = c?.token || c?.jwt || c?.access_token;
|
|
311
|
+
if (!s || typeof s != "string") throw new Error("Token broker response did not include a JWT.");
|
|
312
|
+
return {
|
|
313
|
+
token: s,
|
|
314
|
+
expiresAtS: Ie(c) || Ee(s) || Math.floor(Date.now() / 1e3) + 300
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function Ie(e) {
|
|
318
|
+
const t = e?.expiresAtS ?? e?.expires_at_s ?? e?.expiresInS ?? e?.expires_in_s;
|
|
319
|
+
if (Number.isFinite(t)) return Number(t);
|
|
320
|
+
const r = e?.expiresIn ?? e?.expires_in;
|
|
321
|
+
if (Number.isFinite(r)) return Math.floor(Date.now() / 1e3) + Number(r);
|
|
322
|
+
const n = e?.expiresAt ?? e?.expires_at;
|
|
323
|
+
if (typeof n == "string") {
|
|
324
|
+
const o = Date.parse(n);
|
|
325
|
+
if (Number.isFinite(o)) return Math.floor(o / 1e3);
|
|
326
|
+
}
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
function Ee(e) {
|
|
330
|
+
try {
|
|
331
|
+
const [, t] = e.split(".");
|
|
332
|
+
if (!t) return null;
|
|
333
|
+
const r = t.replace(/-/gu, "+").replace(/_/gu, "/"), n = atob(r.padEnd(Math.ceil(r.length / 4) * 4, "=")), o = JSON.parse(n);
|
|
334
|
+
return Number.isFinite(o?.exp) ? Number(o.exp) : null;
|
|
335
|
+
} catch {
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
var q = {
|
|
340
|
+
unauthorized: {
|
|
341
|
+
code: "auth",
|
|
342
|
+
message: "Assistant authentication failed. Please retry."
|
|
343
|
+
},
|
|
344
|
+
forbidden: {
|
|
345
|
+
code: "auth",
|
|
346
|
+
message: "Assistant authentication failed. Please retry."
|
|
347
|
+
},
|
|
348
|
+
unknown_op: {
|
|
349
|
+
code: "op_unavailable",
|
|
350
|
+
message: "This assistant action is not available yet."
|
|
351
|
+
},
|
|
352
|
+
invalid_input: {
|
|
353
|
+
code: "invalid_request",
|
|
354
|
+
message: "The assistant request was not valid."
|
|
355
|
+
},
|
|
356
|
+
account_config: {
|
|
357
|
+
code: "account_config",
|
|
358
|
+
message: "Assistant configuration is unavailable."
|
|
359
|
+
},
|
|
360
|
+
upstream_llm: {
|
|
361
|
+
code: "op_failed",
|
|
362
|
+
message: "The assistant could not complete that request."
|
|
363
|
+
},
|
|
364
|
+
upstream_timeout: {
|
|
365
|
+
code: "op_timeout",
|
|
366
|
+
message: "The assistant took too long to respond."
|
|
367
|
+
},
|
|
368
|
+
schema_mismatch: {
|
|
369
|
+
code: "op_failed",
|
|
370
|
+
message: "The assistant could not complete that request."
|
|
371
|
+
},
|
|
372
|
+
rate_limited: {
|
|
373
|
+
code: "rate_limited",
|
|
374
|
+
message: "The assistant is receiving too many requests. Please retry shortly."
|
|
375
|
+
},
|
|
376
|
+
internal: {
|
|
377
|
+
code: "op_failed",
|
|
378
|
+
message: "The assistant could not complete that request."
|
|
379
|
+
},
|
|
380
|
+
payload_too_large: {
|
|
381
|
+
code: "invalid_request",
|
|
382
|
+
message: "The assistant request was too large."
|
|
383
|
+
}
|
|
384
|
+
}, v = class extends Error {
|
|
385
|
+
constructor(e, t, r = {}) {
|
|
386
|
+
super(t), this.name = "AgentError", this.code = e, this.source = r.source || "agent", r.sourceCode && (this.sourceCode = r.sourceCode), r.detail !== void 0 && (this.detail = r.detail);
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
function ee(e) {
|
|
390
|
+
const t = String(e?.code || "upstream_llm"), r = q[t] || q.upstream_llm;
|
|
391
|
+
return new v(r.code, r.message, {
|
|
392
|
+
source: "be",
|
|
393
|
+
sourceCode: t,
|
|
394
|
+
detail: e?.detail
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
function je(e, t) {
|
|
398
|
+
const r = t?.error && typeof t.error == "object" ? t.error : {};
|
|
399
|
+
return ee({
|
|
400
|
+
code: String(r.code || Oe(e)),
|
|
401
|
+
detail: r.detail
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
function wt(e) {
|
|
405
|
+
return e instanceof v ? {
|
|
406
|
+
type: "error",
|
|
407
|
+
code: e.code,
|
|
408
|
+
message: e.message
|
|
409
|
+
} : {
|
|
410
|
+
type: "error",
|
|
411
|
+
code: "agent_invoke_failed",
|
|
412
|
+
message: "The assistant could not complete that request."
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
function Oe(e) {
|
|
416
|
+
return e === 401 ? "unauthorized" : e === 403 ? "forbidden" : e === 413 ? "payload_too_large" : e === 429 ? "rate_limited" : "internal";
|
|
417
|
+
}
|
|
418
|
+
async function kt({ beUrl: e, accountId: t, devJwtSecret: r, tokenBrokerUrl: n, tokenBrokerAudience: o, jwtProvider: i, parentUrl: a, op: c, input: s, cacheTtlS: u, cacheKey: l, browserCache: f, signal: m }) {
|
|
419
|
+
const d = await (i || Ae({
|
|
420
|
+
accountId: t,
|
|
421
|
+
devJwtSecret: r,
|
|
422
|
+
tokenBrokerUrl: n,
|
|
423
|
+
tokenBrokerAudience: o
|
|
424
|
+
}))({
|
|
425
|
+
...m ? { signal: m } : {},
|
|
426
|
+
...a ? { parentUrl: a } : {}
|
|
427
|
+
}), { opDomain: h, opName: p } = Ce(c, t), A = {
|
|
428
|
+
method: "POST",
|
|
429
|
+
headers: {
|
|
430
|
+
authorization: `Bearer ${d}`,
|
|
431
|
+
"content-type": "application/json",
|
|
432
|
+
accept: "application/x-ndjson"
|
|
433
|
+
},
|
|
434
|
+
body: JSON.stringify({
|
|
435
|
+
op_domain: h,
|
|
436
|
+
op_name: p,
|
|
437
|
+
op_payload: s,
|
|
438
|
+
...u !== void 0 ? { cache_ttl_s: u } : {},
|
|
439
|
+
...l !== void 0 ? { cache_key: l } : {}
|
|
440
|
+
}),
|
|
441
|
+
...m ? { signal: m } : {}
|
|
442
|
+
}, z = `${String(e).replace(/\/+$/u, "")}/v1/execute`, M = f === !1 ? await fetch(z, A) : await ce(z, A, typeof f == "object" ? f : {});
|
|
443
|
+
if (!M.ok) throw je(M.status, await Me(M));
|
|
444
|
+
return Ne(M);
|
|
445
|
+
}
|
|
446
|
+
function Ce(e, t) {
|
|
447
|
+
if (!e || e.startsWith("-") || e.endsWith("-")) throw new Error(`Invalid BE op name: ${e}`);
|
|
448
|
+
return {
|
|
449
|
+
opDomain: Pe(t),
|
|
450
|
+
opName: e
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function Pe(e) {
|
|
454
|
+
return e.replace(/-agentic$/u, "");
|
|
455
|
+
}
|
|
456
|
+
async function Me(e) {
|
|
457
|
+
try {
|
|
458
|
+
return await e.json();
|
|
459
|
+
} catch {
|
|
460
|
+
return { error: { code: e.statusText || "internal" } };
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
async function Ne(e) {
|
|
464
|
+
const t = e.body?.getReader();
|
|
465
|
+
if (!t) throw new Error("BE response body is not readable.");
|
|
466
|
+
const r = new TextDecoder();
|
|
467
|
+
let n = "";
|
|
468
|
+
const o = {};
|
|
469
|
+
for (; ; ) {
|
|
470
|
+
const { value: a, done: c } = await t.read();
|
|
471
|
+
if (c) break;
|
|
472
|
+
n += r.decode(a, { stream: !0 });
|
|
473
|
+
let s = n.indexOf(`
|
|
474
|
+
`);
|
|
475
|
+
for (; s >= 0; ) {
|
|
476
|
+
const u = n.slice(0, s).trim();
|
|
477
|
+
n = n.slice(s + 1), u && J(JSON.parse(u), o), s = n.indexOf(`
|
|
478
|
+
`);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
const i = n.trim();
|
|
482
|
+
return i && J(JSON.parse(i), o), o;
|
|
483
|
+
}
|
|
484
|
+
function J(e, t) {
|
|
485
|
+
if (e._error) throw ee(e._error);
|
|
486
|
+
if (!e._end)
|
|
487
|
+
for (const [r, n] of Object.entries(e)) {
|
|
488
|
+
if (Object.prototype.hasOwnProperty.call(t, r)) throw new v("op_failed", `BE streamed duplicate field "${r}".`, {
|
|
489
|
+
source: "be",
|
|
490
|
+
sourceCode: "schema_mismatch"
|
|
491
|
+
});
|
|
492
|
+
t[r] = n;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
function bt(e = {}) {
|
|
496
|
+
return {
|
|
497
|
+
type: "metadata",
|
|
498
|
+
...e
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
function Be(e, t = !1, r = {}) {
|
|
502
|
+
return {
|
|
503
|
+
type: "text_chunk",
|
|
504
|
+
content: e,
|
|
505
|
+
final: t,
|
|
506
|
+
...r
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
function St(e) {
|
|
510
|
+
return {
|
|
511
|
+
type: "ui_spec",
|
|
512
|
+
...e
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
function xt(e) {
|
|
516
|
+
return {
|
|
517
|
+
type: "action",
|
|
518
|
+
action: e
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
function ve(e, t) {
|
|
522
|
+
return {
|
|
523
|
+
type: "error",
|
|
524
|
+
code: e,
|
|
525
|
+
message: t
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
function te() {
|
|
529
|
+
return { type: "done" };
|
|
530
|
+
}
|
|
531
|
+
function Re(e, t) {
|
|
532
|
+
return e[t?.type || t?.action?.type || "inputText"] || e.inputText;
|
|
533
|
+
}
|
|
534
|
+
async function _t({ request: e, accountModule: t, contextStore: r, beClient: n, toolBridge: o, emit: i, rpc: a, signal: c }) {
|
|
535
|
+
const s = performance.now(), u = await r.load(e), l = u.thread.id, f = Ge(e);
|
|
536
|
+
r.appendUserMessage(l, f);
|
|
537
|
+
const m = Re(t.flows, e);
|
|
538
|
+
if (!m)
|
|
539
|
+
return i(ve("unknown_action", `No agent flow for request type ${e?.type || "inputText"}`)), i(te()), {
|
|
540
|
+
steps: 0,
|
|
541
|
+
productSkusEmitted: []
|
|
542
|
+
};
|
|
543
|
+
const d = {
|
|
544
|
+
request: e,
|
|
545
|
+
context: r.patch(l, {}) || u,
|
|
546
|
+
bag: {},
|
|
547
|
+
accountConfig: t.accountConfig || {},
|
|
548
|
+
threadId: l,
|
|
549
|
+
steps: 0,
|
|
550
|
+
productSkusEmitted: /* @__PURE__ */ new Set(),
|
|
551
|
+
committed: !1
|
|
552
|
+
}, h = {
|
|
553
|
+
contextStore: r,
|
|
554
|
+
beClient: n,
|
|
555
|
+
toolBridge: o,
|
|
556
|
+
emit: i,
|
|
557
|
+
rpc: a,
|
|
558
|
+
adapters: t.adapters || {},
|
|
559
|
+
...c ? { signal: c } : {}
|
|
560
|
+
};
|
|
561
|
+
return await P(m, d, h), d.committed || await R(d, h), await a("beacon.send", {
|
|
562
|
+
type: "turnSummary",
|
|
563
|
+
threadId: l,
|
|
564
|
+
sessionId: e?.session_id || e?.sessionId || l,
|
|
565
|
+
accountId: t.accountId || d.context.meta.accountId,
|
|
566
|
+
steps: d.steps,
|
|
567
|
+
totalLatencyMs: O(s),
|
|
568
|
+
productSkusEmitted: [...d.productSkusEmitted]
|
|
569
|
+
}), {
|
|
570
|
+
steps: d.steps,
|
|
571
|
+
productSkusEmitted: [...d.productSkusEmitted]
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
async function P(e, t, r) {
|
|
575
|
+
for (const n of e) {
|
|
576
|
+
if (r.signal?.aborted) return;
|
|
577
|
+
t.steps += 1, await $e(n, t, r), t.context = r.contextStore.patch(t.threadId, {}) || t.context;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
async function $e(e, t, r) {
|
|
581
|
+
const n = U(t);
|
|
582
|
+
if (e.kind === "be_op") {
|
|
583
|
+
await Ue(e, t, r, n);
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
if (e.kind === "tool") {
|
|
587
|
+
await Fe(e, t, r, n);
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
if (e.kind === "adapter") {
|
|
591
|
+
await De(e, t, r, n);
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
if (e.kind === "emit") {
|
|
595
|
+
ze(e, t, r);
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
if (e.kind === "branch") {
|
|
599
|
+
await Ke(e, t, r, n);
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
if (e.kind === "parallel") {
|
|
603
|
+
await qe(e, t, r);
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
if (e.kind === "refusal") {
|
|
607
|
+
await Je(e, t, r, n);
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
e.kind === "commit" && await Le(e, t, r);
|
|
611
|
+
}
|
|
612
|
+
async function Ue(e, t, r, n) {
|
|
613
|
+
const o = performance.now();
|
|
614
|
+
let i;
|
|
615
|
+
const a = x(e.cacheTtlS, n), c = x(e.cacheKey, n), s = x(e.browserCache, n);
|
|
616
|
+
try {
|
|
617
|
+
i = await r.beClient.invoke({
|
|
618
|
+
op: e.op,
|
|
619
|
+
input: x(e.input, n),
|
|
620
|
+
...a !== void 0 ? { cacheTtlS: a } : {},
|
|
621
|
+
...c !== void 0 ? { cacheKey: c } : {},
|
|
622
|
+
...s !== void 0 ? { browserCache: s } : {},
|
|
623
|
+
...r.signal ? { signal: r.signal } : {}
|
|
624
|
+
});
|
|
625
|
+
} catch (l) {
|
|
626
|
+
const f = l, m = String(f?.sourceCode || f?.code || "unknown"), d = {
|
|
627
|
+
type: "agentOp",
|
|
628
|
+
threadId: t.threadId,
|
|
629
|
+
sessionId: t.request?.session_id || t.request?.sessionId || t.threadId,
|
|
630
|
+
accountId: t.context.meta.accountId,
|
|
631
|
+
op: e.op,
|
|
632
|
+
status: "error",
|
|
633
|
+
latencyMs: O(o),
|
|
634
|
+
errorCode: m
|
|
635
|
+
};
|
|
636
|
+
if (await r.rpc("beacon.send", d), e.onError) {
|
|
637
|
+
e.errorOut && (t.bag[e.errorOut] = l), await P(e.onError, t, r);
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
throw l;
|
|
641
|
+
}
|
|
642
|
+
e.out && (t.bag[e.out] = i), $(e, i, t, r.contextStore);
|
|
643
|
+
const u = {
|
|
644
|
+
type: "agentOp",
|
|
645
|
+
threadId: t.threadId,
|
|
646
|
+
sessionId: t.request?.session_id || t.request?.sessionId || t.threadId,
|
|
647
|
+
accountId: t.context.meta.accountId,
|
|
648
|
+
op: e.op,
|
|
649
|
+
status: "ok",
|
|
650
|
+
latencyMs: O(o)
|
|
651
|
+
};
|
|
652
|
+
await r.rpc("beacon.send", u);
|
|
653
|
+
}
|
|
654
|
+
async function Fe(e, t, r, n) {
|
|
655
|
+
const o = performance.now();
|
|
656
|
+
try {
|
|
657
|
+
const i = await r.toolBridge.invoke(e.name, x(e.input, n));
|
|
658
|
+
e.out && (t.bag[e.out] = i), $(e, i, t, r.contextStore), await r.rpc("beacon.send", {
|
|
659
|
+
type: "agentTool",
|
|
660
|
+
threadId: t.threadId,
|
|
661
|
+
sessionId: L(t),
|
|
662
|
+
accountId: t.context.meta.accountId,
|
|
663
|
+
tool: e.name,
|
|
664
|
+
status: "ok",
|
|
665
|
+
latencyMs: O(o)
|
|
666
|
+
});
|
|
667
|
+
} catch (i) {
|
|
668
|
+
const a = i;
|
|
669
|
+
if (await r.rpc("beacon.send", {
|
|
670
|
+
type: "agentTool",
|
|
671
|
+
threadId: t.threadId,
|
|
672
|
+
sessionId: L(t),
|
|
673
|
+
accountId: t.context.meta.accountId,
|
|
674
|
+
tool: e.name,
|
|
675
|
+
status: "error",
|
|
676
|
+
latencyMs: O(o),
|
|
677
|
+
errorCode: String(a?.code || a?.name || "unknown")
|
|
678
|
+
}), e.onError) {
|
|
679
|
+
e.errorOut && (t.bag[e.errorOut] = i), await P(e.onError, t, r);
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
throw i;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
async function De(e, t, r, n) {
|
|
686
|
+
const o = r.adapters?.[e.name];
|
|
687
|
+
if (typeof o != "function") throw new Error(`Unknown flow adapter: ${e.name}`);
|
|
688
|
+
const i = await o(x(e.input, n), n);
|
|
689
|
+
e.out && (t.bag[e.out] = i), $(e, i, t, r.contextStore);
|
|
690
|
+
}
|
|
691
|
+
function ze(e, t, r) {
|
|
692
|
+
const n = e.build(U(t));
|
|
693
|
+
Qe(n, t.productSkusEmitted), r.emit(n);
|
|
694
|
+
}
|
|
695
|
+
async function Ke(e, t, r, n) {
|
|
696
|
+
const o = String(x(e.on, n) || "default");
|
|
697
|
+
await P(e.cases[o] || e.cases.default || [], t, r);
|
|
698
|
+
}
|
|
699
|
+
async function qe(e, t, r) {
|
|
700
|
+
const n = e.steps.map((a) => {
|
|
701
|
+
const c = {
|
|
702
|
+
...t,
|
|
703
|
+
context: He(t.context),
|
|
704
|
+
bag: { ...t.bag },
|
|
705
|
+
productSkusEmitted: t.productSkusEmitted,
|
|
706
|
+
committed: !1
|
|
707
|
+
};
|
|
708
|
+
return P(a, c, {
|
|
709
|
+
...r,
|
|
710
|
+
contextStore: We(c)
|
|
711
|
+
}).then(() => c);
|
|
712
|
+
}), o = await Promise.all(n), i = e.merge || {};
|
|
713
|
+
for (const a of o) {
|
|
714
|
+
for (const c of i.bag || []) Object.prototype.hasOwnProperty.call(a.bag, c) && (t.bag[c] = a.bag[c]);
|
|
715
|
+
if (i.panel?.length) {
|
|
716
|
+
const c = H(a.context.panel, i.panel);
|
|
717
|
+
Object.keys(c).length && (t.context = r.contextStore.patch(t.threadId, { panel: c }) || t.context);
|
|
718
|
+
}
|
|
719
|
+
if (i.threadExtensions?.length) {
|
|
720
|
+
const c = H(a.context.thread.extensions, i.threadExtensions);
|
|
721
|
+
Object.keys(c).length && (t.context = r.contextStore.patch(t.threadId, { thread: {
|
|
722
|
+
...t.context.thread,
|
|
723
|
+
extensions: c
|
|
724
|
+
} }) || t.context);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
async function Je(e, t, r, n) {
|
|
729
|
+
r.emit(Be(x(e.message, n), !0)), await R(t, r);
|
|
730
|
+
}
|
|
731
|
+
async function Le(e, t, r) {
|
|
732
|
+
await R(t, r);
|
|
733
|
+
}
|
|
734
|
+
async function R(e, { contextStore: t, emit: r }) {
|
|
735
|
+
e.committed || (e.context = await t.commit(e.threadId) || e.context, e.committed = !0, r(te()));
|
|
736
|
+
}
|
|
737
|
+
function $(e, t, r, n) {
|
|
738
|
+
if (typeof e.patch != "function") return;
|
|
739
|
+
const o = e.patch(r.context, t, U(r));
|
|
740
|
+
o && (r.context = n.patch(r.threadId, o) || r.context);
|
|
741
|
+
}
|
|
742
|
+
function U(e) {
|
|
743
|
+
return {
|
|
744
|
+
request: e.request,
|
|
745
|
+
context: e.context,
|
|
746
|
+
bag: e.bag,
|
|
747
|
+
accountConfig: e.accountConfig
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
function L(e) {
|
|
751
|
+
return e.request?.session_id || e.request?.sessionId || e.threadId;
|
|
752
|
+
}
|
|
753
|
+
function He(e) {
|
|
754
|
+
return typeof structuredClone == "function" ? structuredClone(e) : JSON.parse(JSON.stringify(e));
|
|
755
|
+
}
|
|
756
|
+
function H(e, t) {
|
|
757
|
+
const r = {};
|
|
758
|
+
for (const n of t) Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]);
|
|
759
|
+
return r;
|
|
760
|
+
}
|
|
761
|
+
function We(e) {
|
|
762
|
+
return {
|
|
763
|
+
async load() {
|
|
764
|
+
return e.context;
|
|
765
|
+
},
|
|
766
|
+
patch(t, r) {
|
|
767
|
+
return e.context = Ve(e.context, r), e.context;
|
|
768
|
+
},
|
|
769
|
+
appendUserMessage() {
|
|
770
|
+
return e.context;
|
|
771
|
+
},
|
|
772
|
+
async commit() {
|
|
773
|
+
return e.context;
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
function Ve(e, t) {
|
|
778
|
+
return !t || typeof t != "object" ? e : {
|
|
779
|
+
...e,
|
|
780
|
+
...t,
|
|
781
|
+
panel: {
|
|
782
|
+
...e.panel || {},
|
|
783
|
+
...t.panel || {}
|
|
784
|
+
},
|
|
785
|
+
thread: {
|
|
786
|
+
...e.thread || {},
|
|
787
|
+
...t.thread || {},
|
|
788
|
+
extensions: {
|
|
789
|
+
...e.thread?.extensions || {},
|
|
790
|
+
...t.thread?.extensions || {}
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
meta: {
|
|
794
|
+
...e.meta || {},
|
|
795
|
+
...t.meta || {}
|
|
796
|
+
},
|
|
797
|
+
messages: Array.isArray(t.messages) ? t.messages.slice(-50) : e.messages
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
function x(e, t) {
|
|
801
|
+
return typeof e == "function" ? e(t) : e;
|
|
802
|
+
}
|
|
803
|
+
function Ge(e) {
|
|
804
|
+
const t = e?.payload;
|
|
805
|
+
if (typeof t == "string") return t;
|
|
806
|
+
if (t && typeof t == "object" && "text" in t) {
|
|
807
|
+
const r = t.text;
|
|
808
|
+
if (typeof r == "string") return r;
|
|
809
|
+
}
|
|
810
|
+
return typeof e?.action?.payload == "string" ? e.action.payload : typeof e?.action?.title == "string" ? e.action.title : "";
|
|
811
|
+
}
|
|
812
|
+
function Qe(e, t) {
|
|
813
|
+
const r = e, n = r.spec, o = Array.isArray(n?.items) ? n.items : void 0, i = Array.isArray(r.items) ? r.items : void 0, a = o || i;
|
|
814
|
+
if (Array.isArray(a)) {
|
|
815
|
+
for (const c of a) if (c && typeof c == "object") {
|
|
816
|
+
const s = c.sku;
|
|
817
|
+
typeof s == "string" && t.add(s);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
function At(e) {
|
|
822
|
+
return { invoke(t, r) {
|
|
823
|
+
return e("tool.invoke", {
|
|
824
|
+
name: t,
|
|
825
|
+
input: r
|
|
826
|
+
});
|
|
827
|
+
} };
|
|
828
|
+
}
|
|
829
|
+
function re(e) {
|
|
830
|
+
return e && typeof e == "object" && !Array.isArray(e) ? e : null;
|
|
831
|
+
}
|
|
832
|
+
function F(e) {
|
|
833
|
+
const t = re(e);
|
|
834
|
+
if (!t) return null;
|
|
835
|
+
const r = T(t.sku, t.SKU);
|
|
836
|
+
if (!r) return null;
|
|
837
|
+
const n = {
|
|
838
|
+
sku: r,
|
|
839
|
+
name: T(t.name, t.title, t.short_name, r) || r,
|
|
840
|
+
url: T(t.url) || ""
|
|
841
|
+
}, o = Array.isArray(t.images) ? t.images : void 0, i = T(t.imageUrl, t.image_url, t.image, o?.[0]);
|
|
842
|
+
i && (n.imageUrl = i), o && o.length > 1 && (n.images = o.filter((p) => !!p).map(String));
|
|
843
|
+
const a = j(t.price_discounted), c = j(t.price), s = a || c;
|
|
844
|
+
s > 0 && (n.price = String(s));
|
|
845
|
+
const u = a > 0 ? c : 0;
|
|
846
|
+
u > 0 && (n.originalPrice = String(u));
|
|
847
|
+
const l = T(t.brand);
|
|
848
|
+
l && (n.brand = l);
|
|
849
|
+
const f = j(t.rating);
|
|
850
|
+
f > 0 && (n.rating = f);
|
|
851
|
+
const m = j(t.review_count) || j(t.reviewCount);
|
|
852
|
+
m > 0 && (n.reviewCount = m);
|
|
853
|
+
const d = T(t.cart_code, t.cartCode);
|
|
854
|
+
d && (n.cartCode = d), typeof t.in_stock == "boolean" && (n.inStock = t.in_stock), typeof t.inStock == "boolean" && (n.inStock = t.inStock);
|
|
855
|
+
const h = t.category_names;
|
|
856
|
+
return Array.isArray(h) && (n.categoryNames = h.map(String)), n;
|
|
857
|
+
}
|
|
858
|
+
function ne(e) {
|
|
859
|
+
const t = re(e);
|
|
860
|
+
if (!t) return e;
|
|
861
|
+
const r = t.category_names, n = Array.isArray(r) ? r : void 0, o = t.images, i = Array.isArray(o) ? o : void 0, a = {
|
|
862
|
+
sku: t.sku,
|
|
863
|
+
name: t.name || t.title,
|
|
864
|
+
url: t.url,
|
|
865
|
+
price: t.price,
|
|
866
|
+
currency: t.price_currency || t.currency,
|
|
867
|
+
category: n?.[n.length - 1] ?? void 0,
|
|
868
|
+
category_names: n ? n.slice(0, 4) : void 0,
|
|
869
|
+
image: i ? i[0] : t.image,
|
|
870
|
+
in_stock: t.in_stock,
|
|
871
|
+
rating: t.rating,
|
|
872
|
+
review_count: t.review_count
|
|
873
|
+
};
|
|
874
|
+
for (const c of Object.keys(a)) a[c] === void 0 && delete a[c];
|
|
875
|
+
return a;
|
|
876
|
+
}
|
|
877
|
+
function Tt(e) {
|
|
878
|
+
return Array.isArray(e) ? e.map(ne).filter((t) => !!t) : [];
|
|
879
|
+
}
|
|
880
|
+
function T(...e) {
|
|
881
|
+
for (const t of e) if (typeof t == "string" && t.trim()) return t.trim();
|
|
882
|
+
return "";
|
|
883
|
+
}
|
|
884
|
+
function j(e) {
|
|
885
|
+
const t = Number(e);
|
|
886
|
+
return Number.isFinite(t) ? t : 0;
|
|
887
|
+
}
|
|
888
|
+
function W(e) {
|
|
889
|
+
return Array.isArray(e) ? e.map(String).filter(Boolean) : typeof e == "string" && e ? [e] : [];
|
|
890
|
+
}
|
|
891
|
+
function It(e = []) {
|
|
892
|
+
const t = {}, r = [];
|
|
893
|
+
return (Array.isArray(e) ? e.map(F).filter((n) => !!n) : []).forEach((n, o) => {
|
|
894
|
+
const i = `product-${o.toString()}`;
|
|
895
|
+
r.push(i);
|
|
896
|
+
const a = {
|
|
897
|
+
sku: n.sku,
|
|
898
|
+
product: n
|
|
899
|
+
};
|
|
900
|
+
t[i] = {
|
|
901
|
+
type: "ProductCard",
|
|
902
|
+
props: {
|
|
903
|
+
product: n,
|
|
904
|
+
index: o,
|
|
905
|
+
action: {
|
|
906
|
+
title: n.name,
|
|
907
|
+
type: "launchSingleProduct",
|
|
908
|
+
payload: a
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
};
|
|
912
|
+
}), t.root = {
|
|
913
|
+
type: "ProductGrid",
|
|
914
|
+
props: { layout: "grid" },
|
|
915
|
+
children: r
|
|
916
|
+
}, {
|
|
917
|
+
widget: "chat",
|
|
918
|
+
panelHint: "panel",
|
|
919
|
+
spec: {
|
|
920
|
+
root: "root",
|
|
921
|
+
elements: t
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
function Et(e) {
|
|
926
|
+
return {
|
|
927
|
+
widget: "chat",
|
|
928
|
+
panelHint: "panel",
|
|
929
|
+
spec: {
|
|
930
|
+
root: "root",
|
|
931
|
+
elements: { root: {
|
|
932
|
+
type: "ProductDetailsPanel",
|
|
933
|
+
props: { product: F(e) || e || {} }
|
|
934
|
+
} }
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
function jt(e = {}) {
|
|
939
|
+
const t = (e.multiple_product_details || e.products || []).map(F).filter((n) => !!n), r = e.table || {};
|
|
940
|
+
return {
|
|
941
|
+
widget: "chat",
|
|
942
|
+
panelHint: "panel",
|
|
943
|
+
spec: {
|
|
944
|
+
root: "root",
|
|
945
|
+
elements: { root: {
|
|
946
|
+
type: "ComparisonTable",
|
|
947
|
+
props: {
|
|
948
|
+
products: t,
|
|
949
|
+
recommended: t.find((n) => n.sku === e.recommended_choice_sku) || t[0],
|
|
950
|
+
attributes: Object.entries(r).map(([n, o]) => ({
|
|
951
|
+
label: n,
|
|
952
|
+
values: Array.isArray(o) ? o.map(String) : [String(o ?? "")]
|
|
953
|
+
})),
|
|
954
|
+
highlights: W(e.key_differences),
|
|
955
|
+
specialCases: W(e.special_considerations),
|
|
956
|
+
recommendedText: e.recommended_choice,
|
|
957
|
+
productActions: Object.fromEntries(t.map((n) => [n.sku, {
|
|
958
|
+
title: n.name,
|
|
959
|
+
type: "launchSingleProduct",
|
|
960
|
+
payload: {
|
|
961
|
+
sku: n.sku,
|
|
962
|
+
product: n
|
|
963
|
+
}
|
|
964
|
+
}]))
|
|
965
|
+
}
|
|
966
|
+
} }
|
|
967
|
+
}
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
function Ot(e = []) {
|
|
971
|
+
return {
|
|
972
|
+
widget: "chat",
|
|
973
|
+
panelHint: "inline",
|
|
974
|
+
spec: {
|
|
975
|
+
root: "root",
|
|
976
|
+
elements: { root: {
|
|
977
|
+
type: "ActionButtons",
|
|
978
|
+
props: { buttons: (Array.isArray(e) ? e : []).map((t) => {
|
|
979
|
+
const r = t.label || t.title || t.shortName || "", n = t.action || t.requestDetails || t.request_details;
|
|
980
|
+
return !r || !n?.type ? null : {
|
|
981
|
+
label: r,
|
|
982
|
+
action: {
|
|
983
|
+
title: r,
|
|
984
|
+
type: n.type,
|
|
985
|
+
...n.payload !== void 0 ? { payload: n.payload } : {}
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
}).filter((t) => !!t) }
|
|
989
|
+
} }
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
function Ct(e) {
|
|
994
|
+
return Object.freeze([...e]);
|
|
995
|
+
}
|
|
996
|
+
var V = /* @__PURE__ */ new Set([
|
|
997
|
+
"and",
|
|
998
|
+
"are",
|
|
999
|
+
"for",
|
|
1000
|
+
"from",
|
|
1001
|
+
"the",
|
|
1002
|
+
"with"
|
|
1003
|
+
]), Ye = {
|
|
1004
|
+
token: 0.26,
|
|
1005
|
+
keyword: 0.22,
|
|
1006
|
+
category: 0.18,
|
|
1007
|
+
facet: 0.16,
|
|
1008
|
+
color: 0.08,
|
|
1009
|
+
attribute: 0.06,
|
|
1010
|
+
price: 0.08,
|
|
1011
|
+
retrieval: 0.08
|
|
1012
|
+
}, Xe = [
|
|
1013
|
+
"amber",
|
|
1014
|
+
"beige",
|
|
1015
|
+
"black",
|
|
1016
|
+
"blue",
|
|
1017
|
+
"blush",
|
|
1018
|
+
"bronze",
|
|
1019
|
+
"brown",
|
|
1020
|
+
"cream",
|
|
1021
|
+
"gold",
|
|
1022
|
+
"green",
|
|
1023
|
+
"grey",
|
|
1024
|
+
"ivory",
|
|
1025
|
+
"lilac",
|
|
1026
|
+
"mixed",
|
|
1027
|
+
"orange",
|
|
1028
|
+
"pastel",
|
|
1029
|
+
"pink",
|
|
1030
|
+
"purple",
|
|
1031
|
+
"red",
|
|
1032
|
+
"silver",
|
|
1033
|
+
"white",
|
|
1034
|
+
"yellow"
|
|
1035
|
+
];
|
|
1036
|
+
function _(e) {
|
|
1037
|
+
return String(e ?? "").normalize("NFKD").replace(new RegExp("\\p{Diacritic}", "gu"), "").toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1038
|
+
}
|
|
1039
|
+
function w(e, t = V) {
|
|
1040
|
+
const r = t instanceof Set ? t : /* @__PURE__ */ new Set([...V, ...t]), n = /* @__PURE__ */ new Set(), o = [];
|
|
1041
|
+
for (const i of _(e).split(/\s+/u))
|
|
1042
|
+
i.length < 3 || r.has(i) || n.has(i) || (n.add(i), o.push(i));
|
|
1043
|
+
return o;
|
|
1044
|
+
}
|
|
1045
|
+
function B(e, t = {}) {
|
|
1046
|
+
if (et(e)) return e;
|
|
1047
|
+
const r = t.facetKeys, n = y(e.category_names ?? e.category), o = y(e.category_ids), i = tt(e.facet_hits), a = Object.entries(i).filter(([p]) => !r || r.some((A) => _(A) === _(p))).map(([, p]) => p), c = k(e.name, e.title), s = k(e.brand), u = t.sourceKeywords ?? [], l = [
|
|
1048
|
+
c,
|
|
1049
|
+
s,
|
|
1050
|
+
...n,
|
|
1051
|
+
...a,
|
|
1052
|
+
...y(e.promotions),
|
|
1053
|
+
k(e.description),
|
|
1054
|
+
...u
|
|
1055
|
+
].join(" "), f = w(l, t.stopWords), m = k(t.sourceProductType, ot(n, c, f), f[0]), d = b([...nt(l, Xe), ...Object.entries(i).filter(([p]) => /colou?r/iu.test(p)).flatMap(([, p]) => w(p, t.stopWords))]), h = b([...a.flatMap((p) => w(p, t.stopWords)), ...y(e.promotions).flatMap((p) => w(p, t.stopWords))]).slice(0, 24);
|
|
1056
|
+
return {
|
|
1057
|
+
sku: k(e.sku),
|
|
1058
|
+
title: c,
|
|
1059
|
+
brand: s,
|
|
1060
|
+
productType: m,
|
|
1061
|
+
categoryNames: n,
|
|
1062
|
+
categoryIds: o,
|
|
1063
|
+
facets: i,
|
|
1064
|
+
keywords: b([...u.flatMap((p) => w(p, t.stopWords)), ...f]).slice(0, 12),
|
|
1065
|
+
tokens: f,
|
|
1066
|
+
colors: d,
|
|
1067
|
+
attributes: h,
|
|
1068
|
+
price: rt(e)
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
function Pt(e, t = {}) {
|
|
1072
|
+
const r = k(e.product_type, e.productType), n = k(e.title, r, y(e.keywords).join(" ")), o = b([
|
|
1073
|
+
...y(e.keywords),
|
|
1074
|
+
...y(e.colors),
|
|
1075
|
+
...y(e.materials),
|
|
1076
|
+
...y(e.styles),
|
|
1077
|
+
...y(e.attributes)
|
|
1078
|
+
]);
|
|
1079
|
+
return B({
|
|
1080
|
+
sku: "__photo__",
|
|
1081
|
+
name: n,
|
|
1082
|
+
category_names: r ? [r] : [],
|
|
1083
|
+
facet_hits: {
|
|
1084
|
+
colors: y(e.colors).join(", "),
|
|
1085
|
+
materials: y(e.materials).join(", "),
|
|
1086
|
+
styles: y(e.styles).join(", "),
|
|
1087
|
+
attributes: y(e.attributes).join(", ")
|
|
1088
|
+
},
|
|
1089
|
+
promotions: o
|
|
1090
|
+
}, {
|
|
1091
|
+
...t,
|
|
1092
|
+
sourceProductType: r,
|
|
1093
|
+
sourceKeywords: o
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
function Mt(e, t = {}) {
|
|
1097
|
+
const r = B(e, t);
|
|
1098
|
+
return b([
|
|
1099
|
+
...t.sourceQueries ?? [],
|
|
1100
|
+
N([
|
|
1101
|
+
r.productType,
|
|
1102
|
+
...r.colors.slice(0, 1),
|
|
1103
|
+
...r.attributes.slice(0, 2)
|
|
1104
|
+
]),
|
|
1105
|
+
N([r.productType, ...r.keywords.slice(0, 3)]),
|
|
1106
|
+
N([r.categoryNames[r.categoryNames.length - 1], ...r.keywords.slice(0, 2)]),
|
|
1107
|
+
N(r.title.split(/\s+/u).slice(0, 6)),
|
|
1108
|
+
r.productType
|
|
1109
|
+
].map((n) => n.trim()).filter(Boolean)).slice(0, t.queryLimit ?? 6);
|
|
1110
|
+
}
|
|
1111
|
+
function Ze(e, t, r = {}) {
|
|
1112
|
+
const n = {
|
|
1113
|
+
...Ye,
|
|
1114
|
+
...r.weights
|
|
1115
|
+
}, o = B(t, r), i = [], a = I(e.tokens, o.tokens), c = I(e.keywords, o.tokens), s = it(e.categoryNames, o.categoryNames) || I(G(e.categoryNames), G(o.categoryNames)), u = I(e.attributes, o.attributes), l = I(e.colors, o.colors), f = I(e.attributes, o.tokens), m = at(e.price, o.price), d = ct(o.sku, r.hitCounts) > 0 ? 1 : 0, h = st(e, o), p = a * n.token + c * n.keyword + s * n.category + u * n.facet + l * n.color + f * n.attribute + m * n.price + d * n.retrieval, A = ut(h ? p : p * 0.35);
|
|
1116
|
+
return h && e.productType && e.productType === o.productType && i.push("same product type"), s > 0.4 && i.push("similar category"), u > 0.2 && i.push("matching product attributes"), l > 0 && i.push("matching colour"), m > 0.8 && i.push("similar price"), h || i.push("weaker product-type match"), {
|
|
1117
|
+
score: Number(A.toFixed(4)),
|
|
1118
|
+
reasons: i
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
function Nt(e, t, r = {}) {
|
|
1122
|
+
const n = B(e, r), o = new Set([n.sku, ...r.ignoreSkus ?? []].filter(Boolean));
|
|
1123
|
+
return t.filter((i) => {
|
|
1124
|
+
const a = k(i.sku);
|
|
1125
|
+
return a && !o.has(a);
|
|
1126
|
+
}).map((i) => {
|
|
1127
|
+
const a = Ze(n, i, r);
|
|
1128
|
+
return {
|
|
1129
|
+
...i,
|
|
1130
|
+
similarity_score: a.score,
|
|
1131
|
+
similarity_reasons: a.reasons
|
|
1132
|
+
};
|
|
1133
|
+
}).sort((i, a) => a.similarity_score - i.similarity_score).slice(0, Math.max(1, Math.min(r.limit ?? 12, 100)));
|
|
1134
|
+
}
|
|
1135
|
+
function et(e) {
|
|
1136
|
+
return !!(e && typeof e == "object" && Array.isArray(e.tokens));
|
|
1137
|
+
}
|
|
1138
|
+
function k(...e) {
|
|
1139
|
+
for (const t of e) if (typeof t == "string" && t.trim()) return t.trim();
|
|
1140
|
+
return "";
|
|
1141
|
+
}
|
|
1142
|
+
function y(e) {
|
|
1143
|
+
return Array.isArray(e) ? e.map((t) => k(t)).filter(Boolean) : typeof e == "string" && e.trim() ? e.split(/[,;/|]+/u).map((t) => t.trim()).filter(Boolean) : [];
|
|
1144
|
+
}
|
|
1145
|
+
function tt(e) {
|
|
1146
|
+
return !e || typeof e != "object" || Array.isArray(e) ? {} : Object.fromEntries(Object.entries(e).map(([t, r]) => [t, k(r)]).filter(([, t]) => t));
|
|
1147
|
+
}
|
|
1148
|
+
function rt(e) {
|
|
1149
|
+
const t = Number(e.price_discounted);
|
|
1150
|
+
if (Number.isFinite(t) && t > 0) return t;
|
|
1151
|
+
const r = Number(e.price);
|
|
1152
|
+
return Number.isFinite(r) && r > 0 ? r : 0;
|
|
1153
|
+
}
|
|
1154
|
+
function b(e) {
|
|
1155
|
+
const t = /* @__PURE__ */ new Set(), r = [];
|
|
1156
|
+
for (const n of e) {
|
|
1157
|
+
const o = _(n);
|
|
1158
|
+
!o || t.has(o) || (t.add(o), r.push(o));
|
|
1159
|
+
}
|
|
1160
|
+
return r;
|
|
1161
|
+
}
|
|
1162
|
+
function nt(e, t) {
|
|
1163
|
+
const r = ` ${_(e)} `;
|
|
1164
|
+
return t.filter((n) => r.includes(` ${_(n)} `));
|
|
1165
|
+
}
|
|
1166
|
+
function ot(e, t, r) {
|
|
1167
|
+
const n = _(e[e.length - 1] ?? e[0] ?? "");
|
|
1168
|
+
if (n) {
|
|
1169
|
+
const o = w(n), i = new Set(w(t));
|
|
1170
|
+
return o.find((a) => i.has(a)) ?? o[0] ?? n;
|
|
1171
|
+
}
|
|
1172
|
+
return r[0] ?? "";
|
|
1173
|
+
}
|
|
1174
|
+
function N(e) {
|
|
1175
|
+
return e.map((t) => _(t)).filter(Boolean).join(" ").replace(/\s+/gu, " ").trim().slice(0, 120);
|
|
1176
|
+
}
|
|
1177
|
+
function G(e) {
|
|
1178
|
+
return e.flatMap((t) => w(t));
|
|
1179
|
+
}
|
|
1180
|
+
function I(e, t) {
|
|
1181
|
+
const r = b(e), n = new Set(b(t));
|
|
1182
|
+
return r.length === 0 || n.size === 0 ? 0 : r.filter((o) => n.has(o)).length / r.length;
|
|
1183
|
+
}
|
|
1184
|
+
function it(e, t) {
|
|
1185
|
+
const r = b(e), n = new Set(b(t));
|
|
1186
|
+
return r.length === 0 || n.size === 0 ? 0 : r.filter((o) => n.has(o)).length / r.length;
|
|
1187
|
+
}
|
|
1188
|
+
function at(e, t) {
|
|
1189
|
+
return e <= 0 || t <= 0 ? 0 : Math.min(e, t) / Math.max(e, t);
|
|
1190
|
+
}
|
|
1191
|
+
function ct(e, t) {
|
|
1192
|
+
return !e || !t ? 0 : typeof t.get == "function" ? t.get(e) ?? 0 : t[e] ?? 0;
|
|
1193
|
+
}
|
|
1194
|
+
function st(e, t) {
|
|
1195
|
+
if (!e.productType || !t.productType || e.productType === t.productType) return !0;
|
|
1196
|
+
const r = new Set(w(e.productType)), n = /* @__PURE__ */ new Set([...w(t.productType), ...t.tokens]);
|
|
1197
|
+
return [...r].some((o) => n.has(o));
|
|
1198
|
+
}
|
|
1199
|
+
function ut(e) {
|
|
1200
|
+
return Math.max(0, Math.min(1, e));
|
|
1201
|
+
}
|
|
1202
|
+
function Bt(e, t, r = {}) {
|
|
1203
|
+
return `${e}:${r.version || "v2"}:${oe(t)}`;
|
|
1204
|
+
}
|
|
1205
|
+
function vt(e, t = {}) {
|
|
1206
|
+
return ie(e).map((r) => ae(typeof r == "string" ? r : r.sku, t.locale)).filter(Boolean).filter((r, n, o) => o.indexOf(r) === n).sort((r, n) => D(r, n, t.locale)).slice(0, t.limit || 16).join(",");
|
|
1207
|
+
}
|
|
1208
|
+
function Rt(e, t = {}) {
|
|
1209
|
+
return oe(ie(e).map((r) => lt(r, t)).filter((r) => !!r).sort((r, n) => D(String(r.sku || r.name || ""), String(n.sku || n.name || ""), t.locale)).slice(0, t.limit || 16));
|
|
1210
|
+
}
|
|
1211
|
+
function $t(e, t) {
|
|
1212
|
+
return S(e, t);
|
|
1213
|
+
}
|
|
1214
|
+
function oe(e) {
|
|
1215
|
+
let t = 2166136261;
|
|
1216
|
+
const r = ft(e);
|
|
1217
|
+
for (let n = 0; n < r.length; n += 1)
|
|
1218
|
+
t ^= r.charCodeAt(n), t = Math.imul(t, 16777619);
|
|
1219
|
+
return (t >>> 0).toString(36);
|
|
1220
|
+
}
|
|
1221
|
+
function lt(e, t) {
|
|
1222
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
1223
|
+
const r = e, n = t.mapProduct?.(r);
|
|
1224
|
+
if (n) return C(n);
|
|
1225
|
+
const o = ne(r);
|
|
1226
|
+
return o && typeof o == "object" && !Array.isArray(o) ? C(dt(o, t)) : null;
|
|
1227
|
+
}
|
|
1228
|
+
function ie(e) {
|
|
1229
|
+
return Array.isArray(e) ? e.filter((t) => typeof t == "string" || !!(t && typeof t == "object" && !Array.isArray(t))) : [];
|
|
1230
|
+
}
|
|
1231
|
+
function ft(e) {
|
|
1232
|
+
return JSON.stringify(C(e));
|
|
1233
|
+
}
|
|
1234
|
+
function C(e) {
|
|
1235
|
+
return Array.isArray(e) ? e.map(C) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).filter(([, t]) => t !== void 0).sort(([t], [r]) => t.localeCompare(r)).map(([t, r]) => [t, C(r)]));
|
|
1236
|
+
}
|
|
1237
|
+
function dt(e, t) {
|
|
1238
|
+
return {
|
|
1239
|
+
sku: ae(e.sku, t.locale),
|
|
1240
|
+
name: S(e.name, t.locale),
|
|
1241
|
+
url: S(e.url, t.locale),
|
|
1242
|
+
price: e.price,
|
|
1243
|
+
currency: S(e.currency, t.locale),
|
|
1244
|
+
category: S(e.category, t.locale),
|
|
1245
|
+
category_names: pt(e.category_names, t.locale, 16),
|
|
1246
|
+
image: S(e.image, t.locale),
|
|
1247
|
+
in_stock: e.in_stock,
|
|
1248
|
+
rating: e.rating,
|
|
1249
|
+
review_count: e.review_count
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
function ae(e, t) {
|
|
1253
|
+
return S(e, t).toUpperCase();
|
|
1254
|
+
}
|
|
1255
|
+
function S(e, t) {
|
|
1256
|
+
return typeof e == "string" ? e.trim().replace(/\s+/gu, " ").toLocaleLowerCase(t || void 0) : "";
|
|
1257
|
+
}
|
|
1258
|
+
function D(e, t, r) {
|
|
1259
|
+
return e.localeCompare(t, r, { numeric: !0 });
|
|
1260
|
+
}
|
|
1261
|
+
function pt(e, t, r) {
|
|
1262
|
+
return Array.isArray(e) ? e.map((n) => S(n, t)).filter(Boolean).sort((n, o) => D(n, o, t)).slice(0, r) : void 0;
|
|
1263
|
+
}
|
|
1264
|
+
function Ut(e) {
|
|
1265
|
+
const t = e?.payload;
|
|
1266
|
+
if (typeof t == "string") return t;
|
|
1267
|
+
if (t && typeof t == "object" && "text" in t) {
|
|
1268
|
+
const n = t.text;
|
|
1269
|
+
if (typeof n == "string") return n;
|
|
1270
|
+
}
|
|
1271
|
+
const r = e?.action;
|
|
1272
|
+
return r && typeof r.payload == "string" ? r.payload : r && typeof r.title == "string" ? r.title : "";
|
|
1273
|
+
}
|
|
1274
|
+
export {
|
|
1275
|
+
St as A,
|
|
1276
|
+
ye as B,
|
|
1277
|
+
_t as C,
|
|
1278
|
+
ve as D,
|
|
1279
|
+
te as E,
|
|
1280
|
+
je as F,
|
|
1281
|
+
gt as H,
|
|
1282
|
+
Ae as I,
|
|
1283
|
+
_e as L,
|
|
1284
|
+
v as M,
|
|
1285
|
+
ee as N,
|
|
1286
|
+
bt as O,
|
|
1287
|
+
wt as P,
|
|
1288
|
+
ht as R,
|
|
1289
|
+
At as S,
|
|
1290
|
+
xt as T,
|
|
1291
|
+
me as U,
|
|
1292
|
+
yt as V,
|
|
1293
|
+
Et as _,
|
|
1294
|
+
oe as a,
|
|
1295
|
+
ne as b,
|
|
1296
|
+
B as c,
|
|
1297
|
+
Nt as d,
|
|
1298
|
+
Ze as f,
|
|
1299
|
+
jt as g,
|
|
1300
|
+
Ot as h,
|
|
1301
|
+
vt as i,
|
|
1302
|
+
kt as j,
|
|
1303
|
+
Be as k,
|
|
1304
|
+
Mt as l,
|
|
1305
|
+
Ct as m,
|
|
1306
|
+
Bt as n,
|
|
1307
|
+
$t as o,
|
|
1308
|
+
w as p,
|
|
1309
|
+
Rt as r,
|
|
1310
|
+
Pt as s,
|
|
1311
|
+
Ut as t,
|
|
1312
|
+
_ as u,
|
|
1313
|
+
It as v,
|
|
1314
|
+
Re as w,
|
|
1315
|
+
Tt as x,
|
|
1316
|
+
F as y,
|
|
1317
|
+
O as z
|
|
1318
|
+
};
|