@opencx/widget-core 5.5.0 → 5.6.1
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/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +639 -618
- package/dist/index.js.map +1 -1
- package/dist/src/api/schema.d.ts +2 -0
- package/dist/src/api/schema.d.ts.map +1 -1
- package/dist/src/context/active-session-polling.ctx.d.ts +5 -1
- package/dist/src/context/active-session-polling.ctx.d.ts.map +1 -1
- package/dist/src/context/message.ctx.d.ts +7 -2
- package/dist/src/context/message.ctx.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types/messages.d.ts +5 -0
- package/dist/src/types/messages.d.ts.map +1 -1
- package/dist/src/utils/message-options.d.ts +21 -0
- package/dist/src/utils/message-options.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import
|
|
1
|
+
import oe from "lodash.isequal";
|
|
2
2
|
import { z as h } from "zod";
|
|
3
|
-
import
|
|
4
|
-
import { v4 as
|
|
5
|
-
const
|
|
3
|
+
import ne from "openapi-fetch";
|
|
4
|
+
import { v4 as K } from "uuid";
|
|
5
|
+
const F = "[opencx]", b = {
|
|
6
6
|
warn: (i, ...e) => {
|
|
7
|
-
console.warn(`${
|
|
7
|
+
console.warn(`${F} ${i}`, ...e);
|
|
8
8
|
},
|
|
9
9
|
error: (i, ...e) => {
|
|
10
|
-
console.error(`${
|
|
10
|
+
console.error(`${F} ${i}`, ...e);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
class z {
|
|
14
14
|
constructor(e) {
|
|
15
|
-
this.subscribers = /* @__PURE__ */ new Set(), this.get = () => this.state, this.set = (
|
|
16
|
-
|
|
17
|
-
}, this.setPartial = (
|
|
18
|
-
if (
|
|
19
|
-
const o = { ...this.state, ...
|
|
15
|
+
this.subscribers = /* @__PURE__ */ new Set(), this.get = () => this.state, this.set = (t) => {
|
|
16
|
+
oe(this.state, t) || (this.state = t, this.notifySubscribers(t));
|
|
17
|
+
}, this.setPartial = (t) => {
|
|
18
|
+
if (t == null) return;
|
|
19
|
+
const o = { ...this.state, ...t };
|
|
20
20
|
this.set(o);
|
|
21
21
|
}, this.reset = () => {
|
|
22
22
|
this.set(this.initialState);
|
|
23
|
-
}, this.notifySubscribers = (
|
|
23
|
+
}, this.notifySubscribers = (t) => {
|
|
24
24
|
Array.from(this.subscribers).forEach((r) => {
|
|
25
25
|
try {
|
|
26
|
-
r(
|
|
26
|
+
r(t);
|
|
27
27
|
} catch (_) {
|
|
28
28
|
b.error("state subscriber threw", _);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
}, this.subscribe = (
|
|
32
|
-
this.subscribers.delete(
|
|
31
|
+
}, this.subscribe = (t) => (this.subscribers.add(t), () => {
|
|
32
|
+
this.subscribers.delete(t);
|
|
33
33
|
}), this.state = e, this.initialState = e;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
class
|
|
36
|
+
const ie = 5e3;
|
|
37
|
+
class re {
|
|
38
38
|
constructor({
|
|
39
39
|
config: e,
|
|
40
|
-
api:
|
|
40
|
+
api: t,
|
|
41
41
|
sessionsState: o,
|
|
42
42
|
setSessions: r
|
|
43
43
|
}) {
|
|
@@ -46,64 +46,64 @@ class ie {
|
|
|
46
46
|
}, this.setViewingSessionId = (_) => {
|
|
47
47
|
this.viewingSessionId = _, this.evaluate(this.sessionsState.get().data);
|
|
48
48
|
}, this.evaluate = (_) => {
|
|
49
|
-
const
|
|
49
|
+
const s = [];
|
|
50
50
|
for (const a of _) {
|
|
51
51
|
if (a.id === this.viewingSessionId) {
|
|
52
52
|
(a.unread === !0 || a.unread === !1 && !this.reportedSessionIds.has(a.id)) && this.markViewedSessionRead(a.id);
|
|
53
53
|
continue;
|
|
54
54
|
}
|
|
55
|
-
a.unread === !0 &&
|
|
55
|
+
a.unread === !0 && s.push(a.id);
|
|
56
56
|
}
|
|
57
|
-
this.state.set({ unreadSessionIds:
|
|
57
|
+
this.state.set({ unreadSessionIds: s, count: s.length }), this.notifyCount(s.length);
|
|
58
58
|
}, this.markViewedSessionRead = (_) => {
|
|
59
59
|
if (this.readsInFlight.has(_)) return;
|
|
60
60
|
this.readsInFlight.add(_);
|
|
61
|
-
let
|
|
61
|
+
let s = !1;
|
|
62
62
|
this.api.markSessionRead({ sessionId: _ }).then(({ data: a }) => {
|
|
63
63
|
if (!a || this.disposed) return;
|
|
64
64
|
this.reportedSessionIds.add(_);
|
|
65
65
|
const n = this.sessionsState.get().data.find((c) => c.id === a.id);
|
|
66
|
-
n &&
|
|
66
|
+
n && _e(n, a) ? s = !0 : this.setSessions([a]);
|
|
67
67
|
}).catch((a) => {
|
|
68
68
|
b.warn("failed to mark the session read", {
|
|
69
69
|
sessionId: _,
|
|
70
70
|
error: a instanceof Error ? a.message : String(a)
|
|
71
71
|
}), this.scheduleRetry();
|
|
72
72
|
}).finally(() => {
|
|
73
|
-
this.readsInFlight.delete(_),
|
|
73
|
+
this.readsInFlight.delete(_), s && !this.disposed && this.evaluate(this.sessionsState.get().data);
|
|
74
74
|
});
|
|
75
75
|
}, this.scheduleRetry = () => {
|
|
76
76
|
this.retryTimer || this.disposed || (this.retryTimer = setTimeout(() => {
|
|
77
77
|
this.retryTimer = null, this.evaluate(this.sessionsState.get().data);
|
|
78
|
-
},
|
|
78
|
+
}, ie));
|
|
79
79
|
}, this.notifyCount = (_) => {
|
|
80
|
-
var
|
|
80
|
+
var s, a;
|
|
81
81
|
if (_ !== this.lastNotifiedCount) {
|
|
82
82
|
this.lastNotifiedCount = _;
|
|
83
83
|
try {
|
|
84
|
-
(a = (
|
|
84
|
+
(a = (s = this.config.hooks) == null ? void 0 : s.onUnreadCountChange) == null || a.call(s, _);
|
|
85
85
|
} catch (n) {
|
|
86
86
|
b.error("onUnreadCountChange hook failed", n);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
}, this.config = e, this.api =
|
|
89
|
+
}, this.config = e, this.api = t, this.sessionsState = o, this.setSessions = r, this.subscriptions.push(
|
|
90
90
|
o.subscribe(({ data: _ }) => this.evaluate(_))
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function _e(i, e) {
|
|
95
95
|
return new Date(i.updatedAt).getTime() > new Date(e.updatedAt).getTime();
|
|
96
96
|
}
|
|
97
|
-
const
|
|
97
|
+
const Xa = (i) => i.type === "data-keepalive", et = (i) => i.type === "data-turn-steered", U = h.object({ const: h.string(), title: h.string().optional() }), le = h.object({
|
|
98
98
|
type: h.enum(["string", "number", "integer", "boolean", "array"]),
|
|
99
99
|
title: h.string().optional(),
|
|
100
100
|
description: h.string().optional(),
|
|
101
101
|
default: h.union([h.string(), h.number(), h.boolean(), h.array(h.string())]).optional(),
|
|
102
102
|
enum: h.array(h.string()).optional(),
|
|
103
|
-
oneOf: h.array(
|
|
103
|
+
oneOf: h.array(U).optional(),
|
|
104
104
|
items: h.object({
|
|
105
105
|
enum: h.array(h.string()).optional(),
|
|
106
|
-
anyOf: h.array(
|
|
106
|
+
anyOf: h.array(U).optional()
|
|
107
107
|
}).optional(),
|
|
108
108
|
minItems: h.number().int().nonnegative().optional(),
|
|
109
109
|
maxItems: h.number().int().nonnegative().optional(),
|
|
@@ -112,7 +112,7 @@ const Ya = (i) => i.type === "data-keepalive", Qa = (i) => i.type === "data-turn
|
|
|
112
112
|
minLength: h.number().optional(),
|
|
113
113
|
maxLength: h.number().optional(),
|
|
114
114
|
format: h.string().optional()
|
|
115
|
-
}),
|
|
115
|
+
}), ce = h.array(
|
|
116
116
|
h.object({
|
|
117
117
|
id: h.string(),
|
|
118
118
|
serverId: h.string(),
|
|
@@ -122,12 +122,12 @@ const Ya = (i) => i.type === "data-keepalive", Qa = (i) => i.type === "data-turn
|
|
|
122
122
|
form: h.object({
|
|
123
123
|
message: h.string(),
|
|
124
124
|
requestedSchema: h.object({
|
|
125
|
-
properties: h.record(h.string(),
|
|
125
|
+
properties: h.record(h.string(), le),
|
|
126
126
|
required: h.array(h.string()).optional()
|
|
127
127
|
})
|
|
128
128
|
})
|
|
129
129
|
})
|
|
130
|
-
),
|
|
130
|
+
), pe = h.array(
|
|
131
131
|
h.object({
|
|
132
132
|
key: h.string(),
|
|
133
133
|
serverId: h.string(),
|
|
@@ -135,73 +135,73 @@ const Ya = (i) => i.type === "data-keepalive", Qa = (i) => i.type === "data-turn
|
|
|
135
135
|
message: h.string(),
|
|
136
136
|
toolName: h.string()
|
|
137
137
|
})
|
|
138
|
-
),
|
|
138
|
+
), de = (i) => {
|
|
139
139
|
b.error("request failed", i.error);
|
|
140
|
-
},
|
|
141
|
-
const e =
|
|
140
|
+
}, ue = (i) => {
|
|
141
|
+
const e = ne({
|
|
142
142
|
baseUrl: i.baseUrl
|
|
143
|
-
}),
|
|
143
|
+
}), t = {
|
|
144
144
|
onRequest: i.onRequest,
|
|
145
145
|
onResponse: i.onResponse,
|
|
146
|
-
onError: i.onError ||
|
|
146
|
+
onError: i.onError || de
|
|
147
147
|
};
|
|
148
|
-
return e.use(
|
|
148
|
+
return e.use(t), e;
|
|
149
149
|
};
|
|
150
|
-
class
|
|
150
|
+
class me extends Error {
|
|
151
151
|
constructor() {
|
|
152
152
|
super("This connection request expired. Preparing a new request."), this.name = "ConnectionRequestExpiredError";
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
class
|
|
155
|
+
class he extends Error {
|
|
156
156
|
constructor() {
|
|
157
157
|
super("This connection attempt is no longer available."), this.name = "ConnectionAttemptUnavailableError";
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
const
|
|
161
|
-
class
|
|
160
|
+
const ge = "/backend/widget/v5/chat/stream", ke = "/backend/widget/v5/chat/{sessionId}/stream", B = (i, e, t) => `${i.replace(/\/$/, "")}${t ? e.replace("{sessionId}", encodeURIComponent(t)) : e}`;
|
|
161
|
+
class H {
|
|
162
162
|
constructor({ config: e }) {
|
|
163
163
|
var r, _;
|
|
164
|
-
this.userToken = null, this.constructClientOptions = (
|
|
164
|
+
this.userToken = null, this.constructClientOptions = (s) => {
|
|
165
165
|
const a = this.config.apiUrl || "https://api.open.cx", n = {
|
|
166
166
|
"X-Bot-Token": this.config.token,
|
|
167
167
|
"Content-Type": "application/json",
|
|
168
168
|
Accept: "application/json",
|
|
169
|
-
Authorization:
|
|
169
|
+
Authorization: s ? `Bearer ${s}` : void 0
|
|
170
170
|
};
|
|
171
171
|
return { baseUrl: a, headers: n };
|
|
172
172
|
}, this.createOpenAPIClient = ({
|
|
173
|
-
baseUrl:
|
|
173
|
+
baseUrl: s,
|
|
174
174
|
headers: a
|
|
175
|
-
}) =>
|
|
176
|
-
baseUrl:
|
|
175
|
+
}) => ue({
|
|
176
|
+
baseUrl: s,
|
|
177
177
|
onRequest: ({ request: n }) => {
|
|
178
178
|
Object.entries(a).forEach(([c, d]) => {
|
|
179
179
|
d && n.headers.set(c, d);
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
}), this.listApprovalPreferences = async () => {
|
|
183
|
-
const { baseUrl:
|
|
184
|
-
`${
|
|
183
|
+
const { baseUrl: s, headers: a } = this.getStreamAuthContext(), n = await fetch(
|
|
184
|
+
`${s}/backend/widget/v5/connections/approval-preferences`,
|
|
185
185
|
{ headers: a }
|
|
186
186
|
);
|
|
187
187
|
if (!n.ok) throw new Error("Could not load permissions.");
|
|
188
|
-
return
|
|
189
|
-
}, this.revokeApprovalPreference = async (
|
|
188
|
+
return pe.parse(await n.json());
|
|
189
|
+
}, this.revokeApprovalPreference = async (s, a) => {
|
|
190
190
|
const { baseUrl: n, headers: c } = this.getStreamAuthContext();
|
|
191
191
|
if (!(await fetch(
|
|
192
|
-
`${n}/backend/widget/v5/connections/${encodeURIComponent(
|
|
192
|
+
`${n}/backend/widget/v5/connections/${encodeURIComponent(s)}/approval-preferences/${encodeURIComponent(a)}`,
|
|
193
193
|
{ method: "DELETE", headers: c }
|
|
194
194
|
)).ok) throw new Error("Could not reset permission.");
|
|
195
|
-
}, this.listElicitations = async (
|
|
195
|
+
}, this.listElicitations = async (s, a) => {
|
|
196
196
|
const { baseUrl: n, headers: c } = this.getStreamAuthContext(), d = await fetch(
|
|
197
|
-
`${n}/backend/widget/v5/connections/elicitation/${encodeURIComponent(
|
|
197
|
+
`${n}/backend/widget/v5/connections/elicitation/${encodeURIComponent(s)}`,
|
|
198
198
|
{ headers: c, signal: a }
|
|
199
199
|
);
|
|
200
200
|
if (!d.ok) throw new Error("Could not load the request.");
|
|
201
|
-
return
|
|
202
|
-
}, this.answerElicitation = async (
|
|
201
|
+
return ce.parse(await d.json());
|
|
202
|
+
}, this.answerElicitation = async (s, a, n) => {
|
|
203
203
|
const { baseUrl: c, headers: d } = this.getStreamAuthContext(), l = await fetch(
|
|
204
|
-
`${c}/backend/widget/v5/connections/elicitation/${encodeURIComponent(
|
|
204
|
+
`${c}/backend/widget/v5/connections/elicitation/${encodeURIComponent(s)}/${encodeURIComponent(a)}`,
|
|
205
205
|
{
|
|
206
206
|
method: "POST",
|
|
207
207
|
headers: { ...d, "Content-Type": "application/json" },
|
|
@@ -212,87 +212,87 @@ class B {
|
|
|
212
212
|
throw new Error(
|
|
213
213
|
l.status === 400 ? "Check your answers and try again." : "This request has ended. Ask the agent to try again."
|
|
214
214
|
);
|
|
215
|
-
}, this.listConnections = async (
|
|
215
|
+
}, this.listConnections = async (s) => {
|
|
216
216
|
const { data: a, error: n } = await this.client.GET(
|
|
217
217
|
"/backend/widget/v5/connections",
|
|
218
|
-
{ signal:
|
|
218
|
+
{ signal: s }
|
|
219
219
|
);
|
|
220
220
|
if (n || !a)
|
|
221
221
|
throw new Error("Could not load connections. Sign in and try again.");
|
|
222
222
|
return a;
|
|
223
|
-
}, this.startConnection = async (
|
|
223
|
+
}, this.startConnection = async (s, a, n) => {
|
|
224
224
|
const { data: c, error: d, response: l } = await this.client.POST(
|
|
225
225
|
"/backend/widget/v5/connections/{serverId}/start",
|
|
226
226
|
{
|
|
227
|
-
params: { path: { serverId:
|
|
227
|
+
params: { path: { serverId: s } },
|
|
228
228
|
body: { request_id: a },
|
|
229
229
|
signal: n
|
|
230
230
|
}
|
|
231
231
|
);
|
|
232
|
-
if (l.status === 410) throw new
|
|
232
|
+
if (l.status === 410) throw new me();
|
|
233
233
|
if (l.status === 404)
|
|
234
234
|
throw new Error("This connection request is no longer available.");
|
|
235
235
|
if (d || !c)
|
|
236
236
|
throw new Error("Could not start this connection. Please try again.");
|
|
237
237
|
return c;
|
|
238
|
-
}, this.getConnectionAttempt = async (
|
|
238
|
+
}, this.getConnectionAttempt = async (s, a, n) => {
|
|
239
239
|
const { data: c, error: d, response: l } = await this.client.GET(
|
|
240
240
|
"/backend/widget/v5/connections/{serverId}/attempts/{attemptId}",
|
|
241
241
|
{
|
|
242
|
-
params: { path: { serverId:
|
|
242
|
+
params: { path: { serverId: s, attemptId: a } },
|
|
243
243
|
signal: n
|
|
244
244
|
}
|
|
245
245
|
);
|
|
246
246
|
if ([401, 403, 404].includes(l.status))
|
|
247
|
-
throw new
|
|
247
|
+
throw new he();
|
|
248
248
|
if (d || !c)
|
|
249
249
|
throw new Error(`Could not check the connection (${l.status}).`);
|
|
250
250
|
return c.status;
|
|
251
|
-
}, this.disconnectConnection = async (
|
|
251
|
+
}, this.disconnectConnection = async (s) => {
|
|
252
252
|
const { error: a } = await this.client.DELETE(
|
|
253
253
|
"/backend/widget/v5/connections/{serverId}",
|
|
254
254
|
{
|
|
255
|
-
params: { path: { serverId:
|
|
255
|
+
params: { path: { serverId: s } }
|
|
256
256
|
}
|
|
257
257
|
);
|
|
258
258
|
if (a) throw new Error("Could not disconnect. Please try again.");
|
|
259
|
-
}, this.setAuthToken = (
|
|
260
|
-
this.userToken =
|
|
261
|
-
const { baseUrl: a, headers: n } = this.constructClientOptions(
|
|
259
|
+
}, this.setAuthToken = (s) => {
|
|
260
|
+
this.userToken = s;
|
|
261
|
+
const { baseUrl: a, headers: n } = this.constructClientOptions(s);
|
|
262
262
|
this.client = this.createOpenAPIClient({ baseUrl: a, headers: n });
|
|
263
263
|
}, this.getStreamAuthContext = () => {
|
|
264
|
-
const { baseUrl:
|
|
264
|
+
const { baseUrl: s, headers: a } = this.constructClientOptions(this.userToken), n = {};
|
|
265
265
|
for (const [c, d] of Object.entries(a))
|
|
266
266
|
typeof d == "string" && (["content-type", "accept"].includes(c.toLowerCase()) || (n[c] = d));
|
|
267
|
-
return { baseUrl:
|
|
267
|
+
return { baseUrl: s, headers: n };
|
|
268
268
|
}, this.getStreamTransportOptions = () => {
|
|
269
|
-
const { baseUrl:
|
|
269
|
+
const { baseUrl: s, headers: a } = this.getStreamAuthContext();
|
|
270
270
|
return {
|
|
271
|
-
api:
|
|
272
|
-
reconnectApi: (n) =>
|
|
271
|
+
api: B(s, ge),
|
|
272
|
+
reconnectApi: (n) => B(s, ke, n),
|
|
273
273
|
headers: a
|
|
274
274
|
};
|
|
275
|
-
}, this.stopStream = async (
|
|
275
|
+
}, this.stopStream = async (s) => {
|
|
276
276
|
const { response: a } = await this.client.POST(
|
|
277
277
|
"/backend/widget/v5/chat/{sessionId}/stop",
|
|
278
|
-
{ params: { path: { sessionId:
|
|
278
|
+
{ params: { path: { sessionId: s } } }
|
|
279
279
|
);
|
|
280
280
|
if (!a.ok)
|
|
281
281
|
throw new Error(`Failed to stop stream: ${a.status}`);
|
|
282
|
-
}, this.sendPageReply = async (
|
|
282
|
+
}, this.sendPageReply = async (s, a) => {
|
|
283
283
|
try {
|
|
284
284
|
await this.client.POST("/backend/widget/v5/chat/{sessionId}/page-reply", {
|
|
285
|
-
params: { path: { sessionId:
|
|
285
|
+
params: { path: { sessionId: s } },
|
|
286
286
|
body: a
|
|
287
287
|
});
|
|
288
288
|
} catch {
|
|
289
289
|
}
|
|
290
|
-
}, this.getAgentTurnMessages = async (
|
|
290
|
+
}, this.getAgentTurnMessages = async (s, a) => {
|
|
291
291
|
const { data: n, response: c } = await this.client.GET(
|
|
292
292
|
"/backend/widget/v5/chat/{sessionId}/messages",
|
|
293
293
|
{
|
|
294
294
|
params: {
|
|
295
|
-
path: { sessionId:
|
|
295
|
+
path: { sessionId: s },
|
|
296
296
|
query: {
|
|
297
297
|
toolActivity: a == null ? void 0 : a.toolActivity,
|
|
298
298
|
reasoning: (a == null ? void 0 : a.reasoning) === void 0 ? void 0 : a.reasoning ? "true" : "false"
|
|
@@ -305,11 +305,11 @@ class B {
|
|
|
305
305
|
handled_connection_request_ids: n.handled_connection_request_ids ?? []
|
|
306
306
|
} : (b.warn("agent turn messages fetch failed", c.status), null);
|
|
307
307
|
}, this.createDictationSession = async ({
|
|
308
|
-
language:
|
|
308
|
+
language: s
|
|
309
309
|
}) => {
|
|
310
310
|
const { data: a, response: n } = await this.client.POST(
|
|
311
311
|
"/backend/widget/v5/dictation/sessions",
|
|
312
|
-
{ body:
|
|
312
|
+
{ body: s ? { language: s } : {} }
|
|
313
313
|
);
|
|
314
314
|
if (!a)
|
|
315
315
|
throw new Error(`Failed to start dictation: ${n.status}`);
|
|
@@ -318,53 +318,53 @@ class B {
|
|
|
318
318
|
params: {
|
|
319
319
|
header: { "x-bot-token": this.config.token }
|
|
320
320
|
}
|
|
321
|
-
}), this.sendMessage = async (
|
|
322
|
-
body:
|
|
321
|
+
}), this.sendMessage = async (s, a) => await this.client.POST("/backend/widget/v2/chat/send", {
|
|
322
|
+
body: s,
|
|
323
323
|
signal: a
|
|
324
|
-
}), this.createUnverifiedContact = async (
|
|
324
|
+
}), this.createUnverifiedContact = async (s) => await this.client.POST(
|
|
325
325
|
"/backend/widget/v2/contact/create-unverified",
|
|
326
326
|
{
|
|
327
327
|
params: { header: { "x-bot-token": this.config.token } },
|
|
328
|
-
body:
|
|
328
|
+
body: s
|
|
329
329
|
}
|
|
330
|
-
), this.createSession = async (
|
|
331
|
-
body:
|
|
330
|
+
), this.createSession = async (s, a) => await this.client.POST("/backend/widget/v2/create-session", {
|
|
331
|
+
body: s,
|
|
332
332
|
signal: a
|
|
333
333
|
}), this.pollSessionAndHistory = async ({
|
|
334
|
-
sessionId:
|
|
334
|
+
sessionId: s,
|
|
335
335
|
abortSignal: a
|
|
336
336
|
}) => await this.client.GET("/backend/widget/v2/poll/{sessionId}", {
|
|
337
|
-
params: { path: { sessionId:
|
|
337
|
+
params: { path: { sessionId: s } },
|
|
338
338
|
signal: a
|
|
339
339
|
}), this.markSessionRead = async ({
|
|
340
|
-
sessionId:
|
|
340
|
+
sessionId: s,
|
|
341
341
|
abortSignal: a
|
|
342
342
|
}) => await this.client.POST(
|
|
343
343
|
"/backend/widget/v2/session/{sessionId}/read",
|
|
344
344
|
{
|
|
345
|
-
params: { path: { sessionId:
|
|
345
|
+
params: { path: { sessionId: s } },
|
|
346
346
|
signal: a
|
|
347
347
|
}
|
|
348
348
|
), this.getSessions = async ({
|
|
349
|
-
cursor:
|
|
349
|
+
cursor: s,
|
|
350
350
|
filters: a,
|
|
351
351
|
abortSignal: n
|
|
352
352
|
}) => await this.client.GET("/backend/widget/v2/sessions", {
|
|
353
353
|
params: {
|
|
354
354
|
query: {
|
|
355
|
-
offset:
|
|
355
|
+
offset: s,
|
|
356
356
|
filters: JSON.stringify(a)
|
|
357
357
|
}
|
|
358
358
|
},
|
|
359
359
|
signal: n
|
|
360
360
|
}), this.uploadFile = async ({
|
|
361
|
-
file:
|
|
361
|
+
file: s,
|
|
362
362
|
abortSignal: a,
|
|
363
363
|
onProgress: n
|
|
364
364
|
}) => new Promise((c, d) => {
|
|
365
365
|
var y;
|
|
366
366
|
const l = new FormData();
|
|
367
|
-
l.append("file",
|
|
367
|
+
l.append("file", s);
|
|
368
368
|
const p = new XMLHttpRequest();
|
|
369
369
|
if (a && (a.addEventListener("abort", () => {
|
|
370
370
|
p.abort(), d(new DOMException("Aborted", "AbortError"));
|
|
@@ -372,18 +372,18 @@ class B {
|
|
|
372
372
|
d(new DOMException("Aborted", "AbortError"));
|
|
373
373
|
return;
|
|
374
374
|
}
|
|
375
|
-
p.upload.addEventListener("progress", (
|
|
376
|
-
if (
|
|
377
|
-
const w = Math.round(
|
|
375
|
+
p.upload.addEventListener("progress", (v) => {
|
|
376
|
+
if (v.lengthComputable && n) {
|
|
377
|
+
const w = Math.round(v.loaded / v.total * 100);
|
|
378
378
|
n(w);
|
|
379
379
|
}
|
|
380
380
|
}), p.addEventListener("load", () => {
|
|
381
381
|
if (p.status >= 200 && p.status < 300)
|
|
382
382
|
try {
|
|
383
|
-
const
|
|
384
|
-
c(
|
|
385
|
-
} catch (
|
|
386
|
-
d(new Error(`Failed to parse response: ${
|
|
383
|
+
const v = JSON.parse(p.responseText);
|
|
384
|
+
c(v);
|
|
385
|
+
} catch (v) {
|
|
386
|
+
d(new Error(`Failed to parse response: ${v}`));
|
|
387
387
|
}
|
|
388
388
|
else
|
|
389
389
|
d(new Error(`Upload failed with status: ${p.status}`));
|
|
@@ -394,22 +394,22 @@ class B {
|
|
|
394
394
|
});
|
|
395
395
|
const { baseUrl: u } = this.constructClientOptions(this.userToken), g = `${u}/backend/widget/v2/upload`;
|
|
396
396
|
p.open("POST", g), p.setRequestHeader("X-Bot-Token", this.config.token), this.userToken ?? ((y = this.config.user) == null ? void 0 : y.token) ? p.setRequestHeader("Authorization", `Bearer ${this.userToken}`) : b.error("user token not set"), p.send(l);
|
|
397
|
-
}), this.vote = async (
|
|
398
|
-
body:
|
|
397
|
+
}), this.vote = async (s) => await this.client.POST("/backend/widget/v2/chat/vote", { body: s }), this.resolveSession = async (s, a) => await this.client.POST("/backend/widget/v2/session/resolve", {
|
|
398
|
+
body: s,
|
|
399
399
|
signal: a
|
|
400
|
-
}), this.createStateCheckpoint = async (
|
|
401
|
-
body:
|
|
402
|
-
}), this.submitCsat = async (
|
|
403
|
-
const { baseUrl:
|
|
400
|
+
}), this.createStateCheckpoint = async (s) => await this.client.POST("/backend/widget/v2/checkpoint", {
|
|
401
|
+
body: s
|
|
402
|
+
}), this.submitCsat = async (s) => await this.client.POST("/backend/widget/v2/submit-csat", { body: s }), this.config = e, this.userToken = ((r = e.user) == null ? void 0 : r.token) || null;
|
|
403
|
+
const { baseUrl: t, headers: o } = this.constructClientOptions(
|
|
404
404
|
(_ = e.user) == null ? void 0 : _.token
|
|
405
405
|
);
|
|
406
|
-
this.client = this.createOpenAPIClient({ baseUrl:
|
|
406
|
+
this.client = this.createOpenAPIClient({ baseUrl: t, headers: o });
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
function
|
|
409
|
+
function be(i, e) {
|
|
410
410
|
b.error(`missing case for ${i} in ${e}`);
|
|
411
411
|
}
|
|
412
|
-
class
|
|
412
|
+
class J {
|
|
413
413
|
constructor() {
|
|
414
414
|
this.state = new z({
|
|
415
415
|
isPolling: !1,
|
|
@@ -417,7 +417,7 @@ class $ {
|
|
|
417
417
|
}), this.abortController = new AbortController(), this.reset = () => {
|
|
418
418
|
var e;
|
|
419
419
|
this.abortController.abort("Resetting poller"), (e = this.stopPolling) == null || e.call(this), this.stopPolling = null;
|
|
420
|
-
}, this.stopPolling = null, this.startPolling = (e,
|
|
420
|
+
}, this.stopPolling = null, this.startPolling = (e, t) => {
|
|
421
421
|
if (this.stopPolling) return;
|
|
422
422
|
const o = [], r = async () => {
|
|
423
423
|
this.abortController = new AbortController(), this.state.setPartial({ isPolling: !0 });
|
|
@@ -430,7 +430,7 @@ class $ {
|
|
|
430
430
|
} finally {
|
|
431
431
|
this.state.setPartial({ isPolling: !1 });
|
|
432
432
|
}
|
|
433
|
-
this.abortController.signal.aborted || o.push(setTimeout(r,
|
|
433
|
+
this.abortController.signal.aborted || o.push(setTimeout(r, t));
|
|
434
434
|
};
|
|
435
435
|
r(), this.stopPolling = () => {
|
|
436
436
|
o.forEach(clearTimeout), this.state.reset();
|
|
@@ -438,42 +438,42 @@ class $ {
|
|
|
438
438
|
};
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function Y(i) {
|
|
442
442
|
try {
|
|
443
443
|
const e = i();
|
|
444
|
-
return e instanceof Promise ? e.then((
|
|
444
|
+
return e instanceof Promise ? e.then((t) => ({ data: t })).catch((t) => ({ error: t })) : { data: e };
|
|
445
445
|
} catch (e) {
|
|
446
446
|
return { error: e };
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
class
|
|
449
|
+
class fe {
|
|
450
450
|
constructor({
|
|
451
451
|
api: e,
|
|
452
|
-
config:
|
|
452
|
+
config: t,
|
|
453
453
|
sessionCtx: o,
|
|
454
454
|
messageCtx: r,
|
|
455
455
|
sessionPollingIntervalSeconds: _
|
|
456
456
|
}) {
|
|
457
|
-
this.poller = new
|
|
457
|
+
this.poller = new J(), this.fetchSessionAndFullHistoryAbortController = new AbortController(), this.reconcileAbortController = new AbortController(), this.subscriptions = [], this.reconcilingSessionId = null, this.seenHistoryIds = /* @__PURE__ */ new Set(), this.removedHistoryIds = /* @__PURE__ */ new Set(), this.protectedUntilSeq = /* @__PURE__ */ new Map(), this.landedPollSessionId = null, this.pollSeq = 0, this.lastAppliedSeq = 0, this.removableAfterSeq = 0, this.registerPolling = () => {
|
|
458
458
|
this.subscriptions.push(
|
|
459
|
-
this.sessionCtx.sessionState.subscribe(({ session:
|
|
460
|
-
((
|
|
459
|
+
this.sessionCtx.sessionState.subscribe(({ session: s }) => {
|
|
460
|
+
((s == null ? void 0 : s.id) ?? null) !== this.landedPollSessionId && (this.seenHistoryIds = /* @__PURE__ */ new Set(), this.removedHistoryIds = /* @__PURE__ */ new Set(), this.protectedUntilSeq = /* @__PURE__ */ new Map(), this.removableAfterSeq = 0, this.landedPollSessionId = null);
|
|
461
461
|
})
|
|
462
462
|
), this.subscriptions.push(
|
|
463
|
-
this.sessionCtx.sessionState.subscribe(({ session:
|
|
464
|
-
|
|
463
|
+
this.sessionCtx.sessionState.subscribe(({ session: s }) => {
|
|
464
|
+
s != null && s.id ? this.poller.startPolling(async (a) => {
|
|
465
465
|
this.fetchSessionAndHistory({
|
|
466
|
-
sessionId:
|
|
466
|
+
sessionId: s.id,
|
|
467
467
|
abortSignal: a
|
|
468
468
|
});
|
|
469
469
|
}, this.sessionPollingIntervalSeconds * 1e3) : this.poller.reset();
|
|
470
470
|
})
|
|
471
471
|
), this.subscriptions.push(
|
|
472
|
-
this.sessionCtx.sessionState.subscribe(({ session:
|
|
473
|
-
if (
|
|
472
|
+
this.sessionCtx.sessionState.subscribe(({ session: s }) => {
|
|
473
|
+
if (s != null && s.id && !s.isOpened)
|
|
474
474
|
try {
|
|
475
475
|
this.fetchSessionAndFullHistoryAbortController = new AbortController(), this.fetchSessionAndHistory({
|
|
476
|
-
sessionId:
|
|
476
|
+
sessionId: s.id,
|
|
477
477
|
abortSignal: this.fetchSessionAndFullHistoryAbortController.signal
|
|
478
478
|
});
|
|
479
479
|
} catch (a) {
|
|
@@ -483,36 +483,36 @@ class be {
|
|
|
483
483
|
this.fetchSessionAndFullHistoryAbortController.abort();
|
|
484
484
|
})
|
|
485
485
|
), this.subscriptions.push(
|
|
486
|
-
this.sessionCtx.sessionState.subscribe(({ session:
|
|
487
|
-
this.reconcilingSessionId !== null && (
|
|
486
|
+
this.sessionCtx.sessionState.subscribe(({ session: s }) => {
|
|
487
|
+
this.reconcilingSessionId !== null && (s == null ? void 0 : s.id) !== this.reconcilingSessionId && this.reconcileAbortController.abort();
|
|
488
488
|
})
|
|
489
489
|
);
|
|
490
490
|
}, this.dispose = () => {
|
|
491
|
-
this.poller.reset(), this.fetchSessionAndFullHistoryAbortController.abort(), this.reconcileAbortController.abort(), this.reconcilingSessionId = null, this.subscriptions.forEach((
|
|
492
|
-
}, this.reconcileAfterStream = async (
|
|
491
|
+
this.poller.reset(), this.fetchSessionAndFullHistoryAbortController.abort(), this.reconcileAbortController.abort(), this.reconcilingSessionId = null, this.subscriptions.forEach((s) => s()), this.subscriptions = [];
|
|
492
|
+
}, this.reconcileAfterStream = async (s) => {
|
|
493
493
|
this.reconcileAbortController.abort(), this.reconcileAbortController = new AbortController();
|
|
494
494
|
const { signal: a } = this.reconcileAbortController;
|
|
495
|
-
this.reconcilingSessionId =
|
|
495
|
+
this.reconcilingSessionId = s;
|
|
496
496
|
try {
|
|
497
|
-
await this.fetchSessionAndHistory({ sessionId:
|
|
497
|
+
await this.fetchSessionAndHistory({ sessionId: s, abortSignal: a });
|
|
498
498
|
} catch (n) {
|
|
499
499
|
if (!a.aborted) throw n;
|
|
500
500
|
} finally {
|
|
501
|
-
this.reconcilingSessionId ===
|
|
501
|
+
this.reconcilingSessionId === s && (this.reconcilingSessionId = null);
|
|
502
502
|
}
|
|
503
503
|
}, this.fetchSessionAndHistory = async ({
|
|
504
|
-
sessionId:
|
|
504
|
+
sessionId: s,
|
|
505
505
|
abortSignal: a
|
|
506
506
|
}) => {
|
|
507
|
-
const n = this.landedPollSessionId !==
|
|
507
|
+
const n = this.landedPollSessionId !== s && this.messageCtx.state.get().messages.length === 0;
|
|
508
508
|
n && this.messageCtx.state.setPartial({ isInitialFetchLoading: !0 });
|
|
509
509
|
const c = ++this.pollSeq, { data: d } = await this.api.pollSessionAndHistory({
|
|
510
|
-
sessionId:
|
|
510
|
+
sessionId: s,
|
|
511
511
|
abortSignal: a
|
|
512
512
|
});
|
|
513
513
|
if (d != null && d.session && (this.sessionCtx.sessionState.setPartial({ session: d.session }), this.sessionCtx.setSessions([d.session])), d != null && d.history) {
|
|
514
514
|
const l = c < this.lastAppliedSeq, p = !l && c > this.removableAfterSeq;
|
|
515
|
-
l || (this.lastAppliedSeq = c), p && (this.removableAfterSeq = this.pollSeq), this.landedPollSessionId =
|
|
515
|
+
l || (this.lastAppliedSeq = c), p && (this.removableAfterSeq = this.pollSeq), this.landedPollSessionId = s, d.history.length > 0 && this.reconcileOptionPicks(d.history);
|
|
516
516
|
const u = new Set(d.history.map((k) => k.publicId)), m = p ? Array.from(this.seenHistoryIds).filter((k) => !u.has(k)) : [], g = new Set(
|
|
517
517
|
m.filter((k) => (this.protectedUntilSeq.get(k) ?? 0) < c)
|
|
518
518
|
);
|
|
@@ -520,15 +520,15 @@ class be {
|
|
|
520
520
|
...Array.from(u),
|
|
521
521
|
...m.filter((k) => !g.has(k))
|
|
522
522
|
]) : u.forEach((k) => this.seenHistoryIds.add(k)), g.forEach((k) => this.removedHistoryIds.add(k));
|
|
523
|
-
const
|
|
524
|
-
(k) => !
|
|
523
|
+
const f = this.messageCtx.state.get().messages, y = d.history.map(this.mapHistoryToMessage).filter((k) => k !== null).filter((k) => !this.removedHistoryIds.has(k.id)).filter(
|
|
524
|
+
(k) => !f.some((D) => D.id === k.id)
|
|
525
525
|
);
|
|
526
526
|
p || y.forEach(
|
|
527
527
|
(k) => this.protectedUntilSeq.set(k.id, this.pollSeq)
|
|
528
528
|
);
|
|
529
|
-
let
|
|
530
|
-
const w =
|
|
531
|
-
if (y.length > 0 || w.length !==
|
|
529
|
+
let v = !1;
|
|
530
|
+
const w = f.flatMap((k) => g.has(k.id) ? [] : "replyTo" in k && k.replyTo && g.has(k.replyTo.id) ? (v = !0, [{ ...k, replyTo: void 0 }]) : [k]);
|
|
531
|
+
if (y.length > 0 || w.length !== f.length || v)
|
|
532
532
|
if (this.messageCtx.state.setPartial({
|
|
533
533
|
messages: [...w, ...y]
|
|
534
534
|
}), n)
|
|
@@ -540,50 +540,50 @@ class be {
|
|
|
540
540
|
this.messageCtx.dispatchToOnMessageReceivedHook(k);
|
|
541
541
|
}
|
|
542
542
|
this.messageCtx.state.get().isInitialFetchLoading && this.messageCtx.state.setPartial({ isInitialFetchLoading: !1 });
|
|
543
|
-
}, this.reconcileOptionPicks = (
|
|
543
|
+
}, this.reconcileOptionPicks = (s) => {
|
|
544
544
|
var a;
|
|
545
|
-
for (const n of
|
|
545
|
+
for (const n of s) {
|
|
546
546
|
const c = (a = n.messageOptions) == null ? void 0 : a.pickedOptionId;
|
|
547
547
|
c && this.messageCtx.setMessageOptionPick(n.publicId, c);
|
|
548
548
|
}
|
|
549
|
-
}, this.mapHistoryToMessage = (
|
|
549
|
+
}, this.mapHistoryToMessage = (s) => {
|
|
550
550
|
var n;
|
|
551
551
|
const a = {
|
|
552
|
-
id:
|
|
553
|
-
timestamp:
|
|
554
|
-
attachments:
|
|
552
|
+
id: s.publicId,
|
|
553
|
+
timestamp: s.sentAt || "",
|
|
554
|
+
attachments: s.attachments || void 0
|
|
555
555
|
};
|
|
556
|
-
if (
|
|
556
|
+
if (s.sender.kind === "user")
|
|
557
557
|
return {
|
|
558
558
|
...a,
|
|
559
559
|
type: "USER",
|
|
560
560
|
deliveredAt: a.timestamp,
|
|
561
|
-
content:
|
|
561
|
+
content: s.content.text || "",
|
|
562
562
|
// Backend field name (schema.ts) → widget vocabulary.
|
|
563
|
-
markedElements:
|
|
563
|
+
markedElements: s.pickedElements
|
|
564
564
|
};
|
|
565
|
-
if (
|
|
565
|
+
if (s.sender.kind === "agent")
|
|
566
566
|
return {
|
|
567
567
|
...a,
|
|
568
568
|
type: "AGENT",
|
|
569
569
|
component: "agent_message",
|
|
570
570
|
data: {
|
|
571
|
-
message:
|
|
571
|
+
message: s.content.text || ""
|
|
572
572
|
},
|
|
573
573
|
agent: {
|
|
574
|
-
name:
|
|
574
|
+
name: s.sender.name || "",
|
|
575
575
|
// Do not set avatarUrl from config here... let it be taken from the config at render time
|
|
576
576
|
// Only set avatar url from the backend's response
|
|
577
|
-
avatarUrl:
|
|
578
|
-
avatar:
|
|
577
|
+
avatarUrl: s.sender.avatar || null,
|
|
578
|
+
avatar: s.sender.avatar || null,
|
|
579
579
|
id: null,
|
|
580
580
|
isAi: !1
|
|
581
581
|
},
|
|
582
|
-
...this.constructReplyTo(
|
|
583
|
-
...
|
|
582
|
+
...this.constructReplyTo(s),
|
|
583
|
+
...this.constructMessageOptions(s)
|
|
584
584
|
};
|
|
585
|
-
if (
|
|
586
|
-
const c =
|
|
585
|
+
if (s.sender.kind === "ai") {
|
|
586
|
+
const c = s.actionCalls && s.actionCalls.length > 0 ? s.actionCalls[s.actionCalls.length - 1] : void 0;
|
|
587
587
|
return {
|
|
588
588
|
...a,
|
|
589
589
|
type: "AI",
|
|
@@ -597,23 +597,25 @@ class be {
|
|
|
597
597
|
avatar: null
|
|
598
598
|
},
|
|
599
599
|
data: {
|
|
600
|
-
message:
|
|
600
|
+
message: s.content.text || "",
|
|
601
601
|
action: c ? {
|
|
602
602
|
name: c.actionName,
|
|
603
603
|
data: this.extractActionResult(c)
|
|
604
604
|
} : void 0
|
|
605
605
|
},
|
|
606
|
-
...this.constructReplyTo(
|
|
606
|
+
...this.constructReplyTo(s),
|
|
607
|
+
// Workflow messages (a sent macro) arrive as AI and carry options too.
|
|
608
|
+
...this.constructMessageOptions(s)
|
|
607
609
|
};
|
|
608
610
|
}
|
|
609
|
-
if (
|
|
610
|
-
const c = this.constructSystemMessage(
|
|
611
|
+
if (s.sender.kind === "system") {
|
|
612
|
+
const c = this.constructSystemMessage(s);
|
|
611
613
|
return c === null ? null : { ...c };
|
|
612
614
|
}
|
|
613
615
|
return null;
|
|
614
|
-
}, this.constructReplyTo = (
|
|
615
|
-
if (!
|
|
616
|
-
const { publicId: a, text: n, sender: c } =
|
|
616
|
+
}, this.constructReplyTo = (s) => {
|
|
617
|
+
if (!s.replyTo) return {};
|
|
618
|
+
const { publicId: a, text: n, sender: c } = s.replyTo;
|
|
617
619
|
return {
|
|
618
620
|
replyTo: {
|
|
619
621
|
id: a,
|
|
@@ -621,64 +623,64 @@ class be {
|
|
|
621
623
|
sender: c
|
|
622
624
|
}
|
|
623
625
|
};
|
|
624
|
-
}, this.constructSystemMessage = (
|
|
625
|
-
if (!
|
|
626
|
-
switch (
|
|
626
|
+
}, this.constructMessageOptions = (s) => s.messageOptions ? { messageOptions: s.messageOptions } : {}, this.constructSystemMessage = (s) => {
|
|
627
|
+
if (!s || !s.systemMessagePayload) return null;
|
|
628
|
+
switch (s.systemMessagePayload.type) {
|
|
627
629
|
case "state_checkpoint":
|
|
628
630
|
return {
|
|
629
|
-
id:
|
|
631
|
+
id: s.publicId,
|
|
630
632
|
type: "SYSTEM",
|
|
631
633
|
subtype: "state_checkpoint",
|
|
632
|
-
data: { payload:
|
|
633
|
-
timestamp:
|
|
634
|
+
data: { payload: s.systemMessagePayload.payload },
|
|
635
|
+
timestamp: s.sentAt || "",
|
|
634
636
|
attachments: void 0
|
|
635
637
|
};
|
|
636
638
|
case "csat_requested":
|
|
637
639
|
return {
|
|
638
|
-
id:
|
|
640
|
+
id: s.publicId,
|
|
639
641
|
type: "SYSTEM",
|
|
640
642
|
subtype: "csat_requested",
|
|
641
643
|
data: { payload: void 0 },
|
|
642
|
-
timestamp:
|
|
644
|
+
timestamp: s.sentAt || "",
|
|
643
645
|
attachments: void 0
|
|
644
646
|
};
|
|
645
647
|
case "csat_submitted":
|
|
646
648
|
return {
|
|
647
|
-
id:
|
|
649
|
+
id: s.publicId,
|
|
648
650
|
type: "SYSTEM",
|
|
649
651
|
subtype: "csat_submitted",
|
|
650
652
|
data: {
|
|
651
653
|
payload: {
|
|
652
|
-
score:
|
|
653
|
-
feedback:
|
|
654
|
+
score: s.systemMessagePayload.payload.score ?? void 0,
|
|
655
|
+
feedback: s.systemMessagePayload.payload.feedback ?? void 0
|
|
654
656
|
}
|
|
655
657
|
},
|
|
656
|
-
timestamp:
|
|
658
|
+
timestamp: s.sentAt || "",
|
|
657
659
|
attachments: void 0
|
|
658
660
|
};
|
|
659
661
|
case "none":
|
|
660
662
|
return null;
|
|
661
663
|
default:
|
|
662
|
-
return
|
|
663
|
-
|
|
664
|
+
return be(
|
|
665
|
+
s.systemMessagePayload,
|
|
664
666
|
this.constructSystemMessage.name
|
|
665
667
|
), null;
|
|
666
668
|
}
|
|
667
|
-
}, this.extractActionResult = (
|
|
668
|
-
const a =
|
|
669
|
+
}, this.extractActionResult = (s) => {
|
|
670
|
+
const a = s.result;
|
|
669
671
|
if (a === null || typeof a != "object") return a;
|
|
670
672
|
if ("responseBodyText" in a && typeof a.responseBodyText == "string") {
|
|
671
|
-
const n = a.responseBodyText, c =
|
|
673
|
+
const n = a.responseBodyText, c = Y(() => JSON.parse(n)).data;
|
|
672
674
|
if (c) return c;
|
|
673
675
|
}
|
|
674
|
-
return
|
|
675
|
-
}, this.api = e, this.config =
|
|
676
|
+
return s.result;
|
|
677
|
+
}, this.api = e, this.config = t, this.sessionCtx = o, this.messageCtx = r, this.sessionPollingIntervalSeconds = _, this.registerPolling();
|
|
676
678
|
}
|
|
677
679
|
}
|
|
678
680
|
class ve {
|
|
679
681
|
constructor({
|
|
680
682
|
config: e,
|
|
681
|
-
api:
|
|
683
|
+
api: t,
|
|
682
684
|
storageCtx: o
|
|
683
685
|
}) {
|
|
684
686
|
var r;
|
|
@@ -686,9 +688,9 @@ class ve {
|
|
|
686
688
|
var _;
|
|
687
689
|
return !!(!((_ = this.state.get().contact) != null && _.token) && this.config.collectUserData);
|
|
688
690
|
}, this.autoCreateUnverifiedUserIfNotExists = async () => {
|
|
689
|
-
var _,
|
|
691
|
+
var _, s, a, n, c, d, l, p, u, m, g, f, y, v;
|
|
690
692
|
if (!((_ = this.config.user) != null && _.token)) {
|
|
691
|
-
if (this.config.collectUserData && !((a = (
|
|
693
|
+
if (this.config.collectUserData && !((a = (s = this.config.user) == null ? void 0 : s.data) != null && a.email)) {
|
|
692
694
|
if ((n = this.config.extraDataCollectionFields) != null && n.length)
|
|
693
695
|
return;
|
|
694
696
|
const w = await ((c = this.storageCtx) == null ? void 0 : c.getContactToken());
|
|
@@ -704,12 +706,12 @@ class ve {
|
|
|
704
706
|
}
|
|
705
707
|
await this.createUnverifiedContact({
|
|
706
708
|
email: (m = (u = this.config.user) == null ? void 0 : u.data) == null ? void 0 : m.email,
|
|
707
|
-
non_verified_name: (
|
|
708
|
-
non_verified_custom_data: (
|
|
709
|
+
non_verified_name: (f = (g = this.config.user) == null ? void 0 : g.data) == null ? void 0 : f.name,
|
|
710
|
+
non_verified_custom_data: (v = (y = this.config.user) == null ? void 0 : y.data) == null ? void 0 : v.customData
|
|
709
711
|
});
|
|
710
712
|
}
|
|
711
|
-
}, this.createUnverifiedContact = async (_,
|
|
712
|
-
this.state.setPartial({ extraCollectedData:
|
|
713
|
+
}, this.createUnverifiedContact = async (_, s) => {
|
|
714
|
+
this.state.setPartial({ extraCollectedData: s });
|
|
713
715
|
try {
|
|
714
716
|
this.state.setPartial({
|
|
715
717
|
isCreatingUnverifiedContact: !0,
|
|
@@ -725,11 +727,11 @@ class ve {
|
|
|
725
727
|
this.state.setPartial({ isCreatingUnverifiedContact: !1 });
|
|
726
728
|
}
|
|
727
729
|
}, this.recoverFromStaleToken = async () => {
|
|
728
|
-
var _,
|
|
730
|
+
var _, s, a, n, c, d, l, p, u, m;
|
|
729
731
|
if ((_ = this.config.user) != null && _.token) return !1;
|
|
730
732
|
this.api.setAuthToken(""), this.state.setPartial({ contact: null });
|
|
731
733
|
try {
|
|
732
|
-
await ((
|
|
734
|
+
await ((s = this.storageCtx) == null ? void 0 : s.clearContactToken()), await ((a = this.storageCtx) == null ? void 0 : a.clearActiveSessionId());
|
|
733
735
|
} catch (g) {
|
|
734
736
|
b.warn("failed to clear a stale contact token", {
|
|
735
737
|
error: g instanceof Error ? g.message : String(g)
|
|
@@ -742,9 +744,9 @@ class ve {
|
|
|
742
744
|
}), !!((m = this.state.get().contact) != null && m.token);
|
|
743
745
|
}, this.setUnverifiedContact = async (_) => {
|
|
744
746
|
var n, c, d, l;
|
|
745
|
-
const
|
|
747
|
+
const s = await ((n = this.storageCtx) == null ? void 0 : n.getExternalContactId()), a = ((c = this.config.user) == null ? void 0 : c.externalId) || s || K();
|
|
746
748
|
this.api.setAuthToken(_), await ((d = this.storageCtx) == null ? void 0 : d.setContactToken(_)), await ((l = this.storageCtx) == null ? void 0 : l.setExternalContactId(a)), this.state.setPartial({ contact: { token: _, externalId: a } });
|
|
747
|
-
}, this.config = e, this.storageCtx = o, this.api =
|
|
749
|
+
}, this.config = e, this.storageCtx = o, this.api = t, this.state = new z({
|
|
748
750
|
contact: (r = e.user) != null && r.token ? {
|
|
749
751
|
token: e.user.token,
|
|
750
752
|
// Set optional externalId from config... not local storage
|
|
@@ -756,37 +758,37 @@ class ve {
|
|
|
756
758
|
}), this.autoCreateUnverifiedUserIfNotExists();
|
|
757
759
|
}
|
|
758
760
|
}
|
|
759
|
-
class
|
|
761
|
+
class ye {
|
|
760
762
|
constructor(e) {
|
|
761
|
-
this.api = e, this.state = new z([]), this.controllers = /* @__PURE__ */ new Map(), this.appendFiles = (
|
|
762
|
-
const o =
|
|
763
|
+
this.api = e, this.state = new z([]), this.controllers = /* @__PURE__ */ new Map(), this.appendFiles = (t) => {
|
|
764
|
+
const o = t.map(
|
|
763
765
|
(r) => ({
|
|
764
766
|
file: r,
|
|
765
|
-
id:
|
|
767
|
+
id: K(),
|
|
766
768
|
status: "pending",
|
|
767
769
|
progress: 0
|
|
768
770
|
})
|
|
769
771
|
);
|
|
770
772
|
this.state.set([...this.state.get(), ...o]), o.forEach((r) => void this.upload(r));
|
|
771
|
-
}, this.cancel = (
|
|
773
|
+
}, this.cancel = (t) => {
|
|
772
774
|
var o;
|
|
773
|
-
(o = this.controllers.get(
|
|
775
|
+
(o = this.controllers.get(t)) == null || o.abort(), this.controllers.delete(t), this.state.set(this.state.get().filter((r) => r.id !== t));
|
|
774
776
|
}, this.reset = () => {
|
|
775
|
-
this.controllers.forEach((
|
|
777
|
+
this.controllers.forEach((t) => t.abort()), this.controllers.clear(), this.state.reset();
|
|
776
778
|
};
|
|
777
779
|
}
|
|
778
|
-
update(e,
|
|
780
|
+
update(e, t) {
|
|
779
781
|
this.state.set(
|
|
780
|
-
this.state.get().map((o) => o.id === e ? { ...o, ...
|
|
782
|
+
this.state.get().map((o) => o.id === e ? { ...o, ...t } : o)
|
|
781
783
|
);
|
|
782
784
|
}
|
|
783
785
|
async upload(e) {
|
|
784
|
-
const
|
|
785
|
-
this.controllers.set(e.id,
|
|
786
|
+
const t = new AbortController();
|
|
787
|
+
this.controllers.set(e.id, t), this.update(e.id, { status: "uploading" });
|
|
786
788
|
try {
|
|
787
789
|
const o = await this.api.uploadFile({
|
|
788
790
|
file: e.file,
|
|
789
|
-
abortSignal:
|
|
791
|
+
abortSignal: t.signal,
|
|
790
792
|
onProgress: (r) => this.update(e.id, { progress: r })
|
|
791
793
|
});
|
|
792
794
|
this.update(e.id, {
|
|
@@ -795,7 +797,7 @@ class fe {
|
|
|
795
797
|
progress: 100
|
|
796
798
|
});
|
|
797
799
|
} catch (o) {
|
|
798
|
-
|
|
800
|
+
t.signal.aborted || this.update(e.id, {
|
|
799
801
|
status: "error",
|
|
800
802
|
progress: 0,
|
|
801
803
|
error: o instanceof Error ? o.message : "Upload failed"
|
|
@@ -806,12 +808,12 @@ class fe {
|
|
|
806
808
|
}
|
|
807
809
|
}
|
|
808
810
|
function q() {
|
|
809
|
-
return
|
|
811
|
+
return K();
|
|
810
812
|
}
|
|
811
|
-
class
|
|
813
|
+
class we {
|
|
812
814
|
constructor({
|
|
813
815
|
api: e,
|
|
814
|
-
sessionCtx:
|
|
816
|
+
sessionCtx: t,
|
|
815
817
|
messageCtx: o
|
|
816
818
|
}) {
|
|
817
819
|
this.submitCsat = async (r) => {
|
|
@@ -819,12 +821,12 @@ class ye {
|
|
|
819
821
|
const _ = (c = this.sessionCtx.sessionState.get().session) == null ? void 0 : c.id;
|
|
820
822
|
if (!_)
|
|
821
823
|
return { data: null, error: "No session id found" };
|
|
822
|
-
const
|
|
824
|
+
const s = q();
|
|
823
825
|
this.messageCtx.state.setPartial({
|
|
824
826
|
messages: [
|
|
825
827
|
...this.messageCtx.state.get().messages,
|
|
826
828
|
{
|
|
827
|
-
id:
|
|
829
|
+
id: s,
|
|
828
830
|
type: "SYSTEM",
|
|
829
831
|
subtype: "csat_submitted",
|
|
830
832
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -839,14 +841,14 @@ class ye {
|
|
|
839
841
|
});
|
|
840
842
|
const { data: a, error: n } = await this.api.submitCsat({
|
|
841
843
|
...r,
|
|
842
|
-
system_message_uuid:
|
|
844
|
+
system_message_uuid: s,
|
|
843
845
|
session_id: _
|
|
844
846
|
});
|
|
845
847
|
return { data: a, error: n };
|
|
846
|
-
}, this.api = e, this.sessionCtx =
|
|
848
|
+
}, this.api = e, this.sessionCtx = t, this.messageCtx = o;
|
|
847
849
|
}
|
|
848
850
|
}
|
|
849
|
-
const
|
|
851
|
+
const je = [
|
|
850
852
|
{
|
|
851
853
|
action: "newparagraph",
|
|
852
854
|
phrases: {
|
|
@@ -921,7 +923,7 @@ const we = [
|
|
|
921
923
|
it: ["invia messaggio"]
|
|
922
924
|
}
|
|
923
925
|
}
|
|
924
|
-
],
|
|
926
|
+
], Se = [
|
|
925
927
|
"en",
|
|
926
928
|
"es",
|
|
927
929
|
"fr",
|
|
@@ -929,25 +931,25 @@ const we = [
|
|
|
929
931
|
"pt",
|
|
930
932
|
"it"
|
|
931
933
|
];
|
|
932
|
-
function Se(i) {
|
|
933
|
-
return je.includes(i);
|
|
934
|
-
}
|
|
935
934
|
function ze(i) {
|
|
936
|
-
return
|
|
935
|
+
return Se.includes(i);
|
|
937
936
|
}
|
|
938
937
|
function Ce(i) {
|
|
939
|
-
|
|
938
|
+
return i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
939
|
+
}
|
|
940
|
+
function xe(i) {
|
|
941
|
+
const e = je.flatMap(
|
|
940
942
|
(r) => i.flatMap(
|
|
941
|
-
(_) => r.phrases[_].map((
|
|
943
|
+
(_) => r.phrases[_].map((s) => ({ phrase: s, action: r.action }))
|
|
942
944
|
)
|
|
943
|
-
),
|
|
945
|
+
), t = e.map((r) => Ce(r.phrase)).sort((r, _) => _.length - r.length).join("|"), o = String.raw`(?<=^\s{0,3}|[.!?\n]\s{0,3})`;
|
|
944
946
|
return {
|
|
945
947
|
regex: new RegExp(
|
|
946
|
-
`${o}(${
|
|
948
|
+
`${o}(${t})` + String.raw`([.,!?;:])(?=\s|$)`,
|
|
947
949
|
"giu"
|
|
948
950
|
),
|
|
949
951
|
finalRegex: new RegExp(
|
|
950
|
-
`${o}(${
|
|
952
|
+
`${o}(${t})` + String.raw`([.,!?;:]?)(?=\s|$)`,
|
|
951
953
|
"giu"
|
|
952
954
|
),
|
|
953
955
|
phraseToAction: new Map(
|
|
@@ -956,39 +958,39 @@ function Ce(i) {
|
|
|
956
958
|
longestPhrase: Math.max(...e.map((r) => r.phrase.length))
|
|
957
959
|
};
|
|
958
960
|
}
|
|
959
|
-
const
|
|
960
|
-
function
|
|
961
|
-
const e = i &&
|
|
962
|
-
let o =
|
|
963
|
-
return o || (o =
|
|
961
|
+
const V = /* @__PURE__ */ new Map();
|
|
962
|
+
function R(i) {
|
|
963
|
+
const e = i && ze(i) && i !== "en" ? i : null, t = e ?? "en";
|
|
964
|
+
let o = V.get(t);
|
|
965
|
+
return o || (o = xe(e ? ["en", e] : ["en"]), V.set(t, o)), o;
|
|
964
966
|
}
|
|
965
|
-
function
|
|
967
|
+
function qe(i) {
|
|
966
968
|
const e = i.replace(/\s+$/, "");
|
|
967
969
|
if (!e) return "";
|
|
968
|
-
const
|
|
970
|
+
const t = e.replace(/[.!?]+$/, "");
|
|
969
971
|
let o = -1;
|
|
970
|
-
for (let r =
|
|
971
|
-
const _ =
|
|
972
|
+
for (let r = t.length - 1; r >= 0; r--) {
|
|
973
|
+
const _ = t[r];
|
|
972
974
|
if (_ === "." || _ === "!" || _ === "?" || _ === `
|
|
973
975
|
`) {
|
|
974
976
|
o = r + 1;
|
|
975
977
|
break;
|
|
976
978
|
}
|
|
977
979
|
}
|
|
978
|
-
return o === -1 ? "" : `${
|
|
980
|
+
return o === -1 ? "" : `${t.slice(0, o)} `.replace(/\n $/, `
|
|
979
981
|
`);
|
|
980
982
|
}
|
|
981
|
-
const
|
|
983
|
+
const Ae = new RegExp(
|
|
982
984
|
String.raw`(^- |\n(?:- )?)(\p{Ll})`,
|
|
983
985
|
"gu"
|
|
984
986
|
);
|
|
985
|
-
function
|
|
987
|
+
function Ee(i) {
|
|
986
988
|
return i.replace(
|
|
987
|
-
|
|
988
|
-
(e,
|
|
989
|
+
Ae,
|
|
990
|
+
(e, t, o) => t + o.toUpperCase()
|
|
989
991
|
);
|
|
990
992
|
}
|
|
991
|
-
function
|
|
993
|
+
function Pe(i) {
|
|
992
994
|
return i.length <= 3 && /^\s*$/.test(i) ? !0 : /[.!?\n]\s{0,3}$/.test(i.slice(-6));
|
|
993
995
|
}
|
|
994
996
|
class A {
|
|
@@ -997,10 +999,10 @@ class A {
|
|
|
997
999
|
* Pure and deterministic: always called with the entire raw string so the
|
|
998
1000
|
* result never depends on delta chunking.
|
|
999
1001
|
*/
|
|
1000
|
-
static process(e,
|
|
1001
|
-
const o =
|
|
1002
|
+
static process(e, t) {
|
|
1003
|
+
const o = R(t == null ? void 0 : t.language), r = t != null && t.final ? "" : A.commandPrefixTail(e, t == null ? void 0 : t.language), _ = e.slice(0, e.length - r.length), s = t != null && t.final ? o.finalRegex : o.regex;
|
|
1002
1004
|
let a = "", n = null, c = 0;
|
|
1003
|
-
for (const l of Array.from(_.matchAll(
|
|
1005
|
+
for (const l of Array.from(_.matchAll(s))) {
|
|
1004
1006
|
const [, p = ""] = l, u = o.phraseToAction.get(p.toLowerCase());
|
|
1005
1007
|
if (u)
|
|
1006
1008
|
if (a += _.slice(c, l.index), c = l.index + l[0].length, u === "newline") a = `${a.replace(/[ \t]+$/, "")}
|
|
@@ -1014,13 +1016,13 @@ class A {
|
|
|
1014
1016
|
a = m === "" || m.endsWith(`
|
|
1015
1017
|
`) ? `${m}- ` : `${m}
|
|
1016
1018
|
- `;
|
|
1017
|
-
} else if (u === "scratch") a =
|
|
1019
|
+
} else if (u === "scratch") a = qe(a);
|
|
1018
1020
|
else {
|
|
1019
1021
|
n = u === "send" ? "send" : "stop";
|
|
1020
1022
|
break;
|
|
1021
1023
|
}
|
|
1022
1024
|
}
|
|
1023
|
-
return n === null && (a += _.slice(c)), { text:
|
|
1025
|
+
return n === null && (a += _.slice(c)), { text: Ee(
|
|
1024
1026
|
a.replace(/^\s+/, "").replace(/[ \t]+\n/g, `
|
|
1025
1027
|
`).replace(/\n[ \t]+/g, `
|
|
1026
1028
|
`).replace(/(^|\n)- +/g, "$1- ").replace(/ {2,}/g, " ").replace(/\n{3,}/g, `
|
|
@@ -1037,16 +1039,16 @@ class A {
|
|
|
1037
1039
|
* control command from an intermediate delta would stop or submit
|
|
1038
1040
|
* mid-sentence.
|
|
1039
1041
|
*/
|
|
1040
|
-
static commandPrefixTail(e,
|
|
1041
|
-
const o =
|
|
1042
|
+
static commandPrefixTail(e, t) {
|
|
1043
|
+
const o = R(t), r = Math.min(e.length, o.longestPhrase + 2);
|
|
1042
1044
|
for (let _ = r; _ > 0; _--) {
|
|
1043
|
-
const
|
|
1044
|
-
if (!
|
|
1045
|
-
const a = e.slice(
|
|
1045
|
+
const s = e.length - _;
|
|
1046
|
+
if (!Pe(e.slice(0, s))) continue;
|
|
1047
|
+
const a = e.slice(s).toLowerCase(), n = a.replace(/^\s+/, "");
|
|
1046
1048
|
if (n) {
|
|
1047
1049
|
for (const c of Array.from(o.phraseToAction.keys()))
|
|
1048
1050
|
if (c.startsWith(n))
|
|
1049
|
-
return e.slice(
|
|
1051
|
+
return e.slice(s + (a.length - n.length));
|
|
1050
1052
|
}
|
|
1051
1053
|
}
|
|
1052
1054
|
return "";
|
|
@@ -1056,13 +1058,13 @@ class A {
|
|
|
1056
1058
|
* prefix) — i.e. a silence pause would resolve it into a command. Used by
|
|
1057
1059
|
* the manager's silence timer.
|
|
1058
1060
|
*/
|
|
1059
|
-
static pendingTailIsCompletePhrase(e,
|
|
1060
|
-
const o = A.commandPrefixTail(e,
|
|
1061
|
-
return o ?
|
|
1061
|
+
static pendingTailIsCompletePhrase(e, t) {
|
|
1062
|
+
const o = A.commandPrefixTail(e, t).trim().toLowerCase();
|
|
1063
|
+
return o ? R(t).phraseToAction.has(o) : !1;
|
|
1062
1064
|
}
|
|
1063
1065
|
}
|
|
1064
|
-
const
|
|
1065
|
-
class
|
|
1066
|
+
const Te = 55, Ie = 90;
|
|
1067
|
+
class G {
|
|
1066
1068
|
/**
|
|
1067
1069
|
* Next paced step toward `processed`: normally one word per tick so text
|
|
1068
1070
|
* flows evenly instead of landing in bursty chunks; proportionally larger
|
|
@@ -1071,28 +1073,28 @@ class V {
|
|
|
1071
1073
|
*/
|
|
1072
1074
|
static nextDripText({
|
|
1073
1075
|
displayed: e,
|
|
1074
|
-
processed:
|
|
1076
|
+
processed: t
|
|
1075
1077
|
}) {
|
|
1076
|
-
if (
|
|
1077
|
-
const o =
|
|
1078
|
-
if (o >
|
|
1079
|
-
return
|
|
1078
|
+
if (t.length <= e.length) return t;
|
|
1079
|
+
const o = t.length - e.length;
|
|
1080
|
+
if (o > Ie)
|
|
1081
|
+
return t.slice(0, e.length + Math.ceil(o / 3));
|
|
1080
1082
|
let r = e.length;
|
|
1081
|
-
for (; r <
|
|
1082
|
-
for (; r <
|
|
1083
|
-
return r - e.length > 12 && (r = e.length + 6),
|
|
1083
|
+
for (; r < t.length && /\s/.test(t.charAt(r)); ) r++;
|
|
1084
|
+
for (; r < t.length && !/\s/.test(t.charAt(r)); ) r++;
|
|
1085
|
+
return r - e.length > 12 && (r = e.length + 6), t.slice(0, Math.max(r, e.length + 1));
|
|
1084
1086
|
}
|
|
1085
1087
|
/** Normalize a BCP-47 browser locale into the hint OpenAI accepts. */
|
|
1086
1088
|
static languageHint(e) {
|
|
1087
1089
|
if (!e) return;
|
|
1088
|
-
const
|
|
1089
|
-
if (/^zh-(cn|tw|hk)$/.test(
|
|
1090
|
-
const o =
|
|
1090
|
+
const t = e.toLowerCase();
|
|
1091
|
+
if (/^zh-(cn|tw|hk)$/.test(t)) return t;
|
|
1092
|
+
const o = t.split("-")[0];
|
|
1091
1093
|
return o && /^[a-z]{2,3}$/.test(o) ? o : void 0;
|
|
1092
1094
|
}
|
|
1093
1095
|
}
|
|
1094
|
-
const
|
|
1095
|
-
class
|
|
1096
|
+
const Me = 2e4;
|
|
1097
|
+
class De {
|
|
1096
1098
|
constructor() {
|
|
1097
1099
|
this.cached = null, this.inflight = null;
|
|
1098
1100
|
}
|
|
@@ -1100,15 +1102,15 @@ class Me {
|
|
|
1100
1102
|
get() {
|
|
1101
1103
|
if (!this.cached) return null;
|
|
1102
1104
|
const e = Date.parse(this.cached.expiresAt);
|
|
1103
|
-
return Number.isNaN(e) || e - Date.now() <
|
|
1105
|
+
return Number.isNaN(e) || e - Date.now() < Me ? (this.cached = null, null) : this.cached;
|
|
1104
1106
|
}
|
|
1105
1107
|
/**
|
|
1106
1108
|
* Resolve a mint, deduping concurrent requests (hover-prewarm racing a
|
|
1107
1109
|
* click reuses the same in-flight promise instead of double-minting).
|
|
1108
1110
|
*/
|
|
1109
1111
|
async resolve(e) {
|
|
1110
|
-
const
|
|
1111
|
-
return
|
|
1112
|
+
const t = this.get();
|
|
1113
|
+
return t || (this.inflight || (this.inflight = e().then((o) => (this.cached = o, o)).finally(() => {
|
|
1112
1114
|
this.inflight = null;
|
|
1113
1115
|
})), this.inflight);
|
|
1114
1116
|
}
|
|
@@ -1117,60 +1119,60 @@ class Me {
|
|
|
1117
1119
|
this.cached = null;
|
|
1118
1120
|
}
|
|
1119
1121
|
}
|
|
1120
|
-
function
|
|
1122
|
+
function Z(i) {
|
|
1121
1123
|
return typeof i == "object" && i !== null && !Array.isArray(i);
|
|
1122
1124
|
}
|
|
1123
|
-
function
|
|
1124
|
-
if (!
|
|
1125
|
-
const e =
|
|
1125
|
+
function Re(i) {
|
|
1126
|
+
if (!Z(i) || typeof i.type != "string") return null;
|
|
1127
|
+
const e = Z(i.error) ? i.error : null;
|
|
1126
1128
|
return {
|
|
1127
1129
|
type: i.type,
|
|
1128
1130
|
delta: typeof i.delta == "string" ? i.delta : void 0,
|
|
1129
1131
|
errorMessage: e && typeof e.message == "string" ? e.message : void 0
|
|
1130
1132
|
};
|
|
1131
1133
|
}
|
|
1132
|
-
const
|
|
1134
|
+
const Ne = "https://api.openai.com/v1/realtime/calls", Ke = 600 * 1e3, Le = 15e3, Oe = 5e3;
|
|
1133
1135
|
class T extends Error {
|
|
1134
1136
|
}
|
|
1135
|
-
class
|
|
1137
|
+
class Fe {
|
|
1136
1138
|
constructor({
|
|
1137
1139
|
mintToken: e,
|
|
1138
|
-
onDelta:
|
|
1140
|
+
onDelta: t,
|
|
1139
1141
|
onState: o,
|
|
1140
1142
|
onError: r,
|
|
1141
1143
|
onLevel: _
|
|
1142
1144
|
}) {
|
|
1143
|
-
this.state = "idle", this.pc = null, this.dc = null, this.stream = null, this.audioContext = null, this.levelRaf = 0, this.timers = [], this.loggedParseFailure = !1, this.mintToken = e, this.onDelta =
|
|
1145
|
+
this.state = "idle", this.pc = null, this.dc = null, this.stream = null, this.audioContext = null, this.levelRaf = 0, this.timers = [], this.loggedParseFailure = !1, this.mintToken = e, this.onDelta = t, this.onState = o, this.onError = r, this.onLevel = _;
|
|
1144
1146
|
}
|
|
1145
1147
|
async start() {
|
|
1146
1148
|
if (this.state === "idle") {
|
|
1147
1149
|
this.setState("connecting"), this.timers.push(
|
|
1148
1150
|
setTimeout(() => {
|
|
1149
1151
|
this.state === "connecting" && this.fail("unavailable");
|
|
1150
|
-
},
|
|
1151
|
-
), this.timers.push(setTimeout(() => this.stop(),
|
|
1152
|
+
}, Le)
|
|
1153
|
+
), this.timers.push(setTimeout(() => this.stop(), Ke));
|
|
1152
1154
|
try {
|
|
1153
1155
|
const e = this.requestMicrophone();
|
|
1154
1156
|
e.then((d) => {
|
|
1155
1157
|
this.isTornDown() || this.stream && this.stream !== d ? d.getTracks().forEach((l) => l.stop()) : this.stream = d;
|
|
1156
1158
|
}).catch(() => {
|
|
1157
1159
|
});
|
|
1158
|
-
const [
|
|
1160
|
+
const [t, o] = await Promise.all([e, this.mintToken()]);
|
|
1159
1161
|
if (this.isTornDown()) {
|
|
1160
|
-
|
|
1162
|
+
t.getTracks().forEach((d) => d.stop());
|
|
1161
1163
|
return;
|
|
1162
1164
|
}
|
|
1163
|
-
this.stream =
|
|
1165
|
+
this.stream = t, this.startLevelMeter(t);
|
|
1164
1166
|
const r = new RTCPeerConnection();
|
|
1165
1167
|
this.pc = r;
|
|
1166
|
-
const [_] =
|
|
1168
|
+
const [_] = t.getAudioTracks();
|
|
1167
1169
|
if (!_) throw new T("No audio track");
|
|
1168
|
-
r.addTrack(_,
|
|
1169
|
-
const
|
|
1170
|
-
this.dc =
|
|
1170
|
+
r.addTrack(_, t);
|
|
1171
|
+
const s = r.createDataChannel("oai-events");
|
|
1172
|
+
this.dc = s, s.addEventListener(
|
|
1171
1173
|
"message",
|
|
1172
1174
|
(d) => this.handleServerEvent(d.data)
|
|
1173
|
-
),
|
|
1175
|
+
), s.addEventListener("open", () => {
|
|
1174
1176
|
this.state === "connecting" && this.setState("listening");
|
|
1175
1177
|
}), r.addEventListener("connectionstatechange", () => {
|
|
1176
1178
|
if (r.connectionState === "failed") {
|
|
@@ -1180,12 +1182,12 @@ class Oe {
|
|
|
1180
1182
|
r.connectionState === "disconnected" && this.timers.push(
|
|
1181
1183
|
setTimeout(() => {
|
|
1182
1184
|
this.pc === r && r.connectionState !== "connected" && this.fail("unavailable");
|
|
1183
|
-
},
|
|
1185
|
+
}, Oe)
|
|
1184
1186
|
);
|
|
1185
1187
|
});
|
|
1186
1188
|
const a = await r.createOffer();
|
|
1187
1189
|
if (this.isTornDown() || (await r.setLocalDescription(a), this.isTornDown())) return;
|
|
1188
|
-
const n = await fetch(
|
|
1190
|
+
const n = await fetch(Ne, {
|
|
1189
1191
|
method: "POST",
|
|
1190
1192
|
headers: {
|
|
1191
1193
|
Authorization: `Bearer ${o.token}`,
|
|
@@ -1220,24 +1222,24 @@ class Oe {
|
|
|
1220
1222
|
autoGainControl: !0
|
|
1221
1223
|
}
|
|
1222
1224
|
});
|
|
1223
|
-
} catch (
|
|
1225
|
+
} catch (t) {
|
|
1224
1226
|
throw new T(
|
|
1225
|
-
|
|
1227
|
+
t instanceof DOMException ? t.name : "Could not access the microphone"
|
|
1226
1228
|
);
|
|
1227
1229
|
}
|
|
1228
1230
|
}
|
|
1229
1231
|
handleServerEvent(e) {
|
|
1230
1232
|
if (typeof e != "string") return;
|
|
1231
|
-
let
|
|
1233
|
+
let t;
|
|
1232
1234
|
try {
|
|
1233
|
-
|
|
1235
|
+
t = JSON.parse(e);
|
|
1234
1236
|
} catch {
|
|
1235
1237
|
this.loggedParseFailure || (this.loggedParseFailure = !0, b.error("dictation server event was not valid JSON", {
|
|
1236
1238
|
snippet: e.slice(0, 120)
|
|
1237
1239
|
}));
|
|
1238
1240
|
return;
|
|
1239
1241
|
}
|
|
1240
|
-
const o =
|
|
1242
|
+
const o = Re(t);
|
|
1241
1243
|
if (!o) return;
|
|
1242
1244
|
const { type: r, delta: _ } = o;
|
|
1243
1245
|
if (r === "session.created" || r === "transcription_session.created") {
|
|
@@ -1255,11 +1257,11 @@ class Oe {
|
|
|
1255
1257
|
startLevelMeter(e) {
|
|
1256
1258
|
if (this.onLevel)
|
|
1257
1259
|
try {
|
|
1258
|
-
const
|
|
1259
|
-
this.audioContext =
|
|
1260
|
-
const o =
|
|
1260
|
+
const t = new AudioContext();
|
|
1261
|
+
this.audioContext = t;
|
|
1262
|
+
const o = t.createMediaStreamSource(e), r = t.createAnalyser();
|
|
1261
1263
|
r.fftSize = 512, o.connect(r);
|
|
1262
|
-
const _ = new Uint8Array(r.frequencyBinCount),
|
|
1264
|
+
const _ = new Uint8Array(r.frequencyBinCount), s = () => {
|
|
1263
1265
|
var c;
|
|
1264
1266
|
r.getByteTimeDomainData(_);
|
|
1265
1267
|
let a = 0;
|
|
@@ -1268,12 +1270,12 @@ class Oe {
|
|
|
1268
1270
|
a += l * l;
|
|
1269
1271
|
}
|
|
1270
1272
|
const n = Math.sqrt(a / _.length);
|
|
1271
|
-
(c = this.onLevel) == null || c.call(this, Math.min(1, n * 4)), this.levelRaf = requestAnimationFrame(
|
|
1273
|
+
(c = this.onLevel) == null || c.call(this, Math.min(1, n * 4)), this.levelRaf = requestAnimationFrame(s);
|
|
1272
1274
|
};
|
|
1273
|
-
this.levelRaf = requestAnimationFrame(
|
|
1274
|
-
} catch (
|
|
1275
|
+
this.levelRaf = requestAnimationFrame(s);
|
|
1276
|
+
} catch (t) {
|
|
1275
1277
|
b.error("dictation level meter unavailable", {
|
|
1276
|
-
_e:
|
|
1278
|
+
_e: t instanceof Error ? t.message : String(t)
|
|
1277
1279
|
});
|
|
1278
1280
|
}
|
|
1279
1281
|
}
|
|
@@ -1284,8 +1286,8 @@ class Oe {
|
|
|
1284
1286
|
this.isTornDown() || (this.teardown(), this.setState("error"), this.onError(e));
|
|
1285
1287
|
}
|
|
1286
1288
|
teardown() {
|
|
1287
|
-
var e,
|
|
1288
|
-
this.timers.forEach((_) => clearTimeout(_)), this.timers = [], this.levelRaf && cancelAnimationFrame(this.levelRaf), this.levelRaf = 0, (e = this.dc) == null || e.close(), this.dc = null, (
|
|
1289
|
+
var e, t, o, r;
|
|
1290
|
+
this.timers.forEach((_) => clearTimeout(_)), this.timers = [], this.levelRaf && cancelAnimationFrame(this.levelRaf), this.levelRaf = 0, (e = this.dc) == null || e.close(), this.dc = null, (t = this.pc) == null || t.close(), this.pc = null, (o = this.stream) == null || o.getTracks().forEach((_) => _.stop()), this.stream = null, (r = this.audioContext) == null || r.close().catch((_) => {
|
|
1289
1291
|
b.error("failed to close dictation audio context", {
|
|
1290
1292
|
_e: String(_)
|
|
1291
1293
|
});
|
|
@@ -1295,20 +1297,20 @@ class Oe {
|
|
|
1295
1297
|
this.state !== e && (this.state = e, this.onState(e));
|
|
1296
1298
|
}
|
|
1297
1299
|
}
|
|
1298
|
-
const
|
|
1299
|
-
class
|
|
1300
|
-
constructor({ api: e, config:
|
|
1301
|
-
this.state = new z(
|
|
1300
|
+
const Ue = 1300, Be = { status: "idle", error: null };
|
|
1301
|
+
class He {
|
|
1302
|
+
constructor({ api: e, config: t }) {
|
|
1303
|
+
this.state = new z(Be), this.levelRef = { current: 0 }, this.mintCache = new De(), this.session = null, this.target = null, this.prefix = "", this.raw = "", this.processed = "", this.displayed = "", this.dripTimer = null, this.silenceTimer = null, this.isActive = () => this.session !== null, this.prewarm = () => {
|
|
1302
1304
|
this.mintToken().catch((o) => {
|
|
1303
1305
|
this.mintCache.clear(), b.error("dictation token prewarm failed", {
|
|
1304
1306
|
_e: o instanceof Error ? o.message : String(o)
|
|
1305
1307
|
});
|
|
1306
1308
|
});
|
|
1307
1309
|
}, this.start = (o) => {
|
|
1308
|
-
this.session && this.teardown(), this.target = o, this.language =
|
|
1310
|
+
this.session && this.teardown(), this.target = o, this.language = G.languageHint(
|
|
1309
1311
|
this.config.language ?? navigator.language
|
|
1310
1312
|
), this.prefix = o.getValue(), this.raw = "", this.processed = "", this.displayed = "";
|
|
1311
|
-
const r = new
|
|
1313
|
+
const r = new Fe({
|
|
1312
1314
|
mintToken: this.mintToken,
|
|
1313
1315
|
onLevel: (_) => {
|
|
1314
1316
|
this.levelRef.current = _;
|
|
@@ -1326,12 +1328,12 @@ class Be {
|
|
|
1326
1328
|
return;
|
|
1327
1329
|
}
|
|
1328
1330
|
this.raw += _;
|
|
1329
|
-
const
|
|
1330
|
-
if (
|
|
1331
|
+
const s = this.ingest();
|
|
1332
|
+
if (s === "stop") {
|
|
1331
1333
|
this.teardown();
|
|
1332
1334
|
return;
|
|
1333
1335
|
}
|
|
1334
|
-
if (
|
|
1336
|
+
if (s === "send") {
|
|
1335
1337
|
this.teardown({ send: !0 });
|
|
1336
1338
|
return;
|
|
1337
1339
|
}
|
|
@@ -1343,7 +1345,7 @@ class Be {
|
|
|
1343
1345
|
this.raw = `${this.raw}.`;
|
|
1344
1346
|
const a = this.ingest();
|
|
1345
1347
|
a === "stop" ? this.teardown() : a === "send" && this.teardown({ send: !0 });
|
|
1346
|
-
},
|
|
1348
|
+
}, Ue));
|
|
1347
1349
|
}
|
|
1348
1350
|
});
|
|
1349
1351
|
this.session = r, this.state.set({ status: "connecting", error: null }), this.dripTimer = setInterval(() => {
|
|
@@ -1353,18 +1355,18 @@ class Be {
|
|
|
1353
1355
|
return;
|
|
1354
1356
|
}
|
|
1355
1357
|
this.applyDisplayed(
|
|
1356
|
-
|
|
1358
|
+
G.nextDripText({
|
|
1357
1359
|
displayed: this.displayed,
|
|
1358
1360
|
processed: this.processed
|
|
1359
1361
|
})
|
|
1360
1362
|
);
|
|
1361
1363
|
}
|
|
1362
|
-
},
|
|
1364
|
+
}, Te), r.start();
|
|
1363
1365
|
}, this.stop = (o) => {
|
|
1364
1366
|
this.session && this.teardown(o);
|
|
1365
1367
|
}, this.mintToken = async () => this.mintCache.resolve(
|
|
1366
1368
|
() => this.api.createDictationSession({ language: this.language })
|
|
1367
|
-
), this.api = e, this.config =
|
|
1369
|
+
), this.api = e, this.config = t;
|
|
1368
1370
|
}
|
|
1369
1371
|
/** Applied text = prefix + dictated. A mismatch means the visitor edited. */
|
|
1370
1372
|
isConsistent() {
|
|
@@ -1376,28 +1378,28 @@ class Be {
|
|
|
1376
1378
|
/** Process the transcript and apply the outcome. Shared by the delta path,
|
|
1377
1379
|
* the silence timer, and (with `final`) teardown. Returns the control. */
|
|
1378
1380
|
ingest(e) {
|
|
1379
|
-
const
|
|
1381
|
+
const t = A.process(this.raw, {
|
|
1380
1382
|
language: this.language,
|
|
1381
1383
|
final: e == null ? void 0 : e.final
|
|
1382
1384
|
});
|
|
1383
|
-
return this.processed =
|
|
1385
|
+
return this.processed = t.text, t.text.startsWith(this.displayed) || this.applyDisplayed(t.text), t.control;
|
|
1384
1386
|
}
|
|
1385
1387
|
stopSilenceTimer() {
|
|
1386
1388
|
this.silenceTimer && clearTimeout(this.silenceTimer), this.silenceTimer = null;
|
|
1387
1389
|
}
|
|
1388
1390
|
teardown(e) {
|
|
1389
1391
|
var _;
|
|
1390
|
-
const
|
|
1392
|
+
const t = this.session, o = this.target;
|
|
1391
1393
|
this.dripTimer && clearInterval(this.dripTimer), this.dripTimer = null, this.stopSilenceTimer();
|
|
1392
1394
|
let r = (e == null ? void 0 : e.send) ?? !1;
|
|
1393
1395
|
if (o && this.isConsistent()) {
|
|
1394
|
-
const
|
|
1395
|
-
(e == null ? void 0 : e.executeFinalCommand) !== !1 &&
|
|
1396
|
+
const s = this.ingest({ final: !0 });
|
|
1397
|
+
(e == null ? void 0 : e.executeFinalCommand) !== !1 && s === "send" && (r = !0), this.processed !== this.displayed && this.applyDisplayed(this.processed);
|
|
1396
1398
|
}
|
|
1397
|
-
this.session = null, this.target = null,
|
|
1399
|
+
this.session = null, this.target = null, t == null || t.stop(), this.levelRef.current = 0, this.state.set({ status: "idle", error: (e == null ? void 0 : e.error) ?? null }), r && ((_ = o == null ? void 0 : o.onSend) == null || _.call(o));
|
|
1398
1400
|
}
|
|
1399
1401
|
}
|
|
1400
|
-
const
|
|
1402
|
+
const Ve = {
|
|
1401
1403
|
write_a_message_placeholder: "اكتب رسالة...",
|
|
1402
1404
|
your_issue_has_been_resolved: "تم حل مشكلتك!",
|
|
1403
1405
|
new_conversation: "محادثة جديدة",
|
|
@@ -1448,7 +1450,7 @@ const He = {
|
|
|
1448
1450
|
steps: "خطوات",
|
|
1449
1451
|
step_arguments: "الوسائط",
|
|
1450
1452
|
step_result: "النتيجة",
|
|
1451
|
-
attach_files: "إرفاق صور أو مقاطع فيديو أو ملفات PDF أو جداول بيانات (الحد الأقصى
|
|
1453
|
+
attach_files: "إرفاق صور أو مقاطع فيديو أو ملفات PDF أو جداول بيانات (الحد الأقصى 50 ميغابايت)",
|
|
1452
1454
|
mark_page_active: "انقر على أي شيء في الصفحة لتحديده — اضغط Esc للإلغاء",
|
|
1453
1455
|
mark_page: "حدّد شيئًا في الصفحة لطرح سؤال عنه",
|
|
1454
1456
|
stop_response: "إيقاف الرد",
|
|
@@ -1507,7 +1509,7 @@ const He = {
|
|
|
1507
1509
|
zoom_out: "تصغير",
|
|
1508
1510
|
reset_zoom: "إعادة تعيين التكبير",
|
|
1509
1511
|
support_chat_aria_label: "دردشة الدعم"
|
|
1510
|
-
},
|
|
1512
|
+
}, Ge = {
|
|
1511
1513
|
write_a_message_placeholder: "একটি বার্তা লিখুন...",
|
|
1512
1514
|
your_issue_has_been_resolved: "আপনার সমস্যা সমাধান হয়েছে!",
|
|
1513
1515
|
new_conversation: "নতুন কথোপকথন",
|
|
@@ -1545,7 +1547,7 @@ const He = {
|
|
|
1545
1547
|
steps: "ধাপ",
|
|
1546
1548
|
step_arguments: "আর্গুমেন্ট",
|
|
1547
1549
|
step_result: "ফলাফল",
|
|
1548
|
-
attach_files: "ছবি, ভিডিও, PDF বা স্প্রেডশিট সংযুক্ত করুন (সর্বোচ্চ আকার
|
|
1550
|
+
attach_files: "ছবি, ভিডিও, PDF বা স্প্রেডশিট সংযুক্ত করুন (সর্বোচ্চ আকার 50 MB)",
|
|
1549
1551
|
mark_page_active: "চিহ্নিত করতে পৃষ্ঠার যেকোনো কিছুতে ক্লিক করুন — বাতিল করতে Esc চাপুন",
|
|
1550
1552
|
mark_page: "পৃষ্ঠার কোনো কিছু সম্পর্কে জিজ্ঞাসা করতে সেটি চিহ্নিত করুন",
|
|
1551
1553
|
stop_response: "উত্তর থামান",
|
|
@@ -1604,7 +1606,7 @@ const He = {
|
|
|
1604
1606
|
zoom_out: "ছোট করুন",
|
|
1605
1607
|
reset_zoom: "জুম রিসেট করুন",
|
|
1606
1608
|
support_chat_aria_label: "সাপোর্ট চ্যাট"
|
|
1607
|
-
},
|
|
1609
|
+
}, Ze = {
|
|
1608
1610
|
write_a_message_placeholder: "Напишете съобщение...",
|
|
1609
1611
|
your_issue_has_been_resolved: "Вашият проблем е разрешен!",
|
|
1610
1612
|
new_conversation: "Нов разговор",
|
|
@@ -1642,7 +1644,7 @@ const He = {
|
|
|
1642
1644
|
steps: "стъпки",
|
|
1643
1645
|
step_arguments: "Аргументи",
|
|
1644
1646
|
step_result: "Резултат",
|
|
1645
|
-
attach_files: "Прикачете изображения, видеоклипове, PDF файлове или електронни таблици (максимален размер
|
|
1647
|
+
attach_files: "Прикачете изображения, видеоклипове, PDF файлове или електронни таблици (максимален размер 50 MB)",
|
|
1646
1648
|
mark_page_active: "Щракнете върху нещо на страницата, за да го маркирате — Esc за отказ",
|
|
1647
1649
|
mark_page: "Маркирайте нещо на страницата, за да попитате за него",
|
|
1648
1650
|
stop_response: "Спиране на отговора",
|
|
@@ -1701,7 +1703,7 @@ const He = {
|
|
|
1701
1703
|
zoom_out: "Намаляване",
|
|
1702
1704
|
reset_zoom: "Нулиране на мащаба",
|
|
1703
1705
|
support_chat_aria_label: "Чат за поддръжка"
|
|
1704
|
-
},
|
|
1706
|
+
}, We = {
|
|
1705
1707
|
write_a_message_placeholder: "Napište zprávu...",
|
|
1706
1708
|
your_issue_has_been_resolved: "Váš problém byl vyřešen!",
|
|
1707
1709
|
new_conversation: "Nová konverzace",
|
|
@@ -1739,7 +1741,7 @@ const He = {
|
|
|
1739
1741
|
steps: "kroky",
|
|
1740
1742
|
step_arguments: "Argumenty",
|
|
1741
1743
|
step_result: "Výsledek",
|
|
1742
|
-
attach_files: "Připojit obrázky, videa, PDF nebo tabulky (maximální velikost
|
|
1744
|
+
attach_files: "Připojit obrázky, videa, PDF nebo tabulky (maximální velikost 50 MB)",
|
|
1743
1745
|
mark_page_active: "Kliknutím na cokoli na stránce to označíte — klávesou Esc akci zrušíte",
|
|
1744
1746
|
mark_page: "Označte něco na stránce a zeptejte se na to",
|
|
1745
1747
|
stop_response: "Zastavit odpověď",
|
|
@@ -1798,7 +1800,7 @@ const He = {
|
|
|
1798
1800
|
zoom_out: "Oddálit",
|
|
1799
1801
|
reset_zoom: "Obnovit přiblížení",
|
|
1800
1802
|
support_chat_aria_label: "Chat podpory"
|
|
1801
|
-
},
|
|
1803
|
+
}, $e = {
|
|
1802
1804
|
write_a_message_placeholder: "Skriv en besked...",
|
|
1803
1805
|
your_issue_has_been_resolved: "Dit problem er løst!",
|
|
1804
1806
|
new_conversation: "Ny samtale",
|
|
@@ -1836,7 +1838,7 @@ const He = {
|
|
|
1836
1838
|
steps: "trin",
|
|
1837
1839
|
step_arguments: "Argumenter",
|
|
1838
1840
|
step_result: "Resultat",
|
|
1839
|
-
attach_files: "Vedhæft billeder, videoer, PDF-filer eller regneark (maksimal størrelse
|
|
1841
|
+
attach_files: "Vedhæft billeder, videoer, PDF-filer eller regneark (maksimal størrelse 50 MB)",
|
|
1840
1842
|
mark_page_active: "Klik på noget på siden for at markere det — Esc annullerer",
|
|
1841
1843
|
mark_page: "Markér noget på siden for at spørge om det",
|
|
1842
1844
|
stop_response: "Stop svar",
|
|
@@ -1895,7 +1897,7 @@ const He = {
|
|
|
1895
1897
|
zoom_out: "Zoom ud",
|
|
1896
1898
|
reset_zoom: "Nulstil zoom",
|
|
1897
1899
|
support_chat_aria_label: "Supportchat"
|
|
1898
|
-
},
|
|
1900
|
+
}, Je = {
|
|
1899
1901
|
write_a_message_placeholder: "Γράψτε ένα μήνυμα...",
|
|
1900
1902
|
your_issue_has_been_resolved: "Το πρόβλημά σας επιλύθηκε!",
|
|
1901
1903
|
new_conversation: "Νέα συνομιλία",
|
|
@@ -1933,7 +1935,7 @@ const He = {
|
|
|
1933
1935
|
steps: "βήματα",
|
|
1934
1936
|
step_arguments: "Ορίσματα",
|
|
1935
1937
|
step_result: "Αποτέλεσμα",
|
|
1936
|
-
attach_files: "Επισύναψη εικόνων, βίντεο, PDF ή υπολογιστικών φύλλων (μέγιστο μέγεθος
|
|
1938
|
+
attach_files: "Επισύναψη εικόνων, βίντεο, PDF ή υπολογιστικών φύλλων (μέγιστο μέγεθος 50 MB)",
|
|
1937
1939
|
mark_page_active: "Κάντε κλικ σε οτιδήποτε στη σελίδα για να το επισημάνετε — Esc για ακύρωση",
|
|
1938
1940
|
mark_page: "Επισημάνετε κάτι στη σελίδα για να ρωτήσετε σχετικά με αυτό",
|
|
1939
1941
|
stop_response: "Διακοπή απάντησης",
|
|
@@ -1992,7 +1994,7 @@ const He = {
|
|
|
1992
1994
|
zoom_out: "Σμίκρυνση",
|
|
1993
1995
|
reset_zoom: "Επαναφορά ζουμ",
|
|
1994
1996
|
support_chat_aria_label: "Συνομιλία υποστήριξης"
|
|
1995
|
-
},
|
|
1997
|
+
}, Ye = {
|
|
1996
1998
|
write_a_message_placeholder: "Nachricht schreiben...",
|
|
1997
1999
|
your_issue_has_been_resolved: "Ihr Problem wurde gelöst!",
|
|
1998
2000
|
new_conversation: "Neue Konversation",
|
|
@@ -2030,7 +2032,7 @@ const He = {
|
|
|
2030
2032
|
steps: "Schritte",
|
|
2031
2033
|
step_arguments: "Argumente",
|
|
2032
2034
|
step_result: "Ergebnis",
|
|
2033
|
-
attach_files: "Bilder, Videos, PDFs oder Tabellen anhängen (maximale Größe
|
|
2035
|
+
attach_files: "Bilder, Videos, PDFs oder Tabellen anhängen (maximale Größe 50 MB)",
|
|
2034
2036
|
mark_page_active: "Klicken Sie auf etwas auf der Seite, um es zu markieren — Esc zum Abbrechen",
|
|
2035
2037
|
mark_page: "Markieren Sie etwas auf der Seite, um danach zu fragen",
|
|
2036
2038
|
stop_response: "Antwort stoppen",
|
|
@@ -2089,7 +2091,7 @@ const He = {
|
|
|
2089
2091
|
zoom_out: "Verkleinern",
|
|
2090
2092
|
reset_zoom: "Zoom zurücksetzen",
|
|
2091
2093
|
support_chat_aria_label: "Support-Chat"
|
|
2092
|
-
},
|
|
2094
|
+
}, Q = {
|
|
2093
2095
|
write_a_message_placeholder: "Write a message...",
|
|
2094
2096
|
your_issue_has_been_resolved: "Your issue has been resolved!",
|
|
2095
2097
|
new_conversation: "New conversation",
|
|
@@ -2140,7 +2142,7 @@ const He = {
|
|
|
2140
2142
|
steps: "steps",
|
|
2141
2143
|
step_arguments: "Arguments",
|
|
2142
2144
|
step_result: "Result",
|
|
2143
|
-
attach_files: "Attach images, videos, PDFs, or spreadsheets (maximum size
|
|
2145
|
+
attach_files: "Attach images, videos, PDFs, or spreadsheets (maximum size 50 MB)",
|
|
2144
2146
|
mark_page_active: "Click anything on the page to mark it — Esc to cancel",
|
|
2145
2147
|
mark_page: "Mark something on the page to ask about it",
|
|
2146
2148
|
stop_response: "Stop response",
|
|
@@ -2199,7 +2201,7 @@ const He = {
|
|
|
2199
2201
|
zoom_out: "Zoom out",
|
|
2200
2202
|
reset_zoom: "Reset zoom",
|
|
2201
2203
|
support_chat_aria_label: "Support chat"
|
|
2202
|
-
},
|
|
2204
|
+
}, Qe = {
|
|
2203
2205
|
write_a_message_placeholder: "Escribe un mensaje...",
|
|
2204
2206
|
your_issue_has_been_resolved: "¡Tu problema fue resuelto!",
|
|
2205
2207
|
new_conversation: "Nueva conversación",
|
|
@@ -2237,7 +2239,7 @@ const He = {
|
|
|
2237
2239
|
steps: "pasos",
|
|
2238
2240
|
step_arguments: "Argumentos",
|
|
2239
2241
|
step_result: "Resultado",
|
|
2240
|
-
attach_files: "Adjuntar imágenes, vídeos, PDF u hojas de cálculo (tamaño máximo
|
|
2242
|
+
attach_files: "Adjuntar imágenes, vídeos, PDF u hojas de cálculo (tamaño máximo 50 MB)",
|
|
2241
2243
|
mark_page_active: "Haz clic en cualquier elemento de la página para marcarlo — Esc para cancelar",
|
|
2242
2244
|
mark_page: "Marca algo de la página para preguntar sobre ello",
|
|
2243
2245
|
stop_response: "Detener respuesta",
|
|
@@ -2296,7 +2298,7 @@ const He = {
|
|
|
2296
2298
|
zoom_out: "Alejar",
|
|
2297
2299
|
reset_zoom: "Restablecer zoom",
|
|
2298
2300
|
support_chat_aria_label: "Chat de soporte"
|
|
2299
|
-
},
|
|
2301
|
+
}, Xe = {
|
|
2300
2302
|
write_a_message_placeholder: "Magsulat ng mensahe...",
|
|
2301
2303
|
your_issue_has_been_resolved: "Nalutas na ang iyong isyu!",
|
|
2302
2304
|
new_conversation: "Bagong usapan",
|
|
@@ -2334,7 +2336,7 @@ const He = {
|
|
|
2334
2336
|
steps: "mga hakbang",
|
|
2335
2337
|
step_arguments: "Mga argumento",
|
|
2336
2338
|
step_result: "Resulta",
|
|
2337
|
-
attach_files: "Mag-attach ng mga larawan, video, PDF, o spreadsheet (maximum na laki
|
|
2339
|
+
attach_files: "Mag-attach ng mga larawan, video, PDF, o spreadsheet (maximum na laki 50 MB)",
|
|
2338
2340
|
mark_page_active: "Mag-click ng kahit ano sa page para markahan ito — Esc para kanselahin",
|
|
2339
2341
|
mark_page: "Markahan ang isang bagay sa page para magtanong tungkol dito",
|
|
2340
2342
|
stop_response: "Ihinto ang sagot",
|
|
@@ -2393,7 +2395,7 @@ const He = {
|
|
|
2393
2395
|
zoom_out: "Paliitin",
|
|
2394
2396
|
reset_zoom: "I-reset ang zoom",
|
|
2395
2397
|
support_chat_aria_label: "Chat ng suporta"
|
|
2396
|
-
},
|
|
2398
|
+
}, ea = {
|
|
2397
2399
|
write_a_message_placeholder: "Kirjoita viesti...",
|
|
2398
2400
|
your_issue_has_been_resolved: "Ongelmasi on ratkaistu!",
|
|
2399
2401
|
new_conversation: "Uusi keskustelu",
|
|
@@ -2431,7 +2433,7 @@ const He = {
|
|
|
2431
2433
|
steps: "vaihetta",
|
|
2432
2434
|
step_arguments: "Argumentit",
|
|
2433
2435
|
step_result: "Tulos",
|
|
2434
|
-
attach_files: "Liitä kuvia, videoita, PDF-tiedostoja tai laskentataulukoita (enimmäiskoko
|
|
2436
|
+
attach_files: "Liitä kuvia, videoita, PDF-tiedostoja tai laskentataulukoita (enimmäiskoko 50 MB)",
|
|
2435
2437
|
mark_page_active: "Merkitse sivulta jotain napsauttamalla sitä — peruuta Esc-näppäimellä",
|
|
2436
2438
|
mark_page: "Merkitse sivulta jotain kysyäksesi siitä",
|
|
2437
2439
|
stop_response: "Pysäytä vastaus",
|
|
@@ -2490,7 +2492,7 @@ const He = {
|
|
|
2490
2492
|
zoom_out: "Loitonna",
|
|
2491
2493
|
reset_zoom: "Palauta zoomaus",
|
|
2492
2494
|
support_chat_aria_label: "Tukichat"
|
|
2493
|
-
},
|
|
2495
|
+
}, aa = {
|
|
2494
2496
|
write_a_message_placeholder: "Écrivez un message...",
|
|
2495
2497
|
your_issue_has_been_resolved: "Votre problème a été résolu !",
|
|
2496
2498
|
new_conversation: "Nouvelle conversation",
|
|
@@ -2528,7 +2530,7 @@ const He = {
|
|
|
2528
2530
|
steps: "étapes",
|
|
2529
2531
|
step_arguments: "Arguments",
|
|
2530
2532
|
step_result: "Résultat",
|
|
2531
|
-
attach_files: "Joindre des images, des vidéos, des PDF ou des feuilles de calcul (taille maximale
|
|
2533
|
+
attach_files: "Joindre des images, des vidéos, des PDF ou des feuilles de calcul (taille maximale 50 Mo)",
|
|
2532
2534
|
mark_page_active: "Cliquez sur un élément de la page pour le marquer — Échap pour annuler",
|
|
2533
2535
|
mark_page: "Marquez un élément de la page pour poser une question à son sujet",
|
|
2534
2536
|
stop_response: "Arrêter la réponse",
|
|
@@ -2587,7 +2589,7 @@ const He = {
|
|
|
2587
2589
|
zoom_out: "Zoom arrière",
|
|
2588
2590
|
reset_zoom: "Réinitialiser le zoom",
|
|
2589
2591
|
support_chat_aria_label: "Chat de support"
|
|
2590
|
-
},
|
|
2592
|
+
}, ta = {
|
|
2591
2593
|
write_a_message_placeholder: "एक संदेश लिखें...",
|
|
2592
2594
|
your_issue_has_been_resolved: "आपकी समस्या हल हो गई है!",
|
|
2593
2595
|
new_conversation: "नई बातचीत",
|
|
@@ -2625,7 +2627,7 @@ const He = {
|
|
|
2625
2627
|
steps: "चरण",
|
|
2626
2628
|
step_arguments: "आर्ग्युमेंट",
|
|
2627
2629
|
step_result: "परिणाम",
|
|
2628
|
-
attach_files: "चित्र, वीडियो, PDF या स्प्रेडशीट संलग्न करें (अधिकतम आकार
|
|
2630
|
+
attach_files: "चित्र, वीडियो, PDF या स्प्रेडशीट संलग्न करें (अधिकतम आकार 50 MB)",
|
|
2629
2631
|
mark_page_active: "चिह्नित करने के लिए पेज पर किसी भी चीज़ पर क्लिक करें — रद्द करने के लिए Esc दबाएँ",
|
|
2630
2632
|
mark_page: "पेज पर किसी चीज़ के बारे में पूछने के लिए उसे चिह्नित करें",
|
|
2631
2633
|
stop_response: "जवाब रोकें",
|
|
@@ -2684,7 +2686,7 @@ const He = {
|
|
|
2684
2686
|
zoom_out: "ज़ूम आउट",
|
|
2685
2687
|
reset_zoom: "ज़ूम रीसेट करें",
|
|
2686
2688
|
support_chat_aria_label: "सहायता चैट"
|
|
2687
|
-
},
|
|
2689
|
+
}, sa = {
|
|
2688
2690
|
write_a_message_placeholder: "Scrivi un messaggio...",
|
|
2689
2691
|
your_issue_has_been_resolved: "Il tuo problema è stato risolto!",
|
|
2690
2692
|
new_conversation: "Nuova conversazione",
|
|
@@ -2722,7 +2724,7 @@ const He = {
|
|
|
2722
2724
|
steps: "passaggi",
|
|
2723
2725
|
step_arguments: "Argomenti",
|
|
2724
2726
|
step_result: "Risultato",
|
|
2725
|
-
attach_files: "Allega immagini, video, PDF o fogli di calcolo (dimensione massima
|
|
2727
|
+
attach_files: "Allega immagini, video, PDF o fogli di calcolo (dimensione massima 50 MB)",
|
|
2726
2728
|
mark_page_active: "Fai clic su un elemento della pagina per contrassegnarlo — Esc per annullare",
|
|
2727
2729
|
mark_page: "Contrassegna un elemento della pagina per fare una domanda al riguardo",
|
|
2728
2730
|
stop_response: "Interrompi risposta",
|
|
@@ -2781,7 +2783,7 @@ const He = {
|
|
|
2781
2783
|
zoom_out: "Riduci",
|
|
2782
2784
|
reset_zoom: "Reimposta zoom",
|
|
2783
2785
|
support_chat_aria_label: "Chat di supporto"
|
|
2784
|
-
},
|
|
2786
|
+
}, oa = {
|
|
2785
2787
|
write_a_message_placeholder: "メッセージを入力...",
|
|
2786
2788
|
your_issue_has_been_resolved: "問題が解決しました!",
|
|
2787
2789
|
new_conversation: "新しい会話",
|
|
@@ -2819,7 +2821,7 @@ const He = {
|
|
|
2819
2821
|
steps: "ステップ",
|
|
2820
2822
|
step_arguments: "引数",
|
|
2821
2823
|
step_result: "結果",
|
|
2822
|
-
attach_files: "画像、動画、PDF、スプレッドシートを添付(最大サイズ
|
|
2824
|
+
attach_files: "画像、動画、PDF、スプレッドシートを添付(最大サイズ 50 MB)",
|
|
2823
2825
|
mark_page_active: "ページ上の項目をクリックしてマーク — Esc でキャンセル",
|
|
2824
2826
|
mark_page: "質問したいページ上の項目をマーク",
|
|
2825
2827
|
stop_response: "回答を停止",
|
|
@@ -2878,7 +2880,7 @@ const He = {
|
|
|
2878
2880
|
zoom_out: "縮小",
|
|
2879
2881
|
reset_zoom: "ズームをリセット",
|
|
2880
2882
|
support_chat_aria_label: "サポートチャット"
|
|
2881
|
-
},
|
|
2883
|
+
}, na = {
|
|
2882
2884
|
write_a_message_placeholder: "메시지를 입력하세요...",
|
|
2883
2885
|
your_issue_has_been_resolved: "문제가 해결되었습니다!",
|
|
2884
2886
|
new_conversation: "새 대화",
|
|
@@ -2916,7 +2918,7 @@ const He = {
|
|
|
2916
2918
|
steps: "단계",
|
|
2917
2919
|
step_arguments: "인수",
|
|
2918
2920
|
step_result: "결과",
|
|
2919
|
-
attach_files: "이미지, 동영상, PDF 또는 스프레드시트 첨부(최대 크기
|
|
2921
|
+
attach_files: "이미지, 동영상, PDF 또는 스프레드시트 첨부(최대 크기 50 MB)",
|
|
2920
2922
|
mark_page_active: "페이지에서 표시할 항목을 클릭하세요 — 취소하려면 Esc를 누르세요",
|
|
2921
2923
|
mark_page: "질문할 페이지의 항목을 표시하세요",
|
|
2922
2924
|
stop_response: "응답 중지",
|
|
@@ -2975,7 +2977,7 @@ const He = {
|
|
|
2975
2977
|
zoom_out: "축소",
|
|
2976
2978
|
reset_zoom: "확대/축소 초기화",
|
|
2977
2979
|
support_chat_aria_label: "고객 지원 채팅"
|
|
2978
|
-
},
|
|
2980
|
+
}, ia = {
|
|
2979
2981
|
write_a_message_placeholder: "Schrijf een bericht...",
|
|
2980
2982
|
your_issue_has_been_resolved: "Uw probleem is opgelost!",
|
|
2981
2983
|
new_conversation: "Nieuw gesprek",
|
|
@@ -3013,7 +3015,7 @@ const He = {
|
|
|
3013
3015
|
steps: "stappen",
|
|
3014
3016
|
step_arguments: "Argumenten",
|
|
3015
3017
|
step_result: "Resultaat",
|
|
3016
|
-
attach_files: "Afbeeldingen, video's, pdf's of spreadsheets bijvoegen (maximale grootte
|
|
3018
|
+
attach_files: "Afbeeldingen, video's, pdf's of spreadsheets bijvoegen (maximale grootte 50 MB)",
|
|
3017
3019
|
mark_page_active: "Klik op iets op de pagina om het te markeren — Esc om te annuleren",
|
|
3018
3020
|
mark_page: "Markeer iets op de pagina om er een vraag over te stellen",
|
|
3019
3021
|
stop_response: "Antwoord stoppen",
|
|
@@ -3072,7 +3074,7 @@ const He = {
|
|
|
3072
3074
|
zoom_out: "Uitzoomen",
|
|
3073
3075
|
reset_zoom: "Zoom herstellen",
|
|
3074
3076
|
support_chat_aria_label: "Supportchat"
|
|
3075
|
-
},
|
|
3077
|
+
}, ra = {
|
|
3076
3078
|
write_a_message_placeholder: "Skriv en melding...",
|
|
3077
3079
|
your_issue_has_been_resolved: "Problemet ditt er løst!",
|
|
3078
3080
|
new_conversation: "Ny samtale",
|
|
@@ -3110,7 +3112,7 @@ const He = {
|
|
|
3110
3112
|
steps: "trinn",
|
|
3111
3113
|
step_arguments: "Argumenter",
|
|
3112
3114
|
step_result: "Resultat",
|
|
3113
|
-
attach_files: "Legg ved bilder, videoer, PDF-er eller regneark (maksimal størrelse
|
|
3115
|
+
attach_files: "Legg ved bilder, videoer, PDF-er eller regneark (maksimal størrelse 50 MB)",
|
|
3114
3116
|
mark_page_active: "Klikk på noe på siden for å markere det — Esc for å avbryte",
|
|
3115
3117
|
mark_page: "Marker noe på siden for å spørre om det",
|
|
3116
3118
|
stop_response: "Stopp svar",
|
|
@@ -3169,7 +3171,7 @@ const He = {
|
|
|
3169
3171
|
zoom_out: "Zoom ut",
|
|
3170
3172
|
reset_zoom: "Tilbakestill zoom",
|
|
3171
3173
|
support_chat_aria_label: "Support-chat"
|
|
3172
|
-
},
|
|
3174
|
+
}, _a = {
|
|
3173
3175
|
write_a_message_placeholder: "Napisz wiadomość...",
|
|
3174
3176
|
your_issue_has_been_resolved: "Twój problem został rozwiązany!",
|
|
3175
3177
|
new_conversation: "Nowa rozmowa",
|
|
@@ -3207,7 +3209,7 @@ const He = {
|
|
|
3207
3209
|
steps: "kroki",
|
|
3208
3210
|
step_arguments: "Argumenty",
|
|
3209
3211
|
step_result: "Wynik",
|
|
3210
|
-
attach_files: "Dołącz obrazy, filmy, pliki PDF lub arkusze kalkulacyjne (maksymalny rozmiar
|
|
3212
|
+
attach_files: "Dołącz obrazy, filmy, pliki PDF lub arkusze kalkulacyjne (maksymalny rozmiar 50 MB)",
|
|
3211
3213
|
mark_page_active: "Kliknij coś na stronie, aby to oznaczyć — Esc, aby anulować",
|
|
3212
3214
|
mark_page: "Oznacz coś na stronie, aby o to zapytać",
|
|
3213
3215
|
stop_response: "Zatrzymaj odpowiedź",
|
|
@@ -3266,7 +3268,7 @@ const He = {
|
|
|
3266
3268
|
zoom_out: "Pomniejsz",
|
|
3267
3269
|
reset_zoom: "Resetuj powiększenie",
|
|
3268
3270
|
support_chat_aria_label: "Czat pomocy"
|
|
3269
|
-
},
|
|
3271
|
+
}, la = {
|
|
3270
3272
|
write_a_message_placeholder: "Escreva uma mensagem...",
|
|
3271
3273
|
your_issue_has_been_resolved: "Seu problema foi resolvido!",
|
|
3272
3274
|
new_conversation: "Nova conversa",
|
|
@@ -3304,7 +3306,7 @@ const He = {
|
|
|
3304
3306
|
steps: "passos",
|
|
3305
3307
|
step_arguments: "Argumentos",
|
|
3306
3308
|
step_result: "Resultado",
|
|
3307
|
-
attach_files: "Anexar imagens, vídeos, PDFs ou folhas de cálculo (tamanho máximo
|
|
3309
|
+
attach_files: "Anexar imagens, vídeos, PDFs ou folhas de cálculo (tamanho máximo 50 MB)",
|
|
3308
3310
|
mark_page_active: "Clique em algo na página para o marcar — Esc para cancelar",
|
|
3309
3311
|
mark_page: "Marque algo na página para perguntar sobre isso",
|
|
3310
3312
|
stop_response: "Parar resposta",
|
|
@@ -3363,7 +3365,7 @@ const He = {
|
|
|
3363
3365
|
zoom_out: "Reduzir",
|
|
3364
3366
|
reset_zoom: "Redefinir zoom",
|
|
3365
3367
|
support_chat_aria_label: "Chat de suporte"
|
|
3366
|
-
},
|
|
3368
|
+
}, ca = {
|
|
3367
3369
|
write_a_message_placeholder: "Scrie un mesaj...",
|
|
3368
3370
|
your_issue_has_been_resolved: "Problema ta a fost rezolvată!",
|
|
3369
3371
|
new_conversation: "Conversație nouă",
|
|
@@ -3401,7 +3403,7 @@ const He = {
|
|
|
3401
3403
|
steps: "pași",
|
|
3402
3404
|
step_arguments: "Argumente",
|
|
3403
3405
|
step_result: "Rezultat",
|
|
3404
|
-
attach_files: "Atașează imagini, videoclipuri, PDF-uri sau foi de calcul (dimensiune maximă
|
|
3406
|
+
attach_files: "Atașează imagini, videoclipuri, PDF-uri sau foi de calcul (dimensiune maximă 50 MB)",
|
|
3405
3407
|
mark_page_active: "Dă clic pe ceva din pagină pentru a-l marca — Esc pentru anulare",
|
|
3406
3408
|
mark_page: "Marchează ceva din pagină pentru a întreba despre acel element",
|
|
3407
3409
|
stop_response: "Oprește răspunsul",
|
|
@@ -3460,7 +3462,7 @@ const He = {
|
|
|
3460
3462
|
zoom_out: "Micșorează",
|
|
3461
3463
|
reset_zoom: "Resetează zoomul",
|
|
3462
3464
|
support_chat_aria_label: "Chat de asistență"
|
|
3463
|
-
},
|
|
3465
|
+
}, pa = {
|
|
3464
3466
|
write_a_message_placeholder: "Skriv ett meddelande...",
|
|
3465
3467
|
your_issue_has_been_resolved: "Ditt problem har lösts!",
|
|
3466
3468
|
new_conversation: "Ny konversation",
|
|
@@ -3498,7 +3500,7 @@ const He = {
|
|
|
3498
3500
|
steps: "steg",
|
|
3499
3501
|
step_arguments: "Argument",
|
|
3500
3502
|
step_result: "Resultat",
|
|
3501
|
-
attach_files: "Bifoga bilder, videor, PDF-filer eller kalkylblad (maximal storlek
|
|
3503
|
+
attach_files: "Bifoga bilder, videor, PDF-filer eller kalkylblad (maximal storlek 50 MB)",
|
|
3502
3504
|
mark_page_active: "Klicka på något på sidan för att markera det — Esc för att avbryta",
|
|
3503
3505
|
mark_page: "Markera något på sidan för att fråga om det",
|
|
3504
3506
|
stop_response: "Stoppa svaret",
|
|
@@ -3557,7 +3559,7 @@ const He = {
|
|
|
3557
3559
|
zoom_out: "Zooma ut",
|
|
3558
3560
|
reset_zoom: "Återställ zoom",
|
|
3559
3561
|
support_chat_aria_label: "Supportchatt"
|
|
3560
|
-
},
|
|
3562
|
+
}, da = {
|
|
3561
3563
|
write_a_message_placeholder: "Напишите сообщение...",
|
|
3562
3564
|
your_issue_has_been_resolved: "Ваша проблема решена!",
|
|
3563
3565
|
new_conversation: "Новый разговор",
|
|
@@ -3595,7 +3597,7 @@ const He = {
|
|
|
3595
3597
|
steps: "шаги",
|
|
3596
3598
|
step_arguments: "Аргументы",
|
|
3597
3599
|
step_result: "Результат",
|
|
3598
|
-
attach_files: "Прикрепить изображения, видео, PDF-файлы или таблицы (максимальный размер
|
|
3600
|
+
attach_files: "Прикрепить изображения, видео, PDF-файлы или таблицы (максимальный размер 50 МБ)",
|
|
3599
3601
|
mark_page_active: "Нажмите на элемент страницы, чтобы отметить его — Esc для отмены",
|
|
3600
3602
|
mark_page: "Отметьте элемент на странице, чтобы задать вопрос о нём",
|
|
3601
3603
|
stop_response: "Остановить ответ",
|
|
@@ -3654,7 +3656,7 @@ const He = {
|
|
|
3654
3656
|
zoom_out: "Уменьшить",
|
|
3655
3657
|
reset_zoom: "Сбросить масштаб",
|
|
3656
3658
|
support_chat_aria_label: "Чат поддержки"
|
|
3657
|
-
},
|
|
3659
|
+
}, ua = {
|
|
3658
3660
|
write_a_message_placeholder: "เขียนข้อความ...",
|
|
3659
3661
|
your_issue_has_been_resolved: "ปัญหาของคุณได้รับการแก้ไขแล้ว!",
|
|
3660
3662
|
new_conversation: "การสนทนาใหม่",
|
|
@@ -3692,7 +3694,7 @@ const He = {
|
|
|
3692
3694
|
steps: "ขั้นตอน",
|
|
3693
3695
|
step_arguments: "อาร์กิวเมนต์",
|
|
3694
3696
|
step_result: "ผลลัพธ์",
|
|
3695
|
-
attach_files: "แนบรูปภาพ วิดีโอ PDF หรือสเปรดชีต (ขนาดสูงสุด
|
|
3697
|
+
attach_files: "แนบรูปภาพ วิดีโอ PDF หรือสเปรดชีต (ขนาดสูงสุด 50 MB)",
|
|
3696
3698
|
mark_page_active: "คลิกสิ่งใดก็ได้บนหน้าเพื่อทำเครื่องหมาย — กด Esc เพื่อยกเลิก",
|
|
3697
3699
|
mark_page: "ทำเครื่องหมายสิ่งที่อยู่บนหน้าเพื่อถามเกี่ยวกับสิ่งนั้น",
|
|
3698
3700
|
stop_response: "หยุดการตอบ",
|
|
@@ -3751,7 +3753,7 @@ const He = {
|
|
|
3751
3753
|
zoom_out: "ย่อ",
|
|
3752
3754
|
reset_zoom: "รีเซ็ตการซูม",
|
|
3753
3755
|
support_chat_aria_label: "แชทฝ่ายสนับสนุน"
|
|
3754
|
-
},
|
|
3756
|
+
}, ma = {
|
|
3755
3757
|
write_a_message_placeholder: "Bir mesaj yazın...",
|
|
3756
3758
|
your_issue_has_been_resolved: "Sorununuz çözüldü!",
|
|
3757
3759
|
new_conversation: "Yeni konuşma",
|
|
@@ -3789,7 +3791,7 @@ const He = {
|
|
|
3789
3791
|
steps: "adım",
|
|
3790
3792
|
step_arguments: "Bağımsız değişkenler",
|
|
3791
3793
|
step_result: "Sonuç",
|
|
3792
|
-
attach_files: "Görsel, video, PDF veya elektronik tablo ekle (en fazla
|
|
3794
|
+
attach_files: "Görsel, video, PDF veya elektronik tablo ekle (en fazla 50 MB)",
|
|
3793
3795
|
mark_page_active: "İşaretlemek için sayfadaki bir öğeye tıklayın — iptal etmek için Esc'ye basın",
|
|
3794
3796
|
mark_page: "Hakkında soru sormak için sayfadaki bir öğeyi işaretleyin",
|
|
3795
3797
|
stop_response: "Yanıtı durdur",
|
|
@@ -3848,7 +3850,7 @@ const He = {
|
|
|
3848
3850
|
zoom_out: "Uzaklaştır",
|
|
3849
3851
|
reset_zoom: "Yakınlaştırmayı sıfırla",
|
|
3850
3852
|
support_chat_aria_label: "Destek sohbeti"
|
|
3851
|
-
},
|
|
3853
|
+
}, ha = {
|
|
3852
3854
|
write_a_message_placeholder: "پیغام لکھیں...",
|
|
3853
3855
|
your_issue_has_been_resolved: "آپ کا مسئلہ حل ہو گیا ہے!",
|
|
3854
3856
|
new_conversation: "نئی گفتگو",
|
|
@@ -3886,7 +3888,7 @@ const He = {
|
|
|
3886
3888
|
steps: "مراحل",
|
|
3887
3889
|
step_arguments: "آرگیومنٹس",
|
|
3888
3890
|
step_result: "نتیجہ",
|
|
3889
|
-
attach_files: "تصاویر، ویڈیوز، PDF یا اسپریڈشیٹس منسلک کریں (زیادہ سے زیادہ حجم
|
|
3891
|
+
attach_files: "تصاویر، ویڈیوز، PDF یا اسپریڈشیٹس منسلک کریں (زیادہ سے زیادہ حجم 50 MB)",
|
|
3890
3892
|
mark_page_active: "نشان لگانے کے لیے صفحے پر کسی چیز پر کلک کریں — منسوخ کرنے کے لیے Esc دبائیں",
|
|
3891
3893
|
mark_page: "صفحے پر کسی چیز کے بارے میں پوچھنے کے لیے اس پر نشان لگائیں",
|
|
3892
3894
|
stop_response: "جواب روکیں",
|
|
@@ -3945,7 +3947,7 @@ const He = {
|
|
|
3945
3947
|
zoom_out: "زوم آؤٹ",
|
|
3946
3948
|
reset_zoom: "زوم دوبارہ ترتیب دیں",
|
|
3947
3949
|
support_chat_aria_label: "سپورٹ چیٹ"
|
|
3948
|
-
},
|
|
3950
|
+
}, ga = {
|
|
3949
3951
|
write_a_message_placeholder: "Viết tin nhắn...",
|
|
3950
3952
|
your_issue_has_been_resolved: "Vấn đề của bạn đã được giải quyết!",
|
|
3951
3953
|
new_conversation: "Cuộc trò chuyện mới",
|
|
@@ -3983,7 +3985,7 @@ const He = {
|
|
|
3983
3985
|
steps: "bước",
|
|
3984
3986
|
step_arguments: "Đối số",
|
|
3985
3987
|
step_result: "Kết quả",
|
|
3986
|
-
attach_files: "Đính kèm hình ảnh, video, PDF hoặc bảng tính (kích thước tối đa
|
|
3988
|
+
attach_files: "Đính kèm hình ảnh, video, PDF hoặc bảng tính (kích thước tối đa 50 MB)",
|
|
3987
3989
|
mark_page_active: "Nhấp vào bất kỳ nội dung nào trên trang để đánh dấu — nhấn Esc để hủy",
|
|
3988
3990
|
mark_page: "Đánh dấu nội dung trên trang để hỏi về nội dung đó",
|
|
3989
3991
|
stop_response: "Dừng trả lời",
|
|
@@ -4042,7 +4044,7 @@ const He = {
|
|
|
4042
4044
|
zoom_out: "Thu nhỏ",
|
|
4043
4045
|
reset_zoom: "Đặt lại thu phóng",
|
|
4044
4046
|
support_chat_aria_label: "Trò chuyện hỗ trợ"
|
|
4045
|
-
},
|
|
4047
|
+
}, ka = {
|
|
4046
4048
|
write_a_message_placeholder: "写一条消息...",
|
|
4047
4049
|
your_issue_has_been_resolved: "您的问题已解决!",
|
|
4048
4050
|
new_conversation: "新对话",
|
|
@@ -4080,7 +4082,7 @@ const He = {
|
|
|
4080
4082
|
steps: "步骤",
|
|
4081
4083
|
step_arguments: "参数",
|
|
4082
4084
|
step_result: "结果",
|
|
4083
|
-
attach_files: "附加图片、视频、PDF 或电子表格(最大
|
|
4085
|
+
attach_files: "附加图片、视频、PDF 或电子表格(最大 50 MB)",
|
|
4084
4086
|
mark_page_active: "点击页面上的任意内容进行标记 — 按 Esc 取消",
|
|
4085
4087
|
mark_page: "标记页面上的内容以便就此提问",
|
|
4086
4088
|
stop_response: "停止回答",
|
|
@@ -4139,7 +4141,7 @@ const He = {
|
|
|
4139
4141
|
zoom_out: "缩小",
|
|
4140
4142
|
reset_zoom: "重置缩放",
|
|
4141
4143
|
support_chat_aria_label: "支持对话"
|
|
4142
|
-
},
|
|
4144
|
+
}, ba = {
|
|
4143
4145
|
write_a_message_placeholder: "Napišite poruku...",
|
|
4144
4146
|
your_issue_has_been_resolved: "Vaš problem je riješen!",
|
|
4145
4147
|
new_conversation: "Novi razgovor",
|
|
@@ -4177,7 +4179,7 @@ const He = {
|
|
|
4177
4179
|
steps: "koraci",
|
|
4178
4180
|
step_arguments: "Argumenti",
|
|
4179
4181
|
step_result: "Rezultat",
|
|
4180
|
-
attach_files: "Priložite slike, videozapise, PDF-ove ili proračunske tablice (najveća veličina
|
|
4182
|
+
attach_files: "Priložite slike, videozapise, PDF-ove ili proračunske tablice (najveća veličina 50 MB)",
|
|
4181
4183
|
mark_page_active: "Kliknite bilo što na stranici da biste to označili — Esc za odustajanje",
|
|
4182
4184
|
mark_page: "Označite nešto na stranici da biste pitali o tome",
|
|
4183
4185
|
stop_response: "Zaustavi odgovor",
|
|
@@ -4236,7 +4238,7 @@ const He = {
|
|
|
4236
4238
|
zoom_out: "Udalji",
|
|
4237
4239
|
reset_zoom: "Poništi zumiranje",
|
|
4238
4240
|
support_chat_aria_label: "Chat za podršku"
|
|
4239
|
-
},
|
|
4241
|
+
}, fa = {
|
|
4240
4242
|
write_a_message_placeholder: "Kirjuta sõnum...",
|
|
4241
4243
|
your_issue_has_been_resolved: "Teie probleem on lahendatud!",
|
|
4242
4244
|
new_conversation: "Uus vestlus",
|
|
@@ -4274,7 +4276,7 @@ const He = {
|
|
|
4274
4276
|
steps: "sammud",
|
|
4275
4277
|
step_arguments: "Argumendid",
|
|
4276
4278
|
step_result: "Tulemus",
|
|
4277
|
-
attach_files: "Lisa pilte, videoid, PDF-e või arvutustabeleid (maksimaalne suurus
|
|
4279
|
+
attach_files: "Lisa pilte, videoid, PDF-e või arvutustabeleid (maksimaalne suurus 50 MB)",
|
|
4278
4280
|
mark_page_active: "Märkimiseks klõpsa lehel ükskõik millel — tühistamiseks vajuta Esc",
|
|
4279
4281
|
mark_page: "Märgi lehel midagi, et selle kohta küsida",
|
|
4280
4282
|
stop_response: "Peata vastus",
|
|
@@ -4371,7 +4373,7 @@ const He = {
|
|
|
4371
4373
|
steps: "lépés",
|
|
4372
4374
|
step_arguments: "Argumentumok",
|
|
4373
4375
|
step_result: "Eredmény",
|
|
4374
|
-
attach_files: "Képek, videók, PDF-ek vagy táblázatok csatolása (legfeljebb
|
|
4376
|
+
attach_files: "Képek, videók, PDF-ek vagy táblázatok csatolása (legfeljebb 50 MB)",
|
|
4375
4377
|
mark_page_active: "Kattintson valamire az oldalon a megjelöléséhez — Esc a megszakításhoz",
|
|
4376
4378
|
mark_page: "Jelöljön meg valamit az oldalon, hogy kérdezhessen róla",
|
|
4377
4379
|
stop_response: "Válasz leállítása",
|
|
@@ -4430,7 +4432,7 @@ const He = {
|
|
|
4430
4432
|
zoom_out: "Kicsinyítés",
|
|
4431
4433
|
reset_zoom: "Nagyítás visszaállítása",
|
|
4432
4434
|
support_chat_aria_label: "Ügyfélszolgálati chat"
|
|
4433
|
-
},
|
|
4435
|
+
}, ya = {
|
|
4434
4436
|
write_a_message_placeholder: "Skrifaðu skilaboð...",
|
|
4435
4437
|
your_issue_has_been_resolved: "Málið þitt hefur verið leyst!",
|
|
4436
4438
|
new_conversation: "Nýtt samtal",
|
|
@@ -4468,7 +4470,7 @@ const He = {
|
|
|
4468
4470
|
steps: "skref",
|
|
4469
4471
|
step_arguments: "Viðföng",
|
|
4470
4472
|
step_result: "Niðurstaða",
|
|
4471
|
-
attach_files: "Hengja við myndir, myndskeið, PDF-skjöl eða töflureikna (hámarksstærð
|
|
4473
|
+
attach_files: "Hengja við myndir, myndskeið, PDF-skjöl eða töflureikna (hámarksstærð 50 MB)",
|
|
4472
4474
|
mark_page_active: "Smelltu á eitthvað á síðunni til að merkja það — Esc til að hætta við",
|
|
4473
4475
|
mark_page: "Merktu eitthvað á síðunni til að spyrja um það",
|
|
4474
4476
|
stop_response: "Stöðva svar",
|
|
@@ -4527,7 +4529,7 @@ const He = {
|
|
|
4527
4529
|
zoom_out: "Minnka aðdrátt",
|
|
4528
4530
|
reset_zoom: "Endurstilla aðdrátt",
|
|
4529
4531
|
support_chat_aria_label: "Þjónustuspjall"
|
|
4530
|
-
},
|
|
4532
|
+
}, wa = {
|
|
4531
4533
|
write_a_message_placeholder: "Rakstiet ziņojumu...",
|
|
4532
4534
|
your_issue_has_been_resolved: "Jūsu problēma ir atrisināta!",
|
|
4533
4535
|
new_conversation: "Jauna saruna",
|
|
@@ -4565,7 +4567,7 @@ const He = {
|
|
|
4565
4567
|
steps: "darbības",
|
|
4566
4568
|
step_arguments: "Argumenti",
|
|
4567
4569
|
step_result: "Rezultāts",
|
|
4568
|
-
attach_files: "Pievienot attēlus, video, PDF vai izklājlapas (maksimālais izmērs
|
|
4570
|
+
attach_files: "Pievienot attēlus, video, PDF vai izklājlapas (maksimālais izmērs 50 MB)",
|
|
4569
4571
|
mark_page_active: "Noklikšķiniet uz kaut kā lapā, lai to atzīmētu — Esc, lai atceltu",
|
|
4570
4572
|
mark_page: "Atzīmējiet kaut ko lapā, lai par to pajautātu",
|
|
4571
4573
|
stop_response: "Apturēt atbildi",
|
|
@@ -4624,7 +4626,7 @@ const He = {
|
|
|
4624
4626
|
zoom_out: "Attālināt",
|
|
4625
4627
|
reset_zoom: "Atiestatīt tālummaiņu",
|
|
4626
4628
|
support_chat_aria_label: "Atbalsta tērzēšana"
|
|
4627
|
-
},
|
|
4629
|
+
}, ja = {
|
|
4628
4630
|
write_a_message_placeholder: "Parašykite žinutę...",
|
|
4629
4631
|
your_issue_has_been_resolved: "Jūsų problema išspręsta!",
|
|
4630
4632
|
new_conversation: "Naujas pokalbis",
|
|
@@ -4662,7 +4664,7 @@ const He = {
|
|
|
4662
4664
|
steps: "žingsniai",
|
|
4663
4665
|
step_arguments: "Argumentai",
|
|
4664
4666
|
step_result: "Rezultatas",
|
|
4665
|
-
attach_files: "Pridėti vaizdus, vaizdo įrašus, PDF ar skaičiuokles (didžiausias dydis
|
|
4667
|
+
attach_files: "Pridėti vaizdus, vaizdo įrašus, PDF ar skaičiuokles (didžiausias dydis 50 MB)",
|
|
4666
4668
|
mark_page_active: "Spustelėkite ką nors puslapyje, kad pažymėtumėte — Esc atšaukti",
|
|
4667
4669
|
mark_page: "Pažymėkite ką nors puslapyje, kad galėtumėte apie tai paklausti",
|
|
4668
4670
|
stop_response: "Stabdyti atsakymą",
|
|
@@ -4721,7 +4723,7 @@ const He = {
|
|
|
4721
4723
|
zoom_out: "Nutolinti",
|
|
4722
4724
|
reset_zoom: "Atstatyti mastelį",
|
|
4723
4725
|
support_chat_aria_label: "Pagalbos pokalbis"
|
|
4724
|
-
},
|
|
4726
|
+
}, Sa = {
|
|
4725
4727
|
write_a_message_placeholder: "Schreift eng Noriicht...",
|
|
4726
4728
|
your_issue_has_been_resolved: "Äert Problem gouf geléist!",
|
|
4727
4729
|
new_conversation: "Nei Konversatioun",
|
|
@@ -4759,7 +4761,7 @@ const He = {
|
|
|
4759
4761
|
steps: "Schrëtt",
|
|
4760
4762
|
step_arguments: "Argumenter",
|
|
4761
4763
|
step_result: "Resultat",
|
|
4762
|
-
attach_files: "Biller, Videoen, PDFen oder Tabelle bäifügen (maximal Gréisst
|
|
4764
|
+
attach_files: "Biller, Videoen, PDFen oder Tabelle bäifügen (maximal Gréisst 50 MB)",
|
|
4763
4765
|
mark_page_active: "Klickt op eppes op der Säit, fir et ze markéieren — Esc fir ofzebriechen",
|
|
4764
4766
|
mark_page: "Markéiert eppes op der Säit, fir doriwwer ze froen",
|
|
4765
4767
|
stop_response: "Äntwert stoppen",
|
|
@@ -4818,7 +4820,7 @@ const He = {
|
|
|
4818
4820
|
zoom_out: "Erauszoomen",
|
|
4819
4821
|
reset_zoom: "Zoom zrécksetzen",
|
|
4820
4822
|
support_chat_aria_label: "Support-Chat"
|
|
4821
|
-
},
|
|
4823
|
+
}, za = {
|
|
4822
4824
|
write_a_message_placeholder: "Ikteb messaġġ...",
|
|
4823
4825
|
your_issue_has_been_resolved: "Il-problema tiegħek ġiet riżolta!",
|
|
4824
4826
|
new_conversation: "Konversazzjoni ġdida",
|
|
@@ -4856,7 +4858,7 @@ const He = {
|
|
|
4856
4858
|
steps: "passi",
|
|
4857
4859
|
step_arguments: "Argumenti",
|
|
4858
4860
|
step_result: "Riżultat",
|
|
4859
|
-
attach_files: "Ehmeż stampi, vidjows, PDFs jew spreadsheets (daqs massimu
|
|
4861
|
+
attach_files: "Ehmeż stampi, vidjows, PDFs jew spreadsheets (daqs massimu 50 MB)",
|
|
4860
4862
|
mark_page_active: "Ikklikkja xi ħaġa fil-paġna biex timmarkaha — Esc biex tikkanċella",
|
|
4861
4863
|
mark_page: "Immarka xi ħaġa fil-paġna biex tistaqsi dwarha",
|
|
4862
4864
|
stop_response: "Waqqaf it-tweġiba",
|
|
@@ -4915,7 +4917,7 @@ const He = {
|
|
|
4915
4917
|
zoom_out: "Ċekken",
|
|
4916
4918
|
reset_zoom: "Irrisettja ż-zoom",
|
|
4917
4919
|
support_chat_aria_label: "Chat ta’ appoġġ"
|
|
4918
|
-
},
|
|
4920
|
+
}, Ca = {
|
|
4919
4921
|
write_a_message_placeholder: "Skriv en melding...",
|
|
4920
4922
|
your_issue_has_been_resolved: "Saken din er løst!",
|
|
4921
4923
|
new_conversation: "Ny samtale",
|
|
@@ -4953,7 +4955,7 @@ const He = {
|
|
|
4953
4955
|
steps: "trinn",
|
|
4954
4956
|
step_arguments: "Argumenter",
|
|
4955
4957
|
step_result: "Resultat",
|
|
4956
|
-
attach_files: "Legg ved bilder, videoer, PDF-er eller regneark (maksimal størrelse
|
|
4958
|
+
attach_files: "Legg ved bilder, videoer, PDF-er eller regneark (maksimal størrelse 50 MB)",
|
|
4957
4959
|
mark_page_active: "Klikk på noe på siden for å markere det — Esc for å avbryte",
|
|
4958
4960
|
mark_page: "Marker noe på siden for å spørre om det",
|
|
4959
4961
|
stop_response: "Stopp svar",
|
|
@@ -5012,7 +5014,7 @@ const He = {
|
|
|
5012
5014
|
zoom_out: "Zoom ut",
|
|
5013
5015
|
reset_zoom: "Tilbakestill zoom",
|
|
5014
5016
|
support_chat_aria_label: "Support-chat"
|
|
5015
|
-
},
|
|
5017
|
+
}, xa = {
|
|
5016
5018
|
write_a_message_placeholder: "Napíšte správu...",
|
|
5017
5019
|
your_issue_has_been_resolved: "Váš problém bol vyriešený!",
|
|
5018
5020
|
new_conversation: "Nová konverzácia",
|
|
@@ -5050,7 +5052,7 @@ const He = {
|
|
|
5050
5052
|
steps: "kroky",
|
|
5051
5053
|
step_arguments: "Argumenty",
|
|
5052
5054
|
step_result: "Výsledok",
|
|
5053
|
-
attach_files: "Priložiť obrázky, videá, PDF súbory alebo tabuľky (maximálna veľkosť
|
|
5055
|
+
attach_files: "Priložiť obrázky, videá, PDF súbory alebo tabuľky (maximálna veľkosť 50 MB)",
|
|
5054
5056
|
mark_page_active: "Kliknutím na čokoľvek na stránke to označíte — klávesom Esc akciu zrušíte",
|
|
5055
5057
|
mark_page: "Označte niečo na stránke a opýtajte sa na to",
|
|
5056
5058
|
stop_response: "Zastaviť odpoveď",
|
|
@@ -5109,82 +5111,98 @@ const He = {
|
|
|
5109
5111
|
zoom_out: "Oddialiť",
|
|
5110
5112
|
reset_zoom: "Obnoviť priblíženie",
|
|
5111
5113
|
support_chat_aria_label: "Chat podpory"
|
|
5112
|
-
},
|
|
5113
|
-
ar:
|
|
5114
|
-
bn:
|
|
5115
|
-
bg:
|
|
5116
|
-
cs:
|
|
5117
|
-
da:
|
|
5118
|
-
de:
|
|
5119
|
-
el:
|
|
5120
|
-
en:
|
|
5121
|
-
es:
|
|
5122
|
-
et:
|
|
5123
|
-
fi:
|
|
5124
|
-
fil:
|
|
5125
|
-
fr:
|
|
5126
|
-
hi:
|
|
5127
|
-
hr:
|
|
5114
|
+
}, X = {
|
|
5115
|
+
ar: Ve,
|
|
5116
|
+
bn: Ge,
|
|
5117
|
+
bg: Ze,
|
|
5118
|
+
cs: We,
|
|
5119
|
+
da: $e,
|
|
5120
|
+
de: Ye,
|
|
5121
|
+
el: Je,
|
|
5122
|
+
en: Q,
|
|
5123
|
+
es: Qe,
|
|
5124
|
+
et: fa,
|
|
5125
|
+
fi: ea,
|
|
5126
|
+
fil: Xe,
|
|
5127
|
+
fr: aa,
|
|
5128
|
+
hi: ta,
|
|
5129
|
+
hr: ba,
|
|
5128
5130
|
hu: va,
|
|
5129
|
-
is:
|
|
5130
|
-
it:
|
|
5131
|
-
ja:
|
|
5132
|
-
ko:
|
|
5133
|
-
lb:
|
|
5134
|
-
lt:
|
|
5135
|
-
lv:
|
|
5136
|
-
mt:
|
|
5137
|
-
nb:
|
|
5138
|
-
nl:
|
|
5139
|
-
no:
|
|
5140
|
-
pl:
|
|
5141
|
-
pt:
|
|
5142
|
-
ro:
|
|
5143
|
-
ru:
|
|
5144
|
-
sk:
|
|
5145
|
-
sv:
|
|
5146
|
-
th:
|
|
5147
|
-
tr:
|
|
5148
|
-
ur:
|
|
5149
|
-
vi:
|
|
5150
|
-
"zh-cn":
|
|
5151
|
-
},
|
|
5152
|
-
function
|
|
5153
|
-
return
|
|
5131
|
+
is: ya,
|
|
5132
|
+
it: sa,
|
|
5133
|
+
ja: oa,
|
|
5134
|
+
ko: na,
|
|
5135
|
+
lb: Sa,
|
|
5136
|
+
lt: ja,
|
|
5137
|
+
lv: wa,
|
|
5138
|
+
mt: za,
|
|
5139
|
+
nb: Ca,
|
|
5140
|
+
nl: ia,
|
|
5141
|
+
no: ra,
|
|
5142
|
+
pl: _a,
|
|
5143
|
+
pt: la,
|
|
5144
|
+
ro: ca,
|
|
5145
|
+
ru: da,
|
|
5146
|
+
sk: xa,
|
|
5147
|
+
sv: pa,
|
|
5148
|
+
th: ua,
|
|
5149
|
+
tr: ma,
|
|
5150
|
+
ur: ha,
|
|
5151
|
+
vi: ga,
|
|
5152
|
+
"zh-cn": ka
|
|
5153
|
+
}, qa = Object.keys(X);
|
|
5154
|
+
function Aa(i) {
|
|
5155
|
+
return qa.includes(i);
|
|
5154
5156
|
}
|
|
5155
|
-
const
|
|
5156
|
-
function
|
|
5157
|
-
return
|
|
5157
|
+
const Ea = /* @__PURE__ */ new Set(["ar", "ur"]);
|
|
5158
|
+
function at(i) {
|
|
5159
|
+
return Ea.has(i);
|
|
5158
5160
|
}
|
|
5159
|
-
function
|
|
5160
|
-
return
|
|
5161
|
+
function Pa(i) {
|
|
5162
|
+
return Aa(i) ? i : "en";
|
|
5161
5163
|
}
|
|
5162
|
-
function
|
|
5164
|
+
function Ta(i, e, t, o) {
|
|
5163
5165
|
var _;
|
|
5164
|
-
const r = ((_ =
|
|
5166
|
+
const r = ((_ = t == null ? void 0 : t[e]) == null ? void 0 : _[i]) || X[e][i] || Q[i] || i;
|
|
5165
5167
|
return o ? r.replace(
|
|
5166
5168
|
/\{(\w+)\}/g,
|
|
5167
|
-
(
|
|
5169
|
+
(s, a) => a in o ? String(o[a]) : s
|
|
5168
5170
|
) : r;
|
|
5169
5171
|
}
|
|
5170
|
-
function
|
|
5171
|
-
return
|
|
5172
|
+
function Ia(i, e, t) {
|
|
5173
|
+
return Ta(
|
|
5172
5174
|
e,
|
|
5173
|
-
|
|
5175
|
+
Pa(i.language),
|
|
5174
5176
|
i.translationOverrides,
|
|
5175
|
-
|
|
5177
|
+
t
|
|
5176
5178
|
);
|
|
5177
5179
|
}
|
|
5178
|
-
|
|
5180
|
+
function I(i) {
|
|
5181
|
+
return i.type === "AGENT" || i.type === "AI";
|
|
5182
|
+
}
|
|
5183
|
+
function Ma(i, e) {
|
|
5184
|
+
var o;
|
|
5185
|
+
if ((e == null ? void 0 : e.isOpened) === !1) return null;
|
|
5186
|
+
const t = i.findLast(
|
|
5187
|
+
(r) => I(r) && !!r.messageOptions
|
|
5188
|
+
);
|
|
5189
|
+
return ((o = t == null ? void 0 : t.messageOptions) == null ? void 0 : o.pickedOptionId) === null ? t : null;
|
|
5190
|
+
}
|
|
5191
|
+
function tt(i, e) {
|
|
5192
|
+
var o, r;
|
|
5193
|
+
const t = Ma(i, e);
|
|
5194
|
+
return ((o = t == null ? void 0 : t.messageOptions) == null ? void 0 : o.requireTap) !== !0 ? !1 : ((r = i.findLast(I)) == null ? void 0 : r.id) === t.id;
|
|
5195
|
+
}
|
|
5196
|
+
class Da {
|
|
5179
5197
|
constructor({
|
|
5180
5198
|
config: e,
|
|
5181
|
-
api:
|
|
5199
|
+
api: t,
|
|
5182
5200
|
contactCtx: o,
|
|
5183
5201
|
storageCtx: r,
|
|
5184
5202
|
sessionsPollingIntervalSeconds: _,
|
|
5185
|
-
sharedSessions:
|
|
5203
|
+
sharedSessions: s
|
|
5186
5204
|
}) {
|
|
5187
|
-
this.sessionsRefresher = new
|
|
5205
|
+
this.sessionsRefresher = new J(), this.persistedSessionId = null, this.sessionAbortController = new AbortController(), this.sessionState = new z({
|
|
5188
5206
|
session: null,
|
|
5189
5207
|
isCreatingSession: !1,
|
|
5190
5208
|
isResolvingSession: !1
|
|
@@ -5252,7 +5270,7 @@ class Ia {
|
|
|
5252
5270
|
Object.entries(this.config.sessionCustomData || {}).map(
|
|
5253
5271
|
([a, n]) => {
|
|
5254
5272
|
var c;
|
|
5255
|
-
return typeof n == "string" ? [a, n] : typeof n == "boolean" ? [a, n] : typeof n == "number" ? [a, n] : [a, ((c =
|
|
5273
|
+
return typeof n == "string" ? [a, n] : typeof n == "boolean" ? [a, n] : typeof n == "number" ? [a, n] : [a, ((c = Y(() => JSON.stringify(n))) == null ? void 0 : c.data) || ""];
|
|
5256
5274
|
}
|
|
5257
5275
|
)
|
|
5258
5276
|
), this.createSession = async () => {
|
|
@@ -5293,8 +5311,8 @@ class Ia {
|
|
|
5293
5311
|
this.sessionState.setPartial({ session: d }), this.setSessions([d]);
|
|
5294
5312
|
try {
|
|
5295
5313
|
(g = (m = this.config.hooks) == null ? void 0 : m.onSessionCreated) == null || g.call(m, { session: d });
|
|
5296
|
-
} catch (
|
|
5297
|
-
b.error("onSessionCreated hook failed",
|
|
5314
|
+
} catch (f) {
|
|
5315
|
+
b.error("onSessionCreated hook failed", f);
|
|
5298
5316
|
}
|
|
5299
5317
|
return { session: d, status: p.status, error: void 0 };
|
|
5300
5318
|
}, this.loadMoreSessions = async () => {
|
|
@@ -5352,14 +5370,14 @@ class Ia {
|
|
|
5352
5370
|
payload: a
|
|
5353
5371
|
});
|
|
5354
5372
|
return c != null && c.success ? { success: !0 } : { success: !1 };
|
|
5355
|
-
}, this.config = e, this.api =
|
|
5373
|
+
}, this.config = e, this.api = t, this.contactCtx = o, this.storageCtx = r, this.sessionsPollingIntervalSeconds = _, s ? this.sessionsState = s : this.registerSessionsRefresherWrapper(), this.registerActiveSessionPersistence();
|
|
5356
5374
|
}
|
|
5357
5375
|
}
|
|
5358
|
-
const
|
|
5359
|
-
const o =
|
|
5376
|
+
const Ra = (i, e, { sendsPageContext: t }) => {
|
|
5377
|
+
const o = La(i), r = t && e.mentions && e.mentions.length > 0 ? { mentions: e.mentions.map(Na) } : void 0, _ = t && (e.clientContext || r) ? { ...o, ...e.clientContext, ...r } : o, s = e.connectionRequestId ? {
|
|
5360
5378
|
..._,
|
|
5361
5379
|
opencx__connection_request_id: e.connectionRequestId
|
|
5362
|
-
} : _, a = e.withPageEntity === !1 &&
|
|
5380
|
+
} : _, a = e.withPageEntity === !1 && s && "entity" in s ? Ka(s, "entity") : s;
|
|
5363
5381
|
return {
|
|
5364
5382
|
clientContext: e.background ? { ...a, opencx__background: !0 } : a,
|
|
5365
5383
|
custom_data: {
|
|
@@ -5367,15 +5385,15 @@ const Ma = (i, e, { sendsPageContext: s }) => {
|
|
|
5367
5385
|
...e.customData || {}
|
|
5368
5386
|
}
|
|
5369
5387
|
};
|
|
5370
|
-
},
|
|
5388
|
+
}, Na = ({ type: i, id: e, title: t, meta: o }) => ({
|
|
5371
5389
|
type: i,
|
|
5372
5390
|
id: e,
|
|
5373
|
-
title:
|
|
5391
|
+
title: t,
|
|
5374
5392
|
...o ? { meta: o } : {}
|
|
5375
|
-
}),
|
|
5376
|
-
const { [e]:
|
|
5393
|
+
}), Ka = (i, e) => {
|
|
5394
|
+
const { [e]: t, ...o } = i;
|
|
5377
5395
|
return Object.keys(o).length > 0 ? o : void 0;
|
|
5378
|
-
},
|
|
5396
|
+
}, La = (i) => {
|
|
5379
5397
|
if (typeof i.context != "function") return i.context;
|
|
5380
5398
|
try {
|
|
5381
5399
|
return i.context();
|
|
@@ -5383,25 +5401,25 @@ const Ma = (i, e, { sendsPageContext: s }) => {
|
|
|
5383
5401
|
b.error("context getter threw; sending without context", e);
|
|
5384
5402
|
return;
|
|
5385
5403
|
}
|
|
5386
|
-
},
|
|
5387
|
-
const e = i.features,
|
|
5404
|
+
}, Oa = (i) => {
|
|
5405
|
+
const e = i.features, t = {
|
|
5388
5406
|
page_context: (e == null ? void 0 : e.pageContext) === !0,
|
|
5389
5407
|
client_tools: (e == null ? void 0 : e.pageContext) === !0 && (e == null ? void 0 : e.clientTools) === !0,
|
|
5390
5408
|
page_actions: (e == null ? void 0 : e.pageContext) === !0 && (e == null ? void 0 : e.clientTools) === !0 && (e == null ? void 0 : e.pageActions) === !0
|
|
5391
5409
|
};
|
|
5392
|
-
return e && (e.preamble !== void 0 && (
|
|
5393
|
-
},
|
|
5410
|
+
return e && (e.preamble !== void 0 && (t.preamble = e.preamble), e.inlineUi !== void 0 && (t.inline_ui = e.inlineUi)), t;
|
|
5411
|
+
}, Fa = ({
|
|
5394
5412
|
config: i,
|
|
5395
5413
|
input: e,
|
|
5396
|
-
uuid:
|
|
5414
|
+
uuid: t,
|
|
5397
5415
|
sessionId: o,
|
|
5398
5416
|
content: r,
|
|
5399
5417
|
initialMessages: _,
|
|
5400
|
-
sendsPageContext:
|
|
5418
|
+
sendsPageContext: s
|
|
5401
5419
|
}) => {
|
|
5402
5420
|
var a, n, c, d;
|
|
5403
5421
|
return {
|
|
5404
|
-
uuid:
|
|
5422
|
+
uuid: t,
|
|
5405
5423
|
bot_token: i.token,
|
|
5406
5424
|
headers: i.headers,
|
|
5407
5425
|
query_params: i.queryParams,
|
|
@@ -5409,9 +5427,9 @@ const Ma = (i, e, { sendsPageContext: s }) => {
|
|
|
5409
5427
|
session_id: o,
|
|
5410
5428
|
content: r,
|
|
5411
5429
|
attachments: e.attachments,
|
|
5412
|
-
...
|
|
5430
|
+
...Ra(i, e, { sendsPageContext: s }),
|
|
5413
5431
|
language: i.language,
|
|
5414
|
-
features:
|
|
5432
|
+
features: Oa(i),
|
|
5415
5433
|
presentation: i.presentation,
|
|
5416
5434
|
capabilities: {
|
|
5417
5435
|
connections: ((a = i.capabilities) == null ? void 0 : a.connections) === !0,
|
|
@@ -5429,11 +5447,11 @@ const Ma = (i, e, { sendsPageContext: s }) => {
|
|
|
5429
5447
|
}, x = class x {
|
|
5430
5448
|
constructor({
|
|
5431
5449
|
config: e,
|
|
5432
|
-
api:
|
|
5450
|
+
api: t,
|
|
5433
5451
|
sessionCtx: o,
|
|
5434
5452
|
contactCtx: r,
|
|
5435
5453
|
streaming: _,
|
|
5436
|
-
sendsPageContext:
|
|
5454
|
+
sendsPageContext: s,
|
|
5437
5455
|
getClientCapabilities: a,
|
|
5438
5456
|
getRequestConfig: n,
|
|
5439
5457
|
isStreaming: c,
|
|
@@ -5512,25 +5530,25 @@ const Ma = (i, e, { sendsPageContext: s }) => {
|
|
|
5512
5530
|
}, this.stageUserTurn = async (l, { pending: p }) => {
|
|
5513
5531
|
const u = this.captureConversation(), m = this.buildUserMessage(l);
|
|
5514
5532
|
if (!m) return null;
|
|
5515
|
-
const g = p ? { ...m, pending: !0 } : m,
|
|
5516
|
-
...
|
|
5533
|
+
const g = p ? { ...m, pending: !0 } : m, f = this.buildPersistentInitialMessages(), y = [
|
|
5534
|
+
...f.map((w) => w.id),
|
|
5517
5535
|
g.id
|
|
5518
5536
|
];
|
|
5519
5537
|
this.state.setPartial({
|
|
5520
5538
|
messages: [
|
|
5521
|
-
...
|
|
5539
|
+
...f,
|
|
5522
5540
|
...this.state.get().messages,
|
|
5523
5541
|
...g.background ? [] : [g]
|
|
5524
5542
|
]
|
|
5525
5543
|
});
|
|
5526
|
-
let
|
|
5544
|
+
let v;
|
|
5527
5545
|
try {
|
|
5528
|
-
|
|
5546
|
+
v = await this.ensureSessionId();
|
|
5529
5547
|
} catch (w) {
|
|
5530
5548
|
if (!u()) return null;
|
|
5531
5549
|
throw this.rollbackOptimisticMessages(y), w;
|
|
5532
5550
|
}
|
|
5533
|
-
return u() ?
|
|
5551
|
+
return u() ? v ? { sessionId: v, userMessage: g, initialMessages: f } : (this.rollbackOptimisticMessages(y), null) : null;
|
|
5534
5552
|
}, this.buildQueuedUserMessage = (l) => {
|
|
5535
5553
|
var m;
|
|
5536
5554
|
const p = this.buildUserMessage(l);
|
|
@@ -5554,7 +5572,7 @@ const Ma = (i, e, { sendsPageContext: s }) => {
|
|
|
5554
5572
|
p.some((u) => u.id === l.id) || this.state.setPartial({ messages: [...p, l] });
|
|
5555
5573
|
}, this.markUserMessageDelivered = (l) => {
|
|
5556
5574
|
const p = this.state.get().messages, u = p.findIndex(
|
|
5557
|
-
(
|
|
5575
|
+
(f) => f.id === l && f.type === "USER" && f.pending
|
|
5558
5576
|
);
|
|
5559
5577
|
if (u === -1) return;
|
|
5560
5578
|
const m = p[u];
|
|
@@ -5565,19 +5583,19 @@ const Ma = (i, e, { sendsPageContext: s }) => {
|
|
|
5565
5583
|
});
|
|
5566
5584
|
}, this.setMessageOptionPick = (l, p) => {
|
|
5567
5585
|
const u = this.state.get().messages, m = u.findIndex((y) => y.id === l), g = u[m];
|
|
5568
|
-
if (!g || g
|
|
5569
|
-
const
|
|
5570
|
-
|
|
5586
|
+
if (!g || !I(g) || !g.messageOptions || g.messageOptions.pickedOptionId === p) return;
|
|
5587
|
+
const f = [...u];
|
|
5588
|
+
f[m] = {
|
|
5571
5589
|
...g,
|
|
5572
5590
|
messageOptions: { ...g.messageOptions, pickedOptionId: p }
|
|
5573
|
-
}, this.state.setPartial({ messages:
|
|
5574
|
-
}, this.
|
|
5591
|
+
}, this.state.setPartial({ messages: f });
|
|
5592
|
+
}, this.releaseUnsentOptionPick = (l) => {
|
|
5575
5593
|
var g;
|
|
5576
5594
|
if (!l.optionReply) return;
|
|
5577
|
-
const { messageId: p, optionId: u } = l.optionReply, m = this.state.get().messages.find((
|
|
5578
|
-
|
|
5595
|
+
const { messageId: p, optionId: u } = l.optionReply, m = this.state.get().messages.find((f) => f.id === p);
|
|
5596
|
+
!m || !I(m) || ((g = m.messageOptions) == null ? void 0 : g.pickedOptionId) !== u || this.setMessageOptionPick(p, null);
|
|
5579
5597
|
}, this.sendMessage = async (l) => {
|
|
5580
|
-
var u, m, g,
|
|
5598
|
+
var u, m, g, f, y;
|
|
5581
5599
|
if (this.streaming) {
|
|
5582
5600
|
if (!this.agentHandlers) {
|
|
5583
5601
|
this.bufferedAgentSends.push(l);
|
|
@@ -5588,8 +5606,8 @@ const Ma = (i, e, { sendsPageContext: s }) => {
|
|
|
5588
5606
|
}
|
|
5589
5607
|
let p;
|
|
5590
5608
|
try {
|
|
5591
|
-
const
|
|
5592
|
-
if (this.blocksSendWhileAwaitingReply && (
|
|
5609
|
+
const v = this.sessionCtx.sessionState.get().session, k = (v == null ? void 0 : v.assignee.kind) === "ai", D = this.state.get().isSendingMessageToAI, E = this.state.get().messages.at(-1);
|
|
5610
|
+
if (this.blocksSendWhileAwaitingReply && (D || // If last message is from user, then bot response did not arrive yet
|
|
5593
5611
|
k && (E == null ? void 0 : E.type) === "USER" && E.id !== this.state.get().settledAgentUserMessageId)) {
|
|
5594
5612
|
b.warn("cannot send messages while awaiting AI response");
|
|
5595
5613
|
return;
|
|
@@ -5597,23 +5615,23 @@ const Ma = (i, e, { sendsPageContext: s }) => {
|
|
|
5597
5615
|
this.sendMessageAbortController.abort("Superseded by a newer message"), this.sendMessageAbortController = new AbortController(), p = this.sendMessageAbortController, this.state.setPartial({
|
|
5598
5616
|
lastAIResMightSolveUserIssue: !1,
|
|
5599
5617
|
isSendingMessage: !0,
|
|
5600
|
-
isSendingMessageToAI: !!k || !
|
|
5618
|
+
isSendingMessageToAI: !!k || !v
|
|
5601
5619
|
});
|
|
5602
|
-
const
|
|
5603
|
-
if (!
|
|
5604
|
-
const { sessionId:
|
|
5620
|
+
const L = await this.stageUserTurn(l, { pending: !1 });
|
|
5621
|
+
if (!L) return;
|
|
5622
|
+
const { sessionId: ae, userMessage: O, initialMessages: te } = L;
|
|
5605
5623
|
this.notifySendAccepted(l);
|
|
5606
5624
|
const { data: j } = await this.api.sendMessage(
|
|
5607
|
-
|
|
5625
|
+
Fa({
|
|
5608
5626
|
config: {
|
|
5609
5627
|
...this.getRequestConfig(),
|
|
5610
5628
|
capabilities: this.getClientCapabilities()
|
|
5611
5629
|
},
|
|
5612
5630
|
input: l,
|
|
5613
|
-
uuid:
|
|
5614
|
-
sessionId:
|
|
5615
|
-
content:
|
|
5616
|
-
initialMessages:
|
|
5631
|
+
uuid: O.id,
|
|
5632
|
+
sessionId: ae,
|
|
5633
|
+
content: O.content,
|
|
5634
|
+
initialMessages: te,
|
|
5617
5635
|
sendsPageContext: this.sendsPageContext
|
|
5618
5636
|
}),
|
|
5619
5637
|
p.signal
|
|
@@ -5623,7 +5641,7 @@ const Ma = (i, e, { sendsPageContext: s }) => {
|
|
|
5623
5641
|
if (C) {
|
|
5624
5642
|
const P = this.state.get().messages;
|
|
5625
5643
|
if (!!P.some(
|
|
5626
|
-
(
|
|
5644
|
+
(se) => se.id === C.id
|
|
5627
5645
|
)) {
|
|
5628
5646
|
this.state.setPartial({
|
|
5629
5647
|
lastAIResMightSolveUserIssue: ((u = j.autopilotResponse) == null ? void 0 : u.mightSolveUserIssue) || ((m = j.uiResponse) == null ? void 0 : m.mightSolveUserIssue)
|
|
@@ -5632,21 +5650,21 @@ const Ma = (i, e, { sendsPageContext: s }) => {
|
|
|
5632
5650
|
}
|
|
5633
5651
|
this.state.setPartial({
|
|
5634
5652
|
messages: [...P, C],
|
|
5635
|
-
lastAIResMightSolveUserIssue: ((g = j.autopilotResponse) == null ? void 0 : g.mightSolveUserIssue) || ((
|
|
5653
|
+
lastAIResMightSolveUserIssue: ((g = j.autopilotResponse) == null ? void 0 : g.mightSolveUserIssue) || ((f = j.uiResponse) == null ? void 0 : f.mightSolveUserIssue)
|
|
5636
5654
|
}), this.dispatchToOnMessageReceivedHook(C);
|
|
5637
5655
|
}
|
|
5638
5656
|
j.session && this.sessionCtx.sessionState.setPartial({ session: j.session });
|
|
5639
5657
|
} else {
|
|
5640
|
-
this.
|
|
5658
|
+
this.releaseUnsentOptionPick(l);
|
|
5641
5659
|
const C = this.toBotErrorMessage(
|
|
5642
|
-
((y = j == null ? void 0 : j.error) == null ? void 0 : y.message) ||
|
|
5660
|
+
((y = j == null ? void 0 : j.error) == null ? void 0 : y.message) || Ia(this.config, "turn_failed_message")
|
|
5643
5661
|
), P = this.state.get().messages;
|
|
5644
5662
|
this.state.setPartial({
|
|
5645
5663
|
messages: [...P, C]
|
|
5646
5664
|
});
|
|
5647
5665
|
}
|
|
5648
|
-
} catch (
|
|
5649
|
-
p != null && p.signal.aborted || (this.
|
|
5666
|
+
} catch (v) {
|
|
5667
|
+
p != null && p.signal.aborted || (this.releaseUnsentOptionPick(l), b.error("failed to send message", v));
|
|
5650
5668
|
} finally {
|
|
5651
5669
|
p != null && p.signal.aborted || this.state.setPartial({
|
|
5652
5670
|
isSendingMessage: !1,
|
|
@@ -5660,16 +5678,16 @@ const Ma = (i, e, { sendsPageContext: s }) => {
|
|
|
5660
5678
|
`)}
|
|
5661
5679
|
|
|
5662
5680
|
${l}` : l;
|
|
5663
|
-
})(),
|
|
5681
|
+
})(), f = (/* @__PURE__ */ new Date()).toISOString();
|
|
5664
5682
|
return {
|
|
5665
5683
|
id: q(),
|
|
5666
5684
|
type: "USER",
|
|
5667
|
-
deliveredAt:
|
|
5685
|
+
deliveredAt: f,
|
|
5668
5686
|
content: g,
|
|
5669
5687
|
attachments: p,
|
|
5670
5688
|
markedElements: u,
|
|
5671
5689
|
mentions: m,
|
|
5672
|
-
timestamp:
|
|
5690
|
+
timestamp: f
|
|
5673
5691
|
};
|
|
5674
5692
|
}, this.toBotMessage = (l) => {
|
|
5675
5693
|
var p;
|
|
@@ -5704,7 +5722,7 @@ ${l}` : l;
|
|
|
5704
5722
|
variant: "error",
|
|
5705
5723
|
action: void 0
|
|
5706
5724
|
}
|
|
5707
|
-
}), this.config = e, this.getClientCapabilities = a ?? (() => this.getRequestConfig().capabilities), this.api =
|
|
5725
|
+
}), this.config = e, this.getClientCapabilities = a ?? (() => this.getRequestConfig().capabilities), this.api = t, this.sessionCtx = o, this.contactCtx = r, this.isStreaming = c ?? (() => _), this.getRequestConfig = n ?? (() => this.config), this.getSendsPageContext = d ?? (() => s);
|
|
5708
5726
|
}
|
|
5709
5727
|
/**
|
|
5710
5728
|
* Current transport choice. The org or this embed may request polling
|
|
@@ -5717,9 +5735,9 @@ ${l}` : l;
|
|
|
5717
5735
|
return this.getSendsPageContext();
|
|
5718
5736
|
}
|
|
5719
5737
|
/** Hand a send to the streaming engine; its failure can never propagate. */
|
|
5720
|
-
static dispatchToEngine(e,
|
|
5738
|
+
static dispatchToEngine(e, t) {
|
|
5721
5739
|
try {
|
|
5722
|
-
Promise.resolve(e.send(
|
|
5740
|
+
Promise.resolve(e.send(t)).catch((o) => {
|
|
5723
5741
|
b.error("streaming send failed", o);
|
|
5724
5742
|
});
|
|
5725
5743
|
} catch (o) {
|
|
@@ -5727,8 +5745,8 @@ ${l}` : l;
|
|
|
5727
5745
|
}
|
|
5728
5746
|
}
|
|
5729
5747
|
get hasPendingAgentWork() {
|
|
5730
|
-
var e,
|
|
5731
|
-
return this.bufferedAgentSends.length > 0 || (((
|
|
5748
|
+
var e, t;
|
|
5749
|
+
return this.bufferedAgentSends.length > 0 || (((t = (e = this.agentHandlers) == null ? void 0 : e.hasPendingWork) == null ? void 0 : t.call(e)) ?? !1);
|
|
5732
5750
|
}
|
|
5733
5751
|
/**
|
|
5734
5752
|
* Defensive read of `clientContext.page_marks` → the user bubble's context
|
|
@@ -5738,11 +5756,11 @@ ${l}` : l;
|
|
|
5738
5756
|
* without a usable name are dropped.
|
|
5739
5757
|
*/
|
|
5740
5758
|
static markedElementNames(e) {
|
|
5741
|
-
const
|
|
5742
|
-
if (!Array.isArray(
|
|
5743
|
-
const o =
|
|
5759
|
+
const t = e == null ? void 0 : e.page_marks;
|
|
5760
|
+
if (!Array.isArray(t)) return;
|
|
5761
|
+
const o = t.flatMap((r) => {
|
|
5744
5762
|
if (typeof r != "object" || r === null) return [];
|
|
5745
|
-
const _ = r.elements,
|
|
5763
|
+
const _ = r.elements, s = Array.isArray(_) ? _[0] : void 0, a = typeof s == "object" && s !== null && "name" in s ? s.name : void 0;
|
|
5746
5764
|
if (typeof a != "string" || a.length === 0) return [];
|
|
5747
5765
|
const n = r.note, c = r.snapshotUrl;
|
|
5748
5766
|
return [
|
|
@@ -5765,10 +5783,10 @@ ${l}` : l;
|
|
|
5765
5783
|
}
|
|
5766
5784
|
};
|
|
5767
5785
|
x.SENT_TEXT_HISTORY_MAX = 50;
|
|
5768
|
-
let
|
|
5769
|
-
class
|
|
5786
|
+
let N = x;
|
|
5787
|
+
class Ua {
|
|
5770
5788
|
constructor(e) {
|
|
5771
|
-
var
|
|
5789
|
+
var t, o;
|
|
5772
5790
|
this.widget = e, this.subscriptions = [], this.disposed = !1, this.restorableSessionId = null, this.didReadStoredSession = !1, this.readStoredSession = () => {
|
|
5773
5791
|
if (!this.shouldRestoreLastSession) {
|
|
5774
5792
|
this.didReadStoredSession = !0;
|
|
@@ -5794,9 +5812,9 @@ class Oa {
|
|
|
5794
5812
|
isInitialFetchLoading: r,
|
|
5795
5813
|
data: _
|
|
5796
5814
|
}) => {
|
|
5797
|
-
var
|
|
5815
|
+
var s, a, n, c, d;
|
|
5798
5816
|
if (!(this.disposed || !this.didReadStoredSession)) {
|
|
5799
|
-
if (this.restorableSessionId && !((
|
|
5817
|
+
if (this.restorableSessionId && !((s = this.sessionCtx.sessionState.get().session) != null && s.id)) {
|
|
5800
5818
|
const l = _.find(
|
|
5801
5819
|
(p) => p.id === this.restorableSessionId && p.isOpened
|
|
5802
5820
|
);
|
|
@@ -5820,7 +5838,7 @@ class Oa {
|
|
|
5820
5838
|
}, this.toSessionsScreen = () => {
|
|
5821
5839
|
this.navigateConversation || this.resetChat(), this.state.setPartial({ screen: "sessions" });
|
|
5822
5840
|
}, this.toChatScreen = (r) => {
|
|
5823
|
-
var
|
|
5841
|
+
var s, a;
|
|
5824
5842
|
if (this.navigateConversation) return this.navigateConversation(r);
|
|
5825
5843
|
this.resetChat();
|
|
5826
5844
|
let _;
|
|
@@ -5828,16 +5846,16 @@ class Oa {
|
|
|
5828
5846
|
if (_ = this.sessionCtx.sessionsState.get().data.find((n) => n.id === r), !_) return;
|
|
5829
5847
|
this.sessionCtx.sessionState.setPartial({ session: _ });
|
|
5830
5848
|
}
|
|
5831
|
-
return this.state.setPartial({ screen: "chat" }), (a = (
|
|
5849
|
+
return this.state.setPartial({ screen: "chat" }), (a = (s = this.config.hooks) == null ? void 0 : s.onNavigateToChat) == null || a.call(s, { session: _ }), this.widget;
|
|
5832
5850
|
}, this.config = e.config, this.contactCtx = e.contactCtx, this.sessionCtx = e.sessionCtx, this.resetChat = e.resetChat, this.state = new z({
|
|
5833
|
-
screen: this.contactCtx.shouldCollectData() ? "welcome" : (
|
|
5851
|
+
screen: this.contactCtx.shouldCollectData() ? "welcome" : (t = this.config.router) != null && t.chatScreenOnly ? "chat" : "sessions"
|
|
5834
5852
|
}), this.shouldRestoreLastSession = ((o = this.config.router) == null ? void 0 : o.restoreLastSession) ?? !1, this.readStoredSession(), this.registerRoutingListener();
|
|
5835
5853
|
}
|
|
5836
5854
|
}
|
|
5837
|
-
class
|
|
5855
|
+
class Ba {
|
|
5838
5856
|
constructor({
|
|
5839
5857
|
storage: e,
|
|
5840
|
-
config:
|
|
5858
|
+
config: t
|
|
5841
5859
|
}) {
|
|
5842
5860
|
this.KEYS = {
|
|
5843
5861
|
contactToken: (o) => `opencx-widget:org-token-${o}:contact-token`,
|
|
@@ -5878,10 +5896,10 @@ class Fa {
|
|
|
5878
5896
|
return o === "docked" || o === "floating" ? o : null;
|
|
5879
5897
|
}, this.setCompanionSidebarMode = async (o) => {
|
|
5880
5898
|
await this.storage.set(this.companionKey("sidebar-mode"), o);
|
|
5881
|
-
}, this.storage = e, this.config =
|
|
5899
|
+
}, this.storage = e, this.config = t;
|
|
5882
5900
|
}
|
|
5883
5901
|
}
|
|
5884
|
-
function
|
|
5902
|
+
function Ha({
|
|
5885
5903
|
org: i,
|
|
5886
5904
|
agent: e
|
|
5887
5905
|
}) {
|
|
@@ -5910,35 +5928,35 @@ function Ua({
|
|
|
5910
5928
|
}
|
|
5911
5929
|
};
|
|
5912
5930
|
}
|
|
5913
|
-
function
|
|
5931
|
+
function W(i, e) {
|
|
5914
5932
|
return i && e !== !1;
|
|
5915
5933
|
}
|
|
5916
|
-
function
|
|
5917
|
-
const
|
|
5934
|
+
function Va(i, e) {
|
|
5935
|
+
const t = e.features;
|
|
5918
5936
|
return {
|
|
5919
|
-
dictation:
|
|
5920
|
-
attachments:
|
|
5937
|
+
dictation: W(i.features.dictation, t == null ? void 0 : t.dictation),
|
|
5938
|
+
attachments: W(
|
|
5921
5939
|
i.features.attachments,
|
|
5922
|
-
|
|
5940
|
+
t == null ? void 0 : t.attachments
|
|
5923
5941
|
),
|
|
5924
|
-
pageContext: i.features.pageContext && (
|
|
5925
|
-
clientTools: i.features.clientTools && i.features.pageContext && (
|
|
5926
|
-
pageActions: i.features.pageActions && i.features.clientTools && i.features.pageContext && (
|
|
5942
|
+
pageContext: i.features.pageContext && (t == null ? void 0 : t.pageContext) === !0,
|
|
5943
|
+
clientTools: i.features.clientTools && i.features.pageContext && (t == null ? void 0 : t.pageContext) === !0 && (t == null ? void 0 : t.clientTools) === !0,
|
|
5944
|
+
pageActions: i.features.pageActions && i.features.clientTools && i.features.pageContext && (t == null ? void 0 : t.pageContext) === !0 && (t == null ? void 0 : t.clientTools) === !0 && (t == null ? void 0 : t.pageActions) === !0
|
|
5927
5945
|
};
|
|
5928
5946
|
}
|
|
5929
|
-
class
|
|
5930
|
-
constructor(e,
|
|
5931
|
-
super(
|
|
5947
|
+
class Ga extends Error {
|
|
5948
|
+
constructor(e, t, o) {
|
|
5949
|
+
super(t), this.name = "WidgetInitializationError", this.code = e, this.details = o;
|
|
5932
5950
|
}
|
|
5933
5951
|
}
|
|
5934
5952
|
const S = class S {
|
|
5935
5953
|
constructor({
|
|
5936
5954
|
config: e,
|
|
5937
|
-
storage:
|
|
5955
|
+
storage: t,
|
|
5938
5956
|
getClientCapabilities: o,
|
|
5939
5957
|
getRequestConfig: r,
|
|
5940
5958
|
modes: _,
|
|
5941
|
-
org:
|
|
5959
|
+
org: s,
|
|
5942
5960
|
agent: a,
|
|
5943
5961
|
parent: n
|
|
5944
5962
|
}) {
|
|
@@ -5974,11 +5992,11 @@ const S = class S {
|
|
|
5974
5992
|
throw Error(
|
|
5975
5993
|
"Widget polling values are not defined, did you call WidgetCtx.initialize()"
|
|
5976
5994
|
);
|
|
5977
|
-
this.config = e, this.getRequestConfig = r ?? (() => this.config), this.getClientCapabilities = o, this.org =
|
|
5995
|
+
this.config = e, this.getRequestConfig = r ?? (() => this.config), this.getClientCapabilities = o, this.org = s, this.agent = a, this.api = (n == null ? void 0 : n.api) ?? new H({ config: e }), this.storageCtx = (n == null ? void 0 : n.storageCtx) ?? (t ? new Ba({ storage: t, config: e }) : void 0), this.modes = _, this.contactCtx = (n == null ? void 0 : n.contactCtx) ?? new ve({
|
|
5978
5996
|
api: this.api,
|
|
5979
5997
|
config: this.config,
|
|
5980
5998
|
storageCtx: this.storageCtx
|
|
5981
|
-
}), this.sessionCtx = new
|
|
5999
|
+
}), this.sessionCtx = new Da({
|
|
5982
6000
|
config: this.config,
|
|
5983
6001
|
api: this.api,
|
|
5984
6002
|
contactCtx: this.contactCtx,
|
|
@@ -5986,12 +6004,12 @@ const S = class S {
|
|
|
5986
6004
|
storageCtx: n ? void 0 : this.storageCtx,
|
|
5987
6005
|
sharedSessions: n == null ? void 0 : n.sessionCtx.sessionsState,
|
|
5988
6006
|
sessionsPollingIntervalSeconds: S.pollingIntervalsSeconds.sessions
|
|
5989
|
-
}), this.ownsUnreadCtx = !n, this.unreadCtx = (n == null ? void 0 : n.unreadCtx) ?? new
|
|
6007
|
+
}), this.ownsUnreadCtx = !n, this.unreadCtx = (n == null ? void 0 : n.unreadCtx) ?? new re({
|
|
5990
6008
|
config: this.config,
|
|
5991
6009
|
api: this.api,
|
|
5992
6010
|
sessionsState: this.sessionCtx.sessionsState,
|
|
5993
6011
|
setSessions: this.sessionCtx.setSessions
|
|
5994
|
-
}), this.messageCtx = new
|
|
6012
|
+
}), this.messageCtx = new N({
|
|
5995
6013
|
config: this.config,
|
|
5996
6014
|
api: this.api,
|
|
5997
6015
|
sessionCtx: this.sessionCtx,
|
|
@@ -6004,55 +6022,55 @@ const S = class S {
|
|
|
6004
6022
|
getSendsPageContext: () => this.features.pageContext,
|
|
6005
6023
|
getClientCapabilities: o,
|
|
6006
6024
|
getRequestConfig: r
|
|
6007
|
-
}), this.uploadCtx = new
|
|
6025
|
+
}), this.uploadCtx = new ye(this.api), this.csatCtx = new we({
|
|
6008
6026
|
api: this.api,
|
|
6009
6027
|
sessionCtx: this.sessionCtx,
|
|
6010
6028
|
messageCtx: this.messageCtx
|
|
6011
|
-
}), this.dictationCtx = new
|
|
6029
|
+
}), this.dictationCtx = new He({
|
|
6012
6030
|
api: this.api,
|
|
6013
6031
|
config: this.config
|
|
6014
|
-
}), this.activeSessionPollingCtx = new
|
|
6032
|
+
}), this.activeSessionPollingCtx = new fe({
|
|
6015
6033
|
api: this.api,
|
|
6016
6034
|
config: this.config,
|
|
6017
6035
|
sessionCtx: this.sessionCtx,
|
|
6018
6036
|
messageCtx: this.messageCtx,
|
|
6019
6037
|
sessionPollingIntervalSeconds: S.pollingIntervalsSeconds.session
|
|
6020
|
-
}), this.routerCtx = new
|
|
6038
|
+
}), this.routerCtx = new Ua(this);
|
|
6021
6039
|
}
|
|
6022
6040
|
get streaming() {
|
|
6023
|
-
var e,
|
|
6024
|
-
return (e = this.messageCtx) != null && e.hasPendingAgentWork ? !0 : (
|
|
6041
|
+
var e, t;
|
|
6042
|
+
return (e = this.messageCtx) != null && e.hasPendingAgentWork ? !0 : (t = this.messageCtx) != null && t.state.get().isSendingMessage ? !1 : this.agent.streaming && this.getRequestConfig().streaming === !0;
|
|
6025
6043
|
}
|
|
6026
6044
|
/**
|
|
6027
6045
|
* The org's features narrowed by this embed's `config.features` — the
|
|
6028
6046
|
* answers the UI asks for, resolved against the current options.
|
|
6029
6047
|
*/
|
|
6030
6048
|
get features() {
|
|
6031
|
-
return
|
|
6049
|
+
return Va(this.agent, this.getRequestConfig());
|
|
6032
6050
|
}
|
|
6033
6051
|
};
|
|
6034
6052
|
S.pollingIntervalsSeconds = null, S.initialize = async ({
|
|
6035
6053
|
config: e,
|
|
6036
|
-
storage:
|
|
6054
|
+
storage: t,
|
|
6037
6055
|
getClientCapabilities: o,
|
|
6038
6056
|
getRequestConfig: r
|
|
6039
6057
|
}) => {
|
|
6040
|
-
var
|
|
6041
|
-
const _ = await new
|
|
6058
|
+
var s, a;
|
|
6059
|
+
const _ = await new H({
|
|
6042
6060
|
config: e
|
|
6043
6061
|
}).getExternalWidgetConfig();
|
|
6044
6062
|
if (!_.data)
|
|
6045
|
-
throw b.error("widget config fetch failed", _.error), new
|
|
6063
|
+
throw b.error("widget config fetch failed", _.error), new Ga(
|
|
6046
6064
|
"config-fetch-failed",
|
|
6047
6065
|
"Failed to fetch widget config",
|
|
6048
6066
|
_.error
|
|
6049
6067
|
);
|
|
6050
6068
|
return S.pollingIntervalsSeconds = {
|
|
6051
|
-
session: ((
|
|
6069
|
+
session: ((s = _.data) == null ? void 0 : s.sessionPollingIntervalSeconds) || 10,
|
|
6052
6070
|
sessions: ((a = _.data) == null ? void 0 : a.sessionsPollingIntervalSeconds) || 60
|
|
6053
6071
|
}, new S({
|
|
6054
6072
|
config: e,
|
|
6055
|
-
storage:
|
|
6073
|
+
storage: t,
|
|
6056
6074
|
getClientCapabilities: o,
|
|
6057
6075
|
getRequestConfig: r,
|
|
6058
6076
|
modes: _.data.modes || [],
|
|
@@ -6060,20 +6078,20 @@ S.pollingIntervalsSeconds = null, S.initialize = async ({
|
|
|
6060
6078
|
id: _.data.org.id,
|
|
6061
6079
|
name: _.data.org.name
|
|
6062
6080
|
},
|
|
6063
|
-
agent:
|
|
6081
|
+
agent: Ha(_.data)
|
|
6064
6082
|
});
|
|
6065
6083
|
};
|
|
6066
|
-
let
|
|
6067
|
-
function
|
|
6084
|
+
let $ = S;
|
|
6085
|
+
function st(i, e) {
|
|
6068
6086
|
return i ? {
|
|
6069
6087
|
streaming: i.streaming && (e == null ? void 0 : e.streaming) !== !1,
|
|
6070
6088
|
toolActivity: i.toolActivity === "hidden" || (e == null ? void 0 : e.toolActivity) === "hidden" ? "hidden" : i.toolActivity === "status" || (e == null ? void 0 : e.toolActivity) === "status" ? "status" : "details",
|
|
6071
6089
|
reasoning: i.reasoning && (e == null ? void 0 : e.reasoning) !== !1
|
|
6072
6090
|
} : e;
|
|
6073
6091
|
}
|
|
6074
|
-
class
|
|
6075
|
-
constructor({ attack: e, release:
|
|
6076
|
-
this.value = 0, this.attack = e, this.release =
|
|
6092
|
+
class ot {
|
|
6093
|
+
constructor({ attack: e, release: t }) {
|
|
6094
|
+
this.value = 0, this.attack = e, this.release = t;
|
|
6077
6095
|
}
|
|
6078
6096
|
next(e) {
|
|
6079
6097
|
return this.value += (e - this.value) * (e > this.value ? this.attack : this.release), this.value;
|
|
@@ -6082,57 +6100,60 @@ class at {
|
|
|
6082
6100
|
return this.value;
|
|
6083
6101
|
}
|
|
6084
6102
|
}
|
|
6085
|
-
const
|
|
6103
|
+
const M = [
|
|
6086
6104
|
"compact",
|
|
6087
6105
|
"sidebar",
|
|
6088
6106
|
"fullscreen"
|
|
6089
|
-
],
|
|
6090
|
-
|
|
6107
|
+
], Za = new Set(
|
|
6108
|
+
M
|
|
6091
6109
|
);
|
|
6092
|
-
function
|
|
6093
|
-
return
|
|
6110
|
+
function ee(i) {
|
|
6111
|
+
return Za.has(i);
|
|
6094
6112
|
}
|
|
6095
|
-
function
|
|
6096
|
-
if (!Array.isArray(i)) return
|
|
6097
|
-
const e = [],
|
|
6113
|
+
function nt(i) {
|
|
6114
|
+
if (!Array.isArray(i)) return M;
|
|
6115
|
+
const e = [], t = /* @__PURE__ */ new Set();
|
|
6098
6116
|
for (const o of i)
|
|
6099
|
-
!
|
|
6100
|
-
return e.length > 0 ? e :
|
|
6117
|
+
!ee(o) || t.has(o) || (t.add(o), e.push(o));
|
|
6118
|
+
return e.length > 0 ? e : M;
|
|
6101
6119
|
}
|
|
6102
|
-
function
|
|
6103
|
-
return
|
|
6120
|
+
function it(i, e) {
|
|
6121
|
+
return ee(i) && e.includes(i) ? i : e[0] ?? M[0];
|
|
6104
6122
|
}
|
|
6105
|
-
function
|
|
6123
|
+
function rt(i, e) {
|
|
6106
6124
|
return i === "left" || i === "right" ? i : e === "rtl" ? "left" : "right";
|
|
6107
6125
|
}
|
|
6108
|
-
function
|
|
6126
|
+
function _t(i) {
|
|
6109
6127
|
return i === "docked" ? "docked" : "floating";
|
|
6110
6128
|
}
|
|
6111
6129
|
export {
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6130
|
+
he as ConnectionAttemptUnavailableError,
|
|
6131
|
+
me as ConnectionRequestExpiredError,
|
|
6132
|
+
ot as DictationLevelSmoother,
|
|
6115
6133
|
z as PrimitiveState,
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6134
|
+
re as UnreadCtx,
|
|
6135
|
+
$ as WidgetCtx,
|
|
6136
|
+
Ga as WidgetInitializationError,
|
|
6137
|
+
Fa as buildSendMessageBody,
|
|
6120
6138
|
q as genUuid,
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6139
|
+
Ta as getTranslation,
|
|
6140
|
+
I as isAgentOrAiMessage,
|
|
6141
|
+
Xa as isAgentStreamKeepalive,
|
|
6142
|
+
tt as isAwaitingRequiredTap,
|
|
6143
|
+
be as isExhaustive,
|
|
6144
|
+
Z as isRecord,
|
|
6145
|
+
at as isRtlLanguage,
|
|
6146
|
+
Aa as isSupportedLanguage,
|
|
6147
|
+
et as isTurnSteeredPart,
|
|
6128
6148
|
b as log,
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6149
|
+
nt as normalizeCompanionLayouts,
|
|
6150
|
+
st as resolveClientPresentation,
|
|
6151
|
+
it as resolveCompanionDefaultLayout,
|
|
6152
|
+
La as resolveConfigContext,
|
|
6153
|
+
Pa as resolveLanguage,
|
|
6154
|
+
_t as resolveSidebarMode,
|
|
6155
|
+
rt as resolveSidebarSide,
|
|
6156
|
+
Ma as tappableOptionsMessage,
|
|
6157
|
+
Ia as translate
|
|
6137
6158
|
};
|
|
6138
6159
|
//# sourceMappingURL=index.js.map
|