interview-widget 1.0.8 → 1.0.10
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/assets/bolt-icon.d.ts +1 -0
- package/dist/assets/camera-off-icon.d.ts +1 -0
- package/dist/assets/index.d.ts +4 -0
- package/dist/assets/info-icon.d.ts +1 -0
- package/dist/assets/scan-face-icon.d.ts +1 -0
- package/dist/assets/target-icon.d.ts +1 -0
- package/dist/assets/users-icon.d.ts +1 -0
- package/dist/components/interview/interview-content.d.ts +4 -0
- package/dist/components/interview/interview-controller.d.ts +2 -0
- package/dist/components/interview/proctoring/face-data-permission-modal.d.ts +7 -0
- package/dist/components/interview/proctoring/gaze-detection/components/gaze-controls.d.ts +15 -0
- package/dist/components/interview/proctoring/gaze-detection/components/video-controls.d.ts +21 -0
- package/dist/components/interview/proctoring/gaze-detection/config/gaze-modal-config.d.ts +10 -0
- package/dist/components/interview/proctoring/gaze-detection/hooks/index.d.ts +9 -0
- package/dist/components/interview/proctoring/gaze-detection/hooks/use-camera-setup.d.ts +3 -0
- package/dist/components/interview/proctoring/gaze-detection/hooks/use-canvas-drawing.d.ts +11 -0
- package/dist/components/interview/proctoring/gaze-detection/hooks/use-face-analysis.d.ts +8 -0
- package/dist/components/interview/proctoring/gaze-detection/hooks/use-fps-counter.d.ts +4 -0
- package/dist/components/interview/proctoring/gaze-detection/hooks/use-gaze-analysis.d.ts +11 -0
- package/dist/components/interview/proctoring/gaze-detection/hooks/use-model-loader.d.ts +10 -0
- package/dist/components/interview/proctoring/gaze-detection/hooks/use-reference-manager.d.ts +11 -0
- package/dist/components/interview/proctoring/gaze-detection/hooks/use-render-loop.d.ts +5 -0
- package/dist/components/interview/proctoring/gaze-detection/hooks/use-warning-manager.d.ts +10 -0
- package/dist/components/interview/proctoring/gaze-detection/utils/types.d.ts +54 -0
- package/dist/components/media/video-feed.d.ts +6 -2
- package/dist/components/modals/gaze-warning-modal.d.ts +8 -0
- package/dist/components/modals/onboarding-modal.d.ts +4 -0
- package/dist/context/proctoring-context.d.ts +27 -0
- package/dist/services/api/interview-api.d.ts +9 -1
- package/dist/services/stt/stt-service.d.ts +4 -0
- package/dist/types.d.ts +15 -0
- package/dist/utils/constants.d.ts +1 -0
- package/dist/widget.css +1 -1
- package/dist/widget.es.js +6663 -1791
- package/dist/widget.umd.js +19 -5
- package/package.json +2 -1
package/dist/widget.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(he,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],d):(he=typeof globalThis<"u"?globalThis:he||self,d(he.InterviewWidget={},he.React,he.ReactDOM))})(this,function(he,d,Qt){"use strict";var Ah=Object.defineProperty;var Ch=(he,d,Qt)=>d in he?Ah(he,d,{enumerable:!0,configurable:!0,writable:!0,value:Qt}):he[d]=Qt;var je=(he,d,Qt)=>Ch(he,typeof d!="symbol"?d+"":d,Qt);var Ji=typeof document<"u"?document.currentScript:null,$s={exports:{}},Jr={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var qe=Symbol.for("react.transitional.element"),Ue=Symbol.for("react.fragment");function ke(i,r,t){var s=null;if(t!==void 0&&(s=""+t),r.key!==void 0&&(s=""+r.key),"key"in r){t={};for(var n in r)n!=="key"&&(t[n]=r[n])}else t=r;return r=t.ref,{$$typeof:qe,type:i,key:s,ref:r!==void 0?r:null,props:t}}ee.Fragment=Ue,ee.jsx=ke,ee.jsxs=ke,je.exports=ee;var e=je.exports;const le={},F={api:{baseUrl:"/api",retryConfig:{attempts:3,backoff:"exponential",baseDelay:1e3}},ui:{baseColor:"#3B82F6",borderRadius:"8px"},interview:{timers:{thinkingDuration:30,answeringDuration:120,editingDuration:30},stt:{provider:"groq",model:"whisper-large-v3-turbo",language:"en"},tts:{provider:"piper"},proctoring:{enabled:!0}}},ce="iw-storage";function We(){if(!(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:oe&&oe.tagName.toUpperCase()==="SCRIPT"&&oe.src||new URL("widget.umd.js",document.baseURI).href}<"u"&&(le!=null&&le.VITE_IW_SECRET)))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"}const Ne=We(),de="AES-GCM",we=12;async function Ee(i){const t=new TextEncoder().encode(i),s=await crypto.subtle.digest("SHA-256",t);return crypto.subtle.importKey("raw",s,de,!1,["encrypt","decrypt"])}function Be(){return crypto.getRandomValues(new Uint8Array(we))}async function Ge(i,r="default-seed"){try{const t=typeof i=="string"?i:JSON.stringify(i),n=new TextEncoder().encode(t),l=await Ee(r),a=Be(),c=await crypto.subtle.encrypt({name:de,iv:a},l,n),u=new Uint8Array(a.length+c.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(c),a.length),btoa(String.fromCharCode(...Array.from(u)))}catch(t){throw console.error("Encryption failed:",t),new Error("Failed to encrypt data")}}async function Ve(i,r="default-seed"){try{const t=atob(i),s=new Uint8Array(t.length);for(let w=0;w<t.length;w++)s[w]=t.charCodeAt(w);const n=s.slice(0,we),l=s.slice(we),a=await Ee(r),c=await crypto.subtle.decrypt({name:de,iv:n},a,l);return new TextDecoder().decode(c)}catch(t){throw console.error("Decryption failed:",t),new Error("Failed to decrypt data")}}async function ze(i,r="default-seed"){return Ge(i,r)}async function He(i,r="default-seed"){const t=await Ve(i,r);try{return JSON.parse(t)}catch{return t}}const te=o.createContext(null),Ye=async()=>{var i,r;try{const t=sessionStorage.getItem(ce);if(t){const s=await He(t,Ne);return{logViolations:((i=s.state)==null?void 0:i.logViolations)||[],totalViolations:((r=s.state)==null?void 0:r.totalViolations)||0}}}catch(t){console.error("Failed to load proctoring data from session storage:",t)}return{logViolations:[],totalViolations:0}},Ce=async i=>{try{const r=await ze({state:i,version:0},Ne);sessionStorage.setItem(ce,r)}catch(r){console.error("Failed to save proctoring data to session storage:",r)}},Qe=({children:i})=>{const r=o.useRef({logViolations:[],totalViolations:0}),t=o.useRef(new Set);o.useEffect(()=>{Ye().then(w=>{r.current=w,s()})},[]);const s=o.useCallback(()=>{t.current.forEach(w=>w())},[]),n=o.useCallback(w=>(t.current.add(w),()=>{t.current.delete(w)}),[]),l=o.useCallback(()=>r.current,[]),a=o.useCallback(w=>{r.current={logViolations:[...r.current.logViolations,w],totalViolations:r.current.totalViolations+1},Ce(r.current),s()},[s]),c=o.useCallback(()=>{r.current={logViolations:[],totalViolations:0},Ce(r.current),s()},[s]),u=o.useMemo(()=>({getState:l,addViolation:a,clearViolations:c,subscribe:n}),[l,a,c,n]);return e.jsx(te.Provider,{value:u,children:i})},Ke=()=>{const i=o.useContext(te);if(!i)throw new Error("useViolations must be used within a ProctoringProvider");return o.useSyncExternalStore(i.subscribe,()=>i.getState().logViolations,()=>i.getState().logViolations)},Je=()=>{const i=o.useContext(te);if(!i)throw new Error("useTotalViolations must be used within a ProctoringProvider");return o.useSyncExternalStore(i.subscribe,()=>i.getState().totalViolations,()=>i.getState().totalViolations)},Xe=()=>{const i=o.useContext(te);if(!i)throw new Error("useProctoringActions must be used within a ProctoringProvider");return{addViolation:i.addViolation,clearViolations:i.clearViolations}},Se=o.createContext(null);function Te({config:i={},children:r}){var s,n,l,a;const t={api:{...F.api,...i.api,retryConfig:{...F.api.retryConfig,...(s=i.api)==null?void 0:s.retryConfig}},ui:{...F.ui,...i.ui},interview:{...F.interview,...i.interview,timers:{...F.interview.timers,...(n=i.interview)==null?void 0:n.timers},stt:{...F.interview.stt,...(l=i.interview)==null?void 0:l.stt},tts:{...F.interview.tts,...(a=i.interview)==null?void 0:a.tts}}};return e.jsx(Se.Provider,{value:t,children:e.jsx(Qe,{children:r})})}function ie(){const i=o.useContext(Se);if(!i)throw new Error("useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>");return i}function Ie(){return ie().api||F.api}function V(){return ie().ui||F.ui}function Ze(){return ie().interview||F.interview}const Me=({className:i,...r})=>e.jsx("div",{children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`iw-animate-spin ${i}`,...r,children:[e.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),e.jsx("path",{d:"M12 6l0 -3"}),e.jsx("path",{d:"M16.25 7.75l2.15 -2.15"}),e.jsx("path",{d:"M18 12l3 0"}),e.jsx("path",{d:"M16.25 16.25l2.15 2.15"}),e.jsx("path",{d:"M12 18l0 3"}),e.jsx("path",{d:"M7.75 16.25l-2.15 2.15"}),e.jsx("path",{d:"M6 12l-3 0"}),e.jsx("path",{d:"M7.75 7.75l-2.15 -2.15"})]})}),Ae=({children:i,variant:r="primary",size:t="md",fullWidth:s=!1,isLoading:n=!1,disabled:l,className:a="",...c})=>{const u="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",w={primary:"iw-bg-primary-600 iw-text-white iw-hover:bg-primary-700 iw-border iw-border-transparent",secondary:"iw-bg-primary-100 iw-text-primary-700 iw-hover:bg-primary-200 iw-border iw-border-transparent",outline:"iw-bg-transparent iw-text-primary-700 iw-border iw-border-primary-500 iw-hover:bg-primary-50",text:"iw-bg-transparent iw-text-primary-600 iw-hover:bg-primary-50 iw-border iw-border-transparent",gradient:"iw-text-white iw-border iw-border-transparent iw-bg-gradient-to-r iw-from-purple-500 iw-to-indigo-500 hover:iw-from-purple-600 hover:iw-to-indigo-600"},h={sm:"iw-px-3 iw-py-1.5 iw-text-sm",md:"iw-px-4 iw-py-2.5 iw-text-sm",lg:"iw-px-5 iw-py-3 iw-text-base"},m="iw-disabled:opacity-50 iw-disabled:cursor-not-allowed iw-disabled:pointer-events-none",f=s?"iw-w-full":"";return e.jsxs("button",{className:`${u} ${w[r]} ${h[t]} ${f} ${m} ${a}`,disabled:l||n,...c,children:[n&&e.jsx(Me,{height:16,width:16,style:{marginRight:"3px"}}),i]})};function et(i){const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}function tt(i,r,t){return"#"+[i,r,t].map(s=>{const n=Math.round(s).toString(16);return n.length===1?"0"+n:n}).join("")}function De(i,r){const t=et(i);if(!t)return i;const s=t.r+(255-t.r)*r,n=t.g+(255-t.g)*r,l=t.b+(255-t.b)*r;return tt(s,n,l)}function it(i,r=.8){return{background:`linear-gradient(to bottom, ${De(i,r)}, #ffffff)`,color:"#1f2937"}}function rt(i){return new Promise(r=>setTimeout(r,i))}function _e(i){return`linear-gradient(to left, ${De(i,.4)}, ${i})`}const st=()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);function nt(i){try{const r=i.split(".");if(r.length!==3||!r[1])throw new Error("Invalid JWT token");const s=r[1].replace(/-/g,"+").replace(/_/g,"/"),n=s.padEnd(s.length+(4-s.length%4)%4,"="),l=atob(n);return JSON.parse(l)}catch(r){return console.error("Error decoding JWT:",r),null}}const Re=i=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:[e.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}),e.jsx("path",{d:"m9 12 2 2 4-4"})]}),Pe=i=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:[e.jsx("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}),e.jsx("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),e.jsx("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]}),at=i=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:[e.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),e.jsx("path",{d:"M15 8a5 5 0 0 1 0 8"}),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"})]}),G=i=>{const{baseColor:r,borderRadius:t}=V(),{loading:s,children:n,...l}=i;return e.jsx(Ae,{style:{background:_e(r),borderRadius:t},...l,children:s?e.jsx(Me,{}):n})},ot=["Do not refresh or reload the page during your assessment","Refrain from switching tabs or opening other applications while the session is in progress","Ensure your face remains clearly visible on camera at all times","Avoid frequent distractions or leaving your seat during the session","Do not disable or interfere with audio/video monitoring"],lt=({isOpen:i,onStart:r,onClose:t})=>{var T;const s=o.useRef(null),n=o.useRef(null),{baseColor:l,borderRadius:a}=V(),[c,u]=o.useState(!1),[w,h]=o.useState(null),[m,f]=o.useState(!1),d=l??"#2563eb",p=_e(d),b=a??18,k=(x,M)=>x.startsWith("#")&&x.length===7?`${x}${M}`:x,g=[`radial-gradient(120% 85% at 50% 125%, ${k(d,"34")} 0%, transparent 70%)`,`radial-gradient(90% 70% at 10% 130%, ${k(d,"24")} 0%, transparent 72%)`,`radial-gradient(90% 70% at 90% 130%, ${k(d,"24")} 0%, transparent 72%)`,`repeating-linear-gradient(135deg, ${k(d,"14")} 0, ${k(d,"14")} 16px, transparent 16px, transparent 32px)`].join(", "),v=c?{label:"Camera & microphone ready",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-emerald-400"}:m?{label:"Checking device access…",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-amber-300"}:{label:"Allow access to continue",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-rose-300"},C=c?{badge:"Ready",toneClass:"iw-bg-emerald-50 iw-text-emerald-600",cameraCopy:"Framing looks good for identity verification.",micCopy:"We can hear you clearly for your responses."}:m?{badge:"Checking",toneClass:"iw-bg-amber-50 iw-text-amber-600",cameraCopy:"Hang tight while we confirm camera access.",micCopy:"Listening for microphone permission from your browser."}:{badge:"Action needed",toneClass:"iw-bg-rose-50 iw-text-rose-600",cameraCopy:"Grant camera access to continue with the interview.",micCopy:"Enable microphone access so we can capture your answers."},N=[{label:"Camera feed",description:C.cameraCopy,status:C.badge,toneClass:C.toneClass,Icon:Pe},{label:"Microphone input",description:C.micCopy,status:C.badge,toneClass:C.toneClass,Icon:at}],D=()=>{n.current&&(n.current.getTracks().forEach(x=>x.stop()),n.current=null)},j=async()=>{f(!0),h(null);try{const x=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1280},height:{ideal:720}},audio:!0});n.current=x,s.current&&(s.current.srcObject=x),u(!0)}catch(x){console.error("Media permission error:",x);let M="Unable to access camera or microphone.";(x==null?void 0:x.name)==="NotAllowedError"?M="Permissions denied. Please allow access to camera and microphone.":(x==null?void 0:x.name)==="NotFoundError"?M="No camera/microphone found. Please connect a device and retry.":x!=null&&x.message&&(M=x.message),u(!1),h(M)}finally{f(!1)}};if(o.useEffect(()=>{if(!i){D();return}return j(),()=>{D()}},[i]),!i)return null;const S=()=>{r(),D()};return 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: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:[e.jsxs("div",{className:"iw-relative iw-overflow-hidden",style:{background:p},children:[e.jsx("div",{"aria-hidden":!0,className:"iw-absolute iw-pointer-events-none",style:{top:-90,right:-100,width:240,height:240,background:"radial-gradient(circle, rgba(255,255,255,0.6), transparent 70%)",filter:"blur(12px)"}}),e.jsx("div",{"aria-hidden":!0,className:"iw-absolute iw-pointer-events-none",style:{bottom:-110,left:-60,width:220,height:220,background:"radial-gradient(circle, rgba(255,255,255,0.35), transparent 70%)",filter:"blur(14px)"}}),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:[e.jsx("div",{className:"iw-flex iw-flex-col iw-gap-4 iw-text-white",children:e.jsxs("div",{className:"iw-flex iw-items-start iw-gap-4",children:[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:e.jsx(Re,{className:"iw-h-6 iw-w-6"})}),e.jsxs("div",{children:[e.jsx("p",{className:"iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-white/70",children:"Pre-interview checklist"}),e.jsx("h2",{className:"iw-mt-1 iw-text-xl iw-font-semibold iw-leading-tight",children:"Final checks before you go live"}),e.jsx("p",{className:"iw-mt-2 iw-text-sm iw-text-white/80",children:"Align your space, confirm device access, and step confidently into your secure session."})]})]})}),e.jsx("div",{className:"iw-flex iw-items-start iw-justify-end",children:e.jsxs("div",{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 ${v.toneClass}`,children:[e.jsx("span",{className:`iw-inline-flex iw-h-2 iw-w-2 iw-rounded-full ${v.dotClass}`}),v.label]})}),t&&e.jsx("button",{"aria-label":"Close",className:"iw-absolute iw-top-5 iw-right-5 iw-text-white/70 transition-colors hover:iw-text-white",onClick:()=>{D(),t==null||t()},children:"✕"})]})]}),e.jsxs("div",{className:"iw-relative iw-flex iw-flex-col iw-gap-6 iw-px-6 iw-pb-8 iw-pt-6",children:[e.jsxs("div",{className:"iw-grid xl:iw-grid-cols-[0.95fr_1.05fr] iw-gap-6",children:[e.jsx("section",{className:"iw-flex iw-flex-col iw-gap-5",children:e.jsxs("div",{className:"iw-rounded-2xl iw-border iw-border-slate-100 iw-bg-white iw-p-5 iw-shadow-sm",children:[e.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[e.jsx("h3",{className:"iw-text-sm iw-font-semibold iw-text-slate-900",children:"Proctoring guidelines"}),e.jsx("span",{className:"iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-slate-400",children:"Required"})]}),e.jsx("ul",{className:"iw-mt-5 iw-flex iw-flex-col iw-gap-4",children:ot.map((x,M)=>e.jsx("li",{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",children:e.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3",children:[e.jsx("span",{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",style:{background:p},children:M+1}),e.jsx("span",{className:"iw-text-sm iw-text-slate-600",children:x})]})},x))})]})}),e.jsxs("section",{className:"iw-flex iw-flex-col iw-gap-5",children:[e.jsxs("div",{className:"iw-relative iw-flex iw-flex-col iw-gap-6 iw-overflow-hidden iw-rounded-3xl iw-bg-white ",style:{borderRadius:b},children:[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:e.jsx("video",{ref:s,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-h-64 iw-w-full iw-rounded-2xl iw-object-cover",style:{transform:"scaleX(-1)",borderRadius:b}})}),e.jsxs("div",{className:"iw-relative iw-grid iw-grid-cols-2 iw-gap-4 iw-px-1",children:[e.jsx(Ae,{onClick:j,disabled:m,variant:"outline",size:"sm",className:"iw-font-medium",style:{borderColor:d,borderRadius:b,color:d},children:c?"Recheck permissions":"Enable camera & mic"}),e.jsx(G,{onClick:S,disabled:!c,className:"iw-h-10 iw-px-6 iw-text-sm",style:{backgroundColor:d},children:"Proceed"})]})]}),e.jsx("ul",{className:"iw-grid sm:iw-grid-cols-1 iw-gap-3",children:N.map(({Icon:x,label:M,description:P,status:L,toneClass:O})=>e.jsx("li",{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",children:e.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3",children:[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:e.jsx(x,{className:"iw-h-5 iw-w-5 iw-text-slate-600"})}),e.jsxs("div",{className:"iw-flex-1",children:[e.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-gap-3",children:[e.jsx("p",{className:"iw-text-sm iw-font-medium iw-text-slate-800",children:M}),e.jsx("span",{className:`iw-rounded-full iw-px-3 iw-py-1 iw-text-[11px] iw-font-semibold ${O}`,children:L})]}),e.jsx("p",{className:"iw-mt-1.5 iw-text-xs iw-text-slate-500",children:P})]})]})},M))}),w&&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:w}),!((T=navigator.mediaDevices)!=null&&T.getUserMedia)&&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."})]})]}),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: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."})}),e.jsx("div",{"aria-hidden":!0,className:"iw-pointer-events-none iw-absolute iw-inset-x-0 iw-bottom-1 iw-h-20",style:{backgroundImage:g,backgroundSize:"100% 120%, 100% 120%, 100% 120%, 32px 32px",backgroundPosition:"center bottom, left 95% bottom, right 95% bottom, center bottom",backgroundRepeat:"no-repeat, no-repeat, no-repeat, repeat",opacity:.9,transform:"translateY(4px)",maskImage:"linear-gradient(to top, rgba(0,0,0,0.92), transparent)",WebkitMaskImage:"linear-gradient(to top, rgba(0,0,0,0.92), transparent)"}})]})]})})};var I=(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))(I||{});const ct={thinkingDuration:30,answeringDuration:120,editingDuration:30},dt={idle:{next:"fetching_question"},fetching_question:{next:"reading_question"},reading_question:{next:"thinking"},thinking:{next:"answering",duration:30},answering:{next:"transcribing",duration:120},transcribing:{next:"editing"},editing:{next:"submitting",duration:30},submitting:{next:"completed"},completed:{next:"completed"}};class wt{constructor(r={},t={}){R(this,"config");R(this,"state");R(this,"phaseIntervalId",null);R(this,"globalIntervalId",null);R(this,"callbacks");this.config={...ct,...r},this.callbacks=t,this.state={phase:"idle",currentPhaseTimeRemaining:0,totalTimeElapsed:0,currentQuestionNumber:0}}getState(){return{...this.state}}startQuestion(){this.state.currentQuestionNumber===0&&this.startGlobalTimer(),this.state.currentQuestionNumber=this.state.currentQuestionNumber+1,this.state.phase="fetching_question",this.notifyChange()}nextPhase(){const r=this.state.phase,t=dt[r];if(!t)return;this.stopPhaseTimer(),this.state.phase=t.next;const s=this.getDurationForPhase(t.next);s>0?(this.state.currentPhaseTimeRemaining=s,this.startPhaseTimer()):this.state.currentPhaseTimeRemaining=0,this.notifyChange()}completeInterview(){var r,t;this.stopGlobalTimer(),this.stopPhaseTimer(),this.state.phase="completed",(t=(r=this.callbacks).onInterviewEnd)==null||t.call(r),this.notifyChange()}destroy(){this.stopPhaseTimer(),this.stopGlobalTimer()}getDurationForPhase(r){switch(r){case"thinking":return this.config.thinkingDuration;case"answering":return this.config.answeringDuration;case"editing":return this.config.editingDuration;default:return 0}}startGlobalTimer(){this.globalIntervalId=setInterval(()=>{var r,t;this.state.totalTimeElapsed++,(t=(r=this.callbacks).onTick)==null||t.call(r,this.getState())},1e3)}stopGlobalTimer(){this.globalIntervalId&&(clearInterval(this.globalIntervalId),this.globalIntervalId=null)}startPhaseTimer(){this.phaseIntervalId=setInterval(()=>{this.state.currentPhaseTimeRemaining--,this.state.currentPhaseTimeRemaining<=0&&this.nextPhase()},1e3)}stopPhaseTimer(){this.phaseIntervalId&&(clearInterval(this.phaseIntervalId),this.phaseIntervalId=null)}notifyChange(){var r,t;(t=(r=this.callbacks).onPhaseChange)==null||t.call(r,this.state.phase,this.getState())}}function ut(i={}){const{config:r={},callbacks:t={}}=i,s=o.useRef(null);s.current||(s.current=new wt(r,{}));const n=s.current,[l,a]=o.useState(n.getState()),c=o.useCallback(()=>{a(n.getState())},[n]);o.useEffect(()=>{const m={onPhaseChange:(f,d)=>{var p;c(),(p=t.onPhaseChange)==null||p.call(t,f,d)},onTick:f=>{var d;c(),(d=t.onTick)==null||d.call(t,f)},onInterviewEnd:()=>{var f;c(),(f=t.onInterviewEnd)==null||f.call(t)}};n.callbacks=m},[n,t,c]),o.useEffect(()=>()=>{n.destroy()},[n]);const u=o.useCallback(()=>{n.startQuestion(),c()},[n,c]),w=o.useCallback(()=>{n.nextPhase(),c()},[n,c]),h=o.useCallback(()=>{n.completeInterview(),c()},[n,c]);return{state:l,startQuestion:u,nextPhase:w,completeInterview:h,timerService:n}}function ht(i,r={}){const[t,s]=o.useState({data:null,loading:!1,error:null}),n=o.useCallback(async(...l)=>{var a,c,u,w;s(h=>({...h,loading:!0,error:null}));try{const h=await i(...l);s(m=>({...m,data:h,loading:!1,error:null})),(a=r.onSuccess)==null||a.call(r,h),(c=r.onSettled)==null||c.call(r,h,null)}catch(h){const m=h.type?h:{type:"unknown",message:h.message||"Unknown error",retryable:!0,userMessage:"Something went wrong. Please try again.",originalError:h};s(f=>({...f,loading:!1,error:m})),(u=r.onError)==null||u.call(r,m),(w=r.onSettled)==null||w.call(r,null,m)}},[i,r]);return{...t,execute:n}}const mt=i=>{const[r,t]=o.useState(null),[s,n]=o.useState(!1),l=document,a=()=>!!(l.fullscreenEnabled||l.webkitFullscreenEnabled||l.mozFullScreenEnabled||l.msFullscreenEnabled),c=()=>l.fullscreenElement||l.webkitFullscreenElement||l.mozFullScreenElement||l.msFullscreenElement,u=async d=>{var p;try{if(!a())throw new Error("Fullscreen is not supported in this environment");d.requestFullscreen?await d.requestFullscreen():d.webkitRequestFullscreen?await d.webkitRequestFullscreen():d.mozRequestFullScreen?await d.mozRequestFullScreen():d.msRequestFullscreen&&await d.msRequestFullscreen()}catch(b){const k={name:"FullscreenError",message:b instanceof Error?b.message:"Failed to enter fullscreen"};t(k),(p=i==null?void 0:i.onError)==null||p.call(i,k)}},w=async()=>{var d;try{l.exitFullscreen?await l.exitFullscreen():l.webkitExitFullscreen?await l.webkitExitFullscreen():l.mozCancelFullScreen?await l.mozCancelFullScreen():l.msExitFullscreen&&await l.msExitFullscreen()}catch(p){const b={name:"FullscreenError",message:p instanceof Error?p.message:"Failed to exit fullscreen"};t(b),(d=i==null?void 0:i.onError)==null||d.call(i,b)}},h=o.useCallback(()=>{var p;const d=!!c();n(d),(p=i==null?void 0:i.onFullScreenChange)==null||p.call(i,d)},[i]);o.useEffect(()=>{const d=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];return d.forEach(p=>{document.addEventListener(p,h)}),()=>{d.forEach(p=>{document.removeEventListener(p,h)})}},[h]);const m=async d=>{t(null);const p=d??document.documentElement;await u(p)};return{isFullScreen:s,toggleFullScreen:async d=>{s?await w():await m(d)},enterFullScreen:m,exitFullScreen:w,error:r}};function ft(i){var r;if(!navigator.onLine)return{type:"network",message:"No internet connection",retryable:!0,userMessage:"Please check your internet connection and try again."};if(i.name==="AbortError"||(r=i.message)!=null&&r.includes("timeout"))return{type:"timeout",message:"Request timed out",retryable:!0,userMessage:"The request is taking longer than expected. Please try again."};if(i.status){const{status:t}=i;if(t===401||t===403)return{type:"auth",status:t,message:"Authentication failed",retryable:!1,userMessage:"Your session has expired. Please refresh the page."};if(t===429)return{type:"rate-limit",status:t,message:"Too many requests",retryable:!0,userMessage:"Please wait a moment before trying again."};if(t>=500)return{type:"server",status:t,message:`Server error: ${t}`,retryable:!0,userMessage:"Our servers are experiencing issues. Please try again in a few moments."};if(t>=400)return{type:"client",status:t,message:`Client error: ${t}`,retryable:!1,userMessage:"There was an issue with your request. Please check your input."}}return{type:"unknown",message:i.message||"Unknown error occurred",retryable:!0,userMessage:"Something unexpected happened. Please try again.",originalError:i}}async function ue(i,r={},t={attempts:3,backoff:"exponential",baseDelay:1e3,maxDelay:1e4,jitter:!0}){let s;for(let n=1;n<=t.attempts;n++)try{const l=new AbortController,a=setTimeout(()=>l.abort(),6e4),c=await fetch(i,{...r,signal:l.signal});if(clearTimeout(a),c.status>=400&&c.status<500&&c.status!==429)return c;if(!c.ok)throw new Error(`HTTP ${c.status}: ${c.statusText}`);return c}catch(l){s=l;const a=ft(l);if(!a.retryable||n===t.attempts)throw a;const c=gt(n,t);console.warn(`API request failed (attempt ${n}/${t.attempts}), retrying in ${c}ms:`,a.message),await new Promise(u=>setTimeout(u,c))}throw s}function gt(i,r){let t;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*(.5+Math.random()*.5)),Math.round(t)}class xt{constructor(r={}){R(this,"config");this.config=r}updateConfig(r){this.config={...this.config,...r}}getHeaders(){var t;const r={"Content-Type":"application/json"};return(t=this.config)!=null&&t.authToken&&(r.Authorization=`Bearer ${this.config.authToken}`),r}getBaseUrl(){var r;return((r=this.config)==null?void 0:r.baseUrl)||"/api"}async generateQuestion({interviewId:r,isInterviewDone:t=!1,qnaId:s,question:n,answer:l,answerDuration:a}){const c=await ue(`${this.getBaseUrl()}/questions/next`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({interview_id:r,is_interview_done:t,qna_id:s,question:n,answer:l,answer_duration:a??"00:00:30"})});if(!c.ok)throw new Error(`Failed to get questions: ${c.status}`);return await c.json()}}function pt(){const i=ie();return o.useMemo(()=>{const t=i.api||{};return new xt(t)},[i.api])}const bt=i=>{o.useEffect(()=>{const r=s=>{(s.ctrlKey||s.metaKey)&&["c","v","a","t","n","w","r","s","p"].includes(s.key.toLowerCase())&&(s.preventDefault(),i({type:"blocked_shortcut",severity:"low",details:{action:"shortcut_pressed",reason:`Attempted to use a blocked keyboard shortcut: Ctrl + ${s.key}`}})),s.key.startsWith("F")&&s.key.length<=3&&(s.preventDefault(),i({type:"blocked_function_key",severity:"low",details:{action:"function_key_pressed",reason:`Attempted to use a blocked function key: ${s.key}`}})),s.altKey&&s.key==="Tab"&&(s.preventDefault(),i({type:"alt_tab_attempt",severity:"medium",details:{action:"alt_tab",reason:"Attempted to use the Alt + Tab shortcut"}}))},t=s=>{s.preventDefault(),i({type:"right_click_attempt",severity:"low",details:{action:"right_click",reason:"Attempted to use the right click"}})};return document.addEventListener("keydown",r),document.addEventListener("contextmenu",t),()=>{document.removeEventListener("keydown",r),document.removeEventListener("contextmenu",t)}},[i])};class E extends Error{constructor(r,t,s=!1){super(r),this.code=t,this.recoverable=s,this.name="STTError"}}class yt{constructor(r={}){R(this,"config");R(this,"mediaRecorder",null);R(this,"audioChunks",[]);R(this,"recordingStream",null);R(this,"autoStopTimeoutId",null);this.config={baseUrl:"http://localhost:8000",provider:"groq",model:"whisper-large-v3-turbo",language:"en",includeTimestamps:!1,temperature:0,...r}}updateConfig(r){this.config={...this.config,...r}}isRecordingSupported(){return!!(navigator.mediaDevices&&typeof navigator.mediaDevices.getUserMedia=="function"&&window.MediaRecorder)}async startRecording(r,t){var s;if(!this.isRecordingSupported())throw new E("Audio recording is not supported in this browser","RECORDING_NOT_SUPPORTED",!1);if(this.isRecording())throw new E("Recording is already in progress","ALREADY_RECORDING",!0);try{this.recordingStream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:44100}}),this.audioChunks=[];const n=this.getSupportedMimeType();this.mediaRecorder=new MediaRecorder(this.recordingStream,{mimeType:n}),this.mediaRecorder.ondataavailable=l=>{var a;l.data.size>0&&(this.audioChunks.push(l.data),(a=t==null?void 0:t.onDataAvailable)==null||a.call(t,l.data))},this.mediaRecorder.onstop=()=>{var l;(l=t==null?void 0:t.onStop)==null||l.call(t)},this.mediaRecorder.onerror=l=>{var c;const a=new E(`Recording failed: ${l.error}`,"RECORDING_ERROR",!0);(c=t==null?void 0:t.onError)==null||c.call(t,a),this.cleanup()},this.mediaRecorder.start(100),(s=t==null?void 0:t.onStart)==null||s.call(t),r&&r>0&&(this.autoStopTimeoutId=setTimeout(()=>{this.isRecording()&&this.stopRecording()},r*1e3))}catch(n){if(this.cleanup(),n instanceof Error){if(n.name==="NotAllowedError"||n.name==="PermissionDeniedError")throw new E("Microphone permission was denied","PERMISSION_DENIED",!1);if(n.name==="NotFoundError")throw new E("No microphone found","NO_MICROPHONE",!1)}throw new E(`Failed to start recording: ${n instanceof Error?n.message:String(n)}`,"START_RECORDING_FAILED",!0)}}async stopRecording(){if(this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),!this.mediaRecorder||!this.isRecording())throw new E("No active recording to stop","NO_ACTIVE_RECORDING",!1);return new Promise((r,t)=>{if(!this.mediaRecorder){t(new E("MediaRecorder is null","MEDIARECORDER_NULL",!1));return}const s=this.mediaRecorder,n=()=>{try{const l=s.mimeType||"audio/webm",a=new Blob(this.audioChunks,{type:l});this.cleanup(),r(a)}catch(l){t(new E(`Failed to create audio blob: ${l instanceof Error?l.message:String(l)}`,"BLOB_CREATION_FAILED",!1))}};s.addEventListener("stop",n,{once:!0}),s.stop()})}async transcribe(r){const{audioBlob:t,model:s=this.config.model,language:n=this.config.language,includeTimestamps:l=this.config.includeTimestamps,temperature:a=this.config.temperature}=r;if(!t||t.size===0)throw new E("Audio blob is empty or invalid","INVALID_AUDIO",!1);try{const c=new FormData,u=new File([t],"recording.wav",{type:t.type||"audio/wav"});c.append("file",u),c.append("model",s||"whisper-large-v3-turbo"),c.append("language",n||"en"),c.append("include_timestamps",String(l||!1)),c.append("temperature",String(a||0)),c.append("qna_id",this.config.qnaId||"");const w=await ue(`${this.config.baseUrl}/speech/transcribe`,{method:"POST",headers:{accept:"application/json","X-STT-Provider":this.config.provider||"groq",...this.config.authToken&&{Authorization:`Bearer ${this.config.authToken}`}},body:c},{attempts:1,backoff:"exponential",baseDelay:1e3,maxDelay:3e3,jitter:!0});if(!w.ok){const m=await w.text();let f=`STT request failed: ${w.status} ${w.statusText}`;try{const d=JSON.parse(m);f=d.message||d.error||f}catch{f=m||f}throw new E(f,`HTTP_${w.status}`,w.status>=500)}return{transcript:(await w.json()).data.text??""}}catch(c){throw c instanceof E?c:new E(`Transcription failed: ${c instanceof Error?c.message:String(c)}`,"TRANSCRIPTION_FAILED",!0)}}cancelRecording(){this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),this.mediaRecorder&&this.isRecording()&&this.mediaRecorder.stop(),this.cleanup()}isRecording(){return this.mediaRecorder!==null&&this.mediaRecorder.state==="recording"}getSupportedMimeType(){const r=["audio/webm","audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4","audio/wav"];for(const t of r)if(MediaRecorder.isTypeSupported(t))return t;return"audio/webm"}cleanup(){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)}}const z=new yt,vt=(i={})=>{const[r,t]=o.useState(!1),[s,n]=o.useState(!1),[l,a]=o.useState(null),[c,u]=o.useState(null),[w,h]=o.useState(null);i.config&&z.updateConfig(i.config);const m=o.useCallback(async b=>{var k;try{u(null),a(null),h(null),await z.startRecording(b,{onStart:()=>{var g;t(!0),(g=i.onStart)==null||g.call(i)},onStop:()=>{var g;t(!1),(g=i.onStop)==null||g.call(i)},onError:g=>{var C;const v=g instanceof E?g:new E(g.message,"RECORDING_ERROR",!0);u(v),t(!1),(C=i.onError)==null||C.call(i,v)}})}catch(g){const v=g instanceof E?g:new E(g instanceof Error?g.message:String(g),"START_FAILED",!1);throw u(v),t(!1),(k=i.onError)==null||k.call(i,v),v}},[]),f=o.useCallback(async()=>{var b,k;try{const g=await z.stopRecording();return h(g),t(!1),(b=i.onStop)==null||b.call(i),g}catch(g){const v=g instanceof E?g:new E(g instanceof Error?g.message:String(g),"STOP_FAILED",!1);throw u(v),t(!1),(k=i.onError)==null||k.call(i,v),v}},[]),d=o.useCallback(async(b,k={})=>{var g,v;try{u(null),n(!0);const C={audioBlob:b,...k},N=await z.transcribe(C);return a(N.transcript),n(!1),(g=i.onTranscriptionComplete)==null||g.call(i,N),N}catch(C){const N=C instanceof E?C:new E(C instanceof Error?C.message:String(C),"TRANSCRIPTION_FAILED",!0);throw u(N),n(!1),(v=i.onError)==null||v.call(i,N),N}},[]),p=o.useCallback(()=>{z.cancelRecording(),t(!1),h(null)},[]);return{startRecording:m,stopRecording:f,transcribe:d,cancelRecording:p,isRecording:r,isTranscribing:s,transcript:l,error:c,audioBlob:w}},jt=i=>{const r=o.useRef(null),t=o.useRef(!1);o.useEffect(()=>{const s=()=>{document.hidden&&(t.current=!0,r.current&&(clearTimeout(r.current),r.current=null),i({type:"tab_switch",severity:"high",details:{action:"tab_hidden",reason:"Attempted to switch tabs or applications"}}),setTimeout(()=>{t.current=!1},100))},n=()=>{t.current||(r.current=setTimeout(()=>{t.current||i({type:"focus_loss",severity:"medium",details:{action:"window_blur",reason:"Focus lost from the interview window"}}),r.current=null},50))};return document.addEventListener("visibilitychange",s),window.addEventListener("blur",n),()=>{document.removeEventListener("visibilitychange",s),window.removeEventListener("blur",n),r.current&&clearTimeout(r.current)}},[i])},kt=()=>{o.useEffect(()=>{const i=document.createElement("style");return i.textContent=`
|
|
9
|
+
*/var yl=Symbol.for("react.transitional.element"),bl=Symbol.for("react.fragment");function Hs(e,t,r){var i=null;if(r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),"key"in t){r={};for(var n in t)n!=="key"&&(r[n]=t[n])}else r=t;return t=r.ref,{$$typeof:yl,type:e,key:i,ref:t!==void 0?t:null,props:r}}Jr.Fragment=bl,Jr.jsx=Hs,Jr.jsxs=Hs,$s.exports=Jr;var o=$s.exports;const Qi={},Ze={api:{baseUrl:"/api",retryConfig:{attempts:3,backoff:"exponential",baseDelay:1e3}},ui:{baseColor:"#3B82F6",borderRadius:"8px"},interview:{timers:{thinkingDuration:30,answeringDuration:120,editingDuration:30},stt:{provider:"groq",model:"whisper-large-v3-turbo",language:"en"},tts:{provider:"piper"},proctoring:{enabled:!0,gazeAnalysisEnabled:!0}}},Zi="iw-storage";function vl(){if(!(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ji&&Ji.tagName.toUpperCase()==="SCRIPT"&&Ji.src||new URL("widget.umd.js",document.baseURI).href}<"u"&&(Qi!=null&&Qi.VITE_IW_SECRET)))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"}const qs=vl(),Ys=5,en="AES-GCM",tn=12;async function Ks(e){const r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return crypto.subtle.importKey("raw",i,en,!1,["encrypt","decrypt"])}function kl(){return crypto.getRandomValues(new Uint8Array(tn))}async function _l(e,t="default-seed"){try{const r=typeof e=="string"?e:JSON.stringify(e),n=new TextEncoder().encode(r),s=await Ks(t),a=kl(),c=await crypto.subtle.encrypt({name:en,iv:a},s,n),l=new Uint8Array(a.length+c.byteLength);return l.set(new Uint8Array(a),0),l.set(new Uint8Array(c),a.length),btoa(String.fromCharCode(...Array.from(l)))}catch(r){throw console.error("Encryption failed:",r),new Error("Failed to encrypt data")}}async function El(e,t="default-seed"){try{const r=atob(e),i=new Uint8Array(r.length);for(let u=0;u<r.length;u++)i[u]=r.charCodeAt(u);const n=i.slice(0,tn),s=i.slice(tn),a=await Ks(t),c=await crypto.subtle.decrypt({name:en,iv:n},a,s);return new TextDecoder().decode(c)}catch(r){throw console.error("Decryption failed:",r),new Error("Failed to decrypt data")}}async function jl(e,t="default-seed"){return _l(e,t)}async function Tl(e,t="default-seed"){const r=await El(e,t);try{return JSON.parse(r)}catch{return r}}const Sr=d.createContext(null),Sl=async()=>{try{const e=sessionStorage.getItem(Zi);if(e){const r=(await Tl(e,qs)).state;return{logViolations:(r==null?void 0:r.logViolations)||[],totalViolations:(r==null?void 0:r.totalViolations)||0,gazeViolationCounters:(r==null?void 0:r.gazeViolationCounters)||{lookingAwayCount:0,noFaceDetectedCount:0,multipleFacesCount:0,totalGazeViolations:0},referenceSet:(r==null?void 0:r.referenceSet)??!1,referenceRef:(r==null?void 0:r.referenceRef)??{x:.5,y:.5,noseX:.5,noseY:.5}}}}catch(e){console.error("Failed to load proctoring data from session storage:",e)}return{logViolations:[],totalViolations:0,gazeViolationCounters:{lookingAwayCount:0,noFaceDetectedCount:0,multipleFacesCount:0,totalGazeViolations:0},referenceSet:!1,referenceRef:{x:.5,y:.5,noseX:.5,noseY:.5}}},Ar=async e=>{try{const t=await jl({state:e,version:0},qs);sessionStorage.setItem(Zi,t)}catch(t){console.error("Failed to save proctoring data to session storage:",t)}},Al=({children:e})=>{const t=d.useRef({logViolations:[],totalViolations:0,gazeViolationCounters:{lookingAwayCount:0,noFaceDetectedCount:0,multipleFacesCount:0,totalGazeViolations:0},referenceSet:!1,referenceRef:{x:.5,y:.5,noseX:.5,noseY:.5}}),r=d.useRef(new Set);d.useEffect(()=>{Sl().then(w=>{t.current=w,i()})},[]);const i=d.useCallback(()=>{r.current.forEach(w=>w())},[]),n=d.useCallback(w=>(r.current.add(w),()=>{r.current.delete(w)}),[]),s=d.useCallback(()=>t.current,[]),a=d.useCallback(w=>{t.current={...t.current,logViolations:[...t.current.logViolations,w],totalViolations:t.current.totalViolations+1},Ar(t.current),i()},[i]),c=d.useCallback(w=>{const m={...t.current.gazeViolationCounters};w==="looking_away"&&(m.lookingAwayCount+=1),w==="no_face_detected"&&(m.noFaceDetectedCount+=1),w==="multiple_faces"&&(m.multipleFacesCount+=1),m.totalGazeViolations=m.lookingAwayCount+m.noFaceDetectedCount+m.multipleFacesCount,t.current={...t.current,gazeViolationCounters:m},Ar(t.current),i()},[i]),l=d.useCallback(()=>{t.current={...t.current,logViolations:[],totalViolations:0},Ar(t.current),i()},[i]),u=d.useCallback(()=>{t.current={...t.current,gazeViolationCounters:{lookingAwayCount:0,noFaceDetectedCount:0,multipleFacesCount:0,totalGazeViolations:0}},Ar(t.current),i()},[i]),h=d.useCallback((w,m)=>{t.current={...t.current,referenceSet:w,referenceRef:m},Ar(t.current),i()},[i]),f=d.useMemo(()=>({getState:s,addViolation:a,clearViolations:l,subscribe:n,incrementGazeViolation:c,clearGazeViolationCounters:u,setReferenceData:h}),[s,a,l,n,c,u,h]);return o.jsx(Sr.Provider,{value:f,children:e})},Xs=()=>{const e=d.useContext(Sr);if(!e)throw new Error("useProctoringStore must be used within a ProctoringProvider");const t=d.useSyncExternalStore(e.subscribe,e.getState,e.getState);return{logViolations:t.logViolations,totalViolations:t.totalViolations,addViolation:e.addViolation,clearViolations:e.clearViolations,gazeViolationCounters:t.gazeViolationCounters,referenceSet:t.referenceSet,referenceRef:t.referenceRef,incrementGazeViolation:e.incrementGazeViolation,clearGazeViolationCounters:e.clearGazeViolationCounters,setReferenceData:e.setReferenceData}},Cl=()=>{const e=d.useContext(Sr);if(!e)throw new Error("useViolations must be used within a ProctoringProvider");return d.useSyncExternalStore(e.subscribe,()=>e.getState().logViolations,()=>e.getState().logViolations)},Nl=()=>{const e=d.useContext(Sr);if(!e)throw new Error("useTotalViolations must be used within a ProctoringProvider");return d.useSyncExternalStore(e.subscribe,()=>e.getState().totalViolations,()=>e.getState().totalViolations)},Il=()=>{const e=d.useContext(Sr);if(!e)throw new Error("useProctoringActions must be used within a ProctoringProvider");return{addViolation:e.addViolation,clearViolations:e.clearViolations}},Js=d.createContext(null);function Qs({config:e={},children:t}){var i,n,s,a;const r={api:{...Ze.api,...e.api,retryConfig:{...Ze.api.retryConfig,...(i=e.api)==null?void 0:i.retryConfig}},ui:{...Ze.ui,...e.ui},interview:{...Ze.interview,...e.interview,timers:{...Ze.interview.timers,...(n=e.interview)==null?void 0:n.timers},stt:{...Ze.interview.stt,...(s=e.interview)==null?void 0:s.stt},tts:{...Ze.interview.tts,...(a=e.interview)==null?void 0:a.tts}}};return o.jsx(Js.Provider,{value:r,children:o.jsx(Al,{children:t})})}function Qr(){const e=d.useContext(Js);if(!e)throw new Error("useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>");return e}function Zs(){return Qr().api||Ze.api}function Cr(){return Qr().ui||Ze.ui}function rn(){return Qr().interview||Ze.interview}const eo=({className:e,...t})=>o.jsx("div",{children:o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`iw-animate-spin ${e}`,...t,children:[o.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o.jsx("path",{d:"M12 6l0 -3"}),o.jsx("path",{d:"M16.25 7.75l2.15 -2.15"}),o.jsx("path",{d:"M18 12l3 0"}),o.jsx("path",{d:"M16.25 16.25l2.15 2.15"}),o.jsx("path",{d:"M12 18l0 3"}),o.jsx("path",{d:"M7.75 16.25l-2.15 2.15"}),o.jsx("path",{d:"M6 12l-3 0"}),o.jsx("path",{d:"M7.75 7.75l-2.15 -2.15"})]})}),to=({children:e,variant:t="primary",size:r="md",fullWidth:i=!1,isLoading:n=!1,disabled:s,className:a="",...c})=>{const l="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",u={primary:"iw-bg-primary-600 iw-text-white iw-hover:bg-primary-700 iw-border iw-border-transparent",secondary:"iw-bg-primary-100 iw-text-primary-700 iw-hover:bg-primary-200 iw-border iw-border-transparent",outline:"iw-bg-transparent iw-text-primary-700 iw-border iw-border-primary-500 iw-hover:bg-primary-50",text:"iw-bg-transparent iw-text-primary-600 iw-hover:bg-primary-50 iw-border iw-border-transparent",gradient:"iw-text-white iw-border iw-border-transparent iw-bg-gradient-to-r iw-from-purple-500 iw-to-indigo-500 hover:iw-from-purple-600 hover:iw-to-indigo-600"},h={sm:"iw-px-3 iw-py-1.5 iw-text-sm",md:"iw-px-4 iw-py-2.5 iw-text-sm",lg:"iw-px-5 iw-py-3 iw-text-base"},f="iw-disabled:opacity-50 iw-disabled:cursor-not-allowed iw-disabled:pointer-events-none",w=i?"iw-w-full":"";return o.jsxs("button",{className:`${l} ${u[t]} ${h[r]} ${w} ${f} ${a}`,disabled:s||n,...c,children:[n&&o.jsx(eo,{height:16,width:16,style:{marginRight:"3px"}}),e]})};function Ml(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function Ll(e,t,r){return"#"+[e,t,r].map(i=>{const n=Math.round(i).toString(16);return n.length===1?"0"+n:n}).join("")}function ro(e,t){const r=Ml(e);if(!r)return e;const i=r.r+(255-r.r)*t,n=r.g+(255-r.g)*t,s=r.b+(255-r.b)*t;return Ll(i,n,s)}function Fl(e,t=.8){return{background:`linear-gradient(to bottom, ${ro(e,t)}, #ffffff)`,color:"#1f2937"}}function io(e){return new Promise(t=>setTimeout(t,e))}function no(e){return`linear-gradient(to left, ${ro(e,.4)}, ${e})`}const Pl=()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);function Dl(e){try{const t=e.split(".");if(t.length!==3||!t[1])throw new Error("Invalid JWT token");const i=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=i.padEnd(i.length+(4-i.length%4)%4,"="),s=atob(n);return JSON.parse(s)}catch(t){return console.error("Error decoding JWT:",t),null}}const so=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]}),oo=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}),o.jsx("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),o.jsx("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]}),Ol=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o.jsx("path",{d:"M15 8a5 5 0 0 1 0 8"}),o.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"})]}),qe=e=>{const{baseColor:t,borderRadius:r}=Cr(),{loading:i,children:n,...s}=e;return o.jsx(to,{style:{background:no(t),borderRadius:r},...s,children:i?o.jsx(eo,{}):n})},Zr=({isOpen:e,onClose:t,children:r,title:i,showCloseButton:n=!0,closeOnOverlayClick:s=!0,closeOnEscape:a=!0,className:c=""})=>{if(d.useEffect(()=>{if(!e||!a)return;const h=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,a,t]),d.useEffect(()=>(e?(document.body.style.overflow="hidden",document.body.classList.add("interview-widget-container")):(document.body.style.overflow="unset",document.body.classList.remove("interview-widget-container")),()=>{document.body.style.overflow="unset",document.body.classList.remove("interview-widget-container")}),[e]),!e)return null;const l=h=>{s&&h.target===h.currentTarget&&t()},u=o.jsxs("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center",children:[o.jsx("div",{className:"iw-fixed iw-inset-0 iw-bg-black iw-bg-opacity-50 iw-transition-opacity",onClick:l}),o.jsxs("div",{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}`,role:"dialog","aria-modal":"true","aria-labelledby":i?"dialog-title":void 0,children:[(i||n)&&o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-p-4 iw-border-b iw-border-gray-200",children:[i&&o.jsx("h2",{id:"dialog-title",className:"iw-text-lg iw-font-semibold iw-text-gray-900",children:i}),n&&o.jsx("button",{onClick:t,className:"iw-p-1 iw-text-gray-400 iw-hover:text-gray-600 iw-transition-colors iw-rounded iw-hover:bg-gray-100","aria-label":"Close dialog",children:o.jsx("svg",{className:"iw-w-5 iw-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsx("div",{className:"iw-p-4 iw-overflow-y-auto",children:r})]})]});return Qt.createPortal(u,document.body)},Rl=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-info-icon prefix__lucide-info",...e,children:[o.jsx("circle",{cx:12,cy:12,r:10}),o.jsx("path",{d:"M12 16v-4M12 8h.01"})]}),Bl=e=>o.jsx("svg",{width:24,height:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-scan-face-icon prefix__lucide-scan-face",...e,children:o.jsx("path",{d:"M3 7V5a2 2 0 012-2h2M17 3h2a2 2 0 012 2v2M21 17v2a2 2 0 01-2 2h-2M7 21H5a2 2 0 01-2-2v-2M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01"})});function Ul({isOpen:e,onDecline:t,onContinue:r}){return o.jsx(Zr,{isOpen:e,showCloseButton:!1,onClose:t,children:e&&o.jsx("div",{className:"iw-bg-white iw-border-slate-200 iw-rounded-2xl iw-p-0 iw-shadow-xl sm:iw-max-w-xl",children:o.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-4",children:[o.jsx("div",{className:"iw--mt-0.5 iw-h-2.5 iw-w-full iw-rounded-t-2xl iw-bg-gradient-to-r iw-from-blue-500 iw-to-indigo-500"}),o.jsx("div",{className:"iw-sr-only",children:"Face Data Usage Notice"}),o.jsx("div",{className:"iw-sr-only",children:"Permission to use face data for interview monitoring"}),o.jsxs("div",{className:"iw-px-8 iw-py-8",children:[o.jsxs("div",{className:"iw-text-center",children:[o.jsx("div",{className:"iw-mx-auto iw-mb-6 iw-flex iw-h-16 iw-w-16 iw-items-center iw-justify-center iw-rounded-full iw-border iw-border-blue-200 iw-bg-gradient-to-br iw-from-blue-50 iw-to-blue-100 iw-shadow-sm iw-ring-1 iw-ring-blue-100",children:o.jsx(Bl,{className:"iw-text-blue-600"})}),o.jsx("h1",{className:"iw-text-zinc-700 iw-mb-6 iw-text-2xl iw-font-semibold iw-tracking-tight",children:"Face Data Usage Notice"})]}),o.jsxs("ul",{className:"iw-mb-4 iw-list-item iw-space-y-4 iw-text-sm iw-leading-relaxed iw-text-gray-700",children:[o.jsx("li",{children:"To ensure the integrity of the interview process, this platform uses your device's camera to monitor your face and gaze direction."}),o.jsx("li",{children:"Your face data is processed only for proctoring purposes (e.g., detecting if you are looking away or off-screen)."}),o.jsx("li",{children:"All processing is limited to the interview session and is used solely to maintain fairness."})]}),o.jsxs("div",{className:"iw-text-zinc-700 iw-flex iw-items-start iw-gap-2 iw-rounded-md iw-border iw-border-blue-100 iw-bg-blue-50/60 iw-p-3 iw-text-sm iw-font-medium",children:[o.jsx(Rl,{className:"iw-text-neutral-400 iw-mt-0.5 iw-inline-block iw-size-4 iw-flex-shrink-0"}),o.jsx("p",{className:"",children:"Please note that we do not store, share, or use your biometric data beyond the scope of this interview."})]}),o.jsx("p",{className:"iw-text-neutral-400 iw-my-4 iw-text-center iw-text-sm",children:"By continuing, you acknowledge and consent to the use of your face data exclusively for interview monitoring purposes."}),o.jsxs("div",{className:"iw-flex iw-gap-3 iw-border-t iw-border-gray-200/80 iw-pt-6",children:[o.jsx(qe,{onClick:t,className:"iw-flex-1 iw-border",children:"Decline"}),o.jsx(qe,{onClick:r,className:"iw-flex-1",children:"I Understand & Continue"})]})]})]})})})}const Gl=["Do not refresh or reload the page during your assessment","Refrain from switching tabs or opening other applications while the session is in progress","Ensure your face remains clearly visible on camera at all times","Avoid frequent distractions or leaving your seat during the session","Do not disable or interfere with audio/video monitoring"],Vl=({isOpen:e,onStart:t,onRequestCalibration:r,onClose:i,gazeEnabled:n=!1,videoFeedRef:s})=>{var Q;const a=d.useRef(null),c=d.useRef(null),{baseColor:l,borderRadius:u}=Cr(),[h,f]=d.useState(!1),[w,m]=d.useState(!1),[p,E]=d.useState(!1),[v,g]=d.useState(!1),[T,S]=d.useState(!1),[A,U]=d.useState(null),[N,G]=d.useState(!1),L=l??"#2563eb",re=no(L),We=u??18,ke=(C,ue)=>C.startsWith("#")&&C.length===7?`${C}${ue}`:C,$e=[`radial-gradient(120% 85% at 50% 125%, ${ke(L,"34")} 0%, transparent 70%)`,`radial-gradient(90% 70% at 10% 130%, ${ke(L,"24")} 0%, transparent 72%)`,`radial-gradient(90% 70% at 90% 130%, ${ke(L,"24")} 0%, transparent 72%)`,`repeating-linear-gradient(135deg, ${ke(L,"14")} 0, ${ke(L,"14")} 16px, transparent 16px, transparent 32px)`].join(", "),_e=h?{label:"Camera & microphone ready",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-emerald-400"}:N?{label:"Checking device access…",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-amber-300"}:{label:"Allow access to continue",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-rose-300"},Ee=h?{badge:"Ready",toneClass:"iw-bg-emerald-50 iw-text-emerald-600",cameraCopy:"Framing looks good for identity verification.",micCopy:"We can hear you clearly for your responses."}:N?{badge:"Checking",toneClass:"iw-bg-amber-50 iw-text-amber-600",cameraCopy:"Hang tight while we confirm camera access.",micCopy:"Listening for microphone permission from your browser."}:{badge:"Action needed",toneClass:"iw-bg-rose-50 iw-text-rose-600",cameraCopy:"Grant camera access to continue with the interview.",micCopy:"Enable microphone access so we can capture your answers."},bt=[{label:"Camera feed",description:Ee.cameraCopy,status:Ee.badge,toneClass:Ee.toneClass,Icon:oo},{label:"Microphone input",description:Ee.micCopy,status:Ee.badge,toneClass:Ee.toneClass,Icon:Ol}],we=()=>{c.current&&(c.current.getTracks().forEach(C=>C.stop()),c.current=null)},Qe=async()=>{G(!0),U(null);try{const C=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1280},height:{ideal:720}},audio:!0});c.current=C,a.current&&(a.current.srcObject=C),f(!0)}catch(C){console.error("Media permission error:",C);let ue="Unable to access camera or microphone.";(C==null?void 0:C.name)==="NotAllowedError"?ue="Permissions denied. Please allow access to camera and microphone.":(C==null?void 0:C.name)==="NotFoundError"?ue="No camera/microphone found. Please connect a device and retry.":C!=null&&C.message&&(ue=C.message),f(!1),U(ue)}finally{G(!1)}};if(d.useEffect(()=>{if(!e){we();return}return Qe(),()=>we()},[e]),!e)return null;const le=()=>{n?E(!0):(t(),we())},at=async()=>{g(!0),r==null||r(),await io(2e3),g(!1),t()};return o.jsxs("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:[o.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:[o.jsxs("div",{className:"iw-relative iw-overflow-hidden",style:{background:re},children:[o.jsx("div",{"aria-hidden":!0,className:"iw-absolute iw-pointer-events-none",style:{top:-90,right:-100,width:240,height:240,background:"radial-gradient(circle, rgba(255,255,255,0.6), transparent 70%)",filter:"blur(12px)"}}),o.jsx("div",{"aria-hidden":!0,className:"iw-absolute iw-pointer-events-none",style:{bottom:-110,left:-60,width:220,height:220,background:"radial-gradient(circle, rgba(255,255,255,0.35), transparent 70%)",filter:"blur(14px)"}}),o.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:[o.jsx("div",{className:"iw-flex iw-flex-col iw-gap-4 iw-text-white",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-4",children:[o.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:o.jsx(so,{className:"iw-h-6 iw-w-6"})}),o.jsxs("div",{children:[o.jsx("p",{className:"iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-white/70",children:"Pre-interview checklist"}),o.jsx("h2",{className:"iw-mt-1 iw-text-xl iw-font-semibold iw-leading-tight",children:"Final checks before you go live"}),o.jsx("p",{className:"iw-mt-2 iw-text-sm iw-text-white/80",children:"Align your space, confirm device access, and step confidently into your secure session."})]})]})}),o.jsx("div",{className:"iw-flex iw-items-start iw-justify-end",children:o.jsxs("div",{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 ${_e.toneClass}`,children:[o.jsx("span",{className:`iw-inline-flex iw-h-2 iw-w-2 iw-rounded-full ${_e.dotClass}`}),_e.label]})}),i&&o.jsx("button",{"aria-label":"Close",className:"iw-absolute iw-top-5 iw-right-5 iw-text-white/70 transition-colors hover:iw-text-white",onClick:()=>{we(),i==null||i()},children:"✕"})]})]}),o.jsxs("div",{className:"iw-relative iw-flex iw-flex-col iw-gap-6 iw-px-6 iw-pb-8 iw-pt-6",children:[o.jsxs("div",{className:"iw-grid xl:iw-grid-cols-[0.95fr_1.05fr] iw-gap-6",children:[o.jsx("section",{className:"iw-flex iw-flex-col iw-gap-5",children:o.jsxs("div",{className:"iw-rounded-2xl iw-border iw-border-slate-100 iw-bg-white iw-p-5 iw-shadow-sm",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[o.jsx("h3",{className:"iw-text-sm iw-font-semibold iw-text-slate-900",children:"Proctoring guidelines"}),o.jsx("span",{className:"iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-slate-400",children:"Required"})]}),o.jsx("ul",{className:"iw-mt-5 iw-flex iw-flex-col iw-gap-4",children:Gl.map((C,ue)=>o.jsx("li",{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",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3",children:[o.jsx("span",{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",style:{background:re},children:ue+1}),o.jsx("span",{className:"iw-text-sm iw-text-slate-600",children:C})]})},C))})]})}),o.jsxs("section",{className:"iw-flex iw-flex-col iw-gap-5",children:[o.jsxs("div",{className:"iw-relative iw-flex iw-flex-col iw-gap-6 iw-overflow-hidden iw-rounded-3xl iw-bg-white ",style:{borderRadius:We},children:[o.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:o.jsx("video",{ref:a,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-h-64 iw-w-full iw-rounded-2xl iw-object-cover",style:{transform:"scaleX(-1)",borderRadius:We}})}),o.jsx("div",{className:"iw-relative iw-grid iw-grid-cols-2 iw-gap-4 iw-px-1",children:!p&&!T?o.jsxs(o.Fragment,{children:[o.jsx(to,{onClick:Qe,disabled:N,variant:"outline",size:"sm",className:"iw-font-medium",style:{borderColor:L,borderRadius:We,color:L},children:h?"Recheck permissions":"Enable camera & mic"}),o.jsx(qe,{onClick:le,disabled:!h,className:"iw-h-10 iw-px-6 iw-text-sm",style:{backgroundColor:L},children:"Proceed"})]}):n&&(p&&!T?o.jsx(qe,{onClick:()=>m(!0),disabled:!h,className:"iw-h-10 iw-px-6 iw-text-sm iw-col-span-2",style:{backgroundColor:L},children:"Calibrate Face Position"}):o.jsxs(qe,{onClick:at,disabled:v||!h,className:"iw-h-10 iw-px-6 iw-text-sm iw-col-span-2",style:{backgroundColor:L},children:[v?"Calibrating":"Start Calibration",v&&o.jsx("span",{className:"iw-ml-2 iw-animate-spin iw-inline-block iw-border-2 iw-border-t-transparent iw-border-stone-200 iw-size-4 iw-rounded-full","aria-label":"loading"})]}))})]}),n&&T?o.jsxs("span",{className:"iw-text-slate-700 iw-text-center iw-text-md",children:["Sit upright and look directly into the camera, then press the",o.jsx("span",{className:"iw-font-semibold",children:" Start Calibration "}),"button. Proper calibration is required and incorrect setup may affect your assessment."]}):o.jsx("ul",{className:"iw-grid sm:iw-grid-cols-1 iw-gap-3",children:bt.map(({Icon:C,label:ue,description:ct,status:qt,toneClass:Ft})=>o.jsx("li",{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",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3",children:[o.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:o.jsx(C,{className:"iw-h-5 iw-w-5 iw-text-slate-600"})}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-gap-3",children:[o.jsx("p",{className:"iw-text-sm iw-font-medium iw-text-slate-800",children:ue}),o.jsx("span",{className:`iw-rounded-full iw-px-3 iw-py-1 iw-text-[11px] iw-font-semibold ${Ft}`,children:qt})]}),o.jsx("p",{className:"iw-mt-1.5 iw-text-xs iw-text-slate-500",children:ct})]})]})},ue))}),A&&o.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:A}),!((Q=navigator.mediaDevices)!=null&&Q.getUserMedia)&&o.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."})]})]}),o.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:o.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."})}),o.jsx("div",{"aria-hidden":!0,className:"iw-pointer-events-none iw-absolute iw-inset-x-0 iw-bottom-1 iw-h-20",style:{backgroundImage:$e,backgroundSize:"100% 120%, 100% 120%, 100% 120%, 32px 32px",backgroundPosition:"center bottom, left 95% bottom, right 95% bottom, center bottom",backgroundRepeat:"no-repeat, no-repeat, no-repeat, repeat",opacity:.9,transform:"translateY(4px)",maskImage:"linear-gradient(to top, rgba(0,0,0,0.92), transparent)",WebkitMaskImage:"linear-gradient(to top, rgba(0,0,0,0.92), transparent)"}})]})]}),o.jsx(Ul,{isOpen:w,onDecline:()=>m(!1),onContinue:()=>{m(!1),S(!0)}})]})};var de=(e=>(e.IDLE="idle",e.FETCHING_QUESTION="fetching_question",e.READING_QUESTION="reading_question",e.THINKING="thinking",e.ANSWERING="answering",e.TRANSCRIBING="transcribing",e.EDITING="editing",e.SUBMITTING="submitting",e.COMPLETED="completed",e))(de||{});const zl={thinkingDuration:30,answeringDuration:120,editingDuration:30},Wl={idle:{next:"fetching_question"},fetching_question:{next:"reading_question"},reading_question:{next:"thinking"},thinking:{next:"answering",duration:30},answering:{next:"transcribing",duration:120},transcribing:{next:"editing"},editing:{next:"submitting",duration:30},submitting:{next:"completed"},completed:{next:"completed"}};class $l{constructor(t={},r={}){je(this,"config");je(this,"state");je(this,"phaseIntervalId",null);je(this,"globalIntervalId",null);je(this,"callbacks");this.config={...zl,...t},this.callbacks=r,this.state={phase:"idle",currentPhaseTimeRemaining:0,totalTimeElapsed:0,currentQuestionNumber:0}}getState(){return{...this.state}}startQuestion(){this.state.currentQuestionNumber===0&&this.startGlobalTimer(),this.state.currentQuestionNumber=this.state.currentQuestionNumber+1,this.state.phase="fetching_question",this.notifyChange()}nextPhase(){const t=this.state.phase,r=Wl[t];if(!r)return;this.stopPhaseTimer(),this.state.phase=r.next;const i=this.getDurationForPhase(r.next);i>0?(this.state.currentPhaseTimeRemaining=i,this.startPhaseTimer()):this.state.currentPhaseTimeRemaining=0,this.notifyChange()}completeInterview(){var t,r;this.stopGlobalTimer(),this.stopPhaseTimer(),this.state.phase="completed",(r=(t=this.callbacks).onInterviewEnd)==null||r.call(t),this.notifyChange()}destroy(){this.stopPhaseTimer(),this.stopGlobalTimer()}getDurationForPhase(t){switch(t){case"thinking":return this.config.thinkingDuration;case"answering":return this.config.answeringDuration;case"editing":return this.config.editingDuration;default:return 0}}startGlobalTimer(){this.globalIntervalId=setInterval(()=>{var t,r;this.state.totalTimeElapsed++,(r=(t=this.callbacks).onTick)==null||r.call(t,this.getState())},1e3)}stopGlobalTimer(){this.globalIntervalId&&(clearInterval(this.globalIntervalId),this.globalIntervalId=null)}startPhaseTimer(){this.phaseIntervalId=setInterval(()=>{this.state.currentPhaseTimeRemaining--,this.state.currentPhaseTimeRemaining<=0&&this.nextPhase()},1e3)}stopPhaseTimer(){this.phaseIntervalId&&(clearInterval(this.phaseIntervalId),this.phaseIntervalId=null)}notifyChange(){var t,r;(r=(t=this.callbacks).onPhaseChange)==null||r.call(t,this.state.phase,this.getState())}}function Hl(e={}){const{config:t={},callbacks:r={}}=e,i=d.useRef(null);i.current||(i.current=new $l(t,{}));const n=i.current,[s,a]=d.useState(n.getState()),c=d.useCallback(()=>{a(n.getState())},[n]);d.useEffect(()=>{const f={onPhaseChange:(w,m)=>{var p;c(),(p=r.onPhaseChange)==null||p.call(r,w,m)},onTick:w=>{var m;c(),(m=r.onTick)==null||m.call(r,w)},onInterviewEnd:()=>{var w;c(),(w=r.onInterviewEnd)==null||w.call(r)}};n.callbacks=f},[n,r,c]),d.useEffect(()=>()=>{n.destroy()},[n]);const l=d.useCallback(()=>{n.startQuestion(),c()},[n,c]),u=d.useCallback(()=>{n.nextPhase(),c()},[n,c]),h=d.useCallback(()=>{n.completeInterview(),c()},[n,c]);return{state:s,startQuestion:l,nextPhase:u,completeInterview:h,timerService:n}}function ql(e,t={}){const[r,i]=d.useState({data:null,loading:!1,error:null}),n=d.useCallback(async(...s)=>{var a,c,l,u;i(h=>({...h,loading:!0,error:null}));try{const h=await e(...s);i(f=>({...f,data:h,loading:!1,error:null})),(a=t.onSuccess)==null||a.call(t,h),(c=t.onSettled)==null||c.call(t,h,null)}catch(h){const f=h.type?h:{type:"unknown",message:h.message||"Unknown error",retryable:!0,userMessage:"Something went wrong. Please try again.",originalError:h};i(w=>({...w,loading:!1,error:f})),(l=t.onError)==null||l.call(t,f),(u=t.onSettled)==null||u.call(t,null,f)}},[e,t]);return{...r,execute:n}}const Yl=e=>{const[t,r]=d.useState(null),[i,n]=d.useState(!1),s=document,a=()=>!!(s.fullscreenEnabled||s.webkitFullscreenEnabled||s.mozFullScreenEnabled||s.msFullscreenEnabled),c=()=>s.fullscreenElement||s.webkitFullscreenElement||s.mozFullScreenElement||s.msFullscreenElement,l=async m=>{var p;try{if(!a())throw new Error("Fullscreen is not supported in this environment");m.requestFullscreen?await m.requestFullscreen():m.webkitRequestFullscreen?await m.webkitRequestFullscreen():m.mozRequestFullScreen?await m.mozRequestFullScreen():m.msRequestFullscreen&&await m.msRequestFullscreen()}catch(E){const v={name:"FullscreenError",message:E instanceof Error?E.message:"Failed to enter fullscreen"};r(v),(p=e==null?void 0:e.onError)==null||p.call(e,v)}},u=async()=>{var m;try{s.exitFullscreen?await s.exitFullscreen():s.webkitExitFullscreen?await s.webkitExitFullscreen():s.mozCancelFullScreen?await s.mozCancelFullScreen():s.msExitFullscreen&&await s.msExitFullscreen()}catch(p){const E={name:"FullscreenError",message:p instanceof Error?p.message:"Failed to exit fullscreen"};r(E),(m=e==null?void 0:e.onError)==null||m.call(e,E)}},h=d.useCallback(()=>{var p;const m=!!c();n(m),(p=e==null?void 0:e.onFullScreenChange)==null||p.call(e,m)},[e]);d.useEffect(()=>{const m=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];return m.forEach(p=>{document.addEventListener(p,h)}),()=>{m.forEach(p=>{document.removeEventListener(p,h)})}},[h]);const f=async m=>{r(null);const p=m??document.documentElement;await l(p)};return{isFullScreen:i,toggleFullScreen:async m=>{i?await u():await f(m)},enterFullScreen:f,exitFullScreen:u,error:t}};function Kl(e){var t;if(!navigator.onLine)return{type:"network",message:"No internet connection",retryable:!0,userMessage:"Please check your internet connection and try again."};if(e.name==="AbortError"||(t=e.message)!=null&&t.includes("timeout"))return{type:"timeout",message:"Request timed out",retryable:!0,userMessage:"The request is taking longer than expected. Please try again."};if(e.status){const{status:r}=e;if(r===401||r===403)return{type:"auth",status:r,message:"Authentication failed",retryable:!1,userMessage:"Your session has expired. Please refresh the page."};if(r===429)return{type:"rate-limit",status:r,message:"Too many requests",retryable:!0,userMessage:"Please wait a moment before trying again."};if(r>=500)return{type:"server",status:r,message:`Server error: ${r}`,retryable:!0,userMessage:"Our servers are experiencing issues. Please try again in a few moments."};if(r>=400)return{type:"client",status:r,message:`Client error: ${r}`,retryable:!1,userMessage:"There was an issue with your request. Please check your input."}}return{type:"unknown",message:e.message||"Unknown error occurred",retryable:!0,userMessage:"Something unexpected happened. Please try again.",originalError:e}}async function ei(e,t={},r={attempts:3,backoff:"exponential",baseDelay:1e3,maxDelay:1e4,jitter:!0}){let i;for(let n=1;n<=r.attempts;n++)try{const s=new AbortController,a=setTimeout(()=>s.abort(),6e4),c=await fetch(e,{...t,signal:s.signal});if(clearTimeout(a),c.status>=400&&c.status<500&&c.status!==429)return c;if(!c.ok)throw new Error(`HTTP ${c.status}: ${c.statusText}`);return c}catch(s){i=s;const a=Kl(s);if(!a.retryable||n===r.attempts)throw a;const c=Xl(n,r);console.warn(`API request failed (attempt ${n}/${r.attempts}), retrying in ${c}ms:`,a.message),await new Promise(l=>setTimeout(l,c))}throw i}function Xl(e,t){let r;return t.backoff==="exponential"?r=t.baseDelay*Math.pow(2,e-1):r=t.baseDelay,r=Math.min(r,t.maxDelay),t.jitter&&(r=r*(.5+Math.random()*.5)),Math.round(r)}class Jl{constructor(t={}){je(this,"config");this.config=t}updateConfig(t){this.config={...this.config,...t}}getHeaders(){var r;const t={"Content-Type":"application/json"};return(r=this.config)!=null&&r.authToken&&(t.Authorization=`Bearer ${this.config.authToken}`),t}getBaseUrl(){var t;return((t=this.config)==null?void 0:t.baseUrl)||"/api"}async generateQuestion({interviewId:t,isInterviewDone:r=!1,qnaId:i,question:n,answer:s,answerDuration:a}){const c=await ei(`${this.getBaseUrl()}/questions/next`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({interview_id:t,is_interview_done:r,qna_id:i,question:n,answer:s,answer_duration:a??"00:00:30"})});if(!c.ok)throw new Error(`Failed to get questions: ${c.status}`);return await c.json()}async requestScreenshotUploadUrl(t,r=`screenshot-${Date.now()}.jpeg`){const i=await ei(`${this.getBaseUrl()}/interview/${t}/content`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({filename:r,mime_type:"image/jpeg"})});if(!i.ok)throw new Error(`Failed to request screenshot upload URL: ${i.status}`);return await i.json()}async uploadScreenshot(t,r){const i=await fetch(t,{method:"PUT",body:r,headers:{"Content-Type":"image/jpeg"}});if(!i.ok)throw new Error(`Failed to upload screenshot: ${i.status}`)}}function ao(){const e=Qr();return d.useMemo(()=>{const r=e.api||{};return new Jl(r)},[e.api])}const Ql=e=>{d.useEffect(()=>{const t=i=>{(i.ctrlKey||i.metaKey)&&["c","v","a","t","n","w","r","s","p"].includes(i.key.toLowerCase())&&(i.preventDefault(),e({type:"blocked_shortcut",severity:"low",details:{action:"shortcut_pressed",reason:`Attempted to use a blocked keyboard shortcut: Ctrl + ${i.key}`}})),i.key.startsWith("F")&&i.key.length<=3&&(i.preventDefault(),e({type:"blocked_function_key",severity:"low",details:{action:"function_key_pressed",reason:`Attempted to use a blocked function key: ${i.key}`}})),i.altKey&&i.key==="Tab"&&(i.preventDefault(),e({type:"alt_tab_attempt",severity:"medium",details:{action:"alt_tab",reason:"Attempted to use the Alt + Tab shortcut"}}))},r=i=>{i.preventDefault(),e({type:"right_click_attempt",severity:"low",details:{action:"right_click",reason:"Attempted to use the right click"}})};return document.addEventListener("keydown",t),document.addEventListener("contextmenu",r),()=>{document.removeEventListener("keydown",t),document.removeEventListener("contextmenu",r)}},[e])};class Z extends Error{constructor(t,r,i=!1){super(t),this.code=r,this.recoverable=i,this.name="STTError"}}class Zl{constructor(t={}){je(this,"config");je(this,"mediaRecorder",null);je(this,"audioChunks",[]);je(this,"recordingStream",null);je(this,"autoStopTimeoutId",null);this.config={baseUrl:"http://localhost:8000",provider:"groq",model:"whisper-large-v3-turbo",language:"en",includeTimestamps:!1,temperature:0,...t}}updateConfig(t){this.config={...this.config,...t}}isRecordingSupported(){return!!(navigator.mediaDevices&&typeof navigator.mediaDevices.getUserMedia=="function"&&window.MediaRecorder)}async startRecording(t,r){var i;if(!this.isRecordingSupported())throw new Z("Audio recording is not supported in this browser","RECORDING_NOT_SUPPORTED",!1);if(this.isRecording())throw new Z("Recording is already in progress","ALREADY_RECORDING",!0);try{this.recordingStream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:44100}}),this.audioChunks=[];const n=this.getSupportedMimeType();this.mediaRecorder=new MediaRecorder(this.recordingStream,{mimeType:n}),this.mediaRecorder.ondataavailable=s=>{var a;s.data.size>0&&(this.audioChunks.push(s.data),(a=r==null?void 0:r.onDataAvailable)==null||a.call(r,s.data))},this.mediaRecorder.onstop=()=>{var s;(s=r==null?void 0:r.onStop)==null||s.call(r)},this.mediaRecorder.onerror=s=>{var c;const a=new Z(`Recording failed: ${s.error}`,"RECORDING_ERROR",!0);(c=r==null?void 0:r.onError)==null||c.call(r,a),this.cleanup()},this.mediaRecorder.start(100),(i=r==null?void 0:r.onStart)==null||i.call(r),t&&t>0&&(this.autoStopTimeoutId=setTimeout(()=>{this.isRecording()&&this.stopRecording()},t*1e3))}catch(n){if(this.cleanup(),n instanceof Error){if(n.name==="NotAllowedError"||n.name==="PermissionDeniedError")throw new Z("Microphone permission was denied","PERMISSION_DENIED",!1);if(n.name==="NotFoundError")throw new Z("No microphone found","NO_MICROPHONE",!1)}throw new Z(`Failed to start recording: ${n instanceof Error?n.message:String(n)}`,"START_RECORDING_FAILED",!0)}}async stopRecording(){if(this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),!this.mediaRecorder||!this.isRecording())throw new Z("No active recording to stop","NO_ACTIVE_RECORDING",!1);return new Promise((t,r)=>{if(!this.mediaRecorder){r(new Z("MediaRecorder is null","MEDIARECORDER_NULL",!1));return}const i=this.mediaRecorder,n=()=>{try{const s=i.mimeType||"audio/webm",a=new Blob(this.audioChunks,{type:s});this.cleanup(),t(a)}catch(s){r(new Z(`Failed to create audio blob: ${s instanceof Error?s.message:String(s)}`,"BLOB_CREATION_FAILED",!1))}};i.addEventListener("stop",n,{once:!0}),i.stop()})}async transcribe(t){const{audioBlob:r,model:i=this.config.model,language:n=this.config.language,includeTimestamps:s=this.config.includeTimestamps,temperature:a=this.config.temperature}=t;if(!r||r.size===0)throw new Z("Audio blob is empty or invalid","INVALID_AUDIO",!1);try{const c=new FormData,l=new File([r],"recording.wav",{type:r.type||"audio/wav"});c.append("file",l),c.append("model",i||"whisper-large-v3-turbo"),c.append("language",n||"en"),c.append("include_timestamps",String(s||!1)),c.append("temperature",String(a||0)),c.append("qna_id",this.config.qnaId||"");const u=await ei(`${this.config.baseUrl}/speech/transcribe`,{method:"POST",headers:{accept:"application/json","X-STT-Provider":this.config.provider||"groq",...this.config.authToken&&{Authorization:`Bearer ${this.config.authToken}`}},body:c},{attempts:1,backoff:"exponential",baseDelay:1e3,maxDelay:3e3,jitter:!0});if(!u.ok){const f=await u.text();let w=`STT request failed: ${u.status} ${u.statusText}`;try{const m=JSON.parse(f);w=m.message||m.error||w}catch{w=f||w}throw new Z(w,`HTTP_${u.status}`,u.status>=500)}return{transcript:(await u.json()).data.text??""}}catch(c){throw c instanceof Z?c:new Z(`Transcription failed: ${c instanceof Error?c.message:String(c)}`,"TRANSCRIPTION_FAILED",!0)}}cancelRecording(){this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),this.mediaRecorder&&this.isRecording()&&this.mediaRecorder.stop(),this.cleanup()}isRecording(){return this.mediaRecorder!==null&&this.mediaRecorder.state==="recording"}getSupportedMimeType(){const t=["audio/webm","audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4","audio/wav"];for(const r of t)if(MediaRecorder.isTypeSupported(r))return r;return"audio/webm"}getRecordingStream(){return this.recordingStream}cleanup(){this.recordingStream&&(this.recordingStream.getTracks().forEach(t=>t.stop()),this.recordingStream=null),this.mediaRecorder=null,this.audioChunks=[],this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null)}}const Zt=new Zl,eu=(e={})=>{const[t,r]=d.useState(!1),[i,n]=d.useState(!1),[s,a]=d.useState(null),[c,l]=d.useState(null),[u,h]=d.useState(null);e.config&&Zt.updateConfig(e.config);const f=d.useCallback(async E=>{var v;try{l(null),a(null),h(null),await Zt.startRecording(E,{onStart:()=>{var g;r(!0),(g=e.onStart)==null||g.call(e)},onStop:()=>{var g;r(!1),(g=e.onStop)==null||g.call(e)},onError:g=>{var S;const T=g instanceof Z?g:new Z(g.message,"RECORDING_ERROR",!0);l(T),r(!1),(S=e.onError)==null||S.call(e,T)}})}catch(g){const T=g instanceof Z?g:new Z(g instanceof Error?g.message:String(g),"START_FAILED",!1);throw l(T),r(!1),(v=e.onError)==null||v.call(e,T),T}},[]),w=d.useCallback(async()=>{var E,v;try{const g=await Zt.stopRecording();return h(g),r(!1),(E=e.onStop)==null||E.call(e),g}catch(g){const T=g instanceof Z?g:new Z(g instanceof Error?g.message:String(g),"STOP_FAILED",!1);throw l(T),r(!1),(v=e.onError)==null||v.call(e,T),T}},[]),m=d.useCallback(async(E,v={})=>{var g,T;try{l(null),n(!0);const S={audioBlob:E,...v},A=await Zt.transcribe(S);return a(A.transcript),n(!1),(g=e.onTranscriptionComplete)==null||g.call(e,A),A}catch(S){const A=S instanceof Z?S:new Z(S instanceof Error?S.message:String(S),"TRANSCRIPTION_FAILED",!0);throw l(A),n(!1),(T=e.onError)==null||T.call(e,A),A}},[]),p=d.useCallback(()=>{Zt.cancelRecording(),r(!1),h(null)},[]);return{startRecording:f,stopRecording:w,transcribe:m,cancelRecording:p,isRecording:t,isTranscribing:i,transcript:s,error:c,audioBlob:u}},tu=e=>{const t=d.useRef(null),r=d.useRef(!1);d.useEffect(()=>{const i=()=>{document.hidden&&(r.current=!0,t.current&&(clearTimeout(t.current),t.current=null),e({type:"tab_switch",severity:"high",details:{action:"tab_hidden",reason:"Attempted to switch tabs or applications"}}),setTimeout(()=>{r.current=!1},100))},n=()=>{r.current||(t.current=setTimeout(()=>{r.current||e({type:"focus_loss",severity:"medium",details:{action:"window_blur",reason:"Focus lost from the interview window"}}),t.current=null},50))};return document.addEventListener("visibilitychange",i),window.addEventListener("blur",n),()=>{document.removeEventListener("visibilitychange",i),window.removeEventListener("blur",n),t.current&&clearTimeout(t.current)}},[e])},ru=()=>{d.useEffect(()=>{const e=document.createElement("style");return e.textContent=`
|
|
10
10
|
* {
|
|
11
11
|
-webkit-user-select: none !important;
|
|
12
12
|
-moz-user-select: none !important;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
-ms-user-select: text !important;
|
|
20
20
|
user-select: text !important;
|
|
21
21
|
}
|
|
22
|
-
`,document.head.appendChild(
|
|
22
|
+
`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[])};class iu{constructor(t={}){je(this,"config");je(this,"currentAudio",null);this.config={baseUrl:"http://localhost:8000",provider:"piper",voice:"string",speed:1,...t}}updateConfig(t){this.config={...this.config,...t}}async synthesizeSpeech(t){const{text:r,voice:i=this.config.voice,speed:n=this.config.speed}=t,s=new URLSearchParams;s.append("text",r),s.append("voice",i||"string"),s.append("speed",(n==null?void 0:n.toString())||"1");const a=await ei(`${this.config.baseUrl}/speech/synthesize`,{method:"POST",headers:{accept:"application/json","X-TTS-Provider":this.config.provider||"piper","Content-Type":"application/x-www-form-urlencoded",...this.config.authToken&&{Authorization:`Bearer ${this.config.authToken}`}},body:s},{attempts:1,backoff:"fixed",baseDelay:1e3,maxDelay:1e3,jitter:!1});if(!a.ok)throw new Error(`TTS request failed: ${a.status} ${a.statusText}`);const c=a.headers.get("content-type");if(c&&c.includes("audio/"))return a.blob();try{const l=await a.json();throw new Error(`TTS Error: ${JSON.stringify(l)}`)}catch{throw new Error("TTS request failed with unknown error")}}async speak(t,r){var i,n;try{this.stop(),(i=r==null?void 0:r.onStart)==null||i.call(r);const s=await this.synthesizeSpeech(t),a=URL.createObjectURL(s);return this.currentAudio=new Audio(a),new Promise((c,l)=>{if(!this.currentAudio){l(new Error("Audio element not created"));return}const u=this.currentAudio;u.onended=()=>{var h;URL.revokeObjectURL(a),this.currentAudio=null,(h=r==null?void 0:r.onEnd)==null||h.call(r),c()},u.onerror=h=>{var w;URL.revokeObjectURL(a),this.currentAudio=null;const f=new Error(`Audio playback failed: ${h}`);(w=r==null?void 0:r.onError)==null||w.call(r,f),l(f)},u.play().catch(h=>{var w;URL.revokeObjectURL(a),this.currentAudio=null;const f=new Error(`Failed to play audio: ${h.message}`);(w=r==null?void 0:r.onError)==null||w.call(r,f),l(f)})})}catch(s){const a=s instanceof Error?s:new Error(`TTS Error: ${String(s)}`);throw(n=r==null?void 0:r.onError)==null||n.call(r,a),a}}stop(){this.currentAudio&&(this.currentAudio.pause(),this.currentAudio.currentTime=0,this.currentAudio=null)}isPlaying(){return this.currentAudio!==null&&!this.currentAudio.paused}}const nn=new iu,nu=(e={})=>{const[t,r]=d.useState(!1),[i,n]=d.useState(!1),[s,a]=d.useState(null);e.config&&nn.updateConfig(e.config);const c=d.useCallback(async(u,h={})=>{var f;try{a(null),n(!0);const w={text:u,...h};await nn.speak(w,{onStart:()=>{var m;n(!1),r(!0),(m=e.onStart)==null||m.call(e)},onEnd:()=>{var m;r(!1),(m=e.onEnd)==null||m.call(e)},onError:m=>{var p;r(!1),n(!1),a(m),(p=e.onError)==null||p.call(e,m)}})}catch(w){const m=w instanceof Error?w:new Error(String(w));throw a(m),r(!1),n(!1),(f=e.onError)==null||f.call(e,m),m}},[e]),l=d.useCallback(()=>{nn.stop(),r(!1),n(!1)},[]);return{speak:c,stop:l,isPlaying:t,isLoading:i,error:s}},su=({onViolation:e,onEnd:t,maxViolations:r=5})=>{const{addViolation:i}=Il(),n=Cl(),s=Nl(),a=d.useRef(s);d.useEffect(()=>{a.current=s},[s]);const c=d.useCallback(u=>{t&&t(u,a.current)},[t]);return{logViolation:d.useCallback(({type:u,severity:h,details:f})=>{const w={id:Pl(),type:u,severity:h,details:f,timestamp:Date.now()};i(w);const m=a.current+1;e&&e(w,m),m>=r&&c("excessive_violations")},[i,e,r,c]),onInterviewEnd:c,violationCount:s,logList:n}},ou=()=>{d.useEffect(()=>{function e(){console.clear(),console.log(`
|
|
23
23
|
%c
|
|
24
24
|
╔═══════════════════════════════════════════════════════════════════════╗
|
|
25
25
|
║ ║
|
|
@@ -65,7 +65,21 @@
|
|
|
65
65
|
│ │
|
|
66
66
|
│ 💡 IMMEDIATE ACTION REQUIRED: │
|
|
67
67
|
│ Close developer tools to continue interview │
|
|
68
|
-
└─────────────────────────────────────────────────────────────┘`,"color: #ffd93d; font-size: 14px; font-family: monospace; background: rgba(255, 217, 61, 0.1); padding: 10px;")}const r={open:!1,orientation:null},t=160,s=setInterval(()=>{window.outerHeight-window.innerHeight>t||window.outerWidth-window.innerWidth>t?r.open||(r.open=!0,r.orientation=window.outerWidth-window.innerWidth>t?"vertical":"horizontal",i()):r.open&&(r.open=!1,console.log("%c🌟 Developer tools closed. Interview continues smoothly! ✨","color: #4ecdc4; font-weight: bold; text-shadow: 0 0 10px #4ecdc4;"))},500),n=a=>{if(a.keyCode===123||a.ctrlKey&&a.shiftKey&&(a.keyCode===73||a.keyCode===74)||a.ctrlKey&&a.keyCode===85)return a.preventDefault(),console.log("%c🎭 Nice try! Keyboard shortcuts are disabled during interviews ✨","color: #ffd93d; font-weight: bold; text-shadow: 0 0 10px #ffd93d;"),!1},l=a=>(a.preventDefault(),console.log("%c🌈 Right-click menu disabled for interview integrity! 🎪","color: #ff9ff3; font-weight: bold; text-shadow: 0 0 10px #ff9ff3;"),!1);return document.addEventListener("keydown",n),document.addEventListener("contextmenu",l),()=>{clearInterval(s),document.removeEventListener("keydown",n),document.removeEventListener("contextmenu",l),delete window.showStats,delete window.interviewTips}},[])},me=i=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:[e.jsx("path",{d:"M12 2a10 10 0 0 1 7.38 16.75"}),e.jsx("path",{d:"M12 6v6l4 2"}),e.jsx("path",{d:"M2.5 8.875a10 10 0 0 0-.5 3"}),e.jsx("path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4"}),e.jsx("path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857"}),e.jsx("path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38"})]}),Tt=(i,r,t)=>Math.max(r,Math.min(t,i)),Fe=i=>{const r=Math.max(0,Math.floor(i)),t=Math.floor(r/60).toString().padStart(2,"0"),s=(r%60).toString().padStart(2,"0");return`${t}:${s}`},fe=({total:i,remaining:r,size:t=64,strokeWidth:s=6,className:n="",showLabel:l=!0})=>{const a=Math.max(1,i||1),c=Tt(r/a,0,1),{radius:u,circumference:w,dashOffset:h,center:m}=o.useMemo(()=>{const p=(t-s)/2,b=2*Math.PI*p,k=b*(1-c),g=Math.round(s)%2===1,v=t/2+(g?.5:0);return{radius:p,circumference:b,dashOffset:k,center:v}},[t,s,c]),f=o.useMemo(()=>c<=.25?"iw-stroke-red-500":c<=.5?"iw-stroke-yellow-500":"iw-stroke-green-500",[c]),d=c<=.25?"iw-animate-pulse":"";return e.jsxs("div",{className:`iw-relative iw-inline-flex iw-items-center iw-justify-center iw-rounded-full iw-bg-white ${n}`,style:{width:t,height:t},"aria-label":`Time remaining ${Fe(r)}`,role:"timer","aria-live":"polite",children:[e.jsx("svg",{width:t,height:t,viewBox:`0 0 ${t} ${t}`,preserveAspectRatio:"xMidYMid meet",children:e.jsxs("g",{transform:`rotate(-90 ${m} ${m})`,children:[e.jsx("circle",{cx:m,cy:m,r:u,className:"iw-stroke-gray-200",strokeWidth:s,fill:"none",shapeRendering:"geometricPrecision",vectorEffect:"non-scaling-stroke"}),e.jsx("circle",{cx:m,cy:m,r:u,className:`${f} ${d}`,strokeWidth:s,strokeLinecap:"round",fill:"none",strokeDasharray:w,strokeDashoffset:h,shapeRendering:"geometricPrecision",vectorEffect:"non-scaling-stroke",style:{transition:"stroke-dashoffset 0.3s ease, stroke 0.2s ease"}})]})}),l&&e.jsx("div",{className:"iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center iw-rotate-0",children:e.jsx("span",{className:`iw-text-[11px] iw-font-semibold iw-tabular-nums ${c<=.25?"iw-text-red-600":c<=.5?"iw-text-yellow-600":"iw-text-green-600"}`,children:Fe(r)})})]})},It=({label:i,error:r,fullWidth:t=!1,className:s="",id:n,...l})=>{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",u=r?"iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500":"",w=t?"iw-w-full":"",h=s.includes("iw-h-full")||t?"iw-h-full":"";return e.jsxs("div",{className:`iw-h-full iw-flex iw-flex-col ${t?"iw-w-full":""}`,children:[i&&e.jsx("label",{htmlFor:a,className:"iw-block iw-text-sm iw-font-medium iw-text-gray-700 iw-mb-1",children:i}),e.jsx("textarea",{id:a,className:`${c} ${u} ${w} ${h} ${s}`,"aria-invalid":r?"true":"false",...l}),r&&e.jsx("p",{className:"iw-mt-1 iw-text-sm iw-text-red-600",children:r})]})},Mt=({value:i,onChange:r,onSubmit:t,isSubmitDisabled:s,state:n,editingTime:l})=>{const a=c=>{c.key==="Enter"&&(c.ctrlKey||c.metaKey)&&!s&&(c.preventDefault(),t())};return e.jsxs("div",{className:"iw-flex iw-flex-col iw-h-full ",children:[e.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[e.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"Your Answer"}),e.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-2",children:[e.jsxs("div",{className:"iw-flex iw-items-center iw-gap-1",children:[e.jsx(me,{className:"iw-size-4 iw-text-orange-600"}),e.jsx("p",{className:"iw-text-gray-700 iw-text-sm",children:"Time to edit: "})]}),e.jsx(fe,{total:l,remaining:n.currentPhaseTimeRemaining,size:50,strokeWidth:4})]})]}),e.jsxs("div",{className:" iw-overflow-hidden iw-flex iw-flex-col iw-h-full iw-mt-2",children:[e.jsx(It,{value:i,onChange:r,onKeyDown:a,placeholder:"Type your answer here...",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",onPaste:c=>c.preventDefault(),onCopy:c=>c.preventDefault(),onCut:c=>c.preventDefault(),onDrop:c=>c.preventDefault(),onDragOver:c=>c.preventDefault()}),e.jsx("div",{className:"iw-w-full iw-grid iw-grid-cols-1 iw-mt-4",children:e.jsx(G,{onClick:t,disabled:s,children:"Submit Answer"})})]})]})},At=({className:i=""})=>{var n;const{authToken:r}=Ie(),t=r?nt(r):null,s=o.useRef(null);return o.useEffect(()=>{let l=null;return(async()=>{try{l=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),s.current&&(s.current.srcObject=l)}catch(c){console.error("Error accessing camera:",c)}})(),()=>{l&&l.getTracks().forEach(c=>c.stop())}},[]),e.jsxs("div",{className:`iw-relative ${i}`,children:[e.jsx("video",{ref:s,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-r-xl iw-min-h-[400px] iw-max-h-[600px] iw-aspect-video",style:{transform:"scaleX(-1)"}}),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:[e.jsx("div",{className:"iw-size-2 iw-animate-pulse iw-rounded-full iw-bg-red-500"}),e.jsx("span",{className:"iw-font-medium iw-text-white",children:"Recording"})]}),((n=t==null?void 0:t.data)==null?void 0:n.user_name)&&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:e.jsx("span",{className:"iw-font-medium iw-text-white",children:t.data.user_name})})]})},Dt=({question:i,isLoading:r=!1})=>{const{baseColor:t}=V();return e.jsx("div",{className:"iw-rounded-xl iw-mb-4 message-animation iw-text-gray-800 iw-p-6 ",style:it(t,.85),children:e.jsxs("div",{className:"iw-flex iw-items-center iw-gap-8",children:[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:e.jsx("div",{className:"iw-mt-2",children:e.jsx("img",{src:"https://duf9q5sx7u.ufs.sh/f/va7H6eSeKAux755zByRN5Nq9LZurgIoJGYX6c0CEdRSDm8y2",alt:"brand_logo",className:"iw-h-28 iw-w-28"})})}),r?e.jsxs("div",{className:"iw-animate-pulse iw-w-full iw-space-y-3 iw-mr-10",children:[e.jsx("div",{className:"iw-h-5 iw-bg-gray-200 iw-rounded iw-w-full"}),e.jsx("div",{className:"iw-h-5 iw-bg-gray-200 iw-rounded iw-w-3/4"})]}):e.jsx("p",{className:"iw-text-lg iw-leading-8",children:i==null?void 0:i.question})]})})},Le=({currentQuestion:i,phase:r,className:t="",children:s})=>e.jsxs("div",{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`,children:[e.jsx("div",{className:"iw-flex iw-items-start iw-justify-between iw-gap-3",children:e.jsx("div",{className:"iw-flex-1",children:e.jsx(Dt,{question:i,isLoading:r===I.FETCHING_QUESTION||r===I.IDLE})})}),e.jsxs("div",{className:"iw iw-bg-[#F6F6F6] iw-grid iw-grid-cols-2 iw-rounded-[14px] iw-p-6",children:[e.jsx("div",{className:"iw-min-h-[400px] iw-max-h-[600px]",children:e.jsx(At,{})}),e.jsx("div",{className:"iw-bg-white iw-rounded-r-xl iw-shadow iw-p-6",children:s})]})]}),$e=({isOpen:i,onClose:r,children:t,title:s,showCloseButton:n=!0,closeOnOverlayClick:l=!0,closeOnEscape:a=!0,className:c=""})=>{if(o.useEffect(()=>{if(!i||!a)return;const h=m=>{m.key==="Escape"&&r()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[i,a,r]),o.useEffect(()=>(i?(document.body.style.overflow="hidden",document.body.classList.add("interview-widget-container")):(document.body.style.overflow="unset",document.body.classList.remove("interview-widget-container")),()=>{document.body.style.overflow="unset",document.body.classList.remove("interview-widget-container")}),[i]),!i)return null;const u=h=>{l&&h.target===h.currentTarget&&r()},w=e.jsxs("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center",children:[e.jsx("div",{className:"iw-fixed iw-inset-0 iw-bg-black iw-bg-opacity-50 iw-transition-opacity",onClick:u}),e.jsxs("div",{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}`,role:"dialog","aria-modal":"true","aria-labelledby":s?"dialog-title":void 0,children:[(s||n)&&e.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-p-4 iw-border-b iw-border-gray-200",children:[s&&e.jsx("h2",{id:"dialog-title",className:"iw-text-lg iw-font-semibold iw-text-gray-900",children:s}),n&&e.jsx("button",{onClick:r,className:"iw-p-1 iw-text-gray-400 iw-hover:text-gray-600 iw-transition-colors iw-rounded iw-hover:bg-gray-100","aria-label":"Close dialog",children:e.jsx("svg",{className:"iw-w-5 iw-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"iw-p-4 iw-overflow-y-auto",children:t})]})]});return B.createPortal(w,document.body)},_t=({confirmExitInterview:i,isOpen:r,onClose:t})=>e.jsx($e,{isOpen:r,onClose:t,title:"Exit Interview",closeOnOverlayClick:!1,children:e.jsxs("div",{className:"iw-space-y-5",children:[e.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3 iw-rounded-xl iw-p-2",children:[e.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-flex-none iw-items-center iw-justify-center iw-rounded-full iw-bg-rose-100 iw-text-rose-600",children:"!"}),e.jsxs("div",{className:"iw-space-y-2",children:[e.jsx("p",{className:"iw-text-sm iw-font-semibold iw-text-rose-600",children:"Leaving now will end your interview !"}),e.jsx("p",{className:"iw-text-sm iw-text-slate-500",children:"Are you sure you want to exit? All progress will be lost and you will not be able to resume."})]})]}),e.jsxs("div",{className:"iw-flex iw-flex-col-reverse iw-gap-2 sm:iw-flex-row sm:iw-items-center sm:iw-justify-end iw-pb-1",children:[e.jsx("button",{className:"iw-inline-flex iw-items-center iw-justify-center iw-rounded-lg iw-border iw-border-slate-200 iw-bg-white iw-px-4 iw-py-2 iw-text-sm iw-font-medium iw-text-slate-600 iw-shadow-sm iw-transition hover:iw-bg-slate-50",onClick:t,children:"Stay in interview"}),e.jsx("button",{className:"iw-inline-flex iw-items-center iw-justify-center iw-rounded-lg iw-px-4 iw-py-2 iw-text-sm iw-font-semibold iw-text-white iw-transition hover:iw-brightness-110",style:{background:"linear-gradient(to right, rgba(244, 63, 94, 0.8), rgba(225, 29, 72, 0.8))",boxShadow:"0 12px 30px -16px rgba(244, 63, 94, 0.65)"},onClick:i,children:"Confirm exit"})]})]})}),Oe=({title:i,onExit:r})=>{const{baseColor:t}=V(),[s,n]=o.useState(!1);return e.jsxs("header",{className:"iw-w-full iw-text-gray-900",children:[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:[e.jsxs("div",{className:"iw-flex iw-items-center iw-space-x-2",children:[e.jsx("div",{className:"iw-h-7 iw-w-7 iw-rounded-md iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold",style:{backgroundColor:t},children:"N"}),e.jsx("p",{className:"iw-text-sm iw-font-medium",children:"Novara"})]}),e.jsx("h1",{className:"iw-text-base iw-font-bold",children:i}),e.jsx("button",{className:"iw-text-sm iw-text-white iw-px-4 iw-py-2 iw-rounded-md",style:{background:"linear-gradient(to right, rgba(244, 63, 94, 0.8), rgba(225, 29, 72, 0.8))"},onClick:()=>n(!0),children:"Exit Interview"})]}),e.jsx("div",{className:"iw-h-px iw-bg-gray-200"}),e.jsx(_t,{isOpen:s,confirmExitInterview:()=>{r(),n(!1)},onClose:()=>n(!1)})]})},Rt=({className:i="",width:r,height:t=56,barWidth:s=3,gap:n=2,fftSize:l=1024,smoothingTimeConstant:a=.8,mediaStream:c,startOnMount:u=!0})=>{const{baseColor:w}=V(),h=o.useRef(null),m=o.useRef(null),f=o.useRef(null),d=o.useRef(null),p=o.useRef(null),b=o.useRef(null),k=o.useRef(!1),[g,v]=o.useState(null);o.useEffect(()=>{if(r||!m.current)return;const N=m.current,D=()=>{const S=h.current;if(!S)return;const T=N.clientWidth,x=t;S.width=Math.max(1,Math.floor(T*window.devicePixelRatio||1)),S.height=Math.max(1,Math.floor(x*window.devicePixelRatio||1))},j=new ResizeObserver(D);return j.observe(N),D(),()=>j.disconnect()},[r,t]),o.useEffect(()=>{if(!r)return;const N=h.current;N&&(N.width=Math.max(1,Math.floor(r*(window.devicePixelRatio||1))),N.height=Math.max(1,Math.floor(t*(window.devicePixelRatio||1))))},[r,t]),o.useEffect(()=>{let N=!1;return(async()=>{try{const j=new(window.AudioContext||window.webkitAudioContext);f.current=j;let S=c;if(!S){if(!u)return;S=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1}),k.current=!0}if(N)return;const T=j.createAnalyser();T.fftSize=l,T.smoothingTimeConstant=a,d.current=T;const x=j.createMediaStreamSource(S);p.current=x,x.connect(T),C()}catch(j){v((j==null?void 0:j.message)||"Failed to initialize microphone")}})(),()=>{var j,S,T,x;N=!0,b.current&&cancelAnimationFrame(b.current);try{(j=p.current)==null||j.disconnect()}catch{}try{(S=d.current)==null||S.disconnect()}catch{}k.current&&((x=((T=p.current)==null?void 0:T.mediaStream)||void 0)==null||x.getTracks().forEach(M=>M.stop())),f.current&&f.current.state!=="closed"&&f.current.close()}},[c,l,a,u]);const C=()=>{const N=h.current,D=d.current;if(!N||!D)return;const j=N.getContext("2d");if(!j)return;const S=window.devicePixelRatio||1,T=N.width,x=N.height,M=D.frequencyBinCount,P=new Uint8Array(M),L=()=>{b.current=requestAnimationFrame(L),D.getByteTimeDomainData(P),j.clearRect(0,0,T,x),j.fillStyle="rgba(0,0,0,0)",j.fillRect(0,0,T,x);const O=Math.max(1,Math.floor(s*S)),H=Math.max(1,Math.floor(n*S)),Y=O+H,Q=Math.max(8,Math.floor((T+H)/Y)),q=Math.floor(P.length/Q);for(let $=0;$<Q;$++){const _=Math.min(P.length-1,$*q),K=P[_]/128-1,U=Math.abs(K),pe=Math.pow(U,.6),J=Math.max(x*.06,pe*(x*.9)),be=$*Y,ye=(x-J)/2,ve=140-Math.min(140,140*U),X=85,ne=48+Math.floor(12*(1-U));j.fillStyle=`${w}`,j.shadowColor=`hsla(${ve}, ${X}%, ${ne}%, ${.25*U})`,j.shadowBlur=8*U;const ae=Math.min(O/2,J/2);Pt(j,be,ye,O,J,ae),j.fill()}};L()};return e.jsxs("div",{ref:m,className:`iw-relative iw-w-full iw-overflow-hidden iw-rounded-md iw-bg-gray-50 ${i}`,style:{height:t},children:[e.jsx("canvas",{ref:h,className:"iw-w-full iw-h-full"}),g&&e.jsx("div",{className:"iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center",children:e.jsx("span",{className:"iw-text-xs iw-text-red-600 iw-bg-red-50 iw-border iw-border-red-200 iw-px-2 iw-py-1 iw-rounded",children:g})})]})};function Pt(i,r,t,s,n,l){const a=Math.min(l,s/2,n/2);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()}const Ft=({state:i,answeringTime:r,nextPhase:t,sttError:s})=>e.jsxs("div",{className:"iw-flex iw-flex-col iw-justify-between iw-h-full ",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[e.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"You may start speaking now. We're listening...."}),e.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-2",children:[e.jsxs("div",{className:"iw-flex iw-items-center iw-gap-1",children:[e.jsx(me,{className:"iw-size-4 iw-text-orange-600"}),e.jsx("p",{className:"iw-text-gray-700 iw-text-sm",children:"Time to talk: "})]}),e.jsx(fe,{total:r,remaining:i.currentPhaseTimeRemaining,size:50,strokeWidth:4})]})]}),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."})]}),e.jsxs("div",{children:[e.jsx(Rt,{}),s&&e.jsxs("div",{className:"iw-mt-2 iw-text-xs iw-text-red-600",children:["Recording error: ",s.message]})]}),e.jsx("div",{className:"iw-w-full iw-grid iw-grid-cols-1",children:e.jsx(G,{onClick:()=>{t()},children:"Transcribe My Answer"})})]});function Lt(){const[i,r]=o.useState(!0),t=o.useMemo(()=>[0,1,2].map(s=>({id:s})),[]);return o.useEffect(()=>{const s=setInterval(()=>{r(n=>!n)},1500);return()=>clearInterval(s)},[]),e.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-8 iw-h-full",children:[e.jsx("div",{className:"iw-relative iw-w-80 iw-h-48 ","aria-hidden":!0,children:t.map((s,n)=>{const l=n*50,a=i?l:l+12,c=i?1:.08,u=n*140;return e.jsx("div",{role:"presentation",className:"iw-absolute iw-w-full iw-rounded-lg iw-p-4 iw-shadow-md iw-bg-gradient-to-b iw-from-gray-50 iw-to-gray-100 iw-overflow-hidden",style:{top:0,transform:`translateY(${a}px)`,opacity:c,transition:`transform 600ms cubic-bezier(.2,.9,.3,1) ${u}ms, opacity 400ms ease ${u}ms`},children:e.jsxs("div",{className:"iw-flex iw-gap-3 iw-items-center",children:[e.jsx("div",{className:"iw-w-10 iw-h-10 iw-bg-gray-300 iw-rounded iw-flex-shrink-0"}),e.jsxs("div",{className:"iw-flex-1 iw-space-y-2",children:[e.jsx("div",{className:"iw-h-2 iw-bg-gray-300 iw-rounded iw-w-24"}),e.jsx("div",{className:"iw-h-2 iw-bg-gray-300 iw-rounded iw-w-32"})]})]})},s.id)})}),e.jsx("div",{className:"iw-text-center",children:e.jsx("p",{className:"iw-text-gray-500 iw-font-medium",children:"Preparing your question..."})})]})}const $t=({size:i="192px",className:r,colors:t,animationDuration:s=20})=>{const l={...{bg:"oklch(95% 0.02 264.695)",c1:"oklch(75% 0.15 350)",c2:"oklch(80% 0.12 200)",c3:"oklch(78% 0.14 280)"},...t},a=parseInt(i.replace("px",""),10),c=a<50?Math.max(a*.008,1):Math.max(a*.015,4),u=a<50?Math.max(a*.004,1.2):Math.max(a*.008,1.5),w=a<50?Math.max(a*.004,.05):Math.max(a*.008,.1),h=a<50?Math.max(a*.004,.5):Math.max(a*.008,2),m=a<30?"0%":a<50?"5%":a<100?"15%":"25%",f=a<30?1.1:a<50?Math.max(u*1.2,1.3):u;return e.jsx("div",{className:`siri-orb ${r}`,style:{width:i,height:i,"--bg":l.bg,"--c1":l.c1,"--c2":l.c2,"--c3":l.c3,"--animation-duration":`${s}s`,"--blur-amount":`${c}px`,"--contrast-amount":f,"--dot-size":`${w}px`,"--shadow-spread":`${h}px`,"--mask-radius":m},children:e.jsx("style",{children:`
|
|
68
|
+
└─────────────────────────────────────────────────────────────┘`,"color: #ffd93d; font-size: 14px; font-family: monospace; background: rgba(255, 217, 61, 0.1); padding: 10px;")}const t={open:!1,orientation:null},r=160,i=setInterval(()=>{window.outerHeight-window.innerHeight>r||window.outerWidth-window.innerWidth>r?t.open||(t.open=!0,t.orientation=window.outerWidth-window.innerWidth>r?"vertical":"horizontal",e()):t.open&&(t.open=!1,console.log("%c🌟 Developer tools closed. Interview continues smoothly! ✨","color: #4ecdc4; font-weight: bold; text-shadow: 0 0 10px #4ecdc4;"))},500),n=a=>{if(a.keyCode===123||a.ctrlKey&&a.shiftKey&&(a.keyCode===73||a.keyCode===74)||a.ctrlKey&&a.keyCode===85)return a.preventDefault(),console.log("%c🎭 Nice try! Keyboard shortcuts are disabled during interviews ✨","color: #ffd93d; font-weight: bold; text-shadow: 0 0 10px #ffd93d;"),!1},s=a=>(a.preventDefault(),console.log("%c🌈 Right-click menu disabled for interview integrity! 🎪","color: #ff9ff3; font-weight: bold; text-shadow: 0 0 10px #ff9ff3;"),!1);return document.addEventListener("keydown",n),document.addEventListener("contextmenu",s),()=>{clearInterval(i),document.removeEventListener("keydown",n),document.removeEventListener("contextmenu",s),delete window.showStats,delete window.interviewTips}},[])},sn=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M12 2a10 10 0 0 1 7.38 16.75"}),o.jsx("path",{d:"M12 6v6l4 2"}),o.jsx("path",{d:"M2.5 8.875a10 10 0 0 0-.5 3"}),o.jsx("path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4"}),o.jsx("path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857"}),o.jsx("path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38"})]}),au=(e,t,r)=>Math.max(t,Math.min(r,e)),co=e=>{const t=Math.max(0,Math.floor(e)),r=Math.floor(t/60).toString().padStart(2,"0"),i=(t%60).toString().padStart(2,"0");return`${r}:${i}`},on=({total:e,remaining:t,size:r=64,strokeWidth:i=6,className:n="",showLabel:s=!0})=>{const a=Math.max(1,e||1),c=au(t/a,0,1),{radius:l,circumference:u,dashOffset:h,center:f}=d.useMemo(()=>{const p=(r-i)/2,E=2*Math.PI*p,v=E*(1-c),g=Math.round(i)%2===1,T=r/2+(g?.5:0);return{radius:p,circumference:E,dashOffset:v,center:T}},[r,i,c]),w=d.useMemo(()=>c<=.25?"iw-stroke-red-500":c<=.5?"iw-stroke-yellow-500":"iw-stroke-green-500",[c]),m=c<=.25?"iw-animate-pulse":"";return o.jsxs("div",{className:`iw-relative iw-inline-flex iw-items-center iw-justify-center iw-rounded-full iw-bg-white ${n}`,style:{width:r,height:r},"aria-label":`Time remaining ${co(t)}`,role:"timer","aria-live":"polite",children:[o.jsx("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,preserveAspectRatio:"xMidYMid meet",children:o.jsxs("g",{transform:`rotate(-90 ${f} ${f})`,children:[o.jsx("circle",{cx:f,cy:f,r:l,className:"iw-stroke-gray-200",strokeWidth:i,fill:"none",shapeRendering:"geometricPrecision",vectorEffect:"non-scaling-stroke"}),o.jsx("circle",{cx:f,cy:f,r:l,className:`${w} ${m}`,strokeWidth:i,strokeLinecap:"round",fill:"none",strokeDasharray:u,strokeDashoffset:h,shapeRendering:"geometricPrecision",vectorEffect:"non-scaling-stroke",style:{transition:"stroke-dashoffset 0.3s ease, stroke 0.2s ease"}})]})}),s&&o.jsx("div",{className:"iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center iw-rotate-0",children:o.jsx("span",{className:`iw-text-[11px] iw-font-semibold iw-tabular-nums ${c<=.25?"iw-text-red-600":c<=.5?"iw-text-yellow-600":"iw-text-green-600"}`,children:co(t)})})]})},cu=({label:e,error:t,fullWidth:r=!1,className:i="",id:n,...s})=>{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",l=t?"iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500":"",u=r?"iw-w-full":"",h=i.includes("iw-h-full")||r?"iw-h-full":"";return o.jsxs("div",{className:`iw-h-full iw-flex iw-flex-col ${r?"iw-w-full":""}`,children:[e&&o.jsx("label",{htmlFor:a,className:"iw-block iw-text-sm iw-font-medium iw-text-gray-700 iw-mb-1",children:e}),o.jsx("textarea",{id:a,className:`${c} ${l} ${u} ${h} ${i}`,"aria-invalid":t?"true":"false",...s}),t&&o.jsx("p",{className:"iw-mt-1 iw-text-sm iw-text-red-600",children:t})]})},lu=({value:e,onChange:t,onSubmit:r,isSubmitDisabled:i,state:n,editingTime:s})=>{const a=c=>{c.key==="Enter"&&(c.ctrlKey||c.metaKey)&&!i&&(c.preventDefault(),r())};return o.jsxs("div",{className:"iw-flex iw-flex-col iw-h-full ",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"Your Answer"}),o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-2",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-1",children:[o.jsx(sn,{className:"iw-size-4 iw-text-orange-600"}),o.jsx("p",{className:"iw-text-gray-700 iw-text-sm",children:"Time to edit: "})]}),o.jsx(on,{total:s,remaining:n.currentPhaseTimeRemaining,size:50,strokeWidth:4})]})]}),o.jsxs("div",{className:" iw-overflow-hidden iw-flex iw-flex-col iw-h-full iw-mt-2",children:[o.jsx(cu,{value:e,onChange:t,onKeyDown:a,placeholder:"Type your answer here...",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",onPaste:c=>c.preventDefault(),onCopy:c=>c.preventDefault(),onCut:c=>c.preventDefault(),onDrop:c=>c.preventDefault(),onDragOver:c=>c.preventDefault()}),o.jsx("div",{className:"iw-w-full iw-grid iw-grid-cols-1 iw-mt-4",children:o.jsx(qe,{onClick:r,disabled:i,children:"Submit Answer"})})]})]})},Nr=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),o.jsx("path",{d:"M12 9v4"}),o.jsx("path",{d:"M12 17h.01"})]}),uu=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M12 6v6l4 2"}),o.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),lo=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),o.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),du=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("circle",{cx:"12",cy:"12",r:"3"}),o.jsx("path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}),o.jsx("path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}),o.jsx("path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}),o.jsx("path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"})]}),an=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("circle",{cx:"12",cy:"12",r:"3"}),o.jsx("path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}),o.jsx("path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}),o.jsx("path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}),o.jsx("path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"})]}),hu=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("circle",{cx:"12",cy:"12",r:"3"}),o.jsx("path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}),o.jsx("path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}),o.jsx("path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}),o.jsx("path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"})]}),fu=e=>o.jsxs("svg",{width:24,height:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-bolt-icon prefix__lucide-bolt",...e,children:[o.jsx("path",{d:"M21 16V8a2 2 0 00-1-1.73l-7-4a2 2 0 00-2 0l-7 4A2 2 0 003 8v8a2 2 0 001 1.73l7 4a2 2 0 002 0l7-4A2 2 0 0021 16z"}),o.jsx("circle",{cx:12,cy:12,r:4})]}),wu=e=>o.jsxs("svg",{width:24,height:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-camera-off-icon prefix__lucide-camera-off",...e,children:[o.jsx("path",{d:"M14.564 14.558a3 3 0 11-4.122-4.121M2 2l20 20"}),o.jsx("path",{d:"M20 20H4a2 2 0 01-2-2V9a2 2 0 012-2h1.997a2 2 0 00.819-.175M9.695 4.024A2 2 0 0110.004 4h3.993a2 2 0 011.76 1.05l.486.9A2 2 0 0018.003 7H20a2 2 0 012 2v7.344"})]}),mu=e=>o.jsxs("svg",{width:24,height:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-target-icon prefix__lucide-target",...e,children:[o.jsx("circle",{cx:12,cy:12,r:10}),o.jsx("circle",{cx:12,cy:12,r:6}),o.jsx("circle",{cx:12,cy:12,r:2})]}),gu=e=>o.jsxs("svg",{width:24,height:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-users-icon prefix__lucide-users",...e,children:[o.jsx("path",{d:"M16 21v-2a4 4 0 00-4-4H6a4 4 0 00-4 4v2M16 3.128a4 4 0 010 7.744M22 21v-2a4 4 0 00-3-3.87"}),o.jsx("circle",{cx:9,cy:7,r:4})]}),Ir={FACE_DETECTED:"face_detected",NO_FACE:"no_face_detected",MULTIPLE_FACES:"multiple_faces",LOOKING_AWAY:"looking_away",CAMERA_ERROR:"camera_error"},pu={[Ir.FACE_DETECTED]:{icon:lo,iconColor:"iw-text-green-600",iconBg:"iw-bg-green-50",iconBorder:"iw-border-green-100",title:"All Good",subtitle:"Everything looks normal",description:"Your gaze is properly focused on the screen. Continue with your interview.",buttonText:"Continue"},[Ir.NO_FACE]:{icon:wu,iconColor:"iw-text-orange-600",iconBg:"iw-bg-orange-50",iconBorder:"iw-border-orange-100",title:"Face Not Detected",subtitle:"We can't see you in the camera",description:"Please ensure you're positioned properly in front of the camera and that your face is clearly visible.",buttonText:"I Understood"},[Ir.MULTIPLE_FACES]:{icon:gu,iconColor:"iw-text-red-600",iconBg:"iw-bg-red-50",iconBorder:"iw-border-red-100",title:"Multiple People Detected",subtitle:"More than one person is visible",description:"For interview integrity, please ensure you are alone in the room and only your face is visible to the camera.",buttonText:"I Understood"},[Ir.LOOKING_AWAY]:{icon:mu,iconColor:"iw-text-amber-600",iconBg:"iw-bg-amber-50",iconBorder:"iw-border-amber-200/75",title:"Stay Focused",subtitle:"We noticed you looked away from the screen",description:"To ensure interview integrity, please keep your attention on the screen throughout the session.",buttonText:"I Understood"},[Ir.CAMERA_ERROR]:{icon:Nr,iconColor:"iw-text-red-600",iconBg:"iw-bg-red-50",iconBorder:"iw-border-red-100",title:"Camera Issue",subtitle:"There's a problem with your camera",description:"Please check your camera connection and permissions, then refresh the page to continue.",buttonText:"I Understood"}};function xu({isOpen:e,onClose:t,warningType:r}){const i=pu[r],n=i.icon,s=()=>{t()};return r==="face_detected"?null:o.jsx(Zr,{isOpen:e,onClose:t,children:e&&o.jsx("div",{className:"iw-bg-white iw-border-white iw-border iw-p-0 iw-shadow-lg sm:iw-max-w-md",children:o.jsxs("div",{children:[o.jsx("div",{className:"iw-sr-only",children:i.description}),o.jsxs("div",{className:"iw-px-8 iw-py-8 iw-text-center",children:[o.jsx("div",{className:`iw-mx-auto iw-mb-6 iw-flex iw-h-16 iw-w-16 iw-items-center iw-justify-center iw-rounded-full ${i.iconBg} border ${i.iconBorder}`,children:o.jsx(n,{className:`iw-h-7 iw-w-7 ${i.iconColor}`})}),o.jsx("h1",{className:"iw-text-foreground iw-mb-3 iw-text-2xl iw-font-bold iw-tracking-tight",children:i.title}),o.jsx("h2",{className:"iw-text-gray-500 iw-mb-6 iw-text-base iw-font-medium",children:i.subtitle}),o.jsx("p",{className:"iw-text-neutral-400 iw-mx-auto iw-mb-8 iw-max-w-sm iw-text-sm iw-leading-relaxed",children:i.description}),o.jsx(qe,{onClick:s,className:"iw-w-full iw-bg-gray-800 iw-text-white hover:iw-bg-gray-800",children:i.buttonText})]})]})})})}const yu=({gazeAnalysisEnabled:e,isModelLoaded:t,stats:r,statusMessage:i,loadingProgress:n})=>o.jsx("div",{className:"iw-w-full",children:o.jsxs("div",{className:"iw-border-strock iw-rounded-md iw-border iw-bg-gray-50 iw-p-4",children:[o.jsxs("h3",{className:"iw-m-0 iw-mb-2.5",children:["Status: ",i]}),n>0&&n<100&&o.jsxs("div",{className:"iw-mb-2.5",children:[o.jsx("div",{className:"iw-h-2 iw-w-full iw-rounded iw-bg-gray-300",children:o.jsx("div",{className:"iw-h-full iw-rounded iw-bg-blue-600 iw-transition-all iw-duration-300 iw-ease-out",style:{width:`${n}%`}})}),o.jsxs("small",{className:"iw-text-gray-600",children:["Loading model... ",n.toFixed(1),"%"]})]}),o.jsxs("div",{className:"iw-grid iw-grid-cols-2 iw-gap-2.5 iw-text-sm",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"FPS:"})," ",o.jsx("span",{className:r.fps<15?"iw-text-red-600":r.fps<25?"iw-text-orange-500":"iw-text-green-600",children:r.fps})]}),o.jsxs("div",{children:[o.jsx("strong",{children:"Model:"})," ",t?"✓ Loaded":"✗ Loading"]}),e&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("strong",{children:"Engagement:"})," ",r.engagement.toFixed(1),"%"]}),o.jsxs("div",{children:[o.jsx("strong",{children:"Looking:"})," ",o.jsx("span",{className:r.isLookingAway?"iw-text-red-600":"iw-text-green-600",children:r.isLookingAway?"Away":"At Screen"})]})]})]}),r.referenceFaceNotDetected&&o.jsxs("div",{className:"iw-text-gray-dark iw-mt-2.5 iw-w-full iw-rounded-md iw-bg-[#ffeb3b] iw-p-2.5 iw-text-sm",children:[o.jsx("strong",{children:"Reference Face Not Detected"}),o.jsx("br",{}),"The previously set reference face is no longer in view."]}),r.multipleFacesDetected&&o.jsxs("div",{className:"iw-mt-2.5 iw-rounded iw-bg-red-50 iw-p-2.5 iw-text-sm iw-text-red-700",children:[o.jsx("strong",{children:"Multiple Faces Detected"}),o.jsx("br",{}),"Please ensure only one person is in the frame."]}),!e&&o.jsxs("div",{className:"iw-mt-2.5 iw-rounded iw-bg-blue-50 iw-p-2.5 iw-text-sm iw-text-blue-700",children:[o.jsx("strong",{children:"Gaze Analysis Disabled"}),o.jsx("br",{}),"Enable to track engagement and attention levels."]})]})}),bu=({showControls:e,isBubbleOpen:t,setIsBubbleOpen:r,setReference:i,clearCache:n,isModelLoaded:s,gazeAnalysisEnabled:a,referenceSet:c,showLandmarks:l,setShowLandmarks:u,showEngagementBar:h,setShowEngagementBar:f,handleToggleGazeAnalysis:w,stats:m,statusMessage:p,loadingProgress:E})=>e?o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>r(!t),className:"iw-absolute iw-right-4 iw-bottom-4 iw-z-10 iw-flex iw-h-10 iw-w-10 iw-items-center iw-justify-center iw-rounded-full iw-text-white",children:o.jsx(fu,{className:"iw-size-4.5"})}),t&&o.jsxs("div",{className:"iw-absolute iw-right-4 iw-bottom-16 iw-z-10 iw-max-h-96 iw-w-80 iw-overflow-y-auto iw-rounded-md iw-bg-gray-50 iw-p-4 iw-shadow-lg",children:[o.jsx("h4",{className:"m-0 mb-2.5",children:"Controls"}),o.jsx("button",{onClick:i,disabled:!s||!a,className:`iw-mb-2.5 iw-block iw-w-full iw-rounded border-none iw-px-4 iw-py-2 iw-text-sm iw-text-white ${!s||!a?"iw-cursor-not-allowed iw-bg-gray-400":"iw-cursor-pointer iw-bg-blue-600 hover:iw-bg-blue-700"}`,children:c?"Reference Set ✓":"Set Reference"}),o.jsx("button",{onClick:n,className:"iw-mb-4 iw-block iw-w-full iw-cursor-pointer iw-rounded iw-border-none iw-bg-red-600 iw-px-4 iw-py-2 iw-text-sm iw-text-white hover:iw-bg-red-700",children:"Clear Model Cache"}),o.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-2.5",children:[o.jsxs("label",{className:"iw-flex iw-cursor-pointer iw-items-center iw-gap-2",children:[o.jsx("input",{type:"checkbox",checked:a,onChange:v=>w(v.target.checked)}),o.jsx("strong",{children:"Enable Gaze Analysis"})]}),o.jsxs("label",{className:`iw-flex iw-cursor-pointer iw-items-center iw-gap-2 ${a?"iw-opacity-100":"iw-opacity-60"}`,children:[o.jsx("input",{type:"checkbox",checked:l,onChange:v=>u(v.target.checked),disabled:!a}),"Show Landmarks"]}),o.jsxs("label",{className:`iw-flex iw-cursor-pointer iw-items-center iw-gap-2 ${a?"iw-opacity-100":"iw-opacity-60"}`,children:[o.jsx("input",{type:"checkbox",checked:h,onChange:v=>f(v.target.checked),disabled:!a}),"Show Engagement Bar"]})]}),c&&o.jsx(yu,{gazeAnalysisEnabled:a,isModelLoaded:s,loadingProgress:E,stats:m,statusMessage:p})]})]}):null;var er=typeof self<"u"?self:{};function Rt(){throw Error("Invalid UTF8")}function uo(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let ti,cn;const vu=typeof TextDecoder<"u";let ku;const _u=typeof TextEncoder<"u";function ho(e){if(_u)e=(ku||(ku=new TextEncoder)).encode(e);else{let r=0;const i=new Uint8Array(3*e.length);for(let n=0;n<e.length;n++){var t=e.charCodeAt(n);if(t<128)i[r++]=t;else{if(t<2048)i[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&n<e.length){const s=e.charCodeAt(++n);if(s>=56320&&s<=57343){t=1024*(t-55296)+s-56320+65536,i[r++]=t>>18|240,i[r++]=t>>12&63|128,i[r++]=t>>6&63|128,i[r++]=63&t|128;continue}n--}t=65533}i[r++]=t>>12|224,i[r++]=t>>6&63|128}i[r++]=63&t|128}}e=r===i.length?i:i.subarray(0,r)}return e}var ln,ri;e:{for(var fo=["CLOSURE_FLAGS"],un=er,dn=0;dn<fo.length;dn++)if((un=un[fo[dn]])==null){ri=null;break e}ri=un}var Mr,wo=ri&&ri[610401301];ln=wo!=null&&wo;const mo=er.navigator;function hn(e){return!!ln&&!!Mr&&Mr.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function De(e){var t;return(t=er.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function kt(){return!!ln&&!!Mr&&Mr.brands.length>0}function fn(){return kt()?hn("Chromium"):(De("Chrome")||De("CriOS"))&&!(!kt()&&De("Edge"))||De("Silk")}function ii(e){return ii[" "](e),e}Mr=mo&&mo.userAgentData||null,ii[" "]=function(){};var Eu=!kt()&&(De("Trident")||De("MSIE"));!De("Android")||fn(),fn(),De("Safari")&&(fn()||!kt()&&De("Coast")||!kt()&&De("Opera")||!kt()&&De("Edge")||(kt()?hn("Microsoft Edge"):De("Edg/"))||kt()&&hn("Opera"));var go={},Lr=null;function ju(e){const t=e.length;let r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);const i=new Uint8Array(r);let n=0;return function(s,a){function c(u){for(;l<s.length;){const h=s.charAt(l++),f=Lr[h];if(f!=null)return f;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return u}po();let l=0;for(;;){const u=c(-1),h=c(0),f=c(64),w=c(64);if(w===64&&u===-1)break;a(u<<2|h>>4),f!=64&&(a(h<<4&240|f>>2),w!=64&&a(f<<6&192|w))}}(e,function(s){i[n++]=s}),n!==r?i.subarray(0,n):i}function po(){if(!Lr){Lr={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const i=e.concat(t[r].split(""));go[r]=i;for(let n=0;n<i.length;n++){const s=i[n];Lr[s]===void 0&&(Lr[s]=n)}}}}var xo=typeof Uint8Array<"u",yo=!Eu&&typeof btoa=="function";function bo(e){if(!yo){var t;t===void 0&&(t=0),po(),t=go[t];var r=Array(Math.floor(e.length/3)),i=t[64]||"";let l=0,u=0;for(;l<e.length-2;l+=3){var n=e[l],s=e[l+1],a=e[l+2],c=t[n>>2];n=t[(3&n)<<4|s>>4],s=t[(15&s)<<2|a>>6],a=t[63&a],r[u++]=c+n+s+a}switch(c=0,a=i,e.length-l){case 2:a=t[(15&(c=e[l+1]))<<2]||i;case 1:e=e[l],r[u]=t[e>>2]+t[(3&e)<<4|c>>4]+a+i}return r.join("")}for(t="",r=0,i=e.length-10240;r<i;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}const vo=/[-_.]/g,Tu={"-":"+",_:"/",".":"="};function Su(e){return Tu[e]||""}function ko(e){if(!yo)return ju(e);vo.test(e)&&(e=e.replace(vo,Su)),e=atob(e);const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function Bt(e){return xo&&e!=null&&e instanceof Uint8Array}var tr={};function Ut(){return Au||(Au=new dt(null,tr))}function wn(e){_o(tr);var t=e.g;return(t=t==null||Bt(t)?t:typeof t=="string"?ko(t):null)==null?t:e.g=t}var dt=class{h(){return new Uint8Array(wn(this)||0)}constructor(e,t){if(_o(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let Au,Cu;function _o(e){if(e!==tr)throw Error("illegal external caller")}function Eo(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function mn(e){return Eo(e=Error(e),"warning"),e}function gn(e){if(e!=null){var t=Cu??(Cu={}),r=t[e]||0;r>=5||(t[e]=r+1,Eo(e=Error(),"incident"),function(i){er.setTimeout(()=>{throw i},0)}(e))}}var ni=typeof Symbol=="function"&&typeof Symbol()=="symbol";function rr(e,t,r=!1){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?r&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t}var Nu=rr("jas",void 0,!0),jo=rr(void 0,"0di"),Fr=rr(void 0,"1oa"),ir=rr(void 0,Symbol()),Iu=rr(void 0,"0actk"),To=rr(void 0,"8utk");const k=ni?Nu:"Ea",So={Ea:{value:0,configurable:!0,writable:!0,enumerable:!1}},Ao=Object.defineProperties;function si(e,t){ni||k in e||Ao(e,So),e[k]|=t}function ie(e,t){ni||k in e||Ao(e,So),e[k]=t}function nr(e){return si(e,34),e}function Mu(e,t){ie(t,-15615&(0|e))}function pn(e,t){ie(t,-15581&(34|e))}function oi(){return typeof BigInt=="function"}function xe(e){return Array.prototype.slice.call(e)}var xn,Pr={};function ai(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function yn(e,t){if(e!=null){if(typeof e=="string")e=e?new dt(e,tr):Ut();else if(e.constructor!==dt)if(Bt(e))e=e.length?new dt(new Uint8Array(e),tr):Ut();else{if(!t)throw Error();e=void 0}}return e}const Co=[];function _t(e){if(2&e)throw Error()}ie(Co,55),xn=Object.freeze(Co);class No{constructor(t,r,i){this.g=t,this.h=r,this.l=i}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}function bn(e){return ir?e[ir]:void 0}var Lu=Object.freeze({});function ci(e){return e.Na=!0,e}var Fu=ci(e=>typeof e=="number"),Io=ci(e=>typeof e=="string"),Pu=ci(e=>typeof e=="boolean"),li=typeof er.BigInt=="function"&&typeof er.BigInt(0)=="bigint";function Et(e){var t=e;if(Io(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(Fu(t)&&!Number.isSafeInteger(t))throw Error(String(t));return li?BigInt(e):e=Pu(e)?e?"1":"0":Io(e)?e.trim()||"0":String(e)}var vn=ci(e=>li?e>=Ou&&e<=Bu:e[0]==="-"?Mo(e,Du):Mo(e,Ru));const Du=Number.MIN_SAFE_INTEGER.toString(),Ou=li?BigInt(Number.MIN_SAFE_INTEGER):void 0,Ru=Number.MAX_SAFE_INTEGER.toString(),Bu=li?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Mo(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){const i=e[r],n=t[r];if(i>n)return!1;if(i<n)return!0}}const Uu=typeof Uint8Array.prototype.slice=="function";let Lo,B=0,X=0;function Fo(e){const t=e>>>0;B=t,X=(e-t)/4294967296>>>0}function Gt(e){if(e<0){Fo(-e);const[t,r]=jn(B,X);B=t>>>0,X=r>>>0}else Fo(e)}function kn(e){const t=Lo||(Lo=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),X=0,B=t.getUint32(0,!0)}function _n(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Dr(e,t)}function En(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=_n(e,t))=="number"?r?-e:e:r?"-"+e:e}function Dr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else oi()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+Po(r)+Po(e));return r}function Po(e){return e=String(e),"0000000".slice(e.length)+e}function Do(){var e=B,t=X;if(2147483648&t)if(oi())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,i]=jn(e,t);e="-"+Dr(r,i)}else e=Dr(e,t);return e}function ui(e){if(e.length<16)Gt(Number(e));else if(oi())e=BigInt(e),B=Number(e&BigInt(4294967295))>>>0,X=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");X=B=0;const r=e.length;for(let i=t,n=(r-t)%6+t;n<=r;i=n,n+=6){const s=Number(e.slice(i,n));X*=1e6,B=1e6*B+s,B>=4294967296&&(X+=Math.trunc(B/4294967296),X>>>=0,B>>>=0)}if(t){const[i,n]=jn(B,X);B=i,X=n}}}function jn(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}const Or=typeof BigInt=="function"?BigInt.asIntN:void 0,Gu=typeof BigInt=="function"?BigInt.asUintN:void 0,jt=Number.isSafeInteger,di=Number.isFinite,sr=Math.trunc,Vu=Et(0);function Tt(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Oo(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const zu=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Rr(e){switch(typeof e){case"bigint":return!0;case"number":return di(e);case"string":return zu.test(e);default:return!1}}function or(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return di(e)?0|e:void 0}function Ro(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return di(e)?e>>>0:void 0}function Bo(e){if(e[0]==="-")return!1;const t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function Uo(e){const t=e.length;return e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337}function Go(e){return Uo(e)?e:(ui(e),Do())}function Tn(e){return e=sr(e),jt(e)||(Gt(e),e=En(B,X)),e}function Vo(e){var t=sr(Number(e));return jt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Go(e))}function zo(e){var t=sr(Number(e));return jt(t)?Et(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),oi()?Et(Or(64,BigInt(e))):Et(Go(e)))}function Wo(e){if(jt(e))e=Et(Tn(e));else{if(e=sr(e),jt(e))e=String(e);else{const t=String(e);Uo(t)?e=t:(Gt(e),e=Do())}e=Et(e)}return e}function Sn(e){return e==null?e:typeof e=="bigint"?(vn(e)?e=Number(e):(e=Or(64,e),e=vn(e)?Number(e):String(e)),e):Rr(e)?typeof e=="number"?Tn(e):Vo(e):void 0}function Wu(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(Gu(64,e));if(Rr(e)){if(t==="string")return t=sr(Number(e)),jt(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Bo(e)||(ui(e),e=Dr(B,X))),e;if(t==="number")return(e=sr(e))>=0&&jt(e)?e:function(r){if(r<0){Gt(r);var i=Dr(B,X);return r=Number(i),jt(r)?r:i}return Bo(i=String(r))?i:(Gt(r),_n(B,X))}(e)}}function $o(e){if(typeof e!="string")throw Error();return e}function ar(e){if(e!=null&&typeof e!="string")throw Error();return e}function cr(e){return e==null||typeof e=="string"?e:void 0}function An(e,t,r,i){if(e!=null&&typeof e=="object"&&e.W===Pr)return e;if(!Array.isArray(e))return r?2&i?((e=t[jo])||(nr((e=new t).u),e=t[jo]=e),t=e):t=new t:t=void 0,t;let n=r=0|e[k];return n===0&&(n|=32&i),n|=2&i,n!==r&&ie(e,n),new t(e)}function $u(e,t,r){if(t)e:{if(!Rr(t=e))throw mn("int64");switch(typeof t){case"string":t=zo(t);break e;case"bigint":t=Et(Or(64,t));break e;default:t=Wo(t)}}else e=typeof(t=e),t=t==null?t:e==="bigint"?Et(Or(64,t)):Rr(t)?e==="string"?zo(t):Wo(t):void 0;return(e=t)==null?r?Vu:void 0:e}function Hu(e){return e}const qu={};let Yu=function(){try{return ii(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class Cn{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,r){return this.g.set(t,r),this.size=this.g.size,this}delete(t){return t=this.g.delete(t),this.size=this.g.size,t}clear(){this.g.clear(),this.size=this.g.size}has(t){return this.g.has(t)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(t,r){return this.g.forEach(t,r)}[Symbol.iterator](){return this.entries()}}const Ku=Yu?(Object.setPrototypeOf(Cn.prototype,Map.prototype),Object.defineProperties(Cn.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Cn):class extends Map{constructor(){super()}};function Ho(e){return e}function Nn(e){if(2&e.M)throw Error("Cannot mutate an immutable Map")}var et=class extends Ku{constructor(e,t,r=Ho,i=Ho){super();let n=0|e[k];n|=64,ie(e,n),this.M=n,this.I=t,this.S=r,this.X=this.I?Xu:i;for(let s=0;s<e.length;s++){const a=e[s],c=r(a[0],!1,!0);let l=a[1];t?l===void 0&&(l=null):l=i(a[1],!1,!0,void 0,void 0,n),super.set(c,l)}}La(){var e=td;if(this.size!==0)return Array.from(super.entries(),t=>(t[0]=e(t[0]),t[1]=e(t[1]),t))}da(e=Ju){const t=[],r=super.entries();for(var i;!(i=r.next()).done;)(i=i.value)[0]=e(i[0]),i[1]=e(i[1]),t.push(i);return t}clear(){Nn(this),super.clear()}delete(e){return Nn(this),super.delete(this.S(e,!0,!1))}entries(){if(this.I){var e=super.keys();e=new No(e,Qu,this)}else e=super.entries();return e}values(){if(this.I){var e=super.keys();e=new No(e,et.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.I?super.forEach((r,i,n)=>{e.call(t,n.get(i),i,n)}):super.forEach(e,t)}set(e,t){return Nn(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.X(t,!0,!0,this.I,!1,this.M))}Ja(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.I?e===void 0?null:e:this.X(e,!1,!0,void 0,!1,this.M),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);const t=super.get(e);if(t!==void 0){var r=this.I;return r?((r=this.X(t,!1,!0,r,this.pa,this.M))!==t&&super.set(e,r),r):t}}[Symbol.iterator](){return this.entries()}};function Xu(e,t,r,i,n,s){return e=An(e,i,r,s),n&&(e=wi(e)),e}function Ju(e){return e}function Qu(e){return[e,this.get(e)]}let Zu,qo,Yo,ed;function Ko(){return Zu||(Zu=new et(nr([]),void 0,void 0,void 0,qu))}function In(e,t,r,i,n){if(e!=null){if(Array.isArray(e)){const s=0|e[k];return e.length===0&&1&s?void 0:n&&2&s?e:hi(e,t,r,i!==void 0,n)}return t(e,i)}}function hi(e,t,r,i,n){const s=i||r?0|e[k]:0,a=i?!!(32&s):void 0;let c=0;const l=(i=xe(e)).length;for(let p=0;p<l;p++){var u=i[p];if(p===l-1&&ai(u)){var h=t,f=r,w=a,m=n;let E;for(let v in u){const g=In(u[v],h,f,w,m);g!=null&&((E??(E={}))[v]=g)}u=E}else u=In(i[p],t,r,a,n);i[p]=u,u!=null&&(c=p+1)}return c<l&&(i.length=c),r&&((e=bn(e))&&(i[ir]=xe(e)),r(s,i)),i}function td(e){return In(e,Mn,void 0,void 0,!1)}function Mn(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return vn(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Bt(e))return Bt(e)&&gn(To),bo(e);if(e.W===Pr)return Xo(e);if(e instanceof dt){const t=e.g;return t==null?"":typeof t=="string"?t:e.g=bo(t)}return e instanceof et?e.La():void 0}return e}function Xo(e){var t=e.u;e=hi(t,Mn,void 0,void 0,!1);var r=0|t[k];if((t=e.length)&&!(512&r)){var i=e[t-1],n=!1;ai(i)?(t--,n=!0):i=void 0;var s=t-(r=512&r?0:-1),a=(qo??Hu)(s,r,e,i);if(i&&(e[t]=void 0),s<a&&i){for(var c in s=!0,i){const l=+c;l<=a?(e[n=l+r]=i[c],t=Math.max(n+1,t),n=!1,delete i[c]):s=!1}s&&(i=void 0)}for(s=t-1;t>0;s=t-1)if((c=e[s])==null)t--,n=!0;else{if(!((s-=r)>=a))break;(i??(i={}))[s]=c,t--,n=!0}n&&(e.length=t),i&&e.push(i)}return e}function St(e,t,r){return e=Jo(e,t[0],t[1],r?1:2),t!==Yo&&r&&si(e,8192),e}function Jo(e,t,r,i){if(e==null){var n=96;r?(e=[r],n|=512):e=[],t&&(n=-16760833&n|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(8192&(n=0|e[k])||!(64&n)||2&n||gn(Iu),1024&n)throw Error("farr");if(64&n)return e;if(i===1||i===2||(n|=64),r&&(n|=512,r!==e[0]))throw Error("mid");e:{var s=(r=e).length;if(s){var a=s-1;if(ai(i=r[a])){if((a-=t=512&(n|=256)?0:-1)>=1024)throw Error("pvtlmt");for(var c in i)(s=+c)<a&&(r[s+t]=i[c],delete i[c]);n=-16760833&n|(1023&a)<<14;break e}}if(t){if((c=Math.max(t,s-(512&n?0:-1)))>1024)throw Error("spvt");n=-16760833&n|(1023&c)<<14}}}return ie(e,n),e}function Ln(e,t,r=pn){if(e!=null){if(xo&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var i=0|e[k];return 2&i?e:(t&&(t=i===0||!!(32&i)&&!(64&i||!(16&i))),t?(ie(e,34|i),4&i&&Object.freeze(e),e):hi(e,Ln,4&i?pn:r,!0,!0))}return e.W===Pr?e=2&(i=0|(r=e.u)[k])?e:new e.constructor(fi(r,i,!0)):e instanceof et&&!(2&e.M)&&(r=nr(e.da(Ln)),e=new et(r,e.I,e.S,e.X)),e}}function fi(e,t,r){const i=r||2&t?pn:Mu,n=!!(32&t);return e=function(s,a,c){const l=xe(s);var u=l.length;const h=256&a?l[u-1]:void 0;for(u+=h?-1:0,a=512&a?1:0;a<u;a++)l[a]=c(l[a]);if(h){a=l[a]={};for(const f in h)a[f]=c(h[f])}return(s=bn(s))&&(l[ir]=xe(s)),l}(e,t,s=>Ln(s,n,i)),si(e,32|(r?2:0)),e}function wi(e){const t=e.u,r=0|t[k];return 2&r?new e.constructor(fi(t,r,!1)):e}function lr(e,t){return ht(e=e.u,0|e[k],t)}function ht(e,t,r){if(r===-1)return null;const i=r+(512&t?0:-1),n=e.length-1;return i>=n&&256&t?e[n][r]:i<=n?e[i]:void 0}function V(e,t,r){const i=e.u;let n=0|i[k];return _t(n),Y(i,n,t,r),e}function Y(e,t,r,i){const n=512&t?0:-1,s=r+n;var a=e.length-1;return s>=a&&256&t?(e[a][r]=i,t):s<=a?(e[s]=i,t):(i!==void 0&&(r>=(a=t>>14&1023||536870912)?i!=null&&(e[a+n]={[r]:i},ie(e,t|=256)):e[s]=i),t)}function mi(e,t){let r=0|(e=e.u)[k];const i=ht(e,r,t),n=Tt(i);return n!=null&&n!==i&&Y(e,r,t,n),n}function Qo(e){let t=0|(e=e.u)[k];const r=ht(e,t,1),i=yn(r,!0);return i!=null&&i!==r&&Y(e,t,1,i),i}function Vt(){return Lu===void 0?2:4}function zt(e,t,r,i,n){const s=e.u,a=2&(e=0|s[k])?1:i;n=!!n;let c=0|(i=Fn(s,e,t))[k];if(!(4&c)){4&c&&(i=xe(i),c=mt(c,e),e=Y(s,e,t,i));let l=0,u=0;for(;l<i.length;l++){const h=r(i[l]);h!=null&&(i[u++]=h)}u<l&&(i.length=u),c=Pn(c,e),r=-2049&(20|c),c=r&=-4097,ie(i,c),2&c&&Object.freeze(i)}return a===1||a===4&&32&c?ft(c)||(n=c,c|=2,c!==n&&ie(i,c),Object.freeze(i)):(a===2&&ft(c)&&(i=xe(i),c=mt(c,e),c=At(c,e,n),ie(i,c),e=Y(s,e,t,i)),ft(c)||(t=c,c=At(c,e,n),c!==t&&ie(i,c))),i}function Fn(e,t,r){return e=ht(e,t,r),Array.isArray(e)?e:xn}function Pn(e,t){return e===0&&(e=mt(e,t)),1|e}function ft(e){return!!(2&e)&&!!(4&e)||!!(1024&e)}function Zo(e){e=xe(e);for(let t=0;t<e.length;t++){const r=e[t]=xe(e[t]);Array.isArray(r[1])&&(r[1]=nr(r[1]))}return e}function Dn(e,t,r,i){let n=0|(e=e.u)[k];_t(n),Y(e,n,t,(i==="0"?Number(r)===0:r===i)?void 0:r)}function ur(e,t,r,i){_t(t);let n=Fn(e,t,r);const s=n!==xn;if(64&t||!(8192&t)||!s){const a=s?0|n[k]:0;let c=a;(!s||2&c||ft(c)||4&c&&!(32&c))&&(n=xe(n),c=mt(c,t),t=Y(e,t,r,n)),c=-13&Pn(c,t),c=At(i?-17&c:16|c,t,!0),c!==a&&ie(n,c)}return n}function On(e,t){var r=tc;return Bn(Rn(e=e.u),e,0|e[k],r)===t?t:-1}function Rn(e){if(ni)return e[Fr]??(e[Fr]=new Map);if(Fr in e)return e[Fr];const t=new Map;return Object.defineProperty(e,Fr,{value:t}),t}function ea(e,t,r,i){const n=Rn(e),s=Bn(n,e,t,r);return s!==i&&(s&&(t=Y(e,t,s)),n.set(r,i)),t}function Bn(e,t,r,i){let n=e.get(i);if(n!=null)return n;n=0;for(let s=0;s<i.length;s++){const a=i[s];ht(t,r,a)!=null&&(n!==0&&(r=Y(t,r,n)),n=a)}return e.set(i,n),n}function Un(e,t,r){let i=0|e[k];const n=ht(e,i,r);let s;if(n!=null&&n.W===Pr)return(t=wi(n))!==n&&Y(e,i,r,t),t.u;if(Array.isArray(n)){const a=0|n[k];s=2&a?St(fi(n,a,!1),t,!0):64&a?n:St(s,t,!0)}else s=St(void 0,t,!0);return s!==n&&Y(e,i,r,s),s}function ta(e,t,r){let i=0|(e=e.u)[k];const n=ht(e,i,r);return(t=An(n,t,!1,i))!==n&&t!=null&&Y(e,i,r,t),t}function F(e,t,r){if((t=ta(e,t,r))==null)return t;let i=0|(e=e.u)[k];if(!(2&i)){const n=wi(t);n!==t&&Y(e,i,r,t=n)}return t}function ra(e,t,r,i,n,s,a){e=e.u;var c=!!(2&t);const l=c?1:n;s=!!s,a&&(a=!c);var u=0|(n=Fn(e,t,i))[k];if(!(c=!!(4&u))){var h=n,f=t;const w=!!(2&(u=Pn(u,t)));w&&(f|=2);let m=!w,p=!0,E=0,v=0;for(;E<h.length;E++){const g=An(h[E],r,!1,f);if(g instanceof r){if(!w){const T=!!(2&(0|g.u[k]));m&&(m=!T),p&&(p=T)}h[v++]=g}}v<E&&(h.length=v),u|=4,u=p?16|u:-17&u,ie(h,u=m?8|u:-9&u),w&&Object.freeze(h)}if(a&&!(8&u||!n.length&&(l===1||l===4&&32&u))){for(ft(u)&&(n=xe(n),u=mt(u,t),t=Y(e,t,i,n)),r=n,a=u,h=0;h<r.length;h++)(u=r[h])!==(f=wi(u))&&(r[h]=f);a|=8,ie(r,a=r.length?-17&a:16|a),u=a}return l===1||l===4&&32&u?ft(u)||(t=u,(u|=!n.length||16&u&&(!c||32&u)?2:1024)!==t&&ie(n,u),Object.freeze(n)):(l===2&&ft(u)&&(ie(n=xe(n),u=At(u=mt(u,t),t,s)),t=Y(e,t,i,n)),ft(u)||(i=u,(u=At(u,t,s))!==i&&ie(n,u))),n}function wt(e,t,r){const i=0|e.u[k];return ra(e,i,t,r,Vt(),!1,!(2&i))}function j(e,t,r,i){return i==null&&(i=void 0),V(e,r,i)}function Br(e,t,r,i){i==null&&(i=void 0);e:{let n=0|(e=e.u)[k];if(_t(n),i==null){const s=Rn(e);if(Bn(s,e,n,r)!==t)break e;s.set(r,0)}else n=ea(e,n,r,t);Y(e,n,t,i)}}function mt(e,t){return-1025&(e=32|(2&t?2|e:-3&e))}function At(e,t,r){return 32&t&&r||(e&=-33),e}function gi(e,t,r){_t(0|e.u[k]),zt(e,t,cr,2,!0).push($o(r))}function pi(e,t,r,i){const n=0|e.u[k];_t(n),e=ra(e,n,r,t,2,!0),i=i??new r,e.push(i),e[k]=2&(0|i.u[k])?-9&e[k]:-17&e[k]}function Oe(e,t){return or(lr(e,t))}function Re(e,t){return cr(lr(e,t))}function ee(e,t){return mi(e,t)??0}function Ur(e,t,r){if(r!=null&&typeof r!="boolean")throw e=typeof r,Error(`Expected boolean but got ${e!="object"?e:r?Array.isArray(r)?"array":e:"null"}: ${r}`);V(e,t,r)}function tt(e,t,r){if(r!=null){if(typeof r!="number"||!di(r))throw mn("int32");r|=0}V(e,t,r)}function b(e,t,r){if(r!=null&&typeof r!="number")throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);V(e,t,r)}function xi(e,t,r){{const a=e.u;let c=0|a[k];if(_t(c),r==null)Y(a,c,t);else{var i=e=0|r[k],n=ft(e),s=n||Object.isFrozen(r);for(n||(e=0),s||(r=xe(r),i=0,e=At(e=mt(e,c),c,!0),s=!1),e|=21,n=0;n<r.length;n++){const l=r[n],u=$o(l);Object.is(l,u)||(s&&(r=xe(r),i=0,e=At(e=mt(e,c),c,!0),s=!1),r[n]=u)}e!==i&&(s&&(r=xe(r),e=At(e=mt(e,c),c,!0)),ie(r,e)),Y(a,c,t,r)}}}function ia(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Gn(){return Error("Failed to read varint, encoding is invalid.")}function na(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Vn(e){if(typeof e=="string")return{buffer:ko(e),O:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),O:!1};if(e.constructor===Uint8Array)return{buffer:e,O:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),O:!1};if(e.constructor===dt)return{buffer:wn(e)||new Uint8Array(0),O:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),O:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function zn(e,t){let r,i=0,n=0,s=0;const a=e.h;let c=e.g;do r=a[c++],i|=(127&r)<<s,s+=7;while(s<32&&128&r);for(s>32&&(n|=(127&r)>>4),s=3;s<32&&128&r;s+=7)r=a[c++],n|=(127&r)<<s;if(Wt(e,c),r<128)return t(i>>>0,n>>>0);throw Gn()}function Wn(e){let t=0,r=e.g;const i=r+10,n=e.h;for(;r<i;){const s=n[r++];if(t|=s,(128&s)==0)return Wt(e,r),!!(127&t)}throw Gn()}function Ct(e){const t=e.h;let r=e.g,i=t[r++],n=127&i;if(128&i&&(i=t[r++],n|=(127&i)<<7,128&i&&(i=t[r++],n|=(127&i)<<14,128&i&&(i=t[r++],n|=(127&i)<<21,128&i&&(i=t[r++],n|=i<<28,128&i&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Gn();return Wt(e,r),n}function gt(e){return Ct(e)>>>0}function $n(e){var t=e.h;const r=e.g,i=t[r],n=t[r+1],s=t[r+2];return t=t[r+3],Wt(e,e.g+4),(i<<0|n<<8|s<<16|t<<24)>>>0}function Hn(e){var t=$n(e);e=2*(t>>31)+1;const r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function rd(e){return Ct(e)}function qn(e,t,{aa:r=!1}={}){e.aa=r,t&&(t=Vn(t),e.h=t.buffer,e.m=t.O,e.j=0,e.l=e.h.length,e.g=e.j)}function Wt(e,t){if(e.g=t,t>e.l)throw na(e.l,t)}function sa(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);const r=e.g,i=r+t;if(i>e.l)throw na(t,e.l-r);return e.g=i,r}function oa(e,t){if(t==0)return Ut();var r=sa(e,t);return e.aa&&e.m?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):Uu?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Ut():new dt(r,tr)}et.prototype.toJSON=void 0;var aa=[];function ca(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var r=gt(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5))throw ia(r,e.l);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=r,!0}function yi(e){switch(e.h){case 0:e.h!=0?yi(e):Wn(e.g);break;case 1:Wt(e=e.g,e.g+8);break;case 2:if(e.h!=2)yi(e);else{var t=gt(e.g);Wt(e=e.g,e.g+t)}break;case 5:Wt(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!ca(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}yi(e)}break;default:throw ia(e.h,e.l)}}function Gr(e,t,r){const i=e.g.l,n=gt(e.g),s=e.g.g+n;let a=s-i;if(a<=0&&(e.g.l=s,r(t,e,void 0,void 0,void 0),a=s-e.g.g),a)throw Error(`Message parsing ended unexpectedly. Expected to read ${n} bytes, instead read ${n-a} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=s,e.g.l=i,t}function Yn(e){var t=gt(e.g),r=sa(e=e.g,t);if(e=e.h,vu){var i,n=e;(i=cn)||(i=cn=new TextDecoder("utf-8",{fatal:!0})),t=r+t,n=r===0&&t===n.length?n:n.subarray(r,t);try{var s=i.decode(n)}catch(c){if(ti===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),ti=!0}catch{ti=!1}}throw!ti&&(cn=void 0),c}}else{t=(s=r)+t,r=[];let c,l=null;for(;s<t;){var a=e[s++];a<128?r.push(a):a<224?s>=t?Rt():(c=e[s++],a<194||(192&c)!=128?(s--,Rt()):r.push((31&a)<<6|63&c)):a<240?s>=t-1?Rt():(c=e[s++],(192&c)!=128||a===224&&c<160||a===237&&c>=160||(192&(i=e[s++]))!=128?(s--,Rt()):r.push((15&a)<<12|(63&c)<<6|63&i)):a<=244?s>=t-2?Rt():(c=e[s++],(192&c)!=128||c-144+(a<<28)>>30||(192&(i=e[s++]))!=128||(192&(n=e[s++]))!=128?(s--,Rt()):(a=(7&a)<<18|(63&c)<<12|(63&i)<<6|63&n,a-=65536,r.push(55296+(a>>10&1023),56320+(1023&a)))):Rt(),r.length>=8192&&(l=uo(l,r),r.length=0)}s=uo(l,r)}return s}function la(e){const t=gt(e.g);return oa(e.g,t)}function bi(e,t,r){var i=gt(e.g);for(i=e.g.g+i;e.g.g<i;)r.push(t(e.g))}var vi=[];function Ye(e,t,r){t.g?t.m(e,t.g,t.h,r):t.m(e,t.h,r)}var y=class{constructor(e,t){this.u=Jo(e,t)}toJSON(){try{var e=Xo(this)}finally{qo=void 0}return e}l(){var e=Rd;return e.g?e.l(this,e.g,e.h):e.l(this,e.h,e.defaultValue)}clone(){const e=this.u;return new this.constructor(fi(e,0|e[k],!1))}O(){return!!(2&(0|this.u[k]))}};function ua(e){return e?/^\d+$/.test(e)?(ui(e),new Kn(B,X)):null:id||(id=new Kn(0,0))}y.prototype.W=Pr,y.prototype.toString=function(){return this.u.toString()};var Kn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let id;function da(e){return e?/^-?\d+$/.test(e)?(ui(e),new Xn(B,X)):null:nd||(nd=new Xn(0,0))}var Xn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let nd;function dr(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function hr(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function ki(e,t){if(t>=0)hr(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Vr(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function fr(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Te(e,t,r){hr(e.g,8*t+r)}function Jn(e,t){return Te(e,t,2),t=e.g.end(),fr(e,t),t.push(e.h),t}function Qn(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function _i(e,t,r){Te(e,t,2),hr(e.g,r.length),fr(e,e.g.end()),fr(e,r)}function Ei(e,t,r,i){r!=null&&(t=Jn(e,t),i(r,e),Qn(e,t))}function Ke(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Zn=Ke(),ha=Ke(),es=Ke(),ts=Ke(),fa=Ke(),wa=Ke(),rs=Ke(),ma=Ke(),ga=Ke(),wr=class{constructor(e,t,r){this.g=e,this.h=t,e=Zn,this.l=!!e&&r===e||!1}};function ji(e,t){return new wr(e,t,Zn)}function pa(e,t,r,i,n){Ei(e,r,_a(t,i),n)}const sd=ji(function(e,t,r,i,n){return e.h===2&&(Gr(e,Un(t,i,r),n),!0)},pa),od=ji(function(e,t,r,i,n){return e.h===2&&(Gr(e,Un(t,i,r),n),!0)},pa);var Ti=Symbol(),is=Symbol(),xa=Symbol(),ya=Symbol();let ba,va;function $t(e,t,r,i){var n=i[e];if(n)return n;(n={}).Ma=i,n.T=function(f){switch(typeof f){case"boolean":return Yo||(Yo=[0,void 0,!0]);case"number":return f>0?void 0:f===0?ed||(ed=[0,void 0]):[-f,void 0];case"string":return[0,f];case"object":return f}}(i[0]);var s=i[1];let a=1;s&&s.constructor===Object&&(n.ga=s,typeof(s=i[++a])=="function"&&(n.la=!0,ba??(ba=s),va??(va=i[a+1]),s=i[a+=2]));const c={};for(;s&&Array.isArray(s)&&s.length&&typeof s[0]=="number"&&s[0]>0;){for(var l=0;l<s.length;l++)c[s[l]]=s;s=i[++a]}for(l=1;s!==void 0;){let f;typeof s=="number"&&(l+=s,s=i[++a]);var u=void 0;if(s instanceof wr?f=s:(f=sd,a--),f==null?void 0:f.l){s=i[++a],u=i;var h=a;typeof s=="function"&&(s=s(),u[h]=s),u=s}for(h=l+1,typeof(s=i[++a])=="number"&&s<0&&(h-=s,s=i[++a]);l<h;l++){const w=c[l];u?r(n,l,f,u,w):t(n,l,f,w)}}return i[e]=n}function ka(e){return Array.isArray(e)?e[0]instanceof wr?e:[od,e]:[e,void 0]}function _a(e,t){return e instanceof y?e.u:Array.isArray(e)?St(e,t,!1):void 0}function ns(e,t,r,i){const n=r.g;e[t]=i?(s,a,c)=>n(s,a,c,i):n}function ss(e,t,r,i,n){const s=r.g;let a,c;e[t]=(l,u,h)=>s(l,u,h,c||(c=$t(is,ns,ss,i).T),a||(a=os(i)),n)}function os(e){let t=e[xa];if(t!=null)return t;const r=$t(is,ns,ss,e);return t=r.la?(i,n)=>ba(i,n,r):(i,n)=>{const s=0|i[k];for(;ca(n)&&n.h!=4;){var a=n.m,c=r[a];if(c==null){var l=r.ga;l&&(l=l[a])&&(l=ad(l))!=null&&(c=r[a]=l)}c!=null&&c(n,i,a)||(a=(c=n).l,yi(c),c.fa?c=void 0:(l=c.g.g-a,c.g.g=a,c=oa(c.g,l)),a=i,c&&((l=a[ir])?l.push(c):a[ir]=[c]))}return 8192&s&&nr(i),!0},e[xa]=t}function ad(e){const t=(e=ka(e))[0].g;if(e=e[1]){const r=os(e),i=$t(is,ns,ss,e).T;return(n,s,a)=>t(n,s,a,i,r)}return t}function Si(e,t,r){e[t]=r.h}function Ai(e,t,r,i){let n,s;const a=r.h;e[t]=(c,l,u)=>a(c,l,u,s||(s=$t(Ti,Si,Ai,i).T),n||(n=Ea(i)))}function Ea(e){let t=e[ya];if(!t){const r=$t(Ti,Si,Ai,e);t=(i,n)=>ja(i,n,r),e[ya]=t}return t}function ja(e,t,r){(function(i,n,s){const a=512&n?0:-1,c=i.length,l=c+((n=64&n?256&n:!!c&&ai(i[c-1]))?-1:0);for(let u=0;u<l;u++)s(u-a,i[u]);if(n){i=i[c-1];for(const u in i)!isNaN(u)&&s(+u,i[u])}})(e,0|e[k]|(r.T[1]?512:0),(i,n)=>{if(n!=null){var s=function(a,c){var l=a[c];if(l)return l;if((l=a.ga)&&(l=l[c])){var u=(l=ka(l))[0].h;if(l=l[1]){const h=Ea(l),f=$t(Ti,Si,Ai,l).T;l=a.la?va(f,h):(w,m,p)=>u(w,m,p,f,h)}else l=u;return a[c]=l}}(r,i);s&&s(t,n,i)}}),(e=bn(e))&&function(i,n){fr(i,i.g.end());for(let s=0;s<n.length;s++)fr(i,wn(n[s])||new Uint8Array(0))}(t,e)}function mr(e,t){if(Array.isArray(t)){var r=0|t[k];if(4&r)return t;for(var i=0,n=0;i<t.length;i++){const s=e(t[i]);s!=null&&(t[n++]=s)}return n<i&&(t.length=n),ie(t,-6145&(5|r)),2&r&&Object.freeze(t),t}}function me(e,t,r){return new wr(e,t,r)}function gr(e,t,r){return new wr(e,t,r)}function ge(e,t,r){Y(e,0|e[k],t,r)}var cd=ji(function(e,t,r,i,n){return e.h===2&&(e=Gr(e,St([void 0,void 0],i,!0),n),_t(i=0|t[k]),(n=ht(t,i,r))instanceof et?2&n.M?((n=n.da()).push(e),Y(t,i,r,n)):n.Ja(e):Array.isArray(n)?(2&(0|n[k])&&Y(t,i,r,n=Zo(n)),n.push(e)):Y(t,i,r,[e]),!0)},function(e,t,r,i,n){if(t instanceof et)t.forEach((s,a)=>{Ei(e,r,St([a,s],i,!1),n)});else if(Array.isArray(t))for(let s=0;s<t.length;s++){const a=t[s];Array.isArray(a)&&Ei(e,r,St(a,i,!1),n)}});function Ta(e,t,r){if(t=function(i){if(i==null)return i;const n=typeof i;if(n==="bigint")return String(Or(64,i));if(Rr(i)){if(n==="string")return Vo(i);if(n==="number")return Tn(i)}}(t),t!=null&&(typeof t=="string"&&da(t),t!=null))switch(Te(e,r,0),typeof t){case"number":e=e.g,Gt(t),dr(e,B,X);break;case"bigint":r=BigInt.asUintN(64,t),r=new Xn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),dr(e.g,r.h,r.g);break;default:r=da(t),dr(e.g,r.h,r.g)}}function Sa(e,t,r){(t=or(t))!=null&&t!=null&&(Te(e,r,0),ki(e.g,t))}function Aa(e,t,r){(t=Oo(t))!=null&&(Te(e,r,0),e.g.g.push(t?1:0))}function Ca(e,t,r){(t=cr(t))!=null&&_i(e,r,ho(t))}function Na(e,t,r,i,n){Ei(e,r,_a(t,i),n)}function Ia(e,t,r){t==null||typeof t=="string"||t instanceof dt||(Bt(t)?Bt(t)&&gn(To):t=void 0),t!=null&&_i(e,r,Vn(t).buffer)}function Ma(e,t,r){return(e.h===5||e.h===2)&&(t=ur(t,0|t[k],r,!1),e.h==2?bi(e,Hn,t):t.push(Hn(e.g)),!0)}var pt=me(function(e,t,r){if(e.h!==1)return!1;var i=e.g;e=$n(i);const n=$n(i);i=2*(n>>31)+1;const s=n>>>20&2047;return e=4294967296*(1048575&n)+e,ge(t,r,s==2047?e?NaN:i*(1/0):s==0?5e-324*i*e:i*Math.pow(2,s-1075)*(e+4503599627370496)),!0},function(e,t,r){(t=Tt(t))!=null&&(Te(e,r,1),e=e.g,(r=Lo||(Lo=new DataView(new ArrayBuffer(8)))).setFloat64(0,+t,!0),B=r.getUint32(0,!0),X=r.getUint32(4,!0),Vr(e,B),Vr(e,X))},Ke()),ne=me(function(e,t,r){return e.h===5&&(ge(t,r,Hn(e.g)),!0)},function(e,t,r){(t=Tt(t))!=null&&(Te(e,r,5),e=e.g,kn(t),Vr(e,B))},rs),ld=gr(Ma,function(e,t,r){if((t=mr(Tt,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&(Te(i,n,5),i=i.g,kn(s),Vr(i,B))}},rs),as=gr(Ma,function(e,t,r){if((t=mr(Tt,t))!=null&&t.length){Te(e,r,2),hr(e.g,4*t.length);for(let i=0;i<t.length;i++)r=e.g,kn(t[i]),Vr(r,B)}},rs),Nt=me(function(e,t,r){return e.h===0&&(ge(t,r,zn(e.g,En)),!0)},Ta,wa),cs=me(function(e,t,r){return e.h===0&&(ge(t,r,(e=zn(e.g,En))===0?void 0:e),!0)},Ta,wa),ud=me(function(e,t,r){return e.h===0&&(ge(t,r,zn(e.g,_n)),!0)},function(e,t,r){if((t=Wu(t))!=null&&(typeof t=="string"&&ua(t),t!=null))switch(Te(e,r,0),typeof t){case"number":e=e.g,Gt(t),dr(e,B,X);break;case"bigint":r=BigInt.asUintN(64,t),r=new Kn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),dr(e.g,r.h,r.g);break;default:r=ua(t),dr(e.g,r.h,r.g)}},Ke()),J=me(function(e,t,r){return e.h===0&&(ge(t,r,Ct(e.g)),!0)},Sa,ts),Ci=gr(function(e,t,r){return(e.h===0||e.h===2)&&(t=ur(t,0|t[k],r,!1),e.h==2?bi(e,Ct,t):t.push(Ct(e.g)),!0)},function(e,t,r){if((t=mr(or,t))!=null&&t.length){r=Jn(e,r);for(let i=0;i<t.length;i++)ki(e.g,t[i]);Qn(e,r)}},ts),pr=me(function(e,t,r){return e.h===0&&(ge(t,r,(e=Ct(e.g))===0?void 0:e),!0)},Sa,ts),$=me(function(e,t,r){return e.h===0&&(ge(t,r,Wn(e.g)),!0)},Aa,ha),xr=me(function(e,t,r){return e.h===0&&(ge(t,r,(e=Wn(e.g))===!1?void 0:e),!0)},Aa,ha),fe=gr(function(e,t,r){return e.h===2&&(e=Yn(e),ur(t,0|t[k],r,!1).push(e),!0)},function(e,t,r){if((t=mr(cr,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&_i(i,n,ho(s))}},es),It=me(function(e,t,r){return e.h===2&&(ge(t,r,(e=Yn(e))===""?void 0:e),!0)},Ca,es),O=me(function(e,t,r){return e.h===2&&(ge(t,r,Yn(e)),!0)},Ca,es),oe=function(e,t,r=Zn){return new wr(e,t,r)}(function(e,t,r,i,n){return e.h===2&&(i=St(void 0,i,!0),ur(t,0|t[k],r,!0).push(i),Gr(e,i,n),!0)},function(e,t,r,i,n){if(Array.isArray(t))for(let s=0;s<t.length;s++)Na(e,t[s],r,i,n)}),R=ji(function(e,t,r,i,n,s){return e.h===2&&(ea(t,0|t[k],s,r),Gr(e,t=Un(t,i,r),n),!0)},Na),La=me(function(e,t,r){return e.h===2&&(ge(t,r,la(e)),!0)},Ia,ma),dd=gr(function(e,t,r){return(e.h===0||e.h===2)&&(t=ur(t,0|t[k],r,!1),e.h==2?bi(e,gt,t):t.push(gt(e.g)),!0)},function(e,t,r){if((t=mr(Ro,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&(Te(i,n,0),hr(i.g,s))}},fa),hd=me(function(e,t,r){return e.h===0&&(ge(t,r,(e=gt(e.g))===0?void 0:e),!0)},function(e,t,r){(t=Ro(t))!=null&&t!=null&&(Te(e,r,0),hr(e.g,t))},fa),Se=me(function(e,t,r){return e.h===0&&(ge(t,r,Ct(e.g)),!0)},function(e,t,r){(t=or(t))!=null&&(t=parseInt(t,10),Te(e,r,0),ki(e.g,t))},ga);class fd{constructor(t,r){this.h=t,this.g=r,this.l=F,this.m=j,this.defaultValue=void 0}register(){ii(this)}}function Xe(e,t){return new fd(e,t)}function Mt(e,t){return(r,i)=>{if(vi.length){const s=vi.pop();s.o(i),qn(s.g,r,i),r=s}else r=new class{constructor(s,a){if(aa.length){const c=aa.pop();qn(c,s,a),s=c}else s=new class{constructor(c,l){this.h=null,this.m=!1,this.g=this.l=this.j=0,qn(this,c,l)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.aa=!1}}(s,a);this.g=s,this.l=this.g.g,this.h=this.m=-1,this.o(a)}o({fa:s=!1}={}){this.fa=s}}(r,i);try{const s=new e,a=s.u;os(t)(a,r);var n=s}finally{r.g.clear(),r.m=-1,r.h=-1,vi.length<100&&vi.push(r)}return n}}function Ni(e){return function(){const t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const a=this.g;return this.g=[],a}}}};ja(this.u,t,$t(Ti,Si,Ai,e)),fr(t,t.g.end());const r=new Uint8Array(t.h),i=t.l,n=i.length;let s=0;for(let a=0;a<n;a++){const c=i[a];r.set(c,s),s+=c.length}return t.l=[r],r}}var Fa=class extends y{constructor(e){super(e)}},Pa=[0,It,me(function(e,t,r){return e.h===2&&(ge(t,r,(e=la(e))===Ut()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof y){const i=t.Oa;return void(i&&(t=i(t),t!=null&&_i(e,r,Vn(t).buffer)))}if(Array.isArray(t))return}Ia(e,t,r)},ma)];let ls,Da=globalThis.trustedTypes;function Oa(e){ls===void 0&&(ls=function(){let r=null;if(!Da)return r;try{const i=n=>n;r=Da.createPolicy("goog#html",{createHTML:i,createScript:i,createScriptURL:i})}catch{}return r}());var t=ls;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function wd(e,...t){if(t.length===0)return Oa(e[0]);let r=e[0];for(let i=0;i<t.length;i++)r+=encodeURIComponent(t[i])+e[i+1];return Oa(r)}var Ra=[0,J,Se,$,-1,Ci,Se,-1],md=class extends y{constructor(e){super(e)}},Ba=[0,$,O,$,Se,-1,gr(function(e,t,r){return(e.h===0||e.h===2)&&(t=ur(t,0|t[k],r,!1),e.h==2?bi(e,rd,t):t.push(Ct(e.g)),!0)},function(e,t,r){if((t=mr(or,t))!=null&&t.length){r=Jn(e,r);for(let i=0;i<t.length;i++)ki(e.g,t[i]);Qn(e,r)}},ga),O,-1,[0,$,-1],Se,$,-1],Ua=[0,O,-2],Ga=class extends y{constructor(e){super(e)}},Va=[0],za=[0,J,$,1,$,-3],Ae=class extends y{constructor(e){super(e,2)}},se={};se[336783863]=[0,O,$,-1,J,[0,[1,2,3,4,5,6,7,8,9],R,Va,R,Ba,R,Ua,R,za,R,Ra,R,[0,O,-2],R,[0,O,Se],R,[0,Se,O,-1],R,[0,Se,-1]],[0,O],$,[0,[1,3],[2,4],R,[0,Ci],-1,R,[0,fe],-1,oe,[0,O,-1]],O];var Wa=[0,cs,-1,xr,-3,cs,Ci,It,pr,cs,-1,xr,pr,xr,-2,It];function Ce(e,t){Dn(e,2,ar(t),"")}function z(e,t){gi(e,3,t)}function M(e,t){gi(e,4,t)}var pe=class extends y{constructor(e){super(e,500)}o(e){return j(this,0,7,e)}},zr=[-1,{}],$a=[0,O,1,zr],Ha=[0,O,fe,zr];function Ne(e,t){pi(e,1,pe,t)}function W(e,t){gi(e,10,t)}function P(e,t){gi(e,15,t)}var ye=class extends y{constructor(e){super(e,500)}o(e){return j(this,0,1001,e)}},qa=[-500,oe,[-500,It,-1,fe,-3,[-2,se,$],oe,Pa,pr,-1,$a,Ha,oe,[0,It,xr],It,Wa,pr,fe,987,fe],4,oe,[-500,O,-1,[-1,{}],998,O],oe,[-500,O,fe,-1,[-2,{},$],997,fe,-1],pr,oe,[-500,O,fe,zr,998,fe],fe,pr,$a,Ha,oe,[0,It,-1,zr],fe,-2,Wa,It,-1,xr,[0,xr,hd],978,zr,oe,Pa];ye.prototype.g=Ni(qa);var gd=Mt(ye,qa),pd=class extends y{constructor(e){super(e)}},Ya=class extends y{constructor(e){super(e)}g(){return wt(this,pd,1)}},Ka=[0,oe,[0,J,ne,O,-1]],Ii=Mt(Ya,Ka),xd=class extends y{constructor(e){super(e)}},yd=class extends y{constructor(e){super(e)}},us=class extends y{constructor(e){super(e)}h(){return F(this,xd,2)}g(){return wt(this,yd,5)}},Xa=Mt(class extends y{constructor(e){super(e)}},[0,fe,Ci,as,[0,Se,[0,J,-3],[0,ne,-3],[0,J,-1,[0,oe,[0,J,-2]]],oe,[0,ne,-1,O,ne]],O,-1,Nt,oe,[0,J,ne],fe,Nt]),Ja=class extends y{constructor(e){super(e)}},yr=Mt(class extends y{constructor(e){super(e)}},[0,oe,[0,ne,-4]]),Qa=class extends y{constructor(e){super(e)}},Wr=Mt(class extends y{constructor(e){super(e)}},[0,oe,[0,ne,-4]]),bd=class extends y{constructor(e){super(e)}},vd=[0,J,-1,as,Se],Za=class extends y{constructor(e){super(e)}};Za.prototype.g=Ni([0,ne,-4,Nt]);var kd=class extends y{constructor(e){super(e)}},_d=Mt(class extends y{constructor(e){super(e)}},[0,oe,[0,1,J,O,Ka],Nt]),ec=class extends y{constructor(e){super(e)}},Ed=class extends y{constructor(e){super(e)}ma(){const e=Qo(this);return e??Ut()}},jd=class extends y{constructor(e){super(e)}},tc=[1,2],Td=Mt(class extends y{constructor(e){super(e)}},[0,oe,[0,tc,R,[0,as],R,[0,La],J,O],Nt]),ds=class extends y{constructor(e){super(e)}},rc=[0,O,J,ne,fe,-1],ic=class extends y{constructor(e){super(e)}},Sd=[0,$,-1],nc=class extends y{constructor(e){super(e)}},Mi=[1,2,3,4,5],Li=class extends y{constructor(e){super(e)}g(){return Qo(this)!=null}h(){return Re(this,2)!=null}},H=class extends y{constructor(e){super(e)}g(){return Oo(lr(this,2))??!1}},sc=[0,La,O,[0,J,Nt,-1],[0,ud,Nt]],te=[0,sc,$,[0,Mi,R,za,R,Ba,R,Ra,R,Va,R,Ua],Se],Fi=class extends y{constructor(e){super(e)}},hs=[0,te,ne,-1,J],Ad=Xe(502141897,Fi);se[502141897]=hs;var Cd=Mt(class extends y{constructor(e){super(e)}},[0,[0,Se,-1,ld,dd],vd]),oc=class extends y{constructor(e){super(e)}},ac=class extends y{constructor(e){super(e)}},fs=[0,te,ne,[0,te],$],cc=[0,te,hs,fs,ne,[0,[0,sc]]],Nd=Xe(508968150,ac);se[508968150]=cc,se[508968149]=fs;var lc=class extends y{constructor(e){super(e)}},Id=Xe(513916220,lc);se[513916220]=[0,te,cc,J];var br=class extends y{constructor(e){super(e)}h(){return F(this,ds,2)}g(){V(this,2)}},uc=[0,te,rc];se[478825465]=uc;var Md=class extends y{constructor(e){super(e)}},dc=class extends y{constructor(e){super(e)}},ws=class extends y{constructor(e){super(e)}},ms=class extends y{constructor(e){super(e)}},hc=class extends y{constructor(e){super(e)}},fc=[0,te,[0,te],uc,-1],wc=[0,te,ne,J],gs=[0,te,ne],mc=[0,te,wc,gs,ne],Ld=Xe(479097054,hc);se[479097054]=[0,te,mc,fc],se[463370452]=fc,se[464864288]=wc;var Fd=Xe(462713202,ms);se[462713202]=mc,se[474472470]=gs;var Pd=class extends y{constructor(e){super(e)}},gc=class extends y{constructor(e){super(e)}},pc=class extends y{constructor(e){super(e)}},xc=class extends y{constructor(e){super(e)}},ps=[0,te,ne,-1,J],xs=[0,te,ne,$];xc.prototype.g=Ni([0,te,gs,[0,te],hs,fs,ps,xs]);var yc=class extends y{constructor(e){super(e)}},Dd=Xe(456383383,yc);se[456383383]=[0,te,rc];var bc=class extends y{constructor(e){super(e)}},Od=Xe(476348187,bc);se[476348187]=[0,te,Sd];var vc=class extends y{constructor(e){super(e)}},kc=class extends y{constructor(e){super(e)}},_c=[0,Se,-1],Rd=Xe(458105876,class extends y{constructor(e){super(e)}g(){var e=this.u;const t=0|e[k],r=2&t;return e=function(i,n,s){var a=kc;const c=2&n;let l=!1;if(s==null){if(c)return Ko();s=[]}else if(s.constructor===et){if(!(2&s.M)||c)return s;s=s.da()}else Array.isArray(s)?l=!!(2&(0|s[k])):s=[];if(c){if(!s.length)return Ko();l||(l=!0,nr(s))}else l&&(l=!1,s=Zo(s));return l||(64&(0|s[k])?s[k]&=-33:32&n&&si(s,32)),Y(i,n,2,a=new et(s,a,$u,void 0)),a}(e,t,ht(e,t,2)),!r&&kc&&(e.pa=!0),e}});se[458105876]=[0,_c,cd,[!0,Nt,[0,O,-1,fe]]];var ys=class extends y{constructor(e){super(e)}},Ec=Xe(458105758,ys);se[458105758]=[0,te,O,_c];var jc=class extends y{constructor(e){super(e)}},Bd=Xe(443442058,jc);se[443442058]=[0,te,O,J,ne,fe,-1,$,ne],se[514774813]=ps;var Tc=class extends y{constructor(e){super(e)}},Ud=Xe(516587230,Tc);function bs(e,t){return t=t?t.clone():new ds,e.displayNamesLocale!==void 0?V(t,1,ar(e.displayNamesLocale)):e.displayNamesLocale===void 0&&V(t,1),e.maxResults!==void 0?tt(t,2,e.maxResults):"maxResults"in e&&V(t,2),e.scoreThreshold!==void 0?b(t,3,e.scoreThreshold):"scoreThreshold"in e&&V(t,3),e.categoryAllowlist!==void 0?xi(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&V(t,4),e.categoryDenylist!==void 0?xi(t,5,e.categoryDenylist):"categoryDenylist"in e&&V(t,5),t}function vs(e,t=-1,r=""){return{categories:e.map(i=>({index:Oe(i,1)??0??-1,score:ee(i,2)??0,categoryName:Re(i,3)??""??"",displayName:Re(i,4)??""??""})),headIndex:t,headName:r}}function Sc(e){var a,c;var t=zt(e,3,Tt,Vt()),r=zt(e,2,or,Vt()),i=zt(e,1,cr,Vt()),n=zt(e,9,cr,Vt());const s={categories:[],keypoints:[]};for(let l=0;l<t.length;l++)s.categories.push({score:t[l],index:r[l]??-1,categoryName:i[l]??"",displayName:n[l]??""});if((t=(a=F(e,us,4))==null?void 0:a.h())&&(s.boundingBox={originX:Oe(t,1)??0,originY:Oe(t,2)??0,width:Oe(t,3)??0,height:Oe(t,4)??0,angle:0}),(c=F(e,us,4))==null?void 0:c.g().length)for(const l of F(e,us,4).g())s.keypoints.push({x:mi(l,1)??0,y:mi(l,2)??0,score:mi(l,4)??0,label:Re(l,3)??""});return s}function Pi(e){const t=[];for(const r of wt(e,Qa,1))t.push({x:ee(r,1)??0,y:ee(r,2)??0,z:ee(r,3)??0,visibility:ee(r,4)??0});return t}function $r(e){const t=[];for(const r of wt(e,Ja,1))t.push({x:ee(r,1)??0,y:ee(r,2)??0,z:ee(r,3)??0,visibility:ee(r,4)??0});return t}function Ac(e){return Array.from(e,t=>t>127?t-256:t)}function Cc(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,i=0,n=0;for(let s=0;s<e.length;s++)r+=e[s]*t[s],i+=e[s]*e[s],n+=t[s]*t[s];if(i<=0||n<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(i*n)}let Di;se[516587230]=[0,te,ps,xs,ne],se[518928384]=xs;const Gd=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Nc(){if(Di===void 0)try{await WebAssembly.instantiate(Gd),Di=!0}catch{Di=!1}return Di}async function Hr(e,t=wd``){const r=await Nc()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Ht=class{};function Ic(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")}(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function Mc(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,i)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",n=>{i(n)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function Lc(e){return e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height]}function _(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function Fc(e,t,r){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(r?e.i._bindTextureToStream(r):e.i._bindTextureToCanvas(),!(r=e.i.canvas.getContext("webgl2")||e.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const[i,n]=Lc(t);return!e.l||i===e.i.canvas.width&&n===e.i.canvas.height||(e.i.canvas.width=i,e.i.canvas.height=n),[i,n]}function Pc(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const i=new Uint32Array(t.length);for(let n=0;n<t.length;n++)i[n]=e.i.stringToNewUTF8(t[n]);t=e.i._malloc(4*i.length),e.i.HEAPU32.set(i,t>>2),r(t);for(const n of i)e.i._free(n);e.i._free(t)}function rt(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function Lt(e,t,r){let i=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(n,s,a)=>{s?(r(i,a),i=[]):i.push(n)}}Ht.forVisionTasks=function(e){return Hr("vision",e)},Ht.forTextTasks=function(e){return Hr("text",e)},Ht.forGenAiExperimentalTasks=function(e){return Hr("genai_experimental",e)},Ht.forGenAiTasks=function(e){return Hr("genai",e)},Ht.forAudioTasks=function(e){return Hr("audio",e)},Ht.isSimdSupported=function(){return Nc()};async function Vd(e,t,r,i){return e=await(async(n,s,a,c,l)=>{if(s&&await Mc(s),!self.ModuleFactory||a&&(await Mc(a),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&l&&((s=self.Module).locateFile=l.locateFile,l.mainScriptUrlOrBlob&&(s.mainScriptUrlOrBlob=l.mainScriptUrlOrBlob)),l=await self.ModuleFactory(self.Module||l),self.ModuleFactory=self.Module=void 0,new n(l,c)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:n=>n.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&n.endsWith(".data")?r.assetBinaryPath.toString():n}),await e.o(i),e}function ks(e,t){const r=F(e.baseOptions,Li,1)||new Li;typeof t=="string"?(V(r,2,ar(t)),V(r,1)):t instanceof Uint8Array&&(V(r,1,yn(t,!1)),V(r,2)),j(e.baseOptions,0,1,r)}function Dc(e){try{const t=e.G.length;if(t===1)throw Error(e.G[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.G.map(r=>r.message).join(", "))}finally{e.G=[]}}function x(e,t){e.B=Math.max(e.B,t)}function Oi(e,t){e.A=new pe,Ce(e.A,"PassThroughCalculator"),z(e.A,"free_memory"),M(e.A,"free_memory_unused_out"),W(t,"free_memory"),Ne(t,e.A)}function vr(e,t){z(e.A,t),M(e.A,t+"_unused_out")}function Ri(e){e.g.addBoolToStream(!0,"free_memory",e.B)}var _s=class{constructor(e){this.g=e,this.G=[],this.B=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var r,i,n,s,a,c;if(t){const l=e.baseOptions||{};if((r=e.baseOptions)!=null&&r.modelAssetBuffer&&((i=e.baseOptions)!=null&&i.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((n=F(this.baseOptions,Li,1))!=null&&n.g()||(s=F(this.baseOptions,Li,1))!=null&&s.h()||(a=e.baseOptions)!=null&&a.modelAssetBuffer||(c=e.baseOptions)!=null&&c.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(u,h){let f=F(u.baseOptions,nc,3);if(!f){var w=f=new nc,m=new Ga;Br(w,4,Mi,m)}"delegate"in h&&(h.delegate==="GPU"?(h=f,w=new md,Br(h,2,Mi,w)):(h=f,w=new Ga,Br(h,4,Mi,w))),j(u.baseOptions,0,3,f)}(this,l),l.modelAssetPath)return fetch(l.modelAssetPath.toString()).then(u=>{if(u.ok)return u.arrayBuffer();throw Error(`Failed to fetch model: ${l.modelAssetPath} (${u.status})`)}).then(u=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(u),!0,!1,!1),ks(this,"/model.dat"),this.m(),this.J()});if(l.modelAssetBuffer instanceof Uint8Array)ks(this,l.modelAssetBuffer);else if(l.modelAssetBuffer)return async function(u){const h=[];for(var f=0;;){const{done:w,value:m}=await u.read();if(w)break;h.push(m),f+=m.length}if(h.length===0)return new Uint8Array(0);if(h.length===1)return h[0];u=new Uint8Array(f),f=0;for(const w of h)u.set(w,f),f+=w.length;return u}(l.modelAssetBuffer).then(u=>{ks(this,u),this.m(),this.J()})}return this.m(),this.J(),Promise.resolve()}J(){}ca(){let e;if(this.g.ca(t=>{e=gd(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,i)=>{this.G.push(Error(i))}),this.g.Ha(),this.g.setGraph(e,t),this.A=void 0,Dc(this)}finishProcessing(){this.g.finishProcessing(),Dc(this)}close(){this.A=void 0,this.g.closeGraph()}};function xt(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}_s.prototype.close=_s.prototype.close;class zd{constructor(t,r,i,n){this.g=t,this.h=r,this.m=i,this.l=n}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function Oc(e,t,r){const i=e.g;if(r=xt(i.createShader(r),"Failed to create WebGL shader"),i.shaderSource(r,t),i.compileShader(r),!i.getShaderParameter(r,i.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${i.getShaderInfoLog(r)}`);return i.attachShader(e.h,r),r}function Rc(e,t){const r=e.g,i=xt(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(i);const n=xt(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,n),r.enableVertexAttribArray(e.P),r.vertexAttribPointer(e.P,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);const s=xt(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.J),r.vertexAttribPointer(e.J,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,null),r.bindVertexArray(null),new zd(r,i,n,s)}function Es(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function js(e,t,r,i){return Es(e,t),e.h||(e.m(),e.C()),r?(e.s||(e.s=Rc(e,!0)),r=e.s):(e.v||(e.v=Rc(e,!1)),r=e.v),t.useProgram(e.h),r.bind(),e.l(),e=i(),r.g.bindVertexArray(null),e}function Bi(e,t,r){return Es(e,t),e=xt(t.createTexture(),"Failed to create texture"),t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,r??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function Ui(e,t,r){Es(e,t),e.A||(e.A=xt(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.A),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function Ts(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Ss=class{G(){return`
|
|
69
|
+
precision mediump float;
|
|
70
|
+
varying vec2 vTex;
|
|
71
|
+
uniform sampler2D inputTexture;
|
|
72
|
+
void main() {
|
|
73
|
+
gl_FragColor = texture2D(inputTexture, vTex);
|
|
74
|
+
}
|
|
75
|
+
`}m(){const e=this.g;if(this.h=xt(e.createProgram(),"Failed to create WebGL program"),this.Z=Oc(this,`
|
|
76
|
+
attribute vec2 aVertex;
|
|
77
|
+
attribute vec2 aTex;
|
|
78
|
+
varying vec2 vTex;
|
|
79
|
+
void main(void) {
|
|
80
|
+
gl_Position = vec4(aVertex, 0.0, 1.0);
|
|
81
|
+
vTex = aTex;
|
|
82
|
+
}`,e.VERTEX_SHADER),this.Y=Oc(this,this.G(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.P=e.getAttribLocation(this.h,"aVertex"),this.J=e.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.Z),e.deleteShader(this.Y)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}};function yt(e,t){switch(t){case 0:return e.g.find(r=>r instanceof Uint8Array);case 1:return e.g.find(r=>r instanceof Float32Array);case 2:return e.g.find(r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function As(e){var t=yt(e,1);if(!t){if(t=yt(e,0))t=new Float32Array(t).map(i=>i/255);else{t=new Float32Array(e.width*e.height);const i=kr(e);var r=Cs(e);if(Ui(r,i,Bc(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){r=new Float32Array(e.width*e.height*4),i.readPixels(0,0,e.width,e.height,i.RGBA,i.FLOAT,r);for(let n=0,s=0;n<t.length;++n,s+=4)t[n]=r[s]}else i.readPixels(0,0,e.width,e.height,i.RED,i.FLOAT,t)}e.g.push(t)}return t}function Bc(e){let t=yt(e,2);if(!t){const r=kr(e);t=Gc(e);const i=As(e),n=Uc(e);r.texImage2D(r.TEXTURE_2D,0,n,e.width,e.height,0,r.RED,r.FLOAT,i),Ns(e)}return t}function kr(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=xt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Uc(e){if(e=kr(e),!Gi)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Gi=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Gi=e.R16F}return Gi}function Cs(e){return e.l||(e.l=new Ss),e.l}function Gc(e){const t=kr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=yt(e,2);return r||(r=Bi(Cs(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Ns(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Gi,ae=class{constructor(e,t,r,i,n,s,a){this.g=e,this.m=t,this.j=r,this.canvas=i,this.l=n,this.width=s,this.height=a,this.j&&--Vc===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Da(){return!!yt(this,0)}ja(){return!!yt(this,1)}R(){return!!yt(this,2)}ia(){return(t=yt(e=this,0))||(t=As(e),t=new Uint8Array(t.map(r=>255*r)),e.g.push(t)),t;var e,t}ha(){return As(this)}N(){return Bc(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{const i=kr(this),n=Cs(this);i.activeTexture(i.TEXTURE1),r=Bi(n,i,this.m?i.LINEAR:i.NEAREST),i.bindTexture(i.TEXTURE_2D,r);const s=Uc(this);i.texImage2D(i.TEXTURE_2D,0,s,this.width,this.height,0,i.RED,i.FLOAT,null),i.bindTexture(i.TEXTURE_2D,null),Ui(n,i,r),js(n,i,!1,()=>{Gc(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),Ns(this)}),Ts(n),Ns(this)}}e.push(r)}return new ae(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&kr(this).deleteTexture(yt(this,2)),Vc=-1}};ae.prototype.close=ae.prototype.close,ae.prototype.clone=ae.prototype.clone,ae.prototype.getAsWebGLTexture=ae.prototype.N,ae.prototype.getAsFloat32Array=ae.prototype.ha,ae.prototype.getAsUint8Array=ae.prototype.ia,ae.prototype.hasWebGLTexture=ae.prototype.R,ae.prototype.hasFloat32Array=ae.prototype.ja,ae.prototype.hasUint8Array=ae.prototype.Da;var Vc=250;function it(e,t){switch(t){case 0:return e.g.find(r=>r instanceof ImageData);case 1:return e.g.find(r=>typeof ImageBitmap<"u"&&r instanceof ImageBitmap);case 2:return e.g.find(r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function zc(e){var t=it(e,0);if(!t){t=_r(e);const r=zi(e),i=new Uint8Array(e.width*e.height*4);Ui(r,t,Vi(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,i),Ts(r),t=new ImageData(new Uint8ClampedArray(i.buffer),e.width,e.height),e.g.push(t)}return t}function Vi(e){let t=it(e,2);if(!t){const r=_r(e);t=Wi(e);const i=it(e,1)||zc(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,i),qr(e)}return t}function _r(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=xt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function zi(e){return e.l||(e.l=new Ss),e.l}function Wi(e){const t=_r(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=it(e,2);return r||(r=Bi(zi(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function qr(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Wc(e){const t=_r(e);return js(zi(e),t,!0,()=>function(r,i){const n=r.canvas;if(n.width===r.width&&n.height===r.height)return i();const s=n.width,a=n.height;return n.width=r.width,n.height=r.height,r=i(),n.width=s,n.height=a,r}(e,()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))}var ce=class{constructor(e,t,r,i,n,s,a){this.g=e,this.j=t,this.m=r,this.canvas=i,this.l=n,this.width=s,this.height=a,(this.j||this.m)&&--$c===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ca(){return!!it(this,0)}ka(){return!!it(this,1)}R(){return!!it(this,2)}Aa(){return zc(this)}za(){var e=it(this,1);return e||(Vi(this),Wi(this),e=Wc(this),qr(this),this.g.push(e),this.j=!0),e}N(){return Vi(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const i=_r(this),n=zi(this);i.activeTexture(i.TEXTURE1),r=Bi(n,i),i.bindTexture(i.TEXTURE_2D,r),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.width,this.height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.bindTexture(i.TEXTURE_2D,null),Ui(n,i,r),js(n,i,!1,()=>{Wi(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),qr(this)}),Ts(n),qr(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Vi(this),Wi(this),r=Wc(this),qr(this)}e.push(r)}return new ce(e,this.ka(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&it(this,1).close(),this.m&&_r(this).deleteTexture(it(this,2)),$c=-1}};ce.prototype.close=ce.prototype.close,ce.prototype.clone=ce.prototype.clone,ce.prototype.getAsWebGLTexture=ce.prototype.N,ce.prototype.getAsImageBitmap=ce.prototype.za,ce.prototype.getAsImageData=ce.prototype.Aa,ce.prototype.hasWebGLTexture=ce.prototype.R,ce.prototype.hasImageBitmap=ce.prototype.ka,ce.prototype.hasImageData=ce.prototype.Ca;var $c=250;function Je(...e){return e.map(([t,r])=>({start:t,end:r}))}const Wd=function(e){return class extends e{Ha(){this.i._registerModelResourcesGraphService()}}}((Hc=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",t!==void 0?this.i.canvas=t:Ic()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){const t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){const r=e.length,i=this.i._malloc(r);this.i.HEAPU8.set(e,i),t?this.i._changeBinaryGraph(r,i):this.i._changeTextGraph(r,i),this.i._free(i)}configureAudio(e,t,r,i,n){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),_(this,i||"input_audio",s=>{_(this,n=n||"audio_header",a=>{this.i._configureAudio(s,a,e,t??0,r)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){rt(this,"__graph_config__",t=>{e(t)}),_(this,"__graph_config__",t=>{this.i._getGraphConfig(t,void 0)}),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,i,n){const s=4*e.length;this.h!==s&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(s),this.h=s),this.i.HEAPF32.set(e,this.g/4),_(this,i,a=>{this.i._addAudioToInputStream(this.g,t,r,a,n)})}addGpuBufferToStream(e,t,r){_(this,t,i=>{const[n,s]=Fc(this,e,i);this.i._addBoundTextureToStream(i,n,s,r)})}addBoolToStream(e,t,r){_(this,t,i=>{this.i._addBoolToInputStream(e,i,r)})}addDoubleToStream(e,t,r){_(this,t,i=>{this.i._addDoubleToInputStream(e,i,r)})}addFloatToStream(e,t,r){_(this,t,i=>{this.i._addFloatToInputStream(e,i,r)})}addIntToStream(e,t,r){_(this,t,i=>{this.i._addIntToInputStream(e,i,r)})}addUintToStream(e,t,r){_(this,t,i=>{this.i._addUintToInputStream(e,i,r)})}addStringToStream(e,t,r){_(this,t,i=>{_(this,e,n=>{this.i._addStringToInputStream(n,i,r)})})}addStringRecordToStream(e,t,r){_(this,t,i=>{Pc(this,Object.keys(e),n=>{Pc(this,Object.values(e),s=>{this.i._addFlatHashMapToInputStream(n,s,Object.keys(e).length,i,r)})})})}addProtoToStream(e,t,r,i){_(this,r,n=>{_(this,t,s=>{const a=this.i._malloc(e.length);this.i.HEAPU8.set(e,a),this.i._addProtoToInputStream(a,e.length,s,n,i),this.i._free(a)})})}addEmptyPacketToStream(e,t){_(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){_(this,t,i=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const s of e)this.i._addBoolVectorEntry(n,s);this.i._addBoolVectorToInputStream(n,i,r)})}addDoubleVectorToStream(e,t,r){_(this,t,i=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const s of e)this.i._addDoubleVectorEntry(n,s);this.i._addDoubleVectorToInputStream(n,i,r)})}addFloatVectorToStream(e,t,r){_(this,t,i=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const s of e)this.i._addFloatVectorEntry(n,s);this.i._addFloatVectorToInputStream(n,i,r)})}addIntVectorToStream(e,t,r){_(this,t,i=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const s of e)this.i._addIntVectorEntry(n,s);this.i._addIntVectorToInputStream(n,i,r)})}addUintVectorToStream(e,t,r){_(this,t,i=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of e)this.i._addUintVectorEntry(n,s);this.i._addUintVectorToInputStream(n,i,r)})}addStringVectorToStream(e,t,r){_(this,t,i=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const s of e)_(this,s,a=>{this.i._addStringVectorEntry(n,a)});this.i._addStringVectorToInputStream(n,i,r)})}addBoolToInputSidePacket(e,t){_(this,t,r=>{this.i._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){_(this,t,r=>{this.i._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){_(this,t,r=>{this.i._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){_(this,t,r=>{this.i._addIntToInputSidePacket(e,r)})}addUintToInputSidePacket(e,t){_(this,t,r=>{this.i._addUintToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){_(this,t,r=>{_(this,e,i=>{this.i._addStringToInputSidePacket(i,r)})})}addProtoToInputSidePacket(e,t,r){_(this,r,i=>{_(this,t,n=>{const s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputSidePacket(s,e.length,n,i),this.i._free(s)})})}addBoolVectorToInputSidePacket(e,t){_(this,t,r=>{const i=this.i._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(const n of e)this.i._addBoolVectorEntry(i,n);this.i._addBoolVectorToInputSidePacket(i,r)})}addDoubleVectorToInputSidePacket(e,t){_(this,t,r=>{const i=this.i._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(const n of e)this.i._addDoubleVectorEntry(i,n);this.i._addDoubleVectorToInputSidePacket(i,r)})}addFloatVectorToInputSidePacket(e,t){_(this,t,r=>{const i=this.i._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(const n of e)this.i._addFloatVectorEntry(i,n);this.i._addFloatVectorToInputSidePacket(i,r)})}addIntVectorToInputSidePacket(e,t){_(this,t,r=>{const i=this.i._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(const n of e)this.i._addIntVectorEntry(i,n);this.i._addIntVectorToInputSidePacket(i,r)})}addUintVectorToInputSidePacket(e,t){_(this,t,r=>{const i=this.i._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(const n of e)this.i._addUintVectorEntry(i,n);this.i._addUintVectorToInputSidePacket(i,r)})}addStringVectorToInputSidePacket(e,t){_(this,t,r=>{const i=this.i._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(const n of e)_(this,n,s=>{this.i._addStringVectorEntry(i,s)});this.i._addStringVectorToInputSidePacket(i,r)})}attachBoolListener(e,t){rt(this,e,t),_(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){Lt(this,e,t),_(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){rt(this,e,t),_(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){Lt(this,e,t),_(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){rt(this,e,t),_(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){Lt(this,e,t),_(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){rt(this,e,t),_(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){Lt(this,e,t),_(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){rt(this,e,t),_(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){Lt(this,e,t),_(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){rt(this,e,t),_(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){Lt(this,e,t),_(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){rt(this,e,t),_(this,e,i=>{this.i._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){Lt(this,e,t),_(this,e,i=>{this.i._attachProtoVectorListener(i,r||!1)})}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),rt(this,e,(i,n)=>{i=new Float32Array(i.buffer,i.byteOffset,i.length/4),t(i,n)}),_(this,e,i=>{this.i._attachAudioListener(i,r||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Hc{get ea(){return this.i}oa(e,t,r){_(this,t,i=>{const[n,s]=Fc(this,e,i);this.ea._addBoundTextureAsImageToStream(i,n,s,r)})}V(e,t){rt(this,e,t),_(this,e,r=>{this.ea._attachImageListener(r)})}ba(e,t){Lt(this,e,t),_(this,e,r=>{this.ea._attachImageVectorListener(r)})}}));var Hc,Be=class extends Wd{};async function I(e,t,r){return async function(i,n,s,a){return Vd(i,n,s,a)}(e,r.canvas??(Ic()?void 0:document.createElement("canvas")),t,r)}function qc(e,t,r,i){if(e.U){const s=new Za;if(r!=null&&r.regionOfInterest){if(!e.na)throw Error("This task doesn't support region-of-interest.");var n=r.regionOfInterest;if(n.left>=n.right||n.top>=n.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(n.left<0||n.top<0||n.right>1||n.bottom>1)throw Error("Expected RectF values to be in [0,1].");b(s,1,(n.left+n.right)/2),b(s,2,(n.top+n.bottom)/2),b(s,4,n.right-n.left),b(s,3,n.bottom-n.top)}else b(s,1,.5),b(s,2,.5),b(s,4,1),b(s,3,1);if(r!=null&&r.rotationDegrees){if((r==null?void 0:r.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(b(s,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[a,c]=Lc(t);r=ee(s,3)*c/a,n=ee(s,4)*a/c,b(s,4,r),b(s,3,n)}}e.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",e.U,i)}e.g.oa(t,e.Z,i??performance.now()),e.finishProcessing()}function Ue(e,t,r){var i;if((i=e.baseOptions)!=null&&i.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");qc(e,t,r,e.B+1)}function nt(e,t,r,i){var n;if(!((n=e.baseOptions)!=null&&n.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");qc(e,t,r,i)}function Er(e,t,r,i){var n=t.data;const s=t.width,a=s*(t=t.height);if((n instanceof Uint8Array||n instanceof Float32Array)&&n.length!==a)throw Error("Unsupported channel count: "+n.length/a);return e=new ae([n],r,!1,e.g.i.canvas,e.P,s,t),i?e.clone():e}var be=class extends _s{constructor(e,t,r,i){super(e),this.g=e,this.Z=t,this.U=r,this.na=i,this.P=new Ss}l(e,t=!0){if("runningMode"in e&&Ur(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.P.close(),super.close()}};be.prototype.close=be.prototype.close;var Ge=class extends be{constructor(e,t){super(new Be(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},j(e=this.h=new Fi,0,1,t=new H),b(this.h,2,.5),b(this.h,3,.3)}get baseOptions(){return F(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&b(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&b(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}D(e,t){return this.j={detections:[]},Ue(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},nt(this,e,r,t),this.j}m(){var e=new ye;W(e,"image_in"),W(e,"norm_rect_in"),P(e,"detections");const t=new Ae;Ye(t,Ad,this.h);const r=new pe;Ce(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect_in"),M(r,"DETECTIONS:detections"),r.o(t),Ne(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Xa(s),this.j.detections.push(Sc(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ge.prototype.detectForVideo=Ge.prototype.F,Ge.prototype.detect=Ge.prototype.D,Ge.prototype.setOptions=Ge.prototype.o,Ge.createFromModelPath=async function(e,t){return I(Ge,e,{baseOptions:{modelAssetPath:t}})},Ge.createFromModelBuffer=function(e,t){return I(Ge,e,{baseOptions:{modelAssetBuffer:t}})},Ge.createFromOptions=function(e,t){return I(Ge,e,t)};var Is=Je([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),Ms=Je([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),Ls=Je([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Yc=Je([474,475],[475,476],[476,477],[477,474]),Fs=Je([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),Ps=Je([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Kc=Je([469,470],[470,471],[471,472],[472,469]),Ds=Je([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),Xc=[...Is,...Ms,...Ls,...Fs,...Ps,...Ds],Jc=Je([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function Qc(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var K=class extends be{constructor(e,t){super(new Be(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,j(e=this.h=new ac,0,1,t=new H),this.v=new oc,j(this.h,0,3,this.v),this.s=new Fi,j(this.h,0,2,this.s),tt(this.s,4,1),b(this.s,2,.5),b(this.v,2,.5),b(this.h,4,.5)}get baseOptions(){return F(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"numFaces"in e&&tt(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&b(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&b(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&b(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}D(e,t){return Qc(this),Ue(this,e,t),this.j}F(e,t,r){return Qc(this),nt(this,e,r,t),this.j}m(){var e=new ye;W(e,"image_in"),W(e,"norm_rect"),P(e,"face_landmarks");const t=new Ae;Ye(t,Nd,this.h);const r=new pe;Ce(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),M(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Ne(e,r),this.g.attachProtoVectorListener("face_landmarks",(i,n)=>{for(const s of i)i=Wr(s),this.j.faceLandmarks.push(Pi(i));x(this,n)}),this.g.attachEmptyPacketListener("face_landmarks",i=>{x(this,i)}),this.outputFaceBlendshapes&&(P(e,"blendshapes"),M(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(i,n)=>{if(this.outputFaceBlendshapes)for(const s of i)i=Ii(s),this.j.faceBlendshapes.push(vs(i.g()??[]));x(this,n)}),this.g.attachEmptyPacketListener("blendshapes",i=>{x(this,i)})),this.outputFacialTransformationMatrixes&&(P(e,"face_geometry"),M(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(i,n)=>{if(this.outputFacialTransformationMatrixes)for(const s of i)(i=F(Cd(s),bd,2))&&this.j.facialTransformationMatrixes.push({rows:Oe(i,1)??0??0,columns:Oe(i,2)??0??0,data:zt(i,3,Tt,Vt()).slice()??[]});x(this,n)}),this.g.attachEmptyPacketListener("face_geometry",i=>{x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};K.prototype.detectForVideo=K.prototype.F,K.prototype.detect=K.prototype.D,K.prototype.setOptions=K.prototype.o,K.createFromModelPath=function(e,t){return I(K,e,{baseOptions:{modelAssetPath:t}})},K.createFromModelBuffer=function(e,t){return I(K,e,{baseOptions:{modelAssetBuffer:t}})},K.createFromOptions=function(e,t){return I(K,e,t)},K.FACE_LANDMARKS_LIPS=Is,K.FACE_LANDMARKS_LEFT_EYE=Ms,K.FACE_LANDMARKS_LEFT_EYEBROW=Ls,K.FACE_LANDMARKS_LEFT_IRIS=Yc,K.FACE_LANDMARKS_RIGHT_EYE=Fs,K.FACE_LANDMARKS_RIGHT_EYEBROW=Ps,K.FACE_LANDMARKS_RIGHT_IRIS=Kc,K.FACE_LANDMARKS_FACE_OVAL=Ds,K.FACE_LANDMARKS_CONTOURS=Xc,K.FACE_LANDMARKS_TESSELATION=Jc;var st=class extends be{constructor(e,t){super(new Be(e,t),"image_in","norm_rect",!0),j(e=this.j=new lc,0,1,t=new H)}get baseOptions(){return F(this.j,H,1)}set baseOptions(e){j(this.j,0,1,e)}o(e){return super.l(e)}Ka(e,t,r){const i=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,Ue(this,e,i??{}),!this.h)return this.s}m(){var e=new ye;W(e,"image_in"),W(e,"norm_rect"),P(e,"stylized_image");const t=new Ae;Ye(t,Id,this.j);const r=new pe;Ce(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),M(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),Ne(e,r),this.g.V("stylized_image",(i,n)=>{var s=!this.h,a=i.data,c=i.width;const l=c*(i=i.height);if(a instanceof Uint8Array)if(a.length===3*l){const u=new Uint8ClampedArray(4*l);for(let h=0;h<l;++h)u[4*h]=a[3*h],u[4*h+1]=a[3*h+1],u[4*h+2]=a[3*h+2],u[4*h+3]=255;a=new ImageData(u,c,i)}else{if(a.length!==4*l)throw Error("Unsupported channel count: "+a.length/l);a=new ImageData(new Uint8ClampedArray(a.buffer,a.byteOffset,a.length),c,i)}else if(!(a instanceof WebGLTexture))throw Error(`Unsupported format: ${a.constructor.name}`);c=new ce([a],!1,!1,this.g.i.canvas,this.P,c,i),this.s=s=s?c.clone():c,this.h&&this.h(s),x(this,n)}),this.g.attachEmptyPacketListener("stylized_image",i=>{this.s=null,this.h&&this.h(null),x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};st.prototype.stylize=st.prototype.Ka,st.prototype.setOptions=st.prototype.o,st.createFromModelPath=function(e,t){return I(st,e,{baseOptions:{modelAssetPath:t}})},st.createFromModelBuffer=function(e,t){return I(st,e,{baseOptions:{modelAssetBuffer:t}})},st.createFromOptions=function(e,t){return I(st,e,t)};var Os=Je([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function Zc(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function el(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function tl(e,t=!0){const r=[];for(const n of e){var i=Ii(n);e=[];for(const s of i.g())i=t&&Oe(s,1)!=null?Oe(s,1)??0:-1,e.push({score:ee(s,2)??0,index:i,categoryName:Re(s,3)??""??"",displayName:Re(s,4)??""??""});r.push(e)}return r}var Ie=class extends be{constructor(e,t){super(new Be(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],j(e=this.j=new hc,0,1,t=new H),this.s=new ms,j(this.j,0,2,this.s),this.C=new ws,j(this.s,0,3,this.C),this.v=new dc,j(this.s,0,2,this.v),this.h=new Md,j(this.j,0,3,this.h),b(this.v,2,.5),b(this.s,4,.5),b(this.C,2,.5)}get baseOptions(){return F(this.j,H,1)}set baseOptions(e){j(this.j,0,1,e)}o(e){var n,s,a,c;if(tt(this.v,3,e.numHands??1),"minHandDetectionConfidence"in e&&b(this.v,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&b(this.s,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&b(this.C,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new br,r=t,i=bs(e.cannedGesturesClassifierOptions,(n=F(this.h,br,3))==null?void 0:n.h());j(r,0,2,i),j(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((s=F(this.h,br,3))==null||s.g());return e.customGesturesClassifierOptions?(j(r=t=new br,0,2,i=bs(e.customGesturesClassifierOptions,(a=F(this.h,br,4))==null?void 0:a.h())),j(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((c=F(this.h,br,4))==null||c.g()),this.l(e)}Fa(e,t){return Zc(this),Ue(this,e,t),el(this)}Ga(e,t,r){return Zc(this),nt(this,e,r,t),el(this)}m(){var e=new ye;W(e,"image_in"),W(e,"norm_rect"),P(e,"hand_gestures"),P(e,"hand_landmarks"),P(e,"world_hand_landmarks"),P(e,"handedness");const t=new Ae;Ye(t,Ld,this.j);const r=new pe;Ce(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),M(r,"HAND_GESTURES:hand_gestures"),M(r,"LANDMARKS:hand_landmarks"),M(r,"WORLD_LANDMARKS:world_hand_landmarks"),M(r,"HANDEDNESS:handedness"),r.o(t),Ne(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i){i=Wr(s);const a=[];for(const c of wt(i,Qa,1))a.push({x:ee(c,1)??0,y:ee(c,2)??0,z:ee(c,3)??0,visibility:ee(c,4)??0});this.landmarks.push(a)}x(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i){i=yr(s);const a=[];for(const c of wt(i,Ja,1))a.push({x:ee(c,1)??0,y:ee(c,2)??0,z:ee(c,3)??0,visibility:ee(c,4)??0});this.worldLandmarks.push(a)}x(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("hand_gestures",(i,n)=>{this.gestures.push(...tl(i,!1)),x(this,n)}),this.g.attachEmptyPacketListener("hand_gestures",i=>{x(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{this.handedness.push(...tl(i)),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function rl(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Ie.prototype.recognizeForVideo=Ie.prototype.Ga,Ie.prototype.recognize=Ie.prototype.Fa,Ie.prototype.setOptions=Ie.prototype.o,Ie.createFromModelPath=function(e,t){return I(Ie,e,{baseOptions:{modelAssetPath:t}})},Ie.createFromModelBuffer=function(e,t){return I(Ie,e,{baseOptions:{modelAssetBuffer:t}})},Ie.createFromOptions=function(e,t){return I(Ie,e,t)},Ie.HAND_CONNECTIONS=Os;var Me=class extends be{constructor(e,t){super(new Be(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],j(e=this.h=new ms,0,1,t=new H),this.s=new ws,j(this.h,0,3,this.s),this.j=new dc,j(this.h,0,2,this.j),tt(this.j,3,1),b(this.j,2,.5),b(this.s,2,.5),b(this.h,4,.5)}get baseOptions(){return F(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"numHands"in e&&tt(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&b(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&b(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&b(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ue(this,e,t),rl(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],nt(this,e,r,t),rl(this)}m(){var e=new ye;W(e,"image_in"),W(e,"norm_rect"),P(e,"hand_landmarks"),P(e,"world_hand_landmarks"),P(e,"handedness");const t=new Ae;Ye(t,Fd,this.h);const r=new pe;Ce(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),M(r,"LANDMARKS:hand_landmarks"),M(r,"WORLD_LANDMARKS:world_hand_landmarks"),M(r,"HANDEDNESS:handedness"),r.o(t),Ne(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i)i=Wr(s),this.landmarks.push(Pi(i));x(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i)i=yr(s),this.worldLandmarks.push($r(i));x(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{var s=this.handedness,a=s.push;const c=[];for(const l of i){i=Ii(l);const u=[];for(const h of i.g())u.push({score:ee(h,2)??0,index:Oe(h,1)??0??-1,categoryName:Re(h,3)??""??"",displayName:Re(h,4)??""??""});c.push(u)}a.call(s,...c),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Me.prototype.detectForVideo=Me.prototype.F,Me.prototype.detect=Me.prototype.D,Me.prototype.setOptions=Me.prototype.o,Me.createFromModelPath=function(e,t){return I(Me,e,{baseOptions:{modelAssetPath:t}})},Me.createFromModelBuffer=function(e,t){return I(Me,e,{baseOptions:{modelAssetBuffer:t}})},Me.createFromOptions=function(e,t){return I(Me,e,t)},Me.HAND_CONNECTIONS=Os;var il=Je([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function nl(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function sl(e){try{if(!e.C)return e.h;e.C(e.h)}finally{Ri(e)}}function $i(e,t){e=Wr(e),t.push(Pi(e))}var q=class extends be{constructor(e,t){super(new Be(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,j(e=this.j=new xc,0,1,t=new H),this.K=new ws,j(this.j,0,2,this.K),this.Y=new Pd,j(this.j,0,3,this.Y),this.s=new Fi,j(this.j,0,4,this.s),this.H=new oc,j(this.j,0,5,this.H),this.v=new gc,j(this.j,0,6,this.v),this.L=new pc,j(this.j,0,7,this.L),b(this.s,2,.5),b(this.s,3,.3),b(this.H,2,.5),b(this.v,2,.5),b(this.v,3,.3),b(this.L,2,.5),b(this.K,2,.5)}get baseOptions(){return F(this.j,H,1)}set baseOptions(e){j(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&b(this.s,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&b(this.s,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&b(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&b(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&b(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&b(this.L,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&b(this.K,2,e.minHandLandmarksConfidence??.5),this.l(e)}D(e,t,r){const i=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:r,nl(this),Ue(this,e,i),sl(this)}F(e,t,r,i){const n=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:i,nl(this),nt(this,e,n,t),sl(this)}m(){var e=new ye;W(e,"input_frames_image"),P(e,"pose_landmarks"),P(e,"pose_world_landmarks"),P(e,"face_landmarks"),P(e,"left_hand_landmarks"),P(e,"left_hand_world_landmarks"),P(e,"right_hand_landmarks"),P(e,"right_hand_world_landmarks");const t=new Ae,r=new Fa;Dn(r,1,ar("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(n,s){if(s!=null)if(Array.isArray(s))V(n,2,hi(s,Mn,void 0,void 0,!1));else{if(!(typeof s=="string"||s instanceof dt||Bt(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Dn(n,2,yn(s,!1),Ut())}}(r,this.j.g());const i=new pe;Ce(i,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),pi(i,8,Fa,r),z(i,"IMAGE:input_frames_image"),M(i,"POSE_LANDMARKS:pose_landmarks"),M(i,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),M(i,"FACE_LANDMARKS:face_landmarks"),M(i,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),M(i,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),M(i,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),M(i,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),i.o(t),Ne(e,i),Oi(this,e),this.g.attachProtoListener("pose_landmarks",(n,s)=>{$i(n,this.h.poseLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("pose_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("pose_world_landmarks",(n,s)=>{var a=this.h.poseWorldLandmarks;n=yr(n),a.push($r(n)),x(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",n=>{x(this,n)}),this.outputPoseSegmentationMasks&&(M(i,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),vr(this,"pose_segmentation_mask"),this.g.V("pose_segmentation_mask",(n,s)=>{this.h.poseSegmentationMasks=[Er(this,n,!0,!this.C)],x(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",n=>{this.h.poseSegmentationMasks=[],x(this,n)})),this.g.attachProtoListener("face_landmarks",(n,s)=>{$i(n,this.h.faceLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{x(this,n)}),this.outputFaceBlendshapes&&(P(e,"extra_blendshapes"),M(i,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(n,s)=>{var a=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=Ii(n),a.push(vs(n.g()??[]))),x(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",n=>{x(this,n)})),this.g.attachProtoListener("left_hand_landmarks",(n,s)=>{$i(n,this.h.leftHandLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("left_hand_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("left_hand_world_landmarks",(n,s)=>{var a=this.h.leftHandWorldLandmarks;n=yr(n),a.push($r(n)),x(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("right_hand_landmarks",(n,s)=>{$i(n,this.h.rightHandLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("right_hand_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("right_hand_world_landmarks",(n,s)=>{var a=this.h.rightHandWorldLandmarks;n=yr(n),a.push($r(n)),x(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",n=>{x(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};q.prototype.detectForVideo=q.prototype.F,q.prototype.detect=q.prototype.D,q.prototype.setOptions=q.prototype.o,q.createFromModelPath=function(e,t){return I(q,e,{baseOptions:{modelAssetPath:t}})},q.createFromModelBuffer=function(e,t){return I(q,e,{baseOptions:{modelAssetBuffer:t}})},q.createFromOptions=function(e,t){return I(q,e,t)},q.HAND_CONNECTIONS=Os,q.POSE_CONNECTIONS=il,q.FACE_LANDMARKS_LIPS=Is,q.FACE_LANDMARKS_LEFT_EYE=Ms,q.FACE_LANDMARKS_LEFT_EYEBROW=Ls,q.FACE_LANDMARKS_LEFT_IRIS=Yc,q.FACE_LANDMARKS_RIGHT_EYE=Fs,q.FACE_LANDMARKS_RIGHT_EYEBROW=Ps,q.FACE_LANDMARKS_RIGHT_IRIS=Kc,q.FACE_LANDMARKS_FACE_OVAL=Ds,q.FACE_LANDMARKS_CONTOURS=Xc,q.FACE_LANDMARKS_TESSELATION=Jc;var Ve=class extends be{constructor(e,t){super(new Be(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},j(e=this.h=new yc,0,1,t=new H)}get baseOptions(){return F(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return j(this.h,0,2,bs(e,F(this.h,ds,2))),this.l(e)}qa(e,t){return this.j={classifications:[]},Ue(this,e,t),this.j}ra(e,t,r){return this.j={classifications:[]},nt(this,e,r,t),this.j}m(){var e=new ye;W(e,"input_image"),W(e,"norm_rect"),P(e,"classifications");const t=new Ae;Ye(t,Dd,this.h);const r=new pe;Ce(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),z(r,"IMAGE:input_image"),z(r,"NORM_RECT:norm_rect"),M(r,"CLASSIFICATIONS:classifications"),r.o(t),Ne(e,r),this.g.attachProtoListener("classifications",(i,n)=>{this.j=function(s){const a={classifications:wt(s,kd,1).map(c=>{var l;return vs(((l=F(c,Ya,4))==null?void 0:l.g())??[],Oe(c,2)??0,Re(c,3)??"")})};return Sn(lr(s,2))!=null&&(a.timestampMs=Sn(lr(s,2))??0),a}(_d(i)),x(this,n)}),this.g.attachEmptyPacketListener("classifications",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ve.prototype.classifyForVideo=Ve.prototype.ra,Ve.prototype.classify=Ve.prototype.qa,Ve.prototype.setOptions=Ve.prototype.o,Ve.createFromModelPath=function(e,t){return I(Ve,e,{baseOptions:{modelAssetPath:t}})},Ve.createFromModelBuffer=function(e,t){return I(Ve,e,{baseOptions:{modelAssetBuffer:t}})},Ve.createFromOptions=function(e,t){return I(Ve,e,t)};var Le=class extends be{constructor(e,t){super(new Be(e,t),"image_in","norm_rect",!0),this.h=new bc,this.embeddings={embeddings:[]},j(e=this.h,0,1,t=new H)}get baseOptions(){return F(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){var t=this.h,r=F(this.h,ic,2);return r=r?r.clone():new ic,e.l2Normalize!==void 0?Ur(r,1,e.l2Normalize):"l2Normalize"in e&&V(r,1),e.quantize!==void 0?Ur(r,2,e.quantize):"quantize"in e&&V(r,2),j(t,0,2,r),this.l(e)}xa(e,t){return Ue(this,e,t),this.embeddings}ya(e,t,r){return nt(this,e,r,t),this.embeddings}m(){var e=new ye;W(e,"image_in"),W(e,"norm_rect"),P(e,"embeddings_out");const t=new Ae;Ye(t,Od,this.h);const r=new pe;Ce(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),M(r,"EMBEDDINGS:embeddings_out"),r.o(t),Ne(e,r),this.g.attachProtoListener("embeddings_out",(i,n)=>{i=Td(i),this.embeddings=function(s){return{embeddings:wt(s,jd,1).map(a=>{var l,u;const c={headIndex:Oe(a,3)??0??-1,headName:Re(a,4)??""??""};if(ta(a,ec,On(a,1))!==void 0)a=zt(a=F(a,ec,On(a,1)),1,Tt,Vt()),c.floatEmbedding=a.slice();else{const h=new Uint8Array(0);c.quantizedEmbedding=((u=(l=F(a,Ed,On(a,2)))==null?void 0:l.ma())==null?void 0:u.h())??h}return c}),timestampMs:Sn(lr(s,2))??0}}(i),x(this,n)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Le.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Cc(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Cc(Ac(e.quantizedEmbedding),Ac(t.quantizedEmbedding))}return e},Le.prototype.embedForVideo=Le.prototype.ya,Le.prototype.embed=Le.prototype.xa,Le.prototype.setOptions=Le.prototype.o,Le.createFromModelPath=function(e,t){return I(Le,e,{baseOptions:{modelAssetPath:t}})},Le.createFromModelBuffer=function(e,t){return I(Le,e,{baseOptions:{modelAssetBuffer:t}})},Le.createFromOptions=function(e,t){return I(Le,e,t)};var Rs=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};function ol(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function al(e){try{const t=new Rs(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Ri(e)}}Rs.prototype.close=Rs.prototype.close;var ve=class extends be{constructor(e,t){super(new Be(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new ys,this.v=new vc,j(this.h,0,3,this.v),j(e=this.h,0,1,t=new H)}get baseOptions(){return F(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?V(this.h,2,ar(e.displayNamesLocale)):"displayNamesLocale"in e&&V(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}J(){(function(e){var r,i;const t=wt(e.ca(),pe,1).filter(n=>(Re(n,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(e.s=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(((i=(r=F(t[0],Ae,7))==null?void 0:r.l())==null?void 0:i.g())??new Map).forEach((n,s)=>{e.s[Number(s)]=Re(n,1)??""})})(this)}segment(e,t,r){const i=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,ol(this),Ue(this,e,i),al(this)}Ia(e,t,r,i){const n=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:i,ol(this),nt(this,e,n,t),al(this)}Ba(){return this.s}m(){var e=new ye;W(e,"image_in"),W(e,"norm_rect");const t=new Ae;Ye(t,Ec,this.h);const r=new pe;Ce(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),r.o(t),Ne(e,r),Oi(this,e),this.outputConfidenceMasks&&(P(e,"confidence_masks"),M(r,"CONFIDENCE_MASKS:confidence_masks"),vr(this,"confidence_masks"),this.g.ba("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Er(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(P(e,"category_mask"),M(r,"CATEGORY_MASK:category_mask"),vr(this,"category_mask"),this.g.V("category_mask",(i,n)=>{this.categoryMask=Er(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),P(e,"quality_scores"),M(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,x(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ve.prototype.getLabels=ve.prototype.Ba,ve.prototype.segmentForVideo=ve.prototype.Ia,ve.prototype.segment=ve.prototype.segment,ve.prototype.setOptions=ve.prototype.o,ve.createFromModelPath=function(e,t){return I(ve,e,{baseOptions:{modelAssetPath:t}})},ve.createFromModelBuffer=function(e,t){return I(ve,e,{baseOptions:{modelAssetBuffer:t}})},ve.createFromOptions=function(e,t){return I(ve,e,t)};var Bs=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};Bs.prototype.close=Bs.prototype.close;var $d=class extends y{constructor(e){super(e)}},jr=[0,J,-2],Hi=[0,pt,-3,$,pt,-1],cl=[0,Hi],ll=[0,Hi,J,-1],Us=class extends y{constructor(e){super(e)}},ul=[0,pt,-1,$],Hd=class extends y{constructor(e){super(e)}},dl=class extends y{constructor(e){super(e)}},Gs=[1,2,3,4,5,6,7,8,9,10,14,15],hl=class extends y{constructor(e){super(e)}};hl.prototype.g=Ni([0,oe,[0,Gs,R,Hi,R,[0,Hi,jr],R,cl,R,[0,cl,jr],R,ul,R,[0,pt,-3,$,Se],R,[0,pt,-3,$],R,[0,O,pt,-2,$,J,$,-1,2,pt,jr],R,ll,R,[0,ll,jr],pt,jr,O,R,[0,pt,-3,$,jr,-1],R,[0,oe,ul]],O,[0,O,J,-1,$]]);var ot=class extends be{constructor(e,t){super(new Be(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new ys,this.s=new vc,j(this.h,0,3,this.s),j(e=this.h,0,1,t=new H)}get baseOptions(){return F(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,i){const n=typeof r!="function"?r:{};this.j=typeof r=="function"?r:i,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.B+1,i=new hl;const s=new dl;var a=new $d;if(tt(a,1,255),j(s,0,12,a),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var c=new Us;Ur(c,3,!0),b(c,1,t.keypoint.x),b(c,2,t.keypoint.y),Br(s,5,Gs,c)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(c of(a=new Hd,t.scribble))Ur(t=new Us,3,!0),b(t,1,c.x),b(t,2,c.y),pi(a,1,Us,t);Br(s,15,Gs,a)}pi(i,1,dl,s),this.g.addProtoToStream(i.g(),"drishti.RenderData","roi_in",r),Ue(this,e,n);e:{try{const u=new Bs(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var l=u;break e}this.j(u)}finally{Ri(this)}l=void 0}return l}m(){var e=new ye;W(e,"image_in"),W(e,"roi_in"),W(e,"norm_rect_in");const t=new Ae;Ye(t,Ec,this.h);const r=new pe;Ce(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),z(r,"IMAGE:image_in"),z(r,"ROI:roi_in"),z(r,"NORM_RECT:norm_rect_in"),r.o(t),Ne(e,r),Oi(this,e),this.outputConfidenceMasks&&(P(e,"confidence_masks"),M(r,"CONFIDENCE_MASKS:confidence_masks"),vr(this,"confidence_masks"),this.g.ba("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Er(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(P(e,"category_mask"),M(r,"CATEGORY_MASK:category_mask"),vr(this,"category_mask"),this.g.V("category_mask",(i,n)=>{this.categoryMask=Er(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),P(e,"quality_scores"),M(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,x(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ot.prototype.segment=ot.prototype.segment,ot.prototype.setOptions=ot.prototype.o,ot.createFromModelPath=function(e,t){return I(ot,e,{baseOptions:{modelAssetPath:t}})},ot.createFromModelBuffer=function(e,t){return I(ot,e,{baseOptions:{modelAssetBuffer:t}})},ot.createFromOptions=function(e,t){return I(ot,e,t)};var ze=class extends be{constructor(e,t){super(new Be(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},j(e=this.h=new jc,0,1,t=new H)}get baseOptions(){return F(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?V(this.h,2,ar(e.displayNamesLocale)):"displayNamesLocale"in e&&V(this.h,2),e.maxResults!==void 0?tt(this.h,3,e.maxResults):"maxResults"in e&&V(this.h,3),e.scoreThreshold!==void 0?b(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&V(this.h,4),e.categoryAllowlist!==void 0?xi(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&V(this.h,5),e.categoryDenylist!==void 0?xi(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&V(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},Ue(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},nt(this,e,r,t),this.j}m(){var e=new ye;W(e,"input_frame_gpu"),W(e,"norm_rect"),P(e,"detections");const t=new Ae;Ye(t,Bd,this.h);const r=new pe;Ce(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),z(r,"IMAGE:input_frame_gpu"),z(r,"NORM_RECT:norm_rect"),M(r,"DETECTIONS:detections"),r.o(t),Ne(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Xa(s),this.j.detections.push(Sc(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ze.prototype.detectForVideo=ze.prototype.F,ze.prototype.detect=ze.prototype.D,ze.prototype.setOptions=ze.prototype.o,ze.createFromModelPath=async function(e,t){return I(ze,e,{baseOptions:{modelAssetPath:t}})},ze.createFromModelBuffer=function(e,t){return I(ze,e,{baseOptions:{modelAssetBuffer:t}})},ze.createFromOptions=function(e,t){return I(ze,e,t)};var Vs=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){var e;(e=this.segmentationMasks)==null||e.forEach(t=>{t.close()})}};function fl(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function wl(e){try{const t=new Vs(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{Ri(e)}}Vs.prototype.close=Vs.prototype.close;var Fe=class extends be{constructor(e,t){super(new Be(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,j(e=this.h=new Tc,0,1,t=new H),this.v=new pc,j(this.h,0,3,this.v),this.j=new gc,j(this.h,0,2,this.j),tt(this.j,4,1),b(this.j,2,.5),b(this.v,2,.5),b(this.h,4,.5)}get baseOptions(){return F(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"numPoses"in e&&tt(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&b(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&b(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&b(this.v,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}D(e,t,r){const i=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:r,fl(this),Ue(this,e,i),wl(this)}F(e,t,r,i){const n=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:i,fl(this),nt(this,e,n,t),wl(this)}m(){var e=new ye;W(e,"image_in"),W(e,"norm_rect"),P(e,"normalized_landmarks"),P(e,"world_landmarks"),P(e,"segmentation_masks");const t=new Ae;Ye(t,Ud,this.h);const r=new pe;Ce(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),M(r,"NORM_LANDMARKS:normalized_landmarks"),M(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Ne(e,r),Oi(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(i,n)=>{this.landmarks=[];for(const s of i)i=Wr(s),this.landmarks.push(Pi(i));x(this,n)}),this.g.attachEmptyPacketListener("normalized_landmarks",i=>{this.landmarks=[],x(this,i)}),this.g.attachProtoVectorListener("world_landmarks",(i,n)=>{this.worldLandmarks=[];for(const s of i)i=yr(s),this.worldLandmarks.push($r(i));x(this,n)}),this.g.attachEmptyPacketListener("world_landmarks",i=>{this.worldLandmarks=[],x(this,i)}),this.outputSegmentationMasks&&(M(r,"SEGMENTATION_MASK:segmentation_masks"),vr(this,"segmentation_masks"),this.g.ba("segmentation_masks",(i,n)=>{this.segmentationMasks=i.map(s=>Er(this,s,!0,!this.s)),x(this,n)}),this.g.attachEmptyPacketListener("segmentation_masks",i=>{this.segmentationMasks=[],x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Fe.prototype.detectForVideo=Fe.prototype.F,Fe.prototype.detect=Fe.prototype.D,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return I(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return I(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return I(Fe,e,t)},Fe.POSE_CONNECTIONS=il;const qi="https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task",qd="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm",Yd=()=>{const e=d.useRef(null),[t,r]=d.useState(!1),[i,n]=d.useState("Initializing..."),[s,a]=d.useState(0),[c,l]=d.useState(!1);d.useEffect(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(w=>{console.log("ServiceWorker registered:",w)}).catch(w=>{console.log("ServiceWorker registration failed:",w)})},[]);const u=async()=>"caches"in window?await(await caches.open("mediapipe-models-v1")).match(qi)!==void 0:!1,h=async()=>{try{const w=await fetch(qi),m=w.headers.get("content-length"),p=m?parseInt(m,10):0;if(!w.body)throw new Error("No response body");const E=w.body.getReader();let v=0;const g=[];for(;;){const{done:T,value:S}=await E.read();if(T)break;if(g.push(S),v+=S.length,p){const A=Math.round(v/p*100);a(A),n(`Downloading model... ${A}%`)}}return"caches"in window&&await(await caches.open("mediapipe-models-v1")).put(qi,new Response(new Blob(g),{headers:{"Content-Type":"application/octet-stream"}})),!0}catch(w){return console.error("Failed to preload model:",w),!1}};return d.useEffect(()=>{(async()=>{try{n("Checking cached models..."),await u()?n("Using cached model..."):(n("Model not cached. Downloading..."),await h()),n("Loading MediaPipe WASM...");const p=await Ht.forVisionTasks(qd);n("Creating face landmarker...");const E=await K.createFromOptions(p,{baseOptions:{modelAssetPath:qi,delegate:"GPU"},runningMode:"VIDEO",outputFaceBlendshapes:!0,numFaces:2});e.current=E,r(!0),n("Model loaded successfully ✅")}catch(m){console.error("Model init error:",m),n(`Error: ${m==null?void 0:m.message}`),(m==null?void 0:m.name)==="NotAllowedError"&&l(!0)}})()},[]),{faceLandmarkerRef:e,isModelLoaded:t,statusMessage:i,setStatusMessage:n,loadingProgress:s,permissionDenied:c,clearCache:async()=>{"caches"in window&&(await caches.delete("mediapipe-models-v1"),n("Cache cleared. Please refresh to re-download models."))}}},Kd=()=>{const[e,t]=d.useState(0),r=d.useRef({lastTime:0,frames:0,fps:0}),i=d.useCallback(()=>{const n=performance.now(),s=r.current;if(s.frames++,n-s.lastTime>=1e3){const a=Math.round(s.frames*1e3/(n-s.lastTime));t(a),s.frames=0,s.lastTime=n}},[]);return{fps:e,updateFPS:i}},Xd=()=>{const e=d.useRef({value:100,isLookingAway:!1}),t=d.useCallback((s,a,c,l)=>{if(!s||!c||!a)return;const u=s.getContext("2d");if(!u)return;const{width:h,height:f}=s;if(u.clearRect(0,0,h,f),u.drawImage(a,0,0,h,f),l){u.fillStyle="#00FF00";for(const w of c)u.fillRect(w.x*h-.5,w.y*f-.5,1,1)}},[]),r=d.useCallback(s=>{const a=e.current.value/100,c=100,l=20,u=10,h=10;s.fillStyle="rgba(0, 0, 0, 0.3)",s.fillRect(u,h,l,c),s.fillStyle=`rgba(${Math.floor(255*(1-a))}, ${Math.floor(255*a)}, 0, 0.8)`;const f=c*a;s.fillRect(u,h+c-f,l,f),s.fillStyle="#FFFFFF",s.fillRect(u,h+c*(1-a),l,2)},[]),i=d.useCallback((s,a,c,l,u,h,f)=>{if(t(s,a,c,l),u&&h&&f){const w=s.getContext("2d");w&&r(w)}},[t,r]),n=d.useCallback((s,a)=>{const c=s.getContext("2d");c&&(c.clearRect(0,0,s.width,s.height),c.drawImage(a,0,0,s.width,s.height))},[]);return{drawLandmarks:t,drawEngagementBar:r,drawWithEngagementBar:i,clearCanvas:n,engagementRef:e}},Jd=80,Qd=()=>{const[e,t]=d.useState(100),[r,i]=d.useState(!1),n=d.useRef(0),s=d.useCallback((a,c,l)=>{if(!l||a.length<468)return;const u=a[33],h=a[263],f=a[1];if(!u||!h||!f)return;const w=(u.x+h.x)*.5,m=(u.y+h.y)*.5,p=w-c.x,E=m-c.y,v=Math.sqrt(p*p+E*E),g=Math.abs(f.y-c.noseY)*100,T=Math.abs(f.x-c.noseX)*100,S=Math.max(0,100-(v*200+g+T)),A=S<Jd,U=performance.now();return U-n.current>100&&(t(S),i(A),n.current=U),{engagement:S,isLookingAway:A}},[]);return{engagement:e,isLookingAway:r,analyzeGaze:s,setEngagement:t,setIsLookingAway:i}},Zd=.05,eh=()=>{const[e,t]=d.useState(!1),[r,i]=d.useState(!1),n=d.useCallback((c,l)=>Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2)),[]),s=d.useCallback((c,l)=>{if(!c||!l)return 0;const u=[1,33,263,61,291,10,152];let h=0,f=0;const w=l[33],m=l[263],p=c[33],E=c[263];if(!w||!m||!p||!E)return 0;const v=n(w,m),g=n(p,E);if(v===0||g===0)return 0;for(const S of u){const A=l[S],U=c[S];if(A&&U){const N=w.x+(U.x-p.x)*v/g,G=w.y+(U.y-p.y)*v/g;h+=n(A,{x:N,y:G}),f++}}return f===0?0:h/f},[n]),a=d.useCallback((c,l,u,h)=>{if(!c.faceLandmarks||c.faceLandmarks.length===0)return l?(h("Reference face not detected."),i(!0),t(!1)):i(!1),null;if(l&&u){let f=null,w=0;for(const m of c.faceLandmarks)s(m,u)<Zd&&(f=m,w++);return w===1?(t(!1),i(!1),h("Reference face tracked."),f):w>1?(t(!0),i(!1),h("Multiple matching faces detected. Tracking suspended."),null):(t(!1),i(!0),h("Reference face not detected."),null)}else{c.faceLandmarks.length>1?(t(!0),h("Multiple faces detected. Set reference for single face tracking.")):(t(!1),h("No reference set. Detecting first face."));const f=c.faceLandmarks[0];return!f||f.length<468?null:f}},[s]);return{multipleFacesDetected:e,referenceFaceNotDetected:r,analyzeFace:a,setMultipleFacesDetected:t,setReferenceFaceNotDetected:i}},th=1e3,rh=(e,t)=>{const[r,i]=d.useState(!1),[n,s]=d.useState("face_detected"),{incrementGazeViolation:a}=Xs(),{multipleFacesDetected:c,referenceFaceNotDetected:l,isLookingAway:u}=e;d.useEffect(()=>{let w;return(u||c||l)&&t?w=setTimeout(()=>{i(!0),u?(s("looking_away"),a("looking_away")):c?(s("multiple_faces"),a("multiple_faces")):l&&(s("no_face_detected"),a("no_face_detected"))},th):(i(!1),s("face_detected")),()=>{clearTimeout(w)}},[u,c,l,t,a]);const h=d.useCallback(()=>c?"multiple_faces":l?"no_face_detected":u?"looking_away":"face_detected",[c,l,u]),f=d.useCallback(()=>{i(!1),s("face_detected")},[]);return{showGazeWarningModal:r,faceDetectionState:n,getWarningType:h,closeWarningModal:f,setShowGazeWarningModal:i,setFaceDetectionState:s}},ih=(e,t,r,i)=>{const n=d.useRef(null);return d.useEffect(()=>{if(!t)return;const s=async()=>{try{const l=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"}});e.current&&(e.current.srcObject=l,e.current.onloadeddata=()=>{r()})}catch(l){console.error("Camera access error:",l),i("Camera access failed")}},a=n.current,c=e.current;return s(),()=>{a&&cancelAnimationFrame(a),c!=null&&c.srcObject&&c.srcObject.getTracks().forEach(u=>u.stop())}},[t,r]),d.useEffect(()=>{const s=Zt.getRecordingStream();if(s&&e.current){e.current.srcObject=s;const a=s.getVideoTracks(),c=s.getAudioTracks(),l=()=>{console.log("Media track ended - permission may have been revoked")};[...a,...c].forEach(u=>{u.addEventListener("ended",l)})}},[]),{animationFrameRef:n}},nh=(e,t,r,i,n,s,a,c,l,u,h,f,w,m,p)=>{const E=d.useRef(null),v=d.useCallback(()=>{var A;const g=e.current,T=t.current,S=r.current;if(!g||g.readyState<2||!S||!T){E.current=requestAnimationFrame(v);return}i();try{const U=performance.now(),N=S.detectForVideo(g,U);if(((A=N.faceLandmarks)==null?void 0:A.length)>0){p(!1);const G=n(N,l,u.current,m);G?(s(T,g,G,h,f,w,l),l&&w&&c(G,u.current,w)):a(T,g)}else a(T,g),l?(p(!0),m("Reference face not detected.")):p(!1)}catch(U){console.error("Face detection error:",U)}E.current=requestAnimationFrame(v)},[e,t,r,i,n,s,a,c,l,u,h,f,w,m,p]);return{renderLoop:v,animationFrameRef:E}},sh=(e,t,r,i)=>{const{referenceSet:n,referenceRef:s,setReferenceData:a}=Xs(),c=d.useRef(s),l=d.useCallback(()=>{c.current=s},[s]),u=d.useCallback(()=>{var w;const h=e.current,f=t.current;if(!(!h||!f))try{const m=performance.now(),p=h.detectForVideo(f,m);if((w=p.faceLandmarks)!=null&&w[0]){const E=p.faceLandmarks[0],v=E[33],g=E[263],T=E[1];v&&g&&T&&(c.current={x:(v.x+g.x)*.5,y:(v.y+g.y)*.5,noseX:T.x,noseY:T.y},a(!0,c.current),r("Reference set. Gaze tracking active."))}}catch(m){console.error("Set reference error:",m),r("Failed to set reference")}},[e,t,r,a,i]);return{referenceSet:n,referenceRef:c,setReference:u,syncReference:l}},oh=d.forwardRef(({className:e="",interviewId:t="",interview_duration:r},i)=>{var xl;const{authToken:n}=Zs(),s=n?Dl(n):null,a=ao(),{proctoring:c}=rn(),l=!!(c!=null&&c.gazeAnalysisEnabled),[u,h]=d.useState(!1),[f,w]=d.useState((c==null?void 0:c.showLandmarks)??!1),[m,p]=d.useState((c==null?void 0:c.showEngagementBar)??!0),[E,v]=d.useState(l),g=d.useRef(null),T=d.useRef(null),S=d.useRef(null),A=d.useCallback(async lt=>{var Xi;const Xt=g.current,vt=S.current;if(!Xt||!vt)return;const ut=vt.getContext("2d");if(!ut)return;vt.width=Xt.videoWidth,vt.height=Xt.videoHeight,ut.save(),ut.scale(-1,1),ut.drawImage(Xt,-vt.width,0,vt.width,vt.height),ut.restore();const Xr=await new Promise(Jt=>vt.toBlob(Jt,"image/jpeg"));if(Xr&&t)try{const Jt=`${lt}-${Date.now()}.jpeg`,Pe=await a.requestScreenshotUploadUrl(t,Jt);Pe.success&&Pe.data.upload_url&&await a.uploadScreenshot((Xi=Pe==null?void 0:Pe.data)==null?void 0:Xi.upload_url,Xr)}catch(Jt){console.error(`Failed to upload screenshot for ${lt}:`,Jt)}},[a,t]),{faceLandmarkerRef:U,isModelLoaded:N,statusMessage:G,setStatusMessage:L,loadingProgress:re,permissionDenied:We,clearCache:ke}=Yd(),{fps:$e,updateFPS:_e}=Kd(),{drawWithEngagementBar:Ee,clearCanvas:bt,engagementRef:we}=Xd(),{engagement:Qe,isLookingAway:le,analyzeGaze:at,setEngagement:Q,setIsLookingAway:C}=Qd(),{multipleFacesDetected:ue,referenceFaceNotDetected:ct,analyzeFace:qt,setMultipleFacesDetected:Ft,setReferenceFaceNotDetected:Yt}=eh(),{referenceSet:Tr,referenceRef:Kt,setReference:Pt,syncReference:Yr}=sh(U,g,L,void 0),Ki={multipleFacesDetected:ue,referenceFaceNotDetected:ct,isLookingAway:le},{showGazeWarningModal:Kr,getWarningType:D,closeWarningModal:He,setShowGazeWarningModal:Dt,setFaceDetectionState:pl}=rh(Ki,l),{renderLoop:kh}=nh(g,T,U,_e,qt,Ee,bt,at,Tr,Kt,f,m,l,L,Yt);ih(g,N,kh,L),d.useEffect(()=>{Yr()},[Yr]),d.useEffect(()=>{we&&we.current&&(we.current.value=Qe,we.current.isLookingAway=le)},[Qe,le,we]);const _h=d.useCallback(lt=>{v(lt),lt||(Q(100),C(!1))},[Q,C]),Eh=d.useCallback(()=>{C(!1),Ft(!1),Yt(!1),pl("face_detected"),Dt(!1),He()},[C,Ft,Yt,pl,Dt,He]),jh={engagement:Qe,fps:$e,isLookingAway:le,multipleFacesDetected:ue,referenceFaceNotDetected:ct};return d.useEffect(()=>{let lt=null;const Xt=[];return(async()=>{try{lt=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),g.current&&(g.current.srcObject=lt);const Xr=(r??Ys)*60*1e3/3,Xi=[0,1,2].map((Pe,Ot)=>({label:`capture-${Ot+1}`,start:Ot*Xr,end:(Ot+1)*Xr})),Jt=(Pe,Ot)=>Pe===Ot?Pe:Math.random()*(Ot-Pe)+Pe;Xi.forEach(({label:Pe,start:Ot,end:Th},Sh)=>{let Ws;Sh===0?Ws=3e3:Ws=Jt(Ot,Th),Xt.push(setTimeout(()=>{A(Pe)},Ws))})}catch(ut){console.error("Error accessing camera:",ut)}})(),()=>{lt&<.getTracks().forEach(ut=>ut.stop()),Xt.forEach(clearTimeout)}},[A,r]),d.useImperativeHandle(i,()=>({setReference:()=>{Pt()}}),[Pt]),o.jsxs("div",{className:`iw-relative ${e}`,children:[We?o.jsxs("div",{className:"iw-rounded-md iw-border iw-border-red-600 iw-p-5 iw-text-red-600",children:[o.jsx("h2",{children:"Camera Permission Denied"}),o.jsx("p",{children:"Please allow camera access to use this application."})]}):o.jsx("div",{className:"iw-flex iw-w-full iw-flex-wrap iw-gap-5",children:o.jsxs("div",{className:"iw-relative iw-flex-1",children:[o.jsx("video",{ref:g,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-r-xl iw-min-h-[200px] iw-max-h-[600px] iw-aspect-video",style:{transform:"scaleX(-1)"}}),l&&o.jsx("canvas",{ref:T,width:420,height:240,className:"iw-absolute iw-top-0 iw-left-0 iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-r-xl iw-min-h-[200px] iw-max-h-[600px] iw-aspect-video",style:{transform:"scaleX(-1)"}}),o.jsx("canvas",{ref:S,style:{display:"none"}}),o.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:[o.jsx("div",{className:"iw-size-2 iw-animate-pulse iw-rounded-full iw-bg-red-500"}),o.jsx("span",{className:"iw-font-medium iw-text-white",children:"Recording"})]}),((xl=s==null?void 0:s.data)==null?void 0:xl.user_name)&&o.jsx("div",{className:"iw-absolute iw-z-50 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:o.jsx("span",{className:"iw-font-medium iw-text-white",children:s.data.user_name})}),o.jsx("div",{className:"iw-absolute iw-bottom-4 iw-right-4",children:o.jsx(bu,{showControls:(c==null?void 0:c.showControls)??!1,isBubbleOpen:u,setIsBubbleOpen:h,setReference:Pt,clearCache:ke,isModelLoaded:N,gazeAnalysisEnabled:E&&l,referenceSet:Tr,showLandmarks:f,setShowLandmarks:w,showEngagementBar:m,setShowEngagementBar:p,handleToggleGazeAnalysis:_h,stats:jh,statusMessage:G,loadingProgress:re})})]})}),l&&Kr&&o.jsx(xu,{isOpen:Kr,onClose:Eh,warningType:D()})]})}),ah=({question:e,isLoading:t=!1})=>{const{baseColor:r}=Cr();return o.jsx("div",{className:"iw-rounded-xl iw-mb-4 message-animation iw-text-gray-800 iw-p-6 ",style:Fl(r,.85),children:o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-8",children:[o.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:o.jsx("div",{className:"iw-mt-2",children:o.jsx("img",{src:"https://duf9q5sx7u.ufs.sh/f/va7H6eSeKAux755zByRN5Nq9LZurgIoJGYX6c0CEdRSDm8y2",alt:"brand_logo",className:"iw-h-28 iw-w-28"})})}),t?o.jsxs("div",{className:"iw-animate-pulse iw-w-full iw-space-y-3 iw-mr-10",children:[o.jsx("div",{className:"iw-h-5 iw-bg-gray-200 iw-rounded iw-w-full"}),o.jsx("div",{className:"iw-h-5 iw-bg-gray-200 iw-rounded iw-w-3/4"})]}):o.jsx("p",{className:"iw-text-lg iw-leading-8",children:e==null?void 0:e.question})]})})},ml=({currentQuestion:e,phase:t,className:r="",children:i,interviewId:n="",interview_duration:s=Ys,videoFeedRef:a})=>o.jsxs("div",{className:`iw-p-4 iw-space-y-4 iw-pb-6 ${r} iw-min-h-[calc(100vh_-_3.8rem)] iw-flex iw-flex-col iw-justify-between`,children:[o.jsx("div",{className:"iw-flex iw-items-start iw-justify-between iw-gap-3",children:o.jsx("div",{className:"iw-flex-1",children:o.jsx(ah,{question:e,isLoading:t===de.FETCHING_QUESTION||t===de.IDLE})})}),o.jsxs("div",{className:"iw iw-bg-[#F6F6F6] iw-grid iw-grid-cols-2 iw-rounded-[14px] iw-p-6",children:[o.jsx("div",{className:"iw-min-h-[400px] iw-max-h-[600px]",children:o.jsx(oh,{ref:a,interviewId:n,interview_duration:s})}),o.jsx("div",{className:"iw-bg-white iw-rounded-r-xl iw-shadow iw-p-6",children:i})]})]}),ch=({confirmExitInterview:e,isOpen:t,onClose:r})=>o.jsx(Zr,{isOpen:t,onClose:r,title:"Exit Interview",closeOnOverlayClick:!1,children:o.jsxs("div",{className:"iw-space-y-5",children:[o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3 iw-rounded-xl iw-p-2",children:[o.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-flex-none iw-items-center iw-justify-center iw-rounded-full iw-bg-rose-100 iw-text-rose-600",children:"!"}),o.jsxs("div",{className:"iw-space-y-2",children:[o.jsx("p",{className:"iw-text-sm iw-font-semibold iw-text-rose-600",children:"Leaving now will end your interview !"}),o.jsx("p",{className:"iw-text-sm iw-text-slate-500",children:"Are you sure you want to exit? All progress will be lost and you will not be able to resume."})]})]}),o.jsxs("div",{className:"iw-flex iw-flex-col-reverse iw-gap-2 sm:iw-flex-row sm:iw-items-center sm:iw-justify-end iw-pb-1",children:[o.jsx("button",{className:"iw-inline-flex iw-items-center iw-justify-center iw-rounded-lg iw-border iw-border-slate-200 iw-bg-white iw-px-4 iw-py-2 iw-text-sm iw-font-medium iw-text-slate-600 iw-shadow-sm iw-transition hover:iw-bg-slate-50",onClick:r,children:"Stay in interview"}),o.jsx("button",{className:"iw-inline-flex iw-items-center iw-justify-center iw-rounded-lg iw-px-4 iw-py-2 iw-text-sm iw-font-semibold iw-text-white iw-transition hover:iw-brightness-110",style:{background:"linear-gradient(to right, rgba(244, 63, 94, 0.8), rgba(225, 29, 72, 0.8))",boxShadow:"0 12px 30px -16px rgba(244, 63, 94, 0.65)"},onClick:e,children:"Confirm exit"})]})]})}),gl=({title:e,onExit:t})=>{const{baseColor:r}=Cr(),[i,n]=d.useState(!1);return o.jsxs("header",{className:"iw-w-full iw-text-gray-900",children:[o.jsxs("div",{className:"iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-pb-4 iw-pt-2",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-space-x-2",children:[o.jsx("div",{className:"iw-h-7 iw-w-7 iw-rounded-md iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold",style:{backgroundColor:r},children:"N"}),o.jsx("p",{className:"iw-text-sm iw-font-medium",children:"Novara"})]}),o.jsx("h1",{className:"iw-text-base iw-font-bold",children:e}),o.jsx("button",{className:"iw-text-sm iw-text-white iw-px-4 iw-py-2 iw-rounded-md",style:{background:"linear-gradient(to right, rgba(244, 63, 94, 0.8), rgba(225, 29, 72, 0.8))"},onClick:()=>n(!0),children:"Exit Interview"})]}),o.jsx("div",{className:"iw-h-px iw-bg-gray-200"}),o.jsx(ch,{isOpen:i,confirmExitInterview:()=>{t(),n(!1)},onClose:()=>n(!1)})]})},lh=({className:e="",width:t,height:r=56,barWidth:i=3,gap:n=2,fftSize:s=1024,smoothingTimeConstant:a=.8,mediaStream:c,startOnMount:l=!0})=>{const{baseColor:u}=Cr(),h=d.useRef(null),f=d.useRef(null),w=d.useRef(null),m=d.useRef(null),p=d.useRef(null),E=d.useRef(null),v=d.useRef(!1),[g,T]=d.useState(null);d.useEffect(()=>{if(t||!f.current)return;const A=f.current,U=()=>{const G=h.current;if(!G)return;const L=A.clientWidth,re=r;G.width=Math.max(1,Math.floor(L*window.devicePixelRatio||1)),G.height=Math.max(1,Math.floor(re*window.devicePixelRatio||1))},N=new ResizeObserver(U);return N.observe(A),U(),()=>N.disconnect()},[t,r]),d.useEffect(()=>{if(!t)return;const A=h.current;A&&(A.width=Math.max(1,Math.floor(t*(window.devicePixelRatio||1))),A.height=Math.max(1,Math.floor(r*(window.devicePixelRatio||1))))},[t,r]),d.useEffect(()=>{let A=!1;return(async()=>{try{const N=new(window.AudioContext||window.webkitAudioContext);w.current=N;let G=c;if(!G){if(!l)return;G=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1}),v.current=!0}if(A)return;const L=N.createAnalyser();L.fftSize=s,L.smoothingTimeConstant=a,m.current=L;const re=N.createMediaStreamSource(G);p.current=re,re.connect(L),S()}catch(N){T((N==null?void 0:N.message)||"Failed to initialize microphone")}})(),()=>{var N,G,L,re;A=!0,E.current&&cancelAnimationFrame(E.current);try{(N=p.current)==null||N.disconnect()}catch{}try{(G=m.current)==null||G.disconnect()}catch{}v.current&&((re=((L=p.current)==null?void 0:L.mediaStream)||void 0)==null||re.getTracks().forEach(We=>We.stop())),w.current&&w.current.state!=="closed"&&w.current.close()}},[c,s,a,l]);const S=()=>{const A=h.current,U=m.current;if(!A||!U)return;const N=A.getContext("2d");if(!N)return;const G=window.devicePixelRatio||1,L=A.width,re=A.height,We=U.frequencyBinCount,ke=new Uint8Array(We),$e=()=>{E.current=requestAnimationFrame($e),U.getByteTimeDomainData(ke),N.clearRect(0,0,L,re),N.fillStyle="rgba(0,0,0,0)",N.fillRect(0,0,L,re);const _e=Math.max(1,Math.floor(i*G)),Ee=Math.max(1,Math.floor(n*G)),bt=_e+Ee,we=Math.max(8,Math.floor((L+Ee)/bt)),Qe=Math.floor(ke.length/we);for(let le=0;le<we;le++){const at=Math.min(ke.length-1,le*Qe),Q=ke[at]/128-1,C=Math.abs(Q),ue=Math.pow(C,.6),ct=Math.max(re*.06,ue*(re*.9)),qt=le*bt,Ft=(re-ct)/2,Yt=140-Math.min(140,140*C),Tr=85,Kt=48+Math.floor(12*(1-C));N.fillStyle=`${u}`,N.shadowColor=`hsla(${Yt}, ${Tr}%, ${Kt}%, ${.25*C})`,N.shadowBlur=8*C;const Pt=Math.min(_e/2,ct/2);uh(N,qt,Ft,_e,ct,Pt),N.fill()}};$e()};return o.jsxs("div",{ref:f,className:`iw-relative iw-w-full iw-overflow-hidden iw-rounded-md iw-bg-gray-50 ${e}`,style:{height:r},children:[o.jsx("canvas",{ref:h,className:"iw-w-full iw-h-full"}),g&&o.jsx("div",{className:"iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center",children:o.jsx("span",{className:"iw-text-xs iw-text-red-600 iw-bg-red-50 iw-border iw-border-red-200 iw-px-2 iw-py-1 iw-rounded",children:g})})]})};function uh(e,t,r,i,n,s){const a=Math.min(s,i/2,n/2);e.beginPath(),e.moveTo(t+a,r),e.lineTo(t+i-a,r),e.quadraticCurveTo(t+i,r,t+i,r+a),e.lineTo(t+i,r+n-a),e.quadraticCurveTo(t+i,r+n,t+i-a,r+n),e.lineTo(t+a,r+n),e.quadraticCurveTo(t,r+n,t,r+n-a),e.lineTo(t,r+a),e.quadraticCurveTo(t,r,t+a,r),e.closePath()}const dh=({state:e,answeringTime:t,nextPhase:r,sttError:i})=>o.jsxs("div",{className:"iw-flex iw-flex-col iw-justify-between iw-h-full ",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"You may start speaking now. We're listening...."}),o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-2",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-1",children:[o.jsx(sn,{className:"iw-size-4 iw-text-orange-600"}),o.jsx("p",{className:"iw-text-gray-700 iw-text-sm",children:"Time to talk: "})]}),o.jsx(on,{total:t,remaining:e.currentPhaseTimeRemaining,size:50,strokeWidth:4})]})]}),o.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."})]}),o.jsxs("div",{children:[o.jsx(lh,{}),i&&o.jsxs("div",{className:"iw-mt-2 iw-text-xs iw-text-red-600",children:["Recording error: ",i.message]})]}),o.jsx("div",{className:"iw-w-full iw-grid iw-grid-cols-1",children:o.jsx(qe,{onClick:()=>{r()},children:"Transcribe My Answer"})})]});function hh(){const[e,t]=d.useState(!0),r=d.useMemo(()=>[0,1,2].map(i=>({id:i})),[]);return d.useEffect(()=>{const i=setInterval(()=>{t(n=>!n)},1500);return()=>clearInterval(i)},[]),o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-8 iw-h-full",children:[o.jsx("div",{className:"iw-relative iw-w-80 iw-h-48 ","aria-hidden":!0,children:r.map((i,n)=>{const s=n*50,a=e?s:s+12,c=e?1:.08,l=n*140;return o.jsx("div",{role:"presentation",className:"iw-absolute iw-w-full iw-rounded-lg iw-p-4 iw-shadow-md iw-bg-gradient-to-b iw-from-gray-50 iw-to-gray-100 iw-overflow-hidden",style:{top:0,transform:`translateY(${a}px)`,opacity:c,transition:`transform 600ms cubic-bezier(.2,.9,.3,1) ${l}ms, opacity 400ms ease ${l}ms`},children:o.jsxs("div",{className:"iw-flex iw-gap-3 iw-items-center",children:[o.jsx("div",{className:"iw-w-10 iw-h-10 iw-bg-gray-300 iw-rounded iw-flex-shrink-0"}),o.jsxs("div",{className:"iw-flex-1 iw-space-y-2",children:[o.jsx("div",{className:"iw-h-2 iw-bg-gray-300 iw-rounded iw-w-24"}),o.jsx("div",{className:"iw-h-2 iw-bg-gray-300 iw-rounded iw-w-32"})]})]})},i.id)})}),o.jsx("div",{className:"iw-text-center",children:o.jsx("p",{className:"iw-text-gray-500 iw-font-medium",children:"Preparing your question..."})})]})}const fh=({size:e="192px",className:t,colors:r,animationDuration:i=20})=>{const s={...{bg:"oklch(95% 0.02 264.695)",c1:"oklch(75% 0.15 350)",c2:"oklch(80% 0.12 200)",c3:"oklch(78% 0.14 280)"},...r},a=parseInt(e.replace("px",""),10),c=a<50?Math.max(a*.008,1):Math.max(a*.015,4),l=a<50?Math.max(a*.004,1.2):Math.max(a*.008,1.5),u=a<50?Math.max(a*.004,.05):Math.max(a*.008,.1),h=a<50?Math.max(a*.004,.5):Math.max(a*.008,2),f=a<30?"0%":a<50?"5%":a<100?"15%":"25%",w=a<30?1.1:a<50?Math.max(l*1.2,1.3):l;return o.jsx("div",{className:`siri-orb ${t}`,style:{width:e,height:e,"--bg":s.bg,"--c1":s.c1,"--c2":s.c2,"--c3":s.c3,"--animation-duration":`${i}s`,"--blur-amount":`${c}px`,"--contrast-amount":w,"--dot-size":`${u}px`,"--shadow-spread":`${h}px`,"--mask-radius":f},children:o.jsx("style",{children:`
|
|
69
83
|
@property --angle {
|
|
70
84
|
syntax: "<angle>";
|
|
71
85
|
inherits: false;
|
|
@@ -170,4 +184,4 @@
|
|
|
170
184
|
animation: none;
|
|
171
185
|
}
|
|
172
186
|
}
|
|
173
|
-
`})})};function Ot({ttsError:i}){return 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:[e.jsx($t,{size:"80px"}),i&&e.jsxs("div",{className:"iw-mt-2 iw-text-xs iw-text-red-600",children:["Audio playback failed: ",i.message]}),e.jsx("p",{className:"iw-text- iw-text-gray-700",children:"Your AI interviewer is speaking..."})]})}const qt=({state:i,thinkingTime:r,nextPhase:t})=>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:[e.jsxs("div",{children:[e.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"Get Ready to Answer"}),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."})]}),e.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-2",children:[e.jsxs("div",{className:"iw-flex iw-items-center iw-gap-1",children:[e.jsx(me,{className:"iw-size-4 iw-text-orange-600"}),e.jsx("p",{className:"iw-text-gray-700 iw-text-sm",children:"Time to think: "})]}),e.jsx(fe,{total:r,remaining:i.currentPhaseTimeRemaining,size:50,strokeWidth:4})]}),e.jsx("div",{className:"iw-w-full iw-grid iw-grid-cols-1",children:e.jsx(G,{onClick:()=>{t()},children:"Start Answering"})})]}),Ut=({sttError:i})=>e.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full",children:[e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 60 60",fill:"none",children:[e.jsx("rect",{width:60,height:60,rx:30,fill:"url(#prefix__paint0_linear_1460_12482)"}),e.jsx("path",{d:"M28.127 14c.276 7.685 6.442 13.851 14.127 14.127-7.684.276-13.85 6.442-14.127 14.127-.275-7.685-6.442-13.851-14.126-14.127 7.684-.276 13.85-6.442 14.126-14.127zM38.937 31.873A7.331 7.331 0 0046 38.937 7.331 7.331 0 0038.937 46a7.331 7.331 0 00-7.064-7.063 7.331 7.331 0 007.064-7.064z",fill:"#fff"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"prefix__paint0_linear_1460_12482",x1:30,y1:-6.563,x2:77.813,y2:54.375,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:.211,stopColor:"#5C92FA"}),e.jsx("stop",{offset:1,stopColor:"#A75FFD"})]})})]}),e.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1 iw-mt-3",children:"Just a moment... We're analyzing your response"}),e.jsx("p",{className:"iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]",children:"After transcription, you'll have 45 sec to review your answer."}),i&&e.jsxs("div",{className:"iw-mt-2 iw-text-xs iw-text-red-600",children:["Transcription error: ",i.message,i.recoverable&&" (attempting to continue)"]})]}),re=i=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:[e.jsx("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),e.jsx("path",{d:"M12 9v4"}),e.jsx("path",{d:"M12 17h.01"})]}),Wt=i=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:[e.jsx("path",{d:"M12 6v6l4 2"}),e.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),Bt=i=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:[e.jsx("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),Gt=i=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}),e.jsx("path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}),e.jsx("path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}),e.jsx("path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"})]}),ge=i=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}),e.jsx("path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}),e.jsx("path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}),e.jsx("path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"})]}),Vt=i=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}),e.jsx("path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}),e.jsx("path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}),e.jsx("path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"})]}),se=5;function zt({isOpen:i,onClose:r,warningCount:t,violationType:s,onDisqualify:n}){const[l,a]=o.useState(10),c=o.useRef(r);if(o.useEffect(()=>{c.current=r},[r]),o.useEffect(()=>{if(!i)return;const f=setInterval(()=>{a(d=>d<=1?(c.current(),10):d-1)},1e3);return()=>clearInterval(f)},[i]),o.useEffect(()=>{i&&a(10)},[i]),o.useEffect(()=>(i?(document.body.style.overflow="hidden",document.body.classList.add("interview-widget-container")):(document.body.style.overflow="unset",document.body.classList.remove("interview-widget-container")),()=>{document.body.style.overflow="unset",document.body.classList.remove("interview-widget-container")}),[i]),!i)return null;const w=(()=>{switch(s){case"tab_switch":return{title:"Tab Switch Detected",description:"You attempted to switch to another tab or reload application.",icon:e.jsx(Bt,{className:"iw-h-5 iw-w-5"})};case"fullscreen_exit":return{title:"Full Screen Exit Detected",description:"You attempted to exit full screen mode.",icon:e.jsx(Pe,{className:"iw-h-5 iw-w-5"})};case"focus_loss":return{title:"Focus Loss Detected",description:"You lost focus from the interview window.",icon:e.jsx(Gt,{className:"iw-h-5 iw-w-5"})};case"blocked_shortcut":return{title:"Keyboard Shortcut Blocked",description:"You attempted to use a blocked keyboard shortcut.",icon:e.jsx(ge,{className:"iw-h-5 iw-w-5"})};case"right_click_attempt":return{title:"Right Click Attempted",description:"You attempted to use the right click.",icon:e.jsx(Vt,{className:"iw-h-5 iw-w-5"})};case"alt_tab_attempt":return{title:"Alt + Tab Attempted",description:"You attempted to use the Alt + Tab shortcut.",icon:e.jsx(ge,{className:"iw-h-5 iw-w-5"})};case"blocked_function_key":return{title:"Function Key Blocked",description:"You attempted to use a blocked function key.",icon:e.jsx(ge,{className:"iw-h-5 iw-w-5"})};default:return{title:"Violation Detected",description:"You attempted to perform an action that is not allowed.",icon:e.jsx(re,{className:"iw-h-5 iw-w-5"})}}})(),h=se-t,m=()=>{t+1>se?n():r()};return e.jsx("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-black/60 iw-p-4 iw-backdrop-blur-sm",children:e.jsxs("div",{className:"iw-w-full iw-max-w-md iw-rounded-2xl iw-border iw-border-gray-100 iw-bg-white iw-shadow-xl",children:[e.jsxs("div",{className:"iw-p-6 iw-pb-0",children:[e.jsxs("div",{className:"iw-mb-6 iw-flex iw-items-start iw-gap-4",children:[e.jsx("div",{className:"iw-flex iw-h-12 iw-w-12 iw-flex-shrink-0 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-red-50",children:e.jsx(re,{className:"iw-h-6 iw-w-6 iw-text-red-500"})}),e.jsxs("div",{className:"iw-flex-1",children:[e.jsx("h2",{className:"iw-mb-1 iw-text-xl iw-font-semibold iw-text-gray-900",children:"Security Violation"}),e.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[e.jsx("span",{className:"iw-text-sm iw-text-gray-500",children:"Warning"}),e.jsx("div",{className:"iw-flex iw-gap-1",children:Array.from({length:se}).map((f,d)=>e.jsx("div",{className:`iw-h-2 iw-w-2 iw-rounded-full ${d<=t-1?"iw-bg-red-500":"iw-bg-gray-200"}`},d))}),e.jsxs("span",{className:"iw-text-sm iw-text-gray-500",children:["(",t,"/",se,")"]})]})]})]}),e.jsx("div",{className:"iw-mb-5 iw-rounded-2xl iw-border iw-border-red-100 iw-p-5",style:{background:"linear-gradient(to right, rgb(254, 242, 242), rgb(254, 245, 235))",borderColor:"rgb(254, 226, 226)"},children:e.jsxs("div",{className:"iw-flex iw-items-start iw-gap-4",children:[e.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-items-center iw-justify-center iw-rounded-xl iw-bg-white iw-shadow-sm",children:w.icon}),e.jsxs("div",{className:"iw-flex-1",children:[e.jsx("h3",{className:"iw-mb-2 iw-font-semibold iw-text-gray-900",children:w.title}),e.jsx("p",{className:"iw-text-sm iw-leading-relaxed iw-text-gray-700",children:w.description}),e.jsxs("div",{className:"iw-mt-3 iw-flex iw-items-center iw-gap-2 iw-text-xs iw-text-red-600",children:[e.jsx(Re,{className:"iw-h-3 iw-w-3"}),e.jsx("span",{children:"This action is monitored for interview integrity"})]})]})]})}),e.jsxs("div",{className:"iw-mb-5 iw-grid iw-grid-cols-2 iw-gap-3",children:[e.jsx("div",{className:"iw-rounded-xl iw-border iw-border-amber-200 iw-bg-amber-50 iw-p-4",children:e.jsxs("div",{className:"iw-text-center",children:[e.jsx("div",{className:"iw-mb-1 iw-text-2xl iw-font-bold iw-text-amber-600",children:h}),e.jsx("div",{className:"iw-text-xs iw-font-medium iw-text-amber-700",children:"Warnings Left"})]})}),e.jsx("div",{className:"iw-border-primary-100 iw-bg-primary-50 iw-rounded-xl iw-border iw-p-4",children:e.jsxs("div",{className:"iw-text-center",children:[e.jsxs("div",{className:"iw-mb-1 iw-flex iw-items-center iw-justify-center iw-gap-1.5",children:[e.jsx(Wt,{className:"iw-text-primary-600 iw-h-4 iw-w-4"}),e.jsx("span",{className:"iw-text-primary-600 iw-text-2xl iw-font-bold",children:l})]}),e.jsx("div",{className:"iw-text-primary-700 iw-text-xs iw-font-medium",children:"Auto Close"})]})})]}),h===1&&e.jsx("div",{className:"iw-mb-5 iw-rounded-2xl iw-p-4 iw-text-white",style:{background:"linear-gradient(to right, rgba(220, 38, 38, 0.9), rgba(239, 68, 68, 0.9))"},children:e.jsxs("div",{className:"iw-flex iw-items-center iw-gap-3",children:[e.jsx("div",{className:"iw-flex iw-h-8 iw-w-8 iw-items-center iw-justify-center iw-rounded-full iw-bg-white/20",children:e.jsx(re,{className:"iw-h-4 iw-w-4"})}),e.jsxs("div",{children:[e.jsx("div",{className:"iw-text-sm iw-font-semibold",children:"Final Warning"}),e.jsx("div",{className:"iw-text-xs iw-text-red-100",children:"Next violation will disqualify you from this interview"})]})]})})]}),e.jsxs("div",{className:"iw-p-6 iw-pt-0",children:[e.jsx(G,{onClick:m,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",children:"I Understand - Continue Interview"}),e.jsx("p",{className:"iw-text-gray-500 iw-mt-3 iw-text-center iw-text-xs",children:"Please maintain focus and avoid switching tabs, exiting fullscreen, using shortcuts or right-clicking."})]})]})})}const Ht=i=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:[e.jsx("path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z"}),e.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),Yt=({showHardReloadWarning:i,onContinue:r})=>{const t=()=>{r()};return e.jsxs($e,{isOpen:i,onClose:t,closeOnOverlayClick:!1,closeOnEscape:!1,showCloseButton:!1,className:"iw-max-w-lg iw-px-2 iw-rounded-xl",children:[e.jsx("div",{className:"iw-absolute iw-inset-x-0 iw-top-0 iw-h-1 iw-bg-gradient-to-r iw-from-red-500 iw-to-red-600"}),e.jsx("div",{className:"iw-space-y-1 iw-pb-2 iw-pt-3",children:e.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[e.jsx(re,{className:"iw-w-5 iw-h-5 iw-text-red-500"}),e.jsx("h3",{className:"iw-text-xl iw-font-semibold iw-text-red-500",children:"Full Screen Exit Detected"})]})}),e.jsx("div",{className:"iw-pt-4 iw-pb-6",children:e.jsx("p",{className:"iw-text-center iw-text-sm iw-leading-relaxed iw-text-gray-500/90",children:"Exiting full screen mode or reloading this page during the session is strictly prohibited. Any attempt to do so will be recorded and may lead to penalties."})}),e.jsx("div",{className:"iw-pt-2 iw-pb-4",children:e.jsxs("button",{onClick:t,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",children:[e.jsx(Ht,{className:"iw-size-4"}),"Continue Session"]})})]})},Qt=o.forwardRef(({children:i,onDisqualify:r},t)=>{const[s,n]=o.useState(!1),[l,a]=o.useState(!1),[c,u]=o.useState(!1),[w,h]=o.useState("fullscreen_exit"),{logViolation:m,violationCount:f}=Ct({maxViolations:5,onViolation:g=>{l||(n(!0),h(g.type))}}),{enterFullScreen:d,isFullScreen:p,exitFullScreen:b}=mt({onFullScreenChange(g){!g&&!l&&!c&&(n(!0),m({type:"fullscreen_exit",severity:"high",details:{action:"fullscreen_exit",reason:"Attempted to exit full screen mode"}})),g&&u(!1)}});o.useEffect(()=>{d()},[]),o.useImperativeHandle(t,()=>({exitFullScreenIntentionally:async()=>{u(!0),n(!1),a(!1);try{document.fullscreenElement&&await document.exitFullscreen()}catch(g){console.error("Failed to exit fullscreen:",g)}}}),[]),jt(m),bt(m),kt(),St();const k=()=>{a(!0),b(),n(!1),r==null||r()};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"iw-relative iw-h-full iw-w-full",children:i}),e.jsx(zt,{warningCount:f,isOpen:s,violationType:w,onClose:()=>{n(!1),d()},onDisqualify:k}),!s&&f>0&&!l&&!c&&e.jsx(Yt,{showHardReloadWarning:!p,logViolation:m,onContinue:d})]})}),Kt=({interviewTitle:i,interviewId:r,onComplete:t,onDisqualify:s,className:n=""})=>{var ae;const l=pt(),{baseUrl:a,authToken:c}=Ie(),{timers:u,stt:w,tts:h,proctoring:m}=Ze(),f=o.useRef(null),[d,p]=o.useState(null),[b,k]=o.useState(""),g=o.useRef(""),v=o.useRef(null),C={thinkingTime:(u==null?void 0:u.thinkingDuration)||30,answeringTime:(u==null?void 0:u.answeringDuration)||120,editingTime:(u==null?void 0:u.editingDuration)||30},{thinkingTime:N,answeringTime:D,editingTime:j}=C;o.useEffect(()=>{g.current=b},[b]);const S=o.useRef(!1),{speak:T,stop:x,error:M}=Et({config:{baseUrl:a,provider:h==null?void 0:h.provider,authToken:c},onEnd:()=>{S.current=!1,_()},onError:()=>{S.current||(S.current=!0,_())}}),P=o.useRef(!1),L=o.useRef(!1),{startRecording:O,stopRecording:H,transcribe:Y,error:Q}=vt({config:{baseUrl:a,provider:w==null?void 0:w.provider,model:w==null?void 0:w.model,language:w==null?void 0:w.language,authToken:c,qnaId:((ae=v.current)==null?void 0:ae.qna_id)||""},onStart:()=>{P.current=!1,L.current=!1},onStop:()=>{},onTranscriptionComplete:y=>{k(y.transcript),L.current||(L.current=!0,_())},onError:y=>{console.error("STT Error:",y),P.current||(P.current=!0,_())}}),{state:q,startQuestion:$,nextPhase:_,completeInterview:K}=ut({config:{thinkingDuration:N,answeringDuration:D,editingDuration:j},callbacks:{onPhaseChange:y=>{switch(y){case I.FETCHING_QUESTION:U();break;case I.READING_QUESTION:be();break;case I.ANSWERING:ye();break;case I.TRANSCRIBING:ve();break;case I.SUBMITTING:J();break}},onInterviewEnd:()=>{t==null||t()}}});o.useEffect(()=>{$()},[]);const{execute:U,loading:pe}=ht(async()=>{var W,Z;const y=await l.generateQuestion({interviewId:r,question:((W=v.current)==null?void 0:W.question)||"",qnaId:((Z=v.current)==null?void 0:Z.qna_id)||"",answer:g.current});return v.current=y.data,y},{onSuccess:async y=>{y&&y.data&&(k(""),p(y.data),_())},onError:y=>{console.error("Failed to fetch questions:",y)}}),J=o.useCallback(async()=>{$()},[$]),be=o.useCallback(async()=>{var y;if((y=v.current)!=null&&y.question)try{S.current=!1,await T(v.current.question),v.current.is_interview_done&&(await rt(2e3),K())}catch(W){console.error("Failed to speak question:",W)}else _()},[T,_,K]),ye=o.useCallback(async()=>{try{await O(D)}catch(y){console.error("Failed to start recording:",y),_()}},[O,_]),ve=o.useCallback(async()=>{try{const y=await H();await Y(y)}catch(y){console.error("STT processing failed:",y),!P.current&&!L.current&&(P.current=!0,_())}},[H,Y,_]),X=o.useCallback(async y=>{var Z;x(),await((Z=f.current)==null?void 0:Z.exitFullScreenIntentionally()),(await l.generateQuestion({interviewId:r,isInterviewDone:!0})).success&&(y==null||y(),K(),sessionStorage.removeItem(ce))},[r,x,l]),ne=()=>{const{phase:y}=q;switch(y){case I.IDLE:return 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:[e.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"Ready to start the Interview?"}),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.`}),e.jsx(G,{onClick:$,className:"iw-mt-2 iw-w-40",children:"Start Interview"})]});case I.FETCHING_QUESTION:return e.jsx(Lt,{});case I.READING_QUESTION:return e.jsx(Ot,{ttsError:M});case I.THINKING:return e.jsx(qt,{state:q,thinkingTime:N,nextPhase:_});case I.ANSWERING:return e.jsx(Ft,{state:q,answeringTime:D,nextPhase:_,sttError:Q});case I.TRANSCRIBING:return e.jsx(Ut,{sttError:Q});case I.EDITING:case I.SUBMITTING:return e.jsx("div",{className:"iw-space-y-4 iw-h-full",children:e.jsx(Mt,{value:b,onChange:W=>k(W.target.value),onSubmit:()=>_(),isSubmitDisabled:!b.trim()||pe,state:q,editingTime:j})});case I.COMPLETED:return null;default:return null}};return e.jsx(e.Fragment,{children:m!=null&&m.enabled?e.jsxs(Qt,{ref:f,onDisqualify:()=>X(s),children:[e.jsx(Oe,{title:i,onExit:()=>X()}),e.jsx(Le,{currentQuestion:d,phase:q.phase,className:n,children:ne()})]}):e.jsxs(e.Fragment,{children:[e.jsx(Oe,{title:i,onExit:()=>X()}),e.jsx(Le,{currentQuestion:d,phase:q.phase,className:n,children:ne()})]})})},xe=({title:i,interviewId:r,onInterviewEnd:t,onInterviewDisqualify:s,className:n=""})=>{const[l,a]=o.useState(!1),[c,u]=o.useState(!0),w=o.useRef(null);return l?e.jsx("div",{className:"interview-widget-container",children:e.jsx("div",{ref:w,className:`iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${n}`,children:e.jsx("div",{className:" iw-h-full iw-flex iw-flex-col",children:e.jsx(Kt,{interviewTitle:i??"Interview",interviewId:r,className:n,onComplete:t||(()=>{}),onDisqualify:s})})})}):e.jsx("div",{className:"interview-widget-container",children:e.jsx(lt,{isOpen:c,onStart:()=>{a(!0),u(!1)}})})};typeof window<"u"&&(window.InterviewWidget={InterviewWidget:xe,InterviewWidgetProvider:Te}),A.InterviewWidget=xe,A.InterviewWidgetProvider=Te,A.default=xe,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
187
|
+
`})})};function wh({ttsError:e}){return o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-8 iw-w-full iw-h-full",children:[o.jsx(fh,{size:"80px"}),e&&o.jsxs("div",{className:"iw-mt-2 iw-text-xs iw-text-red-600",children:["Audio playback failed: ",e.message]}),o.jsx("p",{className:"iw-text- iw-text-gray-700",children:"Your AI interviewer is speaking..."})]})}const mh=({state:e,thinkingTime:t,nextPhase:r})=>o.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-6 iw-items-center iw-justify-center iw-text-center iw-h-full ",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"Get Ready to Answer"}),o.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."})]}),o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-2",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-1",children:[o.jsx(sn,{className:"iw-size-4 iw-text-orange-600"}),o.jsx("p",{className:"iw-text-gray-700 iw-text-sm",children:"Time to think: "})]}),o.jsx(on,{total:t,remaining:e.currentPhaseTimeRemaining,size:50,strokeWidth:4})]}),o.jsx("div",{className:"iw-w-full iw-grid iw-grid-cols-1",children:o.jsx(qe,{onClick:()=>{r()},children:"Start Answering"})})]}),gh=({sttError:e})=>o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full",children:[o.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 60 60",fill:"none",children:[o.jsx("rect",{width:60,height:60,rx:30,fill:"url(#prefix__paint0_linear_1460_12482)"}),o.jsx("path",{d:"M28.127 14c.276 7.685 6.442 13.851 14.127 14.127-7.684.276-13.85 6.442-14.127 14.127-.275-7.685-6.442-13.851-14.126-14.127 7.684-.276 13.85-6.442 14.126-14.127zM38.937 31.873A7.331 7.331 0 0046 38.937 7.331 7.331 0 0038.937 46a7.331 7.331 0 00-7.064-7.063 7.331 7.331 0 007.064-7.064z",fill:"#fff"}),o.jsx("defs",{children:o.jsxs("linearGradient",{id:"prefix__paint0_linear_1460_12482",x1:30,y1:-6.563,x2:77.813,y2:54.375,gradientUnits:"userSpaceOnUse",children:[o.jsx("stop",{offset:.211,stopColor:"#5C92FA"}),o.jsx("stop",{offset:1,stopColor:"#A75FFD"})]})})]}),o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1 iw-mt-3",children:"Just a moment... We're analyzing your response"}),o.jsx("p",{className:"iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]",children:"After transcription, you'll have 45 sec to review your answer."}),e&&o.jsxs("div",{className:"iw-mt-2 iw-text-xs iw-text-red-600",children:["Transcription error: ",e.message,e.recoverable&&" (attempting to continue)"]})]}),Yi=5;function ph({isOpen:e,onClose:t,warningCount:r,violationType:i,onDisqualify:n}){const[s,a]=d.useState(10),c=d.useRef(t);if(d.useEffect(()=>{c.current=t},[t]),d.useEffect(()=>{if(!e)return;const w=setInterval(()=>{a(m=>m<=1?(c.current(),10):m-1)},1e3);return()=>clearInterval(w)},[e]),d.useEffect(()=>{e&&a(10)},[e]),d.useEffect(()=>(e?(document.body.style.overflow="hidden",document.body.classList.add("interview-widget-container")):(document.body.style.overflow="unset",document.body.classList.remove("interview-widget-container")),()=>{document.body.style.overflow="unset",document.body.classList.remove("interview-widget-container")}),[e]),!e)return null;const u=(()=>{switch(i){case"tab_switch":return{title:"Tab Switch Detected",description:"You attempted to switch to another tab or reload application.",icon:o.jsx(lo,{className:"iw-h-5 iw-w-5"})};case"fullscreen_exit":return{title:"Full Screen Exit Detected",description:"You attempted to exit full screen mode.",icon:o.jsx(oo,{className:"iw-h-5 iw-w-5"})};case"focus_loss":return{title:"Focus Loss Detected",description:"You lost focus from the interview window.",icon:o.jsx(du,{className:"iw-h-5 iw-w-5"})};case"blocked_shortcut":return{title:"Keyboard Shortcut Blocked",description:"You attempted to use a blocked keyboard shortcut.",icon:o.jsx(an,{className:"iw-h-5 iw-w-5"})};case"right_click_attempt":return{title:"Right Click Attempted",description:"You attempted to use the right click.",icon:o.jsx(hu,{className:"iw-h-5 iw-w-5"})};case"alt_tab_attempt":return{title:"Alt + Tab Attempted",description:"You attempted to use the Alt + Tab shortcut.",icon:o.jsx(an,{className:"iw-h-5 iw-w-5"})};case"blocked_function_key":return{title:"Function Key Blocked",description:"You attempted to use a blocked function key.",icon:o.jsx(an,{className:"iw-h-5 iw-w-5"})};default:return{title:"Violation Detected",description:"You attempted to perform an action that is not allowed.",icon:o.jsx(Nr,{className:"iw-h-5 iw-w-5"})}}})(),h=Yi-r,f=()=>{r+1>Yi?n():t()};return o.jsx("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-black/60 iw-p-4 iw-backdrop-blur-sm",children:o.jsxs("div",{className:"iw-w-full iw-max-w-md iw-rounded-2xl iw-border iw-border-gray-100 iw-bg-white iw-shadow-xl",children:[o.jsxs("div",{className:"iw-p-6 iw-pb-0",children:[o.jsxs("div",{className:"iw-mb-6 iw-flex iw-items-start iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-12 iw-w-12 iw-flex-shrink-0 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-red-50",children:o.jsx(Nr,{className:"iw-h-6 iw-w-6 iw-text-red-500"})}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsx("h2",{className:"iw-mb-1 iw-text-xl iw-font-semibold iw-text-gray-900",children:"Security Violation"}),o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[o.jsx("span",{className:"iw-text-sm iw-text-gray-500",children:"Warning"}),o.jsx("div",{className:"iw-flex iw-gap-1",children:Array.from({length:Yi}).map((w,m)=>o.jsx("div",{className:`iw-h-2 iw-w-2 iw-rounded-full ${m<=r-1?"iw-bg-red-500":"iw-bg-gray-200"}`},m))}),o.jsxs("span",{className:"iw-text-sm iw-text-gray-500",children:["(",r,"/",Yi,")"]})]})]})]}),o.jsx("div",{className:"iw-mb-5 iw-rounded-2xl iw-border iw-border-red-100 iw-p-5",style:{background:"linear-gradient(to right, rgb(254, 242, 242), rgb(254, 245, 235))",borderColor:"rgb(254, 226, 226)"},children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-items-center iw-justify-center iw-rounded-xl iw-bg-white iw-shadow-sm",children:u.icon}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsx("h3",{className:"iw-mb-2 iw-font-semibold iw-text-gray-900",children:u.title}),o.jsx("p",{className:"iw-text-sm iw-leading-relaxed iw-text-gray-700",children:u.description}),o.jsxs("div",{className:"iw-mt-3 iw-flex iw-items-center iw-gap-2 iw-text-xs iw-text-red-600",children:[o.jsx(so,{className:"iw-h-3 iw-w-3"}),o.jsx("span",{children:"This action is monitored for interview integrity"})]})]})]})}),o.jsxs("div",{className:"iw-mb-5 iw-grid iw-grid-cols-2 iw-gap-3",children:[o.jsx("div",{className:"iw-rounded-xl iw-border iw-border-amber-200 iw-bg-amber-50 iw-p-4",children:o.jsxs("div",{className:"iw-text-center",children:[o.jsx("div",{className:"iw-mb-1 iw-text-2xl iw-font-bold iw-text-amber-600",children:h}),o.jsx("div",{className:"iw-text-xs iw-font-medium iw-text-amber-700",children:"Warnings Left"})]})}),o.jsx("div",{className:"iw-border-primary-100 iw-bg-primary-50 iw-rounded-xl iw-border iw-p-4",children:o.jsxs("div",{className:"iw-text-center",children:[o.jsxs("div",{className:"iw-mb-1 iw-flex iw-items-center iw-justify-center iw-gap-1.5",children:[o.jsx(uu,{className:"iw-text-primary-600 iw-h-4 iw-w-4"}),o.jsx("span",{className:"iw-text-primary-600 iw-text-2xl iw-font-bold",children:s})]}),o.jsx("div",{className:"iw-text-primary-700 iw-text-xs iw-font-medium",children:"Auto Close"})]})})]}),h===1&&o.jsx("div",{className:"iw-mb-5 iw-rounded-2xl iw-p-4 iw-text-white",style:{background:"linear-gradient(to right, rgba(220, 38, 38, 0.9), rgba(239, 68, 68, 0.9))"},children:o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-3",children:[o.jsx("div",{className:"iw-flex iw-h-8 iw-w-8 iw-items-center iw-justify-center iw-rounded-full iw-bg-white/20",children:o.jsx(Nr,{className:"iw-h-4 iw-w-4"})}),o.jsxs("div",{children:[o.jsx("div",{className:"iw-text-sm iw-font-semibold",children:"Final Warning"}),o.jsx("div",{className:"iw-text-xs iw-text-red-100",children:"Next violation will disqualify you from this interview"})]})]})})]}),o.jsxs("div",{className:"iw-p-6 iw-pt-0",children:[o.jsx(qe,{onClick:f,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",children:"I Understand - Continue Interview"}),o.jsx("p",{className:"iw-text-gray-500 iw-mt-3 iw-text-center iw-text-xs",children:"Please maintain focus and avoid switching tabs, exiting fullscreen, using shortcuts or right-clicking."})]})]})})}const xh=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z"}),o.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),yh=({showHardReloadWarning:e,onContinue:t})=>{const r=()=>{t()};return o.jsxs(Zr,{isOpen:e,onClose:r,closeOnOverlayClick:!1,closeOnEscape:!1,showCloseButton:!1,className:"iw-max-w-lg iw-px-2 iw-rounded-xl",children:[o.jsx("div",{className:"iw-absolute iw-inset-x-0 iw-top-0 iw-h-1 iw-bg-gradient-to-r iw-from-red-500 iw-to-red-600"}),o.jsx("div",{className:"iw-space-y-1 iw-pb-2 iw-pt-3",children:o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[o.jsx(Nr,{className:"iw-w-5 iw-h-5 iw-text-red-500"}),o.jsx("h3",{className:"iw-text-xl iw-font-semibold iw-text-red-500",children:"Full Screen Exit Detected"})]})}),o.jsx("div",{className:"iw-pt-4 iw-pb-6",children:o.jsx("p",{className:"iw-text-center iw-text-sm iw-leading-relaxed iw-text-gray-500/90",children:"Exiting full screen mode or reloading this page during the session is strictly prohibited. Any attempt to do so will be recorded and may lead to penalties."})}),o.jsx("div",{className:"iw-pt-2 iw-pb-4",children:o.jsxs("button",{onClick:r,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",children:[o.jsx(xh,{className:"iw-size-4"}),"Continue Session"]})})]})},bh=d.forwardRef(({children:e,onDisqualify:t},r)=>{const[i,n]=d.useState(!1),[s,a]=d.useState(!1),[c,l]=d.useState(!1),[u,h]=d.useState("fullscreen_exit"),{logViolation:f,violationCount:w}=su({maxViolations:5,onViolation:g=>{s||(n(!0),h(g.type))}}),{enterFullScreen:m,isFullScreen:p,exitFullScreen:E}=Yl({onFullScreenChange(g){!g&&!s&&!c&&(n(!0),f({type:"fullscreen_exit",severity:"high",details:{action:"fullscreen_exit",reason:"Attempted to exit full screen mode"}})),g&&l(!1)}});d.useEffect(()=>{m()},[]),d.useImperativeHandle(r,()=>({exitFullScreenIntentionally:async()=>{l(!0),n(!1),a(!1);try{document.fullscreenElement&&await document.exitFullscreen()}catch(g){console.error("Failed to exit fullscreen:",g)}}}),[]),tu(f),Ql(f),ru(),ou();const v=()=>{a(!0),E(),n(!1),t==null||t()};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"iw-relative iw-h-full iw-w-full",children:e}),o.jsx(ph,{warningCount:w,isOpen:i,violationType:u,onClose:()=>{n(!1),m()},onDisqualify:v}),!i&&w>0&&!s&&!c&&o.jsx(yh,{showHardReloadWarning:!p,logViolation:f,onContinue:m})]})}),vh=({interviewTitle:e,interviewId:t,onComplete:r,onDisqualify:i,className:n="",videoFeedRef:s})=>{var Yr,Ki,Kr;const a=ao(),{baseUrl:c,authToken:l}=Zs(),{timers:u,stt:h,tts:f,proctoring:w}=rn(),m=d.useRef(null),[p,E]=d.useState(null),[v,g]=d.useState(""),T=d.useRef(""),S=d.useRef(null),A={thinkingTime:(u==null?void 0:u.thinkingDuration)||30,answeringTime:(u==null?void 0:u.answeringDuration)||120,editingTime:(u==null?void 0:u.editingDuration)||30},{thinkingTime:U,answeringTime:N,editingTime:G}=A;d.useEffect(()=>{T.current=v},[v]);const L=d.useRef(!1),{speak:re,stop:We,error:ke}=nu({config:{baseUrl:c,provider:f==null?void 0:f.provider,authToken:l},onEnd:()=>{L.current=!1,Q()},onError:()=>{L.current||(L.current=!0,Q())}}),$e=d.useRef(!1),_e=d.useRef(!1),{startRecording:Ee,stopRecording:bt,transcribe:we,error:Qe}=eu({config:{baseUrl:c,provider:h==null?void 0:h.provider,model:h==null?void 0:h.model,language:h==null?void 0:h.language,authToken:l,qnaId:((Yr=S.current)==null?void 0:Yr.qna_id)||""},onStart:()=>{$e.current=!1,_e.current=!1},onStop:()=>{},onTranscriptionComplete:D=>{g(D.transcript),_e.current||(_e.current=!0,Q())},onError:D=>{console.error("STT Error:",D),$e.current||($e.current=!0,Q())}}),{state:le,startQuestion:at,nextPhase:Q,completeInterview:C}=Hl({config:{thinkingDuration:U,answeringDuration:N,editingDuration:G},callbacks:{onPhaseChange:D=>{switch(D){case de.FETCHING_QUESTION:ue();break;case de.READING_QUESTION:Ft();break;case de.ANSWERING:Yt();break;case de.TRANSCRIBING:Tr();break;case de.SUBMITTING:qt();break}},onInterviewEnd:()=>{r==null||r()}}});d.useEffect(()=>{at()},[]);const{execute:ue,loading:ct}=ql(async()=>{var He,Dt;const D=await a.generateQuestion({interviewId:t,question:((He=S.current)==null?void 0:He.question)||"",qnaId:((Dt=S.current)==null?void 0:Dt.qna_id)||"",answer:T.current});return S.current=D.data,D},{onSuccess:async D=>{D&&D.data&&(g(""),E(D.data),Q())},onError:D=>{console.error("Failed to fetch questions:",D)}}),qt=d.useCallback(async()=>{at()},[at]),Ft=d.useCallback(async()=>{var D;if((D=S.current)!=null&&D.question)try{L.current=!1,await re(S.current.question),S.current.is_interview_done&&(await io(2e3),C())}catch(He){console.error("Failed to speak question:",He)}else Q()},[re,Q,C]),Yt=d.useCallback(async()=>{try{await Ee(N)}catch(D){console.error("Failed to start recording:",D),Q()}},[Ee,Q]),Tr=d.useCallback(async()=>{try{const D=await bt();await we(D)}catch(D){console.error("STT processing failed:",D),!$e.current&&!_e.current&&($e.current=!0,Q())}},[bt,we,Q]),Kt=d.useCallback(async D=>{var He;We(),await((He=m.current)==null?void 0:He.exitFullScreenIntentionally());try{(await a.generateQuestion({interviewId:t,isInterviewDone:!0})).success&&(D==null||D(),C(),sessionStorage.removeItem(Zi))}catch(Dt){console.error("API call failed:",Dt)}},[t,We,a]),Pt=()=>{const{phase:D}=le;switch(D){case de.IDLE:return o.jsxs("div",{className:"iw-text-center iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-2 iw-h-full",children:[o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"Ready to start the Interview?"}),o.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.`}),o.jsx(qe,{onClick:at,className:"iw-mt-2 iw-w-40",children:"Start Interview"})]});case de.FETCHING_QUESTION:return o.jsx(hh,{});case de.READING_QUESTION:return o.jsx(wh,{ttsError:ke});case de.THINKING:return o.jsx(mh,{state:le,thinkingTime:U,nextPhase:Q});case de.ANSWERING:return o.jsx(dh,{state:le,answeringTime:N,nextPhase:Q,sttError:Qe});case de.TRANSCRIBING:return o.jsx(gh,{sttError:Qe});case de.EDITING:case de.SUBMITTING:return o.jsx("div",{className:"iw-space-y-4 iw-h-full",children:o.jsx(lu,{value:v,onChange:He=>g(He.target.value),onSubmit:()=>Q(),isSubmitDisabled:!v.trim()||ct,state:le,editingTime:G})});case de.COMPLETED:return null;default:return null}};return o.jsx(o.Fragment,{children:w!=null&&w.enabled?o.jsxs(bh,{ref:m,onDisqualify:()=>Kt(i),children:[o.jsx(gl,{title:e,onExit:()=>Kt()}),o.jsx(ml,{currentQuestion:p,phase:le.phase,className:n,interviewId:t,interview_duration:(Ki=S==null?void 0:S.current)==null?void 0:Ki.interview_duration,videoFeedRef:s,children:Pt()})]}):o.jsxs(o.Fragment,{children:[o.jsx(gl,{title:e,onExit:()=>Kt()}),o.jsx(ml,{currentQuestion:p,phase:le.phase,className:n,interviewId:t,interview_duration:(Kr=S==null?void 0:S.current)==null?void 0:Kr.interview_duration,videoFeedRef:s,children:Pt()})]})})},zs=({title:e,interviewId:t,onInterviewEnd:r,onInterviewDisqualify:i,className:n=""})=>{const[s,a]=d.useState(!1),[c,l]=d.useState(!0),[u,h]=d.useState(!1),{proctoring:f}=rn(),w=d.useRef(null),m=d.useRef(null),p=(f==null?void 0:f.gazeAnalysisEnabled)===!0,E=()=>{a(!0),l(!1)};return d.useEffect(()=>{if(s&&u&&m.current&&p)try{m.current.setReference()}finally{h(!1)}},[s,u,p]),s?o.jsx("div",{className:"interview-widget-container",children:o.jsx("div",{ref:w,className:`iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${n}`,children:o.jsx("div",{className:"iw-h-full iw-flex iw-flex-col",children:o.jsx(vh,{interviewTitle:e??"Interview",interviewId:t,className:n,onComplete:r??(()=>{}),onDisqualify:i,videoFeedRef:m})})})}):o.jsx("div",{className:"interview-widget-container",children:o.jsx(Vl,{isOpen:c,gazeEnabled:p,onStart:E,onRequestCalibration:()=>h(!0),videoFeedRef:m})})};typeof window<"u"&&(window.InterviewWidget={InterviewWidget:zs,InterviewWidgetProvider:Qs}),he.InterviewWidget=zs,he.InterviewWidgetProvider=Qs,he.default=zs,Object.defineProperties(he,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|