PageSourceSearch

https://www.whatandtik.com/_next/static/chunks/3585.f30c20abcc89147c.js

js whatandtik.com collected 2026-10-02 01:48:53 UTC 3,709 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3585],{3585:(e,t,s)=>{s.r(t),s.d(t,{CameraScanner:()=>d});var a=s(5155),n=s(2115),r=s(5664),l=s(5229),c=s(2056),i=s(5299),o=s(1362),u=s(1834);let m="moriya-camera-scanner";function d(e){let{open:t,onClose:d,onScan:h}=e,x=(0,n.useRef)(null),[f,g]=(0,n.useState)(null),[p,w]=(0,n.useState)(!1),[b,j]=(0,n.useState)(!1),[N,v]=(0,n.useState)(null),y=(0,n.useRef)("");return(0,n.useEffect)(()=>{if(!t)return;let e=!1;return g(null),w(!0),v(null),y.current="",(async()=>{try{let{Html5Qrcode:t,Html5QrcodeSupportedFormats:a}=await Promise.all([s.e(5604),s.e(1514)]).then(s.bind(s,1514));if(await new Promise(e=>setTimeout(e,50)),e)return;let n=new t(m,{verbose:!1,formatsToSupport:[a.EAN_13,a.EAN_8,a.UPC_A,a.UPC_E,a.CODE_128,a.CODE_39,a.CODE_93,a.ITF,a.CODABAR,a.QR_CODE]});if(x.current=n,await n.start({facingMode:"environment"},{fps:10,qrbox:(e,t)=>{let s=Math.min(e,t),a=Math.floor(.7*s);return{width:a,height:Math.floor(.6*a)}},aspectRatio:1.5},async e=>{if(e!==y.current){y.current=e,j(!0),v(null);try{let t=await h(e);v(t),t.ok?setTimeout(()=>{y.current="",v(null)},1500):setTimeout(()=>{y.current=""},2e3)}catch(e){v({ok:!1,message:e instanceof Error?e.message:"Lookup failed"}),setTimeout(()=>{y.current=""},2e3)}finally{j(!1)}}},()=>{}),e){try{await n.stop()}catch(e){}return}w(!1)}catch(t){if(e)return;w(!1),t instanceof Error?t.message.includes("Permission")||t.message.includes("NotAllowed")?g("Camera permission denied. Allow camera access in your browser settings."):t.message.includes("NotFound")?g("No camera found on this device."):g(t.message):g("Could not start camera.")}})(),()=>{e=!0;let t=x.current;if(x.current=null,t)try{t.stop().catch(()=>null).then(()=>{try{t.clear()}catch(e){}}).catch(()=>null)}catch(e){}}},[t,h]),(0,a.jsx)(u.lG,{open:t,onOpenChange:e=>{e||d()},children:(0,a.jsxs)(u.Cf,{className:"max-w-md p-0 overflow-hidden gap-0",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between bg-foreground text-background px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(r.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"font-semibold text-sm",children:"Camera Scanner"})]}),(0,a.jsx)("button",{onClick:d,className:"p-1 rounded-md hover:bg-white/10","aria-label":"Close",children:(0,a.jsx)(l.A,{className:"h-4 w-4"})})]}),(0,a.jsxs)("div",{className:"relative bg-black aspect-[3/4]",children:[(0,a.jsx)("div",{id:m,className:"absolute inset-0"}),p&&!f&&(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center text-white text-sm",children:"Starting camera…"}),f&&(0,a.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-6 text-center bg-black/80",children:[(0,a.jsx)(c.A,{className:"h-8 w-8 text-yellow-400 mb-2"}),(0,a.jsx)("p",{className:"text-white text-sm",children:f})]}),(b||N)&&(0,a.jsx)("div",{className:"absolute bottom-3 left-3 right-3 rounded-lg px-3 py-2.5 text-sm font-medium text-center",style:{background:b?"rgba(15,23,42,0.85)":(null==N?void 0:N.ok)?"#16a34a":"#dc2626",color:"white"},children:(0,a.jsx)("div",{className:"flex items-center justify-center gap-2",children:b?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.A,{className:"h-4 w-4 animate-spin"})," Looking up…"]}):(null==N?void 0:N.ok)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{className:"h-4 w-4"})," ",N.message]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.A,{className:"h-4 w-4"})," ",null==N?void 0:N.message]})})})]}),(0,a.jsx)("div",{className:"bg-white px-4 py-3 text-xs text-muted-foreground",children:"Point the camera at a barcode. Keep scanning multiple items — tap X to close."})]})})}}}]);

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.