@pdftron/webviewer
Version:
[WebViewer](https://www.apryse.com/webviewer) is a powerful JavaScript Document SDK and UI Component Library that is a part of the [Apryse PDF SDK](https://www.apryse.com). It provides a slick, out-of-the-box responsive UI that interacts with the core lib
45 lines (44 loc) • 21.4 kB
JavaScript
(function(){var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(h){var g=0;return function(){return g<h.length?{done:!1,value:h[g++]}:{done:!0}}};$jscomp.arrayIterator=function(h){return{next:$jscomp.arrayIteratorImpl(h)}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(h,g,k){if(h==Array.prototype||h==Object.prototype)return h;h[g]=k.value;return h};$jscomp.getGlobal=function(h){h=["object"==typeof globalThis&&globalThis,h,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var g=0;g<h.length;++g){var k=h[g];if(k&&k.Math==Math)return k}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(h,g,k){if(!k||null!=h){k=$jscomp.propertyToPolyfillSymbol[g];if(null==k)return h[g];k=h[k];return void 0!==k?k:h[g]}};
$jscomp.polyfill=function(h,g,k,l){g&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(h,g,k,l):$jscomp.polyfillUnisolated(h,g,k,l))};$jscomp.polyfillUnisolated=function(h,g,k,l){k=$jscomp.global;h=h.split(".");for(l=0;l<h.length-1;l++){var e=h[l];if(!(e in k))return;k=k[e]}h=h[h.length-1];l=k[h];g=g(l);g!=l&&null!=g&&$jscomp.defineProperty(k,h,{configurable:!0,writable:!0,value:g})};
$jscomp.polyfillIsolated=function(h,g,k,l){var e=h.split(".");h=1===e.length;l=e[0];l=!h&&l in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var q=0;q<e.length-1;q++){var c=e[q];if(!(c in l))return;l=l[c]}e=e[e.length-1];k=$jscomp.IS_SYMBOL_NATIVE&&"es6"===k?l[e]:null;g=g(k);null!=g&&(h?$jscomp.defineProperty($jscomp.polyfills,e,{configurable:!0,writable:!0,value:g}):g!==k&&(void 0===$jscomp.propertyToPolyfillSymbol[e]&&(k=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(e):$jscomp.POLYFILL_PREFIX+k+"$"+e),$jscomp.defineProperty(l,$jscomp.propertyToPolyfillSymbol[e],{configurable:!0,writable:!0,value:g})))};$jscomp.initSymbol=function(){};
$jscomp.polyfill("Symbol",function(h){if(h)return h;var g=function(q,c){this.$jscomp$symbol$id_=q;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:c})};g.prototype.toString=function(){return this.$jscomp$symbol$id_};var k="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",l=0,e=function(q){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new g(k+(q||"")+"_"+l++,q)};return e},"es6","es3");
$jscomp.polyfill("Symbol.iterator",function(h){if(h)return h;h=Symbol("Symbol.iterator");for(var g="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),k=0;k<g.length;k++){var l=$jscomp.global[g[k]];"function"===typeof l&&"function"!=typeof l.prototype[h]&&$jscomp.defineProperty(l.prototype,h,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}})}return h},"es6",
"es3");$jscomp.iteratorPrototype=function(h){h={next:h};h[Symbol.iterator]=function(){return this};return h};$jscomp.checkEs6ConformanceViaProxy=function(){try{var h={},g=Object.create(new $jscomp.global.Proxy(h,{get:function(k,l,e){return k==h&&"q"==l&&e==g}}));return!0===g.q}catch(k){return!1}};$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1;$jscomp.ES6_CONFORMANCE=$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&$jscomp.checkEs6ConformanceViaProxy();
$jscomp.makeIterator=function(h){var g="undefined"!=typeof Symbol&&Symbol.iterator&&h[Symbol.iterator];if(g)return g.call(h);if("number"==typeof h.length)return $jscomp.arrayIterator(h);throw Error(String(h)+" is not an iterable or ArrayLike");};$jscomp.owns=function(h,g){return Object.prototype.hasOwnProperty.call(h,g)};$jscomp.MapEntry=function(){};
$jscomp.assign=$jscomp.TRUST_ES6_POLYFILLS&&"function"==typeof Object.assign?Object.assign:function(h,g){for(var k=1;k<arguments.length;k++){var l=arguments[k];if(l)for(var e in l)$jscomp.owns(l,e)&&(h[e]=l[e])}return h};$jscomp.polyfill("Object.assign",function(h){return h||$jscomp.assign},"es6","es3");
$jscomp.polyfill("Promise",function(h){function g(){this.batch_=null}function k(c){return c instanceof e?c:new e(function(m,p){m(c)})}if(h&&(!($jscomp.FORCE_POLYFILL_PROMISE||$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION&&"undefined"===typeof $jscomp.global.PromiseRejectionEvent)||!$jscomp.global.Promise||-1===$jscomp.global.Promise.toString().indexOf("[native code]")))return h;g.prototype.asyncExecute=function(c){if(null==this.batch_){this.batch_=[];var m=this;this.asyncExecuteFunction(function(){m.executeBatch_()})}this.batch_.push(c)};
var l=$jscomp.global.setTimeout;g.prototype.asyncExecuteFunction=function(c){l(c,0)};g.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var c=this.batch_;this.batch_=[];for(var m=0;m<c.length;++m){var p=c[m];c[m]=null;try{p()}catch(u){this.asyncThrow_(u)}}}this.batch_=null};g.prototype.asyncThrow_=function(c){this.asyncExecuteFunction(function(){throw c;})};var e=function(c){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];this.isRejectionHandled_=!1;var m=this.createResolveAndReject_();
try{c(m.resolve,m.reject)}catch(p){m.reject(p)}};e.prototype.createResolveAndReject_=function(){function c(u){return function(v){p||(p=!0,u.call(m,v))}}var m=this,p=!1;return{resolve:c(this.resolveTo_),reject:c(this.reject_)}};e.prototype.resolveTo_=function(c){if(c===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(c instanceof e)this.settleSameAsPromise_(c);else{a:switch(typeof c){case "object":var m=null!=c;break a;case "function":m=!0;break a;default:m=!1}m?this.resolveToNonPromiseObj_(c):
this.fulfill_(c)}};e.prototype.resolveToNonPromiseObj_=function(c){var m=void 0;try{m=c.then}catch(p){this.reject_(p);return}"function"==typeof m?this.settleSameAsThenable_(m,c):this.fulfill_(c)};e.prototype.reject_=function(c){this.settle_(2,c)};e.prototype.fulfill_=function(c){this.settle_(1,c)};e.prototype.settle_=function(c,m){if(0!=this.state_)throw Error("Cannot settle("+c+", "+m+"): Promise already settled in state"+this.state_);this.state_=c;this.result_=m;2===this.state_&&this.scheduleUnhandledRejectionCheck_();
this.executeOnSettledCallbacks_()};e.prototype.scheduleUnhandledRejectionCheck_=function(){var c=this;l(function(){if(c.notifyUnhandledRejection_()){var m=$jscomp.global.console;"undefined"!==typeof m&&m.error(c.result_)}},1)};e.prototype.notifyUnhandledRejection_=function(){if(this.isRejectionHandled_)return!1;var c=$jscomp.global.CustomEvent,m=$jscomp.global.Event,p=$jscomp.global.dispatchEvent;if("undefined"===typeof p)return!0;"function"===typeof c?c=new c("unhandledrejection",{cancelable:!0}):
"function"===typeof m?c=new m("unhandledrejection",{cancelable:!0}):(c=$jscomp.global.document.createEvent("CustomEvent"),c.initCustomEvent("unhandledrejection",!1,!0,c));c.promise=this;c.reason=this.result_;return p(c)};e.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var c=0;c<this.onSettledCallbacks_.length;++c)q.asyncExecute(this.onSettledCallbacks_[c]);this.onSettledCallbacks_=null}};var q=new g;e.prototype.settleSameAsPromise_=function(c){var m=this.createResolveAndReject_();
c.callWhenSettled_(m.resolve,m.reject)};e.prototype.settleSameAsThenable_=function(c,m){var p=this.createResolveAndReject_();try{c.call(m,p.resolve,p.reject)}catch(u){p.reject(u)}};e.prototype.then=function(c,m){function p(w,z){return"function"==typeof w?function(A){try{u(w(A))}catch(B){v(B)}}:z}var u,v,x=new e(function(w,z){u=w;v=z});this.callWhenSettled_(p(c,u),p(m,v));return x};e.prototype.catch=function(c){return this.then(void 0,c)};e.prototype.callWhenSettled_=function(c,m){function p(){switch(u.state_){case 1:c(u.result_);
break;case 2:m(u.result_);break;default:throw Error("Unexpected state: "+u.state_);}}var u=this;null==this.onSettledCallbacks_?q.asyncExecute(p):this.onSettledCallbacks_.push(p);this.isRejectionHandled_=!0};e.resolve=k;e.reject=function(c){return new e(function(m,p){p(c)})};e.race=function(c){return new e(function(m,p){for(var u=$jscomp.makeIterator(c),v=u.next();!v.done;v=u.next())k(v.value).callWhenSettled_(m,p)})};e.all=function(c){var m=$jscomp.makeIterator(c),p=m.next();return p.done?k([]):new e(function(u,
v){function x(A){return function(B){w[A]=B;z--;0==z&&u(w)}}var w=[],z=0;do w.push(void 0),z++,k(p.value).callWhenSettled_(x(w.length-1),v),p=m.next();while(!p.done)})};return e},"es6","es3");$jscomp.checkStringArgs=function(h,g,k){if(null==h)throw new TypeError("The 'this' value for String.prototype."+k+" must not be null or undefined");if(g instanceof RegExp)throw new TypeError("First argument to String.prototype."+k+" must not be a regular expression");return h+""};
(function(h){function g(l){if(k[l])return k[l].exports;var e=k[l]={i:l,l:!1,exports:{}};h[l].call(e.exports,e,e.exports,g);e.l=!0;return e.exports}var k={};g.m=h;g.c=k;g.d=function(l,e,q){g.o(l,e)||Object.defineProperty(l,e,{enumerable:!0,get:q})};g.r=function(l){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"});Object.defineProperty(l,"__esModule",{value:!0})};g.t=function(l,e){e&1&&(l=g(l));if(e&8||e&4&&"object"===typeof l&&l&&l.__esModule)return l;
var q=Object.create(null);g.r(q);Object.defineProperty(q,"default",{enumerable:!0,value:l});if(e&2&&"string"!=typeof l)for(var c in l)g.d(q,c,function(m){return l[m]}.bind(null,c));return q};g.n=function(l){var e=l&&l.__esModule?function(){return l["default"]}:function(){return l};g.d(e,"a",e);return e};g.o=function(l,e){return Object.prototype.hasOwnProperty.call(l,e)};g.p="/core";return g(g.s=4)})([function(h,g,k){k.d(g,"a",function(){return q});k.d(g,"b",function(){return c});var l={},e={flattenedResources:!1,
CANVAS_CACHE_SIZE:void 0,maxPagesBefore:void 0,maxPagesAhead:void 0,disableLogs:!1,wvsQueryParameters:{},_trnDebugMode:!1,_logFiltersEnabled:null},q=function(m){return e[m]},c=function(m,p){var u;e[m]=p;null===(u=l[m])||void 0===u?void 0:u.forEach(function(v){v(p)})}},function(h,g,k){(function(l){k.d(g,"b",function(){return K});k.d(g,"a",function(){return C});k.d(g,"c",function(){return G});k.d(g,"d",function(){return H});var e=k(2),q=k(7);k.n(q);var c=window,m=function(){return function(d,a){this.fsQ=
this.fs_read_counter=0;this.needCallback=!1;this.fs_read_total=d;this.fsQ=a}}();c.AsyncFSHack={readingAsyncFS:0,readingCounter:0,readCalls:{}};var p=c.Module,u=0,v={},x=function(d){c.AsyncFSHack.readingAsyncFS=1;d in c.AsyncFSHack.readCalls||(c.AsyncFSHack.readCalls[d]=new m(c.AsyncFSHack.read_total,c.AsyncFSHack.q))},w=function(d){var a=c.AsyncFSHack.readCalls[d];++a.fs_read_counter;a.fs_read_counter>=a.fs_read_total&&(a.needCallback?p._finish_do_call_operation(a.fsQ):c.AsyncFSHack.readingAsyncFS=
0,delete c.AsyncFSHack.readCalls[d])},z=function(d,a,b,f,n,r,t){this.lruList=[];this.chunkMap={};this.chunkReader={};this.chunkMap[a]=n;this.length=a;this.cacheDataSize=f;this.url=d;this.customHeaders=r;this.withCredentials=t;this.chunkSize=b};Object.assign(z.prototype,{lruUpdate:function(d){var a=this.lruList.lastIndexOf(d);0<=a&&this.lruList.splice(a,1);this.lruList.push(d)},downloadChunk:function(d,a){var b=!1;d in this.chunkReader||(this.chunkReader[d]=[],b=!0);a&&this.chunkReader[d].push(a);
if(b){a=Math.min(d+this.chunkSize,this.length)-1;var f=new XMLHttpRequest;f.open("GET",this.url,!0);f.responseType="arraybuffer";f.setRequestHeader("Range",["bytes=",d,"-",a].join(""));this.withCredentials&&(f.withCredentials=this.withCredentials);if(this.customHeaders)for(var n in this.customHeaders)f.setRequestHeader(n,this.customHeaders[n]);f.send();var r=this;f.onload=function(){if(200===f.status||206===f.status){var t=new Int8Array(f.response);r.writeChunk(t,d)}else window.parent.parentWarn("Failed to load data from".concat(r.url)),
t=new Int8Array(0);for(var D=r.chunkReader[d],E=0;E<D.length;E++)D[E](t);delete r.chunkReader[d]}}},hadChunk:function(d){return d in this.chunkMap},hasChunk:function(d){return this.chunkMap[d]},getCacheData:function(){return this.chunkMap[this.length]},updateCache:function(d){for(var a=0;a<d.length;a++){var b=d[a];this.hadChunk(b)&&(this.hasChunk(b)?this.lruUpdate(b):this.downloadChunk(b))}},wrapChunkRetrieval:function(d,a,b){this.downloadChunk(d,function(f){b(f,a)})},downloadChunks:function(d,a){for(var b=
d.length,f=Array(b),n=0,r=function(D,E){f[E]=D;++n;n===b&&a(f)},t=0;t<b;++t)this.wrapChunkRetrieval(d[t][0],t,r)},readFromCache:function(d,a,b){var f=[],n=0,r=Math.floor(a/this.chunkSize)*this.chunkSize,t=a%this.chunkSize;a=this.chunkSize-t;a=a>b?b:a;this.chunkMap[r]?(t=this.chunkMap[r].subarray(t,t+a),d.set(t),this.lruUpdate(r)):this.hadChunk(r)?f.push([r,t,a,n]):(t=new Int8Array(a),d.set(t));for(b-=a;0<b;)n+=a,r+=this.chunkSize,a=this.chunkSize>b?b:this.chunkSize,this.chunkMap[r]?(t=this.chunkMap[r].subarray(0,
a),d.set(t,n),this.lruUpdate(r)):this.hadChunk(r)?f.push([r,0,a,n]):(t=new Int8Array(a),d.set(t,n)),b-=a;return f},writeChunk:function(d,a,b){Object(e.a)(this.lruList,this.chunkMap,this.chunkSize,p.chunkMax,d,a,b);this.lruUpdate(a)}});var A=function(d){this.chunkStorage=d;this.position=0;this.length=this.chunkStorage.length};Object.assign(A.prototype,{read:function(d,a,b,f){var n=f+b<=this.length,r=n?b:this.length-f,t=c.AsyncFSHack.readingCounter.toString();if(0<r){x(t);var D=d.subarray(a,a+r);var E=
this.chunkStorage.readFromCache(D,f,r);E.length?(c.AsyncFSHack.readCalls[t].needCallback=!0,this.chunkStorage.downloadChunks(E,function(M){for(var I=0;I<M.length;++I){var J=E[I],N=M[I].subarray(J[1],J[1]+J[2]);D.set(N,J[3])}w(t)})):n&&w(t);f+=r}else r=0;if(!n){x(t);a+=r;if(b-=r){n=this.chunkStorage.getCacheData();b>n.length&&(b=n.length);var L=f-this.length;b-=L;d=d.subarray(a,a+b);a=n.subarray(L,L+b);d.set(a)}E&&E.length||w(t);f+=b;r+=b}this.position=f;return r},write:function(d,a,b,f){var n=f+b<=
this.length,r=f+b<=this.length?b:this.length-f;if(0<r){var t=d.subarray(a,a+r),D=f%this.chunkStorage.chunkSize;this.chunkStorage.writeChunk(t,f-D,D);f+=r}else r=0;if(!n){t=a+r;if(b-=r)a=this.chunkStorage.getCacheData(),b>a.length&&(b=a.length),n=f-this.length,b-=n,t=d.subarray(t,t+b),a.subarray(n,n+b).set(t);f+=b;r+=b}this.position=f;return r},seek:function(d){this.position=d},close:function(){this.chunkStorage=null},getPos:function(){return this.position},getTotalSize:function(){return this.length+
this.chunkStorage.cacheDataSize}});var B=function(d){this.file=d;this.filePosition=0;this.fileLength=d.size;this.readerPool=[]};Object.assign(B.prototype,{readFromFile:function(d,a,b){var f=this.readerPool.length?this.readerPool.pop():new FileReader;var n=this;f.onload=function(){var r=new Int8Array(f.result);n.readerPool.push(f);b(r)};f.readAsArrayBuffer(this.file.slice(a,a+d))},read:function(d,a,b,f){b=f+b<=this.fileLength?b:this.fileLength-f;if(0<b){var n=c.AsyncFSHack.readingCounter.toString();
x(n);var r=d.subarray(a,a+b);c.AsyncFSHack.readCalls[n].needCallback=!0;this.readFromFile(b,f,function(t){r.set(t);w(n)});this.filePosition=f+b}return b},seek:function(d){this.filePosition=d},close:function(){this.reader=this.file=null},getPos:function(){return this.filePosition},getTotalSize:function(){return this.fileLength}});var F={open:function(d){var a=d.path.slice(1);d.provider=p.docs[a].chunkStorage?new A(p.docs[a].chunkStorage):new B(p.docs[a])},close:function(d){d.provider.close()},read:function(d,
a,b,f,n){return d.provider.read(a,b,f,n)},llseek:function(d,a,b){d=d.provider;1===b?a+=d.getPos():2===b&&(a=d.getTotalSize()+a);if(0>a)throw new c.FS.ErrnoError(l.ERRNO_CODES.EINVAL);d.seek(a);return a},write:function(d,a,b,f,n){return f?d.provider.write(a,b,f,n):0}},y=function(d){if(!v[d]){var a=c.FS.makedev(3,5);c.FS.registerDevice(a,F);c.FS.mkdev(d,511,a);v[d]=!0}},K=function(d,a,b,f,n){var r="docdev".concat(++u);y(r);var t=Math.ceil((a+b-1)/b/8),D=new Int8Array(new ArrayBuffer(t));d=new z(d,a,
b,t,D,f,n);p.docs[r]={chunkStorage:d};return r},C=function(d){var a="docdev".concat(++u);y(a);p.docs[a]=d;return a},G=function(d){c.FS.unlink(d);p.docs[d]&&delete p.docs[d]},H=function(d){var a=Object.prototype.toString.call(d);return"object"===typeof d&&null!==d&&("[object File]"===a||"[object Blob]"===a)}}).call(this,k(6))},function(h,g,k){function l(e,q,c,m,p,u,v){v=v||0;var x=q[u],w=p.length;m=e.length>=m&&!x;w!==c||p.buffer.byteLength!==w?(m?(e=e.shift(),x=q[e],x.length<c&&(x=new Int8Array(c)),
q[e]=null):x=x?q[u]:new Int8Array(c),x.subarray(v,v+w).set(p),p=x):m&&(e=e.shift(),q[e]=null);q[u]=p}k.d(g,"a",function(){return l});k(3)},function(h,g,k){k.d(g,"a",function(){return e});var l=k(0),e=function(q,c){Object(l.a)("disableLogs")||(c?console.warn("".concat(q,": ").concat(c)):console.warn(q))}},function(h,g,k){h.exports=k(5)},function(h,g,k){function l(a){"@babel/helpers - typeof";return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(b){return typeof b}:function(b){return b&&
"function"==typeof Symbol&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},l(a)}k.r(g);var e=k(1),q=window,c;q.Module.onRuntimeInitialized=function(){m=!0;u||(C.handleMessage({action:"workerLoaded",data:{}}),u=!0);C.sendTestResponse();q.PThread.receiveObjectTransfer=function(){var a=q.Module.GetNextResponseMessage();q.getThreadedWasmWorker().handleMessage(a);q.Module.PopNextResponseMessage()}};q.Module.locateFile=function(a){return c+a};q.Module.INITIAL_MEMORY=100663296;var m=!1,p=
!1,u=!1,v=1,x=function(a){if("object"===l(a)&&null!==a)if("undefined"!==typeof a.byteLength){var b="mainThreadArrayBuffer".concat(v);v++;a=new Uint8Array(a);q.FS.writeFile(b,a);a={handle:b,isArrayBufferRef:!0}}else for(b in a)a.hasOwnProperty(b)&&(a[b]=x(a[b]));return a},w=function(a){if("object"===l(a)&&null!==a)if(a.isArrayBufferRef){var b=q.FS.readFile(a.handle,{encoding:"binary"});q.FS.unlink(a.handle);a=b.buffer}else if(a.constructor===Uint8Array)a=(new Uint8Array(a)).buffer;else for(b in a)a.hasOwnProperty(b)&&
(a[b]=w(a[b]));return a},z=0,A={},B={},F={},y={},K=function(a){var b=a.action,f=a.data,n=a.callbackId;if("NewDoc"===b&&f)b=f.value,"url"===f.type?(b=Object(e.b)(b.url,b.size,f.chunkSize,b.customHeaders,b.withCredentials),B[n]=b,f.value.docDevId=b):Object(e.d)(b)&&(b=Object(e.a)(b),B[n]=b,f.value=b);else if("SaveDoc"!==b&&"SaveDocFromFixedElements"!==b||!f)"GetCanvas"===b&&f?(n=f.docId,n in y&&(b=y[n],b in q.Module.docs&&(b=q.Module.docs[b],"chunkStorage"in b&&(f=q.Module.GetRequiredChunkOffsetArray(n,
f.pageIndex+1),f.length&&b.chunkStorage.updateCache(f))))):"DeleteDocument"===b&&f&&(f=f.docId,f in y&&(F[n]=f));else{b=f.docId;var r=f.finishedWithDocument,t="docFilePath".concat(z);A[n]={filePath:t,docId:b,finishedWithDocument:r};z++;f.filePath=t}q.Module.HandleMessage(x(a))},C;q.MainThreadLabel=!0;q.getThreadedWasmWorker=function(){return C};var G=function(a){window.parent.loadThreadedBackend(a,{"Wasm.wasm":1E7,"Wasm.js":15E4},window);this.eventListeners=[]};Object.assign(G.prototype,{addEventListener:function(a,
b){if("message"===a)this.eventListeners.push(b);else throw Error("event type ".concat(a," is not supported by WasmWorker."));},removeEventListener:function(a,b){"message"===a&&(this.eventListeners=this.eventListeners.filter(function(f){return f!==b}))},sendTestResponse:function(){m&&p&&(this.handleMessage({action:"test",data:{supportTypedArray:!0,supportTransfers:!0}}),this.postMessage=K)},postMessage:function(a){if("test"===a.action)p=!0,this.sendTestResponse();else throw Error("Need to do handshake first!");
},handleMessage:function(a){var b=a.callbackId,f=a.data;if(b in B)f&&f.docId?y[f.docId]=B[b]:Object(e.c)(B[b]),delete B[b];else if(b in A){if(!a.hasOwnProperty("error")){var n=A[b].filePath,r=q.FS.readFile(n,{encoding:"binary"});f.fileData=r.buffer;f=A[b].docId;f in y&&(Object(e.c)(y[f]),delete y[f]);f&&!A[b].finishedWithDocument?y[f]=n:q.FS.unlink(n)}delete A[b]}else b in F&&(n=F[b],n in y&&(Object(e.c)(y[n]),delete y[n]),delete F[b]);a=w(a);window.parent.postMessage(a)},reset:function(){C=null;
u=p=m=!1}});var H=function(){var a={},b=new Promise(function(f,n){a.resolve=f;a.reject=n});a.promise=b;return a}(),d=function(a){"object"===l(a.data)&&"action"in a.data&&"workerLoaded"===a.data.action&&(H.resolve(C),C.removeEventListener("message",d))};window.addEventListener("message",function(a){var b=a.data;a.origin===window.location.origin&&"loadWasmWorker"===b.action?(c=b.workerFolder,C=new G("".concat(b.wasmSource,"PDFNetThreaded")),u||C.addEventListener("message",d)):a.origin===window.location.origin&&
"dispose"===b.action?(C.removeEventListener("message",d),C.reset()):C.postMessage(b)});q.getWasmWorkerPromise=function(){return H.promise}},function(h,g){g=function(){return this}();try{g=g||(new Function("return this"))()}catch(k){"object"===typeof window&&(g=window)}h.exports=g},function(h,g){window.Module={chunkMax:100,docs:{}}}]);}).call(this || window)