@box/pdfjs-dist 6.4.299-box.1 → 6.4.299-box.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +10 -0
- package/build/pdf.min.mjs +4 -4
- package/build/pdf.mjs +137 -12
- package/build/pdf.mjs.map +1 -1
- package/build/pdf.sandbox.min.mjs +2 -2
- package/build/pdf.sandbox.mjs +2 -2
- package/build/pdf.worker.min.mjs +3 -3
- package/build/pdf.worker.mjs +3 -3
- package/image_decoders/pdf.image_decoders.min.mjs +2 -2
- package/image_decoders/pdf.image_decoders.mjs +2 -2
- package/legacy/build/pdf.min.mjs +4 -4
- package/legacy/build/pdf.mjs +145 -18
- package/legacy/build/pdf.mjs.map +1 -1
- package/legacy/build/pdf.sandbox.min.mjs +2 -2
- package/legacy/build/pdf.sandbox.mjs +2 -2
- package/legacy/build/pdf.worker.min.mjs +3 -3
- package/legacy/build/pdf.worker.mjs +3 -3
- package/legacy/image_decoders/pdf.image_decoders.min.mjs +2 -2
- package/legacy/image_decoders/pdf.image_decoders.mjs +2 -2
- package/legacy/web/pdf_viewer.mjs +4 -4
- package/package.json +4 -3
- package/types/src/display/display_utils.d.ts +43 -0
- package/web/pdf_viewer.mjs +4 -4
package/build/pdf.worker.mjs
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* pdfjsVersion = 6.4.299-box.
|
|
24
|
-
* pdfjsBuild =
|
|
23
|
+
* pdfjsVersion = 6.4.299-box.2
|
|
24
|
+
* pdfjsBuild = 9c8224a
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
;// ./src/shared/util.js
|
|
@@ -64217,7 +64217,7 @@ class WorkerMessageHandler {
|
|
|
64217
64217
|
docId,
|
|
64218
64218
|
apiVersion
|
|
64219
64219
|
} = docParams;
|
|
64220
|
-
const workerVersion = "6.4.299-box.
|
|
64220
|
+
const workerVersion = "6.4.299-box.2";
|
|
64221
64221
|
if (apiVersion !== workerVersion) {
|
|
64222
64222
|
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
|
|
64223
64223
|
}
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* JavaScript code in this page
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
|
-
* pdfjsVersion = 6.4.299-box.
|
|
23
|
-
* pdfjsBuild =
|
|
22
|
+
* pdfjsVersion = 6.4.299-box.2
|
|
23
|
+
* pdfjsBuild = 9c8224a
|
|
24
24
|
*/
|
|
25
25
|
"object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&process.type,new Float32Array([1/0,1/0,-1/0,-1/0]);const e={ERRORS:0,WARNINGS:1,INFOS:5};let t=e.WARNINGS;function setVerbosityLevel(e){Number.isInteger(e)&&(t=e)}function getVerbosityLevel(){return t}function info(r){t>=e.INFOS&&console.info(`Info: ${r}`)}function warn(r){t>=e.WARNINGS&&console.warn(`Warning: ${r}`)}function unreachable(e){throw new Error(e)}function shadow(e,t,r,n=!1){Object.defineProperty(e,t,{value:r,enumerable:!n,configurable:!0,writable:!1});return r}const r=function BaseExceptionClosure(){function BaseException(e,t){this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();class FormatError extends r{constructor(e){super(e,"FormatError")}}function bytesToString(e){"object"==typeof e&&void 0!==e?.length||unreachable("Invalid argument for bytesToString");const t=e.length,r=8192;if(t<r)return String.fromCharCode.apply(null,e);const n=[];for(let s=0;s<t;s+=r){const a=Math.min(s+r,t),i=e.subarray(s,a);n.push(String.fromCharCode.apply(null,i))}return n.join("")}class FeatureTest{static get isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return shadow(this,"isLittleEndian",1===new Uint32Array(e.buffer,0,1)[0])}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return shadow(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get isFloat16ArraySupported(){return shadow(this,"isFloat16ArraySupported","undefined"!=typeof Float16Array)}static get isSanitizerSupported(){return shadow(this,"isSanitizerSupported","undefined"!=typeof Sanitizer)}static get platform(){const{platform:e,userAgent:t}=navigator;return shadow(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCanvasFilterSupported(){let e;this.isOffscreenCanvasSupported?e=new OffscreenCanvas(1,1).getContext("2d"):"undefined"!=typeof document&&(e=document.createElement("canvas").getContext("2d"));return shadow(this,"isCanvasFilterSupported",void 0!==e?.filter)}static get isAlphaColorInputSupported(){if("undefined"==typeof document)return shadow(this,"isAlphaColorInputSupported",!1);const e=document.createElement("input");e.type="color";e.setAttribute("alpha","");e.value="#ff000080";return shadow(this,"isAlphaColorInputSupported","#ff0000"!==e.value)}static get isBackdropFilterSupported(){return shadow(this,"isBackdropFilterSupported","undefined"!=typeof CSS&&CSS.supports("backdrop-filter","blur(1px)"))}}class Util{static get hexNums(){return shadow(this,"hexNums",Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")))}static makeHexColor(e,t,r){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[r]}`}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,r=0){const n=e[r],s=e[r+1];e[r]=n*t[0]+s*t[2]+t[4];e[r+1]=n*t[1]+s*t[3]+t[5]}static applyTransformToBezier(e,t,r=0){const n=t[0],s=t[1],a=t[2],i=t[3],o=t[4],c=t[5];for(let t=0;t<6;t+=2){const l=e[r+t],f=e[r+t+1];e[r+t]=l*n+f*a+o;e[r+t+1]=l*s+f*i+c}}static applyInverseTransform(e,t){const r=e[0],n=e[1],s=t[0]*t[3]-t[1]*t[2];e[0]=(r*t[3]-n*t[2]+t[2]*t[5]-t[4]*t[3])/s;e[1]=(-r*t[1]+n*t[0]+t[4]*t[1]-t[5]*t[0])/s}static axialAlignedBoundingBox(e,t,r){const n=t[0],s=t[1],a=t[2],i=t[3],o=t[4],c=t[5],l=e[0],f=e[1],u=e[2],h=e[3];let m=n*l+o,g=m,d=n*u+o,p=d,b=i*f+c,y=b,w=i*h+c,C=w;if(0!==s||0!==a){const e=s*l,t=s*u,r=a*f,n=a*h;m+=r;p+=r;d+=n;g+=n;b+=e;C+=e;w+=t;y+=t}r[0]=Math.min(r[0],m,d,g,p);r[1]=Math.min(r[1],b,w,y,C);r[2]=Math.max(r[2],m,d,g,p);r[3]=Math.max(r[3],b,w,y,C)}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){const r=e[0],n=e[1],s=e[2],a=e[3],i=r**2+n**2,o=r*s+n*a,c=s**2+a**2,l=(i+c)/2,f=Math.sqrt(l**2-(i*c-o**2));t[0]=Math.sqrt(l+f||1);t[1]=Math.sqrt(l-f||1)}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){const r=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(r>n)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>a?null:[r,s,n,a]}static pointBoundingBox(e,t,r){r[0]=Math.min(r[0],e);r[1]=Math.min(r[1],t);r[2]=Math.max(r[2],e);r[3]=Math.max(r[3],t)}static rectBoundingBox(e,t,r,n,s){s[0]=Math.min(s[0],e,r);s[1]=Math.min(s[1],t,n);s[2]=Math.max(s[2],e,r);s[3]=Math.max(s[3],t,n)}static#e(e,t,r,n,s,a,i,o,c,l){if(c<=0||c>=1)return;const f=1-c,u=c*c,h=u*c,m=f*(f*(f*e+3*c*t)+3*u*r)+h*n,g=f*(f*(f*s+3*c*a)+3*u*i)+h*o;l[0]=Math.min(l[0],m);l[1]=Math.min(l[1],g);l[2]=Math.max(l[2],m);l[3]=Math.max(l[3],g)}static#t(e,t,r,n,s,a,i,o,c,l,f,u){if(Math.abs(c)<1e-12){Math.abs(l)>=1e-12&&this.#e(e,t,r,n,s,a,i,o,-f/l,u);return}const h=l**2-4*f*c;if(h<0)return;const m=Math.sqrt(h),g=2*c;this.#e(e,t,r,n,s,a,i,o,(-l+m)/g,u);this.#e(e,t,r,n,s,a,i,o,(-l-m)/g,u)}static bezierBoundingBox(e,t,r,n,s,a,i,o,c){c[0]=Math.min(c[0],e,i);c[1]=Math.min(c[1],t,o);c[2]=Math.max(c[2],e,i);c[3]=Math.max(c[3],t,o);this.#t(e,r,s,i,t,n,a,o,3*(3*(r-s)-e+i),6*(e-2*r+s),3*(r-e),c);this.#t(e,r,s,i,t,n,a,o,3*(3*(n-a)-t+o),6*(t-2*n+a),3*(n-t),c)}}const makeArr=()=>[];"function"!=typeof Iterator.prototype.join&&(Iterator.prototype.join=function(e){return[...this].join(e)});const n=async function JBig2(e={}){var t=e,quit_=(e,t)=>{throw t},r=import.meta.url;try{new URL(".",r).href}catch{}0;console.log.bind(console);var n,s,a=console.error.bind(console),i=!1;function updateMemoryViews(){if(!s?.buffer?.resizable){var e=function getMemoryBuffer(){return g.buffer}();s=new Int8Array(e);o=new Uint8Array(e)}}class ExitStatus{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`;this.status=e}}var o,callRuntimeCallbacks=e=>{for(;e.length>0;)e.shift()(t)},c=[],l=[],f=!0,u=0,h={},handleException=e=>{if(e instanceof ExitStatus||"unwind"==e)return n;quit_(0,e)},keepRuntimeAlive=()=>f||u>0,_proc_exit=e=>{n=e;if(!keepRuntimeAlive()){t.onExit?.(e);i=!0}quit_(0,new ExitStatus(e))},_exit=(e,t)=>{n=e;_proc_exit(e)},callUserCallback=e=>{if(!i)try{return e()}catch(e){handleException(e)}finally{(()=>{if(!keepRuntimeAlive())try{_exit(n)}catch(e){handleException(e)}})()}},alignMemory=(e,t)=>Math.ceil(e/t)*t,growMemory=e=>{var t=(e-g.buffer.byteLength+65535)/65536|0;try{g.grow(t);updateMemoryViews();return 1}catch(e){}};t.noExitRuntime&&(f=t.noExitRuntime);t.print&&t.print;t.printErr&&(a=t.printErr);t.arguments&&t.arguments;t.thisProgram&&t.thisProgram;var m,g,d=t.preInit;if(d){"function"==typeof d&&(t.preInit=d=[d]);for(;d.length>0;)d.shift()()}t.writeArrayToMemory=(e,t)=>{s.set(e,t)};var p,b={e:()=>function abort(e){t.onAbort?.(e);a(e=`Aborted(${e})`);i=!0;e+=". Build with -sASSERTIONS for more info.";throw new WebAssembly.RuntimeError(e)}(""),d:()=>{f=!1;u=0},a:(e,t)=>{if(h[e]){clearTimeout(h[e].id);delete h[e]}if(!t)return 0;var r=setTimeout(()=>{delete h[e];callUserCallback(()=>m(e,performance.now()))},t);h[e]={id:r,timeout_ms:t};return 0},g:function _createImageData(e){t.imageData=new Uint8Array(e)},b:e=>{var t=o.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n=1;n<=4;n*=2){var s=t*(1+.2/n);s=Math.min(s,e+100663296);var a=Math.min(r,alignMemory(Math.max(e,s),65536));if(growMemory(a))return!0}return!1},c:_proc_exit,h:function _setImageData(e,r,n,s){if(n===r){t.imageData=new Uint8ClampedArray(o.subarray(e,e+n*s));return}const a=r*s,i=t.imageData=new Uint8ClampedArray(a);for(let t=e,s=0;s<a;t+=n,s+=r)i.set(o.subarray(t,t+r),s)},f:function _setLineData(e,r,n){t.imageData.set(o.subarray(e,e+r),n)}};p=await async function createWasm(){function receiveInstance(e){!function assignWasmExports(e){t._malloc=e.k;t._free=e.l;t._jbig2_decode=e.m;t._ccitt_decode=e.n;m=e.o;g=e.i;e.__indirect_function_table}(p=e.exports);updateMemoryViews();return p}var e=function getWasmImports(){return{a:b}}(),r=t.instantiateWasm;return new Promise(t=>{r(e,e=>t(receiveInstance(e)))})}();await async function run(){!function preRun(){var e=t.preRun;if(e){"function"==typeof e&&(e=[e]);l.push(...e)}callRuntimeCallbacks(l)}();var e=t.setStatus;if(e){e("Running...");await new Promise(e=>setTimeout(e,1));setTimeout(e,1,"")}if(!i){!function initRuntime(){0;p.j()}();t.onRuntimeInitialized?.();!function postRun(){var e=t.postRun;if(e){"function"==typeof e&&(e=[e]);c.push(...e)}callRuntimeCallbacks(c)}()}}();return t},s=(Symbol("CIRCULAR_REF"),Symbol("EOF"),new Map,new Map),a=new Map;class Name{constructor(e){this.name=e}static get(e){let t=s.get(e);if(!t){t=new Name(e);s.set(e,t)}return t}}const nonSerializable=()=>nonSerializable;class Dict{__nonSerializable__=nonSerializable;#r=new Map;objId=null;suppressEncryption=!1;xref;constructor(e=null){this.xref=e}assignXref(e){this.xref=e}get size(){return this.#r.size}#n(e,t,r){let n=this.#r.get(t);void 0===n&&void 0!==r&&(n=this.#r.get(r));return n instanceof Ref&&this.xref?e?this.xref.fetchAsync(n,this.suppressEncryption):this.xref.fetch(n,this.suppressEncryption):n}get(e,t){return this.#n(!1,e,t)}async getAsync(e,t){return this.#n(!0,e,t)}getArray(e,t){let r=this.#n(!1,e,t);if(Array.isArray(r)){r=r.slice();for(let e=0,t=r.length;e<t;e++)r[e]instanceof Ref&&this.xref&&(r[e]=this.xref.fetch(r[e],this.suppressEncryption))}return r}getRaw(e){return this.#r.get(e)}getKeys(){return this.#r.keys()}getRawValues(){return this.#r.values()}getRawEntries(){return this.#r.entries()}set(e,t){this.#r.set(e,t)}setIfNotExists(e,t){this.has(e)||this.set(e,t)}setIfNumber(e,t){"number"==typeof t&&this.set(e,t)}setIfArray(e,t){(Array.isArray(t)||ArrayBuffer.isView(t))&&this.set(e,t)}setIfDefined(e,t){null!=t&&this.set(e,t)}setIfName(e,t){"string"==typeof t?this.set(e,Name.get(t)):t instanceof Name&&this.set(e,t)}setIfDict(e,t){t instanceof Dict&&this.set(e,t)}has(e){return this.#r.has(e)}*[Symbol.iterator](){for(const[e,t]of this.#r)yield[e,t instanceof Ref&&this.xref?this.xref.fetch(t,this.suppressEncryption):t]}static get empty(){const e=new Dict(null);e.set=(e,t)=>{unreachable("Should not call `set` on the empty dictionary.")};return shadow(this,"empty",e)}static merge({xref:e,dictArray:t,mergeSubDicts:r=!1}){const n=new Dict(e),s=new Map;for(const e of t)if(e instanceof Dict)for(const[t,n]of e.getRawEntries()){const e=s.getOrInsertComputed(t,makeArr);(!e.length||r&&n instanceof Dict)&&e.push(n)}for(const[t,r]of s){if(1===r.length||!(r[0]instanceof Dict)){n.set(t,r[0]);continue}const s=new Dict(e);for(const e of r)for(const[t,r]of e.getRawEntries())s.setIfNotExists(t,r);s.size>0&&n.set(t,s)}s.clear();return n.size>0?n:Dict.empty}clone(){const e=new Dict(this.xref);for(const[t,r]of this.#r)e.set(t,r);return e}delete(e){this.#r.delete(e)}}class Ref{#s;constructor(e,t,r){this.#s=e;this.num=t;this.gen=r}toString(){return this.#s}static fromString(e){let t=a.get(e);if(t)return t;const r=/^([1-9]\d*)R([1-9]\d*)?$/.exec(e);if(!r)return null;t=new Ref(e,parseInt(r[1],10),r[2]?parseInt(r[2],10):0);a.set(e,t);return t}static get(e,t){const r=0===t?`${e}R`:`${e}R${t}`;let n=a.get(r);if(!n){n=new Ref(r,e,t);a.set(r,n)}return n}}Symbol.iterator;Symbol.iterator;class BaseStream{get length(){unreachable("Abstract getter `length` accessed")}get isEmpty(){unreachable("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return shadow(this,"isDataLoaded",!0)}getByte(){unreachable("Abstract method `getByte` called")}getBytes(e){unreachable("Abstract method `getBytes` called")}async getImageData(e,t){return this.getBytes(e,t)}async asyncGetBytes(){unreachable("Abstract method `asyncGetBytes` called")}get isAsync(){return!1}get isAsyncDecoder(){return!1}get isImageStream(){return!1}get canAsyncDecodeImageFromBuffer(){return!1}async getTransferableImage(e,t){return null}peekByte(){const e=this.getByte();-1!==e&&this.pos--;return e}peekBytes(e){const t=this.getBytes(e);this.pos-=t.length;return t}getUint16(){const e=this.getByte(),t=this.getByte();return-1===e||-1===t?-1:(e<<8)+t}getInt32(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()}getByteRange(e,t){unreachable("Abstract method `getByteRange` called")}getString(e){return bytesToString(this.getBytes(e))}skip(e){this.pos+=e||1}reset(){unreachable("Abstract method `reset` called")}moveStart(){unreachable("Abstract method `moveStart` called")}makeSubStream(e,t,r=null){unreachable("Abstract method `makeSubStream` called")}clone(){unreachable("Abstract method `clone` called")}getBaseStreams(){return null}getOriginalStream(){return this.stream?.getOriginalStream()||this}}Object.create(null);class MissingDataException extends r{constructor(e,t){super(`Missing data [${e}, ${t})`,"MissingDataException");this.begin=e;this.end=t}}class WasmImage{static#a=null;static#i=new Set;static#o=!0;static#c=!0;static#l=null;#f=null;#u=null;_filename=null;_noWasmFilename=null;static setOptions({handler:e,useWasm:t,useWorkerFetch:r,wasmUrl:n}){WasmImage.#o=t;WasmImage.#c=r;WasmImage.#l=n;r||(WasmImage.#a=e)}static get instance(){unreachable("Abstract getter `instance` accessed")}static cleanup(){for(const e of WasmImage.#i)e.#u=null}constructor(e=!1){e&&WasmImage.#i.add(this)}async#h(e){let t=null;try{t=(await(import(
|
|
26
26
|
/*webpackIgnore: true*/
|