@opencxh/domain 1.131.0 → 1.133.0

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.js CHANGED
@@ -1,116 +1,584 @@
1
- function S(e) {
2
- return e.replace(/<style[\s\S]*?<\/style>/gi, " ").replace(/<script[\s\S]*?<\/script>/gi, " ").replace(/<[^>]+>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/\s+/g, " ").trim();
1
+ const _e = 10, Te = 10, Me = 10, Se = 5, x = /* @__PURE__ */ new Set([
2
+ "header",
3
+ "section",
4
+ "context",
5
+ "divider",
6
+ "image",
7
+ "list",
8
+ "actions",
9
+ "attachments"
10
+ ]);
11
+ function m(e) {
12
+ if (typeof e == "string") return e.length > 0;
13
+ if (!e || typeof e != "object") return !1;
14
+ const n = e;
15
+ return typeof n.key == "string" || typeof n.value == "string";
3
16
  }
4
- function T(e) {
5
- const n = e.trim();
6
- return n.length <= 140 ? n : n.slice(0, 139).trimEnd() + "…";
17
+ function Ce(e, n = () => {
18
+ }) {
19
+ if (!Array.isArray(e)) return [];
20
+ const t = [];
21
+ for (const i of e) {
22
+ if (t.length >= 10) {
23
+ n("more than 10 blocks; the rest was dropped");
24
+ break;
25
+ }
26
+ if (!i || typeof i != "object") continue;
27
+ const a = i;
28
+ if (!x.has(a.type)) {
29
+ n("unknown block type " + String(a.type));
30
+ continue;
31
+ }
32
+ switch (a.type) {
33
+ case "header":
34
+ if (!m(a.text)) {
35
+ n("a header without text");
36
+ continue;
37
+ }
38
+ break;
39
+ case "context":
40
+ if (!m(a.text)) {
41
+ n("a context block without text");
42
+ continue;
43
+ }
44
+ break;
45
+ case "image":
46
+ if (!a.url || !a.alt) {
47
+ n("an image without url or alt");
48
+ continue;
49
+ }
50
+ break;
51
+ case "section":
52
+ Array.isArray(a.fields) && a.fields.length > 10 && (n("more than 10 fields in a section"), a.fields = a.fields.slice(0, 10));
53
+ break;
54
+ case "list":
55
+ if (!Array.isArray(a.items) || a.items.length === 0) {
56
+ n("a list without items");
57
+ continue;
58
+ }
59
+ a.items.length > 10 && (n("more than 10 list items"), a.items = a.items.slice(0, 10));
60
+ break;
61
+ case "actions": {
62
+ const r = Array.isArray(a.elements) ? a.elements : [], o = r.filter((s) => s && s.action_id && s.invoke && m(s.text));
63
+ if (o.length !== r.length && n("an action without action_id, invoke or text"), o.length === 0) continue;
64
+ o.length > 5 && n("more than 5 actions"), a.elements = o.slice(0, 5);
65
+ break;
66
+ }
67
+ }
68
+ t.push(a);
69
+ }
70
+ return t;
71
+ }
72
+ function U(e) {
73
+ return e.replace(/<style[\s\S]*?<\/style>/gi, " ").replace(/<script[\s\S]*?<\/script>/gi, " ").replace(/<[^>]+>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/\s+/g, " ").trim();
7
74
  }
8
- function c(e) {
75
+ function u(e) {
9
76
  if (!e || e < 0) return "";
10
77
  const n = Math.floor(e / 60), t = Math.floor(e % 60);
11
78
  return `${n}:${t.toString().padStart(2, "0")}`;
12
79
  }
13
- function h(e) {
14
- switch (e.type) {
15
- case "EMAIL_RECEIVED":
16
- case "EMAIL_SENT": {
17
- const n = e.payload, t = n.bodySnippet?.trim() || S(n.body ?? "");
18
- return n.subject ? `${n.subject} — ${t}` : t;
80
+ function A(e) {
81
+ return e ? ` — ${Math.floor(e / 60)}m ${e % 60}s` : "";
82
+ }
83
+ function f(e) {
84
+ return e?.split("@")?.[0] || e || "";
85
+ }
86
+ function p(e) {
87
+ return e.map((n) => n.name).join(", ");
88
+ }
89
+ function I(e) {
90
+ return e === "meeting" ? "Meeting" : e === "video" ? "Video call" : "Audio call";
91
+ }
92
+ const c = {
93
+ /* ---- voice ---- */
94
+ VOICE_CALL_STARTED: {
95
+ shape: "event",
96
+ channelKind: "voice",
97
+ icon: "phone",
98
+ snippet: () => "Gesprek gestart",
99
+ timeline: (e) => e.direction === "inbound" ? `Inbound call started — ${f(e.payload.from)}` : `Outbound call started — ${f(e.payload.to)}`
100
+ },
101
+ VOICE_CALL_ANSWERED: {
102
+ shape: "event",
103
+ channelKind: "voice",
104
+ icon: "phone",
105
+ snippet: () => "Gesprek aangenomen",
106
+ timeline: (e, n) => `Call answered — ${n}`
107
+ },
108
+ VOICE_CALL_HOLD: {
109
+ shape: "event",
110
+ channelKind: "voice",
111
+ icon: "phone",
112
+ snippet: () => "In de wacht",
113
+ timeline: (e, n) => `Call on hold — ${n}`
114
+ },
115
+ VOICE_CALL_UNHOLD: {
116
+ shape: "event",
117
+ channelKind: "voice",
118
+ icon: "phone",
119
+ snippet: () => "Hervat"
120
+ },
121
+ VOICE_CALL_ENDED: {
122
+ shape: "event",
123
+ channelKind: "voice",
124
+ icon: "phone",
125
+ snippet: (e) => `Gesprek beëindigd${e.payload.duration ? ` (${u(e.payload.duration)})` : ""}`,
126
+ timeline: (e) => `Call ended${A(e.payload.duration)}`
127
+ },
128
+ VOICE_CALL_MISSED: {
129
+ shape: "event",
130
+ channelKind: "voice",
131
+ icon: "phone",
132
+ snippet: () => "Gemiste oproep",
133
+ timeline: (e) => `Missed call — ${f(e.payload.from)}`
134
+ },
135
+ VOICE_CALL_FAILED: {
136
+ shape: "event",
137
+ channelKind: "voice",
138
+ icon: "phone",
139
+ snippet: () => "Gesprek mislukt",
140
+ timeline: () => "Call failed"
141
+ },
142
+ VOICE_CALL_VOICEMAIL: {
143
+ shape: "artifact",
144
+ channelKind: "voice",
145
+ icon: "phone",
146
+ snippet: (e) => e.payload.transcription?.trim() ? e.payload.transcription : "Voicemail ontvangen"
147
+ },
148
+ /* ---- video ---- */
149
+ VIDEO_CALL_STARTED: {
150
+ shape: "event",
151
+ channelKind: "video",
152
+ icon: "video",
153
+ snippet: () => "Gesprek gestart",
154
+ timeline: () => "Video call started"
155
+ },
156
+ VIDEO_CALL_ANSWERED: {
157
+ shape: "event",
158
+ channelKind: "video",
159
+ icon: "video",
160
+ snippet: () => "Gesprek aangenomen",
161
+ timeline: () => "Video call answered"
162
+ },
163
+ VIDEO_CALL_HOLD: {
164
+ shape: "event",
165
+ channelKind: "video",
166
+ icon: "video",
167
+ snippet: () => "In de wacht"
168
+ },
169
+ VIDEO_CALL_UNHOLD: {
170
+ shape: "event",
171
+ channelKind: "video",
172
+ icon: "video",
173
+ snippet: () => "Hervat"
174
+ },
175
+ VIDEO_CALL_ENDED: {
176
+ shape: "event",
177
+ channelKind: "video",
178
+ icon: "video",
179
+ snippet: (e) => `Gesprek beëindigd${e.payload.duration ? ` (${u(e.payload.duration)})` : ""}`,
180
+ timeline: () => "Video call ended"
181
+ },
182
+ VIDEO_CALL_MISSED: {
183
+ shape: "event",
184
+ channelKind: "video",
185
+ icon: "video",
186
+ snippet: () => "Gemiste oproep",
187
+ timeline: () => "Missed video call"
188
+ },
189
+ VIDEO_CALL_FAILED: {
190
+ shape: "event",
191
+ channelKind: "video",
192
+ icon: "video",
193
+ snippet: () => "Gesprek mislukt",
194
+ timeline: () => "Video call failed"
195
+ },
196
+ /* ---- mail ---- */
197
+ EMAIL_RECEIVED: {
198
+ shape: "message",
199
+ triggerable: !0,
200
+ displayNameKey: "communication:activity.EMAIL_RECEIVED",
201
+ component: "communication:EmailActivity",
202
+ channelKind: "mail",
203
+ icon: "mail",
204
+ replyable: !0,
205
+ carriesText: !0,
206
+ countsAs: "inbound_message",
207
+ snippet: _
208
+ },
209
+ EMAIL_SENT: {
210
+ shape: "message",
211
+ component: "communication:EmailActivity",
212
+ channelKind: "mail",
213
+ icon: "mail",
214
+ replyable: !0,
215
+ carriesText: !0,
216
+ countsAs: "outbound_message",
217
+ snippet: _
218
+ },
219
+ /* ---- chat ---- */
220
+ CHAT_MESSAGE_SENT: {
221
+ shape: "message",
222
+ component: "communication:ChatMessage",
223
+ channelKind: "chat",
224
+ icon: "message-circle",
225
+ replyable: !0,
226
+ carriesText: !0,
227
+ countsAs: "outbound_message",
228
+ snippet: (e) => e.payload.text ?? ""
229
+ },
230
+ CHAT_MESSAGE_RECEIVED: {
231
+ shape: "message",
232
+ triggerable: !0,
233
+ displayNameKey: "communication:activity.CHAT_MESSAGE_RECEIVED",
234
+ component: "communication:ChatMessage",
235
+ channelKind: "chat",
236
+ icon: "message-circle",
237
+ replyable: !0,
238
+ carriesText: !0,
239
+ countsAs: "inbound_message",
240
+ snippet: (e) => e.payload.text ?? ""
241
+ },
242
+ CHAT_MEMBER_JOINED: {
243
+ shape: "event",
244
+ channelKind: "chat",
245
+ icon: "message-circle",
246
+ snippet: (e) => `${p(e.payload.members)} toegevoegd`,
247
+ timeline: (e) => {
248
+ const n = p(e.payload.members) || "Someone", t = e.payload.initiator?.name ? ` · added by ${e.payload.initiator.name}` : "";
249
+ return `${n} joined the chat${t}`;
250
+ }
251
+ },
252
+ CHAT_MEMBER_LEFT: {
253
+ shape: "event",
254
+ channelKind: "chat",
255
+ icon: "message-circle",
256
+ snippet: (e) => `${p(e.payload.members)} verlaten`,
257
+ timeline: (e) => {
258
+ const n = p(e.payload.members) || "Someone", t = e.payload.initiator?.name ? ` · removed by ${e.payload.initiator.name}` : "";
259
+ return `${n} left the chat${t}`;
19
260
  }
20
- case "CHAT_MESSAGE_SENT":
21
- case "CHAT_MESSAGE_RECEIVED":
22
- return e.payload.text ?? "";
23
- case "CHAT_RENAMED":
24
- return `Hernoemd naar "${e.payload.newName}"`;
25
- case "CHAT_MEMBER_JOINED":
26
- return `${e.payload.members.map((n) => n.name).join(", ")} toegevoegd`;
27
- case "CHAT_MEMBER_LEFT":
28
- return `${e.payload.members.map((n) => n.name).join(", ")} verlaten`;
29
- case "CHAT_CALL_STARTED":
30
- return "Gesprek gestart";
31
- case "CHAT_CALL_ENDED":
32
- return `Gesprek beëindigd${e.payload.duration ? ` (${c(e.payload.duration)})` : ""}`;
33
- case "CHAT_EVENT":
34
- return e.payload.text ?? e.payload.eventType;
35
- case "VOICE_CALL_STARTED":
36
- case "VIDEO_CALL_STARTED":
37
- return "Gesprek gestart";
38
- case "VOICE_CALL_ANSWERED":
39
- case "VIDEO_CALL_ANSWERED":
40
- return "Gesprek aangenomen";
41
- case "VOICE_CALL_HOLD":
42
- case "VIDEO_CALL_HOLD":
43
- return "In de wacht";
44
- case "VOICE_CALL_UNHOLD":
45
- case "VIDEO_CALL_UNHOLD":
46
- return "Hervat";
47
- case "VOICE_CALL_ENDED":
48
- case "VIDEO_CALL_ENDED":
49
- return `Gesprek beëindigd${e.payload.duration ? ` (${c(e.payload.duration)})` : ""}`;
50
- case "VOICE_CALL_MISSED":
51
- case "VIDEO_CALL_MISSED":
52
- return "Gemiste oproep";
53
- case "VOICE_CALL_FAILED":
54
- case "VIDEO_CALL_FAILED":
55
- return "Gesprek mislukt";
56
- case "VOICE_CALL_VOICEMAIL":
57
- return e.payload.transcription?.trim() ? e.payload.transcription : "Voicemail ontvangen";
58
- case "TRANSCRIPT_ADDED":
59
- return (e.payload.segments ?? []).map((n) => n.text).join(" ");
60
- case "AI_MESSAGE_ADDED":
61
- return e.payload.output?.text ?? e.payload.input?.text ?? "";
62
- case "AI_ACTION_PROPOSED":
63
- return `Voorstel wacht op goedkeuring (${e.payload.actions?.length ?? 0} actie(s))`;
64
- case "PLAYBOOK_STARTED":
65
- return `Playbook gestart${e.payload.playbookName ? `: ${e.payload.playbookName}` : ""}`;
66
- case "PLAYBOOK_COMPLETED":
67
- return "Playbook afgerond";
68
- case "PLAYBOOK_ESCALATED":
69
- return "Playbook geëscaleerd naar een mens";
70
- case "MEETING_SCHEDULED":
71
- return `Vergadering gepland: ${e.payload.title}`;
72
- case "MEETING_STARTED":
73
- return `Vergadering gestart: ${e.payload.title}`;
74
- case "MEETING_ENDED":
75
- return `Vergadering beëindigd${e.payload.duration ? ` (${c(e.payload.duration)})` : ""}`;
76
- case "MEETING_PARTICIPANT_JOINED":
77
- return `${e.payload.name} deelgenomen`;
78
- case "MEETING_PARTICIPANT_LEFT":
79
- return `${e.payload.name} verlaten`;
80
- case "COMMENT_ADDED":
81
- return e.payload.text ?? "";
82
- case "FILE_UPLOADED":
83
- return `Bestand: ${e.payload.fileName}`;
84
- case "INTERACTION_CREATED":
85
- return "Interactie aangemaakt";
86
- case "INTERACTION_STATUS_CHANGED":
87
- return `Status: ${e.payload.fromStatus} → ${e.payload.toStatus}`;
88
- case "INTERACTION_ASSIGNED":
89
- return "Interactie toegewezen";
90
- default:
91
- return "";
261
+ },
262
+ CHAT_RENAMED: {
263
+ shape: "event",
264
+ channelKind: "chat",
265
+ icon: "message-circle",
266
+ snippet: (e) => `Hernoemd naar "${e.payload.newName}"`,
267
+ timeline: (e) => `Chat renamed to "${e.payload.newName}"${e.payload.initiator ? ` by ${e.payload.initiator.name}` : ""}`
268
+ },
269
+ CHAT_CALL_STARTED: {
270
+ shape: "event",
271
+ channelKind: "chat",
272
+ icon: "message-circle",
273
+ snippet: () => "Gesprek gestart",
274
+ timeline: (e) => `${I(e.payload.callType)} started${e.payload.initiator ? ` by ${e.payload.initiator.name}` : ""}`,
275
+ joinUrl: (e) => e.payload.joinUrl
276
+ },
277
+ CHAT_CALL_ENDED: {
278
+ shape: "event",
279
+ channelKind: "chat",
280
+ icon: "message-circle",
281
+ snippet: (e) => `Gesprek beëindigd${e.payload.duration ? ` (${u(e.payload.duration)})` : ""}`,
282
+ timeline: (e) => `${I(e.payload.callType)} ended${A(e.payload.duration)}`,
283
+ joinUrl: (e) => e.payload.joinUrl
284
+ },
285
+ CHAT_EVENT: {
286
+ shape: "event",
287
+ channelKind: "chat",
288
+ icon: "message-circle",
289
+ snippet: (e) => e.payload.text ?? e.payload.eventType,
290
+ timeline: (e) => e.payload.text || e.payload.eventType
291
+ },
292
+ /* ---- inhoud ---- */
293
+ TRANSCRIPT_ADDED: {
294
+ shape: "artifact",
295
+ triggerable: !0,
296
+ displayNameKey: "communication:activity.TRANSCRIPT_ADDED",
297
+ component: "communication:TranscriptionActivity",
298
+ icon: "captions",
299
+ carriesText: !0,
300
+ snippet: (e) => (e.payload.segments ?? []).map((n) => n.text).join(" ")
301
+ },
302
+ COMMENT_ADDED: {
303
+ shape: "note",
304
+ component: "communication:CommentActivity",
305
+ icon: "sticky-note",
306
+ carriesText: !0,
307
+ snippet: (e) => e.payload.text ?? ""
308
+ },
309
+ FILE_UPLOADED: {
310
+ shape: "artifact",
311
+ component: "communication:FileActivity",
312
+ icon: "paperclip",
313
+ snippet: (e) => `Bestand: ${e.payload.fileName}`
314
+ },
315
+ /* ---- AI & playbooks ---- */
316
+ AI_MESSAGE_ADDED: {
317
+ shape: "event",
318
+ triggerable: !0,
319
+ displayNameKey: "communication:activity.AI_MESSAGE_ADDED",
320
+ icon: "circle",
321
+ snippet: (e) => e.payload.output?.text ?? e.payload.input?.text ?? "",
322
+ timeline: () => "AI message added"
323
+ },
324
+ AI_ACTION_PROPOSED: {
325
+ shape: "event",
326
+ component: "communication:ProposedActionCard",
327
+ icon: "circle",
328
+ playbookAuthored: !0,
329
+ snippet: (e) => `Voorstel wacht op goedkeuring (${e.payload.actions?.length ?? 0} actie(s))`
330
+ },
331
+ PLAYBOOK_STARTED: {
332
+ shape: "event",
333
+ icon: "circle",
334
+ playbookAuthored: !0,
335
+ snippet: (e) => `Playbook gestart${e.payload.playbookName ? `: ${e.payload.playbookName}` : ""}`,
336
+ timeline: (e) => `Playbook gestart${e.payload.playbookName ? ` — ${e.payload.playbookName}` : ""}`
337
+ },
338
+ PLAYBOOK_COMPLETED: {
339
+ shape: "event",
340
+ icon: "circle",
341
+ playbookAuthored: !0,
342
+ snippet: () => "Playbook afgerond",
343
+ timeline: () => "Playbook afgerond"
344
+ },
345
+ PLAYBOOK_ESCALATED: {
346
+ shape: "event",
347
+ icon: "circle",
348
+ playbookAuthored: !0,
349
+ snippet: () => "Playbook geëscaleerd naar een mens",
350
+ timeline: () => "Playbook geëscaleerd naar een mens"
351
+ },
352
+ /* ---- meetings ---- */
353
+ MEETING_SCHEDULED: {
354
+ shape: "event",
355
+ icon: "calendar",
356
+ snippet: (e) => `Vergadering gepland: ${e.payload.title}`,
357
+ timeline: () => "Meeting scheduled",
358
+ joinUrl: (e) => e.payload.joinUrl
359
+ },
360
+ MEETING_STARTED: {
361
+ shape: "event",
362
+ icon: "calendar",
363
+ snippet: (e) => `Vergadering gestart: ${e.payload.title}`,
364
+ timeline: () => "Meeting started",
365
+ joinUrl: (e) => e.payload.joinUrl
366
+ },
367
+ MEETING_ENDED: {
368
+ shape: "event",
369
+ icon: "calendar",
370
+ snippet: (e) => `Vergadering beëindigd${e.payload.duration ? ` (${u(e.payload.duration)})` : ""}`,
371
+ timeline: () => "Meeting ended"
372
+ },
373
+ MEETING_PARTICIPANT_JOINED: {
374
+ shape: "event",
375
+ icon: "calendar",
376
+ snippet: (e) => `${e.payload.name} deelgenomen`,
377
+ timeline: (e, n) => `${n} joined the meeting`
378
+ },
379
+ MEETING_PARTICIPANT_LEFT: {
380
+ shape: "event",
381
+ icon: "calendar",
382
+ snippet: (e) => `${e.payload.name} verlaten`,
383
+ timeline: (e, n) => `${n} left the meeting`
384
+ },
385
+ /* ---- interactie-levenscyclus ---- */
386
+ INTERACTION_CREATED: {
387
+ shape: "event",
388
+ icon: "circle",
389
+ snippet: () => "Interactie aangemaakt",
390
+ timeline: (e, n) => `Interaction started by ${n}`
391
+ },
392
+ INTERACTION_STATUS_CHANGED: {
393
+ shape: "event",
394
+ triggerable: !0,
395
+ displayNameKey: "communication:activity.INTERACTION_STATUS_CHANGED",
396
+ icon: "circle-dot",
397
+ snippet: (e) => `Status: ${e.payload.fromStatus} → ${e.payload.toStatus}`,
398
+ timeline: (e, n) => `Status changed to ${e.payload.toStatus} by ${n}`
399
+ },
400
+ INTERACTION_ASSIGNED: {
401
+ shape: "event",
402
+ icon: "user",
403
+ snippet: () => "Interactie toegewezen",
404
+ timeline: (e, n) => `Assigned by ${n}`
92
405
  }
406
+ };
407
+ function _(e) {
408
+ const n = e.payload, t = n.bodySnippet?.trim() || U(n.body ?? "");
409
+ return n.subject ? `${n.subject} — ${t}` : t;
410
+ }
411
+ function l(e) {
412
+ return c[e];
93
413
  }
94
- function ie(e) {
414
+ function ve(e) {
415
+ return l(e)?.icon ?? "circle";
416
+ }
417
+ function Ne(e) {
418
+ return l(e)?.channelKind;
419
+ }
420
+ function Oe(e) {
421
+ const n = l(e)?.shape;
422
+ return n === "message" || n === "note";
423
+ }
424
+ function ke(e) {
425
+ return l(e)?.replyable === !0;
426
+ }
427
+ function De(e) {
428
+ return l(e)?.carriesText === !0;
429
+ }
430
+ function Le(e) {
431
+ return l(e)?.countsAs;
432
+ }
433
+ function Re(e) {
434
+ return l(e)?.playbookAuthored === !0;
435
+ }
436
+ function P(e) {
437
+ const n = l(e.type)?.snippet;
438
+ return n ? n(e) : "";
439
+ }
440
+ function $e(e, n) {
441
+ const t = l(e.type)?.timeline;
442
+ return t ? t(e, n) : e.type.replace(/_/g, " ").toLowerCase();
443
+ }
444
+ function xe(e) {
445
+ const n = l(e.type)?.joinUrl;
446
+ return n ? n(e) : void 0;
447
+ }
448
+ function h(e, n) {
449
+ let t = e;
450
+ for (const i of n.split(".")) {
451
+ if (t == null || typeof t != "object") return "";
452
+ t = t[i];
453
+ }
454
+ return t == null ? "" : typeof t == "string" ? t : typeof t == "number" || typeof t == "boolean" ? String(t) : "";
455
+ }
456
+ function y(e, n, t) {
457
+ if (e === void 0) return null;
458
+ if (typeof e == "string") return e || null;
459
+ if ("value" in e)
460
+ return h(n, e.value) || null;
461
+ const i = {};
462
+ for (const [r, o] of Object.entries(e.params ?? {}))
463
+ i[r] = h(n, o);
464
+ const a = t(e.key, i);
465
+ return a === e.key ? null : a;
466
+ }
467
+ function w(e, n) {
468
+ if (!e || typeof e == "string" || "value" in e) return null;
469
+ const t = {};
470
+ for (const [i, a] of Object.entries(e.params ?? {}))
471
+ t[i] = h(n, a);
472
+ return { key: e.key, params: t };
473
+ }
474
+ const K = (e) => e;
475
+ function T(e) {
476
+ const n = c[e];
477
+ return {
478
+ type: e,
479
+ shape: n.shape,
480
+ channelKind: n.channelKind,
481
+ icon: n.icon,
482
+ replyable: n.replyable === !0,
483
+ countsAs: n.countsAs,
484
+ carriesText: n.carriesText === !0,
485
+ triggerable: n.triggerable === !0,
486
+ component: n.component,
487
+ builtIn: !0,
488
+ displayNameKey: n.displayNameKey
489
+ };
490
+ }
491
+ function M(e) {
492
+ return {
493
+ type: e.type,
494
+ shape: e.shape,
495
+ channelKind: e.channelKind,
496
+ icon: e.icon || "circle",
497
+ replyable: e.replyable === !0,
498
+ countsAs: e.countsAs,
499
+ carriesText: e.carriesText === !0,
500
+ triggerable: e.triggerable === !0,
501
+ component: e.component,
502
+ builtIn: !1,
503
+ displayNameKey: e.displayNameKey
504
+ };
505
+ }
506
+ class G {
507
+ constructor(n = [], t = K) {
508
+ this.translate = t;
509
+ for (const i of n)
510
+ i?.type && (i.type in c || this.declared.has(i.type) || this.declared.set(i.type, i));
511
+ }
512
+ declared = /* @__PURE__ */ new Map();
513
+ get(n) {
514
+ if (n in c) return T(n);
515
+ const t = this.declared.get(n);
516
+ return t ? M(t) : void 0;
517
+ }
518
+ /** Alles wat als trigger aangeboden mag worden, ingebouwd en gedeclareerd. */
519
+ triggerable() {
520
+ const n = Object.keys(c).filter((i) => c[i].triggerable).map(T), t = [...this.declared.values()].map(M).filter((i) => i.triggerable);
521
+ return [...n, ...t];
522
+ }
523
+ /**
524
+ * De tijdlijnregel. Ingebouwd komt uit de catalogus, gedeclareerd uit `text` + de
525
+ * meegeleverde vertaling. Zonder bruikbare tekst valt het terug op de ontstreepte
526
+ * typenaam — dezelfde regel die de feed altijd al toonde voor onbekende types.
527
+ */
528
+ timelineText(n, t) {
529
+ const i = c[n.type];
530
+ if (i?.timeline) return i.timeline(n, t);
531
+ const a = this.declared.get(n.type);
532
+ return y(a?.text, n, this.translate) ?? n.type.replace(/_/g, " ").toLowerCase();
533
+ }
534
+ /** De regel voor de inboxlijst. Leeg wanneer het type niets te tonen heeft. */
535
+ snippet(n) {
536
+ const t = c[n.type];
537
+ if (t?.snippet) return t.snippet(n);
538
+ const i = this.declared.get(n.type);
539
+ return y(i?.text, n, this.translate) ?? "";
540
+ }
541
+ /** De descriptor zoals hij binnenkwam; nodig om `text` als sleutel op te slaan. */
542
+ descriptor(n) {
543
+ return this.declared.get(n);
544
+ }
545
+ /** De declaratieve blokken van een type, als het er heeft. */
546
+ blocks(n) {
547
+ const t = this.declared.get(n)?.render;
548
+ return t?.length ? t : void 0;
549
+ }
550
+ /** De vertaler die bij deze registry hoort, voor het oplossen van blokteksten. */
551
+ get translator() {
552
+ return this.translate;
553
+ }
554
+ }
555
+ const Ue = new G(), S = 140;
556
+ function V(e) {
557
+ const n = e.trim();
558
+ return n.length <= S ? n : n.slice(0, S - 1).trimEnd() + "…";
559
+ }
560
+ function Pe(e, n) {
561
+ const t = w(n?.text, e), i = n ? y(n.text, e, (a) => a) : null;
95
562
  return {
96
563
  activityId: e.id,
97
564
  type: e.type,
98
- snippet: T(h(e)),
565
+ snippet: V(i ?? P(e)),
99
566
  authorName: e.author?.name ?? "",
100
567
  direction: e.direction,
101
- createdAt: e.createdAt ?? Date.now()
568
+ createdAt: e.createdAt ?? Date.now(),
569
+ ...t ? { snippetKey: t.key, snippetParams: t.params } : {}
102
570
  };
103
571
  }
104
- function se(e, n, t = []) {
105
- const r = e.createdAt;
106
- if (!r) return [];
572
+ function we(e, n, t = []) {
573
+ const i = e.createdAt;
574
+ if (!i) return [];
107
575
  const a = new Set(t);
108
- return e.author.type === "user" && e.author.id && a.add(e.author.id), Object.entries(n).filter(([i, s]) => s >= r && !a.has(i)).map(([i]) => i);
576
+ return e.author.type === "user" && e.author.id && a.add(e.author.id), Object.entries(n).filter(([r, o]) => o >= i && !a.has(r)).map(([r]) => r);
109
577
  }
110
- function oe(e) {
578
+ function Ke(e) {
111
579
  return e.createdAt ?? 0;
112
580
  }
113
- const le = [
581
+ const Ge = [
114
582
  { id: "agent", label: "Agent", labelSource: "user" },
115
583
  { id: "team", label: "Team", labelSource: "team" },
116
584
  { id: "inbox", label: "Inbox", labelSource: "inbox" },
@@ -120,57 +588,57 @@ const le = [
120
588
  { id: "handledBy", label: "Afhandelaar", labelSource: "raw" },
121
589
  { id: "time", label: "Tijd", labelSource: "raw" }
122
590
  ];
123
- function ce(e) {
591
+ function Ve(e) {
124
592
  const n = [];
125
593
  for (const t of Object.keys(e))
126
- for (const r of Object.keys(e[t]))
127
- n.push({ lang: t, key: r, value: e[t][r] });
594
+ for (const i of Object.keys(e[t]))
595
+ n.push({ lang: t, key: i, value: e[t][i] });
128
596
  return n;
129
597
  }
130
- function u(e) {
598
+ function g(e) {
131
599
  return e < 10 ? `0${e}` : `${e}`;
132
600
  }
133
- function D(e, n) {
134
- const t = new Date(e), r = `${t.getUTCFullYear()}-${u(t.getUTCMonth() + 1)}-${u(t.getUTCDate())}`;
135
- return n === "day" ? r : `${r}T${u(t.getUTCHours())}`;
601
+ function H(e, n) {
602
+ const t = new Date(e), i = `${t.getUTCFullYear()}-${g(t.getUTCMonth() + 1)}-${g(t.getUTCDate())}`;
603
+ return n === "day" ? i : `${i}T${g(t.getUTCHours())}`;
136
604
  }
137
- function C(e, n) {
605
+ function B(e, n) {
138
606
  const t = new Date(e);
139
607
  return t.setUTCMinutes(0, 0, 0), n === "day" && t.setUTCHours(0), t.getTime();
140
608
  }
141
- const O = 36e5, N = 864e5;
142
- function ue(e, n, t) {
143
- const r = t === "hour" ? O : N, a = [];
144
- for (let i = C(e, t); i <= n; i += r)
145
- a.push(D(i, t));
609
+ const j = 36e5, F = 864e5;
610
+ function He(e, n, t) {
611
+ const i = t === "hour" ? j : F, a = [];
612
+ for (let r = B(e, t); r <= n; r += i)
613
+ a.push(H(r, t));
146
614
  return a;
147
615
  }
148
- const L = [
616
+ const X = [
149
617
  { id: "resource", label: "Resource", labelSource: "raw" },
150
618
  { id: "origin", label: "Herkomst", labelSource: "raw" }
151
- ], R = L.map((e) => e.id);
152
- function y(e, n) {
619
+ ], W = X.map((e) => e.id);
620
+ function Y(e, n) {
153
621
  return `${e}.usage.${n}`;
154
622
  }
155
- function de(e, n) {
623
+ function Be(e, n) {
156
624
  return n.map((t) => ({
157
- id: y(e, t.unit),
625
+ id: Y(e, t.unit),
158
626
  label: t.label,
159
627
  category: "Verbruik",
160
628
  valueType: t.valueType ?? "count",
161
629
  aggregation: "sum",
162
630
  supportedDimensions: [
163
631
  "provider",
164
- ...R,
632
+ ...W,
165
633
  ...t.extraDimensions ?? [],
166
634
  "time"
167
635
  ]
168
636
  }));
169
637
  }
170
- function pe(e) {
638
+ function je(e) {
171
639
  return (e.startsWith("tool:") ? e.slice(5) : e).replace(/__/g, " · ").replace(/\./g, " · ").replace(/_/g, " ");
172
640
  }
173
- const fe = [
641
+ const Fe = [
174
642
  { name: "text", type: "string" },
175
643
  { name: "subject", type: "string" },
176
644
  { name: "from", type: "string" },
@@ -193,7 +661,7 @@ const fe = [
193
661
  // een nieuw adres) — een stap die hierop leunt hoort dus een `condition` te hebben.
194
662
  { name: "contactId", type: "string" },
195
663
  { name: "companyId", type: "string" }
196
- ], ge = {
664
+ ], Xe = {
197
665
  topics: [
198
666
  { name: "topic", type: "string" },
199
667
  { name: "confidence", type: "number" }
@@ -204,7 +672,7 @@ const fe = [
204
672
  ],
205
673
  extract: []
206
674
  };
207
- function k(e) {
675
+ function z(e) {
208
676
  switch (e.kind) {
209
677
  case "user":
210
678
  return `user:${e.userId}`;
@@ -214,22 +682,22 @@ function k(e) {
214
682
  return "org";
215
683
  }
216
684
  }
217
- function Ee(e) {
685
+ function We(e) {
218
686
  if (typeof e != "string") return;
219
687
  const n = e.trim();
220
688
  if (n === "org") return { kind: "org" };
221
689
  const t = n.indexOf(":");
222
690
  if (t <= 0) return;
223
- const r = n.slice(0, t), a = n.slice(t + 1).trim();
691
+ const i = n.slice(0, t), a = n.slice(t + 1).trim();
224
692
  if (a) {
225
- if (r === "user") return { kind: "user", userId: a };
226
- if (r === "team") return { kind: "team", teamId: a };
693
+ if (i === "user") return { kind: "user", userId: a };
694
+ if (i === "team") return { kind: "team", teamId: a };
227
695
  }
228
696
  }
229
- function x(e) {
230
- return k(e);
697
+ function q(e) {
698
+ return z(e);
231
699
  }
232
- function me(e) {
700
+ function Ye(e) {
233
701
  switch (e.kind) {
234
702
  case "personal":
235
703
  return { kind: "user", userId: e.userId };
@@ -239,20 +707,20 @@ function me(e) {
239
707
  return { kind: "org" };
240
708
  }
241
709
  }
242
- function be(e) {
243
- return x(e);
710
+ function ze(e) {
711
+ return q(e);
244
712
  }
245
- const U = ["done", "escalated", "failed", "timed_out", "stopped"], P = ["awaiting_approval", "awaiting_reply"];
246
- function $(e) {
247
- return U.includes(e);
713
+ const J = ["done", "escalated", "failed", "timed_out", "stopped"], Q = ["awaiting_approval", "awaiting_reply"];
714
+ function Z(e) {
715
+ return J.includes(e);
248
716
  }
249
- function Ae(e) {
250
- return $(e);
717
+ function qe(e) {
718
+ return Z(e);
251
719
  }
252
- function Ie(e) {
253
- return P.includes(e);
720
+ function Je(e) {
721
+ return Q.includes(e);
254
722
  }
255
- const _ = [
723
+ const R = [
256
724
  {
257
725
  id: "openai",
258
726
  label: "OpenAI",
@@ -340,53 +808,53 @@ const _ = [
340
808
  defaultModel: "default"
341
809
  }
342
810
  ];
343
- function d(e) {
344
- return _.find((n) => n.id === e);
811
+ function E(e) {
812
+ return R.find((n) => n.id === e);
345
813
  }
346
- function _e(e) {
347
- return d(e)?.label ?? e;
814
+ function Qe(e) {
815
+ return E(e)?.label ?? e;
348
816
  }
349
- function Me(e, n = "gpt-5-mini") {
350
- return d(e)?.defaultModel ?? n;
817
+ function Ze(e, n = "gpt-5-mini") {
818
+ return E(e)?.defaultModel ?? n;
351
819
  }
352
- function Se(e) {
353
- return _.filter((n) => n.capabilities.includes(e));
820
+ function en(e) {
821
+ return R.filter((n) => n.capabilities.includes(e));
354
822
  }
355
- function Te(e) {
356
- const n = d(e);
823
+ function nn(e) {
824
+ const n = E(e);
357
825
  return !!n && !n.baseUrl;
358
826
  }
359
- const he = /* @__PURE__ */ new Set(["mail", "message"]);
360
- function w(e, n) {
827
+ const tn = /* @__PURE__ */ new Set(["mail", "message"]);
828
+ function ee(e, n) {
361
829
  const t = e.settings?.signatures?.[n];
362
830
  return !t || !t.enabled || !t.body || t.body.trim() === "" ? null : t;
363
831
  }
364
- function De(e, n, t, r = "html") {
832
+ function an(e, n, t, i = "html") {
365
833
  if (!e) return t;
366
- const a = w(e, n);
367
- return a ? `${t}${r === "text" ? `
834
+ const a = ee(e, n);
835
+ return a ? `${t}${i === "text" ? `
368
836
 
369
837
  ` : n === "mail" ? "<br><br>-- <br>" : "<br><br>"}${a.body}` : t;
370
838
  }
371
- function Ce(e) {
839
+ function rn(e) {
372
840
  return e.endpoints ?? [];
373
841
  }
374
- const Oe = (e) => !!e.assignedUserId || !!e.assignedInboxId, Ne = (e) => e.status === "closed", Le = (e) => ({
842
+ const on = (e) => !!e.assignedUserId || !!e.assignedInboxId, sn = (e) => e.status === "closed", ln = (e) => ({
375
843
  urgent: 10,
376
844
  high: 5,
377
845
  normal: 2,
378
846
  low: 1
379
- })[e.priority] || 0, Re = (e, n = 30) => e.title?.length <= n ? e.title : `${e.title.substring(0, n)}...`;
380
- function ye(e, n) {
847
+ })[e.priority] || 0, cn = (e, n = 30) => e.title?.length <= n ? e.title : `${e.title.substring(0, n)}...`;
848
+ function un(e, n) {
381
849
  return e.lastActivityAt ? !(e.seenBy ?? []).includes(n) : !1;
382
850
  }
383
- const ke = 2e3, xe = 500, Ue = 12e3, Pe = 4e3, G = ["contact", "company"];
384
- function $e(e) {
851
+ const pn = 2e3, dn = 500, mn = 12e3, fn = 4e3, ne = ["contact", "company"];
852
+ function gn(e) {
385
853
  if (!e) return !1;
386
854
  const n = e.slice(0, e.indexOf(":"));
387
- return G.includes(n);
855
+ return ne.includes(n);
388
856
  }
389
- const p = {
857
+ const b = {
390
858
  // The lower bounds are deliberately generous: service ranges (0800/0900) are
391
859
  // shorter than geographic numbers, and a too-strict minimum silently drops them.
392
860
  // An over-permissive key is harmless — it simply matches nothing.
@@ -409,81 +877,81 @@ const p = {
409
877
  PL: { callingCode: "48", nsnMin: 9, nsnMax: 9 },
410
878
  US: { callingCode: "1", nsnMin: 10, nsnMax: 10 },
411
879
  CA: { callingCode: "1", nsnMin: 10, nsnMax: 10 }
412
- }, V = "NL", H = 15, B = 8, F = Array.from(
413
- new Set(Object.values(p).map((e) => e.callingCode))
880
+ }, te = "NL", ie = 15, ae = 8, re = Array.from(
881
+ new Set(Object.values(b).map((e) => e.callingCode))
414
882
  ).sort((e, n) => n.length - e.length);
415
- function f(e) {
883
+ function C(e) {
416
884
  if (e)
417
- return p[e.trim().toUpperCase()];
885
+ return b[e.trim().toUpperCase()];
418
886
  }
419
- function l(e, n) {
887
+ function d(e, n) {
420
888
  return e.length >= n.nsnMin && e.length <= n.nsnMax;
421
889
  }
422
- function g(e) {
423
- if (e.length > H) return null;
424
- for (const n of F) {
890
+ function v(e) {
891
+ if (e.length > ie) return null;
892
+ for (const n of re) {
425
893
  if (!e.startsWith(n)) continue;
426
894
  const t = e.slice(n.length);
427
- for (const r of Object.values(p)) {
428
- if (r.callingCode !== n) continue;
429
- const a = r.trunkPrefix, i = a && t.startsWith(a) ? t.slice(a.length) : t;
430
- if (l(i, r)) return `+${n}${i}`;
895
+ for (const i of Object.values(b)) {
896
+ if (i.callingCode !== n) continue;
897
+ const a = i.trunkPrefix, r = a && t.startsWith(a) ? t.slice(a.length) : t;
898
+ if (d(r, i)) return `+${n}${r}`;
431
899
  }
432
900
  return null;
433
901
  }
434
- return e.length < B ? null : `+${e}`;
902
+ return e.length < ae ? null : `+${e}`;
435
903
  }
436
- function v(e) {
904
+ function oe(e) {
437
905
  let n = e.trim();
438
906
  const t = n.match(/^(sips?|tel|whatsapp):/i);
439
907
  t && (n = n.slice(t[0].length));
440
- const r = n.indexOf("@");
441
- return r >= 0 && (n = n.slice(0, r)), n.trim();
908
+ const i = n.indexOf("@");
909
+ return i >= 0 && (n = n.slice(0, i)), n.trim();
442
910
  }
443
- function we(e) {
911
+ function hn(e) {
444
912
  if (!e) return !1;
445
913
  const n = e.indexOf("@");
446
914
  if (n <= 0) return !1;
447
915
  const t = e.slice(0, n).trim();
448
916
  return !/^[+\d\s().-]+$/.test(t);
449
917
  }
450
- function E(e, n) {
918
+ function N(e, n) {
451
919
  if (!e) return null;
452
- const t = v(e);
920
+ const t = oe(e);
453
921
  if (!t) return null;
454
- const r = t.startsWith("+"), a = t.replace(/\D/g, "");
922
+ const i = t.startsWith("+"), a = t.replace(/\D/g, "");
455
923
  if (!a) return null;
456
- if (r) return g(a);
457
- if (a.startsWith("00")) return g(a.slice(2));
458
- const i = f(n) ?? f(V);
459
- if (!i) return null;
460
- const s = i.trunkPrefix;
461
- if (s && a.startsWith(s)) {
462
- const o = a.slice(s.length);
463
- return l(o, i) ? `+${i.callingCode}${o}` : null;
924
+ if (i) return v(a);
925
+ if (a.startsWith("00")) return v(a.slice(2));
926
+ const r = C(n) ?? C(te);
927
+ if (!r) return null;
928
+ const o = r.trunkPrefix;
929
+ if (o && a.startsWith(o)) {
930
+ const s = a.slice(o.length);
931
+ return d(s, r) ? `+${r.callingCode}${s}` : null;
464
932
  }
465
- if (a.startsWith(i.callingCode)) {
466
- const o = a.slice(i.callingCode.length);
467
- if (l(o, i)) return `+${i.callingCode}${o}`;
933
+ if (a.startsWith(r.callingCode)) {
934
+ const s = a.slice(r.callingCode.length);
935
+ if (d(s, r)) return `+${r.callingCode}${s}`;
468
936
  }
469
- return !s && l(a, i) ? `+${i.callingCode}${a}` : null;
937
+ return !o && d(a, r) ? `+${r.callingCode}${a}` : null;
470
938
  }
471
- function Ge(e, n = 9) {
939
+ function yn(e, n = 9) {
472
940
  const t = (e ?? "").replace(/\D/g, "");
473
941
  return t.length < n ? null : t.slice(-n);
474
942
  }
475
- function M(e) {
943
+ function $(e) {
476
944
  if (!e) return null;
477
945
  const n = e.trim().toLowerCase(), t = n.lastIndexOf("@");
478
946
  if (t <= 0 || t === n.length - 1) return null;
479
- const r = n.slice(0, t).split("+")[0], a = n.slice(t + 1);
480
- return !r || !a.includes(".") ? null : `${r}@${a}`;
947
+ const i = n.slice(0, t).split("+")[0], a = n.slice(t + 1);
948
+ return !i || !a.includes(".") ? null : `${i}@${a}`;
481
949
  }
482
- function Ve(e) {
483
- const n = M(e);
950
+ function En(e) {
951
+ const n = $(e);
484
952
  return n ? n.slice(n.lastIndexOf("@") + 1) : null;
485
953
  }
486
- const W = /* @__PURE__ */ new Set([
954
+ const se = /* @__PURE__ */ new Set([
487
955
  "co.uk",
488
956
  "org.uk",
489
957
  "gov.uk",
@@ -493,14 +961,14 @@ const W = /* @__PURE__ */ new Set([
493
961
  "com.br",
494
962
  "co.za"
495
963
  ]);
496
- function j(e) {
964
+ function le(e) {
497
965
  if (!e) return null;
498
966
  const n = e.trim().toLowerCase().replace(/\.$/, "").split(".").filter(Boolean);
499
967
  if (n.length < 2) return null;
500
968
  const t = n.slice(-2).join(".");
501
- return W.has(t) && n.length >= 3 ? n.slice(-3).join(".") : t;
969
+ return se.has(t) && n.length >= 3 ? n.slice(-3).join(".") : t;
502
970
  }
503
- const K = /* @__PURE__ */ new Set([
971
+ const ce = /* @__PURE__ */ new Set([
504
972
  "gmail.com",
505
973
  "googlemail.com",
506
974
  "outlook.com",
@@ -545,34 +1013,34 @@ const K = /* @__PURE__ */ new Set([
545
1013
  "proximus.be",
546
1014
  "scarlet.be"
547
1015
  ]);
548
- function He(e) {
549
- const n = j(e);
550
- return n ? K.has(n) : !1;
1016
+ function bn(e) {
1017
+ const n = le(e);
1018
+ return n ? ce.has(n) : !1;
551
1019
  }
552
- function Be(e) {
1020
+ function An(e) {
553
1021
  if (!e) return !1;
554
1022
  const n = e.trim().toLowerCase();
555
1023
  return n === "tel" || n === "sms" || n === "whatsapp" || n === "fax";
556
1024
  }
557
- function Fe(e, n, t) {
1025
+ function In(e, n, t) {
558
1026
  if (!e || !n) return null;
559
- const r = e.trim().toLowerCase();
560
- if (r === "tel" || r === "sms" || r === "whatsapp") {
561
- const i = E(n, t);
562
- return i ? `tel:${i}` : null;
1027
+ const i = e.trim().toLowerCase();
1028
+ if (i === "tel" || i === "sms" || i === "whatsapp") {
1029
+ const r = N(n, t);
1030
+ return r ? `tel:${r}` : null;
563
1031
  }
564
- if (r === "fax") {
565
- const i = E(n, t);
566
- return i ? `fax:${i}` : null;
1032
+ if (i === "fax") {
1033
+ const r = N(n, t);
1034
+ return r ? `fax:${r}` : null;
567
1035
  }
568
- if (r === "mailto" || r === "email") {
569
- const i = M(n);
570
- return i ? `mailto:${i}` : null;
1036
+ if (i === "mailto" || i === "email") {
1037
+ const r = $(n);
1038
+ return r ? `mailto:${r}` : null;
571
1039
  }
572
1040
  const a = n.trim().toLowerCase();
573
- return a ? `${r}:${a}` : null;
1041
+ return a ? `${i}:${a}` : null;
574
1042
  }
575
- const Y = [
1043
+ const ue = [
576
1044
  /<blockquote/i,
577
1045
  /class="?gmail_quote/i,
578
1046
  // Gmail quote container
@@ -585,107 +1053,107 @@ const Y = [
585
1053
  // Outlook underscore separator before "From:"
586
1054
  /\bOn\b[\s\S]{0,200}?\bwrote:/i
587
1055
  // Gmail "On <date> <name> wrote:"
588
- ], m = /^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i, z = /^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;
589
- function q(e) {
1056
+ ], O = /^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i, pe = /^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;
1057
+ function de(e) {
590
1058
  const n = e.split(`
591
1059
  `);
592
1060
  for (let t = 0; t < n.length; t++)
593
- if (z.test(n[t]) || m.test(n[t]) && n.slice(t + 1, t + 4).some((r) => m.test(r)))
1061
+ if (pe.test(n[t]) || O.test(n[t]) && n.slice(t + 1, t + 4).some((i) => O.test(i)))
594
1062
  return n.slice(0, t).join(`
595
1063
  `).trim();
596
1064
  return e;
597
1065
  }
598
- function b(e) {
1066
+ function k(e) {
599
1067
  let n = e;
600
1068
  return n = n.replace(/<(script|style)[\s\S]*?<\/\1>/gi, ""), n = n.replace(/<br\s*\/?>/gi, `
601
1069
  `), n = n.replace(/<\/(p|div|li|tr|h[1-6]|ul|ol|table)>/gi, `
602
1070
  `), n = n.replace(/<[^>]+>/g, ""), n = n.replace(/<[^>]*$/, ""), n;
603
1071
  }
604
- function A(e) {
1072
+ function D(e) {
605
1073
  return e.replace(/&nbsp;/gi, " ").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&#39;/gi, "'").replace(/&#(\d+);/g, (n, t) => String.fromCharCode(Number(t))).replace(/&amp;/gi, "&");
606
1074
  }
607
- function I(e) {
1075
+ function L(e) {
608
1076
  return e.replace(/\r/g, "").replace(/[ \t]+/g, " ").replace(/ *\n */g, `
609
1077
  `).replace(/\n{3,}/g, `
610
1078
 
611
1079
  `).trim();
612
1080
  }
613
- function ve(e) {
1081
+ function _n(e) {
614
1082
  if (typeof e != "string" || !e) return "";
615
1083
  let n = e.length;
616
- for (const i of Y) {
617
- const s = e.search(i);
618
- s >= 0 && s < n && (n = s);
1084
+ for (const r of ue) {
1085
+ const o = e.search(r);
1086
+ o >= 0 && o < n && (n = o);
619
1087
  }
620
1088
  const t = e.slice(0, n);
621
- let r = I(A(b(t)));
622
- return r || (r = I(A(b(e)))), q(r) || r;
1089
+ let i = L(D(k(t)));
1090
+ return i || (i = L(D(k(e)))), de(i) || i;
623
1091
  }
624
- const X = /(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i, J = /\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;
625
- function We(e, n) {
626
- return !!(e && X.test(e) || n && J.test(n));
1092
+ const me = /(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i, fe = /\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;
1093
+ function Tn(e, n) {
1094
+ return !!(e && me.test(e) || n && fe.test(n));
627
1095
  }
628
- const Q = 3, Z = 600;
629
- function je(e, n) {
630
- return e >= Q || n >= Z;
1096
+ const ge = 3, he = 600;
1097
+ function Mn(e, n) {
1098
+ return e >= ge || n >= he;
631
1099
  }
632
- function ee(e, n) {
633
- const t = new Set(e.disabledIntents ?? []), r = e.intentOverrides ?? {}, a = n.intents.filter((s) => !t.has(s.intent)).map((s) => te(s, r[s.intent]));
1100
+ function ye(e, n) {
1101
+ const t = new Set(e.disabledIntents ?? []), i = e.intentOverrides ?? {}, a = n.intents.filter((o) => !t.has(o.intent)).map((o) => be(o, i[o.intent]));
634
1102
  if (!e.extraIntents || e.extraIntents.length === 0) return a;
635
- const i = new Set(a.map((s) => s.intent));
636
- for (const s of e.extraIntents)
637
- i.has(s.intent) || (a.push(s), i.add(s.intent));
1103
+ const r = new Set(a.map((o) => o.intent));
1104
+ for (const o of e.extraIntents)
1105
+ r.has(o.intent) || (a.push(o), r.add(o.intent));
638
1106
  return a;
639
1107
  }
640
- function ne(e, n) {
1108
+ function Ee(e, n) {
641
1109
  const t = {};
642
- for (const r of e.intents) {
643
- if (!r.togglable) continue;
644
- const a = n?.[r.intent];
645
- t[r.intent] = a ?? r.defaultEnabled ?? !0;
1110
+ for (const i of e.intents) {
1111
+ if (!i.togglable) continue;
1112
+ const a = n?.[i.intent];
1113
+ t[i.intent] = a ?? i.defaultEnabled ?? !0;
646
1114
  }
647
1115
  return t;
648
1116
  }
649
- function Ke(e, n) {
650
- const t = ne(e, n);
651
- return Object.entries(t).filter(([, r]) => !r).map(([r]) => r);
1117
+ function Sn(e, n) {
1118
+ const t = Ee(e, n);
1119
+ return Object.entries(t).filter(([, i]) => !i).map(([i]) => i);
652
1120
  }
653
- function te(e, n) {
1121
+ function be(e, n) {
654
1122
  return n ? {
655
1123
  intent: n.intent ?? e.intent,
656
1124
  targetSchemes: n.targetSchemes ?? e.targetSchemes,
657
1125
  transport: n.transport ?? e.transport
658
1126
  } : e;
659
1127
  }
660
- function Ye(e, n) {
1128
+ function Cn(e, n) {
661
1129
  const t = [];
662
- for (const r of e) {
663
- if (!r.enabled) continue;
664
- const a = n[r.providerId];
1130
+ for (const i of e) {
1131
+ if (!i.enabled) continue;
1132
+ const a = n[i.providerId];
665
1133
  if (a)
666
- for (const i of ee(r, a))
667
- t.push({ channel: r, description: a, capability: i });
1134
+ for (const r of ye(i, a))
1135
+ t.push({ channel: i, description: a, capability: r });
668
1136
  }
669
1137
  return t;
670
1138
  }
671
- function ze(e, n) {
1139
+ function vn(e, n) {
672
1140
  return n.filter((t) => t.capability.intent === e);
673
1141
  }
674
- function re(e, n) {
1142
+ function Ae(e, n) {
675
1143
  return n.filter((t) => t.capability.targetSchemes.includes(e));
676
1144
  }
677
- function qe(e, n) {
678
- return re(e.scheme, n);
1145
+ function Nn(e, n) {
1146
+ return Ae(e.scheme, n);
679
1147
  }
680
- function Xe(e, n, t) {
681
- const r = [];
1148
+ function On(e, n, t) {
1149
+ const i = [];
682
1150
  for (const a of e)
683
- for (const i of t)
684
- i.capability.intent === n && i.capability.targetSchemes.includes(a.scheme) && r.push({ channelIntent: i, endpoint: a });
685
- return r;
1151
+ for (const r of t)
1152
+ r.capability.intent === n && r.capability.targetSchemes.includes(a.scheme) && i.push({ channelIntent: r, endpoint: a });
1153
+ return i;
686
1154
  }
687
- var ae = /* @__PURE__ */ ((e) => (e.MAILTO = "mailto", e.SIP = "sip", e.TEL = "tel", e.WEBHOOK = "webhook", e.USERNAME = "username", e.ID = "id", e.CUSTOM = "custom", e.URL = "url", e.TELEGRAM = "telegram", e.WHATSAPP = "whatsapp", e.MESSENGER = "messenger", e.INSTAGRAM = "instagram", e.VIBER = "viber", e.SMS = "sms", e.FAX = "fax", e.TEAMS = "teams", e.CALENDAR = "calendar", e))(ae || {});
688
- const Je = "message_window", Qe = "message_templates", Ze = {
1155
+ var Ie = /* @__PURE__ */ ((e) => (e.MAILTO = "mailto", e.SIP = "sip", e.TEL = "tel", e.WEBHOOK = "webhook", e.USERNAME = "username", e.ID = "id", e.CUSTOM = "custom", e.URL = "url", e.TELEGRAM = "telegram", e.WHATSAPP = "whatsapp", e.MESSENGER = "messenger", e.INSTAGRAM = "instagram", e.VIBER = "viber", e.SMS = "sms", e.FAX = "fax", e.TEAMS = "teams", e.CALENDAR = "calendar", e))(Ie || {});
1156
+ const kn = "message_window", Dn = "message_templates", Ln = {
689
1157
  // E-mail
690
1158
  FROM: "from",
691
1159
  TO: "to",
@@ -702,88 +1170,110 @@ const Je = "message_window", Qe = "message_templates", Ze = {
702
1170
  // Voice/conference
703
1171
  HOST: "host",
704
1172
  PARTICIPANT: "participant"
705
- }, en = (e, n) => ({ intent: e, ...n }), nn = "folder_management", tn = "remote_search", rn = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" }, an = 9e4, sn = "installation-id";
1173
+ }, Rn = (e, n) => ({ intent: e, ...n }), $n = "folder_management", xn = "remote_search", Un = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" }, Pn = 9e4, wn = "installation-id";
706
1174
  export {
707
- _ as AI_VENDORS,
708
- ge as CLASSIFY_VARS,
709
- le as CORE_DIMENSIONS,
710
- ae as CommunicationScheme,
711
- Pe as DEFAULT_MEMORY_BUDGET,
712
- V as DEFAULT_PHONE_REGION,
713
- nn as FEATURE_FOLDER_MANAGEMENT,
714
- tn as FEATURE_REMOTE_SEARCH,
715
- sn as INSTALLATION_HEADER,
716
- Ze as InteractionParticipantRole,
717
- Ue as MAX_MEMORY_BUDGET,
718
- ke as MAX_MEMORY_CHARS,
719
- xe as MIN_MEMORY_BUDGET,
720
- P as PAUSED_RUN_STATUSES,
721
- p as PHONE_REGIONS,
722
- an as PRESENCE_ONLINE_WINDOW_MS,
723
- Qe as PROVIDER_FEATURE_MESSAGE_TEMPLATES,
724
- Je as PROVIDER_FEATURE_MESSAGE_WINDOW,
725
- K as PUBLIC_EMAIL_DOMAINS,
726
- G as RELATED_SUBJECT_KINDS,
727
- he as SIGNATURE_INTENTS,
728
- Z as SUMMARY_MIN_LAST_CHARS,
729
- Q as SUMMARY_MIN_MESSAGES,
730
- U as TERMINAL_RUN_STATUSES,
731
- fe as TRIGGER_VARS,
732
- rn as UNSUPPORTED,
733
- L as USAGE_DIMENSIONS,
734
- R as USAGE_DIMENSION_IDS,
735
- x as actingIdentityKey,
736
- oe as activityTimestamp,
737
- be as actorKey,
738
- Me as aiVendorDefaultModel,
739
- _e as aiVendorLabel,
740
- Te as aiVendorNeedsBaseUrl,
741
- Se as aiVendorsWith,
742
- De as applySignature,
743
- ie as buildActivityPreview,
744
- Ye as buildChannelIntents,
745
- ve as cleanMessageText,
746
- en as defineIntent,
747
- Ke as disabledIntentsFromCapabilities,
748
- Ve as emailDomain,
749
- Fe as endpointKey,
750
- qe as filterByEndpoint,
751
- ze as filterByIntent,
752
- re as filterByTargetScheme,
753
- d as findAiVendor,
754
- ce as flattenLocales,
755
- C as floorToPeriod,
756
- k as formatActingIdentity,
757
- D as formatPeriod,
758
- se as getActivitySeenUserIds,
759
- Ce as getContactEndpoints,
760
- Re as getShortTitle,
761
- Le as getUrgencyScore,
762
- pe as humanizeAction,
763
- Oe as isAssigned,
764
- Ne as isClosed,
765
- ye as isInteractionUnseen,
766
- We as isLikelyBulk,
767
- Ie as isPaused,
768
- He as isPublicEmailDomain,
769
- Ae as isRetryable,
770
- $ as isTerminal,
771
- je as isThreadLongEnough,
772
- we as looksLikeEmail,
773
- Xe as matchContactToIntents,
774
- Be as needsPhoneRegion,
775
- M as normalizeEmail,
776
- Ee as parseActingIdentity,
777
- ue as periodsInRange,
778
- Ge as phoneSuffix,
779
- me as playbookActor,
780
- j as registrableDomain,
781
- $e as relatedByDefault,
782
- ne as resolveAccountCapabilities,
783
- ee as resolveChannelIntents,
784
- w as resolveSignature,
785
- S as stripHtml,
786
- E as toE164,
787
- y as usageMetricId,
788
- de as usageMetrics
1175
+ c as ACTIVITY_CATALOG,
1176
+ R as AI_VENDORS,
1177
+ G as ActivityTypeRegistry,
1178
+ Ue as BUILT_IN_ONLY,
1179
+ Xe as CLASSIFY_VARS,
1180
+ Ge as CORE_DIMENSIONS,
1181
+ Ie as CommunicationScheme,
1182
+ fn as DEFAULT_MEMORY_BUDGET,
1183
+ te as DEFAULT_PHONE_REGION,
1184
+ $n as FEATURE_FOLDER_MANAGEMENT,
1185
+ xn as FEATURE_REMOTE_SEARCH,
1186
+ wn as INSTALLATION_HEADER,
1187
+ Ln as InteractionParticipantRole,
1188
+ Se as MAX_ACTIONS,
1189
+ _e as MAX_BLOCKS,
1190
+ Te as MAX_FIELDS,
1191
+ Me as MAX_LIST_ITEMS,
1192
+ mn as MAX_MEMORY_BUDGET,
1193
+ pn as MAX_MEMORY_CHARS,
1194
+ dn as MIN_MEMORY_BUDGET,
1195
+ Q as PAUSED_RUN_STATUSES,
1196
+ b as PHONE_REGIONS,
1197
+ Pn as PRESENCE_ONLINE_WINDOW_MS,
1198
+ Dn as PROVIDER_FEATURE_MESSAGE_TEMPLATES,
1199
+ kn as PROVIDER_FEATURE_MESSAGE_WINDOW,
1200
+ ce as PUBLIC_EMAIL_DOMAINS,
1201
+ ne as RELATED_SUBJECT_KINDS,
1202
+ tn as SIGNATURE_INTENTS,
1203
+ he as SUMMARY_MIN_LAST_CHARS,
1204
+ ge as SUMMARY_MIN_MESSAGES,
1205
+ J as TERMINAL_RUN_STATUSES,
1206
+ Fe as TRIGGER_VARS,
1207
+ Un as UNSUPPORTED,
1208
+ X as USAGE_DIMENSIONS,
1209
+ W as USAGE_DIMENSION_IDS,
1210
+ q as actingIdentityKey,
1211
+ ve as activityIconOf,
1212
+ xe as activityJoinUrl,
1213
+ P as activitySnippet,
1214
+ w as activityTextParams,
1215
+ $e as activityTimelineText,
1216
+ Ke as activityTimestamp,
1217
+ l as activityTypeInfo,
1218
+ ze as actorKey,
1219
+ Ze as aiVendorDefaultModel,
1220
+ Qe as aiVendorLabel,
1221
+ nn as aiVendorNeedsBaseUrl,
1222
+ en as aiVendorsWith,
1223
+ an as applySignature,
1224
+ Pe as buildActivityPreview,
1225
+ Cn as buildChannelIntents,
1226
+ De as carriesText,
1227
+ Ne as channelKindOf,
1228
+ _n as cleanMessageText,
1229
+ Rn as defineIntent,
1230
+ Sn as disabledIntentsFromCapabilities,
1231
+ En as emailDomain,
1232
+ In as endpointKey,
1233
+ Nn as filterByEndpoint,
1234
+ vn as filterByIntent,
1235
+ Ae as filterByTargetScheme,
1236
+ E as findAiVendor,
1237
+ Ve as flattenLocales,
1238
+ B as floorToPeriod,
1239
+ z as formatActingIdentity,
1240
+ H as formatPeriod,
1241
+ we as getActivitySeenUserIds,
1242
+ rn as getContactEndpoints,
1243
+ cn as getShortTitle,
1244
+ ln as getUrgencyScore,
1245
+ je as humanizeAction,
1246
+ on as isAssigned,
1247
+ sn as isClosed,
1248
+ un as isInteractionUnseen,
1249
+ Tn as isLikelyBulk,
1250
+ Oe as isMessageType,
1251
+ Je as isPaused,
1252
+ Re as isPlaybookAuthoredType,
1253
+ bn as isPublicEmailDomain,
1254
+ ke as isReplyableType,
1255
+ qe as isRetryable,
1256
+ Z as isTerminal,
1257
+ Mn as isThreadLongEnough,
1258
+ hn as looksLikeEmail,
1259
+ On as matchContactToIntents,
1260
+ Le as messageCountsAs,
1261
+ An as needsPhoneRegion,
1262
+ Ce as normalizeBlocks,
1263
+ $ as normalizeEmail,
1264
+ We as parseActingIdentity,
1265
+ He as periodsInRange,
1266
+ yn as phoneSuffix,
1267
+ Ye as playbookActor,
1268
+ h as readPath,
1269
+ le as registrableDomain,
1270
+ gn as relatedByDefault,
1271
+ Ee as resolveAccountCapabilities,
1272
+ y as resolveActivityText,
1273
+ ye as resolveChannelIntents,
1274
+ ee as resolveSignature,
1275
+ U as stripHtml,
1276
+ N as toE164,
1277
+ Y as usageMetricId,
1278
+ Be as usageMetrics
789
1279
  };