PageSourceSearch

https://conversiontab.com/build/assets/qr-code-reader-page-Ceoqe7CV.js

js conversiontab.com collected 2026-09-24 10:08:03 UTC 5,241 bytes, 1 lines download raw bytes

1import{_ as A}from"./app-gOHIPY12.js";import{saveResultFile as F}from"./ctResultAccessAd-Dk9whJZs.js";import{w as S}from"./fileDropzone-CA_uaFcV.js";import{l as k}from"./loadImageForDecode-CYbtsPI8.js";import"./FileSaver.min-BR20wtAe.js";import"./_commonjsHelpers-BosuxZz1.js";import"./ctFullscreenAd-CL-AA_Ul.js";import"./transientNotice-Ds_di7lD.js";function v(x){const d=document.getElementById("ctQrDecodeToastBody"),t=document.getElementById("ctQrDecodeToast");if(!d||!t||typeof bootstrap>"u"){window.alert(x);return}d.textContent=x,bootstrap.Toast.getOrCreateInstance(t).show()}function N(){if(!document.getElementById("ct-qr-code-reader-root"))return;const d=document.getElementById("ctQrDecodeFile"),t=document.getElementById("ctQrDecodeDrop"),u=document.getElementById("ctQrDecodeDropCaption"),r=document.getElementById("ctQrDecodeImg"),s=document.getElementById("ctQrDecodeImgPh"),l=document.getElementById("ctQrDecodeRead"),E=document.getElementById("ctQrDecodeAnother"),c=document.getElementById("ctQrDecodeOut"),i=document.getElementById("ctQrDecodeCopy"),p=document.getElementById("ctQrDecodeDownloadTxt"),o=document.getElementById("ctQrDecodeStatus"),C=document.getElementById("ctQrDecodeProg");if(!d||!t)return;d.setAttribute("accept","image/png,image/jpeg,image/jpg,image/webp,image/gif,image/bmp,image/tiff,image/x-tiff,.png,.jpg,.jpeg,.webp,.gif,.bmp,.tif,.tiff");let w=null,f=null,h=0,m=null;const g=e=>{C&&(C.style.width=`${e}%`,C.setAttribute("aria-valuenow",String(e)))},B=()=>{var e,n;m&&(window.clearTimeout(m),m=null),i&&(i.classList.remove("ct-hash-copy-btn--success"),(e=i.querySelector(".ct-hash-copy-ic--default"))==null||e.classList.remove("d-none"),(n=i.querySelector(".ct-hash-copy-ic--done"))==null||n.classList.add("d-none"))},I=e=>{i&&(i.disabled=!e),p&&(p.disabled=!e),e||B()},D=()=>{w&&(URL.revokeObjectURL(w),w=null)},L=()=>{h+=1,d.value="",f=null,D(),r&&(r.removeAttribute("src"),r.classList.add("d-none")),s&&s.classList.remove("d-none"),c&&(c.value=""),l&&(l.disabled=!0),I(!1),g(0),o&&(o.textContent="Ready to read"),u&&t&&(u.textContent=t.getAttribute("data-ct-placeholder")||"Drop a file here or click to browse.")},T=async e=>{if(!e){L();return}if(e.size>50*1024*1024){v("File size exceeds 50MB limit."),d.value="",u&&t&&(u.textContent=t.getAttribute("data-ct-placeholder")||"Drop a file here or click to browse.");return}const n=++h;f=e,D(),r&&(r.removeAttribute("src"),r.classList.add("d-none")),s&&(s.classList.remove("d-none"),s.textContent="Preparing preview…"),l&&(l.disabled=!0),c&&(c.value=""),I(!1),o&&(o.textContent="Preparing image…");try{const a=await k(e);if(n!==h||f!==e){a.revoke();return}w=a.previewUrl,r&&(r.src=a.previewUrl,r.classList.remove("d-none")),s&&(s.classList.add("d-none"),s.textContent="Preview appears here after you choose an image"),l&&(l.disabled=!1),o&&(o.textContent="Ready to read")}catch(a){if(n!==h)return;f=null,D(),r&&(r.removeAttribute("src"),r.classList.add("d-none")),s&&(s.classList.remove("d-none"),s.textContent="Preview appears here after you choose an image"),l&&(l.disabled=!0),o&&(o.textContent="Ready to read"),v(a instanceof Error?a.message:"Could not load the image."),d.value="",u&&t&&(u.textContent=t.getAttribute("data-ct-placeholder")||"Drop a file here or click to browse.")}};S({input:d,drop:t,dragContainer:t.closest(".ct-qr-decode__workspace")??t.closest(".card-body"),captionEl:u??void 0}),d.addEventListener("change",()=>{var n;const e=(n=d.files)==null?void 0:n[0];if(!e){L();return}T(e)}),E==null||E.addEventListener("click",()=>{L(),t==null||t.focus(),t==null||t.scrollIntoView({behavior:"smooth",block:"center"})}),l==null||l.addEventListener("click",async()=>{var a;if(!f){v("Please choose an image file.");return}o&&(o.textContent="Scanning image for QR code…"),g(0);let e=0;const n=window.setInterval(()=>{e=Math.min(e+10,90),g(e)},200);try{const{BrowserMultiFormatReader:b}=await A(async()=>{const{BrowserMultiFormatReader:Q}=await import("./index-D3Mz4UNV.js");return{BrowserMultiFormatReader:Q}},[]),R=await k(f);try{const Q=new b;let y;try{y=await Q.decodeFromImageElement(R.image)}catch{throw new Error("No QR code found or image could not be decoded.")}const P=((a=y.getText)==null?void 0:a.call(y))??y.text??"";c&&(c.value=P),I(!0),g(100),o&&(o.textContent="QR code read successfully.")}finally{R.revoke()}}catch(b){v(b instanceof Error?b.message:"No QR code found or image could not be decoded."),o&&(o.textContent="Ready to read"),g(0)}finally{window.clearInterval(n)}}),i==null||i.addEventListener("click",async()=>{var n,a;const e=(c==null?void 0:c.value)||"";if(e)try{await navigator.clipboard.writeText(e),o&&(o.textContent="Copied to clipboard."),i.classList.add("ct-hash-copy-btn--success"),(n=i.querySelector(".ct-hash-copy-ic--default"))==null||n.classList.add("d-none"),(a=i.querySelector(".ct-hash-copy-ic--done"))==null||a.classList.remove("d-none"),m&&window.clearTimeout(m),m=window.setTimeout(()=>{B(),m=null},2e3)}catch{v("Clipboard not available. Select the text and copy manually.")}}),p==null||p.addEventListener("click",()=>{const e=(c==null?void 0:c.value)||"";if(!e)return;const n=new Blob([e],{type:"text/plain;charset=utf-8"});F(n,"qr-decoded.txt")})}export{N as initQrCodeReaderPage};

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.