(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,252184,e=>{"use strict";let r=(0,e.i(54537).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["AlertCircle",()=>r],252184)},747566,e=>{"use strict";var r=e.i(278191),t=e.i(136357),a=e.i(599518),s=e.i(252184);function c({onScan:e,onError:c}){let l=(0,t.useRef)(null),i=(0,t.useRef)(null),[n,d]=(0,t.useState)(null),[o,u]=(0,t.useState)(!1),h=(0,t.useRef)(null);(0,t.useEffect)(()=>(m(),()=>{b()}),[]);let m=async()=>{try{let e=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}});l.current&&(l.current.srcObject=e,l.current.play(),u(!0),x())}catch(r){let e="Unable to access camera. Please check permissions.";d(e),c?.(e)}},b=()=>{l.current?.srcObject&&l.current.srcObject.getTracks().forEach(e=>e.stop()),h.current&&clearInterval(h.current)},x=()=>{h.current=setInterval(()=>{f()},500)},f=()=>{if(!l.current||!i.current)return;let r=l.current,t=i.current,a=t.getContext("2d");if(!a||r.readyState!==r.HAVE_ENOUGH_DATA)return;t.width=r.videoWidth,t.height=r.videoHeight,a.drawImage(r,0,0,t.width,t.height);let s=a.getImageData(0,0,t.width,t.height);try{let r=window.jsQR?.(s.data,s.width,s.height);r?.data&&(h.current&&clearInterval(h.current),e(r.data))}catch(e){console.error("QR scanning error:",e)}};return(0,r.jsx)("div",{className:"relative",children:n?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center h-96 bg-red-50 border-2 border-red-200",children:[(0,r.jsx)(s.AlertCircle,{className:"w-12 h-12 text-red-600 mb-4"}),(0,r.jsx)("p",{className:"text-red-600 text-center px-4",children:n})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"relative aspect-square max-h-96 bg-black overflow-hidden",children:[(0,r.jsx)("video",{ref:l,className:"w-full h-full object-cover",playsInline:!0,muted:!0}),(0,r.jsxs)("div",{className:"absolute inset-0 border-4 border-primary/50",children:[(0,r.jsx)("div",{className:"absolute top-0 left-0 w-16 h-16 border-t-4 border-l-4 border-primary"}),(0,r.jsx)("div",{className:"absolute top-0 right-0 w-16 h-16 border-t-4 border-r-4 border-primary"}),(0,r.jsx)("div",{className:"absolute bottom-0 left-0 w-16 h-16 border-b-4 border-l-4 border-primary"}),(0,r.jsx)("div",{className:"absolute bottom-0 right-0 w-16 h-16 border-b-4 border-r-4 border-primary"})]}),(0,r.jsx)("div",{className:"absolute bottom-4 left-0 right-0 text-center",children:(0,r.jsx)("div",{className:"inline-block bg-black/70 px-4 py-2",children:(0,r.jsxs)("p",{className:"text-white text-sm flex items-center",children:[(0,r.jsx)(a.Camera,{className:"w-4 h-4 mr-2"}),"Position QR code in the frame"]})})})]}),(0,r.jsx)("canvas",{ref:i,className:"hidden"})]})})}e.s(["default",()=>c])},64465,e=>{e.n(e.i(747566))}]);