diff --git a/docs/kiosk-ref.json b/docs/kiosk-ref.json new file mode 100644 index 0000000000..e53735ef72 --- /dev/null +++ b/docs/kiosk-ref.json @@ -0,0 +1,3 @@ +{ + "redirect": "/--kiosk" +} diff --git a/docs/kiosk.html b/docs/kiosk.html deleted file mode 100644 index 7ba1e393b0..0000000000 --- a/docs/kiosk.html +++ /dev/null @@ -1,12 +0,0 @@ -MakeCode Arcade Kiosk
\ No newline at end of file diff --git a/docs/static/kiosk/asset-manifest.json b/docs/static/kiosk/asset-manifest.json deleted file mode 100644 index 371ff8ba4e..0000000000 --- a/docs/static/kiosk/asset-manifest.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "files": { - "main.css": "/static/kiosk/static/css/main.269c590e.css", - "main.js": "/static/kiosk/static/js/main.3ab95ea3.js", - "static/js/787.709d397d.chunk.js": "/static/kiosk/static/js/787.709d397d.chunk.js", - "index.html": "/static/kiosk/index.html", - "main.269c590e.css.map": "/static/kiosk/static/css/main.269c590e.css.map", - "main.3ab95ea3.js.map": "/static/kiosk/static/js/main.3ab95ea3.js.map", - "787.709d397d.chunk.js.map": "/static/kiosk/static/js/787.709d397d.chunk.js.map" - }, - "entrypoints": [ - "static/css/main.269c590e.css", - "static/js/main.3ab95ea3.js" - ] -} \ No newline at end of file diff --git a/docs/static/kiosk/manifest.json b/docs/static/kiosk/manifest.json deleted file mode 100644 index c516918d4d..0000000000 --- a/docs/static/kiosk/manifest.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "short_name": "MakeCode Arcade Kiosk", - "name": "MakeCode Arcade Kiosk", - "icons": [ - ], - "start_url": ".", - "display": "standalone", - "theme_color": "#000000", - "background_color": "#ffffff" -} diff --git a/docs/static/kiosk/robots.txt b/docs/static/kiosk/robots.txt deleted file mode 100644 index e9e57dc4d4..0000000000 --- a/docs/static/kiosk/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# https://www.robotstxt.org/robotstxt.html -User-agent: * -Disallow: diff --git a/docs/static/kiosk/static/js/787.709d397d.chunk.js b/docs/static/kiosk/static/js/787.709d397d.chunk.js deleted file mode 100644 index 78c7396cb8..0000000000 --- a/docs/static/kiosk/static/js/787.709d397d.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";(self.webpackChunkmakecode_arcade_kiosk=self.webpackChunkmakecode_arcade_kiosk||[]).push([[787],{787:function(e,t,n){n.r(t),n.d(t,{getCLS:function(){return y},getFCP:function(){return g},getFID:function(){return F},getLCP:function(){return P},getTTFB:function(){return D}});var i,r,a,o,u=function(e,t){return{name:e,value:void 0===t?-1:t,delta:0,entries:[],id:"v2-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},c=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if("first-input"===e&&!("PerformanceEventTiming"in self))return;var n=new PerformanceObserver((function(e){return e.getEntries().map(t)}));return n.observe({type:e,buffered:!0}),n}}catch(e){}},f=function(e,t){var n=function n(i){"pagehide"!==i.type&&"hidden"!==document.visibilityState||(e(i),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},s=function(e){addEventListener("pageshow",(function(t){t.persisted&&e(t)}),!0)},m=function(e,t,n){var i;return function(r){t.value>=0&&(r||n)&&(t.delta=t.value-(i||0),(t.delta||void 0===i)&&(i=t.value,e(t)))}},v=-1,d=function(){return"hidden"===document.visibilityState?0:1/0},p=function(){f((function(e){var t=e.timeStamp;v=t}),!0)},l=function(){return v<0&&(v=d(),p(),s((function(){setTimeout((function(){v=d(),p()}),0)}))),{get firstHiddenTime(){return v}}},g=function(e,t){var n,i=l(),r=u("FCP"),a=function(e){"first-contentful-paint"===e.name&&(f&&f.disconnect(),e.startTime-1&&e(t)},r=u("CLS",0),a=0,o=[],v=function(e){if(!e.hadRecentInput){var t=o[0],i=o[o.length-1];a&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(a+=e.value,o.push(e)):(a=e.value,o=[e]),a>r.value&&(r.value=a,r.entries=o,n())}},d=c("layout-shift",v);d&&(n=m(i,r,t),f((function(){d.takeRecords().map(v),n(!0)})),s((function(){a=0,T=-1,r=u("CLS",0),n=m(i,r,t)})))},E={passive:!0,capture:!0},w=new Date,L=function(e,t){i||(i=t,r=e,a=new Date,b(removeEventListener),S())},S=function(){if(r>=0&&r1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){L(e,t),r()},i=function(){r()},r=function(){removeEventListener("pointerup",n,E),removeEventListener("pointercancel",i,E)};addEventListener("pointerup",n,E),addEventListener("pointercancel",i,E)}(t,e):L(t,e)}},b=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,k,E)}))},F=function(e,t){var n,a=l(),v=u("FID"),d=function(e){e.startTimeperformance.now())return;n.entries=[t],e(n)}catch(e){}},"complete"===document.readyState?setTimeout(t,0):addEventListener("load",(function(){return setTimeout(t,0)}))}}}]); -//# sourceMappingURL=787.709d397d.chunk.js.map \ No newline at end of file diff --git a/docs/static/kiosk/static/js/787.709d397d.chunk.js.map b/docs/static/kiosk/static/js/787.709d397d.chunk.js.map deleted file mode 100644 index a85daa3435..0000000000 --- a/docs/static/kiosk/static/js/787.709d397d.chunk.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"static/js/787.709d397d.chunk.js","mappings":"+RAAA,IAAIA,EAAEC,EAAEC,EAAEC,EAAEC,EAAE,SAASJ,EAAEC,GAAG,MAAM,CAACI,KAAKL,EAAEM,WAAM,IAASL,GAAG,EAAEA,EAAEM,MAAM,EAAEC,QAAQ,GAAGC,GAAG,MAAMC,OAAOC,KAAKC,MAAM,KAAKF,OAAOG,KAAKC,MAAM,cAAcD,KAAKE,UAAU,MAAM,EAAEC,EAAE,SAAShB,EAAEC,GAAG,IAAI,GAAGgB,oBAAoBC,oBAAoBC,SAASnB,GAAG,CAAC,GAAG,gBAAgBA,KAAK,2BAA2BoB,MAAM,OAAO,IAAIlB,EAAE,IAAIe,qBAAqB,SAASjB,GAAG,OAAOA,EAAEqB,aAAaC,IAAIrB,EAAE,IAAI,OAAOC,EAAEqB,QAAQ,CAACC,KAAKxB,EAAEyB,UAAS,IAAKvB,CAAC,CAAW,CAAT,MAAMF,GAAG,CAAC,EAAE0B,EAAE,SAAS1B,EAAEC,GAAG,IAAIC,EAAE,SAASA,EAAEC,GAAG,aAAaA,EAAEqB,MAAM,WAAWG,SAASC,kBAAkB5B,EAAEG,GAAGF,IAAI4B,oBAAoB,mBAAmB3B,GAAE,GAAI2B,oBAAoB,WAAW3B,GAAE,IAAK,EAAE4B,iBAAiB,mBAAmB5B,GAAE,GAAI4B,iBAAiB,WAAW5B,GAAE,EAAG,EAAE6B,EAAE,SAAS/B,GAAG8B,iBAAiB,YAAY,SAAS7B,GAAGA,EAAE+B,WAAWhC,EAAEC,EAAE,IAAG,EAAG,EAAEgC,EAAE,SAASjC,EAAEC,EAAEC,GAAG,IAAIC,EAAE,OAAO,SAASC,GAAGH,EAAEK,OAAO,IAAIF,GAAGF,KAAKD,EAAEM,MAAMN,EAAEK,OAAOH,GAAG,IAAIF,EAAEM,YAAO,IAASJ,KAAKA,EAAEF,EAAEK,MAAMN,EAAEC,IAAI,CAAC,EAAEiC,GAAG,EAAEC,EAAE,WAAW,MAAM,WAAWR,SAASC,gBAAgB,EAAE,GAAG,EAAEQ,EAAE,WAAWV,GAAG,SAAS1B,GAAG,IAAIC,EAAED,EAAEqC,UAAUH,EAAEjC,CAAC,IAAG,EAAG,EAAEqC,EAAE,WAAW,OAAOJ,EAAE,IAAIA,EAAEC,IAAIC,IAAIL,GAAG,WAAWQ,YAAY,WAAWL,EAAEC,IAAIC,GAAG,GAAG,EAAE,KAAK,CAAKI,sBAAkB,OAAON,CAAC,EAAE,EAAEO,EAAE,SAASzC,EAAEC,GAAG,IAAIC,EAAEC,EAAEmC,IAAIZ,EAAEtB,EAAE,OAAO8B,EAAE,SAASlC,GAAG,2BAA2BA,EAAEK,OAAO+B,GAAGA,EAAEM,aAAa1C,EAAE2C,UAAUxC,EAAEqC,kBAAkBd,EAAEpB,MAAMN,EAAE2C,UAAUjB,EAAElB,QAAQoC,KAAK5C,GAAGE,GAAE,IAAK,EAAEiC,EAAEU,OAAOC,aAAaA,YAAYC,kBAAkBD,YAAYC,iBAAiB,0BAA0B,GAAGX,EAAED,EAAE,KAAKnB,EAAE,QAAQkB,IAAIC,GAAGC,KAAKlC,EAAE+B,EAAEjC,EAAE0B,EAAEzB,GAAGkC,GAAGD,EAAEC,GAAGJ,GAAG,SAAS5B,GAAGuB,EAAEtB,EAAE,OAAOF,EAAE+B,EAAEjC,EAAE0B,EAAEzB,GAAG+C,uBAAuB,WAAWA,uBAAuB,WAAWtB,EAAEpB,MAAMwC,YAAYlC,MAAMT,EAAEkC,UAAUnC,GAAE,EAAG,GAAG,GAAG,IAAI,EAAE+C,GAAE,EAAGC,GAAG,EAAEC,EAAE,SAASnD,EAAEC,GAAGgD,IAAIR,GAAG,SAASzC,GAAGkD,EAAElD,EAAEM,KAAK,IAAI2C,GAAE,GAAI,IAAI/C,EAAEC,EAAE,SAASF,GAAGiD,GAAG,GAAGlD,EAAEC,EAAE,EAAEiC,EAAE9B,EAAE,MAAM,GAAG+B,EAAE,EAAEC,EAAE,GAAGE,EAAE,SAAStC,GAAG,IAAIA,EAAEoD,eAAe,CAAC,IAAInD,EAAEmC,EAAE,GAAGjC,EAAEiC,EAAEA,EAAEiB,OAAO,GAAGlB,GAAGnC,EAAE2C,UAAUxC,EAAEwC,UAAU,KAAK3C,EAAE2C,UAAU1C,EAAE0C,UAAU,KAAKR,GAAGnC,EAAEM,MAAM8B,EAAEQ,KAAK5C,KAAKmC,EAAEnC,EAAEM,MAAM8B,EAAE,CAACpC,IAAImC,EAAED,EAAE5B,QAAQ4B,EAAE5B,MAAM6B,EAAED,EAAE1B,QAAQ4B,EAAElC,IAAI,CAAC,EAAEiD,EAAEnC,EAAE,eAAesB,GAAGa,IAAIjD,EAAE+B,EAAE9B,EAAE+B,EAAEjC,GAAGyB,GAAG,WAAWyB,EAAEG,cAAchC,IAAIgB,GAAGpC,GAAE,EAAG,IAAI6B,GAAG,WAAWI,EAAE,EAAEe,GAAG,EAAEhB,EAAE9B,EAAE,MAAM,GAAGF,EAAE+B,EAAE9B,EAAE+B,EAAEjC,EAAE,IAAI,EAAEsD,EAAE,CAACC,SAAQ,EAAGC,SAAQ,GAAIC,EAAE,IAAI/C,KAAKgD,EAAE,SAASxD,EAAEC,GAAGJ,IAAIA,EAAEI,EAAEH,EAAEE,EAAED,EAAE,IAAIS,KAAKiD,EAAE/B,qBAAqBgC,IAAI,EAAEA,EAAE,WAAW,GAAG5D,GAAG,GAAGA,EAAEC,EAAEwD,EAAE,CAAC,IAAItD,EAAE,CAAC0D,UAAU,cAAczD,KAAKL,EAAEwB,KAAKuC,OAAO/D,EAAE+D,OAAOC,WAAWhE,EAAEgE,WAAWrB,UAAU3C,EAAEqC,UAAU4B,gBAAgBjE,EAAEqC,UAAUpC,GAAGE,EAAE+D,SAAS,SAASlE,GAAGA,EAAEI,EAAE,IAAID,EAAE,EAAE,CAAC,EAAEgE,EAAE,SAASnE,GAAG,GAAGA,EAAEgE,WAAW,CAAC,IAAI/D,GAAGD,EAAEqC,UAAU,KAAK,IAAI1B,KAAKmC,YAAYlC,OAAOZ,EAAEqC,UAAU,eAAerC,EAAEwB,KAAK,SAASxB,EAAEC,GAAG,IAAIC,EAAE,WAAWyD,EAAE3D,EAAEC,GAAGG,GAAG,EAAED,EAAE,WAAWC,GAAG,EAAEA,EAAE,WAAWyB,oBAAoB,YAAY3B,EAAEqD,GAAG1B,oBAAoB,gBAAgB1B,EAAEoD,EAAE,EAAEzB,iBAAiB,YAAY5B,EAAEqD,GAAGzB,iBAAiB,gBAAgB3B,EAAEoD,EAAE,CAAhO,CAAkOtD,EAAED,GAAG2D,EAAE1D,EAAED,EAAE,CAAC,EAAE4D,EAAE,SAAS5D,GAAG,CAAC,YAAY,UAAU,aAAa,eAAekE,SAAS,SAASjE,GAAG,OAAOD,EAAEC,EAAEkE,EAAEZ,EAAE,GAAG,EAAEa,EAAE,SAASlE,EAAEgC,GAAG,IAAIC,EAAEC,EAAEE,IAAIG,EAAErC,EAAE,OAAO6C,EAAE,SAASjD,GAAGA,EAAE2C,UAAUP,EAAEI,kBAAkBC,EAAEnC,MAAMN,EAAEiE,gBAAgBjE,EAAE2C,UAAUF,EAAEjC,QAAQoC,KAAK5C,GAAGmC,GAAE,GAAI,EAAEe,EAAElC,EAAE,cAAciC,GAAGd,EAAEF,EAAE/B,EAAEuC,EAAEP,GAAGgB,GAAGxB,GAAG,WAAWwB,EAAEI,cAAchC,IAAI2B,GAAGC,EAAER,YAAY,IAAG,GAAIQ,GAAGnB,GAAG,WAAW,IAAIf,EAAEyB,EAAErC,EAAE,OAAO+B,EAAEF,EAAE/B,EAAEuC,EAAEP,GAAG/B,EAAE,GAAGF,GAAG,EAAED,EAAE,KAAK4D,EAAE9B,kBAAkBd,EAAEiC,EAAE9C,EAAEyC,KAAK5B,GAAG6C,GAAG,GAAG,EAAEQ,EAAE,CAAC,EAAEC,EAAE,SAAStE,EAAEC,GAAG,IAAIC,EAAEC,EAAEmC,IAAIJ,EAAE9B,EAAE,OAAO+B,EAAE,SAASnC,GAAG,IAAIC,EAAED,EAAE2C,UAAU1C,EAAEE,EAAEqC,kBAAkBN,EAAE5B,MAAML,EAAEiC,EAAE1B,QAAQoC,KAAK5C,GAAGE,IAAI,EAAEkC,EAAEpB,EAAE,2BAA2BmB,GAAG,GAAGC,EAAE,CAAClC,EAAE+B,EAAEjC,EAAEkC,EAAEjC,GAAG,IAAIwC,EAAE,WAAW4B,EAAEnC,EAAEzB,MAAM2B,EAAEkB,cAAchC,IAAIa,GAAGC,EAAEM,aAAa2B,EAAEnC,EAAEzB,KAAI,EAAGP,GAAE,GAAI,EAAE,CAAC,UAAU,SAASgE,SAAS,SAASlE,GAAG8B,iBAAiB9B,EAAEyC,EAAE,CAAC8B,MAAK,EAAGd,SAAQ,GAAI,IAAI/B,EAAEe,GAAE,GAAIV,GAAG,SAAS5B,GAAG+B,EAAE9B,EAAE,OAAOF,EAAE+B,EAAEjC,EAAEkC,EAAEjC,GAAG+C,uBAAuB,WAAWA,uBAAuB,WAAWd,EAAE5B,MAAMwC,YAAYlC,MAAMT,EAAEkC,UAAUgC,EAAEnC,EAAEzB,KAAI,EAAGP,GAAE,EAAG,GAAG,GAAG,GAAG,CAAC,EAAEsE,EAAE,SAASxE,GAAG,IAAIC,EAAEC,EAAEE,EAAE,QAAQH,EAAE,WAAW,IAAI,IAAIA,EAAE6C,YAAY2B,iBAAiB,cAAc,IAAI,WAAW,IAAIzE,EAAE8C,YAAY4B,OAAOzE,EAAE,CAAC6D,UAAU,aAAanB,UAAU,GAAG,IAAI,IAAIzC,KAAKF,EAAE,oBAAoBE,GAAG,WAAWA,IAAID,EAAEC,GAAGW,KAAK8D,IAAI3E,EAAEE,GAAGF,EAAE4E,gBAAgB,IAAI,OAAO3E,CAAC,CAAjL,GAAqL,GAAGC,EAAEI,MAAMJ,EAAEK,MAAMN,EAAE4E,cAAc3E,EAAEI,MAAM,GAAGJ,EAAEI,MAAMwC,YAAYlC,MAAM,OAAOV,EAAEM,QAAQ,CAACP,GAAGD,EAAEE,EAAY,CAAT,MAAMF,GAAG,CAAC,EAAE,aAAa2B,SAASmD,WAAWvC,WAAWtC,EAAE,GAAG6B,iBAAiB,QAAQ,WAAW,OAAOS,WAAWtC,EAAE,EAAE,GAAG,C","sources":["../node_modules/web-vitals/dist/web-vitals.js"],"sourcesContent":["var e,t,n,i,r=function(e,t){return{name:e,value:void 0===t?-1:t,delta:0,entries:[],id:\"v2-\".concat(Date.now(),\"-\").concat(Math.floor(8999999999999*Math.random())+1e12)}},a=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if(\"first-input\"===e&&!(\"PerformanceEventTiming\"in self))return;var n=new PerformanceObserver((function(e){return e.getEntries().map(t)}));return n.observe({type:e,buffered:!0}),n}}catch(e){}},o=function(e,t){var n=function n(i){\"pagehide\"!==i.type&&\"hidden\"!==document.visibilityState||(e(i),t&&(removeEventListener(\"visibilitychange\",n,!0),removeEventListener(\"pagehide\",n,!0)))};addEventListener(\"visibilitychange\",n,!0),addEventListener(\"pagehide\",n,!0)},u=function(e){addEventListener(\"pageshow\",(function(t){t.persisted&&e(t)}),!0)},c=function(e,t,n){var i;return function(r){t.value>=0&&(r||n)&&(t.delta=t.value-(i||0),(t.delta||void 0===i)&&(i=t.value,e(t)))}},f=-1,s=function(){return\"hidden\"===document.visibilityState?0:1/0},m=function(){o((function(e){var t=e.timeStamp;f=t}),!0)},v=function(){return f<0&&(f=s(),m(),u((function(){setTimeout((function(){f=s(),m()}),0)}))),{get firstHiddenTime(){return f}}},d=function(e,t){var n,i=v(),o=r(\"FCP\"),f=function(e){\"first-contentful-paint\"===e.name&&(m&&m.disconnect(),e.startTime-1&&e(t)},f=r(\"CLS\",0),s=0,m=[],v=function(e){if(!e.hadRecentInput){var t=m[0],i=m[m.length-1];s&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(s+=e.value,m.push(e)):(s=e.value,m=[e]),s>f.value&&(f.value=s,f.entries=m,n())}},h=a(\"layout-shift\",v);h&&(n=c(i,f,t),o((function(){h.takeRecords().map(v),n(!0)})),u((function(){s=0,l=-1,f=r(\"CLS\",0),n=c(i,f,t)})))},T={passive:!0,capture:!0},y=new Date,g=function(i,r){e||(e=r,t=i,n=new Date,w(removeEventListener),E())},E=function(){if(t>=0&&t1e12?new Date:performance.now())-e.timeStamp;\"pointerdown\"==e.type?function(e,t){var n=function(){g(e,t),r()},i=function(){r()},r=function(){removeEventListener(\"pointerup\",n,T),removeEventListener(\"pointercancel\",i,T)};addEventListener(\"pointerup\",n,T),addEventListener(\"pointercancel\",i,T)}(t,e):g(t,e)}},w=function(e){[\"mousedown\",\"keydown\",\"touchstart\",\"pointerdown\"].forEach((function(t){return e(t,S,T)}))},L=function(n,f){var s,m=v(),d=r(\"FID\"),p=function(e){e.startTimeperformance.now())return;n.entries=[t],e(n)}catch(e){}},\"complete\"===document.readyState?setTimeout(t,0):addEventListener(\"load\",(function(){return setTimeout(t,0)}))};export{h as getCLS,d as getFCP,L as getFID,F as getLCP,P as getTTFB};\n"],"names":["e","t","n","i","r","name","value","delta","entries","id","concat","Date","now","Math","floor","random","a","PerformanceObserver","supportedEntryTypes","includes","self","getEntries","map","observe","type","buffered","o","document","visibilityState","removeEventListener","addEventListener","u","persisted","c","f","s","m","timeStamp","v","setTimeout","firstHiddenTime","d","disconnect","startTime","push","window","performance","getEntriesByName","requestAnimationFrame","p","l","h","hadRecentInput","length","takeRecords","T","passive","capture","y","g","w","E","entryType","target","cancelable","processingStart","forEach","S","L","b","F","once","P","getEntriesByType","timing","max","navigationStart","responseStart","readyState"],"sourceRoot":""} \ No newline at end of file diff --git a/docs/static/kiosk/static/js/main.3ab95ea3.js b/docs/static/kiosk/static/js/main.3ab95ea3.js deleted file mode 100644 index f3f6e97386..0000000000 --- a/docs/static/kiosk/static/js/main.3ab95ea3.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! For license information please see main.3ab95ea3.js.LICENSE.txt */ -!function(){var e={484:function(e,t,n){var r=n(424).default,i=n(115).default,a=n(61).default,o=n(588).default,s=n(808).default,l=n(704).default,u=n(690).default,c=n(728).default,d=n(655).default,f=n(389).default;!function(e){"use strict";var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};function h(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}function v(e,t){var n=Object.setPrototypeOf;n?n(e,t):e.__proto__=t}function p(e,t){void 0===t&&(t=e.constructor);var n=Error.captureStackTrace;n&&n(e,t)}var g=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return u(this,n),(e=t.call(this,r)).message=r,e}return c(n,[{key:"getKind",value:function(){return this.constructor.kind}}]),n}(function(e){function t(t){var n=this.constructor,r=e.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),v(r,n.prototype),p(r),r}return h(t,e),t}(Error));g.kind="Exception";var m=function(e){d(n,e);var t=f(n);function n(){return u(this,n),t.apply(this,arguments)}return c(n)}(g);m.kind="ArgumentException";var y=function(e){d(n,e);var t=f(n);function n(){return u(this,n),t.apply(this,arguments)}return c(n)}(g);y.kind="IllegalArgumentException";var w=function(){function e(t){if(u(this,e),this.binarizer=t,null===t)throw new y("Binarizer must be non-null.")}return c(e,[{key:"getWidth",value:function(){return this.binarizer.getWidth()}},{key:"getHeight",value:function(){return this.binarizer.getHeight()}},{key:"getBlackRow",value:function(e,t){return this.binarizer.getBlackRow(e,t)}},{key:"getBlackMatrix",value:function(){return null!==this.matrix&&void 0!==this.matrix||(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}},{key:"isCropSupported",value:function(){return this.binarizer.getLuminanceSource().isCropSupported()}},{key:"crop",value:function(t,n,r,i){var a=this.binarizer.getLuminanceSource().crop(t,n,r,i);return new e(this.binarizer.createBinarizer(a))}},{key:"isRotateSupported",value:function(){return this.binarizer.getLuminanceSource().isRotateSupported()}},{key:"rotateCounterClockwise",value:function(){var t=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new e(this.binarizer.createBinarizer(t))}},{key:"rotateCounterClockwise45",value:function(){var t=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new e(this.binarizer.createBinarizer(t))}},{key:"toString",value:function(){try{return this.getBlackMatrix().toString()}catch(e){return""}}}]),e}(),E=function(e){d(n,e);var t=f(n);function n(){return u(this,n),t.apply(this,arguments)}return c(n,null,[{key:"getChecksumInstance",value:function(){return new n}}]),n}(g);E.kind="ChecksumException";var C=function(){function e(t){u(this,e),this.source=t}return c(e,[{key:"getLuminanceSource",value:function(){return this.source}},{key:"getWidth",value:function(){return this.source.getWidth()}},{key:"getHeight",value:function(){return this.source.getHeight()}}]),e}(),S=function(){function e(){u(this,e)}return c(e,null,[{key:"arraycopy",value:function(e,t,n,r,i){for(;i--;)n[r++]=e[t++]}},{key:"currentTimeMillis",value:function(){return Date.now()}}]),e}(),A=function(e){d(n,e);var t=f(n);function n(){return u(this,n),t.apply(this,arguments)}return c(n)}(g);A.kind="IndexOutOfBoundsException";var b=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return u(this,n),(e=t.call(this,i)).index=r,e.message=i,e}return c(n)}(A);b.kind="ArrayIndexOutOfBoundsException";var k=function(){function e(){u(this,e)}return c(e,null,[{key:"fill",value:function(e,t){for(var n=0,r=e.length;nn)throw new y("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new b(t);if(n>e)throw new b(n)}},{key:"asList",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n>1,s=r(n,t[o]);if(s>0)i=o+1;else{if(!(s<0))return o;a=o-1}}return-i-1}},{key:"numberComparator",value:function(e,t){return e-t}}]),e}(),_=function(){function e(){u(this,e)}return c(e,null,[{key:"numberOfTrailingZeros",value:function(e){var t;if(0===e)return 32;var n=31;return 0!==(t=e<<16)&&(n-=16,e=t),0!==(t=e<<8)&&(n-=8,e=t),0!==(t=e<<4)&&(n-=4,e=t),0!==(t=e<<2)&&(n-=2,e=t),n-(e<<1>>>31)}},{key:"numberOfLeadingZeros",value:function(e){if(0===e)return 32;var t=1;return e>>>16===0&&(t+=16,e<<=16),e>>>24===0&&(t+=8,e<<=8),e>>>28===0&&(t+=4,e<<=4),e>>>30===0&&(t+=2,e<<=2),t-=e>>>31}},{key:"toHexString",value:function(e){return e.toString(16)}},{key:"toBinaryString",value:function(e){return String(parseInt(String(e),2))}},{key:"bitCount",value:function(e){return e=(e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135,e+=e>>>8,63&(e+=e>>>16)}},{key:"truncDivision",value:function(e,t){return Math.trunc(e/t)}},{key:"parseInt",value:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return parseInt(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0)}))}]),e}();_.MIN_VALUE_32_BITS=-2147483648,_.MAX_VALUE=Number.MAX_SAFE_INTEGER;var I,T=function(){function e(t,n){u(this,e),void 0===t?(this.size=0,this.bits=new Int32Array(1)):(this.size=t,this.bits=void 0===n||null===n?e.makeArray(t):n)}return c(e,[{key:"getSize",value:function(){return this.size}},{key:"getSizeInBytes",value:function(){return Math.floor((this.size+7)/8)}},{key:"ensureCapacity",value:function(t){if(t>32*this.bits.length){var n=e.makeArray(t);S.arraycopy(this.bits,0,n,0,this.bits.length),this.bits=n}}},{key:"get",value:function(e){return 0!==(this.bits[Math.floor(e/32)]&1<<(31&e))}},{key:"set",value:function(e){this.bits[Math.floor(e/32)]|=1<<(31&e)}},{key:"flip",value:function(e){this.bits[Math.floor(e/32)]^=1<<(31&e)}},{key:"getNextSet",value:function(e){var t=this.size;if(e>=t)return t;var n=this.bits,r=Math.floor(e/32),i=n[r];i&=~((1<<(31&e))-1);for(var a=n.length;0===i;){if(++r===a)return t;i=n[r]}var o=32*r+_.numberOfTrailingZeros(i);return o>t?t:o}},{key:"getNextUnset",value:function(e){var t=this.size;if(e>=t)return t;var n=this.bits,r=Math.floor(e/32),i=~n[r];i&=~((1<<(31&e))-1);for(var a=n.length;0===i;){if(++r===a)return t;i=~n[r]}var o=32*r+_.numberOfTrailingZeros(i);return o>t?t:o}},{key:"setBulk",value:function(e,t){this.bits[Math.floor(e/32)]=t}},{key:"setRange",value:function(e,t){if(tthis.size)throw new y;if(t!==e){t--;for(var n=Math.floor(e/32),r=Math.floor(t/32),i=this.bits,a=n;a<=r;a++){var o=(2<<(an?0:31&e));i[a]|=o}}}},{key:"clear",value:function(){for(var e=this.bits.length,t=this.bits,n=0;nthis.size)throw new y;if(t===e)return!0;t--;for(var r=Math.floor(e/32),i=Math.floor(t/32),a=this.bits,o=r;o<=i;o++){var s=(2<<(or?0:31&e))&4294967295;if((a[o]&s)!==(n?s:0))return!1}return!0}},{key:"appendBit",value:function(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++}},{key:"appendBits",value:function(e,t){if(t<0||t>32)throw new y("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(var n=t;n>0;n--)this.appendBit(1===(e>>n-1&1))}},{key:"appendBitArray",value:function(e){var t=e.size;this.ensureCapacity(this.size+t);for(var n=0;n>1&1431655765|(1431655765&a)<<1)>>2&858993459|(858993459&a)<<2)>>4&252645135|(252645135&a)<<4)>>8&16711935|(16711935&a)<<8)>>16&65535|(65535&a)<<16,e[t-i]=a}if(this.size!==32*n){for(var o=32*n-this.size,s=e[0]>>>o,l=1;l>>o}e[n-1]=s}this.bits=e}},{key:"equals",value:function(t){if(!(t instanceof e))return!1;var n=t;return this.size===n.size&&k.equals(this.bits,n.bits)}},{key:"hashCode",value:function(){return 31*this.size+k.hashCode(this.bits)}},{key:"toString",value:function(){for(var e="",t=0,n=this.size;t3?i-3:0),o=3;o=900)throw new D("incorect value");var n=e.VALUES_TO_ECI.get(t);if(void 0===n)throw new D("incorect value");return n}},{key:"getCharacterSetECIByName",value:function(t){var n=e.NAME_TO_ECI.get(t);if(void 0===n)throw new D("incorect value");return n}}]),e}();R.VALUE_IDENTIFIER_TO_ECI=new Map,R.VALUES_TO_ECI=new Map,R.NAME_TO_ECI=new Map,R.Cp437=new R(M.Cp437,Int32Array.from([0,2]),"Cp437"),R.ISO8859_1=new R(M.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),R.ISO8859_2=new R(M.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),R.ISO8859_3=new R(M.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),R.ISO8859_4=new R(M.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),R.ISO8859_5=new R(M.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),R.ISO8859_6=new R(M.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),R.ISO8859_7=new R(M.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),R.ISO8859_8=new R(M.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),R.ISO8859_9=new R(M.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),R.ISO8859_10=new R(M.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),R.ISO8859_11=new R(M.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),R.ISO8859_13=new R(M.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),R.ISO8859_14=new R(M.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),R.ISO8859_15=new R(M.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),R.ISO8859_16=new R(M.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),R.SJIS=new R(M.SJIS,20,"SJIS","Shift_JIS"),R.Cp1250=new R(M.Cp1250,21,"Cp1250","windows-1250"),R.Cp1251=new R(M.Cp1251,22,"Cp1251","windows-1251"),R.Cp1252=new R(M.Cp1252,23,"Cp1252","windows-1252"),R.Cp1256=new R(M.Cp1256,24,"Cp1256","windows-1256"),R.UnicodeBigUnmarked=new R(M.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),R.UTF8=new R(M.UTF8,26,"UTF8","UTF-8"),R.ASCII=new R(M.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),R.Big5=new R(M.Big5,28,"Big5"),R.GB18030=new R(M.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),R.EUC_KR=new R(M.EUC_KR,30,"EUC_KR","EUC-KR");var O=function(e){d(n,e);var t=f(n);function n(){return u(this,n),t.apply(this,arguments)}return c(n)}(g);O.kind="UnsupportedOperationException";var P=function(){function e(){u(this,e)}return c(e,null,[{key:"decode",value:function(e,t){var n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):"undefined"===typeof TextDecoder||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)}},{key:"shouldDecodeOnFallback",value:function(t){return!e.isBrowser()&&"ISO-8859-1"===t}},{key:"encode",value:function(e,t){var n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):"undefined"===typeof TextEncoder?this.encodeFallback(e):(new TextEncoder).encode(e)}},{key:"isBrowser",value:function(){return"undefined"!==typeof window&&"[object Window]"==={}.toString.call(window)}},{key:"encodingName",value:function(e){return"string"===typeof e?e:e.getName()}},{key:"encodingCharacterSet",value:function(e){return e instanceof R?e:R.getCharacterSetECIByName(e)}},{key:"decodeFallback",value:function(t,n){var r=this.encodingCharacterSet(n);if(e.isDecodeFallbackSupported(r)){for(var i="",a=0,o=t.length;a1&&void 0!==arguments[1]?arguments[1]:null,n=t?t.getName():this.ISO88591;return P.decode(new Uint8Array([e]),n)}},{key:"guessEncoding",value:function(t,n){if(null!==n&&void 0!==n&&void 0!==n.get(N.CHARACTER_SET))return n.get(N.CHARACTER_SET).toString();for(var r=t.length,i=!0,a=!0,o=!0,s=0,l=0,u=0,c=0,d=0,f=0,h=0,v=0,p=0,g=0,m=0,y=t.length>3&&239===t[0]&&187===t[1]&&191===t[2],w=0;w0?0===(128&E)?o=!1:s--:0!==(128&E)&&(0===(64&E)?o=!1:(s++,0===(32&E)?l++:(s++,0===(16&E)?u++:(s++,0===(8&E)?c++:o=!1))))),i&&(E>127&&E<160?i=!1:E>159&&(E<192||215===E||247===E)&&m++),a&&(d>0?E<64||127===E||E>252?a=!1:d--:128===E||160===E||E>239?a=!1:E>160&&E<224?(f++,v=0,++h>p&&(p=h)):E>127?(d++,h=0,++v>g&&(g=v)):(h=0,v=0))}return o&&s>0&&(o=!1),a&&d>0&&(a=!1),o&&(y||l+u+c>0)?e.UTF8:a&&(e.ASSUME_SHIFT_JIS||p>=3||g>=3)?e.SHIFT_JIS:i&&a?2===p&&2===f||10*m>=r?e.SHIFT_JIS:e.ISO88591:i?e.ISO88591:a?e.SHIFT_JIS:o?e.UTF8:e.PLATFORM_DEFAULT_ENCODING}},{key:"format",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:0;return e.charCodeAt(t)}},{key:"getCharAt",value:function(e){return String.fromCharCode(e)}}]),e}();x.SHIFT_JIS=R.SJIS.getName(),x.GB2312="GB2312",x.ISO88591=R.ISO8859_1.getName(),x.EUC_JP="EUC_JP",x.UTF8=R.UTF8.getName(),x.PLATFORM_DEFAULT_ENCODING=x.UTF8,x.ASSUME_SHIFT_JIS=!1;var L=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";u(this,e),this.value=t}return c(e,[{key:"enableDecoding",value:function(e){return this.encoding=e,this}},{key:"append",value:function(e){return"string"===typeof e?this.value+=e.toString():this.encoding?this.value+=x.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}},{key:"appendChars",value:function(e,t,n){for(var r=t;t>>(31&e)&1)}},{key:"set",value:function(e,t){var n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(31&e)&4294967295}},{key:"unset",value:function(e,t){var n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(31&e)&4294967295)}},{key:"flip",value:function(e,t){var n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(31&e)&4294967295}},{key:"xor",value:function(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new y("input matrix dimensions do not match");for(var t=new T(Math.floor(this.width/32)+1),n=this.rowSize,r=this.bits,i=0,a=this.height;ithis.height||i>this.width)throw new y("The region must fit inside the matrix");for(var o=this.rowSize,s=this.bits,l=t;ls&&(s=l),32*uo){for(var f=31;c>>>f===0;)f--;32*u+f>o&&(o=32*u+f)}}}return o=0&&0===t[n];)n--;if(n<0)return null;for(var r=Math.floor(n/e),i=32*Math.floor(n%e),a=t[n],o=31;a>>>o===0;)o--;return i+=o,Int32Array.from([i,r])}},{key:"getWidth",value:function(){return this.width}},{key:"getHeight",value:function(){return this.height}},{key:"getRowSize",value:function(){return this.rowSize}},{key:"equals",value:function(t){if(!(t instanceof e))return!1;var n=t;return this.width===n.width&&this.height===n.height&&this.rowSize===n.rowSize&&k.equals(this.bits,n.bits)}},{key:"hashCode",value:function(){var e=this.width;return e=31*(e=31*(e=31*(e=31*e+this.width)+this.height)+this.rowSize)+k.hashCode(this.bits)}},{key:"toString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"X ",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n";return this.buildToString(e,t,n)}},{key:"buildToString",value:function(e,t,n){for(var r=new L,i=0,a=this.height;io){if(-1===s)s=a-o;else if(a-o!==s)throw new y("row lengths do not match");o=a,l++}u++}else if(t.substring(u,u+n.length)===n)u+=n.length,i[a]=!0,a++;else{if(t.substring(u,u+r.length)!==r)throw new y("illegal character encountered: "+t.substring(u));u+=r.length,i[a]=!1,a++}if(a>o){if(-1===s)s=a-o;else if(a-o!==s)throw new y("row lengths do not match");l++}for(var c=new e(s,l),d=0;d>n.LUMINANCE_SHIFT]++;var l=n.estimateBlackPoint(o);if(i<3)for(var u=0;u>n.LUMINANCE_SHIFT]++;for(var d=n.estimateBlackPoint(a),f=e.getMatrix(),h=0;ha&&(i=o,a=e[o]),e[o]>r&&(r=e[o]);for(var s=0,l=0,u=0;ul&&(s=u,l=d)}if(i>s){var f=i;i=s,s=f}if(s-i<=t/16)throw new F;for(var h=s-1,v=-1,p=s-1;p>i;p--){var g=p-i,m=g*g*(s-p)*(r-e[p]);m>v&&(h=p,v=m)}return h<=n.MINIMUM_DIMENSION&&r>=n.MINIMUM_DIMENSION){var i=e.getMatrix(),a=t>>n.BLOCK_SIZE_POWER;0!==(t&n.BLOCK_SIZE_MASK)&&a++;var l=r>>n.BLOCK_SIZE_POWER;0!==(r&n.BLOCK_SIZE_MASK)&&l++;var u=n.calculateBlackPoints(i,a,l,t,r),c=new B(t,r);n.calculateThresholdForBlock(i,a,l,t,r,u,c),this.matrix=c}else this.matrix=o(s(n.prototype),"getBlackMatrix",this).call(this);return this.matrix}},{key:"createBinarizer",value:function(e){return new n(e)}}],[{key:"calculateThresholdForBlock",value:function(e,t,r,i,a,o,s){for(var l=a-n.BLOCK_SIZE,u=i-n.BLOCK_SIZE,c=0;cl&&(d=l);for(var f=n.cap(c,2,r-3),h=0;hu&&(v=u);for(var p=n.cap(h,2,t-3),g=0,m=-2;m<=2;m++){var y=o[f+m];g+=y[p-2]+y[p-1]+y[p]+y[p+1]+y[p+2]}var w=g/25;n.thresholdBlock(e,v,d,w,i,s)}}}},{key:"cap",value:function(e,t,n){return en?n:e}},{key:"thresholdBlock",value:function(e,t,r,i,a,o){for(var s=0,l=r*a+t;so&&(c=o);for(var d=0;ds&&(f=s);for(var h=0,v=255,p=0,g=0,m=c*i+f;gp&&(p=w)}if(p-v>n.MIN_DYNAMIC_RANGE)for(g++,m+=i;g>2*n.BLOCK_SIZE_POWER;if(p-v<=n.MIN_DYNAMIC_RANGE&&(C=v/2,u>0&&d>0)){var S=(l[u-1][d]+2*l[u][d-1]+l[u-1][d-1])/4;v=this.getHeight())throw new y("Requested row is outside the image: "+e);var n=this.getWidth(),r=e*n;return null===t?t=this.buffer.slice(r,r+n):(t.length>10,r[a]=s}return r}}]),n}(H);V.DEGREE_TO_RADIANS=Math.PI/180;var G,W=function(){function e(t,n,r){u(this,e),this.deviceId=t,this.label=n,this.kind="videoinput",this.groupId=r||void 0}return c(e,[{key:"toJSON",value:function(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}]),e}(),Y=(globalThis||n.g||self||window?(globalThis||n.g||self||window||void 0).__awaiter:void 0)||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,a){function o(e){try{l(r.next(e))}catch(t){a(t)}}function s(e){try{l(r.throw(e))}catch(t){a(t)}}function l(e){e.done?n(e.value):i(e.value).then(o,s)}l((r=r.apply(e,t||[])).next())}))},X=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,r=arguments.length>2?arguments[2]:void 0;u(this,e),this.reader=t,this.timeBetweenScansMillis=n,this._hints=r,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}return c(e,[{key:"hasNavigator",get:function(){return"undefined"!==typeof navigator}},{key:"isMediaDevicesSuported",get:function(){return this.hasNavigator&&!!navigator.mediaDevices}},{key:"canEnumerateDevices",get:function(){return!(!this.isMediaDevicesSuported||!navigator.mediaDevices.enumerateDevices)}},{key:"timeBetweenDecodingAttempts",get:function(){return this._timeBetweenDecodingAttempts},set:function(e){this._timeBetweenDecodingAttempts=e<0?0:e}},{key:"hints",get:function(){return this._hints},set:function(e){this._hints=e||null}},{key:"listVideoInputDevices",value:function(){return Y(this,void 0,void 0,a().mark((function e(){var t,n,r,i,o,s,u,c,d,f;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hasNavigator){e.next=2;break}throw new Error("Can't enumerate devices, navigator is not present.");case 2:if(this.canEnumerateDevices){e.next=4;break}throw new Error("Can't enumerate devices, method not supported.");case 4:return e.next=6,navigator.mediaDevices.enumerateDevices();case 6:t=e.sent,n=[],r=l(t),e.prev=9,r.s();case 11:if((i=r.n()).done){e.next=23;break}if(o=i.value,"videoinput"===(s="video"===o.kind?"videoinput":o.kind)){e.next=16;break}return e.abrupt("continue",21);case 16:u=o.deviceId||o.id,c=o.label||"Video device ".concat(n.length+1),d=o.groupId,f={deviceId:u,label:c,kind:s,groupId:d},n.push(f);case 21:e.next=11;break;case 23:e.next=28;break;case 25:e.prev=25,e.t0=e.catch(9),r.e(e.t0);case 28:return e.prev=28,r.f(),e.finish(28);case 31:return e.abrupt("return",n);case 32:case"end":return e.stop()}}),e,this,[[9,25,28,31]])})))}},{key:"getVideoInputDevices",value:function(){return Y(this,void 0,void 0,a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.listVideoInputDevices();case 2:return t=e.sent,e.abrupt("return",t.map((function(e){return new W(e.deviceId,e.label)})));case 4:case"end":return e.stop()}}),e,this)})))}},{key:"findDeviceById",value:function(e){return Y(this,void 0,void 0,a().mark((function t(){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.listVideoInputDevices();case 2:if(n=t.sent){t.next=5;break}return t.abrupt("return",null);case 5:return t.abrupt("return",n.find((function(t){return t.deviceId===e})));case 6:case"end":return t.stop()}}),t,this)})))}},{key:"decodeFromInputVideoDevice",value:function(e,t){return Y(this,void 0,void 0,a().mark((function n(){return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.decodeOnceFromVideoDevice(e,t);case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"decodeOnceFromVideoDevice",value:function(e,t){return Y(this,void 0,void 0,a().mark((function n(){var r;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.reset(),r={video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},n.next=5,this.decodeOnceFromConstraints(r,t);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n,this)})))}},{key:"decodeOnceFromConstraints",value:function(e,t){return Y(this,void 0,void 0,a().mark((function n(){var r;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,navigator.mediaDevices.getUserMedia(e);case 2:return r=n.sent,n.next=5,this.decodeOnceFromStream(r,t);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n,this)})))}},{key:"decodeOnceFromStream",value:function(e,t){return Y(this,void 0,void 0,a().mark((function n(){var r,i;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.reset(),n.next=3,this.attachStreamToVideo(e,t);case 3:return r=n.sent,n.next=6,this.decodeOnce(r);case 6:return i=n.sent,n.abrupt("return",i);case 8:case"end":return n.stop()}}),n,this)})))}},{key:"decodeFromInputVideoDeviceContinuously",value:function(e,t,n){return Y(this,void 0,void 0,a().mark((function r(){return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.decodeFromVideoDevice(e,t,n);case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"decodeFromVideoDevice",value:function(e,t,n){return Y(this,void 0,void 0,a().mark((function r(){var i;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i={video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},r.next=4,this.decodeFromConstraints(i,t,n);case 4:return r.abrupt("return",r.sent);case 5:case"end":return r.stop()}}),r,this)})))}},{key:"decodeFromConstraints",value:function(e,t,n){return Y(this,void 0,void 0,a().mark((function r(){var i;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,navigator.mediaDevices.getUserMedia(e);case 2:return i=r.sent,r.next=5,this.decodeFromStream(i,t,n);case 5:return r.abrupt("return",r.sent);case 6:case"end":return r.stop()}}),r,this)})))}},{key:"decodeFromStream",value:function(e,t,n){return Y(this,void 0,void 0,a().mark((function r(){var i;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.reset(),r.next=3,this.attachStreamToVideo(e,t);case 3:return i=r.sent,r.next=6,this.decodeContinuously(i,n);case 6:return r.abrupt("return",r.sent);case 7:case"end":return r.stop()}}),r,this)})))}},{key:"stopAsyncDecode",value:function(){this._stopAsyncDecode=!0}},{key:"stopContinuousDecode",value:function(){this._stopContinuousDecode=!0}},{key:"attachStreamToVideo",value:function(e,t){return Y(this,void 0,void 0,a().mark((function n(){var r;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=this.prepareVideoElement(t),this.addVideoSource(r,e),this.videoElement=r,this.stream=e,n.next=6,this.playVideoOnLoadAsync(r);case 6:return n.abrupt("return",r);case 7:case"end":return n.stop()}}),n,this)})))}},{key:"playVideoOnLoadAsync",value:function(e){var t=this;return new Promise((function(n,r){return t.playVideoOnLoad(e,(function(){return n()}))}))}},{key:"playVideoOnLoad",value:function(e,t){var n=this;this.videoEndedListener=function(){return n.stopStreams()},this.videoCanPlayListener=function(){return n.tryPlayVideo(e)},e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}},{key:"isVideoPlaying",value:function(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}},{key:"tryPlayVideo",value:function(e){return Y(this,void 0,void 0,a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.isVideoPlaying(e)){t.next=3;break}return console.warn("Trying to play video that is already playing."),t.abrupt("return");case 3:return t.prev=3,t.next=6,e.play();case 6:t.next=11;break;case 8:t.prev=8,t.t0=t.catch(3),console.warn("It was not possible to play the video.");case 11:case"end":return t.stop()}}),t,this,[[3,8]])})))}},{key:"getMediaElement",value:function(e,t){var n=document.getElementById(e);if(!n)throw new m("element with id '".concat(e,"' not found"));if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new m("element with id '".concat(e,"' must be an ").concat(t," element"));return n}},{key:"decodeFromImage",value:function(e,t){if(!e&&!t)throw new m("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)}},{key:"decodeFromVideo",value:function(e,t){if(!e&&!t)throw new m("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}},{key:"decodeFromVideoContinuously",value:function(e,t,n){if(void 0===e&&void 0===t)throw new m("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)}},{key:"decodeFromImageElement",value:function(e){if(!e)throw new m("An image element must be provided.");this.reset();var t=this.prepareImageElement(e);return this.imageElement=t,this.isImageLoaded(t)?this.decodeOnce(t,!1,!0):this._decodeOnLoadImage(t)}},{key:"decodeFromVideoElement",value:function(e){var t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}},{key:"decodeFromVideoElementContinuously",value:function(e,t){var n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)}},{key:"_decodeFromVideoElementSetup",value:function(e){if(!e)throw new m("A video element must be provided.");this.reset();var t=this.prepareVideoElement(e);return this.videoElement=t,t}},{key:"decodeFromImageUrl",value:function(e){if(!e)throw new m("An URL must be provided.");this.reset();var t=this.prepareImageElement();this.imageElement=t;var n=this._decodeOnLoadImage(t);return t.src=e,n}},{key:"decodeFromVideoUrl",value:function(e){if(!e)throw new m("An URL must be provided.");this.reset();var t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n}},{key:"decodeFromVideoUrlContinuously",value:function(e,t){if(!e)throw new m("An URL must be provided.");this.reset();var n=this.prepareVideoElement(),r=this.decodeFromVideoElementContinuously(n,t);return n.src=e,r}},{key:"_decodeOnLoadImage",value:function(e){var t=this;return new Promise((function(n,r){t.imageLoadedListener=function(){return t.decodeOnce(e,!1,!0).then(n,r)},e.addEventListener("load",t.imageLoadedListener)}))}},{key:"_decodeOnLoadVideo",value:function(e){return Y(this,void 0,void 0,a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.playVideoOnLoadAsync(e);case 2:return t.next=4,this.decodeOnce(e);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)})))}},{key:"_decodeOnLoadVideoContinuously",value:function(e,t){return Y(this,void 0,void 0,a().mark((function n(){return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.playVideoOnLoadAsync(e);case 2:this.decodeContinuously(e,t);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"isImageLoaded",value:function(e){return!!e.complete&&0!==e.naturalWidth}},{key:"prepareImageElement",value:function(e){var t;return"undefined"===typeof e&&((t=document.createElement("img")).width=200,t.height=200),"string"===typeof e&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}},{key:"prepareVideoElement",value:function(e){var t;return e||"undefined"===typeof document||((t=document.createElement("video")).width=200,t.height=200),"string"===typeof e&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}},{key:"decodeOnce",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this._stopAsyncDecode=!1;var i=function i(a,o){if(t._stopAsyncDecode)return o(new F("Video stream has ended before any code could be detected.")),void(t._stopAsyncDecode=void 0);try{a(t.decode(e))}catch(s){if(n&&s instanceof F||(s instanceof E||s instanceof D)&&r)return setTimeout(i,t._timeBetweenDecodingAttempts,a,o);o(s)}};return new Promise((function(e,t){return i(e,t)}))}},{key:"decodeContinuously",value:function(e,t){var n=this;this._stopContinuousDecode=!1,function r(){if(n._stopContinuousDecode)n._stopContinuousDecode=void 0;else try{var i=n.decode(e);t(i,null),setTimeout(r,n.timeBetweenScansMillis)}catch(a){t(null,a),(a instanceof E||a instanceof D||a instanceof F)&&setTimeout(r,n._timeBetweenDecodingAttempts)}}()}},{key:"decode",value:function(e){var t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}},{key:"createBinaryBitmap",value:function(e){var t=this.getCaptureCanvasContext(e);this.drawImageOnCanvas(t,e);var n=this.getCaptureCanvas(e),r=new V(n),i=new z(r);return new w(i)}},{key:"getCaptureCanvasContext",value:function(e){if(!this.captureCanvasContext){var t=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=t}return this.captureCanvasContext}},{key:"getCaptureCanvas",value:function(e){if(!this.captureCanvas){var t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas}},{key:"drawImageOnCanvas",value:function(e,t){e.drawImage(t,0,0)}},{key:"decodeBitmap",value:function(e){return this.reader.decode(e,this._hints)}},{key:"createCaptureCanvas",value:function(e){if("undefined"===typeof document)return this._destroyCaptureCanvas(),null;var t,n,r=document.createElement("canvas");return"undefined"!==typeof e&&(e instanceof HTMLVideoElement?(t=e.videoWidth,n=e.videoHeight):e instanceof HTMLImageElement&&(t=e.naturalWidth||e.width,n=e.naturalHeight||e.height)),r.style.width=t+"px",r.style.height=n+"px",r.width=t,r.height=n,r}},{key:"stopStreams",value:function(){this.stream&&(this.stream.getVideoTracks().forEach((function(e){return e.stop()})),this.stream=void 0),!1===this._stopAsyncDecode&&this.stopAsyncDecode(),!1===this._stopContinuousDecode&&this.stopContinuousDecode()}},{key:"reset",value:function(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}},{key:"_destroyVideoElement",value:function(){this.videoElement&&("undefined"!==typeof this.videoEndedListener&&this.videoElement.removeEventListener("ended",this.videoEndedListener),"undefined"!==typeof this.videoPlayingEventListener&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),"undefined"!==typeof this.videoCanPlayListener&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}},{key:"_destroyImageElement",value:function(){this.imageElement&&(void 0!==this.imageLoadedListener&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}},{key:"_destroyCaptureCanvas",value:function(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}},{key:"addVideoSource",value:function(e,t){try{e.srcObject=t}catch(n){e.src=URL.createObjectURL(t)}}},{key:"cleanVideoSource",value:function(e){try{e.srcObject=null}catch(t){e.src=""}this.videoElement.removeAttribute("src")}}]),e}(),Q=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null==n?0:8*n.length,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:S.currentTimeMillis();u(this,e),this.text=t,this.rawBytes=n,this.numBits=r,this.resultPoints=i,this.format=a,this.timestamp=o,this.text=t,this.rawBytes=n,this.numBits=void 0===r||null===r?null===n||void 0===n?0:8*n.length:r,this.resultPoints=i,this.format=a,this.resultMetadata=null,this.timestamp=void 0===o||null===o?S.currentTimeMillis():o}return c(e,[{key:"getText",value:function(){return this.text}},{key:"getRawBytes",value:function(){return this.rawBytes}},{key:"getNumBits",value:function(){return this.numBits}},{key:"getResultPoints",value:function(){return this.resultPoints}},{key:"getBarcodeFormat",value:function(){return this.format}},{key:"getResultMetadata",value:function(){return this.resultMetadata}},{key:"putMetadata",value:function(e,t){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}},{key:"putAllMetadata",value:function(e){null!==e&&(null===this.resultMetadata?this.resultMetadata=e:this.resultMetadata=new Map(e))}},{key:"addResultPoints",value:function(e){var t=this.resultPoints;if(null===t)this.resultPoints=e;else if(null!==e&&e.length>0){var n=new Array(t.length+e.length);S.arraycopy(t,0,n,0,t.length),S.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}},{key:"getTimestamp",value:function(){return this.timestamp}},{key:"toString",value:function(){return this.text}}]),e}();!function(e){e[e.AZTEC=0]="AZTEC",e[e.CODABAR=1]="CODABAR",e[e.CODE_39=2]="CODE_39",e[e.CODE_93=3]="CODE_93",e[e.CODE_128=4]="CODE_128",e[e.DATA_MATRIX=5]="DATA_MATRIX",e[e.EAN_8=6]="EAN_8",e[e.EAN_13=7]="EAN_13",e[e.ITF=8]="ITF",e[e.MAXICODE=9]="MAXICODE",e[e.PDF_417=10]="PDF_417",e[e.QR_CODE=11]="QR_CODE",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(G||(G={}));var Z,K=G;!function(e){e[e.OTHER=0]="OTHER",e[e.ORIENTATION=1]="ORIENTATION",e[e.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",e[e.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",e[e.ISSUE_NUMBER=4]="ISSUE_NUMBER",e[e.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",e[e.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",e[e.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",e[e.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",e[e.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",e[e.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"}(Z||(Z={}));var q=Z,$=function(){function e(t,n,r,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:-1;u(this,e),this.rawBytes=t,this.text=n,this.byteSegments=r,this.ecLevel=i,this.structuredAppendSequenceNumber=a,this.structuredAppendParity=o,this.numBits=void 0===t||null===t?0:8*t.length}return c(e,[{key:"getRawBytes",value:function(){return this.rawBytes}},{key:"getNumBits",value:function(){return this.numBits}},{key:"setNumBits",value:function(e){this.numBits=e}},{key:"getText",value:function(){return this.text}},{key:"getByteSegments",value:function(){return this.byteSegments}},{key:"getECLevel",value:function(){return this.ecLevel}},{key:"getErrorsCorrected",value:function(){return this.errorsCorrected}},{key:"setErrorsCorrected",value:function(e){this.errorsCorrected=e}},{key:"getErasures",value:function(){return this.erasures}},{key:"setErasures",value:function(e){this.erasures=e}},{key:"getOther",value:function(){return this.other}},{key:"setOther",value:function(e){this.other=e}},{key:"hasStructuredAppend",value:function(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}},{key:"getStructuredAppendParity",value:function(){return this.structuredAppendParity}},{key:"getStructuredAppendSequenceNumber",value:function(){return this.structuredAppendSequenceNumber}}]),e}(),J=function(){function e(){u(this,e)}return c(e,[{key:"exp",value:function(e){return this.expTable[e]}},{key:"log",value:function(e){if(0===e)throw new y;return this.logTable[e]}}],[{key:"addOrSubtract",value:function(e,t){return e^t}}]),e}(),ee=function(){function e(t,n){if(u(this,e),0===n.length)throw new y;this.field=t;var r=n.length;if(r>1&&0===n[0]){for(var i=1;ir.length){var i=n;n=r,r=i}var a=new Int32Array(r.length),o=r.length-n.length;S.arraycopy(r,0,a,0,o);for(var s=o;s=e.getDegree()&&!r.isZero();){var o=r.getDegree()-e.getDegree(),s=t.multiply(r.getCoefficient(r.getDegree()),a),l=e.multiplyByMonomial(o,s),u=t.buildMonomial(o,s);n=n.addOrSubtract(u),r=r.addOrSubtract(l)}return[n,r]}},{key:"toString",value:function(){for(var e="",t=this.getDegree();t>=0;t--){var n=this.getCoefficient(t);if(0!==n){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),0===t||1!==n){var r=this.field.log(n);0===r?e+="1":1===r?e+="a":(e+="a^",e+=r)}0!==t&&(1===t?e+="x":(e+="x^",e+=t))}}return e}}]),e}(),te=function(e){d(n,e);var t=f(n);function n(){return u(this,n),t.apply(this,arguments)}return c(n)}(g);te.kind="ArithmeticException";var ne=function(e){d(n,e);var t=f(n);function n(e,r,a){var o;u(this,n),(o=t.call(this)).primitive=e,o.size=r,o.generatorBase=a;for(var s=new Int32Array(r),l=1,c=0;c=r&&(l^=e,l&=r-1);o.expTable=s;for(var d=new Int32Array(r),f=0;f=(n/2|0);){var u=a,c=s;if(s=l,(a=o).isZero())throw new re("r_{i-1} was zero");o=u;for(var d=i.getZero(),f=a.getCoefficient(a.getDegree()),h=i.inverse(f);o.getDegree()>=a.getDegree()&&!o.isZero();){var v=o.getDegree()-a.getDegree(),p=i.multiply(o.getCoefficient(o.getDegree()),h);d=d.addOrSubtract(i.buildMonomial(v,p)),o=o.addOrSubtract(a.multiplyByMonomial(v,p))}if(l=d.multiply(s).addOrSubtract(c),o.getDegree()>=a.getDegree())throw new ie("Division algorithm failed to reduce polynomial?")}var g=l.getCoefficient(0);if(0===g)throw new re("sigmaTilde(0) was zero");var m=i.inverse(g);return[l.multiplyScalar(m),o.multiplyScalar(m)]}},{key:"findErrorLocations",value:function(e){var t=e.getDegree();if(1===t)return Int32Array.from([e.getCoefficient(1)]);for(var n=new Int32Array(t),r=0,i=this.field,a=1;a1,v,v+r-1),v+=r-1;else for(var m=r-1;m>=0;--m)h[v++]=0!==(g&1<=8?e.readCode(t,n,8):e.readCode(t,n,r)<<8-r}},{key:"convertBoolArrayToByteArray",value:function(t){for(var n=new Uint8Array((t.length+7)/8),r=0;r","?","[","]","{","}","CTRL_UL"],se.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];var le=function(){function e(){u(this,e)}return c(e,null,[{key:"round",value:function(e){return NaN===e?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}},{key:"distance",value:function(e,t,n,r){var i=e-n,a=t-r;return Math.sqrt(i*i+a*a)}},{key:"sum",value:function(e){for(var t=0,n=0,r=e.length;n!==r;n++)t+=e[n];return t}}]),e}(),ue=function(){function e(){u(this,e)}return c(e,null,[{key:"floatToIntBits",value:function(e){return e}}]),e}();ue.MAX_VALUE=Number.MAX_SAFE_INTEGER;var ce=function(){function e(t,n){u(this,e),this.x=t,this.y=n}return c(e,[{key:"getX",value:function(){return this.x}},{key:"getY",value:function(){return this.y}},{key:"equals",value:function(t){if(t instanceof e){var n=t;return this.x===n.x&&this.y===n.y}return!1}},{key:"hashCode",value:function(){return 31*ue.floatToIntBits(this.x)+ue.floatToIntBits(this.y)}},{key:"toString",value:function(){return"("+this.x+","+this.y+")"}}],[{key:"orderBestPatterns",value:function(e){var t,n,r,i=this.distance(e[0],e[1]),a=this.distance(e[1],e[2]),o=this.distance(e[0],e[2]);if(a>=i&&a>=o?(n=e[0],t=e[1],r=e[2]):o>=a&&o>=i?(n=e[1],t=e[0],r=e[2]):(n=e[2],t=e[0],r=e[1]),this.crossProductZ(t,n,r)<0){var s=t;t=r,r=s}e[0]=t,e[1]=n,e[2]=r}},{key:"distance",value:function(e,t){return le.distance(e.x,e.y,t.x,t.y)}},{key:"crossProductZ",value:function(e,t,n){var r=t.x,i=t.y;return(n.x-r)*(e.y-i)-(n.y-i)*(e.x-r)}}]),e}(),de=function(){function e(t,n){u(this,e),this.bits=t,this.points=n}return c(e,[{key:"getBits",value:function(){return this.bits}},{key:"getPoints",value:function(){return this.points}}]),e}(),fe=function(e){d(n,e);var t=f(n);function n(e,r,i,a,o){var s;return u(this,n),(s=t.call(this,e,r)).compact=i,s.nbDatablocks=a,s.nbLayers=o,s}return c(n,[{key:"getNbLayers",value:function(){return this.nbLayers}},{key:"getNbDatablocks",value:function(){return this.nbDatablocks}},{key:"isCompact",value:function(){return this.compact}}]),n}(de),he=function(){function e(t,n,r,i){u(this,e),this.image=t,this.height=t.getHeight(),this.width=t.getWidth(),void 0!==n&&null!==n||(n=e.INIT_SIZE),void 0!==r&&null!==r||(r=t.getWidth()/2|0),void 0!==i&&null!==i||(i=t.getHeight()/2|0);var a=n/2|0;if(this.leftInit=r-a,this.rightInit=r+a,this.upInit=i-a,this.downInit=i+a,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new F}return c(e,[{key:"detect",value:function(){for(var e=this.leftInit,t=this.rightInit,n=this.upInit,r=this.downInit,i=!1,a=!0,o=!1,s=!1,l=!1,u=!1,c=!1,d=this.width,f=this.height;a;){a=!1;for(var h=!0;(h||!s)&&t=d){i=!0;break}for(var v=!0;(v||!l)&&r=f){i=!0;break}for(var p=!0;(p||!u)&&e>=0;)(p=this.containsBlackPoint(n,r,e,!1))?(e--,a=!0,u=!0):u||e--;if(e<0){i=!0;break}for(var g=!0;(g||!c)&&n>=0;)(g=this.containsBlackPoint(e,t,n,!0))?(n--,a=!0,c=!0):c||n--;if(n<0){i=!0;break}a&&(o=!0)}if(!i&&o){for(var m=t-e,y=null,w=1;null===y&&wn||s<-1||s>r)throw new F;i=!1,-1===o?(t[a]=0,i=!0):o===n&&(t[a]=n-1,i=!0),-1===s?(t[a+1]=0,i=!0):s===r&&(t[a+1]=r-1,i=!0)}i=!0;for(var l=t.length-2;l>=0&&i;l-=2){var u=Math.floor(t[l]),c=Math.floor(t[l+1]);if(u<-1||u>n||c<-1||c>r)throw new F;i=!1,-1===u?(t[l]=0,i=!0):u===n&&(t[l]=n-1,i=!0),-1===c?(t[l+1]=0,i=!0):c===r&&(t[l+1]=r-1,i=!0)}}}]),e}(),pe=function(){function e(t,n,r,i,a,o,s,l,c){u(this,e),this.a11=t,this.a21=n,this.a31=r,this.a12=i,this.a22=a,this.a32=o,this.a13=s,this.a23=l,this.a33=c}return c(e,[{key:"transformPoints",value:function(e){for(var t=e.length,n=this.a11,r=this.a12,i=this.a13,a=this.a21,o=this.a22,s=this.a23,l=this.a31,u=this.a32,c=this.a33,d=0;d>1&127):(r<<=10,r+=(a>>2&992)+(a>>1&31))}var o=this.getCorrectedParameterData(r,this.compact);this.compact?(this.nbLayers=1+(o>>6),this.nbDataBlocks=1+(63&o)):(this.nbLayers=1+(o>>11),this.nbDataBlocks=1+(2047&o))}},{key:"getRotation",value:function(e,t){var n=0;e.forEach((function(e,r,i){n=(e>>t-2<<1)+(1&e)+(n<<3)})),n=((1&n)<<11)+(n>>1);for(var r=0;r<4;r++)if(_.bitCount(n^this.EXPECTED_CORNER_BITS[r])<=2)return r;throw new F}},{key:"getCorrectedParameterData",value:function(e,t){var n,r;t?(n=7,r=2):(n=10,r=4);for(var i=n-r,a=new Int32Array(n),o=n-1;o>=0;--o)a[o]=15&e,e>>=4;try{new oe(ne.AZTEC_PARAM).decode(a,i)}catch(u){throw new F}for(var s=0,l=0;l2){var c=this.distancePoint(u,o)*this.nbCenterLayers/(this.distancePoint(i,t)*(this.nbCenterLayers+2));if(c<.75||c>1.25||!this.isWhiteOrBlackRectangle(o,s,l,u))break}t=o,n=s,r=l,i=u,a=!a}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new F;this.compact=5===this.nbCenterLayers;var d=new ce(t.getX()+.5,t.getY()-.5),f=new ce(n.getX()+.5,n.getY()+.5),h=new ce(r.getX()-.5,r.getY()+.5),v=new ce(i.getX()-.5,i.getY()-.5);return this.expandSquare([d,f,h,v],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}},{key:"getMatrixCenter",value:function(){var e,t,n,r;try{var i=new he(this.image).detect();e=i[0],t=i[1],n=i[2],r=i[3]}catch(c){var a=this.image.getWidth()/2,o=this.image.getHeight()/2;e=this.getFirstDifferent(new ye(a+7,o-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new ye(a+7,o+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new ye(a-7,o+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new ye(a-7,o-7),!1,-1,-1).toResultPoint()}var s=le.round((e.getX()+r.getX()+t.getX()+n.getX())/4),l=le.round((e.getY()+r.getY()+t.getY()+n.getY())/4);try{var u=new he(this.image,15,s,l).detect();e=u[0],t=u[1],n=u[2],r=u[3]}catch(c){e=this.getFirstDifferent(new ye(s+7,l-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new ye(s+7,l+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new ye(s-7,l+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new ye(s-7,l-7),!1,-1,-1).toResultPoint()}return s=le.round((e.getX()+r.getX()+t.getX()+n.getX())/4),l=le.round((e.getY()+r.getY()+t.getY()+n.getY())/4),new ye(s,l)}},{key:"getMatrixCornerPoints",value:function(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}},{key:"sampleGrid",value:function(e,t,n,r,i){var a=me.getInstance(),o=this.getDimension(),s=o/2-this.nbCenterLayers,l=o/2+this.nbCenterLayers;return a.sampleGrid(e,o,o,s,s,l,s,l,l,s,l,t.getX(),t.getY(),n.getX(),n.getY(),r.getX(),r.getY(),i.getX(),i.getY())}},{key:"sampleLine",value:function(e,t,n){for(var r=0,i=this.distanceResultPoint(e,t),a=i/n,o=e.getX(),s=e.getY(),l=a*(t.getX()-e.getX())/i,u=a*(t.getY()-e.getY())/i,c=0;c.1&&d<.9?0:d<=.1===l?1:-1}},{key:"getFirstDifferent",value:function(e,t,n,r){for(var i=e.getX()+n,a=e.getY()+r;this.isValid(i,a)&&this.image.get(i,a)===t;)i+=n,a+=r;for(i-=n,a-=r;this.isValid(i,a)&&this.image.get(i,a)===t;)i+=n;for(i-=n;this.isValid(i,a)&&this.image.get(i,a)===t;)a+=r;return new ye(i,a-=r)}},{key:"expandSquare",value:function(e,t,n){var r=n/(2*t),i=e[0].getX()-e[2].getX(),a=e[0].getY()-e[2].getY(),o=(e[0].getX()+e[2].getX())/2,s=(e[0].getY()+e[2].getY())/2,l=new ce(o+r*i,s+r*a),u=new ce(o-r*i,s-r*a);return i=e[1].getX()-e[3].getX(),a=e[1].getY()-e[3].getY(),o=(e[1].getX()+e[3].getX())/2,s=(e[1].getY()+e[3].getY())/2,[l,new ce(o+r*i,s+r*a),u,new ce(o-r*i,s-r*a)]}},{key:"isValid",value:function(e,t){return e>=0&&e0&&t1&&void 0!==arguments[1]?arguments[1]:null,n=null,r=new we(e.getBlackMatrix()),i=null,a=null;try{var o=r.detectMirror(!1);i=o.getPoints(),this.reportFoundResultPoints(t,i),a=(new se).decode(o)}catch(d){n=d}if(null==a)try{var s=r.detectMirror(!0);i=s.getPoints(),this.reportFoundResultPoints(t,i),a=(new se).decode(s)}catch(d){if(null!=n)throw n;throw d}var l=new Q(a.getText(),a.getRawBytes(),a.getNumBits(),i,K.AZTEC,S.currentTimeMillis()),u=a.getByteSegments();null!=u&&l.putMetadata(q.BYTE_SEGMENTS,u);var c=a.getECLevel();return null!=c&&l.putMetadata(q.ERROR_CORRECTION_LEVEL,c),l}},{key:"reportFoundResultPoints",value:function(e,t){if(null!=e){var n=e.get(N.NEED_RESULT_POINT_CALLBACK);null!=n&&t.forEach((function(e,t,r){n.foundPossibleResultPoint(e)}))}}},{key:"reset",value:function(){}}]),e}(),Ce=function(e){d(n,e);var t=f(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;return u(this,n),t.call(this,new Ee,e)}return c(n)}(X),Se=function(){function e(){u(this,e)}return c(e,[{key:"decode",value:function(e,t){try{return this.doDecode(e,t)}catch(u){if(t&&!0===t.get(N.TRY_HARDER)&&e.isRotateSupported()){var n=e.rotateCounterClockwise(),r=this.doDecode(n,t),i=r.getResultMetadata(),a=270;null!==i&&!0===i.get(q.ORIENTATION)&&(a+=i.get(q.ORIENTATION)%360),r.putMetadata(q.ORIENTATION,a);var o=r.getResultPoints();if(null!==o)for(var s=n.getHeight(),l=0;l>(o?8:5));n=o?i:15;for(var l=Math.trunc(i/2),u=0;u=i)break;try{a=e.getBlackRow(d,a)}catch(p){continue}for(var f=0;f<2;f++){1===f&&(a.reverse(),t&&!0===t.get(N.NEED_RESULT_POINT_CALLBACK)&&function(){var e=new Map;t.forEach((function(t,n){return e.set(n,t)})),e.delete(N.NEED_RESULT_POINT_CALLBACK),t=e}());try{var h=this.decodeRow(d,a,t);if(1===f){h.putMetadata(q.ORIENTATION,180);var v=h.getResultPoints();null!==v&&(v[0]=new ce(r-v[0].getX()-1,v[0].getY()),v[1]=new ce(r-v[1].getX()-1,v[1].getY()))}return h}catch(g){}}}throw new F}}],[{key:"recordPattern",value:function(e,t,n){for(var r=n.length,i=0;i=a)throw new F;for(var o=!e.get(t),s=0,l=t;l0&&i>=0;)t.get(--n)!==a&&(i--,a=!a);if(i>=0)throw new F;e.recordPattern(t,n+1,r)}},{key:"patternMatchVariance",value:function(e,t,n){for(var r=e.length,i=0,a=0,o=0;od?c-d:d-c;if(f>n)return Number.POSITIVE_INFINITY;l+=f}return l/i}}]),e}(),Ae=function(e){d(n,e);var t=f(n);function n(){return u(this,n),t.apply(this,arguments)}return c(n,[{key:"decodeRow",value:function(e,t,r){var i,a=r&&!0===r.get(N.ASSUME_GS1),o=n.findStartPattern(t),s=o[2],l=0,u=new Uint8Array(20);switch(u[l++]=s,s){case n.CODE_START_A:i=n.CODE_CODE_A;break;case n.CODE_START_B:i=n.CODE_CODE_B;break;case n.CODE_START_C:i=n.CODE_CODE_C;break;default:throw new D}for(var c=!1,d=!1,f="",h=o[0],v=o[1],p=Int32Array.from([0,0,0,0,0,0]),g=0,m=0,y=s,w=0,C=!0,S=!1,A=!1;!c;){var b=d;switch(d=!1,g=m,m=n.decodeCode(t,p,v),u[l++]=m,m!==n.CODE_STOP&&(C=!0),m!==n.CODE_STOP&&(y+=++w*m),h=v,v+=p.reduce((function(e,t){return e+t}),0),m){case n.CODE_START_A:case n.CODE_START_B:case n.CODE_START_C:throw new D}switch(i){case n.CODE_CODE_A:if(m<64)f+=A===S?String.fromCharCode(" ".charCodeAt(0)+m):String.fromCharCode(" ".charCodeAt(0)+m+128),A=!1;else if(m<96)f+=A===S?String.fromCharCode(m-64):String.fromCharCode(m+64),A=!1;else switch(m!==n.CODE_STOP&&(C=!1),m){case n.CODE_FNC_1:a&&(0===f.length?f+="]C1":f+=String.fromCharCode(29));break;case n.CODE_FNC_2:case n.CODE_FNC_3:break;case n.CODE_FNC_4_A:!S&&A?(S=!0,A=!1):S&&A?(S=!1,A=!1):A=!0;break;case n.CODE_SHIFT:d=!0,i=n.CODE_CODE_B;break;case n.CODE_CODE_B:i=n.CODE_CODE_B;break;case n.CODE_CODE_C:i=n.CODE_CODE_C;break;case n.CODE_STOP:c=!0}break;case n.CODE_CODE_B:if(m<96)f+=A===S?String.fromCharCode(" ".charCodeAt(0)+m):String.fromCharCode(" ".charCodeAt(0)+m+128),A=!1;else switch(m!==n.CODE_STOP&&(C=!1),m){case n.CODE_FNC_1:a&&(0===f.length?f+="]C1":f+=String.fromCharCode(29));break;case n.CODE_FNC_2:case n.CODE_FNC_3:break;case n.CODE_FNC_4_B:!S&&A?(S=!0,A=!1):S&&A?(S=!1,A=!1):A=!0;break;case n.CODE_SHIFT:d=!0,i=n.CODE_CODE_A;break;case n.CODE_CODE_A:i=n.CODE_CODE_A;break;case n.CODE_CODE_C:i=n.CODE_CODE_C;break;case n.CODE_STOP:c=!0}break;case n.CODE_CODE_C:if(m<100)m<10&&(f+="0"),f+=m;else switch(m!==n.CODE_STOP&&(C=!1),m){case n.CODE_FNC_1:a&&(0===f.length?f+="]C1":f+=String.fromCharCode(29));break;case n.CODE_CODE_A:i=n.CODE_CODE_A;break;case n.CODE_CODE_B:i=n.CODE_CODE_B;break;case n.CODE_STOP:c=!0}}b&&(i=i===n.CODE_CODE_A?n.CODE_CODE_B:n.CODE_CODE_A)}var k=v-h;if(v=t.getNextUnset(v),!t.isRange(v,Math.min(t.getSize(),v+(v-h)/2),!1))throw new F;if((y-=w*g)%103!==g)throw new E;var _=f.length;if(0===_)throw new F;_>0&&C&&(f=i===n.CODE_CODE_C?f.substring(0,_-2):f.substring(0,_-1));for(var I=(o[1]+o[0])/2,T=h+k/2,M=u.length,R=new Uint8Array(M),O=0;O=0&&e.isRange(Math.max(0,o-(u-o)/2),o,!1))return Int32Array.from([o,u,d]);o+=a[0]+a[1],(a=a.slice(2,a.length-1))[i-1]=0,a[i]=0,i--}else i++;a[i]=1,s=!s}throw new F}},{key:"decodeCode",value:function(e,t,r){Se.recordPattern(e,r,t);for(var i=n.MAX_AVG_VARIANCE,a=-1,o=0;o=0)return a;throw new F}}]),n}(Se);Ae.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],Ae.MAX_AVG_VARIANCE=.25,Ae.MAX_INDIVIDUAL_VARIANCE=.7,Ae.CODE_SHIFT=98,Ae.CODE_CODE_C=99,Ae.CODE_CODE_B=100,Ae.CODE_CODE_A=101,Ae.CODE_FNC_1=102,Ae.CODE_FNC_2=97,Ae.CODE_FNC_3=96,Ae.CODE_FNC_4_A=101,Ae.CODE_FNC_4_B=100,Ae.CODE_START_A=103,Ae.CODE_START_B=104,Ae.CODE_START_C=105,Ae.CODE_STOP=106;var be=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return u(this,n),(e=t.call(this)).usingCheckDigit=r,e.extendedMode=i,e.decodeRowResult="",e.counters=new Int32Array(9),e}return c(n,[{key:"decodeRow",value:function(e,t,r){var i=this.counters;i.fill(0),this.decodeRowResult="";var a,o,s=n.findAsteriskPattern(t,i),u=t.getNextSet(s[1]),c=t.getSize();do{n.recordPattern(t,u,i);var d=n.toNarrowWidePattern(i);if(d<0)throw new F;a=n.patternToChar(d),this.decodeRowResult+=a,o=u;var f,h=l(i);try{for(h.s();!(f=h.n()).done;)u+=f.value}catch(b){h.e(b)}finally{h.f()}u=t.getNextSet(u)}while("*"!==a);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var v,p,g=0,m=l(i);try{for(m.s();!(v=m.n()).done;)g+=v.value}catch(b){m.e(b)}finally{m.f()}if(u!==c&&2*(u-o-g)r&&(a=s)}}catch(p){o.e(p)}finally{o.f()}r=a,t=0;for(var u=0,c=0,d=0;dr&&(c|=1<0;h++){var v=e[h];if(v>r&&(t--,2*v>=u))return-1}return c}}while(t>3);return-1}},{key:"patternToChar",value:function(e){for(var t=0;t="A"&&a<="Z"))throw new D;o=String.fromCharCode(a.charCodeAt(0)+32);break;case"$":if(!(a>="A"&&a<="Z"))throw new D;o=String.fromCharCode(a.charCodeAt(0)-64);break;case"%":if(a>="A"&&a<="E")o=String.fromCharCode(a.charCodeAt(0)-38);else if(a>="F"&&a<="J")o=String.fromCharCode(a.charCodeAt(0)-11);else if(a>="K"&&a<="O")o=String.fromCharCode(a.charCodeAt(0)+16);else if(a>="P"&&a<="T")o=String.fromCharCode(a.charCodeAt(0)+43);else if("U"===a)o="\0";else if("V"===a)o="@";else if("W"===a)o="`";else{if("X"!==a&&"Y"!==a&&"Z"!==a)throw new D;o="\x7f"}break;case"/":if(a>="A"&&a<="O")o=String.fromCharCode(a.charCodeAt(0)-32);else{if("Z"!==a)throw new D;o=":"}}n+=o,r++}else n+=i}return n}}]),n}(Se);be.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",be.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],be.ASTERISK_ENCODING=148;var ke=function(e){d(n,e);var t=f(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments)).narrowLineWidth=-1,e}return c(n,[{key:"decodeRow",value:function(e,t,r){var i=this.decodeStart(t),a=this.decodeEnd(t),o=new L;n.decodeMiddle(t,i[1],a[0],o);var s=o.toString(),u=null;null!=r&&(u=r.get(N.ALLOWED_LENGTHS)),null==u&&(u=n.DEFAULT_ALLOWED_LENGTHS);var c,d=s.length,f=!1,h=0,v=l(u);try{for(v.s();!(c=v.n()).done;){var p=c.value;if(d===p){f=!0;break}p>h&&(h=p)}}catch(m){v.e(m)}finally{v.f()}if(!f&&d>h&&(f=!0),!f)throw new D;var g=[new ce(i[1],e),new ce(a[0],e)];return new Q(s,null,0,g,K.ITF,(new Date).getTime())}},{key:"decodeStart",value:function(e){var t=n.skipWhiteSpace(e),r=n.findGuardPattern(e,t,n.START_PATTERN);return this.narrowLineWidth=(r[1]-r[0])/4,this.validateQuietZone(e,r[0]),r}},{key:"validateQuietZone",value:function(e,t){var n=10*this.narrowLineWidth;n=n0&&r>=0&&!e.get(r);r--)n--;if(0!==n)throw new F}},{key:"decodeEnd",value:function(e){e.reverse();try{var t,r=n.skipWhiteSpace(e);try{t=n.findGuardPattern(e,r,n.END_PATTERN_REVERSED[0])}catch(a){a instanceof F&&(t=n.findGuardPattern(e,r,n.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,t[0]);var i=t[0];return t[0]=e.getSize()-t[1],t[1]=e.getSize()-i,t}finally{e.reverse()}}}],[{key:"decodeMiddle",value:function(e,t,r,i){var a=new Int32Array(10),o=new Int32Array(5),s=new Int32Array(5);for(a.fill(0),o.fill(0),s.fill(0);t=0)return r%10;throw new F}}]),n}(Se);ke.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],ke.MAX_AVG_VARIANCE=.38,ke.MAX_INDIVIDUAL_VARIANCE=.5,ke.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],ke.START_PATTERN=Int32Array.from([1,1,1,1]),ke.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];var _e=function(e){d(n,e);var t=f(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments)).decodeRowStringBuffer="",e}return c(n,null,[{key:"findStartGuardPattern",value:function(e){for(var t,r=!1,i=0,a=Int32Array.from([0,0,0]);!r;){a=Int32Array.from([0,0,0]);var o=(t=n.findGuardPattern(e,i,!1,this.START_END_PATTERN,a))[0],s=o-((i=t[1])-o);s>=0&&(r=e.isRange(s,o,!1))}return t}},{key:"checkChecksum",value:function(e){return n.checkStandardUPCEANChecksum(e)}},{key:"checkStandardUPCEANChecksum",value:function(e){var t=e.length;if(0===t)return!1;var r=parseInt(e.charAt(t-1),10);return n.getStandardUPCEANChecksum(e.substring(0,t-1))===r}},{key:"getStandardUPCEANChecksum",value:function(e){for(var t=e.length,n=0,r=t-1;r>=0;r-=2){var i=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(i<0||i>9)throw new D;n+=i}n*=3;for(var a=t-2;a>=0;a-=2){var o=e.charAt(a).charCodeAt(0)-"0".charCodeAt(0);if(o<0||o>9)throw new D;n+=o}return(1e3-n)%10}},{key:"decodeEnd",value:function(e,t){return n.findGuardPattern(e,t,!1,n.START_END_PATTERN,new Int32Array(n.START_END_PATTERN.length).fill(0))}},{key:"findGuardPatternWithoutCounters",value:function(e,t,n,r){return this.findGuardPattern(e,t,n,r,new Int32Array(r.length))}},{key:"findGuardPattern",value:function(e,t,r,i,a){for(var o=e.getSize(),s=0,l=t=r?e.getNextUnset(t):e.getNextSet(t),u=i.length,c=r,d=t;d=0)return o;throw new F}}]),n}(Se);_e.MAX_AVG_VARIANCE=.48,_e.MAX_INDIVIDUAL_VARIANCE=.7,_e.START_END_PATTERN=Int32Array.from([1,1,1]),_e.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),_e.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),_e.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];var Ie=function(){function e(){u(this,e),this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return c(e,[{key:"decodeRow",value:function(t,n,r){var i=this.decodeRowStringBuffer,a=this.decodeMiddle(n,r,i),o=i.toString(),s=e.parseExtensionString(o),l=[new ce((r[0]+r[1])/2,t),new ce(a,t)],u=new Q(o,null,0,l,K.UPC_EAN_EXTENSION,(new Date).getTime());return null!=s&&u.putAllMetadata(s),u}},{key:"decodeMiddle",value:function(t,n,r){var i=this.decodeMiddleCounters;i[0]=0,i[1]=0,i[2]=0,i[3]=0;for(var a=t.getSize(),o=n[1],s=0,u=0;u<5&&o=10&&(s|=1<<4-u),4!==u&&(o=t.getNextSet(o),o=t.getNextUnset(o))}if(5!==r.length)throw new F;var h=this.determineCheckDigit(s);if(e.extensionChecksum(r.toString())!==h)throw new F;return o}},{key:"determineCheckDigit",value:function(e){for(var t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new F}}],[{key:"extensionChecksum",value:function(e){for(var t=e.length,n=0,r=t-2;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);n*=3;for(var i=t-1;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-"0".charCodeAt(0);return(n*=3)%10}},{key:"parseExtensionString",value:function(t){if(5!==t.length)return null;var n=e.parseExtension5String(t);return null==n?null:new Map([[q.SUGGESTED_PRICE,n]])}},{key:"parseExtension5String",value:function(e){var t;switch(e.charAt(0)){case"0":t="\xa3";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t=""}var n=parseInt(e.substring(1)),r=n%100;return t+(n/100).toString()+"."+(r<10?"0"+r:r.toString())}}]),e}(),Te=function(){function e(){u(this,e),this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return c(e,[{key:"decodeRow",value:function(t,n,r){var i=this.decodeRowStringBuffer,a=this.decodeMiddle(n,r,i),o=i.toString(),s=e.parseExtensionString(o),l=[new ce((r[0]+r[1])/2,t),new ce(a,t)],u=new Q(o,null,0,l,K.UPC_EAN_EXTENSION,(new Date).getTime());return null!=s&&u.putAllMetadata(s),u}},{key:"decodeMiddle",value:function(e,t,n){var r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;for(var i=e.getSize(),a=t[1],o=0,s=0;s<2&&a=10&&(o|=1<<1-s),1!==s&&(a=e.getNextSet(a),a=e.getNextUnset(a))}if(2!==n.length)throw new F;if(parseInt(n.toString())%4!==o)throw new F;return a}}],[{key:"parseExtensionString",value:function(e){return 2!==e.length?null:new Map([[q.ISSUE_NUMBER,parseInt(e)]])}}]),e}(),Me=function(){function e(){u(this,e)}return c(e,null,[{key:"decodeRow",value:function(e,t,n){var r=_e.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return(new Ie).decodeRow(e,t,r)}catch(i){return(new Te).decodeRow(e,t,r)}}}]),e}();Me.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);var Ne=function(e){d(n,e);var t=f(n);function n(){var e;u(this,n),(e=t.call(this)).decodeRowStringBuffer="",n.L_AND_G_PATTERNS=n.L_PATTERNS.map((function(e){return Int32Array.from(e)}));for(var r=10;r<20;r++){for(var i=n.L_PATTERNS[r-10],a=new Int32Array(i.length),o=0;o=t.getSize()||!t.isRange(h,v,!1))throw new F;var p=u.toString();if(p.length<8)throw new D;if(!n.checkChecksum(p))throw new E;var g=(i[1]+i[0])/2,m=(d[1]+d[0])/2,y=this.getBarcodeFormat(),w=[new ce(g,e),new ce(m,e)],C=new Q(p,null,0,w,y,(new Date).getTime()),S=0;try{var A=Me.decodeRow(e,t,d[1]);C.putMetadata(q.UPC_EAN_EXTENSION,A.getText()),C.putAllMetadata(A.getResultMetadata()),C.addResultPoints(A.getResultPoints()),S=A.getText().length}catch(I){}var b=null==r?null:r.get(N.ALLOWED_EAN_EXTENSIONS);if(null!=b){var k=!1;for(var _ in b)if(S.toString()===_){k=!0;break}if(!k)throw new F}return y===K.EAN_13||K.UPC_A,C}}],[{key:"checkChecksum",value:function(e){return n.checkStandardUPCEANChecksum(e)}},{key:"checkStandardUPCEANChecksum",value:function(e){var t=e.length;if(0===t)return!1;var r=parseInt(e.charAt(t-1),10);return n.getStandardUPCEANChecksum(e.substring(0,t-1))===r}},{key:"getStandardUPCEANChecksum",value:function(e){for(var t=e.length,n=0,r=t-1;r>=0;r-=2){var i=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(i<0||i>9)throw new D;n+=i}n*=3;for(var a=t-2;a>=0;a-=2){var o=e.charAt(a).charCodeAt(0)-"0".charCodeAt(0);if(o<0||o>9)throw new D;n+=o}return(1e3-n)%10}},{key:"decodeEnd",value:function(e,t){return n.findGuardPattern(e,t,!1,n.START_END_PATTERN,new Int32Array(n.START_END_PATTERN.length).fill(0))}}]),n}(_e),De=function(e){d(n,e);var t=f(n);function n(){var e;return u(this,n),(e=t.call(this)).decodeMiddleCounters=Int32Array.from([0,0,0,0]),e}return c(n,[{key:"decodeMiddle",value:function(e,t,r){var i=this.decodeMiddleCounters;i[0]=0,i[1]=0,i[2]=0,i[3]=0;for(var a=e.getSize(),o=t[1],s=0,u=0;u<6&&o=10&&(s|=1<<5-u)}r=n.determineFirstDigit(r,s),o=Ne.findGuardPattern(e,o,!0,Ne.MIDDLE_PATTERN,new Int32Array(Ne.MIDDLE_PATTERN.length).fill(0))[1];for(var h=0;h<6&&o=10&&(s|=1<<5-u)}return n.determineNumSysAndCheckDigit(new L(r),s),o}},{key:"decodeEnd",value:function(e,t){return n.findGuardPatternWithoutCounters(e,t,!0,n.MIDDLE_END_PATTERN)}},{key:"checkChecksum",value:function(e){return Ne.checkChecksum(n.convertUPCEtoUPCA(e))}},{key:"getBarcodeFormat",value:function(){return K.UPC_E}}],[{key:"determineNumSysAndCheckDigit",value:function(e,t){for(var n=0;n<=1;n++)for(var r=0;r<10;r++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][r])return e.insert(0,"0"+n),void e.append("0"+r);throw F.getNotFoundInstance()}},{key:"convertUPCEtoUPCA",value:function(e){var t=e.slice(1,7).split("").map((function(e){return e.charCodeAt(0)})),n=new L;n.append(e.charAt(0));var r=t[5];switch(r){case 0:case 1:case 2:n.appendChars(t,0,2),n.append(r),n.append("0000"),n.appendChars(t,2,3);break;case 3:n.appendChars(t,0,3),n.append("00000"),n.appendChars(t,3,2);break;case 4:n.appendChars(t,0,4),n.append("00000"),n.append(t[4]);break;default:n.appendChars(t,0,5),n.append("0000"),n.append(r)}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}]),n}(Ne);Pe.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Pe.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,1])];var xe=function(e){d(n,e);var t=f(n);function n(e){var r;u(this,n),r=t.call(this);var i=null==e?null:e.get(N.POSSIBLE_FORMATS),a=[];return null!=i&&(i.indexOf(K.EAN_13)>-1?a.push(new De):i.indexOf(K.UPC_A)>-1&&a.push(new Oe),i.indexOf(K.EAN_8)>-1&&a.push(new Re),i.indexOf(K.UPC_E)>-1&&a.push(new Pe)),0===a.length&&(a.push(new De),a.push(new Re),a.push(new Pe)),r.readers=a,r}return c(n,[{key:"decodeRow",value:function(e,t,n){var r,i=l(this.readers);try{for(i.s();!(r=i.n()).done;){var a=r.value;try{var o=a.decodeRow(e,t,n),s=o.getBarcodeFormat()===K.EAN_13&&"0"===o.getText().charAt(0),u=null==n?null:n.get(N.POSSIBLE_FORMATS),c=null==u||u.includes(K.UPC_A);if(s&&c){var d=o.getRawBytes(),f=new Q(o.getText().substring(1),d,d.length,o.getResultPoints(),K.UPC_A);return f.putAllMetadata(o.getResultMetadata()),f}return o}catch(h){}}}catch(h){i.e(h)}finally{i.f()}throw new F}},{key:"reset",value:function(){var e,t=l(this.readers);try{for(t.s();!(e=t.n()).done;)e.value.reset()}catch(n){t.e(n)}finally{t.f()}}}]),n}(Se),Le=function(e){d(n,e);var t=f(n);function n(){var e;return u(this,n),(e=t.call(this)).decodeFinderCounters=new Int32Array(4),e.dataCharacterCounters=new Int32Array(8),e.oddRoundingErrors=new Array(4),e.evenRoundingErrors=new Array(4),e.oddCounts=new Array(e.dataCharacterCounters.length/2),e.evenCounts=new Array(e.dataCharacterCounters.length/2),e}return c(n,[{key:"getDecodeFinderCounters",value:function(){return this.decodeFinderCounters}},{key:"getDataCharacterCounters",value:function(){return this.dataCharacterCounters}},{key:"getOddRoundingErrors",value:function(){return this.oddRoundingErrors}},{key:"getEvenRoundingErrors",value:function(){return this.evenRoundingErrors}},{key:"getOddCounts",value:function(){return this.oddCounts}},{key:"getEvenCounts",value:function(){return this.evenCounts}},{key:"parseFinderValue",value:function(e,t){for(var r=0;rr&&(r=t[i],n=i);e[n]++}},{key:"decrement",value:function(e,t){for(var n=0,r=t[0],i=1;i=n.MIN_FINDER_PATTERN_RATIO&&r<=n.MAX_FINDER_PATTERN_RATIO){var i,a=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER,s=l(e);try{for(s.s();!(i=s.n()).done;){var u=i.value;u>o&&(o=u),u=c-d-1&&(h-=e.combins(a-f-(c-d),c-d-2)),c-d-1>1){for(var v=0,p=a-f-(c-d-2);p>n;p--)v+=e.combins(a-f-p-1,c-d-3);h-=v*(c-1-d)}else a-f>n&&h--;s+=h}a-=f}return s}},{key:"combins",value:function(e,t){var n,r;e-t>t?(r=t,n=e-t):(r=e-t,n=t);for(var i=1,a=1,o=e;o>n;o--)i*=o,a<=r&&(i/=a,a++);for(;a<=r;)i/=a,a++;return i}}]),e}(),ze=function(){function e(){u(this,e)}return c(e,null,[{key:"buildBitArray",value:function(e){var t=2*e.length-1;null==e[e.length-1].getRightChar()&&(t-=1);for(var n=new T(12*t),r=0,i=e[0].getRightChar().getValue(),a=11;a>=0;--a)0!=(i&1<=0;--u)0!=(l&1<=0;--d)0!=(c&1<10||i<0||i>10)throw new D;return a.firstDigit=r,a.secondDigit=i,a}return c(n,[{key:"getFirstDigit",value:function(){return this.firstDigit}},{key:"getSecondDigit",value:function(){return this.secondDigit}},{key:"getValue",value:function(){return 10*this.firstDigit+this.secondDigit}},{key:"isFirstDigitFNC1",value:function(){return this.firstDigit===n.FNC1}},{key:"isSecondDigitFNC1",value:function(){return this.secondDigit===n.FNC1}},{key:"isAnyFNC1",value:function(){return this.firstDigit===n.FNC1||this.secondDigit===n.FNC1}}]),n}(je);We.FNC1=10;var Ye=function(){function e(){u(this,e)}return c(e,null,[{key:"parseFieldsInGeneralPurpose",value:function(t){if(!t)return null;if(t.length<2)throw new F;var n,r=t.substring(0,2),i=l(e.TWO_DIGIT_DATA_LENGTH);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(a[0]===r)return a[1]===e.VARIABLE_LENGTH?e.processVariableAI(2,a[2],t):e.processFixedAI(2,a[1],t)}}catch(y){i.e(y)}finally{i.f()}if(t.length<3)throw new F;var o,s=t.substring(0,3),u=l(e.THREE_DIGIT_DATA_LENGTH);try{for(u.s();!(o=u.n()).done;){var c=o.value;if(c[0]===s)return c[1]===e.VARIABLE_LENGTH?e.processVariableAI(3,c[2],t):e.processFixedAI(3,c[1],t)}}catch(y){u.e(y)}finally{u.f()}var d,f=l(e.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH);try{for(f.s();!(d=f.n()).done;){var h=d.value;if(h[0]===s)return h[1]===e.VARIABLE_LENGTH?e.processVariableAI(4,h[2],t):e.processFixedAI(4,h[1],t)}}catch(y){f.e(y)}finally{f.f()}if(t.length<4)throw new F;var v,p=t.substring(0,4),g=l(e.FOUR_DIGIT_DATA_LENGTH);try{for(g.s();!(v=g.n()).done;){var m=v.value;if(m[0]===p)return m[1]===e.VARIABLE_LENGTH?e.processVariableAI(4,m[2],t):e.processFixedAI(4,m[1],t)}}catch(y){g.e(y)}finally{g.f()}throw new F}},{key:"processFixedAI",value:function(t,n,r){if(r.lengththis.information.getSize())return e+4<=this.information.getSize();for(var t=e;tthis.information.getSize()){var t=this.extractNumericValueFromBitArray(e,4);return new We(this.information.getSize(),0===t?We.FNC1:t-1,We.FNC1)}var n=this.extractNumericValueFromBitArray(e,7);return new We(e+7,(n-8)/11,(n-8)%11)}},{key:"extractNumericValueFromBitArray",value:function(t,n){return e.extractNumericValueFromBitArray(this.information,t,n)}},{key:"decodeGeneralPurposeField",value:function(e,t){this.buffer.setLengthToZero(),null!=t&&this.buffer.append(t),this.current.setPosition(e);var n=this.parseBlocks();return null!=n&&n.isRemaining()?new Ge(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new Ge(this.current.getPosition(),this.buffer.toString())}},{key:"parseBlocks",value:function(){var e,t;do{var n=this.current.getPosition();if(e=this.current.isAlpha()?(t=this.parseAlphaBlock()).isFinished():this.current.isIsoIec646()?(t=this.parseIsoIec646Block()).isFinished():(t=this.parseNumericBlock()).isFinished(),n===this.current.getPosition()&&!e)break}while(!e);return t.getDecodedInformation()}},{key:"parseNumericBlock",value:function(){for(;this.isStillNumeric(this.current.getPosition());){var e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){var t=void 0;return t=e.isSecondDigitFNC1()?new Ge(this.current.getPosition(),this.buffer.toString()):new Ge(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new He(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){var n=new Ge(this.current.getPosition(),this.buffer.toString());return new He(!0,n)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new He(!1)}},{key:"parseIsoIec646Block",value:function(){for(;this.isStillIsoIec646(this.current.getPosition());){var e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){var t=new Ge(this.current.getPosition(),this.buffer.toString());return new He(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5this.information.getSize())return!1;var t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<116)return!0;if(e+8>this.information.getSize())return!1;var r=this.extractNumericValueFromBitArray(e,8);return r>=232&&r<253}},{key:"decodeIsoIec646",value:function(e){var t=this.extractNumericValueFromBitArray(e,5);if(15===t)return new Ve(e+5,Ve.FNC1);if(t>=5&&t<15)return new Ve(e+5,"0"+(t-5));var n,r=this.extractNumericValueFromBitArray(e,7);if(r>=64&&r<90)return new Ve(e+7,""+(r+1));if(r>=90&&r<116)return new Ve(e+7,""+(r+7));switch(this.extractNumericValueFromBitArray(e,8)){case 232:n="!";break;case 233:n='"';break;case 234:n="%";break;case 235:n="&";break;case 236:n="'";break;case 237:n="(";break;case 238:n=")";break;case 239:n="*";break;case 240:n="+";break;case 241:n=",";break;case 242:n="-";break;case 243:n=".";break;case 244:n="/";break;case 245:n=":";break;case 246:n=";";break;case 247:n="<";break;case 248:n="=";break;case 249:n=">";break;case 250:n="?";break;case 251:n="_";break;case 252:n=" ";break;default:throw new D}return new Ve(e+8,n)}},{key:"isStillAlpha",value:function(e){if(e+5>this.information.getSize())return!1;var t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63}},{key:"decodeAlphanumeric",value:function(e){var t=this.extractNumericValueFromBitArray(e,5);if(15===t)return new Ve(e+5,Ve.FNC1);if(t>=5&&t<15)return new Ve(e+5,"0"+(t-5));var n,r=this.extractNumericValueFromBitArray(e,6);if(r>=32&&r<58)return new Ve(e+6,""+(r+33));switch(r){case 58:n="*";break;case 59:n=",";break;case 60:n="-";break;case 61:n=".";break;case 62:n="/";break;default:throw new ie("Decoding invalid alphanumeric value: "+r)}return new Ve(e+6,n)}},{key:"isAlphaTo646ToAlphaLatch",value:function(e){if(e+1>this.information.getSize())return!1;for(var t=0;t<5&&t+ethis.information.getSize())return!1;for(var t=e;tthis.information.getSize())return!1;for(var t=0;t<4&&t+e25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());var t=null;try{t=this.checkRows(new Array,0)}catch(n){this.verbose&&console.log(n)}return e&&(this.rows=this.rows.reverse()),t}},{key:"checkRows",value:function(e,t){for(var r=t;re){a=o.isEquivalent(this.pairs);break}i=o.isEquivalent(this.pairs),r++}a||i||n.isPartialRow(this.pairs,this.rows)||(this.rows.push(r,new st(this.pairs,e,t)),this.removePartialRows(this.pairs,this.rows))}},{key:"removePartialRows",value:function(e,t){var n,r=l(t);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.getPairs().length!==e.length){var a,o=l(i.getPairs());try{for(o.s();!(a=o.n()).done;){var s,u=a.value,c=l(e);try{for(c.s();!(s=c.n()).done;){var d=s.value;if(ot.equals(u,d))break}}catch(f){c.e(f)}finally{c.f()}}}catch(f){o.e(f)}finally{o.f()}}}}catch(f){r.e(f)}finally{r.f()}}},{key:"getRows",value:function(){return this.rows}},{key:"checkChecksum",value:function(){var e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(null==n)return!1;for(var r=n.getChecksumPortion(),i=2,a=1;a=0?r:this.isEmptyPair(t)?0:t[t.length-1].getFinderPattern().getStartEnd()[1];var s=t.length%2!=0;this.startFromEven&&(s=!s);for(var l=!1;a=0&&!e.get(s);)s--;s++,i=this.startEnd[0]-s,a=s,o=this.startEnd[1]}else a=this.startEnd[0],i=(o=e.getNextUnset(this.startEnd[1]+1))-this.startEnd[1];var l,u=this.getDecodeFinderCounters();S.arraycopy(u,0,u,1,u.length-1),u[0]=i;try{l=this.parseFinderValue(u,n.FINDER_PATTERNS)}catch(c){return null}return new Fe(l,[a,o],a,o,t)}},{key:"decodeDataCharacter",value:function(e,t,r,i){for(var a=this.getDataCharacterCounters(),o=0;o.3)throw new F;for(var h=this.getOddCounts(),v=this.getEvenCounts(),p=this.getOddRoundingErrors(),g=this.getEvenRoundingErrors(),m=0;m8){if(y>8.7)throw new F;w=8}var E=m/2;0==(1&m)?(h[E]=w,p[E]=y-w):(v[E]=w,g[E]=y-w)}this.adjustOddEvenCounts(c);for(var C=4*t.getValue()+(r?0:2)+(i?0:1)-1,S=0,A=0,b=h.length-1;b>=0;b--){if(n.isNotA1left(t,r,i)){var k=n.WEIGHTS[C][2*b];A+=h[b]*k}S+=h[b]}for(var _=0,I=v.length-1;I>=0;I--)if(n.isNotA1left(t,r,i)){var T=n.WEIGHTS[C][2*I+1];_+=v[I]*T}var M=A+_;if(0!=(1&S)||S>13||S<4)throw new F;var N=(13-S)/2,D=n.SYMBOL_WIDEST[N],R=9-D,O=Ue.getRSSvalue(h,D,!0),P=Ue.getRSSvalue(v,R,!1),x=n.EVEN_TOTAL_SUBSET[N],L=n.GSUM[N];return new Be(O*x+P+L,M)}},{key:"adjustOddEvenCounts",value:function(e){var t=le.sum(new Int32Array(this.getOddCounts())),r=le.sum(new Int32Array(this.getEvenCounts())),i=!1,a=!1;t>13?a=!0:t<4&&(i=!0);var o=!1,s=!1;r>13?s=!0:r<4&&(o=!0);var l=t+r-e,u=1==(1&t),c=0==(1&r);if(1==l)if(u){if(c)throw new F;a=!0}else{if(!c)throw new F;s=!0}else if(-1==l)if(u){if(c)throw new F;i=!0}else{if(!c)throw new F;o=!0}else{if(0!=l)throw new F;if(u){if(!c)throw new F;ti.length)){for(var a=!0,o=0;o1){var c,d=l(this.possibleRightPairs);try{for(d.s();!(c=d.n()).done;){var f=c.value;if(f.getCount()>1&&n.checkChecksum(u,f))return n.constructResult(u,f)}}catch(h){d.e(h)}finally{d.f()}}}}catch(h){s.e(h)}finally{s.f()}throw new F}},{key:"reset",value:function(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}},{key:"decodePair",value:function(e,t,n,r){try{var i=this.findFinderPattern(e,t),a=this.parseFoundFinderPattern(e,n,t,i),o=null==r?null:r.get(N.NEED_RESULT_POINT_CALLBACK);if(null!=o){var s=(i[0]+i[1])/2;t&&(s=e.getSize()-1-s),o.foundPossibleResultPoint(new ce(s,n))}var l=this.decodeDataCharacter(e,a,!0),u=this.decodeDataCharacter(e,a,!1);return new ut(1597*l.getValue()+u.getValue(),l.getChecksumPortion()+4*u.getChecksumPortion(),a)}catch(c){return null}}},{key:"decodeDataCharacter",value:function(e,t,r){for(var i=this.getDataCharacterCounters(),a=0;a8&&(m=8);var y=Math.floor(p/2);0===(1&p)?(d[y]=m,h[y]=g-m):(f[y]=m,v[y]=g-m)}this.adjustOddEvenCounts(r,u);for(var w=0,E=0,C=d.length-1;C>=0;C--)E*=9,E+=d[C],w+=d[C];for(var S=0,A=0,b=f.length-1;b>=0;b--)S*=9,S+=f[b],A+=f[b];var k=E+3*S;if(r){if(0!==(1&w)||w>12||w<4)throw new F;var _=(12-w)/2,I=n.OUTSIDE_ODD_WIDEST[_],T=9-I,M=Ue.getRSSvalue(d,I,!1),N=Ue.getRSSvalue(f,T,!0),D=n.OUTSIDE_EVEN_TOTAL_SUBSET[_],R=n.OUTSIDE_GSUM[_];return new Be(M*D+N+R,k)}if(0!==(1&A)||A>10||A<4)throw new F;var O=(10-A)/2,P=n.INSIDE_ODD_WIDEST[O],x=9-P,L=Ue.getRSSvalue(d,P,!0),B=Ue.getRSSvalue(f,x,!1),U=n.INSIDE_ODD_TOTAL_SUBSET[O],z=n.INSIDE_GSUM[O];return new Be(B*U+L+z,k)}},{key:"findFinderPattern",value:function(e,t){var n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;for(var r=e.getSize(),i=!1,a=0;a=0&&a!==e.get(o);)o--;o++;var s=i[0]-o,l=this.getDecodeFinderCounters(),u=new Int32Array(l.length);S.arraycopy(l,0,u,1,l.length-1),u[0]=s;var c=this.parseFinderValue(u,n.FINDER_PATTERNS),d=o,f=i[1];return r&&(d=e.getSize()-1-d,f=e.getSize()-1-f),new Fe(c,[o,i[1]],d,f,t)}},{key:"adjustOddEvenCounts",value:function(e,t){var n=le.sum(new Int32Array(this.getOddCounts())),r=le.sum(new Int32Array(this.getEvenCounts())),i=!1,a=!1,o=!1,s=!1;e?(n>12?a=!0:n<4&&(i=!0),r>12?s=!0:r<4&&(o=!0)):(n>11?a=!0:n<5&&(i=!0),r>10?s=!0:r<4&&(o=!0));var l=n+r-t,u=(1&n)===(e?1:0),c=1===(1&r);if(1===l)if(u){if(c)throw new F;a=!0}else{if(!c)throw new F;s=!0}else if(-1===l)if(u){if(c)throw new F;i=!0}else{if(!c)throw new F;o=!0}else{if(0!==l)throw new F;if(u){if(!c)throw new F;n0;a--)i.append("0");i.append(r);for(var o=0,s=0;s<13;s++){var l=i.charAt(s).charCodeAt(0)-"0".charCodeAt(0);o+=0===(1&s)?3*l:l}10===(o=10-o%10)&&(o=0),i.append(o.toString());var u=e.getFinderPattern().getResultPoints(),c=t.getFinderPattern().getResultPoints();return new Q(i.toString(),null,0,[u[0],u[1],c[0],c[1]],K.RSS_14,(new Date).getTime())}},{key:"checkChecksum",value:function(e,t){var n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,r=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return r>72&&r--,r>8&&r--,n===r}}]),n}(Le);ct.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],ct.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],ct.OUTSIDE_GSUM=[0,161,961,2015,2715],ct.INSIDE_GSUM=[0,336,1036,1516],ct.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],ct.INSIDE_ODD_WIDEST=[2,4,6,8],ct.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];var dt=function(e){d(n,e);var t=f(n);function n(e,r){var i;u(this,n),(i=t.call(this)).readers=[],i.verbose=!0===r;var a=e?e.get(N.POSSIBLE_FORMATS):null,o=e&&void 0!==e.get(N.ASSUME_CODE_39_CHECK_DIGIT);return a&&((a.includes(K.EAN_13)||a.includes(K.UPC_A)||a.includes(K.EAN_8)||a.includes(K.UPC_E))&&i.readers.push(new xe(e)),a.includes(K.CODE_39)&&i.readers.push(new be(o)),a.includes(K.CODE_128)&&i.readers.push(new Ae),a.includes(K.ITF)&&i.readers.push(new ke),a.includes(K.RSS_14)&&i.readers.push(new ct),a.includes(K.RSS_EXPANDED)&&i.readers.push(new lt(i.verbose))),0===i.readers.length&&(i.readers.push(new xe(e)),i.readers.push(new be),i.readers.push(new xe(e)),i.readers.push(new Ae),i.readers.push(new ke),i.readers.push(new ct),i.readers.push(new lt(i.verbose))),i}return c(n,[{key:"decodeRow",value:function(e,t,n){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:500,r=arguments.length>1?arguments[1]:void 0;return u(this,n),t.call(this,new dt(r),e,r)}return c(n)}(X),ht=function(){function e(t,n,r){u(this,e),this.ecCodewords=t,this.ecBlocks=[n],r&&this.ecBlocks.push(r)}return c(e,[{key:"getECCodewords",value:function(){return this.ecCodewords}},{key:"getECBlocks",value:function(){return this.ecBlocks}}]),e}(),vt=function(){function e(t,n){u(this,e),this.count=t,this.dataCodewords=n}return c(e,[{key:"getCount",value:function(){return this.count}},{key:"getDataCodewords",value:function(){return this.dataCodewords}}]),e}(),pt=function(){function e(t,n,r,i,a,o){u(this,e),this.versionNumber=t,this.symbolSizeRows=n,this.symbolSizeColumns=r,this.dataRegionSizeRows=i,this.dataRegionSizeColumns=a,this.ecBlocks=o;var s,c=0,d=o.getECCodewords(),f=o.getECBlocks(),h=l(f);try{for(h.s();!(s=h.n()).done;){var v=s.value;c+=v.getCount()*(v.getDataCodewords()+d)}}catch(p){h.e(p)}finally{h.f()}this.totalCodewords=c}return c(e,[{key:"getVersionNumber",value:function(){return this.versionNumber}},{key:"getSymbolSizeRows",value:function(){return this.symbolSizeRows}},{key:"getSymbolSizeColumns",value:function(){return this.symbolSizeColumns}},{key:"getDataRegionSizeRows",value:function(){return this.dataRegionSizeRows}},{key:"getDataRegionSizeColumns",value:function(){return this.dataRegionSizeColumns}},{key:"getTotalCodewords",value:function(){return this.totalCodewords}},{key:"getECBlocks",value:function(){return this.ecBlocks}},{key:"toString",value:function(){return""+this.versionNumber}}],[{key:"getVersionForDimensions",value:function(t,n){if(0!==(1&t)||0!==(1&n))throw new D;var r,i=l(e.VERSIONS);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(a.symbolSizeRows===t&&a.symbolSizeColumns===n)return a}}catch(o){i.e(o)}finally{i.f()}throw new D}},{key:"buildVersions",value:function(){return[new e(1,10,10,8,8,new ht(5,new vt(1,3))),new e(2,12,12,10,10,new ht(7,new vt(1,5))),new e(3,14,14,12,12,new ht(10,new vt(1,8))),new e(4,16,16,14,14,new ht(12,new vt(1,12))),new e(5,18,18,16,16,new ht(14,new vt(1,18))),new e(6,20,20,18,18,new ht(18,new vt(1,22))),new e(7,22,22,20,20,new ht(20,new vt(1,30))),new e(8,24,24,22,22,new ht(24,new vt(1,36))),new e(9,26,26,24,24,new ht(28,new vt(1,44))),new e(10,32,32,14,14,new ht(36,new vt(1,62))),new e(11,36,36,16,16,new ht(42,new vt(1,86))),new e(12,40,40,18,18,new ht(48,new vt(1,114))),new e(13,44,44,20,20,new ht(56,new vt(1,144))),new e(14,48,48,22,22,new ht(68,new vt(1,174))),new e(15,52,52,24,24,new ht(42,new vt(2,102))),new e(16,64,64,14,14,new ht(56,new vt(2,140))),new e(17,72,72,16,16,new ht(36,new vt(4,92))),new e(18,80,80,18,18,new ht(48,new vt(4,114))),new e(19,88,88,20,20,new ht(56,new vt(4,144))),new e(20,96,96,22,22,new ht(68,new vt(4,174))),new e(21,104,104,24,24,new ht(56,new vt(6,136))),new e(22,120,120,18,18,new ht(68,new vt(6,175))),new e(23,132,132,20,20,new ht(62,new vt(8,163))),new e(24,144,144,22,22,new ht(62,new vt(8,156),new vt(2,155))),new e(25,8,18,6,16,new ht(7,new vt(1,5))),new e(26,8,32,6,14,new ht(11,new vt(1,10))),new e(27,12,26,10,24,new ht(14,new vt(1,16))),new e(28,12,36,10,16,new ht(18,new vt(1,22))),new e(29,16,36,14,16,new ht(24,new vt(1,32))),new e(30,16,48,14,22,new ht(28,new vt(1,49)))]}}]),e}();pt.VERSIONS=pt.buildVersions();var gt,mt=function(){function e(t){u(this,e);var n=t.getHeight();if(n<8||n>144||0!==(1&n))throw new D;this.version=e.readVersion(t),this.mappingBitMatrix=this.extractDataRegion(t),this.readMappingMatrix=new B(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}return c(e,[{key:"getVersion",value:function(){return this.version}},{key:"readCodewords",value:function(){var e=new Int8Array(this.version.getTotalCodewords()),t=0,n=4,r=0,i=this.mappingBitMatrix.getHeight(),a=this.mappingBitMatrix.getWidth(),o=!1,s=!1,l=!1,u=!1;do{if(n!==i||0!==r||o)if(n!==i-2||0!==r||0===(3&a)||s)if(n!==i+4||2!==r||0!==(7&a)||l)if(n!==i-2||0!==r||4!==(7&a)||u){do{n=0&&!this.readMappingMatrix.get(r,n)&&(e[t++]=255&this.readUtah(n,r,i,a)),n-=2,r+=2}while(n>=0&&r=0&&r=0);n+=3,r+=1}else e[t++]=255&this.readCorner4(i,a),n-=2,r+=2,u=!0;else e[t++]=255&this.readCorner3(i,a),n-=2,r+=2,l=!0;else e[t++]=255&this.readCorner2(i,a),n-=2,r+=2,s=!0;else e[t++]=255&this.readCorner1(i,a),n-=2,r+=2,o=!0}while(n7?I-1:I;c[M].codewords[N]=t[E++]}if(E!==t.length)throw new y;return c}}]),e}(),wt=function(){function e(t){u(this,e),this.bytes=t,this.byteOffset=0,this.bitOffset=0}return c(e,[{key:"getBitOffset",value:function(){return this.bitOffset}},{key:"getByteOffset",value:function(){return this.byteOffset}},{key:"readBits",value:function(e){if(e<1||e>32||e>this.available())throw new y(""+e);var t=0,n=this.bitOffset,r=this.byteOffset,i=this.bytes;if(n>0){var a=8-n,o=e>8-o<>s,e-=o,8===(n+=o)&&(n=0,r++)}if(e>0){for(;e>=8;)t=t<<8|255&i[r],r++,e-=8;if(e>0){var u=8-e,c=255>>u<>u,n+=e}}return this.bitOffset=n,this.byteOffset=r,t}},{key:"available",value:function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}]),e}();!function(e){e[e.PAD_ENCODE=0]="PAD_ENCODE",e[e.ASCII_ENCODE=1]="ASCII_ENCODE",e[e.C40_ENCODE=2]="C40_ENCODE",e[e.TEXT_ENCODE=3]="TEXT_ENCODE",e[e.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",e[e.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",e[e.BASE256_ENCODE=6]="BASE256_ENCODE"}(gt||(gt={}));var Et=function(){function e(){u(this,e)}return c(e,null,[{key:"decode",value:function(e){var t=new wt(e),n=new L,r=new L,i=new Array,a=gt.ASCII_ENCODE;do{if(a===gt.ASCII_ENCODE)a=this.decodeAsciiSegment(t,n,r);else{switch(a){case gt.C40_ENCODE:this.decodeC40Segment(t,n);break;case gt.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case gt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case gt.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case gt.BASE256_ENCODE:this.decodeBase256Segment(t,n,i);break;default:throw new D}a=gt.ASCII_ENCODE}}while(a!==gt.PAD_ENCODE&&t.available()>0);return r.length()>0&&n.append(r.toString()),new $(e,n.toString(),0===i.length?null:i,null)}},{key:"decodeAsciiSegment",value:function(e,t,n){var r=!1;do{var i=e.readBits(8);if(0===i)throw new D;if(i<=128)return r&&(i+=128),t.append(String.fromCharCode(i-1)),gt.ASCII_ENCODE;if(129===i)return gt.PAD_ENCODE;if(i<=229){var a=i-130;a<10&&t.append("0"),t.append(""+a)}else switch(i){case 230:return gt.C40_ENCODE;case 231:return gt.BASE256_ENCODE;case 232:t.append(String.fromCharCode(29));break;case 233:case 234:case 241:break;case 235:r=!0;break;case 236:t.append("[)>\x1e05\x1d"),n.insert(0,"\x1e\x04");break;case 237:t.append("[)>\x1e06\x1d"),n.insert(0,"\x1e\x04");break;case 238:return gt.ANSIX12_ENCODE;case 239:return gt.TEXT_ENCODE;case 240:return gt.EDIFACT_ENCODE;default:if(254!==i||0!==e.available())throw new D}}while(e.available()>0);return gt.ASCII_ENCODE}},{key:"decodeC40Segment",value:function(e,t){var n=!1,r=[],i=0;do{if(8===e.available())return;var a=e.readBits(8);if(254===a)return;this.parseTwoBytes(a,e.readBits(8),r);for(var o=0;o<3;o++){var s=r[o];switch(i){case 0:if(s<3)i=s+1;else{if(!(s0)}},{key:"decodeTextSegment",value:function(e,t){var n=!1,r=[],i=0;do{if(8===e.available())return;var a=e.readBits(8);if(254===a)return;this.parseTwoBytes(a,e.readBits(8),r);for(var o=0;o<3;o++){var s=r[o];switch(i){case 0:if(s<3)i=s+1;else{if(!(s0)}},{key:"decodeAnsiX12Segment",value:function(e,t){var n=[];do{if(8===e.available())return;var r=e.readBits(8);if(254===r)return;this.parseTwoBytes(r,e.readBits(8),n);for(var i=0;i<3;i++){var a=n[i];switch(a){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(a<14)t.append(String.fromCharCode(a+44));else{if(!(a<40))throw new D;t.append(String.fromCharCode(a+51))}}}}while(e.available()>0)}},{key:"parseTwoBytes",value:function(e,t,n){var r=(e<<8)+t-1,i=Math.floor(r/1600);n[0]=i,r-=1600*i,i=Math.floor(r/40),n[1]=i,n[2]=r-40*i}},{key:"decodeEdifactSegment",value:function(e,t){do{if(e.available()<=16)return;for(var n=0;n<4;n++){var r=e.readBits(6);if(31===r){var i=8-e.getBitOffset();return void(8!==i&&e.readBits(i))}0===(32&r)&&(r|=64),t.append(String.fromCharCode(r))}}while(e.available()>0)}},{key:"decodeBase256Segment",value:function(e,t,n){var r,i=1+e.getByteOffset(),a=this.unrandomize255State(e.readBits(8),i++);if((r=0===a?e.available()/8|0:a<250?a:250*(a-249)+this.unrandomize255State(e.readBits(8),i++))<0)throw new D;for(var o=new Uint8Array(r),s=0;s=0?n:n+256}}]),e}();Et.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Et.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Et.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],Et.TEXT_SHIFT2_SET_CHARS=Et.C40_SHIFT2_SET_CHARS,Et.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",String.fromCharCode(127)];var Ct=function(){function e(){u(this,e),this.rsDecoder=new oe(ne.DATA_MATRIX_FIELD_256)}return c(e,[{key:"decode",value:function(e){var t,n=new mt(e),r=n.getVersion(),i=n.readCodewords(),a=yt.getDataBlocks(i,r),o=0,s=l(a);try{for(s.s();!(t=s.n()).done;)o+=t.value.getNumDataCodewords()}catch(g){s.e(g)}finally{s.f()}for(var u=new Uint8Array(o),c=a.length,d=0;do&&(u=o,c[0]=t,c[1]=n,c[2]=r,c[3]=i),u>s&&(u=s,c[0]=n,c[1]=r,c[2]=i,c[3]=t),u>l&&(c[0]=r,c[1]=i,c[2]=t,c[3]=n),c}},{key:"detectSolid2",value:function(t){var n=t[0],r=t[1],i=t[2],a=t[3],o=this.transitionsBetween(n,a),s=e.shiftPoint(r,i,4*(o+1)),l=e.shiftPoint(i,r,4*(o+1));return this.transitionsBetween(s,n)this.transitionsBetween(l,d)+this.transitionsBetween(u,d)?c:d:c:this.isValid(d)?d:null}},{key:"shiftToModuleCenter",value:function(t){var n=t[0],r=t[1],i=t[2],a=t[3],o=this.transitionsBetween(n,a)+1,s=this.transitionsBetween(i,a)+1,l=e.shiftPoint(n,r,4*s),u=e.shiftPoint(i,r,4*o);1===(1&(o=this.transitionsBetween(l,a)+1))&&(o+=1),1===(1&(s=this.transitionsBetween(u,a)+1))&&(s+=1);var c,d,f=(n.getX()+r.getX()+i.getX()+a.getX())/4,h=(n.getY()+r.getY()+i.getY()+a.getY())/4;return n=e.moveAway(n,f,h),r=e.moveAway(r,f,h),i=e.moveAway(i,f,h),a=e.moveAway(a,f,h),l=e.shiftPoint(n,r,4*s),l=e.shiftPoint(l,a,4*o),c=e.shiftPoint(r,n,4*s),c=e.shiftPoint(c,i,4*o),u=e.shiftPoint(i,a,4*s),u=e.shiftPoint(u,r,4*o),d=e.shiftPoint(a,i,4*s),[l,c,u,d=e.shiftPoint(d,n,4*o)]}},{key:"isValid",value:function(e){return e.getX()>=0&&e.getX()0&&e.getY()Math.abs(i-n);if(o){var s=n;n=r,r=s,s=i,i=a,a=s}for(var l=Math.abs(i-n),u=Math.abs(a-r),c=-l/2,d=r0){if(g===a)break;g+=d,c-=l}}return h}}],[{key:"shiftPoint",value:function(e,t,n){var r=(t.getX()-e.getX())/(n+1),i=(t.getY()-e.getY())/(n+1);return new ce(e.getX()+r,e.getY()+i)}},{key:"moveAway",value:function(e,t,n){var r=e.getX(),i=e.getY();return r1&&void 0!==arguments[1]?arguments[1]:null;if(null!=i&&i.has(N.PURE_BARCODE)){var a=e.extractPureBits(t.getBlackMatrix());n=this.decoder.decode(a),r=e.NO_POINTS}else{var o=new St(t.getBlackMatrix()).detect();n=this.decoder.decode(o.getBits()),r=o.getPoints()}var s=n.getRawBytes(),l=new Q(n.getText(),s,8*s.length,r,K.DATA_MATRIX,S.currentTimeMillis()),u=n.getByteSegments();null!=u&&l.putMetadata(q.BYTE_SEGMENTS,u);var c=n.getECLevel();return null!=c&&l.putMetadata(q.ERROR_CORRECTION_LEVEL,c),l}},{key:"reset",value:function(){}}],[{key:"extractPureBits",value:function(e){var t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(null==t||null==n)throw new F;var r=this.moduleSize(t,e),i=t[1],a=n[1],o=t[0],s=(n[0]-o+1)/r,l=(a-i+1)/r;if(s<=0||l<=0)throw new F;var u=r/2;i+=u,o+=u;for(var c=new B(s,l),d=0;d0&&void 0!==arguments[0]?arguments[0]:500;return u(this,n),t.call(this,new At,e)}return c(n)}(X);!function(e){e[e.L=0]="L",e[e.M=1]="M",e[e.Q=2]="Q",e[e.H=3]="H"}(bt||(bt={}));var _t=function(){function e(t,n,r){u(this,e),this.value=t,this.stringValue=n,this.bits=r,e.FOR_BITS.set(r,this),e.FOR_VALUE.set(t,this)}return c(e,[{key:"getValue",value:function(){return this.value}},{key:"getBits",value:function(){return this.bits}},{key:"toString",value:function(){return this.stringValue}},{key:"equals",value:function(t){if(!(t instanceof e))return!1;var n=t;return this.value===n.value}}],[{key:"fromString",value:function(t){switch(t){case"L":return e.L;case"M":return e.M;case"Q":return e.Q;case"H":return e.H;default:throw new m(t+"not available")}}},{key:"forBits",value:function(t){if(t<0||t>=e.FOR_BITS.size)throw new y;return e.FOR_BITS.get(t)}}]),e}();_t.FOR_BITS=new Map,_t.FOR_VALUE=new Map,_t.L=new _t(bt.L,"L",1),_t.M=new _t(bt.M,"M",0),_t.Q=new _t(bt.Q,"Q",3),_t.H=new _t(bt.H,"H",2);var It=function(){function e(t){u(this,e),this.errorCorrectionLevel=_t.forBits(t>>3&3),this.dataMask=7&t}return c(e,[{key:"getErrorCorrectionLevel",value:function(){return this.errorCorrectionLevel}},{key:"getDataMask",value:function(){return this.dataMask}},{key:"hashCode",value:function(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}},{key:"equals",value:function(t){if(!(t instanceof e))return!1;var n=t;return this.errorCorrectionLevel===n.errorCorrectionLevel&&this.dataMask===n.dataMask}}],[{key:"numBitsDiffering",value:function(e,t){return _.bitCount(e^t)}},{key:"decodeFormatInformation",value:function(t,n){var r=e.doDecodeFormatInformation(t,n);return null!==r?r:e.doDecodeFormatInformation(t^e.FORMAT_INFO_MASK_QR,n^e.FORMAT_INFO_MASK_QR)}},{key:"doDecodeFormatInformation",value:function(t,n){var r,i=Number.MAX_SAFE_INTEGER,a=0,o=l(e.FORMAT_INFO_DECODE_LOOKUP);try{for(o.s();!(r=o.n()).done;){var s=r.value,u=s[0];if(u===t||u===n)return new e(s[1]);var c=e.numBitsDiffering(t,u);c1?n-1:0),i=1;i2?r-2:0),a=2;a6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}},{key:"toString",value:function(){return""+this.versionNumber}}],[{key:"getProvisionalVersionForDimension",value:function(e){if(e%4!==1)throw new D;try{return this.getVersionForNumber((e-17)/4)}catch(t){throw new D}}},{key:"getVersionForNumber",value:function(t){if(t<1||t>40)throw new y;return e.VERSIONS[t-1]}},{key:"decodeVersionInformation",value:function(t){for(var n=Number.MAX_SAFE_INTEGER,r=0,i=0;i=0;n--)e=this.copyBit(8,n,e);for(var r=this.bitMatrix.getHeight(),i=0,a=r-7,o=r-1;o>=a;o--)i=this.copyBit(8,o,i);for(var s=r-8;s=0;i--)for(var a=e-9;a>=r;a--)n=this.copyBit(a,i,n);var o=Dt.decodeVersionInformation(n);if(null!==o&&o.getDimensionForVersion()===e)return this.parsedVersion=o,o;n=0;for(var s=5;s>=0;s--)for(var l=e-9;l>=r;l--)n=this.copyBit(s,l,n);if(null!==(o=Dt.decodeVersionInformation(n))&&o.getDimensionForVersion()===e)return this.parsedVersion=o,o;throw new D}},{key:"copyBit",value:function(e,t,n){return(this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t))?n<<1|1:n<<1}},{key:"readCodewords",value:function(){var e=this.readFormatInformation(),t=this.readVersion(),n=Rt.values.get(e.getDataMask()),r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r);for(var i=t.buildFunctionPattern(),a=!0,o=new Uint8Array(t.getTotalCodewords()),s=0,l=0,u=0,c=r-1;c>0;c-=2){6===c&&c--;for(var d=0;d=0&&d[E].codewords.length!==w;)E--;E++;for(var C=w-a.getECCodewordsPerBlock(),S=0,A=0;Ae.available())throw new D;for(var r=new Uint8Array(2*n),i=0;n>0;){var a=e.readBits(13),o=a/96<<8&4294967295|a%96;o+=o<959?41377:42657,r[i]=o>>8&255,r[i+1]=255&o,i+=2,n--}try{t.append(P.decode(r,x.GB2312))}catch(s){throw new D(s)}}},{key:"decodeKanjiSegment",value:function(e,t,n){if(13*n>e.available())throw new D;for(var r=new Uint8Array(2*n),i=0;n>0;){var a=e.readBits(13),o=a/192<<8&4294967295|a%192;o+=o<7936?33088:49472,r[i]=o>>8,r[i+1]=o,i+=2,n--}try{t.append(P.decode(r,x.SHIFT_JIS))}catch(s){throw new D(s)}}},{key:"decodeByteSegment",value:function(e,t,n,r,i,a){if(8*n>e.available())throw new D;for(var o,s=new Uint8Array(n),l=0;l=e.ALPHANUMERIC_CHARS.length)throw new D;return e.ALPHANUMERIC_CHARS[t]}},{key:"decodeAlphanumericSegment",value:function(t,n,r,i){for(var a=n.length();r>1;){if(t.available()<11)throw new D;var o=t.readBits(11);n.append(e.toAlphaNumericChar(Math.floor(o/45))),n.append(e.toAlphaNumericChar(o%45)),r-=2}if(1===r){if(t.available()<6)throw new D;n.append(e.toAlphaNumericChar(t.readBits(6)))}if(i)for(var s=a;s=3;){if(t.available()<10)throw new D;var i=t.readBits(10);if(i>=1e3)throw new D;n.append(e.toAlphaNumericChar(Math.floor(i/100))),n.append(e.toAlphaNumericChar(Math.floor(i/10)%10)),n.append(e.toAlphaNumericChar(i%10)),r-=3}if(2===r){if(t.available()<7)throw new D;var a=t.readBits(7);if(a>=100)throw new D;n.append(e.toAlphaNumericChar(Math.floor(a/10))),n.append(e.toAlphaNumericChar(a%10))}else if(1===r){if(t.available()<4)throw new D;var o=t.readBits(4);if(o>=10)throw new D;n.append(e.toAlphaNumericChar(o))}}},{key:"parseECIValue",value:function(e){var t=e.readBits(8);if(0===(128&t))return 127&t;if(128===(192&t))return(63&t)<<8&4294967295|e.readBits(8);if(192===(224&t))return(31&t)<<16&4294967295|e.readBits(16);throw new D}}]),e}();Bt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Bt.GB2312_SUBSET=1;var Ft=function(){function e(t){u(this,e),this.mirrored=t}return c(e,[{key:"isMirrored",value:function(){return this.mirrored}},{key:"applyMirroredCorrection",value:function(e){if(this.mirrored&&null!==e&&!(e.length<3)){var t=e[0];e[0]=e[2],e[2]=t}}}]),e}(),Ut=function(){function e(){u(this,e),this.rsDecoder=new oe(ne.QR_CODE_FIELD_256)}return c(e,[{key:"decodeBooleanArray",value:function(e,t){return this.decodeBitMatrix(B.parseFromBooleanArray(e),t)}},{key:"decodeBitMatrix",value:function(e,t){var n=new Pt(e),r=null;try{return this.decodeBitMatrixParser(n,t)}catch(a){r=a}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();var i=this.decodeBitMatrixParser(n,t);return i.setOther(new Ft(!0)),i}catch(a){if(null!==r)throw r;throw a}}},{key:"decodeBitMatrixParser",value:function(e,t){var n,r=e.readVersion(),i=e.readFormatInformation().getErrorCorrectionLevel(),a=e.readCodewords(),o=xt.getDataBlocks(a,r,i),s=0,u=l(o);try{for(u.s();!(n=u.n()).done;)s+=n.value.getNumDataCodewords()}catch(y){u.e(y)}finally{u.f()}var c,d=new Uint8Array(s),f=0,h=l(o);try{for(h.s();!(c=h.n()).done;){var v=c.value,p=v.getCodewords(),g=v.getNumDataCodewords();this.correctErrors(p,g);for(var m=0;m=n)return!1;return!0}},{key:"crossCheckVertical",value:function(t,n,r,i){var a=this.image,o=a.getHeight(),s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;for(var l=t;l>=0&&a.get(n,l)&&s[1]<=r;)s[1]++,l--;if(l<0||s[1]>r)return NaN;for(;l>=0&&!a.get(n,l)&&s[0]<=r;)s[0]++,l--;if(s[0]>r)return NaN;for(l=t+1;lr)return NaN;for(;lr)return NaN;var u=s[0]+s[1]+s[2];return 5*Math.abs(u-i)>=2*i?NaN:this.foundPatternCross(s)?e.centerFromEnd(s,l):NaN}},{key:"handlePossibleCenter",value:function(t,n,r){var i=t[0]+t[1]+t[2],a=e.centerFromEnd(t,r),o=this.crossCheckVertical(n,a,2*t[1],i);if(!isNaN(o)){var s,u=(t[0]+t[1]+t[2])/3,c=l(this.possibleCenters);try{for(c.s();!(s=c.n()).done;){var d=s.value;if(d.aboutEquals(u,o,a))return d.combineEstimate(o,a,u)}}catch(h){c.e(h)}finally{c.f()}var f=new zt(a,o,u);this.possibleCenters.push(f),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(f)}return null}}],[{key:"centerFromEnd",value:function(e,t){return t-e[2]-e[1]/2}}]),e}(),jt=function(e){d(n,e);var t=f(n);function n(e,r,i,a){var o;return u(this,n),(o=t.call(this,e,r)).estimatedModuleSize=i,o.count=a,void 0===a&&(o.count=1),o}return c(n,[{key:"getEstimatedModuleSize",value:function(){return this.estimatedModuleSize}},{key:"getCount",value:function(){return this.count}},{key:"aboutEquals",value:function(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){var r=Math.abs(e-this.estimatedModuleSize);return r<=1||r<=this.estimatedModuleSize}return!1}},{key:"combineEstimate",value:function(e,t,r){var i=this.count+1;return new n((this.count*this.getX()+t)/i,(this.count*this.getY()+e)/i,(this.count*this.estimatedModuleSize+r)/i,i)}}]),n}(ce),Vt=function(){function e(t){u(this,e),this.bottomLeft=t[0],this.topLeft=t[1],this.topRight=t[2]}return c(e,[{key:"getBottomLeft",value:function(){return this.bottomLeft}},{key:"getTopLeft",value:function(){return this.topLeft}},{key:"getTopRight",value:function(){return this.topRight}}]),e}(),Gt=function(){function e(t,n){u(this,e),this.image=t,this.resultPointCallback=n,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=n}return c(e,[{key:"getImage",value:function(){return this.image}},{key:"getPossibleCenters",value:function(){return this.possibleCenters}},{key:"find",value:function(t){var n=null!==t&&void 0!==t&&void 0!==t.get(N.TRY_HARDER),r=null!==t&&void 0!==t&&void 0!==t.get(N.PURE_BARCODE),i=this.image,a=i.getHeight(),o=i.getWidth(),s=Math.floor(3*a/(4*e.MAX_MODULES));(su[2]&&(c+=h-u[2]-s,f=o-1)}d=0,u[0]=0,u[1]=0,u[2]=0,u[3]=0,u[4]=0}else u[0]=u[2],u[1]=u[3],u[2]=u[4],u[3]=1,u[4]=0,d=3;else u[++d]++;else u[d]++;e.foundPatternCross(u)&&!0===this.handlePossibleCenter(u,c,o,r)&&(s=u[0],this.hasSkipped&&(l=this.haveMultiplyConfirmedCenters()))}var v=this.selectBestPatterns();return ce.orderBestPatterns(v),new Vt(v)}},{key:"getCrossCheckStateCount",value:function(){var e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e}},{key:"crossCheckDiagonal",value:function(t,n,r,i){for(var a=this.getCrossCheckStateCount(),o=0,s=this.image;t>=o&&n>=o&&s.get(n-o,t-o);)a[2]++,o++;if(t=o&&n>=o&&!s.get(n-o,t-o)&&a[1]<=r;)a[1]++,o++;if(tr)return!1;for(;t>=o&&n>=o&&s.get(n-o,t-o)&&a[0]<=r;)a[0]++,o++;if(a[0]>r)return!1;var l=s.getHeight(),u=s.getWidth();for(o=1;t+o=l||n+o>=u)return!1;for(;t+o=l||n+o>=u||a[3]>=r)return!1;for(;t+o=r)return!1;var c=a[0]+a[1]+a[2]+a[3]+a[4];return Math.abs(c-i)<2*i&&e.foundPatternCross(a)}},{key:"crossCheckVertical",value:function(t,n,r,i){for(var a=this.image,o=a.getHeight(),s=this.getCrossCheckStateCount(),l=t;l>=0&&a.get(n,l);)s[2]++,l--;if(l<0)return NaN;for(;l>=0&&!a.get(n,l)&&s[1]<=r;)s[1]++,l--;if(l<0||s[1]>r)return NaN;for(;l>=0&&a.get(n,l)&&s[0]<=r;)s[0]++,l--;if(s[0]>r)return NaN;for(l=t+1;l=r)return NaN;for(;l=r)return NaN;var u=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(u-i)>=2*i?NaN:e.foundPatternCross(s)?e.centerFromEnd(s,l):NaN}},{key:"crossCheckHorizontal",value:function(t,n,r,i){for(var a=this.image,o=a.getWidth(),s=this.getCrossCheckStateCount(),l=t;l>=0&&a.get(l,n);)s[2]++,l--;if(l<0)return NaN;for(;l>=0&&!a.get(l,n)&&s[1]<=r;)s[1]++,l--;if(l<0||s[1]>r)return NaN;for(;l>=0&&a.get(l,n)&&s[0]<=r;)s[0]++,l--;if(s[0]>r)return NaN;for(l=t+1;l=r)return NaN;for(;l=r)return NaN;var u=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(u-i)>=i?NaN:e.foundPatternCross(s)?e.centerFromEnd(s,l):NaN}},{key:"handlePossibleCenter",value:function(t,n,r,i){var a=t[0]+t[1]+t[2]+t[3]+t[4],o=e.centerFromEnd(t,r),s=this.crossCheckVertical(n,Math.floor(o),t[2],a);if(!isNaN(s)&&(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(s),t[2],a),!isNaN(o)&&(!i||this.crossCheckDiagonal(Math.floor(s),Math.floor(o),t[2],a)))){for(var l=a/7,u=!1,c=this.possibleCenters,d=0,f=c.length;d=e.CENTER_QUORUM){if(null!=n)return this.hasSkipped=!0,Math.floor((Math.abs(n.getX()-i.getX())-Math.abs(n.getY()-i.getY()))/2);n=i}}}catch(a){r.e(a)}finally{r.f()}return 0}},{key:"haveMultiplyConfirmedCenters",value:function(){var t,n=0,r=0,i=this.possibleCenters.length,a=l(this.possibleCenters);try{for(a.s();!(t=a.n()).done;){var o=t.value;o.getCount()>=e.CENTER_QUORUM&&(n++,r+=o.getEstimatedModuleSize())}}catch(h){a.e(h)}finally{a.f()}if(n<3)return!1;var s,u=r/i,c=0,d=l(this.possibleCenters);try{for(d.s();!(s=d.n()).done;){var f=s.value;c+=Math.abs(f.getEstimatedModuleSize()-u)}}catch(h){d.e(h)}finally{d.f()}return c<=.05*r}},{key:"selectBestPatterns",value:function(){var e=this.possibleCenters.length;if(e<3)throw new F;var t,n=this.possibleCenters;if(e>3){var r,i=0,a=0,o=l(this.possibleCenters);try{for(o.s();!(r=o.n()).done;){var s=r.value.getEstimatedModuleSize();i+=s,a+=s*s}}catch(g){o.e(g)}finally{o.f()}t=i/e;var u=Math.sqrt(a/e-t*t);n.sort((function(e,n){var r=Math.abs(n.getEstimatedModuleSize()-t),i=Math.abs(e.getEstimatedModuleSize()-t);return ri?1:0}));for(var c=Math.max(.2*t,u),d=0;d3;d++){var f=n[d];Math.abs(f.getEstimatedModuleSize()-t)>c&&(n.splice(d,1),d--)}}if(n.length>3){var h,v=0,p=l(n);try{for(p.s();!(h=p.n()).done;)v+=h.value.getEstimatedModuleSize()}catch(g){p.e(g)}finally{p.f()}t=v/n.length,n.sort((function(e,n){if(n.getCount()===e.getCount()){var r=Math.abs(n.getEstimatedModuleSize()-t),i=Math.abs(e.getEstimatedModuleSize()-t);return ri?-1:0}return n.getCount()-e.getCount()})),n.splice(3)}return[n[0],n[1],n[2]]}}],[{key:"centerFromEnd",value:function(e,t){return t-e[4]-e[3]-e[2]/2}},{key:"foundPatternCross",value:function(e){for(var t=0,n=0;n<5;n++){var r=e[n];if(0===r)return!1;t+=r}if(t<7)return!1;var i=t/7,a=i/2;return Math.abs(i-e[0])0)for(var c=r.getX()-n.getX()+i.getX(),d=r.getY()-n.getY()+i.getY(),f=1-3/l,h=Math.floor(n.getX()+f*(c-n.getX())),v=Math.floor(n.getY()+f*(d-n.getY())),p=4;p<=16;p<<=1)try{u=this.findAlignmentInRegion(a,h,v,p);break}catch(y){if(!(y instanceof F))throw y}var g=e.createTransform(n,r,i,u,o),m=e.sampleGrid(this.image,g,o);return new de(m,null===u?[i,n,r]:[i,n,r,u])}},{key:"calculateModuleSize",value:function(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2}},{key:"calculateModuleSizeOneWay",value:function(e,t){var n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?r/7:isNaN(r)?n/7:(n+r)/14}},{key:"sizeOfBlackWhiteBlackRunBothWays",value:function(e,t,n,r){var i=this.sizeOfBlackWhiteBlackRun(e,t,n,r),a=1,o=e-(n-e);o<0?(a=e/(e-o),o=0):o>=this.image.getWidth()&&(a=(this.image.getWidth()-1-e)/(o-e),o=this.image.getWidth()-1);var s=Math.floor(t-(r-t)*a);return a=1,s<0?(a=t/(t-s),s=0):s>=this.image.getHeight()&&(a=(this.image.getHeight()-1-t)/(s-t),s=this.image.getHeight()-1),o=Math.floor(e+(o-e)*a),(i+=this.sizeOfBlackWhiteBlackRun(e,t,o,s))-1}},{key:"sizeOfBlackWhiteBlackRun",value:function(e,t,n,r){var i=Math.abs(r-t)>Math.abs(n-e);if(i){var a=e;e=t,t=a,a=n,n=r,r=a}for(var o=Math.abs(n-e),s=Math.abs(r-t),l=-o/2,u=e0){if(v===r)break;v+=c,l-=o}}return 2===d?le.distance(n+u,r,e,t):NaN}},{key:"findAlignmentInRegion",value:function(e,t,n,r){var i=Math.floor(r*e),a=Math.max(0,t-i),o=Math.min(this.image.getWidth()-1,t+i);if(o-a<3*e)throw new F("Alignment top exceeds estimated module size.");var s=Math.max(0,n-i),l=Math.min(this.image.getHeight()-1,n+i);if(l-s<3*e)throw new F("Alignment bottom exceeds estimated module size.");return new Ht(this.image,a,s,o-a,l-s,e,this.resultPointCallback).find()}}],[{key:"createTransform",value:function(e,t,n,r,i){var a,o,s,l,u=i-3.5;return null!==r?(a=r.getX(),o=r.getY(),l=s=u-3):(a=t.getX()-e.getX()+n.getX(),o=t.getY()-e.getY()+n.getY(),s=u,l=u),pe.quadrilateralToQuadrilateral(3.5,3.5,u,3.5,s,l,3.5,u,e.getX(),e.getY(),t.getX(),t.getY(),a,o,n.getX(),n.getY())}},{key:"sampleGrid",value:function(e,t,n){return me.getInstance().sampleGridWithTransform(e,n,n,t)}},{key:"computeDimension",value:function(e,t,n,r){var i=le.round(ce.distance(e,t)/r),a=le.round(ce.distance(e,n)/r),o=Math.floor((i+a)/2)+7;switch(3&o){case 0:o++;break;case 2:o--;break;case 3:throw new F("Dimensions could be not found.")}return o}}]),e}(),Yt=function(){function e(){u(this,e),this.decoder=new Ut}return c(e,[{key:"getDecoder",value:function(){return this.decoder}},{key:"decode",value:function(t,n){var r,i;if(void 0!==n&&null!==n&&void 0!==n.get(N.PURE_BARCODE)){var a=e.extractPureBits(t.getBlackMatrix());r=this.decoder.decodeBitMatrix(a,n),i=e.NO_POINTS}else{var o=new Wt(t.getBlackMatrix()).detect(n);r=this.decoder.decodeBitMatrix(o.getBits(),n),i=o.getPoints()}r.getOther()instanceof Ft&&r.getOther().applyMirroredCorrection(i);var s=new Q(r.getText(),r.getRawBytes(),void 0,i,K.QR_CODE,void 0),l=r.getByteSegments();null!==l&&s.putMetadata(q.BYTE_SEGMENTS,l);var u=r.getECLevel();return null!==u&&s.putMetadata(q.ERROR_CORRECTION_LEVEL,u),r.hasStructuredAppend()&&(s.putMetadata(q.STRUCTURED_APPEND_SEQUENCE,r.getStructuredAppendSequenceNumber()),s.putMetadata(q.STRUCTURED_APPEND_PARITY,r.getStructuredAppendParity())),s}},{key:"reset",value:function(){}}],[{key:"extractPureBits",value:function(e){var t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(null===t||null===n)throw new F;var r=this.moduleSize(t,e),i=t[1],a=n[1],o=t[0],s=n[0];if(o>=s||i>=a)throw new F;if(a-i!==s-o&&(s=o+(a-i))>=e.getWidth())throw new F;var l=Math.round((s-o+1)/r),u=Math.round((a-i+1)/r);if(l<=0||u<=0)throw new F;if(u!==l)throw new F;var c=Math.floor(r/2);i+=c;var d=(o+=c)+Math.floor((l-1)*r)-s;if(d>0){if(d>c)throw new F;o-=d}var f=i+Math.floor((u-1)*r)-a;if(f>0){if(f>c)throw new F;i-=f}for(var h=new B(l,u),v=0;v0;){var d=e.findGuardPattern(t,a,--i,r,!1,o,u);if(null==d){i++;break}c=d}s[0]=new ce(c[0],i),s[1]=new ce(c[1],i),l=!0;break}}var f=i+1;if(l){for(var h=0,v=Int32Array.from([Math.trunc(s[0].getX()),Math.trunc(s[1].getX())]);fe.SKIPPED_ROW_COUNT_MAX)break;h++}}f-=h+1,s[2]=new ce(v[0],f),s[3]=new ce(v[1],f)}return f-i0&&u++d?c-d:d-c;if(f>n)return 1/0;l+=f}return l/i}}]),e}();Zt.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Zt.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Zt.MAX_AVG_VARIANCE=.42,Zt.MAX_INDIVIDUAL_VARIANCE=.8,Zt.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Zt.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Zt.MAX_PIXEL_DRIFT=3,Zt.MAX_PATTERN_DRIFT=5,Zt.SKIPPED_ROW_COUNT_MAX=25,Zt.ROW_STEP=5,Zt.BARCODE_MIN_HEIGHT=10;var Kt=function(){function e(t,n){if(u(this,e),0===n.length)throw new y;this.field=t;var r=n.length;if(r>1&&0===n[0]){for(var i=1;ir.length){var i=n;n=r,r=i}var a=new Int32Array(r.length),o=r.length-n.length;S.arraycopy(r,0,a,0,o);for(var s=o;s=0;t--){var n=this.getCoefficient(t);0!==n&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),0!==t&&1===n||e.append(n),0!==t&&(1===t?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}]),e}(),qt=function(e){d(n,e);var t=f(n);function n(e,r){var a;u(this,n),(a=t.call(this)).modulus=e,a.expTable=new Int32Array(e),a.logTable=new Int32Array(e);for(var o=1,s=0;s0;o--){var s=r.evaluateAt(this.field.exp(o));i[t-o]=s,0!==s&&(a=!0)}if(!a)return 0;var u=this.field.getOne();if(null!=n){var c,d=l(n);try{for(d.s();!(c=d.n()).done;){var f=c.value,h=this.field.exp(e.length-1-f),v=new Kt(this.field,new Int32Array([this.field.subtract(0,h),1]));u=u.multiply(v)}}catch(b){d.e(b)}finally{d.f()}}for(var p=new Kt(this.field,i),g=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),p,t),m=g[0],y=g[1],w=this.findErrorLocations(m),C=this.findErrorMagnitudes(y,m,w),S=0;S=Math.round(n/2);){var l=i,u=o;if(o=s,(i=a).isZero())throw E.getChecksumInstance();a=l;for(var c=this.field.getZero(),d=i.getCoefficient(i.getDegree()),f=this.field.inverse(d);a.getDegree()>=i.getDegree()&&!a.isZero();){var h=a.getDegree()-i.getDegree(),v=this.field.multiply(a.getCoefficient(a.getDegree()),f);c=c.add(this.field.buildMonomial(h,v)),a=a.subtract(i.multiplyByMonomial(h,v))}s=c.multiply(o).subtract(u).negative()}var p=s.getCoefficient(0);if(0===p)throw E.getChecksumInstance();var g=this.field.inverse(p);return[s.multiply(g),a.multiply(g)]}},{key:"findErrorLocations",value:function(e){for(var t=e.getDegree(),n=new Int32Array(t),r=0,i=1;i0){var l=r?this.topLeft:this.topRight,u=Math.trunc(l.getY()-t);u<0&&(u=0);var c=new ce(l.getX(),u);r?i=c:o=c}if(n>0){var d=r?this.bottomLeft:this.bottomRight,f=Math.trunc(d.getY()+n);f>=this.image.getHeight()&&(f=this.image.getHeight()-1);var h=new ce(d.getX(),f);r?a=h:s=h}return new e(this.image,i,a,o,s)}},{key:"getMinX",value:function(){return this.minX}},{key:"getMaxX",value:function(){return this.maxX}},{key:"getMinY",value:function(){return this.minY}},{key:"getMaxY",value:function(){return this.maxY}},{key:"getTopLeft",value:function(){return this.topLeft}},{key:"getTopRight",value:function(){return this.topRight}},{key:"getBottomLeft",value:function(){return this.bottomLeft}},{key:"getBottomRight",value:function(){return this.bottomRight}}],[{key:"merge",value:function(t,n){return null==t?n:null==n?t:new e(t.image,t.topLeft,t.bottomLeft,n.topRight,n.bottomRight)}}]),e}(),en=function(){function e(t,n,r,i){u(this,e),this.columnCount=t,this.errorCorrectionLevel=i,this.rowCountUpperPart=n,this.rowCountLowerPart=r,this.rowCount=n+r}return c(e,[{key:"getColumnCount",value:function(){return this.columnCount}},{key:"getErrorCorrectionLevel",value:function(){return this.errorCorrectionLevel}},{key:"getRowCount",value:function(){return this.rowCount}},{key:"getRowCountUpperPart",value:function(){return this.rowCountUpperPart}},{key:"getRowCountLowerPart",value:function(){return this.rowCountLowerPart}}]),e}(),tn=function(){function e(){u(this,e),this.buffer=""}return c(e,[{key:"format",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i=0&&null!=(n=this.codewords[i]))return n;if((i=this.imageRowToCodewordIndex(t)+r)t?(t=s.getValue(),(n=[]).push(s.getKey())):s.getValue()===t&&n.push(s.getKey())};for(i.s();!(e=i.n()).done;)a()}catch(o){i.e(o)}finally{i.f()}return Xt.toIntArray(n)}},{key:"getConfidence",value:function(e){return this.values.get(e)}}]),e}(),an=function(e){d(n,e);var t=f(n);function n(e,r){var i;return u(this,n),(i=t.call(this,e))._isLeft=r,i}return c(n,[{key:"setRowNumbers",value:function(){var e,t=l(this.getCodewords());try{for(t.s();!(e=t.n()).done;){var n=e.value;null!=n&&n.setRowNumberAsRowIndicatorColumn()}}catch(r){t.e(r)}finally{t.f()}}},{key:"adjustCompleteIndicatorColumnRowNumbers",value:function(e){var t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);for(var n=this.getBoundingBox(),r=this._isLeft?n.getTopLeft():n.getTopRight(),i=this._isLeft?n.getBottomLeft():n.getBottomRight(),a=this.imageRowToCodewordIndex(Math.trunc(r.getY())),o=this.imageRowToCodewordIndex(Math.trunc(i.getY())),s=-1,l=1,u=0,c=a;c=e.getRowCount()||f>c)t[c]=null;else{for(var h=void 0,v=(h=l>2?(l-2)*f:f)>=c,p=1;p<=h&&!v;p++)v=null!=t[c-p];v?t[c]=null:(s=d.getRowNumber(),u=1)}}}},{key:"getRowHeights",value:function(){var e=this.getBarcodeMetadata();if(null==e)return null;this.adjustIncompleteIndicatorColumnRowNumbers(e);var t,n=new Int32Array(e.getRowCount()),r=l(this.getCodewords());try{for(r.s();!(t=r.n()).done;){var i=t.value;if(null!=i){var a=i.getRowNumber();if(a>=n.length)continue;n[a]++}}}catch(o){r.e(o)}finally{r.f()}return n}},{key:"adjustIncompleteIndicatorColumnRowNumbers",value:function(e){for(var t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),r=this._isLeft?t.getBottomLeft():t.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(n.getY())),a=this.imageRowToCodewordIndex(Math.trunc(r.getY())),o=this.getCodewords(),s=-1,l=i;l=e.getRowCount()?o[l]=null:s=u.getRowNumber())}}},{key:"getBarcodeMetadata",value:function(){var e,t=this.getCodewords(),n=new rn,r=new rn,i=new rn,a=new rn,o=l(t);try{for(o.s();!(e=o.n()).done;){var s=e.value;if(null!=s){s.setRowNumberAsRowIndicatorColumn();var u=s.getValue()%30,c=s.getRowNumber();switch(this._isLeft||(c+=2),c%3){case 0:r.setValue(3*u+1);break;case 1:a.setValue(u/3),i.setValue(u%3);break;case 2:n.setValue(u+1)}}}}catch(f){o.e(f)}finally{o.f()}if(0===n.getValue().length||0===r.getValue().length||0===i.getValue().length||0===a.getValue().length||n.getValue()[0]<1||r.getValue()[0]+i.getValue()[0]Xt.MAX_ROWS_IN_BARCODE)return null;var d=new en(n.getValue()[0],r.getValue()[0],i.getValue()[0],a.getValue()[0]);return this.removeIncorrectCodewords(t,d),d}},{key:"removeIncorrectCodewords",value:function(e,t){for(var n=0;nt.getRowCount())e[n]=null;else switch(this._isLeft||(a+=2),a%3){case 0:3*i+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:Math.trunc(i/3)===t.getErrorCorrectionLevel()&&i%3===t.getRowCountLowerPart()||(e[n]=null);break;case 2:i+1!==t.getColumnCount()&&(e[n]=null)}}}}},{key:"isLeft",value:function(){return this._isLeft}},{key:"toString",value:function(){return"IsLeft: "+this._isLeft+"\n"+o(s(n.prototype),"toString",this).call(this)}}]),n}(nn),on=function(){function e(t,n){u(this,e),this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=t,this.barcodeColumnCount=t.getColumnCount(),this.boundingBox=n,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}return c(e,[{key:"getDetectionResultColumns",value:function(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);var e,t=Xt.MAX_CODEWORDS_IN_BARCODE;do{e=t,t=this.adjustRowNumbersAndGetCount()}while(t>0&&t0&&a0&&(s[0]=r[n-1],s[4]=a[n-1],s[5]=o[n-1]),n>1&&(s[8]=r[n-2],s[10]=a[n-2],s[11]=o[n-2]),n>=1;r=1&n,e.RATIOS_TABLE[t]||(e.RATIOS_TABLE[t]=new Array(Xt.BARS_IN_MODULE)),e.RATIOS_TABLE[t][Xt.BARS_IN_MODULE-i-1]=Math.fround(a/Xt.MODULES_IN_CODEWORD)}this.bSymbolTableReady=!0}},{key:"getDecodedValue",value:function(t){var n=e.getDecodedCodewordValue(e.sampleBitCounts(t));return-1!==n?n:e.getClosestDecodedValue(t)}},{key:"sampleBitCounts",value:function(e){for(var t=le.sum(e),n=new Int32Array(Xt.BARS_IN_MODULE),r=0,i=0,a=0;a1)for(var i=0;i=a)break}l1&&void 0!==arguments[1]?arguments[1]:void 0)}}]),e}(),dn=function(e){d(n,e);var t=f(n);function n(){return u(this,n),t.apply(this,arguments)}return c(n)}(g);dn.kind="NullPointerException";var fn,hn,vn=function(){function e(){u(this,e)}return c(e,[{key:"writeBytes",value:function(e){this.writeBytesOffset(e,0,e.length)}},{key:"writeBytesOffset",value:function(e,t,n){if(null==e)throw new dn;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new A;if(0!==n)for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:32;if(u(this,n),(e=t.call(this)).count=0,r<0)throw new y("Negative initial size: "+r);return e.buf=new Uint8Array(r),e}return c(n,[{key:"ensureCapacity",value:function(e){e-this.buf.length>0&&this.grow(e)}},{key:"grow",value:function(e){var t=this.buf.length<<1;if(t-e<0&&(t=e),t<0){if(e<0)throw new pn;t=_.MAX_VALUE}this.buf=k.copyOfUint8Array(this.buf,t)}},{key:"write",value:function(e){this.ensureCapacity(this.count+1),this.buf[this.count]=e,this.count+=1}},{key:"writeBytesOffset",value:function(e,t,n){if(t<0||t>e.length||n<0||t+n-e.length>0)throw new A;this.ensureCapacity(this.count+n),S.arraycopy(e,t,this.buf,this.count,n),this.count+=n}},{key:"writeTo",value:function(e){e.writeBytesOffset(this.buf,0,this.count)}},{key:"reset",value:function(){this.count=0}},{key:"toByteArray",value:function(){return k.copyOfUint8Array(this.buf,this.count)}},{key:"size",value:function(){return this.count}},{key:"toString",value:function(e){return e?"string"===typeof e?this.toString_string(e):this.toString_number(e):this.toString_void()}},{key:"toString_void",value:function(){return new String(this.buf).toString()}},{key:"toString_string",value:function(e){return new String(this.buf).toString()}},{key:"toString_number",value:function(e){return new String(this.buf).toString()}},{key:"close",value:function(){}}]),n}(vn);function mn(){if("undefined"!==typeof window)return window.BigInt||null;if("undefined"!==typeof n.g)return n.g.BigInt||null;if("undefined"!==typeof self)return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}function yn(e){if("undefined"===typeof hn&&(hn=mn()),null===hn)throw new Error("BigInt is not supported!");return hn(e)}function wn(){var e=[];e[0]=yn(1);var t=yn(900);e[1]=t;for(var n=2;n<16;n++)e[n]=e[n-1]*t;return e}!function(e){e[e.ALPHA=0]="ALPHA",e[e.LOWER=1]="LOWER",e[e.MIXED=2]="MIXED",e[e.PUNCT=3]="PUNCT",e[e.ALPHA_SHIFT=4]="ALPHA_SHIFT",e[e.PUNCT_SHIFT=5]="PUNCT_SHIFT"}(fn||(fn={}));var En=function(){function e(){u(this,e)}return c(e,null,[{key:"decode",value:function(t,n){var r=new L(""),i=R.ISO8859_1;r.enableDecoding(i);for(var a=1,o=t[a++],s=new un;at[0])throw D.getFormatInstance();for(var i=new Int32Array(e.NUMBER_OF_SEQUENCE_CODEWORDS),a=0;a0){for(var f=0;f<6;++f)o.write(Number(yn(l)>>yn(8*(5-f))));l=0,s=0}}i===n[0]&&d0){for(var p=0;p<6;++p)o.write(Number(yn(l)>>yn(8*(5-p))));l=0,s=0}}}return a.append(P.decode(o.toByteArray(),r)),i}},{key:"numericCompaction",value:function(t,n,r){for(var i=0,a=!1,o=new Int32Array(e.MAX_NUMERIC_CODEWORDS);n0&&(r.append(e.decodeBase900toBase10(o,i)),i=0)}return n}},{key:"decodeBase900toBase10",value:function(t,n){for(var r=yn(0),i=0;i@[\\]_`~!\r\t,:\n-.$/\"|*()?{}'",En.MIXED_CHARS="0123456789&\r\t,:#-.$/+%*=^",En.EXP900=mn()?wn():[],En.NUMBER_OF_SEQUENCE_CODEWORDS=2;var Cn=function(){function e(){u(this,e)}return c(e,null,[{key:"decode",value:function(t,n,r,i,a,o,s){for(var l,u=new Jt(t,n,r,i,a),c=null,d=null,f=!0;;f=!1){if(null!=n&&(c=e.getRowIndicatorColumn(t,u,n,!0,o,s)),null!=i&&(d=e.getRowIndicatorColumn(t,u,i,!1,o,s)),null==(l=e.merge(c,d)))throw F.getNotFoundInstance();var h=l.getBoundingBox();if(!f||null==h||!(h.getMinY()u.getMaxY()))break;u=h}l.setBoundingBox(u);var v=l.getBarcodeColumnCount()+1;l.setDetectionResultColumn(0,c),l.setDetectionResultColumn(v,d);for(var p=null!=c,g=1;g<=v;g++){var m=p?g:v-g;if(void 0===l.getDetectionResultColumn(m)){var y=void 0;y=0===m||m===v?new an(u,0===m):new nn(u),l.setDetectionResultColumn(m,y);for(var w=-1,E=w,C=u.getMinY();C<=u.getMaxY();C++){if((w=e.getStartColumn(l,m,C,p))<0||w>u.getMaxX()){if(-1===E)continue;w=E}var S=e.detectCodeword(t,u.getMinX(),u.getMaxX(),p,w,C,o,s);null!=S&&(y.setCodeword(C,S),E=w,o=Math.min(o,S.getWidth()),s=Math.max(s,S.getWidth()))}}}return e.createDecoderResult(l)}},{key:"merge",value:function(t,n){if(null==t&&null==n)return null;var r=e.getBarcodeMetadata(t,n);if(null==r)return null;var i=Jt.merge(e.adjustBoundingBox(t),e.adjustBoundingBox(n));return new on(r,i)}},{key:"adjustBoundingBox",value:function(t){if(null==t)return null;var n=t.getRowHeights();if(null==n)return null;var r,i=e.getMax(n),a=0,o=l(n);try{for(o.s();!(r=o.n()).done;){var s=r.value;if(a+=i-s,s>0)break}}catch(v){o.e(v)}finally{o.f()}for(var u=t.getCodewords(),c=0;a>0&&null==u[c];c++)a--;for(var d=0,f=n.length-1;f>=0&&(d+=i-n[f],!(n[f]>0));f--);for(var h=u.length-1;d>0&&null==u[h];h--)d--;return t.getBoundingBox().addMissingRows(a,d,t.isLeft())}},{key:"getMax",value:function(e){var t,n=-1,r=l(e);try{for(r.s();!(t=r.n()).done;){var i=t.value;n=Math.max(n,i)}}catch(a){r.e(a)}finally{r.f()}return n}},{key:"getBarcodeMetadata",value:function(e,t){var n,r;return null==e||null==(n=e.getBarcodeMetadata())?null==t?null:t.getBarcodeMetadata():null==t||null==(r=t.getBarcodeMetadata())?n:n.getColumnCount()!==r.getColumnCount()&&n.getErrorCorrectionLevel()!==r.getErrorCorrectionLevel()&&n.getRowCount()!==r.getRowCount()?null:n}},{key:"getRowIndicatorColumn",value:function(t,n,r,i,a,o){for(var s=new an(n,i),l=0;l<2;l++)for(var u=0===l?1:-1,c=Math.trunc(Math.trunc(r.getX())),d=Math.trunc(Math.trunc(r.getY()));d<=n.getMaxY()&&d>=n.getMinY();d+=u){var f=e.detectCodeword(t,0,t.getWidth(),i,c,d,a,o);null!=f&&(s.setCodeword(d,f),c=i?f.getStartX():f.getEndX())}return s}},{key:"adjustCodewordCount",value:function(t,n){var r=n[0][1],i=r.getValue(),a=t.getBarcodeColumnCount()*t.getBarcodeRowCount()-e.getNumberOfECCodeWords(t.getBarcodeECLevel());if(0===i.length){if(a<1||a>Xt.MAX_CODEWORDS_IN_BARCODE)throw F.getNotFoundInstance();r.setValue(a)}else i[0]!==a&&r.setValue(a)}},{key:"createDecoderResult",value:function(t){var n=e.createBarcodeMatrix(t);e.adjustCodewordCount(t,n);for(var r=new Array,i=new Int32Array(t.getBarcodeRowCount()*t.getBarcodeColumnCount()),a=[],o=new Array,s=0;s0;){for(var l=0;l=0){if(f>=t.length)continue;t[f][a].setValue(d.getValue())}}}}catch(h){c.e(h)}finally{c.f()}}a++}}catch(h){o.e(h)}finally{o.f()}return t}},{key:"isValidBarcodeColumn",value:function(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}},{key:"getStartColumn",value:function(t,n,r,i){var a=i?1:-1,o=null;if(e.isValidBarcodeColumn(t,n-a)&&(o=t.getDetectionResultColumn(n-a).getCodeword(r)),null!=o)return i?o.getEndX():o.getStartX();if(null!=(o=t.getDetectionResultColumn(n).getCodewordNearby(r)))return i?o.getStartX():o.getEndX();if(e.isValidBarcodeColumn(t,n-a)&&(o=t.getDetectionResultColumn(n-a).getCodewordNearby(r)),null!=o)return i?o.getEndX():o.getStartX();for(var s=0;e.isValidBarcodeColumn(t,n-a);){n-=a;var u,c=l(t.getDetectionResultColumn(n).getCodewords());try{for(c.s();!(u=c.n()).done;){var d=u.value;if(null!=d)return(i?d.getEndX():d.getStartX())+a*s*(d.getEndX()-d.getStartX())}}catch(f){c.e(f)}finally{c.f()}s++}return i?t.getBoundingBox().getMinX():t.getBoundingBox().getMaxX()}},{key:"detectCodeword",value:function(t,n,r,i,a,o,s,l){a=e.adjustCodewordStartColumn(t,n,r,i,a,o);var u,c=e.getModuleBitCount(t,n,r,i,a,o);if(null==c)return null;var d=le.sum(c);if(i)u=a+d;else{for(var f=0;f=t)&&l=n:se.CODEWORD_SKEW_SIZE)return a;s+=l}l=-l,i=!i}return s}},{key:"checkCodewordSkew",value:function(t,n,r){return n-e.CODEWORD_SKEW_SIZE<=t&&t<=r+e.CODEWORD_SKEW_SIZE}},{key:"decodeCodewords",value:function(t,n,r){if(0===t.length)throw D.getFormatInstance();var i=1<r/2+e.MAX_ERRORS||r<0||r>e.MAX_EC_CODEWORDS)throw E.getChecksumInstance();return e.errorCorrection.decode(t,r,n)}},{key:"verifyCodewordCount",value:function(e,t){if(e.length<4)throw D.getFormatInstance();var n=e[0];if(n>e.length)throw D.getFormatInstance();if(0===n){if(!(t>=1;return t}},{key:"getCodewordBucketNumber",value:function(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}},{key:"getCodewordBucketNumber_number",value:function(t){return e.getCodewordBucketNumber(e.getBitCountForCodeword(t))}},{key:"getCodewordBucketNumber_Int32Array",value:function(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}},{key:"toString",value:function(e){for(var t=new tn,n=0;n1&&void 0!==arguments[1]?arguments[1]:null,r=e.decode(t,n,!1);if(null==r||0===r.length||null==r[0])throw F.getNotFoundInstance();return r[0]}},{key:"decodeMultiple",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;try{return e.decode(t,n,!0)}catch(r){if(r instanceof D||r instanceof E)throw F.getNotFoundInstance();throw r}}},{key:"reset",value:function(){}}],[{key:"decode",value:function(t,n,r){var i,a=new Array,o=Zt.detectMultiple(t,n,r),s=l(o.getPoints());try{for(s.s();!(i=s.n()).done;){var u=i.value,c=Cn.decode(o.getBits(),u[4],u[5],u[6],u[7],e.getMinCodewordWidth(u),e.getMaxCodewordWidth(u)),d=new Q(c.getText(),c.getRawBytes(),void 0,u,K.PDF_417);d.putMetadata(q.ERROR_CORRECTION_LEVEL,c.getECLevel());var f=c.getOther();null!=f&&d.putMetadata(q.PDF417_EXTRA_METADATA,f),a.push(d)}}catch(h){s.e(h)}finally{s.f()}return a.map((function(e){return e}))}},{key:"getMaxWidth",value:function(e,t){return null==e||null==t?0:Math.trunc(Math.abs(e.getX()-t.getX()))}},{key:"getMinWidth",value:function(e,t){return null==e||null==t?_.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}},{key:"getMaxCodewordWidth",value:function(t){return Math.floor(Math.max(Math.max(e.getMaxWidth(t[0],t[4]),e.getMaxWidth(t[6],t[2])*Xt.MODULES_IN_CODEWORD/Xt.MODULES_IN_STOP_PATTERN),Math.max(e.getMaxWidth(t[1],t[5]),e.getMaxWidth(t[7],t[3])*Xt.MODULES_IN_CODEWORD/Xt.MODULES_IN_STOP_PATTERN)))}},{key:"getMinCodewordWidth",value:function(t){return Math.floor(Math.min(Math.min(e.getMinWidth(t[0],t[4]),e.getMinWidth(t[6],t[2])*Xt.MODULES_IN_CODEWORD/Xt.MODULES_IN_STOP_PATTERN),Math.min(e.getMinWidth(t[1],t[5]),e.getMinWidth(t[7],t[3])*Xt.MODULES_IN_CODEWORD/Xt.MODULES_IN_STOP_PATTERN)))}}]),e}(),An=function(e){d(n,e);var t=f(n);function n(){return u(this,n),t.apply(this,arguments)}return c(n)}(g);An.kind="ReaderException";var bn,kn=function(){function e(t,n){u(this,e),this.verbose=!0===t,n&&this.setHints(n)}return c(e,[{key:"decode",value:function(e,t){return t&&this.setHints(t),this.decodeInternal(e)}},{key:"decodeWithState",value:function(e){return null!==this.readers&&void 0!==this.readers||this.setHints(null),this.decodeInternal(e)}},{key:"setHints",value:function(e){this.hints=e;var t=null!==e&&void 0!==e&&void 0!==e.get(N.TRY_HARDER),n=null===e||void 0===e?null:e.get(N.POSSIBLE_FORMATS),r=new Array;if(null!==n&&void 0!==n){var i=n.some((function(e){return e===K.UPC_A||e===K.UPC_E||e===K.EAN_13||e===K.EAN_8||e===K.CODABAR||e===K.CODE_39||e===K.CODE_93||e===K.CODE_128||e===K.ITF||e===K.RSS_14||e===K.RSS_EXPANDED}));i&&!t&&r.push(new dt(e,this.verbose)),n.includes(K.QR_CODE)&&r.push(new Yt),n.includes(K.DATA_MATRIX)&&r.push(new At),n.includes(K.AZTEC)&&r.push(new Ee),n.includes(K.PDF_417)&&r.push(new Sn),i&&t&&r.push(new dt(e,this.verbose))}0===r.length&&(t||r.push(new dt(e,this.verbose)),r.push(new Yt),r.push(new At),r.push(new Ee),r.push(new Sn),t&&r.push(new dt(e,this.verbose))),this.readers=r}},{key:"reset",value:function(){if(null!==this.readers){var e,t=l(this.readers);try{for(t.s();!(e=t.n()).done;)e.value.reset()}catch(n){t.e(n)}finally{t.f()}}}},{key:"decodeInternal",value:function(e){if(null===this.readers)throw new An("No readers where selected, nothing can be read.");var t,n=l(this.readers);try{for(n.s();!(t=n.n()).done;){var r=t.value;try{return r.decode(e,this.hints)}catch(i){if(i instanceof An)continue}}}catch(a){n.e(a)}finally{n.f()}throw new F("No MultiFormat Readers were able to detect the code.")}}]),e}(),_n=function(e){d(n,e);var t=f(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500;u(this,n);var i=new kn;return i.setHints(e),t.call(this,i,r)}return c(n,[{key:"decodeBitmap",value:function(e){return this.reader.decodeWithState(e)}}]),n}(X),In=function(e){d(n,e);var t=f(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;return u(this,n),t.call(this,new Sn,e)}return c(n)}(X),Tn=function(e){d(n,e);var t=f(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;return u(this,n),t.call(this,new Yt,e)}return c(n)}(X);!function(e){e[e.ERROR_CORRECTION=0]="ERROR_CORRECTION",e[e.CHARACTER_SET=1]="CHARACTER_SET",e[e.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",e[e.MIN_SIZE=3]="MIN_SIZE",e[e.MAX_SIZE=4]="MAX_SIZE",e[e.MARGIN=5]="MARGIN",e[e.PDF417_COMPACT=6]="PDF417_COMPACT",e[e.PDF417_COMPACTION=7]="PDF417_COMPACTION",e[e.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",e[e.AZTEC_LAYERS=9]="AZTEC_LAYERS",e[e.QR_VERSION=10]="QR_VERSION"}(bn||(bn={}));var Mn=bn,Nn=function(){function e(t){u(this,e),this.field=t,this.cachedGenerators=[],this.cachedGenerators.push(new ee(t,Int32Array.from([1])))}return c(e,[{key:"buildGenerator",value:function(e){var t=this.cachedGenerators;if(e>=t.length)for(var n=t[t.length-1],r=this.field,i=t.length;i<=e;i++){var a=n.multiply(new ee(r,Int32Array.from([1,r.exp(i-1+r.getGeneratorBase())])));t.push(a),n=a}return t[e]}},{key:"encode",value:function(e,t){if(0===t)throw new y("No error correction bytes");var n=e.length-t;if(n<=0)throw new y("No data bytes provided");var r=this.buildGenerator(t),i=new Int32Array(n);S.arraycopy(e,0,i,0,n);for(var a=new ee(this.field,i),o=(a=a.multiplyByMonomial(t,1)).divide(r)[1].getCoefficients(),s=t-o.length,l=0;l=5&&(r+=e.N1+(l-5)),l=1,u=d)}l>=5&&(r+=e.N1+(l-5))}return r}}]),e}();Dn.N1=3,Dn.N2=3,Dn.N3=40,Dn.N4=10;var Rn=function(){function e(t,n){u(this,e),this.width=t,this.height=n;for(var r=new Array(n),i=0;i!==n;i++)r[i]=new Uint8Array(t);this.bytes=r}return c(e,[{key:"getHeight",value:function(){return this.height}},{key:"getWidth",value:function(){return this.width}},{key:"get",value:function(e,t){return this.bytes[t][e]}},{key:"getArray",value:function(){return this.bytes}},{key:"setNumber",value:function(e,t,n){this.bytes[t][e]=n}},{key:"setBoolean",value:function(e,t,n){this.bytes[t][e]=n?1:0}},{key:"clear",value:function(e){var t,n=l(this.bytes);try{for(n.s();!(t=n.n()).done;){var r=t.value;k.fill(r,e)}}catch(i){n.e(i)}finally{n.f()}}},{key:"equals",value:function(t){if(!(t instanceof e))return!1;var n=t;if(this.width!==n.width)return!1;if(this.height!==n.height)return!1;for(var r=0,i=this.height;r>\n"),e.toString()}},{key:"setMode",value:function(e){this.mode=e}},{key:"setECLevel",value:function(e){this.ecLevel=e}},{key:"setVersion",value:function(e){this.version=e}},{key:"setMaskPattern",value:function(e){this.maskPattern=e}},{key:"setMatrix",value:function(e){this.matrix=e}}],[{key:"isValidMaskPattern",value:function(t){return t>=0&&t0;){for(6===o&&(o-=1);s>=0&&s=r;)t^=n<=0)for(var l=0;l!==o;l++){var u=i[l];u>=0&&e.isEmpty(n.get(u,s))&&e.embedPositionAdjustmentPattern(u-2,s-2,n)}}}}]),e}();xn.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),xn.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),xn.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),xn.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),xn.VERSION_INFO_POLY=7973,xn.TYPE_INFO_POLY=1335,xn.TYPE_INFO_MASK_PATTERN=21522;var Ln=function(){function e(t,n){u(this,e),this.dataBytes=t,this.errorCorrectionBytes=n}return c(e,[{key:"getDataBytes",value:function(){return this.dataBytes}},{key:"getErrorCorrectionBytes",value:function(){return this.errorCorrectionBytes}}]),e}(),Bn=function(){function e(){u(this,e)}return c(e,null,[{key:"calculateMaskPenalty",value:function(e){return Dn.applyMaskPenaltyRule1(e)+Dn.applyMaskPenaltyRule2(e)+Dn.applyMaskPenaltyRule3(e)+Dn.applyMaskPenaltyRule4(e)}},{key:"encode",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=e.DEFAULT_BYTE_MODE_ENCODING,a=null!==r&&void 0!==r.get(Mn.CHARACTER_SET);a&&(i=r.get(Mn.CHARACTER_SET).toString());var o=this.chooseMode(t,i),s=new T;if(o===Lt.BYTE&&(a||e.DEFAULT_BYTE_MODE_ENCODING!==i)){var l=R.getCharacterSetECIByName(i);void 0!==l&&this.appendECI(l,s)}this.appendModeInfo(o,s);var u,c=new T;if(this.appendBytes(t,o,c,i),null!==r&&void 0!==r.get(Mn.QR_VERSION)){var d=Number.parseInt(r.get(Mn.QR_VERSION).toString(),10);u=Dt.getVersionForNumber(d);var f=this.calculateBitsNeeded(o,s,c,u);if(!this.willFit(f,u,n))throw new Pn("Data too big for requested version")}else u=this.recommendVersion(n,o,s,c);var h=new T;h.appendBitArray(s);var v=o===Lt.BYTE?c.getSizeInBytes():t.length;this.appendLengthInfo(v,u,o,h),h.appendBitArray(c);var p=u.getECBlocksForLevel(n),g=u.getTotalCodewords()-p.getTotalECCodewords();this.terminateBits(g,h);var m=this.interleaveWithECBytes(h,u.getTotalCodewords(),g,p.getNumBlocks()),y=new On;y.setECLevel(n),y.setMode(o),y.setVersion(u);var w=u.getDimensionForVersion(),E=new Rn(w,w),C=this.chooseMaskPattern(m,n,u,E);return y.setMaskPattern(C),xn.buildMatrix(m,n,u,C,E),y.setMatrix(E),y}},{key:"recommendVersion",value:function(e,t,n,r){var i=this.calculateBitsNeeded(t,n,r,Dt.getVersionForNumber(1)),a=this.chooseVersion(i,e),o=this.calculateBitsNeeded(t,n,r,a);return this.chooseVersion(o,e)}},{key:"calculateBitsNeeded",value:function(e,t,n,r){return t.getSize()+e.getCharacterCountBits(r)+n.getSize()}},{key:"getAlphanumericCode",value:function(t){return t1&&void 0!==arguments[1]?arguments[1]:null;if(R.SJIS.getName()===n&&this.isOnlyDoubleByteKanji(t))return Lt.KANJI;for(var r=!1,i=!1,a=0,o=t.length;a159)&&(i<224||i>235))return!1}return!0}},{key:"chooseMaskPattern",value:function(e,t,n,r){for(var i=Number.MAX_SAFE_INTEGER,a=-1,o=0;o=(e+7)/8}},{key:"terminateBits",value:function(e,t){var n=8*e;if(t.getSize()>n)throw new Pn("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(var r=0;r<4&&t.getSize()0)for(var a=i;a<8;a++)t.appendBit(!1);for(var o=e-t.getSizeInBytes(),s=0;s=n)throw new Pn("Block ID too large");var o=e%n,s=n-o,l=Math.floor(e/n),u=l+1,c=Math.floor(t/n),d=c+1,f=l-c,h=u-d;if(f!==h)throw new Pn("EC bytes mismatch");if(n!==s+o)throw new Pn("RS blocks mismatch");if(e!==(c+f)*s+(d+h)*o)throw new Pn("Total bytes mismatch");r=1<=0&&n<=9}},{key:"appendNumericBytes",value:function(t,n){for(var r=t.length,i=0;i=33088&&a<=40956?o=a-33088:a>=57408&&a<=60351&&(o=a-49472),-1===o)throw new Pn("Invalid byte sequence");var s=192*(o>>8)+(255&o);t.appendBits(s,13)}}},{key:"appendECI",value:function(e,t){t.appendBits(Lt.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}]),e}();Bn.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),Bn.DEFAULT_BYTE_MODE_ENCODING=R.UTF8.getName();var Fn=function(){function e(){u(this,e)}return c(e,[{key:"write",value:function(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(0===t.length)throw new y("Found empty contents");if(n<0||r<0)throw new y("Requested dimensions are too small: "+n+"x"+r);var a=_t.L,o=e.QUIET_ZONE_SIZE;null!==i&&(void 0!==i.get(Mn.ERROR_CORRECTION)&&(a=_t.fromString(i.get(Mn.ERROR_CORRECTION).toString())),void 0!==i.get(Mn.MARGIN)&&(o=Number.parseInt(i.get(Mn.MARGIN).toString(),10)));var s=Bn.encode(t,a,i);return this.renderResult(s,n,r,o)}},{key:"writeToDom",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;"string"===typeof e&&(e=document.querySelector(e));var a=this.write(t,n,r,i);e&&e.appendChild(a)}},{key:"renderResult",value:function(e,t,n,r){var i=e.getMatrix();if(null===i)throw new ie;for(var a=i.getWidth(),o=i.getHeight(),s=a+2*r,l=o+2*r,u=Math.max(t,s),c=Math.max(n,l),d=Math.min(Math.floor(u/s),Math.floor(c/l)),f=Math.floor((u-a*d)/2),h=Math.floor((c-o*d)/2),v=this.createSVGElement(u,c),p=0,g=h;pr||o+l>i)throw new y("Crop rectangle does not fit within image data.");return c&&d.reverseHorizontal(s,l),d}return c(n,[{key:"getRow",value:function(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);var n=this.getWidth();(null===t||void 0===t||t.length>16&255,g=v>>7&510,m=255&v;f[h]=(p+g+m)/4&255}c.luminances=f}else c.luminances=e;if(void 0===a&&(c.dataWidth=r),void 0===o&&(c.dataHeight=i),void 0===s&&(c.left=0),void 0===l&&(c.top=0),c.left+r>c.dataWidth||c.top+i>c.dataHeight)throw new y("Crop rectangle does not fit within image data.");return c}return c(n,[{key:"getRow",value:function(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);var n=this.getWidth();(null===t||void 0===t||t.length"}}]),n}(function(){function e(t){u(this,e),this.previous=t}return c(e,[{key:"getPrevious",value:function(){return this.previous}}]),e}()),Qn=function(e){d(n,e);var t=f(n);function n(e,r,i){var a;return u(this,n),(a=t.call(this,e,0,0)).binaryShiftStart=r,a.binaryShiftByteCount=i,a}return c(n,[{key:"appendTo",value:function(e,t){for(var n=0;n62?e.appendBits(this.binaryShiftByteCount-31,16):0===n?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+n],8)}},{key:"addBinaryShift",value:function(e,t){return new n(this,e,t)}},{key:"toString",value:function(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}]),n}(Xn);function Zn(e,t,n){return new Qn(e,t,n)}function Kn(e,t,n){return new Xn(e,t,n)}var qn=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],$n=0,Jn=1,er=2,tr=3,nr=4,rr=new Xn(null,0,0),ir=[Int32Array.from([0,327708,327710,327709,656318]),Int32Array.from([590318,0,327710,327709,656318]),Int32Array.from([262158,590300,0,590301,932798]),Int32Array.from([327709,327708,656318,0,327710]),Int32Array.from([327711,656380,656382,656381,0])];function ar(e){var t,n=l(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;k.fill(r,-1)}}catch(i){n.e(i)}finally{n.f()}return e[$n][nr]=0,e[Jn][nr]=0,e[Jn][$n]=28,e[tr][nr]=0,e[er][nr]=0,e[er][$n]=15,e}var or=ar(k.createInt32Array(6,6)),sr=function(){function e(t,n,r,i){u(this,e),this.token=t,this.mode=n,this.binaryShiftByteCount=r,this.bitCount=i}return c(e,[{key:"getMode",value:function(){return this.mode}},{key:"getToken",value:function(){return this.token}},{key:"getBinaryShiftByteCount",value:function(){return this.binaryShiftByteCount}},{key:"getBitCount",value:function(){return this.bitCount}},{key:"latchAndAppend",value:function(t,n){var r=this.bitCount,i=this.token;if(t!==this.mode){var a=ir[this.mode][t];i=Kn(i,65535&a,a>>16),r+=a>>16}var o=t===er?4:5;return new e(i=Kn(i,n,o),t,0,r+o)}},{key:"shiftAndAppend",value:function(t,n){var r=this.token,i=this.mode===er?4:5;return r=Kn(r,or[this.mode][t],i),new e(r=Kn(r,n,5),this.mode,0,this.bitCount+i+5)}},{key:"addBinaryShiftChar",value:function(t){var n=this.token,r=this.mode,i=this.bitCount;if(this.mode===nr||this.mode===er){var a=ir[r][$n];n=Kn(n,65535&a,a>>16),i+=a>>16,r=$n}var o=0===this.binaryShiftByteCount||31===this.binaryShiftByteCount?18:62===this.binaryShiftByteCount?9:8,s=new e(n,r,this.binaryShiftByteCount+1,i+o);return 2078===s.binaryShiftByteCount&&(s=s.endBinaryShift(t+1)),s}},{key:"endBinaryShift",value:function(t){if(0===this.binaryShiftByteCount)return this;var n=this.token;return new e(n=Zn(n,t-this.binaryShiftByteCount,this.binaryShiftByteCount),this.mode,0,this.bitCount)}},{key:"isBetterThanOrEqualTo",value:function(t){var n=this.bitCount+(ir[this.mode][t.mode]>>16);return this.binaryShiftByteCountt.binaryShiftByteCount&&t.binaryShiftByteCount>0&&(n+=10),n<=t.bitCount}},{key:"toBitArray",value:function(e){for(var t=[],n=this.endBinaryShift(e.length).token;null!==n;n=n.getPrevious())t.unshift(n);for(var r=new T,i=0,a=t;i62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}]),e}();function lr(e){var t=x.getCharCode(" "),n=x.getCharCode("."),r=x.getCharCode(",");e[$n][t]=1;for(var i=x.getCharCode("Z"),a=x.getCharCode("A"),o=a;o<=i;o++)e[$n][o]=o-a+2;e[Jn][t]=1;for(var s=x.getCharCode("z"),l=x.getCharCode("a"),u=l;u<=s;u++)e[Jn][u]=u-l+2;e[er][t]=1;for(var c=x.getCharCode("9"),d=x.getCharCode("0"),f=d;f<=c;f++)e[er][f]=f-d+2;e[er][r]=12,e[er][n]=13;for(var h=["\0"," ","\x01","\x02","\x03","\x04","\x05","\x06","\x07","\b","\t","\n","\v","\f","\r","\x1b","\x1c","\x1d","\x1e","\x1f","@","\\","^","_","`","|","~","\x7f"],v=0;v","?","[","]","{","}"],g=0;g0&&(e[nr][x.getCharCode(p[g])]=g);return e}sr.INITIAL_STATE=new sr(rr,$n,0,0);var ur=lr(k.createInt32Array(5,256)),cr=function(){function e(t){u(this,e),this.text=t}return c(e,[{key:"encode",value:function(){for(var t=x.getCharCode(" "),n=x.getCharCode("\n"),r=Yn.singletonList(sr.INITIAL_STATE),i=0;i0?(r=e.updateStateListForPair(r,i,a),i++):r=this.updateStateListForChar(r,i)}return Yn.min(r,(function(e,t){return e.getBitCount()-t.getBitCount()})).toBitArray(this.text)}},{key:"updateStateListForChar",value:function(t,n){var r,i=[],a=l(t);try{for(a.s();!(r=a.n()).done;){var o=r.value;this.updateStateForChar(o,n,i)}}catch(s){a.e(s)}finally{a.f()}return e.simplifyStates(i)}},{key:"updateStateForChar",value:function(e,t,n){for(var r=255&this.text[t],i=ur[e.getMode()][r]>0,a=null,o=0;o<=nr;o++){var s=ur[o][r];if(s>0){if(null==a&&(a=e.endBinaryShift(t)),!i||o===e.getMode()||o===er){var l=a.latchAndAppend(o,s);n.push(l)}if(!i&&or[e.getMode()][o]>=0){var u=a.shiftAndAppend(o,s);n.push(u)}}}if(e.getBinaryShiftByteCount()>0||0===ur[e.getMode()][r]){var c=e.addBinaryShiftChar(t);n.push(c)}}}],[{key:"updateStateListForPair",value:function(e,t,n){var r,i=[],a=l(e);try{for(a.s();!(r=a.n()).done;){var o=r.value;this.updateStateForPair(o,t,n,i)}}catch(s){a.e(s)}finally{a.f()}return this.simplifyStates(i)}},{key:"updateStateForPair",value:function(e,t,n,r){var i=e.endBinaryShift(t);if(r.push(i.latchAndAppend(nr,n)),e.getMode()!==nr&&r.push(i.shiftAndAppend(nr,n)),3===n||4===n){var a=i.latchAndAppend(er,16-n).latchAndAppend(er,1);r.push(a)}if(e.getBinaryShiftByteCount()>0){var o=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(o)}}},{key:"simplifyStates",value:function(e){var t,n=[],r=l(e);try{for(r.s();!(t=r.n()).done;){var i,a=t.value,o=!0,s=l(n);try{var u=function(){var e=i.value;if(e.isBetterThanOrEqualTo(a))return o=!1,"break";a.isBetterThanOrEqualTo(e)&&(n=n.filter((function(t){return t!==e})))};for(s.s();!(i=s.n()).done&&"break"!==u(););}catch(c){s.e(c)}finally{s.f()}o&&n.push(a)}}catch(c){r.e(c)}finally{r.f()}return n}}]),e}(),dr=function(){function e(){u(this,e)}return c(e,null,[{key:"encodeBytes",value:function(t){return e.encode(t,e.DEFAULT_EC_PERCENT,e.DEFAULT_AZTEC_LAYERS)}},{key:"encode",value:function(t,n,r){var i,a,o,s,l,u=new cr(t).encode(),c=_.truncDivision(u.getSize()*n,100)+11,d=u.getSize()+c;if(r!==e.DEFAULT_AZTEC_LAYERS){if(i=r<0,(a=Math.abs(r))>(i?e.MAX_NB_BITS_COMPACT:e.MAX_NB_BITS))throw new y(x.format("Illegal value %s for layers",r));var f=(o=e.totalBitsInLayer(a,i))-o%(s=e.WORD_SIZE[a]);if((l=e.stuffBits(u,s)).getSize()+c>f)throw new y("Data to large for user specified layer");if(i&&l.getSize()>64*s)throw new y("Data to large for user specified layer")}else{s=0,l=null;for(var h=0;;h++){if(h>e.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(a=(i=h<=3)?h+1:h,!(d>(o=e.totalBitsInLayer(a,i)))){null!=l&&s===e.WORD_SIZE[a]||(s=e.WORD_SIZE[a],l=e.stuffBits(u,s));var v=o-o%s;if(!(i&&l.getSize()>64*s)&&l.getSize()+c<=v)break}}}var p,g=e.generateCheckWords(l,o,s),m=l.getSize()/s,w=e.generateModeMessage(i,a,m),E=(i?11:14)+4*a,C=new Int32Array(E);if(i){p=E;for(var S=0;S=r||e.get(a+s))&&(o|=1<