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

28 lines
1.0 MiB
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 e={34:(e,t,r)=>{var a=r(4901);e.exports=function(e){return"object"==typeof e?null!==e:a(e)}},81:(e,t,r)=>{var a=r(9565),n=r(9306),i=r(8551),s=r(6823),o=r(851),c=TypeError;e.exports=function(e,t){var r=arguments.length<2?o(e):t;if(n(r))return i(a(r,e));throw new c(s(e)+" is not iterable")}},116:(e,t,r)=>{var a=r(6518),n=r(9565),i=r(2652),s=r(9306),o=r(8551),c=r(1767),l=r(9539),h=r(4549)("find",TypeError);a({target:"Iterator",proto:!0,real:!0,forced:h},{find:function find(e){o(this);try{s(e)}catch(e){l(this,"throw",e)}if(h)return n(h,this,e);var t=c(this),r=0;return i(t,(function(t,a){if(e(t,r++))return a(t)}),{IS_RECORD:!0,INTERRUPTED:!0}).result}})},283:(e,t,r)=>{var a=r(9504),n=r(9039),i=r(4901),s=r(9297),o=r(3724),c=r(350).CONFIGURABLE,l=r(3706),h=r(1181),u=h.enforce,d=h.get,f=String,g=Object.defineProperty,p=a("".slice),m=a("".replace),b=a([].join),y=o&&!n((function(){return 8!==g((function(){}),"length",{value:8}).length})),w=String(String).split("String"),x=e.exports=function(e,t,r){"Symbol("===p(f(t),0,7)&&(t="["+m(f(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]");r&&r.getter&&(t="get "+t);r&&r.setter&&(t="set "+t);(!s(e,"name")||c&&e.name!==t)&&(o?g(e,"name",{value:t,configurable:!0}):e.name=t);y&&r&&s(r,"arity")&&e.length!==r.arity&&g(e,"length",{value:r.arity});try{r&&s(r,"constructor")&&r.constructor?o&&g(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var a=u(e);s(a,"source")||(a.source=b(w,"string"==typeof t?t:""));return e};Function.prototype.toString=x((function toString(){return i(this)&&d(this).source||l(this)}),"toString")},350:(e,t,r)=>{var a=r(3724),n=r(9297),i=Function.prototype,s=a&&Object.getOwnPropertyDescriptor,o=n(i,"name"),c=o&&"something"===function something(){}.name,l=o&&(!a||a&&s(i,"name").configurable);e.exports={EXISTS:o,PROPER:c,CONFIGURABLE:l}},397:(e,t,r)=>{var a=r(7751);e.exports=a("document","documentElement")},421:e=>{e.exports={}},456:(e,t,r)=>{var a=r(6518),n=r(4576),i=r(9504),s=r(4154),o=r(5169),c=i(1.1.toString),l=n.Uint8Array,h=!l||!l.prototype.toHex||!function(){try{return"ffffffffffffffff"===new l([255,255,255,255,255,255,255,255]).toHex()}catch(e){return!1}}();l&&a({target:"Uint8Array",proto:!0,forced:h},{toHex:function toHex(){s(this);o(this.buffer);for(var e="",t=0,r=this.length;t<r;t++){var a=c(this[t],16);e+=1===a.length?"0"+a:a}return e}})},507:(e,t,r)=>{var a=r(9565);e.exports=function(e,t,r){for(var n,i,s=r?e:e.iterator,o=e.next;!(n=a(o,s)).done;)if(void 0!==(i=t(n.value)))return i}},531:(e,t,r)=>{var a=r(6518),n=r(9565),i=r(9306),s=r(8551),o=r(1767),c=r(8646),l=r(9462),h=r(9539),u=r(6395),d=r(684),f=r(4549),g=!u&&!d("flatMap",(function(){})),p=!u&&!g&&f("flatMap",TypeError),m=u||g||p,b=l((function(){for(var e,t,r=this.iterator,a=this.mapper;;){if(t=this.inner)try{if(!(e=s(n(t.next,t.iterator))).done)return e.value;this.inner=null}catch(e){h(r,"throw",e)}e=s(n(this.next,r));if(this.done=!!e.done)return;try{this.inner=c(a(e.value,this.counter++),!1)}catch(e){h(r,"throw",e)}}}));a({target:"Iterator",proto:!0,real:!0,forced:m},{flatMap:function flatMap(e){s(this);try{i(e)}catch(e){h(this,"throw",e)}return p?n(p,this,e):new b(o(this),{mapper:e,inner:null})}})},616:(e,t,r)=>{var a=r(9039);e.exports=!a((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},655:(e,t,r)=>{var a=r(6955),n=String;e.exports=function(e){if("Symbol"===a(e))throw new TypeError("Cannot convert a Symbol value to a string");return n(e)}},679:(e,t,r)=>{var a=r(1625),n=TypeError;e.exports=function(e,t){if(a(t,e))return e;throw new n("Incorrect invocation")}},684:e=>{e.exports=function(e,t){var r="function"==typeof Iterator&&Iterator.prototype[e];if(r)try{r.call({next:null},t).next()}catch(e){return!0}}},741:e=>{var t=Math.ceil,r=Math.floor;e.exports=Math.trunc||function trunc(e){var a=+e;return(a>0?r:t)(a)}},757:(e,t,r)=>{var a=r(7751),n=r(4901),i=r(1625),s=r(7040),o=Object;e.exports=s?function(e){return"symbol"==typeof e}:function(e){var t=a("Symbol");return n(t)&&i(t.prototype,o(e))}},851:(e,t,r)=>{var a=r(6955),n=r(5966),i=r(4117),s=r
/*webpackIgnore: true*/
/*@vite-ignore*/
t)).default()}catch(e){warn(`JpxImage#getJsModule: ${e}`)}e(r)}static async#U(e,t,r){const a="openjpeg.wasm";try{this.#N||(this.#L?this.#N=await fetchBinaryData(`${this.#F}${a}`):this.#N=await this.#P.sendWithPromise("FetchBinaryData",{type:"wasmFactory",filename:a}));return r((await WebAssembly.instantiate(this.#N,t)).instance)}catch(t){warn(`JpxImage#instantiateWasm: ${t}`);this.#j(e);return null}finally{this.#P=null}}static async decode(e,{numComponents:t=4,isIndexedColormap:r=!1,smaskInData:a=!1,reducePower:n=0}={}){if(!this.#_){const{promise:e,resolve:t}=Promise.withResolvers(),r=[e];this.#v?r.push(Nr({warn,instantiateWasm:this.#U.bind(this,t)})):this.#j(t);this.#_=Promise.race(r)}const i=await this.#_;if(!i)throw new JpxError("OpenJPEG failed to initialize");let s;try{const o=e.length;s=i._malloc(o);i.writeArrayToMemory(e,s);if(i._jp2_decode(s,o,t>0?t:0,!!r,!!a,n)){const{errorMessages:e}=i;if(e){delete i.errorMessages;throw new JpxError(e)}throw new JpxError("Unknown error")}const{imageData:c}=i;i.imageData=null;return c}finally{s&&i._free(s)}}static cleanup(){this.#_=null}static parseImageProperties(e){let t=e.getByte();for(;t>=0;){const r=t;t=e.getByte();if(65361===(r<<8|t)){e.skip(4);const t=e.getInt32()>>>0,r=e.getInt32()>>>0,a=e.getInt32()>>>0,n=e.getInt32()>>>0;e.skip(16);return{width:t-a,height:r-n,bitsPerComponent:8,componentsCount:e.getUint16()}}}throw new JpxError("No size marker found in JPX stream")}}function addState(e,t,r,a,n){let i=e;for(let e=0,r=t.length-1;e<r;e++){const r=t[e];i=i[r]||=[]}i[t.at(-1)]={checkFn:r,iterateFn:a,processFn:n}}const Pr=[];addState(Pr,[ye,xe,Lt,we],null,(function iterateInlineImageGroup(e,t){const r=e.fnArray,a=(t-(e.iCurr-3))%4;switch(a){case 0:return r[t]===ye;case 1:return r[t]===xe;case 2:return r[t]===Lt;case 3:return r[t]===we}throw new Error(`iterateInlineImageGroup - invalid pos: ${a}`)}),(function foundInlineImageGroup(e,t){const r=e.fnArray,a=e.argsArray,n=e.iCurr,i=n-3,s=n-2,o=n-1,c=Math.min(Math.floor((t-i)/4),200);if(c<10)return t-(t-i)%4;let l=0;const h=[];let u=0,d=1,f=1;for(let e=0;e<c;e++){const t=a[s+(e<<2)],r=a[o+(e<<2)][0];if(d+r.width>1e3){l=Math.max(l,d);f+=u+2;d=0;u=0}h.push({transform:t,x:d,y:f,w:r.width,h:r.height});d+=r.width+2;u=Math.max(u,r.height)}const g=Math.max(l,d)+1,p=f+u+1,m=new Uint8Array(g*p*4),b=g<<2;for(let e=0;e<c;e++){const t=a[o+(e<<2)][0].data,r=h[e].w<<2;let n=0,i=h[e].x+h[e].y*g<<2;m.set(t.subarray(0,r),i-b);for(let a=0,s=h[e].h;a<s;a++){m.set(t.subarray(n,n+r),i);n+=r;i+=b}m.set(t.subarray(n-r,n),i);for(;i>=0;){t[i-4]=t[i];t[i-3]=t[i+1];t[i-2]=t[i+2];t[i-1]=t[i+3];t[i+r]=t[i+r-4];t[i+r+1]=t[i+r-3];t[i+r+2]=t[i+r-2];t[i+r+3]=t[i+r-1];i-=b}}const y={width:g,height:p};if(e.isOffscreenCanvasSupported){const e=new OffscreenCanvas(g,p);e.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(m.buffer),g,p),0,0);y.bitmap=e.transferToImageBitmap();y.data=null}else{y.kind=O;y.data=m}r.splice(i,4*c,jt);a.splice(i,4*c,[y,h]);return i+1}));addState(Pr,[ye,xe,Nt,we],null,(function iterateImageMaskGroup(e,t){const r=e.fnArray,a=(t-(e.iCurr-3))%4;switch(a){case 0:return r[t]===ye;case 1:return r[t]===xe;case 2:return r[t]===Nt;case 3:return r[t]===we}throw new Error(`iterateImageMaskGroup - invalid pos: ${a}`)}),(function foundImageMaskGroup(e,t){const r=e.fnArray,a=e.argsArray,n=e.iCurr,i=n-3,s=n-2,o=n-1;let c=Math.floor((t-i)/4);if(c<10)return t-(t-i)%4;let l,h,u=!1;const d=a[o][0],f=a[s][0],g=a[s][1],p=a[s][2],m=a[s][3];if(g===p){u=!0;l=s+4;let e=o+4;for(let t=1;t<c;t++,l+=4,e+=4){h=a[l];if(a[e][0]!==d||h[0]!==f||h[1]!==g||h[2]!==p||h[3]!==m){t<10?u=!1:c=t;break}}}if(u){c=Math.min(c,1e3);const e=new Float32Array(2*c);l=s;for(let t=0;t<c;t++,l+=4){h=a[l];e[t<<1]=h[4];e[1+(t<<1)]=h[5]}r.splice(i,4*c,qt);a.splice(i,4*c,[d,f,g,p,m,e])}else{c=Math.min(c,100);const e=[];for(let t=0;t<c;t++){h=a[s+(t<<2)];const r=a[o+(t<<2)][0];e.push({data:r.data,width:r.width,height:r.height,interpolate:r.interpolate,count:r.count,transform:h})}r.splice(i,4*c,Pt);a.splice(i,4*c,[e])}return i+1}));addState(Pr,[ye,xe,_t,we],(function(e){const t=e.args