interview-widget 3.0.8 → 3.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/interview/proctoring/gaze-detection/utils/types.d.ts +1 -1
- package/dist/components/interview/proctoring/interview-proctoring.d.ts +10 -0
- package/dist/components/media/video-feed.d.ts +1 -0
- package/dist/components/modals/gaze-warning-modal.d.ts +2 -1
- package/dist/components/modals/onboarding-media-controls.d.ts +1 -0
- package/dist/components/ui/media-control-item.d.ts +8 -0
- package/dist/components/ui/standalone-dialog.d.ts +13 -0
- package/dist/components/warnings/status-overlay.d.ts +4 -0
- package/dist/services/timer/timer-service.d.ts +4 -0
- package/dist/types.d.ts +2 -1
- package/dist/widget.css +1 -1
- package/dist/widget.es.js +3356 -3355
- package/dist/widget.umd.js +6 -6
- package/package.json +3 -2
package/dist/widget.umd.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
(function(he,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):(he=typeof globalThis<"u"?globalThis:he||self,o(he.InterviewWidget={},he.jsxRuntime,he.React,he.ReactDOM))})(this,function(he,o,u,pl){"use strict";var tu=Object.defineProperty;var ru=(he,o,u)=>o in he?tu(he,o,{enumerable:!0,configurable:!0,writable:!0,value:u}):he[o]=u;var Me=(he,o,u)=>ru(he,typeof o!="symbol"?o+"":o,u);var tn=typeof document<"u"?document.currentScript:null;const rn={},Ke={api:{baseUrl:"/api",retryConfig:{attempts:3,backoff:"exponential",baseDelay:1e3}},ui:{baseColor:"#3B82F6",borderRadius:"8px"},interview:{allow_answer_editing:!0,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}}},nn="iw-storage";function ml(){if(!(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:tn&&tn.tagName.toUpperCase()==="SCRIPT"&&tn.src||new URL("widget.umd.js",document.baseURI).href}<"u"&&(rn!=null&&rn.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 Gs=ml(),oi=30,yl={SCREENSHOT:"screenshot"},sn="AES-GCM",on=12;async function Vs(e){const r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return crypto.subtle.importKey("raw",i,sn,!1,["encrypt","decrypt"])}function bl(){return crypto.getRandomValues(new Uint8Array(on))}async function vl(e,t="default-seed"){try{const r=typeof e=="string"?e:JSON.stringify(e),n=new TextEncoder().encode(r),s=await Vs(t),a=bl(),c=await crypto.subtle.encrypt({name:sn,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 xl(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,on),s=i.slice(on),a=await Vs(t),c=await crypto.subtle.decrypt({name:sn,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 El(e,t="default-seed"){return vl(e,t)}async function kl(e,t="default-seed"){const r=await xl(e,t);try{return JSON.parse(r)}catch{return r}}const Ir=u.createContext(null),_l=async()=>{try{const e=sessionStorage.getItem(nn);if(e){const r=(await kl(e,Gs)).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}}},Fr=async e=>{try{const t=await El({state:e,version:0},Gs);sessionStorage.setItem(nn,t)}catch(t){console.error("Failed to save proctoring data to session storage:",t)}},Nl=({children:e})=>{const t=u.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=u.useRef(new Set);u.useEffect(()=>{_l().then(w=>{t.current=w,i()})},[]);const i=u.useCallback(()=>{r.current.forEach(w=>w())},[]),n=u.useCallback(w=>(r.current.add(w),()=>{r.current.delete(w)}),[]),s=u.useCallback(()=>t.current,[]),a=u.useCallback(w=>{t.current={...t.current,logViolations:[...t.current.logViolations,w],totalViolations:t.current.totalViolations+1},Fr(t.current),i()},[i]),c=u.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},Fr(t.current),i()},[i]),l=u.useCallback(()=>{t.current={...t.current,logViolations:[],totalViolations:0},Fr(t.current),i()},[i]),h=u.useCallback(()=>{t.current={...t.current,gazeViolationCounters:{lookingAwayCount:0,noFaceDetectedCount:0,multipleFacesCount:0,totalGazeViolations:0}},Fr(t.current),i()},[i]),d=u.useCallback((w,g)=>{t.current={...t.current,referenceSet:w,referenceRef:g},Fr(t.current),i()},[i]),f=u.useMemo(()=>({getState:s,addViolation:a,clearViolations:l,subscribe:n,incrementGazeViolation:c,clearGazeViolationCounters:h,setReferenceData:d}),[s,a,l,n,c,h,d]);return o.jsx(Ir.Provider,{value:f,children:e})},js=()=>{const e=u.useContext(Ir);if(!e)throw new Error("useProctoringStore must be used within a ProctoringProvider");const t=u.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}},Tl=()=>{const e=u.useContext(Ir);if(!e)throw new Error("useViolations must be used within a ProctoringProvider");return u.useSyncExternalStore(e.subscribe,()=>e.getState().logViolations,()=>e.getState().logViolations)},Sl=()=>{const e=u.useContext(Ir);if(!e)throw new Error("useTotalViolations must be used within a ProctoringProvider");return u.useSyncExternalStore(e.subscribe,()=>e.getState().totalViolations,()=>e.getState().totalViolations)},Al=()=>{const e=u.useContext(Ir);if(!e)throw new Error("useProctoringActions must be used within a ProctoringProvider");return{addViolation:e.addViolation,clearViolations:e.clearViolations}},Ws=u.createContext(null);function $s({config:e={},children:t}){var i,n,s,a;const r={api:{...Ke.api,...e.api,retryConfig:{...Ke.api.retryConfig,...(i=e.api)==null?void 0:i.retryConfig}},ui:{...Ke.ui,...e.ui},interview:{...Ke.interview,...e.interview,timers:{...Ke.interview.timers,...(n=e.interview)==null?void 0:n.timers},stt:{...Ke.interview.stt,...(s=e.interview)==null?void 0:s.stt},tts:{...Ke.interview.tts,...(a=e.interview)==null?void 0:a.tts}}};return o.jsx(Ws.Provider,{value:r,children:o.jsx(Nl,{children:t})})}function ai(){const e=u.useContext(Ws);if(!e)throw new Error("useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>");return e}function zs(){return ai().api||Ke.api}function ci(){return ai().ui||Ke.ui}function an(){return ai().interview||Ke.interview}function Cl(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 Il(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 Fl(e,t){const r=Cl(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 Il(i,n,s)}function Ll(e){return new Promise(t=>setTimeout(t,e))}function Ml(e){return`linear-gradient(to left, ${Fl(e,.4)}, ${e})`}const Pl=()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);function Dl(e){try{const t=e.split(".");if(t.length!==3||!t[1])throw new Error("Invalid JWT token");const i=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=i.padEnd(i.length+(4-i.length%4)%4,"="),s=atob(n);return JSON.parse(s)}catch(t){return console.error("Error decoding JWT:",t),null}}const Ol=e=>{var t;return!e||typeof e!="string"?"":(t=e.charAt(0))==null?void 0:t.toUpperCase()},cn=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}`},ln=({brandLogo:e,brandName:t,className:r="",showFallbackStyles:i=!0})=>{const{baseColor:n}=ci();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:Ol(t)})},Lr=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"})]}),Bl=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})]}),Ul=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"})]}),li=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"})}),Hs=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"})]}),Gl=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M12 6v6l4 2"}),o.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),qs=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"})}),Ks=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"})]}),Vl=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("circle",{cx:"12",cy:"12",r:"3"}),o.jsx("path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}),o.jsx("path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}),o.jsx("path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}),o.jsx("path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"})]}),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"})]}),dn=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("circle",{cx:"12",cy:"12",r:"3"}),o.jsx("path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}),o.jsx("path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}),o.jsx("path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}),o.jsx("path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"})]}),Ys=({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"})]})}),Wl=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"})]}),$l=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:"M2 2L22 22",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M4 11C4 15.4183 7.58172 19 12 19M12 19C13.9545 19 15.7454 18.2991 17.1348 17.1348M12 19V22M12 22H15M12 22H9M20 11C20 12.6514 19.4996 14.1859 18.6422 15.4603",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M7 6.98V11C7 13.7614 9.23858 16 12 16C13.1354 16 14.1647 15.6096 15.004 14.972M16.4387 13.244C16.7973 12.5545 17 11.8309 17 11V6.98C17 4.21858 14.7614 2 12 2C10.1312 2 8.53009 2.96527 7.672 4.484",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round"})]}),zl=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}),o.jsx("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),o.jsx("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]}),Hl=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("circle",{cx:"12",cy:"12",r:"3"}),o.jsx("path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}),o.jsx("path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}),o.jsx("path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}),o.jsx("path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"})]}),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:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]}),Kl=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})]}),Yl=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})]}),Xl=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"})]}),Ql=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:"M2.00195 2L21.9773 22",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M16.8517 16.8668C16.7225 17.8052 16.4666 18.4659 15.9596 18.9735C14.9357 19.9987 13.2878 19.9987 9.99206 19.9987H8.99329C5.69755 19.9987 4.04967 19.9987 3.02581 18.9735C2.00195 17.9484 2.00195 16.2985 2.00195 12.9987V10.9987C2.00195 7.69885 2.00195 6.04893 3.02581 5.0238C3.36833 4.68086 3.78068 4.45265 4.3012 4.30078",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M8.23633 4.00052C8.47821 4 8.73001 4 8.99223 4H9.99099C13.2868 4 14.9347 4 15.9585 5.02513C16.9823 6.05025 16.9823 7.70017 16.9823 11V12.7574M16.9823 9.23142L19.3019 7.52913C20.773 6.54073 21.449 7.17196 21.6675 7.64847C22.1192 8.92813 21.9769 11.3936 21.9769 14.5417C21.8704 16.555 21.5953 16.7719 21.3138 16.9939L21.3108 16.9962",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Mr={FACE_DETECTED:"face_detected",NO_FACE:"no_face_detected",MULTIPLE_FACES:"multiple_faces",LOOKING_AWAY:"looking_away",CAMERA_ERROR:"camera_error"},Xs={[Mr.FACE_DETECTED]:{icon:Ks,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"},[Mr.NO_FACE]:{icon:Ul,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"},[Mr.MULTIPLE_FACES]:{icon:Yl,iconColor:"iw-text-red-600",iconBg:"iw-bg-red-50",iconBorder:"iw-border-red-100",title:"Multiple People Detected",subtitle:"More than one person is visible",description:"For interview integrity, please ensure you are alone in the room and only your face is visible to the camera.",buttonText:"I Understood"},[Mr.LOOKING_AWAY]:{icon:Kl,iconColor:"iw-text-amber-600",iconBg:"iw-bg-amber-50",iconBorder:"iw-border-amber-200/75",title:"Stay Focused",subtitle:"We noticed you looked away from the screen",description:"To ensure interview integrity, please keep your attention on the screen throughout the session.",buttonText:"I Understood"},[Mr.CAMERA_ERROR]:{icon:Lr,iconColor:"iw-text-red-600",iconBg:"iw-bg-red-50",iconBorder:"iw-border-red-100",title:"Camera Issue",subtitle:"There's a problem with your camera",description:"Please check your camera connection and permissions, then refresh the page to continue.",buttonText:"I Understood"}};function Jl(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 gt(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=Jl(s);if(!a.retryable||n===r.attempts)throw a;const c=Zl(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 Zl(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 pt={v2:"/v2"},mt={GENERATE_QUESTION:e=>`${pt.v2}/interviews/${e}/next-question`,SCREENSHOT_UPLOAD:e=>`${pt.v2}/interviews/${e}/assets/upload-url`,CONFIRM_UPLOAD:e=>`${pt.v2}/interviews/assets/${e}/confirm`,TRANSCRIBE_ANSWER:e=>`${pt.v2}/interviews/${e}/transcribe-answer`,SUBMIT_ANSWER:e=>`${pt.v2}/interviews/${e}/submit-answer`,EXIT:e=>`${pt.v2}/interviews/${e}/exit`,CONFIG:e=>`${pt.v2}/interviews/${e}/config`,TRANSCRIPTION:e=>`${pt.v2}/interviews/${e}/transcript`};class Qs{constructor(t={}){Me(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 gt(`${this.getBaseUrl()}${mt.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 gt(`${this.getBaseUrl()}${mt.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 gt(`${this.getBaseUrl()}${mt.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 gt(`${this.getBaseUrl()}${mt.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 gt(`${this.getBaseUrl()}${mt.SCREENSHOT_UPLOAD(t)}`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({filename:r,mime_type:"image/jpeg",asset_type:yl.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 gt(`${this.getBaseUrl()}${mt.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 gt(`${this.getBaseUrl()}${mt.TRANSCRIPTION(t)}`,{method:"GET",headers:{...this.getHeaders(),"x-auth-token":"interview-engine-api-key"}});if(!r.ok)throw new Error(`Failed to get interview transcription: ${r.status}`);return await r.json()}}const Rl=new Qs,ed=({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."]})]})}),td=({showControls:e,isBubbleOpen:t,setIsBubbleOpen:r,setReference:i,clearCache:n,isModelLoaded:s,gazeAnalysisEnabled:a,referenceSet:c,showLandmarks:l,setShowLandmarks:h,showEngagementBar:d,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(Bl,{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:b=>w(b.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:b=>h(b.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:d,onChange:b=>f(b.target.checked),disabled:!a}),"Show Engagement Bar"]})]}),c&&o.jsx(ed,{gazeAnalysisEnabled:a,isModelLoaded:s,loadingProgress:y,stats:g,statusMessage:p})]})]}):null;var Jt=typeof self<"u"?self:{};function Pr(e,t){e:{for(var r=["CLOSURE_FLAGS"],i=Jt,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 Lt(){throw Error("Invalid UTF8")}function Js(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let di,un;const rd=typeof TextDecoder<"u";let id;const nd=typeof TextEncoder<"u";function Zs(e){if(nd)e=(id||(id=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 Rs(e){Jt.setTimeout(()=>{throw e},0)}var hn,sd=Pr(610401301,!1),eo=Pr(748402147,!0),fn=Pr(824648567,!0),wn=Pr(824656860,Pr(1,!0));function to(){var e=Jt.navigator;return e&&(e=e.userAgent)?e:""}const ro=Jt.navigator;function ui(e){return ui[" "](e),e}hn=ro&&ro.userAgentData||null,ui[" "]=function(){};const io={};let Dr=null;function od(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 d=s.charAt(l++),f=Dr[d];if(f!=null)return f;if(!/^[\s\xa0]*$/.test(d))throw Error("Unknown base64 encoding at char: "+d)}return h}no();let l=0;for(;;){const h=c(-1),d=c(0),f=c(64),w=c(64);if(w===64&&h===-1)break;a(h<<2|d>>4),f!=64&&(a(d<<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 no(){if(!Dr){Dr={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const i=e.concat(t[r].split(""));io[r]=i;for(let n=0;n<i.length;n++){const s=i[n];Dr[s]===void 0&&(Dr[s]=n)}}}}var ad=typeof Uint8Array<"u",so=!(!(sd&&hn&&hn.brands.length>0)&&(to().indexOf("Trident")!=-1||to().indexOf("MSIE")!=-1))&&typeof btoa=="function";const oo=/[-_.]/g,cd={"-":"+",_:"/",".":"="};function ld(e){return cd[e]||""}function ao(e){if(!so)return od(e);e=oo.test(e)?e.replace(oo,ld):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 gn(e){return ad&&e!=null&&e instanceof Uint8Array}var Zt={};function Mt(){return dd||(dd=new Ye(null,Zt))}function pn(e){co(Zt);var t=e.g;return(t=t==null||gn(t)?t:typeof t=="string"?ao(t):null)==null?t:e.g=t}var Ye=class{h(){return new Uint8Array(pn(this)||0)}constructor(e,t){if(co(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let dd,ud;function co(e){if(e!==Zt)throw Error("illegal external caller")}function lo(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function mn(e){return lo(e=Error(e),"warning"),e}function Rt(e,t){if(e!=null){var r=ud??(ud={}),i=r[e]||0;i>=t||(r[e]=i+1,lo(e=Error(),"incident"),Rs(e))}}function er(){return typeof BigInt=="function"}var tr=typeof Symbol=="function"&&typeof Symbol()=="symbol";function Xe(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 hd=Xe("jas",void 0,!0),uo=Xe(void 0,"0di"),Or=Xe(void 0,"1oa"),xe=Xe(void 0,Symbol()),fd=Xe(void 0,"0ub"),wd=Xe(void 0,"0ubs"),yn=Xe(void 0,"0ubsb"),gd=Xe(void 0,"0actk"),rr=Xe("m_m","Pa",!0),ho=Xe();const fo={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},wo=Object.defineProperties,x=tr?hd:"Ga";var Pt;const go=[];function Br(e,t){tr||x in e||wo(e,fo),e[x]|=t}function se(e,t){tr||x in e||wo(e,fo),e[x]=t}function Ur(e){return Br(e,34),e}function Gr(e){return Br(e,8192),e}se(go,7),Pt=Object.freeze(go);var ir={};function Ee(e,t){return t===void 0?e.h!==Dt&&!!(2&(0|e.v[x])):!!(2&t)&&e.h!==Dt}const Dt={};function bn(e,t){if(e!=null){if(typeof e=="string")e=e?new Ye(e,Zt):Mt();else if(e.constructor!==Ye)if(gn(e))e=e.length?new Ye(new Uint8Array(e),Zt):Mt();else{if(!t)throw Error();e=void 0}}return e}class po{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 pd=Object.freeze({});function mo(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 yo={};function nr(e){return 128&e?yo:void 0}function hi(e){return e.Na=!0,e}var md=hi(e=>typeof e=="number"),bo=hi(e=>typeof e=="string"),yd=hi(e=>typeof e=="boolean"),fi=typeof Jt.BigInt=="function"&&typeof Jt.BigInt(0)=="bigint";function ke(e){var t=e;if(bo(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(md(t)&&!Number.isSafeInteger(t))throw Error(String(t));return fi?BigInt(e):e=yd(e)?e?"1":"0":bo(e)?e.trim()||"0":String(e)}var vn=hi(e=>fi?e>=vd&&e<=Ed:e[0]==="-"?vo(e,bd):vo(e,xd));const bd=Number.MIN_SAFE_INTEGER.toString(),vd=fi?BigInt(Number.MIN_SAFE_INTEGER):void 0,xd=Number.MAX_SAFE_INTEGER.toString(),Ed=fi?BigInt(Number.MAX_SAFE_INTEGER):void 0;function vo(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 kd=typeof Uint8Array.prototype.slice=="function";let _d,H=0,te=0;function xo(e){const t=e>>>0;H=t,te=(e-t)/4294967296>>>0}function sr(e){if(e<0){xo(-e);const[t,r]=Nn(H,te);H=t>>>0,te=r>>>0}else xo(e)}function xn(e){const t=_d||(_d=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),te=0,H=t.getUint32(0,!0)}function En(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Vr(e,t)}function Nd(e,t){return ke(er()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):Vr(e,t))}function kn(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=En(e,t))=="number"?r?-e:e:r?"-"+e:e}function Eo(e,t){return er()?ke(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):ke(_n(e,t))}function Vr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else er()?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+ko(r)+ko(e));return r}function ko(e){return e=String(e),"0000000".slice(e.length)+e}function _n(e,t){if(2147483648&t)if(er())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,i]=Nn(e,t);e="-"+Vr(r,i)}else e=Vr(e,t);return e}function wi(e){if(e.length<16)sr(Number(e));else if(er())e=BigInt(e),H=Number(e&BigInt(4294967295))>>>0,te=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");te=H=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));te*=1e6,H=1e6*H+s,H>=4294967296&&(te+=Math.trunc(H/4294967296),te>>>=0,H>>>=0)}if(t){const[i,n]=Nn(H,te);H=i,te=n}}}function Nn(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function We(e){return Array.prototype.slice.call(e)}const jr=typeof BigInt=="function"?BigInt.asIntN:void 0,Td=typeof BigInt=="function"?BigInt.asUintN:void 0,Ot=Number.isSafeInteger,gi=Number.isFinite,or=Math.trunc,Sd=ke(0);function Wr(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 Qe(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function $r(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 _o(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const Ad=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function zr(e){switch(typeof e){case"bigint":return!0;case"number":return gi(e);case"string":return Ad.test(e);default:return!1}}function ar(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return gi(e)?0|e:void 0}function No(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return gi(e)?e>>>0:void 0}function To(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(wi(e),_n(H,te))}function Tn(e){return e=or(e),Ot(e)||(sr(e),e=kn(H,te)),e}function So(e){var t=or(Number(e));return Ot(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),To(e))}function Ao(e){var t=or(Number(e));return Ot(t)?ke(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),er()?ke(jr(64,BigInt(e))):ke(To(e)))}function Co(e){return Ot(e)?e=ke(Tn(e)):(e=or(e),Ot(e)?e=String(e):(sr(e),e=_n(H,te)),e=ke(e)),e}function Cd(e){return e==null?e:typeof e=="bigint"?(vn(e)?e=Number(e):(e=jr(64,e),e=vn(e)?Number(e):String(e)),e):zr(e)?typeof e=="number"?Tn(e):So(e):void 0}function pi(e){const t=typeof e;return e==null?e:t==="bigint"?ke(jr(64,e)):zr(e)?t==="string"?Ao(e):Co(e):void 0}function Io(e){if(typeof e!="string")throw Error();return e}function Hr(e){if(e!=null&&typeof e!="string")throw Error();return e}function fe(e){return e==null||typeof e=="string"?e:void 0}function Sn(e,t,r,i){return e!=null&&e[rr]===ir?e:Array.isArray(e)?((i=(r=0|e[x])|32&i|2&i)!==r&&se(e,i),new t(e)):(r?2&i?((e=t[uo])||(Ur((e=new t).v),e=t[uo]=e),t=e):t=new t:t=void 0,t)}function Id(e,t,r){if(t)e:{if(!zr(t=e))throw mn("int64");switch(typeof t){case"string":t=Ao(t);break e;case"bigint":t=ke(jr(64,t));break e;default:t=Co(t)}}else t=pi(e);return(e=t)==null?r?Sd:void 0:e}const Fd={};let Ld=function(){try{return ui(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class An{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 Md=Ld?(Object.setPrototypeOf(An.prototype,Map.prototype),Object.defineProperties(An.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),An):class extends Map{constructor(){super()}};function Fo(e){return e}function Cn(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var at=class extends Md{constructor(e,t,r=Fo,i=Fo){super(),this.J=0|e[x],this.K=t,this.S=r,this.fa=this.K?Pd: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 Gr(Array.from(super.entries(),e))}clear(){Cn(this),super.clear()}delete(e){return Cn(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new po(e,Dd,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new po(e,at.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 Cn(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 Pd(e,t,r,i,n,s){return e=Sn(e,i,r,s),n&&(e=Ln(e)),e}function Dd(e){return[e,this.get(e)]}let Od;function Lo(){return Od||(Od=new at(Ur([]),void 0,void 0,void 0,Fd))}function mi(e){return xe?e[xe]:void 0}function yi(e,t){for(const r in e)!isNaN(r)&&t(e,+r,e[r])}at.prototype.toJSON=void 0;var In=class{};const Bd={Ka:!0};function Ud(e,t){t<100||Rt(wd,1)}function bi(e,t,r,i){const n=i!==void 0;i=!!i;var s,a=xe;!n&&tr&&a&&(s=e[a])&&yi(s,Ud),a=[];var c=e.length;let l;s=4294967295;let h=!1;const d=!!(64&t),f=d?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,!d||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(d&&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,d&&!Number.isNaN(w)&&(p=w+f)<s?a[p]=c:(t??(t={}))[g]=c}return t&&(h?a.push(t):a[s]=t),n&&xe&&(e=mi(e))&&e instanceof In&&(a[xe]=function(g){const p=new In;return yi(g,(y,b,m)=>{p[b]=We(m)}),p.da=g.da,p}(e)),a}function Gd(e){return e[0]=qr(e[0]),e[1]=qr(e[1]),e}function qr(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return vn(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[x];return e.length===0&&1&t?void 0:bi(e,t,qr)}if(e!=null&&e[rr]===ir)return Mo(e);if(e instanceof Ye){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(so){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),no(),r=io[r],i=Array(Math.floor(t.length/3)),n=r[64]||"";let h=0,d=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[d++]=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[d]=r[t>>2]+r[(3&t)<<4|l>>4]+c+n}t=i.join("")}e=e.g=t}return e}return e instanceof at?e=e.size!==0?e.V(Gd):void 0:void 0}return e}function Mo(e){return bi(e=e.v,0|e[x],qr)}let Vd,jd;function Bt(e,t){return Po(e,t[0],t[1])}function Po(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[x],eo&&1&n)throw Error("rfarr");if(2048&n&&!(2&n)&&function(){if(eo)throw Error("carr");Rt(gd,5)}(),256&n)throw Error("farr");if(64&n)return(n|i)!==n&&se(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 se(e,64|n|i),e}function Wd(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var r=0|e[x];return e.length===0&&1&r?void 0:Do(e,r,t)}if(e!=null&&e[rr]===ir)return Oo(e);if(e instanceof at){if(2&(t=e.J))return e;if(!e.size)return;if(r=Ur(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[rr]===ir?Oo(n):Array.isArray(n)?Do(n,0|n[x],!!(32&t)):void 0,i[1]=n}return r}return e instanceof Ye?e:void 0}function Do(e,t,r){return 2&t||(!r||4096&t||16&t?e=cr(e,t,!1,r&&!(16&t)):(Br(e,34),4&t&&Object.freeze(e))),e}function Fn(e,t,r){return e=new e.constructor(t),r&&(e.h=Dt),e.m=Dt,e}function Oo(e){const t=e.v,r=0|t[x];return Ee(e,r)?e:Mn(e,t,r)?Fn(e,t):cr(t,r)}function cr(e,t,r,i){return i??(i=!!(34&t)),e=bi(e,t,Wd,i),i=32,r&&(i|=2),se(e,t=16769217&t|i),e}function Ln(e){const t=e.v,r=0|t[x];return Ee(e,r)?Mn(e,t,r)?Fn(e,t,!0):new e.constructor(cr(t,r,!1)):e}function lr(e){if(e.h!==Dt)return!1;var t=e.v;return Br(t=cr(t,0|t[x]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function dr(e){if(!lr(e)&&Ee(e,0|e.v[x]))throw Error()}function Ut(e,t){t===void 0&&(t=0|e[x]),32&t&&!(4096&t)&&se(e,4096|t)}function Mn(e,t,r){return!!(2&r)||!(!(32&r)||4096&r)&&(se(t,2|r),e.h=Dt,!0)}const $d=ke(0),yt={};function W(e,t,r,i,n){if((t=ct(e.v,t,r,n))!==null||i&&e.m!==Dt)return t}function ct(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 B(e,t,r,i){dr(e),oe(e=e.v,0|e[x],t,r,i)}function oe(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[x]))>>14&1023||536870912)?i!=null&&(e[a+(n?0:-1)]={[r]:i}):e[s]=i),t)}function Gt(){return pd===void 0?2:4}function Vt(e,t,r,i,n){let s=e.v,a=0|s[x];i=Ee(e,a)?1:i,n=!!n||i===3,i===2&&lr(e)&&(s=e.v,a=0|s[x]);let c=(e=Pn(s,t))===Pt?7:0|e[x],l=Dn(c,a);var h=!(4&l);if(h){4&l&&(e=We(e),c=0,l=Wt(l,a),a=oe(s,a,t,e));let d=0,f=0;for(;d<e.length;d++){const w=r(e[d]);w!=null&&(e[f++]=w)}f<d&&(e.length=f),r=-513&(4|l),l=r&=-1025,l&=-4097}return l!==c&&(se(e,l),2&l&&Object.freeze(e)),Bo(e,l,s,a,t,i,h,n)}function Bo(e,t,r,i,n,s,a,c){let l=t;return s===1||s===4&&(2&t||!(16&t)&&32&i)?jt(t)||((t|=!e.length||a&&!(4096&t)||32&i&&!(4096&t||16&t)?2:256)!==l&&se(e,t),Object.freeze(e)):(s===2&&jt(t)&&(e=We(e),l=0,t=Wt(t,i),i=oe(r,i,n,e)),jt(t)||(c||(t|=16),t!==l&&se(e,t))),2&t||!(4096&t||16&t)||Ut(r,i),e}function Pn(e,t,r){return e=ct(e,t,r),Array.isArray(e)?e:Pt}function Dn(e,t){return 2&t&&(e|=2),1|e}function jt(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Uo(e){return bn(e,!0)}function Go(e){e=We(e);for(let t=0;t<e.length;t++){const r=e[t]=We(e[t]);Array.isArray(r[1])&&(r[1]=Ur(r[1]))}return Gr(e)}function bt(e,t,r,i){dr(e),oe(e=e.v,0|e[x],t,(i==="0"?Number(r)===0:r===i)?void 0:r)}function ur(e,t,r){if(2&t)throw Error();const i=nr(t);let n=Pn(e,r,i),s=n===Pt?7:0|n[x],a=Dn(s,t);return(2&a||jt(a)||16&a)&&(a===s||jt(a)||se(n,a),n=We(n),s=0,a=Wt(a,t),oe(e,t,r,n,i)),a&=-13,a!==s&&se(n,a),n}function On(e,t){var r=Ha;return Un(Bn(e=e.v),e,void 0,r)===t?t:-1}function Bn(e){if(tr)return e[Or]??(e[Or]=new Map);if(Or in e)return e[Or];const t=new Map;return Object.defineProperty(e,Or,{value:t}),t}function Vo(e,t,r,i,n){const s=Bn(e),a=Un(s,e,t,r,n);return a!==i&&(a&&(t=oe(e,t,a,void 0,n)),s.set(r,i)),t}function Un(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];ct(t,c,n)!=null&&(s!==0&&(r=oe(t,r,s,void 0,n)),s=c)}return e.set(i,s),s}function Gn(e,t,r){let i=0|e[x];const n=nr(i),s=ct(e,r,n);let a;if(s!=null&&s[rr]===ir){if(!Ee(s))return lr(s),s.v;a=s.v}else Array.isArray(s)&&(a=s);if(a){const c=0|a[x];2&c&&(a=cr(a,c))}return a=Bt(a,t),a!==s&&oe(e,i,r,a,n),a}function jo(e,t,r,i,n){let s=!1;if((i=ct(e,i,n,a=>{const c=Sn(a,r,!1,t);return s=c!==a&&c!=null,c}))!=null)return s&&!Ee(i)&&Ut(e,t),i}function D(e,t,r,i){let n=e.v,s=0|n[x];if((t=jo(n,s,t,r,i))==null)return t;if(s=0|n[x],!Ee(e,s)){const a=Ln(t);a!==t&&(lr(e)&&(n=e.v,s=0|n[x]),s=oe(n,s,r,t=a,i),Ut(n,s))}return t}function Wo(e,t,r,i,n,s,a,c){var l=Ee(e,r);s=l?1:s,a=!!a||s===3,l=c&&!l,(s===2||l)&&lr(e)&&(r=0|(t=e.v)[x]);var h=(e=Pn(t,n))===Pt?7:0|e[x],d=Dn(h,r);if(c=!(4&d)){var f=e,w=r;const g=!!(2&d);g&&(w|=2);let p=!g,y=!0,b=0,m=0;for(;b<f.length;b++){const S=Sn(f[b],i,!1,w);if(S instanceof i){if(!g){const I=Ee(S);p&&(p=!I),y&&(y=I)}f[m++]=S}}m<b&&(f.length=m),d|=4,d=y?-4097&d:4096|d,d=p?8|d:-9&d}if(d!==h&&(se(e,d),2&d&&Object.freeze(e)),l&&!(8&d||!e.length&&(s===1||s===4&&(2&d||!(16&d)&&32&r)))){for(jt(d)&&(e=We(e),d=Wt(d,r),r=oe(t,r,n,e)),i=e,l=d,h=0;h<i.length;h++)(f=i[h])!==(d=Ln(f))&&(i[h]=d);l|=8,se(e,d=l=i.length?4096|l:-4097&l)}return Bo(e,d,t,r,n,s,c,a)}function lt(e,t,r){const i=e.v;return Wo(e,i,0|i[x],t,r,Gt(),!1,!0)}function $o(e){return e==null&&(e=void 0),e}function N(e,t,r,i,n){return B(e,r,i=$o(i),n),i&&!Ee(i)&&Ut(e.v),e}function Kr(e,t,r,i){e:{var n=i=$o(i);dr(e);const s=e.v;let a=0|s[x];if(n==null){const c=Bn(s);if(Un(c,s,a,r)!==t)break e;c.set(r,0)}else a=Vo(s,a,r,t);oe(s,a,t,n)}i&&!Ee(i)&&Ut(e.v)}function Wt(e,t){return-273&(2&t?2|e:-3&e)}function Vn(e,t,r,i){var n=i;dr(e),e=Wo(e,i=e.v,0|i[x],r,t,2,!0),n=n??new r,e.push(n),t=r=e===Pt?7:0|e[x],(n=Ee(n))?(r&=-9,e.length===1&&(r&=-4097)):r|=4096,r!==t&&se(e,r),n||Ut(i)}function Pe(e,t,r){return ar(W(e,t,void 0,r))}function zo(e){return(wn?W(e,2,void 0,void 0,pi):pi(W(e,2)))??$d}function J(e,t){return W(e,t,void 0,void 0,Qe)??0}function dt(e,t,r){if(r!=null){if(typeof r!="number"||!gi(r))throw mn("int32");r|=0}B(e,t,r)}function _(e,t,r){B(e,t,Wr(r))}function _e(e,t,r){bt(e,t,Hr(r),"")}function vi(e,t,r){{dr(e);const a=e.v;let c=0|a[x];if(r==null)oe(a,c,t);else{var i=e=r===Pt?7:0|r[x],n=jt(e),s=n||Object.isFrozen(r);for(n||(e=0),s||(r=We(r),i=0,e=Wt(e,c),s=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(wn?1024:0),n=0;n<r.length;n++){const l=r[n],h=Io(l);Object.is(l,h)||(s&&(r=We(r),i=0,e=Wt(e,c),s=!1),r[n]=h)}e!==i&&(s&&(r=We(r),e=Wt(e,c)),se(r,e)),oe(a,c,t,r)}}}function xi(e,t,r){dr(e),Vt(e,t,fe,2,!0).push(Io(r))}var hr=class{constructor(e,t,r){if(this.buffer=e,r&&!t)throw Error();this.g=t}};function jn(e,t){if(typeof e=="string")return new hr(ao(e),t);if(Array.isArray(e))return new hr(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new hr(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new hr(e,!1);if(e.constructor===Ye)return t=pn(e)||new Uint8Array(0),new hr(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new hr(e,!1);throw Error()}function fr(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($t(e,c),!(128&r))return t(i>>>0,n>>>0);throw Error()}function Wn(e){let t=0,r=e.g;const i=r+10,n=e.h;for(;r<i;){const s=n[r++];if(t|=s,(128&s)==0)return $t(e,r),!!(127&t)}throw Error()}function vt(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 $t(e,r),n}function ut(e){return vt(e)>>>0}function Ei(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],$t(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 zd(e){return vt(e)}function $t(e,t){if(e.g=t,t>e.l)throw Error()}function Ho(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 qo(e,t){if(t==0)return Mt();var r=Ho(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):kd?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Mt():new Ye(r,Zt)}var Ko=[];function Yo(e,t,r,i){if(Ni.length){const n=Ni.pop();return n.o(i),n.g.init(e,t,r,i),n}return new Hd(e,t,r,i)}function Xo(e){e.g.clear(),e.l=-1,e.h=-1,Ni.length<100&&Ni.push(e)}function Qo(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var r=ut(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5)||t<1)throw Error();return e.l=t,e.h=r,!0}function ki(e){switch(e.h){case 0:e.h!=0?ki(e):Wn(e.g);break;case 1:$t(e=e.g,e.g+8);break;case 2:if(e.h!=2)ki(e);else{var t=ut(e.g);$t(e=e.g,e.g+t)}break;case 5:$t(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!Qo(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}ki(e)}break;default:throw Error()}}function Yr(e,t,r){const i=e.g.l;var n=ut(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 $n(e){var t=ut(e.g),r=Ho(e=e.g,t);if(e=e.h,rd){var i,n=e;(i=un)||(i=un=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(di===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),di=!0}catch{di=!1}}throw!di&&(un=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?Lt():(c=e[s++],a<194||(192&c)!=128?(s--,Lt()):r.push((31&a)<<6|63&c)):a<240?s>=t-1?Lt():(c=e[s++],(192&c)!=128||a===224&&c<160||a===237&&c>=160||(192&(i=e[s++]))!=128?(s--,Lt()):r.push((15&a)<<12|(63&c)<<6|63&i)):a<=244?s>=t-2?Lt():(c=e[s++],(192&c)!=128||c-144+(a<<28)>>30||(192&(i=e[s++]))!=128||(192&(n=e[s++]))!=128?(s--,Lt()):(a=(7&a)<<18|(63&c)<<12|(63&i)<<6|63&n,a-=65536,r.push(55296+(a>>10&1023),56320+(1023&a)))):Lt(),r.length>=8192&&(l=Js(l,r),r.length=0)}s=Js(l,r)}return s}function Jo(e){const t=ut(e.g);return qo(e.g,t)}function _i(e,t,r){var i=ut(e.g);for(i=e.g.g+i;e.g.g<i;)r.push(t(e.g))}var Hd=class{constructor(e,t,r,i){if(Ko.length){const n=Ko.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=jn(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}},Ni=[];function Zo(e){return e?/^\d+$/.test(e)?(wi(e),new zn(H,te)):null:qd||(qd=new zn(0,0))}var zn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let qd;function Ro(e){return e?/^-?\d+$/.test(e)?(wi(e),new Hn(H,te)):null:Kd||(Kd=new Hn(0,0))}var Hn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Kd;function wr(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 gr(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Ti(e,t){if(t>=0)gr(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function qn(e){var t=H;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 pr(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function De(e,t,r){gr(e.g,8*t+r)}function Kn(e,t){return De(e,t,2),t=e.g.end(),pr(e,t),t.push(e.h),t}function Yn(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 Si(e,t,r){De(e,t,2),gr(e.g,r.length),pr(e,e.g.end()),pr(e,r)}function Ai(e,t,r,i){r!=null&&(t=Kn(e,t),i(r,e),Yn(e,t))}function Je(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Xn=Je(),ea=Je(),Qn=Je(),Jn=Je(),ta=Je(),ra=Je(),Yd=Je(),Ci=Je(),ia=Je(),na=Je();function Ze(e,t,r){var i=e.v;xe&&xe in i&&(i=i[xe])&&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 E=class{constructor(e,t){this.v=Po(e,t,void 0,2048)}toJSON(){return Mo(this)}j(){var n;var e=I2,t=this.v,r=e.g,i=xe;if(tr&&i&&((n=t[i])==null?void 0:n[r])!=null&&Rt(fd,3),t=e.g,ho&&xe&&ho===void 0&&(i=(r=this.v)[xe])&&(i=i.da))try{i(r,t,Bd)}catch(s){Rs(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[x];return Mn(this,e,t)?Fn(this,e,!0):new this.constructor(cr(e,t,!1))}};E.prototype[rr]=ir,E.prototype.toString=function(){return this.v.toString()};var mr=class{constructor(e,t,r){this.g=e,this.h=t,e=Xn,this.l=!!e&&r===e||!1}};function Ii(e,t){return new mr(e,t,Xn)}function sa(e,t,r,i,n){Ai(e,r,ua(t,i),n)}const Xd=Ii(function(e,t,r,i,n){return e.h===2&&(Yr(e,Gn(t,i,r),n),!0)},sa),Qd=Ii(function(e,t,r,i,n){return e.h===2&&(Yr(e,Gn(t,i,r),n),!0)},sa);var Fi=Symbol(),Li=Symbol(),Zn=Symbol(),oa=Symbol(),aa=Symbol();let ca,la;function zt(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 Vd||(Vd=[0,void 0,!0]);case"number":return f>0?void 0:f===0?jd||(jd=[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,ca??(ca=s),la??(la=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 mr?f=s:(f=Xd,a--),f==null?void 0:f.l){s=i[++a],h=i;var d=a;typeof s=="function"&&(s=s(),h[d]=s),h=s}for(d=l+1,typeof(s=i[++a])=="number"&&s<0&&(d-=s,s=i[++a]);l<d;l++){const w=c[l];h?r(n,l,f,h,w):t(n,l,f,w)}}return i[e]=n}function da(e){return Array.isArray(e)?e[0]instanceof mr?e:[Qd,e]:[e,void 0]}function ua(e,t){return e instanceof E?e.v:Array.isArray(e)?Bt(e,t):void 0}function Rn(e,t,r,i){const n=r.g;e[t]=i?(s,a,c)=>n(s,a,c,i):n}function es(e,t,r,i,n){const s=r.g;let a,c;e[t]=(l,h,d)=>s(l,h,d,c||(c=zt(Li,Rn,es,i).T),a||(a=ts(i)),n)}function ts(e){let t=e[Zn];if(t!=null)return t;const r=zt(Li,Rn,es,e);return t=r.ma?(i,n)=>ca(i,n,r):(i,n)=>{for(;Qo(n)&&n.h!=4;){var s=n.l,a=r[s];if(a==null){var c=r.ba;c&&(c=c[s])&&(c=Zd(c))!=null&&(a=r[s]=c)}if(a==null||!a(n,i,s)){if(a=(c=n).m,ki(c),c.ha)var l=void 0;else l=c.g.g-a,c.g.g=a,l=qo(c.g,l);a=void 0,c=i,l&&((a=c[xe]??(c[xe]=new In))[s]??(a[s]=[])).push(l)}}return(i=mi(i))&&(i.da=r.qa[aa]),!0},e[Zn]=t,e[aa]=Jd.bind(e),t}function Jd(e,t,r,i){var n=this[Li];const s=this[Zn],a=Bt(void 0,n.T),c=mi(e);if(c){var l=!1,h=n.ba;if(h){if(n=(d,f,w)=>{if(w.length!==0)if(h[f])for(const g of w){d=Yo(g);try{l=!0,s(a,d)}finally{Xo(d)}}else i==null||i(e,f,w)},t==null)yi(c,n);else if(c!=null){const d=c[t];d&&n(c,t,d)}if(l){let d=0|e[x];if(2&d&&2048&d&&!(r!=null&&r.Ka))throw Error();const f=nr(d),w=(g,p)=>{if(ct(e,g,f)!=null){if((r==null?void 0:r.Qa)===1)return;throw Error()}p!=null&&(d=oe(e,d,g,p,f)),delete c[g]};t==null?mo(a,0|a[x],(g,p)=>{w(g,p)}):w(t,ct(a,t,f))}}}}function Zd(e){const t=(e=da(e))[0].g;if(e=e[1]){const r=ts(e),i=zt(Li,Rn,es,e).T;return(n,s,a)=>t(n,s,a,i,r)}return t}function Mi(e,t,r){e[t]=r.h}function Pi(e,t,r,i){let n,s;const a=r.h;e[t]=(c,l,h)=>a(c,l,h,s||(s=zt(Fi,Mi,Pi,i).T),n||(n=ha(i)))}function ha(e){let t=e[oa];if(!t){const r=zt(Fi,Mi,Pi,e);t=(i,n)=>fa(i,n,r),e[oa]=t}return t}function fa(e,t,r){mo(e,0|e[x],(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=da(l))[0].h;if(l=l[1]){const d=ha(l),f=zt(Fi,Mi,Pi,l).T;l=a.ma?la(f,d):(w,g,p)=>h(w,g,p,f,d)}else l=h;return a[c]=l}}(r,i);s?s(t,n,i):i<500||Rt(yn,3)}}),(e=mi(e))&&yi(e,(i,n,s)=>{for(pr(t,t.g.end()),i=0;i<s.length;i++)pr(t,pn(s[i])||new Uint8Array(0))})}const Rd=ke(0);function yr(e,t){if(Array.isArray(t)){var r=0|t[x];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&&se(t,e),2&e&&Object.freeze(t),t}}function ge(e,t,r){return new mr(e,t,r)}function br(e,t,r){return new mr(e,t,r)}function ce(e,t,r){oe(e,0|e[x],t,r,nr(0|e[x]))}var e2=Ii(function(e,t,r,i,n){if(e.h!==2)return!1;if(e=We(e=Yr(e,Bt([void 0,void 0],i),n)),n=nr(i=0|t[x]),2&i)throw Error();let s=ct(t,r,n);if(s instanceof at)2&s.J?(s=s.V(),s.push(e),oe(t,i,r,s,n)):s.Ma(e);else if(Array.isArray(s)){var a=0|s[x];8192&a||se(s,a|=8192),2&a&&(s=Go(s),oe(t,i,r,s,n)),s.push(e)}else oe(t,i,r,Gr([e]),n);return!0},function(e,t,r,i,n){if(t instanceof at)t.forEach((s,a)=>{Ai(e,r,Bt([a,s],i),n)});else if(Array.isArray(t)){for(let s=0;s<t.length;s++){const a=t[s];Array.isArray(a)&&Ai(e,r,Bt(a,i),n)}Gr(t)}});function wa(e,t,r){(t=Qe(t))!=null&&(De(e,r,5),e=e.g,xn(t),qn(e))}function ga(e,t,r){if(t=function(i){if(i==null)return i;const n=typeof i;if(n==="bigint")return String(jr(64,i));if(zr(i)){if(n==="string")return So(i);if(n==="number")return Tn(i)}}(t),t!=null&&(typeof t=="string"&&Ro(t),t!=null))switch(De(e,r,0),typeof t){case"number":e=e.g,sr(t),wr(e,H,te);break;case"bigint":r=BigInt.asUintN(64,t),r=new Hn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),wr(e.g,r.h,r.g);break;default:r=Ro(t),wr(e.g,r.h,r.g)}}function pa(e,t,r){(t=ar(t))!=null&&t!=null&&(De(e,r,0),Ti(e.g,t))}function ma(e,t,r){(t=_o(t))!=null&&(De(e,r,0),e.g.g.push(t?1:0))}function ya(e,t,r){(t=fe(t))!=null&&Si(e,r,Zs(t))}function ba(e,t,r,i,n){Ai(e,r,ua(t,i),n)}function va(e,t,r){(t=t==null||typeof t=="string"||t instanceof Ye?t:void 0)!=null&&Si(e,r,jn(t,!0).buffer)}function xa(e,t,r){return(e.h===5||e.h===2)&&(t=ur(t,0|t[x],r),e.h==2?_i(e,Ei,t):t.push(Ei(e.g)),!0)}var re=ge(function(e,t,r){return e.h===5&&(ce(t,r,Ei(e.g)),!0)},wa,Ci),t2=br(xa,function(e,t,r){if((t=yr(Qe,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&(De(i,n,5),i=i.g,xn(s),qn(i))}},Ci),rs=br(xa,function(e,t,r){if((t=yr(Qe,t))!=null&&t.length){De(e,r,2),gr(e.g,4*t.length);for(let i=0;i<t.length;i++)r=e.g,xn(t[i]),qn(r)}},Ci),r2=ge(function(e,t,r){return e.h===5&&(ce(t,r,(e=Ei(e.g))===0?void 0:e),!0)},wa,Ci),xt=ge(function(e,t,r){return fn?(e.h!==0?e=!1:(ce(t,r,fr(e.g,Eo)),e=!0),e):e.h===0&&(ce(t,r,fr(e.g,kn)),!0)},ga,ra),is=ge(function(e,t,r){return fn?(e.h!==0?t=!1:(ce(t,r,(e=fr(e.g,Eo))===Rd?void 0:e),t=!0),t):e.h===0&&(ce(t,r,(e=fr(e.g,kn))===0?void 0:e),!0)},ga,ra),i2=ge(function(e,t,r){return fn?(e.h!==0?e=!1:(ce(t,r,fr(e.g,Nd)),e=!0),e):e.h===0&&(ce(t,r,fr(e.g,En)),!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(zr(i)){if(n==="string")return n=or(Number(i)),Ot(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"))||(wi(i),i=Vr(H,te))),i;if(n==="number")return(i=or(i))>=0&&Ot(i)||(sr(i),i=En(H,te)),i}}(t),t!=null&&(typeof t=="string"&&Zo(t),t!=null))switch(De(e,r,0),typeof t){case"number":e=e.g,sr(t),wr(e,H,te);break;case"bigint":r=BigInt.asUintN(64,t),r=new zn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),wr(e.g,r.h,r.g);break;default:r=Zo(t),wr(e.g,r.h,r.g)}},Yd),le=ge(function(e,t,r){return e.h===0&&(ce(t,r,vt(e.g)),!0)},pa,Jn),Xr=br(function(e,t,r){return(e.h===0||e.h===2)&&(t=ur(t,0|t[x],r),e.h==2?_i(e,vt,t):t.push(vt(e.g)),!0)},function(e,t,r){if((t=yr(ar,t))!=null&&t.length){r=Kn(e,r);for(let i=0;i<t.length;i++)Ti(e.g,t[i]);Yn(e,r)}},Jn),vr=ge(function(e,t,r){return e.h===0&&(ce(t,r,(e=vt(e.g))===0?void 0:e),!0)},pa,Jn),Z=ge(function(e,t,r){return e.h===0&&(ce(t,r,Wn(e.g)),!0)},ma,ea),Ht=ge(function(e,t,r){return e.h===0&&(ce(t,r,(e=Wn(e.g))===!1?void 0:e),!0)},ma,ea),we=br(function(e,t,r){return e.h===2&&(e=$n(e),ur(t,0|t[x],r).push(e),!0)},function(e,t,r){if((t=yr(fe,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&Si(i,n,Zs(s))}},Qn),Et=ge(function(e,t,r){return e.h===2&&(ce(t,r,(e=$n(e))===""?void 0:e),!0)},ya,Qn),G=ge(function(e,t,r){return e.h===2&&(ce(t,r,$n(e)),!0)},ya,Qn),de=function(e,t,r=Xn){return new mr(e,t,r)}(function(e,t,r,i,n){return e.h===2&&(i=Bt(void 0,i),ur(t,0|t[x],r).push(i),Yr(e,i,n),!0)},function(e,t,r,i,n){if(Array.isArray(t)){for(let s=0;s<t.length;s++)ba(e,t[s],r,i,n);1&(e=0|t[x])||se(t,1|e)}}),R=Ii(function(e,t,r,i,n,s){if(e.h!==2)return!1;let a=0|t[x];return Vo(t,a,s,r,nr(a)),Yr(e,t=Gn(t,i,r),n),!0},ba),Ea=ge(function(e,t,r){return e.h===2&&(ce(t,r,Jo(e)),!0)},va,ia),n2=br(function(e,t,r){return(e.h===0||e.h===2)&&(t=ur(t,0|t[x],r),e.h==2?_i(e,ut,t):t.push(ut(e.g)),!0)},function(e,t,r){if((t=yr(No,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&(De(i,n,0),gr(i.g,s))}},ta),s2=ge(function(e,t,r){return e.h===0&&(ce(t,r,(e=ut(e.g))===0?void 0:e),!0)},function(e,t,r){(t=No(t))!=null&&t!=null&&(De(e,r,0),gr(e.g,t))},ta),Ne=ge(function(e,t,r){return e.h===0&&(ce(t,r,vt(e.g)),!0)},function(e,t,r){(t=ar(t))!=null&&(t=parseInt(t,10),De(e,r,0),Ti(e.g,t))},na);class o2{constructor(t,r){var i=Te;this.g=t,this.h=r,this.m=D,this.j=N,this.defaultValue=void 0,this.l=i.Oa!=null?yo:void 0}register(){ui(this)}}function Re(e,t){return new o2(e,t)}function kt(e,t){return(r,i)=>{{const s={ea:!0};i&&Object.assign(s,i),r=Yo(r,void 0,void 0,s);try{const a=new e,c=a.v;ts(t)(c,r);var n=a}finally{Xo(r)}}return n}}function Di(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}}}};fa(this.v,t,zt(Fi,Mi,Pi,e)),pr(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 ka=class extends E{constructor(e){super(e)}},_a=[0,Et,ge(function(e,t,r){return e.h===2&&(ce(t,r,(e=Jo(e))===Mt()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof E){const i=t.Ra;return void(i?(t=i(t),t!=null&&Si(e,r,jn(t,!0).buffer)):Rt(yn,3))}if(Array.isArray(t))return void Rt(yn,3)}va(e,t,r)},ia)];let ns,Na=globalThis.trustedTypes;function Ta(e){var t;return ns===void 0&&(ns=function(){let r=null;if(!Na)return r;try{const i=n=>n;r=Na.createPolicy("goog#html",{createHTML:i,createScript:i,createScriptURL:i})}catch{}return r}()),e=(t=ns)?t.createScriptURL(e):e,new class{constructor(r){this.g=r}toString(){return this.g+""}}(e)}function a2(e,...t){if(t.length===0)return Ta(e[0]);let r=e[0];for(let i=0;i<t.length;i++)r+=encodeURIComponent(t[i])+e[i+1];return Ta(r)}var Sa=[0,le,Ne,Z,-1,Xr,Ne,-1,Z],c2=class extends E{constructor(e){super(e)}},Aa=[0,Z,G,Z,Ne,-1,br(function(e,t,r){return(e.h===0||e.h===2)&&(t=ur(t,0|t[x],r),e.h==2?_i(e,zd,t):t.push(vt(e.g)),!0)},function(e,t,r){if((t=yr(ar,t))!=null&&t.length){r=Kn(e,r);for(let i=0;i<t.length;i++)Ti(e.g,t[i]);Yn(e,r)}},na),G,-1,[0,Z,-1],Ne,Z,-1],Ca=[0,3,Z,-1,2,[0,le],[0,Ne,Z],[0,G,-1],[0]],Ia=[0,G,-2],Fa=class extends E{constructor(e){super(e)}},La=[0],Ma=[0,le,Z,1,Z,-4],Te=class extends E{constructor(e){super(e,2)}},ae={};ae[336783863]=[0,G,Z,-1,le,[0,[1,2,3,4,5,6,7,8,9],R,La,R,Aa,R,Ia,R,Ma,R,Sa,R,[0,G,-2],R,[0,G,Ne],R,Ca,R,[0,Ne,-1,Z]],[0,G],Z,[0,[1,3],[2,4],R,[0,Xr],-1,R,[0,we],-1,de,[0,G,-1]],G];var Pa=[0,is,-1,Ht,-3,is,Xr,Et,vr,is,-1,Ht,vr,Ht,-2,Et];function $(e,t){xi(e,3,t)}function F(e,t){xi(e,4,t)}var ye=class extends E{constructor(e){super(e,500)}o(e){return N(this,0,7,e)}},Qr=[-1,{}],Da=[0,G,1,Qr],Oa=[0,G,we,Qr];function Oe(e,t){Vn(e,1,ye,t)}function q(e,t){xi(e,10,t)}function O(e,t){xi(e,15,t)}var Se=class extends E{constructor(e){super(e,500)}o(e){return N(this,0,1001,e)}},Ba=[-500,de,[-500,Et,-1,we,-3,[-2,ae,Z],de,_a,vr,-1,Da,Oa,de,[0,Et,Ht],Et,Pa,vr,we,987,we],4,de,[-500,G,-1,[-1,{}],998,G],de,[-500,G,we,-1,[-2,{},Z],997,we,-1],vr,de,[-500,G,we,Qr,998,we],we,vr,Da,Oa,de,[0,Et,-1,Qr],we,-2,Pa,Et,-1,Ht,[0,Ht,s2],978,Qr,de,_a];Se.prototype.g=Di(Ba);var l2=kt(Se,Ba),d2=class extends E{constructor(e){super(e)}},Ua=class extends E{constructor(e){super(e)}g(){return lt(this,d2,1)}},Ga=[0,de,[0,le,re,G,-1]],Oi=kt(Ua,Ga),u2=class extends E{constructor(e){super(e)}},h2=class extends E{constructor(e){super(e)}},ss=class extends E{constructor(e){super(e)}l(){return D(this,u2,2)}g(){return lt(this,h2,5)}},Va=kt(class extends E{constructor(e){super(e)}},[0,we,Xr,rs,[0,Ne,[0,le,-3],[0,re,-3],[0,le,-1,[0,de,[0,le,-2]]],de,[0,re,-1,G,re]],G,-1,xt,de,[0,le,re],we,xt]),ja=class extends E{constructor(e){super(e)}},xr=kt(class extends E{constructor(e){super(e)}},[0,de,[0,re,-4]]),Wa=class extends E{constructor(e){super(e)}},Jr=kt(class extends E{constructor(e){super(e)}},[0,de,[0,re,-4]]),f2=class extends E{constructor(e){super(e)}},w2=[0,le,-1,rs,Ne],$a=class extends E{constructor(e){super(e)}};$a.prototype.g=Di([0,re,-4,xt]);var g2=class extends E{constructor(e){super(e)}},p2=kt(class extends E{constructor(e){super(e)}},[0,de,[0,1,le,G,Ga],xt]),za=class extends E{constructor(e){super(e)}},m2=class extends E{constructor(e){super(e)}na(){const e=W(this,1,void 0,void 0,Uo);return e??Mt()}},y2=class extends E{constructor(e){super(e)}},Ha=[1,2],b2=kt(class extends E{constructor(e){super(e)}},[0,de,[0,Ha,R,[0,rs],R,[0,Ea],le,G],xt]),os=class extends E{constructor(e){super(e)}},qa=[0,G,le,re,we,-1],Ka=class extends E{constructor(e){super(e)}},v2=[0,Z,-1],Ya=class extends E{constructor(e){super(e)}},Bi=[1,2,3,4,5,6],Ui=class extends E{constructor(e){super(e)}g(){return W(this,1,void 0,void 0,Uo)!=null}l(){return fe(W(this,2))!=null}},Y=class extends E{constructor(e){super(e)}g(){return _o(W(this,2))??!1}},Xa=[0,Ea,G,[0,le,xt,-1],[0,i2,xt]],ie=[0,Xa,Z,[0,Bi,R,Ma,R,Aa,R,Sa,R,La,R,Ia,R,Ca],Ne],Gi=class extends E{constructor(e){super(e)}},as=[0,ie,re,-1,le],x2=Re(502141897,Gi);ae[502141897]=as;var E2=kt(class extends E{constructor(e){super(e)}},[0,[0,Ne,-1,t2,n2],w2]),Qa=class extends E{constructor(e){super(e)}},Ja=class extends E{constructor(e){super(e)}},cs=[0,ie,re,[0,ie],Z],k2=Re(508968150,Ja);ae[508968150]=[0,ie,as,cs,re,[0,[0,Xa]]],ae[508968149]=cs;var Er=class extends E{constructor(e){super(e)}l(){return D(this,os,2)}g(){B(this,2)}},Za=[0,ie,qa];ae[478825465]=Za;var _2=class extends E{constructor(e){super(e)}},Ra=class extends E{constructor(e){super(e)}},ls=class extends E{constructor(e){super(e)}},ds=class extends E{constructor(e){super(e)}},ec=class extends E{constructor(e){super(e)}},tc=[0,ie,[0,ie],Za,-1],rc=[0,ie,re,le],us=[0,ie,re],ic=[0,ie,rc,us,re],N2=Re(479097054,ec);ae[479097054]=[0,ie,ic,tc],ae[463370452]=tc,ae[464864288]=rc;var T2=Re(462713202,ds);ae[462713202]=ic,ae[474472470]=us;var S2=class extends E{constructor(e){super(e)}},nc=class extends E{constructor(e){super(e)}},sc=class extends E{constructor(e){super(e)}},oc=class extends E{constructor(e){super(e)}},hs=[0,ie,re,-1,le],fs=[0,ie,re,Z];oc.prototype.g=Di([0,ie,us,[0,ie],as,cs,hs,fs]);var ac=class extends E{constructor(e){super(e)}},A2=Re(456383383,ac);ae[456383383]=[0,ie,qa];var cc=class extends E{constructor(e){super(e)}},C2=Re(476348187,cc);ae[476348187]=[0,ie,v2];var lc=class extends E{constructor(e){super(e)}},dc=class extends E{constructor(e){super(e)}},uc=[0,Ne,-1],I2=Re(458105876,class extends E{constructor(e){super(e)}g(){let e;var t=this.v;const r=0|t[x];return e=Ee(this,r),t=function(i,n,s,a){var c=dc;!a&&lr(i)&&(s=0|(n=i.v)[x]);var l=ct(n,2);if(i=!1,l==null){if(a)return Lo();l=[]}else if(l.constructor===at){if(!(2&l.J)||a)return l;l=l.V()}else Array.isArray(l)?i=!!(2&(0|l[x])):l=[];if(a){if(!l.length)return Lo();i||(i=!0,Ur(l))}else i&&(i=!1,Gr(l),l=Go(l));return!i&&32&s&&Br(l,32),s=oe(n,s,2,a=new at(l,c,Id,void 0)),i||Ut(n,s),a}(this,t,r,e),!e&&dc&&(t.ra=!0),t}});ae[458105876]=[0,uc,e2,[!0,xt,[0,G,-1,we]],[0,Xr,Z,Ne]];var ws=class extends E{constructor(e){super(e)}},hc=Re(458105758,ws);ae[458105758]=[0,ie,G,uc];var gs=class extends E{constructor(e){super(e)}},fc=[0,r2,-1,Ht],F2=class extends E{constructor(e){super(e)}},wc=class extends E{constructor(e){super(e)}},ps=[1,2];wc.prototype.g=Di([0,ps,R,fc,R,[0,de,fc]]);var gc=class extends E{constructor(e){super(e)}},L2=Re(443442058,gc);ae[443442058]=[0,ie,G,le,re,we,-1,Z,re],ae[514774813]=hs;var pc=class extends E{constructor(e){super(e)}},M2=Re(516587230,pc);function ms(e,t){return t=t?t.clone():new os,e.displayNamesLocale!==void 0?B(t,1,Hr(e.displayNamesLocale)):e.displayNamesLocale===void 0&&B(t,1),e.maxResults!==void 0?dt(t,2,e.maxResults):"maxResults"in e&&B(t,2),e.scoreThreshold!==void 0?_(t,3,e.scoreThreshold):"scoreThreshold"in e&&B(t,3),e.categoryAllowlist!==void 0?vi(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&B(t,4),e.categoryDenylist!==void 0?vi(t,5,e.categoryDenylist):"categoryDenylist"in e&&B(t,5),t}function mc(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function ys(e,t=-1,r=""){return{categories:e.map(i=>({index:Pe(i,1)??0??-1,score:J(i,2)??0,categoryName:fe(W(i,3))??""??"",displayName:fe(W(i,4))??""??""})),headIndex:t,headName:r}}function P2(e){const t={classifications:lt(e,g2,1).map(r=>{var i;return ys(((i=D(r,Ua,4))==null?void 0:i.g())??[],Pe(r,2)??0,fe(W(r,3))??"")})};return function(r){return Cd(wn?W(r,2,void 0,void 0,pi):W(r,2))}(e)!=null&&(t.timestampMs=mc(zo(e))),t}function yc(e){var a,c;var t=Vt(e,3,Qe,Gt()),r=Vt(e,2,ar,Gt()),i=Vt(e,1,fe,Gt()),n=Vt(e,9,fe,Gt());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=D(e,ss,4))==null?void 0:a.l())&&(s.boundingBox={originX:Pe(t,1,yt)??0,originY:Pe(t,2,yt)??0,width:Pe(t,3,yt)??0,height:Pe(t,4,yt)??0,angle:0}),(c=D(e,ss,4))==null?void 0:c.g().length)for(const l of D(e,ss,4).g())s.keypoints.push({x:W(l,1,void 0,yt,Qe)??0,y:W(l,2,void 0,yt,Qe)??0,score:W(l,4,void 0,yt,Qe)??0,label:fe(W(l,3,void 0,yt))??""});return s}function Vi(e){const t=[];for(const r of lt(e,Wa,1))t.push({x:J(r,1)??0,y:J(r,2)??0,z:J(r,3)??0,visibility:J(r,4)??0});return t}function Zr(e){const t=[];for(const r of lt(e,ja,1))t.push({x:J(r,1)??0,y:J(r,2)??0,z:J(r,3)??0,visibility:J(r,4)??0});return t}function bc(e){return Array.from(e,t=>t>127?t-256:t)}function vc(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 ji;ae[516587230]=[0,ie,hs,fs,re],ae[518928384]=fs;const D2=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 xc(){if(ji===void 0)try{await WebAssembly.instantiate(D2),ji=!0}catch{ji=!1}return ji}async function Rr(e,t=a2``){const r=await xc()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var qt=class{};function Ec(){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 kc(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 _c(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 Nc(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]=_c(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 Tc(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 et(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function _t(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 Rr("vision",e)},qt.forTextTasks=function(e){return Rr("text",e)},qt.forGenAiExperimentalTasks=function(e){return Rr("genai_experimental",e)},qt.forGenAiTasks=function(e){return Rr("genai",e)},qt.forAudioTasks=function(e){return Rr("audio",e)},qt.isSimdSupported=function(){return xc()};async function O2(e,t,r,i){return e=await(async(n,s,a,c,l)=>{if(s&&await kc(s),!self.ModuleFactory||a&&(await kc(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 bs(e,t){const r=D(e.baseOptions,Ui,1)||new Ui;typeof t=="string"?(B(r,2,Hr(t)),B(r,1)):t instanceof Uint8Array&&(B(r,1,bn(t,!1)),B(r,2)),N(e.baseOptions,0,1,r)}function Sc(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 v(e,t){e.C=Math.max(e.C,t)}function Wi(e,t){e.B=new ye,_e(e.B,2,"PassThroughCalculator"),$(e.B,"free_memory"),F(e.B,"free_memory_unused_out"),q(t,"free_memory"),Oe(t,e.B)}function kr(e,t){$(e.B,t),F(e.B,t+"_unused_out")}function $i(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var vs=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=D(this.baseOptions,Ui,1))!=null&&n.g()||(s=D(this.baseOptions,Ui,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,d){let f=D(h.baseOptions,Ya,3);if(!f){var w=f=new Ya,g=new Fa;Kr(w,4,Bi,g)}"delegate"in d&&(d.delegate==="GPU"?(d=f,w=new c2,Kr(d,2,Bi,w)):(d=f,w=new Fa,Kr(d,4,Bi,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),bs(this,"/model.dat"),this.m(),this.L()});if(l.modelAssetBuffer instanceof Uint8Array)bs(this,l.modelAssetBuffer);else if(l.modelAssetBuffer)return async function(h){const d=[];for(var f=0;;){const{done:w,value:g}=await h.read();if(w)break;d.push(g),f+=g.length}if(d.length===0)return new Uint8Array(0);if(d.length===1)return d[0];h=new Uint8Array(f),f=0;for(const w of d)h.set(w,f),f+=w.length;return h}(l.modelAssetBuffer).then(h=>{bs(this,h),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca(t=>{e=l2(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,Sc(this)}finishProcessing(){this.g.finishProcessing(),Sc(this)}close(){this.B=void 0,this.g.closeGraph()}};function Nt(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}vs.prototype.close=vs.prototype.close;class B2{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 Ac(e,t,r){const i=e.g;if(r=Nt(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 Cc(e,t){const r=e.g,i=Nt(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(i);const n=Nt(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=Nt(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 B2(r,i,n,s)}function xs(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function U2(e,t,r,i){return xs(e,t),e.h||(e.m(),e.D()),r?(e.u||(e.u=Cc(e,!0)),r=e.u):(e.A||(e.A=Cc(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=i(),r.g.bindVertexArray(null),e}function Ic(e,t,r){return xs(e,t),e=Nt(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 Fc(e,t,r){xs(e,t),e.B||(e.B=Nt(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 G2(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Lc=class{H(){return`
|
|
1
|
+
(function(he,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):(he=typeof globalThis<"u"?globalThis:he||self,o(he.InterviewWidget={},he.jsxRuntime,he.React,he.ReactDOM))})(this,function(he,o,u,Vs){"use strict";var r1=Object.defineProperty;var i1=(he,o,u)=>o in he?r1(he,o,{enumerable:!0,configurable:!0,writable:!0,value:u}):he[o]=u;var Pe=(he,o,u)=>i1(he,typeof o!="symbol"?o+"":o,u);var Ri=typeof document<"u"?document.currentScript:null;const en={},He={api:{baseUrl:"/api",retryConfig:{attempts:3,backoff:"exponential",baseDelay:1e3}},ui:{baseColor:"#3B82F6",borderRadius:"8px"},interview:{allow_answer_editing:!0,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}}},tn="iw-storage";function yl(){if(!(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ri&&Ri.tagName.toUpperCase()==="SCRIPT"&&Ri.src||new URL("widget.umd.js",document.baseURI).href}<"u"&&(en!=null&&en.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 js=yl(),ai=30,bl={SCREENSHOT:"screenshot"},rn="AES-GCM",nn=12;async function Ws(e){const r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return crypto.subtle.importKey("raw",i,rn,!1,["encrypt","decrypt"])}function vl(){return crypto.getRandomValues(new Uint8Array(nn))}async function xl(e,t="default-seed"){try{const r=typeof e=="string"?e:JSON.stringify(e),n=new TextEncoder().encode(r),s=await Ws(t),a=vl(),c=await crypto.subtle.encrypt({name:rn,iv:a},s,n),l=new Uint8Array(a.length+c.byteLength);return l.set(new Uint8Array(a),0),l.set(new Uint8Array(c),a.length),btoa(String.fromCharCode(...Array.from(l)))}catch(r){throw console.error("Encryption failed:",r),new Error("Failed to encrypt data")}}async function El(e,t="default-seed"){try{const r=atob(e),i=new Uint8Array(r.length);for(let h=0;h<r.length;h++)i[h]=r.charCodeAt(h);const n=i.slice(0,nn),s=i.slice(nn),a=await Ws(t),c=await crypto.subtle.decrypt({name:rn,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 _l(e,t="default-seed"){return xl(e,t)}async function kl(e,t="default-seed"){const r=await El(e,t);try{return JSON.parse(r)}catch{return r}}const Fr=u.createContext(null),Tl=async()=>{try{const e=sessionStorage.getItem(tn);if(e){const r=(await kl(e,js)).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}}},Lr=async e=>{try{const t=await _l({state:e,version:0},js);sessionStorage.setItem(tn,t)}catch(t){console.error("Failed to save proctoring data to session storage:",t)}},Al=({children:e})=>{const t=u.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=u.useRef(new Set);u.useEffect(()=>{Tl().then(w=>{t.current=w,i()})},[]);const i=u.useCallback(()=>{r.current.forEach(w=>w())},[]),n=u.useCallback(w=>(r.current.add(w),()=>{r.current.delete(w)}),[]),s=u.useCallback(()=>t.current,[]),a=u.useCallback(w=>{t.current={...t.current,logViolations:[...t.current.logViolations,w],totalViolations:t.current.totalViolations+1},Lr(t.current),i()},[i]),c=u.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},Lr(t.current),i()},[i]),l=u.useCallback(()=>{t.current={...t.current,logViolations:[],totalViolations:0},Lr(t.current),i()},[i]),h=u.useCallback(()=>{t.current={...t.current,gazeViolationCounters:{lookingAwayCount:0,noFaceDetectedCount:0,multipleFacesCount:0,totalGazeViolations:0}},Lr(t.current),i()},[i]),d=u.useCallback((w,g)=>{t.current={...t.current,referenceSet:w,referenceRef:g},Lr(t.current),i()},[i]),f=u.useMemo(()=>({getState:s,addViolation:a,clearViolations:l,subscribe:n,incrementGazeViolation:c,clearGazeViolationCounters:h,setReferenceData:d}),[s,a,l,n,c,h,d]);return o.jsx(Fr.Provider,{value:f,children:e})},$s=()=>{const e=u.useContext(Fr);if(!e)throw new Error("useProctoringStore must be used within a ProctoringProvider");const t=u.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}},Sl=()=>{const e=u.useContext(Fr);if(!e)throw new Error("useViolations must be used within a ProctoringProvider");return u.useSyncExternalStore(e.subscribe,()=>e.getState().logViolations,()=>e.getState().logViolations)},Cl=()=>{const e=u.useContext(Fr);if(!e)throw new Error("useTotalViolations must be used within a ProctoringProvider");return u.useSyncExternalStore(e.subscribe,()=>e.getState().totalViolations,()=>e.getState().totalViolations)},Nl=()=>{const e=u.useContext(Fr);if(!e)throw new Error("useProctoringActions must be used within a ProctoringProvider");return{addViolation:e.addViolation,clearViolations:e.clearViolations}},zs=u.createContext(null);function Hs({config:e={},children:t}){var i,n,s,a;const r={api:{...He.api,...e.api,retryConfig:{...He.api.retryConfig,...(i=e.api)==null?void 0:i.retryConfig}},ui:{...He.ui,...e.ui},interview:{...He.interview,...e.interview,timers:{...He.interview.timers,...(n=e.interview)==null?void 0:n.timers},stt:{...He.interview.stt,...(s=e.interview)==null?void 0:s.stt},tts:{...He.interview.tts,...(a=e.interview)==null?void 0:a.tts}}};return o.jsx(zs.Provider,{value:r,children:o.jsx(Al,{children:t})})}function ci(){const e=u.useContext(zs);if(!e)throw new Error("useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>");return e}function qs(){return ci().api||He.api}function Xt(){return ci().ui||He.ui}function sn(){return ci().interview||He.interview}function Il(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 Fl(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 Ll(e,t){const r=Il(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 Fl(i,n,s)}function Ml(e){return new Promise(t=>setTimeout(t,e))}function Pl(e){return`linear-gradient(to left, ${Ll(e,.4)}, ${e})`}const Dl=()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);function Ol(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 Bl=e=>{var t;return!e||typeof e!="string"?"":(t=e.charAt(0))==null?void 0:t.toUpperCase()},on=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}`},an=({brandLogo:e,brandName:t,className:r="",showFallbackStyles:i=!0})=>{const{baseColor:n}=Xt();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:Bl(t)})};function Ul(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 gt(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=Ul(s);if(!a.retryable||n===r.attempts)throw a;const c=Gl(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 Gl(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 pt={v2:"/v2"},mt={GENERATE_QUESTION:e=>`${pt.v2}/interviews/${e}/next-question`,SCREENSHOT_UPLOAD:e=>`${pt.v2}/interviews/${e}/assets/upload-url`,CONFIRM_UPLOAD:e=>`${pt.v2}/interviews/assets/${e}/confirm`,TRANSCRIBE_ANSWER:e=>`${pt.v2}/interviews/${e}/transcribe-answer`,SUBMIT_ANSWER:e=>`${pt.v2}/interviews/${e}/submit-answer`,EXIT:e=>`${pt.v2}/interviews/${e}/exit`,CONFIG:e=>`${pt.v2}/interviews/${e}/config`,TRANSCRIPTION:e=>`${pt.v2}/interviews/${e}/transcript`};class Ks{constructor(t={}){Pe(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 gt(`${this.getBaseUrl()}${mt.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 gt(`${this.getBaseUrl()}${mt.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 gt(`${this.getBaseUrl()}${mt.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 gt(`${this.getBaseUrl()}${mt.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 gt(`${this.getBaseUrl()}${mt.SCREENSHOT_UPLOAD(t)}`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({filename:r,mime_type:"image/jpeg",asset_type:bl.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 gt(`${this.getBaseUrl()}${mt.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 gt(`${this.getBaseUrl()}${mt.TRANSCRIPTION(t)}`,{method:"GET",headers:{...this.getHeaders(),"x-auth-token":"interview-engine-api-key"}});if(!r.ok)throw new Error(`Failed to get interview transcription: ${r.status}`);return await r.json()}}const Vl=new Ks,jl=({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."]})]})}),cn=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"})]}),Wl=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})]}),$l=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"})]}),ln=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"})}),Ys=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"})]}),Mr=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"})}),zl=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"})]}),Hl=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"})]}),Xs=({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"})]})}),ql=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"})]}),Kl=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:"M2 2L22 22",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M4 11C4 15.4183 7.58172 19 12 19M12 19C13.9545 19 15.7454 18.2991 17.1348 17.1348M12 19V22M12 22H15M12 22H9M20 11C20 12.6514 19.4996 14.1859 18.6422 15.4603",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M7 6.98V11C7 13.7614 9.23858 16 12 16C13.1354 16 14.1647 15.6096 15.004 14.972M16.4387 13.244C16.7973 12.5545 17 11.8309 17 11V6.98C17 4.21858 14.7614 2 12 2C10.1312 2 8.53009 2.96527 7.672 4.484",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round"})]}),Yl=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})]}),Xl=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})]}),Ql=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"})]}),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:"M2.00195 2L21.9773 22",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M16.8517 16.8668C16.7225 17.8052 16.4666 18.4659 15.9596 18.9735C14.9357 19.9987 13.2878 19.9987 9.99206 19.9987H8.99329C5.69755 19.9987 4.04967 19.9987 3.02581 18.9735C2.00195 17.9484 2.00195 16.2985 2.00195 12.9987V10.9987C2.00195 7.69885 2.00195 6.04893 3.02581 5.0238C3.36833 4.68086 3.78068 4.45265 4.3012 4.30078",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M8.23633 4.00052C8.47821 4 8.73001 4 8.99223 4H9.99099C13.2868 4 14.9347 4 15.9585 5.02513C16.9823 6.05025 16.9823 7.70017 16.9823 11V12.7574M16.9823 9.23142L19.3019 7.52913C20.773 6.54073 21.449 7.17196 21.6675 7.64847C22.1192 8.92813 21.9769 11.3936 21.9769 14.5417C21.8704 16.555 21.5953 16.7719 21.3138 16.9939L21.3108 16.9962",stroke:"#062260",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Zl=({showControls:e,isBubbleOpen:t,setIsBubbleOpen:r,setReference:i,clearCache:n,isModelLoaded:s,gazeAnalysisEnabled:a,referenceSet:c,showLandmarks:l,setShowLandmarks:h,showEngagementBar:d,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(Wl,{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:b=>w(b.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:b=>h(b.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:d,onChange:b=>f(b.target.checked),disabled:!a}),"Show Engagement Bar"]})]}),c&&o.jsx(jl,{gazeAnalysisEnabled:a,isModelLoaded:s,loadingProgress:y,stats:g,statusMessage:p})]})]}):null;var Qt=typeof self<"u"?self:{};function Pr(e,t){e:{for(var r=["CLOSURE_FLAGS"],i=Qt,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 It(){throw Error("Invalid UTF8")}function Qs(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let li,dn;const Rl=typeof TextDecoder<"u";let ed;const td=typeof TextEncoder<"u";function Js(e){if(td)e=(ed||(ed=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 Zs(e){Qt.setTimeout(()=>{throw e},0)}var un,rd=Pr(610401301,!1),Rs=Pr(748402147,!0),hn=Pr(824648567,!0),fn=Pr(824656860,Pr(1,!0));function eo(){var e=Qt.navigator;return e&&(e=e.userAgent)?e:""}const to=Qt.navigator;function di(e){return di[" "](e),e}un=to&&to.userAgentData||null,di[" "]=function(){};const ro={};let Dr=null;function id(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 d=s.charAt(l++),f=Dr[d];if(f!=null)return f;if(!/^[\s\xa0]*$/.test(d))throw Error("Unknown base64 encoding at char: "+d)}return h}io();let l=0;for(;;){const h=c(-1),d=c(0),f=c(64),w=c(64);if(w===64&&h===-1)break;a(h<<2|d>>4),f!=64&&(a(d<<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 io(){if(!Dr){Dr={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const i=e.concat(t[r].split(""));ro[r]=i;for(let n=0;n<i.length;n++){const s=i[n];Dr[s]===void 0&&(Dr[s]=n)}}}}var nd=typeof Uint8Array<"u",no=!(!(rd&&un&&un.brands.length>0)&&(eo().indexOf("Trident")!=-1||eo().indexOf("MSIE")!=-1))&&typeof btoa=="function";const so=/[-_.]/g,sd={"-":"+",_:"/",".":"="};function od(e){return sd[e]||""}function oo(e){if(!no)return id(e);e=so.test(e)?e.replace(so,od):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 wn(e){return nd&&e!=null&&e instanceof Uint8Array}var Jt={};function Ft(){return ad||(ad=new qe(null,Jt))}function gn(e){ao(Jt);var t=e.g;return(t=t==null||wn(t)?t:typeof t=="string"?oo(t):null)==null?t:e.g=t}var qe=class{h(){return new Uint8Array(gn(this)||0)}constructor(e,t){if(ao(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let ad,cd;function ao(e){if(e!==Jt)throw Error("illegal external caller")}function co(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function pn(e){return co(e=Error(e),"warning"),e}function Zt(e,t){if(e!=null){var r=cd??(cd={}),i=r[e]||0;i>=t||(r[e]=i+1,co(e=Error(),"incident"),Zs(e))}}function Rt(){return typeof BigInt=="function"}var er=typeof Symbol=="function"&&typeof Symbol()=="symbol";function Ke(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 ld=Ke("jas",void 0,!0),lo=Ke(void 0,"0di"),Or=Ke(void 0,"1oa"),Ee=Ke(void 0,Symbol()),dd=Ke(void 0,"0ub"),ud=Ke(void 0,"0ubs"),mn=Ke(void 0,"0ubsb"),hd=Ke(void 0,"0actk"),tr=Ke("m_m","Pa",!0),uo=Ke();const ho={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},fo=Object.defineProperties,x=er?ld:"Ga";var Lt;const wo=[];function Br(e,t){er||x in e||fo(e,ho),e[x]|=t}function ne(e,t){er||x in e||fo(e,ho),e[x]=t}function Ur(e){return Br(e,34),e}function Gr(e){return Br(e,8192),e}ne(wo,7),Lt=Object.freeze(wo);var rr={};function _e(e,t){return t===void 0?e.h!==Mt&&!!(2&(0|e.v[x])):!!(2&t)&&e.h!==Mt}const Mt={};function yn(e,t){if(e!=null){if(typeof e=="string")e=e?new qe(e,Jt):Ft();else if(e.constructor!==qe)if(wn(e))e=e.length?new qe(new Uint8Array(e),Jt):Ft();else{if(!t)throw Error();e=void 0}}return e}class go{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 fd=Object.freeze({});function po(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 mo={};function ir(e){return 128&e?mo:void 0}function ui(e){return e.Na=!0,e}var wd=ui(e=>typeof e=="number"),yo=ui(e=>typeof e=="string"),gd=ui(e=>typeof e=="boolean"),hi=typeof Qt.BigInt=="function"&&typeof Qt.BigInt(0)=="bigint";function ke(e){var t=e;if(yo(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(wd(t)&&!Number.isSafeInteger(t))throw Error(String(t));return hi?BigInt(e):e=gd(e)?e?"1":"0":yo(e)?e.trim()||"0":String(e)}var bn=ui(e=>hi?e>=md&&e<=bd:e[0]==="-"?bo(e,pd):bo(e,yd));const pd=Number.MIN_SAFE_INTEGER.toString(),md=hi?BigInt(Number.MIN_SAFE_INTEGER):void 0,yd=Number.MAX_SAFE_INTEGER.toString(),bd=hi?BigInt(Number.MAX_SAFE_INTEGER):void 0;function bo(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 vd=typeof Uint8Array.prototype.slice=="function";let xd,K=0,te=0;function vo(e){const t=e>>>0;K=t,te=(e-t)/4294967296>>>0}function nr(e){if(e<0){vo(-e);const[t,r]=kn(K,te);K=t>>>0,te=r>>>0}else vo(e)}function vn(e){const t=xd||(xd=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),te=0,K=t.getUint32(0,!0)}function xn(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Vr(e,t)}function Ed(e,t){return ke(Rt()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):Vr(e,t))}function En(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=xn(e,t))=="number"?r?-e:e:r?"-"+e:e}function xo(e,t){return Rt()?ke(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):ke(_n(e,t))}function Vr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else Rt()?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+Eo(r)+Eo(e));return r}function Eo(e){return e=String(e),"0000000".slice(e.length)+e}function _n(e,t){if(2147483648&t)if(Rt())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,i]=kn(e,t);e="-"+Vr(r,i)}else e=Vr(e,t);return e}function fi(e){if(e.length<16)nr(Number(e));else if(Rt())e=BigInt(e),K=Number(e&BigInt(4294967295))>>>0,te=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");te=K=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));te*=1e6,K=1e6*K+s,K>=4294967296&&(te+=Math.trunc(K/4294967296),te>>>=0,K>>>=0)}if(t){const[i,n]=kn(K,te);K=i,te=n}}}function kn(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function je(e){return Array.prototype.slice.call(e)}const jr=typeof BigInt=="function"?BigInt.asIntN:void 0,_d=typeof BigInt=="function"?BigInt.asUintN:void 0,Pt=Number.isSafeInteger,wi=Number.isFinite,sr=Math.trunc,kd=ke(0);function Wr(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 Ye(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function $r(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 _o(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const Td=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function zr(e){switch(typeof e){case"bigint":return!0;case"number":return wi(e);case"string":return Td.test(e);default:return!1}}function or(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return wi(e)?0|e:void 0}function ko(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return wi(e)?e>>>0:void 0}function To(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(fi(e),_n(K,te))}function Tn(e){return e=sr(e),Pt(e)||(nr(e),e=En(K,te)),e}function Ao(e){var t=sr(Number(e));return Pt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),To(e))}function So(e){var t=sr(Number(e));return Pt(t)?ke(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Rt()?ke(jr(64,BigInt(e))):ke(To(e)))}function Co(e){return Pt(e)?e=ke(Tn(e)):(e=sr(e),Pt(e)?e=String(e):(nr(e),e=_n(K,te)),e=ke(e)),e}function Ad(e){return e==null?e:typeof e=="bigint"?(bn(e)?e=Number(e):(e=jr(64,e),e=bn(e)?Number(e):String(e)),e):zr(e)?typeof e=="number"?Tn(e):Ao(e):void 0}function gi(e){const t=typeof e;return e==null?e:t==="bigint"?ke(jr(64,e)):zr(e)?t==="string"?So(e):Co(e):void 0}function No(e){if(typeof e!="string")throw Error();return e}function Hr(e){if(e!=null&&typeof e!="string")throw Error();return e}function fe(e){return e==null||typeof e=="string"?e:void 0}function An(e,t,r,i){return e!=null&&e[tr]===rr?e:Array.isArray(e)?((i=(r=0|e[x])|32&i|2&i)!==r&&ne(e,i),new t(e)):(r?2&i?((e=t[lo])||(Ur((e=new t).v),e=t[lo]=e),t=e):t=new t:t=void 0,t)}function Sd(e,t,r){if(t)e:{if(!zr(t=e))throw pn("int64");switch(typeof t){case"string":t=So(t);break e;case"bigint":t=ke(jr(64,t));break e;default:t=Co(t)}}else t=gi(e);return(e=t)==null?r?kd:void 0:e}const Cd={};let Nd=function(){try{return di(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class Sn{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 Id=Nd?(Object.setPrototypeOf(Sn.prototype,Map.prototype),Object.defineProperties(Sn.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Sn):class extends Map{constructor(){super()}};function Io(e){return e}function Cn(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var ot=class extends Id{constructor(e,t,r=Io,i=Io){super(),this.J=0|e[x],this.K=t,this.S=r,this.fa=this.K?Fd: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 Gr(Array.from(super.entries(),e))}clear(){Cn(this),super.clear()}delete(e){return Cn(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new go(e,Ld,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new go(e,ot.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 Cn(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 Fd(e,t,r,i,n,s){return e=An(e,i,r,s),n&&(e=Fn(e)),e}function Ld(e){return[e,this.get(e)]}let Md;function Fo(){return Md||(Md=new ot(Ur([]),void 0,void 0,void 0,Cd))}function pi(e){return Ee?e[Ee]:void 0}function mi(e,t){for(const r in e)!isNaN(r)&&t(e,+r,e[r])}ot.prototype.toJSON=void 0;var Nn=class{};const Pd={Ka:!0};function Dd(e,t){t<100||Zt(ud,1)}function yi(e,t,r,i){const n=i!==void 0;i=!!i;var s,a=Ee;!n&&er&&a&&(s=e[a])&&mi(s,Dd),a=[];var c=e.length;let l;s=4294967295;let h=!1;const d=!!(64&t),f=d?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,!d||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(d&&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,d&&!Number.isNaN(w)&&(p=w+f)<s?a[p]=c:(t??(t={}))[g]=c}return t&&(h?a.push(t):a[s]=t),n&&Ee&&(e=pi(e))&&e instanceof Nn&&(a[Ee]=function(g){const p=new Nn;return mi(g,(y,b,m)=>{p[b]=je(m)}),p.da=g.da,p}(e)),a}function Od(e){return e[0]=qr(e[0]),e[1]=qr(e[1]),e}function qr(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return bn(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[x];return e.length===0&&1&t?void 0:yi(e,t,qr)}if(e!=null&&e[tr]===rr)return Lo(e);if(e instanceof qe){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(no){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),io(),r=ro[r],i=Array(Math.floor(t.length/3)),n=r[64]||"";let h=0,d=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[d++]=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[d]=r[t>>2]+r[(3&t)<<4|l>>4]+c+n}t=i.join("")}e=e.g=t}return e}return e instanceof ot?e=e.size!==0?e.V(Od):void 0:void 0}return e}function Lo(e){return yi(e=e.v,0|e[x],qr)}let Bd,Ud;function Dt(e,t){return Mo(e,t[0],t[1])}function Mo(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[x],Rs&&1&n)throw Error("rfarr");if(2048&n&&!(2&n)&&function(){if(Rs)throw Error("carr");Zt(hd,5)}(),256&n)throw Error("farr");if(64&n)return(n|i)!==n&&ne(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 ne(e,64|n|i),e}function Gd(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var r=0|e[x];return e.length===0&&1&r?void 0:Po(e,r,t)}if(e!=null&&e[tr]===rr)return Do(e);if(e instanceof ot){if(2&(t=e.J))return e;if(!e.size)return;if(r=Ur(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[tr]===rr?Do(n):Array.isArray(n)?Po(n,0|n[x],!!(32&t)):void 0,i[1]=n}return r}return e instanceof qe?e:void 0}function Po(e,t,r){return 2&t||(!r||4096&t||16&t?e=ar(e,t,!1,r&&!(16&t)):(Br(e,34),4&t&&Object.freeze(e))),e}function In(e,t,r){return e=new e.constructor(t),r&&(e.h=Mt),e.m=Mt,e}function Do(e){const t=e.v,r=0|t[x];return _e(e,r)?e:Ln(e,t,r)?In(e,t):ar(t,r)}function ar(e,t,r,i){return i??(i=!!(34&t)),e=yi(e,t,Gd,i),i=32,r&&(i|=2),ne(e,t=16769217&t|i),e}function Fn(e){const t=e.v,r=0|t[x];return _e(e,r)?Ln(e,t,r)?In(e,t,!0):new e.constructor(ar(t,r,!1)):e}function cr(e){if(e.h!==Mt)return!1;var t=e.v;return Br(t=ar(t,0|t[x]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function lr(e){if(!cr(e)&&_e(e,0|e.v[x]))throw Error()}function Ot(e,t){t===void 0&&(t=0|e[x]),32&t&&!(4096&t)&&ne(e,4096|t)}function Ln(e,t,r){return!!(2&r)||!(!(32&r)||4096&r)&&(ne(t,2|r),e.h=Mt,!0)}const Vd=ke(0),yt={};function z(e,t,r,i,n){if((t=at(e.v,t,r,n))!==null||i&&e.m!==Mt)return t}function at(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 G(e,t,r,i){lr(e),se(e=e.v,0|e[x],t,r,i)}function se(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[x]))>>14&1023||536870912)?i!=null&&(e[a+(n?0:-1)]={[r]:i}):e[s]=i),t)}function Bt(){return fd===void 0?2:4}function Ut(e,t,r,i,n){let s=e.v,a=0|s[x];i=_e(e,a)?1:i,n=!!n||i===3,i===2&&cr(e)&&(s=e.v,a=0|s[x]);let c=(e=Mn(s,t))===Lt?7:0|e[x],l=Pn(c,a);var h=!(4&l);if(h){4&l&&(e=je(e),c=0,l=Vt(l,a),a=se(s,a,t,e));let d=0,f=0;for(;d<e.length;d++){const w=r(e[d]);w!=null&&(e[f++]=w)}f<d&&(e.length=f),r=-513&(4|l),l=r&=-1025,l&=-4097}return l!==c&&(ne(e,l),2&l&&Object.freeze(e)),Oo(e,l,s,a,t,i,h,n)}function Oo(e,t,r,i,n,s,a,c){let l=t;return s===1||s===4&&(2&t||!(16&t)&&32&i)?Gt(t)||((t|=!e.length||a&&!(4096&t)||32&i&&!(4096&t||16&t)?2:256)!==l&&ne(e,t),Object.freeze(e)):(s===2&&Gt(t)&&(e=je(e),l=0,t=Vt(t,i),i=se(r,i,n,e)),Gt(t)||(c||(t|=16),t!==l&&ne(e,t))),2&t||!(4096&t||16&t)||Ot(r,i),e}function Mn(e,t,r){return e=at(e,t,r),Array.isArray(e)?e:Lt}function Pn(e,t){return 2&t&&(e|=2),1|e}function Gt(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Bo(e){return yn(e,!0)}function Uo(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]=Ur(r[1]))}return Gr(e)}function bt(e,t,r,i){lr(e),se(e=e.v,0|e[x],t,(i==="0"?Number(r)===0:r===i)?void 0:r)}function dr(e,t,r){if(2&t)throw Error();const i=ir(t);let n=Mn(e,r,i),s=n===Lt?7:0|n[x],a=Pn(s,t);return(2&a||Gt(a)||16&a)&&(a===s||Gt(a)||ne(n,a),n=je(n),s=0,a=Vt(a,t),se(e,t,r,n,i)),a&=-13,a!==s&&ne(n,a),n}function Dn(e,t){var r=za;return Bn(On(e=e.v),e,void 0,r)===t?t:-1}function On(e){if(er)return e[Or]??(e[Or]=new Map);if(Or in e)return e[Or];const t=new Map;return Object.defineProperty(e,Or,{value:t}),t}function Go(e,t,r,i,n){const s=On(e),a=Bn(s,e,t,r,n);return a!==i&&(a&&(t=se(e,t,a,void 0,n)),s.set(r,i)),t}function Bn(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];at(t,c,n)!=null&&(s!==0&&(r=se(t,r,s,void 0,n)),s=c)}return e.set(i,s),s}function Un(e,t,r){let i=0|e[x];const n=ir(i),s=at(e,r,n);let a;if(s!=null&&s[tr]===rr){if(!_e(s))return cr(s),s.v;a=s.v}else Array.isArray(s)&&(a=s);if(a){const c=0|a[x];2&c&&(a=ar(a,c))}return a=Dt(a,t),a!==s&&se(e,i,r,a,n),a}function Vo(e,t,r,i,n){let s=!1;if((i=at(e,i,n,a=>{const c=An(a,r,!1,t);return s=c!==a&&c!=null,c}))!=null)return s&&!_e(i)&&Ot(e,t),i}function O(e,t,r,i){let n=e.v,s=0|n[x];if((t=Vo(n,s,t,r,i))==null)return t;if(s=0|n[x],!_e(e,s)){const a=Fn(t);a!==t&&(cr(e)&&(n=e.v,s=0|n[x]),s=se(n,s,r,t=a,i),Ot(n,s))}return t}function jo(e,t,r,i,n,s,a,c){var l=_e(e,r);s=l?1:s,a=!!a||s===3,l=c&&!l,(s===2||l)&&cr(e)&&(r=0|(t=e.v)[x]);var h=(e=Mn(t,n))===Lt?7:0|e[x],d=Pn(h,r);if(c=!(4&d)){var f=e,w=r;const g=!!(2&d);g&&(w|=2);let p=!g,y=!0,b=0,m=0;for(;b<f.length;b++){const A=An(f[b],i,!1,w);if(A instanceof i){if(!g){const I=_e(A);p&&(p=!I),y&&(y=I)}f[m++]=A}}m<b&&(f.length=m),d|=4,d=y?-4097&d:4096|d,d=p?8|d:-9&d}if(d!==h&&(ne(e,d),2&d&&Object.freeze(e)),l&&!(8&d||!e.length&&(s===1||s===4&&(2&d||!(16&d)&&32&r)))){for(Gt(d)&&(e=je(e),d=Vt(d,r),r=se(t,r,n,e)),i=e,l=d,h=0;h<i.length;h++)(f=i[h])!==(d=Fn(f))&&(i[h]=d);l|=8,ne(e,d=l=i.length?4096|l:-4097&l)}return Oo(e,d,t,r,n,s,c,a)}function ct(e,t,r){const i=e.v;return jo(e,i,0|i[x],t,r,Bt(),!1,!0)}function Wo(e){return e==null&&(e=void 0),e}function T(e,t,r,i,n){return G(e,r,i=Wo(i),n),i&&!_e(i)&&Ot(e.v),e}function Kr(e,t,r,i){e:{var n=i=Wo(i);lr(e);const s=e.v;let a=0|s[x];if(n==null){const c=On(s);if(Bn(c,s,a,r)!==t)break e;c.set(r,0)}else a=Go(s,a,r,t);se(s,a,t,n)}i&&!_e(i)&&Ot(e.v)}function Vt(e,t){return-273&(2&t?2|e:-3&e)}function Gn(e,t,r,i){var n=i;lr(e),e=jo(e,i=e.v,0|i[x],r,t,2,!0),n=n??new r,e.push(n),t=r=e===Lt?7:0|e[x],(n=_e(n))?(r&=-9,e.length===1&&(r&=-4097)):r|=4096,r!==t&&ne(e,r),n||Ot(i)}function De(e,t,r){return or(z(e,t,void 0,r))}function $o(e){return(fn?z(e,2,void 0,void 0,gi):gi(z(e,2)))??Vd}function Z(e,t){return z(e,t,void 0,void 0,Ye)??0}function lt(e,t,r){if(r!=null){if(typeof r!="number"||!wi(r))throw pn("int32");r|=0}G(e,t,r)}function k(e,t,r){G(e,t,Wr(r))}function Te(e,t,r){bt(e,t,Hr(r),"")}function bi(e,t,r){{lr(e);const a=e.v;let c=0|a[x];if(r==null)se(a,c,t);else{var i=e=r===Lt?7:0|r[x],n=Gt(e),s=n||Object.isFrozen(r);for(n||(e=0),s||(r=je(r),i=0,e=Vt(e,c),s=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(fn?1024:0),n=0;n<r.length;n++){const l=r[n],h=No(l);Object.is(l,h)||(s&&(r=je(r),i=0,e=Vt(e,c),s=!1),r[n]=h)}e!==i&&(s&&(r=je(r),e=Vt(e,c)),ne(r,e)),se(a,c,t,r)}}}function vi(e,t,r){lr(e),Ut(e,t,fe,2,!0).push(No(r))}var ur=class{constructor(e,t,r){if(this.buffer=e,r&&!t)throw Error();this.g=t}};function Vn(e,t){if(typeof e=="string")return new ur(oo(e),t);if(Array.isArray(e))return new ur(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new ur(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new ur(e,!1);if(e.constructor===qe)return t=gn(e)||new Uint8Array(0),new ur(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new ur(e,!1);throw Error()}function hr(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(jt(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 jt(e,r),!!(127&t)}throw Error()}function vt(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 jt(e,r),n}function dt(e){return vt(e)>>>0}function xi(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],jt(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 jd(e){return vt(e)}function jt(e,t){if(e.g=t,t>e.l)throw Error()}function zo(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 Ho(e,t){if(t==0)return Ft();var r=zo(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):vd?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Ft():new qe(r,Jt)}var qo=[];function Ko(e,t,r,i){if(ki.length){const n=ki.pop();return n.o(i),n.g.init(e,t,r,i),n}return new Wd(e,t,r,i)}function Yo(e){e.g.clear(),e.l=-1,e.h=-1,ki.length<100&&ki.push(e)}function Xo(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var r=dt(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5)||t<1)throw Error();return e.l=t,e.h=r,!0}function Ei(e){switch(e.h){case 0:e.h!=0?Ei(e):jn(e.g);break;case 1:jt(e=e.g,e.g+8);break;case 2:if(e.h!=2)Ei(e);else{var t=dt(e.g);jt(e=e.g,e.g+t)}break;case 5:jt(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!Xo(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}Ei(e)}break;default:throw Error()}}function Yr(e,t,r){const i=e.g.l;var n=dt(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 Wn(e){var t=dt(e.g),r=zo(e=e.g,t);if(e=e.h,Rl){var i,n=e;(i=dn)||(i=dn=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(li===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),li=!0}catch{li=!1}}throw!li&&(dn=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?It():(c=e[s++],a<194||(192&c)!=128?(s--,It()):r.push((31&a)<<6|63&c)):a<240?s>=t-1?It():(c=e[s++],(192&c)!=128||a===224&&c<160||a===237&&c>=160||(192&(i=e[s++]))!=128?(s--,It()):r.push((15&a)<<12|(63&c)<<6|63&i)):a<=244?s>=t-2?It():(c=e[s++],(192&c)!=128||c-144+(a<<28)>>30||(192&(i=e[s++]))!=128||(192&(n=e[s++]))!=128?(s--,It()):(a=(7&a)<<18|(63&c)<<12|(63&i)<<6|63&n,a-=65536,r.push(55296+(a>>10&1023),56320+(1023&a)))):It(),r.length>=8192&&(l=Qs(l,r),r.length=0)}s=Qs(l,r)}return s}function Qo(e){const t=dt(e.g);return Ho(e.g,t)}function _i(e,t,r){var i=dt(e.g);for(i=e.g.g+i;e.g.g<i;)r.push(t(e.g))}var Wd=class{constructor(e,t,r,i){if(qo.length){const n=qo.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=Vn(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}},ki=[];function Jo(e){return e?/^\d+$/.test(e)?(fi(e),new $n(K,te)):null:$d||($d=new $n(0,0))}var $n=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let $d;function Zo(e){return e?/^-?\d+$/.test(e)?(fi(e),new zn(K,te)):null:zd||(zd=new zn(0,0))}var zn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let zd;function fr(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 wr(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Ti(e,t){if(t>=0)wr(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Hn(e){var t=K;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 gr(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Oe(e,t,r){wr(e.g,8*t+r)}function qn(e,t){return Oe(e,t,2),t=e.g.end(),gr(e,t),t.push(e.h),t}function Kn(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 Ai(e,t,r){Oe(e,t,2),wr(e.g,r.length),gr(e,e.g.end()),gr(e,r)}function Si(e,t,r,i){r!=null&&(t=qn(e,t),i(r,e),Kn(e,t))}function Xe(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Yn=Xe(),Ro=Xe(),Xn=Xe(),Qn=Xe(),ea=Xe(),ta=Xe(),Hd=Xe(),Ci=Xe(),ra=Xe(),ia=Xe();function Qe(e,t,r){var i=e.v;Ee&&Ee in i&&(i=i[Ee])&&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 E=class{constructor(e,t){this.v=Mo(e,t,void 0,2048)}toJSON(){return Lo(this)}j(){var n;var e=Su,t=this.v,r=e.g,i=Ee;if(er&&i&&((n=t[i])==null?void 0:n[r])!=null&&Zt(dd,3),t=e.g,uo&&Ee&&uo===void 0&&(i=(r=this.v)[Ee])&&(i=i.da))try{i(r,t,Pd)}catch(s){Zs(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[x];return Ln(this,e,t)?In(this,e,!0):new this.constructor(ar(e,t,!1))}};E.prototype[tr]=rr,E.prototype.toString=function(){return this.v.toString()};var pr=class{constructor(e,t,r){this.g=e,this.h=t,e=Yn,this.l=!!e&&r===e||!1}};function Ni(e,t){return new pr(e,t,Yn)}function na(e,t,r,i,n){Si(e,r,da(t,i),n)}const qd=Ni(function(e,t,r,i,n){return e.h===2&&(Yr(e,Un(t,i,r),n),!0)},na),Kd=Ni(function(e,t,r,i,n){return e.h===2&&(Yr(e,Un(t,i,r),n),!0)},na);var Ii=Symbol(),Fi=Symbol(),Jn=Symbol(),sa=Symbol(),oa=Symbol();let aa,ca;function Wt(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 Bd||(Bd=[0,void 0,!0]);case"number":return f>0?void 0:f===0?Ud||(Ud=[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,aa??(aa=s),ca??(ca=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 pr?f=s:(f=qd,a--),f==null?void 0:f.l){s=i[++a],h=i;var d=a;typeof s=="function"&&(s=s(),h[d]=s),h=s}for(d=l+1,typeof(s=i[++a])=="number"&&s<0&&(d-=s,s=i[++a]);l<d;l++){const w=c[l];h?r(n,l,f,h,w):t(n,l,f,w)}}return i[e]=n}function la(e){return Array.isArray(e)?e[0]instanceof pr?e:[Kd,e]:[e,void 0]}function da(e,t){return e instanceof E?e.v:Array.isArray(e)?Dt(e,t):void 0}function Zn(e,t,r,i){const n=r.g;e[t]=i?(s,a,c)=>n(s,a,c,i):n}function Rn(e,t,r,i,n){const s=r.g;let a,c;e[t]=(l,h,d)=>s(l,h,d,c||(c=Wt(Fi,Zn,Rn,i).T),a||(a=es(i)),n)}function es(e){let t=e[Jn];if(t!=null)return t;const r=Wt(Fi,Zn,Rn,e);return t=r.ma?(i,n)=>aa(i,n,r):(i,n)=>{for(;Xo(n)&&n.h!=4;){var s=n.l,a=r[s];if(a==null){var c=r.ba;c&&(c=c[s])&&(c=Xd(c))!=null&&(a=r[s]=c)}if(a==null||!a(n,i,s)){if(a=(c=n).m,Ei(c),c.ha)var l=void 0;else l=c.g.g-a,c.g.g=a,l=Ho(c.g,l);a=void 0,c=i,l&&((a=c[Ee]??(c[Ee]=new Nn))[s]??(a[s]=[])).push(l)}}return(i=pi(i))&&(i.da=r.qa[oa]),!0},e[Jn]=t,e[oa]=Yd.bind(e),t}function Yd(e,t,r,i){var n=this[Fi];const s=this[Jn],a=Dt(void 0,n.T),c=pi(e);if(c){var l=!1,h=n.ba;if(h){if(n=(d,f,w)=>{if(w.length!==0)if(h[f])for(const g of w){d=Ko(g);try{l=!0,s(a,d)}finally{Yo(d)}}else i==null||i(e,f,w)},t==null)mi(c,n);else if(c!=null){const d=c[t];d&&n(c,t,d)}if(l){let d=0|e[x];if(2&d&&2048&d&&!(r!=null&&r.Ka))throw Error();const f=ir(d),w=(g,p)=>{if(at(e,g,f)!=null){if((r==null?void 0:r.Qa)===1)return;throw Error()}p!=null&&(d=se(e,d,g,p,f)),delete c[g]};t==null?po(a,0|a[x],(g,p)=>{w(g,p)}):w(t,at(a,t,f))}}}}function Xd(e){const t=(e=la(e))[0].g;if(e=e[1]){const r=es(e),i=Wt(Fi,Zn,Rn,e).T;return(n,s,a)=>t(n,s,a,i,r)}return t}function Li(e,t,r){e[t]=r.h}function Mi(e,t,r,i){let n,s;const a=r.h;e[t]=(c,l,h)=>a(c,l,h,s||(s=Wt(Ii,Li,Mi,i).T),n||(n=ua(i)))}function ua(e){let t=e[sa];if(!t){const r=Wt(Ii,Li,Mi,e);t=(i,n)=>ha(i,n,r),e[sa]=t}return t}function ha(e,t,r){po(e,0|e[x],(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=la(l))[0].h;if(l=l[1]){const d=ua(l),f=Wt(Ii,Li,Mi,l).T;l=a.ma?ca(f,d):(w,g,p)=>h(w,g,p,f,d)}else l=h;return a[c]=l}}(r,i);s?s(t,n,i):i<500||Zt(mn,3)}}),(e=pi(e))&&mi(e,(i,n,s)=>{for(gr(t,t.g.end()),i=0;i<s.length;i++)gr(t,gn(s[i])||new Uint8Array(0))})}const Qd=ke(0);function mr(e,t){if(Array.isArray(t)){var r=0|t[x];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&&ne(t,e),2&e&&Object.freeze(t),t}}function me(e,t,r){return new pr(e,t,r)}function yr(e,t,r){return new pr(e,t,r)}function ce(e,t,r){se(e,0|e[x],t,r,ir(0|e[x]))}var Jd=Ni(function(e,t,r,i,n){if(e.h!==2)return!1;if(e=je(e=Yr(e,Dt([void 0,void 0],i),n)),n=ir(i=0|t[x]),2&i)throw Error();let s=at(t,r,n);if(s instanceof ot)2&s.J?(s=s.V(),s.push(e),se(t,i,r,s,n)):s.Ma(e);else if(Array.isArray(s)){var a=0|s[x];8192&a||ne(s,a|=8192),2&a&&(s=Uo(s),se(t,i,r,s,n)),s.push(e)}else se(t,i,r,Gr([e]),n);return!0},function(e,t,r,i,n){if(t instanceof ot)t.forEach((s,a)=>{Si(e,r,Dt([a,s],i),n)});else if(Array.isArray(t)){for(let s=0;s<t.length;s++){const a=t[s];Array.isArray(a)&&Si(e,r,Dt(a,i),n)}Gr(t)}});function fa(e,t,r){(t=Ye(t))!=null&&(Oe(e,r,5),e=e.g,vn(t),Hn(e))}function wa(e,t,r){if(t=function(i){if(i==null)return i;const n=typeof i;if(n==="bigint")return String(jr(64,i));if(zr(i)){if(n==="string")return Ao(i);if(n==="number")return Tn(i)}}(t),t!=null&&(typeof t=="string"&&Zo(t),t!=null))switch(Oe(e,r,0),typeof t){case"number":e=e.g,nr(t),fr(e,K,te);break;case"bigint":r=BigInt.asUintN(64,t),r=new zn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),fr(e.g,r.h,r.g);break;default:r=Zo(t),fr(e.g,r.h,r.g)}}function ga(e,t,r){(t=or(t))!=null&&t!=null&&(Oe(e,r,0),Ti(e.g,t))}function pa(e,t,r){(t=_o(t))!=null&&(Oe(e,r,0),e.g.g.push(t?1:0))}function ma(e,t,r){(t=fe(t))!=null&&Ai(e,r,Js(t))}function ya(e,t,r,i,n){Si(e,r,da(t,i),n)}function ba(e,t,r){(t=t==null||typeof t=="string"||t instanceof qe?t:void 0)!=null&&Ai(e,r,Vn(t,!0).buffer)}function va(e,t,r){return(e.h===5||e.h===2)&&(t=dr(t,0|t[x],r),e.h==2?_i(e,xi,t):t.push(xi(e.g)),!0)}var re=me(function(e,t,r){return e.h===5&&(ce(t,r,xi(e.g)),!0)},fa,Ci),Zd=yr(va,function(e,t,r){if((t=mr(Ye,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&(Oe(i,n,5),i=i.g,vn(s),Hn(i))}},Ci),ts=yr(va,function(e,t,r){if((t=mr(Ye,t))!=null&&t.length){Oe(e,r,2),wr(e.g,4*t.length);for(let i=0;i<t.length;i++)r=e.g,vn(t[i]),Hn(r)}},Ci),Rd=me(function(e,t,r){return e.h===5&&(ce(t,r,(e=xi(e.g))===0?void 0:e),!0)},fa,Ci),xt=me(function(e,t,r){return hn?(e.h!==0?e=!1:(ce(t,r,hr(e.g,xo)),e=!0),e):e.h===0&&(ce(t,r,hr(e.g,En)),!0)},wa,ta),rs=me(function(e,t,r){return hn?(e.h!==0?t=!1:(ce(t,r,(e=hr(e.g,xo))===Qd?void 0:e),t=!0),t):e.h===0&&(ce(t,r,(e=hr(e.g,En))===0?void 0:e),!0)},wa,ta),eu=me(function(e,t,r){return hn?(e.h!==0?e=!1:(ce(t,r,hr(e.g,Ed)),e=!0),e):e.h===0&&(ce(t,r,hr(e.g,xn)),!0)},function(e,t,r){if(t=function(i){if(i==null)return i;var n=typeof i;if(n==="bigint")return String(_d(64,i));if(zr(i)){if(n==="string")return n=sr(Number(i)),Pt(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"))||(fi(i),i=Vr(K,te))),i;if(n==="number")return(i=sr(i))>=0&&Pt(i)||(nr(i),i=xn(K,te)),i}}(t),t!=null&&(typeof t=="string"&&Jo(t),t!=null))switch(Oe(e,r,0),typeof t){case"number":e=e.g,nr(t),fr(e,K,te);break;case"bigint":r=BigInt.asUintN(64,t),r=new $n(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),fr(e.g,r.h,r.g);break;default:r=Jo(t),fr(e.g,r.h,r.g)}},Hd),le=me(function(e,t,r){return e.h===0&&(ce(t,r,vt(e.g)),!0)},ga,Qn),Xr=yr(function(e,t,r){return(e.h===0||e.h===2)&&(t=dr(t,0|t[x],r),e.h==2?_i(e,vt,t):t.push(vt(e.g)),!0)},function(e,t,r){if((t=mr(or,t))!=null&&t.length){r=qn(e,r);for(let i=0;i<t.length;i++)Ti(e.g,t[i]);Kn(e,r)}},Qn),br=me(function(e,t,r){return e.h===0&&(ce(t,r,(e=vt(e.g))===0?void 0:e),!0)},ga,Qn),R=me(function(e,t,r){return e.h===0&&(ce(t,r,jn(e.g)),!0)},pa,Ro),$t=me(function(e,t,r){return e.h===0&&(ce(t,r,(e=jn(e.g))===!1?void 0:e),!0)},pa,Ro),ge=yr(function(e,t,r){return e.h===2&&(e=Wn(e),dr(t,0|t[x],r).push(e),!0)},function(e,t,r){if((t=mr(fe,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&Ai(i,n,Js(s))}},Xn),Et=me(function(e,t,r){return e.h===2&&(ce(t,r,(e=Wn(e))===""?void 0:e),!0)},ma,Xn),W=me(function(e,t,r){return e.h===2&&(ce(t,r,Wn(e)),!0)},ma,Xn),de=function(e,t,r=Yn){return new pr(e,t,r)}(function(e,t,r,i,n){return e.h===2&&(i=Dt(void 0,i),dr(t,0|t[x],r).push(i),Yr(e,i,n),!0)},function(e,t,r,i,n){if(Array.isArray(t)){for(let s=0;s<t.length;s++)ya(e,t[s],r,i,n);1&(e=0|t[x])||ne(t,1|e)}}),ee=Ni(function(e,t,r,i,n,s){if(e.h!==2)return!1;let a=0|t[x];return Go(t,a,s,r,ir(a)),Yr(e,t=Un(t,i,r),n),!0},ya),xa=me(function(e,t,r){return e.h===2&&(ce(t,r,Qo(e)),!0)},ba,ra),tu=yr(function(e,t,r){return(e.h===0||e.h===2)&&(t=dr(t,0|t[x],r),e.h==2?_i(e,dt,t):t.push(dt(e.g)),!0)},function(e,t,r){if((t=mr(ko,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&(Oe(i,n,0),wr(i.g,s))}},ea),ru=me(function(e,t,r){return e.h===0&&(ce(t,r,(e=dt(e.g))===0?void 0:e),!0)},function(e,t,r){(t=ko(t))!=null&&t!=null&&(Oe(e,r,0),wr(e.g,t))},ea),Ae=me(function(e,t,r){return e.h===0&&(ce(t,r,vt(e.g)),!0)},function(e,t,r){(t=or(t))!=null&&(t=parseInt(t,10),Oe(e,r,0),Ti(e.g,t))},ia);class iu{constructor(t,r){var i=Se;this.g=t,this.h=r,this.m=O,this.j=T,this.defaultValue=void 0,this.l=i.Oa!=null?mo:void 0}register(){di(this)}}function Je(e,t){return new iu(e,t)}function _t(e,t){return(r,i)=>{{const s={ea:!0};i&&Object.assign(s,i),r=Ko(r,void 0,void 0,s);try{const a=new e,c=a.v;es(t)(c,r);var n=a}finally{Yo(r)}}return n}}function Pi(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}}}};ha(this.v,t,Wt(Ii,Li,Mi,e)),gr(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 Ea=class extends E{constructor(e){super(e)}},_a=[0,Et,me(function(e,t,r){return e.h===2&&(ce(t,r,(e=Qo(e))===Ft()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof E){const i=t.Ra;return void(i?(t=i(t),t!=null&&Ai(e,r,Vn(t,!0).buffer)):Zt(mn,3))}if(Array.isArray(t))return void Zt(mn,3)}ba(e,t,r)},ra)];let is,ka=globalThis.trustedTypes;function Ta(e){var t;return is===void 0&&(is=function(){let r=null;if(!ka)return r;try{const i=n=>n;r=ka.createPolicy("goog#html",{createHTML:i,createScript:i,createScriptURL:i})}catch{}return r}()),e=(t=is)?t.createScriptURL(e):e,new class{constructor(r){this.g=r}toString(){return this.g+""}}(e)}function nu(e,...t){if(t.length===0)return Ta(e[0]);let r=e[0];for(let i=0;i<t.length;i++)r+=encodeURIComponent(t[i])+e[i+1];return Ta(r)}var Aa=[0,le,Ae,R,-1,Xr,Ae,-1,R],su=class extends E{constructor(e){super(e)}},Sa=[0,R,W,R,Ae,-1,yr(function(e,t,r){return(e.h===0||e.h===2)&&(t=dr(t,0|t[x],r),e.h==2?_i(e,jd,t):t.push(vt(e.g)),!0)},function(e,t,r){if((t=mr(or,t))!=null&&t.length){r=qn(e,r);for(let i=0;i<t.length;i++)Ti(e.g,t[i]);Kn(e,r)}},ia),W,-1,[0,R,-1],Ae,R,-1],Ca=[0,3,R,-1,2,[0,le],[0,Ae,R],[0,W,-1],[0]],Na=[0,W,-2],Ia=class extends E{constructor(e){super(e)}},Fa=[0],La=[0,le,R,1,R,-4],Se=class extends E{constructor(e){super(e,2)}},oe={};oe[336783863]=[0,W,R,-1,le,[0,[1,2,3,4,5,6,7,8,9],ee,Fa,ee,Sa,ee,Na,ee,La,ee,Aa,ee,[0,W,-2],ee,[0,W,Ae],ee,Ca,ee,[0,Ae,-1,R]],[0,W],R,[0,[1,3],[2,4],ee,[0,Xr],-1,ee,[0,ge],-1,de,[0,W,-1]],W];var Ma=[0,rs,-1,$t,-3,rs,Xr,Et,br,rs,-1,$t,br,$t,-2,Et];function H(e,t){vi(e,3,t)}function F(e,t){vi(e,4,t)}var be=class extends E{constructor(e){super(e,500)}o(e){return T(this,0,7,e)}},Qr=[-1,{}],Pa=[0,W,1,Qr],Da=[0,W,ge,Qr];function Be(e,t){Gn(e,1,be,t)}function Y(e,t){vi(e,10,t)}function B(e,t){vi(e,15,t)}var Ce=class extends E{constructor(e){super(e,500)}o(e){return T(this,0,1001,e)}},Oa=[-500,de,[-500,Et,-1,ge,-3,[-2,oe,R],de,_a,br,-1,Pa,Da,de,[0,Et,$t],Et,Ma,br,ge,987,ge],4,de,[-500,W,-1,[-1,{}],998,W],de,[-500,W,ge,-1,[-2,{},R],997,ge,-1],br,de,[-500,W,ge,Qr,998,ge],ge,br,Pa,Da,de,[0,Et,-1,Qr],ge,-2,Ma,Et,-1,$t,[0,$t,ru],978,Qr,de,_a];Ce.prototype.g=Pi(Oa);var ou=_t(Ce,Oa),au=class extends E{constructor(e){super(e)}},Ba=class extends E{constructor(e){super(e)}g(){return ct(this,au,1)}},Ua=[0,de,[0,le,re,W,-1]],Di=_t(Ba,Ua),cu=class extends E{constructor(e){super(e)}},lu=class extends E{constructor(e){super(e)}},ns=class extends E{constructor(e){super(e)}l(){return O(this,cu,2)}g(){return ct(this,lu,5)}},Ga=_t(class extends E{constructor(e){super(e)}},[0,ge,Xr,ts,[0,Ae,[0,le,-3],[0,re,-3],[0,le,-1,[0,de,[0,le,-2]]],de,[0,re,-1,W,re]],W,-1,xt,de,[0,le,re],ge,xt]),Va=class extends E{constructor(e){super(e)}},vr=_t(class extends E{constructor(e){super(e)}},[0,de,[0,re,-4]]),ja=class extends E{constructor(e){super(e)}},Jr=_t(class extends E{constructor(e){super(e)}},[0,de,[0,re,-4]]),du=class extends E{constructor(e){super(e)}},uu=[0,le,-1,ts,Ae],Wa=class extends E{constructor(e){super(e)}};Wa.prototype.g=Pi([0,re,-4,xt]);var hu=class extends E{constructor(e){super(e)}},fu=_t(class extends E{constructor(e){super(e)}},[0,de,[0,1,le,W,Ua],xt]),$a=class extends E{constructor(e){super(e)}},wu=class extends E{constructor(e){super(e)}na(){const e=z(this,1,void 0,void 0,Bo);return e??Ft()}},gu=class extends E{constructor(e){super(e)}},za=[1,2],pu=_t(class extends E{constructor(e){super(e)}},[0,de,[0,za,ee,[0,ts],ee,[0,xa],le,W],xt]),ss=class extends E{constructor(e){super(e)}},Ha=[0,W,le,re,ge,-1],qa=class extends E{constructor(e){super(e)}},mu=[0,R,-1],Ka=class extends E{constructor(e){super(e)}},Oi=[1,2,3,4,5,6],Bi=class extends E{constructor(e){super(e)}g(){return z(this,1,void 0,void 0,Bo)!=null}l(){return fe(z(this,2))!=null}},Q=class extends E{constructor(e){super(e)}g(){return _o(z(this,2))??!1}},Ya=[0,xa,W,[0,le,xt,-1],[0,eu,xt]],ie=[0,Ya,R,[0,Oi,ee,La,ee,Sa,ee,Aa,ee,Fa,ee,Na,ee,Ca],Ae],Ui=class extends E{constructor(e){super(e)}},os=[0,ie,re,-1,le],yu=Je(502141897,Ui);oe[502141897]=os;var bu=_t(class extends E{constructor(e){super(e)}},[0,[0,Ae,-1,Zd,tu],uu]),Xa=class extends E{constructor(e){super(e)}},Qa=class extends E{constructor(e){super(e)}},as=[0,ie,re,[0,ie],R],vu=Je(508968150,Qa);oe[508968150]=[0,ie,os,as,re,[0,[0,Ya]]],oe[508968149]=as;var xr=class extends E{constructor(e){super(e)}l(){return O(this,ss,2)}g(){G(this,2)}},Ja=[0,ie,Ha];oe[478825465]=Ja;var xu=class extends E{constructor(e){super(e)}},Za=class extends E{constructor(e){super(e)}},cs=class extends E{constructor(e){super(e)}},ls=class extends E{constructor(e){super(e)}},Ra=class extends E{constructor(e){super(e)}},ec=[0,ie,[0,ie],Ja,-1],tc=[0,ie,re,le],ds=[0,ie,re],rc=[0,ie,tc,ds,re],Eu=Je(479097054,Ra);oe[479097054]=[0,ie,rc,ec],oe[463370452]=ec,oe[464864288]=tc;var _u=Je(462713202,ls);oe[462713202]=rc,oe[474472470]=ds;var ku=class extends E{constructor(e){super(e)}},ic=class extends E{constructor(e){super(e)}},nc=class extends E{constructor(e){super(e)}},sc=class extends E{constructor(e){super(e)}},us=[0,ie,re,-1,le],hs=[0,ie,re,R];sc.prototype.g=Pi([0,ie,ds,[0,ie],os,as,us,hs]);var oc=class extends E{constructor(e){super(e)}},Tu=Je(456383383,oc);oe[456383383]=[0,ie,Ha];var ac=class extends E{constructor(e){super(e)}},Au=Je(476348187,ac);oe[476348187]=[0,ie,mu];var cc=class extends E{constructor(e){super(e)}},lc=class extends E{constructor(e){super(e)}},dc=[0,Ae,-1],Su=Je(458105876,class extends E{constructor(e){super(e)}g(){let e;var t=this.v;const r=0|t[x];return e=_e(this,r),t=function(i,n,s,a){var c=lc;!a&&cr(i)&&(s=0|(n=i.v)[x]);var l=at(n,2);if(i=!1,l==null){if(a)return Fo();l=[]}else if(l.constructor===ot){if(!(2&l.J)||a)return l;l=l.V()}else Array.isArray(l)?i=!!(2&(0|l[x])):l=[];if(a){if(!l.length)return Fo();i||(i=!0,Ur(l))}else i&&(i=!1,Gr(l),l=Uo(l));return!i&&32&s&&Br(l,32),s=se(n,s,2,a=new ot(l,c,Sd,void 0)),i||Ot(n,s),a}(this,t,r,e),!e&&lc&&(t.ra=!0),t}});oe[458105876]=[0,dc,Jd,[!0,xt,[0,W,-1,ge]],[0,Xr,R,Ae]];var fs=class extends E{constructor(e){super(e)}},uc=Je(458105758,fs);oe[458105758]=[0,ie,W,dc];var ws=class extends E{constructor(e){super(e)}},hc=[0,Rd,-1,$t],Cu=class extends E{constructor(e){super(e)}},fc=class extends E{constructor(e){super(e)}},gs=[1,2];fc.prototype.g=Pi([0,gs,ee,hc,ee,[0,de,hc]]);var wc=class extends E{constructor(e){super(e)}},Nu=Je(443442058,wc);oe[443442058]=[0,ie,W,le,re,ge,-1,R,re],oe[514774813]=us;var gc=class extends E{constructor(e){super(e)}},Iu=Je(516587230,gc);function ps(e,t){return t=t?t.clone():new ss,e.displayNamesLocale!==void 0?G(t,1,Hr(e.displayNamesLocale)):e.displayNamesLocale===void 0&&G(t,1),e.maxResults!==void 0?lt(t,2,e.maxResults):"maxResults"in e&&G(t,2),e.scoreThreshold!==void 0?k(t,3,e.scoreThreshold):"scoreThreshold"in e&&G(t,3),e.categoryAllowlist!==void 0?bi(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&G(t,4),e.categoryDenylist!==void 0?bi(t,5,e.categoryDenylist):"categoryDenylist"in e&&G(t,5),t}function pc(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function ms(e,t=-1,r=""){return{categories:e.map(i=>({index:De(i,1)??0??-1,score:Z(i,2)??0,categoryName:fe(z(i,3))??""??"",displayName:fe(z(i,4))??""??""})),headIndex:t,headName:r}}function Fu(e){const t={classifications:ct(e,hu,1).map(r=>{var i;return ms(((i=O(r,Ba,4))==null?void 0:i.g())??[],De(r,2)??0,fe(z(r,3))??"")})};return function(r){return Ad(fn?z(r,2,void 0,void 0,gi):z(r,2))}(e)!=null&&(t.timestampMs=pc($o(e))),t}function mc(e){var a,c;var t=Ut(e,3,Ye,Bt()),r=Ut(e,2,or,Bt()),i=Ut(e,1,fe,Bt()),n=Ut(e,9,fe,Bt());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=O(e,ns,4))==null?void 0:a.l())&&(s.boundingBox={originX:De(t,1,yt)??0,originY:De(t,2,yt)??0,width:De(t,3,yt)??0,height:De(t,4,yt)??0,angle:0}),(c=O(e,ns,4))==null?void 0:c.g().length)for(const l of O(e,ns,4).g())s.keypoints.push({x:z(l,1,void 0,yt,Ye)??0,y:z(l,2,void 0,yt,Ye)??0,score:z(l,4,void 0,yt,Ye)??0,label:fe(z(l,3,void 0,yt))??""});return s}function Gi(e){const t=[];for(const r of ct(e,ja,1))t.push({x:Z(r,1)??0,y:Z(r,2)??0,z:Z(r,3)??0,visibility:Z(r,4)??0});return t}function Zr(e){const t=[];for(const r of ct(e,Va,1))t.push({x:Z(r,1)??0,y:Z(r,2)??0,z:Z(r,3)??0,visibility:Z(r,4)??0});return t}function yc(e){return Array.from(e,t=>t>127?t-256:t)}function bc(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 Vi;oe[516587230]=[0,ie,us,hs,re],oe[518928384]=hs;const Lu=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 vc(){if(Vi===void 0)try{await WebAssembly.instantiate(Lu),Vi=!0}catch{Vi=!1}return Vi}async function Rr(e,t=nu``){const r=await vc()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var zt=class{};function xc(){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 Ec(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 _c(e){return e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height]}function _(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function kc(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]=_c(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 Tc(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 Ze(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function kt(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)}}zt.forVisionTasks=function(e){return Rr("vision",e)},zt.forTextTasks=function(e){return Rr("text",e)},zt.forGenAiExperimentalTasks=function(e){return Rr("genai_experimental",e)},zt.forGenAiTasks=function(e){return Rr("genai",e)},zt.forAudioTasks=function(e){return Rr("audio",e)},zt.isSimdSupported=function(){return vc()};async function Mu(e,t,r,i){return e=await(async(n,s,a,c,l)=>{if(s&&await Ec(s),!self.ModuleFactory||a&&(await Ec(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 ys(e,t){const r=O(e.baseOptions,Bi,1)||new Bi;typeof t=="string"?(G(r,2,Hr(t)),G(r,1)):t instanceof Uint8Array&&(G(r,1,yn(t,!1)),G(r,2)),T(e.baseOptions,0,1,r)}function Ac(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 v(e,t){e.C=Math.max(e.C,t)}function ji(e,t){e.B=new be,Te(e.B,2,"PassThroughCalculator"),H(e.B,"free_memory"),F(e.B,"free_memory_unused_out"),Y(t,"free_memory"),Be(t,e.B)}function Er(e,t){H(e.B,t),F(e.B,t+"_unused_out")}function Wi(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var bs=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=O(this.baseOptions,Bi,1))!=null&&n.g()||(s=O(this.baseOptions,Bi,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,d){let f=O(h.baseOptions,Ka,3);if(!f){var w=f=new Ka,g=new Ia;Kr(w,4,Oi,g)}"delegate"in d&&(d.delegate==="GPU"?(d=f,w=new su,Kr(d,2,Oi,w)):(d=f,w=new Ia,Kr(d,4,Oi,w))),T(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),ys(this,"/model.dat"),this.m(),this.L()});if(l.modelAssetBuffer instanceof Uint8Array)ys(this,l.modelAssetBuffer);else if(l.modelAssetBuffer)return async function(h){const d=[];for(var f=0;;){const{done:w,value:g}=await h.read();if(w)break;d.push(g),f+=g.length}if(d.length===0)return new Uint8Array(0);if(d.length===1)return d[0];h=new Uint8Array(f),f=0;for(const w of d)h.set(w,f),f+=w.length;return h}(l.modelAssetBuffer).then(h=>{ys(this,h),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca(t=>{e=ou(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,Ac(this)}finishProcessing(){this.g.finishProcessing(),Ac(this)}close(){this.B=void 0,this.g.closeGraph()}};function Tt(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}bs.prototype.close=bs.prototype.close;class Pu{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 Sc(e,t,r){const i=e.g;if(r=Tt(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 Cc(e,t){const r=e.g,i=Tt(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(i);const n=Tt(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=Tt(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 Pu(r,i,n,s)}function vs(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Du(e,t,r,i){return vs(e,t),e.h||(e.m(),e.D()),r?(e.u||(e.u=Cc(e,!0)),r=e.u):(e.A||(e.A=Cc(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=i(),r.g.bindVertexArray(null),e}function Nc(e,t,r){return vs(e,t),e=Tt(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 Ic(e,t,r){vs(e,t),e.B||(e.B=Tt(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 Ou(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Fc=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=Tt(e.createProgram(),"Failed to create WebGL program"),this.X=Sc(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=Ac(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 ht(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 Es(e){var t=ht(e,1);if(!t){if(t=ht(e,0))t=new Float32Array(t).map(i=>i/255);else{t=new Float32Array(e.width*e.height);const i=_r(e);var r=ks(e);if(Fc(r,i,Mc(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 Mc(e){let t=ht(e,2);if(!t){const r=_r(e);t=Dc(e);const i=Es(e),n=Pc(e);r.texImage2D(r.TEXTURE_2D,0,n,e.width,e.height,0,r.RED,r.FLOAT,i),_s(e)}return t}function _r(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=Nt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Pc(e){if(e=_r(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 ks(e){return e.l||(e.l=new Lc),e.l}function Dc(e){const t=_r(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=ht(e,2);return r||(r=Ic(ks(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function _s(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var zi,ue=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&&--Oc===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!ht(this,0)}ka(){return!!ht(this,1)}R(){return!!ht(this,2)}ja(){return(t=ht(e=this,0))||(t=Es(e),t=new Uint8Array(t.map(r=>Math.round(255*r))),e.g.push(t)),t;var e,t}ia(){return Es(this)}N(){return Mc(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=_r(this),n=ks(this);i.activeTexture(i.TEXTURE1),r=Ic(n,i,this.m?i.LINEAR:i.NEAREST),i.bindTexture(i.TEXTURE_2D,r);const s=Pc(this);i.texImage2D(i.TEXTURE_2D,0,s,this.width,this.height,0,i.RED,i.FLOAT,null),i.bindTexture(i.TEXTURE_2D,null),Fc(n,i,r),U2(n,i,!1,()=>{Dc(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),_s(this)}),G2(n),_s(this)}}e.push(r)}return new ue(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&_r(this).deleteTexture(ht(this,2)),Oc=-1}};ue.prototype.close=ue.prototype.close,ue.prototype.clone=ue.prototype.clone,ue.prototype.getAsWebGLTexture=ue.prototype.N,ue.prototype.getAsFloat32Array=ue.prototype.ia,ue.prototype.getAsUint8Array=ue.prototype.ja,ue.prototype.hasWebGLTexture=ue.prototype.R,ue.prototype.hasFloat32Array=ue.prototype.ka,ue.prototype.hasUint8Array=ue.prototype.Fa;var Oc=250;function $e(...e){return e.map(([t,r])=>({start:t,end:r}))}const V2=function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}}((Bc=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:Ec()?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){et(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]=Nc(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=>{Tc(this,Object.keys(e),n=>{Tc(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){et(this,e,t),k(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){_t(this,e,t),k(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){et(this,e,t),k(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){_t(this,e,t),k(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){et(this,e,t),k(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){_t(this,e,t),k(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){et(this,e,t),k(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){_t(this,e,t),k(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){et(this,e,t),k(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){_t(this,e,t),k(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){et(this,e,t),k(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){_t(this,e,t),k(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){et(this,e,t),k(this,e,i=>{this.i._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){_t(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?'),et(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 Bc{get ga(){return this.i}pa(e,t,r){k(this,t,i=>{const[n,s]=Nc(this,e,i);this.ga._addBoundTextureAsImageToStream(i,n,s,r)})}Z(e,t){et(this,e,t),k(this,e,r=>{this.ga._attachImageListener(r)})}aa(e,t){_t(this,e,t),k(this,e,r=>{this.ga._attachImageVectorListener(r)})}}));var Bc,ze=class extends V2{};async function M(e,t,r){return async function(i,n,s,a){return O2(i,n,s,a)}(e,r.canvas??(Ec()?void 0:document.createElement("canvas")),t,r)}function Uc(e,t,r,i){if(e.U){const s=new $a;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].");_(s,1,(n.left+n.right)/2),_(s,2,(n.top+n.bottom)/2),_(s,4,n.right-n.left),_(s,3,n.bottom-n.top)}else _(s,1,.5),_(s,2,.5),_(s,4,1),_(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(_(s,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[a,c]=_c(t);r=J(s,3)*c/a,n=J(s,4)*a/c,_(s,4,r),_(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 He(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'.");Uc(e,t,r,e.C+1)}function tt(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'.");Uc(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 ue([n],r,!1,e.g.i.canvas,e.P,s,t),i?e.clone():e}var Ae=class extends vs{constructor(e,t,r,i){super(e),this.g=e,this.X=t,this.U=r,this.oa=i,this.P=new Lc}l(e,t=!0){if("runningMode"in e&&B(this.baseOptions,2,$r(!!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()}};Ae.prototype.close=Ae.prototype.close;var Be=class extends Ae{constructor(e,t){super(new ze(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},N(e=this.h=new Gi,0,1,t=new Y),_(this.h,2,.5),_(this.h,3,.3)}get baseOptions(){return D(this.h,Y,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&_(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&_(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},He(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},tt(this,e,r,t),this.j}m(){var e=new Se;q(e,"image_in"),q(e,"norm_rect_in"),O(e,"detections");const t=new Te;Ze(t,x2,this.h);const r=new ye;_e(r,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),$(r,"IMAGE:image_in"),$(r,"NORM_RECT:norm_rect_in"),F(r,"DETECTIONS:detections"),r.o(t),Oe(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Va(s),this.j.detections.push(yc(i));v(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Be.prototype.detectForVideo=Be.prototype.G,Be.prototype.detect=Be.prototype.F,Be.prototype.setOptions=Be.prototype.o,Be.createFromModelPath=async function(e,t){return M(Be,e,{baseOptions:{modelAssetPath:t}})},Be.createFromModelBuffer=function(e,t){return M(Be,e,{baseOptions:{modelAssetBuffer:t}})},Be.createFromOptions=function(e,t){return M(Be,e,t)};var Ns=$e([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=$e([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]),Ss=$e([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Gc=$e([474,475],[475,476],[476,477],[477,474]),As=$e([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]),Cs=$e([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Vc=$e([469,470],[470,471],[471,472],[472,469]),Is=$e([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=[...Ns,...Ts,...Ss,...As,...Cs,...Is],Wc=$e([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 $c(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var K=class extends Ae{constructor(e,t){super(new ze(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,N(e=this.h=new Ja,0,1,t=new Y),this.A=new Qa,N(this.h,0,3,this.A),this.u=new Gi,N(this.h,0,2,this.u),dt(this.u,4,1),_(this.u,2,.5),_(this.A,2,.5),_(this.h,4,.5)}get baseOptions(){return D(this.h,Y,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return"numFaces"in e&&dt(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&_(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&_(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 $c(this),He(this,e,t),this.j}G(e,t,r){return $c(this),tt(this,e,r,t),this.j}m(){var e=new Se;q(e,"image_in"),q(e,"norm_rect"),O(e,"face_landmarks");const t=new Te;Ze(t,k2,this.h);const r=new ye;_e(r,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),$(r,"IMAGE:image_in"),$(r,"NORM_RECT:norm_rect"),F(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Oe(e,r),this.g.attachProtoVectorListener("face_landmarks",(i,n)=>{for(const s of i)i=Jr(s),this.j.faceLandmarks.push(Vi(i));v(this,n)}),this.g.attachEmptyPacketListener("face_landmarks",i=>{v(this,i)}),this.outputFaceBlendshapes&&(O(e,"blendshapes"),F(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(i,n)=>{if(this.outputFaceBlendshapes)for(const s of i)i=Oi(s),this.j.faceBlendshapes.push(ys(i.g()??[]));v(this,n)}),this.g.attachEmptyPacketListener("blendshapes",i=>{v(this,i)})),this.outputFacialTransformationMatrixes&&(O(e,"face_geometry"),F(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(i,n)=>{if(this.outputFacialTransformationMatrixes)for(const s of i)(i=D(i=E2(s),f2,2))&&this.j.facialTransformationMatrixes.push({rows:Pe(i,1)??0??0,columns:Pe(i,2)??0??0,data:Vt(i,3,Qe,Gt()).slice()??[]});v(this,n)}),this.g.attachEmptyPacketListener("face_geometry",i=>{v(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};K.prototype.detectForVideo=K.prototype.G,K.prototype.detect=K.prototype.F,K.prototype.setOptions=K.prototype.o,K.createFromModelPath=function(e,t){return M(K,e,{baseOptions:{modelAssetPath:t}})},K.createFromModelBuffer=function(e,t){return M(K,e,{baseOptions:{modelAssetBuffer:t}})},K.createFromOptions=function(e,t){return M(K,e,t)},K.FACE_LANDMARKS_LIPS=Ns,K.FACE_LANDMARKS_LEFT_EYE=Ts,K.FACE_LANDMARKS_LEFT_EYEBROW=Ss,K.FACE_LANDMARKS_LEFT_IRIS=Gc,K.FACE_LANDMARKS_RIGHT_EYE=As,K.FACE_LANDMARKS_RIGHT_EYEBROW=Cs,K.FACE_LANDMARKS_RIGHT_IRIS=Vc,K.FACE_LANDMARKS_FACE_OVAL=Is,K.FACE_LANDMARKS_CONTOURS=jc,K.FACE_LANDMARKS_TESSELATION=Wc;var Fs=$e([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function zc(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Hc(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 qc(e,t=!0){const r=[];for(const n of e){var i=Oi(n);e=[];for(const s of i.g())i=t&&Pe(s,1)!=null?Pe(s,1)??0:-1,e.push({score:J(s,2)??0,index:i,categoryName:fe(W(s,3))??""??"",displayName:fe(W(s,4))??""??""});r.push(e)}return r}var Ce=class extends Ae{constructor(e,t){super(new ze(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],N(e=this.j=new ec,0,1,t=new Y),this.u=new ds,N(this.j,0,2,this.u),this.D=new ls,N(this.u,0,3,this.D),this.A=new Ra,N(this.u,0,2,this.A),this.h=new _2,N(this.j,0,3,this.h),_(this.A,2,.5),_(this.u,4,.5),_(this.D,2,.5)}get baseOptions(){return D(this.j,Y,1)}set baseOptions(e){N(this.j,0,1,e)}o(e){var n,s,a,c;if(dt(this.A,3,e.numHands??1),"minHandDetectionConfidence"in e&&_(this.A,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.u,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&_(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new Er,r=t,i=ms(e.cannedGesturesClassifierOptions,(n=D(this.h,Er,3))==null?void 0:n.l());N(r,0,2,i),N(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((s=D(this.h,Er,3))==null||s.g());return e.customGesturesClassifierOptions?(N(r=t=new Er,0,2,i=ms(e.customGesturesClassifierOptions,(a=D(this.h,Er,4))==null?void 0:a.l())),N(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((c=D(this.h,Er,4))==null||c.g()),this.l(e)}Ha(e,t){return zc(this),He(this,e,t),Hc(this)}Ia(e,t,r){return zc(this),tt(this,e,r,t),Hc(this)}m(){var e=new Se;q(e,"image_in"),q(e,"norm_rect"),O(e,"hand_gestures"),O(e,"hand_landmarks"),O(e,"world_hand_landmarks"),O(e,"handedness");const t=new Te;Ze(t,N2,this.j);const r=new ye;_e(r,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),$(r,"IMAGE:image_in"),$(r,"NORM_RECT:norm_rect"),F(r,"HAND_GESTURES:hand_gestures"),F(r,"LANDMARKS:hand_landmarks"),F(r,"WORLD_LANDMARKS:world_hand_landmarks"),F(r,"HANDEDNESS:handedness"),r.o(t),Oe(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i){i=Jr(s);const a=[];for(const c of lt(i,Wa,1))a.push({x:J(c,1)??0,y:J(c,2)??0,z:J(c,3)??0,visibility:J(c,4)??0});this.landmarks.push(a)}v(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{v(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i){i=xr(s);const a=[];for(const c of lt(i,ja,1))a.push({x:J(c,1)??0,y:J(c,2)??0,z:J(c,3)??0,visibility:J(c,4)??0});this.worldLandmarks.push(a)}v(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{v(this,i)}),this.g.attachProtoVectorListener("hand_gestures",(i,n)=>{this.gestures.push(...qc(i,!1)),v(this,n)}),this.g.attachEmptyPacketListener("hand_gestures",i=>{v(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{this.handedness.push(...qc(i)),v(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Kc(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Ce.prototype.recognizeForVideo=Ce.prototype.Ia,Ce.prototype.recognize=Ce.prototype.Ha,Ce.prototype.setOptions=Ce.prototype.o,Ce.createFromModelPath=function(e,t){return M(Ce,e,{baseOptions:{modelAssetPath:t}})},Ce.createFromModelBuffer=function(e,t){return M(Ce,e,{baseOptions:{modelAssetBuffer:t}})},Ce.createFromOptions=function(e,t){return M(Ce,e,t)},Ce.HAND_CONNECTIONS=Fs;var Ie=class extends Ae{constructor(e,t){super(new ze(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],N(e=this.h=new ds,0,1,t=new Y),this.u=new ls,N(this.h,0,3,this.u),this.j=new Ra,N(this.h,0,2,this.j),dt(this.j,3,1),_(this.j,2,.5),_(this.u,2,.5),_(this.h,4,.5)}get baseOptions(){return D(this.h,Y,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return"numHands"in e&&dt(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&_(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&_(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],He(this,e,t),Kc(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],tt(this,e,r,t),Kc(this)}m(){var e=new Se;q(e,"image_in"),q(e,"norm_rect"),O(e,"hand_landmarks"),O(e,"world_hand_landmarks"),O(e,"handedness");const t=new Te;Ze(t,T2,this.h);const r=new ye;_e(r,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),$(r,"IMAGE:image_in"),$(r,"NORM_RECT:norm_rect"),F(r,"LANDMARKS:hand_landmarks"),F(r,"WORLD_LANDMARKS:world_hand_landmarks"),F(r,"HANDEDNESS:handedness"),r.o(t),Oe(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i)i=Jr(s),this.landmarks.push(Vi(i));v(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{v(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i)i=xr(s),this.worldLandmarks.push(Zr(i));v(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{v(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{var s=this.handedness,a=s.push;const c=[];for(const l of i){i=Oi(l);const h=[];for(const d of i.g())h.push({score:J(d,2)??0,index:Pe(d,1)??0??-1,categoryName:fe(W(d,3))??""??"",displayName:fe(W(d,4))??""??""});c.push(h)}a.call(s,...c),v(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ie.prototype.detectForVideo=Ie.prototype.G,Ie.prototype.detect=Ie.prototype.F,Ie.prototype.setOptions=Ie.prototype.o,Ie.createFromModelPath=function(e,t){return M(Ie,e,{baseOptions:{modelAssetPath:t}})},Ie.createFromModelBuffer=function(e,t){return M(Ie,e,{baseOptions:{modelAssetBuffer:t}})},Ie.createFromOptions=function(e,t){return M(Ie,e,t)},Ie.HAND_CONNECTIONS=Fs;var Yc=$e([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 Xc(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function Qc(e){try{if(!e.D)return e.h;e.D(e.h)}finally{$i(e)}}function Hi(e,t){e=Jr(e),t.push(Vi(e))}var z=class extends Ae{constructor(e,t){super(new ze(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 oc,0,1,t=new Y),this.I=new ls,N(this.j,0,2,this.I),this.W=new S2,N(this.j,0,3,this.W),this.u=new Gi,N(this.j,0,4,this.u),this.O=new Qa,N(this.j,0,5,this.O),this.A=new nc,N(this.j,0,6,this.A),this.M=new sc,N(this.j,0,7,this.M),_(this.u,2,.5),_(this.u,3,.3),_(this.O,2,.5),_(this.A,2,.5),_(this.A,3,.3),_(this.M,2,.5),_(this.I,2,.5)}get baseOptions(){return D(this.j,Y,1)}set baseOptions(e){N(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&_(this.u,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&_(this.u,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&_(this.O,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&_(this.A,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&_(this.A,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&_(this.M,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&_(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,Xc(this),He(this,e,i),Qc(this)}G(e,t,r,i){const n=typeof r!="function"?r:{};return this.D=typeof r=="function"?r:i,Xc(this),tt(this,e,n,t),Qc(this)}m(){var e=new Se;q(e,"input_frames_image"),O(e,"pose_landmarks"),O(e,"pose_world_landmarks"),O(e,"face_landmarks"),O(e,"left_hand_landmarks"),O(e,"left_hand_world_landmarks"),O(e,"right_hand_landmarks"),O(e,"right_hand_world_landmarks");const t=new Te,r=new ka;_e(r,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),function(n,s){if(s!=null)if(Array.isArray(s))B(n,2,bi(s,0,qr));else{if(!(typeof s=="string"||s instanceof Ye||gn(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");bt(n,2,bn(s,!1),Mt())}}(r,this.j.g());const i=new ye;_e(i,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Vn(i,8,ka,r),$(i,"IMAGE:input_frames_image"),F(i,"POSE_LANDMARKS:pose_landmarks"),F(i,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),F(i,"FACE_LANDMARKS:face_landmarks"),F(i,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),F(i,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),F(i,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),F(i,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),i.o(t),Oe(e,i),Wi(this,e),this.g.attachProtoListener("pose_landmarks",(n,s)=>{Hi(n,this.h.poseLandmarks),v(this,s)}),this.g.attachEmptyPacketListener("pose_landmarks",n=>{v(this,n)}),this.g.attachProtoListener("pose_world_landmarks",(n,s)=>{var a=this.h.poseWorldLandmarks;n=xr(n),a.push(Zr(n)),v(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",n=>{v(this,n)}),this.outputPoseSegmentationMasks&&(F(i,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),kr(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",(n,s)=>{this.h.poseSegmentationMasks=[Nr(this,n,!0,!this.D)],v(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",n=>{this.h.poseSegmentationMasks=[],v(this,n)})),this.g.attachProtoListener("face_landmarks",(n,s)=>{Hi(n,this.h.faceLandmarks),v(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{v(this,n)}),this.outputFaceBlendshapes&&(O(e,"extra_blendshapes"),F(i,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(n,s)=>{var a=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=Oi(n),a.push(ys(n.g()??[]))),v(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",n=>{v(this,n)})),this.g.attachProtoListener("left_hand_landmarks",(n,s)=>{Hi(n,this.h.leftHandLandmarks),v(this,s)}),this.g.attachEmptyPacketListener("left_hand_landmarks",n=>{v(this,n)}),this.g.attachProtoListener("left_hand_world_landmarks",(n,s)=>{var a=this.h.leftHandWorldLandmarks;n=xr(n),a.push(Zr(n)),v(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",n=>{v(this,n)}),this.g.attachProtoListener("right_hand_landmarks",(n,s)=>{Hi(n,this.h.rightHandLandmarks),v(this,s)}),this.g.attachEmptyPacketListener("right_hand_landmarks",n=>{v(this,n)}),this.g.attachProtoListener("right_hand_world_landmarks",(n,s)=>{var a=this.h.rightHandWorldLandmarks;n=xr(n),a.push(Zr(n)),v(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",n=>{v(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};z.prototype.detectForVideo=z.prototype.G,z.prototype.detect=z.prototype.F,z.prototype.setOptions=z.prototype.o,z.createFromModelPath=function(e,t){return M(z,e,{baseOptions:{modelAssetPath:t}})},z.createFromModelBuffer=function(e,t){return M(z,e,{baseOptions:{modelAssetBuffer:t}})},z.createFromOptions=function(e,t){return M(z,e,t)},z.HAND_CONNECTIONS=Fs,z.POSE_CONNECTIONS=Yc,z.FACE_LANDMARKS_LIPS=Ns,z.FACE_LANDMARKS_LEFT_EYE=Ts,z.FACE_LANDMARKS_LEFT_EYEBROW=Ss,z.FACE_LANDMARKS_LEFT_IRIS=Gc,z.FACE_LANDMARKS_RIGHT_EYE=As,z.FACE_LANDMARKS_RIGHT_EYEBROW=Cs,z.FACE_LANDMARKS_RIGHT_IRIS=Vc,z.FACE_LANDMARKS_FACE_OVAL=Is,z.FACE_LANDMARKS_CONTOURS=jc,z.FACE_LANDMARKS_TESSELATION=Wc;var Ue=class extends Ae{constructor(e,t){super(new ze(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},N(e=this.h=new ac,0,1,t=new Y)}get baseOptions(){return D(this.h,Y,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return N(this.h,0,2,ms(e,D(this.h,os,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},He(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},tt(this,e,r,t),this.j}m(){var e=new Se;q(e,"input_image"),q(e,"norm_rect"),O(e,"classifications");const t=new Te;Ze(t,A2,this.h);const r=new ye;_e(r,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),$(r,"IMAGE:input_image"),$(r,"NORM_RECT:norm_rect"),F(r,"CLASSIFICATIONS:classifications"),r.o(t),Oe(e,r),this.g.attachProtoListener("classifications",(i,n)=>{this.j=P2(p2(i)),v(this,n)}),this.g.attachEmptyPacketListener("classifications",i=>{v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ue.prototype.classifyForVideo=Ue.prototype.ta,Ue.prototype.classify=Ue.prototype.sa,Ue.prototype.setOptions=Ue.prototype.o,Ue.createFromModelPath=function(e,t){return M(Ue,e,{baseOptions:{modelAssetPath:t}})},Ue.createFromModelBuffer=function(e,t){return M(Ue,e,{baseOptions:{modelAssetBuffer:t}})},Ue.createFromOptions=function(e,t){return M(Ue,e,t)};var Fe=class extends Ae{constructor(e,t){super(new ze(e,t),"image_in","norm_rect",!0),this.h=new cc,this.embeddings={embeddings:[]},N(e=this.h,0,1,t=new Y)}get baseOptions(){return D(this.h,Y,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){var t=this.h,r=D(this.h,Ka,2);return r=r?r.clone():new Ka,e.l2Normalize!==void 0?B(r,1,$r(e.l2Normalize)):"l2Normalize"in e&&B(r,1),e.quantize!==void 0?B(r,2,$r(e.quantize)):"quantize"in e&&B(r,2),N(t,0,2,r),this.l(e)}za(e,t){return He(this,e,t),this.embeddings}Aa(e,t,r){return tt(this,e,r,t),this.embeddings}m(){var e=new Se;q(e,"image_in"),q(e,"norm_rect"),O(e,"embeddings_out");const t=new Te;Ze(t,C2,this.h);const r=new ye;_e(r,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),$(r,"IMAGE:image_in"),$(r,"NORM_RECT:norm_rect"),F(r,"EMBEDDINGS:embeddings_out"),r.o(t),Oe(e,r),this.g.attachProtoListener("embeddings_out",(i,n)=>{i=b2(i),this.embeddings=function(s){return{embeddings:lt(s,y2,1).map(a=>{var h,d;const c={headIndex:Pe(a,3)??0??-1,headName:fe(W(a,4))??""??""};var l=a.v;return jo(l,0|l[x],za,On(a,1))!==void 0?(a=Vt(a=D(a,za,On(a,1),void 0),1,Qe,Gt()),c.floatEmbedding=a.slice()):(l=new Uint8Array(0),c.quantizedEmbedding=((d=(h=D(a,m2,On(a,2),void 0))==null?void 0:h.na())==null?void 0:d.h())??l),c}),timestampMs:mc(zo(s))}}(i),v(this,n)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Fe.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=vc(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=vc(bc(e.quantizedEmbedding),bc(t.quantizedEmbedding))}return e},Fe.prototype.embedForVideo=Fe.prototype.Aa,Fe.prototype.embed=Fe.prototype.za,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return M(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return M(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return M(Fe,e,t)};var Ls=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 j2(e){var r,i;const t=function(n){return lt(n,ye,1)}(e.ca()).filter(n=>(fe(W(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=D(t[0],Te,7))==null?void 0:r.j())==null?void 0:i.g())??new Map).forEach((n,s)=>{e.u[Number(s)]=fe(W(n,1))??""})}function Jc(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function Zc(e){try{const t=new Ls(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{$i(e)}}Ls.prototype.close=Ls.prototype.close;var be=class extends Ae{constructor(e,t){super(new ze(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new ws,this.A=new lc,N(this.h,0,3,this.A),N(e=this.h,0,1,t=new Y)}get baseOptions(){return D(this.h,Y,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?B(this.h,2,Hr(e.displayNamesLocale)):"displayNamesLocale"in e&&B(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){j2(this)}segment(e,t,r){const i=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,Jc(this),He(this,e,i),Zc(this)}La(e,t,r,i){const n=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:i,Jc(this),tt(this,e,n,t),Zc(this)}Da(){return this.u}m(){var e=new Se;q(e,"image_in"),q(e,"norm_rect");const t=new Te;Ze(t,hc,this.h);const r=new ye;_e(r,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),$(r,"IMAGE:image_in"),$(r,"NORM_RECT:norm_rect"),r.o(t),Oe(e,r),Wi(this,e),this.outputConfidenceMasks&&(O(e,"confidence_masks"),F(r,"CONFIDENCE_MASKS:confidence_masks"),kr(this,"confidence_masks"),this.g.aa("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Nr(this,s,!0,!this.j)),v(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],v(this,i)})),this.outputCategoryMask&&(O(e,"category_mask"),F(r,"CATEGORY_MASK:category_mask"),kr(this,"category_mask"),this.g.Z("category_mask",(i,n)=>{this.categoryMask=Nr(this,i,!1,!this.j),v(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,v(this,i)})),O(e,"quality_scores"),F(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,v(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};be.prototype.getLabels=be.prototype.Da,be.prototype.segmentForVideo=be.prototype.La,be.prototype.segment=be.prototype.segment,be.prototype.setOptions=be.prototype.o,be.createFromModelPath=function(e,t){return M(be,e,{baseOptions:{modelAssetPath:t}})},be.createFromModelBuffer=function(e,t){return M(be,e,{baseOptions:{modelAssetBuffer:t}})},be.createFromOptions=function(e,t){return M(be,e,t)};var Ms=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()}};Ms.prototype.close=Ms.prototype.close;var rt=class extends Ae{constructor(e,t){super(new ze(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new ws,this.u=new lc,N(this.h,0,3,this.u),N(e=this.h,0,1,t=new Y)}get baseOptions(){return D(this.h,Y,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 wc,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var s=new gs;bt(s,3,$r(!0),!1),bt(s,1,Wr(t.keypoint.x),0),bt(s,2,Wr(t.keypoint.y),0),Kr(i,1,ps,s)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const c=new F2;for(s of t.scribble)bt(t=new gs,3,$r(!0),!1),bt(t,1,Wr(s.x),0),bt(t,2,Wr(s.y),0),Vn(c,1,gs,t);Kr(i,2,ps,c)}}this.g.addProtoToStream(i.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",r),He(this,e,n);e:{try{const c=new Ms(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var a=c;break e}this.j(c)}finally{$i(this)}a=void 0}return a}m(){var e=new Se;q(e,"image_in"),q(e,"roi_in"),q(e,"norm_rect_in");const t=new Te;Ze(t,hc,this.h);const r=new ye;_e(r,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),$(r,"IMAGE:image_in"),$(r,"ROI:roi_in"),$(r,"NORM_RECT:norm_rect_in"),r.o(t),Oe(e,r),Wi(this,e),this.outputConfidenceMasks&&(O(e,"confidence_masks"),F(r,"CONFIDENCE_MASKS:confidence_masks"),kr(this,"confidence_masks"),this.g.aa("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Nr(this,s,!0,!this.j)),v(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],v(this,i)})),this.outputCategoryMask&&(O(e,"category_mask"),F(r,"CATEGORY_MASK:category_mask"),kr(this,"category_mask"),this.g.Z("category_mask",(i,n)=>{this.categoryMask=Nr(this,i,!1,!this.j),v(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,v(this,i)})),O(e,"quality_scores"),F(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,v(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};rt.prototype.segment=rt.prototype.segment,rt.prototype.setOptions=rt.prototype.o,rt.createFromModelPath=function(e,t){return M(rt,e,{baseOptions:{modelAssetPath:t}})},rt.createFromModelBuffer=function(e,t){return M(rt,e,{baseOptions:{modelAssetBuffer:t}})},rt.createFromOptions=function(e,t){return M(rt,e,t)};var Ge=class extends Ae{constructor(e,t){super(new ze(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},N(e=this.h=new gc,0,1,t=new Y)}get baseOptions(){return D(this.h,Y,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?B(this.h,2,Hr(e.displayNamesLocale)):"displayNamesLocale"in e&&B(this.h,2),e.maxResults!==void 0?dt(this.h,3,e.maxResults):"maxResults"in e&&B(this.h,3),e.scoreThreshold!==void 0?_(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&B(this.h,4),e.categoryAllowlist!==void 0?vi(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&B(this.h,5),e.categoryDenylist!==void 0?vi(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&B(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},He(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},tt(this,e,r,t),this.j}m(){var e=new Se;q(e,"input_frame_gpu"),q(e,"norm_rect"),O(e,"detections");const t=new Te;Ze(t,L2,this.h);const r=new ye;_e(r,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),$(r,"IMAGE:input_frame_gpu"),$(r,"NORM_RECT:norm_rect"),F(r,"DETECTIONS:detections"),r.o(t),Oe(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Va(s),this.j.detections.push(yc(i));v(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ge.prototype.detectForVideo=Ge.prototype.G,Ge.prototype.detect=Ge.prototype.F,Ge.prototype.setOptions=Ge.prototype.o,Ge.createFromModelPath=async function(e,t){return M(Ge,e,{baseOptions:{modelAssetPath:t}})},Ge.createFromModelBuffer=function(e,t){return M(Ge,e,{baseOptions:{modelAssetBuffer:t}})},Ge.createFromOptions=function(e,t){return M(Ge,e,t)};var Ps=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 Rc(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function el(e){try{const t=new Ps(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{$i(e)}}Ps.prototype.close=Ps.prototype.close;var Le=class extends Ae{constructor(e,t){super(new ze(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,N(e=this.h=new pc,0,1,t=new Y),this.A=new sc,N(this.h,0,3,this.A),this.j=new nc,N(this.h,0,2,this.j),dt(this.j,4,1),_(this.j,2,.5),_(this.A,2,.5),_(this.h,4,.5)}get baseOptions(){return D(this.h,Y,1)}set baseOptions(e){N(this.h,0,1,e)}o(e){return"numPoses"in e&&dt(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&_(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&_(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,Rc(this),He(this,e,i),el(this)}G(e,t,r,i){const n=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:i,Rc(this),tt(this,e,n,t),el(this)}m(){var e=new Se;q(e,"image_in"),q(e,"norm_rect"),O(e,"normalized_landmarks"),O(e,"world_landmarks"),O(e,"segmentation_masks");const t=new Te;Ze(t,M2,this.h);const r=new ye;_e(r,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),$(r,"IMAGE:image_in"),$(r,"NORM_RECT:norm_rect"),F(r,"NORM_LANDMARKS:normalized_landmarks"),F(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Oe(e,r),Wi(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(i,n)=>{this.landmarks=[];for(const s of i)i=Jr(s),this.landmarks.push(Vi(i));v(this,n)}),this.g.attachEmptyPacketListener("normalized_landmarks",i=>{this.landmarks=[],v(this,i)}),this.g.attachProtoVectorListener("world_landmarks",(i,n)=>{this.worldLandmarks=[];for(const s of i)i=xr(s),this.worldLandmarks.push(Zr(i));v(this,n)}),this.g.attachEmptyPacketListener("world_landmarks",i=>{this.worldLandmarks=[],v(this,i)}),this.outputSegmentationMasks&&(F(r,"SEGMENTATION_MASK:segmentation_masks"),kr(this,"segmentation_masks"),this.g.aa("segmentation_masks",(i,n)=>{this.segmentationMasks=i.map(s=>Nr(this,s,!0,!this.u)),v(this,n)}),this.g.attachEmptyPacketListener("segmentation_masks",i=>{this.segmentationMasks=[],v(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Le.prototype.detectForVideo=Le.prototype.G,Le.prototype.detect=Le.prototype.F,Le.prototype.setOptions=Le.prototype.o,Le.createFromModelPath=function(e,t){return M(Le,e,{baseOptions:{modelAssetPath:t}})},Le.createFromModelBuffer=function(e,t){return M(Le,e,{baseOptions:{modelAssetBuffer:t}})},Le.createFromOptions=function(e,t){return M(Le,e,t)},Le.POSE_CONNECTIONS=Yc;const qi="https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task",W2="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm",$2=()=>{const e=u.useRef(null),[t,r]=u.useState(!1),[i,n]=u.useState("Initializing..."),[s,a]=u.useState(0),[c,l]=u.useState(!1);u.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(qi)!==void 0:!1,d=async()=>{try{const w=await fetch(qi),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 b=0;const m=[];for(;;){const{done:S,value:I}=await y.read();if(S)break;if(m.push(I),b+=I.length,p){const C=Math.round(b/p*100);a(C),n(`Downloading model... ${C}%`)}}return"caches"in window&&await(await caches.open("mediapipe-models-v1")).put(qi,new Response(new Blob(m),{headers:{"Content-Type":"application/octet-stream"}})),!0}catch(w){return console.error("Failed to preload model:",w),!1}};return u.useEffect(()=>{(async()=>{try{n("Checking cached models..."),await h()?n("Using cached model..."):(n("Model not cached. Downloading..."),await d()),n("Loading MediaPipe WASM...");const p=await qt.forVisionTasks(W2);n("Creating face landmarker...");const y=await K.createFromOptions(p,{baseOptions:{modelAssetPath:qi,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."))}}},z2=()=>{const[e,t]=u.useState(0),r=u.useRef({lastTime:0,frames:0,fps:0}),i=u.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}},H2=()=>{const e=u.useRef({value:100,isLookingAway:!1}),t=u.useCallback((s,a,c,l)=>{if(!s||!c||!a)return;const h=s.getContext("2d");if(!h)return;const{width:d,height:f}=s;if(h.clearRect(0,0,d,f),h.drawImage(a,0,0,d,f),l){h.fillStyle="#00FF00";for(const w of c)h.fillRect(w.x*d-.5,w.y*f-.5,1,1)}},[]),r=u.useCallback(s=>{const a=e.current.value/100,c=100,l=20,h=20,d=40;s.fillStyle="rgba(0, 0, 0, 0.3)",s.fillRect(h,d,l,c),s.fillStyle=`rgba(${Math.floor(255*(1-a))}, ${Math.floor(255*a)}, 0, 0.8)`;const f=c*a;s.fillRect(h,d+c-f,l,f),s.fillStyle="#FFFFFF",s.fillRect(h,d+c*(1-a),l,2)},[]),i=u.useCallback((s,a,c,l,h,d,f)=>{if(t(s,a,c,l),h&&d&&f){const w=s.getContext("2d");w&&r(w)}},[t,r]),n=u.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}},q2=50,K2=()=>{const[e,t]=u.useState(100),[r,i]=u.useState(!1),n=u.useRef(0),s=u.useCallback((a,c,l)=>{if(!l||a.length<468)return;const h=a[33],d=a[263],f=a[1];if(!h||!d||!f)return;const w=(h.x+d.x)*.5,g=(h.y+d.y)*.5,p=w-c.x,y=g-c.y,b=Math.sqrt(p*p+y*y),m=Math.abs(f.y-c.noseY)*100,S=Math.abs(f.x-c.noseX)*100,I=Math.max(0,100-(b*200+m+S)),C=I<q2,U=performance.now();return U-n.current>100&&(t(I),i(C),n.current=U),{engagement:I,isLookingAway:C}},[]);return{engagement:e,isLookingAway:r,analyzeGaze:s,setEngagement:t,setIsLookingAway:i}},Y2=.05,X2=()=>{const[e,t]=u.useState(!1),[r,i]=u.useState(!1),n=u.useCallback((c,l)=>Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2)),[]),s=u.useCallback((c,l)=>{if(!c||!l)return 0;const h=[1,33,263,61,291,10,152];let d=0,f=0;const w=l[33],g=l[263],p=c[33],y=c[263];if(!w||!g||!p||!y)return 0;const b=n(w,g),m=n(p,y);if(b===0||m===0)return 0;for(const I of h){const C=l[I],U=c[I];if(C&&U){const L=w.x+(U.x-p.x)*b/m,V=w.y+(U.y-p.y)*b/m;d+=n(C,{x:L,y:V}),f++}}return f===0?0:d/f},[n]),a=u.useCallback((c,l,h,d)=>{if(!c.faceLandmarks||c.faceLandmarks.length===0)return l?(d("Reference face not detected."),i(!0),t(!1)):i(!1),null;if(l&&h){let f=null,w=0;for(const g of c.faceLandmarks)s(g,h)<Y2&&(f=g,w++);return w===1?(t(!1),i(!1),d("Reference face tracked."),f):w>1?(t(!0),i(!1),d("Multiple matching faces detected. Tracking suspended."),null):(t(!1),i(!0),d("Reference face not detected."),null)}else{c.faceLandmarks.length>1?(t(!0),d("Multiple faces detected. Set reference for single face tracking.")):(t(!1),d("No reference set. Detecting first face."));const f=c.faceLandmarks[0];return!f||f.length<468?null:f}},[s]);return{multipleFacesDetected:e,referenceFaceNotDetected:r,analyzeFace:a,setMultipleFacesDetected:t,setReferenceFaceNotDetected:i}},Q2=1e3,J2=(e,t)=>{const[r,i]=u.useState(!1),[n,s]=u.useState("face_detected"),{incrementGazeViolation:a}=js(),{multipleFacesDetected:c,referenceFaceNotDetected:l,isLookingAway:h}=e;u.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"))},Q2):(i(!1),s("face_detected")),()=>{clearTimeout(w)}},[h,c,l,t,a]);const d=u.useCallback(()=>c?"multiple_faces":l?"no_face_detected":h?"looking_away":"face_detected",[c,l,h]),f=u.useCallback(()=>{i(!1),s("face_detected")},[]);return{showGazeWarningModal:r,faceDetectionState:n,getWarningType:d,closeWarningModal:f,setShowGazeWarningModal:i,setFaceDetectionState:s}};class X extends Error{constructor(t,r,i=!1){super(t),this.code=r,this.recoverable=i,this.name="STTError"}}class Z2{constructor(t={}){Me(this,"config");Me(this,"mediaRecorder",null);Me(this,"audioChunks",[]);Me(this,"recordingStream",null);Me(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 X("Audio recording is not supported in this browser","RECORDING_NOT_SUPPORTED",!1);if(this.isRecording())throw new X("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 X(`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 X("Microphone permission was denied","PERMISSION_DENIED",!1);if(n.name==="NotFoundError")throw new X("No microphone found","NO_MICROPHONE",!1)}throw new X(`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 X("No active recording to stop","NO_ACTIVE_RECORDING",!1);return new Promise((t,r)=>{if(!this.mediaRecorder){r(new X("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 X(`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 X("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 X("Interview ID is missing from configuration","MISSING_INTERVIEW_ID",!1);const s=await gt(`${this.config.baseUrl}${mt.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 X(l,`HTTP_${s.status}`,s.status>=500)}return{transcript:(await s.json()).data.transcribed_text??""}}catch(i){throw i instanceof X?i:new X(`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 Z2,R2=(e,t,r,i)=>{const n=u.useRef(null);return u.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]),u.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}},e1=(e,t,r,i,n,s,a,c,l,h,d,f,w,g,p)=>{const y=u.useRef(null),b=u.useCallback(()=>{var C;const m=e.current,S=t.current,I=r.current;if(!m||m.readyState<2||!I||!S){y.current=requestAnimationFrame(b);return}i();try{const U=performance.now(),L=I.detectForVideo(m,U);if(((C=L.faceLandmarks)==null?void 0:C.length)>0){p(!1);const V=n(L,l,h.current,g);V?(s(S,m,V,d,f,w,l),l&&w&&c(V,h.current,w)):a(S,m)}else a(S,m),l?(p(!0),g("Reference face not detected.")):p(!1)}catch(U){console.error("Face detection error:",U)}y.current=requestAnimationFrame(b)},[e,t,r,i,n,s,a,c,l,h,d,f,w,g,p]);return{renderLoop:b,animationFrameRef:y}},t1=(e,t,r,i)=>{const{referenceSet:n,referenceRef:s,setReferenceData:a}=js(),c=u.useRef(s),l=u.useCallback(()=>{c.current=s},[s]),h=u.useCallback(()=>{var w;const d=e.current,f=t.current;if(console.log({faceLandmarker:d,video:f}),!(!d||!f))try{const g=performance.now(),p=d.detectForVideo(f,g);if((w=p.faceLandmarks)!=null&&w[0]){const y=p.faceLandmarks[0],b=y[33],m=y[263],S=y[1];b&&m&&S&&(c.current={x:(b.x+m.x)*.5,y:(b.y+m.y)*.5,noseX:S.x,noseY:S.y},a(!0,c.current),r("Reference set. Gaze tracking active."),console.log("Reference set. Gaze tracking active.",c.current),i&&i())}}catch(g){console.error("Set reference error:",g),r("Failed to set reference")}},[e,t,r,a,i]);return{referenceSet:n,referenceRef:c,setReference:h,syncReference:l}},Ds=({isOpen:e,onClose:t,children:r,title:i,showCloseButton:n=!0,closeOnOverlayClick:s=!0,closeOnEscape:a=!0,className:c=""})=>{if(u.useEffect(()=>{if(!e||!a)return;const d=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,a,t]),u.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=d=>{s&&d.target===d.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 pl.createPortal(h,document.body)},Ki=({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"},d={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]} ${d[r]} ${w} ${f} ${a}`,disabled:s||n,...c,children:[n&&o.jsx(Ys,{height:16,width:16,style:{marginRight:"3px"}}),e]})},ei=e=>{const{baseColor:t,borderRadius:r}=ci(),{loading:i,children:n,...s}=e;return o.jsx(Ki,{style:{background:Ml(t),borderRadius:r},...s,children:i?o.jsx(Ys,{}):n})};function r1({isOpen:e,onClose:t,warningType:r}){const i=Xs[r],n=i.icon,s=()=>{t()};return r==="face_detected"?null:o.jsx(Ds,{isOpen:e,onClose:t,children:e&&o.jsx("div",{className:"iw-bg-white iw-border-white iw-border iw-p-0 iw-shadow-lg sm:iw-max-w-md",children:o.jsxs("div",{children:[o.jsx("div",{className:"iw-sr-only",children:i.description}),o.jsxs("div",{className:"iw-px-8 iw-py-8 iw-text-center",children:[o.jsx("div",{className:`iw-mx-auto iw-mb-6 iw-flex iw-h-16 iw-w-16 iw-items-center iw-justify-center iw-rounded-full ${i.iconBg} border ${i.iconBorder}`,children:o.jsx(n,{className:`iw-h-7 iw-w-7 ${i.iconColor}`})}),o.jsx("h1",{className:"iw-text-foreground iw-mb-3 iw-text-2xl iw-font-bold iw-tracking-tight",children:i.title}),o.jsx("h2",{className:"iw-text-gray-500 iw-mb-6 iw-text-base iw-font-medium",children:i.subtitle}),o.jsx("p",{className:"iw-text-neutral-400 iw-mx-auto iw-mb-8 iw-max-w-sm iw-text-sm iw-leading-relaxed",children:i.description}),o.jsx(ei,{onClick:s,className:"iw-w-full iw-bg-gray-800 iw-text-white hover:iw-bg-gray-800",children:i.buttonText})]})]})})})}const tl=u.forwardRef(({className:e="",interviewId:t="",interview_duration:r,showProctoringUI:i=!0,onSetReference:n,isAnswering:s,onProctoringStatusChange:a,showStatusOverlay:c=!1},l)=>{var gl;const{authToken:h}=zs(),d=h?Dl(h):null,{borderRadius:f}=ci(),w=f??18,{proctoring:g}=an(),p=!!(g!=null&&g.gazeAnalysisEnabled),[y,b]=u.useState(!1),[m,S]=u.useState((g==null?void 0:g.showLandmarks)??!1),[I,C]=u.useState(i&&((g==null?void 0:g.showEngagementBar)??!0)),[U,L]=u.useState(p),[V,ne]=u.useState(!1),T=u.useRef(null),j=u.useRef(null),ft=u.useRef(null),qe=u.useRef(null),Ve=u.useCallback(async ve=>{const si=T.current,me=ft.current;if(!si||!me)return;const Cr=me.getContext("2d");Cr&&(me.width=si.videoWidth,me.height=si.videoHeight,Cr.save(),Cr.scale(-1,1),Cr.drawImage(si,-me.width,0,me.width,me.height),Cr.restore(),await new Promise(en=>me.toBlob(en,"image/jpeg")))},[Rl,t]);u.useEffect(()=>{let ve;return s&&(ne(!0),ve=setTimeout(()=>ne(!1),1e3)),()=>{ve&&clearTimeout(ve)}},[s]);const{faceLandmarkerRef:it,isModelLoaded:nt,statusMessage:Kt,setStatusMessage:Tt,loadingProgress:St,permissionDenied:wt,clearCache:At}=$2(),{fps:st,updateFPS:Sr}=z2(),{drawWithEngagementBar:Ct,clearCanvas:ti,engagementRef:ot}=H2(),{engagement:pe,isLookingAway:je,analyzeGaze:ee,setEngagement:It,setIsLookingAway:Ar}=K2(),{multipleFacesDetected:ri,referenceFaceNotDetected:ii,analyzeFace:Bs,setMultipleFacesDetected:Qi,setReferenceFaceNotDetected:Yt}=X2(),{referenceSet:ni,referenceRef:Ji,setReference:A,syncReference:Q}=t1(it,T,Tt,n),Xt={multipleFacesDetected:ri,referenceFaceNotDetected:ii,isLookingAway:je},{showGazeWarningModal:Zi,getWarningType:Ri,closeWarningModal:hl,setShowGazeWarningModal:fl,setFaceDetectionState:wl}=J2(Xt,p&&!c);u.useEffect(()=>{if(a){const ve=Ri()||"face_detected";a(ve)}},[ri,ii,je,Ri,a]);const{renderLoop:K1}=e1(T,j,it,Sr,Bs,Ct,ti,ee,ni,Ji,m,I,p,Tt,Yt);R2(T,nt,K1,Tt),u.useEffect(()=>{Q()},[Q]),u.useEffect(()=>{ot&&ot.current&&(ot.current.value=pe,ot.current.isLookingAway=je)},[pe,je,ot]);const Y1=u.useCallback(ve=>{L(ve),ve||(It(100),Ar(!1))},[It,Ar]),X1=u.useCallback(()=>{Ar(!1),Qi(!1),Yt(!1),wl("face_detected"),fl(!1),hl()},[Ar,Qi,Yt,wl,fl,hl]),Q1={engagement:pe,fps:st,isLookingAway:je,multipleFacesDetected:ri,referenceFaceNotDetected:ii};return u.useEffect(()=>{const ve=[];return(async()=>{try{const me=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1});qe.current=me,T.current&&(T.current.srcObject=me);const en=(r??oi)*60*1e3/3,J1=[0,1,2].map((Qt,Ft)=>({label:`capture-${Ft+1}`,start:Ft*en,end:(Ft+1)*en})),Z1=(Qt,Ft)=>Qt===Ft?Qt:Math.random()*(Ft-Qt)+Qt;J1.forEach(({label:Qt,start:Ft,end:R1},eu)=>{let Us;eu===0?Us=3e3:Us=Z1(Ft,R1),ve.push(setTimeout(()=>{Ve(Qt)},Us))})}catch(me){console.error("Error accessing camera:",me)}})(),()=>{qe.current&&qe.current.getTracks().forEach(me=>me.stop()),ve.forEach(clearTimeout)}},[Ve]),u.useImperativeHandle(l,()=>({setReference:()=>{A()},stopCamera:()=>{qe.current&&(qe.current.getTracks().forEach(ve=>ve.stop()),qe.current=null)}}),[A]),o.jsxs("div",{className:`iw-relative iw-h-full iw-w-full ${e}`,children:[wt?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 ${V?"iw-animate-answer-start":""} ${s?"iw-border-4 iw-border-[#6296FB]":""}`,style:{width:"100%",height:"auto",minHeight:"0"},children:[o.jsx("video",{ref:T,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)"}}),p&&o.jsx("canvas",{ref:j,width:320,height:240,className:"iw-absolute iw-inset-0 iw-w-full iw-h-full iw-object-cover",style:{transform:"scaleX(-1)",borderRadius:w}}),o.jsx("canvas",{ref:ft,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&&((gl=d==null?void 0:d.data)==null?void 0:gl.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:d.data.user_name})}),i&&o.jsx("div",{className:"iw-absolute iw-bottom-4 iw-right-4",children:o.jsx(td,{showControls:(g==null?void 0:g.showControls)??!1,isBubbleOpen:y,setIsBubbleOpen:b,setReference:A,clearCache:At,isModelLoaded:nt,gazeAnalysisEnabled:U&&p,referenceSet:ni,showLandmarks:m,setShowLandmarks:S,showEngagementBar:I,setShowEngagementBar:C,handleToggleGazeAnalysis:Y1,stats:Q1,statusMessage:Kt,loadingProgress:St})}),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(i1,{status:Ri()??"face_detected"})})]})]})}),p&&Zi&&!c&&o.jsx(r1,{isOpen:Zi,onClose:X1,warningType:Ri()})]})}),i1=({status:e})=>{const t=Xs[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-2",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 ${r?"iw-bg-[#E94315]":"iw-bg-[#22C55E]"}`,children:r?o.jsx(qs,{}):o.jsx(li,{})}),o.jsx("span",{className:"iw-text-sm iw-font-medium",children:e==="face_detected"?"Face detected clearly":t.title})]}),r&&o.jsx("span",{className:"iw-text-white iw-text-center iw-text-sm iw-drop-shadow-sm iw-max-w-[400px] iw-px-3 ",children:"Sit upright & look directly into the camera"})]})},rl=({micEnabled:e=!1,videoEnabled:t=!1,buttonText:r,onButtonClick:i,isAgreed:n,onAgreedToggle:s,showCheckbox:a=!0,showMediaIcons:c=!0,disabled:l=!1})=>{const h=l||!n||c&&(!e||!t);return o.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-6 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-4 iw-border iw-border-[#E7EAF1]",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-[#B3B9CB]"}`,onClick:d=>{d.stopPropagation(),s(!n)},children:n&&o.jsx(li,{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.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-4",children:[c&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"iw-relative",children:[o.jsx("div",{className:`iw-flex iw-h-12 iw-w-16 iw-items-center iw-justify-center iw-rounded-xl iw-border iw-transition-all ${e?"iw-border-[#E7EAF1] iw-bg-white iw-text-[#062260]":"iw-border-rose-200 iw-bg-rose-50 iw-text-rose-600"}`,children:e?o.jsx(Wl,{className:"iw-h-6 iw-w-6"}):o.jsx($l,{className:"iw-h-6 iw-w-6"})}),e&&o.jsx("div",{className:"iw-absolute -iw-right-1 -iw-top-1 iw-flex iw-h-4 iw-w-4 iw-items-center iw-justify-center iw-rounded-full iw-bg-[#22C55E] iw-text-white",children:o.jsx(li,{className:"iw-h-2.5 iw-w-2.5"})})]}),o.jsxs("div",{className:"iw-relative",children:[o.jsx("div",{className:`iw-flex iw-h-12 iw-w-16 iw-items-center iw-justify-center iw-rounded-xl iw-border iw-transition-all ${t?"iw-border-[#E7EAF1] iw-bg-white iw-text-[#062260]":"iw-border-rose-200 iw-bg-rose-50 iw-text-rose-600"}`,children:t?o.jsx(Xl,{className:"iw-h-6 iw-w-6"}):o.jsx(Ql,{className:"iw-h-6 iw-w-6"})}),t&&o.jsx("div",{className:"iw-absolute -iw-right-1 -iw-top-1 iw-flex iw-h-4 iw-w-4 iw-items-center iw-justify-center iw-rounded-full iw-bg-[#22C55E] iw-text-white",children:o.jsx(li,{className:"iw-h-2.5 iw-w-2.5"})})]})]}),o.jsx(Ki,{onClick:i,disabled:h,className:`iw-h-12 iw-flex-1 iw-max-w-[220px] !iw-bg-[#F1F5FE] !iw-text-[#062260] !iw-font-bold iw-border-none iw-rounded-lg ${h?"iw-opacity-50":"hover:iw-opacity-75"}`,children:r})]})]})},n1=({steps:e,currentStepIndex:t})=>o.jsx("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-4 iw-w-full iw-py-6",children:e.map((r,i)=>{const n=i<t,s=i===t;return o.jsxs(u.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)})}),s1=["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"],o1=({isOpen:e,onStart:t,gazeEnabled:r=!1,videoFeedRef:i,interviewId:n="",interview_duration:s=oi})=>{const a=u.useRef(null),c=u.useRef(null),[l,h]=u.useState(!1),[d,f]=u.useState(!1),[w,g]=u.useState(0),[p,y]=u.useState(!1),b=u.useRef(null),m=u.useRef(null),S=T=>{b.current=T,i&&(typeof i=="function"?i(T):i.current=T)},I=()=>{c.current&&(c.current.getTracks().forEach(T=>T.stop()),c.current=null)},C=async()=>{try{const T=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1280},height:{ideal:720}},audio:!0});c.current=T,a.current&&(a.current.srcObject=T),h(!0)}catch(T){console.error("Media permission error:",T);let j="Unable to access camera or microphone.";(T==null?void 0:T.name)==="NotAllowedError"?j="Permissions denied. Please allow access to camera and microphone.":(T==null?void 0:T.name)==="NotFoundError"?j="No camera/microphone found. Please connect a device and retry.":T!=null&&T.message&&(j=T.message),h(!1),console.log(j)}finally{}};if(u.useEffect(()=>{if(!e){I();return}return C(),()=>I()},[e]),u.useEffect(()=>()=>{m.current&&(clearInterval(m.current),m.current=null)},[]),!e)return null;const[U,L]=u.useState("face_detected"),V=async()=>{f(!0);const T=()=>{var j;return(j=b.current)==null?void 0:j.setReference()};T(),m.current&&clearInterval(m.current),m.current=setInterval(T,500)},ne=[{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-overflow-auto",children:o.jsxs("div",{className:"iw-w-full iw-max-w-[700px] iw-bg-white iw-rounded-xl iw-shadow-2xl iw-overflow-auto",children:[o.jsxs("div",{className:"iw-px-5 iw-pt-5",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-4 iw-bg-[#F1F5FE] iw-rounded-xl iw-p-3 iw-border iw-border-[#E7EAF1]",children:o.jsx("p",{className:"iw-text-[#5C6686] iw-text-sm 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-6 iw-border-b iw-border-dashed iw-border-[#B3B9CB] iw-w-full"}),o.jsx(n1,{steps:ne,currentStepIndex:w})]}),o.jsx("div",{className:"iw-px-5 iw-pb-5 iw-flex iw-flex-col iw-items-center",children:w===0?o.jsxs("div",{className:"iw-w-full iw-flex iw-flex-col iw-items-center iw-gap-6",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(tl,{ref:S,interviewId:n,interview_duration:s,showProctoringUI:!1,showStatusOverlay:!0,onProctoringStatusChange:L,onSetReference:()=>{m.current&&(clearInterval(m.current),m.current=null),f(!1),g(1)}}):o.jsx("video",{ref:a,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-full iw-object-cover",style:{transform:"scaleX(-1)"}})}),o.jsx(rl,{micEnabled:l,videoEnabled:l,buttonText:r?d?"Calibrating...":"Start calibrate":"Next",onButtonClick:()=>{r?V():g(1)},disabled:!p||r&&U!=="face_detected"||!r&&!l,isAgreed:p,onAgreedToggle:y})]}):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:s1.map((T,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:T})]},j))}),o.jsx(rl,{buttonText:"Start interview",onButtonClick:()=>{t(),I()},isAgreed:p,onAgreedToggle:y,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 il={thinkingDuration:0,answeringDuration:120,editingDuration:30},nl={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 a1{constructor(t={},r={}){Me(this,"config");Me(this,"state");Me(this,"phaseIntervalId",null);Me(this,"globalIntervalId",null);Me(this,"callbacks");this.config={...il,...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=nl[t];if(!r)return;if(r.next==="editing"&&this.config.editingDuration===0){const n=nl.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()}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 c1(e={}){const{config:t={},callbacks:r={}}=e,i=u.useRef(null);i.current||(i.current=new a1(t,{}));const n=i.current,[s,a]=u.useState(n.getState()),c=u.useCallback(()=>{a(n.getState())},[n]);u.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]),u.useEffect(()=>{n.updateConfig(t)},[n,t]),u.useEffect(()=>()=>{n.destroy()},[n]);const l=u.useCallback(()=>{n.startQuestion(),c()},[n,c]),h=u.useCallback(()=>{n.nextPhase(),c()},[n,c]),d=u.useCallback(()=>{n.completeInterview(),c()},[n,c]);return{state:s,startQuestion:l,nextPhase:h,completeInterview:d,timerService:n}}function l1(e,t={}){const[r,i]=u.useState({data:null,loading:!1,error:null}),n=u.useCallback(async(...s)=>{var a,c,l,h;i(d=>({...d,loading:!0,error:null}));try{const d=await e(...s);i(f=>({...f,data:d,loading:!1,error:null})),(a=t.onSuccess)==null||a.call(t,d),(c=t.onSettled)==null||c.call(t,d,null)}catch(d){const f=d.type?d:{type:"unknown",message:d.message||"Unknown error",retryable:!0,userMessage:"Something went wrong. Please try again.",originalError:d};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 d1=e=>{const[t,r]=u.useState(null),[i,n]=u.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 b={name:"FullscreenError",message:y instanceof Error?y.message:"Failed to enter fullscreen"};r(b),(p=e==null?void 0:e.onError)==null||p.call(e,b)}},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)}},d=u.useCallback(()=>{var p;const g=!!c();n(g),(p=e==null?void 0:e.onFullScreenChange)==null||p.call(e,g)},[e]);u.useEffect(()=>{const g=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];return g.forEach(p=>{document.addEventListener(p,d)}),()=>{g.forEach(p=>{document.removeEventListener(p,d)})}},[d]);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 sl(){const e=ai();return u.useMemo(()=>{const r=e.api||{};return new Qs(r)},[e.api])}const u1=e=>{u.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])},h1=(e={})=>{const[t,r]=u.useState(!1),[i,n]=u.useState(!1),[s,a]=u.useState(null),[c,l]=u.useState(null),[h,d]=u.useState(null);e.config&&Tr.updateConfig(e.config);const f=u.useCallback(async y=>{var b;try{l(null),a(null),d(null),await Tr.startRecording(y,{onStart:()=>{var m;r(!0),(m=e.onStart)==null||m.call(e)},onStop:()=>{var m;r(!1),(m=e.onStop)==null||m.call(e)},onError:m=>{var I;const S=m instanceof X?m:new X(m.message,"RECORDING_ERROR",!0);l(S),r(!1),(I=e.onError)==null||I.call(e,S)}})}catch(m){const S=m instanceof X?m:new X(m instanceof Error?m.message:String(m),"START_FAILED",!1);throw l(S),r(!1),(b=e.onError)==null||b.call(e,S),S}},[]),w=u.useCallback(async()=>{var y,b;try{const m=await Tr.stopRecording();return d(m),r(!1),(y=e.onStop)==null||y.call(e),m}catch(m){const S=m instanceof X?m:new X(m instanceof Error?m.message:String(m),"STOP_FAILED",!1);throw l(S),r(!1),(b=e.onError)==null||b.call(e,S),S}},[]),g=u.useCallback(async(y,b={})=>{var m,S;try{l(null),n(!0);const I={audioBlob:y,...b},C=await Tr.transcribe(I);return a(C.transcript),n(!1),(m=e.onTranscriptionComplete)==null||m.call(e,C),C}catch(I){const C=I instanceof X?I:new X(I instanceof Error?I.message:String(I),"TRANSCRIPTION_FAILED",!0);throw l(C),n(!1),(S=e.onError)==null||S.call(e,C),C}},[]),p=u.useCallback(()=>{Tr.cancelRecording(),r(!1),d(null)},[]);return{startRecording:f,stopRecording:w,transcribe:g,cancelRecording:p,isRecording:t,isTranscribing:i,transcript:s,error:c,audioBlob:h}},f1=e=>{const t=u.useRef(null),r=u.useRef(!1);u.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])},w1=()=>{u.useEffect(()=>{const e=document.createElement("style");return e.textContent=`
|
|
15
|
+
}`,e.VERTEX_SHADER),this.W=Sc(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 ut(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 xs(e){var t=ut(e,1);if(!t){if(t=ut(e,0))t=new Float32Array(t).map(i=>i/255);else{t=new Float32Array(e.width*e.height);const i=_r(e);var r=Es(e);if(Ic(r,i,Lc(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 Lc(e){let t=ut(e,2);if(!t){const r=_r(e);t=Pc(e);const i=xs(e),n=Mc(e);r.texImage2D(r.TEXTURE_2D,0,n,e.width,e.height,0,r.RED,r.FLOAT,i),_s(e)}return t}function _r(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=Tt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Mc(e){if(e=_r(e),!$i)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))$i=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");$i=e.R16F}return $i}function Es(e){return e.l||(e.l=new Fc),e.l}function Pc(e){const t=_r(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=ut(e,2);return r||(r=Nc(Es(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function _s(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var $i,ue=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&&--Dc===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!ut(this,0)}ka(){return!!ut(this,1)}R(){return!!ut(this,2)}ja(){return(t=ut(e=this,0))||(t=xs(e),t=new Uint8Array(t.map(r=>Math.round(255*r))),e.g.push(t)),t;var e,t}ia(){return xs(this)}N(){return Lc(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=_r(this),n=Es(this);i.activeTexture(i.TEXTURE1),r=Nc(n,i,this.m?i.LINEAR:i.NEAREST),i.bindTexture(i.TEXTURE_2D,r);const s=Mc(this);i.texImage2D(i.TEXTURE_2D,0,s,this.width,this.height,0,i.RED,i.FLOAT,null),i.bindTexture(i.TEXTURE_2D,null),Ic(n,i,r),Du(n,i,!1,()=>{Pc(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),_s(this)}),Ou(n),_s(this)}}e.push(r)}return new ue(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&_r(this).deleteTexture(ut(this,2)),Dc=-1}};ue.prototype.close=ue.prototype.close,ue.prototype.clone=ue.prototype.clone,ue.prototype.getAsWebGLTexture=ue.prototype.N,ue.prototype.getAsFloat32Array=ue.prototype.ia,ue.prototype.getAsUint8Array=ue.prototype.ja,ue.prototype.hasWebGLTexture=ue.prototype.R,ue.prototype.hasFloat32Array=ue.prototype.ka,ue.prototype.hasUint8Array=ue.prototype.Fa;var Dc=250;function We(...e){return e.map(([t,r])=>({start:t,end:r}))}const Bu=function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}}((Oc=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:xc()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){const t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){const r=e.length,i=this.i._malloc(r);this.i.HEAPU8.set(e,i),t?this.i._changeBinaryGraph(r,i):this.i._changeTextGraph(r,i),this.i._free(i)}configureAudio(e,t,r,i,n){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),_(this,i||"input_audio",s=>{_(this,n=n||"audio_header",a=>{this.i._configureAudio(s,a,e,t??0,r)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){Ze(this,"__graph_config__",t=>{e(t)}),_(this,"__graph_config__",t=>{this.i._getGraphConfig(t,void 0)}),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,i,n){const s=4*e.length;this.h!==s&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(s),this.h=s),this.i.HEAPF32.set(e,this.g/4),_(this,i,a=>{this.i._addAudioToInputStream(this.g,t,r,a,n)})}addGpuBufferToStream(e,t,r){_(this,t,i=>{const[n,s]=kc(this,e,i);this.i._addBoundTextureToStream(i,n,s,r)})}addBoolToStream(e,t,r){_(this,t,i=>{this.i._addBoolToInputStream(e,i,r)})}addDoubleToStream(e,t,r){_(this,t,i=>{this.i._addDoubleToInputStream(e,i,r)})}addFloatToStream(e,t,r){_(this,t,i=>{this.i._addFloatToInputStream(e,i,r)})}addIntToStream(e,t,r){_(this,t,i=>{this.i._addIntToInputStream(e,i,r)})}addUintToStream(e,t,r){_(this,t,i=>{this.i._addUintToInputStream(e,i,r)})}addStringToStream(e,t,r){_(this,t,i=>{_(this,e,n=>{this.i._addStringToInputStream(n,i,r)})})}addStringRecordToStream(e,t,r){_(this,t,i=>{Tc(this,Object.keys(e),n=>{Tc(this,Object.values(e),s=>{this.i._addFlatHashMapToInputStream(n,s,Object.keys(e).length,i,r)})})})}addProtoToStream(e,t,r,i){_(this,r,n=>{_(this,t,s=>{const a=this.i._malloc(e.length);this.i.HEAPU8.set(e,a),this.i._addProtoToInputStream(a,e.length,s,n,i),this.i._free(a)})})}addEmptyPacketToStream(e,t){_(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){_(this,t,i=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const s of e)this.i._addBoolVectorEntry(n,s);this.i._addBoolVectorToInputStream(n,i,r)})}addDoubleVectorToStream(e,t,r){_(this,t,i=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const s of e)this.i._addDoubleVectorEntry(n,s);this.i._addDoubleVectorToInputStream(n,i,r)})}addFloatVectorToStream(e,t,r){_(this,t,i=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const s of e)this.i._addFloatVectorEntry(n,s);this.i._addFloatVectorToInputStream(n,i,r)})}addIntVectorToStream(e,t,r){_(this,t,i=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const s of e)this.i._addIntVectorEntry(n,s);this.i._addIntVectorToInputStream(n,i,r)})}addUintVectorToStream(e,t,r){_(this,t,i=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of e)this.i._addUintVectorEntry(n,s);this.i._addUintVectorToInputStream(n,i,r)})}addStringVectorToStream(e,t,r){_(this,t,i=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const s of e)_(this,s,a=>{this.i._addStringVectorEntry(n,a)});this.i._addStringVectorToInputStream(n,i,r)})}addBoolToInputSidePacket(e,t){_(this,t,r=>{this.i._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){_(this,t,r=>{this.i._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){_(this,t,r=>{this.i._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){_(this,t,r=>{this.i._addIntToInputSidePacket(e,r)})}addUintToInputSidePacket(e,t){_(this,t,r=>{this.i._addUintToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){_(this,t,r=>{_(this,e,i=>{this.i._addStringToInputSidePacket(i,r)})})}addProtoToInputSidePacket(e,t,r){_(this,r,i=>{_(this,t,n=>{const s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputSidePacket(s,e.length,n,i),this.i._free(s)})})}addBoolVectorToInputSidePacket(e,t){_(this,t,r=>{const i=this.i._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(const n of e)this.i._addBoolVectorEntry(i,n);this.i._addBoolVectorToInputSidePacket(i,r)})}addDoubleVectorToInputSidePacket(e,t){_(this,t,r=>{const i=this.i._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(const n of e)this.i._addDoubleVectorEntry(i,n);this.i._addDoubleVectorToInputSidePacket(i,r)})}addFloatVectorToInputSidePacket(e,t){_(this,t,r=>{const i=this.i._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(const n of e)this.i._addFloatVectorEntry(i,n);this.i._addFloatVectorToInputSidePacket(i,r)})}addIntVectorToInputSidePacket(e,t){_(this,t,r=>{const i=this.i._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(const n of e)this.i._addIntVectorEntry(i,n);this.i._addIntVectorToInputSidePacket(i,r)})}addUintVectorToInputSidePacket(e,t){_(this,t,r=>{const i=this.i._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(const n of e)this.i._addUintVectorEntry(i,n);this.i._addUintVectorToInputSidePacket(i,r)})}addStringVectorToInputSidePacket(e,t){_(this,t,r=>{const i=this.i._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(const n of e)_(this,n,s=>{this.i._addStringVectorEntry(i,s)});this.i._addStringVectorToInputSidePacket(i,r)})}attachBoolListener(e,t){Ze(this,e,t),_(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){kt(this,e,t),_(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){Ze(this,e,t),_(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){kt(this,e,t),_(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){Ze(this,e,t),_(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){kt(this,e,t),_(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){Ze(this,e,t),_(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){kt(this,e,t),_(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){Ze(this,e,t),_(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){kt(this,e,t),_(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){Ze(this,e,t),_(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){kt(this,e,t),_(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){Ze(this,e,t),_(this,e,i=>{this.i._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){kt(this,e,t),_(this,e,i=>{this.i._attachProtoVectorListener(i,r||!1)})}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Ze(this,e,(i,n)=>{i=new Float32Array(i.buffer,i.byteOffset,i.length/4),t(i,n)}),_(this,e,i=>{this.i._attachAudioListener(i,r||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Oc{get ga(){return this.i}pa(e,t,r){_(this,t,i=>{const[n,s]=kc(this,e,i);this.ga._addBoundTextureAsImageToStream(i,n,s,r)})}Z(e,t){Ze(this,e,t),_(this,e,r=>{this.ga._attachImageListener(r)})}aa(e,t){kt(this,e,t),_(this,e,r=>{this.ga._attachImageVectorListener(r)})}}));var Oc,$e=class extends Bu{};async function M(e,t,r){return async function(i,n,s,a){return Mu(i,n,s,a)}(e,r.canvas??(xc()?void 0:document.createElement("canvas")),t,r)}function Bc(e,t,r,i){if(e.U){const s=new Wa;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].");k(s,1,(n.left+n.right)/2),k(s,2,(n.top+n.bottom)/2),k(s,4,n.right-n.left),k(s,3,n.bottom-n.top)}else k(s,1,.5),k(s,2,.5),k(s,4,1),k(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(k(s,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[a,c]=_c(t);r=Z(s,3)*c/a,n=Z(s,4)*a/c,k(s,4,r),k(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 ze(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'.");Bc(e,t,r,e.C+1)}function Re(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'.");Bc(e,t,r,i)}function kr(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 ue([n],r,!1,e.g.i.canvas,e.P,s,t),i?e.clone():e}var Ne=class extends bs{constructor(e,t,r,i){super(e),this.g=e,this.X=t,this.U=r,this.oa=i,this.P=new Fc}l(e,t=!0){if("runningMode"in e&&G(this.baseOptions,2,$r(!!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()}};Ne.prototype.close=Ne.prototype.close;var Ue=class extends Ne{constructor(e,t){super(new $e(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},T(e=this.h=new Ui,0,1,t=new Q),k(this.h,2,.5),k(this.h,3,.3)}get baseOptions(){return O(this.h,Q,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&k(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&k(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},ze(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Re(this,e,r,t),this.j}m(){var e=new Ce;Y(e,"image_in"),Y(e,"norm_rect_in"),B(e,"detections");const t=new Se;Qe(t,yu,this.h);const r=new be;Te(r,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),H(r,"IMAGE:image_in"),H(r,"NORM_RECT:norm_rect_in"),F(r,"DETECTIONS:detections"),r.o(t),Be(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Ga(s),this.j.detections.push(mc(i));v(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{v(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=async function(e,t){return M(Ue,e,{baseOptions:{modelAssetPath:t}})},Ue.createFromModelBuffer=function(e,t){return M(Ue,e,{baseOptions:{modelAssetBuffer:t}})},Ue.createFromOptions=function(e,t){return M(Ue,e,t)};var ks=We([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=We([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]),As=We([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Uc=We([474,475],[475,476],[476,477],[477,474]),Ss=We([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]),Cs=We([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Gc=We([469,470],[470,471],[471,472],[472,469]),Ns=We([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]),Vc=[...ks,...Ts,...As,...Ss,...Cs,...Ns],jc=We([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 Wc(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var X=class extends Ne{constructor(e,t){super(new $e(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,T(e=this.h=new Qa,0,1,t=new Q),this.A=new Xa,T(this.h,0,3,this.A),this.u=new Ui,T(this.h,0,2,this.u),lt(this.u,4,1),k(this.u,2,.5),k(this.A,2,.5),k(this.h,4,.5)}get baseOptions(){return O(this.h,Q,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return"numFaces"in e&<(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&k(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&k(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&k(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 Wc(this),ze(this,e,t),this.j}G(e,t,r){return Wc(this),Re(this,e,r,t),this.j}m(){var e=new Ce;Y(e,"image_in"),Y(e,"norm_rect"),B(e,"face_landmarks");const t=new Se;Qe(t,vu,this.h);const r=new be;Te(r,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),H(r,"IMAGE:image_in"),H(r,"NORM_RECT:norm_rect"),F(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Be(e,r),this.g.attachProtoVectorListener("face_landmarks",(i,n)=>{for(const s of i)i=Jr(s),this.j.faceLandmarks.push(Gi(i));v(this,n)}),this.g.attachEmptyPacketListener("face_landmarks",i=>{v(this,i)}),this.outputFaceBlendshapes&&(B(e,"blendshapes"),F(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(i,n)=>{if(this.outputFaceBlendshapes)for(const s of i)i=Di(s),this.j.faceBlendshapes.push(ms(i.g()??[]));v(this,n)}),this.g.attachEmptyPacketListener("blendshapes",i=>{v(this,i)})),this.outputFacialTransformationMatrixes&&(B(e,"face_geometry"),F(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(i,n)=>{if(this.outputFacialTransformationMatrixes)for(const s of i)(i=O(i=bu(s),du,2))&&this.j.facialTransformationMatrixes.push({rows:De(i,1)??0??0,columns:De(i,2)??0??0,data:Ut(i,3,Ye,Bt()).slice()??[]});v(this,n)}),this.g.attachEmptyPacketListener("face_geometry",i=>{v(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};X.prototype.detectForVideo=X.prototype.G,X.prototype.detect=X.prototype.F,X.prototype.setOptions=X.prototype.o,X.createFromModelPath=function(e,t){return M(X,e,{baseOptions:{modelAssetPath:t}})},X.createFromModelBuffer=function(e,t){return M(X,e,{baseOptions:{modelAssetBuffer:t}})},X.createFromOptions=function(e,t){return M(X,e,t)},X.FACE_LANDMARKS_LIPS=ks,X.FACE_LANDMARKS_LEFT_EYE=Ts,X.FACE_LANDMARKS_LEFT_EYEBROW=As,X.FACE_LANDMARKS_LEFT_IRIS=Uc,X.FACE_LANDMARKS_RIGHT_EYE=Ss,X.FACE_LANDMARKS_RIGHT_EYEBROW=Cs,X.FACE_LANDMARKS_RIGHT_IRIS=Gc,X.FACE_LANDMARKS_FACE_OVAL=Ns,X.FACE_LANDMARKS_CONTOURS=Vc,X.FACE_LANDMARKS_TESSELATION=jc;var Is=We([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 $c(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function zc(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 Hc(e,t=!0){const r=[];for(const n of e){var i=Di(n);e=[];for(const s of i.g())i=t&&De(s,1)!=null?De(s,1)??0:-1,e.push({score:Z(s,2)??0,index:i,categoryName:fe(z(s,3))??""??"",displayName:fe(z(s,4))??""??""});r.push(e)}return r}var Ie=class extends Ne{constructor(e,t){super(new $e(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],T(e=this.j=new Ra,0,1,t=new Q),this.u=new ls,T(this.j,0,2,this.u),this.D=new cs,T(this.u,0,3,this.D),this.A=new Za,T(this.u,0,2,this.A),this.h=new xu,T(this.j,0,3,this.h),k(this.A,2,.5),k(this.u,4,.5),k(this.D,2,.5)}get baseOptions(){return O(this.j,Q,1)}set baseOptions(e){T(this.j,0,1,e)}o(e){var n,s,a,c;if(lt(this.A,3,e.numHands??1),"minHandDetectionConfidence"in e&&k(this.A,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&k(this.u,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&k(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new xr,r=t,i=ps(e.cannedGesturesClassifierOptions,(n=O(this.h,xr,3))==null?void 0:n.l());T(r,0,2,i),T(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((s=O(this.h,xr,3))==null||s.g());return e.customGesturesClassifierOptions?(T(r=t=new xr,0,2,i=ps(e.customGesturesClassifierOptions,(a=O(this.h,xr,4))==null?void 0:a.l())),T(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((c=O(this.h,xr,4))==null||c.g()),this.l(e)}Ha(e,t){return $c(this),ze(this,e,t),zc(this)}Ia(e,t,r){return $c(this),Re(this,e,r,t),zc(this)}m(){var e=new Ce;Y(e,"image_in"),Y(e,"norm_rect"),B(e,"hand_gestures"),B(e,"hand_landmarks"),B(e,"world_hand_landmarks"),B(e,"handedness");const t=new Se;Qe(t,Eu,this.j);const r=new be;Te(r,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),H(r,"IMAGE:image_in"),H(r,"NORM_RECT:norm_rect"),F(r,"HAND_GESTURES:hand_gestures"),F(r,"LANDMARKS:hand_landmarks"),F(r,"WORLD_LANDMARKS:world_hand_landmarks"),F(r,"HANDEDNESS:handedness"),r.o(t),Be(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i){i=Jr(s);const a=[];for(const c of ct(i,ja,1))a.push({x:Z(c,1)??0,y:Z(c,2)??0,z:Z(c,3)??0,visibility:Z(c,4)??0});this.landmarks.push(a)}v(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{v(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i){i=vr(s);const a=[];for(const c of ct(i,Va,1))a.push({x:Z(c,1)??0,y:Z(c,2)??0,z:Z(c,3)??0,visibility:Z(c,4)??0});this.worldLandmarks.push(a)}v(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{v(this,i)}),this.g.attachProtoVectorListener("hand_gestures",(i,n)=>{this.gestures.push(...Hc(i,!1)),v(this,n)}),this.g.attachEmptyPacketListener("hand_gestures",i=>{v(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{this.handedness.push(...Hc(i)),v(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function qc(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Ie.prototype.recognizeForVideo=Ie.prototype.Ia,Ie.prototype.recognize=Ie.prototype.Ha,Ie.prototype.setOptions=Ie.prototype.o,Ie.createFromModelPath=function(e,t){return M(Ie,e,{baseOptions:{modelAssetPath:t}})},Ie.createFromModelBuffer=function(e,t){return M(Ie,e,{baseOptions:{modelAssetBuffer:t}})},Ie.createFromOptions=function(e,t){return M(Ie,e,t)},Ie.HAND_CONNECTIONS=Is;var Fe=class extends Ne{constructor(e,t){super(new $e(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],T(e=this.h=new ls,0,1,t=new Q),this.u=new cs,T(this.h,0,3,this.u),this.j=new Za,T(this.h,0,2,this.j),lt(this.j,3,1),k(this.j,2,.5),k(this.u,2,.5),k(this.h,4,.5)}get baseOptions(){return O(this.h,Q,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return"numHands"in e&<(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&k(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&k(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&k(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ze(this,e,t),qc(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Re(this,e,r,t),qc(this)}m(){var e=new Ce;Y(e,"image_in"),Y(e,"norm_rect"),B(e,"hand_landmarks"),B(e,"world_hand_landmarks"),B(e,"handedness");const t=new Se;Qe(t,_u,this.h);const r=new be;Te(r,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),H(r,"IMAGE:image_in"),H(r,"NORM_RECT:norm_rect"),F(r,"LANDMARKS:hand_landmarks"),F(r,"WORLD_LANDMARKS:world_hand_landmarks"),F(r,"HANDEDNESS:handedness"),r.o(t),Be(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i)i=Jr(s),this.landmarks.push(Gi(i));v(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{v(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i)i=vr(s),this.worldLandmarks.push(Zr(i));v(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{v(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{var s=this.handedness,a=s.push;const c=[];for(const l of i){i=Di(l);const h=[];for(const d of i.g())h.push({score:Z(d,2)??0,index:De(d,1)??0??-1,categoryName:fe(z(d,3))??""??"",displayName:fe(z(d,4))??""??""});c.push(h)}a.call(s,...c),v(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Fe.prototype.detectForVideo=Fe.prototype.G,Fe.prototype.detect=Fe.prototype.F,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return M(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return M(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return M(Fe,e,t)},Fe.HAND_CONNECTIONS=Is;var Kc=We([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 Yc(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function Xc(e){try{if(!e.D)return e.h;e.D(e.h)}finally{Wi(e)}}function zi(e,t){e=Jr(e),t.push(Gi(e))}var q=class extends Ne{constructor(e,t){super(new $e(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,T(e=this.j=new sc,0,1,t=new Q),this.I=new cs,T(this.j,0,2,this.I),this.W=new ku,T(this.j,0,3,this.W),this.u=new Ui,T(this.j,0,4,this.u),this.O=new Xa,T(this.j,0,5,this.O),this.A=new ic,T(this.j,0,6,this.A),this.M=new nc,T(this.j,0,7,this.M),k(this.u,2,.5),k(this.u,3,.3),k(this.O,2,.5),k(this.A,2,.5),k(this.A,3,.3),k(this.M,2,.5),k(this.I,2,.5)}get baseOptions(){return O(this.j,Q,1)}set baseOptions(e){T(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&k(this.u,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&k(this.u,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&k(this.O,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&k(this.A,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&k(this.A,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&k(this.M,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&k(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,Yc(this),ze(this,e,i),Xc(this)}G(e,t,r,i){const n=typeof r!="function"?r:{};return this.D=typeof r=="function"?r:i,Yc(this),Re(this,e,n,t),Xc(this)}m(){var e=new Ce;Y(e,"input_frames_image"),B(e,"pose_landmarks"),B(e,"pose_world_landmarks"),B(e,"face_landmarks"),B(e,"left_hand_landmarks"),B(e,"left_hand_world_landmarks"),B(e,"right_hand_landmarks"),B(e,"right_hand_world_landmarks");const t=new Se,r=new Ea;Te(r,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),function(n,s){if(s!=null)if(Array.isArray(s))G(n,2,yi(s,0,qr));else{if(!(typeof s=="string"||s instanceof qe||wn(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");bt(n,2,yn(s,!1),Ft())}}(r,this.j.g());const i=new be;Te(i,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Gn(i,8,Ea,r),H(i,"IMAGE:input_frames_image"),F(i,"POSE_LANDMARKS:pose_landmarks"),F(i,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),F(i,"FACE_LANDMARKS:face_landmarks"),F(i,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),F(i,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),F(i,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),F(i,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),i.o(t),Be(e,i),ji(this,e),this.g.attachProtoListener("pose_landmarks",(n,s)=>{zi(n,this.h.poseLandmarks),v(this,s)}),this.g.attachEmptyPacketListener("pose_landmarks",n=>{v(this,n)}),this.g.attachProtoListener("pose_world_landmarks",(n,s)=>{var a=this.h.poseWorldLandmarks;n=vr(n),a.push(Zr(n)),v(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",n=>{v(this,n)}),this.outputPoseSegmentationMasks&&(F(i,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Er(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",(n,s)=>{this.h.poseSegmentationMasks=[kr(this,n,!0,!this.D)],v(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",n=>{this.h.poseSegmentationMasks=[],v(this,n)})),this.g.attachProtoListener("face_landmarks",(n,s)=>{zi(n,this.h.faceLandmarks),v(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{v(this,n)}),this.outputFaceBlendshapes&&(B(e,"extra_blendshapes"),F(i,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(n,s)=>{var a=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=Di(n),a.push(ms(n.g()??[]))),v(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",n=>{v(this,n)})),this.g.attachProtoListener("left_hand_landmarks",(n,s)=>{zi(n,this.h.leftHandLandmarks),v(this,s)}),this.g.attachEmptyPacketListener("left_hand_landmarks",n=>{v(this,n)}),this.g.attachProtoListener("left_hand_world_landmarks",(n,s)=>{var a=this.h.leftHandWorldLandmarks;n=vr(n),a.push(Zr(n)),v(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",n=>{v(this,n)}),this.g.attachProtoListener("right_hand_landmarks",(n,s)=>{zi(n,this.h.rightHandLandmarks),v(this,s)}),this.g.attachEmptyPacketListener("right_hand_landmarks",n=>{v(this,n)}),this.g.attachProtoListener("right_hand_world_landmarks",(n,s)=>{var a=this.h.rightHandWorldLandmarks;n=vr(n),a.push(Zr(n)),v(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",n=>{v(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};q.prototype.detectForVideo=q.prototype.G,q.prototype.detect=q.prototype.F,q.prototype.setOptions=q.prototype.o,q.createFromModelPath=function(e,t){return M(q,e,{baseOptions:{modelAssetPath:t}})},q.createFromModelBuffer=function(e,t){return M(q,e,{baseOptions:{modelAssetBuffer:t}})},q.createFromOptions=function(e,t){return M(q,e,t)},q.HAND_CONNECTIONS=Is,q.POSE_CONNECTIONS=Kc,q.FACE_LANDMARKS_LIPS=ks,q.FACE_LANDMARKS_LEFT_EYE=Ts,q.FACE_LANDMARKS_LEFT_EYEBROW=As,q.FACE_LANDMARKS_LEFT_IRIS=Uc,q.FACE_LANDMARKS_RIGHT_EYE=Ss,q.FACE_LANDMARKS_RIGHT_EYEBROW=Cs,q.FACE_LANDMARKS_RIGHT_IRIS=Gc,q.FACE_LANDMARKS_FACE_OVAL=Ns,q.FACE_LANDMARKS_CONTOURS=Vc,q.FACE_LANDMARKS_TESSELATION=jc;var Ge=class extends Ne{constructor(e,t){super(new $e(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},T(e=this.h=new oc,0,1,t=new Q)}get baseOptions(){return O(this.h,Q,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return T(this.h,0,2,ps(e,O(this.h,ss,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},ze(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Re(this,e,r,t),this.j}m(){var e=new Ce;Y(e,"input_image"),Y(e,"norm_rect"),B(e,"classifications");const t=new Se;Qe(t,Tu,this.h);const r=new be;Te(r,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),H(r,"IMAGE:input_image"),H(r,"NORM_RECT:norm_rect"),F(r,"CLASSIFICATIONS:classifications"),r.o(t),Be(e,r),this.g.attachProtoListener("classifications",(i,n)=>{this.j=Fu(fu(i)),v(this,n)}),this.g.attachEmptyPacketListener("classifications",i=>{v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ge.prototype.classifyForVideo=Ge.prototype.ta,Ge.prototype.classify=Ge.prototype.sa,Ge.prototype.setOptions=Ge.prototype.o,Ge.createFromModelPath=function(e,t){return M(Ge,e,{baseOptions:{modelAssetPath:t}})},Ge.createFromModelBuffer=function(e,t){return M(Ge,e,{baseOptions:{modelAssetBuffer:t}})},Ge.createFromOptions=function(e,t){return M(Ge,e,t)};var Le=class extends Ne{constructor(e,t){super(new $e(e,t),"image_in","norm_rect",!0),this.h=new ac,this.embeddings={embeddings:[]},T(e=this.h,0,1,t=new Q)}get baseOptions(){return O(this.h,Q,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){var t=this.h,r=O(this.h,qa,2);return r=r?r.clone():new qa,e.l2Normalize!==void 0?G(r,1,$r(e.l2Normalize)):"l2Normalize"in e&&G(r,1),e.quantize!==void 0?G(r,2,$r(e.quantize)):"quantize"in e&&G(r,2),T(t,0,2,r),this.l(e)}za(e,t){return ze(this,e,t),this.embeddings}Aa(e,t,r){return Re(this,e,r,t),this.embeddings}m(){var e=new Ce;Y(e,"image_in"),Y(e,"norm_rect"),B(e,"embeddings_out");const t=new Se;Qe(t,Au,this.h);const r=new be;Te(r,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),H(r,"IMAGE:image_in"),H(r,"NORM_RECT:norm_rect"),F(r,"EMBEDDINGS:embeddings_out"),r.o(t),Be(e,r),this.g.attachProtoListener("embeddings_out",(i,n)=>{i=pu(i),this.embeddings=function(s){return{embeddings:ct(s,gu,1).map(a=>{var h,d;const c={headIndex:De(a,3)??0??-1,headName:fe(z(a,4))??""??""};var l=a.v;return Vo(l,0|l[x],$a,Dn(a,1))!==void 0?(a=Ut(a=O(a,$a,Dn(a,1),void 0),1,Ye,Bt()),c.floatEmbedding=a.slice()):(l=new Uint8Array(0),c.quantizedEmbedding=((d=(h=O(a,wu,Dn(a,2),void 0))==null?void 0:h.na())==null?void 0:d.h())??l),c}),timestampMs:pc($o(s))}}(i),v(this,n)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Le.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=bc(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=bc(yc(e.quantizedEmbedding),yc(t.quantizedEmbedding))}return e},Le.prototype.embedForVideo=Le.prototype.Aa,Le.prototype.embed=Le.prototype.za,Le.prototype.setOptions=Le.prototype.o,Le.createFromModelPath=function(e,t){return M(Le,e,{baseOptions:{modelAssetPath:t}})},Le.createFromModelBuffer=function(e,t){return M(Le,e,{baseOptions:{modelAssetBuffer:t}})},Le.createFromOptions=function(e,t){return M(Le,e,t)};var Fs=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 Uu(e){var r,i;const t=function(n){return ct(n,be,1)}(e.ca()).filter(n=>(fe(z(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=O(t[0],Se,7))==null?void 0:r.j())==null?void 0:i.g())??new Map).forEach((n,s)=>{e.u[Number(s)]=fe(z(n,1))??""})}function Qc(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function Jc(e){try{const t=new Fs(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Wi(e)}}Fs.prototype.close=Fs.prototype.close;var ve=class extends Ne{constructor(e,t){super(new $e(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new fs,this.A=new cc,T(this.h,0,3,this.A),T(e=this.h,0,1,t=new Q)}get baseOptions(){return O(this.h,Q,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?G(this.h,2,Hr(e.displayNamesLocale)):"displayNamesLocale"in e&&G(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){Uu(this)}segment(e,t,r){const i=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,Qc(this),ze(this,e,i),Jc(this)}La(e,t,r,i){const n=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:i,Qc(this),Re(this,e,n,t),Jc(this)}Da(){return this.u}m(){var e=new Ce;Y(e,"image_in"),Y(e,"norm_rect");const t=new Se;Qe(t,uc,this.h);const r=new be;Te(r,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),H(r,"IMAGE:image_in"),H(r,"NORM_RECT:norm_rect"),r.o(t),Be(e,r),ji(this,e),this.outputConfidenceMasks&&(B(e,"confidence_masks"),F(r,"CONFIDENCE_MASKS:confidence_masks"),Er(this,"confidence_masks"),this.g.aa("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>kr(this,s,!0,!this.j)),v(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],v(this,i)})),this.outputCategoryMask&&(B(e,"category_mask"),F(r,"CATEGORY_MASK:category_mask"),Er(this,"category_mask"),this.g.Z("category_mask",(i,n)=>{this.categoryMask=kr(this,i,!1,!this.j),v(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,v(this,i)})),B(e,"quality_scores"),F(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,v(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ve.prototype.getLabels=ve.prototype.Da,ve.prototype.segmentForVideo=ve.prototype.La,ve.prototype.segment=ve.prototype.segment,ve.prototype.setOptions=ve.prototype.o,ve.createFromModelPath=function(e,t){return M(ve,e,{baseOptions:{modelAssetPath:t}})},ve.createFromModelBuffer=function(e,t){return M(ve,e,{baseOptions:{modelAssetBuffer:t}})},ve.createFromOptions=function(e,t){return M(ve,e,t)};var Ls=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()}};Ls.prototype.close=Ls.prototype.close;var et=class extends Ne{constructor(e,t){super(new $e(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new fs,this.u=new cc,T(this.h,0,3,this.u),T(e=this.h,0,1,t=new Q)}get baseOptions(){return O(this.h,Q,1)}set baseOptions(e){T(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 fc,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var s=new ws;bt(s,3,$r(!0),!1),bt(s,1,Wr(t.keypoint.x),0),bt(s,2,Wr(t.keypoint.y),0),Kr(i,1,gs,s)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const c=new Cu;for(s of t.scribble)bt(t=new ws,3,$r(!0),!1),bt(t,1,Wr(s.x),0),bt(t,2,Wr(s.y),0),Gn(c,1,ws,t);Kr(i,2,gs,c)}}this.g.addProtoToStream(i.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",r),ze(this,e,n);e:{try{const c=new Ls(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var a=c;break e}this.j(c)}finally{Wi(this)}a=void 0}return a}m(){var e=new Ce;Y(e,"image_in"),Y(e,"roi_in"),Y(e,"norm_rect_in");const t=new Se;Qe(t,uc,this.h);const r=new be;Te(r,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),H(r,"IMAGE:image_in"),H(r,"ROI:roi_in"),H(r,"NORM_RECT:norm_rect_in"),r.o(t),Be(e,r),ji(this,e),this.outputConfidenceMasks&&(B(e,"confidence_masks"),F(r,"CONFIDENCE_MASKS:confidence_masks"),Er(this,"confidence_masks"),this.g.aa("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>kr(this,s,!0,!this.j)),v(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],v(this,i)})),this.outputCategoryMask&&(B(e,"category_mask"),F(r,"CATEGORY_MASK:category_mask"),Er(this,"category_mask"),this.g.Z("category_mask",(i,n)=>{this.categoryMask=kr(this,i,!1,!this.j),v(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,v(this,i)})),B(e,"quality_scores"),F(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,v(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,v(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};et.prototype.segment=et.prototype.segment,et.prototype.setOptions=et.prototype.o,et.createFromModelPath=function(e,t){return M(et,e,{baseOptions:{modelAssetPath:t}})},et.createFromModelBuffer=function(e,t){return M(et,e,{baseOptions:{modelAssetBuffer:t}})},et.createFromOptions=function(e,t){return M(et,e,t)};var Ve=class extends Ne{constructor(e,t){super(new $e(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},T(e=this.h=new wc,0,1,t=new Q)}get baseOptions(){return O(this.h,Q,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?G(this.h,2,Hr(e.displayNamesLocale)):"displayNamesLocale"in e&&G(this.h,2),e.maxResults!==void 0?lt(this.h,3,e.maxResults):"maxResults"in e&&G(this.h,3),e.scoreThreshold!==void 0?k(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&G(this.h,4),e.categoryAllowlist!==void 0?bi(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&G(this.h,5),e.categoryDenylist!==void 0?bi(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&G(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},ze(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Re(this,e,r,t),this.j}m(){var e=new Ce;Y(e,"input_frame_gpu"),Y(e,"norm_rect"),B(e,"detections");const t=new Se;Qe(t,Nu,this.h);const r=new be;Te(r,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),H(r,"IMAGE:input_frame_gpu"),H(r,"NORM_RECT:norm_rect"),F(r,"DETECTIONS:detections"),r.o(t),Be(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Ga(s),this.j.detections.push(mc(i));v(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{v(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=async function(e,t){return M(Ve,e,{baseOptions:{modelAssetPath:t}})},Ve.createFromModelBuffer=function(e,t){return M(Ve,e,{baseOptions:{modelAssetBuffer:t}})},Ve.createFromOptions=function(e,t){return M(Ve,e,t)};var Ms=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 Zc(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function Rc(e){try{const t=new Ms(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{Wi(e)}}Ms.prototype.close=Ms.prototype.close;var Me=class extends Ne{constructor(e,t){super(new $e(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,T(e=this.h=new gc,0,1,t=new Q),this.A=new nc,T(this.h,0,3,this.A),this.j=new ic,T(this.h,0,2,this.j),lt(this.j,4,1),k(this.j,2,.5),k(this.A,2,.5),k(this.h,4,.5)}get baseOptions(){return O(this.h,Q,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return"numPoses"in e&<(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&k(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&k(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&k(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,Zc(this),ze(this,e,i),Rc(this)}G(e,t,r,i){const n=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:i,Zc(this),Re(this,e,n,t),Rc(this)}m(){var e=new Ce;Y(e,"image_in"),Y(e,"norm_rect"),B(e,"normalized_landmarks"),B(e,"world_landmarks"),B(e,"segmentation_masks");const t=new Se;Qe(t,Iu,this.h);const r=new be;Te(r,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),H(r,"IMAGE:image_in"),H(r,"NORM_RECT:norm_rect"),F(r,"NORM_LANDMARKS:normalized_landmarks"),F(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Be(e,r),ji(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(i,n)=>{this.landmarks=[];for(const s of i)i=Jr(s),this.landmarks.push(Gi(i));v(this,n)}),this.g.attachEmptyPacketListener("normalized_landmarks",i=>{this.landmarks=[],v(this,i)}),this.g.attachProtoVectorListener("world_landmarks",(i,n)=>{this.worldLandmarks=[];for(const s of i)i=vr(s),this.worldLandmarks.push(Zr(i));v(this,n)}),this.g.attachEmptyPacketListener("world_landmarks",i=>{this.worldLandmarks=[],v(this,i)}),this.outputSegmentationMasks&&(F(r,"SEGMENTATION_MASK:segmentation_masks"),Er(this,"segmentation_masks"),this.g.aa("segmentation_masks",(i,n)=>{this.segmentationMasks=i.map(s=>kr(this,s,!0,!this.u)),v(this,n)}),this.g.attachEmptyPacketListener("segmentation_masks",i=>{this.segmentationMasks=[],v(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Me.prototype.detectForVideo=Me.prototype.G,Me.prototype.detect=Me.prototype.F,Me.prototype.setOptions=Me.prototype.o,Me.createFromModelPath=function(e,t){return M(Me,e,{baseOptions:{modelAssetPath:t}})},Me.createFromModelBuffer=function(e,t){return M(Me,e,{baseOptions:{modelAssetBuffer:t}})},Me.createFromOptions=function(e,t){return M(Me,e,t)},Me.POSE_CONNECTIONS=Kc;const Hi="https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task",Gu="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm",Vu=()=>{const e=u.useRef(null),[t,r]=u.useState(!1),[i,n]=u.useState("Initializing..."),[s,a]=u.useState(0),[c,l]=u.useState(!1);u.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(Hi)!==void 0:!1,d=async()=>{try{const w=await fetch(Hi),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 b=0;const m=[];for(;;){const{done:A,value:I}=await y.read();if(A)break;if(m.push(I),b+=I.length,p){const N=Math.round(b/p*100);a(N),n(`Downloading model... ${N}%`)}}return"caches"in window&&await(await caches.open("mediapipe-models-v1")).put(Hi,new Response(new Blob(m),{headers:{"Content-Type":"application/octet-stream"}})),!0}catch(w){return console.error("Failed to preload model:",w),!1}};return u.useEffect(()=>{(async()=>{try{n("Checking cached models..."),await h()?n("Using cached model..."):(n("Model not cached. Downloading..."),await d()),n("Loading MediaPipe WASM...");const p=await zt.forVisionTasks(Gu);n("Creating face landmarker...");const y=await X.createFromOptions(p,{baseOptions:{modelAssetPath:Hi,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."))}}},ju=()=>{const[e,t]=u.useState(0),r=u.useRef({lastTime:0,frames:0,fps:0}),i=u.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}},Wu=()=>{const e=u.useRef({value:100,isLookingAway:!1}),t=u.useCallback((s,a,c,l)=>{if(!s||!c||!a)return;const h=s.getContext("2d");if(!h)return;const{width:d,height:f}=s;if(h.clearRect(0,0,d,f),h.drawImage(a,0,0,d,f),l){h.fillStyle="#00FF00";for(const w of c)h.fillRect(w.x*d-.5,w.y*f-.5,1,1)}},[]),r=u.useCallback(s=>{const a=e.current.value/100,c=100,l=20,h=20,d=40;s.fillStyle="rgba(0, 0, 0, 0.3)",s.fillRect(h,d,l,c),s.fillStyle=`rgba(${Math.floor(255*(1-a))}, ${Math.floor(255*a)}, 0, 0.8)`;const f=c*a;s.fillRect(h,d+c-f,l,f),s.fillStyle="#FFFFFF",s.fillRect(h,d+c*(1-a),l,2)},[]),i=u.useCallback((s,a,c,l,h,d,f)=>{if(t(s,a,c,l),h&&d&&f){const w=s.getContext("2d");w&&r(w)}},[t,r]),n=u.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}},$u=50,zu=()=>{const[e,t]=u.useState(100),[r,i]=u.useState(!1),n=u.useRef(0),s=u.useCallback((a,c,l)=>{if(!l||a.length<468)return;const h=a[33],d=a[263],f=a[1];if(!h||!d||!f)return;const w=(h.x+d.x)*.5,g=(h.y+d.y)*.5,p=w-c.x,y=g-c.y,b=Math.sqrt(p*p+y*y),m=Math.abs(f.y-c.noseY)*100,A=Math.abs(f.x-c.noseX)*100,I=Math.max(0,100-(b*200+m+A)),N=I<$u,V=performance.now();return V-n.current>100&&(t(I),i(N),n.current=V),{engagement:I,isLookingAway:N}},[]);return{engagement:e,isLookingAway:r,analyzeGaze:s,setEngagement:t,setIsLookingAway:i}},Hu=.05,qu=()=>{const[e,t]=u.useState(!1),[r,i]=u.useState(!1),n=u.useCallback((c,l)=>Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2)),[]),s=u.useCallback((c,l)=>{if(!c||!l)return 0;const h=[1,33,263,61,291,10,152];let d=0,f=0;const w=l[33],g=l[263],p=c[33],y=c[263];if(!w||!g||!p||!y)return 0;const b=n(w,g),m=n(p,y);if(b===0||m===0)return 0;for(const I of h){const N=l[I],V=c[I];if(N&&V){const L=w.x+(V.x-p.x)*b/m,j=w.y+(V.y-p.y)*b/m;d+=n(N,{x:L,y:j}),f++}}return f===0?0:d/f},[n]),a=u.useCallback((c,l,h,d)=>{if(!c.faceLandmarks||c.faceLandmarks.length===0)return l?(d("Reference face not detected."),i(!0),t(!1)):i(!1),null;if(l&&h){let f=null,w=0;for(const g of c.faceLandmarks)s(g,h)<Hu&&(f=g,w++);return w===1?(t(!1),i(!1),d("Reference face tracked."),f):w>1?(t(!0),i(!1),d("Multiple matching faces detected. Tracking suspended."),null):(t(!1),i(!0),d("Reference face not detected."),null)}else{c.faceLandmarks.length>1?(t(!0),d("Multiple faces detected. Set reference for single face tracking.")):(t(!1),d("No reference set. Detecting first face."));const f=c.faceLandmarks[0];return!f||f.length<468?null:f}},[s]);return{multipleFacesDetected:e,referenceFaceNotDetected:r,analyzeFace:a,setMultipleFacesDetected:t,setReferenceFaceNotDetected:i}},Ku=1e3,Yu=(e,t)=>{const[r,i]=u.useState(!1),[n,s]=u.useState("face_detected"),{incrementGazeViolation:a}=$s(),{multipleFacesDetected:c,referenceFaceNotDetected:l,isLookingAway:h}=e;u.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"))},Ku):(i(!1),s("face_detected")),()=>{clearTimeout(w)}},[h,c,l,t,a]);const d=u.useCallback(()=>c?"multiple_faces":l?"no_face_detected":h?"looking_away":"face_detected",[c,l,h]),f=u.useCallback(()=>{i(!1),s("face_detected")},[]);return{showGazeWarningModal:r,faceDetectionState:n,getWarningType:d,closeWarningModal:f,setShowGazeWarningModal:i,setFaceDetectionState:s}};class J extends Error{constructor(t,r,i=!1){super(t),this.code=r,this.recoverable=i,this.name="STTError"}}class Xu{constructor(t={}){Pe(this,"config");Pe(this,"mediaRecorder",null);Pe(this,"audioChunks",[]);Pe(this,"recordingStream",null);Pe(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 J("Audio recording is not supported in this browser","RECORDING_NOT_SUPPORTED",!1);if(this.isRecording())throw new J("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 J(`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 J("Microphone permission was denied","PERMISSION_DENIED",!1);if(n.name==="NotFoundError")throw new J("No microphone found","NO_MICROPHONE",!1)}throw new J(`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 J("No active recording to stop","NO_ACTIVE_RECORDING",!1);return new Promise((t,r)=>{if(!this.mediaRecorder){r(new J("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 J(`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 J("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 J("Interview ID is missing from configuration","MISSING_INTERVIEW_ID",!1);const s=await gt(`${this.config.baseUrl}${mt.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 J(l,`HTTP_${s.status}`,s.status>=500)}return{transcript:(await s.json()).data.transcribed_text??""}}catch(i){throw i instanceof J?i:new J(`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 Xu,Qu=(e,t,r,i)=>{const n=u.useRef(null);return u.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]),u.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}},Ju=(e,t,r,i,n,s,a,c,l,h,d,f,w,g,p)=>{const y=u.useRef(null),b=u.useCallback(()=>{var N;const m=e.current,A=t.current,I=r.current;if(!m||m.readyState<2||!I||!A){y.current=requestAnimationFrame(b);return}i();try{const V=performance.now(),L=I.detectForVideo(m,V);if(((N=L.faceLandmarks)==null?void 0:N.length)>0){p(!1);const j=n(L,l,h.current,g);j?(s(A,m,j,d,f,w,l),l&&w&&c(j,h.current,w)):a(A,m)}else a(A,m),l?(p(!0),g("Reference face not detected.")):p(!1)}catch(V){console.error("Face detection error:",V)}y.current=requestAnimationFrame(b)},[e,t,r,i,n,s,a,c,l,h,d,f,w,g,p]);return{renderLoop:b,animationFrameRef:y}},Zu=(e,t,r,i)=>{const{referenceSet:n,referenceRef:s,setReferenceData:a}=$s(),c=u.useRef(s),l=u.useCallback(()=>{c.current=s},[s]),h=u.useCallback(()=>{var w;const d=e.current,f=t.current;if(console.log({faceLandmarker:d,video:f}),!(!d||!f))try{const g=performance.now(),p=d.detectForVideo(f,g);if((w=p.faceLandmarks)!=null&&w[0]){const y=p.faceLandmarks[0],b=y[33],m=y[263],A=y[1];b&&m&&A&&(c.current={x:(b.x+m.x)*.5,y:(b.y+m.y)*.5,noseX:A.x,noseY:A.y},a(!0,c.current),r("Reference set. Gaze tracking active."),console.log("Reference set. Gaze tracking active.",c.current),i&&i())}}catch(g){console.error("Set reference error:",g),r("Failed to set reference")}},[e,t,r,a,i]);return{referenceSet:n,referenceRef:c,setReference:h,syncReference:l}},ei={FACE_DETECTED:"face_detected",NO_FACE:"no_face_detected",MULTIPLE_FACES:"multiple_faces",LOOKING_AWAY:"looking_away",CAMERA_ERROR:"camera_error"},el={[ei.FACE_DETECTED]:{icon:zl,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"},[ei.NO_FACE]:{icon:$l,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"},[ei.MULTIPLE_FACES]:{icon:Xl,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"},[ei.LOOKING_AWAY]:{icon:Yl,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"},[ei.CAMERA_ERROR]:{icon:cn,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"}};function Ru({onClose:e,warningType:t,isCheatingModalOpen:r=!1}){const i=el[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(Mr,{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 e2=({status:e})=>{const t=el[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-2",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 ${r?"iw-bg-[#E94315]":"iw-bg-[#22C55E]"}`,children:r?o.jsx(Mr,{}):o.jsx(ln,{})}),o.jsx("span",{className:"iw-text-sm iw-font-medium",children:e==="face_detected"?"Face detected clearly":t.title})]}),r&&o.jsx("span",{className:"iw-text-white iw-text-center iw-text-sm iw-drop-shadow-sm iw-max-w-[400px] iw-px-3 ",children:"Sit upright & look directly into the camera"})]})},tl=u.forwardRef(({className:e="",interviewId:t="",interview_duration:r,showProctoringUI:i=!0,onSetReference:n,isAnswering:s,onProctoringStatusChange:a,showStatusOverlay:c=!1,cheatingWarningVisible:l=!1},h)=>{var ml;const{authToken:d}=qs(),f=d?Ol(d):null,{borderRadius:w}=Xt(),g=w??18,{proctoring:p}=sn(),y=!!(p!=null&&p.gazeAnalysisEnabled),[b,m]=u.useState(!1),[A,I]=u.useState((p==null?void 0:p.showLandmarks)??!1),[N,V]=u.useState(i&&((p==null?void 0:p.showEngagementBar)??!0)),[L,j]=u.useState(y),[ae,S]=u.useState(!1),U=u.useRef(null),ht=u.useRef(null),Ht=u.useRef(null),pe=u.useRef(null),tt=u.useCallback(async xe=>{const oi=U.current,ye=Ht.current;if(!oi||!ye)return;const Ir=ye.getContext("2d");Ir&&(ye.width=oi.videoWidth,ye.height=oi.videoHeight,Ir.save(),Ir.scale(-1,1),Ir.drawImage(oi,-ye.width,0,ye.width,ye.height),Ir.restore(),await new Promise(Zi=>ye.toBlob(Zi,"image/jpeg")))},[Vl,t]);u.useEffect(()=>{let xe;return s&&(S(!0),xe=setTimeout(()=>S(!1),1e3)),()=>{xe&&clearTimeout(xe)}},[s]);const{faceLandmarkerRef:rt,isModelLoaded:At,statusMessage:Ar,setStatusMessage:it,loadingProgress:ft,permissionDenied:St,clearCache:nt}=Vu(),{fps:Sr,updateFPS:Ct}=ju(),{drawWithEngagementBar:ti,clearCanvas:Cr,engagementRef:we}=Wu(),{engagement:st,isLookingAway:$,analyzeGaze:qt,setEngagement:ri,setIsLookingAway:Nr}=zu(),{multipleFacesDetected:ii,referenceFaceNotDetected:ni,analyzeFace:Us,setMultipleFacesDetected:Yi,setReferenceFaceNotDetected:Kt}=qu(),{referenceSet:si,referenceRef:Xi,setReference:C,syncReference:D}=Zu(rt,U,it,n),wt={multipleFacesDetected:ii,referenceFaceNotDetected:ni,isLookingAway:$},{showGazeWarningModal:Qi,getWarningType:Ji,closeWarningModal:wl,setShowGazeWarningModal:gl,setFaceDetectionState:pl}=Yu(wt,y&&!c);u.useEffect(()=>{if(a){const xe=Ji()||"face_detected";a(xe)}},[ii,ni,$,Ji,a]);const{renderLoop:Y2}=Ju(U,ht,rt,Ct,Us,ti,Cr,qt,si,Xi,A,N,y,it,Kt);Qu(U,At,Y2,it),u.useEffect(()=>{D()},[D]),u.useEffect(()=>{we&&we.current&&(we.current.value=st,we.current.isLookingAway=$)},[st,$,we]);const X2=u.useCallback(xe=>{j(xe),xe||(ri(100),Nr(!1))},[ri,Nr]),Q2=u.useCallback(()=>{Nr(!1),Yi(!1),Kt(!1),pl("face_detected"),gl(!1),wl()},[Nr,Yi,Kt,pl,gl,wl]),J2={engagement:st,fps:Sr,isLookingAway:$,multipleFacesDetected:ii,referenceFaceNotDetected:ni};return u.useEffect(()=>{const xe=[];return(async()=>{try{const ye=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1});pe.current=ye,U.current&&(U.current.srcObject=ye);const Zi=(r??ai)*60*1e3/3,Z2=[0,1,2].map((Yt,Nt)=>({label:`capture-${Nt+1}`,start:Nt*Zi,end:(Nt+1)*Zi})),R2=(Yt,Nt)=>Yt===Nt?Yt:Math.random()*(Nt-Yt)+Yt;Z2.forEach(({label:Yt,start:Nt,end:e1},t1)=>{let Gs;t1===0?Gs=3e3:Gs=R2(Nt,e1),xe.push(setTimeout(()=>{tt(Yt)},Gs))})}catch(ye){console.error("Error accessing camera:",ye)}})(),()=>{pe.current&&pe.current.getTracks().forEach(ye=>ye.stop()),xe.forEach(clearTimeout)}},[tt]),u.useImperativeHandle(h,()=>({setReference:()=>{C()},stopCamera:()=>{pe.current&&(pe.current.getTracks().forEach(xe=>xe.stop()),pe.current=null)}}),[C]),o.jsxs("div",{className:`iw-relative iw-h-full iw-w-full ${e}`,children:[St?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 ${ae?"iw-animate-answer-start":""} ${s?"iw-border-4 iw-border-[#6296FB]":""}`,style:{width:"100%",height:"auto",minHeight:"0"},children:[o.jsx("video",{ref:U,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)"}}),y&&o.jsx("canvas",{ref:ht,width:320,height:240,className:"iw-absolute iw-inset-0 iw-w-full iw-h-full iw-object-cover",style:{transform:"scaleX(-1)",borderRadius:g,display:"hidden"}}),o.jsx("canvas",{ref:Ht,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&&((ml=f==null?void 0:f.data)==null?void 0:ml.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:f.data.user_name})}),i&&o.jsx("div",{className:"iw-absolute iw-bottom-4 iw-right-4",children:o.jsx(Zl,{showControls:(p==null?void 0:p.showControls)??!1,isBubbleOpen:b,setIsBubbleOpen:m,setReference:C,clearCache:nt,isModelLoaded:At,gazeAnalysisEnabled:L&&y,referenceSet:si,showLandmarks:A,setShowLandmarks:I,showEngagementBar:N,setShowEngagementBar:V,handleToggleGazeAnalysis:X2,stats:J2,statusMessage:Ar,loadingProgress:ft})}),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(e2,{status:Ji()??"face_detected"})})]})]})}),y&&Qi&&!c&&o.jsx(Ru,{isOpen:Qi,onClose:Q2,warningType:Ji(),isCheatingModalOpen:l})]})}),qi=({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"},d={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]} ${d[r]} ${w} ${f} ${a}`,disabled:s||n,...c,children:[n&&o.jsx(Xs,{height:16,width:16,style:{marginRight:"3px"}}),e]})},rl=({enabled:e,OnIcon:t,OffIcon:r,label:i})=>{const{baseColor:n}=Xt();return o.jsxs("div",{className:"iw-relative iw-group",children:[o.jsx("div",{className:"iw-flex iw-h-12 iw-w-16 iw-items-center iw-justify-center iw-rounded-xl iw-border iw-transition-all iw-border-[#E7EAF1] iw-bg-white iw-text-[#062260]",children:e?o.jsx(t,{className:"iw-h-6 iw-w-6"}):o.jsx(r,{className:"iw-h-6 iw-w-6"})}),e?o.jsx("div",{className:"iw-absolute -iw-right-1 -iw-top-1 iw-flex iw-h-4 iw-w-4 iw-items-center iw-justify-center iw-rounded-full iw-bg-[#22C55E] iw-text-white",children:o.jsx(ln,{className:"iw-h-2.5 iw-w-2.5"})}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"iw-absolute -iw-right-2 -iw-top-2 iw-z-10",children:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z",fill:"#E94315"}),o.jsx("circle",{cx:"12",cy:"10",r:"1.5",fill:"white"}),o.jsx("rect",{x:"11",y:"13",width:"2",height:"5",rx:"0.5",fill:"white"})]})}),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:n},children:[o.jsxs("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:i}),o.jsx(Mr,{className:"iw-w-4 iw-h-4 iw-text-white/70 hover:iw-text-white iw-cursor-pointer iw-shrink-0"})]}),o.jsx("p",{className:"iw-text-xs iw-opacity-90 iw-leading-tight",children:"We need permission to access your device. Go to your 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]"})]})})]})]})},il=({micEnabled:e=!1,videoEnabled:t=!1,buttonText:r,onButtonClick:i,isAgreed:n,onAgreedToggle:s,showCheckbox:a=!0,showMediaIcons:c=!0,disabled:l=!1})=>{const h=l||!n||c&&(!e||!t);return o.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-6 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-4 iw-border iw-border-[#E7EAF1]",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-[#B3B9CB]"}`,onClick:d=>{d.stopPropagation(),s(!n)},children:n&&o.jsx(ln,{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.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-4",children:[c&&o.jsxs(o.Fragment,{children:[o.jsx(rl,{enabled:e,OnIcon:ql,OffIcon:Kl,label:"Allow us to access your microphone"}),o.jsx(rl,{enabled:t,OnIcon:Ql,OffIcon:Jl,label:"Allow us to access your camera"})]}),o.jsxs("div",{className:"iw-relative iw-group iw-flex-1 iw-max-w-[220px]",children:[o.jsx(qi,{onClick:i,disabled:h,className:`iw-h-12 iw-w-full !iw-bg-[#F1F5FE] !iw-text-[#062260] !iw-font-bold !iw-border-[#E7EAF1] iw-rounded-lg ${h?"iw-opacity-50":"hover:iw-opacity-75"}`,children:r}),!n&&(!c||e&&t)&&t2()]})]})]})},t2=()=>{const{baseColor:e}=Xt();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/5 -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]"})]})})})},r2=({steps:e,currentStepIndex:t})=>o.jsx("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-4 iw-w-full iw-py-6",children:e.map((r,i)=>{const n=i<t,s=i===t;return o.jsxs(u.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)})}),i2=["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"],n2=({isOpen:e,onStart:t,gazeEnabled:r=!1,videoFeedRef:i,interviewId:n="",interview_duration:s=ai})=>{const a=u.useRef(null),c=u.useRef(null),[l,h]=u.useState(!1),[d,f]=u.useState(!1),[w,g]=u.useState(0),[p,y]=u.useState(!1),b=u.useRef(null),m=u.useRef(null),A=S=>{b.current=S,i&&(typeof i=="function"?i(S):i.current=S)},I=()=>{c.current&&(c.current.getTracks().forEach(S=>S.stop()),c.current=null)},N=async()=>{try{const S=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}},audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:{ideal:48e3},channelCount:{ideal:1}}});c.current=S,a.current&&(a.current.srcObject=S,await a.current.play()),h(!0)}catch(S){console.error("Media permission error:",S);let U="Unable to access camera or microphone.";(S==null?void 0:S.name)==="NotAllowedError"?U="Permissions denied. Please allow access to camera and microphone.":(S==null?void 0:S.name)==="NotFoundError"?U="No camera/microphone found. Please connect a device and retry.":S!=null&&S.message&&(U=S.message),h(!1),console.log(U)}};if(u.useEffect(()=>{if(!e){I();return}return N(),()=>I()},[e]),u.useEffect(()=>()=>{m.current&&(clearInterval(m.current),m.current=null)},[]),!e)return null;const[V,L]=u.useState("face_detected"),j=async()=>{f(!0);const S=()=>{var U;return(U=b.current)==null?void 0:U.setReference()};S(),m.current&&clearInterval(m.current),m.current=setInterval(S,500)},ae=[{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-overflow-auto",children:o.jsxs("div",{className:"iw-w-full iw-max-w-[700px] iw-max-h-[800px] iw-my-6 iw-bg-white iw-rounded-xl iw-shadow-2xl iw-overflow-auto",children:[o.jsxs("div",{className:"iw-px-5 iw-pt-5",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-4 iw-bg-[#F1F5FE] iw-rounded-xl iw-p-3 iw-border iw-border-[#E7EAF1]",children:o.jsx("p",{className:"iw-text-[#5C6686] iw-text-sm 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-6 iw-border-b iw-border-dashed iw-border-[#B3B9CB] iw-w-full"}),o.jsx(r2,{steps:ae,currentStepIndex:w})]}),o.jsx("div",{className:"iw-px-5 iw-pb-5 iw-flex iw-flex-col iw-items-center",children:w===0?o.jsxs("div",{className:"iw-w-full iw-flex iw-flex-col iw-items-center iw-gap-6",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(tl,{ref:A,interviewId:n,interview_duration:s,showProctoringUI:!1,showStatusOverlay:!0,onProctoringStatusChange:L,onSetReference:()=>{m.current&&(clearInterval(m.current),m.current=null),f(!1),g(1)}}):o.jsx("video",{ref:a,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-full iw-object-cover",style:{transform:"scaleX(-1)"}})}),o.jsx(il,{micEnabled:l,videoEnabled:l,buttonText:r?d?"Calibrating...":"Start calibrate":"Next",onButtonClick:()=>{r?j():g(1)},disabled:!p||r&&V!=="face_detected"||!r&&!l,isAgreed:p,onAgreedToggle:y})]}):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:i2.map((S,U)=>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:U+1}),o.jsx("span",{className:"iw-text-[#5C6686] iw-font-medium",children:S})]},U))}),o.jsx(il,{buttonText:"Start interview",onButtonClick:()=>{t(),I()},isAgreed:p,onAgreedToggle:y,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 nl={thinkingDuration:0,answeringDuration:120,editingDuration:30},sl={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 s2{constructor(t={},r={}){Pe(this,"config");Pe(this,"state");Pe(this,"phaseIntervalId",null);Pe(this,"globalIntervalId",null);Pe(this,"callbacks");this.config={...nl,...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=sl[t];if(!r)return;if(r.next==="editing"&&this.config.editingDuration===0){const n=sl.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 o2(e={}){const{config:t={},callbacks:r={}}=e,i=u.useRef(null);i.current||(i.current=new s2(t,{}));const n=i.current,[s,a]=u.useState(n.getState()),c=u.useCallback(()=>{a(n.getState())},[n]);u.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]),u.useEffect(()=>{n.updateConfig(t)},[n,t]),u.useEffect(()=>()=>{n.destroy()},[n]);const l=u.useCallback(()=>{n.startQuestion(),c()},[n,c]),h=u.useCallback(()=>{n.nextPhase(),c()},[n,c]),d=u.useCallback(()=>{n.completeInterview(),c()},[n,c]);return{state:s,startQuestion:l,nextPhase:h,completeInterview:d,timerService:n}}function a2(e,t={}){const[r,i]=u.useState({data:null,loading:!1,error:null}),n=u.useCallback(async(...s)=>{var a,c,l,h;i(d=>({...d,loading:!0,error:null}));try{const d=await e(...s);i(f=>({...f,data:d,loading:!1,error:null})),(a=t.onSuccess)==null||a.call(t,d),(c=t.onSettled)==null||c.call(t,d,null)}catch(d){const f=d.type?d:{type:"unknown",message:d.message||"Unknown error",retryable:!0,userMessage:"Something went wrong. Please try again.",originalError:d};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 c2=e=>{const[t,r]=u.useState(null),[i,n]=u.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 b={name:"FullscreenError",message:y instanceof Error?y.message:"Failed to enter fullscreen"};r(b),(p=e==null?void 0:e.onError)==null||p.call(e,b)}},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)}},d=u.useCallback(()=>{var p;const g=!!c();n(g),(p=e==null?void 0:e.onFullScreenChange)==null||p.call(e,g)},[e]);u.useEffect(()=>{const g=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];return g.forEach(p=>{document.addEventListener(p,d)}),()=>{g.forEach(p=>{document.removeEventListener(p,d)})}},[d]);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 ol(){const e=ci();return u.useMemo(()=>{const r=e.api||{};return new Ks(r)},[e.api])}const l2=e=>{u.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])},d2=(e={})=>{const[t,r]=u.useState(!1),[i,n]=u.useState(!1),[s,a]=u.useState(null),[c,l]=u.useState(null),[h,d]=u.useState(null);e.config&&Tr.updateConfig(e.config);const f=u.useCallback(async y=>{var b;try{l(null),a(null),d(null),await Tr.startRecording(y,{onStart:()=>{var m;r(!0),(m=e.onStart)==null||m.call(e)},onStop:()=>{var m;r(!1),(m=e.onStop)==null||m.call(e)},onError:m=>{var I;const A=m instanceof J?m:new J(m.message,"RECORDING_ERROR",!0);l(A),r(!1),(I=e.onError)==null||I.call(e,A)}})}catch(m){const A=m instanceof J?m:new J(m instanceof Error?m.message:String(m),"START_FAILED",!1);throw l(A),r(!1),(b=e.onError)==null||b.call(e,A),A}},[]),w=u.useCallback(async()=>{var y,b;try{const m=await Tr.stopRecording();return d(m),r(!1),(y=e.onStop)==null||y.call(e),m}catch(m){const A=m instanceof J?m:new J(m instanceof Error?m.message:String(m),"STOP_FAILED",!1);throw l(A),r(!1),(b=e.onError)==null||b.call(e,A),A}},[]),g=u.useCallback(async(y,b={})=>{var m,A;try{l(null),n(!0);const I={audioBlob:y,...b},N=await Tr.transcribe(I);return a(N.transcript),n(!1),(m=e.onTranscriptionComplete)==null||m.call(e,N),N}catch(I){const N=I instanceof J?I:new J(I instanceof Error?I.message:String(I),"TRANSCRIPTION_FAILED",!0);throw l(N),n(!1),(A=e.onError)==null||A.call(e,N),N}},[]),p=u.useCallback(()=>{Tr.cancelRecording(),r(!1),d(null)},[]);return{startRecording:f,stopRecording:w,transcribe:g,cancelRecording:p,isRecording:t,isTranscribing:i,transcript:s,error:c,audioBlob:h}},u2=e=>{const t=u.useRef(null),r=u.useRef(!1);u.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])},h2=()=>{u.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 f2{constructor(){Pe(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,d)=>{if(!this.currentAudio){d(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),d(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),d(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 al=new f2,w2=(e={})=>{const[t,r]=u.useState(!1),[i,n]=u.useState(!1),[s,a]=u.useState(null),c=u.useCallback(async h=>{var d;try{a(null),n(!0),await al.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),(d=e.onError)==null||d.call(e,w),w}},[e]),l=u.useCallback(()=>{al.stop(),r(!1),n(!1)},[]);return{speak:c,stop:l,isPlaying:t,isLoading:i,error:s}},g2=({onViolation:e,onEnd:t,maxViolations:r=5})=>{const{addViolation:i}=Nl(),n=Sl(),s=Cl(),a=u.useRef(s);u.useEffect(()=>{a.current=s},[s]);const c=u.useCallback(h=>{t&&t(h,a.current)},[t]);return{logViolation:u.useCallback(({type:h,severity:d,details:f})=>{const w={id:Dl(),type:h,severity:d,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}},p2=()=>{u.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}},[])},b1=(e,t,r)=>Math.max(t,Math.min(r,e)),al=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}`},Yi=({total:e,remaining:t,size:r=64,strokeWidth:i=6,className:n="",showLabel:s=!0})=>{const a=Math.max(1,e||1),c=b1(t/a,0,1),{radius:l,circumference:h,dashOffset:d,center:f}=u.useMemo(()=>{const p=(r-i)/2,y=2*Math.PI*p,b=y*(1-c),m=Math.round(i)%2===1,S=r/2+(m?.5:0);return{radius:p,circumference:y,dashOffset:b,center:S}},[r,i,c]),w=u.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 ${al(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:d,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:al(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,{})})]})},v1=({timerState:e,answeringTime:t})=>{const r=(e==null?void 0:e.currentPhaseTimeRemaining)||0,i=t||il.answeringDuration;return o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-3",children:[o.jsx(Yi,{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:[cn(r)," mins"]})]})]})},x1=({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(ln,{brandLogo:n,brandName:i})})}),o.jsx(E1,{phase:r,question:e,isLoading:t,brandName:i,timerState:s,answeringTime:a})]})}),E1=({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(v1,{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})}},k1=({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":"",d=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} ${d} ${i}`,"aria-invalid":t?"true":"false",...s}),t&&o.jsx("p",{className:"iw-mt-1 iw-text-sm iw-text-red-600",children:t})]})},_1=({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(k1,{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(Yi,{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:`${cn(r.currentPhaseTimeRemaining)} mins`})]})]})]}),cl=({children:e})=>o.jsx("div",{className:"iw-flex iw-flex-col iw-items-start iw-mt-3 iw-gap-1",children:e}),N1=({children:e})=>o.jsx("div",{className:"iw-flex iw-flex-col iw-items-end iw-mt-3 iw-gap-1",children:e}),T1=({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]}),ll=({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:"."})]})]}),S1=({phase:e,questionNumber:t})=>{switch(e){case P.FETCHING_QUESTION:return o.jsxs(cl,{children:[o.jsx(T1,{questionNumber:t+1}),o.jsx(ll,{})]});case P.ANSWERING:return o.jsx(N1,{children:o.jsx(ll,{label:"You"})});case P.TRANSCRIBING:return o.jsx(cl,{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("img",{src:"../../../../src/assets/transcribing.gif",alt:"Transcribing",className:"iw-h-8 iw-w-12"}),o.jsx("span",{className:"iw-text-sm iw-text-[#062260]",children:"Analyzing answer…"})]})});default:return null}},A1=({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(_1,{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(S1,{phase:a==null?void 0:a.phase,questionNumber:t+1})]})},C1=()=>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))}),I1=({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(C1,{}):e==null?void 0:e.map((h,d)=>o.jsx(A1,{item:h,index:d,isCurrentQuestion:d===(e==null?void 0:e.length)-1,isEditable:!!(d===(e==null?void 0:e.length)-1&&n),answerText:s||"",onAnswerChange:a||(()=>{}),timerState:c,editingTime:l},h.qna_id)),o.jsx("div",{ref:i})]})]}),F1=({interviewId:e,className:t="",currentQuestion:r,lastSubmittedAnswer:i,isEditing:n,answerText:s,onAnswerChange:a,timerState:c,editingTime:l})=>{const h=sl(),[d,f]=u.useState([]),[w,g]=u.useState(!0),p=u.useRef(null);return u.useEffect(()=>{var y;(y=p.current)==null||y.scrollIntoView({behavior:"smooth"})},[d,s,c==null?void 0:c.phase]),u.useEffect(()=>{(async()=>{var b;try{const m=await h.getInterviewTranscription(e);f(((b=m==null?void 0:m.data)==null?void 0:b.question_answers)||[])}catch(m){console.error("Failed to fetch transcript:",m)}finally{g(!1)}})()},[e,h]),u.useEffect(()=>{r&&f(y=>{if(y.some(S=>S.qna_id===r.qna_id))return y;const m={qna_id:r.qna_id,question:r.question,answer:null,question_generated_at:new Date().toISOString(),answer_submitted_at:null};return[...y,m]})},[r]),u.useEffect(()=>{i!=null&&i.answer?f(y=>y.map(b=>b.qna_id===i.qnaId?{...b,answer:i.answer,answer_submitted_at:new Date().toISOString()}:b)):s&&f(y=>y.map(b=>b.qna_id===(i==null?void 0:i.qnaId)?{...b,answer:s,answer_submitted_at:new Date().toISOString()}:b))},[i,s]),o.jsx(I1,{transcript:d,isLoading:w||(d==null?void 0:d.length)===0,className:t,bottomRef:p,isEditing:n,answerText:s,onAnswerChange:a,timerState:c,editingTime:l})},L1=({onClick:e,text:t="Submit response"})=>(u.useEffect(()=>{if(typeof window>"u")return;const r=i=>{const n=i.metaKey||i.ctrlKey,s=i.key===" ",a=i.target;a.tagName==="INPUT"||a.isContentEditable||n&&s&&(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 Ctrl / ⌘ + Space"})]})})),dl=({brandName:e,brandLogo:t,currentQuestion:r,state:i,phase:n,className:s="",interviewId:a="",interview_duration:c=oi,videoFeedRef:l,lastSubmittedAnswer:h,onNextPhase:d,answerText:f,onAnswerChange:w,editingTime:g,answeringTime:p})=>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(x1,{question:r,isLoading:n===P.FETCHING_QUESTION||n===P.IDLE,phase:n,brandName:e,brandLogo:t,timerState:i,answeringTime:p})})}),o.jsx("div",{className:"iw-flex-1 iw-min-h-0 iw-rounded-[16px] iw-overflow-hidden iw-relative",children:o.jsx(tl,{ref:l,interviewId:a,interview_duration:c,isAnswering:n===P.ANSWERING})})]}),o.jsx("div",{className:"iw-interview-transcription iw-w-1/4 iw-min-w-32 iw-h-full",children:o.jsx(F1,{interviewId:a,currentQuestion:r,lastSubmittedAnswer:h,isEditing:n===P.EDITING,answerText:f,onAnswerChange:w,timerState:i,editingTime:g})}),d&&(n===P.ANSWERING||n===P.EDITING)&&o.jsx(L1,{onClick:d,text:n===P.ANSWERING?"Submit Response":"Submit Final Response"})]}),M1=({confirmExitInterview:e,isOpen:t,onClose:r})=>o.jsxs(Ds,{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(Ki,{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(Ki,{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"})]})]}),ul=({title:e,brandName:t,brandLogo:r,onExit:i,totalDuration:n=30,elapsedTime:s=0})=>{const[a,c]=u.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:cn(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(ln,{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(qs,{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(M1,{isOpen:a,confirmExitInterview:()=>{i(),c(!1)},onClose:()=>c(!1)})]})},P1=({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}=ci(),d=u.useRef(null),f=u.useRef(null),w=u.useRef(null),g=u.useRef(null),p=u.useRef(null),y=u.useRef(null),b=u.useRef(!1),[m,S]=u.useState(null);u.useEffect(()=>{if(t||!f.current)return;const C=f.current,U=()=>{const V=d.current;if(!V)return;const ne=C.clientWidth,T=r;V.width=Math.max(1,Math.floor(ne*window.devicePixelRatio||1)),V.height=Math.max(1,Math.floor(T*window.devicePixelRatio||1))},L=new ResizeObserver(U);return L.observe(C),U(),()=>L.disconnect()},[t,r]),u.useEffect(()=>{if(!t)return;const C=d.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]),u.useEffect(()=>{let C=!1;return(async()=>{try{const L=new(window.AudioContext||window.webkitAudioContext);w.current=L;let V=c;if(!V){if(!l)return;V=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1}),b.current=!0}if(C)return;const ne=L.createAnalyser();ne.fftSize=s,ne.smoothingTimeConstant=a,g.current=ne;const T=L.createMediaStreamSource(V);p.current=T,T.connect(ne),I()}catch(L){S((L==null?void 0:L.message)||"Failed to initialize microphone")}})(),()=>{var L,V,ne,T;C=!0,y.current&&cancelAnimationFrame(y.current);try{(L=p.current)==null||L.disconnect()}catch{}try{(V=g.current)==null||V.disconnect()}catch{}b.current&&((T=((ne=p.current)==null?void 0:ne.mediaStream)||void 0)==null||T.getTracks().forEach(j=>j.stop())),w.current&&w.current.state!=="closed"&&w.current.close()}},[c,s,a,l]);const I=()=>{const C=d.current,U=g.current;if(!C||!U)return;const L=C.getContext("2d");if(!L)return;const V=window.devicePixelRatio||1,ne=C.width,T=C.height,j=U.frequencyBinCount,ft=new Uint8Array(j),qe=()=>{y.current=requestAnimationFrame(qe),U.getByteTimeDomainData(ft),L.clearRect(0,0,ne,T),L.fillStyle="rgba(0,0,0,0)",L.fillRect(0,0,ne,T);const Ve=Math.max(1,Math.floor(i*V)),it=Math.max(1,Math.floor(n*V)),nt=Ve+it,Kt=Math.max(8,Math.floor((ne+it)/nt)),Tt=Math.floor(ft.length/Kt);for(let St=0;St<Kt;St++){const wt=Math.min(ft.length-1,St*Tt),At=ft[wt]/128-1,st=Math.abs(At),Sr=Math.pow(st,.6),Ct=Math.max(T*.06,Sr*(T*.9)),ti=St*nt,ot=(T-Ct)/2,pe=140-Math.min(140,140*st),je=85,ee=48+Math.floor(12*(1-st));L.fillStyle=`${h}`,L.shadowColor=`hsla(${pe}, ${je}%, ${ee}%, ${.25*st})`,L.shadowBlur=8*st;const It=Math.min(Ve/2,Ct/2);D1(L,ti,ot,Ve,Ct,It),L.fill()}};qe()};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:d,className:"iw-w-full iw-h-full"}),m&&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:m})})]})};function D1(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 O1=({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(Hs,{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(Yi,{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(P1,{}),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(ei,{onClick:()=>{r()},children:"Transcribe My Answer"})})]});function B1(){const[e,t]=u.useState(!0),r=u.useMemo(()=>[0,1,2].map(i=>({id:i})),[]);return u.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 U1=({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),d=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":`${d}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}},[])},Ps=e=>{const{baseColor:t,borderRadius:r}=Xt(),{loading:i,children:n,...s}=e;return o.jsx(qi,{style:{background:Pl(t),borderRadius:r},...s,children:i?o.jsx(Xs,{}):n})},m2=(e,t,r)=>Math.max(t,Math.min(r,e)),cl=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}`},Ki=({total:e,remaining:t,size:r=64,strokeWidth:i=6,className:n="",showLabel:s=!0})=>{const a=Math.max(1,e||1),c=m2(t/a,0,1),{radius:l,circumference:h,dashOffset:d,center:f}=u.useMemo(()=>{const p=(r-i)/2,y=2*Math.PI*p,b=y*(1-c),m=Math.round(i)%2===1,A=r/2+(m?.5:0);return{radius:p,circumference:y,dashOffset:b,center:A}},[r,i,c]),w=u.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 ${cl(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:d,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:cl(t)})}):o.jsx("div",{className:"iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center iw-rotate-0",children:o.jsx(Hl,{})})]})},y2=({timerState:e,answeringTime:t})=>{const r=(e==null?void 0:e.currentPhaseTimeRemaining)||0,i=t||nl.answeringDuration;return o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-3",children:[o.jsx(Ki,{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:[on(r)," mins"]})]})]})},b2=({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(an,{brandLogo:n,brandName:i})})}),o.jsx(v2,{phase:r,question:e,isLoading:t,brandName:i,timerState:s,answeringTime:a})]})}),v2=({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(y2,{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})}},x2=({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":"",d=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} ${d} ${i}`,"aria-invalid":t?"true":"false",...s}),t&&o.jsx("p",{className:"iw-mt-1 iw-text-sm iw-text-red-600",children:t})]})},E2=({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(x2,{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(Ki,{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:`${on(r.currentPhaseTimeRemaining)} mins`})]})]})]}),ll=({children:e})=>o.jsx("div",{className:"iw-flex iw-flex-col iw-items-start iw-mt-3 iw-gap-1",children:e}),_2=({children:e})=>o.jsx("div",{className:"iw-flex iw-flex-col iw-items-end iw-mt-3 iw-gap-1",children:e}),k2=({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]}),dl=({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:"."})]})]}),T2=({phase:e,questionNumber:t})=>{switch(e){case P.FETCHING_QUESTION:return o.jsxs(ll,{children:[o.jsx(k2,{questionNumber:t+1}),o.jsx(dl,{})]});case P.ANSWERING:return o.jsx(_2,{children:o.jsx(dl,{label:"You"})});case P.TRANSCRIBING:return o.jsx(ll,{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}},A2=({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(E2,{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(T2,{phase:a==null?void 0:a.phase,questionNumber:t+1})]})},S2=()=>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))}),C2=({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(S2,{}):e==null?void 0:e.map((h,d)=>o.jsx(A2,{item:h,index:d,isCurrentQuestion:d===(e==null?void 0:e.length)-1,isEditable:!!(d===(e==null?void 0:e.length)-1&&n),answerText:s,onAnswerChange:a||(()=>{}),timerState:c,editingTime:l},h.qna_id)),o.jsx("div",{ref:i})]})]}),N2=({interviewId:e,className:t="",currentQuestion:r,lastSubmittedAnswer:i,isEditing:n,answerText:s,onAnswerChange:a,timerState:c,editingTime:l})=>{const h=ol(),[d,f]=u.useState([]),[w,g]=u.useState(!0),p=u.useRef(null);return u.useEffect(()=>{var y;(y=p.current)==null||y.scrollIntoView({behavior:"smooth"})},[d,s,c==null?void 0:c.phase]),u.useEffect(()=>{(async()=>{var b;try{const m=await h.getInterviewTranscription(e);f(((b=m==null?void 0:m.data)==null?void 0:b.transcript)||[])}catch(m){console.error("Failed to fetch transcript:",m)}finally{g(!1)}})()},[e,h]),u.useEffect(()=>{r&&f(y=>{if(y.some(A=>A.qna_id===r.qna_id))return y;const m={qna_id:r.qna_id,question:r.question,answer:null,question_generated_at:new Date().toISOString(),answer_submitted_at:null};return[...y,m]})},[r]),u.useEffect(()=>{i!=null&&i.answer?f(y=>y.map(b=>b.qna_id===i.qnaId?{...b,answer:i.answer,answer_submitted_at:new Date().toISOString()}:b)):s&&f(y=>y.map(b=>b.qna_id===(i==null?void 0:i.qnaId)?{...b,answer:s,answer_submitted_at:new Date().toISOString()}:b))},[i,s]),o.jsx(C2,{transcript:d,isLoading:w||(d==null?void 0:d.length)===0,className:t,bottomRef:p,isEditing:n,answerText:s,onAnswerChange:a,timerState:c,editingTime:l})},Ds=5,Os=5;function I2({isOpen:e,onClose:t,warningCount:r,violationType:i,onDisqualify:n}){const[,s]=u.useState(Os),a=u.useRef(t),c=u.useRef(n),l=u.useRef(r);if(u.useEffect(()=>{a.current=t,c.current=n,l.current=r},[t,n,r]),u.useEffect(()=>{if(!e)return;const w=setInterval(()=>{s(g=>g<=1?(l.current+1>Ds?c.current():a.current(),Os):g-1)},1e3);return()=>clearInterval(w)},[e]),u.useEffect(()=>{e&&s(Os)},[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"}},d=Ds-r,f=()=>{r+1>Ds?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(Mr,{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(cn,{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 ",d>0?d:0," warning",d>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:d===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 F2=({isOpen:e,onClose:t,children:r,title:i,showCloseButton:n=!0,closeOnOverlayClick:s=!0,closeOnEscape:a=!0,className:c=""})=>{if(u.useEffect(()=>{if(!e||!a)return;const d=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,a,t]),u.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=d=>{s&&d.target===d.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 Vs.createPortal(h,document.body)},L2=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"})]}),M2=({showHardReloadWarning:e,onContinue:t})=>{const r=()=>{t()};return o.jsxs(F2,{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(cn,{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(L2,{className:"iw-size-4"}),"Continue Session"]})})]})},ul=u.createContext(null),P2=()=>{const e=u.useContext(ul);if(!e)throw new Error("useProctoring must be used within InterviewProctoring");return e},D2=u.forwardRef(({children:e,onDisqualify:t},r)=>{const[i,n]=u.useState(!1),[s,a]=u.useState(!1),[c,l]=u.useState(!1),[h,d]=u.useState("fullscreen_exit"),{logViolation:f,violationCount:w}=g2({maxViolations:5,onViolation:m=>{s||(n(!0),d(m.type))}}),{enterFullScreen:g,isFullScreen:p,exitFullScreen:y}=c2({onFullScreenChange(m){!m&&!s&&!c&&(n(!0),f({type:"fullscreen_exit",severity:"high",details:{action:"fullscreen_exit",reason:"Attempted to exit full screen mode"}})),m&&l(!1)}});u.useEffect(()=>{g()},[]),u.useImperativeHandle(r,()=>({exitFullScreenIntentionally:async()=>{l(!0),n(!1),a(!1);try{document.fullscreenElement&&await document.exitFullscreen()}catch(m){console.error("Failed to exit fullscreen:",m)}}}),[]),u2(f),l2(f),h2(),p2();const b=()=>{a(!0),y(),n(!1),t==null||t()};return o.jsxs(ul.Provider,{value:{violationCount:w,violationType:h,showWarningModal:i,setShowWarningModal:n,handleClose:()=>{n(!1),g()},handleDisqualify:b},children:[o.jsx("div",{className:"iw-relative iw-h-full iw-w-full",children:e}),!i&&w>0&&!s&&!c&&o.jsx(M2,{showHardReloadWarning:!p,logViolation:f,onContinue:g})]})}),O2=({onClick:e,text:t="Submit response"})=>(u.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"})]})})),hl=({brandName:e,brandLogo:t,currentQuestion:r,state:i,phase:n,className:s="",interviewId:a="",interview_duration:c=ai,videoFeedRef:l,lastSubmittedAnswer:h,onNextPhase:d,answerText:f,onAnswerChange:w,editingTime:g,answeringTime:p})=>{const{showWarningModal:y,violationCount:b,violationType:m,handleClose:A,handleDisqualify:I}=P2();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(b2,{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(tl,{ref:l,interviewId:a,interview_duration:c,isAnswering:n===P.ANSWERING,cheatingWarningVisible:y}),o.jsx(I2,{isOpen:y,warningCount:b,violationType:m,onClose:A,onDisqualify:I})]})]}),o.jsx("div",{className:"iw-interview-transcription iw-w-1/4 iw-min-w-32 iw-h-full",children:o.jsx(N2,{interviewId:a,currentQuestion:r,lastSubmittedAnswer:h,isEditing:n===P.EDITING,answerText:f,onAnswerChange:w,timerState:i,editingTime:g})}),d&&(n===P.ANSWERING||n===P.EDITING)&&o.jsx(O2,{onClick:d,text:n===P.ANSWERING?"Submit Response":"Submit Final Response"})]})},B2=({isOpen:e,onClose:t,children:r,title:i,showCloseButton:n=!0,closeOnOverlayClick:s=!0,closeOnEscape:a=!0,className:c=""})=>{if(u.useEffect(()=>{if(!e||!a)return;const d=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,a,t]),u.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=d=>{s&&d.target===d.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 Vs.createPortal(h,document.body)},U2=({confirmExitInterview:e,isOpen:t,onClose:r})=>o.jsxs(B2,{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(qi,{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(qi,{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"})]})]}),fl=({title:e,brandName:t,brandLogo:r,onExit:i,totalDuration:n=30,elapsedTime:s=0})=>{const[a,c]=u.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:on(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(an,{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(Mr,{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(U2,{isOpen:a,confirmExitInterview:()=>{i(),c(!1)},onClose:()=>c(!1)})]})},G2=({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}=Xt(),d=u.useRef(null),f=u.useRef(null),w=u.useRef(null),g=u.useRef(null),p=u.useRef(null),y=u.useRef(null),b=u.useRef(!1),[m,A]=u.useState(null);u.useEffect(()=>{if(t||!f.current)return;const N=f.current,V=()=>{const j=d.current;if(!j)return;const ae=N.clientWidth,S=r;j.width=Math.max(1,Math.floor(ae*window.devicePixelRatio||1)),j.height=Math.max(1,Math.floor(S*window.devicePixelRatio||1))},L=new ResizeObserver(V);return L.observe(N),V(),()=>L.disconnect()},[t,r]),u.useEffect(()=>{if(!t)return;const N=d.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]),u.useEffect(()=>{let N=!1;return(async()=>{try{const L=new(window.AudioContext||window.webkitAudioContext);w.current=L;let j=c;if(!j){if(!l)return;j=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1}),b.current=!0}if(N)return;const ae=L.createAnalyser();ae.fftSize=s,ae.smoothingTimeConstant=a,g.current=ae;const S=L.createMediaStreamSource(j);p.current=S,S.connect(ae),I()}catch(L){A((L==null?void 0:L.message)||"Failed to initialize microphone")}})(),()=>{var L,j,ae,S;N=!0,y.current&&cancelAnimationFrame(y.current);try{(L=p.current)==null||L.disconnect()}catch{}try{(j=g.current)==null||j.disconnect()}catch{}b.current&&((S=((ae=p.current)==null?void 0:ae.mediaStream)||void 0)==null||S.getTracks().forEach(U=>U.stop())),w.current&&w.current.state!=="closed"&&w.current.close()}},[c,s,a,l]);const I=()=>{const N=d.current,V=g.current;if(!N||!V)return;const L=N.getContext("2d");if(!L)return;const j=window.devicePixelRatio||1,ae=N.width,S=N.height,U=V.frequencyBinCount,ht=new Uint8Array(U),Ht=()=>{y.current=requestAnimationFrame(Ht),V.getByteTimeDomainData(ht),L.clearRect(0,0,ae,S),L.fillStyle="rgba(0,0,0,0)",L.fillRect(0,0,ae,S);const pe=Math.max(1,Math.floor(i*j)),tt=Math.max(1,Math.floor(n*j)),rt=pe+tt,At=Math.max(8,Math.floor((ae+tt)/rt)),Ar=Math.floor(ht.length/At);for(let it=0;it<At;it++){const ft=Math.min(ht.length-1,it*Ar),St=ht[ft]/128-1,nt=Math.abs(St),Sr=Math.pow(nt,.6),Ct=Math.max(S*.06,Sr*(S*.9)),ti=it*rt,Cr=(S-Ct)/2,we=140-Math.min(140,140*nt),st=85,$=48+Math.floor(12*(1-nt));L.fillStyle=`${h}`,L.shadowColor=`hsla(${we}, ${st}%, ${$}%, ${.25*nt})`,L.shadowBlur=8*nt;const qt=Math.min(pe/2,Ct/2);V2(L,ti,Cr,pe,Ct,qt),L.fill()}};Ht()};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:d,className:"iw-w-full iw-h-full"}),m&&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:m})})]})};function V2(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 j2=({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(Ys,{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(Ki,{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(G2,{}),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(Ps,{onClick:()=>{r()},children:"Transcribe My Answer"})})]});function W2(){const[e,t]=u.useState(!0),r=u.useMemo(()=>[0,1,2].map(i=>({id:i})),[]);return u.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 $2=({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),d=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":`${d}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 G1({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(U1,{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 V1=({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(Hs,{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(Yi,{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(ei,{onClick:()=>{r()},children:"Start Answering"})})]}),j1=({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)"]})]}),Xi=5;function W1({isOpen:e,onClose:t,warningCount:r,violationType:i,onDisqualify:n}){const[s,a]=u.useState(10),c=u.useRef(t);if(u.useEffect(()=>{c.current=t},[t]),u.useEffect(()=>{if(!e)return;const w=setInterval(()=>{a(g=>g<=1?(c.current(),10):g-1)},1e3);return()=>clearInterval(w)},[e]),u.useEffect(()=>{e&&a(10)},[e]),u.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 h=(()=>{switch(i){case"tab_switch":return{title:"Tab Switch Detected",description:"You attempted to switch to another tab or reload application.",icon:o.jsx(Ks,{className:"iw-h-5 iw-w-5"})};case"fullscreen_exit":return{title:"Full Screen Exit Detected",description:"You attempted to exit full screen mode.",icon:o.jsx(zl,{className:"iw-h-5 iw-w-5"})};case"focus_loss":return{title:"Focus Loss Detected",description:"You lost focus from the interview window.",icon:o.jsx(Vl,{className:"iw-h-5 iw-w-5"})};case"blocked_shortcut":return{title:"Keyboard Shortcut Blocked",description:"You attempted to use a blocked keyboard shortcut.",icon:o.jsx(dn,{className:"iw-h-5 iw-w-5"})};case"right_click_attempt":return{title:"Right Click Attempted",description:"You attempted to use the right click.",icon:o.jsx(Hl,{className:"iw-h-5 iw-w-5"})};case"alt_tab_attempt":return{title:"Alt + Tab Attempted",description:"You attempted to use the Alt + Tab shortcut.",icon:o.jsx(dn,{className:"iw-h-5 iw-w-5"})};case"blocked_function_key":return{title:"Function Key Blocked",description:"You attempted to use a blocked function key.",icon:o.jsx(dn,{className:"iw-h-5 iw-w-5"})};default:return{title:"Violation Detected",description:"You attempted to perform an action that is not allowed.",icon:o.jsx(Lr,{className:"iw-h-5 iw-w-5"})}}})(),d=Xi-r,f=()=>{r+1>Xi?n():t()};return o.jsx("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-black/60 iw-p-4 iw-backdrop-blur-sm",children:o.jsxs("div",{className:"iw-w-full iw-max-w-md iw-rounded-2xl iw-border iw-border-gray-100 iw-bg-white iw-shadow-xl",children:[o.jsxs("div",{className:"iw-p-6 iw-pb-0",children:[o.jsxs("div",{className:"iw-mb-6 iw-flex iw-items-start iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-12 iw-w-12 iw-flex-shrink-0 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-red-50",children:o.jsx(Lr,{className:"iw-h-6 iw-w-6 iw-text-red-500"})}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsx("h2",{className:"iw-mb-1 iw-text-xl iw-font-semibold iw-text-gray-900",children:"Security Violation"}),o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[o.jsx("span",{className:"iw-text-sm iw-text-gray-500",children:"Warning"}),o.jsx("div",{className:"iw-flex iw-gap-1",children:Array.from({length:Xi}).map((w,g)=>o.jsx("div",{className:`iw-h-2 iw-w-2 iw-rounded-full ${g<=r-1?"iw-bg-red-500":"iw-bg-gray-200"}`},g))}),o.jsxs("span",{className:"iw-text-sm iw-text-gray-500",children:["(",r,"/",Xi,")"]})]})]})]}),o.jsx("div",{className:"iw-mb-5 iw-rounded-2xl iw-border iw-border-red-100 iw-p-5",style:{background:"linear-gradient(to right, rgb(254, 242, 242), rgb(254, 245, 235))",borderColor:"rgb(254, 226, 226)"},children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-items-center iw-justify-center iw-rounded-xl iw-bg-white iw-shadow-sm",children:h.icon}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsx("h3",{className:"iw-mb-2 iw-font-semibold iw-text-gray-900",children:h.title}),o.jsx("p",{className:"iw-text-sm iw-leading-relaxed iw-text-gray-700",children:h.description}),o.jsxs("div",{className:"iw-mt-3 iw-flex iw-items-center iw-gap-2 iw-text-xs iw-text-red-600",children:[o.jsx(ql,{className:"iw-h-3 iw-w-3"}),o.jsx("span",{children:"This action is monitored for interview integrity"})]})]})]})}),o.jsxs("div",{className:"iw-mb-5 iw-grid iw-grid-cols-2 iw-gap-3",children:[o.jsx("div",{className:"iw-rounded-xl iw-border iw-border-amber-200 iw-bg-amber-50 iw-p-4",children:o.jsxs("div",{className:"iw-text-center",children:[o.jsx("div",{className:"iw-mb-1 iw-text-2xl iw-font-bold iw-text-amber-600",children:d}),o.jsx("div",{className:"iw-text-xs iw-font-medium iw-text-amber-700",children:"Warnings Left"})]})}),o.jsx("div",{className:"iw-border-primary-100 iw-bg-primary-50 iw-rounded-xl iw-border iw-p-4",children:o.jsxs("div",{className:"iw-text-center",children:[o.jsxs("div",{className:"iw-mb-1 iw-flex iw-items-center iw-justify-center iw-gap-1.5",children:[o.jsx(Gl,{className:"iw-text-primary-600 iw-h-4 iw-w-4"}),o.jsx("span",{className:"iw-text-primary-600 iw-text-2xl iw-font-bold",children:s})]}),o.jsx("div",{className:"iw-text-primary-700 iw-text-xs iw-font-medium",children:"Auto Close"})]})})]}),d===1&&o.jsx("div",{className:"iw-mb-5 iw-rounded-2xl iw-p-4 iw-text-white",style:{background:"linear-gradient(to right, rgba(220, 38, 38, 0.9), rgba(239, 68, 68, 0.9))"},children:o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-3",children:[o.jsx("div",{className:"iw-flex iw-h-8 iw-w-8 iw-items-center iw-justify-center iw-rounded-full iw-bg-white/20",children:o.jsx(Lr,{className:"iw-h-4 iw-w-4"})}),o.jsxs("div",{children:[o.jsx("div",{className:"iw-text-sm iw-font-semibold",children:"Final Warning"}),o.jsx("div",{className:"iw-text-xs iw-text-red-100",children:"Next violation will disqualify you from this interview"})]})]})})]}),o.jsxs("div",{className:"iw-p-6 iw-pt-0",children:[o.jsx(ei,{onClick:f,className:"iw-h-12 iw-w-full iw-rounded-xl iw-bg-gray-800 iw-text-sm iw-font-medium iw-text-white iw-hover:bg-gray-800",children:"I Understand - Continue Interview"}),o.jsx("p",{className:"iw-text-gray-500 iw-mt-3 iw-text-center iw-text-xs",children:"Please maintain focus and avoid switching tabs, exiting fullscreen, using shortcuts or right-clicking."})]})]})})}const $1=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"})]}),z1=({showHardReloadWarning:e,onContinue:t})=>{const r=()=>{t()};return o.jsxs(Ds,{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(Lr,{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($1,{className:"iw-size-4"}),"Continue Session"]})})]})},H1=u.forwardRef(({children:e,onDisqualify:t},r)=>{const[i,n]=u.useState(!1),[s,a]=u.useState(!1),[c,l]=u.useState(!1),[h,d]=u.useState("fullscreen_exit"),{logViolation:f,violationCount:w}=m1({maxViolations:5,onViolation:m=>{s||(n(!0),d(m.type))}}),{enterFullScreen:g,isFullScreen:p,exitFullScreen:y}=d1({onFullScreenChange(m){!m&&!s&&!c&&(n(!0),f({type:"fullscreen_exit",severity:"high",details:{action:"fullscreen_exit",reason:"Attempted to exit full screen mode"}})),m&&l(!1)}});u.useEffect(()=>{g()},[]),u.useImperativeHandle(r,()=>({exitFullScreenIntentionally:async()=>{l(!0),n(!1),a(!1);try{document.fullscreenElement&&await document.exitFullscreen()}catch(m){console.error("Failed to exit fullscreen:",m)}}}),[]),f1(f),u1(f),w1(),y1();const b=()=>{a(!0),y(),n(!1),t==null||t()};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"iw-relative iw-h-full iw-w-full",children:e}),o.jsx(W1,{warningCount:w,isOpen:i,violationType:h,onClose:()=>{n(!1),g()},onDisqualify:b}),!i&&w>0&&!s&&!c&&o.jsx(z1,{showHardReloadWarning:!p,logViolation:f,onContinue:g})]})}),q1=({interviewTitle:e,brandName:t="Novara",brandLogo:r,interviewId:i,onComplete:n,onDisqualify:s,className:a="",videoFeedRef:c})=>{var Ji;const l=sl(),{baseUrl:h,authToken:d}=zs(),{timers:f,stt:w,proctoring:g}=an(),p=u.useRef(null),[y,b]=u.useState(null),[m,S]=u.useState(""),[I,C]=u.useState(null),[U,L]=u.useState(oi),[V,ne]=u.useState(!0),T=u.useRef(""),j=u.useRef(null);u.useEffect(()=>{(async()=>{try{const Q=await l.getInterviewConfig(i);Q!=null&&Q.data&&(Q.data.duration_in_minutes&&L(Q.data.duration_in_minutes),typeof Q.data.allow_answer_editing=="boolean"&&ne(Q.data.allow_answer_editing))}catch(Q){console.error("Failed to fetch interview config:",Q)}})()},[i]);const ft={thinkingTime:(f==null?void 0:f.thinkingDuration)||0,answeringTime:(f==null?void 0:f.answeringDuration)||120,editingTime:V?(f==null?void 0:f.editingDuration)||30:0},{thinkingTime:qe,answeringTime:Ve,editingTime:it}=ft;u.useEffect(()=>{T.current=m},[m]);const nt=u.useRef(!1),{speak:Kt,stop:Tt,error:St}=p1({onEnd:()=>{nt.current=!1,ee()},onError:()=>{nt.current||(nt.current=!0,ee())}}),wt=u.useRef(!1),At=u.useRef(!1),{startRecording:st,stopRecording:Sr,transcribe:Ct,cancelRecording:ti,error:ot}=h1({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:d,qnaId:((Ji=j.current)==null?void 0:Ji.qna_id)||"",interviewId:i},onStart:()=>{wt.current=!1,At.current=!1},onStop:()=>{},onTranscriptionComplete:A=>{S(A.transcript),At.current||(At.current=!0,ee())},onError:A=>{console.error("STT Error:",A),wt.current||(wt.current=!0,ee())}}),{state:pe,startQuestion:je,nextPhase:ee,completeInterview:It}=c1({config:{answeringDuration:Ve,editingDuration:it},callbacks:{onPhaseChange:A=>{switch(A){case P.FETCHING_QUESTION:Ar();break;case P.READING_QUESTION:ii();break;case P.ANSWERING:Bs();break;case P.TRANSCRIBING:Qi();break;case P.SUBMITTING:ri();break}},onInterviewEnd:()=>{n==null||n()}}});u.useEffect(()=>{je()},[]);const{execute:Ar}=l1(async()=>{const A=await l.generateQuestion({interviewId:i});return j.current=A.data,A},{onSuccess:async A=>{A&&A.data&&(S(""),b(A.data),ee())},onError:A=>{console.error("Failed to fetch questions:",A)}}),ri=u.useCallback(async()=>{var A;try{const Q=T.current,Xt=((A=j.current)==null?void 0:A.qna_id)||"";await l.submitAnswer({interviewId:i,qnaId:Xt,answer:Q}),C({qnaId:Xt,answer:Q})}catch(Q){console.error("Failed to submit answer:",Q)}je()},[l,i,je]),ii=u.useCallback(async()=>{var A;if((A=j.current)!=null&&A.question)if(j.current.question_audio_data_base64)try{nt.current=!1,await Kt(j.current.question_audio_data_base64),j.current.is_interview_done&&It()}catch(Q){console.error("Failed to speak question:",Q),ee()}else console.warn("No audio data available for question"),await Ll(2e3),ee();else ee()},[Kt,ee,It]),Bs=u.useCallback(async()=>{try{await st(Ve)}catch(A){console.error("Failed to start recording:",A),ee()}},[st,ee]),Qi=u.useCallback(async()=>{try{const A=await Sr();await Ct(A)}catch(A){console.error("STT processing failed:",A),!wt.current&&!At.current&&(wt.current=!0,ee())}},[Sr,Ct,ee]),Yt=u.useCallback(async A=>{var Q,Xt;Tt(),ti(),c&&"current"in c&&((Q=c.current)==null||Q.stopCamera()),await((Xt=p.current)==null?void 0:Xt.exitFullScreenIntentionally());try{await l.exitInterview(i)}catch(Zi){console.error("API call failed:",Zi)}finally{A==null||A(),It(),sessionStorage.removeItem(nn)}},[i,Tt,l]),ni=()=>{const{phase:A}=pe;switch(A){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(ei,{onClick:je,className:"iw-mt-2 iw-w-40",children:"Start Interview"})]});case P.FETCHING_QUESTION:return o.jsx(B1,{});case P.READING_QUESTION:return o.jsx(G1,{ttsError:St});case P.THINKING:return o.jsx(V1,{state:pe,thinkingTime:qe,nextPhase:ee});case P.ANSWERING:return o.jsx(O1,{state:pe,answeringTime:Ve,nextPhase:ee,sttError:ot});case P.TRANSCRIBING:return o.jsx(j1,{sttError:ot,editingDuration:it});case P.EDITING:case P.SUBMITTING:return null;case P.COMPLETED:return null;default:return null}};return o.jsx(o.Fragment,{children:g!=null&&g.enabled?o.jsxs(H1,{ref:p,onDisqualify:()=>Yt(s),children:[o.jsx(ul,{title:e,brandName:t,brandLogo:r,totalDuration:U,elapsedTime:pe.totalTimeElapsed,onExit:()=>Yt()}),o.jsx(dl,{brandName:t,brandLogo:r,currentQuestion:y,state:pe,phase:pe.phase,className:a,interviewId:i,interview_duration:U,videoFeedRef:c,lastSubmittedAnswer:I,onNextPhase:ee,answerText:m,onAnswerChange:A=>S(A.target.value),editingTime:it,answeringTime:Ve,children:ni()})]}):o.jsxs(o.Fragment,{children:[o.jsx(ul,{title:e,brandName:t,brandLogo:r,totalDuration:U,elapsedTime:pe.totalTimeElapsed,onExit:()=>Yt()}),o.jsx(dl,{brandName:t,brandLogo:r,currentQuestion:y,state:pe,phase:pe.phase,className:a,interviewId:i,interview_duration:U,videoFeedRef:c,lastSubmittedAnswer:I,onNextPhase:ee,answerText:m,onAnswerChange:A=>S(A.target.value),editingTime:it,answeringTime:Ve,children:ni()})]})})},Os=({title:e,brandName:t,brandLogo:r,interviewId:i,onInterviewEnd:n,onInterviewDisqualify:s,className:a=""})=>{const[c,l]=u.useState(!1),[h,d]=u.useState(!0),[f,w]=u.useState(!1),{proctoring:g}=an(),p=u.useRef(null),y=u.useRef(null),b=(g==null?void 0:g.gazeAnalysisEnabled)===!0,m=()=>{l(!0),d(!1)};return u.useEffect(()=>{if(c&&f&&y.current&&b)try{y.current.setReference()}finally{w(!1)}},[c,f,b]),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(q1,{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(ln,{brandLogo:r,brandName:t}),o.jsx("p",{className:"iw-text-xl iw-font-semibold",children:t})]}),o.jsx(o1,{isOpen:h,gazeEnabled:b,onStart:m,onRequestCalibration:()=>w(!0),videoFeedRef:y,interviewId:i})]})};typeof window<"u"&&(window.InterviewWidget={InterviewWidget:Os,InterviewWidgetProvider:$s}),he.InterviewWidget=Os,he.InterviewWidgetProvider=$s,he.default=Os,Object.defineProperties(he,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
179
|
+
`})})};function z2({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($2,{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 H2=({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(Ys,{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(Ki,{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(Ps,{onClick:()=>{r()},children:"Start Answering"})})]}),q2=({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)"]})]}),K2=({interviewTitle:e,brandName:t="Novara",brandLogo:r,interviewId:i,onComplete:n,onDisqualify:s,className:a="",videoFeedRef:c})=>{var Xi;const l=ol(),{baseUrl:h,authToken:d}=qs(),{timers:f,stt:w,proctoring:g}=sn(),p=u.useRef(null),[y,b]=u.useState(null),[m,A]=u.useState(""),[I,N]=u.useState(null),[V,L]=u.useState(ai),[j,ae]=u.useState(!0),S=u.useRef(""),U=u.useRef(null),ht={thinkingTime:(f==null?void 0:f.thinkingDuration)||0,answeringTime:(f==null?void 0:f.answeringDuration)||120,editingTime:j?(f==null?void 0:f.editingDuration)||30:0},{thinkingTime:Ht,answeringTime:pe,editingTime:tt}=ht;u.useEffect(()=>{S.current=m},[m]);const rt=u.useRef(!1),{speak:At,stop:Ar,error:it}=w2({onEnd:()=>{rt.current=!1,$()},onError:()=>{rt.current||(rt.current=!0,$())}}),ft=u.useRef(!1),St=u.useRef(!1),{startRecording:nt,stopRecording:Sr,transcribe:Ct,cancelRecording:ti,error:Cr}=d2({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:d,qnaId:((Xi=U.current)==null?void 0:Xi.qna_id)||"",interviewId:i},onStart:()=>{ft.current=!1,St.current=!1},onStop:()=>{},onTranscriptionComplete:C=>{const D=C.transcript;A(D),S.current=D,St.current||(St.current=!0,$())},onError:C=>{console.error("STT Error:",C),ft.current||(ft.current=!0,$())}}),{state:we,startQuestion:st,nextPhase:$,completeInterview:qt,timerService:ri}=o2({config:{answeringDuration:pe,editingDuration:tt},callbacks:{onPhaseChange:C=>{switch(C){case P.FETCHING_QUESTION:Nr();break;case P.READING_QUESTION:ni();break;case P.ANSWERING:Us();break;case P.TRANSCRIBING:Yi();break;case P.SUBMITTING:ii();break}},onInterviewEnd:()=>{n==null||n()}}});u.useEffect(()=>{st()},[]),u.useEffect(()=>{(async()=>{try{const D=await l.getInterviewConfig(i);if(D!=null&&D.data&&(D.data.duration_in_minutes&&L(D.data.duration_in_minutes),typeof D.data.allow_answer_editing=="boolean"&&ae(D.data.allow_answer_editing),typeof D.data.elapsed_time_in_minutes=="number")){const wt=Math.floor(D.data.elapsed_time_in_minutes*60);ri.setTotalTimeElapsed(wt)}}catch(D){console.error("Failed to fetch interview config:",D)}})()},[i,ri]);const{execute:Nr}=a2(async()=>{const C=await l.generateQuestion({interviewId:i});return U.current=C.data,C},{onSuccess:async C=>{C&&C.data&&(A(""),S.current="",b(C.data),$())},onError:C=>{console.error("Failed to fetch questions:",C)}}),ii=u.useCallback(async()=>{var C;try{const D=S.current,wt=((C=U.current)==null?void 0:C.qna_id)||"";j&&await l.submitAnswer({interviewId:i,qnaId:wt,answer:D}),N({qnaId:wt,answer:D})}catch(D){console.error("Failed to submit answer:",D)}st()},[l,i,st,j]),ni=u.useCallback(async()=>{var C;if((C=U.current)!=null&&C.question)if(U.current.question_audio_data_base64)try{rt.current=!1,await At(U.current.question_audio_data_base64),U.current.is_interview_done&&qt()}catch(D){console.error("Failed to speak question:",D),$()}else console.warn("No audio data available for question"),await Ml(2e3),$();else $()},[At,$,qt]),Us=u.useCallback(async()=>{try{await nt(pe)}catch(C){console.error("Failed to start recording:",C),$()}},[nt,$]),Yi=u.useCallback(async()=>{try{const C=await Sr();await Ct(C)}catch(C){console.error("STT processing failed:",C),!ft.current&&!St.current&&(ft.current=!0,$())}},[Sr,Ct,$]),Kt=u.useCallback(async C=>{var D,wt;Ar(),ti(),c&&"current"in c&&((D=c.current)==null||D.stopCamera()),await((wt=p.current)==null?void 0:wt.exitFullScreenIntentionally());try{await l.exitInterview(i)}catch(Qi){console.error("API call failed:",Qi)}finally{C==null||C(),qt(),sessionStorage.removeItem(tn)}},[i,Ar,l]),si=()=>{const{phase:C}=we;switch(C){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(Ps,{onClick:st,className:"iw-mt-2 iw-w-40",children:"Start Interview"})]});case P.FETCHING_QUESTION:return o.jsx(W2,{});case P.READING_QUESTION:return o.jsx(z2,{ttsError:it});case P.THINKING:return o.jsx(H2,{state:we,thinkingTime:Ht,nextPhase:$});case P.ANSWERING:return o.jsx(j2,{state:we,answeringTime:pe,nextPhase:$,sttError:Cr});case P.TRANSCRIBING:return o.jsx(q2,{sttError:Cr,editingDuration:tt});case P.EDITING:case P.SUBMITTING:return null;case P.COMPLETED:return null;default:return null}};return o.jsx(o.Fragment,{children:g!=null&&g.enabled?o.jsxs(D2,{ref:p,onDisqualify:()=>Kt(s),children:[o.jsx(fl,{title:e,brandName:t,brandLogo:r,totalDuration:V,elapsedTime:we.totalTimeElapsed,onExit:()=>Kt()}),o.jsx(hl,{brandName:t,brandLogo:r,currentQuestion:y,state:we,phase:we.phase,className:a,interviewId:i,interview_duration:V,videoFeedRef:c,lastSubmittedAnswer:I,onNextPhase:$,answerText:m,onAnswerChange:C=>{const D=C.target.value;A(D),S.current=D},editingTime:tt,answeringTime:pe,children:si()})]}):o.jsxs(o.Fragment,{children:[o.jsx(fl,{title:e,brandName:t,brandLogo:r,totalDuration:V,elapsedTime:we.totalTimeElapsed,onExit:()=>Kt()}),o.jsx(hl,{brandName:t,brandLogo:r,currentQuestion:y,state:we,phase:we.phase,className:a,interviewId:i,interview_duration:V,videoFeedRef:c,lastSubmittedAnswer:I,onNextPhase:$,answerText:m,onAnswerChange:C=>{const D=C.target.value;A(D),S.current=D},editingTime:tt,answeringTime:pe,children:si()})]})})},Bs=({title:e,brandName:t,brandLogo:r,interviewId:i,onInterviewEnd:n,onInterviewDisqualify:s,className:a=""})=>{const[c,l]=u.useState(!1),[h,d]=u.useState(!0),[f,w]=u.useState(!1),{proctoring:g}=sn(),p=u.useRef(null),y=u.useRef(null),b=(g==null?void 0:g.gazeAnalysisEnabled)===!0,m=()=>{l(!0),d(!1)};return u.useEffect(()=>{if(c&&f&&y.current&&b)try{y.current.setReference()}finally{w(!1)}},[c,f,b]),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(K2,{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(an,{brandLogo:r,brandName:t}),o.jsx("p",{className:"iw-text-xl iw-font-semibold",children:t})]}),o.jsx(n2,{isOpen:h,gazeEnabled:b,onStart:m,onRequestCalibration:()=>w(!0),videoFeedRef:y,interviewId:i})]})};typeof window<"u"&&(window.InterviewWidget={InterviewWidget:Bs,InterviewWidgetProvider:Hs}),he.InterviewWidget=Bs,he.InterviewWidgetProvider=Hs,he.default=Bs,Object.defineProperties(he,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|