(function(a){a.getWasmVersion=function(){return 23}})("undefined"===typeof window?this:window);(function(a){ArrayBuffer.prototype.slice||(ArrayBuffer.prototype.slice=function(a,l){void 0===a&&(a=0);void 0===l&&(l=this.byteLength);a=Math.floor(a);l=Math.floor(l);0>a&&(a+=this.byteLength);0>l&&(l+=this.byteLength);a=Math.min(Math.max(0,a),this.byteLength);l=Math.min(Math.max(0,l),this.byteLength);if(0>=l-a)return new ArrayBuffer(0);var c=new ArrayBuffer(l-a),d=new Uint8Array(c),e=new Uint8Array(this,a,l-a);d.set(e);return c})})(this);(function(a){function g(){for(var b=0;b<y.length;b++)y[b][0](y[b][1]);y=[];z=!1}function l(b,f){y.push([b,f]);z||(z=!0,A(g,0))}function c(b,f){function k(b){h(f,b)}function r(b){m(f,b)}try{b(k,r)}catch(a){r(a)}}function d(b){var f=b.owner,r=f.state_,f=f.data_,a=b[r];b=b.then;if("function"===typeof a){r=k;try{f=a(f)}catch(c){m(b,c)}}e(b,f)||(r===k&&h(b,f),r===x&&m(b,f))}function e(b,f){var k;try{if(b===f)throw new TypeError("A promises callback cannot return that same promise.");if(f&&("function"===
typeof f||"object"===typeof f)){var r=f.then;if("function"===typeof r)return r.call(f,function(r){k||(k=!0,f!==r?h(b,r):u(b,r))},function(f){k||(k=!0,m(b,f))}),!0}}catch(a){return k||m(b,a),!0}return!1}function h(b,f){b!==f&&e(b,f)||u(b,f)}function u(f,k){f.state_===b&&(f.state_=r,f.data_=k,l(q,f))}function m(f,k){f.state_===b&&(f.state_=r,f.data_=k,l(v,f))}function t(b){var f=b.then_;b.then_=void 0;for(b=0;b<f.length;b++)d(f[b])}function q(b){b.state_=k;t(b)}function v(b){b.state_=x;t(b)}function n(b){if("function"!==
typeof b)throw new TypeError("Promise constructor takes a function argument");if(!1===this instanceof n)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this.then_=[];c(b,this)}a.createPromiseCapability=function(){var b={},f=new n(function(f,k){b.resolve=f;b.reject=k});b.promise=f;return b};var p=a.Promise,f=p&&"resolve"in p&&"reject"in p&&"all"in p&&"race"in p&&function(){var b;new p(function(f){b=f});return"function"===
typeof b}();"undefined"!==typeof exports&&exports?(exports.Promise=f?p:n,exports.Polyfill=n):"function"==typeof define&&define.amd?define(function(){return f?p:n}):f||(a.Promise=n);var b="pending",r="sealed",k="fulfilled",x="rejected",w=function(){},A="undefined"!==typeof setImmediate?setImmediate:setTimeout,y=[],z;n.prototype={constructor:n,state_:b,then_:null,data_:void 0,then:function(b,f){var r={owner:this,then:new this.constructor(w),fulfilled:b,rejected:f};this.state_===k||this.state_===x?l(d,
r):this.then_.push(r);return r.then},"catch":function(b){return this.then(null,b)}};n.all=function(b){if("[object Array]"!==Object.prototype.toString.call(b))throw new TypeError("You must pass an array to Promise.all().");return new this(function(f,k){function r(b){c++;return function(k){a[b]=k;--c||f(a)}}for(var a=[],c=0,x=0,l;x<b.length;x++)(l=b[x])&&"function"===typeof l.then?l.then(r(x),k):a[x]=l;c||f(a)})};n.race=function(b){if("[object Array]"!==Object.prototype.toString.call(b))throw new TypeError("You must pass an array to Promise.race().");
return new this(function(f,k){for(var r=0,a;r<b.length;r++)(a=b[r])&&"function"===typeof a.then?a.then(f,k):f(a)})};n.resolve=function(b){return b&&"object"===typeof b&&b.constructor===this?b:new this(function(f){f(b)})};n.reject=function(b){return new this(function(f,k){k(b)})}})("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this);(function(a,g){function l(b){"function"!==typeof b&&(b=new Function(""+b));for(var k=Array(arguments.length-1),a=0;a<k.length;a++)k[a]=arguments[a+1];v[q]={callback:b,args:k};f(q);return q++}function c(b){delete v[b]}function d(b){if(n)setTimeout(d,0,b);else{var f=v[b];if(f){n=!0;try{var a=f.callback,l=f.args;switch(l.length){case 0:a();break;case 1:a(l[0]);break;case 2:a(l[0],l[1]);break;case 3:a(l[0],l[1],l[2]);break;default:a.apply(g,l)}}finally{c(b),n=!1}}}}function e(){f=function(b){process.nextTick(function(){d(b)})}}
function h(){if(a.postMessage&&!a.importScripts){var b=!0,f=a.onmessage;a.onmessage=function(){b=!1};a.postMessage("","*");a.onmessage=f;return b}}function u(){var b="setImmediate$"+Math.random()+"$",k=function(f){f.source===a&&"string"===typeof f.data&&0===f.data.indexOf(b)&&d(+f.data.slice(b.length))};a.addEventListener?a.addEventListener("message",k,!1):a.attachEvent("onmessage",k);f=function(f){a.postMessage(b+f,"*")}}function m(){var b=p.documentElement;f=function(f){var a=p.createElement("script");
a.onreadystatechange=function(){d(f);a.onreadystatechange=null;b.removeChild(a);a=null};b.appendChild(a)}}function t(){f=function(b){setTimeout(d,0,b)}}if(!a.setImmediate){var q=1,v={},n=!1,p=a.document,f,b=Object.getPrototypeOf&&Object.getPrototypeOf(a),b=b&&b.setTimeout?b:a;"[object process]"==={}.toString.call(a.process)?e():h()?u():p&&"onreadystatechange"in p.createElement("script")?m():t();b.setImmediate=l;b.clearImmediate=c}})("undefined"===typeof self?"undefined"===typeof global?this:global:
self);(function(a){var g=function(a,c){var d=function(a){a=this["catch"](a);return{cancel:c,promise:a,then:e.bind(a),"catch":d.bind(a)}},e=function(a,l){var g=this.then(a,l);return{cancel:c,promise:g,then:e.bind(g),"catch":d.bind(g)}};return{cancel:c,promise:a,then:e.bind(a),"catch":d.bind(a)}};a.CancellablePromise=function(a,c){var d=!1,e,h=new Promise(function(h,g){e=function(){d||(c(),g("cancelled"))};(new Promise(a)).then(function(a){d=!0;h(a)},function(a){d=!0;g(a)})});return g(h,e)};a.CancellablePromise.all=
function(a){var c=Promise.all(a);return g(c,function(){a.forEach(function(a,c){a.cancel&&a.cancel()})})}})("undefined"===typeof self?this:self);(function(a){a.MessageHandler=function(g,l){this.name=g;this.comObj=l;this.callbackIndex=1;this.postMessageTransfers=!0;this.callbacksCapabilities={};var c=this.actionHandler={};this.actionHandlerAsync={};this.nextAsync=null;c.console_log=[function(a){}];c.console_error=[function(c){a.utils.error(c)}];c.workerLoaded=[function(a){}];l.addEventListener("message",this.handleMessage.bind(this))};a.MessageHandler.prototype={on:function(g,l,c){var d=this.actionHandler;d[g]&&a.utils.error('There is already an actionName called "'+
g+'"');d[g]=[l,c]},replace:function(a,l,c){this.actionHandler[a]=[l,c]},onAsync:function(g,l,c){var d=this.actionHandlerAsync;d[g]&&a.utils.error('There is already an actionName called "'+g+'"');d[g]=[l,c]},replaceAsync:function(a,l,c){var d=this.actionHandlerAsync,e=this.actionHandler;e[a]&&delete e[a];d[a]=[l,c]},onNextAsync:function(a){this.nextAsync=a},send:function(a,l){this.postMessage({action:a,data:l})},getNextId:function(){return this.callbackIndex++},sendWithPromise:function(a,l,c){var d=
this.getNextId();a={action:a,data:l,callbackId:d,priority:c};l=createPromiseCapability();this.callbacksCapabilities[d]=l;try{this.postMessage(a)}catch(e){l.reject(e)}return l.promise},sendWithPromiseReturnId:function(a,l,c){var d=this.getNextId();a={action:a,data:l,callbackId:d,priority:c};l=createPromiseCapability();this.callbacksCapabilities[d]=l;try{this.postMessage(a)}catch(e){l.reject(e)}return{promise:l.promise,callbackId:d}},sendWithPromiseWithId:function(g,l,c,d){l>this.callbackIndex&&a.utils.error("Can't reuse callbackId "+
l+" lesser than callbackIndex "+this.callbackIndex);l in this.callbacksCapabilities&&a.utils.error("Can't reuse callbackId "+l+". There is a capability waiting to be resolved. ");g={action:g,data:c,callbackId:l};c=createPromiseCapability();this.callbacksCapabilities[l]=c;try{this.postMessage(g)}catch(e){c.reject(e)}return c.promise},sendError:function(a,l){if(a.message||a.errorData){a.message&&a.message.message&&(a.message=a.message.message);var c=a.errorData;a={type:a.type?a.type:"JavascriptError",
message:a.message};if(c)for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}this.postMessage({isReply:!0,callbackId:l,error:a})},getPromise:function(g){if(g in this.callbacksCapabilities)return this.callbacksCapabilities[g];a.utils.error("Cannot get promise for callback "+g)},cancelPromise:function(g){if(g in this.callbacksCapabilities){var l=this.callbacksCapabilities[g];delete this.callbacksCapabilities[g];l.reject({type:"Cancelled",message:"Request has been cancelled."});this.postMessage({action:"actionCancel",
data:{callbackId:g}})}else a.utils.warn("Cannot cancel callback "+g)},postMessage:function(a){if(this.postMessageTransfers){var l=this.getTransfersArray(a);this.comObj.postMessage(a,l)}else this.comObj.postMessage(a)},getObjectTransfers:function(a,l){if("object"===typeof a)if(a instanceof Uint8Array)l.push(a.buffer);else if(a instanceof ArrayBuffer)l.push(a);else for(var c in a)a.hasOwnProperty(c)&&this.getObjectTransfers(a[c],l)},getTransfersArray:function(a){var l=[];this.getObjectTransfers(a,l);
return 0===l.length?void 0:l},handleMessage:function(g){var l=this,c=g.data,d=this.actionHandler,e=this.actionHandlerAsync;g=this.callbacksCapabilities;var h;c.isReply?(d=c.callbackId,d in g?(e=g[d],delete g[d],"error"in c?e.reject(c.error):e.resolve(c.data)):a.utils.warn("Cannot resolve callback "+d)):c.action in d?(h=d[c.action],c.callbackId?Promise.resolve().then(function(){return h[0].call(h[1],c.data)}).then(function(a){l.postMessage({isReply:!0,callbackId:c.callbackId,data:a})},function(a){l.sendError(a,
c.callbackId)}):h[0].call(h[1],c.data)):c.action in e?(h=e[c.action],c.callbackId?h[0].call(h[1],c).then(function(a){l.postMessage({isReply:!0,callbackId:c.callbackId,data:a});l.nextAsync()},function(a){l.sendError(a,c.callbackId);l.nextAsync()}):h[0].call(h[1],c).then(function(){l.nextAsync()},function(){l.nextAsync()})):a.utils.error("Unknown action from worker: "+c.action)}}})("undefined"===typeof window?this:window);(function(a){var g=a._trnDebugMode||a._trnLogMode,l=a._logFiltersEnabled?a._logFiltersEnabled:{};a.utils=a.utils?a.utils:{};a.utils.warn=function(a,d){d||(d=a,a="default");g&&l[a]&&console.warn(a+": "+d)};a.utils.log=function(a,d){d||(d=a,a="default");g&&l[a]&&console.log(a+": "+d)};a.utils.error=function(a){g&&console.error(a);throw Error(a);};a.info=function(a,l){};a.warn=function(c,l){a.utils.warn(c,l)};a.error=function(c){a.utils.error(c)}})("undefined"===typeof window?this:window);(function(a){a.Module={TOTAL_MEMORY:50331648,noExitRuntime:!0,devicePixelRatio:1,cur_doc:null,cachePtrSize:0,hasBufOwnership:!0,loaded:!1,initCb:null,cachePtr:null,cleanupState:null,docs:{},postEvent:function(a,l,c){Module.workerMessageHandler.send("event",{docId:a,type:l,data:c})},postPagesUpdatedEvent:function(a,l,c){a={pageDimensions:Module.GetPageDimensions(a)};if(c)for(var d=0;d<c.length;++d)c[d]in a.pageDimensions?a.pageDimensions[c[d]].contentChanged=!0:console.warn("Invalid Page Number "+
c[d]);Module.postEvent(l,"pagesUpdated",a);return a},GetIndividualPageDimensions:function(a,l,c){a=Module.PageGetPageInfo(c);a.id=Module.PageGetId(c);return a},GetPageDimensionsRange:function(a,l,c){for(var d={},e=Module.PDFDocGetPageIterator(a,l);l<c&&Module.IteratorHasNext(e);++l){var h=Module.IteratorCurrent(e);d[l]=this.GetIndividualPageDimensions(a,l,h);Module.IteratorNext(e)}return d},GetPageDimensions:function(a){try{var l=Module.stackSave(),c=Module.GetPageCount(a);if(0===c)throw"This document has no pages.";
return Module.GetPageDimensionsRange(a,1,c+1)}finally{Module.stackRestore(l)}},loadDoc:function(a,l){"undefined"===typeof Module&&this._main();var c=null;try{var d=Module.stackSave();l=Module.CreateDoc(a,l);var e=Module.GetDoc(l);if(Module.PDFDocInitSecurityHandler(e))return{docId:l,pageDimensions:Module.GetPageDimensions(e)};c={type:"NeedsPassword",errorData:{docId:l},message:"This document requires a password"}}catch(h){c={type:"InvalidPDF",message:h}}finally{Module.stackRestore(d)}throw c;},loadCanvas:function(a,
l,c,d,e,h,u,m){return new Promise(function(t,q){var v=Module.GetDoc(a),n=l+1,p=function(){t(Module.RasterizePage(v,n,c,d,h,e,u,m))},f=Module.docs[a].chunkStorage;if(f){var b=Module.GetDownloadData(v).downloader,r=f.getRequiredChunkOffsetArrays(b,n);f.keepChunks(r.have);b=function(){var b=f.getChunks(r.missing);Module.loadPromise=b.then(function(){var b=Module.loadPromise.cancelled;Module.loadPromise=null;b||p()})["catch"](function(b){"cancelled"!==b?q(b):Module.loadPromise=null})};Module.loadPromise?
Module.loadPromise.then(b,b):b()}else p()})},loadResources:function(a,l){Module.Initialize(l);Module._TRN_PDFNetSetDefaultDiskCachingEnabled(!1);var c=new Uint8Array(a);Module.PDFNetSetResourceData(c)},onRuntimeInitialized:function(){"undefined"===typeof Module&&(("undefined"!==typeof window?window:self).Module={});(function(g){g.PDFDocExportXFDF=function(a,c){var d=Module.GetDoc(a),e=Module.stackSave(),h;try{var u;u=c?Module.PDFDocFDFExtract(d,c):Module.PDFDocFDFExtract(d);h=Module.FDFDocSaveAsXFDF(u);
Module.stackRestore(e)}catch(m){throw Module.stackRestore(e),m;}return h};g.PageArrayToPageSet=function(a){var c=Module.stackSave(),d;try{d=Module.PageSetCreate();for(var e=0;e<a.length;++e)Module.PageSetAddPage(d,a[e]);Module.stackRestore(c)}catch(h){throw Module.stackRestore(c),h;}return d};g.cancelCurrent=function(){var a=Module.loadPromise;return a?(a.cancel(),a.cancelled=!0):(a=Module.cleanupState)?(clearImmediate(a.timeout),a.cleanupArr.forEach(function(a){a()}),Module.cleanupState=null,!0):
!1};g.SetWorkerRestartCallback=function(a){Module.workerRestartCallback=a};g.XFDFMerge=function(a,c){if(c){var d=[];try{var e=Module.GetUStringFromJSString(c,!0);d.push(function(){Module.UStringDestroy(e)});var h=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_FDFDocCreateFromXFDF(e,h));var u=Module.getValue(h,"i8*");d.push(function(){Module.FDFDocDestroy(u)});REX(Module._TRN_PDFDocFDFUpdate(a,u))}finally{d.forEach(function(a){a()})}}};g.MergeXFDF=function(a,c){return new Promise(function(d,
e){var h=[];try{var u=Module.stackSave();h[h.length]=function(){Module.stackRestore(u)};var m=Module.GetDoc(a);Module.XFDFMerge(m,c);h.forEach(function(a){a()});d({})}catch(t){h.forEach(function(a){a()}),e(t)}})};g.CreateBufferFile=function(a,c){Module.MakeDev(a);for(var d=new ArrayBuffer(c),d=new Uint8Array(d),e=0;e<c;++e)d[e]=255;Module.docs[a]={buffer:d}};g.ReadBufferFile=function(a,c){var d=Module.docs[a].buffer;if(c){var e=new Uint8Array(d.buffer.slice(0));Module.docs[a].buffer=e}return d};g.RemoveBufferFile=
function(a){Module.docs[a]=null};g.SaveHelper=function(a,c,d){d="undefined"===typeof d?2:d;Module.MakeDev(c);a=Module._TRN_PDFDocSave(a,Module.GetUStringFromJSString(c),d,0);Module.docs[c].sink=null;REX(a);return Module.docs[c].buffer.buffer};g.SaveDoc=function(l,c,d,e,h,u){return new Promise(function(m,t){var g=Module.GetDoc(l),v=[];try{var g=Module.GetDoc(l),n=Module.stackSave();v[v.length]=function(){Module.stackRestore(n)};Module.XFDFMerge(g,c);for(var p=Module.PDFDocGetPageIterator(g,1);Module.IteratorHasNext(p);){var f=
Module.IteratorCurrent(p);try{for(var b=Module.PageGetNumAnnots(f);0<b;){var r=Module.PageGetAnnot(f,--b);Module.AnnotHasAppearance(r)||Module.AnnotRefreshAppearance(r)}}catch(E){Module.ObjErase(f,"Annots")}Module.IteratorNext(p)}if(u){var b=function(b){b=new Uint8Array(b);a.FS.writeFile("watermarkFile",b);b=Module.ImageCreateFromFile(g,Module.GetUStringFromJSString("watermarkFile"));a.FS.unlink("watermarkFile");return b},k=Module.ElementBuilderCreate();v.push(function(){Module.ElementBuilderDestroy(k)});
var x=Module.ElementWriterCreate();v.push(function(){Module.ElementWriterDestroy(x)});try{if(!u.hasOwnProperty("default"))throw Error("Watermark dictionary has no 'default' key!");for(var w=b(u["default"]),p=Module.PDFDocGetPageIterator(g,1),r=-1;Module.IteratorHasNext(p);){f=Module.IteratorCurrent(p);Module.IteratorNext(p);r++;var A=r.toString();try{var y;if(u.hasOwnProperty(A)){var z=u[A];if(z)y=b(z);else continue}else y=w;var B=Module.PageGetPageInfo(f),F=Module.ElementBuilderCreateImage(k,y,0,
0,B.width,B.height);Module.ElementWriterBegin(x,f);Module.ElementWriterWritePlacedElement(x,F);Module.ElementWriterEnd(x)}catch(E){console.warn("Watermark for page "+A+"can not be added due to error: "+E)}}}catch(E){console.warn("Watermarks can not be added due to error: "+E)}}p=0;if(e){var C=Module.PDFDocGetRoot(g);(p=Module.ObjFindObj(C,"OpenAction"))&&Module.ObjPut(C,"__OpenActionBackup__",p);var D=Module.ObjPutDict(C,"OpenAction");Module.ObjPutName(D,"Type","Action");Module.ObjPutName(D,"S","JavaScript");
Module.ObjPutString(D,"JS","this.print()")}var G=Module.SaveHelper(g,l,h);e&&(p?Module.ObjPut(C,"OpenAction",Module.ObjFindObj(C,"__OpenActionBackup__")):Module.ObjErase(C,"OpenAction"));v.forEach(function(b){b()});if(d)m({fileData:G});else{var H=G.slice(0);m({fileData:H})}}catch(E){v.forEach(function(b){b()}),t(E)}})};g.SaveDocFromFixedElements=function(a,c,d){a=Module.PDFDocCreateFromLayoutEls(a);a=Module.CreateDoc({type:"ptr",value:a});return Module.SaveDoc(a,c,!0,!1,d)};g.GetCurrentCanvasData=
function(a){var c=Module.currentRenderData;if(!c)return null;a&&REX(Module._TRN_PDFRasterizerUpdateBuffer(c.rast));Date.now();return{pageBuf:Module.ReadBufferFile("b",a).buffer,pageWidth:c.out_width,pageHeight:c.out_height}};g.RasterizePage=function(a,c,d,e,h,u,m,g){return new Promise(function(q,v){Module.currentRenderData={};var n=Module.currentRenderData;n.out_width=parseInt(d,10);n.out_height=parseInt(e,10);var p=[];p.push(function(){Module.currentRenderData=null});try{var f=Module.stackSave();
p[p.length]=function(){Module.stackRestore(f)};var b=Module.GetPage(a,c),r=Module.PageGetPageWidth(b),k=Module.PageGetPageHeight(b);n.stride=4*n.out_width;n.buf_size=n.out_width*n.out_height*4;n.rast=Module.PDFRasterizerCreate();p.push(function(){Module._TRN_PDFRasterizerDestroy(n.rast)});if(m){var x=Module.EMSCreateUpdatedLayersContext(a,m);0!==x&&(Module._TRN_PDFRasterizerSetOCGContext(n.rast,x),p.push(function(){Module._TRN_OCGContextDestroy(x)}))}var w=Module.PageGetRotation(b),A=1===u||3===u,
w=(1===w||3===w)!==A,y,z=Module.allocate(48,"i8",Module.ALLOC_STACK),B;if(h){h.x1=h[0];h.y1=h[1];h.x2=h[2];h.y2=h[3];var F=Module.PageGetDefaultMatrix(b,0),C=Module.Matrix2DInverse(F);h=Module.Matrix2DMultBBox(C,h);var D;h.x2<h.x1&&(D=h.x1,h.x1=h.x2,h.x2=D);h.y2<h.y1&&(D=h.y1,h.y1=h.y2,h.y2=D);y=n.out_width/(w?h.y2-h.y1:h.x2-h.x1);B=Module.GetDefaultMatrixBox(b,h,u)}else B=Module.PageGetDefaultMatrix(b,u),y=n.out_width/(A?k:r);Module.Matrix2DSet(z,y,0,0,y,0,0);Module.Matrix2DConcat(z,B);p.push(function(){Module._free(n.bufPtr)});
var G=Module.allocate(4,"i8",Module.ALLOC_STACK),H=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFRasterizerSetDrawAnnotations(n.rast,0));Module.CreateBufferFile("b",n.buf_size);p.push(function(){Module.RemoveBufferFile("b")});if(10===g){REX(Module._TRN_PDFRasterizerSetOverprint(n.rast,1));var E=Module.PDFRasterizerRasterizeSeparations(n.rast,b,n.out_width,n.out_height,z,0,0);q({pageBuf:E,pageWidth:n.out_width,pageHeight:n.out_height})}else{REX(Module._TRN_PDFRasterizerSetOverprint(n.rast,
g));REX(Module._TRN_PDFRasterizerGetChunkRendererPath(n.rast,b,Module.GetUStringFromJSString("b"),n.out_width,n.out_height,!0,z,0,0,0,G));var J=Module.getValue(G,"i8*");p.splice(1,0,function(){REX(Module._TRN_ChunkRendererDestroy(J))})}(new Date).getTime();var I=function(){try{for(var b=0,f=(new Date).getTime(),a=!1;200>b;){REX(Module._TRN_ChunkRendererRenderNext(J,H));if(!Module.getValue(H,"i8*")){a=!0;break}b=(new Date).getTime()-f}if(a){var k=Module.GetCurrentCanvasData(!1);p.forEach(function(b){b()});
q(k)}else Module.cleanupState.timeout=setImmediate(I,0)}catch(r){p.forEach(function(b){b()}),v(r)}},K=setImmediate(I,0);Module.cleanupState={cleanupArr:p,timeout:K};p.push(function(){Module.cleanupState=null})}catch(L){p.forEach(function(b){b()}),v(L)}})};g.GetDestinationVPosHPos=function(a){var c=0,d=0,e=!1,h=!1,u=Module.DestinationGetPage(a),m=Module.DestinationGetExplicitDestObj(a),u=Module.PageGetDefaultMatrix(u),u=Module.Matrix2DInverse(u),g=Module.Matrix2DMult(u,{x:d,y:c}),d=g.x,c=g.y,q;try{switch(Module.DestinationGetFitType(a)){case 2:case 6:q=
Module.ObjGetAt(m,2);Module.ObjIsNumber(q)&&(c=Module.ObjGetNumber(q),e=!0);break;case 0:q=Module.ObjGetAt(m,2);Module.ObjIsNumber(q)&&(d=Module.ObjGetNumber(q),h=!0);q=Module.ObjGetAt(m,3);Module.ObjIsNumber(q)&&(c=Module.ObjGetNumber(q),e=!0);break;case 4:q=Module.ObjGetAt(m,2);Module.ObjIsNumber(q)&&(d=Module.ObjGetNumber(q),h=!0);q=Module.ObjGetAt(m,5);Module.ObjIsNumber(q)&&(c=Module.ObjGetNumber(q),e=!0);break;case 3:case 7:q=Module.ObjGetAt(m,2),Module.ObjIsNumber(q)&&(d=Module.ObjGetNumber(q),
h=!0)}g=Module.Matrix2DMult(u,{x:d,y:c});d=g.x;c=g.y;e||(c=0);h||(d=0)}catch(v){d=c=0}return{hpos:d,vpos:c}};g.FillBookmarkTree=function(a,c){for(var d=0;Module.BookmarkIsValid(a);a=Module.BookmarkGetNext(a),++d)try{var e=[];if(Module.BookmarkHasChildren(a)){var h=Module.BookmarkGetFirstChild(a);Module.FillBookmarkTree(h,e)}var u=Module.BookmarkGetTitle(a),e={children:e,name:u},m=Module.BookmarkGetAction(a);if(Module.ActionIsValid(m)){var g=Module.ActionGetType(m);if(0===g){var q=Module.ActionGetDest(m);
if(Module.DestinationIsValid(q)){var v=Module.DestinationGetPage(q);if(Module.PageIsValid(v)){var n=Module.PageGetIndex(v);if(0<n){e.pageNumber=n;var p=Module.GetDestinationVPosHPos(q);e.verticalOffset=p.vpos;e.horizontalOffset=p.hpos}}}}else if(5===g){var f=Module.ObjFindObj(m,"URI");f&&(e.url=Module.ObjGetAsPDFText(f))}}c[c.length]=e}catch(b){}};g.LoadBookmarks=function(a){a=Module.GetDoc(a);var c=[],d=Module.stackSave();try{var e=Module.PDFDocGetFirstBookmark(a);Module.BookmarkIsValid(e)&&Module.FillBookmarkTree(e,
c)}catch(h){}Module.stackRestore(d);return{bookmarks:c}};g.UpdatePassword=function(a,c){try{var d=Module.stackSave(),e=Module.GetDoc(a);return Module.PDFDocInitStdSecurityHandler(e,c)?(e in downloadDataMap&&REX(Module._TRN_PDFDocDownloaderInitialize(e,downloadDataMap[e].downloader)),{success:!0,pageDimensions:Module.GetPageDimensions(e)}):{success:!1}}finally{Module.stackRestore(d)}};g.GetTextData=function(a,c){return new Promise(function(d,e){var h=c+1,u=Module.GetDoc(a),m=[];try{var g=Module.stackSave();
m[m.length]=function(){Module.stackRestore(g)};var q=Module.GetPage(u,h),v=Module.allocate(8,"i8",Module.ALLOC_STACK);REX(Module._TRN_TextExtractorCreate(v));var n=Module.getValue(v,"i8*");m[m.length]=function(){Module._TRN_TextExtractorDestroy(n)};REX(Module._TRN_TextExtractorBegin(n,q,0,1));var p=Module.allocate(48,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageGetDefaultMatrix(q,!0,1,0,p));var f=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_TextExtractorGetQuads(n,p,0,f));var b=Module.getValue(f,
"i8*"),r=Module._malloc(8*b);m[m.length]=function(){Module._free(r)};REX(Module._TRN_TextExtractorGetQuads(n,p,r,f));var k=Module.GetJSDoubleArrFromCore(r,b),x=Module.allocate(4,"i8",Module.ALLOC_STACK),w=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_UStringCreate(w));m[m.length]=function(){Module._TRN_UStringDestroy(A)};var A=Module.getValue(w,"i8*");REX(Module._TRN_TextExtractorGetAsTextWithOffsets(n,A,0,x));var y=Module.GetJSStringFromUString(A),z=Module.getValue(x,"i8*"),B=Module._malloc(4*
z);m[m.length]=function(){Module._free(B)};REX(Module._TRN_TextExtractorGetAsTextWithOffsets(n,A,B,x));var F=Module.GetJSIntArrayFromCore(B,z),C=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_TextExtractorCmptSemanticInfo(n,p,0,C));var D=Module.getValue(C,"i8*"),G=Module._malloc(8*D);m[m.length]=function(){Module._free(G)};REX(Module._TRN_TextExtractorCmptSemanticInfo(n,p,G,C));var H=Module.GetJSDoubleArrFromCore(G,D);m.forEach(function(b){b()});d({str:y,quads:k,offsets:F,struct:H})}catch(E){m.forEach(function(b){b()}),
e(E)}})};g.InsertBlankPages=function(a,c,d,e){return new Promise(function(h,u){var m=[],g=Module.GetDoc(a);try{var q=Module.stackSave();m[m.length]=function(){Module.stackRestore(q)};for(var v=c.length-1;0<=v;--v){var n=Module.PDFDocGetPageIterator(g,c[v]),p=Module.PDFDocPageCreate(g,d,e);Module.PDFDocPageInsert(g,n,p)}var f=Module.postPagesUpdatedEvent(g,a);m.forEach(function(b){b()});h(f)}catch(b){m.forEach(function(b){b()}),u(b)}})};g.InsertPages=function(a,c,d,e,h){return new Promise(function(u,
m){var g=[],q=Module.GetDoc(a);try{var v=Module.stackSave();g[g.length]=function(){Module.stackRestore(v)};var n;if(c instanceof ArrayBuffer){var p=Module.CreateDoc(c);n=Module.GetDoc(p);g[g.length]=function(){Module.DeleteDoc(p)}}else n=Module.GetDoc(c);for(var f=d.length,b=Module.PageSetCreate(),r=0;r<f;++r)Module.PageSetAddPage(b,d[r]);Module.PDFDocInsertPages(q,e,n,b,h);var k=Module.postPagesUpdatedEvent(q,a);g.forEach(function(b){b()});u(k)}catch(x){g.forEach(function(b){b()}),m(x)}})};g.MovePages=
function(a,c,d){return new Promise(function(e,h){var g=[],m=Module.GetDoc(a);try{var t=Module.stackSave();g[g.length]=function(){Module.stackRestore(t)};for(var q=c.length,v=Module.PageSetCreate(),n=0;n<q;++n)Module.PageSetAddPage(v,c[n]);Module.PDFDocMovePages(m,d,v);var p=Module.postPagesUpdatedEvent(m,a);g.forEach(function(f){f()});e(p)}catch(f){g.forEach(function(b){b()}),h(f)}})};g.RemovePages=function(a,c){return new Promise(function(d,e){var h=Module.GetDoc(a),g=[];try{var m=Module.stackSave();
g[g.length]=function(){Module.stackRestore(m)};for(var t=c.length-1;0<=t;--t){var q=Module.PDFDocGetPageIterator(h,c[t]);Module.IteratorHasNext(q)&&Module.PDFDocPageRemove(h,q)}var v=Module.postPagesUpdatedEvent(h,a);g.forEach(function(a){a()});d(v)}catch(n){g.forEach(function(a){a()}),e(n)}})};g.RotatePages=function(a,c,d){return new Promise(function(e,h){var g=Module.GetDoc(a),m=[];try{var t=Module.stackSave();m[m.length]=function(){Module.stackRestore(t)};var q=c.length,v=0,n=Module.PDFDocGetPageIterator(g,
c[0]),p=[];m.push(function(){Module._TRN_IteratorDestroy(n)});for(var f=c[0];Module.IteratorHasNext(n)&&v<c[q-1];++f){if(f===c[v]){var b=Module.IteratorCurrent(n),r=(Module.PageGetRotation(b)+d)%4;Module.PageSetRotation(b,r);p.push(f);v++}Module.IteratorNext(n)}var k=Module.postPagesUpdatedEvent(g,a,p);m.forEach(function(b){b()});e(k)}catch(x){m.forEach(function(b){b()}),h(x)}})};g.ExtractPages=function(a,c,d,e){return new Promise(function(h,g){var m=[];try{var t=Module.GetDoc(a),q=Module.stackSave();
m[m.length]=function(){Module.stackRestore(q)};var v=function(f){m.forEach(function(b){b()});g(f)};Module.XFDFMerge(t,d);var n=Module.CreateEmptyDoc();m[m.length]=function(){Module.DeleteDoc(n)};var p=Module.InsertPages(n,a,c,1,!0).then(function(){return Module.SaveDoc(n,void 0,!0,!1,void 0,e)}).then(function(f){m.forEach(function(b){b()});return f})["catch"](v);h(p)}catch(f){v(f)}})};g.CropPages=function(a,c,d,e,h,g){return new Promise(function(m,t){var q=Module.GetDoc(a),v=[];try{var n=Module.stackSave();
v[v.length]=function(){Module.stackRestore(n)};var p=c.length,f=0,b=Module.PDFDocGetPageIterator(q,c[0]);v.push(function(){Module._TRN_IteratorDestroy(b)});for(var r=[],k=c[0];Module.IteratorHasNext(b)&&f<c[p-1];++k){if(k===c[f]){var x=Module.IteratorCurrent(b),w=Module.allocate(8,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageGetCropBox(x,w));var A=Module.PageGetRotation(x),y=Module.getValue(w,"double"),z=Module.getValue(w+8,"double"),B=Module.getValue(w+16,"double"),F=Module.getValue(w+24,"double");
0===A%4?(Module.setValue(w,y+h,"double"),Module.setValue(w+8,z+e,"double"),Module.setValue(w+16,B-g,"double"),Module.setValue(w+24,F-d,"double")):1===A%4?(Module.setValue(w,y+d,"double"),Module.setValue(w+8,z+h,"double"),Module.setValue(w+16,B-e,"double"),Module.setValue(w+24,F-g,"double")):2===A%4?(Module.setValue(w,y+g,"double"),Module.setValue(w+8,z+d,"double"),Module.setValue(w+16,B-h,"double"),Module.setValue(w+24,F-e,"double")):3===A%4&&(Module.setValue(w,y+e,"double"),Module.setValue(w+8,z+
g,"double"),Module.setValue(w+16,B-d,"double"),Module.setValue(w+24,F-h,"double"));Module.setValue(w+32,0,"double");REX(Module._TRN_PageSetCropBox(x,w));r.push(k);f++}Module.IteratorNext(b)}var C=Module.postPagesUpdatedEvent(q,a,r);v.forEach(function(b){b()});m(C)}catch(D){v.forEach(function(b){b()}),t(D)}})}})("undefined"===typeof self?this.Module:self.Module);this.loaded=!0;Module.initCb&&Module.initCb()}}})("undefined"===typeof self?this:self);var global="undefined"!==typeof window?window:self;
(function(a){a.currentFileString="/current";var g=0,l=0,c={},d=null;Module.chunkMax=200;var e=function(f,b,a,k){var c=new XMLHttpRequest;return CancellablePromise(function(d,e){c.open("GET",f,!0);c.responseType="arraybuffer";c.onerror=function(){e("Network error occurred")};c.onload=function(){if(206===this.status&&c.response.byteLength===a){var b=new Int8Array(c.response);d(b)}else e("Download Failed")};var h=["bytes=",b,"-",b+a-1].join("");c.setRequestHeader("Range",h);if(k)for(var g in k)c.setRequestHeader(g,
k[g]);c.send()},function(){c.abort()})},h=function(f){this.file=f;this.position=0;this.length=f.size;this.reader=new FileReaderSync};h.prototype={read:function(f,b,a){a=this.position+a<=this.length?a:this.length-this.position;f=f.subarray(b,b+a);b=new Int8Array(this.reader.readAsArrayBuffer(this.file.slice(this.position,this.position+a)));f.set(b);this.position+=a;return a},seek:function(f){this.position=f},close:function(){this.reader=this.file=null},getPos:function(){return this.position},getTotalSize:function(){return this.length}};
var u=function(f){this.data=f;this.position=0;this.length=this.data.length};u.prototype={read:function(f,b,a){a=this.position+a<=this.length?a:this.length-this.position;f=f.subarray(b,b+a);b=this.data.subarray(this.position,this.position+a);f.set(b);this.position+=a;return a},write:function(f,b,a){a=this.position+a<=this.length?a:this.length-this.position;f=f.subarray(b,b+a);this.data.subarray(this.position,this.position+a).set(f);this.position+=a;return a},seek:function(f){this.position=f},close:function(){this.data=
null},getPos:function(){return this.position},getTotalSize:function(){return this.length}};var m=function(f,b,a,k){"object"===typeof f?(this.lruList=f.lruList,this.chunkMap=f.chunkMap,this.length=f.length,this.url=f.url,this.customHeaders=f.customHeaders):(this.lruList=[],this.chunkMap={},this.chunkMap[b]=k,this.length=b,this.url=f,this.customHeaders=a)};m.prototype={lruUpdate:function(f){var b=this.lruList.lastIndexOf(f);0<=b&&this.lruList.splice(b,1);this.lruList.push(f)},getChunk:function(f){if(this.chunkMap[f])this.lruUpdate(f);
else{var b=Math.min(f+524288,this.length)-1,a=new XMLHttpRequest;a.open("GET",this.url,!1);a.responseType="arraybuffer";a.setRequestHeader("Range",["bytes=",f,"-",b].join(""));if(this.customHeaders)for(var k in this.customHeaders)a.setRequestHeader(k,this.customHeaders[k]);a.send();if(200===a.status||206===a.status)this.writeChunk(new Int8Array(a.response),f);else throw Error("Failed to load data from");}return this.chunkMap[f]},hadChunk:function(f){return f in this.chunkMap},hasChunk:function(f){return this.chunkMap[f]},
getCacheData:function(){return this.chunkMap[this.length]},getRequiredChunkOffsetArrays:function(f,b){var a={have:[],downloading:[],missing:[]};try{var k=Module.stackSave(),c=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_DownloaderGetRequiredChunksSize(f,b,c));var d=Module.getValue(c,"i8*");if(d){var e=Module._malloc(4*d);REX(Module._TRN_DownloaderGetRequiredChunks(f,b,e,d));for(c=0;c<d;++c){var h=Module.getValue(e+4*c,"i8*");this.hasChunk(h)?a.have.push(h):this.hadChunk(h)?a.missing.push(h):
a.downloading.push(h)}}}finally{e&&Module._free(e),Module.stackRestore(k)}return a},keepVisibleChunks:function(f,b){for(var a=b.length,k=Module.chunkMax/2,c=0,d=0;d<a;++d){var e=this.getRequiredChunkOffsetArrays(f,b[d]),h=e.have,g=h.length,c=c+g;if(c>k){this.keepChunks(h.slice(0,g-c+k));break}this.keepChunks(e.have)}},getChunkAsync:function(f){var b=this,a=f+524288,k=524288;a>this.length&&(k-=a-this.length);return e(this.url,f,k,this.customHeaders).then(function(a){b.writeChunk(a,f)})},getChunks:function(f){for(var b=
f.length,a=Array(b),k=0;k<b;++k)a[k]=this.getChunkAsync(f[k]);return CancellablePromise.all(a)},keepChunks:function(f){for(var b=f.length,a=0;a<b;++a)this.lruUpdate(f[a])},writeChunk:function(f,b,a){a=a||0;var k=this.chunkMap[b],c=f.length,d=this.lruList.length>=Module.chunkMax&&!k;524288!==c||f.buffer.byteLength!==c?(d?(k=this.lruList.shift(),d=this.chunkMap[k],524288>d.length&&(d=new Int8Array(524288)),this.chunkMap[k]=null):d=k?this.chunkMap[b]:new Int8Array(524288),d.subarray(a,a+c).set(f),f=
d):d&&(k=this.lruList.shift(),this.chunkMap[k]=null);this.lruUpdate(b);this.chunkMap[b]=f}};var t=function(a){this.chunkStorage=a;this.position=0;this.length=this.chunkStorage.length};t.prototype={read:function(a,b,r){var k=this.position+r<=this.length,c=k?r:this.length-this.position,d,e;if(this.position<this.length){var h;for(h=0;h<c;){e=this.position%524288;var g=this.position-e,l=c-h;if(this.chunkStorage.hadChunk(g))g=this.chunkStorage.getChunk(g),d=a.subarray(b+h,b+h+l),e=g.subarray(e,e+l),d.set(e),
e=e.length,h+=e,this.position+=e;else for(this.position+=l;h<c;++h)d[h]=0}}if(!k){d=b+c;if(r-=c)b=this.chunkStorage.getCacheData(),r>b.length&&(r=b.length),k=this.position-this.length,d=a.subarray(d,d+r),e=b.subarray(k,k+r),d.set(e);this.position+=r;return c+r}return c},write:function(a,b,r){var k=this.position+r<=this.length,c=this.position+r<=this.length?r:this.length-this.position,d=a.subarray(b,b+c),e=this.position%524288;this.chunkStorage.writeChunk(d,this.position-e,e);this.position+=c;if(!k){d=
b+c;if(r-=c)b=this.chunkStorage.getCacheData(),r>b.length&&(r=b.length),k=this.position-this.length,d=a.subarray(d,d+r),b.subarray(k,k+r).set(d);this.position+=r;return c+r}return c},seek:function(a){this.position=a},close:function(){this.chunkStorage=null},getPos:function(){return this.position},getTotalSize:function(){return this.length}};var q=function(a){this.docId=a;this.length=0;this.data=new Int8Array(8192);this.position=0};q.prototype={seek:function(a){this.position=a},close:function(){var a=
new Int8Array(this.data.buffer.slice(0,this.length));Module.ChangeDocBackend(this.docId,{ptr:Module.GetDoc(this.docId),buffer:a});this.data=null},getPos:function(){return this.position},getTotalSize:function(){return this.length},read:function(a,b,c){var k=this.data.length;c=c+b<k?c:k-b;a=a.subarray(b,b+c);b=this.data.subarray(this.position,this.position+c);a.set(b);this.position+=c;return c},write:function(a,b,c){for(var k=this.position+c,d=this.data.length;k>d;){var d=Math.max(d*(16777216<d?1.5:
2),k),e=new Int8Array(d);e.set(this.data.subarray(0,this.length),0);this.data=e}a=a.subarray(b,b+c);this.data.set(a,this.position);this.position+=c;this.position>this.length&&(this.length=this.position);return c}};var v={IsSink:function(a){return 66===(a.flags&255)},open:function(a){var b=a.path.slice(1);this.IsSink(a)?(a.provider=new q(b),Module.docs[b].sink=a.provider):a.provider=Module.docs[b].sink?new u(Module.docs[b].sink.data):Module.docs[b].chunkStorage?new t(Module.docs[b].chunkStorage):Module.docs[b].buffer?
new u(Module.docs[b].buffer):new h(Module.docs[b].file)},close:function(a){a.provider.close()},read:function(a,b,c,k,d){return a.provider.read(b,c,k)},llseek:function(a,b,c){a=a.provider;1===c?b+=a.getPos():2===c&&(b=a.getTotalSize()+b);if(0>b)throw new FS.ErrnoError(global.ERRNO_CODES.EINVAL);a.seek(b);return b},write:function(a,b,c,k,d){return k?a.provider.write(b,c,k):0}};global.THROW=function(a){throw{type:"InvalidPDF",message:a};};global.REX=function(a){a&&THROW(n(a))};var n=function(f){return"Exception: \n\t Message: "+
a.GetJSStringFromCString(Module._TRN_GetMessage(f))+"\n\t Filename: "+a.GetJSStringFromCString(Module._TRN_GetFileName(f))+"\n\t Function: "+a.GetJSStringFromCString(Module._TRN_GetFunction(f))+"\n\t Linenumber: "+a.GetJSStringFromCString(Module._TRN_GetLineNum(f))};a.GetErrToString=n;a.Initialize=function(a){var b=Module.stackSave();a=a?Module.allocate(Module.intArrayFromString(a),"i8",Module.ALLOC_STACK):0;REX(Module._TRN_PDFNetInitialize(a));Module.stackRestore(b)};a.GetDoc=function(a){if(a in
Module.docs)return Module.docs[a].ptr;throw{type:"InvalidDocReference",message:"Unable to access Document id="+a+". The document appears to be invalid or was deleted."};};a.clearDocBackend=function(){null!==Module.cachePtr?(Module.hasBufOwnership&&Module._free(Module.cachePtr),Module.cachePtr=null):Module.docs[a.currentFileString]&&delete Module.docs[a.currentFileString]};a.MakeDev=function(a){if(!c[a]){var b=FS.makedev(3,5);FS.registerDevice(b,v);FS.mkdev(a,511,b);c[a]=!0}};a.CreateDocFileBackend=
function(a,b){Module.MakeDev(b);var c=Module.allocate(4,"i8",Module.ALLOC_STACK);Module.docs[b]={file:a};var k=Module.allocate(Module.intArrayFromString(b),"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocCreateFromFilePath(k,c));c=Module.getValue(c,"i8*");Module.docs[b].ptr=c};a.InsertImageIntoDoc=function(a,b,c){var k=[];try{var d=Module.ElementBuilderCreate();k.push(function(){Module.ElementBuilderDestroy(d)});var e=Module.ElementWriterCreate();k.push(function(){Module.ElementWriterDestroy(e)});
var h,g;c?(h=c.width,g=c.height):(h=Module.ImageGetImageWidth(b),g=Module.ImageGetImageHeight(b),c=h/g,1<c?(h=612,g=parseInt(h/c,10)):(g=792,h=parseInt(g*c,10)));var l=Module.ElementBuilderCreateImage(d,b,0,0,h,g),v=Module.PDFDocPageCreate(a,h,g);Module.ElementWriterBegin(e,v);Module.ElementWriterWritePlacedElement(e,l);Module.ElementWriterEnd(e);Module.PDFDocPagePushBack(a,v)}finally{k.forEach(function(b){b()})}};var p=function(a,b,c){"object"===typeof a?(this.m_pages=a.m_pages,this.m_has_named_dests=
a.m_has_named_dests,this.m_finished_download=a.m_finished_download,this.m_has_outline=a.m_has_outline,this.m_current_page=a.m_current_page,this.m_id=a.m_id,this.size=a.size,this.timeout=a.timeout,this.eventPageArray=a.eventPageArray,this.requirePageCallbacks=a.requirePageCallbacks):(this.m_pages=[],this.m_has_outline=this.m_finished_download=this.m_has_named_dests=!1,this.m_current_page=1,this.m_id=c,this.size=a,this.timeout=null,this.eventPageArray=[],this.requirePageCallbacks={});this.downloadUserData=
Module.createDownloadUserData(b,c)};p.prototype={getJSUrl:function(){return Module.extractDownloadUserData(this.downloadUserData).url},getDocId:function(){return Module.extractDownloadUserData(this.downloadUserData).docId},destroyUserData:function(){this.m_id in Module.customHeadersMap&&delete Module.customHeadersMap[this.m_id];Module.destroyDownloadUserData(this.downloadUserData)}};a.createDownloadUserData=function(a,b){var c=Module.allocate(Module.intArrayFromString(a),"i8",Module.ALLOC_NORMAL),
k=Module.allocate(8,"i8",Module.ALLOC_NORMAL);Module.setValue(k,c,"i8*");Module.setValue(k+4,parseInt(b,10),"i32");return this.downloadUserData=k};a.extractDownloadUserData=function(f){var b=Module.getValue(f,"i8*"),b=a.GetJSStringFromCString(b);f=Module.getValue(f+4,"i32").toString();return{url:b,docId:f}};a.destroyDownloadUserData=function(a){Module._free(Module.getValue(a,"i8*"));Module._free(a)};global.downloadDataMap={};Module.customHeadersMap={};a.GetDownloadData=function(a){if(a in downloadDataMap)return downloadDataMap[a]};
a.DownloaderHint=function(a,b){var c=Module.GetDoc(a),k=downloadDataMap[c];b.currentPage&&(k.m_current_page=b.currentPage);if(b.visiblePages){var d=b.visiblePages,e;for(e=0;e<d.length;++e)++d[e];for(var h in this.requirePageCallbacks)this.requirePageCallbacks.hasOwnProperty(h)&&d.push(parseInt(h,10));(e=Module.docs[a].chunkStorage)&&e.keepVisibleChunks(k.downloader,d);k=d.length;h=Module.allocate(4*k,"i8",Module.ALLOC_STACK);for(e=0;e<k;++e)Module.setValue(h+4*e,d[e],"i32");REX(Module._TRN_PDFDocDownloadPages(c,
h,k,1,0))}};a.RequirePage=function(a,b){return new Promise(function(c,k){var d=Module.GetDoc(a),e=downloadDataMap[d];e&&!e.m_pages[b]?(b in e.requirePageCallbacks?e.requirePageCallbacks[b].push(c):e.requirePageCallbacks[b]=[c],e=Module.allocate(4,"i8",Module.ALLOC_STACK),Module.setValue(e,b,"i32"),Module._TRN_PDFDocDownloadPages(d,e,1,0,0)):c()})};a.IsLinearizationValid=function(a){a=Module.GetDoc(a);if(a=downloadDataMap[a]){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_DownloaderIsLinearizationValid(a.downloader,
b));return 0!==Module.getValue(b,"i8")}return!1};a.ShouldRunRender=function(a,b){var c=Module.GetDoc(a);return(c=downloadDataMap[c])?c.m_pages[b]:!0};a.createCallbacksStruct=function(a){if(!d){var b=function(a){return function(b){var f=arguments;b in downloadDataMap?a.apply(this,f):setImmediate(function(){b in downloadDataMap&&a.apply(this,f)},0)}};d={downloadProc:Module.addFunction(function(a,b,f,c,d){c=Module.extractDownloadUserData(c);var h=c.docId;e(c.url,b,f,Module.customHeadersMap[h]).then(function(c){h in
Module.docs&&Module.docs[h].chunkStorage&&Module.docs[h].chunkStorage.writeChunk(c,b);Module._TRN_DownloadComplete(0,b,f,a)})}),notifyUpdatePage:Module.addFunction(b(function(a,b,f,c){var d=downloadDataMap[a];d.m_pages[b]=!0;var e=d.eventPageArray;if(b in d.requirePageCallbacks)for(f=d.requirePageCallbacks[b],c=0;c<f.length;++c)f[c]();d.timeout?e.push(b):(e=d.eventPageArray=[b],d.timeout=setTimeout(function(){Module.postPagesUpdatedEvent(a,d.m_id,e);d.timeout=null},100))})),notifyUpdateOutline:Module.addFunction(b(function(a,
b){var f=downloadDataMap[a];f.m_has_outline||(f.m_has_outline=!0,Module.postEvent(f.m_id,"bookmarksUpdated",{}))})),notifyUpdateNamedDests:Module.addFunction(b(function(a,b){var f=downloadDataMap[a];f.m_has_named_dests||(f.m_has_named_dests=!0)})),notifyUpdateThumb:Module.addFunction(b(function(a,b){})),notifyFinishedDownload:Module.addFunction(b(function(a,b){var f=downloadDataMap[a];f.m_finished_download||(f.m_finished_download=!0,Module.postEvent(f.m_id,"documentComplete",{}))})),notifyDocumentError:Module.addFunction(function(a,
b){}),getCurrentPage:Module.addFunction(function(a,b){return downloadDataMap[a].m_current_page})}}b=Module.allocate(40,"i8",Module.ALLOC_STACK);Module.setValue(b,d.downloadProc,"i8*");Module.setValue(b+4,a,"i8*");Module.setValue(b+8,d.notifyUpdatePage,"i8*");Module.setValue(b+12,d.notifyUpdateOutline,"i8*");Module.setValue(b+16,d.notifyUpdateNamedDests,"i8*");Module.setValue(b+20,d.notifyUpdateThumb,"i8*");Module.setValue(b+24,d.notifyFinishedDownload,"i8*");Module.setValue(b+28,d.notifyDocumentError,
"i8*");Module.setValue(b+32,d.getCurrentPage,"i8*");Module.setValue(b+36,0,"i8*");return b};a.CreateDocDownloaderBackend=function(a,b,c){var k=a.url,d=a.size,e=a.customHeaders;e&&(Module.customHeadersMap[c]=e);var h;h=a.downloadData?new p(a.downloadData,k,c,e):new p(a.size,k,c,e);var g=Module.createCallbacksStruct(h.downloadUserData),l=Module.allocate(4,"i8",Module.ALLOC_STACK);Module.MakeDev(c);a.chunkStorage?k=new m(a.chunkStorage):(a=new Int8Array(new ArrayBuffer(Math.ceil((a.size+524288-1)/524288/
8))),k=new m(k,d,e,a));Module.docs[c]={chunkStorage:k};REX(Module._TRN_DownloaderCreate(g,d,Module.GetUStringFromJSString(c),l));h.downloader=Module.getValue(l,"i8*");if(d=Module._TRN_PDFDocCreateFromFilter(h.downloader,b))Module._TRN_FilterDestroy(h.downloader),REX(d);b=Module.getValue(b,"i8*");Module.docs[c].ptr=b;Module.PDFDocInitSecurityHandler(b)&&REX(Module._TRN_PDFDocDownloaderInitialize(b,h.downloader));downloadDataMap[b]=h};a.CreateDocBackend=function(f,b){var c=f.value,k=f.extension,d=f.type,
e=Module.allocate(4,"i8",Module.ALLOC_STACK),h=Module.stackSave();try{if(c)if("ptr"===d)Module.docs[b]={ptr:c};else{var l,d=k&&"pdf"!==k;if("object"===typeof c&&c.url)a.CreateDocDownloaderBackend(c,e,b);else{var v=c instanceof ArrayBuffer,m=v?"buffer":"file";if(v&&(c=new Uint8Array(c),10485760>c.length+g&&!d)){g+=c.length;var n=c.length,u=Module._malloc(c.length);Module.HEAPU8.set(c,u);REX(Module._TRN_PDFDocCreateFromBuffer(u,n,e));l=Module.getValue(e,"i8*");Module.docs[b]={ptr:l,bufPtr:u,bufPtrSize:n,
ownership:!0};Module.docs[b].extension=k;return}Module.MakeDev(b);v={};v[m]=c;Module.docs[b]=v;if(d){var p;f.pageSizes&&f.pageSizes.length?p=f.pageSizes[0]:f.defaultPageSize&&(p=f.defaultPageSize);var q=Module.GetUStringFromJSString(b);REX(Module._TRN_PDFDocCreate(e));l=Module.getValue(e,"i8*");var t=Module.ImageCreateFromFile(l,q);Module.InsertImageIntoDoc(l,t,p)}else{var E=Module.allocate(Module.intArrayFromString(b),"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocCreateFromFilePath(E,e));l=Module.getValue(e,
"i8*")}Module.docs[b].extension=k;Module.docs[b].ptr=l}}else REX(Module._TRN_PDFDocCreate(e)),l=Module.getValue(e,"i8*"),Module.docs[b]={ptr:l},Module.docs[b].extension=k}finally{Module.stackRestore(h)}};a.ChangeDocBackend=function(f,b){var c=Module.docs[f];c?(c.bufPtr&&c.ownership&&(Module._free(c.bufPtr),g-=c.bufPtrSize),delete Module.docs[f]):a.utils.warn("Trying to delete document "+f+" that does not exist.");Module.docs[f]=b};a.DeleteDoc=function(f){var b=Module.docs[f];b?(b.ptr&&(b.ptr in downloadDataMap&&
(clearTimeout(downloadDataMap[b.ptr].timeout),downloadDataMap[b.ptr].destroyUserData(),delete downloadDataMap[b.ptr]),Module.PDFDocDestroy(b.ptr)),b.bufPtr&&b.ownership&&(Module._free(b.bufPtr),g-=b.bufPtrSize),delete Module.docs[f]):a.utils.warn("Trying to delete document "+f+" that does not exist.")};a.CreateDoc=function(f,b){if("id"===f.type)return Module.docPtrStringToIdMap[f.value];if(!b){do b=(++l).toString();while(b in Module.docs)}Module.hasBufOwnership=!0;a.CreateDocBackend(f,b);return b};
a.CreateEmptyDoc=function(){var a=(++l).toString(),b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocCreate(b));b=Module.getValue(b,"i8*");Module.docs[a]={ptr:b};return a};a.PDFDocCreateFromLayoutEls=function(a){var b=new Uint8Array(a);a=Module._malloc(b.length);var c=Module.stackSave(),k=Module.allocate(4,"i8",Module.ALLOC_STACK);Module.HEAPU8.set(b,a);b=Module._TRN_PDFDocCreateFromLayoutEls(a,b.length,k);k=Module.getValue(k,"i8*");Module._free(a);Module.stackRestore(c);REX(b);return k};
a.GetPageCount=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocGetPageCount(a,b));return Module.getValue(b,"i8*")};a.GetPage=function(a,b){var c=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocGetPage(a,b,c));c=Module.getValue(c,"i8*");Module.PageIsValid(c)||THROW("Trying to access page that doesn't exist at index "+b);return c};a.PageGetPageWidth=function(a){var b=Module.allocate(8,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageGetPageWidth(a,1,b));
return Module.getValue(b,"double")};a.PageGetPageHeight=function(a){var b=Module.allocate(8,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageGetPageHeight(a,1,b));return Module.getValue(b,"double")};a.PageGetDefaultMatrix=function(a,b){var c=Module.allocate(48,"i8",Module.ALLOC_STACK);b||(b=0);REX(Module._TRN_PageGetDefaultMatrix(a,!0,1,b,c));return c};a.GetMatrixAsArray=function(a){for(var b=[],c=0;6>c;++c)b[c]=Module.getValue(a+8*c,"double");return b};a.PageGetPageInfo=function(a){var b=Module.allocate(48,
"i8",Module.ALLOC_STACK),c=Module.allocate(8,"i8",Module.ALLOC_STACK),k=Module.allocate(8,"i8",Module.ALLOC_STACK),d=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageGetPageInfo(a,!0,1,0,c,k,b,d));return{rotation:Module.getValue(d,"i8*"),width:Module.getValue(c,"double"),height:Module.getValue(k,"double"),matrix:Module.GetMatrixAsArray(b)}};a.GetUStringFromJSString=function(a,b){var c=Module.allocate(4,"i8",Module.ALLOC_STACK),k=2*(a.length+1),d=Module.allocate(k,"i8",b?Module.ALLOC_NORMAL:
Module.ALLOC_STACK);Module.stringToUTF16(a,d,k);k=Module._TRN_UStringCreateFromString(d,c);b&&Module._free(d);REX(k);return Module.getValue(c,"i8*")};a.GetJSStringFromUString=function(a){var b=Module.allocate(4,"i16*",Module.ALLOC_STACK);REX(Module._TRN_UStringCStr(a,b));return Module.UTF16ToString(Module.getValue(b,"i16*"))};a.GetJSStringFromCString=function(a){return Module.UTF8ToString(a)};a.PDFNetSetResourceData=function(a){Module.res_ptr=Module._malloc(a.length);Module.HEAPU8.set(a,Module.res_ptr);
REX(Module._TRN_PDFNetSetResourceData(Module.res_ptr,a.length));Module.res_ptr_size=a.length};a.PDFDocDestroy=function(a){REX(Module._TRN_PDFDocDestroy(a))};a.VectorGetSize=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_VectorGetSize(a,b));return Module.getValue(b,"i32")};a.VectorGetAt=function(a,b){var c=Module.allocate(1,"i8*",Module.ALLOC_STACK);REX(Module._TRN_VectorGetAt(a,b,c));return Module.getValue(c,"i8*")};a.VectorDestroy=function(a){REX(Module._TRN_VectorDestroy(a))};
a.PDFRasterizerCreate=function(){var a=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFRasterizerCreate(0,a));return Module.getValue(a,"i8*")};a.ExtractSeparationData=function(a){var b=Module.getValue(a,"i8*"),c=Module.getValue(a+4,"i32"),k=Module.getValue(a+8,"i8*"),d=Module.HEAPU8[a+12],e=Module.HEAPU8[a+13],h=Module.HEAPU8[a+14];a=Module.HEAPU8[a+15];var g=new Uint8Array(c);g.set(Module.HEAPU8.subarray(b,b+c));b=Module.GetJSStringFromUString(k);return{color:[d,e,h,a],data:g.buffer,
name:b}};a.PDFRasterizerRasterizeSeparations=function(a,b,c,k,d,e,h){var g=Module.allocate(8,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFRasterizerRasterizeSeparations(a,b,c,k,d,e,h,g));a=Module.VectorGetSize(g);b=Array(a);for(c=0;c<a;++c)k=Module.VectorGetAt(g,c),b[c]=Module.ExtractSeparationData(k);Module.VectorDestroy(g);return b};a.PageGetRotation=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageGetRotation(a,b));return Module.getValue(b,"i8*")};a.PageGetId=function(a){var b=
Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageGetSDFObj(a,b));b=Module.getValue(b,"i8*");a=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ObjGetObjNum(b,a));a=Module.getValue(a,"i32");var c=Module.allocate(2,"i8",Module.ALLOC_STACK);REX(Module._TRN_ObjGetGenNum(b,c));c=Module.getValue(c,"i16");return a+"-"+c};a.PageSetRotation=function(a,b){REX(Module._TRN_PageSetRotation(a,b))};a.GetDefaultMatrixBox=function(a,b,c){var k=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageGetRotation(a,
k));a=(Module.getValue(k,"i32")+c)%4;c=Module.allocate(48,"i8",Module.ALLOC_STACK);switch(a){case 0:return REX(Module._TRN_Matrix2DSet(c,1,0,0,-1,-b.x1,b.y2)),c;case 1:return REX(Module._TRN_Matrix2DSet(c,0,1,1,0,-b.y1,-b.x1)),c;case 2:return REX(Module._TRN_Matrix2DSet(c,-1,0,0,1,b.x2,-b.y1)),c;case 3:return REX(Module._TRN_Matrix2DSet(c,0,-1,-1,0,b.y2,b.x2)),c}throw Error("Yikes, we don't support that rotation type");};a.Matrix2DMultBBox=function(a,b){var c=Module.allocate(8,"i8",Module.ALLOC_STACK),
k=Module.allocate(8,"i8",Module.ALLOC_STACK);Module.setValue(c,b.x1,"double");Module.setValue(k,b.y1,"double");REX(Module._TRN_Matrix2DMult(a,c,k));b.x1=Module.getValue(c,"double");b.y1=Module.getValue(k,"double");Module.setValue(c,b.x2,"double");Module.setValue(k,b.y2,"double");REX(Module._TRN_Matrix2DMult(a,c,k));b.x2=Module.getValue(c,"double");b.y2=Module.getValue(k,"double");return b};a.Matrix2DMult=function(a,b){var c=Module.allocate(8,"i8",Module.ALLOC_STACK),k=Module.allocate(8,"i8",Module.ALLOC_STACK);
Module.setValue(c,b.x,"double");Module.setValue(k,b.y,"double");REX(Module._TRN_Matrix2DMult(a,c,k));b.x=Module.getValue(c,"double");b.y=Module.getValue(k,"double");return b};a.Matrix2DConcat=function(a,b){var c=Module.getValue(b,"double"),k=Module.getValue(b+8,"double"),d=Module.getValue(b+16,"double"),e=Module.getValue(b+24,"double"),h=Module.getValue(b+32,"double"),g=Module.getValue(b+40,"double");REX(Module._TRN_Matrix2DConcat(a,c,k,d,e,h,g))};a.Matrix2DSet=function(a,b,c,k,d,e,h){REX(Module._TRN_Matrix2DSet(a,
b,c,k,d,e,h))};a.IteratorHasNext=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_IteratorHasNext(a,b));return 0!==Module.getValue(b,"i8")};a.IteratorCurrent=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_IteratorCurrent(a,b));return Module.getValue(Module.getValue(b,"i8*"),"i8*")};a.IteratorNext=function(a){REX(Module._TRN_IteratorNext(a))};a.PageGetNumAnnots=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageGetNumAnnots(a,
b));return Module.getValue(b,"i32")};a.PageGetAnnot=function(a,b){var c=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageGetAnnot(a,b,c));return Module.getValue(c,"i8*")};a.PageAnnotRemove=function(a,b){REX(Module._TRN_PageAnnotRemoveByIndex(a,b))};a.AnnotGetType=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_AnnotGetType(a,b));return Module.getValue(b,"i32")};a.AnnotHasAppearance=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_AnnotGetAppearance(a,
0,0,b));return 0!==Module.getValue(b,"i8*")};a.AnnotRefreshAppearance=function(a){REX(Module._TRN_AnnotRefreshAppearance(a))};a.ObjErase=function(a,b){var c=Module.allocate(Module.intArrayFromString(b),"i8",Module.ALLOC_STACK);REX(Module._TRN_ObjEraseFromKey(a,c))};a.GetJSDoubleArrFromCore=function(a,b){for(var c=Array(b),k=a,d=0;d<b;++d)c[d]=Module.getValue(k,"double"),k+=8;return c};a.GetJSIntArrayFromCore=function(a,b){for(var c=Array(b),k=a,d=0;d<b;++d)c[d]=Module.getValue(k,"i32"),k+=4;return c};
a.BookmarkIsValid=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_BookmarkIsValid(a,b));return 0!==Module.getValue(b,"i8")};a.BookmarkGetNext=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_BookmarkGetNext(a,b));return Module.getValue(b,"i8*")};a.BookmarkGetFirstChild=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_BookmarkGetFirstChild(a,b));return Module.getValue(b,"i8*")};a.BookmarkHasChildren=function(a){var b=
Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_BookmarkHasChildren(a,b));return 0!==Module.getValue(b,"i8")};a.BookmarkGetAction=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_BookmarkGetAction(a,b));return Module.getValue(b,"i8*")};a.BookmarkGetTitle=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_BookmarkGetTitle(a,b));a=Module.getValue(b,"i8*");return Module.GetJSStringFromUString(a)};a.ActionIsValid=function(a){var b=Module.allocate(4,
"i8",Module.ALLOC_STACK);REX(Module._TRN_ActionIsValid(a,b));return 0!==Module.getValue(b,"i8")};a.ActionGetType=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ActionGetType(a,b));return Module.getValue(b,"i32")};a.ActionGetDest=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ActionGetDest(a,b));return Module.getValue(b,"i8*")};a.DestinationIsValid=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_DestinationIsValid(a,
b));return 0!==Module.getValue(b,"i8")};a.DestinationGetPage=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_DestinationGetPage(a,b));return Module.getValue(b,"i8*")};a.PageIsValid=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageIsValid(a,b));return 0!==Module.getValue(b,"i8")};a.PageGetIndex=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageGetIndex(a,b));return Module.getValue(b,"i32")};a.ObjGetAsPDFText=
function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ObjGetAsPDFText(a,b));a=Module.getValue(b,"i8*");return Module.GetJSStringFromUString(a)};a.ObjFindObj=function(a,b){var c=Module.allocate(4,"i8",Module.ALLOC_STACK),k=Module.allocate(Module.intArrayFromString(b),"i8",Module.ALLOC_STACK);REX(Module._TRN_ObjFindObj(a,k,c));return Module.getValue(c,"i8*")};a.PDFDocGetFirstBookmark=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocGetFirstBookmark(a,
b));return Module.getValue(b,"i8*")};a.DestinationGetExplicitDestObj=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_DestinationGetExplicitDestObj(a,b));return Module.getValue(b,"i8*")};a.DestinationGetFitType=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_DestinationGetFitType(a,b));return Module.getValue(b,"i32")};a.ObjIsNumber=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ObjIsNumber(a,b));return 0!==Module.getValue(b,
"i8")};a.ObjGetNumber=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ObjGetNumber(a,b));return Module.getValue(b,"double")};a.PDFDocGetRoot=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocGetRoot(a,b));return Module.getValue(b,"i8*")};a.ObjPutName=function(a,b,c){b=Module.allocate(Module.intArrayFromString(b),"i8",Module.ALLOC_STACK);c=Module.allocate(Module.intArrayFromString(c),"i8",Module.ALLOC_STACK);var k=Module.allocate(4,"i8",
Module.ALLOC_STACK);REX(Module._TRN_ObjPutName(a,b,c,k));return Module.getValue(k,"i8*")};a.ObjPutDict=function(a,b){var c=Module.allocate(Module.intArrayFromString(b),"i8",Module.ALLOC_STACK),k=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ObjPutDict(a,c,k));return Module.getValue(k,"i8*")};a.ObjPutString=function(a,b,c){b=Module.allocate(Module.intArrayFromString(b),"i8",Module.ALLOC_STACK);c=Module.allocate(Module.intArrayFromString(c),"i8",Module.ALLOC_STACK);var k=Module.allocate(4,
"i8",Module.ALLOC_STACK);REX(Module._TRN_ObjPutString(a,b,c,k));return Module.getValue(k,"i8*")};a.ObjPut=function(a,b,c){b=Module.allocate(Module.intArrayFromString(b),"i8",Module.ALLOC_STACK);var k=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ObjPut(a,b,c,k));return Module.getValue(k,"i8*")};a.ObjGetAt=function(a,b){var c=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ObjGetAt(a,b,c));return Module.getValue(c,"i8*")};a.Matrix2DInverse=function(a){var b=Module.allocate(48,
"i8",Module.ALLOC_STACK);REX(Module._TRN_Matrix2DInverse(a,b));return b};a.PDFDocInitSecurityHandler=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocInitSecurityHandler(a,0,b));return 0!==Module.getValue(b,"i8")};a.PDFDocInitStdSecurityHandler=function(a,b){var c=Module.allocate(4,"i8",Module.ALLOC_STACK),k=Module.intArrayFromString(b),d=Module.allocate(k,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocInitStdSecurityHandler(a,d,k.length-1,c));return 0!==Module.getValue(c,
"i8")};a.PDFDocInsertPages=function(a,b,c,k,d){REX(Module._TRN_PDFDocInsertPageSet(a,b,c,k,d?1:0,0))};a.PDFDocMovePages=function(a,b,c){REX(Module._TRN_PDFDocMovePageSet(a,b,a,c,0,0))};a.PDFDocGetPageIterator=function(a,b){var c=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocGetPageIterator(a,b,c));return Module.getValue(c,"i8*")};a.PDFDocPageRemove=function(a,b){REX(Module._TRN_PDFDocPageRemove(a,b))};a.PDFDocPageCreate=function(a,b,c){var k=Module.allocate(40,"i8",Module.ALLOC_STACK);
Module.setValue(k,0,"double");Module.setValue(k+8,0,"double");Module.setValue(k+16,b,"double");Module.setValue(k+24,c,"double");Module.setValue(k+32,0,"double");b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocPageCreate(a,k,b));return Module.getValue(b,"i8*")};a.PDFDocPageInsert=function(a,b,c){REX(Module._TRN_PDFDocPageInsert(a,b,c))};a.PageSetCreate=function(){var a=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageSetCreate(a));return Module.getValue(a,"i8*")};a.PageSetCreateRange=
function(a,b){var c=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PageSetCreateRange(c,a,b));return Module.getValue(c,"i8*")};a.PageSetAddPage=function(a,b){REX(Module._TRN_PageSetAddPage(a,b))};a.ElementBuilderCreate=function(){var a=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ElementBuilderCreate(a));return Module.getValue(a,"i8*")};a.ElementBuilderDestroy=function(a){REX(Module._TRN_ElementBuilderDestroy(a))};a.ElementBuilderCreateImage=function(a,b,c,k,d,e){var h=Module.allocate(4,
"i8",Module.ALLOC_STACK);REX(Module._TRN_ElementBuilderCreateImageScaled(a,b,c,k,d,e,h));return Module.getValue(h,"i8*")};a.ElementWriterCreate=function(){var a=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ElementWriterCreate(a));return Module.getValue(a,"i8*")};a.ElementWriterDestroy=function(a){REX(Module._TRN_ElementWriterDestroy(a))};a.ElementWriterBegin=function(a,b){REX(Module._TRN_ElementWriterBeginOnPage(a,b,1))};a.ElementWriterWritePlacedElement=function(a,b){REX(Module._TRN_ElementWriterWritePlacedElement(a,
b))};a.ElementWriterEnd=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ElementWriterEnd(a,b))};a.ImageGetImageWidth=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ImageGetImageWidth(a,b));return Module.getValue(b,"i32")};a.ImageGetImageHeight=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ImageGetImageHeight(a,b));return Module.getValue(b,"i32")};a.ImageCreateFromMemory2=function(a,b,c){var k=Module.allocate(4,
"i8",Module.ALLOC_STACK);REX(Module._TRN_ImageCreateFromMemory2(a,b,c,0,k));return Module.getValue(k,"i8*")};a.ImageCreateFromFile=function(a,b){var c=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_ImageCreateFromFile(a,b,0,c));return Module.getValue(c,"i8*")};a.PDFDocPagePushBack=function(a,b){REX(Module._TRN_PDFDocPagePushBack(a,b))};a.PDFDocHasOC=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocHasOC(a,b));return 0!==Module.getValue(b,"i8")};a.PDFDocGetOCGConfig=
function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_PDFDocGetOCGConfig(a,b));return Module.getValue(b,"i8*")};a.OCGContextCreate=function(a){var b=Module.allocate(4,"i8",Module.ALLOC_STACK);REX(Module._TRN_OCGContextCreateFromConfig(a,b));return Module.getValue(b,"i8*")};a.UStringDestroy=function(a){REX(Module._TRN_UStringDestroy(a))};a.FDFDocDestroy=function(a){REX(Module._TRN_FDFDocDestroy(a))}})(global.Module);!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var g;"undefined"!=typeof window?g=window:"undefined"!=typeof global?g=global:"undefined"!=typeof self&&(g=self);g.PriorityQueue=a()}}(function(){return function g(l,c,d){function e(m,u){if(!c[m]){if(!l[m]){var q="function"==typeof require&&require;if(!u&&q)return q(m,!0);if(h)return h(m,!0);q=Error("Cannot find module '"+m+"'");throw q.code="MODULE_NOT_FOUND",
q;}q=c[m]={exports:{}};l[m][0].call(q.exports,function(c){var d=l[m][1][c];return e(d?d:c)},q,q.exports,g,l,c,d)}return c[m].exports}for(var h="function"==typeof require&&require,u=0;u<d.length;u++)e(d[u]);return e}({1:[function(g,l,c){var d={}.hasOwnProperty,e=function(c,e){function g(){this.constructor=c}for(var l in e)d.call(e,l)&&(c[l]=e[l]);g.prototype=e.prototype;c.prototype=new g;c.__super__=e.prototype;return c};c=g("./PriorityQueue/AbstractPriorityQueue");g=g("./PriorityQueue/ArrayStrategy");
c=function(c){function d(c){c||(c={});c.strategy||(c.strategy=BinaryHeapStrategy);c.comparator||(c.comparator=function(c,d){return(c||0)-(d||0)});d.__super__.constructor.call(this,c)}e(d,c);return d}(c);c.ArrayStrategy=g;l.exports=c},{"./PriorityQueue/AbstractPriorityQueue":2,"./PriorityQueue/ArrayStrategy":3}],2:[function(g,l,c){l.exports=function(){function c(d){if(null==(null!=d?d.strategy:void 0))throw"Must pass options.strategy, a strategy";if(null==(null!=d?d.comparator:void 0))throw"Must pass options.comparator, a comparator";
this.priv=new d.strategy(d);this.length=0}c.prototype.queue=function(c){this.length++;this.priv.queue(c)};c.prototype.dequeue=function(c){if(!this.length)throw"Empty queue";this.length--;return this.priv.dequeue()};c.prototype.peek=function(c){if(!this.length)throw"Empty queue";return this.priv.peek()};c.prototype.remove=function(c){this.priv.remove(c)&&--this.length};c.prototype.find=function(c){return 0<=this.priv.find(c)};c.prototype.removeAllMatching=function(c,d){var g=this.priv.removeAllMatching(c,
d);this.length-=g};return c}()},{}],3:[function(g,l,c){var d;d=function(c,d,g){var l,t,q;t=0;for(l=c.length;t<l;)q=t+l>>>1,0<=g(c[q],d)?t=q+1:l=q;return t};l.exports=function(){function c(d){var e;this.options=d;this.comparator=this.options.comparator;this.data=(null!=(e=this.options.initialValues)?e.slice(0):void 0)||[];this.data.sort(this.comparator).reverse()}c.prototype.queue=function(c){var e;e=d(this.data,c,this.comparator);this.data.splice(e,0,c)};c.prototype.dequeue=function(){return this.data.pop()};
c.prototype.peek=function(){return this.data[this.data.length-1]};c.prototype.find=function(c){var e=d(this.data,c,this.comparator)-1;return 0<=e&&!this.comparator(this.data[e],c)?e:-1};c.prototype.remove=function(c){c=this.find(c);return 0<=c?(this.data.splice(c,1),!0):!1};c.prototype.removeAllMatching=function(c,d){for(var e=0,g=this.data.length-1;0<=g;--g)if(c(this.data[g])){var l=this.data.splice(g,1)[0];d&&d(l);++e}return e};return c}()},{}]},{},[1])(1)});(function(a){a.SetupPDFNetFunctions=function(g){Module._IB_=[];for(var l=function(a){if("object"===typeof a&&null!==a)if("undefined"!==typeof a.byteLength){var c=Module._IB_.length;Module._IB_[c]=new Uint8Array(a);a={handle:c,isArrayBufferRef:!0}}else for(prop in a)a.hasOwnProperty(prop)&&(a[prop]=l(a[prop]));return a},c=function(a){if("object"===typeof a&&null!==a)if(a.buffer)a=a.buffer.slice(a.byteOffset,a.byteOffset+a.length);else if(a.isArrayBufferRef)a=Module._IB_[a.handle].buffer;else for(prop in a)a.hasOwnProperty(prop)&&
(a[prop]=c(a[prop]));return a},d=Module._TRN_EMSCreateSharedWorkerInstance(),e,h=Module._TRN_EMSWorkerInstanceGetFunctionIterator(d),u=function(a,e){return new Promise(function(h,f){a=l(a);var b=a.docId,b=b?Module.GetDoc(b):0;(b=Module.EMSCallSharedFunction(d,e,b))?f({type:"InvalidPDF",message:Module.GetErrToString(b)}):(b=Module.EMSGetLastResponse(d),b=c(b),h(b))})};e=Module._TRN_EMSFunctionIteratorGetNextCommandName(h);)e=Module.GetJSStringFromCString(e),a.queue.onAsync(e,u);Module._TRN_EMSFunctionIteratorDestroy(h);
if(Module._TRN_EMSCreatePDFNetWorkerInstance){var m={},h=function(a,c){g.on(a,c);m[a]=!0};Module.docPtrStringToIdMap={};var t=function(a){if(a in Module.docPtrStringToIdMap)return Module.docPtrStringToIdMap[a];throw Error("Couldn't find document "+a);};a.queue.onAsync("PDFDoc.RequirePage",function(a,c){return Module.RequirePage(t(a.docId),a.pageNum)});h("pdfDocCreateFromBuffer",function(a){a=Module.CreateDoc({type:"array",value:a.buf});var c=Module.GetDoc(a).toString(16);Module.docPtrStringToIdMap[c]=
a;return c});h("PDFDoc.destroy",function(a){a=t(a.auto_dealloc_obj);Module.DeleteDoc(a)});h("PDFDoc.saveMemoryBuffer",function(a){var c=t(a.doc);return Module.SaveHelper(Module.GetDoc(c),c,a.flags).slice(0)});h("pdfDocCreate",function(a){a=Module.CreateDoc({type:"new"});var c=Module.GetDoc(a).toString(16);Module.docPtrStringToIdMap[c]=a;return c});h("GetPDFDoc",function(a){a=a.docId;var c=Module.GetDoc(a).toString(16);Module.docPtrStringToIdMap[c]=a;return c});h("ExtractPDFNetLayersContext",function(a){var c=
a.layers;a=Module.GetDoc(a.docId);var d=0;c?d=Module.EMSCreateUpdatedLayersContext(a,c):Module.PDFDocHasOC(a)&&(c=Module.PDFDocGetOCGConfig(a),d=Module.OCGContextCreate(c));return d.toString(16)});for(var q=Module._TRN_EMSCreatePDFNetWorkerInstance(),h=Module._TRN_EMSWorkerInstanceGetFunctionIterator(q),u=function(a){return new Promise(function(d,e){a=l(a);var f=Module.EMSCallPDFNetFunction(q,a);f?e(Module.GetErrToString(f)):(f=Module.EMSGetLastResponse(q),f=c(f),d(f))})};e=Module._TRN_EMSFunctionIteratorGetNextCommandName(h);)if(e=
Module.GetJSStringFromCString(e),!m[e])g.onAsync(e,u);Module._TRN_EMSFunctionIteratorDestroy(h)}}})("undefined"===typeof self?this:self);(function(a){function g(a){return new Promise(function(d,e){var h=indexedDB.open("wasm-cache",a);h.onerror=e.bind(null,"Error opening wasm cache database");h.onsuccess=function(){d(h.result)};h.onupgradeneeded=function(a){var c=h.result;c.objectStoreNames.contains("wasm-cache")&&(console.log("Clearing out version "+a.oldVersion+" wasm cache"),c.deleteObjectStore("wasm-cache"));console.log("Creating version "+a.newVersion+" wasm cache");c.createObjectStore("wasm-cache")}})}function l(a,d){return new Promise(function(e,
h){var g=a.transaction(["wasm-cache"]).objectStore("wasm-cache").get(d);g.onsuccess=function(a){g.result?e(g.result):h("Module "+d+" was not found in wasm cache")};g.onerror=h.bind(null,"Error getting wasm module "+d)})}a.isWasmCached=function(a,d){return g(a).then(function(a){return l(a,d).then(function(){return!0})})["catch"](function(){return!1})};a.instantiateCachedURL=function(c,d,e,h){function u(a,c){var e=a.transaction(["wasm-cache"],"readwrite").objectStore("wasm-cache").put(c,d);e.onerror=
function(a){console.log("Failed to store in wasm cache: "+a)};e.onsuccess=function(a){console.log("Successfully stored "+d+" in wasm cache")}}function m(c){t=t||Date.now();return c?fetch(a.getBrotliUrl(d)).then(function(a){return WebAssembly.instantiateStreaming(a,e)})["catch"](function(a){return m(!1)}):a.loadURLWithBrotliPriority(d,h,!0,!0).then(function(a){Date.now();return WebAssembly.instantiate(a,e)})}var t;return g(c).then(function(a){return l(a,d).then(function(a){return WebAssembly.instantiate(a,
e)},function(c){return m(!!WebAssembly.instantiateStreaming).then(function(c){try{u(a,c.module)}catch(d){}return c.instance})})},function(a){console.log(a);return m().then(function(a){return a.instance})})}})(this);(function(a){function g(a,b){return fetch(a).then(function(a){console.log("Pos 1");if(200!==a.status)throw Error("Response failed with code "+a.status);console.log("Pos 2");console.log(a);console.log("Pos 2a");var c=!1,k=new ReadableStream({start:function(k){function d(){if(!c)return console.log("Pos 4"),f.read().then(function(a){c=a.done;a=a.value;c?(console.log("Done"),(a=b.End())?k.enqueue(a):k.close()):(a=b.GetNextChunk(a),console.log("Enqueue"),a&&k.enqueue(a))}).then(d)}console.log("Pos 3");
var e=a.body;console.log("Pos 3z"+e);var f=e.getReader();d()}});console.log("Pos 2b");return new Response(k,{headers:{"content-type":"application/wasm"}})})}var l=function(a){if("string"===typeof a){for(var b=new Uint8Array(a.length),c=a.length,d=0;d<c;d++)b[d]=a.charCodeAt(d);return b}return a},c=function(a){if("string"!==typeof a){for(var b="",c=0,d=a.length,e;c<d;)e=a.subarray(c,c+1024),c+=1024,b+=String.fromCharCode.apply(null,e);return b}return a},d=!1,e=function(b,e){d||(importScripts(a.basePath+
"external/decode.min.js"),d=!0);var f=self.BrotliDecode(l(b));return e?f:c(f)},h=function(){this.remainingDataArrays=[]};h.prototype={processRaw:function(a){return a},processBrotli:function(a){this.remainingDataArrays.push(a);return null},GetNextChunk:function(a){this.decodeFunction||(this.decodeFunction=0===a[0]&&97===a[1]&&115===a[2]&&109===a[3]?this.processRaw:this.processBrotli);return this.decodeFunction(a)},End:function(){if(this.remainingDataArrays.length){for(var a=this.arrays,b=0,c=0;c<a.length;++c)b+=
a[c].length;for(var b=new Uint8Array(b),d=0,c=0;c<a.length;++c){var f=a[c];b.set(f,d);d+=f.length}return e(b,!0)}return null}};var u=!1,m=function(b,d){u||(importScripts(a.basePath+"external/rawinflate.js",a.basePath+"external/pako_inflate.min.js"),u=!0);var e=10;if("string"===typeof b){if(b.charCodeAt(3)&8){for(;0!==b.charCodeAt(e);++e);++e}}else if(b[3]&8){for(;0!==b[e];++e);++e}if(d)return b=l(b),b=b.subarray(e,b.length-8),a.pako.inflate(b,{windowBits:-15});b=c(b);b=b.substring(e,b.length-8);return a.RawDeflate.inflate(b)},
t=function(a,b){return b?a:c(a)},q=function(a){var b=!a.shouldOutputArray,d=new XMLHttpRequest;d.open("GET",a.url,a.isAsync);var e=b&&d.overrideMimeType;d.responseType=e?"text":"arraybuffer";e&&d.overrideMimeType("text/plain; charset=x-user-defined");d.send();var f=function(){Date.now();var f;f=e?d.responseText:new Uint8Array(d.response);f.length<a.compressedMaximum?(f=a.decompressFunction(f,a.shouldOutputArray),console.warn("There may be some degradation of performance. Your server has not been configured to serve .gz. and .br. files with the expected Content-Encoding. See http://www.pdftron.com/kb_content_encoding for instructions on how to resolve this.")):
b&&(f=c(f));return f},h;if(a.isAsync)h=new Promise(function(b,c){d.onload=function(){200===this.status?b(f()):c("Download Failed "+a.url)};d.onerror=function(){c("Network error occurred "+a.url)}});else{if(200===d.status)return f();throw Error("Failed to load "+a.url);}return h},v=function(a){var b=a.lastIndexOf("/");-1===b&&(b=0);var c=a.slice(b).replace(".",".br.");return a.slice(0,b)+c},n=function(a,b){var c=a.lastIndexOf("/");-1===c&&(c=0);var d=a.slice(c).replace(".",".gz.");b.url=a.slice(0,
c)+d;b.decompressFunction=m;return q(b)},p=function(a,b){b.url=v(a);b.decompressFunction=e;return q(b)},f=function(a,b){b.url=a;b.decompressFunction=t;return q(b)},b=function(a,b,c,d){return a["catch"](function(a){console.warn(a);return d(b,c)})},r=function(a,c,d){var e;if(d.isAsync){var f=c[0](a,d);for(e=1;e<c.length;++e)f=b(f,a,d,c[e]);return f}for(e=0;e<c.length;++e)try{return c[e](a,d)}catch(h){console.warn(h.message)}throw Error("");};a.getBrotliUrl=v;a.loadURLWithBrotliPriority=function(a,b,
c,d){var e={};e.compressedMaximum=b;e.isAsync=c;e.shouldOutputArray=d;return r(a,[p,n,f],e)};a.loadURLWithGzipPriority=function(a,b,c,d){var e={};e.compressedMaximum=b;e.isAsync=c;e.shouldOutputArray=d;return r(a,[n,p,f],e)};a.loadWasmBrotliStream=function(a){return g(a,new h)}})("undefined"===typeof window?this:window);(function(a){a.Uint8ClampedArray||(a.Uint8ClampedArray=a.Uint8Array);"undefined"===typeof a.crypto&&(a.crypto={getRandomValues:function(a){for(var c=0;c<a.length;c++)a[c]=256*Math.random()}});var g=!(!self.WebAssembly||!self.WebAssembly.validate),l=/^((?!chrome|android).)*safari/i.test(a.navigator.userAgent),c=/Mac OS X 10_13_6.*\(KHTML, like Gecko\)$/.test(a.navigator.userAgent),d=-1<a.navigator.userAgent.indexOf("Edge/16")||-1<a.navigator.userAgent.indexOf("MSAppHost"),e=function(a){var c=this;
this.promise=a.then(function(a){c.response=a;c.status=200})};e.prototype={addEventListener:function(a,c){this.promise.then(c)}};a.loadCompiledBackend=function(h,u,m){if(!g||m||d||l||c){m=loadURLWithGzipPriority((Module.asmjsPrefix?Module.asmjsPrefix:"")+h+".js.mem",u[".js.mem"],!1);var t=loadURLWithGzipPriority((Module.memoryInitializerPrefixURL?Module.memoryInitializerPrefixURL:"")+h+".mem",u[".mem"],!0,!0);Module.memoryInitializerRequest=new e(t)}else Module.instantiateWasm=function(c,d){return self.instantiateCachedURL(a.getWasmVersion(),
h+"Wasm.wasm",c,u["Wasm.wasm"]).then(function(a){d(a)})},m=loadURLWithBrotliPriority(h+"Wasm.js.mem",u["Wasm.js.mem"],!1,!1);eval.call(self,m)}})("undefined"===typeof window?this:window);(function(a){function g(a){var d={};decodeURIComponent(a.slice(1)).split("&").forEach(function(a){a=a.split("=",2);d[a[0]]=a[1]});return d}a.basePath="../";var l=function(){var c=a.pdfWorkerPath||"";a.workerBasePath&&(a.basePath=a.workerBasePath);var d=g(a.location.search),e="true"===d.isfull,h=e?"full/":"lean/";if(d.pdfWorkerPath){c=d.pdfWorkerPath;a.basePath="../";var d=!(!self.WebAssembly||!self.WebAssembly.validate),l=/^((?!chrome|android).)*safari/i.test(a.navigator.userAgent),m=/Mac OS X 10_13_6.*\(KHTML, like Gecko\)$/.test(a.navigator.userAgent);
if(!d||l||m)c=""}a.loadCompiledBackend(c+h+"PDFNetC",{"Wasm.wasm":4E6,"Wasm.js.mem":1E5,".js.mem":6E6,".mem":e?2E6:3E5})};self.shouldResize||l();a.EmscriptenPDFManager=function(){};a.EmscriptenPDFManager.prototype={OnInitialized:function(c){Module.loaded?c():(Module.initCb=function(){c()},a.utils.log("worker","PDFNet is not initialized yet!"))},NewDoc:function(a,d){return new Promise(function(e,h){try{e(Module.loadDoc(a,d))}catch(g){h(g)}})},Initialize:function(c,d,e,h){c&&(Module.TOTAL_MEMORY=c);
Module.memoryInitializerPrefixURL=d;Module.asmjsPrefix=e;a.basePath=h;l()},shouldRunRender:function(a){return Module.ShouldRunRender(a.docId,a.pageIndex+1)}};(function(c){function d(b){var c=b.data,d=b.action,e;e="GetCanvas"===d||"GetCanvasPartial"===d?l.shouldRunRender(c):!0;if(e){p=b;var f=b.asyncCallCapability;a.utils.log("Memory","Worker running command: "+d);t.actionMap[d](c,b).then(function(a){f.resolve(a)},function(a){f.reject(a)})}else a.deferredQueue.queue(b),g()}function e(a){a.asyncCallCapability=
createPromiseCapability();p?t.queue(a):d(a);return a.asyncCallCapability.promise}function h(b){self.shouldResize&&l.Initialize(b.options.workerHeapSize,b.options.pdfResourcePath,b.options.pdfAsmPath,b.options.parentUrl);Module.chunkMax=b.options.chunkMax;if(b.array instanceof Uint8Array){var d=255===b.array[0];c.postMessageTransfers=d;"response"in new XMLHttpRequest?l.OnInitialized(function(){a.SetupPDFNetFunctions(c);n();c.send("test",{supportTypedArray:!0,supportTransfers:d})}):c.send("test",!1)}else c.send("test",
!1)}function g(){setImmediate(function(){if(!p||"BeginOperation"!==p.action)if(t.length){if(!p||p.priority!==r){var a=t.dequeue();d(a)}}else p=null})}var l=new a.EmscriptenPDFManager,t,q=!1,v=!1;Module.workerMessageHandler=c;var n=function(){q?v||(c.send("workerLoaded",{}),v=!0):q=!0};l.OnInitialized(n);(function(){a.queue=t=new PriorityQueue({strategy:PriorityQueue.ArrayStrategy,comparator:function(a,b){return a.priority===b.priority?a.callbackId-b.callbackId:b.priority-a.priority}});a.deferredQueue=
new PriorityQueue({strategy:PriorityQueue.ArrayStrategy,comparator:function(a,b){return a.priority===b.priority?a.callbackId-b.callbackId:b.priority-a.priority}});t.actionMap={};t.onAsync=function(a,b){c.onAsync(a,e);t.actionMap[a]=b}})();var p=null;c.on("test",h);c.on("InitWorker",h);var f=function(a){p&&a(p)&&(Module.cancelCurrent(),p=null);t.removeAllMatching(a,function(a){a.asyncCallCapability.reject({type:"Cancelled",message:"Operation was cancelled due to document deletion."})})},b=function(a){f(function(b){return b.data&&
b.data.docId===a})};c.on("UpdatePassword",function(a){return Module.UpdatePassword(a.docId,a.password)});c.on("LoadRes",function(a){Module.loadResources(a.array,a.l);return{}});c.on("DownloaderHint",function(a){Module.DownloaderHint(a.docId,a.hint)});c.on("IsLinearized",function(a){return Module.IsLinearizationValid(a.docId)});c.onNextAsync(g);t.onAsync("NewDoc",function(a){return l.NewDoc(a)});t.onAsync("GetCanvas",function(b){a.utils.log("workerdetails","Run GetCanvas PageIdx: "+b.pageIndex+" Width: "+
b.width);a.utils.log("Memory","loadCanvas with potential memory usage "+b.width*b.height*8);return Module.loadCanvas(b.docId,b.pageIndex,b.width,b.height,b.rotation,null,b.layers,b.overprintMode)});t.onAsync("GetCanvasPartial",function(b){a.utils.log("Memory","GetCanvasPartial with potential memory usage "+b.width*b.height*8);return Module.loadCanvas(b.docId,b.pageIndex,b.width,b.height,b.rotation,b.bbox,b.layers,b.overprintMode)});t.onAsync("LoadText",function(a){return Module.GetTextData(a.docId,
a.pageIndex)});t.onAsync("SaveDoc",function(a){return Module.SaveDoc(a.docId,a.xfdfString,a.finishedWithDocument,a.printDocument,a.flags,a.watermarks)});t.onAsync("SaveDocFromFixedElements",function(a){return Module.SaveDocFromFixedElements(a.bytes,a.xfdfString,a.flags,a.watermarks)});t.onAsync("MergeXFDF",function(a){return Module.MergeXFDF(a.docId,a.xfdf)});t.onAsync("InsertPages",function(a){return Module.InsertPages(a.docId,a.doc,a.pageArray,a.destPos,a.insertBookmarks)});t.onAsync("MovePages",
function(a){return Module.MovePages(a.docId,a.pageArray,a.destPos)});t.onAsync("RemovePages",function(a){return Module.RemovePages(a.docId,a.pageArray)});t.onAsync("RotatePages",function(a){return Module.RotatePages(a.docId,a.pageArray,a.rotation)});t.onAsync("ExtractPages",function(a){return Module.ExtractPages(a.docId,a.pageArray,a.xfdfString,a.watermarks)});t.onAsync("CropPages",function(a){return Module.CropPages(a.docId,a.pageArray,a.topMargin,a.botMargin,a.leftMargin,a.rightMargin)});t.onAsync("InsertBlankPages",
function(a){return Module.InsertBlankPages(a.docId,a.pageArray,a.width,a.height)});t.onAsync("BeginOperation",function(){return Promise.resolve()});t.onAsync("RequirePage",function(a,b){return Module.RequirePage(a.docId,a.pageNum)});var r=99999;c.on("FinishOperation",function(){if("BeginOperation"===p.action)c.onNextAsync(g),Module.cancelCurrent(),p=null;else throw{message:"Operation has not started."};});c.on("DeleteDocument",function(a){a=a.docId;b(a);Module.DeleteDoc(a)});c.on("LoadBookmarks",
function(a){return Module.LoadBookmarks(a.docId)});c.on("GetCanvasProgressive",function(b){var c;if(p&&p.callbackId===b.callbackId)a.utils.log("worker","Progressive request in progress"),c=Module.GetCurrentCanvasData(!0);else{if(t.find({priority:0,callbackId:b.callbackId}))throw a.utils.log("worker","Progressive request Queued"),{type:"Queued",message:"Rendering has not started yet."};if(a.deferredQueue.find({priority:0,callbackId:b.callbackId}))throw a.utils.log("worker","Progressive request Deferred"),
{type:"Queued",message:"Rendering has not started yet."};}if(!c)throw a.utils.log("worker","Progressive request invalid (render already complete)"),{type:"Unavailable",message:"Rendering is complete or was cancelled."};return c});c.on("actionCancel",function(b){p&&p.callbackId===b.callbackId?(a.utils.log("workerdetails","Cancelled Current Operation"),Module.cancelCurrent()&&g()):(a.utils.log("workerdetails","Cancelled queued operation"),t.remove({priority:0,callbackId:b.callbackId}),a.deferredQueue.remove({priority:0,
callbackId:b.callbackId}))})})(new MessageHandler("worker_processor",self))})("undefined"===typeof window?this:window);
