"use strict";const g=["Aztec","Codabar","Code128","Code39","Code93","DataBar","DataBarExpanded","DataMatrix","DXFilmEdge","EAN-13","EAN-8","ITF","Linear-Codes","Matrix-Codes","MaxiCode","MicroQRCode","None","PDF417","QRCode","rMQRCode","UPC-A","UPC-E"];function E(e){return e.join("|")}function T(e){const t=y(e);let r=0,n=g.length-1;for(;r<=n;){const o=Math.floor((r+n)/2),a=g[o],i=y(a);if(i===t)return a;i<t?r=o+1:n=o-1}return"None"}function y(e){return e.toLowerCase().replace(/_-\[\]/g,"")}const b=["LocalAverage","GlobalHistogram","FixedThreshold","BoolCast"];function w(e,t){return e.Binarizer[t]}const R=["Unknown","ASCII","ISO8859_1","ISO8859_2","ISO8859_3","ISO8859_4","ISO8859_5","ISO8859_6","ISO8859_7","ISO8859_8","ISO8859_9","ISO8859_10","ISO8859_11","ISO8859_13","ISO8859_14","ISO8859_15","ISO8859_16","Cp437","Cp1250","Cp1251","Cp1252","Cp1256","Shift_JIS","Big5","GB2312","GB18030","EUC_JP","EUC_KR","UTF16BE","UTF8","UTF16LE","UTF32BE","UTF32LE","BINARY"];function O(e,t){return e.CharacterSet[t]}const F=["Text","Binary","Mixed","GS1","ISO15434","UnknownECI"];function _(e){return F[e.value]}const B=["Ignore","Read","Require"];function A(e,t){return e.EanAddOnSymbol[t]}const v=["Plain","ECI","HRI","Hex","Escaped"];function W(e,t){return e.TextMode[t]}const d={formats:[],tryHarder:!0,tryRotate:!0,tryInvert:!0,tryDownscale:!0,binarizer:"LocalAverage",isPure:!1,downscaleFactor:3,downscaleThreshold:500,minLineCount:2,maxNumberOfSymbols:255,tryCode39ExtendedMode:!1,validateCode39CheckSum:!1,validateITFCheckSum:!1,returnCodabarStartEnd:!1,returnErrors:!1,eanAddOnSymbol:"Read",textMode:"Plain",characterSet:"Unknown"};function C(e,t){return{...t,formats:E(t.formats),binarizer:w(e,t.binarizer),eanAddOnSymbol:A(e,t.eanAddOnSymbol),textMode:W(e,t.textMode),characterSet:O(e,t.characterSet)}}const M=[-1,0,1,2,3,4,5,6,7,8],U=["L","M","Q","H"],h={width:200,height:200,format:"QRCode",characterSet:"UTF8",eccLevel:-1,margin:10};function L(e,t){return{...t,characterSet:O(e,t.characterSet)}}function p(e){return{...e,format:T(e.format),eccLevel:e.eccLevel,contentType:_(e.contentType)}}function P(e){const{image:t,error:r}=e;return t?{image:new Blob([new Uint8Array(t)],{type:"image/png"}),error:""}:{image:null,error:r}}const X={locateFile:(e,t)=>{const r=e.match(/_(.+?)\.wasm$/);return r?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.1.3/dist/${r[1]}/${e}`:t+e}};let m=new WeakMap;function f(e,t){var a;const r=m.get(e);if(r!=null&&r.modulePromise&&(t===void 0||Object.is(t,r.moduleOverrides)))return r.modulePromise;const n=(a=t!=null?t:r==null?void 0:r.moduleOverrides)!=null?a:X,o=e({...n});return m.set(e,{moduleOverrides:n,modulePromise:o}),o}function x(){m=new WeakMap}function Z(e,t){m.set(e,{moduleOverrides:t})}async function z(e,t,r=d){const n={...d,...r},o=await f(e),{size:a}=t,i=new Uint8Array(await t.arrayBuffer()),u=o._malloc(a);o.HEAPU8.set(i,u);const l=o.readBarcodesFromImage(u,a,C(o,n));o._free(u);const c=[];for(let s=0;s<l.size();++s)c.push(p(l.get(s)));return c}async function D(e,t,r=d){const n={...d,...r},o=await f(e),{data:a,width:i,height:u,data:{byteLength:l}}=t,c=o._malloc(l);o.HEAPU8.set(a,c);const s=o.readBarcodesFromPixmap(c,i,u,C(o,n));o._free(c);const I=[];for(let S=0;S<s.size();++S)I.push(p(s.get(S)));return I}async function H(e,t,r=h){const n={...h,...r},o=await f(e),a=o.writeBarcodeToImage(t,L(o,n));return P(a)}const N={...d,formats:[...d.formats]},$={...h};exports.barcodeFormats=g;exports.binarizers=b;exports.characterSets=R;exports.contentTypes=F;exports.defaultReaderOptions=N;exports.defaultWriterOptions=$;exports.eanAddOnSymbols=B;exports.getZXingModuleWithFactory=f;exports.purgeZXingModule=x;exports.readBarcodesFromImageDataWithFactory=D;exports.readBarcodesFromImageFileWithFactory=z;exports.readOutputEccLevels=U;exports.setZXingModuleOverridesWithFactory=Z;exports.textModes=v;exports.writeBarcodeToImageFileWithFactory=H;exports.writeInputEccLevels=M;
