UNPKG

zwave-js-ui

Version:

Z-Wave Control Panel and MQTT Gateway

3 lines 64.1 kB
import{z as ni,_ as ai,L as ii,J as oi,o as Qe,c as vt,b as E,w as R,aW as gt,k as te,i as ze,aX as si,aY as yt,N as wt,O as $t,Q as li,R as ci,U as Ne,af as ui,h as dr,p as ve,q as hr,a1 as di,aZ as hi,f as fi,n as pi,a0 as mi,e as vi,W as gi,at as yi,a_ as wi,l as $i,t as Ci,X as _i}from"./index-B9yS4Bcc.js";var vr=i=>{throw TypeError(i)},gr=(i,n,l)=>n.has(i)||vr("Cannot "+l),bi=(i,n,l)=>(gr(i,n,"read from private field"),l?l.call(i):n.get(i)),Ti=(i,n,l)=>n.has(i)?vr("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(i):n.set(i,l),Si=(i,n,l,h)=>(gr(i,n,"write to private field"),n.set(i,l),l);const fr=["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 Ei(i){return i.join("|")}function Pi(i){const n=pr(i);let l=0,h=fr.length-1;for(;l<=h;){const o=Math.floor((l+h)/2),v=fr[o],g=pr(v);if(g===n)return v;g<n?l=o+1:h=o-1}return"None"}function pr(i){return i.toLowerCase().replace(/_-\[\]/g,"")}function Oi(i,n){return i.Binarizer[n]}function Ri(i,n){return i.CharacterSet[n]}const Di=["Text","Binary","Mixed","GS1","ISO15434","UnknownECI"];function xi(i){return Di[i.value]}function Ai(i,n){return i.EanAddOnSymbol[n]}function Mi(i,n){return i.TextMode[n]}const ge={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 yr(i,n){return{...n,formats:Ei(n.formats),binarizer:Oi(i,n.binarizer),eanAddOnSymbol:Ai(i,n.eanAddOnSymbol),textMode:Mi(i,n.textMode),characterSet:Ri(i,n.characterSet)}}function wr(i){return{...i,format:Pi(i.format),eccLevel:i.eccLevel,contentType:xi(i.contentType)}}const Vi={locateFile:(i,n)=>{const l=i.match(/_(.+?)\.wasm$/);return l?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.2.14/dist/${l[1]}/${i}`:n+i}};let Ct=new WeakMap;function bt(i,n){var l;const h=Ct.get(i);if(h!=null&&h.modulePromise&&n===void 0)return h.modulePromise;const o=(l=h==null?void 0:h.moduleOverrides)!=null?l:Vi,v=i({...o});return Ct.set(i,{moduleOverrides:o,modulePromise:v}),v}function Fi(i,n){Ct.set(i,{moduleOverrides:n})}async function Ii(i,n,l=ge){const h={...ge,...l},o=await bt(i),{size:v}=n,g=new Uint8Array(await n.arrayBuffer()),P=o._malloc(v);o.HEAPU8.set(g,P);const A=o.readBarcodesFromImage(P,v,yr(o,h));o._free(P);const D=[];for(let _=0;_<A.size();++_)D.push(wr(A.get(_)));return D}async function ji(i,n,l=ge){const h={...ge,...l},o=await bt(i),{data:v,width:g,height:P,data:{byteLength:A}}=n,D=o._malloc(A);o.HEAPU8.set(v,D);const _=o.readBarcodesFromPixmap(D,g,P,yr(o,h));o._free(D);const L=[];for(let $=0;$<_.size();++$)L.push(wr(_.get($)));return L}({...ge,formats:[...ge.formats]});var Ye=(()=>{var i,n=typeof document<"u"&&((i=document.currentScript)==null?void 0:i.tagName.toUpperCase())==="SCRIPT"?document.currentScript.src:void 0;return function(l={}){var h,o=l,v,g,P=new Promise((e,t)=>{v=e,g=t}),A=typeof window=="object",D=typeof Bun<"u",_=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var L=Object.assign({},o),$="./this.program",b="";function K(e){return o.locateFile?o.locateFile(e,b):b+e}var X,N;if(A||_||D){var Q;_?b=self.location.href:typeof document<"u"&&((Q=document.currentScript)===null||Q===void 0?void 0:Q.tagName.toUpperCase())==="SCRIPT"&&(b=document.currentScript.src),n&&(b=n),b.startsWith("blob:")?b="":b=b.substr(0,b.replace(/[?#].*/,"").lastIndexOf("/")+1),_&&(N=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),X=e=>fetch(e,{credentials:"same-origin"}).then(t=>t.ok?t.arrayBuffer():Promise.reject(new Error(t.status+" : "+t.url)))}var he=o.print||console.log.bind(console),G=o.printErr||console.error.bind(console);Object.assign(o,L),L=null,o.arguments&&o.arguments,o.thisProgram&&($=o.thisProgram);var z=o.wasmBinary,Oe,Tt=!1,J,q,fe,ye,se,O,St,Et;function Pt(){var e=Oe.buffer;o.HEAP8=J=new Int8Array(e),o.HEAP16=fe=new Int16Array(e),o.HEAPU8=q=new Uint8Array(e),o.HEAPU16=ye=new Uint16Array(e),o.HEAP32=se=new Int32Array(e),o.HEAPU32=O=new Uint32Array(e),o.HEAPF32=St=new Float32Array(e),o.HEAPF64=Et=new Float64Array(e)}var Ot=[],Rt=[],Dt=[];function Dr(){if(o.preRun)for(typeof o.preRun=="function"&&(o.preRun=[o.preRun]);o.preRun.length;)Mr(o.preRun.shift());Ke(Ot)}function xr(){Ke(Rt)}function Ar(){if(o.postRun)for(typeof o.postRun=="function"&&(o.postRun=[o.postRun]);o.postRun.length;)Fr(o.postRun.shift());Ke(Dt)}function Mr(e){Ot.unshift(e)}function Vr(e){Rt.unshift(e)}function Fr(e){Dt.unshift(e)}var le=0,we=null;function Ir(e){var t;le++,(t=o.monitorRunDependencies)===null||t===void 0||t.call(o,le)}function jr(e){var t;if(le--,(t=o.monitorRunDependencies)===null||t===void 0||t.call(o,le),le==0&&we){var r=we;we=null,r()}}function Ze(e){var t;(t=o.onAbort)===null||t===void 0||t.call(o,e),e="Aborted("+e+")",G(e),Tt=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw g(r),r}var Wr="data:application/octet-stream;base64,",xt=e=>e.startsWith(Wr);function kr(){var e="zxing_reader.wasm";return xt(e)?e:K(e)}var Re;function At(e){if(e==Re&&z)return new Uint8Array(z);if(N)return N(e);throw"both async and sync fetching of the wasm failed"}function Lr(e){return z?Promise.resolve().then(()=>At(e)):X(e).then(t=>new Uint8Array(t),()=>At(e))}function Mt(e,t,r){return Lr(e).then(a=>WebAssembly.instantiate(a,t)).then(r,a=>{G(`failed to asynchronously prepare wasm: ${a}`),Ze(a)})}function Hr(e,t,r,a){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!xt(t)&&typeof fetch=="function"?fetch(t,{credentials:"same-origin"}).then(s=>{var c=WebAssembly.instantiateStreaming(s,r);return c.then(a,function(d){return G(`wasm streaming compile failed: ${d}`),G("falling back to ArrayBuffer instantiation"),Mt(t,r,a)})}):Mt(t,r,a)}function Ur(){return{a:Va}}function qr(){var e,t=Ur();function r(s,c){return F=s.exports,Oe=F.ma,Pt(),Ut=F.qa,Vr(F.na),jr(),F}Ir();function a(s){r(s.instance)}if(o.instantiateWasm)try{return o.instantiateWasm(t,r)}catch(s){G(`Module.instantiateWasm callback failed with error: ${s}`),g(s)}return(e=Re)!==null&&e!==void 0||(Re=kr()),Hr(z,Re,t,a).catch(g),{}}var Ke=e=>{for(;e.length>0;)e.shift()(o)};o.noExitRuntime;var I=e=>Jt(e),j=()=>er(),De=[],xe=0,Br=e=>{var t=new Je(e);return t.get_caught()||(t.set_caught(!0),xe--),t.set_rethrown(!1),De.push(t),rr(e),ar(e)},re=0,Qr=()=>{M(0,0);var e=De.pop();tr(e.excPtr),re=0};class Je{constructor(t){this.excPtr=t,this.ptr=t-24}set_type(t){O[this.ptr+4>>2]=t}get_type(){return O[this.ptr+4>>2]}set_destructor(t){O[this.ptr+8>>2]=t}get_destructor(){return O[this.ptr+8>>2]}set_caught(t){t=t?1:0,J[this.ptr+12]=t}get_caught(){return J[this.ptr+12]!=0}set_rethrown(t){t=t?1:0,J[this.ptr+13]=t}get_rethrown(){return J[this.ptr+13]!=0}init(t,r){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(r)}set_adjusted_ptr(t){O[this.ptr+16>>2]=t}get_adjusted_ptr(){return O[this.ptr+16>>2]}}var zr=e=>{throw re||(re=e),re},Ae=e=>Kt(e),et=e=>{var t=re;if(!t)return Ae(0),0;var r=new Je(t);r.set_adjusted_ptr(t);var a=r.get_type();if(!a)return Ae(0),t;for(var s of e){if(s===0||s===a)break;var c=r.ptr+16;if(nr(s,a,c))return Ae(s),t}return Ae(a),t},Nr=()=>et([]),Gr=e=>et([e]),Xr=(e,t)=>et([e,t]),Yr=()=>{var e=De.pop();e||Ze("no exception to throw");var t=e.excPtr;throw e.get_rethrown()||(De.push(e),e.set_rethrown(!0),e.set_caught(!1),xe++),re=t,re},Zr=(e,t,r)=>{var a=new Je(e);throw a.init(t,r),re=e,xe++,re},Kr=()=>xe,Jr=()=>{Ze("")},Me={},tt=e=>{for(;e.length;){var t=e.pop(),r=e.pop();r(t)}};function $e(e){return this.fromWireType(O[e>>2])}var pe={},ce={},Ve={},Vt,Fe=e=>{throw new Vt(e)},ue=(e,t,r)=>{e.forEach(u=>Ve[u]=t);function a(u){var f=r(u);f.length!==e.length&&Fe("Mismatched type converter count");for(var p=0;p<e.length;++p)Y(e[p],f[p])}var s=new Array(t.length),c=[],d=0;t.forEach((u,f)=>{ce.hasOwnProperty(u)?s[f]=ce[u]:(c.push(u),pe.hasOwnProperty(u)||(pe[u]=[]),pe[u].push(()=>{s[f]=ce[u],++d,d===c.length&&a(s)}))}),c.length===0&&a(s)},en=e=>{var t=Me[e];delete Me[e];var r=t.rawConstructor,a=t.rawDestructor,s=t.fields,c=s.map(d=>d.getterReturnType).concat(s.map(d=>d.setterArgumentType));ue([e],c,d=>{var u={};return s.forEach((f,p)=>{var m=f.fieldName,y=d[p],C=f.getter,S=f.getterContext,x=d[p+s.length],H=f.setter,W=f.setterContext;u[m]={read:k=>y.fromWireType(C(S,k)),write:(k,de)=>{var B=[];H(W,k,x.toWireType(B,de)),tt(B)}}}),[{name:t.name,fromWireType:f=>{var p={};for(var m in u)p[m]=u[m].read(f);return a(f),p},toWireType:(f,p)=>{for(var m in u)if(!(m in p))throw new TypeError(`Missing field: "${m}"`);var y=r();for(m in u)u[m].write(y,p[m]);return f!==null&&f.push(a,y),y},argPackAdvance:ee,readValueFromPointer:$e,destructorFunction:a}]})},tn=(e,t,r,a,s)=>{},rn=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Ft=e},Ft,U=e=>{for(var t="",r=e;q[r];)t+=Ft[q[r++]];return t},me,T=e=>{throw new me(e)};function nn(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var a=t.name;if(e||T(`type "${a}" must have a positive integer typeid pointer`),ce.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;T(`Cannot register type '${a}' twice`)}if(ce[e]=t,delete Ve[e],pe.hasOwnProperty(e)){var s=pe[e];delete pe[e],s.forEach(c=>c())}}function Y(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return nn(e,t,r)}var ee=8,an=(e,t,r,a)=>{t=U(t),Y(e,{name:t,fromWireType:function(s){return!!s},toWireType:function(s,c){return c?r:a},argPackAdvance:ee,readValueFromPointer:function(s){return this.fromWireType(q[s])},destructorFunction:null})},on=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),rt=e=>{function t(r){return r.$$.ptrType.registeredClass.name}T(t(e)+" instance already deleted")},nt=!1,It=e=>{},sn=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},jt=e=>{e.count.value-=1;var t=e.count.value===0;t&&sn(e)},Wt=(e,t,r)=>{if(t===r)return e;if(r.baseClass===void 0)return null;var a=Wt(e,t,r.baseClass);return a===null?null:r.downcast(a)},kt={},ln=()=>Object.keys(be).length,cn=()=>{var e=[];for(var t in be)be.hasOwnProperty(t)&&e.push(be[t]);return e},Ce=[],at=()=>{for(;Ce.length;){var e=Ce.pop();e.$$.deleteScheduled=!1,e.delete()}},_e,un=e=>{_e=e,Ce.length&&_e&&_e(at)},dn=()=>{o.getInheritedInstanceCount=ln,o.getLiveInheritedInstances=cn,o.flushPendingDeletes=at,o.setDelayFunction=un},be={},hn=(e,t)=>{for(t===void 0&&T("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},fn=(e,t)=>(t=hn(e,t),be[t]),Ie=(e,t)=>{(!t.ptrType||!t.ptr)&&Fe("makeClassHandle requires ptr and ptrType");var r=!!t.smartPtrType,a=!!t.smartPtr;return r!==a&&Fe("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Te(Object.create(e,{$$:{value:t,writable:!0}}))};function pn(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=fn(this.registeredClass,t);if(r!==void 0){if(r.$$.count.value===0)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var a=r.clone();return this.destructor(e),a}function s(){return this.isSmartPointer?Ie(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Ie(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var c=this.registeredClass.getActualType(t),d=kt[c];if(!d)return s.call(this);var u;this.isConst?u=d.constPointerType:u=d.pointerType;var f=Wt(t,this.registeredClass,u.registeredClass);return f===null?s.call(this):this.isSmartPointer?Ie(u.registeredClass.instancePrototype,{ptrType:u,ptr:f,smartPtrType:this,smartPtr:e}):Ie(u.registeredClass.instancePrototype,{ptrType:u,ptr:f})}var Te=e=>typeof FinalizationRegistry>"u"?(Te=t=>t,e):(nt=new FinalizationRegistry(t=>{jt(t.$$)}),Te=t=>{var r=t.$$,a=!!r.smartPtr;if(a){var s={$$:r};nt.register(t,s,t)}return t},It=t=>nt.unregister(t),Te(e)),mn=()=>{Object.assign(je.prototype,{isAliasOf(e){if(!(this instanceof je)||!(e instanceof je))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var a=e.$$.ptrType.registeredClass,s=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;a.baseClass;)s=a.upcast(s),a=a.baseClass;return t===a&&r===s},clone(){if(this.$$.ptr||rt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Te(Object.create(Object.getPrototypeOf(this),{$$:{value:on(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||rt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&T("Object already scheduled for deletion"),It(this),jt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||rt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&T("Object already scheduled for deletion"),Ce.push(this),Ce.length===1&&_e&&_e(at),this.$$.deleteScheduled=!0,this}})};function je(){}var Se=(e,t)=>Object.defineProperty(t,"name",{value:e}),Lt=(e,t,r)=>{if(e[t].overloadTable===void 0){var a=e[t];e[t]=function(){for(var s=arguments.length,c=new Array(s),d=0;d<s;d++)c[d]=arguments[d];return e[t].overloadTable.hasOwnProperty(c.length)||T(`Function '${r}' called with an invalid number of arguments (${c.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[c.length].apply(this,c)},e[t].overloadTable=[],e[t].overloadTable[a.argCount]=a}},it=(e,t,r)=>{o.hasOwnProperty(e)?((r===void 0||o[e].overloadTable!==void 0&&o[e].overloadTable[r]!==void 0)&&T(`Cannot register public name '${e}' twice`),Lt(o,e,e),o.hasOwnProperty(r)&&T(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),o[e].overloadTable[r]=t):(o[e]=t,r!==void 0&&(o[e].numArguments=r))},vn=48,gn=57,yn=e=>{if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=vn&&t<=gn?`_${e}`:e};function wn(e,t,r,a,s,c,d,u){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=a,this.baseClass=s,this.getActualType=c,this.upcast=d,this.downcast=u,this.pureVirtualFunctions=[]}var ot=(e,t,r)=>{for(;t!==r;)t.upcast||T(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function $n(e,t){if(t===null)return this.isReference&&T(`null is not a valid ${this.name}`),0;t.$$||T(`Cannot pass "${ht(t)}" as a ${this.name}`),t.$$.ptr||T(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass,a=ot(t.$$.ptr,r,this.registeredClass);return a}function Cn(e,t){var r;if(t===null)return this.isReference&&T(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,r),r):0;(!t||!t.$$)&&T(`Cannot pass "${ht(t)}" as a ${this.name}`),t.$$.ptr||T(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&T(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var a=t.$$.ptrType.registeredClass;if(r=ot(t.$$.ptr,a,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&T("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:T(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var s=t.clone();r=this.rawShare(r,ae.toHandle(()=>s.delete())),e!==null&&e.push(this.rawDestructor,r)}break;default:T("Unsupporting sharing policy")}return r}function _n(e,t){if(t===null)return this.isReference&&T(`null is not a valid ${this.name}`),0;t.$$||T(`Cannot pass "${ht(t)}" as a ${this.name}`),t.$$.ptr||T(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&T(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass,a=ot(t.$$.ptr,r,this.registeredClass);return a}var bn=()=>{Object.assign(We.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:ee,readValueFromPointer:$e,fromWireType:pn})};function We(e,t,r,a,s,c,d,u,f,p,m){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=a,this.isSmartPointer=s,this.pointeeType=c,this.sharingPolicy=d,this.rawGetPointee=u,this.rawConstructor=f,this.rawShare=p,this.rawDestructor=m,!s&&t.baseClass===void 0?a?(this.toWireType=$n,this.destructorFunction=null):(this.toWireType=_n,this.destructorFunction=null):this.toWireType=Cn}var Ht=(e,t,r)=>{o.hasOwnProperty(e)||Fe("Replacing nonexistent public symbol"),o[e].overloadTable!==void 0&&r!==void 0?o[e].overloadTable[r]=t:(o[e]=t,o[e].argCount=r)},Tn=(e,t,r)=>{e=e.replace(/p/g,"i");var a=o["dynCall_"+e];return a(t,...r)},ke=[],Ut,V=e=>{var t=ke[e];return t||(e>=ke.length&&(ke.length=e+1),ke[e]=t=Ut.get(e)),t},Sn=function(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(e.includes("j"))return Tn(e,t,r);var a=V(t)(...r);return a},En=(e,t)=>function(){for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return Sn(e,t,a)},Z=(e,t)=>{e=U(e);function r(){return e.includes("j")?En(e,t):V(t)}var a=r();return typeof a!="function"&&T(`unknown function pointer with signature ${e}: ${t}`),a},Pn=(e,t)=>{var r=Se(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 r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},r},qt,Bt=e=>{var t=Zt(e),r=U(t);return ie(t),r},Le=(e,t)=>{var r=[],a={};function s(c){if(!a[c]&&!ce[c]){if(Ve[c]){Ve[c].forEach(s);return}r.push(c),a[c]=!0}}throw t.forEach(s),new qt(`${e}: `+r.map(Bt).join([", "]))},On=(e,t,r,a,s,c,d,u,f,p,m,y,C)=>{m=U(m),c=Z(s,c),u&&(u=Z(d,u)),p&&(p=Z(f,p)),C=Z(y,C);var S=yn(m);it(S,function(){Le(`Cannot construct ${m} due to unbound types`,[a])}),ue([e,t,r],a?[a]:[],x=>{x=x[0];var H,W;a?(H=x.registeredClass,W=H.instancePrototype):W=je.prototype;var k=Se(m,function(){if(Object.getPrototypeOf(this)!==de)throw new me("Use 'new' to construct "+m);if(B.constructor_body===void 0)throw new me(m+" has no accessible constructor");for(var cr=arguments.length,qe=new Array(cr),Be=0;Be<cr;Be++)qe[Be]=arguments[Be];var ur=B.constructor_body[qe.length];if(ur===void 0)throw new me(`Tried to invoke ctor of ${m} with invalid number of parameters (${qe.length}) - expected (${Object.keys(B.constructor_body).toString()}) parameters instead!`);return ur.apply(this,qe)}),de=Object.create(W,{constructor:{value:k}});k.prototype=de;var B=new wn(m,k,de,C,H,c,u,p);if(B.baseClass){var oe,Ue;(Ue=(oe=B.baseClass).__derivedClasses)!==null&&Ue!==void 0||(oe.__derivedClasses=[]),B.baseClass.__derivedClasses.push(B)}var ri=new We(m,B,!0,!1,!1),sr=new We(m+"*",B,!1,!1,!1),lr=new We(m+" const*",B,!1,!0,!1);return kt[e]={pointerType:sr,constPointerType:lr},Ht(S,k),[ri,sr,lr]})},st=(e,t)=>{for(var r=[],a=0;a<e;a++)r.push(O[t+a*4>>2]);return r};function Rn(e){for(var t=1;t<e.length;++t)if(e[t]!==null&&e[t].destructorFunction===void 0)return!0;return!1}function lt(e,t,r,a,s,c){var d=t.length;d<2&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");var u=t[1]!==null&&r!==null,f=Rn(t),p=t[0].name!=="void",m=d-2,y=new Array(m),C=[],S=[],x=function(){S.length=0;var H;C.length=u?2:1,C[0]=s,u&&(H=t[1].toWireType(S,this),C[1]=H);for(var W=0;W<m;++W)y[W]=t[W+2].toWireType(S,W<0||arguments.length<=W?void 0:arguments[W]),C.push(y[W]);var k=a(...C);function de(B){if(f)tt(S);else for(var oe=u?1:2;oe<t.length;oe++){var Ue=oe===1?H:y[oe-2];t[oe].destructorFunction!==null&&t[oe].destructorFunction(Ue)}if(p)return t[0].fromWireType(B)}return de(k)};return Se(e,x)}var Dn=(e,t,r,a,s,c)=>{var d=st(t,r);s=Z(a,s),ue([],[e],u=>{u=u[0];var f=`constructor ${u.name}`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[t-1]!==void 0)throw new me(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return u.registeredClass.constructor_body[t-1]=()=>{Le(`Cannot construct ${u.name} due to unbound types`,d)},ue([],d,p=>(p.splice(1,0,null),u.registeredClass.constructor_body[t-1]=lt(f,p,null,s,c),[])),[]})},Qt=e=>{e=e.trim();const t=e.indexOf("(");return t!==-1?e.substr(0,t):e},xn=(e,t,r,a,s,c,d,u,f,p)=>{var m=st(r,a);t=U(t),t=Qt(t),c=Z(s,c),ue([],[e],y=>{y=y[0];var C=`${y.name}.${t}`;t.startsWith("@@")&&(t=Symbol[t.substring(2)]),u&&y.registeredClass.pureVirtualFunctions.push(t);function S(){Le(`Cannot call ${C} due to unbound types`,m)}var x=y.registeredClass.instancePrototype,H=x[t];return H===void 0||H.overloadTable===void 0&&H.className!==y.name&&H.argCount===r-2?(S.argCount=r-2,S.className=y.name,x[t]=S):(Lt(x,t,C),x[t].overloadTable[r-2]=S),ue([],m,W=>{var k=lt(C,W,y,c,d);return x[t].overloadTable===void 0?(k.argCount=r-2,x[t]=k):x[t].overloadTable[r-2]=k,[]}),[]})},ct=[],ne=[],ut=e=>{e>9&&--ne[e+1]===0&&(ne[e]=void 0,ct.push(e))},An=()=>ne.length/2-5-ct.length,Mn=()=>{ne.push(0,1,void 0,1,null,1,!0,1,!1,1),o.count_emval_handles=An},ae={toValue:e=>(e||T("Cannot use deleted val. handle = "+e),ne[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const t=ct.pop()||ne.length;return ne[t]=e,ne[t+1]=1,t}}}},zt={name:"emscripten::val",fromWireType:e=>{var t=ae.toValue(e);return ut(e),t},toWireType:(e,t)=>ae.toHandle(t),argPackAdvance:ee,readValueFromPointer:$e,destructorFunction:null},Vn=e=>Y(e,zt),Fn=(e,t,r)=>{switch(t){case 1:return r?function(a){return this.fromWireType(J[a])}:function(a){return this.fromWireType(q[a])};case 2:return r?function(a){return this.fromWireType(fe[a>>1])}:function(a){return this.fromWireType(ye[a>>1])};case 4:return r?function(a){return this.fromWireType(se[a>>2])}:function(a){return this.fromWireType(O[a>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},In=(e,t,r,a)=>{t=U(t);function s(){}s.values={},Y(e,{name:t,constructor:s,fromWireType:function(c){return this.constructor.values[c]},toWireType:(c,d)=>d.value,argPackAdvance:ee,readValueFromPointer:Fn(t,r,a),destructorFunction:null}),it(t,s)},dt=(e,t)=>{var r=ce[e];return r===void 0&&T(`${t} has unknown type ${Bt(e)}`),r},jn=(e,t,r)=>{var a=dt(e,"enum");t=U(t);var s=a.constructor,c=Object.create(a.constructor.prototype,{value:{value:r},constructor:{value:Se(`${a.name}_${t}`,function(){})}});s.values[r]=c,s[t]=c},ht=e=>{if(e===null)return"null";var t=typeof e;return t==="object"||t==="array"||t==="function"?e.toString():""+e},Wn=(e,t)=>{switch(t){case 4:return function(r){return this.fromWireType(St[r>>2])};case 8:return function(r){return this.fromWireType(Et[r>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},kn=(e,t,r)=>{t=U(t),Y(e,{name:t,fromWireType:a=>a,toWireType:(a,s)=>s,argPackAdvance:ee,readValueFromPointer:Wn(t,r),destructorFunction:null})},Ln=(e,t,r,a,s,c,d,u)=>{var f=st(t,r);e=U(e),e=Qt(e),s=Z(a,s),it(e,function(){Le(`Cannot call ${e} due to unbound types`,f)},t-1),ue([],f,p=>{var m=[p[0],null].concat(p.slice(1));return Ht(e,lt(e,m,null,s,c),t-1),[]})},Hn=(e,t,r)=>{switch(t){case 1:return r?a=>J[a]:a=>q[a];case 2:return r?a=>fe[a>>1]:a=>ye[a>>1];case 4:return r?a=>se[a>>2]:a=>O[a>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Un=(e,t,r,a,s)=>{t=U(t);var c=m=>m;if(a===0){var d=32-8*r;c=m=>m<<d>>>d}var u=t.includes("unsigned"),f=(m,y)=>{},p;u?p=function(m,y){return f(y,this.name),y>>>0}:p=function(m,y){return f(y,this.name),y},Y(e,{name:t,fromWireType:c,toWireType:p,argPackAdvance:ee,readValueFromPointer:Hn(t,r,a!==0),destructorFunction:null})},qn=(e,t,r)=>{var a=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],s=a[t];function c(d){var u=O[d>>2],f=O[d+4>>2];return new s(J.buffer,f,u)}r=U(r),Y(e,{name:r,fromWireType:c,argPackAdvance:ee,readValueFromPointer:c},{ignoreDuplicateRegistrations:!0})},Bn=Object.assign({optional:!0},zt),Qn=(e,t)=>{Y(e,Bn)},zn=(e,t,r,a)=>{if(!(a>0))return 0;for(var s=r,c=r+a-1,d=0;d<e.length;++d){var u=e.charCodeAt(d);if(u>=55296&&u<=57343){var f=e.charCodeAt(++d);u=65536+((u&1023)<<10)|f&1023}if(u<=127){if(r>=c)break;t[r++]=u}else if(u<=2047){if(r+1>=c)break;t[r++]=192|u>>6,t[r++]=128|u&63}else if(u<=65535){if(r+2>=c)break;t[r++]=224|u>>12,t[r++]=128|u>>6&63,t[r++]=128|u&63}else{if(r+3>=c)break;t[r++]=240|u>>18,t[r++]=128|u>>12&63,t[r++]=128|u>>6&63,t[r++]=128|u&63}}return t[r]=0,r-s},Ee=(e,t,r)=>zn(e,q,t,r),Nn=e=>{for(var t=0,r=0;r<e.length;++r){var a=e.charCodeAt(r);a<=127?t++:a<=2047?t+=2:a>=55296&&a<=57343?(t+=4,++r):t+=3}return t},Nt=typeof TextDecoder<"u"?new TextDecoder:void 0,Gt=(e,t,r)=>{for(var a=t+r,s=t;e[s]&&!(s>=a);)++s;if(s-t>16&&e.buffer&&Nt)return Nt.decode(e.subarray(t,s));for(var c="";t<s;){var d=e[t++];if(!(d&128)){c+=String.fromCharCode(d);continue}var u=e[t++]&63;if((d&224)==192){c+=String.fromCharCode((d&31)<<6|u);continue}var f=e[t++]&63;if((d&240)==224?d=(d&15)<<12|u<<6|f:d=(d&7)<<18|u<<12|f<<6|e[t++]&63,d<65536)c+=String.fromCharCode(d);else{var p=d-65536;c+=String.fromCharCode(55296|p>>10,56320|p&1023)}}return c},Gn=(e,t)=>e?Gt(q,e,t):"",Xn=(e,t)=>{t=U(t);var r=t==="std::string";Y(e,{name:t,fromWireType(a){var s=O[a>>2],c=a+4,d;if(r)for(var u=c,f=0;f<=s;++f){var p=c+f;if(f==s||q[p]==0){var m=p-u,y=Gn(u,m);d===void 0?d=y:(d+="\0",d+=y),u=p+1}}else{for(var C=new Array(s),f=0;f<s;++f)C[f]=String.fromCharCode(q[c+f]);d=C.join("")}return ie(a),d},toWireType(a,s){s instanceof ArrayBuffer&&(s=new Uint8Array(s));var c,d=typeof s=="string";d||s instanceof Uint8Array||s instanceof Uint8ClampedArray||s instanceof Int8Array||T("Cannot pass non-string to std::string"),r&&d?c=Nn(s):c=s.length;var u=mt(4+c+1),f=u+4;if(O[u>>2]=c,r&&d)Ee(s,f,c+1);else if(d)for(var p=0;p<c;++p){var m=s.charCodeAt(p);m>255&&(ie(f),T("String has UTF-16 code units that do not fit in 8 bits")),q[f+p]=m}else for(var p=0;p<c;++p)q[f+p]=s[p];return a!==null&&a.push(ie,u),u},argPackAdvance:ee,readValueFromPointer:$e,destructorFunction(a){ie(a)}})},Xt=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,Yn=(e,t)=>{for(var r=e,a=r>>1,s=a+t/2;!(a>=s)&&ye[a];)++a;if(r=a<<1,r-e>32&&Xt)return Xt.decode(q.subarray(e,r));for(var c="",d=0;!(d>=t/2);++d){var u=fe[e+d*2>>1];if(u==0)break;c+=String.fromCharCode(u)}return c},Zn=(e,t,r)=>{var a;if((a=r)!==null&&a!==void 0||(r=2147483647),r<2)return 0;r-=2;for(var s=t,c=r<e.length*2?r/2:e.length,d=0;d<c;++d){var u=e.charCodeAt(d);fe[t>>1]=u,t+=2}return fe[t>>1]=0,t-s},Kn=e=>e.length*2,Jn=(e,t)=>{for(var r=0,a="";!(r>=t/4);){var s=se[e+r*4>>2];if(s==0)break;if(++r,s>=65536){var c=s-65536;a+=String.fromCharCode(55296|c>>10,56320|c&1023)}else a+=String.fromCharCode(s)}return a},ea=(e,t,r)=>{var a;if((a=r)!==null&&a!==void 0||(r=2147483647),r<4)return 0;for(var s=t,c=s+r-4,d=0;d<e.length;++d){var u=e.charCodeAt(d);if(u>=55296&&u<=57343){var f=e.charCodeAt(++d);u=65536+((u&1023)<<10)|f&1023}if(se[t>>2]=u,t+=4,t+4>c)break}return se[t>>2]=0,t-s},ta=e=>{for(var t=0,r=0;r<e.length;++r){var a=e.charCodeAt(r);a>=55296&&a<=57343&&++r,t+=4}return t},ra=(e,t,r)=>{r=U(r);var a,s,c,d;t===2?(a=Yn,s=Zn,d=Kn,c=u=>ye[u>>1]):t===4&&(a=Jn,s=ea,d=ta,c=u=>O[u>>2]),Y(e,{name:r,fromWireType:u=>{for(var f=O[u>>2],p,m=u+4,y=0;y<=f;++y){var C=u+4+y*t;if(y==f||c(C)==0){var S=C-m,x=a(m,S);p===void 0?p=x:(p+="\0",p+=x),m=C+t}}return ie(u),p},toWireType:(u,f)=>{typeof f!="string"&&T(`Cannot pass non-string to C++ string type ${r}`);var p=d(f),m=mt(4+p+t);return O[m>>2]=p/t,s(f,m+4,p+t),u!==null&&u.push(ie,m),m},argPackAdvance:ee,readValueFromPointer:$e,destructorFunction(u){ie(u)}})},na=(e,t,r,a,s,c)=>{Me[e]={name:U(t),rawConstructor:Z(r,a),rawDestructor:Z(s,c),fields:[]}},aa=(e,t,r,a,s,c,d,u,f,p)=>{Me[e].fields.push({fieldName:U(t),getterReturnType:r,getter:Z(a,s),getterContext:c,setterArgumentType:d,setter:Z(u,f),setterContext:p})},ia=(e,t)=>{t=U(t),Y(e,{isVoid:!0,name:t,argPackAdvance:0,fromWireType:()=>{},toWireType:(r,a)=>{}})},oa=(e,t,r)=>q.copyWithin(e,t,t+r),ft=[],sa=(e,t,r,a)=>(e=ft[e],t=ae.toValue(t),e(null,t,r,a)),la={},ca=e=>{var t=la[e];return t===void 0?U(e):t},Yt=()=>{if(typeof globalThis=="object")return globalThis;function e(t){t.$$$embind_global$$$=t;var r=typeof $$$embind_global$$$=="object"&&t.$$$embind_global$$$==t;return r||delete t.$$$embind_global$$$,r}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.")},ua=e=>e===0?ae.toHandle(Yt()):(e=ca(e),ae.toHandle(Yt()[e])),da=e=>{var t=ft.length;return ft.push(e),t},ha=(e,t)=>{for(var r=new Array(e),a=0;a<e;++a)r[a]=dt(O[t+a*4>>2],"parameter "+a);return r},fa=Reflect.construct,pa=(e,t,r)=>{var a=[],s=e.toWireType(a,r);return a.length&&(O[t>>2]=ae.toHandle(a)),s},ma=(e,t,r)=>{var a=ha(e,t),s=a.shift();e--;var c=new Array(e),d=(f,p,m,y)=>{for(var C=0,S=0;S<e;++S)c[S]=a[S].readValueFromPointer(y+C),C+=a[S].argPackAdvance;var x=r===1?fa(p,c):p.apply(f,c);return pa(s,m,x)},u=`methodCaller<(${a.map(f=>f.name).join(", ")}) => ${s.name}>`;return da(Se(u,d))},va=e=>{e>9&&(ne[e+1]+=1)},ga=e=>{var t=ae.toValue(e);tt(t),ut(e)},ya=(e,t)=>{e=dt(e,"_emval_take_value");var r=e.readValueFromPointer(t);return ae.toHandle(r)},wa=(e,t,r,a)=>{var s=new Date().getFullYear(),c=new Date(s,0,1),d=new Date(s,6,1),u=c.getTimezoneOffset(),f=d.getTimezoneOffset(),p=Math.max(u,f);O[e>>2]=p*60,se[t>>2]=+(u!=f);var m=S=>{var x=S>=0?"-":"+",H=Math.abs(S),W=String(Math.floor(H/60)).padStart(2,"0"),k=String(H%60).padStart(2,"0");return`UTC${x}${W}${k}`},y=m(u),C=m(f);f<u?(Ee(y,r,17),Ee(C,a,17)):(Ee(y,a,17),Ee(C,r,17))},$a=()=>2147483648,Ca=(e,t)=>Math.ceil(e/t)*t,_a=e=>{var t=Oe.buffer,r=(e-t.byteLength+65535)/65536;try{return Oe.grow(r),Pt(),1}catch{}},ba=e=>{var t=q.length;e>>>=0;var r=$a();if(e>r)return!1;for(var a=1;a<=4;a*=2){var s=t*(1+.2/a);s=Math.min(s,e+100663296);var c=Math.min(r,Ca(Math.max(e,s),65536)),d=_a(c);if(d)return!0}return!1},pt={},Ta=()=>$||"./this.program",Pe=()=>{if(!Pe.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,_:Ta()};for(var r in pt)pt[r]===void 0?delete t[r]:t[r]=pt[r];var a=[];for(var r in t)a.push(`${r}=${t[r]}`);Pe.strings=a}return Pe.strings},Sa=(e,t)=>{for(var r=0;r<e.length;++r)J[t++]=e.charCodeAt(r);J[t]=0},Ea=(e,t)=>{var r=0;return Pe().forEach((a,s)=>{var c=t+r;O[e+s*4>>2]=c,Sa(a,c),r+=a.length+1}),0},Pa=(e,t)=>{var r=Pe();O[e>>2]=r.length;var a=0;return r.forEach(s=>a+=s.length+1),O[t>>2]=a,0},Oa=e=>52;function Ra(e,t,r,a,s){return 70}var Da=[null,[],[]],xa=(e,t)=>{var r=Da[e];t===0||t===10?((e===1?he:G)(Gt(r,0)),r.length=0):r.push(t)},Aa=(e,t,r,a)=>{for(var s=0,c=0;c<r;c++){var d=O[t>>2],u=O[t+4>>2];t+=8;for(var f=0;f<u;f++)xa(e,q[d+f]);s+=u}return O[a>>2]=s,0},Ma=e=>e;Vt=o.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},rn(),me=o.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},mn(),dn(),bn(),qt=o.UnboundTypeError=Pn(Error,"UnboundTypeError"),Mn();var Va={s:Br,v:Qr,b:Nr,g:Gr,q:Xr,Y:Yr,f:Zr,X:Kr,e:zr,T:Jr,ha:en,S:tn,ba:an,fa:On,ea:Dn,w:xn,aa:Vn,x:In,h:jn,M:kn,N:Ln,t:Un,o:qn,ga:Qn,L:Xn,C:ra,B:na,ia:aa,ca:ia,$:oa,E:sa,ka:ut,la:ua,K:ma,O:va,P:ga,da:ya,U:wa,Z:ba,V:Ea,W:Pa,_:Oa,R:Ra,J:Aa,F:Ya,D:ka,G:Xa,n:Za,a:Fa,d:Ha,p:Wa,j:Ga,I:za,u:Qa,H:Na,z:Ja,Q:ti,l:Ua,k:La,c:ja,m:Ia,A:Ba,r:Ka,i:qa,y:ei,ja:Ma},F=qr(),Zt=e=>(Zt=F.oa)(e),ie=o._free=e=>(ie=o._free=F.pa)(e),mt=o._malloc=e=>(mt=o._malloc=F.ra)(e),M=(e,t)=>(M=F.sa)(e,t),Kt=e=>(Kt=F.ta)(e),Jt=e=>(Jt=F.ua)(e),er=()=>(er=F.va)(),tr=e=>(tr=F.wa)(e),rr=e=>(rr=F.xa)(e),nr=(e,t,r)=>(nr=F.ya)(e,t,r),ar=e=>(ar=F.za)(e);o.dynCall_viijii=(e,t,r,a,s,c,d)=>(o.dynCall_viijii=F.Aa)(e,t,r,a,s,c,d),o.dynCall_jiji=(e,t,r,a,s)=>(o.dynCall_jiji=F.Ba)(e,t,r,a,s);var ir=o.dynCall_jiiii=(e,t,r,a,s)=>(ir=o.dynCall_jiiii=F.Ca)(e,t,r,a,s);o.dynCall_iiiiij=(e,t,r,a,s,c,d)=>(o.dynCall_iiiiij=F.Da)(e,t,r,a,s,c,d),o.dynCall_iiiiijj=(e,t,r,a,s,c,d,u,f)=>(o.dynCall_iiiiijj=F.Ea)(e,t,r,a,s,c,d,u,f),o.dynCall_iiiiiijj=(e,t,r,a,s,c,d,u,f,p)=>(o.dynCall_iiiiiijj=F.Fa)(e,t,r,a,s,c,d,u,f,p);function Fa(e,t){var r=j();try{return V(e)(t)}catch(a){if(I(r),a!==a+0)throw a;M(1,0)}}function Ia(e,t,r,a){var s=j();try{V(e)(t,r,a)}catch(c){if(I(s),c!==c+0)throw c;M(1,0)}}function ja(e,t,r){var a=j();try{V(e)(t,r)}catch(s){if(I(a),s!==s+0)throw s;M(1,0)}}function Wa(e,t,r,a){var s=j();try{return V(e)(t,r,a)}catch(c){if(I(s),c!==c+0)throw c;M(1,0)}}function ka(e,t,r,a,s){var c=j();try{return V(e)(t,r,a,s)}catch(d){if(I(c),d!==d+0)throw d;M(1,0)}}function La(e,t){var r=j();try{V(e)(t)}catch(a){if(I(r),a!==a+0)throw a;M(1,0)}}function Ha(e,t,r){var a=j();try{return V(e)(t,r)}catch(s){if(I(a),s!==s+0)throw s;M(1,0)}}function Ua(e){var t=j();try{V(e)()}catch(r){if(I(t),r!==r+0)throw r;M(1,0)}}function qa(e,t,r,a,s,c,d,u,f,p,m){var y=j();try{V(e)(t,r,a,s,c,d,u,f,p,m)}catch(C){if(I(y),C!==C+0)throw C;M(1,0)}}function Ba(e,t,r,a,s){var c=j();try{V(e)(t,r,a,s)}catch(d){if(I(c),d!==d+0)throw d;M(1,0)}}function Qa(e,t,r,a,s,c,d){var u=j();try{return V(e)(t,r,a,s,c,d)}catch(f){if(I(u),f!==f+0)throw f;M(1,0)}}function za(e,t,r,a,s,c){var d=j();try{return V(e)(t,r,a,s,c)}catch(u){if(I(d),u!==u+0)throw u;M(1,0)}}function Na(e,t,r,a,s,c,d,u){var f=j();try{return V(e)(t,r,a,s,c,d,u)}catch(p){if(I(f),p!==p+0)throw p;M(1,0)}}function Ga(e,t,r,a,s){var c=j();try{return V(e)(t,r,a,s)}catch(d){if(I(c),d!==d+0)throw d;M(1,0)}}function Xa(e,t,r,a){var s=j();try{return V(e)(t,r,a)}catch(c){if(I(s),c!==c+0)throw c;M(1,0)}}function Ya(e,t,r,a){var s=j();try{return V(e)(t,r,a)}catch(c){if(I(s),c!==c+0)throw c;M(1,0)}}function Za(e){var t=j();try{return V(e)()}catch(r){if(I(t),r!==r+0)throw r;M(1,0)}}function Ka(e,t,r,a,s,c,d,u){var f=j();try{V(e)(t,r,a,s,c,d,u)}catch(p){if(I(f),p!==p+0)throw p;M(1,0)}}function Ja(e,t,r,a,s,c,d,u,f,p,m,y){var C=j();try{return V(e)(t,r,a,s,c,d,u,f,p,m,y)}catch(S){if(I(C),S!==S+0)throw S;M(1,0)}}function ei(e,t,r,a,s,c,d,u,f,p,m,y,C,S,x,H){var W=j();try{V(e)(t,r,a,s,c,d,u,f,p,m,y,C,S,x,H)}catch(k){if(I(W),k!==k+0)throw k;M(1,0)}}function ti(e,t,r,a,s){var c=j();try{return ir(e,t,r,a,s)}catch(d){if(I(c),d!==d+0)throw d;M(1,0)}}var He;we=function e(){He||or(),He||(we=e)};function or(){if(le>0||(Dr(),le>0))return;function e(){var t;He||(He=!0,o.calledRun=!0,!Tt&&(xr(),v(o),(t=o.onRuntimeInitialized)===null||t===void 0||t.call(o),Ar()))}o.setStatus?(o.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>o.setStatus(""),1),e()},1)):e()}if(o.preInit)for(typeof o.preInit=="function"&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return or(),h=P,h}})();function Wi(i){return bt(Ye,i)}function ki(i){return Fi(Ye,i)}async function Li(i,n){return Ii(Ye,i,n)}async function Hi(i,n){return ji(Ye,i,n)}const $r=[["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"]],Ui=[...$r,["unknown"]].map(i=>i[0]),_t=new Map($r);function qi(i){for(const[n,l]of _t)if(i===l)return n;return"unknown"}function Bi(i){if(Cr(i))return{width:i.naturalWidth,height:i.naturalHeight};if(_r(i))return{width:i.width.baseVal.value,height:i.height.baseVal.value};if(br(i))return{width:i.videoWidth,height:i.videoHeight};if(Sr(i))return{width:i.width,height:i.height};if(Pr(i))return{width:i.displayWidth,height:i.displayHeight};if(Tr(i))return{width:i.width,height:i.height};if(Er(i))return{width:i.width,height:i.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 Cr(i){var n,l;try{return i instanceof((l=(n=i==null?void 0:i.ownerDocument)==null?void 0:n.defaultView)==null?void 0:l.HTMLImageElement)}catch{return!1}}function _r(i){var n,l;try{return i instanceof((l=(n=i==null?void 0:i.ownerDocument)==null?void 0:n.defaultView)==null?void 0:l.SVGImageElement)}catch{return!1}}function br(i){var n,l;try{return i instanceof((l=(n=i==null?void 0:i.ownerDocument)==null?void 0:n.defaultView)==null?void 0:l.HTMLVideoElement)}catch{return!1}}function Tr(i){var n,l;try{return i instanceof((l=(n=i==null?void 0:i.ownerDocument)==null?void 0:n.defaultView)==null?void 0:l.HTMLCanvasElement)}catch{return!1}}function Sr(i){try{return i instanceof ImageBitmap||Object.prototype.toString.call(i)==="[object ImageBitmap]"}catch{return!1}}function Er(i){try{return i instanceof OffscreenCanvas||Object.prototype.toString.call(i)==="[object OffscreenCanvas]"}catch{return!1}}function Pr(i){try{return i instanceof VideoFrame||Object.prototype.toString.call(i)==="[object VideoFrame]"}catch{return!1}}function Or(i){try{return i instanceof Blob||Object.prototype.toString.call(i)==="[object Blob]"}catch{return!1}}function Qi(i){try{return i instanceof ImageData||Object.prototype.toString.call(i)==="[object ImageData]"}catch{return!1}}function zi(i,n){try{const l=new OffscreenCanvas(i,n);if(l.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return l;throw void 0}catch{const l=document.createElement("canvas");return l.width=i,l.height=n,l}}async function Rr(i){if(Cr(i)&&!await Yi(i))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(_r(i)&&!await Zi(i))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(Pr(i)&&Ki(i))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(br(i)&&(i.readyState===0||i.readyState===1))throw new DOMException("Invalid element or state.","InvalidStateError");if(Sr(i)&&eo(i))throw new DOMException("The image source is detached.","InvalidStateError");const{width:n,height:l}=Bi(i);if(n===0||l===0)return null;const h=zi(n,l).getContext("2d");h.drawImage(i,0,0);try{return h.getImageData(0,0,n,l)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function Ni(i){let n;try{if(globalThis.createImageBitmap)n=await createImageBitmap(i);else if(globalThis.Image){n=new Image;let l="";try{l=URL.createObjectURL(i),n.src=l,await n.decode()}finally{URL.revokeObjectURL(l)}}else return i}catch{throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await Rr(n)}function Gi(i){const{width:n,height:l}=i;if(n===0||l===0)return null;const h=i.getContext("2d");try{return h.getImageData(0,0,n,l)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function Xi(i){if(Or(i))return await Ni(i);if(Qi(i)){if(Ji(i))throw new DOMException("The image data has been detached.","InvalidStateError");return i}return Tr(i)||Er(i)?Gi(i):await Rr(i)}async function Yi(i){try{return await i.decode(),!0}catch{return!1}}async function Zi(i){var n;try{return await((n=i.decode)==null?void 0:n.call(i)),!0}catch{return!1}}function Ki(i){return i.format===null}function Ji(i){return i.data.buffer.byteLength===0}function eo(i){return i.width===0&&i.height===0}function mr(i,n){return to(i)?new DOMException(`${n}: ${i.message}`,i.name):ro(i)?new i.constructor(`${n}: ${i.message}`):new Error(`${n}: ${i}`)}function to(i){return i instanceof DOMException||Object.prototype.toString.call(i)==="[object DOMException]"}function ro(i){return i instanceof Error||Object.prototype.toString.call(i)==="[object Error]"}var Xe;class no extends EventTarget{constructor(n={}){var l;super(),Ti(this,Xe);try{const h=(l=n==null?void 0:n.formats)==null?void 0:l.filter(o=>o!=="unknown");if((h==null?void 0:h.length)===0)throw new TypeError("Hint option provided, but is empty.");for(const o of h??[])if(!_t.has(o))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${o}' is not a valid enum value of type BarcodeFormat.`);Si(this,Xe,h??[]),Wi().then(o=>{this.dispatchEvent(new CustomEvent("load",{detail:o}))}).catch(o=>{this.dispatchEvent(new CustomEvent("error",{detail:o}))})}catch(h){throw mr(h,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return Ui.filter(n=>n!=="unknown")}async detect(n){try{const l=await Xi(n);if(l===null)return[];let h;const o={tryHarder:!0,returnCodabarStartEnd:!0,formats:bi(this,Xe).map(v=>_t.get(v))};try{Or(l)?h=await Li(l,o):h=await Hi(l,o)}catch(v){throw console.error(v),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return h.map(v=>{const{topLeft:{x:g,y:P},topRight:{x:A,y:D},bottomLeft:{x:_,y:L},bottomRight:{x:$,y:b}}=v.position,K=Math.min(g,A,_,$),X=Math.min(P,D,L,b),N=Math.max(g,A,_,$),Q=Math.max(P,D,L,b);return{boundingBox:new DOMRectReadOnly(K,X,N-K,Q-X),rawValue:v.text,format:qi(v.format),cornerPoints:[{x:g,y:P},{x:A,y:D},{x:$,y:b},{x:_,y:L}]}})}catch(l){throw mr(l,"Failed to execute 'detect' on 'BarcodeDetector'")}}}Xe=new WeakMap;globalThis.BarcodeDetector!=null||(globalThis.BarcodeDetector=no);class w{constructor(n,l,h,o,v){this._legacyCanvasSize=w.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=n,this.$canvas=document.createElement("canvas"),h&&typeof h=="object"?this._onDecode=l:(console.warn(h||o||v?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=l),l=typeof h=="object"?h:{},this._onDecodeError=l.onDecodeError||(typeof h=="function"?h:this._onDecodeError),this._calculateScanRegion=l.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=l.preferredCamera||v||this._preferredCamera,this._legacyCanvasSize=typeof h=="number"?h:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=l.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),n.disablePictureInPicture=!0,n.playsInline=!0,n.muted=!0;let g=!1;if(n.hidden&&(n.hidden=!1,g=!0),document.body.contains(n)||(document.body.appendChild(n),g=!0),h=n.parentElement,l.highlightScanRegion||l.highlightCodeOutline){if(o=!!l.overlay,this.$overlay=l.overlay||document.createElement("div"),v=this.$overlay.style,v.position="absolute",v.display="none",v.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&l.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}h.insertBefore(this.$overlay,this.$video.nextSibling)}l.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(n),requestAnimationFrame(()=>{let P=window.getComputedStyle(n);P.display==="none"&&(n.style.setProperty("display","block","important"),g=!0),P.visibility!=="visible"&&(n.style.setProperty("visibility","visible","important"),g=!0),g&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),n.style.opacity="0",n.style.width="0",n.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),n.addEventListener("play",this._onPlay),n.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=w.createQrEngine()}static set WORKER_PATH(n){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await w.listCameras(!1)).length}catch{return!1}}static async listCameras(n=!1){if(!navigator.mediaDevices)return[];let l=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),h;try{n&&(await l()).every(o=>!o.label)&&(h=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await l()).map((o,v)=>({id:o.deviceId,label:o.label||(v===0?"Default Camera":`Camera ${v+1}`)}))}finally{h&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),w._stopVideoStream(h))}}async hasFlash(){let n;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;n=this.$video.srcObject}else n=(await this._getCameraStream()).stream;return"torch"in n.getVideoTracks()[0].getSettings()}catch{return!1}finally{n&&n!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),w._stopVideoStream(n))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(n){throw this._flashOn=!1,n}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),w._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:n,facingMode:l}=await this._getCameraStream();!this._active||this._paused?w._stopVideoStream(n):(this._setVideoMirror(l),this.$video.srcObject=n,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(n){if(!this._paused)throw this._active=!1,n}}stop(){this.pause(),this._active=!1}async pause(n=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let l=()=>{this.$video.srcObject instanceof MediaStream&&(w._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return n?(l(),!0):(await new Promise(h=>setTimeout(h,300)),this._paused?(l(),!0):!1)}async setCamera(n){n!==this._preferredCamera&&(this._preferredCamera=n,await this._restartVideoStream())}static async scanImage(n,l,h,o,v=!1,g=!1){let P,A=!1;l&&("scanRegion"in l||"qrEngine"in l||"canvas"in l||"disallowCanvasResizing"in l||"alsoTryWithoutScanRegion"in l||"returnDetailedScanResult"in l)?(P=l.scanRegion,h=l.qrEngine,o=l.canvas,v=l.disallowCanvasResizing||!1,g=l.alsoTryWithoutScanRegion||!1,A=!0):console.warn(l||h||o||v||g?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),l=!!h;try{let D,_;[h,D]=await Promise.all([h||w.createQrEngine(),w._loadImage(n)]),[o,_]=w._drawToCanvas(D,P,o,v);let L;if(h instanceof Worker){let $=h;l||w._postWorkerMessageSync($,"inversionMode","both"),L=await new Promise((b,K)=>{let X,N,Q,he=-1;N=z=>{z.data.id===he&&($.removeEventListener("message",N),$.removeEventListener("error",Q),clearTimeout(X),z.data.data!==null?b({data:z.data.data,cornerPoints:w._convertPoints(z.data.cornerPoints,P)}):K(w.NO_QR_CODE_FOUND))},Q=z=>{$.removeEventListener("message",N),$.removeEventListener("error",Q),clearTimeout(X),K("Scanner error: "+(z?z.message||z:"Unknown Error"))},$.addEventListener("message",N),$.addEventListener("error",Q),X=setTimeout(()=>Q("timeout"),1e4);let G=_.getImageData(0,0,o.width,o.height);he=w._postWorkerMessageSync($,"decode",G,[G.data.buffer])})}else L=await Promise.race([new Promise(($,b)=>window.setTimeout(()=>b("Scanner error: timeout"),1e4)),(async()=>{try{var[$]=await h.detect(o);if(!$)throw w.NO_QR_CODE_FOUND;return{data:$.rawValue,cornerPoints:w._convertPoints($.cornerPoints,P)}}catch(b){if($=b.message||b,/not implemented|service unavailable/.test($))return w._disableBarcodeDetector=!0,w.scanImage(n,{scanRegion:P,canvas:o,disallowCanvasResizing:v,alsoTryWithoutScanRegion:g});throw`Scanner error: ${$}`}})()]);return A?L:L.data}catch(D){if(!P||!g)throw D;let _=await w.scanImage(n,{qrEngine:h,canvas:o,disallowCanvasResizing:v});return A?_:_.data}finally{l||w._postWorkerMessage(h,"close")}}setGrayscaleWeights(n,l,h,o=!0){w._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:n,green:l,blue:h,useIntegerApproximation:o})}setInversionMode(n){w._postWorkerMessage(this._qrEnginePromise,"inversionMode",n)}static async createQrEngine(n){if(n&&console.warn("Specifying a worker path is not required and not supported anymore."),n=()=>ni(()=>import("./qr-scanner-worker.min-D85Z9gVD.js"),[],import.meta.url).then(h=>h.createWorker()),!(!w._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return n();let l=navigator.userAgentData;return l&&l.brands.some(({brand:h})=>/Chromium/i.test(h))&&/mac ?OS/i.test(l.platform)&&await l.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:h,platformVersion:o})=>/arm/i.test(h||"arm")&&13<=parseInt(o||"13")).catch(()=>!0)?n():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(n){let l=Math.round(.6666666666666666*Math.min(n.videoWidth,n.videoHeight));return{x:Math.round((n.videoWidth-l)/2),y:Math.round((n.videoHeight-l)/2),width:l,height:l,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var n=this.$video,l=n.videoWidth,h=n.videoHeight,o=n.offsetWidth,v=n.offsetHeight,g=n.offsetLeft,P=n.offsetTop,A=window.getComputedStyle(n),D=A.objectFit,_=l/h,L=o/v;switch(D){case"none":var $=l,b=h;break;case"fill":$=o,b=v;break;default:(D==="cover"?_>L:_<L)?(b=v,$=b*_):($=o,b=$/_),D==="scale-down"&&($=Math.min($,l),b=Math.min(b,h))}var[K,X]=A.objectPosition.split(" ").map((Q,he)=>{const G=parseFloat(Q);return Q.endsWith("%")?(he?v-b:o-$)*G/100:G});A=this._scanRegion.width||l,L=this._scanRegion.height||h,D=this._scanRegion.x||0;var N=this._scanRegion.y||0;_=this.$overlay.style,_.width=`${A/l*$}px`,_.height=`${L/h*b}px`,_.top=`${P+X+N/h*b}px`,h=/scaleX\(-1\)/.test(n.style.transform),_.left=`${g+(h?o-K-$:K)+(h?l-D-A:D)/l*$}px`,_.transform=n.style.transform}})}static _convertPoints(n,l){if(!l)return n;let h=l.x||0,o=l.y||0,v=l.width&&l.downScaledWidth?l.width/l.downScaledWidth:1;l=l.height&&l.downScaledHeight?l.height/l.downScaledHeight:1;for(let g of n)g.x=g.x*v+h,g.y=g.y*l+o;return n}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var n=Date.now()-this._lastScanTimestamp,l=1e3/this._maxScansPerSecond;n<l&&await new Promise(o=>setTimeout(o,l-n)),this._lastScanTimestamp=Date.now();try{var h=await w.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!w._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=w.createQrEngine()),h?(this._onDecode?this._onDecode(h):this._legacyOnDecode&&this._legacyOnDecode(h.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",h.cornerPoints.map(({x:o,y:v})=>`${o},${v}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(n){n!==w.NO_QR_CODE_FOUND&&console.log(n)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let n=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",l=[{width:{min:1024}},{width:{min:768}},{}],h=l.map(o=>Object.assign({},o,{[n]:{exact:this._preferredCamera}}));for(let o of[...h,...l])try{let v=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),g=this._getFacingMode(v)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:v,facingMode:g}}catch{}throw"Camera not found."}async _restartVideoStream(){let n=this._paused;await this.pause(!0)&&!n&&this._active&&await this.start()}static _stopVideoStream(n){for(let l of n.getTracks())l.stop(),n.removeTrack(l)}_setVideoMirror(n){this.$video.style.transform="scaleX("+(n==="user"?-1:1)+")"}_getFacingMode(n){return(n=n.getVideoTracks()[0])?/rear|back|environment/i.test(n.label)?"environment":/front|user|face/i.test(n.label)?"user":null:null}static _drawToCanvas(n,l,h,o=!1){h=h||document.createElement("canvas");let v=l&&l.x?l.x:0,g=l&&l.y?l.y:0,P=l&&l.width?l.width:n.videoWidth||n.width,A=l&&l.height?l.height:n.videoHeight||n.height;return o||(o=l&&l.downScaledWidth?l.downScaledWidth:P,l=l&&l.downScaledHeight?l.downScaledHeight:A,h.width!==o&&(h.width=o),h.height!==l&&(h.height=l)),l=h.getContext("2d",{alpha:!1}),l.imageSmoothingEnabled=!1,l.drawImage(n,v,g,P,A,0,0,h.width,h.height),[h,l]}static async _loadImage(n){if(n instanceof Image)return await w._awaitImageLoad(n),n;if(n instanceof HTMLVideoElement||n instanceof HTMLCanvasElement||n instanceof SVGImageElement||"OffscreenCanvas"in window&&n instanceof OffscreenCanvas||"ImageBitmap"in window&&n instanceof ImageBitmap)return n;if(n instanceof File||n instanceof Blob||n instanceof URL||typeof n=="string"){let l=new Image;l.src=n instanceof File||n instanceof Blob?URL.createObjectURL(n):n.toString();try{return await w._awaitImageLoad(l),l}finally{(n instanceof File||n instanceof Blob)&&URL.revokeObjectURL(l.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(n){n.complete&&n.naturalWidth!==0||await new Promise((l,h)=>{let o=v=>{n.removeEventListener("load",o),n.removeEventListener("error",o),v instanceof ErrorEvent?h("Image load error"):l()};n.addEventListener("load",o),n.addEventListener("error",o)})}static async _postWorkerMessage(n,l,h,o){return w._postWorkerMessageSync(await n,l,h,o)}static _postWorkerMessageSync(n,l,h,o){if(!(n instanceof Worker))return-1;let v=w._workerMessageId++;return n.postMessage({id:v,type:l,data:h},o),v}}w.DEFAULT_CANVAS_SIZE=400;w.NO_QR_CODE_FOUND="No QR code found";w._disableBarcodeDetector=!1;w._workerMessageId=0;const Ge=ii.get("QrReader");ki({locateFile:(i,n)=>i.endsWith(".wasm")?"zxing_reader.wasm":n+i});const ao={props:{qrbox:{type:Number,default:200},fps:{type:Number,default:10},rules:{type:Array,default:()=>[]}},data(){return{scanTab:null,qrReader:null,qrCodeError:null,qrString:null,qrForm:!1,loadingQr:!1,retryQrLoad:!1,selectedCamera:null,videoDevices:[],smallQr:!1,dragover:!1}},mounted(){this.initialize()},beforeUnmount(){this.destroyReader()},watch:{qrCodeError(i){i&&setTimeout(()=>{this.qrCodeError=!1},5e3)},selectedCamera(i){this.qrReader&&this.qrReader.setCamera(i)},smallQr(){this.qrReader&&this.retryQr()}},methods:{async retryQr(){await this.destroyReader(),this.retryQrLoad=!1,this.qrCodeError=!1,this.loadingQr=!0,await oi(500),await this.initialize()},async destroyReader(){this.qrReader&&(await this.qrReader.destroy(),this.qrReader=null)},async initialize(){this.loadingQr=!0;try{if(await this.getDevices(),this.videoDevices.length===0)throw new Error("No available camera found");this.selectedCamera=this.selectedCamera||this.videoDevices[0].id,this.qrReader=new w(this.$refs.reader,this.onScanSuccess.bind(this),{highlightScanRegion:!0,highlightCodeOutline:!0,preferredCamera:this.selectedCamera,calculateScanRegion:this.smallQr?i=>this.smallQrCodeRegion(i):null}),await this.qrReader.start()}catch(i){Ge.error(i),this.retryQrLoad=!0,this.qrCodeError="Cannot initialize QR-Code scanner: "+i.message}this.loadingQr=!1},smallQrCodeRegion(i){const n=Math.min(i.videoWidth,i.videoHeight),l=Math.round(1/5*n);return{x:Math.round((i.videoWidth-l)/2),y:Math.round((i.videoHeight-l)/2),width:l,height:l}},async getDevices(){try{const i=await w.listCameras(!0);this.videoDevices=i}catch(i){Ge.error(i),this.qrCodeError="Cannot fetch available video devices"}},onScanSuccess(i){Ge.log("QR-Code scanned: ",typeof i=="string"?i:i.data),this.$emit("result",typeof i=="string"?i:i.data)},onDrop(i){this.dragover=!1,this.onQrImport(i.dataTransfer.files[0])},async onQrImport(i){if(i)try{const n=await w.scanImage(i,{alsoTryWithoutScanRegion:!0});this.onScanSuccess(n)}catch(n){Ge.error(n),this.qrCodeError="Cannot read QR-Code"}}}},io={key:0,class:"d-flex flex-column align-center mt-5"},oo={key:1,class:"d-flex flex-column align-center mt-5"};function so(i,n,l,h,o,v){return Qe(),vt("div",null,[E(si,{modelValue:o.scanTab,"onUpdate:modelValue":n[0]||(n[0]=g=>o.scanTab=g),grow:"",stacked:""},{default:R(()=>[E(gt,null,{default:R(()=>[n[13]||(n[13]=te(" Scan ")),E(ze,null,{default:R(()=>n[12]||(n[12]=[te("photo_camera")])),_:1,__:[12]})]),_:1,__:[13]}),E(gt,null,{default:R(()=>[n[15]||(n[15]=te(" Import ")),E(ze,null,{default:R(()=>n[14]||(n[14]=[te("image")])),_:1,__:[14]})]),_:1,__:[15]}),E(gt,null,{default:R(()=>[n[17]||(n[17]=te(" Text ")),E(ze,null,{default:R(()=>n[16]||(n[16]=[te("border_color")])),_:1,__:[16]})]),_:1,__:[17]})]),_:1},8,["modelValue"]),E(wi,{grow:"",modelValue:o.scanTab,"onUpdate:modelValue":n[11]||(n[11]=g=>o.scanTab=g)},{default:R(()=>[E(yt,{id:"qr-code-scan"},{default:R(()=>[E(wt,{flat:""},{default:R(()=>[E($t,null,{default:R(()=>[E(li,{"menu-props":{attach:"#qr-code-scan"},items:o.videoDevices,modelValue:o.selectedCamera,"onUpdate:modelValue":n[1]||(n[1]=g=>o.selectedCamera=g),label:"Camera","hide-details":"","item-title":"label","item-value":"id"},null,8,["items","modelValue"]),E(ci,{modelValue:o.smallQr,"onUpdate:modelValue":n[2]||(n[2]=g=>o.smallQr=g),label:"Small QR-Code","persistent-hint":"",hint:"If the QR-Code is small and cannot be recognized, enable this option"},null,8,["modelValue"]),Ne("div",null,[o.loadingQr?(Qe(),vt("div",io,[n[18]||(n[18]=Ne("p",{class:"text-caption"},"Loading camera",-1)),E(ui,{class:"mt-2",indeterminate:""})])):o.retryQrLoad?(Qe(),vt("div",oo,[E(dr,{onClick:ve(v.retryQr,["stop"]),color:"primary"},{default:R(()=>n[19]||(n[19]=[te("Retry")])),_:1,__:[19]},8,["onClick"])])):hr("",!0),Ne("video",{class:"mx-auto",ref:"reader",style:di({opacity:o.loadingQr||o.retryQrLoad?0:1,width:"100%",minHeight:"300px"})},null,4)])]),_:1})]),_:1})]),_:1}),E(yt,null,{default:R(()=>[E(wt,{flat:""},{default:R(()=>[E($t,null,{default:R(()=>[E(hi,{"small-chips":"","truncate-length":"15",label:"Import QR-Code",multiple:!1,"show-size":"",accept:"image/*",counter:"","onUpdate:modelValue":v.onQrImport},null,8,["onUpdate:modelValue"]),E(fi,{onDrop:n[3]||(n[3]=ve(g=>v.onDrop(g),["prevent"])),onDragover:n[4]||(n[4]=ve(g=>o.dragover=!0,["prevent"])),onDragenter:n[5]||(n[5]=ve(g=>o.dragover=!0,["prevent"])),onDragleave:n[6]||(n[6]=ve(g=>o.dragover=!1,["prevent"])),class:pi([{"grey lighten-2":o.dragover},"mt-2 dropzone text-center"])},{default:R(()=>[E(ze,{size:"60px"},{default:R(()=>n[20]||(n[20]=[te("cloud_upload")])),_:1,__:[20]}),n[21]||(n[21]=Ne("p",{class:"text-caption font-weight-bold text-uppercase"}," Drop the image here ",-1))]),_:1,__:[21]},8,["class"])]),_:1})]),_:1})]),_:1}),E(yt,null,{default:R(()=>[E(mi,{ref:"qrForm",modelValue:o.qrForm,"onUpdate:modelValue":n[9]||(n[9]=g=>o.qrForm=g),onSubmit:n[10]||(n[10]=ve(g=>v.onScanSuccess(o.qrString),["prevent"]))},{default:R(()=>[E(wt,{flat:""},{default:R(()=>[E($t,null,{default:R(()=>[E(vi,null,{default:R(()=>[E(gi,{label:"QR Code text",hint:"Manually insert the QR Code string",modelValue:o.qrString,"onUpdate:modelValue":n[7]||(n[7]=g=>o.qrString=g),modelModifiers:{trim:!0},rules:l.rules},null,8,["modelValue","rules"])]),_:1})]),_:1}),E(yi,null,{default:R(()=>[E(dr,{type:"submit",color:"primary",disabled:!o.qrForm,onClick:n[8]||(n[8]=g=>v.onScanSuccess(o.qrString))},{default:R(()=>n[22]||(n[22]=[te("Confirm")])),_:1,__:[22]},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["modelValue"]),o.qrCodeError?(Qe(),$i(_i,{key:0,density:"compact",type:"error"},{default:R(()=>[te(Ci(o.qrCodeError),1)]),_:1})):hr("",!0)])}const co=ai(ao,[["render",so],["__scopeId","data-v-a1545be2"]]);export{co as default};