widget-chatbot 1.0.5 → 2.0.0-alpha.2

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.
@@ -0,0 +1,3614 @@
1
+ import { jsx as t, jsxs as h, Fragment as Q } from "react/jsx-runtime";
2
+ import ye from "axios";
3
+ import { version as pn, createContext as de, useContext as ue, useState as _, useRef as B, useMemo as L, useEffect as W, memo as S, Children as Dn, isValidElement as On, cloneElement as Nn, Fragment as He, createElement as $e, useCallback as Mn } from "react";
4
+ import j from "dayjs";
5
+ import { version as Rn, Modal as Je, Typography as F, Button as R, Form as J, notification as ce, Radio as Fn, Divider as Hn, Input as Ee, Image as Bn, Skeleton as P, Avatar as tn, Upload as on, Tooltip as me, Tag as $n, Badge as In, Grid as ne, Empty as cn, Popover as Ie, Mentions as Xe, Select as je, DatePicker as Un, Result as Wn, Tabs as Oe } from "antd";
6
+ import { io as Vn } from "socket.io-client";
7
+ import zn from "react-markdown";
8
+ import Gn from "remark-gfm";
9
+ import { Prism as Kn } from "react-syntax-highlighter";
10
+ import Yn from "@ant-design/icons";
11
+ import { Pie as qn } from "@ant-design/plots";
12
+ import fe from "crypto-js";
13
+ import Qn from "@emoji-mart/react";
14
+ const Zn = "2.0.0-alpha.1", sn = "chat_session", Jn = "user_uttered", Xn = "bot_uttered", jn = "ehelp_bot_uttered", Pn = "https://sfchatbot.dataon.com", et = [
15
+ {
16
+ label: "Didn’t address my question",
17
+ value: "Didn’t address my question"
18
+ },
19
+ {
20
+ label: "Inaccurate Answer",
21
+ value: "Inaccurate Answer"
22
+ },
23
+ {
24
+ label: "The response unclear",
25
+ value: "The response unclear"
26
+ },
27
+ {
28
+ label: "The information is incomplete",
29
+ value: "The information is incomplete"
30
+ },
31
+ {
32
+ label: "I’d like to explain further",
33
+ value: "another"
34
+ }
35
+ ], Te = Rn, be = pn, nt = Zn, tt = "https://sfchatbot.dataon.com/openai-service-dev/", ve = "https://res.cloudinary.com/dcvolkyfb/image/upload/v1740135794/svg/bot_profile_hlnyop.png", Ue = "YYYY-MM-DD", _e = "HH:mm", Pe = "N/A", Ne = [
36
+ // Raster (bitmap)
37
+ ".jpg",
38
+ ".jpeg",
39
+ ".png",
40
+ ".gif",
41
+ ".bmp",
42
+ ".tiff",
43
+ ".tif",
44
+ ".webp",
45
+ ".heif",
46
+ ".heic",
47
+ ".jp2",
48
+ ".ico",
49
+ ".dds",
50
+ ".raw",
51
+ ".cr2",
52
+ ".nef",
53
+ ".arw",
54
+ ".orf",
55
+ ".psd",
56
+ ".xcf"
57
+ ], Me = "w-widget-content-container", Re = "w-ticket-detail-content-container", ot = "w-wrapper-body", ct = "w-wrapper-body-helpdesk", ke = "w-header", Fe = {
58
+ FADE_IN: "w-fade-in-animate"
59
+ }, st = "https://placehold.co/600x400?text=No+Image", Ae = 3, lt = "GoHRDev2025WorkPlazeDataOnDotCom", ge = "(Helpdesk Widget Chatbot)", it = (e) => JSON.parse((e == null ? void 0 : e.replaceAll("/get_started", "")) || "{}"), ln = (e) => {
60
+ var n;
61
+ try {
62
+ return (n = new URL(e)) == null ? void 0 : n.host;
63
+ } catch {
64
+ return ln(Pn);
65
+ }
66
+ }, X = (e, n) => {
67
+ var o, c, l;
68
+ return ((o = Object.keys(e || {})) == null ? void 0 : o.length) > 0 ? (l = (c = Object == null ? void 0 : Object.prototype) == null ? void 0 : c.hasOwnProperty) == null ? void 0 : l.call(e, n) : !1;
69
+ }, Ce = (e) => {
70
+ var o;
71
+ const n = e == null ? void 0 : e.attachment;
72
+ return {
73
+ text: ((o = Object.keys(e || {})) == null ? void 0 : o.length) > 0 && (e == null ? void 0 : e.type) === "text",
74
+ upload: X(e, "attachment") && X(n, "type") && (n == null ? void 0 : n.type) === "fileuploader",
75
+ password: (n == null ? void 0 : n.type) === "show_password_wp",
76
+ filedownload: X(n, "type") && (n == null ? void 0 : n.type) === "filedownloader",
77
+ chart: (n == null ? void 0 : n.type) === "charts" && X(n, "chartType")
78
+ };
79
+ }, rn = (e) => {
80
+ var n, o, c, l;
81
+ if (e) {
82
+ const i = e == null ? void 0 : e.split(".")[1], s = (n = i == null ? void 0 : i.replace(/-/g, "+")) == null ? void 0 : n.replace(/_/g, "/"), r = decodeURIComponent(
83
+ (l = (c = (o = window == null ? void 0 : window.atob(s)) == null ? void 0 : o.split("")) == null ? void 0 : c.map((a) => "%" + ("00" + a.charCodeAt(0).toString(16)).slice(-2))) == null ? void 0 : l.join("")
84
+ );
85
+ return JSON == null ? void 0 : JSON.parse(r || "{}");
86
+ }
87
+ return {};
88
+ }, We = ({
89
+ downloadURL: e = "",
90
+ fileName: n = "",
91
+ isOpenNewTab: o = !1
92
+ }) => {
93
+ var l;
94
+ const c = document == null ? void 0 : document.createElement("a");
95
+ c.href = e, c.download = n || e, o && (c.target = "_blank"), (l = document == null ? void 0 : document.body) == null || l.appendChild(c), c.click(), document.body.removeChild(c);
96
+ }, rt = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
97
+ const n = crypto.getRandomValues(new Uint8Array(1))[0] % 16;
98
+ return (e === "x" ? n : n & 3 | 8).toString(16);
99
+ }), Ve = ({
100
+ ArrObj: e,
101
+ key: n,
102
+ ignoreCaseSensitive: o = !1
103
+ }) => (e == null ? void 0 : e.length) > 0 ? [
104
+ ...new Map(
105
+ e.map((c) => {
106
+ var l;
107
+ return [
108
+ o ? (l = String(c[n])) == null ? void 0 : l.toLowerCase() : c[n],
109
+ c
110
+ ];
111
+ })
112
+ ).values()
113
+ ] : [], at = (e = []) => {
114
+ const n = {}, o = [], c = [];
115
+ e == null || e.forEach((i) => {
116
+ var s;
117
+ X(i, "chats") ? (s = i == null ? void 0 : i.chats) == null || s.forEach((r) => {
118
+ c == null || c.push(r);
119
+ }) : c == null || c.push(i);
120
+ }), c == null || c.forEach((i, s) => {
121
+ var a, d, f;
122
+ const r = i == null ? void 0 : i.generated_id;
123
+ r ? (n[r] || (n[r] = []), (d = n[r]) == null || d.push({
124
+ ...i,
125
+ indexChat: s,
126
+ ...!(i != null && i.timestamp) && {
127
+ timestamp: (a = j()) == null ? void 0 : a.format("hh:mm A")
128
+ }
129
+ }), o == null || o.push({
130
+ keyItem: r ?? s,
131
+ type: "text",
132
+ sender: "response",
133
+ ...r && {
134
+ generated_id: r
135
+ },
136
+ chats: n == null ? void 0 : n[r]
137
+ })) : o == null || o.push({
138
+ ...i,
139
+ keyItem: s,
140
+ ...!(i != null && i.timestamp) && {
141
+ timestamp: (f = j()) == null ? void 0 : f.format("hh:mm A")
142
+ }
143
+ });
144
+ });
145
+ const l = Ve({ ArrObj: o, key: "keyItem" });
146
+ return l == null || l.forEach((i) => {
147
+ i == null || delete i.keyItem;
148
+ }), l;
149
+ }, pe = (e = {}) => {
150
+ const o = {
151
+ ...an(),
152
+ ...e
153
+ };
154
+ localStorage == null || localStorage.setItem(sn, JSON.stringify(o || {}));
155
+ }, an = () => {
156
+ const e = localStorage == null ? void 0 : localStorage.getItem(sn);
157
+ return JSON.parse(e || "{}");
158
+ }, dt = (e = "") => {
159
+ var n;
160
+ try {
161
+ const o = new URL(e);
162
+ return (n = o == null ? void 0 : o.protocol) != null && n.includes("https") ? "wss" : "ws";
163
+ } catch {
164
+ return "wss";
165
+ }
166
+ };
167
+ let en = null;
168
+ const se = (e = ".w-wrapper-body") => {
169
+ const n = document.querySelector(e);
170
+ clearTimeout(en), en = setTimeout(() => {
171
+ n && n.scrollTo({
172
+ top: n.scrollHeight,
173
+ behavior: "smooth"
174
+ });
175
+ }, 0);
176
+ }, ut = (e) => {
177
+ const n = new Uint8Array(e);
178
+ let o = "";
179
+ for (let c = 0; c < n.byteLength; c++)
180
+ o += String.fromCharCode(n[c]);
181
+ return btoa(o);
182
+ }, ft = async (e, n) => {
183
+ var a;
184
+ const o = typeof e == "object" ? JSON == null ? void 0 : JSON.stringify(e || {}) : e, c = new TextEncoder(), l = c == null ? void 0 : c.encode(o), i = c == null ? void 0 : c.encode(n);
185
+ if (i.length !== 32)
186
+ throw new Error("Key length must be 32 bytes for AES-256");
187
+ const s = await ((a = crypto == null ? void 0 : crypto.subtle) == null ? void 0 : a.importKey(
188
+ "raw",
189
+ i,
190
+ { name: "AES-CBC" },
191
+ !1,
192
+ ["encrypt"]
193
+ )), r = await crypto.subtle.encrypt(
194
+ { name: "AES-CBC", iv: new Uint8Array(16) },
195
+ s,
196
+ l
197
+ );
198
+ return ut(r);
199
+ }, Le = (e) => {
200
+ const n = {}, o = dn(e), c = o == null ? void 0 : o.map((l) => {
201
+ var s;
202
+ const i = l == null ? void 0 : l.CREATED_DATE;
203
+ return {
204
+ ...l,
205
+ DATE_KEY: (s = j(i)) == null ? void 0 : s.format("YYYY-MM-DD")
206
+ };
207
+ });
208
+ return c == null || c.forEach((l) => {
209
+ var i;
210
+ n[l == null ? void 0 : l.DATE_KEY] || (n[l == null ? void 0 : l.DATE_KEY] = []), (i = n[l == null ? void 0 : l.DATE_KEY]) == null || i.push(l);
211
+ }), n;
212
+ }, ze = (e) => {
213
+ var n;
214
+ return (n = Object.values(e || {})) == null ? void 0 : n.flat();
215
+ }, dn = (e) => e == null ? void 0 : e.sort((n, o) => j(n == null ? void 0 : n.CREATED_DATE) - j(o == null ? void 0 : o.CREATED_DATE)), un = (e) => {
216
+ if (e && typeof e == "string") {
217
+ const n = e == null ? void 0 : e.split("."), o = n[(n == null ? void 0 : n.length) - 1];
218
+ return e == null ? void 0 : e.replaceAll(`.${o}`, `_avatar.${o}`);
219
+ }
220
+ return e;
221
+ }, Ge = (e) => `https://ui-avatars.com/api/?background=e5e5e5&color=000${e && typeof e == "string" ? `&name=${e.replaceAll(" ", "+")}` : ""}`, fn = de({}), I = () => ue(fn), gt = ({
222
+ children: e,
223
+ getStartedPayload: n,
224
+ socketURL: o,
225
+ socketPath: c,
226
+ onPayslipFn: l,
227
+ title: i,
228
+ subTitle: s,
229
+ keyEncrypt: r,
230
+ history: a,
231
+ isSF: d
232
+ }) => {
233
+ const [f, C] = _(!1), [T, b] = _("va"), [k, x] = _(!1), [E, w] = _({}), [g, u] = _(!1), [m, y] = _(!1), p = B(!1), D = L(() => ({
234
+ getStartedPayload: n,
235
+ socketURL: o,
236
+ socketPath: c,
237
+ onPayslipFn: l,
238
+ title: i,
239
+ subTitle: s,
240
+ keyEncrypt: r,
241
+ isSF: d
242
+ }), [
243
+ n,
244
+ o,
245
+ c,
246
+ l,
247
+ i,
248
+ s,
249
+ r,
250
+ d
251
+ ]), O = L(() => rn(E == null ? void 0 : E.access_token), [E == null ? void 0 : E.access_token]);
252
+ return W(() => {
253
+ w(it(n));
254
+ }, [n]), W(() => {
255
+ pe({
256
+ chatbot_version: nt
257
+ });
258
+ }, []), /* @__PURE__ */ t(
259
+ fn.Provider,
260
+ {
261
+ value: {
262
+ objInitPayload: E,
263
+ setOpenWidget: C,
264
+ isOpenWidget: f,
265
+ activeTab: T,
266
+ setActiveTab: b,
267
+ isExpand: k,
268
+ setExpand: x,
269
+ setObjInitPayload: w,
270
+ parsedJWT: O,
271
+ widgetProps: D,
272
+ isFirstOpenWidget: g,
273
+ setFirstOpenWidget: u,
274
+ isFirstRenderHelpdesk: p,
275
+ history: a,
276
+ showReadyWSHD: m,
277
+ setShowReadyWSHD: y
278
+ },
279
+ children: e
280
+ }
281
+ );
282
+ }, gn = de({}), Ct = () => ue(gn), mt = ({ children: e }) => {
283
+ const { objInitPayload: n } = I(), [o, c] = _({}), l = () => {
284
+ var s;
285
+ (s = ye(
286
+ `${(n == null ? void 0 : n.uriService) || tt}optional/translations`
287
+ )) == null || s.then(({ data: r }) => {
288
+ var a;
289
+ if (r) {
290
+ const d = Object.keys((a = Object.values(r)) == null ? void 0 : a[0]), f = {};
291
+ d == null || d.forEach((C) => {
292
+ var T;
293
+ (T = Object.keys(r)) == null || T.forEach((b) => {
294
+ var k;
295
+ f[C == null ? void 0 : C.toLowerCase()] = (k = r == null ? void 0 : r[b]) == null ? void 0 : k[C];
296
+ });
297
+ }), c(f);
298
+ }
299
+ });
300
+ }, i = () => {
301
+ const s = window.indexedDB.open("language");
302
+ s.onsuccess = (r) => {
303
+ var d;
304
+ const a = r.target.result;
305
+ try {
306
+ const C = a.transaction("keyvaluepairs", "readonly").objectStore("keyvaluepairs"), T = C == null ? void 0 : C.get((d = n == null ? void 0 : n.lang) == null ? void 0 : d.toLowerCase());
307
+ T.onsuccess = () => {
308
+ c(T == null ? void 0 : T.result);
309
+ }, T.onerror = () => {
310
+ l();
311
+ };
312
+ } catch {
313
+ l();
314
+ }
315
+ }, s.onerror = () => {
316
+ l();
317
+ };
318
+ };
319
+ return W(() => {
320
+ i();
321
+ }, [n == null ? void 0 : n.uriService, n == null ? void 0 : n.lang]), /* @__PURE__ */ t(gn.Provider, { value: { langDatas: o }, children: e });
322
+ }, Cn = de({}), ee = () => ue(Cn), Tt = ({ children: e }) => {
323
+ var H;
324
+ const [n, o] = _([]), [c, l] = _(!1), [i, s] = _(!1), [r, a] = _({}), [d, f] = _(!1), [C, T] = _(!1), {
325
+ objInitPayload: b,
326
+ widgetProps: k,
327
+ setOpenWidget: x,
328
+ setFirstOpenWidget: E,
329
+ isFirstRenderHelpdesk: w
330
+ } = I(), g = B(null), u = B(""), m = B(""), y = (v) => {
331
+ const N = X(v, "text_feedback_link") && X(v, "text");
332
+ o((z) => {
333
+ const M = [
334
+ ...z,
335
+ {
336
+ ...v,
337
+ ...N && {
338
+ type: "text"
339
+ },
340
+ sender: "response"
341
+ }
342
+ ];
343
+ return at(M);
344
+ }), l(!1), s(!1), se();
345
+ }, p = () => {
346
+ var v, N, z, M;
347
+ (v = g == null ? void 0 : g.current) == null || v.emit("session_request", { session_id: null }), (N = g == null ? void 0 : g.current) == null || N.on("session_confirm", ($) => {
348
+ u.current = $, pe({
349
+ session_id: $ == null ? void 0 : $.session_id
350
+ });
351
+ }), (z = g == null ? void 0 : g.current) == null || z.on(Xn, y), (M = g == null ? void 0 : g.current) == null || M.on(jn, ($) => {
352
+ const G = JSON.parse($ || "{}");
353
+ X(G, "iswidget") && T(G == null ? void 0 : G.iswidget);
354
+ }), d || f(!0), E(!1);
355
+ }, D = ({
356
+ msg: v,
357
+ additionalConfig: N = {},
358
+ isShowLoadingResponse: z = !0
359
+ }) => {
360
+ var M;
361
+ (M = g == null ? void 0 : g.current) == null || M.emit(Jn, {
362
+ customData: {
363
+ language: b == null ? void 0 : b.lang
364
+ },
365
+ message: v,
366
+ session_id: u == null ? void 0 : u.current,
367
+ ...N
368
+ }), z ? l(!0) : s(!0);
369
+ }, O = () => {
370
+ var N, z;
371
+ g.current && ((N = g == null ? void 0 : g.current) == null || N.off(), (z = g == null ? void 0 : g.current) == null || z.disconnect(), g.current = null), w.current = !1;
372
+ const v = Vn(
373
+ `${dt(k == null ? void 0 : k.socketURL)}://${ln(
374
+ k == null ? void 0 : k.socketURL
375
+ )}`,
376
+ {
377
+ path: k == null ? void 0 : k.socketPath,
378
+ transports: ["websocket"],
379
+ reconnection: !0,
380
+ reconnectionAttempts: 1
381
+ }
382
+ );
383
+ v.on("connect", p), v.on("connect_error", (M) => {
384
+ console.error("connect_error widget-chatbot : ", {
385
+ err: M,
386
+ socketURL: k == null ? void 0 : k.socketURL,
387
+ socketPath: k == null ? void 0 : k.widgetProps
388
+ });
389
+ }), v.io.on("reconnect", () => {
390
+ console.error("reconnect widget-chatbot : ", {
391
+ socketURL: k == null ? void 0 : k.socketURL,
392
+ socketPath: k == null ? void 0 : k.widgetProps
393
+ });
394
+ }), g.current = v;
395
+ }, V = () => {
396
+ var v;
397
+ (!((v = g == null ? void 0 : g.current) != null && v.connected) || !d) && (O(), x(!1));
398
+ }, U = () => {
399
+ f(!1);
400
+ };
401
+ return W(() => (x(!1), O(), window.addEventListener("online", V), window.addEventListener("offline", U), () => {
402
+ var v, N;
403
+ g.current && ((v = g.current) == null || v.off("connect", p), (N = g.current) == null || N.disconnect(), g.current = null), window.removeEventListener("online", V), window.removeEventListener("offline", U);
404
+ }), [
405
+ JSON.stringify(b || {}),
406
+ k == null ? void 0 : k.socketURL,
407
+ k == null ? void 0 : k.socketPath
408
+ ]), /* @__PURE__ */ t(
409
+ Cn.Provider,
410
+ {
411
+ value: {
412
+ setChats: o,
413
+ chats: n,
414
+ onSendMsg: D,
415
+ isWaitResponse: c,
416
+ socket: g == null ? void 0 : g.current,
417
+ sessionId: (H = u == null ? void 0 : u.current) == null ? void 0 : H.session_id,
418
+ loadingRegenerate: i,
419
+ file: r,
420
+ setFile: a,
421
+ connected: d,
422
+ isHandshakeWidget: C,
423
+ createSocket: O,
424
+ currRegenerateId: m
425
+ },
426
+ children: e
427
+ }
428
+ );
429
+ }, bt = {
430
+ 'pre[class*="language-"]': {
431
+ color: "#d4d4d4",
432
+ fontSize: "13px",
433
+ textShadow: "none",
434
+ fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
435
+ direction: "ltr",
436
+ textAlign: "left",
437
+ whiteSpace: "pre",
438
+ wordSpacing: "normal",
439
+ wordBreak: "normal",
440
+ lineHeight: "1.5",
441
+ MozTabSize: "4",
442
+ OTabSize: "4",
443
+ tabSize: "4",
444
+ WebkitHyphens: "none",
445
+ MozHyphens: "none",
446
+ msHyphens: "none",
447
+ hyphens: "none",
448
+ padding: "1em",
449
+ margin: ".5em 0",
450
+ overflow: "auto",
451
+ background: "#1e1e1e"
452
+ },
453
+ 'code[class*="language-"]': {
454
+ color: "#d4d4d4",
455
+ fontSize: "13px",
456
+ textShadow: "none",
457
+ fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
458
+ direction: "ltr",
459
+ textAlign: "left",
460
+ whiteSpace: "pre",
461
+ wordSpacing: "normal",
462
+ wordBreak: "normal",
463
+ lineHeight: "1.5",
464
+ MozTabSize: "4",
465
+ OTabSize: "4",
466
+ tabSize: "4",
467
+ WebkitHyphens: "none",
468
+ MozHyphens: "none",
469
+ msHyphens: "none",
470
+ hyphens: "none"
471
+ },
472
+ 'pre[class*="language-"]::selection': {
473
+ textShadow: "none",
474
+ background: "#264F78"
475
+ },
476
+ 'code[class*="language-"]::selection': {
477
+ textShadow: "none",
478
+ background: "#264F78"
479
+ },
480
+ 'pre[class*="language-"] *::selection': {
481
+ textShadow: "none",
482
+ background: "#264F78"
483
+ },
484
+ 'code[class*="language-"] *::selection': {
485
+ textShadow: "none",
486
+ background: "#264F78"
487
+ },
488
+ ':not(pre) > code[class*="language-"]': {
489
+ padding: ".1em .3em",
490
+ borderRadius: ".3em",
491
+ color: "#db4c69",
492
+ background: "#1e1e1e"
493
+ },
494
+ ".namespace": {
495
+ Opacity: ".7"
496
+ },
497
+ "doctype.doctype-tag": {
498
+ color: "#569CD6"
499
+ },
500
+ "doctype.name": {
501
+ color: "#9cdcfe"
502
+ },
503
+ comment: {
504
+ color: "#6a9955"
505
+ },
506
+ prolog: {
507
+ color: "#6a9955"
508
+ },
509
+ punctuation: {
510
+ color: "#d4d4d4"
511
+ },
512
+ ".language-html .language-css .token.punctuation": {
513
+ color: "#d4d4d4"
514
+ },
515
+ ".language-html .language-javascript .token.punctuation": {
516
+ color: "#d4d4d4"
517
+ },
518
+ property: {
519
+ color: "#9cdcfe"
520
+ },
521
+ tag: {
522
+ color: "#569cd6"
523
+ },
524
+ boolean: {
525
+ color: "#569cd6"
526
+ },
527
+ number: {
528
+ color: "#b5cea8"
529
+ },
530
+ constant: {
531
+ color: "#9cdcfe"
532
+ },
533
+ symbol: {
534
+ color: "#b5cea8"
535
+ },
536
+ inserted: {
537
+ color: "#b5cea8"
538
+ },
539
+ unit: {
540
+ color: "#b5cea8"
541
+ },
542
+ selector: {
543
+ color: "#d7ba7d"
544
+ },
545
+ "attr-name": {
546
+ color: "#9cdcfe"
547
+ },
548
+ string: {
549
+ color: "#ce9178"
550
+ },
551
+ char: {
552
+ color: "#ce9178"
553
+ },
554
+ builtin: {
555
+ color: "#ce9178"
556
+ },
557
+ deleted: {
558
+ color: "#ce9178"
559
+ },
560
+ ".language-css .token.string.url": {
561
+ textDecoration: "underline"
562
+ },
563
+ operator: {
564
+ color: "#d4d4d4"
565
+ },
566
+ entity: {
567
+ color: "#569cd6"
568
+ },
569
+ "operator.arrow": {
570
+ color: "#569CD6"
571
+ },
572
+ atrule: {
573
+ color: "#ce9178"
574
+ },
575
+ "atrule.rule": {
576
+ color: "#c586c0"
577
+ },
578
+ "atrule.url": {
579
+ color: "#9cdcfe"
580
+ },
581
+ "atrule.url.function": {
582
+ color: "#dcdcaa"
583
+ },
584
+ "atrule.url.punctuation": {
585
+ color: "#d4d4d4"
586
+ },
587
+ keyword: {
588
+ color: "#569CD6"
589
+ },
590
+ "keyword.module": {
591
+ color: "#c586c0"
592
+ },
593
+ "keyword.control-flow": {
594
+ color: "#c586c0"
595
+ },
596
+ function: {
597
+ color: "#dcdcaa"
598
+ },
599
+ "function.maybe-class-name": {
600
+ color: "#dcdcaa"
601
+ },
602
+ regex: {
603
+ color: "#d16969"
604
+ },
605
+ important: {
606
+ color: "#569cd6"
607
+ },
608
+ italic: {
609
+ fontStyle: "italic"
610
+ },
611
+ "class-name": {
612
+ color: "#4ec9b0"
613
+ },
614
+ "maybe-class-name": {
615
+ color: "#4ec9b0"
616
+ },
617
+ console: {
618
+ color: "#9cdcfe"
619
+ },
620
+ parameter: {
621
+ color: "#9cdcfe"
622
+ },
623
+ interpolation: {
624
+ color: "#9cdcfe"
625
+ },
626
+ "punctuation.interpolation-punctuation": {
627
+ color: "#569cd6"
628
+ },
629
+ variable: {
630
+ color: "#9cdcfe"
631
+ },
632
+ "imports.maybe-class-name": {
633
+ color: "#9cdcfe"
634
+ },
635
+ "exports.maybe-class-name": {
636
+ color: "#9cdcfe"
637
+ },
638
+ escape: {
639
+ color: "#d7ba7d"
640
+ },
641
+ "tag.punctuation": {
642
+ color: "#808080"
643
+ },
644
+ cdata: {
645
+ color: "#808080"
646
+ },
647
+ "attr-value": {
648
+ color: "#ce9178"
649
+ },
650
+ "attr-value.punctuation": {
651
+ color: "#ce9178"
652
+ },
653
+ "attr-value.punctuation.attr-equals": {
654
+ color: "#d4d4d4"
655
+ },
656
+ namespace: {
657
+ color: "#4ec9b0"
658
+ },
659
+ 'pre[class*="language-javascript"]': {
660
+ color: "#9cdcfe"
661
+ },
662
+ 'code[class*="language-javascript"]': {
663
+ color: "#9cdcfe"
664
+ },
665
+ 'pre[class*="language-jsx"]': {
666
+ color: "#9cdcfe"
667
+ },
668
+ 'code[class*="language-jsx"]': {
669
+ color: "#9cdcfe"
670
+ },
671
+ 'pre[class*="language-typescript"]': {
672
+ color: "#9cdcfe"
673
+ },
674
+ 'code[class*="language-typescript"]': {
675
+ color: "#9cdcfe"
676
+ },
677
+ 'pre[class*="language-tsx"]': {
678
+ color: "#9cdcfe"
679
+ },
680
+ 'code[class*="language-tsx"]': {
681
+ color: "#9cdcfe"
682
+ },
683
+ 'pre[class*="language-css"]': {
684
+ color: "#ce9178"
685
+ },
686
+ 'code[class*="language-css"]': {
687
+ color: "#ce9178"
688
+ },
689
+ 'pre[class*="language-html"]': {
690
+ color: "#d4d4d4"
691
+ },
692
+ 'code[class*="language-html"]': {
693
+ color: "#d4d4d4"
694
+ },
695
+ ".language-regex .token.anchor": {
696
+ color: "#dcdcaa"
697
+ },
698
+ ".language-html .token.punctuation": {
699
+ color: "#808080"
700
+ },
701
+ 'pre[class*="language-"] > code[class*="language-"]': {
702
+ position: "relative",
703
+ zIndex: "1"
704
+ },
705
+ ".line-highlight.line-highlight": {
706
+ background: "#f7ebc6",
707
+ boxShadow: "inset 5px 0 0 #f7d87c",
708
+ zIndex: "0"
709
+ }
710
+ }, yt = (e) => e.replace(/[^a-zA-Z0-9_]/g, "").trim(), A = (e = "", n) => {
711
+ var s;
712
+ const { langDatas: o } = Ct(), c = localStorage == null ? void 0 : localStorage.getItem("show_text_id"), l = yt(String(e)), i = (o == null ? void 0 : o[l == null ? void 0 : l.toUpperCase()]) || n;
713
+ return ((s = Object.keys(o || {})) == null ? void 0 : s.length) > 0 ? c ? `WPUI_${l}` : i : n;
714
+ }, ht = ({ isFeedback: e = !1, open: n, ...o }) => {
715
+ var l;
716
+ const c = L(() => e ? "w-modal-container-feedback" : "", [e]);
717
+ return Te != null && Te.startsWith("5") ? /* @__PURE__ */ t(
718
+ Je,
719
+ {
720
+ rootClassName: c,
721
+ ...o,
722
+ open: n,
723
+ getContainer: "#w-widget-content",
724
+ maskProps: {
725
+ style: {
726
+ backdropFilter: "blur(4px)"
727
+ }
728
+ },
729
+ width: 300,
730
+ style: {
731
+ ...Object.keys((o == null ? void 0 : o.style) || {}).length > 0 && {
732
+ ...o == null ? void 0 : o.style
733
+ },
734
+ top: 20
735
+ }
736
+ }
737
+ ) : (
738
+ // <div className={rootClassName}>
739
+ /* @__PURE__ */ t(
740
+ Je,
741
+ {
742
+ getContainer: "#w-widget-content",
743
+ width: 300,
744
+ ...o,
745
+ ...be != null && be.startsWith("18") ? {
746
+ open: n
747
+ } : { visible: n },
748
+ maskStyle: {
749
+ backdropFilter: "blur(4x)",
750
+ ...((l = Object.keys((o == null ? void 0 : o.maskStyle) || {})) == null ? void 0 : l.length) > 0 && {
751
+ ...o == null ? void 0 : o.maskStyle
752
+ }
753
+ },
754
+ style: {
755
+ ...Object.keys((o == null ? void 0 : o.style) || {}).length > 0 && {
756
+ ...o == null ? void 0 : o.style
757
+ },
758
+ top: 20
759
+ }
760
+ }
761
+ )
762
+ );
763
+ }, mn = S(ht), nn = ({ props: e, isModal: n = !1 }) => {
764
+ const o = (c, l) => {
765
+ var i;
766
+ return (i = Dn) == null ? void 0 : i.map(c, (s) => {
767
+ var r, a, d;
768
+ return !On(s) || ((r = Object.keys((s == null ? void 0 : s.props) || {})) == null ? void 0 : r.length) === 0 ? s : Nn(s, {
769
+ ...s == null ? void 0 : s.props,
770
+ ...(s == null ? void 0 : s.type) === "thead" && {
771
+ className: "ant-table-thead"
772
+ },
773
+ ...((s == null ? void 0 : s.type) === "th" || (s == null ? void 0 : s.type) === "td") && {
774
+ className: "ant-table-cell",
775
+ ...(s == null ? void 0 : s.type) === "th" && {
776
+ style: {
777
+ background: "var(--primary-color, #395ebc)",
778
+ color: "#ffffff",
779
+ minWidth: 180
780
+ }
781
+ }
782
+ },
783
+ ...s.type === "tr" && l === "tbody" && {
784
+ className: "ant-table-row"
785
+ },
786
+ ...(s == null ? void 0 : s.type) === "tbody" && {
787
+ className: "ant-table-tbody"
788
+ },
789
+ children: (a = s == null ? void 0 : s.props) != null && a.children ? o((d = s == null ? void 0 : s.props) == null ? void 0 : d.children, s == null ? void 0 : s.type) : s == null ? void 0 : s.props
790
+ });
791
+ });
792
+ };
793
+ return /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ t("div", { className: "ant-table", children: /* @__PURE__ */ t("div", { className: "ant-table-container", children: /* @__PURE__ */ t(
794
+ "div",
795
+ {
796
+ className: "ant-table-content",
797
+ style: {
798
+ overflow: "scroll",
799
+ maxWidth: n ? "100%" : 330,
800
+ maxHeight: n ? "100%" : 360
801
+ },
802
+ children: /* @__PURE__ */ t("table", { className: "wp-md-table", ...e, children: o(e == null ? void 0 : e.children, "") })
803
+ }
804
+ ) }) }) });
805
+ }, kt = ({ children: e }) => {
806
+ const n = A(
807
+ "OpenDetailTable",
808
+ "Open Detail Table"
809
+ ), o = A("TableDetail", "Tabel Detail"), [c, l] = _(!1);
810
+ return /* @__PURE__ */ t(zn, { remarkPlugins: [Gn], components: {
811
+ table: ({ ...s }) => /* @__PURE__ */ h(Q, { children: [
812
+ /* @__PURE__ */ t(nn, { props: s }),
813
+ /* @__PURE__ */ t(
814
+ "div",
815
+ {
816
+ style: {
817
+ display: "flex",
818
+ justifyContent: "center",
819
+ padding: "5px 0px 10px 0px"
820
+ },
821
+ children: /* @__PURE__ */ t(
822
+ R,
823
+ {
824
+ onClick: () => {
825
+ l(!0);
826
+ },
827
+ children: n
828
+ }
829
+ )
830
+ }
831
+ ),
832
+ /* @__PURE__ */ t(
833
+ mn,
834
+ {
835
+ getContainer: () => document.body,
836
+ footer: null,
837
+ title: o,
838
+ width: 800,
839
+ open: c,
840
+ onCancel: () => {
841
+ l(!1);
842
+ },
843
+ children: /* @__PURE__ */ t(nn, { props: s, isModal: !0 })
844
+ }
845
+ )
846
+ ] }),
847
+ code: ({ ...s }) => {
848
+ const { children: r, className: a, ...d } = s, f = /language-(\w+)/.exec(a || "");
849
+ return f ? /* @__PURE__ */ t(
850
+ Kn,
851
+ {
852
+ ...d,
853
+ PreTag: "div",
854
+ language: f[1],
855
+ style: bt,
856
+ children: String(r).replace(/\n$/, "")
857
+ }
858
+ ) : /* @__PURE__ */ t(F.Text, { code: !0, children: s == null ? void 0 : s.children });
859
+ }
860
+ }, children: e });
861
+ }, Tn = S(kt), At = () => /* @__PURE__ */ t(
862
+ "svg",
863
+ {
864
+ width: "24",
865
+ height: "24",
866
+ viewBox: "0 0 24 24",
867
+ fill: "none",
868
+ xmlns: "http://www.w3.org/2000/svg",
869
+ children: /* @__PURE__ */ t(
870
+ "path",
871
+ {
872
+ fillRule: "evenodd",
873
+ clipRule: "evenodd",
874
+ d: "M5.25 4.5H18.75C19.5 4.5 19.5 5.44772 19.5 6V18C19.5 18.5523 19.5 19.5 18.75 19.5H5.25C4.5 19.5 4.5 18.5523 4.5 18V6C4.5 5.44772 4.5 4.5 5.25 4.5ZM3 6C3 4.34315 4.34315 3 6 3H18C19.6569 3 21 4.34315 21 6V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V6ZM17 17V15.75H7V17H17Z",
875
+ fill: "white"
876
+ }
877
+ )
878
+ }
879
+ ), wt = () => /* @__PURE__ */ t(
880
+ "svg",
881
+ {
882
+ width: "24",
883
+ height: "24",
884
+ viewBox: "0 0 24 24",
885
+ fill: "none",
886
+ xmlns: "http://www.w3.org/2000/svg",
887
+ style: { transform: "rotate(0deg)", transition: "300ms" },
888
+ children: /* @__PURE__ */ t(
889
+ "path",
890
+ {
891
+ d: "M11.325 21H5.175C3.9735 21 3 20.0265 3 18.825V5.175C3 3.9735 3.9735 3 5.175 3H18.825C20.0265 3 21 3.9735 21 5.175V18.825C21 20.0265 20.0265 21 18.825 21H11.325ZM4.35 5.175V12H9.825C11.0265 12 12 12.9735 12 14.175V19.65H18.825C19.281 19.65 19.65 19.281 19.65 18.825V5.175C19.65 4.71975 19.281 4.35 18.825 4.35H5.175C4.71975 4.35 4.35 4.719 4.35 5.175V5.175ZM4.35 18.825C4.35 19.281 4.719 19.65 5.175 19.65H10.65V14.175C10.65 13.719 10.281 13.35 9.825 13.35H4.35V18.825ZM12.4882 11.5117C12.366 11.3895 12.2902 11.2207 12.2902 11.034C12.2902 10.8472 12.366 10.6785 12.4882 10.5562L15.9863 7.059H14.364C13.9913 7.059 13.689 6.75675 13.689 6.384C13.689 6.01125 13.9913 5.709 14.364 5.709H17.616C17.709 5.709 17.7975 5.7285 17.8785 5.763L17.874 5.7615C17.958 5.79675 18.0293 5.8455 18.09 5.90475C18.1508 5.9655 18.1995 6.03825 18.2333 6.11925L18.2347 6.12375C18.2677 6.1995 18.2872 6.28875 18.2872 6.38175V9.633C18.2872 10.0057 17.985 10.308 17.6122 10.308C17.2395 10.308 16.9373 10.0057 16.9373 9.633V8.0115L13.4393 11.5095C13.317 11.631 13.1483 11.7068 12.9623 11.7068C12.7778 11.7068 12.6105 11.6325 12.489 11.5125L12.4882 11.5117Z",
892
+ fill: "white"
893
+ }
894
+ )
895
+ }
896
+ ), Et = () => /* @__PURE__ */ h(
897
+ "svg",
898
+ {
899
+ viewBox: "64 64 896 896",
900
+ focusable: "false",
901
+ width: "14",
902
+ height: "14",
903
+ "aria-hidden": "true",
904
+ fill: "white",
905
+ children: [
906
+ /* @__PURE__ */ t("defs", { children: /* @__PURE__ */ t("style", {}) }),
907
+ /* @__PURE__ */ t("path", { d: "M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z" })
908
+ ]
909
+ }
910
+ ), St = () => /* @__PURE__ */ h(
911
+ "svg",
912
+ {
913
+ viewBox: "-2.4 -2.4 28.80 28.80",
914
+ fill: "none",
915
+ xmlns: "http://www.w3.org/2000/svg",
916
+ children: [
917
+ /* @__PURE__ */ t("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
918
+ /* @__PURE__ */ t(
919
+ "g",
920
+ {
921
+ id: "SVGRepo_tracerCarrier",
922
+ strokeLinecap: "round",
923
+ strokeLinejoin: "round"
924
+ }
925
+ ),
926
+ /* @__PURE__ */ t("g", { id: "SVGRepo_iconCarrier", children: /* @__PURE__ */ t(
927
+ "path",
928
+ {
929
+ fillRule: "evenodd",
930
+ clipRule: "evenodd",
931
+ d: "M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM8.58579 8.58579C8 9.17157 8 10.1144 8 12C8 13.8856 8 14.8284 8.58579 15.4142C9.17157 16 10.1144 16 12 16C13.8856 16 14.8284 16 15.4142 15.4142C16 14.8284 16 13.8856 16 12C16 10.1144 16 9.17157 15.4142 8.58579C14.8284 8 13.8856 8 12 8C10.1144 8 9.17157 8 8.58579 8.58579Z",
932
+ fill: "rgb(57, 94, 188)"
933
+ }
934
+ ) })
935
+ ]
936
+ }
937
+ ), xt = () => /* @__PURE__ */ t("span", { role: "img", "aria-label": "sync", className: "anticon anticon-sync", children: /* @__PURE__ */ t(
938
+ "svg",
939
+ {
940
+ viewBox: "64 64 896 896",
941
+ focusable: "false",
942
+ width: "1em",
943
+ height: "1em",
944
+ fill: "currentColor",
945
+ "aria-hidden": "true",
946
+ children: /* @__PURE__ */ t("path", { d: "M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 01755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 01512.1 856a342.24 342.24 0 01-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 00-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 00-8-8.2z" })
947
+ }
948
+ ) }), Lt = () => /* @__PURE__ */ t("span", { role: "img", "aria-label": "left", className: "anticon anticon-left", children: /* @__PURE__ */ t(
949
+ "svg",
950
+ {
951
+ viewBox: "64 64 896 896",
952
+ focusable: "false",
953
+ width: "1em",
954
+ height: "1em",
955
+ fill: "currentColor",
956
+ "aria-hidden": "true",
957
+ children: /* @__PURE__ */ t("path", { d: "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" })
958
+ }
959
+ ) }), vt = () => /* @__PURE__ */ t("span", { role: "img", "aria-label": "right", className: "anticon anticon-right", children: /* @__PURE__ */ t(
960
+ "svg",
961
+ {
962
+ viewBox: "64 64 896 896",
963
+ focusable: "false",
964
+ width: "1em",
965
+ height: "1em",
966
+ fill: "currentColor",
967
+ "aria-hidden": "true",
968
+ children: /* @__PURE__ */ t("path", { d: "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" })
969
+ }
970
+ ) }), _t = ({ ...e }) => /* @__PURE__ */ t("span", { role: "img", "aria-label": "like", className: "anticon anticon-like", children: /* @__PURE__ */ h(
971
+ "svg",
972
+ {
973
+ viewBox: "64 64 896 896",
974
+ focusable: "false",
975
+ "data-icon": "like",
976
+ width: "1em",
977
+ height: "1em",
978
+ fill: "currentColor",
979
+ "aria-hidden": "true",
980
+ children: [
981
+ /* @__PURE__ */ t(
982
+ "path",
983
+ {
984
+ d: "M273 495.9v428l.3-428zm538.2-88.3H496.8l9.6-198.4c.6-11.9-4.7-23.1-14.6-30.5-6.1-4.5-13.6-6.8-21.1-6.7-19.6.1-36.9 13.4-42.2 32.3-37.1 134.4-64.9 235.2-83.5 302.5V852h399.4a56.85 56.85 0 0033.6-51.8c0-9.7-2.3-18.9-6.9-27.3l-13.9-25.4 21.9-19a56.76 56.76 0 0019.6-43c0-9.7-2.3-18.9-6.9-27.3l-13.9-25.4 21.9-19a56.76 56.76 0 0019.6-43c0-9.7-2.3-18.9-6.9-27.3l-14-25.5 21.9-19a56.76 56.76 0 0019.6-43c0-19.1-11-37.5-28.8-48.4z",
985
+ fill: (e == null ? void 0 : e.feedback) === "like" ? "green" : "#fff"
986
+ }
987
+ ),
988
+ /* @__PURE__ */ t(
989
+ "path",
990
+ {
991
+ d: "M112 528v364c0 17.7 14.3 32 32 32h65V496h-65c-17.7 0-32 14.3-32 32zm773.9 5.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.5-65.5-111a67.67 67.67 0 00-34.3-9.3H572.3l6-122.9c1.5-29.7-9-57.9-29.5-79.4a106.4 106.4 0 00-77.9-33.4c-52 0-98 35-111.8 85.1l-85.8 310.8-.3 428h472.1c9.3 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37zM820.4 499l-21.9 19 14 25.5a56.2 56.2 0 016.9 27.3c0 16.5-7.1 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 016.9 27.3c0 16.5-7.1 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 016.9 27.3c0 22.4-13.2 42.6-33.6 51.8H345V506.8c18.6-67.2 46.4-168 83.5-302.5a44.28 44.28 0 0142.2-32.3c7.5-.1 15 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.1 32.2-19.6 43z",
992
+ fill: (e == null ? void 0 : e.feedback) === "like" ? "green" : "black"
993
+ }
994
+ )
995
+ ]
996
+ }
997
+ ) }), pt = ({ ...e }) => /* @__PURE__ */ t("span", { role: "img", "aria-label": "dislike", className: "anticon anticon-dislike", children: /* @__PURE__ */ h(
998
+ "svg",
999
+ {
1000
+ viewBox: "64 64 896 896",
1001
+ focusable: "false",
1002
+ "data-icon": "dislike",
1003
+ width: "1em",
1004
+ height: "1em",
1005
+ fill: "currentColor",
1006
+ "aria-hidden": "true",
1007
+ children: [
1008
+ /* @__PURE__ */ t(
1009
+ "path",
1010
+ {
1011
+ d: "M273 100.1v428h.3l-.3-428zM820.4 525l-21.9-19 14-25.5a56.2 56.2 0 006.9-27.3c0-16.5-7.1-32.2-19.6-43l-21.9-19 13.9-25.4a56.2 56.2 0 006.9-27.3c0-16.5-7.1-32.2-19.6-43l-21.9-19 13.9-25.4a56.2 56.2 0 006.9-27.3c0-22.4-13.2-42.6-33.6-51.8H345v345.2c18.6 67.2 46.4 168 83.5 302.5a44.28 44.28 0 0042.2 32.3c7.5.1 15-2.2 21.1-6.7 9.9-7.4 15.2-18.6 14.6-30.5l-9.6-198.4h314.4C829 605.5 840 587.1 840 568c0-16.5-7.1-32.2-19.6-43z",
1012
+ fill: (e == null ? void 0 : e.feedback) === "dislike" ? "red" : "#fff"
1013
+ }
1014
+ ),
1015
+ /* @__PURE__ */ t(
1016
+ "path",
1017
+ {
1018
+ d: "M112 132v364c0 17.7 14.3 32 32 32h65V100h-65c-17.7 0-32 14.3-32 32zm773.9 358.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 00-26.5-5.4H273l.3 428 85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zm-74.7 126.1H496.8l9.6 198.4c.6 11.9-4.7 23.1-14.6 30.5-6.1 4.5-13.6 6.8-21.1 6.7a44.28 44.28 0 01-42.2-32.3c-37.1-134.4-64.9-235.2-83.5-302.5V172h399.4a56.85 56.85 0 0133.6 51.8c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0119.6 43c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0119.6 43c0 9.7-2.3 18.9-6.9 27.3l-14 25.5 21.9 19a56.76 56.76 0 0119.6 43c0 19.1-11 37.5-28.8 48.4z",
1019
+ fill: (e == null ? void 0 : e.feedback) === "dislike" ? "red" : "black"
1020
+ }
1021
+ )
1022
+ ]
1023
+ }
1024
+ ) }), Dt = () => /* @__PURE__ */ t("span", { role: "img", "aria-label": "delete", className: "anticon anticon-delete", children: /* @__PURE__ */ t(
1025
+ "svg",
1026
+ {
1027
+ viewBox: "64 64 896 896",
1028
+ focusable: "false",
1029
+ width: "1em",
1030
+ height: "1em",
1031
+ fill: "currentColor",
1032
+ "aria-hidden": "true",
1033
+ children: /* @__PURE__ */ t("path", { d: "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" })
1034
+ }
1035
+ ) }), Ot = () => /* @__PURE__ */ t("span", { role: "img", "aria-label": "close", className: "anticon anticon-close", children: /* @__PURE__ */ t(
1036
+ "svg",
1037
+ {
1038
+ fillRule: "evenodd",
1039
+ viewBox: "64 64 896 896",
1040
+ focusable: "false",
1041
+ "data-icon": "close",
1042
+ width: "1em",
1043
+ height: "1em",
1044
+ fill: "currentColor",
1045
+ "aria-hidden": "true",
1046
+ children: /* @__PURE__ */ t("path", { d: "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" })
1047
+ }
1048
+ ) }), Nt = () => /* @__PURE__ */ t("span", { role: "img", "aria-label": "upload", className: "anticon anticon-upload", children: /* @__PURE__ */ t(
1049
+ "svg",
1050
+ {
1051
+ viewBox: "64 64 896 896",
1052
+ focusable: "false",
1053
+ width: "1em",
1054
+ height: "1em",
1055
+ fill: "currentColor",
1056
+ "aria-hidden": "true",
1057
+ children: /* @__PURE__ */ t("path", { d: "M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" })
1058
+ }
1059
+ ) }), Mt = () => /* @__PURE__ */ t("span", { role: "img", "aria-label": "filter", className: "anticon anticon-filter", children: /* @__PURE__ */ t(
1060
+ "svg",
1061
+ {
1062
+ viewBox: "64 64 896 896",
1063
+ focusable: "false",
1064
+ width: "1em",
1065
+ height: "1em",
1066
+ fill: "currentColor",
1067
+ "aria-hidden": "true",
1068
+ children: /* @__PURE__ */ t("path", { d: "M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z" })
1069
+ }
1070
+ ) }), Rt = () => /* @__PURE__ */ t("span", { role: "img", "aria-label": "down", className: "anticon anticon-down", children: /* @__PURE__ */ t(
1071
+ "svg",
1072
+ {
1073
+ viewBox: "64 64 896 896",
1074
+ focusable: "false",
1075
+ width: "1em",
1076
+ height: "1em",
1077
+ fill: "currentColor",
1078
+ "aria-hidden": "true",
1079
+ children: /* @__PURE__ */ t("path", { d: "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" })
1080
+ }
1081
+ ) }), Ft = () => /* @__PURE__ */ t(
1082
+ "span",
1083
+ {
1084
+ role: "img",
1085
+ "aria-label": "paper-clip",
1086
+ className: "anticon anticon-paper-clip",
1087
+ children: /* @__PURE__ */ t(
1088
+ "svg",
1089
+ {
1090
+ viewBox: "64 64 896 896",
1091
+ focusable: "false",
1092
+ width: "1em",
1093
+ height: "1em",
1094
+ fill: "currentColor",
1095
+ "aria-hidden": "true",
1096
+ children: /* @__PURE__ */ t("path", { d: "M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z" })
1097
+ }
1098
+ )
1099
+ }
1100
+ ), Ht = () => /* @__PURE__ */ t(
1101
+ "svg",
1102
+ {
1103
+ xmlns: "http://www.w3.org/2000/svg",
1104
+ width: "18",
1105
+ height: "18",
1106
+ viewBox: "0 0 32 32",
1107
+ fill: "none",
1108
+ children: /* @__PURE__ */ t(
1109
+ "path",
1110
+ {
1111
+ d: "M13.083 1C10.9876 0.99919 8.92848 1.54638 7.10994 2.58726C5.2914 3.62814 3.7767 5.12652 2.71618 6.93367C1.65565 8.74083 1.08618 10.7939 1.06429 12.8892C1.0424 14.9844 1.56884 17.0489 2.59138 18.8778L1.12189 22.7262C0.999579 23.0461 0.968553 23.3937 1.03227 23.7303C1.096 24.0668 1.25196 24.379 1.48276 24.632C1.71356 24.885 2.01013 25.069 2.33938 25.1633C2.66863 25.2576 3.0176 25.2586 3.34738 25.1661L7.94438 23.8778C9.57274 24.6472 11.3532 25.0407 13.1542 25.0291C14.9551 25.0176 16.7304 24.6013 18.3488 23.8111C19.9671 23.0209 21.3871 21.8769 22.5038 20.4639C23.6204 19.0509 24.4051 17.4049 24.7998 15.6477C25.1944 13.8905 25.189 12.0671 24.7839 10.3122C24.3788 8.5574 23.5844 6.9161 22.4595 5.50971C21.3345 4.10332 19.9077 2.96783 18.2847 2.18722C16.6617 1.40662 14.8839 1.00088 13.083 1ZM13.0682 8.21066C12.4064 8.34005 11.6819 8.76888 11.1126 9.77442C11.0526 9.88001 10.9724 9.97275 10.8766 10.0474C10.7808 10.122 10.6713 10.177 10.5542 10.2092C10.4372 10.2415 10.3149 10.2504 10.1944 10.2354C10.0739 10.2204 9.95753 10.1819 9.85194 10.1219C9.74635 10.062 9.6536 9.98179 9.57899 9.88599C9.50439 9.79019 9.44938 9.68064 9.41711 9.56358C9.38484 9.44652 9.37594 9.32425 9.39093 9.20375C9.40591 9.08326 9.44448 8.96689 9.50444 8.8613C10.3196 7.42693 11.4785 6.63766 12.7133 6.39737C13.8622 6.18019 15.0505 6.41957 16.0256 7.06464C16.9203 7.65613 17.643 8.62285 17.6652 9.78181C17.6892 10.9925 16.9535 12.0849 15.5968 12.8871C14.6763 13.4306 14.3177 13.8003 14.1643 14.0461C14.0349 14.2531 14.0072 14.4417 14.0072 14.8631C14.0072 15.1082 13.9098 15.3433 13.7365 15.5166C13.5632 15.6899 13.3281 15.7873 13.083 15.7873C12.8379 15.7873 12.6028 15.6899 12.4295 15.5166C12.2561 15.3433 12.1588 15.1082 12.1588 14.8631C12.1588 14.3603 12.1846 13.7356 12.5968 13.0701C12.985 12.4472 13.6486 11.8927 14.6578 11.2957C15.6467 10.7097 15.826 10.1533 15.8205 9.82062C15.8131 9.438 15.558 8.97035 15.0072 8.60622C14.4369 8.22892 13.7426 8.08716 13.07 8.21066H13.0682ZM13.5432 20.4083C13.1755 20.4083 12.8229 20.2623 12.563 20.0023C12.303 19.7423 12.1569 19.3897 12.1569 19.022C12.1569 18.6544 12.303 18.3017 12.563 18.0418C12.8229 17.7818 13.1755 17.6357 13.5432 17.6357C13.9109 17.6357 14.2635 17.7818 14.5235 18.0418C14.7835 18.3017 14.9295 18.6544 14.9295 19.022C14.9295 19.3897 14.7835 19.7423 14.5235 20.0023C14.2635 20.2623 13.9109 20.4083 13.5432 20.4083ZM9.45084 26.3972C10.5776 27.7093 11.975 28.762 13.547 29.4831C15.119 30.2042 16.8285 30.5765 18.558 30.5746C20.3934 30.5746 22.1365 30.1624 23.6966 29.423L28.2917 30.7114C28.6215 30.8038 28.9705 30.8028 29.2997 30.7085C29.629 30.6142 29.9255 30.4303 30.1563 30.1772C30.3871 29.9242 30.5431 29.612 30.6068 29.2755C30.6705 28.939 30.6395 28.5914 30.5172 28.2715L29.0477 24.4231C30.05 22.6316 30.5751 20.6127 30.5726 18.5599C30.5726 14.974 29.0015 11.7541 26.508 9.5526C26.7814 10.6172 26.9272 11.7105 26.9424 12.8095C28.0662 14.4454 28.7242 16.4269 28.7242 18.5599C28.7242 20.5008 28.1808 22.314 27.2363 23.8575L26.9997 24.2456L28.7926 28.9314L23.5062 27.4526L23.1827 27.6153C21.7964 28.3251 20.2252 28.7262 18.558 28.7262C16.4617 28.7294 14.4162 28.0816 12.704 26.8722C11.6046 26.8435 10.5126 26.684 9.45084 26.3972Z",
1112
+ fill: "white"
1113
+ }
1114
+ )
1115
+ }
1116
+ ), Bt = () => /* @__PURE__ */ t("span", { role: "img", "aria-label": "smile", className: "anticon anticon-smile", children: /* @__PURE__ */ t(
1117
+ "svg",
1118
+ {
1119
+ viewBox: "64 64 896 896",
1120
+ focusable: "false",
1121
+ width: "1em",
1122
+ height: "1em",
1123
+ fill: "currentColor",
1124
+ "aria-hidden": "true",
1125
+ children: /* @__PURE__ */ t("path", { d: "M288 421a48 48 0 1096 0 48 48 0 10-96 0zm352 0a48 48 0 1096 0 48 48 0 10-96 0zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm263 711c-34.2 34.2-74 61-118.3 79.8C611 874.2 562.3 884 512 884c-50.3 0-99-9.8-144.8-29.2A370.4 370.4 0 01248.9 775c-34.2-34.2-61-74-79.8-118.3C149.8 611 140 562.3 140 512s9.8-99 29.2-144.8A370.4 370.4 0 01249 248.9c34.2-34.2 74-61 118.3-79.8C413 149.8 461.7 140 512 140c50.3 0 99 9.8 144.8 29.2A370.4 370.4 0 01775.1 249c34.2 34.2 61 74 79.8 118.3C874.2 413 884 461.7 884 512s-9.8 99-29.2 144.8A368.89 368.89 0 01775 775zM664 533h-48.1c-4.2 0-7.8 3.2-8.1 7.4C604 589.9 562.5 629 512 629s-92.1-39.1-95.8-88.6c-.3-4.2-3.9-7.4-8.1-7.4H360a8 8 0 00-8 8.4c4.4 84.3 74.5 151.6 160 151.6s155.6-67.3 160-151.6a8 8 0 00-8-8.4z" })
1126
+ }
1127
+ ) }), $t = () => /* @__PURE__ */ t("span", { role: "img", "aria-label": "file", className: "anticon anticon-file", children: /* @__PURE__ */ t(
1128
+ "svg",
1129
+ {
1130
+ viewBox: "64 64 896 896",
1131
+ focusable: "false",
1132
+ width: 24,
1133
+ height: 24,
1134
+ fill: "currentColor",
1135
+ "aria-hidden": "true",
1136
+ children: /* @__PURE__ */ t("path", { d: "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z" })
1137
+ }
1138
+ ) }), It = ({ ...e }) => /* @__PURE__ */ t("span", { role: "img", "aria-label": "loading", ...e, children: /* @__PURE__ */ t(
1139
+ "svg",
1140
+ {
1141
+ viewBox: "0 0 1024 1024",
1142
+ focusable: "false",
1143
+ "data-icon": "loading",
1144
+ width: 52,
1145
+ height: 52,
1146
+ fill: "currentColor",
1147
+ "aria-hidden": "true",
1148
+ children: /* @__PURE__ */ t("path", { d: "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" })
1149
+ }
1150
+ ) }), K = ({ type: e = "", chatProps: n, ...o }) => {
1151
+ const c = L(() => ({
1152
+ minimize: At,
1153
+ expand: wt,
1154
+ send: Et,
1155
+ stop: St,
1156
+ sync: xt,
1157
+ left: Lt,
1158
+ right: vt,
1159
+ like: () => /* @__PURE__ */ t(_t, { ...n }),
1160
+ dislike: () => /* @__PURE__ */ t(pt, { ...n }),
1161
+ delete: Dt,
1162
+ close: Ot,
1163
+ upload: Nt,
1164
+ filter: Mt,
1165
+ down: Rt,
1166
+ "paper-clip": Ft,
1167
+ "chat-bubble": Ht,
1168
+ smile: Bt,
1169
+ file: $t,
1170
+ loading: () => /* @__PURE__ */ t(It, { ...o })
1171
+ }), [e, n]);
1172
+ return /* @__PURE__ */ t(Yn, { component: c == null ? void 0 : c[e], ...o });
1173
+ }, bn = de({}), le = () => ue(bn), Ut = ({ children: e }) => {
1174
+ const [n, o] = _("va"), c = L(() => n === "va", [n]);
1175
+ return /* @__PURE__ */ t(
1176
+ bn.Provider,
1177
+ {
1178
+ value: {
1179
+ activeTab: n,
1180
+ setActiveTab: o,
1181
+ isActiveTabVA: c
1182
+ },
1183
+ children: e
1184
+ }
1185
+ );
1186
+ }, Wt = ({ ...e }) => {
1187
+ const n = A(
1188
+ "WeLoveToHearAboutYourExperienceWithTheSunfishChatbot",
1189
+ "We'd love to hear about your experience with the Sunfish chatbot"
1190
+ ), o = A(
1191
+ "ShareAnyCommentsOrSuggestionsToHelpUsImprove",
1192
+ "Share any comments or suggestions to help us improve"
1193
+ ), c = A("Submit", "Submit"), l = A(
1194
+ "ThankFeedback",
1195
+ "Thank You for your feedback"
1196
+ ), i = A(
1197
+ "AdditionalFeedback",
1198
+ "Additional Feedback"
1199
+ ), [s] = J.useForm(), [r, a] = _(!1), [d, f] = _(""), { setChats: C } = ee(), { objInitPayload: T } = I(), { activeTab: b } = le(), k = L(() => {
1200
+ var u;
1201
+ const g = X(e, "feedback") ? (e == null ? void 0 : e.feedback) === "like" || (e == null ? void 0 : e.feedback) === "" : !0;
1202
+ return typeof (e == null ? void 0 : e.text_thumbsup_link) == "string" && ((u = e == null ? void 0 : e.text_thumbsup_link) == null ? void 0 : u.trim()) !== "" && g;
1203
+ }, [e]), x = L(() => {
1204
+ var u;
1205
+ const g = X(e, "feedback") ? (e == null ? void 0 : e.feedback) === "dislike" || (e == null ? void 0 : e.feedback) === "" : !0;
1206
+ return typeof (e == null ? void 0 : e.text_thumbsdown_link) == "string" && ((u = e == null ? void 0 : e.text_thumbsdown_link) == null ? void 0 : u.trim()) !== "" && g;
1207
+ }, [e]), E = L(() => {
1208
+ if (T != null && T.uriBackend)
1209
+ try {
1210
+ return new URL(T.uriBackend).origin;
1211
+ } catch {
1212
+ return "";
1213
+ }
1214
+ return "";
1215
+ }, [T == null ? void 0 : T.uriBackend]), w = (g) => {
1216
+ var H;
1217
+ const u = g === "like" ? e == null ? void 0 : e.text_thumbsup_link : e == null ? void 0 : e.text_thumbsdown_link, {
1218
+ access_token: m = "",
1219
+ companycode: y = "",
1220
+ companyid: p = "",
1221
+ uriBackend: D = "",
1222
+ uriBackendEnt: O = "",
1223
+ lang: V = ""
1224
+ } = T || {}, U = d === "another" ? s == null ? void 0 : s.getFieldValue("ADDITIONAL_FEEDBACK") : d;
1225
+ (H = ye({
1226
+ method: "POST",
1227
+ url: u,
1228
+ data: {
1229
+ message_id: e == null ? void 0 : e.id,
1230
+ response_type: g === "like" ? "up" : "down",
1231
+ ...g === "dislike" && {
1232
+ additional_feedback: U
1233
+ }
1234
+ },
1235
+ headers: {
1236
+ "Content-Type": "application/json",
1237
+ Authorization: `Bearer ${m}`,
1238
+ "company-code": `${y}`,
1239
+ "company-id": `${p}`,
1240
+ uriBackend: `${D}`,
1241
+ uriBackendEnt: `${O}`,
1242
+ "custom-origin": `${E}`,
1243
+ "Acc-Name": `${y.toUpperCase()}`,
1244
+ Language: `${V}`
1245
+ }
1246
+ })) == null || H.then((v) => {
1247
+ var N, z, M;
1248
+ (v == null ? void 0 : v.status) === 200 && (r && a(!1), (N = ce) == null || N.destroy(), (z = ce) == null || z.config({
1249
+ getContainer: () => document.querySelector(".w-widget-content-container"),
1250
+ top: 28,
1251
+ placement: "top",
1252
+ duration: 3
1253
+ }), (M = ce) == null || M.success({
1254
+ message: l,
1255
+ className: "w-notification-content"
1256
+ }), C(($) => {
1257
+ var G;
1258
+ return (G = $ == null ? void 0 : $.map((Y) => {
1259
+ var q;
1260
+ if (X(Y, "chats")) {
1261
+ const re = (q = Y == null ? void 0 : Y.chats) == null ? void 0 : q.map((oe) => (oe == null ? void 0 : oe.indexChat) === (e == null ? void 0 : e.indexChat) ? {
1262
+ ...oe,
1263
+ feedback: g
1264
+ } : oe);
1265
+ return {
1266
+ ...Y,
1267
+ chats: re
1268
+ };
1269
+ }
1270
+ return (e == null ? void 0 : e.message_id) === (Y == null ? void 0 : Y.message_id) ? {
1271
+ ...Y,
1272
+ feedback: g
1273
+ } : Y;
1274
+ })) == null ? void 0 : G.flat();
1275
+ }));
1276
+ });
1277
+ };
1278
+ return W(() => {
1279
+ var g;
1280
+ (g = ce) == null || g.destroy();
1281
+ }, [b]), /* @__PURE__ */ h(Q, { children: [
1282
+ k && /* @__PURE__ */ t(
1283
+ R,
1284
+ {
1285
+ icon: /* @__PURE__ */ t(K, { type: "like", chatProps: e }),
1286
+ onClick: () => {
1287
+ (e == null ? void 0 : e.feedback) !== "like" && w("like");
1288
+ }
1289
+ }
1290
+ ),
1291
+ x && /* @__PURE__ */ t(
1292
+ R,
1293
+ {
1294
+ icon: /* @__PURE__ */ t(K, { type: "dislike", chatProps: e }),
1295
+ onClick: () => {
1296
+ (e == null ? void 0 : e.feedback) !== "dislike" && a(!0);
1297
+ }
1298
+ }
1299
+ ),
1300
+ /* @__PURE__ */ h(
1301
+ mn,
1302
+ {
1303
+ open: r,
1304
+ isFeedback: !0,
1305
+ okText: c,
1306
+ onCancel: () => {
1307
+ a(!1);
1308
+ },
1309
+ onOk: () => {
1310
+ w("dislike");
1311
+ },
1312
+ children: [
1313
+ /* @__PURE__ */ t("p", { style: { textAlign: "center", fontWeight: 600, fontSize: 14 }, children: n }),
1314
+ /* @__PURE__ */ h("p", { style: { textAlign: "center" }, children: [
1315
+ o,
1316
+ "!"
1317
+ ] }),
1318
+ /* @__PURE__ */ t(
1319
+ Fn.Group,
1320
+ {
1321
+ className: "w-list-feedback-suggestion",
1322
+ options: et,
1323
+ optionType: "button",
1324
+ buttonStyle: "solid",
1325
+ onChange: (g) => {
1326
+ var u;
1327
+ f((u = g == null ? void 0 : g.target) == null ? void 0 : u.value);
1328
+ }
1329
+ }
1330
+ ),
1331
+ d === "another" && /* @__PURE__ */ h(Q, { children: [
1332
+ /* @__PURE__ */ t(Hn, { children: i }),
1333
+ /* @__PURE__ */ t(J, { form: s, layout: "vertical", children: /* @__PURE__ */ t(J.Item, { name: "ADDITIONAL_FEEDBACK", children: /* @__PURE__ */ t(Ee.TextArea, { rows: 3 }) }) })
1334
+ ] })
1335
+ ]
1336
+ }
1337
+ )
1338
+ ] });
1339
+ }, Vt = S(Wt), zt = ({
1340
+ showFeedback: e = !0,
1341
+ showRegenerate: n = !0,
1342
+ position: o = "left",
1343
+ ...c
1344
+ }) => {
1345
+ const l = rt(), { chats: i, onSendMsg: s, setChats: r, loadingRegenerate: a, currRegenerateId: d } = ee(), f = L(() => c == null ? void 0 : c.sender, [c]), C = L(() => i == null ? void 0 : i.filter((E) => (E == null ? void 0 : E.sender) === "client"), [i]), T = L(() => n && f === "response" && (C == null ? void 0 : C.length) > 0 && (c == null ? void 0 : c.indexChat) === (i == null ? void 0 : i.length) - 1, [f, C, i, c == null ? void 0 : c.indexChat, n]), b = L(() => {
1346
+ switch (o) {
1347
+ case "left":
1348
+ return "flex-start";
1349
+ case "center":
1350
+ return "center";
1351
+ case "right":
1352
+ return "flex-end";
1353
+ }
1354
+ }, [o]), k = L(() => e && (c == null ? void 0 : c.text_FeedbackIcons) === "hidup", [c, e]), x = () => {
1355
+ const E = C == null ? void 0 : C[(C == null ? void 0 : C.length) - 1], w = i == null ? void 0 : i[(i == null ? void 0 : i.length) - 1];
1356
+ r(
1357
+ (g = []) => g == null ? void 0 : g.map((u, m) => m === (g == null ? void 0 : g.length) - 1 && (u == null ? void 0 : u.sender) === "response" ? {
1358
+ ...u,
1359
+ generated_id: (w == null ? void 0 : w.generated_id) ?? l
1360
+ // adjust with response
1361
+ } : u)
1362
+ ), d.current = (w == null ? void 0 : w.generated_id) ?? l, s({
1363
+ msg: E == null ? void 0 : E.text,
1364
+ additionalConfig: {
1365
+ generate_id: (w == null ? void 0 : w.generated_id) ?? l
1366
+ },
1367
+ isShowLoadingResponse: a
1368
+ }), se();
1369
+ };
1370
+ return /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ h(
1371
+ "div",
1372
+ {
1373
+ style: {
1374
+ display: "flex",
1375
+ gap: 8,
1376
+ justifyContent: b
1377
+ },
1378
+ children: [
1379
+ T && /* @__PURE__ */ t(
1380
+ R,
1381
+ {
1382
+ loading: a,
1383
+ icon: /* @__PURE__ */ t(K, { type: "sync" }),
1384
+ onClick: () => {
1385
+ x();
1386
+ }
1387
+ }
1388
+ ),
1389
+ k && /* @__PURE__ */ t(Vt, { ...c })
1390
+ ]
1391
+ }
1392
+ ) });
1393
+ }, Be = S(zt), Gt = ({ nameFallback: e = "", ...n }) => /* @__PURE__ */ t(
1394
+ Bn,
1395
+ {
1396
+ ...typeof (n == null ? void 0 : n.onError) != "function" && {
1397
+ fallback: Ge(e)
1398
+ },
1399
+ placeholder: /* @__PURE__ */ t(P.Image, { style: { width: "100%", height: "100%" } }),
1400
+ loading: "lazy",
1401
+ ...n
1402
+ }
1403
+ ), Ke = S(Gt), Kt = ({ nameFallback: e = "", ...n }) => {
1404
+ const o = B(0);
1405
+ return /* @__PURE__ */ t(
1406
+ tn,
1407
+ {
1408
+ ...n,
1409
+ src: /* @__PURE__ */ t(
1410
+ Ke,
1411
+ {
1412
+ src: n == null ? void 0 : n.src,
1413
+ nameFallback: e,
1414
+ ...n,
1415
+ onError: (c) => {
1416
+ o.current += 1, (o == null ? void 0 : o.current) < 3 ? c.target.src = un(n == null ? void 0 : n.src) : c.target.src = Ge(e);
1417
+ }
1418
+ }
1419
+ )
1420
+ }
1421
+ );
1422
+ }, ae = S(Kt);
1423
+ ae.Group = tn.Group;
1424
+ const Yt = () => /* @__PURE__ */ h("div", { className: "lds-ellipsis", children: [
1425
+ /* @__PURE__ */ t("div", {}),
1426
+ /* @__PURE__ */ t("div", {}),
1427
+ /* @__PURE__ */ t("div", {}),
1428
+ /* @__PURE__ */ t("div", {})
1429
+ ] }), yn = S(Yt), qt = () => {
1430
+ const { widgetProps: e } = I();
1431
+ return /* @__PURE__ */ h("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
1432
+ /* @__PURE__ */ t(ae, { src: ve, nameFallback: e == null ? void 0 : e.title }),
1433
+ /* @__PURE__ */ t(yn, {})
1434
+ ] });
1435
+ }, Ye = S(qt), Qt = ({ src: e, name: n }) => /* @__PURE__ */ h("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
1436
+ /* @__PURE__ */ t(ae, { src: e, preview: !1, nameFallback: n }),
1437
+ /* @__PURE__ */ t(F.Text, { children: n })
1438
+ ] }), Se = S(Qt), Zt = ({ ...e }) => {
1439
+ var f, C;
1440
+ const [n, o] = _(1), { loadingRegenerate: c, currRegenerateId: l } = ee(), { isExpand: i, widgetProps: s } = I(), r = L(() => e == null ? void 0 : e.sender, [e]), a = L(() => e == null ? void 0 : e.chats, [e == null ? void 0 : e.chats]), d = L(() => {
1441
+ const T = a == null ? void 0 : a[(a == null ? void 0 : a.length) - 1];
1442
+ return (T == null ? void 0 : T.generated_id) === l.current;
1443
+ }, [a, e, l.current]);
1444
+ return W(() => {
1445
+ !c && (a == null ? void 0 : a.length) > 0 && (o(a == null ? void 0 : a.length), se());
1446
+ }, [c]), c && d ? /* @__PURE__ */ t(Ye, {}) : /* @__PURE__ */ h(Q, { children: [
1447
+ r === "response" && /* @__PURE__ */ t(Se, { name: s == null ? void 0 : s.title, src: ve }),
1448
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: 8 }, children: a == null ? void 0 : a.map((T, b) => {
1449
+ var E;
1450
+ const k = b === ((E = e == null ? void 0 : e.chats) == null ? void 0 : E.length) - 1, x = n === b + 1;
1451
+ return /* @__PURE__ */ h(
1452
+ "div",
1453
+ {
1454
+ style: {
1455
+ display: x ? "flex" : "none",
1456
+ flexDirection: "column",
1457
+ gap: 8
1458
+ },
1459
+ className: "w-fade-in-animate",
1460
+ children: [
1461
+ /* @__PURE__ */ t(
1462
+ "div",
1463
+ {
1464
+ ...k && {
1465
+ className: `w-regenerate-chat-last ${i ? "w-regenerate-chat-last-expand" : ""}`
1466
+ },
1467
+ children: /* @__PURE__ */ h(
1468
+ "div",
1469
+ {
1470
+ className: `w-bubble-chat w-bubble-chat-regenerate ${`w-${r}`} ${i ? "w-bubble-chat-regenerate-expand" : ""}`,
1471
+ children: [
1472
+ /* @__PURE__ */ t(Tn, { children: T == null ? void 0 : T.text }),
1473
+ r === "response" && /* @__PURE__ */ t("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.4)" }, children: T == null ? void 0 : T.timestamp })
1474
+ ]
1475
+ }
1476
+ )
1477
+ }
1478
+ ),
1479
+ /* @__PURE__ */ t(
1480
+ Be,
1481
+ {
1482
+ showFeedback: !0,
1483
+ showRegenerate: !1,
1484
+ ...T
1485
+ }
1486
+ )
1487
+ ]
1488
+ },
1489
+ b
1490
+ );
1491
+ }) }),
1492
+ /* @__PURE__ */ h("div", { style: { display: "flex", gap: 8, justifyContent: "center" }, children: [
1493
+ /* @__PURE__ */ t(
1494
+ Be,
1495
+ {
1496
+ showRegenerate: !0,
1497
+ showFeedback: !1,
1498
+ ...e
1499
+ }
1500
+ ),
1501
+ /* @__PURE__ */ h("div", { style: { display: "flex", gap: 4, alignItems: "center" }, children: [
1502
+ /* @__PURE__ */ t(
1503
+ R,
1504
+ {
1505
+ size: "small",
1506
+ shape: "circle",
1507
+ disabled: n === 1,
1508
+ icon: /* @__PURE__ */ t(K, { type: "left" }),
1509
+ onClick: () => {
1510
+ n > 1 && o((T) => T - 1);
1511
+ }
1512
+ }
1513
+ ),
1514
+ /* @__PURE__ */ h(F.Text, { children: [
1515
+ n,
1516
+ " / ",
1517
+ (f = e == null ? void 0 : e.chats) == null ? void 0 : f.length
1518
+ ] }),
1519
+ /* @__PURE__ */ t(
1520
+ R,
1521
+ {
1522
+ size: "small",
1523
+ shape: "circle",
1524
+ disabled: n === ((C = e == null ? void 0 : e.chats) == null ? void 0 : C.length),
1525
+ icon: /* @__PURE__ */ t(K, { type: "right" }),
1526
+ onClick: () => {
1527
+ var T;
1528
+ n < ((T = e == null ? void 0 : e.chats) == null ? void 0 : T.length) && o((b) => b + 1);
1529
+ }
1530
+ }
1531
+ )
1532
+ ] })
1533
+ ] })
1534
+ ] });
1535
+ }, Jt = S(Zt), Xt = ({ date: e, format: n, sender: o, ...c }) => {
1536
+ var l, i;
1537
+ return /* @__PURE__ */ t(
1538
+ F.Text,
1539
+ {
1540
+ ...c,
1541
+ type: "secondary",
1542
+ style: {
1543
+ display: "block",
1544
+ fontSize: 12,
1545
+ ...o === "client" && {
1546
+ textAlign: "right"
1547
+ },
1548
+ ...((l = Object.keys((c == null ? void 0 : c.style) || {})) == null ? void 0 : l.length) > 0 && {
1549
+ ...c == null ? void 0 : c.style
1550
+ }
1551
+ },
1552
+ children: n ? (i = j(e)) == null ? void 0 : i.format(n) : e
1553
+ }
1554
+ );
1555
+ }, xe = S(Xt), jt = ({ ...e }) => {
1556
+ var s;
1557
+ const { loadingRegenerate: n, chats: o } = ee(), { widgetProps: c } = I(), l = L(() => (o == null ? void 0 : o.length) - 1 === (e == null ? void 0 : e.indexChat), [o]), i = L(() => e == null ? void 0 : e.sender, [e]);
1558
+ return ((s = e == null ? void 0 : e.chats) == null ? void 0 : s.length) > 0 ? /* @__PURE__ */ t(Jt, { ...e }) : n && l ? /* @__PURE__ */ t(Ye, {}) : /* @__PURE__ */ h(Q, { children: [
1559
+ i === "response" && /* @__PURE__ */ t(Se, { name: c == null ? void 0 : c.title, src: ve }),
1560
+ /* @__PURE__ */ h("div", { className: `w-bubble-chat ${`w-${i}`}`, children: [
1561
+ /* @__PURE__ */ t(Tn, { children: e == null ? void 0 : e.text }),
1562
+ /* @__PURE__ */ t(xe, { date: e == null ? void 0 : e.timestamp, sender: i })
1563
+ ] }),
1564
+ /* @__PURE__ */ t(Be, { ...e })
1565
+ ] });
1566
+ }, we = S(jt), Pt = () => {
1567
+ const e = A(
1568
+ "PleaseUploadFile",
1569
+ "Please upload specify file that needed to complete your request"
1570
+ ), n = A("ClickToUpload", "Click to upload"), o = A(
1571
+ "ContinueWithoutUpload",
1572
+ "Continue without upload"
1573
+ ), { onSendMsg: c, setFile: l } = ee(), i = () => {
1574
+ c({
1575
+ msg: "CANCEL UPLOAD"
1576
+ });
1577
+ };
1578
+ return /* @__PURE__ */ h(
1579
+ "div",
1580
+ {
1581
+ style: {
1582
+ display: "flex",
1583
+ flexDirection: "column",
1584
+ gap: 4,
1585
+ marginBottom: 12
1586
+ },
1587
+ children: [
1588
+ /* @__PURE__ */ t(we, { sender: "response", text: `${e}...` }),
1589
+ /* @__PURE__ */ h("div", { style: { display: "flex", gap: 8 }, children: [
1590
+ /* @__PURE__ */ t(
1591
+ on,
1592
+ {
1593
+ className: "btn_upload",
1594
+ beforeUpload: () => !1,
1595
+ fileList: [],
1596
+ accept: ".doc, .jpg, .ods, .png, .txt, .docx, .pdf",
1597
+ onChange: (s) => {
1598
+ l(s == null ? void 0 : s.file);
1599
+ },
1600
+ children: /* @__PURE__ */ t(R, { icon: /* @__PURE__ */ t(K, { type: "upload" }), children: n })
1601
+ }
1602
+ ),
1603
+ /* @__PURE__ */ t(R, { type: "dashed", onClick: i, children: o })
1604
+ ] })
1605
+ ]
1606
+ }
1607
+ );
1608
+ }, eo = S(Pt), no = () => {
1609
+ const [e, n] = _(!1), [o, c] = _(!1), [l, i] = _(!1), [s, r] = _(3), [a, d] = _(!1), [f, C] = _(""), { widgetProps: T } = I(), { onSendMsg: b, chats: k } = ee(), { onSubmitPYPwd: x = () => {
1610
+ }, onCheckPYAccess: E = () => {
1611
+ } } = (T == null ? void 0 : T.onPayslipFn) || {}, w = A(
1612
+ "ProvidePasswordPayslip",
1613
+ "Please provide your password account to access the download"
1614
+ ), g = A("Cancel", "Cancel"), u = A("Submit", "Submit"), m = A("Password", "Password"), y = A("IsRequired", "Is Required"), p = A(
1615
+ "PasswordPayslipValid",
1616
+ "Your password is valid. Please download the payslip file"
1617
+ ), D = A(
1618
+ "AttemptPasswordExceeded",
1619
+ "Your attempt to enter the password exceeded the limit"
1620
+ ), O = A(
1621
+ "VerifyAccessPayslip",
1622
+ "Please wait, verifying access to your payslip"
1623
+ ), V = A(
1624
+ "WrongPwdPayslip",
1625
+ "The password you entered is incorrect. Please try again or contact support if you need assistance"
1626
+ ), U = A(
1627
+ "SessionExpired",
1628
+ "Session expired. Please log in again to continue"
1629
+ ), [H] = J.useForm(), v = () => {
1630
+ var M, $, G;
1631
+ i(!0), d(!0), (G = ($ = (M = E()) == null ? void 0 : M.then((Y) => {
1632
+ var q, re;
1633
+ const Z = (re = (q = Y == null ? void 0 : Y.data) == null ? void 0 : q.DATA) == null ? void 0 : re.RESULT;
1634
+ Z && b({ msg: "Valid" }), n(Z), C("");
1635
+ })) == null ? void 0 : $.catch((Y) => {
1636
+ C(Y == null ? void 0 : Y.toString());
1637
+ })) == null || G.finally(() => {
1638
+ c(!1), d(!1);
1639
+ });
1640
+ }, N = () => {
1641
+ b({ msg: "cancel" }), i(!1);
1642
+ }, z = () => {
1643
+ var $;
1644
+ const M = H == null ? void 0 : H.getFieldValue("pwd");
1645
+ ($ = H == null ? void 0 : H.validateFields()) == null || $.then(() => {
1646
+ var G, Y;
1647
+ c(!0), (Y = (G = x(M)) == null ? void 0 : G.then(({ data: Z }) => {
1648
+ var q;
1649
+ (q = Z == null ? void 0 : Z.DATA) != null && q.ISVALID ? v() : (C(V), r(s - 1), c(!1));
1650
+ })) == null || Y.catch((Z) => {
1651
+ var re, oe, qe, Qe, Ze;
1652
+ const q = Z == null ? void 0 : Z.response;
1653
+ if ((q == null ? void 0 : q.status) === 401) {
1654
+ const vn = (oe = (re = q == null ? void 0 : q.data) == null ? void 0 : re.ERRORS) == null ? void 0 : oe.includes(
1655
+ "ACCESS_TOKEN_EXPIRED"
1656
+ ), _n = (Ze = (Qe = (qe = q == null ? void 0 : q.data) == null ? void 0 : qe.MESSAGE) == null ? void 0 : Qe.toLowerCase()) == null ? void 0 : Ze.includes(
1657
+ "invalid password"
1658
+ );
1659
+ vn && C(U), _n && (C(V), r(s - 1), c(!1));
1660
+ } else
1661
+ C(Z == null ? void 0 : Z.toString());
1662
+ c(!1);
1663
+ });
1664
+ });
1665
+ };
1666
+ return W(() => {
1667
+ var $;
1668
+ const M = k == null ? void 0 : k[(k == null ? void 0 : k.length) - 1];
1669
+ (($ = M == null ? void 0 : M.attachment) == null ? void 0 : $.type) === "show_password_wp" && v();
1670
+ }, []), l ? a ? /* @__PURE__ */ t(we, { sender: "response", text: `${O}...` }) : s === 0 ? /* @__PURE__ */ t(we, { sender: "response", text: D }) : f ? /* @__PURE__ */ t(we, { sender: "response", text: f }) : /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1671
+ /* @__PURE__ */ t(J, { form: H, layout: "vertical", children: /* @__PURE__ */ t(
1672
+ J.Item,
1673
+ {
1674
+ name: "pwd",
1675
+ label: e ? p : w,
1676
+ rules: [
1677
+ {
1678
+ required: !0,
1679
+ message: `${m} ${y}`
1680
+ }
1681
+ ],
1682
+ children: /* @__PURE__ */ t(
1683
+ Ee.Password,
1684
+ {
1685
+ ...e && {
1686
+ disabled: !0,
1687
+ style: {
1688
+ display: "none"
1689
+ }
1690
+ }
1691
+ }
1692
+ )
1693
+ }
1694
+ ) }),
1695
+ !e && /* @__PURE__ */ h("div", { style: { display: "flex", gap: 8 }, children: [
1696
+ /* @__PURE__ */ t(R, { disabled: o, onClick: N, children: g }),
1697
+ /* @__PURE__ */ t(R, { type: "primary", onClick: z, loading: o, children: u })
1698
+ ] })
1699
+ ] }) : null;
1700
+ }, to = S(no), oo = ({ ...e }) => {
1701
+ const { objInitPayload: n } = I(), o = L(() => rn(n == null ? void 0 : n.access_token), [n]);
1702
+ return /* @__PURE__ */ t(R, { onClick: () => {
1703
+ var i, s;
1704
+ const l = e == null ? void 0 : e.attachment;
1705
+ (s = ye({
1706
+ method: "POST",
1707
+ url: l == null ? void 0 : l.endpoint,
1708
+ data: l == null ? void 0 : l.body,
1709
+ headers: {
1710
+ Authorization: `Bearer ${n == null ? void 0 : n.access_token}`,
1711
+ "Content-Type": l == null ? void 0 : l.headers["Content-Type"],
1712
+ coid: n == null ? void 0 : n.companyid,
1713
+ "Company-Id": n == null ? void 0 : n.companyid,
1714
+ "Acc-Name": (i = o == null ? void 0 : o.INSTANCE) == null ? void 0 : i.toLowerCase()
1715
+ },
1716
+ responseType: "blob"
1717
+ })) == null || s.then((r) => {
1718
+ var T;
1719
+ const a = (T = l == null ? void 0 : l.body) == null ? void 0 : T.media, d = `${l == null ? void 0 : l.filename}.${a}`, f = new Blob([r == null ? void 0 : r.data]), C = URL == null ? void 0 : URL.createObjectURL(f);
1720
+ We({ downloadURL: C, fileName: d }), URL.revokeObjectURL(C);
1721
+ });
1722
+ }, children: "Download file" });
1723
+ }, co = S(oo), so = ({ ...e }) => {
1724
+ const n = B(), o = A("DownloadChart", "Download Chart"), c = L(() => e == null ? void 0 : e.attachment, [e == null ? void 0 : e.attachment]), l = L(() => {
1725
+ var s;
1726
+ return (s = c == null ? void 0 : c.data) == null ? void 0 : s.map((r, a) => {
1727
+ var d, f;
1728
+ return {
1729
+ label: (d = c == null ? void 0 : c.labels) == null ? void 0 : d[a],
1730
+ value: r,
1731
+ color: (f = c == null ? void 0 : c.colors) == null ? void 0 : f[a]
1732
+ };
1733
+ });
1734
+ }, [c]), i = () => {
1735
+ var r;
1736
+ const s = (r = document == null ? void 0 : document.querySelector(".chart_widget canvas")) == null ? void 0 : r.toDataURL();
1737
+ We({ fileName: c == null ? void 0 : c.title, downloadURL: s });
1738
+ };
1739
+ return /* @__PURE__ */ h(Q, { children: [
1740
+ /* @__PURE__ */ t(
1741
+ qn,
1742
+ {
1743
+ className: "chart_widget",
1744
+ ref: n,
1745
+ data: l,
1746
+ angleField: "value",
1747
+ colorField: "label",
1748
+ label: {
1749
+ text: "label",
1750
+ style: {
1751
+ fontWeight: "bold"
1752
+ }
1753
+ },
1754
+ legend: {
1755
+ color: {
1756
+ title: !0,
1757
+ position: "bottom",
1758
+ rowPadding: 5
1759
+ }
1760
+ }
1761
+ }
1762
+ ),
1763
+ /* @__PURE__ */ t("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ t(
1764
+ R,
1765
+ {
1766
+ onClick: () => {
1767
+ i();
1768
+ },
1769
+ children: o
1770
+ }
1771
+ ) })
1772
+ ] });
1773
+ }, lo = S(so), io = ({ ...e }) => {
1774
+ var n, o, c, l, i;
1775
+ switch (!0) {
1776
+ case ((n = Ce(e)) == null ? void 0 : n.text):
1777
+ return /* @__PURE__ */ t(we, { ...e });
1778
+ case ((o = Ce(e)) == null ? void 0 : o.upload):
1779
+ return /* @__PURE__ */ t(eo, { ...e });
1780
+ case ((c = Ce(e)) == null ? void 0 : c.password):
1781
+ return /* @__PURE__ */ t(to, { ...e });
1782
+ case ((l = Ce(e)) == null ? void 0 : l.filedownload):
1783
+ return /* @__PURE__ */ t(co, { ...e });
1784
+ case ((i = Ce(e)) == null ? void 0 : i.chart):
1785
+ return /* @__PURE__ */ t(lo, { ...e });
1786
+ default:
1787
+ return null;
1788
+ }
1789
+ }, ro = S(io), ao = () => {
1790
+ const { isOpenWidget: e, widgetProps: n } = I(), { chats: o, isWaitResponse: c } = ee(), { activeTab: l } = le();
1791
+ return W(() => {
1792
+ se();
1793
+ }, [l]), e ? /* @__PURE__ */ h(Q, { children: [
1794
+ /* @__PURE__ */ t("div", { className: "w-bubble-chat-container", children: o == null ? void 0 : o.map((i, s) => {
1795
+ var a;
1796
+ const r = (a = Ce(i)) == null ? void 0 : a.text;
1797
+ return /* @__PURE__ */ h(He, { children: [
1798
+ (i == null ? void 0 : i.sender) === "response" && !r && /* @__PURE__ */ t(
1799
+ Se,
1800
+ {
1801
+ name: n == null ? void 0 : n.title,
1802
+ src: ve
1803
+ }
1804
+ ),
1805
+ /* @__PURE__ */ t(ro, { indexChat: s, ...i })
1806
+ ] }, s);
1807
+ }) }),
1808
+ c && /* @__PURE__ */ t(Ye, {})
1809
+ ] }) : null;
1810
+ }, uo = S(ao), fo = () => {
1811
+ var u;
1812
+ const e = A(
1813
+ "ContinueWithoutUpload",
1814
+ "Continue without Upload"
1815
+ ), {
1816
+ onSendMsg: n,
1817
+ setChats: o,
1818
+ isWaitResponse: c,
1819
+ loadingRegenerate: l,
1820
+ file: i,
1821
+ setFile: s,
1822
+ chats: r,
1823
+ connected: a
1824
+ } = ee(), { isActiveTabVA: d } = le(), f = L(() => {
1825
+ var y;
1826
+ const m = r == null ? void 0 : r[(r == null ? void 0 : r.length) - 1];
1827
+ return (m == null ? void 0 : m.sender) === "response" && ((y = m == null ? void 0 : m.attachment) == null ? void 0 : y.type) === "fileuploader";
1828
+ }, [r]), C = B(), [T, b] = _(!1), [k, x] = _(!1), E = L(() => c || !k, [k, c]), w = () => {
1829
+ var p, D, O, V;
1830
+ const m = (O = (D = (p = C == null ? void 0 : C.current) == null ? void 0 : p.resizableTextArea) == null ? void 0 : D.textArea) == null ? void 0 : O.value;
1831
+ if (!(m != null && m.trim()) || c) return;
1832
+ x(!1), n({ msg: m }), b(!T);
1833
+ const y = {
1834
+ text: m,
1835
+ sender: "client",
1836
+ type: "text",
1837
+ timestamp: (V = j()) == null ? void 0 : V.format("hh:mm A")
1838
+ };
1839
+ o((U) => [...U, y]), se();
1840
+ }, g = () => {
1841
+ n({ msg: "SKIP_WAITING_RESPONSE" });
1842
+ };
1843
+ return W(() => {
1844
+ var m;
1845
+ C != null && C.current && d && ((m = C == null ? void 0 : C.current) == null || m.focus());
1846
+ }, [d]), f ? /* @__PURE__ */ h("div", { className: "w-input-container", style: { alignItems: "center" }, children: [
1847
+ /* @__PURE__ */ t(F.Text, { children: i == null ? void 0 : i.name }),
1848
+ ((u = Object == null ? void 0 : Object.keys(i || {})) == null ? void 0 : u.length) > 0 ? /* @__PURE__ */ h("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
1849
+ /* @__PURE__ */ t(
1850
+ R,
1851
+ {
1852
+ danger: !0,
1853
+ icon: /* @__PURE__ */ t(K, { type: "delete" }),
1854
+ shape: "circle",
1855
+ onClick: () => s({})
1856
+ }
1857
+ ),
1858
+ /* @__PURE__ */ t(
1859
+ R,
1860
+ {
1861
+ className: "w-send-btn",
1862
+ style: { backgroundColor: "var(--primary-color, #395ebc)" },
1863
+ icon: /* @__PURE__ */ t(K, { type: "send" }),
1864
+ shape: "circle",
1865
+ onClick: w
1866
+ }
1867
+ )
1868
+ ] }) : /* @__PURE__ */ t(me, { title: e, children: /* @__PURE__ */ t(
1869
+ R,
1870
+ {
1871
+ icon: /* @__PURE__ */ t(K, { type: "close" }),
1872
+ shape: "circle",
1873
+ onClick: () => {
1874
+ n({
1875
+ msg: "CANCEL UPLOAD"
1876
+ });
1877
+ }
1878
+ }
1879
+ ) })
1880
+ ] }) : /* @__PURE__ */ h("div", { className: "w-input-container", children: [
1881
+ /* @__PURE__ */ t(
1882
+ Ee.TextArea,
1883
+ {
1884
+ className: "w-input-widget",
1885
+ disabled: !a,
1886
+ ref: C,
1887
+ placeholder: "Type a message...",
1888
+ onKeyDown: (m) => {
1889
+ ((m == null ? void 0 : m.code) === "Enter" || (m == null ? void 0 : m.key) === "Enter") && !(m != null && m.shiftKey) && w();
1890
+ },
1891
+ onChange: ({ target: { value: m } }) => {
1892
+ const y = /\S/;
1893
+ pe({
1894
+ input_va_value: m
1895
+ }), m && (y != null && y.test(m)) ? x(!0) : m != null && m.trim() || x(!1);
1896
+ }
1897
+ },
1898
+ T
1899
+ ),
1900
+ c || l ? /* @__PURE__ */ t(
1901
+ R,
1902
+ {
1903
+ style: { border: "none" },
1904
+ icon: /* @__PURE__ */ t(K, { type: "stop" }),
1905
+ shape: "circle",
1906
+ onClick: g,
1907
+ size: "large"
1908
+ }
1909
+ ) : /* @__PURE__ */ t(
1910
+ R,
1911
+ {
1912
+ className: `w-send-btn ${E ? "w-send-btn-disabled" : ""}`,
1913
+ disabled: E,
1914
+ style: { backgroundColor: "var(--primary-color, #395ebc)" },
1915
+ icon: /* @__PURE__ */ t(K, { type: "send" }),
1916
+ shape: "circle",
1917
+ onClick: w
1918
+ }
1919
+ )
1920
+ ] });
1921
+ }, go = S(fo), Co = ({ taskStatus: e }) => {
1922
+ const n = A("InProgress", "In Progress"), o = A("New", "New"), c = A("Closed", "Closed"), l = A("Done", "Done"), i = A("HDCancelled", "Cancelled"), s = {
1923
+ "In Progress": n,
1924
+ Open: o,
1925
+ New: o,
1926
+ Closed: c,
1927
+ Fixed: l,
1928
+ Cancelled: i
1929
+ }, r = {
1930
+ "In Progress": "#FFF2D6",
1931
+ Responded: "#FFF2D6",
1932
+ Open: "#e9e2f8",
1933
+ Reopen: "#e9e2f8",
1934
+ Closed: "#e1ebfd",
1935
+ Fixed: "#bbfab7",
1936
+ Done: "#bbfab7",
1937
+ Cancelled: "#FFF2D6"
1938
+ }, a = L(() => r[e] || r.Closed, [e]), d = L(() => s[e] || e, [e]);
1939
+ return /* @__PURE__ */ t($n, { color: a, children: /* @__PURE__ */ t(
1940
+ F.Text,
1941
+ {
1942
+ className: "primary-color-active",
1943
+ style: { width: "100%", textAlign: "center" },
1944
+ ellipsis: { tooltip: d },
1945
+ children: d
1946
+ }
1947
+ ) }, e);
1948
+ }, hn = S(Co), mo = ({ onClick: e, ...n }) => /* @__PURE__ */ h(
1949
+ "div",
1950
+ {
1951
+ className: "w-ticket-card-container",
1952
+ ...typeof e == "function" && {
1953
+ onClick: e
1954
+ },
1955
+ children: [
1956
+ /* @__PURE__ */ t(
1957
+ F.Text,
1958
+ {
1959
+ strong: !0,
1960
+ style: {
1961
+ color: "var(--primary-color, #395ebc)",
1962
+ fontSize: 16,
1963
+ marginBottom: 10,
1964
+ display: "block"
1965
+ },
1966
+ children: n == null ? void 0 : n.TASK_NAME
1967
+ }
1968
+ ),
1969
+ /* @__PURE__ */ h("div", { className: "w-ticket-card-content-container", children: [
1970
+ /* @__PURE__ */ h("div", { className: "w-ticket-card-cat-code", children: [
1971
+ /* @__PURE__ */ t(F.Text, { children: (n == null ? void 0 : n.TASK_CATEGORY) || Pe }),
1972
+ /* @__PURE__ */ t(F.Text, { children: (n == null ? void 0 : n.TASK_CODE) || Pe })
1973
+ ] }),
1974
+ /* @__PURE__ */ h(
1975
+ "div",
1976
+ {
1977
+ className: "w-ticket-card-status-date",
1978
+ style: {
1979
+ alignItems: "flex-end"
1980
+ },
1981
+ children: [
1982
+ /* @__PURE__ */ t(hn, { taskStatus: n == null ? void 0 : n.TASK_STATUS }),
1983
+ /* @__PURE__ */ t(F.Text, { children: n == null ? void 0 : n.CREATED_DATE })
1984
+ ]
1985
+ }
1986
+ )
1987
+ ] })
1988
+ ]
1989
+ }
1990
+ ), To = S(mo), kn = () => {
1991
+ const { objInitPayload: e, setObjInitPayload: n, parsedJWT: o } = I(), c = L(() => {
1992
+ var i;
1993
+ return {
1994
+ Authorization: `Bearer ${e == null ? void 0 : e.access_token}`,
1995
+ coid: o == null ? void 0 : o.COID,
1996
+ "Acc-Name": (i = o == null ? void 0 : o.INSTANCE) == null ? void 0 : i.toLowerCase(),
1997
+ "Company-Id": e == null ? void 0 : e.companyid,
1998
+ Language: e == null ? void 0 : e.lang
1999
+ };
2000
+ }, [e]);
2001
+ return async (i) => {
2002
+ var d, f, C;
2003
+ const { onSuccess: s, onError: r, onFinally: a } = i ?? {};
2004
+ (C = (f = (d = ye({
2005
+ url: e == null ? void 0 : e.uriBackend,
2006
+ params: {
2007
+ ofid: "sfsystem.RefreshToken",
2008
+ accname: e == null ? void 0 : e.companycode
2009
+ },
2010
+ data: {
2011
+ refreshtoken: (e == null ? void 0 : e.refresh_token) || "4D8C30EE29749D0F06B4F6E2527516B397C09D4DB148D42214E2941C7A86139D3CB512D925E1B098C6090A45E6BCC545723222FA3BABDC2A"
2012
+ },
2013
+ headers: c,
2014
+ method: "POST"
2015
+ })) == null ? void 0 : d.then((T) => {
2016
+ var x;
2017
+ const b = (x = T == null ? void 0 : T.data) == null ? void 0 : x.DATA, k = {
2018
+ access_token: b == null ? void 0 : b.JWT_TOKEN,
2019
+ refresh_token: e == null ? void 0 : e.refresh_token,
2020
+ uagent: e == null ? void 0 : e.uagent,
2021
+ uriBackend: e == null ? void 0 : e.uriBackend,
2022
+ uriService: e == null ? void 0 : e.uriService,
2023
+ companyid: e == null ? void 0 : e.companyid,
2024
+ companycode: e == null ? void 0 : e.companycode,
2025
+ lang: e == null ? void 0 : e.lang,
2026
+ uriBackendEnt: e == null ? void 0 : e.uriBackendEnt,
2027
+ uriBackendHRMGO: e == null ? void 0 : e.uriBackendHRMGO,
2028
+ config: e == null ? void 0 : e.config
2029
+ };
2030
+ n(k), typeof s == "function" && s(T);
2031
+ })) == null ? void 0 : f.catch((T) => {
2032
+ typeof r == "function" && r(T);
2033
+ })) == null || C.finally(() => {
2034
+ typeof a == "function" && a();
2035
+ });
2036
+ };
2037
+ }, De = () => {
2038
+ var s;
2039
+ const e = B(new AbortController()), { objInitPayload: n, parsedJWT: o } = I(), c = kn(), l = {
2040
+ Authorization: `Bearer ${n == null ? void 0 : n.access_token}`,
2041
+ coid: o == null ? void 0 : o.COID,
2042
+ "Acc-Name": (s = o == null ? void 0 : o.INSTANCE) == null ? void 0 : s.toLowerCase(),
2043
+ "Company-Id": n == null ? void 0 : n.companyid,
2044
+ Language: n == null ? void 0 : n.lang
2045
+ }, i = async ({
2046
+ url: r,
2047
+ endpoint: a,
2048
+ method: d = "POST",
2049
+ headers: f,
2050
+ ...C
2051
+ }) => {
2052
+ var x, E, w, g, u, m;
2053
+ const T = {
2054
+ url: r || `${n == null ? void 0 : n.uriBackendHRMGO}${a}`,
2055
+ ...e.current && {
2056
+ signal: (x = e == null ? void 0 : e.current) == null ? void 0 : x.signal
2057
+ },
2058
+ headers: {
2059
+ ...l,
2060
+ ...f,
2061
+ "Company-Code": n == null ? void 0 : n.companycode
2062
+ },
2063
+ method: d,
2064
+ ...C
2065
+ }, b = (E = ye) == null ? void 0 : E.create(T);
2066
+ return (g = (w = b == null ? void 0 : b.interceptors) == null ? void 0 : w.request) == null || g.use(
2067
+ (y) => (n != null && n.access_token && (y.headers.Authorization = `Bearer ${n == null ? void 0 : n.access_token}`), y),
2068
+ (y) => {
2069
+ Promise.reject(y);
2070
+ }
2071
+ ), (m = (u = b == null ? void 0 : b.interceptors) == null ? void 0 : u.response) == null || m.use(
2072
+ (y) => y,
2073
+ async (y) => {
2074
+ var D;
2075
+ const p = y == null ? void 0 : y.config;
2076
+ if (((D = y == null ? void 0 : y.response) == null ? void 0 : D.status) === 401) {
2077
+ const O = await c();
2078
+ return p.headers.Authorization = `Bearer ${O}`, ye(p);
2079
+ }
2080
+ return Promise == null ? void 0 : Promise.reject(y);
2081
+ }
2082
+ ), await (b == null ? void 0 : b.request(T));
2083
+ };
2084
+ return i.abort = () => {
2085
+ var r;
2086
+ e != null && e.current && ((r = e == null ? void 0 : e.current) == null || r.abort(), e.current = new AbortController());
2087
+ }, W(() => () => i.abort(), []), i;
2088
+ }, An = de({}), te = () => ue(An), bo = ({ children: e }) => {
2089
+ const n = De(), [o, c] = _([]), [l, i] = _(""), [s, r] = _(!1), [a, d] = _(!0), [f, C] = _(0), T = (b) => {
2090
+ var k, x, E, w;
2091
+ d(!0), (w = (E = n({
2092
+ endpoint: "/helpdesk/myticket/ticket-list",
2093
+ method: "POST",
2094
+ data: {
2095
+ LIMIT: 20,
2096
+ PAGE: 1,
2097
+ SEARCH: {
2098
+ MY_TICKET: !0,
2099
+ TASK_MODULE: "HD",
2100
+ ...((k = Object.keys(b || {})) == null ? void 0 : k.length) > 0 && {
2101
+ ...b,
2102
+ ...(b == null ? void 0 : b.CREATED_DATE) && {
2103
+ CREATED_DATE: (x = j(b == null ? void 0 : b.CREATED_DATE)) == null ? void 0 : x.format(Ue)
2104
+ }
2105
+ }
2106
+ },
2107
+ SORT: {
2108
+ FIELD: "t.created_date",
2109
+ ORDER: "DESC"
2110
+ }
2111
+ }
2112
+ })) == null ? void 0 : E.then((g) => {
2113
+ var u, m, y;
2114
+ (u = g == null ? void 0 : g.data) != null && u.DATA && c((y = (m = g == null ? void 0 : g.data) == null ? void 0 : m.DATA) == null ? void 0 : y.LIST);
2115
+ })) == null || w.finally(() => {
2116
+ d(!1);
2117
+ });
2118
+ };
2119
+ return W(() => {
2120
+ T();
2121
+ }, []), /* @__PURE__ */ t(
2122
+ An.Provider,
2123
+ {
2124
+ value: {
2125
+ listTicket: o,
2126
+ ticketId: l,
2127
+ setTicketId: i,
2128
+ getListTicket: T,
2129
+ openFilter: s,
2130
+ setOpenFilter: r,
2131
+ loadingListTicket: a,
2132
+ countFilters: f,
2133
+ setCountFilters: C
2134
+ },
2135
+ children: e
2136
+ }
2137
+ );
2138
+ }, yo = () => {
2139
+ const e = A("SubjectSearch", "Subject Search"), n = A("AdvanceFilter", "Advance Filter"), o = B(null), { getListTicket: c, setOpenFilter: l, loadingListTicket: i, countFilters: s } = te();
2140
+ return /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ h("div", { style: { display: "flex", gap: 8, marginBottom: 12 }, children: [
2141
+ /* @__PURE__ */ t(
2142
+ Ee,
2143
+ {
2144
+ placeholder: e,
2145
+ onChange: ({ target: { value: r } }) => {
2146
+ clearTimeout(o == null ? void 0 : o.current), o.current = setTimeout(() => {
2147
+ c({
2148
+ TASK_NAME: r
2149
+ });
2150
+ }, 250);
2151
+ },
2152
+ allowClear: !0
2153
+ }
2154
+ ),
2155
+ /* @__PURE__ */ t(me, { title: `${n} (${s})`, children: /* @__PURE__ */ t(In, { count: s, children: /* @__PURE__ */ t(
2156
+ R,
2157
+ {
2158
+ loading: i,
2159
+ icon: /* @__PURE__ */ t(K, { type: "filter" }),
2160
+ onClick: () => {
2161
+ l(!0);
2162
+ }
2163
+ }
2164
+ ) }) })
2165
+ ] }) });
2166
+ }, ho = S(yo), wn = de({}), ie = () => ue(wn), ko = ({ children: e }) => {
2167
+ const n = B(null), o = B(0), c = B(!1), l = B(null), [i, s] = _([]), [r, a] = _(0), { objInitPayload: d, parsedJWT: f, isFirstRenderHelpdesk: C, setShowReadyWSHD: T } = I(), b = kn(), k = (g) => {
2168
+ const u = new WebSocket(g);
2169
+ u.onopen = () => {
2170
+ c.current = !0, o.current = 0, a(0), T(!0);
2171
+ }, u.onerror = (m) => {
2172
+ T(!1), console.error(`${ge} - WebSocket error:`, m);
2173
+ }, u.onclose = (m) => {
2174
+ console.warn(
2175
+ `${ge} - WebSocket disconnected:`,
2176
+ m
2177
+ ), c.current = !1, T(!1), !(m != null && m.wasClean) && (o == null ? void 0 : o.current) < Ae && (o.current += 1, a((y) => y + 1), clearTimeout(l.current), l.current = setTimeout(x, 2e3));
2178
+ }, u.onmessage = E(u), n.current = u;
2179
+ }, x = async () => {
2180
+ var U, H, v;
2181
+ if (((U = n.current) == null ? void 0 : U.readyState) === (WebSocket == null ? void 0 : WebSocket.CONNECTING)) return;
2182
+ const {
2183
+ access_token: g,
2184
+ companyid: u = "",
2185
+ companycode: m = "",
2186
+ lang: y = "",
2187
+ uriBackendHRMGO: p = ""
2188
+ } = d ?? {};
2189
+ if (!g || !u || !m) {
2190
+ console.warn(
2191
+ `${ge} - Missing required WebSocket credentials.`
2192
+ );
2193
+ return;
2194
+ }
2195
+ const D = `Bearer ${g}`, O = (H = `${p}/ws`) == null ? void 0 : H.replace("https://", "wss://"), V = {
2196
+ COMPANY_ID: u.toString(),
2197
+ COMPANY_CODE: m.toLowerCase(),
2198
+ LANGUAGE: y,
2199
+ ACC_NAME: (v = f == null ? void 0 : f.INSTANCE) == null ? void 0 : v.toLowerCase(),
2200
+ TOKEN: D
2201
+ };
2202
+ try {
2203
+ const N = await ft(
2204
+ V,
2205
+ lt
2206
+ );
2207
+ if (!N || c.current || (o == null ? void 0 : o.current) >= Ae) {
2208
+ console.warn(
2209
+ `${ge} - Skipping WebSocket connection attempt.`
2210
+ );
2211
+ return;
2212
+ }
2213
+ n.current && n.current.close(), k(`${O}?t=${N}`);
2214
+ } catch (N) {
2215
+ console.error(
2216
+ `${ge} - Failed to encrypt token:`,
2217
+ N
2218
+ );
2219
+ }
2220
+ }, E = (g) => (u) => {
2221
+ var m;
2222
+ try {
2223
+ if ((u == null ? void 0 : u.data) === "PING")
2224
+ g.send("PONG");
2225
+ else {
2226
+ const { DATA: y, EVENT: p } = JSON.parse(u.data || "{}");
2227
+ !C.current && p === "USER_ONLINE_NOTIF" && Array.isArray(y == null ? void 0 : y.EMPLOYEES) && (s((m = y == null ? void 0 : y.EMPLOYEES) == null ? void 0 : m.filter(Boolean)), C.current = !0), p === "TOKEN_EXPIRED" && b({
2228
+ onSuccess: () => {
2229
+ x();
2230
+ }
2231
+ });
2232
+ }
2233
+ } catch {
2234
+ console.error(
2235
+ `${ge} - Invalid WebSocket message:`,
2236
+ u.data
2237
+ );
2238
+ }
2239
+ }, w = ({ event: g, data: u, module: m = "HELPDESK_CHAT" }) => {
2240
+ var y;
2241
+ (y = n == null ? void 0 : n.current) == null || y.send(
2242
+ JSON.stringify({
2243
+ EVENT: g,
2244
+ DATA: u,
2245
+ MODULE: m
2246
+ })
2247
+ );
2248
+ };
2249
+ return W(() => {
2250
+ C.current || x();
2251
+ }, []), /* @__PURE__ */ t(
2252
+ wn.Provider,
2253
+ {
2254
+ value: {
2255
+ ws: n == null ? void 0 : n.current,
2256
+ onSendMsg: w,
2257
+ userOnline: i,
2258
+ connectWebSocket: x,
2259
+ retryCountState: r,
2260
+ setRetryCountState: a,
2261
+ retryCountRef: o
2262
+ },
2263
+ children: e
2264
+ }
2265
+ );
2266
+ }, Ao = () => {
2267
+ var s;
2268
+ const { widgetProps: e } = I(), { listTicket: n, setTicketId: o, loadingListTicket: c } = te(), { onSendMsg: l } = ie(), { xs: i } = ne.useBreakpoint();
2269
+ return /* @__PURE__ */ h(Q, { children: [
2270
+ /* @__PURE__ */ t(ho, {}),
2271
+ c ? /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: (s = Array.from({ length: 5 })) == null ? void 0 : s.map((r, a) => /* @__PURE__ */ t(
2272
+ P.Input,
2273
+ {
2274
+ style: { height: 80, width: "100%", borderRadius: 8 }
2275
+ },
2276
+ a
2277
+ )) }) : /* @__PURE__ */ t(
2278
+ "div",
2279
+ {
2280
+ className: `w-list-ticket-container ${e != null && e.isSF ? "w-list-ticket-container-sf" : ""} ${i ? "w-list-ticket-container-mobile" : ""}`,
2281
+ ...(n == null ? void 0 : n.length) === 0 && {
2282
+ style: { justifyContent: "center" }
2283
+ },
2284
+ children: (n == null ? void 0 : n.length) > 0 ? n == null ? void 0 : n.map((r, a) => /* @__PURE__ */ $e(
2285
+ To,
2286
+ {
2287
+ ...r,
2288
+ key: a,
2289
+ onClick: () => {
2290
+ l({
2291
+ event: "JOIN_ROOM",
2292
+ data: {
2293
+ TASK_ID: r == null ? void 0 : r.TASK_ID
2294
+ }
2295
+ }), o(r == null ? void 0 : r.TASK_ID);
2296
+ }
2297
+ }
2298
+ )) : /* @__PURE__ */ t(
2299
+ "div",
2300
+ {
2301
+ style: {
2302
+ display: "flex",
2303
+ justifyContent: "center",
2304
+ alignItems: "center",
2305
+ flex: 1
2306
+ },
2307
+ children: /* @__PURE__ */ t(cn, {})
2308
+ }
2309
+ )
2310
+ }
2311
+ )
2312
+ ] });
2313
+ }, wo = S(Ao), Eo = ({ children: e, open: n, onClose: o, footer: c, styleContainer: l }) => {
2314
+ var T;
2315
+ const [i, s] = _(!1), r = B(), a = B(null), d = B(), f = L(() => n ? "w-fade-in-animate" : "w-fade-out-animate", [n]), C = (b) => {
2316
+ b.code === "Escape" && !b.shiftKey && !b.altKey && !b.ctrlKey && b.key === "Escape" && (b.stopPropagation(), typeof o == "function" && o());
2317
+ };
2318
+ return W(() => {
2319
+ const b = d.current;
2320
+ return b && (clearTimeout(a.current), a.current = setTimeout(() => {
2321
+ b == null || b.focus();
2322
+ }, 250), b == null || b.addEventListener("keydown", C)), n && s(!1), clearTimeout(r == null ? void 0 : r.current), r.current = setTimeout(() => {
2323
+ n || s(!0);
2324
+ }, 300), () => {
2325
+ b && (b == null || b.removeEventListener("keydown", C));
2326
+ };
2327
+ }, [n]), /* @__PURE__ */ h(
2328
+ "div",
2329
+ {
2330
+ className: `${f}`,
2331
+ tabIndex: 1,
2332
+ ref: d,
2333
+ style: {
2334
+ display: i ? "none" : "block",
2335
+ height: "100%",
2336
+ ...((T = Object == null ? void 0 : Object.keys(l || {})) == null ? void 0 : T.length) > 0 && {
2337
+ ...l
2338
+ }
2339
+ },
2340
+ children: [
2341
+ e,
2342
+ c && c
2343
+ ]
2344
+ }
2345
+ );
2346
+ }, En = S(Eo), Sn = de({}), he = () => ue(Sn), So = ({ children: e }) => {
2347
+ const [n, o] = _([]), [c, l] = _({}), [i, s] = _(!0), r = B(!1), a = De(), { ticketId: d } = te(), { ws: f } = ie(), C = L(() => {
2348
+ var m;
2349
+ const E = (c == null ? void 0 : c.CREATED_BY) ?? {}, w = (c == null ? void 0 : c.ASSIGNEE) ?? {}, g = (c == null ? void 0 : c.OTHER_ASSIGNEE) ?? [], u = (m = [E, w, ...g].map((y) => ({
2350
+ ...y
2351
+ }))) == null ? void 0 : m.filter((y) => {
2352
+ var p;
2353
+ return ((p = Object.keys(y || {})) == null ? void 0 : p.length) > 0;
2354
+ });
2355
+ return Ve({ ArrObj: u, key: "EMP_ID" });
2356
+ }, [c]), T = () => {
2357
+ var E, w;
2358
+ s(!0), (w = (E = a({
2359
+ endpoint: "/helpdesk/chat/list",
2360
+ method: "POST",
2361
+ data: {
2362
+ LIMIT: 10,
2363
+ PAGE: 1,
2364
+ TASK_ID: d
2365
+ }
2366
+ })) == null ? void 0 : E.then((g) => {
2367
+ var u, m, y, p, D, O;
2368
+ if (((y = (m = (u = g == null ? void 0 : g.data) == null ? void 0 : u.DATA) == null ? void 0 : m.LIST) == null ? void 0 : y.length) > 0) {
2369
+ const V = (O = (D = (p = g == null ? void 0 : g.data) == null ? void 0 : p.DATA) == null ? void 0 : D.LIST) == null ? void 0 : O.map((U) => ({
2370
+ ...U,
2371
+ ACTOR: {
2372
+ ...U == null ? void 0 : U.ACTOR
2373
+ }
2374
+ }));
2375
+ o(Le(V));
2376
+ } else
2377
+ o({});
2378
+ })) == null || w.finally(() => {
2379
+ s(!1);
2380
+ });
2381
+ }, b = () => {
2382
+ var E;
2383
+ (E = a({
2384
+ endpoint: "/helpdesk/myticket/get",
2385
+ method: "POST",
2386
+ data: {
2387
+ TASK_ID: d
2388
+ }
2389
+ })) == null || E.then((w) => {
2390
+ var g, u, m;
2391
+ if ((g = w == null ? void 0 : w.data) != null && g.DATA) {
2392
+ const y = (m = (u = w == null ? void 0 : w.data) == null ? void 0 : u.DATA) == null ? void 0 : m.LIST;
2393
+ l(y);
2394
+ } else
2395
+ l({});
2396
+ });
2397
+ }, k = (E) => {
2398
+ r.current || o((w) => {
2399
+ const u = [...ze(w), { ...E, CHAT_ALIGN: "from" }];
2400
+ return Le(u);
2401
+ }), r.current = !1;
2402
+ }, x = (E) => {
2403
+ if ((E == null ? void 0 : E.data) !== "PING") {
2404
+ const w = JSON.parse((E == null ? void 0 : E.data) || "{}"), { DATA: g = {}, EVENT: u = "" } = w ?? {};
2405
+ (u === "RECEIVE_MESSAGE" || u === "RECEIVE_ANOTHER_MESSAGE") && k(g);
2406
+ }
2407
+ };
2408
+ return W(() => (d && (T(), b()), f && d && (f == null || f.addEventListener("message", x)), () => {
2409
+ f && d && (f == null || f.removeEventListener("message", x));
2410
+ }), [d]), /* @__PURE__ */ t(
2411
+ Sn.Provider,
2412
+ {
2413
+ value: {
2414
+ chats: n,
2415
+ setChats: o,
2416
+ detailTicket: c,
2417
+ employees: C,
2418
+ isFromSelf: r,
2419
+ loadingChats: i
2420
+ },
2421
+ children: e
2422
+ }
2423
+ );
2424
+ }, xo = () => {
2425
+ const { xs: e } = ne.useBreakpoint(), { employees: n, detailTicket: o, loadingChats: c } = he(), { setTicketId: l } = te(), { userOnline: i } = ie(), s = L(() => {
2426
+ var a;
2427
+ return (a = n == null ? void 0 : n.map((d) => d == null ? void 0 : d.FULL_NAME)) == null ? void 0 : a.join(", ");
2428
+ }, [n]), r = L(() => e ? "click" : "hover", [e]);
2429
+ return c ? /* @__PURE__ */ h("div", { className: "w-ticket-detail-header-container", children: [
2430
+ /* @__PURE__ */ t(P.Avatar, {}),
2431
+ /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
2432
+ /* @__PURE__ */ t(P.Input, {}),
2433
+ /* @__PURE__ */ t(P.Input, { size: "small" })
2434
+ ] }),
2435
+ /* @__PURE__ */ t(P.Input, {})
2436
+ ] }) : /* @__PURE__ */ h("div", { className: "w-ticket-detail-header-container", children: [
2437
+ /* @__PURE__ */ h("div", { style: { display: "flex", gap: 8 }, children: [
2438
+ /* @__PURE__ */ t(
2439
+ R,
2440
+ {
2441
+ icon: /* @__PURE__ */ t(K, { type: "down" }),
2442
+ style: { border: "none" },
2443
+ onClick: () => {
2444
+ l("");
2445
+ }
2446
+ }
2447
+ ),
2448
+ /* @__PURE__ */ t(
2449
+ ae.Group,
2450
+ {
2451
+ maxCount: 2,
2452
+ maxPopoverTrigger: r,
2453
+ maxStyle: {
2454
+ color: "#f56a00",
2455
+ backgroundColor: "#fde3cf",
2456
+ cursor: "pointer"
2457
+ },
2458
+ children: n == null ? void 0 : n.map((a, d) => {
2459
+ const f = i == null ? void 0 : i.includes(a == null ? void 0 : a.EMP_ID);
2460
+ return /* @__PURE__ */ t(me, { title: a == null ? void 0 : a.FULL_NAME, trigger: r, children: /* @__PURE__ */ $e(
2461
+ ae,
2462
+ {
2463
+ ...f && {
2464
+ style: {
2465
+ border: "2px solid green",
2466
+ borderRadius: "50%"
2467
+ }
2468
+ },
2469
+ src: a == null ? void 0 : a.PHOTO,
2470
+ key: d,
2471
+ nameFallback: a == null ? void 0 : a.FULL_NAME
2472
+ }
2473
+ ) }, d);
2474
+ })
2475
+ }
2476
+ ),
2477
+ /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "column", width: 150 }, children: [
2478
+ /* @__PURE__ */ t(
2479
+ me,
2480
+ {
2481
+ title: `${o == null ? void 0 : o.TASK_CODE} - ${o == null ? void 0 : o.SUBJECT}`,
2482
+ trigger: r,
2483
+ children: /* @__PURE__ */ h(F.Text, { className: "w-ticket-detail-header-text", children: [
2484
+ o == null ? void 0 : o.TASK_CODE,
2485
+ " - ",
2486
+ o == null ? void 0 : o.SUBJECT
2487
+ ] })
2488
+ }
2489
+ ),
2490
+ /* @__PURE__ */ t(me, { title: s, trigger: r, children: /* @__PURE__ */ t(
2491
+ F.Text,
2492
+ {
2493
+ type: "secondary",
2494
+ className: "w-ticket-detail-header-text",
2495
+ style: {
2496
+ fontSize: 12
2497
+ },
2498
+ children: s
2499
+ }
2500
+ ) })
2501
+ ] })
2502
+ ] }),
2503
+ /* @__PURE__ */ t(hn, { taskStatus: o == null ? void 0 : o.STATUS })
2504
+ ] });
2505
+ }, Lo = S(xo), vo = ({ ...e }) => {
2506
+ const n = L(() => (e == null ? void 0 : e.CHAT_ALIGN) === "to" ? "client" : "response", [e]);
2507
+ return /* @__PURE__ */ h("div", { className: `w-bubble-chat ${`w-${n}`}`, children: [
2508
+ /* @__PURE__ */ t(
2509
+ "p",
2510
+ {
2511
+ dangerouslySetInnerHTML: {
2512
+ __html: e == null ? void 0 : e.MESSAGE
2513
+ }
2514
+ }
2515
+ ),
2516
+ /* @__PURE__ */ t(
2517
+ xe,
2518
+ {
2519
+ date: e == null ? void 0 : e.CREATED_DATE,
2520
+ format: _e,
2521
+ sender: n
2522
+ }
2523
+ )
2524
+ ] });
2525
+ }, _o = S(vo), po = ({ ...e }) => {
2526
+ const n = A("Download", "Download"), o = L(() => (e == null ? void 0 : e.CHAT_ALIGN) === "to" ? "client" : "response", [e]), c = L(() => {
2527
+ var a;
2528
+ const r = e == null ? void 0 : e.ATTACHMENT;
2529
+ if (r)
2530
+ try {
2531
+ const d = new URL(r), f = (a = d == null ? void 0 : d.pathname) == null ? void 0 : a.split("/");
2532
+ return f == null ? void 0 : f[(f == null ? void 0 : f.length) - 1];
2533
+ } catch {
2534
+ return r;
2535
+ }
2536
+ return "";
2537
+ }, [e]), l = L(() => {
2538
+ if (c != null && c.includes(".")) {
2539
+ const r = c == null ? void 0 : c.split(".");
2540
+ return `.${r == null ? void 0 : r[(r == null ? void 0 : r.length) - 1]}`;
2541
+ }
2542
+ return "";
2543
+ }, [e, c]), i = L(() => Ne == null ? void 0 : Ne.includes(l), [e, l]), s = () => {
2544
+ We({
2545
+ downloadURL: e == null ? void 0 : e.ATTACHMENT,
2546
+ fileName: c,
2547
+ isOpenNewTab: !0
2548
+ });
2549
+ };
2550
+ return /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ h(
2551
+ "div",
2552
+ {
2553
+ className: `w-bubble-chat ${`w-${o}`}`,
2554
+ style: { display: "flex", flexDirection: "column" },
2555
+ children: [
2556
+ i ? /* @__PURE__ */ t(Ke, { src: e == null ? void 0 : e.ATTACHMENT, fallback: st }) : /* @__PURE__ */ h("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
2557
+ /* @__PURE__ */ t(K, { type: "file" }),
2558
+ /* @__PURE__ */ t(
2559
+ F.Link,
2560
+ {
2561
+ onClick: s,
2562
+ style: { display: "block", width: 160 },
2563
+ children: c
2564
+ }
2565
+ )
2566
+ ] }),
2567
+ i && /* @__PURE__ */ t(
2568
+ R,
2569
+ {
2570
+ onClick: s,
2571
+ style: {
2572
+ display: "block",
2573
+ margin: "10px auto 0px"
2574
+ },
2575
+ children: n
2576
+ }
2577
+ ),
2578
+ /* @__PURE__ */ t(
2579
+ xe,
2580
+ {
2581
+ date: e == null ? void 0 : e.CREATED_DATE,
2582
+ format: _e,
2583
+ ...o === "client" && {
2584
+ style: {
2585
+ alignSelf: "flex-end"
2586
+ }
2587
+ }
2588
+ }
2589
+ )
2590
+ ]
2591
+ }
2592
+ ) });
2593
+ }, Do = S(po), Oo = ({ ...e }) => {
2594
+ const n = L(() => (e == null ? void 0 : e.CHAT_ALIGN) === "to" ? "client" : "response", [e]);
2595
+ return /* @__PURE__ */ h("div", { className: "w-ticket-info-chat-container", children: [
2596
+ /* @__PURE__ */ t(
2597
+ xe,
2598
+ {
2599
+ date: e == null ? void 0 : e.CREATED_DATE,
2600
+ format: _e,
2601
+ sender: n
2602
+ }
2603
+ ),
2604
+ /* @__PURE__ */ t(F.Text, { children: e == null ? void 0 : e.MESSAGE })
2605
+ ] });
2606
+ }, No = S(Oo), xn = () => {
2607
+ const { widgetProps: e } = I(), n = fe.enc.Hex.parse(
2608
+ fe.enc.Utf8.parse(e == null ? void 0 : e.keyEncrypt).toString()
2609
+ ), o = {
2610
+ mode: fe.mode.ECB,
2611
+ padding: fe.pad.Pkcs7
2612
+ }, c = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|GreatDayHR/i.test(
2613
+ navigator.userAgent
2614
+ ), l = (s) => {
2615
+ if (typeof s == "number" && (s = s.toString()), !s) return "";
2616
+ if (c) return window.encodeURIComponent(s);
2617
+ const r = fe.enc.Utf8.parse(s), a = fe.AES.encrypt(
2618
+ r,
2619
+ n,
2620
+ o
2621
+ ).toString();
2622
+ return window.encodeURIComponent(`$${a}`);
2623
+ };
2624
+ return {
2625
+ paramsEncrypt: (s) => {
2626
+ const [r, a = null] = s.split("?"), d = r.split("/").map((f) => {
2627
+ const [, C = null] = f.split(":");
2628
+ return C && (e != null && e.keyEncrypt) ? l(C) : f;
2629
+ }).join("/");
2630
+ return a ? `${d}?${a}` : d;
2631
+ },
2632
+ encrypt: l
2633
+ };
2634
+ }, Mo = ({ ...e }) => {
2635
+ const n = A("ViewFAQ", "View FAQ"), o = A(
2636
+ "FAQUnavailable",
2637
+ "FAQ unavailable"
2638
+ ), c = A(
2639
+ "ThisFAQIsUnavailable",
2640
+ "This FAQ is unavailable"
2641
+ ), { paramsEncrypt: l } = xn(), { history: i } = I(), s = L(() => (e == null ? void 0 : e.CHAT_ALIGN) === "to" ? "client" : "response", [e]), r = L(() => e == null ? void 0 : e.FAQ_ID, [e]);
2642
+ return /* @__PURE__ */ h("div", { className: `w-bubble-chat ${`w-${s}`}`, children: [
2643
+ /* @__PURE__ */ t(
2644
+ F.Text,
2645
+ {
2646
+ style: {
2647
+ backgroundColor: "rgb(244, 245, 246)",
2648
+ padding: 8,
2649
+ borderRadius: 8,
2650
+ fontWeight: 600,
2651
+ marginBottom: 8,
2652
+ display: "block"
2653
+ },
2654
+ children: r ? e == null ? void 0 : e.MESSAGE : o
2655
+ }
2656
+ ),
2657
+ r ? /* @__PURE__ */ t(
2658
+ R,
2659
+ {
2660
+ block: !0,
2661
+ onClick: () => {
2662
+ typeof i < "u" && i.push(
2663
+ l(`/standard/hrm.helpdesk.FAQ-detail/:${r}`)
2664
+ );
2665
+ },
2666
+ children: n
2667
+ }
2668
+ ) : /* @__PURE__ */ t(F.Text, { children: c }),
2669
+ /* @__PURE__ */ t(
2670
+ xe,
2671
+ {
2672
+ date: e == null ? void 0 : e.CREATED_DATE,
2673
+ format: _e,
2674
+ sender: s
2675
+ }
2676
+ )
2677
+ ] });
2678
+ }, Ro = S(Mo), Fo = ({ ...e }) => {
2679
+ switch (e == null ? void 0 : e.CHAT_TYPE) {
2680
+ case "info":
2681
+ return /* @__PURE__ */ t(No, { ...e });
2682
+ case "faq":
2683
+ return /* @__PURE__ */ t(Ro, { ...e });
2684
+ case "chat":
2685
+ return e != null && e.ATTACHMENT ? /* @__PURE__ */ t(Do, { ...e }) : /* @__PURE__ */ t(_o, { ...e });
2686
+ default:
2687
+ return null;
2688
+ }
2689
+ }, Ho = S(Fo), Bo = () => {
2690
+ const { employees: e } = he(), [n, o] = _([]), c = A("And", "and"), l = A("IsTyping", "Is Typing"), i = A("People", "People"), { ws: s } = ie(), r = L(() => {
2691
+ const d = n == null ? void 0 : n.map((f) => f == null ? void 0 : f.FULL_NAME);
2692
+ if ((n == null ? void 0 : n.length) > 2) {
2693
+ const f = d == null ? void 0 : d.filter((T, b) => b <= 1), C = d == null ? void 0 : d.filter((T, b) => b > 1);
2694
+ return `${f == null ? void 0 : f.join(", ")}, ${c} ${C == null ? void 0 : C.length} ${i} ${l}`;
2695
+ }
2696
+ return `${d == null ? void 0 : d.join(", ")} ${l}`;
2697
+ }, [n]), a = (d) => {
2698
+ if ((d == null ? void 0 : d.data) !== "PING") {
2699
+ const f = JSON.parse((d == null ? void 0 : d.data) || "{}"), { DATA: C = {}, EVENT: T = "" } = f ?? {};
2700
+ if (T === "TYPING") {
2701
+ const b = e == null ? void 0 : e.find(
2702
+ (x) => (x == null ? void 0 : x.EMP_ID) === (C == null ? void 0 : C.EMPLOYEE_ID)
2703
+ ), k = {
2704
+ ...C,
2705
+ ...b
2706
+ };
2707
+ o((x) => {
2708
+ const E = [...x, k], w = Ve({
2709
+ ArrObj: E,
2710
+ key: "EMPLOYEE_ID"
2711
+ });
2712
+ return w == null ? void 0 : w.filter((g) => g == null ? void 0 : g.IS_TYPING);
2713
+ });
2714
+ }
2715
+ }
2716
+ };
2717
+ return W(() => (s && (s == null || s.addEventListener("message", a)), () => {
2718
+ s && (s == null || s.removeEventListener("message", a));
2719
+ }), [e]), (n == null ? void 0 : n.length) === 0 ? null : /* @__PURE__ */ h(
2720
+ "div",
2721
+ {
2722
+ style: {
2723
+ display: "flex",
2724
+ gap: 8,
2725
+ alignItems: "center"
2726
+ },
2727
+ children: [
2728
+ /* @__PURE__ */ t(
2729
+ ae.Group,
2730
+ {
2731
+ maxCount: 2,
2732
+ maxPopoverTrigger: "click",
2733
+ maxStyle: {
2734
+ color: "#f56a00",
2735
+ backgroundColor: "#fde3cf",
2736
+ cursor: "pointer"
2737
+ },
2738
+ children: n == null ? void 0 : n.map((d, f) => /* @__PURE__ */ t(me, { title: d == null ? void 0 : d.FULL_NAME, children: /* @__PURE__ */ t(ae, { src: d == null ? void 0 : d.PHOTO, nameFallback: d == null ? void 0 : d.FULL_NAME }) }, f))
2739
+ }
2740
+ ),
2741
+ /* @__PURE__ */ t(F.Text, { children: r }),
2742
+ (n == null ? void 0 : n.length) > 0 ? /* @__PURE__ */ t(yn, {}) : null
2743
+ ]
2744
+ }
2745
+ );
2746
+ }, $o = S(Bo), Io = () => {
2747
+ var i;
2748
+ const { chats: e } = he(), { widgetProps: n } = I(), { activeTab: o } = le(), c = B(), { xs: l } = ne.useBreakpoint();
2749
+ return W(() => {
2750
+ clearTimeout(c.current), c.current = setTimeout(() => {
2751
+ se(".w-ticket-detail-content-container");
2752
+ }, 350);
2753
+ }, [o]), /* @__PURE__ */ h(
2754
+ "div",
2755
+ {
2756
+ className: `w-ticket-detail-content-container ${l ? n != null && n.isSF ? "w-ticket-detail-content-container-sf-mobile" : "w-ticket-detail-content-container-mobile" : ""} `,
2757
+ children: [
2758
+ (i = Object.keys(e || {})) == null ? void 0 : i.map((s) => {
2759
+ var a, d;
2760
+ const r = e == null ? void 0 : e[s];
2761
+ return /* @__PURE__ */ h(He, { children: [
2762
+ /* @__PURE__ */ t("div", { className: "w-datekey-chats", children: (a = j(s)) == null ? void 0 : a.format("ddd, DD MMMM YYYY") }),
2763
+ /* @__PURE__ */ t("div", { className: "w-bubble-chat-container", children: (d = dn(r)) == null ? void 0 : d.map((f, C) => {
2764
+ var k, x;
2765
+ const T = (f == null ? void 0 : f.CHAT_ALIGN) === "to" ? "client" : "response", b = f == null ? void 0 : f.CHAT_TYPE;
2766
+ return /* @__PURE__ */ h(He, { children: [
2767
+ T === "response" && b !== "info" && /* @__PURE__ */ t(
2768
+ Se,
2769
+ {
2770
+ src: (k = f == null ? void 0 : f.ACTOR) == null ? void 0 : k.PHOTO,
2771
+ name: (x = f == null ? void 0 : f.ACTOR) == null ? void 0 : x.FULL_NAME
2772
+ }
2773
+ ),
2774
+ /* @__PURE__ */ t(Ho, { ...f })
2775
+ ] }, C);
2776
+ }) })
2777
+ ] }, s);
2778
+ }),
2779
+ /* @__PURE__ */ t($o, {})
2780
+ ]
2781
+ }
2782
+ );
2783
+ }, Uo = S(Io), Wo = () => {
2784
+ var i, s;
2785
+ const { chats: e, loadingChats: n } = he(), { widgetProps: o } = I(), { xs: c } = ne.useBreakpoint(), l = L(() => {
2786
+ var a;
2787
+ const r = [Re];
2788
+ return c && (o != null && o.isSF ? r == null || r.push(
2789
+ `${Re}-sf-mobile`
2790
+ ) : r == null || r.push(`${Re}-mobile`)), (a = r == null ? void 0 : r.filter(Boolean)) == null ? void 0 : a.join(" ");
2791
+ }, [c, o == null ? void 0 : o.isSF]);
2792
+ return n ? /* @__PURE__ */ t(
2793
+ "div",
2794
+ {
2795
+ className: `${l} w-ticket-detail-loading-chats`,
2796
+ children: (i = Array.from({ length: 3 })) == null ? void 0 : i.map((r, a) => {
2797
+ const d = a % 2 === 0;
2798
+ return /* @__PURE__ */ h(
2799
+ "div",
2800
+ {
2801
+ style: {
2802
+ display: "flex",
2803
+ gap: 8,
2804
+ ...d && {
2805
+ alignSelf: "flex-end"
2806
+ }
2807
+ },
2808
+ children: [
2809
+ /* @__PURE__ */ t("div", { style: { order: d ? 2 : 1 }, children: /* @__PURE__ */ t(P.Avatar, {}) }),
2810
+ /* @__PURE__ */ h(
2811
+ "div",
2812
+ {
2813
+ style: {
2814
+ display: "flex",
2815
+ flexDirection: "column",
2816
+ gap: 8,
2817
+ order: d ? 1 : 2
2818
+ },
2819
+ children: [
2820
+ /* @__PURE__ */ t(P.Input, { style: { width: 120, borderRadius: 8 } }),
2821
+ /* @__PURE__ */ t(
2822
+ P.Input,
2823
+ {
2824
+ style: { height: 50, width: "100%", borderRadius: 8 }
2825
+ }
2826
+ )
2827
+ ]
2828
+ }
2829
+ )
2830
+ ]
2831
+ },
2832
+ a
2833
+ );
2834
+ })
2835
+ }
2836
+ ) : ((s = Object.keys(e || {})) == null ? void 0 : s.length) === 0 ? /* @__PURE__ */ t(
2837
+ "div",
2838
+ {
2839
+ className: l,
2840
+ style: {
2841
+ display: "flex",
2842
+ justifyContent: "center",
2843
+ alignItems: "center"
2844
+ },
2845
+ children: /* @__PURE__ */ t(cn, {})
2846
+ }
2847
+ ) : /* @__PURE__ */ t(Uo, {});
2848
+ }, Vo = S(Wo), zo = ({ ...e }) => {
2849
+ const n = B(0);
2850
+ return /* @__PURE__ */ h(
2851
+ "div",
2852
+ {
2853
+ style: { display: "flex", gap: 8 },
2854
+ onClick: (o) => {
2855
+ o == null || o.stopPropagation();
2856
+ },
2857
+ children: [
2858
+ /* @__PURE__ */ t(
2859
+ Ke,
2860
+ {
2861
+ nameFallback: e == null ? void 0 : e.FULL_NAME,
2862
+ src: e == null ? void 0 : e.PHOTO,
2863
+ width: 80,
2864
+ placeholder: /* @__PURE__ */ t(P.Image, { style: { width: "100%", height: "100%" } }),
2865
+ style: { borderRadius: 8 },
2866
+ preview: !1,
2867
+ loading: "lazy",
2868
+ onError: (o) => {
2869
+ n.current += 1, (n == null ? void 0 : n.current) < 3 ? o.target.src = un(e == null ? void 0 : e.PHOTO) : o.target.src = Ge(e == null ? void 0 : e.FULL_NAME);
2870
+ }
2871
+ }
2872
+ ),
2873
+ /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
2874
+ /* @__PURE__ */ t(F.Text, { strong: !0, style: { fontSize: 18 }, children: e == null ? void 0 : e.FULL_NAME }),
2875
+ /* @__PURE__ */ t(F.Text, { children: e == null ? void 0 : e.POSITION_NAME }, e == null ? void 0 : e.POSITION_NAME),
2876
+ /* @__PURE__ */ t(F.Text, { children: e == null ? void 0 : e.DEPT_NAME }),
2877
+ /* @__PURE__ */ t(F.Text, { children: e == null ? void 0 : e.WORKLOCATION })
2878
+ ] })
2879
+ ]
2880
+ }
2881
+ );
2882
+ }, Go = S(zo), Ko = ({ setLoadingUpload: e, isLoadingUpload: n }) => {
2883
+ var w, g;
2884
+ const o = De(), [c, l] = _({}), i = B(null), s = A(
2885
+ "ImageMustSmallerThan",
2886
+ "Image must smaller than"
2887
+ ), r = A(
2888
+ "MaximumFileSizeExceeded",
2889
+ "Maximum file size exceeded"
2890
+ ), { onSendMsg: a } = ie(), { employees: d, setChats: f, isFromSelf: C } = he(), { ticketId: T } = te(), { activeTab: b } = le(), k = () => {
2891
+ var u;
2892
+ (u = o({
2893
+ endpoint: "/upload/get-upload-config",
2894
+ data: {
2895
+ LIMIT: 1,
2896
+ PAGE: 1,
2897
+ SEARCH: {
2898
+ UPLOAD_CODE: "helpdesk"
2899
+ }
2900
+ }
2901
+ })) == null || u.then((m) => {
2902
+ var p, D;
2903
+ const y = (D = (p = m == null ? void 0 : m.data) == null ? void 0 : p.DATA) == null ? void 0 : D.LIST;
2904
+ (y == null ? void 0 : y.length) > 0 && l(y == null ? void 0 : y[0]);
2905
+ });
2906
+ }, x = (u) => {
2907
+ var p, D, O;
2908
+ const m = u.size / 1024 / 1024, y = (c == null ? void 0 : c.MAXFILESIZE) / 1024;
2909
+ return m > y && ((p = ce) == null || p.destroy(), (D = ce) == null || D.config({
2910
+ getContainer: () => document.querySelector(".w-widget-content-container"),
2911
+ top: 28,
2912
+ placement: "top"
2913
+ }), (O = ce) == null || O.error({
2914
+ message: r,
2915
+ description: `${s} ${y == null ? void 0 : y.toFixed(
2916
+ 1
2917
+ )} MB!`,
2918
+ className: "w-notification-content",
2919
+ duration: 3
2920
+ })), !1;
2921
+ }, E = (u) => {
2922
+ var y, p;
2923
+ e(!0);
2924
+ const m = new FormData();
2925
+ m.append("UPLOAD_CODE", c == null ? void 0 : c.UPLOAD_CODE), m.append("UPLOAD_TYPE", c == null ? void 0 : c.UPLOAD_TYPE), m.append("FILE", u), (p = (y = o({
2926
+ endpoint: "/upload/temp",
2927
+ data: m,
2928
+ headers: {
2929
+ "Content-Type": "multipart/form-data"
2930
+ }
2931
+ })) == null ? void 0 : y.then((D) => {
2932
+ var O, V, U, H, v;
2933
+ if ((V = (O = D == null ? void 0 : D.data) == null ? void 0 : O.DATA) != null && V.LIST) {
2934
+ const N = (H = (U = D == null ? void 0 : D.data) == null ? void 0 : U.DATA) == null ? void 0 : H.LIST, z = {
2935
+ ATTACHMENT: N == null ? void 0 : N.VIEW_PATH,
2936
+ FAQ_ID: null,
2937
+ MESSAGE: "",
2938
+ CREATED_DATE: (v = j()) == null ? void 0 : v.format(`${Ue} HH:mm:ss`),
2939
+ CHAT_ALIGN: "to",
2940
+ CHAT_TYPE: "chat"
2941
+ };
2942
+ f((M) => {
2943
+ const G = [...ze(M), z];
2944
+ return Le(G);
2945
+ }), C.current = !0, a({
2946
+ event: "SEND_MESSAGE",
2947
+ data: {
2948
+ ATTACHMENT: N == null ? void 0 : N.TEMP_PATH,
2949
+ FAQ_ID: null,
2950
+ MESSAGE: "",
2951
+ EMPLOYEES: d == null ? void 0 : d.map((M) => M == null ? void 0 : M.EMP_ID),
2952
+ TASK_ID: T
2953
+ }
2954
+ }), clearTimeout(i.current), i.current = setTimeout(() => {
2955
+ se(".w-ticket-detail-content-container");
2956
+ }, 350);
2957
+ }
2958
+ })) == null || p.finally(() => {
2959
+ e(!1);
2960
+ });
2961
+ };
2962
+ return W(() => {
2963
+ k();
2964
+ }, []), W(() => {
2965
+ var u;
2966
+ (u = ce) == null || u.destroy();
2967
+ }, [b]), /* @__PURE__ */ t(
2968
+ on,
2969
+ {
2970
+ beforeUpload: x,
2971
+ fileList: [],
2972
+ accept: (g = (w = c == null ? void 0 : c.EXT_LIST) == null ? void 0 : w.split(",")) == null ? void 0 : g.map((u) => `.${u}`),
2973
+ onChange: (u) => {
2974
+ E(u == null ? void 0 : u.file);
2975
+ },
2976
+ children: /* @__PURE__ */ t(
2977
+ R,
2978
+ {
2979
+ loading: n,
2980
+ icon: /* @__PURE__ */ t(K, { type: "paper-clip" }),
2981
+ shape: "circle",
2982
+ style: { border: "none" }
2983
+ }
2984
+ )
2985
+ }
2986
+ );
2987
+ }, Yo = S(Ko), qo = ({ refInput: e }) => {
2988
+ const { xs: n } = ne.useBreakpoint(), o = L(() => n ? "click" : "hover", [n]), c = () => {
2989
+ var T;
2990
+ const i = (T = e == null ? void 0 : e.current) == null ? void 0 : T.textarea;
2991
+ if (!i)
2992
+ return !1;
2993
+ const { selectionStart: s, selectionEnd: r, value: a } = i, d = a == null ? void 0 : a.substring(0, s), f = a == null ? void 0 : a.substring(s, r), C = a == null ? void 0 : a.substring(r);
2994
+ return {
2995
+ before: d,
2996
+ selectedText: f,
2997
+ after: C,
2998
+ selectionStart: s,
2999
+ selectionEnd: r,
3000
+ text: a
3001
+ };
3002
+ }, l = (i) => {
3003
+ var C, T;
3004
+ (C = e == null ? void 0 : e.current) == null || C.focus();
3005
+ const s = (T = e == null ? void 0 : e.current) == null ? void 0 : T.textarea, r = i == null ? void 0 : i.native;
3006
+ if (!s) return;
3007
+ const { before: a, after: d } = c(), f = `${a}${r}${d}`;
3008
+ typeof document.execCommand == "function" ? document.execCommand("insertText", !1, r) : s.value = f;
3009
+ };
3010
+ return /* @__PURE__ */ t(
3011
+ Ie,
3012
+ {
3013
+ trigger: o,
3014
+ content: /* @__PURE__ */ t(
3015
+ Qn,
3016
+ {
3017
+ onEmojiSelect: (i) => {
3018
+ l(i);
3019
+ },
3020
+ theme: "auto"
3021
+ }
3022
+ ),
3023
+ children: /* @__PURE__ */ t(R, { icon: /* @__PURE__ */ t(K, { type: "smile" }), style: { border: "none" } })
3024
+ }
3025
+ );
3026
+ }, Qo = S(qo), Zo = () => {
3027
+ const [e, n] = _(0), [o, c] = _(!1), l = B(null), i = B(null), s = B(!1), r = B(null), { onSendMsg: a } = ie(), { ticketId: d } = te(), { isActiveTabVA: f } = le(), { employees: C, setChats: T, isFromSelf: b, detailTicket: k } = he(), x = L(() => {
3028
+ var u;
3029
+ return ((u = k == null ? void 0 : k.STATUS) == null ? void 0 : u.toString().toLowerCase()) === "closed";
3030
+ }, [k == null ? void 0 : k.STATUS]), E = L(() => C == null ? void 0 : C.map((u) => ({
3031
+ ...u,
3032
+ label: /* @__PURE__ */ t(
3033
+ Ie,
3034
+ {
3035
+ placement: "left",
3036
+ content: /* @__PURE__ */ t(Go, { ...u }),
3037
+ children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(Se, { src: u == null ? void 0 : u.PHOTO, name: u == null ? void 0 : u.FULL_NAME }) })
3038
+ }
3039
+ ),
3040
+ value: u == null ? void 0 : u.FULL_NAME
3041
+ })), [C]), w = () => {
3042
+ var y, p, D;
3043
+ const u = (p = (y = l == null ? void 0 : l.current) == null ? void 0 : y.textarea) == null ? void 0 : p.value;
3044
+ a({
3045
+ event: "SEND_MESSAGE",
3046
+ data: {
3047
+ ATTACHMENT: "",
3048
+ FAQ_ID: null,
3049
+ MESSAGE: u,
3050
+ EMPLOYEES: C == null ? void 0 : C.map((O) => O == null ? void 0 : O.EMP_ID),
3051
+ TASK_ID: d
3052
+ }
3053
+ });
3054
+ const m = {
3055
+ ATTACHMENT: "",
3056
+ FAQ_ID: null,
3057
+ MESSAGE: u,
3058
+ CREATED_DATE: (D = j()) == null ? void 0 : D.format(`${Ue} HH:mm:ss`),
3059
+ CHAT_ALIGN: "to",
3060
+ CHAT_TYPE: "chat"
3061
+ };
3062
+ T((O) => {
3063
+ const U = [...ze(O), m];
3064
+ return Le(U);
3065
+ }), b.current = !0, se(".w-ticket-detail-content-container"), n((O) => O + 1);
3066
+ }, g = () => {
3067
+ window.clearTimeout(i.current), s.current || (s.current = !0, a({
3068
+ event: "TYPING",
3069
+ data: {
3070
+ TASK_ID: d,
3071
+ IS_TYPING: !0
3072
+ }
3073
+ })), i.current = setTimeout(() => {
3074
+ a({
3075
+ event: "TYPING",
3076
+ data: {
3077
+ TASK_ID: d,
3078
+ IS_TYPING: !1
3079
+ }
3080
+ }), s.current = !1;
3081
+ }, 250);
3082
+ };
3083
+ return W(() => {
3084
+ l != null && l.current && !f && d && (clearTimeout(r.current), r.current = setTimeout(() => {
3085
+ var u;
3086
+ (u = l == null ? void 0 : l.current) == null || u.focus();
3087
+ }, 500));
3088
+ }, [f, d]), x ? null : /* @__PURE__ */ h(
3089
+ "div",
3090
+ {
3091
+ className: "w-input-container",
3092
+ style: {
3093
+ margin: 0
3094
+ },
3095
+ children: [
3096
+ /* @__PURE__ */ t(Qo, { refInput: l }),
3097
+ /* @__PURE__ */ t(
3098
+ Yo,
3099
+ {
3100
+ setLoadingUpload: c,
3101
+ isLoadingUpload: o
3102
+ }
3103
+ ),
3104
+ /* @__PURE__ */ t(
3105
+ Xe,
3106
+ {
3107
+ autoSize: {
3108
+ maxRows: 3
3109
+ },
3110
+ ref: l,
3111
+ className: "w-input-helpdesk",
3112
+ placeholder: "Type a message...",
3113
+ onChange: () => {
3114
+ g();
3115
+ },
3116
+ onKeyDown: (u) => {
3117
+ ((u == null ? void 0 : u.code) === "Enter" || (u == null ? void 0 : u.key) === "Enter") && !(u != null && u.shiftKey) && w();
3118
+ },
3119
+ filterOption: (u, m) => {
3120
+ var D, O, V;
3121
+ const y = (D = u == null ? void 0 : u.toString()) == null ? void 0 : D.toLowerCase(), p = (V = (O = m == null ? void 0 : m.FULL_NAME) == null ? void 0 : O.toString()) == null ? void 0 : V.toLowerCase();
3122
+ return p == null ? void 0 : p.includes(y);
3123
+ },
3124
+ children: E == null ? void 0 : E.map((u, m) => /* @__PURE__ */ t(Xe.Option, { ...u, children: u == null ? void 0 : u.label }, m))
3125
+ },
3126
+ e
3127
+ ),
3128
+ /* @__PURE__ */ t(
3129
+ R,
3130
+ {
3131
+ loading: o,
3132
+ disabled: o,
3133
+ className: "w-send-btn ",
3134
+ style: { backgroundColor: "var(--primary-color, #395ebc)" },
3135
+ icon: /* @__PURE__ */ t(K, { type: "send" }),
3136
+ shape: "circle",
3137
+ onClick: w
3138
+ }
3139
+ )
3140
+ ]
3141
+ }
3142
+ );
3143
+ }, Jo = S(Zo), Xo = ({ title: e, subTitle: n, onClose: o, open: c, styleWrapper: l }) => {
3144
+ var i;
3145
+ return c ? /* @__PURE__ */ t(
3146
+ "div",
3147
+ {
3148
+ className: "w-banner-container",
3149
+ ...((i = Object.keys(l || {})) == null ? void 0 : i.length) > 0 && {
3150
+ style: l
3151
+ },
3152
+ children: /* @__PURE__ */ h("div", { className: "w-banner-content", children: [
3153
+ e && /* @__PURE__ */ t(F.Text, { style: { fontSize: 16, fontWeight: 600 }, children: e }),
3154
+ n && /* @__PURE__ */ t("div", { className: "w-banner-subtitle", children: n }),
3155
+ typeof o == "function" && /* @__PURE__ */ t("div", { className: "w-banner-close-btn", children: /* @__PURE__ */ t(
3156
+ R,
3157
+ {
3158
+ style: { border: "none", background: "transparent" },
3159
+ icon: /* @__PURE__ */ t(K, { type: "close" }),
3160
+ onClick: () => o()
3161
+ }
3162
+ ) })
3163
+ ] })
3164
+ }
3165
+ ) : null;
3166
+ }, Ln = S(Xo), jo = () => {
3167
+ const e = A(
3168
+ "ForMoreInformationOfThisTicket",
3169
+ "For more information of this ticket"
3170
+ ), n = A("ClickHere", "Click here"), { ticketId: o } = te(), { history: c } = I(), { encrypt: l } = xn();
3171
+ return /* @__PURE__ */ t(
3172
+ Ln,
3173
+ {
3174
+ subTitle: /* @__PURE__ */ h(Q, { children: [
3175
+ /* @__PURE__ */ t(F.Text, { children: e }),
3176
+ /* @__PURE__ */ t(
3177
+ F.Link,
3178
+ {
3179
+ strong: !0,
3180
+ className: "w-reconnect-manual",
3181
+ onClick: () => {
3182
+ const i = l(o);
3183
+ c.push(
3184
+ `/standard/hrm.helpdesk.my-ticket.ticket-details?id=${i}`
3185
+ );
3186
+ },
3187
+ children: n
3188
+ }
3189
+ )
3190
+ ] }),
3191
+ open: !0,
3192
+ styleWrapper: {
3193
+ position: "sticky"
3194
+ }
3195
+ }
3196
+ );
3197
+ }, Po = S(jo), ec = ({ onClose: e, visible: n }) => /* @__PURE__ */ t(En, { open: n, onClose: e, children: /* @__PURE__ */ h(So, { children: [
3198
+ /* @__PURE__ */ t(Lo, {}),
3199
+ /* @__PURE__ */ t(Po, {}),
3200
+ /* @__PURE__ */ t(Vo, {}),
3201
+ /* @__PURE__ */ t(Jo, {})
3202
+ ] }) }), nc = S(ec), tc = () => {
3203
+ const e = A("AdvanceFilter", "Advance Filter"), n = A("Subject", "Subject"), o = A(
3204
+ "TicketCategory",
3205
+ "Ticket Category"
3206
+ ), c = A("TicketStatus", "Ticket Status"), l = A("CreatedDate", "Created Date"), i = A("New", "New"), s = A("Open", "Open"), r = A("Reopen", "Reopen"), a = A("InProgress", "In Progress"), d = A("Responded", "Responded"), f = A("Fixed", "Fixed"), C = A("Done", "Done"), T = A("Closed", "Closed"), b = A("HDCancelled", "Cancelled"), k = A("Clear", "Clear"), x = A("Filter", "Filter"), E = De(), [w] = J.useForm(), { openFilter: g, setOpenFilter: u, getListTicket: m, setCountFilters: y } = te(), [p, D] = _([]), O = L(() => {
3207
+ const H = `${i}/${s}/${r}`, v = `${a}/${d}`, N = `${f}/${C}`;
3208
+ return [
3209
+ { value: 3, label: H },
3210
+ { value: 1, label: v },
3211
+ { value: 4, label: N },
3212
+ { value: 6, label: T },
3213
+ { value: 8, label: b }
3214
+ ];
3215
+ }, []), V = () => {
3216
+ var H;
3217
+ (H = E({
3218
+ endpoint: "/helpdesk/category/list",
3219
+ data: {
3220
+ LIMIT: 999999,
3221
+ PAGE: 1,
3222
+ SELECTOR: "*",
3223
+ SORT: { FIELD: "ORDER_NO", ORDER: "ASC" }
3224
+ }
3225
+ })) == null || H.then((v) => {
3226
+ var N, z, M;
3227
+ if ((N = v == null ? void 0 : v.data) != null && N.DATA) {
3228
+ const $ = (M = (z = v == null ? void 0 : v.data) == null ? void 0 : z.DATA) == null ? void 0 : M.LIST;
3229
+ D(
3230
+ $ == null ? void 0 : $.map((G) => ({
3231
+ label: G == null ? void 0 : G.CATEGORY_NAME,
3232
+ value: G == null ? void 0 : G.CATEGORY_CODE
3233
+ }))
3234
+ );
3235
+ }
3236
+ });
3237
+ }, U = () => {
3238
+ var N, z;
3239
+ const H = w == null ? void 0 : w.getFieldsValue(!0);
3240
+ m(H);
3241
+ const v = (z = (N = Object.values(H || {})) == null ? void 0 : N.flat()) == null ? void 0 : z.filter(Boolean);
3242
+ y(v == null ? void 0 : v.length);
3243
+ };
3244
+ return W(() => {
3245
+ V();
3246
+ }, []), /* @__PURE__ */ h(
3247
+ En,
3248
+ {
3249
+ styleContainer: { height: "calc(100% - 50px)" },
3250
+ open: g,
3251
+ onClose: () => {
3252
+ u(!1);
3253
+ },
3254
+ footer: /* @__PURE__ */ h("div", { className: "w-ticket-list-advance-filter-footer", children: [
3255
+ /* @__PURE__ */ t(
3256
+ R,
3257
+ {
3258
+ onClick: () => {
3259
+ w == null || w.resetFields(), U();
3260
+ },
3261
+ children: k
3262
+ },
3263
+ "clear"
3264
+ ),
3265
+ /* @__PURE__ */ t(
3266
+ R,
3267
+ {
3268
+ type: "primary",
3269
+ onClick: () => {
3270
+ U(), u(!1);
3271
+ },
3272
+ children: x
3273
+ },
3274
+ "filter"
3275
+ )
3276
+ ] }),
3277
+ children: [
3278
+ /* @__PURE__ */ t(F.Text, { strong: !0, style: { fontSize: 16 }, children: e }),
3279
+ /* @__PURE__ */ t("div", { className: "w-ticket-list-advance-filter-form-container", children: /* @__PURE__ */ h(J, { form: w, layout: "vertical", children: [
3280
+ /* @__PURE__ */ t(J.Item, { label: n, name: "TASK_NAME", children: /* @__PURE__ */ t(Ee, { allowClear: !0 }) }),
3281
+ /* @__PURE__ */ t(J.Item, { label: o, name: "CATEGORY_CODE", children: /* @__PURE__ */ t(je, { options: p, mode: "multiple", allowClear: !0 }) }),
3282
+ /* @__PURE__ */ t(J.Item, { label: c, name: "TASK_STATUS", children: /* @__PURE__ */ t(je, { options: O, mode: "multiple", allowClear: !0 }) }),
3283
+ /* @__PURE__ */ t(J.Item, { label: l, name: "CREATED_DATE", children: /* @__PURE__ */ t(Un, { style: { width: "100%" }, allowClear: !0 }) })
3284
+ ] }) })
3285
+ ]
3286
+ }
3287
+ );
3288
+ }, oc = S(tc), cc = () => {
3289
+ const e = A(
3290
+ "ReconnectManually",
3291
+ "Reconnect Manually"
3292
+ ), n = A(
3293
+ "HelpdeskWebsocket",
3294
+ "Helpdesk Websocket"
3295
+ ), o = A("NotConnected", "Not Connected"), c = A("Connecting", "Connecting"), {
3296
+ connectWebSocket: l,
3297
+ retryCountState: i,
3298
+ setRetryCountState: s,
3299
+ retryCountRef: r
3300
+ } = ie(), a = L(() => i === Ae ? `${n} ${o}` : `${n} ${c}`, [i]);
3301
+ return /* @__PURE__ */ t(
3302
+ "div",
3303
+ {
3304
+ style: {
3305
+ display: "flex",
3306
+ justifyContent: "center",
3307
+ alignItems: "center",
3308
+ height: "100%"
3309
+ },
3310
+ children: /* @__PURE__ */ t(
3311
+ Wn,
3312
+ {
3313
+ ...i === Ae ? {
3314
+ status: "warning"
3315
+ } : {
3316
+ icon: null
3317
+ },
3318
+ title: a,
3319
+ extra: i === Ae ? /* @__PURE__ */ t(
3320
+ R,
3321
+ {
3322
+ type: "primary",
3323
+ onClick: () => {
3324
+ r.current = 0, s(0), l();
3325
+ },
3326
+ children: e
3327
+ },
3328
+ "reconnect"
3329
+ ) : /* @__PURE__ */ t(
3330
+ K,
3331
+ {
3332
+ type: "loading",
3333
+ className: "w-spin-animate",
3334
+ style: {
3335
+ paddingTop: 8
3336
+ }
3337
+ }
3338
+ )
3339
+ }
3340
+ )
3341
+ }
3342
+ );
3343
+ }, sc = S(cc), lc = () => {
3344
+ const { setTicketId: e, ticketId: n, openFilter: o } = te(), { onSendMsg: c } = ie(), { showReadyWSHD: l } = I();
3345
+ return l ? /* @__PURE__ */ h(Q, { children: [
3346
+ /* @__PURE__ */ t(
3347
+ nc,
3348
+ {
3349
+ visible: n,
3350
+ onClose: () => {
3351
+ e(""), c({
3352
+ event: "LEAVE_ROOM",
3353
+ data: {
3354
+ TASK_ID: n
3355
+ }
3356
+ });
3357
+ }
3358
+ }
3359
+ ),
3360
+ /* @__PURE__ */ t("div", { style: { display: !n && !o ? "block" : "none" }, children: /* @__PURE__ */ t(wo, {}) }),
3361
+ /* @__PURE__ */ t(oc, {})
3362
+ ] }) : /* @__PURE__ */ t(sc, {});
3363
+ }, ic = S(lc), rc = () => {
3364
+ const e = A("NeedHelp", "Need Help"), n = A(
3365
+ "WidgetDisconnected",
3366
+ "Widget Disconnected"
3367
+ ), [o, c] = _(!1), l = B(), { widgetProps: i, setOpenWidget: s, isFirstOpenWidget: r, setFirstOpenWidget: a } = I(), { onSendMsg: d, connected: f, isHandshakeWidget: C } = ee(), T = () => {
3368
+ s(!0), d({ msg: i == null ? void 0 : i.getStartedPayload });
3369
+ };
3370
+ return W(() => {
3371
+ c(!f), window.clearTimeout(l.current), l.current = setTimeout(() => {
3372
+ c(!1);
3373
+ }, 2e3);
3374
+ }, [f]), /* @__PURE__ */ t(
3375
+ Ie,
3376
+ {
3377
+ open: o && C,
3378
+ content: n,
3379
+ placement: "right",
3380
+ children: /* @__PURE__ */ h(
3381
+ "div",
3382
+ {
3383
+ className: "w-launcher-container",
3384
+ onClick: () => {
3385
+ r || (a(!0), T()), s(!0);
3386
+ },
3387
+ children: [
3388
+ /* @__PURE__ */ t(K, { type: "chat-bubble" }),
3389
+ /* @__PURE__ */ h(
3390
+ F.Text,
3391
+ {
3392
+ style: {
3393
+ fontWeight: 600,
3394
+ color: "#fff"
3395
+ },
3396
+ children: [
3397
+ e,
3398
+ "?"
3399
+ ]
3400
+ }
3401
+ )
3402
+ ]
3403
+ }
3404
+ )
3405
+ }
3406
+ );
3407
+ }, ac = S(rc), dc = () => {
3408
+ const e = A("NotConnected", "Not Connected"), n = A(
3409
+ "CannotAutoReconnect",
3410
+ "Cannot auto reconnect"
3411
+ ), o = A(
3412
+ "ReconnectManually",
3413
+ "Reconnect Manually"
3414
+ ), [c, l] = _(!1), { connected: i, createSocket: s } = ee(), { widgetProps: r } = I();
3415
+ return W(() => {
3416
+ l(!i);
3417
+ }, [i]), /* @__PURE__ */ t(
3418
+ Ln,
3419
+ {
3420
+ title: `${r == null ? void 0 : r.title} ${e}`,
3421
+ subTitle: /* @__PURE__ */ h(Q, { children: [
3422
+ /* @__PURE__ */ h(F.Text, { children: [
3423
+ n,
3424
+ "?"
3425
+ ] }),
3426
+ /* @__PURE__ */ t(
3427
+ F.Link,
3428
+ {
3429
+ strong: !0,
3430
+ className: "w-reconnect-manual",
3431
+ onClick: () => {
3432
+ s();
3433
+ },
3434
+ children: o
3435
+ }
3436
+ )
3437
+ ] }),
3438
+ onClose: () => l(!1),
3439
+ open: !i && c
3440
+ }
3441
+ );
3442
+ }, uc = S(
3443
+ dc
3444
+ ), fc = () => {
3445
+ const { xs: e } = ne.useBreakpoint(), [n, o] = _(!1), { isOpenWidget: c, widgetProps: l } = I(), { isActiveTabVA: i } = le(), s = B(null), r = L(() => {
3446
+ var f;
3447
+ const d = [Me];
3448
+ return e && (l != null && l.isSF ? d == null || d.push(`${Me}-sf-mobile`) : d == null || d.push(`${Me}-mobile`)), (f = d == null ? void 0 : d.filter(Boolean)) == null ? void 0 : f.join(" ");
3449
+ }, [e, l == null ? void 0 : l.isSF]), a = Mn(
3450
+ (d) => {
3451
+ var C;
3452
+ const f = [d, Fe == null ? void 0 : Fe.FADE_IN];
3453
+ return l != null && l.isSF && (f == null || f.push(`${d}-sf`)), e && (l != null && l.isSF ? f == null || f.push(`${d}-sf-mobile`) : f == null || f.push(`${d}-mobile`)), (C = f == null ? void 0 : f.filter(Boolean)) == null ? void 0 : C.join(" ");
3454
+ },
3455
+ [l == null ? void 0 : l.isSF, e]
3456
+ );
3457
+ return W(() => {
3458
+ c && o(c), clearTimeout(s.current), s.current = setTimeout(() => {
3459
+ c || o(c);
3460
+ }, 250);
3461
+ }, [c]), n ? /* @__PURE__ */ h("div", { className: r, children: [
3462
+ /* @__PURE__ */ h("div", { style: { display: i ? "block" : "none" }, children: [
3463
+ /* @__PURE__ */ t("div", { className: a(ot), children: /* @__PURE__ */ t(uo, {}) }),
3464
+ /* @__PURE__ */ t(go, {})
3465
+ ] }),
3466
+ /* @__PURE__ */ t("div", { style: { display: i ? "none" : "block" }, children: /* @__PURE__ */ t("div", { className: a(ct), children: /* @__PURE__ */ t(ko, { children: /* @__PURE__ */ t(bo, { children: /* @__PURE__ */ t(ic, {}) }) }) }) }),
3467
+ /* @__PURE__ */ t(uc, {})
3468
+ ] }) : /* @__PURE__ */ t(ac, {});
3469
+ }, gc = S(fc), Cc = ({ items: e, ...n }) => Te != null && Te.startsWith("5") || be != null && be.startsWith("18") ? /* @__PURE__ */ t(Oe, { ...n, items: e }) : /* @__PURE__ */ t(Oe, { ...n, children: e == null ? void 0 : e.map(({ ...o }) => /* @__PURE__ */ $e(
3470
+ Oe.TabPane,
3471
+ {
3472
+ ...o,
3473
+ key: o == null ? void 0 : o.key,
3474
+ tab: o == null ? void 0 : o.label
3475
+ }
3476
+ )) }), mc = S(Cc), Tc = () => {
3477
+ const { isOpenWidget: e } = I(), { setActiveTab: n, activeTab: o } = le(), c = A(
3478
+ "VirtualAssistant",
3479
+ "Virtual Assistant"
3480
+ ), l = A("Helpdesk", "Helpdesk"), { xs: i } = ne.useBreakpoint();
3481
+ return W(() => {
3482
+ const s = an();
3483
+ n((s == null ? void 0 : s.activeTab) ?? o);
3484
+ }, []), e ? /* @__PURE__ */ t(
3485
+ "div",
3486
+ {
3487
+ className: "w-widget-tab-footer-container",
3488
+ ...i && {
3489
+ style: {
3490
+ borderRadius: 0
3491
+ }
3492
+ },
3493
+ children: /* @__PURE__ */ t(
3494
+ mc,
3495
+ {
3496
+ activeKey: o,
3497
+ onChange: (s) => {
3498
+ n(s), pe({
3499
+ activeTab: s
3500
+ });
3501
+ },
3502
+ items: [
3503
+ {
3504
+ label: c,
3505
+ key: "va"
3506
+ },
3507
+ {
3508
+ label: l,
3509
+ key: "helpdesk"
3510
+ }
3511
+ ]
3512
+ }
3513
+ )
3514
+ }
3515
+ ) : null;
3516
+ }, bc = S(Tc), yc = () => {
3517
+ const { isOpenWidget: e, setOpenWidget: n, setExpand: o, isExpand: c, widgetProps: l } = I(), { xs: i } = ne.useBreakpoint();
3518
+ return e ? /* @__PURE__ */ h(
3519
+ "div",
3520
+ {
3521
+ className: `${ke}-container`,
3522
+ ...i && {
3523
+ style: {
3524
+ borderRadius: 0
3525
+ }
3526
+ },
3527
+ children: [
3528
+ /* @__PURE__ */ h("div", { className: `${ke}-text`, children: [
3529
+ /* @__PURE__ */ t("h4", { className: `${ke}-title`, children: l == null ? void 0 : l.title }),
3530
+ /* @__PURE__ */ t("span", { className: `${ke}-subtitle`, children: l == null ? void 0 : l.subTitle })
3531
+ ] }),
3532
+ /* @__PURE__ */ h("div", { className: `${ke}-action`, children: [
3533
+ !i && /* @__PURE__ */ t(
3534
+ K,
3535
+ {
3536
+ type: "expand",
3537
+ style: {
3538
+ transform: c ? "rotate(180deg)" : "rotate(0deg)",
3539
+ transition: "all 300ms"
3540
+ },
3541
+ onClick: () => {
3542
+ o((s) => !s);
3543
+ }
3544
+ }
3545
+ ),
3546
+ /* @__PURE__ */ t(
3547
+ K,
3548
+ {
3549
+ type: "minimize",
3550
+ onClick: () => {
3551
+ n(!1);
3552
+ }
3553
+ }
3554
+ )
3555
+ ] })
3556
+ ]
3557
+ }
3558
+ ) : null;
3559
+ }, hc = S(yc), kc = () => {
3560
+ const { isExpand: e, isOpenWidget: n, isFirstOpenWidget: o, setOpenWidget: c } = I(), { xs: l } = ne.useBreakpoint(), i = L(() => {
3561
+ var r;
3562
+ const s = [
3563
+ l && "w-container-widget-mobile",
3564
+ o && (n ? "w-show-animate" : "w-close-animate"),
3565
+ "w-container-widget",
3566
+ e && "w-container-widget-expand"
3567
+ ];
3568
+ return (r = s == null ? void 0 : s.filter(Boolean)) == null ? void 0 : r.join(" ");
3569
+ }, [e, l, o, n]);
3570
+ return /* @__PURE__ */ h(
3571
+ "div",
3572
+ {
3573
+ className: i,
3574
+ onKeyDown: (s) => {
3575
+ (s == null ? void 0 : s.code) === "Escape" && !(s != null && s.shiftKey) && !(s != null && s.altKey) && !(s != null && s.ctrlKey) && (s == null ? void 0 : s.key) === "Escape" && c(!1);
3576
+ },
3577
+ tabIndex: 0,
3578
+ children: [
3579
+ /* @__PURE__ */ t(hc, {}),
3580
+ /* @__PURE__ */ t("div", { id: "w-widget-content", children: /* @__PURE__ */ h(Ut, { children: [
3581
+ /* @__PURE__ */ t(Tt, { children: /* @__PURE__ */ t(gc, {}) }),
3582
+ /* @__PURE__ */ t(bc, {})
3583
+ ] }) })
3584
+ ]
3585
+ }
3586
+ );
3587
+ }, Ac = S(kc), Fc = ({
3588
+ getStartedPayload: e,
3589
+ socketURL: n,
3590
+ socketPath: o,
3591
+ onPayslipFn: c,
3592
+ title: l,
3593
+ subTitle: i,
3594
+ keyEncrypt: s,
3595
+ history: r,
3596
+ isSF: a = !1
3597
+ }) => /* @__PURE__ */ t(
3598
+ gt,
3599
+ {
3600
+ getStartedPayload: e,
3601
+ socketURL: n,
3602
+ socketPath: o,
3603
+ onPayslipFn: c,
3604
+ title: l,
3605
+ subTitle: i,
3606
+ keyEncrypt: s,
3607
+ history: r,
3608
+ isSF: a,
3609
+ children: /* @__PURE__ */ t(mt, { children: /* @__PURE__ */ t(Ac, {}) })
3610
+ }
3611
+ );
3612
+ export {
3613
+ Fc as default
3614
+ };