interview-widget 1.0.8 → 1.0.9

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/widget.es.js CHANGED
@@ -1,9 +1,9 @@
1
- var We = Object.defineProperty;
2
- var Ge = (i, r, t) => r in i ? We(i, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[r] = t;
3
- var F = (i, r, t) => Ge(i, typeof r != "symbol" ? r + "" : r, t);
4
- import xe, { createContext as Se, useContext as ae, useSyncExternalStore as Ie, useRef as E, useCallback as T, useMemo as ee, useState as k, useEffect as C, forwardRef as Ve, useImperativeHandle as ze } from "react";
5
- import { createPortal as He } from "react-dom";
6
- var Re = { exports: {} }, oe = {};
1
+ var He = Object.defineProperty;
2
+ var Ye = (i, r, t) => r in i ? He(i, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[r] = t;
3
+ var F = (i, r, t) => Ye(i, typeof r != "symbol" ? r + "" : r, t);
4
+ import pe, { createContext as Re, useContext as oe, useSyncExternalStore as Ae, useRef as k, useCallback as T, useMemo as ee, useState as E, useEffect as C, forwardRef as Qe, useImperativeHandle as Ke } from "react";
5
+ import { createPortal as Je } from "react-dom";
6
+ var Me = { exports: {} }, ce = {};
7
7
  /**
8
8
  * @license React
9
9
  * react-jsx-runtime.production.js
@@ -13,8 +13,8 @@ var Re = { exports: {} }, oe = {};
13
13
  * This source code is licensed under the MIT license found in the
14
14
  * LICENSE file in the root directory of this source tree.
15
15
  */
16
- var Ye = Symbol.for("react.transitional.element"), Qe = Symbol.for("react.fragment");
17
- function Ae(i, r, t) {
16
+ var Xe = Symbol.for("react.transitional.element"), Ze = Symbol.for("react.fragment");
17
+ function De(i, r, t) {
18
18
  var s = null;
19
19
  if (t !== void 0 && (s = "" + t), r.key !== void 0 && (s = "" + r.key), "key" in r) {
20
20
  t = {};
@@ -22,19 +22,19 @@ function Ae(i, r, t) {
22
22
  n !== "key" && (t[n] = r[n]);
23
23
  } else t = r;
24
24
  return r = t.ref, {
25
- $$typeof: Ye,
25
+ $$typeof: Xe,
26
26
  type: i,
27
27
  key: s,
28
28
  ref: r !== void 0 ? r : null,
29
29
  props: t
30
30
  };
31
31
  }
32
- oe.Fragment = Qe;
33
- oe.jsx = Ae;
34
- oe.jsxs = Ae;
35
- Re.exports = oe;
36
- var e = Re.exports;
37
- const me = {}, $ = {
32
+ ce.Fragment = Ze;
33
+ ce.jsx = De;
34
+ ce.jsxs = De;
35
+ Me.exports = ce;
36
+ var e = Me.exports;
37
+ const ge = {}, $ = {
38
38
  api: {
39
39
  baseUrl: "/api",
40
40
  retryConfig: {
@@ -65,66 +65,66 @@ const me = {}, $ = {
65
65
  enabled: !0
66
66
  }
67
67
  }
68
- }, be = "iw-storage";
69
- function Ke() {
70
- if (!(typeof import.meta < "u" && (me != null && me.VITE_IW_SECRET)))
68
+ }, ye = "iw-storage";
69
+ function et() {
70
+ if (!(typeof import.meta < "u" && (ge != null && ge.VITE_IW_SECRET)))
71
71
  return typeof process < "u" && process.env.NEXT_PUBLIC_IW_SECRET ? process.env.NEXT_PUBLIC_IW_SECRET : typeof window < "u" && window.__IW_SECRET__ ? window.__IW_SECRET__ : "proctoring-data-seed";
72
72
  }
73
- const Me = Ke(), ye = "AES-GCM", pe = 12;
74
- async function De(i) {
73
+ const _e = et(), Pe = 5, ve = "AES-GCM", be = 12;
74
+ async function Fe(i) {
75
75
  const t = new TextEncoder().encode(i), s = await crypto.subtle.digest("SHA-256", t);
76
- return crypto.subtle.importKey("raw", s, ye, !1, [
76
+ return crypto.subtle.importKey("raw", s, ve, !1, [
77
77
  "encrypt",
78
78
  "decrypt"
79
79
  ]);
80
80
  }
81
- function Je() {
82
- return crypto.getRandomValues(new Uint8Array(pe));
81
+ function tt() {
82
+ return crypto.getRandomValues(new Uint8Array(be));
83
83
  }
84
- async function Xe(i, r = "default-seed") {
84
+ async function it(i, r = "default-seed") {
85
85
  try {
86
- const t = typeof i == "string" ? i : JSON.stringify(i), n = new TextEncoder().encode(t), o = await De(r), a = Je(), l = await crypto.subtle.encrypt(
87
- { name: ye, iv: a },
86
+ const t = typeof i == "string" ? i : JSON.stringify(i), n = new TextEncoder().encode(t), o = await Fe(r), a = tt(), c = await crypto.subtle.encrypt(
87
+ { name: ve, iv: a },
88
88
  o,
89
89
  n
90
- ), w = new Uint8Array(a.length + l.byteLength);
91
- return w.set(new Uint8Array(a), 0), w.set(new Uint8Array(l), a.length), btoa(String.fromCharCode(...Array.from(w)));
90
+ ), w = new Uint8Array(a.length + c.byteLength);
91
+ return w.set(new Uint8Array(a), 0), w.set(new Uint8Array(c), a.length), btoa(String.fromCharCode(...Array.from(w)));
92
92
  } catch (t) {
93
93
  throw console.error("Encryption failed:", t), new Error("Failed to encrypt data");
94
94
  }
95
95
  }
96
- async function Ze(i, r = "default-seed") {
96
+ async function rt(i, r = "default-seed") {
97
97
  try {
98
98
  const t = atob(i), s = new Uint8Array(t.length);
99
99
  for (let d = 0; d < t.length; d++)
100
100
  s[d] = t.charCodeAt(d);
101
- const n = s.slice(0, pe), o = s.slice(pe), a = await De(r), l = await crypto.subtle.decrypt(
102
- { name: ye, iv: n },
101
+ const n = s.slice(0, be), o = s.slice(be), a = await Fe(r), c = await crypto.subtle.decrypt(
102
+ { name: ve, iv: n },
103
103
  a,
104
104
  o
105
105
  );
106
- return new TextDecoder().decode(l);
106
+ return new TextDecoder().decode(c);
107
107
  } catch (t) {
108
108
  throw console.error("Decryption failed:", t), new Error("Failed to decrypt data");
109
109
  }
110
110
  }
111
- async function et(i, r = "default-seed") {
112
- return Xe(i, r);
111
+ async function st(i, r = "default-seed") {
112
+ return it(i, r);
113
113
  }
114
- async function tt(i, r = "default-seed") {
115
- const t = await Ze(i, r);
114
+ async function nt(i, r = "default-seed") {
115
+ const t = await rt(i, r);
116
116
  try {
117
117
  return JSON.parse(t);
118
118
  } catch {
119
119
  return t;
120
120
  }
121
121
  }
122
- const le = Se(null), it = async () => {
122
+ const le = Re(null), at = async () => {
123
123
  var i, r;
124
124
  try {
125
- const t = sessionStorage.getItem(be);
125
+ const t = sessionStorage.getItem(ye);
126
126
  if (t) {
127
- const s = await tt(t, Me);
127
+ const s = await nt(t, _e);
128
128
  return {
129
129
  logViolations: ((i = s.state) == null ? void 0 : i.logViolations) || [],
130
130
  totalViolations: ((r = s.state) == null ? void 0 : r.totalViolations) || 0
@@ -137,28 +137,28 @@ const le = Se(null), it = async () => {
137
137
  );
138
138
  }
139
139
  return { logViolations: [], totalViolations: 0 };
140
- }, ke = async (i) => {
140
+ }, Te = async (i) => {
141
141
  try {
142
- const r = await et(
142
+ const r = await st(
143
143
  {
144
144
  state: i,
145
145
  version: 0
146
146
  },
147
- Me
147
+ _e
148
148
  );
149
- sessionStorage.setItem(be, r);
149
+ sessionStorage.setItem(ye, r);
150
150
  } catch (r) {
151
151
  console.error("Failed to save proctoring data to session storage:", r);
152
152
  }
153
- }, rt = ({
153
+ }, ot = ({
154
154
  children: i
155
155
  }) => {
156
- const r = E({
156
+ const r = k({
157
157
  logViolations: [],
158
158
  totalViolations: 0
159
- }), t = E(/* @__PURE__ */ new Set());
160
- xe.useEffect(() => {
161
- it().then((d) => {
159
+ }), t = k(/* @__PURE__ */ new Set());
160
+ pe.useEffect(() => {
161
+ at().then((d) => {
162
162
  r.current = d, s();
163
163
  });
164
164
  }, []);
@@ -171,46 +171,46 @@ const le = Se(null), it = async () => {
171
171
  r.current = {
172
172
  logViolations: [...r.current.logViolations, d],
173
173
  totalViolations: r.current.totalViolations + 1
174
- }, ke(r.current), s();
174
+ }, Te(r.current), s();
175
175
  },
176
176
  [s]
177
- ), l = T(() => {
177
+ ), c = T(() => {
178
178
  r.current = {
179
179
  logViolations: [],
180
180
  totalViolations: 0
181
- }, ke(r.current), s();
181
+ }, Te(r.current), s();
182
182
  }, [s]), w = ee(
183
183
  () => ({
184
184
  getState: o,
185
185
  addViolation: a,
186
- clearViolations: l,
186
+ clearViolations: c,
187
187
  subscribe: n
188
188
  }),
189
- [o, a, l, n]
189
+ [o, a, c, n]
190
190
  );
191
191
  return /* @__PURE__ */ e.jsx(le.Provider, { value: w, children: i });
192
- }, st = () => {
193
- const i = ae(le);
192
+ }, ct = () => {
193
+ const i = oe(le);
194
194
  if (!i)
195
195
  throw new Error("useViolations must be used within a ProctoringProvider");
196
- return Ie(
196
+ return Ae(
197
197
  i.subscribe,
198
198
  () => i.getState().logViolations,
199
199
  () => i.getState().logViolations
200
200
  );
201
- }, nt = () => {
202
- const i = ae(le);
201
+ }, lt = () => {
202
+ const i = oe(le);
203
203
  if (!i)
204
204
  throw new Error(
205
205
  "useTotalViolations must be used within a ProctoringProvider"
206
206
  );
207
- return Ie(
207
+ return Ae(
208
208
  i.subscribe,
209
209
  () => i.getState().totalViolations,
210
210
  () => i.getState().totalViolations
211
211
  );
212
- }, at = () => {
213
- const i = ae(le);
212
+ }, dt = () => {
213
+ const i = oe(le);
214
214
  if (!i)
215
215
  throw new Error(
216
216
  "useProctoringActions must be used within a ProctoringProvider"
@@ -219,10 +219,10 @@ const le = Se(null), it = async () => {
219
219
  addViolation: i.addViolation,
220
220
  clearViolations: i.clearViolations
221
221
  };
222
- }, _e = Se(
222
+ }, Le = Re(
223
223
  null
224
224
  );
225
- function ot({
225
+ function wt({
226
226
  config: i = {},
227
227
  children: r
228
228
  }) {
@@ -257,26 +257,26 @@ function ot({
257
257
  }
258
258
  }
259
259
  };
260
- return /* @__PURE__ */ e.jsx(_e.Provider, { value: t, children: /* @__PURE__ */ e.jsx(rt, { children: r }) });
260
+ return /* @__PURE__ */ e.jsx(Le.Provider, { value: t, children: /* @__PURE__ */ e.jsx(ot, { children: r }) });
261
261
  }
262
- function ce() {
263
- const i = ae(_e);
262
+ function de() {
263
+ const i = oe(Le);
264
264
  if (!i)
265
265
  throw new Error(
266
266
  "useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>"
267
267
  );
268
268
  return i;
269
269
  }
270
- function Pe() {
271
- return ce().api || $.api;
270
+ function $e() {
271
+ return de().api || $.api;
272
272
  }
273
273
  function te() {
274
- return ce().ui || $.ui;
274
+ return de().ui || $.ui;
275
275
  }
276
- function lt() {
277
- return ce().interview || $.interview;
276
+ function ut() {
277
+ return de().interview || $.interview;
278
278
  }
279
- const Fe = ({
279
+ const Oe = ({
280
280
  className: i,
281
281
  ...r
282
282
  }) => /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs(
@@ -305,7 +305,7 @@ const Fe = ({
305
305
  /* @__PURE__ */ e.jsx("path", { d: "M7.75 7.75l-2.15 -2.15" })
306
306
  ]
307
307
  }
308
- ) }), Le = ({
308
+ ) }), Ue = ({
309
309
  children: i,
310
310
  variant: r = "primary",
311
311
  size: t = "md",
@@ -313,7 +313,7 @@ const Fe = ({
313
313
  isLoading: n = !1,
314
314
  disabled: o,
315
315
  className: a = "",
316
- ...l
316
+ ...c
317
317
  }) => {
318
318
  const w = "iw-inline-flex iw-items-center iw-justify-center iw-rounded-md iw-font-medium iw-transition-colors iw-focus:outline-none iw-focus:ring-2 iw-focus:ring-primary-500 iw-focus:ring-offset-2", d = {
319
319
  primary: "iw-bg-primary-600 iw-text-white iw-hover:bg-primary-700 iw-border iw-border-transparent",
@@ -331,15 +331,15 @@ const Fe = ({
331
331
  {
332
332
  className: `${w} ${d[r]} ${u[t]} ${m} ${h} ${a}`,
333
333
  disabled: o || n,
334
- ...l,
334
+ ...c,
335
335
  children: [
336
- n && /* @__PURE__ */ e.jsx(Fe, { height: 16, width: 16, style: { marginRight: "3px" } }),
336
+ n && /* @__PURE__ */ e.jsx(Oe, { height: 16, width: 16, style: { marginRight: "3px" } }),
337
337
  i
338
338
  ]
339
339
  }
340
340
  );
341
341
  };
342
- function ct(i) {
342
+ function ht(i) {
343
343
  const r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);
344
344
  return r ? {
345
345
  r: parseInt(r[1], 16),
@@ -347,32 +347,32 @@ function ct(i) {
347
347
  b: parseInt(r[3], 16)
348
348
  } : null;
349
349
  }
350
- function dt(i, r, t) {
350
+ function mt(i, r, t) {
351
351
  return "#" + [i, r, t].map((s) => {
352
352
  const n = Math.round(s).toString(16);
353
353
  return n.length === 1 ? "0" + n : n;
354
354
  }).join("");
355
355
  }
356
- function $e(i, r) {
357
- const t = ct(i);
356
+ function qe(i, r) {
357
+ const t = ht(i);
358
358
  if (!t) return i;
359
359
  const s = t.r + (255 - t.r) * r, n = t.g + (255 - t.g) * r, o = t.b + (255 - t.b) * r;
360
- return dt(s, n, o);
360
+ return mt(s, n, o);
361
361
  }
362
- function wt(i, r = 0.8) {
362
+ function gt(i, r = 0.8) {
363
363
  return {
364
- background: `linear-gradient(to bottom, ${$e(i, r)}, #ffffff)`,
364
+ background: `linear-gradient(to bottom, ${qe(i, r)}, #ffffff)`,
365
365
  color: "#1f2937"
366
366
  };
367
367
  }
368
- function ut(i) {
368
+ function ft(i) {
369
369
  return new Promise((r) => setTimeout(r, i));
370
370
  }
371
- function Oe(i) {
372
- return `linear-gradient(to left, ${$e(i, 0.4)}, ${i})`;
371
+ function Be(i) {
372
+ return `linear-gradient(to left, ${qe(i, 0.4)}, ${i})`;
373
373
  }
374
- const ht = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
375
- function mt(i) {
374
+ const xt = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
375
+ function pt(i) {
376
376
  try {
377
377
  const r = i.split(".");
378
378
  if (r.length !== 3 || !r[1])
@@ -386,7 +386,7 @@ function mt(i) {
386
386
  return console.error("Error decoding JWT:", r), null;
387
387
  }
388
388
  }
389
- const qe = (i) => /* @__PURE__ */ e.jsxs(
389
+ const We = (i) => /* @__PURE__ */ e.jsxs(
390
390
  "svg",
391
391
  {
392
392
  xmlns: "http://www.w3.org/2000/svg",
@@ -404,7 +404,7 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
404
404
  /* @__PURE__ */ e.jsx("path", { d: "m9 12 2 2 4-4" })
405
405
  ]
406
406
  }
407
- ), Ue = (i) => /* @__PURE__ */ e.jsxs(
407
+ ), Ve = (i) => /* @__PURE__ */ e.jsxs(
408
408
  "svg",
409
409
  {
410
410
  xmlns: "http://www.w3.org/2000/svg",
@@ -423,7 +423,7 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
423
423
  /* @__PURE__ */ e.jsx("line", { x1: "12", x2: "12", y1: "17", y2: "21" })
424
424
  ]
425
425
  }
426
- ), gt = (i) => /* @__PURE__ */ e.jsxs(
426
+ ), bt = (i) => /* @__PURE__ */ e.jsxs(
427
427
  "svg",
428
428
  {
429
429
  xmlns: "http://www.w3.org/2000/svg",
@@ -442,52 +442,52 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
442
442
  /* @__PURE__ */ e.jsx("path", { d: "M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a.8 .8 0 0 1 1.5 .5v14a.8 .8 0 0 1 -1.5 .5l-3.5 -4.5" })
443
443
  ]
444
444
  }
445
- ), V = (i) => {
445
+ ), G = (i) => {
446
446
  const { baseColor: r, borderRadius: t } = te(), { loading: s, children: n, ...o } = i;
447
447
  return /* @__PURE__ */ e.jsx(
448
- Le,
448
+ Ue,
449
449
  {
450
450
  style: {
451
- background: Oe(r),
451
+ background: Be(r),
452
452
  borderRadius: t
453
453
  },
454
454
  ...o,
455
- children: s ? /* @__PURE__ */ e.jsx(Fe, {}) : n
455
+ children: s ? /* @__PURE__ */ e.jsx(Oe, {}) : n
456
456
  }
457
457
  );
458
- }, ft = [
458
+ }, yt = [
459
459
  "Do not refresh or reload the page during your assessment",
460
460
  "Refrain from switching tabs or opening other applications while the session is in progress",
461
461
  "Ensure your face remains clearly visible on camera at all times",
462
462
  "Avoid frequent distractions or leaving your seat during the session",
463
463
  "Do not disable or interfere with audio/video monitoring"
464
- ], xt = ({
464
+ ], vt = ({
465
465
  isOpen: i,
466
466
  onStart: r,
467
467
  onClose: t
468
468
  }) => {
469
- var A;
470
- const s = E(null), n = E(null), { baseColor: o, borderRadius: a } = te(), [l, w] = k(!1), [d, u] = k(null), [h, m] = k(!1), c = o ?? "#2563eb", x = Oe(c), p = a ?? 18, j = (f, M) => f.startsWith("#") && f.length === 7 ? `${f}${M}` : f, g = [
471
- `radial-gradient(120% 85% at 50% 125%, ${j(
472
- c,
469
+ var M;
470
+ const s = k(null), n = k(null), { baseColor: o, borderRadius: a } = te(), [c, w] = E(!1), [d, u] = E(null), [h, m] = E(!1), l = o ?? "#2563eb", p = Be(l), b = a ?? 18, y = (x, D) => x.startsWith("#") && x.length === 7 ? `${x}${D}` : x, g = [
471
+ `radial-gradient(120% 85% at 50% 125%, ${y(
472
+ l,
473
473
  "34"
474
474
  )} 0%, transparent 70%)`,
475
- `radial-gradient(90% 70% at 10% 130%, ${j(
476
- c,
475
+ `radial-gradient(90% 70% at 10% 130%, ${y(
476
+ l,
477
477
  "24"
478
478
  )} 0%, transparent 72%)`,
479
- `radial-gradient(90% 70% at 90% 130%, ${j(
480
- c,
479
+ `radial-gradient(90% 70% at 90% 130%, ${y(
480
+ l,
481
481
  "24"
482
482
  )} 0%, transparent 72%)`,
483
- `repeating-linear-gradient(135deg, ${j(
484
- c,
483
+ `repeating-linear-gradient(135deg, ${y(
484
+ l,
485
485
  "14"
486
- )} 0, ${j(
487
- c,
486
+ )} 0, ${y(
487
+ l,
488
488
  "14"
489
489
  )} 16px, transparent 16px, transparent 32px)`
490
- ].join(", "), y = l ? {
490
+ ].join(", "), f = c ? {
491
491
  label: "Camera & microphone ready",
492
492
  toneClass: "iw-bg-white/15 iw-text-white",
493
493
  dotClass: "iw-bg-emerald-400"
@@ -499,7 +499,7 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
499
499
  label: "Allow access to continue",
500
500
  toneClass: "iw-bg-white/15 iw-text-white",
501
501
  dotClass: "iw-bg-rose-300"
502
- }, S = l ? {
502
+ }, S = c ? {
503
503
  badge: "Ready",
504
504
  toneClass: "iw-bg-emerald-50 iw-text-emerald-600",
505
505
  cameraCopy: "Framing looks good for identity verification.",
@@ -514,57 +514,57 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
514
514
  toneClass: "iw-bg-rose-50 iw-text-rose-600",
515
515
  cameraCopy: "Grant camera access to continue with the interview.",
516
516
  micCopy: "Enable microphone access so we can capture your answers."
517
- }, N = [
517
+ }, j = [
518
518
  {
519
519
  label: "Camera feed",
520
520
  description: S.cameraCopy,
521
521
  status: S.badge,
522
522
  toneClass: S.toneClass,
523
- Icon: Ue
523
+ Icon: Ve
524
524
  },
525
525
  {
526
526
  label: "Microphone input",
527
527
  description: S.micCopy,
528
528
  status: S.badge,
529
529
  toneClass: S.toneClass,
530
- Icon: gt
530
+ Icon: bt
531
531
  }
532
- ], _ = () => {
533
- n.current && (n.current.getTracks().forEach((f) => f.stop()), n.current = null);
534
- }, v = async () => {
532
+ ], R = () => {
533
+ n.current && (n.current.getTracks().forEach((x) => x.stop()), n.current = null);
534
+ }, N = async () => {
535
535
  m(!0), u(null);
536
536
  try {
537
- const f = await navigator.mediaDevices.getUserMedia({
537
+ const x = await navigator.mediaDevices.getUserMedia({
538
538
  video: { width: { ideal: 1280 }, height: { ideal: 720 } },
539
539
  audio: !0
540
540
  });
541
- n.current = f, s.current && (s.current.srcObject = f), w(!0);
542
- } catch (f) {
543
- console.error("Media permission error:", f);
544
- let M = "Unable to access camera or microphone.";
545
- (f == null ? void 0 : f.name) === "NotAllowedError" ? M = "Permissions denied. Please allow access to camera and microphone." : (f == null ? void 0 : f.name) === "NotFoundError" ? M = "No camera/microphone found. Please connect a device and retry." : f != null && f.message && (M = f.message), w(!1), u(M);
541
+ n.current = x, s.current && (s.current.srcObject = x), w(!0);
542
+ } catch (x) {
543
+ console.error("Media permission error:", x);
544
+ let D = "Unable to access camera or microphone.";
545
+ (x == null ? void 0 : x.name) === "NotAllowedError" ? D = "Permissions denied. Please allow access to camera and microphone." : (x == null ? void 0 : x.name) === "NotFoundError" ? D = "No camera/microphone found. Please connect a device and retry." : x != null && x.message && (D = x.message), w(!1), u(D);
546
546
  } finally {
547
547
  m(!1);
548
548
  }
549
549
  };
550
550
  if (C(() => {
551
551
  if (!i) {
552
- _();
552
+ R();
553
553
  return;
554
554
  }
555
- return v(), () => {
556
- _();
555
+ return N(), () => {
556
+ R();
557
557
  };
558
558
  }, [i]), !i) return null;
559
- const R = () => {
560
- r(), _();
559
+ const A = () => {
560
+ r(), R();
561
561
  };
562
562
  return /* @__PURE__ */ e.jsx("div", { className: "iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-gray-900/25 iw-backdrop-blur-md iw-p-4", children: /* @__PURE__ */ e.jsxs("div", { className: " iw-w-full iw-max-w-[920px] iw-max-h-[96vh] iw-overflow-auto iw-rounded-3xl iw-bg-white iw-shadow-[0_40px_80px_-28px_rgba(15,23,42,0.25)]", children: [
563
563
  /* @__PURE__ */ e.jsxs(
564
564
  "div",
565
565
  {
566
566
  className: "iw-relative iw-overflow-hidden",
567
- style: { background: x },
567
+ style: { background: p },
568
568
  children: [
569
569
  /* @__PURE__ */ e.jsx(
570
570
  "div",
@@ -598,7 +598,7 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
598
598
  ),
599
599
  /* @__PURE__ */ e.jsxs("div", { className: "iw-relative iw-grid md:iw-grid-cols-[minmax(0,1fr)_auto] iw-items-start iw-gap-6 iw-px-6 iw-py-7", children: [
600
600
  /* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-flex-col iw-gap-4 iw-text-white", children: /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-start iw-gap-4", children: [
601
- /* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-h-12 iw-w-12 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-white/15 iw-shadow-inner", children: /* @__PURE__ */ e.jsx(qe, { className: "iw-h-6 iw-w-6" }) }),
601
+ /* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-h-12 iw-w-12 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-white/15 iw-shadow-inner", children: /* @__PURE__ */ e.jsx(We, { className: "iw-h-6 iw-w-6" }) }),
602
602
  /* @__PURE__ */ e.jsxs("div", { children: [
603
603
  /* @__PURE__ */ e.jsx("p", { className: "iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-white/70", children: "Pre-interview checklist" }),
604
604
  /* @__PURE__ */ e.jsx("h2", { className: "iw-mt-1 iw-text-xl iw-font-semibold iw-leading-tight", children: "Final checks before you go live" }),
@@ -608,15 +608,15 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
608
608
  /* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-items-start iw-justify-end", children: /* @__PURE__ */ e.jsxs(
609
609
  "div",
610
610
  {
611
- className: `iw-inline-flex iw-items-center iw-gap-2 iw-rounded-full iw-bg-white/10 iw-px-4 iw-py-1.5 iw-text-xs iw-font-medium iw-text-white/85 iw-backdrop-blur-sm ${y.toneClass}`,
611
+ className: `iw-inline-flex iw-items-center iw-gap-2 iw-rounded-full iw-bg-white/10 iw-px-4 iw-py-1.5 iw-text-xs iw-font-medium iw-text-white/85 iw-backdrop-blur-sm ${f.toneClass}`,
612
612
  children: [
613
613
  /* @__PURE__ */ e.jsx(
614
614
  "span",
615
615
  {
616
- className: `iw-inline-flex iw-h-2 iw-w-2 iw-rounded-full ${y.dotClass}`
616
+ className: `iw-inline-flex iw-h-2 iw-w-2 iw-rounded-full ${f.dotClass}`
617
617
  }
618
618
  ),
619
- y.label
619
+ f.label
620
620
  ]
621
621
  }
622
622
  ) }),
@@ -626,7 +626,7 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
626
626
  "aria-label": "Close",
627
627
  className: "iw-absolute iw-top-5 iw-right-5 iw-text-white/70 transition-colors hover:iw-text-white",
628
628
  onClick: () => {
629
- _(), t == null || t();
629
+ R(), t == null || t();
630
630
  },
631
631
  children: "✕"
632
632
  }
@@ -642,7 +642,7 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
642
642
  /* @__PURE__ */ e.jsx("h3", { className: "iw-text-sm iw-font-semibold iw-text-slate-900", children: "Proctoring guidelines" }),
643
643
  /* @__PURE__ */ e.jsx("span", { className: "iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-slate-400", children: "Required" })
644
644
  ] }),
645
- /* @__PURE__ */ e.jsx("ul", { className: "iw-mt-5 iw-flex iw-flex-col iw-gap-4", children: ft.map((f, M) => /* @__PURE__ */ e.jsx(
645
+ /* @__PURE__ */ e.jsx("ul", { className: "iw-mt-5 iw-flex iw-flex-col iw-gap-4", children: yt.map((x, D) => /* @__PURE__ */ e.jsx(
646
646
  "li",
647
647
  {
648
648
  className: "iw-group iw-overflow-hidden iw-rounded-xl iw-border iw-border-slate-100 iw-bg-slate-50/60 iw-p-4 iw-transition-all hover:iw-border-slate-200 hover:iw-bg-white",
@@ -651,14 +651,14 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
651
651
  "span",
652
652
  {
653
653
  className: "iw-flex iw-h-8 iw-w-8 iw-flex-none iw-items-center iw-justify-center iw-rounded-full iw-text-sm iw-font-semibold iw-text-white",
654
- style: { background: x },
655
- children: M + 1
654
+ style: { background: p },
655
+ children: D + 1
656
656
  }
657
657
  ),
658
- /* @__PURE__ */ e.jsx("span", { className: "iw-text-sm iw-text-slate-600", children: f })
658
+ /* @__PURE__ */ e.jsx("span", { className: "iw-text-sm iw-text-slate-600", children: x })
659
659
  ] })
660
660
  },
661
- f
661
+ x
662
662
  )) })
663
663
  ] }) }),
664
664
  /* @__PURE__ */ e.jsxs("section", { className: "iw-flex iw-flex-col iw-gap-5", children: [
@@ -666,7 +666,7 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
666
666
  "div",
667
667
  {
668
668
  className: "iw-relative iw-flex iw-flex-col iw-gap-6 iw-overflow-hidden iw-rounded-3xl iw-bg-white ",
669
- style: { borderRadius: p },
669
+ style: { borderRadius: b },
670
670
  children: [
671
671
  /* @__PURE__ */ e.jsx("div", { className: "iw-relative iw-z-10 iw-rounded-2xl iw-border iw-border-slate-200 iw-bg-slate-50/80 iw-p-3", children: /* @__PURE__ */ e.jsx(
672
672
  "video",
@@ -678,35 +678,35 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
678
678
  className: "iw-h-64 iw-w-full iw-rounded-2xl iw-object-cover",
679
679
  style: {
680
680
  transform: "scaleX(-1)",
681
- borderRadius: p
681
+ borderRadius: b
682
682
  }
683
683
  }
684
684
  ) }),
685
685
  /* @__PURE__ */ e.jsxs("div", { className: "iw-relative iw-grid iw-grid-cols-2 iw-gap-4 iw-px-1", children: [
686
686
  /* @__PURE__ */ e.jsx(
687
- Le,
687
+ Ue,
688
688
  {
689
- onClick: v,
689
+ onClick: N,
690
690
  disabled: h,
691
691
  variant: "outline",
692
692
  size: "sm",
693
693
  className: "iw-font-medium",
694
694
  style: {
695
- borderColor: c,
696
- borderRadius: p,
697
- color: c
695
+ borderColor: l,
696
+ borderRadius: b,
697
+ color: l
698
698
  },
699
- children: l ? "Recheck permissions" : "Enable camera & mic"
699
+ children: c ? "Recheck permissions" : "Enable camera & mic"
700
700
  }
701
701
  ),
702
702
  /* @__PURE__ */ e.jsx(
703
- V,
703
+ G,
704
704
  {
705
- onClick: R,
706
- disabled: !l,
705
+ onClick: A,
706
+ disabled: !c,
707
707
  className: "iw-h-10 iw-px-6 iw-text-sm",
708
708
  style: {
709
- backgroundColor: c
709
+ backgroundColor: l
710
710
  },
711
711
  children: "Proceed"
712
712
  }
@@ -715,20 +715,20 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
715
715
  ]
716
716
  }
717
717
  ),
718
- /* @__PURE__ */ e.jsx("ul", { className: "iw-grid sm:iw-grid-cols-1 iw-gap-3", children: N.map(
719
- ({ Icon: f, label: M, description: L, status: O, toneClass: U }) => /* @__PURE__ */ e.jsx(
718
+ /* @__PURE__ */ e.jsx("ul", { className: "iw-grid sm:iw-grid-cols-1 iw-gap-3", children: j.map(
719
+ ({ Icon: x, label: D, description: L, status: O, toneClass: B }) => /* @__PURE__ */ e.jsx(
720
720
  "li",
721
721
  {
722
722
  className: "iw-rounded-2xl iw-border iw-border-slate-200/65 iw-bg-white iw-p-4 iw-shadow-sm iw-transition-all hover:iw-border-slate-200",
723
723
  children: /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-start iw-gap-3", children: [
724
- /* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-h-10 iw-w-10 iw-flex-none iw-items-center iw-justify-center iw-rounded-xl iw-bg-slate-100", children: /* @__PURE__ */ e.jsx(f, { className: "iw-h-5 iw-w-5 iw-text-slate-600" }) }),
724
+ /* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-h-10 iw-w-10 iw-flex-none iw-items-center iw-justify-center iw-rounded-xl iw-bg-slate-100", children: /* @__PURE__ */ e.jsx(x, { className: "iw-h-5 iw-w-5 iw-text-slate-600" }) }),
725
725
  /* @__PURE__ */ e.jsxs("div", { className: "iw-flex-1", children: [
726
726
  /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between iw-gap-3", children: [
727
- /* @__PURE__ */ e.jsx("p", { className: "iw-text-sm iw-font-medium iw-text-slate-800", children: M }),
727
+ /* @__PURE__ */ e.jsx("p", { className: "iw-text-sm iw-font-medium iw-text-slate-800", children: D }),
728
728
  /* @__PURE__ */ e.jsx(
729
729
  "span",
730
730
  {
731
- className: `iw-rounded-full iw-px-3 iw-py-1 iw-text-[11px] iw-font-semibold ${U}`,
731
+ className: `iw-rounded-full iw-px-3 iw-py-1 iw-text-[11px] iw-font-semibold ${B}`,
732
732
  children: O
733
733
  }
734
734
  )
@@ -737,11 +737,11 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
737
737
  ] })
738
738
  ] })
739
739
  },
740
- M
740
+ D
741
741
  )
742
742
  ) }),
743
743
  d && /* @__PURE__ */ e.jsx("div", { className: "iw-rounded-lg iw-border iw-border-rose-200 iw-bg-rose-50 iw-px-3 iw-py-2 iw-text-xs iw-text-rose-600", children: d }),
744
- !((A = navigator.mediaDevices) != null && A.getUserMedia) && /* @__PURE__ */ e.jsx("div", { className: "iw-rounded-lg iw-border iw-border-amber-200 iw-bg-amber-50 iw-px-3 iw-py-2 iw-text-xs iw-text-amber-700", children: "Your browser does not support media devices. Please use a modern browser like Chrome, Edge, or Firefox." })
744
+ !((M = navigator.mediaDevices) != null && M.getUserMedia) && /* @__PURE__ */ e.jsx("div", { className: "iw-rounded-lg iw-border iw-border-amber-200 iw-bg-amber-50 iw-px-3 iw-py-2 iw-text-xs iw-text-amber-700", children: "Your browser does not support media devices. Please use a modern browser like Chrome, Edge, or Firefox." })
745
745
  ] })
746
746
  ] }),
747
747
  /* @__PURE__ */ e.jsx("div", { className: " iw-rounded-2xl iw-border iw-border-dashed iw-border-slate-200 iw-bg-slate-50/85 iw-px-5 iw-py-4 iw-text-center", children: /* @__PURE__ */ e.jsx("div", { className: "iw-text-xs iw-text-slate-500", children: "Your session is monitored to protect exam integrity. Continuing confirms you have reviewed and accept these safeguards." }) }),
@@ -765,12 +765,12 @@ const qe = (i) => /* @__PURE__ */ e.jsxs(
765
765
  ] })
766
766
  ] }) });
767
767
  };
768
- var D = /* @__PURE__ */ ((i) => (i.IDLE = "idle", i.FETCHING_QUESTION = "fetching_question", i.READING_QUESTION = "reading_question", i.THINKING = "thinking", i.ANSWERING = "answering", i.TRANSCRIBING = "transcribing", i.EDITING = "editing", i.SUBMITTING = "submitting", i.COMPLETED = "completed", i))(D || {});
769
- const pt = {
768
+ var _ = /* @__PURE__ */ ((i) => (i.IDLE = "idle", i.FETCHING_QUESTION = "fetching_question", i.READING_QUESTION = "reading_question", i.THINKING = "thinking", i.ANSWERING = "answering", i.TRANSCRIBING = "transcribing", i.EDITING = "editing", i.SUBMITTING = "submitting", i.COMPLETED = "completed", i))(_ || {});
769
+ const jt = {
770
770
  thinkingDuration: 30,
771
771
  answeringDuration: 120,
772
772
  editingDuration: 30
773
- }, bt = {
773
+ }, Nt = {
774
774
  idle: {
775
775
  next: "fetching_question"
776
776
  /* FETCHING_QUESTION */
@@ -799,14 +799,14 @@ const pt = {
799
799
  /* COMPLETED */
800
800
  }
801
801
  };
802
- class yt {
802
+ class kt {
803
803
  constructor(r = {}, t = {}) {
804
804
  F(this, "config");
805
805
  F(this, "state");
806
806
  F(this, "phaseIntervalId", null);
807
807
  F(this, "globalIntervalId", null);
808
808
  F(this, "callbacks");
809
- this.config = { ...pt, ...r }, this.callbacks = t, this.state = {
809
+ this.config = { ...jt, ...r }, this.callbacks = t, this.state = {
810
810
  phase: "idle",
811
811
  currentPhaseTimeRemaining: 0,
812
812
  totalTimeElapsed: 0,
@@ -829,7 +829,7 @@ class yt {
829
829
  * Move to next phase
830
830
  */
831
831
  nextPhase() {
832
- const r = this.state.phase, t = bt[r];
832
+ const r = this.state.phase, t = Nt[r];
833
833
  if (!t) return;
834
834
  this.stopPhaseTimer(), this.state.phase = t.next;
835
835
  const s = this.getDurationForPhase(t.next);
@@ -900,38 +900,38 @@ class yt {
900
900
  (t = (r = this.callbacks).onPhaseChange) == null || t.call(r, this.state.phase, this.getState());
901
901
  }
902
902
  }
903
- function vt(i = {}) {
904
- const { config: r = {}, callbacks: t = {} } = i, s = E(null);
905
- s.current || (s.current = new yt(r, {}));
906
- const n = s.current, [o, a] = k(n.getState()), l = T(() => {
903
+ function Et(i = {}) {
904
+ const { config: r = {}, callbacks: t = {} } = i, s = k(null);
905
+ s.current || (s.current = new kt(r, {}));
906
+ const n = s.current, [o, a] = E(n.getState()), c = T(() => {
907
907
  a(n.getState());
908
908
  }, [n]);
909
909
  C(() => {
910
910
  const h = {
911
- onPhaseChange: (m, c) => {
912
- var x;
913
- l(), (x = t.onPhaseChange) == null || x.call(t, m, c);
911
+ onPhaseChange: (m, l) => {
912
+ var p;
913
+ c(), (p = t.onPhaseChange) == null || p.call(t, m, l);
914
914
  },
915
915
  onTick: (m) => {
916
- var c;
917
- l(), (c = t.onTick) == null || c.call(t, m);
916
+ var l;
917
+ c(), (l = t.onTick) == null || l.call(t, m);
918
918
  },
919
919
  onInterviewEnd: () => {
920
920
  var m;
921
- l(), (m = t.onInterviewEnd) == null || m.call(t);
921
+ c(), (m = t.onInterviewEnd) == null || m.call(t);
922
922
  }
923
923
  };
924
924
  n.callbacks = h;
925
- }, [n, t, l]), C(() => () => {
925
+ }, [n, t, c]), C(() => () => {
926
926
  n.destroy();
927
927
  }, [n]);
928
928
  const w = T(() => {
929
- n.startQuestion(), l();
930
- }, [n, l]), d = T(() => {
931
- n.nextPhase(), l();
932
- }, [n, l]), u = T(() => {
933
- n.completeInterview(), l();
934
- }, [n, l]);
929
+ n.startQuestion(), c();
930
+ }, [n, c]), d = T(() => {
931
+ n.nextPhase(), c();
932
+ }, [n, c]), u = T(() => {
933
+ n.completeInterview(), c();
934
+ }, [n, c]);
935
935
  return {
936
936
  state: o,
937
937
  startQuestion: w,
@@ -940,14 +940,14 @@ function vt(i = {}) {
940
940
  timerService: n
941
941
  };
942
942
  }
943
- function jt(i, r = {}) {
944
- const [t, s] = k({
943
+ function Tt(i, r = {}) {
944
+ const [t, s] = E({
945
945
  data: null,
946
946
  loading: !1,
947
947
  error: null
948
948
  }), n = T(
949
949
  async (...o) => {
950
- var a, l, w, d;
950
+ var a, c, w, d;
951
951
  s((u) => ({ ...u, loading: !0, error: null }));
952
952
  try {
953
953
  const u = await i(...o);
@@ -956,7 +956,7 @@ function jt(i, r = {}) {
956
956
  data: u,
957
957
  loading: !1,
958
958
  error: null
959
- })), (a = r.onSuccess) == null || a.call(r, u), (l = r.onSettled) == null || l.call(r, u, null);
959
+ })), (a = r.onSuccess) == null || a.call(r, u), (c = r.onSettled) == null || c.call(r, u, null);
960
960
  } catch (u) {
961
961
  const h = u.type ? u : {
962
962
  type: "unknown",
@@ -979,67 +979,67 @@ function jt(i, r = {}) {
979
979
  execute: n
980
980
  };
981
981
  }
982
- const Nt = (i) => {
983
- const [r, t] = k(null), [s, n] = k(!1), o = document, a = () => !!(o.fullscreenEnabled || o.webkitFullscreenEnabled || o.mozFullScreenEnabled || o.msFullscreenEnabled), l = () => o.fullscreenElement || o.webkitFullscreenElement || o.mozFullScreenElement || o.msFullscreenElement, w = async (c) => {
984
- var x;
982
+ const St = (i) => {
983
+ const [r, t] = E(null), [s, n] = E(!1), o = document, a = () => !!(o.fullscreenEnabled || o.webkitFullscreenEnabled || o.mozFullScreenEnabled || o.msFullscreenEnabled), c = () => o.fullscreenElement || o.webkitFullscreenElement || o.mozFullScreenElement || o.msFullscreenElement, w = async (l) => {
984
+ var p;
985
985
  try {
986
986
  if (!a())
987
987
  throw new Error("Fullscreen is not supported in this environment");
988
- c.requestFullscreen ? await c.requestFullscreen() : c.webkitRequestFullscreen ? await c.webkitRequestFullscreen() : c.mozRequestFullScreen ? await c.mozRequestFullScreen() : c.msRequestFullscreen && await c.msRequestFullscreen();
989
- } catch (p) {
990
- const j = {
988
+ l.requestFullscreen ? await l.requestFullscreen() : l.webkitRequestFullscreen ? await l.webkitRequestFullscreen() : l.mozRequestFullScreen ? await l.mozRequestFullScreen() : l.msRequestFullscreen && await l.msRequestFullscreen();
989
+ } catch (b) {
990
+ const y = {
991
991
  name: "FullscreenError",
992
- message: p instanceof Error ? p.message : "Failed to enter fullscreen"
992
+ message: b instanceof Error ? b.message : "Failed to enter fullscreen"
993
993
  };
994
- t(j), (x = i == null ? void 0 : i.onError) == null || x.call(i, j);
994
+ t(y), (p = i == null ? void 0 : i.onError) == null || p.call(i, y);
995
995
  }
996
996
  }, d = async () => {
997
- var c;
997
+ var l;
998
998
  try {
999
999
  o.exitFullscreen ? await o.exitFullscreen() : o.webkitExitFullscreen ? await o.webkitExitFullscreen() : o.mozCancelFullScreen ? await o.mozCancelFullScreen() : o.msExitFullscreen && await o.msExitFullscreen();
1000
- } catch (x) {
1001
- const p = {
1000
+ } catch (p) {
1001
+ const b = {
1002
1002
  name: "FullscreenError",
1003
- message: x instanceof Error ? x.message : "Failed to exit fullscreen"
1003
+ message: p instanceof Error ? p.message : "Failed to exit fullscreen"
1004
1004
  };
1005
- t(p), (c = i == null ? void 0 : i.onError) == null || c.call(i, p);
1005
+ t(b), (l = i == null ? void 0 : i.onError) == null || l.call(i, b);
1006
1006
  }
1007
1007
  }, u = T(() => {
1008
- var x;
1009
- const c = !!l();
1010
- n(c), (x = i == null ? void 0 : i.onFullScreenChange) == null || x.call(i, c);
1008
+ var p;
1009
+ const l = !!c();
1010
+ n(l), (p = i == null ? void 0 : i.onFullScreenChange) == null || p.call(i, l);
1011
1011
  }, [i]);
1012
1012
  C(() => {
1013
- const c = [
1013
+ const l = [
1014
1014
  "fullscreenchange",
1015
1015
  "webkitfullscreenchange",
1016
1016
  "mozfullscreenchange",
1017
1017
  "MSFullscreenChange"
1018
1018
  ];
1019
- return c.forEach((x) => {
1020
- document.addEventListener(x, u);
1019
+ return l.forEach((p) => {
1020
+ document.addEventListener(p, u);
1021
1021
  }), () => {
1022
- c.forEach((x) => {
1023
- document.removeEventListener(x, u);
1022
+ l.forEach((p) => {
1023
+ document.removeEventListener(p, u);
1024
1024
  });
1025
1025
  };
1026
1026
  }, [u]);
1027
- const h = async (c) => {
1027
+ const h = async (l) => {
1028
1028
  t(null);
1029
- const x = c ?? document.documentElement;
1030
- await w(x);
1029
+ const p = l ?? document.documentElement;
1030
+ await w(p);
1031
1031
  };
1032
1032
  return {
1033
1033
  isFullScreen: s,
1034
- toggleFullScreen: async (c) => {
1035
- s ? await d() : await h(c);
1034
+ toggleFullScreen: async (l) => {
1035
+ s ? await d() : await h(l);
1036
1036
  },
1037
1037
  enterFullScreen: h,
1038
1038
  exitFullScreen: d,
1039
1039
  error: r
1040
1040
  };
1041
1041
  };
1042
- function kt(i) {
1042
+ function Ct(i) {
1043
1043
  var r;
1044
1044
  if (!navigator.onLine)
1045
1045
  return {
@@ -1098,7 +1098,7 @@ function kt(i) {
1098
1098
  originalError: i
1099
1099
  };
1100
1100
  }
1101
- async function ve(i, r = {}, t = {
1101
+ async function ae(i, r = {}, t = {
1102
1102
  attempts: 3,
1103
1103
  backoff: "exponential",
1104
1104
  baseDelay: 1e3,
@@ -1108,33 +1108,33 @@ async function ve(i, r = {}, t = {
1108
1108
  let s;
1109
1109
  for (let n = 1; n <= t.attempts; n++)
1110
1110
  try {
1111
- const o = new AbortController(), a = setTimeout(() => o.abort(), 6e4), l = await fetch(i, {
1111
+ const o = new AbortController(), a = setTimeout(() => o.abort(), 6e4), c = await fetch(i, {
1112
1112
  ...r,
1113
1113
  signal: o.signal
1114
1114
  });
1115
- if (clearTimeout(a), l.status >= 400 && l.status < 500 && l.status !== 429)
1116
- return l;
1117
- if (!l.ok)
1118
- throw new Error(`HTTP ${l.status}: ${l.statusText}`);
1119
- return l;
1115
+ if (clearTimeout(a), c.status >= 400 && c.status < 500 && c.status !== 429)
1116
+ return c;
1117
+ if (!c.ok)
1118
+ throw new Error(`HTTP ${c.status}: ${c.statusText}`);
1119
+ return c;
1120
1120
  } catch (o) {
1121
1121
  s = o;
1122
- const a = kt(o);
1122
+ const a = Ct(o);
1123
1123
  if (!a.retryable || n === t.attempts)
1124
1124
  throw a;
1125
- const l = Et(n, t);
1125
+ const c = It(n, t);
1126
1126
  console.warn(
1127
- `API request failed (attempt ${n}/${t.attempts}), retrying in ${l}ms:`,
1127
+ `API request failed (attempt ${n}/${t.attempts}), retrying in ${c}ms:`,
1128
1128
  a.message
1129
- ), await new Promise((w) => setTimeout(w, l));
1129
+ ), await new Promise((w) => setTimeout(w, c));
1130
1130
  }
1131
1131
  throw s;
1132
1132
  }
1133
- function Et(i, r) {
1133
+ function It(i, r) {
1134
1134
  let t;
1135
1135
  return r.backoff === "exponential" ? t = r.baseDelay * Math.pow(2, i - 1) : t = r.baseDelay, t = Math.min(t, r.maxDelay), r.jitter && (t = t * (0.5 + Math.random() * 0.5)), Math.round(t);
1136
1136
  }
1137
- class Tt {
1137
+ class Rt {
1138
1138
  constructor(r = {}) {
1139
1139
  F(this, "config");
1140
1140
  this.config = r;
@@ -1173,7 +1173,7 @@ class Tt {
1173
1173
  answer: o,
1174
1174
  answerDuration: a
1175
1175
  }) {
1176
- const l = await ve(
1176
+ const c = await ae(
1177
1177
  `${this.getBaseUrl()}/questions/next`,
1178
1178
  {
1179
1179
  method: "POST",
@@ -1189,19 +1189,54 @@ class Tt {
1189
1189
  })
1190
1190
  }
1191
1191
  );
1192
- if (!l.ok)
1193
- throw new Error(`Failed to get questions: ${l.status}`);
1194
- return await l.json();
1192
+ if (!c.ok)
1193
+ throw new Error(`Failed to get questions: ${c.status}`);
1194
+ return await c.json();
1195
+ }
1196
+ /**
1197
+ * Request a signed URL for uploading a screenshot
1198
+ */
1199
+ async requestScreenshotUploadUrl(r, t = `screenshot-${Date.now()}.jpeg`) {
1200
+ const s = await ae(
1201
+ `${this.getBaseUrl()}/interview/${r}/content`,
1202
+ {
1203
+ method: "POST",
1204
+ headers: this.getHeaders(),
1205
+ body: JSON.stringify({
1206
+ filename: t,
1207
+ mime_type: "image/jpeg"
1208
+ })
1209
+ }
1210
+ );
1211
+ if (!s.ok)
1212
+ throw new Error(
1213
+ `Failed to request screenshot upload URL: ${s.status}`
1214
+ );
1215
+ return await s.json();
1216
+ }
1217
+ /**
1218
+ * Upload screenshot to the provided signed URL
1219
+ */
1220
+ async uploadScreenshot(r, t) {
1221
+ const s = await fetch(r, {
1222
+ method: "PUT",
1223
+ body: t,
1224
+ headers: {
1225
+ "Content-Type": "image/jpeg"
1226
+ }
1227
+ });
1228
+ if (!s.ok)
1229
+ throw new Error(`Failed to upload screenshot: ${s.status}`);
1195
1230
  }
1196
1231
  }
1197
- function Ct() {
1198
- const i = ce();
1232
+ function Ge() {
1233
+ const i = de();
1199
1234
  return ee(() => {
1200
1235
  const t = i.api || {};
1201
- return new Tt(t);
1236
+ return new Rt(t);
1202
1237
  }, [i.api]);
1203
1238
  }
1204
- const St = (i) => {
1239
+ const At = (i) => {
1205
1240
  C(() => {
1206
1241
  const r = (s) => {
1207
1242
  (s.ctrlKey || s.metaKey) && ["c", "v", "a", "t", "n", "w", "r", "s", "p"].includes(s.key.toLowerCase()) && (s.preventDefault(), i({
@@ -1246,7 +1281,7 @@ class I extends Error {
1246
1281
  super(r), this.code = t, this.recoverable = s, this.name = "STTError";
1247
1282
  }
1248
1283
  }
1249
- class It {
1284
+ class Mt {
1250
1285
  constructor(r = {}) {
1251
1286
  F(this, "config");
1252
1287
  F(this, "mediaRecorder", null);
@@ -1310,13 +1345,13 @@ class It {
1310
1345
  var o;
1311
1346
  (o = t == null ? void 0 : t.onStop) == null || o.call(t);
1312
1347
  }, this.mediaRecorder.onerror = (o) => {
1313
- var l;
1348
+ var c;
1314
1349
  const a = new I(
1315
1350
  `Recording failed: ${o.error}`,
1316
1351
  "RECORDING_ERROR",
1317
1352
  !0
1318
1353
  );
1319
- (l = t == null ? void 0 : t.onError) == null || l.call(t, a), this.cleanup();
1354
+ (c = t == null ? void 0 : t.onError) == null || c.call(t, a), this.cleanup();
1320
1355
  }, this.mediaRecorder.start(100), (s = t == null ? void 0 : t.onStart) == null || s.call(t), r && r > 0 && (this.autoStopTimeoutId = setTimeout(() => {
1321
1356
  this.isRecording() && this.stopRecording();
1322
1357
  }, r * 1e3));
@@ -1390,11 +1425,11 @@ class It {
1390
1425
  !1
1391
1426
  );
1392
1427
  try {
1393
- const l = new FormData(), w = new File([t], "recording.wav", {
1428
+ const c = new FormData(), w = new File([t], "recording.wav", {
1394
1429
  type: t.type || "audio/wav"
1395
1430
  });
1396
- l.append("file", w), l.append("model", s || "whisper-large-v3-turbo"), l.append("language", n || "en"), l.append("include_timestamps", String(o || !1)), l.append("temperature", String(a || 0)), l.append("qna_id", this.config.qnaId || "");
1397
- const d = await ve(
1431
+ c.append("file", w), c.append("model", s || "whisper-large-v3-turbo"), c.append("language", n || "en"), c.append("include_timestamps", String(o || !1)), c.append("temperature", String(a || 0)), c.append("qna_id", this.config.qnaId || "");
1432
+ const d = await ae(
1398
1433
  `${this.config.baseUrl}/speech/transcribe`,
1399
1434
  {
1400
1435
  method: "POST",
@@ -1405,7 +1440,7 @@ class It {
1405
1440
  Authorization: `Bearer ${this.config.authToken}`
1406
1441
  }
1407
1442
  },
1408
- body: l
1443
+ body: c
1409
1444
  },
1410
1445
  {
1411
1446
  attempts: 1,
@@ -1419,8 +1454,8 @@ class It {
1419
1454
  const h = await d.text();
1420
1455
  let m = `STT request failed: ${d.status} ${d.statusText}`;
1421
1456
  try {
1422
- const c = JSON.parse(h);
1423
- m = c.message || c.error || m;
1457
+ const l = JSON.parse(h);
1458
+ m = l.message || l.error || m;
1424
1459
  } catch {
1425
1460
  m = h || m;
1426
1461
  }
@@ -1433,9 +1468,9 @@ class It {
1433
1468
  return {
1434
1469
  transcript: (await d.json()).data.text ?? ""
1435
1470
  };
1436
- } catch (l) {
1437
- throw l instanceof I ? l : new I(
1438
- `Transcription failed: ${l instanceof Error ? l.message : String(l)}`,
1471
+ } catch (c) {
1472
+ throw c instanceof I ? c : new I(
1473
+ `Transcription failed: ${c instanceof Error ? c.message : String(c)}`,
1439
1474
  "TRANSCRIPTION_FAILED",
1440
1475
  !0
1441
1476
  );
@@ -1476,13 +1511,13 @@ class It {
1476
1511
  this.recordingStream && (this.recordingStream.getTracks().forEach((r) => r.stop()), this.recordingStream = null), this.mediaRecorder = null, this.audioChunks = [], this.autoStopTimeoutId && (clearTimeout(this.autoStopTimeoutId), this.autoStopTimeoutId = null);
1477
1512
  }
1478
1513
  }
1479
- const Z = new It(), Rt = (i = {}) => {
1480
- const [r, t] = k(!1), [s, n] = k(!1), [o, a] = k(null), [l, w] = k(null), [d, u] = k(null);
1514
+ const Z = new Mt(), Dt = (i = {}) => {
1515
+ const [r, t] = E(!1), [s, n] = E(!1), [o, a] = E(null), [c, w] = E(null), [d, u] = E(null);
1481
1516
  i.config && Z.updateConfig(i.config);
1482
- const h = T(async (p) => {
1483
- var j;
1517
+ const h = T(async (b) => {
1518
+ var y;
1484
1519
  try {
1485
- w(null), a(null), u(null), await Z.startRecording(p, {
1520
+ w(null), a(null), u(null), await Z.startRecording(b, {
1486
1521
  onStart: () => {
1487
1522
  var g;
1488
1523
  t(!0), (g = i.onStart) == null || g.call(i);
@@ -1493,67 +1528,67 @@ const Z = new It(), Rt = (i = {}) => {
1493
1528
  },
1494
1529
  onError: (g) => {
1495
1530
  var S;
1496
- const y = g instanceof I ? g : new I(g.message, "RECORDING_ERROR", !0);
1497
- w(y), t(!1), (S = i.onError) == null || S.call(i, y);
1531
+ const f = g instanceof I ? g : new I(g.message, "RECORDING_ERROR", !0);
1532
+ w(f), t(!1), (S = i.onError) == null || S.call(i, f);
1498
1533
  }
1499
1534
  });
1500
1535
  } catch (g) {
1501
- const y = g instanceof I ? g : new I(
1536
+ const f = g instanceof I ? g : new I(
1502
1537
  g instanceof Error ? g.message : String(g),
1503
1538
  "START_FAILED",
1504
1539
  !1
1505
1540
  );
1506
- throw w(y), t(!1), (j = i.onError) == null || j.call(i, y), y;
1541
+ throw w(f), t(!1), (y = i.onError) == null || y.call(i, f), f;
1507
1542
  }
1508
1543
  }, []), m = T(async () => {
1509
- var p, j;
1544
+ var b, y;
1510
1545
  try {
1511
1546
  const g = await Z.stopRecording();
1512
- return u(g), t(!1), (p = i.onStop) == null || p.call(i), g;
1547
+ return u(g), t(!1), (b = i.onStop) == null || b.call(i), g;
1513
1548
  } catch (g) {
1514
- const y = g instanceof I ? g : new I(
1549
+ const f = g instanceof I ? g : new I(
1515
1550
  g instanceof Error ? g.message : String(g),
1516
1551
  "STOP_FAILED",
1517
1552
  !1
1518
1553
  );
1519
- throw w(y), t(!1), (j = i.onError) == null || j.call(i, y), y;
1554
+ throw w(f), t(!1), (y = i.onError) == null || y.call(i, f), f;
1520
1555
  }
1521
- }, []), c = T(
1522
- async (p, j = {}) => {
1523
- var g, y;
1556
+ }, []), l = T(
1557
+ async (b, y = {}) => {
1558
+ var g, f;
1524
1559
  try {
1525
1560
  w(null), n(!0);
1526
1561
  const S = {
1527
- audioBlob: p,
1528
- ...j
1529
- }, N = await Z.transcribe(S);
1530
- return a(N.transcript), n(!1), (g = i.onTranscriptionComplete) == null || g.call(i, N), N;
1562
+ audioBlob: b,
1563
+ ...y
1564
+ }, j = await Z.transcribe(S);
1565
+ return a(j.transcript), n(!1), (g = i.onTranscriptionComplete) == null || g.call(i, j), j;
1531
1566
  } catch (S) {
1532
- const N = S instanceof I ? S : new I(
1567
+ const j = S instanceof I ? S : new I(
1533
1568
  S instanceof Error ? S.message : String(S),
1534
1569
  "TRANSCRIPTION_FAILED",
1535
1570
  !0
1536
1571
  );
1537
- throw w(N), n(!1), (y = i.onError) == null || y.call(i, N), N;
1572
+ throw w(j), n(!1), (f = i.onError) == null || f.call(i, j), j;
1538
1573
  }
1539
1574
  },
1540
1575
  []
1541
- ), x = T(() => {
1576
+ ), p = T(() => {
1542
1577
  Z.cancelRecording(), t(!1), u(null);
1543
1578
  }, []);
1544
1579
  return {
1545
1580
  startRecording: h,
1546
1581
  stopRecording: m,
1547
- transcribe: c,
1548
- cancelRecording: x,
1582
+ transcribe: l,
1583
+ cancelRecording: p,
1549
1584
  isRecording: r,
1550
1585
  isTranscribing: s,
1551
1586
  transcript: o,
1552
- error: l,
1587
+ error: c,
1553
1588
  audioBlob: d
1554
1589
  };
1555
- }, At = (i) => {
1556
- const r = E(null), t = E(!1);
1590
+ }, _t = (i) => {
1591
+ const r = k(null), t = k(!1);
1557
1592
  C(() => {
1558
1593
  const s = () => {
1559
1594
  document.hidden && (t.current = !0, r.current && (clearTimeout(r.current), r.current = null), i({
@@ -1582,7 +1617,7 @@ const Z = new It(), Rt = (i = {}) => {
1582
1617
  document.removeEventListener("visibilitychange", s), window.removeEventListener("blur", n), r.current && clearTimeout(r.current);
1583
1618
  };
1584
1619
  }, [i]);
1585
- }, Mt = () => {
1620
+ }, Pt = () => {
1586
1621
  C(() => {
1587
1622
  const i = document.createElement("style");
1588
1623
  return i.textContent = `
@@ -1603,7 +1638,7 @@ const Z = new It(), Rt = (i = {}) => {
1603
1638
  };
1604
1639
  }, []);
1605
1640
  };
1606
- class Dt {
1641
+ class Ft {
1607
1642
  constructor(r = {}) {
1608
1643
  F(this, "config");
1609
1644
  F(this, "currentAudio", null);
@@ -1631,7 +1666,7 @@ class Dt {
1631
1666
  speed: n = this.config.speed
1632
1667
  } = r, o = new URLSearchParams();
1633
1668
  o.append("text", t), o.append("voice", s || "string"), o.append("speed", (n == null ? void 0 : n.toString()) || "1");
1634
- const a = await ve(
1669
+ const a = await ae(
1635
1670
  `${this.config.baseUrl}/speech/synthesize`,
1636
1671
  {
1637
1672
  method: "POST",
@@ -1657,8 +1692,8 @@ class Dt {
1657
1692
  throw new Error(
1658
1693
  `TTS request failed: ${a.status} ${a.statusText}`
1659
1694
  );
1660
- const l = a.headers.get("content-type");
1661
- if (l && l.includes("audio/"))
1695
+ const c = a.headers.get("content-type");
1696
+ if (c && c.includes("audio/"))
1662
1697
  return a.blob();
1663
1698
  try {
1664
1699
  const w = await a.json();
@@ -1675,7 +1710,7 @@ class Dt {
1675
1710
  try {
1676
1711
  this.stop(), (s = t == null ? void 0 : t.onStart) == null || s.call(t);
1677
1712
  const o = await this.synthesizeSpeech(r), a = URL.createObjectURL(o);
1678
- return this.currentAudio = new Audio(a), new Promise((l, w) => {
1713
+ return this.currentAudio = new Audio(a), new Promise((c, w) => {
1679
1714
  if (!this.currentAudio) {
1680
1715
  w(new Error("Audio element not created"));
1681
1716
  return;
@@ -1683,7 +1718,7 @@ class Dt {
1683
1718
  const d = this.currentAudio;
1684
1719
  d.onended = () => {
1685
1720
  var u;
1686
- URL.revokeObjectURL(a), this.currentAudio = null, (u = t == null ? void 0 : t.onEnd) == null || u.call(t), l();
1721
+ URL.revokeObjectURL(a), this.currentAudio = null, (u = t == null ? void 0 : t.onEnd) == null || u.call(t), c();
1687
1722
  }, d.onerror = (u) => {
1688
1723
  var m;
1689
1724
  URL.revokeObjectURL(a), this.currentAudio = null;
@@ -1714,10 +1749,10 @@ class Dt {
1714
1749
  return this.currentAudio !== null && !this.currentAudio.paused;
1715
1750
  }
1716
1751
  }
1717
- const ge = new Dt(), _t = (i = {}) => {
1718
- const [r, t] = k(!1), [s, n] = k(!1), [o, a] = k(null);
1719
- i.config && ge.updateConfig(i.config);
1720
- const l = T(
1752
+ const fe = new Ft(), Lt = (i = {}) => {
1753
+ const [r, t] = E(!1), [s, n] = E(!1), [o, a] = E(null);
1754
+ i.config && fe.updateConfig(i.config);
1755
+ const c = T(
1721
1756
  async (d, u = {}) => {
1722
1757
  var h;
1723
1758
  try {
@@ -1726,46 +1761,46 @@ const ge = new Dt(), _t = (i = {}) => {
1726
1761
  text: d,
1727
1762
  ...u
1728
1763
  };
1729
- await ge.speak(m, {
1764
+ await fe.speak(m, {
1730
1765
  onStart: () => {
1731
- var c;
1732
- n(!1), t(!0), (c = i.onStart) == null || c.call(i);
1766
+ var l;
1767
+ n(!1), t(!0), (l = i.onStart) == null || l.call(i);
1733
1768
  },
1734
1769
  onEnd: () => {
1735
- var c;
1736
- t(!1), (c = i.onEnd) == null || c.call(i);
1770
+ var l;
1771
+ t(!1), (l = i.onEnd) == null || l.call(i);
1737
1772
  },
1738
- onError: (c) => {
1739
- var x;
1740
- t(!1), n(!1), a(c), (x = i.onError) == null || x.call(i, c);
1773
+ onError: (l) => {
1774
+ var p;
1775
+ t(!1), n(!1), a(l), (p = i.onError) == null || p.call(i, l);
1741
1776
  }
1742
1777
  });
1743
1778
  } catch (m) {
1744
- const c = m instanceof Error ? m : new Error(String(m));
1745
- throw a(c), t(!1), n(!1), (h = i.onError) == null || h.call(i, c), c;
1779
+ const l = m instanceof Error ? m : new Error(String(m));
1780
+ throw a(l), t(!1), n(!1), (h = i.onError) == null || h.call(i, l), l;
1746
1781
  }
1747
1782
  },
1748
1783
  [i]
1749
1784
  ), w = T(() => {
1750
- ge.stop(), t(!1), n(!1);
1785
+ fe.stop(), t(!1), n(!1);
1751
1786
  }, []);
1752
1787
  return {
1753
- speak: l,
1788
+ speak: c,
1754
1789
  stop: w,
1755
1790
  isPlaying: r,
1756
1791
  isLoading: s,
1757
1792
  error: o
1758
1793
  };
1759
- }, Pt = ({
1794
+ }, $t = ({
1760
1795
  onViolation: i,
1761
1796
  onEnd: r,
1762
1797
  maxViolations: t = 5
1763
1798
  }) => {
1764
- const { addViolation: s } = at(), n = st(), o = nt(), a = E(o);
1799
+ const { addViolation: s } = dt(), n = ct(), o = lt(), a = k(o);
1765
1800
  C(() => {
1766
1801
  a.current = o;
1767
1802
  }, [o]);
1768
- const l = T(
1803
+ const c = T(
1769
1804
  (d) => {
1770
1805
  r && r(d, a.current);
1771
1806
  },
@@ -1775,23 +1810,23 @@ const ge = new Dt(), _t = (i = {}) => {
1775
1810
  logViolation: T(
1776
1811
  ({ type: d, severity: u, details: h }) => {
1777
1812
  const m = {
1778
- id: ht(),
1813
+ id: xt(),
1779
1814
  type: d,
1780
1815
  severity: u,
1781
1816
  details: h,
1782
1817
  timestamp: Date.now()
1783
1818
  };
1784
1819
  s(m);
1785
- const c = a.current + 1;
1786
- i && i(m, c), c >= t && l("excessive_violations");
1820
+ const l = a.current + 1;
1821
+ i && i(m, l), l >= t && c("excessive_violations");
1787
1822
  },
1788
- [s, i, t, l]
1823
+ [s, i, t, c]
1789
1824
  ),
1790
- onInterviewEnd: l,
1825
+ onInterviewEnd: c,
1791
1826
  violationCount: o,
1792
1827
  logList: n
1793
1828
  };
1794
- }, Ft = () => {
1829
+ }, Ot = () => {
1795
1830
  C(() => {
1796
1831
  function i() {
1797
1832
  console.clear(), console.log(
@@ -1895,7 +1930,7 @@ const ge = new Dt(), _t = (i = {}) => {
1895
1930
  /* @__PURE__ */ e.jsx("path", { d: "M8.644 21.42a10 10 0 0 0 7.631-.38" })
1896
1931
  ]
1897
1932
  }
1898
- ), Lt = (i, r, t) => Math.max(r, Math.min(t, i)), Ee = (i) => {
1933
+ ), Ut = (i, r, t) => Math.max(r, Math.min(t, i)), Se = (i) => {
1899
1934
  const r = Math.max(0, Math.floor(i)), t = Math.floor(r / 60).toString().padStart(2, "0"), s = (r % 60).toString().padStart(2, "0");
1900
1935
  return `${t}:${s}`;
1901
1936
  }, Ne = ({
@@ -1906,16 +1941,16 @@ const ge = new Dt(), _t = (i = {}) => {
1906
1941
  className: n = "",
1907
1942
  showLabel: o = !0
1908
1943
  }) => {
1909
- const a = Math.max(1, i || 1), l = Lt(r / a, 0, 1), { radius: w, circumference: d, dashOffset: u, center: h } = ee(() => {
1910
- const x = (t - s) / 2, p = 2 * Math.PI * x, j = p * (1 - l), g = Math.round(s) % 2 === 1, y = t / 2 + (g ? 0.5 : 0);
1911
- return { radius: x, circumference: p, dashOffset: j, center: y };
1912
- }, [t, s, l]), m = ee(() => l <= 0.25 ? "iw-stroke-red-500" : l <= 0.5 ? "iw-stroke-yellow-500" : "iw-stroke-green-500", [l]), c = l <= 0.25 ? "iw-animate-pulse" : "";
1944
+ const a = Math.max(1, i || 1), c = Ut(r / a, 0, 1), { radius: w, circumference: d, dashOffset: u, center: h } = ee(() => {
1945
+ const p = (t - s) / 2, b = 2 * Math.PI * p, y = b * (1 - c), g = Math.round(s) % 2 === 1, f = t / 2 + (g ? 0.5 : 0);
1946
+ return { radius: p, circumference: b, dashOffset: y, center: f };
1947
+ }, [t, s, c]), m = ee(() => c <= 0.25 ? "iw-stroke-red-500" : c <= 0.5 ? "iw-stroke-yellow-500" : "iw-stroke-green-500", [c]), l = c <= 0.25 ? "iw-animate-pulse" : "";
1913
1948
  return /* @__PURE__ */ e.jsxs(
1914
1949
  "div",
1915
1950
  {
1916
1951
  className: `iw-relative iw-inline-flex iw-items-center iw-justify-center iw-rounded-full iw-bg-white ${n}`,
1917
1952
  style: { width: t, height: t },
1918
- "aria-label": `Time remaining ${Ee(r)}`,
1953
+ "aria-label": `Time remaining ${Se(r)}`,
1919
1954
  role: "timer",
1920
1955
  "aria-live": "polite",
1921
1956
  children: [
@@ -1946,7 +1981,7 @@ const ge = new Dt(), _t = (i = {}) => {
1946
1981
  cx: h,
1947
1982
  cy: h,
1948
1983
  r: w,
1949
- className: `${m} ${c}`,
1984
+ className: `${m} ${l}`,
1950
1985
  strokeWidth: s,
1951
1986
  strokeLinecap: "round",
1952
1987
  fill: "none",
@@ -1965,14 +2000,14 @@ const ge = new Dt(), _t = (i = {}) => {
1965
2000
  o && /* @__PURE__ */ e.jsx("div", { className: "iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center iw-rotate-0", children: /* @__PURE__ */ e.jsx(
1966
2001
  "span",
1967
2002
  {
1968
- className: `iw-text-[11px] iw-font-semibold iw-tabular-nums ${l <= 0.25 ? "iw-text-red-600" : l <= 0.5 ? "iw-text-yellow-600" : "iw-text-green-600"}`,
1969
- children: Ee(r)
2003
+ className: `iw-text-[11px] iw-font-semibold iw-tabular-nums ${c <= 0.25 ? "iw-text-red-600" : c <= 0.5 ? "iw-text-yellow-600" : "iw-text-green-600"}`,
2004
+ children: Se(r)
1970
2005
  }
1971
2006
  ) })
1972
2007
  ]
1973
2008
  }
1974
2009
  );
1975
- }, $t = ({
2010
+ }, qt = ({
1976
2011
  label: i,
1977
2012
  error: r,
1978
2013
  fullWidth: t = !1,
@@ -1980,7 +2015,7 @@ const ge = new Dt(), _t = (i = {}) => {
1980
2015
  id: n,
1981
2016
  ...o
1982
2017
  }) => {
1983
- const a = n || `textarea-${Math.random().toString(36).substring(2, 9)}`, l = "iw-block iw-rounded-md iw-border iw-border-gray-300 iw-shadow-sm iw-px-4 iw-py-2 iw-text-sm iw-transition-all", w = r ? "iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500" : "", d = t ? "iw-w-full" : "", u = s.includes("iw-h-full") || t ? "iw-h-full" : "";
2018
+ const a = n || `textarea-${Math.random().toString(36).substring(2, 9)}`, c = "iw-block iw-rounded-md iw-border iw-border-gray-300 iw-shadow-sm iw-px-4 iw-py-2 iw-text-sm iw-transition-all", w = r ? "iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500" : "", d = t ? "iw-w-full" : "", u = s.includes("iw-h-full") || t ? "iw-h-full" : "";
1984
2019
  return /* @__PURE__ */ e.jsxs(
1985
2020
  "div",
1986
2021
  {
@@ -1998,7 +2033,7 @@ const ge = new Dt(), _t = (i = {}) => {
1998
2033
  "textarea",
1999
2034
  {
2000
2035
  id: a,
2001
- className: `${l} ${w} ${d} ${u} ${s}`,
2036
+ className: `${c} ${w} ${d} ${u} ${s}`,
2002
2037
  "aria-invalid": r ? "true" : "false",
2003
2038
  ...o
2004
2039
  }
@@ -2007,7 +2042,7 @@ const ge = new Dt(), _t = (i = {}) => {
2007
2042
  ]
2008
2043
  }
2009
2044
  );
2010
- }, Ot = ({
2045
+ }, Bt = ({
2011
2046
  value: i,
2012
2047
  onChange: r,
2013
2048
  onSubmit: t,
@@ -2015,8 +2050,8 @@ const ge = new Dt(), _t = (i = {}) => {
2015
2050
  state: n,
2016
2051
  editingTime: o
2017
2052
  }) => {
2018
- const a = (l) => {
2019
- l.key === "Enter" && (l.ctrlKey || l.metaKey) && !s && (l.preventDefault(), t());
2053
+ const a = (c) => {
2054
+ c.key === "Enter" && (c.ctrlKey || c.metaKey) && !s && (c.preventDefault(), t());
2020
2055
  };
2021
2056
  return /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-h-full ", children: [
2022
2057
  /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between", children: [
@@ -2039,45 +2074,84 @@ const ge = new Dt(), _t = (i = {}) => {
2039
2074
  ] }),
2040
2075
  /* @__PURE__ */ e.jsxs("div", { className: " iw-overflow-hidden iw-flex iw-flex-col iw-h-full iw-mt-2", children: [
2041
2076
  /* @__PURE__ */ e.jsx(
2042
- $t,
2077
+ qt,
2043
2078
  {
2044
2079
  value: i,
2045
2080
  onChange: r,
2046
2081
  onKeyDown: a,
2047
2082
  placeholder: "Type your answer here...",
2048
2083
  className: " iw-w-full iw-h-full iw-flex-1 iw-resize-none !iw-p-4 iw-bg-transparent iw-min-h-full focus-visible:iw-outline-0",
2049
- onPaste: (l) => l.preventDefault(),
2050
- onCopy: (l) => l.preventDefault(),
2051
- onCut: (l) => l.preventDefault(),
2052
- onDrop: (l) => l.preventDefault(),
2053
- onDragOver: (l) => l.preventDefault()
2084
+ onPaste: (c) => c.preventDefault(),
2085
+ onCopy: (c) => c.preventDefault(),
2086
+ onCut: (c) => c.preventDefault(),
2087
+ onDrop: (c) => c.preventDefault(),
2088
+ onDragOver: (c) => c.preventDefault()
2054
2089
  }
2055
2090
  ),
2056
- /* @__PURE__ */ e.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1 iw-mt-4", children: /* @__PURE__ */ e.jsx(V, { onClick: t, disabled: s, children: "Submit Answer" }) })
2091
+ /* @__PURE__ */ e.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1 iw-mt-4", children: /* @__PURE__ */ e.jsx(G, { onClick: t, disabled: s, children: "Submit Answer" }) })
2057
2092
  ] })
2058
2093
  ] });
2059
- }, qt = ({ className: i = "" }) => {
2060
- var n;
2061
- const { authToken: r } = Pe(), t = r ? mt(r) : null, s = E(null);
2094
+ }, Wt = ({
2095
+ className: i = "",
2096
+ interviewId: r = "",
2097
+ interview_duration: t
2098
+ }) => {
2099
+ var d;
2100
+ const { authToken: s } = $e(), n = s ? pt(s) : null, o = Ge(), a = k(null), c = k(null), w = async (u) => {
2101
+ var b;
2102
+ const h = a.current, m = c.current;
2103
+ if (!h || !m) return;
2104
+ const l = m.getContext("2d");
2105
+ if (!l) return;
2106
+ m.width = h.videoWidth, m.height = h.videoHeight, l.drawImage(h, 0, 0, m.width, m.height), console.log(`${u} captured frame at`, (/* @__PURE__ */ new Date()).toLocaleTimeString());
2107
+ const p = await new Promise(
2108
+ (y) => m.toBlob(y, "image/jpeg")
2109
+ );
2110
+ if (p && r)
2111
+ try {
2112
+ const y = `${u}-${Date.now()}.jpeg`, g = await o.requestScreenshotUploadUrl(
2113
+ r,
2114
+ y
2115
+ );
2116
+ g.success && g.data.upload_url && (await o.uploadScreenshot(
2117
+ (b = g == null ? void 0 : g.data) == null ? void 0 : b.upload_url,
2118
+ p
2119
+ ), console.log(
2120
+ `${u} uploaded successfully to ${g.data.file_path}`
2121
+ ));
2122
+ } catch (y) {
2123
+ console.error(`Failed to upload screenshot for ${u}:`, y);
2124
+ }
2125
+ };
2062
2126
  return C(() => {
2063
- let o = null;
2127
+ let u = null;
2128
+ const h = [];
2064
2129
  return (async () => {
2065
2130
  try {
2066
- o = await navigator.mediaDevices.getUserMedia({
2131
+ u = await navigator.mediaDevices.getUserMedia({
2067
2132
  video: !0,
2068
2133
  audio: !1
2069
- }), s.current && (s.current.srcObject = o);
2134
+ }), a.current && (a.current.srcObject = u);
2135
+ const p = (t ?? Pe) * 60 * 1e3 / 3, b = [0, 1, 2].map((g, f) => ({
2136
+ label: `capture-${f + 1}`,
2137
+ start: f * p,
2138
+ end: (f + 1) * p
2139
+ })), y = (g, f) => g === f ? g : Math.random() * (f - g) + g;
2140
+ b.forEach(({ label: g, start: f, end: S }, j) => {
2141
+ let R;
2142
+ j === 0 ? R = 3e3 : R = y(f, S), h.push(setTimeout(() => w(g), R));
2143
+ });
2070
2144
  } catch (l) {
2071
2145
  console.error("Error accessing camera:", l);
2072
2146
  }
2073
2147
  })(), () => {
2074
- o && o.getTracks().forEach((l) => l.stop());
2148
+ u && u.getTracks().forEach((l) => l.stop()), h.forEach(clearTimeout);
2075
2149
  };
2076
2150
  }, []), /* @__PURE__ */ e.jsxs("div", { className: `iw-relative ${i}`, children: [
2077
2151
  /* @__PURE__ */ e.jsx(
2078
2152
  "video",
2079
2153
  {
2080
- ref: s,
2154
+ ref: a,
2081
2155
  autoPlay: !0,
2082
2156
  playsInline: !0,
2083
2157
  muted: !0,
@@ -2087,13 +2161,14 @@ const ge = new Dt(), _t = (i = {}) => {
2087
2161
  }
2088
2162
  }
2089
2163
  ),
2164
+ /* @__PURE__ */ e.jsx("canvas", { ref: c, style: { display: "none" } }),
2090
2165
  /* @__PURE__ */ e.jsxs("div", { className: "iw-absolute iw-top-4 iw-left-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md", children: [
2091
2166
  /* @__PURE__ */ e.jsx("div", { className: "iw-size-2 iw-animate-pulse iw-rounded-full iw-bg-red-500" }),
2092
2167
  /* @__PURE__ */ e.jsx("span", { className: "iw-font-medium iw-text-white", children: "Recording" })
2093
2168
  ] }),
2094
- ((n = t == null ? void 0 : t.data) == null ? void 0 : n.user_name) && /* @__PURE__ */ e.jsx("div", { className: "iw-absolute iw-bottom-4 iw-right-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md", children: /* @__PURE__ */ e.jsx("span", { className: "iw-font-medium iw-text-white", children: t.data.user_name }) })
2169
+ ((d = n == null ? void 0 : n.data) == null ? void 0 : d.user_name) && /* @__PURE__ */ e.jsx("div", { className: "iw-absolute iw-bottom-4 iw-right-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md", children: /* @__PURE__ */ e.jsx("span", { className: "iw-font-medium iw-text-white", children: n.data.user_name }) })
2095
2170
  ] });
2096
- }, Ut = ({
2171
+ }, Vt = ({
2097
2172
  question: i,
2098
2173
  isLoading: r = !1
2099
2174
  }) => {
@@ -2102,7 +2177,7 @@ const ge = new Dt(), _t = (i = {}) => {
2102
2177
  "div",
2103
2178
  {
2104
2179
  className: "iw-rounded-xl iw-mb-4 message-animation iw-text-gray-800 iw-p-6 ",
2105
- style: wt(t, 0.85),
2180
+ style: gt(t, 0.85),
2106
2181
  children: /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-gap-8", children: [
2107
2182
  /* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-flex-col iw-items-center iw-relative iw-h-32 iw-w-32 iw-shrink-0 iw-shadow iw-rounded-lg iw-bg-white", children: /* @__PURE__ */ e.jsx("div", { className: "iw-mt-2", children: /* @__PURE__ */ e.jsx(
2108
2183
  "img",
@@ -2119,30 +2194,38 @@ const ge = new Dt(), _t = (i = {}) => {
2119
2194
  ] })
2120
2195
  }
2121
2196
  );
2122
- }, Te = ({
2197
+ }, Ce = ({
2123
2198
  currentQuestion: i,
2124
2199
  phase: r,
2125
2200
  className: t = "",
2126
- children: s
2201
+ children: s,
2202
+ interviewId: n = "",
2203
+ interview_duration: o = Pe
2127
2204
  }) => /* @__PURE__ */ e.jsxs(
2128
2205
  "div",
2129
2206
  {
2130
2207
  className: `iw-p-4 iw-space-y-4 iw-pb-6 ${t} iw-min-h-[calc(100vh_-_3.8rem)] iw-flex iw-flex-col iw-justify-between`,
2131
2208
  children: [
2132
2209
  /* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-items-start iw-justify-between iw-gap-3", children: /* @__PURE__ */ e.jsx("div", { className: "iw-flex-1", children: /* @__PURE__ */ e.jsx(
2133
- Ut,
2210
+ Vt,
2134
2211
  {
2135
2212
  question: i,
2136
- isLoading: r === D.FETCHING_QUESTION || r === D.IDLE
2213
+ isLoading: r === _.FETCHING_QUESTION || r === _.IDLE
2137
2214
  }
2138
2215
  ) }) }),
2139
2216
  /* @__PURE__ */ e.jsxs("div", { className: "iw iw-bg-[#F6F6F6] iw-grid iw-grid-cols-2 iw-rounded-[14px] iw-p-6", children: [
2140
- /* @__PURE__ */ e.jsx("div", { className: "iw-min-h-[400px] iw-max-h-[600px]", children: /* @__PURE__ */ e.jsx(qt, {}) }),
2217
+ /* @__PURE__ */ e.jsx("div", { className: "iw-min-h-[400px] iw-max-h-[600px]", children: /* @__PURE__ */ e.jsx(
2218
+ Wt,
2219
+ {
2220
+ interviewId: n,
2221
+ interview_duration: o
2222
+ }
2223
+ ) }),
2141
2224
  /* @__PURE__ */ e.jsx("div", { className: "iw-bg-white iw-rounded-r-xl iw-shadow iw-p-6", children: s })
2142
2225
  ] })
2143
2226
  ]
2144
2227
  }
2145
- ), Be = ({
2228
+ ), ze = ({
2146
2229
  isOpen: i,
2147
2230
  onClose: r,
2148
2231
  children: t,
@@ -2150,7 +2233,7 @@ const ge = new Dt(), _t = (i = {}) => {
2150
2233
  showCloseButton: n = !0,
2151
2234
  closeOnOverlayClick: o = !0,
2152
2235
  closeOnEscape: a = !0,
2153
- className: l = ""
2236
+ className: c = ""
2154
2237
  }) => {
2155
2238
  if (C(() => {
2156
2239
  if (!i || !a) return;
@@ -2174,7 +2257,7 @@ const ge = new Dt(), _t = (i = {}) => {
2174
2257
  /* @__PURE__ */ e.jsxs(
2175
2258
  "div",
2176
2259
  {
2177
- className: `iw-relative iw-bg-white iw-rounded-lg iw-shadow-xl iw-max-w-md iw-w-full iw-mx-4 iw-max-h-[90vh] iw-overflow-hidden ${l}`,
2260
+ className: `iw-relative iw-bg-white iw-rounded-lg iw-shadow-xl iw-max-w-md iw-w-full iw-mx-4 iw-max-h-[90vh] iw-overflow-hidden ${c}`,
2178
2261
  role: "dialog",
2179
2262
  "aria-modal": "true",
2180
2263
  "aria-labelledby": s ? "dialog-title" : void 0,
@@ -2220,13 +2303,13 @@ const ge = new Dt(), _t = (i = {}) => {
2220
2303
  }
2221
2304
  )
2222
2305
  ] });
2223
- return He(d, document.body);
2224
- }, Bt = ({
2306
+ return Je(d, document.body);
2307
+ }, Gt = ({
2225
2308
  confirmExitInterview: i,
2226
2309
  isOpen: r,
2227
2310
  onClose: t
2228
2311
  }) => /* @__PURE__ */ e.jsx(
2229
- Be,
2312
+ ze,
2230
2313
  {
2231
2314
  isOpen: r,
2232
2315
  onClose: t,
@@ -2264,8 +2347,8 @@ const ge = new Dt(), _t = (i = {}) => {
2264
2347
  ] })
2265
2348
  ] })
2266
2349
  }
2267
- ), Ce = ({ title: i, onExit: r }) => {
2268
- const { baseColor: t } = te(), [s, n] = k(!1);
2350
+ ), Ie = ({ title: i, onExit: r }) => {
2351
+ const { baseColor: t } = te(), [s, n] = E(!1);
2269
2352
  return /* @__PURE__ */ e.jsxs("header", { className: "iw-w-full iw-text-gray-900", children: [
2270
2353
  /* @__PURE__ */ e.jsxs("div", { className: "iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-pb-4 iw-pt-2", children: [
2271
2354
  /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
@@ -2294,7 +2377,7 @@ const ge = new Dt(), _t = (i = {}) => {
2294
2377
  ] }),
2295
2378
  /* @__PURE__ */ e.jsx("div", { className: "iw-h-px iw-bg-gray-200" }),
2296
2379
  /* @__PURE__ */ e.jsx(
2297
- Bt,
2380
+ Gt,
2298
2381
  {
2299
2382
  isOpen: s,
2300
2383
  confirmExitInterview: () => {
@@ -2304,7 +2387,7 @@ const ge = new Dt(), _t = (i = {}) => {
2304
2387
  }
2305
2388
  )
2306
2389
  ] });
2307
- }, Wt = ({
2390
+ }, zt = ({
2308
2391
  className: i = "",
2309
2392
  width: r,
2310
2393
  height: t = 56,
@@ -2312,78 +2395,78 @@ const ge = new Dt(), _t = (i = {}) => {
2312
2395
  gap: n = 2,
2313
2396
  fftSize: o = 1024,
2314
2397
  smoothingTimeConstant: a = 0.8,
2315
- mediaStream: l,
2398
+ mediaStream: c,
2316
2399
  startOnMount: w = !0
2317
2400
  }) => {
2318
- const { baseColor: d } = te(), u = E(null), h = E(null), m = E(null), c = E(null), x = E(null), p = E(null), j = E(!1), [g, y] = k(null);
2401
+ const { baseColor: d } = te(), u = k(null), h = k(null), m = k(null), l = k(null), p = k(null), b = k(null), y = k(!1), [g, f] = E(null);
2319
2402
  C(() => {
2320
2403
  if (r || !h.current) return;
2321
- const N = h.current, _ = () => {
2322
- const R = u.current;
2323
- if (!R) return;
2324
- const A = N.clientWidth, f = t;
2325
- R.width = Math.max(1, Math.floor(A * window.devicePixelRatio || 1)), R.height = Math.max(1, Math.floor(f * window.devicePixelRatio || 1));
2326
- }, v = new ResizeObserver(_);
2327
- return v.observe(N), _(), () => v.disconnect();
2404
+ const j = h.current, R = () => {
2405
+ const A = u.current;
2406
+ if (!A) return;
2407
+ const M = j.clientWidth, x = t;
2408
+ A.width = Math.max(1, Math.floor(M * window.devicePixelRatio || 1)), A.height = Math.max(1, Math.floor(x * window.devicePixelRatio || 1));
2409
+ }, N = new ResizeObserver(R);
2410
+ return N.observe(j), R(), () => N.disconnect();
2328
2411
  }, [r, t]), C(() => {
2329
2412
  if (!r) return;
2330
- const N = u.current;
2331
- N && (N.width = Math.max(
2413
+ const j = u.current;
2414
+ j && (j.width = Math.max(
2332
2415
  1,
2333
2416
  Math.floor(r * (window.devicePixelRatio || 1))
2334
- ), N.height = Math.max(
2417
+ ), j.height = Math.max(
2335
2418
  1,
2336
2419
  Math.floor(t * (window.devicePixelRatio || 1))
2337
2420
  ));
2338
2421
  }, [r, t]), C(() => {
2339
- let N = !1;
2422
+ let j = !1;
2340
2423
  return (async () => {
2341
2424
  try {
2342
- const v = new (window.AudioContext || window.webkitAudioContext)();
2343
- m.current = v;
2344
- let R = l;
2345
- if (!R) {
2425
+ const N = new (window.AudioContext || window.webkitAudioContext)();
2426
+ m.current = N;
2427
+ let A = c;
2428
+ if (!A) {
2346
2429
  if (!w) return;
2347
- R = await navigator.mediaDevices.getUserMedia({
2430
+ A = await navigator.mediaDevices.getUserMedia({
2348
2431
  audio: !0,
2349
2432
  video: !1
2350
- }), j.current = !0;
2433
+ }), y.current = !0;
2351
2434
  }
2352
- if (N) return;
2353
- const A = v.createAnalyser();
2354
- A.fftSize = o, A.smoothingTimeConstant = a, c.current = A;
2355
- const f = v.createMediaStreamSource(R);
2356
- x.current = f, f.connect(A), S();
2357
- } catch (v) {
2358
- y((v == null ? void 0 : v.message) || "Failed to initialize microphone");
2435
+ if (j) return;
2436
+ const M = N.createAnalyser();
2437
+ M.fftSize = o, M.smoothingTimeConstant = a, l.current = M;
2438
+ const x = N.createMediaStreamSource(A);
2439
+ p.current = x, x.connect(M), S();
2440
+ } catch (N) {
2441
+ f((N == null ? void 0 : N.message) || "Failed to initialize microphone");
2359
2442
  }
2360
2443
  })(), () => {
2361
- var v, R, A, f;
2362
- N = !0, p.current && cancelAnimationFrame(p.current);
2444
+ var N, A, M, x;
2445
+ j = !0, b.current && cancelAnimationFrame(b.current);
2363
2446
  try {
2364
- (v = x.current) == null || v.disconnect();
2447
+ (N = p.current) == null || N.disconnect();
2365
2448
  } catch {
2366
2449
  }
2367
2450
  try {
2368
- (R = c.current) == null || R.disconnect();
2451
+ (A = l.current) == null || A.disconnect();
2369
2452
  } catch {
2370
2453
  }
2371
- j.current && ((f = ((A = x.current) == null ? void 0 : A.mediaStream) || void 0) == null || f.getTracks().forEach((M) => M.stop())), m.current && m.current.state !== "closed" && m.current.close();
2454
+ y.current && ((x = ((M = p.current) == null ? void 0 : M.mediaStream) || void 0) == null || x.getTracks().forEach((D) => D.stop())), m.current && m.current.state !== "closed" && m.current.close();
2372
2455
  };
2373
- }, [l, o, a, w]);
2456
+ }, [c, o, a, w]);
2374
2457
  const S = () => {
2375
- const N = u.current, _ = c.current;
2376
- if (!N || !_) return;
2377
- const v = N.getContext("2d");
2378
- if (!v) return;
2379
- const R = window.devicePixelRatio || 1, A = N.width, f = N.height, M = _.frequencyBinCount, L = new Uint8Array(M), O = () => {
2380
- p.current = requestAnimationFrame(O), _.getByteTimeDomainData(L), v.clearRect(0, 0, A, f), v.fillStyle = "rgba(0,0,0,0)", v.fillRect(0, 0, A, f);
2381
- const U = Math.max(1, Math.floor(s * R)), z = Math.max(1, Math.floor(n * R)), H = U + z, Y = Math.max(8, Math.floor((A + z) / H)), B = Math.floor(L.length / Y);
2382
- for (let q = 0; q < Y; q++) {
2383
- const P = Math.min(L.length - 1, q * B), Q = L[P] / 128 - 1, W = Math.abs(Q), de = Math.pow(W, 0.6), K = Math.max(f * 0.06, de * (f * 0.9)), we = q * H, ue = (f - K) / 2, he = 140 - Math.min(140, 140 * W), J = 85, ie = 48 + Math.floor(12 * (1 - W));
2384
- v.fillStyle = `${d}`, v.shadowColor = `hsla(${he}, ${J}%, ${ie}%, ${0.25 * W})`, v.shadowBlur = 8 * W;
2385
- const re = Math.min(U / 2, K / 2);
2386
- Gt(v, we, ue, U, K, re), v.fill();
2458
+ const j = u.current, R = l.current;
2459
+ if (!j || !R) return;
2460
+ const N = j.getContext("2d");
2461
+ if (!N) return;
2462
+ const A = window.devicePixelRatio || 1, M = j.width, x = j.height, D = R.frequencyBinCount, L = new Uint8Array(D), O = () => {
2463
+ b.current = requestAnimationFrame(O), R.getByteTimeDomainData(L), N.clearRect(0, 0, M, x), N.fillStyle = "rgba(0,0,0,0)", N.fillRect(0, 0, M, x);
2464
+ const B = Math.max(1, Math.floor(s * A)), z = Math.max(1, Math.floor(n * A)), H = B + z, Y = Math.max(8, Math.floor((M + z) / H)), W = Math.floor(L.length / Y);
2465
+ for (let U = 0; U < Y; U++) {
2466
+ const P = Math.min(L.length - 1, U * W), Q = L[P] / 128 - 1, V = Math.abs(Q), we = Math.pow(V, 0.6), K = Math.max(x * 0.06, we * (x * 0.9)), ue = U * H, he = (x - K) / 2, me = 140 - Math.min(140, 140 * V), J = 85, ie = 48 + Math.floor(12 * (1 - V));
2467
+ N.fillStyle = `${d}`, N.shadowColor = `hsla(${me}, ${J}%, ${ie}%, ${0.25 * V})`, N.shadowBlur = 8 * V;
2468
+ const re = Math.min(B / 2, K / 2);
2469
+ Ht(N, ue, he, B, K, re), N.fill();
2387
2470
  }
2388
2471
  };
2389
2472
  O();
@@ -2401,11 +2484,11 @@ const ge = new Dt(), _t = (i = {}) => {
2401
2484
  }
2402
2485
  );
2403
2486
  };
2404
- function Gt(i, r, t, s, n, o) {
2487
+ function Ht(i, r, t, s, n, o) {
2405
2488
  const a = Math.min(o, s / 2, n / 2);
2406
2489
  i.beginPath(), i.moveTo(r + a, t), i.lineTo(r + s - a, t), i.quadraticCurveTo(r + s, t, r + s, t + a), i.lineTo(r + s, t + n - a), i.quadraticCurveTo(r + s, t + n, r + s - a, t + n), i.lineTo(r + a, t + n), i.quadraticCurveTo(r, t + n, r, t + n - a), i.lineTo(r, t + a), i.quadraticCurveTo(r, t, r + a, t), i.closePath();
2407
2490
  }
2408
- const Vt = ({
2491
+ const Yt = ({
2409
2492
  state: i,
2410
2493
  answeringTime: r,
2411
2494
  nextPhase: t,
@@ -2433,14 +2516,14 @@ const Vt = ({
2433
2516
  /* @__PURE__ */ e.jsx("p", { className: "iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]", children: "Done talking? Click the button to review your answer." })
2434
2517
  ] }),
2435
2518
  /* @__PURE__ */ e.jsxs("div", { children: [
2436
- /* @__PURE__ */ e.jsx(Wt, {}),
2519
+ /* @__PURE__ */ e.jsx(zt, {}),
2437
2520
  s && /* @__PURE__ */ e.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
2438
2521
  "Recording error: ",
2439
2522
  s.message
2440
2523
  ] })
2441
2524
  ] }),
2442
2525
  /* @__PURE__ */ e.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1", children: /* @__PURE__ */ e.jsx(
2443
- V,
2526
+ G,
2444
2527
  {
2445
2528
  onClick: () => {
2446
2529
  t();
@@ -2449,8 +2532,8 @@ const Vt = ({
2449
2532
  }
2450
2533
  ) })
2451
2534
  ] });
2452
- function zt() {
2453
- const [i, r] = k(!0), t = ee(
2535
+ function Qt() {
2536
+ const [i, r] = E(!0), t = ee(
2454
2537
  () => [0, 1, 2].map((s) => ({ id: s })),
2455
2538
  []
2456
2539
  );
@@ -2461,7 +2544,7 @@ function zt() {
2461
2544
  return () => clearInterval(s);
2462
2545
  }, []), /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-8 iw-h-full", children: [
2463
2546
  /* @__PURE__ */ e.jsx("div", { className: "iw-relative iw-w-80 iw-h-48 ", "aria-hidden": !0, children: t.map((s, n) => {
2464
- const o = n * 50, a = i ? o : o + 12, l = i ? 1 : 0.08, w = n * 140;
2547
+ const o = n * 50, a = i ? o : o + 12, c = i ? 1 : 0.08, w = n * 140;
2465
2548
  return /* @__PURE__ */ e.jsx(
2466
2549
  "div",
2467
2550
  {
@@ -2470,7 +2553,7 @@ function zt() {
2470
2553
  style: {
2471
2554
  top: 0,
2472
2555
  transform: `translateY(${a}px)`,
2473
- opacity: l,
2556
+ opacity: c,
2474
2557
  transition: `transform 600ms cubic-bezier(.2,.9,.3,1) ${w}ms, opacity 400ms ease ${w}ms`
2475
2558
  },
2476
2559
  children: /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-gap-3 iw-items-center", children: [
@@ -2487,7 +2570,7 @@ function zt() {
2487
2570
  /* @__PURE__ */ e.jsx("div", { className: "iw-text-center", children: /* @__PURE__ */ e.jsx("p", { className: "iw-text-gray-500 iw-font-medium", children: "Preparing your question..." }) })
2488
2571
  ] });
2489
2572
  }
2490
- const Ht = ({
2573
+ const Kt = ({
2491
2574
  size: i = "192px",
2492
2575
  className: r,
2493
2576
  colors: t,
@@ -2501,7 +2584,7 @@ const Ht = ({
2501
2584
  // Pastel blue
2502
2585
  c3: "oklch(78% 0.14 280)"
2503
2586
  // Pastel purple/lavender
2504
- }, ...t }, a = parseInt(i.replace("px", ""), 10), l = a < 50 ? Math.max(a * 8e-3, 1) : Math.max(a * 0.015, 4), w = a < 50 ? Math.max(a * 4e-3, 1.2) : Math.max(a * 8e-3, 1.5), d = a < 50 ? Math.max(a * 4e-3, 0.05) : Math.max(a * 8e-3, 0.1), u = a < 50 ? Math.max(a * 4e-3, 0.5) : Math.max(a * 8e-3, 2), h = a < 30 ? "0%" : a < 50 ? "5%" : a < 100 ? "15%" : "25%", m = a < 30 ? 1.1 : a < 50 ? Math.max(w * 1.2, 1.3) : w;
2587
+ }, ...t }, a = parseInt(i.replace("px", ""), 10), c = a < 50 ? Math.max(a * 8e-3, 1) : Math.max(a * 0.015, 4), w = a < 50 ? Math.max(a * 4e-3, 1.2) : Math.max(a * 8e-3, 1.5), d = a < 50 ? Math.max(a * 4e-3, 0.05) : Math.max(a * 8e-3, 0.1), u = a < 50 ? Math.max(a * 4e-3, 0.5) : Math.max(a * 8e-3, 2), h = a < 30 ? "0%" : a < 50 ? "5%" : a < 100 ? "15%" : "25%", m = a < 30 ? 1.1 : a < 50 ? Math.max(w * 1.2, 1.3) : w;
2505
2588
  return /* @__PURE__ */ e.jsx(
2506
2589
  "div",
2507
2590
  {
@@ -2514,7 +2597,7 @@ const Ht = ({
2514
2597
  "--c2": o.c2,
2515
2598
  "--c3": o.c3,
2516
2599
  "--animation-duration": `${s}s`,
2517
- "--blur-amount": `${l}px`,
2600
+ "--blur-amount": `${c}px`,
2518
2601
  "--contrast-amount": m,
2519
2602
  "--dot-size": `${d}px`,
2520
2603
  "--shadow-spread": `${u}px`,
@@ -2629,9 +2712,9 @@ const Ht = ({
2629
2712
  }
2630
2713
  );
2631
2714
  };
2632
- function Yt({ ttsError: i }) {
2715
+ function Jt({ ttsError: i }) {
2633
2716
  return /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-8 iw-w-full iw-h-full", children: [
2634
- /* @__PURE__ */ e.jsx(Ht, { size: "80px" }),
2717
+ /* @__PURE__ */ e.jsx(Kt, { size: "80px" }),
2635
2718
  i && /* @__PURE__ */ e.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
2636
2719
  "Audio playback failed: ",
2637
2720
  i.message
@@ -2639,7 +2722,7 @@ function Yt({ ttsError: i }) {
2639
2722
  /* @__PURE__ */ e.jsx("p", { className: "iw-text- iw-text-gray-700", children: "Your AI interviewer is speaking..." })
2640
2723
  ] });
2641
2724
  }
2642
- const Qt = ({ state: i, thinkingTime: r, nextPhase: t }) => /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-gap-6 iw-items-center iw-justify-center iw-text-center iw-h-full ", children: [
2725
+ const Xt = ({ state: i, thinkingTime: r, nextPhase: t }) => /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-gap-6 iw-items-center iw-justify-center iw-text-center iw-h-full ", children: [
2643
2726
  /* @__PURE__ */ e.jsxs("div", { children: [
2644
2727
  /* @__PURE__ */ e.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "Get Ready to Answer" }),
2645
2728
  /* @__PURE__ */ e.jsx("p", { className: "iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]", children: "After 30-seconds thinking time, recording will start automatically, or you can begin recording early by clicking the button below." })
@@ -2660,7 +2743,7 @@ const Qt = ({ state: i, thinkingTime: r, nextPhase: t }) => /* @__PURE__ */ e.js
2660
2743
  )
2661
2744
  ] }),
2662
2745
  /* @__PURE__ */ e.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1", children: /* @__PURE__ */ e.jsx(
2663
- V,
2746
+ G,
2664
2747
  {
2665
2748
  onClick: () => {
2666
2749
  t();
@@ -2668,7 +2751,7 @@ const Qt = ({ state: i, thinkingTime: r, nextPhase: t }) => /* @__PURE__ */ e.js
2668
2751
  children: "Start Answering"
2669
2752
  }
2670
2753
  ) })
2671
- ] }), Kt = ({ sttError: i }) => /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full", children: [
2754
+ ] }), Zt = ({ sttError: i }) => /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full", children: [
2672
2755
  /* @__PURE__ */ e.jsxs("svg", { width: "48", height: "48", viewBox: "0 0 60 60", fill: "none", children: [
2673
2756
  /* @__PURE__ */ e.jsx(
2674
2757
  "rect",
@@ -2728,7 +2811,7 @@ const Qt = ({ state: i, thinkingTime: r, nextPhase: t }) => /* @__PURE__ */ e.js
2728
2811
  /* @__PURE__ */ e.jsx("path", { d: "M12 17h.01" })
2729
2812
  ]
2730
2813
  }
2731
- ), Jt = (i) => /* @__PURE__ */ e.jsxs(
2814
+ ), ei = (i) => /* @__PURE__ */ e.jsxs(
2732
2815
  "svg",
2733
2816
  {
2734
2817
  xmlns: "http://www.w3.org/2000/svg",
@@ -2746,7 +2829,7 @@ const Qt = ({ state: i, thinkingTime: r, nextPhase: t }) => /* @__PURE__ */ e.js
2746
2829
  /* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "10" })
2747
2830
  ]
2748
2831
  }
2749
- ), Xt = (i) => /* @__PURE__ */ e.jsxs(
2832
+ ), ti = (i) => /* @__PURE__ */ e.jsxs(
2750
2833
  "svg",
2751
2834
  {
2752
2835
  xmlns: "http://www.w3.org/2000/svg",
@@ -2764,7 +2847,7 @@ const Qt = ({ state: i, thinkingTime: r, nextPhase: t }) => /* @__PURE__ */ e.js
2764
2847
  /* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "3" })
2765
2848
  ]
2766
2849
  }
2767
- ), Zt = (i) => /* @__PURE__ */ e.jsxs(
2850
+ ), ii = (i) => /* @__PURE__ */ e.jsxs(
2768
2851
  "svg",
2769
2852
  {
2770
2853
  xmlns: "http://www.w3.org/2000/svg",
@@ -2785,7 +2868,7 @@ const Qt = ({ state: i, thinkingTime: r, nextPhase: t }) => /* @__PURE__ */ e.js
2785
2868
  /* @__PURE__ */ e.jsx("path", { d: "M7 21H5a2 2 0 0 1-2-2v-2" })
2786
2869
  ]
2787
2870
  }
2788
- ), fe = (i) => /* @__PURE__ */ e.jsxs(
2871
+ ), xe = (i) => /* @__PURE__ */ e.jsxs(
2789
2872
  "svg",
2790
2873
  {
2791
2874
  xmlns: "http://www.w3.org/2000/svg",
@@ -2806,7 +2889,7 @@ const Qt = ({ state: i, thinkingTime: r, nextPhase: t }) => /* @__PURE__ */ e.js
2806
2889
  /* @__PURE__ */ e.jsx("path", { d: "M7 21H5a2 2 0 0 1-2-2v-2" })
2807
2890
  ]
2808
2891
  }
2809
- ), ei = (i) => /* @__PURE__ */ e.jsxs(
2892
+ ), ri = (i) => /* @__PURE__ */ e.jsxs(
2810
2893
  "svg",
2811
2894
  {
2812
2895
  xmlns: "http://www.w3.org/2000/svg",
@@ -2828,20 +2911,20 @@ const Qt = ({ state: i, thinkingTime: r, nextPhase: t }) => /* @__PURE__ */ e.js
2828
2911
  ]
2829
2912
  }
2830
2913
  ), se = 5;
2831
- function ti({
2914
+ function si({
2832
2915
  isOpen: i,
2833
2916
  onClose: r,
2834
2917
  warningCount: t,
2835
2918
  violationType: s,
2836
2919
  onDisqualify: n
2837
2920
  }) {
2838
- const [o, a] = k(10), l = E(r);
2921
+ const [o, a] = E(10), c = k(r);
2839
2922
  if (C(() => {
2840
- l.current = r;
2923
+ c.current = r;
2841
2924
  }, [r]), C(() => {
2842
2925
  if (!i) return;
2843
2926
  const m = setInterval(() => {
2844
- a((c) => c <= 1 ? (l.current(), 10) : c - 1);
2927
+ a((l) => l <= 1 ? (c.current(), 10) : l - 1);
2845
2928
  }, 1e3);
2846
2929
  return () => clearInterval(m);
2847
2930
  }, [i]), C(() => {
@@ -2855,43 +2938,43 @@ function ti({
2855
2938
  return {
2856
2939
  title: "Tab Switch Detected",
2857
2940
  description: "You attempted to switch to another tab or reload application.",
2858
- icon: /* @__PURE__ */ e.jsx(Xt, { className: "iw-h-5 iw-w-5" })
2941
+ icon: /* @__PURE__ */ e.jsx(ti, { className: "iw-h-5 iw-w-5" })
2859
2942
  };
2860
2943
  case "fullscreen_exit":
2861
2944
  return {
2862
2945
  title: "Full Screen Exit Detected",
2863
2946
  description: "You attempted to exit full screen mode.",
2864
- icon: /* @__PURE__ */ e.jsx(Ue, { className: "iw-h-5 iw-w-5" })
2947
+ icon: /* @__PURE__ */ e.jsx(Ve, { className: "iw-h-5 iw-w-5" })
2865
2948
  };
2866
2949
  case "focus_loss":
2867
2950
  return {
2868
2951
  title: "Focus Loss Detected",
2869
2952
  description: "You lost focus from the interview window.",
2870
- icon: /* @__PURE__ */ e.jsx(Zt, { className: "iw-h-5 iw-w-5" })
2953
+ icon: /* @__PURE__ */ e.jsx(ii, { className: "iw-h-5 iw-w-5" })
2871
2954
  };
2872
2955
  case "blocked_shortcut":
2873
2956
  return {
2874
2957
  title: "Keyboard Shortcut Blocked",
2875
2958
  description: "You attempted to use a blocked keyboard shortcut.",
2876
- icon: /* @__PURE__ */ e.jsx(fe, { className: "iw-h-5 iw-w-5" })
2959
+ icon: /* @__PURE__ */ e.jsx(xe, { className: "iw-h-5 iw-w-5" })
2877
2960
  };
2878
2961
  case "right_click_attempt":
2879
2962
  return {
2880
2963
  title: "Right Click Attempted",
2881
2964
  description: "You attempted to use the right click.",
2882
- icon: /* @__PURE__ */ e.jsx(ei, { className: "iw-h-5 iw-w-5" })
2965
+ icon: /* @__PURE__ */ e.jsx(ri, { className: "iw-h-5 iw-w-5" })
2883
2966
  };
2884
2967
  case "alt_tab_attempt":
2885
2968
  return {
2886
2969
  title: "Alt + Tab Attempted",
2887
2970
  description: "You attempted to use the Alt + Tab shortcut.",
2888
- icon: /* @__PURE__ */ e.jsx(fe, { className: "iw-h-5 iw-w-5" })
2971
+ icon: /* @__PURE__ */ e.jsx(xe, { className: "iw-h-5 iw-w-5" })
2889
2972
  };
2890
2973
  case "blocked_function_key":
2891
2974
  return {
2892
2975
  title: "Function Key Blocked",
2893
2976
  description: "You attempted to use a blocked function key.",
2894
- icon: /* @__PURE__ */ e.jsx(fe, { className: "iw-h-5 iw-w-5" })
2977
+ icon: /* @__PURE__ */ e.jsx(xe, { className: "iw-h-5 iw-w-5" })
2895
2978
  };
2896
2979
  default:
2897
2980
  return {
@@ -2911,12 +2994,12 @@ function ti({
2911
2994
  /* @__PURE__ */ e.jsx("h2", { className: "iw-mb-1 iw-text-xl iw-font-semibold iw-text-gray-900", children: "Security Violation" }),
2912
2995
  /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-gap-2", children: [
2913
2996
  /* @__PURE__ */ e.jsx("span", { className: "iw-text-sm iw-text-gray-500", children: "Warning" }),
2914
- /* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-gap-1", children: Array.from({ length: se }).map((m, c) => /* @__PURE__ */ e.jsx(
2997
+ /* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-gap-1", children: Array.from({ length: se }).map((m, l) => /* @__PURE__ */ e.jsx(
2915
2998
  "div",
2916
2999
  {
2917
- className: `iw-h-2 iw-w-2 iw-rounded-full ${c <= t - 1 ? "iw-bg-red-500" : "iw-bg-gray-200"}`
3000
+ className: `iw-h-2 iw-w-2 iw-rounded-full ${l <= t - 1 ? "iw-bg-red-500" : "iw-bg-gray-200"}`
2918
3001
  },
2919
- c
3002
+ l
2920
3003
  )) }),
2921
3004
  /* @__PURE__ */ e.jsxs("span", { className: "iw-text-sm iw-text-gray-500", children: [
2922
3005
  "(",
@@ -2942,7 +3025,7 @@ function ti({
2942
3025
  /* @__PURE__ */ e.jsx("h3", { className: "iw-mb-2 iw-font-semibold iw-text-gray-900", children: d.title }),
2943
3026
  /* @__PURE__ */ e.jsx("p", { className: "iw-text-sm iw-leading-relaxed iw-text-gray-700", children: d.description }),
2944
3027
  /* @__PURE__ */ e.jsxs("div", { className: "iw-mt-3 iw-flex iw-items-center iw-gap-2 iw-text-xs iw-text-red-600", children: [
2945
- /* @__PURE__ */ e.jsx(qe, { className: "iw-h-3 iw-w-3" }),
3028
+ /* @__PURE__ */ e.jsx(We, { className: "iw-h-3 iw-w-3" }),
2946
3029
  /* @__PURE__ */ e.jsx("span", { children: "This action is monitored for interview integrity" })
2947
3030
  ] })
2948
3031
  ] })
@@ -2956,7 +3039,7 @@ function ti({
2956
3039
  ] }) }),
2957
3040
  /* @__PURE__ */ e.jsx("div", { className: "iw-border-primary-100 iw-bg-primary-50 iw-rounded-xl iw-border iw-p-4", children: /* @__PURE__ */ e.jsxs("div", { className: "iw-text-center", children: [
2958
3041
  /* @__PURE__ */ e.jsxs("div", { className: "iw-mb-1 iw-flex iw-items-center iw-justify-center iw-gap-1.5", children: [
2959
- /* @__PURE__ */ e.jsx(Jt, { className: "iw-text-primary-600 iw-h-4 iw-w-4" }),
3042
+ /* @__PURE__ */ e.jsx(ei, { className: "iw-text-primary-600 iw-h-4 iw-w-4" }),
2960
3043
  /* @__PURE__ */ e.jsx("span", { className: "iw-text-primary-600 iw-text-2xl iw-font-bold", children: o })
2961
3044
  ] }),
2962
3045
  /* @__PURE__ */ e.jsx("div", { className: "iw-text-primary-700 iw-text-xs iw-font-medium", children: "Auto Close" })
@@ -2981,7 +3064,7 @@ function ti({
2981
3064
  ] }),
2982
3065
  /* @__PURE__ */ e.jsxs("div", { className: "iw-p-6 iw-pt-0", children: [
2983
3066
  /* @__PURE__ */ e.jsx(
2984
- V,
3067
+ G,
2985
3068
  {
2986
3069
  onClick: h,
2987
3070
  className: "iw-h-12 iw-w-full iw-rounded-xl iw-bg-gray-800 iw-text-sm iw-font-medium iw-text-white iw-hover:bg-gray-800",
@@ -2992,7 +3075,7 @@ function ti({
2992
3075
  ] })
2993
3076
  ] }) });
2994
3077
  }
2995
- const ii = (i) => /* @__PURE__ */ e.jsxs(
3078
+ const ni = (i) => /* @__PURE__ */ e.jsxs(
2996
3079
  "svg",
2997
3080
  {
2998
3081
  xmlns: "http://www.w3.org/2000/svg",
@@ -3010,7 +3093,7 @@ const ii = (i) => /* @__PURE__ */ e.jsxs(
3010
3093
  /* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "10" })
3011
3094
  ]
3012
3095
  }
3013
- ), ri = ({
3096
+ ), ai = ({
3014
3097
  showHardReloadWarning: i,
3015
3098
  onContinue: r
3016
3099
  }) => {
@@ -3018,7 +3101,7 @@ const ii = (i) => /* @__PURE__ */ e.jsxs(
3018
3101
  r();
3019
3102
  };
3020
3103
  return /* @__PURE__ */ e.jsxs(
3021
- Be,
3104
+ ze,
3022
3105
  {
3023
3106
  isOpen: i,
3024
3107
  onClose: t,
@@ -3039,7 +3122,7 @@ const ii = (i) => /* @__PURE__ */ e.jsxs(
3039
3122
  onClick: t,
3040
3123
  className: "iw-w-full iw-flex iw-items-center iw-justify-center iw-gap-2 iw-px-4 iw-py-3 iw-bg-gray-100 iw-text-gray-600 iw-rounded-md iw-font-medium iw-transition-colors hover:iw-bg-gray-200 focus:iw-outline-none focus:iw-ring-2 focus:iw-ring-gray-400 focus:iw-ring-offset-2",
3041
3124
  children: [
3042
- /* @__PURE__ */ e.jsx(ii, { className: "iw-size-4" }),
3125
+ /* @__PURE__ */ e.jsx(ni, { className: "iw-size-4" }),
3043
3126
  "Continue Session"
3044
3127
  ]
3045
3128
  }
@@ -3047,16 +3130,16 @@ const ii = (i) => /* @__PURE__ */ e.jsxs(
3047
3130
  ]
3048
3131
  }
3049
3132
  );
3050
- }, si = Ve(
3133
+ }, oi = Qe(
3051
3134
  ({ children: i, onDisqualify: r }, t) => {
3052
- const [s, n] = k(!1), [o, a] = k(!1), [l, w] = k(!1), [d, u] = k("fullscreen_exit"), { logViolation: h, violationCount: m } = Pt({
3135
+ const [s, n] = E(!1), [o, a] = E(!1), [c, w] = E(!1), [d, u] = E("fullscreen_exit"), { logViolation: h, violationCount: m } = $t({
3053
3136
  maxViolations: 5,
3054
3137
  onViolation: (g) => {
3055
3138
  o || (n(!0), u(g.type));
3056
3139
  }
3057
- }), { enterFullScreen: c, isFullScreen: x, exitFullScreen: p } = Nt({
3140
+ }), { enterFullScreen: l, isFullScreen: p, exitFullScreen: b } = St({
3058
3141
  onFullScreenChange(g) {
3059
- !g && !o && !l && (n(!0), h({
3142
+ !g && !o && !c && (n(!0), h({
3060
3143
  type: "fullscreen_exit",
3061
3144
  severity: "high",
3062
3145
  details: {
@@ -3067,8 +3150,8 @@ const ii = (i) => /* @__PURE__ */ e.jsxs(
3067
3150
  }
3068
3151
  });
3069
3152
  C(() => {
3070
- c();
3071
- }, []), ze(
3153
+ l();
3154
+ }, []), Ke(
3072
3155
  t,
3073
3156
  () => ({
3074
3157
  exitFullScreenIntentionally: async () => {
@@ -3081,113 +3164,113 @@ const ii = (i) => /* @__PURE__ */ e.jsxs(
3081
3164
  }
3082
3165
  }),
3083
3166
  []
3084
- ), At(h), St(h), Mt(), Ft();
3085
- const j = () => {
3086
- a(!0), p(), n(!1), r == null || r();
3167
+ ), _t(h), At(h), Pt(), Ot();
3168
+ const y = () => {
3169
+ a(!0), b(), n(!1), r == null || r();
3087
3170
  };
3088
3171
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
3089
3172
  /* @__PURE__ */ e.jsx("div", { className: "iw-relative iw-h-full iw-w-full", children: i }),
3090
3173
  /* @__PURE__ */ e.jsx(
3091
- ti,
3174
+ si,
3092
3175
  {
3093
3176
  warningCount: m,
3094
3177
  isOpen: s,
3095
3178
  violationType: d,
3096
3179
  onClose: () => {
3097
- n(!1), c();
3180
+ n(!1), l();
3098
3181
  },
3099
- onDisqualify: j
3182
+ onDisqualify: y
3100
3183
  }
3101
3184
  ),
3102
- !s && m > 0 && !o && !l && /* @__PURE__ */ e.jsx(
3103
- ri,
3185
+ !s && m > 0 && !o && !c && /* @__PURE__ */ e.jsx(
3186
+ ai,
3104
3187
  {
3105
- showHardReloadWarning: !x,
3188
+ showHardReloadWarning: !p,
3106
3189
  logViolation: h,
3107
- onContinue: c
3190
+ onContinue: l
3108
3191
  }
3109
3192
  )
3110
3193
  ] });
3111
3194
  }
3112
- ), ni = ({
3195
+ ), ci = ({
3113
3196
  interviewTitle: i,
3114
3197
  interviewId: r,
3115
3198
  onComplete: t,
3116
3199
  onDisqualify: s,
3117
3200
  className: n = ""
3118
3201
  }) => {
3119
- var re;
3120
- const o = Ct(), { baseUrl: a, authToken: l } = Pe(), { timers: w, stt: d, tts: u, proctoring: h } = lt(), m = E(null), [c, x] = k(null), [p, j] = k(""), g = E(""), y = E(null), S = {
3202
+ var re, ke, Ee;
3203
+ const o = Ge(), { baseUrl: a, authToken: c } = $e(), { timers: w, stt: d, tts: u, proctoring: h } = ut(), m = k(null), [l, p] = E(null), [b, y] = E(""), g = k(""), f = k(null), S = {
3121
3204
  thinkingTime: (w == null ? void 0 : w.thinkingDuration) || 30,
3122
3205
  answeringTime: (w == null ? void 0 : w.answeringDuration) || 120,
3123
3206
  editingTime: (w == null ? void 0 : w.editingDuration) || 30
3124
- }, { thinkingTime: N, answeringTime: _, editingTime: v } = S;
3207
+ }, { thinkingTime: j, answeringTime: R, editingTime: N } = S;
3125
3208
  C(() => {
3126
- g.current = p;
3127
- }, [p]);
3128
- const R = E(!1), {
3129
- speak: A,
3130
- stop: f,
3131
- error: M
3132
- } = _t({
3209
+ g.current = b;
3210
+ }, [b]);
3211
+ const A = k(!1), {
3212
+ speak: M,
3213
+ stop: x,
3214
+ error: D
3215
+ } = Lt({
3133
3216
  config: {
3134
3217
  baseUrl: a,
3135
3218
  provider: u == null ? void 0 : u.provider,
3136
- authToken: l
3219
+ authToken: c
3137
3220
  },
3138
3221
  onEnd: () => {
3139
- R.current = !1, P();
3222
+ A.current = !1, P();
3140
3223
  },
3141
3224
  onError: () => {
3142
- R.current || (R.current = !0, P());
3225
+ A.current || (A.current = !0, P());
3143
3226
  }
3144
- }), L = E(!1), O = E(!1), {
3145
- startRecording: U,
3227
+ }), L = k(!1), O = k(!1), {
3228
+ startRecording: B,
3146
3229
  stopRecording: z,
3147
3230
  transcribe: H,
3148
3231
  error: Y
3149
- } = Rt({
3232
+ } = Dt({
3150
3233
  config: {
3151
3234
  baseUrl: a,
3152
3235
  provider: d == null ? void 0 : d.provider,
3153
3236
  model: d == null ? void 0 : d.model,
3154
3237
  language: d == null ? void 0 : d.language,
3155
- authToken: l,
3156
- qnaId: ((re = y.current) == null ? void 0 : re.qna_id) || ""
3238
+ authToken: c,
3239
+ qnaId: ((re = f.current) == null ? void 0 : re.qna_id) || ""
3157
3240
  },
3158
3241
  onStart: () => {
3159
3242
  L.current = !1, O.current = !1;
3160
3243
  },
3161
3244
  onStop: () => {
3162
3245
  },
3163
- onTranscriptionComplete: (b) => {
3164
- j(b.transcript), O.current || (O.current = !0, P());
3246
+ onTranscriptionComplete: (v) => {
3247
+ y(v.transcript), O.current || (O.current = !0, P());
3165
3248
  },
3166
- onError: (b) => {
3167
- console.error("STT Error:", b), L.current || (L.current = !0, P());
3249
+ onError: (v) => {
3250
+ console.error("STT Error:", v), L.current || (L.current = !0, P());
3168
3251
  }
3169
- }), { state: B, startQuestion: q, nextPhase: P, completeInterview: Q } = vt({
3252
+ }), { state: W, startQuestion: U, nextPhase: P, completeInterview: Q } = Et({
3170
3253
  config: {
3171
- thinkingDuration: N,
3172
- answeringDuration: _,
3173
- editingDuration: v
3254
+ thinkingDuration: j,
3255
+ answeringDuration: R,
3256
+ editingDuration: N
3174
3257
  },
3175
3258
  callbacks: {
3176
- onPhaseChange: (b) => {
3177
- switch (b) {
3178
- case D.FETCHING_QUESTION:
3179
- W();
3180
- break;
3181
- case D.READING_QUESTION:
3182
- we();
3259
+ onPhaseChange: (v) => {
3260
+ switch (v) {
3261
+ case _.FETCHING_QUESTION:
3262
+ V();
3183
3263
  break;
3184
- case D.ANSWERING:
3264
+ case _.READING_QUESTION:
3185
3265
  ue();
3186
3266
  break;
3187
- case D.TRANSCRIBING:
3267
+ case _.ANSWERING:
3188
3268
  he();
3189
3269
  break;
3190
- case D.SUBMITTING:
3270
+ case _.TRANSCRIBING:
3271
+ me();
3272
+ break;
3273
+ case _.SUBMITTING:
3191
3274
  K();
3192
3275
  break;
3193
3276
  }
@@ -3198,133 +3281,140 @@ const ii = (i) => /* @__PURE__ */ e.jsxs(
3198
3281
  }
3199
3282
  });
3200
3283
  C(() => {
3201
- q();
3284
+ U();
3202
3285
  }, []);
3203
- const { execute: W, loading: de } = jt(
3286
+ const { execute: V, loading: we } = Tt(
3204
3287
  async () => {
3205
- var G, X;
3206
- const b = await o.generateQuestion({
3288
+ var q, X;
3289
+ const v = await o.generateQuestion({
3207
3290
  interviewId: r,
3208
- question: ((G = y.current) == null ? void 0 : G.question) || "",
3209
- qnaId: ((X = y.current) == null ? void 0 : X.qna_id) || "",
3291
+ question: ((q = f.current) == null ? void 0 : q.question) || "",
3292
+ qnaId: ((X = f.current) == null ? void 0 : X.qna_id) || "",
3210
3293
  answer: g.current
3211
3294
  });
3212
- return y.current = b.data, b;
3295
+ return f.current = v.data, v;
3213
3296
  },
3214
3297
  {
3215
- onSuccess: async (b) => {
3216
- b && b.data && (j(""), x(b.data), P());
3298
+ onSuccess: async (v) => {
3299
+ v && v.data && (y(""), p(v.data), P());
3217
3300
  },
3218
- onError: (b) => {
3219
- console.error("Failed to fetch questions:", b);
3301
+ onError: (v) => {
3302
+ console.error("Failed to fetch questions:", v);
3220
3303
  }
3221
3304
  }
3222
3305
  ), K = T(async () => {
3223
- q();
3224
- }, [q]), we = T(async () => {
3225
- var b;
3226
- if ((b = y.current) != null && b.question)
3306
+ U();
3307
+ }, [U]), ue = T(async () => {
3308
+ var v;
3309
+ if ((v = f.current) != null && v.question)
3227
3310
  try {
3228
- R.current = !1, await A(y.current.question), y.current.is_interview_done && (await ut(2e3), Q());
3229
- } catch (G) {
3230
- console.error("Failed to speak question:", G);
3311
+ A.current = !1, await M(f.current.question), f.current.is_interview_done && (await ft(2e3), Q());
3312
+ } catch (q) {
3313
+ console.error("Failed to speak question:", q);
3231
3314
  }
3232
3315
  else
3233
3316
  P();
3234
- }, [A, P, Q]), ue = T(async () => {
3317
+ }, [M, P, Q]), he = T(async () => {
3235
3318
  try {
3236
- await U(_);
3237
- } catch (b) {
3238
- console.error("Failed to start recording:", b), P();
3319
+ await B(R);
3320
+ } catch (v) {
3321
+ console.error("Failed to start recording:", v), P();
3239
3322
  }
3240
- }, [U, P]), he = T(async () => {
3323
+ }, [B, P]), me = T(async () => {
3241
3324
  try {
3242
- const b = await z();
3243
- await H(b);
3244
- } catch (b) {
3245
- console.error("STT processing failed:", b), !L.current && !O.current && (L.current = !0, P());
3325
+ const v = await z();
3326
+ await H(v);
3327
+ } catch (v) {
3328
+ console.error("STT processing failed:", v), !L.current && !O.current && (L.current = !0, P());
3246
3329
  }
3247
3330
  }, [z, H, P]), J = T(
3248
- async (b) => {
3249
- var X;
3250
- f(), await ((X = m.current) == null ? void 0 : X.exitFullScreenIntentionally()), (await o.generateQuestion({
3251
- interviewId: r,
3252
- isInterviewDone: !0
3253
- })).success && (b == null || b(), Q(), sessionStorage.removeItem(be));
3331
+ async (v) => {
3332
+ var q;
3333
+ x(), await ((q = m.current) == null ? void 0 : q.exitFullScreenIntentionally());
3334
+ try {
3335
+ (await o.generateQuestion({
3336
+ interviewId: r,
3337
+ isInterviewDone: !0
3338
+ })).success && (v == null || v(), Q(), sessionStorage.removeItem(ye));
3339
+ } catch (X) {
3340
+ console.error("API call failed:", X);
3341
+ }
3254
3342
  },
3255
- [r, f, o]
3343
+ [r, x, o]
3256
3344
  ), ie = () => {
3257
- const { phase: b } = B;
3258
- switch (b) {
3259
- case D.IDLE:
3345
+ const { phase: v } = W;
3346
+ switch (v) {
3347
+ case _.IDLE:
3260
3348
  return /* @__PURE__ */ e.jsxs("div", { className: "iw-text-center iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-2 iw-h-full", children: [
3261
3349
  /* @__PURE__ */ e.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "Ready to start the Interview?" }),
3262
3350
  /* @__PURE__ */ e.jsx("p", { className: "iw-max-w-xl iw-text-gray-500 iw-text-xs iw-leading-[21px]", children: `You will be asked a series of behavioral and technical questions. For each one you'll get a short thinking period, then a timed recording window. We'll transcribe your response so you can review and edit it before submitting. Click "Start Interview" when you're ready.` }),
3263
- /* @__PURE__ */ e.jsx(V, { onClick: q, className: "iw-mt-2 iw-w-40", children: "Start Interview" })
3351
+ /* @__PURE__ */ e.jsx(G, { onClick: U, className: "iw-mt-2 iw-w-40", children: "Start Interview" })
3264
3352
  ] });
3265
- case D.FETCHING_QUESTION:
3266
- return /* @__PURE__ */ e.jsx(zt, {});
3267
- case D.READING_QUESTION:
3268
- return /* @__PURE__ */ e.jsx(Yt, { ttsError: M });
3269
- case D.THINKING:
3353
+ case _.FETCHING_QUESTION:
3354
+ return /* @__PURE__ */ e.jsx(Qt, {});
3355
+ case _.READING_QUESTION:
3356
+ return /* @__PURE__ */ e.jsx(Jt, { ttsError: D });
3357
+ case _.THINKING:
3270
3358
  return /* @__PURE__ */ e.jsx(
3271
- Qt,
3359
+ Xt,
3272
3360
  {
3273
- state: B,
3274
- thinkingTime: N,
3361
+ state: W,
3362
+ thinkingTime: j,
3275
3363
  nextPhase: P
3276
3364
  }
3277
3365
  );
3278
- case D.ANSWERING:
3366
+ case _.ANSWERING:
3279
3367
  return /* @__PURE__ */ e.jsx(
3280
- Vt,
3368
+ Yt,
3281
3369
  {
3282
- state: B,
3283
- answeringTime: _,
3370
+ state: W,
3371
+ answeringTime: R,
3284
3372
  nextPhase: P,
3285
3373
  sttError: Y
3286
3374
  }
3287
3375
  );
3288
- case D.TRANSCRIBING:
3289
- return /* @__PURE__ */ e.jsx(Kt, { sttError: Y });
3290
- case D.EDITING:
3291
- case D.SUBMITTING:
3376
+ case _.TRANSCRIBING:
3377
+ return /* @__PURE__ */ e.jsx(Zt, { sttError: Y });
3378
+ case _.EDITING:
3379
+ case _.SUBMITTING:
3292
3380
  return /* @__PURE__ */ e.jsx("div", { className: "iw-space-y-4 iw-h-full", children: /* @__PURE__ */ e.jsx(
3293
- Ot,
3381
+ Bt,
3294
3382
  {
3295
- value: p,
3296
- onChange: (G) => j(G.target.value),
3383
+ value: b,
3384
+ onChange: (q) => y(q.target.value),
3297
3385
  onSubmit: () => P(),
3298
- isSubmitDisabled: !p.trim() || de,
3299
- state: B,
3300
- editingTime: v
3386
+ isSubmitDisabled: !b.trim() || we,
3387
+ state: W,
3388
+ editingTime: N
3301
3389
  }
3302
3390
  ) });
3303
- case D.COMPLETED:
3391
+ case _.COMPLETED:
3304
3392
  return null;
3305
3393
  default:
3306
3394
  return null;
3307
3395
  }
3308
3396
  };
3309
3397
  return /* @__PURE__ */ e.jsx(e.Fragment, { children: h != null && h.enabled ? /* @__PURE__ */ e.jsxs(
3310
- si,
3398
+ oi,
3311
3399
  {
3312
3400
  ref: m,
3313
3401
  onDisqualify: () => J(s),
3314
3402
  children: [
3315
3403
  /* @__PURE__ */ e.jsx(
3316
- Ce,
3404
+ Ie,
3317
3405
  {
3318
3406
  title: i,
3319
3407
  onExit: () => J()
3320
3408
  }
3321
3409
  ),
3322
3410
  /* @__PURE__ */ e.jsx(
3323
- Te,
3411
+ Ce,
3324
3412
  {
3325
- currentQuestion: c,
3326
- phase: B.phase,
3413
+ currentQuestion: l,
3414
+ phase: W.phase,
3327
3415
  className: n,
3416
+ interviewId: r,
3417
+ interview_duration: (ke = f == null ? void 0 : f.current) == null ? void 0 : ke.interview_duration,
3328
3418
  children: ie()
3329
3419
  }
3330
3420
  )
@@ -3332,37 +3422,39 @@ const ii = (i) => /* @__PURE__ */ e.jsxs(
3332
3422
  }
3333
3423
  ) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
3334
3424
  /* @__PURE__ */ e.jsx(
3335
- Ce,
3425
+ Ie,
3336
3426
  {
3337
3427
  title: i,
3338
3428
  onExit: () => J()
3339
3429
  }
3340
3430
  ),
3341
3431
  /* @__PURE__ */ e.jsx(
3342
- Te,
3432
+ Ce,
3343
3433
  {
3344
- currentQuestion: c,
3345
- phase: B.phase,
3434
+ currentQuestion: l,
3435
+ phase: W.phase,
3346
3436
  className: n,
3437
+ interviewId: r,
3438
+ interview_duration: (Ee = f == null ? void 0 : f.current) == null ? void 0 : Ee.interview_duration,
3347
3439
  children: ie()
3348
3440
  }
3349
3441
  )
3350
3442
  ] }) });
3351
- }, ai = ({
3443
+ }, li = ({
3352
3444
  title: i,
3353
3445
  interviewId: r,
3354
3446
  onInterviewEnd: t,
3355
3447
  onInterviewDisqualify: s,
3356
3448
  className: n = ""
3357
3449
  }) => {
3358
- const [o, a] = xe.useState(!1), [l, w] = xe.useState(!0), d = E(null);
3450
+ const [o, a] = pe.useState(!1), [c, w] = pe.useState(!0), d = k(null);
3359
3451
  return o ? /* @__PURE__ */ e.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ e.jsx(
3360
3452
  "div",
3361
3453
  {
3362
3454
  ref: d,
3363
3455
  className: `iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${n}`,
3364
3456
  children: /* @__PURE__ */ e.jsx("div", { className: " iw-h-full iw-flex iw-flex-col", children: /* @__PURE__ */ e.jsx(
3365
- ni,
3457
+ ci,
3366
3458
  {
3367
3459
  interviewTitle: i ?? "Interview",
3368
3460
  interviewId: r,
@@ -3374,9 +3466,9 @@ const ii = (i) => /* @__PURE__ */ e.jsxs(
3374
3466
  ) })
3375
3467
  }
3376
3468
  ) }) : /* @__PURE__ */ e.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ e.jsx(
3377
- xt,
3469
+ vt,
3378
3470
  {
3379
- isOpen: l,
3471
+ isOpen: c,
3380
3472
  onStart: () => {
3381
3473
  a(!0), w(!1);
3382
3474
  }
@@ -3384,11 +3476,11 @@ const ii = (i) => /* @__PURE__ */ e.jsxs(
3384
3476
  ) });
3385
3477
  };
3386
3478
  typeof window < "u" && (window.InterviewWidget = {
3387
- InterviewWidget: ai,
3388
- InterviewWidgetProvider: ot
3479
+ InterviewWidget: li,
3480
+ InterviewWidgetProvider: wt
3389
3481
  });
3390
3482
  export {
3391
- ai as InterviewWidget,
3392
- ot as InterviewWidgetProvider,
3393
- ai as default
3483
+ li as InterviewWidget,
3484
+ wt as InterviewWidgetProvider,
3485
+ li as default
3394
3486
  };