@sapia-ai/chatbot-v3 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EmbeddedVideoPlayer-SaMMfDIW.js +1277 -0
- package/dist/EmbeddedVideoPlayer-SaMMfDIW.js.map +1 -0
- package/dist/Preview-Db-hgkTh.js +83 -0
- package/dist/Preview-Db-hgkTh.js.map +1 -0
- package/dist/api/client.d.ts +60 -0
- package/dist/api/config.d.ts +18 -0
- package/dist/api/constants.d.ts +5 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/sse.d.ts +12 -0
- package/dist/api/types/branding.d.ts +17 -0
- package/dist/api/types/messages.d.ts +148 -0
- package/dist/api/types/responses.d.ts +106 -0
- package/dist/api.js +2 -0
- package/dist/classPrivateFieldSet2-DtQPURVD.js +32 -0
- package/dist/core/bubbles/convert.d.ts +18 -0
- package/dist/core/bubbles/types.d.ts +55 -0
- package/dist/core/constants.d.ts +14 -0
- package/dist/core/events.d.ts +44 -0
- package/dist/core/i18n/fallback.d.ts +2 -0
- package/dist/core/i18n/languages.d.ts +11 -0
- package/dist/core/i18n/translator.d.ts +13 -0
- package/dist/core/interview.d.ts +207 -0
- package/dist/core/media/mimeTypes.d.ts +10 -0
- package/dist/core/media/recorder.d.ts +61 -0
- package/dist/core/persistence.d.ts +4 -0
- package/dist/core/store.d.ts +49 -0
- package/dist/core/theme/branding.d.ts +6 -0
- package/dist/core/theme/cssVariables.d.ts +16 -0
- package/dist/core/theme/types.d.ts +11 -0
- package/dist/core/validation/phoneCountries.d.ts +21 -0
- package/dist/core/validation/pii.d.ts +30 -0
- package/dist/dash.all.min-DZ1yEcJk.js +27302 -0
- package/dist/dash.all.min-DZ1yEcJk.js.map +1 -0
- package/dist/defineProperty-DiFpLzd2.js +39 -0
- package/dist/dist-BSi28_cP.js +702 -0
- package/dist/dist-BSi28_cP.js.map +1 -0
- package/dist/dist-DGBYKC8c.js +14327 -0
- package/dist/dist-DGBYKC8c.js.map +1 -0
- package/dist/dist-FvHBWiRa.js +76 -0
- package/dist/dist-FvHBWiRa.js.map +1 -0
- package/dist/embed/compat.d.ts +82 -0
- package/dist/embed/constants.d.ts +2 -0
- package/dist/embed/createChatbot.d.ts +22 -0
- package/dist/fix-webm-duration-BW9Fbdzt.js +1057 -0
- package/dist/fix-webm-duration-BW9Fbdzt.js.map +1 -0
- package/dist/hls-mBncGwsE.js +18657 -0
- package/dist/hls-mBncGwsE.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4428 -0
- package/dist/index.js.map +1 -0
- package/dist/max-Btet1snX.js +12212 -0
- package/dist/max-Btet1snX.js.map +1 -0
- package/dist/messages-C4jqrtSG.js +187 -0
- package/dist/messages-C4jqrtSG.js.map +1 -0
- package/dist/react/AnswerInput.d.ts +21 -0
- package/dist/react/SapiaChatbot.d.ts +23 -0
- package/dist/react/bubbleViewModel.d.ts +50 -0
- package/dist/react/strings.d.ts +98 -0
- package/dist/react/useBeforeUnload.d.ts +5 -0
- package/dist/react/useVideoRecorder.d.ts +24 -0
- package/dist/react-BGJ7Szvq.js +216 -0
- package/dist/react-BGJ7Szvq.js.map +1 -0
- package/dist/react-BMxM8TWJ.js +192 -0
- package/dist/react-BMxM8TWJ.js.map +1 -0
- package/dist/react-BVzcquey.js +457 -0
- package/dist/react-BVzcquey.js.map +1 -0
- package/dist/react-BrCGR7Ca.js +2208 -0
- package/dist/react-BrCGR7Ca.js.map +1 -0
- package/dist/react-Bujo1aK5.js +334 -0
- package/dist/react-Bujo1aK5.js.map +1 -0
- package/dist/react-CRTg4gz8.js +367 -0
- package/dist/react-CRTg4gz8.js.map +1 -0
- package/dist/react-GXf8sbzf.js +311 -0
- package/dist/react-GXf8sbzf.js.map +1 -0
- package/dist/react-lp7yfM94.js +371 -0
- package/dist/react-lp7yfM94.js.map +1 -0
- package/dist/sapia-chatbot.css +3 -0
- package/dist/sapia.d.ts +4 -0
- package/dist/ui/chat/ChatBubble/ChatBubble.d.ts +47 -0
- package/dist/ui/chat/ChatLog/ChatLog.d.ts +33 -0
- package/dist/ui/chat/TypingIndicator/TypingIndicator.d.ts +17 -0
- package/dist/ui/chat/types.d.ts +71 -0
- package/dist/ui/constants.d.ts +2 -0
- package/dist/ui/inputs/DropdownInput/DropdownInput.d.ts +18 -0
- package/dist/ui/inputs/OptionList/OptionList.d.ts +18 -0
- package/dist/ui/inputs/PhoneAnswerInput/PhoneAnswerInput.d.ts +19 -0
- package/dist/ui/inputs/SliderInput/SliderInput.d.ts +19 -0
- package/dist/ui/inputs/TextAnswerInput/TextAnswerInput.d.ts +32 -0
- package/dist/ui/inputs/VideoRecorder/VideoRecorder.d.ts +54 -0
- package/dist/ui/media/EmbeddedVideo/EmbeddedVideo.d.ts +11 -0
- package/dist/ui/media/EmbeddedVideo/EmbeddedVideoPlayer.d.ts +16 -0
- package/dist/ui/media/EmbeddedVideo/VimeoPlayer.d.ts +20 -0
- package/dist/ui/media/UploadProgress/UploadProgress.d.ts +7 -0
- package/dist/ui/media/VideoPlayer/VideoPlayer.d.ts +13 -0
- package/dist/ui/primitives/Button/Button.d.ts +6 -0
- package/dist/ui/primitives/Dialog/Dialog.d.ts +16 -0
- package/dist/ui/richText.d.ts +6 -0
- package/dist/ui/shell/AccessVerificationForm/AccessVerificationForm.d.ts +21 -0
- package/dist/ui/shell/CopyLinkButton/CopyLinkButton.d.ts +11 -0
- package/dist/ui/shell/DoneScreen/DoneScreen.d.ts +15 -0
- package/dist/ui/shell/Header/Header.d.ts +13 -0
- package/dist/ui/shell/PreparingScreen/PreparingScreen.d.ts +9 -0
- package/dist/ui/shell/ProgressBar/ProgressBar.d.ts +9 -0
- package/dist/ui/shell/WelcomeScreen/WelcomeScreen.d.ts +22 -0
- package/dist/ui/shell/WidgetRoot/WidgetRoot.d.ts +12 -0
- package/dist-umd/sapia-chatbot.umd.js +3655 -0
- package/dist-umd/sapia-chatbot.umd.js.map +1 -0
- package/package.json +94 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4428 @@
|
|
|
1
|
+
import { c as e, h as t, i as n, m as r, o as i, r as a, s as o, t as s, u as c } from "./messages-C4jqrtSG.js";
|
|
2
|
+
import { createRoot as l } from "react-dom/client";
|
|
3
|
+
import * as u from "react";
|
|
4
|
+
import { Suspense as d, lazy as f, useCallback as p, useEffect as m, useId as h, useLayoutEffect as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
5
|
+
import { useStore as b } from "zustand";
|
|
6
|
+
import { createStore as x } from "zustand/vanilla";
|
|
7
|
+
import S from "react-markdown";
|
|
8
|
+
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
9
|
+
import * as E from "react-dom";
|
|
10
|
+
//#region \0rolldown/runtime.js
|
|
11
|
+
var D = Object.create, O = Object.defineProperty, k = Object.getOwnPropertyDescriptor, A = Object.getOwnPropertyNames, j = Object.getPrototypeOf, M = Object.prototype.hasOwnProperty, N = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), P = (e, t, n, r) => {
|
|
12
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = A(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !M.call(e, s) && s !== n && O(e, s, {
|
|
13
|
+
get: ((e) => t[e]).bind(null, s),
|
|
14
|
+
enumerable: !(r = k(t, s)) || r.enumerable
|
|
15
|
+
});
|
|
16
|
+
return e;
|
|
17
|
+
}, ee = (e, t, n) => (n = e == null ? {} : D(j(e)), P(t || !e || !e.__esModule ? O(n, "default", {
|
|
18
|
+
value: e,
|
|
19
|
+
enumerable: !0
|
|
20
|
+
}) : n, e)), F = {
|
|
21
|
+
ASSESSMENT_STARTED: "assessment:started",
|
|
22
|
+
ASSESSMENT_ENDED: "assessment:ended",
|
|
23
|
+
ASSESSMENT_DUPLICATED: "assessment:duplicated",
|
|
24
|
+
ANSWER_SAVED: "answer:saved",
|
|
25
|
+
ANSWER_EDITED: "answer:edited",
|
|
26
|
+
ERROR: "error",
|
|
27
|
+
LOG: "log"
|
|
28
|
+
}, I = class {
|
|
29
|
+
constructor() {
|
|
30
|
+
this.handlers = /* @__PURE__ */ new Map();
|
|
31
|
+
}
|
|
32
|
+
on(e, t) {
|
|
33
|
+
var n;
|
|
34
|
+
let r = (n = this.handlers.get(e)) == null ? /* @__PURE__ */ new Set() : n;
|
|
35
|
+
return r.add(t), this.handlers.set(e, r), () => this.off(e, t);
|
|
36
|
+
}
|
|
37
|
+
off(e, t) {
|
|
38
|
+
var n;
|
|
39
|
+
(n = this.handlers.get(e)) == null || n.delete(t);
|
|
40
|
+
}
|
|
41
|
+
emit(e, t) {
|
|
42
|
+
var n;
|
|
43
|
+
(n = this.handlers.get(e)) == null || n.forEach((e) => e(t));
|
|
44
|
+
}
|
|
45
|
+
}, L = {
|
|
46
|
+
email: "fi_error_piiEmail",
|
|
47
|
+
fullName: "fi_error_piiFullName",
|
|
48
|
+
firstName: "fi_error_piiFirstName",
|
|
49
|
+
lastName: "fi_error_piiLastName",
|
|
50
|
+
phoneNumber: "fi_error_piiPhoneNumber"
|
|
51
|
+
}, te = {
|
|
52
|
+
[i.FULL_NAME]: 100,
|
|
53
|
+
[i.FIRST_NAME]: 50,
|
|
54
|
+
[i.LAST_NAME]: 50
|
|
55
|
+
}, ne = {
|
|
56
|
+
[i.FULL_NAME]: 3,
|
|
57
|
+
[i.FIRST_NAME]: 2,
|
|
58
|
+
[i.LAST_NAME]: 2
|
|
59
|
+
}, R = {
|
|
60
|
+
[i.FULL_NAME]: L.fullName,
|
|
61
|
+
[i.FIRST_NAME]: L.firstName,
|
|
62
|
+
[i.LAST_NAME]: L.lastName
|
|
63
|
+
}, re = {
|
|
64
|
+
[i.FULL_NAME]: "fullName",
|
|
65
|
+
[i.FIRST_NAME]: "firstName",
|
|
66
|
+
[i.LAST_NAME]: "lastName"
|
|
67
|
+
}, ie = (e) => e.trim().split(/\s+/).filter(Boolean).length, z = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/, ae = (e) => {
|
|
68
|
+
let t = e.trim();
|
|
69
|
+
return z.test(t) ? {
|
|
70
|
+
ok: !0,
|
|
71
|
+
text: t
|
|
72
|
+
} : {
|
|
73
|
+
ok: !1,
|
|
74
|
+
errorKey: L.email
|
|
75
|
+
};
|
|
76
|
+
}, oe = (e, t) => {
|
|
77
|
+
let n = t.trim(), r = te[e], i = R[e];
|
|
78
|
+
if (r === void 0 || i === void 0) return {
|
|
79
|
+
ok: !0,
|
|
80
|
+
text: n
|
|
81
|
+
};
|
|
82
|
+
let a = ie(n);
|
|
83
|
+
return a >= 1 && a <= r ? {
|
|
84
|
+
ok: !0,
|
|
85
|
+
text: n
|
|
86
|
+
} : {
|
|
87
|
+
ok: !1,
|
|
88
|
+
errorKey: i
|
|
89
|
+
};
|
|
90
|
+
}, se = (e, t) => {
|
|
91
|
+
let n = ne[e];
|
|
92
|
+
return n !== void 0 && ie(t) > n;
|
|
93
|
+
}, ce = async (e, t) => {
|
|
94
|
+
var n;
|
|
95
|
+
let { parsePhoneNumberFromString: r } = await import("./max-Btet1snX.js"), i = r(e.trim(), t);
|
|
96
|
+
return i != null && i.isValid() ? {
|
|
97
|
+
ok: !0,
|
|
98
|
+
text: i.number
|
|
99
|
+
} : {
|
|
100
|
+
ok: !1,
|
|
101
|
+
errorKey: L.phoneNumber,
|
|
102
|
+
possiblePhoneNumber: (n = i == null ? void 0 : i.isPossible()) == null ? !1 : n
|
|
103
|
+
};
|
|
104
|
+
}, B = "stream-live", V = /* @__PURE__ */ function(e) {
|
|
105
|
+
return e.ANSWERED = "ANSWERED", e.ANSWERING = "ANSWERING", e.EDITING = "EDITING", e.PENDING = "PENDING", e.FAILED = "FAILED", e;
|
|
106
|
+
}({}), le = [
|
|
107
|
+
o.SLIDER,
|
|
108
|
+
o.MCQ,
|
|
109
|
+
o.VIDEO,
|
|
110
|
+
o.DROPDOWN,
|
|
111
|
+
o.BGQ
|
|
112
|
+
], ue = [
|
|
113
|
+
o.MCQ,
|
|
114
|
+
o.DROPDOWN,
|
|
115
|
+
o.BGQ
|
|
116
|
+
], de = [
|
|
117
|
+
o.SLIDER,
|
|
118
|
+
o.MCQ,
|
|
119
|
+
o.DROPDOWN,
|
|
120
|
+
o.BGQ
|
|
121
|
+
], fe = (e) => {
|
|
122
|
+
if (!e || !Array.isArray(e) || e.length === 0) return;
|
|
123
|
+
let t;
|
|
124
|
+
return e.forEach((e) => {
|
|
125
|
+
e.name === "PII_TYPE" && (t = e.value);
|
|
126
|
+
}), t;
|
|
127
|
+
}, pe = (e) => {
|
|
128
|
+
if (!e || !Array.isArray(e) || e.length === 0) return;
|
|
129
|
+
let t;
|
|
130
|
+
return e.forEach((e) => {
|
|
131
|
+
e.name === "VIDEO_TYPE" && (t = e.value);
|
|
132
|
+
}), t;
|
|
133
|
+
}, me = (e) => {
|
|
134
|
+
var t, n, r, i, o, s;
|
|
135
|
+
let c = e == null ? void 0 : e.data, l = (t = c == null || (n = c.question) == null ? void 0 : n.types) == null ? [] : t, u, d;
|
|
136
|
+
if (l.some((e) => le.includes(e))) if (d = {
|
|
137
|
+
text: c == null ? void 0 : c.text,
|
|
138
|
+
value: c == null ? void 0 : c.value
|
|
139
|
+
}, l.some((e) => ue.includes(e))) {
|
|
140
|
+
var f, p;
|
|
141
|
+
u = [{
|
|
142
|
+
id: c == null ? void 0 : c._id,
|
|
143
|
+
types: [a.TEXT],
|
|
144
|
+
contents: (f = c == null || (p = c.question) == null ? void 0 : p.options) == null ? [] : f
|
|
145
|
+
}];
|
|
146
|
+
} else {
|
|
147
|
+
var m, h;
|
|
148
|
+
u = [{
|
|
149
|
+
id: c == null ? void 0 : c._id,
|
|
150
|
+
types: [a.TEXT],
|
|
151
|
+
contents: [{
|
|
152
|
+
id: c == null ? void 0 : c._id,
|
|
153
|
+
text: c == null || (m = c.question) == null || (m = m.contents) == null || (m = m[0]) == null ? void 0 : m.value,
|
|
154
|
+
value: c == null || (h = c.question) == null || (h = h.contents) == null || (h = h[0]) == null ? void 0 : h.value
|
|
155
|
+
}]
|
|
156
|
+
}];
|
|
157
|
+
}
|
|
158
|
+
else u = [{
|
|
159
|
+
id: c == null ? void 0 : c._id,
|
|
160
|
+
types: [a.TEXT],
|
|
161
|
+
contents: [{
|
|
162
|
+
id: c == null ? void 0 : c._id,
|
|
163
|
+
text: c == null ? void 0 : c.text,
|
|
164
|
+
value: c == null ? void 0 : c.value
|
|
165
|
+
}]
|
|
166
|
+
}];
|
|
167
|
+
let g = {
|
|
168
|
+
id: e == null ? void 0 : e.id,
|
|
169
|
+
questionId: c == null || (r = c.question) == null ? void 0 : r._id,
|
|
170
|
+
sender: e == null ? void 0 : e.sender,
|
|
171
|
+
messageIdentifier: e == null ? void 0 : e.messageIdentifier,
|
|
172
|
+
status: V.ANSWERED,
|
|
173
|
+
types: l,
|
|
174
|
+
usageWhitelist: c == null || (i = c.question) == null ? void 0 : i.usageWhitelist,
|
|
175
|
+
masterId: c == null || (o = c.question) == null ? void 0 : o.masterId,
|
|
176
|
+
data: {
|
|
177
|
+
messageItems: u,
|
|
178
|
+
tags: c == null || (s = c.question) == null ? void 0 : s.tags
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
return d && (g.data.answer = d), g;
|
|
182
|
+
}, he = (e, t) => {
|
|
183
|
+
var n, r;
|
|
184
|
+
let i = e == null ? void 0 : e.data;
|
|
185
|
+
return {
|
|
186
|
+
id: e == null ? void 0 : e.id,
|
|
187
|
+
questionId: i == null ? void 0 : i._id,
|
|
188
|
+
sender: e == null ? void 0 : e.sender,
|
|
189
|
+
messageIdentifier: e == null ? void 0 : e.messageIdentifier,
|
|
190
|
+
status: t || !(i == null || (n = i.types) == null) && n.includes(o.HINT) ? V.ANSWERED : V.ANSWERING,
|
|
191
|
+
types: i == null ? void 0 : i.types,
|
|
192
|
+
usageWhitelist: i == null ? void 0 : i.usageWhitelist,
|
|
193
|
+
messageKind: i == null ? void 0 : i.kind,
|
|
194
|
+
data: {
|
|
195
|
+
rules: i == null ? void 0 : i.rules,
|
|
196
|
+
tags: i == null ? void 0 : i.tags,
|
|
197
|
+
messageItems: ((r = i == null ? void 0 : i.contents) == null ? [] : r).map((e) => ({
|
|
198
|
+
id: e == null ? void 0 : e.value,
|
|
199
|
+
types: e == null ? void 0 : e.types,
|
|
200
|
+
component: e == null ? void 0 : e.component,
|
|
201
|
+
contents: [{
|
|
202
|
+
value: e == null ? void 0 : e.value,
|
|
203
|
+
text: e == null ? void 0 : e.value,
|
|
204
|
+
id: e == null ? void 0 : e.value
|
|
205
|
+
}]
|
|
206
|
+
}))
|
|
207
|
+
},
|
|
208
|
+
masterId: i == null ? void 0 : i.masterId,
|
|
209
|
+
piiQuestionType: fe(i == null ? void 0 : i.tags),
|
|
210
|
+
videoQuestionType: pe(i == null ? void 0 : i.tags)
|
|
211
|
+
};
|
|
212
|
+
}, ge = (e, t) => {
|
|
213
|
+
if ((e == null ? void 0 : e.sender) === n.CANDIDATE) return me(e);
|
|
214
|
+
if ((e == null ? void 0 : e.sender) === n.AGENT) return he(e, t);
|
|
215
|
+
}, _e = (e) => {
|
|
216
|
+
var t, r;
|
|
217
|
+
let i = e == null ? void 0 : e.data;
|
|
218
|
+
if (!(i == null || (t = i.types) == null) && t.some((e) => ue.includes(e))) {
|
|
219
|
+
var s, c;
|
|
220
|
+
return {
|
|
221
|
+
id: `${e.id}-candidate`,
|
|
222
|
+
questionId: i == null ? void 0 : i._id,
|
|
223
|
+
sender: n.CANDIDATE,
|
|
224
|
+
messageIdentifier: e.messageIdentifier,
|
|
225
|
+
status: V.ANSWERING,
|
|
226
|
+
types: i == null ? void 0 : i.types,
|
|
227
|
+
usageWhitelist: i == null ? void 0 : i.usageWhitelist,
|
|
228
|
+
masterId: i == null ? void 0 : i.masterId,
|
|
229
|
+
data: {
|
|
230
|
+
messageItems: [{
|
|
231
|
+
id: i == null || (s = i.contents) == null || (s = s[0]) == null ? void 0 : s.value,
|
|
232
|
+
types: [a.TEXT],
|
|
233
|
+
contents: (c = i == null ? void 0 : i.options) == null ? [] : c
|
|
234
|
+
}],
|
|
235
|
+
tags: i == null ? void 0 : i.tags,
|
|
236
|
+
answer: null
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
if (!(i == null || (r = i.types) == null) && r.includes(o.SLIDER)) {
|
|
241
|
+
var l;
|
|
242
|
+
return {
|
|
243
|
+
id: `${e.id}-candidate`,
|
|
244
|
+
questionId: i == null ? void 0 : i._id,
|
|
245
|
+
masterId: i == null ? void 0 : i.masterId,
|
|
246
|
+
sender: n.CANDIDATE,
|
|
247
|
+
messageIdentifier: e.messageIdentifier,
|
|
248
|
+
status: V.ANSWERING,
|
|
249
|
+
types: i == null ? void 0 : i.types,
|
|
250
|
+
usageWhitelist: i == null ? void 0 : i.usageWhitelist,
|
|
251
|
+
data: { messageItems: ((l = i == null ? void 0 : i.contents) == null ? [] : l).map((e) => ({
|
|
252
|
+
id: e.value,
|
|
253
|
+
types: e == null ? void 0 : e.types,
|
|
254
|
+
contents: [{
|
|
255
|
+
value: e == null ? void 0 : e.value,
|
|
256
|
+
text: e == null ? void 0 : e.value,
|
|
257
|
+
id: e.value
|
|
258
|
+
}]
|
|
259
|
+
})) }
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}, ve = (e) => {
|
|
263
|
+
let t = [];
|
|
264
|
+
return e.forEach((r, i) => {
|
|
265
|
+
let a = ge(r, i < e.length - 1);
|
|
266
|
+
if (a && t.push(a), i === e.length - 1 && (r == null ? void 0 : r.sender) === n.AGENT) {
|
|
267
|
+
var o;
|
|
268
|
+
let e = r == null ? void 0 : r.data;
|
|
269
|
+
if (!(e == null || (o = e.types) == null) && o.some((e) => de.includes(e))) {
|
|
270
|
+
let e = _e(r);
|
|
271
|
+
e && t.push(e);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}), t;
|
|
275
|
+
}, ye = [
|
|
276
|
+
"en-GB",
|
|
277
|
+
"en-US",
|
|
278
|
+
"fr",
|
|
279
|
+
"es",
|
|
280
|
+
"de",
|
|
281
|
+
"fi",
|
|
282
|
+
"da",
|
|
283
|
+
"nl",
|
|
284
|
+
"it",
|
|
285
|
+
"sv",
|
|
286
|
+
"nb",
|
|
287
|
+
"pl",
|
|
288
|
+
"ar"
|
|
289
|
+
], be = "en-US", xe = ["ar"], Se = (e) => ye.includes(e), Ce = (e) => e ? e.startsWith("en") && !Se(e) ? "en-US" : Se(e) ? e : be : be, we = (e, t) => e && Se(e) ? e : Ce(t), Te = (e) => xe.includes(e.split("-")[0]), Ee = (e) => Te(e) ? "rtl" : "ltr", De = "sapia-chatbot:v1", Oe = 1800 * 1e3, ke = () => {
|
|
290
|
+
try {
|
|
291
|
+
return typeof window < "u" ? window.localStorage : void 0;
|
|
292
|
+
} catch {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
}, Ae = () => {
|
|
296
|
+
let e = ke();
|
|
297
|
+
if (!e) return {};
|
|
298
|
+
try {
|
|
299
|
+
let t = e.getItem(De);
|
|
300
|
+
return t ? JSON.parse(t) : {};
|
|
301
|
+
} catch {
|
|
302
|
+
return {};
|
|
303
|
+
}
|
|
304
|
+
}, je = (e) => {
|
|
305
|
+
let t = ke();
|
|
306
|
+
if (t) try {
|
|
307
|
+
t.setItem(De, JSON.stringify(e));
|
|
308
|
+
} catch {}
|
|
309
|
+
}, Me = (e, t = Date.now()) => {
|
|
310
|
+
var n;
|
|
311
|
+
let r = (n = Ae().access) == null ? void 0 : n[e];
|
|
312
|
+
if (r && r.expireAt > t) return r.candidateEmail;
|
|
313
|
+
}, Ne = (e, t, n = Date.now()) => {
|
|
314
|
+
let r = Ae();
|
|
315
|
+
je({
|
|
316
|
+
...r,
|
|
317
|
+
access: {
|
|
318
|
+
...r.access,
|
|
319
|
+
[e]: {
|
|
320
|
+
candidateEmail: t,
|
|
321
|
+
expireAt: n + Oe
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}, Pe = "FI_START_ASSESSMENT_FAILED", Fe = "FI_LOAD_NEXT_FAILED", Ie = "FI_EXTRACT_HUMAN_NAME_FAILED", Le = "FI_EDIT_ANSWER_FAILED", Re = "FI_SUBMIT_VIDEO_ANSWER_FAILED", ze = "FI_GET_TRANSLATION_FAILED", Be = "FI_VERIFY_ACCESS_FAILED", Ve = "FI_DETECT_AGC_FAILED", He = "INVALID_PHONE_NUMBER", Ue = "INVALID_PASTE_ANSWER_ACTION", We = "SUBMIT_QUESTION_MESSAGE", Ge = "video-answer", Ke = "optimistic-answer", qe = () => typeof navigator < "u" ? navigator.userAgent : "unknown", Je = (e) => new Promise((t) => setTimeout(t, e)), Ye = (e) => e === s.FI_ASSESSMENT_ENDED, Xe = class {
|
|
326
|
+
constructor(e) {
|
|
327
|
+
var t, n, r, i;
|
|
328
|
+
this.streamSeq = 0, this.welcomeChatLogs = [], this.client = e.client, this.store = e.store, this.emitter = e.emitter, this.assessmentId = e.assessmentId, this.userAgent = (t = e.userAgent) == null ? qe() : t, this.language = (n = e.language) == null ? be : n, this.welcomeGate = (r = e.welcomeGate) == null ? !1 : r, this.streamRevealMs = (i = e.streamRevealMs) == null ? 12 : i, this.store.setState({ language: this.language });
|
|
329
|
+
}
|
|
330
|
+
async loadTranslations() {
|
|
331
|
+
try {
|
|
332
|
+
let e = await this.client.getTranslation(this.language);
|
|
333
|
+
this.store.setState({ translations: e });
|
|
334
|
+
} catch (e) {
|
|
335
|
+
this.emitter.emit(F.ERROR, {
|
|
336
|
+
type: ze,
|
|
337
|
+
message: H(e)
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
async begin() {
|
|
342
|
+
this.store.setState({ phase: "verifying" });
|
|
343
|
+
let e;
|
|
344
|
+
try {
|
|
345
|
+
e = await this.client.getAccessManagement(this.assessmentId);
|
|
346
|
+
} catch {
|
|
347
|
+
await this.start();
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (!e.shouldAuthenticate) {
|
|
351
|
+
await this.start();
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
let t = Me(this.assessmentId);
|
|
355
|
+
if (t) try {
|
|
356
|
+
if ((await this.client.verifyAccess(this.assessmentId, t)).allowToAccess) {
|
|
357
|
+
await this.start();
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
} catch {}
|
|
361
|
+
this.store.setState({
|
|
362
|
+
phase: "access-required",
|
|
363
|
+
emailHint: e.emailHint
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
async verifyAccessEmail(e) {
|
|
367
|
+
let t = e.trim();
|
|
368
|
+
if (!ae(t).ok) {
|
|
369
|
+
this.store.setState({ accessEmailMismatch: !0 });
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
this.store.setState({
|
|
373
|
+
verifyingAccess: !0,
|
|
374
|
+
accessEmailMismatch: !1
|
|
375
|
+
});
|
|
376
|
+
try {
|
|
377
|
+
(await this.client.verifyAccess(this.assessmentId, t)).allowToAccess ? (Ne(this.assessmentId, t), this.store.setState({ verifyingAccess: !1 }), await this.start()) : this.store.setState({
|
|
378
|
+
verifyingAccess: !1,
|
|
379
|
+
accessEmailMismatch: !0
|
|
380
|
+
});
|
|
381
|
+
} catch (e) {
|
|
382
|
+
this.store.setState({ verifyingAccess: !1 }), this.emitter.emit(F.ERROR, {
|
|
383
|
+
type: Be,
|
|
384
|
+
message: H(e)
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
async start() {
|
|
389
|
+
this.store.setState({ phase: "starting" }), this.loadTranslations();
|
|
390
|
+
try {
|
|
391
|
+
var e;
|
|
392
|
+
let t = await this.client.startAts(this.assessmentId), r = (e = t.chatLogs) == null ? [] : e, i = ve(r), a = Ye(t.assessmentStatus), o = this.welcomeGate && !a && !r.some((e) => e.sender === n.CANDIDATE);
|
|
393
|
+
if (this.store.setState({
|
|
394
|
+
phase: a ? "ended" : "active",
|
|
395
|
+
assessmentStatus: t.assessmentStatus,
|
|
396
|
+
bubbles: i,
|
|
397
|
+
branding: t.branding,
|
|
398
|
+
candidateName: t.candidateName,
|
|
399
|
+
roleTitle: t.roleTitle,
|
|
400
|
+
numOfNormalQuestion: t.numOfNormalQuestion,
|
|
401
|
+
numOfNormalAnswer: t.numOfNormalAnswer,
|
|
402
|
+
candidateCountryCode: t.candidateCountryCode,
|
|
403
|
+
agcAttempt: t.agcDetectionAttempt,
|
|
404
|
+
allowNextAgcDetection: t.allowNextAgcDetection
|
|
405
|
+
}), this.emitter.emit(F.ASSESSMENT_STARTED, { assessmentId: this.assessmentId }), a) {
|
|
406
|
+
this.emitter.emit(F.ASSESSMENT_ENDED, { assessmentId: this.assessmentId });
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
if (this.handleTerminalSignals(t)) return;
|
|
410
|
+
if (o) {
|
|
411
|
+
this.welcomeChatLogs = r, this.store.setState({ phase: "welcome" });
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
await this.firstLoad(r);
|
|
415
|
+
} catch (e) {
|
|
416
|
+
this.store.setState({
|
|
417
|
+
phase: "failed",
|
|
418
|
+
lastError: {
|
|
419
|
+
type: Pe,
|
|
420
|
+
message: H(e)
|
|
421
|
+
}
|
|
422
|
+
}), this.emitter.emit(F.ERROR, {
|
|
423
|
+
type: Pe,
|
|
424
|
+
message: H(e)
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
async confirmWelcome() {
|
|
429
|
+
this.store.getState().phase === "welcome" && (this.store.setState({ phase: "active" }), await this.firstLoad(this.welcomeChatLogs));
|
|
430
|
+
}
|
|
431
|
+
async firstLoad(e) {
|
|
432
|
+
var t;
|
|
433
|
+
if (e.length === 0) {
|
|
434
|
+
await this.loadNext();
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
let n = this.store.getState().bubbles, r = n[n.length - 1];
|
|
438
|
+
!(r == null || (t = r.types) == null) && t.includes(o.HINT) && await this.loadNext({
|
|
439
|
+
userAgent: this.userAgent,
|
|
440
|
+
questionId: r.questionId
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
async submitTextAnswer(e, t) {
|
|
444
|
+
await this.submitFreeText(e, t);
|
|
445
|
+
}
|
|
446
|
+
async submitEmailAnswer(e) {
|
|
447
|
+
let t = ae(e);
|
|
448
|
+
return t.ok ? (await this.submitFreeText(t.text), { status: "submitted" }) : {
|
|
449
|
+
status: "invalid",
|
|
450
|
+
errorKey: t.errorKey
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
async submitPhoneAnswer(e, t) {
|
|
454
|
+
let n = await ce(e, t);
|
|
455
|
+
return n.ok ? (await this.submitFreeText(n.text), { status: "submitted" }) : (n.possiblePhoneNumber && this.emitter.emit(F.LOG, {
|
|
456
|
+
type: He,
|
|
457
|
+
message: `Invalid phone number for ${t}: ${e}`
|
|
458
|
+
}), {
|
|
459
|
+
status: "invalid",
|
|
460
|
+
errorKey: n.errorKey
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
async submitNameAnswer(e) {
|
|
464
|
+
let t = this.currentPiiType();
|
|
465
|
+
if (!t) return {
|
|
466
|
+
status: "invalid",
|
|
467
|
+
errorKey: L.fullName
|
|
468
|
+
};
|
|
469
|
+
let n = oe(t, e);
|
|
470
|
+
if (!n.ok) return {
|
|
471
|
+
status: "invalid",
|
|
472
|
+
errorKey: n.errorKey
|
|
473
|
+
};
|
|
474
|
+
if (se(t, n.text)) {
|
|
475
|
+
let e = re[t];
|
|
476
|
+
if (e) try {
|
|
477
|
+
let t = (await this.client.extractHumanName(this.assessmentId, {
|
|
478
|
+
userText: n.text,
|
|
479
|
+
extractType: e
|
|
480
|
+
}))[e];
|
|
481
|
+
if (t && t !== n.text) return {
|
|
482
|
+
status: "confirm-name",
|
|
483
|
+
suggested: t,
|
|
484
|
+
original: n.text
|
|
485
|
+
};
|
|
486
|
+
} catch (e) {
|
|
487
|
+
this.emitter.emit(F.ERROR, {
|
|
488
|
+
type: Ie,
|
|
489
|
+
message: H(e)
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return await this.submitFreeText(n.text), { status: "submitted" };
|
|
494
|
+
}
|
|
495
|
+
async submitNameConfirmed(e) {
|
|
496
|
+
await this.submitFreeText(e);
|
|
497
|
+
}
|
|
498
|
+
async submitLocationAnswer(e) {
|
|
499
|
+
let t = this.currentQuestionId();
|
|
500
|
+
!t || this.store.getState().sendingAnswer || await this.dispatchFreshOrEdit(t, {
|
|
501
|
+
text: e.address,
|
|
502
|
+
value: JSON.stringify(e)
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
enterEditMode(e) {
|
|
506
|
+
this.store.getState().sendingAnswer || this.store.setState((t) => ({
|
|
507
|
+
editingQuestionId: e,
|
|
508
|
+
bubbles: t.bubbles.map((t) => t.sender === n.CANDIDATE && t.questionId === e ? {
|
|
509
|
+
...t,
|
|
510
|
+
status: V.EDITING
|
|
511
|
+
} : t)
|
|
512
|
+
}));
|
|
513
|
+
}
|
|
514
|
+
cancelEditMode() {
|
|
515
|
+
this.store.setState((e) => ({
|
|
516
|
+
editingQuestionId: void 0,
|
|
517
|
+
bubbles: e.bubbles.map((e) => e.status === V.EDITING ? {
|
|
518
|
+
...e,
|
|
519
|
+
status: V.ANSWERED
|
|
520
|
+
} : e)
|
|
521
|
+
}));
|
|
522
|
+
}
|
|
523
|
+
async submitVideoAnswer(e, t) {
|
|
524
|
+
let n = this.currentEditableQuestionId();
|
|
525
|
+
if (!n || this.store.getState().sendingAnswer) return;
|
|
526
|
+
let r = `${Ge}-${n}`;
|
|
527
|
+
this.lastVideoAnswer = {
|
|
528
|
+
questionId: n,
|
|
529
|
+
blob: e,
|
|
530
|
+
extension: t
|
|
531
|
+
}, this.upsertVideoBubble(r, n, {
|
|
532
|
+
status: V.PENDING,
|
|
533
|
+
uploadProgress: 0,
|
|
534
|
+
videoBlob: e,
|
|
535
|
+
videoExtension: t
|
|
536
|
+
}), this.store.setState({ sendingAnswer: !0 });
|
|
537
|
+
try {
|
|
538
|
+
let { url: i, videoFileName: a } = await this.client.getVideoUploadUrl(this.assessmentId, n, t);
|
|
539
|
+
await this.client.uploadVideo(i, e, t, (i) => {
|
|
540
|
+
this.upsertVideoBubble(r, n, {
|
|
541
|
+
status: V.PENDING,
|
|
542
|
+
uploadProgress: i,
|
|
543
|
+
videoBlob: e,
|
|
544
|
+
videoExtension: t
|
|
545
|
+
});
|
|
546
|
+
});
|
|
547
|
+
let o = {
|
|
548
|
+
text: a,
|
|
549
|
+
value: a
|
|
550
|
+
};
|
|
551
|
+
this.store.getState().editingQuestionId === n ? (this.removeBubble(r), await this.editExistingAnswer(n, o)) : (this.upsertVideoBubble(r, n, {
|
|
552
|
+
status: V.PENDING,
|
|
553
|
+
uploadProgress: void 0,
|
|
554
|
+
videoBlob: e,
|
|
555
|
+
videoExtension: t
|
|
556
|
+
}), this.pendingBubbleId = r, await this.loadNext({
|
|
557
|
+
userAgent: this.userAgent,
|
|
558
|
+
questionId: n,
|
|
559
|
+
answer: o
|
|
560
|
+
})), this.lastVideoAnswer = void 0;
|
|
561
|
+
} catch (i) {
|
|
562
|
+
this.upsertVideoBubble(r, n, {
|
|
563
|
+
status: V.FAILED,
|
|
564
|
+
videoBlob: e,
|
|
565
|
+
videoExtension: t
|
|
566
|
+
}), this.store.setState({ sendingAnswer: !1 }), this.emitter.emit(F.ERROR, {
|
|
567
|
+
type: Re,
|
|
568
|
+
message: H(i)
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
async retryVideoAnswer() {
|
|
573
|
+
if (!this.lastVideoAnswer) return;
|
|
574
|
+
let { blob: e, extension: t } = this.lastVideoAnswer;
|
|
575
|
+
await this.submitVideoAnswer(e, t);
|
|
576
|
+
}
|
|
577
|
+
async getVideoPlaybackUrl(e, t) {
|
|
578
|
+
return (await this.client.getVideoAccessUrl(this.assessmentId, e, t)).url;
|
|
579
|
+
}
|
|
580
|
+
upsertVideoBubble(e, t, r) {
|
|
581
|
+
this.store.setState((i) => {
|
|
582
|
+
let a = i.bubbles.find((t) => t.id === e), s = {
|
|
583
|
+
id: e,
|
|
584
|
+
questionId: t,
|
|
585
|
+
sender: n.CANDIDATE,
|
|
586
|
+
status: V.PENDING,
|
|
587
|
+
types: [o.VIDEO],
|
|
588
|
+
data: { messageItems: [] },
|
|
589
|
+
...a,
|
|
590
|
+
...r
|
|
591
|
+
};
|
|
592
|
+
return { bubbles: a ? i.bubbles.map((t) => t.id === e ? s : t) : [...i.bubbles, s] };
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
removeBubble(e) {
|
|
596
|
+
this.store.setState((t) => ({ bubbles: t.bubbles.filter((t) => t.id !== e) }));
|
|
597
|
+
}
|
|
598
|
+
async submitFreeText(e, t) {
|
|
599
|
+
let n = this.currentEditableQuestionId();
|
|
600
|
+
!n || this.store.getState().sendingAnswer || await this.dispatchFreshOrEdit(n, {
|
|
601
|
+
text: e,
|
|
602
|
+
value: e,
|
|
603
|
+
...t ? { html: t } : {}
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
async dispatchFreshOrEdit(e, t) {
|
|
607
|
+
if (this.store.getState().editingQuestionId === e) {
|
|
608
|
+
await this.editExistingAnswer(e, t);
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
let n = {
|
|
612
|
+
userAgent: this.userAgent,
|
|
613
|
+
questionId: e,
|
|
614
|
+
answer: t
|
|
615
|
+
};
|
|
616
|
+
this.appendOptimisticCandidateBubble(n), await this.loadNext(n);
|
|
617
|
+
}
|
|
618
|
+
async editExistingAnswer(e, t) {
|
|
619
|
+
this.store.setState((r) => ({
|
|
620
|
+
sendingAnswer: !0,
|
|
621
|
+
bubbles: r.bubbles.map((r) => r.sender === n.CANDIDATE && r.questionId === e ? {
|
|
622
|
+
...r,
|
|
623
|
+
status: V.PENDING,
|
|
624
|
+
data: {
|
|
625
|
+
...r.data,
|
|
626
|
+
answer: t
|
|
627
|
+
}
|
|
628
|
+
} : r)
|
|
629
|
+
}));
|
|
630
|
+
try {
|
|
631
|
+
let r = me((await this.client.editAnswer(this.assessmentId, {
|
|
632
|
+
questionId: e,
|
|
633
|
+
answer: t
|
|
634
|
+
})).updatedCandidateResponse);
|
|
635
|
+
this.store.setState((t) => ({
|
|
636
|
+
sendingAnswer: !1,
|
|
637
|
+
editingQuestionId: void 0,
|
|
638
|
+
bubbles: t.bubbles.map((t) => t.sender === n.CANDIDATE && t.questionId === e ? r : t)
|
|
639
|
+
})), this.emitter.emit(F.ANSWER_EDITED, { questionId: e });
|
|
640
|
+
} catch (t) {
|
|
641
|
+
this.store.setState((t) => ({
|
|
642
|
+
sendingAnswer: !1,
|
|
643
|
+
bubbles: t.bubbles.map((t) => t.sender === n.CANDIDATE && t.questionId === e ? {
|
|
644
|
+
...t,
|
|
645
|
+
status: V.EDITING
|
|
646
|
+
} : t)
|
|
647
|
+
})), this.emitter.emit(F.ERROR, {
|
|
648
|
+
type: Le,
|
|
649
|
+
message: H(t)
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
currentEditableQuestionId() {
|
|
654
|
+
var e;
|
|
655
|
+
return (e = this.store.getState().editingQuestionId) == null ? this.currentQuestionId() : e;
|
|
656
|
+
}
|
|
657
|
+
currentPiiType() {
|
|
658
|
+
var e;
|
|
659
|
+
let t = this.store.getState().bubbles.filter((e) => e.sender === n.AGENT);
|
|
660
|
+
return (e = t[t.length - 1]) == null ? void 0 : e.piiQuestionType;
|
|
661
|
+
}
|
|
662
|
+
async submitOptionAnswer(e, t = !1) {
|
|
663
|
+
var n;
|
|
664
|
+
let r = this.currentEditableQuestionId();
|
|
665
|
+
if (!r || this.store.getState().sendingAnswer) return;
|
|
666
|
+
let i = this.inlineCandidateBubble(r), a = i == null || (n = i.data.messageItems) == null || (n = n[0]) == null || (n = n.contents) == null ? void 0 : n.find((t) => t.id === e);
|
|
667
|
+
if (!(!i || !a)) {
|
|
668
|
+
if (!t && await this.detectedAgc(i)) {
|
|
669
|
+
this.pendingAgcOptionId = e;
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
await this.submitInlineAnswer(i, r, Qe(a));
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
async detectedAgc(e) {
|
|
676
|
+
if (e.messageIdentifier !== We || !this.store.getState().allowNextAgcDetection) return !1;
|
|
677
|
+
try {
|
|
678
|
+
let e = await this.client.detectAgc(this.assessmentId);
|
|
679
|
+
if (this.store.setState({
|
|
680
|
+
agcAttempt: e.attempt,
|
|
681
|
+
allowNextAgcDetection: e.allowNextAgcDetection
|
|
682
|
+
}), e.isAgc) return this.store.setState({ showAgcWarning: !0 }), !0;
|
|
683
|
+
} catch (e) {
|
|
684
|
+
this.emitter.emit(F.ERROR, {
|
|
685
|
+
type: Ve,
|
|
686
|
+
message: H(e)
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
return !1;
|
|
690
|
+
}
|
|
691
|
+
async continueAfterAgcWarning() {
|
|
692
|
+
let e = this.pendingAgcOptionId;
|
|
693
|
+
this.pendingAgcOptionId = void 0, this.store.setState({ showAgcWarning: !1 }), e && await this.submitOptionAnswer(e, !0);
|
|
694
|
+
}
|
|
695
|
+
dismissAgcWarning() {
|
|
696
|
+
this.pendingAgcOptionId = void 0, this.store.setState({ showAgcWarning: !1 });
|
|
697
|
+
}
|
|
698
|
+
reportPaste() {
|
|
699
|
+
this.emitter.emit(F.LOG, {
|
|
700
|
+
type: Ue,
|
|
701
|
+
message: "Candidate pasted an answer"
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
async submitSliderAnswer(e) {
|
|
705
|
+
let t = this.currentEditableQuestionId();
|
|
706
|
+
if (!t || this.store.getState().sendingAnswer) return;
|
|
707
|
+
let n = this.inlineCandidateBubble(t);
|
|
708
|
+
n && await this.submitInlineAnswer(n, t, {
|
|
709
|
+
text: String(e),
|
|
710
|
+
value: String(e)
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
async submitInlineAnswer(e, t, n) {
|
|
714
|
+
if (this.store.getState().editingQuestionId === t) {
|
|
715
|
+
await this.editExistingAnswer(t, n);
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
this.pendingBubbleId = e.id, this.store.setState((t) => ({ bubbles: t.bubbles.map((t) => t.id === e.id ? {
|
|
719
|
+
...t,
|
|
720
|
+
status: V.PENDING,
|
|
721
|
+
data: {
|
|
722
|
+
...t.data,
|
|
723
|
+
answer: n
|
|
724
|
+
}
|
|
725
|
+
} : t) })), await this.loadNext({
|
|
726
|
+
userAgent: this.userAgent,
|
|
727
|
+
questionId: t,
|
|
728
|
+
answer: n
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
async retryLastAnswer() {
|
|
732
|
+
if (!this.lastFailedInput) return;
|
|
733
|
+
let e = this.lastFailedInput;
|
|
734
|
+
this.lastFailedInput = void 0, this.setPendingBubbleStatus(V.PENDING), await this.loadNext(e);
|
|
735
|
+
}
|
|
736
|
+
currentQuestionId() {
|
|
737
|
+
var e;
|
|
738
|
+
let t = this.store.getState().bubbles.filter((e) => e.sender === n.AGENT);
|
|
739
|
+
return (e = t[t.length - 1]) == null ? void 0 : e.questionId;
|
|
740
|
+
}
|
|
741
|
+
inlineCandidateBubble(e) {
|
|
742
|
+
return this.store.getState().bubbles.find((t) => t.sender === n.CANDIDATE && t.questionId === e && (t.status === V.ANSWERING || t.status === V.FAILED || t.status === V.EDITING));
|
|
743
|
+
}
|
|
744
|
+
appendOptimisticCandidateBubble(e) {
|
|
745
|
+
var t, r, i, a;
|
|
746
|
+
let s = {
|
|
747
|
+
id: `${Ke}-${e.questionId}`,
|
|
748
|
+
questionId: e.questionId,
|
|
749
|
+
sender: n.CANDIDATE,
|
|
750
|
+
status: V.PENDING,
|
|
751
|
+
types: [o.FTQ],
|
|
752
|
+
data: {
|
|
753
|
+
messageItems: [{
|
|
754
|
+
id: e.questionId,
|
|
755
|
+
types: [],
|
|
756
|
+
contents: [{
|
|
757
|
+
id: e.questionId,
|
|
758
|
+
text: (t = (r = e.answer) == null ? void 0 : r.text) == null ? "" : t,
|
|
759
|
+
value: (i = (a = e.answer) == null ? void 0 : a.value) == null ? "" : i
|
|
760
|
+
}]
|
|
761
|
+
}],
|
|
762
|
+
...e.answer ? { answer: e.answer } : {}
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
this.pendingBubbleId = s.id, this.store.setState((e) => ({ bubbles: [...e.bubbles, s] }));
|
|
766
|
+
}
|
|
767
|
+
setPendingBubbleStatus(e) {
|
|
768
|
+
let t = this.pendingBubbleId;
|
|
769
|
+
t && this.store.setState((n) => ({ bubbles: n.bubbles.map((n) => n.id === t ? {
|
|
770
|
+
...n,
|
|
771
|
+
status: e
|
|
772
|
+
} : n) }));
|
|
773
|
+
}
|
|
774
|
+
replacePendingBubble(e) {
|
|
775
|
+
let t = this.pendingBubbleId;
|
|
776
|
+
this.store.setState((n) => ({ bubbles: t ? n.bubbles.map((n) => n.id === t ? e : n) : [...n.bubbles, e] }));
|
|
777
|
+
}
|
|
778
|
+
async loadNext(e) {
|
|
779
|
+
var t;
|
|
780
|
+
(t = this.streamAbort) == null || t.abort();
|
|
781
|
+
let n = new AbortController();
|
|
782
|
+
this.streamAbort = n, this.store.setState({
|
|
783
|
+
sendingAnswer: !!(e != null && e.answer),
|
|
784
|
+
typing: !0
|
|
785
|
+
});
|
|
786
|
+
let r = `${B}-${this.streamSeq++}`, i = "", a = 0, s, c, l = /* @__PURE__ */ new Map(), u = !1, d = !1, f = () => {
|
|
787
|
+
let e = this.buildLiveBubble(r, i.slice(0, a), s);
|
|
788
|
+
this.store.setState((t) => ({
|
|
789
|
+
typing: !1,
|
|
790
|
+
streamingBubbleId: r,
|
|
791
|
+
bubbles: d ? t.bubbles.map((t) => t.id === r ? e : t) : [...t.bubbles, e]
|
|
792
|
+
})), d = !0;
|
|
793
|
+
}, p = (e) => {
|
|
794
|
+
var t;
|
|
795
|
+
a = i.length;
|
|
796
|
+
let n = this.buildLiveBubble(e, i, l.get(e), !0);
|
|
797
|
+
n.status = V.ANSWERED, (t = n.types) != null && t.length || (n.types = [o.HINT]), this.store.setState((e) => ({
|
|
798
|
+
streamingBubbleId: void 0,
|
|
799
|
+
bubbles: d ? e.bubbles.map((e) => e.id === r ? n : e) : [...e.bubbles, n]
|
|
800
|
+
})), r = `${B}-${this.streamSeq++}`, i = "", a = 0, d = !1, s = void 0;
|
|
801
|
+
}, m = (async () => {
|
|
802
|
+
for (; a < i.length || !u;) {
|
|
803
|
+
if (a >= i.length) {
|
|
804
|
+
await Je(8);
|
|
805
|
+
continue;
|
|
806
|
+
}
|
|
807
|
+
a = this.streamRevealMs === 0 ? i.length : Math.min(i.length, a + 2), f(), this.streamRevealMs > 0 && await Je(this.streamRevealMs);
|
|
808
|
+
}
|
|
809
|
+
})(), h = () => this.store.setState((e) => ({
|
|
810
|
+
streamingBubbleId: void 0,
|
|
811
|
+
bubbles: e.bubbles.filter((e) => e.id !== r)
|
|
812
|
+
}));
|
|
813
|
+
try {
|
|
814
|
+
var g;
|
|
815
|
+
let t = await this.client.nextStream(this.assessmentId, e, {
|
|
816
|
+
signal: n.signal,
|
|
817
|
+
onMeta: (e) => {
|
|
818
|
+
l.set(e._id, e), (c === void 0 || c === e._id) && (s = e, d && f());
|
|
819
|
+
},
|
|
820
|
+
onDelta: (e, t) => {
|
|
821
|
+
var n;
|
|
822
|
+
let r = t.split(":")[0];
|
|
823
|
+
c !== void 0 && r !== c && p(c), c = r, s = (n = l.get(r)) == null ? s : n, i += e;
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
if (u = !0, await m, (g = t.nextResponse) != null && g.data ? h() : c && p(c), this.settleAnswerAndStatus(t, e)) return;
|
|
827
|
+
await this.appendAgentAndContinue(t, s);
|
|
828
|
+
} catch (t) {
|
|
829
|
+
if (u = !0, await m.catch(() => {}), t.name === "AbortError") return;
|
|
830
|
+
h(), this.lastFailedInput = e, this.setPendingBubbleStatus(V.FAILED), this.store.setState({
|
|
831
|
+
typing: !1,
|
|
832
|
+
sendingAnswer: !1
|
|
833
|
+
}), this.emitter.emit(F.ERROR, {
|
|
834
|
+
type: Fe,
|
|
835
|
+
message: H(t)
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
buildLiveBubble(e, t, r, i = !1) {
|
|
840
|
+
var o, s, c, l, u, d;
|
|
841
|
+
let f = i ? r == null || (o = r.contents) == null ? void 0 : o[0] : void 0;
|
|
842
|
+
return {
|
|
843
|
+
id: e,
|
|
844
|
+
questionId: (s = r == null ? void 0 : r._id) == null ? e : s,
|
|
845
|
+
sender: n.AGENT,
|
|
846
|
+
status: V.ANSWERING,
|
|
847
|
+
types: (c = r == null ? void 0 : r.types) == null ? [] : c,
|
|
848
|
+
usageWhitelist: r == null ? void 0 : r.usageWhitelist,
|
|
849
|
+
masterId: r == null ? void 0 : r.masterId,
|
|
850
|
+
messageKind: r == null ? void 0 : r.kind,
|
|
851
|
+
piiQuestionType: fe(r == null ? void 0 : r.tags),
|
|
852
|
+
videoQuestionType: pe(r == null ? void 0 : r.tags),
|
|
853
|
+
data: {
|
|
854
|
+
rules: r == null ? void 0 : r.rules,
|
|
855
|
+
tags: r == null ? void 0 : r.tags,
|
|
856
|
+
messageItems: [{
|
|
857
|
+
id: e,
|
|
858
|
+
types: (l = f == null ? void 0 : f.types) == null ? [a.TEXT] : l,
|
|
859
|
+
component: (u = f == null ? void 0 : f.component) == null ? r == null || (d = r.contents) == null || (d = d[0]) == null ? void 0 : d.component : u,
|
|
860
|
+
contents: [{
|
|
861
|
+
id: e,
|
|
862
|
+
value: t,
|
|
863
|
+
text: t
|
|
864
|
+
}]
|
|
865
|
+
}]
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
handleTerminalSignals(e) {
|
|
870
|
+
var t;
|
|
871
|
+
e.duplicatedWithAssessmentLink && this.emitter.emit(F.ASSESSMENT_DUPLICATED, {
|
|
872
|
+
assessmentId: this.assessmentId,
|
|
873
|
+
duplicatedWithAssessmentLink: e.duplicatedWithAssessmentLink
|
|
874
|
+
});
|
|
875
|
+
let n = (t = e.cohortIsArchivedMessage) == null ? e.assessmentIsReusedMessage : t;
|
|
876
|
+
if (n != null && n.data) {
|
|
877
|
+
let e = he(n);
|
|
878
|
+
return this.store.setState((t) => ({
|
|
879
|
+
phase: "ended",
|
|
880
|
+
typing: !1,
|
|
881
|
+
bubbles: [...t.bubbles, e]
|
|
882
|
+
})), this.emitter.emit(F.ASSESSMENT_ENDED, { assessmentId: this.assessmentId }), !0;
|
|
883
|
+
}
|
|
884
|
+
return !1;
|
|
885
|
+
}
|
|
886
|
+
settleAnswerAndStatus(e, t) {
|
|
887
|
+
var n;
|
|
888
|
+
if (t != null && t.answer) {
|
|
889
|
+
var r;
|
|
890
|
+
let n = e.candidateResponse;
|
|
891
|
+
n && ((r = n.data) == null || (r = r.question) == null ? void 0 : r._id) === t.questionId ? this.replacePendingBubble(me(n)) : this.setPendingBubbleStatus(V.ANSWERED), this.pendingBubbleId = void 0, this.emitter.emit(F.ANSWER_SAVED, { questionId: t.questionId });
|
|
892
|
+
}
|
|
893
|
+
return this.store.setState({
|
|
894
|
+
sendingAnswer: !1,
|
|
895
|
+
assessmentStatus: e.assessmentStatus,
|
|
896
|
+
numOfNormalAnswer: (n = e.numOfNormalAnswer) == null ? this.store.getState().numOfNormalAnswer : n
|
|
897
|
+
}), this.handleTerminalSignals(e);
|
|
898
|
+
}
|
|
899
|
+
async appendAgentAndContinue(e, t) {
|
|
900
|
+
let n = e.nextResponse;
|
|
901
|
+
if (n != null && n.data) {
|
|
902
|
+
var r;
|
|
903
|
+
let e = Ze(he(n), t), i = _e(n);
|
|
904
|
+
if (this.store.setState((t) => ({
|
|
905
|
+
typing: !1,
|
|
906
|
+
bubbles: i ? [
|
|
907
|
+
...t.bubbles,
|
|
908
|
+
e,
|
|
909
|
+
i
|
|
910
|
+
] : [...t.bubbles, e]
|
|
911
|
+
})), (r = n.data.types) != null && r.includes(o.HINT)) {
|
|
912
|
+
await this.loadNext({
|
|
913
|
+
userAgent: this.userAgent,
|
|
914
|
+
questionId: n.data._id
|
|
915
|
+
});
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
} else this.store.setState({ typing: !1 });
|
|
919
|
+
(!(n != null && n.data) || Ye(e.assessmentStatus)) && (this.store.setState({ phase: "ended" }), this.emitter.emit(F.ASSESSMENT_ENDED, { assessmentId: this.assessmentId }));
|
|
920
|
+
}
|
|
921
|
+
}, H = (e) => e instanceof Error ? e.message : String(e), Ze = (e, t) => t ? (e.messageKind = t.kind, e.data.messageItems.forEach((e, n) => {
|
|
922
|
+
var r;
|
|
923
|
+
e.component = (r = t.contents) == null || (r = r[n]) == null ? void 0 : r.component;
|
|
924
|
+
}), e) : e, Qe = (e) => ({
|
|
925
|
+
text: e.text,
|
|
926
|
+
value: e.value,
|
|
927
|
+
...e.triggers ? { triggers: e.triggers } : {},
|
|
928
|
+
...e.style ? { style: e.style } : {}
|
|
929
|
+
}), $e = {
|
|
930
|
+
phase: "idle",
|
|
931
|
+
bubbles: [],
|
|
932
|
+
typing: !1,
|
|
933
|
+
sendingAnswer: !1,
|
|
934
|
+
numOfNormalQuestion: 0,
|
|
935
|
+
numOfNormalAnswer: 0
|
|
936
|
+
}, et = () => x(() => ({ ...$e })), tt = {
|
|
937
|
+
fi_label_typing: "Typing",
|
|
938
|
+
fi_button_edit: "Edit",
|
|
939
|
+
fi_button_continue: "Continue",
|
|
940
|
+
fi_button_retry: "Retry",
|
|
941
|
+
fi_button_record: "Record",
|
|
942
|
+
fi_button_stop: "Stop",
|
|
943
|
+
fi_button_tryAgain: "Try Again",
|
|
944
|
+
fi_button_submitRating: "Submit rating",
|
|
945
|
+
fi_label_editing: "Editing",
|
|
946
|
+
fi_label_ratingMessage: "Rate your experience!",
|
|
947
|
+
fi_label_enterResponse: "Enter your response…",
|
|
948
|
+
fi_label_uploading: "Uploading your video",
|
|
949
|
+
fi_label_uploadFailed: "Your video failed to upload.",
|
|
950
|
+
fi_label_cancelEditDesktop: "Cancel edit",
|
|
951
|
+
fi_placeholder_dropdown: "Type to search…",
|
|
952
|
+
fi_placeholder_demoEmailInput: "Enter your email",
|
|
953
|
+
fi_error_piiEmail: "Please enter a valid email address.",
|
|
954
|
+
fi_error_piiFullName: "Please enter a valid full name.",
|
|
955
|
+
fi_error_piiFirstName: "Please enter a valid first name.",
|
|
956
|
+
fi_error_piiLastName: "Please enter a valid last name.",
|
|
957
|
+
fi_error_piiPhoneNumber: "Please enter a valid phone number.",
|
|
958
|
+
fi_error_sendAnswerFailed: "We could not send your answer. Please try again.",
|
|
959
|
+
fi_error_submitVideo: "We could not submit your video. Please try again.",
|
|
960
|
+
sc_header_title: "Interview",
|
|
961
|
+
sc_header_subtitle: "Sapia chat interview",
|
|
962
|
+
sc_speaker_interviewer: "Interviewer",
|
|
963
|
+
sc_single_choice_label: "Single choice question",
|
|
964
|
+
sc_video_badge: "Video",
|
|
965
|
+
sc_typing: "Interviewer is typing",
|
|
966
|
+
sc_typing_reading: "Reading your response",
|
|
967
|
+
sc_typing_thinking: "Thinking about it",
|
|
968
|
+
sc_progress_label: "Interview progress",
|
|
969
|
+
sc_question_counter: "Question {{current}} of {{total}}",
|
|
970
|
+
sc_getting_started: "Getting started",
|
|
971
|
+
sc_pause_hint: "Pause anytime — come back with this link",
|
|
972
|
+
sc_copy_link: "Copy link",
|
|
973
|
+
sc_copied: "Copied ✓",
|
|
974
|
+
sc_role_with_company: "{{role}} role with {{company}}",
|
|
975
|
+
sc_welcome_greeting: "Hi {{name}}.",
|
|
976
|
+
sc_welcome_greeting_generic: "Hi there.",
|
|
977
|
+
sc_welcome_title: "Welcome to your Chat Interview",
|
|
978
|
+
sc_welcome_eyebrow: "Chat interview",
|
|
979
|
+
sc_welcome_copy_resume: "Copy link · resume later",
|
|
980
|
+
sc_welcome_intro: "A conversation for the {{role}} role with {{company}} — answered in your own words, read blind to your name, age and background.",
|
|
981
|
+
sc_welcome_intro_generic: "A conversation answered in your own words, read blind to your name, age and background.",
|
|
982
|
+
sc_welcome_pause: "You can pause and come back later with this link",
|
|
983
|
+
sc_welcome_next: "Next",
|
|
984
|
+
sc_welcome_reassurance: "No right or wrong answers. Take your time.",
|
|
985
|
+
sc_answer_looks_good: "Looking good",
|
|
986
|
+
sc_composer_footer: "Your answers are confidential",
|
|
987
|
+
sc_rich_toolbar: "Text formatting",
|
|
988
|
+
sc_rich_bold: "Bold",
|
|
989
|
+
sc_rich_italic: "Italic",
|
|
990
|
+
sc_rich_underline: "Underline",
|
|
991
|
+
sc_rich_bullet_list: "Bulleted list",
|
|
992
|
+
sc_rich_number_list: "Numbered list",
|
|
993
|
+
sc_button_send: "Send",
|
|
994
|
+
sc_input_label: "Your answer",
|
|
995
|
+
sc_options_group: "Answer options",
|
|
996
|
+
sc_dropdown_search_label: "Search options",
|
|
997
|
+
sc_min_length_hint: "Please write at least {{min}} characters",
|
|
998
|
+
sc_loading: "Loading your interview…",
|
|
999
|
+
sc_preparing: "Preparing your interview…",
|
|
1000
|
+
sc_done_title: "That's everything.",
|
|
1001
|
+
sc_done_title_named: "That's everything, {{name}}.",
|
|
1002
|
+
sc_done_subtitle: "Thanks for being generous with your answers — the {{company}} team takes it from here.",
|
|
1003
|
+
sc_done_subtitle_generic: "Thanks for being generous with your answers — the team takes it from here.",
|
|
1004
|
+
sc_done_next_label: "What happens next",
|
|
1005
|
+
sc_done_step1: "Your answers are assessed on what you said — blind to name, age and background.",
|
|
1006
|
+
sc_done_step2: "You'll get personalised feedback whatever the outcome — usually within a few days.",
|
|
1007
|
+
sc_done_step3: "If it's a match, the team will reach out about next steps.",
|
|
1008
|
+
sc_done_rating_prompt: "How did this interview feel?",
|
|
1009
|
+
sc_start_failed: "We could not load your interview. Please refresh the page to try again.",
|
|
1010
|
+
sc_phone_country_label: "Country code",
|
|
1011
|
+
sc_phone_input_label: "Phone number",
|
|
1012
|
+
sc_phone_placeholder: "Enter your phone number",
|
|
1013
|
+
sc_name_confirm_title: "Is this correct?",
|
|
1014
|
+
sc_name_confirm_body: "We read your name as \"{{suggested}}\". Use this?",
|
|
1015
|
+
sc_name_use_suggested: "Use \"{{suggested}}\"",
|
|
1016
|
+
sc_name_use_original: "Keep what I typed",
|
|
1017
|
+
sc_video_open_camera: "Turn on camera",
|
|
1018
|
+
sc_video_re_record: "Re-record",
|
|
1019
|
+
sc_video_submit: "Use this answer",
|
|
1020
|
+
sc_video_camera: "Camera",
|
|
1021
|
+
sc_video_microphone: "Microphone",
|
|
1022
|
+
sc_video_on: "On",
|
|
1023
|
+
sc_video_off: "Off",
|
|
1024
|
+
sc_video_finish_hint: "Tap to finish",
|
|
1025
|
+
sc_video_camera_off: "Camera is off",
|
|
1026
|
+
sc_video_attempts: "{{current}}/{{max}} attempts",
|
|
1027
|
+
sc_video_camera_error: "We could not access your camera. Please check permissions and try again.",
|
|
1028
|
+
sc_video_preview: "Camera preview",
|
|
1029
|
+
sc_video_retry_upload: "Retry upload",
|
|
1030
|
+
sc_video_play: "Play video",
|
|
1031
|
+
sc_video_answer: "Your video answer",
|
|
1032
|
+
sc_video_embed_label: "Embedded video",
|
|
1033
|
+
sc_access_title: "Verify your identity",
|
|
1034
|
+
sc_access_description: "Please enter the email address you applied with to continue.",
|
|
1035
|
+
sc_access_input_label: "Email address",
|
|
1036
|
+
sc_access_placeholder: "you@example.com",
|
|
1037
|
+
sc_access_submit: "Continue",
|
|
1038
|
+
fi_error_emailDoesNotMatch: "That email does not match our records. Please try again.",
|
|
1039
|
+
fi_error_agcTitle: "Please answer in your own words",
|
|
1040
|
+
fi_error_agcFirstMessage: "Your answer looks like it may be AI-generated. Please edit it to be your own words.",
|
|
1041
|
+
fi_error_agcSecondMessage: "This is your final reminder — please make sure your answer is your own work."
|
|
1042
|
+
}, nt = (e, t) => e.replace(/\{\{\s*(\w+)\s*\}\}/g, (e, n) => (t == null ? void 0 : t[n]) === void 0 ? "" : String(t[n])), rt = (e, t) => t === void 0 ? e : t === 1 ? `${e}_one` : `${e}_other`, it = (e, t) => (n, r) => {
|
|
1043
|
+
var i, a, o, s;
|
|
1044
|
+
let c = rt(n, r == null ? void 0 : r.count);
|
|
1045
|
+
return nt((i = (a = (o = (s = e == null ? void 0 : e[c]) == null ? t[c] : s) == null ? e == null ? void 0 : e[n] : o) == null ? t[n] : a) == null ? n : i, r);
|
|
1046
|
+
}, at = [
|
|
1047
|
+
"header",
|
|
1048
|
+
"question",
|
|
1049
|
+
"response",
|
|
1050
|
+
"button"
|
|
1051
|
+
], ot = (e) => {
|
|
1052
|
+
var t;
|
|
1053
|
+
if (!e) return {};
|
|
1054
|
+
let n = {};
|
|
1055
|
+
return (t = e.theme) == null || t.forEach((e) => {
|
|
1056
|
+
if (at.includes(e.name)) {
|
|
1057
|
+
var t, r;
|
|
1058
|
+
n[e.name] = {
|
|
1059
|
+
backgroundColor: (t = e.value) == null ? void 0 : t.backgroundColor,
|
|
1060
|
+
fontColor: (r = e.value) == null ? void 0 : r.fontColor
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
}), e.font && (n.fontFamily = e.font), n;
|
|
1064
|
+
}, st = (e, t) => {
|
|
1065
|
+
var n, r;
|
|
1066
|
+
if (!(!e && !t)) return {
|
|
1067
|
+
backgroundColor: (n = t == null ? void 0 : t.backgroundColor) == null ? e == null ? void 0 : e.backgroundColor : n,
|
|
1068
|
+
fontColor: (r = t == null ? void 0 : t.fontColor) == null ? e == null ? void 0 : e.fontColor : r
|
|
1069
|
+
};
|
|
1070
|
+
}, ct = (e, t) => {
|
|
1071
|
+
var n;
|
|
1072
|
+
let r = e == null ? {} : e, i = t == null ? {} : t;
|
|
1073
|
+
return {
|
|
1074
|
+
header: st(r.header, i.header),
|
|
1075
|
+
question: st(r.question, i.question),
|
|
1076
|
+
response: st(r.response, i.response),
|
|
1077
|
+
button: st(r.button, i.button),
|
|
1078
|
+
fontFamily: (n = i.fontFamily) == null ? r.fontFamily : n
|
|
1079
|
+
};
|
|
1080
|
+
}, lt = "--sc-header-bg", ut = "--sc-header-fg", dt = "--sc-question-bg", ft = "--sc-question-fg", pt = "--sc-response-bg", mt = "--sc-response-fg", ht = "--sc-button-bg", gt = "--sc-button-fg", _t = "--sc-font-family", vt = (e) => {
|
|
1081
|
+
var t, n, r, i, a, o, s, c;
|
|
1082
|
+
if (!e) return {};
|
|
1083
|
+
let l = {}, u = (e, t) => {
|
|
1084
|
+
t && (l[e] = t);
|
|
1085
|
+
};
|
|
1086
|
+
return u(lt, (t = e.header) == null ? void 0 : t.backgroundColor), u(ut, (n = e.header) == null ? void 0 : n.fontColor), u(dt, (r = e.question) == null ? void 0 : r.backgroundColor), u(ft, (i = e.question) == null ? void 0 : i.fontColor), u(pt, (a = e.response) == null ? void 0 : a.backgroundColor), u(mt, (o = e.response) == null ? void 0 : o.fontColor), u(ht, (s = e.button) == null ? void 0 : s.backgroundColor), u(gt, (c = e.button) == null ? void 0 : c.fontColor), u(_t, e.fontFamily), l;
|
|
1087
|
+
}, yt = new Set([
|
|
1088
|
+
"B",
|
|
1089
|
+
"I",
|
|
1090
|
+
"U",
|
|
1091
|
+
"STRONG",
|
|
1092
|
+
"EM",
|
|
1093
|
+
"UL",
|
|
1094
|
+
"OL",
|
|
1095
|
+
"LI",
|
|
1096
|
+
"BR",
|
|
1097
|
+
"DIV",
|
|
1098
|
+
"P",
|
|
1099
|
+
"SPAN"
|
|
1100
|
+
]), bt = (e) => {
|
|
1101
|
+
if (typeof DOMParser > "u") return "";
|
|
1102
|
+
let t = new DOMParser().parseFromString(e, "text/html"), n = (e) => {
|
|
1103
|
+
Array.from(e.children).forEach((e) => {
|
|
1104
|
+
n(e), Array.from(e.attributes).forEach((t) => e.removeAttribute(t.name));
|
|
1105
|
+
let t = e.tagName;
|
|
1106
|
+
if (!yt.has(t)) e.replaceWith(...Array.from(e.childNodes));
|
|
1107
|
+
else if (t === "UL" || t === "OL") {
|
|
1108
|
+
let t = e;
|
|
1109
|
+
t.style.margin = "4px 0", t.style.paddingLeft = "22px";
|
|
1110
|
+
} else (t === "P" || t === "DIV") && (e.style.margin = "0");
|
|
1111
|
+
});
|
|
1112
|
+
};
|
|
1113
|
+
return n(t.body), t.body.innerHTML;
|
|
1114
|
+
}, xt = ({ options: e, selectedOptionId: t, enabled: n = !1, pending: r = !1, groupLabel: i, onSelect: a }) => /* @__PURE__ */ w("div", {
|
|
1115
|
+
role: "group",
|
|
1116
|
+
"aria-label": i,
|
|
1117
|
+
className: "sc:overflow-hidden sc:rounded-2xl sc:border sc:border-line sc:bg-question",
|
|
1118
|
+
children: e.map((e, i) => {
|
|
1119
|
+
let o = e.id === t;
|
|
1120
|
+
return /* @__PURE__ */ T("button", {
|
|
1121
|
+
type: "button",
|
|
1122
|
+
disabled: !n,
|
|
1123
|
+
"aria-pressed": o,
|
|
1124
|
+
"aria-busy": r && o ? !0 : void 0,
|
|
1125
|
+
onClick: () => a == null ? void 0 : a(e.id),
|
|
1126
|
+
className: `sc:flex sc:w-full sc:items-center sc:gap-3.5 sc:px-[18px] sc:py-[15px] sc:text-start sc:text-base sc:not-last:border-b sc:border-line sc:transition-colors ${o ? "sc:bg-button sc:text-button-fg" : "sc:text-question-fg"} ${n ? "sc:cursor-pointer sc:hover:bg-pink-tint sc:focus-visible:outline-2 sc:focus-visible:-outline-offset-2" : "sc:cursor-default"} ${r && o ? "sc:opacity-60" : ""}`,
|
|
1127
|
+
children: [/* @__PURE__ */ w("span", {
|
|
1128
|
+
"aria-hidden": "true",
|
|
1129
|
+
className: `sc:flex sc:size-7 sc:flex-shrink-0 sc:items-center sc:justify-center sc:rounded-lg sc:text-[13px] sc:font-bold sc:tabular-nums ${o ? "sc:bg-white/15 sc:text-button-fg" : "sc:bg-[#f1f0f3] sc:text-muted"}`,
|
|
1130
|
+
children: i + 1
|
|
1131
|
+
}), /* @__PURE__ */ T("span", { children: [e.text, r && o ? /* @__PURE__ */ w("span", {
|
|
1132
|
+
"aria-hidden": "true",
|
|
1133
|
+
children: " …"
|
|
1134
|
+
}) : null] })]
|
|
1135
|
+
}, e.id);
|
|
1136
|
+
})
|
|
1137
|
+
}), St = ({ options: e, selectedOptionId: t, enabled: n = !1, pending: r = !1, searchPlaceholder: i, searchLabel: a, groupLabel: o, onSelect: s }) => {
|
|
1138
|
+
let [c, l] = y(""), u = c.trim().toLowerCase(), d = u ? e.filter((e) => e.text.toLowerCase().includes(u)) : e;
|
|
1139
|
+
return /* @__PURE__ */ T("div", {
|
|
1140
|
+
className: "sc:flex sc:flex-col sc:gap-2 sc:min-w-60",
|
|
1141
|
+
children: [/* @__PURE__ */ w("input", {
|
|
1142
|
+
type: "text",
|
|
1143
|
+
value: c,
|
|
1144
|
+
disabled: !n,
|
|
1145
|
+
placeholder: i,
|
|
1146
|
+
"aria-label": a,
|
|
1147
|
+
onChange: (e) => l(e.target.value),
|
|
1148
|
+
className: "sc:rounded-md sc:border sc:border-black/20 sc:px-3 sc:py-2 sc:text-sm sc:focus-visible:outline-2 sc:focus-visible:outline-offset-1 sc:disabled:opacity-50"
|
|
1149
|
+
}), /* @__PURE__ */ w("div", {
|
|
1150
|
+
className: "sc:max-h-64 sc:overflow-y-auto",
|
|
1151
|
+
children: /* @__PURE__ */ w(xt, {
|
|
1152
|
+
options: d,
|
|
1153
|
+
selectedOptionId: t,
|
|
1154
|
+
enabled: n,
|
|
1155
|
+
pending: r,
|
|
1156
|
+
groupLabel: o,
|
|
1157
|
+
onSelect: s
|
|
1158
|
+
})
|
|
1159
|
+
})]
|
|
1160
|
+
});
|
|
1161
|
+
}, Ct = {
|
|
1162
|
+
primary: "sc:bg-button sc:text-button-fg sc:hover:bg-ink-strong sc:disabled:opacity-50 sc:disabled:cursor-not-allowed",
|
|
1163
|
+
ghost: "sc:bg-transparent sc:border sc:border-button sc:text-button sc:hover:bg-pink-tint sc:disabled:opacity-50"
|
|
1164
|
+
}, U = ({ children: e, variant: t = "primary", type: n = "button", className: r = "", ...i }) => /* @__PURE__ */ w("button", {
|
|
1165
|
+
type: n,
|
|
1166
|
+
className: `sc:inline-flex sc:items-center sc:justify-center sc:gap-2 sc:rounded-full sc:px-5 sc:py-2.5 sc:text-sm sc:font-semibold sc:transition-colors sc:focus-visible:outline-2 sc:focus-visible:outline-offset-2 ${Ct[t]} ${r}`,
|
|
1167
|
+
...i,
|
|
1168
|
+
children: e
|
|
1169
|
+
}), wt = ({ min: e, max: t, defaultValue: n, submittedValue: r, enabled: i = !1, pending: a = !1, label: o, hint: s, submitLabel: c, onSubmit: l }) => {
|
|
1170
|
+
let [u, d] = y(n), f = r == null ? u : r;
|
|
1171
|
+
return /* @__PURE__ */ T("div", {
|
|
1172
|
+
className: "sc:flex sc:flex-col sc:gap-2 sc:items-stretch sc:min-w-60",
|
|
1173
|
+
children: [
|
|
1174
|
+
/* @__PURE__ */ T("div", {
|
|
1175
|
+
className: "sc:flex sc:items-center sc:gap-2",
|
|
1176
|
+
children: [
|
|
1177
|
+
/* @__PURE__ */ w("span", {
|
|
1178
|
+
"aria-hidden": "true",
|
|
1179
|
+
className: "sc:text-xs sc:text-black/60",
|
|
1180
|
+
children: e
|
|
1181
|
+
}),
|
|
1182
|
+
/* @__PURE__ */ w("input", {
|
|
1183
|
+
type: "range",
|
|
1184
|
+
min: e,
|
|
1185
|
+
max: t,
|
|
1186
|
+
step: 1,
|
|
1187
|
+
value: f,
|
|
1188
|
+
disabled: !i,
|
|
1189
|
+
"aria-label": o,
|
|
1190
|
+
"aria-valuetext": String(f),
|
|
1191
|
+
onChange: (e) => d(Number(e.target.value)),
|
|
1192
|
+
className: "sc:flex-1 sc:accent-button sc:disabled:opacity-50"
|
|
1193
|
+
}),
|
|
1194
|
+
/* @__PURE__ */ w("span", {
|
|
1195
|
+
"aria-hidden": "true",
|
|
1196
|
+
className: "sc:text-xs sc:text-black/60",
|
|
1197
|
+
children: t
|
|
1198
|
+
})
|
|
1199
|
+
]
|
|
1200
|
+
}),
|
|
1201
|
+
/* @__PURE__ */ w("p", {
|
|
1202
|
+
className: "sc:text-sm sc:font-bold sc:text-question-fg",
|
|
1203
|
+
children: s
|
|
1204
|
+
}),
|
|
1205
|
+
i ? /* @__PURE__ */ w(U, {
|
|
1206
|
+
onClick: () => l == null ? void 0 : l(u),
|
|
1207
|
+
disabled: a,
|
|
1208
|
+
"aria-busy": a || void 0,
|
|
1209
|
+
children: c
|
|
1210
|
+
}) : null
|
|
1211
|
+
]
|
|
1212
|
+
});
|
|
1213
|
+
}, Tt = f(() => import("./EmbeddedVideoPlayer-SaMMfDIW.js").then((e) => ({ default: e.EmbeddedVideoPlayer }))), Et = ({ url: e, label: t }) => /* @__PURE__ */ w(d, {
|
|
1214
|
+
fallback: /* @__PURE__ */ w("div", {
|
|
1215
|
+
"aria-hidden": "true",
|
|
1216
|
+
className: "sc:w-full sc:aspect-video"
|
|
1217
|
+
}),
|
|
1218
|
+
children: /* @__PURE__ */ w(Tt, {
|
|
1219
|
+
url: e,
|
|
1220
|
+
label: t
|
|
1221
|
+
})
|
|
1222
|
+
}), Dt = ({ value: e, label: t }) => {
|
|
1223
|
+
let n = Math.round(e * 100);
|
|
1224
|
+
return /* @__PURE__ */ T("div", {
|
|
1225
|
+
className: "sc:flex sc:flex-col sc:gap-1 sc:min-w-60",
|
|
1226
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1227
|
+
role: "progressbar",
|
|
1228
|
+
"aria-label": t,
|
|
1229
|
+
"aria-valuenow": n,
|
|
1230
|
+
"aria-valuemin": 0,
|
|
1231
|
+
"aria-valuemax": 100,
|
|
1232
|
+
className: "sc:h-2 sc:w-full sc:overflow-hidden sc:rounded-full sc:bg-black/10",
|
|
1233
|
+
children: /* @__PURE__ */ w("div", {
|
|
1234
|
+
className: "sc:h-full sc:bg-response",
|
|
1235
|
+
style: { width: `${n}%` }
|
|
1236
|
+
})
|
|
1237
|
+
}), /* @__PURE__ */ T("span", {
|
|
1238
|
+
className: "sc:text-xs sc:text-black/60",
|
|
1239
|
+
children: [n, "%"]
|
|
1240
|
+
})]
|
|
1241
|
+
});
|
|
1242
|
+
}, Ot = ({ blob: e, resolveUrl: t, playLabel: n, label: r }) => {
|
|
1243
|
+
let [i, a] = y(void 0), [o, s] = y(!1);
|
|
1244
|
+
return m(() => {
|
|
1245
|
+
if (!e) return;
|
|
1246
|
+
let t = URL.createObjectURL(e);
|
|
1247
|
+
return a(t), () => URL.revokeObjectURL(t);
|
|
1248
|
+
}, [e]), i ? /* @__PURE__ */ w("video", {
|
|
1249
|
+
src: i,
|
|
1250
|
+
controls: !0,
|
|
1251
|
+
"aria-label": r,
|
|
1252
|
+
className: "sc:max-w-[500px] sc:w-full sc:rounded-2xl sc:bg-black"
|
|
1253
|
+
}) : /* @__PURE__ */ w("button", {
|
|
1254
|
+
type: "button",
|
|
1255
|
+
onClick: async () => {
|
|
1256
|
+
if (t) {
|
|
1257
|
+
s(!0);
|
|
1258
|
+
try {
|
|
1259
|
+
a(await t());
|
|
1260
|
+
} finally {
|
|
1261
|
+
s(!1);
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
},
|
|
1265
|
+
disabled: o || !t,
|
|
1266
|
+
className: "sc:rounded-2xl sc:bg-response sc:text-response-fg sc:px-4 sc:py-2.5 sc:text-sm sc:cursor-pointer sc:disabled:opacity-60",
|
|
1267
|
+
children: n
|
|
1268
|
+
});
|
|
1269
|
+
}, kt = ({ item: e, labels: t, sliderLabels: n, dropdownLabels: r, mediaLabels: i, onRetry: a, onSelectOption: o, onSubmitSlider: s, onEdit: c, onCancelEdit: l, onRetryVideo: u, onResolveVideoUrl: d, rootRef: f, footer: p }) => {
|
|
1270
|
+
let m = e.sender === "agent", h = e.variant === "card", g = h || m || !!(e.options || e.slider || e.video), _ = `sc:rounded-[18px] sc:rounded-br-[6px] sc:px-[17px] sc:py-[13px] sc:text-base/relaxed sc:break-words sc:[animation:sc-msg-in_.3s_ease_both] sc:[text-wrap:pretty] sc:bg-response sc:text-response-fg ${e.pending ? "sc:opacity-60" : ""} ${e.failed ? "sc:opacity-60 sc:border sc:border-red-400" : ""}`, v = e.streaming ? /* @__PURE__ */ w("span", {
|
|
1271
|
+
"aria-hidden": "true",
|
|
1272
|
+
className: "sc:ml-px sc:inline-block sc:h-[1em] sc:w-[3px] sc:translate-y-[0.12em] sc:rounded-[1px] sc:bg-pink-strong",
|
|
1273
|
+
style: { animation: "sc-caret-blink 1s step-end infinite" }
|
|
1274
|
+
}) : null, y = (t) => m && !e.streaming ? /* @__PURE__ */ w(S, {
|
|
1275
|
+
components: { a: ({ children: e, href: t }) => /* @__PURE__ */ w("a", {
|
|
1276
|
+
href: t,
|
|
1277
|
+
target: "_blank",
|
|
1278
|
+
rel: "noreferrer",
|
|
1279
|
+
className: "sc:underline",
|
|
1280
|
+
children: e
|
|
1281
|
+
}) },
|
|
1282
|
+
children: t
|
|
1283
|
+
}) : t;
|
|
1284
|
+
return /* @__PURE__ */ T("li", {
|
|
1285
|
+
ref: f,
|
|
1286
|
+
className: g ? "sc:flex sc:flex-col sc:gap-2 sc:self-start sc:w-full" : "sc:flex sc:flex-col sc:gap-1 sc:max-w-[82%] sc:self-end sc:items-end",
|
|
1287
|
+
children: [
|
|
1288
|
+
h ? /* @__PURE__ */ T("div", {
|
|
1289
|
+
className: `sc:w-full sc:border-l-[3px] sc:border-speaker sc:pl-4 sc:[animation:sc-msg-in_.35s_ease_both] ${e.pending ? "sc:opacity-60" : ""} ${e.failed ? "sc:opacity-60" : ""}`,
|
|
1290
|
+
children: [
|
|
1291
|
+
e.questionLabel || e.questionBadge ? /* @__PURE__ */ T("div", {
|
|
1292
|
+
className: "sc:flex sc:items-center sc:gap-2.5",
|
|
1293
|
+
children: [e.questionLabel ? /* @__PURE__ */ w("span", {
|
|
1294
|
+
className: "sc:text-[11.5px] sc:font-bold sc:uppercase sc:tracking-[0.1em] sc:text-speaker",
|
|
1295
|
+
children: e.questionLabel
|
|
1296
|
+
}) : null, e.questionBadge ? /* @__PURE__ */ T("span", {
|
|
1297
|
+
className: "sc:inline-flex sc:items-center sc:gap-1.5 sc:rounded-full sc:bg-button sc:px-2.5 sc:py-1 sc:text-[10.5px] sc:font-bold sc:tracking-[0.08em] sc:text-button-fg sc:uppercase",
|
|
1298
|
+
children: [/* @__PURE__ */ w("span", {
|
|
1299
|
+
"aria-hidden": "true",
|
|
1300
|
+
className: "sc:size-1.5 sc:rounded-full sc:bg-pink-strong"
|
|
1301
|
+
}), e.questionBadge]
|
|
1302
|
+
}) : null]
|
|
1303
|
+
}) : null,
|
|
1304
|
+
/* @__PURE__ */ w("div", {
|
|
1305
|
+
className: "sc:mt-2.5 sc:text-[21px]/[1.38] sc:font-bold sc:text-question-fg sc:[text-wrap:pretty]",
|
|
1306
|
+
children: e.paragraphs.map((t, n) => /* @__PURE__ */ T("div", { children: [y(t), n === e.paragraphs.length - 1 ? v : null] }, `${e.id}-${n}`))
|
|
1307
|
+
}),
|
|
1308
|
+
p
|
|
1309
|
+
]
|
|
1310
|
+
}) : m ? /* @__PURE__ */ T("div", {
|
|
1311
|
+
className: "sc:flex sc:flex-col sc:gap-1 sc:border-l-2 sc:border-pink sc:pl-4 sc:[animation:sc-msg-in_.3s_ease_both]",
|
|
1312
|
+
children: [/* @__PURE__ */ w("span", {
|
|
1313
|
+
className: "sc:text-[11px] sc:font-semibold sc:uppercase sc:tracking-[0.11em] sc:text-speaker",
|
|
1314
|
+
children: t.speakerLabel
|
|
1315
|
+
}), /* @__PURE__ */ w("div", {
|
|
1316
|
+
className: "sc:text-base/[1.62] sc:text-[#37333d] sc:[text-wrap:pretty]",
|
|
1317
|
+
children: e.paragraphs.map((t, n) => /* @__PURE__ */ T("div", {
|
|
1318
|
+
className: "sc:whitespace-pre-wrap",
|
|
1319
|
+
children: [y(t), n === e.paragraphs.length - 1 ? v : null]
|
|
1320
|
+
}, `${e.id}-${n}`))
|
|
1321
|
+
})]
|
|
1322
|
+
}) : e.answerHtml ? /* @__PURE__ */ w("div", {
|
|
1323
|
+
className: `${_} sc:[&_ul]:list-disc sc:[&_ol]:list-decimal`,
|
|
1324
|
+
dangerouslySetInnerHTML: { __html: bt(e.answerHtml) }
|
|
1325
|
+
}) : e.paragraphs.map((t, n) => /* @__PURE__ */ T("div", {
|
|
1326
|
+
className: `${_} sc:whitespace-pre-wrap`,
|
|
1327
|
+
children: [y(t), n === e.paragraphs.length - 1 ? v : null]
|
|
1328
|
+
}, `${e.id}-${n}`)),
|
|
1329
|
+
e.options && e.optionsKind === "dropdown" ? /* @__PURE__ */ w(St, {
|
|
1330
|
+
options: e.options,
|
|
1331
|
+
selectedOptionId: e.selectedOptionId,
|
|
1332
|
+
enabled: !!e.optionsEnabled,
|
|
1333
|
+
pending: e.pending,
|
|
1334
|
+
searchPlaceholder: r.searchPlaceholder,
|
|
1335
|
+
searchLabel: r.searchLabel,
|
|
1336
|
+
groupLabel: t.optionsGroup,
|
|
1337
|
+
onSelect: o
|
|
1338
|
+
}) : e.options ? /* @__PURE__ */ w(xt, {
|
|
1339
|
+
options: e.options,
|
|
1340
|
+
selectedOptionId: e.selectedOptionId,
|
|
1341
|
+
enabled: !!e.optionsEnabled,
|
|
1342
|
+
pending: e.pending,
|
|
1343
|
+
groupLabel: t.optionsGroup,
|
|
1344
|
+
onSelect: o
|
|
1345
|
+
}) : null,
|
|
1346
|
+
e.slider ? /* @__PURE__ */ w(wt, {
|
|
1347
|
+
min: e.slider.min,
|
|
1348
|
+
max: e.slider.max,
|
|
1349
|
+
defaultValue: e.slider.defaultValue,
|
|
1350
|
+
submittedValue: e.slider.submittedValue,
|
|
1351
|
+
enabled: e.slider.enabled,
|
|
1352
|
+
pending: e.pending,
|
|
1353
|
+
label: n.label,
|
|
1354
|
+
hint: n.hint,
|
|
1355
|
+
submitLabel: n.submitLabel,
|
|
1356
|
+
onSubmit: s
|
|
1357
|
+
}) : null,
|
|
1358
|
+
e.video ? e.video.uploadProgress !== void 0 && !e.video.failed ? /* @__PURE__ */ w(Dt, {
|
|
1359
|
+
value: e.video.uploadProgress,
|
|
1360
|
+
label: i.uploadProgress
|
|
1361
|
+
}) : e.video.failed ? /* @__PURE__ */ T("div", {
|
|
1362
|
+
className: "sc:flex sc:flex-col sc:gap-1 sc:items-end",
|
|
1363
|
+
children: [/* @__PURE__ */ w("p", {
|
|
1364
|
+
role: "alert",
|
|
1365
|
+
className: "sc:text-sm sc:text-red-600",
|
|
1366
|
+
children: i.uploadFailed
|
|
1367
|
+
}), u ? /* @__PURE__ */ w("button", {
|
|
1368
|
+
type: "button",
|
|
1369
|
+
onClick: u,
|
|
1370
|
+
className: "sc:text-xs sc:font-medium sc:text-red-600 sc:underline sc:cursor-pointer",
|
|
1371
|
+
children: i.retryUpload
|
|
1372
|
+
}) : null]
|
|
1373
|
+
}) : /* @__PURE__ */ w(Ot, {
|
|
1374
|
+
blob: e.video.blob,
|
|
1375
|
+
resolveUrl: !e.video.blob && d && e.video.extension ? () => d(e.video.questionId, e.video.extension) : void 0,
|
|
1376
|
+
playLabel: i.playVideo,
|
|
1377
|
+
label: i.videoAnswer
|
|
1378
|
+
}) : null,
|
|
1379
|
+
e.embeddedVideo ? /* @__PURE__ */ w(Et, {
|
|
1380
|
+
url: e.embeddedVideo.url,
|
|
1381
|
+
label: i.embeddedVideo
|
|
1382
|
+
}) : null,
|
|
1383
|
+
e.failed && a ? /* @__PURE__ */ w("button", {
|
|
1384
|
+
type: "button",
|
|
1385
|
+
onClick: a,
|
|
1386
|
+
className: "sc:text-xs sc:font-medium sc:text-red-600 sc:underline sc:cursor-pointer",
|
|
1387
|
+
children: t.retry
|
|
1388
|
+
}) : null,
|
|
1389
|
+
e.editableQuestionId && c ? /* @__PURE__ */ w("button", {
|
|
1390
|
+
type: "button",
|
|
1391
|
+
onClick: () => c(e.editableQuestionId),
|
|
1392
|
+
className: "sc:text-xs sc:font-medium sc:text-response sc:underline sc:cursor-pointer",
|
|
1393
|
+
children: t.edit
|
|
1394
|
+
}) : null,
|
|
1395
|
+
e.editing && l ? /* @__PURE__ */ w("button", {
|
|
1396
|
+
type: "button",
|
|
1397
|
+
onClick: l,
|
|
1398
|
+
className: "sc:text-xs sc:font-medium sc:text-black/60 sc:underline sc:cursor-pointer",
|
|
1399
|
+
children: t.cancelEdit
|
|
1400
|
+
}) : null
|
|
1401
|
+
]
|
|
1402
|
+
});
|
|
1403
|
+
}, At = 400, jt = "sc:size-[5px] sc:rounded-full sc:bg-pink-strong sc:[animation:sc-dot-blink_1.2s_infinite]", Mt = ({ ariaLabel: e, readingLabel: t, thinkingLabel: n, afterAnswer: r }) => {
|
|
1404
|
+
let [i, a] = y(!r);
|
|
1405
|
+
return m(() => {
|
|
1406
|
+
if (!r) return;
|
|
1407
|
+
let e = setTimeout(() => a(!0), At);
|
|
1408
|
+
return () => clearTimeout(e);
|
|
1409
|
+
}, [r]), /* @__PURE__ */ T("div", {
|
|
1410
|
+
role: "status",
|
|
1411
|
+
"aria-label": e,
|
|
1412
|
+
className: "sc:flex sc:items-center sc:gap-2 sc:self-start sc:border-l-2 sc:border-pink sc:pl-4 sc:[animation:sc-msg-in_.25s_ease_both]",
|
|
1413
|
+
children: [/* @__PURE__ */ w("span", {
|
|
1414
|
+
"aria-hidden": "true",
|
|
1415
|
+
className: "sc:text-[13px] sc:font-medium sc:text-muted",
|
|
1416
|
+
children: i ? n : t
|
|
1417
|
+
}), /* @__PURE__ */ T("span", {
|
|
1418
|
+
"aria-hidden": "true",
|
|
1419
|
+
className: "sc:flex sc:items-center sc:gap-1",
|
|
1420
|
+
children: [
|
|
1421
|
+
/* @__PURE__ */ w("span", { className: jt }),
|
|
1422
|
+
/* @__PURE__ */ w("span", { className: `${jt} sc:[animation-delay:.15s]` }),
|
|
1423
|
+
/* @__PURE__ */ w("span", { className: `${jt} sc:[animation-delay:.3s]` })
|
|
1424
|
+
]
|
|
1425
|
+
})]
|
|
1426
|
+
});
|
|
1427
|
+
}, Nt = ({ items: e, typing: t, typingLabel: n, typingReadingLabel: r, typingThinkingLabel: i, bubbleLabels: a, sliderLabels: o, dropdownLabels: s, mediaLabels: c, onRetry: l, onSelectOption: u, onSubmitSlider: d, onEdit: f, onCancelEdit: h, onRetryVideo: _, onResolveVideoUrl: y, cardFooter: b, cardFooterItemId: x }) => {
|
|
1428
|
+
var S;
|
|
1429
|
+
let C = v(null), E = v(null), D = v(null), O = v(null), k = -1;
|
|
1430
|
+
for (let t = e.length - 1; t >= 0; t--) if (e[t].sender === "candidate") {
|
|
1431
|
+
k = t;
|
|
1432
|
+
break;
|
|
1433
|
+
}
|
|
1434
|
+
let A = e[e.length - 1], j = A == null ? void 0 : A.id, M = (A == null ? void 0 : A.sender) === "candidate" && (A.paragraphs.length > 0 || !!A.answerHtml), N = A ? `${A.paragraphs.join("")}${(S = A.answerHtml) == null ? "" : S}` : "", P = p(() => {
|
|
1435
|
+
let e = C.current, t = O.current, n = D.current;
|
|
1436
|
+
if (!e || !t || !n) return;
|
|
1437
|
+
let r = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, i = e.scrollHeight - n.offsetHeight, a = e.clientHeight - (i - r);
|
|
1438
|
+
n.style.height = a > 0 ? `${a}px` : "0px";
|
|
1439
|
+
}, []);
|
|
1440
|
+
return g(() => {
|
|
1441
|
+
var e;
|
|
1442
|
+
if (!M) return;
|
|
1443
|
+
P();
|
|
1444
|
+
let t = C.current, n = O.current;
|
|
1445
|
+
if (!t || !n) return;
|
|
1446
|
+
let r = n.getBoundingClientRect().top - t.getBoundingClientRect().top + t.scrollTop;
|
|
1447
|
+
(e = t.scrollTo) == null || e.call(t, {
|
|
1448
|
+
top: r,
|
|
1449
|
+
behavior: "smooth"
|
|
1450
|
+
});
|
|
1451
|
+
}, [
|
|
1452
|
+
j,
|
|
1453
|
+
M,
|
|
1454
|
+
N,
|
|
1455
|
+
P
|
|
1456
|
+
]), m(() => {
|
|
1457
|
+
if (typeof ResizeObserver > "u") return;
|
|
1458
|
+
let e = E.current;
|
|
1459
|
+
if (!e) return;
|
|
1460
|
+
let t = new ResizeObserver(() => P());
|
|
1461
|
+
return t.observe(e), () => t.disconnect();
|
|
1462
|
+
}, [P]), /* @__PURE__ */ T("div", {
|
|
1463
|
+
ref: C,
|
|
1464
|
+
className: "sc:flex-1 sc:overflow-y-auto sc:bg-canvas sc:px-4 sc:py-5",
|
|
1465
|
+
"aria-live": "polite",
|
|
1466
|
+
children: [/* @__PURE__ */ T("ol", {
|
|
1467
|
+
ref: E,
|
|
1468
|
+
className: "sc:mx-auto sc:flex sc:max-w-[640px] sc:flex-col sc:gap-2.5 sc:list-none",
|
|
1469
|
+
children: [e.map((e, t) => {
|
|
1470
|
+
var n, r;
|
|
1471
|
+
return /* @__PURE__ */ w(kt, {
|
|
1472
|
+
rootRef: t === k ? O : void 0,
|
|
1473
|
+
item: e,
|
|
1474
|
+
labels: a,
|
|
1475
|
+
sliderLabels: o,
|
|
1476
|
+
dropdownLabels: s,
|
|
1477
|
+
mediaLabels: c,
|
|
1478
|
+
onRetry: e.failed ? l : void 0,
|
|
1479
|
+
onSelectOption: e.optionsEnabled ? u : void 0,
|
|
1480
|
+
onSubmitSlider: (n = e.slider) != null && n.enabled ? d : void 0,
|
|
1481
|
+
onEdit: f,
|
|
1482
|
+
onCancelEdit: h,
|
|
1483
|
+
onRetryVideo: (r = e.video) != null && r.failed ? _ : void 0,
|
|
1484
|
+
onResolveVideoUrl: y,
|
|
1485
|
+
footer: x && e.id === x ? b : void 0
|
|
1486
|
+
}, e.id);
|
|
1487
|
+
}), t ? /* @__PURE__ */ w("li", {
|
|
1488
|
+
className: "sc:flex sc:flex-col",
|
|
1489
|
+
children: /* @__PURE__ */ w(Mt, {
|
|
1490
|
+
ariaLabel: n,
|
|
1491
|
+
readingLabel: r,
|
|
1492
|
+
thinkingLabel: i,
|
|
1493
|
+
afterAnswer: M
|
|
1494
|
+
})
|
|
1495
|
+
}) : null]
|
|
1496
|
+
}), /* @__PURE__ */ w("div", {
|
|
1497
|
+
ref: D,
|
|
1498
|
+
"aria-hidden": "true"
|
|
1499
|
+
})]
|
|
1500
|
+
});
|
|
1501
|
+
};
|
|
1502
|
+
typeof window < "u" && window.document && window.document.createElement;
|
|
1503
|
+
function W(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
1504
|
+
return function(r) {
|
|
1505
|
+
if (e == null || e(r), n === !1 || !r.defaultPrevented) return t == null ? void 0 : t(r);
|
|
1506
|
+
};
|
|
1507
|
+
}
|
|
1508
|
+
//#endregion
|
|
1509
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-compose-refs@1.1.3_@types+react@19.2.17_react@19.2.7/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
1510
|
+
function Pt(e, t) {
|
|
1511
|
+
if (typeof e == "function") return e(t);
|
|
1512
|
+
e != null && (e.current = t);
|
|
1513
|
+
}
|
|
1514
|
+
function Ft(...e) {
|
|
1515
|
+
return (t) => {
|
|
1516
|
+
let n = !1, r = e.map((e) => {
|
|
1517
|
+
let r = Pt(e, t);
|
|
1518
|
+
return !n && typeof r == "function" && (n = !0), r;
|
|
1519
|
+
});
|
|
1520
|
+
if (n) return () => {
|
|
1521
|
+
for (let t = 0; t < r.length; t++) {
|
|
1522
|
+
let n = r[t];
|
|
1523
|
+
typeof n == "function" ? n() : Pt(e[t], null);
|
|
1524
|
+
}
|
|
1525
|
+
};
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
function G(...e) {
|
|
1529
|
+
return u.useCallback(Ft(...e), e);
|
|
1530
|
+
}
|
|
1531
|
+
//#endregion
|
|
1532
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-context@1.1.4_@types+react@19.2.17_react@19.2.7/node_modules/@radix-ui/react-context/dist/index.mjs
|
|
1533
|
+
function It(e, t) {
|
|
1534
|
+
let n = u.createContext(t);
|
|
1535
|
+
n.displayName = e + "Context";
|
|
1536
|
+
let r = (e) => {
|
|
1537
|
+
let { children: t, ...r } = e, i = u.useMemo(() => r, Object.values(r));
|
|
1538
|
+
return /* @__PURE__ */ w(n.Provider, {
|
|
1539
|
+
value: i,
|
|
1540
|
+
children: t
|
|
1541
|
+
});
|
|
1542
|
+
};
|
|
1543
|
+
r.displayName = e + "Provider";
|
|
1544
|
+
function i(r) {
|
|
1545
|
+
let i = u.useContext(n);
|
|
1546
|
+
if (i) return i;
|
|
1547
|
+
if (t !== void 0) return t;
|
|
1548
|
+
throw Error(`\`${r}\` must be used within \`${e}\``);
|
|
1549
|
+
}
|
|
1550
|
+
return [r, i];
|
|
1551
|
+
}
|
|
1552
|
+
function Lt(e, t = []) {
|
|
1553
|
+
let n = [];
|
|
1554
|
+
function r(t, r) {
|
|
1555
|
+
let i = u.createContext(r);
|
|
1556
|
+
i.displayName = t + "Context";
|
|
1557
|
+
let a = n.length;
|
|
1558
|
+
n = [...n, r];
|
|
1559
|
+
let o = (t) => {
|
|
1560
|
+
var n;
|
|
1561
|
+
let { scope: r, children: o, ...s } = t, c = (r == null || (n = r[e]) == null ? void 0 : n[a]) || i, l = u.useMemo(() => s, Object.values(s));
|
|
1562
|
+
return /* @__PURE__ */ w(c.Provider, {
|
|
1563
|
+
value: l,
|
|
1564
|
+
children: o
|
|
1565
|
+
});
|
|
1566
|
+
};
|
|
1567
|
+
o.displayName = t + "Provider";
|
|
1568
|
+
function s(n, o) {
|
|
1569
|
+
var s;
|
|
1570
|
+
let c = (o == null || (s = o[e]) == null ? void 0 : s[a]) || i, l = u.useContext(c);
|
|
1571
|
+
if (l) return l;
|
|
1572
|
+
if (r !== void 0) return r;
|
|
1573
|
+
throw Error(`\`${n}\` must be used within \`${t}\``);
|
|
1574
|
+
}
|
|
1575
|
+
return [o, s];
|
|
1576
|
+
}
|
|
1577
|
+
let i = () => {
|
|
1578
|
+
let t = n.map((e) => u.createContext(e));
|
|
1579
|
+
return function(n) {
|
|
1580
|
+
let r = (n == null ? void 0 : n[e]) || t;
|
|
1581
|
+
return u.useMemo(() => ({ [`__scope${e}`]: {
|
|
1582
|
+
...n,
|
|
1583
|
+
[e]: r
|
|
1584
|
+
} }), [n, r]);
|
|
1585
|
+
};
|
|
1586
|
+
};
|
|
1587
|
+
return i.scopeName = e, [r, Rt(i, ...t)];
|
|
1588
|
+
}
|
|
1589
|
+
function Rt(...e) {
|
|
1590
|
+
let t = e[0];
|
|
1591
|
+
if (e.length === 1) return t;
|
|
1592
|
+
let n = () => {
|
|
1593
|
+
let n = e.map((e) => ({
|
|
1594
|
+
useScope: e(),
|
|
1595
|
+
scopeName: e.scopeName
|
|
1596
|
+
}));
|
|
1597
|
+
return function(e) {
|
|
1598
|
+
let r = n.reduce((t, { useScope: n, scopeName: r }) => {
|
|
1599
|
+
let i = n(e)[`__scope${r}`];
|
|
1600
|
+
return {
|
|
1601
|
+
...t,
|
|
1602
|
+
...i
|
|
1603
|
+
};
|
|
1604
|
+
}, {});
|
|
1605
|
+
return u.useMemo(() => ({ [`__scope${t.scopeName}`]: r }), [r]);
|
|
1606
|
+
};
|
|
1607
|
+
};
|
|
1608
|
+
return n.scopeName = t.scopeName, n;
|
|
1609
|
+
}
|
|
1610
|
+
//#endregion
|
|
1611
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-use-layout-effect@1.1.2_@types+react@19.2.17_react@19.2.7/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
1612
|
+
var zt, Bt = (zt = globalThis) != null && zt.document ? u.useLayoutEffect : () => {}, Vt = u.useId || (() => void 0), Ht = 0;
|
|
1613
|
+
function Ut(e) {
|
|
1614
|
+
let [t, n] = u.useState(Vt());
|
|
1615
|
+
return Bt(() => {
|
|
1616
|
+
e || n((e) => e == null ? String(Ht++) : e);
|
|
1617
|
+
}, [e]), e || (t ? `radix-${t}` : "");
|
|
1618
|
+
}
|
|
1619
|
+
//#endregion
|
|
1620
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-use-controllable-state@1.2.3_@types+react@19.2.17_react@19.2.7/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
1621
|
+
var Wt = u.useInsertionEffect || Bt;
|
|
1622
|
+
function Gt({ prop: e, defaultProp: t, onChange: n = () => {}, caller: r }) {
|
|
1623
|
+
let [i, a, o] = Kt({
|
|
1624
|
+
defaultProp: t,
|
|
1625
|
+
onChange: n
|
|
1626
|
+
}), s = e !== void 0, c = s ? e : i;
|
|
1627
|
+
{
|
|
1628
|
+
let t = u.useRef(e !== void 0);
|
|
1629
|
+
u.useEffect(() => {
|
|
1630
|
+
let e = t.current;
|
|
1631
|
+
e !== s && console.warn(`${r} is changing from ${e ? "controlled" : "uncontrolled"} to ${s ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`), t.current = s;
|
|
1632
|
+
}, [s, r]);
|
|
1633
|
+
}
|
|
1634
|
+
return [c, u.useCallback((t) => {
|
|
1635
|
+
if (s) {
|
|
1636
|
+
let r = qt(t) ? t(e) : t;
|
|
1637
|
+
if (r !== e) {
|
|
1638
|
+
var n;
|
|
1639
|
+
(n = o.current) == null || n.call(o, r);
|
|
1640
|
+
}
|
|
1641
|
+
} else a(t);
|
|
1642
|
+
}, [
|
|
1643
|
+
s,
|
|
1644
|
+
e,
|
|
1645
|
+
a,
|
|
1646
|
+
o
|
|
1647
|
+
])];
|
|
1648
|
+
}
|
|
1649
|
+
function Kt({ defaultProp: e, onChange: t }) {
|
|
1650
|
+
let [n, r] = u.useState(e), i = u.useRef(n), a = u.useRef(t);
|
|
1651
|
+
return Wt(() => {
|
|
1652
|
+
a.current = t;
|
|
1653
|
+
}, [t]), u.useEffect(() => {
|
|
1654
|
+
if (i.current !== n) {
|
|
1655
|
+
var e;
|
|
1656
|
+
(e = a.current) == null || e.call(a, n), i.current = n;
|
|
1657
|
+
}
|
|
1658
|
+
}, [n, i]), [
|
|
1659
|
+
n,
|
|
1660
|
+
r,
|
|
1661
|
+
a
|
|
1662
|
+
];
|
|
1663
|
+
}
|
|
1664
|
+
function qt(e) {
|
|
1665
|
+
return typeof e == "function";
|
|
1666
|
+
}
|
|
1667
|
+
//#endregion
|
|
1668
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-slot@1.2.5_@types+react@19.2.17_react@19.2.7/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
1669
|
+
// @__NO_SIDE_EFFECTS__
|
|
1670
|
+
function Jt(e) {
|
|
1671
|
+
let t = u.forwardRef((t, n) => {
|
|
1672
|
+
var r;
|
|
1673
|
+
let { children: i, ...a } = t, o = null, s = !1, c = [];
|
|
1674
|
+
tn(i) && typeof on == "function" && (i = on(i._payload)), u.Children.forEach(i, (e) => {
|
|
1675
|
+
if ($t(e)) {
|
|
1676
|
+
var t;
|
|
1677
|
+
s = !0;
|
|
1678
|
+
let n = e, r = "child" in n.props ? n.props.child : n.props.children;
|
|
1679
|
+
tn(r) && typeof on == "function" && (r = on(r._payload)), o = Xt(n, r), c.push(o == null || (t = o.props) == null ? void 0 : t.children);
|
|
1680
|
+
} else c.push(e);
|
|
1681
|
+
}), o ? o = u.cloneElement(o, void 0, c) : !s && u.Children.count(i) === 1 && u.isValidElement(i) && (o = i);
|
|
1682
|
+
let l = o ? Qt(o) : void 0, d = G(n, l);
|
|
1683
|
+
if (!o) {
|
|
1684
|
+
if (i || i === 0) throw Error(s ? an(e) : rn(e));
|
|
1685
|
+
return i;
|
|
1686
|
+
}
|
|
1687
|
+
let f = Zt(a, (r = o.props) == null ? {} : r);
|
|
1688
|
+
return o.type !== u.Fragment && (f.ref = n ? d : l), u.cloneElement(o, f);
|
|
1689
|
+
});
|
|
1690
|
+
return t.displayName = `${e}.Slot`, t;
|
|
1691
|
+
}
|
|
1692
|
+
var Yt = Symbol.for("radix.slottable"), Xt = (e, t) => {
|
|
1693
|
+
if ("child" in e.props) {
|
|
1694
|
+
let t = e.props.child;
|
|
1695
|
+
return u.isValidElement(t) ? u.cloneElement(t, void 0, e.props.children(t.props.children)) : null;
|
|
1696
|
+
}
|
|
1697
|
+
return u.isValidElement(t) ? t : null;
|
|
1698
|
+
};
|
|
1699
|
+
function Zt(e, t) {
|
|
1700
|
+
let n = { ...t };
|
|
1701
|
+
for (let r in t) {
|
|
1702
|
+
let i = e[r], a = t[r];
|
|
1703
|
+
/^on[A-Z]/.test(r) ? i && a ? n[r] = (...e) => {
|
|
1704
|
+
let t = a(...e);
|
|
1705
|
+
return i(...e), t;
|
|
1706
|
+
} : i && (n[r] = i) : r === "style" ? n[r] = {
|
|
1707
|
+
...i,
|
|
1708
|
+
...a
|
|
1709
|
+
} : r === "className" && (n[r] = [i, a].filter(Boolean).join(" "));
|
|
1710
|
+
}
|
|
1711
|
+
return {
|
|
1712
|
+
...e,
|
|
1713
|
+
...n
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1716
|
+
function Qt(e) {
|
|
1717
|
+
var t, n;
|
|
1718
|
+
let r = (t = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : t.get, i = r && "isReactWarning" in r && r.isReactWarning;
|
|
1719
|
+
return i ? e.ref : (r = (n = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : n.get, i = r && "isReactWarning" in r && r.isReactWarning, i ? e.props.ref : e.props.ref || e.ref);
|
|
1720
|
+
}
|
|
1721
|
+
function $t(e) {
|
|
1722
|
+
return u.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Yt;
|
|
1723
|
+
}
|
|
1724
|
+
var en = Symbol.for("react.lazy");
|
|
1725
|
+
function tn(e) {
|
|
1726
|
+
return typeof e == "object" && !!e && "$$typeof" in e && e.$$typeof === en && "_payload" in e && nn(e._payload);
|
|
1727
|
+
}
|
|
1728
|
+
function nn(e) {
|
|
1729
|
+
return typeof e == "object" && !!e && "then" in e;
|
|
1730
|
+
}
|
|
1731
|
+
var rn = (e) => `${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`, an = (e) => `${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`, on = u.use, K = [
|
|
1732
|
+
"a",
|
|
1733
|
+
"button",
|
|
1734
|
+
"div",
|
|
1735
|
+
"form",
|
|
1736
|
+
"h2",
|
|
1737
|
+
"h3",
|
|
1738
|
+
"img",
|
|
1739
|
+
"input",
|
|
1740
|
+
"label",
|
|
1741
|
+
"li",
|
|
1742
|
+
"nav",
|
|
1743
|
+
"ol",
|
|
1744
|
+
"p",
|
|
1745
|
+
"select",
|
|
1746
|
+
"span",
|
|
1747
|
+
"svg",
|
|
1748
|
+
"ul"
|
|
1749
|
+
].reduce((e, t) => {
|
|
1750
|
+
let n = /* @__PURE__ */ Jt(`Primitive.${t}`), r = u.forwardRef((e, r) => {
|
|
1751
|
+
let { asChild: i, ...a } = e, o = i ? n : t;
|
|
1752
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ w(o, {
|
|
1753
|
+
...a,
|
|
1754
|
+
ref: r
|
|
1755
|
+
});
|
|
1756
|
+
});
|
|
1757
|
+
return r.displayName = `Primitive.${t}`, {
|
|
1758
|
+
...e,
|
|
1759
|
+
[t]: r
|
|
1760
|
+
};
|
|
1761
|
+
}, {});
|
|
1762
|
+
function sn(e, t) {
|
|
1763
|
+
e && E.flushSync(() => e.dispatchEvent(t));
|
|
1764
|
+
}
|
|
1765
|
+
//#endregion
|
|
1766
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-use-callback-ref@1.1.2_@types+react@19.2.17_react@19.2.7/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
|
|
1767
|
+
function cn(e) {
|
|
1768
|
+
let t = u.useRef(e);
|
|
1769
|
+
return u.useEffect(() => {
|
|
1770
|
+
t.current = e;
|
|
1771
|
+
}), u.useMemo(() => ((...e) => {
|
|
1772
|
+
var n;
|
|
1773
|
+
return (n = t.current) == null ? void 0 : n.call(t, ...e);
|
|
1774
|
+
}), []);
|
|
1775
|
+
}
|
|
1776
|
+
//#endregion
|
|
1777
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-use-escape-keydown@1.1.2_@types+react@19.2.17_react@19.2.7/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
|
|
1778
|
+
function ln(e, t = (() => {
|
|
1779
|
+
var e;
|
|
1780
|
+
return (e = globalThis) == null ? void 0 : e.document;
|
|
1781
|
+
})()) {
|
|
1782
|
+
let n = cn(e);
|
|
1783
|
+
u.useEffect(() => {
|
|
1784
|
+
let e = (e) => {
|
|
1785
|
+
e.key === "Escape" && n(e);
|
|
1786
|
+
};
|
|
1787
|
+
return t.addEventListener("keydown", e, { capture: !0 }), () => t.removeEventListener("keydown", e, { capture: !0 });
|
|
1788
|
+
}, [n, t]);
|
|
1789
|
+
}
|
|
1790
|
+
//#endregion
|
|
1791
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-dismissable-layer@1.1.12_@types+react-dom@19.2.3_@types+react@19.2.17___73c7bc8f5cad65bae593ba1fe3bba9e4/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
1792
|
+
var un = "DismissableLayer", dn = "dismissableLayer.update", fn = "dismissableLayer.pointerDownOutside", pn = "dismissableLayer.focusOutside", mn, hn = u.createContext({
|
|
1793
|
+
layers: /* @__PURE__ */ new Set(),
|
|
1794
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
1795
|
+
branches: /* @__PURE__ */ new Set()
|
|
1796
|
+
}), gn = u.forwardRef((e, t) => {
|
|
1797
|
+
var n, r;
|
|
1798
|
+
let { disableOutsidePointerEvents: i = !1, onEscapeKeyDown: a, onPointerDownOutside: o, onFocusOutside: s, onInteractOutside: c, onDismiss: l, ...d } = e, f = u.useContext(hn), [p, m] = u.useState(null), h = (n = p == null ? void 0 : p.ownerDocument) == null ? (r = globalThis) == null ? void 0 : r.document : n, [, g] = u.useState({}), _ = G(t, (e) => m(e)), v = Array.from(f.layers), [y] = [...f.layersWithOutsidePointerEventsDisabled].slice(-1), b = v.indexOf(y), x = p ? v.indexOf(p) : -1, S = f.layersWithOutsidePointerEventsDisabled.size > 0, C = x >= b, T = yn((e) => {
|
|
1799
|
+
let t = e.target, n = [...f.branches].some((e) => e.contains(t));
|
|
1800
|
+
!C || n || (o == null || o(e), c == null || c(e), e.defaultPrevented || l == null || l());
|
|
1801
|
+
}, h), E = bn((e) => {
|
|
1802
|
+
let t = e.target;
|
|
1803
|
+
[...f.branches].some((e) => e.contains(t)) || (s == null || s(e), c == null || c(e), e.defaultPrevented || l == null || l());
|
|
1804
|
+
}, h);
|
|
1805
|
+
return ln((e) => {
|
|
1806
|
+
x === f.layers.size - 1 && (a == null || a(e), !e.defaultPrevented && l && (e.preventDefault(), l()));
|
|
1807
|
+
}, h), u.useEffect(() => {
|
|
1808
|
+
if (p) return i && (f.layersWithOutsidePointerEventsDisabled.size === 0 && (mn = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), f.layersWithOutsidePointerEventsDisabled.add(p)), f.layers.add(p), xn(), () => {
|
|
1809
|
+
i && (f.layersWithOutsidePointerEventsDisabled.delete(p), f.layersWithOutsidePointerEventsDisabled.size === 0 && (h.body.style.pointerEvents = mn));
|
|
1810
|
+
};
|
|
1811
|
+
}, [
|
|
1812
|
+
p,
|
|
1813
|
+
h,
|
|
1814
|
+
i,
|
|
1815
|
+
f
|
|
1816
|
+
]), u.useEffect(() => () => {
|
|
1817
|
+
p && (f.layers.delete(p), f.layersWithOutsidePointerEventsDisabled.delete(p), xn());
|
|
1818
|
+
}, [p, f]), u.useEffect(() => {
|
|
1819
|
+
let e = () => g({});
|
|
1820
|
+
return document.addEventListener(dn, e), () => document.removeEventListener(dn, e);
|
|
1821
|
+
}, []), /* @__PURE__ */ w(K.div, {
|
|
1822
|
+
...d,
|
|
1823
|
+
ref: _,
|
|
1824
|
+
style: {
|
|
1825
|
+
pointerEvents: S ? C ? "auto" : "none" : void 0,
|
|
1826
|
+
...e.style
|
|
1827
|
+
},
|
|
1828
|
+
onFocusCapture: W(e.onFocusCapture, E.onFocusCapture),
|
|
1829
|
+
onBlurCapture: W(e.onBlurCapture, E.onBlurCapture),
|
|
1830
|
+
onPointerDownCapture: W(e.onPointerDownCapture, T.onPointerDownCapture)
|
|
1831
|
+
});
|
|
1832
|
+
});
|
|
1833
|
+
gn.displayName = un;
|
|
1834
|
+
var _n = "DismissableLayerBranch", vn = u.forwardRef((e, t) => {
|
|
1835
|
+
let n = u.useContext(hn), r = u.useRef(null), i = G(t, r);
|
|
1836
|
+
return u.useEffect(() => {
|
|
1837
|
+
let e = r.current;
|
|
1838
|
+
if (e) return n.branches.add(e), () => {
|
|
1839
|
+
n.branches.delete(e);
|
|
1840
|
+
};
|
|
1841
|
+
}, [n.branches]), /* @__PURE__ */ w(K.div, {
|
|
1842
|
+
...e,
|
|
1843
|
+
ref: i
|
|
1844
|
+
});
|
|
1845
|
+
});
|
|
1846
|
+
vn.displayName = _n;
|
|
1847
|
+
function yn(e, t = (() => {
|
|
1848
|
+
var e;
|
|
1849
|
+
return (e = globalThis) == null ? void 0 : e.document;
|
|
1850
|
+
})()) {
|
|
1851
|
+
let n = cn(e), r = u.useRef(!1), i = u.useRef(() => {});
|
|
1852
|
+
return u.useEffect(() => {
|
|
1853
|
+
let e = (e) => {
|
|
1854
|
+
if (e.target && !r.current) {
|
|
1855
|
+
let r = function() {
|
|
1856
|
+
Sn(fn, n, a, { discrete: !0 });
|
|
1857
|
+
}, a = { originalEvent: e };
|
|
1858
|
+
e.pointerType === "touch" ? (t.removeEventListener("click", i.current), i.current = r, t.addEventListener("click", i.current, { once: !0 })) : r();
|
|
1859
|
+
} else t.removeEventListener("click", i.current);
|
|
1860
|
+
r.current = !1;
|
|
1861
|
+
}, a = window.setTimeout(() => {
|
|
1862
|
+
t.addEventListener("pointerdown", e);
|
|
1863
|
+
}, 0);
|
|
1864
|
+
return () => {
|
|
1865
|
+
window.clearTimeout(a), t.removeEventListener("pointerdown", e), t.removeEventListener("click", i.current);
|
|
1866
|
+
};
|
|
1867
|
+
}, [t, n]), { onPointerDownCapture: () => r.current = !0 };
|
|
1868
|
+
}
|
|
1869
|
+
function bn(e, t = (() => {
|
|
1870
|
+
var e;
|
|
1871
|
+
return (e = globalThis) == null ? void 0 : e.document;
|
|
1872
|
+
})()) {
|
|
1873
|
+
let n = cn(e), r = u.useRef(!1);
|
|
1874
|
+
return u.useEffect(() => {
|
|
1875
|
+
let e = (e) => {
|
|
1876
|
+
e.target && !r.current && Sn(pn, n, { originalEvent: e }, { discrete: !1 });
|
|
1877
|
+
};
|
|
1878
|
+
return t.addEventListener("focusin", e), () => t.removeEventListener("focusin", e);
|
|
1879
|
+
}, [t, n]), {
|
|
1880
|
+
onFocusCapture: () => r.current = !0,
|
|
1881
|
+
onBlurCapture: () => r.current = !1
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
1884
|
+
function xn() {
|
|
1885
|
+
let e = new CustomEvent(dn);
|
|
1886
|
+
document.dispatchEvent(e);
|
|
1887
|
+
}
|
|
1888
|
+
function Sn(e, t, n, { discrete: r }) {
|
|
1889
|
+
let i = n.originalEvent.target, a = new CustomEvent(e, {
|
|
1890
|
+
bubbles: !1,
|
|
1891
|
+
cancelable: !0,
|
|
1892
|
+
detail: n
|
|
1893
|
+
});
|
|
1894
|
+
t && i.addEventListener(e, t, { once: !0 }), r ? sn(i, a) : i.dispatchEvent(a);
|
|
1895
|
+
}
|
|
1896
|
+
//#endregion
|
|
1897
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-focus-scope@1.1.9_@types+react-dom@19.2.3_@types+react@19.2.17__@types+_1208a7d081be7db086412200d014e5ff/node_modules/@radix-ui/react-focus-scope/dist/index.mjs
|
|
1898
|
+
var Cn = "focusScope.autoFocusOnMount", wn = "focusScope.autoFocusOnUnmount", Tn = {
|
|
1899
|
+
bubbles: !1,
|
|
1900
|
+
cancelable: !0
|
|
1901
|
+
}, En = "FocusScope", Dn = u.forwardRef((e, t) => {
|
|
1902
|
+
let { loop: n = !1, trapped: r = !1, onMountAutoFocus: i, onUnmountAutoFocus: a, ...o } = e, [s, c] = u.useState(null), l = cn(i), d = cn(a), f = u.useRef(null), p = G(t, (e) => c(e)), m = u.useRef({
|
|
1903
|
+
paused: !1,
|
|
1904
|
+
pause() {
|
|
1905
|
+
this.paused = !0;
|
|
1906
|
+
},
|
|
1907
|
+
resume() {
|
|
1908
|
+
this.paused = !1;
|
|
1909
|
+
}
|
|
1910
|
+
}).current;
|
|
1911
|
+
u.useEffect(() => {
|
|
1912
|
+
if (r) {
|
|
1913
|
+
let e = function(e) {
|
|
1914
|
+
if (m.paused || !s) return;
|
|
1915
|
+
let t = e.target;
|
|
1916
|
+
s.contains(t) ? f.current = t : q(f.current, { select: !0 });
|
|
1917
|
+
}, t = function(e) {
|
|
1918
|
+
if (m.paused || !s) return;
|
|
1919
|
+
let t = e.relatedTarget;
|
|
1920
|
+
t !== null && (s.contains(t) || q(f.current, { select: !0 }));
|
|
1921
|
+
}, n = function(e) {
|
|
1922
|
+
if (document.activeElement === document.body) for (let t of e) t.removedNodes.length > 0 && q(s);
|
|
1923
|
+
};
|
|
1924
|
+
document.addEventListener("focusin", e), document.addEventListener("focusout", t);
|
|
1925
|
+
let r = new MutationObserver(n);
|
|
1926
|
+
return s && r.observe(s, {
|
|
1927
|
+
childList: !0,
|
|
1928
|
+
subtree: !0
|
|
1929
|
+
}), () => {
|
|
1930
|
+
document.removeEventListener("focusin", e), document.removeEventListener("focusout", t), r.disconnect();
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
}, [
|
|
1934
|
+
r,
|
|
1935
|
+
s,
|
|
1936
|
+
m.paused
|
|
1937
|
+
]), u.useEffect(() => {
|
|
1938
|
+
if (s) {
|
|
1939
|
+
Pn.add(m);
|
|
1940
|
+
let e = document.activeElement;
|
|
1941
|
+
if (!s.contains(e)) {
|
|
1942
|
+
let t = new CustomEvent(Cn, Tn);
|
|
1943
|
+
s.addEventListener(Cn, l), s.dispatchEvent(t), t.defaultPrevented || (On(Ln(An(s)), { select: !0 }), document.activeElement === e && q(s));
|
|
1944
|
+
}
|
|
1945
|
+
return () => {
|
|
1946
|
+
s.removeEventListener(Cn, l), setTimeout(() => {
|
|
1947
|
+
let t = new CustomEvent(wn, Tn);
|
|
1948
|
+
s.addEventListener(wn, d), s.dispatchEvent(t), t.defaultPrevented || q(e == null ? document.body : e, { select: !0 }), s.removeEventListener(wn, d), Pn.remove(m);
|
|
1949
|
+
}, 0);
|
|
1950
|
+
};
|
|
1951
|
+
}
|
|
1952
|
+
}, [
|
|
1953
|
+
s,
|
|
1954
|
+
l,
|
|
1955
|
+
d,
|
|
1956
|
+
m
|
|
1957
|
+
]);
|
|
1958
|
+
let h = u.useCallback((e) => {
|
|
1959
|
+
if (!n && !r || m.paused) return;
|
|
1960
|
+
let t = e.key === "Tab" && !e.altKey && !e.ctrlKey && !e.metaKey, i = document.activeElement;
|
|
1961
|
+
if (t && i) {
|
|
1962
|
+
let t = e.currentTarget, [r, a] = kn(t);
|
|
1963
|
+
r && a ? !e.shiftKey && i === a ? (e.preventDefault(), n && q(r, { select: !0 })) : e.shiftKey && i === r && (e.preventDefault(), n && q(a, { select: !0 })) : i === t && e.preventDefault();
|
|
1964
|
+
}
|
|
1965
|
+
}, [
|
|
1966
|
+
n,
|
|
1967
|
+
r,
|
|
1968
|
+
m.paused
|
|
1969
|
+
]);
|
|
1970
|
+
return /* @__PURE__ */ w(K.div, {
|
|
1971
|
+
tabIndex: -1,
|
|
1972
|
+
...o,
|
|
1973
|
+
ref: p,
|
|
1974
|
+
onKeyDown: h
|
|
1975
|
+
});
|
|
1976
|
+
});
|
|
1977
|
+
Dn.displayName = En;
|
|
1978
|
+
function On(e, { select: t = !1 } = {}) {
|
|
1979
|
+
let n = document.activeElement;
|
|
1980
|
+
for (let r of e) if (q(r, { select: t }), document.activeElement !== n) return;
|
|
1981
|
+
}
|
|
1982
|
+
function kn(e) {
|
|
1983
|
+
let t = An(e);
|
|
1984
|
+
return [jn(t, e), jn(t.reverse(), e)];
|
|
1985
|
+
}
|
|
1986
|
+
function An(e) {
|
|
1987
|
+
let t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, { acceptNode: (e) => {
|
|
1988
|
+
let t = e.tagName === "INPUT" && e.type === "hidden";
|
|
1989
|
+
return e.disabled || e.hidden || t ? NodeFilter.FILTER_SKIP : e.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
1990
|
+
} });
|
|
1991
|
+
for (; n.nextNode();) t.push(n.currentNode);
|
|
1992
|
+
return t;
|
|
1993
|
+
}
|
|
1994
|
+
function jn(e, t) {
|
|
1995
|
+
for (let n of e) if (!Mn(n, { upTo: t })) return n;
|
|
1996
|
+
}
|
|
1997
|
+
function Mn(e, { upTo: t }) {
|
|
1998
|
+
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
1999
|
+
for (; e;) {
|
|
2000
|
+
if (t !== void 0 && e === t) return !1;
|
|
2001
|
+
if (getComputedStyle(e).display === "none") return !0;
|
|
2002
|
+
e = e.parentElement;
|
|
2003
|
+
}
|
|
2004
|
+
return !1;
|
|
2005
|
+
}
|
|
2006
|
+
function Nn(e) {
|
|
2007
|
+
return e instanceof HTMLInputElement && "select" in e;
|
|
2008
|
+
}
|
|
2009
|
+
function q(e, { select: t = !1 } = {}) {
|
|
2010
|
+
if (e && e.focus) {
|
|
2011
|
+
let n = document.activeElement;
|
|
2012
|
+
e.focus({ preventScroll: !0 }), e !== n && Nn(e) && t && e.select();
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
var Pn = Fn();
|
|
2016
|
+
function Fn() {
|
|
2017
|
+
let e = [];
|
|
2018
|
+
return {
|
|
2019
|
+
add(t) {
|
|
2020
|
+
let n = e[0];
|
|
2021
|
+
t !== n && (n == null || n.pause()), e = In(e, t), e.unshift(t);
|
|
2022
|
+
},
|
|
2023
|
+
remove(t) {
|
|
2024
|
+
var n;
|
|
2025
|
+
e = In(e, t), (n = e[0]) == null || n.resume();
|
|
2026
|
+
}
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
function In(e, t) {
|
|
2030
|
+
let n = [...e], r = n.indexOf(t);
|
|
2031
|
+
return r !== -1 && n.splice(r, 1), n;
|
|
2032
|
+
}
|
|
2033
|
+
function Ln(e) {
|
|
2034
|
+
return e.filter((e) => e.tagName !== "A");
|
|
2035
|
+
}
|
|
2036
|
+
//#endregion
|
|
2037
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-portal@1.1.11_@types+react-dom@19.2.3_@types+react@19.2.17__@types+reac_a201d07b874b71bd93a8c3bc6f0982e5/node_modules/@radix-ui/react-portal/dist/index.mjs
|
|
2038
|
+
var Rn = "Portal", zn = u.forwardRef((e, t) => {
|
|
2039
|
+
var n;
|
|
2040
|
+
let { container: r, ...i } = e, [a, o] = u.useState(!1);
|
|
2041
|
+
Bt(() => o(!0), []);
|
|
2042
|
+
let s = r || a && ((n = globalThis) == null || (n = n.document) == null ? void 0 : n.body);
|
|
2043
|
+
return s ? E.createPortal(/* @__PURE__ */ w(K.div, {
|
|
2044
|
+
...i,
|
|
2045
|
+
ref: t
|
|
2046
|
+
}), s) : null;
|
|
2047
|
+
});
|
|
2048
|
+
zn.displayName = Rn;
|
|
2049
|
+
//#endregion
|
|
2050
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-presence@1.1.6_@types+react-dom@19.2.3_@types+react@19.2.17__@types+rea_dcd2172d161be68b0f7e3bfe31aff518/node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
2051
|
+
function Bn(e, t) {
|
|
2052
|
+
return u.useReducer((e, n) => {
|
|
2053
|
+
let r = t[e][n];
|
|
2054
|
+
return r == null ? e : r;
|
|
2055
|
+
}, e);
|
|
2056
|
+
}
|
|
2057
|
+
var Vn = (e) => {
|
|
2058
|
+
let { present: t, children: n } = e, r = Hn(t), i = typeof n == "function" ? n({ present: r.isPresent }) : u.Children.only(n), a = Wn(r.ref, Kn(i));
|
|
2059
|
+
return typeof n == "function" || r.isPresent ? u.cloneElement(i, { ref: a }) : null;
|
|
2060
|
+
};
|
|
2061
|
+
Vn.displayName = "Presence";
|
|
2062
|
+
function Hn(e) {
|
|
2063
|
+
let [t, n] = u.useState(), r = u.useRef(null), i = u.useRef(e), a = u.useRef("none"), [o, s] = Bn(e ? "mounted" : "unmounted", {
|
|
2064
|
+
mounted: {
|
|
2065
|
+
UNMOUNT: "unmounted",
|
|
2066
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
2067
|
+
},
|
|
2068
|
+
unmountSuspended: {
|
|
2069
|
+
MOUNT: "mounted",
|
|
2070
|
+
ANIMATION_END: "unmounted"
|
|
2071
|
+
},
|
|
2072
|
+
unmounted: { MOUNT: "mounted" }
|
|
2073
|
+
});
|
|
2074
|
+
return u.useEffect(() => {
|
|
2075
|
+
let e = Gn(r.current);
|
|
2076
|
+
a.current = o === "mounted" ? e : "none";
|
|
2077
|
+
}, [o]), Bt(() => {
|
|
2078
|
+
let t = r.current, n = i.current;
|
|
2079
|
+
if (n !== e) {
|
|
2080
|
+
let r = a.current, o = Gn(t);
|
|
2081
|
+
e ? s("MOUNT") : o === "none" || (t == null ? void 0 : t.display) === "none" ? s("UNMOUNT") : s(n && r !== o ? "ANIMATION_OUT" : "UNMOUNT"), i.current = e;
|
|
2082
|
+
}
|
|
2083
|
+
}, [e, s]), Bt(() => {
|
|
2084
|
+
if (t) {
|
|
2085
|
+
var e;
|
|
2086
|
+
let n, o = (e = t.ownerDocument.defaultView) == null ? window : e, c = (e) => {
|
|
2087
|
+
let a = Gn(r.current).includes(CSS.escape(e.animationName));
|
|
2088
|
+
if (e.target === t && a && (s("ANIMATION_END"), !i.current)) {
|
|
2089
|
+
let e = t.style.animationFillMode;
|
|
2090
|
+
t.style.animationFillMode = "forwards", n = o.setTimeout(() => {
|
|
2091
|
+
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = e);
|
|
2092
|
+
});
|
|
2093
|
+
}
|
|
2094
|
+
}, l = (e) => {
|
|
2095
|
+
e.target === t && (a.current = Gn(r.current));
|
|
2096
|
+
};
|
|
2097
|
+
return t.addEventListener("animationstart", l), t.addEventListener("animationcancel", c), t.addEventListener("animationend", c), () => {
|
|
2098
|
+
o.clearTimeout(n), t.removeEventListener("animationstart", l), t.removeEventListener("animationcancel", c), t.removeEventListener("animationend", c);
|
|
2099
|
+
};
|
|
2100
|
+
} else s("ANIMATION_END");
|
|
2101
|
+
}, [t, s]), {
|
|
2102
|
+
isPresent: ["mounted", "unmountSuspended"].includes(o),
|
|
2103
|
+
ref: u.useCallback((e) => {
|
|
2104
|
+
r.current = e ? getComputedStyle(e) : null, n(e);
|
|
2105
|
+
}, [])
|
|
2106
|
+
};
|
|
2107
|
+
}
|
|
2108
|
+
function Un(e, t) {
|
|
2109
|
+
if (typeof e == "function") return e(t);
|
|
2110
|
+
e != null && (e.current = t);
|
|
2111
|
+
}
|
|
2112
|
+
function Wn(...e) {
|
|
2113
|
+
let t = u.useRef(e);
|
|
2114
|
+
return t.current = e, u.useCallback((e) => {
|
|
2115
|
+
let n = t.current, r = !1, i = n.map((t) => {
|
|
2116
|
+
let n = Un(t, e);
|
|
2117
|
+
return !r && typeof n == "function" && (r = !0), n;
|
|
2118
|
+
});
|
|
2119
|
+
if (r) return () => {
|
|
2120
|
+
for (let e = 0; e < i.length; e++) {
|
|
2121
|
+
let t = i[e];
|
|
2122
|
+
typeof t == "function" ? t() : Un(n[e], null);
|
|
2123
|
+
}
|
|
2124
|
+
};
|
|
2125
|
+
}, []);
|
|
2126
|
+
}
|
|
2127
|
+
function Gn(e) {
|
|
2128
|
+
return (e == null ? void 0 : e.animationName) || "none";
|
|
2129
|
+
}
|
|
2130
|
+
function Kn(e) {
|
|
2131
|
+
var t, n;
|
|
2132
|
+
let r = (t = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : t.get, i = r && "isReactWarning" in r && r.isReactWarning;
|
|
2133
|
+
return i ? e.ref : (r = (n = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : n.get, i = r && "isReactWarning" in r && r.isReactWarning, i ? e.props.ref : e.props.ref || e.ref);
|
|
2134
|
+
}
|
|
2135
|
+
//#endregion
|
|
2136
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-focus-guards@1.1.4_@types+react@19.2.17_react@19.2.7/node_modules/@radix-ui/react-focus-guards/dist/index.mjs
|
|
2137
|
+
var qn = 0, J = null;
|
|
2138
|
+
function Jn() {
|
|
2139
|
+
u.useEffect(() => {
|
|
2140
|
+
J || (J = {
|
|
2141
|
+
start: Yn(),
|
|
2142
|
+
end: Yn()
|
|
2143
|
+
});
|
|
2144
|
+
let { start: e, end: t } = J;
|
|
2145
|
+
return document.body.firstElementChild !== e && document.body.insertAdjacentElement("afterbegin", e), document.body.lastElementChild !== t && document.body.insertAdjacentElement("beforeend", t), qn++, () => {
|
|
2146
|
+
qn === 1 && (J == null || J.start.remove(), J == null || J.end.remove(), J = null), qn = Math.max(0, qn - 1);
|
|
2147
|
+
};
|
|
2148
|
+
}, []);
|
|
2149
|
+
}
|
|
2150
|
+
function Yn() {
|
|
2151
|
+
let e = document.createElement("span");
|
|
2152
|
+
return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
|
|
2153
|
+
}
|
|
2154
|
+
//#endregion
|
|
2155
|
+
//#region ../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
|
|
2156
|
+
var Y = function() {
|
|
2157
|
+
return Y = Object.assign || function(e) {
|
|
2158
|
+
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
|
2159
|
+
return e;
|
|
2160
|
+
}, Y.apply(this, arguments);
|
|
2161
|
+
};
|
|
2162
|
+
function Xn(e, t) {
|
|
2163
|
+
var n = {};
|
|
2164
|
+
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
2165
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, r = Object.getOwnPropertySymbols(e); i < r.length; i++) t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]);
|
|
2166
|
+
return n;
|
|
2167
|
+
}
|
|
2168
|
+
function Zn(e, t, n) {
|
|
2169
|
+
if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a || (a = Array.prototype.slice.call(t, 0, r)), a[r] = t[r]);
|
|
2170
|
+
return e.concat(a || Array.prototype.slice.call(t));
|
|
2171
|
+
}
|
|
2172
|
+
//#endregion
|
|
2173
|
+
//#region ../../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@19.2.17_react@19.2.7/node_modules/react-remove-scroll-bar/dist/es2015/constants.js
|
|
2174
|
+
var Qn = "right-scroll-bar-position", $n = "width-before-scroll-bar", er = "with-scroll-bars-hidden", tr = "--removed-body-scroll-bar-size";
|
|
2175
|
+
//#endregion
|
|
2176
|
+
//#region ../../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@19.2.17_react@19.2.7/node_modules/use-callback-ref/dist/es2015/assignRef.js
|
|
2177
|
+
function nr(e, t) {
|
|
2178
|
+
return typeof e == "function" ? e(t) : e && (e.current = t), e;
|
|
2179
|
+
}
|
|
2180
|
+
//#endregion
|
|
2181
|
+
//#region ../../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@19.2.17_react@19.2.7/node_modules/use-callback-ref/dist/es2015/useRef.js
|
|
2182
|
+
function rr(e, t) {
|
|
2183
|
+
var n = y(function() {
|
|
2184
|
+
return {
|
|
2185
|
+
value: e,
|
|
2186
|
+
callback: t,
|
|
2187
|
+
facade: {
|
|
2188
|
+
get current() {
|
|
2189
|
+
return n.value;
|
|
2190
|
+
},
|
|
2191
|
+
set current(e) {
|
|
2192
|
+
var t = n.value;
|
|
2193
|
+
t !== e && (n.value = e, n.callback(e, t));
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
};
|
|
2197
|
+
})[0];
|
|
2198
|
+
return n.callback = t, n.facade;
|
|
2199
|
+
}
|
|
2200
|
+
//#endregion
|
|
2201
|
+
//#region ../../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@19.2.17_react@19.2.7/node_modules/use-callback-ref/dist/es2015/useMergeRef.js
|
|
2202
|
+
var ir = typeof window < "u" ? u.useLayoutEffect : u.useEffect, ar = /* @__PURE__ */ new WeakMap();
|
|
2203
|
+
function or(e, t) {
|
|
2204
|
+
var n = rr(t || null, function(t) {
|
|
2205
|
+
return e.forEach(function(e) {
|
|
2206
|
+
return nr(e, t);
|
|
2207
|
+
});
|
|
2208
|
+
});
|
|
2209
|
+
return ir(function() {
|
|
2210
|
+
var t = ar.get(n);
|
|
2211
|
+
if (t) {
|
|
2212
|
+
var r = new Set(t), i = new Set(e), a = n.current;
|
|
2213
|
+
r.forEach(function(e) {
|
|
2214
|
+
i.has(e) || nr(e, null);
|
|
2215
|
+
}), i.forEach(function(e) {
|
|
2216
|
+
r.has(e) || nr(e, a);
|
|
2217
|
+
});
|
|
2218
|
+
}
|
|
2219
|
+
ar.set(n, e);
|
|
2220
|
+
}, [e]), n;
|
|
2221
|
+
}
|
|
2222
|
+
//#endregion
|
|
2223
|
+
//#region ../../node_modules/.pnpm/use-sidecar@1.1.3_@types+react@19.2.17_react@19.2.7/node_modules/use-sidecar/dist/es2015/medium.js
|
|
2224
|
+
function sr(e) {
|
|
2225
|
+
return e;
|
|
2226
|
+
}
|
|
2227
|
+
function cr(e, t) {
|
|
2228
|
+
t === void 0 && (t = sr);
|
|
2229
|
+
var n = [], r = !1;
|
|
2230
|
+
return {
|
|
2231
|
+
read: function() {
|
|
2232
|
+
if (r) throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
2233
|
+
return n.length ? n[n.length - 1] : e;
|
|
2234
|
+
},
|
|
2235
|
+
useMedium: function(e) {
|
|
2236
|
+
var i = t(e, r);
|
|
2237
|
+
return n.push(i), function() {
|
|
2238
|
+
n = n.filter(function(e) {
|
|
2239
|
+
return e !== i;
|
|
2240
|
+
});
|
|
2241
|
+
};
|
|
2242
|
+
},
|
|
2243
|
+
assignSyncMedium: function(e) {
|
|
2244
|
+
for (r = !0; n.length;) {
|
|
2245
|
+
var t = n;
|
|
2246
|
+
n = [], t.forEach(e);
|
|
2247
|
+
}
|
|
2248
|
+
n = {
|
|
2249
|
+
push: function(t) {
|
|
2250
|
+
return e(t);
|
|
2251
|
+
},
|
|
2252
|
+
filter: function() {
|
|
2253
|
+
return n;
|
|
2254
|
+
}
|
|
2255
|
+
};
|
|
2256
|
+
},
|
|
2257
|
+
assignMedium: function(e) {
|
|
2258
|
+
r = !0;
|
|
2259
|
+
var t = [];
|
|
2260
|
+
if (n.length) {
|
|
2261
|
+
var i = n;
|
|
2262
|
+
n = [], i.forEach(e), t = n;
|
|
2263
|
+
}
|
|
2264
|
+
var a = function() {
|
|
2265
|
+
var n = t;
|
|
2266
|
+
t = [], n.forEach(e);
|
|
2267
|
+
}, o = function() {
|
|
2268
|
+
return Promise.resolve().then(a);
|
|
2269
|
+
};
|
|
2270
|
+
o(), n = {
|
|
2271
|
+
push: function(e) {
|
|
2272
|
+
t.push(e), o();
|
|
2273
|
+
},
|
|
2274
|
+
filter: function(e) {
|
|
2275
|
+
return t = t.filter(e), n;
|
|
2276
|
+
}
|
|
2277
|
+
};
|
|
2278
|
+
}
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
function lr(e) {
|
|
2282
|
+
e === void 0 && (e = {});
|
|
2283
|
+
var t = cr(null);
|
|
2284
|
+
return t.options = Y({
|
|
2285
|
+
async: !0,
|
|
2286
|
+
ssr: !1
|
|
2287
|
+
}, e), t;
|
|
2288
|
+
}
|
|
2289
|
+
//#endregion
|
|
2290
|
+
//#region ../../node_modules/.pnpm/use-sidecar@1.1.3_@types+react@19.2.17_react@19.2.7/node_modules/use-sidecar/dist/es2015/exports.js
|
|
2291
|
+
var ur = function(e) {
|
|
2292
|
+
var t = e.sideCar, n = Xn(e, ["sideCar"]);
|
|
2293
|
+
if (!t) throw Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
2294
|
+
var r = t.read();
|
|
2295
|
+
if (!r) throw Error("Sidecar medium not found");
|
|
2296
|
+
return u.createElement(r, Y({}, n));
|
|
2297
|
+
};
|
|
2298
|
+
ur.isSideCarExport = !0;
|
|
2299
|
+
function dr(e, t) {
|
|
2300
|
+
return e.useMedium(t), ur;
|
|
2301
|
+
}
|
|
2302
|
+
//#endregion
|
|
2303
|
+
//#region ../../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.17_react@19.2.7/node_modules/react-remove-scroll/dist/es2015/medium.js
|
|
2304
|
+
var fr = lr(), pr = function() {}, mr = u.forwardRef(function(e, t) {
|
|
2305
|
+
var n = u.useRef(null), r = u.useState({
|
|
2306
|
+
onScrollCapture: pr,
|
|
2307
|
+
onWheelCapture: pr,
|
|
2308
|
+
onTouchMoveCapture: pr
|
|
2309
|
+
}), i = r[0], a = r[1], o = e.forwardProps, s = e.children, c = e.className, l = e.removeScrollBar, d = e.enabled, f = e.shards, p = e.sideCar, m = e.noRelative, h = e.noIsolation, g = e.inert, _ = e.allowPinchZoom, v = e.as, y = v === void 0 ? "div" : v, b = e.gapMode, x = Xn(e, [
|
|
2310
|
+
"forwardProps",
|
|
2311
|
+
"children",
|
|
2312
|
+
"className",
|
|
2313
|
+
"removeScrollBar",
|
|
2314
|
+
"enabled",
|
|
2315
|
+
"shards",
|
|
2316
|
+
"sideCar",
|
|
2317
|
+
"noRelative",
|
|
2318
|
+
"noIsolation",
|
|
2319
|
+
"inert",
|
|
2320
|
+
"allowPinchZoom",
|
|
2321
|
+
"as",
|
|
2322
|
+
"gapMode"
|
|
2323
|
+
]), S = p, C = or([n, t]), w = Y(Y({}, x), i);
|
|
2324
|
+
return u.createElement(u.Fragment, null, d && u.createElement(S, {
|
|
2325
|
+
sideCar: fr,
|
|
2326
|
+
removeScrollBar: l,
|
|
2327
|
+
shards: f,
|
|
2328
|
+
noRelative: m,
|
|
2329
|
+
noIsolation: h,
|
|
2330
|
+
inert: g,
|
|
2331
|
+
setCallbacks: a,
|
|
2332
|
+
allowPinchZoom: !!_,
|
|
2333
|
+
lockRef: n,
|
|
2334
|
+
gapMode: b
|
|
2335
|
+
}), o ? u.cloneElement(u.Children.only(s), Y(Y({}, w), { ref: C })) : u.createElement(y, Y({}, w, {
|
|
2336
|
+
className: c,
|
|
2337
|
+
ref: C
|
|
2338
|
+
}), s));
|
|
2339
|
+
});
|
|
2340
|
+
mr.defaultProps = {
|
|
2341
|
+
enabled: !0,
|
|
2342
|
+
removeScrollBar: !0,
|
|
2343
|
+
inert: !1
|
|
2344
|
+
}, mr.classNames = {
|
|
2345
|
+
fullWidth: $n,
|
|
2346
|
+
zeroRight: Qn
|
|
2347
|
+
};
|
|
2348
|
+
//#endregion
|
|
2349
|
+
//#region ../../node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.js
|
|
2350
|
+
var hr, gr = function() {
|
|
2351
|
+
if (hr) return hr;
|
|
2352
|
+
if (typeof __webpack_nonce__ < "u") return __webpack_nonce__;
|
|
2353
|
+
};
|
|
2354
|
+
//#endregion
|
|
2355
|
+
//#region ../../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@19.2.17_react@19.2.7/node_modules/react-style-singleton/dist/es2015/singleton.js
|
|
2356
|
+
function _r() {
|
|
2357
|
+
if (!document) return null;
|
|
2358
|
+
var e = document.createElement("style");
|
|
2359
|
+
e.type = "text/css";
|
|
2360
|
+
var t = gr();
|
|
2361
|
+
return t && e.setAttribute("nonce", t), e;
|
|
2362
|
+
}
|
|
2363
|
+
function vr(e, t) {
|
|
2364
|
+
e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
|
|
2365
|
+
}
|
|
2366
|
+
function yr(e) {
|
|
2367
|
+
(document.head || document.getElementsByTagName("head")[0]).appendChild(e);
|
|
2368
|
+
}
|
|
2369
|
+
var br = function() {
|
|
2370
|
+
var e = 0, t = null;
|
|
2371
|
+
return {
|
|
2372
|
+
add: function(n) {
|
|
2373
|
+
e == 0 && (t = _r()) && (vr(t, n), yr(t)), e++;
|
|
2374
|
+
},
|
|
2375
|
+
remove: function() {
|
|
2376
|
+
e--, !e && t && (t.parentNode && t.parentNode.removeChild(t), t = null);
|
|
2377
|
+
}
|
|
2378
|
+
};
|
|
2379
|
+
}, xr = function() {
|
|
2380
|
+
var e = br();
|
|
2381
|
+
return function(t, n) {
|
|
2382
|
+
u.useEffect(function() {
|
|
2383
|
+
return e.add(t), function() {
|
|
2384
|
+
e.remove();
|
|
2385
|
+
};
|
|
2386
|
+
}, [t && n]);
|
|
2387
|
+
};
|
|
2388
|
+
}, Sr = function() {
|
|
2389
|
+
var e = xr();
|
|
2390
|
+
return function(t) {
|
|
2391
|
+
var n = t.styles, r = t.dynamic;
|
|
2392
|
+
return e(n, r), null;
|
|
2393
|
+
};
|
|
2394
|
+
}, Cr = {
|
|
2395
|
+
left: 0,
|
|
2396
|
+
top: 0,
|
|
2397
|
+
right: 0,
|
|
2398
|
+
gap: 0
|
|
2399
|
+
}, wr = function(e) {
|
|
2400
|
+
return parseInt(e || "", 10) || 0;
|
|
2401
|
+
}, Tr = function(e) {
|
|
2402
|
+
var t = window.getComputedStyle(document.body), n = t[e === "padding" ? "paddingLeft" : "marginLeft"], r = t[e === "padding" ? "paddingTop" : "marginTop"], i = t[e === "padding" ? "paddingRight" : "marginRight"];
|
|
2403
|
+
return [
|
|
2404
|
+
wr(n),
|
|
2405
|
+
wr(r),
|
|
2406
|
+
wr(i)
|
|
2407
|
+
];
|
|
2408
|
+
}, Er = function(e) {
|
|
2409
|
+
if (e === void 0 && (e = "margin"), typeof window > "u") return Cr;
|
|
2410
|
+
var t = Tr(e), n = document.documentElement.clientWidth, r = window.innerWidth;
|
|
2411
|
+
return {
|
|
2412
|
+
left: t[0],
|
|
2413
|
+
top: t[1],
|
|
2414
|
+
right: t[2],
|
|
2415
|
+
gap: Math.max(0, r - n + t[2] - t[0])
|
|
2416
|
+
};
|
|
2417
|
+
}, Dr = Sr(), Or = "data-scroll-locked", kr = function(e, t, n, r) {
|
|
2418
|
+
var i = e.left, a = e.top, o = e.right, s = e.gap;
|
|
2419
|
+
return n === void 0 && (n = "margin"), `
|
|
2420
|
+
.${er} {
|
|
2421
|
+
overflow: hidden ${r};
|
|
2422
|
+
padding-right: ${s}px ${r};
|
|
2423
|
+
}
|
|
2424
|
+
body[${Or}] {
|
|
2425
|
+
overflow: hidden ${r};
|
|
2426
|
+
overscroll-behavior: contain;
|
|
2427
|
+
${[
|
|
2428
|
+
t && `position: relative ${r};`,
|
|
2429
|
+
n === "margin" && `
|
|
2430
|
+
padding-left: ${i}px;
|
|
2431
|
+
padding-top: ${a}px;
|
|
2432
|
+
padding-right: ${o}px;
|
|
2433
|
+
margin-left:0;
|
|
2434
|
+
margin-top:0;
|
|
2435
|
+
margin-right: ${s}px ${r};
|
|
2436
|
+
`,
|
|
2437
|
+
n === "padding" && `padding-right: ${s}px ${r};`
|
|
2438
|
+
].filter(Boolean).join("")}
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
.${Qn} {
|
|
2442
|
+
right: ${s}px ${r};
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
.${$n} {
|
|
2446
|
+
margin-right: ${s}px ${r};
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
.${Qn} .${Qn} {
|
|
2450
|
+
right: 0 ${r};
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
.${$n} .${$n} {
|
|
2454
|
+
margin-right: 0 ${r};
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
body[${Or}] {
|
|
2458
|
+
${tr}: ${s}px;
|
|
2459
|
+
}
|
|
2460
|
+
`;
|
|
2461
|
+
}, Ar = function() {
|
|
2462
|
+
var e = parseInt(document.body.getAttribute("data-scroll-locked") || "0", 10);
|
|
2463
|
+
return isFinite(e) ? e : 0;
|
|
2464
|
+
}, jr = function() {
|
|
2465
|
+
u.useEffect(function() {
|
|
2466
|
+
return document.body.setAttribute(Or, (Ar() + 1).toString()), function() {
|
|
2467
|
+
var e = Ar() - 1;
|
|
2468
|
+
e <= 0 ? document.body.removeAttribute(Or) : document.body.setAttribute(Or, e.toString());
|
|
2469
|
+
};
|
|
2470
|
+
}, []);
|
|
2471
|
+
}, Mr = function(e) {
|
|
2472
|
+
var t = e.noRelative, n = e.noImportant, r = e.gapMode, i = r === void 0 ? "margin" : r;
|
|
2473
|
+
jr();
|
|
2474
|
+
var a = u.useMemo(function() {
|
|
2475
|
+
return Er(i);
|
|
2476
|
+
}, [i]);
|
|
2477
|
+
return u.createElement(Dr, { styles: kr(a, !t, i, n ? "" : "!important") });
|
|
2478
|
+
}, Nr = !1;
|
|
2479
|
+
if (typeof window < "u") try {
|
|
2480
|
+
var Pr = Object.defineProperty({}, "passive", { get: function() {
|
|
2481
|
+
return Nr = !0, !0;
|
|
2482
|
+
} });
|
|
2483
|
+
window.addEventListener("test", Pr, Pr), window.removeEventListener("test", Pr, Pr);
|
|
2484
|
+
} catch {
|
|
2485
|
+
Nr = !1;
|
|
2486
|
+
}
|
|
2487
|
+
var X = Nr ? { passive: !1 } : !1, Fr = function(e) {
|
|
2488
|
+
return e.tagName === "TEXTAREA";
|
|
2489
|
+
}, Ir = function(e, t) {
|
|
2490
|
+
if (!(e instanceof Element)) return !1;
|
|
2491
|
+
var n = window.getComputedStyle(e);
|
|
2492
|
+
return n[t] !== "hidden" && !(n.overflowY === n.overflowX && !Fr(e) && n[t] === "visible");
|
|
2493
|
+
}, Lr = function(e) {
|
|
2494
|
+
return Ir(e, "overflowY");
|
|
2495
|
+
}, Rr = function(e) {
|
|
2496
|
+
return Ir(e, "overflowX");
|
|
2497
|
+
}, zr = function(e, t) {
|
|
2498
|
+
var n = t.ownerDocument, r = t;
|
|
2499
|
+
do {
|
|
2500
|
+
if (typeof ShadowRoot < "u" && r instanceof ShadowRoot && (r = r.host), Hr(e, r)) {
|
|
2501
|
+
var i = Ur(e, r);
|
|
2502
|
+
if (i[1] > i[2]) return !0;
|
|
2503
|
+
}
|
|
2504
|
+
r = r.parentNode;
|
|
2505
|
+
} while (r && r !== n.body);
|
|
2506
|
+
return !1;
|
|
2507
|
+
}, Br = function(e) {
|
|
2508
|
+
return [
|
|
2509
|
+
e.scrollTop,
|
|
2510
|
+
e.scrollHeight,
|
|
2511
|
+
e.clientHeight
|
|
2512
|
+
];
|
|
2513
|
+
}, Vr = function(e) {
|
|
2514
|
+
return [
|
|
2515
|
+
e.scrollLeft,
|
|
2516
|
+
e.scrollWidth,
|
|
2517
|
+
e.clientWidth
|
|
2518
|
+
];
|
|
2519
|
+
}, Hr = function(e, t) {
|
|
2520
|
+
return e === "v" ? Lr(t) : Rr(t);
|
|
2521
|
+
}, Ur = function(e, t) {
|
|
2522
|
+
return e === "v" ? Br(t) : Vr(t);
|
|
2523
|
+
}, Wr = function(e, t) {
|
|
2524
|
+
return e === "h" && t === "rtl" ? -1 : 1;
|
|
2525
|
+
}, Gr = function(e, t, n, r, i) {
|
|
2526
|
+
var a = Wr(e, window.getComputedStyle(t).direction), o = a * r, s = n.target, c = t.contains(s), l = !1, u = o > 0, d = 0, f = 0;
|
|
2527
|
+
do {
|
|
2528
|
+
if (!s) break;
|
|
2529
|
+
var p = Ur(e, s), m = p[0], h = p[1] - p[2] - a * m;
|
|
2530
|
+
(m || h) && Hr(e, s) && (d += h, f += m);
|
|
2531
|
+
var g = s.parentNode;
|
|
2532
|
+
s = g && g.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? g.host : g;
|
|
2533
|
+
} while (!c && s !== document.body || c && (t.contains(s) || t === s));
|
|
2534
|
+
return (u && (i && Math.abs(d) < 1 || !i && o > d) || !u && (i && Math.abs(f) < 1 || !i && -o > f)) && (l = !0), l;
|
|
2535
|
+
}, Kr = function(e) {
|
|
2536
|
+
return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
|
|
2537
|
+
}, qr = function(e) {
|
|
2538
|
+
return [e.deltaX, e.deltaY];
|
|
2539
|
+
}, Jr = function(e) {
|
|
2540
|
+
return e && "current" in e ? e.current : e;
|
|
2541
|
+
}, Yr = function(e, t) {
|
|
2542
|
+
return e[0] === t[0] && e[1] === t[1];
|
|
2543
|
+
}, Xr = function(e) {
|
|
2544
|
+
return `
|
|
2545
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
2546
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
2547
|
+
`;
|
|
2548
|
+
}, Zr = 0, Z = [];
|
|
2549
|
+
function Qr(e) {
|
|
2550
|
+
var t = u.useRef([]), n = u.useRef([0, 0]), r = u.useRef(), i = u.useState(Zr++)[0], a = u.useState(Sr)[0], o = u.useRef(e);
|
|
2551
|
+
u.useEffect(function() {
|
|
2552
|
+
o.current = e;
|
|
2553
|
+
}, [e]), u.useEffect(function() {
|
|
2554
|
+
if (e.inert) {
|
|
2555
|
+
document.body.classList.add(`block-interactivity-${i}`);
|
|
2556
|
+
var t = Zn([e.lockRef.current], (e.shards || []).map(Jr), !0).filter(Boolean);
|
|
2557
|
+
return t.forEach(function(e) {
|
|
2558
|
+
return e.classList.add(`allow-interactivity-${i}`);
|
|
2559
|
+
}), function() {
|
|
2560
|
+
document.body.classList.remove(`block-interactivity-${i}`), t.forEach(function(e) {
|
|
2561
|
+
return e.classList.remove(`allow-interactivity-${i}`);
|
|
2562
|
+
});
|
|
2563
|
+
};
|
|
2564
|
+
}
|
|
2565
|
+
}, [
|
|
2566
|
+
e.inert,
|
|
2567
|
+
e.lockRef.current,
|
|
2568
|
+
e.shards
|
|
2569
|
+
]);
|
|
2570
|
+
var s = u.useCallback(function(e, t) {
|
|
2571
|
+
if ("touches" in e && e.touches.length === 2 || e.type === "wheel" && e.ctrlKey) return !o.current.allowPinchZoom;
|
|
2572
|
+
var i = Kr(e), a = n.current, s = "deltaX" in e ? e.deltaX : a[0] - i[0], c = "deltaY" in e ? e.deltaY : a[1] - i[1], l, u = e.target, d = Math.abs(s) > Math.abs(c) ? "h" : "v";
|
|
2573
|
+
if ("touches" in e && d === "h" && u.type === "range") return !1;
|
|
2574
|
+
var f = window.getSelection(), p = f && f.anchorNode;
|
|
2575
|
+
if (p && (p === u || p.contains(u))) return !1;
|
|
2576
|
+
var m = zr(d, u);
|
|
2577
|
+
if (!m) return !0;
|
|
2578
|
+
if (m ? l = d : (l = d === "v" ? "h" : "v", m = zr(d, u)), !m) return !1;
|
|
2579
|
+
if (!r.current && "changedTouches" in e && (s || c) && (r.current = l), !l) return !0;
|
|
2580
|
+
var h = r.current || l;
|
|
2581
|
+
return Gr(h, t, e, h === "h" ? s : c, !0);
|
|
2582
|
+
}, []), c = u.useCallback(function(e) {
|
|
2583
|
+
var n = e;
|
|
2584
|
+
if (!(!Z.length || Z[Z.length - 1] !== a)) {
|
|
2585
|
+
var r = "deltaY" in n ? qr(n) : Kr(n), i = t.current.filter(function(e) {
|
|
2586
|
+
return e.name === n.type && (e.target === n.target || n.target === e.shadowParent) && Yr(e.delta, r);
|
|
2587
|
+
})[0];
|
|
2588
|
+
if (i && i.should) {
|
|
2589
|
+
n.cancelable && n.preventDefault();
|
|
2590
|
+
return;
|
|
2591
|
+
}
|
|
2592
|
+
if (!i) {
|
|
2593
|
+
var c = (o.current.shards || []).map(Jr).filter(Boolean).filter(function(e) {
|
|
2594
|
+
return e.contains(n.target);
|
|
2595
|
+
});
|
|
2596
|
+
(c.length > 0 ? s(n, c[0]) : !o.current.noIsolation) && n.cancelable && n.preventDefault();
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
}, []), l = u.useCallback(function(e, n, r, i) {
|
|
2600
|
+
var a = {
|
|
2601
|
+
name: e,
|
|
2602
|
+
delta: n,
|
|
2603
|
+
target: r,
|
|
2604
|
+
should: i,
|
|
2605
|
+
shadowParent: $r(r)
|
|
2606
|
+
};
|
|
2607
|
+
t.current.push(a), setTimeout(function() {
|
|
2608
|
+
t.current = t.current.filter(function(e) {
|
|
2609
|
+
return e !== a;
|
|
2610
|
+
});
|
|
2611
|
+
}, 1);
|
|
2612
|
+
}, []), d = u.useCallback(function(e) {
|
|
2613
|
+
n.current = Kr(e), r.current = void 0;
|
|
2614
|
+
}, []), f = u.useCallback(function(t) {
|
|
2615
|
+
l(t.type, qr(t), t.target, s(t, e.lockRef.current));
|
|
2616
|
+
}, []), p = u.useCallback(function(t) {
|
|
2617
|
+
l(t.type, Kr(t), t.target, s(t, e.lockRef.current));
|
|
2618
|
+
}, []);
|
|
2619
|
+
u.useEffect(function() {
|
|
2620
|
+
return Z.push(a), e.setCallbacks({
|
|
2621
|
+
onScrollCapture: f,
|
|
2622
|
+
onWheelCapture: f,
|
|
2623
|
+
onTouchMoveCapture: p
|
|
2624
|
+
}), document.addEventListener("wheel", c, X), document.addEventListener("touchmove", c, X), document.addEventListener("touchstart", d, X), function() {
|
|
2625
|
+
Z = Z.filter(function(e) {
|
|
2626
|
+
return e !== a;
|
|
2627
|
+
}), document.removeEventListener("wheel", c, X), document.removeEventListener("touchmove", c, X), document.removeEventListener("touchstart", d, X);
|
|
2628
|
+
};
|
|
2629
|
+
}, []);
|
|
2630
|
+
var m = e.removeScrollBar, h = e.inert;
|
|
2631
|
+
return u.createElement(u.Fragment, null, h ? u.createElement(a, { styles: Xr(i) }) : null, m ? u.createElement(Mr, {
|
|
2632
|
+
noRelative: e.noRelative,
|
|
2633
|
+
gapMode: e.gapMode
|
|
2634
|
+
}) : null);
|
|
2635
|
+
}
|
|
2636
|
+
function $r(e) {
|
|
2637
|
+
for (var t = null; e !== null;) e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode;
|
|
2638
|
+
return t;
|
|
2639
|
+
}
|
|
2640
|
+
//#endregion
|
|
2641
|
+
//#region ../../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.17_react@19.2.7/node_modules/react-remove-scroll/dist/es2015/sidecar.js
|
|
2642
|
+
var ei = dr(fr, Qr), ti = u.forwardRef(function(e, t) {
|
|
2643
|
+
return u.createElement(mr, Y({}, e, {
|
|
2644
|
+
ref: t,
|
|
2645
|
+
sideCar: ei
|
|
2646
|
+
}));
|
|
2647
|
+
});
|
|
2648
|
+
ti.classNames = mr.classNames;
|
|
2649
|
+
//#endregion
|
|
2650
|
+
//#region ../../node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js
|
|
2651
|
+
var ni = function(e) {
|
|
2652
|
+
return typeof document > "u" ? null : (Array.isArray(e) ? e[0] : e).ownerDocument.body;
|
|
2653
|
+
}, ri = /* @__PURE__ */ new WeakMap(), ii = /* @__PURE__ */ new WeakMap(), ai = {}, oi = 0, si = function(e) {
|
|
2654
|
+
return e && (e.host || si(e.parentNode));
|
|
2655
|
+
}, ci = function(e, t) {
|
|
2656
|
+
return t.map(function(t) {
|
|
2657
|
+
if (e.contains(t)) return t;
|
|
2658
|
+
var n = si(t);
|
|
2659
|
+
return n && e.contains(n) ? n : (console.error("aria-hidden", t, "in not contained inside", e, ". Doing nothing"), null);
|
|
2660
|
+
}).filter(function(e) {
|
|
2661
|
+
return !!e;
|
|
2662
|
+
});
|
|
2663
|
+
}, li = function(e, t, n, r) {
|
|
2664
|
+
var i = ci(t, Array.isArray(e) ? e : [e]);
|
|
2665
|
+
ai[n] || (ai[n] = /* @__PURE__ */ new WeakMap());
|
|
2666
|
+
var a = ai[n], o = [], s = /* @__PURE__ */ new Set(), c = new Set(i), l = function(e) {
|
|
2667
|
+
!e || s.has(e) || (s.add(e), l(e.parentNode));
|
|
2668
|
+
};
|
|
2669
|
+
i.forEach(l);
|
|
2670
|
+
var u = function(e) {
|
|
2671
|
+
!e || c.has(e) || Array.prototype.forEach.call(e.children, function(e) {
|
|
2672
|
+
if (s.has(e)) u(e);
|
|
2673
|
+
else try {
|
|
2674
|
+
var t = e.getAttribute(r), i = t !== null && t !== "false", c = (ri.get(e) || 0) + 1, l = (a.get(e) || 0) + 1;
|
|
2675
|
+
ri.set(e, c), a.set(e, l), o.push(e), c === 1 && i && ii.set(e, !0), l === 1 && e.setAttribute(n, "true"), i || e.setAttribute(r, "true");
|
|
2676
|
+
} catch (t) {
|
|
2677
|
+
console.error("aria-hidden: cannot operate on ", e, t);
|
|
2678
|
+
}
|
|
2679
|
+
});
|
|
2680
|
+
};
|
|
2681
|
+
return u(t), s.clear(), oi++, function() {
|
|
2682
|
+
o.forEach(function(e) {
|
|
2683
|
+
var t = ri.get(e) - 1, i = a.get(e) - 1;
|
|
2684
|
+
ri.set(e, t), a.set(e, i), t || (ii.has(e) || e.removeAttribute(r), ii.delete(e)), i || e.removeAttribute(n);
|
|
2685
|
+
}), oi--, oi || (ri = /* @__PURE__ */ new WeakMap(), ri = /* @__PURE__ */ new WeakMap(), ii = /* @__PURE__ */ new WeakMap(), ai = {});
|
|
2686
|
+
};
|
|
2687
|
+
}, ui = function(e, t, n) {
|
|
2688
|
+
n === void 0 && (n = "data-aria-hidden");
|
|
2689
|
+
var r = Array.from(Array.isArray(e) ? e : [e]), i = t || ni(e);
|
|
2690
|
+
return i ? (r.push.apply(r, Array.from(i.querySelectorAll("[aria-live], script"))), li(r, i, n, "aria-hidden")) : function() {
|
|
2691
|
+
return null;
|
|
2692
|
+
};
|
|
2693
|
+
}, di = "Dialog", [fi, pi] = Lt(di), [mi, Q] = fi(di), hi = (e) => {
|
|
2694
|
+
let { __scopeDialog: t, children: n, open: r, defaultOpen: i, onOpenChange: a, modal: o = !0 } = e, s = u.useRef(null), c = u.useRef(null), [l, d] = Gt({
|
|
2695
|
+
prop: r,
|
|
2696
|
+
defaultProp: i == null ? !1 : i,
|
|
2697
|
+
onChange: a,
|
|
2698
|
+
caller: di
|
|
2699
|
+
});
|
|
2700
|
+
return /* @__PURE__ */ w(mi, {
|
|
2701
|
+
scope: t,
|
|
2702
|
+
triggerRef: s,
|
|
2703
|
+
contentRef: c,
|
|
2704
|
+
contentId: Ut(),
|
|
2705
|
+
titleId: Ut(),
|
|
2706
|
+
descriptionId: Ut(),
|
|
2707
|
+
open: l,
|
|
2708
|
+
onOpenChange: d,
|
|
2709
|
+
onOpenToggle: u.useCallback(() => d((e) => !e), [d]),
|
|
2710
|
+
modal: o,
|
|
2711
|
+
children: n
|
|
2712
|
+
});
|
|
2713
|
+
};
|
|
2714
|
+
hi.displayName = di;
|
|
2715
|
+
var gi = "DialogTrigger", _i = u.forwardRef((e, t) => {
|
|
2716
|
+
let { __scopeDialog: n, ...r } = e, i = Q(gi, n), a = G(t, i.triggerRef);
|
|
2717
|
+
return /* @__PURE__ */ w(K.button, {
|
|
2718
|
+
type: "button",
|
|
2719
|
+
"aria-haspopup": "dialog",
|
|
2720
|
+
"aria-expanded": i.open,
|
|
2721
|
+
"aria-controls": i.open ? i.contentId : void 0,
|
|
2722
|
+
"data-state": Ii(i.open),
|
|
2723
|
+
...r,
|
|
2724
|
+
ref: a,
|
|
2725
|
+
onClick: W(e.onClick, i.onOpenToggle)
|
|
2726
|
+
});
|
|
2727
|
+
});
|
|
2728
|
+
_i.displayName = gi;
|
|
2729
|
+
var vi = "DialogPortal", [yi, bi] = fi(vi, { forceMount: void 0 }), xi = (e) => {
|
|
2730
|
+
let { __scopeDialog: t, forceMount: n, children: r, container: i } = e, a = Q(vi, t);
|
|
2731
|
+
return /* @__PURE__ */ w(yi, {
|
|
2732
|
+
scope: t,
|
|
2733
|
+
forceMount: n,
|
|
2734
|
+
children: u.Children.map(r, (e) => /* @__PURE__ */ w(Vn, {
|
|
2735
|
+
present: n || a.open,
|
|
2736
|
+
children: /* @__PURE__ */ w(zn, {
|
|
2737
|
+
asChild: !0,
|
|
2738
|
+
container: i,
|
|
2739
|
+
children: e
|
|
2740
|
+
})
|
|
2741
|
+
}))
|
|
2742
|
+
});
|
|
2743
|
+
};
|
|
2744
|
+
xi.displayName = vi;
|
|
2745
|
+
var Si = "DialogOverlay", Ci = u.forwardRef((e, t) => {
|
|
2746
|
+
let n = bi(Si, e.__scopeDialog), { forceMount: r = n.forceMount, ...i } = e, a = Q(Si, e.__scopeDialog);
|
|
2747
|
+
return a.modal ? /* @__PURE__ */ w(Vn, {
|
|
2748
|
+
present: r || a.open,
|
|
2749
|
+
children: /* @__PURE__ */ w(Ti, {
|
|
2750
|
+
...i,
|
|
2751
|
+
ref: t
|
|
2752
|
+
})
|
|
2753
|
+
}) : null;
|
|
2754
|
+
});
|
|
2755
|
+
Ci.displayName = Si;
|
|
2756
|
+
var wi = /* @__PURE__ */ Jt("DialogOverlay.RemoveScroll"), Ti = u.forwardRef((e, t) => {
|
|
2757
|
+
let { __scopeDialog: n, ...r } = e, i = Q(Si, n);
|
|
2758
|
+
return /* @__PURE__ */ w(ti, {
|
|
2759
|
+
as: wi,
|
|
2760
|
+
allowPinchZoom: !0,
|
|
2761
|
+
shards: [i.contentRef],
|
|
2762
|
+
children: /* @__PURE__ */ w(K.div, {
|
|
2763
|
+
"data-state": Ii(i.open),
|
|
2764
|
+
...r,
|
|
2765
|
+
ref: t,
|
|
2766
|
+
style: {
|
|
2767
|
+
pointerEvents: "auto",
|
|
2768
|
+
...r.style
|
|
2769
|
+
}
|
|
2770
|
+
})
|
|
2771
|
+
});
|
|
2772
|
+
}), $ = "DialogContent", Ei = u.forwardRef((e, t) => {
|
|
2773
|
+
let n = bi($, e.__scopeDialog), { forceMount: r = n.forceMount, ...i } = e, a = Q($, e.__scopeDialog);
|
|
2774
|
+
return /* @__PURE__ */ w(Vn, {
|
|
2775
|
+
present: r || a.open,
|
|
2776
|
+
children: a.modal ? /* @__PURE__ */ w(Di, {
|
|
2777
|
+
...i,
|
|
2778
|
+
ref: t
|
|
2779
|
+
}) : /* @__PURE__ */ w(Oi, {
|
|
2780
|
+
...i,
|
|
2781
|
+
ref: t
|
|
2782
|
+
})
|
|
2783
|
+
});
|
|
2784
|
+
});
|
|
2785
|
+
Ei.displayName = $;
|
|
2786
|
+
var Di = u.forwardRef((e, t) => {
|
|
2787
|
+
let n = Q($, e.__scopeDialog), r = u.useRef(null), i = G(t, n.contentRef, r);
|
|
2788
|
+
return u.useEffect(() => {
|
|
2789
|
+
let e = r.current;
|
|
2790
|
+
if (e) return ui(e);
|
|
2791
|
+
}, []), /* @__PURE__ */ w(ki, {
|
|
2792
|
+
...e,
|
|
2793
|
+
ref: i,
|
|
2794
|
+
trapFocus: n.open,
|
|
2795
|
+
disableOutsidePointerEvents: n.open,
|
|
2796
|
+
onCloseAutoFocus: W(e.onCloseAutoFocus, (e) => {
|
|
2797
|
+
var t;
|
|
2798
|
+
e.preventDefault(), (t = n.triggerRef.current) == null || t.focus();
|
|
2799
|
+
}),
|
|
2800
|
+
onPointerDownOutside: W(e.onPointerDownOutside, (e) => {
|
|
2801
|
+
let t = e.detail.originalEvent, n = t.button === 0 && t.ctrlKey === !0;
|
|
2802
|
+
(t.button === 2 || n) && e.preventDefault();
|
|
2803
|
+
}),
|
|
2804
|
+
onFocusOutside: W(e.onFocusOutside, (e) => e.preventDefault())
|
|
2805
|
+
});
|
|
2806
|
+
}), Oi = u.forwardRef((e, t) => {
|
|
2807
|
+
let n = Q($, e.__scopeDialog), r = u.useRef(!1), i = u.useRef(!1);
|
|
2808
|
+
return /* @__PURE__ */ w(ki, {
|
|
2809
|
+
...e,
|
|
2810
|
+
ref: t,
|
|
2811
|
+
trapFocus: !1,
|
|
2812
|
+
disableOutsidePointerEvents: !1,
|
|
2813
|
+
onCloseAutoFocus: (t) => {
|
|
2814
|
+
var a;
|
|
2815
|
+
if ((a = e.onCloseAutoFocus) == null || a.call(e, t), !t.defaultPrevented) {
|
|
2816
|
+
var o;
|
|
2817
|
+
r.current || (o = n.triggerRef.current) == null || o.focus(), t.preventDefault();
|
|
2818
|
+
}
|
|
2819
|
+
r.current = !1, i.current = !1;
|
|
2820
|
+
},
|
|
2821
|
+
onInteractOutside: (t) => {
|
|
2822
|
+
var a, o;
|
|
2823
|
+
(a = e.onInteractOutside) == null || a.call(e, t), t.defaultPrevented || (r.current = !0, t.detail.originalEvent.type === "pointerdown" && (i.current = !0));
|
|
2824
|
+
let s = t.target;
|
|
2825
|
+
(o = n.triggerRef.current) != null && o.contains(s) && t.preventDefault(), t.detail.originalEvent.type === "focusin" && i.current && t.preventDefault();
|
|
2826
|
+
}
|
|
2827
|
+
});
|
|
2828
|
+
}), ki = u.forwardRef((e, t) => {
|
|
2829
|
+
let { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: i, onCloseAutoFocus: a, ...o } = e, s = Q($, n), c = u.useRef(null), l = G(t, c);
|
|
2830
|
+
return Jn(), /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(Dn, {
|
|
2831
|
+
asChild: !0,
|
|
2832
|
+
loop: !0,
|
|
2833
|
+
trapped: r,
|
|
2834
|
+
onMountAutoFocus: i,
|
|
2835
|
+
onUnmountAutoFocus: a,
|
|
2836
|
+
children: /* @__PURE__ */ w(gn, {
|
|
2837
|
+
role: "dialog",
|
|
2838
|
+
id: s.contentId,
|
|
2839
|
+
"aria-describedby": s.descriptionId,
|
|
2840
|
+
"aria-labelledby": s.titleId,
|
|
2841
|
+
"data-state": Ii(s.open),
|
|
2842
|
+
...o,
|
|
2843
|
+
ref: l,
|
|
2844
|
+
onDismiss: () => s.onOpenChange(!1)
|
|
2845
|
+
})
|
|
2846
|
+
}), /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(Bi, { titleId: s.titleId }), /* @__PURE__ */ w(Hi, {
|
|
2847
|
+
contentRef: c,
|
|
2848
|
+
descriptionId: s.descriptionId
|
|
2849
|
+
})] })] });
|
|
2850
|
+
}), Ai = "DialogTitle", ji = u.forwardRef((e, t) => {
|
|
2851
|
+
let { __scopeDialog: n, ...r } = e, i = Q(Ai, n);
|
|
2852
|
+
return /* @__PURE__ */ w(K.h2, {
|
|
2853
|
+
id: i.titleId,
|
|
2854
|
+
...r,
|
|
2855
|
+
ref: t
|
|
2856
|
+
});
|
|
2857
|
+
});
|
|
2858
|
+
ji.displayName = Ai;
|
|
2859
|
+
var Mi = "DialogDescription", Ni = u.forwardRef((e, t) => {
|
|
2860
|
+
let { __scopeDialog: n, ...r } = e, i = Q(Mi, n);
|
|
2861
|
+
return /* @__PURE__ */ w(K.p, {
|
|
2862
|
+
id: i.descriptionId,
|
|
2863
|
+
...r,
|
|
2864
|
+
ref: t
|
|
2865
|
+
});
|
|
2866
|
+
});
|
|
2867
|
+
Ni.displayName = Mi;
|
|
2868
|
+
var Pi = "DialogClose", Fi = u.forwardRef((e, t) => {
|
|
2869
|
+
let { __scopeDialog: n, ...r } = e, i = Q(Pi, n);
|
|
2870
|
+
return /* @__PURE__ */ w(K.button, {
|
|
2871
|
+
type: "button",
|
|
2872
|
+
...r,
|
|
2873
|
+
ref: t,
|
|
2874
|
+
onClick: W(e.onClick, () => i.onOpenChange(!1))
|
|
2875
|
+
});
|
|
2876
|
+
});
|
|
2877
|
+
Fi.displayName = Pi;
|
|
2878
|
+
function Ii(e) {
|
|
2879
|
+
return e ? "open" : "closed";
|
|
2880
|
+
}
|
|
2881
|
+
var Li = "DialogTitleWarning", [Ri, zi] = It(Li, {
|
|
2882
|
+
contentName: $,
|
|
2883
|
+
titleName: Ai,
|
|
2884
|
+
docsSlug: "dialog"
|
|
2885
|
+
}), Bi = ({ titleId: e }) => {
|
|
2886
|
+
let t = zi(Li), n = `\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2887
|
+
|
|
2888
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
2889
|
+
|
|
2890
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;
|
|
2891
|
+
return u.useEffect(() => {
|
|
2892
|
+
e && (document.getElementById(e) || console.error(n));
|
|
2893
|
+
}, [n, e]), null;
|
|
2894
|
+
}, Vi = "DialogDescriptionWarning", Hi = ({ contentRef: e, descriptionId: t }) => {
|
|
2895
|
+
let n = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zi(Vi).contentName}}.`;
|
|
2896
|
+
return u.useEffect(() => {
|
|
2897
|
+
var r;
|
|
2898
|
+
let i = (r = e.current) == null ? void 0 : r.getAttribute("aria-describedby");
|
|
2899
|
+
t && i && (document.getElementById(t) || console.warn(n));
|
|
2900
|
+
}, [
|
|
2901
|
+
n,
|
|
2902
|
+
e,
|
|
2903
|
+
t
|
|
2904
|
+
]), null;
|
|
2905
|
+
}, Ui = hi, Wi = xi, Gi = Ci, Ki = Ei, qi = ji, Ji = Ni, Yi = ({ open: e, title: t, children: n, actions: r, onClose: i }) => /* @__PURE__ */ w(Ui, {
|
|
2906
|
+
open: e,
|
|
2907
|
+
onOpenChange: (e) => !e && (i == null ? void 0 : i()),
|
|
2908
|
+
children: /* @__PURE__ */ T(Wi, { children: [/* @__PURE__ */ w(Gi, { className: "sc:fixed sc:inset-0 sc:bg-black/40 sc:z-50" }), /* @__PURE__ */ T(Ki, {
|
|
2909
|
+
className: "sapia-chatbot sc:fixed sc:left-1/2 sc:top-1/2 sc:-translate-x-1/2 sc:-translate-y-1/2 sc:z-50 sc:w-[90vw] sc:max-w-md sc:rounded-xl sc:bg-white sc:p-5 sc:shadow-lg",
|
|
2910
|
+
onEscapeKeyDown: i ? void 0 : (e) => e.preventDefault(),
|
|
2911
|
+
onPointerDownOutside: i ? void 0 : (e) => e.preventDefault(),
|
|
2912
|
+
children: [
|
|
2913
|
+
/* @__PURE__ */ w(qi, {
|
|
2914
|
+
className: "sc:text-base sc:font-semibold sc:text-question-fg",
|
|
2915
|
+
children: t
|
|
2916
|
+
}),
|
|
2917
|
+
n ? /* @__PURE__ */ w(Ji, {
|
|
2918
|
+
asChild: !0,
|
|
2919
|
+
children: /* @__PURE__ */ w("div", {
|
|
2920
|
+
className: "sc:mt-2 sc:text-sm sc:text-question-fg",
|
|
2921
|
+
children: n
|
|
2922
|
+
})
|
|
2923
|
+
}) : null,
|
|
2924
|
+
/* @__PURE__ */ w("div", {
|
|
2925
|
+
className: "sc:mt-4 sc:flex sc:justify-end sc:gap-2",
|
|
2926
|
+
children: r.map((e) => /* @__PURE__ */ w(U, {
|
|
2927
|
+
variant: e.variant,
|
|
2928
|
+
onClick: e.onClick,
|
|
2929
|
+
children: e.label
|
|
2930
|
+
}, e.label))
|
|
2931
|
+
})
|
|
2932
|
+
]
|
|
2933
|
+
})] })
|
|
2934
|
+
}), Xi = ({ emailHint: e, mismatch: t = !1, submitting: n = !1, labels: r, onSubmit: i }) => {
|
|
2935
|
+
let [a, o] = y(""), s = h();
|
|
2936
|
+
return /* @__PURE__ */ T("form", {
|
|
2937
|
+
onSubmit: (e) => {
|
|
2938
|
+
e.preventDefault(), a.trim().length > 0 && !n && i(a.trim());
|
|
2939
|
+
},
|
|
2940
|
+
className: "sc:flex sc:flex-col sc:gap-3 sc:p-4",
|
|
2941
|
+
children: [
|
|
2942
|
+
/* @__PURE__ */ w("h2", {
|
|
2943
|
+
className: "sc:text-base sc:font-semibold sc:text-question-fg",
|
|
2944
|
+
children: r.title
|
|
2945
|
+
}),
|
|
2946
|
+
/* @__PURE__ */ w("p", {
|
|
2947
|
+
className: "sc:text-sm sc:text-question-fg",
|
|
2948
|
+
children: r.description
|
|
2949
|
+
}),
|
|
2950
|
+
e ? /* @__PURE__ */ w("p", {
|
|
2951
|
+
className: "sc:text-sm sc:font-medium sc:text-question-fg",
|
|
2952
|
+
children: e
|
|
2953
|
+
}) : null,
|
|
2954
|
+
/* @__PURE__ */ w("input", {
|
|
2955
|
+
type: "email",
|
|
2956
|
+
inputMode: "email",
|
|
2957
|
+
value: a,
|
|
2958
|
+
onChange: (e) => o(e.target.value),
|
|
2959
|
+
disabled: n,
|
|
2960
|
+
"aria-label": r.inputLabel,
|
|
2961
|
+
"aria-invalid": t || void 0,
|
|
2962
|
+
"aria-describedby": t ? s : void 0,
|
|
2963
|
+
placeholder: r.placeholder,
|
|
2964
|
+
className: "sc:rounded-md sc:border sc:border-black/20 sc:px-3 sc:py-2 sc:text-sm sc:focus-visible:outline-2 sc:focus-visible:outline-offset-1 sc:disabled:opacity-50"
|
|
2965
|
+
}),
|
|
2966
|
+
t ? /* @__PURE__ */ w("p", {
|
|
2967
|
+
id: s,
|
|
2968
|
+
role: "alert",
|
|
2969
|
+
className: "sc:text-sm sc:text-red-600",
|
|
2970
|
+
children: r.mismatchError
|
|
2971
|
+
}) : null,
|
|
2972
|
+
/* @__PURE__ */ w(U, {
|
|
2973
|
+
type: "submit",
|
|
2974
|
+
disabled: n || a.trim().length === 0,
|
|
2975
|
+
children: r.submit
|
|
2976
|
+
})
|
|
2977
|
+
]
|
|
2978
|
+
});
|
|
2979
|
+
}, Zi = ({ n: e, text: t }) => /* @__PURE__ */ T("div", {
|
|
2980
|
+
className: "sc:mt-3.5 sc:flex sc:items-start sc:gap-3.5 sc:first:mt-4",
|
|
2981
|
+
children: [/* @__PURE__ */ w("span", {
|
|
2982
|
+
"aria-hidden": "true",
|
|
2983
|
+
className: "sc:flex sc:size-7 sc:flex-shrink-0 sc:items-center sc:justify-center sc:rounded-full sc:bg-pink sc:text-sm sc:font-extrabold sc:text-question-fg",
|
|
2984
|
+
children: e
|
|
2985
|
+
}), /* @__PURE__ */ w("span", {
|
|
2986
|
+
className: "sc:text-sm/relaxed sc:text-[#37333d]",
|
|
2987
|
+
children: t
|
|
2988
|
+
})]
|
|
2989
|
+
}), Qi = ({ labels: e }) => /* @__PURE__ */ w("div", {
|
|
2990
|
+
className: "sc:flex sc:flex-1 sc:items-center sc:justify-center sc:overflow-y-auto sc:bg-canvas sc:px-6 sc:py-10",
|
|
2991
|
+
children: /* @__PURE__ */ T("div", {
|
|
2992
|
+
className: "sc:flex sc:w-full sc:max-w-[480px] sc:flex-col sc:items-center sc:text-center",
|
|
2993
|
+
children: [
|
|
2994
|
+
/* @__PURE__ */ w("span", {
|
|
2995
|
+
"aria-hidden": "true",
|
|
2996
|
+
className: "sc:h-10 sc:w-[88px] sc:-rotate-3 sc:rounded-b-[100%] sc:border-b-[9px] sc:border-pink sc:[animation:sc-msg-in_.5s_ease_both]"
|
|
2997
|
+
}),
|
|
2998
|
+
/* @__PURE__ */ w("h1", {
|
|
2999
|
+
className: "sc:mt-6 sc:text-[36px]/[1.1] sc:font-extrabold sc:tracking-tight sc:text-question-fg",
|
|
3000
|
+
children: e.title
|
|
3001
|
+
}),
|
|
3002
|
+
/* @__PURE__ */ w("p", {
|
|
3003
|
+
className: "sc:mt-3.5 sc:text-base/relaxed sc:text-[#37333d] sc:[text-wrap:pretty]",
|
|
3004
|
+
children: e.subtitle
|
|
3005
|
+
}),
|
|
3006
|
+
/* @__PURE__ */ T("div", {
|
|
3007
|
+
className: "sc:mt-7 sc:w-full sc:rounded-[24px] sc:border sc:border-line sc:bg-white sc:p-5 sc:text-left",
|
|
3008
|
+
children: [/* @__PURE__ */ w("span", {
|
|
3009
|
+
className: "sc:text-xs sc:font-semibold sc:tracking-[0.18em] sc:text-muted sc:uppercase",
|
|
3010
|
+
children: e.nextLabel
|
|
3011
|
+
}), e.steps.map((e, t) => /* @__PURE__ */ w(Zi, {
|
|
3012
|
+
n: t + 1,
|
|
3013
|
+
text: e
|
|
3014
|
+
}, t))]
|
|
3015
|
+
}),
|
|
3016
|
+
/* @__PURE__ */ T("div", {
|
|
3017
|
+
className: "sc:mt-4 sc:w-full sc:rounded-[24px] sc:bg-pink-tint sc:p-5",
|
|
3018
|
+
children: [/* @__PURE__ */ w("span", {
|
|
3019
|
+
className: "sc:text-[15px] sc:font-bold sc:text-question-fg",
|
|
3020
|
+
children: e.ratingPrompt
|
|
3021
|
+
}), /* @__PURE__ */ w("div", {
|
|
3022
|
+
className: "sc:mt-2.5 sc:flex sc:justify-center sc:gap-1",
|
|
3023
|
+
"aria-hidden": "true",
|
|
3024
|
+
children: [
|
|
3025
|
+
1,
|
|
3026
|
+
2,
|
|
3027
|
+
3,
|
|
3028
|
+
4,
|
|
3029
|
+
5
|
|
3030
|
+
].map((e) => /* @__PURE__ */ w("span", {
|
|
3031
|
+
className: "sc:text-[28px] sc:text-line",
|
|
3032
|
+
children: "★"
|
|
3033
|
+
}, e))
|
|
3034
|
+
})]
|
|
3035
|
+
})
|
|
3036
|
+
]
|
|
3037
|
+
})
|
|
3038
|
+
}), $i = ({ title: e, subtitle: t, logoUrl: n, logoAlt: r, progressLabel: i }) => /* @__PURE__ */ w("header", {
|
|
3039
|
+
className: "sc:flex-shrink-0 sc:border-b sc:border-line sc:bg-header sc:text-header-fg",
|
|
3040
|
+
children: /* @__PURE__ */ T("div", {
|
|
3041
|
+
className: "sc:mx-auto sc:flex sc:w-full sc:max-w-[720px] sc:items-center sc:justify-between sc:gap-3 sc:px-4 sc:py-2.5",
|
|
3042
|
+
children: [/* @__PURE__ */ T("div", {
|
|
3043
|
+
className: "sc:flex sc:min-w-0 sc:items-center sc:gap-3",
|
|
3044
|
+
children: [n ? /* @__PURE__ */ w("img", {
|
|
3045
|
+
src: n,
|
|
3046
|
+
alt: r == null ? "" : r,
|
|
3047
|
+
className: "sc:h-7 sc:w-auto"
|
|
3048
|
+
}) : null, /* @__PURE__ */ T("div", {
|
|
3049
|
+
className: "sc:flex sc:min-w-0 sc:flex-col sc:gap-0.5",
|
|
3050
|
+
children: [/* @__PURE__ */ w("h1", {
|
|
3051
|
+
className: "sc:truncate sc:text-[15px] sc:font-bold sc:text-header-fg",
|
|
3052
|
+
children: e
|
|
3053
|
+
}), t ? /* @__PURE__ */ w("span", {
|
|
3054
|
+
className: "sc:truncate sc:text-[13px] sc:text-muted",
|
|
3055
|
+
children: t
|
|
3056
|
+
}) : null]
|
|
3057
|
+
})]
|
|
3058
|
+
}), i ? /* @__PURE__ */ w("span", {
|
|
3059
|
+
className: "sc:flex-shrink-0 sc:rounded-full sc:bg-pink-tint sc:px-3.5 sc:py-1.5 sc:text-[13px] sc:font-bold sc:text-header-fg sc:tabular-nums",
|
|
3060
|
+
children: i
|
|
3061
|
+
}) : null]
|
|
3062
|
+
})
|
|
3063
|
+
}), ea = "sc:size-2 sc:rounded-full sc:bg-pink-strong sc:[animation:sc-dot-blink_1.2s_infinite]", ta = ({ label: e }) => /* @__PURE__ */ T("div", {
|
|
3064
|
+
role: "status",
|
|
3065
|
+
className: "sc:flex sc:flex-1 sc:flex-col sc:items-center sc:justify-center sc:gap-5 sc:bg-canvas sc:p-6",
|
|
3066
|
+
children: [
|
|
3067
|
+
/* @__PURE__ */ w("span", {
|
|
3068
|
+
"aria-hidden": "true",
|
|
3069
|
+
className: "sc:h-[34px] sc:w-[76px] sc:-rotate-3 sc:rounded-b-[100%] sc:border-b-[8px] sc:border-pink"
|
|
3070
|
+
}),
|
|
3071
|
+
/* @__PURE__ */ w("span", {
|
|
3072
|
+
className: "sc:text-lg sc:font-bold sc:text-question-fg",
|
|
3073
|
+
children: e
|
|
3074
|
+
}),
|
|
3075
|
+
/* @__PURE__ */ T("div", {
|
|
3076
|
+
className: "sc:flex sc:gap-1.5",
|
|
3077
|
+
"aria-hidden": "true",
|
|
3078
|
+
children: [
|
|
3079
|
+
/* @__PURE__ */ w("span", { className: ea }),
|
|
3080
|
+
/* @__PURE__ */ w("span", { className: `${ea} sc:[animation-delay:.15s]` }),
|
|
3081
|
+
/* @__PURE__ */ w("span", { className: `${ea} sc:[animation-delay:.3s]` })
|
|
3082
|
+
]
|
|
3083
|
+
})
|
|
3084
|
+
]
|
|
3085
|
+
}), na = ({ value: e, max: t, label: n }) => {
|
|
3086
|
+
if (t <= 0) return null;
|
|
3087
|
+
let r = Math.min(100, Math.round(e / t * 100));
|
|
3088
|
+
return /* @__PURE__ */ w("div", {
|
|
3089
|
+
role: "progressbar",
|
|
3090
|
+
"aria-label": n,
|
|
3091
|
+
"aria-valuemin": 0,
|
|
3092
|
+
"aria-valuemax": t,
|
|
3093
|
+
"aria-valuenow": Math.min(e, t),
|
|
3094
|
+
className: "sc:h-[3px] sc:w-full sc:bg-[#f1f1f1]",
|
|
3095
|
+
children: /* @__PURE__ */ w("div", {
|
|
3096
|
+
className: "sc:h-full sc:rounded-r-[3px] sc:bg-pink-strong sc:transition-[width] sc:duration-500 sc:ease-out",
|
|
3097
|
+
style: { width: `${r}%` }
|
|
3098
|
+
})
|
|
3099
|
+
});
|
|
3100
|
+
}, ra = ({ copyLabel: e, copiedLabel: t, className: n = "" }) => {
|
|
3101
|
+
let [r, i] = y(!1), a = v(void 0);
|
|
3102
|
+
return /* @__PURE__ */ w("button", {
|
|
3103
|
+
type: "button",
|
|
3104
|
+
onClick: () => {
|
|
3105
|
+
try {
|
|
3106
|
+
var e;
|
|
3107
|
+
(e = navigator.clipboard) == null || e.writeText(window.location.href);
|
|
3108
|
+
} catch {}
|
|
3109
|
+
i(!0), clearTimeout(a.current), a.current = setTimeout(() => i(!1), 2e3);
|
|
3110
|
+
},
|
|
3111
|
+
className: `sc:cursor-pointer sc:transition-colors ${n}`,
|
|
3112
|
+
children: r ? t : e
|
|
3113
|
+
});
|
|
3114
|
+
}, ia = ({ labels: e, logoUrl: t, logoAlt: n, onNext: r }) => /* @__PURE__ */ w("div", {
|
|
3115
|
+
className: "sc:flex sc:min-h-full sc:flex-1 sc:flex-col sc:items-center sc:justify-center sc:bg-canvas sc:px-6 sc:py-10",
|
|
3116
|
+
children: /* @__PURE__ */ T("div", {
|
|
3117
|
+
className: "sc:flex sc:w-full sc:max-w-[520px] sc:flex-col sc:items-center sc:text-center",
|
|
3118
|
+
children: [
|
|
3119
|
+
t ? /* @__PURE__ */ w("img", {
|
|
3120
|
+
src: t,
|
|
3121
|
+
alt: n == null ? "" : n,
|
|
3122
|
+
className: "sc:h-7 sc:w-auto"
|
|
3123
|
+
}) : null,
|
|
3124
|
+
/* @__PURE__ */ T("div", {
|
|
3125
|
+
className: "sc:mt-7 sc:flex sc:items-center sc:gap-2.5",
|
|
3126
|
+
children: [/* @__PURE__ */ w("span", {
|
|
3127
|
+
"aria-hidden": "true",
|
|
3128
|
+
className: "sc:h-2.5 sc:w-7 sc:-rotate-3 sc:rounded-b-[100%] sc:border-b-[5px] sc:border-pink-strong"
|
|
3129
|
+
}), /* @__PURE__ */ w("span", {
|
|
3130
|
+
className: "sc:text-[12px] sc:font-bold sc:tracking-[0.18em] sc:text-muted sc:uppercase",
|
|
3131
|
+
children: e.eyebrow
|
|
3132
|
+
})]
|
|
3133
|
+
}),
|
|
3134
|
+
/* @__PURE__ */ w("h1", {
|
|
3135
|
+
className: "sc:mt-4 sc:text-[38px]/[1.06] sc:font-extrabold sc:tracking-tight sc:text-question-fg",
|
|
3136
|
+
children: e.greeting
|
|
3137
|
+
}),
|
|
3138
|
+
/* @__PURE__ */ w("p", {
|
|
3139
|
+
className: "sc:mt-4 sc:text-base/relaxed sc:text-[#37333d] sc:[text-wrap:pretty]",
|
|
3140
|
+
children: e.intro
|
|
3141
|
+
}),
|
|
3142
|
+
/* @__PURE__ */ w(U, {
|
|
3143
|
+
onClick: r,
|
|
3144
|
+
className: "sc:mt-7 sc:h-14 sc:w-full sc:text-[17px]",
|
|
3145
|
+
children: e.next
|
|
3146
|
+
}),
|
|
3147
|
+
/* @__PURE__ */ w(ra, {
|
|
3148
|
+
copyLabel: e.copyLinkResume,
|
|
3149
|
+
copiedLabel: e.copied,
|
|
3150
|
+
className: "sc:mt-3.5 sc:text-[13px] sc:font-bold sc:text-muted sc:hover:text-question-fg"
|
|
3151
|
+
})
|
|
3152
|
+
]
|
|
3153
|
+
})
|
|
3154
|
+
}), aa = "sapia-chatbot", oa = ({ children: e, themeVariables: t, dir: n = "ltr" }) => /* @__PURE__ */ w("div", {
|
|
3155
|
+
className: `${aa} sc:flex sc:h-full sc:flex-col`,
|
|
3156
|
+
dir: n,
|
|
3157
|
+
style: t,
|
|
3158
|
+
children: e
|
|
3159
|
+
}), sa = {
|
|
3160
|
+
"ap-southeast-2": "AU",
|
|
3161
|
+
"eu-west-1": "GB",
|
|
3162
|
+
"us-east-1": "US"
|
|
3163
|
+
}, ca = 127397, la = (e) => String.fromCodePoint(...e.toUpperCase().split("").map((e) => e.charCodeAt(0) + ca)), ua = async (e = "en") => {
|
|
3164
|
+
let { getCountries: t, getCountryCallingCode: n } = await import("./max-Btet1snX.js"), r = new Intl.DisplayNames([e], { type: "region" });
|
|
3165
|
+
return t().map((e) => {
|
|
3166
|
+
var t;
|
|
3167
|
+
return {
|
|
3168
|
+
code: e,
|
|
3169
|
+
callingCode: n(e),
|
|
3170
|
+
name: (t = r.of(e)) == null ? e : t,
|
|
3171
|
+
flag: la(e)
|
|
3172
|
+
};
|
|
3173
|
+
}).sort((e, t) => e.name.localeCompare(t.name));
|
|
3174
|
+
}, da = ({ candidateCountryCode: e, region: t }) => {
|
|
3175
|
+
var n, r;
|
|
3176
|
+
return (n = (r = e == null ? void 0 : e.toUpperCase()) == null ? t ? sa[t] : void 0 : r) == null ? "AU" : n;
|
|
3177
|
+
}, fa = ({ countries: e, defaultCountryCode: t, disabled: n = !1, countryLabel: r, inputLabel: i, placeholder: a, sendLabel: o, onSubmit: s }) => {
|
|
3178
|
+
let [c, l] = y(t), [u, d] = y(""), f = !n && u.trim().length > 0, p = () => {
|
|
3179
|
+
f && s(u.trim(), c);
|
|
3180
|
+
};
|
|
3181
|
+
return /* @__PURE__ */ w("div", {
|
|
3182
|
+
className: "sc:border-t sc:border-black/10 sc:p-3",
|
|
3183
|
+
children: /* @__PURE__ */ T("div", {
|
|
3184
|
+
className: "sc:flex sc:items-center sc:gap-2",
|
|
3185
|
+
children: [
|
|
3186
|
+
/* @__PURE__ */ w("select", {
|
|
3187
|
+
value: c,
|
|
3188
|
+
onChange: (e) => l(e.target.value),
|
|
3189
|
+
disabled: n,
|
|
3190
|
+
"aria-label": r,
|
|
3191
|
+
className: "sc:max-w-36 sc:rounded-md sc:border sc:border-black/20 sc:px-2 sc:py-2 sc:text-sm sc:disabled:opacity-50",
|
|
3192
|
+
children: e.map((e) => /* @__PURE__ */ T("option", {
|
|
3193
|
+
value: e.code,
|
|
3194
|
+
children: [
|
|
3195
|
+
e.flag,
|
|
3196
|
+
" ",
|
|
3197
|
+
e.name,
|
|
3198
|
+
" +",
|
|
3199
|
+
e.callingCode
|
|
3200
|
+
]
|
|
3201
|
+
}, e.code))
|
|
3202
|
+
}),
|
|
3203
|
+
/* @__PURE__ */ w("input", {
|
|
3204
|
+
type: "tel",
|
|
3205
|
+
inputMode: "tel",
|
|
3206
|
+
value: u,
|
|
3207
|
+
onChange: (e) => d(e.target.value),
|
|
3208
|
+
onKeyDown: (e) => {
|
|
3209
|
+
e.key === "Enter" && (e.preventDefault(), p());
|
|
3210
|
+
},
|
|
3211
|
+
disabled: n,
|
|
3212
|
+
placeholder: a,
|
|
3213
|
+
"aria-label": i,
|
|
3214
|
+
className: "sc:flex-1 sc:rounded-md sc:border sc:border-black/20 sc:px-3 sc:py-2 sc:text-sm sc:focus-visible:outline-2 sc:focus-visible:outline-offset-1 sc:disabled:opacity-50"
|
|
3215
|
+
}),
|
|
3216
|
+
/* @__PURE__ */ w(U, {
|
|
3217
|
+
onClick: p,
|
|
3218
|
+
disabled: !f,
|
|
3219
|
+
"aria-label": o,
|
|
3220
|
+
children: o
|
|
3221
|
+
})
|
|
3222
|
+
]
|
|
3223
|
+
})
|
|
3224
|
+
});
|
|
3225
|
+
}, pa = (e) => {
|
|
3226
|
+
var t, n;
|
|
3227
|
+
return (t = (n = e == null ? void 0 : e.innerText) == null ? e == null ? void 0 : e.textContent : n) == null ? "" : t;
|
|
3228
|
+
}, ma = (e) => {
|
|
3229
|
+
try {
|
|
3230
|
+
return document.queryCommandState(e);
|
|
3231
|
+
} catch {
|
|
3232
|
+
return !1;
|
|
3233
|
+
}
|
|
3234
|
+
}, ha = ({ onSubmit: e, disabled: t = !1, minLength: n, maxLength: r, recommendedLength: i, placeholder: a, sendLabel: o, minLengthHint: s, okHint: c, footer: l, inputLabel: u, richText: d = !1, toolbarLabels: f, onPaste: p }) => {
|
|
3235
|
+
let [m, g] = y(""), [_, b] = y({
|
|
3236
|
+
bold: !1,
|
|
3237
|
+
italic: !1,
|
|
3238
|
+
underline: !1,
|
|
3239
|
+
ul: !1,
|
|
3240
|
+
ol: !1
|
|
3241
|
+
}), x = v(null), S = v(null), C = h(), E = m.trim().length, D = n !== void 0 && E < n, O = !t && E > 0 && !D, k = (e) => {
|
|
3242
|
+
g(r === void 0 ? e.target.value : e.target.value.slice(0, r));
|
|
3243
|
+
let t = e.target;
|
|
3244
|
+
t.style.height = "auto", t.style.height = `${t.scrollHeight}px`;
|
|
3245
|
+
}, A = () => {
|
|
3246
|
+
g(pa(S.current)), b({
|
|
3247
|
+
bold: ma("bold"),
|
|
3248
|
+
italic: ma("italic"),
|
|
3249
|
+
underline: ma("underline"),
|
|
3250
|
+
ul: ma("insertUnorderedList"),
|
|
3251
|
+
ol: ma("insertOrderedList")
|
|
3252
|
+
});
|
|
3253
|
+
}, j = (e) => (t) => {
|
|
3254
|
+
var n;
|
|
3255
|
+
t.preventDefault(), (n = S.current) == null || n.focus();
|
|
3256
|
+
try {
|
|
3257
|
+
document.execCommand(e);
|
|
3258
|
+
} catch {}
|
|
3259
|
+
A();
|
|
3260
|
+
}, M = () => {
|
|
3261
|
+
if (O) {
|
|
3262
|
+
if (d && S.current) {
|
|
3263
|
+
let t = bt(S.current.innerHTML);
|
|
3264
|
+
e(m.trim(), t), S.current.innerHTML = "";
|
|
3265
|
+
} else e(m.trim()), x.current && (x.current.style.height = "auto");
|
|
3266
|
+
g("");
|
|
3267
|
+
}
|
|
3268
|
+
}, N = (e) => {
|
|
3269
|
+
e.key === "Enter" && (e.metaKey || e.ctrlKey) && (e.preventDefault(), M());
|
|
3270
|
+
}, P = r !== void 0 || i !== void 0, ee = r == null ? i : r, F = E > 0, I = D && F ? s == null ? "" : s : F ? c == null ? "" : c : "";
|
|
3271
|
+
if (P) {
|
|
3272
|
+
let e = `${E}${ee === void 0 ? "" : ` / ${ee}`}`;
|
|
3273
|
+
I = I ? `${I} · ${e}` : e;
|
|
3274
|
+
}
|
|
3275
|
+
let L = D && F, te = D ? "sc:text-muted" : "sc:text-ok", ne = d && f, R = (e, t, n, r, i = "") => /* @__PURE__ */ w("button", {
|
|
3276
|
+
type: "button",
|
|
3277
|
+
"aria-label": e,
|
|
3278
|
+
"aria-pressed": t,
|
|
3279
|
+
title: e,
|
|
3280
|
+
onMouseDown: j(n),
|
|
3281
|
+
className: `sc:h-[34px] sc:rounded-[9px] sc:px-2.5 sc:text-[15px] sc:font-bold sc:text-question-fg sc:hover:bg-pink-tint ${t ? "sc:bg-pink-tint" : ""} ${i}`,
|
|
3282
|
+
children: r
|
|
3283
|
+
});
|
|
3284
|
+
return /* @__PURE__ */ w("div", {
|
|
3285
|
+
className: "sc:flex-shrink-0 sc:bg-canvas sc:px-4 sc:pt-2 sc:pb-3.5",
|
|
3286
|
+
children: /* @__PURE__ */ T("div", {
|
|
3287
|
+
className: "sc:mx-auto sc:max-w-[640px]",
|
|
3288
|
+
children: [/* @__PURE__ */ T("div", {
|
|
3289
|
+
className: "sc:rounded-[14px] sc:border-[1.5px] sc:border-[#dedee6] sc:bg-white sc:px-[14px] sc:py-2",
|
|
3290
|
+
children: [ne ? /* @__PURE__ */ T("div", {
|
|
3291
|
+
role: "toolbar",
|
|
3292
|
+
"aria-label": f.toolbar,
|
|
3293
|
+
className: "sc:mb-1 sc:flex sc:items-center sc:gap-0.5 sc:border-b sc:border-[#f1f1f1] sc:pb-2",
|
|
3294
|
+
children: [
|
|
3295
|
+
R(f.bold, _.bold, "bold", "B", "sc:w-[34px]"),
|
|
3296
|
+
R(f.italic, _.italic, "italic", "I", "sc:w-[34px] sc:italic"),
|
|
3297
|
+
R(f.underline, _.underline, "underline", "U", "sc:w-[34px] sc:underline"),
|
|
3298
|
+
/* @__PURE__ */ w("span", { className: "sc:mx-1.5 sc:h-5 sc:w-px sc:bg-line" }),
|
|
3299
|
+
R(f.bulletList, _.ul, "insertUnorderedList", "• List"),
|
|
3300
|
+
R(f.numberList, _.ol, "insertOrderedList", "1. List")
|
|
3301
|
+
]
|
|
3302
|
+
}) : null, /* @__PURE__ */ T("div", {
|
|
3303
|
+
className: "sc:flex sc:items-end sc:gap-2",
|
|
3304
|
+
children: [ne ? /* @__PURE__ */ T("div", {
|
|
3305
|
+
className: "sc:relative sc:flex-1",
|
|
3306
|
+
children: [/* @__PURE__ */ w("div", {
|
|
3307
|
+
ref: S,
|
|
3308
|
+
role: "textbox",
|
|
3309
|
+
"aria-multiline": "true",
|
|
3310
|
+
"aria-label": u,
|
|
3311
|
+
"aria-describedby": I ? C : void 0,
|
|
3312
|
+
tabIndex: t ? -1 : 0,
|
|
3313
|
+
contentEditable: !t,
|
|
3314
|
+
suppressContentEditableWarning: !0,
|
|
3315
|
+
onInput: A,
|
|
3316
|
+
onKeyUp: A,
|
|
3317
|
+
onMouseUp: A,
|
|
3318
|
+
onKeyDown: N,
|
|
3319
|
+
onPaste: p,
|
|
3320
|
+
className: "sc:max-h-[200px] sc:min-h-[44px] sc:overflow-y-auto sc:px-1 sc:py-2 sc:text-base/relaxed sc:text-question-fg sc:outline-none"
|
|
3321
|
+
}), F ? null : /* @__PURE__ */ w("span", {
|
|
3322
|
+
className: "sc:pointer-events-none sc:absolute sc:top-2 sc:left-1 sc:text-base sc:text-[#b9b3c2]",
|
|
3323
|
+
children: a
|
|
3324
|
+
})]
|
|
3325
|
+
}) : /* @__PURE__ */ w("textarea", {
|
|
3326
|
+
ref: x,
|
|
3327
|
+
value: m,
|
|
3328
|
+
onChange: k,
|
|
3329
|
+
onKeyDown: N,
|
|
3330
|
+
onPaste: p,
|
|
3331
|
+
disabled: t,
|
|
3332
|
+
placeholder: a,
|
|
3333
|
+
"aria-label": u,
|
|
3334
|
+
"aria-describedby": I ? C : void 0,
|
|
3335
|
+
rows: 1,
|
|
3336
|
+
className: "sc:max-h-[200px] sc:min-h-[44px] sc:flex-1 sc:resize-none sc:overflow-y-auto sc:bg-transparent sc:px-1 sc:py-2 sc:text-base/relaxed sc:text-question-fg sc:outline-none sc:placeholder:text-[#b9b3c2] sc:disabled:opacity-50"
|
|
3337
|
+
}), /* @__PURE__ */ w(U, {
|
|
3338
|
+
onClick: M,
|
|
3339
|
+
disabled: !O,
|
|
3340
|
+
"aria-label": o,
|
|
3341
|
+
className: "sc:rounded-[10px] sc:px-5",
|
|
3342
|
+
children: o
|
|
3343
|
+
})]
|
|
3344
|
+
})]
|
|
3345
|
+
}), /* @__PURE__ */ T("div", {
|
|
3346
|
+
className: "sc:mt-1.5 sc:flex sc:items-center sc:justify-between sc:gap-3 sc:px-1",
|
|
3347
|
+
children: [/* @__PURE__ */ w("span", {
|
|
3348
|
+
id: C,
|
|
3349
|
+
role: L ? "status" : void 0,
|
|
3350
|
+
className: `sc:text-[13px] sc:font-semibold sc:tabular-nums ${te}`,
|
|
3351
|
+
children: I
|
|
3352
|
+
}), l ? /* @__PURE__ */ w("span", {
|
|
3353
|
+
className: "sc:text-xs sc:text-muted",
|
|
3354
|
+
children: l
|
|
3355
|
+
}) : null]
|
|
3356
|
+
})]
|
|
3357
|
+
})
|
|
3358
|
+
});
|
|
3359
|
+
}, ga = (e) => `${Math.floor(e / 60)}:${(e % 60).toString().padStart(2, "0")}`, _a = ({ label: e, on: t, onLabel: n, offLabel: r, onToggle: i, disabled: a }) => /* @__PURE__ */ T("div", {
|
|
3360
|
+
className: "sc:flex sc:items-center sc:justify-between sc:py-2.5",
|
|
3361
|
+
children: [/* @__PURE__ */ w("span", {
|
|
3362
|
+
className: "sc:text-sm sc:font-semibold sc:text-[#37333d]",
|
|
3363
|
+
children: e
|
|
3364
|
+
}), /* @__PURE__ */ T("button", {
|
|
3365
|
+
type: "button",
|
|
3366
|
+
role: "switch",
|
|
3367
|
+
"aria-checked": t,
|
|
3368
|
+
"aria-label": e,
|
|
3369
|
+
disabled: a,
|
|
3370
|
+
onClick: i,
|
|
3371
|
+
className: "sc:flex sc:items-center sc:gap-2",
|
|
3372
|
+
children: [/* @__PURE__ */ w("span", {
|
|
3373
|
+
className: `sc:text-[13px] sc:font-bold ${t ? "sc:text-ok" : "sc:text-muted"}`,
|
|
3374
|
+
children: t ? n : r
|
|
3375
|
+
}), /* @__PURE__ */ w("span", {
|
|
3376
|
+
className: `sc:relative sc:inline-block sc:h-[26px] sc:w-[44px] sc:rounded-full sc:transition-colors ${t ? "sc:bg-button" : "sc:bg-[#d9d2e0]"}`,
|
|
3377
|
+
children: /* @__PURE__ */ w("span", { className: `sc:absolute sc:top-[3px] sc:size-5 sc:rounded-full sc:bg-white sc:shadow sc:transition-all ${t ? "sc:left-[21px]" : "sc:left-[3px]"}` })
|
|
3378
|
+
})]
|
|
3379
|
+
})]
|
|
3380
|
+
}), va = ({ phase: e, elapsedSeconds: t, maxSeconds: n, hasResult: r, showPreview: i, videoRef: a, disabled: o = !1, labels: s, onOpenCamera: c, onBeginCountdown: l, onStartRecording: u, onStopRecording: d, onReRecord: f, onSubmit: p, camOn: m = !0, micOn: h = !0, onToggleCamera: g, onToggleMicrophone: _, countdown: v, attemptsLabel: y, canRetake: b = !0, reviewUrl: x }) => {
|
|
3381
|
+
var S, E, D, O, k, A;
|
|
3382
|
+
let j = i && (e === "preview" || e === "recording"), M = v != null && v > 0, N = n > 0 ? Math.min(100, Math.round(t / n * 100)) : 0, P = (S = l == null ? u : l) == null ? (() => {}) : S;
|
|
3383
|
+
return /* @__PURE__ */ w("div", {
|
|
3384
|
+
className: "sc:mt-3.5 sc:flex sc:flex-col sc:gap-3",
|
|
3385
|
+
children: /* @__PURE__ */ T("div", {
|
|
3386
|
+
className: "sc:flex sc:w-full sc:flex-col sc:gap-3",
|
|
3387
|
+
children: [
|
|
3388
|
+
e === "error" ? /* @__PURE__ */ w("p", {
|
|
3389
|
+
role: "alert",
|
|
3390
|
+
className: "sc:text-sm sc:text-red-600",
|
|
3391
|
+
children: s.cameraError
|
|
3392
|
+
}) : null,
|
|
3393
|
+
j ? /* @__PURE__ */ T("div", {
|
|
3394
|
+
className: "sc:relative sc:aspect-[4/3] sc:max-h-[420px] sc:overflow-hidden sc:rounded-[20px] sc:bg-ink-strong",
|
|
3395
|
+
children: [
|
|
3396
|
+
/* @__PURE__ */ w("video", {
|
|
3397
|
+
ref: a,
|
|
3398
|
+
autoPlay: !0,
|
|
3399
|
+
muted: !0,
|
|
3400
|
+
playsInline: !0,
|
|
3401
|
+
"aria-label": s.preview,
|
|
3402
|
+
className: "sc:absolute sc:inset-0 sc:size-full sc:-scale-x-100 sc:object-cover"
|
|
3403
|
+
}),
|
|
3404
|
+
!m && s.cameraOff ? /* @__PURE__ */ w("div", {
|
|
3405
|
+
className: "sc:absolute sc:inset-0 sc:flex sc:items-center sc:justify-center sc:bg-ink-strong sc:text-sm sc:font-semibold sc:text-white/60",
|
|
3406
|
+
children: s.cameraOff
|
|
3407
|
+
}) : null,
|
|
3408
|
+
M ? /* @__PURE__ */ w("div", {
|
|
3409
|
+
className: "sc:absolute sc:inset-0 sc:flex sc:items-center sc:justify-center sc:bg-ink-strong/45",
|
|
3410
|
+
children: /* @__PURE__ */ w("span", {
|
|
3411
|
+
className: "sc:text-[100px] sc:font-extrabold sc:text-pink",
|
|
3412
|
+
children: v
|
|
3413
|
+
})
|
|
3414
|
+
}) : null,
|
|
3415
|
+
e === "recording" ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T("div", {
|
|
3416
|
+
className: "sc:absolute sc:top-3.5 sc:left-3.5 sc:flex sc:items-center sc:gap-2 sc:rounded-full sc:bg-black/45 sc:px-3 sc:py-1.5",
|
|
3417
|
+
children: [/* @__PURE__ */ w("span", { className: "sc:size-2.5 sc:rounded-full sc:bg-[#ff5a5a] sc:[animation:sc-rec-pulse_1.1s_infinite]" }), /* @__PURE__ */ T("span", {
|
|
3418
|
+
role: "timer",
|
|
3419
|
+
"aria-live": "off",
|
|
3420
|
+
className: "sc:text-[13px] sc:font-bold sc:text-white sc:tabular-nums",
|
|
3421
|
+
children: [
|
|
3422
|
+
ga(t),
|
|
3423
|
+
" / ",
|
|
3424
|
+
ga(n)
|
|
3425
|
+
]
|
|
3426
|
+
})]
|
|
3427
|
+
}), /* @__PURE__ */ w("div", {
|
|
3428
|
+
className: "sc:absolute sc:inset-x-0 sc:bottom-0 sc:h-1.5 sc:bg-white/15",
|
|
3429
|
+
children: /* @__PURE__ */ w("div", {
|
|
3430
|
+
className: "sc:h-full sc:bg-pink-strong",
|
|
3431
|
+
style: { width: `${N}%` }
|
|
3432
|
+
})
|
|
3433
|
+
})] }) : null
|
|
3434
|
+
]
|
|
3435
|
+
}) : null,
|
|
3436
|
+
e === "review" && x ? /* @__PURE__ */ w("video", {
|
|
3437
|
+
src: x,
|
|
3438
|
+
controls: !0,
|
|
3439
|
+
playsInline: !0,
|
|
3440
|
+
"aria-label": s.preview,
|
|
3441
|
+
className: "sc:aspect-[4/3] sc:max-h-[420px] sc:w-full sc:rounded-[20px] sc:bg-ink-strong sc:object-cover"
|
|
3442
|
+
}) : null,
|
|
3443
|
+
e === "preview" && s.camera && g && _ ? /* @__PURE__ */ T("div", {
|
|
3444
|
+
className: "sc:rounded-2xl sc:bg-[#f5f4f7] sc:px-4 sc:py-1",
|
|
3445
|
+
children: [
|
|
3446
|
+
/* @__PURE__ */ w(_a, {
|
|
3447
|
+
label: s.camera,
|
|
3448
|
+
on: m,
|
|
3449
|
+
onLabel: (E = s.on) == null ? "On" : E,
|
|
3450
|
+
offLabel: (D = s.off) == null ? "Off" : D,
|
|
3451
|
+
onToggle: g,
|
|
3452
|
+
disabled: o
|
|
3453
|
+
}),
|
|
3454
|
+
/* @__PURE__ */ w("div", { className: "sc:h-px sc:bg-line" }),
|
|
3455
|
+
/* @__PURE__ */ w(_a, {
|
|
3456
|
+
label: (O = s.microphone) == null ? "Microphone" : O,
|
|
3457
|
+
on: h,
|
|
3458
|
+
onLabel: (k = s.on) == null ? "On" : k,
|
|
3459
|
+
offLabel: (A = s.off) == null ? "Off" : A,
|
|
3460
|
+
onToggle: _,
|
|
3461
|
+
disabled: o
|
|
3462
|
+
})
|
|
3463
|
+
]
|
|
3464
|
+
}) : null,
|
|
3465
|
+
e === "idle" || e === "error" ? /* @__PURE__ */ w(U, {
|
|
3466
|
+
disabled: o,
|
|
3467
|
+
onClick: c,
|
|
3468
|
+
children: s.openCamera
|
|
3469
|
+
}) : null,
|
|
3470
|
+
e === "preview" ? /* @__PURE__ */ T("div", {
|
|
3471
|
+
className: "sc:flex sc:items-center sc:gap-3",
|
|
3472
|
+
children: [/* @__PURE__ */ w(U, {
|
|
3473
|
+
disabled: o || M,
|
|
3474
|
+
onClick: P,
|
|
3475
|
+
className: "sc:flex-1",
|
|
3476
|
+
children: s.startRecording
|
|
3477
|
+
}), y ? /* @__PURE__ */ w("span", {
|
|
3478
|
+
className: "sc:flex-shrink-0 sc:text-[13px] sc:font-bold sc:text-muted sc:tabular-nums",
|
|
3479
|
+
children: y
|
|
3480
|
+
}) : null]
|
|
3481
|
+
}) : null,
|
|
3482
|
+
e === "recording" ? /* @__PURE__ */ T("div", {
|
|
3483
|
+
className: "sc:flex sc:flex-col sc:items-center sc:gap-1.5",
|
|
3484
|
+
children: [/* @__PURE__ */ w("button", {
|
|
3485
|
+
type: "button",
|
|
3486
|
+
disabled: o,
|
|
3487
|
+
onClick: d,
|
|
3488
|
+
"aria-label": s.stopRecording,
|
|
3489
|
+
className: "sc:flex sc:size-16 sc:items-center sc:justify-center sc:rounded-full sc:border-[3px] sc:border-button sc:bg-white sc:hover:bg-pink-tint",
|
|
3490
|
+
children: /* @__PURE__ */ w("span", { className: "sc:size-5 sc:rounded-md sc:bg-[#e5484d]" })
|
|
3491
|
+
}), s.finishHint ? /* @__PURE__ */ w("span", {
|
|
3492
|
+
className: "sc:text-[13px] sc:font-semibold sc:text-muted",
|
|
3493
|
+
children: s.finishHint
|
|
3494
|
+
}) : null]
|
|
3495
|
+
}) : null,
|
|
3496
|
+
e === "review" ? /* @__PURE__ */ T("div", {
|
|
3497
|
+
className: "sc:flex sc:flex-col sc:gap-2.5",
|
|
3498
|
+
children: [/* @__PURE__ */ T("div", {
|
|
3499
|
+
className: "sc:flex sc:gap-2.5",
|
|
3500
|
+
children: [/* @__PURE__ */ w(U, {
|
|
3501
|
+
disabled: o || !r,
|
|
3502
|
+
onClick: p,
|
|
3503
|
+
className: "sc:flex-[1.2]",
|
|
3504
|
+
children: s.submit
|
|
3505
|
+
}), b ? /* @__PURE__ */ w(U, {
|
|
3506
|
+
variant: "ghost",
|
|
3507
|
+
disabled: o,
|
|
3508
|
+
onClick: f,
|
|
3509
|
+
className: "sc:flex-1",
|
|
3510
|
+
children: s.reRecord
|
|
3511
|
+
}) : null]
|
|
3512
|
+
}), y ? /* @__PURE__ */ w("p", {
|
|
3513
|
+
className: "sc:text-center sc:text-[12.5px] sc:font-semibold sc:text-muted sc:tabular-nums",
|
|
3514
|
+
children: y
|
|
3515
|
+
}) : null]
|
|
3516
|
+
}) : null
|
|
3517
|
+
]
|
|
3518
|
+
})
|
|
3519
|
+
});
|
|
3520
|
+
}, ya = [
|
|
3521
|
+
"video/webm;codecs=vp8,opus",
|
|
3522
|
+
"video/webm;codecs=vp9,opus",
|
|
3523
|
+
"video/webm",
|
|
3524
|
+
"video/mp4"
|
|
3525
|
+
], ba = [
|
|
3526
|
+
"audio/webm;codecs=opus",
|
|
3527
|
+
"audio/webm",
|
|
3528
|
+
"audio/mp4"
|
|
3529
|
+
], xa = (e, t) => e.find((e) => t(e)), Sa = (e) => e && e.includes("mp4") ? "mp4" : "webm", Ca = (e) => Sa(e) === "webm", wa = 4e5, Ta = 64e3, Ea = async (e, t) => {
|
|
3530
|
+
var n;
|
|
3531
|
+
let r = await import("./fix-webm-duration-BW9Fbdzt.js").then((e) => /* @__PURE__ */ ee(e.default, 1));
|
|
3532
|
+
return ((n = r.default) == null ? r : n)(e, t);
|
|
3533
|
+
}, Da = class {
|
|
3534
|
+
constructor(e) {
|
|
3535
|
+
var t, n, r;
|
|
3536
|
+
this.deps = e, this.state = {
|
|
3537
|
+
phase: "idle",
|
|
3538
|
+
elapsedSeconds: 0
|
|
3539
|
+
}, this.chunks = [], this.startedAt = 0, this.media = (t = e.media) == null ? "video" : t, this.now = (n = e.now) == null ? (() => Date.now()) : n, this.fixWebmDuration = (r = e.fixWebmDuration) == null ? Ea : r;
|
|
3540
|
+
}
|
|
3541
|
+
getState() {
|
|
3542
|
+
return this.state;
|
|
3543
|
+
}
|
|
3544
|
+
getStream() {
|
|
3545
|
+
return this.stream;
|
|
3546
|
+
}
|
|
3547
|
+
async openCamera() {
|
|
3548
|
+
try {
|
|
3549
|
+
this.stream = await this.deps.getStream(this.media === "video" ? {
|
|
3550
|
+
video: !0,
|
|
3551
|
+
audio: !0
|
|
3552
|
+
} : { audio: !0 }), this.setState({
|
|
3553
|
+
phase: "preview",
|
|
3554
|
+
elapsedSeconds: 0,
|
|
3555
|
+
result: void 0,
|
|
3556
|
+
error: void 0
|
|
3557
|
+
});
|
|
3558
|
+
} catch (e) {
|
|
3559
|
+
this.setState({
|
|
3560
|
+
phase: "error",
|
|
3561
|
+
elapsedSeconds: 0,
|
|
3562
|
+
error: Oa(e)
|
|
3563
|
+
});
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3566
|
+
startRecording() {
|
|
3567
|
+
if (!this.stream || this.state.phase !== "preview") return;
|
|
3568
|
+
let e = this.media === "video" ? ya : ba;
|
|
3569
|
+
this.mimeType = xa(e, this.deps.isTypeSupported);
|
|
3570
|
+
let t = {
|
|
3571
|
+
videoBitsPerSecond: this.media === "video" ? wa : void 0,
|
|
3572
|
+
audioBitsPerSecond: Ta,
|
|
3573
|
+
...this.mimeType ? { mimeType: this.mimeType } : {}
|
|
3574
|
+
};
|
|
3575
|
+
this.chunks = [], this.recorder = this.deps.createRecorder(this.stream, t), this.recorder.ondataavailable = (e) => {
|
|
3576
|
+
e.data && e.data.size > 0 && this.chunks.push(e.data);
|
|
3577
|
+
}, this.recorder.onstop = () => void this.finalize(), this.recorder.start(1e3), this.startedAt = this.now(), this.setState({
|
|
3578
|
+
phase: "recording",
|
|
3579
|
+
elapsedSeconds: 0
|
|
3580
|
+
}), this.timer = setInterval(() => this.tick(), 1e3);
|
|
3581
|
+
}
|
|
3582
|
+
stopRecording() {
|
|
3583
|
+
this.state.phase !== "recording" || !this.recorder || (this.clearTimer(), this.recorder.stop());
|
|
3584
|
+
}
|
|
3585
|
+
reset() {
|
|
3586
|
+
this.clearTimer(), this.chunks = [], this.setState({
|
|
3587
|
+
phase: "preview",
|
|
3588
|
+
elapsedSeconds: 0,
|
|
3589
|
+
result: void 0,
|
|
3590
|
+
error: void 0
|
|
3591
|
+
});
|
|
3592
|
+
}
|
|
3593
|
+
dispose() {
|
|
3594
|
+
var e;
|
|
3595
|
+
this.clearTimer(), this.recorder = void 0, (e = this.stream) == null || e.getTracks().forEach((e) => e.stop()), this.stream = void 0;
|
|
3596
|
+
}
|
|
3597
|
+
tick() {
|
|
3598
|
+
let e = Math.floor((this.now() - this.startedAt) / 1e3);
|
|
3599
|
+
this.setState({
|
|
3600
|
+
...this.state,
|
|
3601
|
+
elapsedSeconds: e
|
|
3602
|
+
}), e >= this.deps.maxSeconds && this.stopRecording();
|
|
3603
|
+
}
|
|
3604
|
+
async finalize() {
|
|
3605
|
+
var e, t;
|
|
3606
|
+
let n = this.now() - this.startedAt, r = (e = this.mimeType) == null ? (t = this.chunks[0]) == null ? void 0 : t.type : e, i = new Blob(this.chunks, r ? { type: r } : void 0);
|
|
3607
|
+
if (Ca(r)) try {
|
|
3608
|
+
i = await this.fixWebmDuration(i, n);
|
|
3609
|
+
} catch {}
|
|
3610
|
+
this.setState({
|
|
3611
|
+
phase: "review",
|
|
3612
|
+
elapsedSeconds: Math.floor(n / 1e3),
|
|
3613
|
+
result: {
|
|
3614
|
+
blob: i,
|
|
3615
|
+
extension: Sa(r),
|
|
3616
|
+
durationSeconds: Math.floor(n / 1e3)
|
|
3617
|
+
}
|
|
3618
|
+
});
|
|
3619
|
+
}
|
|
3620
|
+
clearTimer() {
|
|
3621
|
+
this.timer && clearInterval(this.timer), this.timer = void 0;
|
|
3622
|
+
}
|
|
3623
|
+
setState(e) {
|
|
3624
|
+
var t, n;
|
|
3625
|
+
this.state = e, (t = (n = this.deps).onChange) == null || t.call(n, e);
|
|
3626
|
+
}
|
|
3627
|
+
}, Oa = (e) => e instanceof Error ? e.message : String(e), ka = (e, t = "video") => {
|
|
3628
|
+
let n = v(null), r = v(null), [i, a] = y({
|
|
3629
|
+
phase: "idle",
|
|
3630
|
+
elapsedSeconds: 0
|
|
3631
|
+
}), [o, s] = y(!0), [c, l] = y(!0), [u, d] = y(null), [f, h] = y(1), [g, _] = y(null);
|
|
3632
|
+
m(() => {
|
|
3633
|
+
let n = new Da({
|
|
3634
|
+
maxSeconds: e,
|
|
3635
|
+
media: t,
|
|
3636
|
+
getStream: (e) => navigator.mediaDevices.getUserMedia(e),
|
|
3637
|
+
createRecorder: (e, t) => new MediaRecorder(e, t),
|
|
3638
|
+
isTypeSupported: (e) => MediaRecorder.isTypeSupported(e),
|
|
3639
|
+
onChange: a
|
|
3640
|
+
});
|
|
3641
|
+
return r.current = n, () => n.dispose();
|
|
3642
|
+
}, [e, t]), m(() => {
|
|
3643
|
+
var e;
|
|
3644
|
+
let t = (e = r.current) == null ? void 0 : e.getStream();
|
|
3645
|
+
n.current && t && (i.phase === "preview" || i.phase === "recording") && (n.current.srcObject = t);
|
|
3646
|
+
}, [i.phase]), m(() => {
|
|
3647
|
+
var e;
|
|
3648
|
+
if (i.phase === "review" && (e = i.result) != null && e.blob) {
|
|
3649
|
+
let e = URL.createObjectURL(i.result.blob);
|
|
3650
|
+
return _(e), () => URL.revokeObjectURL(e);
|
|
3651
|
+
}
|
|
3652
|
+
_(null);
|
|
3653
|
+
}, [i.phase, i.result]), m(() => {
|
|
3654
|
+
if (u === null) return;
|
|
3655
|
+
if (u <= 0) {
|
|
3656
|
+
var e;
|
|
3657
|
+
d(null), (e = r.current) == null || e.startRecording();
|
|
3658
|
+
return;
|
|
3659
|
+
}
|
|
3660
|
+
let t = setTimeout(() => d((e) => (e == null ? 1 : e) - 1), 1e3);
|
|
3661
|
+
return () => clearTimeout(t);
|
|
3662
|
+
}, [u]);
|
|
3663
|
+
let b = p(() => {
|
|
3664
|
+
var e;
|
|
3665
|
+
let t = (e = r.current) == null ? void 0 : e.getStream();
|
|
3666
|
+
s((e) => {
|
|
3667
|
+
let n = !e;
|
|
3668
|
+
return t == null || t.getVideoTracks().forEach((e) => {
|
|
3669
|
+
e.enabled = n;
|
|
3670
|
+
}), n;
|
|
3671
|
+
});
|
|
3672
|
+
}, []), x = p(() => {
|
|
3673
|
+
var e;
|
|
3674
|
+
let t = (e = r.current) == null ? void 0 : e.getStream();
|
|
3675
|
+
l((e) => {
|
|
3676
|
+
let n = !e;
|
|
3677
|
+
return t == null || t.getAudioTracks().forEach((e) => {
|
|
3678
|
+
e.enabled = n;
|
|
3679
|
+
}), n;
|
|
3680
|
+
});
|
|
3681
|
+
}, []), S = p(() => {
|
|
3682
|
+
var e;
|
|
3683
|
+
h((e) => Math.min(e + 1, 5)), (e = r.current) == null || e.reset();
|
|
3684
|
+
}, []);
|
|
3685
|
+
return {
|
|
3686
|
+
state: i,
|
|
3687
|
+
videoRef: n,
|
|
3688
|
+
camOn: o,
|
|
3689
|
+
micOn: c,
|
|
3690
|
+
countdown: u,
|
|
3691
|
+
attempts: f,
|
|
3692
|
+
maxAttempts: 5,
|
|
3693
|
+
reviewUrl: g,
|
|
3694
|
+
openCamera: p(() => {
|
|
3695
|
+
var e;
|
|
3696
|
+
(e = r.current) == null || e.openCamera();
|
|
3697
|
+
}, []),
|
|
3698
|
+
beginCountdown: p(() => d(3), []),
|
|
3699
|
+
stopRecording: p(() => {
|
|
3700
|
+
var e;
|
|
3701
|
+
return (e = r.current) == null ? void 0 : e.stopRecording();
|
|
3702
|
+
}, []),
|
|
3703
|
+
reRecord: S,
|
|
3704
|
+
toggleCamera: b,
|
|
3705
|
+
toggleMicrophone: x
|
|
3706
|
+
};
|
|
3707
|
+
}, Aa = ({ engine: e, kind: t, disabled: n, textRules: r, strings: i, candidateCountryCode: a, region: o, maxVideoSeconds: s = 60, editing: c = !1, cancelEditLabel: l, onPaste: u }) => {
|
|
3708
|
+
let [d, f] = y(null), [p, h] = y(null), [g, _] = y([]);
|
|
3709
|
+
m(() => {
|
|
3710
|
+
if (t !== "phone") return;
|
|
3711
|
+
let e = !0;
|
|
3712
|
+
return ua().then((t) => {
|
|
3713
|
+
e && _(t);
|
|
3714
|
+
}), () => {
|
|
3715
|
+
e = !1;
|
|
3716
|
+
};
|
|
3717
|
+
}, [t]);
|
|
3718
|
+
let v = (e) => {
|
|
3719
|
+
e.status === "invalid" ? f(e.errorKey) : e.status === "confirm-name" && h({
|
|
3720
|
+
suggested: e.suggested,
|
|
3721
|
+
original: e.original
|
|
3722
|
+
});
|
|
3723
|
+
}, b = c && l ? /* @__PURE__ */ w("div", {
|
|
3724
|
+
className: "sc:flex sc:justify-end sc:px-3 sc:pt-2",
|
|
3725
|
+
children: /* @__PURE__ */ w("button", {
|
|
3726
|
+
type: "button",
|
|
3727
|
+
onClick: () => e.cancelEditMode(),
|
|
3728
|
+
className: "sc:text-xs sc:font-medium sc:text-black/60 sc:underline sc:cursor-pointer",
|
|
3729
|
+
children: l
|
|
3730
|
+
})
|
|
3731
|
+
}) : null;
|
|
3732
|
+
if (t === "video") return /* @__PURE__ */ T(C, { children: [b, /* @__PURE__ */ w(ja, {
|
|
3733
|
+
engine: e,
|
|
3734
|
+
maxSeconds: s,
|
|
3735
|
+
disabled: n,
|
|
3736
|
+
strings: i
|
|
3737
|
+
})] });
|
|
3738
|
+
if (t === "phone") return /* @__PURE__ */ T(C, { children: [
|
|
3739
|
+
b,
|
|
3740
|
+
/* @__PURE__ */ w(fa, {
|
|
3741
|
+
countries: g,
|
|
3742
|
+
defaultCountryCode: da({
|
|
3743
|
+
candidateCountryCode: a,
|
|
3744
|
+
region: o
|
|
3745
|
+
}),
|
|
3746
|
+
disabled: n || g.length === 0,
|
|
3747
|
+
countryLabel: i.phoneCountryLabel,
|
|
3748
|
+
inputLabel: i.phoneInputLabel,
|
|
3749
|
+
placeholder: i.phonePlaceholder,
|
|
3750
|
+
sendLabel: i.sendLabel,
|
|
3751
|
+
onSubmit: (t, n) => void e.submitPhoneAnswer(t, n).then(v)
|
|
3752
|
+
}),
|
|
3753
|
+
/* @__PURE__ */ w(Ma, {
|
|
3754
|
+
errorKey: d,
|
|
3755
|
+
strings: i,
|
|
3756
|
+
onClose: () => f(null)
|
|
3757
|
+
})
|
|
3758
|
+
] });
|
|
3759
|
+
let x = t === "email" ? (t) => void e.submitEmailAnswer(t).then(v) : t === "name" ? (t) => void e.submitNameAnswer(t).then(v) : (t, n) => void e.submitTextAnswer(t, n), S = t === "text";
|
|
3760
|
+
return /* @__PURE__ */ T(C, { children: [
|
|
3761
|
+
b,
|
|
3762
|
+
/* @__PURE__ */ w(ha, {
|
|
3763
|
+
onSubmit: x,
|
|
3764
|
+
onPaste: u,
|
|
3765
|
+
disabled: n,
|
|
3766
|
+
minLength: S ? r.minLength : void 0,
|
|
3767
|
+
maxLength: S ? r.maxLength : void 0,
|
|
3768
|
+
recommendedLength: S ? r.recommendedLength : void 0,
|
|
3769
|
+
placeholder: t === "email" ? i.emailPlaceholder : i.inputPlaceholder,
|
|
3770
|
+
inputLabel: i.inputLabel,
|
|
3771
|
+
sendLabel: i.sendLabel,
|
|
3772
|
+
minLengthHint: S && r.minLength !== void 0 ? i.minLengthHint(r.minLength) : void 0,
|
|
3773
|
+
okHint: S ? i.answerLooksGood : void 0,
|
|
3774
|
+
footer: i.composerFooter,
|
|
3775
|
+
richText: S,
|
|
3776
|
+
toolbarLabels: {
|
|
3777
|
+
toolbar: i.richToolbar,
|
|
3778
|
+
bold: i.richBold,
|
|
3779
|
+
italic: i.richItalic,
|
|
3780
|
+
underline: i.richUnderline,
|
|
3781
|
+
bulletList: i.richBulletList,
|
|
3782
|
+
numberList: i.richNumberList
|
|
3783
|
+
}
|
|
3784
|
+
}),
|
|
3785
|
+
/* @__PURE__ */ w(Ma, {
|
|
3786
|
+
errorKey: d,
|
|
3787
|
+
strings: i,
|
|
3788
|
+
onClose: () => f(null)
|
|
3789
|
+
}),
|
|
3790
|
+
p ? /* @__PURE__ */ w(Yi, {
|
|
3791
|
+
open: !0,
|
|
3792
|
+
title: i.nameConfirmTitle,
|
|
3793
|
+
actions: [{
|
|
3794
|
+
label: i.useSuggestedLabel(p.suggested),
|
|
3795
|
+
onClick: () => {
|
|
3796
|
+
let t = p.suggested;
|
|
3797
|
+
h(null), e.submitNameConfirmed(t);
|
|
3798
|
+
}
|
|
3799
|
+
}, {
|
|
3800
|
+
label: i.useOriginalLabel,
|
|
3801
|
+
variant: "ghost",
|
|
3802
|
+
onClick: () => {
|
|
3803
|
+
let t = p.original;
|
|
3804
|
+
h(null), e.submitNameConfirmed(t);
|
|
3805
|
+
}
|
|
3806
|
+
}],
|
|
3807
|
+
children: i.nameConfirmBody(p.suggested)
|
|
3808
|
+
}) : null
|
|
3809
|
+
] });
|
|
3810
|
+
}, ja = ({ engine: e, maxSeconds: t, disabled: n, strings: r }) => {
|
|
3811
|
+
let { state: i, videoRef: a, camOn: o, micOn: s, countdown: c, attempts: l, maxAttempts: u, reviewUrl: d, openCamera: f, beginCountdown: p, stopRecording: m, reRecord: h, toggleCamera: g, toggleMicrophone: _ } = ka(t);
|
|
3812
|
+
return /* @__PURE__ */ w(va, {
|
|
3813
|
+
phase: i.phase,
|
|
3814
|
+
elapsedSeconds: i.elapsedSeconds,
|
|
3815
|
+
maxSeconds: t,
|
|
3816
|
+
hasResult: !!i.result,
|
|
3817
|
+
showPreview: !0,
|
|
3818
|
+
videoRef: a,
|
|
3819
|
+
disabled: n,
|
|
3820
|
+
camOn: o,
|
|
3821
|
+
micOn: s,
|
|
3822
|
+
countdown: c,
|
|
3823
|
+
attemptsLabel: r.videoAttempts(l, u),
|
|
3824
|
+
canRetake: l < u,
|
|
3825
|
+
reviewUrl: d,
|
|
3826
|
+
labels: {
|
|
3827
|
+
openCamera: r.videoOpenCamera,
|
|
3828
|
+
startRecording: r.videoStartRecording,
|
|
3829
|
+
stopRecording: r.videoStopRecording,
|
|
3830
|
+
reRecord: r.videoReRecord,
|
|
3831
|
+
submit: r.videoSubmit,
|
|
3832
|
+
cameraError: r.videoCameraError,
|
|
3833
|
+
preview: r.videoPreview,
|
|
3834
|
+
camera: r.videoCamera,
|
|
3835
|
+
microphone: r.videoMicrophone,
|
|
3836
|
+
on: r.videoOn,
|
|
3837
|
+
off: r.videoOff,
|
|
3838
|
+
finishHint: r.videoFinishHint,
|
|
3839
|
+
cameraOff: r.videoCameraOff
|
|
3840
|
+
},
|
|
3841
|
+
onOpenCamera: f,
|
|
3842
|
+
onBeginCountdown: p,
|
|
3843
|
+
onStopRecording: m,
|
|
3844
|
+
onReRecord: h,
|
|
3845
|
+
onToggleCamera: g,
|
|
3846
|
+
onToggleMicrophone: _,
|
|
3847
|
+
onSubmit: () => i.result && void e.submitVideoAnswer(i.result.blob, i.result.extension)
|
|
3848
|
+
});
|
|
3849
|
+
}, Ma = ({ errorKey: e, strings: t, onClose: n }) => e ? /* @__PURE__ */ w(Yi, {
|
|
3850
|
+
open: !0,
|
|
3851
|
+
title: t.piiError(e),
|
|
3852
|
+
actions: [{
|
|
3853
|
+
label: t.editLabel,
|
|
3854
|
+
onClick: n
|
|
3855
|
+
}],
|
|
3856
|
+
onClose: n
|
|
3857
|
+
}) : null, Na = [
|
|
3858
|
+
o.MCQ,
|
|
3859
|
+
o.DROPDOWN,
|
|
3860
|
+
o.BGQ
|
|
3861
|
+
], Pa = [
|
|
3862
|
+
o.FTQ,
|
|
3863
|
+
o.MCQ,
|
|
3864
|
+
o.DROPDOWN
|
|
3865
|
+
], Fa = ["ph_i_accept", "ph_submit_assessment"], Ia = (e) => {
|
|
3866
|
+
var t;
|
|
3867
|
+
return e.sender === n.CANDIDATE && ((t = e.types) == null ? [] : t).some((e) => Na.includes(e));
|
|
3868
|
+
}, La = (e) => {
|
|
3869
|
+
var t;
|
|
3870
|
+
return e.sender === n.CANDIDATE && ((t = e.types) == null ? [] : t).includes(o.SLIDER);
|
|
3871
|
+
}, Ra = (e) => {
|
|
3872
|
+
var t;
|
|
3873
|
+
return e.sender === n.CANDIDATE && ((t = e.types) == null ? [] : t).includes(o.VIDEO);
|
|
3874
|
+
}, za = (e) => {
|
|
3875
|
+
var t;
|
|
3876
|
+
return e.component ? e.component === "VideoPlayer" : ((t = e.types) == null ? [] : t).includes(a.VIDEO);
|
|
3877
|
+
}, Ba = (e) => {
|
|
3878
|
+
var t, r;
|
|
3879
|
+
if (e.sender !== n.AGENT) return;
|
|
3880
|
+
let i = ((t = e.data.messageItems) == null ? [] : t).find(za), a = i == null || (r = i.contents) == null || (r = r[0]) == null ? void 0 : r.value;
|
|
3881
|
+
return a ? { url: a } : void 0;
|
|
3882
|
+
}, Va = (e) => {
|
|
3883
|
+
if (!(!e || !e.includes("."))) return e.split(".").pop();
|
|
3884
|
+
}, Ha = (e) => e === V.ANSWERING || e === V.FAILED || e === V.EDITING, Ua = (e) => {
|
|
3885
|
+
var t, r;
|
|
3886
|
+
if (e.sender !== n.CANDIDATE || e.status !== V.ANSWERED) return;
|
|
3887
|
+
let i = ((t = e.types) == null ? [] : t).some((e) => Pa.includes(e)), a = (r = e.data.answer) == null ? void 0 : r.value;
|
|
3888
|
+
if (!(!i || a && Fa.includes(a))) return e.questionId;
|
|
3889
|
+
}, Wa = (e) => {
|
|
3890
|
+
var t;
|
|
3891
|
+
return e.sender === n.CANDIDATE && e.data.answer ? [e.data.answer.text] : ((t = e.data.messageItems) == null ? [] : t).filter((e) => !za(e)).map((e) => {
|
|
3892
|
+
var t, n;
|
|
3893
|
+
return (t = (n = e.contents) == null || (n = n[0]) == null ? void 0 : n.text) == null ? "" : t;
|
|
3894
|
+
}).filter((e) => e.length > 0);
|
|
3895
|
+
}, Ga = (e, t, r) => {
|
|
3896
|
+
var i;
|
|
3897
|
+
let a = Ba(e), s = t.get(e.id), c = s !== void 0, l = {
|
|
3898
|
+
id: e.id,
|
|
3899
|
+
sender: e.sender === n.AGENT ? "agent" : "candidate",
|
|
3900
|
+
paragraphs: Wa(e),
|
|
3901
|
+
pending: e.status === V.PENDING,
|
|
3902
|
+
failed: e.status === V.FAILED,
|
|
3903
|
+
editableQuestionId: Ua(e),
|
|
3904
|
+
editing: e.status === V.EDITING,
|
|
3905
|
+
...a ? { embeddedVideo: a } : {},
|
|
3906
|
+
...c ? {
|
|
3907
|
+
variant: "card",
|
|
3908
|
+
questionLabel: s.label,
|
|
3909
|
+
...s.badge ? { questionBadge: s.badge } : {}
|
|
3910
|
+
} : {},
|
|
3911
|
+
...r !== void 0 && e.id === r ? { streaming: !0 } : {},
|
|
3912
|
+
...e.sender === n.CANDIDATE && (i = e.data.answer) != null && i.html ? { answerHtml: e.data.answer.html } : {}
|
|
3913
|
+
};
|
|
3914
|
+
if (Ia(e)) {
|
|
3915
|
+
var u, d, f, p;
|
|
3916
|
+
let t = e.data.answer;
|
|
3917
|
+
if (e.status === V.ANSWERED || e.status === V.PENDING && t != null) return {
|
|
3918
|
+
...l,
|
|
3919
|
+
paragraphs: t ? [t.text] : []
|
|
3920
|
+
};
|
|
3921
|
+
let n = (u = (d = e.data.messageItems) == null || (d = d[0]) == null ? void 0 : d.contents) == null ? [] : u, r = n.map(({ id: e, text: t }) => ({
|
|
3922
|
+
id: e,
|
|
3923
|
+
text: t
|
|
3924
|
+
}));
|
|
3925
|
+
return {
|
|
3926
|
+
...l,
|
|
3927
|
+
paragraphs: [],
|
|
3928
|
+
options: r,
|
|
3929
|
+
optionsKind: (f = e.types) != null && f.includes(o.DROPDOWN) ? "dropdown" : "list",
|
|
3930
|
+
selectedOptionId: (p = n.find((t) => {
|
|
3931
|
+
var n;
|
|
3932
|
+
return t.value === ((n = e.data.answer) == null ? void 0 : n.value);
|
|
3933
|
+
})) == null ? void 0 : p.id,
|
|
3934
|
+
optionsEnabled: Ha(e.status)
|
|
3935
|
+
};
|
|
3936
|
+
}
|
|
3937
|
+
if (Ra(e)) {
|
|
3938
|
+
var m, h;
|
|
3939
|
+
return {
|
|
3940
|
+
...l,
|
|
3941
|
+
paragraphs: [],
|
|
3942
|
+
video: {
|
|
3943
|
+
uploadProgress: e.uploadProgress,
|
|
3944
|
+
blob: e.videoBlob,
|
|
3945
|
+
questionId: e.questionId,
|
|
3946
|
+
extension: (m = e.videoExtension) == null ? Va((h = e.data.answer) == null ? void 0 : h.value) : m,
|
|
3947
|
+
failed: e.status === V.FAILED
|
|
3948
|
+
}
|
|
3949
|
+
};
|
|
3950
|
+
}
|
|
3951
|
+
if (La(e)) {
|
|
3952
|
+
var g;
|
|
3953
|
+
let t = (g = e.data.answer) == null ? void 0 : g.value;
|
|
3954
|
+
return {
|
|
3955
|
+
...l,
|
|
3956
|
+
paragraphs: [],
|
|
3957
|
+
slider: {
|
|
3958
|
+
min: 1,
|
|
3959
|
+
max: 10,
|
|
3960
|
+
defaultValue: 8,
|
|
3961
|
+
submittedValue: t === void 0 ? void 0 : Number(t),
|
|
3962
|
+
enabled: Ha(e.status)
|
|
3963
|
+
}
|
|
3964
|
+
};
|
|
3965
|
+
}
|
|
3966
|
+
return l;
|
|
3967
|
+
}, Ka = (e, t = /* @__PURE__ */ new Map(), n) => e.map((e) => Ga(e, t, n)).filter((e) => {
|
|
3968
|
+
var t, n;
|
|
3969
|
+
return e.paragraphs.length > 0 || ((t = (n = e.options) == null ? void 0 : n.length) == null ? 0 : t) > 0 || e.slider !== void 0 || e.video !== void 0 || e.embeddedVideo !== void 0;
|
|
3970
|
+
}), qa = (e, t) => {
|
|
3971
|
+
let r = e.filter((e) => e.sender === n.AGENT);
|
|
3972
|
+
return t ? r.find((e) => e.questionId === t) : r[r.length - 1];
|
|
3973
|
+
}, Ja = (e, t) => {
|
|
3974
|
+
var n;
|
|
3975
|
+
return (n = qa(e, t)) == null ? void 0 : n.questionId;
|
|
3976
|
+
}, Ya = [
|
|
3977
|
+
o.FTQ,
|
|
3978
|
+
o.MCQ,
|
|
3979
|
+
o.BGQ,
|
|
3980
|
+
o.DROPDOWN,
|
|
3981
|
+
o.VIDEO
|
|
3982
|
+
], Xa = (e) => {
|
|
3983
|
+
var t;
|
|
3984
|
+
return e.sender === n.AGENT && ((t = e.types) == null ? [] : t).some((e) => Ya.includes(e));
|
|
3985
|
+
}, Za = (e, t, n, r) => {
|
|
3986
|
+
let i = /* @__PURE__ */ new Map();
|
|
3987
|
+
if (r) return i;
|
|
3988
|
+
let a = 0;
|
|
3989
|
+
for (let r of e) {
|
|
3990
|
+
var s;
|
|
3991
|
+
if (!Xa(r)) continue;
|
|
3992
|
+
a += 1;
|
|
3993
|
+
let e = (s = r.types) == null ? [] : s;
|
|
3994
|
+
e.includes(o.VIDEO) ? i.set(r.id, {
|
|
3995
|
+
label: n.counter(a, t),
|
|
3996
|
+
badge: n.videoBadge
|
|
3997
|
+
}) : e.includes(o.MCQ) || e.includes(o.BGQ) || e.includes(o.DROPDOWN) ? i.set(r.id, { label: n.singleChoice }) : i.set(r.id, { label: n.counter(a, t) });
|
|
3998
|
+
}
|
|
3999
|
+
return i;
|
|
4000
|
+
}, Qa = (e, t) => {
|
|
4001
|
+
var n;
|
|
4002
|
+
if (t) return;
|
|
4003
|
+
let r = qa(e);
|
|
4004
|
+
if (r) return ((n = r.types) == null ? [] : n).includes(o.VIDEO) ? r.id : void 0;
|
|
4005
|
+
}, $a = (e, t) => {
|
|
4006
|
+
var n;
|
|
4007
|
+
let r = qa(e, t);
|
|
4008
|
+
return !!(!(r == null || (n = r.types) == null) && n.includes(o.FTQ));
|
|
4009
|
+
}, eo = (e, t) => {
|
|
4010
|
+
var n;
|
|
4011
|
+
let r = qa(e, t);
|
|
4012
|
+
if (!(r == null || (n = r.types) == null) && n.includes(o.VIDEO)) return "video";
|
|
4013
|
+
switch (r == null ? void 0 : r.piiQuestionType) {
|
|
4014
|
+
case i.EMAIL: return "email";
|
|
4015
|
+
case i.PHONE_NUMBER: return "phone";
|
|
4016
|
+
case i.LOCATION: return "location";
|
|
4017
|
+
case i.FULL_NAME:
|
|
4018
|
+
case i.FIRST_NAME:
|
|
4019
|
+
case i.LAST_NAME: return "name";
|
|
4020
|
+
default: return "text";
|
|
4021
|
+
}
|
|
4022
|
+
}, to = (e) => {
|
|
4023
|
+
if (e === void 0) return;
|
|
4024
|
+
let t = typeof e == "number" ? e : Number(e);
|
|
4025
|
+
return Number.isFinite(t) ? t : void 0;
|
|
4026
|
+
}, no = (t, n) => {
|
|
4027
|
+
var r, i;
|
|
4028
|
+
let a = (r = (i = qa(t, n)) == null ? void 0 : i.data.rules) == null ? [] : r, o = (e) => {
|
|
4029
|
+
var t;
|
|
4030
|
+
return to((t = a.find((t) => t.name === e)) == null ? void 0 : t.value);
|
|
4031
|
+
};
|
|
4032
|
+
return {
|
|
4033
|
+
minLength: o(e.MIN_TEXT_LENGTH),
|
|
4034
|
+
maxLength: o(e.MAX_TEXT_LENGTH),
|
|
4035
|
+
recommendedLength: o(e.RECOMMENDED_TEXT_LENGTH)
|
|
4036
|
+
};
|
|
4037
|
+
}, ro = (t, n) => {
|
|
4038
|
+
var r, i, a;
|
|
4039
|
+
let o = to((a = ((r = (i = qa(t, n)) == null ? void 0 : i.data.rules) == null ? [] : r).find((t) => t.name === e.MAX_VOICE_SECONDS)) == null ? void 0 : a.value);
|
|
4040
|
+
return o == null ? 60 : o;
|
|
4041
|
+
}, io = (e) => ({
|
|
4042
|
+
headerTitle: e("sc_header_title"),
|
|
4043
|
+
headerSubtitle: e("sc_header_subtitle"),
|
|
4044
|
+
speakerInterviewer: e("sc_speaker_interviewer"),
|
|
4045
|
+
singleChoiceLabel: e("sc_single_choice_label"),
|
|
4046
|
+
videoBadge: e("sc_video_badge"),
|
|
4047
|
+
typingLabel: e("sc_typing"),
|
|
4048
|
+
typingReading: e("sc_typing_reading"),
|
|
4049
|
+
typingThinking: e("sc_typing_thinking"),
|
|
4050
|
+
progressLabel: e("sc_progress_label"),
|
|
4051
|
+
questionCounter: (t, n) => e("sc_question_counter", {
|
|
4052
|
+
current: t,
|
|
4053
|
+
total: n
|
|
4054
|
+
}),
|
|
4055
|
+
gettingStarted: e("sc_getting_started"),
|
|
4056
|
+
pauseHint: e("sc_pause_hint"),
|
|
4057
|
+
copyLinkLabel: e("sc_copy_link"),
|
|
4058
|
+
copiedLabel: e("sc_copied"),
|
|
4059
|
+
roleWithCompany: (t, n) => e("sc_role_with_company", {
|
|
4060
|
+
role: t,
|
|
4061
|
+
company: n
|
|
4062
|
+
}),
|
|
4063
|
+
welcomeGreeting: (t) => t ? e("sc_welcome_greeting", { name: t }) : e("sc_welcome_greeting_generic"),
|
|
4064
|
+
welcomeTitle: e("sc_welcome_title"),
|
|
4065
|
+
welcomeEyebrow: e("sc_welcome_eyebrow"),
|
|
4066
|
+
welcomeCopyResume: e("sc_welcome_copy_resume"),
|
|
4067
|
+
welcomeIntro: (t, n) => t && n ? e("sc_welcome_intro", {
|
|
4068
|
+
role: t,
|
|
4069
|
+
company: n
|
|
4070
|
+
}) : e("sc_welcome_intro_generic"),
|
|
4071
|
+
welcomePause: e("sc_welcome_pause"),
|
|
4072
|
+
welcomeNext: e("sc_welcome_next"),
|
|
4073
|
+
welcomeReassurance: e("sc_welcome_reassurance"),
|
|
4074
|
+
answerLooksGood: e("sc_answer_looks_good"),
|
|
4075
|
+
composerFooter: e("sc_composer_footer"),
|
|
4076
|
+
richToolbar: e("sc_rich_toolbar"),
|
|
4077
|
+
richBold: e("sc_rich_bold"),
|
|
4078
|
+
richItalic: e("sc_rich_italic"),
|
|
4079
|
+
richUnderline: e("sc_rich_underline"),
|
|
4080
|
+
richBulletList: e("sc_rich_bullet_list"),
|
|
4081
|
+
richNumberList: e("sc_rich_number_list"),
|
|
4082
|
+
inputPlaceholder: e("fi_label_enterResponse"),
|
|
4083
|
+
inputLabel: e("sc_input_label"),
|
|
4084
|
+
sendLabel: e("sc_button_send"),
|
|
4085
|
+
retryLabel: e("fi_button_retry"),
|
|
4086
|
+
editLabel: e("fi_button_edit"),
|
|
4087
|
+
cancelEditLabel: e("fi_label_cancelEditDesktop"),
|
|
4088
|
+
optionsGroupLabel: e("sc_options_group"),
|
|
4089
|
+
sliderLabel: e("fi_label_ratingMessage"),
|
|
4090
|
+
sliderHint: e("fi_label_ratingMessage"),
|
|
4091
|
+
submitRatingLabel: e("fi_button_submitRating"),
|
|
4092
|
+
dropdownSearchPlaceholder: e("fi_placeholder_dropdown"),
|
|
4093
|
+
dropdownSearchLabel: e("sc_dropdown_search_label"),
|
|
4094
|
+
emailPlaceholder: e("fi_placeholder_demoEmailInput"),
|
|
4095
|
+
phoneCountryLabel: e("sc_phone_country_label"),
|
|
4096
|
+
phoneInputLabel: e("sc_phone_input_label"),
|
|
4097
|
+
phonePlaceholder: e("sc_phone_placeholder"),
|
|
4098
|
+
nameConfirmTitle: e("sc_name_confirm_title"),
|
|
4099
|
+
nameConfirmBody: (t) => e("sc_name_confirm_body", { suggested: t }),
|
|
4100
|
+
useSuggestedLabel: (t) => e("sc_name_use_suggested", { suggested: t }),
|
|
4101
|
+
useOriginalLabel: e("sc_name_use_original"),
|
|
4102
|
+
minLengthHint: (t) => e("sc_min_length_hint", { min: t }),
|
|
4103
|
+
loadingLabel: e("sc_loading"),
|
|
4104
|
+
preparingLabel: e("sc_preparing"),
|
|
4105
|
+
doneTitle: (t) => t ? e("sc_done_title_named", { name: t }) : e("sc_done_title"),
|
|
4106
|
+
doneSubtitle: (t) => t ? e("sc_done_subtitle", { company: t }) : e("sc_done_subtitle_generic"),
|
|
4107
|
+
doneNextLabel: e("sc_done_next_label"),
|
|
4108
|
+
doneSteps: [
|
|
4109
|
+
e("sc_done_step1"),
|
|
4110
|
+
e("sc_done_step2"),
|
|
4111
|
+
e("sc_done_step3")
|
|
4112
|
+
],
|
|
4113
|
+
doneRatingPrompt: e("sc_done_rating_prompt"),
|
|
4114
|
+
startFailedMessage: e("sc_start_failed"),
|
|
4115
|
+
piiError: (t) => e(t),
|
|
4116
|
+
videoOpenCamera: e("sc_video_open_camera"),
|
|
4117
|
+
videoStartRecording: e("fi_button_record"),
|
|
4118
|
+
videoStopRecording: e("fi_button_stop"),
|
|
4119
|
+
videoReRecord: e("sc_video_re_record"),
|
|
4120
|
+
videoSubmit: e("sc_video_submit"),
|
|
4121
|
+
videoCameraError: e("sc_video_camera_error"),
|
|
4122
|
+
videoPreview: e("sc_video_preview"),
|
|
4123
|
+
videoCamera: e("sc_video_camera"),
|
|
4124
|
+
videoMicrophone: e("sc_video_microphone"),
|
|
4125
|
+
videoOn: e("sc_video_on"),
|
|
4126
|
+
videoOff: e("sc_video_off"),
|
|
4127
|
+
videoFinishHint: e("sc_video_finish_hint"),
|
|
4128
|
+
videoCameraOff: e("sc_video_camera_off"),
|
|
4129
|
+
videoAttempts: (t, n) => e("sc_video_attempts", {
|
|
4130
|
+
current: t,
|
|
4131
|
+
max: n
|
|
4132
|
+
}),
|
|
4133
|
+
videoUploadProgress: e("fi_label_uploading"),
|
|
4134
|
+
videoUploadFailed: e("fi_label_uploadFailed"),
|
|
4135
|
+
videoRetryUpload: e("sc_video_retry_upload"),
|
|
4136
|
+
videoPlay: e("sc_video_play"),
|
|
4137
|
+
videoAnswer: e("sc_video_answer"),
|
|
4138
|
+
embeddedVideoLabel: e("sc_video_embed_label"),
|
|
4139
|
+
accessTitle: e("sc_access_title"),
|
|
4140
|
+
accessDescription: e("sc_access_description"),
|
|
4141
|
+
accessInputLabel: e("sc_access_input_label"),
|
|
4142
|
+
accessPlaceholder: e("sc_access_placeholder"),
|
|
4143
|
+
accessSubmit: e("sc_access_submit"),
|
|
4144
|
+
accessMismatch: e("fi_error_emailDoesNotMatch"),
|
|
4145
|
+
agcTitle: e("fi_error_agcTitle"),
|
|
4146
|
+
agcMessage: (t) => e(t >= 2 ? "fi_error_agcSecondMessage" : "fi_error_agcFirstMessage"),
|
|
4147
|
+
agcEdit: e("fi_button_edit"),
|
|
4148
|
+
agcContinue: e("fi_button_continue")
|
|
4149
|
+
}), ao = (e) => {
|
|
4150
|
+
m(() => {
|
|
4151
|
+
if (!e) return;
|
|
4152
|
+
let t = (e) => {
|
|
4153
|
+
e.preventDefault(), e.returnValue = "";
|
|
4154
|
+
};
|
|
4155
|
+
return window.addEventListener("beforeunload", t), () => window.removeEventListener("beforeunload", t);
|
|
4156
|
+
}, [e]);
|
|
4157
|
+
}, oo = () => typeof matchMedia < "u" && matchMedia("(prefers-reduced-motion: reduce)").matches, so = ({ env: e, region: t, appId: n, assessmentId: r, apiOrigin: i, theme: a, showHeader: o = !0, language: s, onEvent: l, emitter: u, fetchImpl: d }) => {
|
|
4158
|
+
var f;
|
|
4159
|
+
let [p] = y(() => {
|
|
4160
|
+
let a = new c({
|
|
4161
|
+
env: e,
|
|
4162
|
+
region: t,
|
|
4163
|
+
appId: n,
|
|
4164
|
+
apiOrigin: i,
|
|
4165
|
+
fetchImpl: d
|
|
4166
|
+
}), o = et(), l = u == null ? new I() : u;
|
|
4167
|
+
return {
|
|
4168
|
+
store: o,
|
|
4169
|
+
engine: new Xe({
|
|
4170
|
+
client: a,
|
|
4171
|
+
store: o,
|
|
4172
|
+
emitter: l,
|
|
4173
|
+
assessmentId: r,
|
|
4174
|
+
language: we(s, typeof navigator < "u" ? navigator.language : void 0),
|
|
4175
|
+
welcomeGate: !0,
|
|
4176
|
+
streamRevealMs: oo() ? 0 : void 0
|
|
4177
|
+
}),
|
|
4178
|
+
events: l
|
|
4179
|
+
};
|
|
4180
|
+
}), h = v(l);
|
|
4181
|
+
h.current = l, m(() => {
|
|
4182
|
+
let e = Object.values(F).map((e) => p.events.on(e, (t) => {
|
|
4183
|
+
var n;
|
|
4184
|
+
return (n = h.current) == null ? void 0 : n.call(h, e, t);
|
|
4185
|
+
}));
|
|
4186
|
+
return () => e.forEach((e) => e());
|
|
4187
|
+
}, [p]);
|
|
4188
|
+
let g = v(!1);
|
|
4189
|
+
m(() => {
|
|
4190
|
+
g.current || (g.current = !0, p.engine.begin());
|
|
4191
|
+
}, [p]);
|
|
4192
|
+
let x = b(p.store, (e) => e.phase), S = b(p.store, (e) => e.bubbles), C = b(p.store, (e) => e.typing), E = b(p.store, (e) => e.streamingBubbleId), D = b(p.store, (e) => e.sendingAnswer), O = b(p.store, (e) => e.numOfNormalQuestion), k = b(p.store, (e) => e.numOfNormalAnswer), A = b(p.store, (e) => e.candidateCountryCode), j = b(p.store, (e) => e.editingQuestionId), M = b(p.store, (e) => e.translations), N = b(p.store, (e) => e.language), P = b(p.store, (e) => e.branding), ee = b(p.store, (e) => e.candidateName), L = b(p.store, (e) => e.roleTitle), te = b(p.store, (e) => e.emailHint), ne = b(p.store, (e) => e.accessEmailMismatch), R = b(p.store, (e) => e.verifyingAccess), re = b(p.store, (e) => e.showAgcWarning), ie = b(p.store, (e) => e.agcAttempt), z = _(() => io(it(M, tt)), [M]), ae = Ee(N == null ? "en-US" : N), oe = _(() => Za(S, O, {
|
|
4193
|
+
counter: z.questionCounter,
|
|
4194
|
+
singleChoice: z.singleChoiceLabel,
|
|
4195
|
+
videoBadge: z.videoBadge
|
|
4196
|
+
}, j), [
|
|
4197
|
+
S,
|
|
4198
|
+
O,
|
|
4199
|
+
z,
|
|
4200
|
+
j
|
|
4201
|
+
]), se = Math.min(k + 1, O), ce = O > 0 && (oe.size > 0 || k > 0) ? z.questionCounter(se, O) : z.gettingStarted, B = P == null ? void 0 : P.title, V = L && B ? z.roleWithCompany(L, B) : B == null ? z.headerTitle : B, le = _(() => Ka(S, oe, E), [
|
|
4202
|
+
S,
|
|
4203
|
+
oe,
|
|
4204
|
+
E
|
|
4205
|
+
]), ue = _(() => Qa(S, j), [S, j]), de = _(() => no(S, j), [S, j]), fe = _(() => eo(S, j), [S, j]), pe = _(() => ro(S, j), [S, j]), me = (f = Ja(S, j)) == null ? "none" : f, he = x === "active" && !C && !D && ($a(S, j) || fe === "video"), ge = x === "active" && fe === "video" && !!ue, _e = x === "active" ? /* @__PURE__ */ w(Aa, {
|
|
4206
|
+
engine: p.engine,
|
|
4207
|
+
kind: fe,
|
|
4208
|
+
disabled: !he,
|
|
4209
|
+
textRules: de,
|
|
4210
|
+
strings: z,
|
|
4211
|
+
candidateCountryCode: A,
|
|
4212
|
+
region: t,
|
|
4213
|
+
maxVideoSeconds: pe,
|
|
4214
|
+
editing: !!j,
|
|
4215
|
+
cancelEditLabel: z.cancelEditLabel,
|
|
4216
|
+
onPaste: () => p.engine.reportPaste()
|
|
4217
|
+
}, me) : null;
|
|
4218
|
+
return ao(D), /* @__PURE__ */ T(oa, {
|
|
4219
|
+
themeVariables: _(() => vt(ct(ot(P), a)), [P, a]),
|
|
4220
|
+
dir: ae,
|
|
4221
|
+
children: [
|
|
4222
|
+
o && x === "active" ? /* @__PURE__ */ w($i, {
|
|
4223
|
+
title: V,
|
|
4224
|
+
subtitle: z.headerSubtitle,
|
|
4225
|
+
logoUrl: P == null ? void 0 : P.logoUrl,
|
|
4226
|
+
progressLabel: ce
|
|
4227
|
+
}) : null,
|
|
4228
|
+
x === "active" ? /* @__PURE__ */ w(na, {
|
|
4229
|
+
value: k,
|
|
4230
|
+
max: O,
|
|
4231
|
+
label: z.progressLabel
|
|
4232
|
+
}) : null,
|
|
4233
|
+
x === "starting" || x === "idle" || x === "verifying" ? /* @__PURE__ */ w(ta, { label: z.preparingLabel }) : null,
|
|
4234
|
+
x === "welcome" ? /* @__PURE__ */ w(ia, {
|
|
4235
|
+
logoUrl: P == null ? void 0 : P.logoUrl,
|
|
4236
|
+
onNext: () => void p.engine.confirmWelcome(),
|
|
4237
|
+
labels: {
|
|
4238
|
+
eyebrow: z.welcomeEyebrow,
|
|
4239
|
+
greeting: z.welcomeGreeting(ee),
|
|
4240
|
+
intro: z.welcomeIntro(L, B),
|
|
4241
|
+
copyLinkResume: z.welcomeCopyResume,
|
|
4242
|
+
copied: z.copiedLabel,
|
|
4243
|
+
next: z.welcomeNext
|
|
4244
|
+
}
|
|
4245
|
+
}) : null,
|
|
4246
|
+
x === "ended" ? /* @__PURE__ */ w(Qi, { labels: {
|
|
4247
|
+
title: z.doneTitle(ee),
|
|
4248
|
+
subtitle: z.doneSubtitle(P == null ? void 0 : P.title),
|
|
4249
|
+
nextLabel: z.doneNextLabel,
|
|
4250
|
+
steps: z.doneSteps,
|
|
4251
|
+
ratingPrompt: z.doneRatingPrompt
|
|
4252
|
+
} }) : null,
|
|
4253
|
+
x === "access-required" ? /* @__PURE__ */ w(Xi, {
|
|
4254
|
+
emailHint: te,
|
|
4255
|
+
mismatch: ne,
|
|
4256
|
+
submitting: R,
|
|
4257
|
+
labels: {
|
|
4258
|
+
title: z.accessTitle,
|
|
4259
|
+
description: z.accessDescription,
|
|
4260
|
+
inputLabel: z.accessInputLabel,
|
|
4261
|
+
placeholder: z.accessPlaceholder,
|
|
4262
|
+
submit: z.accessSubmit,
|
|
4263
|
+
mismatchError: z.accessMismatch
|
|
4264
|
+
},
|
|
4265
|
+
onSubmit: (e) => void p.engine.verifyAccessEmail(e)
|
|
4266
|
+
}) : null,
|
|
4267
|
+
x === "failed" ? /* @__PURE__ */ w("p", {
|
|
4268
|
+
role: "alert",
|
|
4269
|
+
className: "sc:p-4 sc:text-sm sc:text-red-600",
|
|
4270
|
+
children: z.startFailedMessage
|
|
4271
|
+
}) : null,
|
|
4272
|
+
x === "active" ? /* @__PURE__ */ w(Nt, {
|
|
4273
|
+
items: le,
|
|
4274
|
+
typing: C,
|
|
4275
|
+
typingLabel: z.typingLabel,
|
|
4276
|
+
typingReadingLabel: z.typingReading,
|
|
4277
|
+
typingThinkingLabel: z.typingThinking,
|
|
4278
|
+
bubbleLabels: {
|
|
4279
|
+
retry: z.retryLabel,
|
|
4280
|
+
optionsGroup: z.optionsGroupLabel,
|
|
4281
|
+
edit: z.editLabel,
|
|
4282
|
+
cancelEdit: z.cancelEditLabel,
|
|
4283
|
+
speakerLabel: z.speakerInterviewer
|
|
4284
|
+
},
|
|
4285
|
+
sliderLabels: {
|
|
4286
|
+
label: z.sliderLabel,
|
|
4287
|
+
hint: z.sliderHint,
|
|
4288
|
+
submitLabel: z.submitRatingLabel
|
|
4289
|
+
},
|
|
4290
|
+
dropdownLabels: {
|
|
4291
|
+
searchPlaceholder: z.dropdownSearchPlaceholder,
|
|
4292
|
+
searchLabel: z.dropdownSearchLabel
|
|
4293
|
+
},
|
|
4294
|
+
mediaLabels: {
|
|
4295
|
+
uploadProgress: z.videoUploadProgress,
|
|
4296
|
+
uploadFailed: z.videoUploadFailed,
|
|
4297
|
+
retryUpload: z.videoRetryUpload,
|
|
4298
|
+
playVideo: z.videoPlay,
|
|
4299
|
+
videoAnswer: z.videoAnswer,
|
|
4300
|
+
embeddedVideo: z.embeddedVideoLabel
|
|
4301
|
+
},
|
|
4302
|
+
onRetry: () => void p.engine.retryLastAnswer(),
|
|
4303
|
+
onSelectOption: (e) => void p.engine.submitOptionAnswer(e),
|
|
4304
|
+
onSubmitSlider: (e) => void p.engine.submitSliderAnswer(e),
|
|
4305
|
+
onEdit: (e) => p.engine.enterEditMode(e),
|
|
4306
|
+
onCancelEdit: () => p.engine.cancelEditMode(),
|
|
4307
|
+
onRetryVideo: () => void p.engine.retryVideoAnswer(),
|
|
4308
|
+
onResolveVideoUrl: (e, t) => p.engine.getVideoPlaybackUrl(e, t),
|
|
4309
|
+
cardFooter: ge ? _e : void 0,
|
|
4310
|
+
cardFooterItemId: ge ? ue : void 0
|
|
4311
|
+
}) : null,
|
|
4312
|
+
x === "active" && !ge ? _e : null,
|
|
4313
|
+
re ? /* @__PURE__ */ w(Yi, {
|
|
4314
|
+
open: !0,
|
|
4315
|
+
title: z.agcTitle,
|
|
4316
|
+
actions: [{
|
|
4317
|
+
label: z.agcEdit,
|
|
4318
|
+
onClick: () => p.engine.dismissAgcWarning()
|
|
4319
|
+
}, {
|
|
4320
|
+
label: z.agcContinue,
|
|
4321
|
+
variant: "ghost",
|
|
4322
|
+
onClick: () => void p.engine.continueAfterAgcWarning()
|
|
4323
|
+
}],
|
|
4324
|
+
onClose: () => p.engine.dismissAgcWarning(),
|
|
4325
|
+
children: z.agcMessage(ie == null ? 0 : ie)
|
|
4326
|
+
}) : null
|
|
4327
|
+
]
|
|
4328
|
+
});
|
|
4329
|
+
}, co = "sapia-chatbot", lo = (e) => {
|
|
4330
|
+
if (e instanceof HTMLElement) return e;
|
|
4331
|
+
let t = e == null ? `#${co}` : e, n = document.querySelector(t);
|
|
4332
|
+
if (!n) throw Error(`Sapia chatbot container not found for selector "${t}"`);
|
|
4333
|
+
return n;
|
|
4334
|
+
}, uo = (e) => {
|
|
4335
|
+
let t = new I(), n = null, r = e.theme, i = () => {
|
|
4336
|
+
n == null || n.render(/* @__PURE__ */ w(so, {
|
|
4337
|
+
...e,
|
|
4338
|
+
theme: r,
|
|
4339
|
+
emitter: t
|
|
4340
|
+
}));
|
|
4341
|
+
};
|
|
4342
|
+
return {
|
|
4343
|
+
mount(e) {
|
|
4344
|
+
n = l(lo(e)), i();
|
|
4345
|
+
},
|
|
4346
|
+
unmount() {
|
|
4347
|
+
n == null || n.unmount(), n = null;
|
|
4348
|
+
},
|
|
4349
|
+
setTheme(e) {
|
|
4350
|
+
r = e, i();
|
|
4351
|
+
},
|
|
4352
|
+
on: (e, n) => t.on(e, n)
|
|
4353
|
+
};
|
|
4354
|
+
}, fo = "sapiaChatBot", po = 2, mo = 500, ho = "PHChatBot: assessmentId is required (cohortId / jobRequisitionShortcode / applicationShortcode generic links are served by the standalone SPA, not the embeddable widget).", go = /* @__PURE__ */ function(e) {
|
|
4355
|
+
return e.FI_ASSESSMENT_ANSWER_SAVED = "FI_ASSESSMENT_ANSWER_SAVED", e.FI_ASSESSMENT_ANSWER_EDITED = "FI_ASSESSMENT_ANSWER_EDITED", e.FI_ASSESSMENT_STARTED = "FI_ASSESSMENT_STARTED", e.FI_ASSESSMENT_ENDED = "FI_ASSESSMENT_ENDED", e.FI_ASSESSMENT_DUPLICATED = "FI_ASSESSMENT_DUPLICATED", e.CHATBOT_ERROR = "CHATBOT_ERROR", e.CHATBOT_LOG = "CHATBOT_LOG", e;
|
|
4356
|
+
}({}), _o = (e) => e ? {
|
|
4357
|
+
backgroundColor: e.backgroundColor,
|
|
4358
|
+
fontColor: e.fontColor
|
|
4359
|
+
} : void 0, vo = (e) => ({
|
|
4360
|
+
header: _o(e.header),
|
|
4361
|
+
question: _o(e.question),
|
|
4362
|
+
response: _o(e.response),
|
|
4363
|
+
button: _o(e.button)
|
|
4364
|
+
}), yo = {
|
|
4365
|
+
[F.ANSWER_SAVED]: "FI_ASSESSMENT_ANSWER_SAVED",
|
|
4366
|
+
[F.ANSWER_EDITED]: "FI_ASSESSMENT_ANSWER_EDITED",
|
|
4367
|
+
[F.ASSESSMENT_STARTED]: "FI_ASSESSMENT_STARTED",
|
|
4368
|
+
[F.ASSESSMENT_ENDED]: "FI_ASSESSMENT_ENDED",
|
|
4369
|
+
[F.ASSESSMENT_DUPLICATED]: "FI_ASSESSMENT_DUPLICATED",
|
|
4370
|
+
[F.ERROR]: "CHATBOT_ERROR",
|
|
4371
|
+
[F.LOG]: "CHATBOT_LOG"
|
|
4372
|
+
}, bo = async (e, t = po, n = mo) => {
|
|
4373
|
+
let r = t, i = e();
|
|
4374
|
+
for (; !i && r > 0;) --r, await new Promise((e) => setTimeout(e, n)), i = e();
|
|
4375
|
+
return i;
|
|
4376
|
+
}, xo = class {
|
|
4377
|
+
constructor(e) {
|
|
4378
|
+
this.callbacks = {}, this.theme = {}, this.chatbot = null, e.assessmentId || console.error(ho), this.options = e;
|
|
4379
|
+
}
|
|
4380
|
+
addCallbackHandler(e) {
|
|
4381
|
+
this.callbacks = {
|
|
4382
|
+
...this.callbacks,
|
|
4383
|
+
...e
|
|
4384
|
+
};
|
|
4385
|
+
}
|
|
4386
|
+
setTheme({ theme: e }) {
|
|
4387
|
+
var t;
|
|
4388
|
+
this.theme = { ...e }, (t = this.chatbot) == null || t.setTheme(vo(this.theme));
|
|
4389
|
+
}
|
|
4390
|
+
async attachChatBot() {
|
|
4391
|
+
var e;
|
|
4392
|
+
if (!this.options.assessmentId) return;
|
|
4393
|
+
let t = await bo(() => document.getElementById(fo));
|
|
4394
|
+
if (!t) {
|
|
4395
|
+
console.error(`PHChatBot: container #${fo} not found`);
|
|
4396
|
+
return;
|
|
4397
|
+
}
|
|
4398
|
+
this.chatbot = uo({
|
|
4399
|
+
env: this.options.env,
|
|
4400
|
+
region: this.options.region,
|
|
4401
|
+
appId: this.options.appId,
|
|
4402
|
+
assessmentId: this.options.assessmentId,
|
|
4403
|
+
apiOrigin: this.options.apiOrigin,
|
|
4404
|
+
showHeader: (e = this.options.showHeader) == null ? !1 : e,
|
|
4405
|
+
theme: vo(this.theme)
|
|
4406
|
+
});
|
|
4407
|
+
for (let e of Object.values(F)) this.chatbot.on(e, (t) => this.dispatch(e, t));
|
|
4408
|
+
this.chatbot.mount(t);
|
|
4409
|
+
}
|
|
4410
|
+
stopCallingApiWhenUnmount() {
|
|
4411
|
+
var e;
|
|
4412
|
+
(e = this.chatbot) == null || e.unmount(), this.chatbot = null;
|
|
4413
|
+
}
|
|
4414
|
+
dispatch(e, t) {
|
|
4415
|
+
let n = this.callbacks[yo[e]];
|
|
4416
|
+
if (n) {
|
|
4417
|
+
if (e === F.ASSESSMENT_DUPLICATED) {
|
|
4418
|
+
n == null || n({ duplicatedWithAssessmentLink: t.duplicatedWithAssessmentLink });
|
|
4419
|
+
return;
|
|
4420
|
+
}
|
|
4421
|
+
n(t);
|
|
4422
|
+
}
|
|
4423
|
+
}
|
|
4424
|
+
};
|
|
4425
|
+
//#endregion
|
|
4426
|
+
export { fo as CHATBOT_CONTAINER_ID, F as CHATBOT_EVENTS, co as DEFAULT_CONTAINER_ID, r as ENVIRONMENTS, xo as PHChatBot, go as PHChatBotCallbackFunction, t as REGIONS, so as SapiaChatbot, uo as createChatbot, N as t };
|
|
4427
|
+
|
|
4428
|
+
//# sourceMappingURL=index.js.map
|