interview-widget 3.1.6 → 3.1.8
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/components/interview/interview-content.d.ts +1 -0
- package/dist/components/interview/phases/answering-phase.d.ts +2 -1
- package/dist/components/interview/submit-response-button.d.ts +1 -0
- package/dist/services/stt/stt-service.d.ts +34 -2
- package/dist/utils/audio-storage.d.ts +24 -0
- package/dist/widget.css +1 -1
- package/dist/widget.es.js +2977 -2810
- package/dist/widget.umd.js +6 -6
- package/package.json +1 -1
package/dist/widget.umd.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
(function(me,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],o):(me=typeof globalThis<"u"?globalThis:me||self,o(me.InterviewWidget={},me.jsxRuntime,me.React,me.ReactDOM))})(this,function(me,o,d,zs){"use strict";var c2=Object.defineProperty;var l2=(me,o,d)=>o in me?c2(me,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):me[o]=d;var We=(me,o,d)=>l2(me,typeof o!="symbol"?o+"":o,d);var on=typeof document<"u"?document.currentScript:null;const an={},it={api:{baseUrl:"/api",retryConfig:{attempts:3,backoff:"exponential",baseDelay:1e3}},ui:{baseColor:"#3B82F6",borderRadius:"8px"},interview:{allow_answer_editing:!0,capture_screenshots:!1,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}}},cn="iw-storage";function Al(){if(!(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:on&&on.tagName.toUpperCase()==="SCRIPT"&&on.src||new URL("widget.umd.js",document.baseURI).href}<"u"&&(an!=null&&an.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 Hs=Al(),li=30,Cl={SCREENSHOT:"screenshot"},ln="AES-GCM",dn=12;async function qs(e){const r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return crypto.subtle.importKey("raw",i,ln,!1,["encrypt","decrypt"])}function Sl(){return crypto.getRandomValues(new Uint8Array(dn))}async function Nl(e,t="default-seed"){try{const r=typeof e=="string"?e:JSON.stringify(e),n=new TextEncoder().encode(r),s=await qs(t),a=Sl(),c=await crypto.subtle.encrypt({name:ln,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 Tl(e,t="default-seed"){try{const r=atob(e),i=new Uint8Array(r.length);for(let h=0;h<r.length;h++)i[h]=r.charCodeAt(h);const n=i.slice(0,dn),s=i.slice(dn),a=await qs(t),c=await crypto.subtle.decrypt({name:ln,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 Il(e,t="default-seed"){return Nl(e,t)}async function Fl(e,t="default-seed"){const r=await Tl(e,t);try{return JSON.parse(r)}catch{return r}}const Br=d.createContext(null),Ll=async()=>{try{const e=sessionStorage.getItem(cn);if(e){const r=(await Fl(e,Hs)).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}}},Ur=async e=>{try{const t=await Il({state:e,version:0},Hs);sessionStorage.setItem(cn,t)}catch(t){console.error("Failed to save proctoring data to session storage:",t)}},Ml=({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(()=>{Ll().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},Ur(t.current),i()},[i]),c=d.useCallback(w=>{const g={...t.current.gazeViolationCounters};w==="looking_away"&&(g.lookingAwayCount+=1),w==="no_face_detected"&&(g.noFaceDetectedCount+=1),w==="multiple_faces"&&(g.multipleFacesCount+=1),g.totalGazeViolations=g.lookingAwayCount+g.noFaceDetectedCount+g.multipleFacesCount,t.current={...t.current,gazeViolationCounters:g},Ur(t.current),i()},[i]),l=d.useCallback(()=>{t.current={...t.current,logViolations:[],totalViolations:0},Ur(t.current),i()},[i]),h=d.useCallback(()=>{t.current={...t.current,gazeViolationCounters:{lookingAwayCount:0,noFaceDetectedCount:0,multipleFacesCount:0,totalGazeViolations:0}},Ur(t.current),i()},[i]),u=d.useCallback((w,g)=>{t.current={...t.current,referenceSet:w,referenceRef:g},Ur(t.current),i()},[i]),f=d.useMemo(()=>({getState:s,addViolation:a,clearViolations:l,subscribe:n,incrementGazeViolation:c,clearGazeViolationCounters:h,setReferenceData:u}),[s,a,l,n,c,h,u]);return o.jsx(Br.Provider,{value:f,children:e})},Ks=()=>{const e=d.useContext(Br);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}},Dl=()=>{const e=d.useContext(Br);if(!e)throw new Error("useViolations must be used within a ProctoringProvider");return d.useSyncExternalStore(e.subscribe,()=>e.getState().logViolations,()=>e.getState().logViolations)},Pl=()=>{const e=d.useContext(Br);if(!e)throw new Error("useTotalViolations must be used within a ProctoringProvider");return d.useSyncExternalStore(e.subscribe,()=>e.getState().totalViolations,()=>e.getState().totalViolations)},Ol=()=>{const e=d.useContext(Br);if(!e)throw new Error("useProctoringActions must be used within a ProctoringProvider");return{addViolation:e.addViolation,clearViolations:e.clearViolations}},Ys=d.createContext(null);function Xs({config:e={},children:t}){var i,n,s,a;const r={api:{...it.api,...e.api,retryConfig:{...it.api.retryConfig,...(i=e.api)==null?void 0:i.retryConfig}},ui:{...it.ui,...e.ui},interview:{...it.interview,...e.interview,timers:{...it.interview.timers,...(n=e.interview)==null?void 0:n.timers},stt:{...it.interview.stt,...(s=e.interview)==null?void 0:s.stt},tts:{...it.interview.tts,...(a=e.interview)==null?void 0:a.tts}}};return o.jsx(Ys.Provider,{value:r,children:o.jsx(Ml,{children:t})})}function di(){const e=d.useContext(Ys);if(!e)throw new Error("useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>");return e}function Qs(){return di().api||it.api}function Rt(){return di().ui||it.ui}function un(){return di().interview||it.interview}function Bl(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 Ul(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 Gl(e,t){const r=Bl(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 Ul(i,n,s)}function Vl(e){return new Promise(t=>setTimeout(t,e))}function jl(e){return`linear-gradient(to left, ${Gl(e,.4)}, ${e})`}const $l=()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);function Wl(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 zl=e=>{var t;return!e||typeof e!="string"?"":(t=e.charAt(0))==null?void 0:t.toUpperCase()},hn=(e,t)=>{const r=Math.max(0,Math.floor(e));if(t&&r<60)return`${r}`;const i=Math.floor(r/60).toString().padStart(2,"0"),n=(r%60).toString().padStart(2,"0");return`${i}:${n}`},fn=({brandLogo:e,brandName:t,className:r="",showFallbackStyles:i=!0})=>{const{baseColor:n}=Rt();return e?o.jsx("div",{className:r,children:e}):o.jsx("div",{className:i?`iw-h-7 iw-w-7 iw-rounded-md iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold ${r}`:r,style:i?{backgroundColor:n}:{},children:zl(t)})},Hl=e=>{const t=d.useRef(null),r=d.useRef(null),[i,n]=d.useState(!1),[s,a]=d.useState(!1),[c,l]=d.useState(null),[h,u]=d.useState([]),[f,w]=d.useState([]),[g,p]=d.useState(""),[b,m]=d.useState(""),[y,v]=d.useState(!1),C=d.useCallback(()=>{r.current&&(r.current.getTracks().forEach(T=>T.stop()),r.current=null,l(null))},[]),N=d.useCallback(async()=>{var T,L,X,be;try{const Q=await navigator.mediaDevices.enumerateDevices(),W=Q.filter(U=>U.kind==="audioinput"),H=Q.filter(U=>U.kind==="videoinput");if(u(W),w(H),!g&&W.length>0){const U=(T=r.current)==null?void 0:T.getAudioTracks()[0],J=U==null?void 0:U.getSettings().deviceId;p(J||((L=W[0])==null?void 0:L.deviceId)||"")}if(!b&&H.length>0){const U=(X=r.current)==null?void 0:X.getVideoTracks()[0],J=U==null?void 0:U.getSettings().deviceId;m(J||((be=H[0])==null?void 0:be.deviceId)||"")}}catch(Q){console.error("Error enumerating devices:",Q)}},[g,b]),M=d.useCallback(async(T,L)=>{const X={width:{ideal:1280},height:{ideal:720},...L?{deviceId:{exact:L}}:{facingMode:"user"}},be={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:{ideal:48e3},channelCount:{ideal:1},...T?{deviceId:{exact:T}}:{}};let Q=null;try{Q=await navigator.mediaDevices.getUserMedia({video:X,audio:be}),n(!0),a(!0)}catch(W){console.warn("Combined media request failed, trying individual.",W);try{const H=await navigator.mediaDevices.getUserMedia({audio:be});n(!0),Q=H}catch(H){console.error("Audio permission denied",H),n(!1)}try{const H=await navigator.mediaDevices.getUserMedia({video:X});a(!0),Q?H.getTracks().forEach(U=>Q.addTrack(U)):Q=H}catch(H){console.error("Video permission denied",H),a(!1)}}Q?(r.current=Q,l(Q),t.current&&(t.current.srcObject=Q,await t.current.play().catch(W=>console.error("Error playing video element",W)))):(r.current=null,l(null)),await N()},[N]),I=async T=>{T!==g&&(v(!0),p(T),C(),await M(T,b),v(!1))},D=async T=>{T!==b&&(v(!0),m(T),C(),await M(g,T),v(!1))};return d.useEffect(()=>{if(!e){C();return}return M(),()=>C()},[e]),{videoRef:t,audioAllowed:i,videoAllowed:s,audioDevices:h,videoDevices:f,selectedAudioDeviceId:g,selectedVideoDeviceId:b,isDeviceLoading:y,currentStream:c,handleAudioChange:I,handleVideoChange:D,stopStream:C}},ui=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"})]}),ql=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})]}),Kl=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"})]}),hi=e=>o.jsx("svg",{width:"10",height:"9",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M0.75 5.5C0.75 5.5 2.35 6.4125 3.15 7.75C3.15 7.75 5.55 2.5 8.75 0.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Yl=({className:e})=>o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:o.jsx("path",{d:"M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9",stroke:"#062260","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})}),Js=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"})]}),fi=e=>o.jsx("svg",{className:"iw-w-5 iw-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",...e,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),Xl=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"})]}),Ql=e=>o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M2.66797 2H13.3346",stroke:"#5C6686",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M3.66797 2V3.35359C3.66797 4.18151 4.05252 4.96247 4.70874 5.46726L8.0013 8L11.2938 5.46726C11.9501 4.96247 12.3346 4.18151 12.3346 3.35359V2",stroke:"#5C6686",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M3.66797 14V12.6464C3.66797 11.8185 4.05252 11.0375 4.70874 10.5327L8.0013 8L11.2938 10.5327C11.9501 11.0375 12.3346 11.8185 12.3346 12.6464V14",stroke:"#5C6686",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M2.66797 14H13.3346",stroke:"#5C6686",strokeLinecap:"round",strokeLinejoin:"round"})]}),Zs=({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"})]})}),Jl=e=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M17 7V11C17 13.7614 14.7614 16 12 16C9.23858 16 7 13.7614 7 11V7C7 4.23858 9.23858 2 12 2C14.7614 2 17 4.23858 17 7Z",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M20 11C20 15.4183 16.4183 19 12 19M12 19C7.58172 19 4 15.4183 4 11M12 19V22M12 22H15M12 22H9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Rs=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})]}),Zl=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})]}),Rl=e=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M11 8H13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M2 11C2 7.70017 2 6.05025 3.02513 5.02513C4.05025 4 5.70017 4 9 4H10C13.2998 4 14.9497 4 15.9749 5.02513C17 6.05025 17 7.70017 17 11V13C17 16.2998 17 17.9497 15.9749 18.9749C14.9497 20 13.2998 20 10 20H9C5.70017 20 4.05025 20 3.02513 18.9749C2 17.9497 2 16.2998 2 13V11Z",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M17 8.90585L17.1259 8.80196C19.2417 7.05623 20.2996 6.18336 21.1498 6.60482C22 7.02628 22 8.42355 22 11.2181V12.7819C22 15.5765 22 16.9737 21.1498 17.3952C20.2996 17.8166 19.2417 16.9438 17.1259 15.198L17 15.0941",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),ed=e=>o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M8.16651 8.63991V5.35747C8.16651 3.52277 8.16651 2.60542 7.62675 2.37712C7.08699 2.14882 6.45168 2.79749 5.18119 4.09482C4.52323 4.76666 4.14784 4.91543 3.2117 4.91543C2.39301 4.91543 1.98366 4.91543 1.68961 5.11606C1.07921 5.53252 1.17148 6.34653 1.17148 6.9987C1.17148 7.65086 1.07921 8.46485 1.68961 8.88135C1.98366 9.08196 2.39301 9.08196 3.2117 9.08196C4.14784 9.08196 4.52323 9.23076 5.18119 9.90259C6.45168 11.1999 7.08699 11.8486 7.62675 11.6203C8.16651 11.392 8.16651 10.4746 8.16651 8.63991Z",stroke:"currentColor",strokeWidth:"0.875",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M9.9165 5.25C10.2813 5.72815 10.4998 6.33698 10.4998 7C10.4998 7.66302 10.2813 8.27184 9.9165 8.75",stroke:"currentColor",strokeWidth:"0.875",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M11.6665 4.08203C12.3961 4.87894 12.8332 5.89369 12.8332 6.9987C12.8332 8.10371 12.3961 9.11847 11.6665 9.91536",stroke:"currentColor",strokeWidth:"0.875",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ae={FACE_DETECTED:"face_detected",NO_FACE:"no_face_detected",MULTIPLE_FACES:"multiple_faces",LOOKING_AWAY:"looking_away",CAMERA_ERROR:"camera_error",MODEL_LOADING:"model_loading"},eo={[Ae.FACE_DETECTED]:{icon:Xl,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"},[Ae.NO_FACE]:{icon:Kl,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"},[Ae.MULTIPLE_FACES]:{icon:Zl,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 on the screen.",buttonText:"I Understood"},[Ae.LOOKING_AWAY]:{icon:Rs,iconColor:"iw-text-amber-600",iconBg:"iw-bg-amber-50",iconBorder:"iw-border-amber-200/75",title:"Focus Alert",subtitle:"You looked away from the screen. Maintain focus to continue.",buttonText:"I Understood"},[Ae.CAMERA_ERROR]:{icon:ui,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, contact support if the problem continues.",buttonText:"I Understood"},[Ae.MODEL_LOADING]:{icon:Rs,iconColor:"iw-text-blue-600",iconBg:"iw-bg-blue-50",iconBorder:"iw-border-blue-100",title:"Initializing Model",subtitle:"Please wait while we set up the AI",description:"The face detection model is being loaded. This should only take a moment.",buttonText:"Wait"}};function td(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 vt(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=td(s);if(!a.retryable||n===r.attempts)throw a;const c=rd(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 rd(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)}const xt={v2:"/v2"},Et={GENERATE_QUESTION:e=>`${xt.v2}/interviews/${e}/next-question`,SCREENSHOT_UPLOAD:e=>`${xt.v2}/interviews/${e}/assets/upload-url`,CONFIRM_UPLOAD:e=>`${xt.v2}/interviews/assets/${e}/confirm`,TRANSCRIBE_ANSWER:e=>`${xt.v2}/interviews/${e}/transcribe-answer`,SUBMIT_ANSWER:e=>`${xt.v2}/interviews/${e}/submit-answer`,EXIT:e=>`${xt.v2}/interviews/${e}/exit`,CONFIG:e=>`${xt.v2}/interviews/${e}/config`,TRANSCRIPTION:e=>`${xt.v2}/interviews/${e}/transcript`};class to{constructor(t={}){We(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}){const i=await vt(`${this.getBaseUrl()}${Et.GENERATE_QUESTION(t)}`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({interview_id:t,is_interview_done:r})});if(!i.ok)throw new Error(`Failed to get questions: ${i.status}`);return await i.json()}async submitAnswer({interviewId:t,qnaId:r,answer:i}){const n=await vt(`${this.getBaseUrl()}${Et.SUBMIT_ANSWER(t)}`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({qna_id:r,answer_text:i})});if(!n.ok)throw new Error(`Failed to submit answer: ${n.status}`);return await n.json()}async exitInterview(t){const r=await vt(`${this.getBaseUrl()}${Et.EXIT(t)}`,{method:"POST",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to exit interview: ${r.status}`)}async getInterviewConfig(t){const r=await vt(`${this.getBaseUrl()}${Et.CONFIG(t)}`,{method:"GET",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to get interview config: ${r.status}`);return await r.json()}async requestScreenshotUploadUrl(t,r=`screenshot-${Date.now()}.jpeg`){const i=await vt(`${this.getBaseUrl()}${Et.SCREENSHOT_UPLOAD(t)}`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({filename:r,mime_type:"image/jpeg",asset_type:Cl.SCREENSHOT})});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}`)}async confirmScreenshotUpload(t){const r=await vt(`${this.getBaseUrl()}${Et.CONFIRM_UPLOAD(t)}`,{method:"POST",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to confirm screenshot upload: ${r.status}`)}async getInterviewTranscription(t){const r=await vt(`${this.getBaseUrl()}${Et.TRANSCRIPTION(t)}`,{method:"GET",headers:{...this.getHeaders()}});if(!r.ok)throw new Error(`Failed to get interview transcription: ${r.status}`);return await r.json()}}const wi=new to,id=({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."]})]})}),nd=({showControls:e,isBubbleOpen:t,setIsBubbleOpen:r,setReference:i,clearCache:n,isModelLoaded:s,gazeAnalysisEnabled:a,referenceSet:c,showLandmarks:l,setShowLandmarks:h,showEngagementBar:u,setShowEngagementBar:f,handleToggleGazeAnalysis:w,stats:g,statusMessage:p,loadingProgress:b})=>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(ql,{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:m=>w(m.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:m=>h(m.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:u,onChange:m=>f(m.target.checked),disabled:!a}),"Show Engagement Bar"]})]}),c&&o.jsx(id,{gazeAnalysisEnabled:a,isModelLoaded:s,loadingProgress:b,stats:g,statusMessage:p})]})]}):null;var er=typeof self<"u"?self:{};function Gr(e,t){e:{for(var r=["CLOSURE_FLAGS"],i=er,n=0;n<r.length;n++)if((i=i[r[n]])==null){r=null;break e}r=i}return(e=r&&r[e])!=null?e:t}function Pt(){throw Error("Invalid UTF8")}function ro(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let gi,wn;const sd=typeof TextDecoder<"u";let od;const ad=typeof TextEncoder<"u";function io(e){if(ad)e=(od||(od=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}function no(e){er.setTimeout(()=>{throw e},0)}var gn,cd=Gr(610401301,!1),so=Gr(748402147,!0),pn=Gr(824648567,!0),mn=Gr(824656860,Gr(1,!0));function oo(){var e=er.navigator;return e&&(e=e.userAgent)?e:""}const ao=er.navigator;function pi(e){return pi[" "](e),e}gn=ao&&ao.userAgentData||null,pi[" "]=function(){};const co={};let Vr=null;function ld(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(h){for(;l<s.length;){const u=s.charAt(l++),f=Vr[u];if(f!=null)return f;if(!/^[\s\xa0]*$/.test(u))throw Error("Unknown base64 encoding at char: "+u)}return h}lo();let l=0;for(;;){const h=c(-1),u=c(0),f=c(64),w=c(64);if(w===64&&h===-1)break;a(h<<2|u>>4),f!=64&&(a(u<<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 lo(){if(!Vr){Vr={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const i=e.concat(t[r].split(""));co[r]=i;for(let n=0;n<i.length;n++){const s=i[n];Vr[s]===void 0&&(Vr[s]=n)}}}}var dd=typeof Uint8Array<"u",uo=!(!(cd&&gn&&gn.brands.length>0)&&(oo().indexOf("Trident")!=-1||oo().indexOf("MSIE")!=-1))&&typeof btoa=="function";const ho=/[-_.]/g,ud={"-":"+",_:"/",".":"="};function hd(e){return ud[e]||""}function fo(e){if(!uo)return ld(e);e=ho.test(e)?e.replace(ho,hd):e,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 yn(e){return dd&&e!=null&&e instanceof Uint8Array}var tr={};function Ot(){return fd||(fd=new nt(null,tr))}function bn(e){wo(tr);var t=e.g;return(t=t==null||yn(t)?t:typeof t=="string"?fo(t):null)==null?t:e.g=t}var nt=class{h(){return new Uint8Array(bn(this)||0)}constructor(e,t){if(wo(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let fd,wd;function wo(e){if(e!==tr)throw Error("illegal external caller")}function go(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function vn(e){return go(e=Error(e),"warning"),e}function rr(e,t){if(e!=null){var r=wd??(wd={}),i=r[e]||0;i>=t||(r[e]=i+1,go(e=Error(),"incident"),no(e))}}function ir(){return typeof BigInt=="function"}var nr=typeof Symbol=="function"&&typeof Symbol()=="symbol";function st(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 gd=st("jas",void 0,!0),po=st(void 0,"0di"),jr=st(void 0,"1oa"),Te=st(void 0,Symbol()),pd=st(void 0,"0ub"),md=st(void 0,"0ubs"),xn=st(void 0,"0ubsb"),yd=st(void 0,"0actk"),sr=st("m_m","Pa",!0),mo=st();const yo={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},bo=Object.defineProperties,E=nr?gd:"Ga";var Bt;const vo=[];function $r(e,t){nr||E in e||bo(e,yo),e[E]|=t}function de(e,t){nr||E in e||bo(e,yo),e[E]=t}function Wr(e){return $r(e,34),e}function zr(e){return $r(e,8192),e}de(vo,7),Bt=Object.freeze(vo);var or={};function Ie(e,t){return t===void 0?e.h!==Ut&&!!(2&(0|e.v[E])):!!(2&t)&&e.h!==Ut}const Ut={};function En(e,t){if(e!=null){if(typeof e=="string")e=e?new nt(e,tr):Ot();else if(e.constructor!==nt)if(yn(e))e=e.length?new nt(new Uint8Array(e),tr):Ot();else{if(!t)throw Error();e=void 0}}return e}class xo{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}}var bd=Object.freeze({});function Eo(e,t,r){const i=128&t?0:-1,n=e.length;var s;(s=!!n)&&(s=(s=e[n-1])!=null&&typeof s=="object"&&s.constructor===Object);const a=n+(s?-1:0);for(t=128&t?1:0;t<a;t++)r(t-i,e[t]);if(s){e=e[n-1];for(const c in e)!isNaN(c)&&r(+c,e[c])}}var _o={};function ar(e){return 128&e?_o:void 0}function mi(e){return e.Na=!0,e}var vd=mi(e=>typeof e=="number"),ko=mi(e=>typeof e=="string"),xd=mi(e=>typeof e=="boolean"),yi=typeof er.BigInt=="function"&&typeof er.BigInt(0)=="bigint";function Fe(e){var t=e;if(ko(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(vd(t)&&!Number.isSafeInteger(t))throw Error(String(t));return yi?BigInt(e):e=xd(e)?e?"1":"0":ko(e)?e.trim()||"0":String(e)}var _n=mi(e=>yi?e>=_d&&e<=Ad:e[0]==="-"?Ao(e,Ed):Ao(e,kd));const Ed=Number.MIN_SAFE_INTEGER.toString(),_d=yi?BigInt(Number.MIN_SAFE_INTEGER):void 0,kd=Number.MAX_SAFE_INTEGER.toString(),Ad=yi?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Ao(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 Cd=typeof Uint8Array.prototype.slice=="function";let Sd,Z=0,ae=0;function Co(e){const t=e>>>0;Z=t,ae=(e-t)/4294967296>>>0}function cr(e){if(e<0){Co(-e);const[t,r]=Nn(Z,ae);Z=t>>>0,ae=r>>>0}else Co(e)}function kn(e){const t=Sd||(Sd=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),ae=0,Z=t.getUint32(0,!0)}function An(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Hr(e,t)}function Nd(e,t){return Fe(ir()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):Hr(e,t))}function Cn(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=An(e,t))=="number"?r?-e:e:r?"-"+e:e}function So(e,t){return ir()?Fe(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):Fe(Sn(e,t))}function Hr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else ir()?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+No(r)+No(e));return r}function No(e){return e=String(e),"0000000".slice(e.length)+e}function Sn(e,t){if(2147483648&t)if(ir())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,i]=Nn(e,t);e="-"+Hr(r,i)}else e=Hr(e,t);return e}function bi(e){if(e.length<16)cr(Number(e));else if(ir())e=BigInt(e),Z=Number(e&BigInt(4294967295))>>>0,ae=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");ae=Z=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));ae*=1e6,Z=1e6*Z+s,Z>=4294967296&&(ae+=Math.trunc(Z/4294967296),ae>>>=0,Z>>>=0)}if(t){const[i,n]=Nn(Z,ae);Z=i,ae=n}}}function Nn(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Je(e){return Array.prototype.slice.call(e)}const qr=typeof BigInt=="function"?BigInt.asIntN:void 0,Td=typeof BigInt=="function"?BigInt.asUintN:void 0,Gt=Number.isSafeInteger,vi=Number.isFinite,lr=Math.trunc,Id=Fe(0);function Kr(e){if(e!=null&&typeof e!="number")throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);return e}function ot(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Yr(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}function To(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const Fd=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Xr(e){switch(typeof e){case"bigint":return!0;case"number":return vi(e);case"string":return Fd.test(e);default:return!1}}function dr(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return vi(e)?0|e:void 0}function Io(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return vi(e)?e>>>0:void 0}function Fo(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(bi(e),Sn(Z,ae))}function Tn(e){return e=lr(e),Gt(e)||(cr(e),e=Cn(Z,ae)),e}function Lo(e){var t=lr(Number(e));return Gt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Fo(e))}function Mo(e){var t=lr(Number(e));return Gt(t)?Fe(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),ir()?Fe(qr(64,BigInt(e))):Fe(Fo(e)))}function Do(e){return Gt(e)?e=Fe(Tn(e)):(e=lr(e),Gt(e)?e=String(e):(cr(e),e=Sn(Z,ae)),e=Fe(e)),e}function Ld(e){return e==null?e:typeof e=="bigint"?(_n(e)?e=Number(e):(e=qr(64,e),e=_n(e)?Number(e):String(e)),e):Xr(e)?typeof e=="number"?Tn(e):Lo(e):void 0}function xi(e){const t=typeof e;return e==null?e:t==="bigint"?Fe(qr(64,e)):Xr(e)?t==="string"?Mo(e):Do(e):void 0}function Po(e){if(typeof e!="string")throw Error();return e}function Qr(e){if(e!=null&&typeof e!="string")throw Error();return e}function ye(e){return e==null||typeof e=="string"?e:void 0}function In(e,t,r,i){return e!=null&&e[sr]===or?e:Array.isArray(e)?((i=(r=0|e[E])|32&i|2&i)!==r&&de(e,i),new t(e)):(r?2&i?((e=t[po])||(Wr((e=new t).v),e=t[po]=e),t=e):t=new t:t=void 0,t)}function Md(e,t,r){if(t)e:{if(!Xr(t=e))throw vn("int64");switch(typeof t){case"string":t=Mo(t);break e;case"bigint":t=Fe(qr(64,t));break e;default:t=Do(t)}}else t=xi(e);return(e=t)==null?r?Id:void 0:e}const Dd={};let Pd=function(){try{return pi(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class Fn{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 Od=Pd?(Object.setPrototypeOf(Fn.prototype,Map.prototype),Object.defineProperties(Fn.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Fn):class extends Map{constructor(){super()}};function Oo(e){return e}function Ln(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var ft=class extends Od{constructor(e,t,r=Oo,i=Oo){super(),this.J=0|e[E],this.K=t,this.S=r,this.fa=this.K?Bd:i;for(let n=0;n<e.length;n++){const s=e[n],a=r(s[0],!1,!0);let c=s[1];t?c===void 0&&(c=null):c=i(s[1],!1,!0,void 0,void 0,this.J),super.set(a,c)}}V(e){return zr(Array.from(super.entries(),e))}clear(){Ln(this),super.clear()}delete(e){return Ln(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new xo(e,Ud,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new xo(e,ft.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach((r,i,n)=>{e.call(t,n.get(i),i,n)}):super.forEach(e,t)}set(e,t){return Ln(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),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.K;return r?((r=this.fa(t,!1,!0,r,this.ra,this.J))!==t&&super.set(e,r),r):t}}[Symbol.iterator](){return this.entries()}};function Bd(e,t,r,i,n,s){return e=In(e,i,r,s),n&&(e=Pn(e)),e}function Ud(e){return[e,this.get(e)]}let Gd;function Bo(){return Gd||(Gd=new ft(Wr([]),void 0,void 0,void 0,Dd))}function Ei(e){return Te?e[Te]:void 0}function _i(e,t){for(const r in e)!isNaN(r)&&t(e,+r,e[r])}ft.prototype.toJSON=void 0;var Mn=class{};const Vd={Ka:!0};function jd(e,t){t<100||rr(md,1)}function ki(e,t,r,i){const n=i!==void 0;i=!!i;var s,a=Te;!n&&nr&&a&&(s=e[a])&&_i(s,jd),a=[];var c=e.length;let l;s=4294967295;let h=!1;const u=!!(64&t),f=u?128&t?0:-1:void 0;1&t||(l=c&&e[c-1],l!=null&&typeof l=="object"&&l.constructor===Object?s=--c:l=void 0,!u||128&t||n||(h=!0,s=s-f+f)),t=void 0;for(var w=0;w<c;w++){let g=e[w];if(g!=null&&(g=r(g,i))!=null)if(u&&w>=s){const p=w-f;(t??(t={}))[p]=g}else a[w]=g}if(l)for(let g in l){if((c=l[g])==null||(c=r(c,i))==null)continue;let p;w=+g,u&&!Number.isNaN(w)&&(p=w+f)<s?a[p]=c:(t??(t={}))[g]=c}return t&&(h?a.push(t):a[s]=t),n&&Te&&(e=Ei(e))&&e instanceof Mn&&(a[Te]=function(g){const p=new Mn;return _i(g,(b,m,y)=>{p[m]=Je(y)}),p.da=g.da,p}(e)),a}function $d(e){return e[0]=Jr(e[0]),e[1]=Jr(e[1]),e}function Jr(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return _n(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[E];return e.length===0&&1&t?void 0:ki(e,t,Jr)}if(e!=null&&e[sr]===or)return Uo(e);if(e instanceof nt){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(uo){for(var r="",i=0,n=t.length-10240;i<n;)r+=String.fromCharCode.apply(null,t.subarray(i,i+=10240));r+=String.fromCharCode.apply(null,i?t.subarray(i):t),t=btoa(r)}else{r===void 0&&(r=0),lo(),r=co[r],i=Array(Math.floor(t.length/3)),n=r[64]||"";let h=0,u=0;for(;h<t.length-2;h+=3){var s=t[h],a=t[h+1],c=t[h+2],l=r[s>>2];s=r[(3&s)<<4|a>>4],a=r[(15&a)<<2|c>>6],c=r[63&c],i[u++]=l+s+a+c}switch(l=0,c=n,t.length-h){case 2:c=r[(15&(l=t[h+1]))<<2]||n;case 1:t=t[h],i[u]=r[t>>2]+r[(3&t)<<4|l>>4]+c+n}t=i.join("")}e=e.g=t}return e}return e instanceof ft?e=e.size!==0?e.V($d):void 0:void 0}return e}function Uo(e){return ki(e=e.v,0|e[E],Jr)}let Wd,zd;function Vt(e,t){return Go(e,t[0],t[1])}function Go(e,t,r,i=0){if(e==null){var n=32;r?(e=[r],n|=128):e=[],t&&(n=-16760833&n|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(n=0|e[E],so&&1&n)throw Error("rfarr");if(2048&n&&!(2&n)&&function(){if(so)throw Error("carr");rr(yd,5)}(),256&n)throw Error("farr");if(64&n)return(n|i)!==n&&de(e,n|i),e;if(r&&(n|=128,r!==e[0]))throw Error("mid");e:{n|=64;var s=(r=e).length;if(s){var a=s-1;const l=r[a];if(l!=null&&typeof l=="object"&&l.constructor===Object){if((a-=t=128&n?0:-1)>=1024)throw Error("pvtlmt");for(var c in l)(s=+c)<a&&(r[s+t]=l[c],delete l[c]);n=-16760833&n|(1023&a)<<14;break e}}if(t){if((c=Math.max(t,s-(128&n?0:-1)))>1024)throw Error("spvt");n=-16760833&n|(1023&c)<<14}}}return de(e,64|n|i),e}function Hd(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var r=0|e[E];return e.length===0&&1&r?void 0:Vo(e,r,t)}if(e!=null&&e[sr]===or)return jo(e);if(e instanceof ft){if(2&(t=e.J))return e;if(!e.size)return;if(r=Wr(e.V()),e.K)for(e=0;e<r.length;e++){const i=r[e];let n=i[1];n=n==null||typeof n!="object"?void 0:n!=null&&n[sr]===or?jo(n):Array.isArray(n)?Vo(n,0|n[E],!!(32&t)):void 0,i[1]=n}return r}return e instanceof nt?e:void 0}function Vo(e,t,r){return 2&t||(!r||4096&t||16&t?e=ur(e,t,!1,r&&!(16&t)):($r(e,34),4&t&&Object.freeze(e))),e}function Dn(e,t,r){return e=new e.constructor(t),r&&(e.h=Ut),e.m=Ut,e}function jo(e){const t=e.v,r=0|t[E];return Ie(e,r)?e:On(e,t,r)?Dn(e,t):ur(t,r)}function ur(e,t,r,i){return i??(i=!!(34&t)),e=ki(e,t,Hd,i),i=32,r&&(i|=2),de(e,t=16769217&t|i),e}function Pn(e){const t=e.v,r=0|t[E];return Ie(e,r)?On(e,t,r)?Dn(e,t,!0):new e.constructor(ur(t,r,!1)):e}function hr(e){if(e.h!==Ut)return!1;var t=e.v;return $r(t=ur(t,0|t[E]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function fr(e){if(!hr(e)&&Ie(e,0|e.v[E]))throw Error()}function jt(e,t){t===void 0&&(t=0|e[E]),32&t&&!(4096&t)&&de(e,4096|t)}function On(e,t,r){return!!(2&r)||!(!(32&r)||4096&r)&&(de(t,2|r),e.h=Ut,!0)}const qd=Fe(0),_t={};function q(e,t,r,i,n){if((t=wt(e.v,t,r,n))!==null||i&&e.m!==Ut)return t}function wt(e,t,r,i){if(t===-1)return null;const n=t+(r?0:-1),s=e.length-1;let a,c;if(!(s<1+(r?0:-1))){if(n>=s)if(a=e[s],a!=null&&typeof a=="object"&&a.constructor===Object)r=a[t],c=!0;else{if(n!==s)return;r=a}else r=e[n];if(i&&r!=null){if((i=i(r))==null)return i;if(!Object.is(i,r))return c?a[t]=i:e[n]=i,i}return r}}function $(e,t,r,i){fr(e),ue(e=e.v,0|e[E],t,r,i)}function ue(e,t,r,i,n){const s=r+(n?0:-1);var a=e.length-1;if(a>=1+(n?0:-1)&&s>=a){const c=e[a];if(c!=null&&typeof c=="object"&&c.constructor===Object)return c[r]=i,t}return s<=a?(e[s]=i,t):(i!==void 0&&(r>=(a=(t??(t=0|e[E]))>>14&1023||536870912)?i!=null&&(e[a+(n?0:-1)]={[r]:i}):e[s]=i),t)}function $t(){return bd===void 0?2:4}function Wt(e,t,r,i,n){let s=e.v,a=0|s[E];i=Ie(e,a)?1:i,n=!!n||i===3,i===2&&hr(e)&&(s=e.v,a=0|s[E]);let c=(e=Bn(s,t))===Bt?7:0|e[E],l=Un(c,a);var h=!(4&l);if(h){4&l&&(e=Je(e),c=0,l=Ht(l,a),a=ue(s,a,t,e));let u=0,f=0;for(;u<e.length;u++){const w=r(e[u]);w!=null&&(e[f++]=w)}f<u&&(e.length=f),r=-513&(4|l),l=r&=-1025,l&=-4097}return l!==c&&(de(e,l),2&l&&Object.freeze(e)),$o(e,l,s,a,t,i,h,n)}function $o(e,t,r,i,n,s,a,c){let l=t;return s===1||s===4&&(2&t||!(16&t)&&32&i)?zt(t)||((t|=!e.length||a&&!(4096&t)||32&i&&!(4096&t||16&t)?2:256)!==l&&de(e,t),Object.freeze(e)):(s===2&&zt(t)&&(e=Je(e),l=0,t=Ht(t,i),i=ue(r,i,n,e)),zt(t)||(c||(t|=16),t!==l&&de(e,t))),2&t||!(4096&t||16&t)||jt(r,i),e}function Bn(e,t,r){return e=wt(e,t,r),Array.isArray(e)?e:Bt}function Un(e,t){return 2&t&&(e|=2),1|e}function zt(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Wo(e){return En(e,!0)}function zo(e){e=Je(e);for(let t=0;t<e.length;t++){const r=e[t]=Je(e[t]);Array.isArray(r[1])&&(r[1]=Wr(r[1]))}return zr(e)}function kt(e,t,r,i){fr(e),ue(e=e.v,0|e[E],t,(i==="0"?Number(r)===0:r===i)?void 0:r)}function wr(e,t,r){if(2&t)throw Error();const i=ar(t);let n=Bn(e,r,i),s=n===Bt?7:0|n[E],a=Un(s,t);return(2&a||zt(a)||16&a)&&(a===s||zt(a)||de(n,a),n=Je(n),s=0,a=Ht(a,t),ue(e,t,r,n,i)),a&=-13,a!==s&&de(n,a),n}function Gn(e,t){var r=Qa;return jn(Vn(e=e.v),e,void 0,r)===t?t:-1}function Vn(e){if(nr)return e[jr]??(e[jr]=new Map);if(jr in e)return e[jr];const t=new Map;return Object.defineProperty(e,jr,{value:t}),t}function Ho(e,t,r,i,n){const s=Vn(e),a=jn(s,e,t,r,n);return a!==i&&(a&&(t=ue(e,t,a,void 0,n)),s.set(r,i)),t}function jn(e,t,r,i,n){let s=e.get(i);if(s!=null)return s;s=0;for(let a=0;a<i.length;a++){const c=i[a];wt(t,c,n)!=null&&(s!==0&&(r=ue(t,r,s,void 0,n)),s=c)}return e.set(i,s),s}function $n(e,t,r){let i=0|e[E];const n=ar(i),s=wt(e,r,n);let a;if(s!=null&&s[sr]===or){if(!Ie(s))return hr(s),s.v;a=s.v}else Array.isArray(s)&&(a=s);if(a){const c=0|a[E];2&c&&(a=ur(a,c))}return a=Vt(a,t),a!==s&&ue(e,i,r,a,n),a}function qo(e,t,r,i,n){let s=!1;if((i=wt(e,i,n,a=>{const c=In(a,r,!1,t);return s=c!==a&&c!=null,c}))!=null)return s&&!Ie(i)&&jt(e,t),i}function V(e,t,r,i){let n=e.v,s=0|n[E];if((t=qo(n,s,t,r,i))==null)return t;if(s=0|n[E],!Ie(e,s)){const a=Pn(t);a!==t&&(hr(e)&&(n=e.v,s=0|n[E]),s=ue(n,s,r,t=a,i),jt(n,s))}return t}function Ko(e,t,r,i,n,s,a,c){var l=Ie(e,r);s=l?1:s,a=!!a||s===3,l=c&&!l,(s===2||l)&&hr(e)&&(r=0|(t=e.v)[E]);var h=(e=Bn(t,n))===Bt?7:0|e[E],u=Un(h,r);if(c=!(4&u)){var f=e,w=r;const g=!!(2&u);g&&(w|=2);let p=!g,b=!0,m=0,y=0;for(;m<f.length;m++){const v=In(f[m],i,!1,w);if(v instanceof i){if(!g){const C=Ie(v);p&&(p=!C),b&&(b=C)}f[y++]=v}}y<m&&(f.length=y),u|=4,u=b?-4097&u:4096|u,u=p?8|u:-9&u}if(u!==h&&(de(e,u),2&u&&Object.freeze(e)),l&&!(8&u||!e.length&&(s===1||s===4&&(2&u||!(16&u)&&32&r)))){for(zt(u)&&(e=Je(e),u=Ht(u,r),r=ue(t,r,n,e)),i=e,l=u,h=0;h<i.length;h++)(f=i[h])!==(u=Pn(f))&&(i[h]=u);l|=8,de(e,u=l=i.length?4096|l:-4097&l)}return $o(e,u,t,r,n,s,c,a)}function gt(e,t,r){const i=e.v;return Ko(e,i,0|i[E],t,r,$t(),!1,!0)}function Yo(e){return e==null&&(e=void 0),e}function S(e,t,r,i,n){return $(e,r,i=Yo(i),n),i&&!Ie(i)&&jt(e.v),e}function Zr(e,t,r,i){e:{var n=i=Yo(i);fr(e);const s=e.v;let a=0|s[E];if(n==null){const c=Vn(s);if(jn(c,s,a,r)!==t)break e;c.set(r,0)}else a=Ho(s,a,r,t);ue(s,a,t,n)}i&&!Ie(i)&&jt(e.v)}function Ht(e,t){return-273&(2&t?2|e:-3&e)}function Wn(e,t,r,i){var n=i;fr(e),e=Ko(e,i=e.v,0|i[E],r,t,2,!0),n=n??new r,e.push(n),t=r=e===Bt?7:0|e[E],(n=Ie(n))?(r&=-9,e.length===1&&(r&=-4097)):r|=4096,r!==t&&de(e,r),n||jt(i)}function ze(e,t,r){return dr(q(e,t,void 0,r))}function Xo(e){return(mn?q(e,2,void 0,void 0,xi):xi(q(e,2)))??qd}function ie(e,t){return q(e,t,void 0,void 0,ot)??0}function pt(e,t,r){if(r!=null){if(typeof r!="number"||!vi(r))throw vn("int32");r|=0}$(e,t,r)}function A(e,t,r){$(e,t,Kr(r))}function Le(e,t,r){kt(e,t,Qr(r),"")}function Ai(e,t,r){{fr(e);const a=e.v;let c=0|a[E];if(r==null)ue(a,c,t);else{var i=e=r===Bt?7:0|r[E],n=zt(e),s=n||Object.isFrozen(r);for(n||(e=0),s||(r=Je(r),i=0,e=Ht(e,c),s=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(mn?1024:0),n=0;n<r.length;n++){const l=r[n],h=Po(l);Object.is(l,h)||(s&&(r=Je(r),i=0,e=Ht(e,c),s=!1),r[n]=h)}e!==i&&(s&&(r=Je(r),e=Ht(e,c)),de(r,e)),ue(a,c,t,r)}}}function Ci(e,t,r){fr(e),Wt(e,t,ye,2,!0).push(Po(r))}var gr=class{constructor(e,t,r){if(this.buffer=e,r&&!t)throw Error();this.g=t}};function zn(e,t){if(typeof e=="string")return new gr(fo(e),t);if(Array.isArray(e))return new gr(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new gr(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new gr(e,!1);if(e.constructor===nt)return t=bn(e)||new Uint8Array(0),new gr(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new gr(e,!1);throw Error()}function pr(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);if(s>32)for(n|=(127&r)>>4,s=3;s<32&&128&r;s+=7)r=a[c++],n|=(127&r)<<s;if(qt(e,c),!(128&r))return t(i>>>0,n>>>0);throw Error()}function Hn(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 qt(e,r),!!(127&t)}throw Error()}function At(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 Error();return qt(e,r),n}function mt(e){return At(e)>>>0}function Si(e){var t=e.h;const r=e.g;var i=t[r],n=t[r+1];const s=t[r+2];return t=t[r+3],qt(e,e.g+4),e=2*((n=(i<<0|n<<8|s<<16|t<<24)>>>0)>>31)+1,i=n>>>23&255,n&=8388607,i==255?n?NaN:e*(1/0):i==0?1401298464324817e-60*e*n:e*Math.pow(2,i-150)*(n+8388608)}function Kd(e){return At(e)}function qt(e,t){if(e.g=t,t>e.l)throw Error()}function Qo(e,t){if(t<0)throw Error();const r=e.g;if((t=r+t)>e.l)throw Error();return e.g=t,r}function Jo(e,t){if(t==0)return Ot();var r=Qo(e,t);return e.Y&&e.j?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):Cd?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Ot():new nt(r,tr)}var Zo=[];function Ro(e,t,r,i){if(Ii.length){const n=Ii.pop();return n.o(i),n.g.init(e,t,r,i),n}return new Yd(e,t,r,i)}function ea(e){e.g.clear(),e.l=-1,e.h=-1,Ii.length<100&&Ii.push(e)}function ta(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var r=mt(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5)||t<1)throw Error();return e.l=t,e.h=r,!0}function Ni(e){switch(e.h){case 0:e.h!=0?Ni(e):Hn(e.g);break;case 1:qt(e=e.g,e.g+8);break;case 2:if(e.h!=2)Ni(e);else{var t=mt(e.g);qt(e=e.g,e.g+t)}break;case 5:qt(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!ta(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}Ni(e)}break;default:throw Error()}}function Rr(e,t,r){const i=e.g.l;var n=mt(e.g);let s=(n=e.g.g+n)-i;if(s<=0&&(e.g.l=n,r(t,e,void 0,void 0,void 0),s=n-e.g.g),s)throw Error();return e.g.g=n,e.g.l=i,t}function qn(e){var t=mt(e.g),r=Qo(e=e.g,t);if(e=e.h,sd){var i,n=e;(i=wn)||(i=wn=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(gi===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),gi=!0}catch{gi=!1}}throw!gi&&(wn=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?Pt():(c=e[s++],a<194||(192&c)!=128?(s--,Pt()):r.push((31&a)<<6|63&c)):a<240?s>=t-1?Pt():(c=e[s++],(192&c)!=128||a===224&&c<160||a===237&&c>=160||(192&(i=e[s++]))!=128?(s--,Pt()):r.push((15&a)<<12|(63&c)<<6|63&i)):a<=244?s>=t-2?Pt():(c=e[s++],(192&c)!=128||c-144+(a<<28)>>30||(192&(i=e[s++]))!=128||(192&(n=e[s++]))!=128?(s--,Pt()):(a=(7&a)<<18|(63&c)<<12|(63&i)<<6|63&n,a-=65536,r.push(55296+(a>>10&1023),56320+(1023&a)))):Pt(),r.length>=8192&&(l=ro(l,r),r.length=0)}s=ro(l,r)}return s}function ra(e){const t=mt(e.g);return Jo(e.g,t)}function Ti(e,t,r){var i=mt(e.g);for(i=e.g.g+i;e.g.g<i;)r.push(t(e.g))}var Yd=class{constructor(e,t,r,i){if(Zo.length){const n=Zo.pop();n.init(e,t,r,i),e=n}else e=new class{constructor(n,s,a,c){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(n,s,a,c)}init(n,s,a,{Y:c=!1,ea:l=!1}={}){this.Y=c,this.ea=l,n&&(n=zn(n,this.ea),this.h=n.buffer,this.j=n.g,this.m=s||0,this.l=a!==void 0?this.m+a:this.h.length,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(e,t,r,i);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(i)}o({ha:e=!1}={}){this.ha=e}},Ii=[];function ia(e){return e?/^\d+$/.test(e)?(bi(e),new Kn(Z,ae)):null:Xd||(Xd=new Kn(0,0))}var Kn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Xd;function na(e){return e?/^-?\d+$/.test(e)?(bi(e),new Yn(Z,ae)):null:Qd||(Qd=new Yn(0,0))}var Yn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Qd;function mr(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 yr(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Fi(e,t){if(t>=0)yr(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Xn(e){var t=Z;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 br(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function He(e,t,r){yr(e.g,8*t+r)}function Qn(e,t){return He(e,t,2),t=e.g.end(),br(e,t),t.push(e.h),t}function Jn(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 Li(e,t,r){He(e,t,2),yr(e.g,r.length),br(e,e.g.end()),br(e,r)}function Mi(e,t,r,i){r!=null&&(t=Qn(e,t),i(r,e),Jn(e,t))}function at(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Zn=at(),sa=at(),Rn=at(),es=at(),oa=at(),aa=at(),Jd=at(),Di=at(),ca=at(),la=at();function ct(e,t,r){var i=e.v;Te&&Te in i&&(i=i[Te])&&delete i[t.g],t.h?t.j(e,t.h,t.g,r,t.l):t.j(e,t.g,r,t.l)}var _=class{constructor(e,t){this.v=Go(e,t,void 0,2048)}toJSON(){return Uo(this)}j(){var n;var e=Mu,t=this.v,r=e.g,i=Te;if(nr&&i&&((n=t[i])==null?void 0:n[r])!=null&&rr(pd,3),t=e.g,mo&&Te&&mo===void 0&&(i=(r=this.v)[Te])&&(i=i.da))try{i(r,t,Vd)}catch(s){no(s)}return e.h?e.m(this,e.h,e.g,e.l):e.m(this,e.g,e.defaultValue,e.l)}clone(){const e=this.v,t=0|e[E];return On(this,e,t)?Dn(this,e,!0):new this.constructor(ur(e,t,!1))}};_.prototype[sr]=or,_.prototype.toString=function(){return this.v.toString()};var vr=class{constructor(e,t,r){this.g=e,this.h=t,e=Zn,this.l=!!e&&r===e||!1}};function Pi(e,t){return new vr(e,t,Zn)}function da(e,t,r,i,n){Mi(e,r,pa(t,i),n)}const Zd=Pi(function(e,t,r,i,n){return e.h===2&&(Rr(e,$n(t,i,r),n),!0)},da),Rd=Pi(function(e,t,r,i,n){return e.h===2&&(Rr(e,$n(t,i,r),n),!0)},da);var Oi=Symbol(),Bi=Symbol(),ts=Symbol(),ua=Symbol(),ha=Symbol();let fa,wa;function Kt(e,t,r,i){var n=i[e];if(n)return n;(n={}).qa=i,n.T=function(f){switch(typeof f){case"boolean":return Wd||(Wd=[0,void 0,!0]);case"number":return f>0?void 0:f===0?zd||(zd=[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.ba=s,typeof(s=i[++a])=="function"&&(n.ma=!0,fa??(fa=s),wa??(wa=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 h=void 0;if(s instanceof vr?f=s:(f=Zd,a--),f==null?void 0:f.l){s=i[++a],h=i;var u=a;typeof s=="function"&&(s=s(),h[u]=s),h=s}for(u=l+1,typeof(s=i[++a])=="number"&&s<0&&(u-=s,s=i[++a]);l<u;l++){const w=c[l];h?r(n,l,f,h,w):t(n,l,f,w)}}return i[e]=n}function ga(e){return Array.isArray(e)?e[0]instanceof vr?e:[Rd,e]:[e,void 0]}function pa(e,t){return e instanceof _?e.v:Array.isArray(e)?Vt(e,t):void 0}function rs(e,t,r,i){const n=r.g;e[t]=i?(s,a,c)=>n(s,a,c,i):n}function is(e,t,r,i,n){const s=r.g;let a,c;e[t]=(l,h,u)=>s(l,h,u,c||(c=Kt(Bi,rs,is,i).T),a||(a=ns(i)),n)}function ns(e){let t=e[ts];if(t!=null)return t;const r=Kt(Bi,rs,is,e);return t=r.ma?(i,n)=>fa(i,n,r):(i,n)=>{for(;ta(n)&&n.h!=4;){var s=n.l,a=r[s];if(a==null){var c=r.ba;c&&(c=c[s])&&(c=tu(c))!=null&&(a=r[s]=c)}if(a==null||!a(n,i,s)){if(a=(c=n).m,Ni(c),c.ha)var l=void 0;else l=c.g.g-a,c.g.g=a,l=Jo(c.g,l);a=void 0,c=i,l&&((a=c[Te]??(c[Te]=new Mn))[s]??(a[s]=[])).push(l)}}return(i=Ei(i))&&(i.da=r.qa[ha]),!0},e[ts]=t,e[ha]=eu.bind(e),t}function eu(e,t,r,i){var n=this[Bi];const s=this[ts],a=Vt(void 0,n.T),c=Ei(e);if(c){var l=!1,h=n.ba;if(h){if(n=(u,f,w)=>{if(w.length!==0)if(h[f])for(const g of w){u=Ro(g);try{l=!0,s(a,u)}finally{ea(u)}}else i==null||i(e,f,w)},t==null)_i(c,n);else if(c!=null){const u=c[t];u&&n(c,t,u)}if(l){let u=0|e[E];if(2&u&&2048&u&&!(r!=null&&r.Ka))throw Error();const f=ar(u),w=(g,p)=>{if(wt(e,g,f)!=null){if((r==null?void 0:r.Qa)===1)return;throw Error()}p!=null&&(u=ue(e,u,g,p,f)),delete c[g]};t==null?Eo(a,0|a[E],(g,p)=>{w(g,p)}):w(t,wt(a,t,f))}}}}function tu(e){const t=(e=ga(e))[0].g;if(e=e[1]){const r=ns(e),i=Kt(Bi,rs,is,e).T;return(n,s,a)=>t(n,s,a,i,r)}return t}function Ui(e,t,r){e[t]=r.h}function Gi(e,t,r,i){let n,s;const a=r.h;e[t]=(c,l,h)=>a(c,l,h,s||(s=Kt(Oi,Ui,Gi,i).T),n||(n=ma(i)))}function ma(e){let t=e[ua];if(!t){const r=Kt(Oi,Ui,Gi,e);t=(i,n)=>ya(i,n,r),e[ua]=t}return t}function ya(e,t,r){Eo(e,0|e[E],(i,n)=>{if(n!=null){var s=function(a,c){var l=a[c];if(l)return l;if((l=a.ba)&&(l=l[c])){var h=(l=ga(l))[0].h;if(l=l[1]){const u=ma(l),f=Kt(Oi,Ui,Gi,l).T;l=a.ma?wa(f,u):(w,g,p)=>h(w,g,p,f,u)}else l=h;return a[c]=l}}(r,i);s?s(t,n,i):i<500||rr(xn,3)}}),(e=Ei(e))&&_i(e,(i,n,s)=>{for(br(t,t.g.end()),i=0;i<s.length;i++)br(t,bn(s[i])||new Uint8Array(0))})}const ru=Fe(0);function xr(e,t){if(Array.isArray(t)){var r=0|t[E];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),(e=-1537&(5|r))!==r&&de(t,e),2&e&&Object.freeze(t),t}}function Ee(e,t,r){return new vr(e,t,r)}function Er(e,t,r){return new vr(e,t,r)}function fe(e,t,r){ue(e,0|e[E],t,r,ar(0|e[E]))}var iu=Pi(function(e,t,r,i,n){if(e.h!==2)return!1;if(e=Je(e=Rr(e,Vt([void 0,void 0],i),n)),n=ar(i=0|t[E]),2&i)throw Error();let s=wt(t,r,n);if(s instanceof ft)2&s.J?(s=s.V(),s.push(e),ue(t,i,r,s,n)):s.Ma(e);else if(Array.isArray(s)){var a=0|s[E];8192&a||de(s,a|=8192),2&a&&(s=zo(s),ue(t,i,r,s,n)),s.push(e)}else ue(t,i,r,zr([e]),n);return!0},function(e,t,r,i,n){if(t instanceof ft)t.forEach((s,a)=>{Mi(e,r,Vt([a,s],i),n)});else if(Array.isArray(t)){for(let s=0;s<t.length;s++){const a=t[s];Array.isArray(a)&&Mi(e,r,Vt(a,i),n)}zr(t)}});function ba(e,t,r){(t=ot(t))!=null&&(He(e,r,5),e=e.g,kn(t),Xn(e))}function va(e,t,r){if(t=function(i){if(i==null)return i;const n=typeof i;if(n==="bigint")return String(qr(64,i));if(Xr(i)){if(n==="string")return Lo(i);if(n==="number")return Tn(i)}}(t),t!=null&&(typeof t=="string"&&na(t),t!=null))switch(He(e,r,0),typeof t){case"number":e=e.g,cr(t),mr(e,Z,ae);break;case"bigint":r=BigInt.asUintN(64,t),r=new Yn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),mr(e.g,r.h,r.g);break;default:r=na(t),mr(e.g,r.h,r.g)}}function xa(e,t,r){(t=dr(t))!=null&&t!=null&&(He(e,r,0),Fi(e.g,t))}function Ea(e,t,r){(t=To(t))!=null&&(He(e,r,0),e.g.g.push(t?1:0))}function _a(e,t,r){(t=ye(t))!=null&&Li(e,r,io(t))}function ka(e,t,r,i,n){Mi(e,r,pa(t,i),n)}function Aa(e,t,r){(t=t==null||typeof t=="string"||t instanceof nt?t:void 0)!=null&&Li(e,r,zn(t,!0).buffer)}function Ca(e,t,r){return(e.h===5||e.h===2)&&(t=wr(t,0|t[E],r),e.h==2?Ti(e,Si,t):t.push(Si(e.g)),!0)}var ce=Ee(function(e,t,r){return e.h===5&&(fe(t,r,Si(e.g)),!0)},ba,Di),nu=Er(Ca,function(e,t,r){if((t=xr(ot,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&(He(i,n,5),i=i.g,kn(s),Xn(i))}},Di),ss=Er(Ca,function(e,t,r){if((t=xr(ot,t))!=null&&t.length){He(e,r,2),yr(e.g,4*t.length);for(let i=0;i<t.length;i++)r=e.g,kn(t[i]),Xn(r)}},Di),su=Ee(function(e,t,r){return e.h===5&&(fe(t,r,(e=Si(e.g))===0?void 0:e),!0)},ba,Di),Ct=Ee(function(e,t,r){return pn?(e.h!==0?e=!1:(fe(t,r,pr(e.g,So)),e=!0),e):e.h===0&&(fe(t,r,pr(e.g,Cn)),!0)},va,aa),os=Ee(function(e,t,r){return pn?(e.h!==0?t=!1:(fe(t,r,(e=pr(e.g,So))===ru?void 0:e),t=!0),t):e.h===0&&(fe(t,r,(e=pr(e.g,Cn))===0?void 0:e),!0)},va,aa),ou=Ee(function(e,t,r){return pn?(e.h!==0?e=!1:(fe(t,r,pr(e.g,Nd)),e=!0),e):e.h===0&&(fe(t,r,pr(e.g,An)),!0)},function(e,t,r){if(t=function(i){if(i==null)return i;var n=typeof i;if(n==="bigint")return String(Td(64,i));if(Xr(i)){if(n==="string")return n=lr(Number(i)),Gt(n)&&n>=0?i=String(n):((n=i.indexOf("."))!==-1&&(i=i.substring(0,n)),(n=i[0]!=="-"&&((n=i.length)<20||n===20&&i<="18446744073709551615"))||(bi(i),i=Hr(Z,ae))),i;if(n==="number")return(i=lr(i))>=0&&Gt(i)||(cr(i),i=An(Z,ae)),i}}(t),t!=null&&(typeof t=="string"&&ia(t),t!=null))switch(He(e,r,0),typeof t){case"number":e=e.g,cr(t),mr(e,Z,ae);break;case"bigint":r=BigInt.asUintN(64,t),r=new Kn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),mr(e.g,r.h,r.g);break;default:r=ia(t),mr(e.g,r.h,r.g)}},Jd),we=Ee(function(e,t,r){return e.h===0&&(fe(t,r,At(e.g)),!0)},xa,es),ei=Er(function(e,t,r){return(e.h===0||e.h===2)&&(t=wr(t,0|t[E],r),e.h==2?Ti(e,At,t):t.push(At(e.g)),!0)},function(e,t,r){if((t=xr(dr,t))!=null&&t.length){r=Qn(e,r);for(let i=0;i<t.length;i++)Fi(e.g,t[i]);Jn(e,r)}},es),_r=Ee(function(e,t,r){return e.h===0&&(fe(t,r,(e=At(e.g))===0?void 0:e),!0)},xa,es),ne=Ee(function(e,t,r){return e.h===0&&(fe(t,r,Hn(e.g)),!0)},Ea,sa),Yt=Ee(function(e,t,r){return e.h===0&&(fe(t,r,(e=Hn(e.g))===!1?void 0:e),!0)},Ea,sa),ve=Er(function(e,t,r){return e.h===2&&(e=qn(e),wr(t,0|t[E],r).push(e),!0)},function(e,t,r){if((t=xr(ye,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&Li(i,n,io(s))}},Rn),St=Ee(function(e,t,r){return e.h===2&&(fe(t,r,(e=qn(e))===""?void 0:e),!0)},_a,Rn),z=Ee(function(e,t,r){return e.h===2&&(fe(t,r,qn(e)),!0)},_a,Rn),ge=function(e,t,r=Zn){return new vr(e,t,r)}(function(e,t,r,i,n){return e.h===2&&(i=Vt(void 0,i),wr(t,0|t[E],r).push(i),Rr(e,i,n),!0)},function(e,t,r,i,n){if(Array.isArray(t)){for(let s=0;s<t.length;s++)ka(e,t[s],r,i,n);1&(e=0|t[E])||de(t,1|e)}}),se=Pi(function(e,t,r,i,n,s){if(e.h!==2)return!1;let a=0|t[E];return Ho(t,a,s,r,ar(a)),Rr(e,t=$n(t,i,r),n),!0},ka),Sa=Ee(function(e,t,r){return e.h===2&&(fe(t,r,ra(e)),!0)},Aa,ca),au=Er(function(e,t,r){return(e.h===0||e.h===2)&&(t=wr(t,0|t[E],r),e.h==2?Ti(e,mt,t):t.push(mt(e.g)),!0)},function(e,t,r){if((t=xr(Io,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&(He(i,n,0),yr(i.g,s))}},oa),cu=Ee(function(e,t,r){return e.h===0&&(fe(t,r,(e=mt(e.g))===0?void 0:e),!0)},function(e,t,r){(t=Io(t))!=null&&t!=null&&(He(e,r,0),yr(e.g,t))},oa),Me=Ee(function(e,t,r){return e.h===0&&(fe(t,r,At(e.g)),!0)},function(e,t,r){(t=dr(t))!=null&&(t=parseInt(t,10),He(e,r,0),Fi(e.g,t))},la);class lu{constructor(t,r){var i=De;this.g=t,this.h=r,this.m=V,this.j=S,this.defaultValue=void 0,this.l=i.Oa!=null?_o:void 0}register(){pi(this)}}function lt(e,t){return new lu(e,t)}function Nt(e,t){return(r,i)=>{{const s={ea:!0};i&&Object.assign(s,i),r=Ro(r,void 0,void 0,s);try{const a=new e,c=a.v;ns(t)(c,r);var n=a}finally{ea(r)}}return n}}function Vi(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}}}};ya(this.v,t,Kt(Oi,Ui,Gi,e)),br(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 Na=class extends _{constructor(e){super(e)}},Ta=[0,St,Ee(function(e,t,r){return e.h===2&&(fe(t,r,(e=ra(e))===Ot()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof _){const i=t.Ra;return void(i?(t=i(t),t!=null&&Li(e,r,zn(t,!0).buffer)):rr(xn,3))}if(Array.isArray(t))return void rr(xn,3)}Aa(e,t,r)},ca)];let as,Ia=globalThis.trustedTypes;function Fa(e){var t;return as===void 0&&(as=function(){let r=null;if(!Ia)return r;try{const i=n=>n;r=Ia.createPolicy("goog#html",{createHTML:i,createScript:i,createScriptURL:i})}catch{}return r}()),e=(t=as)?t.createScriptURL(e):e,new class{constructor(r){this.g=r}toString(){return this.g+""}}(e)}function du(e,...t){if(t.length===0)return Fa(e[0]);let r=e[0];for(let i=0;i<t.length;i++)r+=encodeURIComponent(t[i])+e[i+1];return Fa(r)}var La=[0,we,Me,ne,-1,ei,Me,-1,ne],uu=class extends _{constructor(e){super(e)}},Ma=[0,ne,z,ne,Me,-1,Er(function(e,t,r){return(e.h===0||e.h===2)&&(t=wr(t,0|t[E],r),e.h==2?Ti(e,Kd,t):t.push(At(e.g)),!0)},function(e,t,r){if((t=xr(dr,t))!=null&&t.length){r=Qn(e,r);for(let i=0;i<t.length;i++)Fi(e.g,t[i]);Jn(e,r)}},la),z,-1,[0,ne,-1],Me,ne,-1],Da=[0,3,ne,-1,2,[0,we],[0,Me,ne],[0,z,-1],[0]],Pa=[0,z,-2],Oa=class extends _{constructor(e){super(e)}},Ba=[0],Ua=[0,we,ne,1,ne,-4],De=class extends _{constructor(e){super(e,2)}},he={};he[336783863]=[0,z,ne,-1,we,[0,[1,2,3,4,5,6,7,8,9],se,Ba,se,Ma,se,Pa,se,Ua,se,La,se,[0,z,-2],se,[0,z,Me],se,Da,se,[0,Me,-1,ne]],[0,z],ne,[0,[1,3],[2,4],se,[0,ei],-1,se,[0,ve],-1,ge,[0,z,-1]],z];var Ga=[0,os,-1,Yt,-3,os,ei,St,_r,os,-1,Yt,_r,Yt,-2,St];function K(e,t){Ci(e,3,t)}function P(e,t){Ci(e,4,t)}var Ce=class extends _{constructor(e){super(e,500)}o(e){return S(this,0,7,e)}},ti=[-1,{}],Va=[0,z,1,ti],ja=[0,z,ve,ti];function qe(e,t){Wn(e,1,Ce,t)}function R(e,t){Ci(e,10,t)}function j(e,t){Ci(e,15,t)}var Pe=class extends _{constructor(e){super(e,500)}o(e){return S(this,0,1001,e)}},$a=[-500,ge,[-500,St,-1,ve,-3,[-2,he,ne],ge,Ta,_r,-1,Va,ja,ge,[0,St,Yt],St,Ga,_r,ve,987,ve],4,ge,[-500,z,-1,[-1,{}],998,z],ge,[-500,z,ve,-1,[-2,{},ne],997,ve,-1],_r,ge,[-500,z,ve,ti,998,ve],ve,_r,Va,ja,ge,[0,St,-1,ti],ve,-2,Ga,St,-1,Yt,[0,Yt,cu],978,ti,ge,Ta];Pe.prototype.g=Vi($a);var hu=Nt(Pe,$a),fu=class extends _{constructor(e){super(e)}},Wa=class extends _{constructor(e){super(e)}g(){return gt(this,fu,1)}},za=[0,ge,[0,we,ce,z,-1]],ji=Nt(Wa,za),wu=class extends _{constructor(e){super(e)}},gu=class extends _{constructor(e){super(e)}},cs=class extends _{constructor(e){super(e)}l(){return V(this,wu,2)}g(){return gt(this,gu,5)}},Ha=Nt(class extends _{constructor(e){super(e)}},[0,ve,ei,ss,[0,Me,[0,we,-3],[0,ce,-3],[0,we,-1,[0,ge,[0,we,-2]]],ge,[0,ce,-1,z,ce]],z,-1,Ct,ge,[0,we,ce],ve,Ct]),qa=class extends _{constructor(e){super(e)}},kr=Nt(class extends _{constructor(e){super(e)}},[0,ge,[0,ce,-4]]),Ka=class extends _{constructor(e){super(e)}},ri=Nt(class extends _{constructor(e){super(e)}},[0,ge,[0,ce,-4]]),pu=class extends _{constructor(e){super(e)}},mu=[0,we,-1,ss,Me],Ya=class extends _{constructor(e){super(e)}};Ya.prototype.g=Vi([0,ce,-4,Ct]);var yu=class extends _{constructor(e){super(e)}},bu=Nt(class extends _{constructor(e){super(e)}},[0,ge,[0,1,we,z,za],Ct]),Xa=class extends _{constructor(e){super(e)}},vu=class extends _{constructor(e){super(e)}na(){const e=q(this,1,void 0,void 0,Wo);return e??Ot()}},xu=class extends _{constructor(e){super(e)}},Qa=[1,2],Eu=Nt(class extends _{constructor(e){super(e)}},[0,ge,[0,Qa,se,[0,ss],se,[0,Sa],we,z],Ct]),ls=class extends _{constructor(e){super(e)}},Ja=[0,z,we,ce,ve,-1],Za=class extends _{constructor(e){super(e)}},_u=[0,ne,-1],Ra=class extends _{constructor(e){super(e)}},$i=[1,2,3,4,5,6],Wi=class extends _{constructor(e){super(e)}g(){return q(this,1,void 0,void 0,Wo)!=null}l(){return ye(q(this,2))!=null}},te=class extends _{constructor(e){super(e)}g(){return To(q(this,2))??!1}},ec=[0,Sa,z,[0,we,Ct,-1],[0,ou,Ct]],le=[0,ec,ne,[0,$i,se,Ua,se,Ma,se,La,se,Ba,se,Pa,se,Da],Me],zi=class extends _{constructor(e){super(e)}},ds=[0,le,ce,-1,we],ku=lt(502141897,zi);he[502141897]=ds;var Au=Nt(class extends _{constructor(e){super(e)}},[0,[0,Me,-1,nu,au],mu]),tc=class extends _{constructor(e){super(e)}},rc=class extends _{constructor(e){super(e)}},us=[0,le,ce,[0,le],ne],Cu=lt(508968150,rc);he[508968150]=[0,le,ds,us,ce,[0,[0,ec]]],he[508968149]=us;var Ar=class extends _{constructor(e){super(e)}l(){return V(this,ls,2)}g(){$(this,2)}},ic=[0,le,Ja];he[478825465]=ic;var Su=class extends _{constructor(e){super(e)}},nc=class extends _{constructor(e){super(e)}},hs=class extends _{constructor(e){super(e)}},fs=class extends _{constructor(e){super(e)}},sc=class extends _{constructor(e){super(e)}},oc=[0,le,[0,le],ic,-1],ac=[0,le,ce,we],ws=[0,le,ce],cc=[0,le,ac,ws,ce],Nu=lt(479097054,sc);he[479097054]=[0,le,cc,oc],he[463370452]=oc,he[464864288]=ac;var Tu=lt(462713202,fs);he[462713202]=cc,he[474472470]=ws;var Iu=class extends _{constructor(e){super(e)}},lc=class extends _{constructor(e){super(e)}},dc=class extends _{constructor(e){super(e)}},uc=class extends _{constructor(e){super(e)}},gs=[0,le,ce,-1,we],ps=[0,le,ce,ne];uc.prototype.g=Vi([0,le,ws,[0,le],ds,us,gs,ps]);var hc=class extends _{constructor(e){super(e)}},Fu=lt(456383383,hc);he[456383383]=[0,le,Ja];var fc=class extends _{constructor(e){super(e)}},Lu=lt(476348187,fc);he[476348187]=[0,le,_u];var wc=class extends _{constructor(e){super(e)}},gc=class extends _{constructor(e){super(e)}},pc=[0,Me,-1],Mu=lt(458105876,class extends _{constructor(e){super(e)}g(){let e;var t=this.v;const r=0|t[E];return e=Ie(this,r),t=function(i,n,s,a){var c=gc;!a&&hr(i)&&(s=0|(n=i.v)[E]);var l=wt(n,2);if(i=!1,l==null){if(a)return Bo();l=[]}else if(l.constructor===ft){if(!(2&l.J)||a)return l;l=l.V()}else Array.isArray(l)?i=!!(2&(0|l[E])):l=[];if(a){if(!l.length)return Bo();i||(i=!0,Wr(l))}else i&&(i=!1,zr(l),l=zo(l));return!i&&32&s&&$r(l,32),s=ue(n,s,2,a=new ft(l,c,Md,void 0)),i||jt(n,s),a}(this,t,r,e),!e&&gc&&(t.ra=!0),t}});he[458105876]=[0,pc,iu,[!0,Ct,[0,z,-1,ve]],[0,ei,ne,Me]];var ms=class extends _{constructor(e){super(e)}},mc=lt(458105758,ms);he[458105758]=[0,le,z,pc];var ys=class extends _{constructor(e){super(e)}},yc=[0,su,-1,Yt],Du=class extends _{constructor(e){super(e)}},bc=class extends _{constructor(e){super(e)}},bs=[1,2];bc.prototype.g=Vi([0,bs,se,yc,se,[0,ge,yc]]);var vc=class extends _{constructor(e){super(e)}},Pu=lt(443442058,vc);he[443442058]=[0,le,z,we,ce,ve,-1,ne,ce],he[514774813]=gs;var xc=class extends _{constructor(e){super(e)}},Ou=lt(516587230,xc);function vs(e,t){return t=t?t.clone():new ls,e.displayNamesLocale!==void 0?$(t,1,Qr(e.displayNamesLocale)):e.displayNamesLocale===void 0&&$(t,1),e.maxResults!==void 0?pt(t,2,e.maxResults):"maxResults"in e&&$(t,2),e.scoreThreshold!==void 0?A(t,3,e.scoreThreshold):"scoreThreshold"in e&&$(t,3),e.categoryAllowlist!==void 0?Ai(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&$(t,4),e.categoryDenylist!==void 0?Ai(t,5,e.categoryDenylist):"categoryDenylist"in e&&$(t,5),t}function Ec(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function xs(e,t=-1,r=""){return{categories:e.map(i=>({index:ze(i,1)??0??-1,score:ie(i,2)??0,categoryName:ye(q(i,3))??""??"",displayName:ye(q(i,4))??""??""})),headIndex:t,headName:r}}function Bu(e){const t={classifications:gt(e,yu,1).map(r=>{var i;return xs(((i=V(r,Wa,4))==null?void 0:i.g())??[],ze(r,2)??0,ye(q(r,3))??"")})};return function(r){return Ld(mn?q(r,2,void 0,void 0,xi):q(r,2))}(e)!=null&&(t.timestampMs=Ec(Xo(e))),t}function _c(e){var a,c;var t=Wt(e,3,ot,$t()),r=Wt(e,2,dr,$t()),i=Wt(e,1,ye,$t()),n=Wt(e,9,ye,$t());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=V(e,cs,4))==null?void 0:a.l())&&(s.boundingBox={originX:ze(t,1,_t)??0,originY:ze(t,2,_t)??0,width:ze(t,3,_t)??0,height:ze(t,4,_t)??0,angle:0}),(c=V(e,cs,4))==null?void 0:c.g().length)for(const l of V(e,cs,4).g())s.keypoints.push({x:q(l,1,void 0,_t,ot)??0,y:q(l,2,void 0,_t,ot)??0,score:q(l,4,void 0,_t,ot)??0,label:ye(q(l,3,void 0,_t))??""});return s}function Hi(e){const t=[];for(const r of gt(e,Ka,1))t.push({x:ie(r,1)??0,y:ie(r,2)??0,z:ie(r,3)??0,visibility:ie(r,4)??0});return t}function ii(e){const t=[];for(const r of gt(e,qa,1))t.push({x:ie(r,1)??0,y:ie(r,2)??0,z:ie(r,3)??0,visibility:ie(r,4)??0});return t}function kc(e){return Array.from(e,t=>t>127?t-256:t)}function Ac(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 qi;he[516587230]=[0,le,gs,ps,ce],he[518928384]=ps;const Uu=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 Cc(){if(qi===void 0)try{await WebAssembly.instantiate(Uu),qi=!0}catch{qi=!1}return qi}async function ni(e,t=du``){const r=await Cc()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Xt=class{};function Sc(){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 Nc(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)})}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function Tc(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 k(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 Ic(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]=Tc(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 Fc(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 dt(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function Tt(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)}}Xt.forVisionTasks=function(e){return ni("vision",e)},Xt.forTextTasks=function(e){return ni("text",e)},Xt.forGenAiExperimentalTasks=function(e){return ni("genai_experimental",e)},Xt.forGenAiTasks=function(e){return ni("genai",e)},Xt.forAudioTasks=function(e){return ni("audio",e)},Xt.isSimdSupported=function(){return Cc()};async function Gu(e,t,r,i){return e=await(async(n,s,a,c,l)=>{if(s&&await Nc(s),!self.ModuleFactory||a&&(await Nc(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 Es(e,t){const r=V(e.baseOptions,Wi,1)||new Wi;typeof t=="string"?($(r,2,Qr(t)),$(r,1)):t instanceof Uint8Array&&($(r,1,En(t,!1)),$(r,2)),S(e.baseOptions,0,1,r)}function Lc(e){try{const t=e.H.length;if(t===1)throw Error(e.H[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.H.map(r=>r.message).join(", "))}finally{e.H=[]}}function x(e,t){e.C=Math.max(e.C,t)}function Ki(e,t){e.B=new Ce,Le(e.B,2,"PassThroughCalculator"),K(e.B,"free_memory"),P(e.B,"free_memory_unused_out"),R(t,"free_memory"),qe(t,e.B)}function Cr(e,t){K(e.B,t),P(e.B,t+"_unused_out")}function Yi(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var _s=class{constructor(e){this.g=e,this.H=[],this.C=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=V(this.baseOptions,Wi,1))!=null&&n.g()||(s=V(this.baseOptions,Wi,1))!=null&&s.l()||(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(h,u){let f=V(h.baseOptions,Ra,3);if(!f){var w=f=new Ra,g=new Oa;Zr(w,4,$i,g)}"delegate"in u&&(u.delegate==="GPU"?(u=f,w=new uu,Zr(u,2,$i,w)):(u=f,w=new Oa,Zr(u,4,$i,w))),S(h.baseOptions,0,3,f)}(this,l),l.modelAssetPath)return fetch(l.modelAssetPath.toString()).then(h=>{if(h.ok)return h.arrayBuffer();throw Error(`Failed to fetch model: ${l.modelAssetPath} (${h.status})`)}).then(h=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(h),!0,!1,!1),Es(this,"/model.dat"),this.m(),this.L()});if(l.modelAssetBuffer instanceof Uint8Array)Es(this,l.modelAssetBuffer);else if(l.modelAssetBuffer)return async function(h){const u=[];for(var f=0;;){const{done:w,value:g}=await h.read();if(w)break;u.push(g),f+=g.length}if(u.length===0)return new Uint8Array(0);if(u.length===1)return u[0];h=new Uint8Array(f),f=0;for(const w of u)h.set(w,f),f+=w.length;return h}(l.modelAssetBuffer).then(h=>{Es(this,h),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca(t=>{e=hu(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,i)=>{this.H.push(Error(i))}),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,Lc(this)}finishProcessing(){this.g.finishProcessing(),Lc(this)}close(){this.B=void 0,this.g.closeGraph()}};function It(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}_s.prototype.close=_s.prototype.close;class Vu{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 Mc(e,t,r){const i=e.g;if(r=It(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 Dc(e,t){const r=e.g,i=It(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(i);const n=It(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,n),r.enableVertexAttribArray(e.O),r.vertexAttribPointer(e.O,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=It(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.L),r.vertexAttribPointer(e.L,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 Vu(r,i,n,s)}function ks(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function ju(e,t,r,i){return ks(e,t),e.h||(e.m(),e.D()),r?(e.u||(e.u=Dc(e,!0)),r=e.u):(e.A||(e.A=Dc(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=i(),r.g.bindVertexArray(null),e}function Pc(e,t,r){return ks(e,t),e=It(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 Oc(e,t,r){ks(e,t),e.B||(e.B=It(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.B),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function $u(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Bc=class{H(){return`
|
|
1
|
+
(function(be,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],o):(be=typeof globalThis<"u"?globalThis:be||self,o(be.InterviewWidget={},be.jsxRuntime,be.React,be.ReactDOM))})(this,function(be,o,d,Xs){"use strict";var u1=Object.defineProperty;var h1=(be,o,d)=>o in be?u1(be,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):be[o]=d;var ye=(be,o,d)=>h1(be,typeof o!="symbol"?o+"":o,d);var hn=typeof document<"u"?document.currentScript:null;const fn={},it={api:{baseUrl:"/api",retryConfig:{attempts:3,backoff:"exponential",baseDelay:1e3}},ui:{baseColor:"#3B82F6",borderRadius:"8px"},interview:{allow_answer_editing:!0,capture_screenshots:!1,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}}},wn="iw-storage";function Al(){if(!(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:hn&&hn.tagName.toUpperCase()==="SCRIPT"&&hn.src||new URL("widget.umd.js",document.baseURI).href}<"u"&&(fn!=null&&fn.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=Al(),hi=30,Cl={SCREENSHOT:"screenshot"},gn="AES-GCM",pn=12;async function Js(e){const r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return crypto.subtle.importKey("raw",i,gn,!1,["encrypt","decrypt"])}function Tl(){return crypto.getRandomValues(new Uint8Array(pn))}async function Nl(e,t="default-seed"){try{const r=typeof e=="string"?e:JSON.stringify(e),n=new TextEncoder().encode(r),s=await Js(t),a=Tl(),c=await crypto.subtle.encrypt({name:gn,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 Il(e,t="default-seed"){try{const r=atob(e),i=new Uint8Array(r.length);for(let h=0;h<r.length;h++)i[h]=r.charCodeAt(h);const n=i.slice(0,pn),s=i.slice(pn),a=await Js(t),c=await crypto.subtle.decrypt({name:gn,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 Fl(e,t="default-seed"){return Nl(e,t)}async function Ll(e,t="default-seed"){const r=await Il(e,t);try{return JSON.parse(r)}catch{return r}}const Ur=d.createContext(null),Ml=async()=>{try{const e=sessionStorage.getItem(wn);if(e){const r=(await Ll(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}}},Vr=async e=>{try{const t=await Fl({state:e,version:0},Qs);sessionStorage.setItem(wn,t)}catch(t){console.error("Failed to save proctoring data to session storage:",t)}},Dl=({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(()=>{Ml().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},Vr(t.current),i()},[i]),c=d.useCallback(w=>{const g={...t.current.gazeViolationCounters};w==="looking_away"&&(g.lookingAwayCount+=1),w==="no_face_detected"&&(g.noFaceDetectedCount+=1),w==="multiple_faces"&&(g.multipleFacesCount+=1),g.totalGazeViolations=g.lookingAwayCount+g.noFaceDetectedCount+g.multipleFacesCount,t.current={...t.current,gazeViolationCounters:g},Vr(t.current),i()},[i]),l=d.useCallback(()=>{t.current={...t.current,logViolations:[],totalViolations:0},Vr(t.current),i()},[i]),h=d.useCallback(()=>{t.current={...t.current,gazeViolationCounters:{lookingAwayCount:0,noFaceDetectedCount:0,multipleFacesCount:0,totalGazeViolations:0}},Vr(t.current),i()},[i]),u=d.useCallback((w,g)=>{t.current={...t.current,referenceSet:w,referenceRef:g},Vr(t.current),i()},[i]),f=d.useMemo(()=>({getState:s,addViolation:a,clearViolations:l,subscribe:n,incrementGazeViolation:c,clearGazeViolationCounters:h,setReferenceData:u}),[s,a,l,n,c,h,u]);return o.jsx(Ur.Provider,{value:f,children:e})},Zs=()=>{const e=d.useContext(Ur);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}},Pl=()=>{const e=d.useContext(Ur);if(!e)throw new Error("useViolations must be used within a ProctoringProvider");return d.useSyncExternalStore(e.subscribe,()=>e.getState().logViolations,()=>e.getState().logViolations)},Ol=()=>{const e=d.useContext(Ur);if(!e)throw new Error("useTotalViolations must be used within a ProctoringProvider");return d.useSyncExternalStore(e.subscribe,()=>e.getState().totalViolations,()=>e.getState().totalViolations)},Bl=()=>{const e=d.useContext(Ur);if(!e)throw new Error("useProctoringActions must be used within a ProctoringProvider");return{addViolation:e.addViolation,clearViolations:e.clearViolations}},Rs=d.createContext(null);function eo({config:e={},children:t}){var i,n,s,a;const r={api:{...it.api,...e.api,retryConfig:{...it.api.retryConfig,...(i=e.api)==null?void 0:i.retryConfig}},ui:{...it.ui,...e.ui},interview:{...it.interview,...e.interview,timers:{...it.interview.timers,...(n=e.interview)==null?void 0:n.timers},stt:{...it.interview.stt,...(s=e.interview)==null?void 0:s.stt},tts:{...it.interview.tts,...(a=e.interview)==null?void 0:a.tts}}};return o.jsx(Rs.Provider,{value:r,children:o.jsx(Dl,{children:t})})}function fi(){const e=d.useContext(Rs);if(!e)throw new Error("useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>");return e}function to(){return fi().api||it.api}function Zt(){return fi().ui||it.ui}function mn(){return fi().interview||it.interview}function Ul(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 Vl(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 Gl(e,t){const r=Ul(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 Vl(i,n,s)}function jl(e){return new Promise(t=>setTimeout(t,e))}function zl(e){return`linear-gradient(to left, ${Gl(e,.4)}, ${e})`}const $l=()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);function Wl(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 Hl=e=>{var t;return!e||typeof e!="string"?"":(t=e.charAt(0))==null?void 0:t.toUpperCase()},yn=(e,t)=>{const r=Math.max(0,Math.floor(e));if(t&&r<60)return`${r}`;const i=Math.floor(r/60).toString().padStart(2,"0"),n=(r%60).toString().padStart(2,"0");return`${i}:${n}`},bn=({brandLogo:e,brandName:t,className:r="",showFallbackStyles:i=!0})=>{const{baseColor:n}=Zt();return e?o.jsx("div",{className:r,children:e}):o.jsx("div",{className:i?`iw-h-7 iw-w-7 iw-rounded-md iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold ${r}`:r,style:i?{backgroundColor:n}:{},children:Hl(t)})},ql=e=>{const t=d.useRef(null),r=d.useRef(null),[i,n]=d.useState(!1),[s,a]=d.useState(!1),[c,l]=d.useState(null),[h,u]=d.useState([]),[f,w]=d.useState([]),[g,p]=d.useState(""),[y,m]=d.useState(""),[b,v]=d.useState(!1),I=d.useCallback(()=>{r.current&&(r.current.getTracks().forEach(F=>F.stop()),r.current=null,l(null))},[]),C=d.useCallback(async()=>{var F,D,G,Y;try{const H=await navigator.mediaDevices.enumerateDevices(),q=H.filter(O=>O.kind==="audioinput"),Z=H.filter(O=>O.kind==="videoinput");if(u(q),w(Z),!g&&q.length>0){const O=(F=r.current)==null?void 0:F.getAudioTracks()[0],R=O==null?void 0:O.getSettings().deviceId;p(R||((D=q[0])==null?void 0:D.deviceId)||"")}if(!y&&Z.length>0){const O=(G=r.current)==null?void 0:G.getVideoTracks()[0],R=O==null?void 0:O.getSettings().deviceId;m(R||((Y=Z[0])==null?void 0:Y.deviceId)||"")}}catch(H){console.error("Error enumerating devices:",H)}},[g,y]),S=d.useCallback(async(F,D)=>{const G={width:{ideal:1280},height:{ideal:720},...D?{deviceId:{exact:D}}:{facingMode:"user"}},Y={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:{ideal:48e3},channelCount:{ideal:1},...F?{deviceId:{exact:F}}:{}};let H=null;try{H=await navigator.mediaDevices.getUserMedia({video:G,audio:Y}),n(!0),a(!0)}catch(q){console.warn("Combined media request failed, trying individual.",q);try{const Z=await navigator.mediaDevices.getUserMedia({audio:Y});n(!0),H=Z}catch(Z){console.error("Audio permission denied",Z),n(!1)}try{const Z=await navigator.mediaDevices.getUserMedia({video:G});a(!0),H?Z.getTracks().forEach(O=>H.addTrack(O)):H=Z}catch(Z){console.error("Video permission denied",Z),a(!1)}}H?(r.current=H,l(H),t.current&&(t.current.srcObject=H,await t.current.play().catch(q=>console.error("Error playing video element",q)))):(r.current=null,l(null)),await C()},[C]),A=async F=>{F!==g&&(v(!0),p(F),I(),await S(F,y),v(!1))},M=async F=>{F!==y&&(v(!0),m(F),I(),await S(g,F),v(!1))};return d.useEffect(()=>{if(!e){I();return}return S(),()=>I()},[e]),{videoRef:t,audioAllowed:i,videoAllowed:s,audioDevices:h,videoDevices:f,selectedAudioDeviceId:g,selectedVideoDeviceId:y,isDeviceLoading:b,currentStream:c,handleAudioChange:A,handleVideoChange:M,stopStream:I}},wi=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"})]}),Kl=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})]}),Yl=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"})]}),gi=e=>o.jsx("svg",{width:"10",height:"9",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M0.75 5.5C0.75 5.5 2.35 6.4125 3.15 7.75C3.15 7.75 5.55 2.5 8.75 0.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Xl=({className:e})=>o.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:o.jsx("path",{d:"M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),ro=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"})]}),pi=e=>o.jsx("svg",{className:"iw-w-5 iw-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",...e,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),Ql=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"})]}),Jl=e=>o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M2.66797 2H13.3346",stroke:"#5C6686",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M3.66797 2V3.35359C3.66797 4.18151 4.05252 4.96247 4.70874 5.46726L8.0013 8L11.2938 5.46726C11.9501 4.96247 12.3346 4.18151 12.3346 3.35359V2",stroke:"#5C6686",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M3.66797 14V12.6464C3.66797 11.8185 4.05252 11.0375 4.70874 10.5327L8.0013 8L11.2938 10.5327C11.9501 11.0375 12.3346 11.8185 12.3346 12.6464V14",stroke:"#5C6686",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M2.66797 14H13.3346",stroke:"#5C6686",strokeLinecap:"round",strokeLinejoin:"round"})]}),io=({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"})]})}),Zl=e=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M17 7V11C17 13.7614 14.7614 16 12 16C9.23858 16 7 13.7614 7 11V7C7 4.23858 9.23858 2 12 2C14.7614 2 17 4.23858 17 7Z",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M20 11C20 15.4183 16.4183 19 12 19M12 19C7.58172 19 4 15.4183 4 11M12 19V22M12 22H15M12 22H9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),no=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})]}),Rl=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})]}),ed=e=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M11 8H13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M2 11C2 7.70017 2 6.05025 3.02513 5.02513C4.05025 4 5.70017 4 9 4H10C13.2998 4 14.9497 4 15.9749 5.02513C17 6.05025 17 7.70017 17 11V13C17 16.2998 17 17.9497 15.9749 18.9749C14.9497 20 13.2998 20 10 20H9C5.70017 20 4.05025 20 3.02513 18.9749C2 17.9497 2 16.2998 2 13V11Z",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M17 8.90585L17.1259 8.80196C19.2417 7.05623 20.2996 6.18336 21.1498 6.60482C22 7.02628 22 8.42355 22 11.2181V12.7819C22 15.5765 22 16.9737 21.1498 17.3952C20.2996 17.8166 19.2417 16.9438 17.1259 15.198L17 15.0941",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),td=e=>o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M8.16651 8.63991V5.35747C8.16651 3.52277 8.16651 2.60542 7.62675 2.37712C7.08699 2.14882 6.45168 2.79749 5.18119 4.09482C4.52323 4.76666 4.14784 4.91543 3.2117 4.91543C2.39301 4.91543 1.98366 4.91543 1.68961 5.11606C1.07921 5.53252 1.17148 6.34653 1.17148 6.9987C1.17148 7.65086 1.07921 8.46485 1.68961 8.88135C1.98366 9.08196 2.39301 9.08196 3.2117 9.08196C4.14784 9.08196 4.52323 9.23076 5.18119 9.90259C6.45168 11.1999 7.08699 11.8486 7.62675 11.6203C8.16651 11.392 8.16651 10.4746 8.16651 8.63991Z",stroke:"currentColor",strokeWidth:"0.875",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M9.9165 5.25C10.2813 5.72815 10.4998 6.33698 10.4998 7C10.4998 7.66302 10.2813 8.27184 9.9165 8.75",stroke:"currentColor",strokeWidth:"0.875",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M11.6665 4.08203C12.3961 4.87894 12.8332 5.89369 12.8332 6.9987C12.8332 8.10371 12.3961 9.11847 11.6665 9.91536",stroke:"currentColor",strokeWidth:"0.875",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ce={FACE_DETECTED:"face_detected",NO_FACE:"no_face_detected",MULTIPLE_FACES:"multiple_faces",LOOKING_AWAY:"looking_away",CAMERA_ERROR:"camera_error",MODEL_LOADING:"model_loading"},so={[Ce.FACE_DETECTED]:{icon:Ql,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"},[Ce.NO_FACE]:{icon:Yl,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"},[Ce.MULTIPLE_FACES]:{icon:Rl,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 on the screen.",buttonText:"I Understood"},[Ce.LOOKING_AWAY]:{icon:no,iconColor:"iw-text-amber-600",iconBg:"iw-bg-amber-50",iconBorder:"iw-border-amber-200/75",title:"Focus Alert",subtitle:"You looked away from the screen. Maintain focus to continue.",buttonText:"I Understood"},[Ce.CAMERA_ERROR]:{icon:wi,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, contact support if the problem continues.",buttonText:"I Understood"},[Ce.MODEL_LOADING]:{icon:no,iconColor:"iw-text-blue-600",iconBg:"iw-bg-blue-50",iconBorder:"iw-border-blue-100",title:"Initializing Model",subtitle:"Please wait while we set up the AI",description:"The face detection model is being loaded. This should only take a moment.",buttonText:"Wait"}};function rd(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 xt(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=rd(s);if(!a.retryable||n===r.attempts)throw a;const c=id(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 id(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)}const Et={v2:"/v2"},_t={GENERATE_QUESTION:e=>`${Et.v2}/interviews/${e}/next-question`,SCREENSHOT_UPLOAD:e=>`${Et.v2}/interviews/${e}/assets/upload-url`,CONFIRM_UPLOAD:e=>`${Et.v2}/interviews/assets/${e}/confirm`,TRANSCRIBE_ANSWER:e=>`${Et.v2}/interviews/${e}/transcribe-answer`,SUBMIT_ANSWER:e=>`${Et.v2}/interviews/${e}/submit-answer`,EXIT:e=>`${Et.v2}/interviews/${e}/exit`,CONFIG:e=>`${Et.v2}/interviews/${e}/config`,TRANSCRIPTION:e=>`${Et.v2}/interviews/${e}/transcript`};class oo{constructor(t={}){ye(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}){const i=await xt(`${this.getBaseUrl()}${_t.GENERATE_QUESTION(t)}`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({interview_id:t,is_interview_done:r})});if(!i.ok)throw new Error(`Failed to get questions: ${i.status}`);return await i.json()}async submitAnswer({interviewId:t,qnaId:r,answer:i}){const n=await xt(`${this.getBaseUrl()}${_t.SUBMIT_ANSWER(t)}`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({qna_id:r,answer_text:i})});if(!n.ok)throw new Error(`Failed to submit answer: ${n.status}`);return await n.json()}async exitInterview(t){const r=await xt(`${this.getBaseUrl()}${_t.EXIT(t)}`,{method:"POST",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to exit interview: ${r.status}`)}async getInterviewConfig(t){const r=await xt(`${this.getBaseUrl()}${_t.CONFIG(t)}`,{method:"GET",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to get interview config: ${r.status}`);return await r.json()}async requestScreenshotUploadUrl(t,r=`screenshot-${Date.now()}.jpeg`){const i=await xt(`${this.getBaseUrl()}${_t.SCREENSHOT_UPLOAD(t)}`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({filename:r,mime_type:"image/jpeg",asset_type:Cl.SCREENSHOT})});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}`)}async confirmScreenshotUpload(t){const r=await xt(`${this.getBaseUrl()}${_t.CONFIRM_UPLOAD(t)}`,{method:"POST",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to confirm screenshot upload: ${r.status}`)}async getInterviewTranscription(t){const r=await xt(`${this.getBaseUrl()}${_t.TRANSCRIPTION(t)}`,{method:"GET",headers:{...this.getHeaders()}});if(!r.ok)throw new Error(`Failed to get interview transcription: ${r.status}`);return await r.json()}}const mi=new oo,nd=({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."]})]})}),sd=({showControls:e,isBubbleOpen:t,setIsBubbleOpen:r,setReference:i,clearCache:n,isModelLoaded:s,gazeAnalysisEnabled:a,referenceSet:c,showLandmarks:l,setShowLandmarks:h,showEngagementBar:u,setShowEngagementBar:f,handleToggleGazeAnalysis:w,stats:g,statusMessage:p,loadingProgress:y})=>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(Kl,{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:m=>w(m.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:m=>h(m.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:u,onChange:m=>f(m.target.checked),disabled:!a}),"Show Engagement Bar"]})]}),c&&o.jsx(nd,{gazeAnalysisEnabled:a,isModelLoaded:s,loadingProgress:y,stats:g,statusMessage:p})]})]}):null;var Rt=typeof self<"u"?self:{};function Gr(e,t){e:{for(var r=["CLOSURE_FLAGS"],i=Rt,n=0;n<r.length;n++)if((i=i[r[n]])==null){r=null;break e}r=i}return(e=r&&r[e])!=null?e:t}function Ot(){throw Error("Invalid UTF8")}function ao(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let yi,vn;const od=typeof TextDecoder<"u";let ad;const cd=typeof TextEncoder<"u";function co(e){if(cd)e=(ad||(ad=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}function lo(e){Rt.setTimeout(()=>{throw e},0)}var xn,ld=Gr(610401301,!1),uo=Gr(748402147,!0),En=Gr(824648567,!0),_n=Gr(824656860,Gr(1,!0));function ho(){var e=Rt.navigator;return e&&(e=e.userAgent)?e:""}const fo=Rt.navigator;function bi(e){return bi[" "](e),e}xn=fo&&fo.userAgentData||null,bi[" "]=function(){};const wo={};let jr=null;function dd(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(h){for(;l<s.length;){const u=s.charAt(l++),f=jr[u];if(f!=null)return f;if(!/^[\s\xa0]*$/.test(u))throw Error("Unknown base64 encoding at char: "+u)}return h}go();let l=0;for(;;){const h=c(-1),u=c(0),f=c(64),w=c(64);if(w===64&&h===-1)break;a(h<<2|u>>4),f!=64&&(a(u<<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 go(){if(!jr){jr={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const i=e.concat(t[r].split(""));wo[r]=i;for(let n=0;n<i.length;n++){const s=i[n];jr[s]===void 0&&(jr[s]=n)}}}}var ud=typeof Uint8Array<"u",po=!(!(ld&&xn&&xn.brands.length>0)&&(ho().indexOf("Trident")!=-1||ho().indexOf("MSIE")!=-1))&&typeof btoa=="function";const mo=/[-_.]/g,hd={"-":"+",_:"/",".":"="};function fd(e){return hd[e]||""}function yo(e){if(!po)return dd(e);e=mo.test(e)?e.replace(mo,fd):e,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 kn(e){return ud&&e!=null&&e instanceof Uint8Array}var er={};function Bt(){return wd||(wd=new nt(null,er))}function Sn(e){bo(er);var t=e.g;return(t=t==null||kn(t)?t:typeof t=="string"?yo(t):null)==null?t:e.g=t}var nt=class{h(){return new Uint8Array(Sn(this)||0)}constructor(e,t){if(bo(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let wd,gd;function bo(e){if(e!==er)throw Error("illegal external caller")}function vo(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function An(e){return vo(e=Error(e),"warning"),e}function tr(e,t){if(e!=null){var r=gd??(gd={}),i=r[e]||0;i>=t||(r[e]=i+1,vo(e=Error(),"incident"),lo(e))}}function rr(){return typeof BigInt=="function"}var ir=typeof Symbol=="function"&&typeof Symbol()=="symbol";function st(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 pd=st("jas",void 0,!0),xo=st(void 0,"0di"),zr=st(void 0,"1oa"),Ie=st(void 0,Symbol()),md=st(void 0,"0ub"),yd=st(void 0,"0ubs"),Cn=st(void 0,"0ubsb"),bd=st(void 0,"0actk"),nr=st("m_m","Pa",!0),Eo=st();const _o={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},ko=Object.defineProperties,E=ir?pd:"Ga";var Ut;const So=[];function $r(e,t){ir||E in e||ko(e,_o),e[E]|=t}function de(e,t){ir||E in e||ko(e,_o),e[E]=t}function Wr(e){return $r(e,34),e}function Hr(e){return $r(e,8192),e}de(So,7),Ut=Object.freeze(So);var sr={};function Fe(e,t){return t===void 0?e.h!==Vt&&!!(2&(0|e.v[E])):!!(2&t)&&e.h!==Vt}const Vt={};function Tn(e,t){if(e!=null){if(typeof e=="string")e=e?new nt(e,er):Bt();else if(e.constructor!==nt)if(kn(e))e=e.length?new nt(new Uint8Array(e),er):Bt();else{if(!t)throw Error();e=void 0}}return e}class Ao{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}}var vd=Object.freeze({});function Co(e,t,r){const i=128&t?0:-1,n=e.length;var s;(s=!!n)&&(s=(s=e[n-1])!=null&&typeof s=="object"&&s.constructor===Object);const a=n+(s?-1:0);for(t=128&t?1:0;t<a;t++)r(t-i,e[t]);if(s){e=e[n-1];for(const c in e)!isNaN(c)&&r(+c,e[c])}}var To={};function or(e){return 128&e?To:void 0}function vi(e){return e.Na=!0,e}var xd=vi(e=>typeof e=="number"),No=vi(e=>typeof e=="string"),Ed=vi(e=>typeof e=="boolean"),xi=typeof Rt.BigInt=="function"&&typeof Rt.BigInt(0)=="bigint";function Le(e){var t=e;if(No(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(xd(t)&&!Number.isSafeInteger(t))throw Error(String(t));return xi?BigInt(e):e=Ed(e)?e?"1":"0":No(e)?e.trim()||"0":String(e)}var Nn=vi(e=>xi?e>=kd&&e<=Ad:e[0]==="-"?Io(e,_d):Io(e,Sd));const _d=Number.MIN_SAFE_INTEGER.toString(),kd=xi?BigInt(Number.MIN_SAFE_INTEGER):void 0,Sd=Number.MAX_SAFE_INTEGER.toString(),Ad=xi?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Io(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 Cd=typeof Uint8Array.prototype.slice=="function";let Td,ee=0,ae=0;function Fo(e){const t=e>>>0;ee=t,ae=(e-t)/4294967296>>>0}function ar(e){if(e<0){Fo(-e);const[t,r]=Dn(ee,ae);ee=t>>>0,ae=r>>>0}else Fo(e)}function In(e){const t=Td||(Td=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),ae=0,ee=t.getUint32(0,!0)}function Fn(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:qr(e,t)}function Nd(e,t){return Le(rr()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):qr(e,t))}function Ln(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Fn(e,t))=="number"?r?-e:e:r?"-"+e:e}function Lo(e,t){return rr()?Le(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):Le(Mn(e,t))}function qr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else rr()?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+Mo(r)+Mo(e));return r}function Mo(e){return e=String(e),"0000000".slice(e.length)+e}function Mn(e,t){if(2147483648&t)if(rr())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,i]=Dn(e,t);e="-"+qr(r,i)}else e=qr(e,t);return e}function Ei(e){if(e.length<16)ar(Number(e));else if(rr())e=BigInt(e),ee=Number(e&BigInt(4294967295))>>>0,ae=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");ae=ee=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));ae*=1e6,ee=1e6*ee+s,ee>=4294967296&&(ae+=Math.trunc(ee/4294967296),ae>>>=0,ee>>>=0)}if(t){const[i,n]=Dn(ee,ae);ee=i,ae=n}}}function Dn(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Ze(e){return Array.prototype.slice.call(e)}const Kr=typeof BigInt=="function"?BigInt.asIntN:void 0,Id=typeof BigInt=="function"?BigInt.asUintN:void 0,Gt=Number.isSafeInteger,_i=Number.isFinite,cr=Math.trunc,Fd=Le(0);function Yr(e){if(e!=null&&typeof e!="number")throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);return e}function ot(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Xr(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}function Do(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const Ld=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Qr(e){switch(typeof e){case"bigint":return!0;case"number":return _i(e);case"string":return Ld.test(e);default:return!1}}function lr(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return _i(e)?0|e:void 0}function Po(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return _i(e)?e>>>0:void 0}function Oo(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(Ei(e),Mn(ee,ae))}function Pn(e){return e=cr(e),Gt(e)||(ar(e),e=Ln(ee,ae)),e}function Bo(e){var t=cr(Number(e));return Gt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Oo(e))}function Uo(e){var t=cr(Number(e));return Gt(t)?Le(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),rr()?Le(Kr(64,BigInt(e))):Le(Oo(e)))}function Vo(e){return Gt(e)?e=Le(Pn(e)):(e=cr(e),Gt(e)?e=String(e):(ar(e),e=Mn(ee,ae)),e=Le(e)),e}function Md(e){return e==null?e:typeof e=="bigint"?(Nn(e)?e=Number(e):(e=Kr(64,e),e=Nn(e)?Number(e):String(e)),e):Qr(e)?typeof e=="number"?Pn(e):Bo(e):void 0}function ki(e){const t=typeof e;return e==null?e:t==="bigint"?Le(Kr(64,e)):Qr(e)?t==="string"?Uo(e):Vo(e):void 0}function Go(e){if(typeof e!="string")throw Error();return e}function Jr(e){if(e!=null&&typeof e!="string")throw Error();return e}function ve(e){return e==null||typeof e=="string"?e:void 0}function On(e,t,r,i){return e!=null&&e[nr]===sr?e:Array.isArray(e)?((i=(r=0|e[E])|32&i|2&i)!==r&&de(e,i),new t(e)):(r?2&i?((e=t[xo])||(Wr((e=new t).v),e=t[xo]=e),t=e):t=new t:t=void 0,t)}function Dd(e,t,r){if(t)e:{if(!Qr(t=e))throw An("int64");switch(typeof t){case"string":t=Uo(t);break e;case"bigint":t=Le(Kr(64,t));break e;default:t=Vo(t)}}else t=ki(e);return(e=t)==null?r?Fd:void 0:e}const Pd={};let Od=function(){try{return bi(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class Bn{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 Bd=Od?(Object.setPrototypeOf(Bn.prototype,Map.prototype),Object.defineProperties(Bn.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Bn):class extends Map{constructor(){super()}};function jo(e){return e}function Un(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var gt=class extends Bd{constructor(e,t,r=jo,i=jo){super(),this.J=0|e[E],this.K=t,this.S=r,this.fa=this.K?Ud:i;for(let n=0;n<e.length;n++){const s=e[n],a=r(s[0],!1,!0);let c=s[1];t?c===void 0&&(c=null):c=i(s[1],!1,!0,void 0,void 0,this.J),super.set(a,c)}}V(e){return Hr(Array.from(super.entries(),e))}clear(){Un(this),super.clear()}delete(e){return Un(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new Ao(e,Vd,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new Ao(e,gt.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach((r,i,n)=>{e.call(t,n.get(i),i,n)}):super.forEach(e,t)}set(e,t){return Un(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),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.K;return r?((r=this.fa(t,!1,!0,r,this.ra,this.J))!==t&&super.set(e,r),r):t}}[Symbol.iterator](){return this.entries()}};function Ud(e,t,r,i,n,s){return e=On(e,i,r,s),n&&(e=jn(e)),e}function Vd(e){return[e,this.get(e)]}let Gd;function zo(){return Gd||(Gd=new gt(Wr([]),void 0,void 0,void 0,Pd))}function Si(e){return Ie?e[Ie]:void 0}function Ai(e,t){for(const r in e)!isNaN(r)&&t(e,+r,e[r])}gt.prototype.toJSON=void 0;var Vn=class{};const jd={Ka:!0};function zd(e,t){t<100||tr(yd,1)}function Ci(e,t,r,i){const n=i!==void 0;i=!!i;var s,a=Ie;!n&&ir&&a&&(s=e[a])&&Ai(s,zd),a=[];var c=e.length;let l;s=4294967295;let h=!1;const u=!!(64&t),f=u?128&t?0:-1:void 0;1&t||(l=c&&e[c-1],l!=null&&typeof l=="object"&&l.constructor===Object?s=--c:l=void 0,!u||128&t||n||(h=!0,s=s-f+f)),t=void 0;for(var w=0;w<c;w++){let g=e[w];if(g!=null&&(g=r(g,i))!=null)if(u&&w>=s){const p=w-f;(t??(t={}))[p]=g}else a[w]=g}if(l)for(let g in l){if((c=l[g])==null||(c=r(c,i))==null)continue;let p;w=+g,u&&!Number.isNaN(w)&&(p=w+f)<s?a[p]=c:(t??(t={}))[g]=c}return t&&(h?a.push(t):a[s]=t),n&&Ie&&(e=Si(e))&&e instanceof Vn&&(a[Ie]=function(g){const p=new Vn;return Ai(g,(y,m,b)=>{p[m]=Ze(b)}),p.da=g.da,p}(e)),a}function $d(e){return e[0]=Zr(e[0]),e[1]=Zr(e[1]),e}function Zr(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return Nn(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[E];return e.length===0&&1&t?void 0:Ci(e,t,Zr)}if(e!=null&&e[nr]===sr)return $o(e);if(e instanceof nt){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(po){for(var r="",i=0,n=t.length-10240;i<n;)r+=String.fromCharCode.apply(null,t.subarray(i,i+=10240));r+=String.fromCharCode.apply(null,i?t.subarray(i):t),t=btoa(r)}else{r===void 0&&(r=0),go(),r=wo[r],i=Array(Math.floor(t.length/3)),n=r[64]||"";let h=0,u=0;for(;h<t.length-2;h+=3){var s=t[h],a=t[h+1],c=t[h+2],l=r[s>>2];s=r[(3&s)<<4|a>>4],a=r[(15&a)<<2|c>>6],c=r[63&c],i[u++]=l+s+a+c}switch(l=0,c=n,t.length-h){case 2:c=r[(15&(l=t[h+1]))<<2]||n;case 1:t=t[h],i[u]=r[t>>2]+r[(3&t)<<4|l>>4]+c+n}t=i.join("")}e=e.g=t}return e}return e instanceof gt?e=e.size!==0?e.V($d):void 0:void 0}return e}function $o(e){return Ci(e=e.v,0|e[E],Zr)}let Wd,Hd;function jt(e,t){return Wo(e,t[0],t[1])}function Wo(e,t,r,i=0){if(e==null){var n=32;r?(e=[r],n|=128):e=[],t&&(n=-16760833&n|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(n=0|e[E],uo&&1&n)throw Error("rfarr");if(2048&n&&!(2&n)&&function(){if(uo)throw Error("carr");tr(bd,5)}(),256&n)throw Error("farr");if(64&n)return(n|i)!==n&&de(e,n|i),e;if(r&&(n|=128,r!==e[0]))throw Error("mid");e:{n|=64;var s=(r=e).length;if(s){var a=s-1;const l=r[a];if(l!=null&&typeof l=="object"&&l.constructor===Object){if((a-=t=128&n?0:-1)>=1024)throw Error("pvtlmt");for(var c in l)(s=+c)<a&&(r[s+t]=l[c],delete l[c]);n=-16760833&n|(1023&a)<<14;break e}}if(t){if((c=Math.max(t,s-(128&n?0:-1)))>1024)throw Error("spvt");n=-16760833&n|(1023&c)<<14}}}return de(e,64|n|i),e}function qd(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var r=0|e[E];return e.length===0&&1&r?void 0:Ho(e,r,t)}if(e!=null&&e[nr]===sr)return qo(e);if(e instanceof gt){if(2&(t=e.J))return e;if(!e.size)return;if(r=Wr(e.V()),e.K)for(e=0;e<r.length;e++){const i=r[e];let n=i[1];n=n==null||typeof n!="object"?void 0:n!=null&&n[nr]===sr?qo(n):Array.isArray(n)?Ho(n,0|n[E],!!(32&t)):void 0,i[1]=n}return r}return e instanceof nt?e:void 0}function Ho(e,t,r){return 2&t||(!r||4096&t||16&t?e=dr(e,t,!1,r&&!(16&t)):($r(e,34),4&t&&Object.freeze(e))),e}function Gn(e,t,r){return e=new e.constructor(t),r&&(e.h=Vt),e.m=Vt,e}function qo(e){const t=e.v,r=0|t[E];return Fe(e,r)?e:zn(e,t,r)?Gn(e,t):dr(t,r)}function dr(e,t,r,i){return i??(i=!!(34&t)),e=Ci(e,t,qd,i),i=32,r&&(i|=2),de(e,t=16769217&t|i),e}function jn(e){const t=e.v,r=0|t[E];return Fe(e,r)?zn(e,t,r)?Gn(e,t,!0):new e.constructor(dr(t,r,!1)):e}function ur(e){if(e.h!==Vt)return!1;var t=e.v;return $r(t=dr(t,0|t[E]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function hr(e){if(!ur(e)&&Fe(e,0|e.v[E]))throw Error()}function zt(e,t){t===void 0&&(t=0|e[E]),32&t&&!(4096&t)&&de(e,4096|t)}function zn(e,t,r){return!!(2&r)||!(!(32&r)||4096&r)&&(de(t,2|r),e.h=Vt,!0)}const Kd=Le(0),kt={};function X(e,t,r,i,n){if((t=pt(e.v,t,r,n))!==null||i&&e.m!==Vt)return t}function pt(e,t,r,i){if(t===-1)return null;const n=t+(r?0:-1),s=e.length-1;let a,c;if(!(s<1+(r?0:-1))){if(n>=s)if(a=e[s],a!=null&&typeof a=="object"&&a.constructor===Object)r=a[t],c=!0;else{if(n!==s)return;r=a}else r=e[n];if(i&&r!=null){if((i=i(r))==null)return i;if(!Object.is(i,r))return c?a[t]=i:e[n]=i,i}return r}}function $(e,t,r,i){hr(e),ue(e=e.v,0|e[E],t,r,i)}function ue(e,t,r,i,n){const s=r+(n?0:-1);var a=e.length-1;if(a>=1+(n?0:-1)&&s>=a){const c=e[a];if(c!=null&&typeof c=="object"&&c.constructor===Object)return c[r]=i,t}return s<=a?(e[s]=i,t):(i!==void 0&&(r>=(a=(t??(t=0|e[E]))>>14&1023||536870912)?i!=null&&(e[a+(n?0:-1)]={[r]:i}):e[s]=i),t)}function $t(){return vd===void 0?2:4}function Wt(e,t,r,i,n){let s=e.v,a=0|s[E];i=Fe(e,a)?1:i,n=!!n||i===3,i===2&&ur(e)&&(s=e.v,a=0|s[E]);let c=(e=$n(s,t))===Ut?7:0|e[E],l=Wn(c,a);var h=!(4&l);if(h){4&l&&(e=Ze(e),c=0,l=qt(l,a),a=ue(s,a,t,e));let u=0,f=0;for(;u<e.length;u++){const w=r(e[u]);w!=null&&(e[f++]=w)}f<u&&(e.length=f),r=-513&(4|l),l=r&=-1025,l&=-4097}return l!==c&&(de(e,l),2&l&&Object.freeze(e)),Ko(e,l,s,a,t,i,h,n)}function Ko(e,t,r,i,n,s,a,c){let l=t;return s===1||s===4&&(2&t||!(16&t)&&32&i)?Ht(t)||((t|=!e.length||a&&!(4096&t)||32&i&&!(4096&t||16&t)?2:256)!==l&&de(e,t),Object.freeze(e)):(s===2&&Ht(t)&&(e=Ze(e),l=0,t=qt(t,i),i=ue(r,i,n,e)),Ht(t)||(c||(t|=16),t!==l&&de(e,t))),2&t||!(4096&t||16&t)||zt(r,i),e}function $n(e,t,r){return e=pt(e,t,r),Array.isArray(e)?e:Ut}function Wn(e,t){return 2&t&&(e|=2),1|e}function Ht(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Yo(e){return Tn(e,!0)}function Xo(e){e=Ze(e);for(let t=0;t<e.length;t++){const r=e[t]=Ze(e[t]);Array.isArray(r[1])&&(r[1]=Wr(r[1]))}return Hr(e)}function St(e,t,r,i){hr(e),ue(e=e.v,0|e[E],t,(i==="0"?Number(r)===0:r===i)?void 0:r)}function fr(e,t,r){if(2&t)throw Error();const i=or(t);let n=$n(e,r,i),s=n===Ut?7:0|n[E],a=Wn(s,t);return(2&a||Ht(a)||16&a)&&(a===s||Ht(a)||de(n,a),n=Ze(n),s=0,a=qt(a,t),ue(e,t,r,n,i)),a&=-13,a!==s&&de(n,a),n}function Hn(e,t){var r=tc;return Kn(qn(e=e.v),e,void 0,r)===t?t:-1}function qn(e){if(ir)return e[zr]??(e[zr]=new Map);if(zr in e)return e[zr];const t=new Map;return Object.defineProperty(e,zr,{value:t}),t}function Qo(e,t,r,i,n){const s=qn(e),a=Kn(s,e,t,r,n);return a!==i&&(a&&(t=ue(e,t,a,void 0,n)),s.set(r,i)),t}function Kn(e,t,r,i,n){let s=e.get(i);if(s!=null)return s;s=0;for(let a=0;a<i.length;a++){const c=i[a];pt(t,c,n)!=null&&(s!==0&&(r=ue(t,r,s,void 0,n)),s=c)}return e.set(i,s),s}function Yn(e,t,r){let i=0|e[E];const n=or(i),s=pt(e,r,n);let a;if(s!=null&&s[nr]===sr){if(!Fe(s))return ur(s),s.v;a=s.v}else Array.isArray(s)&&(a=s);if(a){const c=0|a[E];2&c&&(a=dr(a,c))}return a=jt(a,t),a!==s&&ue(e,i,r,a,n),a}function Jo(e,t,r,i,n){let s=!1;if((i=pt(e,i,n,a=>{const c=On(a,r,!1,t);return s=c!==a&&c!=null,c}))!=null)return s&&!Fe(i)&&zt(e,t),i}function V(e,t,r,i){let n=e.v,s=0|n[E];if((t=Jo(n,s,t,r,i))==null)return t;if(s=0|n[E],!Fe(e,s)){const a=jn(t);a!==t&&(ur(e)&&(n=e.v,s=0|n[E]),s=ue(n,s,r,t=a,i),zt(n,s))}return t}function Zo(e,t,r,i,n,s,a,c){var l=Fe(e,r);s=l?1:s,a=!!a||s===3,l=c&&!l,(s===2||l)&&ur(e)&&(r=0|(t=e.v)[E]);var h=(e=$n(t,n))===Ut?7:0|e[E],u=Wn(h,r);if(c=!(4&u)){var f=e,w=r;const g=!!(2&u);g&&(w|=2);let p=!g,y=!0,m=0,b=0;for(;m<f.length;m++){const v=On(f[m],i,!1,w);if(v instanceof i){if(!g){const I=Fe(v);p&&(p=!I),y&&(y=I)}f[b++]=v}}b<m&&(f.length=b),u|=4,u=y?-4097&u:4096|u,u=p?8|u:-9&u}if(u!==h&&(de(e,u),2&u&&Object.freeze(e)),l&&!(8&u||!e.length&&(s===1||s===4&&(2&u||!(16&u)&&32&r)))){for(Ht(u)&&(e=Ze(e),u=qt(u,r),r=ue(t,r,n,e)),i=e,l=u,h=0;h<i.length;h++)(f=i[h])!==(u=jn(f))&&(i[h]=u);l|=8,de(e,u=l=i.length?4096|l:-4097&l)}return Ko(e,u,t,r,n,s,c,a)}function mt(e,t,r){const i=e.v;return Zo(e,i,0|i[E],t,r,$t(),!1,!0)}function Ro(e){return e==null&&(e=void 0),e}function N(e,t,r,i,n){return $(e,r,i=Ro(i),n),i&&!Fe(i)&&zt(e.v),e}function Rr(e,t,r,i){e:{var n=i=Ro(i);hr(e);const s=e.v;let a=0|s[E];if(n==null){const c=qn(s);if(Kn(c,s,a,r)!==t)break e;c.set(r,0)}else a=Qo(s,a,r,t);ue(s,a,t,n)}i&&!Fe(i)&&zt(e.v)}function qt(e,t){return-273&(2&t?2|e:-3&e)}function Xn(e,t,r,i){var n=i;hr(e),e=Zo(e,i=e.v,0|i[E],r,t,2,!0),n=n??new r,e.push(n),t=r=e===Ut?7:0|e[E],(n=Fe(n))?(r&=-9,e.length===1&&(r&=-4097)):r|=4096,r!==t&&de(e,r),n||zt(i)}function ze(e,t,r){return lr(X(e,t,void 0,r))}function ea(e){return(_n?X(e,2,void 0,void 0,ki):ki(X(e,2)))??Kd}function ne(e,t){return X(e,t,void 0,void 0,ot)??0}function yt(e,t,r){if(r!=null){if(typeof r!="number"||!_i(r))throw An("int32");r|=0}$(e,t,r)}function T(e,t,r){$(e,t,Yr(r))}function Me(e,t,r){St(e,t,Jr(r),"")}function Ti(e,t,r){{hr(e);const a=e.v;let c=0|a[E];if(r==null)ue(a,c,t);else{var i=e=r===Ut?7:0|r[E],n=Ht(e),s=n||Object.isFrozen(r);for(n||(e=0),s||(r=Ze(r),i=0,e=qt(e,c),s=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(_n?1024:0),n=0;n<r.length;n++){const l=r[n],h=Go(l);Object.is(l,h)||(s&&(r=Ze(r),i=0,e=qt(e,c),s=!1),r[n]=h)}e!==i&&(s&&(r=Ze(r),e=qt(e,c)),de(r,e)),ue(a,c,t,r)}}}function Ni(e,t,r){hr(e),Wt(e,t,ve,2,!0).push(Go(r))}var wr=class{constructor(e,t,r){if(this.buffer=e,r&&!t)throw Error();this.g=t}};function Qn(e,t){if(typeof e=="string")return new wr(yo(e),t);if(Array.isArray(e))return new wr(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new wr(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new wr(e,!1);if(e.constructor===nt)return t=Sn(e)||new Uint8Array(0),new wr(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new wr(e,!1);throw Error()}function gr(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);if(s>32)for(n|=(127&r)>>4,s=3;s<32&&128&r;s+=7)r=a[c++],n|=(127&r)<<s;if(Kt(e,c),!(128&r))return t(i>>>0,n>>>0);throw Error()}function Jn(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 Kt(e,r),!!(127&t)}throw Error()}function At(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 Error();return Kt(e,r),n}function bt(e){return At(e)>>>0}function Ii(e){var t=e.h;const r=e.g;var i=t[r],n=t[r+1];const s=t[r+2];return t=t[r+3],Kt(e,e.g+4),e=2*((n=(i<<0|n<<8|s<<16|t<<24)>>>0)>>31)+1,i=n>>>23&255,n&=8388607,i==255?n?NaN:e*(1/0):i==0?1401298464324817e-60*e*n:e*Math.pow(2,i-150)*(n+8388608)}function Yd(e){return At(e)}function Kt(e,t){if(e.g=t,t>e.l)throw Error()}function ta(e,t){if(t<0)throw Error();const r=e.g;if((t=r+t)>e.l)throw Error();return e.g=t,r}function ra(e,t){if(t==0)return Bt();var r=ta(e,t);return e.Y&&e.j?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):Cd?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Bt():new nt(r,er)}var ia=[];function na(e,t,r,i){if(Mi.length){const n=Mi.pop();return n.o(i),n.g.init(e,t,r,i),n}return new Xd(e,t,r,i)}function sa(e){e.g.clear(),e.l=-1,e.h=-1,Mi.length<100&&Mi.push(e)}function oa(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var r=bt(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5)||t<1)throw Error();return e.l=t,e.h=r,!0}function Fi(e){switch(e.h){case 0:e.h!=0?Fi(e):Jn(e.g);break;case 1:Kt(e=e.g,e.g+8);break;case 2:if(e.h!=2)Fi(e);else{var t=bt(e.g);Kt(e=e.g,e.g+t)}break;case 5:Kt(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!oa(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}Fi(e)}break;default:throw Error()}}function ei(e,t,r){const i=e.g.l;var n=bt(e.g);let s=(n=e.g.g+n)-i;if(s<=0&&(e.g.l=n,r(t,e,void 0,void 0,void 0),s=n-e.g.g),s)throw Error();return e.g.g=n,e.g.l=i,t}function Zn(e){var t=bt(e.g),r=ta(e=e.g,t);if(e=e.h,od){var i,n=e;(i=vn)||(i=vn=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(yi===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),yi=!0}catch{yi=!1}}throw!yi&&(vn=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?Ot():(c=e[s++],a<194||(192&c)!=128?(s--,Ot()):r.push((31&a)<<6|63&c)):a<240?s>=t-1?Ot():(c=e[s++],(192&c)!=128||a===224&&c<160||a===237&&c>=160||(192&(i=e[s++]))!=128?(s--,Ot()):r.push((15&a)<<12|(63&c)<<6|63&i)):a<=244?s>=t-2?Ot():(c=e[s++],(192&c)!=128||c-144+(a<<28)>>30||(192&(i=e[s++]))!=128||(192&(n=e[s++]))!=128?(s--,Ot()):(a=(7&a)<<18|(63&c)<<12|(63&i)<<6|63&n,a-=65536,r.push(55296+(a>>10&1023),56320+(1023&a)))):Ot(),r.length>=8192&&(l=ao(l,r),r.length=0)}s=ao(l,r)}return s}function aa(e){const t=bt(e.g);return ra(e.g,t)}function Li(e,t,r){var i=bt(e.g);for(i=e.g.g+i;e.g.g<i;)r.push(t(e.g))}var Xd=class{constructor(e,t,r,i){if(ia.length){const n=ia.pop();n.init(e,t,r,i),e=n}else e=new class{constructor(n,s,a,c){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(n,s,a,c)}init(n,s,a,{Y:c=!1,ea:l=!1}={}){this.Y=c,this.ea=l,n&&(n=Qn(n,this.ea),this.h=n.buffer,this.j=n.g,this.m=s||0,this.l=a!==void 0?this.m+a:this.h.length,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(e,t,r,i);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(i)}o({ha:e=!1}={}){this.ha=e}},Mi=[];function ca(e){return e?/^\d+$/.test(e)?(Ei(e),new Rn(ee,ae)):null:Qd||(Qd=new Rn(0,0))}var Rn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Qd;function la(e){return e?/^-?\d+$/.test(e)?(Ei(e),new es(ee,ae)):null:Jd||(Jd=new es(0,0))}var es=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Jd;function pr(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 mr(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Di(e,t){if(t>=0)mr(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function ts(e){var t=ee;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 yr(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function $e(e,t,r){mr(e.g,8*t+r)}function rs(e,t){return $e(e,t,2),t=e.g.end(),yr(e,t),t.push(e.h),t}function is(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 Pi(e,t,r){$e(e,t,2),mr(e.g,r.length),yr(e,e.g.end()),yr(e,r)}function Oi(e,t,r,i){r!=null&&(t=rs(e,t),i(r,e),is(e,t))}function at(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var ns=at(),da=at(),ss=at(),os=at(),ua=at(),ha=at(),Zd=at(),Bi=at(),fa=at(),wa=at();function ct(e,t,r){var i=e.v;Ie&&Ie in i&&(i=i[Ie])&&delete i[t.g],t.h?t.j(e,t.h,t.g,r,t.l):t.j(e,t.g,r,t.l)}var _=class{constructor(e,t){this.v=Wo(e,t,void 0,2048)}toJSON(){return $o(this)}j(){var n;var e=Du,t=this.v,r=e.g,i=Ie;if(ir&&i&&((n=t[i])==null?void 0:n[r])!=null&&tr(md,3),t=e.g,Eo&&Ie&&Eo===void 0&&(i=(r=this.v)[Ie])&&(i=i.da))try{i(r,t,jd)}catch(s){lo(s)}return e.h?e.m(this,e.h,e.g,e.l):e.m(this,e.g,e.defaultValue,e.l)}clone(){const e=this.v,t=0|e[E];return zn(this,e,t)?Gn(this,e,!0):new this.constructor(dr(e,t,!1))}};_.prototype[nr]=sr,_.prototype.toString=function(){return this.v.toString()};var br=class{constructor(e,t,r){this.g=e,this.h=t,e=ns,this.l=!!e&&r===e||!1}};function Ui(e,t){return new br(e,t,ns)}function ga(e,t,r,i,n){Oi(e,r,xa(t,i),n)}const Rd=Ui(function(e,t,r,i,n){return e.h===2&&(ei(e,Yn(t,i,r),n),!0)},ga),eu=Ui(function(e,t,r,i,n){return e.h===2&&(ei(e,Yn(t,i,r),n),!0)},ga);var Vi=Symbol(),Gi=Symbol(),as=Symbol(),pa=Symbol(),ma=Symbol();let ya,ba;function Yt(e,t,r,i){var n=i[e];if(n)return n;(n={}).qa=i,n.T=function(f){switch(typeof f){case"boolean":return Wd||(Wd=[0,void 0,!0]);case"number":return f>0?void 0:f===0?Hd||(Hd=[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.ba=s,typeof(s=i[++a])=="function"&&(n.ma=!0,ya??(ya=s),ba??(ba=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 h=void 0;if(s instanceof br?f=s:(f=Rd,a--),f==null?void 0:f.l){s=i[++a],h=i;var u=a;typeof s=="function"&&(s=s(),h[u]=s),h=s}for(u=l+1,typeof(s=i[++a])=="number"&&s<0&&(u-=s,s=i[++a]);l<u;l++){const w=c[l];h?r(n,l,f,h,w):t(n,l,f,w)}}return i[e]=n}function va(e){return Array.isArray(e)?e[0]instanceof br?e:[eu,e]:[e,void 0]}function xa(e,t){return e instanceof _?e.v:Array.isArray(e)?jt(e,t):void 0}function cs(e,t,r,i){const n=r.g;e[t]=i?(s,a,c)=>n(s,a,c,i):n}function ls(e,t,r,i,n){const s=r.g;let a,c;e[t]=(l,h,u)=>s(l,h,u,c||(c=Yt(Gi,cs,ls,i).T),a||(a=ds(i)),n)}function ds(e){let t=e[as];if(t!=null)return t;const r=Yt(Gi,cs,ls,e);return t=r.ma?(i,n)=>ya(i,n,r):(i,n)=>{for(;oa(n)&&n.h!=4;){var s=n.l,a=r[s];if(a==null){var c=r.ba;c&&(c=c[s])&&(c=ru(c))!=null&&(a=r[s]=c)}if(a==null||!a(n,i,s)){if(a=(c=n).m,Fi(c),c.ha)var l=void 0;else l=c.g.g-a,c.g.g=a,l=ra(c.g,l);a=void 0,c=i,l&&((a=c[Ie]??(c[Ie]=new Vn))[s]??(a[s]=[])).push(l)}}return(i=Si(i))&&(i.da=r.qa[ma]),!0},e[as]=t,e[ma]=tu.bind(e),t}function tu(e,t,r,i){var n=this[Gi];const s=this[as],a=jt(void 0,n.T),c=Si(e);if(c){var l=!1,h=n.ba;if(h){if(n=(u,f,w)=>{if(w.length!==0)if(h[f])for(const g of w){u=na(g);try{l=!0,s(a,u)}finally{sa(u)}}else i==null||i(e,f,w)},t==null)Ai(c,n);else if(c!=null){const u=c[t];u&&n(c,t,u)}if(l){let u=0|e[E];if(2&u&&2048&u&&!(r!=null&&r.Ka))throw Error();const f=or(u),w=(g,p)=>{if(pt(e,g,f)!=null){if((r==null?void 0:r.Qa)===1)return;throw Error()}p!=null&&(u=ue(e,u,g,p,f)),delete c[g]};t==null?Co(a,0|a[E],(g,p)=>{w(g,p)}):w(t,pt(a,t,f))}}}}function ru(e){const t=(e=va(e))[0].g;if(e=e[1]){const r=ds(e),i=Yt(Gi,cs,ls,e).T;return(n,s,a)=>t(n,s,a,i,r)}return t}function ji(e,t,r){e[t]=r.h}function zi(e,t,r,i){let n,s;const a=r.h;e[t]=(c,l,h)=>a(c,l,h,s||(s=Yt(Vi,ji,zi,i).T),n||(n=Ea(i)))}function Ea(e){let t=e[pa];if(!t){const r=Yt(Vi,ji,zi,e);t=(i,n)=>_a(i,n,r),e[pa]=t}return t}function _a(e,t,r){Co(e,0|e[E],(i,n)=>{if(n!=null){var s=function(a,c){var l=a[c];if(l)return l;if((l=a.ba)&&(l=l[c])){var h=(l=va(l))[0].h;if(l=l[1]){const u=Ea(l),f=Yt(Vi,ji,zi,l).T;l=a.ma?ba(f,u):(w,g,p)=>h(w,g,p,f,u)}else l=h;return a[c]=l}}(r,i);s?s(t,n,i):i<500||tr(Cn,3)}}),(e=Si(e))&&Ai(e,(i,n,s)=>{for(yr(t,t.g.end()),i=0;i<s.length;i++)yr(t,Sn(s[i])||new Uint8Array(0))})}const iu=Le(0);function vr(e,t){if(Array.isArray(t)){var r=0|t[E];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),(e=-1537&(5|r))!==r&&de(t,e),2&e&&Object.freeze(t),t}}function _e(e,t,r){return new br(e,t,r)}function xr(e,t,r){return new br(e,t,r)}function fe(e,t,r){ue(e,0|e[E],t,r,or(0|e[E]))}var nu=Ui(function(e,t,r,i,n){if(e.h!==2)return!1;if(e=Ze(e=ei(e,jt([void 0,void 0],i),n)),n=or(i=0|t[E]),2&i)throw Error();let s=pt(t,r,n);if(s instanceof gt)2&s.J?(s=s.V(),s.push(e),ue(t,i,r,s,n)):s.Ma(e);else if(Array.isArray(s)){var a=0|s[E];8192&a||de(s,a|=8192),2&a&&(s=Xo(s),ue(t,i,r,s,n)),s.push(e)}else ue(t,i,r,Hr([e]),n);return!0},function(e,t,r,i,n){if(t instanceof gt)t.forEach((s,a)=>{Oi(e,r,jt([a,s],i),n)});else if(Array.isArray(t)){for(let s=0;s<t.length;s++){const a=t[s];Array.isArray(a)&&Oi(e,r,jt(a,i),n)}Hr(t)}});function ka(e,t,r){(t=ot(t))!=null&&($e(e,r,5),e=e.g,In(t),ts(e))}function Sa(e,t,r){if(t=function(i){if(i==null)return i;const n=typeof i;if(n==="bigint")return String(Kr(64,i));if(Qr(i)){if(n==="string")return Bo(i);if(n==="number")return Pn(i)}}(t),t!=null&&(typeof t=="string"&&la(t),t!=null))switch($e(e,r,0),typeof t){case"number":e=e.g,ar(t),pr(e,ee,ae);break;case"bigint":r=BigInt.asUintN(64,t),r=new es(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),pr(e.g,r.h,r.g);break;default:r=la(t),pr(e.g,r.h,r.g)}}function Aa(e,t,r){(t=lr(t))!=null&&t!=null&&($e(e,r,0),Di(e.g,t))}function Ca(e,t,r){(t=Do(t))!=null&&($e(e,r,0),e.g.g.push(t?1:0))}function Ta(e,t,r){(t=ve(t))!=null&&Pi(e,r,co(t))}function Na(e,t,r,i,n){Oi(e,r,xa(t,i),n)}function Ia(e,t,r){(t=t==null||typeof t=="string"||t instanceof nt?t:void 0)!=null&&Pi(e,r,Qn(t,!0).buffer)}function Fa(e,t,r){return(e.h===5||e.h===2)&&(t=fr(t,0|t[E],r),e.h==2?Li(e,Ii,t):t.push(Ii(e.g)),!0)}var ce=_e(function(e,t,r){return e.h===5&&(fe(t,r,Ii(e.g)),!0)},ka,Bi),su=xr(Fa,function(e,t,r){if((t=vr(ot,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&($e(i,n,5),i=i.g,In(s),ts(i))}},Bi),us=xr(Fa,function(e,t,r){if((t=vr(ot,t))!=null&&t.length){$e(e,r,2),mr(e.g,4*t.length);for(let i=0;i<t.length;i++)r=e.g,In(t[i]),ts(r)}},Bi),ou=_e(function(e,t,r){return e.h===5&&(fe(t,r,(e=Ii(e.g))===0?void 0:e),!0)},ka,Bi),Ct=_e(function(e,t,r){return En?(e.h!==0?e=!1:(fe(t,r,gr(e.g,Lo)),e=!0),e):e.h===0&&(fe(t,r,gr(e.g,Ln)),!0)},Sa,ha),hs=_e(function(e,t,r){return En?(e.h!==0?t=!1:(fe(t,r,(e=gr(e.g,Lo))===iu?void 0:e),t=!0),t):e.h===0&&(fe(t,r,(e=gr(e.g,Ln))===0?void 0:e),!0)},Sa,ha),au=_e(function(e,t,r){return En?(e.h!==0?e=!1:(fe(t,r,gr(e.g,Nd)),e=!0),e):e.h===0&&(fe(t,r,gr(e.g,Fn)),!0)},function(e,t,r){if(t=function(i){if(i==null)return i;var n=typeof i;if(n==="bigint")return String(Id(64,i));if(Qr(i)){if(n==="string")return n=cr(Number(i)),Gt(n)&&n>=0?i=String(n):((n=i.indexOf("."))!==-1&&(i=i.substring(0,n)),(n=i[0]!=="-"&&((n=i.length)<20||n===20&&i<="18446744073709551615"))||(Ei(i),i=qr(ee,ae))),i;if(n==="number")return(i=cr(i))>=0&&Gt(i)||(ar(i),i=Fn(ee,ae)),i}}(t),t!=null&&(typeof t=="string"&&ca(t),t!=null))switch($e(e,r,0),typeof t){case"number":e=e.g,ar(t),pr(e,ee,ae);break;case"bigint":r=BigInt.asUintN(64,t),r=new Rn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),pr(e.g,r.h,r.g);break;default:r=ca(t),pr(e.g,r.h,r.g)}},Zd),we=_e(function(e,t,r){return e.h===0&&(fe(t,r,At(e.g)),!0)},Aa,os),ti=xr(function(e,t,r){return(e.h===0||e.h===2)&&(t=fr(t,0|t[E],r),e.h==2?Li(e,At,t):t.push(At(e.g)),!0)},function(e,t,r){if((t=vr(lr,t))!=null&&t.length){r=rs(e,r);for(let i=0;i<t.length;i++)Di(e.g,t[i]);is(e,r)}},os),Er=_e(function(e,t,r){return e.h===0&&(fe(t,r,(e=At(e.g))===0?void 0:e),!0)},Aa,os),se=_e(function(e,t,r){return e.h===0&&(fe(t,r,Jn(e.g)),!0)},Ca,da),Xt=_e(function(e,t,r){return e.h===0&&(fe(t,r,(e=Jn(e.g))===!1?void 0:e),!0)},Ca,da),xe=xr(function(e,t,r){return e.h===2&&(e=Zn(e),fr(t,0|t[E],r).push(e),!0)},function(e,t,r){if((t=vr(ve,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&Pi(i,n,co(s))}},ss),Tt=_e(function(e,t,r){return e.h===2&&(fe(t,r,(e=Zn(e))===""?void 0:e),!0)},Ta,ss),K=_e(function(e,t,r){return e.h===2&&(fe(t,r,Zn(e)),!0)},Ta,ss),ge=function(e,t,r=ns){return new br(e,t,r)}(function(e,t,r,i,n){return e.h===2&&(i=jt(void 0,i),fr(t,0|t[E],r).push(i),ei(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);1&(e=0|t[E])||de(t,1|e)}}),oe=Ui(function(e,t,r,i,n,s){if(e.h!==2)return!1;let a=0|t[E];return Qo(t,a,s,r,or(a)),ei(e,t=Yn(t,i,r),n),!0},Na),La=_e(function(e,t,r){return e.h===2&&(fe(t,r,aa(e)),!0)},Ia,fa),cu=xr(function(e,t,r){return(e.h===0||e.h===2)&&(t=fr(t,0|t[E],r),e.h==2?Li(e,bt,t):t.push(bt(e.g)),!0)},function(e,t,r){if((t=vr(Po,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&($e(i,n,0),mr(i.g,s))}},ua),lu=_e(function(e,t,r){return e.h===0&&(fe(t,r,(e=bt(e.g))===0?void 0:e),!0)},function(e,t,r){(t=Po(t))!=null&&t!=null&&($e(e,r,0),mr(e.g,t))},ua),De=_e(function(e,t,r){return e.h===0&&(fe(t,r,At(e.g)),!0)},function(e,t,r){(t=lr(t))!=null&&(t=parseInt(t,10),$e(e,r,0),Di(e.g,t))},wa);class du{constructor(t,r){var i=Pe;this.g=t,this.h=r,this.m=V,this.j=N,this.defaultValue=void 0,this.l=i.Oa!=null?To:void 0}register(){bi(this)}}function lt(e,t){return new du(e,t)}function Nt(e,t){return(r,i)=>{{const s={ea:!0};i&&Object.assign(s,i),r=na(r,void 0,void 0,s);try{const a=new e,c=a.v;ds(t)(c,r);var n=a}finally{sa(r)}}return n}}function $i(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}}}};_a(this.v,t,Yt(Vi,ji,zi,e)),yr(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 Ma=class extends _{constructor(e){super(e)}},Da=[0,Tt,_e(function(e,t,r){return e.h===2&&(fe(t,r,(e=aa(e))===Bt()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof _){const i=t.Ra;return void(i?(t=i(t),t!=null&&Pi(e,r,Qn(t,!0).buffer)):tr(Cn,3))}if(Array.isArray(t))return void tr(Cn,3)}Ia(e,t,r)},fa)];let fs,Pa=globalThis.trustedTypes;function Oa(e){var t;return fs===void 0&&(fs=function(){let r=null;if(!Pa)return r;try{const i=n=>n;r=Pa.createPolicy("goog#html",{createHTML:i,createScript:i,createScriptURL:i})}catch{}return r}()),e=(t=fs)?t.createScriptURL(e):e,new class{constructor(r){this.g=r}toString(){return this.g+""}}(e)}function uu(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 Ba=[0,we,De,se,-1,ti,De,-1,se],hu=class extends _{constructor(e){super(e)}},Ua=[0,se,K,se,De,-1,xr(function(e,t,r){return(e.h===0||e.h===2)&&(t=fr(t,0|t[E],r),e.h==2?Li(e,Yd,t):t.push(At(e.g)),!0)},function(e,t,r){if((t=vr(lr,t))!=null&&t.length){r=rs(e,r);for(let i=0;i<t.length;i++)Di(e.g,t[i]);is(e,r)}},wa),K,-1,[0,se,-1],De,se,-1],Va=[0,3,se,-1,2,[0,we],[0,De,se],[0,K,-1],[0]],Ga=[0,K,-2],ja=class extends _{constructor(e){super(e)}},za=[0],$a=[0,we,se,1,se,-4],Pe=class extends _{constructor(e){super(e,2)}},he={};he[336783863]=[0,K,se,-1,we,[0,[1,2,3,4,5,6,7,8,9],oe,za,oe,Ua,oe,Ga,oe,$a,oe,Ba,oe,[0,K,-2],oe,[0,K,De],oe,Va,oe,[0,De,-1,se]],[0,K],se,[0,[1,3],[2,4],oe,[0,ti],-1,oe,[0,xe],-1,ge,[0,K,-1]],K];var Wa=[0,hs,-1,Xt,-3,hs,ti,Tt,Er,hs,-1,Xt,Er,Xt,-2,Tt];function Q(e,t){Ni(e,3,t)}function B(e,t){Ni(e,4,t)}var Te=class extends _{constructor(e){super(e,500)}o(e){return N(this,0,7,e)}},ri=[-1,{}],Ha=[0,K,1,ri],qa=[0,K,xe,ri];function We(e,t){Xn(e,1,Te,t)}function te(e,t){Ni(e,10,t)}function z(e,t){Ni(e,15,t)}var Oe=class extends _{constructor(e){super(e,500)}o(e){return N(this,0,1001,e)}},Ka=[-500,ge,[-500,Tt,-1,xe,-3,[-2,he,se],ge,Da,Er,-1,Ha,qa,ge,[0,Tt,Xt],Tt,Wa,Er,xe,987,xe],4,ge,[-500,K,-1,[-1,{}],998,K],ge,[-500,K,xe,-1,[-2,{},se],997,xe,-1],Er,ge,[-500,K,xe,ri,998,xe],xe,Er,Ha,qa,ge,[0,Tt,-1,ri],xe,-2,Wa,Tt,-1,Xt,[0,Xt,lu],978,ri,ge,Da];Oe.prototype.g=$i(Ka);var fu=Nt(Oe,Ka),wu=class extends _{constructor(e){super(e)}},Ya=class extends _{constructor(e){super(e)}g(){return mt(this,wu,1)}},Xa=[0,ge,[0,we,ce,K,-1]],Wi=Nt(Ya,Xa),gu=class extends _{constructor(e){super(e)}},pu=class extends _{constructor(e){super(e)}},ws=class extends _{constructor(e){super(e)}l(){return V(this,gu,2)}g(){return mt(this,pu,5)}},Qa=Nt(class extends _{constructor(e){super(e)}},[0,xe,ti,us,[0,De,[0,we,-3],[0,ce,-3],[0,we,-1,[0,ge,[0,we,-2]]],ge,[0,ce,-1,K,ce]],K,-1,Ct,ge,[0,we,ce],xe,Ct]),Ja=class extends _{constructor(e){super(e)}},_r=Nt(class extends _{constructor(e){super(e)}},[0,ge,[0,ce,-4]]),Za=class extends _{constructor(e){super(e)}},ii=Nt(class extends _{constructor(e){super(e)}},[0,ge,[0,ce,-4]]),mu=class extends _{constructor(e){super(e)}},yu=[0,we,-1,us,De],Ra=class extends _{constructor(e){super(e)}};Ra.prototype.g=$i([0,ce,-4,Ct]);var bu=class extends _{constructor(e){super(e)}},vu=Nt(class extends _{constructor(e){super(e)}},[0,ge,[0,1,we,K,Xa],Ct]),ec=class extends _{constructor(e){super(e)}},xu=class extends _{constructor(e){super(e)}na(){const e=X(this,1,void 0,void 0,Yo);return e??Bt()}},Eu=class extends _{constructor(e){super(e)}},tc=[1,2],_u=Nt(class extends _{constructor(e){super(e)}},[0,ge,[0,tc,oe,[0,us],oe,[0,La],we,K],Ct]),gs=class extends _{constructor(e){super(e)}},rc=[0,K,we,ce,xe,-1],ic=class extends _{constructor(e){super(e)}},ku=[0,se,-1],nc=class extends _{constructor(e){super(e)}},Hi=[1,2,3,4,5,6],qi=class extends _{constructor(e){super(e)}g(){return X(this,1,void 0,void 0,Yo)!=null}l(){return ve(X(this,2))!=null}},ie=class extends _{constructor(e){super(e)}g(){return Do(X(this,2))??!1}},sc=[0,La,K,[0,we,Ct,-1],[0,au,Ct]],le=[0,sc,se,[0,Hi,oe,$a,oe,Ua,oe,Ba,oe,za,oe,Ga,oe,Va],De],Ki=class extends _{constructor(e){super(e)}},ps=[0,le,ce,-1,we],Su=lt(502141897,Ki);he[502141897]=ps;var Au=Nt(class extends _{constructor(e){super(e)}},[0,[0,De,-1,su,cu],yu]),oc=class extends _{constructor(e){super(e)}},ac=class extends _{constructor(e){super(e)}},ms=[0,le,ce,[0,le],se],Cu=lt(508968150,ac);he[508968150]=[0,le,ps,ms,ce,[0,[0,sc]]],he[508968149]=ms;var kr=class extends _{constructor(e){super(e)}l(){return V(this,gs,2)}g(){$(this,2)}},cc=[0,le,rc];he[478825465]=cc;var Tu=class extends _{constructor(e){super(e)}},lc=class extends _{constructor(e){super(e)}},ys=class extends _{constructor(e){super(e)}},bs=class extends _{constructor(e){super(e)}},dc=class extends _{constructor(e){super(e)}},uc=[0,le,[0,le],cc,-1],hc=[0,le,ce,we],vs=[0,le,ce],fc=[0,le,hc,vs,ce],Nu=lt(479097054,dc);he[479097054]=[0,le,fc,uc],he[463370452]=uc,he[464864288]=hc;var Iu=lt(462713202,bs);he[462713202]=fc,he[474472470]=vs;var Fu=class extends _{constructor(e){super(e)}},wc=class extends _{constructor(e){super(e)}},gc=class extends _{constructor(e){super(e)}},pc=class extends _{constructor(e){super(e)}},xs=[0,le,ce,-1,we],Es=[0,le,ce,se];pc.prototype.g=$i([0,le,vs,[0,le],ps,ms,xs,Es]);var mc=class extends _{constructor(e){super(e)}},Lu=lt(456383383,mc);he[456383383]=[0,le,rc];var yc=class extends _{constructor(e){super(e)}},Mu=lt(476348187,yc);he[476348187]=[0,le,ku];var bc=class extends _{constructor(e){super(e)}},vc=class extends _{constructor(e){super(e)}},xc=[0,De,-1],Du=lt(458105876,class extends _{constructor(e){super(e)}g(){let e;var t=this.v;const r=0|t[E];return e=Fe(this,r),t=function(i,n,s,a){var c=vc;!a&&ur(i)&&(s=0|(n=i.v)[E]);var l=pt(n,2);if(i=!1,l==null){if(a)return zo();l=[]}else if(l.constructor===gt){if(!(2&l.J)||a)return l;l=l.V()}else Array.isArray(l)?i=!!(2&(0|l[E])):l=[];if(a){if(!l.length)return zo();i||(i=!0,Wr(l))}else i&&(i=!1,Hr(l),l=Xo(l));return!i&&32&s&&$r(l,32),s=ue(n,s,2,a=new gt(l,c,Dd,void 0)),i||zt(n,s),a}(this,t,r,e),!e&&vc&&(t.ra=!0),t}});he[458105876]=[0,xc,nu,[!0,Ct,[0,K,-1,xe]],[0,ti,se,De]];var _s=class extends _{constructor(e){super(e)}},Ec=lt(458105758,_s);he[458105758]=[0,le,K,xc];var ks=class extends _{constructor(e){super(e)}},_c=[0,ou,-1,Xt],Pu=class extends _{constructor(e){super(e)}},kc=class extends _{constructor(e){super(e)}},Ss=[1,2];kc.prototype.g=$i([0,Ss,oe,_c,oe,[0,ge,_c]]);var Sc=class extends _{constructor(e){super(e)}},Ou=lt(443442058,Sc);he[443442058]=[0,le,K,we,ce,xe,-1,se,ce],he[514774813]=xs;var Ac=class extends _{constructor(e){super(e)}},Bu=lt(516587230,Ac);function As(e,t){return t=t?t.clone():new gs,e.displayNamesLocale!==void 0?$(t,1,Jr(e.displayNamesLocale)):e.displayNamesLocale===void 0&&$(t,1),e.maxResults!==void 0?yt(t,2,e.maxResults):"maxResults"in e&&$(t,2),e.scoreThreshold!==void 0?T(t,3,e.scoreThreshold):"scoreThreshold"in e&&$(t,3),e.categoryAllowlist!==void 0?Ti(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&$(t,4),e.categoryDenylist!==void 0?Ti(t,5,e.categoryDenylist):"categoryDenylist"in e&&$(t,5),t}function Cc(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function Cs(e,t=-1,r=""){return{categories:e.map(i=>({index:ze(i,1)??0??-1,score:ne(i,2)??0,categoryName:ve(X(i,3))??""??"",displayName:ve(X(i,4))??""??""})),headIndex:t,headName:r}}function Uu(e){const t={classifications:mt(e,bu,1).map(r=>{var i;return Cs(((i=V(r,Ya,4))==null?void 0:i.g())??[],ze(r,2)??0,ve(X(r,3))??"")})};return function(r){return Md(_n?X(r,2,void 0,void 0,ki):X(r,2))}(e)!=null&&(t.timestampMs=Cc(ea(e))),t}function Tc(e){var a,c;var t=Wt(e,3,ot,$t()),r=Wt(e,2,lr,$t()),i=Wt(e,1,ve,$t()),n=Wt(e,9,ve,$t());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=V(e,ws,4))==null?void 0:a.l())&&(s.boundingBox={originX:ze(t,1,kt)??0,originY:ze(t,2,kt)??0,width:ze(t,3,kt)??0,height:ze(t,4,kt)??0,angle:0}),(c=V(e,ws,4))==null?void 0:c.g().length)for(const l of V(e,ws,4).g())s.keypoints.push({x:X(l,1,void 0,kt,ot)??0,y:X(l,2,void 0,kt,ot)??0,score:X(l,4,void 0,kt,ot)??0,label:ve(X(l,3,void 0,kt))??""});return s}function Yi(e){const t=[];for(const r of mt(e,Za,1))t.push({x:ne(r,1)??0,y:ne(r,2)??0,z:ne(r,3)??0,visibility:ne(r,4)??0});return t}function ni(e){const t=[];for(const r of mt(e,Ja,1))t.push({x:ne(r,1)??0,y:ne(r,2)??0,z:ne(r,3)??0,visibility:ne(r,4)??0});return t}function Nc(e){return Array.from(e,t=>t>127?t-256:t)}function Ic(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 Xi;he[516587230]=[0,le,xs,Es,ce],he[518928384]=Es;const Vu=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 Fc(){if(Xi===void 0)try{await WebAssembly.instantiate(Vu),Xi=!0}catch{Xi=!1}return Xi}async function si(e,t=uu``){const r=await Fc()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Qt=class{};function Lc(){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)})}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function Dc(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 k(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 Pc(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]=Dc(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 Oc(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 dt(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function It(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)}}Qt.forVisionTasks=function(e){return si("vision",e)},Qt.forTextTasks=function(e){return si("text",e)},Qt.forGenAiExperimentalTasks=function(e){return si("genai_experimental",e)},Qt.forGenAiTasks=function(e){return si("genai",e)},Qt.forAudioTasks=function(e){return si("audio",e)},Qt.isSimdSupported=function(){return Fc()};async function Gu(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 Ts(e,t){const r=V(e.baseOptions,qi,1)||new qi;typeof t=="string"?($(r,2,Jr(t)),$(r,1)):t instanceof Uint8Array&&($(r,1,Tn(t,!1)),$(r,2)),N(e.baseOptions,0,1,r)}function Bc(e){try{const t=e.H.length;if(t===1)throw Error(e.H[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.H.map(r=>r.message).join(", "))}finally{e.H=[]}}function x(e,t){e.C=Math.max(e.C,t)}function Qi(e,t){e.B=new Te,Me(e.B,2,"PassThroughCalculator"),Q(e.B,"free_memory"),B(e.B,"free_memory_unused_out"),te(t,"free_memory"),We(t,e.B)}function Sr(e,t){Q(e.B,t),B(e.B,t+"_unused_out")}function Ji(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var Ns=class{constructor(e){this.g=e,this.H=[],this.C=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=V(this.baseOptions,qi,1))!=null&&n.g()||(s=V(this.baseOptions,qi,1))!=null&&s.l()||(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(h,u){let f=V(h.baseOptions,nc,3);if(!f){var w=f=new nc,g=new ja;Rr(w,4,Hi,g)}"delegate"in u&&(u.delegate==="GPU"?(u=f,w=new hu,Rr(u,2,Hi,w)):(u=f,w=new ja,Rr(u,4,Hi,w))),N(h.baseOptions,0,3,f)}(this,l),l.modelAssetPath)return fetch(l.modelAssetPath.toString()).then(h=>{if(h.ok)return h.arrayBuffer();throw Error(`Failed to fetch model: ${l.modelAssetPath} (${h.status})`)}).then(h=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(h),!0,!1,!1),Ts(this,"/model.dat"),this.m(),this.L()});if(l.modelAssetBuffer instanceof Uint8Array)Ts(this,l.modelAssetBuffer);else if(l.modelAssetBuffer)return async function(h){const u=[];for(var f=0;;){const{done:w,value:g}=await h.read();if(w)break;u.push(g),f+=g.length}if(u.length===0)return new Uint8Array(0);if(u.length===1)return u[0];h=new Uint8Array(f),f=0;for(const w of u)h.set(w,f),f+=w.length;return h}(l.modelAssetBuffer).then(h=>{Ts(this,h),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca(t=>{e=fu(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,i)=>{this.H.push(Error(i))}),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,Bc(this)}finishProcessing(){this.g.finishProcessing(),Bc(this)}close(){this.B=void 0,this.g.closeGraph()}};function Ft(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Ns.prototype.close=Ns.prototype.close;class ju{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 Uc(e,t,r){const i=e.g;if(r=Ft(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 Vc(e,t){const r=e.g,i=Ft(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(i);const n=Ft(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,n),r.enableVertexAttribArray(e.O),r.vertexAttribPointer(e.O,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=Ft(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.L),r.vertexAttribPointer(e.L,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 ju(r,i,n,s)}function Is(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function zu(e,t,r,i){return Is(e,t),e.h||(e.m(),e.D()),r?(e.u||(e.u=Vc(e,!0)),r=e.u):(e.A||(e.A=Vc(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=i(),r.g.bindVertexArray(null),e}function Gc(e,t,r){return Is(e,t),e=Ft(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 jc(e,t,r){Is(e,t),e.B||(e.B=Ft(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.B),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function $u(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var zc=class{H(){return`
|
|
2
2
|
precision mediump float;
|
|
3
3
|
varying vec2 vTex;
|
|
4
4
|
uniform sampler2D inputTexture;
|
|
5
5
|
void main() {
|
|
6
6
|
gl_FragColor = texture2D(inputTexture, vTex);
|
|
7
7
|
}
|
|
8
|
-
`}m(){const e=this.g;if(this.h=
|
|
8
|
+
`}m(){const e=this.g;if(this.h=Ft(e.createProgram(),"Failed to create WebGL program"),this.X=Uc(this,`
|
|
9
9
|
attribute vec2 aVertex;
|
|
10
10
|
attribute vec2 aTex;
|
|
11
11
|
varying vec2 vTex;
|
|
12
12
|
void main(void) {
|
|
13
13
|
gl_Position = vec4(aVertex, 0.0, 1.0);
|
|
14
14
|
vTex = aTex;
|
|
15
|
-
}`,e.VERTEX_SHADER),this.W=Mc(this,this.H(),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.O=e.getAttribLocation(this.h,"aVertex"),this.L=e.getAttribLocation(this.h,"aTex")}D(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.X),e.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.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=Sr(e);var r=Cs(e);if(Oc(r,i,Uc(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 Uc(e){let t=yt(e,2);if(!t){const r=Sr(e);t=Vc(e);const i=As(e),n=Gc(e);r.texImage2D(r.TEXTURE_2D,0,n,e.width,e.height,0,r.RED,r.FLOAT,i),Ss(e)}return t}function Sr(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=It(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Gc(e){if(e=Sr(e),!Xi)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Xi=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Xi=e.R16F}return Xi}function Cs(e){return e.l||(e.l=new Bc),e.l}function Vc(e){const t=Sr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=yt(e,2);return r||(r=Pc(Cs(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Ss(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Xi,pe=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&&--jc===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!yt(this,0)}ka(){return!!yt(this,1)}R(){return!!yt(this,2)}ja(){return(t=yt(e=this,0))||(t=As(e),t=new Uint8Array(t.map(r=>Math.round(255*r))),e.g.push(t)),t;var e,t}ia(){return As(this)}N(){return Uc(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=Sr(this),n=Cs(this);i.activeTexture(i.TEXTURE1),r=Pc(n,i,this.m?i.LINEAR:i.NEAREST),i.bindTexture(i.TEXTURE_2D,r);const s=Gc(this);i.texImage2D(i.TEXTURE_2D,0,s,this.width,this.height,0,i.RED,i.FLOAT,null),i.bindTexture(i.TEXTURE_2D,null),Oc(n,i,r),ju(n,i,!1,()=>{Vc(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),Ss(this)}),$u(n),Ss(this)}}e.push(r)}return new pe(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Sr(this).deleteTexture(yt(this,2)),jc=-1}};pe.prototype.close=pe.prototype.close,pe.prototype.clone=pe.prototype.clone,pe.prototype.getAsWebGLTexture=pe.prototype.N,pe.prototype.getAsFloat32Array=pe.prototype.ia,pe.prototype.getAsUint8Array=pe.prototype.ja,pe.prototype.hasWebGLTexture=pe.prototype.R,pe.prototype.hasFloat32Array=pe.prototype.ka,pe.prototype.hasUint8Array=pe.prototype.Fa;var jc=250;function Ze(...e){return e.map(([t,r])=>({start:t,end:r}))}const Wu=function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}}(($c=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:Sc()?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?'),k(this,i||"input_audio",s=>{k(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){dt(this,"__graph_config__",t=>{e(t)}),k(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),k(this,i,a=>{this.i._addAudioToInputStream(this.g,t,r,a,n)})}addGpuBufferToStream(e,t,r){k(this,t,i=>{const[n,s]=Ic(this,e,i);this.i._addBoundTextureToStream(i,n,s,r)})}addBoolToStream(e,t,r){k(this,t,i=>{this.i._addBoolToInputStream(e,i,r)})}addDoubleToStream(e,t,r){k(this,t,i=>{this.i._addDoubleToInputStream(e,i,r)})}addFloatToStream(e,t,r){k(this,t,i=>{this.i._addFloatToInputStream(e,i,r)})}addIntToStream(e,t,r){k(this,t,i=>{this.i._addIntToInputStream(e,i,r)})}addUintToStream(e,t,r){k(this,t,i=>{this.i._addUintToInputStream(e,i,r)})}addStringToStream(e,t,r){k(this,t,i=>{k(this,e,n=>{this.i._addStringToInputStream(n,i,r)})})}addStringRecordToStream(e,t,r){k(this,t,i=>{Fc(this,Object.keys(e),n=>{Fc(this,Object.values(e),s=>{this.i._addFlatHashMapToInputStream(n,s,Object.keys(e).length,i,r)})})})}addProtoToStream(e,t,r,i){k(this,r,n=>{k(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){k(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){k(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){k(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){k(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){k(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){k(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){k(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)k(this,s,a=>{this.i._addStringVectorEntry(n,a)});this.i._addStringVectorToInputStream(n,i,r)})}addBoolToInputSidePacket(e,t){k(this,t,r=>{this.i._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){k(this,t,r=>{this.i._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){k(this,t,r=>{this.i._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){k(this,t,r=>{this.i._addIntToInputSidePacket(e,r)})}addUintToInputSidePacket(e,t){k(this,t,r=>{this.i._addUintToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){k(this,t,r=>{k(this,e,i=>{this.i._addStringToInputSidePacket(i,r)})})}addProtoToInputSidePacket(e,t,r){k(this,r,i=>{k(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){k(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){k(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){k(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){k(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){k(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){k(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)k(this,n,s=>{this.i._addStringVectorEntry(i,s)});this.i._addStringVectorToInputSidePacket(i,r)})}attachBoolListener(e,t){dt(this,e,t),k(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){Tt(this,e,t),k(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){dt(this,e,t),k(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){Tt(this,e,t),k(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){dt(this,e,t),k(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){Tt(this,e,t),k(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){dt(this,e,t),k(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){Tt(this,e,t),k(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){dt(this,e,t),k(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){Tt(this,e,t),k(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){dt(this,e,t),k(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){Tt(this,e,t),k(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){dt(this,e,t),k(this,e,i=>{this.i._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){Tt(this,e,t),k(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?'),dt(this,e,(i,n)=>{i=new Float32Array(i.buffer,i.byteOffset,i.length/4),t(i,n)}),k(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 $c{get ga(){return this.i}pa(e,t,r){k(this,t,i=>{const[n,s]=Ic(this,e,i);this.ga._addBoundTextureAsImageToStream(i,n,s,r)})}Z(e,t){dt(this,e,t),k(this,e,r=>{this.ga._attachImageListener(r)})}aa(e,t){Tt(this,e,t),k(this,e,r=>{this.ga._attachImageVectorListener(r)})}}));var $c,Re=class extends Wu{};async function O(e,t,r){return async function(i,n,s,a){return Gu(i,n,s,a)}(e,r.canvas??(Sc()?void 0:document.createElement("canvas")),t,r)}function Wc(e,t,r,i){if(e.U){const s=new Ya;if(r!=null&&r.regionOfInterest){if(!e.oa)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].");A(s,1,(n.left+n.right)/2),A(s,2,(n.top+n.bottom)/2),A(s,4,n.right-n.left),A(s,3,n.bottom-n.top)}else A(s,1,.5),A(s,2,.5),A(s,4,1),A(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(A(s,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[a,c]=Tc(t);r=ie(s,3)*c/a,n=ie(s,4)*a/c,A(s,4,r),A(s,3,n)}}e.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",e.U,i)}e.g.pa(t,e.X,i??performance.now()),e.finishProcessing()}function et(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'.");Wc(e,t,r,e.C+1)}function ut(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'.");Wc(e,t,r,i)}function Nr(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 pe([n],r,!1,e.g.i.canvas,e.P,s,t),i?e.clone():e}var Oe=class extends _s{constructor(e,t,r,i){super(e),this.g=e,this.X=t,this.U=r,this.oa=i,this.P=new Bc}l(e,t=!0){if("runningMode"in e&&$(this.baseOptions,2,Yr(!!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()}};Oe.prototype.close=Oe.prototype.close;var Ke=class extends Oe{constructor(e,t){super(new Re(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},S(e=this.h=new zi,0,1,t=new te),A(this.h,2,.5),A(this.h,3,.3)}get baseOptions(){return V(this.h,te,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&A(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&A(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},et(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},ut(this,e,r,t),this.j}m(){var e=new Pe;R(e,"image_in"),R(e,"norm_rect_in"),j(e,"detections");const t=new De;ct(t,ku,this.h);const r=new Ce;Le(r,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect_in"),P(r,"DETECTIONS:detections"),r.o(t),qe(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Ha(s),this.j.detections.push(_c(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ke.prototype.detectForVideo=Ke.prototype.G,Ke.prototype.detect=Ke.prototype.F,Ke.prototype.setOptions=Ke.prototype.o,Ke.createFromModelPath=async function(e,t){return O(Ke,e,{baseOptions:{modelAssetPath:t}})},Ke.createFromModelBuffer=function(e,t){return O(Ke,e,{baseOptions:{modelAssetBuffer:t}})},Ke.createFromOptions=function(e,t){return O(Ke,e,t)};var Ns=Ze([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]),Ts=Ze([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]),Is=Ze([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),zc=Ze([474,475],[475,476],[476,477],[477,474]),Fs=Ze([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]),Ls=Ze([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Hc=Ze([469,470],[470,471],[471,472],[472,469]),Ms=Ze([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]),qc=[...Ns,...Ts,...Is,...Fs,...Ls,...Ms],Kc=Ze([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 Yc(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var ee=class extends Oe{constructor(e,t){super(new Re(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,S(e=this.h=new rc,0,1,t=new te),this.A=new tc,S(this.h,0,3,this.A),this.u=new zi,S(this.h,0,2,this.u),pt(this.u,4,1),A(this.u,2,.5),A(this.A,2,.5),A(this.h,4,.5)}get baseOptions(){return V(this.h,te,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return"numFaces"in e&&pt(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&A(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&A(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&A(this.A,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return Yc(this),et(this,e,t),this.j}G(e,t,r){return Yc(this),ut(this,e,r,t),this.j}m(){var e=new Pe;R(e,"image_in"),R(e,"norm_rect"),j(e,"face_landmarks");const t=new De;ct(t,Cu,this.h);const r=new Ce;Le(r,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),P(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),qe(e,r),this.g.attachProtoVectorListener("face_landmarks",(i,n)=>{for(const s of i)i=ri(s),this.j.faceLandmarks.push(Hi(i));x(this,n)}),this.g.attachEmptyPacketListener("face_landmarks",i=>{x(this,i)}),this.outputFaceBlendshapes&&(j(e,"blendshapes"),P(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(i,n)=>{if(this.outputFaceBlendshapes)for(const s of i)i=ji(s),this.j.faceBlendshapes.push(xs(i.g()??[]));x(this,n)}),this.g.attachEmptyPacketListener("blendshapes",i=>{x(this,i)})),this.outputFacialTransformationMatrixes&&(j(e,"face_geometry"),P(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(i,n)=>{if(this.outputFacialTransformationMatrixes)for(const s of i)(i=V(i=Au(s),pu,2))&&this.j.facialTransformationMatrixes.push({rows:ze(i,1)??0??0,columns:ze(i,2)??0??0,data:Wt(i,3,ot,$t()).slice()??[]});x(this,n)}),this.g.attachEmptyPacketListener("face_geometry",i=>{x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ee.prototype.detectForVideo=ee.prototype.G,ee.prototype.detect=ee.prototype.F,ee.prototype.setOptions=ee.prototype.o,ee.createFromModelPath=function(e,t){return O(ee,e,{baseOptions:{modelAssetPath:t}})},ee.createFromModelBuffer=function(e,t){return O(ee,e,{baseOptions:{modelAssetBuffer:t}})},ee.createFromOptions=function(e,t){return O(ee,e,t)},ee.FACE_LANDMARKS_LIPS=Ns,ee.FACE_LANDMARKS_LEFT_EYE=Ts,ee.FACE_LANDMARKS_LEFT_EYEBROW=Is,ee.FACE_LANDMARKS_LEFT_IRIS=zc,ee.FACE_LANDMARKS_RIGHT_EYE=Fs,ee.FACE_LANDMARKS_RIGHT_EYEBROW=Ls,ee.FACE_LANDMARKS_RIGHT_IRIS=Hc,ee.FACE_LANDMARKS_FACE_OVAL=Ms,ee.FACE_LANDMARKS_CONTOURS=qc,ee.FACE_LANDMARKS_TESSELATION=Kc;var Ds=Ze([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 Xc(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Qc(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 Jc(e,t=!0){const r=[];for(const n of e){var i=ji(n);e=[];for(const s of i.g())i=t&&ze(s,1)!=null?ze(s,1)??0:-1,e.push({score:ie(s,2)??0,index:i,categoryName:ye(q(s,3))??""??"",displayName:ye(q(s,4))??""??""});r.push(e)}return r}var Be=class extends Oe{constructor(e,t){super(new Re(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],S(e=this.j=new sc,0,1,t=new te),this.u=new fs,S(this.j,0,2,this.u),this.D=new hs,S(this.u,0,3,this.D),this.A=new nc,S(this.u,0,2,this.A),this.h=new Su,S(this.j,0,3,this.h),A(this.A,2,.5),A(this.u,4,.5),A(this.D,2,.5)}get baseOptions(){return V(this.j,te,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){var n,s,a,c;if(pt(this.A,3,e.numHands??1),"minHandDetectionConfidence"in e&&A(this.A,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&A(this.u,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&A(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new Ar,r=t,i=vs(e.cannedGesturesClassifierOptions,(n=V(this.h,Ar,3))==null?void 0:n.l());S(r,0,2,i),S(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((s=V(this.h,Ar,3))==null||s.g());return e.customGesturesClassifierOptions?(S(r=t=new Ar,0,2,i=vs(e.customGesturesClassifierOptions,(a=V(this.h,Ar,4))==null?void 0:a.l())),S(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((c=V(this.h,Ar,4))==null||c.g()),this.l(e)}Ha(e,t){return Xc(this),et(this,e,t),Qc(this)}Ia(e,t,r){return Xc(this),ut(this,e,r,t),Qc(this)}m(){var e=new Pe;R(e,"image_in"),R(e,"norm_rect"),j(e,"hand_gestures"),j(e,"hand_landmarks"),j(e,"world_hand_landmarks"),j(e,"handedness");const t=new De;ct(t,Nu,this.j);const r=new Ce;Le(r,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),P(r,"HAND_GESTURES:hand_gestures"),P(r,"LANDMARKS:hand_landmarks"),P(r,"WORLD_LANDMARKS:world_hand_landmarks"),P(r,"HANDEDNESS:handedness"),r.o(t),qe(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i){i=ri(s);const a=[];for(const c of gt(i,Ka,1))a.push({x:ie(c,1)??0,y:ie(c,2)??0,z:ie(c,3)??0,visibility:ie(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=kr(s);const a=[];for(const c of gt(i,qa,1))a.push({x:ie(c,1)??0,y:ie(c,2)??0,z:ie(c,3)??0,visibility:ie(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(...Jc(i,!1)),x(this,n)}),this.g.attachEmptyPacketListener("hand_gestures",i=>{x(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{this.handedness.push(...Jc(i)),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Zc(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Be.prototype.recognizeForVideo=Be.prototype.Ia,Be.prototype.recognize=Be.prototype.Ha,Be.prototype.setOptions=Be.prototype.o,Be.createFromModelPath=function(e,t){return O(Be,e,{baseOptions:{modelAssetPath:t}})},Be.createFromModelBuffer=function(e,t){return O(Be,e,{baseOptions:{modelAssetBuffer:t}})},Be.createFromOptions=function(e,t){return O(Be,e,t)},Be.HAND_CONNECTIONS=Ds;var Ue=class extends Oe{constructor(e,t){super(new Re(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],S(e=this.h=new fs,0,1,t=new te),this.u=new hs,S(this.h,0,3,this.u),this.j=new nc,S(this.h,0,2,this.j),pt(this.j,3,1),A(this.j,2,.5),A(this.u,2,.5),A(this.h,4,.5)}get baseOptions(){return V(this.h,te,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return"numHands"in e&&pt(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&A(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&A(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&A(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],et(this,e,t),Zc(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ut(this,e,r,t),Zc(this)}m(){var e=new Pe;R(e,"image_in"),R(e,"norm_rect"),j(e,"hand_landmarks"),j(e,"world_hand_landmarks"),j(e,"handedness");const t=new De;ct(t,Tu,this.h);const r=new Ce;Le(r,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),P(r,"LANDMARKS:hand_landmarks"),P(r,"WORLD_LANDMARKS:world_hand_landmarks"),P(r,"HANDEDNESS:handedness"),r.o(t),qe(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i)i=ri(s),this.landmarks.push(Hi(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=kr(s),this.worldLandmarks.push(ii(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=ji(l);const h=[];for(const u of i.g())h.push({score:ie(u,2)??0,index:ze(u,1)??0??-1,categoryName:ye(q(u,3))??""??"",displayName:ye(q(u,4))??""??""});c.push(h)}a.call(s,...c),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ue.prototype.detectForVideo=Ue.prototype.G,Ue.prototype.detect=Ue.prototype.F,Ue.prototype.setOptions=Ue.prototype.o,Ue.createFromModelPath=function(e,t){return O(Ue,e,{baseOptions:{modelAssetPath:t}})},Ue.createFromModelBuffer=function(e,t){return O(Ue,e,{baseOptions:{modelAssetBuffer:t}})},Ue.createFromOptions=function(e,t){return O(Ue,e,t)},Ue.HAND_CONNECTIONS=Ds;var Rc=Ze([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 el(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function tl(e){try{if(!e.D)return e.h;e.D(e.h)}finally{Yi(e)}}function Qi(e,t){e=ri(e),t.push(Hi(e))}var Y=class extends Oe{constructor(e,t){super(new Re(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,S(e=this.j=new uc,0,1,t=new te),this.I=new hs,S(this.j,0,2,this.I),this.W=new Iu,S(this.j,0,3,this.W),this.u=new zi,S(this.j,0,4,this.u),this.O=new tc,S(this.j,0,5,this.O),this.A=new lc,S(this.j,0,6,this.A),this.M=new dc,S(this.j,0,7,this.M),A(this.u,2,.5),A(this.u,3,.3),A(this.O,2,.5),A(this.A,2,.5),A(this.A,3,.3),A(this.M,2,.5),A(this.I,2,.5)}get baseOptions(){return V(this.j,te,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&A(this.u,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&A(this.u,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&A(this.O,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&A(this.A,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&A(this.A,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&A(this.M,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&A(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,r){const i=typeof t!="function"?t:{};return this.D=typeof t=="function"?t:r,el(this),et(this,e,i),tl(this)}G(e,t,r,i){const n=typeof r!="function"?r:{};return this.D=typeof r=="function"?r:i,el(this),ut(this,e,n,t),tl(this)}m(){var e=new Pe;R(e,"input_frames_image"),j(e,"pose_landmarks"),j(e,"pose_world_landmarks"),j(e,"face_landmarks"),j(e,"left_hand_landmarks"),j(e,"left_hand_world_landmarks"),j(e,"right_hand_landmarks"),j(e,"right_hand_world_landmarks");const t=new De,r=new Na;Le(r,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),function(n,s){if(s!=null)if(Array.isArray(s))$(n,2,ki(s,0,Jr));else{if(!(typeof s=="string"||s instanceof nt||yn(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");kt(n,2,En(s,!1),Ot())}}(r,this.j.g());const i=new Ce;Le(i,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Wn(i,8,Na,r),K(i,"IMAGE:input_frames_image"),P(i,"POSE_LANDMARKS:pose_landmarks"),P(i,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),P(i,"FACE_LANDMARKS:face_landmarks"),P(i,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),P(i,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),P(i,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),P(i,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),i.o(t),qe(e,i),Ki(this,e),this.g.attachProtoListener("pose_landmarks",(n,s)=>{Qi(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=kr(n),a.push(ii(n)),x(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",n=>{x(this,n)}),this.outputPoseSegmentationMasks&&(P(i,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Cr(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",(n,s)=>{this.h.poseSegmentationMasks=[Nr(this,n,!0,!this.D)],x(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",n=>{this.h.poseSegmentationMasks=[],x(this,n)})),this.g.attachProtoListener("face_landmarks",(n,s)=>{Qi(n,this.h.faceLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{x(this,n)}),this.outputFaceBlendshapes&&(j(e,"extra_blendshapes"),P(i,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(n,s)=>{var a=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=ji(n),a.push(xs(n.g()??[]))),x(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",n=>{x(this,n)})),this.g.attachProtoListener("left_hand_landmarks",(n,s)=>{Qi(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=kr(n),a.push(ii(n)),x(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("right_hand_landmarks",(n,s)=>{Qi(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=kr(n),a.push(ii(n)),x(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",n=>{x(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Y.prototype.detectForVideo=Y.prototype.G,Y.prototype.detect=Y.prototype.F,Y.prototype.setOptions=Y.prototype.o,Y.createFromModelPath=function(e,t){return O(Y,e,{baseOptions:{modelAssetPath:t}})},Y.createFromModelBuffer=function(e,t){return O(Y,e,{baseOptions:{modelAssetBuffer:t}})},Y.createFromOptions=function(e,t){return O(Y,e,t)},Y.HAND_CONNECTIONS=Ds,Y.POSE_CONNECTIONS=Rc,Y.FACE_LANDMARKS_LIPS=Ns,Y.FACE_LANDMARKS_LEFT_EYE=Ts,Y.FACE_LANDMARKS_LEFT_EYEBROW=Is,Y.FACE_LANDMARKS_LEFT_IRIS=zc,Y.FACE_LANDMARKS_RIGHT_EYE=Fs,Y.FACE_LANDMARKS_RIGHT_EYEBROW=Ls,Y.FACE_LANDMARKS_RIGHT_IRIS=Hc,Y.FACE_LANDMARKS_FACE_OVAL=Ms,Y.FACE_LANDMARKS_CONTOURS=qc,Y.FACE_LANDMARKS_TESSELATION=Kc;var Ye=class extends Oe{constructor(e,t){super(new Re(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},S(e=this.h=new hc,0,1,t=new te)}get baseOptions(){return V(this.h,te,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return S(this.h,0,2,vs(e,V(this.h,ls,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},et(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},ut(this,e,r,t),this.j}m(){var e=new Pe;R(e,"input_image"),R(e,"norm_rect"),j(e,"classifications");const t=new De;ct(t,Fu,this.h);const r=new Ce;Le(r,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),K(r,"IMAGE:input_image"),K(r,"NORM_RECT:norm_rect"),P(r,"CLASSIFICATIONS:classifications"),r.o(t),qe(e,r),this.g.attachProtoListener("classifications",(i,n)=>{this.j=Bu(bu(i)),x(this,n)}),this.g.attachEmptyPacketListener("classifications",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ye.prototype.classifyForVideo=Ye.prototype.ta,Ye.prototype.classify=Ye.prototype.sa,Ye.prototype.setOptions=Ye.prototype.o,Ye.createFromModelPath=function(e,t){return O(Ye,e,{baseOptions:{modelAssetPath:t}})},Ye.createFromModelBuffer=function(e,t){return O(Ye,e,{baseOptions:{modelAssetBuffer:t}})},Ye.createFromOptions=function(e,t){return O(Ye,e,t)};var Ge=class extends Oe{constructor(e,t){super(new Re(e,t),"image_in","norm_rect",!0),this.h=new fc,this.embeddings={embeddings:[]},S(e=this.h,0,1,t=new te)}get baseOptions(){return V(this.h,te,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t=this.h,r=V(this.h,Za,2);return r=r?r.clone():new Za,e.l2Normalize!==void 0?$(r,1,Yr(e.l2Normalize)):"l2Normalize"in e&&$(r,1),e.quantize!==void 0?$(r,2,Yr(e.quantize)):"quantize"in e&&$(r,2),S(t,0,2,r),this.l(e)}za(e,t){return et(this,e,t),this.embeddings}Aa(e,t,r){return ut(this,e,r,t),this.embeddings}m(){var e=new Pe;R(e,"image_in"),R(e,"norm_rect"),j(e,"embeddings_out");const t=new De;ct(t,Lu,this.h);const r=new Ce;Le(r,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),P(r,"EMBEDDINGS:embeddings_out"),r.o(t),qe(e,r),this.g.attachProtoListener("embeddings_out",(i,n)=>{i=Eu(i),this.embeddings=function(s){return{embeddings:gt(s,xu,1).map(a=>{var h,u;const c={headIndex:ze(a,3)??0??-1,headName:ye(q(a,4))??""??""};var l=a.v;return qo(l,0|l[E],Xa,Gn(a,1))!==void 0?(a=Wt(a=V(a,Xa,Gn(a,1),void 0),1,ot,$t()),c.floatEmbedding=a.slice()):(l=new Uint8Array(0),c.quantizedEmbedding=((u=(h=V(a,vu,Gn(a,2),void 0))==null?void 0:h.na())==null?void 0:u.h())??l),c}),timestampMs:Ec(Xo(s))}}(i),x(this,n)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ge.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Ac(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Ac(kc(e.quantizedEmbedding),kc(t.quantizedEmbedding))}return e},Ge.prototype.embedForVideo=Ge.prototype.Aa,Ge.prototype.embed=Ge.prototype.za,Ge.prototype.setOptions=Ge.prototype.o,Ge.createFromModelPath=function(e,t){return O(Ge,e,{baseOptions:{modelAssetPath:t}})},Ge.createFromModelBuffer=function(e,t){return O(Ge,e,{baseOptions:{modelAssetBuffer:t}})},Ge.createFromOptions=function(e,t){return O(Ge,e,t)};var Ps=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 zu(e){var r,i;const t=function(n){return gt(n,Ce,1)}(e.ca()).filter(n=>(ye(q(n,1))??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(e.u=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(((i=(r=V(t[0],De,7))==null?void 0:r.j())==null?void 0:i.g())??new Map).forEach((n,s)=>{e.u[Number(s)]=ye(q(n,1))??""})}function rl(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function il(e){try{const t=new Ps(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Yi(e)}}Ps.prototype.close=Ps.prototype.close;var Se=class extends Oe{constructor(e,t){super(new Re(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new ms,this.A=new wc,S(this.h,0,3,this.A),S(e=this.h,0,1,t=new te)}get baseOptions(){return V(this.h,te,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?$(this.h,2,Qr(e.displayNamesLocale)):"displayNamesLocale"in e&&$(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){zu(this)}segment(e,t,r){const i=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,rl(this),et(this,e,i),il(this)}La(e,t,r,i){const n=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:i,rl(this),ut(this,e,n,t),il(this)}Da(){return this.u}m(){var e=new Pe;R(e,"image_in"),R(e,"norm_rect");const t=new De;ct(t,mc,this.h);const r=new Ce;Le(r,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),r.o(t),qe(e,r),Ki(this,e),this.outputConfidenceMasks&&(j(e,"confidence_masks"),P(r,"CONFIDENCE_MASKS:confidence_masks"),Cr(this,"confidence_masks"),this.g.aa("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Nr(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(j(e,"category_mask"),P(r,"CATEGORY_MASK:category_mask"),Cr(this,"category_mask"),this.g.Z("category_mask",(i,n)=>{this.categoryMask=Nr(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),j(e,"quality_scores"),P(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)}};Se.prototype.getLabels=Se.prototype.Da,Se.prototype.segmentForVideo=Se.prototype.La,Se.prototype.segment=Se.prototype.segment,Se.prototype.setOptions=Se.prototype.o,Se.createFromModelPath=function(e,t){return O(Se,e,{baseOptions:{modelAssetPath:t}})},Se.createFromModelBuffer=function(e,t){return O(Se,e,{baseOptions:{modelAssetBuffer:t}})},Se.createFromOptions=function(e,t){return O(Se,e,t)};var Os=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()}};Os.prototype.close=Os.prototype.close;var ht=class extends Oe{constructor(e,t){super(new Re(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new ms,this.u=new wc,S(this.h,0,3,this.u),S(e=this.h,0,1,t=new te)}get baseOptions(){return V(this.h,te,1)}set baseOptions(e){S(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:{};if(this.j=typeof r=="function"?r:i,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.C+1,i=new bc,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var s=new ys;kt(s,3,Yr(!0),!1),kt(s,1,Kr(t.keypoint.x),0),kt(s,2,Kr(t.keypoint.y),0),Zr(i,1,bs,s)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const c=new Du;for(s of t.scribble)kt(t=new ys,3,Yr(!0),!1),kt(t,1,Kr(s.x),0),kt(t,2,Kr(s.y),0),Wn(c,1,ys,t);Zr(i,2,bs,c)}}this.g.addProtoToStream(i.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",r),et(this,e,n);e:{try{const c=new Os(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var a=c;break e}this.j(c)}finally{Yi(this)}a=void 0}return a}m(){var e=new Pe;R(e,"image_in"),R(e,"roi_in"),R(e,"norm_rect_in");const t=new De;ct(t,mc,this.h);const r=new Ce;Le(r,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),K(r,"IMAGE:image_in"),K(r,"ROI:roi_in"),K(r,"NORM_RECT:norm_rect_in"),r.o(t),qe(e,r),Ki(this,e),this.outputConfidenceMasks&&(j(e,"confidence_masks"),P(r,"CONFIDENCE_MASKS:confidence_masks"),Cr(this,"confidence_masks"),this.g.aa("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Nr(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(j(e,"category_mask"),P(r,"CATEGORY_MASK:category_mask"),Cr(this,"category_mask"),this.g.Z("category_mask",(i,n)=>{this.categoryMask=Nr(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),j(e,"quality_scores"),P(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)}};ht.prototype.segment=ht.prototype.segment,ht.prototype.setOptions=ht.prototype.o,ht.createFromModelPath=function(e,t){return O(ht,e,{baseOptions:{modelAssetPath:t}})},ht.createFromModelBuffer=function(e,t){return O(ht,e,{baseOptions:{modelAssetBuffer:t}})},ht.createFromOptions=function(e,t){return O(ht,e,t)};var Xe=class extends Oe{constructor(e,t){super(new Re(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},S(e=this.h=new vc,0,1,t=new te)}get baseOptions(){return V(this.h,te,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?$(this.h,2,Qr(e.displayNamesLocale)):"displayNamesLocale"in e&&$(this.h,2),e.maxResults!==void 0?pt(this.h,3,e.maxResults):"maxResults"in e&&$(this.h,3),e.scoreThreshold!==void 0?A(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&$(this.h,4),e.categoryAllowlist!==void 0?Ai(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&$(this.h,5),e.categoryDenylist!==void 0?Ai(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&$(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},et(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},ut(this,e,r,t),this.j}m(){var e=new Pe;R(e,"input_frame_gpu"),R(e,"norm_rect"),j(e,"detections");const t=new De;ct(t,Pu,this.h);const r=new Ce;Le(r,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),K(r,"IMAGE:input_frame_gpu"),K(r,"NORM_RECT:norm_rect"),P(r,"DETECTIONS:detections"),r.o(t),qe(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Ha(s),this.j.detections.push(_c(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Xe.prototype.detectForVideo=Xe.prototype.G,Xe.prototype.detect=Xe.prototype.F,Xe.prototype.setOptions=Xe.prototype.o,Xe.createFromModelPath=async function(e,t){return O(Xe,e,{baseOptions:{modelAssetPath:t}})},Xe.createFromModelBuffer=function(e,t){return O(Xe,e,{baseOptions:{modelAssetBuffer:t}})},Xe.createFromOptions=function(e,t){return O(Xe,e,t)};var Bs=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 nl(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function sl(e){try{const t=new Bs(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{Yi(e)}}Bs.prototype.close=Bs.prototype.close;var Ve=class extends Oe{constructor(e,t){super(new Re(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,S(e=this.h=new xc,0,1,t=new te),this.A=new dc,S(this.h,0,3,this.A),this.j=new lc,S(this.h,0,2,this.j),pt(this.j,4,1),A(this.j,2,.5),A(this.A,2,.5),A(this.h,4,.5)}get baseOptions(){return V(this.h,te,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return"numPoses"in e&&pt(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&A(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&A(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&A(this.A,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,r){const i=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:r,nl(this),et(this,e,i),sl(this)}G(e,t,r,i){const n=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:i,nl(this),ut(this,e,n,t),sl(this)}m(){var e=new Pe;R(e,"image_in"),R(e,"norm_rect"),j(e,"normalized_landmarks"),j(e,"world_landmarks"),j(e,"segmentation_masks");const t=new De;ct(t,Ou,this.h);const r=new Ce;Le(r,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),K(r,"IMAGE:image_in"),K(r,"NORM_RECT:norm_rect"),P(r,"NORM_LANDMARKS:normalized_landmarks"),P(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),qe(e,r),Ki(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(i,n)=>{this.landmarks=[];for(const s of i)i=ri(s),this.landmarks.push(Hi(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=kr(s),this.worldLandmarks.push(ii(i));x(this,n)}),this.g.attachEmptyPacketListener("world_landmarks",i=>{this.worldLandmarks=[],x(this,i)}),this.outputSegmentationMasks&&(P(r,"SEGMENTATION_MASK:segmentation_masks"),Cr(this,"segmentation_masks"),this.g.aa("segmentation_masks",(i,n)=>{this.segmentationMasks=i.map(s=>Nr(this,s,!0,!this.u)),x(this,n)}),this.g.attachEmptyPacketListener("segmentation_masks",i=>{this.segmentationMasks=[],x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ve.prototype.detectForVideo=Ve.prototype.G,Ve.prototype.detect=Ve.prototype.F,Ve.prototype.setOptions=Ve.prototype.o,Ve.createFromModelPath=function(e,t){return O(Ve,e,{baseOptions:{modelAssetPath:t}})},Ve.createFromModelBuffer=function(e,t){return O(Ve,e,{baseOptions:{modelAssetBuffer:t}})},Ve.createFromOptions=function(e,t){return O(Ve,e,t)},Ve.POSE_CONNECTIONS=Rc;const Ji="https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task",Hu="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm",qu=()=>{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 h=async()=>"caches"in window?await(await caches.open("mediapipe-models-v1")).match(Ji)!==void 0:!1,u=async()=>{try{const w=await fetch(Ji),g=w.headers.get("content-length"),p=g?parseInt(g,10):0;if(!w.body)throw new Error("No response body");const b=w.body.getReader();let m=0;const y=[];for(;;){const{done:v,value:C}=await b.read();if(v)break;if(y.push(C),m+=C.length,p){const N=Math.round(m/p*100);a(N),n(`Downloading model... ${N}%`)}}return"caches"in window&&await(await caches.open("mediapipe-models-v1")).put(Ji,new Response(new Blob(y),{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 h()?n("Using cached model..."):(n("Model not cached. Downloading..."),await u()),n("Loading MediaPipe WASM...");const p=await Xt.forVisionTasks(Hu);n("Creating face landmarker...");const b=await ee.createFromOptions(p,{baseOptions:{modelAssetPath:Ji,delegate:"GPU"},runningMode:"VIDEO",outputFaceBlendshapes:!0,numFaces:2});e.current=b,r(!0),n("Model loaded successfully ✅")}catch(g){console.error("Model init error:",g),n(`Error: ${g==null?void 0:g.message}`),(g==null?void 0:g.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."))}}},Ku=()=>{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}},Yu=()=>{const e=d.useRef({value:100,isLookingAway:!1}),t=d.useCallback((s,a,c,l)=>{if(!s||!c||!a)return;const h=s.getContext("2d");if(!h)return;const{width:u,height:f}=s;if(h.clearRect(0,0,u,f),h.drawImage(a,0,0,u,f),l){h.fillStyle="#00FF00";for(const w of c)h.fillRect(w.x*u-.5,w.y*f-.5,1,1)}},[]),r=d.useCallback(s=>{const a=e.current.value/100,c=100,l=20,h=20,u=40;s.fillStyle="rgba(0, 0, 0, 0.3)",s.fillRect(h,u,l,c),s.fillStyle=`rgba(${Math.floor(255*(1-a))}, ${Math.floor(255*a)}, 0, 0.8)`;const f=c*a;s.fillRect(h,u+c-f,l,f),s.fillStyle="#FFFFFF",s.fillRect(h,u+c*(1-a),l,2)},[]),i=d.useCallback((s,a,c,l,h,u,f)=>{if(t(s,a,c,l),h&&u&&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}},Xu=50,Qu=()=>{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 h=a[33],u=a[263],f=a[1];if(!h||!u||!f)return;const w=(h.x+u.x)*.5,g=(h.y+u.y)*.5,p=w-c.x,b=g-c.y,m=Math.sqrt(p*p+b*b),y=Math.abs(f.y-c.noseY)*100,v=Math.abs(f.x-c.noseX)*100,C=Math.max(0,100-(m*200+y+v)),N=C<Xu,M=performance.now();return M-n.current>100&&(t(C),i(N),n.current=M),{engagement:C,isLookingAway:N}},[]);return{engagement:e,isLookingAway:r,analyzeGaze:s,setEngagement:t,setIsLookingAway:i}},Ju=.05,Zu=()=>{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 h=[1,33,263,61,291,10,152];let u=0,f=0;const w=l[33],g=l[263],p=c[33],b=c[263];if(!w||!g||!p||!b)return 0;const m=n(w,g),y=n(p,b);if(m===0||y===0)return 0;for(const C of h){const N=l[C],M=c[C];if(N&&M){const I=w.x+(M.x-p.x)*m/y,D=w.y+(M.y-p.y)*m/y;u+=n(N,{x:I,y:D}),f++}}return f===0?0:u/f},[n]),a=d.useCallback((c,l,h,u)=>{if(!c.faceLandmarks||c.faceLandmarks.length===0)return u("Face not detected."),i(!0),t(!1),null;if(l&&h){let f=null,w=0;for(const g of c.faceLandmarks)s(g,h)<Ju&&(f=g,w++);return w===1?(t(!1),i(!1),u("Reference face tracked."),f):w>1?(t(!0),i(!1),u("Multiple matching faces detected. Tracking suspended."),null):(t(!1),i(!0),u("Reference face not detected."),null)}else{const f=c.faceLandmarks[0];if(c.faceLandmarks.length>1)return t(!0),i(!1),u("Multiple faces detected. Please ensure only you are visible."),null;if(!f)return i(!0),t(!1),u("Face not detected."),null;const g=f[1],p=f[33],b=f[263];return g&&p&&b&&g.x>.35&&g.x<.65&&g.y>.3&&g.y<.7&&p.x>.2&&p.x<.8&&b.x>.2&&b.x<.8?(i(!1),t(!1),u("Face detected. Ready for calibration."),f):(i(!0),t(!1),u("Please position your face in the center."),null)}},[s]);return{multipleFacesDetected:e,referenceFaceNotDetected:r,analyzeFace:a,setMultipleFacesDetected:t,setReferenceFaceNotDetected:i}},Ru=500,e1=(e,t)=>{const[r,i]=d.useState(!1),[n,s]=d.useState(Ae.MODEL_LOADING),{incrementGazeViolation:a}=Ks(),{multipleFacesDetected:c,referenceFaceNotDetected:l,isLookingAway:h}=e;d.useEffect(()=>{let w;return(h||c||l)&&t?w=setTimeout(()=>{i(!0),h?(s("looking_away"),a("looking_away")):c?(s("multiple_faces"),a("multiple_faces")):l&&(s("no_face_detected"),a("no_face_detected"))},Ru):(i(!1),s("face_detected")),()=>{clearTimeout(w)}},[h,c,l,t,a]);const u=d.useCallback(()=>c?Ae.MULTIPLE_FACES:l?"no_face_detected":h?Ae.LOOKING_AWAY:n===Ae.MODEL_LOADING?Ae.MODEL_LOADING:Ae.FACE_DETECTED,[c,l,h]),f=d.useCallback(()=>{i(!1),s("face_detected")},[]);return{showGazeWarningModal:r,faceDetectionState:n,getWarningType:u,closeWarningModal:f,setShowGazeWarningModal:i,setFaceDetectionState:s}};class re extends Error{constructor(t,r,i=!1){super(t),this.code=r,this.recoverable=i,this.name="STTError"}}class t1{constructor(t={}){We(this,"config");We(this,"mediaRecorder",null);We(this,"audioChunks",[]);We(this,"recordingStream",null);We(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 re("Audio recording is not supported in this browser","RECORDING_NOT_SUPPORTED",!1);if(this.isRecording())throw new re("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 re(`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 re("Microphone permission was denied","PERMISSION_DENIED",!1);if(n.name==="NotFoundError")throw new re("No microphone found","NO_MICROPHONE",!1)}throw new re(`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 re("No active recording to stop","NO_ACTIVE_RECORDING",!1);return new Promise((t,r)=>{if(!this.mediaRecorder){r(new re("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 re(`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}=t;if(!r||r.size===0)throw new re("Audio blob is empty or invalid","INVALID_AUDIO",!1);try{const i=new FormData,n=new File([r],"recording.wav",{type:r.type||"audio/wav"});if(i.append("file",n),i.append("qna_id",this.config.qnaId||""),!this.config.interviewId)throw new re("Interview ID is missing from configuration","MISSING_INTERVIEW_ID",!1);const s=await vt(`${this.config.baseUrl}${Et.TRANSCRIBE_ANSWER(this.config.interviewId)}`,{method:"POST",headers:{accept:"application/json","X-STT-Provider":this.config.provider||"groq",...this.config.authToken&&{Authorization:`Bearer ${this.config.authToken}`}},body:i},{attempts:1,backoff:"exponential",baseDelay:1e3,maxDelay:3e3,jitter:!0});if(!s.ok){const c=await s.text();let l=`STT request failed: ${s.status} ${s.statusText}`;try{const h=JSON.parse(c);l=h.message||h.error||l}catch{l=c||l}throw new re(l,`HTTP_${s.status}`,s.status>=500)}return{transcript:(await s.json()).data.transcribed_text??""}}catch(i){throw i instanceof re?i:new re(`Transcription failed: ${i instanceof Error?i.message:String(i)}`,"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 Tr=new t1,r1=(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(h=>h.stop())}},[t,r]),d.useEffect(()=>{const s=Tr.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(h=>{h.addEventListener("ended",l)})}},[]),{animationFrameRef:n}},i1=(e,t,r,i,n,s,a,c,l,h,u,f,w,g,p)=>{const b=d.useRef(null),m=d.useCallback(()=>{const y=e.current,v=t.current,C=r.current;if(!y||y.readyState<2||!C||!v){b.current=requestAnimationFrame(m);return}i();try{const N=performance.now(),M=C.detectForVideo(y,N),I=n(M,l,h.current,g);I?(s(v,y,I,u,f,w,l),l&&w&&c(I,h.current,w)):a(v,y)}catch(N){console.error("Face detection error:",N)}b.current=requestAnimationFrame(m)},[e,t,r,i,n,s,a,c,l,h,u,f,w,g,p]);return{renderLoop:m,animationFrameRef:b}},n1=(e,t,r,i)=>{const{referenceSet:n,referenceRef:s,setReferenceData:a}=Ks(),c=d.useRef(s),l=d.useCallback(()=>{c.current=s},[s]),h=d.useCallback(()=>{var g;const f=e.current,w=t.current;if(console.log({faceLandmarker:f,video:w}),!(!f||!w))try{const p=performance.now(),b=f.detectForVideo(w,p);if((g=b.faceLandmarks)!=null&&g[0]){const m=b.faceLandmarks[0],y=m[33],v=m[263],C=m[1];y&&v&&C&&(c.current={x:(y.x+v.x)*.5,y:(y.y+v.y)*.5,noseX:C.x,noseY:C.y},a(!0,c.current),r("Reference set. Gaze tracking active."),console.log("Reference set. Gaze tracking active.",c.current),i&&i())}}catch(p){console.error("Set reference error:",p),r("Failed to set reference")}},[e,t,r,a,i]),u=d.useCallback(()=>{a(!1,{x:0,y:0,noseX:0,noseY:0}),r("Reference reset. Starting calibration...")},[a,r]);return{referenceSet:n,referenceRef:c,setReference:h,resetReference:u,syncReference:l}};function s1({onClose:e,warningType:t,isCheatingModalOpen:r=!1}){const i=eo[t],n=i.icon;return t==="face_detected"?null:o.jsx("div",{className:"iw-absolute iw-left-4 iw-right-4 md:iw-right-auto md:iw-w-[480px] iw-z-50 iw-animate-in iw-fade-in iw-slide-in-from-bottom-4 iw-duration-300 iw-transition-all",style:{bottom:r?"280px":"5rem"},children:o.jsxs("div",{className:"iw-relative iw-overflow-hidden iw-rounded-xl iw-border iw-border-dashed iw-border-[#5C6686] iw-bg-[#F1F5FE] iw-p-4 iw-shadow-2xl iw-backdrop-blur-sm",children:[o.jsx("button",{onClick:e,className:"iw-absolute iw-right-3 iw-top-3 iw-text-gray-400 iw-transition-colors iw-hover:iw-text-gray-600",children:o.jsx(fi,{className:"iw-h-5 iw-w-5"})}),o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-2",children:[o.jsx("div",{className:"iw-flex iw-size-8 iw-flex-shrink-0 iw-items-center iw-justify-center iw-rounded-full iw-border iw-border-[#5C6686]",children:o.jsx(n,{className:"iw-size-6 iw-text-[#5C6686]"})}),o.jsxs("div",{className:"iw-flex-1 iw-pt-0.5",children:[o.jsx("h2",{className:"iw-text-[20px] iw-font-semibold iw-leading-tight iw-text-[#062260] iw-pr-6",children:i.title}),o.jsx("p",{className:"iw-mt-1.5 iw-text-lg iw-text-[#5C6686]",children:i.subtitle}),i.description&&o.jsx("div",{className:"iw-mt-3 iw-border-t iw-border-dashed iw-border-[#5C6686] iw-pt-3",children:o.jsx("p",{className:"iw-text-[14px] iw-font-bold iw-text-[#062260]",children:i.description})})]})]})]})})}const o1=({status:e})=>{const t=eo[e];if(!t)return null;const r=e!=="face_detected";return o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-gap-0.5",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2 iw-px-3 iw-py-1 iw-rounded-full iw-backdrop-blur-md iw-shadow-sm transition-colors duration-300 iw-text-white",children:[o.jsx("div",{className:`iw-flex iw-h-4 iw-w-4 iw-items-center iw-size-2.5 iw-justify-center iw-rounded-full iw-text-white ${e==="face_detected"?"iw-bg-[#22C55E]":e==="model_loading"?"iw-bg-[#062260]":"iw-bg-[#E94315]"}`,children:e==="face_detected"?o.jsx(hi,{}):e==="model_loading"?o.jsx("div",{className:"iw-animate-spin iw-border iw-border-white iw-border-t-transparent iw-rounded-full iw-w-2 iw-h-2"}):o.jsx(fi,{})}),o.jsx("span",{className:"iw-text-sm iw-font-medium",children:e==="face_detected"?"Face detected clearly":e==="camera_error"?"Camera not found":t.title})]}),r&&o.jsx("span",{className:"iw-text-white iw-text-center iw-text-xs iw-drop-shadow-sm iw-max-w-[400px] iw-px-3",children:e==="model_loading"?"Initializing Face models. Please wait...":e==="no_face_detected"?"Face not detected. Please position yourself clearly in the frame.":e==="multiple_faces"?"Multiple faces detected. Please ensure only you are visible.":"Please position your face correctly."})]})},ol=d.forwardRef(({className:e="",interviewId:t="",interview_duration:r,showProctoringUI:i=!0,onSetReference:n,isAnswering:s,onProctoringStatusChange:a,showStatusOverlay:c=!1,cheatingWarningVisible:l=!1,isDeviceLoading:h=!1,videoAllowed:u=!0},f)=>{var kl;const{authToken:w}=Qs(),g=w?Wl(w):null,{borderRadius:p}=Rt(),b=p??18,{proctoring:m,capture_screenshots:y}=un(),v=!!(m!=null&&m.gazeAnalysisEnabled),[C,N]=d.useState(!1),[M,I]=d.useState((m==null?void 0:m.showLandmarks)??!1),[D,T]=d.useState(i&&((m==null?void 0:m.showEngagementBar)??!0)),[L,X]=d.useState(v),[be,Q]=d.useState(!1),W=d.useRef(null),H=d.useRef(null),U=d.useRef(null),J=d.useRef(null),tt=d.useCallback(async xe=>{var sn;const ai=W.current,_e=U.current;if(!ai||!_e)return;const Or=_e.getContext("2d");if(!Or)return;_e.width=ai.videoWidth,_e.height=ai.videoHeight,Or.save(),Or.scale(-1,1),Or.drawImage(ai,-_e.width,0,_e.width,_e.height),Or.restore();const ci=await new Promise(Zt=>_e.toBlob(Zt,"image/jpeg"));if(ci&&t)try{const Zt=`${xe}-${Date.now()}.jpeg`,ke=await wi.requestScreenshotUploadUrl(t,Zt);ke.data&&ke.data.upload_url&&(await wi.uploadScreenshot((sn=ke==null?void 0:ke.data)==null?void 0:sn.upload_url,ci),ke.data.asset_id&&await wi.confirmScreenshotUpload(ke.data.asset_id))}catch(Zt){console.error(`Failed to upload screenshot for ${xe}:`,Zt)}},[wi,t]);d.useEffect(()=>{let xe;return s&&(Q(!0),xe=setTimeout(()=>Q(!1),1e3)),()=>{xe&&clearTimeout(xe)}},[s]);const{faceLandmarkerRef:bt,isModelLoaded:Ne,statusMessage:Ft,setStatusMessage:Qe,loadingProgress:Ir,permissionDenied:Lt,clearCache:Fr}=qu(),{fps:Lr,updateFPS:je}=Ku(),{drawWithEngagementBar:Mt,clearCanvas:oe,engagementRef:rt}=Yu(),{engagement:Mr,isLookingAway:Qt,analyzeGaze:$s,setEngagement:en,setIsLookingAway:Dr}=Qu(),{multipleFacesDetected:si,referenceFaceNotDetected:Jt,analyzeFace:tn,setMultipleFacesDetected:oi,setReferenceFaceNotDetected:Pr}=Zu(),{referenceSet:F,referenceRef:G,setReference:$e,resetReference:rn,syncReference:bl}=n1(bt,W,Qe,n),t2={multipleFacesDetected:si,referenceFaceNotDetected:Jt,isLookingAway:Qt},{showGazeWarningModal:vl,getWarningType:nn,closeWarningModal:xl,setShowGazeWarningModal:El,setFaceDetectionState:_l}=e1(t2,v&&!c);d.useEffect(()=>{if(a){if(h||!Ne){a("model_loading");return}if(!u){a("camera_error");return}const xe=nn()||Ae.NO_FACE;a(xe)}},[Ne,h,u,si,Jt,Qt,nn,a]);const{renderLoop:r2}=i1(W,H,bt,je,tn,Mt,oe,$s,F,G,M,D,v,Qe,Pr);r1(W,Ne,r2,Qe),d.useEffect(()=>{bl()},[bl]),d.useEffect(()=>{rt&&rt.current&&(rt.current.value=Mr,rt.current.isLookingAway=Qt)},[Mr,Qt,rt]);const i2=d.useCallback(xe=>{X(xe),xe||(en(100),Dr(!1))},[en,Dr]),n2=d.useCallback(()=>{Dr(!1),oi(!1),Pr(!1),_l("face_detected"),El(!1),xl()},[Dr,oi,Pr,_l,El,xl]),s2={engagement:Mr,fps:Lr,isLookingAway:Qt,multipleFacesDetected:si,referenceFaceNotDetected:Jt};return d.useEffect(()=>{if(!y)return;const xe=[];return(async()=>{try{const _e=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1});J.current=_e,W.current&&(W.current.srcObject=_e);const ci=(r??li)*60*1e3/3,sn=[0,1,2].map((ke,Dt)=>({label:`capture-${Dt+1}`,start:Dt*ci,end:(Dt+1)*ci})),Zt=(ke,Dt)=>ke===Dt?ke:Math.random()*(Dt-ke)+ke;sn.forEach(({label:ke,start:Dt,end:o2},a2)=>{let Ws;a2===0?Ws=3e3:Ws=Zt(Dt,o2),xe.push(setTimeout(()=>{tt(ke)},Ws))})}catch(_e){console.error("Error accessing camera:",_e)}})(),()=>{J.current&&J.current.getTracks().forEach(_e=>_e.stop()),xe.forEach(clearTimeout)}},[tt,y]),d.useImperativeHandle(f,()=>({setReference:()=>{$e()},resetReference:()=>{rn()},stopCamera:()=>{J.current&&(J.current.getTracks().forEach(xe=>xe.stop()),J.current=null)}}),[$e,rn]),o.jsxs("div",{className:`iw-relative iw-h-full iw-w-full ${e}`,children:[Lt?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-h-full iw-justify-start iw-items-start",children:o.jsxs("div",{className:`iw-relative iw-max-w-full iw-max-h-full iw-aspect-video iw-rounded-2xl iw-overflow-hidden iw-bg-black ${be?"iw-animate-answer-start":""} ${s?"iw-border-4 iw-border-[#6296FB]":""}`,style:{width:"100%",height:"auto",minHeight:"0"},children:[o.jsx("video",{ref:W,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-absolute iw-inset-0 iw-w-full iw-h-full iw-object-cover",style:{transform:"scaleX(-1)"}}),!u&&o.jsx("div",{className:"iw-absolute iw-inset-0 iw-flex iw-flex-col iw-items-center iw-justify-center iw-bg-black/60 iw-z-30",children:h||!Ne?o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-gap-3",children:[o.jsx("div",{className:"iw-w-5 iw-h-5 iw-border-2 iw-border-white/20 iw-border-t-white iw-rounded-full iw-animate-spin"}),o.jsx("span",{className:"iw-text-white/60 iw-text-xs iw-font-medium iw-tracking-wide",children:"Initializing camera..."})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"iw-text-white iw-font-medium iw-text-sm",children:"Camera not found"}),o.jsx("p",{className:"iw-text-white/60 iw-text-xs iw-mt-1",children:"Please ensure your camera is connected and enabled"})]})}),v&&o.jsx("canvas",{ref:H,width:320,height:240,className:"iw-absolute iw-inset-0 iw-w-full iw-h-full iw-object-cover",style:{transform:"scaleX(-1)",borderRadius:b,display:"hidden"}}),o.jsx("canvas",{ref:U,style:{display:"none"}}),i&&o.jsxs("div",{className:"iw-absolute iw-top-4 iw-right-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-[#FFEBE6] iw-px-2 iw-py-1 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-xs iw-text-[#E94315]",children:"RECORDING"})]}),i&&((kl=g==null?void 0:g.data)==null?void 0:kl.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-[#F1F5FE] iw-px-3 iw-py-1 iw-backdrop-blur-md",children:o.jsx("span",{className:"iw-font-medium iw-text-xs iw-text-[#062260]",children:g.data.user_name})}),i&&o.jsx("div",{className:"iw-absolute iw-bottom-4 iw-right-4",children:o.jsx(nd,{showControls:(m==null?void 0:m.showControls)??!1,isBubbleOpen:C,setIsBubbleOpen:N,setReference:$e,clearCache:Fr,isModelLoaded:Ne,gazeAnalysisEnabled:L&&v,referenceSet:F,showLandmarks:M,setShowLandmarks:I,showEngagementBar:D,setShowEngagementBar:T,handleToggleGazeAnalysis:i2,stats:s2,statusMessage:Ft,loadingProgress:Ir})}),c&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"iw-absolute iw-inset-0 iw-pointer-events-none iw-z-10 ",style:{background:"radial-gradient(ellipse 20% 40% at 50% 45%, transparent 99.5%, rgba(0,0,0,0.35) 100%)"}}),o.jsx("div",{className:"iw-absolute iw-bottom-2 iw-inset-x-0 iw-flex iw-justify-center iw-pointer-events-none iw-z-20",children:o.jsx(o1,{status:u?h||!Ne?"model_loading":nn()??"no_face_detected":"camera_error"})})]})]})}),v&&vl&&!c&&o.jsx(s1,{isOpen:vl,onClose:n2,warningType:nn(),isCheatingModalOpen:l})]})}),Zi=({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",h={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"},u={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} ${h[t]} ${u[r]} ${w} ${f} ${a}`,disabled:s||n,...c,children:[n&&o.jsx(Zs,{height:16,width:16,style:{marginRight:"3px"}}),e]})},a1=({stream:e,className:t="",barCount:r=50})=>{const i=d.useRef(null),n=d.useRef(null),s=d.useRef(null),a=d.useRef(null),c=d.useRef(null);d.useEffect(()=>{if(!e||window===void 0)return;a.current||(a.current=new(window.AudioContext||window.webkitAudioContext));const h=a.current;s.current||(s.current=h.createAnalyser(),s.current.fftSize=256,s.current.smoothingTimeConstant=.5);const u=s.current;try{c.current&&c.current.disconnect(),c.current=h.createMediaStreamSource(e),c.current.connect(u)}catch(w){console.error("Error creating media stream source:",w);return}const f=()=>{if(!i.current)return;const w=i.current,g=w.getContext("2d");if(!g)return;const p=u.frequencyBinCount,b=new Uint8Array(p);u.getByteFrequencyData(b);const m=w.width,y=w.height;g.clearRect(0,0,m,y);let v=0;for(let D=0;D<p;D++){const T=b[D]??0;v+=T*T}const C=Math.sqrt(v/p),N=Math.min(1,C/128);g.clearRect(0,0,m,y);const M=r,I=Math.floor(N*M);for(let D=0;D<M;D++){const T=D*(m/M),L=m/M-1.8;D<I?g.fillStyle="#0EB00E":g.fillStyle="#D9D9D9",g.fillRect(T,0,L,y)}n.current=requestAnimationFrame(f)};return f(),()=>{n.current&&cancelAnimationFrame(n.current)}},[e,r]);const l=d.useRef({audioContext:a.current,source:c.current});return l.current={audioContext:a.current,source:c.current},d.useEffect(()=>()=>{l.current.source&&l.current.source.disconnect(),l.current.audioContext&&l.current.audioContext.state!=="closed"&&l.current.audioContext.close()},[]),o.jsx("canvas",{ref:i,className:t,width:300,height:20,style:{width:"100%",height:"16px"}})},al=({icon:e,devices:t,selectedId:r,onChange:i,label:n,showVisualizer:s=!1,stream:a=null,hasPermission:c=!0})=>{const{baseColor:l}=Rt(),[h,u]=d.useState(!1),f=d.useRef(null);d.useEffect(()=>{const p=b=>{f.current&&!f.current.contains(b.target)&&u(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const w=t.find(p=>p.deviceId===r)||t[0],g=c&&(w==null?void 0:w.label)||n;return o.jsxs("div",{className:"iw-relative iw-flex-1 iw-w-1/2 iw-group",ref:f,children:[o.jsxs("div",{className:`iw-max-w-[300px] iw-flex iw-items-center iw-justify-between iw-bg-white iw-border iw-border-gray-200 iw-rounded-xl iw-px-3 iw-py-3 iw-transition-colors ${c?"iw-cursor-pointer hover:iw-border-blue-500":"iw-cursor-not-allowed"}`,onClick:()=>c&&u(!h),title:c?"":"Permission denied or device not found",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-3 iw-min-w-0 iw-max-w-[210px]",children:[o.jsx(e,{className:"iw-w-5 iw-h-5 iw-text-[#062260] iw-flex-shrink-0"}),o.jsx("span",{className:"iw-text-sm iw-text-[#062260] iw-font-medium iw-truncate",children:g})]}),o.jsx("div",{className:"iw-flex iw-items-center iw-gap-2",children:c?o.jsxs(o.Fragment,{children:[o.jsx(Yl,{className:`iw-w-4 iw-h-4 iw-text-gray-400 iw-transition-transform ${h?"iw-rotate-180":""}`}),r&&o.jsx("div",{className:"iw-bg-[#22C55E] iw-rounded-full iw-p-0.5",children:o.jsx(hi,{className:"iw-w-3 iw-h-3 iw-text-white"})})]}):o.jsx("div",{className:"iw-text-[#E94315] iw-relative",children:o.jsx(ui,{className:"iw-size-5"})})})]}),!c&&o.jsx("div",{className:"iw-hidden group-hover:iw-block iw-absolute iw-bottom-full iw-mb-3 iw-left-1/6 -iw-translate-x-1/2 iw-w-64 iw-z-50",children:o.jsxs("div",{className:"iw-rounded-lg iw-p-3 iw-shadow-lg iw-text-white iw-text-left iw-relative",style:{background:l},children:[o.jsx("div",{className:"iw-flex iw-justify-between iw-items-start iw-mb-1",children:o.jsxs("h4",{className:"iw-text-sm iw-font-bold iw-mr-2",children:["Allow us to access your ",(n==null?void 0:n.split(" ")[1])??"device"]})}),o.jsx("p",{className:"iw-text-xs iw-opacity-90 iw-leading-tight",children:"We need permission to access your device. Go to your browser privacy settings to allow it"}),o.jsx("div",{className:"iw-absolute iw-top-full iw-left-1/2 -iw-translate-x-1/2 -iw-mt-1 iw-border-4 iw-border-transparent iw-border-t-[#5865F2]"})]})}),s&&c&&o.jsxs("div",{className:"iw-mt-2 iw-px-1 iw-flex iw-items-center iw-gap-2 iw-overflow-hidden",children:[o.jsx(ed,{className:"iw-min-h-5 iw-min-w-5"}),o.jsx(a1,{stream:a,className:"iw-w-full"})]}),h&&c&&o.jsxs("div",{className:"iw-absolute iw-bottom-full iw-left-0 iw-right-0 iw-mb-2 iw-bg-white iw-border iw-border-gray-100 iw-rounded-xl iw-shadow-xl iw-z-50 iw-py-2 iw-max-h-60 iw-overflow-y-auto",children:[t.map(p=>o.jsxs("div",{className:`iw-px-4 iw-py-2.5 iw-text-sm iw-cursor-pointer iw-flex iw-items-center iw-justify-start hover:iw-bg-gray-50 ${r===p.deviceId?"iw-text-[#062260] iw-font-medium iw-bg-blue-50":"iw-text-gray-600"}`,onClick:()=>{i==null||i(p.deviceId),u(!1)},children:[r===p.deviceId&&o.jsx(hi,{className:"iw-w-4 iw-h-4 iw-text-[#062260] iw-mr-1"}),o.jsx("span",{className:"iw-truncate",children:p.label||`Device ${p.deviceId.slice(0,5)}...`})]},p.deviceId)),t.length===0&&o.jsx("div",{className:"iw-px-4 iw-py-2 iw-text-sm iw-text-gray-400",children:"No devices found"})]})]})},cl=({micEnabled:e=!1,videoEnabled:t=!1,buttonText:r,onButtonClick:i,isAgreed:n,onAgreedToggle:s,showCheckbox:a=!0,showMediaIcons:c=!0,disabled:l=!1,audioDevices:h=[],videoDevices:u=[],selectedAudioId:f,selectedVideoId:w,onAudioChange:g,onVideoChange:p,audioStream:b=null,isDeviceLoading:m=!1})=>{const y=l||!n||c&&(!e||!t)||m;return o.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-4 iw-w-full",children:[a&&o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3 iw-bg-[#F1F5FE] iw-rounded-xl iw-p-3 iw-border iw-border-[#c2c3c7]",children:[o.jsx("div",{className:`iw-mt-0.5 iw-h-5 iw-w-5 iw-min-w-[20px] iw-rounded iw-border iw-flex iw-items-center iw-justify-center iw-cursor-pointer iw-transition-colors ${n?"iw-bg-[#062260] iw-border-[#062260]":"iw-bg-white iw-border-[#062260]"}`,onClick:v=>{v.stopPropagation(),s(!n)},children:n&&o.jsx(hi,{className:"iw-size-3 iw-text-white"})}),o.jsx("label",{onClick:()=>s(!n),className:"iw-text-sm iw-text-[#062260] iw-font-medium iw-cursor-pointer iw-select-none",children:"By continuing, you acknowledge and consent to the use of your face data exclusively for interview monitoring"})]}),o.jsx("div",{className:"iw-flex iw-justify-center iw-items-center iw-gap-4 iw-flex-wrap iw-max-w-[700px] iw-mx-auto",children:c&&o.jsxs("div",{className:"iw-flex iw-gap-4 iw-w-full",children:[o.jsx(al,{icon:Jl,devices:h,selectedId:f??"",onChange:v=>g&&g(v),label:"Choose mic",showVisualizer:!0,stream:b,hasPermission:e}),o.jsx(al,{icon:Rl,devices:u,selectedId:w??"",onChange:v=>p&&p(v),label:"Choose camera",hasPermission:t})]})}),o.jsxs("div",{className:"iw-relative iw-group iw-w-full iw-max-w-[280px] iw-mx-auto",children:[o.jsx(Zi,{onClick:i,disabled:y,className:`iw-h-12 iw-w-full !iw-bg-[#F1F5FE] !iw-text-[#062260] !iw-font-bold !iw-border-[#E7EAF1] iw-rounded-lg ${y?"iw-opacity-50":"hover:iw-opacity-75"}`,children:m?"Device Loading...":r}),!n&&(!c||e&&t)&&c1()]})]})},c1=()=>{const{baseColor:e}=Rt();return o.jsx(o.Fragment,{children:o.jsx("div",{className:"iw-hidden group-hover:iw-block iw-absolute iw-bottom-full iw-mb-3 iw-left-1/2 -iw-translate-x-1/2 iw-w-64 iw-z-50",children:o.jsxs("div",{className:"iw-rounded-lg iw-p-3 iw-shadow-lg iw-text-white iw-text-left iw-relative",style:{background:e},children:[o.jsx("div",{className:"iw-flex iw-justify-between iw-items-start iw-mb-1",children:o.jsx("h4",{className:"iw-text-sm iw-font-bold iw-mr-2",children:"Action Required"})}),o.jsx("p",{className:"iw-text-xs iw-opacity-90 iw-leading-tight",children:"Please check the box to acknowledge and consent to continue."}),o.jsx("div",{className:"iw-absolute iw-top-full iw-left-1/2 -iw-translate-x-1/2 -iw-mt-1 iw-border-4 iw-border-transparent iw-border-t-[#5865F2]"})]})})})},l1=({steps:e,currentStepIndex:t})=>o.jsx("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-4 iw-w-full iw-py-3",children:e.map((r,i)=>{const n=i<t,s=i===t;return o.jsxs(d.Fragment,{children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-3",children:[o.jsx("div",{className:`iw-flex iw-size-9 iw-text-[#062260] iw-items-center iw-justify-center iw-rounded-full iw-font-semibold iw-border ${s||n?"iw-border-[#0EB00E] iw-bg-[#E9FFE6]":"iw-border-[#BDE0FD] iw-bg-[#E6F3FF]"}`,children:n?o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})}):i+1}),o.jsx("span",{className:`iw-text-sm iw-font-medium ${s||n?"iw-text-[#062260]":"iw-text-[#5C6686]"}`,children:r.label})]}),i<e.length-1&&o.jsx("div",{className:"iw-flex-1 iw-max-w-[120px] iw-border-t iw-border-dotted iw-border-[#B3B9CB]"})]},i)})}),d1=["Don't refresh or reload the page during your assessment","Don't switch tabs or open other applications while session is ongoing","Don't leave your position during the session","Don't disable or interfere with video/audio monitoring"],u1=({isOpen:e,onStart:t,gazeEnabled:r=!1,videoFeedRef:i,interviewId:n="",interview_duration:s=li})=>{const{audioAllowed:a,videoAllowed:c,videoRef:l,audioDevices:h,videoDevices:u,selectedAudioDeviceId:f,selectedVideoDeviceId:w,isDeviceLoading:g,currentStream:p,handleAudioChange:b,handleVideoChange:m,stopStream:y}=Hl(e),[v,C]=d.useState(!1),[N,M]=d.useState(0),[I,D]=d.useState(!1),T=d.useRef(null),L=d.useRef(null),X=U=>{T.current=U,i&&(typeof i=="function"?i(U):i.current=U)};if(d.useEffect(()=>()=>{L.current&&(clearInterval(L.current),L.current=null)},[]),!e)return null;const[be,Q]=d.useState(Ae.MODEL_LOADING),W=async()=>{var J;C(!0),(J=T.current)==null||J.resetReference();const U=()=>{var tt;return(tt=T.current)==null?void 0:tt.setReference()};U(),L.current&&clearInterval(L.current),L.current=setInterval(U,500)},H=[{label:r?"Calibrate your camera":"Camera & Mic permission"},{label:"Basic guidelines"}];return o.jsx("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-gray-900/40 iw-backdrop-blur-sm iw-p-4 iw-pt-5 iw-overflow-auto",children:o.jsxs("div",{className:"iw-w-full iw-max-w-[700px] iw-max-h-[900px] iw-my-4 iw-bg-white iw-rounded-xl iw-shadow-2xl iw-overflow-auto",children:[o.jsxs("div",{className:"iw-px-5 iw-pt-3",children:[o.jsx("h2",{className:"iw-text-[#062260] iw-text-2xl iw-font-medium iw-tracking-tight",children:"Final checks before you go live"}),o.jsx("div",{className:"iw-mt-2 iw-bg-[#F1F5FE] iw-rounded-xl iw-p-2 iw-border iw-border-[#E7EAF1]",children:o.jsx("p",{className:"iw-text-[#5C6686] iw-text-xs iw-leading-relaxed",children:"To ensure the integrity of the interview process, this platform uses your device’s camera to monitor your face and gaze direction. We do not store any outside this session"})}),o.jsx("div",{className:"iw-mt-3 iw-border-b iw-border-dashed iw-border-[#B3B9CB] iw-w-full"}),o.jsx(l1,{steps:H,currentStepIndex:N})]}),o.jsx("div",{className:"iw-px-5 iw-pb-5 iw-flex iw-flex-col iw-items-center",children:N===0?o.jsxs("div",{className:"iw-w-full iw-flex iw-flex-col iw-items-center iw-gap-4",children:[o.jsx("div",{className:"iw-w-full iw-max-w-[600px] iw-aspect-video iw-bg-slate-100 iw-rounded-2xl iw-overflow-hidden iw-relative iw-border iw-border-slate-200",children:r?o.jsx(ol,{ref:X,interviewId:n,interview_duration:s,showProctoringUI:!1,showStatusOverlay:!g&&c,isDeviceLoading:g,videoAllowed:c,onProctoringStatusChange:Q,onSetReference:()=>{L.current&&(clearInterval(L.current),L.current=null),C(!1),M(1)}}):o.jsx("video",{ref:l,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-full iw-object-cover",style:{transform:"scaleX(-1)"}})}),o.jsx(cl,{micEnabled:a,videoEnabled:c,buttonText:r?v?"Calibrating...":be==="model_loading"?"Initialising...":"Start calibrate":"Next",onButtonClick:()=>{r?W():M(1)},disabled:!I||r&&be!=="face_detected"||!r&&(!a||!c),isAgreed:I,onAgreedToggle:D,audioDevices:h,videoDevices:u,selectedAudioId:f,selectedVideoId:w,onAudioChange:b,onVideoChange:m,audioStream:p,isDeviceLoading:g})]}):o.jsxs("div",{className:"iw-w-full iw-flex iw-flex-col iw-gap-6",children:[o.jsx("div",{className:"iw-w-full iw-bg-[#F8FAFF] iw-rounded-2xl iw-p-8 iw-flex iw-flex-col iw-gap-5",children:d1.map((U,J)=>o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-7 iw-w-7 iw-min-w-[28px] iw-items-center iw-justify-center iw-rounded-full iw-bg-[#DBEAFE] iw-text-[#062260] iw-text-xs iw-font-bold",children:J+1}),o.jsx("span",{className:"iw-text-[#5C6686] iw-font-medium",children:U})]},J))}),o.jsx(cl,{buttonText:"Start interview",onButtonClick:()=>{t(),y()},isAgreed:I,onAgreedToggle:D,showMediaIcons:!1})]})})]})})};var B=(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))(B||{});const ll={thinkingDuration:0,answeringDuration:120,editingDuration:30},dl={idle:{next:"fetching_question"},fetching_question:{next:"reading_question"},reading_question:{next:"answering"},thinking:{next:"answering",duration:0},answering:{next:"transcribing",duration:120},transcribing:{next:"editing"},editing:{next:"submitting",duration:30},submitting:{next:"completed"},completed:{next:"completed"}};class h1{constructor(t={},r={}){We(this,"config");We(this,"state");We(this,"phaseIntervalId",null);We(this,"globalIntervalId",null);We(this,"callbacks");this.config={...ll,...t},this.callbacks=r,this.state={phase:"idle",currentPhaseTimeRemaining:0,totalTimeElapsed:0,currentQuestionNumber:0}}updateConfig(t){this.config={...this.config,...t}}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;let r=dl[t];if(!r)return;if(r.next==="editing"&&this.config.editingDuration===0){const n=dl.editing;n&&(r=n)}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()}setTotalTimeElapsed(t){var r,i;this.state.totalTimeElapsed=t,(i=(r=this.callbacks).onTick)==null||i.call(r,this.getState())}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 f1(e={}){const{config:t={},callbacks:r={}}=e,i=d.useRef(null);i.current||(i.current=new h1(t,{}));const n=i.current,[s,a]=d.useState(n.getState()),c=d.useCallback(()=>{a(n.getState())},[n]);d.useEffect(()=>{const f={onPhaseChange:(w,g)=>{var p;c(),(p=r.onPhaseChange)==null||p.call(r,w,g)},onTick:w=>{var g;c(),(g=r.onTick)==null||g.call(r,w)},onInterviewEnd:()=>{var w;c(),(w=r.onInterviewEnd)==null||w.call(r)}};n.callbacks=f},[n,r,c]),d.useEffect(()=>{n.updateConfig(t)},[n,t]),d.useEffect(()=>()=>{n.destroy()},[n]);const l=d.useCallback(()=>{n.startQuestion(),c()},[n,c]),h=d.useCallback(()=>{n.nextPhase(),c()},[n,c]),u=d.useCallback(()=>{n.completeInterview(),c()},[n,c]);return{state:s,startQuestion:l,nextPhase:h,completeInterview:u,timerService:n}}function w1(e,t={}){const[r,i]=d.useState({data:null,loading:!1,error:null}),n=d.useCallback(async(...s)=>{var a,c,l,h;i(u=>({...u,loading:!0,error:null}));try{const u=await e(...s);i(f=>({...f,data:u,loading:!1,error:null})),(a=t.onSuccess)==null||a.call(t,u),(c=t.onSettled)==null||c.call(t,u,null)}catch(u){const f=u.type?u:{type:"unknown",message:u.message||"Unknown error",retryable:!0,userMessage:"Something went wrong. Please try again.",originalError:u};i(w=>({...w,loading:!1,error:f})),(l=t.onError)==null||l.call(t,f),(h=t.onSettled)==null||h.call(t,null,f)}},[e,t]);return{...r,execute:n}}const g1=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 g=>{var p;try{if(!a())throw new Error("Fullscreen is not supported in this environment");g.requestFullscreen?await g.requestFullscreen():g.webkitRequestFullscreen?await g.webkitRequestFullscreen():g.mozRequestFullScreen?await g.mozRequestFullScreen():g.msRequestFullscreen&&await g.msRequestFullscreen()}catch(b){const m={name:"FullscreenError",message:b instanceof Error?b.message:"Failed to enter fullscreen"};r(m),(p=e==null?void 0:e.onError)==null||p.call(e,m)}},h=async()=>{var g;try{s.exitFullscreen?await s.exitFullscreen():s.webkitExitFullscreen?await s.webkitExitFullscreen():s.mozCancelFullScreen?await s.mozCancelFullScreen():s.msExitFullscreen&&await s.msExitFullscreen()}catch(p){const b={name:"FullscreenError",message:p instanceof Error?p.message:"Failed to exit fullscreen"};r(b),(g=e==null?void 0:e.onError)==null||g.call(e,b)}},u=d.useCallback(()=>{var p;const g=!!c();n(g),(p=e==null?void 0:e.onFullScreenChange)==null||p.call(e,g)},[e]);d.useEffect(()=>{const g=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];return g.forEach(p=>{document.addEventListener(p,u)}),()=>{g.forEach(p=>{document.removeEventListener(p,u)})}},[u]);const f=async g=>{r(null);const p=g??document.documentElement;await l(p)};return{isFullScreen:i,toggleFullScreen:async g=>{i?await h():await f(g)},enterFullScreen:f,exitFullScreen:h,error:t}};function ul(){const e=di();return d.useMemo(()=>{const r=e.api||{};return new to(r)},[e.api])}const p1=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])},m1=(e={})=>{const[t,r]=d.useState(!1),[i,n]=d.useState(!1),[s,a]=d.useState(null),[c,l]=d.useState(null),[h,u]=d.useState(null);e.config&&Tr.updateConfig(e.config);const f=d.useCallback(async b=>{var m;try{l(null),a(null),u(null),await Tr.startRecording(b,{onStart:()=>{var y;r(!0),(y=e.onStart)==null||y.call(e)},onStop:()=>{var y;r(!1),(y=e.onStop)==null||y.call(e)},onError:y=>{var C;const v=y instanceof re?y:new re(y.message,"RECORDING_ERROR",!0);l(v),r(!1),(C=e.onError)==null||C.call(e,v)}})}catch(y){const v=y instanceof re?y:new re(y instanceof Error?y.message:String(y),"START_FAILED",!1);throw l(v),r(!1),(m=e.onError)==null||m.call(e,v),v}},[]),w=d.useCallback(async()=>{var b,m;try{const y=await Tr.stopRecording();return u(y),r(!1),(b=e.onStop)==null||b.call(e),y}catch(y){const v=y instanceof re?y:new re(y instanceof Error?y.message:String(y),"STOP_FAILED",!1);throw l(v),r(!1),(m=e.onError)==null||m.call(e,v),v}},[]),g=d.useCallback(async(b,m={})=>{var y,v;try{l(null),n(!0);const C={audioBlob:b,...m},N=await Tr.transcribe(C);return a(N.transcript),n(!1),(y=e.onTranscriptionComplete)==null||y.call(e,N),N}catch(C){const N=C instanceof re?C:new re(C instanceof Error?C.message:String(C),"TRANSCRIPTION_FAILED",!0);throw l(N),n(!1),(v=e.onError)==null||v.call(e,N),N}},[]),p=d.useCallback(()=>{Tr.cancelRecording(),r(!1),u(null)},[]);return{startRecording:f,stopRecording:w,transcribe:g,cancelRecording:p,isRecording:t,isTranscribing:i,transcript:s,error:c,audioBlob:h}},y1=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])},b1=()=>{d.useEffect(()=>{const e=document.createElement("style");return e.textContent=`
|
|
15
|
+
}`,e.VERTEX_SHADER),this.W=Uc(this,this.H(),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.O=e.getAttribLocation(this.h,"aVertex"),this.L=e.getAttribLocation(this.h,"aTex")}D(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.X),e.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}};function vt(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 Fs(e){var t=vt(e,1);if(!t){if(t=vt(e,0))t=new Float32Array(t).map(i=>i/255);else{t=new Float32Array(e.width*e.height);const i=Ar(e);var r=Ls(e);if(jc(r,i,$c(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 $c(e){let t=vt(e,2);if(!t){const r=Ar(e);t=Hc(e);const i=Fs(e),n=Wc(e);r.texImage2D(r.TEXTURE_2D,0,n,e.width,e.height,0,r.RED,r.FLOAT,i),Ms(e)}return t}function Ar(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=Ft(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Wc(e){if(e=Ar(e),!Zi)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Zi=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Zi=e.R16F}return Zi}function Ls(e){return e.l||(e.l=new zc),e.l}function Hc(e){const t=Ar(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=vt(e,2);return r||(r=Gc(Ls(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Ms(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Zi,pe=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&&--qc===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!vt(this,0)}ka(){return!!vt(this,1)}R(){return!!vt(this,2)}ja(){return(t=vt(e=this,0))||(t=Fs(e),t=new Uint8Array(t.map(r=>Math.round(255*r))),e.g.push(t)),t;var e,t}ia(){return Fs(this)}N(){return $c(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=Ar(this),n=Ls(this);i.activeTexture(i.TEXTURE1),r=Gc(n,i,this.m?i.LINEAR:i.NEAREST),i.bindTexture(i.TEXTURE_2D,r);const s=Wc(this);i.texImage2D(i.TEXTURE_2D,0,s,this.width,this.height,0,i.RED,i.FLOAT,null),i.bindTexture(i.TEXTURE_2D,null),jc(n,i,r),zu(n,i,!1,()=>{Hc(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),Ms(this)}),$u(n),Ms(this)}}e.push(r)}return new pe(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ar(this).deleteTexture(vt(this,2)),qc=-1}};pe.prototype.close=pe.prototype.close,pe.prototype.clone=pe.prototype.clone,pe.prototype.getAsWebGLTexture=pe.prototype.N,pe.prototype.getAsFloat32Array=pe.prototype.ia,pe.prototype.getAsUint8Array=pe.prototype.ja,pe.prototype.hasWebGLTexture=pe.prototype.R,pe.prototype.hasFloat32Array=pe.prototype.ka,pe.prototype.hasUint8Array=pe.prototype.Fa;var qc=250;function Re(...e){return e.map(([t,r])=>({start:t,end:r}))}const Wu=function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}}((Kc=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:Lc()?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?'),k(this,i||"input_audio",s=>{k(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){dt(this,"__graph_config__",t=>{e(t)}),k(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),k(this,i,a=>{this.i._addAudioToInputStream(this.g,t,r,a,n)})}addGpuBufferToStream(e,t,r){k(this,t,i=>{const[n,s]=Pc(this,e,i);this.i._addBoundTextureToStream(i,n,s,r)})}addBoolToStream(e,t,r){k(this,t,i=>{this.i._addBoolToInputStream(e,i,r)})}addDoubleToStream(e,t,r){k(this,t,i=>{this.i._addDoubleToInputStream(e,i,r)})}addFloatToStream(e,t,r){k(this,t,i=>{this.i._addFloatToInputStream(e,i,r)})}addIntToStream(e,t,r){k(this,t,i=>{this.i._addIntToInputStream(e,i,r)})}addUintToStream(e,t,r){k(this,t,i=>{this.i._addUintToInputStream(e,i,r)})}addStringToStream(e,t,r){k(this,t,i=>{k(this,e,n=>{this.i._addStringToInputStream(n,i,r)})})}addStringRecordToStream(e,t,r){k(this,t,i=>{Oc(this,Object.keys(e),n=>{Oc(this,Object.values(e),s=>{this.i._addFlatHashMapToInputStream(n,s,Object.keys(e).length,i,r)})})})}addProtoToStream(e,t,r,i){k(this,r,n=>{k(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){k(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){k(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){k(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){k(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){k(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){k(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){k(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)k(this,s,a=>{this.i._addStringVectorEntry(n,a)});this.i._addStringVectorToInputStream(n,i,r)})}addBoolToInputSidePacket(e,t){k(this,t,r=>{this.i._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){k(this,t,r=>{this.i._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){k(this,t,r=>{this.i._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){k(this,t,r=>{this.i._addIntToInputSidePacket(e,r)})}addUintToInputSidePacket(e,t){k(this,t,r=>{this.i._addUintToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){k(this,t,r=>{k(this,e,i=>{this.i._addStringToInputSidePacket(i,r)})})}addProtoToInputSidePacket(e,t,r){k(this,r,i=>{k(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){k(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){k(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){k(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){k(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){k(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){k(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)k(this,n,s=>{this.i._addStringVectorEntry(i,s)});this.i._addStringVectorToInputSidePacket(i,r)})}attachBoolListener(e,t){dt(this,e,t),k(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){It(this,e,t),k(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){dt(this,e,t),k(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){It(this,e,t),k(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){dt(this,e,t),k(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){It(this,e,t),k(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){dt(this,e,t),k(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){It(this,e,t),k(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){dt(this,e,t),k(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){It(this,e,t),k(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){dt(this,e,t),k(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){It(this,e,t),k(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){dt(this,e,t),k(this,e,i=>{this.i._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){It(this,e,t),k(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?'),dt(this,e,(i,n)=>{i=new Float32Array(i.buffer,i.byteOffset,i.length/4),t(i,n)}),k(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 Kc{get ga(){return this.i}pa(e,t,r){k(this,t,i=>{const[n,s]=Pc(this,e,i);this.ga._addBoundTextureAsImageToStream(i,n,s,r)})}Z(e,t){dt(this,e,t),k(this,e,r=>{this.ga._attachImageListener(r)})}aa(e,t){It(this,e,t),k(this,e,r=>{this.ga._attachImageVectorListener(r)})}}));var Kc,et=class extends Wu{};async function U(e,t,r){return async function(i,n,s,a){return Gu(i,n,s,a)}(e,r.canvas??(Lc()?void 0:document.createElement("canvas")),t,r)}function Yc(e,t,r,i){if(e.U){const s=new Ra;if(r!=null&&r.regionOfInterest){if(!e.oa)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].");T(s,1,(n.left+n.right)/2),T(s,2,(n.top+n.bottom)/2),T(s,4,n.right-n.left),T(s,3,n.bottom-n.top)}else T(s,1,.5),T(s,2,.5),T(s,4,1),T(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(T(s,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[a,c]=Dc(t);r=ne(s,3)*c/a,n=ne(s,4)*a/c,T(s,4,r),T(s,3,n)}}e.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",e.U,i)}e.g.pa(t,e.X,i??performance.now()),e.finishProcessing()}function tt(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'.");Yc(e,t,r,e.C+1)}function ut(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'.");Yc(e,t,r,i)}function Cr(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 pe([n],r,!1,e.g.i.canvas,e.P,s,t),i?e.clone():e}var Be=class extends Ns{constructor(e,t,r,i){super(e),this.g=e,this.X=t,this.U=r,this.oa=i,this.P=new zc}l(e,t=!0){if("runningMode"in e&&$(this.baseOptions,2,Xr(!!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 He=class extends Be{constructor(e,t){super(new et(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},N(e=this.h=new Ki,0,1,t=new ie),T(this.h,2,.5),T(this.h,3,.3)}get baseOptions(){return V(this.h,ie,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&T(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&T(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},tt(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},ut(this,e,r,t),this.j}m(){var e=new Oe;te(e,"image_in"),te(e,"norm_rect_in"),z(e,"detections");const t=new Pe;ct(t,Su,this.h);const r=new Te;Me(r,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),Q(r,"IMAGE:image_in"),Q(r,"NORM_RECT:norm_rect_in"),B(r,"DETECTIONS:detections"),r.o(t),We(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Qa(s),this.j.detections.push(Tc(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};He.prototype.detectForVideo=He.prototype.G,He.prototype.detect=He.prototype.F,He.prototype.setOptions=He.prototype.o,He.createFromModelPath=async function(e,t){return U(He,e,{baseOptions:{modelAssetPath:t}})},He.createFromModelBuffer=function(e,t){return U(He,e,{baseOptions:{modelAssetBuffer:t}})},He.createFromOptions=function(e,t){return U(He,e,t)};var Ds=Re([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]),Ps=Re([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]),Os=Re([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Xc=Re([474,475],[475,476],[476,477],[477,474]),Bs=Re([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]),Us=Re([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Qc=Re([469,470],[470,471],[471,472],[472,469]),Vs=Re([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]),Jc=[...Ds,...Ps,...Os,...Bs,...Us,...Vs],Zc=Re([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 Rc(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var re=class extends Be{constructor(e,t){super(new et(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,N(e=this.h=new ac,0,1,t=new ie),this.A=new oc,N(this.h,0,3,this.A),this.u=new Ki,N(this.h,0,2,this.u),yt(this.u,4,1),T(this.u,2,.5),T(this.A,2,.5),T(this.h,4,.5)}get baseOptions(){return V(this.h,ie,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return"numFaces"in e&&yt(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&T(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&T(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&T(this.A,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return Rc(this),tt(this,e,t),this.j}G(e,t,r){return Rc(this),ut(this,e,r,t),this.j}m(){var e=new Oe;te(e,"image_in"),te(e,"norm_rect"),z(e,"face_landmarks");const t=new Pe;ct(t,Cu,this.h);const r=new Te;Me(r,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),Q(r,"IMAGE:image_in"),Q(r,"NORM_RECT:norm_rect"),B(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),We(e,r),this.g.attachProtoVectorListener("face_landmarks",(i,n)=>{for(const s of i)i=ii(s),this.j.faceLandmarks.push(Yi(i));x(this,n)}),this.g.attachEmptyPacketListener("face_landmarks",i=>{x(this,i)}),this.outputFaceBlendshapes&&(z(e,"blendshapes"),B(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(i,n)=>{if(this.outputFaceBlendshapes)for(const s of i)i=Wi(s),this.j.faceBlendshapes.push(Cs(i.g()??[]));x(this,n)}),this.g.attachEmptyPacketListener("blendshapes",i=>{x(this,i)})),this.outputFacialTransformationMatrixes&&(z(e,"face_geometry"),B(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(i,n)=>{if(this.outputFacialTransformationMatrixes)for(const s of i)(i=V(i=Au(s),mu,2))&&this.j.facialTransformationMatrixes.push({rows:ze(i,1)??0??0,columns:ze(i,2)??0??0,data:Wt(i,3,ot,$t()).slice()??[]});x(this,n)}),this.g.attachEmptyPacketListener("face_geometry",i=>{x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};re.prototype.detectForVideo=re.prototype.G,re.prototype.detect=re.prototype.F,re.prototype.setOptions=re.prototype.o,re.createFromModelPath=function(e,t){return U(re,e,{baseOptions:{modelAssetPath:t}})},re.createFromModelBuffer=function(e,t){return U(re,e,{baseOptions:{modelAssetBuffer:t}})},re.createFromOptions=function(e,t){return U(re,e,t)},re.FACE_LANDMARKS_LIPS=Ds,re.FACE_LANDMARKS_LEFT_EYE=Ps,re.FACE_LANDMARKS_LEFT_EYEBROW=Os,re.FACE_LANDMARKS_LEFT_IRIS=Xc,re.FACE_LANDMARKS_RIGHT_EYE=Bs,re.FACE_LANDMARKS_RIGHT_EYEBROW=Us,re.FACE_LANDMARKS_RIGHT_IRIS=Qc,re.FACE_LANDMARKS_FACE_OVAL=Vs,re.FACE_LANDMARKS_CONTOURS=Jc,re.FACE_LANDMARKS_TESSELATION=Zc;var Gs=Re([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 el(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function tl(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 rl(e,t=!0){const r=[];for(const n of e){var i=Wi(n);e=[];for(const s of i.g())i=t&&ze(s,1)!=null?ze(s,1)??0:-1,e.push({score:ne(s,2)??0,index:i,categoryName:ve(X(s,3))??""??"",displayName:ve(X(s,4))??""??""});r.push(e)}return r}var Ue=class extends Be{constructor(e,t){super(new et(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],N(e=this.j=new dc,0,1,t=new ie),this.u=new bs,N(this.j,0,2,this.u),this.D=new ys,N(this.u,0,3,this.D),this.A=new lc,N(this.u,0,2,this.A),this.h=new Tu,N(this.j,0,3,this.h),T(this.A,2,.5),T(this.u,4,.5),T(this.D,2,.5)}get baseOptions(){return V(this.j,ie,1)}set baseOptions(e){N(this.j,0,1,e)}o(e){var n,s,a,c;if(yt(this.A,3,e.numHands??1),"minHandDetectionConfidence"in e&&T(this.A,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&T(this.u,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&T(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new kr,r=t,i=As(e.cannedGesturesClassifierOptions,(n=V(this.h,kr,3))==null?void 0:n.l());N(r,0,2,i),N(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((s=V(this.h,kr,3))==null||s.g());return e.customGesturesClassifierOptions?(N(r=t=new kr,0,2,i=As(e.customGesturesClassifierOptions,(a=V(this.h,kr,4))==null?void 0:a.l())),N(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((c=V(this.h,kr,4))==null||c.g()),this.l(e)}Ha(e,t){return el(this),tt(this,e,t),tl(this)}Ia(e,t,r){return el(this),ut(this,e,r,t),tl(this)}m(){var e=new Oe;te(e,"image_in"),te(e,"norm_rect"),z(e,"hand_gestures"),z(e,"hand_landmarks"),z(e,"world_hand_landmarks"),z(e,"handedness");const t=new Pe;ct(t,Nu,this.j);const r=new Te;Me(r,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),Q(r,"IMAGE:image_in"),Q(r,"NORM_RECT:norm_rect"),B(r,"HAND_GESTURES:hand_gestures"),B(r,"LANDMARKS:hand_landmarks"),B(r,"WORLD_LANDMARKS:world_hand_landmarks"),B(r,"HANDEDNESS:handedness"),r.o(t),We(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i){i=ii(s);const a=[];for(const c of mt(i,Za,1))a.push({x:ne(c,1)??0,y:ne(c,2)??0,z:ne(c,3)??0,visibility:ne(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=_r(s);const a=[];for(const c of mt(i,Ja,1))a.push({x:ne(c,1)??0,y:ne(c,2)??0,z:ne(c,3)??0,visibility:ne(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(...rl(i,!1)),x(this,n)}),this.g.attachEmptyPacketListener("hand_gestures",i=>{x(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{this.handedness.push(...rl(i)),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function il(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Ue.prototype.recognizeForVideo=Ue.prototype.Ia,Ue.prototype.recognize=Ue.prototype.Ha,Ue.prototype.setOptions=Ue.prototype.o,Ue.createFromModelPath=function(e,t){return U(Ue,e,{baseOptions:{modelAssetPath:t}})},Ue.createFromModelBuffer=function(e,t){return U(Ue,e,{baseOptions:{modelAssetBuffer:t}})},Ue.createFromOptions=function(e,t){return U(Ue,e,t)},Ue.HAND_CONNECTIONS=Gs;var Ve=class extends Be{constructor(e,t){super(new et(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],N(e=this.h=new bs,0,1,t=new ie),this.u=new ys,N(this.h,0,3,this.u),this.j=new lc,N(this.h,0,2,this.j),yt(this.j,3,1),T(this.j,2,.5),T(this.u,2,.5),T(this.h,4,.5)}get baseOptions(){return V(this.h,ie,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return"numHands"in e&&yt(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&T(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&T(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&T(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],tt(this,e,t),il(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ut(this,e,r,t),il(this)}m(){var e=new Oe;te(e,"image_in"),te(e,"norm_rect"),z(e,"hand_landmarks"),z(e,"world_hand_landmarks"),z(e,"handedness");const t=new Pe;ct(t,Iu,this.h);const r=new Te;Me(r,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),Q(r,"IMAGE:image_in"),Q(r,"NORM_RECT:norm_rect"),B(r,"LANDMARKS:hand_landmarks"),B(r,"WORLD_LANDMARKS:world_hand_landmarks"),B(r,"HANDEDNESS:handedness"),r.o(t),We(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i)i=ii(s),this.landmarks.push(Yi(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=_r(s),this.worldLandmarks.push(ni(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=Wi(l);const h=[];for(const u of i.g())h.push({score:ne(u,2)??0,index:ze(u,1)??0??-1,categoryName:ve(X(u,3))??""??"",displayName:ve(X(u,4))??""??""});c.push(h)}a.call(s,...c),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ve.prototype.detectForVideo=Ve.prototype.G,Ve.prototype.detect=Ve.prototype.F,Ve.prototype.setOptions=Ve.prototype.o,Ve.createFromModelPath=function(e,t){return U(Ve,e,{baseOptions:{modelAssetPath:t}})},Ve.createFromModelBuffer=function(e,t){return U(Ve,e,{baseOptions:{modelAssetBuffer:t}})},Ve.createFromOptions=function(e,t){return U(Ve,e,t)},Ve.HAND_CONNECTIONS=Gs;var nl=Re([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 sl(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function ol(e){try{if(!e.D)return e.h;e.D(e.h)}finally{Ji(e)}}function Ri(e,t){e=ii(e),t.push(Yi(e))}var J=class extends Be{constructor(e,t){super(new et(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,N(e=this.j=new pc,0,1,t=new ie),this.I=new ys,N(this.j,0,2,this.I),this.W=new Fu,N(this.j,0,3,this.W),this.u=new Ki,N(this.j,0,4,this.u),this.O=new oc,N(this.j,0,5,this.O),this.A=new wc,N(this.j,0,6,this.A),this.M=new gc,N(this.j,0,7,this.M),T(this.u,2,.5),T(this.u,3,.3),T(this.O,2,.5),T(this.A,2,.5),T(this.A,3,.3),T(this.M,2,.5),T(this.I,2,.5)}get baseOptions(){return V(this.j,ie,1)}set baseOptions(e){N(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&T(this.u,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&T(this.u,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&T(this.O,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&T(this.A,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&T(this.A,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&T(this.M,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&T(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,r){const i=typeof t!="function"?t:{};return this.D=typeof t=="function"?t:r,sl(this),tt(this,e,i),ol(this)}G(e,t,r,i){const n=typeof r!="function"?r:{};return this.D=typeof r=="function"?r:i,sl(this),ut(this,e,n,t),ol(this)}m(){var e=new Oe;te(e,"input_frames_image"),z(e,"pose_landmarks"),z(e,"pose_world_landmarks"),z(e,"face_landmarks"),z(e,"left_hand_landmarks"),z(e,"left_hand_world_landmarks"),z(e,"right_hand_landmarks"),z(e,"right_hand_world_landmarks");const t=new Pe,r=new Ma;Me(r,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),function(n,s){if(s!=null)if(Array.isArray(s))$(n,2,Ci(s,0,Zr));else{if(!(typeof s=="string"||s instanceof nt||kn(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");St(n,2,Tn(s,!1),Bt())}}(r,this.j.g());const i=new Te;Me(i,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Xn(i,8,Ma,r),Q(i,"IMAGE:input_frames_image"),B(i,"POSE_LANDMARKS:pose_landmarks"),B(i,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),B(i,"FACE_LANDMARKS:face_landmarks"),B(i,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),B(i,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),B(i,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),B(i,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),i.o(t),We(e,i),Qi(this,e),this.g.attachProtoListener("pose_landmarks",(n,s)=>{Ri(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=_r(n),a.push(ni(n)),x(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",n=>{x(this,n)}),this.outputPoseSegmentationMasks&&(B(i,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Sr(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",(n,s)=>{this.h.poseSegmentationMasks=[Cr(this,n,!0,!this.D)],x(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",n=>{this.h.poseSegmentationMasks=[],x(this,n)})),this.g.attachProtoListener("face_landmarks",(n,s)=>{Ri(n,this.h.faceLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{x(this,n)}),this.outputFaceBlendshapes&&(z(e,"extra_blendshapes"),B(i,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(n,s)=>{var a=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=Wi(n),a.push(Cs(n.g()??[]))),x(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",n=>{x(this,n)})),this.g.attachProtoListener("left_hand_landmarks",(n,s)=>{Ri(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=_r(n),a.push(ni(n)),x(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("right_hand_landmarks",(n,s)=>{Ri(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=_r(n),a.push(ni(n)),x(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",n=>{x(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};J.prototype.detectForVideo=J.prototype.G,J.prototype.detect=J.prototype.F,J.prototype.setOptions=J.prototype.o,J.createFromModelPath=function(e,t){return U(J,e,{baseOptions:{modelAssetPath:t}})},J.createFromModelBuffer=function(e,t){return U(J,e,{baseOptions:{modelAssetBuffer:t}})},J.createFromOptions=function(e,t){return U(J,e,t)},J.HAND_CONNECTIONS=Gs,J.POSE_CONNECTIONS=nl,J.FACE_LANDMARKS_LIPS=Ds,J.FACE_LANDMARKS_LEFT_EYE=Ps,J.FACE_LANDMARKS_LEFT_EYEBROW=Os,J.FACE_LANDMARKS_LEFT_IRIS=Xc,J.FACE_LANDMARKS_RIGHT_EYE=Bs,J.FACE_LANDMARKS_RIGHT_EYEBROW=Us,J.FACE_LANDMARKS_RIGHT_IRIS=Qc,J.FACE_LANDMARKS_FACE_OVAL=Vs,J.FACE_LANDMARKS_CONTOURS=Jc,J.FACE_LANDMARKS_TESSELATION=Zc;var qe=class extends Be{constructor(e,t){super(new et(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},N(e=this.h=new mc,0,1,t=new ie)}get baseOptions(){return V(this.h,ie,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return N(this.h,0,2,As(e,V(this.h,gs,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},tt(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},ut(this,e,r,t),this.j}m(){var e=new Oe;te(e,"input_image"),te(e,"norm_rect"),z(e,"classifications");const t=new Pe;ct(t,Lu,this.h);const r=new Te;Me(r,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),Q(r,"IMAGE:input_image"),Q(r,"NORM_RECT:norm_rect"),B(r,"CLASSIFICATIONS:classifications"),r.o(t),We(e,r),this.g.attachProtoListener("classifications",(i,n)=>{this.j=Uu(vu(i)),x(this,n)}),this.g.attachEmptyPacketListener("classifications",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};qe.prototype.classifyForVideo=qe.prototype.ta,qe.prototype.classify=qe.prototype.sa,qe.prototype.setOptions=qe.prototype.o,qe.createFromModelPath=function(e,t){return U(qe,e,{baseOptions:{modelAssetPath:t}})},qe.createFromModelBuffer=function(e,t){return U(qe,e,{baseOptions:{modelAssetBuffer:t}})},qe.createFromOptions=function(e,t){return U(qe,e,t)};var Ge=class extends Be{constructor(e,t){super(new et(e,t),"image_in","norm_rect",!0),this.h=new yc,this.embeddings={embeddings:[]},N(e=this.h,0,1,t=new ie)}get baseOptions(){return V(this.h,ie,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){var t=this.h,r=V(this.h,ic,2);return r=r?r.clone():new ic,e.l2Normalize!==void 0?$(r,1,Xr(e.l2Normalize)):"l2Normalize"in e&&$(r,1),e.quantize!==void 0?$(r,2,Xr(e.quantize)):"quantize"in e&&$(r,2),N(t,0,2,r),this.l(e)}za(e,t){return tt(this,e,t),this.embeddings}Aa(e,t,r){return ut(this,e,r,t),this.embeddings}m(){var e=new Oe;te(e,"image_in"),te(e,"norm_rect"),z(e,"embeddings_out");const t=new Pe;ct(t,Mu,this.h);const r=new Te;Me(r,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),Q(r,"IMAGE:image_in"),Q(r,"NORM_RECT:norm_rect"),B(r,"EMBEDDINGS:embeddings_out"),r.o(t),We(e,r),this.g.attachProtoListener("embeddings_out",(i,n)=>{i=_u(i),this.embeddings=function(s){return{embeddings:mt(s,Eu,1).map(a=>{var h,u;const c={headIndex:ze(a,3)??0??-1,headName:ve(X(a,4))??""??""};var l=a.v;return Jo(l,0|l[E],ec,Hn(a,1))!==void 0?(a=Wt(a=V(a,ec,Hn(a,1),void 0),1,ot,$t()),c.floatEmbedding=a.slice()):(l=new Uint8Array(0),c.quantizedEmbedding=((u=(h=V(a,xu,Hn(a,2),void 0))==null?void 0:h.na())==null?void 0:u.h())??l),c}),timestampMs:Cc(ea(s))}}(i),x(this,n)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ge.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Ic(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Ic(Nc(e.quantizedEmbedding),Nc(t.quantizedEmbedding))}return e},Ge.prototype.embedForVideo=Ge.prototype.Aa,Ge.prototype.embed=Ge.prototype.za,Ge.prototype.setOptions=Ge.prototype.o,Ge.createFromModelPath=function(e,t){return U(Ge,e,{baseOptions:{modelAssetPath:t}})},Ge.createFromModelBuffer=function(e,t){return U(Ge,e,{baseOptions:{modelAssetBuffer:t}})},Ge.createFromOptions=function(e,t){return U(Ge,e,t)};var js=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 Hu(e){var r,i;const t=function(n){return mt(n,Te,1)}(e.ca()).filter(n=>(ve(X(n,1))??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(e.u=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(((i=(r=V(t[0],Pe,7))==null?void 0:r.j())==null?void 0:i.g())??new Map).forEach((n,s)=>{e.u[Number(s)]=ve(X(n,1))??""})}function al(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function cl(e){try{const t=new js(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Ji(e)}}js.prototype.close=js.prototype.close;var Ne=class extends Be{constructor(e,t){super(new et(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new _s,this.A=new bc,N(this.h,0,3,this.A),N(e=this.h,0,1,t=new ie)}get baseOptions(){return V(this.h,ie,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?$(this.h,2,Jr(e.displayNamesLocale)):"displayNamesLocale"in e&&$(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){Hu(this)}segment(e,t,r){const i=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,al(this),tt(this,e,i),cl(this)}La(e,t,r,i){const n=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:i,al(this),ut(this,e,n,t),cl(this)}Da(){return this.u}m(){var e=new Oe;te(e,"image_in"),te(e,"norm_rect");const t=new Pe;ct(t,Ec,this.h);const r=new Te;Me(r,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),Q(r,"IMAGE:image_in"),Q(r,"NORM_RECT:norm_rect"),r.o(t),We(e,r),Qi(this,e),this.outputConfidenceMasks&&(z(e,"confidence_masks"),B(r,"CONFIDENCE_MASKS:confidence_masks"),Sr(this,"confidence_masks"),this.g.aa("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Cr(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(z(e,"category_mask"),B(r,"CATEGORY_MASK:category_mask"),Sr(this,"category_mask"),this.g.Z("category_mask",(i,n)=>{this.categoryMask=Cr(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),z(e,"quality_scores"),B(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)}};Ne.prototype.getLabels=Ne.prototype.Da,Ne.prototype.segmentForVideo=Ne.prototype.La,Ne.prototype.segment=Ne.prototype.segment,Ne.prototype.setOptions=Ne.prototype.o,Ne.createFromModelPath=function(e,t){return U(Ne,e,{baseOptions:{modelAssetPath:t}})},Ne.createFromModelBuffer=function(e,t){return U(Ne,e,{baseOptions:{modelAssetBuffer:t}})},Ne.createFromOptions=function(e,t){return U(Ne,e,t)};var zs=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()}};zs.prototype.close=zs.prototype.close;var ht=class extends Be{constructor(e,t){super(new et(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new _s,this.u=new bc,N(this.h,0,3,this.u),N(e=this.h,0,1,t=new ie)}get baseOptions(){return V(this.h,ie,1)}set baseOptions(e){N(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:{};if(this.j=typeof r=="function"?r:i,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.C+1,i=new kc,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var s=new ks;St(s,3,Xr(!0),!1),St(s,1,Yr(t.keypoint.x),0),St(s,2,Yr(t.keypoint.y),0),Rr(i,1,Ss,s)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const c=new Pu;for(s of t.scribble)St(t=new ks,3,Xr(!0),!1),St(t,1,Yr(s.x),0),St(t,2,Yr(s.y),0),Xn(c,1,ks,t);Rr(i,2,Ss,c)}}this.g.addProtoToStream(i.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",r),tt(this,e,n);e:{try{const c=new zs(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var a=c;break e}this.j(c)}finally{Ji(this)}a=void 0}return a}m(){var e=new Oe;te(e,"image_in"),te(e,"roi_in"),te(e,"norm_rect_in");const t=new Pe;ct(t,Ec,this.h);const r=new Te;Me(r,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),Q(r,"IMAGE:image_in"),Q(r,"ROI:roi_in"),Q(r,"NORM_RECT:norm_rect_in"),r.o(t),We(e,r),Qi(this,e),this.outputConfidenceMasks&&(z(e,"confidence_masks"),B(r,"CONFIDENCE_MASKS:confidence_masks"),Sr(this,"confidence_masks"),this.g.aa("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Cr(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(z(e,"category_mask"),B(r,"CATEGORY_MASK:category_mask"),Sr(this,"category_mask"),this.g.Z("category_mask",(i,n)=>{this.categoryMask=Cr(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),z(e,"quality_scores"),B(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)}};ht.prototype.segment=ht.prototype.segment,ht.prototype.setOptions=ht.prototype.o,ht.createFromModelPath=function(e,t){return U(ht,e,{baseOptions:{modelAssetPath:t}})},ht.createFromModelBuffer=function(e,t){return U(ht,e,{baseOptions:{modelAssetBuffer:t}})},ht.createFromOptions=function(e,t){return U(ht,e,t)};var Ke=class extends Be{constructor(e,t){super(new et(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},N(e=this.h=new Sc,0,1,t=new ie)}get baseOptions(){return V(this.h,ie,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?$(this.h,2,Jr(e.displayNamesLocale)):"displayNamesLocale"in e&&$(this.h,2),e.maxResults!==void 0?yt(this.h,3,e.maxResults):"maxResults"in e&&$(this.h,3),e.scoreThreshold!==void 0?T(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&$(this.h,4),e.categoryAllowlist!==void 0?Ti(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&$(this.h,5),e.categoryDenylist!==void 0?Ti(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&$(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},tt(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},ut(this,e,r,t),this.j}m(){var e=new Oe;te(e,"input_frame_gpu"),te(e,"norm_rect"),z(e,"detections");const t=new Pe;ct(t,Ou,this.h);const r=new Te;Me(r,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),Q(r,"IMAGE:input_frame_gpu"),Q(r,"NORM_RECT:norm_rect"),B(r,"DETECTIONS:detections"),r.o(t),We(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Qa(s),this.j.detections.push(Tc(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ke.prototype.detectForVideo=Ke.prototype.G,Ke.prototype.detect=Ke.prototype.F,Ke.prototype.setOptions=Ke.prototype.o,Ke.createFromModelPath=async function(e,t){return U(Ke,e,{baseOptions:{modelAssetPath:t}})},Ke.createFromModelBuffer=function(e,t){return U(Ke,e,{baseOptions:{modelAssetBuffer:t}})},Ke.createFromOptions=function(e,t){return U(Ke,e,t)};var $s=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 ll(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function dl(e){try{const t=new $s(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{Ji(e)}}$s.prototype.close=$s.prototype.close;var je=class extends Be{constructor(e,t){super(new et(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,N(e=this.h=new Ac,0,1,t=new ie),this.A=new gc,N(this.h,0,3,this.A),this.j=new wc,N(this.h,0,2,this.j),yt(this.j,4,1),T(this.j,2,.5),T(this.A,2,.5),T(this.h,4,.5)}get baseOptions(){return V(this.h,ie,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return"numPoses"in e&&yt(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&T(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&T(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&T(this.A,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,r){const i=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:r,ll(this),tt(this,e,i),dl(this)}G(e,t,r,i){const n=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:i,ll(this),ut(this,e,n,t),dl(this)}m(){var e=new Oe;te(e,"image_in"),te(e,"norm_rect"),z(e,"normalized_landmarks"),z(e,"world_landmarks"),z(e,"segmentation_masks");const t=new Pe;ct(t,Bu,this.h);const r=new Te;Me(r,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),Q(r,"IMAGE:image_in"),Q(r,"NORM_RECT:norm_rect"),B(r,"NORM_LANDMARKS:normalized_landmarks"),B(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),We(e,r),Qi(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(i,n)=>{this.landmarks=[];for(const s of i)i=ii(s),this.landmarks.push(Yi(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=_r(s),this.worldLandmarks.push(ni(i));x(this,n)}),this.g.attachEmptyPacketListener("world_landmarks",i=>{this.worldLandmarks=[],x(this,i)}),this.outputSegmentationMasks&&(B(r,"SEGMENTATION_MASK:segmentation_masks"),Sr(this,"segmentation_masks"),this.g.aa("segmentation_masks",(i,n)=>{this.segmentationMasks=i.map(s=>Cr(this,s,!0,!this.u)),x(this,n)}),this.g.attachEmptyPacketListener("segmentation_masks",i=>{this.segmentationMasks=[],x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};je.prototype.detectForVideo=je.prototype.G,je.prototype.detect=je.prototype.F,je.prototype.setOptions=je.prototype.o,je.createFromModelPath=function(e,t){return U(je,e,{baseOptions:{modelAssetPath:t}})},je.createFromModelBuffer=function(e,t){return U(je,e,{baseOptions:{modelAssetBuffer:t}})},je.createFromOptions=function(e,t){return U(je,e,t)},je.POSE_CONNECTIONS=nl;const en="https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task",qu="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm",Ku=()=>{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 h=async()=>"caches"in window?await(await caches.open("mediapipe-models-v1")).match(en)!==void 0:!1,u=async()=>{try{const w=await fetch(en),g=w.headers.get("content-length"),p=g?parseInt(g,10):0;if(!w.body)throw new Error("No response body");const y=w.body.getReader();let m=0;const b=[];for(;;){const{done:v,value:I}=await y.read();if(v)break;if(b.push(I),m+=I.length,p){const C=Math.round(m/p*100);a(C),n(`Downloading model... ${C}%`)}}return"caches"in window&&await(await caches.open("mediapipe-models-v1")).put(en,new Response(new Blob(b),{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 h()?n("Using cached model..."):(n("Model not cached. Downloading..."),await u()),n("Loading MediaPipe WASM...");const p=await Qt.forVisionTasks(qu);n("Creating face landmarker...");const y=await re.createFromOptions(p,{baseOptions:{modelAssetPath:en,delegate:"GPU"},runningMode:"VIDEO",outputFaceBlendshapes:!0,numFaces:2});e.current=y,r(!0),n("Model loaded successfully ✅")}catch(g){console.error("Model init error:",g),n(`Error: ${g==null?void 0:g.message}`),(g==null?void 0:g.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."))}}},Yu=()=>{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}},Xu=()=>{const e=d.useRef({value:100,isLookingAway:!1}),t=d.useCallback((s,a,c,l)=>{if(!s||!c||!a)return;const h=s.getContext("2d");if(!h)return;const{width:u,height:f}=s;if(h.clearRect(0,0,u,f),h.drawImage(a,0,0,u,f),l){h.fillStyle="#00FF00";for(const w of c)h.fillRect(w.x*u-.5,w.y*f-.5,1,1)}},[]),r=d.useCallback(s=>{const a=e.current.value/100,c=100,l=20,h=20,u=40;s.fillStyle="rgba(0, 0, 0, 0.3)",s.fillRect(h,u,l,c),s.fillStyle=`rgba(${Math.floor(255*(1-a))}, ${Math.floor(255*a)}, 0, 0.8)`;const f=c*a;s.fillRect(h,u+c-f,l,f),s.fillStyle="#FFFFFF",s.fillRect(h,u+c*(1-a),l,2)},[]),i=d.useCallback((s,a,c,l,h,u,f)=>{if(t(s,a,c,l),h&&u&&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}},Qu=50,Ju=()=>{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 h=a[33],u=a[263],f=a[1];if(!h||!u||!f)return;const w=(h.x+u.x)*.5,g=(h.y+u.y)*.5,p=w-c.x,y=g-c.y,m=Math.sqrt(p*p+y*y),b=Math.abs(f.y-c.noseY)*100,v=Math.abs(f.x-c.noseX)*100,I=Math.max(0,100-(m*200+b+v)),C=I<Qu,S=performance.now();return S-n.current>100&&(t(I),i(C),n.current=S),{engagement:I,isLookingAway:C}},[]);return{engagement:e,isLookingAway:r,analyzeGaze:s,setEngagement:t,setIsLookingAway:i}},Zu=.05,Ru=()=>{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 h=[1,33,263,61,291,10,152];let u=0,f=0;const w=l[33],g=l[263],p=c[33],y=c[263];if(!w||!g||!p||!y)return 0;const m=n(w,g),b=n(p,y);if(m===0||b===0)return 0;for(const I of h){const C=l[I],S=c[I];if(C&&S){const A=w.x+(S.x-p.x)*m/b,M=w.y+(S.y-p.y)*m/b;u+=n(C,{x:A,y:M}),f++}}return f===0?0:u/f},[n]),a=d.useCallback((c,l,h,u)=>{if(!c.faceLandmarks||c.faceLandmarks.length===0)return u("Face not detected."),i(!0),t(!1),null;if(l&&h){let f=null,w=0;for(const g of c.faceLandmarks)s(g,h)<Zu&&(f=g,w++);return w===1?(t(!1),i(!1),u("Reference face tracked."),f):w>1?(t(!0),i(!1),u("Multiple matching faces detected. Tracking suspended."),null):(t(!1),i(!0),u("Reference face not detected."),null)}else{const f=c.faceLandmarks[0];if(c.faceLandmarks.length>1)return t(!0),i(!1),u("Multiple faces detected. Please ensure only you are visible."),null;if(!f)return i(!0),t(!1),u("Face not detected."),null;const g=f[1],p=f[33],y=f[263];return g&&p&&y&&g.x>.35&&g.x<.65&&g.y>.3&&g.y<.7&&p.x>.2&&p.x<.8&&y.x>.2&&y.x<.8?(i(!1),t(!1),u("Face detected. Ready for calibration."),f):(i(!0),t(!1),u("Please position your face in the center."),null)}},[s]);return{multipleFacesDetected:e,referenceFaceNotDetected:r,analyzeFace:a,setMultipleFacesDetected:t,setReferenceFaceNotDetected:i}},eh=500,th=(e,t)=>{const[r,i]=d.useState(!1),[n,s]=d.useState(Ce.MODEL_LOADING),{incrementGazeViolation:a}=Zs(),{multipleFacesDetected:c,referenceFaceNotDetected:l,isLookingAway:h}=e;d.useEffect(()=>{let w;return(h||c||l)&&t?w=setTimeout(()=>{i(!0),h?(s("looking_away"),a("looking_away")):c?(s("multiple_faces"),a("multiple_faces")):l&&(s("no_face_detected"),a("no_face_detected"))},eh):(i(!1),s("face_detected")),()=>{clearTimeout(w)}},[h,c,l,t,a]);const u=d.useCallback(()=>c?Ce.MULTIPLE_FACES:l?"no_face_detected":h?Ce.LOOKING_AWAY:n===Ce.MODEL_LOADING?Ce.MODEL_LOADING:Ce.FACE_DETECTED,[c,l,h]),f=d.useCallback(()=>{i(!1),s("face_detected")},[]);return{showGazeWarningModal:r,faceDetectionState:n,getWarningType:u,closeWarningModal:f,setShowGazeWarningModal:i,setFaceDetectionState:s}};class W extends Error{constructor(t,r,i=!1){super(t),this.code=r,this.recoverable=i,this.name="STTError"}}const rh=50*1024*1024,ul=300,hl=500;class fl{constructor(t={}){ye(this,"config");ye(this,"mediaRecorder",null);ye(this,"audioChunks",[]);ye(this,"audioChunksTotalSize",0);ye(this,"recordingStream",null);ye(this,"autoStopTimeoutId",null);ye(this,"disposed",!1);ye(this,"pendingStopPromise",null);ye(this,"isStarting",!1);ye(this,"recordingStartTime",null);this.config={baseUrl:"http://localhost:8000",provider:"groq",model:"whisper-large-v3-turbo",language:"en",includeTimestamps:!1,temperature:0,...t}}updateConfig(t){this.throwIfDisposed(),this.config={...this.config,...t}}isRecordingSupported(){return!!(navigator.mediaDevices&&typeof navigator.mediaDevices.getUserMedia=="function"&&window.MediaRecorder)}async startRecording(t,r){var i;if(this.throwIfDisposed(),!this.isRecordingSupported())throw new W("Audio recording is not supported in this browser","RECORDING_NOT_SUPPORTED",!1);if(this.isRecording()||this.isStarting){console.warn("STTService.startRecording: already recording or starting, ignoring duplicate call.");return}this.isStarting=!0;try{this.recordingStream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:44100}}),this.audioChunks=[],this.audioChunksTotalSize=0;const n=this.getSupportedMimeType();this.mediaRecorder=new MediaRecorder(this.recordingStream,{mimeType:n}),this.mediaRecorder.addEventListener("dataavailable",s=>{var a,c,l;if(s.data.size>0){if(this.audioChunksTotalSize+s.data.size>rh){console.error(`Max size exceeded: ${(this.audioChunksTotalSize/1024/1024).toFixed(2)} MB`);const h=new W("Recording exceeded maximum size limit","MAX_SIZE_EXCEEDED",!1);(a=r==null?void 0:r.onError)==null||a.call(r,h),this.isRecording()&&((c=this.mediaRecorder)==null||c.stop());return}this.audioChunks.push(s.data),this.audioChunksTotalSize+=s.data.size,(l=r==null?void 0:r.onDataAvailable)==null||l.call(r,s.data)}}),this.mediaRecorder.addEventListener("stop",()=>{var s;(s=r==null?void 0:r.onStop)==null||s.call(r)},{once:!0}),this.mediaRecorder.addEventListener("error",s=>{var c;const a=new W(`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),this.recordingStartTime=Date.now(),(i=r==null?void 0:r.onStart)==null||i.call(r),t&&t>0&&(this.autoStopTimeoutId=setTimeout(()=>{this.handleAutoStop()},t*1e3))}catch(n){if(this.cleanup(),n instanceof Error){if(n.name==="NotAllowedError"||n.name==="PermissionDeniedError")throw new W("Microphone permission was denied","PERMISSION_DENIED",!1);if(n.name==="NotFoundError")throw new W("No microphone found","NO_MICROPHONE",!1)}throw new W(`Failed to start recording: ${n instanceof Error?n.message:String(n)}`,"START_RECORDING_FAILED",!0)}finally{this.isStarting=!1}}async stopRecording(){var t;if(this.throwIfDisposed(),this.pendingStopPromise)return this.pendingStopPromise;if(this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),!this.mediaRecorder||this.mediaRecorder.state==="inactive"){if(this.audioChunks.length>0){const i=((t=this.mediaRecorder)==null?void 0:t.mimeType)||"audio/webm",n=new Blob(this.audioChunks,{type:i});return this.cleanup(),n}const r=this.mediaRecorder?"State is inactive":"MediaRecorder is null";throw console.warn(`Cannot stop recording: ${r}`),new W("No active recording to stop","NO_ACTIVE_RECORDING",!1)}if(this.recordingStartTime!==null){const r=Date.now()-this.recordingStartTime;r<ul&&await new Promise(i=>setTimeout(i,ul-r))}return this.pendingStopPromise=new Promise((r,i)=>{if(!this.mediaRecorder){this.pendingStopPromise=null,i(new W("MediaRecorder is null","MEDIARECORDER_NULL",!1));return}const n=this.mediaRecorder,s=()=>{setTimeout(()=>{try{const a=n.mimeType||"audio/webm",c=new Blob(this.audioChunks,{type:a});if(!c||c.size===0){this.cleanup(),i(new W("Audio blob is empty","EMPTY_BLOB",!1));return}this.cleanup(),r(c)}catch(a){this.cleanup(),i(new W(`Failed to create audio blob: ${a instanceof Error?a.message:String(a)}`,"BLOB_CREATION_FAILED",!1))}finally{this.pendingStopPromise=null}},0)};n.addEventListener("stop",s,{once:!0});try{n.requestData(),n.stop()}catch(a){this.pendingStopPromise=null,i(a)}}),this.pendingStopPromise}handleAutoStop(){if(!this.isRecording())return;const t=this.recordingStartTime?Date.now()-this.recordingStartTime:1/0;if(t<hl){const r=hl-t;setTimeout(()=>{this.isRecording()&&this.executeAutoStop()},r);return}this.executeAutoStop()}executeAutoStop(){this.stopRecording().catch(t=>{console.error("Auto-stop recording failed:",t),t instanceof W&&console.error(`[${t.code}] ${t.message}`)})}async transcribe(t){this.throwIfDisposed();const{audioBlob:r}=t;if(!r||r.size===0)throw new W("Audio blob is empty or invalid","INVALID_AUDIO",!1);try{const i=new FormData,n=new File([r],"recording.wav",{type:r.type||"audio/wav"});if(i.append("file",n),i.append("qna_id",this.config.qnaId||""),!this.config.interviewId)throw new W("Interview ID is missing from configuration","MISSING_INTERVIEW_ID",!1);const s=await xt(`${this.config.baseUrl}${_t.TRANSCRIBE_ANSWER(this.config.interviewId)}`,{method:"POST",headers:{accept:"application/json","X-STT-Provider":this.config.provider||"groq",...this.config.authToken&&{Authorization:`Bearer ${this.config.authToken}`}},body:i},{attempts:1,backoff:"exponential",baseDelay:1e3,maxDelay:3e3,jitter:!0});if(!s.ok){const c=await s.text();let l=`STT request failed: ${s.status} ${s.statusText}`;try{const h=JSON.parse(c);l=h.message||h.error||l}catch{l=c||l}throw new W(l,`HTTP_${s.status}`,s.status>=500)}return{transcript:(await s.json()).data.transcribed_text??""}}catch(i){throw i instanceof W?i:new W(`Transcription failed: ${i instanceof Error?i.message:String(i)}`,"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"}dispose(){this.disposed||(this.cancelRecording(),this.disposed=!0)}isDisposed(){return this.disposed}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.recordingStartTime=null,this.mediaRecorder=null,this.audioChunks=[],this.audioChunksTotalSize=0,this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null)}throwIfDisposed(){if(this.disposed)throw new W("STTService has been disposed and cannot be reused","SERVICE_DISPOSED",!1)}}const ih=new fl,nh=(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(h=>h.stop())}},[t,r]),d.useEffect(()=>{const s=ih.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(h=>{h.addEventListener("ended",l)})}},[]),{animationFrameRef:n}},sh=(e,t,r,i,n,s,a,c,l,h,u,f,w,g,p)=>{const y=d.useRef(null),m=d.useCallback(()=>{const b=e.current,v=t.current,I=r.current;if(!b||b.readyState<2||!I||!v){y.current=requestAnimationFrame(m);return}i();try{const C=performance.now(),S=I.detectForVideo(b,C),A=n(S,l,h.current,g);A?(s(v,b,A,u,f,w,l),l&&w&&c(A,h.current,w)):a(v,b)}catch(C){console.error("Face detection error:",C)}y.current=requestAnimationFrame(m)},[e,t,r,i,n,s,a,c,l,h,u,f,w,g,p]);return{renderLoop:m,animationFrameRef:y}},oh=(e,t,r,i)=>{const{referenceSet:n,referenceRef:s,setReferenceData:a}=Zs(),c=d.useRef(s),l=d.useCallback(()=>{c.current=s},[s]),h=d.useCallback(()=>{var g;const f=e.current,w=t.current;if(!(!f||!w))try{const p=performance.now(),y=f.detectForVideo(w,p);if((g=y.faceLandmarks)!=null&&g[0]){const m=y.faceLandmarks[0],b=m[33],v=m[263],I=m[1];b&&v&&I&&(c.current={x:(b.x+v.x)*.5,y:(b.y+v.y)*.5,noseX:I.x,noseY:I.y},a(!0,c.current),r("Reference set. Gaze tracking active."),i&&i())}}catch(p){console.error("Set reference error:",p),r("Failed to set reference")}},[e,t,r,a,i]),u=d.useCallback(()=>{a(!1,{x:0,y:0,noseX:0,noseY:0}),r("Reference reset. Starting calibration...")},[a,r]);return{referenceSet:n,referenceRef:c,setReference:h,resetReference:u,syncReference:l}};function ah({onClose:e,warningType:t,isCheatingModalOpen:r=!1}){const i=so[t],n=i.icon;return t==="face_detected"?null:o.jsx("div",{className:"iw-absolute iw-left-4 iw-right-4 md:iw-right-auto md:iw-w-[480px] iw-z-50 iw-animate-in iw-fade-in iw-slide-in-from-bottom-4 iw-duration-300 iw-transition-all",style:{bottom:r?"280px":"5rem"},children:o.jsxs("div",{className:"iw-relative iw-overflow-hidden iw-rounded-xl iw-border iw-border-dashed iw-border-[#5C6686] iw-bg-[#F1F5FE] iw-p-4 iw-shadow-2xl iw-backdrop-blur-sm",children:[o.jsx("button",{onClick:e,className:"iw-absolute iw-right-3 iw-top-3 iw-text-gray-400 iw-transition-colors iw-hover:iw-text-gray-600",children:o.jsx(pi,{className:"iw-h-5 iw-w-5"})}),o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-2",children:[o.jsx("div",{className:"iw-flex iw-size-8 iw-flex-shrink-0 iw-items-center iw-justify-center iw-rounded-full iw-border iw-border-[#5C6686]",children:o.jsx(n,{className:"iw-size-6 iw-text-[#5C6686]"})}),o.jsxs("div",{className:"iw-flex-1 iw-pt-0.5",children:[o.jsx("h2",{className:"iw-text-[20px] iw-font-semibold iw-leading-tight iw-text-[#062260] iw-pr-6",children:i.title}),o.jsx("p",{className:"iw-mt-1.5 iw-text-lg iw-text-[#5C6686]",children:i.subtitle}),i.description&&o.jsx("div",{className:"iw-mt-3 iw-border-t iw-border-dashed iw-border-[#5C6686] iw-pt-3",children:o.jsx("p",{className:"iw-text-[14px] iw-font-bold iw-text-[#062260]",children:i.description})})]})]})]})})}const ch=({status:e})=>{const t=so[e];if(!t)return null;const r=e!=="face_detected";return o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-gap-0.5",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2 iw-px-3 iw-py-1 iw-rounded-full iw-backdrop-blur-md iw-shadow-sm transition-colors duration-300 iw-text-white",children:[o.jsx("div",{className:`iw-flex iw-h-4 iw-w-4 iw-items-center iw-size-2.5 iw-justify-center iw-rounded-full iw-text-white ${e==="face_detected"?"iw-bg-[#22C55E]":e==="model_loading"?"iw-bg-[#062260]":"iw-bg-[#E94315]"}`,children:e==="face_detected"?o.jsx(gi,{}):e==="model_loading"?o.jsx("div",{className:"iw-animate-spin iw-border iw-border-white iw-border-t-transparent iw-rounded-full iw-w-2 iw-h-2"}):o.jsx(pi,{})}),o.jsx("span",{className:"iw-text-sm iw-font-medium",children:e==="face_detected"?"Face detected clearly":e==="camera_error"?"Camera not found":t.title})]}),r&&o.jsx("span",{className:"iw-text-white iw-text-center iw-text-xs iw-drop-shadow-sm iw-max-w-[400px] iw-px-3",children:e==="model_loading"?"Initializing Face models. Please wait...":e==="no_face_detected"?"Face not detected. Please position yourself clearly in the frame.":e==="multiple_faces"?"Multiple faces detected. Please ensure only you are visible.":"Please position your face correctly."})]})},wl=d.forwardRef(({className:e="",interviewId:t="",interview_duration:r,showProctoringUI:i=!0,onSetReference:n,isAnswering:s,onProctoringStatusChange:a,showStatusOverlay:c=!1,cheatingWarningVisible:l=!1,isDeviceLoading:h=!1,videoAllowed:u=!0},f)=>{var Sl;const{authToken:w}=to(),g=w?Wl(w):null,{borderRadius:p}=Zt(),y=p??18,{proctoring:m,capture_screenshots:b}=mn(),v=!!(m!=null&&m.gazeAnalysisEnabled),[I,C]=d.useState(!1),[S,A]=d.useState((m==null?void 0:m.showLandmarks)??!1),[M,F]=d.useState(i&&((m==null?void 0:m.showEngagementBar)??!0)),[D,G]=d.useState(v),[Y,H]=d.useState(!1),q=d.useRef(null),Z=d.useRef(null),O=d.useRef(null),R=d.useRef(null),Ye=d.useCallback(async Ee=>{var un;const di=q.current,Se=O.current;if(!di||!Se)return;const Br=Se.getContext("2d");if(!Br)return;Se.width=di.videoWidth,Se.height=di.videoHeight,Br.save(),Br.scale(-1,1),Br.drawImage(di,-Se.width,0,Se.width,Se.height),Br.restore();const ui=await new Promise(Jt=>Se.toBlob(Jt,"image/jpeg"));if(ui&&t)try{const Jt=`${Ee}-${Date.now()}.jpeg`,Ae=await mi.requestScreenshotUploadUrl(t,Jt);Ae.data&&Ae.data.upload_url&&(await mi.uploadScreenshot((un=Ae==null?void 0:Ae.data)==null?void 0:un.upload_url,ui),Ae.data.asset_id&&await mi.confirmScreenshotUpload(Ae.data.asset_id))}catch(Jt){console.error(`Failed to upload screenshot for ${Ee}:`,Jt)}},[mi,t]);d.useEffect(()=>{let Ee;return s&&(H(!0),Ee=setTimeout(()=>H(!1),1e3)),()=>{Ee&&clearTimeout(Ee)}},[s]);const{faceLandmarkerRef:ft,isModelLoaded:Xe,statusMessage:oi,setStatusMessage:ke,loadingProgress:Lt,permissionDenied:Mt,clearCache:Tr}=Ku(),{fps:Nr,updateFPS:Ir}=Yu(),{drawWithEngagementBar:Fr,clearCanvas:Lr,engagementRef:rt}=Xu(),{engagement:Qe,isLookingAway:wt,analyzeGaze:me,setEngagement:Mr,setIsLookingAway:Dt}=Ju(),{multipleFacesDetected:Dr,referenceFaceNotDetected:Pr,analyzeFace:Ks,setMultipleFacesDetected:sn,setReferenceFaceNotDetected:ai}=Ru(),{referenceSet:on,referenceRef:an,setReference:Or,resetReference:cn,syncReference:ci}=oh(ft,q,ke,n),ln={multipleFacesDetected:Dr,referenceFaceNotDetected:Pr,isLookingAway:wt},{showGazeWarningModal:li,getWarningType:L,closeWarningModal:j,setShowGazeWarningModal:Je,setFaceDetectionState:dn}=th(ln,v&&!c);d.useEffect(()=>{if(a){if(h||!Xe){a("model_loading");return}if(!u){a("camera_error");return}const Ee=L()||Ce.NO_FACE;a(Ee)}},[Xe,h,u,Dr,Pr,wt,L,a]);const{renderLoop:s1}=sh(q,Z,ft,Ir,Ks,Fr,Lr,me,on,an,S,M,v,ke,ai);nh(q,Xe,s1,ke),d.useEffect(()=>{ci()},[ci]),d.useEffect(()=>{rt&&rt.current&&(rt.current.value=Qe,rt.current.isLookingAway=wt)},[Qe,wt,rt]);const o1=d.useCallback(Ee=>{G(Ee),Ee||(Mr(100),Dt(!1))},[Mr,Dt]),a1=d.useCallback(()=>{Dt(!1),sn(!1),ai(!1),dn("face_detected"),Je(!1),j()},[Dt,sn,ai,dn,Je,j]),c1={engagement:Qe,fps:Nr,isLookingAway:wt,multipleFacesDetected:Dr,referenceFaceNotDetected:Pr};return d.useEffect(()=>{if(!b)return;const Ee=[];return(async()=>{try{const Se=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1});R.current=Se,q.current&&(q.current.srcObject=Se);const ui=(r??hi)*60*1e3/3,un=[0,1,2].map((Ae,Pt)=>({label:`capture-${Pt+1}`,start:Pt*ui,end:(Pt+1)*ui})),Jt=(Ae,Pt)=>Ae===Pt?Ae:Math.random()*(Pt-Ae)+Ae;un.forEach(({label:Ae,start:Pt,end:l1},d1)=>{let Ys;d1===0?Ys=3e3:Ys=Jt(Pt,l1),Ee.push(setTimeout(()=>{Ye(Ae)},Ys))})}catch(Se){console.error("Error accessing camera:",Se)}})(),()=>{R.current&&R.current.getTracks().forEach(Se=>Se.stop()),Ee.forEach(clearTimeout)}},[Ye,b]),d.useImperativeHandle(f,()=>({setReference:()=>{Or()},resetReference:()=>{cn()},stopCamera:()=>{R.current&&(R.current.getTracks().forEach(Ee=>Ee.stop()),R.current=null)}}),[Or,cn]),o.jsxs("div",{className:`iw-relative iw-h-full iw-w-full ${e}`,children:[Mt?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-h-full iw-justify-start iw-items-start",children:o.jsxs("div",{className:`iw-relative iw-max-w-full iw-max-h-full iw-aspect-video iw-rounded-2xl iw-overflow-hidden iw-bg-black ${Y?"iw-animate-answer-start":""} ${s?"iw-border-4 iw-border-[#6296FB]":""}`,style:{width:"100%",height:"auto",minHeight:"0"},children:[o.jsx("video",{ref:q,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-absolute iw-inset-0 iw-w-full iw-h-full iw-object-cover",style:{transform:"scaleX(-1)"}}),!u&&o.jsx("div",{className:"iw-absolute iw-inset-0 iw-flex iw-flex-col iw-items-center iw-justify-center iw-bg-black/60 iw-z-30",children:h||!Xe?o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-gap-3",children:[o.jsx("div",{className:"iw-w-5 iw-h-5 iw-border-2 iw-border-white/20 iw-border-t-white iw-rounded-full iw-animate-spin"}),o.jsx("span",{className:"iw-text-white/60 iw-text-xs iw-font-medium iw-tracking-wide",children:"Initializing camera..."})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"iw-text-white iw-font-medium iw-text-sm",children:"Camera not found"}),o.jsx("p",{className:"iw-text-white/60 iw-text-xs iw-mt-1",children:"Please ensure your camera is connected and enabled"})]})}),v&&o.jsx("canvas",{ref:Z,width:320,height:240,className:"iw-absolute iw-inset-0 iw-w-full iw-h-full iw-object-cover",style:{transform:"scaleX(-1)",borderRadius:y,display:"hidden"}}),o.jsx("canvas",{ref:O,style:{display:"none"}}),i&&o.jsxs("div",{className:"iw-absolute iw-top-4 iw-right-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-[#FFEBE6] iw-px-2 iw-py-1 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-xs iw-text-[#E94315]",children:"RECORDING"})]}),i&&((Sl=g==null?void 0:g.data)==null?void 0:Sl.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-[#F1F5FE] iw-px-3 iw-py-1 iw-backdrop-blur-md",children:o.jsx("span",{className:"iw-font-medium iw-text-xs iw-text-[#062260]",children:g.data.user_name})}),i&&o.jsx("div",{className:"iw-absolute iw-bottom-4 iw-right-4",children:o.jsx(sd,{showControls:(m==null?void 0:m.showControls)??!1,isBubbleOpen:I,setIsBubbleOpen:C,setReference:Or,clearCache:Tr,isModelLoaded:Xe,gazeAnalysisEnabled:D&&v,referenceSet:on,showLandmarks:S,setShowLandmarks:A,showEngagementBar:M,setShowEngagementBar:F,handleToggleGazeAnalysis:o1,stats:c1,statusMessage:oi,loadingProgress:Lt})}),c&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"iw-absolute iw-inset-0 iw-pointer-events-none iw-z-10 ",style:{background:"radial-gradient(ellipse 20% 40% at 50% 45%, transparent 99.5%, rgba(0,0,0,0.35) 100%)"}}),o.jsx("div",{className:"iw-absolute iw-bottom-2 iw-inset-x-0 iw-flex iw-justify-center iw-pointer-events-none iw-z-20",children:o.jsx(ch,{status:u?h||!Xe?"model_loading":L()??"no_face_detected":"camera_error"})})]})]})}),v&&li&&!c&&o.jsx(ah,{isOpen:li,onClose:a1,warningType:L(),isCheatingModalOpen:l})]})}),tn=({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",h={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"},u={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} ${h[t]} ${u[r]} ${w} ${f} ${a}`,disabled:s||n,...c,children:[n&&o.jsx(io,{height:16,width:16,style:{marginRight:"3px"}}),e]})},lh=({stream:e,className:t="",barCount:r=50})=>{const i=d.useRef(null),n=d.useRef(null),s=d.useRef(null),a=d.useRef(null),c=d.useRef(null);d.useEffect(()=>{if(!e||window===void 0)return;a.current||(a.current=new(window.AudioContext||window.webkitAudioContext));const h=a.current;s.current||(s.current=h.createAnalyser(),s.current.fftSize=256,s.current.smoothingTimeConstant=.5);const u=s.current;try{c.current&&c.current.disconnect(),c.current=h.createMediaStreamSource(e),c.current.connect(u)}catch(w){console.error("Error creating media stream source:",w);return}const f=()=>{if(!i.current)return;const w=i.current,g=w.getContext("2d");if(!g)return;const p=u.frequencyBinCount,y=new Uint8Array(p);u.getByteFrequencyData(y);const m=w.width,b=w.height;g.clearRect(0,0,m,b);let v=0;for(let M=0;M<p;M++){const F=y[M]??0;v+=F*F}const I=Math.sqrt(v/p),C=Math.min(1,I/128);g.clearRect(0,0,m,b);const S=r,A=Math.floor(C*S);for(let M=0;M<S;M++){const F=M*(m/S),D=m/S-1.8;M<A?g.fillStyle="#0EB00E":g.fillStyle="#D9D9D9",g.fillRect(F,0,D,b)}n.current=requestAnimationFrame(f)};return f(),()=>{n.current&&cancelAnimationFrame(n.current)}},[e,r]);const l=d.useRef({audioContext:a.current,source:c.current});return l.current={audioContext:a.current,source:c.current},d.useEffect(()=>()=>{l.current.source&&l.current.source.disconnect(),l.current.audioContext&&l.current.audioContext.state!=="closed"&&l.current.audioContext.close()},[]),o.jsx("canvas",{ref:i,className:t,width:300,height:20,style:{width:"100%",height:"16px"}})},gl=({icon:e,devices:t,selectedId:r,onChange:i,label:n,showVisualizer:s=!1,stream:a=null,hasPermission:c=!0})=>{const{baseColor:l}=Zt(),[h,u]=d.useState(!1),f=d.useRef(null);d.useEffect(()=>{const p=y=>{f.current&&!f.current.contains(y.target)&&u(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const w=t.find(p=>p.deviceId===r)||t[0],g=c&&(w==null?void 0:w.label)||n;return o.jsxs("div",{className:"iw-relative iw-flex-1 iw-w-1/2 iw-group",ref:f,children:[o.jsxs("div",{className:`iw-max-w-[300px] iw-flex iw-items-center iw-justify-between iw-bg-white iw-border iw-border-gray-200 iw-rounded-xl iw-px-3 iw-py-3 iw-transition-colors ${c?"iw-cursor-pointer hover:iw-border-blue-500":"iw-cursor-not-allowed"}`,onClick:()=>c&&u(!h),title:c?"":"Permission denied or device not found",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-3 iw-min-w-0 iw-max-w-[210px]",children:[o.jsx(e,{className:"iw-w-5 iw-h-5 iw-text-[#062260] iw-flex-shrink-0"}),o.jsx("span",{className:"iw-text-sm iw-text-[#062260] iw-font-medium iw-truncate",children:g})]}),o.jsx("div",{className:"iw-flex iw-items-center iw-gap-2",children:c?o.jsxs(o.Fragment,{children:[o.jsx(Xl,{className:`iw-w-4 iw-h-4 iw-text-gray-400 iw-transition-transform ${h?"iw-rotate-180":""}`}),r&&o.jsx("div",{className:"iw-bg-[#22C55E] iw-rounded-full iw-p-0.5",children:o.jsx(gi,{className:"iw-w-3 iw-h-3 iw-text-white"})})]}):o.jsx("div",{className:"iw-text-[#E94315] iw-relative",children:o.jsx(wi,{className:"iw-size-5"})})})]}),!c&&o.jsx("div",{className:"iw-hidden group-hover:iw-block iw-absolute iw-bottom-full iw-mb-3 iw-left-1/6 -iw-translate-x-1/2 iw-w-64 iw-z-50",children:o.jsxs("div",{className:"iw-rounded-lg iw-p-3 iw-shadow-lg iw-text-white iw-text-left iw-relative",style:{background:l},children:[o.jsx("div",{className:"iw-flex iw-justify-between iw-items-start iw-mb-1",children:o.jsxs("h4",{className:"iw-text-sm iw-font-bold iw-mr-2",children:["Allow us to access your ",(n==null?void 0:n.split(" ")[1])??"device"]})}),o.jsx("p",{className:"iw-text-xs iw-opacity-90 iw-leading-tight",children:"We need permission to access your device. Go to your browser privacy settings to allow it"}),o.jsx("div",{className:"iw-absolute iw-top-full iw-left-1/2 -iw-translate-x-1/2 -iw-mt-1 iw-border-4 iw-border-transparent iw-border-t-[#5865F2]"})]})}),s&&c&&o.jsxs("div",{className:"iw-mt-2 iw-px-1 iw-flex iw-items-center iw-gap-2 iw-overflow-hidden",children:[o.jsx(td,{className:"iw-min-h-5 iw-min-w-5"}),o.jsx(lh,{stream:a,className:"iw-w-full"})]}),h&&c&&o.jsxs("div",{className:"iw-absolute iw-bottom-full iw-left-0 iw-right-0 iw-mb-2 iw-bg-white iw-border iw-border-gray-100 iw-rounded-xl iw-shadow-xl iw-z-50 iw-py-2 iw-max-h-60 iw-overflow-y-auto",children:[t.map(p=>o.jsxs("div",{className:`iw-px-4 iw-py-2.5 iw-text-sm iw-cursor-pointer iw-flex iw-items-center iw-justify-start hover:iw-bg-gray-50 ${r===p.deviceId?"iw-text-[#062260] iw-font-medium iw-bg-blue-50":"iw-text-gray-600"}`,onClick:()=>{i==null||i(p.deviceId),u(!1)},children:[r===p.deviceId&&o.jsx(gi,{className:"iw-w-4 iw-h-4 iw-text-[#062260] iw-mr-1"}),o.jsx("span",{className:"iw-truncate",children:p.label||`Device ${p.deviceId.slice(0,5)}...`})]},p.deviceId)),t.length===0&&o.jsx("div",{className:"iw-px-4 iw-py-2 iw-text-sm iw-text-gray-400",children:"No devices found"})]})]})},pl=({micEnabled:e=!1,videoEnabled:t=!1,buttonText:r,onButtonClick:i,isAgreed:n,onAgreedToggle:s,showCheckbox:a=!0,showMediaIcons:c=!0,disabled:l=!1,audioDevices:h=[],videoDevices:u=[],selectedAudioId:f,selectedVideoId:w,onAudioChange:g,onVideoChange:p,audioStream:y=null,isDeviceLoading:m=!1})=>{const b=l||!n||c&&(!e||!t)||m;return o.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-4 iw-w-full",children:[a&&o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3 iw-bg-[#F1F5FE] iw-rounded-xl iw-p-3 iw-border iw-border-[#c2c3c7]",children:[o.jsx("div",{className:`iw-mt-0.5 iw-h-5 iw-w-5 iw-min-w-[20px] iw-rounded iw-border iw-flex iw-items-center iw-justify-center iw-cursor-pointer iw-transition-colors ${n?"iw-bg-[#062260] iw-border-[#062260]":"iw-bg-white iw-border-[#062260]"}`,onClick:v=>{v.stopPropagation(),s(!n)},children:n&&o.jsx(gi,{className:"iw-size-3 iw-text-white"})}),o.jsx("label",{onClick:()=>s(!n),className:"iw-text-sm iw-text-[#062260] iw-font-medium iw-cursor-pointer iw-select-none",children:"By continuing, you acknowledge and consent to the use of your face data exclusively for interview monitoring"})]}),o.jsx("div",{className:"iw-flex iw-justify-center iw-items-center iw-gap-4 iw-flex-wrap iw-max-w-[700px] iw-mx-auto",children:c&&o.jsxs("div",{className:"iw-flex iw-gap-4 iw-w-full",children:[o.jsx(gl,{icon:Zl,devices:h,selectedId:f??"",onChange:v=>g&&g(v),label:"Choose mic",showVisualizer:!0,stream:y,hasPermission:e}),o.jsx(gl,{icon:ed,devices:u,selectedId:w??"",onChange:v=>p&&p(v),label:"Choose camera",hasPermission:t})]})}),o.jsxs("div",{className:"iw-relative iw-group iw-w-full iw-max-w-[280px] iw-mx-auto",children:[o.jsx(tn,{onClick:i,disabled:b,className:`iw-h-12 iw-w-full !iw-bg-[#F1F5FE] !iw-text-[#062260] !iw-font-bold !iw-border-[#E7EAF1] iw-rounded-lg ${b?"iw-opacity-50":"hover:iw-opacity-75"}`,children:m?"Device Loading...":r}),!n&&(!c||e&&t)&&dh()]})]})},dh=()=>{const{baseColor:e}=Zt();return o.jsx(o.Fragment,{children:o.jsx("div",{className:"iw-hidden group-hover:iw-block iw-absolute iw-bottom-full iw-mb-3 iw-left-1/2 -iw-translate-x-1/2 iw-w-64 iw-z-50",children:o.jsxs("div",{className:"iw-rounded-lg iw-p-3 iw-shadow-lg iw-text-white iw-text-left iw-relative",style:{background:e},children:[o.jsx("div",{className:"iw-flex iw-justify-between iw-items-start iw-mb-1",children:o.jsx("h4",{className:"iw-text-sm iw-font-bold iw-mr-2",children:"Action Required"})}),o.jsx("p",{className:"iw-text-xs iw-opacity-90 iw-leading-tight",children:"Please check the box to acknowledge and consent to continue."}),o.jsx("div",{className:"iw-absolute iw-top-full iw-left-1/2 -iw-translate-x-1/2 -iw-mt-1 iw-border-4 iw-border-transparent iw-border-t-[#5865F2]"})]})})})},uh=({steps:e,currentStepIndex:t})=>o.jsx("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-4 iw-w-full iw-py-3",children:e.map((r,i)=>{const n=i<t,s=i===t;return o.jsxs(d.Fragment,{children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-3",children:[o.jsx("div",{className:`iw-flex iw-size-9 iw-text-[#062260] iw-items-center iw-justify-center iw-rounded-full iw-font-semibold iw-border ${s||n?"iw-border-[#0EB00E] iw-bg-[#E9FFE6]":"iw-border-[#BDE0FD] iw-bg-[#E6F3FF]"}`,children:n?o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})}):i+1}),o.jsx("span",{className:`iw-text-sm iw-font-medium ${s||n?"iw-text-[#062260]":"iw-text-[#5C6686]"}`,children:r.label})]}),i<e.length-1&&o.jsx("div",{className:"iw-flex-1 iw-max-w-[120px] iw-border-t iw-border-dotted iw-border-[#B3B9CB]"})]},i)})}),hh=["Don't refresh or reload the page during your assessment","Don't switch tabs or open other applications while session is ongoing","Don't leave your position during the session","Don't disable or interfere with video/audio monitoring"],fh=({isOpen:e,onStart:t,gazeEnabled:r=!1,videoFeedRef:i,interviewId:n="",interview_duration:s=hi})=>{const{audioAllowed:a,videoAllowed:c,videoRef:l,audioDevices:h,videoDevices:u,selectedAudioDeviceId:f,selectedVideoDeviceId:w,isDeviceLoading:g,currentStream:p,handleAudioChange:y,handleVideoChange:m,stopStream:b}=ql(e),[v,I]=d.useState(!1),[C,S]=d.useState(0),[A,M]=d.useState(!1),F=d.useRef(null),D=d.useRef(null),G=O=>{F.current=O,i&&(typeof i=="function"?i(O):i.current=O)};if(d.useEffect(()=>()=>{D.current&&(clearInterval(D.current),D.current=null)},[]),!e)return null;const[Y,H]=d.useState(Ce.MODEL_LOADING),q=async()=>{var R;I(!0),(R=F.current)==null||R.resetReference();const O=()=>{var Ye;return(Ye=F.current)==null?void 0:Ye.setReference()};O(),D.current&&clearInterval(D.current),D.current=setInterval(O,500)},Z=[{label:r?"Calibrate your camera":"Camera & Mic permission"},{label:"Basic guidelines"}];return o.jsx("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-gray-900/40 iw-backdrop-blur-sm iw-p-4 iw-pt-5 iw-overflow-auto",children:o.jsxs("div",{className:"iw-w-full iw-max-w-[700px] iw-max-h-[900px] iw-my-4 iw-bg-white iw-rounded-xl iw-shadow-2xl iw-overflow-auto",children:[o.jsxs("div",{className:"iw-px-5 iw-pt-3",children:[o.jsx("h2",{className:"iw-text-[#062260] iw-text-2xl iw-font-medium iw-tracking-tight",children:"Final checks before you go live"}),o.jsx("div",{className:"iw-mt-2 iw-bg-[#F1F5FE] iw-rounded-xl iw-p-2 iw-border iw-border-[#E7EAF1]",children:o.jsx("p",{className:"iw-text-[#5C6686] iw-text-xs iw-leading-relaxed",children:"To ensure the integrity of the interview process, this platform uses your device’s camera to monitor your face and gaze direction. We do not store any outside this session"})}),o.jsx("div",{className:"iw-mt-3 iw-border-b iw-border-dashed iw-border-[#B3B9CB] iw-w-full"}),o.jsx(uh,{steps:Z,currentStepIndex:C})]}),o.jsx("div",{className:"iw-px-5 iw-pb-5 iw-flex iw-flex-col iw-items-center",children:C===0?o.jsxs("div",{className:"iw-w-full iw-flex iw-flex-col iw-items-center iw-gap-4",children:[o.jsx("div",{className:"iw-w-full iw-max-w-[600px] iw-aspect-video iw-bg-slate-100 iw-rounded-2xl iw-overflow-hidden iw-relative iw-border iw-border-slate-200",children:r?o.jsx(wl,{ref:G,interviewId:n,interview_duration:s,showProctoringUI:!1,showStatusOverlay:!g&&c,isDeviceLoading:g,videoAllowed:c,onProctoringStatusChange:H,onSetReference:()=>{D.current&&(clearInterval(D.current),D.current=null),I(!1),S(1)}}):o.jsx("video",{ref:l,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-full iw-object-cover",style:{transform:"scaleX(-1)"}})}),o.jsx(pl,{micEnabled:a,videoEnabled:c,buttonText:r?v?"Calibrating...":Y==="model_loading"?"Initialising...":"Start calibrate":"Next",onButtonClick:()=>{r?q():S(1)},disabled:!A||r&&Y!=="face_detected"||!r&&(!a||!c),isAgreed:A,onAgreedToggle:M,audioDevices:h,videoDevices:u,selectedAudioId:f,selectedVideoId:w,onAudioChange:y,onVideoChange:m,audioStream:p,isDeviceLoading:g})]}):o.jsxs("div",{className:"iw-w-full iw-flex iw-flex-col iw-gap-6",children:[o.jsx("div",{className:"iw-w-full iw-bg-[#F8FAFF] iw-rounded-2xl iw-p-8 iw-flex iw-flex-col iw-gap-5",children:hh.map((O,R)=>o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-7 iw-w-7 iw-min-w-[28px] iw-items-center iw-justify-center iw-rounded-full iw-bg-[#DBEAFE] iw-text-[#062260] iw-text-xs iw-font-bold",children:R+1}),o.jsx("span",{className:"iw-text-[#5C6686] iw-font-medium",children:O})]},R))}),o.jsx(pl,{buttonText:"Start interview",onButtonClick:()=>{t(),b()},isAgreed:A,onAgreedToggle:M,showMediaIcons:!1})]})})]})})};var P=(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))(P||{});const ml={thinkingDuration:0,answeringDuration:120,editingDuration:30},yl={idle:{next:"fetching_question"},fetching_question:{next:"reading_question"},reading_question:{next:"answering"},thinking:{next:"answering",duration:0},answering:{next:"transcribing",duration:120},transcribing:{next:"editing"},editing:{next:"submitting",duration:30},submitting:{next:"completed"},completed:{next:"completed"}};class wh{constructor(t={},r={}){ye(this,"config");ye(this,"state");ye(this,"phaseIntervalId",null);ye(this,"globalIntervalId",null);ye(this,"callbacks");this.config={...ml,...t},this.callbacks=r,this.state={phase:"idle",currentPhaseTimeRemaining:0,totalTimeElapsed:0,currentQuestionNumber:0}}updateConfig(t){this.config={...this.config,...t}}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;let r=yl[t];if(!r)return;if(r.next==="editing"&&this.config.editingDuration===0){const n=yl.editing;n&&(r=n)}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()}setTotalTimeElapsed(t){var r,i;this.state.totalTimeElapsed=t,(i=(r=this.callbacks).onTick)==null||i.call(r,this.getState())}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 gh(e={}){const{config:t={},callbacks:r={}}=e,i=d.useRef(null);i.current||(i.current=new wh(t,{}));const n=i.current,[s,a]=d.useState(n.getState()),c=d.useCallback(()=>{a(n.getState())},[n]);d.useEffect(()=>{const f={onPhaseChange:(w,g)=>{var p;c(),(p=r.onPhaseChange)==null||p.call(r,w,g)},onTick:w=>{var g;c(),(g=r.onTick)==null||g.call(r,w)},onInterviewEnd:()=>{var w;c(),(w=r.onInterviewEnd)==null||w.call(r)}};n.callbacks=f},[n,r,c]),d.useEffect(()=>{n.updateConfig(t)},[n,t]),d.useEffect(()=>()=>{n.destroy()},[n]);const l=d.useCallback(()=>{n.startQuestion(),c()},[n,c]),h=d.useCallback(()=>{n.nextPhase(),c()},[n,c]),u=d.useCallback(()=>{n.completeInterview(),c()},[n,c]);return{state:s,startQuestion:l,nextPhase:h,completeInterview:u,timerService:n}}function ph(e,t={}){const[r,i]=d.useState({data:null,loading:!1,error:null}),n=d.useCallback(async(...s)=>{var a,c,l,h;i(u=>({...u,loading:!0,error:null}));try{const u=await e(...s);i(f=>({...f,data:u,loading:!1,error:null})),(a=t.onSuccess)==null||a.call(t,u),(c=t.onSettled)==null||c.call(t,u,null)}catch(u){const f=u.type?u:{type:"unknown",message:u.message||"Unknown error",retryable:!0,userMessage:"Something went wrong. Please try again.",originalError:u};i(w=>({...w,loading:!1,error:f})),(l=t.onError)==null||l.call(t,f),(h=t.onSettled)==null||h.call(t,null,f)}},[e,t]);return{...r,execute:n}}const mh=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 g=>{var p;try{if(!a())throw new Error("Fullscreen is not supported in this environment");g.requestFullscreen?await g.requestFullscreen():g.webkitRequestFullscreen?await g.webkitRequestFullscreen():g.mozRequestFullScreen?await g.mozRequestFullScreen():g.msRequestFullscreen&&await g.msRequestFullscreen()}catch(y){const m={name:"FullscreenError",message:y instanceof Error?y.message:"Failed to enter fullscreen"};r(m),(p=e==null?void 0:e.onError)==null||p.call(e,m)}},h=async()=>{var g;try{s.exitFullscreen?await s.exitFullscreen():s.webkitExitFullscreen?await s.webkitExitFullscreen():s.mozCancelFullScreen?await s.mozCancelFullScreen():s.msExitFullscreen&&await s.msExitFullscreen()}catch(p){const y={name:"FullscreenError",message:p instanceof Error?p.message:"Failed to exit fullscreen"};r(y),(g=e==null?void 0:e.onError)==null||g.call(e,y)}},u=d.useCallback(()=>{var p;const g=!!c();n(g),(p=e==null?void 0:e.onFullScreenChange)==null||p.call(e,g)},[e]);d.useEffect(()=>{const g=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];return g.forEach(p=>{document.addEventListener(p,u)}),()=>{g.forEach(p=>{document.removeEventListener(p,u)})}},[u]);const f=async g=>{r(null);const p=g??document.documentElement;await l(p)};return{isFullScreen:i,toggleFullScreen:async g=>{i?await h():await f(g)},enterFullScreen:f,exitFullScreen:h,error:t}};function bl(){const e=fi();return d.useMemo(()=>{const r=e.api||{};return new oo(r)},[e.api])}const yh=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])},bh=(e={})=>{const[t,r]=d.useState(!1),[i,n]=d.useState(!1),[s,a]=d.useState(null),[c,l]=d.useState(null),[h,u]=d.useState(null),f=d.useRef(e);f.current=e;const w=d.useRef(null);w.current||(w.current=new fl(e.config)),d.useEffect(()=>{var b;e.config&&((b=w.current)==null||b.updateConfig(e.config))},[e.config]),d.useEffect(()=>{const b=w.current;return()=>{b==null||b.dispose(),w.current=null}},[]);const g=d.useCallback(async b=>{var I,C;const v=w.current;if(!v||v.isDisposed())throw new W("STT service is not available","SERVICE_UNAVAILABLE",!1);try{l(null),a(null),u(null),await v.startRecording(b,{onStart:()=>{var S,A;r(!0),(A=(S=f.current).onStart)==null||A.call(S)},onStop:()=>{var S,A;r(!1),(A=(S=f.current).onStop)==null||A.call(S)},onError:S=>{var M,F;const A=S instanceof W?S:new W(S.message,"RECORDING_ERROR",!0);l(A),r(!1),(F=(M=f.current).onError)==null||F.call(M,A)}})}catch(S){const A=S instanceof W?S:new W(S instanceof Error?S.message:String(S),"START_FAILED",!1);throw l(A),r(!1),(C=(I=f.current).onError)==null||C.call(I,A),A}},[]),p=d.useCallback(async()=>{var v,I;const b=w.current;if(!b||b.isDisposed())throw new W("STT service is not available","SERVICE_UNAVAILABLE",!1);try{const C=await b.stopRecording();return u(C),C}catch(C){const S=C instanceof W?C:new W(C instanceof Error?C.message:String(C),"STOP_FAILED",!1);throw l(S),r(!1),(I=(v=f.current).onError)==null||I.call(v,S),S}},[]),y=d.useCallback(async(b,v={})=>{var C,S,A,M,F,D;const I=w.current;if(!I||I.isDisposed())throw new W("STT service is not available","SERVICE_UNAVAILABLE",!1);try{if(l(null),n(!0),!b||b.size===0){console.warn("Skipping transcription — blob is empty");const H={transcript:""};return a(H.transcript),n(!1),(S=(C=f.current).onTranscriptionComplete)==null||S.call(C,H),H}const G={audioBlob:b,...v},Y=await I.transcribe(G);return a(Y.transcript),n(!1),(M=(A=f.current).onTranscriptionComplete)==null||M.call(A,Y),Y}catch(G){const Y=G instanceof W?G:new W(G instanceof Error?G.message:String(G),"TRANSCRIPTION_FAILED",!0);throw l(Y),n(!1),(D=(F=f.current).onError)==null||D.call(F,Y),Y}},[]),m=d.useCallback(()=>{var b;(b=w.current)==null||b.cancelRecording(),r(!1),u(null)},[]);return{startRecording:g,stopRecording:p,transcribe:y,cancelRecording:m,isRecording:t,isTranscribing:i,transcript:s,error:c,audioBlob:h}},vh=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])},xh=()=>{d.useEffect(()=>{const e=document.createElement("style");return e.textContent=`
|
|
16
16
|
* {
|
|
17
17
|
-webkit-user-select: none !important;
|
|
18
18
|
-moz-user-select: none !important;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
-ms-user-select: text !important;
|
|
26
26
|
user-select: text !important;
|
|
27
27
|
}
|
|
28
|
-
`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[])};class
|
|
28
|
+
`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[])};class Eh{constructor(){ye(this,"currentAudio",null)}async play(t,r){var i,n;try{if(this.stop(),(i=r==null?void 0:r.onStart)==null||i.call(r),!t)throw new Error("No audio data provided");const s=window.atob(t),a=new Uint8Array(s==null?void 0:s.length);for(let h=0;h<(s==null?void 0:s.length);h++)a[h]=s==null?void 0:s.charCodeAt(h);const c=new Blob([a],{type:"audio/wav"}),l=URL.createObjectURL(c);return this.currentAudio=new Audio(l),new Promise((h,u)=>{if(!this.currentAudio){u(new Error("Audio element not created"));return}const f=this.currentAudio;f.onended=()=>{var w;URL.revokeObjectURL(l),this.currentAudio=null,(w=r==null?void 0:r.onEnd)==null||w.call(r),h()},f.onerror=w=>{var p;URL.revokeObjectURL(l),this.currentAudio=null;const g=new Error(`Audio playback failed: ${w}`);(p=r==null?void 0:r.onError)==null||p.call(r,g),u(g)},f.play().catch(w=>{var p;URL.revokeObjectURL(l),this.currentAudio=null;const g=new Error(`Failed to play audio: ${w.message}`);(p=r==null?void 0:r.onError)==null||p.call(r,g),u(g)})})}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 vl=new Eh,_h=(e={})=>{const[t,r]=d.useState(!1),[i,n]=d.useState(!1),[s,a]=d.useState(null),c=d.useCallback(async h=>{var u;try{a(null),n(!0),await vl.play(h,{onStart:()=>{var f;n(!1),r(!0),(f=e.onStart)==null||f.call(e)},onEnd:()=>{var f;r(!1),(f=e.onEnd)==null||f.call(e)},onError:f=>{var w;r(!1),n(!1),a(f),(w=e.onError)==null||w.call(e,f)}})}catch(f){const w=f instanceof Error?f:new Error(String(f));throw a(w),r(!1),n(!1),(u=e.onError)==null||u.call(e,w),w}},[e]),l=d.useCallback(()=>{vl.stop(),r(!1),n(!1)},[]);return{speak:c,stop:l,isPlaying:t,isLoading:i,error:s}},kh=({onViolation:e,onEnd:t,maxViolations:r=5})=>{const{addViolation:i}=Bl(),n=Pl(),s=Ol(),a=d.useRef(s);d.useEffect(()=>{a.current=s},[s]);const c=d.useCallback(h=>{t&&t(h,a.current)},[t]);return{logViolation:d.useCallback(({type:h,severity:u,details:f})=>{const w={id:$l(),type:h,severity:u,details:f,timestamp:Date.now()};i(w);const g=a.current+1;e&&e(w,g),g>=r&&c("excessive_violations")},[i,e,r,c]),onInterviewEnd:c,violationCount:s,logList:n}},Sh=()=>{d.useEffect(()=>{function e(){console.clear(),console.log(`
|
|
29
29
|
%c
|
|
30
30
|
╔═══════════════════════════════════════════════════════════════════════╗
|
|
31
31
|
║ ║
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
│ │
|
|
72
72
|
│ 💡 IMMEDIATE ACTION REQUIRED: │
|
|
73
73
|
│ Close developer tools to continue interview │
|
|
74
|
-
└─────────────────────────────────────────────────────────────┘`,"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}},[])},Us=e=>{const{baseColor:t,borderRadius:r}=Rt(),{loading:i,children:n,...s}=e;return o.jsx(Zi,{style:{background:jl(t),borderRadius:r},...s,children:i?o.jsx(Zs,{}):n})},k1=(e,t,r)=>Math.max(t,Math.min(r,e)),fl=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}`},Ri=({total:e,remaining:t,size:r=64,strokeWidth:i=6,className:n="",showLabel:s=!0})=>{const a=Math.max(1,e||1),c=k1(t/a,0,1),{radius:l,circumference:h,dashOffset:u,center:f}=d.useMemo(()=>{const p=(r-i)/2,b=2*Math.PI*p,m=b*(1-c),y=Math.round(i)%2===1,v=r/2+(y?.5:0);return{radius:p,circumference:b,dashOffset:m,center:v}},[r,i,c]),w=d.useMemo(()=>c<=.25?"iw-stroke-red-500":c<=.5?"iw-stroke-yellow-500":"iw-stroke-green-500",[c]),g=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 ${fl(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} ${g}`,strokeWidth:i,strokeLinecap:"round",fill:"none",strokeDasharray:h,strokeDashoffset:u,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:fl(t)})}):o.jsx("div",{className:"iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center iw-rotate-0",children:o.jsx(Ql,{})})]})},A1=({timerState:e,answeringTime:t})=>{const r=(e==null?void 0:e.currentPhaseTimeRemaining)||0,i=t||ll.answeringDuration;return o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-3",children:[o.jsx(Ri,{total:i,remaining:r,size:50,strokeWidth:4,showLabel:!1,className:"iw-shadow-sm iw-border iw-border-gray-100"}),o.jsxs("div",{className:"iw-flex iw-flex-col",children:[o.jsx("span",{className:"iw-text-[#5C6686]",children:"Time left to answer"}),o.jsxs("span",{className:"iw-text-xl iw-font-bold iw-text-[#062260]",children:[hn(r,!0),r>=60?" min":" sec"]})]})]})},C1=({question:e,isLoading:t=!1,phase:r,brandName:i,brandLogo:n,timerState:s,answeringTime:a})=>o.jsx("div",{className:"iw-rounded-xl iw-mb-4 message-animation iw-text-gray-800 iw-py-1",children:o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-4",children:[o.jsx("div",{className:`iw-flex iw-flex-col iw-items-center iw-justify-center iw-relative iw-h-16 iw-w-16 iw-shrink-0 iw-shadow iw-rounded-full iw-border-[#E8EEFE] iw-border-4 ${r===B.READING_QUESTION?"iw-animate-speaking":""}`,children:o.jsx("div",{className:"iw-bg-transparent iw-flex iw-items-center iw-justify-center iw-rounded-full iw-size-full",style:{backgroundImage:"linear-gradient(#B5D0FD, #FFFFFF)"},children:o.jsx(fn,{brandLogo:n,brandName:i})})}),o.jsx(S1,{phase:r,question:e,isLoading:t,brandName:i,timerState:s,answeringTime:a})]})}),S1=({phase:e,question:t,isLoading:r,brandName:i,timerState:n,answeringTime:s})=>{const a=i||"We",c=i?"is":"are";if(r||e===B.FETCHING_QUESTION||e===B.IDLE)return 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"})]});const l=()=>o.jsxs("span",{className:"iw-animate-dot-wave iw-ml-1",children:[o.jsx("span",{children:"."}),o.jsx("span",{children:"."}),o.jsx("span",{children:"."})]});switch(e){case B.ANSWERING:return o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-w-full",children:[o.jsxs("p",{className:"iw-text-lg iw-leading-7 iw-font-medium iw-text-gray-600",children:["Listening",o.jsx(l,{})]}),o.jsx(A1,{timerState:n,answeringTime:s})]});case B.TRANSCRIBING:return o.jsxs("p",{className:"iw-text-lg iw-leading-7 iw-font-medium iw-text-gray-600",children:[a," ",c," analyzing your answer",o.jsx(l,{})]});case(B.EDITING||B.SUBMITTING):return o.jsxs("p",{className:"iw-text-lg iw-leading-7 iw-font-medium iw-text-gray-600",children:[a," ",c," waiting for your answer..."]});default:return o.jsx("p",{className:"iw-text-lg iw-leading-7",children:t==null?void 0:t.question})}},N1=({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":"",h=r?"iw-w-full":"",u=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} ${h} ${u} ${i}`,"aria-invalid":t?"true":"false",...s}),t&&o.jsx("p",{className:"iw-mt-1 iw-text-sm iw-text-red-600",children:t})]})},T1=({answerText:e,onAnswerChange:t,timerState:r,editingTime:i})=>o.jsxs("div",{className:"iw-w-full iw-bg-white iw-rounded-xl iw-border iw-border-[#84bbf5] iw-overflow-hidden iw-rounded-tr-none",children:[o.jsx("div",{className:"iw-p-2 iw-pb-0",children:o.jsx(N1,{value:e,onChange:t,placeholder:"Type your answer here...",className:"iw-w-full iw-h-64 iw-resize-none iw-bg-transparent iw-border-none iw-text-[#062260] iw-text-base iw-leading-relaxed focus-visible:iw-outline-0 iw-p-0",disabled:r.phase===B.SUBMITTING})}),o.jsxs("div",{className:"iw-bg-[#F1F5FE] iw-px-2 iw-py-2 iw-flex iw-items-center iw-justify-between iw-border-t iw-border-[#E8EEFE]",children:[o.jsx("span",{className:"iw-text-[#062260] iw-text-sm iw-font-medium iw-line-clamp-1",children:"Time left to edit answer"}),o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[o.jsx(Ri,{total:i,remaining:r.currentPhaseTimeRemaining,size:32,strokeWidth:3,showLabel:!1}),o.jsx("span",{className:"iw-text-[#062260] iw-text-sm iw-font-bold",children:`${hn(r.currentPhaseTimeRemaining,!0)}${r.currentPhaseTimeRemaining>=60?" min":" sec"}`})]})]})]}),wl=({children:e})=>o.jsx("div",{className:"iw-flex iw-flex-col iw-items-start iw-mt-3 iw-gap-1",children:e}),I1=({children:e})=>o.jsx("div",{className:"iw-flex iw-flex-col iw-items-end iw-mt-3 iw-gap-1",children:e}),F1=({questionNumber:e})=>o.jsxs("div",{className:"iw-px-4 iw-py-1.5 iw-rounded-full iw-mb-2 iw-text-sm iw-font-semibold",style:{color:"#062260",backgroundColor:"#E6F3FF",border:"1px solid #BDE0FD"},children:[" Q",e]}),gl=({label:e})=>o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2 iw-text-sm iw-text-gray-500 iw-bg-[#F1F5FE] iw-px-4 iw-py-1.5 iw-rounded-full iw-my-2 iw-font-semibold",children:[e&&o.jsx("span",{className:"iw-font-medium",children:e}),o.jsxs("span",{className:"iw-animate-dot-wave iw-text-2xl",children:[o.jsx("span",{children:"."}),o.jsx("span",{children:"."}),o.jsx("span",{children:"."})]})]}),L1=({phase:e,questionNumber:t})=>{switch(e){case B.FETCHING_QUESTION:return o.jsxs(wl,{children:[o.jsx(F1,{questionNumber:t+1}),o.jsx(gl,{})]});case B.ANSWERING:return o.jsx(I1,{children:o.jsx(gl,{label:"You"})});case B.TRANSCRIBING:return o.jsx(wl,{children:o.jsxs("div",{className:"iw-flex iw-items-center iw-px-1 iw-py-1.5 iw-rounded-lg iw-mb-2 iw-text-sm iw-bg-[#F2E8FE]",children:[o.jsx("div",{className:"iw-h-8 iw-w-12 iw-transcribing-icon"}),o.jsx("span",{className:"iw-text-sm iw-text-[#062260]",children:"Analyzing answer…"})]})});default:return null}},M1=({item:e,index:t,isCurrentQuestion:r=!1,isEditable:i=!1,answerText:n="",onAnswerChange:s,timerState:a,editingTime:c})=>{const l=i&&a&&c!==void 0,h=l||e.answer;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-start",children:[o.jsxs("div",{className:"iw-px-4 iw-py-1.5 iw-rounded-full iw-mb-2 iw-text-sm iw-font-semibold",style:{color:"#062260",backgroundColor:"#E6F3FF",border:"1px solid #BDE0FD"},children:["Q",t+1]}),o.jsx("div",{className:"iw-w-full iw-p-4 iw-rounded-xl iw-text-[#062260] iw-text-base iw-leading-relaxed iw-rounded-tl-none",style:{backgroundColor:"#F1F5FE",border:r?"2px solid #84bbf5":"1px solid transparent"},children:e.question})]}),h&&o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-end iw-mt-4",children:[o.jsx("div",{className:"iw-px-4 iw-py-1.5 iw-rounded-full iw-mb-2 iw-text-sm iw-font-semibold",style:{color:"#062260",backgroundColor:"#F2E8FE",border:"1px solid #E9D5FF"},children:"You"}),l?o.jsx(T1,{answerText:n||"",onAnswerChange:s,timerState:a,editingTime:c}):o.jsx("div",{className:"iw-w-full iw-p-4 iw-rounded-xl iw-text-[#062260] iw-text-base iw-leading-relaxed iw-rounded-tr-none",style:{backgroundColor:"#F7F1FE"},children:e.answer})]}),r&&o.jsx(L1,{phase:a==null?void 0:a.phase,questionNumber:t+1})]})},D1=()=>o.jsx("div",{className:"iw-space-y-6 iw-animate-pulse",children:[1,2,3].map(e=>o.jsxs("div",{className:`iw-flex iw-flex-col ${e%2===0?"iw-items-end":"iw-items-start"} iw-gap-2`,children:[o.jsx("div",{className:"iw-h-8 iw-w-16 iw-bg-gray-200 iw-rounded-full"}),o.jsx("div",{className:"iw-h-24 iw-w-full iw-bg-gray-100 iw-rounded-xl"})]},e))}),P1=({transcript:e,isLoading:t,className:r="",bottomRef:i,isEditing:n,answerText:s,onAnswerChange:a,timerState:c,editingTime:l})=>o.jsxs("div",{className:`iw-h-full iw-flex iw-flex-col iw-bg-white iw-scroll-smooth iw-p-6 iw-pr-2 iw-min-w-32 iw-border iw-rounded-tr-2xl iw-rounded-br-2xl iw-border-[#E8EEFE] ${r}`,children:[o.jsxs("div",{className:"iw-mb-6",children:[o.jsx("h2",{className:"iw-text-lg iw-font-semibold iw-mb-4",style:{color:"#062260"},children:"Interview transcript"}),o.jsx("div",{className:"iw-h-px iw-w-full iw-border-t iw-border-dashed iw-border-gray-300"})]}),o.jsxs("div",{className:"iw-flex-1 iw-overflow-y-auto iw-pr-2 iw-space-y-6 iw-scrollbar-thin iw-max-w-xl iw-pb-5",children:[t?o.jsx(D1,{}):e==null?void 0:e.map((h,u)=>o.jsx(M1,{item:h,index:u,isCurrentQuestion:u===(e==null?void 0:e.length)-1,isEditable:!!(u===(e==null?void 0:e.length)-1&&n),answerText:s,onAnswerChange:a||(()=>{}),timerState:c,editingTime:l},h.qna_id)),o.jsx("div",{ref:i})]})]}),O1=({interviewId:e,className:t="",currentQuestion:r,lastSubmittedAnswer:i,isEditing:n,answerText:s,onAnswerChange:a,timerState:c,editingTime:l})=>{const h=ul(),[u,f]=d.useState([]),[w,g]=d.useState(!0),p=d.useRef(null);return d.useEffect(()=>{var b;(b=p.current)==null||b.scrollIntoView({behavior:"smooth"})},[u,s,c==null?void 0:c.phase]),d.useEffect(()=>{(async()=>{var m;try{const y=await h.getInterviewTranscription(e);f(((m=y==null?void 0:y.data)==null?void 0:m.transcript)||[])}catch(y){console.error("Failed to fetch transcript:",y)}finally{g(!1)}})()},[e,h]),d.useEffect(()=>{r&&f(b=>{if(b.some(v=>v.qna_id===r.qna_id))return b;const y={qna_id:r.qna_id,question:r.question,answer:null,question_generated_at:new Date().toISOString(),answer_submitted_at:null};return[...b,y]})},[r]),d.useEffect(()=>{i!=null&&i.answer?f(b=>b.map(m=>m.qna_id===i.qnaId?{...m,answer:i.answer,answer_submitted_at:new Date().toISOString()}:m)):s&&f(b=>b.map(m=>m.qna_id===(i==null?void 0:i.qnaId)?{...m,answer:s,answer_submitted_at:new Date().toISOString()}:m))},[i,s]),o.jsx(P1,{transcript:u,isLoading:w||(u==null?void 0:u.length)===0,className:t,bottomRef:p,isEditing:n,answerText:s,onAnswerChange:a,timerState:c,editingTime:l})},Gs=5,Vs=5;function B1({isOpen:e,onClose:t,warningCount:r,violationType:i,onDisqualify:n}){const[,s]=d.useState(Vs),a=d.useRef(t),c=d.useRef(n),l=d.useRef(r);if(d.useEffect(()=>{a.current=t,c.current=n,l.current=r},[t,n,r]),d.useEffect(()=>{if(!e)return;const w=setInterval(()=>{s(g=>g<=1?(l.current+1>Gs?c.current():a.current(),Vs):g-1)},1e3);return()=>clearInterval(w)},[e]),d.useEffect(()=>{e&&s(Vs)},[e]),!e)return null;const h=()=>{switch(i){case"tab_switch":return"Attempted tab switch/reload";case"fullscreen_exit":return"Attempted to exit full screen mode";case"focus_loss":return"Lost focus from interview window";case"blocked_shortcut":return"Used a blocked keyboard shortcut";case"right_click_attempt":return"Attempted right click";case"alt_tab_attempt":return"Attempted Alt + Tab";case"blocked_function_key":return"Attempted to use function key";default:return"Attempted right click/tab switch"}},u=Gs-r,f=()=>{r+1>Gs?n():t()};return o.jsx("div",{className:"iw-absolute iw-bottom-20 iw-left-4 iw-right-4 md:iw-right-auto md:iw-w-[480px] iw-z-50 iw-animate-in iw-fade-in iw-slide-in-from-bottom-4 iw-duration-300",children:o.jsxs("div",{className:"iw-relative iw-overflow-hidden iw-rounded-xl iw-border iw-border-dashed iw-border-[#E94315] iw-bg-[#FFEBE6] iw-p-4 iw-shadow-2xl iw-backdrop-blur-sm",children:[o.jsx("button",{onClick:f,className:"iw-absolute iw-right-3 iw-top-3 iw-text-gray-400 iw-transition-colors iw-hover:iw-text-gray-600",children:o.jsx(fi,{className:"iw-h-5 iw-w-5"})}),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-shrink-0 iw-items-center iw-justify-center iw-rounded-full iw-border iw-border-[#FDCBBD]",children:o.jsx(ui,{className:"iw-h-5 iw-w-5 iw-text-red-500"})}),o.jsxs("div",{className:"iw-flex-1 iw-pt-0.5",children:[o.jsxs("h2",{className:"iw-text-[20px] iw-font-semibold iw-leading-tight iw-text-[#E94315]",children:["You have ",u>0?u:0," warning",u>1?"s":""," left"]}),o.jsx("p",{className:"iw-mt-1.5 iw-text-lg iw-text-[#5C6686]",children:h()}),o.jsx("div",{className:"iw-mt-3 iw-border-t iw-border-dashed iw-border-red-200 iw-pt-3",children:u===1?o.jsx("p",{className:"iw-text-[14px] iw-font-bold iw-text-[#062260]",children:"Next violation will disqualify you from this interview and automatically end the interview"}):o.jsx("p",{className:"iw-text-[14px] iw-font-bold iw-text-[#062260]",children:"Interview will end automatically after final warning"})})]})]})]})})}const U1=({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 u=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[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=u=>{s&&u.target===u.currentTarget&&t()},h=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 zs.createPortal(h,document.body)},G1=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"})]}),V1=({showHardReloadWarning:e,onContinue:t})=>{const r=()=>{t()};return o.jsxs(U1,{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(ui,{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(G1,{className:"iw-size-4"}),"Continue Session"]})})]})},pl=d.createContext(null),j1=()=>{const e=d.useContext(pl);if(!e)throw new Error("useProctoring must be used within InterviewProctoring");return e},$1=d.forwardRef(({children:e,onDisqualify:t,isCompleted:r},i)=>{const[n,s]=d.useState(!1),[a,c]=d.useState(!1),[l,h]=d.useState(!1),[u,f]=d.useState("fullscreen_exit"),{logViolation:w,violationCount:g}=E1({maxViolations:5,onViolation:v=>{!a&&!r&&!l&&(s(!0),f(v.type))}}),{enterFullScreen:p,isFullScreen:b,exitFullScreen:m}=g1({onFullScreenChange(v){!v&&!a&&!l&&!r&&(s(!0),w({type:"fullscreen_exit",severity:"high",details:{action:"fullscreen_exit",reason:"Attempted to exit full screen mode"}})),v&&h(!1)}});d.useEffect(()=>{p()},[]),d.useImperativeHandle(i,()=>({exitFullScreenIntentionally:async()=>{h(!0),s(!1),c(!1);try{document.fullscreenElement&&await document.exitFullscreen()}catch(v){console.error("Failed to exit fullscreen:",v)}}}),[]),y1(w),p1(w),b1(),_1(),d.useEffect(()=>{const v=C=>{if(!(a||l||r))return C.preventDefault(),C.returnValue=void 0,""};return window.addEventListener("beforeunload",v),()=>{window.removeEventListener("beforeunload",v)}},[a,l,r]);const y=()=>{c(!0),m(),s(!1),t==null||t()};return o.jsxs(pl.Provider,{value:{violationCount:g,violationType:u,showWarningModal:n,setShowWarningModal:s,handleClose:()=>{s(!1),p()},handleDisqualify:y},children:[o.jsx("div",{className:"iw-relative iw-h-full iw-w-full",children:e}),!b&&g>0&&!a&&!l&&o.jsx(V1,{showHardReloadWarning:!0,logViolation:w,onContinue:p})]})}),W1=({onClick:e,text:t="Submit response"})=>(d.useEffect(()=>{if(typeof window>"u")return;const r=i=>{const n=i.key==="Enter",s=i.target;s.tagName==="INPUT"||s.isContentEditable||n&&(i.preventDefault(),e())};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e]),o.jsx("div",{className:"iw-fixed iw-bottom-10 iw-left-1/4 iw-transform iw--translate-x-1/2 iw-z-50",children:o.jsxs("button",{onClick:e,className:"iw-flex iw-items-center iw-gap-3 iw-bg-[#4C6CFF] hover:iw-bg-[#4c6dffd5] iw-text-white iw-px-5 iw-py-3 iw-rounded-lg iw-shadow-lg iw-transition-all iw-duration-200 iw-group",children:[o.jsx("span",{className:"iw-font-semibold iw-text-sm",children:t}),o.jsx("span",{className:"iw-bg-white/90 iw-text-[#062260] iw-px-2 iw-py-1 iw-rounded iw-text-xs iw-font-mono iw-font-bold group-hover:iw-bg-white iw-transition-colors",children:"Press Enter"})]})})),ml=({brandName:e,brandLogo:t,currentQuestion:r,state:i,phase:n,className:s="",interviewId:a="",interview_duration:c=li,videoFeedRef:l,lastSubmittedAnswer:h,onNextPhase:u,answerText:f,onAnswerChange:w,editingTime:g,answeringTime:p})=>{const{showWarningModal:b,violationCount:m,violationType:y,handleClose:v,handleDisqualify:C}=j1();return o.jsxs("div",{className:`iw-px-4 iw-py-3 ${s} iw-h-[calc(100vh_-_120px)] iw-max-h-[calc(100vh_-_120px)] iw-flex iw-gap-0 iw-relative`,children:[o.jsxs("div",{className:"iw-flex iw-flex-col iw-flex-1 iw-p-5 iw-bg-white/50 iw-border iw-border-[#E8EEFE] iw-rounded-s-3xl iw-overflow-hidden",children:[o.jsx("div",{className:"iw-flex iw-items-start iw-justify-between iw-gap-3 iw-mb-4",children:o.jsx("div",{className:"iw-flex-1",children:o.jsx(C1,{question:r,isLoading:n===B.FETCHING_QUESTION||n===B.IDLE,phase:n,brandName:e,brandLogo:t,timerState:i,answeringTime:p})})}),o.jsxs("div",{className:"iw-flex-1 iw-min-h-0 iw-rounded-[16px] iw-overflow-hidden iw-relative",children:[o.jsx(ol,{ref:l,interviewId:a,interview_duration:c,isAnswering:n===B.ANSWERING,cheatingWarningVisible:b}),o.jsx(B1,{isOpen:b,warningCount:m,violationType:y,onClose:v,onDisqualify:C})]})]}),o.jsx("div",{className:"iw-interview-transcription iw-w-1/4 iw-min-w-32 iw-h-full",children:o.jsx(O1,{interviewId:a,currentQuestion:r,lastSubmittedAnswer:h,isEditing:n===B.EDITING,answerText:f,onAnswerChange:w,timerState:i,editingTime:g})}),u&&(n===B.ANSWERING||n===B.EDITING)&&o.jsx(W1,{onClick:u,text:n===B.ANSWERING?"Submit Response":"Submit Final Response"})]})},z1=({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 u=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[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=u=>{s&&u.target===u.currentTarget&&t()},h=o.jsxs("div",{className:"interview-widget-container",style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},children:[o.jsx("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",transition:"opacity 0.2s"},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?"standalone-dialog-title":void 0,style:{zIndex:1e4},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:"standalone-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 zs.createPortal(h,document.body)},H1=({confirmExitInterview:e,isOpen:t,onClose:r})=>o.jsxs(z1,{isOpen:t,onClose:r,showCloseButton:!1,closeOnOverlayClick:!1,className:"iw-max-w-xl iw-border-2 iw-border-dashed iw-rounded-xl iw-border-[#6296FB]",children:[o.jsxs("div",{className:"iw-p-4",children:[o.jsx("h2",{className:"iw-text-xl iw-font-semibold iw-text-[#062260]",children:"Are you sure you want to leave interview?"}),o.jsx("p",{className:"iw-mt-2 iw-text-[#667085] iw-line-clamp-2",children:"If you exit now, the interview will be terminated and cannot be resumed."})]}),o.jsx("div",{className:"iw-my-0 iw-h-px iw-m-6 iw-border-t iw-border-dashed iw-border-[#B3B9CB]"}),o.jsxs("div",{className:"iw-flex iw-justify-center iw-gap-4 iw-p-4",children:[o.jsx(Zi,{className:"iw-px-8 iw-py-3 iw-rounded-xl !iw-bg-[#E94315] !iw-text-white !iw-font-bold !iw-shadow-md !hover:iw-opacity-70",onClick:e,children:"Leave"}),o.jsx(Zi,{onClick:r,className:"iw-px-6 iw-py-3 iw-rounded-xl !iw-bg-[#F1F5FE] !iw-text-[#062260] !iw-font-bold !iw-border !iw-border-[#E7EAF1] !iw-shadow-md hover:iw-opacity-70",children:"Stay in Interview"})]})]}),yl=({title:e,brandName:t,brandLogo:r,onExit:i,totalDuration:n=30,elapsedTime:s=0})=>{const[a,c]=d.useState(!1),l=Math.min(s/(n*60)*100,100),h=()=>o.jsxs("div",{className:"iw-px-4 iw-pb-2 iw-flex iw-items-center iw-gap-3",children:[o.jsx("div",{className:"iw-flex-1 iw-h-4 iw-bg-[#F2F4F7] iw-rounded-full iw-overflow-hidden iw-border iw-border-blue-100 iw-relative",children:o.jsx("div",{className:"iw-h-full iw-bg-[#0EB00E] iw-rounded-full iw-transition-all iw-duration-1000 iw-ease-linear",style:{width:`${l}%`}})}),o.jsxs("div",{className:"iw-text-sm iw-font-medium iw-whitespace-nowrap",children:[o.jsx("span",{className:"iw-text-[#062260]",children:hn(s)}),o.jsxs("span",{className:"iw-text-[#667085]",children:["/",n," Min"]})]})]});return o.jsxs("header",{className:"iw-w-full iw-text-gray-900 iw-shadow-sm",children:[o.jsxs("div",{className:"iw-mx-auto iw-flex iw-items-center iw-justify-between iw-p-4 iw-pt-1 iw-mb-2 iw-border-b iw-border-[#B3B9CB] iw-border-dashed",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-space-x-2",children:[o.jsx(fn,{brandLogo:r,brandName:t}),o.jsx("p",{className:"iw-text-xl iw-font-semibold",children:t})]}),o.jsx("h1",{className:"iw-text-2xl iw-font-semibold iw-text-gradient-silver",children:e}),o.jsx("button",{className:"iw-text-sm iw-text-[#E94315] iw-min-w-10 iw-rounded-md hover:iw-bg-orange-100 iw-p-2",onClick:()=>c(!0),children:o.jsxs("span",{className:"iw-flex iw-items-center iw-gap-1 iw-text-[18px] iw-font-semibold iw-whitespace-nowrap",children:[o.jsx(fi,{className:"iw-text-[#E94315] iw-size-5"}),"Leave interview"]})})]}),o.jsx(h,{}),o.jsx("div",{className:"iw-h-px iw-bg-gray-200"}),o.jsx(H1,{isOpen:a,confirmExitInterview:()=>{i(),c(!1)},onClose:()=>c(!1)})]})},q1=({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:h}=Rt(),u=d.useRef(null),f=d.useRef(null),w=d.useRef(null),g=d.useRef(null),p=d.useRef(null),b=d.useRef(null),m=d.useRef(!1),[y,v]=d.useState(null);d.useEffect(()=>{if(t||!f.current)return;const N=f.current,M=()=>{const D=u.current;if(!D)return;const T=N.clientWidth,L=r;D.width=Math.max(1,Math.floor(T*window.devicePixelRatio||1)),D.height=Math.max(1,Math.floor(L*window.devicePixelRatio||1))},I=new ResizeObserver(M);return I.observe(N),M(),()=>I.disconnect()},[t,r]),d.useEffect(()=>{if(!t)return;const N=u.current;N&&(N.width=Math.max(1,Math.floor(t*(window.devicePixelRatio||1))),N.height=Math.max(1,Math.floor(r*(window.devicePixelRatio||1))))},[t,r]),d.useEffect(()=>{let N=!1;return(async()=>{try{const I=new(window.AudioContext||window.webkitAudioContext);w.current=I;let D=c;if(!D){if(!l)return;D=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1}),m.current=!0}if(N)return;const T=I.createAnalyser();T.fftSize=s,T.smoothingTimeConstant=a,g.current=T;const L=I.createMediaStreamSource(D);p.current=L,L.connect(T),C()}catch(I){v((I==null?void 0:I.message)||"Failed to initialize microphone")}})(),()=>{var I,D,T,L;N=!0,b.current&&cancelAnimationFrame(b.current);try{(I=p.current)==null||I.disconnect()}catch{}try{(D=g.current)==null||D.disconnect()}catch{}m.current&&((L=((T=p.current)==null?void 0:T.mediaStream)||void 0)==null||L.getTracks().forEach(X=>X.stop())),w.current&&w.current.state!=="closed"&&w.current.close()}},[c,s,a,l]);const C=()=>{const N=u.current,M=g.current;if(!N||!M)return;const I=N.getContext("2d");if(!I)return;const D=window.devicePixelRatio||1,T=N.width,L=N.height,X=M.frequencyBinCount,be=new Uint8Array(X),Q=()=>{b.current=requestAnimationFrame(Q),M.getByteTimeDomainData(be),I.clearRect(0,0,T,L),I.fillStyle="rgba(0,0,0,0)",I.fillRect(0,0,T,L);const W=Math.max(1,Math.floor(i*D)),H=Math.max(1,Math.floor(n*D)),U=W+H,J=Math.max(8,Math.floor((T+H)/U)),tt=Math.floor(be.length/J);for(let bt=0;bt<J;bt++){const Ne=Math.min(be.length-1,bt*tt),Ft=be[Ne]/128-1,Qe=Math.abs(Ft),Ir=Math.pow(Qe,.6),Lt=Math.max(L*.06,Ir*(L*.9)),Fr=bt*U,Lr=(L-Lt)/2,je=140-Math.min(140,140*Qe),Mt=85,oe=48+Math.floor(12*(1-Qe));I.fillStyle=`${h}`,I.shadowColor=`hsla(${je}, ${Mt}%, ${oe}%, ${.25*Qe})`,I.shadowBlur=8*Qe;const rt=Math.min(W/2,Lt/2);K1(I,Fr,Lr,W,Lt,rt),I.fill()}};Q()};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:u,className:"iw-w-full iw-h-full"}),y&&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:y})})]})};function K1(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 Y1=({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(Js,{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(Ri,{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(q1,{}),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(Us,{onClick:()=>{r()},children:"Transcribe My Answer"})})]});function X1(){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 Q1=({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),h=a<50?Math.max(a*.004,.05):Math.max(a*.008,.1),u=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":`${h}px`,"--shadow-spread":`${u}px`,"--mask-radius":f},children:o.jsx("style",{children:`
|
|
74
|
+
└─────────────────────────────────────────────────────────────┘`,"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}},[])},rn=e=>{const{baseColor:t,borderRadius:r}=Zt(),{loading:i,children:n,...s}=e;return o.jsx(tn,{style:{background:zl(t),borderRadius:r},...s,children:i?o.jsx(io,{}):n})},Ah=(e,t,r)=>Math.max(t,Math.min(r,e)),xl=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}`},nn=({total:e,remaining:t,size:r=64,strokeWidth:i=6,className:n="",showLabel:s=!0})=>{const a=Math.max(1,e||1),c=Ah(t/a,0,1),{radius:l,circumference:h,dashOffset:u,center:f}=d.useMemo(()=>{const p=(r-i)/2,y=2*Math.PI*p,m=y*(1-c),b=Math.round(i)%2===1,v=r/2+(b?.5:0);return{radius:p,circumference:y,dashOffset:m,center:v}},[r,i,c]),w=d.useMemo(()=>c<=.25?"iw-stroke-red-500":c<=.5?"iw-stroke-yellow-500":"iw-stroke-green-500",[c]),g=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 ${xl(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} ${g}`,strokeWidth:i,strokeLinecap:"round",fill:"none",strokeDasharray:h,strokeDashoffset:u,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:xl(t)})}):o.jsx("div",{className:"iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center iw-rotate-0",children:o.jsx(Jl,{})})]})},Ch=({timerState:e,answeringTime:t})=>{const r=(e==null?void 0:e.currentPhaseTimeRemaining)||0,i=t||ml.answeringDuration;return o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-3",children:[o.jsx(nn,{total:i,remaining:r,size:50,strokeWidth:4,showLabel:!1,className:"iw-shadow-sm iw-border iw-border-gray-100"}),o.jsxs("div",{className:"iw-flex iw-flex-col",children:[o.jsx("span",{className:"iw-text-[#5C6686]",children:"Time left to answer"}),o.jsxs("span",{className:"iw-text-xl iw-font-bold iw-text-[#062260]",children:[yn(r,!0),r>=60?" min":" sec"]})]})]})},Th=({question:e,isLoading:t=!1,phase:r,brandName:i,brandLogo:n,timerState:s,answeringTime:a})=>o.jsx("div",{className:"iw-rounded-xl iw-mb-4 message-animation iw-text-gray-800 iw-py-1",children:o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-4",children:[o.jsx("div",{className:`iw-flex iw-flex-col iw-items-center iw-justify-center iw-relative iw-h-16 iw-w-16 iw-shrink-0 iw-shadow iw-rounded-full iw-border-[#E8EEFE] iw-border-4 ${r===P.READING_QUESTION?"iw-animate-speaking":""}`,children:o.jsx("div",{className:"iw-bg-transparent iw-flex iw-items-center iw-justify-center iw-rounded-full iw-size-full",style:{backgroundImage:"linear-gradient(#B5D0FD, #FFFFFF)"},children:o.jsx(bn,{brandLogo:n,brandName:i})})}),o.jsx(Nh,{phase:r,question:e,isLoading:t,brandName:i,timerState:s,answeringTime:a})]})}),Nh=({phase:e,question:t,isLoading:r,brandName:i,timerState:n,answeringTime:s})=>{const a=i||"We",c=i?"is":"are";if(r||e===P.FETCHING_QUESTION||e===P.IDLE)return 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"})]});const l=()=>o.jsxs("span",{className:"iw-animate-dot-wave iw-ml-1",children:[o.jsx("span",{children:"."}),o.jsx("span",{children:"."}),o.jsx("span",{children:"."})]});switch(e){case P.ANSWERING:return o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-w-full",children:[o.jsxs("p",{className:"iw-text-lg iw-leading-7 iw-font-medium iw-text-gray-600",children:["Listening",o.jsx(l,{})]}),o.jsx(Ch,{timerState:n,answeringTime:s})]});case P.TRANSCRIBING:return o.jsxs("p",{className:"iw-text-lg iw-leading-7 iw-font-medium iw-text-gray-600",children:[a," ",c," analyzing your answer",o.jsx(l,{})]});case(P.EDITING||P.SUBMITTING):return o.jsxs("p",{className:"iw-text-lg iw-leading-7 iw-font-medium iw-text-gray-600",children:[a," ",c," waiting for your answer..."]});default:return o.jsx("p",{className:"iw-text-lg iw-leading-7",children:t==null?void 0:t.question})}},Ih=({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":"",h=r?"iw-w-full":"",u=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} ${h} ${u} ${i}`,"aria-invalid":t?"true":"false",...s}),t&&o.jsx("p",{className:"iw-mt-1 iw-text-sm iw-text-red-600",children:t})]})},Fh=({answerText:e,onAnswerChange:t,timerState:r,editingTime:i})=>o.jsxs("div",{className:"iw-w-full iw-bg-white iw-rounded-xl iw-border iw-border-[#84bbf5] iw-overflow-hidden iw-rounded-tr-none",children:[o.jsx("div",{className:"iw-p-2 iw-pb-0",children:o.jsx(Ih,{value:e,onChange:t,placeholder:"Type your answer here...",className:"iw-w-full iw-h-64 iw-resize-none iw-bg-transparent iw-border-none iw-text-[#062260] iw-text-base iw-leading-relaxed focus-visible:iw-outline-0 iw-p-0",disabled:r.phase===P.SUBMITTING})}),o.jsxs("div",{className:"iw-bg-[#F1F5FE] iw-px-2 iw-py-2 iw-flex iw-items-center iw-justify-between iw-border-t iw-border-[#E8EEFE]",children:[o.jsx("span",{className:"iw-text-[#062260] iw-text-sm iw-font-medium iw-line-clamp-1",children:"Time left to edit answer"}),o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[o.jsx(nn,{total:i,remaining:r.currentPhaseTimeRemaining,size:32,strokeWidth:3,showLabel:!1}),o.jsx("span",{className:"iw-text-[#062260] iw-text-sm iw-font-bold",children:`${yn(r.currentPhaseTimeRemaining,!0)}${r.currentPhaseTimeRemaining>=60?" min":" sec"}`})]})]})]}),El=({children:e})=>o.jsx("div",{className:"iw-flex iw-flex-col iw-items-start iw-mt-3 iw-gap-1",children:e}),Lh=({children:e})=>o.jsx("div",{className:"iw-flex iw-flex-col iw-items-end iw-mt-3 iw-gap-1",children:e}),Mh=({questionNumber:e})=>o.jsxs("div",{className:"iw-px-4 iw-py-1.5 iw-rounded-full iw-mb-2 iw-text-sm iw-font-semibold",style:{color:"#062260",backgroundColor:"#E6F3FF",border:"1px solid #BDE0FD"},children:[" Q",e]}),_l=({label:e})=>o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2 iw-text-sm iw-text-gray-500 iw-bg-[#F1F5FE] iw-px-4 iw-py-1.5 iw-rounded-full iw-my-2 iw-font-semibold",children:[e&&o.jsx("span",{className:"iw-font-medium",children:e}),o.jsxs("span",{className:"iw-animate-dot-wave iw-text-2xl",children:[o.jsx("span",{children:"."}),o.jsx("span",{children:"."}),o.jsx("span",{children:"."})]})]}),Dh=({phase:e,questionNumber:t})=>{switch(e){case P.FETCHING_QUESTION:return o.jsxs(El,{children:[o.jsx(Mh,{questionNumber:t+1}),o.jsx(_l,{})]});case P.ANSWERING:return o.jsx(Lh,{children:o.jsx(_l,{label:"You"})});case P.TRANSCRIBING:return o.jsx(El,{children:o.jsxs("div",{className:"iw-flex iw-items-center iw-px-1 iw-py-1.5 iw-rounded-lg iw-mb-2 iw-text-sm iw-bg-[#F2E8FE]",children:[o.jsx("div",{className:"iw-h-8 iw-w-12 iw-transcribing-icon"}),o.jsx("span",{className:"iw-text-sm iw-text-[#062260]",children:"Analyzing answer…"})]})});default:return null}},Ph=({item:e,index:t,isCurrentQuestion:r=!1,isEditable:i=!1,answerText:n="",onAnswerChange:s,timerState:a,editingTime:c})=>{const l=i&&a&&c!==void 0,h=l||e.answer;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-start",children:[o.jsxs("div",{className:"iw-px-4 iw-py-1.5 iw-rounded-full iw-mb-2 iw-text-sm iw-font-semibold",style:{color:"#062260",backgroundColor:"#E6F3FF",border:"1px solid #BDE0FD"},children:["Q",t+1]}),o.jsx("div",{className:"iw-w-full iw-p-4 iw-rounded-xl iw-text-[#062260] iw-text-base iw-leading-relaxed iw-rounded-tl-none",style:{backgroundColor:"#F1F5FE",border:r?"2px solid #84bbf5":"1px solid transparent"},children:e.question})]}),h&&o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-end iw-mt-4",children:[o.jsx("div",{className:"iw-px-4 iw-py-1.5 iw-rounded-full iw-mb-2 iw-text-sm iw-font-semibold",style:{color:"#062260",backgroundColor:"#F2E8FE",border:"1px solid #E9D5FF"},children:"You"}),l?o.jsx(Fh,{answerText:n||"",onAnswerChange:s,timerState:a,editingTime:c}):o.jsx("div",{className:"iw-w-full iw-p-4 iw-rounded-xl iw-text-[#062260] iw-text-base iw-leading-relaxed iw-rounded-tr-none",style:{backgroundColor:"#F7F1FE"},children:e.answer})]}),r&&o.jsx(Dh,{phase:a==null?void 0:a.phase,questionNumber:t+1})]})},Oh=()=>o.jsx("div",{className:"iw-space-y-6 iw-animate-pulse",children:[1,2,3].map(e=>o.jsxs("div",{className:`iw-flex iw-flex-col ${e%2===0?"iw-items-end":"iw-items-start"} iw-gap-2`,children:[o.jsx("div",{className:"iw-h-8 iw-w-16 iw-bg-gray-200 iw-rounded-full"}),o.jsx("div",{className:"iw-h-24 iw-w-full iw-bg-gray-100 iw-rounded-xl"})]},e))}),Bh=({transcript:e,isLoading:t,className:r="",bottomRef:i,isEditing:n,answerText:s,onAnswerChange:a,timerState:c,editingTime:l})=>o.jsxs("div",{className:`iw-h-full iw-flex iw-flex-col iw-bg-white iw-scroll-smooth iw-p-6 iw-pr-2 iw-min-w-32 iw-border iw-rounded-tr-2xl iw-rounded-br-2xl iw-border-[#E8EEFE] ${r}`,children:[o.jsxs("div",{className:"iw-mb-6",children:[o.jsx("h2",{className:"iw-text-lg iw-font-semibold iw-mb-4",style:{color:"#062260"},children:"Interview transcript"}),o.jsx("div",{className:"iw-h-px iw-w-full iw-border-t iw-border-dashed iw-border-gray-300"})]}),o.jsxs("div",{className:"iw-flex-1 iw-overflow-y-auto iw-pr-2 iw-space-y-6 iw-scrollbar-thin iw-max-w-xl iw-pb-5",children:[t?o.jsx(Oh,{}):e==null?void 0:e.map((h,u)=>o.jsx(Ph,{item:h,index:u,isCurrentQuestion:u===(e==null?void 0:e.length)-1,isEditable:!!(u===(e==null?void 0:e.length)-1&&n),answerText:s,onAnswerChange:a||(()=>{}),timerState:c,editingTime:l},h.qna_id)),o.jsx("div",{ref:i})]})]}),Uh=({interviewId:e,className:t="",currentQuestion:r,lastSubmittedAnswer:i,isEditing:n,answerText:s,onAnswerChange:a,timerState:c,editingTime:l})=>{const h=bl(),[u,f]=d.useState([]),[w,g]=d.useState(!0),p=d.useRef(null);return d.useEffect(()=>{var y;(y=p.current)==null||y.scrollIntoView({behavior:"smooth"})},[u,s,c==null?void 0:c.phase]),d.useEffect(()=>{(async()=>{var m;try{const b=await h.getInterviewTranscription(e);f(((m=b==null?void 0:b.data)==null?void 0:m.transcript)||[])}catch(b){console.error("Failed to fetch transcript:",b)}finally{g(!1)}})()},[e,h]),d.useEffect(()=>{r&&f(y=>{if(y.some(v=>v.qna_id===r.qna_id))return y;const b={qna_id:r.qna_id,question:r.question,answer:null,question_generated_at:new Date().toISOString(),answer_submitted_at:null};return[...y,b]})},[r]),d.useEffect(()=>{i!=null&&i.answer?f(y=>y.map(m=>m.qna_id===i.qnaId?{...m,answer:i.answer,answer_submitted_at:new Date().toISOString()}:m)):s&&f(y=>y.map(m=>m.qna_id===(i==null?void 0:i.qnaId)?{...m,answer:s,answer_submitted_at:new Date().toISOString()}:m))},[i,s]),o.jsx(Bh,{transcript:u,isLoading:w||(u==null?void 0:u.length)===0,className:t,bottomRef:p,isEditing:n,answerText:s,onAnswerChange:a,timerState:c,editingTime:l})},Ws=5,Hs=5;function Vh({isOpen:e,onClose:t,warningCount:r,violationType:i,onDisqualify:n}){const[,s]=d.useState(Hs),a=d.useRef(t),c=d.useRef(n),l=d.useRef(r);if(d.useEffect(()=>{a.current=t,c.current=n,l.current=r},[t,n,r]),d.useEffect(()=>{if(!e)return;const w=setInterval(()=>{s(g=>g<=1?(l.current+1>Ws?c.current():a.current(),Hs):g-1)},1e3);return()=>clearInterval(w)},[e]),d.useEffect(()=>{e&&s(Hs)},[e]),!e)return null;const h=()=>{switch(i){case"tab_switch":return"Attempted tab switch/reload";case"fullscreen_exit":return"Attempted to exit full screen mode";case"focus_loss":return"Lost focus from interview window";case"blocked_shortcut":return"Used a blocked keyboard shortcut";case"right_click_attempt":return"Attempted right click";case"alt_tab_attempt":return"Attempted Alt + Tab";case"blocked_function_key":return"Attempted to use function key";default:return"Attempted right click/tab switch"}},u=Ws-r,f=()=>{r+1>Ws?n():t()};return o.jsx("div",{className:"iw-absolute iw-bottom-20 iw-left-4 iw-right-4 md:iw-right-auto md:iw-w-[480px] iw-z-50 iw-animate-in iw-fade-in iw-slide-in-from-bottom-4 iw-duration-300",children:o.jsxs("div",{className:"iw-relative iw-overflow-hidden iw-rounded-xl iw-border iw-border-dashed iw-border-[#E94315] iw-bg-[#FFEBE6] iw-p-4 iw-shadow-2xl iw-backdrop-blur-sm",children:[o.jsx("button",{onClick:f,className:"iw-absolute iw-right-3 iw-top-3 iw-text-gray-400 iw-transition-colors iw-hover:iw-text-gray-600",children:o.jsx(pi,{className:"iw-h-5 iw-w-5"})}),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-shrink-0 iw-items-center iw-justify-center iw-rounded-full iw-border iw-border-[#FDCBBD]",children:o.jsx(wi,{className:"iw-h-5 iw-w-5 iw-text-red-500"})}),o.jsxs("div",{className:"iw-flex-1 iw-pt-0.5",children:[o.jsxs("h2",{className:"iw-text-[20px] iw-font-semibold iw-leading-tight iw-text-[#E94315]",children:["You have ",u>0?u:0," warning",u>1?"s":""," left"]}),o.jsx("p",{className:"iw-mt-1.5 iw-text-lg iw-text-[#5C6686]",children:h()}),o.jsx("div",{className:"iw-mt-3 iw-border-t iw-border-dashed iw-border-red-200 iw-pt-3",children:u===1?o.jsx("p",{className:"iw-text-[14px] iw-font-bold iw-text-[#062260]",children:"Next violation will disqualify you from this interview and automatically end the interview"}):o.jsx("p",{className:"iw-text-[14px] iw-font-bold iw-text-[#062260]",children:"Interview will end automatically after final warning"})})]})]})]})})}const Gh=({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 u=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[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=u=>{s&&u.target===u.currentTarget&&t()},h=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 Xs.createPortal(h,document.body)},jh=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"})]}),zh=({showHardReloadWarning:e,onContinue:t})=>{const r=()=>{t()};return o.jsxs(Gh,{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(wi,{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(jh,{className:"iw-size-4"}),"Continue Session"]})})]})},kl=d.createContext(null),$h=()=>{const e=d.useContext(kl);return e||{violationCount:0,violationType:"fullscreen_exit",showWarningModal:!1,setShowWarningModal:()=>{},handleClose:()=>{},handleDisqualify:()=>{}}},Wh=d.forwardRef(({children:e,onDisqualify:t,isCompleted:r},i)=>{const[n,s]=d.useState(!1),[a,c]=d.useState(!1),[l,h]=d.useState(!1),[u,f]=d.useState("fullscreen_exit"),{logViolation:w,violationCount:g}=kh({maxViolations:5,onViolation:v=>{!a&&!r&&!l&&(s(!0),f(v.type))}}),{enterFullScreen:p,isFullScreen:y,exitFullScreen:m}=mh({onFullScreenChange(v){!v&&!a&&!l&&!r&&(s(!0),w({type:"fullscreen_exit",severity:"high",details:{action:"fullscreen_exit",reason:"Attempted to exit full screen mode"}})),v&&h(!1)}});d.useEffect(()=>{p()},[]),d.useImperativeHandle(i,()=>({exitFullScreenIntentionally:async()=>{h(!0),s(!1),c(!1);try{document.fullscreenElement&&await document.exitFullscreen()}catch(v){console.error("Failed to exit fullscreen:",v)}}}),[]),vh(w),yh(w),xh(),Sh(),d.useEffect(()=>{const v=I=>{if(!(a||l||r))return I.preventDefault(),I.returnValue=void 0,""};return window.addEventListener("beforeunload",v),()=>{window.removeEventListener("beforeunload",v)}},[a,l,r]);const b=()=>{c(!0),m(),s(!1),t==null||t()};return o.jsxs(kl.Provider,{value:{violationCount:g,violationType:u,showWarningModal:n,setShowWarningModal:s,handleClose:()=>{s(!1),p()},handleDisqualify:b},children:[o.jsx("div",{className:"iw-relative iw-h-full iw-w-full",children:e}),!y&&g>0&&!a&&!l&&o.jsx(zh,{showHardReloadWarning:!0,logViolation:w,onContinue:p})]})}),Hh=({onClick:e,text:t="Submit response",disabled:r=!1})=>(d.useEffect(()=>{if(typeof window>"u")return;const i=n=>{const s=n.key==="Enter",a=n.target;if(!(a.tagName==="INPUT"||a.isContentEditable)&&s){if(r)return;n.preventDefault(),e()}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[e,r]),o.jsx("div",{className:"iw-fixed iw-bottom-10 iw-left-1/4 iw-transform iw--translate-x-1/2 iw-z-50",children:o.jsxs("button",{disabled:r,onClick:e,className:`iw-flex iw-items-center iw-gap-3 iw-text-white iw-px-5 iw-py-3 iw-rounded-lg iw-shadow-lg iw-transition-all iw-duration-200 iw-group ${r?"iw-bg-[#4C6CFF]/60 iw-cursor-not-allowed":"iw-bg-[#4C6CFF] hover:iw-bg-[#4c6dffd5]"}`,children:[o.jsx("span",{className:"iw-font-semibold iw-text-sm",children:t}),o.jsx("span",{className:"iw-bg-white/90 iw-text-[#062260] iw-px-2 iw-py-1 iw-rounded iw-text-xs iw-font-mono iw-font-bold group-hover:iw-bg-white iw-transition-colors",children:"Press Enter"})]})})),qh=({brandName:e,brandLogo:t,currentQuestion:r,state:i,phase:n,className:s="",interviewId:a="",interview_duration:c=hi,videoFeedRef:l,lastSubmittedAnswer:h,onNextPhase:u,answerText:f,onAnswerChange:w,editingTime:g,answeringTime:p,disableSubmitButton:y=!1})=>{const{showWarningModal:m,violationCount:b,violationType:v,handleClose:I,handleDisqualify:C}=$h();return o.jsxs("div",{className:`iw-px-4 iw-py-3 ${s} iw-h-[calc(100vh_-_120px)] iw-max-h-[calc(100vh_-_120px)] iw-flex iw-gap-0 iw-relative`,children:[o.jsxs("div",{className:"iw-flex iw-flex-col iw-flex-1 iw-p-5 iw-bg-white/50 iw-border iw-border-[#E8EEFE] iw-rounded-s-3xl iw-overflow-hidden",children:[o.jsx("div",{className:"iw-flex iw-items-start iw-justify-between iw-gap-3 iw-mb-4",children:o.jsx("div",{className:"iw-flex-1",children:o.jsx(Th,{question:r,isLoading:n===P.FETCHING_QUESTION||n===P.IDLE,phase:n,brandName:e,brandLogo:t,timerState:i,answeringTime:p})})}),o.jsxs("div",{className:"iw-flex-1 iw-min-h-0 iw-rounded-[16px] iw-overflow-hidden iw-relative",children:[o.jsx(wl,{ref:l,interviewId:a,interview_duration:c,isAnswering:n===P.ANSWERING,cheatingWarningVisible:m}),o.jsx(Vh,{isOpen:m,warningCount:b,violationType:v,onClose:I,onDisqualify:C})]})]}),o.jsx("div",{className:"iw-interview-transcription iw-w-1/4 iw-min-w-32 iw-h-full",children:o.jsx(Uh,{interviewId:a,currentQuestion:r,lastSubmittedAnswer:h,isEditing:n===P.EDITING,answerText:f,onAnswerChange:w,timerState:i,editingTime:g})}),u&&(n===P.ANSWERING||n===P.EDITING)&&o.jsx(Hh,{onClick:u,disabled:y,text:n===P.ANSWERING?"Submit Response":"Submit Final Response"})]})},Kh=({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 u=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[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=u=>{s&&u.target===u.currentTarget&&t()},h=o.jsxs("div",{className:"interview-widget-container",style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},children:[o.jsx("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",transition:"opacity 0.2s"},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?"standalone-dialog-title":void 0,style:{zIndex:1e4},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:"standalone-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 Xs.createPortal(h,document.body)},Yh=({confirmExitInterview:e,isOpen:t,onClose:r})=>o.jsxs(Kh,{isOpen:t,onClose:r,showCloseButton:!1,closeOnOverlayClick:!1,className:"iw-max-w-xl iw-border-2 iw-border-dashed iw-rounded-xl iw-border-[#6296FB]",children:[o.jsxs("div",{className:"iw-p-4",children:[o.jsx("h2",{className:"iw-text-xl iw-font-semibold iw-text-[#062260]",children:"Are you sure you want to leave interview?"}),o.jsx("p",{className:"iw-mt-2 iw-text-[#667085] iw-line-clamp-2",children:"If you exit now, the interview will be terminated and cannot be resumed."})]}),o.jsx("div",{className:"iw-my-0 iw-h-px iw-m-6 iw-border-t iw-border-dashed iw-border-[#B3B9CB]"}),o.jsxs("div",{className:"iw-flex iw-justify-center iw-gap-4 iw-p-4",children:[o.jsx(tn,{className:"iw-px-8 iw-py-3 iw-rounded-xl !iw-bg-[#E94315] !iw-text-white !iw-font-bold !iw-shadow-md !hover:iw-opacity-70",onClick:e,children:"Leave"}),o.jsx(tn,{onClick:r,className:"iw-px-6 iw-py-3 iw-rounded-xl !iw-bg-[#F1F5FE] !iw-text-[#062260] !iw-font-bold !iw-border !iw-border-[#E7EAF1] !iw-shadow-md hover:iw-opacity-70",children:"Stay in Interview"})]})]}),Xh=({title:e,brandName:t,brandLogo:r,onExit:i,totalDuration:n=30,elapsedTime:s=0})=>{const[a,c]=d.useState(!1),l=Math.min(s/(n*60)*100,100),h=()=>o.jsxs("div",{className:"iw-px-4 iw-pb-2 iw-flex iw-items-center iw-gap-3",children:[o.jsx("div",{className:"iw-flex-1 iw-h-4 iw-bg-[#F2F4F7] iw-rounded-full iw-overflow-hidden iw-border iw-border-blue-100 iw-relative",children:o.jsx("div",{className:"iw-h-full iw-bg-[#0EB00E] iw-rounded-full iw-transition-all iw-duration-1000 iw-ease-linear",style:{width:`${l}%`}})}),o.jsxs("div",{className:"iw-text-sm iw-font-medium iw-whitespace-nowrap",children:[o.jsx("span",{className:"iw-text-[#062260]",children:yn(s)}),o.jsxs("span",{className:"iw-text-[#667085]",children:["/",n," Min"]})]})]});return o.jsxs("header",{className:"iw-w-full iw-text-gray-900 iw-shadow-sm",children:[o.jsxs("div",{className:"iw-mx-auto iw-flex iw-items-center iw-justify-between iw-p-4 iw-pt-1 iw-mb-2 iw-border-b iw-border-[#B3B9CB] iw-border-dashed",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-space-x-2",children:[o.jsx(bn,{brandLogo:r,brandName:t}),o.jsx("p",{className:"iw-text-xl iw-font-semibold",children:t})]}),o.jsx("h1",{className:"iw-text-2xl iw-font-semibold iw-text-gradient-silver",children:e}),o.jsx("button",{className:"iw-text-sm iw-text-[#E94315] iw-min-w-10 iw-rounded-md hover:iw-bg-orange-100 iw-p-2",onClick:()=>c(!0),children:o.jsxs("span",{className:"iw-flex iw-items-center iw-gap-1 iw-text-[18px] iw-font-semibold iw-whitespace-nowrap",children:[o.jsx(pi,{className:"iw-text-[#E94315] iw-size-5"}),"Leave interview"]})})]}),o.jsx(h,{}),o.jsx("div",{className:"iw-h-px iw-bg-gray-200"}),o.jsx(Yh,{isOpen:a,confirmExitInterview:()=>{i(),c(!1)},onClose:()=>c(!1)})]})},Qh=({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:h}=Zt(),u=d.useRef(null),f=d.useRef(null),w=d.useRef(null),g=d.useRef(null),p=d.useRef(null),y=d.useRef(null),m=d.useRef(!1),[b,v]=d.useState(null);d.useEffect(()=>{if(t||!f.current)return;const C=f.current,S=()=>{const M=u.current;if(!M)return;const F=C.clientWidth,D=r;M.width=Math.max(1,Math.floor(F*window.devicePixelRatio||1)),M.height=Math.max(1,Math.floor(D*window.devicePixelRatio||1))},A=new ResizeObserver(S);return A.observe(C),S(),()=>A.disconnect()},[t,r]),d.useEffect(()=>{if(!t)return;const C=u.current;C&&(C.width=Math.max(1,Math.floor(t*(window.devicePixelRatio||1))),C.height=Math.max(1,Math.floor(r*(window.devicePixelRatio||1))))},[t,r]),d.useEffect(()=>{let C=!1;return(async()=>{try{const A=new(window.AudioContext||window.webkitAudioContext);w.current=A;let M=c;if(!M){if(!l)return;M=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1}),m.current=!0}if(C)return;const F=A.createAnalyser();F.fftSize=s,F.smoothingTimeConstant=a,g.current=F;const D=A.createMediaStreamSource(M);p.current=D,D.connect(F),I()}catch(A){v((A==null?void 0:A.message)||"Failed to initialize microphone")}})(),()=>{var A,M,F,D;C=!0,y.current&&cancelAnimationFrame(y.current);try{(A=p.current)==null||A.disconnect()}catch{}try{(M=g.current)==null||M.disconnect()}catch{}m.current&&((D=((F=p.current)==null?void 0:F.mediaStream)||void 0)==null||D.getTracks().forEach(G=>G.stop())),w.current&&w.current.state!=="closed"&&w.current.close()}},[c,s,a,l]);const I=()=>{const C=u.current,S=g.current;if(!C||!S)return;const A=C.getContext("2d");if(!A)return;const M=window.devicePixelRatio||1,F=C.width,D=C.height,G=S.frequencyBinCount,Y=new Uint8Array(G),H=()=>{y.current=requestAnimationFrame(H),S.getByteTimeDomainData(Y),A.clearRect(0,0,F,D),A.fillStyle="rgba(0,0,0,0)",A.fillRect(0,0,F,D);const q=Math.max(1,Math.floor(i*M)),Z=Math.max(1,Math.floor(n*M)),O=q+Z,R=Math.max(8,Math.floor((F+Z)/O)),Ye=Math.floor(Y.length/R);for(let ft=0;ft<R;ft++){const Xe=Math.min(Y.length-1,ft*Ye),oi=Y[Xe]/128-1,ke=Math.abs(oi),Lt=Math.pow(ke,.6),Mt=Math.max(D*.06,Lt*(D*.9)),Tr=ft*O,Nr=(D-Mt)/2,Ir=140-Math.min(140,140*ke),Fr=85,Lr=48+Math.floor(12*(1-ke));A.fillStyle=`${h}`,A.shadowColor=`hsla(${Ir}, ${Fr}%, ${Lr}%, ${.25*ke})`,A.shadowBlur=8*ke;const rt=Math.min(q/2,Mt/2);Jh(A,Tr,Nr,q,Mt,rt),A.fill()}};H()};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:u,className:"iw-w-full iw-h-full"}),b&&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:b})})]})};function Jh(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 Zh=({state:e,answeringTime:t,nextPhase:r,sttError:i,disableStopButton:n=!1})=>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(ro,{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(nn,{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(Qh,{}),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(rn,{disabled:n,onClick:()=>{r()},children:"Transcribe My Answer"})})]});function Rh(){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 e1=({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),h=a<50?Math.max(a*.004,.05):Math.max(a*.008,.1),u=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":`${h}px`,"--shadow-spread":`${u}px`,"--mask-radius":f},children:o.jsx("style",{children:`
|
|
75
75
|
@property --angle {
|
|
76
76
|
syntax: "<angle>";
|
|
77
77
|
inherits: false;
|
|
@@ -176,4 +176,4 @@
|
|
|
176
176
|
animation: none;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
`})})};function J1({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(Q1,{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 Z1=({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(Js,{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(Ri,{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(Us,{onClick:()=>{r()},children:"Start Answering"})})]}),R1=({sttError:e,editingDuration:t})=>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.jsxs("p",{className:"iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]",children:["After transcription, you'll have ",t||30," 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)"]})]}),e2=({interviewTitle:e,brandName:t="Novara",brandLogo:r,interviewId:i,onComplete:n,onDisqualify:s,className:a="",videoFeedRef:c})=>{var oi,Pr;const l=ul(),{baseUrl:h,authToken:u}=Qs(),{timers:f,stt:w,proctoring:g}=un(),p=d.useRef(null),[b,m]=d.useState(null),[y,v]=d.useState(""),[C,N]=d.useState(null),[M,I]=d.useState(li),[D,T]=d.useState(!0),L=d.useRef(""),X=d.useRef(null),be={thinkingTime:(f==null?void 0:f.thinkingDuration)||0,answeringTime:(f==null?void 0:f.answeringDuration)||120,editingTime:D?(f==null?void 0:f.editingDuration)||30:0},{thinkingTime:Q,answeringTime:W,editingTime:H}=be;d.useEffect(()=>{L.current=y},[y]);const U=d.useRef(!1),{speak:J,stop:tt,error:bt}=x1({onEnd:()=>{U.current=!1,oe()},onError:()=>{U.current||(U.current=!0,oe())}}),Ne=d.useRef(!1),Ft=d.useRef(!1),{startRecording:Qe,stopRecording:Ir,transcribe:Lt,cancelRecording:Fr,error:Lr}=m1({config:{baseUrl:h,provider:w==null?void 0:w.provider,model:w==null?void 0:w.model,language:w==null?void 0:w.language,authToken:u,qnaId:((oi=X.current)==null?void 0:oi.qna_id)||"",interviewId:i},onStart:()=>{Ne.current=!1,Ft.current=!1},onStop:()=>{},onTranscriptionComplete:F=>{const G=F.transcript;v(G),L.current=G,Ft.current||(Ft.current=!0,oe())},onError:F=>{console.error("STT Error:",F),Ne.current||(Ne.current=!0,oe())}}),{state:je,startQuestion:Mt,nextPhase:oe,completeInterview:rt,timerService:Mr}=f1({config:{answeringDuration:W,editingDuration:H},callbacks:{onPhaseChange:F=>{switch(F){case B.FETCHING_QUESTION:Qt();break;case B.READING_QUESTION:en();break;case B.ANSWERING:Dr();break;case B.TRANSCRIBING:si();break;case B.SUBMITTING:$s();break}},onInterviewEnd:()=>{n==null||n()}}});d.useEffect(()=>{Mt()},[]),d.useEffect(()=>{(async()=>{try{const G=await l.getInterviewConfig(i);if(G!=null&&G.data&&(G.data.duration_in_minutes&&I(G.data.duration_in_minutes),typeof G.data.allow_answer_editing=="boolean"&&T(G.data.allow_answer_editing),typeof G.data.elapsed_time_in_minutes=="number")){const $e=Math.floor(G.data.elapsed_time_in_minutes*60);Mr.setTotalTimeElapsed($e)}}catch(G){console.error("Failed to fetch interview config:",G)}})()},[i,Mr]);const{execute:Qt}=w1(async()=>{const F=await l.generateQuestion({interviewId:i});return X.current=F.data,F},{onSuccess:async F=>{F&&F.data&&(v(""),L.current="",m(F.data),oe())},onError:F=>{console.error("Failed to fetch questions:",F)}}),$s=d.useCallback(async()=>{var F;try{const G=L.current,$e=((F=X.current)==null?void 0:F.qna_id)||"";D&&await l.submitAnswer({interviewId:i,qnaId:$e,answer:G}),N({qnaId:$e,answer:G})}catch(G){console.error("Failed to submit answer:",G)}Mt()},[l,i,Mt,D]),en=d.useCallback(async()=>{var F,G;if((F=X.current)!=null&&F.question)if(X.current.question_audio_data_base64)try{U.current=!1,await J(X.current.question_audio_data_base64),X.current.is_interview_done&&(tt(),Fr(),c&&"current"in c&&((G=c.current)==null||G.stopCamera()),rt())}catch($e){console.error("Failed to speak question:",$e),oe()}else console.warn("No audio data available for question"),await Vl(2e3),oe();else oe()},[J,oe,rt]),Dr=d.useCallback(async()=>{try{await Qe(W)}catch(F){console.error("Failed to start recording:",F),oe()}},[Qe,oe]),si=d.useCallback(async()=>{try{const F=await Ir();await Lt(F)}catch(F){console.error("STT processing failed:",F),!Ne.current&&!Ft.current&&(Ne.current=!0,oe())}},[Ir,Lt,oe]),Jt=d.useCallback(async F=>{var G,$e;tt(),Fr(),c&&"current"in c&&((G=c.current)==null||G.stopCamera()),await(($e=p.current)==null?void 0:$e.exitFullScreenIntentionally());try{await l.exitInterview(i)}catch(rn){console.error("API call failed:",rn)}finally{F==null||F(),rt(),sessionStorage.removeItem(cn)}},[i,tt,l]),tn=()=>{const{phase:F}=je;switch(F){case B.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(Us,{onClick:Mt,className:"iw-mt-2 iw-w-40",children:"Start Interview"})]});case B.FETCHING_QUESTION:return o.jsx(X1,{});case B.READING_QUESTION:return o.jsx(J1,{ttsError:bt});case B.THINKING:return o.jsx(Z1,{state:je,thinkingTime:Q,nextPhase:oe});case B.ANSWERING:return o.jsx(Y1,{state:je,answeringTime:W,nextPhase:oe,sttError:Lr});case B.TRANSCRIBING:return o.jsx(R1,{sttError:Lr,editingDuration:H});case B.EDITING:case B.SUBMITTING:return null;case B.COMPLETED:return null;default:return null}};return o.jsx(o.Fragment,{children:g!=null&&g.enabled?o.jsxs($1,{ref:p,onDisqualify:()=>Jt(s),isCompleted:((Pr=X==null?void 0:X.current)==null?void 0:Pr.is_interview_done)??!1,children:[o.jsx(yl,{title:e,brandName:t,brandLogo:r,totalDuration:M,elapsedTime:je.totalTimeElapsed,onExit:()=>Jt()}),o.jsx(ml,{brandName:t,brandLogo:r,currentQuestion:b,state:je,phase:je.phase,className:a,interviewId:i,interview_duration:M,videoFeedRef:c,lastSubmittedAnswer:C,onNextPhase:oe,answerText:y,onAnswerChange:F=>{const G=F.target.value;v(G),L.current=G},editingTime:H,answeringTime:W,children:tn()})]}):o.jsxs(o.Fragment,{children:[o.jsx(yl,{title:e,brandName:t,brandLogo:r,totalDuration:M,elapsedTime:je.totalTimeElapsed,onExit:()=>Jt()}),o.jsx(ml,{brandName:t,brandLogo:r,currentQuestion:b,state:je,phase:je.phase,className:a,interviewId:i,interview_duration:M,videoFeedRef:c,lastSubmittedAnswer:C,onNextPhase:oe,answerText:y,onAnswerChange:F=>{const G=F.target.value;v(G),L.current=G},editingTime:H,answeringTime:W,children:tn()})]})})},js=({title:e,brandName:t,brandLogo:r,interviewId:i,onInterviewEnd:n,onInterviewDisqualify:s,className:a=""})=>{const[c,l]=d.useState(!1),[h,u]=d.useState(!0),[f,w]=d.useState(!1),{proctoring:g}=un(),p=d.useRef(null),b=d.useRef(null),m=(g==null?void 0:g.gazeAnalysisEnabled)===!0,y=()=>{l(!0),u(!1)};return d.useEffect(()=>{if(c&&f&&b.current&&m)try{b.current.setReference()}finally{w(!1)}},[c,f,m]),c?o.jsx("div",{className:"interview-widget-container",children:o.jsx("div",{ref:p,className:`iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${a}`,children:o.jsx("div",{className:"iw-h-[calc(100vh-1rem)] iw-flex iw-flex-col iw-justify-between gap-1",children:o.jsx(e2,{interviewTitle:e??"Interview",brandName:t??"Novara",brandLogo:r,interviewId:i,className:a,onComplete:n??(()=>{}),onDisqualify:s,videoFeedRef:b})})})}):o.jsxs("div",{className:"interview-widget-container",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-space-x-2 iw-mx-auto iw-p-2 iw-max-w-[1800px]",children:[o.jsx(fn,{brandLogo:r,brandName:t}),o.jsx("p",{className:"iw-text-xl iw-font-semibold",children:t})]}),o.jsx(u1,{isOpen:h,gazeEnabled:m,onStart:y,onRequestCalibration:()=>w(!0),videoFeedRef:b,interviewId:i})]})};typeof window<"u"&&(window.InterviewWidget={InterviewWidget:js,InterviewWidgetProvider:Xs}),me.InterviewWidget=js,me.InterviewWidgetProvider=Xs,me.default=js,Object.defineProperties(me,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
179
|
+
`})})};function t1({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(e1,{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 r1=({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(ro,{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(nn,{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(rn,{onClick:()=>{r()},children:"Start Answering"})})]}),i1=({sttError:e,editingDuration:t})=>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.jsxs("p",{className:"iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]",children:["After transcription, you'll have ",t||30," 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)"]})]}),n1=({interviewTitle:e,brandName:t="Novara",brandLogo:r,interviewId:i,onComplete:n,onDisqualify:s,className:a="",videoFeedRef:c})=>{var ln,li;const l=bl(),{baseUrl:h,authToken:u}=to(),{timers:f,stt:w,proctoring:g}=mn(),p=d.useRef(null),[y,m]=d.useState(null),[b,v]=d.useState(""),[I,C]=d.useState(null),[S,A]=d.useState(hi),[M,F]=d.useState(!0),D=d.useRef(""),G=d.useRef(null),Y={thinkingTime:(f==null?void 0:f.thinkingDuration)||0,answeringTime:(f==null?void 0:f.answeringDuration)||120,editingTime:M?(f==null?void 0:f.editingDuration)||30:0},{thinkingTime:H,answeringTime:q,editingTime:Z}=Y;d.useEffect(()=>{D.current=b},[b]);const[O,R]=d.useState(!1),Ye=d.useRef(!1),{speak:ft,stop:Xe,error:oi}=_h({onEnd:()=>{Ye.current=!1,me()},onError:()=>{Ye.current||(Ye.current=!0,me())}}),ke=d.useRef(!1),Lt=d.useRef(!1),{startRecording:Mt,stopRecording:Tr,transcribe:Nr,cancelRecording:Ir,isRecording:Fr,error:Lr,audioBlob:rt}=bh({config:{baseUrl:h,provider:w==null?void 0:w.provider,model:w==null?void 0:w.model,language:w==null?void 0:w.language,authToken:u,qnaId:((ln=G.current)==null?void 0:ln.qna_id)||"",interviewId:i},onStart:()=>{ke.current=!1,Lt.current=!1},onStop:()=>{},onTranscriptionComplete:L=>{const j=L.transcript;v(j),D.current=j,Lt.current||(Lt.current=!0,me())},onError:L=>{console.error("STT Error:",L),ke.current||(ke.current=!0,me())}}),{state:Qe,startQuestion:wt,nextPhase:me,completeInterview:Mr,timerService:Dt}=gh({config:{answeringDuration:q,editingDuration:Z},callbacks:{onPhaseChange:L=>{switch(L){case P.FETCHING_QUESTION:Dr();break;case P.READING_QUESTION:sn();break;case P.ANSWERING:ai();break;case P.TRANSCRIBING:on();break;case P.SUBMITTING:Ks();break}},onInterviewEnd:()=>{n==null||n()}}});d.useEffect(()=>{wt()},[]),d.useEffect(()=>{(async()=>{try{const j=await l.getInterviewConfig(i);if(j!=null&&j.data&&(j.data.duration_in_minutes&&A(j.data.duration_in_minutes),typeof j.data.allow_answer_editing=="boolean"&&F(j.data.allow_answer_editing),typeof j.data.elapsed_time_in_minutes=="number")){const Je=Math.floor(j.data.elapsed_time_in_minutes*60);Dt.setTotalTimeElapsed(Je)}}catch(j){console.error("Failed to fetch interview config:",j)}})()},[i,Dt]);const{execute:Dr,error:Pr}=ph(async()=>{const L=await l.generateQuestion({interviewId:i});return G.current=L.data,L},{onSuccess:async L=>{L&&L.data&&(v(""),D.current="",m(L.data),me())},onError:L=>{console.error("Failed to fetch questions:",L)}}),Ks=d.useCallback(async()=>{var L;try{const j=D.current,Je=((L=G.current)==null?void 0:L.qna_id)||"";M&&await l.submitAnswer({interviewId:i,qnaId:Je,answer:j}),C({qnaId:Je,answer:j})}catch(j){console.error("Failed to submit answer:",j)}wt()},[l,i,wt,M]),sn=d.useCallback(async()=>{var L,j;if((L=G.current)!=null&&L.question)if(G.current.question_audio_data_base64)try{Ye.current=!1,await ft(G.current.question_audio_data_base64),G.current.is_interview_done&&(Xe(),Ir(),c&&"current"in c&&((j=c.current)==null||j.stopCamera()),Mr())}catch(Je){console.error("Failed to speak question:",Je)}else console.warn("No audio data available for question"),await jl(2e3),me();else me()},[ft,me,Mr]),ai=d.useCallback(async()=>{try{await Mt(q)}catch(L){if((L==null?void 0:L.code)==="ALREADY_RECORDING"){console.warn("startRecording called while already recording — ignoring duplicate call.");return}console.error("Failed to start recording:",L),me()}},[Mt,me,q]),on=d.useCallback(async()=>{if(O){console.warn("Audio processing already in progress, ignoring duplicate call");return}R(!0);try{const L=!Fr&&rt?rt:await Tr();await Nr(L)}catch(L){console.error("STT processing failed:",L),!ke.current&&!Lt.current&&(ke.current=!0,me())}finally{R(!1)}},[O,Fr,rt,Tr,Nr,me,i,Dt]),an=d.useCallback(()=>{O||me()},[O,me]),Or=d.useCallback(async L=>{var j,Je;Xe(),Ir(),c&&"current"in c&&((j=c.current)==null||j.stopCamera()),await((Je=p.current)==null?void 0:Je.exitFullScreenIntentionally());try{await l.exitInterview(i)}catch(dn){console.error("API call failed:",dn)}finally{L==null||L(),Mr(),sessionStorage.removeItem(wn)}},[i,Xe,l]),cn=()=>{const{phase:L}=Qe;switch(L){case P.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(rn,{onClick:wt,className:"iw-mt-2 iw-w-40",children:"Start Interview"})]});case P.FETCHING_QUESTION:return Pr?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-red-600 iw-mb-1",children:"Failed to load the next question"}),o.jsx("p",{className:"iw-max-w-md iw-text-gray-500 iw-text-sm iw-leading-[21px]",children:Pr.message||"Please check your network connection and try again."}),o.jsx(rn,{onClick:()=>Dr(),className:"iw-mt-4 iw-w-40",children:"Retry"})]}):o.jsx(Rh,{});case P.READING_QUESTION:return o.jsx(t1,{ttsError:oi});case P.THINKING:return o.jsx(r1,{state:Qe,thinkingTime:H,nextPhase:me});case P.ANSWERING:return o.jsx(Zh,{state:Qe,answeringTime:q,nextPhase:an,sttError:Lr,disableStopButton:O});case P.TRANSCRIBING:return o.jsx(i1,{sttError:Lr,editingDuration:Z});case P.EDITING:case P.SUBMITTING:return null;case P.COMPLETED:return null;default:return null}},ci=o.jsxs(o.Fragment,{children:[o.jsx(Xh,{title:e,brandName:t,brandLogo:r,totalDuration:S,elapsedTime:Qe.totalTimeElapsed,onExit:()=>Or()}),o.jsx(qh,{brandName:t,brandLogo:r,currentQuestion:y,state:Qe,phase:Qe.phase,className:a,interviewId:i,interview_duration:S,videoFeedRef:c,lastSubmittedAnswer:I,onNextPhase:Qe.phase===P.ANSWERING?an:me,answerText:b,onAnswerChange:L=>{const j=L.target.value;v(j),D.current=j},editingTime:Z,answeringTime:q,disableSubmitButton:Qe.phase===P.ANSWERING&&O,children:cn()})]});return o.jsx(o.Fragment,{children:g!=null&&g.enabled?o.jsx(Wh,{ref:p,onDisqualify:()=>Or(s),isCompleted:((li=G==null?void 0:G.current)==null?void 0:li.is_interview_done)??!1,children:ci}):ci})},qs=({title:e,brandName:t,brandLogo:r,interviewId:i,onInterviewEnd:n,onInterviewDisqualify:s,className:a=""})=>{const[c,l]=d.useState(!1),[h,u]=d.useState(!0),[f,w]=d.useState(!1),{proctoring:g}=mn(),p=d.useRef(null),y=d.useRef(null),m=(g==null?void 0:g.gazeAnalysisEnabled)===!0,b=()=>{l(!0),u(!1)};return d.useEffect(()=>{if(c&&f&&y.current&&m)try{y.current.setReference()}finally{w(!1)}},[c,f,m]),c?o.jsx("div",{className:"interview-widget-container",children:o.jsx("div",{ref:p,className:`iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${a}`,children:o.jsx("div",{className:"iw-h-[calc(100vh-1rem)] iw-flex iw-flex-col iw-justify-between gap-1",children:o.jsx(n1,{interviewTitle:e??"Interview",brandName:t??"Novara",brandLogo:r,interviewId:i,className:a,onComplete:n??(()=>{}),onDisqualify:s,videoFeedRef:y})})})}):o.jsxs("div",{className:"interview-widget-container",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-space-x-2 iw-mx-auto iw-p-2 iw-max-w-[1800px]",children:[o.jsx(bn,{brandLogo:r,brandName:t}),o.jsx("p",{className:"iw-text-xl iw-font-semibold",children:t})]}),o.jsx(fh,{isOpen:h,gazeEnabled:m,onStart:b,onRequestCalibration:()=>w(!0),videoFeedRef:y,interviewId:i})]})};typeof window<"u"&&(window.InterviewWidget={InterviewWidget:qs,InterviewWidgetProvider:eo}),be.InterviewWidget=qs,be.InterviewWidgetProvider=eo,be.default=qs,Object.defineProperties(be,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|