/** * @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 = 7.0.306 * pdfjsBuild = 99b87c5d5 */ export const __webpack_esm_ids__ = ["openjpeg"]; export const __webpack_esm_modules__ = { /***/ 3530 (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); async function OpenJPEG(moduleArg = {}) { var Module = moduleArg; var _scriptName = import.meta.url; var scriptDirectory = ""; var readAsync; try { scriptDirectory = new URL(".", _scriptName).href; } catch {} readAsync = async url => { var response = await fetch(url, { credentials: "same-origin" }); if (response.ok) return response.arrayBuffer(); throw new Error(response.status + " : " + response.url); }; var out = console.log.bind(console); var err = console.error.bind(console); var ABORT = false; function getMemoryBuffer() { return wasmMemory.buffer; } function updateMemoryViews() { if (HEAP8?.buffer?.resizable) return; var b = getMemoryBuffer(); HEAP8 = new Int8Array(b); HEAPU8 = new Uint8Array(b); HEAP32 = new Int32Array(b); HEAPU32 = new Uint32Array(b); } function preRun() { var preRun = Module["preRun"]; if (preRun) { if (typeof preRun === "function") preRun = [preRun]; onPreRuns.push(...preRun); } callRuntimeCallbacks(onPreRuns); } function initRuntime() { 0; wasmExports["j"](); } function postRun() { var postRun = Module["postRun"]; if (postRun) { if (typeof postRun === "function") postRun = [postRun]; onPostRuns.push(...postRun); } callRuntimeCallbacks(onPostRuns); } var wasmBinaryFile; function getWasmImports() { var imports = { a: wasmImports }; return imports; } var HEAP8; var callRuntimeCallbacks = callbacks => { while (callbacks.length > 0) callbacks.shift()(Module); }; var onPostRuns = []; var onPreRuns = []; var HEAP32; var HEAPU8; var alignMemory = (size, alignment) => Math.ceil(size / alignment) * alignment; var getHeapMax = () => 2147483648; var growMemory = size => { var oldHeapSize = wasmMemory.buffer.byteLength; var pages = (size - oldHeapSize + 65535) / 65536 | 0; try { wasmMemory.grow(pages); updateMemoryViews(); return 1; } catch (e) {} }; var bigintToI53Checked = num => num < -9007199254740992 || num > 9007199254740992 ? NaN : Number(num); var HEAPU32; var UTF8Decoder = globalThis.TextDecoder && new TextDecoder(); var findStringEnd = (heapOrArray, idx, maxBytesToRead, ignoreNul) => { var maxIdx = idx + maxBytesToRead; if (ignoreNul) return maxIdx; while (heapOrArray[idx] && !(idx >= maxIdx)) ++idx; return idx; }; var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead, ignoreNul) => { var endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul); if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); var str = ""; while (idx < endPtr) { var u0 = heapOrArray[idx++]; if (!(u0 & 128)) { str += String.fromCharCode(u0); continue; } var u1 = heapOrArray[idx++] & 63; if ((u0 & 224) == 192) { str += String.fromCharCode((u0 & 31) << 6 | u1); continue; } var u2 = heapOrArray[idx++] & 63; if ((u0 & 240) == 224) u0 = (u0 & 15) << 12 | u1 << 6 | u2;else u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63; if (u0 < 65536) str += String.fromCharCode(u0);else { var ch = u0 - 65536; str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); } } return str; }; var printCharBuffers = [null, [], []]; var printChar = (stream, curr) => { var buffer = printCharBuffers[stream]; if (!curr || curr === 10) { (stream === 1 ? out : err)(UTF8ArrayToString(buffer)); buffer.length = 0; } else buffer.push(curr); }; var UTF8ToString = (ptr, maxBytesToRead, ignoreNul) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead, ignoreNul) : ""; if (Module["noExitRuntime"]) Module["noExitRuntime"]; if (Module["print"]) out = Module["print"]; if (Module["printErr"]) err = Module["printErr"]; if (Module["arguments"]) Module["arguments"]; if (Module["thisProgram"]) Module["thisProgram"]; var preInit = Module["preInit"]; if (preInit) { if (typeof preInit === "function") Module["preInit"] = preInit = [preInit]; while (preInit.length > 0) preInit.shift()(); } Module["writeArrayToMemory"] = (array, buffer) => { HEAP8.set(array, buffer); }; var wasmMemory; function assignWasmExports(wasmExports) { Module["_malloc"] = wasmExports["k"]; Module["_free"] = wasmExports["l"]; Module["_jp2_decode"] = wasmExports["m"]; wasmMemory = wasmExports["i"]; wasmExports["__indirect_function_table"]; } var wasmImports = { g: function (comp_ptr, index, nb_comps, nb_pixels) { comp_ptr >>= 2; const imageData = Module.imageData; const comp = HEAP32.subarray(comp_ptr, comp_ptr + nb_pixels); for (let i = 0, j = index; i < nb_pixels; i++, j += nb_comps) imageData[j] = comp[i]; }, c: requestedSize => { var oldSize = HEAPU8.length; requestedSize >>>= 0; var maxHeapSize = getHeapMax(); if (requestedSize > maxHeapSize) return false; for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { var overGrownHeapSize = oldSize * (1 + .2 / cutDown); overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536)); var replacement = growMemory(newSize); if (replacement) return true; } return false; }, d: function (fd, offset) { offset = bigintToI53Checked(offset); return 70; }, b: (fd, iov, iovcnt, pnum) => { var num = 0; for (var i = 0; i < iovcnt; i++) { var ptr = HEAPU32[iov >> 2]; var len = HEAPU32[iov + 4 >> 2]; iov += 8; for (var j = 0; j < len; j++) printChar(fd, HEAPU8[ptr + j]); num += len; } HEAPU32[pnum >> 2] = num; return 0; }, h: function (size) { Module.imageData = new Uint8ClampedArray(size); }, e: function (message_ptr) { const message = UTF8ToString(message_ptr); (Module.warn || console.warn)(`OpenJPEG: ${message}`); }, f: function (array_ptr, array_size) { Module.imageData = new Uint8ClampedArray(HEAPU8.slice(array_ptr, array_ptr + array_size).buffer); }, a: function (message_ptr) { const message = UTF8ToString(message_ptr); if (!Module.errorMessages) Module.errorMessages = message;else Module.errorMessages += "\n" + message; } }; var wasmExports; wasmExports = await async function () { function receiveInstance(instance) { wasmExports = instance.exports; assignWasmExports(wasmExports); updateMemoryViews(); return wasmExports; } var info = getWasmImports(); var instantiateWasm = Module["instantiateWasm"]; return new Promise(resolve => { instantiateWasm(info, inst => resolve(receiveInstance(inst))); }); }(); await async function () { preRun(); var setStatus = Module["setStatus"]; if (setStatus) { setStatus("Running..."); await new Promise(resolve => setTimeout(resolve, 1)); setTimeout(setStatus, 1, ""); } if (ABORT) return; initRuntime(); Module["onRuntimeInitialized"]?.(); postRun(); }(); return Module; } /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (OpenJPEG); /* harmony export */ __webpack_require__.d(__webpack_exports__, [ /* harmony export */ "default", 0, __WEBPACK_DEFAULT_EXPORT__ /* harmony export */ ]); /***/ } };