@scandit/web-datacapture-barcode 7.4.1 → 7.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/js/ar/BarcodeAr.js +1 -1
- package/build/js/ar/BarcodeArFeedback.js +1 -1
- package/build/js/ar/BarcodeArPresenter.js +1 -1
- package/build/js/ar/BarcodeArView.js +1 -1
- package/build/js/ar/ui/atoms/private/BarcodeStatusIconContainer.d.ts +4 -3
- package/build/js/ar/ui/atoms/private/BarcodeStatusIconContainer.js +1 -1
- package/build/js/ar/ui/organisms/BarcodeArStatusIconAnnotation.d.ts +5 -0
- package/build/js/ar/ui/organisms/BarcodeArStatusIconAnnotation.js +1 -1
- package/build/js/chunks/chunk-2LC75X3X.js +1 -0
- package/build/js/chunks/{chunk-IRK7SW2B.js → chunk-3W2UC3XN.js} +1 -1
- package/build/js/chunks/{chunk-WRSF34UR.js → chunk-A7NVYG6G.js} +1 -1
- package/build/js/chunks/chunk-BZWA4BPU.js +7 -0
- package/build/js/chunks/{chunk-RDEBUZMC.js → chunk-DG6LWSW5.js} +1 -1
- package/build/js/chunks/{chunk-BSEQX52V.js → chunk-EJ325HH2.js} +1 -1
- package/build/js/chunks/{chunk-FLVXOM3V.js → chunk-FNIEXTQS.js} +1 -1
- package/build/js/chunks/{chunk-TBEB6P5W.js → chunk-HW5KYM65.js} +1 -1
- package/build/js/chunks/{chunk-D55IVUHN.js → chunk-ISBINAYU.js} +1 -1
- package/build/js/chunks/chunk-ML3SWBJA.js +1 -0
- package/build/js/chunks/{chunk-Z5XSYMXM.js → chunk-WX5YVCZZ.js} +1 -1
- package/build/js/chunks/{chunk-KLLRZ5ML.js → chunk-ZESIYXER.js} +1 -1
- package/build/js/index.js +1 -1
- package/build/js/moduleLoader.js +1 -1
- package/build/js/spark/index.js +1 -1
- package/build/js/spark/ui/SparkScanView.js +1 -1
- package/build/js/spark/ui/SparkScanViewPresenter.js +1 -1
- package/build/js/spark/ui/index.js +1 -1
- package/build/js/worker/BarcodeCaptureWorkerManager.js +1 -1
- package/build/js/worker/WorkerMain.js +1 -1
- package/build/js/worker/barcodeCapture.inlineWorker.js +1 -1
- package/build/js/worker/dataCaptureEngine.js +1 -1
- package/package.json +2 -2
- package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.js +1 -1
- package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.wasm +0 -0
- package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.js +1 -1
- package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.wasm +0 -0
- package/sdc-lib/scandit-datacapture-sdk-barcode-simd.js +1 -1
- package/sdc-lib/scandit-datacapture-sdk-barcode-simd.wasm +0 -0
- package/sdc-lib/scandit-datacapture-sdk-barcode.js +1 -1
- package/sdc-lib/scandit-datacapture-sdk-barcode.wasm +0 -0
- package/build/js/chunks/chunk-A2BKX6QD.js +0 -1
- package/build/js/chunks/chunk-ICRLCCOF.js +0 -1
- package/build/js/chunks/chunk-XUOTM7YW.js +0 -7
- /package/build/js/chunks/{chunk-3MQAMNCQ.js → chunk-5T3ORYHD.js} +0 -0
package/build/js/ar/BarcodeAr.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as BarcodeAr}from'../chunks/chunk-
|
|
1
|
+
export{a as BarcodeAr}from'../chunks/chunk-WX5YVCZZ.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as BarcodeArFeedback}from'../chunks/chunk-
|
|
1
|
+
export{a as BarcodeArFeedback}from'../chunks/chunk-5T3ORYHD.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as BarcodeArPresenter}from'../chunks/chunk-
|
|
1
|
+
export{a as BarcodeArPresenter}from'../chunks/chunk-HW5KYM65.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as BarcodeArView}from'../chunks/chunk-
|
|
1
|
+
export{a as BarcodeArView}from'../chunks/chunk-EJ325HH2.js';
|
|
@@ -6,7 +6,6 @@ declare class BarcodeStatusIconContainer extends ScanditHTMLElement {
|
|
|
6
6
|
private static readonly observedAttributes;
|
|
7
7
|
private containerElement;
|
|
8
8
|
private textContainer;
|
|
9
|
-
private onToggleListener;
|
|
10
9
|
constructor();
|
|
11
10
|
set text(name: string);
|
|
12
11
|
get text(): string;
|
|
@@ -14,12 +13,14 @@ declare class BarcodeStatusIconContainer extends ScanditHTMLElement {
|
|
|
14
13
|
get tip(): boolean;
|
|
15
14
|
set textColor(color: Color);
|
|
16
15
|
get textColor(): Color;
|
|
16
|
+
set expanded(value: boolean);
|
|
17
|
+
set backgroundColor(color: Color);
|
|
18
|
+
get backgroundColor(): Color;
|
|
19
|
+
get expanded(): boolean;
|
|
17
20
|
static create(): BarcodeStatusIconContainer;
|
|
18
21
|
static register(): void;
|
|
19
22
|
private static createStyleElement;
|
|
20
|
-
onToggle(): void;
|
|
21
23
|
connectedCallback(): void;
|
|
22
|
-
disconnectedCallback(): void;
|
|
23
24
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
24
25
|
private updateText;
|
|
25
26
|
private toggleTip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as BarcodeStatusIconContainer}from'../../../../chunks/chunk-
|
|
1
|
+
export{a as BarcodeStatusIconContainer}from'../../../../chunks/chunk-BZWA4BPU.js';
|
|
@@ -17,7 +17,10 @@ declare class BarcodeArStatusIconAnnotation extends ScanditHTMLElement implement
|
|
|
17
17
|
annotationTrigger: BarcodeArAnnotationTrigger;
|
|
18
18
|
anchor: BarcodeArStatusIconAnnotationAnchor;
|
|
19
19
|
private readonly statusIconContainer;
|
|
20
|
+
private onToggleListener;
|
|
20
21
|
private _barcode;
|
|
22
|
+
private _backgroundColor;
|
|
23
|
+
private _icon;
|
|
21
24
|
constructor();
|
|
22
25
|
get barcode(): Barcode;
|
|
23
26
|
protected set barcode(barcode: Barcode);
|
|
@@ -34,6 +37,8 @@ declare class BarcodeArStatusIconAnnotation extends ScanditHTMLElement implement
|
|
|
34
37
|
static create(barcode: Barcode): BarcodeArStatusIconAnnotation;
|
|
35
38
|
private static register;
|
|
36
39
|
connectedCallback(): Promise<void>;
|
|
40
|
+
disconnectedCallback(): void;
|
|
41
|
+
private onToggle;
|
|
37
42
|
updatePosition(point: Point, transformOrigin: Point, rotationAngle: number): void;
|
|
38
43
|
}
|
|
39
44
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as BarcodeArStatusIconAnnotation,a as BarcodeArStatusIconAnnotationAnchor}from'../../../chunks/chunk-
|
|
1
|
+
export{b as BarcodeArStatusIconAnnotation,a as BarcodeArStatusIconAnnotationAnchor}from'../../../chunks/chunk-ML3SWBJA.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s={"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:6887267},"scandit-datacapture-sdk-barcode.wasm":{bytes:6852186},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:6765147},"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:6973788}};export{s as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {DataCaptureLoader,Logger}from'@scandit/web-datacapture-core';function n(r){let s=URL.createObjectURL(new Blob(['"use strict";(()=>{var p={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:6974649},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:6765986},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:6888105},"scandit-datacapture-sdk-barcode.wasm":{bytes:6853002}};function F(t){return typeof t=="object"&&t!=null}function C(t){if(typeof t=="string")return t;if(F(t)){if(typeof t.message=="string")return t.message}else if(typeof t?.toString=="function")return t.toString();return"unknown error"}var l;(t=>{(c=>(c.Debug="debug",c.Info="info",c.Warn="warn",c.Error="error",c.Quiet="quiet"))(t.Level||(t.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),r="debug";function a(c){r=c}t.setLevel=a;function s(c,...h){if(!(e.get(r)>e.get(c)))switch(c){case"debug":{console.debug(...h);break}case"info":{console.log(...h);break}case"warn":{console.warn(...h);break}case"error":{console.error(...h);break}}}t.log=s;function i(...c){s("warn",...c)}t.warn=i;function n(...c){s("debug",...c)}t.debug=n;function o(...c){s("info",...c)}t.info=o;function d(...c){s("error",...c)}t.error=d})(l||(l={}));var B=class re extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,re.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var P=Promise.resolve(),G=!1,$=!1,k,j={writableDataPath:""};async function ae(t){if(k==null)return;G=!0;let e=new Promise((r,a)=>{setTimeout(()=>{a(new B({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},1500)});try{await Promise.race([new Promise((r,a)=>{k?.(t,s=>{if(s!=null){a(s);return}r()})}),e])}finally{G=!1}}async function se(t){return $||(G?($=!0,P=P.then(async()=>($=!1,ae(t)))):P=ae(t)),P}async function ie(t){j=t,k=FS.syncfs,FS.syncfs=(e,r)=>{let a=r,s=()=>{a()},i=n=>{a(n)};se(e).then(s).catch(i)};try{FS.mkdir(j.writableDataPath)}catch(e){if(e.code!=="EEXIST")throw k=void 0,e}return FS.mount(IDBFS,{},j.writableDataPath),se(!0)}var q=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t);var K=function(t,e){this[0]=t,this[1]=e},ne=(t,e,r)=>{var a=(n,o,d,c)=>{try{var h=r[n](o),m=(o=h.value)instanceof K,g=h.done;Promise.resolve(m?o[0]:o).then(b=>m?a(n==="return"?n:"next",o[1]?{done:b.done,value:b.value}:b,d,c):d({value:b,done:g})).catch(b=>a("throw",b,d,c))}catch(b){c(b)}},s=n=>i[n]=o=>new Promise((d,c)=>a(n,o,d,c)),i={};return r=r.apply(t,e),i[q("asyncIterator")]=()=>i,s("next"),s("throw"),s("return"),i},oe=(t,e,r)=>(e=t[q("asyncIterator")])?e.call(t):(t=t[q("iterator")](),e={},r=(a,s)=>(s=t[a])&&(e[a]=i=>new Promise((n,o,d)=>(i=s.call(t,i),d=i.done,Promise.resolve(i.value).then(c=>n({value:c,done:d}),o)))),r("next"),r("return"),e);var de={};function Le(t){return[...new Uint8Array(t)].map(e=>{let r=e.toString(16);return r.length===1?`0${r}`:r}).join("")}function Te(t){return ne(this,null,function*(){let e=t.getReader();try{for(;;){let{done:r,value:a}=yield new K(e.read());if(r)return;yield a}}finally{e.releaseLock()}})}async function We(t){let e=[],r=0,a=0;try{for(var s=oe(Te(t)),i,n,o;i=!(n=await s.next()).done;i=!1){let c=n.value;e.push(c),r+=c.length}}catch(c){o=[c]}finally{try{i&&(n=s.return)&&await n.call(s)}finally{if(o)throw o[0]}}let d=new Uint8Array(r);for(let c of e)d.set(c,a),a+=c.length;return d.buffer}var Ee=(t=>(t.VALID="VALID",t.INVALID="INVALID",t.NOT_VERIFIABLE="NOT_VERIFIABLE",t))(Ee||{});async function Re(t,e,r){if(typeof crypto.subtle.digest!="function")return l.log(l.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${r} could not be verified`),"NOT_VERIFIABLE";try{let a=t instanceof Promise?await t:t,s=await crypto.subtle.digest("SHA-256",a),i=Le(s);return e==null?(l.log(l.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):i===e?(l.log(l.Level.Debug,`Data Capture library WASM integrity found at ${r} has been verified correctly.`),"VALID"):(l.log(l.Level.Warn,`The Scandit Data Capture library WASM file found at ${r} seems invalid: expected file hash doesn\'t match (received: ${i}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),"INVALID")}catch(a){return l.log(l.Level.Warn,"Wasm response could not be verified",a),"NOT_VERIFIABLE"}}var X=new Map([["br",4.4],["gzip",2.9],["none",1]]);function Ne(t){var e;let r="content-encoding";if(t==null||t.get(r)==null)return X.get("none");let a=new Set(((e=t.get(r))!=null?e:"").split(",").map(s=>s.trim()));for(let[s,i]of X)if(a.has(s))return i;return X.get("none")}function He(t){var e,r;if(t==null)return 0;let a=(e=Ne(t))!=null?e:1,s=Number.parseInt((r=t.get("content-length"))!=null?r:"0",10);return Number.isNaN(s)?0:Math.floor(s*a*100)/100}function _e(t){let{pathname:e}=new URL(t);for(let[r,a]of Object.entries(de))if(e.endsWith(r))return a.bytes;return 0}function ce(t){de=t}var ze=(t,e)=>{let r=He(e);return r===0?_e(t):r};function Ve(t,e,r,{onProgress:a,onError:s,onComplete:i}){if(!e.body)return[e];let n=ze(t,e.headers),o=0,d=0,[c,h]=r?e.body.tee():[e.body],m=c.pipeThrough(new TransformStream({async transform(g,b){try{o+=g.length,d=Number((o/n*100).toFixed(2)),n>0&&g.length>0&&d<100?a?.({percentage:d,loadedBytes:o,privateUri:t}):n===0&&g.length>0&&a?.({percentage:null,loadedBytes:o,privateUri:t}),b.enqueue(g)}catch(v){b.error(v),s?.({error:v})}},flush(g){a?.({percentage:100,loadedBytes:o,privateUri:t}),i?.({percentage:100,loadedBytes:o,privateUri:t}),g.terminate()}}));return[new Response(m,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),h]}async function Y({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,onComplete:s,onError:i,referredOrigin:n}){let o=await fetch(t,{referrerPolicy:"origin",referrer:n??""});if(!o.ok)throw new Error(`HTTP status code is not ok: ${o.status}, ${o.statusText}`);let[d,c]=Ve(t,o,r,{onProgress:a,onError:i,onComplete:s});return c!=null&&Re(We(c),e,t),d}function le({wasmURI:t,expectedHash:e,verifyResponseHash:r,progressCallback:a,successCallback:s,errorCallback:i,importObject:n,referredOrigin:o}){async function d(h){try{let m=await Y({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:o}),g=await(h??m).arrayBuffer(),b=await globalThis.WebAssembly.instantiate(g,n);s(b.instance,b.module)}catch(m){l.log(l.Level.Error,m),l.log(l.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${t}, did you configure the path for it correctly?`),i?.(m)}}async function c(){let h;try{h=await Y({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:o});let m=await globalThis.WebAssembly.instantiateStreaming(h,n);s(m.instance,m.module)}catch(m){l.log(l.Level.Warn,m),l.log(l.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),d(h?.bodyUsed===!0?void 0:h)}}typeof globalThis.WebAssembly.instantiateStreaming=="function"?c():d()}async function Z(t,e,r,a){return new Promise((s,i)=>{t().then(s).catch(n=>{let o=e*2;if(o>r){i(n);return}a(n),globalThis.setTimeout(()=>{Z(t,o,r,a).then(s).catch(i)},e)})})}function Q(t){var e,r;let a="unknown";if((e=t.href)!=null&&e.startsWith("blob:null/"))a="localhost";else{let s=((r=t.pathname)==null?void 0:r.length)>1&&!t.pathname.startsWith("/");a=new URL(s?t.pathname:t.origin).hostname}return a.startsWith("[")&&a.endsWith("]")?(a=a.slice(1,-1),a):(/^(\\d{1,3}\\.){3}\\d{1,3}$/.test(a)&&(a=a.split(".").map(s=>Number.parseInt(s,10).toString()).join(".")),a)}async function ue(t,e){async function r(){return importScripts(t)}try{await Z(r,250,4e3,s=>{l.log(l.Level.Warn,s),l.log(l.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${t}, retrying...`)}),self.Module.mainScriptUrlOrBlob=t;let a=globalThis.SDC_WASM_JS_VERSION;return a!==e&&l.log(l.Level.Warn,`The Scandit Data Capture library JS file found at ${t} seems invalid: expected version doesn\'t match (received: ${a}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(a){return l.log(l.Level.Error,a),!1}}function Je(t){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(t)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(t)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function Ue(t){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(t);return e?e[0]:null}function pe(t,e,r){let a=e,s=Je(a);if(s.result){let n=Ue(a);n!=null&&(a=`${s.cdnBaseURL}${n}@${t}/sdc-lib/`)}let i=r.replace(".wasm","");return s.result?{jsURI:`${a}${i}.js`,wasmURI:`${a}${i}.wasm`}:{jsURI:`${a}${i}.js?v=${t}`,wasmURI:`${a}${i}.wasm?v=${t}`}}var I;(t=>{function e(){return"7.4.1"}t.sdkVersion=e})(I||(I={}));var he=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};var $e=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),je=()=>(async t=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(t)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));function Ge(){return typeof crossOriginIsolated>"u"?!1:crossOriginIsolated}function qe(){try{return new WebAssembly.Memory({initial:1,maximum:1,shared:!0}).buffer.constructor.name==="SharedArrayBuffer"}catch{return!1}}async function me(){return $e()}async function Ke(){if(!await je())return!1;let t=null;try{t=new Worker(URL.createObjectURL(new Blob([\'postMessage("Worker" in self);\'],{type:"text/javascript"})),{name:"nestedWorkerTest"})}catch{return!1}return new Promise(e=>{if(t==null){e(!1);return}t.onmessage=r=>{t?.terminate(),e(r.data)}})}async function be(){let t=await Ke();return Ge()&&qe()&&t}var ge=class fe{constructor(e,r){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameCounter=-1,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.performanceMetrics={frameDataPoolSize:0,processedFramesCount:0,redrawRequestsCount:0,actualRedrawsCount:0},this.gestureListener=null,this.webPlatformHintPresenter=null,this.moduleHandler=e,this.workerFunctions=r,this._loadProgressCallback=this._loadProgressCallback.bind(this),ce(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}convertToLoadableFrameData(e){let r=this.getNextFrameId();this.frameDataPool.set(r,new Uint8ClampedArray(e.getFrameData()));let a=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:r,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:a}}createContext(e){var r,a,s,i,n;let o=this.getModeDeserializers(),d=Q(location);(d==="localhost"||d==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(d+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,d,this.parentDomain,o,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let c=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(c==null){let u=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${u}`)}let h=c.getView();this.context=c.getContext(),c.delete();let m=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(u,f)=>{this.contextDidChangeStatus(JSON.parse(f.toJson())),u.delete()},didStartObservingContext:u=>{this.didStartObservingContext(),u.delete()},didStopObservingContext:u=>{u.delete()}}),g=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:u=>{u.delete()},onObservationStopped:u=>{u.delete()},onFrameProcessingStarted:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),f.delete(),u.delete()},onFrameProcessingFinished:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),f.delete(),u.delete()},onFrameSkipped:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),f.delete(),u.delete()}}),b=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(u,f)=>{var O;(O=this.gestureListener)==null||O.delete(),this.gestureListener=u.clone(),u.delete()}});(r=this.gestureRecognizer)==null||r.delete(),this.gestureRecognizer=new b;let v=new m;this.context.addListener(v),v.delete();let w=new g;this.context.addFrameListener(w),w.delete(),this.setView(h),(a=this.view)==null||a.setGestureRecognizer(this.gestureRecognizer);let M=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:u=>{u.delete()},showToast:u=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(u)})},hideToast:u=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(u)})},showGuidance:u=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(u)})},hideGuidance:u=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(u)})},startUpdateTimer:u=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:u}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(s=this.hintPresenterV2)==null||s.delete(),(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=new M,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(n=this.view)==null||n.setHintPresenterV2(this.hintPresenterV2))}onTap(e){var r;(r=this.gestureListener)==null||r.onTap(JSON.stringify(e))}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update()}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.performanceMetricsReporterTimer=setInterval(()=>{this.reportPerformanceMetrics();for(let e of Object.keys(this.performanceMetrics))this.performanceMetrics[e]=0},1e3))}async reportPerformanceMetrics(){this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:{...this.performanceMetrics}})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,r;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.lastFrameCounter=-1,(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(r=this.gestureListener)==null||r.delete(),this.gestureListener=null}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[fe.get3dPartyLicenseKeyMethodName](e)}}}}getModeDeserializers(){return new this.Module.VectorDataCaptureModeDeserializer}loadLibrary(e){return this.libraryLoadingPromise!=null?this.libraryLoadingPromise:(this.libraryLoadingPromise=this.setup(e),this.libraryLoadingPromise)}processFrame(e){var r;if(this.context==null)return{payload:e,transferables:[e.data.buffer]};let a=e.data,s=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888,i=this.Module.allocateUint8Array(a.byteLength);return this.Module.HEAPU8.set(a,i),(r=this.imageFrameSource)==null||r.outputFrame(i,e.width,e.height,s),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){let r=this.frameDataPool.get(e);return r==null?{payload:{data:null}}:{payload:{data:r},transferables:[r.buffer]}}scheduleRedraw(e,r){this.addRedrawRequest(r),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,r){var a;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(a=this.imageFrameSource)==null||a.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,r,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let r=i=>this.redrawRequests.length>0&&this.redrawRequests[0]<=i,a=i=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=i;)this.redrawRequests.shift()},s=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let i=performance.now();if(r(i)){a(i),e.draw();let n=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(n))}s()},this.redrawInterval)};s()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let r=this.onBeforeUpdateContextHook(e),a=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(r.context));if(a==null){let i=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${i}`)}this.context.delete(),this.context=a.getContext();let s=a.getView();a.delete(),s!=null&&r.view!=null&&s.setViewSize(r.view.width,r.view.height,r.view.orientation),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),s!=null&&this.hintPresenterV2&&s.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&s?.setGestureRecognizer(this.gestureRecognizer),this.setView(s),l.debug("context updated",r)}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,r;return{payload:{isDisplayingViewfinder:(r=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?r:!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getNextFrameId(){return this.lastFrameCounter++,this.lastFrameCounter>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL&&(this.lastFrameCounter=0),this.lastFrameCounter}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,r){return r?e?"39b24d078c4d64f1ec024062a5e35f26c234aae04bca13a8aa71dadf45656422":"4f505230e143f0b1a2d38ed3975ab4f7742d08aa9e09d6c9bc364ad257e232d6":e?"b055d9be8c819e7e81a1697e15f91306afa61e4f51c2caef58517588b97d9724":""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":""}getWasmMetadata(){return p}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((r,a)=>r-a)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${Q(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){l.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){l.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let r=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),a=new r;e.setNeedsRedrawDelegate(a),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),r=e.DataDecoding.extend("DataDecoding",{decode(a,s){try{let i=JSON.parse(s),n=[];for(let o of i){let d=new TextDecoder(o.ianaName,{fatal:!0});n.push(d.decode(a.slice(o.startIndex,o.endIndex)))}return n.join("")}catch{return""}}});e.setDataDecoding(new r)}start(e,r,a){e&&r&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||a())}getWritableDataPath(e){return e!=null?(l.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:r,writableDataPathOverride:a,overrideThreadsSupport:s,overrideSimdSupport:i,verifyResponseHash:n,referredOrigin:o,fixedWasmMemory:d}){var c;let h=!1,m=!1;this.writableDataPath=this.getWritableDataPath(a),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,globalThis.path=r;let{resolve:g,reject:b,promise:v}=new he,w=I.sdkVersion();if(w==="")throw new B({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[M,u]=await Promise.all([me(),be()]);s!=="auto"&&(u=s==="on"),i!=="auto"&&(M=i==="on");let f=this.getWasmCoreFileName(M,u),O=pe(w,e,f),{jsURI:U,wasmURI:te}=O,Ae={instantiateWasm:(S,Be)=>(le({importObject:S,wasmURI:te,expectedHash:this.getWasmCoreExpectedHash(M,u),verifyResponseHash:n,successCallback:Be,progressCallback:this._loadProgressCallback,errorCallback:Pe=>{b(Pe)},referredOrigin:o}),{})},A=d===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(d),maximum:this.numOfMBToPages(300),shared:u});return A!==null&&l.log(l.Level.Debug,"Fixed wasmMemory set",A),this.moduleHandler.set({...A?{wasmMemory:A}:{},mainScriptUrlOrBlob:U,canvas:(c=this.workerFunctions.getOffscreenCanvas())!=null?c:{getContext:()=>null},...Ae,dynamicLibraries:this.getWasmDynamicLibraries(te),locateFile:S=>e+S,noInitialRun:!0,preRun:[async()=>{try{await ie({writableDataPath:this.writableDataPath})}catch(S){if(S.name==="BlockedIndexedDB"){b(S.toString());return}l.log(l.Level.Debug,"No IndexedDB support, some data will not be persisted:",S)}m=!0,this.start(m,h,g)}],onMainComplete:()=>{if([h,m].includes(!1)){l.log(l.Level.Warn,{runtimeLoaded:h,fileSystemSynced:m},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),b("onMainComplete has been called but runtime or file system was not ready.");return}g()},onRuntimeInitialized:()=>{h=!0,this.start(m,h,g)},print:S=>{l.log(l.Level.Info,S)}}),await ue(U,w)||b(`Couldn\'t retrieve Scandit Data Capture library at ${U}, did you configure the path for it correctly?`),v}};ge.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var D=ge;function ye(t){return typeof t=="object"&&t!=null&&t.document==null&&"addEventListener"in t&&typeof t.importScripts=="function"}function Se(t){console.warn("Reached unexpected case",t)}var ee=class{constructor(t,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=t,this.dataCaptureInstance=new D(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),ye(t)&&this.listenToMessages()}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",t=>{l.log(l.Level.Error,t)}),this.workerSelf.addEventListener("messageerror",t=>{l.log(l.Level.Error,t)})}postMessage(t,e){this.workerSelf.postMessage(t,e??[])}getOffscreenCanvas(){if(typeof this.workerSelf.OffscreenCanvas=="function")return new this.workerSelf.OffscreenCanvas(32,32)}hasPayload(t){return F(t)&&"payload"in t}hasTransferables(t){return F(t)&&Array.isArray(t.transferables)}async respondWith(t,e,r){let a=null,s;try{s=r(),s instanceof Promise&&(s=await s)}catch(n){s=void 0,a=C(n)}let i={type:"workerTaskId",command:t,id:e,payload:this.hasPayload(s)?s.payload:void 0};a!=null&&(i.error=a),this.postMessage(i,this.hasTransferables(s)?s.transferables:[])}onMessage(t){switch(t.data.command){case"loadLibrary":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.loadLibrary({libraryLocation:e.libraryLocation,locationPath:e.locationPath,referredOrigin:e.referredOrigin,writableDataPathOverride:e.writableDataPathOverride,overrideThreadsSupport:e.overrideThreadsSupport,overrideSimdSupport:e.overrideSimdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory}))}break}case"onTap":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(t.data.command,t.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{l.setLevel(e.level)})}break}case"extractCentaurusLicense":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey))}break}case"documentVisibility":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state)})}break}case"isFeatureSupported":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature))}break}case"getViewfinderInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break}case"getOpenSourceSoftwareLicenseInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break}case"addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(t);break;case"removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(t);break;default:return Se(t.data),!1}return!0}};var ve=(t=>(t.Body="body",t.Footnote="footnote",t))(ve||{}),L=(t=>(t.Start="start",t.Center="center",t.End="end",t))(L||{}),we=(t=>(t.Normal="normal",t.Wider="wider",t.FitText="fitText",t))(we||{}),Me=(t=>(t.Normal="normal",t.Taller="taller",t))(Me||{}),Fe=(t=>(t.Square="square",t.Rounded="rounded",t))(Fe||{}),T=(t=>(t.None="none",t.Check="check",t.ExclamationMark="exclamationMark",t))(T||{}),W=(t=>(t.Top="top",t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(W||{}),Ce=(t=>(t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(Ce||{}),ke=(t=>(t.BlackOnWhite="blackOnWhite",t.WhiteOnBlack="whiteOnBlack",t.Transparent="transparent",t))(ke||{}),x=(t=>(t.Success="success",t.Error="error",t.Warning="warning",t.Info="info",t.Notification="notification",t))(x||{}),De=(t=>(t[t.Ocr=0]="Ocr",t[t.HideLogo=1]="HideLogo",t[t.ShowTestLicenseMessage=2]="ShowTestLicenseMessage",t[t.AugmentedReality=5]="AugmentedReality",t[t.ActivityPingStatsAddon=8]="ActivityPingStatsAddon",t[t.ActivityPing=9]="ActivityPing",t[t.Registration=10]="Registration",t[t.Parser=11]="Parser",t[t.BarcodeCapture=14]="BarcodeCapture",t[t.Analytics=17]="Analytics",t[t.AnalyticsBatchMode=18]="AnalyticsBatchMode",t[t.AnalyticsScanContent=19]="AnalyticsScanContent",t[t.AnalyticsOnlineVerification=20]="AnalyticsOnlineVerification",t[t.SparkScan=21]="SparkScan",t[t.AamvaIdBarcodeVerification=22]="AamvaIdBarcodeVerification",t[t.MappingForTracking=23]="MappingForTracking",t[t.BarcodeFind=24]="BarcodeFind",t[t.MandatoryRegistration=25]="MandatoryRegistration",t[t.FeatureTracking=26]="FeatureTracking",t[t.IdCaptureViz=27]="IdCaptureViz",t[t.IdCaptureMrz=28]="IdCaptureMrz",t[t.IdCaptureBarcode=29]="IdCaptureBarcode",t[t.BarcodeSelectionAimToScan=30]="BarcodeSelectionAimToScan",t[t.BarcodeSelectionTapToScan=31]="BarcodeSelectionTapToScan",t[t.BarcodeCount=32]="BarcodeCount",t[t.BarcodePick=33]="BarcodePick",t[t.IdVerificationDataComparison=34]="IdVerificationDataComparison",t[t.SmartLabelBarcode=35]="SmartLabelBarcode",t[t.SmartLabelText=36]="SmartLabelText",t[t.VoidedIdDetection=37]="VoidedIdDetection",t[t.BarcodeArFull=38]="BarcodeArFull",t))(De||{});var E=class{constructor(e,r,a){this.barcodeAr=null;this.coreEngine=e,this.Module=r,this.workerFunctions=a}async forSettings(e){this.barcodeAr?.delete(),this.barcodeAr=new this.Module.BarcodeAr(this.coreEngine.context,JSON.stringify(e));let r=this.Module.BarcodeArListener.extend("BarcodeArListener",{didUpdateSession:(a,s,i)=>{let n=this.coreEngine.convertToLoadableFrameData(i);this.workerFunctions.postMessage({type:"barcodeArDidUpdateSession",payload:{session:JSON.parse(s.toJson()),frameData:n}}),a.delete(),s.delete(),i.delete()}});this.barcodeAr.addListener(new r,1),this.Module.addBarcodeArToContext(this.coreEngine.context,this.barcodeAr)}start(){this.barcodeAr?.start()}pause(){this.barcodeAr?.pause()}stop(){this.barcodeAr?.stop()}setEnabled(e){this.barcodeAr?.setEnabled(e)}async removeMode(){this.barcodeAr!=null&&this.Module.removeBarcodeArFromContext(this.coreEngine.context,this.barcodeAr)}applySettings(e){this.barcodeAr?.applySettings(JSON.stringify(e))}};var R=class{constructor(e,r,a){this.trackingListenerSet=!1;this.coreEngine=e,this.Module=r,this.workerFunctions=a,this.setup()}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getBatchDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeBatchListener.extend("BarcodeTrackingListener",{didUpdateSession:(a,s,i)=>{this.barcodeBatchDidUpdateSession(s),a.delete(),s.delete(),i.delete()},onTrackedBarcodeTapped:(a,s)=>{this.onTrackedBarcodeTapped(s),a.delete(),s.delete()}}),r=this.Module.BarcodeBatchDeserializerListener.extend("BarcodeTrackingDeserializerListener",{onModeDeserializationFinished:(a,s,i)=>{this.trackingListenerSet||(s.addListener(new e,1),this.trackingListenerSet=!0),a.delete(),s.delete(),i.delete()},onModeDeserializationStarted(a,s,i){a.delete(),s.delete(),i.delete()},onSettingsDeserializationStarted(a,s,i){a.delete(),s.delete(),i.delete()},onSettingsDeserializationFinished(a,s,i){a.delete(),s.delete(),i.delete()}});this.barcodeBatchDeserializer=new this.Module.BarcodeBatchDeserializer,this.barcodeBatchDeserializer.setListener(new r)}onTrackedBarcodeTapped(e){this.workerFunctions.postMessage({type:"didTapTrackedBarcode",payload:JSON.parse(e.toJson())})}};var N=class{constructor(e,r,a){this.captureListenerSet=!1;this.coreEngine=e,this.Module=r,this.workerFunctions=a,this.setup()}barcodeCaptureDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeCaptureDidUpdateSession",payload:JSON.parse(e.toJson())})}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getCaptureDeserializer(){return this.barcodeCaptureDeserializer}getTrackingDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeCaptureListener.extend("BarcodeCaptureListener",{didScan:(n,o,d)=>{this.barcodeCaptureDidScan(o,d),n.delete(),d.delete(),o.delete()},didUpdateSession:(n,o,d)=>{this.barcodeCaptureDidUpdateSession(o),n.delete(),d.delete(),o.delete()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=new e,s=new r,i=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(n,o,d)=>{o.addListener(a,1),o.setSuccessFeedback(s),n.delete(),o.delete(),d.delete()},onModeDeserializationStarted(n,o,d){n.delete(),o.delete(),d.delete()},onSettingsDeserializationStarted(n,o,d){n.delete(),o.delete(),d.delete()},onSettingsDeserializationFinished(n,o,d){n.delete(),o.delete(),d.delete()}});this.barcodeCaptureDeserializer=new this.Module.BarcodeCaptureDeserializer,this.barcodeCaptureDeserializer.setListener(new i)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}barcodeCaptureDidScan(e,r){let a=this.coreEngine.convertToLoadableFrameData(r);this.workerFunctions.postMessage({type:"barcodeCaptureDidScan",payload:{session:JSON.parse(e.toJson()),frameData:a}})}};function Xe(t){return t.charAt(0).toUpperCase()+t.slice(1)}function xe(t){return t}var H=class{constructor(e,r,a){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:L.Center,hintIcon:T.None,hintAnchor:W.AboveViewFinder,hintAnchorOffset:-12,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=xe;this.coreEngine=e,this.Module=r,this.workerFunctions=a}async forSettings(e){this.barcodeFind?.delete(),this.barcodeFind=new this.Module.BarcodeFind(this.coreEngine.context,JSON.stringify(e));let r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.listUpdatedFeedback()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.barcodeFindFeedback()}}),s=this.Module.BarcodeFindTransformer.extend("BarcodeFindTransformer",{transformBarcodeData:n=>this.customerTransformation(n)}),i=this.Module.BarcodeFindListener.extend("BarcodeFindListener",{didUpdateSession:(n,o,d)=>{let c=this.coreEngine.convertToLoadableFrameData(d);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(o.toJson()),frameData:c}}),n.delete(),o.delete(),d.delete()},onSearchPaused:n=>{let o=[];for(let d=0;d<n.size();d++)o.push(n.get(d));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:o}})},onSearchStopped:n=>{let o=[];for(let d=0;d<n.size();d++)o.push(n.get(d));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:o}})},onSearchStarted:()=>{this.workerFunctions.postMessage({type:"barcodeFindSearchStarted",payload:{}})}});this.barcodeFind.setBarcodeFindTransformer(new s),this.barcodeFind.addListener(new i,1),this.barcodeFind.setItemListUpdatedFeedback(new r),this.barcodeFind.setFeedback(new a),this.Module.addBarcodeFindToContext(this.coreEngine.context,this.barcodeFind)}barcodeFindFeedback(){this.workerFunctions.postMessage({type:"barcodeFindFeedback",payload:{}})}start(){this.barcodeFind?.start()}stop(){this.barcodeFind?.stop()}pause(){this.barcodeFind?.pause()}setEnabled(e){this.barcodeFind?.setEnabled(e)}setItemList(e){this.barcodeFind?.setItemList(JSON.stringify(e))}async removeMode(){this.barcodeFind!=null&&this.Module.removeBarcodeFindFromContext(this.coreEngine.context,this.barcodeFind)}addBasicOverlay(){this.basicOverlay?.delete(),this.basicOverlay=null,this.barcodeFind!=null&&(this.basicOverlay=new this.Module.BarcodeFindBasicOverlay(this.barcodeFind)),this.coreEngine.view!=null&&this.basicOverlay!=null&&(this.basicOverlay.setGuidanceHandler(this.createWebFindGuidanceHandler()),this.Module.addBarcodeFindBasicOverlayToView(this.coreEngine.view,this.basicOverlay))}removeBasicOverlay(){this.coreEngine.view!=null&&this.basicOverlay!=null&&this.Module.removeBarcodeFindBasicOverlayFromView(this.coreEngine.view,this.basicOverlay)}async applySettings(e){this.barcodeFind?.applySettings(JSON.stringify(e))}updateBasicOverlay(e){let r=Object.entries(e).filter(([a,s])=>a!=="type");for(let[a,s]of r){let i=`set${Xe(a)}`;this.basicOverlay!=null&&typeof this.basicOverlay[i]=="function"&&s!=null&&this.basicOverlay[i](s)}}setTransformerFunction(e){this.customerTransformation=e??xe}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}listUpdatedFeedback(){this.workerFunctions.postMessage({type:"barcodeFindListUpdatedFeedback",payload:{}})}setToast(e,r){let a=this.coreEngine.hintPresenterV2;e?a?.showToast(JSON.stringify(r)):a?.hideToast(r.tag)}setGuidance(e,r,a){let s={tag:a,text:r,hintStyle:this.transparentGuidanceHintStyle};this.workerFunctions.postMessage({type:e?"showGuidance":"hideGuidance",payload:s})}createWebFindGuidanceHandler(){let e=this.Module.BarcodeFindGuidanceHandler.extend("BarcodeFindGuidanceHandler",{setInitialGuidance:(r,a)=>{this.setGuidance(r,a,"InitialGuidance")},setMoveCloserGuidance:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"MoveCloserGuidance")},setAllItemsFound:(r,a)=>{let s={text:a,toastHintStyle:x.Success,tag:"AllItemsFound"};this.setToast(r,s)},setTapShutterToPause:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"TapShutterToPause")},setTapShutterToResume:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"TapShutterResume")},setItemListUpdated:(r,a)=>{let s={text:a,toastHintStyle:x.Info,tag:"ItemListUpdated"};this.setToast(r,s)}});return new e}};var y=class{constructor(e){this.subscribers=new Set;this.property={key:e,value:null}}addSubscriber(e){this.subscribers.add(e),e.onPropertyChanged?.(this.property)}removeSubscriber(e){this.subscribers.delete(e)}setProperty(e){if(this.property.value!==e.value){this.property={key:this.property.key,value:e.value};for(let r of this.subscribers)r.onPropertyChanged?.(this.property)}}};var Ye={torch_state:new y("torch_state"),scanning_mode:new y("scanning_mode"),sound_enabled:new y("sound_enabled"),haptic_enabled:new y("haptic_enabled"),hand_mode:new y("hand_mode"),session_stop_reason:new y("session_stop_reason"),camera_position:new y("camera_position")},_=class{getBehaviorSubject(e){return Ye[e]}};var z=class{constructor(e,r,a){this.captureListenerSet=!1;this.propertyPushSource=new _;this.coreEngine=e,this.Module=r,this.workerFunctions=a,this.setup()}sparkScanDidUpdateSession(e){this.workerFunctions.postMessage({type:"sparkScanDidUpdateSession",payload:JSON.parse(e.toJson())})}getSparkScanDeserializer(){return this.sparkScanDeserializer}setup(){let e=this.Module.SparkScanListener.extend("SparkScanListener",{didScan:(s,i,n)=>{this.sparkScanDidScan(i,n),s.delete(),i.delete(),n.delete()},didUpdateSession:(s,i,n)=>{this.sparkScanDidUpdateSession(i),s.delete(),i.delete(),n.delete()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(s,i,n)=>{this.captureListenerSet||(i.addListener(new e,1),i.setSuccessFeedback(new r),i.setPropertyPushSource(this.propertyPushSource),this.captureListenerSet=!0),s.delete(),i.delete(),n.delete()},onModeDeserializationStarted(s,i,n){s.delete(),i.delete(),n.delete()},onSettingsDeserializationStarted(s,i,n){s.delete(),i.delete(),n.delete()},onSettingsDeserializationFinished(s,i,n){s.delete(),i.delete(),n.delete()},onOverlayDeserializationStarted(s,i,n){s.delete(),i.delete(),n.delete()},onOverlayDeserializationFinished:(s,i,n)=>{this.sparkScanOverlay?.delete(),this.sparkScanOverlay=i,s.delete(),n.delete()}});this.sparkScanDeserializer=new this.Module.SparkScanDeserializer,this.sparkScanDeserializer.setListener(new a)}emitErrorFeedback(e){this.sparkScanOverlay?.onErrorFeedbackEmitted(e)}overlayReadyForDraw(){this.sparkScanOverlay?.onReadyForNewData()}analyticsManagerPropertyChanged(e){this.propertyPushSource.getBehaviorSubject(e.key).setProperty(e)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}sparkScanDidScan(e,r){let a=this.coreEngine.convertToLoadableFrameData(r);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(e.toJson()),frameData:a}})}};var V=class extends D{constructor(e,r){super(e,r)}getModeDeserializers(){this.barcodeCaptureMode=new N(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new R(this,this.Module,this.workerFunctions),this.sparkScanMode=new z(this,this.Module,this.workerFunctions),this.barcodeFindMode=new H(this,this.Module,this.workerFunctions),this.barcodeArMode=new E(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,r){return r?e?"39b24d078c4d64f1ec024062a5e35f26c234aae04bca13a8aa71dadf45656422":"4f505230e143f0b1a2d38ed3975ab4f7742d08aa9e09d6c9bc364ad257e232d6":e?"b055d9be8c819e7e81a1697e15f91306afa61e4f51c2caef58517588b97d9724":"688a8bab60e1302b8e030d875dd3f54b924eb692c06c6bb05022191c35f6db1e"}getWasmMetadata(){return p}};function Ze(t){return(r=>/^[$A-Z_a-z][\\w$]*\\s*\\(.*\\)\\s*\\{/.test(r)&&!r.startsWith("function"))(t)?`function ${t}`:t}var Qe=["fetch","XMLHttpRequest","eval","Function","self","globalThis","Module","importScripts","this","console","window","document","import","Worker","ServiceWorker"];function et(t){return Qe.map(r=>new RegExp(`\\\\b${r}\\\\b`,"g")).some(r=>r.test(t))}function Oe(t){if(t==null)return null;let e=Ze(t);if(et(e))throw new Error("Function should be pure. Shouldn\'t introduce side effects, or rely on global scope");let r=`\'use strict\';\n return (${e});`;try{return new Function(r)()}catch{return null}}var J=class extends ee{constructor(e,r){super(e,r),this.dataCaptureInstance=new V(r,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,r,a){let s=null,i;try{i=a(),i instanceof Promise&&(i=await i)}catch(o){i=void 0,s=C(o)}let n={type:"workerTaskId",command:e,id:r,payload:this.hasPayload(i)?i.payload:void 0};s!=null&&(n.error=s),this.postMessage(n,this.hasTransferables(i)?i.transferables:[])}onMessage(e){switch(e.data.command){case"sparkScanEmitErrorFeedback":{let{data:r}=e;return this.respondWith(r.command,r.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(r.shouldRemoveBrush)}),!0}case"sparkScanOverlayReadyForDraw":{let{data:r}=e;return this.respondWith(r.command,r.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw()}),!0}case"sparkScanAnalyticsManagerPropertyChanged":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(r.property)}),!0}case"barcodeFindForSettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(r.settings)),!0}case"barcodeFindModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),!0}case"barcodeFindSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start()}),!0;case"barcodeFindSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause()}),!0;case"barcodeFindSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop()}),!0;case"barcodeFindSetItemList":{let{data:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(r.itemList)}),!0}case"barcodeFindSetEnabled":{let{data:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(r.enabled)}),!0}case"barcodeFindApplySettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(r.settings)),!0}case"barcodeFindAddBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay()}),!0}case"barcodeFindRemoveBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay()}),!0}case"barcodeFindUpdateBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(r.jsonOverlay)}),!0}case"barcodeFindSetTransformerFunction":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{let a=Oe(r.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(a)}),!0}case"barcodeArForSettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(r.settings)),!0}case"barcodeArModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),!0}case"barcodeArSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start()}),!0;case"barcodeArSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause()}),!0;case"barcodeArSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop()}),!0;case"barcodeArSetEnabled":{let{data:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(r.enabled)}),!0}case"barcodeArApplySettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(r.settings)}),!0}default:return super.onMessage(e)}}};var ea=new J(globalThis,{get:()=>globalThis.Module,set:t=>{globalThis.Module=t}});function ta(t){}})();\n'],{type:"application/javascript"})),e=new Worker(s,r);return URL.revokeObjectURL(s),e}var o=class r extends DataCaptureLoader{constructor(){super(...arguments);this._name="BarcodeCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=n({name:this.name})),this._dataCaptureWorker}get name(){return this._name}static async create(e){var a;let t=new r(e);return await t.workerCommand("setLogLevel",{level:(a=e.logLevel)!=null?a:Logger.Level.Debug}),await t.load(),t}async workerCommand(e,t,a){return new Promise((d,c)=>{let i=this.workerCommandId++;this.workerTasks.set(i,{resolve:d,reject:c,command:e});let l={...t,command:e,id:i};this.dataCaptureWorker.postMessage(l,a);})}};
|
|
1
|
+
import {DataCaptureLoader,Logger}from'@scandit/web-datacapture-core';function n(r){let s=URL.createObjectURL(new Blob(['"use strict";(()=>{var p={"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:6887267},"scandit-datacapture-sdk-barcode.wasm":{bytes:6852186},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:6765147},"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:6973788}};function F(t){return typeof t=="object"&&t!=null}function C(t){if(typeof t=="string")return t;if(F(t)){if(typeof t.message=="string")return t.message}else if(typeof t?.toString=="function")return t.toString();return"unknown error"}var l;(t=>{(c=>(c.Debug="debug",c.Info="info",c.Warn="warn",c.Error="error",c.Quiet="quiet"))(t.Level||(t.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),r="debug";function a(c){r=c}t.setLevel=a;function s(c,...h){if(!(e.get(r)>e.get(c)))switch(c){case"debug":{console.debug(...h);break}case"info":{console.log(...h);break}case"warn":{console.warn(...h);break}case"error":{console.error(...h);break}}}t.log=s;function i(...c){s("warn",...c)}t.warn=i;function n(...c){s("debug",...c)}t.debug=n;function o(...c){s("info",...c)}t.info=o;function d(...c){s("error",...c)}t.error=d})(l||(l={}));var B=class re extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,re.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var P=Promise.resolve(),G=!1,$=!1,k,j={writableDataPath:""};async function ae(t){if(k==null)return;G=!0;let e=new Promise((r,a)=>{setTimeout(()=>{a(new B({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},1500)});try{await Promise.race([new Promise((r,a)=>{k?.(t,s=>{if(s!=null){a(s);return}r()})}),e])}finally{G=!1}}async function se(t){return $||(G?($=!0,P=P.then(async()=>($=!1,ae(t)))):P=ae(t)),P}async function ie(t){j=t,k=FS.syncfs,FS.syncfs=(e,r)=>{let a=r,s=()=>{a()},i=n=>{a(n)};se(e).then(s).catch(i)};try{FS.mkdir(j.writableDataPath)}catch(e){if(e.code!=="EEXIST")throw k=void 0,e}return FS.mount(IDBFS,{},j.writableDataPath),se(!0)}var q=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t);var K=function(t,e){this[0]=t,this[1]=e},ne=(t,e,r)=>{var a=(n,o,d,c)=>{try{var h=r[n](o),m=(o=h.value)instanceof K,g=h.done;Promise.resolve(m?o[0]:o).then(b=>m?a(n==="return"?n:"next",o[1]?{done:b.done,value:b.value}:b,d,c):d({value:b,done:g})).catch(b=>a("throw",b,d,c))}catch(b){c(b)}},s=n=>i[n]=o=>new Promise((d,c)=>a(n,o,d,c)),i={};return r=r.apply(t,e),i[q("asyncIterator")]=()=>i,s("next"),s("throw"),s("return"),i},oe=(t,e,r)=>(e=t[q("asyncIterator")])?e.call(t):(t=t[q("iterator")](),e={},r=(a,s)=>(s=t[a])&&(e[a]=i=>new Promise((n,o,d)=>(i=s.call(t,i),d=i.done,Promise.resolve(i.value).then(c=>n({value:c,done:d}),o)))),r("next"),r("return"),e);var de={};function Le(t){return[...new Uint8Array(t)].map(e=>{let r=e.toString(16);return r.length===1?`0${r}`:r}).join("")}function Te(t){return ne(this,null,function*(){let e=t.getReader();try{for(;;){let{done:r,value:a}=yield new K(e.read());if(r)return;yield a}}finally{e.releaseLock()}})}async function We(t){let e=[],r=0,a=0;try{for(var s=oe(Te(t)),i,n,o;i=!(n=await s.next()).done;i=!1){let c=n.value;e.push(c),r+=c.length}}catch(c){o=[c]}finally{try{i&&(n=s.return)&&await n.call(s)}finally{if(o)throw o[0]}}let d=new Uint8Array(r);for(let c of e)d.set(c,a),a+=c.length;return d.buffer}var Ee=(t=>(t.VALID="VALID",t.INVALID="INVALID",t.NOT_VERIFIABLE="NOT_VERIFIABLE",t))(Ee||{});async function Re(t,e,r){if(typeof crypto.subtle.digest!="function")return l.log(l.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${r} could not be verified`),"NOT_VERIFIABLE";try{let a=t instanceof Promise?await t:t,s=await crypto.subtle.digest("SHA-256",a),i=Le(s);return e==null?(l.log(l.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):i===e?(l.log(l.Level.Debug,`Data Capture library WASM integrity found at ${r} has been verified correctly.`),"VALID"):(l.log(l.Level.Warn,`The Scandit Data Capture library WASM file found at ${r} seems invalid: expected file hash doesn\'t match (received: ${i}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),"INVALID")}catch(a){return l.log(l.Level.Warn,"Wasm response could not be verified",a),"NOT_VERIFIABLE"}}var X=new Map([["br",4.4],["gzip",2.9],["none",1]]);function Ne(t){var e;let r="content-encoding";if(t==null||t.get(r)==null)return X.get("none");let a=new Set(((e=t.get(r))!=null?e:"").split(",").map(s=>s.trim()));for(let[s,i]of X)if(a.has(s))return i;return X.get("none")}function He(t){var e,r;if(t==null)return 0;let a=(e=Ne(t))!=null?e:1,s=Number.parseInt((r=t.get("content-length"))!=null?r:"0",10);return Number.isNaN(s)?0:Math.floor(s*a*100)/100}function _e(t){let{pathname:e}=new URL(t);for(let[r,a]of Object.entries(de))if(e.endsWith(r))return a.bytes;return 0}function ce(t){de=t}var ze=(t,e)=>{let r=He(e);return r===0?_e(t):r};function Ve(t,e,r,{onProgress:a,onError:s,onComplete:i}){if(!e.body)return[e];let n=ze(t,e.headers),o=0,d=0,[c,h]=r?e.body.tee():[e.body],m=c.pipeThrough(new TransformStream({async transform(g,b){try{o+=g.length,d=Number((o/n*100).toFixed(2)),n>0&&g.length>0&&d<100?a?.({percentage:d,loadedBytes:o,privateUri:t}):n===0&&g.length>0&&a?.({percentage:null,loadedBytes:o,privateUri:t}),b.enqueue(g)}catch(v){b.error(v),s?.({error:v})}},flush(g){a?.({percentage:100,loadedBytes:o,privateUri:t}),i?.({percentage:100,loadedBytes:o,privateUri:t}),g.terminate()}}));return[new Response(m,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),h]}async function Y({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,onComplete:s,onError:i,referredOrigin:n}){let o=await fetch(t,{referrerPolicy:"origin",referrer:n??""});if(!o.ok)throw new Error(`HTTP status code is not ok: ${o.status}, ${o.statusText}`);let[d,c]=Ve(t,o,r,{onProgress:a,onError:i,onComplete:s});return c!=null&&Re(We(c),e,t),d}function le({wasmURI:t,expectedHash:e,verifyResponseHash:r,progressCallback:a,successCallback:s,errorCallback:i,importObject:n,referredOrigin:o}){async function d(h){try{let m=await Y({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:o}),g=await(h??m).arrayBuffer(),b=await globalThis.WebAssembly.instantiate(g,n);s(b.instance,b.module)}catch(m){l.log(l.Level.Error,m),l.log(l.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${t}, did you configure the path for it correctly?`),i?.(m)}}async function c(){let h;try{h=await Y({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:o});let m=await globalThis.WebAssembly.instantiateStreaming(h,n);s(m.instance,m.module)}catch(m){l.log(l.Level.Warn,m),l.log(l.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),d(h?.bodyUsed===!0?void 0:h)}}typeof globalThis.WebAssembly.instantiateStreaming=="function"?c():d()}async function Z(t,e,r,a){return new Promise((s,i)=>{t().then(s).catch(n=>{let o=e*2;if(o>r){i(n);return}a(n),globalThis.setTimeout(()=>{Z(t,o,r,a).then(s).catch(i)},e)})})}function Q(t){var e,r;let a="unknown";if((e=t.href)!=null&&e.startsWith("blob:null/"))a="localhost";else{let s=((r=t.pathname)==null?void 0:r.length)>1&&!t.pathname.startsWith("/");a=new URL(s?t.pathname:t.origin).hostname}return a.startsWith("[")&&a.endsWith("]")?(a=a.slice(1,-1),a):(/^(\\d{1,3}\\.){3}\\d{1,3}$/.test(a)&&(a=a.split(".").map(s=>Number.parseInt(s,10).toString()).join(".")),a)}async function ue(t,e){async function r(){return importScripts(t)}try{await Z(r,250,4e3,s=>{l.log(l.Level.Warn,s),l.log(l.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${t}, retrying...`)}),self.Module.mainScriptUrlOrBlob=t;let a=globalThis.SDC_WASM_JS_VERSION;return a!==e&&l.log(l.Level.Warn,`The Scandit Data Capture library JS file found at ${t} seems invalid: expected version doesn\'t match (received: ${a}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(a){return l.log(l.Level.Error,a),!1}}function Je(t){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(t)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(t)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function Ue(t){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(t);return e?e[0]:null}function pe(t,e,r){let a=e,s=Je(a);if(s.result){let n=Ue(a);n!=null&&(a=`${s.cdnBaseURL}${n}@${t}/sdc-lib/`)}let i=r.replace(".wasm","");return s.result?{jsURI:`${a}${i}.js`,wasmURI:`${a}${i}.wasm`}:{jsURI:`${a}${i}.js?v=${t}`,wasmURI:`${a}${i}.wasm?v=${t}`}}var I;(t=>{function e(){return"7.4.3"}t.sdkVersion=e})(I||(I={}));var he=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};var $e=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),je=()=>(async t=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(t)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));function Ge(){return typeof crossOriginIsolated>"u"?!1:crossOriginIsolated}function qe(){try{return new WebAssembly.Memory({initial:1,maximum:1,shared:!0}).buffer.constructor.name==="SharedArrayBuffer"}catch{return!1}}async function me(){return $e()}async function Ke(){if(!await je())return!1;let t=null;try{t=new Worker(URL.createObjectURL(new Blob([\'postMessage("Worker" in self);\'],{type:"text/javascript"})),{name:"nestedWorkerTest"})}catch{return!1}return new Promise(e=>{if(t==null){e(!1);return}t.onmessage=r=>{t?.terminate(),e(r.data)}})}async function be(){let t=await Ke();return Ge()&&qe()&&t}var ge=class fe{constructor(e,r){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameCounter=-1,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.performanceMetrics={frameDataPoolSize:0,processedFramesCount:0,redrawRequestsCount:0,actualRedrawsCount:0},this.gestureListener=null,this.webPlatformHintPresenter=null,this.moduleHandler=e,this.workerFunctions=r,this._loadProgressCallback=this._loadProgressCallback.bind(this),ce(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}convertToLoadableFrameData(e){let r=this.getNextFrameId();this.frameDataPool.set(r,new Uint8ClampedArray(e.getFrameData()));let a=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:r,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:a}}createContext(e){var r,a,s,i,n;let o=this.getModeDeserializers(),d=Q(location);(d==="localhost"||d==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(d+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,d,this.parentDomain,o,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let c=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(c==null){let u=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${u}`)}let h=c.getView();this.context=c.getContext(),c.delete();let m=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(u,f)=>{this.contextDidChangeStatus(JSON.parse(f.toJson())),u.delete()},didStartObservingContext:u=>{this.didStartObservingContext(),u.delete()},didStopObservingContext:u=>{u.delete()}}),g=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:u=>{u.delete()},onObservationStopped:u=>{u.delete()},onFrameProcessingStarted:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),f.delete(),u.delete()},onFrameProcessingFinished:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),f.delete(),u.delete()},onFrameSkipped:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),f.delete(),u.delete()}}),b=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(u,f)=>{var O;(O=this.gestureListener)==null||O.delete(),this.gestureListener=u.clone(),u.delete()}});(r=this.gestureRecognizer)==null||r.delete(),this.gestureRecognizer=new b;let v=new m;this.context.addListener(v),v.delete();let w=new g;this.context.addFrameListener(w),w.delete(),this.setView(h),(a=this.view)==null||a.setGestureRecognizer(this.gestureRecognizer);let M=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:u=>{u.delete()},showToast:u=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(u)})},hideToast:u=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(u)})},showGuidance:u=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(u)})},hideGuidance:u=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(u)})},startUpdateTimer:u=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:u}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(s=this.hintPresenterV2)==null||s.delete(),(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=new M,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(n=this.view)==null||n.setHintPresenterV2(this.hintPresenterV2))}onTap(e){var r;(r=this.gestureListener)==null||r.onTap(JSON.stringify(e))}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update()}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.performanceMetricsReporterTimer=setInterval(()=>{this.reportPerformanceMetrics();for(let e of Object.keys(this.performanceMetrics))this.performanceMetrics[e]=0},1e3))}async reportPerformanceMetrics(){this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:{...this.performanceMetrics}})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,r;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.lastFrameCounter=-1,(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(r=this.gestureListener)==null||r.delete(),this.gestureListener=null}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[fe.get3dPartyLicenseKeyMethodName](e)}}}}getModeDeserializers(){return new this.Module.VectorDataCaptureModeDeserializer}loadLibrary(e){return this.libraryLoadingPromise!=null?this.libraryLoadingPromise:(this.libraryLoadingPromise=this.setup(e),this.libraryLoadingPromise)}processFrame(e){var r;if(this.context==null)return{payload:e,transferables:[e.data.buffer]};let a=e.data,s=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888,i=this.Module.allocateUint8Array(a.byteLength);return this.Module.HEAPU8.set(a,i),(r=this.imageFrameSource)==null||r.outputFrame(i,e.width,e.height,s),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){let r=this.frameDataPool.get(e);return r==null?{payload:{data:null}}:{payload:{data:r},transferables:[r.buffer]}}scheduleRedraw(e,r){this.addRedrawRequest(r),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,r){var a;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(a=this.imageFrameSource)==null||a.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,r,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let r=i=>this.redrawRequests.length>0&&this.redrawRequests[0]<=i,a=i=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=i;)this.redrawRequests.shift()},s=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let i=performance.now();if(r(i)){a(i),e.draw();let n=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(n))}s()},this.redrawInterval)};s()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let r=this.onBeforeUpdateContextHook(e),a=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(r.context));if(a==null){let i=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${i}`)}this.context.delete(),this.context=a.getContext();let s=a.getView();a.delete(),s!=null&&r.view!=null&&s.setViewSize(r.view.width,r.view.height,r.view.orientation),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),s!=null&&this.hintPresenterV2&&s.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&s?.setGestureRecognizer(this.gestureRecognizer),this.setView(s),l.debug("context updated",r)}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,r;return{payload:{isDisplayingViewfinder:(r=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?r:!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getNextFrameId(){return this.lastFrameCounter++,this.lastFrameCounter>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL&&(this.lastFrameCounter=0),this.lastFrameCounter}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,r){return r?e?"f7428d9b7ec2bb70ed8bd17b316ee7b11df8b9c932009a2791bc6745059a20a9":"69c812d01cfbc1984987ce75fa813e7ebaf17d63668079700bae897721249c93":e?"29a942a86b60bd1239a408df6e47e11913924b430f2cd4c14de68c6c5c6a75f1":""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":""}getWasmMetadata(){return p}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((r,a)=>r-a)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${Q(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){l.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){l.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let r=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),a=new r;e.setNeedsRedrawDelegate(a),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),r=e.DataDecoding.extend("DataDecoding",{decode(a,s){try{let i=JSON.parse(s),n=[];for(let o of i){let d=new TextDecoder(o.ianaName,{fatal:!0});n.push(d.decode(a.slice(o.startIndex,o.endIndex)))}return n.join("")}catch{return""}}});e.setDataDecoding(new r)}start(e,r,a){e&&r&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||a())}getWritableDataPath(e){return e!=null?(l.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:r,writableDataPathOverride:a,overrideThreadsSupport:s,overrideSimdSupport:i,verifyResponseHash:n,referredOrigin:o,fixedWasmMemory:d}){var c;let h=!1,m=!1;this.writableDataPath=this.getWritableDataPath(a),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,globalThis.path=r;let{resolve:g,reject:b,promise:v}=new he,w=I.sdkVersion();if(w==="")throw new B({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[M,u]=await Promise.all([me(),be()]);s!=="auto"&&(u=s==="on"),i!=="auto"&&(M=i==="on");let f=this.getWasmCoreFileName(M,u),O=pe(w,e,f),{jsURI:U,wasmURI:te}=O,Ae={instantiateWasm:(S,Be)=>(le({importObject:S,wasmURI:te,expectedHash:this.getWasmCoreExpectedHash(M,u),verifyResponseHash:n,successCallback:Be,progressCallback:this._loadProgressCallback,errorCallback:Pe=>{b(Pe)},referredOrigin:o}),{})},A=d===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(d),maximum:this.numOfMBToPages(300),shared:u});return A!==null&&l.log(l.Level.Debug,"Fixed wasmMemory set",A),this.moduleHandler.set({...A?{wasmMemory:A}:{},mainScriptUrlOrBlob:U,canvas:(c=this.workerFunctions.getOffscreenCanvas())!=null?c:{getContext:()=>null},...Ae,dynamicLibraries:this.getWasmDynamicLibraries(te),locateFile:S=>e+S,noInitialRun:!0,preRun:[async()=>{try{await ie({writableDataPath:this.writableDataPath})}catch(S){if(S.name==="BlockedIndexedDB"){b(S.toString());return}l.log(l.Level.Debug,"No IndexedDB support, some data will not be persisted:",S)}m=!0,this.start(m,h,g)}],onMainComplete:()=>{if([h,m].includes(!1)){l.log(l.Level.Warn,{runtimeLoaded:h,fileSystemSynced:m},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),b("onMainComplete has been called but runtime or file system was not ready.");return}g()},onRuntimeInitialized:()=>{h=!0,this.start(m,h,g)},print:S=>{l.log(l.Level.Info,S)}}),await ue(U,w)||b(`Couldn\'t retrieve Scandit Data Capture library at ${U}, did you configure the path for it correctly?`),v}};ge.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var D=ge;function ye(t){return typeof t=="object"&&t!=null&&t.document==null&&"addEventListener"in t&&typeof t.importScripts=="function"}function Se(t){console.warn("Reached unexpected case",t)}var ee=class{constructor(t,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=t,this.dataCaptureInstance=new D(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),ye(t)&&this.listenToMessages()}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",t=>{l.log(l.Level.Error,t)}),this.workerSelf.addEventListener("messageerror",t=>{l.log(l.Level.Error,t)})}postMessage(t,e){this.workerSelf.postMessage(t,e??[])}getOffscreenCanvas(){if(typeof this.workerSelf.OffscreenCanvas=="function")return new this.workerSelf.OffscreenCanvas(32,32)}hasPayload(t){return F(t)&&"payload"in t}hasTransferables(t){return F(t)&&Array.isArray(t.transferables)}async respondWith(t,e,r){let a=null,s;try{s=r(),s instanceof Promise&&(s=await s)}catch(n){s=void 0,a=C(n)}let i={type:"workerTaskId",command:t,id:e,payload:this.hasPayload(s)?s.payload:void 0};a!=null&&(i.error=a),this.postMessage(i,this.hasTransferables(s)?s.transferables:[])}onMessage(t){switch(t.data.command){case"loadLibrary":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.loadLibrary({libraryLocation:e.libraryLocation,locationPath:e.locationPath,referredOrigin:e.referredOrigin,writableDataPathOverride:e.writableDataPathOverride,overrideThreadsSupport:e.overrideThreadsSupport,overrideSimdSupport:e.overrideSimdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory}))}break}case"onTap":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(t.data.command,t.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{l.setLevel(e.level)})}break}case"extractCentaurusLicense":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey))}break}case"documentVisibility":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state)})}break}case"isFeatureSupported":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature))}break}case"getViewfinderInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break}case"getOpenSourceSoftwareLicenseInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break}case"addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(t);break;case"removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(t);break;default:return Se(t.data),!1}return!0}};var ve=(t=>(t.Body="body",t.Footnote="footnote",t))(ve||{}),L=(t=>(t.Start="start",t.Center="center",t.End="end",t))(L||{}),we=(t=>(t.Normal="normal",t.Wider="wider",t.FitText="fitText",t))(we||{}),Me=(t=>(t.Normal="normal",t.Taller="taller",t))(Me||{}),Fe=(t=>(t.Square="square",t.Rounded="rounded",t))(Fe||{}),T=(t=>(t.None="none",t.Check="check",t.ExclamationMark="exclamationMark",t))(T||{}),W=(t=>(t.Top="top",t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(W||{}),Ce=(t=>(t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(Ce||{}),ke=(t=>(t.BlackOnWhite="blackOnWhite",t.WhiteOnBlack="whiteOnBlack",t.Transparent="transparent",t))(ke||{}),x=(t=>(t.Success="success",t.Error="error",t.Warning="warning",t.Info="info",t.Notification="notification",t))(x||{}),De=(t=>(t[t.Ocr=0]="Ocr",t[t.HideLogo=1]="HideLogo",t[t.ShowTestLicenseMessage=2]="ShowTestLicenseMessage",t[t.AugmentedReality=5]="AugmentedReality",t[t.ActivityPingStatsAddon=8]="ActivityPingStatsAddon",t[t.ActivityPing=9]="ActivityPing",t[t.Registration=10]="Registration",t[t.Parser=11]="Parser",t[t.BarcodeCapture=14]="BarcodeCapture",t[t.Analytics=17]="Analytics",t[t.AnalyticsBatchMode=18]="AnalyticsBatchMode",t[t.AnalyticsScanContent=19]="AnalyticsScanContent",t[t.AnalyticsOnlineVerification=20]="AnalyticsOnlineVerification",t[t.SparkScan=21]="SparkScan",t[t.AamvaIdBarcodeVerification=22]="AamvaIdBarcodeVerification",t[t.MappingForTracking=23]="MappingForTracking",t[t.BarcodeFind=24]="BarcodeFind",t[t.MandatoryRegistration=25]="MandatoryRegistration",t[t.FeatureTracking=26]="FeatureTracking",t[t.IdCaptureViz=27]="IdCaptureViz",t[t.IdCaptureMrz=28]="IdCaptureMrz",t[t.IdCaptureBarcode=29]="IdCaptureBarcode",t[t.BarcodeSelectionAimToScan=30]="BarcodeSelectionAimToScan",t[t.BarcodeSelectionTapToScan=31]="BarcodeSelectionTapToScan",t[t.BarcodeCount=32]="BarcodeCount",t[t.BarcodePick=33]="BarcodePick",t[t.IdVerificationDataComparison=34]="IdVerificationDataComparison",t[t.SmartLabelBarcode=35]="SmartLabelBarcode",t[t.SmartLabelText=36]="SmartLabelText",t[t.VoidedIdDetection=37]="VoidedIdDetection",t[t.BarcodeArFull=38]="BarcodeArFull",t))(De||{});var E=class{constructor(e,r,a){this.barcodeAr=null;this.coreEngine=e,this.Module=r,this.workerFunctions=a}async forSettings(e){this.barcodeAr?.delete(),this.barcodeAr=new this.Module.BarcodeAr(this.coreEngine.context,JSON.stringify(e));let r=this.Module.BarcodeArListener.extend("BarcodeArListener",{didUpdateSession:(a,s,i)=>{let n=this.coreEngine.convertToLoadableFrameData(i);this.workerFunctions.postMessage({type:"barcodeArDidUpdateSession",payload:{session:JSON.parse(s.toJson()),frameData:n}}),a.delete(),s.delete(),i.delete()}});this.barcodeAr.addListener(new r,1),this.Module.addBarcodeArToContext(this.coreEngine.context,this.barcodeAr)}start(){this.barcodeAr?.start()}pause(){this.barcodeAr?.pause()}stop(){this.barcodeAr?.stop()}setEnabled(e){this.barcodeAr?.setEnabled(e)}async removeMode(){this.barcodeAr!=null&&this.Module.removeBarcodeArFromContext(this.coreEngine.context,this.barcodeAr)}applySettings(e){this.barcodeAr?.applySettings(JSON.stringify(e))}};var R=class{constructor(e,r,a){this.trackingListenerSet=!1;this.coreEngine=e,this.Module=r,this.workerFunctions=a,this.setup()}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getBatchDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeBatchListener.extend("BarcodeTrackingListener",{didUpdateSession:(a,s,i)=>{this.barcodeBatchDidUpdateSession(s),a.delete(),s.delete(),i.delete()},onTrackedBarcodeTapped:(a,s)=>{this.onTrackedBarcodeTapped(s),a.delete(),s.delete()}}),r=this.Module.BarcodeBatchDeserializerListener.extend("BarcodeTrackingDeserializerListener",{onModeDeserializationFinished:(a,s,i)=>{this.trackingListenerSet||(s.addListener(new e,1),this.trackingListenerSet=!0),a.delete(),s.delete(),i.delete()},onModeDeserializationStarted(a,s,i){a.delete(),s.delete(),i.delete()},onSettingsDeserializationStarted(a,s,i){a.delete(),s.delete(),i.delete()},onSettingsDeserializationFinished(a,s,i){a.delete(),s.delete(),i.delete()}});this.barcodeBatchDeserializer=new this.Module.BarcodeBatchDeserializer,this.barcodeBatchDeserializer.setListener(new r)}onTrackedBarcodeTapped(e){this.workerFunctions.postMessage({type:"didTapTrackedBarcode",payload:JSON.parse(e.toJson())})}};var N=class{constructor(e,r,a){this.captureListenerSet=!1;this.coreEngine=e,this.Module=r,this.workerFunctions=a,this.setup()}barcodeCaptureDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeCaptureDidUpdateSession",payload:JSON.parse(e.toJson())})}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getCaptureDeserializer(){return this.barcodeCaptureDeserializer}getTrackingDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeCaptureListener.extend("BarcodeCaptureListener",{didScan:(n,o,d)=>{this.barcodeCaptureDidScan(o,d),n.delete(),d.delete(),o.delete()},didUpdateSession:(n,o,d)=>{this.barcodeCaptureDidUpdateSession(o),n.delete(),d.delete(),o.delete()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=new e,s=new r,i=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(n,o,d)=>{o.addListener(a,1),o.setSuccessFeedback(s),n.delete(),o.delete(),d.delete()},onModeDeserializationStarted(n,o,d){n.delete(),o.delete(),d.delete()},onSettingsDeserializationStarted(n,o,d){n.delete(),o.delete(),d.delete()},onSettingsDeserializationFinished(n,o,d){n.delete(),o.delete(),d.delete()}});this.barcodeCaptureDeserializer=new this.Module.BarcodeCaptureDeserializer,this.barcodeCaptureDeserializer.setListener(new i)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}barcodeCaptureDidScan(e,r){let a=this.coreEngine.convertToLoadableFrameData(r);this.workerFunctions.postMessage({type:"barcodeCaptureDidScan",payload:{session:JSON.parse(e.toJson()),frameData:a}})}};function Xe(t){return t.charAt(0).toUpperCase()+t.slice(1)}function xe(t){return t}var H=class{constructor(e,r,a){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:L.Center,hintIcon:T.None,hintAnchor:W.AboveViewFinder,hintAnchorOffset:-12,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=xe;this.coreEngine=e,this.Module=r,this.workerFunctions=a}async forSettings(e){this.barcodeFind?.delete(),this.barcodeFind=new this.Module.BarcodeFind(this.coreEngine.context,JSON.stringify(e));let r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.listUpdatedFeedback()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.barcodeFindFeedback()}}),s=this.Module.BarcodeFindTransformer.extend("BarcodeFindTransformer",{transformBarcodeData:n=>this.customerTransformation(n)}),i=this.Module.BarcodeFindListener.extend("BarcodeFindListener",{didUpdateSession:(n,o,d)=>{let c=this.coreEngine.convertToLoadableFrameData(d);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(o.toJson()),frameData:c}}),n.delete(),o.delete(),d.delete()},onSearchPaused:n=>{let o=[];for(let d=0;d<n.size();d++)o.push(n.get(d));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:o}})},onSearchStopped:n=>{let o=[];for(let d=0;d<n.size();d++)o.push(n.get(d));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:o}})},onSearchStarted:()=>{this.workerFunctions.postMessage({type:"barcodeFindSearchStarted",payload:{}})}});this.barcodeFind.setBarcodeFindTransformer(new s),this.barcodeFind.addListener(new i,1),this.barcodeFind.setItemListUpdatedFeedback(new r),this.barcodeFind.setFeedback(new a),this.Module.addBarcodeFindToContext(this.coreEngine.context,this.barcodeFind)}barcodeFindFeedback(){this.workerFunctions.postMessage({type:"barcodeFindFeedback",payload:{}})}start(){this.barcodeFind?.start()}stop(){this.barcodeFind?.stop()}pause(){this.barcodeFind?.pause()}setEnabled(e){this.barcodeFind?.setEnabled(e)}setItemList(e){this.barcodeFind?.setItemList(JSON.stringify(e))}async removeMode(){this.barcodeFind!=null&&this.Module.removeBarcodeFindFromContext(this.coreEngine.context,this.barcodeFind)}addBasicOverlay(){this.basicOverlay?.delete(),this.basicOverlay=null,this.barcodeFind!=null&&(this.basicOverlay=new this.Module.BarcodeFindBasicOverlay(this.barcodeFind)),this.coreEngine.view!=null&&this.basicOverlay!=null&&(this.basicOverlay.setGuidanceHandler(this.createWebFindGuidanceHandler()),this.Module.addBarcodeFindBasicOverlayToView(this.coreEngine.view,this.basicOverlay))}removeBasicOverlay(){this.coreEngine.view!=null&&this.basicOverlay!=null&&this.Module.removeBarcodeFindBasicOverlayFromView(this.coreEngine.view,this.basicOverlay)}async applySettings(e){this.barcodeFind?.applySettings(JSON.stringify(e))}updateBasicOverlay(e){let r=Object.entries(e).filter(([a,s])=>a!=="type");for(let[a,s]of r){let i=`set${Xe(a)}`;this.basicOverlay!=null&&typeof this.basicOverlay[i]=="function"&&s!=null&&this.basicOverlay[i](s)}}setTransformerFunction(e){this.customerTransformation=e??xe}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}listUpdatedFeedback(){this.workerFunctions.postMessage({type:"barcodeFindListUpdatedFeedback",payload:{}})}setToast(e,r){let a=this.coreEngine.hintPresenterV2;e?a?.showToast(JSON.stringify(r)):a?.hideToast(r.tag)}setGuidance(e,r,a){let s={tag:a,text:r,hintStyle:this.transparentGuidanceHintStyle};this.workerFunctions.postMessage({type:e?"showGuidance":"hideGuidance",payload:s})}createWebFindGuidanceHandler(){let e=this.Module.BarcodeFindGuidanceHandler.extend("BarcodeFindGuidanceHandler",{setInitialGuidance:(r,a)=>{this.setGuidance(r,a,"InitialGuidance")},setMoveCloserGuidance:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"MoveCloserGuidance")},setAllItemsFound:(r,a)=>{let s={text:a,toastHintStyle:x.Success,tag:"AllItemsFound"};this.setToast(r,s)},setTapShutterToPause:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"TapShutterToPause")},setTapShutterToResume:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"TapShutterResume")},setItemListUpdated:(r,a)=>{let s={text:a,toastHintStyle:x.Info,tag:"ItemListUpdated"};this.setToast(r,s)}});return new e}};var y=class{constructor(e){this.subscribers=new Set;this.property={key:e,value:null}}addSubscriber(e){this.subscribers.add(e),e.onPropertyChanged?.(this.property)}removeSubscriber(e){this.subscribers.delete(e)}setProperty(e){if(this.property.value!==e.value){this.property={key:this.property.key,value:e.value};for(let r of this.subscribers)r.onPropertyChanged?.(this.property)}}};var Ye={torch_state:new y("torch_state"),scanning_mode:new y("scanning_mode"),sound_enabled:new y("sound_enabled"),haptic_enabled:new y("haptic_enabled"),hand_mode:new y("hand_mode"),session_stop_reason:new y("session_stop_reason"),camera_position:new y("camera_position")},_=class{getBehaviorSubject(e){return Ye[e]}};var z=class{constructor(e,r,a){this.captureListenerSet=!1;this.propertyPushSource=new _;this.coreEngine=e,this.Module=r,this.workerFunctions=a,this.setup()}sparkScanDidUpdateSession(e){this.workerFunctions.postMessage({type:"sparkScanDidUpdateSession",payload:JSON.parse(e.toJson())})}getSparkScanDeserializer(){return this.sparkScanDeserializer}setup(){let e=this.Module.SparkScanListener.extend("SparkScanListener",{didScan:(s,i,n)=>{this.sparkScanDidScan(i,n),s.delete(),i.delete(),n.delete()},didUpdateSession:(s,i,n)=>{this.sparkScanDidUpdateSession(i),s.delete(),i.delete(),n.delete()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(s,i,n)=>{this.captureListenerSet||(i.addListener(new e,1),i.setSuccessFeedback(new r),i.setPropertyPushSource(this.propertyPushSource),this.captureListenerSet=!0),s.delete(),i.delete(),n.delete()},onModeDeserializationStarted(s,i,n){s.delete(),i.delete(),n.delete()},onSettingsDeserializationStarted(s,i,n){s.delete(),i.delete(),n.delete()},onSettingsDeserializationFinished(s,i,n){s.delete(),i.delete(),n.delete()},onOverlayDeserializationStarted(s,i,n){s.delete(),i.delete(),n.delete()},onOverlayDeserializationFinished:(s,i,n)=>{this.sparkScanOverlay?.delete(),this.sparkScanOverlay=i,s.delete(),n.delete()}});this.sparkScanDeserializer=new this.Module.SparkScanDeserializer,this.sparkScanDeserializer.setListener(new a)}emitErrorFeedback(e){this.sparkScanOverlay?.onErrorFeedbackEmitted(e)}overlayReadyForDraw(){this.sparkScanOverlay?.onReadyForNewData()}analyticsManagerPropertyChanged(e){this.propertyPushSource.getBehaviorSubject(e.key).setProperty(e)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}sparkScanDidScan(e,r){let a=this.coreEngine.convertToLoadableFrameData(r);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(e.toJson()),frameData:a}})}};var V=class extends D{constructor(e,r){super(e,r)}getModeDeserializers(){this.barcodeCaptureMode=new N(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new R(this,this.Module,this.workerFunctions),this.sparkScanMode=new z(this,this.Module,this.workerFunctions),this.barcodeFindMode=new H(this,this.Module,this.workerFunctions),this.barcodeArMode=new E(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,r){return r?e?"f7428d9b7ec2bb70ed8bd17b316ee7b11df8b9c932009a2791bc6745059a20a9":"69c812d01cfbc1984987ce75fa813e7ebaf17d63668079700bae897721249c93":e?"29a942a86b60bd1239a408df6e47e11913924b430f2cd4c14de68c6c5c6a75f1":"0fa0bbbbb739313a8b07757f4bb6e8d76d0b41a78880e955330cac7ecea7f146"}getWasmMetadata(){return p}};function Ze(t){return(r=>/^[$A-Z_a-z][\\w$]*\\s*\\(.*\\)\\s*\\{/.test(r)&&!r.startsWith("function"))(t)?`function ${t}`:t}var Qe=["fetch","XMLHttpRequest","eval","Function","self","globalThis","Module","importScripts","this","console","window","document","import","Worker","ServiceWorker"];function et(t){return Qe.map(r=>new RegExp(`\\\\b${r}\\\\b`,"g")).some(r=>r.test(t))}function Oe(t){if(t==null)return null;let e=Ze(t);if(et(e))throw new Error("Function should be pure. Shouldn\'t introduce side effects, or rely on global scope");let r=`\'use strict\';\n return (${e});`;try{return new Function(r)()}catch{return null}}var J=class extends ee{constructor(e,r){super(e,r),this.dataCaptureInstance=new V(r,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,r,a){let s=null,i;try{i=a(),i instanceof Promise&&(i=await i)}catch(o){i=void 0,s=C(o)}let n={type:"workerTaskId",command:e,id:r,payload:this.hasPayload(i)?i.payload:void 0};s!=null&&(n.error=s),this.postMessage(n,this.hasTransferables(i)?i.transferables:[])}onMessage(e){switch(e.data.command){case"sparkScanEmitErrorFeedback":{let{data:r}=e;return this.respondWith(r.command,r.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(r.shouldRemoveBrush)}),!0}case"sparkScanOverlayReadyForDraw":{let{data:r}=e;return this.respondWith(r.command,r.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw()}),!0}case"sparkScanAnalyticsManagerPropertyChanged":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(r.property)}),!0}case"barcodeFindForSettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(r.settings)),!0}case"barcodeFindModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),!0}case"barcodeFindSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start()}),!0;case"barcodeFindSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause()}),!0;case"barcodeFindSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop()}),!0;case"barcodeFindSetItemList":{let{data:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(r.itemList)}),!0}case"barcodeFindSetEnabled":{let{data:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(r.enabled)}),!0}case"barcodeFindApplySettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(r.settings)),!0}case"barcodeFindAddBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay()}),!0}case"barcodeFindRemoveBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay()}),!0}case"barcodeFindUpdateBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(r.jsonOverlay)}),!0}case"barcodeFindSetTransformerFunction":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{let a=Oe(r.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(a)}),!0}case"barcodeArForSettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(r.settings)),!0}case"barcodeArModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),!0}case"barcodeArSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start()}),!0;case"barcodeArSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause()}),!0;case"barcodeArSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop()}),!0;case"barcodeArSetEnabled":{let{data:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(r.enabled)}),!0}case"barcodeArApplySettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(r.settings)}),!0}default:return super.onMessage(e)}}};var ea=new J(globalThis,{get:()=>globalThis.Module,set:t=>{globalThis.Module=t}});function ta(t){}})();\n'],{type:"application/javascript"})),e=new Worker(s,r);return URL.revokeObjectURL(s),e}var o=class r extends DataCaptureLoader{constructor(){super(...arguments);this._name="BarcodeCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=n({name:this.name})),this._dataCaptureWorker}get name(){return this._name}static async create(e){var a;let t=new r(e);return await t.workerCommand("setLogLevel",{level:(a=e.logLevel)!=null?a:Logger.Level.Debug}),await t.load(),t}async workerCommand(e,t,a){return new Promise((d,c)=>{let i=this.workerCommandId++;this.workerTasks.set(i,{resolve:d,reject:c,command:e});let l={...t,command:e,id:i};this.dataCaptureWorker.postMessage(l,a);})}};
|
|
2
2
|
export{o as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a
|
|
1
|
+
import {a}from'./chunk-WVIC3JWX.js';import {a as a$3}from'./chunk-7O2NHA3I.js';import {a as a$2}from'./chunk-LTNZJEG4.js';import {a as a$4}from'./chunk-4QSEBPWB.js';import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {a as a$5}from'./chunk-2LC75X3X.js';import {DataCaptureEngine}from'@scandit/web-datacapture-core/build/js/worker/index.js';var c=class extends DataCaptureEngine{constructor(e,r){super(e,r);}getModeDeserializers(){this.barcodeCaptureMode=new a(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new a$1(this,this.Module,this.workerFunctions),this.sparkScanMode=new a$2(this,this.Module,this.workerFunctions),this.barcodeFindMode=new a$3(this,this.Module,this.workerFunctions),this.barcodeArMode=new a$4(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return ""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,r){return r?e?"f7428d9b7ec2bb70ed8bd17b316ee7b11df8b9c932009a2791bc6745059a20a9":"69c812d01cfbc1984987ce75fa813e7ebaf17d63668079700bae897721249c93":e?"29a942a86b60bd1239a408df6e47e11913924b430f2cd4c14de68c6c5c6a75f1":"0fa0bbbbb739313a8b07757f4bb6e8d76d0b41a78880e955330cac7ecea7f146"}getWasmMetadata(){return a$5}};export{c as a};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import {a}from'./chunk-LAYALN2H.js';import {gray900}from'@scandit/web-datacapture-core/build/js/private/ui/colors.js';import {ScanditHTMLElement,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';import {Color}from'@scandit/web-datacapture-core';var e=class e extends ScanditHTMLElement{constructor(){super();let t=this.attachShadow({mode:"open"});t.innerHTML=html`<div class="container">
|
|
2
|
+
<span class="ghost-arrow arw-bottom-center"></span>
|
|
3
|
+
<div class="icon-container">
|
|
4
|
+
<slot name="barcode-icon"></slot>
|
|
5
|
+
</div>
|
|
6
|
+
<span class="text"></span>
|
|
7
|
+
</div>`,this.containerElement=t.querySelector(".container"),this.textContainer=this.containerElement.querySelector(".text"),t.append(e.createStyleElement().cloneNode(true)),t.append(a());}set text(t){this.updateText(t);}get text(){var t;return (t=this.textContainer.textContent)!=null?t:""}set tip(t){this.toggleTip(t);}get tip(){var t,o;return (o=(t=this.containerElement.querySelector(".ghost-arrow"))==null?void 0:t.classList.value.includes("arw-"))!=null?o:false}set textColor(t){this.style.setProperty("--text-color",`#${t.toJSON()}`);}get textColor(){return Color.fromJSON(this.style.getPropertyValue("--text-color"))}set expanded(t){this.toggleAttribute("expanded",t);}set backgroundColor(t){this.style.setProperty("--background-color",`#${t.toJSON()}`),this.style.setProperty("--arrow-background-color",`#${t.toJSON()}`);}get backgroundColor(){let t=this.style.getPropertyValue("--background-color");return Color.fromJSON(t===""?"FFFFFF":t)}get expanded(){return this.hasAttribute("expanded")}static create(){return document.createElement(e.tag)}static register(){defineCustomElements({[e.tag]:e});}static createStyleElement(){return css`:host{display:inline-flex;--size:32px;--padding:0px;--background-color:#fff;--text-color:#${gray900.toJSON()};--expanded-width:190px;--arrow-size:calc(var(--size)/5);--arrow-background-color:#fff;--arrow-offset:0px;cursor:pointer;font-family:SF Pro Text,sans-serif;font-size:1rem;font-style:normal;font-weight:600;transition:transform .25s ease-in-out;user-select:none;-webkit-tap-highlight-color:transparent}.ghost-arrow{height:var(--size);left:0;position:absolute;top:-2px;width:var(--size)}:host([hidden]){display:none}.container{background-color:var(--background-color);border-radius:calc(var(--size) + var(--padding)/2);box-shadow:0 1px 2px 0 #${gray900.withAlpha(.3).toJSON()};display:inline-flex;flex-direction:row;gap:10px;padding:var(--padding);position:relative;transition:width .25s ease-in-out;white-space:nowrap}.container,.icon-container{align-items:center;height:var(--size);width:var(--size)}.icon-container{display:flex;justify-content:center;position:absolute}.container span.text{color:var(--text-color);max-width:0;opacity:0;overflow:hidden;position:absolute;transform:translateX(0);transition:opacity .25s ease-in-out,transform .25s ease-in-out,max-width .25s ease-in-out;white-space:nowrap}:host([expanded]) .container span.text{max-width:calc(var(--expanded-width) - var(--size) - 2px);opacity:1;transform:translateX(var(--size))}:host([expanded]){transform:translateX(calc(var(--expanded-width) - 50% - 2px - var(--size)/2))}:host([expanded]) .container{width:var(--expanded-width)}`}connectedCallback(){this.setAttribute("tip","true");}attributeChangedCallback(t,o,r){t==="text"?this.updateText(r):t==="tip"&&this.toggleTip(r==="true"||r==="");}updateText(t){this.textContainer.textContent=t.slice(0,20);}toggleTip(t){var o;(o=this.containerElement.querySelector(".ghost-arrow"))==null||o.classList.toggle("arw-bottom-center",t);}};e.tag="scandit-status-icon-container",e.observedAttributes=["text","tip"];var s=e;export{s as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$2}from'./chunk-OTZPCIBD.js';import {a as a$3}from'./chunk-NKRL5HIU.js';import {a}from'./chunk-QCD3RIT4.js';import {a as a$1,c,b as b$1}from'./chunk-P4F5WUAR.js';import {a as a$5}from'./chunk-UKOWYLLZ.js';import {c as c$1,b as b$3}from'./chunk-SZUPDKV5.js';import {a as a$4}from'./chunk-XTOFHCOV.js';import {b}from'./chunk-JMUNN3HX.js';import {b as b$2}from'./chunk-DHCNYKSL.js';import {DataCaptureView,Anchor,LogoStyle,CameraAccess,Camera,isCameraFrameSource,FrameSourceState,Color,CameraPosition,TorchState,Logger,NumberWithUnit,RadiusLocationSelection}from'@scandit/web-datacapture-core';import {localStorage}from'@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';var P=class O{constructor(a$4,e,t,i){this.cameras=[];this.preferenceManager=new a(localStorage);this.defaultSuccessBrush=a$1.defaultSuccessBrush();this.defaultErrorBrush=a$1.defaultErrorBrush();this.sparkScanView=a$4,this.context=e,this.sparkScan=t,this.sparkScanViewSettings=i,this.stateManager=new a$2(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=a$3.withDefaults(i.soundEnabled,i.hapticEnabled),this.analyticsManager=b.forContext(e),this.triggerButtonCollapseTimeout=new Timeout(this.sparkScanViewSettings.triggerButtonCollapseTimeout,async()=>{this.stateManager.state!=="idle"&&await this.switchToIdleState({sessionStopReason:"timeout"});}),this.inactiveStateTimeout=new Timeout(i.inactiveStateTimeout,async()=>{this.stateManager.state!=="inactive"&&!this.stateManager.holdingToScan&&await this.switchToInactiveState({sessionStopReason:"timeout"});}),this.stateTimeouts={active:this.inactiveStateTimeout,inactive:this.triggerButtonCollapseTimeout},this.switchToIdleState();}get portraitOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateY)!=null?a:this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateY)!=null?a:this.defaultMiniPreviewTranslateY}get defaultTriggerButtonTranslateX(){return this.parentViewSizes.width-Math.min(this.parentViewSizes.width/3,110)-90/2}get defaultTriggerButtonTranslateY(){return this.parentViewSizes.height-Math.min(this.parentViewSizes.height/3,250)-90/2}get defaultMiniPreviewTranslateX(){return this.parentViewSizes.width-225-16}get parentViewSizes(){var a,e;return {width:(a=this.sparkScanView.parentElement.clientWidth)!=null?a:window.innerWidth,height:(e=this.sparkScanView.parentElement.clientHeight)!=null?e:window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(a,e,t,i){return new O(a,e,t,i)}async prepareScanning(a){var i;this.context.addListener(this),this.dataCaptureView=await DataCaptureView.forContext(this.context),this.dataCaptureView.logoAnchor=Anchor.BottomCenter,this.dataCaptureView.logoStyle=LogoStyle.Minimal,this.dataCaptureView.setHiddenProperty("stopVideoTracksOnVisibilityChange",false),this.dataCaptureView.setHiddenProperty("freezeFrameWhenStoppingFrameSource",false),this.dataCaptureView.connectToElement(a);let e=await CameraAccess.getCameras();this.cameras=e.map(r=>Camera.fromDeviceCamera(r)),this.camera=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(i=this.cameras.find(r=>r.position===this.sparkScanViewSettings.defaultCameraPosition))!=null?i:Camera.default,await this.camera.applySettings(a$4.recommendedCameraSettings),await this.context.setFrameSource(this.camera),await this.camera.switchToDesiredState(FrameSourceState.Standby);let t=await this.camera.isTorchAvailable();this.sparkScanView.setTorchAvailable(t),this.sparkScanView.setZoomAvailable(this.camera.isZoomAvailable()),this.sparkScanView.cameraSwitchButtonTapped(t,this.camera.position),await this.context.addMode(this.sparkScan),this.sparkScan.addListener(this),this.sparkScanOverlay=await a$5.withSparkScanForView(this.sparkScan,this.dataCaptureView),await this.sparkScanOverlay.setShouldRemoveLocationsAfterScan(this.stateManager.scanningBehavior==="continuous"),this.analyticsManager.startSession({cameraPosition:this.camera.position,handMode:"right",hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences();}async startScanning(){await this.switchToActiveState();}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:"user"});}async stopScanning(a){var e;await this.sparkScan.setEnabled(false),this.sparkScan.removeListener(this),await((e=this.camera)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),this.dataCaptureView.detachFromElement(),this.context.removeListener(this),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async onTriggerButtonPointerDown(){await this.sparkScan.setResultSuppressionEnabled(true);}async onTriggerButtonTap(){switch(await this.sparkScan.setResultSuppressionEnabled(false),this.stateManager.state){case "Initial":return;case "idle":case "inactive":case "error":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case "active":await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}):this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}}async onTriggerButtonLongPressStart(){var a;await this.sparkScan.setResultSuppressionEnabled(false),this.sparkScanViewSettings.holdToScanEnabled&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior="continuous",this.stateManager.holdingToScan=true,await((a=this.sparkScanOverlay)==null?void 0:a.setShouldRemoveLocationsAfterScan(true)),await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}async onTriggerButtonLongPressEnd(){var a,e;this.sparkScanViewSettings.holdToScanEnabled&&this.stateManager.state!=="error"&&(this.stateManager.scanningBehavior=(a=this.scanningBehaviorCache)!=null?a:"single",this.stateManager.holdingToScan=false,await((e=this.sparkScanOverlay)==null?void 0:e.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new b$1("",0,Color.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)}));}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState();}async onVisibilityChange(){await this.switchToIdleState();}async onTargetModeButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var h,s,S;e.emit();let i=String(a),r={true:a&&this.stateManager.scanningMode instanceof b$3,false:!a&&this.stateManager.scanningMode instanceof c$1}[i];r&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetMode(a),await((h=this.sparkScanOverlay)==null?void 0:h.setShouldDrawViewfinder(a)),this.startTimeoutForCurrentState(),this.sparkScanView.targetModeButtonTapped(a,t),r&&((S=(s=this.listener)==null?void 0:s.didChangeScanningMode)==null||S.call(s,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode));}async onScanningBehaviorButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var i;e.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(a?"continuous":"single"),await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(a)),this.startTimeoutForCurrentState(),this.sparkScanView.scanningBehaviorButtonTapped(a,t),this.analyticsManager.setScanningMode(this.stateManager.scanningMode);}async onBarcodeFindButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapBarcodeFindButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onLabelCaptureButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapLabelCaptureButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onCameraSwitchButtonTap(){if(this.feedbackManager.emitTapFeedback(),this.restartTimeouts(),!this.camera||this.stateManager.state==="error")return;let a={[CameraPosition.WorldFacing]:CameraPosition.UserFacing,[CameraPosition.UserFacing]:CameraPosition.WorldFacing}[this.camera.position],e=this.cameras.find(t=>t.position===a);e&&(await this.camera.switchToDesiredState(FrameSourceState.Off),await e.applySettings(this.camera.settings),await this.context.setFrameSource(e),await e.switchToDesiredState(FrameSourceState.On),this.sparkScanView.cameraSwitchButtonTapped(await e.isTorchAvailable(),a),this.analyticsManager.setCameraPosition(a),this.camera=e);}async onTorchButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var i;e.emit(),this.stateManager.torchState=a?TorchState.On:TorchState.Off,((i=this.camera)==null?void 0:i.getCurrentState())===FrameSourceState.On&&await this.camera.setDesiredTorchState(this.stateManager.torchState),this.startTimeoutForCurrentState(),this.sparkScanView.torchButtonTapped(a,t),this.analyticsManager.setTorchState(this.stateManager.torchState);}restartTimeouts(){for(let a of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])(a==null?void 0:a.running)===true&&a.start();}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:"user"});}onMiniPreviewResizeButtonTap(){(this.stateManager.state==="active"||this.stateManager.state==="inactive")&&(this.feedbackManager.emitTapFeedback(),this.startTimeoutForCurrentState());}async onMiniPreviewZoomButtonTap(a){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=a,this.camera&&(this.camera.settings.zoomFactor=a,await this.camera.applySettings(this.camera.settings)),this.startTimeoutForCurrentState();}async onMiniPreviewDrag(a,e){switch(this.stateManager.state==="active"&&await this.sparkScan.setEnabled(false),e){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationMiniPreviewTranslateX=a.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=a.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationMiniPreviewTranslateX=a.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=a.y;break}}this.restartTimeouts();}onMiniPreviewPointerMove(){this.restartTimeouts();}async onMiniPreviewPointerUp(){await this.switchToActiveState();}async onMiniPreviewDragEnd(){this.stateManager.state==="active"&&await this.sparkScan.setEnabled(true);}onTriggerButtonDrag(a,e){switch(e){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationTriggerButtonTranslateX=a.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=a.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationTriggerButtonTranslateX=a.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=a.y;break}}}async onOrientationChange(){this.stateManager.state==="error"&&await this.switchToInactiveState({sessionStopReason:"user"});}async didScan(a,e){if(!e.newlyRecognizedBarcode)return;let t=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(e.newlyRecognizedBarcode);t instanceof b$1?await this.switchToErrorState({barcodeFeedback:t}):t instanceof c&&await(this.stateManager.continuousModeEnabled?this.switchToActiveState({barcodeFeedback:t}):this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:t,emitSuccessFeedback:true})),this.restartTimeouts();}didChangeFrameSource(a,e){var t;if(isCameraFrameSource(e))this.camera=e;else {let i=(t=e==null?void 0:e.toJSONObject().type)!=null?t:"unknown";Logger.warn(`SparkScanView instances require a camera frame source to work, but a frame source of type "${i}" was found.`);}}setListener(a){this.listener=a;}brushForFeedback(a){return a.brush}async switchToIdleState(a={}){var e,t,i;this.feedbackManager.emitTapFeedback(),await((e=this.sparkScanOverlay)==null?void 0:e.overlayReadyForDraw()),this.setState("idle"),await this.sparkScan.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),(i=this.resumeCapturingTimeout)==null||i.stop(),this.sparkScanView.switchToIdleState(),a.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToActiveState(a={}){var t,i,r,o,h,s,S;let e=this.stateManager.state;await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.On)),await((i=this.camera)==null?void 0:i.setDesiredTorchState(this.stateManager.torchState)),a.barcodeFeedback&&await((r=this.sparkScanOverlay)==null?void 0:r.setBrush(this.brushForFeedback(a.barcodeFeedback))),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await((h=this.sparkScanOverlay)==null?void 0:h.overlayReadyForDraw()),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.stateManager.holdingToScan||this.inactiveStateTimeout.start(),this.triggerButtonCollapseTimeout.stop(),(s=this.resumeCapturingTimeout)==null||s.stop(),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c,this.stateManager.scanningBehavior,(S=a.barcodeFeedback)==null?void 0:S.visualFeedbackColor,this.stateManager.zoomedIn&&e!=="active"),await this.sparkScan.setEnabled(true),this.setState("active");}async switchToInactiveState(a){var t,i,r,o,h,s;(a.emitSuccessFeedback)!=null||(a.emitSuccessFeedback=true),this.setState("inactive"),a.barcodeFeedback&&await((t=this.sparkScanOverlay)==null?void 0:t.setBrush(this.brushForFeedback(a.barcodeFeedback))),await this.sparkScan.setEnabled(false),this.stateManager.scanningMode.previewBehavior==="persistent"?a.barcodeFeedback instanceof c&&await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(true)):await((r=this.camera)==null?void 0:r.switchToDesiredState(FrameSourceState.Standby)),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),await((o=this.sparkScanOverlay)==null?void 0:o.overlayReadyForDraw()),this.triggerButtonCollapseTimeout.start(),this.inactiveStateTimeout.stop(),(h=this.resumeCapturingTimeout)==null||h.stop(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c&&a.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(s=a.barcodeFeedback)==null?void 0:s.visualFeedbackColor),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToErrorState(a){var t,i,r,o;let e=a.barcodeFeedback.resumeCapturingDelay>0;e&&(this.setState("error"),this.stateManager.scanningBehavior="single",await this.sparkScan.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.resumeCapturingTimeout=new Timeout(a.barcodeFeedback.resumeCapturingDelay,async()=>{this.stateManager.state!=="active"&&await this.switchToActiveState();}),this.resumeCapturingTimeout.start()),await((i=this.sparkScanOverlay)==null?void 0:i.setErrorBrush(a.barcodeFeedback.brush)),await((r=this.sparkScanOverlay)==null?void 0:r.overlayReadyForDraw()),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(a.barcodeFeedback.resumeCapturingDelay===0)),await this.sparkScan.workerCommand("sparkScanEmitErrorFeedback",{shouldRemoveBrush:!e}),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),await this.sparkScanView.switchToErrorState(a.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled);}enableTargetModeLocationSelection(a){var r;let e=a?b$2.SparkScan.SparkScanSettings.targetModeLocationSelection.radius:b$2.SparkScan.SparkScanSettings.locationSelection.radius,t=a?b$2.SparkScan.SparkScanSettings.targetModeLocationSelection.unit:b$2.SparkScan.SparkScanSettings.locationSelection.unit,i=new NumberWithUnit(e,t);this.sparkScan.settings.locationSelection=new RadiusLocationSelection(i),(r=this.sparkScanOverlay)==null||r.setRadius(i);}enableTargetMode(a){this.enableTargetModeLocationSelection(a);}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,false),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,false),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,false);}setState(a){var e,t;a!==this.stateManager.state&&(this.stateManager.state=a,(t=(e=this.listener)==null?void 0:e.didChangeViewState)==null||t.call(e,a));}startTimeoutForCurrentState(){let a=this.stateTimeouts[this.stateManager.state];a==null||a.start();}};export{P as a};
|
|
1
|
+
import {a as a$2}from'./chunk-OTZPCIBD.js';import {a as a$3}from'./chunk-NKRL5HIU.js';import {a}from'./chunk-QCD3RIT4.js';import {a as a$5}from'./chunk-UKOWYLLZ.js';import {c as c$1,b as b$3}from'./chunk-SZUPDKV5.js';import {a as a$4}from'./chunk-XTOFHCOV.js';import {b}from'./chunk-JMUNN3HX.js';import {a as a$1,c,b as b$1}from'./chunk-P4F5WUAR.js';import {b as b$2}from'./chunk-DHCNYKSL.js';import {DataCaptureView,Anchor,LogoStyle,CameraAccess,Camera,isCameraFrameSource,FrameSourceState,Color,CameraPosition,TorchState,Logger,NumberWithUnit,RadiusLocationSelection}from'@scandit/web-datacapture-core';import {localStorage}from'@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';var P=class O{constructor(a$4,e,t,i){this.cameras=[];this.preferenceManager=new a(localStorage);this.defaultSuccessBrush=a$1.defaultSuccessBrush();this.defaultErrorBrush=a$1.defaultErrorBrush();this.sparkScanView=a$4,this.context=e,this.sparkScan=t,this.sparkScanViewSettings=i,this.stateManager=new a$2(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=a$3.withDefaults(i.soundEnabled,i.hapticEnabled),this.analyticsManager=b.forContext(e),this.triggerButtonCollapseTimeout=new Timeout(this.sparkScanViewSettings.triggerButtonCollapseTimeout,async()=>{this.stateManager.state!=="idle"&&await this.switchToIdleState({sessionStopReason:"timeout"});}),this.inactiveStateTimeout=new Timeout(i.inactiveStateTimeout,async()=>{this.stateManager.state!=="inactive"&&!this.stateManager.holdingToScan&&await this.switchToInactiveState({sessionStopReason:"timeout"});}),this.stateTimeouts={active:this.inactiveStateTimeout,inactive:this.triggerButtonCollapseTimeout},this.switchToIdleState();}get portraitOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateY)!=null?a:this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateY)!=null?a:this.defaultMiniPreviewTranslateY}get defaultTriggerButtonTranslateX(){return this.parentViewSizes.width-Math.min(this.parentViewSizes.width/3,110)-90/2}get defaultTriggerButtonTranslateY(){return this.parentViewSizes.height-Math.min(this.parentViewSizes.height/3,250)-90/2}get defaultMiniPreviewTranslateX(){return this.parentViewSizes.width-225-16}get parentViewSizes(){var a,e;return {width:(a=this.sparkScanView.parentElement.clientWidth)!=null?a:window.innerWidth,height:(e=this.sparkScanView.parentElement.clientHeight)!=null?e:window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(a,e,t,i){return new O(a,e,t,i)}async prepareScanning(a){var i;this.context.addListener(this),this.dataCaptureView=await DataCaptureView.forContext(this.context),this.dataCaptureView.logoAnchor=Anchor.BottomCenter,this.dataCaptureView.logoStyle=LogoStyle.Minimal,this.dataCaptureView.setHiddenProperty("stopVideoTracksOnVisibilityChange",false),this.dataCaptureView.setHiddenProperty("freezeFrameWhenStoppingFrameSource",false),this.dataCaptureView.connectToElement(a);let e=await CameraAccess.getCameras();this.cameras=e.map(r=>Camera.fromDeviceCamera(r)),this.camera=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(i=this.cameras.find(r=>r.position===this.sparkScanViewSettings.defaultCameraPosition))!=null?i:Camera.default,await this.camera.applySettings(a$4.recommendedCameraSettings),await this.context.setFrameSource(this.camera),await this.camera.switchToDesiredState(FrameSourceState.Standby);let t=await this.camera.isTorchAvailable();this.sparkScanView.setTorchAvailable(t),this.sparkScanView.setZoomAvailable(this.camera.isZoomAvailable()),this.sparkScanView.cameraSwitchButtonTapped(t,this.camera.position),await this.context.addMode(this.sparkScan),this.sparkScan.addListener(this),this.sparkScanOverlay=await a$5.withSparkScanForView(this.sparkScan,this.dataCaptureView),await this.sparkScanOverlay.setShouldRemoveLocationsAfterScan(this.stateManager.scanningBehavior==="continuous"),this.analyticsManager.startSession({cameraPosition:this.camera.position,handMode:"right",hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences();}async startScanning(){await this.switchToActiveState();}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:"user"});}async stopScanning(a){var e;await this.sparkScan.setEnabled(false),this.sparkScan.removeListener(this),await((e=this.camera)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),this.dataCaptureView.detachFromElement(),this.context.removeListener(this),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async onTriggerButtonPointerDown(){await this.sparkScan.setResultSuppressionEnabled(true);}async onTriggerButtonTap(){switch(await this.sparkScan.setResultSuppressionEnabled(false),this.stateManager.state){case "Initial":return;case "idle":case "inactive":case "error":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case "active":await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}):this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}}async onTriggerButtonLongPressStart(){var a;await this.sparkScan.setResultSuppressionEnabled(false),this.sparkScanViewSettings.holdToScanEnabled&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior="continuous",this.stateManager.holdingToScan=true,await((a=this.sparkScanOverlay)==null?void 0:a.setShouldRemoveLocationsAfterScan(true)),await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}async onTriggerButtonLongPressEnd(){var a,e;this.sparkScanViewSettings.holdToScanEnabled&&this.stateManager.state!=="error"&&(this.stateManager.scanningBehavior=(a=this.scanningBehaviorCache)!=null?a:"single",this.stateManager.holdingToScan=false,await((e=this.sparkScanOverlay)==null?void 0:e.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new b$1("",0,Color.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)}));}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState();}async onVisibilityChange(){await this.switchToIdleState();}async onTargetModeButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var h,s,S;e.emit();let i=String(a),r={true:a&&this.stateManager.scanningMode instanceof b$3,false:!a&&this.stateManager.scanningMode instanceof c$1}[i];r&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetMode(a),await((h=this.sparkScanOverlay)==null?void 0:h.setShouldDrawViewfinder(a)),this.startTimeoutForCurrentState(),this.sparkScanView.targetModeButtonTapped(a,t),r&&((S=(s=this.listener)==null?void 0:s.didChangeScanningMode)==null||S.call(s,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode));}async onScanningBehaviorButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var i;e.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(a?"continuous":"single"),await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(a)),this.startTimeoutForCurrentState(),this.sparkScanView.scanningBehaviorButtonTapped(a,t),this.analyticsManager.setScanningMode(this.stateManager.scanningMode);}async onBarcodeFindButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapBarcodeFindButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onLabelCaptureButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapLabelCaptureButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onCameraSwitchButtonTap(){if(this.feedbackManager.emitTapFeedback(),this.restartTimeouts(),!this.camera||this.stateManager.state==="error")return;let a={[CameraPosition.WorldFacing]:CameraPosition.UserFacing,[CameraPosition.UserFacing]:CameraPosition.WorldFacing}[this.camera.position],e=this.cameras.find(t=>t.position===a);e&&(await this.camera.switchToDesiredState(FrameSourceState.Off),await e.applySettings(this.camera.settings),await this.context.setFrameSource(e),await e.switchToDesiredState(FrameSourceState.On),this.sparkScanView.cameraSwitchButtonTapped(await e.isTorchAvailable(),a),this.analyticsManager.setCameraPosition(a),this.camera=e);}async onTorchButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var i;e.emit(),this.stateManager.torchState=a?TorchState.On:TorchState.Off,((i=this.camera)==null?void 0:i.getCurrentState())===FrameSourceState.On&&await this.camera.setDesiredTorchState(this.stateManager.torchState),this.startTimeoutForCurrentState(),this.sparkScanView.torchButtonTapped(a,t),this.analyticsManager.setTorchState(this.stateManager.torchState);}restartTimeouts(){for(let a of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])(a==null?void 0:a.running)===true&&a.start();}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:"user"});}onMiniPreviewResizeButtonTap(){(this.stateManager.state==="active"||this.stateManager.state==="inactive")&&(this.feedbackManager.emitTapFeedback(),this.startTimeoutForCurrentState());}async onMiniPreviewZoomButtonTap(a){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=a,this.camera&&(this.camera.settings.zoomFactor=a,await this.camera.applySettings(this.camera.settings)),this.startTimeoutForCurrentState();}async onMiniPreviewDrag(a,e){switch(this.stateManager.state==="active"&&await this.sparkScan.setEnabled(false),e){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationMiniPreviewTranslateX=a.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=a.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationMiniPreviewTranslateX=a.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=a.y;break}}this.restartTimeouts();}onMiniPreviewPointerMove(){this.restartTimeouts();}async onMiniPreviewPointerUp(){await this.switchToActiveState();}async onMiniPreviewDragEnd(){this.stateManager.state==="active"&&await this.sparkScan.setEnabled(true);}onTriggerButtonDrag(a,e){switch(e){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationTriggerButtonTranslateX=a.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=a.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationTriggerButtonTranslateX=a.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=a.y;break}}}async onOrientationChange(){if(this.stateManager.state==="active"&&this.stateManager.holdingToScan){this.restartTimeouts();return}this.stateManager.state==="error"&&await this.switchToInactiveState({sessionStopReason:"user"});}async didScan(a,e){if(!e.newlyRecognizedBarcode)return;let t=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(e.newlyRecognizedBarcode);t instanceof b$1?await this.switchToErrorState({barcodeFeedback:t}):t instanceof c&&await(this.stateManager.continuousModeEnabled?this.switchToActiveState({barcodeFeedback:t}):this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:t,emitSuccessFeedback:true})),this.restartTimeouts();}didChangeFrameSource(a,e){var t;if(isCameraFrameSource(e))this.camera=e;else {let i=(t=e==null?void 0:e.toJSONObject().type)!=null?t:"unknown";Logger.warn(`SparkScanView instances require a camera frame source to work, but a frame source of type "${i}" was found.`);}}setListener(a){this.listener=a;}brushForFeedback(a){return a.brush}async switchToIdleState(a={}){var e,t,i;this.feedbackManager.emitTapFeedback(),await((e=this.sparkScanOverlay)==null?void 0:e.overlayReadyForDraw()),this.setState("idle"),await this.sparkScan.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),(i=this.resumeCapturingTimeout)==null||i.stop(),this.sparkScanView.switchToIdleState(),a.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToActiveState(a={}){var t,i,r,o,h,s,S;let e=this.stateManager.state;await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.On)),await((i=this.camera)==null?void 0:i.setDesiredTorchState(this.stateManager.torchState)),a.barcodeFeedback&&await((r=this.sparkScanOverlay)==null?void 0:r.setBrush(this.brushForFeedback(a.barcodeFeedback))),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await((h=this.sparkScanOverlay)==null?void 0:h.overlayReadyForDraw()),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.stateManager.holdingToScan||this.inactiveStateTimeout.start(),this.triggerButtonCollapseTimeout.stop(),(s=this.resumeCapturingTimeout)==null||s.stop(),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c,this.stateManager.scanningBehavior,(S=a.barcodeFeedback)==null?void 0:S.visualFeedbackColor,this.stateManager.zoomedIn&&e!=="active"),await this.sparkScan.setEnabled(true),this.setState("active");}async switchToInactiveState(a){var t,i,r,o,h,s;(a.emitSuccessFeedback)!=null||(a.emitSuccessFeedback=true),this.setState("inactive"),a.barcodeFeedback&&await((t=this.sparkScanOverlay)==null?void 0:t.setBrush(this.brushForFeedback(a.barcodeFeedback))),await this.sparkScan.setEnabled(false),this.stateManager.scanningMode.previewBehavior==="persistent"?a.barcodeFeedback instanceof c&&await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(true)):await((r=this.camera)==null?void 0:r.switchToDesiredState(FrameSourceState.Standby)),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),await((o=this.sparkScanOverlay)==null?void 0:o.overlayReadyForDraw()),this.triggerButtonCollapseTimeout.start(),this.inactiveStateTimeout.stop(),(h=this.resumeCapturingTimeout)==null||h.stop(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c&&a.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(s=a.barcodeFeedback)==null?void 0:s.visualFeedbackColor),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToErrorState(a){var t,i,r,o;let e=a.barcodeFeedback.resumeCapturingDelay>0;e&&(this.setState("error"),this.stateManager.scanningBehavior="single",await this.sparkScan.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.resumeCapturingTimeout=new Timeout(a.barcodeFeedback.resumeCapturingDelay,async()=>{this.stateManager.state!=="active"&&await this.switchToActiveState();}),this.resumeCapturingTimeout.start()),await((i=this.sparkScanOverlay)==null?void 0:i.setErrorBrush(a.barcodeFeedback.brush)),await((r=this.sparkScanOverlay)==null?void 0:r.overlayReadyForDraw()),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(a.barcodeFeedback.resumeCapturingDelay===0)),await this.sparkScan.workerCommand("sparkScanEmitErrorFeedback",{shouldRemoveBrush:!e}),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),await this.sparkScanView.switchToErrorState(a.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled);}enableTargetModeLocationSelection(a){var r;let e=a?b$2.SparkScan.SparkScanSettings.targetModeLocationSelection.radius:b$2.SparkScan.SparkScanSettings.locationSelection.radius,t=a?b$2.SparkScan.SparkScanSettings.targetModeLocationSelection.unit:b$2.SparkScan.SparkScanSettings.locationSelection.unit,i=new NumberWithUnit(e,t);this.sparkScan.settings.locationSelection=new RadiusLocationSelection(i),(r=this.sparkScanOverlay)==null||r.setRadius(i);}enableTargetMode(a){this.enableTargetModeLocationSelection(a);}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,false),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,false),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,false);}setState(a){var e,t;a!==this.stateManager.state&&(this.stateManager.state=a,(t=(e=this.listener)==null?void 0:e.didChangeViewState)==null||t.call(e,a));}startTimeoutForCurrentState(){let a=this.stateTimeouts[this.stateManager.state];a==null||a.start();}};export{P as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-ZZQLFO35.js';import {a as a$7}from'./chunk-ZPCWOA3Y.js';import {a as a$6}from'./chunk-DQVSIMLI.js';import {a as a$9}from'./chunk-GBKJMQMZ.js';import {b as b$1}from'./chunk-4KRKVW3B.js';import {b}from'./chunk-DGF7ODRH.js';import {a as a$5}from'./chunk-7GJVUU3G.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$8}from'./chunk-NDQSQK6H.js';import {a as a$2}from'./chunk-TBEB6P5W.js';import {a as a$4}from'./chunk-LKQMBRKB.js';import {a as a$3}from'./chunk-Z5XSYMXM.js';import {Anchor,DataCaptureView,Direction,Point,Size}from'@scandit/web-datacapture-core';import {Backdrop}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Backdrop.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {calculateWidth,calculateHeight}from'@scandit/web-datacapture-core/build/js/private/utils/quadrilateralUtils.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';var q={async highlightForBarcode(R,w){let t=a$9.create(R);w(t);}},d=class d extends ScanditHTMLElement{constructor(){super(...arguments);this.torchIconButton=null;this.cameraSwitchButton=null;this.zoomButton=null;this.onTorchButtonClickHandler=this.onTorchButtonClick.bind(this);this.onCameraSwitchButtonHandler=this.onCameraSwitchButtonClick.bind(this);this.onZoomButtonHandler=this.onZoomButtonClick.bind(this);this.onLayoutPointerDownHandler=this.onLayoutPointerDown.bind(this);this.onInfoAnnotationTapHandler=this.onInfoAnnotationTap.bind(this);this.pendingDeletionTimeout=null;}set shouldShowZoomControl(t){this.zoomButton&&(this.zoomButton.hidden=!t);}get shouldShowZoomControl(){return this.zoomButton===null?false:!this.zoomButton.hidden}set shouldShowCameraSwitchControl(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}get shouldShowCameraSwitchControl(){return this.cameraSwitchButton===null?false:!this.cameraSwitchButton.hidden}set shouldShowTorchControl(t){this.torchIconButton!==null&&(this.torchIconButton.hidden=!t);}get shouldShowTorchControl(){return this.torchIconButton===null?false:!this.torchIconButton.hidden}set torchControlPosition(t){var o;(o=this.torchIconButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var o,e;let t=(e=(o=this.torchIconButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var o;(o=this.zoomButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.BottomRight:t.replace("controls-","")}set cameraSwitchControlPosition(t){var o;(o=this.cameraSwitchButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,o,e,r,n){d.register();let i=document.createElement(d.tag);return i.barcodeArViewSettings=r,i.layout=a.create(),i.append(i.layout),a$1(t)?(i.dataCaptureView=t,i.dataCaptureView.containerElement.prepend(i),await t.setContext(o)):(i.dataCaptureView=await DataCaptureView.forContext(o),i.dataCaptureView.connectToElement(t),i.dataCaptureView.containerElement.prepend(i)),i.presenter=new a$2(i,o,e,r,n!=null?n:a$3.createRecommendedCameraSettings()),await i.presenter.prepare(),i}static async create(t,o,e){return d.createWithSettings(t,o,e,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$7.tag]:a$7,[a$6.tag]:a$6,[a$5.tag]:a$5,[d.tag]:d,[Backdrop.tag]:Backdrop});}static createStyleElement(){return css`[data-could-be-deleted=true]{display:none!important}[data-on-foreground=true]{z-index:3}${d.tag}{inset:0;position:absolute;z-index:1}`}async start(){return this.presenter.startSearching()}async stop(){return this.presenter.stopSearching()}async pause(){return this.presenter.pauseSearching()}reset(){this.deletePendingViews(),this.deleteAllViews();}toggleTorchIcon(t){this.torchIconButton!==null&&(this.torchIconButton.state=t);}onTorchButtonClick(){this.presenter.onTorchButtonClicked();}onCameraSwitchButtonClick(){this.presenter.onCameraSwitchButtonClicked();}onZoomButtonClick(){this.presenter.onZoomButtonClicked();}changeZoomButtonIcon(t){this.zoomButton&&(this.zoomButton.zoom=`${t}x`);}connectedCallback(){this.torchIconButton=a$5.create(),this.torchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchIconButton.hidden=true,this.torchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$7.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.zoomButton=a$6.create(),this.zoomButton.slot=`controls-${this.zoomControlPosition}`,this.zoomButton.hidden=true,this.zoomButton.addEventListener("pointerdown",this.onZoomButtonHandler),this.layout.append(this.torchIconButton,this.cameraSwitchButton,this.zoomButton),this.layout.addEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.addEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler),this.backdrop=Backdrop.create(),this.layout.append(this.backdrop),this.pendingDeletionTimeout=new Timeout(1e3,()=>{this.deletePendingViews();}),this.prepend(d.createStyleElement());}disconnectedCallback(){var t,o,e;this.deleteAllViews(),(t=this.torchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(o=this.cameraSwitchButton)==null||o.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(e=this.zoomButton)==null||e.removeEventListener("pointerdown",this.onZoomButtonHandler),this.layout.removeEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.removeEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler);}isPopoverAnnotation(t){return t instanceof b}isAnnotation(t){var o;return ((o=t.dataset)==null?void 0:o.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let o=t.target,e=o==null?void 0:o.closest("[data-identifier$='-highlight']"),r=o==null?void 0:o.closest(b.tag);if((e==null?void 0:e.dataset.id)!=null){await this.handleHighlightClick(e);return}if((r==null?void 0:r.dataset.id)!=null){await this.handleAnnotationClick(r);return}await this.handleClickOutside();}async handleHighlightClick(t){this.presenter.emitTappedFeedback();let o=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));o&&(this.isPopoverAnnotation(o)?await this.handlePopoverHighlightClick(o,t):o.hidden=!o.hidden);}async handlePopoverHighlightClick(t,o){var e;if(!this.areMultiplePopoverAllowed()){let r=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(e=r==null?void 0:r.dataset.identifier)==null?void 0:e.replace("-annotation","-highlight"),i=this.layout.querySelector(`[data-identifier="${n}"]`);r!=null&&i!=null&&await this.hideBarcodeArPopover(r,i,false);}await this.toggleBarcodeArPopover(t,o);}async handleAnnotationClick(t){var r;let o=(r=t.dataset.identifier)==null?void 0:r.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.toggleBarcodeArPopover(t,e);}async handleClickOutside(){var r;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let o=(r=t.dataset.identifier)==null?void 0:r.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.hideBarcodeArPopover(t,e);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,o){t.dataset.onForeground="true",t.hidden=false,o.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,o,e=true){t.dataset.onForeground="false",t.hidden=true,o&&(o.dataset.onForeground="false"),e&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(o=>o.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,o){t.hidden?await this.showBarcodeArPopover(t,o):await this.hideBarcodeArPopover(t,o);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var o,e,r;await((e=(o=this.highlightProvider)!=null?o:q)==null?void 0:e.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((r=this.annotationProvider)==null?void 0:r.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,o){let e=o,r=a$8(t),n=this.queryAnnotationByDataId(r);if(n)n.dataset.couldBeDeleted="false";else {if(e.dataset.id=r,e.dataset.identifier=this.identifierForAnnotation(t.identifier),e.hidden=true,this.layout.append(e),this.isPopoverAnnotation(e)){if(e.direction=Direction.Vertical,e.anchor==null&&(e.anchor="bottom-center"),this.areMultiplePopoverAllowed()||e.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(r);if(!i)return;this.showBarcodeArPopover(e,i);}}else {let i=e;i.hidden=i.annotationTrigger==="highlightTap";}this.updateAnnotationPosition(t,e);}}async onHighlight(t,o){let e=a$8(t),r=this.queryHighlightByDataId(e);r?r.dataset.couldBeDeleted="false":(o.dataset.id=e,o.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,o),this.layout.append(o));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var r,n,i,P,h;let o=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of o)u.dataset.couldBeDeleted="true";(r=this.pendingDeletionTimeout)!=null&&r.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let e=new Set(t.removedTrackedBarcodes);for(let u of o){let p=(i=u.dataset.identifier)==null?void 0:i.replace("-highlight","").replace("-annotation","");p!=null&&e.has(p)&&(u.dataset.couldBeDeleted="true");}(P=this.pendingDeletionTimeout)!=null&&P.running||(h=this.pendingDeletionTimeout)==null||h.start();}render(t){for(let[o,e]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[o]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(e);let r=a$8(e),n=this.queryAnnotationByDataId(r),i=this.queryHighlightByDataId(r);i&&(this.updateBrushSize(i,e),this.updateHighlightPosition(e,i)),n&&this.updateAnnotationPosition(e,n,i);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,o,e="center"){if(o.hidden)return;let r=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(r,e);o.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(r.topLeft,r.topRight));}updateBrushSize(t,o){if(t.width==null||t.height==null)return;let e=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(o.anchorPositions),r=Math.round(calculateWidth(e)),n=Math.round(calculateHeight(e));t.width!==r&&(t.width=r),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,o,e){var p,y;let n=t.orderVerticesByPosition(),i=this.normalizedViewPointFromFrameAnchorPositions(t,"center"),h={"bottom-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"topCenter");return new Point(s.x,s.y-7)},"top-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"bottomCenter");return new Point(s.x,s.y+7)},"right-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerLeft");return new Point(s.x-7,s.y)},"left-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerRight");return new Point(s.x+7,s.y)}}[o]();return e?e instanceof b$1?(p={"bottom-center":new Point(i.x,i.y-7-e.clientHeight/2),"top-center":new Point(i.x,i.y+7+e.clientHeight/2),"right-center":new Point(i.x-7-e.clientWidth/2,i.y),"left-center":new Point(i.x+7+e.clientWidth/2,i.y)}[o])!=null?p:h:(y={"bottom-center":new Point(i.x,i.y-7-e.clientHeight/2),"top-center":new Point(i.x,i.y+7+e.clientHeight/2),"right-center":new Point(i.x-7-e.clientWidth/2,i.y),"left-center":new Point(i.x+7+e.clientWidth/2,i.y)}[o])!=null?y:h:h}updateAnnotationPosition(t,o,e){let r=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);o.anchor||(o.anchor="top-center");let n=this.getTransformOrigin(o.anchor),i=this.calculateAnnotationPosition(r,o.anchor,e);o.updatePosition(i,n,this.calculateRotationAngle(r.topLeft,r.topRight));}normalizedViewPointFromFrameAnchorPositions(t,o="center"){let e=this.presenter.currentCamera.getMirrorImageEnabled(),r=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(e){let i=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[o]];return Point.mirrorX(i,r)}return t[o]}calculateRotationAngle(t,o){let e=o.x-t.x,r=-(o.y-t.y),n=Math.atan2(r,e);return Math.round(n*(180/Math.PI))}};d.tag="scandit-barcode-ar-view";var k=d;export{k as a};
|
|
1
|
+
import {a}from'./chunk-ZZQLFO35.js';import {a as a$7}from'./chunk-ZPCWOA3Y.js';import {a as a$6}from'./chunk-DQVSIMLI.js';import {a as a$9}from'./chunk-GBKJMQMZ.js';import {b as b$1}from'./chunk-4KRKVW3B.js';import {b}from'./chunk-DGF7ODRH.js';import {a as a$5}from'./chunk-7GJVUU3G.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$8}from'./chunk-NDQSQK6H.js';import {a as a$2}from'./chunk-HW5KYM65.js';import {a as a$4}from'./chunk-LKQMBRKB.js';import {a as a$3}from'./chunk-WX5YVCZZ.js';import {Anchor,DataCaptureView,Direction,Point,Size}from'@scandit/web-datacapture-core';import {Backdrop}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Backdrop.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {calculateWidth,calculateHeight}from'@scandit/web-datacapture-core/build/js/private/utils/quadrilateralUtils.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';var q={async highlightForBarcode(R,w){let t=a$9.create(R);w(t);}},d=class d extends ScanditHTMLElement{constructor(){super(...arguments);this.torchIconButton=null;this.cameraSwitchButton=null;this.zoomButton=null;this.onTorchButtonClickHandler=this.onTorchButtonClick.bind(this);this.onCameraSwitchButtonHandler=this.onCameraSwitchButtonClick.bind(this);this.onZoomButtonHandler=this.onZoomButtonClick.bind(this);this.onLayoutPointerDownHandler=this.onLayoutPointerDown.bind(this);this.onInfoAnnotationTapHandler=this.onInfoAnnotationTap.bind(this);this.pendingDeletionTimeout=null;}set shouldShowZoomControl(t){this.zoomButton&&(this.zoomButton.hidden=!t);}get shouldShowZoomControl(){return this.zoomButton===null?false:!this.zoomButton.hidden}set shouldShowCameraSwitchControl(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}get shouldShowCameraSwitchControl(){return this.cameraSwitchButton===null?false:!this.cameraSwitchButton.hidden}set shouldShowTorchControl(t){this.torchIconButton!==null&&(this.torchIconButton.hidden=!t);}get shouldShowTorchControl(){return this.torchIconButton===null?false:!this.torchIconButton.hidden}set torchControlPosition(t){var o;(o=this.torchIconButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var o,e;let t=(e=(o=this.torchIconButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var o;(o=this.zoomButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.BottomRight:t.replace("controls-","")}set cameraSwitchControlPosition(t){var o;(o=this.cameraSwitchButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,o,e,r,n){d.register();let i=document.createElement(d.tag);return i.barcodeArViewSettings=r,i.layout=a.create(),i.append(i.layout),a$1(t)?(i.dataCaptureView=t,i.dataCaptureView.containerElement.prepend(i),await t.setContext(o)):(i.dataCaptureView=await DataCaptureView.forContext(o),i.dataCaptureView.connectToElement(t),i.dataCaptureView.containerElement.prepend(i)),i.presenter=new a$2(i,o,e,r,n!=null?n:a$3.createRecommendedCameraSettings()),await i.presenter.prepare(),i}static async create(t,o,e){return d.createWithSettings(t,o,e,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$7.tag]:a$7,[a$6.tag]:a$6,[a$5.tag]:a$5,[d.tag]:d,[Backdrop.tag]:Backdrop});}static createStyleElement(){return css`[data-could-be-deleted=true]{display:none!important}[data-on-foreground=true]{z-index:3}${d.tag}{inset:0;position:absolute;z-index:1}`}async start(){return this.presenter.startSearching()}async stop(){return this.presenter.stopSearching()}async pause(){return this.presenter.pauseSearching()}reset(){this.deletePendingViews(),this.deleteAllViews();}toggleTorchIcon(t){this.torchIconButton!==null&&(this.torchIconButton.state=t);}onTorchButtonClick(){this.presenter.onTorchButtonClicked();}onCameraSwitchButtonClick(){this.presenter.onCameraSwitchButtonClicked();}onZoomButtonClick(){this.presenter.onZoomButtonClicked();}changeZoomButtonIcon(t){this.zoomButton&&(this.zoomButton.zoom=`${t}x`);}connectedCallback(){this.torchIconButton=a$5.create(),this.torchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchIconButton.hidden=true,this.torchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$7.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.zoomButton=a$6.create(),this.zoomButton.slot=`controls-${this.zoomControlPosition}`,this.zoomButton.hidden=true,this.zoomButton.addEventListener("pointerdown",this.onZoomButtonHandler),this.layout.append(this.torchIconButton,this.cameraSwitchButton,this.zoomButton),this.layout.addEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.addEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler),this.backdrop=Backdrop.create(),this.layout.append(this.backdrop),this.pendingDeletionTimeout=new Timeout(1e3,()=>{this.deletePendingViews();}),this.prepend(d.createStyleElement());}disconnectedCallback(){var t,o,e;this.deleteAllViews(),(t=this.torchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(o=this.cameraSwitchButton)==null||o.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(e=this.zoomButton)==null||e.removeEventListener("pointerdown",this.onZoomButtonHandler),this.layout.removeEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.removeEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler);}isPopoverAnnotation(t){return t instanceof b}isAnnotation(t){var o;return ((o=t.dataset)==null?void 0:o.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let o=t.target,e=o==null?void 0:o.closest("[data-identifier$='-highlight']"),r=o==null?void 0:o.closest(b.tag);if((e==null?void 0:e.dataset.id)!=null){await this.handleHighlightClick(e);return}if((r==null?void 0:r.dataset.id)!=null){await this.handleAnnotationClick(r);return}await this.handleClickOutside();}async handleHighlightClick(t){this.presenter.emitTappedFeedback();let o=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));o&&(this.isPopoverAnnotation(o)?await this.handlePopoverHighlightClick(o,t):o.hidden=!o.hidden);}async handlePopoverHighlightClick(t,o){var e;if(!this.areMultiplePopoverAllowed()){let r=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(e=r==null?void 0:r.dataset.identifier)==null?void 0:e.replace("-annotation","-highlight"),i=this.layout.querySelector(`[data-identifier="${n}"]`);r!=null&&i!=null&&await this.hideBarcodeArPopover(r,i,false);}await this.toggleBarcodeArPopover(t,o);}async handleAnnotationClick(t){var r;let o=(r=t.dataset.identifier)==null?void 0:r.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.toggleBarcodeArPopover(t,e);}async handleClickOutside(){var r;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let o=(r=t.dataset.identifier)==null?void 0:r.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.hideBarcodeArPopover(t,e);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,o){t.dataset.onForeground="true",t.hidden=false,o.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,o,e=true){t.dataset.onForeground="false",t.hidden=true,o&&(o.dataset.onForeground="false"),e&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(o=>o.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,o){t.hidden?await this.showBarcodeArPopover(t,o):await this.hideBarcodeArPopover(t,o);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var o,e,r;await((e=(o=this.highlightProvider)!=null?o:q)==null?void 0:e.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((r=this.annotationProvider)==null?void 0:r.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,o){let e=o,r=a$8(t),n=this.queryAnnotationByDataId(r);if(n)n.dataset.couldBeDeleted="false";else {if(e.dataset.id=r,e.dataset.identifier=this.identifierForAnnotation(t.identifier),e.hidden=true,this.layout.append(e),this.isPopoverAnnotation(e)){if(e.direction=Direction.Vertical,e.anchor==null&&(e.anchor="bottom-center"),this.areMultiplePopoverAllowed()||e.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(r);if(!i)return;this.showBarcodeArPopover(e,i);}}else {let i=e;i.hidden=i.annotationTrigger==="highlightTap";}this.updateAnnotationPosition(t,e);}}async onHighlight(t,o){let e=a$8(t),r=this.queryHighlightByDataId(e);r?r.dataset.couldBeDeleted="false":(o.dataset.id=e,o.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,o),this.layout.append(o));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var r,n,i,P,h;let o=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of o)u.dataset.couldBeDeleted="true";(r=this.pendingDeletionTimeout)!=null&&r.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let e=new Set(t.removedTrackedBarcodes);for(let u of o){let p=(i=u.dataset.identifier)==null?void 0:i.replace("-highlight","").replace("-annotation","");p!=null&&e.has(p)&&(u.dataset.couldBeDeleted="true");}(P=this.pendingDeletionTimeout)!=null&&P.running||(h=this.pendingDeletionTimeout)==null||h.start();}render(t){for(let[o,e]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[o]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(e);let r=a$8(e),n=this.queryAnnotationByDataId(r),i=this.queryHighlightByDataId(r);i&&(this.updateBrushSize(i,e),this.updateHighlightPosition(e,i)),n&&this.updateAnnotationPosition(e,n,i);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,o,e="center"){if(o.hidden)return;let r=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(r,e);o.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(r.topLeft,r.topRight));}updateBrushSize(t,o){if(t.width==null||t.height==null)return;let e=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(o.anchorPositions),r=Math.round(calculateWidth(e)),n=Math.round(calculateHeight(e));t.width!==r&&(t.width=r),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,o,e){var p,y;let n=t.orderVerticesByPosition(),i=this.normalizedViewPointFromFrameAnchorPositions(t,"center"),h={"bottom-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"topCenter");return new Point(s.x,s.y-7)},"top-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"bottomCenter");return new Point(s.x,s.y+7)},"right-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerLeft");return new Point(s.x-7,s.y)},"left-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerRight");return new Point(s.x+7,s.y)}}[o]();return e?e instanceof b$1?(p={"bottom-center":new Point(i.x,i.y-7-e.clientHeight/2),"top-center":new Point(i.x,i.y+7+e.clientHeight/2),"right-center":new Point(i.x-7-e.clientWidth/2,i.y),"left-center":new Point(i.x+7+e.clientWidth/2,i.y)}[o])!=null?p:h:(y={"bottom-center":new Point(i.x,i.y-7-e.clientHeight/2),"top-center":new Point(i.x,i.y+7+e.clientHeight/2),"right-center":new Point(i.x-7-e.clientWidth/2,i.y),"left-center":new Point(i.x+7+e.clientWidth/2,i.y)}[o])!=null?y:h:h}updateAnnotationPosition(t,o,e){let r=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);o.anchor||(o.anchor="top-center");let n=this.getTransformOrigin(o.anchor),i=this.calculateAnnotationPosition(r,o.anchor,e);o.updatePosition(i,n,this.calculateRotationAngle(r.topLeft,r.topRight));}normalizedViewPointFromFrameAnchorPositions(t,o="center"){let e=this.presenter.currentCamera.getMirrorImageEnabled(),r=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(e){let i=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[o]];return Point.mirrorX(i,r)}return t[o]}calculateRotationAngle(t,o){let e=o.x-t.x,r=-(o.y-t.y),n=Math.atan2(r,e);return Math.round(n*(180/Math.PI))}};d.tag="scandit-barcode-ar-view";var k=d;export{k as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-3W2UC3XN.js';import {a}from'./chunk-LKZBVQXD.js';import {Localization}from'@scandit/web-datacapture-core';import {normalizeLibraryLocation}from'@scandit/web-datacapture-core/build/js/private/Helper.js';function b(r){return Localization.getInstance().updateIfMissing({...a}),r!=null&&r.libraryLocation&&(r.libraryLocation=normalizeLibraryLocation(r.libraryLocation)),{moduleName:"BarcodeCapture",load:async n=>{var e,o;let a=n;return await a$1.create({...a,libraryLocation:(e=r==null?void 0:r.libraryLocation)!=null?e:a.libraryLocation,highEndBlurryRecognition:(o=r==null?void 0:r.highEndBlurryRecognition)!=null?o:false})}}}export{b as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-5T3ORYHD.js';import {TorchState,isCameraFrameSource,Camera,FrameSourceState,CameraPosition}from'@scandit/web-datacapture-core';var n=class{constructor(e,t,o,d,h){this.torchState=TorchState.Off;this.cameraSupportMap=new Map;this.zoomFactor=1;this.view=e,this.context=t,this.barcodeAr=o,this.viewSettings=d,this.cameraSettings=h;}get currentCamera(){if(isCameraFrameSource(this.context.frameSource))return this.context.frameSource;throw new Error("The current frame source is not a Camera")}async prepare(){await this.barcodeAr.setEnabled(false),this.barcodeAr.feedback=await a.createWithOptions(true,true),this.barcodeAr.addPrivateListener(this);let e=Camera.atPosition(this.viewSettings.defaultCameraPosition);await this.context.setFrameSource(e),await this.currentCamera.applySettings(this.cameraSettings),await this.currentCamera.switchToDesiredState(FrameSourceState.Standby),this.zoomFactor=this.currentCamera.settings.zoomFactor,this.view.changeZoomButtonIcon(this.zoomFactor);}async dispose(){var e;this.view.deleteAllViews(),await this.context.removeMode(this.barcodeAr),this.barcodeAr.removePrivateListener(this),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off));}async startSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.On)),await this.barcodeAr.setEnabled(true),await this.barcodeAr.start();}async stopSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.stop();}async pauseSearching(){var e;this.view.deletePendingViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Standby)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.pause();}emitTappedFeedback(){this.barcodeAr.feedback.tapped.emit();}didUpdateSession(e,t){Object.keys(t.addedTrackedBarcodes).length>0&&this.barcodeAr.feedback.scanned.emit(),this.view.render(t);}async onTorchButtonClicked(){var e,t;this.cameraSupportMap.get(this.currentCamera.label)||this.cameraSupportMap.set(this.currentCamera.label,{torch:await this.currentCamera.isTorchAvailable()}),(t=(e=this.cameraSupportMap.get(this.currentCamera.label))==null?void 0:e.torch)!=null&&t&&(await this.currentCamera.setDesiredTorchState(this.torchState===TorchState.Off?TorchState.On:TorchState.Off),this.torchState=this.torchState===TorchState.Off?TorchState.On:TorchState.Off,this.view.toggleTorchIcon(this.torchState));}async onZoomButtonClicked(){var t;if(!this.currentCamera.isZoomAvailable())return;let e=(t={1:2,2:1}[this.zoomFactor])!=null?t:1;this.currentCamera.settings.zoomFactor=e,await this.currentCamera.applySettings(this.currentCamera.settings),this.zoomFactor=e,this.view.changeZoomButtonIcon(e);}async onCameraSwitchButtonClicked(){let e=this.currentCamera.getCurrentState(),t=Camera.atPosition(this.currentCamera.position===CameraPosition.UserFacing?CameraPosition.WorldFacing:CameraPosition.UserFacing);await this.context.setFrameSource(t),await this.currentCamera.switchToDesiredState(e);}};export{n as a};
|