UNPKG

@scandit/web-datacapture-barcode

Version:

Scandit Data Capture SDK for the Web

1 lines • 2.29 kB
import{defaultSymbologies as e}from"../defaults/DefaultsSymbologies.js";import"../ScanIntention.js";import{ensureSmartScanIntentionSupport as t}from"../private/smartScanIntentionHelper.js";import"../SelectionMode.js";import{defaultSparkScan as n}from"../defaults/DefaultsSparkScan.js";import{NumberWithUnit as r,RadiusLocationSelection as i}from"@scandit/web-datacapture-core";const a=`manual`;var o=class{constructor(){this.codeDuplicateFilter=n.SparkScanSettings.codeDuplicateFilter,this.enabledCompositeTypes=[],this.selectionMode=`off`,this._scanIntention=a,this._scanIntentionExplicitlySet=!1,this.locationSelection=new i(new r(n.SparkScanSettings.locationSelection.radius,n.SparkScanSettings.locationSelection.unit)),this.properties={},this.symbologies={}}get scanIntention(){return this._scanIntention}set scanIntention(e){this._scanIntention=e??void 0,this._scanIntentionExplicitlySet=e!=null}_resolveScanIntention(e){this._scanIntentionExplicitlySet||(this._scanIntention=this.selectionMode===`auto`?`smart`:a),this._scanIntention=t({scanIntention:this._scanIntention},e).scanIntention}get enabledSymbologies(){return Object.keys(this.symbologies).filter(e=>{var t;return(t=this.symbologies[e])==null?void 0:t.isEnabled})}get compositeTypeDescriptions(){return e.CompositeTypeDescriptions.reduce((e,t)=>(e[t.types[0]]=t,e),{})}settingsForSymbology(t){if(!this.symbologies[t]){let n=e.SymbologySettings[t];n._symbology=t,this.symbologies[t]=n}return this.symbologies[t]}setProperty(e,t){this.properties[e]=t}getProperty(e){return this.properties[e]}enableSymbologies(e){for(let t of e)this.enableSymbology(t,!0)}enableSymbology(e,t){this.settingsForSymbology(e).isEnabled=t}enableSymbologiesForCompositeTypes(e){for(let t of e)this.enableSymbologies(this.compositeTypeDescriptions[t].symbologies)}toJSONObject(){let e={},t=Object.keys(this.symbologies);return{codeDuplicateFilter:this.codeDuplicateFilter,enabledCompositeTypes:[...this.enabledCompositeTypes],locationSelection:this.locationSelection.toJSONObject(),properties:{...this.properties},symbologies:t.reduce((e,t)=>{var n;let r=(n=this.symbologies[t])==null?void 0:n.toJSONObject();return r&&(e[t]=r),e},e),scanIntention:this.scanIntention??null,selectionMode:this.selectionMode??null}}};export{o as SparkScanSettings};