MindMap/frontend/node_modules/pdfjs-dist/legacy/build/pdf.min.mjs

28 lines
441 KiB
JavaScript
Raw Permalink Normal View History

/**
* @licstart The following is the entire license notice for the
* JavaScript code in this page
*
* Copyright 2024 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* JavaScript code in this page
*/
/**
* pdfjsVersion = 5.4.149
* pdfjsBuild = 9e2e9e209
*/var t={34:(t,e,i)=>{var n=i(4901);t.exports=function(t){return"object"==typeof t?null!==t:n(t)}},81:(t,e,i)=>{var n=i(9565),s=i(9306),r=i(8551),a=i(6823),o=i(851),l=TypeError;t.exports=function(t,e){var i=arguments.length<2?o(t):e;if(s(i))return r(n(i,t));throw new l(a(t)+" is not iterable")}},116:(t,e,i)=>{var n=i(6518),s=i(9565),r=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),c=i(4549)("find",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:c},{find:function find(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(c)return s(c,this,t);var e=l(this),i=0;return r(e,(function(e,n){if(t(e,i++))return n(e)}),{IS_RECORD:!0,INTERRUPTED:!0}).result}})},283:(t,e,i)=>{var n=i(9504),s=i(9039),r=i(4901),a=i(9297),o=i(3724),l=i(350).CONFIGURABLE,h=i(3706),c=i(1181),d=c.enforce,u=c.get,p=String,g=Object.defineProperty,f=n("".slice),m=n("".replace),b=n([].join),y=o&&!s((function(){return 8!==g((function(){}),"length",{value:8}).length})),v=String(String).split("String"),w=t.exports=function(t,e,i){"Symbol("===f(p(e),0,7)&&(e="["+m(p(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]");i&&i.getter&&(e="get "+e);i&&i.setter&&(e="set "+e);(!a(t,"name")||l&&t.name!==e)&&(o?g(t,"name",{value:e,configurable:!0}):t.name=e);y&&i&&a(i,"arity")&&t.length!==i.arity&&g(t,"length",{value:i.arity});try{i&&a(i,"constructor")&&i.constructor?o&&g(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=d(t);a(n,"source")||(n.source=b(v,"string"==typeof e?e:""));return t};Function.prototype.toString=w((function toString(){return r(this)&&u(this).source||h(this)}),"toString")},350:(t,e,i)=>{var n=i(3724),s=i(9297),r=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,o=s(r,"name"),l=o&&"something"===function something(){}.name,h=o&&(!n||n&&a(r,"name").configurable);t.exports={EXISTS:o,PROPER:l,CONFIGURABLE:h}},397:(t,e,i)=>{var n=i(7751);t.exports=n("document","documentElement")},421:t=>{t.exports={}},456:(t,e,i)=>{var n=i(6518),s=i(4576),r=i(9504),a=i(4154),o=i(5169),l=r(1.1.toString),h=s.Uint8Array,c=!h||!h.prototype.toHex||!function(){try{return"ffffffffffffffff"===new h([255,255,255,255,255,255,255,255]).toHex()}catch(t){return!1}}();h&&n({target:"Uint8Array",proto:!0,forced:c},{toHex:function toHex(){a(this);o(this.buffer);for(var t="",e=0,i=this.length;e<i;e++){var n=l(this[e],16);t+=1===n.length?"0"+n:n}return t}})},507:(t,e,i)=>{var n=i(9565);t.exports=function(t,e,i){for(var s,r,a=i?t:t.iterator,o=t.next;!(s=n(o,a)).done;)if(void 0!==(r=e(s.value)))return r}},531:(t,e,i)=>{var n=i(6518),s=i(9565),r=i(9306),a=i(8551),o=i(1767),l=i(8646),h=i(9462),c=i(9539),d=i(6395),u=i(684),p=i(4549),g=!d&&!u("flatMap",(function(){})),f=!d&&!g&&p("flatMap",TypeError),m=d||g||f,b=h((function(){for(var t,e,i=this.iterator,n=this.mapper;;){if(e=this.inner)try{if(!(t=a(s(e.next,e.iterator))).done)return t.value;this.inner=null}catch(t){c(i,"throw",t)}t=a(s(this.next,i));if(this.done=!!t.done)return;try{this.inner=l(n(t.value,this.counter++),!1)}catch(t){c(i,"throw",t)}}}));n({target:"Iterator",proto:!0,real:!0,forced:m},{flatMap:function flatMap(t){a(this);try{r(t)}catch(t){c(this,"throw",t)}return f?s(f,this,t):new b(o(this),{mapper:t,inner:null})}})},616:(t,e,i)=>{var n=i(9039);t.exports=!n((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},655:(t,e,i)=>{var n=i(6955),s=String;t.exports=function(t){if("Symbol"===n(t))throw new TypeError("Cannot convert a Symbol value to a string");return s(t)}},679:(t,e,i)=>{var n=i(1625),s=TypeError;t.exports=function(t,e){if(n(e,t))return t;throw new s("Incorrect invocation")}},684:t=>{t.exports=function(t,e){var i="function"==typeof Iterator&&Iterator.prototype[t];if(i)try{i.call({next:null},e).next()}catch(t){return!0}}},741:t=>{var e=Math.ceil,i=Math.floor;t.exports=Math.trunc||function trunc(t){var n=+t;return(n>0?i:e)(n)}},757:(t,e,i)=>{var n=i(7751),s=i(4901),r=i(1625),a=i(7040),o=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=n("Symbol");return s(e)&&r(e.prototype,o(t))}},851:(t,e,i)=>{var n=i(6955),s=i(5966),r=i(4117),a=i
/*webpackIgnore: true*/
/*@vite-ignore*/
this.workerSrc)).WorkerMessageHandler})())}}class WorkerTransport{#bs=new Map;#ys=new Map;#vs=new Map;#ws=new Map;#As=null;constructor(t,e,i,n,s,r){this.messageHandler=t;this.loadingTask=e;this.commonObjs=new PDFObjects;this.fontLoader=new FontLoader({ownerDocument:n.ownerDocument,styleElement:n.styleElement});this.loadingParams=n.loadingParams;this._params=n;this.canvasFactory=s.canvasFactory;this.filterFactory=s.filterFactory;this.cMapReaderFactory=s.cMapReaderFactory;this.standardFontDataFactory=s.standardFontDataFactory;this.wasmFactory=s.wasmFactory;this.destroyed=!1;this.destroyCapability=null;this._networkStream=i;this._fullReader=null;this._lastProgress=null;this.downloadInfoCapability=Promise.withResolvers();this.enableHWA=r;this.setupMessageHandler()}#xs(t,e=null){const i=this.#bs.get(t);if(i)return i;const n=this.messageHandler.sendWithPromise(t,e);this.#bs.set(t,n);return n}get annotationStorage(){return shadow(this,"annotationStorage",new AnnotationStorage)}getRenderingIntent(t,e=p.ENABLE,i=null,n=!1,s=!1){let g=a,f=Y;switch(t){case"any":g=r;break;case"display":break;case"print":g=o;break;default:warn(`getRenderingIntent - invalid intent: ${t}`)}const m=g&o&&i instanceof PrintAnnotationStorage?i:this.annotationStorage;switch(e){case p.DISABLE:g+=c;break;case p.ENABLE:break;case p.ENABLE_FORMS:g+=l;break;case p.ENABLE_STORAGE:g+=h;f=m.serializable;break;default:warn(`getRenderingIntent - invalid annotationMode: ${e}`)}n&&(g+=d);s&&(g+=u);const{ids:b,hash:y}=m.modifiedIds;return{renderingIntent:g,cacheKey:[g,f.hash,y].join("_"),annotationStorageSerializable:f,modifiedIds:b}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0;this.destroyCapability=Promise.withResolvers();this.#As?.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const e of this.#ys.values())t.push(e._destroy());this.#ys.clear();this.#vs.clear();this.#ws.clear();this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);t.push(e);Promise.all(t).then((()=>{this.commonObjs.clear();this.fontLoader.clear();this.#bs.clear();this.filterFactory.destroy();TextLayer.cleanup();this._networkStream?.cancelAllRequests(new AbortException("Worker was terminated."));this.messageHandler?.destroy();this.messageHandler=null;this.destroyCapability.resolve()}),this.destroyCapability.reject);return this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",((t,e)=>{assert(this._networkStream,"GetReader - no `IPDFStream` instance available.");this._fullReader=this._networkStream.getFullReader();this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}};e.onPull=()=>{this._fullReader.read().then((function({value:t,done:i}){if(i)e.close();else{assert(t instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer.");e.enqueue(new Uint8Array(t),1,[t])}})).catch((t=>{e.error(t)}))};e.onCancel=t=>{this._fullReader.cancel(t);e.ready.catch((t=>{if(!this.destroyed)throw t}))}}));t.on("ReaderHeadersReady",(async t=>{await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:s}=this._fullReader;if(!i||!n){this._lastProgress&&e.onProgress?.(this._lastProgress);this._fullReader.onProgress=t=>{e.onProgress?.({loaded:t.loaded,total:t.total})}}return{isStreamingSupported:i,isRangeSupported:n,contentLength:s}}));t.on("GetRangeReader",((t,e)=>{assert(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(t.begin,t.end);if(i){e.onPull=()=>{i.read().then((function({value:t,done:i}){if(i)e.close();else{assert(t instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer.");e.enqueue(new Uint8Array(t),1,[t])}})).catch((t=>{e.error(t)}))};e.onCancel=t=>{i.cancel(t);e.ready.catch((t=>{if(!this.destroyed)throw t}))}}else e.close()}));t.on("GetDoc",(({pdfInfo:t})=>{this._numPages=t.numPages;this._htmlForXfa=t.htmlForXfa;delete t.htmlForXfa;e._capability