(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0dd9f2"],{"81be":function(e,t,n){"use strict";n.r(t),n.d(t,"BarcodeScannerWeb",(function(){return r}));var i=n("1547"),o=n("2682");class r extends i["c"]{constructor(){super(...arguments),this._isSupported="BarcodeDetector"in window,this.errorVideoElementMissing="videoElement must be provided.",this.errorBlobMissing="blob must be provided.",this.eventBarcodesScanned="barcodesScanned"}async startScan(e){if(!this._isSupported)throw this.createUnavailableException();if(!(null===e||void 0===e?void 0:e.videoElement))throw new Error(this.errorVideoElementMissing);this.videoElement=e.videoElement,this.stream=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:(null===e||void 0===e?void 0:e.lensFacing)===o["b"].Front?"user":"environment"}},audio:!1}),e.videoElement.srcObject=this.stream,await e.videoElement.play();const t=new BarcodeDetector;this.intervalId=window.setInterval(async()=>{if(!e.videoElement)return;const n=await t.detect(e.videoElement);0!==n.length&&this.handleScannedBarcodes(n)},500)}async stopScan(){if(!this._isSupported)throw this.createUnavailableException();this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.stream&&(this.stream.getTracks().forEach(e=>e.stop()),this.stream=void 0),this.videoElement&&(this.videoElement.srcObject=null,this.videoElement=void 0)}async readBarcodesFromImage(e){var t;if(!this._isSupported)throw this.createUnavailableException();if(!e.blob)throw new Error(this.errorBlobMissing);const n=null===(t=e.formats)||void 0===t?void 0:t.map(e=>e.toLowerCase()),i=new BarcodeDetector((null===n||void 0===n?void 0:n.length)?{formats:n}:void 0),o=await createImageBitmap(e.blob),r=await i.detect(o);return{barcodes:this.convertDetectedBarcodesToBarcodes(r)}}async scan(){throw this.createUnimplementedException()}async isSupported(){return{supported:this._isSupported}}async enableTorch(){throw this.createUnimplementedException()}async disableTorch(){throw this.createUnimplementedException()}async toggleTorch(){throw this.createUnimplementedException()}async isTorchEnabled(){throw this.createUnimplementedException()}async isTorchAvailable(){return{available:!1}}async setZoomRatio(e){throw this.createUnimplementedException()}async getZoomRatio(){throw this.createUnimplementedException()}async getMinZoomRatio(){throw this.createUnimplementedException()}async getMaxZoomRatio(){throw this.createUnimplementedException()}async openSettings(){throw this.createUnimplementedException()}async isGoogleBarcodeScannerModuleAvailable(){throw this.createUnimplementedException()}async installGoogleBarcodeScannerModule(){throw this.createUnimplementedException()}async checkPermissions(){try{const e=await navigator.permissions.query({name:"camera"});return{camera:e.state}}catch(e){return{camera:"prompt"}}}async requestPermissions(){try{const e=await navigator.mediaDevices.getUserMedia({video:!0});return e.getTracks().forEach(e=>e.stop()),{camera:"granted"}}catch(e){return{camera:"denied"}}}createUnavailableException(){return new i["a"]("This plugin method is not available on this platform.",i["b"].Unavailable)}createUnimplementedException(){return new i["a"]("This method is not implemented on web.",i["b"].Unimplemented)}handleScannedBarcodes(e){const t={barcodes:this.convertDetectedBarcodesToBarcodes(e)};this.notifyListeners(this.eventBarcodesScanned,t)}convertDetectedBarcodesToBarcodes(e){return e.map(e=>({cornerPoints:[[e.cornerPoints[0].x,e.cornerPoints[0].y],[e.cornerPoints[1].x,e.cornerPoints[1].y],[e.cornerPoints[2].x,e.cornerPoints[2].y],[e.cornerPoints[3].x,e.cornerPoints[3].y]],displayValue:e.rawValue,rawValue:e.rawValue,format:e.format.toUpperCase(),valueType:o["a"].Unknown}))}}}}]);