PageSourceSearch

https://www.asgardhire.ai/assets/practice-interview._interviewId.lazy-B00dTTY1.js

js asgardhire.ai collected 2026-10-02 01:12:23 UTC 25,300 bytes, 6 lines download raw bytes

1import{p as ae,j as e,al as X,P as oe,r as c,J as de,bO as ce,c as le,q as ue,aC as me,T as G,au as Y}from"./index-D4_zyxsV.js";import{g as xe}from"./hero-images-DwkhtOPN.js";import{a as fe,b as Z,c as pe,Q as ge,e as he}from"./practice-interview-apis-BvGKDTf0.js";import{C as be}from"./clock-3-DcjFkejF.js";import{R as ee}from"./radio-BSAVU_KX.js";import{P as we}from"./phone-Bael98tX.js";import{P as ve}from"./PracticeInterviewEvaluation-B2T7guR1.js";import{c as H,d as ye,b as je,e as ke}from"./interview-history-apis-D2bFQnN3.js";import{U as Ne}from"./UnifiedMediaTestDialog-Le0q3m1H.js";import"./interview-score-J6QmC5bx.js";import"./building-2-CfSP8rk7.js";import"./play-circle-CWMY5nSz.js";import"./lightbulb-Bb150vGz.js";import"./award-DAQGDEdT.js";import"./rotate-ccw-DBBjJCWw.js";import"./clock-D4tkBG6G.js";import"./clipboard-list-BdO-gTfO.js";import"./shield-check-BhZSLG4G.js";/**
2 * @license lucide-react v0.344.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const te=ae("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);function Ie(t,r){return`In this interview, you will be assessed${t?` for the ${t} role${r?` at ${r}`:""}`:""}. The AI interviewer will ask a series of questions tailored to the job and your profile.`}function Se({jobTitle:t,companyName:r,description:i,onBack:l,onStart:s,isStarting:a}){const n=xe(t+r);return e.jsxs("div",{className:"min-h-screen bg-muted/50",children:[e.jsx("div",{className:"relative pt-safe",style:{background:n},children:e.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 pt-5 pb-8",children:[e.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 text-white/70 hover:text-white text-sm font-medium transition-colors mb-10",children:[e.jsx(X,{size:16}),"Back"]}),r&&e.jsx("p",{className:"text-white/60 text-xs font-semibold uppercase tracking-widest mb-1",children:r}),e.jsx("h1",{className:"text-white text-2xl sm:text-3xl font-black leading-tight mb-1",children:"You're all set!"}),e.jsx("p",{className:"text-white/60 text-sm mt-2",children:"Review the format, then check your microphone and audio"})]})}),e.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-8 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-foreground mb-4",children:"You're ready if…"}),e.jsx("div",{className:"bg-card rounded-xl border border-border shadow-sm divide-y divide-border/50",children:["You're in a quiet space with no background noise","Your microphone and speakers are working","You have 10–15 minutes of uninterrupted time","Your screen will stay awake during the call"].map(m=>e.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",children:[e.jsx(oe,{size:18,className:"text-success flex-shrink-0"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:m})]},m))})]}),e.jsxs("div",{className:"bg-card rounded-xl border border-border shadow-sm p-5",children:[e.jsx("h2",{className:"text-sm font-bold text-foreground mb-3",children:"Interview Details"}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:i||Ie(t,r)})]}),e.jsxs("div",{className:"bg-card rounded-xl border border-border shadow-sm p-6",children:[e.jsx("button",{type:"button",onClick:s,disabled:a,className:"w-full py-3.5 bg-primary hover:bg-primary/90 text-primary-foreground font-bold rounded-xl text-base transition-colors shadow-sm disabled:opacity-50",children:a?"Opening device check…":"Check microphone & audio"}),e.jsx("p",{className:"text-xs text-muted-foreground text-center mt-3",children:"You will test your microphone, speakers and environment before the interview starts"})]})]})]})}function V(t,r){const i=r.text.trim();if(!i)return t;if(r.role==="system"){const n=t.at(-1);return n?.role==="system"&&n.text===i?t:[...t,{id:`system-${t.length}-${i}`,role:"system",text:i}]}const l=`${r.role}-${r.turnId??0}`,s=t.findIndex(n=>n.id===l),a={id:l,role:r.role,text:i,interim:r.interim};return s===-1?[...t,a]:t[s].text===i&&t[s].interim===r.interim?t:t.map((n,m)=>m===s?a:n)}const re="https://voice.asgardhire.ai/embed/dograh-widget.js",ne="emb_qyEymUieBpeu6SU9mWIPeD1lB0W2BwQ3gER4YKseltw",Ce="https://voice.asgardhire.ai",J="__dograh_ws_interceptor__";async function Ee(t,r,i=navigator.mediaDevices){if(!r)return t.start();const l=Object.getOwnPropertyDescriptor(i,"getUserMedia"),s=i.getUserMedia.bind(i);let a=!1,n;const m=()=>{a||(a=!0,n!=null&&window.clearTimeout(n),l?Object.defineProperty(i,"getUserMedia",l):delete i.getUserMedia)};Object.defineProperty(i,"getUserMedia",{configurable:!0,writable:!0,value:async o=>{if(!(!!o?.audio&&!o?.video))return s(o);m();const j=typeof o?.audio=="object"?o.audio:{};return s({...o,audio:{...j,deviceId:{exact:r}}})}}),n=window.setTimeout(m,15e3);try{return await t.start()}finally{m()}}const Te={botBuffer:"",userCommitted:"",userLastChunk:"",agentTurnId:0,userTurnId:0,userFinalizedAt:null,userTurnAdvancedEarly:!1},_e=1500;function Q(t){return String(t.payload?.text??t.payload?.content??t.payload?.transcript??t.payload?.transcription??t.text??t.content??t.transcript??t.transcription??"")}function Re(t,r,i=Date.now()){const l=r.type||r.event||"";if(l==="rtf-bot-text"){const s=Q(r);if(!s)return{state:t,update:null};const a=t.botBuffer&&!/^[.,!?;:\s]/.test(s)&&!t.botBuffer.endsWith(" "),n=t.botBuffer+(a?" ":"")+s,m=t.agentTurnId===0?1:t.agentTurnId;return{state:{...t,botBuffer:n,agentTurnId:m},update:{role:"agent",text:n,turnId:m,interim:!0}}}if(l==="rtf-bot-stopped-speaking"){const s=t.botBuffer.trim();return{state:t.userTurnAdvancedEarly?{...t,botBuffer:"",userTurnAdvancedEarly:!1}:{...t,botBuffer:"",userTurnId:t.userTurnId+1,userCommitted:"",userLastChunk:"",userFinalizedAt:null},update:s?{role:"agent",text:s,turnId:t.agentTurnId,interim:!1}:null}}if(l==="rtf-bot-started-speaking"){const s=(t.userCommitted+" "+t.userLastChunk).trim();return{state:{...t,userCommitted:s,userLastChunk:"",agentTurnId:t.agentTurnId+1,botBuffer:"",userFinalizedAt:s?i:null},update:s?{role:"user",text:s,turnId:Math.max(t.userTurnId,1),interim:!1}:null}}if(l==="rtf-user-transcription"){const s=Q(r),a=!!(r.payload?.final??r.payload?.is_final??r.payload?.finalized??r.final??r.is_final??r.finalized),n=t.userFinalizedAt==null?null:i-t.userFinalizedAt;if(n!=null&&n>_e){const j=t.userTurnId+1,h=s.trim();return{state:{...t,userTurnId:j,userCommitted:a?h:"",userLastChunk:a?"":s,userFinalizedAt:null,userTurnAdvancedEarly:!0},update:h?{role:"user",text:h,turnId:j,interim:!a}:null}}const x=t.userTurnId===0?1:t.userTurnId,o=(t.userCommitted+" "+s).trim();return{state:{...t,userTurnId:x,userLastChunk:a?"":s,userCommitted:a?o:t.userCommitted},update:o?{role:"user",text:o,turnId:x,interim:!a&&t.userFinalizedAt==null}:null}}return l==="rtf-user-mute-started"?t.userLastChunk?{state:{...t,userCommitted:(t.userCommitted+" "+t.userLastChunk).trim(),userLastChunk:""},update:null}:{state:t,update:null}:{state:t,update:null}}function Le(){if(window[J])return;window[J]=!0;const t=window.WebSocket;window.WebSocket=function(r,i){const l=i?new t(r,i):new t(r);if(typeof r=="string"&&(r.includes("emb_session")||r.includes("/signaling/"))){let s=Te;const a=n=>{window.dispatchEvent(new CustomEvent("dograh:transcript",{detail:n}))};l.addEventListener("message",n=>{try{const m=JSON.parse(n.data),{state:x,update:o}=Re(s,m,Date.now());s=x,o&&a(o)}catch{}})}return l},window.WebSocket.prototype=t.prototype,window.WebSocket.CONNECTING=t.CONNECTING,window.WebSocket.OPEN=t.OPEN,window.WebSocket.CLOSING=t.CLOSING,window.WebSocket.CLOSED=t.CLOSED}function se(){return`${re}?token=${ne}&environment=production&apiEndpoint=${Ce}`}const q={"not-configured":{label:"Practice interviews unavailable",message:"Practice interviews aren't available in this version of the app. Trying again won't help - please use the web app instead.",retryable:!1},"script-failed":{label:"Couldn't reach the interviewer",message:"We couldn't reach the interview service. It may be temporarily unavailable - check your connection and try again.",retryable:!0},"widget-unavailable":{label:"Interviewer didn't start",message:"The interview service loaded but didn't start in time. Trying again usually fixes this.",retryable:!0}},Pe=1e4,We=150,Ae=[1e3];function Fe(t=Pe,r=We){const i=()=>window.DograhWidget,l=i();return l?Promise.resolve(l):new Promise(s=>{let a=0;const n=window.setInterval(()=>{a+=r;const m=i();m?(window.clearInterval(n),s(m)):a>=t&&(window.clearInterval(n),s(null))},r)})}async function De({configured:t,loadScript:r,waitForWidget:i,delay:l,retryDelaysMs:s=Ae}){if(!t)return{ok:!1,reason:"not-configured"};let a="script-failed";for(let n=0;n<=s.length;n++){n>0&&await l(s[n-1]);try{await r()}catch{a="script-failed";continue}const m=await i();if(m)return{ok:!0,widget:m};a="widget-unavailable"}return{ok:!1,reason:a}}function Me(){const t=se();if(!t||document.querySelector(`link[rel="preload"][href="${t}"]`))return;const r=document.createElement("link");r.rel="preload",r.as="script",r.href=t,document.head.appendChild(r)}function ze(t,r={}){const i=document.getElementById("dograh-widget-script");return i&&i.remove(),delete window.DograhWidget,new Promise((l,s)=>{const a=se(),n=document.createElement("script");n.id="dograh-widget-script",n.src=a,n.async=!0,n.setAttribute("data-dograh-context",JSON.stringify({interview_id:t,...r})),n.onload=()=>l(),n.onerror=()=>{n.remove(),s(new Error("Failed to load Dograh widget script"))},document.head.appendChild(n)})}function Oe({interviewId:t,jobTitle:r,interviewType:i,selectedDeviceId:l,onDeviceError:s,onEnd:a,prearmedContext:n}){const m=fe(),x=Z(),[o,g]=c.useState("idle"),[j,h]=c.useState("Starting…"),[N,y]=c.useState([]),[I,A]=c.useState(0),[F,_]=c.useState("Selected microphone"),[S,R]=c.useState(null),[D,M]=c.useState(0),z=c.useRef(null),b=c.useRef(null),C=c.useRef(!1),k=c.useCallback((u,f)=>{y(d=>V(d,{role:u,text:f}))},[]),E=c.useCallback(u=>{if(!C.current){if(C.current=!0,typeof u=="number"&&Number.isFinite(u)){const f=Math.floor(u/60),d=String(Math.floor(u%60)).padStart(2,"0");k("system",`Call ended - ${f}m ${d}s`)}g("ended"),window.setTimeout(a,600)}},[k,a]);c.useEffect(()=>{let u=[],f=null;const d=()=>
6{if(f=null,u.length===0)return;const w=u;u=[],y(v=>w.reduce(V,v))},P=w=>{const v=w.detail;!v||!["agent","user","system"].includes(v.role)||(u.push(v),f==null&&(f=requestAnimationFrame(d)))};return window.addEventListener("dograh:transcript",P),()=>{window.removeEventListener("dograh:transcript",P),f!=null&&cancelAnimationFrame(f)}},[]),c.useEffect(()=>{z.current?.scrollIntoView({block:"nearest"})},[N]),c.useEffect(()=>{if(o!=="connected")return;const u=window.setInterval(()=>A(f=>f+1),1e3);return()=>window.clearInterval(u)},[o]),c.useEffect(()=>{l&&navigator.mediaDevices.enumerateDevices().then(u=>{const f=u.find(d=>d.kind==="audioinput"&&d.deviceId===l);_(f?.label||"Selected microphone")}).catch(()=>{})},[l]),c.useEffect(()=>{Le();let u=!1,f=!1;R(null),g("idle"),h(D===0?"Starting…":"Trying again…");const d=(n??x.mutateAsync(t).then(w=>w.context)).catch(w=>(console.warn("[PracticeInterviewCall] arm failed, starting without context:",w),{}));return(async()=>{const w=await d;if(u)return;const v=await De({configured:!!(re&&ne),loadScript:()=>ze(t,w),waitForWidget:()=>Fe(),delay:p=>new Promise(W=>window.setTimeout(W,p))});if(u)return;if(!v.ok){const p=q[v.reason];R(v.reason),g("failed"),h(p.label),k("system",p.message);return}const T=v.widget;b.current=T,T.onStatusChange((p,W)=>{const ie={idle:"Ready",connecting:"Connecting…",connected:"Interview in progress",failed:"Connection failed"};g(p),h(ie[p]??W??p)}),T.onCallConnected(({workflowRunId:p})=>{m.mutate({interviewId:t,workflowRunId:String(p)},{onError:W=>console.error("[PracticeInterviewCall] failed to save run ID:",W)}),k("system","Interview live - speak your answers")}),T.onCallDisconnected(({durationSeconds:p})=>{E(p)}),T.onError(p=>{g("failed"),h("Connection failed"),k("system",`Error: ${p.message}`)}),f||(f=!0,g("connecting"),h("Connecting…"),Ee(T,l,navigator.mediaDevices))})(),()=>{if(u=!0,b.current){try{b.current.end()}catch{}b.current=null}}},[D]);const O=()=>{if(b.current)try{b.current.end()}catch{}E(I)},$=()=>{y([]),M(u=>u+1)},U=()=>{if(C.current=!0,b.current)try{b.current.end()}catch{}s?.()}
6,B={idle:"bg-foreground/90",connecting:"bg-warning animate-pulse",connected:"bg-success",failed:"bg-destructive",ended:"bg-foreground/90"},L=`${String(Math.floor(I/60)).padStart(2,"0")}:${String(I%60).padStart(2,"0")}`;return e.jsxs("div",{className:"dark flex min-h-screen flex-col bg-background font-funnel text-foreground",children:[e.jsx("header",{className:"border-b border-foreground/10 bg-card px-4 pt-safe-4 pb-4 sm:px-7",children:e.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between gap-4",children:[e.jsx("button",{type:"button",onClick:O,className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-foreground/10 bg-foreground/5 text-muted-foreground/60 hover:bg-foreground/10","aria-label":"Leave practice interview",children:e.jsx(X,{size:18})}),e.jsxs("div",{className:"min-w-0 text-center",children:[e.jsx("p",{className:"truncate text-sm font-bold text-foreground sm:text-base",children:r}),e.jsx("p",{className:"mt-0.5 text-xs font-semibold text-muted-foreground",children:i})]}),e.jsxs("div",{className:"flex h-10 min-w-16 items-center justify-center gap-1.5 rounded-xl border border-foreground
6/10 bg-foreground/5 px-3 text-xs font-bold text-muted-foreground/60",children:[e.jsx(be,{size:14})," ",L]})]})}),e.jsxs("main",{className:"mx-auto grid w-full max-w-7xl flex-1 gap-5 overflow-hidden p-4 sm:p-6 lg:grid-cols-[minmax(280px,0.72fr)_minmax(420px,1.28fr)] lg:p-7",children:[e.jsxs("section",{className:"flex min-h-[330px] flex-col items-center justify-center overflow-hidden rounded-3xl border border-foreground/10 bg-gradient-to-b from-card to-background p-6 text-center shadow-2xl",children:[e.jsxs("div",{className:"mb-7 flex items-center gap-2 rounded-full border border-foreground/10 bg-background/40 px-4 py-2",children:[e.jsx("span",{className:`h-2.5 w-2.5 rounded-full ${B[o]}`}),e.jsx("span",{className:"text-xs font-bold text-muted-foreground/60",children:j})]}),e.jsxs("div",{className:"relative flex h-40 w-40 items-center justify-center sm:h-48 sm:w-48 shrink-0",children:[o==="connected"&&e.jsx("span",{className:"absolute inset-0 animate-ping rounded-full border border-primary/20"}),e.jsx("span",{className:"absolute inset-5 rounded-full bg-primary/10 blur-xl"}),e.jsx("div",{className:"relative flex h-28 w-28 items-center justify-center rounded-full border border-primary/25 bg-gradient-to-br from-primary to-primary/55 shadow-[0_0_70px_hsl(var(--primary)/0.32)] sm:h-32 sm:w-32 shrink-0",children:e.jsx(te,{size:48,className:"text-foreground"})})]}),e.jsx("h1",{className:"mt-7 text-xl font-bold",children:"AI practice interviewer"}),e.jsx("p",{className:"mt-2 max-w-sm text-sm leading-6 text-muted-foreground",children:S?q[S].message:o==="connected"?"Answer naturally. Your live transcript appears alongside the conversation.":"Your tailored interview is getting ready."}),e.jsxs("div",{className:"mt-7 flex items-center gap-2 rounded-xl bg-foreground
6/5 px-4 py-3 text-xs font-semibold text-muted-foreground",children:[e.jsx(ce,{size:15,className:o==="connected"?"text-success":"text-muted-foreground"}),o==="connected"?`${F} is live`:`Connecting ${F}`]}),S&&q[S].retryable&&e.jsx("button",{type:"button",onClick:$,className:"mt-4 rounded-xl bg-primary px-5 py-2.5 text-xs font-bold text-primary-foreground hover:bg-primary/90",children:"Try again"}),o==="failed"&&s&&e.jsx("button",{type:"button",onClick:U,className:"mt-4 rounded-xl border border-foreground/15 bg-foreground/5 px-4 py-2.5 text-xs font-bold text-foreground hover:bg-foreground/10",children:"Check microphone again"})]}),e.jsxs("section",{className:"flex min-h-[420px] flex-col overflow-hidden rounded-3xl border border-foreground/10 bg-card shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-foreground/10 px-5 py-4 sm:px-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-bold text-foreground",children:"Live transcript"}),e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Words update as they are spoken"})]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-success/10 px-3 py-1 text-[11px] font-bold text-success",children:[e.jsx(ee,{size:12,className:o==="connected"?"animate-pulse":""})," Live"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-5 sm:px-6",children:N.length===0?e.jsxs("div",{className:"flex h-full min-h-52 flex-col items-center justify-center text-center",children:[e.jsx(Ue,{}),e.jsx("p",{className:"mt-4 text-sm font-semibold text-muted-foreground",children:"The conversation will appear here"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Start speaking once the interviewer asks the first question."})]}):e.jsxs("div",{className:"space-y-5 pb-4","aria-live":"polite","aria-relevant":"additions text",children:[N.map(u=>e.jsx($e,{line:u},u.id)),e.jsx("div",{ref:z})]})})]})]}
6),e.jsx("footer",{className:"border-t border-foreground/10 bg-card px-4 py-4",children:e.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-center gap-4",children:[e.jsxs("div",{className:"hidden text-right sm:block",children:[e.jsx("p",{className:"text-xs font-bold text-muted-foreground/60",children:"Finished your answer?"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"End only when you have completed the interview"})]}),e.jsxs("button",{type:"button",onClick:O,disabled:o==="ended",className:"inline-flex items-center gap-2 rounded-xl bg-destructive px-6 py-3 text-sm font-bold text-destructive-foreground shadow-lg shadow-destructive/30 transition-colors hover:bg-destructive/90 disabled:opacity-40","aria-label":"End interview",children:[e.jsx(we,{size:18,className:"rotate-[135deg]"})," End interview"]})]})})]})}const $e=c.memo(function({line:r}){return r.role==="system"?e.jsxs("div",{className:"flex items-center gap-3 py-1 text-[11px] font-semibold text-muted-foreground",children:[e.jsx("span",{className:"h-px flex-1 bg-foreground
6/5"}),r.text,e.jsx("span",{className:"h-px flex-1 bg-foreground/5"})]}):e.jsxs("div",{className:`flex items-start gap-3 ${r.role==="user"?"flex-row-reverse":""}`,children:[e.jsx("span",{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${r.role==="agent"?"bg-primary/20 text-primary":"bg-foreground/10 text-foreground/80"}`,children:r.role==="agent"?e.jsx(te,{size:16}):e.jsx(de,{size:16})}),e.jsxs("div",{className:`max-w-[82%] rounded-2xl border px-4 py-3 ${r.role==="agent"?"rounded-tl-sm border-primary/20 bg-primary/10":"rounded-tr-sm border-foreground/10 bg-foreground/5"}`,children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:`text-[11px] font-bold ${r.role==="agent"?"text-primary":"text-foreground/70"}`,children:r.role==="agent"?"Interviewer":"You"}),r.interim&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-success",children:[e.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-success"})," transcribing"]})]}),e.jsx("p",{className:"text-sm leading-6 text-foreground/90",children:r.text})]})]})});function Ue(){return e.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-2xl border border-foreground
6/10 bg-foreground/5 text-muted-foreground shrink-0",children:e.jsx(ee,{size:24})})}function Be(){const{interviewId:t}=K.useParams(),r=K.useSearch(),i=ue(),l=me(),s=!r.jobTitle||!r.companyName,a=H(s?t:""),n=r.jobTitle??a.data?.job_title??"",m=r.companyName??a.data?.company_name??"",[x,o]=c.useState("ready"),g=pe(t,x==="ready"),j=g.data?.reason===ge,h=g.data?.ready??!1,N=g.data?.description??r.description??"",y=ye(),[I,A]=c.useState(null),[F,_]=c.useState(null),[S,R]=c.useState(void 0),[D,M]=c.useState(void 0),[z,b]=c.useState(""),C=c.useRef(l);c.useEffect(()=>{C.current=l});const k=Z(),E=c.useRef(null),O=c.useCallback(()=>{Me(),E.current||(E.current=k.mutateAsync(t).then(d=>d.context))},[k,t]),$=()=>{x==="ready"?i({to:"/explore-jobs",search:Y("fresh")}):o("ready")},U=()=>{O(),o("device-check")},B=c.useMemo(()=>({interview_id:t,jd_id:r.jobId,jd_title:n,job_description:N,org_name:m,interview_duration:10,number_of_questions:5}),[m,N,t,n,r.jobId]),L=c.useCallback(async()=>{o("evaluating"),_(null);try{const d=await he(t,C.current);if(d.accepted){o("eval-pending"),y();return}R(d.recordingUrl),M(d.durationMs),A(d.feedback),o("evaluated"),y()}catch(d){const P=d?.response?.data?.message??d?.response?.data?.error??d?.message??"Evaluation failed. Please try again.";console.error("[PracticeInterview] evaluate-candidate error:",d?.response??d),_(P),o("eval-error")}},[t,y]),u=H(x==="eval-pending"?t:"");c.useEffect(()=>{if(x!=="eval-pending"||!u.data)return;const d=u.data;if(d.interview_feedback){R(d.candidate_recording_s3_url??void 0),M(d.duration_ms??void 0),A(d.interview_feedback),o("evaluated"),y();return}je(d)&&(_(ke(d.interview_status).body),o("eval-error"))},[x,u.data,y]);const f=c.useCallback(()=>{L()},[L]);return x==="eval-pending"?e.jsxs("div",{className:"dark min-h-screen flex flex-col items-center justify-center gap-6 p-8 bg-background text-foreground",children:[e.jsx(G,{size:64,variant:"brand",spin:!0,title:""}),e.jsx("p",{className:"text-foreground text-center text-base font-medium max-w-xs leading-relaxed",children:"Still scoring your interview. This is taking a little longer than usual - you can wait here, or check practice history later."}),e.jsx("button",{onClick:()=>i({to:"/interview-history"}
6),className:"px-6 py-3 rounded-xl bg-foreground/10 text-foreground text-sm font-medium transition-colors hover:bg-foreground/20",children:"View practice history"})]}):x==="evaluating"?e.jsxs("div",{className:"dark min-h-screen flex flex-col items-center justify-center gap-6 p-8 bg-background text-foreground",children:[e.jsx(G,{size:64,variant:"brand",spin:!0,title:""}),e.jsx("p",{className:"text-foreground text-center text-base font-medium max-w-xs leading-relaxed",children:"Evaluating your interview. This will only take a few seconds..."})]}):x==="evaluated"&&I?e.jsx(ve,{feedback:I,recordingUrl:S,durationMs:D,jobTitle:n,companyName:m,interviewType:r.interviewType??"Practice interview",onBack:()=>i({to:"/interview-history"}),onPracticeAnother:()=>i({to:"/explore-jobs",search:Y("fresh")})}):x==="eval-error"?e.jsxs("div",{className:"dark min-h-screen flex flex-col items-center justify-center gap-6 p-8 bg-background text-foreground",children:[e.jsx("p",{className:"text-foreground text-xl font-bold",children:"Interview Completed"}),e.jsx("p",{className:"text-destructive text-sm text-center max-w-xs leading-relaxed",children:F}),e.jsxs("div",{className:"flex flex-col items-center gap-3 mt-2 w-full max-w-xs",children:[e.jsx("button",{onClick:L,className:"w-full px-6 py-3 rounded-xl bg-warning text-warning-foreground text-sm font-semibold transition-colors hover:bg-warning/90",children:"Retry Evaluation"}),e.jsx("button",{onClick:()=>i({to:"/interview-history"}
6),className:"w-full px-6 py-3 rounded-xl bg-foreground/10 text-foreground text-sm font-medium transition-colors hover:bg-foreground/20",children:"View practice history"})]})]}):x==="call"?e.jsx(Oe,{interviewId:t,jobTitle:n,interviewType:r.interviewType??"Practice Interview",selectedDeviceId:z,onDeviceError:()=>o("device-check"),onEnd:f,prearmedContext:E.current??void 0}):x==="device-check"?e.jsx("div",{className:"min-h-screen bg-muted/50",children:e.jsx(Ne,{interviewData:B,onBack:()=>o("ready"),onComplete:d=>{b(d),o("call")}})}):x==="ready"&&j?e.jsxs("div",{className:"dark min-h-screen flex flex-col items-center justify-center gap-6 p-8 bg-background text-foreground",children:[e.jsx("p",{className:"text-foreground text-xl font-bold",children:"We couldn't prepare this interview"}),e.jsx("p",{className:"text-destructive text-sm text-center max-w-xs leading-relaxed",children:g.data?.message??"Something went wrong building your questions. Your credit has been returned."}),e.jsx("button",{onClick:()=>i({to:"/explore-jobs",search:Y("fresh")}),className:"px-6 py-3 rounded-xl bg-warning text-warning-foreground text-sm font-semibold transition-colors hover:bg-warning/90",children:"Try another role"})]}):x==="ready"&&!h?e.jsxs("div",{className:"dark min-h-screen flex flex-col items-center justify-center gap-6 p-8 bg-background text-foreground",children:[e.jsx(G,{size:64,variant:"brand",spin:!0,title:""}),e.jsxs("p",{className:"text-foreground text-center text-base font-medium max-w-xs leading-relaxed",children:["Preparing your interview questions",n?` for ${n}`:"",". This usually takes a few seconds..."]})]}):e.jsx(Se,{jobTitle:n,companyName:m,description:N,onBack:$,onStart:U,isStarting:!1})}const K=le("/_candidate/practice-interview/$interviewId")({component:Be});export{K as Route};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.