tesseract.js
Advanced tools
Comparing version 2.0.0-beta.1 to 2.0.0-beta.2
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Tesseract=t():e.Tesseract=t()}(window,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=14)}([function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=r(9),i=r(33),a=Object.prototype.toString;function c(e){return"[object Array]"===a.call(e)}function u(e){return null!==e&&"object"===n(e)}function s(e){return"[object Function]"===a.call(e)}function f(e,t){if(null!=e)if("object"!==n(e)&&(e=[e]),c(e))for(var r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:c,isArrayBuffer:function(e){return"[object ArrayBuffer]"===a.call(e)},isBuffer:i,isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:u,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===a.call(e)},isFile:function(e){return"[object File]"===a.call(e)},isBlob:function(e){return"[object Blob]"===a.call(e)},isFunction:s,isStream:function(e){return u(e)&&s(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:f,merge:function e(){var t={};function r(r,o){"object"===n(t[o])&&"object"===n(r)?t[o]=e(t[o],r):t[o]=r}for(var o=0,i=arguments.length;o<i;o++)f(arguments[o],r);return t},extend:function(e,t,r){return f(t,function(t,n){e[n]=r&&"function"==typeof t?o(t,r):t}),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(e,t){e.exports=function(e,t){return"".concat(e,"-").concat(t,"-").concat(Math.random().toString(16).slice(3,8))}},function(e,t){var r=this,n=!1;t.logging=n,t.setLogging=function(e){n=e},t.log=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return n?console.log.apply(r,t):null}},function(e,t,r){var n,o;void 0===(o="function"==typeof(n=function(){return function(){var e=arguments.length;if(0===e)throw new Error("resolveUrl requires at least one argument; got none.");var t=document.createElement("base");if(t.href=arguments[0],1===e)return t.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(t,r.firstChild);for(var n,o=document.createElement("a"),i=1;i<e;i++)o.href=arguments[i],n=o.href,t.href=n;return r.removeChild(t),n}})?n.call(t,r,t,e):n)||(e.exports=o)},function(e,t,r){"use strict";(function(t){var n=r(0),o=r(35),i={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,u={adapter:("undefined"!=typeof XMLHttpRequest?c=r(10):void 0!==t&&(c=r(10)),c),transformRequest:[function(e,t){return o(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)?(a(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],function(e){u.headers[e]={}}),n.forEach(["post","put","patch"],function(e){u.headers[e]=n.merge(i)}),e.exports=u}).call(this,r(8))},function(e,t,r){var n=r(1),o=0;e.exports=function(e){var t=e.id,r=e.action,i=e.payload,a=void 0===i?{}:i,c=t;return void 0===c&&(c=n("Job",o),o+=1),{id:c,action:r,payload:a}}},function(e,t,r){function n(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function o(e){return function(){var t=this,r=arguments;return new Promise(function(o,i){var a=e.apply(t,r);function c(e){n(a,o,i,c,u,"next",e)}function u(e){n(a,o,i,c,u,"throw",e)}c(void 0)})}}function i(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){a(e,t,r[t])})}return e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var u=r(18),s=r(20),f=r(5),l=r(2).log,p=r(1),d=r(21).defaultOEM,h=r(22),m=h.defaultOptions,y=h.spawnWorker,g=h.terminateWorker,v=h.onMessage,b=h.loadImage,w=h.send,x=0;e.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=p("Worker",x),r=u(i({},m,e)),n=r.logger,a=c(r,["logger"]),h={},j={},O=y(a);x+=1;var E=function(e,t){h[e]=t},k=function(e,t){j[e]=t},S=function(e){var r=e.id,n=e.action,o=e.payload;return new Promise(function(e,i){l("[".concat(t,"]: Start ").concat(r,", action=").concat(n)),E(n,e),k(n,i),w(O,{workerId:t,jobId:r,action:n,payload:o})})},L=function(){var e=o(regeneratorRuntime.mark(function e(t){var r,n,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:{},n=o.length>2?o[2]:void 0,e.t0=S,e.t1=f,e.t2=n,e.next=7,b(t);case 7:return e.t3=e.sent,e.t4=r,e.t5={image:e.t3,options:e.t4},e.t6={id:e.t2,action:"recognize",payload:e.t5},e.t7=(0,e.t1)(e.t6),e.abrupt("return",(0,e.t0)(e.t7));case 13:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),P=function(){var e=o(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=S,e.t1=f,e.t2=r,e.next=5,b(t);case 5:return e.t3=e.sent,e.t4={image:e.t3},e.t5={id:e.t2,action:"detect",payload:e.t4},e.t6=(0,e.t1)(e.t5),e.abrupt("return",(0,e.t0)(e.t6));case 10:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}(),R=function(){var e=o(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===O){e.next=5;break}return e.next=3,S(f({id:t,action:"terminate"}));case 3:g(O),O=null;case 5:return e.abrupt("return",Promise.resolve());case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}();return v(O,function(e){var t=e.workerId,r=e.jobId,o=e.status,a=e.action,c=e.data;if("resolve"===o){l("[".concat(t,"]: Complete ").concat(r));var u=c;"recognize"===a?u=s(c):"getPDF"===a&&(u=Array.from(i({},c,{length:Object.keys(c).length}))),h[a]({jobId:r,data:u})}else{if("reject"===o)throw j[a](c),Error(c);"progress"===o&&n(c)}}),{id:t,worker:O,setResolve:E,setReject:k,load:function(e){return S(f({id:e,action:"load",payload:{options:a}}))},loadLanguage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"eng",t=arguments.length>1?arguments[1]:void 0;return S(f({id:t,action:"loadLanguage",payload:{langs:e,options:a}}))},initialize:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"eng",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d,r=arguments.length>2?arguments[2]:void 0;return S(f({id:r,action:"initialize",payload:{langs:e,oem:t}}))},setParameters:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return S(f({id:t,action:"setParameters",payload:{params:e}}))},recognize:L,getPDF:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Tesseract OCR Result",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2?arguments[2]:void 0;return S(f({id:r,action:"getPDF",payload:{title:e,textonly:t}}))},detect:P,terminate:R}}},function(e,t){e.exports={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}},function(e,t){var r,n,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var u,s=[],f=!1,l=-1;function p(){f&&u&&(f=!1,u.length?s=u.concat(s):l=-1,s.length&&d())}function d(){if(!f){var e=c(p);f=!0;for(var t=s.length;t;){for(u=s,s=[];++l<t;)u&&u[l].run();l=-1,t=s.length}u=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];s.push(new h(e,t)),1!==s.length||f||c(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},function(e,t,r){"use strict";var n=r(0),o=r(36),i=r(38),a=r(39),c=r(40),u=r(11),s="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||r(41);e.exports=function(e){return new Promise(function(t,f){var l=e.data,p=e.headers;n.isFormData(l)&&delete p["Content-Type"];var d=new XMLHttpRequest,h="onreadystatechange",m=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in d||c(e.url)||(d=new window.XDomainRequest,h="onload",m=!0,d.onprogress=function(){},d.ontimeout=function(){}),e.auth){var y=e.auth.username||"",g=e.auth.password||"";p.Authorization="Basic "+s(y+":"+g)}if(d.open(e.method.toUpperCase(),i(e.url,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,d[h]=function(){if(d&&(4===d.readyState||m)&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in d?a(d.getAllResponseHeaders()):null,n={data:e.responseType&&"text"!==e.responseType?d.response:d.responseText,status:1223===d.status?204:d.status,statusText:1223===d.status?"No Content":d.statusText,headers:r,config:e,request:d};o(t,f,n),d=null}},d.onerror=function(){f(u("Network Error",e,null,d)),d=null},d.ontimeout=function(){f(u("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",d)),d=null},n.isStandardBrowserEnv()){var v=r(42),b=(e.withCredentials||c(e.url))&&e.xsrfCookieName?v.read(e.xsrfCookieName):void 0;b&&(p[e.xsrfHeaderName]=b)}if("setRequestHeader"in d&&n.forEach(p,function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete p[t]:d.setRequestHeader(t,e)}),e.withCredentials&&(d.withCredentials=!0),e.responseType)try{d.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){d&&(d.abort(),f(e),d=null)}),void 0===l&&(l=null),d.send(l)})}},function(e,t,r){"use strict";var n=r(37);e.exports=function(e,t,r,o,i){var a=new Error(e);return n(a,t,r,o,i)}},function(e,t,r){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,r){function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r(15);var o=r(17),i=r(6),a=r(50),c=r(7),u=r(51),s=r(2).setLogging;e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}({OEM:c,PSM:u,createScheduler:o,createWorker:i,setLogging:s},a)},function(e,t,r){(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=function(e){"use strict";var r,n=Object.prototype,o=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),a=new P(n||[]);return i._invoke=function(e,t,r){var n=l;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw i;return T()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=k(a,r);if(c){if(c===m)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=f(e,t,r);if("normal"===u.type){if(n=r.done?h:p,u.arg===m)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=h,r.method="throw",r.arg=u.arg)}}}(e,r,a),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l="suspendedStart",p="suspendedYield",d="executing",h="completed",m={};function y(){}function g(){}function v(){}var b={};b[a]=function(){return this};var w=Object.getPrototypeOf,x=w&&w(w(R([])));x&&x!==n&&o.call(x,a)&&(b=x);var j=v.prototype=y.prototype=Object.create(b);function O(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function E(e){var r;this._invoke=function(n,i){function a(){return new Promise(function(r,a){!function r(n,i,a,c){var u=f(e[n],e,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"===t(l)&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,a,c)},function(e){r("throw",e,a,c)}):Promise.resolve(l).then(function(e){s.value=e,a(s)},function(e){return r("throw",e,a,c)})}c(u.arg)}(n,i,r,a)})}return r=r?r.then(a,a):a()}}function k(e,t){var n=e.iterator[t.method];if(n===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=r,k(e,t),"throw"===t.method))return m;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=f(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,m;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,m):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function R(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=r,t.done=!0,t};return i.next=i}}return{next:T}}function T(){return{value:r,done:!0}}return g.prototype=j.constructor=v,v.constructor=g,v[u]=g.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u in e||(e[u]="GeneratorFunction")),e.prototype=Object.create(j),e},e.awrap=function(e){return{__await:e}},O(E.prototype),E.prototype[c]=function(){return this},e.AsyncIterator=E,e.async=function(t,r,n,o){var i=new E(s(t,r,n,o));return e.isGeneratorFunction(r)?i:i.next().then(function(e){return e.done?e.value:i.next()})},O(j),j[u]="Generator",j[a]=function(){return this},j.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=R,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(L),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,o){return c.type="throw",c.arg=e,t.next=n,o&&(t.method="next",t.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:R(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),m}},e}("object"===t(e)?e.exports:{});try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}}).call(this,r(16)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){var n=this;function o(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function i(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function c(e){i(a,n,o,c,u,"next",e)}function u(e){i(a,n,o,c,u,"throw",e)}c(void 0)})}}var c=r(5),u=r(2).log,s=r(1),f=0;e.exports=function(){var e=s("Scheduler",f),t={},r={},i=[];f+=1;var l=function(){return Object.keys(t).length},p=function(){if(0!==i.length)for(var e=Object.keys(t),n=0;n<e.length;n+=1)if(void 0===r[e[n]]){i[0](t[e[n]]);break}},d=function(t,s){return new Promise(function(f,l){var d=c({action:t,payload:s});i.push(function(){var e=a(regeneratorRuntime.mark(function e(a){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.shift(),r[a.id]=d,e.prev=2,e.t0=f,e.next=6,a[t].apply(n,[].concat(o(s),[d.id]));case 6:e.t1=e.sent,(0,e.t0)(e.t1),e.next=13;break;case 10:e.prev=10,e.t2=e.catch(2),l(e.t2);case 13:return e.prev=13,delete r[a.id],p(),e.finish(13);case 17:case"end":return e.stop()}},e,null,[[2,10,13,17]])}));return function(t){return e.apply(this,arguments)}}()),u("[".concat(e,"]: Add ").concat(d.id," to JobQueue")),u("[".concat(e,"]: JobQueue length=").concat(i.length)),p()})};return{addWorker:function(r){return t[r.id]=r,u("[".concat(e,"]: Add ").concat(r.id)),u("[".concat(e,"]: Number of workers=").concat(l())),p(),r.id},addJob:function(){var t=a(regeneratorRuntime.mark(function t(r){var n,o,i,a=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==l()){t.next=2;break}throw Error("[".concat(e,"]: You need to have at least one worker before adding jobs"));case 2:for(n=a.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=a[i];return t.abrupt("return",d(r,o));case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),terminate:function(){var e=a(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:Object.keys(t).forEach(function(){var e=a(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t[r].terminate();case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),i=[];case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),getQueueLen:function(){return i.length},getNumWorkers:l}}},function(e,t,r){function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o="browser"===r(19)("type")?r(3):function(e){return e};e.exports=function(e){var t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}({},e);return["corePath","workerPath","langPath"].forEach(function(r){void 0!==e[r]&&(t[r]=o(t[r]))}),t}},function(e,t){e.exports=function(e){var t={type:"undefined"!=typeof window&&void 0!==window.document?"browser":"node"};return void 0===e?t:t[e]}},function(e,t){function r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.exports=function(e){var t=[],n=[],o=[],i=[],a=[];return e.blocks.forEach(function(c){c.paragraphs.forEach(function(t){t.lines.forEach(function(n){n.words.forEach(function(o){o.symbols.forEach(function(i){a.push(r({},i,{page:e,block:c,paragraph:t,line:n,word:o}))}),i.push(r({},o,{page:e,block:c,paragraph:t,line:n}))}),o.push(r({},n,{page:e,block:c,paragraph:t}))}),n.push(r({},t,{page:e,block:c}))}),t.push(r({},c,{page:e}))}),r({},e,{blocks:t,paragraphs:n,lines:o,words:i,symbols:a})}},function(e,t,r){var n=r(7);e.exports={defaultOEM:n.DEFAULT}},function(e,t,r){var n=r(23),o=r(26),i=r(27),a=r(28),c=r(29),u=r(30);e.exports={defaultOptions:n,spawnWorker:o,terminateWorker:i,onMessage:a,send:c,loadImage:u}},function(e,t,r){(function(t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=r(3),a=r(24),c=a.version,u=a.dependencies,s=r(25);e.exports=function(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){o(e,t,r[t])})}return e}({},s,{workerPath:void 0!==t&&"development"===t.env.TESS_ENV?i("/dist/worker.dev.js?nocache=".concat(Math.random().toString(36).slice(3))):"https://unpkg.com/tesseract.js@v".concat(c,"/dist/worker.min.js"),corePath:"https://unpkg.com/tesseract.js-core@v".concat(u["tesseract.js-core"].substring(1),"/tesseract-core.").concat("object"===("undefined"==typeof WebAssembly?"undefined":n(WebAssembly))?"wasm":"asm",".js")})}).call(this,r(8))},function(e){e.exports={name:"tesseract.js",version:"2.0.0-beta.1",description:"Pure Javascript Multilingual OCR",main:"src/index.js",types:"src/index.d.ts",unpkg:"dist/tesseract.min.js",jsdelivr:"dist/tesseract.min.js",scripts:{start:"node scripts/server.js",build:"rimraf dist && webpack --config scripts/webpack.config.prod.js",prepublishOnly:"npm run build",wait:"rimraf dist && wait-on http://localhost:3000/dist/tesseract.dev.js",test:"npm-run-all -p -r start test:all","test:all":"npm-run-all wait test:browser:* test:node:all","test:node":"nyc mocha --exit --bail --require ./scripts/test-helper.js","test:node:all":"npm run test:node:one -- ./tests/*.test.js","test:browser-tpl":"mocha-headless-chrome -a incognito -a no-sandbox -a disable-setuid-sandbox -a disable-logging -t 300000","test:browser:detect":"npm run test:browser-tpl -- -f ./tests/detect.test.html","test:browser:recognize":"npm run test:browser-tpl -- -f ./tests/recognize.test.html","test:browser:scheduler":"npm run test:browser-tpl -- -f ./tests/scheduler.test.html",lint:"eslint src",postinstall:"opencollective-postinstall || true"},browser:{"./src/worker/node/index.js":"./src/worker/browser/index.js"},author:"",contributors:["jeromewu"],license:"Apache-2.0",devDependencies:{"@babel/core":"^7.4.5","@babel/preset-env":"^7.4.5",acorn:"^6.1.1","babel-loader":"^8.0.6",cors:"^2.8.5",eslint:"^5.9.0","eslint-config-airbnb":"^17.1.0","eslint-plugin-import":"^2.14.0","eslint-plugin-jsx-a11y":"^6.1.2","eslint-plugin-react":"^7.11.1","expect.js":"^0.3.1",express:"^4.16.4",mocha:"^5.2.0","mocha-headless-chrome":"^2.0.2","npm-run-all":"^4.1.5",nyc:"^13.1.0",rimraf:"^2.6.3","wait-on":"^3.2.0",webpack:"^4.26.0","webpack-cli":"^3.1.2","webpack-dev-middleware":"^3.4.0"},dependencies:{axios:"^0.18.0","bmp-js":"^0.1.0","file-type":"^12.3.0","idb-keyval":"^3.2.0","is-url":"1.2.2","opencollective-postinstall":"^2.0.2","regenerator-runtime":"^0.13.3","resolve-url":"^0.2.1","tesseract.js-core":"^2.0.0-beta.13",zlibjs:"^0.3.1"},repository:{type:"git",url:"https://github.com/naptha/tesseract.js.git"},bugs:{url:"https://github.com/naptha/tesseract.js/issues"},homepage:"https://github.com/naptha/tesseract.js",collective:{type:"opencollective",url:"https://opencollective.com/tesseractjs"}}},function(e,t){e.exports={langPath:"https://tessdata.projectnaptha.com/4.0.0",workerBlobURL:!0,logger:function(){}}},function(e,t){e.exports=function(e){var t,r=e.workerPath,n=e.workerBlobURL;if(Blob&&URL&&n){var o=new Blob(['importScripts("'.concat(r,'");')],{type:"application/javascript"});t=new Worker(URL.createObjectURL(o))}else t=new Worker(r);return t}},function(e,t){e.exports=function(e){e.terminate()}},function(e,t){e.exports=function(e,t){e.onmessage=function(e){var r=e.data;t(r)}}},function(e,t){function r(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}e.exports=function(){var e,t=(e=regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.postMessage(r);case 1:case"end":return e.stop()}},e)}),function(){var t=this,n=arguments;return new Promise(function(o,i){var a=e.apply(t,n);function c(e){r(a,o,i,c,u,"next",e)}function u(e){r(a,o,i,c,u,"throw",e)}c(void 0)})});return function(e,r){return t.apply(this,arguments)}}()},function(e,t,r){function n(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function o(e){return function(){var t=this,r=arguments;return new Promise(function(o,i){var a=e.apply(t,r);function c(e){n(a,o,i,c,u,"next",e)}function u(e){n(a,o,i,c,u,"throw",e)}c(void 0)})}}var i=r(31),a=r(3),c=function(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(e){var t=e.target.error.code;r(Error("File could not be read! Code=".concat(t)))},n.readAsArrayBuffer(e)})},u=function(){var e=o(regeneratorRuntime.mark(function e(t){var r,n,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t,void 0!==t){e.next=3;break}return e.abrupt("return","undefined");case 3:if("string"!=typeof t){e.next=15;break}if(!/data:image\/([a-zA-Z]*);base64,([^"]*)/.test(t)){e.next=8;break}r=atob(t.split(",")[1]).split("").map(function(e){return e.charCodeAt(0)}),e.next=13;break;case 8:return e.next=10,i.get(a(t),{responseType:"arraybuffer"});case 10:n=e.sent,s=n.data,r=s;case 13:e.next=33;break;case 15:if(!(t instanceof HTMLElement)){e.next=29;break}if("IMG"!==t.tagName){e.next=20;break}return e.next=19,u(t.src);case 19:r=e.sent;case 20:if("VIDEO"!==t.tagName){e.next=24;break}return e.next=23,u(t.poster);case 23:r=e.sent;case 24:if("CANVAS"!==t.tagName){e.next=27;break}return e.next=27,new Promise(function(e){t.toBlob(function(){var t=o(regeneratorRuntime.mark(function t(n){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c(n);case 2:r=t.sent,e();case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())});case 27:e.next=33;break;case 29:if(!(t instanceof File||t instanceof Blob)){e.next=33;break}return e.next=32,c(t);case 32:r=e.sent;case 33:return e.abrupt("return",new Uint8Array(r));case 34:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}();e.exports=u},function(e,t,r){e.exports=r(32)},function(e,t,r){"use strict";var n=r(0),o=r(9),i=r(34),a=r(4);function c(e){var t=new i(e),r=o(i.prototype.request,t);return n.extend(r,i.prototype,t),n.extend(r,t),r}var u=c(a);u.Axios=i,u.create=function(e){return c(n.merge(a,e))},u.Cancel=r(13),u.CancelToken=r(48),u.isCancel=r(12),u.all=function(e){return Promise.all(e)},u.spread=r(49),e.exports=u,e.exports.default=u},function(e,t){function r(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)} | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Tesseract=t():e.Tesseract=t()}(window,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=14)}([function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=r(9),i=r(33),a=Object.prototype.toString;function c(e){return"[object Array]"===a.call(e)}function u(e){return null!==e&&"object"===n(e)}function s(e){return"[object Function]"===a.call(e)}function f(e,t){if(null!=e)if("object"!==n(e)&&(e=[e]),c(e))for(var r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:c,isArrayBuffer:function(e){return"[object ArrayBuffer]"===a.call(e)},isBuffer:i,isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:u,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===a.call(e)},isFile:function(e){return"[object File]"===a.call(e)},isBlob:function(e){return"[object Blob]"===a.call(e)},isFunction:s,isStream:function(e){return u(e)&&s(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:f,merge:function e(){var t={};function r(r,o){"object"===n(t[o])&&"object"===n(r)?t[o]=e(t[o],r):t[o]=r}for(var o=0,i=arguments.length;o<i;o++)f(arguments[o],r);return t},extend:function(e,t,r){return f(t,function(t,n){e[n]=r&&"function"==typeof t?o(t,r):t}),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(e,t){e.exports=function(e,t){return"".concat(e,"-").concat(t,"-").concat(Math.random().toString(16).slice(3,8))}},function(e,t){var r=this,n=!1;t.logging=n,t.setLogging=function(e){n=e},t.log=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return n?console.log.apply(r,t):null}},function(e,t,r){var n,o;void 0===(o="function"==typeof(n=function(){return function(){var e=arguments.length;if(0===e)throw new Error("resolveUrl requires at least one argument; got none.");var t=document.createElement("base");if(t.href=arguments[0],1===e)return t.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(t,r.firstChild);for(var n,o=document.createElement("a"),i=1;i<e;i++)o.href=arguments[i],n=o.href,t.href=n;return r.removeChild(t),n}})?n.call(t,r,t,e):n)||(e.exports=o)},function(e,t,r){"use strict";(function(t){var n=r(0),o=r(35),i={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,u={adapter:("undefined"!=typeof XMLHttpRequest?c=r(10):void 0!==t&&(c=r(10)),c),transformRequest:[function(e,t){return o(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)?(a(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],function(e){u.headers[e]={}}),n.forEach(["post","put","patch"],function(e){u.headers[e]=n.merge(i)}),e.exports=u}).call(this,r(8))},function(e,t,r){var n=r(1),o=0;e.exports=function(e){var t=e.id,r=e.action,i=e.payload,a=void 0===i?{}:i,c=t;return void 0===c&&(c=n("Job",o),o+=1),{id:c,action:r,payload:a}}},function(e,t,r){function n(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function o(e){return function(){var t=this,r=arguments;return new Promise(function(o,i){var a=e.apply(t,r);function c(e){n(a,o,i,c,u,"next",e)}function u(e){n(a,o,i,c,u,"throw",e)}c(void 0)})}}function i(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){a(e,t,r[t])})}return e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var u=r(18),s=r(20),f=r(5),l=r(2).log,p=r(1),d=r(21).defaultOEM,h=r(22),m=h.defaultOptions,y=h.spawnWorker,g=h.terminateWorker,v=h.onMessage,b=h.loadImage,w=h.send,x=0;e.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=p("Worker",x),r=u(i({},m,e)),n=r.logger,a=c(r,["logger"]),h={},j={},O=y(a);x+=1;var E=function(e,t){h[e]=t},k=function(e,t){j[e]=t},S=function(e){var r=e.id,n=e.action,o=e.payload;return new Promise(function(e,i){l("[".concat(t,"]: Start ").concat(r,", action=").concat(n)),E(n,e),k(n,i),w(O,{workerId:t,jobId:r,action:n,payload:o})})},L=function(){var e=o(regeneratorRuntime.mark(function e(t){var r,n,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:{},n=o.length>2?o[2]:void 0,e.t0=S,e.t1=f,e.t2=n,e.next=7,b(t);case 7:return e.t3=e.sent,e.t4=r,e.t5={image:e.t3,options:e.t4},e.t6={id:e.t2,action:"recognize",payload:e.t5},e.t7=(0,e.t1)(e.t6),e.abrupt("return",(0,e.t0)(e.t7));case 13:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),P=function(){var e=o(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=S,e.t1=f,e.t2=r,e.next=5,b(t);case 5:return e.t3=e.sent,e.t4={image:e.t3},e.t5={id:e.t2,action:"detect",payload:e.t4},e.t6=(0,e.t1)(e.t5),e.abrupt("return",(0,e.t0)(e.t6));case 10:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}(),R=function(){var e=o(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===O){e.next=5;break}return e.next=3,S(f({id:t,action:"terminate"}));case 3:g(O),O=null;case 5:return e.abrupt("return",Promise.resolve());case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}();return v(O,function(e){var t=e.workerId,r=e.jobId,o=e.status,a=e.action,c=e.data;if("resolve"===o){l("[".concat(t,"]: Complete ").concat(r));var u=c;"recognize"===a?u=s(c):"getPDF"===a&&(u=Array.from(i({},c,{length:Object.keys(c).length}))),h[a]({jobId:r,data:u})}else{if("reject"===o)throw j[a](c),Error(c);"progress"===o&&n(c)}}),{id:t,worker:O,setResolve:E,setReject:k,load:function(e){return S(f({id:e,action:"load",payload:{options:a}}))},loadLanguage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"eng",t=arguments.length>1?arguments[1]:void 0;return S(f({id:t,action:"loadLanguage",payload:{langs:e,options:a}}))},initialize:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"eng",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d,r=arguments.length>2?arguments[2]:void 0;return S(f({id:r,action:"initialize",payload:{langs:e,oem:t}}))},setParameters:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return S(f({id:t,action:"setParameters",payload:{params:e}}))},recognize:L,getPDF:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Tesseract OCR Result",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2?arguments[2]:void 0;return S(f({id:r,action:"getPDF",payload:{title:e,textonly:t}}))},detect:P,terminate:R}}},function(e,t){e.exports={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}},function(e,t){var r,n,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var u,s=[],f=!1,l=-1;function p(){f&&u&&(f=!1,u.length?s=u.concat(s):l=-1,s.length&&d())}function d(){if(!f){var e=c(p);f=!0;for(var t=s.length;t;){for(u=s,s=[];++l<t;)u&&u[l].run();l=-1,t=s.length}u=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];s.push(new h(e,t)),1!==s.length||f||c(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},function(e,t,r){"use strict";var n=r(0),o=r(36),i=r(38),a=r(39),c=r(40),u=r(11),s="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||r(41);e.exports=function(e){return new Promise(function(t,f){var l=e.data,p=e.headers;n.isFormData(l)&&delete p["Content-Type"];var d=new XMLHttpRequest,h="onreadystatechange",m=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in d||c(e.url)||(d=new window.XDomainRequest,h="onload",m=!0,d.onprogress=function(){},d.ontimeout=function(){}),e.auth){var y=e.auth.username||"",g=e.auth.password||"";p.Authorization="Basic "+s(y+":"+g)}if(d.open(e.method.toUpperCase(),i(e.url,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,d[h]=function(){if(d&&(4===d.readyState||m)&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in d?a(d.getAllResponseHeaders()):null,n={data:e.responseType&&"text"!==e.responseType?d.response:d.responseText,status:1223===d.status?204:d.status,statusText:1223===d.status?"No Content":d.statusText,headers:r,config:e,request:d};o(t,f,n),d=null}},d.onerror=function(){f(u("Network Error",e,null,d)),d=null},d.ontimeout=function(){f(u("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",d)),d=null},n.isStandardBrowserEnv()){var v=r(42),b=(e.withCredentials||c(e.url))&&e.xsrfCookieName?v.read(e.xsrfCookieName):void 0;b&&(p[e.xsrfHeaderName]=b)}if("setRequestHeader"in d&&n.forEach(p,function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete p[t]:d.setRequestHeader(t,e)}),e.withCredentials&&(d.withCredentials=!0),e.responseType)try{d.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){d&&(d.abort(),f(e),d=null)}),void 0===l&&(l=null),d.send(l)})}},function(e,t,r){"use strict";var n=r(37);e.exports=function(e,t,r,o,i){var a=new Error(e);return n(a,t,r,o,i)}},function(e,t,r){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,r){function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r(15);var o=r(17),i=r(6),a=r(50),c=r(7),u=r(51),s=r(2).setLogging;e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}({OEM:c,PSM:u,createScheduler:o,createWorker:i,setLogging:s},a)},function(e,t,r){(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=function(e){"use strict";var r,n=Object.prototype,o=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),a=new P(n||[]);return i._invoke=function(e,t,r){var n=l;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw i;return T()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=k(a,r);if(c){if(c===m)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=f(e,t,r);if("normal"===u.type){if(n=r.done?h:p,u.arg===m)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=h,r.method="throw",r.arg=u.arg)}}}(e,r,a),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l="suspendedStart",p="suspendedYield",d="executing",h="completed",m={};function y(){}function g(){}function v(){}var b={};b[a]=function(){return this};var w=Object.getPrototypeOf,x=w&&w(w(R([])));x&&x!==n&&o.call(x,a)&&(b=x);var j=v.prototype=y.prototype=Object.create(b);function O(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function E(e){var r;this._invoke=function(n,i){function a(){return new Promise(function(r,a){!function r(n,i,a,c){var u=f(e[n],e,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"===t(l)&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,a,c)},function(e){r("throw",e,a,c)}):Promise.resolve(l).then(function(e){s.value=e,a(s)},function(e){return r("throw",e,a,c)})}c(u.arg)}(n,i,r,a)})}return r=r?r.then(a,a):a()}}function k(e,t){var n=e.iterator[t.method];if(n===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=r,k(e,t),"throw"===t.method))return m;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=f(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,m;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,m):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function R(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=r,t.done=!0,t};return i.next=i}}return{next:T}}function T(){return{value:r,done:!0}}return g.prototype=j.constructor=v,v.constructor=g,v[u]=g.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u in e||(e[u]="GeneratorFunction")),e.prototype=Object.create(j),e},e.awrap=function(e){return{__await:e}},O(E.prototype),E.prototype[c]=function(){return this},e.AsyncIterator=E,e.async=function(t,r,n,o){var i=new E(s(t,r,n,o));return e.isGeneratorFunction(r)?i:i.next().then(function(e){return e.done?e.value:i.next()})},O(j),j[u]="Generator",j[a]=function(){return this},j.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=R,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(L),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,o){return c.type="throw",c.arg=e,t.next=n,o&&(t.method="next",t.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:R(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),m}},e}("object"===t(e)?e.exports:{});try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}}).call(this,r(16)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){var n=this;function o(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function i(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function c(e){i(a,n,o,c,u,"next",e)}function u(e){i(a,n,o,c,u,"throw",e)}c(void 0)})}}var c=r(5),u=r(2).log,s=r(1),f=0;e.exports=function(){var e=s("Scheduler",f),t={},r={},i=[];f+=1;var l=function(){return Object.keys(t).length},p=function(){if(0!==i.length)for(var e=Object.keys(t),n=0;n<e.length;n+=1)if(void 0===r[e[n]]){i[0](t[e[n]]);break}},d=function(t,s){return new Promise(function(f,l){var d=c({action:t,payload:s});i.push(function(){var e=a(regeneratorRuntime.mark(function e(a){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.shift(),r[a.id]=d,e.prev=2,e.t0=f,e.next=6,a[t].apply(n,[].concat(o(s),[d.id]));case 6:e.t1=e.sent,(0,e.t0)(e.t1),e.next=13;break;case 10:e.prev=10,e.t2=e.catch(2),l(e.t2);case 13:return e.prev=13,delete r[a.id],p(),e.finish(13);case 17:case"end":return e.stop()}},e,null,[[2,10,13,17]])}));return function(t){return e.apply(this,arguments)}}()),u("[".concat(e,"]: Add ").concat(d.id," to JobQueue")),u("[".concat(e,"]: JobQueue length=").concat(i.length)),p()})};return{addWorker:function(r){return t[r.id]=r,u("[".concat(e,"]: Add ").concat(r.id)),u("[".concat(e,"]: Number of workers=").concat(l())),p(),r.id},addJob:function(){var t=a(regeneratorRuntime.mark(function t(r){var n,o,i,a=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==l()){t.next=2;break}throw Error("[".concat(e,"]: You need to have at least one worker before adding jobs"));case 2:for(n=a.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=a[i];return t.abrupt("return",d(r,o));case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),terminate:function(){var e=a(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:Object.keys(t).forEach(function(){var e=a(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t[r].terminate();case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),i=[];case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),getQueueLen:function(){return i.length},getNumWorkers:l}}},function(e,t,r){function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o="browser"===r(19)("type")?r(3):function(e){return e};e.exports=function(e){var t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}({},e);return["corePath","workerPath","langPath"].forEach(function(r){void 0!==e[r]&&(t[r]=o(t[r]))}),t}},function(e,t){e.exports=function(e){var t={type:"undefined"!=typeof window&&void 0!==window.document?"browser":"node"};return void 0===e?t:t[e]}},function(e,t){function r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.exports=function(e){var t=[],n=[],o=[],i=[],a=[];return e.blocks.forEach(function(c){c.paragraphs.forEach(function(t){t.lines.forEach(function(n){n.words.forEach(function(o){o.symbols.forEach(function(i){a.push(r({},i,{page:e,block:c,paragraph:t,line:n,word:o}))}),i.push(r({},o,{page:e,block:c,paragraph:t,line:n}))}),o.push(r({},n,{page:e,block:c,paragraph:t}))}),n.push(r({},t,{page:e,block:c}))}),t.push(r({},c,{page:e}))}),r({},e,{blocks:t,paragraphs:n,lines:o,words:i,symbols:a})}},function(e,t,r){var n=r(7);e.exports={defaultOEM:n.DEFAULT}},function(e,t,r){var n=r(23),o=r(26),i=r(27),a=r(28),c=r(29),u=r(30);e.exports={defaultOptions:n,spawnWorker:o,terminateWorker:i,onMessage:a,send:c,loadImage:u}},function(e,t,r){(function(t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=r(3),a=r(24),c=a.version,u=a.dependencies,s=r(25);e.exports=function(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){o(e,t,r[t])})}return e}({},s,{workerPath:void 0!==t&&"development"===t.env.TESS_ENV?i("/dist/worker.dev.js?nocache=".concat(Math.random().toString(36).slice(3))):"https://unpkg.com/tesseract.js@v".concat(c,"/dist/worker.min.js"),corePath:"https://unpkg.com/tesseract.js-core@v".concat(u["tesseract.js-core"].substring(1),"/tesseract-core.").concat("object"===("undefined"==typeof WebAssembly?"undefined":n(WebAssembly))?"wasm":"asm",".js")})}).call(this,r(8))},function(e){e.exports={name:"tesseract.js",version:"2.0.0-beta.2",description:"Pure Javascript Multilingual OCR",main:"src/index.js",types:"src/index.d.ts",unpkg:"dist/tesseract.min.js",jsdelivr:"dist/tesseract.min.js",scripts:{start:"node scripts/server.js",build:"rimraf dist && webpack --config scripts/webpack.config.prod.js",prepublishOnly:"npm run build",wait:"rimraf dist && wait-on http://localhost:3000/dist/tesseract.dev.js",test:"npm-run-all -p -r start test:all","test:all":"npm-run-all wait test:browser:* test:node:all","test:node":"nyc mocha --exit --bail --require ./scripts/test-helper.js","test:node:all":"npm run test:node -- ./tests/*.test.js","test:browser-tpl":"mocha-headless-chrome -a incognito -a no-sandbox -a disable-setuid-sandbox -a disable-logging -t 300000","test:browser:detect":"npm run test:browser-tpl -- -f ./tests/detect.test.html","test:browser:recognize":"npm run test:browser-tpl -- -f ./tests/recognize.test.html","test:browser:scheduler":"npm run test:browser-tpl -- -f ./tests/scheduler.test.html",lint:"eslint src",postinstall:"opencollective-postinstall || true"},browser:{"./src/worker/node/index.js":"./src/worker/browser/index.js"},author:"",contributors:["jeromewu"],license:"Apache-2.0",devDependencies:{"@babel/core":"^7.4.5","@babel/preset-env":"^7.4.5",acorn:"^6.1.1","babel-loader":"^8.0.6",cors:"^2.8.5",eslint:"^5.9.0","eslint-config-airbnb":"^17.1.0","eslint-plugin-import":"^2.14.0","eslint-plugin-jsx-a11y":"^6.1.2","eslint-plugin-react":"^7.11.1","expect.js":"^0.3.1",express:"^4.16.4",mocha:"^5.2.0","mocha-headless-chrome":"^2.0.2","npm-run-all":"^4.1.5",nyc:"^13.1.0",rimraf:"^2.6.3","wait-on":"^3.2.0",webpack:"^4.26.0","webpack-cli":"^3.1.2","webpack-dev-middleware":"^3.4.0"},dependencies:{axios:"^0.18.0","bmp-js":"^0.1.0","file-type":"^12.3.0","idb-keyval":"^3.2.0","is-url":"1.2.2","opencollective-postinstall":"^2.0.2","regenerator-runtime":"^0.13.3","resolve-url":"^0.2.1","tesseract.js-core":"^2.0.0-beta.13",zlibjs:"^0.3.1"},repository:{type:"git",url:"https://github.com/naptha/tesseract.js.git"},bugs:{url:"https://github.com/naptha/tesseract.js/issues"},homepage:"https://github.com/naptha/tesseract.js",collective:{type:"opencollective",url:"https://opencollective.com/tesseractjs"}}},function(e,t){e.exports={langPath:"https://tessdata.projectnaptha.com/4.0.0",workerBlobURL:!0,logger:function(){}}},function(e,t){e.exports=function(e){var t,r=e.workerPath,n=e.workerBlobURL;if(Blob&&URL&&n){var o=new Blob(['importScripts("'.concat(r,'");')],{type:"application/javascript"});t=new Worker(URL.createObjectURL(o))}else t=new Worker(r);return t}},function(e,t){e.exports=function(e){e.terminate()}},function(e,t){e.exports=function(e,t){e.onmessage=function(e){var r=e.data;t(r)}}},function(e,t){function r(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}e.exports=function(){var e,t=(e=regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.postMessage(r);case 1:case"end":return e.stop()}},e)}),function(){var t=this,n=arguments;return new Promise(function(o,i){var a=e.apply(t,n);function c(e){r(a,o,i,c,u,"next",e)}function u(e){r(a,o,i,c,u,"throw",e)}c(void 0)})});return function(e,r){return t.apply(this,arguments)}}()},function(e,t,r){function n(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function o(e){return function(){var t=this,r=arguments;return new Promise(function(o,i){var a=e.apply(t,r);function c(e){n(a,o,i,c,u,"next",e)}function u(e){n(a,o,i,c,u,"throw",e)}c(void 0)})}}var i=r(31),a=r(3),c=function(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(e){var t=e.target.error.code;r(Error("File could not be read! Code=".concat(t)))},n.readAsArrayBuffer(e)})},u=function(){var e=o(regeneratorRuntime.mark(function e(t){var r,n,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t,void 0!==t){e.next=3;break}return e.abrupt("return","undefined");case 3:if("string"!=typeof t){e.next=15;break}if(!/data:image\/([a-zA-Z]*);base64,([^"]*)/.test(t)){e.next=8;break}r=atob(t.split(",")[1]).split("").map(function(e){return e.charCodeAt(0)}),e.next=13;break;case 8:return e.next=10,i.get(a(t),{responseType:"arraybuffer"});case 10:n=e.sent,s=n.data,r=s;case 13:e.next=33;break;case 15:if(!(t instanceof HTMLElement)){e.next=29;break}if("IMG"!==t.tagName){e.next=20;break}return e.next=19,u(t.src);case 19:r=e.sent;case 20:if("VIDEO"!==t.tagName){e.next=24;break}return e.next=23,u(t.poster);case 23:r=e.sent;case 24:if("CANVAS"!==t.tagName){e.next=27;break}return e.next=27,new Promise(function(e){t.toBlob(function(){var t=o(regeneratorRuntime.mark(function t(n){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c(n);case 2:r=t.sent,e();case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())});case 27:e.next=33;break;case 29:if(!(t instanceof File||t instanceof Blob)){e.next=33;break}return e.next=32,c(t);case 32:r=e.sent;case 33:return e.abrupt("return",new Uint8Array(r));case 34:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}();e.exports=u},function(e,t,r){e.exports=r(32)},function(e,t,r){"use strict";var n=r(0),o=r(9),i=r(34),a=r(4);function c(e){var t=new i(e),r=o(i.prototype.request,t);return n.extend(r,i.prototype,t),n.extend(r,t),r}var u=c(a);u.Axios=i,u.create=function(e){return c(n.merge(a,e))},u.Cancel=r(13),u.CancelToken=r(48),u.isCancel=r(12),u.all=function(e){return Promise.all(e)},u.spread=r(49),e.exports=u,e.exports.default=u},function(e,t){function r(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)} | ||
/*! | ||
@@ -3,0 +3,0 @@ * Determine if an object is a Buffer |
@@ -148,3 +148,3 @@ # API | ||
| ---- | ---- | ------------- | ----------- | | ||
| tessedit\_ocr\_engine\_mode | enum | OEM.LSTM\_ONLY | Check [HERE](https://github.com/tesseract-ocr/tesseract/blob/4.0.0/src/ccstruct/publictypes.h#L268) for definition of each mode | | ||
| tessedit\_ocr\_engine\_mode | enum | OEM.DEFAULT | Check [HERE](https://github.com/tesseract-ocr/tesseract/blob/4.0.0/src/ccstruct/publictypes.h#L268) for definition of each mode | | ||
| tessedit\_pageseg\_mode | enum | PSM.SINGLE\_BLOCK | Check [HERE](https://github.com/tesseract-ocr/tesseract/blob/4.0.0/src/ccstruct/publictypes.h#L163) for definition of each mode | | ||
@@ -151,0 +151,0 @@ | tessedit\_char\_whitelist | string | '' | setting white list characters makes the result only contains these characters, useful the content in image is limited | |
@@ -5,9 +5,2 @@ # Tesseract.js Examples | ||
Example repositories: | ||
- Offline version: https://github.com/jeromewu/tesseract.js-offline | ||
- With Vue: https://github.com/jeromewu/tesseract.js-vue-app | ||
- With Angular: https://github.com/jeromewu/tesseract.js-angular-app | ||
- Chrome Extension: https://github.com/jeromewu/tesseract.js-chrome-extension | ||
### basic | ||
@@ -14,0 +7,0 @@ |
{ | ||
"name": "tesseract.js", | ||
"version": "2.0.0-beta.1", | ||
"version": "2.0.0-beta.2", | ||
"description": "Pure Javascript Multilingual OCR", | ||
@@ -17,3 +17,3 @@ "main": "src/index.js", | ||
"test:node": "nyc mocha --exit --bail --require ./scripts/test-helper.js", | ||
"test:node:all": "npm run test:node:one -- ./tests/*.test.js", | ||
"test:node:all": "npm run test:node -- ./tests/*.test.js", | ||
"test:browser-tpl": "mocha-headless-chrome -a incognito -a no-sandbox -a disable-setuid-sandbox -a disable-logging -t 300000", | ||
@@ -20,0 +20,0 @@ "test:browser:detect": "npm run test:browser-tpl -- -f ./tests/detect.test.html", |
@@ -14,3 +14,3 @@ <p align="center"> | ||
<h3 align="center"> | ||
Version 2 beta is now available and under development in the master branch<br> | ||
Version 2 beta is now available and under development in the master branch, read a story about v2 beta: <a href="https://medium.com/@jeromewus/why-i-refactor-tesseract-js-v2-50f750a9cfe2">Why I refactor tesseract.js v2?</a><br> | ||
Check the <a href="https://github.com/naptha/tesseract.js/tree/support/1.x">support/1.x</a> branch for version 1 | ||
@@ -23,4 +23,13 @@ </h3> | ||
Image Recognition | ||
[![fancy demo gif](./docs/images/demo.gif)](http://tesseract.projectnaptha.com) | ||
Video Real-time Recognition | ||
<p align="center"> | ||
<a href="https://github.com/jeromewu/tesseract.js-video"><img alt="Tesseract.js Video" src="./docs/images/video-demo.gif"></a> | ||
</p> | ||
Tesseract.js wraps an [emscripten](https://github.com/kripken/emscripten) [port](https://github.com/naptha/tesseract.js-core) of the [Tesseract](https://github.com/tesseract-ocr/tesseract) [OCR](https://en.wikipedia.org/wiki/Optical_character_recognition) Engine. | ||
@@ -57,3 +66,3 @@ It works in the browser using [webpack](https://webpack.js.org/) or plain script tags with a [CDN](#CDN) and on the server with [Node.js](https://nodejs.org/en/). | ||
console.log(text); | ||
await woker.terminate(); | ||
await worker.terminate(); | ||
})(); | ||
@@ -67,3 +76,3 @@ ``` | ||
- Upgrade to tesseract v4.1 (using emscripten 1.38.45) | ||
- Support multiple languages at the same time, eg: eng+chi_tra for English and Traditional Chinese | ||
- Support multiple languages at the same time, eg: eng+chi\_tra for English and Traditional Chinese | ||
- Supported image formats: png, jpg, bmp, pbm | ||
@@ -112,3 +121,13 @@ - Support WebAssembly (fallback to ASM.js when browser doesn't support) | ||
## Use tesseract.js the way you like! | ||
- Offline Version: https://github.com/jeromewu/tesseract.js-offline | ||
- Custom Traineddata: https://github.com/jeromewu/tesseract.js-custom-traineddata | ||
- Chrome Extension: https://github.com/jeromewu/tesseract.js-chrome-extension | ||
- With Vue: https://github.com/jeromewu/tesseract.js-vue-app | ||
- With Angular: https://github.com/jeromewu/tesseract.js-angular-app | ||
- With React: https://github.com/jeromewu/tesseract.js-react-app | ||
- Typescript: https://github.com/jeromewu/tesseract.js-typescript | ||
- Video Real-time Recognition: https://github.com/jeromewu/tesseract.js-video | ||
## Contributing | ||
@@ -115,0 +134,0 @@ |
@@ -14,3 +14,2 @@ /** | ||
const gunzip = require('./gunzip'); | ||
const resolveURL = require('./resolveURL'); | ||
const cache = require('./cache'); | ||
@@ -32,4 +31,3 @@ | ||
gunzip, | ||
resolveURL, | ||
...cache, | ||
}); |
@@ -94,4 +94,2 @@ /** | ||
path = langPath; | ||
} else if (process.browser) { /** When langPath is not an URL in browser */ | ||
path = adapter.resolveURL(langPath); | ||
} | ||
@@ -98,0 +96,0 @@ |
@@ -13,3 +13,2 @@ /** | ||
const getCore = require('./getCore'); | ||
const resolveURL = require('./resolveURL'); | ||
const gunzip = require('./gunzip'); | ||
@@ -28,4 +27,3 @@ const cache = require('./cache'); | ||
gunzip, | ||
resolveURL, | ||
...cache, | ||
}); |
const { fork } = require('child_process'); | ||
let debugPort = 9229; | ||
/** | ||
@@ -10,4 +12,5 @@ * spawnWorker | ||
*/ | ||
module.exports = ({ workerPath }) => ( | ||
fork(workerPath) | ||
); | ||
module.exports = ({ workerPath }) => { | ||
debugPort += 1; | ||
return fork(workerPath, { execArgv: [`--debug-port=${debugPort}`] }); | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1111784
187
1
71
2260