interview-widget 1.0.12 → 1.0.15

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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var kl=Symbol.for("react.transitional.element"),_l=Symbol.for("react.fragment");function qs(e,t,r){var i=null;if(r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),"key"in t){r={};for(var n in t)n!=="key"&&(r[n]=t[n])}else r=t;return t=r.ref,{$$typeof:kl,type:e,key:i,ref:t!==void 0?t:null,props:r}}Jr.Fragment=_l,Jr.jsx=qs,Jr.jsxs=qs,Hs.exports=Jr;var o=Hs.exports;const Qi={},tt={api:{baseUrl:"/api",retryConfig:{attempts:3,backoff:"exponential",baseDelay:1e3}},ui:{baseColor:"#3B82F6",borderRadius:"8px"},interview:{timers:{thinkingDuration:30,answeringDuration:120,editingDuration:30},stt:{provider:"groq",model:"whisper-large-v3-turbo",language:"en"},tts:{provider:"piper"},proctoring:{enabled:!0,gazeAnalysisEnabled:!0}}},Zi="iw-storage";function El(){if(!(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ji&&Ji.tagName.toUpperCase()==="SCRIPT"&&Ji.src||new URL("widget.umd.js",document.baseURI).href}<"u"&&(Qi!=null&&Qi.VITE_IW_SECRET)))return typeof process<"u"&&process.env.NEXT_PUBLIC_IW_SECRET?process.env.NEXT_PUBLIC_IW_SECRET:typeof window<"u"&&window.__IW_SECRET__?window.__IW_SECRET__:"proctoring-data-seed"}const Ys=El(),en=5,tn="AES-GCM",rn=12;async function Ks(e){const r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return crypto.subtle.importKey("raw",i,tn,!1,["encrypt","decrypt"])}function jl(){return crypto.getRandomValues(new Uint8Array(rn))}async function Tl(e,t="default-seed"){try{const r=typeof e=="string"?e:JSON.stringify(e),n=new TextEncoder().encode(r),s=await Ks(t),a=jl(),c=await crypto.subtle.encrypt({name:tn,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 Sl(e,t="default-seed"){try{const r=atob(e),i=new Uint8Array(r.length);for(let u=0;u<r.length;u++)i[u]=r.charCodeAt(u);const n=i.slice(0,rn),s=i.slice(rn),a=await Ks(t),c=await crypto.subtle.decrypt({name:tn,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 Al(e,t="default-seed"){return Tl(e,t)}async function Cl(e,t="default-seed"){const r=await Sl(e,t);try{return JSON.parse(r)}catch{return r}}const Ar=h.createContext(null),Nl=async()=>{try{const e=sessionStorage.getItem(Zi);if(e){const r=(await Cl(e,Ys)).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}}},Cr=async e=>{try{const t=await Al({state:e,version:0},Ys);sessionStorage.setItem(Zi,t)}catch(t){console.error("Failed to save proctoring data to session storage:",t)}},Il=({children:e})=>{const t=h.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=h.useRef(new Set);h.useEffect(()=>{Nl().then(w=>{t.current=w,i()})},[]);const i=h.useCallback(()=>{r.current.forEach(w=>w())},[]),n=h.useCallback(w=>(r.current.add(w),()=>{r.current.delete(w)}),[]),s=h.useCallback(()=>t.current,[]),a=h.useCallback(w=>{t.current={...t.current,logViolations:[...t.current.logViolations,w],totalViolations:t.current.totalViolations+1},Cr(t.current),i()},[i]),c=h.useCallback(w=>{const m={...t.current.gazeViolationCounters};w==="looking_away"&&(m.lookingAwayCount+=1),w==="no_face_detected"&&(m.noFaceDetectedCount+=1),w==="multiple_faces"&&(m.multipleFacesCount+=1),m.totalGazeViolations=m.lookingAwayCount+m.noFaceDetectedCount+m.multipleFacesCount,t.current={...t.current,gazeViolationCounters:m},Cr(t.current),i()},[i]),l=h.useCallback(()=>{t.current={...t.current,logViolations:[],totalViolations:0},Cr(t.current),i()},[i]),u=h.useCallback(()=>{t.current={...t.current,gazeViolationCounters:{lookingAwayCount:0,noFaceDetectedCount:0,multipleFacesCount:0,totalGazeViolations:0}},Cr(t.current),i()},[i]),d=h.useCallback((w,m)=>{t.current={...t.current,referenceSet:w,referenceRef:m},Cr(t.current),i()},[i]),f=h.useMemo(()=>({getState:s,addViolation:a,clearViolations:l,subscribe:n,incrementGazeViolation:c,clearGazeViolationCounters:u,setReferenceData:d}),[s,a,l,n,c,u,d]);return o.jsx(Ar.Provider,{value:f,children:e})},Xs=()=>{const e=h.useContext(Ar);if(!e)throw new Error("useProctoringStore must be used within a ProctoringProvider");const t=h.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}},Ml=()=>{const e=h.useContext(Ar);if(!e)throw new Error("useViolations must be used within a ProctoringProvider");return h.useSyncExternalStore(e.subscribe,()=>e.getState().logViolations,()=>e.getState().logViolations)},Ll=()=>{const e=h.useContext(Ar);if(!e)throw new Error("useTotalViolations must be used within a ProctoringProvider");return h.useSyncExternalStore(e.subscribe,()=>e.getState().totalViolations,()=>e.getState().totalViolations)},Fl=()=>{const e=h.useContext(Ar);if(!e)throw new Error("useProctoringActions must be used within a ProctoringProvider");return{addViolation:e.addViolation,clearViolations:e.clearViolations}},Js=h.createContext(null);function Qs({config:e={},children:t}){var i,n,s,a;const r={api:{...tt.api,...e.api,retryConfig:{...tt.api.retryConfig,...(i=e.api)==null?void 0:i.retryConfig}},ui:{...tt.ui,...e.ui},interview:{...tt.interview,...e.interview,timers:{...tt.interview.timers,...(n=e.interview)==null?void 0:n.timers},stt:{...tt.interview.stt,...(s=e.interview)==null?void 0:s.stt},tts:{...tt.interview.tts,...(a=e.interview)==null?void 0:a.tts}}};return o.jsx(Js.Provider,{value:r,children:o.jsx(Il,{children:t})})}function Qr(){const e=h.useContext(Js);if(!e)throw new Error("useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>");return e}function Zs(){return Qr().api||tt.api}function Zt(){return Qr().ui||tt.ui}function nn(){return Qr().interview||tt.interview}const eo=({className:e,...t})=>o.jsx("div",{children:o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`iw-animate-spin ${e}`,...t,children:[o.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o.jsx("path",{d:"M12 6l0 -3"}),o.jsx("path",{d:"M16.25 7.75l2.15 -2.15"}),o.jsx("path",{d:"M18 12l3 0"}),o.jsx("path",{d:"M16.25 16.25l2.15 2.15"}),o.jsx("path",{d:"M12 18l0 3"}),o.jsx("path",{d:"M7.75 16.25l-2.15 2.15"}),o.jsx("path",{d:"M6 12l-3 0"}),o.jsx("path",{d:"M7.75 7.75l-2.15 -2.15"})]})}),to=({children:e,variant:t="primary",size:r="md",fullWidth:i=!1,isLoading:n=!1,disabled:s,className:a="",...c})=>{const l="iw-inline-flex iw-items-center iw-justify-center iw-rounded-md iw-font-medium iw-transition-colors iw-focus:outline-none iw-focus:ring-2 iw-focus:ring-primary-500 iw-focus:ring-offset-2",u={primary:"iw-bg-primary-600 iw-text-white iw-hover:bg-primary-700 iw-border iw-border-transparent",secondary:"iw-bg-primary-100 iw-text-primary-700 iw-hover:bg-primary-200 iw-border iw-border-transparent",outline:"iw-bg-transparent iw-text-primary-700 iw-border iw-border-primary-500 iw-hover:bg-primary-50",text:"iw-bg-transparent iw-text-primary-600 iw-hover:bg-primary-50 iw-border iw-border-transparent",gradient:"iw-text-white iw-border iw-border-transparent iw-bg-gradient-to-r iw-from-purple-500 iw-to-indigo-500 hover:iw-from-purple-600 hover:iw-to-indigo-600"},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} ${u[t]} ${d[r]} ${w} ${f} ${a}`,disabled:s||n,...c,children:[n&&o.jsx(eo,{height:16,width:16,style:{marginRight:"3px"}}),e]})};function Pl(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 Dl(e,t,r){return"#"+[e,t,r].map(i=>{const n=Math.round(i).toString(16);return n.length===1?"0"+n:n}).join("")}function ro(e,t){const r=Pl(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 Dl(i,n,s)}function Rl(e,t=.8){return{background:`linear-gradient(to bottom, ${ro(e,t)}, #ffffff)`,color:"#1f2937"}}function io(e){return new Promise(t=>setTimeout(t,e))}function no(e){return`linear-gradient(to left, ${ro(e,.4)}, ${e})`}const Ol=()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);function Bl(e){try{const t=e.split(".");if(t.length!==3||!t[1])throw new Error("Invalid JWT token");const i=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=i.padEnd(i.length+(4-i.length%4)%4,"="),s=atob(n);return JSON.parse(s)}catch(t){return console.error("Error decoding JWT:",t),null}}const so=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]}),oo=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}),o.jsx("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),o.jsx("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]}),Ul=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o.jsx("path",{d:"M15 8a5 5 0 0 1 0 8"}),o.jsx("path",{d:"M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a.8 .8 0 0 1 1.5 .5v14a.8 .8 0 0 1 -1.5 .5l-3.5 -4.5"})]}),He=e=>{const{baseColor:t,borderRadius:r}=Zt(),{loading:i,children:n,...s}=e;return o.jsx(to,{style:{background:no(t),borderRadius:r},...s,children:i?o.jsx(eo,{}):n})},Zr=({isOpen:e,onClose:t,children:r,title:i,showCloseButton:n=!0,closeOnOverlayClick:s=!0,closeOnEscape:a=!0,className:c=""})=>{if(h.useEffect(()=>{if(!e||!a)return;const d=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,a,t]),h.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()},u=o.jsxs("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center",children:[o.jsx("div",{className:"iw-fixed iw-inset-0 iw-bg-black iw-bg-opacity-50 iw-transition-opacity",onClick:l}),o.jsxs("div",{className:`iw-relative iw-bg-white iw-rounded-lg iw-shadow-xl iw-max-w-md iw-w-full iw-mx-4 iw-max-h-[90vh] iw-overflow-hidden ${c}`,role:"dialog","aria-modal":"true","aria-labelledby":i?"dialog-title":void 0,children:[(i||n)&&o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-p-4 iw-border-b iw-border-gray-200",children:[i&&o.jsx("h2",{id:"dialog-title",className:"iw-text-lg iw-font-semibold iw-text-gray-900",children:i}),n&&o.jsx("button",{onClick:t,className:"iw-p-1 iw-text-gray-400 iw-hover:text-gray-600 iw-transition-colors iw-rounded iw-hover:bg-gray-100","aria-label":"Close dialog",children:o.jsx("svg",{className:"iw-w-5 iw-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsx("div",{className:"iw-p-4 iw-overflow-y-auto",children:r})]})]});return Qt.createPortal(u,document.body)},Gl=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-info-icon prefix__lucide-info",...e,children:[o.jsx("circle",{cx:12,cy:12,r:10}),o.jsx("path",{d:"M12 16v-4M12 8h.01"})]}),Vl=e=>o.jsx("svg",{width:24,height:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-scan-face-icon prefix__lucide-scan-face",...e,children:o.jsx("path",{d:"M3 7V5a2 2 0 012-2h2M17 3h2a2 2 0 012 2v2M21 17v2a2 2 0 01-2 2h-2M7 21H5a2 2 0 01-2-2v-2M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01"})});function zl({isOpen:e,onDecline:t,onContinue:r}){return o.jsx(Zr,{isOpen:e,showCloseButton:!1,onClose:t,children:e&&o.jsx("div",{className:"iw-bg-white iw-border-slate-200 iw-rounded-2xl iw-p-0 iw-shadow-xl sm:iw-max-w-xl",children:o.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-4",children:[o.jsx("div",{className:"iw--mt-0.5 iw-h-2.5 iw-w-full iw-rounded-t-2xl iw-bg-gradient-to-r iw-from-blue-500 iw-to-indigo-500"}),o.jsx("div",{className:"iw-sr-only",children:"Face Data Usage Notice"}),o.jsx("div",{className:"iw-sr-only",children:"Permission to use face data for interview monitoring"}),o.jsxs("div",{className:"iw-px-8 iw-py-8",children:[o.jsxs("div",{className:"iw-text-center",children:[o.jsx("div",{className:"iw-mx-auto iw-mb-6 iw-flex iw-h-16 iw-w-16 iw-items-center iw-justify-center iw-rounded-full iw-border iw-border-blue-200 iw-bg-gradient-to-br iw-from-blue-50 iw-to-blue-100 iw-shadow-sm iw-ring-1 iw-ring-blue-100",children:o.jsx(Vl,{className:"iw-text-blue-600"})}),o.jsx("h1",{className:"iw-text-zinc-700 iw-mb-6 iw-text-2xl iw-font-semibold iw-tracking-tight",children:"Face Data Usage Notice"})]}),o.jsxs("ul",{className:"iw-mb-4 iw-list-item iw-space-y-4 iw-text-sm iw-leading-relaxed iw-text-gray-700",children:[o.jsx("li",{children:"To ensure the integrity of the interview process, this platform uses your device's camera to monitor your face and gaze direction."}),o.jsx("li",{children:"Your face data is processed only for proctoring purposes (e.g., detecting if you are looking away or off-screen)."}),o.jsx("li",{children:"All processing is limited to the interview session and is used solely to maintain fairness."})]}),o.jsxs("div",{className:"iw-text-zinc-700 iw-flex iw-items-start iw-gap-2 iw-rounded-md iw-border iw-border-blue-100 iw-bg-blue-50/60 iw-p-3 iw-text-sm iw-font-medium",children:[o.jsx(Gl,{className:"iw-text-neutral-400 iw-mt-0.5 iw-inline-block iw-size-4 iw-flex-shrink-0"}),o.jsx("p",{className:"",children:"Please note that we do not store, share, or use your biometric data beyond the scope of this interview."})]}),o.jsx("p",{className:"iw-text-neutral-400 iw-my-4 iw-text-center iw-text-sm",children:"By continuing, you acknowledge and consent to the use of your face data exclusively for interview monitoring purposes."}),o.jsxs("div",{className:"iw-flex iw-gap-3 iw-border-t iw-border-gray-200/80 iw-pt-6",children:[o.jsx(He,{onClick:t,className:"iw-flex-1 iw-border",children:"Decline"}),o.jsx(He,{onClick:r,className:"iw-flex-1",children:"I Understand & Continue"})]})]})]})})})}function Wl(e){var t;if(!navigator.onLine)return{type:"network",message:"No internet connection",retryable:!0,userMessage:"Please check your internet connection and try again."};if(e.name==="AbortError"||(t=e.message)!=null&&t.includes("timeout"))return{type:"timeout",message:"Request timed out",retryable:!0,userMessage:"The request is taking longer than expected. Please try again."};if(e.status){const{status:r}=e;if(r===401||r===403)return{type:"auth",status:r,message:"Authentication failed",retryable:!1,userMessage:"Your session has expired. Please refresh the page."};if(r===429)return{type:"rate-limit",status:r,message:"Too many requests",retryable:!0,userMessage:"Please wait a moment before trying again."};if(r>=500)return{type:"server",status:r,message:`Server error: ${r}`,retryable:!0,userMessage:"Our servers are experiencing issues. Please try again in a few moments."};if(r>=400)return{type:"client",status:r,message:`Client error: ${r}`,retryable:!1,userMessage:"There was an issue with your request. Please check your input."}}return{type:"unknown",message:e.message||"Unknown error occurred",retryable:!0,userMessage:"Something unexpected happened. Please try again.",originalError:e}}async function ei(e,t={},r={attempts:3,backoff:"exponential",baseDelay:1e3,maxDelay:1e4,jitter:!0}){let i;for(let n=1;n<=r.attempts;n++)try{const s=new AbortController,a=setTimeout(()=>s.abort(),6e4),c=await fetch(e,{...t,signal:s.signal});if(clearTimeout(a),c.status>=400&&c.status<500&&c.status!==429)return c;if(!c.ok)throw new Error(`HTTP ${c.status}: ${c.statusText}`);return c}catch(s){i=s;const a=Wl(s);if(!a.retryable||n===r.attempts)throw a;const c=$l(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 $l(e,t){let r;return t.backoff==="exponential"?r=t.baseDelay*Math.pow(2,e-1):r=t.baseDelay,r=Math.min(r,t.maxDelay),t.jitter&&(r=r*(.5+Math.random()*.5)),Math.round(r)}class Hl{constructor(t={}){Te(this,"config");this.config=t}updateConfig(t){this.config={...this.config,...t}}getHeaders(){var r;const t={"Content-Type":"application/json"};return(r=this.config)!=null&&r.authToken&&(t.Authorization=`Bearer ${this.config.authToken}`),t}getBaseUrl(){var t;return((t=this.config)==null?void 0:t.baseUrl)||"/api"}async generateQuestion({interviewId:t,isInterviewDone:r=!1,qnaId:i,question:n,answer:s,answerDuration:a}){const c=await ei(`${this.getBaseUrl()}/questions/next`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({interview_id:t,is_interview_done:r,qna_id:i,question:n,answer:s,answer_duration:a??"00:00:30"})});if(!c.ok)throw new Error(`Failed to get questions: ${c.status}`);return await c.json()}async requestScreenshotUploadUrl(t,r=`screenshot-${Date.now()}.jpeg`){const i=await ei(`${this.getBaseUrl()}/interview/${t}/content`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({filename:r,mime_type:"image/jpeg"})});if(!i.ok)throw new Error(`Failed to request screenshot upload URL: ${i.status}`);return await i.json()}async uploadScreenshot(t,r){const i=await fetch(t,{method:"PUT",body:r,headers:{"Content-Type":"image/jpeg"}});if(!i.ok)throw new Error(`Failed to upload screenshot: ${i.status}`)}}function ao(){const e=Qr();return h.useMemo(()=>{const r=e.api||{};return new Hl(r)},[e.api])}const Nr=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),o.jsx("path",{d:"M12 9v4"}),o.jsx("path",{d:"M12 17h.01"})]}),sn=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M12 2a10 10 0 0 1 7.38 16.75"}),o.jsx("path",{d:"M12 6v6l4 2"}),o.jsx("path",{d:"M2.5 8.875a10 10 0 0 0-.5 3"}),o.jsx("path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4"}),o.jsx("path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857"}),o.jsx("path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38"})]}),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:"M12 6v6l4 2"}),o.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),co=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"})]}),Yl=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"})]}),on=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"})]}),Kl=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"})]}),Xl=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})]}),Jl=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"})]}),Ql=e=>o.jsxs("svg",{width:24,height:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-target-icon prefix__lucide-target",...e,children:[o.jsx("circle",{cx:12,cy:12,r:10}),o.jsx("circle",{cx:12,cy:12,r:6}),o.jsx("circle",{cx:12,cy:12,r:2})]}),Zl=e=>o.jsxs("svg",{width:24,height:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-users-icon prefix__lucide-users",...e,children:[o.jsx("path",{d:"M16 21v-2a4 4 0 00-4-4H6a4 4 0 00-4 4v2M16 3.128a4 4 0 010 7.744M22 21v-2a4 4 0 00-3-3.87"}),o.jsx("circle",{cx:9,cy:7,r:4})]}),Ir={FACE_DETECTED:"face_detected",NO_FACE:"no_face_detected",MULTIPLE_FACES:"multiple_faces",LOOKING_AWAY:"looking_away",CAMERA_ERROR:"camera_error"},eu={[Ir.FACE_DETECTED]:{icon:co,iconColor:"iw-text-green-600",iconBg:"iw-bg-green-50",iconBorder:"iw-border-green-100",title:"All Good",subtitle:"Everything looks normal",description:"Your gaze is properly focused on the screen. Continue with your interview.",buttonText:"Continue"},[Ir.NO_FACE]:{icon:Jl,iconColor:"iw-text-orange-600",iconBg:"iw-bg-orange-50",iconBorder:"iw-border-orange-100",title:"Face Not Detected",subtitle:"We can't see you in the camera",description:"Please ensure you're positioned properly in front of the camera and that your face is clearly visible.",buttonText:"I Understood"},[Ir.MULTIPLE_FACES]:{icon:Zl,iconColor:"iw-text-red-600",iconBg:"iw-bg-red-50",iconBorder:"iw-border-red-100",title:"Multiple People Detected",subtitle:"More than one person is visible",description:"For interview integrity, please ensure you are alone in the room and only your face is visible to the camera.",buttonText:"I Understood"},[Ir.LOOKING_AWAY]:{icon:Ql,iconColor:"iw-text-amber-600",iconBg:"iw-bg-amber-50",iconBorder:"iw-border-amber-200/75",title:"Stay Focused",subtitle:"We noticed you looked away from the screen",description:"To ensure interview integrity, please keep your attention on the screen throughout the session.",buttonText:"I Understood"},[Ir.CAMERA_ERROR]:{icon:Nr,iconColor:"iw-text-red-600",iconBg:"iw-bg-red-50",iconBorder:"iw-border-red-100",title:"Camera Issue",subtitle:"There's a problem with your camera",description:"Please check your camera connection and permissions, then refresh the page to continue.",buttonText:"I Understood"}};function tu({isOpen:e,onClose:t,warningType:r}){const i=eu[r],n=i.icon,s=()=>{t()};return r==="face_detected"?null:o.jsx(Zr,{isOpen:e,onClose:t,children:e&&o.jsx("div",{className:"iw-bg-white iw-border-white iw-border iw-p-0 iw-shadow-lg sm:iw-max-w-md",children:o.jsxs("div",{children:[o.jsx("div",{className:"iw-sr-only",children:i.description}),o.jsxs("div",{className:"iw-px-8 iw-py-8 iw-text-center",children:[o.jsx("div",{className:`iw-mx-auto iw-mb-6 iw-flex iw-h-16 iw-w-16 iw-items-center iw-justify-center iw-rounded-full ${i.iconBg} border ${i.iconBorder}`,children:o.jsx(n,{className:`iw-h-7 iw-w-7 ${i.iconColor}`})}),o.jsx("h1",{className:"iw-text-foreground iw-mb-3 iw-text-2xl iw-font-bold iw-tracking-tight",children:i.title}),o.jsx("h2",{className:"iw-text-gray-500 iw-mb-6 iw-text-base iw-font-medium",children:i.subtitle}),o.jsx("p",{className:"iw-text-neutral-400 iw-mx-auto iw-mb-8 iw-max-w-sm iw-text-sm iw-leading-relaxed",children:i.description}),o.jsx(He,{onClick:s,className:"iw-w-full iw-bg-gray-800 iw-text-white hover:iw-bg-gray-800",children:i.buttonText})]})]})})})}const ru=({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."]})]})}),iu=({showControls:e,isBubbleOpen:t,setIsBubbleOpen:r,setReference:i,clearCache:n,isModelLoaded:s,gazeAnalysisEnabled:a,referenceSet:c,showLandmarks:l,setShowLandmarks:u,showEngagementBar:d,setShowEngagementBar:f,handleToggleGazeAnalysis:w,stats:m,statusMessage:g,loadingProgress:v})=>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(Xl,{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:E=>w(E.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:E=>u(E.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:E=>f(E.target.checked),disabled:!a}),"Show Engagement Bar"]})]}),c&&o.jsx(ru,{gazeAnalysisEnabled:a,isModelLoaded:s,loadingProgress:v,stats:m,statusMessage:g})]})]}):null;var er=typeof self<"u"?self:{};function Gt(){throw Error("Invalid UTF8")}function lo(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let ti,an;const nu=typeof TextDecoder<"u";let su;const ou=typeof TextEncoder<"u";function uo(e){if(ou)e=(su||(su=new TextEncoder)).encode(e);else{let r=0;const i=new Uint8Array(3*e.length);for(let n=0;n<e.length;n++){var t=e.charCodeAt(n);if(t<128)i[r++]=t;else{if(t<2048)i[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&n<e.length){const s=e.charCodeAt(++n);if(s>=56320&&s<=57343){t=1024*(t-55296)+s-56320+65536,i[r++]=t>>18|240,i[r++]=t>>12&63|128,i[r++]=t>>6&63|128,i[r++]=63&t|128;continue}n--}t=65533}i[r++]=t>>12|224,i[r++]=t>>6&63|128}i[r++]=63&t|128}}e=r===i.length?i:i.subarray(0,r)}return e}var cn,ri;e:{for(var ho=["CLOSURE_FLAGS"],ln=er,un=0;un<ho.length;un++)if((ln=ln[ho[un]])==null){ri=null;break e}ri=ln}var Mr,fo=ri&&ri[610401301];cn=fo!=null&&fo;const wo=er.navigator;function dn(e){return!!cn&&!!Mr&&Mr.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function Re(e){var t;return(t=er.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function _t(){return!!cn&&!!Mr&&Mr.brands.length>0}function hn(){return _t()?dn("Chromium"):(Re("Chrome")||Re("CriOS"))&&!(!_t()&&Re("Edge"))||Re("Silk")}function ii(e){return ii[" "](e),e}Mr=wo&&wo.userAgentData||null,ii[" "]=function(){};var au=!_t()&&(Re("Trident")||Re("MSIE"));!Re("Android")||hn(),hn(),Re("Safari")&&(hn()||!_t()&&Re("Coast")||!_t()&&Re("Opera")||!_t()&&Re("Edge")||(_t()?dn("Microsoft Edge"):Re("Edg/"))||_t()&&dn("Opera"));var mo={},Lr=null;function cu(e){const t=e.length;let r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);const i=new Uint8Array(r);let n=0;return function(s,a){function c(u){for(;l<s.length;){const d=s.charAt(l++),f=Lr[d];if(f!=null)return f;if(!/^[\s\xa0]*$/.test(d))throw Error("Unknown base64 encoding at char: "+d)}return u}go();let l=0;for(;;){const u=c(-1),d=c(0),f=c(64),w=c(64);if(w===64&&u===-1)break;a(u<<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 go(){if(!Lr){Lr={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const i=e.concat(t[r].split(""));mo[r]=i;for(let n=0;n<i.length;n++){const s=i[n];Lr[s]===void 0&&(Lr[s]=n)}}}}var po=typeof Uint8Array<"u",xo=!au&&typeof btoa=="function";function yo(e){if(!xo){var t;t===void 0&&(t=0),go(),t=mo[t];var r=Array(Math.floor(e.length/3)),i=t[64]||"";let l=0,u=0;for(;l<e.length-2;l+=3){var n=e[l],s=e[l+1],a=e[l+2],c=t[n>>2];n=t[(3&n)<<4|s>>4],s=t[(15&s)<<2|a>>6],a=t[63&a],r[u++]=c+n+s+a}switch(c=0,a=i,e.length-l){case 2:a=t[(15&(c=e[l+1]))<<2]||i;case 1:e=e[l],r[u]=t[e>>2]+t[(3&e)<<4|c>>4]+a+i}return r.join("")}for(t="",r=0,i=e.length-10240;r<i;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}const bo=/[-_.]/g,lu={"-":"+",_:"/",".":"="};function uu(e){return lu[e]||""}function vo(e){if(!xo)return cu(e);bo.test(e)&&(e=e.replace(bo,uu)),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 Vt(e){return po&&e!=null&&e instanceof Uint8Array}var tr={};function zt(){return du||(du=new ht(null,tr))}function fn(e){ko(tr);var t=e.g;return(t=t==null||Vt(t)?t:typeof t=="string"?vo(t):null)==null?t:e.g=t}var ht=class{h(){return new Uint8Array(fn(this)||0)}constructor(e,t){if(ko(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let du,hu;function ko(e){if(e!==tr)throw Error("illegal external caller")}function _o(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function wn(e){return _o(e=Error(e),"warning"),e}function mn(e){if(e!=null){var t=hu??(hu={}),r=t[e]||0;r>=5||(t[e]=r+1,_o(e=Error(),"incident"),function(i){er.setTimeout(()=>{throw i},0)}(e))}}var ni=typeof Symbol=="function"&&typeof Symbol()=="symbol";function rr(e,t,r=!1){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?r&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t}var fu=rr("jas",void 0,!0),Eo=rr(void 0,"0di"),Fr=rr(void 0,"1oa"),ir=rr(void 0,Symbol()),wu=rr(void 0,"0actk"),jo=rr(void 0,"8utk");const k=ni?fu:"Ea",To={Ea:{value:0,configurable:!0,writable:!0,enumerable:!1}},So=Object.defineProperties;function si(e,t){ni||k in e||So(e,To),e[k]|=t}function ie(e,t){ni||k in e||So(e,To),e[k]=t}function nr(e){return si(e,34),e}function mu(e,t){ie(t,-15615&(0|e))}function gn(e,t){ie(t,-15581&(34|e))}function oi(){return typeof BigInt=="function"}function ye(e){return Array.prototype.slice.call(e)}var pn,Pr={};function ai(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function xn(e,t){if(e!=null){if(typeof e=="string")e=e?new ht(e,tr):zt();else if(e.constructor!==ht)if(Vt(e))e=e.length?new ht(new Uint8Array(e),tr):zt();else{if(!t)throw Error();e=void 0}}return e}const Ao=[];function Et(e){if(2&e)throw Error()}ie(Ao,55),pn=Object.freeze(Ao);class Co{constructor(t,r,i){this.g=t,this.h=r,this.l=i}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}function yn(e){return ir?e[ir]:void 0}var gu=Object.freeze({});function ci(e){return e.Na=!0,e}var pu=ci(e=>typeof e=="number"),No=ci(e=>typeof e=="string"),xu=ci(e=>typeof e=="boolean"),li=typeof er.BigInt=="function"&&typeof er.BigInt(0)=="bigint";function jt(e){var t=e;if(No(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(pu(t)&&!Number.isSafeInteger(t))throw Error(String(t));return li?BigInt(e):e=xu(e)?e?"1":"0":No(e)?e.trim()||"0":String(e)}var bn=ci(e=>li?e>=bu&&e<=ku:e[0]==="-"?Io(e,yu):Io(e,vu));const yu=Number.MIN_SAFE_INTEGER.toString(),bu=li?BigInt(Number.MIN_SAFE_INTEGER):void 0,vu=Number.MAX_SAFE_INTEGER.toString(),ku=li?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Io(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){const i=e[r],n=t[r];if(i>n)return!1;if(i<n)return!0}}const _u=typeof Uint8Array.prototype.slice=="function";let Mo,U=0,J=0;function Lo(e){const t=e>>>0;U=t,J=(e-t)/4294967296>>>0}function Wt(e){if(e<0){Lo(-e);const[t,r]=En(U,J);U=t>>>0,J=r>>>0}else Lo(e)}function vn(e){const t=Mo||(Mo=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),J=0,U=t.getUint32(0,!0)}function kn(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Dr(e,t)}function _n(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=kn(e,t))=="number"?r?-e:e:r?"-"+e:e}function Dr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else oi()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+Fo(r)+Fo(e));return r}function Fo(e){return e=String(e),"0000000".slice(e.length)+e}function Po(){var e=U,t=J;if(2147483648&t)if(oi())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,i]=En(e,t);e="-"+Dr(r,i)}else e=Dr(e,t);return e}function ui(e){if(e.length<16)Wt(Number(e));else if(oi())e=BigInt(e),U=Number(e&BigInt(4294967295))>>>0,J=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");J=U=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));J*=1e6,U=1e6*U+s,U>=4294967296&&(J+=Math.trunc(U/4294967296),J>>>=0,U>>>=0)}if(t){const[i,n]=En(U,J);U=i,J=n}}}function En(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}const Rr=typeof BigInt=="function"?BigInt.asIntN:void 0,Eu=typeof BigInt=="function"?BigInt.asUintN:void 0,Tt=Number.isSafeInteger,di=Number.isFinite,sr=Math.trunc,ju=jt(0);function St(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Do(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const Tu=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Or(e){switch(typeof e){case"bigint":return!0;case"number":return di(e);case"string":return Tu.test(e);default:return!1}}function or(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return di(e)?0|e:void 0}function Ro(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return di(e)?e>>>0:void 0}function Oo(e){if(e[0]==="-")return!1;const t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function Bo(e){const t=e.length;return e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337}function Uo(e){return Bo(e)?e:(ui(e),Po())}function jn(e){return e=sr(e),Tt(e)||(Wt(e),e=_n(U,J)),e}function Go(e){var t=sr(Number(e));return Tt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Uo(e))}function Vo(e){var t=sr(Number(e));return Tt(t)?jt(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),oi()?jt(Rr(64,BigInt(e))):jt(Uo(e)))}function zo(e){if(Tt(e))e=jt(jn(e));else{if(e=sr(e),Tt(e))e=String(e);else{const t=String(e);Bo(t)?e=t:(Wt(e),e=Po())}e=jt(e)}return e}function Tn(e){return e==null?e:typeof e=="bigint"?(bn(e)?e=Number(e):(e=Rr(64,e),e=bn(e)?Number(e):String(e)),e):Or(e)?typeof e=="number"?jn(e):Go(e):void 0}function Su(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(Eu(64,e));if(Or(e)){if(t==="string")return t=sr(Number(e)),Tt(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Oo(e)||(ui(e),e=Dr(U,J))),e;if(t==="number")return(e=sr(e))>=0&&Tt(e)?e:function(r){if(r<0){Wt(r);var i=Dr(U,J);return r=Number(i),Tt(r)?r:i}return Oo(i=String(r))?i:(Wt(r),kn(U,J))}(e)}}function Wo(e){if(typeof e!="string")throw Error();return e}function ar(e){if(e!=null&&typeof e!="string")throw Error();return e}function cr(e){return e==null||typeof e=="string"?e:void 0}function Sn(e,t,r,i){if(e!=null&&typeof e=="object"&&e.W===Pr)return e;if(!Array.isArray(e))return r?2&i?((e=t[Eo])||(nr((e=new t).u),e=t[Eo]=e),t=e):t=new t:t=void 0,t;let n=r=0|e[k];return n===0&&(n|=32&i),n|=2&i,n!==r&&ie(e,n),new t(e)}function Au(e,t,r){if(t)e:{if(!Or(t=e))throw wn("int64");switch(typeof t){case"string":t=Vo(t);break e;case"bigint":t=jt(Rr(64,t));break e;default:t=zo(t)}}else e=typeof(t=e),t=t==null?t:e==="bigint"?jt(Rr(64,t)):Or(t)?e==="string"?Vo(t):zo(t):void 0;return(e=t)==null?r?ju:void 0:e}function Cu(e){return e}const Nu={};let Iu=function(){try{return ii(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 Mu=Iu?(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 $o(e){return e}function Cn(e){if(2&e.M)throw Error("Cannot mutate an immutable Map")}var rt=class extends Mu{constructor(e,t,r=$o,i=$o){super();let n=0|e[k];n|=64,ie(e,n),this.M=n,this.I=t,this.S=r,this.X=this.I?Lu:i;for(let s=0;s<e.length;s++){const a=e[s],c=r(a[0],!1,!0);let l=a[1];t?l===void 0&&(l=null):l=i(a[1],!1,!0,void 0,void 0,n),super.set(c,l)}}La(){var e=Ou;if(this.size!==0)return Array.from(super.entries(),t=>(t[0]=e(t[0]),t[1]=e(t[1]),t))}da(e=Fu){const t=[],r=super.entries();for(var i;!(i=r.next()).done;)(i=i.value)[0]=e(i[0]),i[1]=e(i[1]),t.push(i);return t}clear(){Cn(this),super.clear()}delete(e){return Cn(this),super.delete(this.S(e,!0,!1))}entries(){if(this.I){var e=super.keys();e=new Co(e,Pu,this)}else e=super.entries();return e}values(){if(this.I){var e=super.keys();e=new Co(e,rt.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.I?super.forEach((r,i,n)=>{e.call(t,n.get(i),i,n)}):super.forEach(e,t)}set(e,t){return Cn(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.X(t,!0,!0,this.I,!1,this.M))}Ja(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.I?e===void 0?null:e:this.X(e,!1,!0,void 0,!1,this.M),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);const t=super.get(e);if(t!==void 0){var r=this.I;return r?((r=this.X(t,!1,!0,r,this.pa,this.M))!==t&&super.set(e,r),r):t}}[Symbol.iterator](){return this.entries()}};function Lu(e,t,r,i,n,s){return e=Sn(e,i,r,s),n&&(e=wi(e)),e}function Fu(e){return e}function Pu(e){return[e,this.get(e)]}let Du,Ho,qo,Ru;function Yo(){return Du||(Du=new rt(nr([]),void 0,void 0,void 0,Nu))}function Nn(e,t,r,i,n){if(e!=null){if(Array.isArray(e)){const s=0|e[k];return e.length===0&&1&s?void 0:n&&2&s?e:hi(e,t,r,i!==void 0,n)}return t(e,i)}}function hi(e,t,r,i,n){const s=i||r?0|e[k]:0,a=i?!!(32&s):void 0;let c=0;const l=(i=ye(e)).length;for(let g=0;g<l;g++){var u=i[g];if(g===l-1&&ai(u)){var d=t,f=r,w=a,m=n;let v;for(let E in u){const p=Nn(u[E],d,f,w,m);p!=null&&((v??(v={}))[E]=p)}u=v}else u=Nn(i[g],t,r,a,n);i[g]=u,u!=null&&(c=g+1)}return c<l&&(i.length=c),r&&((e=yn(e))&&(i[ir]=ye(e)),r(s,i)),i}function Ou(e){return Nn(e,In,void 0,void 0,!1)}function In(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(Vt(e))return Vt(e)&&mn(jo),yo(e);if(e.W===Pr)return Ko(e);if(e instanceof ht){const t=e.g;return t==null?"":typeof t=="string"?t:e.g=yo(t)}return e instanceof rt?e.La():void 0}return e}function Ko(e){var t=e.u;e=hi(t,In,void 0,void 0,!1);var r=0|t[k];if((t=e.length)&&!(512&r)){var i=e[t-1],n=!1;ai(i)?(t--,n=!0):i=void 0;var s=t-(r=512&r?0:-1),a=(Ho??Cu)(s,r,e,i);if(i&&(e[t]=void 0),s<a&&i){for(var c in s=!0,i){const l=+c;l<=a?(e[n=l+r]=i[c],t=Math.max(n+1,t),n=!1,delete i[c]):s=!1}s&&(i=void 0)}for(s=t-1;t>0;s=t-1)if((c=e[s])==null)t--,n=!0;else{if(!((s-=r)>=a))break;(i??(i={}))[s]=c,t--,n=!0}n&&(e.length=t),i&&e.push(i)}return e}function At(e,t,r){return e=Xo(e,t[0],t[1],r?1:2),t!==qo&&r&&si(e,8192),e}function Xo(e,t,r,i){if(e==null){var n=96;r?(e=[r],n|=512):e=[],t&&(n=-16760833&n|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(8192&(n=0|e[k])||!(64&n)||2&n||mn(wu),1024&n)throw Error("farr");if(64&n)return e;if(i===1||i===2||(n|=64),r&&(n|=512,r!==e[0]))throw Error("mid");e:{var s=(r=e).length;if(s){var a=s-1;if(ai(i=r[a])){if((a-=t=512&(n|=256)?0:-1)>=1024)throw Error("pvtlmt");for(var c in i)(s=+c)<a&&(r[s+t]=i[c],delete i[c]);n=-16760833&n|(1023&a)<<14;break e}}if(t){if((c=Math.max(t,s-(512&n?0:-1)))>1024)throw Error("spvt");n=-16760833&n|(1023&c)<<14}}}return ie(e,n),e}function Mn(e,t,r=gn){if(e!=null){if(po&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var i=0|e[k];return 2&i?e:(t&&(t=i===0||!!(32&i)&&!(64&i||!(16&i))),t?(ie(e,34|i),4&i&&Object.freeze(e),e):hi(e,Mn,4&i?gn:r,!0,!0))}return e.W===Pr?e=2&(i=0|(r=e.u)[k])?e:new e.constructor(fi(r,i,!0)):e instanceof rt&&!(2&e.M)&&(r=nr(e.da(Mn)),e=new rt(r,e.I,e.S,e.X)),e}}function fi(e,t,r){const i=r||2&t?gn:mu,n=!!(32&t);return e=function(s,a,c){const l=ye(s);var u=l.length;const d=256&a?l[u-1]:void 0;for(u+=d?-1:0,a=512&a?1:0;a<u;a++)l[a]=c(l[a]);if(d){a=l[a]={};for(const f in d)a[f]=c(d[f])}return(s=yn(s))&&(l[ir]=ye(s)),l}(e,t,s=>Mn(s,n,i)),si(e,32|(r?2:0)),e}function wi(e){const t=e.u,r=0|t[k];return 2&r?new e.constructor(fi(t,r,!1)):e}function lr(e,t){return ft(e=e.u,0|e[k],t)}function ft(e,t,r){if(r===-1)return null;const i=r+(512&t?0:-1),n=e.length-1;return i>=n&&256&t?e[n][r]:i<=n?e[i]:void 0}function V(e,t,r){const i=e.u;let n=0|i[k];return Et(n),K(i,n,t,r),e}function K(e,t,r,i){const n=512&t?0:-1,s=r+n;var a=e.length-1;return s>=a&&256&t?(e[a][r]=i,t):s<=a?(e[s]=i,t):(i!==void 0&&(r>=(a=t>>14&1023||536870912)?i!=null&&(e[a+n]={[r]:i},ie(e,t|=256)):e[s]=i),t)}function mi(e,t){let r=0|(e=e.u)[k];const i=ft(e,r,t),n=St(i);return n!=null&&n!==i&&K(e,r,t,n),n}function Jo(e){let t=0|(e=e.u)[k];const r=ft(e,t,1),i=xn(r,!0);return i!=null&&i!==r&&K(e,t,1,i),i}function $t(){return gu===void 0?2:4}function Ht(e,t,r,i,n){const s=e.u,a=2&(e=0|s[k])?1:i;n=!!n;let c=0|(i=Ln(s,e,t))[k];if(!(4&c)){4&c&&(i=ye(i),c=gt(c,e),e=K(s,e,t,i));let l=0,u=0;for(;l<i.length;l++){const d=r(i[l]);d!=null&&(i[u++]=d)}u<l&&(i.length=u),c=Fn(c,e),r=-2049&(20|c),c=r&=-4097,ie(i,c),2&c&&Object.freeze(i)}return a===1||a===4&&32&c?wt(c)||(n=c,c|=2,c!==n&&ie(i,c),Object.freeze(i)):(a===2&&wt(c)&&(i=ye(i),c=gt(c,e),c=Ct(c,e,n),ie(i,c),e=K(s,e,t,i)),wt(c)||(t=c,c=Ct(c,e,n),c!==t&&ie(i,c))),i}function Ln(e,t,r){return e=ft(e,t,r),Array.isArray(e)?e:pn}function Fn(e,t){return e===0&&(e=gt(e,t)),1|e}function wt(e){return!!(2&e)&&!!(4&e)||!!(1024&e)}function Qo(e){e=ye(e);for(let t=0;t<e.length;t++){const r=e[t]=ye(e[t]);Array.isArray(r[1])&&(r[1]=nr(r[1]))}return e}function Pn(e,t,r,i){let n=0|(e=e.u)[k];Et(n),K(e,n,t,(i==="0"?Number(r)===0:r===i)?void 0:r)}function ur(e,t,r,i){Et(t);let n=Ln(e,t,r);const s=n!==pn;if(64&t||!(8192&t)||!s){const a=s?0|n[k]:0;let c=a;(!s||2&c||wt(c)||4&c&&!(32&c))&&(n=ye(n),c=gt(c,t),t=K(e,t,r,n)),c=-13&Fn(c,t),c=Ct(i?-17&c:16|c,t,!0),c!==a&&ie(n,c)}return n}function Dn(e,t){var r=ec;return On(Rn(e=e.u),e,0|e[k],r)===t?t:-1}function Rn(e){if(ni)return e[Fr]??(e[Fr]=new Map);if(Fr in e)return e[Fr];const t=new Map;return Object.defineProperty(e,Fr,{value:t}),t}function Zo(e,t,r,i){const n=Rn(e),s=On(n,e,t,r);return s!==i&&(s&&(t=K(e,t,s)),n.set(r,i)),t}function On(e,t,r,i){let n=e.get(i);if(n!=null)return n;n=0;for(let s=0;s<i.length;s++){const a=i[s];ft(t,r,a)!=null&&(n!==0&&(r=K(t,r,n)),n=a)}return e.set(i,n),n}function Bn(e,t,r){let i=0|e[k];const n=ft(e,i,r);let s;if(n!=null&&n.W===Pr)return(t=wi(n))!==n&&K(e,i,r,t),t.u;if(Array.isArray(n)){const a=0|n[k];s=2&a?At(fi(n,a,!1),t,!0):64&a?n:At(s,t,!0)}else s=At(void 0,t,!0);return s!==n&&K(e,i,r,s),s}function ea(e,t,r){let i=0|(e=e.u)[k];const n=ft(e,i,r);return(t=Sn(n,t,!1,i))!==n&&t!=null&&K(e,i,r,t),t}function M(e,t,r){if((t=ea(e,t,r))==null)return t;let i=0|(e=e.u)[k];if(!(2&i)){const n=wi(t);n!==t&&K(e,i,r,t=n)}return t}function ta(e,t,r,i,n,s,a){e=e.u;var c=!!(2&t);const l=c?1:n;s=!!s,a&&(a=!c);var u=0|(n=Ln(e,t,i))[k];if(!(c=!!(4&u))){var d=n,f=t;const w=!!(2&(u=Fn(u,t)));w&&(f|=2);let m=!w,g=!0,v=0,E=0;for(;v<d.length;v++){const p=Sn(d[v],r,!1,f);if(p instanceof r){if(!w){const A=!!(2&(0|p.u[k]));m&&(m=!A),g&&(g=A)}d[E++]=p}}E<v&&(d.length=E),u|=4,u=g?16|u:-17&u,ie(d,u=m?8|u:-9&u),w&&Object.freeze(d)}if(a&&!(8&u||!n.length&&(l===1||l===4&&32&u))){for(wt(u)&&(n=ye(n),u=gt(u,t),t=K(e,t,i,n)),r=n,a=u,d=0;d<r.length;d++)(u=r[d])!==(f=wi(u))&&(r[d]=f);a|=8,ie(r,a=r.length?-17&a:16|a),u=a}return l===1||l===4&&32&u?wt(u)||(t=u,(u|=!n.length||16&u&&(!c||32&u)?2:1024)!==t&&ie(n,u),Object.freeze(n)):(l===2&&wt(u)&&(ie(n=ye(n),u=Ct(u=gt(u,t),t,s)),t=K(e,t,i,n)),wt(u)||(i=u,(u=Ct(u,t,s))!==i&&ie(n,u))),n}function mt(e,t,r){const i=0|e.u[k];return ta(e,i,t,r,$t(),!1,!(2&i))}function j(e,t,r,i){return i==null&&(i=void 0),V(e,r,i)}function Br(e,t,r,i){i==null&&(i=void 0);e:{let n=0|(e=e.u)[k];if(Et(n),i==null){const s=Rn(e);if(On(s,e,n,r)!==t)break e;s.set(r,0)}else n=Zo(e,n,r,t);K(e,n,t,i)}}function gt(e,t){return-1025&(e=32|(2&t?2|e:-3&e))}function Ct(e,t,r){return 32&t&&r||(e&=-33),e}function gi(e,t,r){Et(0|e.u[k]),Ht(e,t,cr,2,!0).push(Wo(r))}function pi(e,t,r,i){const n=0|e.u[k];Et(n),e=ta(e,n,r,t,2,!0),i=i??new r,e.push(i),e[k]=2&(0|i.u[k])?-9&e[k]:-17&e[k]}function Oe(e,t){return or(lr(e,t))}function Be(e,t){return cr(lr(e,t))}function ee(e,t){return mi(e,t)??0}function Ur(e,t,r){if(r!=null&&typeof r!="boolean")throw e=typeof r,Error(`Expected boolean but got ${e!="object"?e:r?Array.isArray(r)?"array":e:"null"}: ${r}`);V(e,t,r)}function it(e,t,r){if(r!=null){if(typeof r!="number"||!di(r))throw wn("int32");r|=0}V(e,t,r)}function b(e,t,r){if(r!=null&&typeof r!="number")throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);V(e,t,r)}function xi(e,t,r){{const a=e.u;let c=0|a[k];if(Et(c),r==null)K(a,c,t);else{var i=e=0|r[k],n=wt(e),s=n||Object.isFrozen(r);for(n||(e=0),s||(r=ye(r),i=0,e=Ct(e=gt(e,c),c,!0),s=!1),e|=21,n=0;n<r.length;n++){const l=r[n],u=Wo(l);Object.is(l,u)||(s&&(r=ye(r),i=0,e=Ct(e=gt(e,c),c,!0),s=!1),r[n]=u)}e!==i&&(s&&(r=ye(r),e=Ct(e=gt(e,c),c,!0)),ie(r,e)),K(a,c,t,r)}}}function ra(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Un(){return Error("Failed to read varint, encoding is invalid.")}function ia(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Gn(e){if(typeof e=="string")return{buffer:vo(e),O:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),O:!1};if(e.constructor===Uint8Array)return{buffer:e,O:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),O:!1};if(e.constructor===ht)return{buffer:fn(e)||new Uint8Array(0),O:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),O:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function Vn(e,t){let r,i=0,n=0,s=0;const a=e.h;let c=e.g;do r=a[c++],i|=(127&r)<<s,s+=7;while(s<32&&128&r);for(s>32&&(n|=(127&r)>>4),s=3;s<32&&128&r;s+=7)r=a[c++],n|=(127&r)<<s;if(qt(e,c),r<128)return t(i>>>0,n>>>0);throw Un()}function zn(e){let t=0,r=e.g;const i=r+10,n=e.h;for(;r<i;){const s=n[r++];if(t|=s,(128&s)==0)return qt(e,r),!!(127&t)}throw Un()}function Nt(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 Un();return qt(e,r),n}function pt(e){return Nt(e)>>>0}function Wn(e){var t=e.h;const r=e.g,i=t[r],n=t[r+1],s=t[r+2];return t=t[r+3],qt(e,e.g+4),(i<<0|n<<8|s<<16|t<<24)>>>0}function $n(e){var t=Wn(e);e=2*(t>>31)+1;const r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function Bu(e){return Nt(e)}function Hn(e,t,{aa:r=!1}={}){e.aa=r,t&&(t=Gn(t),e.h=t.buffer,e.m=t.O,e.j=0,e.l=e.h.length,e.g=e.j)}function qt(e,t){if(e.g=t,t>e.l)throw ia(e.l,t)}function na(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);const r=e.g,i=r+t;if(i>e.l)throw ia(t,e.l-r);return e.g=i,r}function sa(e,t){if(t==0)return zt();var r=na(e,t);return e.aa&&e.m?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):_u?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?zt():new ht(r,tr)}rt.prototype.toJSON=void 0;var oa=[];function aa(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var r=pt(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5))throw ra(r,e.l);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=r,!0}function yi(e){switch(e.h){case 0:e.h!=0?yi(e):zn(e.g);break;case 1:qt(e=e.g,e.g+8);break;case 2:if(e.h!=2)yi(e);else{var t=pt(e.g);qt(e=e.g,e.g+t)}break;case 5:qt(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!aa(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}yi(e)}break;default:throw ra(e.h,e.l)}}function Gr(e,t,r){const i=e.g.l,n=pt(e.g),s=e.g.g+n;let a=s-i;if(a<=0&&(e.g.l=s,r(t,e,void 0,void 0,void 0),a=s-e.g.g),a)throw Error(`Message parsing ended unexpectedly. Expected to read ${n} bytes, instead read ${n-a} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=s,e.g.l=i,t}function qn(e){var t=pt(e.g),r=na(e=e.g,t);if(e=e.h,nu){var i,n=e;(i=an)||(i=an=new TextDecoder("utf-8",{fatal:!0})),t=r+t,n=r===0&&t===n.length?n:n.subarray(r,t);try{var s=i.decode(n)}catch(c){if(ti===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),ti=!0}catch{ti=!1}}throw!ti&&(an=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?Gt():(c=e[s++],a<194||(192&c)!=128?(s--,Gt()):r.push((31&a)<<6|63&c)):a<240?s>=t-1?Gt():(c=e[s++],(192&c)!=128||a===224&&c<160||a===237&&c>=160||(192&(i=e[s++]))!=128?(s--,Gt()):r.push((15&a)<<12|(63&c)<<6|63&i)):a<=244?s>=t-2?Gt():(c=e[s++],(192&c)!=128||c-144+(a<<28)>>30||(192&(i=e[s++]))!=128||(192&(n=e[s++]))!=128?(s--,Gt()):(a=(7&a)<<18|(63&c)<<12|(63&i)<<6|63&n,a-=65536,r.push(55296+(a>>10&1023),56320+(1023&a)))):Gt(),r.length>=8192&&(l=lo(l,r),r.length=0)}s=lo(l,r)}return s}function ca(e){const t=pt(e.g);return sa(e.g,t)}function bi(e,t,r){var i=pt(e.g);for(i=e.g.g+i;e.g.g<i;)r.push(t(e.g))}var vi=[];function qe(e,t,r){t.g?t.m(e,t.g,t.h,r):t.m(e,t.h,r)}var y=class{constructor(e,t){this.u=Xo(e,t)}toJSON(){try{var e=Ko(this)}finally{Ho=void 0}return e}l(){var e=vd;return e.g?e.l(this,e.g,e.h):e.l(this,e.h,e.defaultValue)}clone(){const e=this.u;return new this.constructor(fi(e,0|e[k],!1))}O(){return!!(2&(0|this.u[k]))}};function la(e){return e?/^\d+$/.test(e)?(ui(e),new Yn(U,J)):null:Uu||(Uu=new Yn(0,0))}y.prototype.W=Pr,y.prototype.toString=function(){return this.u.toString()};var Yn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Uu;function ua(e){return e?/^-?\d+$/.test(e)?(ui(e),new Kn(U,J)):null:Gu||(Gu=new Kn(0,0))}var Kn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Gu;function dr(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function hr(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function ki(e,t){if(t>=0)hr(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Vr(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function fr(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Se(e,t,r){hr(e.g,8*t+r)}function Xn(e,t){return Se(e,t,2),t=e.g.end(),fr(e,t),t.push(e.h),t}function Jn(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function _i(e,t,r){Se(e,t,2),hr(e.g,r.length),fr(e,e.g.end()),fr(e,r)}function Ei(e,t,r,i){r!=null&&(t=Xn(e,t),i(r,e),Jn(e,t))}function Ye(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Qn=Ye(),da=Ye(),Zn=Ye(),es=Ye(),ha=Ye(),fa=Ye(),ts=Ye(),wa=Ye(),ma=Ye(),wr=class{constructor(e,t,r){this.g=e,this.h=t,e=Qn,this.l=!!e&&r===e||!1}};function ji(e,t){return new wr(e,t,Qn)}function ga(e,t,r,i,n){Ei(e,r,ka(t,i),n)}const Vu=ji(function(e,t,r,i,n){return e.h===2&&(Gr(e,Bn(t,i,r),n),!0)},ga),zu=ji(function(e,t,r,i,n){return e.h===2&&(Gr(e,Bn(t,i,r),n),!0)},ga);var Ti=Symbol(),rs=Symbol(),pa=Symbol(),xa=Symbol();let ya,ba;function Yt(e,t,r,i){var n=i[e];if(n)return n;(n={}).Ma=i,n.T=function(f){switch(typeof f){case"boolean":return qo||(qo=[0,void 0,!0]);case"number":return f>0?void 0:f===0?Ru||(Ru=[0,void 0]):[-f,void 0];case"string":return[0,f];case"object":return f}}(i[0]);var s=i[1];let a=1;s&&s.constructor===Object&&(n.ga=s,typeof(s=i[++a])=="function"&&(n.la=!0,ya??(ya=s),ba??(ba=i[a+1]),s=i[a+=2]));const c={};for(;s&&Array.isArray(s)&&s.length&&typeof s[0]=="number"&&s[0]>0;){for(var l=0;l<s.length;l++)c[s[l]]=s;s=i[++a]}for(l=1;s!==void 0;){let f;typeof s=="number"&&(l+=s,s=i[++a]);var u=void 0;if(s instanceof wr?f=s:(f=Vu,a--),f==null?void 0:f.l){s=i[++a],u=i;var d=a;typeof s=="function"&&(s=s(),u[d]=s),u=s}for(d=l+1,typeof(s=i[++a])=="number"&&s<0&&(d-=s,s=i[++a]);l<d;l++){const w=c[l];u?r(n,l,f,u,w):t(n,l,f,w)}}return i[e]=n}function va(e){return Array.isArray(e)?e[0]instanceof wr?e:[zu,e]:[e,void 0]}function ka(e,t){return e instanceof y?e.u:Array.isArray(e)?At(e,t,!1):void 0}function is(e,t,r,i){const n=r.g;e[t]=i?(s,a,c)=>n(s,a,c,i):n}function ns(e,t,r,i,n){const s=r.g;let a,c;e[t]=(l,u,d)=>s(l,u,d,c||(c=Yt(rs,is,ns,i).T),a||(a=ss(i)),n)}function ss(e){let t=e[pa];if(t!=null)return t;const r=Yt(rs,is,ns,e);return t=r.la?(i,n)=>ya(i,n,r):(i,n)=>{const s=0|i[k];for(;aa(n)&&n.h!=4;){var a=n.m,c=r[a];if(c==null){var l=r.ga;l&&(l=l[a])&&(l=Wu(l))!=null&&(c=r[a]=l)}c!=null&&c(n,i,a)||(a=(c=n).l,yi(c),c.fa?c=void 0:(l=c.g.g-a,c.g.g=a,c=sa(c.g,l)),a=i,c&&((l=a[ir])?l.push(c):a[ir]=[c]))}return 8192&s&&nr(i),!0},e[pa]=t}function Wu(e){const t=(e=va(e))[0].g;if(e=e[1]){const r=ss(e),i=Yt(rs,is,ns,e).T;return(n,s,a)=>t(n,s,a,i,r)}return t}function Si(e,t,r){e[t]=r.h}function Ai(e,t,r,i){let n,s;const a=r.h;e[t]=(c,l,u)=>a(c,l,u,s||(s=Yt(Ti,Si,Ai,i).T),n||(n=_a(i)))}function _a(e){let t=e[xa];if(!t){const r=Yt(Ti,Si,Ai,e);t=(i,n)=>Ea(i,n,r),e[xa]=t}return t}function Ea(e,t,r){(function(i,n,s){const a=512&n?0:-1,c=i.length,l=c+((n=64&n?256&n:!!c&&ai(i[c-1]))?-1:0);for(let u=0;u<l;u++)s(u-a,i[u]);if(n){i=i[c-1];for(const u in i)!isNaN(u)&&s(+u,i[u])}})(e,0|e[k]|(r.T[1]?512:0),(i,n)=>{if(n!=null){var s=function(a,c){var l=a[c];if(l)return l;if((l=a.ga)&&(l=l[c])){var u=(l=va(l))[0].h;if(l=l[1]){const d=_a(l),f=Yt(Ti,Si,Ai,l).T;l=a.la?ba(f,d):(w,m,g)=>u(w,m,g,f,d)}else l=u;return a[c]=l}}(r,i);s&&s(t,n,i)}}),(e=yn(e))&&function(i,n){fr(i,i.g.end());for(let s=0;s<n.length;s++)fr(i,fn(n[s])||new Uint8Array(0))}(t,e)}function mr(e,t){if(Array.isArray(t)){var r=0|t[k];if(4&r)return t;for(var i=0,n=0;i<t.length;i++){const s=e(t[i]);s!=null&&(t[n++]=s)}return n<i&&(t.length=n),ie(t,-6145&(5|r)),2&r&&Object.freeze(t),t}}function ge(e,t,r){return new wr(e,t,r)}function gr(e,t,r){return new wr(e,t,r)}function pe(e,t,r){K(e,0|e[k],t,r)}var $u=ji(function(e,t,r,i,n){return e.h===2&&(e=Gr(e,At([void 0,void 0],i,!0),n),Et(i=0|t[k]),(n=ft(t,i,r))instanceof rt?2&n.M?((n=n.da()).push(e),K(t,i,r,n)):n.Ja(e):Array.isArray(n)?(2&(0|n[k])&&K(t,i,r,n=Qo(n)),n.push(e)):K(t,i,r,[e]),!0)},function(e,t,r,i,n){if(t instanceof rt)t.forEach((s,a)=>{Ei(e,r,At([a,s],i,!1),n)});else if(Array.isArray(t))for(let s=0;s<t.length;s++){const a=t[s];Array.isArray(a)&&Ei(e,r,At(a,i,!1),n)}});function ja(e,t,r){if(t=function(i){if(i==null)return i;const n=typeof i;if(n==="bigint")return String(Rr(64,i));if(Or(i)){if(n==="string")return Go(i);if(n==="number")return jn(i)}}(t),t!=null&&(typeof t=="string"&&ua(t),t!=null))switch(Se(e,r,0),typeof t){case"number":e=e.g,Wt(t),dr(e,U,J);break;case"bigint":r=BigInt.asUintN(64,t),r=new Kn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),dr(e.g,r.h,r.g);break;default:r=ua(t),dr(e.g,r.h,r.g)}}function Ta(e,t,r){(t=or(t))!=null&&t!=null&&(Se(e,r,0),ki(e.g,t))}function Sa(e,t,r){(t=Do(t))!=null&&(Se(e,r,0),e.g.g.push(t?1:0))}function Aa(e,t,r){(t=cr(t))!=null&&_i(e,r,uo(t))}function Ca(e,t,r,i,n){Ei(e,r,ka(t,i),n)}function Na(e,t,r){t==null||typeof t=="string"||t instanceof ht||(Vt(t)?Vt(t)&&mn(jo):t=void 0),t!=null&&_i(e,r,Gn(t).buffer)}function Ia(e,t,r){return(e.h===5||e.h===2)&&(t=ur(t,0|t[k],r,!1),e.h==2?bi(e,$n,t):t.push($n(e.g)),!0)}var xt=ge(function(e,t,r){if(e.h!==1)return!1;var i=e.g;e=Wn(i);const n=Wn(i);i=2*(n>>31)+1;const s=n>>>20&2047;return e=4294967296*(1048575&n)+e,pe(t,r,s==2047?e?NaN:i*(1/0):s==0?5e-324*i*e:i*Math.pow(2,s-1075)*(e+4503599627370496)),!0},function(e,t,r){(t=St(t))!=null&&(Se(e,r,1),e=e.g,(r=Mo||(Mo=new DataView(new ArrayBuffer(8)))).setFloat64(0,+t,!0),U=r.getUint32(0,!0),J=r.getUint32(4,!0),Vr(e,U),Vr(e,J))},Ye()),ne=ge(function(e,t,r){return e.h===5&&(pe(t,r,$n(e.g)),!0)},function(e,t,r){(t=St(t))!=null&&(Se(e,r,5),e=e.g,vn(t),Vr(e,U))},ts),Hu=gr(Ia,function(e,t,r){if((t=mr(St,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&(Se(i,n,5),i=i.g,vn(s),Vr(i,U))}},ts),os=gr(Ia,function(e,t,r){if((t=mr(St,t))!=null&&t.length){Se(e,r,2),hr(e.g,4*t.length);for(let i=0;i<t.length;i++)r=e.g,vn(t[i]),Vr(r,U)}},ts),It=ge(function(e,t,r){return e.h===0&&(pe(t,r,Vn(e.g,_n)),!0)},ja,fa),as=ge(function(e,t,r){return e.h===0&&(pe(t,r,(e=Vn(e.g,_n))===0?void 0:e),!0)},ja,fa),qu=ge(function(e,t,r){return e.h===0&&(pe(t,r,Vn(e.g,kn)),!0)},function(e,t,r){if((t=Su(t))!=null&&(typeof t=="string"&&la(t),t!=null))switch(Se(e,r,0),typeof t){case"number":e=e.g,Wt(t),dr(e,U,J);break;case"bigint":r=BigInt.asUintN(64,t),r=new Yn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),dr(e.g,r.h,r.g);break;default:r=la(t),dr(e.g,r.h,r.g)}},Ye()),Q=ge(function(e,t,r){return e.h===0&&(pe(t,r,Nt(e.g)),!0)},Ta,es),Ci=gr(function(e,t,r){return(e.h===0||e.h===2)&&(t=ur(t,0|t[k],r,!1),e.h==2?bi(e,Nt,t):t.push(Nt(e.g)),!0)},function(e,t,r){if((t=mr(or,t))!=null&&t.length){r=Xn(e,r);for(let i=0;i<t.length;i++)ki(e.g,t[i]);Jn(e,r)}},es),pr=ge(function(e,t,r){return e.h===0&&(pe(t,r,(e=Nt(e.g))===0?void 0:e),!0)},Ta,es),H=ge(function(e,t,r){return e.h===0&&(pe(t,r,zn(e.g)),!0)},Sa,da),xr=ge(function(e,t,r){return e.h===0&&(pe(t,r,(e=zn(e.g))===!1?void 0:e),!0)},Sa,da),fe=gr(function(e,t,r){return e.h===2&&(e=qn(e),ur(t,0|t[k],r,!1).push(e),!0)},function(e,t,r){if((t=mr(cr,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&_i(i,n,uo(s))}},Zn),Mt=ge(function(e,t,r){return e.h===2&&(pe(t,r,(e=qn(e))===""?void 0:e),!0)},Aa,Zn),R=ge(function(e,t,r){return e.h===2&&(pe(t,r,qn(e)),!0)},Aa,Zn),ae=function(e,t,r=Qn){return new wr(e,t,r)}(function(e,t,r,i,n){return e.h===2&&(i=At(void 0,i,!0),ur(t,0|t[k],r,!0).push(i),Gr(e,i,n),!0)},function(e,t,r,i,n){if(Array.isArray(t))for(let s=0;s<t.length;s++)Ca(e,t[s],r,i,n)}),O=ji(function(e,t,r,i,n,s){return e.h===2&&(Zo(t,0|t[k],s,r),Gr(e,t=Bn(t,i,r),n),!0)},Ca),Ma=ge(function(e,t,r){return e.h===2&&(pe(t,r,ca(e)),!0)},Na,wa),Yu=gr(function(e,t,r){return(e.h===0||e.h===2)&&(t=ur(t,0|t[k],r,!1),e.h==2?bi(e,pt,t):t.push(pt(e.g)),!0)},function(e,t,r){if((t=mr(Ro,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&(Se(i,n,0),hr(i.g,s))}},ha),Ku=ge(function(e,t,r){return e.h===0&&(pe(t,r,(e=pt(e.g))===0?void 0:e),!0)},function(e,t,r){(t=Ro(t))!=null&&t!=null&&(Se(e,r,0),hr(e.g,t))},ha),Ae=ge(function(e,t,r){return e.h===0&&(pe(t,r,Nt(e.g)),!0)},function(e,t,r){(t=or(t))!=null&&(t=parseInt(t,10),Se(e,r,0),ki(e.g,t))},ma);class Xu{constructor(t,r){this.h=t,this.g=r,this.l=M,this.m=j,this.defaultValue=void 0}register(){ii(this)}}function Ke(e,t){return new Xu(e,t)}function Lt(e,t){return(r,i)=>{if(vi.length){const s=vi.pop();s.o(i),Hn(s.g,r,i),r=s}else r=new class{constructor(s,a){if(oa.length){const c=oa.pop();Hn(c,s,a),s=c}else s=new class{constructor(c,l){this.h=null,this.m=!1,this.g=this.l=this.j=0,Hn(this,c,l)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.aa=!1}}(s,a);this.g=s,this.l=this.g.g,this.h=this.m=-1,this.o(a)}o({fa:s=!1}={}){this.fa=s}}(r,i);try{const s=new e,a=s.u;ss(t)(a,r);var n=s}finally{r.g.clear(),r.m=-1,r.h=-1,vi.length<100&&vi.push(r)}return n}}function Ni(e){return function(){const t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const a=this.g;return this.g=[],a}}}};Ea(this.u,t,Yt(Ti,Si,Ai,e)),fr(t,t.g.end());const r=new Uint8Array(t.h),i=t.l,n=i.length;let s=0;for(let a=0;a<n;a++){const c=i[a];r.set(c,s),s+=c.length}return t.l=[r],r}}var La=class extends y{constructor(e){super(e)}},Fa=[0,Mt,ge(function(e,t,r){return e.h===2&&(pe(t,r,(e=ca(e))===zt()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof y){const i=t.Oa;return void(i&&(t=i(t),t!=null&&_i(e,r,Gn(t).buffer)))}if(Array.isArray(t))return}Na(e,t,r)},wa)];let cs,Pa=globalThis.trustedTypes;function Da(e){cs===void 0&&(cs=function(){let r=null;if(!Pa)return r;try{const i=n=>n;r=Pa.createPolicy("goog#html",{createHTML:i,createScript:i,createScriptURL:i})}catch{}return r}());var t=cs;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function Ju(e,...t){if(t.length===0)return Da(e[0]);let r=e[0];for(let i=0;i<t.length;i++)r+=encodeURIComponent(t[i])+e[i+1];return Da(r)}var Ra=[0,Q,Ae,H,-1,Ci,Ae,-1],Qu=class extends y{constructor(e){super(e)}},Oa=[0,H,R,H,Ae,-1,gr(function(e,t,r){return(e.h===0||e.h===2)&&(t=ur(t,0|t[k],r,!1),e.h==2?bi(e,Bu,t):t.push(Nt(e.g)),!0)},function(e,t,r){if((t=mr(or,t))!=null&&t.length){r=Xn(e,r);for(let i=0;i<t.length;i++)ki(e.g,t[i]);Jn(e,r)}},ma),R,-1,[0,H,-1],Ae,H,-1],Ba=[0,R,-2],Ua=class extends y{constructor(e){super(e)}},Ga=[0],Va=[0,Q,H,1,H,-3],Ce=class extends y{constructor(e){super(e,2)}},se={};se[336783863]=[0,R,H,-1,Q,[0,[1,2,3,4,5,6,7,8,9],O,Ga,O,Oa,O,Ba,O,Va,O,Ra,O,[0,R,-2],O,[0,R,Ae],O,[0,Ae,R,-1],O,[0,Ae,-1]],[0,R],H,[0,[1,3],[2,4],O,[0,Ci],-1,O,[0,fe],-1,ae,[0,R,-1]],R];var za=[0,as,-1,xr,-3,as,Ci,Mt,pr,as,-1,xr,pr,xr,-2,Mt];function Ne(e,t){Pn(e,2,ar(t),"")}function z(e,t){gi(e,3,t)}function I(e,t){gi(e,4,t)}var xe=class extends y{constructor(e){super(e,500)}o(e){return j(this,0,7,e)}},zr=[-1,{}],Wa=[0,R,1,zr],$a=[0,R,fe,zr];function Ie(e,t){pi(e,1,xe,t)}function W(e,t){gi(e,10,t)}function F(e,t){gi(e,15,t)}var be=class extends y{constructor(e){super(e,500)}o(e){return j(this,0,1001,e)}},Ha=[-500,ae,[-500,Mt,-1,fe,-3,[-2,se,H],ae,Fa,pr,-1,Wa,$a,ae,[0,Mt,xr],Mt,za,pr,fe,987,fe],4,ae,[-500,R,-1,[-1,{}],998,R],ae,[-500,R,fe,-1,[-2,{},H],997,fe,-1],pr,ae,[-500,R,fe,zr,998,fe],fe,pr,Wa,$a,ae,[0,Mt,-1,zr],fe,-2,za,Mt,-1,xr,[0,xr,Ku],978,zr,ae,Fa];be.prototype.g=Ni(Ha);var Zu=Lt(be,Ha),ed=class extends y{constructor(e){super(e)}},qa=class extends y{constructor(e){super(e)}g(){return mt(this,ed,1)}},Ya=[0,ae,[0,Q,ne,R,-1]],Ii=Lt(qa,Ya),td=class extends y{constructor(e){super(e)}},rd=class extends y{constructor(e){super(e)}},ls=class extends y{constructor(e){super(e)}h(){return M(this,td,2)}g(){return mt(this,rd,5)}},Ka=Lt(class extends y{constructor(e){super(e)}},[0,fe,Ci,os,[0,Ae,[0,Q,-3],[0,ne,-3],[0,Q,-1,[0,ae,[0,Q,-2]]],ae,[0,ne,-1,R,ne]],R,-1,It,ae,[0,Q,ne],fe,It]),Xa=class extends y{constructor(e){super(e)}},yr=Lt(class extends y{constructor(e){super(e)}},[0,ae,[0,ne,-4]]),Ja=class extends y{constructor(e){super(e)}},Wr=Lt(class extends y{constructor(e){super(e)}},[0,ae,[0,ne,-4]]),id=class extends y{constructor(e){super(e)}},nd=[0,Q,-1,os,Ae],Qa=class extends y{constructor(e){super(e)}};Qa.prototype.g=Ni([0,ne,-4,It]);var sd=class extends y{constructor(e){super(e)}},od=Lt(class extends y{constructor(e){super(e)}},[0,ae,[0,1,Q,R,Ya],It]),Za=class extends y{constructor(e){super(e)}},ad=class extends y{constructor(e){super(e)}ma(){const e=Jo(this);return e??zt()}},cd=class extends y{constructor(e){super(e)}},ec=[1,2],ld=Lt(class extends y{constructor(e){super(e)}},[0,ae,[0,ec,O,[0,os],O,[0,Ma],Q,R],It]),us=class extends y{constructor(e){super(e)}},tc=[0,R,Q,ne,fe,-1],rc=class extends y{constructor(e){super(e)}},ud=[0,H,-1],ic=class extends y{constructor(e){super(e)}},Mi=[1,2,3,4,5],Li=class extends y{constructor(e){super(e)}g(){return Jo(this)!=null}h(){return Be(this,2)!=null}},q=class extends y{constructor(e){super(e)}g(){return Do(lr(this,2))??!1}},nc=[0,Ma,R,[0,Q,It,-1],[0,qu,It]],te=[0,nc,H,[0,Mi,O,Va,O,Oa,O,Ra,O,Ga,O,Ba],Ae],Fi=class extends y{constructor(e){super(e)}},ds=[0,te,ne,-1,Q],dd=Ke(502141897,Fi);se[502141897]=ds;var hd=Lt(class extends y{constructor(e){super(e)}},[0,[0,Ae,-1,Hu,Yu],nd]),sc=class extends y{constructor(e){super(e)}},oc=class extends y{constructor(e){super(e)}},hs=[0,te,ne,[0,te],H],ac=[0,te,ds,hs,ne,[0,[0,nc]]],fd=Ke(508968150,oc);se[508968150]=ac,se[508968149]=hs;var cc=class extends y{constructor(e){super(e)}},wd=Ke(513916220,cc);se[513916220]=[0,te,ac,Q];var br=class extends y{constructor(e){super(e)}h(){return M(this,us,2)}g(){V(this,2)}},lc=[0,te,tc];se[478825465]=lc;var md=class extends y{constructor(e){super(e)}},uc=class extends y{constructor(e){super(e)}},fs=class extends y{constructor(e){super(e)}},ws=class extends y{constructor(e){super(e)}},dc=class extends y{constructor(e){super(e)}},hc=[0,te,[0,te],lc,-1],fc=[0,te,ne,Q],ms=[0,te,ne],wc=[0,te,fc,ms,ne],gd=Ke(479097054,dc);se[479097054]=[0,te,wc,hc],se[463370452]=hc,se[464864288]=fc;var pd=Ke(462713202,ws);se[462713202]=wc,se[474472470]=ms;var xd=class extends y{constructor(e){super(e)}},mc=class extends y{constructor(e){super(e)}},gc=class extends y{constructor(e){super(e)}},pc=class extends y{constructor(e){super(e)}},gs=[0,te,ne,-1,Q],ps=[0,te,ne,H];pc.prototype.g=Ni([0,te,ms,[0,te],ds,hs,gs,ps]);var xc=class extends y{constructor(e){super(e)}},yd=Ke(456383383,xc);se[456383383]=[0,te,tc];var yc=class extends y{constructor(e){super(e)}},bd=Ke(476348187,yc);se[476348187]=[0,te,ud];var bc=class extends y{constructor(e){super(e)}},vc=class extends y{constructor(e){super(e)}},kc=[0,Ae,-1],vd=Ke(458105876,class extends y{constructor(e){super(e)}g(){var e=this.u;const t=0|e[k],r=2&t;return e=function(i,n,s){var a=vc;const c=2&n;let l=!1;if(s==null){if(c)return Yo();s=[]}else if(s.constructor===rt){if(!(2&s.M)||c)return s;s=s.da()}else Array.isArray(s)?l=!!(2&(0|s[k])):s=[];if(c){if(!s.length)return Yo();l||(l=!0,nr(s))}else l&&(l=!1,s=Qo(s));return l||(64&(0|s[k])?s[k]&=-33:32&n&&si(s,32)),K(i,n,2,a=new rt(s,a,Au,void 0)),a}(e,t,ft(e,t,2)),!r&&vc&&(e.pa=!0),e}});se[458105876]=[0,kc,$u,[!0,It,[0,R,-1,fe]]];var xs=class extends y{constructor(e){super(e)}},_c=Ke(458105758,xs);se[458105758]=[0,te,R,kc];var Ec=class extends y{constructor(e){super(e)}},kd=Ke(443442058,Ec);se[443442058]=[0,te,R,Q,ne,fe,-1,H,ne],se[514774813]=gs;var jc=class extends y{constructor(e){super(e)}},_d=Ke(516587230,jc);function ys(e,t){return t=t?t.clone():new us,e.displayNamesLocale!==void 0?V(t,1,ar(e.displayNamesLocale)):e.displayNamesLocale===void 0&&V(t,1),e.maxResults!==void 0?it(t,2,e.maxResults):"maxResults"in e&&V(t,2),e.scoreThreshold!==void 0?b(t,3,e.scoreThreshold):"scoreThreshold"in e&&V(t,3),e.categoryAllowlist!==void 0?xi(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&V(t,4),e.categoryDenylist!==void 0?xi(t,5,e.categoryDenylist):"categoryDenylist"in e&&V(t,5),t}function bs(e,t=-1,r=""){return{categories:e.map(i=>({index:Oe(i,1)??0??-1,score:ee(i,2)??0,categoryName:Be(i,3)??""??"",displayName:Be(i,4)??""??""})),headIndex:t,headName:r}}function Tc(e){var a,c;var t=Ht(e,3,St,$t()),r=Ht(e,2,or,$t()),i=Ht(e,1,cr,$t()),n=Ht(e,9,cr,$t());const s={categories:[],keypoints:[]};for(let l=0;l<t.length;l++)s.categories.push({score:t[l],index:r[l]??-1,categoryName:i[l]??"",displayName:n[l]??""});if((t=(a=M(e,ls,4))==null?void 0:a.h())&&(s.boundingBox={originX:Oe(t,1)??0,originY:Oe(t,2)??0,width:Oe(t,3)??0,height:Oe(t,4)??0,angle:0}),(c=M(e,ls,4))==null?void 0:c.g().length)for(const l of M(e,ls,4).g())s.keypoints.push({x:mi(l,1)??0,y:mi(l,2)??0,score:mi(l,4)??0,label:Be(l,3)??""});return s}function Pi(e){const t=[];for(const r of mt(e,Ja,1))t.push({x:ee(r,1)??0,y:ee(r,2)??0,z:ee(r,3)??0,visibility:ee(r,4)??0});return t}function $r(e){const t=[];for(const r of mt(e,Xa,1))t.push({x:ee(r,1)??0,y:ee(r,2)??0,z:ee(r,3)??0,visibility:ee(r,4)??0});return t}function Sc(e){return Array.from(e,t=>t>127?t-256:t)}function Ac(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,i=0,n=0;for(let s=0;s<e.length;s++)r+=e[s]*t[s],i+=e[s]*e[s],n+=t[s]*t[s];if(i<=0||n<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(i*n)}let Di;se[516587230]=[0,te,gs,ps,ne],se[518928384]=ps;const Ed=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Cc(){if(Di===void 0)try{await WebAssembly.instantiate(Ed),Di=!0}catch{Di=!1}return Di}async function Hr(e,t=Ju``){const r=await Cc()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Kt=class{};function Nc(){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 Ic(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,i)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",n=>{i(n)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function Mc(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 Lc(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]=Mc(t);return!e.l||i===e.i.canvas.width&&n===e.i.canvas.height||(e.i.canvas.width=i,e.i.canvas.height=n),[i,n]}function Fc(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const i=new Uint32Array(t.length);for(let n=0;n<t.length;n++)i[n]=e.i.stringToNewUTF8(t[n]);t=e.i._malloc(4*i.length),e.i.HEAPU32.set(i,t>>2),r(t);for(const n of i)e.i._free(n);e.i._free(t)}function nt(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function Ft(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)}}Kt.forVisionTasks=function(e){return Hr("vision",e)},Kt.forTextTasks=function(e){return Hr("text",e)},Kt.forGenAiExperimentalTasks=function(e){return Hr("genai_experimental",e)},Kt.forGenAiTasks=function(e){return Hr("genai",e)},Kt.forAudioTasks=function(e){return Hr("audio",e)},Kt.isSimdSupported=function(){return Cc()};async function jd(e,t,r,i){return e=await(async(n,s,a,c,l)=>{if(s&&await Ic(s),!self.ModuleFactory||a&&(await Ic(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 vs(e,t){const r=M(e.baseOptions,Li,1)||new Li;typeof t=="string"?(V(r,2,ar(t)),V(r,1)):t instanceof Uint8Array&&(V(r,1,xn(t,!1)),V(r,2)),j(e.baseOptions,0,1,r)}function Pc(e){try{const t=e.G.length;if(t===1)throw Error(e.G[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.G.map(r=>r.message).join(", "))}finally{e.G=[]}}function x(e,t){e.B=Math.max(e.B,t)}function Ri(e,t){e.A=new xe,Ne(e.A,"PassThroughCalculator"),z(e.A,"free_memory"),I(e.A,"free_memory_unused_out"),W(t,"free_memory"),Ie(t,e.A)}function vr(e,t){z(e.A,t),I(e.A,t+"_unused_out")}function Oi(e){e.g.addBoolToStream(!0,"free_memory",e.B)}var ks=class{constructor(e){this.g=e,this.G=[],this.B=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var r,i,n,s,a,c;if(t){const l=e.baseOptions||{};if((r=e.baseOptions)!=null&&r.modelAssetBuffer&&((i=e.baseOptions)!=null&&i.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((n=M(this.baseOptions,Li,1))!=null&&n.g()||(s=M(this.baseOptions,Li,1))!=null&&s.h()||(a=e.baseOptions)!=null&&a.modelAssetBuffer||(c=e.baseOptions)!=null&&c.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(u,d){let f=M(u.baseOptions,ic,3);if(!f){var w=f=new ic,m=new Ua;Br(w,4,Mi,m)}"delegate"in d&&(d.delegate==="GPU"?(d=f,w=new Qu,Br(d,2,Mi,w)):(d=f,w=new Ua,Br(d,4,Mi,w))),j(u.baseOptions,0,3,f)}(this,l),l.modelAssetPath)return fetch(l.modelAssetPath.toString()).then(u=>{if(u.ok)return u.arrayBuffer();throw Error(`Failed to fetch model: ${l.modelAssetPath} (${u.status})`)}).then(u=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(u),!0,!1,!1),vs(this,"/model.dat"),this.m(),this.J()});if(l.modelAssetBuffer instanceof Uint8Array)vs(this,l.modelAssetBuffer);else if(l.modelAssetBuffer)return async function(u){const d=[];for(var f=0;;){const{done:w,value:m}=await u.read();if(w)break;d.push(m),f+=m.length}if(d.length===0)return new Uint8Array(0);if(d.length===1)return d[0];u=new Uint8Array(f),f=0;for(const w of d)u.set(w,f),f+=w.length;return u}(l.modelAssetBuffer).then(u=>{vs(this,u),this.m(),this.J()})}return this.m(),this.J(),Promise.resolve()}J(){}ca(){let e;if(this.g.ca(t=>{e=Zu(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,i)=>{this.G.push(Error(i))}),this.g.Ha(),this.g.setGraph(e,t),this.A=void 0,Pc(this)}finishProcessing(){this.g.finishProcessing(),Pc(this)}close(){this.A=void 0,this.g.closeGraph()}};function yt(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}ks.prototype.close=ks.prototype.close;class Td{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 Dc(e,t,r){const i=e.g;if(r=yt(i.createShader(r),"Failed to create WebGL shader"),i.shaderSource(r,t),i.compileShader(r),!i.getShaderParameter(r,i.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${i.getShaderInfoLog(r)}`);return i.attachShader(e.h,r),r}function Rc(e,t){const r=e.g,i=yt(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(i);const n=yt(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,n),r.enableVertexAttribArray(e.P),r.vertexAttribPointer(e.P,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);const s=yt(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.J),r.vertexAttribPointer(e.J,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,null),r.bindVertexArray(null),new Td(r,i,n,s)}function _s(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Es(e,t,r,i){return _s(e,t),e.h||(e.m(),e.C()),r?(e.s||(e.s=Rc(e,!0)),r=e.s):(e.v||(e.v=Rc(e,!1)),r=e.v),t.useProgram(e.h),r.bind(),e.l(),e=i(),r.g.bindVertexArray(null),e}function Bi(e,t,r){return _s(e,t),e=yt(t.createTexture(),"Failed to create texture"),t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,r??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function Ui(e,t,r){_s(e,t),e.A||(e.A=yt(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.A),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function js(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Ts=class{G(){return`
9
+ */var kl=Symbol.for("react.transitional.element"),_l=Symbol.for("react.fragment");function qs(e,t,r){var i=null;if(r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),"key"in t){r={};for(var n in t)n!=="key"&&(r[n]=t[n])}else r=t;return t=r.ref,{$$typeof:kl,type:e,key:i,ref:t!==void 0?t:null,props:r}}Jr.Fragment=_l,Jr.jsx=qs,Jr.jsxs=qs,Hs.exports=Jr;var o=Hs.exports;const Qi={},tt={api:{baseUrl:"/api",retryConfig:{attempts:3,backoff:"exponential",baseDelay:1e3}},ui:{baseColor:"#3B82F6",borderRadius:"8px"},interview:{timers:{thinkingDuration:30,answeringDuration:120,editingDuration:30},stt:{provider:"groq",model:"whisper-large-v3-turbo",language:"en"},tts:{provider:"piper"},proctoring:{enabled:!0,gazeAnalysisEnabled:!0}}},Zi="iw-storage";function El(){if(!(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ji&&Ji.tagName.toUpperCase()==="SCRIPT"&&Ji.src||new URL("widget.umd.js",document.baseURI).href}<"u"&&(Qi!=null&&Qi.VITE_IW_SECRET)))return typeof process<"u"&&process.env.NEXT_PUBLIC_IW_SECRET?process.env.NEXT_PUBLIC_IW_SECRET:typeof window<"u"&&window.__IW_SECRET__?window.__IW_SECRET__:"proctoring-data-seed"}const Ys=El(),en=5,tn="AES-GCM",rn=12;async function Ks(e){const r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return crypto.subtle.importKey("raw",i,tn,!1,["encrypt","decrypt"])}function jl(){return crypto.getRandomValues(new Uint8Array(rn))}async function Tl(e,t="default-seed"){try{const r=typeof e=="string"?e:JSON.stringify(e),n=new TextEncoder().encode(r),s=await Ks(t),a=jl(),c=await crypto.subtle.encrypt({name:tn,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 Sl(e,t="default-seed"){try{const r=atob(e),i=new Uint8Array(r.length);for(let u=0;u<r.length;u++)i[u]=r.charCodeAt(u);const n=i.slice(0,rn),s=i.slice(rn),a=await Ks(t),c=await crypto.subtle.decrypt({name:tn,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 Al(e,t="default-seed"){return Tl(e,t)}async function Cl(e,t="default-seed"){const r=await Sl(e,t);try{return JSON.parse(r)}catch{return r}}const Ar=h.createContext(null),Nl=async()=>{try{const e=sessionStorage.getItem(Zi);if(e){const r=(await Cl(e,Ys)).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}}},Cr=async e=>{try{const t=await Al({state:e,version:0},Ys);sessionStorage.setItem(Zi,t)}catch(t){console.error("Failed to save proctoring data to session storage:",t)}},Il=({children:e})=>{const t=h.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=h.useRef(new Set);h.useEffect(()=>{Nl().then(w=>{t.current=w,i()})},[]);const i=h.useCallback(()=>{r.current.forEach(w=>w())},[]),n=h.useCallback(w=>(r.current.add(w),()=>{r.current.delete(w)}),[]),s=h.useCallback(()=>t.current,[]),a=h.useCallback(w=>{t.current={...t.current,logViolations:[...t.current.logViolations,w],totalViolations:t.current.totalViolations+1},Cr(t.current),i()},[i]),c=h.useCallback(w=>{const m={...t.current.gazeViolationCounters};w==="looking_away"&&(m.lookingAwayCount+=1),w==="no_face_detected"&&(m.noFaceDetectedCount+=1),w==="multiple_faces"&&(m.multipleFacesCount+=1),m.totalGazeViolations=m.lookingAwayCount+m.noFaceDetectedCount+m.multipleFacesCount,t.current={...t.current,gazeViolationCounters:m},Cr(t.current),i()},[i]),l=h.useCallback(()=>{t.current={...t.current,logViolations:[],totalViolations:0},Cr(t.current),i()},[i]),u=h.useCallback(()=>{t.current={...t.current,gazeViolationCounters:{lookingAwayCount:0,noFaceDetectedCount:0,multipleFacesCount:0,totalGazeViolations:0}},Cr(t.current),i()},[i]),d=h.useCallback((w,m)=>{t.current={...t.current,referenceSet:w,referenceRef:m},Cr(t.current),i()},[i]),f=h.useMemo(()=>({getState:s,addViolation:a,clearViolations:l,subscribe:n,incrementGazeViolation:c,clearGazeViolationCounters:u,setReferenceData:d}),[s,a,l,n,c,u,d]);return o.jsx(Ar.Provider,{value:f,children:e})},Xs=()=>{const e=h.useContext(Ar);if(!e)throw new Error("useProctoringStore must be used within a ProctoringProvider");const t=h.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}},Ml=()=>{const e=h.useContext(Ar);if(!e)throw new Error("useViolations must be used within a ProctoringProvider");return h.useSyncExternalStore(e.subscribe,()=>e.getState().logViolations,()=>e.getState().logViolations)},Ll=()=>{const e=h.useContext(Ar);if(!e)throw new Error("useTotalViolations must be used within a ProctoringProvider");return h.useSyncExternalStore(e.subscribe,()=>e.getState().totalViolations,()=>e.getState().totalViolations)},Fl=()=>{const e=h.useContext(Ar);if(!e)throw new Error("useProctoringActions must be used within a ProctoringProvider");return{addViolation:e.addViolation,clearViolations:e.clearViolations}},Js=h.createContext(null);function Qs({config:e={},children:t}){var i,n,s,a;const r={api:{...tt.api,...e.api,retryConfig:{...tt.api.retryConfig,...(i=e.api)==null?void 0:i.retryConfig}},ui:{...tt.ui,...e.ui},interview:{...tt.interview,...e.interview,timers:{...tt.interview.timers,...(n=e.interview)==null?void 0:n.timers},stt:{...tt.interview.stt,...(s=e.interview)==null?void 0:s.stt},tts:{...tt.interview.tts,...(a=e.interview)==null?void 0:a.tts}}};return o.jsx(Js.Provider,{value:r,children:o.jsx(Il,{children:t})})}function Qr(){const e=h.useContext(Js);if(!e)throw new Error("useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>");return e}function Zs(){return Qr().api||tt.api}function Zt(){return Qr().ui||tt.ui}function nn(){return Qr().interview||tt.interview}const eo=({className:e,...t})=>o.jsx("div",{children:o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`iw-animate-spin ${e}`,...t,children:[o.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o.jsx("path",{d:"M12 6l0 -3"}),o.jsx("path",{d:"M16.25 7.75l2.15 -2.15"}),o.jsx("path",{d:"M18 12l3 0"}),o.jsx("path",{d:"M16.25 16.25l2.15 2.15"}),o.jsx("path",{d:"M12 18l0 3"}),o.jsx("path",{d:"M7.75 16.25l-2.15 2.15"}),o.jsx("path",{d:"M6 12l-3 0"}),o.jsx("path",{d:"M7.75 7.75l-2.15 -2.15"})]})}),to=({children:e,variant:t="primary",size:r="md",fullWidth:i=!1,isLoading:n=!1,disabled:s,className:a="",...c})=>{const l="iw-inline-flex iw-items-center iw-justify-center iw-rounded-md iw-font-medium iw-transition-colors iw-focus:outline-none iw-focus:ring-2 iw-focus:ring-primary-500 iw-focus:ring-offset-2",u={primary:"iw-bg-primary-600 iw-text-white iw-hover:bg-primary-700 iw-border iw-border-transparent",secondary:"iw-bg-primary-100 iw-text-primary-700 iw-hover:bg-primary-200 iw-border iw-border-transparent",outline:"iw-bg-transparent iw-text-primary-700 iw-border iw-border-primary-500 iw-hover:bg-primary-50",text:"iw-bg-transparent iw-text-primary-600 iw-hover:bg-primary-50 iw-border iw-border-transparent",gradient:"iw-text-white iw-border iw-border-transparent iw-bg-gradient-to-r iw-from-purple-500 iw-to-indigo-500 hover:iw-from-purple-600 hover:iw-to-indigo-600"},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} ${u[t]} ${d[r]} ${w} ${f} ${a}`,disabled:s||n,...c,children:[n&&o.jsx(eo,{height:16,width:16,style:{marginRight:"3px"}}),e]})};function Pl(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 Dl(e,t,r){return"#"+[e,t,r].map(i=>{const n=Math.round(i).toString(16);return n.length===1?"0"+n:n}).join("")}function ro(e,t){const r=Pl(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 Dl(i,n,s)}function Rl(e,t=.8){return{background:`linear-gradient(to bottom, ${ro(e,t)}, #ffffff)`,color:"#1f2937"}}function io(e){return new Promise(t=>setTimeout(t,e))}function no(e){return`linear-gradient(to left, ${ro(e,.4)}, ${e})`}const Ol=()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);function Bl(e){try{const t=e.split(".");if(t.length!==3||!t[1])throw new Error("Invalid JWT token");const i=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=i.padEnd(i.length+(4-i.length%4)%4,"="),s=atob(n);return JSON.parse(s)}catch(t){return console.error("Error decoding JWT:",t),null}}const so=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]}),oo=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}),o.jsx("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),o.jsx("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]}),Ul=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o.jsx("path",{d:"M15 8a5 5 0 0 1 0 8"}),o.jsx("path",{d:"M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a.8 .8 0 0 1 1.5 .5v14a.8 .8 0 0 1 -1.5 .5l-3.5 -4.5"})]}),He=e=>{const{baseColor:t,borderRadius:r}=Zt(),{loading:i,children:n,...s}=e;return o.jsx(to,{style:{background:no(t),borderRadius:r},...s,children:i?o.jsx(eo,{}):n})},Zr=({isOpen:e,onClose:t,children:r,title:i,showCloseButton:n=!0,closeOnOverlayClick:s=!0,closeOnEscape:a=!0,className:c=""})=>{if(h.useEffect(()=>{if(!e||!a)return;const d=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,a,t]),h.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()},u=o.jsxs("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center",children:[o.jsx("div",{className:"iw-fixed iw-inset-0 iw-bg-black iw-bg-opacity-50 iw-transition-opacity",onClick:l}),o.jsxs("div",{className:`iw-relative iw-bg-white iw-rounded-lg iw-shadow-xl iw-max-w-md iw-w-full iw-mx-4 iw-max-h-[90vh] iw-overflow-hidden ${c}`,role:"dialog","aria-modal":"true","aria-labelledby":i?"dialog-title":void 0,children:[(i||n)&&o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-p-4 iw-border-b iw-border-gray-200",children:[i&&o.jsx("h2",{id:"dialog-title",className:"iw-text-lg iw-font-semibold iw-text-gray-900",children:i}),n&&o.jsx("button",{onClick:t,className:"iw-p-1 iw-text-gray-400 iw-hover:text-gray-600 iw-transition-colors iw-rounded iw-hover:bg-gray-100","aria-label":"Close dialog",children:o.jsx("svg",{className:"iw-w-5 iw-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsx("div",{className:"iw-p-4 iw-overflow-y-auto",children:r})]})]});return Qt.createPortal(u,document.body)},Gl=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-info-icon prefix__lucide-info",...e,children:[o.jsx("circle",{cx:12,cy:12,r:10}),o.jsx("path",{d:"M12 16v-4M12 8h.01"})]}),Vl=e=>o.jsx("svg",{width:24,height:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-scan-face-icon prefix__lucide-scan-face",...e,children:o.jsx("path",{d:"M3 7V5a2 2 0 012-2h2M17 3h2a2 2 0 012 2v2M21 17v2a2 2 0 01-2 2h-2M7 21H5a2 2 0 01-2-2v-2M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01"})});function zl({isOpen:e,onDecline:t,onContinue:r}){return o.jsx(Zr,{isOpen:e,showCloseButton:!1,onClose:t,children:e&&o.jsx("div",{className:"iw-bg-white iw-border-slate-200 iw-rounded-2xl iw-p-0 iw-shadow-xl sm:iw-max-w-xl",children:o.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-4",children:[o.jsx("div",{className:"iw--mt-0.5 iw-h-2.5 iw-w-full iw-rounded-t-2xl iw-bg-gradient-to-r iw-from-blue-500 iw-to-indigo-500"}),o.jsx("div",{className:"iw-sr-only",children:"Face Data Usage Notice"}),o.jsx("div",{className:"iw-sr-only",children:"Permission to use face data for interview monitoring"}),o.jsxs("div",{className:"iw-px-8 iw-py-8",children:[o.jsxs("div",{className:"iw-text-center",children:[o.jsx("div",{className:"iw-mx-auto iw-mb-6 iw-flex iw-h-16 iw-w-16 iw-items-center iw-justify-center iw-rounded-full iw-border iw-border-blue-200 iw-bg-gradient-to-br iw-from-blue-50 iw-to-blue-100 iw-shadow-sm iw-ring-1 iw-ring-blue-100",children:o.jsx(Vl,{className:"iw-text-blue-600"})}),o.jsx("h1",{className:"iw-text-zinc-700 iw-mb-6 iw-text-2xl iw-font-semibold iw-tracking-tight",children:"Face Data Usage Notice"})]}),o.jsxs("ul",{className:"iw-mb-4 iw-list-item iw-space-y-4 iw-text-sm iw-leading-relaxed iw-text-gray-700",children:[o.jsx("li",{children:"To ensure the integrity of the interview process, this platform uses your device's camera to monitor your face and gaze direction."}),o.jsx("li",{children:"Your face data is processed only for proctoring purposes (e.g., detecting if you are looking away or off-screen)."}),o.jsx("li",{children:"All processing is limited to the interview session and is used solely to maintain fairness."})]}),o.jsxs("div",{className:"iw-text-zinc-700 iw-flex iw-items-start iw-gap-2 iw-rounded-md iw-border iw-border-blue-100 iw-bg-blue-50/60 iw-p-3 iw-text-sm iw-font-medium",children:[o.jsx(Gl,{className:"iw-text-neutral-400 iw-mt-0.5 iw-inline-block iw-size-4 iw-flex-shrink-0"}),o.jsx("p",{className:"",children:"Please note that we do not store, share, or use your biometric data beyond the scope of this interview."})]}),o.jsx("p",{className:"iw-text-neutral-400 iw-my-4 iw-text-center iw-text-sm",children:"By continuing, you acknowledge and consent to the use of your face data exclusively for interview monitoring purposes."}),o.jsxs("div",{className:"iw-flex iw-gap-3 iw-border-t iw-border-gray-200/80 iw-pt-6",children:[o.jsx(He,{onClick:t,className:"iw-flex-1 iw-border",children:"Decline"}),o.jsx(He,{onClick:r,className:"iw-flex-1",children:"I Understand & Continue"})]})]})]})})})}function Wl(e){var t;if(!navigator.onLine)return{type:"network",message:"No internet connection",retryable:!0,userMessage:"Please check your internet connection and try again."};if(e.name==="AbortError"||(t=e.message)!=null&&t.includes("timeout"))return{type:"timeout",message:"Request timed out",retryable:!0,userMessage:"The request is taking longer than expected. Please try again."};if(e.status){const{status:r}=e;if(r===401||r===403)return{type:"auth",status:r,message:"Authentication failed",retryable:!1,userMessage:"Your session has expired. Please refresh the page."};if(r===429)return{type:"rate-limit",status:r,message:"Too many requests",retryable:!0,userMessage:"Please wait a moment before trying again."};if(r>=500)return{type:"server",status:r,message:`Server error: ${r}`,retryable:!0,userMessage:"Our servers are experiencing issues. Please try again in a few moments."};if(r>=400)return{type:"client",status:r,message:`Client error: ${r}`,retryable:!1,userMessage:"There was an issue with your request. Please check your input."}}return{type:"unknown",message:e.message||"Unknown error occurred",retryable:!0,userMessage:"Something unexpected happened. Please try again.",originalError:e}}async function ei(e,t={},r={attempts:3,backoff:"exponential",baseDelay:1e3,maxDelay:1e4,jitter:!0}){let i;for(let n=1;n<=r.attempts;n++)try{const s=new AbortController,a=setTimeout(()=>s.abort(),6e4),c=await fetch(e,{...t,signal:s.signal});if(clearTimeout(a),c.status>=400&&c.status<500&&c.status!==429)return c;if(!c.ok)throw new Error(`HTTP ${c.status}: ${c.statusText}`);return c}catch(s){i=s;const a=Wl(s);if(!a.retryable||n===r.attempts)throw a;const c=$l(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 $l(e,t){let r;return t.backoff==="exponential"?r=t.baseDelay*Math.pow(2,e-1):r=t.baseDelay,r=Math.min(r,t.maxDelay),t.jitter&&(r=r*(.5+Math.random()*.5)),Math.round(r)}class Hl{constructor(t={}){Te(this,"config");this.config=t}updateConfig(t){this.config={...this.config,...t}}getHeaders(){var r;const t={"Content-Type":"application/json"};return(r=this.config)!=null&&r.authToken&&(t.Authorization=`Bearer ${this.config.authToken}`),t}getBaseUrl(){var t;return((t=this.config)==null?void 0:t.baseUrl)||"/api"}async generateQuestion({interviewId:t,isInterviewDone:r=!1,qnaId:i,question:n,answer:s,answerDuration:a}){const c=await ei(`${this.getBaseUrl()}/questions/next`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({interview_id:t,is_interview_done:r,qna_id:i,question:n,answer:s,answer_duration:a??"00:00:30"})});if(!c.ok)throw new Error(`Failed to get questions: ${c.status}`);return await c.json()}async requestScreenshotUploadUrl(t,r=`screenshot-${Date.now()}.jpeg`){const i=await ei(`${this.getBaseUrl()}/interview/${t}/content`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({filename:r,mime_type:"image/jpeg"})});if(!i.ok)throw new Error(`Failed to request screenshot upload URL: ${i.status}`);return await i.json()}async uploadScreenshot(t,r){const i=await fetch(t,{method:"PUT",body:r,headers:{"Content-Type":"image/jpeg"}});if(!i.ok)throw new Error(`Failed to upload screenshot: ${i.status}`)}}function ao(){const e=Qr();return h.useMemo(()=>{const r=e.api||{};return new Hl(r)},[e.api])}const Nr=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),o.jsx("path",{d:"M12 9v4"}),o.jsx("path",{d:"M12 17h.01"})]}),sn=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M12 2a10 10 0 0 1 7.38 16.75"}),o.jsx("path",{d:"M12 6v6l4 2"}),o.jsx("path",{d:"M2.5 8.875a10 10 0 0 0-.5 3"}),o.jsx("path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4"}),o.jsx("path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857"}),o.jsx("path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38"})]}),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:"M12 6v6l4 2"}),o.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),co=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"})]}),Yl=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"})]}),on=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"})]}),Kl=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"})]}),Xl=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})]}),Jl=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"})]}),Ql=e=>o.jsxs("svg",{width:24,height:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-target-icon prefix__lucide-target",...e,children:[o.jsx("circle",{cx:12,cy:12,r:10}),o.jsx("circle",{cx:12,cy:12,r:6}),o.jsx("circle",{cx:12,cy:12,r:2})]}),Zl=e=>o.jsxs("svg",{width:24,height:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"prefix__lucide prefix__lucide-users-icon prefix__lucide-users",...e,children:[o.jsx("path",{d:"M16 21v-2a4 4 0 00-4-4H6a4 4 0 00-4 4v2M16 3.128a4 4 0 010 7.744M22 21v-2a4 4 0 00-3-3.87"}),o.jsx("circle",{cx:9,cy:7,r:4})]}),Ir={FACE_DETECTED:"face_detected",NO_FACE:"no_face_detected",MULTIPLE_FACES:"multiple_faces",LOOKING_AWAY:"looking_away",CAMERA_ERROR:"camera_error"},eu={[Ir.FACE_DETECTED]:{icon:co,iconColor:"iw-text-green-600",iconBg:"iw-bg-green-50",iconBorder:"iw-border-green-100",title:"All Good",subtitle:"Everything looks normal",description:"Your gaze is properly focused on the screen. Continue with your interview.",buttonText:"Continue"},[Ir.NO_FACE]:{icon:Jl,iconColor:"iw-text-orange-600",iconBg:"iw-bg-orange-50",iconBorder:"iw-border-orange-100",title:"Face Not Detected",subtitle:"We can't see you in the camera",description:"Please ensure you're positioned properly in front of the camera and that your face is clearly visible.",buttonText:"I Understood"},[Ir.MULTIPLE_FACES]:{icon:Zl,iconColor:"iw-text-red-600",iconBg:"iw-bg-red-50",iconBorder:"iw-border-red-100",title:"Multiple People Detected",subtitle:"More than one person is visible",description:"For interview integrity, please ensure you are alone in the room and only your face is visible to the camera.",buttonText:"I Understood"},[Ir.LOOKING_AWAY]:{icon:Ql,iconColor:"iw-text-amber-600",iconBg:"iw-bg-amber-50",iconBorder:"iw-border-amber-200/75",title:"Stay Focused",subtitle:"We noticed you looked away from the screen",description:"To ensure interview integrity, please keep your attention on the screen throughout the session.",buttonText:"I Understood"},[Ir.CAMERA_ERROR]:{icon:Nr,iconColor:"iw-text-red-600",iconBg:"iw-bg-red-50",iconBorder:"iw-border-red-100",title:"Camera Issue",subtitle:"There's a problem with your camera",description:"Please check your camera connection and permissions, then refresh the page to continue.",buttonText:"I Understood"}};function tu({isOpen:e,onClose:t,warningType:r}){const i=eu[r],n=i.icon,s=()=>{t()};return r==="face_detected"?null:o.jsx(Zr,{isOpen:e,onClose:t,children:e&&o.jsx("div",{className:"iw-bg-white iw-border-white iw-border iw-p-0 iw-shadow-lg sm:iw-max-w-md",children:o.jsxs("div",{children:[o.jsx("div",{className:"iw-sr-only",children:i.description}),o.jsxs("div",{className:"iw-px-8 iw-py-8 iw-text-center",children:[o.jsx("div",{className:`iw-mx-auto iw-mb-6 iw-flex iw-h-16 iw-w-16 iw-items-center iw-justify-center iw-rounded-full ${i.iconBg} border ${i.iconBorder}`,children:o.jsx(n,{className:`iw-h-7 iw-w-7 ${i.iconColor}`})}),o.jsx("h1",{className:"iw-text-foreground iw-mb-3 iw-text-2xl iw-font-bold iw-tracking-tight",children:i.title}),o.jsx("h2",{className:"iw-text-gray-500 iw-mb-6 iw-text-base iw-font-medium",children:i.subtitle}),o.jsx("p",{className:"iw-text-neutral-400 iw-mx-auto iw-mb-8 iw-max-w-sm iw-text-sm iw-leading-relaxed",children:i.description}),o.jsx(He,{onClick:s,className:"iw-w-full iw-bg-gray-800 iw-text-white hover:iw-bg-gray-800",children:i.buttonText})]})]})})})}const ru=({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."]})]})}),iu=({showControls:e,isBubbleOpen:t,setIsBubbleOpen:r,setReference:i,clearCache:n,isModelLoaded:s,gazeAnalysisEnabled:a,referenceSet:c,showLandmarks:l,setShowLandmarks:u,showEngagementBar:d,setShowEngagementBar:f,handleToggleGazeAnalysis:w,stats:m,statusMessage:g,loadingProgress:v})=>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(Xl,{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:E=>w(E.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:E=>u(E.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:E=>f(E.target.checked),disabled:!a}),"Show Engagement Bar"]})]}),c&&o.jsx(ru,{gazeAnalysisEnabled:a,isModelLoaded:s,loadingProgress:v,stats:m,statusMessage:g})]})]}):null;var er=typeof self<"u"?self:{};function Gt(){throw Error("Invalid UTF8")}function lo(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let ti,an;const nu=typeof TextDecoder<"u";let su;const ou=typeof TextEncoder<"u";function uo(e){if(ou)e=(su||(su=new TextEncoder)).encode(e);else{let r=0;const i=new Uint8Array(3*e.length);for(let n=0;n<e.length;n++){var t=e.charCodeAt(n);if(t<128)i[r++]=t;else{if(t<2048)i[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&n<e.length){const s=e.charCodeAt(++n);if(s>=56320&&s<=57343){t=1024*(t-55296)+s-56320+65536,i[r++]=t>>18|240,i[r++]=t>>12&63|128,i[r++]=t>>6&63|128,i[r++]=63&t|128;continue}n--}t=65533}i[r++]=t>>12|224,i[r++]=t>>6&63|128}i[r++]=63&t|128}}e=r===i.length?i:i.subarray(0,r)}return e}var cn,ri;e:{for(var ho=["CLOSURE_FLAGS"],ln=er,un=0;un<ho.length;un++)if((ln=ln[ho[un]])==null){ri=null;break e}ri=ln}var Mr,fo=ri&&ri[610401301];cn=fo!=null&&fo;const wo=er.navigator;function dn(e){return!!cn&&!!Mr&&Mr.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function Re(e){var t;return(t=er.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function _t(){return!!cn&&!!Mr&&Mr.brands.length>0}function hn(){return _t()?dn("Chromium"):(Re("Chrome")||Re("CriOS"))&&!(!_t()&&Re("Edge"))||Re("Silk")}function ii(e){return ii[" "](e),e}Mr=wo&&wo.userAgentData||null,ii[" "]=function(){};var au=!_t()&&(Re("Trident")||Re("MSIE"));!Re("Android")||hn(),hn(),Re("Safari")&&(hn()||!_t()&&Re("Coast")||!_t()&&Re("Opera")||!_t()&&Re("Edge")||(_t()?dn("Microsoft Edge"):Re("Edg/"))||_t()&&dn("Opera"));var mo={},Lr=null;function cu(e){const t=e.length;let r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);const i=new Uint8Array(r);let n=0;return function(s,a){function c(u){for(;l<s.length;){const d=s.charAt(l++),f=Lr[d];if(f!=null)return f;if(!/^[\s\xa0]*$/.test(d))throw Error("Unknown base64 encoding at char: "+d)}return u}go();let l=0;for(;;){const u=c(-1),d=c(0),f=c(64),w=c(64);if(w===64&&u===-1)break;a(u<<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 go(){if(!Lr){Lr={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const i=e.concat(t[r].split(""));mo[r]=i;for(let n=0;n<i.length;n++){const s=i[n];Lr[s]===void 0&&(Lr[s]=n)}}}}var po=typeof Uint8Array<"u",xo=!au&&typeof btoa=="function";function yo(e){if(!xo){var t;t===void 0&&(t=0),go(),t=mo[t];var r=Array(Math.floor(e.length/3)),i=t[64]||"";let l=0,u=0;for(;l<e.length-2;l+=3){var n=e[l],s=e[l+1],a=e[l+2],c=t[n>>2];n=t[(3&n)<<4|s>>4],s=t[(15&s)<<2|a>>6],a=t[63&a],r[u++]=c+n+s+a}switch(c=0,a=i,e.length-l){case 2:a=t[(15&(c=e[l+1]))<<2]||i;case 1:e=e[l],r[u]=t[e>>2]+t[(3&e)<<4|c>>4]+a+i}return r.join("")}for(t="",r=0,i=e.length-10240;r<i;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}const bo=/[-_.]/g,lu={"-":"+",_:"/",".":"="};function uu(e){return lu[e]||""}function vo(e){if(!xo)return cu(e);bo.test(e)&&(e=e.replace(bo,uu)),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 Vt(e){return po&&e!=null&&e instanceof Uint8Array}var tr={};function zt(){return du||(du=new ht(null,tr))}function fn(e){ko(tr);var t=e.g;return(t=t==null||Vt(t)?t:typeof t=="string"?vo(t):null)==null?t:e.g=t}var ht=class{h(){return new Uint8Array(fn(this)||0)}constructor(e,t){if(ko(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let du,hu;function ko(e){if(e!==tr)throw Error("illegal external caller")}function _o(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function wn(e){return _o(e=Error(e),"warning"),e}function mn(e){if(e!=null){var t=hu??(hu={}),r=t[e]||0;r>=5||(t[e]=r+1,_o(e=Error(),"incident"),function(i){er.setTimeout(()=>{throw i},0)}(e))}}var ni=typeof Symbol=="function"&&typeof Symbol()=="symbol";function rr(e,t,r=!1){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?r&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t}var fu=rr("jas",void 0,!0),Eo=rr(void 0,"0di"),Fr=rr(void 0,"1oa"),ir=rr(void 0,Symbol()),wu=rr(void 0,"0actk"),jo=rr(void 0,"8utk");const k=ni?fu:"Ea",To={Ea:{value:0,configurable:!0,writable:!0,enumerable:!1}},So=Object.defineProperties;function si(e,t){ni||k in e||So(e,To),e[k]|=t}function ie(e,t){ni||k in e||So(e,To),e[k]=t}function nr(e){return si(e,34),e}function mu(e,t){ie(t,-15615&(0|e))}function gn(e,t){ie(t,-15581&(34|e))}function oi(){return typeof BigInt=="function"}function ye(e){return Array.prototype.slice.call(e)}var pn,Pr={};function ai(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function xn(e,t){if(e!=null){if(typeof e=="string")e=e?new ht(e,tr):zt();else if(e.constructor!==ht)if(Vt(e))e=e.length?new ht(new Uint8Array(e),tr):zt();else{if(!t)throw Error();e=void 0}}return e}const Ao=[];function Et(e){if(2&e)throw Error()}ie(Ao,55),pn=Object.freeze(Ao);class Co{constructor(t,r,i){this.g=t,this.h=r,this.l=i}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}function yn(e){return ir?e[ir]:void 0}var gu=Object.freeze({});function ci(e){return e.Na=!0,e}var pu=ci(e=>typeof e=="number"),No=ci(e=>typeof e=="string"),xu=ci(e=>typeof e=="boolean"),li=typeof er.BigInt=="function"&&typeof er.BigInt(0)=="bigint";function jt(e){var t=e;if(No(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(pu(t)&&!Number.isSafeInteger(t))throw Error(String(t));return li?BigInt(e):e=xu(e)?e?"1":"0":No(e)?e.trim()||"0":String(e)}var bn=ci(e=>li?e>=bu&&e<=ku:e[0]==="-"?Io(e,yu):Io(e,vu));const yu=Number.MIN_SAFE_INTEGER.toString(),bu=li?BigInt(Number.MIN_SAFE_INTEGER):void 0,vu=Number.MAX_SAFE_INTEGER.toString(),ku=li?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Io(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){const i=e[r],n=t[r];if(i>n)return!1;if(i<n)return!0}}const _u=typeof Uint8Array.prototype.slice=="function";let Mo,U=0,J=0;function Lo(e){const t=e>>>0;U=t,J=(e-t)/4294967296>>>0}function Wt(e){if(e<0){Lo(-e);const[t,r]=En(U,J);U=t>>>0,J=r>>>0}else Lo(e)}function vn(e){const t=Mo||(Mo=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),J=0,U=t.getUint32(0,!0)}function kn(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Dr(e,t)}function _n(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=kn(e,t))=="number"?r?-e:e:r?"-"+e:e}function Dr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else oi()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+Fo(r)+Fo(e));return r}function Fo(e){return e=String(e),"0000000".slice(e.length)+e}function Po(){var e=U,t=J;if(2147483648&t)if(oi())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,i]=En(e,t);e="-"+Dr(r,i)}else e=Dr(e,t);return e}function ui(e){if(e.length<16)Wt(Number(e));else if(oi())e=BigInt(e),U=Number(e&BigInt(4294967295))>>>0,J=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");J=U=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));J*=1e6,U=1e6*U+s,U>=4294967296&&(J+=Math.trunc(U/4294967296),J>>>=0,U>>>=0)}if(t){const[i,n]=En(U,J);U=i,J=n}}}function En(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}const Rr=typeof BigInt=="function"?BigInt.asIntN:void 0,Eu=typeof BigInt=="function"?BigInt.asUintN:void 0,Tt=Number.isSafeInteger,di=Number.isFinite,sr=Math.trunc,ju=jt(0);function St(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Do(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const Tu=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Or(e){switch(typeof e){case"bigint":return!0;case"number":return di(e);case"string":return Tu.test(e);default:return!1}}function or(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return di(e)?0|e:void 0}function Ro(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return di(e)?e>>>0:void 0}function Oo(e){if(e[0]==="-")return!1;const t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function Bo(e){const t=e.length;return e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337}function Uo(e){return Bo(e)?e:(ui(e),Po())}function jn(e){return e=sr(e),Tt(e)||(Wt(e),e=_n(U,J)),e}function Go(e){var t=sr(Number(e));return Tt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Uo(e))}function Vo(e){var t=sr(Number(e));return Tt(t)?jt(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),oi()?jt(Rr(64,BigInt(e))):jt(Uo(e)))}function zo(e){if(Tt(e))e=jt(jn(e));else{if(e=sr(e),Tt(e))e=String(e);else{const t=String(e);Bo(t)?e=t:(Wt(e),e=Po())}e=jt(e)}return e}function Tn(e){return e==null?e:typeof e=="bigint"?(bn(e)?e=Number(e):(e=Rr(64,e),e=bn(e)?Number(e):String(e)),e):Or(e)?typeof e=="number"?jn(e):Go(e):void 0}function Su(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(Eu(64,e));if(Or(e)){if(t==="string")return t=sr(Number(e)),Tt(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Oo(e)||(ui(e),e=Dr(U,J))),e;if(t==="number")return(e=sr(e))>=0&&Tt(e)?e:function(r){if(r<0){Wt(r);var i=Dr(U,J);return r=Number(i),Tt(r)?r:i}return Oo(i=String(r))?i:(Wt(r),kn(U,J))}(e)}}function Wo(e){if(typeof e!="string")throw Error();return e}function ar(e){if(e!=null&&typeof e!="string")throw Error();return e}function cr(e){return e==null||typeof e=="string"?e:void 0}function Sn(e,t,r,i){if(e!=null&&typeof e=="object"&&e.W===Pr)return e;if(!Array.isArray(e))return r?2&i?((e=t[Eo])||(nr((e=new t).u),e=t[Eo]=e),t=e):t=new t:t=void 0,t;let n=r=0|e[k];return n===0&&(n|=32&i),n|=2&i,n!==r&&ie(e,n),new t(e)}function Au(e,t,r){if(t)e:{if(!Or(t=e))throw wn("int64");switch(typeof t){case"string":t=Vo(t);break e;case"bigint":t=jt(Rr(64,t));break e;default:t=zo(t)}}else e=typeof(t=e),t=t==null?t:e==="bigint"?jt(Rr(64,t)):Or(t)?e==="string"?Vo(t):zo(t):void 0;return(e=t)==null?r?ju:void 0:e}function Cu(e){return e}const Nu={};let Iu=function(){try{return ii(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 Mu=Iu?(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 $o(e){return e}function Cn(e){if(2&e.M)throw Error("Cannot mutate an immutable Map")}var rt=class extends Mu{constructor(e,t,r=$o,i=$o){super();let n=0|e[k];n|=64,ie(e,n),this.M=n,this.I=t,this.S=r,this.X=this.I?Lu:i;for(let s=0;s<e.length;s++){const a=e[s],c=r(a[0],!1,!0);let l=a[1];t?l===void 0&&(l=null):l=i(a[1],!1,!0,void 0,void 0,n),super.set(c,l)}}La(){var e=Ou;if(this.size!==0)return Array.from(super.entries(),t=>(t[0]=e(t[0]),t[1]=e(t[1]),t))}da(e=Fu){const t=[],r=super.entries();for(var i;!(i=r.next()).done;)(i=i.value)[0]=e(i[0]),i[1]=e(i[1]),t.push(i);return t}clear(){Cn(this),super.clear()}delete(e){return Cn(this),super.delete(this.S(e,!0,!1))}entries(){if(this.I){var e=super.keys();e=new Co(e,Pu,this)}else e=super.entries();return e}values(){if(this.I){var e=super.keys();e=new Co(e,rt.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.I?super.forEach((r,i,n)=>{e.call(t,n.get(i),i,n)}):super.forEach(e,t)}set(e,t){return Cn(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.X(t,!0,!0,this.I,!1,this.M))}Ja(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.I?e===void 0?null:e:this.X(e,!1,!0,void 0,!1,this.M),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);const t=super.get(e);if(t!==void 0){var r=this.I;return r?((r=this.X(t,!1,!0,r,this.pa,this.M))!==t&&super.set(e,r),r):t}}[Symbol.iterator](){return this.entries()}};function Lu(e,t,r,i,n,s){return e=Sn(e,i,r,s),n&&(e=wi(e)),e}function Fu(e){return e}function Pu(e){return[e,this.get(e)]}let Du,Ho,qo,Ru;function Yo(){return Du||(Du=new rt(nr([]),void 0,void 0,void 0,Nu))}function Nn(e,t,r,i,n){if(e!=null){if(Array.isArray(e)){const s=0|e[k];return e.length===0&&1&s?void 0:n&&2&s?e:hi(e,t,r,i!==void 0,n)}return t(e,i)}}function hi(e,t,r,i,n){const s=i||r?0|e[k]:0,a=i?!!(32&s):void 0;let c=0;const l=(i=ye(e)).length;for(let g=0;g<l;g++){var u=i[g];if(g===l-1&&ai(u)){var d=t,f=r,w=a,m=n;let v;for(let E in u){const p=Nn(u[E],d,f,w,m);p!=null&&((v??(v={}))[E]=p)}u=v}else u=Nn(i[g],t,r,a,n);i[g]=u,u!=null&&(c=g+1)}return c<l&&(i.length=c),r&&((e=yn(e))&&(i[ir]=ye(e)),r(s,i)),i}function Ou(e){return Nn(e,In,void 0,void 0,!1)}function In(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(Vt(e))return Vt(e)&&mn(jo),yo(e);if(e.W===Pr)return Ko(e);if(e instanceof ht){const t=e.g;return t==null?"":typeof t=="string"?t:e.g=yo(t)}return e instanceof rt?e.La():void 0}return e}function Ko(e){var t=e.u;e=hi(t,In,void 0,void 0,!1);var r=0|t[k];if((t=e.length)&&!(512&r)){var i=e[t-1],n=!1;ai(i)?(t--,n=!0):i=void 0;var s=t-(r=512&r?0:-1),a=(Ho??Cu)(s,r,e,i);if(i&&(e[t]=void 0),s<a&&i){for(var c in s=!0,i){const l=+c;l<=a?(e[n=l+r]=i[c],t=Math.max(n+1,t),n=!1,delete i[c]):s=!1}s&&(i=void 0)}for(s=t-1;t>0;s=t-1)if((c=e[s])==null)t--,n=!0;else{if(!((s-=r)>=a))break;(i??(i={}))[s]=c,t--,n=!0}n&&(e.length=t),i&&e.push(i)}return e}function At(e,t,r){return e=Xo(e,t[0],t[1],r?1:2),t!==qo&&r&&si(e,8192),e}function Xo(e,t,r,i){if(e==null){var n=96;r?(e=[r],n|=512):e=[],t&&(n=-16760833&n|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(8192&(n=0|e[k])||!(64&n)||2&n||mn(wu),1024&n)throw Error("farr");if(64&n)return e;if(i===1||i===2||(n|=64),r&&(n|=512,r!==e[0]))throw Error("mid");e:{var s=(r=e).length;if(s){var a=s-1;if(ai(i=r[a])){if((a-=t=512&(n|=256)?0:-1)>=1024)throw Error("pvtlmt");for(var c in i)(s=+c)<a&&(r[s+t]=i[c],delete i[c]);n=-16760833&n|(1023&a)<<14;break e}}if(t){if((c=Math.max(t,s-(512&n?0:-1)))>1024)throw Error("spvt");n=-16760833&n|(1023&c)<<14}}}return ie(e,n),e}function Mn(e,t,r=gn){if(e!=null){if(po&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var i=0|e[k];return 2&i?e:(t&&(t=i===0||!!(32&i)&&!(64&i||!(16&i))),t?(ie(e,34|i),4&i&&Object.freeze(e),e):hi(e,Mn,4&i?gn:r,!0,!0))}return e.W===Pr?e=2&(i=0|(r=e.u)[k])?e:new e.constructor(fi(r,i,!0)):e instanceof rt&&!(2&e.M)&&(r=nr(e.da(Mn)),e=new rt(r,e.I,e.S,e.X)),e}}function fi(e,t,r){const i=r||2&t?gn:mu,n=!!(32&t);return e=function(s,a,c){const l=ye(s);var u=l.length;const d=256&a?l[u-1]:void 0;for(u+=d?-1:0,a=512&a?1:0;a<u;a++)l[a]=c(l[a]);if(d){a=l[a]={};for(const f in d)a[f]=c(d[f])}return(s=yn(s))&&(l[ir]=ye(s)),l}(e,t,s=>Mn(s,n,i)),si(e,32|(r?2:0)),e}function wi(e){const t=e.u,r=0|t[k];return 2&r?new e.constructor(fi(t,r,!1)):e}function lr(e,t){return ft(e=e.u,0|e[k],t)}function ft(e,t,r){if(r===-1)return null;const i=r+(512&t?0:-1),n=e.length-1;return i>=n&&256&t?e[n][r]:i<=n?e[i]:void 0}function V(e,t,r){const i=e.u;let n=0|i[k];return Et(n),K(i,n,t,r),e}function K(e,t,r,i){const n=512&t?0:-1,s=r+n;var a=e.length-1;return s>=a&&256&t?(e[a][r]=i,t):s<=a?(e[s]=i,t):(i!==void 0&&(r>=(a=t>>14&1023||536870912)?i!=null&&(e[a+n]={[r]:i},ie(e,t|=256)):e[s]=i),t)}function mi(e,t){let r=0|(e=e.u)[k];const i=ft(e,r,t),n=St(i);return n!=null&&n!==i&&K(e,r,t,n),n}function Jo(e){let t=0|(e=e.u)[k];const r=ft(e,t,1),i=xn(r,!0);return i!=null&&i!==r&&K(e,t,1,i),i}function $t(){return gu===void 0?2:4}function Ht(e,t,r,i,n){const s=e.u,a=2&(e=0|s[k])?1:i;n=!!n;let c=0|(i=Ln(s,e,t))[k];if(!(4&c)){4&c&&(i=ye(i),c=gt(c,e),e=K(s,e,t,i));let l=0,u=0;for(;l<i.length;l++){const d=r(i[l]);d!=null&&(i[u++]=d)}u<l&&(i.length=u),c=Fn(c,e),r=-2049&(20|c),c=r&=-4097,ie(i,c),2&c&&Object.freeze(i)}return a===1||a===4&&32&c?wt(c)||(n=c,c|=2,c!==n&&ie(i,c),Object.freeze(i)):(a===2&&wt(c)&&(i=ye(i),c=gt(c,e),c=Ct(c,e,n),ie(i,c),e=K(s,e,t,i)),wt(c)||(t=c,c=Ct(c,e,n),c!==t&&ie(i,c))),i}function Ln(e,t,r){return e=ft(e,t,r),Array.isArray(e)?e:pn}function Fn(e,t){return e===0&&(e=gt(e,t)),1|e}function wt(e){return!!(2&e)&&!!(4&e)||!!(1024&e)}function Qo(e){e=ye(e);for(let t=0;t<e.length;t++){const r=e[t]=ye(e[t]);Array.isArray(r[1])&&(r[1]=nr(r[1]))}return e}function Pn(e,t,r,i){let n=0|(e=e.u)[k];Et(n),K(e,n,t,(i==="0"?Number(r)===0:r===i)?void 0:r)}function ur(e,t,r,i){Et(t);let n=Ln(e,t,r);const s=n!==pn;if(64&t||!(8192&t)||!s){const a=s?0|n[k]:0;let c=a;(!s||2&c||wt(c)||4&c&&!(32&c))&&(n=ye(n),c=gt(c,t),t=K(e,t,r,n)),c=-13&Fn(c,t),c=Ct(i?-17&c:16|c,t,!0),c!==a&&ie(n,c)}return n}function Dn(e,t){var r=ec;return On(Rn(e=e.u),e,0|e[k],r)===t?t:-1}function Rn(e){if(ni)return e[Fr]??(e[Fr]=new Map);if(Fr in e)return e[Fr];const t=new Map;return Object.defineProperty(e,Fr,{value:t}),t}function Zo(e,t,r,i){const n=Rn(e),s=On(n,e,t,r);return s!==i&&(s&&(t=K(e,t,s)),n.set(r,i)),t}function On(e,t,r,i){let n=e.get(i);if(n!=null)return n;n=0;for(let s=0;s<i.length;s++){const a=i[s];ft(t,r,a)!=null&&(n!==0&&(r=K(t,r,n)),n=a)}return e.set(i,n),n}function Bn(e,t,r){let i=0|e[k];const n=ft(e,i,r);let s;if(n!=null&&n.W===Pr)return(t=wi(n))!==n&&K(e,i,r,t),t.u;if(Array.isArray(n)){const a=0|n[k];s=2&a?At(fi(n,a,!1),t,!0):64&a?n:At(s,t,!0)}else s=At(void 0,t,!0);return s!==n&&K(e,i,r,s),s}function ea(e,t,r){let i=0|(e=e.u)[k];const n=ft(e,i,r);return(t=Sn(n,t,!1,i))!==n&&t!=null&&K(e,i,r,t),t}function M(e,t,r){if((t=ea(e,t,r))==null)return t;let i=0|(e=e.u)[k];if(!(2&i)){const n=wi(t);n!==t&&K(e,i,r,t=n)}return t}function ta(e,t,r,i,n,s,a){e=e.u;var c=!!(2&t);const l=c?1:n;s=!!s,a&&(a=!c);var u=0|(n=Ln(e,t,i))[k];if(!(c=!!(4&u))){var d=n,f=t;const w=!!(2&(u=Fn(u,t)));w&&(f|=2);let m=!w,g=!0,v=0,E=0;for(;v<d.length;v++){const p=Sn(d[v],r,!1,f);if(p instanceof r){if(!w){const A=!!(2&(0|p.u[k]));m&&(m=!A),g&&(g=A)}d[E++]=p}}E<v&&(d.length=E),u|=4,u=g?16|u:-17&u,ie(d,u=m?8|u:-9&u),w&&Object.freeze(d)}if(a&&!(8&u||!n.length&&(l===1||l===4&&32&u))){for(wt(u)&&(n=ye(n),u=gt(u,t),t=K(e,t,i,n)),r=n,a=u,d=0;d<r.length;d++)(u=r[d])!==(f=wi(u))&&(r[d]=f);a|=8,ie(r,a=r.length?-17&a:16|a),u=a}return l===1||l===4&&32&u?wt(u)||(t=u,(u|=!n.length||16&u&&(!c||32&u)?2:1024)!==t&&ie(n,u),Object.freeze(n)):(l===2&&wt(u)&&(ie(n=ye(n),u=Ct(u=gt(u,t),t,s)),t=K(e,t,i,n)),wt(u)||(i=u,(u=Ct(u,t,s))!==i&&ie(n,u))),n}function mt(e,t,r){const i=0|e.u[k];return ta(e,i,t,r,$t(),!1,!(2&i))}function j(e,t,r,i){return i==null&&(i=void 0),V(e,r,i)}function Br(e,t,r,i){i==null&&(i=void 0);e:{let n=0|(e=e.u)[k];if(Et(n),i==null){const s=Rn(e);if(On(s,e,n,r)!==t)break e;s.set(r,0)}else n=Zo(e,n,r,t);K(e,n,t,i)}}function gt(e,t){return-1025&(e=32|(2&t?2|e:-3&e))}function Ct(e,t,r){return 32&t&&r||(e&=-33),e}function gi(e,t,r){Et(0|e.u[k]),Ht(e,t,cr,2,!0).push(Wo(r))}function pi(e,t,r,i){const n=0|e.u[k];Et(n),e=ta(e,n,r,t,2,!0),i=i??new r,e.push(i),e[k]=2&(0|i.u[k])?-9&e[k]:-17&e[k]}function Oe(e,t){return or(lr(e,t))}function Be(e,t){return cr(lr(e,t))}function ee(e,t){return mi(e,t)??0}function Ur(e,t,r){if(r!=null&&typeof r!="boolean")throw e=typeof r,Error(`Expected boolean but got ${e!="object"?e:r?Array.isArray(r)?"array":e:"null"}: ${r}`);V(e,t,r)}function it(e,t,r){if(r!=null){if(typeof r!="number"||!di(r))throw wn("int32");r|=0}V(e,t,r)}function b(e,t,r){if(r!=null&&typeof r!="number")throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);V(e,t,r)}function xi(e,t,r){{const a=e.u;let c=0|a[k];if(Et(c),r==null)K(a,c,t);else{var i=e=0|r[k],n=wt(e),s=n||Object.isFrozen(r);for(n||(e=0),s||(r=ye(r),i=0,e=Ct(e=gt(e,c),c,!0),s=!1),e|=21,n=0;n<r.length;n++){const l=r[n],u=Wo(l);Object.is(l,u)||(s&&(r=ye(r),i=0,e=Ct(e=gt(e,c),c,!0),s=!1),r[n]=u)}e!==i&&(s&&(r=ye(r),e=Ct(e=gt(e,c),c,!0)),ie(r,e)),K(a,c,t,r)}}}function ra(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Un(){return Error("Failed to read varint, encoding is invalid.")}function ia(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Gn(e){if(typeof e=="string")return{buffer:vo(e),O:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),O:!1};if(e.constructor===Uint8Array)return{buffer:e,O:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),O:!1};if(e.constructor===ht)return{buffer:fn(e)||new Uint8Array(0),O:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),O:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function Vn(e,t){let r,i=0,n=0,s=0;const a=e.h;let c=e.g;do r=a[c++],i|=(127&r)<<s,s+=7;while(s<32&&128&r);for(s>32&&(n|=(127&r)>>4),s=3;s<32&&128&r;s+=7)r=a[c++],n|=(127&r)<<s;if(qt(e,c),r<128)return t(i>>>0,n>>>0);throw Un()}function zn(e){let t=0,r=e.g;const i=r+10,n=e.h;for(;r<i;){const s=n[r++];if(t|=s,(128&s)==0)return qt(e,r),!!(127&t)}throw Un()}function Nt(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 Un();return qt(e,r),n}function pt(e){return Nt(e)>>>0}function Wn(e){var t=e.h;const r=e.g,i=t[r],n=t[r+1],s=t[r+2];return t=t[r+3],qt(e,e.g+4),(i<<0|n<<8|s<<16|t<<24)>>>0}function $n(e){var t=Wn(e);e=2*(t>>31)+1;const r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function Bu(e){return Nt(e)}function Hn(e,t,{aa:r=!1}={}){e.aa=r,t&&(t=Gn(t),e.h=t.buffer,e.m=t.O,e.j=0,e.l=e.h.length,e.g=e.j)}function qt(e,t){if(e.g=t,t>e.l)throw ia(e.l,t)}function na(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);const r=e.g,i=r+t;if(i>e.l)throw ia(t,e.l-r);return e.g=i,r}function sa(e,t){if(t==0)return zt();var r=na(e,t);return e.aa&&e.m?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):_u?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?zt():new ht(r,tr)}rt.prototype.toJSON=void 0;var oa=[];function aa(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var r=pt(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5))throw ra(r,e.l);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=r,!0}function yi(e){switch(e.h){case 0:e.h!=0?yi(e):zn(e.g);break;case 1:qt(e=e.g,e.g+8);break;case 2:if(e.h!=2)yi(e);else{var t=pt(e.g);qt(e=e.g,e.g+t)}break;case 5:qt(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!aa(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}yi(e)}break;default:throw ra(e.h,e.l)}}function Gr(e,t,r){const i=e.g.l,n=pt(e.g),s=e.g.g+n;let a=s-i;if(a<=0&&(e.g.l=s,r(t,e,void 0,void 0,void 0),a=s-e.g.g),a)throw Error(`Message parsing ended unexpectedly. Expected to read ${n} bytes, instead read ${n-a} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=s,e.g.l=i,t}function qn(e){var t=pt(e.g),r=na(e=e.g,t);if(e=e.h,nu){var i,n=e;(i=an)||(i=an=new TextDecoder("utf-8",{fatal:!0})),t=r+t,n=r===0&&t===n.length?n:n.subarray(r,t);try{var s=i.decode(n)}catch(c){if(ti===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),ti=!0}catch{ti=!1}}throw!ti&&(an=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?Gt():(c=e[s++],a<194||(192&c)!=128?(s--,Gt()):r.push((31&a)<<6|63&c)):a<240?s>=t-1?Gt():(c=e[s++],(192&c)!=128||a===224&&c<160||a===237&&c>=160||(192&(i=e[s++]))!=128?(s--,Gt()):r.push((15&a)<<12|(63&c)<<6|63&i)):a<=244?s>=t-2?Gt():(c=e[s++],(192&c)!=128||c-144+(a<<28)>>30||(192&(i=e[s++]))!=128||(192&(n=e[s++]))!=128?(s--,Gt()):(a=(7&a)<<18|(63&c)<<12|(63&i)<<6|63&n,a-=65536,r.push(55296+(a>>10&1023),56320+(1023&a)))):Gt(),r.length>=8192&&(l=lo(l,r),r.length=0)}s=lo(l,r)}return s}function ca(e){const t=pt(e.g);return sa(e.g,t)}function bi(e,t,r){var i=pt(e.g);for(i=e.g.g+i;e.g.g<i;)r.push(t(e.g))}var vi=[];function qe(e,t,r){t.g?t.m(e,t.g,t.h,r):t.m(e,t.h,r)}var y=class{constructor(e,t){this.u=Xo(e,t)}toJSON(){try{var e=Ko(this)}finally{Ho=void 0}return e}l(){var e=vd;return e.g?e.l(this,e.g,e.h):e.l(this,e.h,e.defaultValue)}clone(){const e=this.u;return new this.constructor(fi(e,0|e[k],!1))}O(){return!!(2&(0|this.u[k]))}};function la(e){return e?/^\d+$/.test(e)?(ui(e),new Yn(U,J)):null:Uu||(Uu=new Yn(0,0))}y.prototype.W=Pr,y.prototype.toString=function(){return this.u.toString()};var Yn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Uu;function ua(e){return e?/^-?\d+$/.test(e)?(ui(e),new Kn(U,J)):null:Gu||(Gu=new Kn(0,0))}var Kn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Gu;function dr(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function hr(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function ki(e,t){if(t>=0)hr(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Vr(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function fr(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Se(e,t,r){hr(e.g,8*t+r)}function Xn(e,t){return Se(e,t,2),t=e.g.end(),fr(e,t),t.push(e.h),t}function Jn(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function _i(e,t,r){Se(e,t,2),hr(e.g,r.length),fr(e,e.g.end()),fr(e,r)}function Ei(e,t,r,i){r!=null&&(t=Xn(e,t),i(r,e),Jn(e,t))}function Ye(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Qn=Ye(),da=Ye(),Zn=Ye(),es=Ye(),ha=Ye(),fa=Ye(),ts=Ye(),wa=Ye(),ma=Ye(),wr=class{constructor(e,t,r){this.g=e,this.h=t,e=Qn,this.l=!!e&&r===e||!1}};function ji(e,t){return new wr(e,t,Qn)}function ga(e,t,r,i,n){Ei(e,r,ka(t,i),n)}const Vu=ji(function(e,t,r,i,n){return e.h===2&&(Gr(e,Bn(t,i,r),n),!0)},ga),zu=ji(function(e,t,r,i,n){return e.h===2&&(Gr(e,Bn(t,i,r),n),!0)},ga);var Ti=Symbol(),rs=Symbol(),pa=Symbol(),xa=Symbol();let ya,ba;function Yt(e,t,r,i){var n=i[e];if(n)return n;(n={}).Ma=i,n.T=function(f){switch(typeof f){case"boolean":return qo||(qo=[0,void 0,!0]);case"number":return f>0?void 0:f===0?Ru||(Ru=[0,void 0]):[-f,void 0];case"string":return[0,f];case"object":return f}}(i[0]);var s=i[1];let a=1;s&&s.constructor===Object&&(n.ga=s,typeof(s=i[++a])=="function"&&(n.la=!0,ya??(ya=s),ba??(ba=i[a+1]),s=i[a+=2]));const c={};for(;s&&Array.isArray(s)&&s.length&&typeof s[0]=="number"&&s[0]>0;){for(var l=0;l<s.length;l++)c[s[l]]=s;s=i[++a]}for(l=1;s!==void 0;){let f;typeof s=="number"&&(l+=s,s=i[++a]);var u=void 0;if(s instanceof wr?f=s:(f=Vu,a--),f==null?void 0:f.l){s=i[++a],u=i;var d=a;typeof s=="function"&&(s=s(),u[d]=s),u=s}for(d=l+1,typeof(s=i[++a])=="number"&&s<0&&(d-=s,s=i[++a]);l<d;l++){const w=c[l];u?r(n,l,f,u,w):t(n,l,f,w)}}return i[e]=n}function va(e){return Array.isArray(e)?e[0]instanceof wr?e:[zu,e]:[e,void 0]}function ka(e,t){return e instanceof y?e.u:Array.isArray(e)?At(e,t,!1):void 0}function is(e,t,r,i){const n=r.g;e[t]=i?(s,a,c)=>n(s,a,c,i):n}function ns(e,t,r,i,n){const s=r.g;let a,c;e[t]=(l,u,d)=>s(l,u,d,c||(c=Yt(rs,is,ns,i).T),a||(a=ss(i)),n)}function ss(e){let t=e[pa];if(t!=null)return t;const r=Yt(rs,is,ns,e);return t=r.la?(i,n)=>ya(i,n,r):(i,n)=>{const s=0|i[k];for(;aa(n)&&n.h!=4;){var a=n.m,c=r[a];if(c==null){var l=r.ga;l&&(l=l[a])&&(l=Wu(l))!=null&&(c=r[a]=l)}c!=null&&c(n,i,a)||(a=(c=n).l,yi(c),c.fa?c=void 0:(l=c.g.g-a,c.g.g=a,c=sa(c.g,l)),a=i,c&&((l=a[ir])?l.push(c):a[ir]=[c]))}return 8192&s&&nr(i),!0},e[pa]=t}function Wu(e){const t=(e=va(e))[0].g;if(e=e[1]){const r=ss(e),i=Yt(rs,is,ns,e).T;return(n,s,a)=>t(n,s,a,i,r)}return t}function Si(e,t,r){e[t]=r.h}function Ai(e,t,r,i){let n,s;const a=r.h;e[t]=(c,l,u)=>a(c,l,u,s||(s=Yt(Ti,Si,Ai,i).T),n||(n=_a(i)))}function _a(e){let t=e[xa];if(!t){const r=Yt(Ti,Si,Ai,e);t=(i,n)=>Ea(i,n,r),e[xa]=t}return t}function Ea(e,t,r){(function(i,n,s){const a=512&n?0:-1,c=i.length,l=c+((n=64&n?256&n:!!c&&ai(i[c-1]))?-1:0);for(let u=0;u<l;u++)s(u-a,i[u]);if(n){i=i[c-1];for(const u in i)!isNaN(u)&&s(+u,i[u])}})(e,0|e[k]|(r.T[1]?512:0),(i,n)=>{if(n!=null){var s=function(a,c){var l=a[c];if(l)return l;if((l=a.ga)&&(l=l[c])){var u=(l=va(l))[0].h;if(l=l[1]){const d=_a(l),f=Yt(Ti,Si,Ai,l).T;l=a.la?ba(f,d):(w,m,g)=>u(w,m,g,f,d)}else l=u;return a[c]=l}}(r,i);s&&s(t,n,i)}}),(e=yn(e))&&function(i,n){fr(i,i.g.end());for(let s=0;s<n.length;s++)fr(i,fn(n[s])||new Uint8Array(0))}(t,e)}function mr(e,t){if(Array.isArray(t)){var r=0|t[k];if(4&r)return t;for(var i=0,n=0;i<t.length;i++){const s=e(t[i]);s!=null&&(t[n++]=s)}return n<i&&(t.length=n),ie(t,-6145&(5|r)),2&r&&Object.freeze(t),t}}function ge(e,t,r){return new wr(e,t,r)}function gr(e,t,r){return new wr(e,t,r)}function pe(e,t,r){K(e,0|e[k],t,r)}var $u=ji(function(e,t,r,i,n){return e.h===2&&(e=Gr(e,At([void 0,void 0],i,!0),n),Et(i=0|t[k]),(n=ft(t,i,r))instanceof rt?2&n.M?((n=n.da()).push(e),K(t,i,r,n)):n.Ja(e):Array.isArray(n)?(2&(0|n[k])&&K(t,i,r,n=Qo(n)),n.push(e)):K(t,i,r,[e]),!0)},function(e,t,r,i,n){if(t instanceof rt)t.forEach((s,a)=>{Ei(e,r,At([a,s],i,!1),n)});else if(Array.isArray(t))for(let s=0;s<t.length;s++){const a=t[s];Array.isArray(a)&&Ei(e,r,At(a,i,!1),n)}});function ja(e,t,r){if(t=function(i){if(i==null)return i;const n=typeof i;if(n==="bigint")return String(Rr(64,i));if(Or(i)){if(n==="string")return Go(i);if(n==="number")return jn(i)}}(t),t!=null&&(typeof t=="string"&&ua(t),t!=null))switch(Se(e,r,0),typeof t){case"number":e=e.g,Wt(t),dr(e,U,J);break;case"bigint":r=BigInt.asUintN(64,t),r=new Kn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),dr(e.g,r.h,r.g);break;default:r=ua(t),dr(e.g,r.h,r.g)}}function Ta(e,t,r){(t=or(t))!=null&&t!=null&&(Se(e,r,0),ki(e.g,t))}function Sa(e,t,r){(t=Do(t))!=null&&(Se(e,r,0),e.g.g.push(t?1:0))}function Aa(e,t,r){(t=cr(t))!=null&&_i(e,r,uo(t))}function Ca(e,t,r,i,n){Ei(e,r,ka(t,i),n)}function Na(e,t,r){t==null||typeof t=="string"||t instanceof ht||(Vt(t)?Vt(t)&&mn(jo):t=void 0),t!=null&&_i(e,r,Gn(t).buffer)}function Ia(e,t,r){return(e.h===5||e.h===2)&&(t=ur(t,0|t[k],r,!1),e.h==2?bi(e,$n,t):t.push($n(e.g)),!0)}var xt=ge(function(e,t,r){if(e.h!==1)return!1;var i=e.g;e=Wn(i);const n=Wn(i);i=2*(n>>31)+1;const s=n>>>20&2047;return e=4294967296*(1048575&n)+e,pe(t,r,s==2047?e?NaN:i*(1/0):s==0?5e-324*i*e:i*Math.pow(2,s-1075)*(e+4503599627370496)),!0},function(e,t,r){(t=St(t))!=null&&(Se(e,r,1),e=e.g,(r=Mo||(Mo=new DataView(new ArrayBuffer(8)))).setFloat64(0,+t,!0),U=r.getUint32(0,!0),J=r.getUint32(4,!0),Vr(e,U),Vr(e,J))},Ye()),ne=ge(function(e,t,r){return e.h===5&&(pe(t,r,$n(e.g)),!0)},function(e,t,r){(t=St(t))!=null&&(Se(e,r,5),e=e.g,vn(t),Vr(e,U))},ts),Hu=gr(Ia,function(e,t,r){if((t=mr(St,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&(Se(i,n,5),i=i.g,vn(s),Vr(i,U))}},ts),os=gr(Ia,function(e,t,r){if((t=mr(St,t))!=null&&t.length){Se(e,r,2),hr(e.g,4*t.length);for(let i=0;i<t.length;i++)r=e.g,vn(t[i]),Vr(r,U)}},ts),It=ge(function(e,t,r){return e.h===0&&(pe(t,r,Vn(e.g,_n)),!0)},ja,fa),as=ge(function(e,t,r){return e.h===0&&(pe(t,r,(e=Vn(e.g,_n))===0?void 0:e),!0)},ja,fa),qu=ge(function(e,t,r){return e.h===0&&(pe(t,r,Vn(e.g,kn)),!0)},function(e,t,r){if((t=Su(t))!=null&&(typeof t=="string"&&la(t),t!=null))switch(Se(e,r,0),typeof t){case"number":e=e.g,Wt(t),dr(e,U,J);break;case"bigint":r=BigInt.asUintN(64,t),r=new Yn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),dr(e.g,r.h,r.g);break;default:r=la(t),dr(e.g,r.h,r.g)}},Ye()),Q=ge(function(e,t,r){return e.h===0&&(pe(t,r,Nt(e.g)),!0)},Ta,es),Ci=gr(function(e,t,r){return(e.h===0||e.h===2)&&(t=ur(t,0|t[k],r,!1),e.h==2?bi(e,Nt,t):t.push(Nt(e.g)),!0)},function(e,t,r){if((t=mr(or,t))!=null&&t.length){r=Xn(e,r);for(let i=0;i<t.length;i++)ki(e.g,t[i]);Jn(e,r)}},es),pr=ge(function(e,t,r){return e.h===0&&(pe(t,r,(e=Nt(e.g))===0?void 0:e),!0)},Ta,es),$=ge(function(e,t,r){return e.h===0&&(pe(t,r,zn(e.g)),!0)},Sa,da),xr=ge(function(e,t,r){return e.h===0&&(pe(t,r,(e=zn(e.g))===!1?void 0:e),!0)},Sa,da),fe=gr(function(e,t,r){return e.h===2&&(e=qn(e),ur(t,0|t[k],r,!1).push(e),!0)},function(e,t,r){if((t=mr(cr,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&_i(i,n,uo(s))}},Zn),Mt=ge(function(e,t,r){return e.h===2&&(pe(t,r,(e=qn(e))===""?void 0:e),!0)},Aa,Zn),R=ge(function(e,t,r){return e.h===2&&(pe(t,r,qn(e)),!0)},Aa,Zn),ae=function(e,t,r=Qn){return new wr(e,t,r)}(function(e,t,r,i,n){return e.h===2&&(i=At(void 0,i,!0),ur(t,0|t[k],r,!0).push(i),Gr(e,i,n),!0)},function(e,t,r,i,n){if(Array.isArray(t))for(let s=0;s<t.length;s++)Ca(e,t[s],r,i,n)}),O=ji(function(e,t,r,i,n,s){return e.h===2&&(Zo(t,0|t[k],s,r),Gr(e,t=Bn(t,i,r),n),!0)},Ca),Ma=ge(function(e,t,r){return e.h===2&&(pe(t,r,ca(e)),!0)},Na,wa),Yu=gr(function(e,t,r){return(e.h===0||e.h===2)&&(t=ur(t,0|t[k],r,!1),e.h==2?bi(e,pt,t):t.push(pt(e.g)),!0)},function(e,t,r){if((t=mr(Ro,t))!=null)for(let a=0;a<t.length;a++){var i=e,n=r,s=t[a];s!=null&&(Se(i,n,0),hr(i.g,s))}},ha),Ku=ge(function(e,t,r){return e.h===0&&(pe(t,r,(e=pt(e.g))===0?void 0:e),!0)},function(e,t,r){(t=Ro(t))!=null&&t!=null&&(Se(e,r,0),hr(e.g,t))},ha),Ae=ge(function(e,t,r){return e.h===0&&(pe(t,r,Nt(e.g)),!0)},function(e,t,r){(t=or(t))!=null&&(t=parseInt(t,10),Se(e,r,0),ki(e.g,t))},ma);class Xu{constructor(t,r){this.h=t,this.g=r,this.l=M,this.m=j,this.defaultValue=void 0}register(){ii(this)}}function Ke(e,t){return new Xu(e,t)}function Lt(e,t){return(r,i)=>{if(vi.length){const s=vi.pop();s.o(i),Hn(s.g,r,i),r=s}else r=new class{constructor(s,a){if(oa.length){const c=oa.pop();Hn(c,s,a),s=c}else s=new class{constructor(c,l){this.h=null,this.m=!1,this.g=this.l=this.j=0,Hn(this,c,l)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.aa=!1}}(s,a);this.g=s,this.l=this.g.g,this.h=this.m=-1,this.o(a)}o({fa:s=!1}={}){this.fa=s}}(r,i);try{const s=new e,a=s.u;ss(t)(a,r);var n=s}finally{r.g.clear(),r.m=-1,r.h=-1,vi.length<100&&vi.push(r)}return n}}function Ni(e){return function(){const t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const a=this.g;return this.g=[],a}}}};Ea(this.u,t,Yt(Ti,Si,Ai,e)),fr(t,t.g.end());const r=new Uint8Array(t.h),i=t.l,n=i.length;let s=0;for(let a=0;a<n;a++){const c=i[a];r.set(c,s),s+=c.length}return t.l=[r],r}}var La=class extends y{constructor(e){super(e)}},Fa=[0,Mt,ge(function(e,t,r){return e.h===2&&(pe(t,r,(e=ca(e))===zt()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof y){const i=t.Oa;return void(i&&(t=i(t),t!=null&&_i(e,r,Gn(t).buffer)))}if(Array.isArray(t))return}Na(e,t,r)},wa)];let cs,Pa=globalThis.trustedTypes;function Da(e){cs===void 0&&(cs=function(){let r=null;if(!Pa)return r;try{const i=n=>n;r=Pa.createPolicy("goog#html",{createHTML:i,createScript:i,createScriptURL:i})}catch{}return r}());var t=cs;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function Ju(e,...t){if(t.length===0)return Da(e[0]);let r=e[0];for(let i=0;i<t.length;i++)r+=encodeURIComponent(t[i])+e[i+1];return Da(r)}var Ra=[0,Q,Ae,$,-1,Ci,Ae,-1],Qu=class extends y{constructor(e){super(e)}},Oa=[0,$,R,$,Ae,-1,gr(function(e,t,r){return(e.h===0||e.h===2)&&(t=ur(t,0|t[k],r,!1),e.h==2?bi(e,Bu,t):t.push(Nt(e.g)),!0)},function(e,t,r){if((t=mr(or,t))!=null&&t.length){r=Xn(e,r);for(let i=0;i<t.length;i++)ki(e.g,t[i]);Jn(e,r)}},ma),R,-1,[0,$,-1],Ae,$,-1],Ba=[0,R,-2],Ua=class extends y{constructor(e){super(e)}},Ga=[0],Va=[0,Q,$,1,$,-3],Ce=class extends y{constructor(e){super(e,2)}},se={};se[336783863]=[0,R,$,-1,Q,[0,[1,2,3,4,5,6,7,8,9],O,Ga,O,Oa,O,Ba,O,Va,O,Ra,O,[0,R,-2],O,[0,R,Ae],O,[0,Ae,R,-1],O,[0,Ae,-1]],[0,R],$,[0,[1,3],[2,4],O,[0,Ci],-1,O,[0,fe],-1,ae,[0,R,-1]],R];var za=[0,as,-1,xr,-3,as,Ci,Mt,pr,as,-1,xr,pr,xr,-2,Mt];function Ne(e,t){Pn(e,2,ar(t),"")}function z(e,t){gi(e,3,t)}function I(e,t){gi(e,4,t)}var xe=class extends y{constructor(e){super(e,500)}o(e){return j(this,0,7,e)}},zr=[-1,{}],Wa=[0,R,1,zr],$a=[0,R,fe,zr];function Ie(e,t){pi(e,1,xe,t)}function W(e,t){gi(e,10,t)}function F(e,t){gi(e,15,t)}var be=class extends y{constructor(e){super(e,500)}o(e){return j(this,0,1001,e)}},Ha=[-500,ae,[-500,Mt,-1,fe,-3,[-2,se,$],ae,Fa,pr,-1,Wa,$a,ae,[0,Mt,xr],Mt,za,pr,fe,987,fe],4,ae,[-500,R,-1,[-1,{}],998,R],ae,[-500,R,fe,-1,[-2,{},$],997,fe,-1],pr,ae,[-500,R,fe,zr,998,fe],fe,pr,Wa,$a,ae,[0,Mt,-1,zr],fe,-2,za,Mt,-1,xr,[0,xr,Ku],978,zr,ae,Fa];be.prototype.g=Ni(Ha);var Zu=Lt(be,Ha),ed=class extends y{constructor(e){super(e)}},qa=class extends y{constructor(e){super(e)}g(){return mt(this,ed,1)}},Ya=[0,ae,[0,Q,ne,R,-1]],Ii=Lt(qa,Ya),td=class extends y{constructor(e){super(e)}},rd=class extends y{constructor(e){super(e)}},ls=class extends y{constructor(e){super(e)}h(){return M(this,td,2)}g(){return mt(this,rd,5)}},Ka=Lt(class extends y{constructor(e){super(e)}},[0,fe,Ci,os,[0,Ae,[0,Q,-3],[0,ne,-3],[0,Q,-1,[0,ae,[0,Q,-2]]],ae,[0,ne,-1,R,ne]],R,-1,It,ae,[0,Q,ne],fe,It]),Xa=class extends y{constructor(e){super(e)}},yr=Lt(class extends y{constructor(e){super(e)}},[0,ae,[0,ne,-4]]),Ja=class extends y{constructor(e){super(e)}},Wr=Lt(class extends y{constructor(e){super(e)}},[0,ae,[0,ne,-4]]),id=class extends y{constructor(e){super(e)}},nd=[0,Q,-1,os,Ae],Qa=class extends y{constructor(e){super(e)}};Qa.prototype.g=Ni([0,ne,-4,It]);var sd=class extends y{constructor(e){super(e)}},od=Lt(class extends y{constructor(e){super(e)}},[0,ae,[0,1,Q,R,Ya],It]),Za=class extends y{constructor(e){super(e)}},ad=class extends y{constructor(e){super(e)}ma(){const e=Jo(this);return e??zt()}},cd=class extends y{constructor(e){super(e)}},ec=[1,2],ld=Lt(class extends y{constructor(e){super(e)}},[0,ae,[0,ec,O,[0,os],O,[0,Ma],Q,R],It]),us=class extends y{constructor(e){super(e)}},tc=[0,R,Q,ne,fe,-1],rc=class extends y{constructor(e){super(e)}},ud=[0,$,-1],ic=class extends y{constructor(e){super(e)}},Mi=[1,2,3,4,5],Li=class extends y{constructor(e){super(e)}g(){return Jo(this)!=null}h(){return Be(this,2)!=null}},H=class extends y{constructor(e){super(e)}g(){return Do(lr(this,2))??!1}},nc=[0,Ma,R,[0,Q,It,-1],[0,qu,It]],te=[0,nc,$,[0,Mi,O,Va,O,Oa,O,Ra,O,Ga,O,Ba],Ae],Fi=class extends y{constructor(e){super(e)}},ds=[0,te,ne,-1,Q],dd=Ke(502141897,Fi);se[502141897]=ds;var hd=Lt(class extends y{constructor(e){super(e)}},[0,[0,Ae,-1,Hu,Yu],nd]),sc=class extends y{constructor(e){super(e)}},oc=class extends y{constructor(e){super(e)}},hs=[0,te,ne,[0,te],$],ac=[0,te,ds,hs,ne,[0,[0,nc]]],fd=Ke(508968150,oc);se[508968150]=ac,se[508968149]=hs;var cc=class extends y{constructor(e){super(e)}},wd=Ke(513916220,cc);se[513916220]=[0,te,ac,Q];var br=class extends y{constructor(e){super(e)}h(){return M(this,us,2)}g(){V(this,2)}},lc=[0,te,tc];se[478825465]=lc;var md=class extends y{constructor(e){super(e)}},uc=class extends y{constructor(e){super(e)}},fs=class extends y{constructor(e){super(e)}},ws=class extends y{constructor(e){super(e)}},dc=class extends y{constructor(e){super(e)}},hc=[0,te,[0,te],lc,-1],fc=[0,te,ne,Q],ms=[0,te,ne],wc=[0,te,fc,ms,ne],gd=Ke(479097054,dc);se[479097054]=[0,te,wc,hc],se[463370452]=hc,se[464864288]=fc;var pd=Ke(462713202,ws);se[462713202]=wc,se[474472470]=ms;var xd=class extends y{constructor(e){super(e)}},mc=class extends y{constructor(e){super(e)}},gc=class extends y{constructor(e){super(e)}},pc=class extends y{constructor(e){super(e)}},gs=[0,te,ne,-1,Q],ps=[0,te,ne,$];pc.prototype.g=Ni([0,te,ms,[0,te],ds,hs,gs,ps]);var xc=class extends y{constructor(e){super(e)}},yd=Ke(456383383,xc);se[456383383]=[0,te,tc];var yc=class extends y{constructor(e){super(e)}},bd=Ke(476348187,yc);se[476348187]=[0,te,ud];var bc=class extends y{constructor(e){super(e)}},vc=class extends y{constructor(e){super(e)}},kc=[0,Ae,-1],vd=Ke(458105876,class extends y{constructor(e){super(e)}g(){var e=this.u;const t=0|e[k],r=2&t;return e=function(i,n,s){var a=vc;const c=2&n;let l=!1;if(s==null){if(c)return Yo();s=[]}else if(s.constructor===rt){if(!(2&s.M)||c)return s;s=s.da()}else Array.isArray(s)?l=!!(2&(0|s[k])):s=[];if(c){if(!s.length)return Yo();l||(l=!0,nr(s))}else l&&(l=!1,s=Qo(s));return l||(64&(0|s[k])?s[k]&=-33:32&n&&si(s,32)),K(i,n,2,a=new rt(s,a,Au,void 0)),a}(e,t,ft(e,t,2)),!r&&vc&&(e.pa=!0),e}});se[458105876]=[0,kc,$u,[!0,It,[0,R,-1,fe]]];var xs=class extends y{constructor(e){super(e)}},_c=Ke(458105758,xs);se[458105758]=[0,te,R,kc];var Ec=class extends y{constructor(e){super(e)}},kd=Ke(443442058,Ec);se[443442058]=[0,te,R,Q,ne,fe,-1,$,ne],se[514774813]=gs;var jc=class extends y{constructor(e){super(e)}},_d=Ke(516587230,jc);function ys(e,t){return t=t?t.clone():new us,e.displayNamesLocale!==void 0?V(t,1,ar(e.displayNamesLocale)):e.displayNamesLocale===void 0&&V(t,1),e.maxResults!==void 0?it(t,2,e.maxResults):"maxResults"in e&&V(t,2),e.scoreThreshold!==void 0?b(t,3,e.scoreThreshold):"scoreThreshold"in e&&V(t,3),e.categoryAllowlist!==void 0?xi(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&V(t,4),e.categoryDenylist!==void 0?xi(t,5,e.categoryDenylist):"categoryDenylist"in e&&V(t,5),t}function bs(e,t=-1,r=""){return{categories:e.map(i=>({index:Oe(i,1)??0??-1,score:ee(i,2)??0,categoryName:Be(i,3)??""??"",displayName:Be(i,4)??""??""})),headIndex:t,headName:r}}function Tc(e){var a,c;var t=Ht(e,3,St,$t()),r=Ht(e,2,or,$t()),i=Ht(e,1,cr,$t()),n=Ht(e,9,cr,$t());const s={categories:[],keypoints:[]};for(let l=0;l<t.length;l++)s.categories.push({score:t[l],index:r[l]??-1,categoryName:i[l]??"",displayName:n[l]??""});if((t=(a=M(e,ls,4))==null?void 0:a.h())&&(s.boundingBox={originX:Oe(t,1)??0,originY:Oe(t,2)??0,width:Oe(t,3)??0,height:Oe(t,4)??0,angle:0}),(c=M(e,ls,4))==null?void 0:c.g().length)for(const l of M(e,ls,4).g())s.keypoints.push({x:mi(l,1)??0,y:mi(l,2)??0,score:mi(l,4)??0,label:Be(l,3)??""});return s}function Pi(e){const t=[];for(const r of mt(e,Ja,1))t.push({x:ee(r,1)??0,y:ee(r,2)??0,z:ee(r,3)??0,visibility:ee(r,4)??0});return t}function $r(e){const t=[];for(const r of mt(e,Xa,1))t.push({x:ee(r,1)??0,y:ee(r,2)??0,z:ee(r,3)??0,visibility:ee(r,4)??0});return t}function Sc(e){return Array.from(e,t=>t>127?t-256:t)}function Ac(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,i=0,n=0;for(let s=0;s<e.length;s++)r+=e[s]*t[s],i+=e[s]*e[s],n+=t[s]*t[s];if(i<=0||n<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(i*n)}let Di;se[516587230]=[0,te,gs,ps,ne],se[518928384]=ps;const Ed=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Cc(){if(Di===void 0)try{await WebAssembly.instantiate(Ed),Di=!0}catch{Di=!1}return Di}async function Hr(e,t=Ju``){const r=await Cc()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Kt=class{};function Nc(){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 Ic(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,i)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",n=>{i(n)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function Mc(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 Lc(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]=Mc(t);return!e.l||i===e.i.canvas.width&&n===e.i.canvas.height||(e.i.canvas.width=i,e.i.canvas.height=n),[i,n]}function Fc(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const i=new Uint32Array(t.length);for(let n=0;n<t.length;n++)i[n]=e.i.stringToNewUTF8(t[n]);t=e.i._malloc(4*i.length),e.i.HEAPU32.set(i,t>>2),r(t);for(const n of i)e.i._free(n);e.i._free(t)}function nt(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function Ft(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)}}Kt.forVisionTasks=function(e){return Hr("vision",e)},Kt.forTextTasks=function(e){return Hr("text",e)},Kt.forGenAiExperimentalTasks=function(e){return Hr("genai_experimental",e)},Kt.forGenAiTasks=function(e){return Hr("genai",e)},Kt.forAudioTasks=function(e){return Hr("audio",e)},Kt.isSimdSupported=function(){return Cc()};async function jd(e,t,r,i){return e=await(async(n,s,a,c,l)=>{if(s&&await Ic(s),!self.ModuleFactory||a&&(await Ic(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 vs(e,t){const r=M(e.baseOptions,Li,1)||new Li;typeof t=="string"?(V(r,2,ar(t)),V(r,1)):t instanceof Uint8Array&&(V(r,1,xn(t,!1)),V(r,2)),j(e.baseOptions,0,1,r)}function Pc(e){try{const t=e.G.length;if(t===1)throw Error(e.G[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.G.map(r=>r.message).join(", "))}finally{e.G=[]}}function x(e,t){e.B=Math.max(e.B,t)}function Ri(e,t){e.A=new xe,Ne(e.A,"PassThroughCalculator"),z(e.A,"free_memory"),I(e.A,"free_memory_unused_out"),W(t,"free_memory"),Ie(t,e.A)}function vr(e,t){z(e.A,t),I(e.A,t+"_unused_out")}function Oi(e){e.g.addBoolToStream(!0,"free_memory",e.B)}var ks=class{constructor(e){this.g=e,this.G=[],this.B=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var r,i,n,s,a,c;if(t){const l=e.baseOptions||{};if((r=e.baseOptions)!=null&&r.modelAssetBuffer&&((i=e.baseOptions)!=null&&i.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((n=M(this.baseOptions,Li,1))!=null&&n.g()||(s=M(this.baseOptions,Li,1))!=null&&s.h()||(a=e.baseOptions)!=null&&a.modelAssetBuffer||(c=e.baseOptions)!=null&&c.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(u,d){let f=M(u.baseOptions,ic,3);if(!f){var w=f=new ic,m=new Ua;Br(w,4,Mi,m)}"delegate"in d&&(d.delegate==="GPU"?(d=f,w=new Qu,Br(d,2,Mi,w)):(d=f,w=new Ua,Br(d,4,Mi,w))),j(u.baseOptions,0,3,f)}(this,l),l.modelAssetPath)return fetch(l.modelAssetPath.toString()).then(u=>{if(u.ok)return u.arrayBuffer();throw Error(`Failed to fetch model: ${l.modelAssetPath} (${u.status})`)}).then(u=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(u),!0,!1,!1),vs(this,"/model.dat"),this.m(),this.J()});if(l.modelAssetBuffer instanceof Uint8Array)vs(this,l.modelAssetBuffer);else if(l.modelAssetBuffer)return async function(u){const d=[];for(var f=0;;){const{done:w,value:m}=await u.read();if(w)break;d.push(m),f+=m.length}if(d.length===0)return new Uint8Array(0);if(d.length===1)return d[0];u=new Uint8Array(f),f=0;for(const w of d)u.set(w,f),f+=w.length;return u}(l.modelAssetBuffer).then(u=>{vs(this,u),this.m(),this.J()})}return this.m(),this.J(),Promise.resolve()}J(){}ca(){let e;if(this.g.ca(t=>{e=Zu(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,i)=>{this.G.push(Error(i))}),this.g.Ha(),this.g.setGraph(e,t),this.A=void 0,Pc(this)}finishProcessing(){this.g.finishProcessing(),Pc(this)}close(){this.A=void 0,this.g.closeGraph()}};function yt(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}ks.prototype.close=ks.prototype.close;class Td{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 Dc(e,t,r){const i=e.g;if(r=yt(i.createShader(r),"Failed to create WebGL shader"),i.shaderSource(r,t),i.compileShader(r),!i.getShaderParameter(r,i.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${i.getShaderInfoLog(r)}`);return i.attachShader(e.h,r),r}function Rc(e,t){const r=e.g,i=yt(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(i);const n=yt(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,n),r.enableVertexAttribArray(e.P),r.vertexAttribPointer(e.P,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);const s=yt(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.J),r.vertexAttribPointer(e.J,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,null),r.bindVertexArray(null),new Td(r,i,n,s)}function _s(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Es(e,t,r,i){return _s(e,t),e.h||(e.m(),e.C()),r?(e.s||(e.s=Rc(e,!0)),r=e.s):(e.v||(e.v=Rc(e,!1)),r=e.v),t.useProgram(e.h),r.bind(),e.l(),e=i(),r.g.bindVertexArray(null),e}function Bi(e,t,r){return _s(e,t),e=yt(t.createTexture(),"Failed to create texture"),t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,r??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function Ui(e,t,r){_s(e,t),e.A||(e.A=yt(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.A),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function js(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Ts=class{G(){return`
10
10
  precision mediump float;
11
11
  varying vec2 vTex;
12
12
  uniform sampler2D inputTexture;
@@ -20,7 +20,7 @@
20
20
  void main(void) {
21
21
  gl_Position = vec4(aVertex, 0.0, 1.0);
22
22
  vTex = aTex;
23
- }`,e.VERTEX_SHADER),this.Y=Dc(this,this.G(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.P=e.getAttribLocation(this.h,"aVertex"),this.J=e.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.Z),e.deleteShader(this.Y)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}};function bt(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 Ss(e){var t=bt(e,1);if(!t){if(t=bt(e,0))t=new Float32Array(t).map(i=>i/255);else{t=new Float32Array(e.width*e.height);const i=kr(e);var r=As(e);if(Ui(r,i,Oc(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 Oc(e){let t=bt(e,2);if(!t){const r=kr(e);t=Uc(e);const i=Ss(e),n=Bc(e);r.texImage2D(r.TEXTURE_2D,0,n,e.width,e.height,0,r.RED,r.FLOAT,i),Cs(e)}return t}function kr(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=yt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Bc(e){if(e=kr(e),!Gi)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Gi=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Gi=e.R16F}return Gi}function As(e){return e.l||(e.l=new Ts),e.l}function Uc(e){const t=kr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=bt(e,2);return r||(r=Bi(As(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Cs(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Gi,ce=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&&--Gc===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Da(){return!!bt(this,0)}ja(){return!!bt(this,1)}R(){return!!bt(this,2)}ia(){return(t=bt(e=this,0))||(t=Ss(e),t=new Uint8Array(t.map(r=>255*r)),e.g.push(t)),t;var e,t}ha(){return Ss(this)}N(){return Oc(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{const i=kr(this),n=As(this);i.activeTexture(i.TEXTURE1),r=Bi(n,i,this.m?i.LINEAR:i.NEAREST),i.bindTexture(i.TEXTURE_2D,r);const s=Bc(this);i.texImage2D(i.TEXTURE_2D,0,s,this.width,this.height,0,i.RED,i.FLOAT,null),i.bindTexture(i.TEXTURE_2D,null),Ui(n,i,r),Es(n,i,!1,()=>{Uc(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),Cs(this)}),js(n),Cs(this)}}e.push(r)}return new ce(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&kr(this).deleteTexture(bt(this,2)),Gc=-1}};ce.prototype.close=ce.prototype.close,ce.prototype.clone=ce.prototype.clone,ce.prototype.getAsWebGLTexture=ce.prototype.N,ce.prototype.getAsFloat32Array=ce.prototype.ha,ce.prototype.getAsUint8Array=ce.prototype.ia,ce.prototype.hasWebGLTexture=ce.prototype.R,ce.prototype.hasFloat32Array=ce.prototype.ja,ce.prototype.hasUint8Array=ce.prototype.Da;var Gc=250;function st(e,t){switch(t){case 0:return e.g.find(r=>r instanceof ImageData);case 1:return e.g.find(r=>typeof ImageBitmap<"u"&&r instanceof ImageBitmap);case 2:return e.g.find(r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function Vc(e){var t=st(e,0);if(!t){t=_r(e);const r=zi(e),i=new Uint8Array(e.width*e.height*4);Ui(r,t,Vi(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,i),js(r),t=new ImageData(new Uint8ClampedArray(i.buffer),e.width,e.height),e.g.push(t)}return t}function Vi(e){let t=st(e,2);if(!t){const r=_r(e);t=Wi(e);const i=st(e,1)||Vc(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,i),qr(e)}return t}function _r(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=yt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function zi(e){return e.l||(e.l=new Ts),e.l}function Wi(e){const t=_r(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=st(e,2);return r||(r=Bi(zi(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function qr(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function zc(e){const t=_r(e);return Es(zi(e),t,!0,()=>function(r,i){const n=r.canvas;if(n.width===r.width&&n.height===r.height)return i();const s=n.width,a=n.height;return n.width=r.width,n.height=r.height,r=i(),n.width=s,n.height=a,r}(e,()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))}var le=class{constructor(e,t,r,i,n,s,a){this.g=e,this.j=t,this.m=r,this.canvas=i,this.l=n,this.width=s,this.height=a,(this.j||this.m)&&--Wc===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ca(){return!!st(this,0)}ka(){return!!st(this,1)}R(){return!!st(this,2)}Aa(){return Vc(this)}za(){var e=st(this,1);return e||(Vi(this),Wi(this),e=zc(this),qr(this),this.g.push(e),this.j=!0),e}N(){return Vi(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const i=_r(this),n=zi(this);i.activeTexture(i.TEXTURE1),r=Bi(n,i),i.bindTexture(i.TEXTURE_2D,r),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.width,this.height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.bindTexture(i.TEXTURE_2D,null),Ui(n,i,r),Es(n,i,!1,()=>{Wi(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),qr(this)}),js(n),qr(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Vi(this),Wi(this),r=zc(this),qr(this)}e.push(r)}return new le(e,this.ka(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&st(this,1).close(),this.m&&_r(this).deleteTexture(st(this,2)),Wc=-1}};le.prototype.close=le.prototype.close,le.prototype.clone=le.prototype.clone,le.prototype.getAsWebGLTexture=le.prototype.N,le.prototype.getAsImageBitmap=le.prototype.za,le.prototype.getAsImageData=le.prototype.Aa,le.prototype.hasWebGLTexture=le.prototype.R,le.prototype.hasImageBitmap=le.prototype.ka,le.prototype.hasImageData=le.prototype.Ca;var Wc=250;function Xe(...e){return e.map(([t,r])=>({start:t,end:r}))}const Sd=function(e){return class extends e{Ha(){this.i._registerModelResourcesGraphService()}}}(($c=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",t!==void 0?this.i.canvas=t:Nc()?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){nt(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]=Lc(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=>{Fc(this,Object.keys(e),n=>{Fc(this,Object.values(e),s=>{this.i._addFlatHashMapToInputStream(n,s,Object.keys(e).length,i,r)})})})}addProtoToStream(e,t,r,i){_(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){nt(this,e,t),_(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){Ft(this,e,t),_(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){nt(this,e,t),_(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){Ft(this,e,t),_(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){nt(this,e,t),_(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){Ft(this,e,t),_(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){nt(this,e,t),_(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){Ft(this,e,t),_(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){nt(this,e,t),_(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){Ft(this,e,t),_(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){nt(this,e,t),_(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){Ft(this,e,t),_(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){nt(this,e,t),_(this,e,i=>{this.i._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){Ft(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?'),nt(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 $c{get ea(){return this.i}oa(e,t,r){_(this,t,i=>{const[n,s]=Lc(this,e,i);this.ea._addBoundTextureAsImageToStream(i,n,s,r)})}V(e,t){nt(this,e,t),_(this,e,r=>{this.ea._attachImageListener(r)})}ba(e,t){Ft(this,e,t),_(this,e,r=>{this.ea._attachImageVectorListener(r)})}}));var $c,Ue=class extends Sd{};async function N(e,t,r){return async function(i,n,s,a){return jd(i,n,s,a)}(e,r.canvas??(Nc()?void 0:document.createElement("canvas")),t,r)}function Hc(e,t,r,i){if(e.U){const s=new Qa;if(r!=null&&r.regionOfInterest){if(!e.na)throw Error("This task doesn't support region-of-interest.");var n=r.regionOfInterest;if(n.left>=n.right||n.top>=n.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(n.left<0||n.top<0||n.right>1||n.bottom>1)throw Error("Expected RectF values to be in [0,1].");b(s,1,(n.left+n.right)/2),b(s,2,(n.top+n.bottom)/2),b(s,4,n.right-n.left),b(s,3,n.bottom-n.top)}else b(s,1,.5),b(s,2,.5),b(s,4,1),b(s,3,1);if(r!=null&&r.rotationDegrees){if((r==null?void 0:r.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(b(s,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[a,c]=Mc(t);r=ee(s,3)*c/a,n=ee(s,4)*a/c,b(s,4,r),b(s,3,n)}}e.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",e.U,i)}e.g.oa(t,e.Z,i??performance.now()),e.finishProcessing()}function Ge(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'.");Hc(e,t,r,e.B+1)}function ot(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'.");Hc(e,t,r,i)}function Er(e,t,r,i){var n=t.data;const s=t.width,a=s*(t=t.height);if((n instanceof Uint8Array||n instanceof Float32Array)&&n.length!==a)throw Error("Unsupported channel count: "+n.length/a);return e=new ce([n],r,!1,e.g.i.canvas,e.P,s,t),i?e.clone():e}var ve=class extends ks{constructor(e,t,r,i){super(e),this.g=e,this.Z=t,this.U=r,this.na=i,this.P=new Ts}l(e,t=!0){if("runningMode"in e&&Ur(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.P.close(),super.close()}};ve.prototype.close=ve.prototype.close;var Ve=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},j(e=this.h=new Fi,0,1,t=new q),b(this.h,2,.5),b(this.h,3,.3)}get baseOptions(){return M(this.h,q,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&b(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&b(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}D(e,t){return this.j={detections:[]},Ge(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},ot(this,e,r,t),this.j}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect_in"),F(e,"detections");const t=new Ce;qe(t,dd,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect_in"),I(r,"DETECTIONS:detections"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Ka(s),this.j.detections.push(Tc(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ve.prototype.detectForVideo=Ve.prototype.F,Ve.prototype.detect=Ve.prototype.D,Ve.prototype.setOptions=Ve.prototype.o,Ve.createFromModelPath=async function(e,t){return N(Ve,e,{baseOptions:{modelAssetPath:t}})},Ve.createFromModelBuffer=function(e,t){return N(Ve,e,{baseOptions:{modelAssetBuffer:t}})},Ve.createFromOptions=function(e,t){return N(Ve,e,t)};var Ns=Xe([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]),Is=Xe([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]),Ms=Xe([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),qc=Xe([474,475],[475,476],[476,477],[477,474]),Ls=Xe([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]),Fs=Xe([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Yc=Xe([469,470],[470,471],[471,472],[472,469]),Ps=Xe([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]),Kc=[...Ns,...Is,...Ms,...Ls,...Fs,...Ps],Xc=Xe([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 Jc(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var X=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,j(e=this.h=new oc,0,1,t=new q),this.v=new sc,j(this.h,0,3,this.v),this.s=new Fi,j(this.h,0,2,this.s),it(this.s,4,1),b(this.s,2,.5),b(this.v,2,.5),b(this.h,4,.5)}get baseOptions(){return M(this.h,q,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"numFaces"in e&&it(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&b(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&b(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&b(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}D(e,t){return Jc(this),Ge(this,e,t),this.j}F(e,t,r){return Jc(this),ot(this,e,r,t),this.j}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect"),F(e,"face_landmarks");const t=new Ce;qe(t,fd,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),I(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("face_landmarks",(i,n)=>{for(const s of i)i=Wr(s),this.j.faceLandmarks.push(Pi(i));x(this,n)}),this.g.attachEmptyPacketListener("face_landmarks",i=>{x(this,i)}),this.outputFaceBlendshapes&&(F(e,"blendshapes"),I(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(i,n)=>{if(this.outputFaceBlendshapes)for(const s of i)i=Ii(s),this.j.faceBlendshapes.push(bs(i.g()??[]));x(this,n)}),this.g.attachEmptyPacketListener("blendshapes",i=>{x(this,i)})),this.outputFacialTransformationMatrixes&&(F(e,"face_geometry"),I(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(i,n)=>{if(this.outputFacialTransformationMatrixes)for(const s of i)(i=M(hd(s),id,2))&&this.j.facialTransformationMatrixes.push({rows:Oe(i,1)??0??0,columns:Oe(i,2)??0??0,data:Ht(i,3,St,$t()).slice()??[]});x(this,n)}),this.g.attachEmptyPacketListener("face_geometry",i=>{x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};X.prototype.detectForVideo=X.prototype.F,X.prototype.detect=X.prototype.D,X.prototype.setOptions=X.prototype.o,X.createFromModelPath=function(e,t){return N(X,e,{baseOptions:{modelAssetPath:t}})},X.createFromModelBuffer=function(e,t){return N(X,e,{baseOptions:{modelAssetBuffer:t}})},X.createFromOptions=function(e,t){return N(X,e,t)},X.FACE_LANDMARKS_LIPS=Ns,X.FACE_LANDMARKS_LEFT_EYE=Is,X.FACE_LANDMARKS_LEFT_EYEBROW=Ms,X.FACE_LANDMARKS_LEFT_IRIS=qc,X.FACE_LANDMARKS_RIGHT_EYE=Ls,X.FACE_LANDMARKS_RIGHT_EYEBROW=Fs,X.FACE_LANDMARKS_RIGHT_IRIS=Yc,X.FACE_LANDMARKS_FACE_OVAL=Ps,X.FACE_LANDMARKS_CONTOURS=Kc,X.FACE_LANDMARKS_TESSELATION=Xc;var at=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!0),j(e=this.j=new cc,0,1,t=new q)}get baseOptions(){return M(this.j,q,1)}set baseOptions(e){j(this.j,0,1,e)}o(e){return super.l(e)}Ka(e,t,r){const i=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,Ge(this,e,i??{}),!this.h)return this.s}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect"),F(e,"stylized_image");const t=new Ce;qe(t,wd,this.j);const r=new xe;Ne(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),I(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),Ie(e,r),this.g.V("stylized_image",(i,n)=>{var s=!this.h,a=i.data,c=i.width;const l=c*(i=i.height);if(a instanceof Uint8Array)if(a.length===3*l){const u=new Uint8ClampedArray(4*l);for(let d=0;d<l;++d)u[4*d]=a[3*d],u[4*d+1]=a[3*d+1],u[4*d+2]=a[3*d+2],u[4*d+3]=255;a=new ImageData(u,c,i)}else{if(a.length!==4*l)throw Error("Unsupported channel count: "+a.length/l);a=new ImageData(new Uint8ClampedArray(a.buffer,a.byteOffset,a.length),c,i)}else if(!(a instanceof WebGLTexture))throw Error(`Unsupported format: ${a.constructor.name}`);c=new le([a],!1,!1,this.g.i.canvas,this.P,c,i),this.s=s=s?c.clone():c,this.h&&this.h(s),x(this,n)}),this.g.attachEmptyPacketListener("stylized_image",i=>{this.s=null,this.h&&this.h(null),x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};at.prototype.stylize=at.prototype.Ka,at.prototype.setOptions=at.prototype.o,at.createFromModelPath=function(e,t){return N(at,e,{baseOptions:{modelAssetPath:t}})},at.createFromModelBuffer=function(e,t){return N(at,e,{baseOptions:{modelAssetBuffer:t}})},at.createFromOptions=function(e,t){return N(at,e,t)};var Ds=Xe([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 Qc(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 el(e,t=!0){const r=[];for(const n of e){var i=Ii(n);e=[];for(const s of i.g())i=t&&Oe(s,1)!=null?Oe(s,1)??0:-1,e.push({score:ee(s,2)??0,index:i,categoryName:Be(s,3)??""??"",displayName:Be(s,4)??""??""});r.push(e)}return r}var Me=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],j(e=this.j=new dc,0,1,t=new q),this.s=new ws,j(this.j,0,2,this.s),this.C=new fs,j(this.s,0,3,this.C),this.v=new uc,j(this.s,0,2,this.v),this.h=new md,j(this.j,0,3,this.h),b(this.v,2,.5),b(this.s,4,.5),b(this.C,2,.5)}get baseOptions(){return M(this.j,q,1)}set baseOptions(e){j(this.j,0,1,e)}o(e){var n,s,a,c;if(it(this.v,3,e.numHands??1),"minHandDetectionConfidence"in e&&b(this.v,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&b(this.s,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&b(this.C,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new br,r=t,i=ys(e.cannedGesturesClassifierOptions,(n=M(this.h,br,3))==null?void 0:n.h());j(r,0,2,i),j(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((s=M(this.h,br,3))==null||s.g());return e.customGesturesClassifierOptions?(j(r=t=new br,0,2,i=ys(e.customGesturesClassifierOptions,(a=M(this.h,br,4))==null?void 0:a.h())),j(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((c=M(this.h,br,4))==null||c.g()),this.l(e)}Fa(e,t){return Qc(this),Ge(this,e,t),Zc(this)}Ga(e,t,r){return Qc(this),ot(this,e,r,t),Zc(this)}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect"),F(e,"hand_gestures"),F(e,"hand_landmarks"),F(e,"world_hand_landmarks"),F(e,"handedness");const t=new Ce;qe(t,gd,this.j);const r=new xe;Ne(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),I(r,"HAND_GESTURES:hand_gestures"),I(r,"LANDMARKS:hand_landmarks"),I(r,"WORLD_LANDMARKS:world_hand_landmarks"),I(r,"HANDEDNESS:handedness"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i){i=Wr(s);const a=[];for(const c of mt(i,Ja,1))a.push({x:ee(c,1)??0,y:ee(c,2)??0,z:ee(c,3)??0,visibility:ee(c,4)??0});this.landmarks.push(a)}x(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i){i=yr(s);const a=[];for(const c of mt(i,Xa,1))a.push({x:ee(c,1)??0,y:ee(c,2)??0,z:ee(c,3)??0,visibility:ee(c,4)??0});this.worldLandmarks.push(a)}x(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("hand_gestures",(i,n)=>{this.gestures.push(...el(i,!1)),x(this,n)}),this.g.attachEmptyPacketListener("hand_gestures",i=>{x(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{this.handedness.push(...el(i)),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function tl(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Me.prototype.recognizeForVideo=Me.prototype.Ga,Me.prototype.recognize=Me.prototype.Fa,Me.prototype.setOptions=Me.prototype.o,Me.createFromModelPath=function(e,t){return N(Me,e,{baseOptions:{modelAssetPath:t}})},Me.createFromModelBuffer=function(e,t){return N(Me,e,{baseOptions:{modelAssetBuffer:t}})},Me.createFromOptions=function(e,t){return N(Me,e,t)},Me.HAND_CONNECTIONS=Ds;var Le=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],j(e=this.h=new ws,0,1,t=new q),this.s=new fs,j(this.h,0,3,this.s),this.j=new uc,j(this.h,0,2,this.j),it(this.j,3,1),b(this.j,2,.5),b(this.s,2,.5),b(this.h,4,.5)}get baseOptions(){return M(this.h,q,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"numHands"in e&&it(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&b(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&b(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&b(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ge(this,e,t),tl(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ot(this,e,r,t),tl(this)}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect"),F(e,"hand_landmarks"),F(e,"world_hand_landmarks"),F(e,"handedness");const t=new Ce;qe(t,pd,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),I(r,"LANDMARKS:hand_landmarks"),I(r,"WORLD_LANDMARKS:world_hand_landmarks"),I(r,"HANDEDNESS:handedness"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i)i=Wr(s),this.landmarks.push(Pi(i));x(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i)i=yr(s),this.worldLandmarks.push($r(i));x(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{var s=this.handedness,a=s.push;const c=[];for(const l of i){i=Ii(l);const u=[];for(const d of i.g())u.push({score:ee(d,2)??0,index:Oe(d,1)??0??-1,categoryName:Be(d,3)??""??"",displayName:Be(d,4)??""??""});c.push(u)}a.call(s,...c),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Le.prototype.detectForVideo=Le.prototype.F,Le.prototype.detect=Le.prototype.D,Le.prototype.setOptions=Le.prototype.o,Le.createFromModelPath=function(e,t){return N(Le,e,{baseOptions:{modelAssetPath:t}})},Le.createFromModelBuffer=function(e,t){return N(Le,e,{baseOptions:{modelAssetBuffer:t}})},Le.createFromOptions=function(e,t){return N(Le,e,t)},Le.HAND_CONNECTIONS=Ds;var rl=Xe([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 il(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function nl(e){try{if(!e.C)return e.h;e.C(e.h)}finally{Oi(e)}}function $i(e,t){e=Wr(e),t.push(Pi(e))}var Y=class extends ve{constructor(e,t){super(new Ue(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,j(e=this.j=new pc,0,1,t=new q),this.K=new fs,j(this.j,0,2,this.K),this.Y=new xd,j(this.j,0,3,this.Y),this.s=new Fi,j(this.j,0,4,this.s),this.H=new sc,j(this.j,0,5,this.H),this.v=new mc,j(this.j,0,6,this.v),this.L=new gc,j(this.j,0,7,this.L),b(this.s,2,.5),b(this.s,3,.3),b(this.H,2,.5),b(this.v,2,.5),b(this.v,3,.3),b(this.L,2,.5),b(this.K,2,.5)}get baseOptions(){return M(this.j,q,1)}set baseOptions(e){j(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&b(this.s,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&b(this.s,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&b(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&b(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&b(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&b(this.L,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&b(this.K,2,e.minHandLandmarksConfidence??.5),this.l(e)}D(e,t,r){const i=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:r,il(this),Ge(this,e,i),nl(this)}F(e,t,r,i){const n=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:i,il(this),ot(this,e,n,t),nl(this)}m(){var e=new be;W(e,"input_frames_image"),F(e,"pose_landmarks"),F(e,"pose_world_landmarks"),F(e,"face_landmarks"),F(e,"left_hand_landmarks"),F(e,"left_hand_world_landmarks"),F(e,"right_hand_landmarks"),F(e,"right_hand_world_landmarks");const t=new Ce,r=new La;Pn(r,1,ar("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(n,s){if(s!=null)if(Array.isArray(s))V(n,2,hi(s,In,void 0,void 0,!1));else{if(!(typeof s=="string"||s instanceof ht||Vt(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Pn(n,2,xn(s,!1),zt())}}(r,this.j.g());const i=new xe;Ne(i,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),pi(i,8,La,r),z(i,"IMAGE:input_frames_image"),I(i,"POSE_LANDMARKS:pose_landmarks"),I(i,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),I(i,"FACE_LANDMARKS:face_landmarks"),I(i,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),I(i,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),I(i,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),I(i,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),i.o(t),Ie(e,i),Ri(this,e),this.g.attachProtoListener("pose_landmarks",(n,s)=>{$i(n,this.h.poseLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("pose_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("pose_world_landmarks",(n,s)=>{var a=this.h.poseWorldLandmarks;n=yr(n),a.push($r(n)),x(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",n=>{x(this,n)}),this.outputPoseSegmentationMasks&&(I(i,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),vr(this,"pose_segmentation_mask"),this.g.V("pose_segmentation_mask",(n,s)=>{this.h.poseSegmentationMasks=[Er(this,n,!0,!this.C)],x(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",n=>{this.h.poseSegmentationMasks=[],x(this,n)})),this.g.attachProtoListener("face_landmarks",(n,s)=>{$i(n,this.h.faceLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{x(this,n)}),this.outputFaceBlendshapes&&(F(e,"extra_blendshapes"),I(i,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(n,s)=>{var a=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=Ii(n),a.push(bs(n.g()??[]))),x(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",n=>{x(this,n)})),this.g.attachProtoListener("left_hand_landmarks",(n,s)=>{$i(n,this.h.leftHandLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("left_hand_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("left_hand_world_landmarks",(n,s)=>{var a=this.h.leftHandWorldLandmarks;n=yr(n),a.push($r(n)),x(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("right_hand_landmarks",(n,s)=>{$i(n,this.h.rightHandLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("right_hand_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("right_hand_world_landmarks",(n,s)=>{var a=this.h.rightHandWorldLandmarks;n=yr(n),a.push($r(n)),x(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",n=>{x(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Y.prototype.detectForVideo=Y.prototype.F,Y.prototype.detect=Y.prototype.D,Y.prototype.setOptions=Y.prototype.o,Y.createFromModelPath=function(e,t){return N(Y,e,{baseOptions:{modelAssetPath:t}})},Y.createFromModelBuffer=function(e,t){return N(Y,e,{baseOptions:{modelAssetBuffer:t}})},Y.createFromOptions=function(e,t){return N(Y,e,t)},Y.HAND_CONNECTIONS=Ds,Y.POSE_CONNECTIONS=rl,Y.FACE_LANDMARKS_LIPS=Ns,Y.FACE_LANDMARKS_LEFT_EYE=Is,Y.FACE_LANDMARKS_LEFT_EYEBROW=Ms,Y.FACE_LANDMARKS_LEFT_IRIS=qc,Y.FACE_LANDMARKS_RIGHT_EYE=Ls,Y.FACE_LANDMARKS_RIGHT_EYEBROW=Fs,Y.FACE_LANDMARKS_RIGHT_IRIS=Yc,Y.FACE_LANDMARKS_FACE_OVAL=Ps,Y.FACE_LANDMARKS_CONTOURS=Kc,Y.FACE_LANDMARKS_TESSELATION=Xc;var ze=class extends ve{constructor(e,t){super(new Ue(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},j(e=this.h=new xc,0,1,t=new q)}get baseOptions(){return M(this.h,q,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return j(this.h,0,2,ys(e,M(this.h,us,2))),this.l(e)}qa(e,t){return this.j={classifications:[]},Ge(this,e,t),this.j}ra(e,t,r){return this.j={classifications:[]},ot(this,e,r,t),this.j}m(){var e=new be;W(e,"input_image"),W(e,"norm_rect"),F(e,"classifications");const t=new Ce;qe(t,yd,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),z(r,"IMAGE:input_image"),z(r,"NORM_RECT:norm_rect"),I(r,"CLASSIFICATIONS:classifications"),r.o(t),Ie(e,r),this.g.attachProtoListener("classifications",(i,n)=>{this.j=function(s){const a={classifications:mt(s,sd,1).map(c=>{var l;return bs(((l=M(c,qa,4))==null?void 0:l.g())??[],Oe(c,2)??0,Be(c,3)??"")})};return Tn(lr(s,2))!=null&&(a.timestampMs=Tn(lr(s,2))??0),a}(od(i)),x(this,n)}),this.g.attachEmptyPacketListener("classifications",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ze.prototype.classifyForVideo=ze.prototype.ra,ze.prototype.classify=ze.prototype.qa,ze.prototype.setOptions=ze.prototype.o,ze.createFromModelPath=function(e,t){return N(ze,e,{baseOptions:{modelAssetPath:t}})},ze.createFromModelBuffer=function(e,t){return N(ze,e,{baseOptions:{modelAssetBuffer:t}})},ze.createFromOptions=function(e,t){return N(ze,e,t)};var Fe=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!0),this.h=new yc,this.embeddings={embeddings:[]},j(e=this.h,0,1,t=new q)}get baseOptions(){return M(this.h,q,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){var t=this.h,r=M(this.h,rc,2);return r=r?r.clone():new rc,e.l2Normalize!==void 0?Ur(r,1,e.l2Normalize):"l2Normalize"in e&&V(r,1),e.quantize!==void 0?Ur(r,2,e.quantize):"quantize"in e&&V(r,2),j(t,0,2,r),this.l(e)}xa(e,t){return Ge(this,e,t),this.embeddings}ya(e,t,r){return ot(this,e,r,t),this.embeddings}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect"),F(e,"embeddings_out");const t=new Ce;qe(t,bd,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),I(r,"EMBEDDINGS:embeddings_out"),r.o(t),Ie(e,r),this.g.attachProtoListener("embeddings_out",(i,n)=>{i=ld(i),this.embeddings=function(s){return{embeddings:mt(s,cd,1).map(a=>{var l,u;const c={headIndex:Oe(a,3)??0??-1,headName:Be(a,4)??""??""};if(ea(a,Za,Dn(a,1))!==void 0)a=Ht(a=M(a,Za,Dn(a,1)),1,St,$t()),c.floatEmbedding=a.slice();else{const d=new Uint8Array(0);c.quantizedEmbedding=((u=(l=M(a,ad,Dn(a,2)))==null?void 0:l.ma())==null?void 0:u.h())??d}return c}),timestampMs:Tn(lr(s,2))??0}}(i),x(this,n)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Fe.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Ac(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Ac(Sc(e.quantizedEmbedding),Sc(t.quantizedEmbedding))}return e},Fe.prototype.embedForVideo=Fe.prototype.ya,Fe.prototype.embed=Fe.prototype.xa,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return N(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return N(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return N(Fe,e,t)};var Rs=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};function sl(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function ol(e){try{const t=new Rs(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Oi(e)}}Rs.prototype.close=Rs.prototype.close;var ke=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new xs,this.v=new bc,j(this.h,0,3,this.v),j(e=this.h,0,1,t=new q)}get baseOptions(){return M(this.h,q,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?V(this.h,2,ar(e.displayNamesLocale)):"displayNamesLocale"in e&&V(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}J(){(function(e){var r,i;const t=mt(e.ca(),xe,1).filter(n=>(Be(n,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(e.s=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(((i=(r=M(t[0],Ce,7))==null?void 0:r.l())==null?void 0:i.g())??new Map).forEach((n,s)=>{e.s[Number(s)]=Be(n,1)??""})})(this)}segment(e,t,r){const i=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,sl(this),Ge(this,e,i),ol(this)}Ia(e,t,r,i){const n=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:i,sl(this),ot(this,e,n,t),ol(this)}Ba(){return this.s}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect");const t=new Ce;qe(t,_c,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),r.o(t),Ie(e,r),Ri(this,e),this.outputConfidenceMasks&&(F(e,"confidence_masks"),I(r,"CONFIDENCE_MASKS:confidence_masks"),vr(this,"confidence_masks"),this.g.ba("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Er(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(F(e,"category_mask"),I(r,"CATEGORY_MASK:category_mask"),vr(this,"category_mask"),this.g.V("category_mask",(i,n)=>{this.categoryMask=Er(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),F(e,"quality_scores"),I(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,x(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ke.prototype.getLabels=ke.prototype.Ba,ke.prototype.segmentForVideo=ke.prototype.Ia,ke.prototype.segment=ke.prototype.segment,ke.prototype.setOptions=ke.prototype.o,ke.createFromModelPath=function(e,t){return N(ke,e,{baseOptions:{modelAssetPath:t}})},ke.createFromModelBuffer=function(e,t){return N(ke,e,{baseOptions:{modelAssetBuffer:t}})},ke.createFromOptions=function(e,t){return N(ke,e,t)};var Os=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};Os.prototype.close=Os.prototype.close;var Ad=class extends y{constructor(e){super(e)}},jr=[0,Q,-2],Hi=[0,xt,-3,H,xt,-1],al=[0,Hi],cl=[0,Hi,Q,-1],Bs=class extends y{constructor(e){super(e)}},ll=[0,xt,-1,H],Cd=class extends y{constructor(e){super(e)}},ul=class extends y{constructor(e){super(e)}},Us=[1,2,3,4,5,6,7,8,9,10,14,15],dl=class extends y{constructor(e){super(e)}};dl.prototype.g=Ni([0,ae,[0,Us,O,Hi,O,[0,Hi,jr],O,al,O,[0,al,jr],O,ll,O,[0,xt,-3,H,Ae],O,[0,xt,-3,H],O,[0,R,xt,-2,H,Q,H,-1,2,xt,jr],O,cl,O,[0,cl,jr],xt,jr,R,O,[0,xt,-3,H,jr,-1],O,[0,ae,ll]],R,[0,R,Q,-1,H]]);var ct=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new xs,this.s=new bc,j(this.h,0,3,this.s),j(e=this.h,0,1,t=new q)}get baseOptions(){return M(this.h,q,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,i){const n=typeof r!="function"?r:{};this.j=typeof r=="function"?r:i,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.B+1,i=new dl;const s=new ul;var a=new Ad;if(it(a,1,255),j(s,0,12,a),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var c=new Bs;Ur(c,3,!0),b(c,1,t.keypoint.x),b(c,2,t.keypoint.y),Br(s,5,Us,c)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(c of(a=new Cd,t.scribble))Ur(t=new Bs,3,!0),b(t,1,c.x),b(t,2,c.y),pi(a,1,Bs,t);Br(s,15,Us,a)}pi(i,1,ul,s),this.g.addProtoToStream(i.g(),"drishti.RenderData","roi_in",r),Ge(this,e,n);e:{try{const u=new Os(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var l=u;break e}this.j(u)}finally{Oi(this)}l=void 0}return l}m(){var e=new be;W(e,"image_in"),W(e,"roi_in"),W(e,"norm_rect_in");const t=new Ce;qe(t,_c,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),z(r,"IMAGE:image_in"),z(r,"ROI:roi_in"),z(r,"NORM_RECT:norm_rect_in"),r.o(t),Ie(e,r),Ri(this,e),this.outputConfidenceMasks&&(F(e,"confidence_masks"),I(r,"CONFIDENCE_MASKS:confidence_masks"),vr(this,"confidence_masks"),this.g.ba("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Er(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(F(e,"category_mask"),I(r,"CATEGORY_MASK:category_mask"),vr(this,"category_mask"),this.g.V("category_mask",(i,n)=>{this.categoryMask=Er(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),F(e,"quality_scores"),I(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,x(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ct.prototype.segment=ct.prototype.segment,ct.prototype.setOptions=ct.prototype.o,ct.createFromModelPath=function(e,t){return N(ct,e,{baseOptions:{modelAssetPath:t}})},ct.createFromModelBuffer=function(e,t){return N(ct,e,{baseOptions:{modelAssetBuffer:t}})},ct.createFromOptions=function(e,t){return N(ct,e,t)};var We=class extends ve{constructor(e,t){super(new Ue(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},j(e=this.h=new Ec,0,1,t=new q)}get baseOptions(){return M(this.h,q,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?V(this.h,2,ar(e.displayNamesLocale)):"displayNamesLocale"in e&&V(this.h,2),e.maxResults!==void 0?it(this.h,3,e.maxResults):"maxResults"in e&&V(this.h,3),e.scoreThreshold!==void 0?b(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&V(this.h,4),e.categoryAllowlist!==void 0?xi(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&V(this.h,5),e.categoryDenylist!==void 0?xi(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&V(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},Ge(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},ot(this,e,r,t),this.j}m(){var e=new be;W(e,"input_frame_gpu"),W(e,"norm_rect"),F(e,"detections");const t=new Ce;qe(t,kd,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),z(r,"IMAGE:input_frame_gpu"),z(r,"NORM_RECT:norm_rect"),I(r,"DETECTIONS:detections"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Ka(s),this.j.detections.push(Tc(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};We.prototype.detectForVideo=We.prototype.F,We.prototype.detect=We.prototype.D,We.prototype.setOptions=We.prototype.o,We.createFromModelPath=async function(e,t){return N(We,e,{baseOptions:{modelAssetPath:t}})},We.createFromModelBuffer=function(e,t){return N(We,e,{baseOptions:{modelAssetBuffer:t}})},We.createFromOptions=function(e,t){return N(We,e,t)};var Gs=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 hl(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function fl(e){try{const t=new Gs(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{Oi(e)}}Gs.prototype.close=Gs.prototype.close;var Pe=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,j(e=this.h=new jc,0,1,t=new q),this.v=new gc,j(this.h,0,3,this.v),this.j=new mc,j(this.h,0,2,this.j),it(this.j,4,1),b(this.j,2,.5),b(this.v,2,.5),b(this.h,4,.5)}get baseOptions(){return M(this.h,q,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"numPoses"in e&&it(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&b(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&b(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&b(this.v,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}D(e,t,r){const i=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:r,hl(this),Ge(this,e,i),fl(this)}F(e,t,r,i){const n=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:i,hl(this),ot(this,e,n,t),fl(this)}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect"),F(e,"normalized_landmarks"),F(e,"world_landmarks"),F(e,"segmentation_masks");const t=new Ce;qe(t,_d,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),I(r,"NORM_LANDMARKS:normalized_landmarks"),I(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Ie(e,r),Ri(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(i,n)=>{this.landmarks=[];for(const s of i)i=Wr(s),this.landmarks.push(Pi(i));x(this,n)}),this.g.attachEmptyPacketListener("normalized_landmarks",i=>{this.landmarks=[],x(this,i)}),this.g.attachProtoVectorListener("world_landmarks",(i,n)=>{this.worldLandmarks=[];for(const s of i)i=yr(s),this.worldLandmarks.push($r(i));x(this,n)}),this.g.attachEmptyPacketListener("world_landmarks",i=>{this.worldLandmarks=[],x(this,i)}),this.outputSegmentationMasks&&(I(r,"SEGMENTATION_MASK:segmentation_masks"),vr(this,"segmentation_masks"),this.g.ba("segmentation_masks",(i,n)=>{this.segmentationMasks=i.map(s=>Er(this,s,!0,!this.s)),x(this,n)}),this.g.attachEmptyPacketListener("segmentation_masks",i=>{this.segmentationMasks=[],x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Pe.prototype.detectForVideo=Pe.prototype.F,Pe.prototype.detect=Pe.prototype.D,Pe.prototype.setOptions=Pe.prototype.o,Pe.createFromModelPath=function(e,t){return N(Pe,e,{baseOptions:{modelAssetPath:t}})},Pe.createFromModelBuffer=function(e,t){return N(Pe,e,{baseOptions:{modelAssetBuffer:t}})},Pe.createFromOptions=function(e,t){return N(Pe,e,t)},Pe.POSE_CONNECTIONS=rl;const qi="https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task",Nd="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm",Id=()=>{const e=h.useRef(null),[t,r]=h.useState(!1),[i,n]=h.useState("Initializing..."),[s,a]=h.useState(0),[c,l]=h.useState(!1);h.useEffect(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(w=>{console.log("ServiceWorker registered:",w)}).catch(w=>{console.log("ServiceWorker registration failed:",w)})},[]);const u=async()=>"caches"in window?await(await caches.open("mediapipe-models-v1")).match(qi)!==void 0:!1,d=async()=>{try{const w=await fetch(qi),m=w.headers.get("content-length"),g=m?parseInt(m,10):0;if(!w.body)throw new Error("No response body");const v=w.body.getReader();let E=0;const p=[];for(;;){const{done:A,value:S}=await v.read();if(A)break;if(p.push(S),E+=S.length,g){const T=Math.round(E/g*100);a(T),n(`Downloading model... ${T}%`)}}return"caches"in window&&await(await caches.open("mediapipe-models-v1")).put(qi,new Response(new Blob(p),{headers:{"Content-Type":"application/octet-stream"}})),!0}catch(w){return console.error("Failed to preload model:",w),!1}};return h.useEffect(()=>{(async()=>{try{n("Checking cached models..."),await u()?n("Using cached model..."):(n("Model not cached. Downloading..."),await d()),n("Loading MediaPipe WASM...");const g=await Kt.forVisionTasks(Nd);n("Creating face landmarker...");const v=await X.createFromOptions(g,{baseOptions:{modelAssetPath:qi,delegate:"GPU"},runningMode:"VIDEO",outputFaceBlendshapes:!0,numFaces:2});e.current=v,r(!0),n("Model loaded successfully ✅")}catch(m){console.error("Model init error:",m),n(`Error: ${m==null?void 0:m.message}`),(m==null?void 0:m.name)==="NotAllowedError"&&l(!0)}})()},[]),{faceLandmarkerRef:e,isModelLoaded:t,statusMessage:i,setStatusMessage:n,loadingProgress:s,permissionDenied:c,clearCache:async()=>{"caches"in window&&(await caches.delete("mediapipe-models-v1"),n("Cache cleared. Please refresh to re-download models."))}}},Md=()=>{const[e,t]=h.useState(0),r=h.useRef({lastTime:0,frames:0,fps:0}),i=h.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}},Ld=()=>{const e=h.useRef({value:100,isLookingAway:!1}),t=h.useCallback((s,a,c,l)=>{if(!s||!c||!a)return;const u=s.getContext("2d");if(!u)return;const{width:d,height:f}=s;if(u.clearRect(0,0,d,f),u.drawImage(a,0,0,d,f),l){u.fillStyle="#00FF00";for(const w of c)u.fillRect(w.x*d-.5,w.y*f-.5,1,1)}},[]),r=h.useCallback(s=>{const a=e.current.value/100,c=100,l=20,u=10,d=10;s.fillStyle="rgba(0, 0, 0, 0.3)",s.fillRect(u,d,l,c),s.fillStyle=`rgba(${Math.floor(255*(1-a))}, ${Math.floor(255*a)}, 0, 0.8)`;const f=c*a;s.fillRect(u,d+c-f,l,f),s.fillStyle="#FFFFFF",s.fillRect(u,d+c*(1-a),l,2)},[]),i=h.useCallback((s,a,c,l,u,d,f)=>{if(t(s,a,c,l),u&&d&&f){const w=s.getContext("2d");w&&r(w)}},[t,r]),n=h.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}},Fd=70,Pd=()=>{const[e,t]=h.useState(100),[r,i]=h.useState(!1),n=h.useRef(0),s=h.useCallback((a,c,l)=>{if(!l||a.length<468)return;const u=a[33],d=a[263],f=a[1];if(!u||!d||!f)return;const w=(u.x+d.x)*.5,m=(u.y+d.y)*.5,g=w-c.x,v=m-c.y,E=Math.sqrt(g*g+v*v),p=Math.abs(f.y-c.noseY)*100,A=Math.abs(f.x-c.noseX)*100,S=Math.max(0,100-(E*200+p+A)),T=S<Fd,G=performance.now();return G-n.current>100&&(t(S),i(T),n.current=G),{engagement:S,isLookingAway:T}},[]);return{engagement:e,isLookingAway:r,analyzeGaze:s,setEngagement:t,setIsLookingAway:i}},Dd=.05,Rd=()=>{const[e,t]=h.useState(!1),[r,i]=h.useState(!1),n=h.useCallback((c,l)=>Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2)),[]),s=h.useCallback((c,l)=>{if(!c||!l)return 0;const u=[1,33,263,61,291,10,152];let d=0,f=0;const w=l[33],m=l[263],g=c[33],v=c[263];if(!w||!m||!g||!v)return 0;const E=n(w,m),p=n(g,v);if(E===0||p===0)return 0;for(const S of u){const T=l[S],G=c[S];if(T&&G){const C=w.x+(G.x-g.x)*E/p,B=w.y+(G.y-g.y)*E/p;d+=n(T,{x:C,y:B}),f++}}return f===0?0:d/f},[n]),a=h.useCallback((c,l,u,d)=>{if(!c.faceLandmarks||c.faceLandmarks.length===0)return l?(d("Reference face not detected."),i(!0),t(!1)):i(!1),null;if(l&&u){let f=null,w=0;for(const m of c.faceLandmarks)s(m,u)<Dd&&(f=m,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}},Od=1e3,Bd=(e,t)=>{const[r,i]=h.useState(!1),[n,s]=h.useState("face_detected"),{incrementGazeViolation:a}=Xs(),{multipleFacesDetected:c,referenceFaceNotDetected:l,isLookingAway:u}=e;h.useEffect(()=>{let w;return(u||c||l)&&t?w=setTimeout(()=>{i(!0),u?(s("looking_away"),a("looking_away")):c?(s("multiple_faces"),a("multiple_faces")):l&&(s("no_face_detected"),a("no_face_detected"))},Od):(i(!1),s("face_detected")),()=>{clearTimeout(w)}},[u,c,l,t,a]);const d=h.useCallback(()=>c?"multiple_faces":l?"no_face_detected":u?"looking_away":"face_detected",[c,l,u]),f=h.useCallback(()=>{i(!1),s("face_detected")},[]);return{showGazeWarningModal:r,faceDetectionState:n,getWarningType:d,closeWarningModal:f,setShowGazeWarningModal:i,setFaceDetectionState:s}};class re extends Error{constructor(t,r,i=!1){super(t),this.code=r,this.recoverable=i,this.name="STTError"}}class Ud{constructor(t={}){Te(this,"config");Te(this,"mediaRecorder",null);Te(this,"audioChunks",[]);Te(this,"recordingStream",null);Te(this,"autoStopTimeoutId",null);this.config={baseUrl:"http://localhost:8000",provider:"groq",model:"whisper-large-v3-turbo",language:"en",includeTimestamps:!1,temperature:0,...t}}updateConfig(t){this.config={...this.config,...t}}isRecordingSupported(){return!!(navigator.mediaDevices&&typeof navigator.mediaDevices.getUserMedia=="function"&&window.MediaRecorder)}async startRecording(t,r){var i;if(!this.isRecordingSupported())throw new re("Audio recording is not supported in this browser","RECORDING_NOT_SUPPORTED",!1);if(this.isRecording())throw new re("Recording is already in progress","ALREADY_RECORDING",!0);try{this.recordingStream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:44100}}),this.audioChunks=[];const n=this.getSupportedMimeType();this.mediaRecorder=new MediaRecorder(this.recordingStream,{mimeType:n}),this.mediaRecorder.ondataavailable=s=>{var a;s.data.size>0&&(this.audioChunks.push(s.data),(a=r==null?void 0:r.onDataAvailable)==null||a.call(r,s.data))},this.mediaRecorder.onstop=()=>{var s;(s=r==null?void 0:r.onStop)==null||s.call(r)},this.mediaRecorder.onerror=s=>{var c;const a=new re(`Recording failed: ${s.error}`,"RECORDING_ERROR",!0);(c=r==null?void 0:r.onError)==null||c.call(r,a),this.cleanup()},this.mediaRecorder.start(100),(i=r==null?void 0:r.onStart)==null||i.call(r),t&&t>0&&(this.autoStopTimeoutId=setTimeout(()=>{this.isRecording()&&this.stopRecording()},t*1e3))}catch(n){if(this.cleanup(),n instanceof Error){if(n.name==="NotAllowedError"||n.name==="PermissionDeniedError")throw new re("Microphone permission was denied","PERMISSION_DENIED",!1);if(n.name==="NotFoundError")throw new re("No microphone found","NO_MICROPHONE",!1)}throw new re(`Failed to start recording: ${n instanceof Error?n.message:String(n)}`,"START_RECORDING_FAILED",!0)}}async stopRecording(){if(this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),!this.mediaRecorder||!this.isRecording())throw new re("No active recording to stop","NO_ACTIVE_RECORDING",!1);return new Promise((t,r)=>{if(!this.mediaRecorder){r(new re("MediaRecorder is null","MEDIARECORDER_NULL",!1));return}const i=this.mediaRecorder,n=()=>{try{const s=i.mimeType||"audio/webm",a=new Blob(this.audioChunks,{type:s});this.cleanup(),t(a)}catch(s){r(new re(`Failed to create audio blob: ${s instanceof Error?s.message:String(s)}`,"BLOB_CREATION_FAILED",!1))}};i.addEventListener("stop",n,{once:!0}),i.stop()})}async transcribe(t){const{audioBlob:r,model:i=this.config.model,language:n=this.config.language,includeTimestamps:s=this.config.includeTimestamps,temperature:a=this.config.temperature}=t;if(!r||r.size===0)throw new re("Audio blob is empty or invalid","INVALID_AUDIO",!1);try{const c=new FormData,l=new File([r],"recording.wav",{type:r.type||"audio/wav"});c.append("file",l),c.append("model",i||"whisper-large-v3-turbo"),c.append("language",n||"en"),c.append("include_timestamps",String(s||!1)),c.append("temperature",String(a||0)),c.append("qna_id",this.config.qnaId||"");const u=await ei(`${this.config.baseUrl}/speech/transcribe`,{method:"POST",headers:{accept:"application/json","X-STT-Provider":this.config.provider||"groq",...this.config.authToken&&{Authorization:`Bearer ${this.config.authToken}`}},body:c},{attempts:1,backoff:"exponential",baseDelay:1e3,maxDelay:3e3,jitter:!0});if(!u.ok){const f=await u.text();let w=`STT request failed: ${u.status} ${u.statusText}`;try{const m=JSON.parse(f);w=m.message||m.error||w}catch{w=f||w}throw new re(w,`HTTP_${u.status}`,u.status>=500)}return{transcript:(await u.json()).data.text??""}}catch(c){throw c instanceof re?c:new re(`Transcription failed: ${c instanceof Error?c.message:String(c)}`,"TRANSCRIPTION_FAILED",!0)}}cancelRecording(){this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),this.mediaRecorder&&this.isRecording()&&this.mediaRecorder.stop(),this.cleanup()}isRecording(){return this.mediaRecorder!==null&&this.mediaRecorder.state==="recording"}getSupportedMimeType(){const t=["audio/webm","audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4","audio/wav"];for(const r of t)if(MediaRecorder.isTypeSupported(r))return r;return"audio/webm"}getRecordingStream(){return this.recordingStream}cleanup(){this.recordingStream&&(this.recordingStream.getTracks().forEach(t=>t.stop()),this.recordingStream=null),this.mediaRecorder=null,this.audioChunks=[],this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null)}}const Tr=new Ud,Gd=(e,t,r,i)=>{const n=h.useRef(null);return h.useEffect(()=>{if(!t)return;const s=async()=>{try{const l=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"}});e.current&&(e.current.srcObject=l,e.current.onloadeddata=()=>{r()})}catch(l){console.error("Camera access error:",l),i("Camera access failed")}},a=n.current,c=e.current;return s(),()=>{a&&cancelAnimationFrame(a),c!=null&&c.srcObject&&c.srcObject.getTracks().forEach(u=>u.stop())}},[t,r]),h.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(u=>{u.addEventListener("ended",l)})}},[]),{animationFrameRef:n}},Vd=(e,t,r,i,n,s,a,c,l,u,d,f,w,m,g)=>{const v=h.useRef(null),E=h.useCallback(()=>{var T;const p=e.current,A=t.current,S=r.current;if(!p||p.readyState<2||!S||!A){v.current=requestAnimationFrame(E);return}i();try{const G=performance.now(),C=S.detectForVideo(p,G);if(((T=C.faceLandmarks)==null?void 0:T.length)>0){g(!1);const B=n(C,l,u.current,m);B?(s(A,p,B,d,f,w,l),l&&w&&c(B,u.current,w)):a(A,p)}else a(A,p),l?(g(!0),m("Reference face not detected.")):g(!1)}catch(G){console.error("Face detection error:",G)}v.current=requestAnimationFrame(E)},[e,t,r,i,n,s,a,c,l,u,d,f,w,m,g]);return{renderLoop:E,animationFrameRef:v}},zd=(e,t,r,i)=>{const{referenceSet:n,referenceRef:s,setReferenceData:a}=Xs(),c=h.useRef(s),l=h.useCallback(()=>{c.current=s},[s]),u=h.useCallback(()=>{var w;const d=e.current,f=t.current;if(console.log({faceLandmarker:d,video:f}),!(!d||!f))try{const m=performance.now(),g=d.detectForVideo(f,m);if((w=g.faceLandmarks)!=null&&w[0]){const v=g.faceLandmarks[0],E=v[33],p=v[263],A=v[1];E&&p&&A&&(c.current={x:(E.x+p.x)*.5,y:(E.y+p.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))}}catch(m){console.error("Set reference error:",m),r("Failed to set reference")}},[e,t,r,a,i]);return{referenceSet:n,referenceRef:c,setReference:u,syncReference:l}},wl=h.forwardRef(({className:e="",interviewId:t="",interview_duration:r,showProctoringUI:i=!0},n)=>{var vl;const{authToken:s}=Zs(),a=s?Bl(s):null,c=ao(),{borderRadius:l}=Zt(),u=l??18,{proctoring:d}=nn(),f=!!(d!=null&&d.gazeAnalysisEnabled),[w,m]=h.useState(!1),[g,v]=h.useState((d==null?void 0:d.showLandmarks)??!1),[E,p]=h.useState((d==null?void 0:d.showEngagementBar)??!0),[A,S]=h.useState(f),T=h.useRef(null),G=h.useRef(null),C=h.useRef(null),B=h.useCallback(async ut=>{var Xi;const Xt=T.current,kt=C.current;if(!Xt||!kt)return;const dt=kt.getContext("2d");if(!dt)return;kt.width=Xt.videoWidth,kt.height=Xt.videoHeight,dt.save(),dt.scale(-1,1),dt.drawImage(Xt,-kt.width,0,kt.width,kt.height),dt.restore();const Xr=await new Promise(Jt=>kt.toBlob(Jt,"image/jpeg"));if(Xr&&t)try{const Jt=`${ut}-${Date.now()}.jpeg`,De=await c.requestScreenshotUploadUrl(t,Jt);De.success&&De.data.upload_url&&await c.uploadScreenshot((Xi=De==null?void 0:De.data)==null?void 0:Xi.upload_url,Xr)}catch(Jt){console.error(`Failed to upload screenshot for ${ut}:`,Jt)}},[c,t]),{faceLandmarkerRef:$,isModelLoaded:D,statusMessage:Je,setStatusMessage:_e,loadingProgress:we,permissionDenied:$e,clearCache:Qe}=Id(),{fps:Ee,updateFPS:vt}=Md(),{drawWithEngagementBar:Ze,clearCanvas:me,engagementRef:je}=Ld(),{engagement:Z,isLookingAway:de,analyzeGaze:P,setEngagement:oe,setIsLookingAway:lt}=Pd(),{multipleFacesDetected:Pt,referenceFaceNotDetected:Dt,analyzeFace:Yr,setMultipleFacesDetected:Rt,setReferenceFaceNotDetected:Ot}=Rd(),{referenceSet:Kr,referenceRef:Ki,setReference:Sr,syncReference:L}=zd($,T,_e,void 0),et={multipleFacesDetected:Pt,referenceFaceNotDetected:Dt,isLookingAway:de},{showGazeWarningModal:Bt,getWarningType:Eh,closeWarningModal:xl,setShowGazeWarningModal:yl,setFaceDetectionState:bl}=Bd(et,f),{renderLoop:jh}=Vd(T,G,$,vt,Yr,Ze,me,P,Kr,Ki,g,E,f,_e,Ot);Gd(T,D,jh,_e),h.useEffect(()=>{L()},[L]),h.useEffect(()=>{je&&je.current&&(je.current.value=Z,je.current.isLookingAway=de)},[Z,de,je]);const Th=h.useCallback(ut=>{S(ut),ut||(oe(100),lt(!1))},[oe,lt]),Sh=h.useCallback(()=>{lt(!1),Rt(!1),Ot(!1),bl("face_detected"),yl(!1),xl()},[lt,Rt,Ot,bl,yl,xl]),Ah={engagement:Z,fps:Ee,isLookingAway:de,multipleFacesDetected:Pt,referenceFaceNotDetected:Dt};return h.useEffect(()=>{let ut=null;const Xt=[];return(async()=>{try{ut=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),T.current&&(T.current.srcObject=ut);const Xr=(r??en)*60*1e3/3,Xi=[0,1,2].map((De,Ut)=>({label:`capture-${Ut+1}`,start:Ut*Xr,end:(Ut+1)*Xr})),Jt=(De,Ut)=>De===Ut?De:Math.random()*(Ut-De)+De;Xi.forEach(({label:De,start:Ut,end:Ch},Nh)=>{let $s;Nh===0?$s=3e3:$s=Jt(Ut,Ch),Xt.push(setTimeout(()=>{B(De)},$s))})}catch(dt){console.error("Error accessing camera:",dt)}})(),()=>{ut&&ut.getTracks().forEach(dt=>dt.stop()),Xt.forEach(clearTimeout)}},[B,r]),h.useImperativeHandle(n,()=>({setReference:()=>{Sr()},faceLandmarkerRef:$}),[Sr]),o.jsxs("div",{className:`iw-relative ${e}`,children:[$e?o.jsxs("div",{className:"iw-rounded-md iw-border iw-border-red-600 iw-p-5 iw-text-red-600",children:[o.jsx("h2",{children:"Camera Permission Denied"}),o.jsx("p",{children:"Please allow camera access to use this application."})]}):o.jsx("div",{className:"iw-flex iw-w-full iw-flex-wrap iw-gap-5",children:o.jsxs("div",{className:"iw-relative iw-flex-1",children:[o.jsx("video",{ref:T,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-r-xl iw-min-h-[200px] iw-max-h-[600px] iw-aspect-video",style:{transform:"scaleX(-1)"}}),f&&o.jsx("canvas",{ref:G,width:420,height:240,className:"iw-absolute iw-top-0 iw-left-0 iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-r-xl iw-min-h-[200px] iw-max-h-[600px] iw-aspect-video",style:{transform:"scaleX(-1)",borderRadius:u}}),o.jsx("canvas",{ref:C,style:{display:"none"}}),i&&o.jsxs("div",{className:"iw-absolute iw-top-4 iw-left-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md",children:[o.jsx("div",{className:"iw-size-2 iw-animate-pulse iw-rounded-full iw-bg-red-500"}),o.jsx("span",{className:"iw-font-medium iw-text-white",children:"Recording"})]}),i&&((vl=a==null?void 0:a.data)==null?void 0:vl.user_name)&&o.jsx("div",{className:"iw-absolute iw-z-50 iw-bottom-4 iw-right-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md",children:o.jsx("span",{className:"iw-font-medium iw-text-white",children:a.data.user_name})}),i&&o.jsx("div",{className:"iw-absolute iw-bottom-4 iw-right-4",children:o.jsx(iu,{showControls:(d==null?void 0:d.showControls)??!1,isBubbleOpen:w,setIsBubbleOpen:m,setReference:Sr,clearCache:Qe,isModelLoaded:D,gazeAnalysisEnabled:A&&f,referenceSet:Kr,showLandmarks:g,setShowLandmarks:v,showEngagementBar:!1,setShowEngagementBar:p,handleToggleGazeAnalysis:Th,stats:Ah,statusMessage:Je,loadingProgress:we})})]})}),f&&Bt&&o.jsx(tu,{isOpen:Bt,onClose:Sh,warningType:Eh()})]})}),Wd=["Do not refresh or reload the page during your assessment","Refrain from switching tabs or opening other applications while the session is in progress","Ensure your face remains clearly visible on camera at all times","Avoid frequent distractions or leaving your seat during the session","Do not disable or interfere with audio/video monitoring"],$d=({isOpen:e,onStart:t,onClose:r,gazeEnabled:i=!1,videoFeedRef:n,interviewId:s="",interview_duration:a=en})=>{var de;const c=h.useRef(null),l=h.useRef(null),{baseColor:u,borderRadius:d}=Zt(),[f,w]=h.useState(!1),[m,g]=h.useState(!1),[v,E]=h.useState(!1),[p,A]=h.useState(!1),[S,T]=h.useState(!1),[G,C]=h.useState(null),[B,$]=h.useState(!1),D=u??"#2563eb",Je=no(D),_e=d??18,we=(P,oe)=>P.startsWith("#")&&P.length===7?`${P}${oe}`:P,$e=[`radial-gradient(120% 85% at 50% 125%, ${we(D,"34")} 0%, transparent 70%)`,`radial-gradient(90% 70% at 10% 130%, ${we(D,"24")} 0%, transparent 72%)`,`radial-gradient(90% 70% at 90% 130%, ${we(D,"24")} 0%, transparent 72%)`,`repeating-linear-gradient(135deg, ${we(D,"14")} 0, ${we(D,"14")} 16px, transparent 16px, transparent 32px)`].join(", "),Qe=f?{label:"Camera & microphone ready",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-emerald-400"}:B?{label:"Checking device access…",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-amber-300"}:{label:"Allow access to continue",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-rose-300"},Ee=f?{badge:"Ready",toneClass:"iw-bg-emerald-50 iw-text-emerald-600",cameraCopy:"Framing looks good for identity verification.",micCopy:"We can hear you clearly for your responses."}:B?{badge:"Checking",toneClass:"iw-bg-amber-50 iw-text-amber-600",cameraCopy:"Hang tight while we confirm camera access.",micCopy:"Listening for microphone permission from your browser."}:{badge:"Action needed",toneClass:"iw-bg-rose-50 iw-text-rose-600",cameraCopy:"Grant camera access to continue with the interview.",micCopy:"Enable microphone access so we can capture your answers."},vt=[{label:"Camera feed",description:Ee.cameraCopy,status:Ee.badge,toneClass:Ee.toneClass,Icon:oo},{label:"Microphone input",description:Ee.micCopy,status:Ee.badge,toneClass:Ee.toneClass,Icon:Ul}],Ze=()=>{l.current&&(l.current.getTracks().forEach(P=>P.stop()),l.current=null)},me=async()=>{$(!0),C(null);try{const P=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1280},height:{ideal:720}},audio:!0});l.current=P,c.current&&(c.current.srcObject=P),w(!0)}catch(P){console.error("Media permission error:",P);let oe="Unable to access camera or microphone.";(P==null?void 0:P.name)==="NotAllowedError"?oe="Permissions denied. Please allow access to camera and microphone.":(P==null?void 0:P.name)==="NotFoundError"?oe="No camera/microphone found. Please connect a device and retry.":P!=null&&P.message&&(oe=P.message),w(!1),C(oe)}finally{$(!1)}};if(h.useEffect(()=>{if(!e){Ze();return}return me(),()=>Ze()},[e]),!e)return null;const je=()=>{i?E(!0):(t(),Ze())},Z=async()=>{A(!0),await io(4e3),A(!1),t()};return o.jsxs("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-gray-900/25 iw-backdrop-blur-md iw-p-4",children:[o.jsxs("div",{className:" iw-w-full iw-max-w-[920px] iw-max-h-[96vh] iw-overflow-auto iw-rounded-3xl iw-bg-white iw-shadow-[0_40px_80px_-28px_rgba(15,23,42,0.25)]",children:[o.jsxs("div",{className:"iw-relative iw-overflow-hidden",style:{background:Je},children:[o.jsx("div",{"aria-hidden":!0,className:"iw-absolute iw-pointer-events-none",style:{top:-90,right:-100,width:240,height:240,background:"radial-gradient(circle, rgba(255,255,255,0.6), transparent 70%)",filter:"blur(12px)"}}),o.jsx("div",{"aria-hidden":!0,className:"iw-absolute iw-pointer-events-none",style:{bottom:-110,left:-60,width:220,height:220,background:"radial-gradient(circle, rgba(255,255,255,0.35), transparent 70%)",filter:"blur(14px)"}}),o.jsxs("div",{className:"iw-relative iw-grid md:iw-grid-cols-[minmax(0,1fr)_auto] iw-items-start iw-gap-6 iw-px-6 iw-py-7",children:[o.jsx("div",{className:"iw-flex iw-flex-col iw-gap-4 iw-text-white",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-12 iw-w-12 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-white/15 iw-shadow-inner",children:o.jsx(so,{className:"iw-h-6 iw-w-6"})}),o.jsxs("div",{children:[o.jsx("p",{className:"iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-white/70",children:"Pre-interview checklist"}),o.jsx("h2",{className:"iw-mt-1 iw-text-xl iw-font-semibold iw-leading-tight",children:"Final checks before you go live"}),o.jsx("p",{className:"iw-mt-2 iw-text-sm iw-text-white/80",children:"Align your space, confirm device access, and step confidently into your secure session."})]})]})}),o.jsx("div",{className:"iw-flex iw-items-start iw-justify-end",children:o.jsxs("div",{className:`iw-inline-flex iw-items-center iw-gap-2 iw-rounded-full iw-bg-white/10 iw-px-4 iw-py-1.5 iw-text-xs iw-font-medium iw-text-white/85 iw-backdrop-blur-sm ${Qe.toneClass}`,children:[o.jsx("span",{className:`iw-inline-flex iw-h-2 iw-w-2 iw-rounded-full ${Qe.dotClass}`}),Qe.label]})}),r&&o.jsx("button",{"aria-label":"Close",className:"iw-absolute iw-top-5 iw-right-5 iw-text-white/70 transition-colors hover:iw-text-white",onClick:()=>{Ze(),r==null||r()},children:"✕"})]})]}),o.jsxs("div",{className:"iw-relative iw-flex iw-flex-col iw-gap-6 iw-px-6 iw-pb-8 iw-pt-6",children:[o.jsxs("div",{className:"iw-grid xl:iw-grid-cols-[0.95fr_1.05fr] iw-gap-6",children:[o.jsx("section",{className:"iw-flex iw-flex-col iw-gap-5",children:o.jsxs("div",{className:"iw-rounded-2xl iw-border iw-border-slate-100 iw-bg-white iw-p-5 iw-shadow-sm",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[o.jsx("h3",{className:"iw-text-sm iw-font-semibold iw-text-slate-900",children:"Proctoring guidelines"}),o.jsx("span",{className:"iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-slate-400",children:"Required"})]}),o.jsx("ul",{className:"iw-mt-5 iw-flex iw-flex-col iw-gap-4",children:Wd.map((P,oe)=>o.jsx("li",{className:"iw-group iw-overflow-hidden iw-rounded-xl iw-border iw-border-slate-100 iw-bg-slate-50/60 iw-p-4 iw-transition-all hover:iw-border-slate-200 hover:iw-bg-white",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3",children:[o.jsx("span",{className:"iw-flex iw-h-8 iw-w-8 iw-flex-none iw-items-center iw-justify-center iw-rounded-full iw-text-sm iw-font-semibold iw-text-white",style:{background:Je},children:oe+1}),o.jsx("span",{className:"iw-text-sm iw-text-slate-600",children:P})]})},P))})]})}),o.jsxs("section",{className:"iw-flex iw-flex-col iw-gap-5",children:[o.jsxs("div",{className:"iw-relative iw-flex iw-flex-col iw-gap-6 iw-overflow-hidden iw-rounded-3xl iw-bg-white ",style:{borderRadius:_e},children:[o.jsx("div",{className:"iw-relative iw-z-10 iw-rounded-2xl iw-border iw-border-slate-200 iw-bg-slate-50/80 iw-p-3",children:i&&p?o.jsx(wl,{ref:n,interviewId:s,interview_duration:a,showProctoringUI:!1}):o.jsx("video",{ref:c,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-h-64 iw-w-full iw-rounded-2xl iw-object-cover",style:{transform:"scaleX(-1)",borderRadius:_e}})}),o.jsx("div",{className:"iw-relative iw-grid iw-grid-cols-2 iw-gap-4 iw-px-1",children:!v&&!S?o.jsxs(o.Fragment,{children:[o.jsx(to,{onClick:me,disabled:B,variant:"outline",size:"sm",className:"iw-font-medium",style:{borderColor:D,borderRadius:_e,color:D},children:f?"Recheck permissions":"Enable camera & mic"}),o.jsx(He,{onClick:je,disabled:!f,className:"iw-h-10 iw-px-6 iw-text-sm",style:{backgroundColor:D},children:"Proceed"})]}):i&&(v&&!S?o.jsx(He,{onClick:()=>g(!0),disabled:!f,className:"iw-h-10 iw-px-6 iw-text-sm iw-col-span-2",style:{backgroundColor:D},children:"Calibrate Face Position"}):o.jsxs(He,{onClick:Z,disabled:p||!f,className:"iw-h-10 iw-px-6 iw-text-sm iw-col-span-2",style:{backgroundColor:D},children:[p?"Calibrating":"Start Calibration",p&&o.jsx("span",{className:"iw-ml-2 iw-animate-spin iw-inline-block iw-border-2 iw-border-t-transparent iw-border-stone-200 iw-size-4 iw-rounded-full","aria-label":"loading"})]}))})]}),i&&S?o.jsxs("span",{className:"iw-text-slate-700 iw-text-center iw-text-md",children:["Sit upright and look directly into the camera, then press the",o.jsx("span",{className:"iw-font-semibold",children:" Start Calibration "}),"button. Proper calibration is required and incorrect setup may affect your assessment."]}):o.jsx("ul",{className:"iw-grid sm:iw-grid-cols-1 iw-gap-3",children:vt.map(({Icon:P,label:oe,description:lt,status:Pt,toneClass:Dt})=>o.jsx("li",{className:"iw-rounded-2xl iw-border iw-border-slate-200/65 iw-bg-white iw-p-4 iw-shadow-sm iw-transition-all hover:iw-border-slate-200",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3",children:[o.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-flex-none iw-items-center iw-justify-center iw-rounded-xl iw-bg-slate-100",children:o.jsx(P,{className:"iw-h-5 iw-w-5 iw-text-slate-600"})}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-gap-3",children:[o.jsx("p",{className:"iw-text-sm iw-font-medium iw-text-slate-800",children:oe}),o.jsx("span",{className:`iw-rounded-full iw-px-3 iw-py-1 iw-text-[11px] iw-font-semibold ${Dt}`,children:Pt})]}),o.jsx("p",{className:"iw-mt-1.5 iw-text-xs iw-text-slate-500",children:lt})]})]})},oe))}),G&&o.jsx("div",{className:"iw-rounded-lg iw-border iw-border-rose-200 iw-bg-rose-50 iw-px-3 iw-py-2 iw-text-xs iw-text-rose-600",children:G}),!((de=navigator.mediaDevices)!=null&&de.getUserMedia)&&o.jsx("div",{className:"iw-rounded-lg iw-border iw-border-amber-200 iw-bg-amber-50 iw-px-3 iw-py-2 iw-text-xs iw-text-amber-700",children:"Your browser does not support media devices. Please use a modern browser like Chrome, Edge, or Firefox."})]})]}),o.jsx("div",{className:" iw-rounded-2xl iw-border iw-border-dashed iw-border-slate-200 iw-bg-slate-50/85 iw-px-5 iw-py-4 iw-text-center",children:o.jsx("div",{className:"iw-text-xs iw-text-slate-500",children:"Your session is monitored to protect exam integrity. Continuing confirms you have reviewed and accept these safeguards."})}),o.jsx("div",{"aria-hidden":!0,className:"iw-pointer-events-none iw-absolute iw-inset-x-0 iw-bottom-1 iw-h-20",style:{backgroundImage:$e,backgroundSize:"100% 120%, 100% 120%, 100% 120%, 32px 32px",backgroundPosition:"center bottom, left 95% bottom, right 95% bottom, center bottom",backgroundRepeat:"no-repeat, no-repeat, no-repeat, repeat",opacity:.9,transform:"translateY(4px)",maskImage:"linear-gradient(to top, rgba(0,0,0,0.92), transparent)",WebkitMaskImage:"linear-gradient(to top, rgba(0,0,0,0.92), transparent)"}})]})]}),o.jsx(zl,{isOpen:m,onDecline:()=>g(!1),onContinue:()=>{g(!1),T(!0)}})]})};var ue=(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))(ue||{});const Hd={thinkingDuration:30,answeringDuration:120,editingDuration:30},qd={idle:{next:"fetching_question"},fetching_question:{next:"reading_question"},reading_question:{next:"thinking"},thinking:{next:"answering",duration:30},answering:{next:"transcribing",duration:120},transcribing:{next:"editing"},editing:{next:"submitting",duration:30},submitting:{next:"completed"},completed:{next:"completed"}};class Yd{constructor(t={},r={}){Te(this,"config");Te(this,"state");Te(this,"phaseIntervalId",null);Te(this,"globalIntervalId",null);Te(this,"callbacks");this.config={...Hd,...t},this.callbacks=r,this.state={phase:"idle",currentPhaseTimeRemaining:0,totalTimeElapsed:0,currentQuestionNumber:0}}getState(){return{...this.state}}startQuestion(){this.state.currentQuestionNumber===0&&this.startGlobalTimer(),this.state.currentQuestionNumber=this.state.currentQuestionNumber+1,this.state.phase="fetching_question",this.notifyChange()}nextPhase(){const t=this.state.phase,r=qd[t];if(!r)return;this.stopPhaseTimer(),this.state.phase=r.next;const i=this.getDurationForPhase(r.next);i>0?(this.state.currentPhaseTimeRemaining=i,this.startPhaseTimer()):this.state.currentPhaseTimeRemaining=0,this.notifyChange()}completeInterview(){var t,r;this.stopGlobalTimer(),this.stopPhaseTimer(),this.state.phase="completed",(r=(t=this.callbacks).onInterviewEnd)==null||r.call(t),this.notifyChange()}destroy(){this.stopPhaseTimer(),this.stopGlobalTimer()}getDurationForPhase(t){switch(t){case"thinking":return this.config.thinkingDuration;case"answering":return this.config.answeringDuration;case"editing":return this.config.editingDuration;default:return 0}}startGlobalTimer(){this.globalIntervalId=setInterval(()=>{var t,r;this.state.totalTimeElapsed++,(r=(t=this.callbacks).onTick)==null||r.call(t,this.getState())},1e3)}stopGlobalTimer(){this.globalIntervalId&&(clearInterval(this.globalIntervalId),this.globalIntervalId=null)}startPhaseTimer(){this.phaseIntervalId=setInterval(()=>{this.state.currentPhaseTimeRemaining--,this.state.currentPhaseTimeRemaining<=0&&this.nextPhase()},1e3)}stopPhaseTimer(){this.phaseIntervalId&&(clearInterval(this.phaseIntervalId),this.phaseIntervalId=null)}notifyChange(){var t,r;(r=(t=this.callbacks).onPhaseChange)==null||r.call(t,this.state.phase,this.getState())}}function Kd(e={}){const{config:t={},callbacks:r={}}=e,i=h.useRef(null);i.current||(i.current=new Yd(t,{}));const n=i.current,[s,a]=h.useState(n.getState()),c=h.useCallback(()=>{a(n.getState())},[n]);h.useEffect(()=>{const f={onPhaseChange:(w,m)=>{var g;c(),(g=r.onPhaseChange)==null||g.call(r,w,m)},onTick:w=>{var m;c(),(m=r.onTick)==null||m.call(r,w)},onInterviewEnd:()=>{var w;c(),(w=r.onInterviewEnd)==null||w.call(r)}};n.callbacks=f},[n,r,c]),h.useEffect(()=>()=>{n.destroy()},[n]);const l=h.useCallback(()=>{n.startQuestion(),c()},[n,c]),u=h.useCallback(()=>{n.nextPhase(),c()},[n,c]),d=h.useCallback(()=>{n.completeInterview(),c()},[n,c]);return{state:s,startQuestion:l,nextPhase:u,completeInterview:d,timerService:n}}function Xd(e,t={}){const[r,i]=h.useState({data:null,loading:!1,error:null}),n=h.useCallback(async(...s)=>{var a,c,l,u;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),(u=t.onSettled)==null||u.call(t,null,f)}},[e,t]);return{...r,execute:n}}const Jd=e=>{const[t,r]=h.useState(null),[i,n]=h.useState(!1),s=document,a=()=>!!(s.fullscreenEnabled||s.webkitFullscreenEnabled||s.mozFullScreenEnabled||s.msFullscreenEnabled),c=()=>s.fullscreenElement||s.webkitFullscreenElement||s.mozFullScreenElement||s.msFullscreenElement,l=async m=>{var g;try{if(!a())throw new Error("Fullscreen is not supported in this environment");m.requestFullscreen?await m.requestFullscreen():m.webkitRequestFullscreen?await m.webkitRequestFullscreen():m.mozRequestFullScreen?await m.mozRequestFullScreen():m.msRequestFullscreen&&await m.msRequestFullscreen()}catch(v){const E={name:"FullscreenError",message:v instanceof Error?v.message:"Failed to enter fullscreen"};r(E),(g=e==null?void 0:e.onError)==null||g.call(e,E)}},u=async()=>{var m;try{s.exitFullscreen?await s.exitFullscreen():s.webkitExitFullscreen?await s.webkitExitFullscreen():s.mozCancelFullScreen?await s.mozCancelFullScreen():s.msExitFullscreen&&await s.msExitFullscreen()}catch(g){const v={name:"FullscreenError",message:g instanceof Error?g.message:"Failed to exit fullscreen"};r(v),(m=e==null?void 0:e.onError)==null||m.call(e,v)}},d=h.useCallback(()=>{var g;const m=!!c();n(m),(g=e==null?void 0:e.onFullScreenChange)==null||g.call(e,m)},[e]);h.useEffect(()=>{const m=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];return m.forEach(g=>{document.addEventListener(g,d)}),()=>{m.forEach(g=>{document.removeEventListener(g,d)})}},[d]);const f=async m=>{r(null);const g=m??document.documentElement;await l(g)};return{isFullScreen:i,toggleFullScreen:async m=>{i?await u():await f(m)},enterFullScreen:f,exitFullScreen:u,error:t}},Qd=e=>{h.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])},Zd=(e={})=>{const[t,r]=h.useState(!1),[i,n]=h.useState(!1),[s,a]=h.useState(null),[c,l]=h.useState(null),[u,d]=h.useState(null);e.config&&Tr.updateConfig(e.config);const f=h.useCallback(async v=>{var E;try{l(null),a(null),d(null),await Tr.startRecording(v,{onStart:()=>{var p;r(!0),(p=e.onStart)==null||p.call(e)},onStop:()=>{var p;r(!1),(p=e.onStop)==null||p.call(e)},onError:p=>{var S;const A=p instanceof re?p:new re(p.message,"RECORDING_ERROR",!0);l(A),r(!1),(S=e.onError)==null||S.call(e,A)}})}catch(p){const A=p instanceof re?p:new re(p instanceof Error?p.message:String(p),"START_FAILED",!1);throw l(A),r(!1),(E=e.onError)==null||E.call(e,A),A}},[]),w=h.useCallback(async()=>{var v,E;try{const p=await Tr.stopRecording();return d(p),r(!1),(v=e.onStop)==null||v.call(e),p}catch(p){const A=p instanceof re?p:new re(p instanceof Error?p.message:String(p),"STOP_FAILED",!1);throw l(A),r(!1),(E=e.onError)==null||E.call(e,A),A}},[]),m=h.useCallback(async(v,E={})=>{var p,A;try{l(null),n(!0);const S={audioBlob:v,...E},T=await Tr.transcribe(S);return a(T.transcript),n(!1),(p=e.onTranscriptionComplete)==null||p.call(e,T),T}catch(S){const T=S instanceof re?S:new re(S instanceof Error?S.message:String(S),"TRANSCRIPTION_FAILED",!0);throw l(T),n(!1),(A=e.onError)==null||A.call(e,T),T}},[]),g=h.useCallback(()=>{Tr.cancelRecording(),r(!1),d(null)},[]);return{startRecording:f,stopRecording:w,transcribe:m,cancelRecording:g,isRecording:t,isTranscribing:i,transcript:s,error:c,audioBlob:u}},eh=e=>{const t=h.useRef(null),r=h.useRef(!1);h.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])},th=()=>{h.useEffect(()=>{const e=document.createElement("style");return e.textContent=`
23
+ }`,e.VERTEX_SHADER),this.Y=Dc(this,this.G(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.P=e.getAttribLocation(this.h,"aVertex"),this.J=e.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.Z),e.deleteShader(this.Y)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}};function bt(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 Ss(e){var t=bt(e,1);if(!t){if(t=bt(e,0))t=new Float32Array(t).map(i=>i/255);else{t=new Float32Array(e.width*e.height);const i=kr(e);var r=As(e);if(Ui(r,i,Oc(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 Oc(e){let t=bt(e,2);if(!t){const r=kr(e);t=Uc(e);const i=Ss(e),n=Bc(e);r.texImage2D(r.TEXTURE_2D,0,n,e.width,e.height,0,r.RED,r.FLOAT,i),Cs(e)}return t}function kr(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=yt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Bc(e){if(e=kr(e),!Gi)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Gi=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Gi=e.R16F}return Gi}function As(e){return e.l||(e.l=new Ts),e.l}function Uc(e){const t=kr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=bt(e,2);return r||(r=Bi(As(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Cs(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Gi,ce=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&&--Gc===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Da(){return!!bt(this,0)}ja(){return!!bt(this,1)}R(){return!!bt(this,2)}ia(){return(t=bt(e=this,0))||(t=Ss(e),t=new Uint8Array(t.map(r=>255*r)),e.g.push(t)),t;var e,t}ha(){return Ss(this)}N(){return Oc(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{const i=kr(this),n=As(this);i.activeTexture(i.TEXTURE1),r=Bi(n,i,this.m?i.LINEAR:i.NEAREST),i.bindTexture(i.TEXTURE_2D,r);const s=Bc(this);i.texImage2D(i.TEXTURE_2D,0,s,this.width,this.height,0,i.RED,i.FLOAT,null),i.bindTexture(i.TEXTURE_2D,null),Ui(n,i,r),Es(n,i,!1,()=>{Uc(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),Cs(this)}),js(n),Cs(this)}}e.push(r)}return new ce(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&kr(this).deleteTexture(bt(this,2)),Gc=-1}};ce.prototype.close=ce.prototype.close,ce.prototype.clone=ce.prototype.clone,ce.prototype.getAsWebGLTexture=ce.prototype.N,ce.prototype.getAsFloat32Array=ce.prototype.ha,ce.prototype.getAsUint8Array=ce.prototype.ia,ce.prototype.hasWebGLTexture=ce.prototype.R,ce.prototype.hasFloat32Array=ce.prototype.ja,ce.prototype.hasUint8Array=ce.prototype.Da;var Gc=250;function st(e,t){switch(t){case 0:return e.g.find(r=>r instanceof ImageData);case 1:return e.g.find(r=>typeof ImageBitmap<"u"&&r instanceof ImageBitmap);case 2:return e.g.find(r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function Vc(e){var t=st(e,0);if(!t){t=_r(e);const r=zi(e),i=new Uint8Array(e.width*e.height*4);Ui(r,t,Vi(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,i),js(r),t=new ImageData(new Uint8ClampedArray(i.buffer),e.width,e.height),e.g.push(t)}return t}function Vi(e){let t=st(e,2);if(!t){const r=_r(e);t=Wi(e);const i=st(e,1)||Vc(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,i),qr(e)}return t}function _r(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=yt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function zi(e){return e.l||(e.l=new Ts),e.l}function Wi(e){const t=_r(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=st(e,2);return r||(r=Bi(zi(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function qr(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function zc(e){const t=_r(e);return Es(zi(e),t,!0,()=>function(r,i){const n=r.canvas;if(n.width===r.width&&n.height===r.height)return i();const s=n.width,a=n.height;return n.width=r.width,n.height=r.height,r=i(),n.width=s,n.height=a,r}(e,()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))}var le=class{constructor(e,t,r,i,n,s,a){this.g=e,this.j=t,this.m=r,this.canvas=i,this.l=n,this.width=s,this.height=a,(this.j||this.m)&&--Wc===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ca(){return!!st(this,0)}ka(){return!!st(this,1)}R(){return!!st(this,2)}Aa(){return Vc(this)}za(){var e=st(this,1);return e||(Vi(this),Wi(this),e=zc(this),qr(this),this.g.push(e),this.j=!0),e}N(){return Vi(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const i=_r(this),n=zi(this);i.activeTexture(i.TEXTURE1),r=Bi(n,i),i.bindTexture(i.TEXTURE_2D,r),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.width,this.height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.bindTexture(i.TEXTURE_2D,null),Ui(n,i,r),Es(n,i,!1,()=>{Wi(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),qr(this)}),js(n),qr(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Vi(this),Wi(this),r=zc(this),qr(this)}e.push(r)}return new le(e,this.ka(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&st(this,1).close(),this.m&&_r(this).deleteTexture(st(this,2)),Wc=-1}};le.prototype.close=le.prototype.close,le.prototype.clone=le.prototype.clone,le.prototype.getAsWebGLTexture=le.prototype.N,le.prototype.getAsImageBitmap=le.prototype.za,le.prototype.getAsImageData=le.prototype.Aa,le.prototype.hasWebGLTexture=le.prototype.R,le.prototype.hasImageBitmap=le.prototype.ka,le.prototype.hasImageData=le.prototype.Ca;var Wc=250;function Xe(...e){return e.map(([t,r])=>({start:t,end:r}))}const Sd=function(e){return class extends e{Ha(){this.i._registerModelResourcesGraphService()}}}(($c=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",t!==void 0?this.i.canvas=t:Nc()?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){nt(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]=Lc(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=>{Fc(this,Object.keys(e),n=>{Fc(this,Object.values(e),s=>{this.i._addFlatHashMapToInputStream(n,s,Object.keys(e).length,i,r)})})})}addProtoToStream(e,t,r,i){_(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){nt(this,e,t),_(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){Ft(this,e,t),_(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){nt(this,e,t),_(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){Ft(this,e,t),_(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){nt(this,e,t),_(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){Ft(this,e,t),_(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){nt(this,e,t),_(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){Ft(this,e,t),_(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){nt(this,e,t),_(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){Ft(this,e,t),_(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){nt(this,e,t),_(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){Ft(this,e,t),_(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){nt(this,e,t),_(this,e,i=>{this.i._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){Ft(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?'),nt(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 $c{get ea(){return this.i}oa(e,t,r){_(this,t,i=>{const[n,s]=Lc(this,e,i);this.ea._addBoundTextureAsImageToStream(i,n,s,r)})}V(e,t){nt(this,e,t),_(this,e,r=>{this.ea._attachImageListener(r)})}ba(e,t){Ft(this,e,t),_(this,e,r=>{this.ea._attachImageVectorListener(r)})}}));var $c,Ue=class extends Sd{};async function N(e,t,r){return async function(i,n,s,a){return jd(i,n,s,a)}(e,r.canvas??(Nc()?void 0:document.createElement("canvas")),t,r)}function Hc(e,t,r,i){if(e.U){const s=new Qa;if(r!=null&&r.regionOfInterest){if(!e.na)throw Error("This task doesn't support region-of-interest.");var n=r.regionOfInterest;if(n.left>=n.right||n.top>=n.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(n.left<0||n.top<0||n.right>1||n.bottom>1)throw Error("Expected RectF values to be in [0,1].");b(s,1,(n.left+n.right)/2),b(s,2,(n.top+n.bottom)/2),b(s,4,n.right-n.left),b(s,3,n.bottom-n.top)}else b(s,1,.5),b(s,2,.5),b(s,4,1),b(s,3,1);if(r!=null&&r.rotationDegrees){if((r==null?void 0:r.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(b(s,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[a,c]=Mc(t);r=ee(s,3)*c/a,n=ee(s,4)*a/c,b(s,4,r),b(s,3,n)}}e.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",e.U,i)}e.g.oa(t,e.Z,i??performance.now()),e.finishProcessing()}function Ge(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'.");Hc(e,t,r,e.B+1)}function ot(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'.");Hc(e,t,r,i)}function Er(e,t,r,i){var n=t.data;const s=t.width,a=s*(t=t.height);if((n instanceof Uint8Array||n instanceof Float32Array)&&n.length!==a)throw Error("Unsupported channel count: "+n.length/a);return e=new ce([n],r,!1,e.g.i.canvas,e.P,s,t),i?e.clone():e}var ve=class extends ks{constructor(e,t,r,i){super(e),this.g=e,this.Z=t,this.U=r,this.na=i,this.P=new Ts}l(e,t=!0){if("runningMode"in e&&Ur(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.P.close(),super.close()}};ve.prototype.close=ve.prototype.close;var Ve=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},j(e=this.h=new Fi,0,1,t=new H),b(this.h,2,.5),b(this.h,3,.3)}get baseOptions(){return M(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&b(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&b(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}D(e,t){return this.j={detections:[]},Ge(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},ot(this,e,r,t),this.j}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect_in"),F(e,"detections");const t=new Ce;qe(t,dd,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect_in"),I(r,"DETECTIONS:detections"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Ka(s),this.j.detections.push(Tc(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ve.prototype.detectForVideo=Ve.prototype.F,Ve.prototype.detect=Ve.prototype.D,Ve.prototype.setOptions=Ve.prototype.o,Ve.createFromModelPath=async function(e,t){return N(Ve,e,{baseOptions:{modelAssetPath:t}})},Ve.createFromModelBuffer=function(e,t){return N(Ve,e,{baseOptions:{modelAssetBuffer:t}})},Ve.createFromOptions=function(e,t){return N(Ve,e,t)};var Ns=Xe([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]),Is=Xe([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]),Ms=Xe([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),qc=Xe([474,475],[475,476],[476,477],[477,474]),Ls=Xe([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]),Fs=Xe([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Yc=Xe([469,470],[470,471],[471,472],[472,469]),Ps=Xe([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]),Kc=[...Ns,...Is,...Ms,...Ls,...Fs,...Ps],Xc=Xe([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 Jc(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var X=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,j(e=this.h=new oc,0,1,t=new H),this.v=new sc,j(this.h,0,3,this.v),this.s=new Fi,j(this.h,0,2,this.s),it(this.s,4,1),b(this.s,2,.5),b(this.v,2,.5),b(this.h,4,.5)}get baseOptions(){return M(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"numFaces"in e&&it(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&b(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&b(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&b(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}D(e,t){return Jc(this),Ge(this,e,t),this.j}F(e,t,r){return Jc(this),ot(this,e,r,t),this.j}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect"),F(e,"face_landmarks");const t=new Ce;qe(t,fd,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),I(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("face_landmarks",(i,n)=>{for(const s of i)i=Wr(s),this.j.faceLandmarks.push(Pi(i));x(this,n)}),this.g.attachEmptyPacketListener("face_landmarks",i=>{x(this,i)}),this.outputFaceBlendshapes&&(F(e,"blendshapes"),I(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(i,n)=>{if(this.outputFaceBlendshapes)for(const s of i)i=Ii(s),this.j.faceBlendshapes.push(bs(i.g()??[]));x(this,n)}),this.g.attachEmptyPacketListener("blendshapes",i=>{x(this,i)})),this.outputFacialTransformationMatrixes&&(F(e,"face_geometry"),I(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(i,n)=>{if(this.outputFacialTransformationMatrixes)for(const s of i)(i=M(hd(s),id,2))&&this.j.facialTransformationMatrixes.push({rows:Oe(i,1)??0??0,columns:Oe(i,2)??0??0,data:Ht(i,3,St,$t()).slice()??[]});x(this,n)}),this.g.attachEmptyPacketListener("face_geometry",i=>{x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};X.prototype.detectForVideo=X.prototype.F,X.prototype.detect=X.prototype.D,X.prototype.setOptions=X.prototype.o,X.createFromModelPath=function(e,t){return N(X,e,{baseOptions:{modelAssetPath:t}})},X.createFromModelBuffer=function(e,t){return N(X,e,{baseOptions:{modelAssetBuffer:t}})},X.createFromOptions=function(e,t){return N(X,e,t)},X.FACE_LANDMARKS_LIPS=Ns,X.FACE_LANDMARKS_LEFT_EYE=Is,X.FACE_LANDMARKS_LEFT_EYEBROW=Ms,X.FACE_LANDMARKS_LEFT_IRIS=qc,X.FACE_LANDMARKS_RIGHT_EYE=Ls,X.FACE_LANDMARKS_RIGHT_EYEBROW=Fs,X.FACE_LANDMARKS_RIGHT_IRIS=Yc,X.FACE_LANDMARKS_FACE_OVAL=Ps,X.FACE_LANDMARKS_CONTOURS=Kc,X.FACE_LANDMARKS_TESSELATION=Xc;var at=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!0),j(e=this.j=new cc,0,1,t=new H)}get baseOptions(){return M(this.j,H,1)}set baseOptions(e){j(this.j,0,1,e)}o(e){return super.l(e)}Ka(e,t,r){const i=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,Ge(this,e,i??{}),!this.h)return this.s}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect"),F(e,"stylized_image");const t=new Ce;qe(t,wd,this.j);const r=new xe;Ne(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),I(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),Ie(e,r),this.g.V("stylized_image",(i,n)=>{var s=!this.h,a=i.data,c=i.width;const l=c*(i=i.height);if(a instanceof Uint8Array)if(a.length===3*l){const u=new Uint8ClampedArray(4*l);for(let d=0;d<l;++d)u[4*d]=a[3*d],u[4*d+1]=a[3*d+1],u[4*d+2]=a[3*d+2],u[4*d+3]=255;a=new ImageData(u,c,i)}else{if(a.length!==4*l)throw Error("Unsupported channel count: "+a.length/l);a=new ImageData(new Uint8ClampedArray(a.buffer,a.byteOffset,a.length),c,i)}else if(!(a instanceof WebGLTexture))throw Error(`Unsupported format: ${a.constructor.name}`);c=new le([a],!1,!1,this.g.i.canvas,this.P,c,i),this.s=s=s?c.clone():c,this.h&&this.h(s),x(this,n)}),this.g.attachEmptyPacketListener("stylized_image",i=>{this.s=null,this.h&&this.h(null),x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};at.prototype.stylize=at.prototype.Ka,at.prototype.setOptions=at.prototype.o,at.createFromModelPath=function(e,t){return N(at,e,{baseOptions:{modelAssetPath:t}})},at.createFromModelBuffer=function(e,t){return N(at,e,{baseOptions:{modelAssetBuffer:t}})},at.createFromOptions=function(e,t){return N(at,e,t)};var Ds=Xe([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 Qc(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 el(e,t=!0){const r=[];for(const n of e){var i=Ii(n);e=[];for(const s of i.g())i=t&&Oe(s,1)!=null?Oe(s,1)??0:-1,e.push({score:ee(s,2)??0,index:i,categoryName:Be(s,3)??""??"",displayName:Be(s,4)??""??""});r.push(e)}return r}var Me=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],j(e=this.j=new dc,0,1,t=new H),this.s=new ws,j(this.j,0,2,this.s),this.C=new fs,j(this.s,0,3,this.C),this.v=new uc,j(this.s,0,2,this.v),this.h=new md,j(this.j,0,3,this.h),b(this.v,2,.5),b(this.s,4,.5),b(this.C,2,.5)}get baseOptions(){return M(this.j,H,1)}set baseOptions(e){j(this.j,0,1,e)}o(e){var n,s,a,c;if(it(this.v,3,e.numHands??1),"minHandDetectionConfidence"in e&&b(this.v,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&b(this.s,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&b(this.C,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new br,r=t,i=ys(e.cannedGesturesClassifierOptions,(n=M(this.h,br,3))==null?void 0:n.h());j(r,0,2,i),j(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((s=M(this.h,br,3))==null||s.g());return e.customGesturesClassifierOptions?(j(r=t=new br,0,2,i=ys(e.customGesturesClassifierOptions,(a=M(this.h,br,4))==null?void 0:a.h())),j(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((c=M(this.h,br,4))==null||c.g()),this.l(e)}Fa(e,t){return Qc(this),Ge(this,e,t),Zc(this)}Ga(e,t,r){return Qc(this),ot(this,e,r,t),Zc(this)}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect"),F(e,"hand_gestures"),F(e,"hand_landmarks"),F(e,"world_hand_landmarks"),F(e,"handedness");const t=new Ce;qe(t,gd,this.j);const r=new xe;Ne(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),I(r,"HAND_GESTURES:hand_gestures"),I(r,"LANDMARKS:hand_landmarks"),I(r,"WORLD_LANDMARKS:world_hand_landmarks"),I(r,"HANDEDNESS:handedness"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i){i=Wr(s);const a=[];for(const c of mt(i,Ja,1))a.push({x:ee(c,1)??0,y:ee(c,2)??0,z:ee(c,3)??0,visibility:ee(c,4)??0});this.landmarks.push(a)}x(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i){i=yr(s);const a=[];for(const c of mt(i,Xa,1))a.push({x:ee(c,1)??0,y:ee(c,2)??0,z:ee(c,3)??0,visibility:ee(c,4)??0});this.worldLandmarks.push(a)}x(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("hand_gestures",(i,n)=>{this.gestures.push(...el(i,!1)),x(this,n)}),this.g.attachEmptyPacketListener("hand_gestures",i=>{x(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{this.handedness.push(...el(i)),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function tl(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Me.prototype.recognizeForVideo=Me.prototype.Ga,Me.prototype.recognize=Me.prototype.Fa,Me.prototype.setOptions=Me.prototype.o,Me.createFromModelPath=function(e,t){return N(Me,e,{baseOptions:{modelAssetPath:t}})},Me.createFromModelBuffer=function(e,t){return N(Me,e,{baseOptions:{modelAssetBuffer:t}})},Me.createFromOptions=function(e,t){return N(Me,e,t)},Me.HAND_CONNECTIONS=Ds;var Le=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],j(e=this.h=new ws,0,1,t=new H),this.s=new fs,j(this.h,0,3,this.s),this.j=new uc,j(this.h,0,2,this.j),it(this.j,3,1),b(this.j,2,.5),b(this.s,2,.5),b(this.h,4,.5)}get baseOptions(){return M(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"numHands"in e&&it(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&b(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&b(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&b(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ge(this,e,t),tl(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ot(this,e,r,t),tl(this)}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect"),F(e,"hand_landmarks"),F(e,"world_hand_landmarks"),F(e,"handedness");const t=new Ce;qe(t,pd,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),I(r,"LANDMARKS:hand_landmarks"),I(r,"WORLD_LANDMARKS:world_hand_landmarks"),I(r,"HANDEDNESS:handedness"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,n)=>{for(const s of i)i=Wr(s),this.landmarks.push(Pi(i));x(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,n)=>{for(const s of i)i=yr(s),this.worldLandmarks.push($r(i));x(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{x(this,i)}),this.g.attachProtoVectorListener("handedness",(i,n)=>{var s=this.handedness,a=s.push;const c=[];for(const l of i){i=Ii(l);const u=[];for(const d of i.g())u.push({score:ee(d,2)??0,index:Oe(d,1)??0??-1,categoryName:Be(d,3)??""??"",displayName:Be(d,4)??""??""});c.push(u)}a.call(s,...c),x(this,n)}),this.g.attachEmptyPacketListener("handedness",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Le.prototype.detectForVideo=Le.prototype.F,Le.prototype.detect=Le.prototype.D,Le.prototype.setOptions=Le.prototype.o,Le.createFromModelPath=function(e,t){return N(Le,e,{baseOptions:{modelAssetPath:t}})},Le.createFromModelBuffer=function(e,t){return N(Le,e,{baseOptions:{modelAssetBuffer:t}})},Le.createFromOptions=function(e,t){return N(Le,e,t)},Le.HAND_CONNECTIONS=Ds;var rl=Xe([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 il(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function nl(e){try{if(!e.C)return e.h;e.C(e.h)}finally{Oi(e)}}function $i(e,t){e=Wr(e),t.push(Pi(e))}var q=class extends ve{constructor(e,t){super(new Ue(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,j(e=this.j=new pc,0,1,t=new H),this.K=new fs,j(this.j,0,2,this.K),this.Y=new xd,j(this.j,0,3,this.Y),this.s=new Fi,j(this.j,0,4,this.s),this.H=new sc,j(this.j,0,5,this.H),this.v=new mc,j(this.j,0,6,this.v),this.L=new gc,j(this.j,0,7,this.L),b(this.s,2,.5),b(this.s,3,.3),b(this.H,2,.5),b(this.v,2,.5),b(this.v,3,.3),b(this.L,2,.5),b(this.K,2,.5)}get baseOptions(){return M(this.j,H,1)}set baseOptions(e){j(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&b(this.s,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&b(this.s,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&b(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&b(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&b(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&b(this.L,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&b(this.K,2,e.minHandLandmarksConfidence??.5),this.l(e)}D(e,t,r){const i=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:r,il(this),Ge(this,e,i),nl(this)}F(e,t,r,i){const n=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:i,il(this),ot(this,e,n,t),nl(this)}m(){var e=new be;W(e,"input_frames_image"),F(e,"pose_landmarks"),F(e,"pose_world_landmarks"),F(e,"face_landmarks"),F(e,"left_hand_landmarks"),F(e,"left_hand_world_landmarks"),F(e,"right_hand_landmarks"),F(e,"right_hand_world_landmarks");const t=new Ce,r=new La;Pn(r,1,ar("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(n,s){if(s!=null)if(Array.isArray(s))V(n,2,hi(s,In,void 0,void 0,!1));else{if(!(typeof s=="string"||s instanceof ht||Vt(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Pn(n,2,xn(s,!1),zt())}}(r,this.j.g());const i=new xe;Ne(i,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),pi(i,8,La,r),z(i,"IMAGE:input_frames_image"),I(i,"POSE_LANDMARKS:pose_landmarks"),I(i,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),I(i,"FACE_LANDMARKS:face_landmarks"),I(i,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),I(i,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),I(i,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),I(i,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),i.o(t),Ie(e,i),Ri(this,e),this.g.attachProtoListener("pose_landmarks",(n,s)=>{$i(n,this.h.poseLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("pose_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("pose_world_landmarks",(n,s)=>{var a=this.h.poseWorldLandmarks;n=yr(n),a.push($r(n)),x(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",n=>{x(this,n)}),this.outputPoseSegmentationMasks&&(I(i,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),vr(this,"pose_segmentation_mask"),this.g.V("pose_segmentation_mask",(n,s)=>{this.h.poseSegmentationMasks=[Er(this,n,!0,!this.C)],x(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",n=>{this.h.poseSegmentationMasks=[],x(this,n)})),this.g.attachProtoListener("face_landmarks",(n,s)=>{$i(n,this.h.faceLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{x(this,n)}),this.outputFaceBlendshapes&&(F(e,"extra_blendshapes"),I(i,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(n,s)=>{var a=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=Ii(n),a.push(bs(n.g()??[]))),x(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",n=>{x(this,n)})),this.g.attachProtoListener("left_hand_landmarks",(n,s)=>{$i(n,this.h.leftHandLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("left_hand_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("left_hand_world_landmarks",(n,s)=>{var a=this.h.leftHandWorldLandmarks;n=yr(n),a.push($r(n)),x(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("right_hand_landmarks",(n,s)=>{$i(n,this.h.rightHandLandmarks),x(this,s)}),this.g.attachEmptyPacketListener("right_hand_landmarks",n=>{x(this,n)}),this.g.attachProtoListener("right_hand_world_landmarks",(n,s)=>{var a=this.h.rightHandWorldLandmarks;n=yr(n),a.push($r(n)),x(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",n=>{x(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};q.prototype.detectForVideo=q.prototype.F,q.prototype.detect=q.prototype.D,q.prototype.setOptions=q.prototype.o,q.createFromModelPath=function(e,t){return N(q,e,{baseOptions:{modelAssetPath:t}})},q.createFromModelBuffer=function(e,t){return N(q,e,{baseOptions:{modelAssetBuffer:t}})},q.createFromOptions=function(e,t){return N(q,e,t)},q.HAND_CONNECTIONS=Ds,q.POSE_CONNECTIONS=rl,q.FACE_LANDMARKS_LIPS=Ns,q.FACE_LANDMARKS_LEFT_EYE=Is,q.FACE_LANDMARKS_LEFT_EYEBROW=Ms,q.FACE_LANDMARKS_LEFT_IRIS=qc,q.FACE_LANDMARKS_RIGHT_EYE=Ls,q.FACE_LANDMARKS_RIGHT_EYEBROW=Fs,q.FACE_LANDMARKS_RIGHT_IRIS=Yc,q.FACE_LANDMARKS_FACE_OVAL=Ps,q.FACE_LANDMARKS_CONTOURS=Kc,q.FACE_LANDMARKS_TESSELATION=Xc;var ze=class extends ve{constructor(e,t){super(new Ue(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},j(e=this.h=new xc,0,1,t=new H)}get baseOptions(){return M(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return j(this.h,0,2,ys(e,M(this.h,us,2))),this.l(e)}qa(e,t){return this.j={classifications:[]},Ge(this,e,t),this.j}ra(e,t,r){return this.j={classifications:[]},ot(this,e,r,t),this.j}m(){var e=new be;W(e,"input_image"),W(e,"norm_rect"),F(e,"classifications");const t=new Ce;qe(t,yd,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),z(r,"IMAGE:input_image"),z(r,"NORM_RECT:norm_rect"),I(r,"CLASSIFICATIONS:classifications"),r.o(t),Ie(e,r),this.g.attachProtoListener("classifications",(i,n)=>{this.j=function(s){const a={classifications:mt(s,sd,1).map(c=>{var l;return bs(((l=M(c,qa,4))==null?void 0:l.g())??[],Oe(c,2)??0,Be(c,3)??"")})};return Tn(lr(s,2))!=null&&(a.timestampMs=Tn(lr(s,2))??0),a}(od(i)),x(this,n)}),this.g.attachEmptyPacketListener("classifications",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ze.prototype.classifyForVideo=ze.prototype.ra,ze.prototype.classify=ze.prototype.qa,ze.prototype.setOptions=ze.prototype.o,ze.createFromModelPath=function(e,t){return N(ze,e,{baseOptions:{modelAssetPath:t}})},ze.createFromModelBuffer=function(e,t){return N(ze,e,{baseOptions:{modelAssetBuffer:t}})},ze.createFromOptions=function(e,t){return N(ze,e,t)};var Fe=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!0),this.h=new yc,this.embeddings={embeddings:[]},j(e=this.h,0,1,t=new H)}get baseOptions(){return M(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){var t=this.h,r=M(this.h,rc,2);return r=r?r.clone():new rc,e.l2Normalize!==void 0?Ur(r,1,e.l2Normalize):"l2Normalize"in e&&V(r,1),e.quantize!==void 0?Ur(r,2,e.quantize):"quantize"in e&&V(r,2),j(t,0,2,r),this.l(e)}xa(e,t){return Ge(this,e,t),this.embeddings}ya(e,t,r){return ot(this,e,r,t),this.embeddings}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect"),F(e,"embeddings_out");const t=new Ce;qe(t,bd,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),I(r,"EMBEDDINGS:embeddings_out"),r.o(t),Ie(e,r),this.g.attachProtoListener("embeddings_out",(i,n)=>{i=ld(i),this.embeddings=function(s){return{embeddings:mt(s,cd,1).map(a=>{var l,u;const c={headIndex:Oe(a,3)??0??-1,headName:Be(a,4)??""??""};if(ea(a,Za,Dn(a,1))!==void 0)a=Ht(a=M(a,Za,Dn(a,1)),1,St,$t()),c.floatEmbedding=a.slice();else{const d=new Uint8Array(0);c.quantizedEmbedding=((u=(l=M(a,ad,Dn(a,2)))==null?void 0:l.ma())==null?void 0:u.h())??d}return c}),timestampMs:Tn(lr(s,2))??0}}(i),x(this,n)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Fe.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Ac(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Ac(Sc(e.quantizedEmbedding),Sc(t.quantizedEmbedding))}return e},Fe.prototype.embedForVideo=Fe.prototype.ya,Fe.prototype.embed=Fe.prototype.xa,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return N(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return N(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return N(Fe,e,t)};var Rs=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};function sl(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function ol(e){try{const t=new Rs(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Oi(e)}}Rs.prototype.close=Rs.prototype.close;var ke=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new xs,this.v=new bc,j(this.h,0,3,this.v),j(e=this.h,0,1,t=new H)}get baseOptions(){return M(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?V(this.h,2,ar(e.displayNamesLocale)):"displayNamesLocale"in e&&V(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}J(){(function(e){var r,i;const t=mt(e.ca(),xe,1).filter(n=>(Be(n,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(e.s=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(((i=(r=M(t[0],Ce,7))==null?void 0:r.l())==null?void 0:i.g())??new Map).forEach((n,s)=>{e.s[Number(s)]=Be(n,1)??""})})(this)}segment(e,t,r){const i=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,sl(this),Ge(this,e,i),ol(this)}Ia(e,t,r,i){const n=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:i,sl(this),ot(this,e,n,t),ol(this)}Ba(){return this.s}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect");const t=new Ce;qe(t,_c,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),r.o(t),Ie(e,r),Ri(this,e),this.outputConfidenceMasks&&(F(e,"confidence_masks"),I(r,"CONFIDENCE_MASKS:confidence_masks"),vr(this,"confidence_masks"),this.g.ba("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Er(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(F(e,"category_mask"),I(r,"CATEGORY_MASK:category_mask"),vr(this,"category_mask"),this.g.V("category_mask",(i,n)=>{this.categoryMask=Er(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),F(e,"quality_scores"),I(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,x(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ke.prototype.getLabels=ke.prototype.Ba,ke.prototype.segmentForVideo=ke.prototype.Ia,ke.prototype.segment=ke.prototype.segment,ke.prototype.setOptions=ke.prototype.o,ke.createFromModelPath=function(e,t){return N(ke,e,{baseOptions:{modelAssetPath:t}})},ke.createFromModelBuffer=function(e,t){return N(ke,e,{baseOptions:{modelAssetBuffer:t}})},ke.createFromOptions=function(e,t){return N(ke,e,t)};var Os=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};Os.prototype.close=Os.prototype.close;var Ad=class extends y{constructor(e){super(e)}},jr=[0,Q,-2],Hi=[0,xt,-3,$,xt,-1],al=[0,Hi],cl=[0,Hi,Q,-1],Bs=class extends y{constructor(e){super(e)}},ll=[0,xt,-1,$],Cd=class extends y{constructor(e){super(e)}},ul=class extends y{constructor(e){super(e)}},Us=[1,2,3,4,5,6,7,8,9,10,14,15],dl=class extends y{constructor(e){super(e)}};dl.prototype.g=Ni([0,ae,[0,Us,O,Hi,O,[0,Hi,jr],O,al,O,[0,al,jr],O,ll,O,[0,xt,-3,$,Ae],O,[0,xt,-3,$],O,[0,R,xt,-2,$,Q,$,-1,2,xt,jr],O,cl,O,[0,cl,jr],xt,jr,R,O,[0,xt,-3,$,jr,-1],O,[0,ae,ll]],R,[0,R,Q,-1,$]]);var ct=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new xs,this.s=new bc,j(this.h,0,3,this.s),j(e=this.h,0,1,t=new H)}get baseOptions(){return M(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,i){const n=typeof r!="function"?r:{};this.j=typeof r=="function"?r:i,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.B+1,i=new dl;const s=new ul;var a=new Ad;if(it(a,1,255),j(s,0,12,a),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var c=new Bs;Ur(c,3,!0),b(c,1,t.keypoint.x),b(c,2,t.keypoint.y),Br(s,5,Us,c)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(c of(a=new Cd,t.scribble))Ur(t=new Bs,3,!0),b(t,1,c.x),b(t,2,c.y),pi(a,1,Bs,t);Br(s,15,Us,a)}pi(i,1,ul,s),this.g.addProtoToStream(i.g(),"drishti.RenderData","roi_in",r),Ge(this,e,n);e:{try{const u=new Os(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var l=u;break e}this.j(u)}finally{Oi(this)}l=void 0}return l}m(){var e=new be;W(e,"image_in"),W(e,"roi_in"),W(e,"norm_rect_in");const t=new Ce;qe(t,_c,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),z(r,"IMAGE:image_in"),z(r,"ROI:roi_in"),z(r,"NORM_RECT:norm_rect_in"),r.o(t),Ie(e,r),Ri(this,e),this.outputConfidenceMasks&&(F(e,"confidence_masks"),I(r,"CONFIDENCE_MASKS:confidence_masks"),vr(this,"confidence_masks"),this.g.ba("confidence_masks",(i,n)=>{this.confidenceMasks=i.map(s=>Er(this,s,!0,!this.j)),x(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],x(this,i)})),this.outputCategoryMask&&(F(e,"category_mask"),I(r,"CATEGORY_MASK:category_mask"),vr(this,"category_mask"),this.g.V("category_mask",(i,n)=>{this.categoryMask=Er(this,i,!1,!this.j),x(this,n)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,x(this,i)})),F(e,"quality_scores"),I(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,n)=>{this.qualityScores=i,x(this,n)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ct.prototype.segment=ct.prototype.segment,ct.prototype.setOptions=ct.prototype.o,ct.createFromModelPath=function(e,t){return N(ct,e,{baseOptions:{modelAssetPath:t}})},ct.createFromModelBuffer=function(e,t){return N(ct,e,{baseOptions:{modelAssetBuffer:t}})},ct.createFromOptions=function(e,t){return N(ct,e,t)};var We=class extends ve{constructor(e,t){super(new Ue(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},j(e=this.h=new Ec,0,1,t=new H)}get baseOptions(){return M(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?V(this.h,2,ar(e.displayNamesLocale)):"displayNamesLocale"in e&&V(this.h,2),e.maxResults!==void 0?it(this.h,3,e.maxResults):"maxResults"in e&&V(this.h,3),e.scoreThreshold!==void 0?b(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&V(this.h,4),e.categoryAllowlist!==void 0?xi(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&V(this.h,5),e.categoryDenylist!==void 0?xi(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&V(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},Ge(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},ot(this,e,r,t),this.j}m(){var e=new be;W(e,"input_frame_gpu"),W(e,"norm_rect"),F(e,"detections");const t=new Ce;qe(t,kd,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),z(r,"IMAGE:input_frame_gpu"),z(r,"NORM_RECT:norm_rect"),I(r,"DETECTIONS:detections"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("detections",(i,n)=>{for(const s of i)i=Ka(s),this.j.detections.push(Tc(i));x(this,n)}),this.g.attachEmptyPacketListener("detections",i=>{x(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};We.prototype.detectForVideo=We.prototype.F,We.prototype.detect=We.prototype.D,We.prototype.setOptions=We.prototype.o,We.createFromModelPath=async function(e,t){return N(We,e,{baseOptions:{modelAssetPath:t}})},We.createFromModelBuffer=function(e,t){return N(We,e,{baseOptions:{modelAssetBuffer:t}})},We.createFromOptions=function(e,t){return N(We,e,t)};var Gs=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 hl(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function fl(e){try{const t=new Gs(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{Oi(e)}}Gs.prototype.close=Gs.prototype.close;var Pe=class extends ve{constructor(e,t){super(new Ue(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,j(e=this.h=new jc,0,1,t=new H),this.v=new gc,j(this.h,0,3,this.v),this.j=new mc,j(this.h,0,2,this.j),it(this.j,4,1),b(this.j,2,.5),b(this.v,2,.5),b(this.h,4,.5)}get baseOptions(){return M(this.h,H,1)}set baseOptions(e){j(this.h,0,1,e)}o(e){return"numPoses"in e&&it(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&b(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&b(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&b(this.v,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}D(e,t,r){const i=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:r,hl(this),Ge(this,e,i),fl(this)}F(e,t,r,i){const n=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:i,hl(this),ot(this,e,n,t),fl(this)}m(){var e=new be;W(e,"image_in"),W(e,"norm_rect"),F(e,"normalized_landmarks"),F(e,"world_landmarks"),F(e,"segmentation_masks");const t=new Ce;qe(t,_d,this.h);const r=new xe;Ne(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),z(r,"IMAGE:image_in"),z(r,"NORM_RECT:norm_rect"),I(r,"NORM_LANDMARKS:normalized_landmarks"),I(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Ie(e,r),Ri(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(i,n)=>{this.landmarks=[];for(const s of i)i=Wr(s),this.landmarks.push(Pi(i));x(this,n)}),this.g.attachEmptyPacketListener("normalized_landmarks",i=>{this.landmarks=[],x(this,i)}),this.g.attachProtoVectorListener("world_landmarks",(i,n)=>{this.worldLandmarks=[];for(const s of i)i=yr(s),this.worldLandmarks.push($r(i));x(this,n)}),this.g.attachEmptyPacketListener("world_landmarks",i=>{this.worldLandmarks=[],x(this,i)}),this.outputSegmentationMasks&&(I(r,"SEGMENTATION_MASK:segmentation_masks"),vr(this,"segmentation_masks"),this.g.ba("segmentation_masks",(i,n)=>{this.segmentationMasks=i.map(s=>Er(this,s,!0,!this.s)),x(this,n)}),this.g.attachEmptyPacketListener("segmentation_masks",i=>{this.segmentationMasks=[],x(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Pe.prototype.detectForVideo=Pe.prototype.F,Pe.prototype.detect=Pe.prototype.D,Pe.prototype.setOptions=Pe.prototype.o,Pe.createFromModelPath=function(e,t){return N(Pe,e,{baseOptions:{modelAssetPath:t}})},Pe.createFromModelBuffer=function(e,t){return N(Pe,e,{baseOptions:{modelAssetBuffer:t}})},Pe.createFromOptions=function(e,t){return N(Pe,e,t)},Pe.POSE_CONNECTIONS=rl;const qi="https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task",Nd="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm",Id=()=>{const e=h.useRef(null),[t,r]=h.useState(!1),[i,n]=h.useState("Initializing..."),[s,a]=h.useState(0),[c,l]=h.useState(!1);h.useEffect(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(w=>{console.log("ServiceWorker registered:",w)}).catch(w=>{console.log("ServiceWorker registration failed:",w)})},[]);const u=async()=>"caches"in window?await(await caches.open("mediapipe-models-v1")).match(qi)!==void 0:!1,d=async()=>{try{const w=await fetch(qi),m=w.headers.get("content-length"),g=m?parseInt(m,10):0;if(!w.body)throw new Error("No response body");const v=w.body.getReader();let E=0;const p=[];for(;;){const{done:A,value:T}=await v.read();if(A)break;if(p.push(T),E+=T.length,g){const S=Math.round(E/g*100);a(S),n(`Downloading model... ${S}%`)}}return"caches"in window&&await(await caches.open("mediapipe-models-v1")).put(qi,new Response(new Blob(p),{headers:{"Content-Type":"application/octet-stream"}})),!0}catch(w){return console.error("Failed to preload model:",w),!1}};return h.useEffect(()=>{(async()=>{try{n("Checking cached models..."),await u()?n("Using cached model..."):(n("Model not cached. Downloading..."),await d()),n("Loading MediaPipe WASM...");const g=await Kt.forVisionTasks(Nd);n("Creating face landmarker...");const v=await X.createFromOptions(g,{baseOptions:{modelAssetPath:qi,delegate:"GPU"},runningMode:"VIDEO",outputFaceBlendshapes:!0,numFaces:2});e.current=v,r(!0),n("Model loaded successfully ✅")}catch(m){console.error("Model init error:",m),n(`Error: ${m==null?void 0:m.message}`),(m==null?void 0:m.name)==="NotAllowedError"&&l(!0)}})()},[]),{faceLandmarkerRef:e,isModelLoaded:t,statusMessage:i,setStatusMessage:n,loadingProgress:s,permissionDenied:c,clearCache:async()=>{"caches"in window&&(await caches.delete("mediapipe-models-v1"),n("Cache cleared. Please refresh to re-download models."))}}},Md=()=>{const[e,t]=h.useState(0),r=h.useRef({lastTime:0,frames:0,fps:0}),i=h.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}},Ld=()=>{const e=h.useRef({value:100,isLookingAway:!1}),t=h.useCallback((s,a,c,l)=>{if(!s||!c||!a)return;const u=s.getContext("2d");if(!u)return;const{width:d,height:f}=s;if(u.clearRect(0,0,d,f),u.drawImage(a,0,0,d,f),l){u.fillStyle="#00FF00";for(const w of c)u.fillRect(w.x*d-.5,w.y*f-.5,1,1)}},[]),r=h.useCallback(s=>{const a=e.current.value/100,c=100,l=20,u=10,d=10;s.fillStyle="rgba(0, 0, 0, 0.3)",s.fillRect(u,d,l,c),s.fillStyle=`rgba(${Math.floor(255*(1-a))}, ${Math.floor(255*a)}, 0, 0.8)`;const f=c*a;s.fillRect(u,d+c-f,l,f),s.fillStyle="#FFFFFF",s.fillRect(u,d+c*(1-a),l,2)},[]),i=h.useCallback((s,a,c,l,u,d,f)=>{if(t(s,a,c,l),u&&d&&f){const w=s.getContext("2d");w&&r(w)}},[t,r]),n=h.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}},Fd=70,Pd=()=>{const[e,t]=h.useState(100),[r,i]=h.useState(!1),n=h.useRef(0),s=h.useCallback((a,c,l)=>{if(!l||a.length<468)return;const u=a[33],d=a[263],f=a[1];if(!u||!d||!f)return;const w=(u.x+d.x)*.5,m=(u.y+d.y)*.5,g=w-c.x,v=m-c.y,E=Math.sqrt(g*g+v*v),p=Math.abs(f.y-c.noseY)*100,A=Math.abs(f.x-c.noseX)*100,T=Math.max(0,100-(E*200+p+A)),S=T<Fd,G=performance.now();return G-n.current>100&&(t(T),i(S),n.current=G),{engagement:T,isLookingAway:S}},[]);return{engagement:e,isLookingAway:r,analyzeGaze:s,setEngagement:t,setIsLookingAway:i}},Dd=.05,Rd=()=>{const[e,t]=h.useState(!1),[r,i]=h.useState(!1),n=h.useCallback((c,l)=>Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2)),[]),s=h.useCallback((c,l)=>{if(!c||!l)return 0;const u=[1,33,263,61,291,10,152];let d=0,f=0;const w=l[33],m=l[263],g=c[33],v=c[263];if(!w||!m||!g||!v)return 0;const E=n(w,m),p=n(g,v);if(E===0||p===0)return 0;for(const T of u){const S=l[T],G=c[T];if(S&&G){const C=w.x+(G.x-g.x)*E/p,B=w.y+(G.y-g.y)*E/p;d+=n(S,{x:C,y:B}),f++}}return f===0?0:d/f},[n]),a=h.useCallback((c,l,u,d)=>{if(!c.faceLandmarks||c.faceLandmarks.length===0)return l?(d("Reference face not detected."),i(!0),t(!1)):i(!1),null;if(l&&u){let f=null,w=0;for(const m of c.faceLandmarks)s(m,u)<Dd&&(f=m,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}},Od=1e3,Bd=(e,t)=>{const[r,i]=h.useState(!1),[n,s]=h.useState("face_detected"),{incrementGazeViolation:a}=Xs(),{multipleFacesDetected:c,referenceFaceNotDetected:l,isLookingAway:u}=e;h.useEffect(()=>{let w;return(u||c||l)&&t?w=setTimeout(()=>{i(!0),u?(s("looking_away"),a("looking_away")):c?(s("multiple_faces"),a("multiple_faces")):l&&(s("no_face_detected"),a("no_face_detected"))},Od):(i(!1),s("face_detected")),()=>{clearTimeout(w)}},[u,c,l,t,a]);const d=h.useCallback(()=>c?"multiple_faces":l?"no_face_detected":u?"looking_away":"face_detected",[c,l,u]),f=h.useCallback(()=>{i(!1),s("face_detected")},[]);return{showGazeWarningModal:r,faceDetectionState:n,getWarningType:d,closeWarningModal:f,setShowGazeWarningModal:i,setFaceDetectionState:s}};class re extends Error{constructor(t,r,i=!1){super(t),this.code=r,this.recoverable=i,this.name="STTError"}}class Ud{constructor(t={}){Te(this,"config");Te(this,"mediaRecorder",null);Te(this,"audioChunks",[]);Te(this,"recordingStream",null);Te(this,"autoStopTimeoutId",null);this.config={baseUrl:"http://localhost:8000",provider:"groq",model:"whisper-large-v3-turbo",language:"en",includeTimestamps:!1,temperature:0,...t}}updateConfig(t){this.config={...this.config,...t}}isRecordingSupported(){return!!(navigator.mediaDevices&&typeof navigator.mediaDevices.getUserMedia=="function"&&window.MediaRecorder)}async startRecording(t,r){var i;if(!this.isRecordingSupported())throw new re("Audio recording is not supported in this browser","RECORDING_NOT_SUPPORTED",!1);if(this.isRecording())throw new re("Recording is already in progress","ALREADY_RECORDING",!0);try{this.recordingStream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:44100}}),this.audioChunks=[];const n=this.getSupportedMimeType();this.mediaRecorder=new MediaRecorder(this.recordingStream,{mimeType:n}),this.mediaRecorder.ondataavailable=s=>{var a;s.data.size>0&&(this.audioChunks.push(s.data),(a=r==null?void 0:r.onDataAvailable)==null||a.call(r,s.data))},this.mediaRecorder.onstop=()=>{var s;(s=r==null?void 0:r.onStop)==null||s.call(r)},this.mediaRecorder.onerror=s=>{var c;const a=new re(`Recording failed: ${s.error}`,"RECORDING_ERROR",!0);(c=r==null?void 0:r.onError)==null||c.call(r,a),this.cleanup()},this.mediaRecorder.start(100),(i=r==null?void 0:r.onStart)==null||i.call(r),t&&t>0&&(this.autoStopTimeoutId=setTimeout(()=>{this.isRecording()&&this.stopRecording()},t*1e3))}catch(n){if(this.cleanup(),n instanceof Error){if(n.name==="NotAllowedError"||n.name==="PermissionDeniedError")throw new re("Microphone permission was denied","PERMISSION_DENIED",!1);if(n.name==="NotFoundError")throw new re("No microphone found","NO_MICROPHONE",!1)}throw new re(`Failed to start recording: ${n instanceof Error?n.message:String(n)}`,"START_RECORDING_FAILED",!0)}}async stopRecording(){if(this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),!this.mediaRecorder||!this.isRecording())throw new re("No active recording to stop","NO_ACTIVE_RECORDING",!1);return new Promise((t,r)=>{if(!this.mediaRecorder){r(new re("MediaRecorder is null","MEDIARECORDER_NULL",!1));return}const i=this.mediaRecorder,n=()=>{try{const s=i.mimeType||"audio/webm",a=new Blob(this.audioChunks,{type:s});this.cleanup(),t(a)}catch(s){r(new re(`Failed to create audio blob: ${s instanceof Error?s.message:String(s)}`,"BLOB_CREATION_FAILED",!1))}};i.addEventListener("stop",n,{once:!0}),i.stop()})}async transcribe(t){const{audioBlob:r,model:i=this.config.model,language:n=this.config.language,includeTimestamps:s=this.config.includeTimestamps,temperature:a=this.config.temperature}=t;if(!r||r.size===0)throw new re("Audio blob is empty or invalid","INVALID_AUDIO",!1);try{const c=new FormData,l=new File([r],"recording.wav",{type:r.type||"audio/wav"});c.append("file",l),c.append("model",i||"whisper-large-v3-turbo"),c.append("language",n||"en"),c.append("include_timestamps",String(s||!1)),c.append("temperature",String(a||0)),c.append("qna_id",this.config.qnaId||"");const u=await ei(`${this.config.baseUrl}/speech/transcribe`,{method:"POST",headers:{accept:"application/json","X-STT-Provider":this.config.provider||"groq",...this.config.authToken&&{Authorization:`Bearer ${this.config.authToken}`}},body:c},{attempts:1,backoff:"exponential",baseDelay:1e3,maxDelay:3e3,jitter:!0});if(!u.ok){const f=await u.text();let w=`STT request failed: ${u.status} ${u.statusText}`;try{const m=JSON.parse(f);w=m.message||m.error||w}catch{w=f||w}throw new re(w,`HTTP_${u.status}`,u.status>=500)}return{transcript:(await u.json()).data.text??""}}catch(c){throw c instanceof re?c:new re(`Transcription failed: ${c instanceof Error?c.message:String(c)}`,"TRANSCRIPTION_FAILED",!0)}}cancelRecording(){this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null),this.mediaRecorder&&this.isRecording()&&this.mediaRecorder.stop(),this.cleanup()}isRecording(){return this.mediaRecorder!==null&&this.mediaRecorder.state==="recording"}getSupportedMimeType(){const t=["audio/webm","audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4","audio/wav"];for(const r of t)if(MediaRecorder.isTypeSupported(r))return r;return"audio/webm"}getRecordingStream(){return this.recordingStream}cleanup(){this.recordingStream&&(this.recordingStream.getTracks().forEach(t=>t.stop()),this.recordingStream=null),this.mediaRecorder=null,this.audioChunks=[],this.autoStopTimeoutId&&(clearTimeout(this.autoStopTimeoutId),this.autoStopTimeoutId=null)}}const Tr=new Ud,Gd=(e,t,r,i)=>{const n=h.useRef(null);return h.useEffect(()=>{if(!t)return;const s=async()=>{try{const l=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"}});e.current&&(e.current.srcObject=l,e.current.onloadeddata=()=>{r()})}catch(l){console.error("Camera access error:",l),i("Camera access failed")}},a=n.current,c=e.current;return s(),()=>{a&&cancelAnimationFrame(a),c!=null&&c.srcObject&&c.srcObject.getTracks().forEach(u=>u.stop())}},[t,r]),h.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(u=>{u.addEventListener("ended",l)})}},[]),{animationFrameRef:n}},Vd=(e,t,r,i,n,s,a,c,l,u,d,f,w,m,g)=>{const v=h.useRef(null),E=h.useCallback(()=>{var S;const p=e.current,A=t.current,T=r.current;if(!p||p.readyState<2||!T||!A){v.current=requestAnimationFrame(E);return}i();try{const G=performance.now(),C=T.detectForVideo(p,G);if(((S=C.faceLandmarks)==null?void 0:S.length)>0){g(!1);const B=n(C,l,u.current,m);B?(s(A,p,B,d,f,w,l),l&&w&&c(B,u.current,w)):a(A,p)}else a(A,p),l?(g(!0),m("Reference face not detected.")):g(!1)}catch(G){console.error("Face detection error:",G)}v.current=requestAnimationFrame(E)},[e,t,r,i,n,s,a,c,l,u,d,f,w,m,g]);return{renderLoop:E,animationFrameRef:v}},zd=(e,t,r,i)=>{const{referenceSet:n,referenceRef:s,setReferenceData:a}=Xs(),c=h.useRef(s),l=h.useCallback(()=>{c.current=s},[s]),u=h.useCallback(()=>{var w;const d=e.current,f=t.current;if(console.log({faceLandmarker:d,video:f}),!(!d||!f))try{const m=performance.now(),g=d.detectForVideo(f,m);if((w=g.faceLandmarks)!=null&&w[0]){const v=g.faceLandmarks[0],E=v[33],p=v[263],A=v[1];E&&p&&A&&(c.current={x:(E.x+p.x)*.5,y:(E.y+p.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))}}catch(m){console.error("Set reference error:",m),r("Failed to set reference")}},[e,t,r,a,i]);return{referenceSet:n,referenceRef:c,setReference:u,syncReference:l}},wl=h.forwardRef(({className:e="",interviewId:t="",interview_duration:r,showProctoringUI:i=!0},n)=>{var vl;const{authToken:s}=Zs(),a=s?Bl(s):null,c=ao(),{borderRadius:l}=Zt(),u=l??18,{proctoring:d}=nn(),f=!!(d!=null&&d.gazeAnalysisEnabled),[w,m]=h.useState(!1),[g,v]=h.useState((d==null?void 0:d.showLandmarks)??!1),[E,p]=h.useState(i&&((d==null?void 0:d.showEngagementBar)??!0)),[A,T]=h.useState(f),S=h.useRef(null),G=h.useRef(null),C=h.useRef(null),B=h.useCallback(async ut=>{var Xi;const Xt=S.current,kt=C.current;if(!Xt||!kt)return;const dt=kt.getContext("2d");if(!dt)return;kt.width=Xt.videoWidth,kt.height=Xt.videoHeight,dt.save(),dt.scale(-1,1),dt.drawImage(Xt,-kt.width,0,kt.width,kt.height),dt.restore();const Xr=await new Promise(Jt=>kt.toBlob(Jt,"image/jpeg"));if(Xr&&t)try{const Jt=`${ut}-${Date.now()}.jpeg`,De=await c.requestScreenshotUploadUrl(t,Jt);De.success&&De.data.upload_url&&await c.uploadScreenshot((Xi=De==null?void 0:De.data)==null?void 0:Xi.upload_url,Xr)}catch(Jt){console.error(`Failed to upload screenshot for ${ut}:`,Jt)}},[c,t]),{faceLandmarkerRef:Y,isModelLoaded:D,statusMessage:Je,setStatusMessage:_e,loadingProgress:we,permissionDenied:$e,clearCache:Qe}=Id(),{fps:Ee,updateFPS:vt}=Md(),{drawWithEngagementBar:Ze,clearCanvas:me,engagementRef:je}=Ld(),{engagement:Z,isLookingAway:de,analyzeGaze:P,setEngagement:oe,setIsLookingAway:lt}=Pd(),{multipleFacesDetected:Pt,referenceFaceNotDetected:Dt,analyzeFace:Yr,setMultipleFacesDetected:Rt,setReferenceFaceNotDetected:Ot}=Rd(),{referenceSet:Kr,referenceRef:Ki,setReference:Sr,syncReference:L}=zd(Y,S,_e,void 0),et={multipleFacesDetected:Pt,referenceFaceNotDetected:Dt,isLookingAway:de},{showGazeWarningModal:Bt,getWarningType:Eh,closeWarningModal:xl,setShowGazeWarningModal:yl,setFaceDetectionState:bl}=Bd(et,f),{renderLoop:jh}=Vd(S,G,Y,vt,Yr,Ze,me,P,Kr,Ki,g,E,f,_e,Ot);Gd(S,D,jh,_e),h.useEffect(()=>{L()},[L]),h.useEffect(()=>{je&&je.current&&(je.current.value=Z,je.current.isLookingAway=de)},[Z,de,je]);const Th=h.useCallback(ut=>{T(ut),ut||(oe(100),lt(!1))},[oe,lt]),Sh=h.useCallback(()=>{lt(!1),Rt(!1),Ot(!1),bl("face_detected"),yl(!1),xl()},[lt,Rt,Ot,bl,yl,xl]),Ah={engagement:Z,fps:Ee,isLookingAway:de,multipleFacesDetected:Pt,referenceFaceNotDetected:Dt};return h.useEffect(()=>{let ut=null;const Xt=[];return(async()=>{try{ut=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),S.current&&(S.current.srcObject=ut);const Xr=(r??en)*60*1e3/3,Xi=[0,1,2].map((De,Ut)=>({label:`capture-${Ut+1}`,start:Ut*Xr,end:(Ut+1)*Xr})),Jt=(De,Ut)=>De===Ut?De:Math.random()*(Ut-De)+De;Xi.forEach(({label:De,start:Ut,end:Ch},Nh)=>{let $s;Nh===0?$s=3e3:$s=Jt(Ut,Ch),Xt.push(setTimeout(()=>{B(De)},$s))})}catch(dt){console.error("Error accessing camera:",dt)}})(),()=>{ut&&ut.getTracks().forEach(dt=>dt.stop()),Xt.forEach(clearTimeout)}},[B,r]),h.useImperativeHandle(n,()=>({setReference:()=>{Sr()}}),[Sr]),o.jsxs("div",{className:`iw-relative ${e}`,children:[$e?o.jsxs("div",{className:"iw-rounded-md iw-border iw-border-red-600 iw-p-5 iw-text-red-600",children:[o.jsx("h2",{children:"Camera Permission Denied"}),o.jsx("p",{children:"Please allow camera access to use this application."})]}):o.jsx("div",{className:"iw-flex iw-w-full iw-flex-wrap iw-gap-5",children:o.jsxs("div",{className:"iw-relative iw-flex-1",children:[o.jsx("video",{ref:S,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-r-xl iw-min-h-[200px] iw-max-h-[600px] iw-aspect-video",style:{transform:"scaleX(-1)"}}),f&&o.jsx("canvas",{ref:G,width:420,height:240,className:"iw-absolute iw-top-0 iw-left-0 iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-r-xl iw-min-h-[200px] iw-max-h-[600px] iw-aspect-video",style:{transform:"scaleX(-1)",borderRadius:u}}),o.jsx("canvas",{ref:C,style:{display:"none"}}),i&&o.jsxs("div",{className:"iw-absolute iw-top-4 iw-left-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md",children:[o.jsx("div",{className:"iw-size-2 iw-animate-pulse iw-rounded-full iw-bg-red-500"}),o.jsx("span",{className:"iw-font-medium iw-text-white",children:"Recording"})]}),i&&((vl=a==null?void 0:a.data)==null?void 0:vl.user_name)&&o.jsx("div",{className:"iw-absolute iw-z-50 iw-bottom-4 iw-right-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md",children:o.jsx("span",{className:"iw-font-medium iw-text-white",children:a.data.user_name})}),i&&o.jsx("div",{className:"iw-absolute iw-bottom-4 iw-right-4",children:o.jsx(iu,{showControls:(d==null?void 0:d.showControls)??!1,isBubbleOpen:w,setIsBubbleOpen:m,setReference:Sr,clearCache:Qe,isModelLoaded:D,gazeAnalysisEnabled:A&&f,referenceSet:Kr,showLandmarks:g,setShowLandmarks:v,showEngagementBar:E,setShowEngagementBar:p,handleToggleGazeAnalysis:Th,stats:Ah,statusMessage:Je,loadingProgress:we})})]})}),f&&Bt&&o.jsx(tu,{isOpen:Bt,onClose:Sh,warningType:Eh()})]})}),Wd=["Do not refresh or reload the page during your assessment","Refrain from switching tabs or opening other applications while the session is in progress","Ensure your face remains clearly visible on camera at all times","Avoid frequent distractions or leaving your seat during the session","Do not disable or interfere with audio/video monitoring"],$d=({isOpen:e,onStart:t,onClose:r,gazeEnabled:i=!1,videoFeedRef:n,interviewId:s="",interview_duration:a=en})=>{var de;const c=h.useRef(null),l=h.useRef(null),{baseColor:u,borderRadius:d}=Zt(),[f,w]=h.useState(!1),[m,g]=h.useState(!1),[v,E]=h.useState(!1),[p,A]=h.useState(!1),[T,S]=h.useState(!1),[G,C]=h.useState(null),[B,Y]=h.useState(!1),D=u??"#2563eb",Je=no(D),_e=d??18,we=(P,oe)=>P.startsWith("#")&&P.length===7?`${P}${oe}`:P,$e=[`radial-gradient(120% 85% at 50% 125%, ${we(D,"34")} 0%, transparent 70%)`,`radial-gradient(90% 70% at 10% 130%, ${we(D,"24")} 0%, transparent 72%)`,`radial-gradient(90% 70% at 90% 130%, ${we(D,"24")} 0%, transparent 72%)`,`repeating-linear-gradient(135deg, ${we(D,"14")} 0, ${we(D,"14")} 16px, transparent 16px, transparent 32px)`].join(", "),Qe=f?{label:"Camera & microphone ready",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-emerald-400"}:B?{label:"Checking device access…",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-amber-300"}:{label:"Allow access to continue",toneClass:"iw-bg-white/15 iw-text-white",dotClass:"iw-bg-rose-300"},Ee=f?{badge:"Ready",toneClass:"iw-bg-emerald-50 iw-text-emerald-600",cameraCopy:"Framing looks good for identity verification.",micCopy:"We can hear you clearly for your responses."}:B?{badge:"Checking",toneClass:"iw-bg-amber-50 iw-text-amber-600",cameraCopy:"Hang tight while we confirm camera access.",micCopy:"Listening for microphone permission from your browser."}:{badge:"Action needed",toneClass:"iw-bg-rose-50 iw-text-rose-600",cameraCopy:"Grant camera access to continue with the interview.",micCopy:"Enable microphone access so we can capture your answers."},vt=[{label:"Camera feed",description:Ee.cameraCopy,status:Ee.badge,toneClass:Ee.toneClass,Icon:oo},{label:"Microphone input",description:Ee.micCopy,status:Ee.badge,toneClass:Ee.toneClass,Icon:Ul}],Ze=()=>{l.current&&(l.current.getTracks().forEach(P=>P.stop()),l.current=null)},me=async()=>{Y(!0),C(null);try{const P=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1280},height:{ideal:720}},audio:!0});l.current=P,c.current&&(c.current.srcObject=P),w(!0)}catch(P){console.error("Media permission error:",P);let oe="Unable to access camera or microphone.";(P==null?void 0:P.name)==="NotAllowedError"?oe="Permissions denied. Please allow access to camera and microphone.":(P==null?void 0:P.name)==="NotFoundError"?oe="No camera/microphone found. Please connect a device and retry.":P!=null&&P.message&&(oe=P.message),w(!1),C(oe)}finally{Y(!1)}};if(h.useEffect(()=>{if(!e){Ze();return}return me(),()=>Ze()},[e]),!e)return null;const je=()=>{i?E(!0):(t(),Ze())},Z=async()=>{A(!0),await io(4e3),A(!1),t()};return o.jsxs("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-gray-900/25 iw-backdrop-blur-md iw-p-4",children:[o.jsxs("div",{className:" iw-w-full iw-max-w-[920px] iw-max-h-[96vh] iw-overflow-auto iw-rounded-3xl iw-bg-white iw-shadow-[0_40px_80px_-28px_rgba(15,23,42,0.25)]",children:[o.jsxs("div",{className:"iw-relative iw-overflow-hidden",style:{background:Je},children:[o.jsx("div",{"aria-hidden":!0,className:"iw-absolute iw-pointer-events-none",style:{top:-90,right:-100,width:240,height:240,background:"radial-gradient(circle, rgba(255,255,255,0.6), transparent 70%)",filter:"blur(12px)"}}),o.jsx("div",{"aria-hidden":!0,className:"iw-absolute iw-pointer-events-none",style:{bottom:-110,left:-60,width:220,height:220,background:"radial-gradient(circle, rgba(255,255,255,0.35), transparent 70%)",filter:"blur(14px)"}}),o.jsxs("div",{className:"iw-relative iw-grid md:iw-grid-cols-[minmax(0,1fr)_auto] iw-items-start iw-gap-6 iw-px-6 iw-py-7",children:[o.jsx("div",{className:"iw-flex iw-flex-col iw-gap-4 iw-text-white",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-12 iw-w-12 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-white/15 iw-shadow-inner",children:o.jsx(so,{className:"iw-h-6 iw-w-6"})}),o.jsxs("div",{children:[o.jsx("p",{className:"iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-white/70",children:"Pre-interview checklist"}),o.jsx("h2",{className:"iw-mt-1 iw-text-xl iw-font-semibold iw-leading-tight",children:"Final checks before you go live"}),o.jsx("p",{className:"iw-mt-2 iw-text-sm iw-text-white/80",children:"Align your space, confirm device access, and step confidently into your secure session."})]})]})}),o.jsx("div",{className:"iw-flex iw-items-start iw-justify-end",children:o.jsxs("div",{className:`iw-inline-flex iw-items-center iw-gap-2 iw-rounded-full iw-bg-white/10 iw-px-4 iw-py-1.5 iw-text-xs iw-font-medium iw-text-white/85 iw-backdrop-blur-sm ${Qe.toneClass}`,children:[o.jsx("span",{className:`iw-inline-flex iw-h-2 iw-w-2 iw-rounded-full ${Qe.dotClass}`}),Qe.label]})}),r&&o.jsx("button",{"aria-label":"Close",className:"iw-absolute iw-top-5 iw-right-5 iw-text-white/70 transition-colors hover:iw-text-white",onClick:()=>{Ze(),r==null||r()},children:"✕"})]})]}),o.jsxs("div",{className:"iw-relative iw-flex iw-flex-col iw-gap-6 iw-px-6 iw-pb-8 iw-pt-6",children:[o.jsxs("div",{className:"iw-grid xl:iw-grid-cols-[0.95fr_1.05fr] iw-gap-6",children:[o.jsx("section",{className:"iw-flex iw-flex-col iw-gap-5",children:o.jsxs("div",{className:"iw-rounded-2xl iw-border iw-border-slate-100 iw-bg-white iw-p-5 iw-shadow-sm",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[o.jsx("h3",{className:"iw-text-sm iw-font-semibold iw-text-slate-900",children:"Proctoring guidelines"}),o.jsx("span",{className:"iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-slate-400",children:"Required"})]}),o.jsx("ul",{className:"iw-mt-5 iw-flex iw-flex-col iw-gap-4",children:Wd.map((P,oe)=>o.jsx("li",{className:"iw-group iw-overflow-hidden iw-rounded-xl iw-border iw-border-slate-100 iw-bg-slate-50/60 iw-p-4 iw-transition-all hover:iw-border-slate-200 hover:iw-bg-white",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3",children:[o.jsx("span",{className:"iw-flex iw-h-8 iw-w-8 iw-flex-none iw-items-center iw-justify-center iw-rounded-full iw-text-sm iw-font-semibold iw-text-white",style:{background:Je},children:oe+1}),o.jsx("span",{className:"iw-text-sm iw-text-slate-600",children:P})]})},P))})]})}),o.jsxs("section",{className:"iw-flex iw-flex-col iw-gap-5",children:[o.jsxs("div",{className:"iw-relative iw-flex iw-flex-col iw-gap-6 iw-overflow-hidden iw-rounded-3xl iw-bg-white ",style:{borderRadius:_e},children:[o.jsx("div",{className:"iw-relative iw-z-10 iw-rounded-2xl iw-border iw-border-slate-200 iw-bg-slate-50/80 iw-p-3",children:i&&(T||p)?o.jsx(wl,{ref:n,interviewId:s,interview_duration:a,showProctoringUI:!1}):o.jsx("video",{ref:c,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-h-64 iw-w-full iw-rounded-2xl iw-object-cover",style:{transform:"scaleX(-1)",borderRadius:_e}})}),o.jsx("div",{className:"iw-relative iw-grid iw-grid-cols-2 iw-gap-4 iw-px-1",children:!v&&!T?o.jsxs(o.Fragment,{children:[o.jsx(to,{onClick:me,disabled:B,variant:"outline",size:"sm",className:"iw-font-medium",style:{borderColor:D,borderRadius:_e,color:D},children:f?"Recheck permissions":"Enable camera & mic"}),o.jsx(He,{onClick:je,disabled:!f,className:"iw-h-10 iw-px-6 iw-text-sm",style:{backgroundColor:D},children:"Proceed"})]}):i&&(v&&!T?o.jsx(He,{onClick:()=>g(!0),disabled:!f,className:"iw-h-10 iw-px-6 iw-text-sm iw-col-span-2",style:{backgroundColor:D},children:"Calibrate Face Position"}):o.jsxs(He,{onClick:Z,disabled:p||!f,className:"iw-h-10 iw-px-6 iw-text-sm iw-col-span-2",style:{backgroundColor:D},children:[p?"Calibrating":"Start Calibration",p&&o.jsx("span",{className:"iw-ml-2 iw-animate-spin iw-inline-block iw-border-2 iw-border-t-transparent iw-border-stone-200 iw-size-4 iw-rounded-full","aria-label":"loading"})]}))})]}),i&&T?o.jsxs("span",{className:"iw-text-slate-700 iw-text-center iw-text-md",children:["Sit upright and look directly into the camera, then press the",o.jsx("span",{className:"iw-font-semibold",children:" Start Calibration "}),"button. Proper calibration is required and incorrect setup may affect your assessment."]}):o.jsx("ul",{className:"iw-grid sm:iw-grid-cols-1 iw-gap-3",children:vt.map(({Icon:P,label:oe,description:lt,status:Pt,toneClass:Dt})=>o.jsx("li",{className:"iw-rounded-2xl iw-border iw-border-slate-200/65 iw-bg-white iw-p-4 iw-shadow-sm iw-transition-all hover:iw-border-slate-200",children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3",children:[o.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-flex-none iw-items-center iw-justify-center iw-rounded-xl iw-bg-slate-100",children:o.jsx(P,{className:"iw-h-5 iw-w-5 iw-text-slate-600"})}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-gap-3",children:[o.jsx("p",{className:"iw-text-sm iw-font-medium iw-text-slate-800",children:oe}),o.jsx("span",{className:`iw-rounded-full iw-px-3 iw-py-1 iw-text-[11px] iw-font-semibold ${Dt}`,children:Pt})]}),o.jsx("p",{className:"iw-mt-1.5 iw-text-xs iw-text-slate-500",children:lt})]})]})},oe))}),G&&o.jsx("div",{className:"iw-rounded-lg iw-border iw-border-rose-200 iw-bg-rose-50 iw-px-3 iw-py-2 iw-text-xs iw-text-rose-600",children:G}),!((de=navigator.mediaDevices)!=null&&de.getUserMedia)&&o.jsx("div",{className:"iw-rounded-lg iw-border iw-border-amber-200 iw-bg-amber-50 iw-px-3 iw-py-2 iw-text-xs iw-text-amber-700",children:"Your browser does not support media devices. Please use a modern browser like Chrome, Edge, or Firefox."})]})]}),o.jsx("div",{className:" iw-rounded-2xl iw-border iw-border-dashed iw-border-slate-200 iw-bg-slate-50/85 iw-px-5 iw-py-4 iw-text-center",children:o.jsx("div",{className:"iw-text-xs iw-text-slate-500",children:"Your session is monitored to protect exam integrity. Continuing confirms you have reviewed and accept these safeguards."})}),o.jsx("div",{"aria-hidden":!0,className:"iw-pointer-events-none iw-absolute iw-inset-x-0 iw-bottom-1 iw-h-20",style:{backgroundImage:$e,backgroundSize:"100% 120%, 100% 120%, 100% 120%, 32px 32px",backgroundPosition:"center bottom, left 95% bottom, right 95% bottom, center bottom",backgroundRepeat:"no-repeat, no-repeat, no-repeat, repeat",opacity:.9,transform:"translateY(4px)",maskImage:"linear-gradient(to top, rgba(0,0,0,0.92), transparent)",WebkitMaskImage:"linear-gradient(to top, rgba(0,0,0,0.92), transparent)"}})]})]}),o.jsx(zl,{isOpen:m,onDecline:()=>g(!1),onContinue:()=>{g(!1),S(!0)}})]})};var ue=(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))(ue||{});const Hd={thinkingDuration:30,answeringDuration:120,editingDuration:30},qd={idle:{next:"fetching_question"},fetching_question:{next:"reading_question"},reading_question:{next:"thinking"},thinking:{next:"answering",duration:30},answering:{next:"transcribing",duration:120},transcribing:{next:"editing"},editing:{next:"submitting",duration:30},submitting:{next:"completed"},completed:{next:"completed"}};class Yd{constructor(t={},r={}){Te(this,"config");Te(this,"state");Te(this,"phaseIntervalId",null);Te(this,"globalIntervalId",null);Te(this,"callbacks");this.config={...Hd,...t},this.callbacks=r,this.state={phase:"idle",currentPhaseTimeRemaining:0,totalTimeElapsed:0,currentQuestionNumber:0}}getState(){return{...this.state}}startQuestion(){this.state.currentQuestionNumber===0&&this.startGlobalTimer(),this.state.currentQuestionNumber=this.state.currentQuestionNumber+1,this.state.phase="fetching_question",this.notifyChange()}nextPhase(){const t=this.state.phase,r=qd[t];if(!r)return;this.stopPhaseTimer(),this.state.phase=r.next;const i=this.getDurationForPhase(r.next);i>0?(this.state.currentPhaseTimeRemaining=i,this.startPhaseTimer()):this.state.currentPhaseTimeRemaining=0,this.notifyChange()}completeInterview(){var t,r;this.stopGlobalTimer(),this.stopPhaseTimer(),this.state.phase="completed",(r=(t=this.callbacks).onInterviewEnd)==null||r.call(t),this.notifyChange()}destroy(){this.stopPhaseTimer(),this.stopGlobalTimer()}getDurationForPhase(t){switch(t){case"thinking":return this.config.thinkingDuration;case"answering":return this.config.answeringDuration;case"editing":return this.config.editingDuration;default:return 0}}startGlobalTimer(){this.globalIntervalId=setInterval(()=>{var t,r;this.state.totalTimeElapsed++,(r=(t=this.callbacks).onTick)==null||r.call(t,this.getState())},1e3)}stopGlobalTimer(){this.globalIntervalId&&(clearInterval(this.globalIntervalId),this.globalIntervalId=null)}startPhaseTimer(){this.phaseIntervalId=setInterval(()=>{this.state.currentPhaseTimeRemaining--,this.state.currentPhaseTimeRemaining<=0&&this.nextPhase()},1e3)}stopPhaseTimer(){this.phaseIntervalId&&(clearInterval(this.phaseIntervalId),this.phaseIntervalId=null)}notifyChange(){var t,r;(r=(t=this.callbacks).onPhaseChange)==null||r.call(t,this.state.phase,this.getState())}}function Kd(e={}){const{config:t={},callbacks:r={}}=e,i=h.useRef(null);i.current||(i.current=new Yd(t,{}));const n=i.current,[s,a]=h.useState(n.getState()),c=h.useCallback(()=>{a(n.getState())},[n]);h.useEffect(()=>{const f={onPhaseChange:(w,m)=>{var g;c(),(g=r.onPhaseChange)==null||g.call(r,w,m)},onTick:w=>{var m;c(),(m=r.onTick)==null||m.call(r,w)},onInterviewEnd:()=>{var w;c(),(w=r.onInterviewEnd)==null||w.call(r)}};n.callbacks=f},[n,r,c]),h.useEffect(()=>()=>{n.destroy()},[n]);const l=h.useCallback(()=>{n.startQuestion(),c()},[n,c]),u=h.useCallback(()=>{n.nextPhase(),c()},[n,c]),d=h.useCallback(()=>{n.completeInterview(),c()},[n,c]);return{state:s,startQuestion:l,nextPhase:u,completeInterview:d,timerService:n}}function Xd(e,t={}){const[r,i]=h.useState({data:null,loading:!1,error:null}),n=h.useCallback(async(...s)=>{var a,c,l,u;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),(u=t.onSettled)==null||u.call(t,null,f)}},[e,t]);return{...r,execute:n}}const Jd=e=>{const[t,r]=h.useState(null),[i,n]=h.useState(!1),s=document,a=()=>!!(s.fullscreenEnabled||s.webkitFullscreenEnabled||s.mozFullScreenEnabled||s.msFullscreenEnabled),c=()=>s.fullscreenElement||s.webkitFullscreenElement||s.mozFullScreenElement||s.msFullscreenElement,l=async m=>{var g;try{if(!a())throw new Error("Fullscreen is not supported in this environment");m.requestFullscreen?await m.requestFullscreen():m.webkitRequestFullscreen?await m.webkitRequestFullscreen():m.mozRequestFullScreen?await m.mozRequestFullScreen():m.msRequestFullscreen&&await m.msRequestFullscreen()}catch(v){const E={name:"FullscreenError",message:v instanceof Error?v.message:"Failed to enter fullscreen"};r(E),(g=e==null?void 0:e.onError)==null||g.call(e,E)}},u=async()=>{var m;try{s.exitFullscreen?await s.exitFullscreen():s.webkitExitFullscreen?await s.webkitExitFullscreen():s.mozCancelFullScreen?await s.mozCancelFullScreen():s.msExitFullscreen&&await s.msExitFullscreen()}catch(g){const v={name:"FullscreenError",message:g instanceof Error?g.message:"Failed to exit fullscreen"};r(v),(m=e==null?void 0:e.onError)==null||m.call(e,v)}},d=h.useCallback(()=>{var g;const m=!!c();n(m),(g=e==null?void 0:e.onFullScreenChange)==null||g.call(e,m)},[e]);h.useEffect(()=>{const m=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];return m.forEach(g=>{document.addEventListener(g,d)}),()=>{m.forEach(g=>{document.removeEventListener(g,d)})}},[d]);const f=async m=>{r(null);const g=m??document.documentElement;await l(g)};return{isFullScreen:i,toggleFullScreen:async m=>{i?await u():await f(m)},enterFullScreen:f,exitFullScreen:u,error:t}},Qd=e=>{h.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])},Zd=(e={})=>{const[t,r]=h.useState(!1),[i,n]=h.useState(!1),[s,a]=h.useState(null),[c,l]=h.useState(null),[u,d]=h.useState(null);e.config&&Tr.updateConfig(e.config);const f=h.useCallback(async v=>{var E;try{l(null),a(null),d(null),await Tr.startRecording(v,{onStart:()=>{var p;r(!0),(p=e.onStart)==null||p.call(e)},onStop:()=>{var p;r(!1),(p=e.onStop)==null||p.call(e)},onError:p=>{var T;const A=p instanceof re?p:new re(p.message,"RECORDING_ERROR",!0);l(A),r(!1),(T=e.onError)==null||T.call(e,A)}})}catch(p){const A=p instanceof re?p:new re(p instanceof Error?p.message:String(p),"START_FAILED",!1);throw l(A),r(!1),(E=e.onError)==null||E.call(e,A),A}},[]),w=h.useCallback(async()=>{var v,E;try{const p=await Tr.stopRecording();return d(p),r(!1),(v=e.onStop)==null||v.call(e),p}catch(p){const A=p instanceof re?p:new re(p instanceof Error?p.message:String(p),"STOP_FAILED",!1);throw l(A),r(!1),(E=e.onError)==null||E.call(e,A),A}},[]),m=h.useCallback(async(v,E={})=>{var p,A;try{l(null),n(!0);const T={audioBlob:v,...E},S=await Tr.transcribe(T);return a(S.transcript),n(!1),(p=e.onTranscriptionComplete)==null||p.call(e,S),S}catch(T){const S=T instanceof re?T:new re(T instanceof Error?T.message:String(T),"TRANSCRIPTION_FAILED",!0);throw l(S),n(!1),(A=e.onError)==null||A.call(e,S),S}},[]),g=h.useCallback(()=>{Tr.cancelRecording(),r(!1),d(null)},[]);return{startRecording:f,stopRecording:w,transcribe:m,cancelRecording:g,isRecording:t,isTranscribing:i,transcript:s,error:c,audioBlob:u}},eh=e=>{const t=h.useRef(null),r=h.useRef(!1);h.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])},th=()=>{h.useEffect(()=>{const e=document.createElement("style");return e.textContent=`
24
24
  * {
25
25
  -webkit-user-select: none !important;
26
26
  -moz-user-select: none !important;
@@ -79,7 +79,7 @@
79
79
  │ │
80
80
  │ 💡 IMMEDIATE ACTION REQUIRED: │
81
81
  │ Close developer tools to continue interview │
82
- └─────────────────────────────────────────────────────────────┘`,"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}},[])},oh=(e,t,r)=>Math.max(t,Math.min(r,e)),ml=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}`},zs=({total:e,remaining:t,size:r=64,strokeWidth:i=6,className:n="",showLabel:s=!0})=>{const a=Math.max(1,e||1),c=oh(t/a,0,1),{radius:l,circumference:u,dashOffset:d,center:f}=h.useMemo(()=>{const g=(r-i)/2,v=2*Math.PI*g,E=v*(1-c),p=Math.round(i)%2===1,A=r/2+(p?.5:0);return{radius:g,circumference:v,dashOffset:E,center:A}},[r,i,c]),w=h.useMemo(()=>c<=.25?"iw-stroke-red-500":c<=.5?"iw-stroke-yellow-500":"iw-stroke-green-500",[c]),m=c<=.25?"iw-animate-pulse":"";return o.jsxs("div",{className:`iw-relative iw-inline-flex iw-items-center iw-justify-center iw-rounded-full iw-bg-white ${n}`,style:{width:r,height:r},"aria-label":`Time remaining ${ml(t)}`,role:"timer","aria-live":"polite",children:[o.jsx("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,preserveAspectRatio:"xMidYMid meet",children:o.jsxs("g",{transform:`rotate(-90 ${f} ${f})`,children:[o.jsx("circle",{cx:f,cy:f,r:l,className:"iw-stroke-gray-200",strokeWidth:i,fill:"none",shapeRendering:"geometricPrecision",vectorEffect:"non-scaling-stroke"}),o.jsx("circle",{cx:f,cy:f,r:l,className:`${w} ${m}`,strokeWidth:i,strokeLinecap:"round",fill:"none",strokeDasharray:u,strokeDashoffset: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:ml(t)})})]})},ah=({label:e,error:t,fullWidth:r=!1,className:i="",id:n,...s})=>{const a=n||`textarea-${Math.random().toString(36).substring(2,9)}`,c="iw-block iw-rounded-md iw-border iw-border-gray-300 iw-shadow-sm iw-px-4 iw-py-2 iw-text-sm iw-transition-all",l=t?"iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500":"",u=r?"iw-w-full":"",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} ${u} ${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})]})},ch=({value:e,onChange:t,onSubmit:r,isSubmitDisabled:i,state:n,editingTime:s})=>{const a=c=>{c.key==="Enter"&&(c.ctrlKey||c.metaKey)&&!i&&(c.preventDefault(),r())};return o.jsxs("div",{className:"iw-flex iw-flex-col iw-h-full ",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"Your Answer"}),o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-2",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-1",children:[o.jsx(sn,{className:"iw-size-4 iw-text-orange-600"}),o.jsx("p",{className:"iw-text-gray-700 iw-text-sm",children:"Time to edit: "})]}),o.jsx(zs,{total:s,remaining:n.currentPhaseTimeRemaining,size:50,strokeWidth:4})]})]}),o.jsxs("div",{className:" iw-overflow-hidden iw-flex iw-flex-col iw-h-full iw-mt-2",children:[o.jsx(ah,{value:e,onChange:t,onKeyDown:a,placeholder:"Type your answer here...",className:" iw-w-full iw-h-full iw-flex-1 iw-resize-none !iw-p-4 iw-bg-transparent iw-min-h-full focus-visible:iw-outline-0",onPaste:c=>c.preventDefault(),onCopy:c=>c.preventDefault(),onCut:c=>c.preventDefault(),onDrop:c=>c.preventDefault(),onDragOver:c=>c.preventDefault()}),o.jsx("div",{className:"iw-w-full iw-grid iw-grid-cols-1 iw-mt-4",children:o.jsx(He,{onClick:r,disabled:i,children:"Submit Answer"})})]})]})},lh=({question:e,isLoading:t=!1})=>{const{baseColor:r}=Zt();return o.jsx("div",{className:"iw-rounded-xl iw-mb-4 message-animation iw-text-gray-800 iw-p-6 ",style:Rl(r,.85),children:o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-8",children:[o.jsx("div",{className:"iw-flex iw-flex-col iw-items-center iw-relative iw-h-32 iw-w-32 iw-shrink-0 iw-shadow iw-rounded-lg iw-bg-white",children:o.jsx("div",{className:"iw-mt-2",children:o.jsx("img",{src:"https://duf9q5sx7u.ufs.sh/f/va7H6eSeKAux755zByRN5Nq9LZurgIoJGYX6c0CEdRSDm8y2",alt:"brand_logo",className:"iw-h-28 iw-w-28"})})}),t?o.jsxs("div",{className:"iw-animate-pulse iw-w-full iw-space-y-3 iw-mr-10",children:[o.jsx("div",{className:"iw-h-5 iw-bg-gray-200 iw-rounded iw-w-full"}),o.jsx("div",{className:"iw-h-5 iw-bg-gray-200 iw-rounded iw-w-3/4"})]}):o.jsx("p",{className:"iw-text-lg iw-leading-8",children:e==null?void 0:e.question})]})})},gl=({currentQuestion:e,phase:t,className:r="",children:i,interviewId:n="",interview_duration:s=en,videoFeedRef:a})=>o.jsxs("div",{className:`iw-p-4 iw-space-y-4 iw-pb-6 ${r} iw-min-h-[calc(100vh_-_3.8rem)] iw-flex iw-flex-col iw-justify-between`,children:[o.jsx("div",{className:"iw-flex iw-items-start iw-justify-between iw-gap-3",children:o.jsx("div",{className:"iw-flex-1",children:o.jsx(lh,{question:e,isLoading:t===ue.FETCHING_QUESTION||t===ue.IDLE})})}),o.jsxs("div",{className:"iw iw-bg-[#F6F6F6] iw-grid iw-grid-cols-2 iw-rounded-[14px] iw-p-6",children:[o.jsx("div",{className:"iw-min-h-[400px] iw-max-h-[600px]",children:o.jsx(wl,{ref:a,interviewId:n,interview_duration:s})}),o.jsx("div",{className:"iw-bg-white iw-rounded-r-xl iw-shadow iw-p-6",children:i})]})]}),uh=({confirmExitInterview:e,isOpen:t,onClose:r})=>o.jsx(Zr,{isOpen:t,onClose:r,title:"Exit Interview",closeOnOverlayClick:!1,children:o.jsxs("div",{className:"iw-space-y-5",children:[o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3 iw-rounded-xl iw-p-2",children:[o.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-flex-none iw-items-center iw-justify-center iw-rounded-full iw-bg-rose-100 iw-text-rose-600",children:"!"}),o.jsxs("div",{className:"iw-space-y-2",children:[o.jsx("p",{className:"iw-text-sm iw-font-semibold iw-text-rose-600",children:"Leaving now will end your interview !"}),o.jsx("p",{className:"iw-text-sm iw-text-slate-500",children:"Are you sure you want to exit? All progress will be lost and you will not be able to resume."})]})]}),o.jsxs("div",{className:"iw-flex iw-flex-col-reverse iw-gap-2 sm:iw-flex-row sm:iw-items-center sm:iw-justify-end iw-pb-1",children:[o.jsx("button",{className:"iw-inline-flex iw-items-center iw-justify-center iw-rounded-lg iw-border iw-border-slate-200 iw-bg-white iw-px-4 iw-py-2 iw-text-sm iw-font-medium iw-text-slate-600 iw-shadow-sm iw-transition hover:iw-bg-slate-50",onClick:r,children:"Stay in interview"}),o.jsx("button",{className:"iw-inline-flex iw-items-center iw-justify-center iw-rounded-lg iw-px-4 iw-py-2 iw-text-sm iw-font-semibold iw-text-white iw-transition hover:iw-brightness-110",style:{background:"linear-gradient(to right, rgba(244, 63, 94, 0.8), rgba(225, 29, 72, 0.8))",boxShadow:"0 12px 30px -16px rgba(244, 63, 94, 0.65)"},onClick:e,children:"Confirm exit"})]})]})}),pl=({title:e,onExit:t})=>{const{baseColor:r}=Zt(),[i,n]=h.useState(!1);return o.jsxs("header",{className:"iw-w-full iw-text-gray-900",children:[o.jsxs("div",{className:"iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-pb-4 iw-pt-2",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-space-x-2",children:[o.jsx("div",{className:"iw-h-7 iw-w-7 iw-rounded-md iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold",style:{backgroundColor:r},children:"N"}),o.jsx("p",{className:"iw-text-sm iw-font-medium",children:"Novara"})]}),o.jsx("h1",{className:"iw-text-base iw-font-bold",children:e}),o.jsx("button",{className:"iw-text-sm iw-text-white iw-px-4 iw-py-2 iw-rounded-md",style:{background:"linear-gradient(to right, rgba(244, 63, 94, 0.8), rgba(225, 29, 72, 0.8))"},onClick:()=>n(!0),children:"Exit Interview"})]}),o.jsx("div",{className:"iw-h-px iw-bg-gray-200"}),o.jsx(uh,{isOpen:i,confirmExitInterview:()=>{t(),n(!1)},onClose:()=>n(!1)})]})},dh=({className:e="",width:t,height:r=56,barWidth:i=3,gap:n=2,fftSize:s=1024,smoothingTimeConstant:a=.8,mediaStream:c,startOnMount:l=!0})=>{const{baseColor:u}=Zt(),d=h.useRef(null),f=h.useRef(null),w=h.useRef(null),m=h.useRef(null),g=h.useRef(null),v=h.useRef(null),E=h.useRef(!1),[p,A]=h.useState(null);h.useEffect(()=>{if(t||!f.current)return;const T=f.current,G=()=>{const B=d.current;if(!B)return;const $=T.clientWidth,D=r;B.width=Math.max(1,Math.floor($*window.devicePixelRatio||1)),B.height=Math.max(1,Math.floor(D*window.devicePixelRatio||1))},C=new ResizeObserver(G);return C.observe(T),G(),()=>C.disconnect()},[t,r]),h.useEffect(()=>{if(!t)return;const T=d.current;T&&(T.width=Math.max(1,Math.floor(t*(window.devicePixelRatio||1))),T.height=Math.max(1,Math.floor(r*(window.devicePixelRatio||1))))},[t,r]),h.useEffect(()=>{let T=!1;return(async()=>{try{const C=new(window.AudioContext||window.webkitAudioContext);w.current=C;let B=c;if(!B){if(!l)return;B=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1}),E.current=!0}if(T)return;const $=C.createAnalyser();$.fftSize=s,$.smoothingTimeConstant=a,m.current=$;const D=C.createMediaStreamSource(B);g.current=D,D.connect($),S()}catch(C){A((C==null?void 0:C.message)||"Failed to initialize microphone")}})(),()=>{var C,B,$,D;T=!0,v.current&&cancelAnimationFrame(v.current);try{(C=g.current)==null||C.disconnect()}catch{}try{(B=m.current)==null||B.disconnect()}catch{}E.current&&((D=(($=g.current)==null?void 0:$.mediaStream)||void 0)==null||D.getTracks().forEach(Je=>Je.stop())),w.current&&w.current.state!=="closed"&&w.current.close()}},[c,s,a,l]);const S=()=>{const T=d.current,G=m.current;if(!T||!G)return;const C=T.getContext("2d");if(!C)return;const B=window.devicePixelRatio||1,$=T.width,D=T.height,Je=G.frequencyBinCount,_e=new Uint8Array(Je),we=()=>{v.current=requestAnimationFrame(we),G.getByteTimeDomainData(_e),C.clearRect(0,0,$,D),C.fillStyle="rgba(0,0,0,0)",C.fillRect(0,0,$,D);const $e=Math.max(1,Math.floor(i*B)),Qe=Math.max(1,Math.floor(n*B)),Ee=$e+Qe,vt=Math.max(8,Math.floor(($+Qe)/Ee)),Ze=Math.floor(_e.length/vt);for(let me=0;me<vt;me++){const je=Math.min(_e.length-1,me*Ze),Z=_e[je]/128-1,de=Math.abs(Z),P=Math.pow(de,.6),oe=Math.max(D*.06,P*(D*.9)),lt=me*Ee,Pt=(D-oe)/2,Dt=140-Math.min(140,140*de),Yr=85,Rt=48+Math.floor(12*(1-de));C.fillStyle=`${u}`,C.shadowColor=`hsla(${Dt}, ${Yr}%, ${Rt}%, ${.25*de})`,C.shadowBlur=8*de;const Ot=Math.min($e/2,oe/2);hh(C,lt,Pt,$e,oe,Ot),C.fill()}};we()};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"}),p&&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:p})})]})};function hh(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 fh=({state:e,answeringTime:t,nextPhase:r,sttError:i})=>o.jsxs("div",{className:"iw-flex iw-flex-col iw-justify-between iw-h-full ",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"You may start speaking now. We're listening...."}),o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-2",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-1",children:[o.jsx(sn,{className:"iw-size-4 iw-text-orange-600"}),o.jsx("p",{className:"iw-text-gray-700 iw-text-sm",children:"Time to talk: "})]}),o.jsx(zs,{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(dh,{}),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(He,{onClick:()=>{r()},children:"Transcribe My Answer"})})]});function wh(){const[e,t]=h.useState(!0),r=h.useMemo(()=>[0,1,2].map(i=>({id:i})),[]);return h.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 mh=({size:e="192px",className:t,colors:r,animationDuration:i=20})=>{const s={...{bg:"oklch(95% 0.02 264.695)",c1:"oklch(75% 0.15 350)",c2:"oklch(80% 0.12 200)",c3:"oklch(78% 0.14 280)"},...r},a=parseInt(e.replace("px",""),10),c=a<50?Math.max(a*.008,1):Math.max(a*.015,4),l=a<50?Math.max(a*.004,1.2):Math.max(a*.008,1.5),u=a<50?Math.max(a*.004,.05):Math.max(a*.008,.1),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":`${u}px`,"--shadow-spread":`${d}px`,"--mask-radius":f},children:o.jsx("style",{children:`
82
+ └─────────────────────────────────────────────────────────────┘`,"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}},[])},oh=(e,t,r)=>Math.max(t,Math.min(r,e)),ml=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}`},zs=({total:e,remaining:t,size:r=64,strokeWidth:i=6,className:n="",showLabel:s=!0})=>{const a=Math.max(1,e||1),c=oh(t/a,0,1),{radius:l,circumference:u,dashOffset:d,center:f}=h.useMemo(()=>{const g=(r-i)/2,v=2*Math.PI*g,E=v*(1-c),p=Math.round(i)%2===1,A=r/2+(p?.5:0);return{radius:g,circumference:v,dashOffset:E,center:A}},[r,i,c]),w=h.useMemo(()=>c<=.25?"iw-stroke-red-500":c<=.5?"iw-stroke-yellow-500":"iw-stroke-green-500",[c]),m=c<=.25?"iw-animate-pulse":"";return o.jsxs("div",{className:`iw-relative iw-inline-flex iw-items-center iw-justify-center iw-rounded-full iw-bg-white ${n}`,style:{width:r,height:r},"aria-label":`Time remaining ${ml(t)}`,role:"timer","aria-live":"polite",children:[o.jsx("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,preserveAspectRatio:"xMidYMid meet",children:o.jsxs("g",{transform:`rotate(-90 ${f} ${f})`,children:[o.jsx("circle",{cx:f,cy:f,r:l,className:"iw-stroke-gray-200",strokeWidth:i,fill:"none",shapeRendering:"geometricPrecision",vectorEffect:"non-scaling-stroke"}),o.jsx("circle",{cx:f,cy:f,r:l,className:`${w} ${m}`,strokeWidth:i,strokeLinecap:"round",fill:"none",strokeDasharray:u,strokeDashoffset: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:ml(t)})})]})},ah=({label:e,error:t,fullWidth:r=!1,className:i="",id:n,...s})=>{const a=n||`textarea-${Math.random().toString(36).substring(2,9)}`,c="iw-block iw-rounded-md iw-border iw-border-gray-300 iw-shadow-sm iw-px-4 iw-py-2 iw-text-sm iw-transition-all",l=t?"iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500":"",u=r?"iw-w-full":"",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} ${u} ${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})]})},ch=({value:e,onChange:t,onSubmit:r,isSubmitDisabled:i,state:n,editingTime:s})=>{const a=c=>{c.key==="Enter"&&(c.ctrlKey||c.metaKey)&&!i&&(c.preventDefault(),r())};return o.jsxs("div",{className:"iw-flex iw-flex-col iw-h-full ",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"Your Answer"}),o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-2",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-1",children:[o.jsx(sn,{className:"iw-size-4 iw-text-orange-600"}),o.jsx("p",{className:"iw-text-gray-700 iw-text-sm",children:"Time to edit: "})]}),o.jsx(zs,{total:s,remaining:n.currentPhaseTimeRemaining,size:50,strokeWidth:4})]})]}),o.jsxs("div",{className:" iw-overflow-hidden iw-flex iw-flex-col iw-h-full iw-mt-2",children:[o.jsx(ah,{value:e,onChange:t,onKeyDown:a,placeholder:"Type your answer here...",className:" iw-w-full iw-h-full iw-flex-1 iw-resize-none !iw-p-4 iw-bg-transparent iw-min-h-full focus-visible:iw-outline-0",onPaste:c=>c.preventDefault(),onCopy:c=>c.preventDefault(),onCut:c=>c.preventDefault(),onDrop:c=>c.preventDefault(),onDragOver:c=>c.preventDefault()}),o.jsx("div",{className:"iw-w-full iw-grid iw-grid-cols-1 iw-mt-4",children:o.jsx(He,{onClick:r,disabled:i,children:"Submit Answer"})})]})]})},lh=({question:e,isLoading:t=!1})=>{const{baseColor:r}=Zt();return o.jsx("div",{className:"iw-rounded-xl iw-mb-4 message-animation iw-text-gray-800 iw-p-6 ",style:Rl(r,.85),children:o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-8",children:[o.jsx("div",{className:"iw-flex iw-flex-col iw-items-center iw-relative iw-h-32 iw-w-32 iw-shrink-0 iw-shadow iw-rounded-lg iw-bg-white",children:o.jsx("div",{className:"iw-mt-2",children:o.jsx("img",{src:"https://duf9q5sx7u.ufs.sh/f/va7H6eSeKAux755zByRN5Nq9LZurgIoJGYX6c0CEdRSDm8y2",alt:"brand_logo",className:"iw-h-28 iw-w-28"})})}),t?o.jsxs("div",{className:"iw-animate-pulse iw-w-full iw-space-y-3 iw-mr-10",children:[o.jsx("div",{className:"iw-h-5 iw-bg-gray-200 iw-rounded iw-w-full"}),o.jsx("div",{className:"iw-h-5 iw-bg-gray-200 iw-rounded iw-w-3/4"})]}):o.jsx("p",{className:"iw-text-lg iw-leading-8",children:e==null?void 0:e.question})]})})},gl=({currentQuestion:e,phase:t,className:r="",children:i,interviewId:n="",interview_duration:s=en,videoFeedRef:a})=>o.jsxs("div",{className:`iw-p-4 iw-space-y-4 iw-pb-6 ${r} iw-min-h-[calc(100vh_-_3.8rem)] iw-flex iw-flex-col iw-justify-between`,children:[o.jsx("div",{className:"iw-flex iw-items-start iw-justify-between iw-gap-3",children:o.jsx("div",{className:"iw-flex-1",children:o.jsx(lh,{question:e,isLoading:t===ue.FETCHING_QUESTION||t===ue.IDLE})})}),o.jsxs("div",{className:"iw iw-bg-[#F6F6F6] iw-grid iw-grid-cols-2 iw-rounded-[14px] iw-p-6",children:[o.jsx("div",{className:"iw-min-h-[400px] iw-max-h-[600px]",children:o.jsx(wl,{ref:a,interviewId:n,interview_duration:s})}),o.jsx("div",{className:"iw-bg-white iw-rounded-r-xl iw-shadow iw-p-6",children:i})]})]}),uh=({confirmExitInterview:e,isOpen:t,onClose:r})=>o.jsx(Zr,{isOpen:t,onClose:r,title:"Exit Interview",closeOnOverlayClick:!1,children:o.jsxs("div",{className:"iw-space-y-5",children:[o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-3 iw-rounded-xl iw-p-2",children:[o.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-flex-none iw-items-center iw-justify-center iw-rounded-full iw-bg-rose-100 iw-text-rose-600",children:"!"}),o.jsxs("div",{className:"iw-space-y-2",children:[o.jsx("p",{className:"iw-text-sm iw-font-semibold iw-text-rose-600",children:"Leaving now will end your interview !"}),o.jsx("p",{className:"iw-text-sm iw-text-slate-500",children:"Are you sure you want to exit? All progress will be lost and you will not be able to resume."})]})]}),o.jsxs("div",{className:"iw-flex iw-flex-col-reverse iw-gap-2 sm:iw-flex-row sm:iw-items-center sm:iw-justify-end iw-pb-1",children:[o.jsx("button",{className:"iw-inline-flex iw-items-center iw-justify-center iw-rounded-lg iw-border iw-border-slate-200 iw-bg-white iw-px-4 iw-py-2 iw-text-sm iw-font-medium iw-text-slate-600 iw-shadow-sm iw-transition hover:iw-bg-slate-50",onClick:r,children:"Stay in interview"}),o.jsx("button",{className:"iw-inline-flex iw-items-center iw-justify-center iw-rounded-lg iw-px-4 iw-py-2 iw-text-sm iw-font-semibold iw-text-white iw-transition hover:iw-brightness-110",style:{background:"linear-gradient(to right, rgba(244, 63, 94, 0.8), rgba(225, 29, 72, 0.8))",boxShadow:"0 12px 30px -16px rgba(244, 63, 94, 0.65)"},onClick:e,children:"Confirm exit"})]})]})}),pl=({title:e,onExit:t})=>{const{baseColor:r}=Zt(),[i,n]=h.useState(!1);return o.jsxs("header",{className:"iw-w-full iw-text-gray-900",children:[o.jsxs("div",{className:"iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-pb-4 iw-pt-2",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-space-x-2",children:[o.jsx("div",{className:"iw-h-7 iw-w-7 iw-rounded-md iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold",style:{backgroundColor:r},children:"N"}),o.jsx("p",{className:"iw-text-sm iw-font-medium",children:"Novara"})]}),o.jsx("h1",{className:"iw-text-base iw-font-bold",children:e}),o.jsx("button",{className:"iw-text-sm iw-text-white iw-px-4 iw-py-2 iw-rounded-md",style:{background:"linear-gradient(to right, rgba(244, 63, 94, 0.8), rgba(225, 29, 72, 0.8))"},onClick:()=>n(!0),children:"Exit Interview"})]}),o.jsx("div",{className:"iw-h-px iw-bg-gray-200"}),o.jsx(uh,{isOpen:i,confirmExitInterview:()=>{t(),n(!1)},onClose:()=>n(!1)})]})},dh=({className:e="",width:t,height:r=56,barWidth:i=3,gap:n=2,fftSize:s=1024,smoothingTimeConstant:a=.8,mediaStream:c,startOnMount:l=!0})=>{const{baseColor:u}=Zt(),d=h.useRef(null),f=h.useRef(null),w=h.useRef(null),m=h.useRef(null),g=h.useRef(null),v=h.useRef(null),E=h.useRef(!1),[p,A]=h.useState(null);h.useEffect(()=>{if(t||!f.current)return;const S=f.current,G=()=>{const B=d.current;if(!B)return;const Y=S.clientWidth,D=r;B.width=Math.max(1,Math.floor(Y*window.devicePixelRatio||1)),B.height=Math.max(1,Math.floor(D*window.devicePixelRatio||1))},C=new ResizeObserver(G);return C.observe(S),G(),()=>C.disconnect()},[t,r]),h.useEffect(()=>{if(!t)return;const S=d.current;S&&(S.width=Math.max(1,Math.floor(t*(window.devicePixelRatio||1))),S.height=Math.max(1,Math.floor(r*(window.devicePixelRatio||1))))},[t,r]),h.useEffect(()=>{let S=!1;return(async()=>{try{const C=new(window.AudioContext||window.webkitAudioContext);w.current=C;let B=c;if(!B){if(!l)return;B=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1}),E.current=!0}if(S)return;const Y=C.createAnalyser();Y.fftSize=s,Y.smoothingTimeConstant=a,m.current=Y;const D=C.createMediaStreamSource(B);g.current=D,D.connect(Y),T()}catch(C){A((C==null?void 0:C.message)||"Failed to initialize microphone")}})(),()=>{var C,B,Y,D;S=!0,v.current&&cancelAnimationFrame(v.current);try{(C=g.current)==null||C.disconnect()}catch{}try{(B=m.current)==null||B.disconnect()}catch{}E.current&&((D=((Y=g.current)==null?void 0:Y.mediaStream)||void 0)==null||D.getTracks().forEach(Je=>Je.stop())),w.current&&w.current.state!=="closed"&&w.current.close()}},[c,s,a,l]);const T=()=>{const S=d.current,G=m.current;if(!S||!G)return;const C=S.getContext("2d");if(!C)return;const B=window.devicePixelRatio||1,Y=S.width,D=S.height,Je=G.frequencyBinCount,_e=new Uint8Array(Je),we=()=>{v.current=requestAnimationFrame(we),G.getByteTimeDomainData(_e),C.clearRect(0,0,Y,D),C.fillStyle="rgba(0,0,0,0)",C.fillRect(0,0,Y,D);const $e=Math.max(1,Math.floor(i*B)),Qe=Math.max(1,Math.floor(n*B)),Ee=$e+Qe,vt=Math.max(8,Math.floor((Y+Qe)/Ee)),Ze=Math.floor(_e.length/vt);for(let me=0;me<vt;me++){const je=Math.min(_e.length-1,me*Ze),Z=_e[je]/128-1,de=Math.abs(Z),P=Math.pow(de,.6),oe=Math.max(D*.06,P*(D*.9)),lt=me*Ee,Pt=(D-oe)/2,Dt=140-Math.min(140,140*de),Yr=85,Rt=48+Math.floor(12*(1-de));C.fillStyle=`${u}`,C.shadowColor=`hsla(${Dt}, ${Yr}%, ${Rt}%, ${.25*de})`,C.shadowBlur=8*de;const Ot=Math.min($e/2,oe/2);hh(C,lt,Pt,$e,oe,Ot),C.fill()}};we()};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"}),p&&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:p})})]})};function hh(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 fh=({state:e,answeringTime:t,nextPhase:r,sttError:i})=>o.jsxs("div",{className:"iw-flex iw-flex-col iw-justify-between iw-h-full ",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between",children:[o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"You may start speaking now. We're listening...."}),o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-2",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-1",children:[o.jsx(sn,{className:"iw-size-4 iw-text-orange-600"}),o.jsx("p",{className:"iw-text-gray-700 iw-text-sm",children:"Time to talk: "})]}),o.jsx(zs,{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(dh,{}),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(He,{onClick:()=>{r()},children:"Transcribe My Answer"})})]});function wh(){const[e,t]=h.useState(!0),r=h.useMemo(()=>[0,1,2].map(i=>({id:i})),[]);return h.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 mh=({size:e="192px",className:t,colors:r,animationDuration:i=20})=>{const s={...{bg:"oklch(95% 0.02 264.695)",c1:"oklch(75% 0.15 350)",c2:"oklch(80% 0.12 200)",c3:"oklch(78% 0.14 280)"},...r},a=parseInt(e.replace("px",""),10),c=a<50?Math.max(a*.008,1):Math.max(a*.015,4),l=a<50?Math.max(a*.004,1.2):Math.max(a*.008,1.5),u=a<50?Math.max(a*.004,.05):Math.max(a*.008,.1),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":`${u}px`,"--shadow-spread":`${d}px`,"--mask-radius":f},children:o.jsx("style",{children:`
83
83
  @property --angle {
84
84
  syntax: "<angle>";
85
85
  inherits: false;
@@ -184,4 +184,4 @@
184
184
  animation: none;
185
185
  }
186
186
  }
187
- `})})};function gh({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(mh,{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 ph=({state:e,thinkingTime:t,nextPhase:r})=>o.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-6 iw-items-center iw-justify-center iw-text-center iw-h-full ",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"Get Ready to Answer"}),o.jsx("p",{className:"iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]",children:"After 30-seconds thinking time, recording will start automatically, or you can begin recording early by clicking the button below."})]}),o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-2",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-1",children:[o.jsx(sn,{className:"iw-size-4 iw-text-orange-600"}),o.jsx("p",{className:"iw-text-gray-700 iw-text-sm",children:"Time to think: "})]}),o.jsx(zs,{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(He,{onClick:()=>{r()},children:"Start Answering"})})]}),xh=({sttError:e})=>o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full",children:[o.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 60 60",fill:"none",children:[o.jsx("rect",{width:60,height:60,rx:30,fill:"url(#prefix__paint0_linear_1460_12482)"}),o.jsx("path",{d:"M28.127 14c.276 7.685 6.442 13.851 14.127 14.127-7.684.276-13.85 6.442-14.127 14.127-.275-7.685-6.442-13.851-14.126-14.127 7.684-.276 13.85-6.442 14.126-14.127zM38.937 31.873A7.331 7.331 0 0046 38.937 7.331 7.331 0 0038.937 46a7.331 7.331 0 00-7.064-7.063 7.331 7.331 0 007.064-7.064z",fill:"#fff"}),o.jsx("defs",{children:o.jsxs("linearGradient",{id:"prefix__paint0_linear_1460_12482",x1:30,y1:-6.563,x2:77.813,y2:54.375,gradientUnits:"userSpaceOnUse",children:[o.jsx("stop",{offset:.211,stopColor:"#5C92FA"}),o.jsx("stop",{offset:1,stopColor:"#A75FFD"})]})})]}),o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1 iw-mt-3",children:"Just a moment... We're analyzing your response"}),o.jsx("p",{className:"iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]",children:"After transcription, you'll have 45 sec to review your answer."}),e&&o.jsxs("div",{className:"iw-mt-2 iw-text-xs iw-text-red-600",children:["Transcription error: ",e.message,e.recoverable&&" (attempting to continue)"]})]}),Yi=5;function yh({isOpen:e,onClose:t,warningCount:r,violationType:i,onDisqualify:n}){const[s,a]=h.useState(10),c=h.useRef(t);if(h.useEffect(()=>{c.current=t},[t]),h.useEffect(()=>{if(!e)return;const w=setInterval(()=>{a(m=>m<=1?(c.current(),10):m-1)},1e3);return()=>clearInterval(w)},[e]),h.useEffect(()=>{e&&a(10)},[e]),h.useEffect(()=>(e?(document.body.style.overflow="hidden",document.body.classList.add("interview-widget-container")):(document.body.style.overflow="unset",document.body.classList.remove("interview-widget-container")),()=>{document.body.style.overflow="unset",document.body.classList.remove("interview-widget-container")}),[e]),!e)return null;const u=(()=>{switch(i){case"tab_switch":return{title:"Tab Switch Detected",description:"You attempted to switch to another tab or reload application.",icon:o.jsx(co,{className:"iw-h-5 iw-w-5"})};case"fullscreen_exit":return{title:"Full Screen Exit Detected",description:"You attempted to exit full screen mode.",icon:o.jsx(oo,{className:"iw-h-5 iw-w-5"})};case"focus_loss":return{title:"Focus Loss Detected",description:"You lost focus from the interview window.",icon:o.jsx(Yl,{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(on,{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(Kl,{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(on,{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(on,{className:"iw-h-5 iw-w-5"})};default:return{title:"Violation Detected",description:"You attempted to perform an action that is not allowed.",icon:o.jsx(Nr,{className:"iw-h-5 iw-w-5"})}}})(),d=Yi-r,f=()=>{r+1>Yi?n():t()};return o.jsx("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-black/60 iw-p-4 iw-backdrop-blur-sm",children:o.jsxs("div",{className:"iw-w-full iw-max-w-md iw-rounded-2xl iw-border iw-border-gray-100 iw-bg-white iw-shadow-xl",children:[o.jsxs("div",{className:"iw-p-6 iw-pb-0",children:[o.jsxs("div",{className:"iw-mb-6 iw-flex iw-items-start iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-12 iw-w-12 iw-flex-shrink-0 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-red-50",children:o.jsx(Nr,{className:"iw-h-6 iw-w-6 iw-text-red-500"})}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsx("h2",{className:"iw-mb-1 iw-text-xl iw-font-semibold iw-text-gray-900",children:"Security Violation"}),o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[o.jsx("span",{className:"iw-text-sm iw-text-gray-500",children:"Warning"}),o.jsx("div",{className:"iw-flex iw-gap-1",children:Array.from({length:Yi}).map((w,m)=>o.jsx("div",{className:`iw-h-2 iw-w-2 iw-rounded-full ${m<=r-1?"iw-bg-red-500":"iw-bg-gray-200"}`},m))}),o.jsxs("span",{className:"iw-text-sm iw-text-gray-500",children:["(",r,"/",Yi,")"]})]})]})]}),o.jsx("div",{className:"iw-mb-5 iw-rounded-2xl iw-border iw-border-red-100 iw-p-5",style:{background:"linear-gradient(to right, rgb(254, 242, 242), rgb(254, 245, 235))",borderColor:"rgb(254, 226, 226)"},children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-items-center iw-justify-center iw-rounded-xl iw-bg-white iw-shadow-sm",children:u.icon}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsx("h3",{className:"iw-mb-2 iw-font-semibold iw-text-gray-900",children:u.title}),o.jsx("p",{className:"iw-text-sm iw-leading-relaxed iw-text-gray-700",children:u.description}),o.jsxs("div",{className:"iw-mt-3 iw-flex iw-items-center iw-gap-2 iw-text-xs iw-text-red-600",children:[o.jsx(so,{className:"iw-h-3 iw-w-3"}),o.jsx("span",{children:"This action is monitored for interview integrity"})]})]})]})}),o.jsxs("div",{className:"iw-mb-5 iw-grid iw-grid-cols-2 iw-gap-3",children:[o.jsx("div",{className:"iw-rounded-xl iw-border iw-border-amber-200 iw-bg-amber-50 iw-p-4",children:o.jsxs("div",{className:"iw-text-center",children:[o.jsx("div",{className:"iw-mb-1 iw-text-2xl iw-font-bold iw-text-amber-600",children: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(ql,{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(Nr,{className:"iw-h-4 iw-w-4"})}),o.jsxs("div",{children:[o.jsx("div",{className:"iw-text-sm iw-font-semibold",children:"Final Warning"}),o.jsx("div",{className:"iw-text-xs iw-text-red-100",children:"Next violation will disqualify you from this interview"})]})]})})]}),o.jsxs("div",{className:"iw-p-6 iw-pt-0",children:[o.jsx(He,{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 bh=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"})]}),vh=({showHardReloadWarning:e,onContinue:t})=>{const r=()=>{t()};return o.jsxs(Zr,{isOpen:e,onClose:r,closeOnOverlayClick:!1,closeOnEscape:!1,showCloseButton:!1,className:"iw-max-w-lg iw-px-2 iw-rounded-xl",children:[o.jsx("div",{className:"iw-absolute iw-inset-x-0 iw-top-0 iw-h-1 iw-bg-gradient-to-r iw-from-red-500 iw-to-red-600"}),o.jsx("div",{className:"iw-space-y-1 iw-pb-2 iw-pt-3",children:o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[o.jsx(Nr,{className:"iw-w-5 iw-h-5 iw-text-red-500"}),o.jsx("h3",{className:"iw-text-xl iw-font-semibold iw-text-red-500",children:"Full Screen Exit Detected"})]})}),o.jsx("div",{className:"iw-pt-4 iw-pb-6",children:o.jsx("p",{className:"iw-text-center iw-text-sm iw-leading-relaxed iw-text-gray-500/90",children:"Exiting full screen mode or reloading this page during the session is strictly prohibited. Any attempt to do so will be recorded and may lead to penalties."})}),o.jsx("div",{className:"iw-pt-2 iw-pb-4",children:o.jsxs("button",{onClick:r,className:"iw-w-full iw-flex iw-items-center iw-justify-center iw-gap-2 iw-px-4 iw-py-3 iw-bg-gray-100 iw-text-gray-600 iw-rounded-md iw-font-medium iw-transition-colors hover:iw-bg-gray-200 focus:iw-outline-none focus:iw-ring-2 focus:iw-ring-gray-400 focus:iw-ring-offset-2",children:[o.jsx(bh,{className:"iw-size-4"}),"Continue Session"]})})]})},kh=h.forwardRef(({children:e,onDisqualify:t},r)=>{const[i,n]=h.useState(!1),[s,a]=h.useState(!1),[c,l]=h.useState(!1),[u,d]=h.useState("fullscreen_exit"),{logViolation:f,violationCount:w}=nh({maxViolations:5,onViolation:p=>{s||(n(!0),d(p.type))}}),{enterFullScreen:m,isFullScreen:g,exitFullScreen:v}=Jd({onFullScreenChange(p){!p&&!s&&!c&&(n(!0),f({type:"fullscreen_exit",severity:"high",details:{action:"fullscreen_exit",reason:"Attempted to exit full screen mode"}})),p&&l(!1)}});h.useEffect(()=>{m()},[]),h.useImperativeHandle(r,()=>({exitFullScreenIntentionally:async()=>{l(!0),n(!1),a(!1);try{document.fullscreenElement&&await document.exitFullscreen()}catch(p){console.error("Failed to exit fullscreen:",p)}}}),[]),eh(f),Qd(f),th(),sh();const E=()=>{a(!0),v(),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(yh,{warningCount:w,isOpen:i,violationType:u,onClose:()=>{n(!1),m()},onDisqualify:E}),!i&&w>0&&!s&&!c&&o.jsx(vh,{showHardReloadWarning:!g,logViolation:f,onContinue:m})]})}),_h=({interviewTitle:e,interviewId:t,onComplete:r,onDisqualify:i,className:n="",videoFeedRef:s})=>{var Kr,Ki,Sr;const a=ao(),{baseUrl:c,authToken:l}=Zs(),{timers:u,stt:d,tts:f,proctoring:w}=nn(),m=h.useRef(null),[g,v]=h.useState(null),[E,p]=h.useState(""),A=h.useRef(""),S=h.useRef(null),T={thinkingTime:(u==null?void 0:u.thinkingDuration)||30,answeringTime:(u==null?void 0:u.answeringDuration)||120,editingTime:(u==null?void 0:u.editingDuration)||30},{thinkingTime:G,answeringTime:C,editingTime:B}=T;h.useEffect(()=>{A.current=E},[E]);const $=h.useRef(!1),{speak:D,stop:Je,error:_e}=ih({config:{baseUrl:c,provider:f==null?void 0:f.provider,authToken:l},onEnd:()=>{$.current=!1,Z()},onError:()=>{$.current||($.current=!0,Z())}}),we=h.useRef(!1),$e=h.useRef(!1),{startRecording:Qe,stopRecording:Ee,transcribe:vt,error:Ze}=Zd({config:{baseUrl:c,provider:d==null?void 0:d.provider,model:d==null?void 0:d.model,language:d==null?void 0:d.language,authToken:l,qnaId:((Kr=S.current)==null?void 0:Kr.qna_id)||""},onStart:()=>{we.current=!1,$e.current=!1},onStop:()=>{},onTranscriptionComplete:L=>{p(L.transcript),$e.current||($e.current=!0,Z())},onError:L=>{console.error("STT Error:",L),we.current||(we.current=!0,Z())}}),{state:me,startQuestion:je,nextPhase:Z,completeInterview:de}=Kd({config:{thinkingDuration:G,answeringDuration:C,editingDuration:B},callbacks:{onPhaseChange:L=>{switch(L){case ue.FETCHING_QUESTION:P();break;case ue.READING_QUESTION:Pt();break;case ue.ANSWERING:Dt();break;case ue.TRANSCRIBING:Yr();break;case ue.SUBMITTING:lt();break}},onInterviewEnd:()=>{r==null||r()}}});h.useEffect(()=>{je()},[]);const{execute:P,loading:oe}=Xd(async()=>{var et,Bt;const L=await a.generateQuestion({interviewId:t,question:((et=S.current)==null?void 0:et.question)||"",qnaId:((Bt=S.current)==null?void 0:Bt.qna_id)||"",answer:A.current});return S.current=L.data,L},{onSuccess:async L=>{L&&L.data&&(p(""),v(L.data),Z())},onError:L=>{console.error("Failed to fetch questions:",L)}}),lt=h.useCallback(async()=>{je()},[je]),Pt=h.useCallback(async()=>{var L;if((L=S.current)!=null&&L.question)try{$.current=!1,await D(S.current.question),S.current.is_interview_done&&(await io(2e3),de())}catch(et){console.error("Failed to speak question:",et)}else Z()},[D,Z,de]),Dt=h.useCallback(async()=>{try{await Qe(C)}catch(L){console.error("Failed to start recording:",L),Z()}},[Qe,Z]),Yr=h.useCallback(async()=>{try{const L=await Ee();await vt(L)}catch(L){console.error("STT processing failed:",L),!we.current&&!$e.current&&(we.current=!0,Z())}},[Ee,vt,Z]),Rt=h.useCallback(async L=>{var et;Je(),await((et=m.current)==null?void 0:et.exitFullScreenIntentionally());try{(await a.generateQuestion({interviewId:t,isInterviewDone:!0})).success&&(L==null||L(),de(),sessionStorage.removeItem(Zi))}catch(Bt){console.error("API call failed:",Bt)}},[t,Je,a]),Ot=()=>{const{phase:L}=me;switch(L){case ue.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(He,{onClick:je,className:"iw-mt-2 iw-w-40",children:"Start Interview"})]});case ue.FETCHING_QUESTION:return o.jsx(wh,{});case ue.READING_QUESTION:return o.jsx(gh,{ttsError:_e});case ue.THINKING:return o.jsx(ph,{state:me,thinkingTime:G,nextPhase:Z});case ue.ANSWERING:return o.jsx(fh,{state:me,answeringTime:C,nextPhase:Z,sttError:Ze});case ue.TRANSCRIBING:return o.jsx(xh,{sttError:Ze});case ue.EDITING:case ue.SUBMITTING:return o.jsx("div",{className:"iw-space-y-4 iw-h-full",children:o.jsx(ch,{value:E,onChange:et=>p(et.target.value),onSubmit:()=>Z(),isSubmitDisabled:!E.trim()||oe,state:me,editingTime:B})});case ue.COMPLETED:return null;default:return null}};return o.jsx(o.Fragment,{children:w!=null&&w.enabled?o.jsxs(kh,{ref:m,onDisqualify:()=>Rt(i),children:[o.jsx(pl,{title:e,onExit:()=>Rt()}),o.jsx(gl,{currentQuestion:g,phase:me.phase,className:n,interviewId:t,interview_duration:(Ki=S==null?void 0:S.current)==null?void 0:Ki.interview_duration,videoFeedRef:s,children:Ot()})]}):o.jsxs(o.Fragment,{children:[o.jsx(pl,{title:e,onExit:()=>Rt()}),o.jsx(gl,{currentQuestion:g,phase:me.phase,className:n,interviewId:t,interview_duration:(Sr=S==null?void 0:S.current)==null?void 0:Sr.interview_duration,videoFeedRef:s,children:Ot()})]})})},Ws=({title:e,interviewId:t,onInterviewEnd:r,onInterviewDisqualify:i,className:n=""})=>{const[s,a]=h.useState(!1),[c,l]=h.useState(!0),[u,d]=h.useState(!1),{proctoring:f}=nn(),w=h.useRef(null),m=h.useRef(null),g=(f==null?void 0:f.gazeAnalysisEnabled)===!0,v=()=>{a(!0),l(!1)};return h.useEffect(()=>{if(s&&u&&m.current&&g)try{m.current.setReference()}finally{d(!1)}},[s,u,g]),s?o.jsx("div",{className:"interview-widget-container",children:o.jsx("div",{ref:w,className:`iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${n}`,children:o.jsx("div",{className:"iw-h-full iw-flex iw-flex-col",children:o.jsx(_h,{interviewTitle:e??"Interview",interviewId:t,className:n,onComplete:r??(()=>{}),onDisqualify:i,videoFeedRef:m})})})}):o.jsx("div",{className:"interview-widget-container",children:o.jsx($d,{isOpen:c,gazeEnabled:g,onStart:v,onRequestCalibration:()=>d(!0),videoFeedRef:m,interviewId:t})})};typeof window<"u"&&(window.InterviewWidget={InterviewWidget:Ws,InterviewWidgetProvider:Qs}),he.InterviewWidget=Ws,he.InterviewWidgetProvider=Qs,he.default=Ws,Object.defineProperties(he,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
187
+ `})})};function gh({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(mh,{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 ph=({state:e,thinkingTime:t,nextPhase:r})=>o.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-6 iw-items-center iw-justify-center iw-text-center iw-h-full ",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1",children:"Get Ready to Answer"}),o.jsx("p",{className:"iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]",children:"After 30-seconds thinking time, recording will start automatically, or you can begin recording early by clicking the button below."})]}),o.jsxs("div",{className:"iw-flex iw-items-center iw-justify-center iw-gap-2",children:[o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-1",children:[o.jsx(sn,{className:"iw-size-4 iw-text-orange-600"}),o.jsx("p",{className:"iw-text-gray-700 iw-text-sm",children:"Time to think: "})]}),o.jsx(zs,{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(He,{onClick:()=>{r()},children:"Start Answering"})})]}),xh=({sttError:e})=>o.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full",children:[o.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 60 60",fill:"none",children:[o.jsx("rect",{width:60,height:60,rx:30,fill:"url(#prefix__paint0_linear_1460_12482)"}),o.jsx("path",{d:"M28.127 14c.276 7.685 6.442 13.851 14.127 14.127-7.684.276-13.85 6.442-14.127 14.127-.275-7.685-6.442-13.851-14.126-14.127 7.684-.276 13.85-6.442 14.126-14.127zM38.937 31.873A7.331 7.331 0 0046 38.937 7.331 7.331 0 0038.937 46a7.331 7.331 0 00-7.064-7.063 7.331 7.331 0 007.064-7.064z",fill:"#fff"}),o.jsx("defs",{children:o.jsxs("linearGradient",{id:"prefix__paint0_linear_1460_12482",x1:30,y1:-6.563,x2:77.813,y2:54.375,gradientUnits:"userSpaceOnUse",children:[o.jsx("stop",{offset:.211,stopColor:"#5C92FA"}),o.jsx("stop",{offset:1,stopColor:"#A75FFD"})]})})]}),o.jsx("h3",{className:"iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1 iw-mt-3",children:"Just a moment... We're analyzing your response"}),o.jsx("p",{className:"iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]",children:"After transcription, you'll have 45 sec to review your answer."}),e&&o.jsxs("div",{className:"iw-mt-2 iw-text-xs iw-text-red-600",children:["Transcription error: ",e.message,e.recoverable&&" (attempting to continue)"]})]}),Yi=5;function yh({isOpen:e,onClose:t,warningCount:r,violationType:i,onDisqualify:n}){const[s,a]=h.useState(10),c=h.useRef(t);if(h.useEffect(()=>{c.current=t},[t]),h.useEffect(()=>{if(!e)return;const w=setInterval(()=>{a(m=>m<=1?(c.current(),10):m-1)},1e3);return()=>clearInterval(w)},[e]),h.useEffect(()=>{e&&a(10)},[e]),h.useEffect(()=>(e?(document.body.style.overflow="hidden",document.body.classList.add("interview-widget-container")):(document.body.style.overflow="unset",document.body.classList.remove("interview-widget-container")),()=>{document.body.style.overflow="unset",document.body.classList.remove("interview-widget-container")}),[e]),!e)return null;const u=(()=>{switch(i){case"tab_switch":return{title:"Tab Switch Detected",description:"You attempted to switch to another tab or reload application.",icon:o.jsx(co,{className:"iw-h-5 iw-w-5"})};case"fullscreen_exit":return{title:"Full Screen Exit Detected",description:"You attempted to exit full screen mode.",icon:o.jsx(oo,{className:"iw-h-5 iw-w-5"})};case"focus_loss":return{title:"Focus Loss Detected",description:"You lost focus from the interview window.",icon:o.jsx(Yl,{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(on,{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(Kl,{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(on,{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(on,{className:"iw-h-5 iw-w-5"})};default:return{title:"Violation Detected",description:"You attempted to perform an action that is not allowed.",icon:o.jsx(Nr,{className:"iw-h-5 iw-w-5"})}}})(),d=Yi-r,f=()=>{r+1>Yi?n():t()};return o.jsx("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-black/60 iw-p-4 iw-backdrop-blur-sm",children:o.jsxs("div",{className:"iw-w-full iw-max-w-md iw-rounded-2xl iw-border iw-border-gray-100 iw-bg-white iw-shadow-xl",children:[o.jsxs("div",{className:"iw-p-6 iw-pb-0",children:[o.jsxs("div",{className:"iw-mb-6 iw-flex iw-items-start iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-12 iw-w-12 iw-flex-shrink-0 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-red-50",children:o.jsx(Nr,{className:"iw-h-6 iw-w-6 iw-text-red-500"})}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsx("h2",{className:"iw-mb-1 iw-text-xl iw-font-semibold iw-text-gray-900",children:"Security Violation"}),o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[o.jsx("span",{className:"iw-text-sm iw-text-gray-500",children:"Warning"}),o.jsx("div",{className:"iw-flex iw-gap-1",children:Array.from({length:Yi}).map((w,m)=>o.jsx("div",{className:`iw-h-2 iw-w-2 iw-rounded-full ${m<=r-1?"iw-bg-red-500":"iw-bg-gray-200"}`},m))}),o.jsxs("span",{className:"iw-text-sm iw-text-gray-500",children:["(",r,"/",Yi,")"]})]})]})]}),o.jsx("div",{className:"iw-mb-5 iw-rounded-2xl iw-border iw-border-red-100 iw-p-5",style:{background:"linear-gradient(to right, rgb(254, 242, 242), rgb(254, 245, 235))",borderColor:"rgb(254, 226, 226)"},children:o.jsxs("div",{className:"iw-flex iw-items-start iw-gap-4",children:[o.jsx("div",{className:"iw-flex iw-h-10 iw-w-10 iw-items-center iw-justify-center iw-rounded-xl iw-bg-white iw-shadow-sm",children:u.icon}),o.jsxs("div",{className:"iw-flex-1",children:[o.jsx("h3",{className:"iw-mb-2 iw-font-semibold iw-text-gray-900",children:u.title}),o.jsx("p",{className:"iw-text-sm iw-leading-relaxed iw-text-gray-700",children:u.description}),o.jsxs("div",{className:"iw-mt-3 iw-flex iw-items-center iw-gap-2 iw-text-xs iw-text-red-600",children:[o.jsx(so,{className:"iw-h-3 iw-w-3"}),o.jsx("span",{children:"This action is monitored for interview integrity"})]})]})]})}),o.jsxs("div",{className:"iw-mb-5 iw-grid iw-grid-cols-2 iw-gap-3",children:[o.jsx("div",{className:"iw-rounded-xl iw-border iw-border-amber-200 iw-bg-amber-50 iw-p-4",children:o.jsxs("div",{className:"iw-text-center",children:[o.jsx("div",{className:"iw-mb-1 iw-text-2xl iw-font-bold iw-text-amber-600",children: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(ql,{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(Nr,{className:"iw-h-4 iw-w-4"})}),o.jsxs("div",{children:[o.jsx("div",{className:"iw-text-sm iw-font-semibold",children:"Final Warning"}),o.jsx("div",{className:"iw-text-xs iw-text-red-100",children:"Next violation will disqualify you from this interview"})]})]})})]}),o.jsxs("div",{className:"iw-p-6 iw-pt-0",children:[o.jsx(He,{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 bh=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"})]}),vh=({showHardReloadWarning:e,onContinue:t})=>{const r=()=>{t()};return o.jsxs(Zr,{isOpen:e,onClose:r,closeOnOverlayClick:!1,closeOnEscape:!1,showCloseButton:!1,className:"iw-max-w-lg iw-px-2 iw-rounded-xl",children:[o.jsx("div",{className:"iw-absolute iw-inset-x-0 iw-top-0 iw-h-1 iw-bg-gradient-to-r iw-from-red-500 iw-to-red-600"}),o.jsx("div",{className:"iw-space-y-1 iw-pb-2 iw-pt-3",children:o.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[o.jsx(Nr,{className:"iw-w-5 iw-h-5 iw-text-red-500"}),o.jsx("h3",{className:"iw-text-xl iw-font-semibold iw-text-red-500",children:"Full Screen Exit Detected"})]})}),o.jsx("div",{className:"iw-pt-4 iw-pb-6",children:o.jsx("p",{className:"iw-text-center iw-text-sm iw-leading-relaxed iw-text-gray-500/90",children:"Exiting full screen mode or reloading this page during the session is strictly prohibited. Any attempt to do so will be recorded and may lead to penalties."})}),o.jsx("div",{className:"iw-pt-2 iw-pb-4",children:o.jsxs("button",{onClick:r,className:"iw-w-full iw-flex iw-items-center iw-justify-center iw-gap-2 iw-px-4 iw-py-3 iw-bg-gray-100 iw-text-gray-600 iw-rounded-md iw-font-medium iw-transition-colors hover:iw-bg-gray-200 focus:iw-outline-none focus:iw-ring-2 focus:iw-ring-gray-400 focus:iw-ring-offset-2",children:[o.jsx(bh,{className:"iw-size-4"}),"Continue Session"]})})]})},kh=h.forwardRef(({children:e,onDisqualify:t},r)=>{const[i,n]=h.useState(!1),[s,a]=h.useState(!1),[c,l]=h.useState(!1),[u,d]=h.useState("fullscreen_exit"),{logViolation:f,violationCount:w}=nh({maxViolations:5,onViolation:p=>{s||(n(!0),d(p.type))}}),{enterFullScreen:m,isFullScreen:g,exitFullScreen:v}=Jd({onFullScreenChange(p){!p&&!s&&!c&&(n(!0),f({type:"fullscreen_exit",severity:"high",details:{action:"fullscreen_exit",reason:"Attempted to exit full screen mode"}})),p&&l(!1)}});h.useEffect(()=>{m()},[]),h.useImperativeHandle(r,()=>({exitFullScreenIntentionally:async()=>{l(!0),n(!1),a(!1);try{document.fullscreenElement&&await document.exitFullscreen()}catch(p){console.error("Failed to exit fullscreen:",p)}}}),[]),eh(f),Qd(f),th(),sh();const E=()=>{a(!0),v(),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(yh,{warningCount:w,isOpen:i,violationType:u,onClose:()=>{n(!1),m()},onDisqualify:E}),!i&&w>0&&!s&&!c&&o.jsx(vh,{showHardReloadWarning:!g,logViolation:f,onContinue:m})]})}),_h=({interviewTitle:e,interviewId:t,onComplete:r,onDisqualify:i,className:n="",videoFeedRef:s})=>{var Kr,Ki,Sr;const a=ao(),{baseUrl:c,authToken:l}=Zs(),{timers:u,stt:d,tts:f,proctoring:w}=nn(),m=h.useRef(null),[g,v]=h.useState(null),[E,p]=h.useState(""),A=h.useRef(""),T=h.useRef(null),S={thinkingTime:(u==null?void 0:u.thinkingDuration)||30,answeringTime:(u==null?void 0:u.answeringDuration)||120,editingTime:(u==null?void 0:u.editingDuration)||30},{thinkingTime:G,answeringTime:C,editingTime:B}=S;h.useEffect(()=>{A.current=E},[E]);const Y=h.useRef(!1),{speak:D,stop:Je,error:_e}=ih({config:{baseUrl:c,provider:f==null?void 0:f.provider,authToken:l},onEnd:()=>{Y.current=!1,Z()},onError:()=>{Y.current||(Y.current=!0,Z())}}),we=h.useRef(!1),$e=h.useRef(!1),{startRecording:Qe,stopRecording:Ee,transcribe:vt,error:Ze}=Zd({config:{baseUrl:c,provider:d==null?void 0:d.provider,model:d==null?void 0:d.model,language:d==null?void 0:d.language,authToken:l,qnaId:((Kr=T.current)==null?void 0:Kr.qna_id)||""},onStart:()=>{we.current=!1,$e.current=!1},onStop:()=>{},onTranscriptionComplete:L=>{p(L.transcript),$e.current||($e.current=!0,Z())},onError:L=>{console.error("STT Error:",L),we.current||(we.current=!0,Z())}}),{state:me,startQuestion:je,nextPhase:Z,completeInterview:de}=Kd({config:{thinkingDuration:G,answeringDuration:C,editingDuration:B},callbacks:{onPhaseChange:L=>{switch(L){case ue.FETCHING_QUESTION:P();break;case ue.READING_QUESTION:Pt();break;case ue.ANSWERING:Dt();break;case ue.TRANSCRIBING:Yr();break;case ue.SUBMITTING:lt();break}},onInterviewEnd:()=>{r==null||r()}}});h.useEffect(()=>{je()},[]);const{execute:P,loading:oe}=Xd(async()=>{var et,Bt;const L=await a.generateQuestion({interviewId:t,question:((et=T.current)==null?void 0:et.question)||"",qnaId:((Bt=T.current)==null?void 0:Bt.qna_id)||"",answer:A.current});return T.current=L.data,L},{onSuccess:async L=>{L&&L.data&&(p(""),v(L.data),Z())},onError:L=>{console.error("Failed to fetch questions:",L)}}),lt=h.useCallback(async()=>{je()},[je]),Pt=h.useCallback(async()=>{var L;if((L=T.current)!=null&&L.question)try{Y.current=!1,await D(T.current.question),T.current.is_interview_done&&(await io(2e3),de())}catch(et){console.error("Failed to speak question:",et)}else Z()},[D,Z,de]),Dt=h.useCallback(async()=>{try{await Qe(C)}catch(L){console.error("Failed to start recording:",L),Z()}},[Qe,Z]),Yr=h.useCallback(async()=>{try{const L=await Ee();await vt(L)}catch(L){console.error("STT processing failed:",L),!we.current&&!$e.current&&(we.current=!0,Z())}},[Ee,vt,Z]),Rt=h.useCallback(async L=>{var et;Je(),await((et=m.current)==null?void 0:et.exitFullScreenIntentionally());try{(await a.generateQuestion({interviewId:t,isInterviewDone:!0})).success&&(L==null||L(),de(),sessionStorage.removeItem(Zi))}catch(Bt){console.error("API call failed:",Bt)}},[t,Je,a]),Ot=()=>{const{phase:L}=me;switch(L){case ue.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(He,{onClick:je,className:"iw-mt-2 iw-w-40",children:"Start Interview"})]});case ue.FETCHING_QUESTION:return o.jsx(wh,{});case ue.READING_QUESTION:return o.jsx(gh,{ttsError:_e});case ue.THINKING:return o.jsx(ph,{state:me,thinkingTime:G,nextPhase:Z});case ue.ANSWERING:return o.jsx(fh,{state:me,answeringTime:C,nextPhase:Z,sttError:Ze});case ue.TRANSCRIBING:return o.jsx(xh,{sttError:Ze});case ue.EDITING:case ue.SUBMITTING:return o.jsx("div",{className:"iw-space-y-4 iw-h-full",children:o.jsx(ch,{value:E,onChange:et=>p(et.target.value),onSubmit:()=>Z(),isSubmitDisabled:!E.trim()||oe,state:me,editingTime:B})});case ue.COMPLETED:return null;default:return null}};return o.jsx(o.Fragment,{children:w!=null&&w.enabled?o.jsxs(kh,{ref:m,onDisqualify:()=>Rt(i),children:[o.jsx(pl,{title:e,onExit:()=>Rt()}),o.jsx(gl,{currentQuestion:g,phase:me.phase,className:n,interviewId:t,interview_duration:(Ki=T==null?void 0:T.current)==null?void 0:Ki.interview_duration,videoFeedRef:s,children:Ot()})]}):o.jsxs(o.Fragment,{children:[o.jsx(pl,{title:e,onExit:()=>Rt()}),o.jsx(gl,{currentQuestion:g,phase:me.phase,className:n,interviewId:t,interview_duration:(Sr=T==null?void 0:T.current)==null?void 0:Sr.interview_duration,videoFeedRef:s,children:Ot()})]})})},Ws=({title:e,interviewId:t,onInterviewEnd:r,onInterviewDisqualify:i,className:n=""})=>{const[s,a]=h.useState(!1),[c,l]=h.useState(!0),[u,d]=h.useState(!1),{proctoring:f}=nn(),w=h.useRef(null),m=h.useRef(null),g=(f==null?void 0:f.gazeAnalysisEnabled)===!0,v=()=>{a(!0),l(!1)};return h.useEffect(()=>{if(s&&u&&m.current&&g)try{m.current.setReference()}finally{d(!1)}},[s,u,g]),s?o.jsx("div",{className:"interview-widget-container",children:o.jsx("div",{ref:w,className:`iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${n}`,children:o.jsx("div",{className:"iw-h-full iw-flex iw-flex-col",children:o.jsx(_h,{interviewTitle:e??"Interview",interviewId:t,className:n,onComplete:r??(()=>{}),onDisqualify:i,videoFeedRef:m})})})}):o.jsx("div",{className:"interview-widget-container",children:o.jsx($d,{isOpen:c,gazeEnabled:g,onStart:v,onRequestCalibration:()=>d(!0),videoFeedRef:m,interviewId:t})})};typeof window<"u"&&(window.InterviewWidget={InterviewWidget:Ws,InterviewWidgetProvider:Qs}),he.InterviewWidget=Ws,he.InterviewWidgetProvider=Qs,he.default=Ws,Object.defineProperties(he,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});