@idscan/idvc2 2.8.11 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +6 -0
  2. package/dist/css/idvc.css +1 -1
  3. package/dist/idvc.js +2 -1688
  4. package/dist/idvc.js.LICENSE.txt +42 -0
  5. package/dist/idvc.js.gzip +0 -0
  6. package/dist/index.html +22 -19
  7. package/dist/js/environment/generalTypeCenters.json +5569 -0
  8. package/dist/js/environment/langs.js +1 -1
  9. package/dist/js/environment/networkNames.json +3 -2
  10. package/dist/js/environment/stepsDescription.ts +5 -5
  11. package/dist/langs.js.gzip +0 -0
  12. package/dist/networks/Blur-chunk.js +1 -1
  13. package/dist/networks/Bubble-chunk.js +1 -1
  14. package/dist/networks/ClassLocal-chunk.js +1 -1
  15. package/dist/networks/Face-chunk.js +1 -1
  16. package/dist/networks/GeneralTypeDetectionYolo-chunk.js +1 -0
  17. package/dist/networks/MRZ-chunk.js +1 -1
  18. package/dist/networks/PDF-chunk.js +1 -1
  19. package/dist/networks/ZXing-chunk.js +1 -1
  20. package/dist/networks/blurWorker.js.gzip +0 -0
  21. package/dist/networks/bubbleWorker.js.gzip +0 -0
  22. package/dist/networks/generalTypeDetectionYolo.onnx.gzip +0 -0
  23. package/dist/networks/mrzWorker.js.gzip +0 -0
  24. package/dist/networks/ort-wasm-simd.wasm.gzip +0 -0
  25. package/dist/networks/ort-wasm.wasm.gzip +0 -0
  26. package/dist/networks/pdfWorker.js.gzip +0 -0
  27. package/dist/types/bl.d.ts +1 -0
  28. package/dist/types/helpers/canvas.d.ts +6 -0
  29. package/dist/types/helpers/color.d.ts +1 -0
  30. package/dist/types/helpers/image.d.ts +7 -6
  31. package/dist/types/helpers/math.d.ts +2 -0
  32. package/dist/types/idvc.d.ts +1 -0
  33. package/dist/types/loader/loaderGeneralTypeDetectionYolo.d.ts +2 -0
  34. package/dist/types/modules/FrontProcessing.d.ts +5 -5
  35. package/dist/types/modules/MrzModule.d.ts +4 -4
  36. package/dist/types/modules/manualUploadProcessing.d.ts +1 -1
  37. package/dist/types/modules/ui/canvas.d.ts +1 -0
  38. package/dist/types/neural models/anglesModel.d.ts +1 -0
  39. package/dist/types/neural models/classLocalModel.d.ts +2 -1
  40. package/dist/types/neural models/generalTypeDetectionYoloModel.d.ts +24 -0
  41. package/dist/types/neural models/generalTypeYolo/exits.d.ts +5 -0
  42. package/dist/types/neural models/mrzModel.d.ts +2 -2
  43. package/dist/types/neural models/neuralModel.d.ts +1 -1
  44. package/package.json +3 -4
@@ -0,0 +1 @@
1
+ (self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[9],{7358:(t,e,n)=>{n.r(e),n.d(e,{default:()=>T});var r=n(4554),i=n(813),o=n(4328),u=n(7286),a=n(8417),c=n(6955),l=n(528),f=n(683);function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t,e,n,r,i,o,u){try{var a=t[o](u),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function y(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function b(t){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},b(t)}function v(t,e){return!e||"object"!=((n=e)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof e?h(t):e;var n}function g(t,e){return g=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},g(t,e)}function m(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);u=!0);}catch(t){a=!0,i=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw i}}return o}}(t,e)||S(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||S(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(t,e){if(t){if("string"==typeof t)return s(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0}}function I(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=b(t);if(e){var i=b(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return v(this,n)}}function x(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,r=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(6===o[0]&&u.label<i[1]){u.label=i[1],i=o;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(o);break}i[2]&&u.ops.pop(),u.trys.pop();continue}o=e.call(t,u)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var k={confidence:.5,predictConfidence:.55,classes:["BACKS_MRZ","BACKS_MRZPDF","BACKS_NO","BACKS_PDF","BCC","CAC","DLIC","EA","GC","IID","MID_NEW","MID_OLD","PASSP","PC","VA","VHC"],inputImageWidth:320,inputImageHeight:224,inputTensorSize:[1,224,320,3],inputTensorName:"image_input",outputTensorSize:[1,21,1470],outputTensorName:"Identity"},A=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&g(t,e)}(u,t);var e,n,r,o=I(u);function u(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.z.WASM,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),d(h(t=o.call(this,e,n,r)),"canvasSize",{width:1,height:1}),t}return e=u,n=[{key:"setSizes",value:function(t){var e=t.height,n=t.width;this.canvasSize.width=n,this.canvasSize.height=e}},{key:"predictFromImage",value:function(t,e){var n,r=this;return(n=function(){var n,i,o,u,a,c,s;return x(this,(function(h){switch(h.label){case 0:return r.loading?[2,{}]:(r.loading=!0,n=r.createSrc(t,"angles-input-canvas"),i=e||(0,l.vL)("general-type-canvas",{width:k.inputImageWidth,height:k.inputImageHeight}),o=(0,l.RT)({width:i.width,height:i.height},{width:n.width,height:n.height},10),(u=i.getContext("2d")).fillStyle="rgb(114, 114, 114)",u.fillRect(0,0,i.width,i.width),u.drawImage(n,o.x,o.y,o.width,o.height),a=(0,f.vG)(u.getImageData(0,0,i.width,i.height),f.eQ.WITHOUT),[4,r.predict(a)]);case 1:return c=h.sent(),s=r.processOutput(c[k.outputTensorName].data,i.width,i.height),r.setSizes(i),[2,r.interpret(s)]}}))},function(){var t=this,e=arguments;return new Promise((function(r,i){var o=n.apply(t,e);function u(t){p(o,r,i,u,a,"next",t)}function a(t){p(o,r,i,u,a,"throw",t)}u(void 0)}))})()}},{key:"interpret",value:function(t){var e=t.filter((function(t){return t[5]>k.predictConfidence}))[0]||[],n={side:"None",bbox:{topLeft:{x:0,y:0},bottomRight:{x:1,y:1}},perimeterInPercents:{width:0,height:0}};if(e.length){n.side=e[4];var r=e.slice(0,4);n.bbox.topLeft.x=r[0],n.bbox.topLeft.y=r[1],n.bbox.bottomRight.x=r[2],n.bbox.bottomRight.y=r[3],n.perimeterInPercents.width=(r[2]-r[0])/this.canvasSize.width*100,n.perimeterInPercents.height=(r[3]-r[1])/this.canvasSize.height*100}return this.loading=!1,n}},{key:"processOutput",value:function(t,e,n){for(var r=function(r){var i=w(Array(k.classes.length).keys()).map((function(e){return[e,t[u*(e+4)+r]]})).reduce((function(t,e){return e[1]>t[1]?e:t}),[0,0]);if(i[1]<k.confidence)return"continue";var a=k.classes[i[0]],c=t[r],l=t[u+r],f=t[2*u+r],s=t[3*u+r],h=(c-f/2)/k.inputImageWidth*e,p=(l-s/2)/k.inputImageHeight*n,y=(c+f/2)/k.inputImageWidth*e,d=(l+s/2)/k.inputImageHeight*n;o.push([h,p,y,d,a,i[1]])},i=this,o=[],u=k.outputTensorSize[k.outputTensorSize.length-1],a=0;a<u;a+=1)r(a);o=o.sort((function(t,e){return e[5]-t[5]}));for(var c=[];o.length>0;)c.push(o[0]),o=o.filter((function(t){return i.iou(o[0],t)<.2}));return c}},{key:"iou",value:function(t,e){return this.intersection(t,e)/this.union(t,e)}},{key:"union",value:function(t,e){var n=m(t,4),r=n[0],i=n[1],o=n[2],u=n[3],a=m(e,4),c=a[0],l=a[1];return(o-r)*(u-i)+(a[2]-c)*(a[3]-l)-this.intersection(t,e)}},{key:"intersection",value:function(t,e){var n=m(t,4),r=n[0],i=n[1],o=n[2],u=n[3],a=m(e,4),c=a[0],l=a[1],f=a[2],s=a[3],h=Math.max(r,c),p=Math.max(i,l);return(Math.min(o,f)-h)*(Math.min(u,s)-p)}},{key:"predict",value:function(t){var e=new a.es("float32",t,k.inputTensorSize),n=d({},k.inputTensorName,e);return this.session.run(n)}}],n&&y(e.prototype,n),r&&y(e,r),u}(c.Z);function C(t,e,n,r,i,o,u){try{var a=t[o](u),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function O(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function u(t){C(o,r,i,u,a,"next",t)}function a(t){C(o,r,i,u,a,"throw",t)}u(void 0)}))}}function P(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,r=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(6===o[0]&&u.label<i[1]){u.label=i[1],i=o;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(o);break}i[2]&&u.ops.pop(),u.trys.pop();continue}o=e.call(t,u)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}const T=O((function(){var t;return P(this,(function(e){return t=new A("".concat(r.t.JZ),i.z.WASM,o.Z.networkUrl),u.Z.setModule("model","generalTypeDetectionYolo",t),[2,[t.initialize.bind(t)]]}))}))}}]);
@@ -1 +1 @@
1
- (self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[343],{4550:(e,t,r)=>{r.d(t,{o:()=>l});var n=r(7885),o=r(7666);function i(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){r(e);return}a.done?t(c):Promise.resolve(c).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var u=e.apply(t,r);function a(e){i(u,n,o,a,c,"next",e)}function c(e){i(u,n,o,a,c,"throw",e)}a(void 0)})}}function a(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var c=function(){var e=u(function(e){var t,r,i,u,c;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),r=Uint8Array.bind,[4,(0,o.xl)(e)];case 1:return t=new(r.apply(Uint8Array,[void 0,a.sent()])),i=(0,n.ec)(t),u=new Blob([i.buffer],{type:"application/javascript"}),[2,URL.createObjectURL(u)];case 2:throw console.error("Error loading and decompressing worker file:",c=a.sent()),c;case 3:return[2]}})});return function(t){return e.apply(this,arguments)}}(),l=function(){var e=u(function(e){var t;return a(this,function(r){switch(r.label){case 0:return[4,c(e)];case 1:return t=r.sent(),[2,new Worker(t)]}})});return function(t){return e.apply(this,arguments)}}()},5470:(e,t,r)=>{r.r(t),r.d(t,{default:()=>q});var n=r(4328),o=r(7286),i=r(8736),u=r(6955),a=r(813),c=r(683),l=["0","1","2","3","4","*","5","6","7","*","8","9","A","*","B","C","*","D","*","E","*","F","*","G","*","H","I","J","*","K","*","L","*","M","N","O","P","*","Q","R","*","S","T","*","U","*","V","*","W","X","Y","*","Z","<","*"];function s(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){r(e);return}a.done?t(c):Promise.resolve(c).then(n,o)}function p(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){f(i,n,o,u,a,"next",e)}function a(e){f(i,n,o,u,a,"throw",e)}u(void 0)})}}function y(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function b(e,t,r){return t&&h(e.prototype,t),r&&h(e,r),e}function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}function w(e,t){return t&&("object"===k(t)||"function"==typeof t)?t:s(e)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function O(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function P(e){var t=O();return function(){var r,n=d(e);if(t){var o=d(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return w(this,r)}}function x(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var j=784,S=[1,28,28,1],R="input_1",A="dense",E=function(e){"use strict";m(r,e);var t=P(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.z.WASM,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return y(this,r),v(s(e=t.call(this,n,o,i)),"promiseList",void 0),v(s(e),"predictionList",void 0),e}return b(r,[{key:"predict",value:function(e){var t=v({},R,new i.Tensor("float32",e,S));return this.session.run(t)}},{key:"predictFromArray",value:function(e,t){var r=this;return p(function(){var n,o;return x(this,function(i){switch(i.label){case 0:if(r.promiseList||(r.promiseList=Array(t).fill(0)),r.predictionList||(r.predictionList=Array(t).fill(0)),r.loading)return[2,[]];for(o=0,n=(0,c.Fv)(e,c.eQ.STANDART);o<t;o+=1)r.promiseList[o]=r.predict(n.subarray(j*o,j*(o+1)));return[4,Promise.all(r.promiseList)];case 1:return i.sent().forEach(function(e,t){r.predictionList[t]=r.interpret(e[A].data)}),[2,r.predictionList]}})})()}},{key:"interpret",value:function(e){return Array.from(e).map(function(e,t){return{value:l[t],confidence:e}}).sort(function(e,t){return e.confidence-t.confidence}).slice(-3).reverse()}},{key:"isLoading",get:function(){return this.loading}},{key:"predictFromImage",value:function(e,t){}}]),r}(u.Z),M=r(4554);function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function C(e){if(Array.isArray(e))return e}function _(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){r(e);return}a.done?t(c):Promise.resolve(c).then(n,o)}function L(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){_(i,n,o,u,a,"next",e)}function a(e){_(i,n,o,u,a,"throw",e)}u(void 0)})}}function z(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function I(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Z(e,t,r){return t&&I(e.prototype,t),r&&I(e,r),e}function D(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,a=!1;try{for(o=o.call(e);!(u=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,n=e}finally{try{u||null==o.return||o.return()}finally{if(a)throw n}}return i}}function F(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function U(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){D(e,t,r[t])})}return e}function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function G(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):N(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function V(e,t){return C(e)||B(e,t)||W(e,t)||F()}function W(e,t){if(e){if("string"==typeof e)return T(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return T(e,t)}}function K(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var Q=function(){"use strict";function e(t,r,n){var o=this;z(this,e),D(this,"w",0),D(this,"h",0),D(this,"successCount",0),D(this,"worker",void 0),D(this,"model",void 0),D(this,"isInitialized",!1),D(this,"isProcessing",!1),D(this,"MIN_MRZ_FRAMES",3),this.model=new E("".concat(M.t.$I),a.z.WASM,n),this.worker=t,this.worker.postMessage({fn:"init",initData:{key:r,networkUrl:n}}),this.worker.onmessage=function(e){var t=e.data,r=t.name,n=t.data;"initialization"===r&&(o.isInitialized=n)}}return Z(e,[{key:"getErrorVal",value:function(e){var t;return -3===e&&(t=0),-2===e&&(t=1),t}},{key:"licenseError",value:function(e){return{error:!0,errorType:"licenceKeyError",errorVal:this.getErrorVal(e)}}},{key:"yComparator",value:function(e,t){return e.y<t.y?[e,t]:[t,e]}},{key:"allocate",value:function(){}},{key:"prepareMRZlocation",value:function(e){var t=[e.leftTop,e.rightTop,e.rightBottom,e.leftBottom].sort(function(e,t){return e.x-t.x}),r=V(this.yComparator(t[0],t[1]),2),n=r[0],o=r[1],i=V(this.yComparator(t[2],t[3]),2),u=i[0],a=i[1];return{leftTop:{x:n.x-.03,y:n.y-.03},rightTop:{x:u.x+.03,y:u.y-.03},rightBottom:{x:a.x+.03,y:a.y+.03},leftBottom:{x:o.x-.03,y:o.y+.03}}}},{key:"writeResults",value:function(e){var t={mrzText:""},r=e.fields.filter(function(e){return -1!==e.name.indexOf("Line")&&e.value.length>0}).map(function(e){return e.value}).join("\n");return r.length>0&&(t.mrzText=window.btoa(r)),t}},{key:"predict",value:function(e,t){var r=this;return L(function(){var n;return K(this,function(o){switch(o.label){case 0:return[4,r.model.predictFromArray(e,t)];case 1:if(!((n=o.sent()).filter(function(e){return"*"===V(e,1)[0].value}).length>3))return[3,3];return[4,r.model.predictFromArray(e.reverse(),t)];case 2:n=o.sent(),o.label=3;case 3:return[2,n]}})})()}},{key:"scan",value:function(e){var t=this;return new Promise(function(r){var n;t.worker.postMessage({fn:"prepare",iData:e}),t.worker.onmessage=(n=L(function(e){var n,o,i,u;return K(this,function(a){switch(a.label){case 0:if(o=(n=e.data).name,i=n.data,"batchArr"!==o)return[3,2];return[4,t.predict(i.batchArr,i.batchSize)];case 1:return u=a.sent(),t.worker.postMessage({fn:"process",predictions:u}),[2];case 2:return"result"===o&&r(i),r(i),[2]}})}),function(e){return n.apply(this,arguments)})})}},{key:"processMRZ",value:function(e){var t=this;return L(function(){var r,n,o,i,u,a,c;return K(this,function(l){switch(l.label){case 0:if(n={status:!1,cancel:!1,touch:!1,image:null,type:"mrz",isSuccessProcess:!1},t.isProcessing||!t.isInitialized)return[2,n];return t.isProcessing=!0,[4,t.scan(e)];case 1:if(null==(o=l.sent())?void 0:o.errorId)return t.isProcessing=!1,[2,G(U({},o),{error:t.licenseError(o.errorId)})];return o&&(null==o?void 0:null===(r=o.status)||void 0===r?void 0:r.value)===0&&(null==o?void 0:o.count)>0?(u=(i=t.estimateResults(o))===o.count&&o.symbolsConf>.95?"green":"yellow",n.coords={locations:t.prepareMRZlocation(o.location),color:u},a=i===o.count&&o.symbolsConf>.85,c=i>=o.count-2,(a||c)&&(t.successCount+=1,n.isSuccessProcess=!0,t.successCount>=t.MIN_MRZ_FRAMES&&(n.status=!0,n.needToCut=!0,n.image=e,n.results=t.writeResults(o)))):(n.coords=null,t.successCount=0),t.isProcessing=!1,[2,n]}})})()}},{key:"estimateResults",value:function(e){return 0===e.count?0:e.fields.reduce(function(e,t){return"Valid"===t.status?e+1:e},0)}},{key:"detectMrz",value:function(e){var t=this;return L(function(){var r,n,o;return K(this,function(i){switch(i.label){case 0:return[4,t.scan(e)];case 1:if(r=i.sent(),n=!0,r&&r.count>0&&r.symbolsConf>.8)return[2,{status:!0,locations:t.prepareMRZlocation(r.location),results:t.writeResults(r),isNotMRZ:n=!1}];return r&&r.symbolsConf>.6&&(n=!1),o={status:!1,isNotMRZ:n},(null==r?void 0:r.errorId)&&(o.error=t.licenseError(r.errorId)),[2,o]}})})()}}]),e}(),$=r(4295),H=r(4550);function J(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){r(e);return}a.done?t(c):Promise.resolve(c).then(n,o)}function X(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){J(i,n,o,u,a,"next",e)}function a(e){J(i,n,o,u,a,"throw",e)}u(void 0)})}}function Y(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}let q=function(){var e=X(function(e){var t,r,i,u;return Y(this,function(a){switch(a.label){case 0:if(t=e.commonLicenseKey)return[3,1];return(0,$.Z)(),[3,3];case 1:return[4,(0,H.o)("".concat(n.Z.chunkPublicPath,"mrzWorker.js.gzip"))];case 2:i=a.sent(),u=new Q(i,t,n.Z.networkUrl),o.Z.setModule("module","mrz",u),r=[u.model.initialize.bind(u.model)],a.label=3;case 3:return[2,r]}})});return function(t){return e.apply(this,arguments)}}()}}]);
1
+ (self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[343],{4550:(e,t,r)=>{r.d(t,{o:()=>s});var n=r(7885),o=r(7666);function i(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var u=e.apply(t,r);function a(e){i(u,n,o,a,c,"next",e)}function c(e){i(u,n,o,a,c,"throw",e)}a(void 0)}))}}function a(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var c,l=(c=u((function(e){var t,r,i,u,c;return a(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),r=Uint8Array.bind,[4,(0,o.xl)(e)];case 1:return t=new(r.apply(Uint8Array,[void 0,a.sent()])),i=(0,n.ec)(t),u=new Blob([i.buffer],{type:"application/javascript"}),[2,URL.createObjectURL(u)];case 2:throw c=a.sent(),console.error("Error loading and decompressing worker file:",c),c;case 3:return[2]}}))})),function(e){return c.apply(this,arguments)}),s=function(){var e=u((function(e){var t;return a(this,(function(r){switch(r.label){case 0:return[4,l(e)];case 1:return t=r.sent(),[2,new Worker(t)]}}))}));return function(t){return e.apply(this,arguments)}}()},5470:(e,t,r)=>{r.r(t),r.d(t,{default:()=>Z});var n=r(4328),o=r(7286),i=r(8417),u=r(6955),a=r(813),c=r(683),l=["0","1","2","3","4","*","5","6","7","*","8","9","A","*","B","C","*","D","*","E","*","F","*","G","*","H","I","J","*","K","*","L","*","M","N","O","P","*","Q","R","*","S","T","*","U","*","V","*","W","X","Y","*","Z","<","*"];function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function b(e,t){return!t||"object"!=((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof t?s(e):t;var r}function v(e,t){return v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},v(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=h(e);if(t){var o=h(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return b(this,r)}}function w(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var m=[1,28,28,1],g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(u,e);var t,r,n,o=d(u);function u(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.z.WASM,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),y(s(e=o.call(this,t,r,n)),"predictionList",void 0),y(s(e),"interpretedPredictionsList",void 0),e}return t=u,r=[{key:"predict",value:function(e){var t=y({},"input_1",new i.es("float32",e,m));return this.session.run(t)}},{key:"predictFromArray",value:function(e,t){var r,n=this;return(r=function(){var r,o,i;return w(this,(function(u){switch(u.label){case 0:if(n.predictionList||(n.predictionList=new Array(t).fill(0)),n.interpretedPredictionsList||(n.interpretedPredictionsList=new Array(t).fill(0)),n.loading)return[2,[]];r=(0,c.Fv)(e,c.eQ.STANDART),o=0,u.label=1;case 1:return o<t?(i=n.predictionList,[4,n.predict(r.subarray(784*o,784*(o+1)))]):[3,4];case 2:i[o]=u.sent(),u.label=3;case 3:return o+=1,[3,1];case 4:return n.predictionList.forEach((function(e,t){n.interpretedPredictionsList[t]=n.interpret(e.dense.data)})),[2,n.interpretedPredictionsList]}}))},function(){var e=this,t=arguments;return new Promise((function(n,o){var i=r.apply(e,t);function u(e){f(i,n,o,u,a,"next",e)}function a(e){f(i,n,o,u,a,"throw",e)}u(void 0)}))})()}},{key:"interpret",value:function(e){return Array.from(e).map((function(e,t){return{value:l[t],confidence:e}})).sort((function(e,t){return e.confidence-t.confidence})).slice(-3).reverse()}},{key:"isLoading",get:function(){return this.loading}},{key:"predictFromImage",value:function(e,t){}}],r&&p(t.prototype,r),n&&p(t,n),u}(u.Z),k=r(4554);function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function O(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function x(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){O(i,n,o,u,a,"next",e)}function a(e){O(i,n,o,u,a,"throw",e)}u(void 0)}))}}function j(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){S(e,t,r[t])}))}return e}function A(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(e);!(u=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var T=function(){function e(t,r,n){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),S(this,"w",0),S(this,"h",0),S(this,"successCount",0),S(this,"worker",void 0),S(this,"model",void 0),S(this,"isInitialized",!1),S(this,"isProcessing",!1),S(this,"MIN_MRZ_FRAMES",3),this.model=new g("".concat(k.t.$I),a.z.WASM,n),this.worker=t,this.worker.postMessage({fn:"init",initData:{key:r,networkUrl:n}}),this.worker.onmessage=function(e){var t=e.data,r=t.name,n=t.data;"initialization"===r&&(o.isInitialized=n)}}var t,r,n;return t=e,r=[{key:"getErrorVal",value:function(e){var t;return-3===e&&(t=0),-2===e&&(t=1),t}},{key:"licenseError",value:function(e){return{error:!0,errorType:"licenceKeyError",errorVal:this.getErrorVal(e)}}},{key:"yComparator",value:function(e,t){return e.y<t.y?[e,t]:[t,e]}},{key:"allocate",value:function(){}},{key:"prepareMRZlocation",value:function(e){var t=[e.leftTop,e.rightTop,e.rightBottom,e.leftBottom].sort((function(e,t){return e.x-t.x})),r=E(this.yComparator(t[0],t[1]),2),n=r[0],o=r[1],i=E(this.yComparator(t[2],t[3]),2),u=i[0],a=i[1],c=.03;return{leftTop:{x:n.x-c,y:n.y-c},rightTop:{x:u.x+c,y:u.y-c},rightBottom:{x:a.x+c,y:a.y+c},leftBottom:{x:o.x-c,y:o.y+c}}}},{key:"writeResults",value:function(e){var t={mrzText:""},r=e.fields.filter((function(e){return-1!==e.name.indexOf("Line")&&e.value.length>0})).map((function(e){return e.value})).join("\n");return r.length>0&&(t.mrzText=window.btoa(r)),t}},{key:"predict",value:function(e,t){var r=this;return x((function(){var n;return M(this,(function(o){switch(o.label){case 0:return[4,r.model.predictFromArray(e,t)];case 1:return(n=o.sent()).filter((function(e){return"*"===E(e,1)[0].value})).length>3?[4,r.model.predictFromArray(e.reverse(),t)]:[3,3];case 2:n=o.sent(),o.label=3;case 3:return[2,n]}}))}))()}},{key:"scan",value:function(e){var t=this;return new Promise((function(r){t.worker.postMessage({fn:"prepare",iData:e});var n,o=t;t.worker.onmessage=(n=x((function(e){var t,n,i,u;return M(this,(function(a){switch(a.label){case 0:return t=e.data,n=t.name,i=t.data,"batchArr"!==n?[3,2]:[4,o.predict(i.batchArr,i.batchSize)];case 1:return u=a.sent(),o.worker.postMessage({fn:"process",predictions:u}),[2];case 2:return"result"===n&&r(i),r(i),[2]}}))})),function(e){return n.apply(this,arguments)})}))}},{key:"processMRZ",value:function(e){var t=this;return x((function(){var r,n,o,i,u,a,c;return M(this,(function(l){switch(l.label){case 0:return n={status:!1,cancel:!1,touch:!1,image:null,type:"mrz",isSuccessProcess:!1},t.isProcessing?[2,n]:t.isInitialized?(t.isProcessing=!0,[4,t.scan(e)]):[2,n];case 1:return(null==(o=l.sent())?void 0:o.errorId)?(t.isProcessing=!1,[2,A(R({},o),{error:t.licenseError(o.errorId)})]):(o&&0===(null==o||null===(r=o.status)||void 0===r?void 0:r.value)&&(null==o?void 0:o.count)>0?(i=t.estimateResults(o),u=i===o.count&&o.symbolsConf>.95?"green":"yellow",n.coords={locations:t.prepareMRZlocation(o.location),color:u},a=i===o.count&&o.symbolsConf>.85,c=i>=o.count-2,(a||c)&&(t.successCount+=1,n.isSuccessProcess=!0,t.successCount>=t.MIN_MRZ_FRAMES&&(n.status=!0,n.needToCut=!0,n.image=e,n.results=t.writeResults(o)))):(n.coords=null,t.successCount=0),t.isProcessing=!1,[2,n])}}))}))()}},{key:"estimateResults",value:function(e){return 0===e.count?0:e.fields.reduce((function(e,t){return"Valid"===t.status?e+1:e}),0)}},{key:"detectMrz",value:function(e){var t=this;return x((function(){var r,n,o,i,u;return M(this,(function(a){switch(a.label){case 0:return[4,t.scan(e)];case 1:return r=a.sent(),n=!0,r&&r.count>0&&r.symbolsConf>.8?(o=t.prepareMRZlocation(r.location),i=t.writeResults(r),[2,{status:!0,locations:o,results:i,isNotMRZ:n=!1}]):(r&&r.symbolsConf>.6&&(n=!1),u={status:!1,isNotMRZ:n},(null==r?void 0:r.errorId)&&(u.error=t.licenseError(r.errorId)),[2,u])}}))}))()}}],r&&j(t.prototype,r),n&&j(t,n),e}();const C=T;var _=r(4295),L=r(4550);function z(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function I(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}const Z=(D=function(e){var t,r,i,u;return I(this,(function(a){switch(a.label){case 0:return(t=e.commonLicenseKey)?[3,1]:((0,_.Z)(),[3,3]);case 1:return[4,(0,L.o)("".concat(n.Z.chunkPublicPath,"mrzWorker.js.gzip"))];case 2:i=a.sent(),u=new C(i,t,n.Z.networkUrl),o.Z.setModule("module","mrz",u),r=[u.model.initialize.bind(u.model)],a.label=3;case 3:return[2,r]}}))},B=function(){var e=this,t=arguments;return new Promise((function(r,n){var o=D.apply(e,t);function i(e){z(o,r,n,i,u,"next",e)}function u(e){z(o,r,n,i,u,"throw",e)}i(void 0)}))},function(e){return B.apply(this,arguments)});var D,B}}]);
@@ -1 +1 @@
1
- (self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[596],{4550:(e,r,t)=>{t.d(r,{o:()=>c});var n=t(7885),o=t(7666);function i(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){t(e);return}u.done?r(s):Promise.resolve(s).then(n,o)}function a(e){return function(){var r=this,t=arguments;return new Promise(function(n,o){var a=e.apply(r,t);function u(e){i(a,n,o,u,s,"next",e)}function s(e){i(a,n,o,u,s,"throw",e)}u(void 0)})}}function u(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var s=function(){var e=a(function(e){var r,t,i,a,s;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),t=Uint8Array.bind,[4,(0,o.xl)(e)];case 1:return r=new(t.apply(Uint8Array,[void 0,u.sent()])),i=(0,n.ec)(r),a=new Blob([i.buffer],{type:"application/javascript"}),[2,URL.createObjectURL(a)];case 2:throw console.error("Error loading and decompressing worker file:",s=u.sent()),s;case 3:return[2]}})});return function(r){return e.apply(this,arguments)}}(),c=function(){var e=a(function(e){var r;return u(this,function(t){switch(t.label){case 0:return[4,s(e)];case 1:return r=t.sent(),[2,new Worker(r)]}})});return function(r){return e.apply(this,arguments)}}()},8766:(e,r,t)=>{t.r(r),t.d(r,{default:()=>z});var n=t(4328),o=t(6399);function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function a(e){if(Array.isArray(e))return e}function u(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){t(e);return}u.done?r(s):Promise.resolve(s).then(n,o)}function s(e){return function(){var r=this,t=arguments;return new Promise(function(n,o){var i=e.apply(r,t);function a(e){u(i,n,o,a,s,"next",e)}function s(e){u(i,n,o,a,s,"throw",e)}a(void 0)})}}function c(e,r){if(!(e instanceof r))throw TypeError("Cannot call a class as a function")}function l(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,r,t){return r&&l(e.prototype,r),t&&l(e,t),e}function d(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(e,r){var t,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(t=o.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}function h(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e,r){return a(e)||p(e,r)||v(e,r)||h()}function v(e,r){if(e){if("string"==typeof e)return i(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i(e,r)}}function b(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var w=function(){"use strict";function e(r,t,n){var o=this;c(this,e),d(this,"module",void 0),d(this,"handle",null),d(this,"bw",0),d(this,"bh",0),d(this,"src",null),d(this,"out",null),d(this,"isAllocate",!1),d(this,"worker",void 0),d(this,"isProcessing",!1),d(this,"isInitialized",!1),d(this,"successCount",0),d(this,"pdfCapturedCount",0),d(this,"src2",null),d(this,"locations",null),d(this,"pdfCount",0),d(this,"geometry",void 0),d(this,"minPDFframes",1),d(this,"cropSizes",void 0),d(this,"canvasSizes",void 0),d(this,"privateErrorId",0),this.worker=r,this.worker.onmessage=function(e){var r=e.data,t=r.name,n=r.data;"initialization"===t&&(o.isInitialized=n)},this.worker.postMessage({fn:"init",key:t,isNeedToLoadPDFWIthPreprocess:n})}return f(e,[{key:"errorId",get:function(){return this.privateErrorId},set:function(e){this.privateErrorId=[o.l.Detected,o.l.Decoded].includes(e)?0:e}},{key:"errorVal",get:function(){var e;return this.errorId===o.l.LicenseKeyHasExpired&&(e=0),this.errorId===o.l.InvalidLicenseKey&&(e=1),e}},{key:"init",value:function(e,r,t,n){this.geometry=e,this.minPDFframes=r,this.cropSizes=t,this.canvasSizes=n}},{key:"licenseError",value:function(){return{error:!0,errorType:"licenceKeyError",errorVal:this.errorVal}}},{key:"create",value:function(){}},{key:"setSizes",value:function(e,r){this.bw=e,this.bh=r,this.worker.postMessage({fn:"setSizes",bw:e,bh:r})}},{key:"allocate",value:function(){this.worker.postMessage({fn:"allocate"})}},{key:"drawCords",value:function(e){var r=this,t=[];if(e){var n=[];Object.entries(e).forEach(function(e){var t=y(e,2),o=t[0],i=Math.trunc(t[1]),a=o[0],u=+o[1]-1;n[u]||(n[u]={x:0,y:0}),"x"===a?n[u].x=r.canvasSizes.width*i/r.bw:n[u].y=r.canvasSizes.height*i/r.bh});var o=[n[3].x-n[0].x,n[3].y-n[0].y],i=[n[1].x-n[0].x,n[1].y-n[0].y],a=[n[2].x-n[1].x,n[2].y-n[1].y],u=[n[3].x-n[2].x,n[3].y-n[2].y],s=this.geometry.angleBetweenTwoVectors(o,i),c=this.geometry.angleBetweenTwoVectors(a,u);s<=100&&s>=80&&c<=100&&c>=80&&(t=n)}return t}},{key:"processPDF",value:function(e){var r=this;return s(function(){var t,n;return b(this,function(i){switch(i.label){case 0:if(r.isProcessing)return[2,{}];if(t={status:!1,predict:!1,touch:!1,image:null,type:"pdf",error:null,coords:[],trackString:"",pdfSuccessCount:0,pdfCount:0,isSuccessProcess:!1,pdfCapturedCount:0},!r.isInitialized)return[2,t];return r.isProcessing=!0,[4,r.readPDF(e)];case 1:if((n=i.sent()).error)return r.isProcessing=!1,t.error=n,[2,t];return n&&"status"in n&&(n.status.value===o.l.Detected&&(r.pdfCapturedCount+=1),n.status.value===o.l.Detected||n.status.value===o.l.Decoded?(t.coords=r.drawCords(n.location),t.isSuccessProcess=!0):(r.successCount+=1,r.drawCords(null)),n.status.value===o.l.Decoded?(r.pdfCount+=1,r.pdfCount>=r.minPDFframes&&(r.successCount=0,r.pdfCount=0,t.trackString=n.trackString||n.data||"",t.status=!0,t.image=e,t.pdfCapturedCount=0)):r.pdfCount=0),t.pdfSuccessCount=r.successCount,t.pdfCount=r.pdfCount,t.pdfCapturedCount=r.pdfCapturedCount,r.isProcessing=!1,[2,t]}})})()}},{key:"processPDFWithPreProcess",value:function(e){var r=this;return new Promise(function(t){r.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data;if("result"===o){r.errorId=null==i?void 0:null===(a=i.status)||void 0===a?void 0:a.value;var a,u=(r.errorId?r.licenseError():null)||i;t(u)}else t(i)},r.worker.postMessage({fn:"pdfWithPreProcess",iData:e})})}},{key:"readPDF",value:function(e){var r=this;return s(function(){return b(this,function(t){return[2,new Promise(function(t){r.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data,a=n.bw,u=n.bh;if("ready"===o)r.worker.postMessage({fn:"process"});else if("result"===o){r.errorId=null==i?void 0:null===(s=i.status)||void 0===s?void 0:s.value;var s,c=(r.errorId?r.licenseError():null)||i;r.bw=a,r.bh=u,t(c)}else t(i)},r.worker.postMessage({fn:"prepare",iData:e})})]})})()}}]),e}(),m=t(7286),g=t(4550);function k(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function C(e){if(Array.isArray(e))return e}function P(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){t(e);return}u.done?r(s):Promise.resolve(s).then(n,o)}function S(e){return function(){var r=this,t=arguments;return new Promise(function(n,o){var i=e.apply(r,t);function a(e){P(i,n,o,a,u,"next",e)}function u(e){P(i,n,o,a,u,"throw",e)}a(void 0)})}}function x(e,r){var t,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(t=o.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}function I(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function D(e,r){return C(e)||x(e,r)||E(e,r)||I()}function E(e,r){if(e){if("string"==typeof e)return k(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return k(e,r)}}function A(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var j=function(){var e=S(function(e){var r,t,o,i;return A(this,function(a){switch(a.label){case 0:return r=e.pdf417key,t=!!Object.entries(n.Z.config.documentTypes).find(function(e){var r=D(e,2);return(r[0],r[1]).find(function(e){return("pdf"===e.type||"back"===e.type)&&e.mode.uploader})}),[4,(0,g.o)("".concat(n.Z.chunkPublicPath,"pdfWorker.js.gzip"))];case 1:return o=a.sent(),i=new w(o,r,t),m.Z.setModule("module","pdf",i),[2]}})});return function(r){return e.apply(this,arguments)}}();let z=j}}]);
1
+ (self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[596],{4550:(e,r,t)=>{t.d(r,{o:()=>c});var n=t(7885),o=t(7666);function i(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function a(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var a=e.apply(r,t);function u(e){i(a,n,o,u,s,"next",e)}function s(e){i(a,n,o,u,s,"throw",e)}u(void 0)}))}}function u(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var s,l=(s=a((function(e){var r,t,i,a,s;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),t=Uint8Array.bind,[4,(0,o.xl)(e)];case 1:return r=new(t.apply(Uint8Array,[void 0,u.sent()])),i=(0,n.ec)(r),a=new Blob([i.buffer],{type:"application/javascript"}),[2,URL.createObjectURL(a)];case 2:throw s=u.sent(),console.error("Error loading and decompressing worker file:",s),s;case 3:return[2]}}))})),function(e){return s.apply(this,arguments)}),c=function(){var e=a((function(e){var r;return u(this,(function(t){switch(t.label){case 0:return[4,l(e)];case 1:return r=t.sent(),[2,new Worker(r)]}}))}));return function(r){return e.apply(this,arguments)}}()},8766:(e,r,t)=>{t.r(r),t.d(r,{default:()=>k});var n=t(4328),o=t(6399);function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function a(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function u(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var i=e.apply(r,t);function u(e){a(i,n,o,u,s,"next",e)}function s(e){a(i,n,o,u,s,"throw",e)}u(void 0)}))}}function s(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return i(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var d=function(){function e(r,t,n){var o=this;!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),l(this,"module",void 0),l(this,"handle",null),l(this,"bw",0),l(this,"bh",0),l(this,"src",null),l(this,"out",null),l(this,"isAllocate",!1),l(this,"worker",void 0),l(this,"isProcessing",!1),l(this,"isInitialized",!1),l(this,"successCount",0),l(this,"pdfCapturedCount",0),l(this,"src2",null),l(this,"locations",null),l(this,"pdfCount",0),l(this,"geometry",void 0),l(this,"minPDFframes",1),l(this,"cropSizes",void 0),l(this,"canvasSizes",void 0),l(this,"privateErrorId",0),this.worker=r,this.worker.onmessage=function(e){var r=e.data,t=r.name,n=r.data;"initialization"===t&&(o.isInitialized=n)},this.worker.postMessage({fn:"init",key:t,isNeedToLoadPDFWIthPreprocess:n})}var r,t,n;return r=e,(t=[{key:"errorId",get:function(){return this.privateErrorId},set:function(e){this.privateErrorId=[o.l.Detected,o.l.Decoded].includes(e)?0:e}},{key:"errorVal",get:function(){var e;return this.errorId===o.l.LicenseKeyHasExpired&&(e=0),this.errorId===o.l.InvalidLicenseKey&&(e=1),e}},{key:"init",value:function(e,r,t,n){this.geometry=e,this.minPDFframes=r,this.cropSizes=t,this.canvasSizes=n}},{key:"licenseError",value:function(){return{error:!0,errorType:"licenceKeyError",errorVal:this.errorVal}}},{key:"create",value:function(){}},{key:"setSizes",value:function(e,r){this.bw=e,this.bh=r,this.worker.postMessage({fn:"setSizes",bw:e,bh:r})}},{key:"allocate",value:function(){this.worker.postMessage({fn:"allocate"})}},{key:"drawCords",value:function(e){var r=this,t=[];if(e){var n=[];Object.entries(e).forEach((function(e){var t=c(e,2),o=t[0],i=t[1],a=Math.trunc(i),u=o[0],s=+o[1]-1;n[s]||(n[s]={x:0,y:0}),"x"===u?n[s].x=r.canvasSizes.width*a/r.bw:n[s].y=r.canvasSizes.height*a/r.bh}));var o=[n[3].x-n[0].x,n[3].y-n[0].y],i=[n[1].x-n[0].x,n[1].y-n[0].y],a=[n[2].x-n[1].x,n[2].y-n[1].y],u=[n[3].x-n[2].x,n[3].y-n[2].y],s=this.geometry.angleBetweenTwoVectors(o,i),l=this.geometry.angleBetweenTwoVectors(a,u);s<=100&&s>=80&&l<=100&&l>=80&&(t=n)}return t}},{key:"processPDF",value:function(e){var r=this;return u((function(){var t,n;return f(this,(function(i){switch(i.label){case 0:return r.isProcessing?[2,{}]:(t={status:!1,predict:!1,touch:!1,image:null,type:"pdf",error:null,coords:[],trackString:"",pdfSuccessCount:0,pdfCount:0,isSuccessProcess:!1,pdfCapturedCount:0},r.isInitialized?(r.isProcessing=!0,[4,r.readPDF(e)]):[2,t]);case 1:return(n=i.sent()).error?(r.isProcessing=!1,t.error=n,[2,t]):(n&&"status"in n&&(n.status.value===o.l.Detected&&(r.pdfCapturedCount+=1),n.status.value===o.l.Detected||n.status.value===o.l.Decoded?(t.coords=r.drawCords(n.location),t.isSuccessProcess=!0):(r.successCount+=1,r.drawCords(null)),n.status.value===o.l.Decoded?(r.pdfCount+=1,r.pdfCount>=r.minPDFframes&&(r.successCount=0,r.pdfCount=0,t.trackString=n.trackString||n.data||"",t.status=!0,t.image=e,t.pdfCapturedCount=0)):r.pdfCount=0),t.pdfSuccessCount=r.successCount,t.pdfCount=r.pdfCount,t.pdfCapturedCount=r.pdfCapturedCount,r.isProcessing=!1,[2,t])}}))}))()}},{key:"processPDFWithPreProcess",value:function(e){var r=this;return new Promise((function(t){r.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data;if("result"===o){var a;r.errorId=null==i||null===(a=i.status)||void 0===a?void 0:a.value;var u=r.errorId?r.licenseError():null;t(u||i)}else t(i)},r.worker.postMessage({fn:"pdfWithPreProcess",iData:e})}))}},{key:"readPDF",value:function(e){var r=this;return u((function(){return f(this,(function(t){return[2,new Promise((function(t){r.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data,a=n.bw,u=n.bh;if("ready"===o)r.worker.postMessage({fn:"process"});else if("result"===o){var s;r.errorId=null==i||null===(s=i.status)||void 0===s?void 0:s.value;var l=(r.errorId?r.licenseError():null)||i;r.bw=a,r.bh=u,t(l)}else t(i)},r.worker.postMessage({fn:"prepare",iData:e})}))]}))}))()}}])&&s(r.prototype,t),n&&s(r,n),e}();var p,h,y=t(7286),v=t(4550);function b(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function w(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function m(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return b(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return b(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}const k=(p=function(e){var r,t,o,i;return g(this,(function(a){switch(a.label){case 0:return r=e.pdf417key,t=!!Object.entries(n.Z.config.documentTypes).find((function(e){var r=m(e,2);return r[0],r[1].find((function(e){return("pdf"===e.type||"back"===e.type)&&e.mode.uploader}))})),[4,(0,v.o)("".concat(n.Z.chunkPublicPath,"pdfWorker.js.gzip"))];case 1:return o=a.sent(),i=new d(o,r,t),y.Z.setModule("module","pdf",i),[2]}}))},h=function(){var e=this,r=arguments;return new Promise((function(t,n){var o=p.apply(e,r);function i(e){w(o,t,n,i,a,"next",e)}function a(e){w(o,t,n,i,a,"throw",e)}i(void 0)}))},function(e){return h.apply(this,arguments)})}}]);