UNPKG

vue-qrcode-reader

Version:

A set of Vue.js components for detecting and decoding QR codes.

3 lines 73.9 kB
(function(ee,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],O):(ee=typeof globalThis<"u"?globalThis:ee||self,O(ee.VueQrcodeReader={},ee.Vue))})(this,function(ee,O){"use strict";var Wt=(r,o,i)=>{if(!o.has(r))throw TypeError("Cannot "+i)},jt=(r,o,i)=>(Wt(r,o,"read from private field"),i?i.call(r):o.get(r)),tn=(r,o,i)=>{if(o.has(r))throw TypeError("Cannot add the same private member more than once");o instanceof WeakSet?o.add(r):o.set(r,i)},rn=(r,o,i,c)=>(Wt(r,o,"write to private field"),o.set(r,i),i);const Lt=[["aztec","Aztec"],["code_128","Code128"],["code_39","Code39"],["code_93","Code93"],["codabar","Codabar"],["databar","DataBar"],["databar_expanded","DataBarExpanded"],["data_matrix","DataMatrix"],["dx_film_edge","DXFilmEdge"],["ean_13","EAN-13"],["ean_8","EAN-8"],["itf","ITF"],["maxi_code","MaxiCode"],["micro_qr_code","MicroQRCode"],["pdf417","PDF417"],["qr_code","QRCode"],["rm_qr_code","rMQRCode"],["upc_a","UPC-A"],["upc_e","UPC-E"],["linear_codes","Linear-Codes"],["matrix_codes","Matrix-Codes"]],nn=[...Lt,["unknown"]].map(r=>r[0]),He=new Map(Lt);function an(r){for(const[o,i]of He)if(r===i)return o;return"unknown"}function on(r){if(Ht(r))return{width:r.naturalWidth,height:r.naturalHeight};if(Bt(r))return{width:r.width.baseVal.value,height:r.height.baseVal.value};if(Vt(r))return{width:r.videoWidth,height:r.videoHeight};if(Nt(r))return{width:r.width,height:r.height};if(Gt(r))return{width:r.displayWidth,height:r.displayHeight};if(qt(r))return{width:r.width,height:r.height};if(zt(r))return{width:r.width,height:r.height};throw new TypeError("The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'.")}function Ht(r){try{return r instanceof HTMLImageElement}catch(o){return!1}}function Bt(r){try{return r instanceof SVGImageElement}catch(o){return!1}}function Vt(r){try{return r instanceof HTMLVideoElement}catch(o){return!1}}function qt(r){try{return r instanceof HTMLCanvasElement}catch(o){return!1}}function Nt(r){try{return r instanceof ImageBitmap}catch(o){return!1}}function zt(r){try{return r instanceof OffscreenCanvas}catch(o){return!1}}function Gt(r){try{return r instanceof VideoFrame}catch(o){return!1}}function Yt(r){try{return r instanceof Blob}catch(o){return!1}}function sn(r){try{return r instanceof ImageData}catch(o){return!1}}function cn(r,o){try{const i=new OffscreenCanvas(r,o);if(i.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return i;throw void 0}catch(i){const c=document.createElement("canvas");return c.width=r,c.height=o,c}}async function Jt(r){if(Ht(r)&&!await fn(r))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(Bt(r)&&!await hn(r))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(Gt(r)&&pn(r))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(Vt(r)&&(r.readyState===0||r.readyState===1))throw new DOMException("Invalid element or state.","InvalidStateError");if(Nt(r)&&vn(r))throw new DOMException("The image source is detached.","InvalidStateError");const{width:o,height:i}=on(r);if(o===0||i===0)return null;const c=cn(o,i).getContext("2d");c.drawImage(r,0,0);try{return c.getImageData(0,0,o,i)}catch(l){throw new DOMException("Source would taint origin.","SecurityError")}}async function un(r){let o;try{if(globalThis.createImageBitmap)o=await createImageBitmap(r);else if(globalThis.Image){o=new Image;let i="";try{i=URL.createObjectURL(r),o.src=i,await o.decode()}finally{URL.revokeObjectURL(i)}}else return r}catch(i){throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await Jt(o)}function ln(r){const{width:o,height:i}=r;if(o===0||i===0)return null;const c=r.getContext("2d");try{return c.getImageData(0,0,o,i)}catch(l){throw new DOMException("Source would taint origin.","SecurityError")}}async function dn(r){if(Yt(r))return await un(r);if(sn(r)){if(mn(r))throw new DOMException("The image data has been detached.","InvalidStateError");return r}return qt(r)||zt(r)?ln(r):await Jt(r)}async function fn(r){try{return await r.decode(),!0}catch(o){return!1}}async function hn(r){var o;try{return await((o=r.decode)==null?void 0:o.call(r)),!0}catch(i){return!1}}function pn(r){return r.format===null}function mn(r){return r.data.buffer.byteLength===0}function vn(r){return r.width===0&&r.height===0}function Qt(r,o){return r instanceof DOMException?new DOMException(`${o}: ${r.message}`,r.name):r instanceof Error?new r.constructor(`${o}: ${r.message}`):new Error(`${o}: ${r}`)}const Xt=["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 yn(r){return r.join("|")}function gn(r){const o=Zt(r);let i=0,c=Xt.length-1;for(;i<=c;){const l=Math.floor((i+c)/2),h=Xt[l],v=Zt(h);if(v===o)return h;v<o?i=l+1:c=l-1}return"None"}function Zt(r){return r.toLowerCase().replace(/_-\[\]/g,"")}function wn(r,o){return r.Binarizer[o]}function bn(r,o){return r.CharacterSet[o]}const Cn=["Text","Binary","Mixed","GS1","ISO15434","UnknownECI"];function $n(r){return Cn[r.value]}function _n(r,o){return r.EanAddOnSymbol[o]}function Sn(r,o){return r.TextMode[o]}const Ce={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 Kt(r,o){return{...o,formats:yn(o.formats),binarizer:wn(r,o.binarizer),eanAddOnSymbol:_n(r,o.eanAddOnSymbol),textMode:Sn(r,o.textMode),characterSet:bn(r,o.characterSet)}}function er(r){return{...r,format:gn(r.format),eccLevel:r.eccLevel,contentType:$n(r.contentType)}}const Pn={locateFile:(r,o)=>{const i=r.match(/_(.+?)\.wasm$/);return i?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.1.3/dist/${i[1]}/${r}`:o+r}};let lt=new WeakMap;function dt(r,o){var i;const c=lt.get(r);if(c!=null&&c.modulePromise&&o===void 0)return c.modulePromise;const l=(i=c==null?void 0:c.moduleOverrides)!=null?i:Pn,h=r({...l});return lt.set(r,{moduleOverrides:l,modulePromise:h}),h}function Tn(r,o){lt.set(r,{moduleOverrides:o})}async function En(r,o,i=Ce){const c={...Ce,...i},l=await dt(r),{size:h}=o,v=new Uint8Array(await o.arrayBuffer()),g=l._malloc(h);l.HEAPU8.set(v,g);const b=l.readBarcodesFromImage(g,h,Kt(l,c));l._free(g);const p=[];for(let C=0;C<b.size();++C)p.push(er(b.get(C)));return p}async function On(r,o,i=Ce){const c={...Ce,...i},l=await dt(r),{data:h,width:v,height:g,data:{byteLength:b}}=o,p=l._malloc(b);l.HEAPU8.set(h,p);const C=l.readBarcodesFromPixmap(p,v,g,Kt(l,c));l._free(p);const S=[];for(let $=0;$<C.size();++$)S.push(er(C.get($)));return S}({...Ce,formats:[...Ce.formats]});var Be=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(o={}){var i=o,c,l;i.ready=new Promise((e,t)=>{c=e,l=t});var h=Object.assign({},i),v="./this.program",g=typeof window=="object",b=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&process.versions.node;var p="";function C(e){return i.locateFile?i.locateFile(e,p):p+e}var S;(g||b)&&(b?p=self.location.href:typeof document<"u"&&document.currentScript&&(p=document.currentScript.src),r&&(p=r),p.indexOf("blob:")!==0?p=p.substr(0,p.replace(/[?#].*/,"").lastIndexOf("/")+1):p="",b&&(S=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})),i.print||console.log.bind(console);var $=i.printErr||console.error.bind(console);Object.assign(i,h),h=null,i.arguments&&i.arguments,i.thisProgram&&(v=i.thisProgram),i.quit&&i.quit;var U;i.wasmBinary&&(U=i.wasmBinary),typeof WebAssembly!="object"&&K("no native wasm support detected");var W,j=!1,k,R,Z,I,D,A,me,ce;function Se(){var e=W.buffer;i.HEAP8=k=new Int8Array(e),i.HEAP16=Z=new Int16Array(e),i.HEAPU8=R=new Uint8Array(e),i.HEAPU16=I=new Uint16Array(e),i.HEAP32=D=new Int32Array(e),i.HEAPU32=A=new Uint32Array(e),i.HEAPF32=me=new Float32Array(e),i.HEAPF64=ce=new Float64Array(e)}var Pe=[],Ae=[],Re=[];function ze(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)mt(i.preRun.shift());wt(Pe)}function ht(){wt(Ae)}function pt(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)xe(i.postRun.shift());wt(Re)}function mt(e){Pe.unshift(e)}function vt(e){Ae.unshift(e)}function xe(e){Re.unshift(e)}var oe=0,ge=null;function Ge(e){var t;oe++,(t=i.monitorRunDependencies)===null||t===void 0||t.call(i,oe)}function ve(e){var t;if(oe--,(t=i.monitorRunDependencies)===null||t===void 0||t.call(i,oe),oe==0&&ge){var n=ge;ge=null,n()}}function K(e){var t;(t=i.onAbort)===null||t===void 0||t.call(i,e),e="Aborted("+e+")",$(e),j=!0,e+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(e);throw l(n),n}var yt="data:application/octet-stream;base64,",Ye=e=>e.startsWith(yt),ye;ye="zxing_reader.wasm",Ye(ye)||(ye=C(ye));function Je(e){if(e==ye&&U)return new Uint8Array(U);if(S)return S(e);throw"both async and sync fetching of the wasm failed"}function gt(e){return!U&&(g||b)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()}).catch(()=>Je(e)):Promise.resolve().then(()=>Je(e))}function Qe(e,t,n){return gt(e).then(a=>WebAssembly.instantiate(a,t)).then(a=>a).then(n,a=>{$(`failed to asynchronously prepare wasm: ${a}`),K(a)})}function ba(e,t,n,a){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Ye(t)&&typeof fetch=="function"?fetch(t,{credentials:"same-origin"}).then(s=>{var u=WebAssembly.instantiateStreaming(s,n);return u.then(a,function(d){return $(`wasm streaming compile failed: ${d}`),$("falling back to ArrayBuffer instantiation"),Qe(t,n,a)})}):Qe(t,n,a)}function Ca(){var e={a:ui};function t(a,s){return G=a.exports,W=G.ia,Se(),kr=G.ma,vt(G.ja),ve(),G}Ge();function n(a){t(a.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(a){$(`Module.instantiateWasm callback failed with error: ${a}`),l(a)}return ba(U,ye,e,n).catch(l),{}}var wt=e=>{for(;e.length>0;)e.shift()(i)};i.noExitRuntime;var Xe=[],Ze=0,$a=e=>{var t=new bt(e);return t.get_caught()||(t.set_caught(!0),Ze--),t.set_rethrown(!1),Xe.push(t),Yr(t.excPtr),t.get_exception_ptr()},ue=0,_a=()=>{L(0,0);var e=Xe.pop();Gr(e.excPtr),ue=0};function bt(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(t){A[this.ptr+4>>2]=t},this.get_type=function(){return A[this.ptr+4>>2]},this.set_destructor=function(t){A[this.ptr+8>>2]=t},this.get_destructor=function(){return A[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,k[this.ptr+12>>0]=t},this.get_caught=function(){return k[this.ptr+12>>0]!=0},this.set_rethrown=function(t){t=t?1:0,k[this.ptr+13>>0]=t},this.get_rethrown=function(){return k[this.ptr+13>>0]!=0},this.init=function(t,n){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(n)},this.set_adjusted_ptr=function(t){A[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return A[this.ptr+16>>2]},this.get_exception_ptr=function(){var t=Qr(this.get_type());if(t)return A[this.excPtr>>2];var n=this.get_adjusted_ptr();return n!==0?n:this.excPtr}}var Sa=e=>{throw ue||(ue=e),ue},Ct=e=>{var t=ue;if(!t)return Le(0),0;var n=new bt(t);n.set_adjusted_ptr(t);var a=n.get_type();if(!a)return Le(0),t;for(var s in e){var u=e[s];if(u===0||u===a)break;var d=n.ptr+16;if(Jr(u,a,d))return Le(u),t}return Le(a),t},Pa=()=>Ct([]),Ta=e=>Ct([e]),Ea=(e,t)=>Ct([e,t]),Oa=()=>{var e=Xe.pop();e||K("no exception to throw");var t=e.excPtr;throw e.get_rethrown()||(Xe.push(e),e.set_rethrown(!0),e.set_caught(!1),Ze++),ue=t,ue},Ma=(e,t,n)=>{var a=new bt(e);throw a.init(t,n),ue=e,Ze++,ue},Da=()=>Ze,Ke={},$t=e=>{for(;e.length;){var t=e.pop(),n=e.pop();n(t)}};function _t(e){return this.fromWireType(D[e>>2])}var Te={},we={},et={},Pr,tt=e=>{throw new Pr(e)},be=(e,t,n)=>{e.forEach(function(f){et[f]=t});function a(f){var m=n(f);m.length!==e.length&&tt("Mismatched type converter count");for(var w=0;w<e.length;++w)ie(e[w],m[w])}var s=new Array(t.length),u=[],d=0;t.forEach((f,m)=>{we.hasOwnProperty(f)?s[m]=we[f]:(u.push(f),Te.hasOwnProperty(f)||(Te[f]=[]),Te[f].push(()=>{s[m]=we[f],++d,d===u.length&&a(s)}))}),u.length===0&&a(s)},Aa=e=>{var t=Ke[e];delete Ke[e];var n=t.rawConstructor,a=t.rawDestructor,s=t.fields,u=s.map(d=>d.getterReturnType).concat(s.map(d=>d.setterArgumentType));be([e],u,d=>{var f={};return s.forEach((m,w)=>{var _=m.fieldName,T=d[w],E=m.getter,M=m.getterContext,H=d[w+s.length],N=m.setter,F=m.setterContext;f[_]={read:Q=>T.fromWireType(E(M,Q)),write:(Q,y)=>{var P=[];N(F,Q,H.toWireType(P,y)),$t(P)}}}),[{name:t.name,fromWireType:m=>{var w={};for(var _ in f)w[_]=f[_].read(m);return a(m),w},toWireType:(m,w)=>{for(var _ in f)if(!(_ in w))throw new TypeError(`Missing field: "${_}"`);var T=n();for(_ in f)f[_].write(T,w[_]);return m!==null&&m.push(a,T),T},argPackAdvance:se,readValueFromPointer:_t,destructorFunction:a}]})},Ra=(e,t,n,a,s)=>{},xa=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Tr=e},Tr,J=e=>{for(var t="",n=e;R[n];)t+=Tr[R[n++]];return t},Ee,x=e=>{throw new Ee(e)};function ka(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var a=t.name;if(e||x(`type "${a}" must have a positive integer typeid pointer`),we.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;x(`Cannot register type '${a}' twice`)}if(we[e]=t,delete et[e],Te.hasOwnProperty(e)){var s=Te[e];delete Te[e],s.forEach(u=>u())}}function ie(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return ka(e,t,n)}var se=8,Ia=(e,t,n,a)=>{t=J(t),ie(e,{name:t,fromWireType:function(s){return!!s},toWireType:function(s,u){return u?n:a},argPackAdvance:se,readValueFromPointer:function(s){return this.fromWireType(R[s])},destructorFunction:null})},Fa=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),St=e=>{function t(n){return n.$$.ptrType.registeredClass.name}x(t(e)+" instance already deleted")},Pt=!1,Er=e=>{},Ua=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},Or=e=>{e.count.value-=1;var t=e.count.value===0;t&&Ua(e)},Mr=(e,t,n)=>{if(t===n)return e;if(n.baseClass===void 0)return null;var a=Mr(e,t,n.baseClass);return a===null?null:n.downcast(a)},Dr={},Wa=()=>Object.keys(Fe).length,ja=()=>{var e=[];for(var t in Fe)Fe.hasOwnProperty(t)&&e.push(Fe[t]);return e},ke=[],Tt=()=>{for(;ke.length;){var e=ke.pop();e.$$.deleteScheduled=!1,e.delete()}},Ie,La=e=>{Ie=e,ke.length&&Ie&&Ie(Tt)},Ha=()=>{i.getInheritedInstanceCount=Wa,i.getLiveInheritedInstances=ja,i.flushPendingDeletes=Tt,i.setDelayFunction=La},Fe={},Ba=(e,t)=>{for(t===void 0&&x("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},Va=(e,t)=>(t=Ba(e,t),Fe[t]),rt=(e,t)=>{(!t.ptrType||!t.ptr)&&tt("makeClassHandle requires ptr and ptrType");var n=!!t.smartPtrType,a=!!t.smartPtr;return n!==a&&tt("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Ue(Object.create(e,{$$:{value:t,writable:!0}}))};function qa(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=Va(this.registeredClass,t);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var a=n.clone();return this.destructor(e),a}function s(){return this.isSmartPointer?rt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):rt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(t),d=Dr[u];if(!d)return s.call(this);var f;this.isConst?f=d.constPointerType:f=d.pointerType;var m=Mr(t,this.registeredClass,f.registeredClass);return m===null?s.call(this):this.isSmartPointer?rt(f.registeredClass.instancePrototype,{ptrType:f,ptr:m,smartPtrType:this,smartPtr:e}):rt(f.registeredClass.instancePrototype,{ptrType:f,ptr:m})}var Ue=e=>typeof FinalizationRegistry>"u"?(Ue=t=>t,e):(Pt=new FinalizationRegistry(t=>{Or(t.$$)}),Ue=t=>{var n=t.$$,a=!!n.smartPtr;if(a){var s={$$:n};Pt.register(t,s,t)}return t},Er=t=>Pt.unregister(t),Ue(e)),Na=()=>{Object.assign(nt.prototype,{isAliasOf(e){if(!(this instanceof nt)||!(e instanceof nt))return!1;var t=this.$$.ptrType.registeredClass,n=this.$$.ptr;e.$$=e.$$;for(var a=e.$$.ptrType.registeredClass,s=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;a.baseClass;)s=a.upcast(s),a=a.baseClass;return t===a&&n===s},clone(){if(this.$$.ptr||St(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Ue(Object.create(Object.getPrototypeOf(this),{$$:{value:Fa(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||St(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&x("Object already scheduled for deletion"),Er(this),Or(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||St(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&x("Object already scheduled for deletion"),ke.push(this),ke.length===1&&Ie&&Ie(Tt),this.$$.deleteScheduled=!0,this}})};function nt(){}var We=(e,t)=>Object.defineProperty(t,"name",{value:e}),Ar=(e,t,n)=>{if(e[t].overloadTable===void 0){var a=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||x(`Function '${n}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[a.argCount]=a}},Et=(e,t,n)=>{i.hasOwnProperty(e)?((n===void 0||i[e].overloadTable!==void 0&&i[e].overloadTable[n]!==void 0)&&x(`Cannot register public name '${e}' twice`),Ar(i,e,e),i.hasOwnProperty(n)&&x(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),i[e].overloadTable[n]=t):(i[e]=t,n!==void 0&&(i[e].numArguments=n))},za=48,Ga=57,Ya=e=>{if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=za&&t<=Ga?`_${e}`:e};function Ja(e,t,n,a,s,u,d,f){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=a,this.baseClass=s,this.getActualType=u,this.upcast=d,this.downcast=f,this.pureVirtualFunctions=[]}var Ot=(e,t,n)=>{for(;t!==n;)t.upcast||x(`Expected null or instance of ${n.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Qa(e,t){if(t===null)return this.isReference&&x(`null is not a valid ${this.name}`),0;t.$$||x(`Cannot pass "${xt(t)}" as a ${this.name}`),t.$$.ptr||x(`Cannot pass deleted object as a pointer of type ${this.name}`);var n=t.$$.ptrType.registeredClass,a=Ot(t.$$.ptr,n,this.registeredClass);return a}function Xa(e,t){var n;if(t===null)return this.isReference&&x(`null is not a valid ${this.name}`),this.isSmartPointer?(n=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,n),n):0;(!t||!t.$$)&&x(`Cannot pass "${xt(t)}" as a ${this.name}`),t.$$.ptr||x(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&x(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var a=t.$$.ptrType.registeredClass;if(n=Ot(t.$$.ptr,a,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&x("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:x(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:n=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)n=t.$$.smartPtr;else{var s=t.clone();n=this.rawShare(n,le.toHandle(()=>s.delete())),e!==null&&e.push(this.rawDestructor,n)}break;default:x("Unsupporting sharing policy")}return n}function Za(e,t){if(t===null)return this.isReference&&x(`null is not a valid ${this.name}`),0;t.$$||x(`Cannot pass "${xt(t)}" as a ${this.name}`),t.$$.ptr||x(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&x(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass,a=Ot(t.$$.ptr,n,this.registeredClass);return a}function Rr(e){return this.fromWireType(A[e>>2])}var Ka=()=>{Object.assign(at.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var t;(t=this.rawDestructor)===null||t===void 0||t.call(this,e)},argPackAdvance:se,readValueFromPointer:Rr,deleteObject(e){e!==null&&e.delete()},fromWireType:qa})};function at(e,t,n,a,s,u,d,f,m,w,_){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=a,this.isSmartPointer=s,this.pointeeType=u,this.sharingPolicy=d,this.rawGetPointee=f,this.rawConstructor=m,this.rawShare=w,this.rawDestructor=_,!s&&t.baseClass===void 0?a?(this.toWireType=Qa,this.destructorFunction=null):(this.toWireType=Za,this.destructorFunction=null):this.toWireType=Xa}var xr=(e,t,n)=>{i.hasOwnProperty(e)||tt("Replacing nonexistant public symbol"),i[e].overloadTable!==void 0&&n!==void 0?i[e].overloadTable[n]=t:(i[e]=t,i[e].argCount=n)},eo=(e,t,n)=>{var a=i["dynCall_"+e];return n&&n.length?a.apply(null,[t].concat(n)):a.call(null,t)},ot=[],kr,B=e=>{var t=ot[e];return t||(e>=ot.length&&(ot.length=e+1),ot[e]=t=kr.get(e)),t},to=(e,t,n)=>{if(e.includes("j"))return eo(e,t,n);var a=B(t).apply(null,n);return a},ro=(e,t)=>{var n=[];return function(){return n.length=0,Object.assign(n,arguments),to(e,t,n)}},re=(e,t)=>{e=J(e);function n(){return e.includes("j")?ro(e,t):B(t)}var a=n();return typeof a!="function"&&x(`unknown function pointer with signature ${e}: ${t}`),a},no=(e,t)=>{var n=We(t,function(a){this.name=t,this.message=a;var s=new Error(a).stack;s!==void 0&&(this.stack=this.toString()+` `+s.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},n},Ir,Fr=e=>{var t=zr(e),n=J(t);return de(t),n},it=(e,t)=>{var n=[],a={};function s(u){if(!a[u]&&!we[u]){if(et[u]){et[u].forEach(s);return}n.push(u),a[u]=!0}}throw t.forEach(s),new Ir(`${e}: `+n.map(Fr).join([", "]))},ao=(e,t,n,a,s,u,d,f,m,w,_,T,E)=>{_=J(_),u=re(s,u),f&&(f=re(d,f)),w&&(w=re(m,w)),E=re(T,E);var M=Ya(_);Et(M,function(){it(`Cannot construct ${_} due to unbound types`,[a])}),be([e,t,n],a?[a]:[],function(H){H=H[0];var N,F;a?(N=H.registeredClass,F=N.instancePrototype):F=nt.prototype;var Q=We(_,function(){if(Object.getPrototypeOf(this)!==y)throw new Ee("Use 'new' to construct "+_);if(P.constructor_body===void 0)throw new Ee(_+" has no accessible constructor");var en=P.constructor_body[arguments.length];if(en===void 0)throw new Ee(`Tried to invoke ctor of ${_} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(P.constructor_body).toString()}) parameters instead!`);return en.apply(this,arguments)}),y=Object.create(F,{constructor:{value:Q}});Q.prototype=y;var P=new Ja(_,Q,y,E,N,u,f,w);if(P.baseClass){var z,Y;(Y=(z=P.baseClass).__derivedClasses)!==null&&Y!==void 0||(z.__derivedClasses=[]),P.baseClass.__derivedClasses.push(P)}var Oe=new at(_,P,!0,!1,!1),ut=new at(_+"*",P,!1,!1,!1),Kr=new at(_+" const*",P,!1,!0,!1);return Dr[e]={pointerType:ut,constPointerType:Kr},xr(M,Q),[Oe,ut,Kr]})},Mt=(e,t)=>{for(var n=[],a=0;a<e;a++)n.push(A[t+a*4>>2]);return n};function oo(e){for(var t=1;t<e.length;++t)if(e[t]!==null&&e[t].destructorFunction===void 0)return!0;return!1}function Dt(e,t,n,a,s,u){var d=t.length;d<2&&x("argTypes array size mismatch! Must at least get return value and 'this' types!");var f=t[1]!==null&&n!==null,m=oo(t),w=t[0].name!=="void",_=d-2,T=new Array(_),E=[],M=[],H=function(){arguments.length!==_&&x(`function ${e} called with ${arguments.length} arguments, expected ${_}`),M.length=0;var N;E.length=f?2:1,E[0]=s,f&&(N=t[1].toWireType(M,this),E[1]=N);for(var F=0;F<_;++F)T[F]=t[F+2].toWireType(M,arguments[F]),E.push(T[F]);var Q=a.apply(null,E);function y(P){if(m)$t(M);else for(var z=f?1:2;z<t.length;z++){var Y=z===1?N:T[z-2];t[z].destructorFunction!==null&&t[z].destructorFunction(Y)}if(w)return t[0].fromWireType(P)}return y(Q)};return We(e,H)}var io=(e,t,n,a,s,u)=>{var d=Mt(t,n);s=re(a,s),be([],[e],function(f){f=f[0];var m=`constructor ${f.name}`;if(f.registeredClass.constructor_body===void 0&&(f.registeredClass.constructor_body=[]),f.registeredClass.constructor_body[t-1]!==void 0)throw new Ee(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return f.registeredClass.constructor_body[t-1]=()=>{it(`Cannot construct ${f.name} due to unbound types`,d)},be([],d,w=>(w.splice(1,0,null),f.registeredClass.constructor_body[t-1]=Dt(m,w,null,s,u),[])),[]})},Ur=e=>{e=e.trim();const t=e.indexOf("(");return t!==-1?e.substr(0,t):e},so=(e,t,n,a,s,u,d,f,m)=>{var w=Mt(n,a);t=J(t),t=Ur(t),u=re(s,u),be([],[e],function(_){_=_[0];var T=`${_.name}.${t}`;t.startsWith("@@")&&(t=Symbol[t.substring(2)]),f&&_.registeredClass.pureVirtualFunctions.push(t);function E(){it(`Cannot call ${T} due to unbound types`,w)}var M=_.registeredClass.instancePrototype,H=M[t];return H===void 0||H.overloadTable===void 0&&H.className!==_.name&&H.argCount===n-2?(E.argCount=n-2,E.className=_.name,M[t]=E):(Ar(M,t,T),M[t].overloadTable[n-2]=E),be([],w,function(N){var F=Dt(T,N,_,u,d);return M[t].overloadTable===void 0?(F.argCount=n-2,M[t]=F):M[t].overloadTable[n-2]=F,[]}),[]})};function co(){Object.assign(Wr.prototype,{get(e){return this.allocated[e]},has(e){return this.allocated[e]!==void 0},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function Wr(){this.allocated=[void 0],this.freelist=[]}var te=new Wr,At=e=>{e>=te.reserved&&--te.get(e).refcount===0&&te.free(e)},uo=()=>{for(var e=0,t=te.reserved;t<te.allocated.length;++t)te.allocated[t]!==void 0&&++e;return e},lo=()=>{te.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),te.reserved=te.allocated.length,i.count_emval_handles=uo},le={toValue:e=>(e||x("Cannot use deleted val. handle = "+e),te.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return te.allocate({refcount:1,value:e})}}},fo=(e,t)=>{t=J(t),ie(e,{name:t,fromWireType:n=>{var a=le.toValue(n);return At(n),a},toWireType:(n,a)=>le.toHandle(a),argPackAdvance:se,readValueFromPointer:_t,destructorFunction:null})},ho=(e,t,n)=>{switch(t){case 1:return n?function(a){return this.fromWireType(k[a>>0])}:function(a){return this.fromWireType(R[a>>0])};case 2:return n?function(a){return this.fromWireType(Z[a>>1])}:function(a){return this.fromWireType(I[a>>1])};case 4:return n?function(a){return this.fromWireType(D[a>>2])}:function(a){return this.fromWireType(A[a>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},po=(e,t,n,a)=>{t=J(t);function s(){}s.values={},ie(e,{name:t,constructor:s,fromWireType:function(u){return this.constructor.values[u]},toWireType:(u,d)=>d.value,argPackAdvance:se,readValueFromPointer:ho(t,n,a),destructorFunction:null}),Et(t,s)},Rt=(e,t)=>{var n=we[e];return n===void 0&&x(t+" has unknown type "+Fr(e)),n},mo=(e,t,n)=>{var a=Rt(e,"enum");t=J(t);var s=a.constructor,u=Object.create(a.constructor.prototype,{value:{value:n},constructor:{value:We(`${a.name}_${t}`,function(){})}});s.values[n]=u,s[t]=u},xt=e=>{if(e===null)return"null";var t=typeof e;return t==="object"||t==="array"||t==="function"?e.toString():""+e},vo=(e,t)=>{switch(t){case 4:return function(n){return this.fromWireType(me[n>>2])};case 8:return function(n){return this.fromWireType(ce[n>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},yo=(e,t,n)=>{t=J(t),ie(e,{name:t,fromWireType:a=>a,toWireType:(a,s)=>s,argPackAdvance:se,readValueFromPointer:vo(t,n),destructorFunction:null})},go=(e,t,n,a,s,u,d)=>{var f=Mt(t,n);e=J(e),e=Ur(e),s=re(a,s),Et(e,function(){it(`Cannot call ${e} due to unbound types`,f)},t-1),be([],f,function(m){var w=[m[0],null].concat(m.slice(1));return xr(e,Dt(e,w,null,s,u),t-1),[]})},wo=(e,t,n)=>{switch(t){case 1:return n?a=>k[a>>0]:a=>R[a>>0];case 2:return n?a=>Z[a>>1]:a=>I[a>>1];case 4:return n?a=>D[a>>2]:a=>A[a>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},bo=(e,t,n,a,s)=>{t=J(t);var u=_=>_;if(a===0){var d=32-8*n;u=_=>_<<d>>>d}var f=t.includes("unsigned"),m=(_,T)=>{},w;f?w=function(_,T){return m(T,this.name),T>>>0}:w=function(_,T){return m(T,this.name),T},ie(e,{name:t,fromWireType:u,toWireType:w,argPackAdvance:se,readValueFromPointer:wo(t,n,a!==0),destructorFunction:null})},Co=(e,t,n)=>{var a=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],s=a[t];function u(d){var f=A[d>>2],m=A[d+4>>2];return new s(k.buffer,m,f)}n=J(n),ie(e,{name:n,fromWireType:u,argPackAdvance:se,readValueFromPointer:u},{ignoreDuplicateRegistrations:!0})},jr=(e,t,n,a)=>{if(!(a>0))return 0;for(var s=n,u=n+a-1,d=0;d<e.length;++d){var f=e.charCodeAt(d);if(f>=55296&&f<=57343){var m=e.charCodeAt(++d);f=65536+((f&1023)<<10)|m&1023}if(f<=127){if(n>=u)break;t[n++]=f}else if(f<=2047){if(n+1>=u)break;t[n++]=192|f>>6,t[n++]=128|f&63}else if(f<=65535){if(n+2>=u)break;t[n++]=224|f>>12,t[n++]=128|f>>6&63,t[n++]=128|f&63}else{if(n+3>=u)break;t[n++]=240|f>>18,t[n++]=128|f>>12&63,t[n++]=128|f>>6&63,t[n++]=128|f&63}}return t[n]=0,n-s},$o=(e,t,n)=>jr(e,R,t,n),Lr=e=>{for(var t=0,n=0;n<e.length;++n){var a=e.charCodeAt(n);a<=127?t++:a<=2047?t+=2:a>=55296&&a<=57343?(t+=4,++n):t+=3}return t},Hr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,_o=(e,t,n)=>{for(var a=t+n,s=t;e[s]&&!(s>=a);)++s;if(s-t>16&&e.buffer&&Hr)return Hr.decode(e.subarray(t,s));for(var u="";t<s;){var d=e[t++];if(!(d&128)){u+=String.fromCharCode(d);continue}var f=e[t++]&63;if((d&224)==192){u+=String.fromCharCode((d&31)<<6|f);continue}var m=e[t++]&63;if((d&240)==224?d=(d&15)<<12|f<<6|m:d=(d&7)<<18|f<<12|m<<6|e[t++]&63,d<65536)u+=String.fromCharCode(d);else{var w=d-65536;u+=String.fromCharCode(55296|w>>10,56320|w&1023)}}return u},kt=(e,t)=>e?_o(R,e,t):"",So=(e,t)=>{t=J(t);var n=t==="std::string";ie(e,{name:t,fromWireType(a){var s=A[a>>2],u=a+4,d;if(n)for(var f=u,m=0;m<=s;++m){var w=u+m;if(m==s||R[w]==0){var _=w-f,T=kt(f,_);d===void 0?d=T:(d+="\0",d+=T),f=w+1}}else{for(var E=new Array(s),m=0;m<s;++m)E[m]=String.fromCharCode(R[u+m]);d=E.join("")}return de(a),d},toWireType(a,s){s instanceof ArrayBuffer&&(s=new Uint8Array(s));var u,d=typeof s=="string";d||s instanceof Uint8Array||s instanceof Uint8ClampedArray||s instanceof Int8Array||x("Cannot pass non-string to std::string"),n&&d?u=Lr(s):u=s.length;var f=Ut(4+u+1),m=f+4;if(A[f>>2]=u,n&&d)$o(s,m,u+1);else if(d)for(var w=0;w<u;++w){var _=s.charCodeAt(w);_>255&&(de(m),x("String has UTF-16 code units that do not fit in 8 bits")),R[m+w]=_}else for(var w=0;w<u;++w)R[m+w]=s[w];return a!==null&&a.push(de,f),f},argPackAdvance:se,readValueFromPointer:Rr,destructorFunction(a){de(a)}})},Br=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,Po=(e,t)=>{for(var n=e,a=n>>1,s=a+t/2;!(a>=s)&&I[a];)++a;if(n=a<<1,n-e>32&&Br)return Br.decode(R.subarray(e,n));for(var u="",d=0;!(d>=t/2);++d){var f=Z[e+d*2>>1];if(f==0)break;u+=String.fromCharCode(f)}return u},To=(e,t,n)=>{var a;if((a=n)!==null&&a!==void 0||(n=2147483647),n<2)return 0;n-=2;for(var s=t,u=n<e.length*2?n/2:e.length,d=0;d<u;++d){var f=e.charCodeAt(d);Z[t>>1]=f,t+=2}return Z[t>>1]=0,t-s},Eo=e=>e.length*2,Oo=(e,t)=>{for(var n=0,a="";!(n>=t/4);){var s=D[e+n*4>>2];if(s==0)break;if(++n,s>=65536){var u=s-65536;a+=String.fromCharCode(55296|u>>10,56320|u&1023)}else a+=String.fromCharCode(s)}return a},Mo=(e,t,n)=>{var a;if((a=n)!==null&&a!==void 0||(n=2147483647),n<4)return 0;for(var s=t,u=s+n-4,d=0;d<e.length;++d){var f=e.charCodeAt(d);if(f>=55296&&f<=57343){var m=e.charCodeAt(++d);f=65536+((f&1023)<<10)|m&1023}if(D[t>>2]=f,t+=4,t+4>u)break}return D[t>>2]=0,t-s},Do=e=>{for(var t=0,n=0;n<e.length;++n){var a=e.charCodeAt(n);a>=55296&&a<=57343&&++n,t+=4}return t},Ao=(e,t,n)=>{n=J(n);var a,s,u,d,f;t===2?(a=Po,s=To,d=Eo,u=()=>I,f=1):t===4&&(a=Oo,s=Mo,d=Do,u=()=>A,f=2),ie(e,{name:n,fromWireType:m=>{for(var w=A[m>>2],_=u(),T,E=m+4,M=0;M<=w;++M){var H=m+4+M*t;if(M==w||_[H>>f]==0){var N=H-E,F=a(E,N);T===void 0?T=F:(T+="\0",T+=F),E=H+t}}return de(m),T},toWireType:(m,w)=>{typeof w!="string"&&x(`Cannot pass non-string to C++ string type ${n}`);var _=d(w),T=Ut(4+_+t);return A[T>>2]=_>>f,s(w,T+4,_+t),m!==null&&m.push(de,T),T},argPackAdvance:se,readValueFromPointer:_t,destructorFunction(m){de(m)}})},Ro=(e,t,n,a,s,u)=>{Ke[e]={name:J(t),rawConstructor:re(n,a),rawDestructor:re(s,u),fields:[]}},xo=(e,t,n,a,s,u,d,f,m,w)=>{Ke[e].fields.push({fieldName:J(t),getterReturnType:n,getter:re(a,s),getterContext:u,setterArgumentType:d,setter:re(f,m),setterContext:w})},ko=(e,t)=>{t=J(t),ie(e,{isVoid:!0,name:t,argPackAdvance:0,fromWireType:()=>{},toWireType:(n,a)=>{}})},It=[],Io=(e,t,n,a)=>(e=It[e],t=le.toValue(t),e(null,t,n,a)),Fo={},Uo=e=>{var t=Fo[e];return t===void 0?J(e):t},Vr=()=>{if(typeof globalThis=="object")return globalThis;function e(t){t.$$$embind_global$$$=t;var n=typeof $$$embind_global$$$=="object"&&t.$$$embind_global$$$==t;return n||delete t.$$$embind_global$$$,n}if(typeof $$$embind_global$$$=="object"||(typeof global=="object"&&e(global)?$$$embind_global$$$=global:typeof self=="object"&&e(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},Wo=e=>e===0?le.toHandle(Vr()):(e=Uo(e),le.toHandle(Vr()[e])),jo=e=>{var t=It.length;return It.push(e),t},Lo=(e,t)=>{for(var n=new Array(e),a=0;a<e;++a)n[a]=Rt(A[t+a*4>>2],"parameter "+a);return n},Ho=Reflect.construct,Bo=(e,t,n)=>{var a=[],s=e.toWireType(a,n);return a.length&&(A[t>>2]=le.toHandle(a)),s},Vo=(e,t,n)=>{var a=Lo(e,t),s=a.shift();e--;var u=new Array(e),d=(m,w,_,T)=>{for(var E=0,M=0;M<e;++M)u[M]=a[M].readValueFromPointer(T+E),E+=a[M].argPackAdvance;for(var H=n===1?Ho(w,u):w.apply(m,u),M=0;M<e;++M){var N,F;(N=(F=a[M]).deleteObject)===null||N===void 0||N.call(F,u[M])}return Bo(s,_,H)},f=`methodCaller<(${a.map(m=>m.name).join(", ")}) => ${s.name}>`;return jo(We(f,d))},qo=e=>{e>4&&(te.get(e).refcount+=1)},No=e=>{var t=le.toValue(e);$t(t),At(e)},zo=(e,t)=>{e=Rt(e,"_emval_take_value");var n=e.readValueFromPointer(t);return le.toHandle(n)},Go=()=>{K("")},Yo=(e,t,n)=>R.copyWithin(e,t,t+n),Jo=()=>2147483648,Qo=e=>{var t=W.buffer,n=(e-t.byteLength+65535)/65536;try{return W.grow(n),Se(),1}catch(a){}},Xo=e=>{var t=R.length;e>>>=0;var n=Jo();if(e>n)return!1;for(var a=(m,w)=>m+(w-m%w)%w,s=1;s<=4;s*=2){var u=t*(1+.2/s);u=Math.min(u,e+100663296);var d=Math.min(n,a(Math.max(e,u),65536)),f=Qo(d);if(f)return!0}return!1},Ft={},Zo=()=>v||"./this.program",je=()=>{if(!je.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Zo()};for(var n in Ft)Ft[n]===void 0?delete t[n]:t[n]=Ft[n];var a=[];for(var n in t)a.push(`${n}=${t[n]}`);je.strings=a}return je.strings},Ko=(e,t)=>{for(var n=0;n<e.length;++n)k[t++>>0]=e.charCodeAt(n);k[t>>0]=0},ei=(e,t)=>{var n=0;return je().forEach((a,s)=>{var u=t+n;A[e+s*4>>2]=u,Ko(a,u),n+=a.length+1}),0},ti=(e,t)=>{var n=je();A[e>>2]=n.length;var a=0;return n.forEach(s=>a+=s.length+1),A[t>>2]=a,0},ri=e=>e,st=e=>e%4===0&&(e%100!==0||e%400===0),ni=(e,t)=>{for(var n=0,a=0;a<=t;n+=e[a++]);return n},qr=[31,29,31,30,31,30,31,31,30,31,30,31],Nr=[31,28,31,30,31,30,31,31,30,31,30,31],ai=(e,t)=>{for(var n=new Date(e.getTime());t>0;){var a=st(n.getFullYear()),s=n.getMonth(),u=(a?qr:Nr)[s];if(t>u-n.getDate())t-=u-n.getDate()+1,n.setDate(1),s<11?n.setMonth(s+1):(n.setMonth(0),n.setFullYear(n.getFullYear()+1));else return n.setDate(n.getDate()+t),n}return n};function oi(e,t,n){var a=Lr(e)+1,s=new Array(a);return jr(e,s,0,s.length),s}var ii=(e,t)=>{k.set(e,t)},si=(e,t,n,a)=>{var s=A[a+40>>2],u={tm_sec:D[a>>2],tm_min:D[a+4>>2],tm_hour:D[a+8>>2],tm_mday:D[a+12>>2],tm_mon:D[a+16>>2],tm_year:D[a+20>>2],tm_wday:D[a+24>>2],tm_yday:D[a+28>>2],tm_isdst:D[a+32>>2],tm_gmtoff:D[a+36>>2],tm_zone:s?kt(s):""},d=kt(n),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var m in f)d=d.replace(new RegExp(m,"g"),f[m]);var w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],_=["January","February","March","April","May","June","July","August","September","October","November","December"];function T(y,P,z){for(var Y=typeof y=="number"?y.toString():y||"";Y.length<P;)Y=z[0]+Y;return Y}function E(y,P){return T(y,P,"0")}function M(y,P){function z(Oe){return Oe<0?-1:Oe>0?1:0}var Y;return(Y=z(y.getFullYear()-P.getFullYear()))===0&&(Y=z(y.getMonth()-P.getMonth()))===0&&(Y=z(y.getDate()-P.getDate())),Y}function H(y){switch(y.getDay()){case 0:return new Date(y.getFullYear()-1,11,29);case 1:return y;case 2:return new Date(y.getFullYear(),0,3);case 3:return new Date(y.getFullYear(),0,2);case 4:return new Date(y.getFullYear(),0,1);case 5:return new Date(y.getFullYear()-1,11,31);case 6:return new Date(y.getFullYear()-1,11,30)}}function N(y){var P=ai(new Date(y.tm_year+1900,0,1),y.tm_yday),z=new Date(P.getFullYear(),0,4),Y=new Date(P.getFullYear()+1,0,4),Oe=H(z),ut=H(Y);return M(Oe,P)<=0?M(ut,P)<=0?P.getFullYear()+1:P.getFullYear():P.getFullYear()-1}var F={"%a":y=>w[y.tm_wday].substring(0,3),"%A":y=>w[y.tm_wday],"%b":y=>_[y.tm_mon].substring(0,3),"%B":y=>_[y.tm_mon],"%C":y=>{var P=y.tm_year+1900;return E(P/100|0,2)},"%d":y=>E(y.tm_mday,2),"%e":y=>T(y.tm_mday,2," "),"%g":y=>N(y).toString().substring(2),"%G":y=>N(y),"%H":y=>E(y.tm_hour,2),"%I":y=>{var P=y.tm_hour;return P==0?P=12:P>12&&(P-=12),E(P,2)},"%j":y=>E(y.tm_mday+ni(st(y.tm_year+1900)?qr:Nr,y.tm_mon-1),3),"%m":y=>E(y.tm_mon+1,2),"%M":y=>E(y.tm_min,2),"%n":()=>` `,"%p":y=>y.tm_hour>=0&&y.tm_hour<12?"AM":"PM","%S":y=>E(y.tm_sec,2),"%t":()=>" ","%u":y=>y.tm_wday||7,"%U":y=>{var P=y.tm_yday+7-y.tm_wday;return E(Math.floor(P/7),2)},"%V":y=>{var P=Math.floor((y.tm_yday+7-(y.tm_wday+6)%7)/7);if((y.tm_wday+371-y.tm_yday-2)%7<=2&&P++,P){if(P==53){var z=(y.tm_wday+371-y.tm_yday)%7;z!=4&&(z!=3||!st(y.tm_year))&&(P=1)}}else{P=52;var Y=(y.tm_wday+7-y.tm_yday-1)%7;(Y==4||Y==5&&st(y.tm_year%400-1))&&P++}return E(P,2)},"%w":y=>y.tm_wday,"%W":y=>{var P=y.tm_yday+7-(y.tm_wday+6)%7;return E(Math.floor(P/7),2)},"%y":y=>(y.tm_year+1900).toString().substring(2),"%Y":y=>y.tm_year+1900,"%z":y=>{var P=y.tm_gmtoff,z=P>=0;return P=Math.abs(P)/60,P=P/60*100+P%60,(z?"+":"-")+("0000"+P).slice(-4)},"%Z":y=>y.tm_zone,"%%":()=>"%"};d=d.replace(/%%/g,"\0\0");for(var m in F)d.includes(m)&&(d=d.replace(new RegExp(m,"g"),F[m](u)));d=d.replace(/\0\0/g,"%");var Q=oi(d);return Q.length>t?0:(ii(Q,e),Q.length-1)},ci=(e,t,n,a,s)=>si(e,t,n,a);Pr=i.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},xa(),Ee=i.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Na(),Ha(),Ka(),Ir=i.UnboundTypeError=no(Error,"UnboundTypeError"),co(),lo();var ui={s:$a,u:_a,b:Pa,g:Ta,q:Ea,J:Oa,f:Ma,V:Da,d:Sa,da:Aa,Q:Ra,_:Ia,ca:ao,ba:io,w:so,Y:fo,x:po,h:mo,L:yo,M:go,t:bo,o:Co,K:So,C:Ao,A:Ro,ea:xo,$:ko,R:Io,ha:At,fa:Wo,Z:Vo,N:qo,O:No,aa:zo,B:Go,X:Yo,W:Xo,T:ei,U:ti,E:Pi,D:pi,F:Si,n:Ti,a:li,e:vi,m:hi,k:gi,H:$i,v:bi,G:_i,z:Oi,P:Di,l:yi,j:mi,c:fi,p:di,I:Ci,r:Ei,i:wi,y:Mi,ga:ri,S:ci},G=Ca(),de=i._free=e=>(de=i._free=G.ka)(e),Ut=i._malloc=e=>(Ut=i._malloc=G.la)(e),zr=e=>(zr=G.na)(e),L=(e,t)=>(L=G.oa)(e,t),Le=e=>(Le=G.pa)(e),V=()=>(V=G.qa)(),q=e=>(q=G.ra)(e),Gr=e=>(Gr=G.sa)(e),Yr=e=>(Yr=G.ta)(e),Jr=(e,t,n)=>(Jr=G.ua)(e,t,n),Qr=e=>(Qr=G.va)(e);i.dynCall_viijii=(e,t,n,a,s,u,d)=>(i.dynCall_viijii=G.wa)(e,t,n,a,s,u,d);var Xr=i.dynCall_jiiii=(e,t,n,a,s)=>(Xr=i.dynCall_jiiii=G.xa)(e,t,n,a,s);i.dynCall_iiiiij=(e,t,n,a,s,u,d)=>(i.dynCall_iiiiij=G.ya)(e,t,n,a,s,u,d),i.dynCall_iiiiijj=(e,t,n,a,s,u,d,f,m)=>(i.dynCall_iiiiijj=G.za)(e,t,n,a,s,u,d,f,m),i.dynCall_iiiiiijj=(e,t,n,a,s,u,d,f,m,w)=>(i.dynCall_iiiiiijj=G.Aa)(e,t,n,a,s,u,d,f,m,w);function li(e,t){var n=V();try{return B(e)(t)}catch(a){if(q(n),a!==a+0)throw a;L(1,0)}}function di(e,t,n,a){var s=V();try{B(e)(t,n,a)}catch(u){if(q(s),u!==u+0)throw u;L(1,0)}}function fi(e,t,n){var a=V();try{B(e)(t,n)}catch(s){if(q(a),s!==s+0)throw s;L(1,0)}}function hi(e,t,n,a){var s=V();try{return B(e)(t,n,a)}catch(u){if(q(s),u!==u+0)throw u;L(1,0)}}function pi(e,t,n,a,s){var u=V();try{return B(e)(t,n,a,s)}catch(d){if(q(u),d!==d+0)throw d;L(1,0)}}function mi(e,t){var n=V();try{B(e)(t)}catch(a){if(q(n),a!==a+0)throw a;L(1,0)}}function vi(e,t,n){var a=V();try{return B(e)(t,n)}catch(s){if(q(a),s!==s+0)throw s;L(1,0)}}function yi(e){var t=V();try{B(e)()}catch(n){if(q(t),n!==n+0)throw n;L(1,0)}}function gi(e,t,n,a,s){var u=V();try{return B(e)(t,n,a,s)}catch(d){if(q(u),d!==d+0)throw d;L(1,0)}}function wi(e,t,n,a,s,u,d,f,m,w,_){var T=V();try{B(e)(t,n,a,s,u,d,f,m,w,_)}catch(E){if(q(T),E!==E+0)throw E;L(1,0)}}function bi(e,t,n,a,s,u,d){var f=V();try{return B(e)(t,n,a,s,u,d)}catch(m){if(q(f),m!==m+0)throw m;L(1,0)}}function Ci(e,t,n,a,s){var u=V();try{B(e)(t,n,a,s)}catch(d){if(q(u),d!==d+0)throw d;L(1,0)}}function $i(e,t,n,a,s,u){var d=V();try{return B(e)(t,n,a,s,u)}catch(f){if(q(d),f!==f+0)throw f;L(1,0)}}function _i(e,t,n,a,s,u,d,f){var m=V();try{return B(e)(t,n,a,s,u,d,f)}catch(w){if(q(m),w!==w+0)throw w;L(1,0)}}function Si(e,t,n,a){var s=V();try{return B(e)(t,n,a)}catch(u){if(q(s),u!==u+0)throw u;L(1,0)}}function Pi(e,t,n,a){var s=V();try{return B(e)(t,n,a)}catch(u){if(q(s),u!==u+0)throw u;L(1,0)}}function Ti(e){var t=V();try{return B(e)()}catch(n){if(q(t),n!==n+0)throw n;L(1,0)}}function Ei(e,t,n,a,s,u,d,f){var m=V();try{B(e)(t,n,a,s,u,d,f)}catch(w){if(q(m),w!==w+0)throw w;L(1,0)}}function Oi(e,t,n,a,s,u,d,f,m,w,_,T){var E=V();try{return B(e)(t,n,a,s,u,d,f,m,w,_,T)}catch(M){if(q(E),M!==M+0)throw M;L(1,0)}}function Mi(e,t,n,a,s,u,d,f,m,w,_,T,E,M,H,N){var F=V();try{B(e)(t,n,a,s,u,d,f,m,w,_,T,E,M,H,N)}catch(Q){if(q(F),Q!==Q+0)throw Q;L(1,0)}}function Di(e,t,n,a,s){var u=V();try{return Xr(e,t,n,a,s)}catch(d){if(q(u),d!==d+0)throw d;L(1,0)}}var ct;ge=function e(){ct||Zr(),ct||(ge=e)};function Zr(){if(oe>0||(ze(),oe>0))return;function e(){ct||(ct=!0,i.calledRun=!0,!j&&(ht(),c(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),pt()))}i.setStatus?(i.setStatus("Running..."),setTimeout(function(){setTimeout(function(){i.setStatus("")},1),e()},1)):e()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Zr(),o.ready}})();function Mn(r){return dt(Be,r)}function Dn(r){return Tn(Be,r)}async function An(r,o){return En(Be,r,o)}async function Rn(r,o){return On(Be,r,o)}var Me;class De extends EventTarget{constructor(o={}){var i;super(),tn(this,Me,void 0);try{const c=(i=o==null?void 0:o.formats)==null?void 0:i.filter(l=>l!=="unknown");if((c==null?void 0:c.length)===0)throw new TypeError("Hint option provided, but is empty.");c==null||c.forEach(l=>{if(!He.has(l))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${l}' is not a valid enum value of type BarcodeFormat.`)}),rn(this,Me,c!=null?c:[]),Mn().then(l=>{this.dispatchEvent(new CustomEvent("load",{detail:l}))}).catch(l=>{this.dispatchEvent(new CustomEvent("error",{detail:l}))})}catch(c){throw Qt(c,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return nn.filter(o=>o!=="unknown")}async detect(o){try{const i=await dn(o);if(i===null)return[];let c;try{Yt(i)?c=await An(i,{tryHarder:!0,formats:jt(this,Me).map(l=>He.get(l))}):c=await Rn(i,{tryHarder:!0,formats:jt(this,Me).map(l=>He.get(l))})}catch(l){throw console.error(l),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return c.map(l=>{const{topLeft:{x:h,y:v},topRight:{x:g,y:b},bottomLeft:{x:p,y:C},bottomRight:{x:S,y:$}}=l.position,U=Math.min(h,g,p,S),W=Math.min(v,b,C,$),j=Math.max(h,g,p,S),k=Math.max(v,b,C,$);return{boundingBox:new DOMRectReadOnly(U,W,j-U,k-W),rawValue:l.text,format:an(l.format),cornerPoints:[{x:h,y:v},{x:g,y:b},{x:S,y:$},{x:p,y:C}]}})}catch(i){throw Qt(i,"Failed to execute 'detect' on 'BarcodeDetector'")}}}Me=new WeakMap;const ft=(r,o,i="error")=>{let c,l;const h=new Promise((v,g)=>{c=v,l=g,r.addEventListener(o,c),r.addEventListener(i,l)});return h.finally(()=>{r.removeEventListener(o,c),r.removeEventListener(i,l)}),h},tr=r=>new Promise(o=>setTimeout(o,r));class xn extends Error{constructor(){super("can't process cross-origin image"),this.name="DropImageFetchError"}}class rr extends Error{constructor(){super("this browser has no Stream API support"),this.name="StreamApiNotSupportedError"}}class kn extends Error{constructor(){super("camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP."),this.name="InsecureContextError"}}class In extends Error{constructor(){super("Loading camera stream timed out after 6 seconds. If you are on iOS in PWA mode, this is a known issue (see https://github.com/gruhn/vue-qrcode-reader/issues/298)"),this.name="StreamLoadTimeoutError"}}const Fn=r=>{let o=!1,i;return(...c)=>(o||(i=r(c),o=!0),i)};function ne(r,o){if(r===!1)throw new Error(o!=null?o:"assertion failure")}function nr(r){throw new Error("this code should be unreachable")}function Un(){return navigator.platform.toUpperCase().includes("MAC")}let ar;async function Wn(r){if(window.BarcodeDetector===void 0)return console.debug("[vue-qrcode-reader] Native BarcodeDetector not supported. Will use polyfill."),new De({formats:r});const o=await window.BarcodeDetector.getSupportedFormats(),i=r.filter(c=>!o.includes(c));return i.length>0?(console.debug(`[vue-qrcode-reader] Native BarcodeDetector does not support formats ${JSON.stringify(i)}. Will use polyfill.`),new De({formats:r})):Un()&&r.includes("pdf417")?(console.debug("[vue-qrcode-reader] Native BarcodeDetector is buggy for PDF417 codes on MacOS. Will use polyfill."),new De({formats:r})):(console.debug("[vue-qrcode-reader] Will use native BarcodeDetector."),new window.BarcodeDetector({formats:r}))}async function or(r){ar=await Wn(r)}const jn=async(r,{detectHandler:o,locateHandler:i,minDelay:c,formats:l})=>{console.debug("[vue-qrcode-reader] start scanning"),await or(l);const h=v=>async g=>{if(r.readyState===0)console.debug("[vue-qrcode-reader] stop scanning: video element readyState is 0");else{const{lastScanned:b,contentBefore:p,lastScanHadContent:C}=v;if(g-b<c)window.requestAnimationFrame(h(v));else{const S=await ar.detect(r),$=S.some(j=>!p.includes(j.rawValue));$&&o(S);const U=S.length>0;U&&i(S),!U&&C&&i(S);const W={lastScanned:g,lastScanHadContent:U,contentBefore:$?S.map(j=>j.rawValue):p};window.requestAnimationFrame(h(W))}}};h({lastScanned:performance.now(),contentBefore:[],lastScanHadContent:!1})(performance.now())},Ln=async r=>{if(r.startsWith("http")&&r.includes(location.host)===!1)throw new xn;const o=document.createElement("img");return o.src=r,await ft(o,"load"),o},ir=async(r,o=["qr_code"])=>await new De({formats:o}).detect(r),Hn=async(r,o=["qr_code"])=>{const i=new De({formats:o}),c=await Ln(r);return await i.detect(c)};var sr={},X={};Object.defineProperty(X,"__esModule",{value:!0}),X.compactObject=dr,X.deprecated=Qn;var Bn=X.detectBrowser=Xn;X.disableLog=Gn,X.disableWarnings=Yn,X.extractVersion=Ve,X.filterStats=Zn,X.log=Jn,X.walkStats=qe,X.wrapPeerConnectionEvent=zn;function Vn(r,o,i){return o=qn(o),o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i,r}function qn(r){var o=Nn(r,"string");return fe(o)==="symbol"?o:String(o)}function Nn(r,o){if(fe(r)!=="object"||r===null)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var c=i.call(r,o);if(fe(c)!=="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(r)}function fe(r){"@babel/helpers - typeof";return fe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},fe(r)}var cr=!0,ur=!0;function Ve(r,o,i){var c=r.match(o);return c&&c.length>=i&&parseInt(c[i],10)}function zn(r,o,i){if(r.RTCPeerConnection){var c=r.RTCPeerConnection.prototype,l=c.addEventListener;c.addEventListener=function(v,g){if(v!==o)return l.apply(this,arguments);var b=function(C){var S=i(C);S&&(g.handleEvent?g.handleEvent(S):g(S))};return this._eventMap=this._eventMap||{},this._eventMap[o]||(this._eventMap[o]=new Map),this._eventMap[o].set(g,b),l.apply(this,[v,b])};var h=c.removeEventListener;c.removeEventListener=function(v,g){if(v!==o||!this._eventMap||!this._eventMap[o])return h.apply(this,arguments);if(!this._eventMap[o].has(g))return h.apply(this,arguments);var b=this._eventMap