!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 n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){const r=n(3),o={corePath:`https://cdn.jsdelivr.net/gh/naptha/tesseract.js-core@2.0.0-beta.4/tesseract${"object"==typeof WebAssembly?"":"asm"}.js`,langPath:"https://cdn.jsdelivr.net/gh/naptha/tessdata@gh-pages/3.02/"};{const{version:e}=n(4);o.workerPath=`https://cdn.jsdelivr.net/gh/naptha/tesseract.js@${e}/dist/worker.js`}t.defaultOptions=o,t.spawnWorker=((e,t)=>{let n;if(window.Blob&&window.URL){const e=new Blob([`importScripts("${t.workerPath}");`]);n=new Worker(window.URL.createObjectURL(e))}else n=new Worker(t.workerPath);return n.onmessage=(({data:t})=>{e._recv(t)}),n}),t.terminateWorker=(e=>{e.worker.terminate()}),t.sendPacket=((e,t)=>{(e=>r(e)?fetch(e).then(e=>e.buffer()):new Promise)(t.payload.image).then(e=>new Uint8Array(e)).then(n=>{e.worker.postMessage({...t,payload:{...t.payload,image:Array.from(n)}})})})},function(e,t,n){const r=n(2),o=n(0),s=n(5),i=n(6);e.exports={TesseractWorker:class{constructor(e={}){this.worker=null,this.workerOptions=Object.assign({},o.defaultOptions,e),this._currentJob=null,this._queue=[]}recognize(e,t={lang:"eng"}){return this._delay(n=>{n._send("recognize",{image:e,options:r.string(t)?{lang:t||"eng"}:t,workerOptions:this.workerOptions})})}detect(e,t={}){return this._delay(n=>{n._send("detect",{image:e,options:t,workerOptions:this.workerOptions})})}terminate(){this.worker&&o.terminateWorker(this),this.worker=null,this._currentJob=null,this._queue=[]}_delay(e){r.null(this.worker)&&(this.worker=o.spawnWorker(this,this.workerOptions));const t=new i(this);return this._queue.push(()=>{this._queue.shift(),this._currentJob=t,e(t)}),r.null(this._currentJob)&&this._dequeue(),t}_dequeue(){this._currentJob=null,this._queue.length&&this._queue[0]()}_recv(e){this._currentJob.id===e.jobId?this._currentJob._handle({...e,data:"resolve"===e.status&&"recognize"===e.action?s(e.data):e.data}):console.warn(`Job ID ${e.jobId} not known.`)}}}},function(e,t,n){var r;!function(o){"use strict";var s,i,u,a,c,f,l,p,h,b,d,y,g;function m(e){return null!=e}function v(e){return"number"==typeof e&&e>b&&et}function _(e,t){return v(e)&&e=t}function O(e,t){return v(e)&&e<=t}function E(e){return"string"==typeof e}function x(e){return E(e)&&""!==e}function P(e){return"[object Object]"===Object.prototype.toString.call(e)}function S(e,t){try{return e instanceof t}catch(e){return!1}}function I(e,t){var n;for(n in t)if(t.hasOwnProperty(n)){if(!1===e.hasOwnProperty(n)||typeof e[n]!=typeof t[n])return!1;if(P(e[n])&&!1===I(e[n],t[n]))return!1}return!0}function T(e){return y(e)}function q(e){return m(e)&&k(e.length,0)}function A(e){return"function"==typeof e}function J(e,t){var n;for(n=0;nn}},{n:"greaterOrEqual",f:k},{n:"lessOrEqual",f:O},{n:"inRange",f:function(e,t,n){if(t=n}},{n:"positive",f:function(e){return j(e,0)}},{n:"negative",f:function(e){return _(e,0)}},{n:"string",f:E,s:"s"},{n:"emptyString",f:function(e){return""===e},s:"s"},{n:"nonEmptyString",f:x,s:"s"},{n:"contains",f:function(e,t){return E(e)&&-1!==e.indexOf(t)},s:"s"},{n:"match",f:function(e,t){return E(e)&&!!e.match(t)},s:"s"},{n:"boolean",f:function(e){return!1===e||!0===e},s:"b"},{n:"object",f:P,s:"o"},{n:"emptyObject",f:function(e){return P(e)&&0===Object.keys(e).length},s:"o"},{n:"nonEmptyObject",f:function(e){return P(e)&&Object.keys(e).length>0},s:"o"},{n:"instanceStrict",f:S,s:"t"},{n:"instance",f:function(e,t){try{return S(e,t)||e.constructor.name===t.name||Object.prototype.toString.call(e)==="[object "+t.name+"]"}catch(e){return!1}},s:"t"},{n:"like",f:I,s:"t"},{n:"array",f:T,s:"a"},{n:"emptyArray",f:function(e){return T(e)&&0===e.length},s:"a"},{n:"nonEmptyArray",f:function(e){return T(e)&&j(e.length,0)},s:"a"},{n:"arrayLike",f:q,s:"al"},{n:"iterable",f:function(e){if(!g)return q(e);return m(e)&&A(e[Symbol.iterator])},s:"i"},{n:"date",f:function(e){return S(e,Date)&&w(e.getTime())},s:"d"},{n:"function",f:A,s:"f"},{n:"hasLength",f:function(e,t){return m(e)&&e.length===t},s:"l"}].map(function(e){var t=e.n;i[t]="Invalid "+s[e.s||"n"],u[t]=e.f}),a={apply:function(e,t){if(c.array(e),A(t))return e.map(function(e){return t(e)});return c.array(t),c.hasLength(e,t.length),e.map(function(e,n){return t[n](e)})},map:function(e,t){if(c.object(e),A(t))return function(e,t){var n={};return Object.keys(e).forEach(function(r){n[r]=t(e[r])}),n}(e,t);return c.object(t),function e(t,n){var r={};return Object.keys(n).forEach(function(o){var s=n[o];A(s)?f.assigned(t)?r[o]=!!s.m:r[o]=s(t[o]):P(s)&&(r[o]=e(t[o],s))}),r}(e,t)},all:function(e){if(T(e))return J(e,!1);return c.object(e),N(e,!1)},any:function(e){if(T(e))return J(e,!0);return c.object(e),N(e,!0)}},p=["array","arrayLike","iterable","object"],h=Array.prototype.slice,b=Number.NEGATIVE_INFINITY,d=Number.POSITIVE_INFINITY,y=Array.isArray,g="function"==typeof Symbol,a=M(a,u),c=z(W,L),f=z($,D),l=z(function(e){var t=function(){return!!f.assigned(arguments[0])||e.apply(null,arguments)};return t.l=e.length,t.m=!0,t},function(e){if(!1===m(e))return!0;return e}),c.not=V(W,f),c.maybe=V(W,l),p.forEach(function(e){u[e].of=U([R.bind(null,null),u[e],u,null])}),B(c,W),B(f,$),p.forEach(function(e){l[e].of=U([R.bind(null,"maybe"),u[e],u,null]),c.maybe[e].of=V(W,l[e].of),c.not[e].of=V(W,f[e].of)}),function(o){void 0===(r=function(){return o}.call(t,n,t,e))||(e.exports=r)}(M(a,{assert:c,not:f,maybe:l}))}()},function(e,t){e.exports=function(e){return n.test(e)};var n=/^(?:\w+:)?\/\/([^\s\.]+\.\S{2}|localhost[\:?\d]*)\S*$/},function(e){e.exports={name:"tesseract.js",version:"1.0.13",description:"Pure Javascript Multilingual OCR",main:"src/index.js",scripts:{start:'concurrently --kill-others "watchify src/index.js -t [ envify --NODE_ENV development ] -t [ babelify --presets [ es2015 ] ] -o dist/tesseract.dev.js --standalone Tesseract" "watchify src/browser/worker.js -t [ envify --NODE_ENV development ] -t [ babelify --presets [ es2015 ] ] -o dist/worker.dev.js" "http-server -p 7355"',build:"webpack --config webpack.config.js",prepublishOnly:"npm run build",lint:"eslint src"},browser:{"./src/node/index.js":"./src/browser/index.js"},author:"",contributors:["jeromewu"],license:"Apache-2.0",devDependencies:{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",webpack:"^4.26.0","webpack-cli":"^3.1.2"},dependencies:{"check-types":"^7.4.0","is-url":"1.2.2","node-fetch":"^1.7.3","tesseract.js-core":"^2.0.0-beta.4","tesseract.js-utils":"^1.0.0-beta.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"}},function(e,t){e.exports=(e=>{const t={...e,paragraphs:[],lines:[],words:[],symbols:[]};return t.blocks.forEach(e=>{const n={...e,page:t,lines:[],words:[],symbols:[]};n.paragraphs.forEach(e=>{const r={...e,block:n,page:t,words:[],symbols:[]};r.lines.forEach(e=>{const o={...e,paragraph:r,block:n,page:t,symbols:[]};o.words.forEach(e=>{const s={...e,line:o,paragraph:r,block:n,page:t};s.symbols.forEach(e=>{const i={...e,word:s,line:o,paragraph:r,block:n,page:t};i.line.symbols.push(i),i.paragraph.symbols.push(i),i.block.symbols.push(i),i.page.symbols.push(i)}),s.paragraph.words.push(s),s.block.words.push(s),s.page.words.push(s)}),o.block.lines.push(o),o.page.lines.push(o)}),r.page.paragraphs.push(r)})}),t})},function(e,t,n){const r=n(0);let o=0;e.exports=class{constructor(e){o+=1,this.id=`Job-${o}-${Math.random().toString(16).slice(3,8)}`,this._instance=e,this._resolve=[],this._reject=[],this._progress=[],this._finally=[]}then(e,t){return this._resolve.push?this._resolve.push(e):e(this._resolve),t&&this.catch(t),this}catch(e){return this._reject.push?this._reject.push(e):e(this._reject),this}progress(e){return this._progress.push(e),this}finally(e){return this._finally.push(e),this}_send(e,t){r.sendPacket(this._instance,{jobId:this.id,action:e,payload:t})}_handle(e){const{data:t}=e;let n=!1;"resolve"===e.status?(0===this._resolve.length&&console.log(t),this._resolve.forEach(e=>{const n=e(t);n&&"function"==typeof n.then&&console.warn("TesseractJob instances do not chain like ES6 Promises. To convert it into a real promise, use Promise.resolve.")}),this._resolve=t,this._instance._dequeue(),n=!0):"reject"===e.status?(0===this._reject.length&&console.error(t),this._reject.forEach(e=>e(t)),this._reject=t,this._instance._dequeue(),n=!0):"progress"===e.status?this._progress.forEach(e=>e(t)):console.warn("Message type unknown",e.status),n&&this._finally.forEach(e=>e(t))}}}])}); //# sourceMappingURL=tesseract.min.js.map