PageSourceSearch

https://encrypt-qr-codes.netlify.app/_next/static/chunks/137-c7d2f6ca243bd78c.js

js encrypt-qr-codes.netlify.app collected 2026-10-03 10:42:15 UTC 33,671 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[137],{159:function(e,t,n){"use strict";function r(e){return"data:image/svg+xml;base64,".concat(btoa(e))}async function a(e){let[t]=await o(e);return t.toDataURL("image/png")}async function s(e,t){if(!e.startsWith("data:image/png;"))throw Error("Data is not a PNG data url: ".concat(e));let n=document.createElement("a");n.href=e,n.download="".concat(t,".png"),n.style.display="block",n.click()}async function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=await new Promise((t,n)=>{let r=new Image;r.onerror=n,r.onload=()=>t(r),r.src=e}),r=document.createElement("canvas");r.width=t,r.height=t;let a=r.getContext("2d");return a.fillStyle="#fff",a.fillRect(0,0,t,t),a.drawImage(n,0,0,t,t),[r,a]}n.d(t,{LG:function(){return s},Mv:function(){return a},r6:function(){return r}})},3548:function(e,t,n){"use strict";n.d(t,{_:function(){return l},l:function(){return c}});var r=n(741),a=n(7133).lW;let s="SHA-256",o="AES-GCM",i={v0:1e5,v1:6e5};async function c(e,t,n,a){let c=e.getRandomValues(new Uint8Array(16)),l=await d(e,a,c,i.v1,s),h=e.getRandomValues(new Uint8Array(12)),m=await e.subtle.encrypt({name:o,iv:h},l,new TextEncoder().encode(t));return{iv:u(h),salt:u(c),cipherText:u(m),vers:"v1",hint:n,date:(0,r._3)()}}async function l(e,t,n){var r;let a;let c=await d(e,n,h(t.salt),null!==(r=i[t.vers])&&void 0!==r?r:i.v0,s);try{a=await e.subtle.decrypt({name:o,iv:h(t.iv)},c,h(t.cipherText))}catch(e){throw console.info(e),Error("Could not decrypt the QR code. Is the password correct?")}return new TextDecoder().decode(a)}async function d(e,t,n,r,a){if("number"!=typeof r&&r<1e3)throw Error("Iterations not provided");let s=await e.subtle.importKey("raw",new TextEncoder().encode(t),{name:"PBKDF2"},!1,["deriveKey"]);return await e.subtle.deriveKey({name:"PBKDF2",salt:n,iterations:r,hash:a},s,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}function u(e){return a.from(e).toString("hex")}function h(e){return new Uint8Array(a.from(e,"hex"))}},6048:function(e,t){"use strict";t.Z={github:{home:"https://github.com/kangabru/encrypt-qr-codes",deploy:"https://github.com/kangabru/encrypt-qr-codes#deploy",local:"https://github.com/kangabru/encrypt-qr-codes#develop"},examples:{typescript:"https://github.com/kangabru/encrypt-qr-codes/blob/master/src/common/crypto.ts",python:"https://github.com/kangabru/encrypt-qr-codes/blob/master/python/decrypt.py"},crypto:{aesGcm:"https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#supported_algorithms",pbkdf2:"https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/deriveKey#pbkdf2",randomValues:"https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues"},authy:{home:"https://authy.com/",backup:"https://authy.com/blog/how-the-authy-two-factor-backups-work/"},_1Password:{twoFactor:"https://1password.com/features/two-factor-authentication/",password:"https://support.1password.com/strong-account-password/",passwordCost:"https://support.1password.com/pbkdf2/",generator:"https://1password.com/password-generator/"},lastPass:{incidents:"https://en.wikipedia.org/wiki/LastPass#Security_incidents",hack:"https://blog.lastpass.com/2023/03/security-incident-update-recommended-actions/",hackExtra:"https://support.lastpass.com/s/document-item?language=en_US&bundleId=lastpass&topicId=LastPass/incident-2-details.html&_LANG=enus"}}},9609:function(e,t,n){"use strict";n.d(t,{te:function(){return c},pg:function(){return i}});var r,a,s=n(9834),o=n(7636);async function i(e){return s.Z.scanImage(e,{returnDetailedScanResult:!0}).then(e=>e.data)}function c(e,t){return function(e,t){let n=Math.ceil(.1*e.size),r=e.size+2*n;return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 '.concat(r," ").concat(r,'" fill="black">\n    <defs>\n      <rect id="r" height="1.05" width="1.05" />\n      <svg id="lock" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">\n        <path clip-rule="evenodd" fill-rule="evenodd" d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z" />\n      </svg>\n    </defs>\n    ').concat(function(e,t,n,r){let{size:a,blocks:s}=e,o=[],i=t/2-n,c=Math.ceil(.12*a);c%2==0&&c++;let l=(.75*c)**2;for(let[e,t]of s){let a=(e+.5-i)**2+(t+.5-i)**2;(!r||a>l)&&o.push('<use href="#r" x="'.concat(n+e,'" y="').concat(n+t,'" />'))}if(r){let e=n+i-c/2;o.push('<use href="#lock" x="'.concat(e,'" y="').concat(e,'" width="').concat(c,'" height="').concat(c,'" />'))}return o.join("")}(e,r,n,!!t.showLockSymbol),"\n    ").concat(function(e,t,n){let r=[],[a,s]=[n,t-n],[o,i]=[.85*n,t-.85*n],c=(.6*n).toFixed(1),d=(.35*n).toFixed(1);return e.title&&r.push('<text x="'.concat(a,'" y="').concat(o,'" font-size="').concat(c,'" text-anchor="start" font-family="sans-serif">\n        ').concat(l(e.title),"\n      </text>")),r.push('<g font-size="'.concat(d,'" font-family="sans-serif" dominant-baseline="hanging">')),e.date&&r.push('<text x="'.concat(s,'" y="').concat(i,'" text-anchor="end">\n        ').concat(l(e.date),"\n      </text>")),e.showWebsiteUrl&&r.push('<text x="'.concat(a,'" y="').concat(i,'" text-anchor="start">/kangabru/encrypt-qr-codes</text>')),r.push("</g>"),r.join("")}(t,r,n),"\n  </svg>")}(function(e,t){let n;let r={0:o.QRCodeDecoderErrorCorrectionLevel.L,1:o.QRCodeDecoderErrorCorrectionLevel.M,2:o.QRCodeDecoderErrorCorrectionLevel.Q,3:o.QRCodeDecoderErrorCorrectionLevel.H}[null!=t?t:1];try{n=o.QRCodeEncoder.encode(e,r)}catch(e){throw console.info(e),Error("Failed to read QR code")}let a=n.getMatrix();if(null===a)throw new o.IllegalStateException;let s=a.getWidth(),i=a.getHeight(),c=[];for(let e=0;e<i;e++)for(let t=0;t<s;t++)1===a.get(t,e)&&c.push([t,e]);return{size:Math.max(s,i),blocks:c}}(e),t)}function l(e){return e.replace(/[<>&'"]/g,function(e){switch(e){case"<":return"&lt;";case">":return"&gt;";
1case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;";default:return e}})}(r=a||(a={}))[r.Low=0]="Low",r[r.Medium=1]="Medium",r[r.High=2]="High",r[r.Higher=3]="Higher"},9709:function(e,t,n){"use strict";n.d(t,{ZP:function(){return s},p5:function(){return o}});var r=n(5484),a=n(2265);function s(){let[e,t]=(0,a.useState)([]),n=(0,a.useCallback)(()=>(0,r.qh)().then(t),[]);return(0,a.useEffect)(()=>void n(),[n]),[e,(0,a.useCallback)(e=>o(e).then(n),[n]),(0,a.useCallback)(e=>(0,r.IV)(e).then(n),[n]),(0,a.useCallback)(()=>(0,r.ZH)().then(n),[n])]}function o(e){let t=+new Date+"-"+Math.random().toString(16).substr(2,6);return(0,r.t8)(t,e)}},741:function(e,t,n){"use strict";function r(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(e=>!!e).join(" ")}function a(){return new Date().toISOString().split("T")[0]}function s(e){var t;return null!==(t=e.message)&&void 0!==t?t:e.toString()}n.d(t,{_3:function(){return a},e$:function(){return s},v_:function(){return r}})},2959:function(e,t,n){"use strict";n.d(t,{Z:function(){return m}});var r=n(7437),a=n(159),s=n(9709),o=n(3759),i=n(1441),c=n(8965),l=n(1794),d=n(9214),u=n(2265),h=n(5987);function m(e){let{title:t,isLoading:n,extraInfo:m,qrCodeInfo:p,getFileName:f}=e,[g,x]=(0,u.useState)(!1);return(0,r.jsxs)(o.s,{title:t,children:[p?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{dangerouslySetInnerHTML:{__html:p.svgHtml},className:"aspect-square w-full max-w-lg rounded-md border border-gray-300 shadow-sm"}),m]}):(0,r.jsx)("div",{className:"grid h-full w-full place-items-center",children:n?(0,r.jsx)(h.H,{className:"h-8 w-8 text-indigo-600"}):(0,r.jsx)(i.Z,{className:"max-h-40 text-gray-200"})}),(0,r.jsx)("div",{className:"flex-1"}),(0,r.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-4 text-sm sm:text-base",children:[(0,r.jsxs)("button",{className:"action-button",disabled:!p,onClick:async()=>{let e=(0,a.r6)(p.svgHtml),t=await (0,a.Mv)(e);(0,a.LG)(t,f(p.dataEncrypted)).catch(e=>console.error("Failed to download image",e))},children:[(0,r.jsx)(c.Z,{className:"mr-1 h-5 w-5"}),(0,r.jsx)("span",{children:"Download PNG"})]}),(0,r.jsx)("button",{className:"action-button",disabled:!p,onClick:()=>{let{svgHtml:e,dataEncrypted:t}=p,{hint:n,date:r}=t;(0,s.p5)({src:(0,a.r6)(e),hint:n,date:r,fileName:f(t)}),x(!0),setTimeout(()=>x(!1),1e3)},children:g?(0,r.jsx)(l.Z,{className:"mr-1 h-5 w-5"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.Z,{className:"mr-1 h-5 w-5"}),(0,r.jsx)("span",{children:"Save for print"})]})})]})]})}},6287:function(e,t,n){"use strict";n.d(t,{DW:function(){return x},j1:function(){return g}});var r=n(7437),a=n(6048),s=n(741);function o(e){return(0,r.jsx)("ul",{className:(0,s.v_)("list-disc pl-4",e.className),children:e.points.map((e,t)=>(0,r.jsx)("li",{children:e},t))})}var i=n(1396),c=n.n(i);function l(e){return(0,r.jsx)(c(),{...e,className:"text-indigo-900 underline"})}var d=n(1441),u=n(136),h=n(5781);let m=[{question:"Who is this for?",answer:"Security concious people who want to backup their 2FA codes. You might already use a service like Authy but want extra redundancy and flexibility. The encrypted QR codes are just images that you can safely save in Whatsapp, a photo gallery, and even print them out."},{question:"What is a QR code?",answer:(0,r.jsxs)("p",{className:"flex",children:[(0,r.jsx)("span",{children:"A QR (quick-response) code is a barcode that's easy to scan and contains useful data. They are blocky, black/white, square images which you usually scan when adding two-factor auth to an account."}),(0,r.jsx)(d.Z,{className:"ml-2 h-28 w-28 flex-shrink-0 text-gray-700"})]})},{question:"What is two-factor auth (2FA)?",answer:(0,r.jsx)(o,{points:["Two-factor authentication (2FA) helps protect your online accounts from being accessed by someone who has access to your password.","You usually set up 2FA by scanning a QR code to link the service with an authenticator app on your phone. The app generates a random code every few seconds which you fill into the website when asked.","By knowing your password and filling in the 2FA code, you verify two factors: something you know and something you have. This makes it much harder to hack an account even if someone knows your password."]})},{question:"Why should I backup 2FA codes?",answer:"If you lose or break your 2FA device you could lose access to some accounts forever - even if you have the password. We often set up 2FA with our most important accounts so losing access could be a huge loss of data e.g. photos, emails, and documents. You should absolutely backup 2FA codes and in multiple places."},{question:"What's wrong with Authy?",answer:(0,r.jsx)(o,{points:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l,{href:a.Z.authy.home,children:"Authy"})," is a great authenticator app that can double as a backup by saving your 2FA codes for you. However, this is opt-in and you must now rely on a private service. If you lose access to Authy, you lose all of your 2FA codes."]}),(0,r.jsxs)(r.Fragment,{children:["One problem is that Authy is linked to your mobile phone number and"," ",(0,r.jsx)(l,{href:a.Z.authy.backup,children:"you must receive an sms"})," to gain access to your account. If you lose your phone & SIM then it's up to your phone provider to give you that number again, and that could take weeks."]}),"So definitely use a service like Authy, but it's a good idea to have extra backups. Encrypted QR codes are just images that you can safely save in Whatsapp, a photo gallery, and even print them out."]})},{question:"What's wrong with 1Password?",answer:(0,r.jsx)(o,{points:["1Password is a great password manager that can double as a backup by saving your 2FA codes for you. This is convenient but in the (unlikely) event that your vault is compromised then your 2FA codes w
1on't protect those accounts.",(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l,{href:a.Z._1Password.twoFactor,children:"They claim"})," that most hacks made are not by compromising your vault, but by guessing your password or finding it in a data breach. This is true but a vault is a high value target and even a breach on LastPass was"," ",(0,r.jsx)(l,{href:a.Z.lastPass.incidents,children:"made"})," by"," ",(0,r.jsx)(l,{href:a.Z.lastPass.hack,children:"hacking"})," the"," ",(0,r.jsx)(l,{href:a.Z.lastPass.hackExtra,children:"corporate vault"}),"."]}),"So if you want to separate your 2FA codes from your password manager then encrypting and backing up your 2FA codes is a good solution."]})},{question:"Can I rely on this website?",answer:(0,r.jsxs)(r.Fragment,{children:["Yes but the great thing is, you don't have to! This website is fully open source so you can control how you use it."," ",(0,r.jsx)(l,{href:a.Z.github.home,children:"Fork the code"})," and reuse it however you like, ",(0,r.jsx)(l,{href:a.Z.github.deploy,children:"self-host"})," it, or run the"," ",(0,r.jsx)(l,{href:a.Z.github.local,children:"site locally"})," for fully offline use."," ","Decryption is language agnostic so you can always recover an encrypted QR code in future. Here are examples in both"," ",(0,r.jsx)(l,{href:a.Z.examples.typescript,children:"Typescript"})," and"," ",(0,r.jsx)(l,{href:a.Z.examples.python,children:"Python"}),"."]})}],p=[{question:(0,r.jsx)(y,{icon:u.Z,children:"How are codes encrypted?"}),answer:(0,r.jsx)(o,{points:["Note: Encryption/decryption is done on your device and no data is collected about you.","A QR Code is scanned to decode its plaintext content.",(0,r.jsxs)(r.Fragment,{children:["The plaintext is encrypted into ciphertext as follows:",(0,r.jsx)(o,{className:"ml-2",points:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l,{href:a.Z.crypto.pbkdf2,children:"PBKDF2"})," derives a 256 bit key from the password and random salt."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l,{href:a.Z.crypto.aesGcm,children:"AES-GCM"})," with random init values (IV) encrypts the data."]}),(0,r.jsxs)(r.Fragment,{children:["Cryptographically strong random data is provided by"," ",(0,r.jsx)(l,{href:a.Z.crypto.randomValues,children:"Crypto"}),"."]})]},0)]}),(0,r.jsxs)("div",{className:"sm:flex",children:[(0,r.jsxs)("p",{className:"mr-2 flex-1",children:["The ciphertext, salt, and IV are encoded into a text format and saved as a JSON object. The data is encoded into a new encrypted QR code."," ",(0,r.jsx)(l,{href:a.Z.examples.typescript,children:"View the process here"}),"."]}),(0,r.jsx)("p",{className:"text-mono whitespace-pre-wrap rounded-md border border-gray-200 bg-white px-3 py-2 text-sm shadow",children:'{\n  "iv":"5a7e0a...",\n  "salt":"74c98...",\n  "cipherText":"0e50b...",\n  "hint":"Google Account",\n  "date":"2024-01-01"\n}'},0)]},0)]})},{question:(0,r.jsx)(y,{icon:u.Z,children:"How do I encrypt a 2FA code?"}),answer:(0,r.jsx)(o,{points:["Log into an account and follow their instructions to set up 2FA. Stop when they present you with a QR code.","Before you scan the QR code with your auth app, first encrypt a copy of the QR code with this website.","Either screenshot, copy/paste, or scan the QR code with a camera and encrypt it. The following Q&A has more details.","Download the encrypted QR code and save or print the image in multiple places as a backup.","Continue setting up 2FA with the original QR code as normal with your authenticator app."]})},{question:(0,r.jsx)(y,{icon:u.Z,children:"How do I encrypt a QR code?"}),answer:(0,r.jsx)(o,{points:[(0,r.jsxs)(r.Fragment,{children:["Scan a QR code by selecting a file, copy & paste, drag & drop, or scanning it via camera. E.g:",(0,r.jsx)(o,{className:"ml-2",points:["Scan a QR code on your phone via your laptop webcam.","Scan a printed QR code with your mobile camera.","Screenshot the QR code, save, then select the image file.","Right click and copy the QR code, then 'Ctrl+V' to paste here."]},0)]}),"Type an unencrypted hint to remember what the QR code is for.","Type a secure password to encrypt the QR code with. You MUST remember the password to unlock it again - this is unrecoverable if you forget it. Ideally use a unique password for each QR code.","Download the encrypted QR code and save or print the image in multiple places as a backup."]})},{question:(0,r.jsx)(y,{icon:u.Z,children:"How do I choose and store a password?"}),answer:(0,r.jsx)(o,{points:[(0,r.jsxs)(r.Fragment,{children:["1Password has good tips ",(0,r.jsx)(l,{href:a.Z._1Password.password,children:"here"})," ","and ",(0,r.jsx)(l,{href:a.Z._1Password.passwordCost,children:"here"})," for choosing a password:",(0,r.jsx)(o,{className:"ml-2",points:["Make it long (16+ characters). Each character makes it exponentially harder to crack.",(0,r.jsxs)(r.Fragment,{children:["Make it random. We're not as random as we think so you should use a password"," ",(0,r.jsx)(l,{href:a.Z._1Password.generator,children:"generator"})," (turn the 'memorable' option on)."]}),"Make it memorable: 5 random words is much easier to remember but still harder to crack than 16+ random characters."]},0)]}),"The solution? Generate 5 random words like this `passion-ken-omit-verso-tortoise` - it's long, random, and memorable. Write it down and practice it regularly until you commit it to memory.","If you plan to keep your 2FA codes separate from your password manager then create a new password (not your master password) and commit it to memory - don't store it in your vault.","Ideally use a unique password for each QR code. Using the same one for all c
1odes should be fine if they're accessed rarely and stored safely in the same place - akin to a using password manager."]})}],f=[{question:(0,r.jsx)(y,{icon:h.Z,children:"How do I decrypt a QR code?"}),answer:(0,r.jsx)(o,{points:["Note: Encryption/decryption is done on your device and no data is collected about you.","Select/paste/drop/scan an encrypted QR code into the decrypt page. You can use your phone camera to scan a printed code for example.","Type in the original password to unlock the code. There is no way to recover a password if you have lost or forgotten it.","You can scan the decrypted code as a normal 2FA QR code.",(0,r.jsxs)(r.Fragment,{children:["Advanced users can decrypt codes using"," ",(0,r.jsx)(l,{href:a.Z.examples.typescript,children:"Typescript"})," or"," ",(0,r.jsx)(l,{href:a.Z.examples.python,children:"Python"}),"."]})]})}],g=[...p],x=[...f];function y(e){return(0,r.jsxs)("span",{className:"flex items-center",children:[(0,r.jsx)(e.icon,{className:"-mt-0.5 mr-2 h-5 w-5"}),e.children]})}[...m,...p,...f]},3116:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(7437),a=n(3125),s=n(3173),o=n(2265);function i(e){let{faqs:t}=e;return(0,r.jsxs)("section",{className:"mx-auto mt-8 max-w-3xl px-4",children:[(0,r.jsx)("h2",{className:"text-xl font-bold leading-10 tracking-tight text-gray-900",children:"FAQs"}),(0,r.jsx)("dl",{className:"mt-5 divide-y divide-gray-900/10",children:t.map((e,t)=>(0,r.jsx)(c,{...e},t))})]})}function c(e){let[t,n]=(0,o.useState)(!1);return(0,r.jsxs)("div",{children:[(0,r.jsx)("dt",{children:(0,r.jsxs)("button",{onClick:()=>n(e=>!e),className:"flex w-full items-start justify-between rounded-md px-2 py-4 text-left text-gray-900 hover:underline focus:underline focus:outline-none",children:[(0,r.jsx)("span",{className:"text-base font-semibold leading-7",children:e.question}),(0,r.jsx)("span",{className:"ml-6 flex h-7 items-center",children:t?(0,r.jsx)(a.Z,{className:"h-6 w-6","aria-hidden":"true"}):(0,r.jsx)(s.Z,{className:"h-6 w-6","aria-hidden":"true"})})]})}),t&&(0,r.jsx)("dd",{className:"-mt-2 mb-4 pr-12 text-base leading-7 text-gray-600",children:e.answer})]})}},22:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(7437),a=n(6048),s=n(741),o=n(1441),i=n(136),c=n(5781),l=n(9214),d=n(1396),u=n.n(d),h=n(4033),m=n(5987);let p=[{name:"Encrypt",href:"/encrypt",icon:i.Z},{name:"Decrypt",href:"/decrypt",icon:c.Z},{name:"Print",href:"/print",icon:l.Z}];function f(e){let t=(0,h.usePathname)();return(0,r.jsxs)("div",{className:"min-h-screen bg-gray-100 pb-32 print:pb-0",children:[(0,r.jsxs)("header",{className:"bg-indigo-600 pb-32 text-white print:hidden md:pb-48",children:[(0,r.jsx)("div",{className:"lg:border-b lg:border-indigo-400 lg:border-opacity-25",children:(0,r.jsxs)("div",{className:"relative mx-auto flex h-16 max-w-screen-lg items-center justify-between px-4 lg:px-8",children:[(0,r.jsx)(u(),{href:"/",title:"Home",className:"focus-ring flex-shrink-0 rounded-md focus:ring-indigo-200/50",children:(0,r.jsx)(o.Z,{className:"h-8 w-8"})}),(0,r.jsx)("div",{className:"flex flex-1 flex-wrap items-center justify-end space-x-4 sm:ml-10 sm:justify-start",children:p.map(e=>(0,r.jsxs)(u(),{href:e.href,className:(0,s.v_)("focus-ring flex items-center rounded-md px-2 py-1 text-xs font-medium focus:ring-indigo-200/50 sm:px-3 sm:py-2 sm:text-sm",e.href===t?"bg-indigo-700 text-white":"text-white hover:bg-indigo-500 hover:bg-opacity-75"),children:[(0,r.jsx)(e.icon,{className:"-ml-1 mr-1 h-5 w-5 text-white","aria-hidden":"true"}),(0,r.jsx)("span",{children:e.name})]},e.name))}),(0,r.jsxs)(u(),{href:a.Z.github.home,className:"focus-ring hidden items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-indigo-500 hover:bg-opacity-75 focus:ring-indigo-200/50 sm:flex",children:[(0,r.jsx)("span",{children:"Star"}),(0,r.jsx)(m.f,{className:"ml-2 h-5 w-5","aria-hidden":"true"})]})]})}),(0,r.jsx)("h1",{className:"hidden",children:e.title})]}),(0,r.jsx)("main",{className:(0,s.v_)("mx-auto -mt-32 w-full max-w-screen-lg print:mt-0",e.className),children:e.children})]})}},3759:function(e,t,n){"use strict";n.d(t,{E:function(){return s},s:function(){return o}});var r=n(7437),a=n(741);function s(e){return(0,r.jsx)("section",{className:"mx-4 flex grid-cols-2 flex-col items-center gap-4 md:grid md:items-stretch",children:e.children})}function o(e){return(0,r.jsxs)("div",{className:(0,a.v_)("flex w-full max-w-lg flex-col rounded-lg border-t-4 bg-white p-4 shadow",e.hasError?"border-red-200":"border-indigo-200"),children:[(0,r.jsxs)("div",{className:"mb-4 flex items-center",children:[e.icon,(0,r.jsx)("h2",{className:"text-lg",children:e.title})]}),e.children]})}},6136:function(e,t,n){"use strict";n.d(t,{Z:function(){return R}});var r=n(7437),a=n(741),s=n(621),o=n(4670),i=n(7550),c=n(7665),l=n(2265),d=n(5804),u=n(9834),h=n(2537);let m=(0,l.createContext)({});function p(e){let[t,n]=(0,l.useState)("image"),[a,s]=(0,l.useState)(""),[o,i]=(0,l.useState)(""),c=(0,h.u6)().setFieldValue,d=(0,l.useCallback)((e,t)=>{var r,a;i(""),s(null!==(r=e.fileName)&&void 0!==r?r:""),c("image",e.dataUrl),c("qrCodeData",null!==(a=e.qrCodeData)&&void 0!==a?a:""),t&&n(t)},[c]),u=(0,l.useCallback)(()=>{i(""),s(""),c("image",""),c("qrCodeData","")},[c]);return(0,l.useEffect)(()=>
1{if(i(""),"image"===t)return u},[t,u]),(0,r.jsx)(m.Provider,{value:{mode:t,setMode:n,setImageDetails:d,resetImageDetails:u,fileName:a,error:o,setError:i},children:e.children})}function f(){let{setImageDetails:e,error:t,setError:n}=(0,l.useContext)(m),s=(0,l.useRef)(null),o=(0,l.useRef)(null),[i,c]=(0,l.useState)(!1),[h,p]=(0,l.useState)([]);return(0,l.useEffect)(()=>{if(n(""),c(!1),!s.current)return;let t=new u.Z(s.current,t=>{let{data:n}=t,r=s.current;if(r){console.info("Found QR code data:",n);let[t,a]=function(e){let t=document.createElement("canvas"),n=t.getContext("2d"),r=Math.min(e.videoWidth,e.videoHeight);t.width=r,t.height=r;let a=Math.floor((e.videoWidth-r)*.5),s=Math.floor((e.videoHeight-r)*.5);return n.scale(-1,1),n.translate(-t.width,0),n.drawImage(e,a,s,r,r,0,0,r,r),[t.toDataURL(),r]}(r);e({dataUrl:t,width:a,height:a,qrCodeData:n,fileName:"Scanned from camera"},"image")}},{highlightScanRegion:!0,returnDetailedScanResult:!0});return o.current=t,t.start().then(()=>c(!0)).catch(e=>{c(!1),n((0,a.e$)(e)||"Couldn't load camera")}),()=>{c(!1),t.destroy()}},[e,n]),(0,l.useEffect)(()=>{p([]),u.Z.listCameras(!0).then(e=>p(e))},[]),(0,r.jsxs)("div",{className:(0,a.v_)("relative rounded-lg border-2 border-dashed p-1.5",t?"border-red-400":"border-indigo-400"),children:[(0,r.jsxs)("div",{className:"flex flex-col items-center",children:[(0,r.jsx)("video",{ref:s,className:"h-36 rounded-md"}),i&&h.length>1&&(0,r.jsx)("select",{className:"mt-2 rounded text-xs",onInput:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.setCamera(e.currentTarget.value)},children:h.map(e=>(0,r.jsx)("option",{value:e.id,onClick:()=>{var t;return null===(t=o.current)||void 0===t?void 0:t.setCamera(e.id)},children:e.label},e.id))})]}),!i&&(0,r.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-2",children:[(0,r.jsx)(d.Z,{className:"h-12 w-12 text-gray-300"}),(0,r.jsx)("span",{className:(0,a.v_)("mt-3 flex text-sm leading-6",t?"text-red-600":"text-gray-600"),children:null!=t?t:"Starting camera..."})]})]})}var g=n(9609);function x(e){let t=(0,h.U$)("qrCodeData")[1].value,[n,a]=function(e){let[t,n]=(0,l.useState)(e);return[t,(0,l.useCallback)(()=>n(e=>!e),[]),n]}(!1);return(0,r.jsxs)("div",{className:"relative",children:[n?(0,r.jsx)(y,{data:t,toggle:a}):e.children,t&&(0,r.jsx)(w,{isShowingImageData:n,toggle:a})]})}function y(e){return(0,r.jsx)("div",{className:"text-mono relative min-h-[10rem] break-words rounded-md border border-gray-300 bg-gray-50 px-3 py-2 text-sm shadow-sm",children:e.data})}function w(e){let t=e.isShowingImageData?s.Z:i.Z;return(0,r.jsx)("button",{type:"button",className:"absolute right-2 top-2 z-10 rounded bg-white p-1 shadow hover:bg-gray-50",onClick:e.toggle,children:(0,r.jsx)(t,{className:"h-5 w-5"})})}function v(e){let{imageSrc:t,description:n}=e,{setImageDetails:s,resetImageDetails:o,setError:i}=(0,l.useContext)(m);return(0,l.useEffect)(()=>(s({dataUrl:t,width:500,height:500,fileName:"Demo QR Code",qrCodeData:""}),(0,g.pg)(t).then(e=>{s({dataUrl:t,qrCodeData:e,width:500,height:500,fileName:"Demo QR Code"})}).catch(e=>{i((0,a.e$)(e))}),o),[t,s,o,i]),(0,r.jsx)(x,{children:(0,r.jsxs)("div",{className:"flex h-40 w-full flex-col items-center justify-center rounded-lg border-2 border-dashed p-2 text-center",children:[(0,r.jsx)("div",{className:"w-full flex-1 overflow-hidden",children:(0,r.jsx)("img",{src:t,alt:"",className:"h-full w-full object-contain"})}),(0,r.jsx)("span",{children:n})]})})}function b(e){return new Promise((t,n)=>{if(null==e?void 0:e.type.match("image.*")){let r=new FileReader;
1r.readAsDataURL(e),r.onerror=()=>n("Error reading file"),r.onload=r=>{var a,s,o,i;return(o=null===(a=r.target)||void 0===a?void 0:a.result,i=null!==(s=e.name)&&void 0!==s?s:"",new Promise((e,t)=>{if(!o)return t();let n=new Image;n.onerror=t,n.onload=r=>{let a=n.naturalWidth,s=n.naturalHeight;(0,g.pg)(o).then(t=>{e({dataUrl:o,fileName:i,width:a,height:s,qrCodeData:t})}).catch(t)},n.src=o})).then(t).catch(n)}}else e?n("File is not an image"):n("No image found")})}var j=n(8930);function N(){var e,t;let{setImageDetails:n,setError:s,...o}=(0,l.useContext)(m),[i,c]=(0,h.U$)("image"),{value:d,...u}=i;e=e=>n(e,"image"),t=e=>s(e),(0,l.useEffect)(()=>{let n=n=>new Promise((e,t)=>{var r;let a=n.clipboardData||(null===(r=n.originalEvent)||void 0===r?void 0:r.clipboardData);if(!a)return t("No clipboard data");let s=a.items,o=null;for(let e=0;e<s.length;e++)0===s[e].type.indexOf("image")&&(o=s[e].getAsFile());b(o).then(t=>e({...t,fileName:"Pasted image"})).catch(()=>t("No image found from paste"))}).then(e).catch(e=>t(e.toString()));return document.addEventListener("paste",n),()=>document.removeEventListener("paste",n)},[e,t]);let[p]=function(e){let[t,n]=(0,l.useState)(!1),[r,a]=(0,l.useState)(!1),s=e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),n(!0)},o=e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"),n(!1)},i=(0,l.useCallback)(t=>{t.stopPropagation(),t.preventDefault(),new Promise((e,n)=>{var r;let a=null===(r=t.dataTransfer)||void 0===r?void 0:r.files;a?b(a[0]).then(e).catch(n):n("No image found from drop")}).then(t=>{a(!1),n(!1),e(t)}).catch(e=>{n(!1),a(!0)})},[e]);return(0,l.useLayoutEffect)(()=>{let e=document.querySelector("main");if(e)return e.addEventListener("dragover",s),e.addEventListener("dragleave",o),e.addEventListener("drop",i),()=>{null==e||e.removeEventListener("dragover",s),null==e||e.removeEventListener("dragleave",o),null==e||e.removeEventListener("drop",i)}},[i]),[t,r]}(e=>n(e,"image")),f=c.touched&&c.error||o.error;return(0,r.jsx)(x,{children:(0,r.jsxs)("label",{tabIndex:0,className:(0,a.v_)("focus-ring group relative flex h-40 cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed p-2 text-center focus:ring-indigo-300/50",p?"border-indigo-400":"border-gray-300 hover:border-indigo-400"),children:[d?(0,r.jsx)(k,{dataUrl:d,fileName:o.fileName}):(0,r.jsx)(C,{}),f&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:f}),(0,r.jsx)("input",{className:"invisible h-0 w-0",type:"file",accept:"image/*",...u,onChange:async e=>{var t;let r=null===(t=e.target)||void 0===t?void 0:t.files;if(r)try{let e=await b(r[0]),t="";try{e.qrCodeData=await (0,g.pg)(e.dataUrl)}catch(e){t=(0,a.e$)(e)}n(e,"image"),t&&s(t)}catch(e){s((0,a.e$)(e))}}})]})})}function k(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-full flex-1 overflow-hidden",children:(0,r.jsx)("img",{src:e.dataUrl,alt:"",className:"h-full w-full object-contain"})}),e.fileName&&(0,r.jsx)("span",{children:e.fileName})]})}function C(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(j.Z,{className:"h-12 w-12 text-gray-300"}),(0,r.jsxs)("span",{className:"mt-4 text-sm leading-6 text-gray-600",children:[(0,r.jsx)("span",{className:"inline font-semibold text-indigo-600 group-hover:underline",children:"Select an image"}),", drag and drop, or paste"]})]})}function S(e){return(0,r.jsxs)("div",{className:"grow-wrap",children:[(0,r.jsxs)("span",{className:(0,a.v_)("invisible whitespace-pre-wrap",e.className),"aria-hidden":!0,children:[e.value," "]}),(0,r.jsx)("textarea",{...e})]})}function Z(){let[e]=(0,h.U$)("qrCodeData");return(0,r.jsx)(S,{...e,className:"text-mono relative min-h-40 w-full break-words rounded-md border border-gray-300 bg-white px-3 py-2 text-sm shadow-sm focus:ring focus:ring-indigo-200/50",placeholder:"Google Backup codes\n\nabz2j-18dn3\n1l42k-vme4q"})}function R(e){return(0,r.jsx)(p,{children:(0,r.jsx)(F,{...e})})}function F(e){let{mode:t}=(0,l.useContext)(m);return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:(0,a.v_)("mb-2 grid text-center text-sm font-medium text-gray-900",e.showTypeMode?"grid-cols-4":"grid-cols-3"),children:[(0,r.jsx)(E,{mode:"image",text:"Select",icon:s.Z}),(0,r.jsx)(E,{mode:"camera",text:"Scan",icon:o.Z}),e.showTypeMode&&(0,r.jsx)(E,{mode:"type",text:"Text",icon:i.Z}),(0,r.jsx)(E,{mode:"demo",text:"Demo",icon:c.Z})]}),"image"===t&&(0,r.jsx)(N,{}),"camera"===t&&(0,r.jsx)(f,{}),"type"===t&&(0,r.jsx)(Z,{}),"demo"===t&&(0,r.jsx)(v,{imageSrc:e.demoSrc,description:e.demoDescription})]})}function E(e){let{mode:t,setMode:n}=(0,l.useContext)(m);return(0,r.jsxs)("button",{type:"button",onClick:()=>n(e.mode),className:(0,a.v_)("focus-ring flex items-center justify-center p-3 hover:rounded hover:bg-gray-50 focus:rounded",t===e.mode&&"border-b-2 border-b-indigo-500"),children:[(0,r.jsx)(e.icon,{className:"mr-1 h-5 w-5 flex-shrink-0"}),(0,r.jsx)("span",{children:e.text})]})}n(8650)},5212:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7437),a=n(741),s=n(2537);function o(e){var t;let[n,o]=(0,s.U$)({...e,validate:t=>t.length<e.minLength?"".concat(e.label," is too short"):void 0}),{value:i}=n;return(0,r.jsxs)("label",{className:"block",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"ml-2 text-gray-800",children:e.label}),(0,r.jsx)("span",{className:"mr-2 text-xs",children:0===i.length?"*":i.length<e.minLength?e.minLength-i.length:null})]}),(0,r.jsx)("span",{className:"ml-2 text-xs text-gray-600",children:e.description}),(0,r.jsx)("input",{...n,...e,type:null!==(t=e.type)&&void 0!==t?t:"text",required:!0,className:(0,a.v_)("disabled mt-1 block w-full rounded-md border shadow-sm focus:ring",i.length>0&&i.length<e.minLength?"border-red-300 focus:border-red-300 focus:ring-red-200/50":"border-gray-300 focus:border-indigo-300 focus:ring-indigo-200/50")}),o.error&&o.touched?(0,r.jsx)("div",{className:"text-sm text-red-500",children:o.error}):null]})}},5987:function(e,t,n){"use strict";n.d(t,{H:function(){return o},f:function(){return s}});var r=n(7437),a=n(741);function s(e){return(0,r.jsx)("svg",{viewBox:"0 0 98 96",...e,children:(0,r.jsx)("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.3
162 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z"})})}function o(e){return(0,r.jsxs)("svg",{className:(0,a.v_)("animate-spin",e.className),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",children:[(0,r.jsx)("circle",{opacity:"0.25",cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{opacity:"0.75",d:"M22 12 A 10 10 0 0 1 7 20.7"})]})}},8650:function(){}}]);

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.