text: (function(n){n.extend({bb_vibrate:function(){if("vibrate"in window.navigator){window.navigator.vibrate([200,100,200]);var n=window.setTimeout(function(){window.clearTimeout(n);window.navigator.vibrate([])},1e3)}},bb_barcode:function(t,i,r,u){var f=n(t),e=new ZXing.BrowserMultiFormatReader;if(r==="dispose"){e.reset();return}f.attr("data-scan")==="Camera"&&e.getVideoInputDevices().then(n=>{i.invokeMethodAsync("InitDevices",n).then(()=>{if(u&&n.length>0){var t=f.find('button[data-method="scan"]'),i=f.attr("data-scan");i==="Camera"&&t.trigger("click")}})});f.on("click","button[data-method]",function(){var r=n(this).attr("data-method"),o,s,u,t;if(r==="scan")i.invokeMethodAsync("Start"),o=f.find(".dropdown-item.active").attr("data-val"),s=f.find("video").attr("id"),e.decodeFromVideoDevice(o,s,(t,r)=>{if(t){n.bb_vibrate();console.log(t.text);i.invokeMethodAsync("GetResult",t.text);var u=f.attr("data-autostop")==="true";u&&e.reset()}!r||r instanceof ZXing.NotFoundException||(console.error(r),i.invokeMethodAsync("GetError",r))});else if(r==="scanImage"){e=new ZXing.BrowserMultiFormatReader;f.find(":file").remove();u=n(".scanner-image");t=n('<input type="file" hidden accept="image/*">');f.append(t);t.on("change",function(){if(this.files.length!==0){var t=new FileReader;t.onloadend=function(t){u.attr("src",t.target.result);e.decodeFromImage(u[0]).then(t=>{t&&(n.bb_vibrate(),console.log(t.text),i.invokeMethodAsync("GetResult",t.text))}).catch(n=>{n&&(console.log(n),i.invokeMethodAsync("GetError",n.message))})};t.readAsDataURL(this.files[0])}});t.trigger("click")}else r==="close"&&(e.reset(),i.invokeMethodAsync("Stop"))})}})})(jQuery);