1import{d as A,r,j as t}from"./vendor-react-DfYGAhtm.js";import{t as T,k as L,m as p,g as O}from"./index-DsBgCU7r.js";import{W as d}from"./recording.constants-Cr2cQllO.js";import{g as C}from"./errors-BYKXB8DF.js";import{u as P,I as B,a as G,C as z,g as F}from"./recordingSteps-B9IUj48e.js";import{u as V}from"./useWitnessFlowDeviceB-BXT16w5i.js";import{WitnessFlowRoutes as K}from"./index-CX6eACXF.js";import{h as U,a as o,V as _,T as l}from"./vendor-ui-DA_r9yXk.js";import"./vendor-icons-1odZwi-b.js";import"./vendor-state-BsBVN-fX.js";import"./vendor-forms-BP-7CbAP.js";import"./fix-webm-duration-DBGubGlL.js";import"./inspectionAnalysis.runtime-CbjBTDqp.js";import"./sseStream-C28FcIBw.js";import"./WitnessFlowLayout-sXdBrCkv.js";import"./device-DbCxnG1h.js";const g=F({surface:"browser"}),b=G,w=B,ct=()=>{const m=A(),{videoRef:k,cameraError:v,stopAndGetUrl:x}=P(),{sendStep:f,error:n}=V(),[i,u]=r.useState(!1),[S,y]=r.useState(0),[h,I]=r.useState(w),[D,W]=r.useState(()=>{const e=sessionStorage.getItem(d);if(e){const s=Math.floor((Date.now()-parseInt(e,10))/1e3);return Math.max(0,b-s)}return sessionStorage.setItem(d,Date.now().toString()),b});r.useEffect(()=>{n.trim()&&T.error(C(new Error(n))??n)},[n]);const a=r.useCallback(async()=>{if(!i){u(!0);try{await f("IMEI_TEST",{source:"device_b_w2w"}),sessionStorage.removeItem(d);const e=await x();m(K.w2wSubmit,{state:{videoUrl:e}})}catch(e){T.error(C(e)??"Could not finish recording. Try again."),u(!1)}}},[i,m,f,x]),E=r.useRef(a);r.useEffect(()=>{E.current=a},[a]),r.useEffect(()=>{const e=setInterval(()=>{W(s=>{const N=Math.max(0,s-1);return N===0&&setTimeout(()=>E.current(),0),N}),I(s=>s<=1?0:s-1)},1e3);return()=>clearInterval(e)},[]);const c=g[S],R=S===g.length-1,j=h>0,M=()=>{y(e=>Math.min(e+1,g.length-1)),I(w)};return t.jsxs(U,{gap:0,minH:"100dvh",pb:8,children:[t.jsx(o,{display:"flex",justifyContent:"center",pt:8,pb:3,children:t.jsx(L,{variant:"light",alt:"Myka",h:"36px"})}),t.jsx(_,{gap:0,px:6,pb:4,align:"center",children:t.jsx(l,{fontSize:"xl",fontWeight:"bold",color:p.text.primary,textAlign:"center",children:c.heading})}),t.jsx(o,{px:4,children:t.jsx(z,{videoRef:k,cameraError:v,secondsLeft:D})}),t.jsx(o,{px:4,pt:4,children:t.jsx(o,{bg:"orange.50",borderRadius:"2xl",px:5,py:4,children:t.jsxs(_,{gap:2,align:"center",children:[t.jsx(l,{fontSize:"10px",fontWeight:"bold",color:"orange.500",letterSpacing:"widest",textTransform:"uppercase",children:c.label}),t.jsx(l,{fontSize:"md",fontWeight:"bold",color:p.text.primary,textAlign:"center",children:c.title}),t.jsx(l,{fontSize:"sm",color:p.text.info,textAlign:"center",children:c.subtitle})]})})}),t.jsx(o,{px:5,pt:6,mt:"auto",children:t.jsx(O,{text:j?`Keep recording⦠(${h}s)`:R?"Done Recording":"Next",fullWidth:!0,loading:i,disabled:i||j,onClick:R?()=>void a():M})})]})};export{ct as default};
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.