interview-widget 3.2.16 → 3.2.17
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.
|
@@ -423,12 +423,12 @@ const uu = (e) => {
|
|
|
423
423
|
const t = D(null), i = D(null), [r, n] = C(!1), [o, s] = C(!1), [a, l] = C(null), [d, u] = C([]), [h, w] = C([]), [f, g] = C(""), [y, b] = C(""), [p, v] = C(!1), _ = M(() => {
|
|
424
424
|
i.current && (i.current.getTracks().forEach((x) => x.stop()), i.current = null, l(null));
|
|
425
425
|
}, []), E = M(async () => {
|
|
426
|
-
var x,
|
|
426
|
+
var x, T, P, j;
|
|
427
427
|
try {
|
|
428
428
|
const z = await navigator.mediaDevices.enumerateDevices(), X = z.filter((U) => U.kind === "audioinput"), O = z.filter((U) => U.kind === "videoinput");
|
|
429
429
|
if (u(X), w(O), !f && X.length > 0) {
|
|
430
430
|
const U = (x = i.current) == null ? void 0 : x.getAudioTracks()[0], ee = U == null ? void 0 : U.getSettings().deviceId;
|
|
431
|
-
g(ee || ((
|
|
431
|
+
g(ee || ((T = X[0]) == null ? void 0 : T.deviceId) || "");
|
|
432
432
|
}
|
|
433
433
|
if (!y && O.length > 0) {
|
|
434
434
|
const U = (P = i.current) == null ? void 0 : P.getVideoTracks()[0], ee = U == null ? void 0 : U.getSettings().deviceId;
|
|
@@ -437,11 +437,11 @@ const uu = (e) => {
|
|
|
437
437
|
} catch (z) {
|
|
438
438
|
console.error("Error enumerating devices:", z);
|
|
439
439
|
}
|
|
440
|
-
}, [f, y]),
|
|
440
|
+
}, [f, y]), k = M(async (x, T) => {
|
|
441
441
|
const P = {
|
|
442
442
|
width: { ideal: 1280 },
|
|
443
443
|
height: { ideal: 720 },
|
|
444
|
-
...
|
|
444
|
+
...T ? { deviceId: { exact: T } } : { facingMode: "user" }
|
|
445
445
|
}, j = {
|
|
446
446
|
echoCancellation: !0,
|
|
447
447
|
noiseSuppression: !0,
|
|
@@ -472,17 +472,17 @@ const uu = (e) => {
|
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
z ? (i.current = z, l(z), t.current && (t.current.srcObject = z, await t.current.play().catch((X) => console.error("Error playing video element", X)))) : (i.current = null, l(null)), await E();
|
|
475
|
-
}, [E]),
|
|
476
|
-
x !== f && (v(!0), g(x), _(), await
|
|
475
|
+
}, [E]), A = async (x) => {
|
|
476
|
+
x !== f && (v(!0), g(x), _(), await k(x, y), v(!1));
|
|
477
477
|
}, G = async (x) => {
|
|
478
|
-
x !== y && (v(!0), b(x), _(), await
|
|
478
|
+
x !== y && (v(!0), b(x), _(), await k(f, x), v(!1));
|
|
479
479
|
};
|
|
480
480
|
return B(() => {
|
|
481
481
|
if (!e) {
|
|
482
482
|
_();
|
|
483
483
|
return;
|
|
484
484
|
}
|
|
485
|
-
return
|
|
485
|
+
return k(), () => _();
|
|
486
486
|
}, [e]), {
|
|
487
487
|
videoRef: t,
|
|
488
488
|
audioAllowed: r,
|
|
@@ -493,7 +493,7 @@ const uu = (e) => {
|
|
|
493
493
|
selectedVideoDeviceId: y,
|
|
494
494
|
isDeviceLoading: p,
|
|
495
495
|
currentStream: a,
|
|
496
|
-
handleAudioChange:
|
|
496
|
+
handleAudioChange: A,
|
|
497
497
|
handleVideoChange: G,
|
|
498
498
|
stopStream: _
|
|
499
499
|
};
|
|
@@ -4732,8 +4732,8 @@ const Lr = "https://storage.googleapis.com/mediapipe-models/face_landmarker/face
|
|
|
4732
4732
|
const w = (d.x + u.x) * 0.5, f = (d.y + u.y) * 0.5, g = w - a.x, y = f - a.y, b = Math.sqrt(g * g + y * y), p = Math.abs(h.y - a.noseY) * 100, v = Math.abs(h.x - a.noseX) * 100, _ = Math.max(
|
|
4733
4733
|
0,
|
|
4734
4734
|
100 - (b * 200 + p + v)
|
|
4735
|
-
), E = _ < wh,
|
|
4736
|
-
return
|
|
4735
|
+
), E = _ < wh, k = performance.now();
|
|
4736
|
+
return k - n.current > 100 && (t(_), r(E), n.current = k), { engagement: _, isLookingAway: E };
|
|
4737
4737
|
},
|
|
4738
4738
|
[]
|
|
4739
4739
|
);
|
|
@@ -4774,11 +4774,11 @@ const Lr = "https://storage.googleapis.com/mediapipe-models/face_landmarker/face
|
|
|
4774
4774
|
);
|
|
4775
4775
|
if (b === 0 || p === 0) return 0;
|
|
4776
4776
|
for (const _ of d) {
|
|
4777
|
-
const E = l[_],
|
|
4778
|
-
if (E &&
|
|
4779
|
-
const
|
|
4777
|
+
const E = l[_], k = a[_];
|
|
4778
|
+
if (E && k) {
|
|
4779
|
+
const A = w.x + (k.x - g.x) * b / p, G = w.y + (k.y - g.y) * b / p;
|
|
4780
4780
|
u += n(E, {
|
|
4781
|
-
x:
|
|
4781
|
+
x: A,
|
|
4782
4782
|
y: G
|
|
4783
4783
|
}), h++;
|
|
4784
4784
|
}
|
|
@@ -5353,24 +5353,24 @@ const Eh = new fr(), _h = (e, t, i, r) => {
|
|
|
5353
5353
|
}
|
|
5354
5354
|
r();
|
|
5355
5355
|
try {
|
|
5356
|
-
const E = performance.now(),
|
|
5356
|
+
const E = performance.now(), k = _.detectForVideo(
|
|
5357
5357
|
p,
|
|
5358
5358
|
E
|
|
5359
|
-
),
|
|
5360
|
-
|
|
5359
|
+
), A = n(
|
|
5360
|
+
k,
|
|
5361
5361
|
l,
|
|
5362
5362
|
d.current,
|
|
5363
5363
|
f
|
|
5364
5364
|
);
|
|
5365
|
-
|
|
5365
|
+
A ? (o(
|
|
5366
5366
|
v,
|
|
5367
5367
|
p,
|
|
5368
|
-
|
|
5368
|
+
A,
|
|
5369
5369
|
u,
|
|
5370
5370
|
h,
|
|
5371
5371
|
w,
|
|
5372
5372
|
l
|
|
5373
|
-
), l && w && a(
|
|
5373
|
+
), l && w && a(A, d.current, w)) : s(v, p);
|
|
5374
5374
|
} catch (E) {
|
|
5375
5375
|
console.error("Face detection error:", E);
|
|
5376
5376
|
}
|
|
@@ -5828,28 +5828,28 @@ const Fh = (e) => {
|
|
|
5828
5828
|
try {
|
|
5829
5829
|
l(null), s(null), u(null), await v.startRecording(p, {
|
|
5830
5830
|
onStart: () => {
|
|
5831
|
-
var
|
|
5832
|
-
i(!0), (
|
|
5831
|
+
var k, A;
|
|
5832
|
+
i(!0), (A = (k = h.current).onStart) == null || A.call(k);
|
|
5833
5833
|
},
|
|
5834
5834
|
// ---- FIX: onStop is the SINGLE source of truth for stop events.
|
|
5835
5835
|
// stopRecording() no longer calls onStop separately, preventing double-fire.
|
|
5836
5836
|
onStop: () => {
|
|
5837
|
-
var
|
|
5838
|
-
i(!1), (
|
|
5837
|
+
var k, A;
|
|
5838
|
+
i(!1), (A = (k = h.current).onStop) == null || A.call(k);
|
|
5839
5839
|
},
|
|
5840
|
-
onError: (
|
|
5840
|
+
onError: (k) => {
|
|
5841
5841
|
var G, x;
|
|
5842
|
-
const
|
|
5843
|
-
l(
|
|
5842
|
+
const A = k instanceof Q ? k : new Q(k.message, "RECORDING_ERROR", !0);
|
|
5843
|
+
l(A), i(!1), (x = (G = h.current).onError) == null || x.call(G, A);
|
|
5844
5844
|
}
|
|
5845
5845
|
});
|
|
5846
|
-
} catch (
|
|
5847
|
-
const
|
|
5848
|
-
|
|
5846
|
+
} catch (k) {
|
|
5847
|
+
const A = k instanceof Q ? k : new Q(
|
|
5848
|
+
k instanceof Error ? k.message : String(k),
|
|
5849
5849
|
"START_FAILED",
|
|
5850
5850
|
!1
|
|
5851
5851
|
);
|
|
5852
|
-
throw l(
|
|
5852
|
+
throw l(A), i(!1), (E = (_ = h.current).onError) == null || E.call(_, A), A;
|
|
5853
5853
|
}
|
|
5854
5854
|
}, []), g = M(async () => {
|
|
5855
5855
|
var v, _;
|
|
@@ -5864,16 +5864,16 @@ const Fh = (e) => {
|
|
|
5864
5864
|
const E = await p.stopRecording();
|
|
5865
5865
|
return u(E), E;
|
|
5866
5866
|
} catch (E) {
|
|
5867
|
-
const
|
|
5867
|
+
const k = E instanceof Q ? E : new Q(
|
|
5868
5868
|
E instanceof Error ? E.message : String(E),
|
|
5869
5869
|
"STOP_FAILED",
|
|
5870
5870
|
!1
|
|
5871
5871
|
);
|
|
5872
|
-
throw l(
|
|
5872
|
+
throw l(k), i(!1), (_ = (v = h.current).onError) == null || _.call(v, k), k;
|
|
5873
5873
|
}
|
|
5874
5874
|
}, []), y = M(
|
|
5875
5875
|
async (p, v = {}) => {
|
|
5876
|
-
var E,
|
|
5876
|
+
var E, k, A, G, x, T;
|
|
5877
5877
|
const _ = w.current;
|
|
5878
5878
|
if (!_ || _.isDisposed())
|
|
5879
5879
|
throw new Q(
|
|
@@ -5885,20 +5885,20 @@ const Fh = (e) => {
|
|
|
5885
5885
|
if (l(null), n(!0), !p || p.size === 0) {
|
|
5886
5886
|
console.warn("Skipping transcription — blob is empty");
|
|
5887
5887
|
const z = { transcript: "" };
|
|
5888
|
-
return s(z.transcript), n(!1), (
|
|
5888
|
+
return s(z.transcript), n(!1), (k = (E = h.current).onTranscriptionComplete) == null || k.call(E, z), z;
|
|
5889
5889
|
}
|
|
5890
5890
|
const P = {
|
|
5891
5891
|
audioBlob: p,
|
|
5892
5892
|
...v
|
|
5893
5893
|
}, j = await _.transcribe(P);
|
|
5894
|
-
return s(j.transcript), n(!1), (G = (
|
|
5894
|
+
return s(j.transcript), n(!1), (G = (A = h.current).onTranscriptionComplete) == null || G.call(A, j), j;
|
|
5895
5895
|
} catch (P) {
|
|
5896
5896
|
const j = P instanceof Q ? P : new Q(
|
|
5897
5897
|
P instanceof Error ? P.message : String(P),
|
|
5898
5898
|
"TRANSCRIPTION_FAILED",
|
|
5899
5899
|
!0
|
|
5900
5900
|
);
|
|
5901
|
-
throw l(j), n(!1), (
|
|
5901
|
+
throw l(j), n(!1), (T = (x = h.current).onError) == null || T.call(x, j), j;
|
|
5902
5902
|
}
|
|
5903
5903
|
},
|
|
5904
5904
|
[]
|
|
@@ -6386,9 +6386,9 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
6386
6386
|
videoAllowed: u = !0
|
|
6387
6387
|
}, h) => {
|
|
6388
6388
|
var as;
|
|
6389
|
-
const { authToken: w } = Aa(), f = os(), g = w ? lu(w) : null, { borderRadius: y } = Ii(), b = y ?? 18, { proctoring: p, capture_screenshots: v } = gr(), _ = !!(p != null && p.gazeAnalysisEnabled), [E,
|
|
6389
|
+
const { authToken: w } = Aa(), f = os(), g = w ? lu(w) : null, { borderRadius: y } = Ii(), b = y ?? 18, { proctoring: p, capture_screenshots: v } = gr(), _ = !!(p != null && p.gazeAnalysisEnabled), [E, k] = C(!1), [A, G] = C(
|
|
6390
6390
|
(p == null ? void 0 : p.showLandmarks) ?? !1
|
|
6391
|
-
), [x,
|
|
6391
|
+
), [x, T] = C(
|
|
6392
6392
|
r && ((p == null ? void 0 : p.showEngagementBar) ?? !0)
|
|
6393
6393
|
), [P, j] = C(
|
|
6394
6394
|
_
|
|
@@ -6501,7 +6501,7 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
6501
6501
|
$i,
|
|
6502
6502
|
Hi,
|
|
6503
6503
|
qi,
|
|
6504
|
-
|
|
6504
|
+
A,
|
|
6505
6505
|
x,
|
|
6506
6506
|
_,
|
|
6507
6507
|
ct,
|
|
@@ -6629,16 +6629,16 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
6629
6629
|
{
|
|
6630
6630
|
showControls: (p == null ? void 0 : p.showControls) ?? !1,
|
|
6631
6631
|
isBubbleOpen: E,
|
|
6632
|
-
setIsBubbleOpen:
|
|
6632
|
+
setIsBubbleOpen: k,
|
|
6633
6633
|
setReference: Ki,
|
|
6634
6634
|
clearCache: oi,
|
|
6635
6635
|
isModelLoaded: Ke,
|
|
6636
6636
|
gazeAnalysisEnabled: P && _,
|
|
6637
6637
|
referenceSet: Hi,
|
|
6638
|
-
showLandmarks:
|
|
6638
|
+
showLandmarks: A,
|
|
6639
6639
|
setShowLandmarks: G,
|
|
6640
6640
|
showEngagementBar: x,
|
|
6641
|
-
setShowEngagementBar:
|
|
6641
|
+
setShowEngagementBar: T,
|
|
6642
6642
|
handleToggleGazeAnalysis: Pl,
|
|
6643
6643
|
stats: Bl,
|
|
6644
6644
|
statusMessage: De,
|
|
@@ -6767,21 +6767,21 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
6767
6767
|
const U = p[O] ?? 0;
|
|
6768
6768
|
E += U * U;
|
|
6769
6769
|
}
|
|
6770
|
-
const
|
|
6770
|
+
const k = Math.sqrt(E / b), A = Math.min(1, k / 128), G = new Float32Array(w.fftSize);
|
|
6771
6771
|
w.getFloatTimeDomainData(G);
|
|
6772
6772
|
let x = 0;
|
|
6773
6773
|
for (let O = 0; O < G.length; O++) {
|
|
6774
6774
|
const U = G[O] || 0;
|
|
6775
6775
|
x += U * U;
|
|
6776
6776
|
}
|
|
6777
|
-
const
|
|
6777
|
+
const T = Math.sqrt(x / G.length), P = T > 0 ? 20 * Math.log10(T) : -1 / 0;
|
|
6778
6778
|
let j = "problem";
|
|
6779
6779
|
if (P >= -20 ? j = "good" : P >= -25 ? j = "acceptable" : P >= -45 ? j = "poor" : j = "problem", r) {
|
|
6780
6780
|
const O = Date.now();
|
|
6781
6781
|
O - s.current > 200 && (s.current = O, r(j, P));
|
|
6782
6782
|
}
|
|
6783
6783
|
y.clearRect(0, 0, v, _);
|
|
6784
|
-
const z = i, X = Math.floor(
|
|
6784
|
+
const z = i, X = Math.floor(A * z);
|
|
6785
6785
|
for (let O = 0; O < z; O++) {
|
|
6786
6786
|
const U = O * (v / z), ee = v / z - 1.8;
|
|
6787
6787
|
O < X ? y.fillStyle = "#0EB00E" : y.fillStyle = "#D9D9D9", y.fillRect(U, 0, ee, _);
|
|
@@ -7030,11 +7030,11 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
7030
7030
|
audioStream: y = null,
|
|
7031
7031
|
isDeviceLoading: b = !1
|
|
7032
7032
|
}) => {
|
|
7033
|
-
const { baseColor: p } = Ii(), [v, _] = C("problem"), [E,
|
|
7033
|
+
const { baseColor: p } = Ii(), [v, _] = C("problem"), [E, k] = C(!1);
|
|
7034
7034
|
Ht.useEffect(() => {
|
|
7035
|
-
_("problem"),
|
|
7035
|
+
_("problem"), k(!1);
|
|
7036
7036
|
}, [h]);
|
|
7037
|
-
const
|
|
7037
|
+
const A = l || !n || a && (!e || !t || !E) || b;
|
|
7038
7038
|
return /* @__PURE__ */ m("div", { className: "iw-flex iw-flex-col iw-gap-1 iw-w-full", children: [
|
|
7039
7039
|
/* @__PURE__ */ m("div", { className: "iw-flex iw-justify-center iw-items-center iw-gap-2 iw-flex-wrap iw-max-w-[700px] iw-mx-auto", children: [
|
|
7040
7040
|
a && /* @__PURE__ */ m("div", { className: "iw-flex sm:iw-flex-row iw-flex-col iw-gap-4 iw-w-full", children: [
|
|
@@ -7053,10 +7053,10 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
7053
7053
|
stream: y,
|
|
7054
7054
|
hasPermission: e,
|
|
7055
7055
|
onAudioLevel: (x) => {
|
|
7056
|
-
const
|
|
7056
|
+
const T = { good: 3, acceptable: 2, poor: 1, problem: 0 };
|
|
7057
7057
|
_(
|
|
7058
|
-
(P) =>
|
|
7059
|
-
), !E && (x === "good" || x === "acceptable") &&
|
|
7058
|
+
(P) => T[x] > T[P] ? x : P
|
|
7059
|
+
), !E && (x === "good" || x === "acceptable") && k(!0);
|
|
7060
7060
|
}
|
|
7061
7061
|
}
|
|
7062
7062
|
),
|
|
@@ -7098,8 +7098,8 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
7098
7098
|
zr,
|
|
7099
7099
|
{
|
|
7100
7100
|
onClick: r,
|
|
7101
|
-
disabled:
|
|
7102
|
-
className: `iw-h-12 iw-w-full iw-shadow-lg !iw-bg-[#F1F5FE] !iw-text-[#062260] !iw-font-bold !iw-border-[#E7EAF1] iw-rounded-lg ${
|
|
7101
|
+
disabled: A,
|
|
7102
|
+
className: `iw-h-12 iw-w-full iw-shadow-lg !iw-bg-[#F1F5FE] !iw-text-[#062260] !iw-font-bold !iw-border-[#E7EAF1] iw-rounded-lg ${A ? "iw-opacity-50" : "hover:iw-opacity-75"}`,
|
|
7103
7103
|
children: b ? "Device Loading..." : i
|
|
7104
7104
|
}
|
|
7105
7105
|
),
|
|
@@ -7171,11 +7171,11 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
7171
7171
|
handleAudioChange: y,
|
|
7172
7172
|
handleVideoChange: b,
|
|
7173
7173
|
stopStream: p
|
|
7174
|
-
} = du(e), [v, _] = C(!1), [E,
|
|
7174
|
+
} = du(e), [v, _] = C(!1), [E, k] = C(0), [A, G] = C(!1), x = D(null), T = D(null), P = (U) => {
|
|
7175
7175
|
x.current = U, r && (typeof r == "function" ? r(U) : r.current = U);
|
|
7176
7176
|
};
|
|
7177
7177
|
if (B(() => () => {
|
|
7178
|
-
|
|
7178
|
+
T.current && (clearInterval(T.current), T.current = null);
|
|
7179
7179
|
}, []), !e) return null;
|
|
7180
7180
|
const [j, z] = C(Re.MODEL_LOADING), X = async () => {
|
|
7181
7181
|
var ee;
|
|
@@ -7184,7 +7184,7 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
7184
7184
|
var be;
|
|
7185
7185
|
return (be = x.current) == null ? void 0 : be.setReference();
|
|
7186
7186
|
};
|
|
7187
|
-
U(),
|
|
7187
|
+
U(), T.current && clearInterval(T.current), T.current = setInterval(U, 500);
|
|
7188
7188
|
};
|
|
7189
7189
|
return /* @__PURE__ */ c("div", { className: "iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-gray-900/40 iw-backdrop-blur-sm iw-p-4 iw-pt-16 iw-overflow-auto", children: /* @__PURE__ */ m("div", { className: "iw-w-full iw-max-w-[700px] iw-max-h-[900px] iw-my-6 iw-bg-white iw-rounded-xl iw-shadow-2xl iw-overflow-auto", children: [
|
|
7190
7190
|
/* @__PURE__ */ m("div", { className: "iw-px-12 iw-pt-3", children: [
|
|
@@ -7209,7 +7209,7 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
7209
7209
|
videoAllowed: a,
|
|
7210
7210
|
onProctoringStatusChange: z,
|
|
7211
7211
|
onSetReference: () => {
|
|
7212
|
-
|
|
7212
|
+
T.current && (clearInterval(T.current), T.current = null), _(!1), k(1);
|
|
7213
7213
|
}
|
|
7214
7214
|
}
|
|
7215
7215
|
) : /* @__PURE__ */ c(
|
|
@@ -7230,10 +7230,10 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
7230
7230
|
videoEnabled: a,
|
|
7231
7231
|
buttonText: i ? v ? "Calibrating..." : j === "model_loading" ? "Initialising..." : "Start calibrate" : "Next",
|
|
7232
7232
|
onButtonClick: () => {
|
|
7233
|
-
i ? X() :
|
|
7233
|
+
i ? X() : k(1);
|
|
7234
7234
|
},
|
|
7235
|
-
disabled: !
|
|
7236
|
-
isAgreed:
|
|
7235
|
+
disabled: !A || i && j !== "face_detected" || !i && (!s || !a),
|
|
7236
|
+
isAgreed: A,
|
|
7237
7237
|
onAgreedToggle: G,
|
|
7238
7238
|
audioDevices: d,
|
|
7239
7239
|
videoDevices: u,
|
|
@@ -7257,7 +7257,7 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
7257
7257
|
onButtonClick: () => {
|
|
7258
7258
|
t(), p();
|
|
7259
7259
|
},
|
|
7260
|
-
isAgreed:
|
|
7260
|
+
isAgreed: A,
|
|
7261
7261
|
onAgreedToggle: G,
|
|
7262
7262
|
showMediaIcons: !1
|
|
7263
7263
|
}
|
|
@@ -7561,28 +7561,28 @@ const to = new Oh(), Bh = (e = {}) => {
|
|
|
7561
7561
|
n = new u(), o = n.createAnalyser(), o.fftSize = 256, o.smoothingTimeConstant = 0.9, s = n.createMediaStreamSource(d), s.connect(o);
|
|
7562
7562
|
const h = o.frequencyBinCount, w = new Uint8Array(h), f = new Float32Array(h), g = 0.2, y = () => {
|
|
7563
7563
|
if (t.current) {
|
|
7564
|
-
const
|
|
7565
|
-
i.width !==
|
|
7564
|
+
const T = t.current.clientWidth - 32;
|
|
7565
|
+
i.width !== T && T > 0 && (i.width = T);
|
|
7566
7566
|
}
|
|
7567
7567
|
const b = i.width, p = i.height;
|
|
7568
7568
|
r.clearRect(0, 0, b, p), o.getByteFrequencyData(w);
|
|
7569
|
-
for (let
|
|
7570
|
-
const P = f[
|
|
7571
|
-
f[
|
|
7569
|
+
for (let T = 0; T < h; T++) {
|
|
7570
|
+
const P = f[T] || 0, j = w[T] || 0;
|
|
7571
|
+
f[T] = P * g + j * (1 - g);
|
|
7572
7572
|
}
|
|
7573
|
-
const v = 3, _ = 2, E = Math.floor(b / (v + _)),
|
|
7574
|
-
if (
|
|
7573
|
+
const v = 3, _ = 2, E = Math.floor(b / (v + _)), k = E > 0 ? E % 2 === 0 ? E - 1 : E : 0;
|
|
7574
|
+
if (k <= 0) {
|
|
7575
7575
|
a = requestAnimationFrame(y);
|
|
7576
7576
|
return;
|
|
7577
7577
|
}
|
|
7578
|
-
const
|
|
7578
|
+
const A = (b - k * (v + _)) / 2, G = Math.floor(k / 2);
|
|
7579
7579
|
r.fillStyle = "#27ba71";
|
|
7580
7580
|
const x = 38;
|
|
7581
|
-
for (let
|
|
7582
|
-
const P = Math.abs(
|
|
7581
|
+
for (let T = 0; T < k; T++) {
|
|
7582
|
+
const P = Math.abs(T - G), j = G > 0 ? P / G : 0, z = 2 + Math.floor(Math.pow(j, 1.5) * x);
|
|
7583
7583
|
let X = f[Math.min(z, h - 1)] || 0;
|
|
7584
7584
|
X = X / 255, X = Math.pow(X, 2.2);
|
|
7585
|
-
const O = 1 - j * 0.8, U = 1.5, ee = X > 0.05 ? Math.sin(Date.now() / 300 +
|
|
7585
|
+
const O = 1 - j * 0.8, U = 1.5, ee = X > 0.05 ? Math.sin(Date.now() / 300 + T) * 0.5 * O : 0, be = X * (p - 8) * O, Me = Math.max(U, be + ee), at = A + T * (v + _), Ke = (p - Me) / 2;
|
|
7586
7586
|
r.beginPath(), r.roundRect(at, Ke, v, Me, v / 2), r.fill();
|
|
7587
7587
|
}
|
|
7588
7588
|
a = requestAnimationFrame(y);
|
|
@@ -8168,26 +8168,24 @@ const c2 = (e) => /* @__PURE__ */ m(
|
|
|
8168
8168
|
}),
|
|
8169
8169
|
[]
|
|
8170
8170
|
), Lh(y), Fh(y), Mh(), Vh();
|
|
8171
|
-
const { proctoring: E } = gr(),
|
|
8171
|
+
const { proctoring: E } = gr(), k = (E == null ? void 0 : E.prevent_unintended_exit) ?? !1;
|
|
8172
8172
|
B(() => {
|
|
8173
|
-
if (!T) return;
|
|
8174
|
-
window.history.pushState(null, "", window.location.href);
|
|
8175
8173
|
const x = () => {
|
|
8176
|
-
d || h || r || (console.log("User attempted to use browser back navigation"), l(!0), window.history.pushState(null, "", window.location.href));
|
|
8177
|
-
},
|
|
8178
|
-
if (!(d || h || r))
|
|
8179
|
-
return
|
|
8174
|
+
k && (d || h || r || (console.log("User attempted to use browser back navigation"), l(!0), window.history.pushState(null, "", window.location.href)));
|
|
8175
|
+
}, T = (P) => {
|
|
8176
|
+
if (!(d || h || r) && (console.log("User attempted to reload or close the tab"), k))
|
|
8177
|
+
return l(!0), P.preventDefault(), P.returnValue = "", "";
|
|
8180
8178
|
};
|
|
8181
|
-
return window.addEventListener("popstate", x), window.addEventListener("beforeunload",
|
|
8182
|
-
window.removeEventListener("popstate", x), window.removeEventListener("beforeunload",
|
|
8179
|
+
return k && (window.history.pushState(null, "", window.location.href), window.addEventListener("popstate", x)), window.addEventListener("beforeunload", T), () => {
|
|
8180
|
+
window.removeEventListener("popstate", x), window.removeEventListener("beforeunload", T);
|
|
8183
8181
|
};
|
|
8184
8182
|
}, [
|
|
8185
8183
|
d,
|
|
8186
8184
|
h,
|
|
8187
8185
|
r,
|
|
8188
|
-
|
|
8186
|
+
k
|
|
8189
8187
|
]);
|
|
8190
|
-
const
|
|
8188
|
+
const A = () => {
|
|
8191
8189
|
u(!0), _(), s(!1), l(!1), t == null || t();
|
|
8192
8190
|
}, G = () => {
|
|
8193
8191
|
l(!1), i == null || i();
|
|
@@ -8203,7 +8201,7 @@ const c2 = (e) => /* @__PURE__ */ m(
|
|
|
8203
8201
|
handleClose: () => {
|
|
8204
8202
|
s(!1), p();
|
|
8205
8203
|
},
|
|
8206
|
-
handleDisqualify:
|
|
8204
|
+
handleDisqualify: A,
|
|
8207
8205
|
handleUnintendedExit: () => {
|
|
8208
8206
|
l(!0);
|
|
8209
8207
|
}
|
|
@@ -8425,13 +8423,13 @@ const c2 = (e) => /* @__PURE__ */ m(
|
|
|
8425
8423
|
const { baseColor: d } = Ii(), u = D(null), h = D(null), w = D(null), f = D(null), g = D(null), y = D(null), b = D(!1), [p, v] = C(null);
|
|
8426
8424
|
B(() => {
|
|
8427
8425
|
if (t || !h.current) return;
|
|
8428
|
-
const E = h.current,
|
|
8426
|
+
const E = h.current, k = () => {
|
|
8429
8427
|
const G = u.current;
|
|
8430
8428
|
if (!G) return;
|
|
8431
|
-
const x = E.clientWidth,
|
|
8432
|
-
G.width = Math.max(1, Math.floor(x * window.devicePixelRatio || 1)), G.height = Math.max(1, Math.floor(
|
|
8433
|
-
},
|
|
8434
|
-
return
|
|
8429
|
+
const x = E.clientWidth, T = i;
|
|
8430
|
+
G.width = Math.max(1, Math.floor(x * window.devicePixelRatio || 1)), G.height = Math.max(1, Math.floor(T * window.devicePixelRatio || 1));
|
|
8431
|
+
}, A = new ResizeObserver(k);
|
|
8432
|
+
return A.observe(E), k(), () => A.disconnect();
|
|
8435
8433
|
}, [t, i]), B(() => {
|
|
8436
8434
|
if (!t) return;
|
|
8437
8435
|
const E = u.current;
|
|
@@ -8446,8 +8444,8 @@ const c2 = (e) => /* @__PURE__ */ m(
|
|
|
8446
8444
|
let E = !1;
|
|
8447
8445
|
return (async () => {
|
|
8448
8446
|
try {
|
|
8449
|
-
const
|
|
8450
|
-
w.current =
|
|
8447
|
+
const A = new (window.AudioContext || window.webkitAudioContext)();
|
|
8448
|
+
w.current = A;
|
|
8451
8449
|
let G = a;
|
|
8452
8450
|
if (!G) {
|
|
8453
8451
|
if (!l) return;
|
|
@@ -8457,40 +8455,40 @@ const c2 = (e) => /* @__PURE__ */ m(
|
|
|
8457
8455
|
}), b.current = !0;
|
|
8458
8456
|
}
|
|
8459
8457
|
if (E) return;
|
|
8460
|
-
const x =
|
|
8458
|
+
const x = A.createAnalyser();
|
|
8461
8459
|
x.fftSize = o, x.smoothingTimeConstant = s, f.current = x;
|
|
8462
|
-
const
|
|
8463
|
-
g.current =
|
|
8464
|
-
} catch (
|
|
8465
|
-
v((
|
|
8460
|
+
const T = A.createMediaStreamSource(G);
|
|
8461
|
+
g.current = T, T.connect(x), _();
|
|
8462
|
+
} catch (A) {
|
|
8463
|
+
v((A == null ? void 0 : A.message) || "Failed to initialize microphone");
|
|
8466
8464
|
}
|
|
8467
8465
|
})(), () => {
|
|
8468
|
-
var
|
|
8466
|
+
var A, G, x, T;
|
|
8469
8467
|
E = !0, y.current && cancelAnimationFrame(y.current);
|
|
8470
8468
|
try {
|
|
8471
|
-
(
|
|
8469
|
+
(A = g.current) == null || A.disconnect();
|
|
8472
8470
|
} catch {
|
|
8473
8471
|
}
|
|
8474
8472
|
try {
|
|
8475
8473
|
(G = f.current) == null || G.disconnect();
|
|
8476
8474
|
} catch {
|
|
8477
8475
|
}
|
|
8478
|
-
b.current && ((
|
|
8476
|
+
b.current && ((T = ((x = g.current) == null ? void 0 : x.mediaStream) || void 0) == null || T.getTracks().forEach((P) => P.stop())), w.current && w.current.state !== "closed" && w.current.close();
|
|
8479
8477
|
};
|
|
8480
8478
|
}, [a, o, s, l]);
|
|
8481
8479
|
const _ = () => {
|
|
8482
|
-
const E = u.current,
|
|
8483
|
-
if (!E || !
|
|
8484
|
-
const
|
|
8485
|
-
if (!
|
|
8486
|
-
const G = window.devicePixelRatio || 1, x = E.width,
|
|
8487
|
-
y.current = requestAnimationFrame(z),
|
|
8480
|
+
const E = u.current, k = f.current;
|
|
8481
|
+
if (!E || !k) return;
|
|
8482
|
+
const A = E.getContext("2d");
|
|
8483
|
+
if (!A) return;
|
|
8484
|
+
const G = window.devicePixelRatio || 1, x = E.width, T = E.height, P = k.frequencyBinCount, j = new Uint8Array(P), z = () => {
|
|
8485
|
+
y.current = requestAnimationFrame(z), k.getByteTimeDomainData(j), A.clearRect(0, 0, x, T), A.fillStyle = "rgba(0,0,0,0)", A.fillRect(0, 0, x, T);
|
|
8488
8486
|
const X = Math.max(1, Math.floor(r * G)), O = Math.max(1, Math.floor(n * G)), U = X + O, ee = Math.max(8, Math.floor((x + O) / U)), be = Math.floor(j.length / ee);
|
|
8489
8487
|
for (let Me = 0; Me < ee; Me++) {
|
|
8490
|
-
const at = Math.min(j.length - 1, Me * be), Ke = j[at] / 128 - 1, De = Math.abs(Ke), ct = Math.pow(De, 0.6), At = Math.max(
|
|
8491
|
-
|
|
8488
|
+
const at = Math.min(j.length - 1, Me * be), Ke = j[at] / 128 - 1, De = Math.abs(Ke), ct = Math.pow(De, 0.6), At = Math.max(T * 0.06, ct * (T * 0.9)), ni = Me * U, oi = (T - At) / 2, si = 140 - Math.min(140, 140 * De), ai = 85, ci = 48 + Math.floor(12 * (1 - De));
|
|
8489
|
+
A.fillStyle = `${d}`, A.shadowColor = `hsla(${si}, ${ai}%, ${ci}%, ${0.25 * De})`, A.shadowBlur = 8 * De;
|
|
8492
8490
|
const Ut = Math.min(X / 2, At / 2);
|
|
8493
|
-
g2(
|
|
8491
|
+
g2(A, ni, oi, X, At, Ut), A.fill();
|
|
8494
8492
|
}
|
|
8495
8493
|
};
|
|
8496
8494
|
z();
|
|
@@ -8836,9 +8834,9 @@ const x2 = ({ state: e, thinkingTime: t, nextPhase: i }) => /* @__PURE__ */ m("d
|
|
|
8836
8834
|
videoFeedRef: a
|
|
8837
8835
|
}) => {
|
|
8838
8836
|
var Xi, Tr;
|
|
8839
|
-
const l = os(), { baseUrl: d, authToken: u } = Aa(), { timers: h, stt: w, proctoring: f } = gr(), g = D(null), [y, b] = C(null), [p, v] = C(""), [_, E] = C(null), [
|
|
8837
|
+
const l = os(), { baseUrl: d, authToken: u } = Aa(), { timers: h, stt: w, proctoring: f } = gr(), g = D(null), [y, b] = C(null), [p, v] = C(""), [_, E] = C(null), [k, A] = C(
|
|
8840
8838
|
Hr
|
|
8841
|
-
), [G, x] = C(!0),
|
|
8839
|
+
), [G, x] = C(!0), T = D(""), P = D(null), j = {
|
|
8842
8840
|
thinkingTime: (h == null ? void 0 : h.thinkingDuration) || 0,
|
|
8843
8841
|
// TODO: Use this to use the estimated answer duration from response
|
|
8844
8842
|
// answeringTime:
|
|
@@ -8849,7 +8847,7 @@ const x2 = ({ state: e, thinkingTime: t, nextPhase: i }) => /* @__PURE__ */ m("d
|
|
|
8849
8847
|
editingTime: G ? (h == null ? void 0 : h.editingDuration) || 30 : 0
|
|
8850
8848
|
}, { thinkingTime: z, answeringTime: X, editingTime: O } = j;
|
|
8851
8849
|
B(() => {
|
|
8852
|
-
|
|
8850
|
+
T.current = p;
|
|
8853
8851
|
}, [p]);
|
|
8854
8852
|
const [U, ee] = C(!1), be = D(!1), {
|
|
8855
8853
|
speak: Me,
|
|
@@ -8887,7 +8885,7 @@ const x2 = ({ state: e, thinkingTime: t, nextPhase: i }) => /* @__PURE__ */ m("d
|
|
|
8887
8885
|
},
|
|
8888
8886
|
onTranscriptionComplete: (V) => {
|
|
8889
8887
|
const W = V.transcript;
|
|
8890
|
-
v(W),
|
|
8888
|
+
v(W), T.current = W, ct.current || (ct.current = !0, ae());
|
|
8891
8889
|
},
|
|
8892
8890
|
onError: (V) => {
|
|
8893
8891
|
console.error("STT Error:", V), De.current || (De.current = !0, ae());
|
|
@@ -8929,7 +8927,7 @@ const x2 = ({ state: e, thinkingTime: t, nextPhase: i }) => /* @__PURE__ */ m("d
|
|
|
8929
8927
|
(async () => {
|
|
8930
8928
|
try {
|
|
8931
8929
|
const W = await l.getInterviewConfig(r);
|
|
8932
|
-
if (W != null && W.data && (W.data.duration_in_minutes &&
|
|
8930
|
+
if (W != null && W.data && (W.data.duration_in_minutes && A(W.data.duration_in_minutes), typeof W.data.allow_answer_editing == "boolean" && x(W.data.allow_answer_editing), typeof W.data.elapsed_time_in_minutes == "number")) {
|
|
8933
8931
|
const Ye = Math.floor(
|
|
8934
8932
|
W.data.elapsed_time_in_minutes * 60
|
|
8935
8933
|
);
|
|
@@ -8952,7 +8950,7 @@ const x2 = ({ state: e, thinkingTime: t, nextPhase: i }) => /* @__PURE__ */ m("d
|
|
|
8952
8950
|
},
|
|
8953
8951
|
{
|
|
8954
8952
|
onSuccess: async (V) => {
|
|
8955
|
-
V && V.data && (v(""),
|
|
8953
|
+
V && V.data && (v(""), T.current = "", b(V.data), ae());
|
|
8956
8954
|
},
|
|
8957
8955
|
onError: (V) => {
|
|
8958
8956
|
console.error("Failed to fetch questions:", V);
|
|
@@ -8961,7 +8959,7 @@ const x2 = ({ state: e, thinkingTime: t, nextPhase: i }) => /* @__PURE__ */ m("d
|
|
|
8961
8959
|
), zi = M(async () => {
|
|
8962
8960
|
var V;
|
|
8963
8961
|
try {
|
|
8964
|
-
const W =
|
|
8962
|
+
const W = T.current, Ye = ((V = P.current) == null ? void 0 : V.qna_id) || "";
|
|
8965
8963
|
G && await l.submitAnswer({
|
|
8966
8964
|
interviewId: r,
|
|
8967
8965
|
qnaId: Ye,
|
|
@@ -9108,7 +9106,7 @@ const x2 = ({ state: e, thinkingTime: t, nextPhase: i }) => /* @__PURE__ */ m("d
|
|
|
9108
9106
|
title: e,
|
|
9109
9107
|
brandName: t,
|
|
9110
9108
|
brandLogo: i,
|
|
9111
|
-
totalDuration:
|
|
9109
|
+
totalDuration: k,
|
|
9112
9110
|
elapsedTime: Ie.totalTimeElapsed,
|
|
9113
9111
|
onExit: () => {
|
|
9114
9112
|
var V;
|
|
@@ -9126,14 +9124,14 @@ const x2 = ({ state: e, thinkingTime: t, nextPhase: i }) => /* @__PURE__ */ m("d
|
|
|
9126
9124
|
phase: Ie.phase,
|
|
9127
9125
|
className: s,
|
|
9128
9126
|
interviewId: r,
|
|
9129
|
-
interview_duration:
|
|
9127
|
+
interview_duration: k,
|
|
9130
9128
|
videoFeedRef: a,
|
|
9131
9129
|
lastSubmittedAnswer: _,
|
|
9132
9130
|
onNextPhase: Ie.phase === $.ANSWERING ? Hi : ae,
|
|
9133
9131
|
answerText: p,
|
|
9134
9132
|
onAnswerChange: (V) => {
|
|
9135
9133
|
const W = V.target.value;
|
|
9136
|
-
v(W),
|
|
9134
|
+
v(W), T.current = W;
|
|
9137
9135
|
},
|
|
9138
9136
|
editingTime: O,
|
|
9139
9137
|
disableSubmitButton: Ie.phase === $.ANSWERING && U,
|