import {a}from'./chunk-SYDG6PPD.js';import {NumberWithUnit,RectangularLocationSelection,SizeWithUnit}from'@scandit/web-datacapture-core';import {nativeHandle}from'@scandit/web-datacapture-core/build/js/private/nativeHandle.js';var p=class p{constructor(e,t){this[nativeHandle]=e,this.workerCommand=t;}static async fromLabelDefinitions(e){let t=new l;for(let n of e)t.addLabel(n);return t.build()}static forHandle(e,t){return new p(e,t)}async getLocationSelection(){let e=await this.workerCommand("labelCaptureSettingsGetLocationSelection",{payload:{settingsHandle:this[nativeHandle]}});if(e!=null){if(e.size.width!=null&&e.size.aspect!=null){let t=NumberWithUnit.fromJSON(e.size.width);return RectangularLocationSelection.withWidthAndAspectRatio(t,e.size.aspect)}if(e.size.height!=null&&e.size.aspect!=null){let t=NumberWithUnit.fromJSON(e.size.height);return RectangularLocationSelection.withHeightAndAspectRatio(t,e.size.aspect)}if(e.size.width!=null&&e.size.height!=null){let t=NumberWithUnit.fromJSON(e.size.width),n=NumberWithUnit.fromJSON(e.size.height);return RectangularLocationSelection.withSize(new SizeWithUnit(t,n))}}}async setLocationSelection(e){e instanceof RectangularLocationSelection&&await this.workerCommand("labelCaptureSettingsSetLocationSelection",{payload:{settingsHandle:this[nativeHandle],locationSelection:e.toJSONObject()}});}async getProperty(e){return await this.workerCommand("labelCaptureSettingsGetProperty",{payload:{settingsHandle:this[nativeHandle],key:e}})}async setProperty(e,t){await this.workerCommand("labelCaptureSettingsSetProperty",{payload:{settingsHandle:this[nativeHandle],key:e,value:t}});}async getBlueprintJSON(){let e=await this.workerCommand("labelCaptureSettingsGetBlueprintJson",{payload:{settingsHandle:this[nativeHandle]}});return JSON.parse(e)}},s=p,l=class{constructor(){this.labelDefinitions=[];this.hiddenProperties={};}addLabel(e){return this.labelDefinitions.push(e),this}setHiddenProperty(e,t){return this.hiddenProperties[e]=t,this}setHiddenProperties(e){return this.hiddenProperties=e,this}setLabelProperties(e){return this.labelProperties=e,this}async build(){let e=a().workerCommand.bind(a()),t=await e("labelCaptureBuildLabelCaptureSettings",{payload:{hiddenProperties:this.hiddenProperties,labelDefinitionHandles:this.labelDefinitions.map(n=>n[nativeHandle]),labelProperties:this.labelProperties}});return s.forHandle(t,e)}};export{s as a,l as b};