dynamsoft-mrz-scanner
Version:
Dynamsoft MRZ Scanner JavaScript Edition is a ready-to-use SDK for web applications that accurately recognizes and parses Machine-Readable Zones on Machine-Readable Travel Documents.
3 lines • 413 kB
JavaScript
(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=e=>e&&typeof e==`object`&&typeof e.then==`function`,n=(async()=>{})().constructor,r=class extends n{get status(){return this._s}get isPending(){return this._s===`pending`}get isFulfilled(){return this._s===`fulfilled`}get isRejected(){return this._s===`rejected`}get task(){return this._task}set task(e){var r=this;let i;this._task=e,t(e)?i=e:typeof e==`function`&&(i=new n(e)),i&&async function(){try{let t=await i;e===r._task&&r.resolve(t)}catch(t){e===r._task&&r.reject(t)}}()}get isEmpty(){return this._task==null}constructor(e){let n,r;super((e,t)=>{n=e,r=t}),this._s=`pending`,this.resolve=e=>{this.isPending&&(t(e)?this.task=e:(this._s=`fulfilled`,n(e)))},this.reject=e=>{this.isPending&&(this._s=`rejected`,r(e))},this.task=e}};function i(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function a(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}var o,s,c;(function(e){e[e.BOPM_BLOCK=0]=`BOPM_BLOCK`,e[e.BOPM_UPDATE=1]=`BOPM_UPDATE`})(o||={}),function(e){e[e.CCUT_AUTO=0]=`CCUT_AUTO`,e[e.CCUT_FULL_CHANNEL=1]=`CCUT_FULL_CHANNEL`,e[e.CCUT_Y_CHANNEL_ONLY=2]=`CCUT_Y_CHANNEL_ONLY`,e[e.CCUT_RGB_R_CHANNEL_ONLY=3]=`CCUT_RGB_R_CHANNEL_ONLY`,e[e.CCUT_RGB_G_CHANNEL_ONLY=4]=`CCUT_RGB_G_CHANNEL_ONLY`,e[e.CCUT_RGB_B_CHANNEL_ONLY=5]=`CCUT_RGB_B_CHANNEL_ONLY`}(s||={}),function(e){e[e.IPF_BINARY=0]=`IPF_BINARY`,e[e.IPF_BINARYINVERTED=1]=`IPF_BINARYINVERTED`,e[e.IPF_GRAYSCALED=2]=`IPF_GRAYSCALED`,e[e.IPF_NV21=3]=`IPF_NV21`,e[e.IPF_RGB_565=4]=`IPF_RGB_565`,e[e.IPF_RGB_555=5]=`IPF_RGB_555`,e[e.IPF_RGB_888=6]=`IPF_RGB_888`,e[e.IPF_ARGB_8888=7]=`IPF_ARGB_8888`,e[e.IPF_RGB_161616=8]=`IPF_RGB_161616`,e[e.IPF_ARGB_16161616=9]=`IPF_ARGB_16161616`,e[e.IPF_ABGR_8888=10]=`IPF_ABGR_8888`,e[e.IPF_ABGR_16161616=11]=`IPF_ABGR_16161616`,e[e.IPF_BGR_888=12]=`IPF_BGR_888`,e[e.IPF_BINARY_8=13]=`IPF_BINARY_8`,e[e.IPF_NV12=14]=`IPF_NV12`,e[e.IPF_BINARY_8_INVERTED=15]=`IPF_BINARY_8_INVERTED`}(c||={});var l=typeof self>`u`,u=typeof importScripts==`function`,d=(()=>{if(!u){if(!l&&document.currentScript){let e=document.currentScript.src,t=e.indexOf(`?`);if(t!=-1)e=e.substring(0,t);else{let t=e.indexOf(`#`);t!=-1&&(e=e.substring(0,t))}return e.substring(0,e.lastIndexOf(`/`)+1)}return`./`}})(),f=e=>{if(e??=`./`,!(l||u)){let t=document.createElement(`a`);t.href=e,e=t.href}return e.endsWith(`/`)||(e+=`/`),e},p=e=>Object.prototype.toString.call(e),m=e=>Array.isArray?Array.isArray(e):p(e)===`[object Array]`,h=e=>typeof e==`number`&&!Number.isNaN(e),g=e=>typeof e==`object`&&!!e&&!Array.isArray(e),_=e=>!(!g(e)||!h(e.x)||!h(e.y)||!h(e.radius)||e.radius<0||!h(e.startAngle)||!h(e.endAngle)),v=e=>!!g(e)&&!!m(e.points)&&e.points.length!=0&&!e.points.some(e=>!E(e)),y=e=>!(!g(e)||!h(e.width)||e.width<=0||!h(e.height)||e.height<=0||!h(e.stride)||e.stride<=0||!(`format`in e)||`tag`in e&&!w(e.tag)),b=(e,t)=>e===`bytes`&&typeof t==`object`&&typeof t.ptr==`number`&&typeof t.length==`number`,x=e=>!(!y(e)||!h(e.bytes.length)&&!h(e.bytes.ptr)),S=e=>!!y(e)&&e.bytes instanceof Uint8Array,C=e=>!(!g(e)||!h(e.left)||e.left<0||!h(e.top)||e.top<0||!h(e.right)||e.right<0||!h(e.bottom)||e.bottom<0||e.left>=e.right||e.top>=e.bottom),w=e=>e===null||!!g(e)&&!!h(e.imageId)&&`type`in e,T=e=>!(!g(e)||!E(e.startPoint)||!E(e.endPoint)||e.startPoint.x==e.endPoint.x&&e.startPoint.y==e.endPoint.y),E=e=>!!g(e)&&!!h(e.x)&&!!h(e.y),D=e=>!!g(e)&&!!m(e.points)&&e.points.length!=0&&!e.points.some(e=>!E(e)),ee=e=>!!g(e)&&!!m(e.points)&&e.points.length!=0&&e.points.length==4&&!e.points.some(e=>!E(e)),O=e=>!(!g(e)||!h(e.x)||!h(e.y)||!h(e.width)||e.width<0||!h(e.height)||e.height<0),k=async(e,t,n)=>await new Promise((r,i)=>{let a=new XMLHttpRequest;a.responseType=t,a.onloadstart=()=>{n&&n.loadstartCallback&&n.loadstartCallback()},a.onloadend=async e=>{n&&n.loadendCallback&&n.loadendCallback(),a.status<200||a.status>=300?i(a.status):r(a.response)},a.onprogress=e=>{n&&n.progressCallback&&n.progressCallback(e)},a.onerror=e=>{i(e)},a.open(`GET`,e,!0),a.send()}),A=e=>/^(https:\/\/www\.|http:\/\/www\.|https:\/\/|http:\/\/)|^[a-zA-Z0-9]{2,}(\.[a-zA-Z0-9]{2,})(\.[a-zA-Z0-9]{2,})?/.test(e),j=(e,t)=>{let n=e.split(`.`),r=t.split(`.`);for(let e=0;e<n.length&&e<r.length;++e){let t=n[e],i=r[e];if(t===i)continue;let a=parseInt(n[e]),o=parseInt(r[e]);return a===o||Number.isNaN(a)&&Number.isNaN(o)?t<i?-1:1:a<o||Number.isNaN(a)&&Number.isInteger(o)?-1:1}return n.length===r.length?0:n.length<r.length?-1:1},M=e=>{let t={};for(let n in e){if(n===`rootDirectory`)continue;let r=n,i=e[r],a=i&&typeof i==`object`&&i.path?i.path:i,o=e.rootDirectory;if(o&&!o.endsWith(`/`)&&(o+=`/`),typeof i==`object`&&i.isInternal)o&&(a=e[r].version?`${o}${ue[r]}@${e[r].version}/${r===`dcvData`?``:`dist/`}${r===`ddv`?`engine`:``}`:`${o}${ue[r]}/${r===`dcvData`?``:`dist/`}${r===`ddv`?`engine`:``}`);else{let n=/^@engineRootDirectory(\/?)/;if(typeof a==`string`&&(a=a.replace(n,o||``)),typeof a==`object`&&r===`dwt`){let i=e[r].resourcesPath,a=e[r].serviceInstallerLocation;t[r]={resourcesPath:i.replace(n,o||``),serviceInstallerLocation:a.replace(n,o||``)};continue}}t[r]=f(a)}return t},N=async(e,t,n)=>await new Promise(async(r,i)=>{try{let i=t.split(`.`),a=i[i.length-1],o=await re(`image/${a}`,e);i.length<=1&&(a=`png`);let s=new File([o],t,{type:`image/${a}`});if(n){let e=URL.createObjectURL(s),n=document.createElement(`a`);n.href=e,n.download=t,n.click()}r(s)}catch{i()}}),te=e=>{S(e)&&(e=ae(e));let t=document.createElement(`canvas`);return t.width=e.width,t.height=e.height,t.getContext(`2d`,{willReadFrequently:!0}).putImageData(e,0,0),t},ne=(e,t)=>{S(t)&&(t=ae(t));let n=te(t),r=new Image;return r.src=n.toDataURL(e),r},re=async(e,t)=>{S(t)&&(t=ae(t));let n=te(t);if(e===`image/bmp`){let e=ie(n.getContext(`2d`).getImageData(0,0,n.width,n.height));return new Blob([e],{type:`image/bmp`})}return new Promise((t,r)=>{n.toBlob(e=>t(e),e)})},ie=e=>{let t=e.width,n=e.height,r=e.data,i=4*Math.floor((24*t+31)/32),a=i*n,o=54+a,s=new ArrayBuffer(o),c=new DataView(s);c.setUint16(0,19778,!0),c.setUint32(2,o,!0),c.setUint16(6,0,!0),c.setUint16(8,0,!0),c.setUint32(10,54,!0),c.setUint32(14,40,!0),c.setInt32(18,t,!0),c.setInt32(22,-n,!0),c.setUint16(26,1,!0),c.setUint16(28,24,!0),c.setUint32(30,0,!0),c.setUint32(34,a,!0),c.setInt32(38,2835,!0),c.setInt32(42,2835,!0),c.setUint32(46,0,!0),c.setUint32(50,0,!0);let l=54,u=i-3*t;for(let e=0;e<n;e++){for(let n=0;n<t;n++){let i=4*(e*t+n),a=r[i],o=r[i+1],s=r[i+2];c.setUint8(l++,s),c.setUint8(l++,o),c.setUint8(l++,a)}for(let e=0;e<u;e++)c.setUint8(l++,0)}return s},ae=e=>{let t,n=e.bytes;if(!(n&&n instanceof Uint8Array))throw Error(`Parameter type error`);if(Number(e.format)===c.IPF_BGR_888){let e=n.length/3;t=new Uint8ClampedArray(4*e);for(let r=0;r<e;++r)t[4*r]=n[3*r],t[4*r+1]=n[3*r+1],t[4*r+2]=n[3*r+2],t[4*r+3]=255}else if(Number(e.format)===c.IPF_RGB_888){let e=n.length/3;t=new Uint8ClampedArray(4*e);for(let r=0;r<e;++r)t[4*r]=n[3*r+2],t[4*r+1]=n[3*r+1],t[4*r+2]=n[3*r],t[4*r+3]=255}else if(Number(e.format)===c.IPF_GRAYSCALED){let e=n.length;t=new Uint8ClampedArray(4*e);for(let r=0;r<e;r++)t[4*r]=t[4*r+1]=t[4*r+2]=n[r],t[4*r+3]=255}else if(Number(e.format)===c.IPF_BINARY_8||Number(e.format)===c.IPF_BINARY_8_INVERTED){let r=n.length,i=e.width,a=e.height,o=e.stride;t=new Uint8ClampedArray(i*a*4);for(let e=0;e<r;e++){let r=n[e],a=e%o,s=Math.floor(e/o);for(let e=0;e<8;e++){let n=a+e,o=4*(s*i+n);if(n>=i)break;t[o]=t[o+1]=t[o+2]=(128&r)/128*255,t[o+3]=255,r<<=1}}}else if(Number(e.format)===c.IPF_ABGR_8888){let e=n.length/4;t=new Uint8ClampedArray(n.length);for(let r=0;r<e;++r)t[4*r]=n[4*r],t[4*r+1]=n[4*r+1],t[4*r+2]=n[4*r+2],t[4*r+3]=n[4*r+3]}else if(Number(e.format)===c.IPF_ARGB_8888){let e=n.length/4;t=new Uint8ClampedArray(n.length);for(let r=0;r<e;++r)t[4*r]=n[4*r+2],t[4*r+1]=n[4*r+1],t[4*r+2]=n[4*r],t[4*r+3]=n[4*r+3]}else Number(e.format),c.IPF_BINARY_8_INVERTED;return new ImageData(t,e.width,e.height)},oe=()=>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])),se=async e=>{let t=URL.createObjectURL(e);try{let e=await new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=n,r.src=t}),n=document.createElement(`canvas`),r=n.getContext(`2d`);return n.width=e.width,n.height=e.height,r.drawImage(e,0,0),{bytes:Uint8Array.from(r.getImageData(0,0,n.width,n.height).data),width:n.width,height:n.height,stride:4*n.width,format:c.IPF_ABGR_8888}}finally{URL.revokeObjectURL(t)}},ce=async(e,t)=>{let n=new TextEncoder,r=await crypto.subtle.importKey(`raw`,n.encode(t),`PBKDF2`,!1,[`deriveKey`]),i=await crypto.subtle.deriveKey({name:`PBKDF2`,salt:n.encode(`salt-for-key-derivation`),iterations:1e5,hash:`SHA-256`},r,{name:`AES-GCM`,length:256},!1,[`encrypt`,`decrypt`]),a=crypto.getRandomValues(new Uint8Array(12)),o=await crypto.subtle.encrypt({name:`AES-GCM`,iv:a,tagLength:128},i,n.encode(e)),s=new Uint8Array(a.length+o.byteLength);return s.set(a),s.set(new Uint8Array(o),a.length),btoa(String.fromCharCode.apply(null,s))},le=async(e,t)=>{let n=atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);let i=r.slice(0,12),a=r.slice(12),o=new TextEncoder,s=await crypto.subtle.importKey(`raw`,o.encode(t),`PBKDF2`,!1,[`deriveKey`]),c=await crypto.subtle.deriveKey({name:`PBKDF2`,salt:o.encode(`salt-for-key-derivation`),iterations:1e5,hash:`SHA-256`},s,{name:`AES-GCM`,length:256},!1,[`encrypt`,`decrypt`]),l=await crypto.subtle.decrypt({name:`AES-GCM`,iv:i,tagLength:128},c,a);return new TextDecoder().decode(l)},ue={std:`dynamsoft-capture-vision-std`,dip:`dynamsoft-image-processing`,core:`dynamsoft-core`,dnn:`dynamsoft-capture-vision-dnn`,license:`dynamsoft-license`,utility:`dynamsoft-utility`,cvr:`dynamsoft-capture-vision-router`,dbr:`dynamsoft-barcode-reader`,dlr:`dynamsoft-label-recognizer`,ddn:`dynamsoft-document-normalizer`,dcp:`dynamsoft-code-parser`,dcvData:`dynamsoft-capture-vision-data`,dce:`dynamsoft-camera-enhancer`,identityutility:`dynamsoft-identity-utility`,ddv:`dynamsoft-document-viewer`,dwt:`dwt`,dbrBundle:`dynamsoft-barcode-reader-bundle`,dcvBundle:`dynamsoft-capture-vision-bundle`},de,P,fe,pe,me,he,ge,_e,ve,ye,be,xe,Se,Ce=class e{get _isFetchingStarted(){return i(this,me,`f`)}constructor(){de.add(this),P.set(this,[]),fe.set(this,1),pe.set(this,o.BOPM_BLOCK),me.set(this,!1),he.set(this,void 0),ge.set(this,s.CCUT_AUTO)}setErrorListener(e){}addImageToBuffer(e){if(!S(e))throw TypeError(`Invalid 'image'.`);if(e.imageTag?.hasOwnProperty(`imageId`)&&typeof e.imageTag.imageId==`number`&&this.hasImage(e.imageTag.imageId))throw Error(`Existed imageId.`);if(i(this,P,`f`).length>=i(this,fe,`f`))switch(i(this,pe,`f`)){case o.BOPM_BLOCK:break;case o.BOPM_UPDATE:if(i(this,P,`f`).push(e),g(i(this,he,`f`))&&h(i(this,he,`f`).imageId)&&i(this,he,`f`).keepInBuffer==1)for(;i(this,P,`f`).length>i(this,fe,`f`);){let e=i(this,P,`f`).findIndex(e=>e.imageTag?.imageId!==i(this,he,`f`).imageId);i(this,P,`f`).splice(e,1)}else i(this,P,`f`).splice(0,i(this,P,`f`).length-i(this,fe,`f`))}else i(this,P,`f`).push(e)}getImage(){if(i(this,P,`f`).length===0)return null;let t;if(i(this,he,`f`)&&h(i(this,he,`f`).imageId)){let e=i(this,de,`m`,_e).call(this,i(this,he,`f`).imageId);if(e<0)throw Error(`Image with id ${i(this,he,`f`).imageId} doesn't exist.`);t=i(this,P,`f`).slice(e,e+1)[0]}else t=i(this,P,`f`).pop();if([c.IPF_RGB_565,c.IPF_RGB_555,c.IPF_RGB_888,c.IPF_ARGB_8888,c.IPF_RGB_161616,c.IPF_ARGB_16161616,c.IPF_ABGR_8888,c.IPF_ABGR_16161616,c.IPF_BGR_888].includes(t.format)){if(i(this,ge,`f`)===s.CCUT_RGB_R_CHANNEL_ONLY){e._onLog&&e._onLog(`only get R channel data.`);let n=new Uint8Array(t.width*t.height);for(let e=0;e<n.length;e++)switch(t.format){case c.IPF_RGB_565:case c.IPF_RGB_555:case c.IPF_RGB_888:case c.IPF_RGB_161616:n[e]=t.bytes[3*e+2];break;case c.IPF_ARGB_8888:case c.IPF_ARGB_16161616:n[e]=t.bytes[4*e+2];break;case c.IPF_BGR_888:n[e]=t.bytes[3*e];break;case c.IPF_ABGR_8888:case c.IPF_ABGR_16161616:n[e]=t.bytes[4*e]}t.bytes=n,t.stride=t.width,t.format=c.IPF_GRAYSCALED}else if(i(this,ge,`f`)===s.CCUT_RGB_G_CHANNEL_ONLY){e._onLog&&e._onLog(`only get G channel data.`);let n=new Uint8Array(t.width*t.height);for(let e=0;e<n.length;e++)switch(t.format){case c.IPF_RGB_565:case c.IPF_RGB_555:case c.IPF_RGB_888:case c.IPF_RGB_161616:case c.IPF_BGR_888:n[e]=t.bytes[3*e+1];break;case c.IPF_ARGB_8888:case c.IPF_ARGB_16161616:case c.IPF_ABGR_8888:case c.IPF_ABGR_16161616:n[e]=t.bytes[4*e+1]}t.bytes=n,t.stride=t.width,t.format=c.IPF_GRAYSCALED}else if(i(this,ge,`f`)===s.CCUT_RGB_B_CHANNEL_ONLY){e._onLog&&e._onLog(`only get B channel data.`);let n=new Uint8Array(t.width*t.height);for(let e=0;e<n.length;e++)switch(t.format){case c.IPF_RGB_565:case c.IPF_RGB_555:case c.IPF_RGB_888:case c.IPF_RGB_161616:n[e]=t.bytes[3*e];break;case c.IPF_ARGB_8888:case c.IPF_ARGB_16161616:n[e]=t.bytes[4*e];break;case c.IPF_BGR_888:n[e]=t.bytes[3*e+2];break;case c.IPF_ABGR_8888:case c.IPF_ABGR_16161616:n[e]=t.bytes[4*e+2]}t.bytes=n,t.stride=t.width,t.format=c.IPF_GRAYSCALED}}else [c.IPF_NV21,c.IPF_NV12].includes(t.format)&&e._onLog&&e._onLog(`NV21 or NV12 is not supported.`);return t}setNextImageToReturn(e,t){if(!((...e)=>e.length!==0&&e.every(e=>h(e)))(e))throw TypeError(`Invalid 'imageId'.`);if(t!==void 0&&p(t)!==`[object Boolean]`)throw TypeError(`Invalid 'keepInBuffer'.`);a(this,he,{imageId:e,keepInBuffer:t},`f`)}_resetNextReturnedImage(){a(this,he,null,`f`)}hasImage(e){return i(this,de,`m`,_e).call(this,e)>=0}startFetching(){a(this,me,!0,`f`)}stopFetching(){a(this,me,!1,`f`)}setMaxImageCount(e){if(typeof e!=`number`)throw TypeError(`Invalid 'count'.`);if(e<1||Math.round(e)!==e)throw Error(`Invalid 'count'.`);for(a(this,fe,e,`f`);i(this,P,`f`)&&i(this,P,`f`).length>e;)i(this,P,`f`).shift()}getMaxImageCount(){return i(this,fe,`f`)}getImageCount(){return i(this,P,`f`).length}clearBuffer(){i(this,P,`f`).length=0}isBufferEmpty(){return i(this,P,`f`).length===0}setBufferOverflowProtectionMode(e){a(this,pe,e,`f`)}getBufferOverflowProtectionMode(){return i(this,pe,`f`)}setColourChannelUsageType(e){a(this,ge,e,`f`)}getColourChannelUsageType(){return i(this,ge,`f`)}};P=new WeakMap,fe=new WeakMap,pe=new WeakMap,me=new WeakMap,he=new WeakMap,ge=new WeakMap,de=new WeakSet,_e=function(e){if(typeof e!=`number`)throw TypeError(`Invalid 'imageId'.`);return i(this,P,`f`).findIndex(t=>t.imageTag?.imageId===e)},typeof navigator<`u`&&(ve=navigator,ye=ve.userAgent,be=ve.platform,xe=ve.mediaDevices),function(){if(!l){let e={Edge:{search:`Edg`,verSearch:`Edg`},OPR:null,Chrome:null,Safari:{str:ve.vendor,search:`Apple`,verSearch:[`Version`,`iPhone OS`,`CPU OS`]},Firefox:null,Explorer:{search:`MSIE`,verSearch:`MSIE`}},t={HarmonyOS:null,Android:null,iPhone:null,iPad:null,Windows:{str:be,search:`Win`},Mac:{str:be},Linux:{str:be}},n=`unknownBrowser`,r=0,i=`unknownOS`;for(let t in e){let i=e[t]||{},a=i.str||ye,o=i.search||t,s=i.verStr||ye,c=i.verSearch||t;if(c instanceof Array||(c=[c]),a.indexOf(o)!=-1){n=t;for(let e of c){let t=s.indexOf(e);if(t!=-1){r=parseFloat(s.substring(t+e.length+1));break}}break}}for(let e in t){let n=t[e]||{},r=n.str||ye,a=n.search||e;if(r.indexOf(a)!=-1){i=e;break}}i==`Linux`&&ye.indexOf(`Windows NT`)!=-1&&(i=`HarmonyOS`),Se={browser:n,version:r,OS:i}}l&&(Se={browser:`ssr`,version:0,OS:`ssr`})}();var we=typeof WebAssembly<`u`&&ye&&!(/Safari/.test(ye)&&!/Chrome/.test(ye)&&/\(.+\s11_2_([2-6]).*\)/.test(ye)),Te=!(typeof Worker>`u`),Ee=!(!xe||!xe.getUserMedia),De=async()=>{let e=!1;if(Ee)try{(await xe.getUserMedia({video:!0})).getTracks().forEach(e=>{e.stop()}),e=!0}catch{}return e},F,Oe,ke,Ae,je,Me,Ne,Pe,Fe;Se.browser===`Chrome`&&Se.version>66||Se.browser===`Safari`&&Se.version>13||Se.browser===`OPR`&&Se.version>43||Se.browser===`Edge`&&Se.version,function(e){e[e.CRIT_ORIGINAL_IMAGE=1]=`CRIT_ORIGINAL_IMAGE`,e[e.CRIT_BARCODE=2]=`CRIT_BARCODE`,e[e.CRIT_TEXT_LINE=4]=`CRIT_TEXT_LINE`,e[e.CRIT_DETECTED_QUAD=8]=`CRIT_DETECTED_QUAD`,e[e.CRIT_DESKEWED_IMAGE=16]=`CRIT_DESKEWED_IMAGE`,e[e.CRIT_PARSED_RESULT=32]=`CRIT_PARSED_RESULT`,e[e.CRIT_ENHANCED_IMAGE=64]=`CRIT_ENHANCED_IMAGE`}(F||={}),function(e){e[e.CT_NORMAL_INTERSECTED=0]=`CT_NORMAL_INTERSECTED`,e[e.CT_T_INTERSECTED=1]=`CT_T_INTERSECTED`,e[e.CT_CROSS_INTERSECTED=2]=`CT_CROSS_INTERSECTED`,e[e.CT_NOT_INTERSECTED=3]=`CT_NOT_INTERSECTED`}(Oe||={}),function(e){e[e.EC_OK=0]=`EC_OK`,e[e.EC_UNKNOWN=-1e4]=`EC_UNKNOWN`,e[e.EC_NO_MEMORY=-10001]=`EC_NO_MEMORY`,e[e.EC_NULL_POINTER=-10002]=`EC_NULL_POINTER`,e[e.EC_LICENSE_INVALID=-10003]=`EC_LICENSE_INVALID`,e[e.EC_LICENSE_EXPIRED=-10004]=`EC_LICENSE_EXPIRED`,e[e.EC_FILE_NOT_FOUND=-10005]=`EC_FILE_NOT_FOUND`,e[e.EC_FILE_TYPE_NOT_SUPPORTED=-10006]=`EC_FILE_TYPE_NOT_SUPPORTED`,e[e.EC_BPP_NOT_SUPPORTED=-10007]=`EC_BPP_NOT_SUPPORTED`,e[e.EC_INDEX_INVALID=-10008]=`EC_INDEX_INVALID`,e[e.EC_CUSTOM_REGION_INVALID=-10010]=`EC_CUSTOM_REGION_INVALID`,e[e.EC_IMAGE_READ_FAILED=-10012]=`EC_IMAGE_READ_FAILED`,e[e.EC_TIFF_READ_FAILED=-10013]=`EC_TIFF_READ_FAILED`,e[e.EC_DIB_BUFFER_INVALID=-10018]=`EC_DIB_BUFFER_INVALID`,e[e.EC_PDF_READ_FAILED=-10021]=`EC_PDF_READ_FAILED`,e[e.EC_PDF_DLL_MISSING=-10022]=`EC_PDF_DLL_MISSING`,e[e.EC_PAGE_NUMBER_INVALID=-10023]=`EC_PAGE_NUMBER_INVALID`,e[e.EC_CUSTOM_SIZE_INVALID=-10024]=`EC_CUSTOM_SIZE_INVALID`,e[e.EC_TIMEOUT=-10026]=`EC_TIMEOUT`,e[e.EC_JSON_PARSE_FAILED=-10030]=`EC_JSON_PARSE_FAILED`,e[e.EC_JSON_TYPE_INVALID=-10031]=`EC_JSON_TYPE_INVALID`,e[e.EC_JSON_KEY_INVALID=-10032]=`EC_JSON_KEY_INVALID`,e[e.EC_JSON_VALUE_INVALID=-10033]=`EC_JSON_VALUE_INVALID`,e[e.EC_JSON_NAME_KEY_MISSING=-10034]=`EC_JSON_NAME_KEY_MISSING`,e[e.EC_JSON_NAME_VALUE_DUPLICATED=-10035]=`EC_JSON_NAME_VALUE_DUPLICATED`,e[e.EC_TEMPLATE_NAME_INVALID=-10036]=`EC_TEMPLATE_NAME_INVALID`,e[e.EC_JSON_NAME_REFERENCE_INVALID=-10037]=`EC_JSON_NAME_REFERENCE_INVALID`,e[e.EC_PARAMETER_VALUE_INVALID=-10038]=`EC_PARAMETER_VALUE_INVALID`,e[e.EC_DOMAIN_NOT_MATCH=-10039]=`EC_DOMAIN_NOT_MATCH`,e[e.EC_LICENSE_KEY_NOT_MATCH=-10043]=`EC_LICENSE_KEY_NOT_MATCH`,e[e.EC_SET_MODE_ARGUMENT_ERROR=-10051]=`EC_SET_MODE_ARGUMENT_ERROR`,e[e.EC_GET_MODE_ARGUMENT_ERROR=-10055]=`EC_GET_MODE_ARGUMENT_ERROR`,e[e.EC_IRT_LICENSE_INVALID=-10056]=`EC_IRT_LICENSE_INVALID`,e[e.EC_FILE_SAVE_FAILED=-10058]=`EC_FILE_SAVE_FAILED`,e[e.EC_STAGE_TYPE_INVALID=-10059]=`EC_STAGE_TYPE_INVALID`,e[e.EC_IMAGE_ORIENTATION_INVALID=-10060]=`EC_IMAGE_ORIENTATION_INVALID`,e[e.EC_CONVERT_COMPLEX_TEMPLATE_ERROR=-10061]=`EC_CONVERT_COMPLEX_TEMPLATE_ERROR`,e[e.EC_CALL_REJECTED_WHEN_CAPTURING=-10062]=`EC_CALL_REJECTED_WHEN_CAPTURING`,e[e.EC_NO_IMAGE_SOURCE=-10063]=`EC_NO_IMAGE_SOURCE`,e[e.EC_READ_DIRECTORY_FAILED=-10064]=`EC_READ_DIRECTORY_FAILED`,e[e.EC_MODULE_NOT_FOUND=-10065]=`EC_MODULE_NOT_FOUND`,e[e.EC_MULTI_PAGES_NOT_SUPPORTED=-10066]=`EC_MULTI_PAGES_NOT_SUPPORTED`,e[e.EC_FILE_ALREADY_EXISTS=-10067]=`EC_FILE_ALREADY_EXISTS`,e[e.EC_CREATE_FILE_FAILED=-10068]=`EC_CREATE_FILE_FAILED`,e[e.EC_IMAGE_DATA_INVALID=-10069]=`EC_IMAGE_DATA_INVALID`,e[e.EC_IMAGE_SIZE_NOT_MATCH=-10070]=`EC_IMAGE_SIZE_NOT_MATCH`,e[e.EC_IMAGE_PIXEL_FORMAT_NOT_MATCH=-10071]=`EC_IMAGE_PIXEL_FORMAT_NOT_MATCH`,e[e.EC_SECTION_LEVEL_RESULT_IRREPLACEABLE=-10072]=`EC_SECTION_LEVEL_RESULT_IRREPLACEABLE`,e[e.EC_AXIS_DEFINITION_INCORRECT=-10073]=`EC_AXIS_DEFINITION_INCORRECT`,e[e.EC_RESULT_TYPE_MISMATCH_IRREPLACEABLE=-10074]=`EC_RESULT_TYPE_MISMATCH_IRREPLACEABLE`,e[e.EC_PDF_LIBRARY_LOAD_FAILED=-10075]=`EC_PDF_LIBRARY_LOAD_FAILED`,e[e.EC_UNSUPPORTED_JSON_KEY_WARNING=-10077]=`EC_UNSUPPORTED_JSON_KEY_WARNING`,e[e.EC_MODEL_FILE_NOT_FOUND=-10078]=`EC_MODEL_FILE_NOT_FOUND`,e[e.EC_PDF_LICENSE_NOT_FOUND=-10079]=`EC_PDF_LICENSE_NOT_FOUND`,e[e.EC_RECT_INVALID=-10080]=`EC_RECT_INVALID`,e[e.EC_TEMPLATE_VERSION_INCOMPATIBLE=-10081]=`EC_TEMPLATE_VERSION_INCOMPATIBLE`,e[e.EC_PORTRAIT_ZONE_NOT_FOUND=-10082]=`EC_PORTRAIT_ZONE_NOT_FOUND`,e[e.EC_NO_LICENSE=-2e4]=`EC_NO_LICENSE`,e[e.EC_LICENSE_BUFFER_FAILED=-20002]=`EC_LICENSE_BUFFER_FAILED`,e[e.EC_LICENSE_SYNC_FAILED=-20003]=`EC_LICENSE_SYNC_FAILED`,e[e.EC_DEVICE_NOT_MATCH=-20004]=`EC_DEVICE_NOT_MATCH`,e[e.EC_BIND_DEVICE_FAILED=-20005]=`EC_BIND_DEVICE_FAILED`,e[e.EC_INSTANCE_COUNT_OVER_LIMIT=-20008]=`EC_INSTANCE_COUNT_OVER_LIMIT`,e[e.EC_TRIAL_LICENSE=-20010]=`EC_TRIAL_LICENSE`,e[e.EC_LICENSE_VERSION_NOT_MATCH=-20011]=`EC_LICENSE_VERSION_NOT_MATCH`,e[e.EC_LICENSE_CACHE_USED=-20012]=`EC_LICENSE_CACHE_USED`,e[e.EC_LICENSE_AUTH_QUOTA_EXCEEDED=-20013]=`EC_LICENSE_AUTH_QUOTA_EXCEEDED`,e[e.EC_LICENSE_RESULTS_LIMIT_EXCEEDED=-20014]=`EC_LICENSE_RESULTS_LIMIT_EXCEEDED`,e[e.EC_BARCODE_FORMAT_INVALID=-30009]=`EC_BARCODE_FORMAT_INVALID`,e[e.EC_CUSTOM_MODULESIZE_INVALID=-30025]=`EC_CUSTOM_MODULESIZE_INVALID`,e[e.EC_TEXT_LINE_GROUP_LAYOUT_CONFLICT=-40101]=`EC_TEXT_LINE_GROUP_LAYOUT_CONFLICT`,e[e.EC_TEXT_LINE_GROUP_REGEX_CONFLICT=-40102]=`EC_TEXT_LINE_GROUP_REGEX_CONFLICT`,e[e.EC_QUADRILATERAL_INVALID=-50057]=`EC_QUADRILATERAL_INVALID`,e[e.EC_PANORAMA_LICENSE_INVALID=-70060]=`EC_PANORAMA_LICENSE_INVALID`,e[e.EC_RESOURCE_PATH_NOT_EXIST=-90001]=`EC_RESOURCE_PATH_NOT_EXIST`,e[e.EC_RESOURCE_LOAD_FAILED=-90002]=`EC_RESOURCE_LOAD_FAILED`,e[e.EC_CODE_SPECIFICATION_NOT_FOUND=-90003]=`EC_CODE_SPECIFICATION_NOT_FOUND`,e[e.EC_FULL_CODE_EMPTY=-90004]=`EC_FULL_CODE_EMPTY`,e[e.EC_FULL_CODE_PREPROCESS_FAILED=-90005]=`EC_FULL_CODE_PREPROCESS_FAILED`,e[e.EC_LICENSE_WARNING=-10076]=`EC_LICENSE_WARNING`,e[e.EC_BARCODE_READER_LICENSE_NOT_FOUND=-30063]=`EC_BARCODE_READER_LICENSE_NOT_FOUND`,e[e.EC_LABEL_RECOGNIZER_LICENSE_NOT_FOUND=-40103]=`EC_LABEL_RECOGNIZER_LICENSE_NOT_FOUND`,e[e.EC_DOCUMENT_NORMALIZER_LICENSE_NOT_FOUND=-50058]=`EC_DOCUMENT_NORMALIZER_LICENSE_NOT_FOUND`,e[e.EC_CODE_PARSER_LICENSE_NOT_FOUND=-90012]=`EC_CODE_PARSER_LICENSE_NOT_FOUND`}(ke||={}),function(e){e[e.GEM_SKIP=0]=`GEM_SKIP`,e[e.GEM_AUTO=1]=`GEM_AUTO`,e[e.GEM_GENERAL=2]=`GEM_GENERAL`,e[e.GEM_GRAY_EQUALIZE=4]=`GEM_GRAY_EQUALIZE`,e[e.GEM_GRAY_SMOOTH=8]=`GEM_GRAY_SMOOTH`,e[e.GEM_SHARPEN_SMOOTH=16]=`GEM_SHARPEN_SMOOTH`,e[e.GEM_REV=-2147483648]=`GEM_REV`,e[e.GEM_END=-1]=`GEM_END`}(Ae||={}),function(e){e[e.GTM_SKIP=0]=`GTM_SKIP`,e[e.GTM_INVERTED=1]=`GTM_INVERTED`,e[e.GTM_ORIGINAL=2]=`GTM_ORIGINAL`,e[e.GTM_AUTO=4]=`GTM_AUTO`,e[e.GTM_REV=-2147483648]=`GTM_REV`,e[e.GTM_END=-1]=`GTM_END`}(je||={}),function(e){e[e.ITT_FILE_IMAGE=0]=`ITT_FILE_IMAGE`,e[e.ITT_VIDEO_FRAME=1]=`ITT_VIDEO_FRAME`}(Me||={}),function(e){e[e.PDFRM_VECTOR=1]=`PDFRM_VECTOR`,e[e.PDFRM_RASTER=2]=`PDFRM_RASTER`,e[e.PDFRM_REV=-2147483648]=`PDFRM_REV`}(Ne||={}),function(e){e[e.RDS_RASTERIZED_PAGES=0]=`RDS_RASTERIZED_PAGES`,e[e.RDS_EXTRACTED_IMAGES=1]=`RDS_EXTRACTED_IMAGES`}(Pe||={}),function(e){e[e.CVS_NOT_VERIFIED=0]=`CVS_NOT_VERIFIED`,e[e.CVS_PASSED=1]=`CVS_PASSED`,e[e.CVS_FAILED=2]=`CVS_FAILED`}(Fe||={});var Ie={IRUT_NULL:BigInt(0),IRUT_COLOUR_IMAGE:BigInt(1),IRUT_SCALED_COLOUR_IMAGE:BigInt(2),IRUT_GRAYSCALE_IMAGE:BigInt(4),IRUT_TRANSOFORMED_GRAYSCALE_IMAGE:BigInt(8),IRUT_ENHANCED_GRAYSCALE_IMAGE:BigInt(16),IRUT_PREDETECTED_REGIONS:BigInt(32),IRUT_BINARY_IMAGE:BigInt(64),IRUT_TEXTURE_DETECTION_RESULT:BigInt(128),IRUT_TEXTURE_REMOVED_GRAYSCALE_IMAGE:BigInt(256),IRUT_TEXTURE_REMOVED_BINARY_IMAGE:BigInt(512),IRUT_CONTOURS:BigInt(1024),IRUT_LINE_SEGMENTS:BigInt(2048),IRUT_TEXT_ZONES:BigInt(4096),IRUT_TEXT_REMOVED_BINARY_IMAGE:BigInt(8192),IRUT_CANDIDATE_BARCODE_ZONES:BigInt(16384),IRUT_LOCALIZED_BARCODES:BigInt(32768),IRUT_SCALED_BARCODE_IMAGE:BigInt(65536),IRUT_DEFORMATION_RESISTED_BARCODE_IMAGE:BigInt(1<<17),IRUT_COMPLEMENTED_BARCODE_IMAGE:BigInt(1<<18),IRUT_DECODED_BARCODES:BigInt(1<<19),IRUT_LONG_LINES:BigInt(1<<20),IRUT_CORNERS:BigInt(1<<21),IRUT_CANDIDATE_QUAD_EDGES:BigInt(1<<22),IRUT_DETECTED_QUADS:BigInt(1<<23),IRUT_LOCALIZED_TEXT_LINES:BigInt(1<<24),IRUT_RECOGNIZED_TEXT_LINES:BigInt(1<<25),IRUT_DESKEWED_IMAGE:BigInt(1<<26),IRUT_SHORT_LINES:BigInt(1<<27),IRUT_RAW_TEXT_LINES:BigInt(1<<28),IRUT_LOGIC_LINES:BigInt(1<<29),IRUT_ENHANCED_IMAGE:BigInt(2**30),IRUT_ALL:BigInt(`0xFFFFFFFFFFFFFFFF`)},Le,Re,ze,Be,Ve;(function(e){e[e.ROET_PREDETECTED_REGION=0]=`ROET_PREDETECTED_REGION`,e[e.ROET_LOCALIZED_BARCODE=1]=`ROET_LOCALIZED_BARCODE`,e[e.ROET_DECODED_BARCODE=2]=`ROET_DECODED_BARCODE`,e[e.ROET_LOCALIZED_TEXT_LINE=3]=`ROET_LOCALIZED_TEXT_LINE`,e[e.ROET_RECOGNIZED_TEXT_LINE=4]=`ROET_RECOGNIZED_TEXT_LINE`,e[e.ROET_DETECTED_QUAD=5]=`ROET_DETECTED_QUAD`,e[e.ROET_DESKEWED_IMAGE=6]=`ROET_DESKEWED_IMAGE`,e[e.ROET_SOURCE_IMAGE=7]=`ROET_SOURCE_IMAGE`,e[e.ROET_TARGET_ROI=8]=`ROET_TARGET_ROI`,e[e.ROET_ENHANCED_IMAGE=9]=`ROET_ENHANCED_IMAGE`,e[e.ROET_AUXILIARY_REGION=10]=`ROET_AUXILIARY_REGION`})(Le||={}),function(e){e[e.ST_NULL=0]=`ST_NULL`,e[e.ST_REGION_PREDETECTION=1]=`ST_REGION_PREDETECTION`,e[e.ST_BARCODE_LOCALIZATION=2]=`ST_BARCODE_LOCALIZATION`,e[e.ST_BARCODE_DECODING=3]=`ST_BARCODE_DECODING`,e[e.ST_TEXT_LINE_LOCALIZATION=4]=`ST_TEXT_LINE_LOCALIZATION`,e[e.ST_TEXT_LINE_RECOGNITION=5]=`ST_TEXT_LINE_RECOGNITION`,e[e.ST_DOCUMENT_DETECTION=6]=`ST_DOCUMENT_DETECTION`,e[e.ST_DOCUMENT_DESKEWING=7]=`ST_DOCUMENT_DESKEWING`,e[e.ST_IMAGE_ENHANCEMENT=8]=`ST_IMAGE_ENHANCEMENT`}(Re||={}),function(e){e[e.IFF_JPEG=0]=`IFF_JPEG`,e[e.IFF_PNG=1]=`IFF_PNG`,e[e.IFF_BMP=2]=`IFF_BMP`,e[e.IFF_PDF=3]=`IFF_PDF`}(ze||={}),function(e){e[e.ICDM_NEAR=0]=`ICDM_NEAR`,e[e.ICDM_FAR=1]=`ICDM_FAR`}(Be||={}),function(e){e.MN_DYNAMSOFT_CAPTURE_VISION_ROUTER=`cvr`,e.MN_DYNAMSOFT_CORE=`core`,e.MN_DYNAMSOFT_LICENSE=`license`,e.MN_DYNAMSOFT_IMAGE_PROCESSING=`dip`,e.MN_DYNAMSOFT_UTILITY=`utility`,e.MN_DYNAMSOFT_BARCODE_READER=`dbr`,e.MN_DYNAMSOFT_DOCUMENT_NORMALIZER=`ddn`,e.MN_DYNAMSOFT_LABEL_RECOGNIZER=`dlr`,e.MN_DYNAMSOFT_CAPTURE_VISION_DATA=`dcvData`,e.MN_DYNAMSOFT_NEURAL_NETWORK=`dnn`,e.MN_DYNAMSOFT_CODE_PARSER=`dcp`,e.MN_DYNAMSOFT_CAMERA_ENHANCER=`dce`,e.MN_DYNAMSOFT_CAPTURE_VISION_STD=`std`}(Ve||={});var He={},Ue=async e=>{let t=typeof e==`string`?[e]:e,n=[];for(let e of t)n.push(He[e]=He[e]||new r);await Promise.all(n)},We=async(e,t)=>{let n,i=typeof e==`string`?[e]:e,a=[];for(let e of i){let i;a.push(i=He[e]=He[e]||new r(n||=t())),i.isEmpty&&(i.task=n||=t())}await Promise.all(a)},Ge=async e=>await new Promise((t,n)=>{let r=L();R[r]=async e=>{if(e.success)return t(e.u8);{let t=Error(e.message);e.stack&&(t.stack=e.stack),n(t)}},I.postMessage({type:`imagePtrToUint8Array`,id:r,body:{data:e}})}),Ke=async e=>await new Promise((t,n)=>{let r=L();R[r]=async e=>{if(e.success)return t(e.result);{let t=Error(e.message);e.stack&&(t.stack=e.stack),n(t)}},I.postMessage({type:`resolveDsImageData`,id:r,body:{point:e}})}),I,qe=0,L=()=>qe++,R={},Je,Ye=e=>{Je=e,I&&I.postMessage({type:`setBLog`,body:{value:!!e}})},Xe=!1,Ze=e=>{Xe=e,I&&I.postMessage({type:`setBDebug`,body:{value:!!e}})},z={},B={},Qe={dip:{wasm:!0}},$e={std:{version:`2.0.0`,path:f(d+`../../dynamsoft-capture-vision-std@2.0.0/dist/`),isInternal:!0},core:{version:`4.4.20-dev-20260415104041`,path:d,isInternal:!0}},et=5;typeof navigator<`u`&&(et=navigator.hardwareConcurrency?navigator.hardwareConcurrency-1:5),R[-3]=async e=>{V.onWasmLoadProgressChanged&&V.onWasmLoadProgressChanged(e.resourcesPath,e.tag,{loaded:e.loaded,total:e.total})};var V=class e{static get engineResourcePaths(){return $e}static set engineResourcePaths(e){Object.assign($e,e)}static get bSupportDce4Module(){return this._bSupportDce4Module}static get bSupportIRTModule(){return this._bSupportIRTModule}static get versions(){return this._versions}static get _onLog(){return Je}static set _onLog(e){Ye(e)}static get _bDebug(){return Xe}static set _bDebug(e){Ze(e)}static get _workerName(){return`${e._bundleEnv.toLowerCase()}.bundle.worker.js`}static get wasmLoadOptions(){return e._wasmLoadOptions}static set wasmLoadOptions(t){Object.assign(e._wasmLoadOptions,t)}static isModuleLoaded(e){return e=(e||=`core`).toLowerCase(),!!He[e]&&He[e].isFulfilled}static async loadWasm(){return await async function(){let t,n;t instanceof Array||(t=t?[t]:[]);let i=He.core;n=!i||i.isEmpty,n||await Ue(`core`);let a=new Map,o=e=>{if(e=e.toLowerCase(),Ve.MN_DYNAMSOFT_CAPTURE_VISION_STD==e||Ve.MN_DYNAMSOFT_CORE==e)return;let t=Qe[e].deps;if(t?.length)for(let e of t)o(e);let n=He[e];a.has(e)||a.set(e,!n||n.isEmpty)};for(let e of t)o(e);let s=[];n&&s.push(`core`),s.push(...a.keys());let c=[...a.entries()].filter(e=>!e[1]).map(e=>e[0]);await We(s,async function(){let t=[...a.entries()].filter(e=>e[1]).map(e=>e[0]);await Ue(c);let i=M($e),o={};for(let e of t)o[e]=Qe[e];let s={engineResourcePaths:i,autoResources:o,names:t,_bundleEnv:e._bundleEnv,wasmLoadOptions:e.wasmLoadOptions},l=new r;if(n){s.needLoadCore=!0;let t=i[`${e._bundleEnv.toLowerCase()}Bundle`]+e._workerName;t.startsWith(location.origin)||(t=await fetch(t).then(e=>e.blob()).then(e=>URL.createObjectURL(e))),I=new Worker(t),I.onerror=e=>{let t=Error(e.message);l.reject(t)},I.addEventListener(`message`,e=>{let t=e.data?e.data:e,n=t.type,r=t.id,i=t.body;switch(n){case`log`:Je&&Je(t.message);break;case`warning`:console.warn(t.message);break;case`task`:try{R[r]&&(R[r](i),delete R[r])}catch(e){throw delete R[r],e}break;case`event`:try{R[r](i)}catch(e){throw e}break;default:console.log(e)}}),s.bLog=!!Je,s.bd=Xe,s.dm=location.origin.startsWith(`http`)?location.origin:`https://localhost`}else await Ue(`core`);let u=qe++;R[u]=t=>{if(t.success)Object.assign(z,t.versions),JSON.stringify(t.versions)!==`{}`&&(e._versions=t.versions),e.loadedWasmType=t.loadedWasmType,l.resolve(void 0);else{let e=Error(t.message);t.stack&&(e.stack=t.stack),l.reject(e)}},I.postMessage({type:`loadWasm`,id:u,body:s}),await l})}()}static async detectEnvironment(){return await async function(){return{wasm:we,worker:Te,getUserMedia:Ee,camera:await De(),browser:Se.browser,version:Se.version,OS:Se.OS}}()}static async getModuleVersion(){return await new Promise((e,t)=>{let n=L();R[n]=async function(n){if(n.success)return e(n.versions);{let e=Error(n.message);return e.stack=n.stack+`
`+e.stack,t(e)}},I.postMessage({type:`getModuleVersion`,id:n})})}static getVersion(){return`4.4.20-dev-20260415104041(Worker: ${z.core&&z.core.worker||`Not Loaded`}, Wasm: ${z.core&&z.core.wasm||`Not Loaded`})`}static enableLogging(){Ce._onLog=console.log,e._onLog=console.log}static disableLogging(){Ce._onLog=null,e._onLog=null}static async cfd(e){return await new Promise((t,n)=>{let r=L();R[r]=async function(e){if(e.success)return t();{let t=Error(e.message);return t.stack=e.stack+`
`+t.stack,n(t)}},I.postMessage({type:`cfd`,id:r,body:{count:e}})})}};V._bSupportDce4Module=-1,V._bSupportIRTModule=-1,V._versions=null,V._bundleEnv=`DCV`,V._wasmLoadOptions={wasmType:`auto`,pthreadPoolSize:et},V.loadedWasmType=`ml-simd-pthread`,V.browserInfo=Se;var tt=typeof self>`u`,nt=typeof importScripts==`function`,rt=(()=>{if(!nt){if(!tt&&document.currentScript){let e=document.currentScript.src,t=e.indexOf(`?`);if(t!=-1)e=e.substring(0,t);else{let t=e.indexOf(`#`);t!=-1&&(e=e.substring(0,t))}return e.substring(0,e.lastIndexOf(`/`)+1)}return`./`}})();function H(e,t,n){return(t=function(e){var t=function(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}(e,`string`);return typeof t==`symbol`?t:t+``}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function it(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?it(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):it(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ot,st,ct,lt,ut=/<style>([\s\S]*?)<\/style>/g,dt=/style="([\s\S]*?)"/g,ft=(e,t)=>{let{inlineScript2Blob:n,internalCss2Blob:r,insertInternalCss2ExistedSheet:i}=t||{};if(i){let t,n;for(let e=0;e<document.styleSheets.length;++e){let r=document.styleSheets[e];try{n=r.cssRules,t=r;break}catch{}}t&&(e=e.replace(ut,(e,r,i,a)=>{let o=r.split(`}`),s=o.length-1,c=[],l=null,u=0;for(let e=0;e<s;++e){let t=0;for(;(t=o[e].indexOf(`{`,t))!==-1;)u+=1,t+=1;if(l)u===1?(c.push(l+o[e]+`}`),l=null,u=0):(l+=o[e]+`}`,--u);else{if(u<1)throw Error(`invalid style`);u===1?(c.push(o[e].trimStart()+`}`),u=0):(l=o[e].trimStart()+`}`,--u)}}if(l||u)throw Error(`invalid style`);for(let e of c)t.insertRule(e,n.length);return``}))}let a=[];r&&(e=e.replace(ut,(e,t,n,r)=>(a.push(new Blob([t],{type:`text/css`})),`<HasStyle></HasStyle>`)));let o=[];e=e.replace(dt,(e,t,n,r)=>(o.push(t),`hasstyle`));let s=document.createElement(`div`);if(s.insertAdjacentHTML(`beforeend`,e),s.normalize(),r){let e=s.querySelectorAll(`HasStyle`);for(let t=0;t<a.length;t++){let n=a[t],r=e[t],i=document.createElement(`link`);i.rel=`stylesheet`,i.href=URL.createObjectURL(n),r.replaceWith(i)}}let c=s.querySelectorAll(`[hasstyle]`);for(let e=0;e<o.length;e++){let t=o[e],n=c[e];n.removeAttribute(`hasstyle`);let r=t.split(`;`).map(e=>e.trim()).filter(e=>e);if(n.style)for(let e of r){let t=e.split(`:`);n.style[t[0].trim()]=t[1].trim()}}for(let e of s.querySelectorAll(`script`)){let t=document.createElement(`script`);e.textContent&&(n&&!e.src?(t.src=URL.createObjectURL(new Blob([e.textContent],{type:`text/javascript`})),t.addEventListener(`load`,()=>URL.revokeObjectURL(t.src))):t.textContent=e.textContent);for(let n of e.attributes)t.setAttribute(n.name,n.value);e.replaceWith(t)}let l=new DocumentFragment;return l.append(...s.childNodes),l.childNodes.length===1?l.firstChild:l},pt=e=>e&&typeof e==`object`&&typeof e.then==`function`,mt=(async()=>{})().constructor,ht=class extends mt{get status(){return this._s}get isPending(){return this._s===`pending`}get isFulfilled(){return this._s===`fulfilled`}get isRejected(){return this._s===`rejected`}get task(){return this._task}set task(e){var t=this;let n;this._task=e,pt(e)?n=e:typeof e==`function`&&(n=new mt(e)),n&&async function(){try{let r=await n;e===t._task&&t.resolve(r)}catch(n){e===t._task&&t.reject(n)}}()}get isEmpty(){return this._task==null}constructor(e){let t,n;super((e,r)=>{t=e,n=r}),this._s=`pending`,this.resolve=e=>{this.isPending&&(pt(e)?this.task=e:(this._s=`fulfilled`,t(e)))},this.reject=e=>{this.isPending&&(this._s=`rejected`,n(e))},this.task=e}},gt=typeof navigator<`u`&&((e,t)=>{let n=(e=navigator)?.userAgent,r=(t=navigator)?.platform,i=n&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(n);return r&&/Win|Mac|Linux/i.test(r)&&!i})(),_t=typeof navigator<`u`&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!((ot=window)!=null&&ot.MSStream),vt=typeof navigator<`u`&&/Android/i.test(navigator.userAgent)&&/Firefox/i.test(navigator.userAgent),yt=typeof navigator<`u`&&((e,t)=>{let n=navigator.standalone||((e=(t=window).matchMedia)==null||(e=e.call(t,`(display-mode: standalone)`))==null?void 0:e.matches);return _t&&n})(),bt=gt?{width:1920,height:1080}:{width:1280,height:720},xt=function(){let e=this,t=MediaDeviceInfo.prototype.toJSON.apply(e);return t.trackLabel=e.trackLabel,t.capabilities=e.capabilities,t.isFront=e.isFront,t},St=`The camera feature is available only in secure contexts (HTTPS).`,U=class e{constructor(){H(this,`_coreShell`,void 0),H(this,`_video`,void 0),H(this,`_coreInnerLayer`,void 0),H(this,`_coreOuterLayer`,void 0),H(this,`_regionBoxWrapper`,void 0),H(this,`_regionBoxMask`,void 0),H(this,`_regionBoxBorder`,void 0),H(this,`_objectFit`,`contain`),H(this,`_uiInlineScript2Blob`,!0),H(this,`_uiInternalCss2Blob`,!0),H(this,`_uiInternalCss2ExistedSheet`,!1),H(this,`_ui`,void 0),H(this,`_pOpen`,void 0),H(this,`_getUserMediaTimeout`,1e4),H(this,`_paused`,!1),H(this,`_shouldClose`,!1),H(this,`_cameraChangedWhenPaused`,!1),H(this,`_requestedCamera`,`back`),H(this,`_requestedResolution`,bt),H(this,`_regionBox`,{unit:`view-size`,center:{x:0,y:0},maskStyle:{background:`rgba(0, 0, 0, 0.5)`},borderStyle:{border:`1px solid #00ff7f`}}),H(this,`_eventListeners`,{}),H(this,`_taskIdIOSResizeProblem`,void 0),H(this,`onOpened`,void 0);let t=this._coreShell=document.createElement(`div`);Object.assign(t.style,{width:`100%`,height:`100%`,minWidth:`100px`,minHeight:`100px`,backgroundColor:`black`,display:`flex`,justifyContent:`center`,alignItems:`center`,overflow:`hidden`,position:`relative`});let n=this._coreOuterLayer=document.createElement(`div`);Object.assign(n.style,{width:`auto`,height:`100%`,minWidth:`100px`,minHeight:`100px`,aspectRatio:`1`,flex:`none`,position:`relative`,overflow:`hidden`});let r=this._coreInnerLayer=document.createElement(`div`);Object.assign(r.style,{width:`100%`,height:`100%`,position:`relative`,transformOrigin:`center`});let i=this._video=document.createElement(`video`);Object.assign(i.style,{width:`100%`,height:`100%`,position:`absolute`,left:`0`,top:`0`,objectFit:`fill`}),i.muted=!0,i.playsInline=!0,i.addEventListener(`resize`,()=>{try{this._updateObjectFit()}catch(e){console.error(e)}try{this._updateCanvasSize()}catch(e){console.error(e)}}),r.append(i),n.append(r),t.append(n),typeof ResizeObserver<`u`&&new ResizeObserver(()=>{if(!t.isConnected)return;this._updateObjectFit();let e=navigator?.userAgent;if(e&&/iPhone|iPad/i.test(e)){this._taskIdIOSResizeProblem&&clearInterval(this._taskIdIOSResizeProblem);let e=0;this._taskIdIOSResizeProblem=setInterval(()=>{if(++e>10||!t.isConnected)return clearInterval(this._taskIdIOSResizeProblem),void(this._taskIdIOSResizeProblem=null);this._updateObjectFit()},100)}}).observe(t);for(let t of e._arrConstructors)t.call(this)}_updateObjectFit(){let e=this._video;if(!e.isConnected||!e.videoWidth||!e.videoHeight)return;let t=this._coreOuterLayer.style,n=this._regionBoxWrapper?.style;if(this._objectFit===`fill`||t.aspectRatio===void 0)return t.width!==`100%`&&(t.width=`100%`),t.height!==`100%`&&(t.height=`100%`),void(n&&(n.width!==`100%`&&(n.width=`100%`),n.height!==`100%`&&(n.height=`100%`)));let{width:r,height:i}=this._coreShell.getBoundingClientRect(),a=`${e.videoWidth} / ${e.videoHeight}`;a!=t.aspectRatio&&(t.aspectRatio=a),n&&a!=n.aspectRatio&&(n.aspectRatio=a);let o=r/i-e.videoWidth/e.videoHeight;if(Math.abs(o)<.001)return;let s=!1;o>0&&(s=!s),this._objectFit===`cover`&&(s=!s);let c=n&&this._objectFit===`contain`,l=n&&this._objectFit===`cover`;s?(t.width!=`auto`&&(t.width=`auto`),t.height!=`100%`&&(t.height=`100%`),c&&(n.width!=`auto`&&(n.width=`auto`),n.height!=`100%`&&(n.height=`100%`))):(t.width!=`100%`&&(t.width=`100%`),t.height!=`auto`&&(t.height=`auto`),c&&(n.width!=`100%`&&(n.width=`100%`),n.height!=`auto`&&(n.height=`auto`))),l&&(n.width!==`100%`&&(n.width=`100%`),n.height!==`100%`&&(n.height=`100%`))}get video(){return this._video}get track(){var e;return(e=this._video)==null||(e=e.srcObject)==null?void 0:e.getTracks().filter(e=>e.kind===`video`)[0]}get objectFit(){return this._objectFit}set objectFit(e){this._objectFit=e,this._updateObjectFit()}get ui(){return this._ui||this._coreShell}set ui(e){if(!e)return void(this._ui=void 0);if(e instanceof HTMLElement&&e.contains(this._coreShell))return void(this._ui=e);if(typeof e==`string`){if(!e.trim().startsWith(`<`))throw Error(`Invalid html string.`);e=ft(e,{inlineScript2Blob:this._uiInlineScript2Blob,internalCss2Blob:this._uiInternalCss2Blob,insertInternalCss2ExistedSheet:this._uiInternalCss2ExistedSheet})}let t;if(e instanceof HTMLElement)t=e;else{if(!(e instanceof DocumentFragment))throw Error(`Seems no HTMLElement.`);t=document.createElement(`div`),Object.assign(t.style,{width:`100%`,height:`100%`}),t.append(e)}let n=`dm-camera-core-container`,r=t.classList.contains(n)?t:t.querySelector(`.${n}`);if(!r)throw Error(`Can't find element with class \`${n}\`.`);this._ui=t;for(let e of t.querySelectorAll(`script`))e.currentDMCamera=this;r.append(this._coreShell)}get status(){return this._pOpen?this._pOpen.isPending?this._shouldClose?`closing`:`opening`:this._paused||this._video.paused||this.track?.readyState===`ended`?`paused`:`opened`:`closed`}get requestedCamera(){return JSON.parse(JSON.stringify(this._requestedCamera))}get requestedResolution(){return JSON.parse(JSON.stringify(this._requestedResolution))}get currentCamera(){var t;return this.status!==`opened`&&this.status!==`paused`?null:e._mapDeviceInfo?.[(t=this.track)==null||(t=t.getSettings())==null?void 0:t.deviceId]}get currentResolution(){return{width:this.video?.videoWidth,height:this.video?.videoHeight}}get regionBox(){return this._regionBox}static async hasCamera(){var t;return!((t=navigator)==null||!t.mediaDevices)&&!!(await e.getDeviceInfos()).length}static async hasMacroCamera(){var t;return!((t=navigator)==null||!t.mediaDevices)&&!!(await e.getDeviceInfos()).find(e=>{var t;return!e.isFront&&((t=e.capabilities)==null||(t=t.focusDistance)==null?void 0:t.min)<.061})}static async hasFrontCamera(){var t;return!((t=navigator)==null||!t.mediaDevices)&&!!(await e.getDeviceInfos()).find(e=>e.isFront)}static async getDeviceInfos(){var t;if((t=navigator)==null||!t.mediaDevices)throw Error(St);e._delayBeforeEnumerateDevices&&await new Promise(t=>setTimeout(t,e._delayBeforeEnumerateDevices));let n=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`videoinput`);if(!n.length)return[];if(n.some(e=>!e.deviceId)){let t;try{e._delayBeforeGetUserMedia&&await new Promise(t=>setTimeout(t,e._delayBeforeGetUserMedia)),t=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),e._delayBeforeEnumerateDevices&&await new Promise(t=>setTimeout(t,e._delayBeforeEnumerateDevices)),n=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`videoinput`),n.some(e=>!e.deviceId)&&console.warn(`Some camera does not have deviceId.`)}catch(e){console.warn(`Failed to get device ID by opening camera.`,e)}if(t){let e=t.getTracks().filter(e=>e.kind===`video`)[0],r=e.getSettings().deviceId,i=n.find(e=>e.deviceId===r);i?(i.trackLabel=e.label,i.capabilities=e.getCapabilities?.call(e),i.isFront=e.getSettings().facingMode===`user`,i.toJSON=xt):console.warn("Can't find current device by `track.getSettings().deviceId`."),t.getTracks().forEach(e=>e.stop())}}return await e._setCapabilities(n),e._mapDeviceInfo=n.reduce((e,t)=>(e[t.deviceId]=t,e),{}),[...n]}static async _setCapabilities(t){for(let n of t){if(!n.deviceId||xt===n.toJSON)continue;let t=e._mapDeviceInfo?.[n.deviceId];if(t)n.trackLabel=t.trackLabel,n.capabilities=t.capabilities,n.isFront=t.isFront;else try{e._delayBeforeGetUserMedia&&await new Promise(t=>setTimeout(t,e._delayBeforeGetUserMedia));let t=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:n.deviceId}},audio:!1}),r=t.getTracks().filter(e=>e.kind===`video`)[0];n.trackLabel=r.label,n.capabilities=r.getCapabilities?.call(r),n.isFront=r.getSettings().facingMode===`user`,t.getTracks().forEach(e=>e.stop())}catch(e){console.warn("Failed to get `trackLabel` and `capabilities`, by opening camera.",e)}n.toJSON=xt}}async open(){if(this.status!==`opened`)if(this.status===`closed`||this.status===`paused`)try{if(this.status===`paused`&&this._cameraChangedWhenPaused&&await this.close(),this.status===`closed`){if(this._pOpen=new ht,this._requestedCamera!==`customized-video`){var t;let n;if(typeof this._requestedCamera==`string`){switch(this._requestedCamera){case`front`:n={facingMode:`user`};break;case`quick-back`:n={facingMode:`environment`};break;case`back`:{let t=await e.getDeviceInfos();if(!t.length)throw Error(`No camera found.`);for(let r of e._cameraNameMatcher){for(let e of t){let t=(e.trackLabel||e.label)?.toLowerCase();for(let i of r)if(t.includes(i)){n={deviceId:e.deviceId};break}if(n)break}if(n)break}if(n)break;t.reverse();for(let e of t)if(!e.isFront){n={deviceId:e.deviceId};break}if(n)break;n={deviceId:t[0].deviceId};break}case`macro-back`:{let t=await e.getDeviceInfos();if(!t.length)throw Error(`No camera found.`);n={deviceId:t.reduce((e,t)=>{var n,r,i;return t!=null&&t.isFront?e:e&&e!=null&&(n=e.capabilities)!=null&&(n=n.focusDistance)!=null&&n.min?(t==null||(r=t.capabilities)==null||(r=r.focusDistance)==null?void 0:r.min)<(e==null||(i=e.capabilities)==null||(i=i.focusDistance)==null?void 0:i.min)?t:e:t})?.deviceId||t[t.length-1].deviceId};break}default:throw Error(`Unknown camera preset: ${this._requestedCamera}`)}this._requestedCamera=n}else n=this._requestedCamera;let r={video:Object.assign({},n,this._requestedResolution),audio:!1};if((t=navigator)==null||!t.mediaDevices)throw Error(St);e._delayBeforeGetUserMedia&&await new Promise(t=>setTimeout(t,e._delayBeforeGetUserMedia));let i=navigator.mediaDevices.getUserMedia(r),a=await(this._getUserMediaTimeout?Promise.race([i,new Promise((e,t)=>setTimeout(()=>t(Error(`Camera open timeout.`)),this._getUserMediaTimeout))]):i);if(this.status===`closing`)throw Error(`Camera closed.`);this._video.srcObject=a}else{await this._video.play();let e=0;for(;++e<100&&!(this.video.readyState>=HTMLMediaElement.HAVE_ENOUGH_DATA);)await new Promise(e=>setTimeout(e,100))}if(yt&&this._requestedCamera!==`customized-video`){this._noUseButWorkaroundIosPwaProblem=this._video.offsetHeight,await new Promise(e=>{let t=!1,n=()=>{this._video.removeEventListener(`loadedmetadata`,n),t=!0,e()};this._video.addEventListener(`loadedmetadata`,n),setTimeout(()=>{t||(console.warn(`video loadedmetadata timeout`),n())},1e3)});let t=!1;if(await Promise.race([this.video.play().then(()=>{t=!0}),new Promise(n=>setTimeout(()=>{t||n()},e._videoPlayTimeout))]),!t)throw Error("`video.play()` unresponsive in current iOS PWA environment. Please use `singleFrameMode='camera'` instead.")}else{let t=!1;await Promise.race([this.video.play(),async function(){if(await new Promise(t=>setTimeout(t,e._videoPlayTimeout)),!t)throw Error(`video play timeout`)}()]),t=!0}if(this.status===`closing`)throw Error(`Camera closed.`);if(this.track){let t=this.track.getSettings(),n=0;for(;++n<e._countEnsureResolution&&!(t.width===this.video.videoWidth&&t.height===this.video.videoHeight||t.height===this.video.videoWidth&&t.width===this.video.videoHeight);)await new Promise(e=>setTimeout(e,100))}if(this.status===`closing`)throw Error(`Camera closed.`);this._pOpen.resolve()}else{if(this._pOpen=new ht,await this._video.play(),this.status===`closing`)throw Error(`Camera closed.`);this._paused=!1,this._pOpen.resolve()}for(let t of e._arrOnOpen)t.call(this);this._callOpenedListeners()}catch(e){var n,r;let t=(n=this._video)==null||(n=n.srcObject)==null||(r=n.getTracks)==null?void 0:r.call(n);if(t)for(let e of t)e?.stop();this._video.srcObject=null;let i=this._pOpen;this._pOpen=null,this._shouldClose=!1,i.catch(e=>{}),i.reject();let a=Error(`Error opening camera: ${e?.message}`,{cause:e});throw a.name=e.name,a}else{if(this.status!==`opening`&&this.status!==`closing`)throw Error(`Never`);await this._pOpen}}async pause(){try{await this._pOpen}catch{}this.status===`opened`&&(this._video.pause(),this._paused=!0)}async close(){var t,n,r;for(let t of e._arrBeforeClose)t.call(this);if(this.status===`closed`)return;if(this.status===`opening`&&(this._shouldClose=!0),this.status===`closing`){try{await this._pOpen}catch{}return}let i=(t=this._video)==null||(t=t.srcObject)==null||(n=t.getTracks)==null?void 0:n.call(t);if(i)for(let e of i)e?.stop();this._video&&(this._video.srcObject=null),this._pOpen=null,this._paused=!1,this._cameraChangedWhenPaused=!1;for(let t of e._arrOnClose)t.call(this);this._regionBoxWrapper&&(this._regionBoxWrapper.style.visibility=`hidden`),(r=this._eventListeners.closed)==null||r.forEach(e=>{try{e.call(this)}catch(e){console.error(e)}})}async requestCamera(e){if(typeof e==`string`)Ct.includes(e)?this._requestedCamera=e:this._requestedCamera={deviceId:{exact:e}};else if(e)if(e.kind===`videoinput`)e.deviceId?this._requestedCamera={deviceId:{exact:e.deviceId}}:this._requestedCamera=`back`;else{let t=this._requestedCamera=JSON.parse(JSON.stringify(e));if(t.width||t.height||t.aspectRatio){let e=this._requestedResolution={};t.width&&(e.width=t.width,delete t.width),t.height&&(e.height=t.height,delete t.height),t.aspectRatio&&(e.aspectRatio=t.aspectRatio,delete t.aspectRatio)}}else e===null?this._requestedCamera=null:e===void 0&&(this._requestedCamera=`back`);this.status===`opened`?(await this.close(),await this.open()):this.status===`paused`&&(this._cameraChangedWhenPaused=!0)}async requestResolution(t,n){let r={};if(typeof t==`number`?(r.width=t,typeof n==`number`&&(r.height=n)):Array.isArray(t)?(t[0]&&(r.width=t[0]),t[1]&&(r.height=t[1])):t?((t=JSON.parse(JSON.stringify(t))).width&&(r.width=t.width),t.height&&(r.height=t.height),t.aspectRatio&&(r.aspectRatio=t.aspectRatio)):t===null?r=null:t===void 0&&(r=bt),this._requestedResolution=r,this.status===`opened`)if(e._bReopenWhenChangeResolution)await this.close(),await this.open();else{e._delayBeforeApplyConstraints&&await new Promise(t=>setTimeout(t,e._delayBeforeApplyConstraints)),await this.track.applyConstraints(at(at({},this._requestedCamera),r));let t=this.track.getSettings(),n=0;for(;++n<e._countEnsureResolution&&!(t.width===this.video.videoWidth&&t.height===this.video.videoHeight||t.height===this.video.videoWidth&&t.width===this.video.videoHeight);)await new Promise(e=>setTimeout(e,100));this._callOpenedListeners()}else this.status===`paused`&&(e._bReopenWhenChangeResolution?this._cameraChangedWhenPaused=!0:(e._delayBeforeApplyConstraints&&await new Promise(t=>setTimeout(t,e._delayBeforeApplyConstraints)),await this.track.applyConstraints(at(at({},this._requestedCamera),r))))}async applyConstraints(e){this.track&&this._requestedCamera!==`c