@microblink/capture 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/capture.js CHANGED
@@ -1924,27 +1924,41 @@ const Ro = "application/javascript", rl = (e, t = {}) => {
1924
1924
  useBlob: !0,
1925
1925
  ...t
1926
1926
  };
1927
- return n.skipSameOrigin && new URL(e).origin === self.location.origin ? Promise.resolve(e) : new Promise(
1928
- (i, r) => void fetch(e, {
1927
+ if (n.skipSameOrigin && new URL(e).origin === self.location.origin)
1928
+ return Promise.resolve(e);
1929
+ let i;
1930
+ try {
1931
+ const r = new AbortController();
1932
+ i = r.signal;
1933
+ const o = setTimeout(() => {
1934
+ r.abort();
1935
+ }, 3e3), s = () => {
1936
+ clearTimeout(o), r.abort();
1937
+ };
1938
+ i.addEventListener("abort", s);
1939
+ } catch {
1940
+ }
1941
+ return new Promise(
1942
+ (r, o) => void fetch(e, {
1929
1943
  // abort if the worker is not fetched in a reasonable time
1930
- signal: AbortSignal.timeout(3e3)
1931
- }).then((o) => o.text()).then((o) => {
1932
- const s = new URL(e).href.split("/");
1933
- s.pop();
1934
- const a = qr`
1944
+ signal: i
1945
+ }).then((s) => s.text()).then((s) => {
1946
+ const a = new URL(e).href.split("/");
1947
+ a.pop();
1948
+ const c = qr`
1935
1949
  const _importScripts = importScripts;
1936
- const _fixImports = (url) => new URL(url, '${s.join("/") + "/"}').href;
1950
+ const _fixImports = (url) => new URL(url, '${a.join("/") + "/"}').href;
1937
1951
  importScripts = (...urls) => _importScripts(...urls.map(_fixImports));
1938
1952
  `;
1939
- let c = "";
1953
+ let u = "";
1940
1954
  if (n.useBlob) {
1941
- const u = new Blob([a + o], { type: Ro });
1942
- c = URL.createObjectURL(u);
1955
+ const l = new Blob([c + s], { type: Ro });
1956
+ u = URL.createObjectURL(l);
1943
1957
  } else
1944
- c = `data:${Ro},` + encodeURIComponent(a + o);
1945
- i(c);
1958
+ u = `data:${Ro},` + encodeURIComponent(c + s);
1959
+ r(u);
1946
1960
  }).catch(() => {
1947
- r(new Error(`Failed to fetch worker from ${e}`));
1961
+ o(new Error(`Failed to fetch worker from ${e}`));
1948
1962
  })
1949
1963
  );
1950
1964
  }, ol = async (e = window.location.href) => {
@@ -7,11 +7,11 @@
7
7
  `),tt,mt,xe,Kt(/&/g,"&amp;"),Kt(/</g,"&lt;"),Kt(/>/g,"&gt;"),Kt(/"/g,"&quot;"),Kt(/'/g,"&#x27;"),Kt(/`/g,"&#x60;")),new we(Vt(/(?:\n(?:\s*))+/g," "),xe),new we(Vt(/(?:\n\s*)/g,""),xe),new we(tt({separator:","}),Vt(/(?:\s+)/g," "),xe),new we(tt({separator:",",conjunction:"or"}),Vt(/(?:\s+)/g," "),xe),new we(tt({separator:",",conjunction:"and"}),Vt(/(?:\s+)/g," "),xe),new we(tt,mt,xe),new we(tt,Vt(/(?:\s+)/g," "),xe),new we(mt,xe);var qi=new we(mt("all"),xe),Zu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xi={exports:{}};(function(e,t){(function(n,i){var r="1.0.36",o="",s="?",a="function",c="undefined",u="object",l="string",g="major",f="model",h="name",d="type",M="vendor",y="version",m="architecture",T="console",N="mobile",j="tablet",A="smarttv",E="wearable",S="embedded",I=350,z="Amazon",C="Apple",R="ASUS",F="BlackBerry",x="Browser",D="Chrome",b="Edge",w="Firefox",v="Google",O="Huawei",_="LG",$="Microsoft",X="Motorola",se="Opera",Se="Samsung",at="Sharp",Je="Sony",U="Xiaomi",de="Zebra",fe="Facebook",Ft="Chromium OS",Gn="Mac OS",Bt=function(W,re){var Q={};for(var ce in W)re[ce]&&re[ce].length%2===0?Q[ce]=re[ce].concat(W[ce]):Q[ce]=W[ce];return Q},Ht=function(W){for(var re={},Q=0;Q<W.length;Q++)re[W[Q].toUpperCase()]=W[Q];return re},Bi=function(W,re){return typeof W===l?Vn(re).indexOf(Vn(W))!==-1:!1},Vn=function(W){return W.toLowerCase()},_y=function(W){return typeof W===l?W.replace(/[^\d\.]/g,o).split(".")[0]:i},zo=function(W,re){if(typeof W===l)return W=W.replace(/^\s\s*/,o),typeof re===c?W:W.substring(0,I)},Kn=function(W,re){for(var Q=0,ce,vt,ct,ie,B,ut;Q<re.length&&!B;){var ko=re[Q],Lu=re[Q+1];for(ce=vt=0;ce<ko.length&&!B&&ko[ce];)if(B=ko[ce++].exec(W),B)for(ct=0;ct<Lu.length;ct++)ut=B[++vt],ie=Lu[ct],typeof ie===u&&ie.length>0?ie.length===2?typeof ie[1]==a?this[ie[0]]=ie[1].call(this,ut):this[ie[0]]=ie[1]:ie.length===3?typeof ie[1]===a&&!(ie[1].exec&&ie[1].test)?this[ie[0]]=ut?ie[1].call(this,ut,ie[2]):i:this[ie[0]]=ut?ut.replace(ie[1],ie[2]):i:ie.length===4&&(this[ie[0]]=ut?ie[3].call(this,ut.replace(ie[1],ie[2])):i):this[ie]=ut||i;Q+=2}},_o=function(W,re){for(var Q in re)if(typeof re[Q]===u&&re[Q].length>0){for(var ce=0;ce<re[Q].length;ce++)if(Bi(re[Q][ce],W))return Q===s?i:Q}else if(Bi(re[Q],W))return Q===s?i:Q;return W},ky={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Nu={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Tu={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[y,[h,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[y,[h,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[h,y],[/opios[\/ ]+([\w\.]+)/i],[y,[h,se+" Mini"]],[/\bopr\/([\w\.]+)/i],[y,[h,se]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[h,y],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[y,[h,"UC"+x]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[y,[h,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[y,[h,"WeChat"]],[/konqueror\/([\w\.]+)/i],[y,[h,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[y,[h,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[y,[h,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[h,/(.+)/,"$1 Secure "+x],y],[/\bfocus\/([\w\.]+)/i],[y,[h,w+" Focus"]],[/\bopt\/([\w\.]+)/i],[y,[h,se+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[y,[h,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[y,[h,"Dolphin"]],[/coast\/([\w\.]+)/i],[y,[h,se+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[y,[h,"MIUI "+x]],[/fxios\/([-\w\.]+)/i],[y,[h,w]],[/\bqihu|(qi?ho?o?|360)browser/i],[[h,"360 "+x]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[h,/(.+)/,"$1 "+x],y],[/(comodo_dragon)\/([\w\.]+)/i],[[h,/_/g," "],y],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[h,y],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[h],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[h,fe],y],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[h,y],[/\bgsa\/([\w\.]+) .*safari\//i],[y,[h,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[y,[h,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[y,[h,D+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[h,D+" WebView"],y],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[y,[h,"Android "+x]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[h,y],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[y,[h,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[y,h],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[h,[y,_o,ky]],[/(webkit|khtml)\/([\w\.]+)/i],[h,y],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[h,"Netscape"],y],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[y,[h,w+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[h,y],[/(cobalt)\/([\w\.]+)/i],[h,[y,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[m,"amd64"]],[/(ia32(?=;))/i],[[m,Vn]],[/((?:i[346]|x)86)[;\)]/i],[[m,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[m,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[m,"armhf"]],[/windows (ce|mobile); ppc;/i],[[m,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[m,/ower/,o,Vn]],[/(sun4\w)[;\)]/i],[[m,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[m,Vn]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[f,[M,Se],[d,j]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[f,[M,Se],[d,N]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[f,[M,C],[d,N]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[f,[M,C],[d,j]],[/(macintosh);/i],[f,[M,C]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[f,[M,at],[d,N]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[f,[M,O],[d,j]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[f,[M,O],[d,N]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[f,/_/g," "],[M,U],[d,N]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[f,/_/g," "],[M,U],[d,j]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[f,[M,"OPPO"],[d,N]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[f,[M,"Vivo"],[d,N]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[f,[M,"Realme"],[d,N]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[f,[M,X],[d,N]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[f,[M,X],[d,j]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[f,[M,_],[d,j]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[f,[M,_],[d,N]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[f,[M,"Lenovo"],[d,j]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[f,/_/g," "],[M,"Nokia"],[d,N]],[/(pixel c)\b/i],[f,[M,v],[d,j]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[f,[M,v],[d,N]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[f,[M,Je],[d,N]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[f,"Xperia Tablet"],[M,Je],[d,j]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[f,[M,"OnePlus"],[d,N]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[f,[M,z],[d,j]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[f,/(.+)/g,"Fire Phone $1"],[M,z],[d,N]],[/(playbook);[-\w\),; ]+(rim)/i],[f,M,[d,j]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[f,[M,F],[d,N]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[f,[M,R],[d,j]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[f,[M,R],[d,N]],[/(nexus 9)/i],[f,[M,"HTC"],[d,j]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[M,[f,/_/g," "],[d,N]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[f,[M,"Acer"],[d,j]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[f,[M,"Meizu"],[d,N]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[M,f,[d,N]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[M,f,[d,j]],[/(surface duo)/i],[f,[M,$],[d,j]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[f,[M,"Fairphone"],[d,N]],[/(u304aa)/i],[f,[M,"AT&T"],[d,N]],[/\bsie-(\w*)/i],[f,[M,"Siemens"],[d,N]],[/\b(rct\w+) b/i],[f,[M,"RCA"],[d,j]],[/\b(venue[\d ]{2,7}) b/i],[f,[M,"Dell"],[d,j]],[/\b(q(?:mv|ta)\w+) b/i],[f,[M,"Verizon"],[d,j]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[f,[M,"Barnes & Noble"],[d,j]],[/\b(tm\d{3}\w+) b/i],[f,[M,"NuVision"],[d,j]],[/\b(k88) b/i],[f,[M,"ZTE"],[d,j]],[/\b(nx\d{3}j) b/i],[f,[M,"ZTE"],[d,N]],[/\b(gen\d{3}) b.+49h/i],[f,[M,"Swiss"],[d,N]],[/\b(zur\d{3}) b/i],[f,[M,"Swiss"],[d,j]],[/\b((zeki)?tb.*\b) b/i],[f,[M,"Zeki"],[d,j]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[M,"Dragon Touch"],f,[d,j]],[/\b(ns-?\w{0,9}) b/i],[f,[M,"Insignia"],[d,j]],[/\b((nxa|next)-?\w{0,9}) b/i],[f,[M,"NextBook"],[d,j]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[M,"Voice"],f,[d,N]],[/\b(lvtel\-)?(v1[12]) b/i],[[M,"LvTel"],f,[d,N]],[/\b(ph-1) /i],[f,[M,"Essential"],[d,N]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[f,[M,"Envizen"],[d,j]],[/\b(trio[-\w\. ]+) b/i],[f,[M,"MachSpeed"],[d,j]],[/\btu_(1491) b/i],[f,[M,"Rotor"],[d,j]],[/(shield[\w ]+) b/i],[f,[M,"Nvidia"],[d,j]],[/(sprint) (\w+)/i],[M,f,[d,N]],[/(kin\.[onetw]{3})/i],[[f,/\./g," "],[M,$],[d,N]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[f,[M,de],[d,j]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[f,[M,de],[d,N]],[/smart-tv.+(samsung)/i],[M,[d,A]],[/hbbtv.+maple;(\d+)/i],[[f,/^/,"SmartTV"],[M,Se],[d,A]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[M,_],[d,A]],[/(apple) ?tv/i],[M,[f,C+" TV"],[d,A]],[/crkey/i],[[f,D+"cast"],[M,v],[d,A]],[/droid.+aft(\w+)( bui|\))/i],[f,[M,z],[d,A]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[f,[M,at],[d,A]],[/(bravia[\w ]+)( bui|\))/i],[f,[M,Je],[d,A]],[/(mitv-\w{5}) bui/i],[f,[M,U],[d,A]],[/Hbbtv.*(technisat) (.*);/i],[M,f,[d,A]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[M,zo],[f,zo],[d,A]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,A]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[M,f,[d,T]],[/droid.+; (shield) bui/i],[f,[M,"Nvidia"],[d,T]],[/(playstation [345portablevi]+)/i],[f,[M,Je],[d,T]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[f,[M,$],[d,T]],[/((pebble))app/i],[M,f,[d,E]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[f,[M,C],[d,E]],[/droid.+; (glass) \d/i],[f,[M,v],[d,E]],[/droid.+; (wt63?0{2,3})\)/i],[f,[M,de],[d,E]],[/(quest( 2| pro)?)/i],[f,[M,fe],[d,E]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[M,[d,S]],[/(aeobc)\b/i],[f,[M,z],[d,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[f,[d,N]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[f,[d,j]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,j]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,N]],[/(android[-\w\. ]{0,9});.+buil/i],[f,[M,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[y,[h,b+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[y,[h,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[h,y],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[y,h]],os:[[/microsoft (windows) (vista|xp)/i],[h,y],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[h,[y,_o,Nu]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[h,"Windows"],[y,_o,Nu]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[y,/_/g,"."],[h,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[h,Gn],[y,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[y,h],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[h,y],[/\(bb(10);/i],[y,[h,F]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[y,[h,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[y,[h,w+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[y,[h,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[y,[h,"watchOS"]],[/crkey\/([\d\.]+)/i],[y,[h,D+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[h,Ft],y],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[h,y],[/(sunos) ?([\w\.\d]*)/i],[[h,"Solaris"],y],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[h,y]]},et=function(W,re){if(typeof W===u&&(re=W,W=i),!(this instanceof et))return new et(W,re).getResult();var Q=typeof n!==c&&n.navigator?n.navigator:i,ce=W||(Q&&Q.userAgent?Q.userAgent:o),vt=Q&&Q.userAgentData?Q.userAgentData:i,ct=re?Bt(Tu,re):Tu,ie=Q&&Q.userAgent==ce;return this.getBrowser=function(){var B={};return B[h]=i,B[y]=i,Kn.call(B,ce,ct.browser),B[g]=_y(B[y]),ie&&Q&&Q.brave&&typeof Q.brave.isBrave==a&&(B[h]="Brave"),B},this.getCPU=function(){var B={};return B[m]=i,Kn.call(B,ce,ct.cpu),B},this.getDevice=function(){var B={};return B[M]=i,B[f]=i,B[d]=i,Kn.call(B,ce,ct.device),ie&&!B[d]&&vt&&vt.mobile&&(B[d]=N),ie&&B[f]=="Macintosh"&&Q&&typeof Q.standalone!==c&&Q.maxTouchPoints&&Q.maxTouchPoints>2&&(B[f]="iPad",B[d]=j),B},this.getEngine=function(){var B={};return B[h]=i,B[y]=i,Kn.call(B,ce,ct.engine),B},this.getOS=function(){var B={};return B[h]=i,B[y]=i,Kn.call(B,ce,ct.os),ie&&!B[h]&&vt&&vt.platform!="Unknown"&&(B[h]=vt.platform.replace(/chrome os/i,Ft).replace(/macos/i,Gn)),B},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return ce},this.setUA=function(B){return ce=typeof B===l&&B.length>I?zo(B,I):B,this},this.setUA(ce),this};et.VERSION=r,et.BROWSER=Ht([h,y,g]),et.CPU=Ht([m]),et.DEVICE=Ht([f,M,d,T,N,A,j,E,S]),et.ENGINE=et.OS=Ht([h,y]),e.exports&&(t=e.exports=et),t.UAParser=et;var jn=typeof n!==c&&(n.jQuery||n.Zepto);if(jn&&!jn.ua){var Hi=new et;jn.ua=Hi.getResult(),jn.ua.get=function(){return Hi.getUA()},jn.ua.set=function(W){Hi.setUA(W);var re=Hi.getResult();for(var Q in re)jn.ua[Q]=re[Q]}}})(typeof window=="object"?window:Zu)})(Xi,Xi.exports);var qu=Xi.exports;const Xu=Xo(qu);function Jo(e){const t=Object.keys(e);if(t.length===0)throw new Error("No members in object!");let n=t[0],i=-1/0;for(const[r,o]of Object.entries(e))o>i&&(i=o,n=r);return n}const Ji=e=>{if(e instanceof Error)return e;try{return new Error(JSON.stringify(e))}catch{return new Error(String(e))}};class es{deviceInfo;settings;activeStream;name;#e;constructor(t,n){this.deviceInfo=t,this.name=t.label,this.activeStream=null,this.#e=ns(t),this.settings=n}async startStream(){if(this.activeStream)return this.activeStream;const t=await navigator.mediaDevices.getUserMedia(this.#e);this.activeStream=t,t.onaddtrack=i=>console.log("added track",i),t.onremovetrack=i=>console.log("removed track",i);const n=t.getVideoTracks()[0];return n.onended=i=>{console.log("track ended",i),this.stopStream()},t}stopStream(){this.activeStream&&(console.log(`Stopping active stream on ${this.name}`),nr(this.activeStream),this.activeStream=null)}getVideoTrack(){if(this.activeStream)return this.activeStream.getVideoTracks()[0]}}const er=new Xu,tr=er.getOS().name==="Android",ts=er.getOS().name==="iOS",Ju=async()=>{try{const e=await navigator.mediaDevices.getUserMedia({video:!0});nr(e)}catch{throw new Error("Camera permission not given")}},el=async()=>{if(!navigator.mediaDevices)throw new Error(qi`
8
8
  Cameras can only be used in a secure context:
9
9
  https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
10
- `);return await Ju(),(await navigator.mediaDevices.enumerateDevices()).filter(n=>n.kind==="videoinput")};async function tl(e){try{const t=await rl(e),n=t.getVideoTracks()[0].getSettings();return nr(t),new es(e,n)}catch{return console.warn(`DEBUG: Device ${e.deviceId} doesn't support this constraint.`),null}}const nl=e=>{if(er.getOS().name!=="Android")return;if(e.some(i=>i.settings.facingMode===void 0)){console.warn("Not all devices have facingMode");return}let t=0,n=0;for(const i of e){const r=i.settings.facingMode;r==="environment"&&(i.name=`Back camera ${++n}`),r==="user"&&(i.name=`Front camera ${++t}`)}},nr=e=>{const t=e.getTracks();for(const n of t)n.stop()},il=e=>{const t={};for(const i of e){const r=i.deviceInfo.deviceId;t[r]=0,i.settings.facingMode==="environment"&&(t[r]+=2),tr&&"torch"in i.settings&&(t[r]+=2),tr&&i.settings.focusMode==="single-shot"&&(t[r]+=2),tr&&i===e[e.length]&&(t[r]+=1),ts&&i.name==="Back Triple Camera"&&(t[r]+=5),ts&&i.name==="Back Dual Wide Camera"&&(t[r]+=3)}return Jo(t)};function ns(e){return{video:{deviceId:{exact:e.deviceId},frameRate:{exact:30},width:{exact:1920},height:{exact:1080}},audio:!1}}async function rl(e){const t=ns(e);return await navigator.mediaDevices.getUserMedia(t)}async function ol(){const e=await el(),t=[];for await(const n of e){const i=await tl(n);i!==null&&t.push(i)}return t}function sl(e){return{data:e.data,width:e.width,height:e.height,colorSpace:e.colorSpace}}const is="application/javascript",al=(e,t={})=>{const n={skipSameOrigin:!0,useBlob:!0,...t};return n.skipSameOrigin&&new URL(e).origin===self.location.origin?Promise.resolve(e):new Promise((i,r)=>void fetch(e,{signal:AbortSignal.timeout(3e3)}).then(o=>o.text()).then(o=>{const s=new URL(e).href.split("/");s.pop();const a=qi`
10
+ `);return await Ju(),(await navigator.mediaDevices.enumerateDevices()).filter(n=>n.kind==="videoinput")};async function tl(e){try{const t=await rl(e),n=t.getVideoTracks()[0].getSettings();return nr(t),new es(e,n)}catch{return console.warn(`DEBUG: Device ${e.deviceId} doesn't support this constraint.`),null}}const nl=e=>{if(er.getOS().name!=="Android")return;if(e.some(i=>i.settings.facingMode===void 0)){console.warn("Not all devices have facingMode");return}let t=0,n=0;for(const i of e){const r=i.settings.facingMode;r==="environment"&&(i.name=`Back camera ${++n}`),r==="user"&&(i.name=`Front camera ${++t}`)}},nr=e=>{const t=e.getTracks();for(const n of t)n.stop()},il=e=>{const t={};for(const i of e){const r=i.deviceInfo.deviceId;t[r]=0,i.settings.facingMode==="environment"&&(t[r]+=2),tr&&"torch"in i.settings&&(t[r]+=2),tr&&i.settings.focusMode==="single-shot"&&(t[r]+=2),tr&&i===e[e.length]&&(t[r]+=1),ts&&i.name==="Back Triple Camera"&&(t[r]+=5),ts&&i.name==="Back Dual Wide Camera"&&(t[r]+=3)}return Jo(t)};function ns(e){return{video:{deviceId:{exact:e.deviceId},frameRate:{exact:30},width:{exact:1920},height:{exact:1080}},audio:!1}}async function rl(e){const t=ns(e);return await navigator.mediaDevices.getUserMedia(t)}async function ol(){const e=await el(),t=[];for await(const n of e){const i=await tl(n);i!==null&&t.push(i)}return t}function sl(e){return{data:e.data,width:e.width,height:e.height,colorSpace:e.colorSpace}}const is="application/javascript",al=(e,t={})=>{const n={skipSameOrigin:!0,useBlob:!0,...t};if(n.skipSameOrigin&&new URL(e).origin===self.location.origin)return Promise.resolve(e);let i;try{const r=new AbortController;i=r.signal;const o=setTimeout(()=>{r.abort()},3e3),s=()=>{clearTimeout(o),r.abort()};i.addEventListener("abort",s)}catch{}return new Promise((r,o)=>void fetch(e,{signal:i}).then(s=>s.text()).then(s=>{const a=new URL(e).href.split("/");a.pop();const c=qi`
11
11
  const _importScripts = importScripts;
12
- const _fixImports = (url) => new URL(url, '${s.join("/")+"/"}').href;
12
+ const _fixImports = (url) => new URL(url, '${a.join("/")+"/"}').href;
13
13
  importScripts = (...urls) => _importScripts(...urls.map(_fixImports));
14
- `;let c="";if(n.useBlob){const u=new Blob([a+o],{type:is});c=URL.createObjectURL(u)}else c=`data:${is},`+encodeURIComponent(a+o);i(c)}).catch(()=>{r(new Error(`Failed to fetch worker from ${e}`))}))},cl=async(e=window.location.href)=>{const t=await al(e+"/resources/capture-worker.js"),n=new Worker(t);n.onerror=r=>{console.error("Worker error:",r)};const i=Fo(n);return await i.setResourceUrl(e+"/resources"),i};let rs=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");const os="capture-userid";function ul(){if(!ll())return rs();const t=localStorage.getItem(os);if(t)return t;const n=rs();return localStorage.setItem(os,n),n}function ll(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch{return!1}}function fl(e){return{licenseId:e.licenseId,licensee:e.licensee,applicationIds:e.applicationIds,packageName:e.packageName,platform:"Browser",sdkName:e.sdkName,sdkVersion:e.sdkVersion}}async function dl(e){try{return await(await fetch("https://baltazar.microblink.com/api/v2/status/check",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-cache",body:JSON.stringify(fl(e))})).json()}catch(t){throw console.error(t),t}}class gl{#e;#t;constructor(t,n){this.#e=t,this.#t=n}analyze=async t=>{const n=sl(t);return await this.#e.analyze(Go(n,[n.data.buffer]))};finishSideCapture=async()=>await this.#t.finishSideCapture();getResult=async()=>await this.#t.getResult();getSettings=async()=>await this.#t.getSettings();updateSettings=async t=>{const i={...await this.getSettings(),...t};await this.#t.updateSettings(i)};resetCapture=async()=>{await this.#t.reset()};async terminateWorker(){await this.#e.terminate()}}async function ss(e){const t=await cl(e.resourceUrl),n=ul(),i=await t.loadWasm(),r=await i.initializeWithLicenseKey(e.licenseKey,n,!1);if(r.unlockResult===Vi.RequiresServerPermission){const u=await dl(r),l=await i.submitServerPermission(JSON.stringify(u));if(console.log(l),l.status!==Ki.Ok)throw new Error("Server unlock not ok.")}const o=await t.createAnalyzer();if(!o)throw new Error("Failed to create analyzer");let a={...await o.getSettings(),minimumDocumentDpi:220};return e.analyzerSettings&&Object.assign(a,e.analyzerSettings),await o.updateSettings(a),new gl(t,o)}const De=Symbol.for("@ts-pattern/matcher"),as=Symbol.for("@ts-pattern/isVariadic"),Jn="@ts-pattern/anonymous-select-key",ir=e=>!!(e&&typeof e=="object"),ei=e=>e&&!!e[De],Te=(e,t,n)=>{if(ei(e)){const i=e[De](),{matched:r,selections:o}=i.match(t);return r&&o&&Object.keys(o).forEach(s=>n(s,o[s])),r}if(ir(e)){if(!ir(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let i=[],r=[],o=[];for(const s of e.keys()){const a=e[s];ei(a)&&a[as]?o.push(a):o.length?r.push(a):i.push(a)}if(o.length){if(o.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<i.length+r.length)return!1;const s=t.slice(0,i.length),a=r.length===0?[]:t.slice(-r.length),c=t.slice(i.length,r.length===0?1/0:-r.length);return i.every((u,l)=>Te(u,s[l],n))&&r.every((u,l)=>Te(u,a[l],n))&&(o.length===0||Te(o[0],c,n))}return e.length===t.length&&e.every((s,a)=>Te(s,t[a],n))}return Object.keys(e).every(i=>{const r=e[i];return(i in t||ei(o=r)&&o[De]().matcherType==="optional")&&Te(r,t[i],n);var o})}return Object.is(t,e)},Oe=e=>{var t,n,i;return ir(e)?ei(e)?(t=(n=(i=e[De]()).getSelectionKeys)==null?void 0:n.call(i))!=null?t:[]:Array.isArray(e)?En(e,Oe):En(Object.values(e),Oe):[]},En=(e,t)=>e.reduce((n,i)=>n.concat(t(i)),[]);function Ml(...e){if(e.length===1){const[t]=e;return n=>Te(t,n,()=>{})}if(e.length===2){const[t,n]=e;return Te(t,n,()=>{})}throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${e.length}.`)}function je(e){return Object.assign(e,{optional:()=>or(e),and:t=>ue(e,t),or:t=>cs(e,t),select:t=>t===void 0?Sn(e):Sn(t,e)})}function rr(e){return Object.assign((t=>Object.assign(t,{*[Symbol.iterator](){yield Object.assign(t,{[as]:!0})}}))(e),{optional:()=>rr(or(e)),select:t=>rr(t===void 0?Sn(e):Sn(t,e))})}function or(e){return je({[De]:()=>({match:t=>{let n={};const i=(r,o)=>{n[r]=o};return t===void 0?(Oe(e).forEach(r=>i(r,void 0)),{matched:!0,selections:n}):{matched:Te(e,t,i),selections:n}},getSelectionKeys:()=>Oe(e),matcherType:"optional"})})}const hl=(e,t)=>{for(const n of e)if(!t(n))return!1;return!0},yl=(e,t)=>{for(const[n,i]of e.entries())if(!t(i,n))return!1;return!0};function ue(...e){return je({[De]:()=>({match:t=>{let n={};const i=(r,o)=>{n[r]=o};return{matched:e.every(r=>Te(r,t,i)),selections:n}},getSelectionKeys:()=>En(e,Oe),matcherType:"and"})})}function cs(...e){return je({[De]:()=>({match:t=>{let n={};const i=(r,o)=>{n[r]=o};return En(e,Oe).forEach(r=>i(r,void 0)),{matched:e.some(r=>Te(r,t,i)),selections:n}},getSelectionKeys:()=>En(e,Oe),matcherType:"or"})})}function J(e){return{[De]:()=>({match:t=>({matched:!!e(t)})})}}function Sn(...e){const t=typeof e[0]=="string"?e[0]:void 0,n=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return je({[De]:()=>({match:i=>{let r={[t??Jn]:i};return{matched:n===void 0||Te(n,i,(o,s)=>{r[o]=s}),selections:r}},getSelectionKeys:()=>[t??Jn].concat(n===void 0?[]:Oe(n))})})}function nt(e){return typeof e=="number"}function zt(e){return typeof e=="string"}function Nt(e){return typeof e=="bigint"}const us=je(J(function(e){return!0})),ml=us,_t=e=>Object.assign(je(e),{startsWith:t=>{return _t(ue(e,(n=t,J(i=>zt(i)&&i.startsWith(n)))));var n},endsWith:t=>{return _t(ue(e,(n=t,J(i=>zt(i)&&i.endsWith(n)))));var n},minLength:t=>_t(ue(e,(n=>J(i=>zt(i)&&i.length>=n))(t))),maxLength:t=>_t(ue(e,(n=>J(i=>zt(i)&&i.length<=n))(t))),includes:t=>{return _t(ue(e,(n=t,J(i=>zt(i)&&i.includes(n)))));var n},regex:t=>{return _t(ue(e,(n=t,J(i=>zt(i)&&!!i.match(n)))));var n}}),Nl=_t(J(zt)),it=e=>Object.assign(je(e),{between:(t,n)=>it(ue(e,((i,r)=>J(o=>nt(o)&&i<=o&&r>=o))(t,n))),lt:t=>it(ue(e,(n=>J(i=>nt(i)&&i<n))(t))),gt:t=>it(ue(e,(n=>J(i=>nt(i)&&i>n))(t))),lte:t=>it(ue(e,(n=>J(i=>nt(i)&&i<=n))(t))),gte:t=>it(ue(e,(n=>J(i=>nt(i)&&i>=n))(t))),int:()=>it(ue(e,J(t=>nt(t)&&Number.isInteger(t)))),finite:()=>it(ue(e,J(t=>nt(t)&&Number.isFinite(t)))),positive:()=>it(ue(e,J(t=>nt(t)&&t>0))),negative:()=>it(ue(e,J(t=>nt(t)&&t<0)))}),Tl=it(J(nt)),Tt=e=>Object.assign(je(e),{between:(t,n)=>Tt(ue(e,((i,r)=>J(o=>Nt(o)&&i<=o&&r>=o))(t,n))),lt:t=>Tt(ue(e,(n=>J(i=>Nt(i)&&i<n))(t))),gt:t=>Tt(ue(e,(n=>J(i=>Nt(i)&&i>n))(t))),lte:t=>Tt(ue(e,(n=>J(i=>Nt(i)&&i<=n))(t))),gte:t=>Tt(ue(e,(n=>J(i=>Nt(i)&&i>=n))(t))),positive:()=>Tt(ue(e,J(t=>Nt(t)&&t>0))),negative:()=>Tt(ue(e,J(t=>Nt(t)&&t<0)))}),Ll=Tt(J(Nt)),jl=je(J(function(e){return typeof e=="boolean"})),Al=je(J(function(e){return typeof e=="symbol"})),El=je(J(function(e){return e==null}));var Sl={__proto__:null,matcher:De,optional:or,array:function(...e){return rr({[De]:()=>({match:t=>{if(!Array.isArray(t))return{matched:!1};if(e.length===0)return{matched:!0};const n=e[0];let i={};if(t.length===0)return Oe(n).forEach(o=>{i[o]=[]}),{matched:!0,selections:i};const r=(o,s)=>{i[o]=(i[o]||[]).concat([s])};return{matched:t.every(o=>Te(n,o,r)),selections:i}},getSelectionKeys:()=>e.length===0?[]:Oe(e[0])})})},set:function(...e){return je({[De]:()=>({match:t=>{if(!(t instanceof Set))return{matched:!1};let n={};if(t.size===0)return{matched:!0,selections:n};if(e.length===0)return{matched:!0};const i=(o,s)=>{n[o]=(n[o]||[]).concat([s])},r=e[0];return{matched:hl(t,o=>Te(r,o,i)),selections:n}},getSelectionKeys:()=>e.length===0?[]:Oe(e[0])})})},map:function(...e){return je({[De]:()=>({match:t=>{if(!(t instanceof Map))return{matched:!1};let n={};if(t.size===0)return{matched:!0,selections:n};const i=(a,c)=>{n[a]=(n[a]||[]).concat([c])};if(e.length===0)return{matched:!0};var r;if(e.length===1)throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(r=e[0])==null?void 0:r.toString()}`);const[o,s]=e;return{matched:yl(t,(a,c)=>{const u=Te(o,c,i),l=Te(s,a,i);return u&&l}),selections:n}},getSelectionKeys:()=>e.length===0?[]:[...Oe(e[0]),...Oe(e[1])]})})},intersection:ue,union:cs,not:function(e){return je({[De]:()=>({match:t=>({matched:!Te(e,t,()=>{})}),getSelectionKeys:()=>[],matcherType:"not"})})},when:J,select:Sn,any:us,_:ml,string:Nl,number:Tl,bigint:Ll,boolean:jl,symbol:Al,nullish:El,instanceOf:function(e){return je(J(function(t){return n=>n instanceof t}(e)))},shape:function(e){return je(J(Ml(e)))}};const sr={matched:!1,value:void 0};function pl(e){return new ti(e,sr)}class ti{constructor(t,n){this.input=void 0,this.state=void 0,this.input=t,this.state=n}with(...t){if(this.state.matched)return this;const n=t[t.length-1],i=[t[0]];let r;t.length===3&&typeof t[1]=="function"?(i.push(t[0]),r=t[1]):t.length>2&&i.push(...t.slice(1,t.length-1));let o=!1,s={};const a=(u,l)=>{o=!0,s[u]=l},c=!i.some(u=>Te(u,this.input,a))||r&&!r(this.input)?sr:{matched:!0,value:n(o?Jn in s?s[Jn]:s:this.input,this.input)};return new ti(this.input,c)}when(t,n){if(this.state.matched)return this;const i=!!t(this.input);return new ti(this.input,i?{matched:!0,value:n(this.input,this.input)}:sr)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){return this.run()}run(){if(this.state.matched)return this.state.value;let t;try{t=JSON.stringify(this.input)}catch{t=this.input}throw new Error(`Pattern matching error: no pattern matches value ${t}`)}returnType(){return this}}const Le={PROCESSING:{key:"PROCESSING",reticleType:"processing",minDuration:1e3},SIDE_CAPTURED:{key:"SIDE_CAPTURED",reticleType:"flip",minDuration:3e3},DOCUMENT_CAPTURED:{key:"DOCUMENT_CAPTURED",reticleType:"done",minDuration:1e3},SENSING_FRONT:{key:"SENSING_FRONT",reticleType:"searching",minDuration:1e3},SENSING_BACK:{key:"SENSING_BACK",reticleType:"searching",minDuration:1e3},DOCUMENT_FRAMING_CAMERA_TOO_FAR:{key:"DOCUMENT_FRAMING_CAMERA_TOO_FAR",reticleType:"error",minDuration:1500},DOCUMENT_FRAMING_CAMERA_TOO_CLOSE:{key:"DOCUMENT_FRAMING_CAMERA_TOO_CLOSE",reticleType:"error",minDuration:1500},DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE_ANIMATION:{key:"DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE_ANIMATION",reticleType:"rotate",minDuration:3e3},DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE:{key:"DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE",reticleType:"error",minDuration:1500},DOCUMENT_FRAMING_CAMERA_ANGLE_TOO_STEEP:{key:"DOCUMENT_FRAMING_CAMERA_ANGLE_TOO_STEEP",reticleType:"error",minDuration:1500},DOCUMENT_TOO_CLOSE_TO_FRAME_EDGE:{key:"DOCUMENT_TOO_CLOSE_TO_FRAME_EDGE",reticleType:"error",minDuration:1500},LIGHTING_TOO_DARK:{key:"LIGHTING_TOO_DARK",reticleType:"error",minDuration:1500},LIGHTING_TOO_BRIGHT:{key:"LIGHTING_TOO_BRIGHT",reticleType:"error",minDuration:1500},BLUR_DETECTED:{key:"BLUR_DETECTED",reticleType:"error",minDuration:1500},GLARE_DETECTED:{key:"GLARE_DETECTED",reticleType:"error",minDuration:1500},OCCLUDED:{key:"OCCLUDED",reticleType:"error",minDuration:1500},WRONG_SIDE:{key:"WRONG_SIDE",reticleType:"error",minDuration:1500}};class Il{timeWindow=3e3;decayRate=.95;eventStack=[];currentUiState=Le.SENSING_FRONT;currentStateStartTime=performance.now();reset(){this.eventStack=[]}getUiState(t){const n=performance.now(),i={stateKey:this.getUiStateKeyFromResult(t),timeStamp:n,currentWeight:1};if(i.stateKey==="SIDE_CAPTURED"||i.stateKey==="DOCUMENT_CAPTURED")return this.eventStack=[],Le[i.stateKey];this.eventStack.push(i);const r={};if(this.eventStack.forEach(s=>{if(n-s.timeStamp>this.timeWindow){this.eventStack.shift();return}const a=s.timeStamp/n;s.currentWeight*=this.decayRate*a,r[s.stateKey]||(r[s.stateKey]=[]),r[s.stateKey].push(s.currentWeight)}),n-this.currentStateStartTime<this.currentUiState.minDuration)return this.currentUiState;const o={};for(const s in r){const a=s,c=s.length/this.eventStack.length,u=r[a].reduce((l,g)=>l+g,0);o[a]=u*c}try{const s=Jo(o),a=Le[s];return a!==this.currentUiState&&(this.currentUiState=a,this.currentStateStartTime=n),a}catch{return this.currentUiState}}getUiStateKeyFromResult(t){return pl(t).with({frameCaptured:!0,captureState:Sl.when(n=>n==="first-side-capture-in-progress"||n==="second-side-capture-in-progress")},()=>"PROCESSING").with({captureState:"first-side-capture-in-progress",frameAnalysisStatus:{framingStatus:"no-document"}},()=>"SENSING_FRONT").with({captureState:"second-side-capture-in-progress",frameAnalysisStatus:{framingStatus:"no-document"}},()=>"SENSING_BACK").with({captureState:"document-captured"},()=>"DOCUMENT_CAPTURED").with({captureState:"side-captured"},()=>"SIDE_CAPTURED").with({frameAnalysisStatus:{sideAnalysisStatus:"side-already-captured"}},()=>"WRONG_SIDE").with({frameAnalysisStatus:{framingStatus:"camera-angle-too-steep"}},()=>"DOCUMENT_FRAMING_CAMERA_ANGLE_TOO_STEEP").with({frameAnalysisStatus:{framingStatus:"camera-too-close"}},()=>"DOCUMENT_FRAMING_CAMERA_TOO_CLOSE").with({frameAnalysisStatus:{framingStatus:"camera-orientation-unsuitable"}},()=>"DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE").with({frameAnalysisStatus:{framingStatus:"camera-too-far"}},()=>"DOCUMENT_FRAMING_CAMERA_TOO_FAR").with({frameAnalysisStatus:{framingStatus:"document-too-close-to-frame-edge"}},()=>"DOCUMENT_TOO_CLOSE_TO_FRAME_EDGE").with({frameAnalysisStatus:{lightingStatus:"too-bright"}},()=>"LIGHTING_TOO_BRIGHT").with({frameAnalysisStatus:{lightingStatus:"too-dark"}},()=>"LIGHTING_TOO_DARK").with({frameAnalysisStatus:{blurStatus:"blur-detected"}},()=>"BLUR_DETECTED").with({frameAnalysisStatus:{glareStatus:"glare-detected"}},()=>"GLARE_DETECTED").with({frameAnalysisStatus:{occlusionStatus:"occluded"}},()=>"OCCLUDED").otherwise(()=>"SENSING_FRONT")}}const ar=new Il,cr=document.createElement("canvas"),ni=cr.getContext("2d",{willReadFrequently:!0,alpha:!1});function wl(e,t=!1){if(!ni)throw new Error("CanvasRenderingContext2D is missing!");const n=e.videoWidth,i=e.videoHeight;return cr.width=n,cr.height=i,ni.drawImage(e,0,0,n,i),t&&ni.scale(-1,1),ni.getImageData(0,0,n,i)}const xl=e=>(t,n,i)=>{const r=i.subscribe;return i.subscribe=(s,a,c)=>{let u=s;if(a){const l=c?.equalityFn||Object.is;let g=s(i.getState());u=f=>{const h=s(f);if(!l(g,h)){const d=g;a(g=h,d)}},c?.fireImmediately&&a(g,g)}return r(u)},e(t,n,i)},ls=e=>{let t;const n=new Set,i=(c,u)=>{const l=typeof c=="function"?c(t):c;if(!Object.is(l,t)){const g=t;t=u??typeof l!="object"?l:Object.assign({},t,l),n.forEach(f=>f(t,g))}},r=()=>t,a={setState:i,getState:r,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{n.clear()}};return t=e(i,r,a),a},Dl=e=>e?ls(e):ls,fs={cameras:[],videoElement:null,selectedCamera:null,isPlaying:!1,isCapturing:!1,isSwappingCamera:!1,isQueryingCameras:!1,callbacks:{},mirrorX:!1,uiState:structuredClone(Le.SENSING_FRONT),captureRequiresLandscape:!1,initialized:!1,errorState:null,analyzerSettings:{}},k=Dl()(xl(()=>structuredClone(fs))),ds=()=>{console.log("resetting zustand store"),k.getState().cameras.forEach(e=>{e.stopStream()}),k.setState(structuredClone(fs))};let ur,ii;class bl{#e;#t;constructor(t){this.#e=t}setupVideoElement(t){new Ct(i=>{i[0].connected||(k.setState({videoElement:null}),this.cancelCapture())}).observe(t),t.playsInline=!0,t.setAttribute("muted","")}async updateAnalyzerSettings(t){if(k.getState().isCapturing){console.warn("Cancel the capture process using `cancelCapture()` before updating settings");return}try{await this.#e.updateSettings(t)}catch(n){console.error("Error updating analyzer settings",n)}}async selectCamera(t){const n=k.getState();if(n.selectedCamera===t){console.warn("Already selected");return}if(n.isSwappingCamera)return;const i=n.selectedCamera;k.setState({isSwappingCamera:!0}),i&&i.stopStream(),n.videoElement&&(n.videoElement.srcObject=null);try{const r=await t.startStream();n.videoElement&&(n.videoElement.srcObject=r,n.isPlaying&&await n.videoElement.play()),k.setState({selectedCamera:t,isSwappingCamera:!1})}catch(r){console.error(r)}}async updateCameraDevices(){if(k.getState().isQueryingCameras||k.getState().isSwappingCamera)return;k.setState({isQueryingCameras:!0});const t=await ol();if(t.length<1)throw new Error("No capable devices found! Your camera needs to have a minimum resolution of 1920x1080");nl(t);const n=il(t),i=t.find(r=>r.deviceInfo.deviceId===n);k.setState({cameras:t,selectedCamera:i,isQueryingCameras:!1})}async startPlayback(){const t=k.getState();if(!t.isPlaying){if(!t.videoElement){console.warn("No video element present.");return}if(!t.videoElement.srcObject){console.warn("No source present. Start a camera stream first.");return}if(!t.selectedCamera){console.warn("No selected camera");return}await t.selectedCamera.startStream(),await t.videoElement.play(),k.setState({isPlaying:!0}),t.isCapturing===!0&&t.videoElement.requestVideoFrameCallback(()=>void this.#n())}}async startCameraStream(t,n=!0){if(k.getState().isPlaying){console.warn("Already streaming");return}if(k.getState().selectedCamera)console.log("Reusing previous device");else try{await this.updateCameraDevices()}catch(c){k.setState({errorState:Ji(c)});return}const i=k.getState();if(!i.selectedCamera){console.warn("No selected camera!");return}const r=await i.selectedCamera.startStream(),o=r.getVideoTracks()[0],s=o.getSettings();if(!s.width||!s.height)throw new Error("Video doesn't have dimensions!");if(!t.isConnected)throw new Error("Video element needs to be in the document!");k.getState().videoElement||this.setupVideoElement(t),t.srcObject=r,t.width=s.width,t.height=s.height,o.getSettings().facingMode==="environment"?k.setState({mirrorX:!1}):k.setState({mirrorX:!0}),k.setState({videoElement:t}),n&&await this.startPlayback()}async startCapture(){const t=k.getState();if(!t.isCapturing){if(!t.videoElement){console.warn("Missing video element");return}if(!t.selectedCamera){console.warn("No active camera!");return}await this.startPlayback(),k.getState().isPlaying&&(k.setState({isCapturing:!0}),this.#t=t.videoElement.requestVideoFrameCallback(()=>void this.#n()))}}pauseCapture(){const t=k.getState().videoElement;t&&this.#t&&t.cancelVideoFrameCallback(this.#t),k.setState({isCapturing:!1})}async cancelCapture(){await this.resetCapture(),ar.reset(),this.pauseCapture(),k.setState({uiState:Le.SENSING_FRONT})}async resetCapture(){await this.#e.resetCapture(),this.#i()}async stopStream(){console.log("stopStream called");const t=k.getState();if(t.selectedCamera?.stopStream(),await this.cancelCapture(),!t.videoElement){console.log("no video element");return}t.videoElement.srcObject=null,this.pausePlayback()}async finishSideCapture(){return await this.#e.finishSideCapture()}pausePlayback(){console.log("pausePlayback called");const t=k.getState();if(!t.videoElement){k.setState({isPlaying:!1});return}this.pauseCapture(),t.videoElement.pause(),k.setState({isPlaying:!1})}#i(){k.setState({captureRequiresLandscape:!1})}async#n(){const t=k.getState();if(!t.isCapturing||!t.isPlaying)return;if(!t.videoElement){console.error("Missing video element");return}const n=t.callbacks?.onFrameAnalysis,i=typeof n=="function",r=wl(t.videoElement);ur=new ImageData(Uint8ClampedArray.from(r.data),r.width,r.height);const o=await this.#e.analyze(r);if("error"in o){k.setState({errorState:Ji(o.error)});return}const s=ar.getUiState(o);if(i)try{n(o,ur),window.setTimeout(()=>ur=null,0)}catch(a){throw console.warn("onFrameAnalysis callback exception"),a}if(s.key==="DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE"){if(!k.getState().captureRequiresLandscape){this.pauseCapture();const a=Le.DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE_ANIMATION;k.setState({uiState:a,captureRequiresLandscape:!0}),await new Promise(c=>setTimeout(c,a.minDuration)),await this.startCapture();return}k.setState({uiState:Le.DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE})}if(s.key==="SIDE_CAPTURED"){this.pauseCapture(),k.setState({uiState:Le.SIDE_CAPTURED}),await new Promise(a=>setTimeout(a,Le.SIDE_CAPTURED.minDuration)),await this.startCapture();return}if(s.key==="DOCUMENT_CAPTURED"){this.pausePlayback(),k.setState({uiState:Le.DOCUMENT_CAPTURED}),await new Promise(c=>setTimeout(c,Le.DOCUMENT_CAPTURED.minDuration));const a=await this.#e.getResult();try{t.callbacks?.onCaptureResult?.(a)}catch(c){console.warn("onCaptureResult callback exception",c)}this.#i();return}k.setState({uiState:s}),this.#t=t.videoElement.requestVideoFrameCallback(()=>void this.#n())}setCallbacks(t){k.setState({callbacks:t})}setMirrorX(t){k.setState({mirrorX:t})}subscribe=k.subscribe;getState=k.getState;async destroy(){console.info("Destroying Capture SDK instance"),ds(),await this.#e.terminateWorker()}}async function gs(e){try{if(!window.isSecureContext)throw new Error(qi`
14
+ `;let u="";if(n.useBlob){const l=new Blob([c+s],{type:is});u=URL.createObjectURL(l)}else u=`data:${is},`+encodeURIComponent(c+s);r(u)}).catch(()=>{o(new Error(`Failed to fetch worker from ${e}`))}))},cl=async(e=window.location.href)=>{const t=await al(e+"/resources/capture-worker.js"),n=new Worker(t);n.onerror=r=>{console.error("Worker error:",r)};const i=Fo(n);return await i.setResourceUrl(e+"/resources"),i};let rs=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");const os="capture-userid";function ul(){if(!ll())return rs();const t=localStorage.getItem(os);if(t)return t;const n=rs();return localStorage.setItem(os,n),n}function ll(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch{return!1}}function fl(e){return{licenseId:e.licenseId,licensee:e.licensee,applicationIds:e.applicationIds,packageName:e.packageName,platform:"Browser",sdkName:e.sdkName,sdkVersion:e.sdkVersion}}async function dl(e){try{return await(await fetch("https://baltazar.microblink.com/api/v2/status/check",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-cache",body:JSON.stringify(fl(e))})).json()}catch(t){throw console.error(t),t}}class gl{#e;#t;constructor(t,n){this.#e=t,this.#t=n}analyze=async t=>{const n=sl(t);return await this.#e.analyze(Go(n,[n.data.buffer]))};finishSideCapture=async()=>await this.#t.finishSideCapture();getResult=async()=>await this.#t.getResult();getSettings=async()=>await this.#t.getSettings();updateSettings=async t=>{const i={...await this.getSettings(),...t};await this.#t.updateSettings(i)};resetCapture=async()=>{await this.#t.reset()};async terminateWorker(){await this.#e.terminate()}}async function ss(e){const t=await cl(e.resourceUrl),n=ul(),i=await t.loadWasm(),r=await i.initializeWithLicenseKey(e.licenseKey,n,!1);if(r.unlockResult===Vi.RequiresServerPermission){const u=await dl(r),l=await i.submitServerPermission(JSON.stringify(u));if(console.log(l),l.status!==Ki.Ok)throw new Error("Server unlock not ok.")}const o=await t.createAnalyzer();if(!o)throw new Error("Failed to create analyzer");let a={...await o.getSettings(),minimumDocumentDpi:220};return e.analyzerSettings&&Object.assign(a,e.analyzerSettings),await o.updateSettings(a),new gl(t,o)}const De=Symbol.for("@ts-pattern/matcher"),as=Symbol.for("@ts-pattern/isVariadic"),Jn="@ts-pattern/anonymous-select-key",ir=e=>!!(e&&typeof e=="object"),ei=e=>e&&!!e[De],Te=(e,t,n)=>{if(ei(e)){const i=e[De](),{matched:r,selections:o}=i.match(t);return r&&o&&Object.keys(o).forEach(s=>n(s,o[s])),r}if(ir(e)){if(!ir(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let i=[],r=[],o=[];for(const s of e.keys()){const a=e[s];ei(a)&&a[as]?o.push(a):o.length?r.push(a):i.push(a)}if(o.length){if(o.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<i.length+r.length)return!1;const s=t.slice(0,i.length),a=r.length===0?[]:t.slice(-r.length),c=t.slice(i.length,r.length===0?1/0:-r.length);return i.every((u,l)=>Te(u,s[l],n))&&r.every((u,l)=>Te(u,a[l],n))&&(o.length===0||Te(o[0],c,n))}return e.length===t.length&&e.every((s,a)=>Te(s,t[a],n))}return Object.keys(e).every(i=>{const r=e[i];return(i in t||ei(o=r)&&o[De]().matcherType==="optional")&&Te(r,t[i],n);var o})}return Object.is(t,e)},Oe=e=>{var t,n,i;return ir(e)?ei(e)?(t=(n=(i=e[De]()).getSelectionKeys)==null?void 0:n.call(i))!=null?t:[]:Array.isArray(e)?En(e,Oe):En(Object.values(e),Oe):[]},En=(e,t)=>e.reduce((n,i)=>n.concat(t(i)),[]);function Ml(...e){if(e.length===1){const[t]=e;return n=>Te(t,n,()=>{})}if(e.length===2){const[t,n]=e;return Te(t,n,()=>{})}throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${e.length}.`)}function je(e){return Object.assign(e,{optional:()=>or(e),and:t=>ue(e,t),or:t=>cs(e,t),select:t=>t===void 0?Sn(e):Sn(t,e)})}function rr(e){return Object.assign((t=>Object.assign(t,{*[Symbol.iterator](){yield Object.assign(t,{[as]:!0})}}))(e),{optional:()=>rr(or(e)),select:t=>rr(t===void 0?Sn(e):Sn(t,e))})}function or(e){return je({[De]:()=>({match:t=>{let n={};const i=(r,o)=>{n[r]=o};return t===void 0?(Oe(e).forEach(r=>i(r,void 0)),{matched:!0,selections:n}):{matched:Te(e,t,i),selections:n}},getSelectionKeys:()=>Oe(e),matcherType:"optional"})})}const hl=(e,t)=>{for(const n of e)if(!t(n))return!1;return!0},yl=(e,t)=>{for(const[n,i]of e.entries())if(!t(i,n))return!1;return!0};function ue(...e){return je({[De]:()=>({match:t=>{let n={};const i=(r,o)=>{n[r]=o};return{matched:e.every(r=>Te(r,t,i)),selections:n}},getSelectionKeys:()=>En(e,Oe),matcherType:"and"})})}function cs(...e){return je({[De]:()=>({match:t=>{let n={};const i=(r,o)=>{n[r]=o};return En(e,Oe).forEach(r=>i(r,void 0)),{matched:e.some(r=>Te(r,t,i)),selections:n}},getSelectionKeys:()=>En(e,Oe),matcherType:"or"})})}function J(e){return{[De]:()=>({match:t=>({matched:!!e(t)})})}}function Sn(...e){const t=typeof e[0]=="string"?e[0]:void 0,n=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return je({[De]:()=>({match:i=>{let r={[t??Jn]:i};return{matched:n===void 0||Te(n,i,(o,s)=>{r[o]=s}),selections:r}},getSelectionKeys:()=>[t??Jn].concat(n===void 0?[]:Oe(n))})})}function nt(e){return typeof e=="number"}function zt(e){return typeof e=="string"}function Nt(e){return typeof e=="bigint"}const us=je(J(function(e){return!0})),ml=us,_t=e=>Object.assign(je(e),{startsWith:t=>{return _t(ue(e,(n=t,J(i=>zt(i)&&i.startsWith(n)))));var n},endsWith:t=>{return _t(ue(e,(n=t,J(i=>zt(i)&&i.endsWith(n)))));var n},minLength:t=>_t(ue(e,(n=>J(i=>zt(i)&&i.length>=n))(t))),maxLength:t=>_t(ue(e,(n=>J(i=>zt(i)&&i.length<=n))(t))),includes:t=>{return _t(ue(e,(n=t,J(i=>zt(i)&&i.includes(n)))));var n},regex:t=>{return _t(ue(e,(n=t,J(i=>zt(i)&&!!i.match(n)))));var n}}),Nl=_t(J(zt)),it=e=>Object.assign(je(e),{between:(t,n)=>it(ue(e,((i,r)=>J(o=>nt(o)&&i<=o&&r>=o))(t,n))),lt:t=>it(ue(e,(n=>J(i=>nt(i)&&i<n))(t))),gt:t=>it(ue(e,(n=>J(i=>nt(i)&&i>n))(t))),lte:t=>it(ue(e,(n=>J(i=>nt(i)&&i<=n))(t))),gte:t=>it(ue(e,(n=>J(i=>nt(i)&&i>=n))(t))),int:()=>it(ue(e,J(t=>nt(t)&&Number.isInteger(t)))),finite:()=>it(ue(e,J(t=>nt(t)&&Number.isFinite(t)))),positive:()=>it(ue(e,J(t=>nt(t)&&t>0))),negative:()=>it(ue(e,J(t=>nt(t)&&t<0)))}),Tl=it(J(nt)),Tt=e=>Object.assign(je(e),{between:(t,n)=>Tt(ue(e,((i,r)=>J(o=>Nt(o)&&i<=o&&r>=o))(t,n))),lt:t=>Tt(ue(e,(n=>J(i=>Nt(i)&&i<n))(t))),gt:t=>Tt(ue(e,(n=>J(i=>Nt(i)&&i>n))(t))),lte:t=>Tt(ue(e,(n=>J(i=>Nt(i)&&i<=n))(t))),gte:t=>Tt(ue(e,(n=>J(i=>Nt(i)&&i>=n))(t))),positive:()=>Tt(ue(e,J(t=>Nt(t)&&t>0))),negative:()=>Tt(ue(e,J(t=>Nt(t)&&t<0)))}),Ll=Tt(J(Nt)),jl=je(J(function(e){return typeof e=="boolean"})),Al=je(J(function(e){return typeof e=="symbol"})),El=je(J(function(e){return e==null}));var Sl={__proto__:null,matcher:De,optional:or,array:function(...e){return rr({[De]:()=>({match:t=>{if(!Array.isArray(t))return{matched:!1};if(e.length===0)return{matched:!0};const n=e[0];let i={};if(t.length===0)return Oe(n).forEach(o=>{i[o]=[]}),{matched:!0,selections:i};const r=(o,s)=>{i[o]=(i[o]||[]).concat([s])};return{matched:t.every(o=>Te(n,o,r)),selections:i}},getSelectionKeys:()=>e.length===0?[]:Oe(e[0])})})},set:function(...e){return je({[De]:()=>({match:t=>{if(!(t instanceof Set))return{matched:!1};let n={};if(t.size===0)return{matched:!0,selections:n};if(e.length===0)return{matched:!0};const i=(o,s)=>{n[o]=(n[o]||[]).concat([s])},r=e[0];return{matched:hl(t,o=>Te(r,o,i)),selections:n}},getSelectionKeys:()=>e.length===0?[]:Oe(e[0])})})},map:function(...e){return je({[De]:()=>({match:t=>{if(!(t instanceof Map))return{matched:!1};let n={};if(t.size===0)return{matched:!0,selections:n};const i=(a,c)=>{n[a]=(n[a]||[]).concat([c])};if(e.length===0)return{matched:!0};var r;if(e.length===1)throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(r=e[0])==null?void 0:r.toString()}`);const[o,s]=e;return{matched:yl(t,(a,c)=>{const u=Te(o,c,i),l=Te(s,a,i);return u&&l}),selections:n}},getSelectionKeys:()=>e.length===0?[]:[...Oe(e[0]),...Oe(e[1])]})})},intersection:ue,union:cs,not:function(e){return je({[De]:()=>({match:t=>({matched:!Te(e,t,()=>{})}),getSelectionKeys:()=>[],matcherType:"not"})})},when:J,select:Sn,any:us,_:ml,string:Nl,number:Tl,bigint:Ll,boolean:jl,symbol:Al,nullish:El,instanceOf:function(e){return je(J(function(t){return n=>n instanceof t}(e)))},shape:function(e){return je(J(Ml(e)))}};const sr={matched:!1,value:void 0};function pl(e){return new ti(e,sr)}class ti{constructor(t,n){this.input=void 0,this.state=void 0,this.input=t,this.state=n}with(...t){if(this.state.matched)return this;const n=t[t.length-1],i=[t[0]];let r;t.length===3&&typeof t[1]=="function"?(i.push(t[0]),r=t[1]):t.length>2&&i.push(...t.slice(1,t.length-1));let o=!1,s={};const a=(u,l)=>{o=!0,s[u]=l},c=!i.some(u=>Te(u,this.input,a))||r&&!r(this.input)?sr:{matched:!0,value:n(o?Jn in s?s[Jn]:s:this.input,this.input)};return new ti(this.input,c)}when(t,n){if(this.state.matched)return this;const i=!!t(this.input);return new ti(this.input,i?{matched:!0,value:n(this.input,this.input)}:sr)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){return this.run()}run(){if(this.state.matched)return this.state.value;let t;try{t=JSON.stringify(this.input)}catch{t=this.input}throw new Error(`Pattern matching error: no pattern matches value ${t}`)}returnType(){return this}}const Le={PROCESSING:{key:"PROCESSING",reticleType:"processing",minDuration:1e3},SIDE_CAPTURED:{key:"SIDE_CAPTURED",reticleType:"flip",minDuration:3e3},DOCUMENT_CAPTURED:{key:"DOCUMENT_CAPTURED",reticleType:"done",minDuration:1e3},SENSING_FRONT:{key:"SENSING_FRONT",reticleType:"searching",minDuration:1e3},SENSING_BACK:{key:"SENSING_BACK",reticleType:"searching",minDuration:1e3},DOCUMENT_FRAMING_CAMERA_TOO_FAR:{key:"DOCUMENT_FRAMING_CAMERA_TOO_FAR",reticleType:"error",minDuration:1500},DOCUMENT_FRAMING_CAMERA_TOO_CLOSE:{key:"DOCUMENT_FRAMING_CAMERA_TOO_CLOSE",reticleType:"error",minDuration:1500},DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE_ANIMATION:{key:"DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE_ANIMATION",reticleType:"rotate",minDuration:3e3},DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE:{key:"DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE",reticleType:"error",minDuration:1500},DOCUMENT_FRAMING_CAMERA_ANGLE_TOO_STEEP:{key:"DOCUMENT_FRAMING_CAMERA_ANGLE_TOO_STEEP",reticleType:"error",minDuration:1500},DOCUMENT_TOO_CLOSE_TO_FRAME_EDGE:{key:"DOCUMENT_TOO_CLOSE_TO_FRAME_EDGE",reticleType:"error",minDuration:1500},LIGHTING_TOO_DARK:{key:"LIGHTING_TOO_DARK",reticleType:"error",minDuration:1500},LIGHTING_TOO_BRIGHT:{key:"LIGHTING_TOO_BRIGHT",reticleType:"error",minDuration:1500},BLUR_DETECTED:{key:"BLUR_DETECTED",reticleType:"error",minDuration:1500},GLARE_DETECTED:{key:"GLARE_DETECTED",reticleType:"error",minDuration:1500},OCCLUDED:{key:"OCCLUDED",reticleType:"error",minDuration:1500},WRONG_SIDE:{key:"WRONG_SIDE",reticleType:"error",minDuration:1500}};class Il{timeWindow=3e3;decayRate=.95;eventStack=[];currentUiState=Le.SENSING_FRONT;currentStateStartTime=performance.now();reset(){this.eventStack=[]}getUiState(t){const n=performance.now(),i={stateKey:this.getUiStateKeyFromResult(t),timeStamp:n,currentWeight:1};if(i.stateKey==="SIDE_CAPTURED"||i.stateKey==="DOCUMENT_CAPTURED")return this.eventStack=[],Le[i.stateKey];this.eventStack.push(i);const r={};if(this.eventStack.forEach(s=>{if(n-s.timeStamp>this.timeWindow){this.eventStack.shift();return}const a=s.timeStamp/n;s.currentWeight*=this.decayRate*a,r[s.stateKey]||(r[s.stateKey]=[]),r[s.stateKey].push(s.currentWeight)}),n-this.currentStateStartTime<this.currentUiState.minDuration)return this.currentUiState;const o={};for(const s in r){const a=s,c=s.length/this.eventStack.length,u=r[a].reduce((l,g)=>l+g,0);o[a]=u*c}try{const s=Jo(o),a=Le[s];return a!==this.currentUiState&&(this.currentUiState=a,this.currentStateStartTime=n),a}catch{return this.currentUiState}}getUiStateKeyFromResult(t){return pl(t).with({frameCaptured:!0,captureState:Sl.when(n=>n==="first-side-capture-in-progress"||n==="second-side-capture-in-progress")},()=>"PROCESSING").with({captureState:"first-side-capture-in-progress",frameAnalysisStatus:{framingStatus:"no-document"}},()=>"SENSING_FRONT").with({captureState:"second-side-capture-in-progress",frameAnalysisStatus:{framingStatus:"no-document"}},()=>"SENSING_BACK").with({captureState:"document-captured"},()=>"DOCUMENT_CAPTURED").with({captureState:"side-captured"},()=>"SIDE_CAPTURED").with({frameAnalysisStatus:{sideAnalysisStatus:"side-already-captured"}},()=>"WRONG_SIDE").with({frameAnalysisStatus:{framingStatus:"camera-angle-too-steep"}},()=>"DOCUMENT_FRAMING_CAMERA_ANGLE_TOO_STEEP").with({frameAnalysisStatus:{framingStatus:"camera-too-close"}},()=>"DOCUMENT_FRAMING_CAMERA_TOO_CLOSE").with({frameAnalysisStatus:{framingStatus:"camera-orientation-unsuitable"}},()=>"DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE").with({frameAnalysisStatus:{framingStatus:"camera-too-far"}},()=>"DOCUMENT_FRAMING_CAMERA_TOO_FAR").with({frameAnalysisStatus:{framingStatus:"document-too-close-to-frame-edge"}},()=>"DOCUMENT_TOO_CLOSE_TO_FRAME_EDGE").with({frameAnalysisStatus:{lightingStatus:"too-bright"}},()=>"LIGHTING_TOO_BRIGHT").with({frameAnalysisStatus:{lightingStatus:"too-dark"}},()=>"LIGHTING_TOO_DARK").with({frameAnalysisStatus:{blurStatus:"blur-detected"}},()=>"BLUR_DETECTED").with({frameAnalysisStatus:{glareStatus:"glare-detected"}},()=>"GLARE_DETECTED").with({frameAnalysisStatus:{occlusionStatus:"occluded"}},()=>"OCCLUDED").otherwise(()=>"SENSING_FRONT")}}const ar=new Il,cr=document.createElement("canvas"),ni=cr.getContext("2d",{willReadFrequently:!0,alpha:!1});function wl(e,t=!1){if(!ni)throw new Error("CanvasRenderingContext2D is missing!");const n=e.videoWidth,i=e.videoHeight;return cr.width=n,cr.height=i,ni.drawImage(e,0,0,n,i),t&&ni.scale(-1,1),ni.getImageData(0,0,n,i)}const xl=e=>(t,n,i)=>{const r=i.subscribe;return i.subscribe=(s,a,c)=>{let u=s;if(a){const l=c?.equalityFn||Object.is;let g=s(i.getState());u=f=>{const h=s(f);if(!l(g,h)){const d=g;a(g=h,d)}},c?.fireImmediately&&a(g,g)}return r(u)},e(t,n,i)},ls=e=>{let t;const n=new Set,i=(c,u)=>{const l=typeof c=="function"?c(t):c;if(!Object.is(l,t)){const g=t;t=u??typeof l!="object"?l:Object.assign({},t,l),n.forEach(f=>f(t,g))}},r=()=>t,a={setState:i,getState:r,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{n.clear()}};return t=e(i,r,a),a},Dl=e=>e?ls(e):ls,fs={cameras:[],videoElement:null,selectedCamera:null,isPlaying:!1,isCapturing:!1,isSwappingCamera:!1,isQueryingCameras:!1,callbacks:{},mirrorX:!1,uiState:structuredClone(Le.SENSING_FRONT),captureRequiresLandscape:!1,initialized:!1,errorState:null,analyzerSettings:{}},k=Dl()(xl(()=>structuredClone(fs))),ds=()=>{console.log("resetting zustand store"),k.getState().cameras.forEach(e=>{e.stopStream()}),k.setState(structuredClone(fs))};let ur,ii;class bl{#e;#t;constructor(t){this.#e=t}setupVideoElement(t){new Ct(i=>{i[0].connected||(k.setState({videoElement:null}),this.cancelCapture())}).observe(t),t.playsInline=!0,t.setAttribute("muted","")}async updateAnalyzerSettings(t){if(k.getState().isCapturing){console.warn("Cancel the capture process using `cancelCapture()` before updating settings");return}try{await this.#e.updateSettings(t)}catch(n){console.error("Error updating analyzer settings",n)}}async selectCamera(t){const n=k.getState();if(n.selectedCamera===t){console.warn("Already selected");return}if(n.isSwappingCamera)return;const i=n.selectedCamera;k.setState({isSwappingCamera:!0}),i&&i.stopStream(),n.videoElement&&(n.videoElement.srcObject=null);try{const r=await t.startStream();n.videoElement&&(n.videoElement.srcObject=r,n.isPlaying&&await n.videoElement.play()),k.setState({selectedCamera:t,isSwappingCamera:!1})}catch(r){console.error(r)}}async updateCameraDevices(){if(k.getState().isQueryingCameras||k.getState().isSwappingCamera)return;k.setState({isQueryingCameras:!0});const t=await ol();if(t.length<1)throw new Error("No capable devices found! Your camera needs to have a minimum resolution of 1920x1080");nl(t);const n=il(t),i=t.find(r=>r.deviceInfo.deviceId===n);k.setState({cameras:t,selectedCamera:i,isQueryingCameras:!1})}async startPlayback(){const t=k.getState();if(!t.isPlaying){if(!t.videoElement){console.warn("No video element present.");return}if(!t.videoElement.srcObject){console.warn("No source present. Start a camera stream first.");return}if(!t.selectedCamera){console.warn("No selected camera");return}await t.selectedCamera.startStream(),await t.videoElement.play(),k.setState({isPlaying:!0}),t.isCapturing===!0&&t.videoElement.requestVideoFrameCallback(()=>void this.#n())}}async startCameraStream(t,n=!0){if(k.getState().isPlaying){console.warn("Already streaming");return}if(k.getState().selectedCamera)console.log("Reusing previous device");else try{await this.updateCameraDevices()}catch(c){k.setState({errorState:Ji(c)});return}const i=k.getState();if(!i.selectedCamera){console.warn("No selected camera!");return}const r=await i.selectedCamera.startStream(),o=r.getVideoTracks()[0],s=o.getSettings();if(!s.width||!s.height)throw new Error("Video doesn't have dimensions!");if(!t.isConnected)throw new Error("Video element needs to be in the document!");k.getState().videoElement||this.setupVideoElement(t),t.srcObject=r,t.width=s.width,t.height=s.height,o.getSettings().facingMode==="environment"?k.setState({mirrorX:!1}):k.setState({mirrorX:!0}),k.setState({videoElement:t}),n&&await this.startPlayback()}async startCapture(){const t=k.getState();if(!t.isCapturing){if(!t.videoElement){console.warn("Missing video element");return}if(!t.selectedCamera){console.warn("No active camera!");return}await this.startPlayback(),k.getState().isPlaying&&(k.setState({isCapturing:!0}),this.#t=t.videoElement.requestVideoFrameCallback(()=>void this.#n()))}}pauseCapture(){const t=k.getState().videoElement;t&&this.#t&&t.cancelVideoFrameCallback(this.#t),k.setState({isCapturing:!1})}async cancelCapture(){await this.resetCapture(),ar.reset(),this.pauseCapture(),k.setState({uiState:Le.SENSING_FRONT})}async resetCapture(){await this.#e.resetCapture(),this.#i()}async stopStream(){console.log("stopStream called");const t=k.getState();if(t.selectedCamera?.stopStream(),await this.cancelCapture(),!t.videoElement){console.log("no video element");return}t.videoElement.srcObject=null,this.pausePlayback()}async finishSideCapture(){return await this.#e.finishSideCapture()}pausePlayback(){console.log("pausePlayback called");const t=k.getState();if(!t.videoElement){k.setState({isPlaying:!1});return}this.pauseCapture(),t.videoElement.pause(),k.setState({isPlaying:!1})}#i(){k.setState({captureRequiresLandscape:!1})}async#n(){const t=k.getState();if(!t.isCapturing||!t.isPlaying)return;if(!t.videoElement){console.error("Missing video element");return}const n=t.callbacks?.onFrameAnalysis,i=typeof n=="function",r=wl(t.videoElement);ur=new ImageData(Uint8ClampedArray.from(r.data),r.width,r.height);const o=await this.#e.analyze(r);if("error"in o){k.setState({errorState:Ji(o.error)});return}const s=ar.getUiState(o);if(i)try{n(o,ur),window.setTimeout(()=>ur=null,0)}catch(a){throw console.warn("onFrameAnalysis callback exception"),a}if(s.key==="DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE"){if(!k.getState().captureRequiresLandscape){this.pauseCapture();const a=Le.DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE_ANIMATION;k.setState({uiState:a,captureRequiresLandscape:!0}),await new Promise(c=>setTimeout(c,a.minDuration)),await this.startCapture();return}k.setState({uiState:Le.DOCUMENT_FRAMING_CAMERA_ORIENTATION_UNSUITABLE})}if(s.key==="SIDE_CAPTURED"){this.pauseCapture(),k.setState({uiState:Le.SIDE_CAPTURED}),await new Promise(a=>setTimeout(a,Le.SIDE_CAPTURED.minDuration)),await this.startCapture();return}if(s.key==="DOCUMENT_CAPTURED"){this.pausePlayback(),k.setState({uiState:Le.DOCUMENT_CAPTURED}),await new Promise(c=>setTimeout(c,Le.DOCUMENT_CAPTURED.minDuration));const a=await this.#e.getResult();try{t.callbacks?.onCaptureResult?.(a)}catch(c){console.warn("onCaptureResult callback exception",c)}this.#i();return}k.setState({uiState:s}),this.#t=t.videoElement.requestVideoFrameCallback(()=>void this.#n())}setCallbacks(t){k.setState({callbacks:t})}setMirrorX(t){k.setState({mirrorX:t})}subscribe=k.subscribe;getState=k.getState;async destroy(){console.info("Destroying Capture SDK instance"),ds(),await this.#e.terminateWorker()}}async function gs(e){try{if(!window.isSecureContext)throw new Error(qi`
15
15
  Can't load the SDK outside a secure context:
16
16
  https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
17
17
  `);if(k.getState().initialized&&ii)return console.warn("Already initialized, reusing previous SDK instance."),ii;const{callbacks:t,...n}=e,i=await ss(n),r=await i.getSettings();return k.setState({analyzerSettings:r}),t&&k.setState({callbacks:t}),k.setState({initialized:!0}),ii=new bl(i),ii}catch(t){throw k.setState({errorState:Ji(t)}),t}}const Ms={context:void 0,registry:void 0},vl=(e,t)=>e===t,Fe=Symbol("solid-proxy"),ri=Symbol("solid-track"),oi={equals:vl};let hs=Ls;const lt=1,si=2,ys={owned:null,cleanups:null,context:null,owner:null};var ee=null;let lr=null,oe=null,Ae=null,ft=null,ai=0;const[Ol,Yy]=P(!1);function kt(e,t){const n=oe,i=ee,r=e.length===0,o=t===void 0?i:t,s=r?ys:{owned:null,cleanups:null,context:o?o.context:null,owner:o},a=r?e:()=>e(()=>ye(()=>di(s)));ee=s,oe=null;try{return jt(a,!0)}finally{oe=n,ee=i}}function P(e,t){t=t?Object.assign({},oi,t):oi;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},i=r=>(typeof r=="function"&&(r=r(n.value)),Ts(n,r));return[Ns.bind(n),i]}function ms(e,t,n){const i=ui(e,t,!0,lt);$t(i)}function Be(e,t,n){const i=ui(e,t,!1,lt);$t(i)}function H(e,t,n){hs=Pl;const i=ui(e,t,!1,lt);(!n||!n.render)&&(i.user=!0),ft?ft.push(i):$t(i)}function Y(e,t,n){n=n?Object.assign({},oi,n):oi;const i=ui(e,t,!0,0);return i.observers=null,i.observerSlots=null,i.comparator=n.equals||void 0,$t(i),Ns.bind(i)}function fr(e){return jt(e,!1)}function ye(e){if(oe===null)return e();const t=oe;oe=null;try{return e()}finally{oe=t}}function Ze(e,t,n){const i=Array.isArray(e);let r,o=n&&n.defer;return s=>{let a;if(i){a=Array(e.length);for(let u=0;u<e.length;u++)a[u]=e[u]()}else a=e();if(o){o=!1;return}const c=ye(()=>t(a,r,s));return r=a,c}}function Lt(e){H(()=>ye(e))}function V(e){return ee===null||(ee.cleanups===null?ee.cleanups=[e]:ee.cleanups.push(e)),e}function dr(){return oe}function Cl(){return ee}function zl(e,t){const n=ee,i=oe;ee=e,oe=null;try{return jt(t,!0)}catch(r){gr(r)}finally{ee=n,oe=i}}function _l(e){const t=oe,n=ee;return Promise.resolve().then(()=>{oe=t,ee=n;let i;return jt(e,!1),oe=ee=null,i?i.done:void 0})}function kl(){return[Ol,_l]}function Ce(e,t){const n=Symbol("context");return{id:n,Provider:Fl(n),defaultValue:e}}function ze(e){return ee&&ee.context&&ee.context[e.id]!==void 0?ee.context[e.id]:e.defaultValue}function ci(e){const t=Y(e),n=Y(()=>Mr(t()));return n.toArray=()=>{const i=n();return Array.isArray(i)?i:i!=null?[i]:[]},n}function Ns(){if(this.sources&&this.state)if(this.state===lt)$t(this);else{const e=Ae;Ae=null,jt(()=>fi(this),!1),Ae=e}if(oe){const e=this.observers?this.observers.length:0;oe.sources?(oe.sources.push(this),oe.sourceSlots.push(e)):(oe.sources=[this],oe.sourceSlots=[e]),this.observers?(this.observers.push(oe),this.observerSlots.push(oe.sources.length-1)):(this.observers=[oe],this.observerSlots=[oe.sources.length-1])}return this.value}function Ts(e,t,n){let i=e.value;return(!e.comparator||!e.comparator(i,t))&&(e.value=t,e.observers&&e.observers.length&&jt(()=>{for(let r=0;r<e.observers.length;r+=1){const o=e.observers[r],s=lr&&lr.running;s&&lr.disposed.has(o),(s?!o.tState:!o.state)&&(o.pure?Ae.push(o):ft.push(o),o.observers&&js(o)),s||(o.state=lt)}if(Ae.length>1e6)throw Ae=[],new Error},!1)),t}function $t(e){if(!e.fn)return;di(e);const t=ee,n=oe,i=ai;oe=ee=e,Ul(e,e.value,i),oe=n,ee=t}function Ul(e,t,n){let i;try{i=e.fn(t)}catch(r){return e.pure&&(e.state=lt,e.owned&&e.owned.forEach(di),e.owned=null),e.updatedAt=n+1,gr(r)}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?Ts(e,i):e.value=i,e.updatedAt=n)}function ui(e,t,n,i=lt,r){const o={fn:e,state:i,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:ee,context:ee?ee.context:null,pure:n};return ee===null||ee!==ys&&(ee.owned?ee.owned.push(o):ee.owned=[o]),o}function li(e){if(e.state===0)return;if(e.state===si)return fi(e);if(e.suspense&&ye(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<ai);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===lt)$t(e);else if(e.state===si){const i=Ae;Ae=null,jt(()=>fi(e,t[0]),!1),Ae=i}}function jt(e,t){if(Ae)return e();let n=!1;t||(Ae=[]),ft?n=!0:ft=[],ai++;try{const i=e();return Yl(n),i}catch(i){n||(ft=null),Ae=null,gr(i)}}function Yl(e){if(Ae&&(Ls(Ae),Ae=null),e)return;const t=ft;ft=null,t.length&&jt(()=>hs(t),!1)}function Ls(e){for(let t=0;t<e.length;t++)li(e[t])}function Pl(e){let t,n=0;for(t=0;t<e.length;t++){const i=e[t];i.user?e[n++]=i:li(i)}for(t=0;t<n;t++)li(e[t])}function fi(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const i=e.sources[n];if(i.sources){const r=i.state;r===lt?i!==t&&(!i.updatedAt||i.updatedAt<ai)&&li(i):r===si&&fi(i,t)}}}function js(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=si,n.pure?Ae.push(n):ft.push(n),n.observers&&js(n))}}function di(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),i=e.sourceSlots.pop(),r=n.observers;if(r&&r.length){const o=r.pop(),s=n.observerSlots.pop();i<r.length&&(o.sourceSlots[s]=i,r[i]=o,n.observerSlots[i]=s)}}if(e.owned){for(t=e.owned.length-1;t>=0;t--)di(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function Rl(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function gr(e,t=ee){throw Rl(e)}function Mr(e){if(typeof e=="function"&&!e.length)return Mr(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const i=Mr(e[n]);Array.isArray(i)?t.push.apply(t,i):t.push(i)}return t}return e}function Fl(e,t){return function(i){let r;return Be(()=>r=ye(()=>(ee.context={...ee.context,[e]:i.value},ci(()=>i.children))),void 0),r}}const Bl=Symbol("fallback");function As(e){for(let t=0;t<e.length;t++)e[t]()}function Hl(e,t,n={}){let i=[],r=[],o=[],s=0,a=t.length>1?[]:null;return V(()=>As(o)),()=>{let c=e()||[],u,l;return c[ri],ye(()=>{let f=c.length,h,d,M,y,m,T,N,j,A;if(f===0)s!==0&&(As(o),o=[],i=[],r=[],s=0,a&&(a=[])),n.fallback&&(i=[Bl],r[0]=kt(E=>(o[0]=E,n.fallback())),s=1);else if(s===0){for(r=new Array(f),l=0;l<f;l++)i[l]=c[l],r[l]=kt(g);s=f}else{for(M=new Array(f),y=new Array(f),a&&(m=new Array(f)),T=0,N=Math.min(s,f);T<N&&i[T]===c[T];T++);for(N=s-1,j=f-1;N>=T&&j>=T&&i[N]===c[j];N--,j--)M[j]=r[N],y[j]=o[N],a&&(m[j]=a[N]);for(h=new Map,d=new Array(j+1),l=j;l>=T;l--)A=c[l],u=h.get(A),d[l]=u===void 0?-1:u,h.set(A,l);for(u=T;u<=N;u++)A=i[u],l=h.get(A),l!==void 0&&l!==-1?(M[l]=r[u],y[l]=o[u],a&&(m[l]=a[u]),l=d[l],h.set(A,l)):o[u]();for(l=T;l<f;l++)l in M?(r[l]=M[l],o[l]=y[l],a&&(a[l]=m[l],a[l](l))):r[l]=kt(g);r=r.slice(0,s=f),i=c.slice(0)}return r});function g(f){if(o[l]=f,a){const[h,d]=P(l);return a[l]=d,t(c[l],h)}return t(c[l])}}}function L(e,t){return ye(()=>e(t||{}))}function gi(){return!0}const hr={get(e,t,n){return t===Fe?n:e.get(t)},has(e,t){return t===Fe?!0:e.has(t)},set:gi,deleteProperty:gi,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:gi,deleteProperty:gi}},ownKeys(e){return e.keys()}};function yr(e){return(e=typeof e=="function"?e():e)?e:{}}function Ql(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function q(...e){let t=!1;for(let o=0;o<e.length;o++){const s=e[o];t=t||!!s&&Fe in s,e[o]=typeof s=="function"?(t=!0,Y(s)):s}if(t)return new Proxy({get(o){for(let s=e.length-1;s>=0;s--){const a=yr(e[s])[o];if(a!==void 0)return a}},has(o){for(let s=e.length-1;s>=0;s--)if(o in yr(e[s]))return!0;return!1},keys(){const o=[];for(let s=0;s<e.length;s++)o.push(...Object.keys(yr(e[s])));return[...new Set(o)]}},hr);const n={},i={},r=new Set;for(let o=e.length-1;o>=0;o--){const s=e[o];if(!s)continue;const a=Object.getOwnPropertyNames(s);for(let c=0,u=a.length;c<u;c++){const l=a[c];if(l==="__proto__"||l==="constructor")continue;const g=Object.getOwnPropertyDescriptor(s,l);if(!r.has(l))g.get?(r.add(l),Object.defineProperty(n,l,{enumerable:!0,configurable:!0,get:Ql.bind(i[l]=[g.get.bind(s)])})):(g.value!==void 0&&r.add(l),n[l]=g.value);else{const f=i[l];f?g.get?f.push(g.get.bind(s)):g.value!==void 0&&f.push(()=>g.value):n[l]===void 0&&(n[l]=g.value)}}}return n}function ae(e,...t){if(Fe in e){const r=new Set(t.length>1?t.flat():t[0]),o=t.map(s=>new Proxy({get(a){return s.includes(a)?e[a]:void 0},has(a){return s.includes(a)&&a in e},keys(){return s.filter(a=>a in e)}},hr));return o.push(new Proxy({get(s){return r.has(s)?void 0:e[s]},has(s){return r.has(s)?!1:s in e},keys(){return Object.keys(e).filter(s=>!r.has(s))}},hr)),o}const n={},i=t.map(()=>({}));for(const r of Object.getOwnPropertyNames(e)){const o=Object.getOwnPropertyDescriptor(e,r),s=!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable;let a=!1,c=0;for(const u of t)u.includes(r)&&(a=!0,s?i[c][r]=o.value:Object.defineProperty(i[c],r,o)),++c;a||(s?n[r]=o.value:Object.defineProperty(n,r,o))}return[...i,n]}let Gl=0;function Wt(){const e=Ms.context;return e?`${e.id}${e.count++}`:`cl-${Gl++}`}const Es=e=>`Stale read from <${e}>.`;function Ss(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Y(Hl(()=>e.each,e.children,t||void 0))}function he(e){const t=e.keyed,n=Y(()=>e.when,void 0,{equals:(i,r)=>t?i===r:!i==!r});return Y(()=>{const i=n();if(i){const r=e.children;return typeof r=="function"&&r.length>0?ye(()=>r(t?i:()=>{if(!ye(n))throw Es("Show");return e.when})):r}return e.fallback},void 0,void 0)}function mr(e){let t=!1;const n=(o,s)=>o[0]===s[0]&&(t?o[1]===s[1]:!o[1]==!s[1])&&o[2]===s[2],i=ci(()=>e.children),r=Y(()=>{let o=i();Array.isArray(o)||(o=[o]);for(let s=0;s<o.length;s++){const a=o[s].when;if(a)return t=!!o[s].keyed,[s,a,o[s]]}return[-1]},void 0,{equals:n});return Y(()=>{const[o,s,a]=r();if(o<0)return e.fallback;const c=a.children;return typeof c=="function"&&c.length>0?ye(()=>c(t?s:()=>{if(ye(r)[0]!==o)throw Es("Match");return a.when})):c},void 0,void 0)}function rt(e){return e}const Vl=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],Kl=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...Vl]),$l=new Set(["innerHTML","textContent","innerText","children"]),Wl=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),Zl=Object.assign(Object.create(null),{class:"className",formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function ql(e,t){const n=Zl[e];return typeof n=="object"?n[t]?n.$:void 0:n}const Xl=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),Jl=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),ef={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function tf(e,t,n){let i=n.length,r=t.length,o=i,s=0,a=0,c=t[r-1].nextSibling,u=null;for(;s<r||a<o;){if(t[s]===n[a]){s++,a++;continue}for(;t[r-1]===n[o-1];)r--,o--;if(r===s){const l=o<i?a?n[a-1].nextSibling:n[o-a]:c;for(;a<o;)e.insertBefore(n[a++],l)}else if(o===a)for(;s<r;)(!u||!u.has(t[s]))&&t[s].remove(),s++;else if(t[s]===n[o-1]&&n[a]===t[r-1]){const l=t[--r].nextSibling;e.insertBefore(n[a++],t[s++].nextSibling),e.insertBefore(n[--o],l),t[r]=n[o]}else{if(!u){u=new Map;let g=a;for(;g<o;)u.set(n[g],g++)}const l=u.get(t[s]);if(l!=null)if(a<l&&l<o){let g=s,f=1,h;for(;++g<r&&g<o&&!((h=u.get(t[g]))==null||h!==l+f);)f++;if(f>l-a){const d=t[s];for(;a<l;)e.insertBefore(n[a++],d)}else e.replaceChild(n[a++],t[s++])}else s++;else t[s++].remove()}}}const ps="_$DX_DELEGATE";function nf(e,t,n,i={}){let r;return kt(o=>{r=o,t===document?e():G(t,e(),t.firstChild?null:void 0,n)},i.owner),()=>{r(),t.textContent=""}}function ne(e,t,n){let i;const r=()=>{const s=document.createElement("template");return s.innerHTML=e,n?s.content.firstChild.firstChild:s.content.firstChild},o=t?()=>ye(()=>document.importNode(i||(i=r()),!0)):()=>(i||(i=r())).cloneNode(!0);return o.cloneNode=o,o}function rf(e,t=window.document){const n=t[ps]||(t[ps]=new Set);for(let i=0,r=e.length;i<r;i++){const o=e[i];n.has(o)||(n.add(o),t.addEventListener(o,ff))}}function At(e,t,n){n==null?e.removeAttribute(t):e.setAttribute(t,n)}function of(e,t,n,i){i==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,i)}function ge(e,t){t==null?e.removeAttribute("class"):e.className=t}function sf(e,t,n,i){if(i)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const r=n[0];e.addEventListener(t,n[0]=o=>r.call(e,n[1],o))}else e.addEventListener(t,n)}function af(e,t,n={}){const i=Object.keys(t||{}),r=Object.keys(n);let o,s;for(o=0,s=r.length;o<s;o++){const a=r[o];!a||a==="undefined"||t[a]||(ws(e,a,!1),delete n[a])}for(o=0,s=i.length;o<s;o++){const a=i[o],c=!!t[a];!a||a==="undefined"||n[a]===c||!c||(ws(e,a,!0),n[a]=c)}return n}function cf(e,t,n){if(!t)return n?At(e,"style"):t;const i=e.style;if(typeof t=="string")return i.cssText=t;typeof n=="string"&&(i.cssText=n=void 0),n||(n={}),t||(t={});let r,o;for(o in n)t[o]==null&&i.removeProperty(o),delete n[o];for(o in t)r=t[o],r!==n[o]&&(i.setProperty(o,r),n[o]=r);return n}function be(e,t={},n,i){const r={};return i||Be(()=>r.children=Zt(e,t.children,r.children)),Be(()=>t.ref&&t.ref(e)),Be(()=>uf(e,t,n,!0,r,!0)),r}function Is(e,t,n){return ye(()=>e(t,n))}function G(e,t,n,i){if(n!==void 0&&!i&&(i=[]),typeof t!="function")return Zt(e,t,i,n);Be(r=>Zt(e,t(),r,n),i)}function uf(e,t,n,i,r={},o=!1){t||(t={});for(const s in r)if(!(s in t)){if(s==="children")continue;r[s]=xs(e,s,null,r[s],n,o)}for(const s in t){if(s==="children"){i||Zt(e,t.children);continue}const a=t[s];r[s]=xs(e,s,a,r[s],n,o)}}function lf(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function ws(e,t,n){const i=t.trim().split(/\s+/);for(let r=0,o=i.length;r<o;r++)e.classList.toggle(i[r],n)}function xs(e,t,n,i,r,o){let s,a,c,u,l;if(t==="style")return cf(e,n,i);if(t==="classList")return af(e,n,i);if(n===i)return i;if(t==="ref")o||n(e);else if(t.slice(0,3)==="on:"){const g=t.slice(3);i&&e.removeEventListener(g,i),n&&e.addEventListener(g,n)}else if(t.slice(0,10)==="oncapture:"){const g=t.slice(10);i&&e.removeEventListener(g,i,!0),n&&e.addEventListener(g,n,!0)}else if(t.slice(0,2)==="on"){const g=t.slice(2).toLowerCase(),f=Xl.has(g);if(!f&&i){const h=Array.isArray(i)?i[0]:i;e.removeEventListener(g,h)}(f||n)&&(sf(e,g,n,f),f&&rf([g]))}else if(t.slice(0,5)==="attr:")At(e,t.slice(5),n);else if((l=t.slice(0,5)==="prop:")||(c=$l.has(t))||!r&&((u=ql(t,e.tagName))||(a=Kl.has(t)))||(s=e.nodeName.includes("-")))l&&(t=t.slice(5),a=!0),t==="class"||t==="className"?ge(e,n):s&&!a&&!c?e[lf(t)]=n:e[u||t]=n;else{const g=r&&t.indexOf(":")>-1&&ef[t.split(":")[0]];g?of(e,g,t,n):At(e,Wl[t]||t,n)}return n}function ff(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return n||document}});n;){const i=n[t];if(i&&!n.disabled){const r=n[`${t}Data`];if(r!==void 0?i.call(n,r,e):i.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function Zt(e,t,n,i,r){for(;typeof n=="function";)n=n();if(t===n)return n;const o=typeof t,s=i!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o==="string"||o==="number")if(o==="number"&&(t=t.toString()),s){let a=n[0];a&&a.nodeType===3?a.data=t:a=document.createTextNode(t),n=qt(e,n,i,a)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t;else if(t==null||o==="boolean")n=qt(e,n,i);else{if(o==="function")return Be(()=>{let a=t();for(;typeof a=="function";)a=a();n=Zt(e,a,n,i)}),()=>n;if(Array.isArray(t)){const a=[],c=n&&Array.isArray(n);if(Nr(a,t,n,r))return Be(()=>n=Zt(e,a,n,i,!0)),()=>n;if(a.length===0){if(n=qt(e,n,i),s)return n}else c?n.length===0?Ds(e,a,i):tf(e,n,a):(n&&qt(e),Ds(e,a));n=a}else if(t.nodeType){if(Array.isArray(n)){if(s)return n=qt(e,n,i,t);qt(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function Nr(e,t,n,i){let r=!1;for(let o=0,s=t.length;o<s;o++){let a=t[o],c=n&&n[o],u;if(!(a==null||a===!0||a===!1))if((u=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))r=Nr(e,a,c)||r;else if(u==="function")if(i){for(;typeof a=="function";)a=a();r=Nr(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||r}else e.push(a),r=!0;else{const l=String(a);c&&c.nodeType===3&&c.data===l?e.push(c):e.push(document.createTextNode(l))}}return r}function Ds(e,t,n=null){for(let i=0,r=t.length;i<r;i++)e.insertBefore(t[i],n)}function qt(e,t,n,i){if(n===void 0)return e.textContent="";const r=i||document.createTextNode("");if(t.length){let o=!1;for(let s=t.length-1;s>=0;s--){const a=t[s];if(r!==a){const c=a.parentNode===e;!o&&!s?c?e.replaceChild(r,a):e.insertBefore(r,n):c&&a.remove()}else o=!0}}else e.insertBefore(r,n);return[r]}const df="http://www.w3.org/2000/svg";function bs(e,t=!1){return t?document.createElementNS(df,e):document.createElement(e)}function Tr(e){const{useShadow:t}=e,n=document.createTextNode(""),i=()=>e.mount||document.body,r=Cl();let o,s=!!Ms.context;return H(()=>{o||(o=zl(r,()=>Y(()=>e.children)));const a=i();if(a instanceof HTMLHeadElement){const[c,u]=P(!1),l=()=>u(!0);kt(g=>G(a,()=>c()?g():o(),null)),V(l)}else{const c=bs(e.isSVG?"g":"div",e.isSVG),u=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),G(u,o),a.appendChild(c),e.ref&&e.ref(c),V(()=>a.removeChild(c))}},void 0,{render:!s}),n}function pn(e){const[t,n]=ae(e,["component"]),i=Y(()=>t.component);return Y(()=>{const r=i();switch(typeof r){case"function":return ye(()=>r(n));case"string":const o=Jl.has(r),s=bs(r,o);return be(s,n,o),s}})}var gf=function(t){return Mf(t)&&!hf(t)};function Mf(e){return!!e&&typeof e=="object"}function hf(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||Nf(e)}var yf=typeof Symbol=="function"&&Symbol.for,mf=yf?Symbol.for("react.element"):60103;function Nf(e){return e.$$typeof===mf}function Tf(e){return Array.isArray(e)?[]:{}}function In(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Xt(Tf(e),e,t):e}function Lf(e,t,n){return e.concat(t).map(function(i){return In(i,n)})}function jf(e,t){if(!t.customMerge)return Xt;var n=t.customMerge(e);return typeof n=="function"?n:Xt}function Af(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function vs(e){return Object.keys(e).concat(Af(e))}function Os(e,t){try{return t in e}catch{return!1}}function Ef(e,t){return Os(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function Sf(e,t,n){var i={};return n.isMergeableObject(e)&&vs(e).forEach(function(r){i[r]=In(e[r],n)}),vs(t).forEach(function(r){Ef(e,r)||(Os(e,r)&&n.isMergeableObject(t[r])?i[r]=jf(r,n)(e[r],t[r],n):i[r]=In(t[r],n))}),i}function Xt(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||Lf,n.isMergeableObject=n.isMergeableObject||gf,n.cloneUnlessOtherwiseSpecified=In;var i=Array.isArray(t),r=Array.isArray(e),o=i===r;return o?i?n.arrayMerge(e,t,n):Sf(e,t,n):In(t,n)}Xt.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(i,r){return Xt(i,r,n)},{})};var pf=Xt,If=pf;const wf=Xo(If);function xf(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}const Lr=Symbol("store-raw"),Jt=Symbol("store-node"),dt=Symbol("store-has"),Cs=Symbol("store-self");function zs(e){let t=e[Fe];if(!t&&(Object.defineProperty(e,Fe,{value:t=new Proxy(e,vf)}),!Array.isArray(e))){const n=Object.keys(e),i=Object.getOwnPropertyDescriptors(e);for(let r=0,o=n.length;r<o;r++){const s=n[r];i[s].get&&Object.defineProperty(e,s,{enumerable:i[s].enumerable,get:i[s].get.bind(t)})}}return t}function Et(e){let t;return e!=null&&typeof e=="object"&&(e[Fe]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function en(e,t=new Set){let n,i,r,o;if(n=e!=null&&e[Lr])return n;if(!Et(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let s=0,a=e.length;s<a;s++)r=e[s],(i=en(r,t))!==r&&(e[s]=i)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);const s=Object.keys(e),a=Object.getOwnPropertyDescriptors(e);for(let c=0,u=s.length;c<u;c++)o=s[c],!a[o].get&&(r=e[o],(i=en(r,t))!==r&&(e[o]=i))}return e}function Mi(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function wn(e,t,n){if(e[t])return e[t];const[i,r]=P(n,{equals:!1,internal:!0});return i.$=r,e[t]=i}function Df(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===Fe||t===Jt||(delete n.value,delete n.writable,n.get=()=>e[Fe][t]),n}function _s(e){dr()&&wn(Mi(e,Jt),Cs)()}function bf(e){return _s(e),Reflect.ownKeys(e)}const vf={get(e,t,n){if(t===Lr)return e;if(t===Fe)return n;if(t===ri)return _s(e),n;const i=Mi(e,Jt),r=i[t];let o=r?r():e[t];if(t===Jt||t===dt||t==="__proto__")return o;if(!r){const s=Object.getOwnPropertyDescriptor(e,t);dr()&&(typeof o!="function"||e.hasOwnProperty(t))&&!(s&&s.get)&&(o=wn(i,t,o)())}return Et(o)?zs(o):o},has(e,t){return t===Lr||t===Fe||t===ri||t===Jt||t===dt||t==="__proto__"?!0:(dr()&&wn(Mi(e,dt),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:bf,getOwnPropertyDescriptor:Df};function He(e,t,n,i=!1){if(!i&&e[t]===n)return;const r=e[t],o=e.length;n===void 0?(delete e[t],e[dt]&&e[dt][t]&&r!==void 0&&e[dt][t].$()):(e[t]=n,e[dt]&&e[dt][t]&&r===void 0&&e[dt][t].$());let s=Mi(e,Jt),a;if((a=wn(s,t,r))&&a.$(()=>n),Array.isArray(e)&&e.length!==o){for(let c=e.length;c<o;c++)(a=s[c])&&a.$();(a=wn(s,"length",o))&&a.$(e.length)}(a=s[Cs])&&a.$()}function ks(e,t){const n=Object.keys(t);for(let i=0;i<n.length;i+=1){const r=n[i];He(e,r,t[r])}}function Of(e,t){if(typeof t=="function"&&(t=t(e)),t=en(t),Array.isArray(t)){if(e===t)return;let n=0,i=t.length;for(;n<i;n++){const r=t[n];e[n]!==r&&He(e,n,r)}He(e,"length",i)}else ks(e,t)}function xn(e,t,n=[]){let i,r=e;if(t.length>1){i=t.shift();const s=typeof i,a=Array.isArray(e);if(Array.isArray(i)){for(let c=0;c<i.length;c++)xn(e,[i[c]].concat(t),n);return}else if(a&&s==="function"){for(let c=0;c<e.length;c++)i(e[c],c)&&xn(e,[c].concat(t),n);return}else if(a&&s==="object"){const{from:c=0,to:u=e.length-1,by:l=1}=i;for(let g=c;g<=u;g+=l)xn(e,[g].concat(t),n);return}else if(t.length>1){xn(e[i],t,[i].concat(n));return}r=e[i],n=[i].concat(n)}let o=t[0];typeof o=="function"&&(o=o(r,n),o===r)||i===void 0&&o==null||(o=en(o),i===void 0||Et(r)&&Et(o)&&!Array.isArray(o)?ks(r,o):He(e,i,o))}function jr(...[e,t]){const n=en(e||{}),i=Array.isArray(n),r=zs(n);function o(...s){fr(()=>{i&&s.length===1?Of(n,s[0]):xn(n,s)})}return[r,o]}const Ar=Symbol("store-root");function tn(e,t,n,i,r){const o=t[n];if(e===o)return;if(n!==Ar&&(!Et(e)||!Et(o)||r&&e[r]!==o[r])){He(t,n,e);return}if(Array.isArray(e)){if(e.length&&o.length&&(!i||r&&e[0]&&e[0][r]!=null)){let c,u,l,g,f,h,d,M;for(l=0,g=Math.min(o.length,e.length);l<g&&(o[l]===e[l]||r&&o[l]&&e[l]&&o[l][r]===e[l][r]);l++)tn(e[l],o,l,i,r);const y=new Array(e.length),m=new Map;for(g=o.length-1,f=e.length-1;g>=l&&f>=l&&(o[g]===e[f]||r&&o[l]&&e[l]&&o[g][r]===e[f][r]);g--,f--)y[f]=o[g];if(l>f||l>g){for(u=l;u<=f;u++)He(o,u,e[u]);for(;u<e.length;u++)He(o,u,y[u]),tn(e[u],o,u,i,r);o.length>e.length&&He(o,"length",e.length);return}for(d=new Array(f+1),u=f;u>=l;u--)h=e[u],M=r&&h?h[r]:h,c=m.get(M),d[u]=c===void 0?-1:c,m.set(M,u);for(c=l;c<=g;c++)h=o[c],M=r&&h?h[r]:h,u=m.get(M),u!==void 0&&u!==-1&&(y[u]=o[c],u=d[u],m.set(M,u));for(u=l;u<e.length;u++)u in y?(He(o,u,y[u]),tn(e[u],o,u,i,r)):He(o,u,e[u])}else for(let c=0,u=e.length;c<u;c++)tn(e[c],o,c,i,r);o.length>e.length&&He(o,"length",e.length);return}const s=Object.keys(e);for(let c=0,u=s.length;c<u;c++)tn(e[s[c]],o,s[c],i,r);const a=Object.keys(o);for(let c=0,u=a.length;c<u;c++)e[a[c]]===void 0&&He(o,a[c],void 0)}function Us(e,t={}){const{merge:n,key:i="id"}=t,r=en(e);return o=>{if(!Et(o)||!Et(r))return r;const s=tn(r,{[Ar]:o},Ar,n,i);return s===void 0?o:s}}const Cf={scan_the_front_side:"Scan the front side of the document",flip_document:"Flip the document",scan_the_back_side:"Scan the back side of the document",scanning_wrong_side:"Scanning wrong side",move_closer:"Move closer",move_farther:"Move farther",camera_angle_too_steep:"Keep document parallel to phone",document_too_close_to_edge:"Move farther",rotate_phone_animation:"Rotate card or turn phone to landscape",rotate_phone:"Rotate phone or card",lightning_too_bright:"Move to spot with less lighting",lightning_too_dark:"Move to brighter spot",blur_detected:"Keep document and phone still",glare_detected:"Tilt or move document to remove reflection",occluded:"Keep the document fully visible",need_help_tooltip:"Need help?",onboarding_field_visible_title:"Keep all the details visible",onboarding_field_visible_details:"Make sure you keep the document well lit. All document fields should be visible on the camera screen.",tutorial_fields_visible_title:"Keep all the fields visible",tutorial_fields_visible_start:"Start scanning",tutorial_fields_visible_details:"Make sure you aren’t covering parts of the document with a finger, including the bottom lines. Also, watch out for hologram reflections that go over the document fields.",tutorial_harsh_light_title:"Watch out for harsh light",tutorial_harsh_light_details:"Avoid direct harsh light because it reflects from the document and can make parts of the document unreadable. If you can’t read data on the document, it won’t be visible to the camera either.",tutorial_keep_still_title:"Keep still while scanning",tutorial_keep_still_details:"Try to keep the phone and document still while scanning. Moving either can blur the image and make data on the document unreadable.",camera_unavailable:"Camera Unavailable",camera_permission_error:"App doesn't have permission to use the camera, please change privacy settings",settings:"Settings",camera_media_capture_error:"Unable to capture media",camera_unable_to_resume_session:"Unable to resume",camera_query_in_progress:"Selecting best camera, please wait",done:"Done",cancel:"Cancel",back:"Back",next:"Next",ok:"OK",dismiss:"Dismiss"},Ys=Ce(),zf=e=>{const[t,n]=jr(structuredClone({...Cf,...e.userStrings}));Lt(()=>{e.setLocalizationRef(n)});const i={t,updateLocalization:n};return L(Ys.Provider,{value:i,get children(){return e.children}})};function nn(){const e=ze(Ys);if(!e)throw new Error("LocalizationContext.Provider not in scope.");return e}function Er(e){return(...t)=>{for(const n of e)n&&n(...t)}}function _f(e){return(...t)=>{for(let n=e.length-1;n>=0;n--){const i=e[n];i&&i(...t)}}}var p=e=>typeof e=="function"&&!e.length?e():e,Ps=e=>Array.isArray(e)?e:e?[e]:[];function kf(e,...t){return typeof e=="function"?e(...t):e}var Uf=V;function Yf(e,t,n,i){return e.addEventListener(t,n,i),Uf(e.removeEventListener.bind(e,t,n,i))}function Pf(e,t,n,i){const r=()=>{Ps(p(e)).forEach(o=>{o&&Ps(p(t)).forEach(s=>Yf(o,s,n,i))})};typeof e=="function"?H(r):Be(r)}var Sr=Symbol("fallback");function Rs(e){for(const t of e)t.dispose()}function Rf(e,t,n,i={}){const r=new Map;return V(()=>Rs(r.values())),()=>{const s=e()||[];return s[ri],ye(()=>{if(!s.length)return Rs(r.values()),r.clear(),i.fallback?[kt(g=>(r.set(Sr,{dispose:g}),i.fallback()))]:[];const a=new Array(s.length),c=r.get(Sr);if(!r.size||c){c?.dispose(),r.delete(Sr);for(let l=0;l<s.length;l++){const g=s[l],f=t(g,l);o(a,g,l,f)}return a}const u=new Set(r.keys());for(let l=0;l<s.length;l++){const g=s[l],f=t(g,l);u.delete(f);const h=r.get(f);h?(a[l]=h.mapped,h.setIndex?.(l),h.setItem(()=>g)):o(a,g,l,f)}for(const l of u)r.get(l)?.dispose(),r.delete(l);return a})};function o(s,a,c,u){kt(l=>{const[g,f]=P(a),h={setItem:f,dispose:l};if(n.length>1){const[d,M]=P(c);h.setIndex=M,h.mapped=n(g,d)}else h.mapped=n(g);r.set(u,h),s[c]=h.mapped})}}function Ff(e){const{by:t}=e;return Y(Rf(()=>e.each,typeof t=="function"?t:n=>n[t],e.children,"fallback"in e?{fallback:()=>e.fallback}:void 0))}function Bf(e){const t=typeof e.on=="function"||Array.isArray(e.on)?e.on:()=>e.on;return Y(Ze(t,(n,i)=>{const r=e.children;return typeof r=="function"&&r.length>0?r(n,i):r}))}function hi(){return!0}var Hf={get(e,t,n){return t===Fe?n:e.get(t)},has(e,t){return e.has(t)},set:hi,deleteProperty:hi,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:hi,deleteProperty:hi}},ownKeys(e){return e.keys()}},Qf=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function Fs(e){const t={};let n;for(;n=Qf.exec(e);)t[n[1]]=n[2];return t}function Bs(e,t){if(typeof e=="string"){if(typeof t=="string")return`${e};${t}`;e=Fs(e)}else typeof t=="string"&&(t=Fs(t));return{...e,...t}}var pr=(e,t,n)=>{let i;for(const r of e){const o=p(r)[t];i?o&&(i=n(i,o)):i=o}return i};function Gf(...e){const t=Array.isArray(e[0]),n=t?e[0]:e;if(n.length===1)return n[0];const i=t&&e[1]?.reverseEventHandlers?_f:Er,r={};for(const s of n){const a=p(s);for(const c in a)if(c[0]==="o"&&c[1]==="n"&&c[2]){const u=a[c],l=c.toLowerCase(),g=typeof u=="function"?u:Array.isArray(u)?u.length===1?u[0]:u[0].bind(void 0,u[1]):void 0;g?r[l]?r[l].push(g):r[l]=[g]:delete r[l]}}const o=q(...n);return new Proxy({get(s){if(typeof s!="string")return Reflect.get(o,s);if(s==="style")return pr(n,"style",Bs);if(s==="ref"){const a=[];for(const c of n){const u=p(c)[s];typeof u=="function"&&a.push(u)}return i(a)}if(s[0]==="o"&&s[1]==="n"&&s[2]){const a=r[s.toLowerCase()];return a?i(a):Reflect.get(o,s)}return s==="class"||s==="className"?pr(n,s,(a,c)=>`${a} ${c}`):s==="classList"?pr(n,s,(a,c)=>({...a,...c})):Reflect.get(o,s)},has(s){return Reflect.has(o,s)},keys(){return Object.keys(o)}},Hf)}function _e(...e){return Er(e)}var Hs=e=>e instanceof Element;function Ir(e,t){if(t(e))return e;if(typeof e=="function"&&!e.length)return Ir(e(),t);if(Array.isArray(e))for(const n of e){const i=Ir(n,t);if(i)return i}return null}function Vf(e,t=Hs,n=Hs){const i=Y(e);return Y(()=>Ir(i(),t))}function Qs(e,t){const n=[...e],i=n.indexOf(t);return i!==-1&&n.splice(i,1),n}function Kf(e){return typeof e=="number"}function $f(e){return Array.isArray(e)}function rn(e){return Object.prototype.toString.call(e)==="[object String]"}function wr(e){return typeof e=="function"}function on(e){return t=>`${e()}-${t}`}function Qe(e,t){return e?e===t||e.contains(t):!1}function Dn(e,t=!1){const{activeElement:n}=ke(e);if(!n?.nodeName)return null;if(Gs(n)&&n.contentDocument)return Dn(n.contentDocument.body,t);if(t){const i=n.getAttribute("aria-activedescendant");if(i){const r=ke(n).getElementById(i);if(r)return r}}return n}function xr(e){return ke(e).defaultView||window}function ke(e){return e?e.ownerDocument||e:document}function Gs(e){return e.tagName==="IFRAME"}var Vs=(e=>(e.Escape="Escape",e.Enter="Enter",e.Tab="Tab",e.Space=" ",e.ArrowDown="ArrowDown",e.ArrowLeft="ArrowLeft",e.ArrowRight="ArrowRight",e.ArrowUp="ArrowUp",e.End="End",e.Home="Home",e.PageDown="PageDown",e.PageUp="PageUp",e))(Vs||{});function Ks(e){return typeof window>"u"||window.navigator==null?!1:window.navigator.userAgentData?.brands.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function Dr(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function bn(){return Dr(/^Mac/i)}function Wf(){return Dr(/^iPhone/i)}function Zf(){return Dr(/^iPad/i)||bn()&&navigator.maxTouchPoints>1}function $s(){return Wf()||Zf()}function qf(){return bn()||$s()}function Xf(){return Ks(/AppleWebKit/i)&&!Jf()}function Jf(){return Ks(/Chrome/i)}function Ne(e,t){return t&&(wr(t)?t(e):t[0](t[1],e)),e?.defaultPrevented}function Ge(e){return t=>{for(const n of e)Ne(t,n)}}function ed(e){return bn()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function Ee(e){if(e)if(td())e.focus({preventScroll:!0});else{const t=nd(e);e.focus(),id(t)}}var yi=null;function td(){if(yi==null){yi=!1;try{document.createElement("div").focus({get preventScroll(){return yi=!0,!0}})}catch{}}return yi}function nd(e){let t=e.parentNode;const n=[],i=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==i;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return i instanceof HTMLElement&&n.push({element:i,scrollTop:i.scrollTop,scrollLeft:i.scrollLeft}),n}function id(e){for(const{element:t,scrollTop:n,scrollLeft:i}of e)t.scrollTop=n,t.scrollLeft=i}var Ws=["input:not([type='hidden']):not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","[tabindex]","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]:not([contenteditable='false'])"],rd=[...Ws,'[tabindex]:not([tabindex="-1"]):not([disabled])'],br=Ws.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",od=rd.join(':not([hidden]):not([tabindex="-1"]),');function Zs(e,t){const i=Array.from(e.querySelectorAll(br)).filter(qs);return t&&qs(e)&&i.unshift(e),i.forEach((r,o)=>{if(Gs(r)&&r.contentDocument){const s=r.contentDocument.body,a=Zs(s,!1);i.splice(o,1,...a)}}),i}function qs(e){return Xs(e)&&!sd(e)}function Xs(e){return e.matches(br)&&vr(e)}function sd(e){return parseInt(e.getAttribute("tabindex")||"0",10)<0}function vr(e,t){return e.nodeName!=="#comment"&&ad(e)&&cd(e,t)&&(!e.parentElement||vr(e.parentElement,e))}function ad(e){if(!(e instanceof HTMLElement)&&!(e instanceof SVGElement))return!1;const{display:t,visibility:n}=e.style;let i=t!=="none"&&n!=="hidden"&&n!=="collapse";if(i){if(!e.ownerDocument.defaultView)return i;const{getComputedStyle:r}=e.ownerDocument.defaultView,{display:o,visibility:s}=r(e);i=o!=="none"&&s!=="hidden"&&s!=="collapse"}return i}function cd(e,t){return!e.hasAttribute("hidden")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function ud(e,t){return t.some(n=>n.contains(e))}function ld(e,t,n){const i=t?.tabbable?od:br,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(o){return t?.from?.contains(o)?NodeFilter.FILTER_REJECT:o.matches(i)&&vr(o)&&(!n||ud(o,n))&&(!t?.accept||t.accept(o))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(r.currentNode=t.from),r}function fd(){}function dd(e){return[e.clientX,e.clientY]}function gd(e,t){const[n,i]=e;let r=!1;const o=t.length;for(let s=o,a=0,c=s-1;a<s;c=a++){const[u,l]=t[a],[g,f]=t[c],[,h]=t[c===0?s-1:c-1]||[0,0],d=(l-f)*(n-u)-(u-g)*(i-l);if(f<l){if(i>=f&&i<l){if(d===0)return!0;d>0&&(i===f?i>h&&(r=!r):r=!r)}}else if(l<f){if(i>l&&i<=f){if(d===0)return!0;d<0&&(i===f?i<h&&(r=!r):r=!r)}}else if(i==l&&(n>=g&&n<=u||n>=u&&n<=g))return!0}return r}function Me(e,t){return q(e,t)}var vn=new Map,Js=new Set;function ea(){if(typeof window>"u")return;const e=n=>{if(!n.target)return;let i=vn.get(n.target);i||(i=new Set,vn.set(n.target,i),n.target.addEventListener("transitioncancel",t)),i.add(n.propertyName)},t=n=>{if(!n.target)return;const i=vn.get(n.target);if(i&&(i.delete(n.propertyName),i.size===0&&(n.target.removeEventListener("transitioncancel",t),vn.delete(n.target)),vn.size===0)){for(const r of Js)r();Js.clear()}};document.body.addEventListener("transitionrun",e),document.body.addEventListener("transitionend",t)}typeof document<"u"&&(document.readyState!=="loading"?ea():document.addEventListener("DOMContentLoaded",ea));function ta(e,t){const n=na(e,t,"left"),i=na(e,t,"top"),r=t.offsetWidth,o=t.offsetHeight;let s=e.scrollLeft,a=e.scrollTop;const c=s+e.offsetWidth,u=a+e.offsetHeight;n<=s?s=n:n+r>c&&(s+=n+r-c),i<=a?a=i:i+o>u&&(a+=i+o-u),e.scrollLeft=s,e.scrollTop=a}function na(e,t,n){const i=n==="left"?"offsetLeft":"offsetTop";let r=0;for(;t.offsetParent&&(r+=t[i],t.offsetParent!==e);){if(t.offsetParent.contains(e)){r-=e[i];break}t=t.offsetParent}return r}var Md={border:"0",clip:"rect(0 0 0 0)","clip-path":"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:"0",position:"absolute",width:"1px","white-space":"nowrap"};function Or(e){let t=e.startIndex??0;const n=e.startLevel??0,i=[],r=c=>{if(c==null)return"";const u=e.getKey??"key",l=rn(u)?c[u]:u(c);return l!=null?String(l):""},o=c=>{if(c==null)return"";const u=e.getTextValue??"textValue",l=rn(u)?c[u]:u(c);return l!=null?String(l):""},s=c=>{if(c==null)return!1;const u=e.getDisabled??"disabled";return(rn(u)?c[u]:u(c))??!1},a=c=>{if(c!=null)return rn(e.getSectionChildren)?c[e.getSectionChildren]:e.getSectionChildren?.(c)};for(const c of e.dataSource){if(rn(c)||Kf(c)){i.push({type:"item",rawValue:c,key:String(c),textValue:String(c),disabled:s(c),level:n,index:t}),t++;continue}if(a(c)!=null){i.push({type:"section",rawValue:c,key:"",textValue:"",disabled:!1,level:n,index:t}),t++;const u=a(c)??[];if(u.length>0){const l=Or({dataSource:u,getKey:e.getKey,getTextValue:e.getTextValue,getDisabled:e.getDisabled,getSectionChildren:e.getSectionChildren,startIndex:t,startLevel:n+1});i.push(...l),t+=l.length}}else i.push({type:"item",rawValue:c,key:r(c),textValue:o(c),disabled:s(c),level:n,index:t}),t++}return i}/*!
@@ -34,7 +34,7 @@ function Ia(){F||(D.noFSInit||Ja||(Ja=!0,D.stdin=D.stdin,D.stdout=D.stdout,D.std
34
34
  function Ta(){Pa--;D.monitorRunDependencies?.(Pa);if(0==Pa&&(null!==Qa&&(clearInterval(Qa),Qa=null),Ra)){var a=Ra;Ra=null;a()}}function xa(a){D.onAbort?.(a);a="Aborted("+a+")";E(a);za=!0;Aa=1;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");ma(a);throw a;}var Ua=a=>a.startsWith("data:application/octet-stream;base64,"),Wa;Wa="capture-wasm.wasm";Ua(Wa)||(Wa=ra(Wa));
35
35
  function Xa(a){if(a==Wa&&wa)return new Uint8Array(wa);if(ua)return ua(a);throw"both async and sync fetching of the wasm failed";}function Ya(a){return wa||"function"!=typeof fetch?Promise.resolve().then(()=>Xa(a)):fetch(a,{credentials:"same-origin"}).then(b=>{if(!b.ok)throw`failed to load wasm binary file at '${a}'`;return b.arrayBuffer()}).catch(()=>Xa(a))}
36
36
  function Za(a,b,c){return Ya(a).then(d=>WebAssembly.instantiate(d,b)).then(d=>d).then(c,d=>{E(`failed to asynchronously prepare wasm: ${d}`);xa(d)})}function $a(a,b){var c=Wa;return wa||"function"!=typeof WebAssembly.instantiateStreaming||Ua(c)||"function"!=typeof fetch?Za(c,a,b):fetch(c,{credentials:"same-origin"}).then(d=>WebAssembly.instantiateStreaming(d,a).then(b,function(e){E(`wasm streaming compile failed: ${e}`);E("falling back to ArrayBuffer instantiation");return Za(c,a,b)}))}
37
- var G,H,ab={62113:(a,b,c,d)=>{a=K(a);b=K(b);c=K(c);d=K(d);throw Error(a+b+c+d);},62329:(a,b)=>{a=K(a);b=K(b);throw Error(a+b);}};function bb(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}
37
+ var G,H,ab={62105:(a,b,c,d)=>{a=K(a);b=K(b);c=K(c);d=K(d);throw Error(a+b+c+d);},62321:(a,b)=>{a=K(a);b=K(b);throw Error(a+b);}};function bb(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}
38
38
  var cb=a=>{a.terminate();a.onmessage=()=>{}},eb=a=>{0==M.pb.length&&(db(),M.rc(M.pb[0]));var b=M.pb.pop();if(!b)return 6;M.ub.push(b);M.lb[a.tb]=b;b.tb=a.tb;b.postMessage({cmd:"run",start_routine:a.od,arg:a.Jc,pthread_ptr:a.tb},a.td);return 0},N=0,hb=a=>{var b=fb();a=a();gb(b);return a},ib=(a,b)=>b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN;
39
39
  function O(a,b){var c=arguments.length-2,d=arguments;return hb(()=>{for(var e=jb(8*c),f=e>>3,g=0;g<c;g++){var l=d[2+g];ja()[f+g]=l}return kb(a,c,e,b)})}function lb(a){if(F)return O(0,1,a);Aa=a;mb||0<N||(M.Dc(),D.onExit?.(a),za=!0);pa(a,new bb(a))}var sb=a=>{Aa=a;if(F)throw nb(a),"unwind";if(!(mb||0<N||F)){ob();Oa(Fa);Ja=!1;pb(0);for(var b=0;b<qb.length;b++){var c=qb[b];c&&rb(c)}M.Dc();Ha=!0}lb(a)};function tb(){M.receiveObjectTransfer=M.hd;M.threadInitTLS=M.Ec;M.setExitStatus=M.Cc;mb=!1}
40
40
  function ub(){for(var a=navigator.hardwareConcurrency;a--;)db();Da.unshift(()=>{Sa("loading-workers");vb(()=>Ta("loading-workers"))})}function db(){var a=ra("capture-wasm.worker.js");a=new Worker(a);M.pb.push(a)}function vb(a){F?a():Promise.all(M.pb.map(M.rc)).then(a)}
@@ -164,7 +164,7 @@ Va=>{--N;f(()=>{l?Cb(l)(Va):b?.(Va)})},Va=>{--N;f(()=>{l?Cb(l)(Va):b?.(Va)})})},
164
164
  ia:Ue,M:(a,b,c,d)=>Ue(a,b,c,d)},Z=function(){function a(c,d){Z=c.exports;M.Fc.push(Z.ua);Bb=Z.ya;Ea.unshift(Z.pa);ya=d;Ta("wasm-instantiate");return Z}var b={a:$e};Sa("wasm-instantiate");if(D.instantiateWasm)try{return D.instantiateWasm(b,a)}catch(c){E(`Module.instantiateWasm callback failed with error: ${c}`),ma(c)}$a(b,function(c){a(c.instance,c.module)}).catch(ma);return{}}(),Nd=a=>(Nd=Z.qa)(a),ye=a=>(ye=Z.ra)(a),xb=D._pthread_self=()=>(xb=D._pthread_self=Z.sa)(),pb=a=>(pb=Z.ta)(a);
165
165
  D.__emscripten_tls_init=()=>(D.__emscripten_tls_init=Z.ua)();var Yb=(a,b)=>(Yb=Z.va)(a,b),Md=a=>(Md=Z.wa)(a);D.__embind_initialize_bindings=()=>(D.__embind_initialize_bindings=Z.xa)();var ob=()=>(ob=Z.za)(),Ye=D.__emscripten_thread_init=(a,b,c,d,e,f)=>(Ye=D.__emscripten_thread_init=Z.Aa)(a,b,c,d,e,f);D.__emscripten_thread_crashed=()=>(D.__emscripten_thread_crashed=Z.Ba)();
166
166
  var kb=(a,b,c,d)=>(kb=Z.Ca)(a,b,c,d),wb=a=>(wb=Z.Da)(a),Db=D.__emscripten_thread_exit=a=>(Db=D.__emscripten_thread_exit=Z.Ea)(a),ie=()=>(ie=Z.Fa)(),Ze=a=>(Ze=Z.Ga)(a),zb=(a,b)=>(zb=Z.Ha)(a,b),fb=()=>(fb=Z.Ia)(),gb=a=>(gb=Z.Ja)(a),jb=a=>(jb=Z.Ka)(a);D.dynCall_ji=(a,b)=>(D.dynCall_ji=Z.La)(a,b);D.dynCall_jiji=(a,b,c,d,e)=>(D.dynCall_jiji=Z.Ma)(a,b,c,d,e);D.dynCall_viijii=(a,b,c,d,e,f,g)=>(D.dynCall_viijii=Z.Na)(a,b,c,d,e,f,g);D.dynCall_iiiiij=(a,b,c,d,e,f,g)=>(D.dynCall_iiiiij=Z.Oa)(a,b,c,d,e,f,g);
167
- D.dynCall_iiiiijj=(a,b,c,d,e,f,g,l,m)=>(D.dynCall_iiiiijj=Z.Pa)(a,b,c,d,e,f,g,l,m);D.dynCall_iiiiiijj=(a,b,c,d,e,f,g,l,m,n)=>(D.dynCall_iiiiiijj=Z.Qa)(a,b,c,d,e,f,g,l,m,n);D.__ZN2MB2NN28LinearDefragmentingAllocator10Allocation4nullE=15072;D.___start_em_js=61120;D.___stop_em_js=62113;D.addRunDependency=Sa;D.removeRunDependency=Ta;D.FS_createPath=Lc;D.FS_createLazyFile=Oc;D.FS_createDevice=Ka;D.wasmMemory=u;D.keepRuntimeAlive=()=>mb||0<N;D.ExitStatus=bb;D.FS_createPreloadedFile=ic;
167
+ D.dynCall_iiiiijj=(a,b,c,d,e,f,g,l,m)=>(D.dynCall_iiiiijj=Z.Pa)(a,b,c,d,e,f,g,l,m);D.dynCall_iiiiiijj=(a,b,c,d,e,f,g,l,m,n)=>(D.dynCall_iiiiiijj=Z.Qa)(a,b,c,d,e,f,g,l,m,n);D.__ZN2MB2NN28LinearDefragmentingAllocator10Allocation4nullE=15072;D.___start_em_js=61112;D.___stop_em_js=62105;D.addRunDependency=Sa;D.removeRunDependency=Ta;D.FS_createPath=Lc;D.FS_createLazyFile=Oc;D.FS_createDevice=Ka;D.wasmMemory=u;D.keepRuntimeAlive=()=>mb||0<N;D.ExitStatus=bb;D.FS_createPreloadedFile=ic;
168
168
  D.FS_createDataFile=hc;D.FS_unlink=Ec;D.PThread=M;var af;Ra=function cf(){af||df();af||(Ra=cf)};
169
169
  function df(){function a(){if(!af&&(af=!0,D.calledRun=!0,!za)){Ia();la(D);if(D.onRuntimeInitialized)D.onRuntimeInitialized();if(!F){if(D.postRun)for("function"==typeof D.postRun&&(D.postRun=[D.postRun]);D.postRun.length;){var b=D.postRun.shift();Ga.unshift(b)}Oa(Ga)}}}if(!(0<Pa))if(F)la(D),Ia(),startWorker(D);else{if(D.preRun)for("function"==typeof D.preRun&&(D.preRun=[D.preRun]);D.preRun.length;)Da.unshift(D.preRun.shift());Oa(Da);0<Pa||(D.setStatus?(D.setStatus("Running..."),setTimeout(function(){setTimeout(function(){D.setStatus("")},
170
170
  1);a()},1)):a())}}if(D.preInit)for("function"==typeof D.preInit&&(D.preInit=[D.preInit]);0<D.preInit.length;)D.preInit.pop()();df();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microblink/capture",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "homepage": "https://microblink.com/",
5
5
  "repository": "github:BlinkID/capture-browser",
6
6
  "description": "A smart image capturing library for WebAssembly-enabled browsers",