vendor: 10,968 bytes, lines 1-356
1/** 2 * @licstart The following is the entire license notice for the 3 * JavaScript code in this page 4 * 5 * Copyright 2022 Mozilla Foundation 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * 19 * @licend The above is the entire license notice for the 20 * JavaScript code in this page 21 */ 22 23(function webpackUniversalModuleDefinition(root, factory) { 24 if(typeof exports === 'object' && typeof module === 'object') 25 module.exports = factory(); 26 else if(typeof define === 'function' && define.amd) 27 define("pdfjs-dist/build/pdf.worker", [], factory); 28 else if(typeof exports === 'object') 29 exports["pdfjs-dist/build/pdf.worker"] = factory(); 30 else 31 root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory(); 32})(globalThis, () => { 33return /******/ (() => { // webpackBootstrap 34/******/ "use strict"; 35/******/ var __webpack_modules__ = ([ 36/* 0 */, 37/* 1 */ 38/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 39 40 41 42Object.defineProperty(exports, "__esModule", ({ 43 value: true 44})); 45exports.WorkerTask = exports.WorkerMessageHandler = void 0; 46 47var _util = __w_pdfjs_require__(2); 48 49var _primitives = __w_pdfjs_require__(5); 50 51var _core_utils = __w_pdfjs_require__(6); 52 53var _pdf_manager = __w_pdfjs_require__(8); 54 55var _cleanup_helper = __w_pdfjs_require__(71); 56 57var _writer = __w_pdfjs_require__(65); 58 59var _is_node = __w_pdfjs_require__(4); 60 61var _message_handler = __w_pdfjs_require__(102); 62 63var _worker_stream = __w_pdfjs_require__(103); 64 65class WorkerTask { 66 constructor(name) { 67 this.name = name; 68 this.terminated = false; 69 this._capability = (0, _util.createPromiseCapability)(); 70 } 71 72 get finished() { 73 return this._capability.promise; 74 } 75 76 finish() { 77 this._capability.resolve(); 78 } 79 80 terminate() { 81 this.terminated = true; 82 } 83 84 ensureNotTerminated() { 85 if (this.terminated) { 86 throw new Error("Worker task was terminated"); 87 } 88 } 89 90} 91 92exports.WorkerTask = WorkerTask; 93 94class WorkerMessageHandler { 95 static setup(handler, port) { 96 let testMessageProcessed = false; 97 handler.on("test", function wphSetupTest(data) { 98 if (testMessageProcessed) { 99 return; 100 } 101 102 testMessageProcessed = true; 103 handler.send("test", data instanceof Uint8Array); 104 }); 105 handler.on("configure", function wphConfigure(data) { 106 (0, _util.setVerbosityLevel)(data.verbosity); 107 }); 108 handler.on("GetDocRequest", function wphSetupDoc(data) { 109 return WorkerMessageHandler.createDocumentHandler(data, port); 110 }); 111 } 112 113 static createDocumentHandler(docParams, port) { 114 let pdfManager; 115 let terminated = false; 116 let cancelXHRs = null; 117 const WorkerTasks = []; 118 const verbosity = (0, _util.getVerbosityLevel)(); 119 const apiVersion = docParams.apiVersion; 120 const workerVersion = '2.16.105'; 121 122 if (apiVersion !== workerVersion) { 123 throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); 124 } 125 126 const enumerableProperties = []; 127 128 for (const property in []) { 129 enumerableProperties.push(property); 130 } 131 132 if (enumerableProperties.length) { 133 throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s."); 134 } 135 136 if (typeof ReadableStream === "undefined") { 137 const partialMsg = "The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); "; 138 139 if (_is_node.isNodeJS) { 140 throw new Error(partialMsg + "please use a `legacy`-build instead."); 141 } 142 143 throw new Error(partialMsg + "please update to a supported browser."); 144 } 145 146 const docId = docParams.docId; 147 const docBaseUrl = docParams.docBaseUrl; 148 const workerHandlerName = docParams.docId + "_worker"; 149 let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port); 150 151 function ensureNotTerminated() { 152 if (terminated) { 153 throw new Error("Worker was terminated"); 154 } 155 } 156 157 function startWorkerTask(task) { 158 WorkerTasks.push(task); 159 } 160 161 function finishWorkerTask(task) { 162 task.finish(); 163 const i = WorkerTasks.indexOf(task); 164 WorkerTasks.splice(i, 1); 165 } 166 167 async function loadDocument(recoveryMode) { 168 await pdfManager.ensureDoc("checkHeader"); 169 await pdfManager.ensureDoc("parseStartXRef"); 170 await pdfManager.ensureDoc("parse", [recoveryMode]); 171 await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]); 172 await pdfManager.ensureDoc("checkLastPage", [recoveryMode]); 173 const isPureXfa = await pdfManager.ensureDoc("isPureXfa"); 174 175 if (isPureXfa) { 176 const task = new WorkerTask("loadXfaFonts"); 177 startWorkerTask(task); 178 await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]); 179 } 180 181 const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]); 182 const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null; 183 return { 184 numPages, 185 fingerprints, 186 htmlForXfa 187 }; 188 } 189 190 function getPdfManager(data, evaluatorOptions, enableXfa) { 191 const pdfManagerCapability = (0, _util.createPromiseCapability)(); 192 let newPdfManager; 193 const source = data.source; 194 195 if (source.data) { 196 try { 197 newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl); 198 pdfManagerCapability.resolve(newPdfManager); 199 } catch (ex) { 200 pdfManagerCapability.reject(ex); 201 } 202 203 return pdfManagerCapability.promise; 204 } 205 206 let pdfStream, 207 cachedChunks = []; 208 209 try { 210 pdfStream = new _worker_stream.PDFWorkerStream(handler); 211 } catch (ex) { 212 pdfManagerCapability.reject(ex); 213 return pdfManagerCapability.promise; 214 } 215 216 const fullRequest = pdfStream.getFullReader(); 217 fullRequest.headersReady.then(function () { 218 if (!fullRequest.isRangeSupported) { 219 return; 220 } 221 222 const disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported; 223 newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, { 224 msgHandler: handler, 225 password: source.password, 226 length: fullRequest.contentLength, 227 disableAutoFetch, 228 rangeChunkSize: source.rangeChunkSize 229 }, evaluatorOptions, enableXfa, docBaseUrl); 230 231 for (const chunk of cachedChunks) { 232 newPdfManager.sendProgressiveData(chunk); 233 } 234 235 cachedChunks = []; 236 pdfManagerCapability.resolve(newPdfManager); 237 cancelXHRs = null; 238 }).catch(function (reason) { 239 pdfManagerCapability.reject(reason); 240 cancelXHRs = null; 241 }); 242 let loaded = 0; 243 244 const flushChunks = function () { 245 const pdfFile = (0, _util.arraysToBytes)(cachedChunks); 246 247 if (source.length && pdfFile.length !== source.length) { 248 (0, _util.warn)("reported HTTP length is different from actual"); 249 } 250 251 try { 252 newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl); 253 pdfManagerCapability.resolve(newPdfManager); 254 } catch (ex) { 255 pdfManagerCapability.reject(ex); 256 } 257 258 cachedChunks = []; 259 }; 260 261 const readPromise = new Promise(function (resolve, reject) { 262 const readChunk = function ({ 263 value, 264 done 265 }) { 266 try { 267 ensureNotTerminated(); 268 269 if (done) { 270 if (!newPdfManager) { 271 flushChunks(); 272 } 273 274 cancelXHRs = null; 275 return; 276 } 277 278 loaded += (0, _util.arrayByteLength)(value); 279 280 if (!fullRequest.isStreamingSupported) { 281 handler.send("DocProgress", { 282 loaded, 283 total: Math.max(loaded, fullRequest.contentLength || 0) 284 }); 285 } 286 287 if (newPdfManager) { 288 newPdfManager.sendProgressiveData(value); 289 } else { 290 cachedChunks.push(value); 291 } 292 293 fullRequest.read().then(readChunk, reject); 294 } catch (e) { 295 reject(e); 296 } 297 }; 298 299 fullRequest.read().then(readChunk, reject); 300 }); 301 readPromise.catch(function (e) { 302 pdfManagerCapability.reject(e); 303 cancelXHRs = null; 304 }); 305 306 cancelXHRs = function (reason) { 307 pdfStream.cancelAllRequests(reason); 308 }; 309 310 return pdfManagerCapability.promise; 311 } 312 313 function setupDoc(data) { 314 function onSuccess(doc) { 315 ensureNotTerminated(); 316 handler.send("GetDoc", { 317 pdfInfo: doc 318 }); 319 } 320 321 function onFailure(ex) { 322 ensureNotTerminated(); 323 324 if (ex instanceof _util.PasswordException) { 325 const task = new WorkerTask(`PasswordException: response ${ex.code}`); 326 startWorkerTask(task); 327 handler.sendWithPromise("PasswordRequest", ex).then(function ({ 328 password 329 }) { 330 finishWorkerTask(task); 331 pdfManager.updatePassword(password); 332 pdfManagerReady(); 333 }).catch(function () { 334 finishWorkerTask(task); 335 handler.send("DocException", ex); 336 }); 337 } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) { 338 handler.send("DocException", ex); 339 } else { 340 handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString())); 341 } 342 } 343 344 function pdfManagerReady() { 345 ensureNotTerminated(); 346 loadDocument(false).then(onSuccess, function (reason) { 347 ensureNotTerminated(); 348 349 if (!(reason instanceof _core_utils.XRefParseException)) { 350 onFailure(reason); 351 return; 352 } 353 354 pdfManager.requestLoadedStream(); 355 pdfManager.onLoadedStream().then(function () { 356 ensureNotTerminated();
357 loadDocument(true).then(onSuccess, onFailure); 358 }); 359 }); 360 } 361 362 ensureNotTerminated(); 363 const evaluatorOptions = { 364 maxImageSize: data.maxImageSize, 365 disableFontFace: data.disableFontFace, 366 ignoreErrors: data.ignoreErrors, 367 isEvalSupported: data.isEvalSupported, 368 fontExtraProperties: data.fontExtraProperties, 369 useSystemFonts: data.useSystemFonts, 370 cMapUrl: data.cMapUrl, 371 standardFontDataUrl: data.standardFontDataUrl 372 }; 373 getPdfManager(data, evaluatorOptions, data.enableXfa).then(function (newPdfManager) { 374 if (terminated) { 375 newPdfManager.terminate(new _util.AbortException("Worker was terminated.")); 376 throw new Error("Worker was terminated"); 377 } 378 379 pdfManager = newPdfManager; 380 pdfManager.onLoadedStream().then(function (stream) { 381 handler.send("DataLoaded", { 382 length: stream.bytes.byteLength 383 }); 384 }); 385 }).then(pdfManagerReady, onFailure); 386 } 387 388 handler.on("GetPage", function wphSetupGetPage(data) { 389 return pdfManager.getPage(data.pageIndex).then(function (page) { 390 return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) { 391 return { 392 rotate, 393 ref, 394 userUnit, 395 view 396 }; 397 }); 398 }); 399 }); 400 handler.on("GetPageIndex", function wphSetupGetPageIndex(data) { 401 const pageRef = _primitives.Ref.get(data.num, data.gen); 402 403 return pdfManager.ensureCatalog("getPageIndex", [pageRef]); 404 }); 405 handler.on("GetDestinations", function wphSetupGetDestinations(data) { 406 return pdfManager.ensureCatalog("destinations"); 407 }); 408 handler.on("GetDestination", function wphSetupGetDestination(data) { 409 return pdfManager.ensureCatalog("getDestination", [data.id]); 410 }); 411 handler.on("GetPageLabels", function wphSetupGetPageLabels(data) { 412 return pdfManager.ensureCatalog("pageLabels"); 413 }); 414 handler.on("GetPageLayout", function wphSetupGetPageLayout(data) { 415 return pdfManager.ensureCatalog("pageLayout"); 416 }); 417 handler.on("GetPageMode", function wphSetupGetPageMode(data) { 418 return pdfManager.ensureCatalog("pageMode"); 419 }); 420 handler.on("GetViewerPreferences", function (data) { 421 return pdfManager.ensureCatalog("viewerPreferences"); 422 }); 423 handler.on("GetOpenAction", function (data) { 424 return pdfManager.ensureCatalog("openAction"); 425 }); 426 handler.on("GetAttachments", function wphSetupGetAttachments(data) { 427 return pdfManager.ensureCatalog("attachments"); 428 }); 429 handler.on("GetJavaScript", function wphSetupGetJavaScript(data) { 430 return pdfManager.ensureCatalog("javaScript"); 431 }); 432 handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) { 433 return pdfManager.ensureCatalog("jsActions"); 434 }); 435 handler.on("GetPageJSActions", function ({ 436 pageIndex 437 }) { 438 return pdfManager.getPage(pageIndex).then(function (page) { 439 return pdfManager.ensure(page, "jsActions"); 440 }); 441 }); 442 handler.on("GetOutline", function wphSetupGetOutline(data) { 443 return pdfManager.ensureCatalog("documentOutline"); 444 }); 445 handler.on("GetOptionalContentConfig", function (data) { 446 return pdfManager.ensureCatalog("optionalContentConfig"); 447 }); 448 handler.on("GetPermissions", function (data) { 449 return pdfManager.ensureCatalog("permissions"); 450 }); 451 handler.on("GetMetadata", function wphSetupGetMetadata(data) { 452 return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]); 453 }); 454 handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) { 455 return pdfManager.ensureCatalog("markInfo"); 456 }); 457 handler.on("GetData", function wphSetupGetData(data) { 458 pdfManager.requestLoadedStream(); 459 return pdfManager.onLoadedStream().then(function (stream) { 460 return stream.bytes; 461 }); 462 }); 463 handler.on("GetAnnotations", function ({ 464 pageIndex, 465 intent 466 }) { 467 return pdfManager.getPage(pageIndex).then(function (page) { 468 const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`); 469 startWorkerTask(task); 470 return page.getAnnotationsData(handler, task, intent).then(data => { 471 finishWorkerTask(task); 472 return data; 473 }, reason => { 474 finishWorkerTask(task); 475 }); 476 }); 477 }); 478 handler.on("GetFieldObjects", function (data) { 479 return pdfManager.ensureDoc("fieldObjects"); 480 }); 481 handler.on("HasJSActions", function (data) { 482 return pdfManager.ensureDoc("hasJSActions"); 483 }); 484 handler.on("GetCalculationOrderIds", function (data) { 485 return pdfManager.ensureDoc("calculationOrderIds"); 486 }); 487 handler.on("SaveDocument", function ({ 488 isPureXfa, 489 numPages, 490 annotationStorage, 491 filename 492 }) { 493 pdfManager.requestLoadedStream(); 494 const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null; 495 const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")]; 496 497 if (newAnnotationsByPage) { 498 for (const [pageIndex, annotations] of newAnnotationsByPage) { 499 promises.push(pdfManager.getPage(pageIndex).then(page => { 500 const task = new WorkerTask(`Save (editor): page ${pageIndex}`); 501 return page.saveNewAnnotations(handler, task, annotations).finally(function () { 502 finishWorkerTask(task); 503 }); 504 })); 505 } 506 } 507 508 if (isPureXfa) { 509 promises.push(pdfManager.serializeXfaData(annotationStorage)); 510 } else { 511 for (let pageIndex = 0; pageIndex < numPages; pageIndex++) { 512 promises.push(pdfManager.getPage(pageIndex).then(function (page) { 513 const task = new WorkerTask(`Save: page ${pageIndex}`); 514 return page.save(handler, task, annotationStorage).finally(function () { 515 finishWorkerTask(task); 516 }); 517 })); 518 } 519 } 520 521 return Promise.all(promises).then(function ([stream, acroForm, acroFormRef, xref, startXRef, ...refs]) { 522 let newRefs = []; 523 let xfaData = null; 524 525 if (isPureXfa) { 526 xfaData = refs[0]; 527 528 if (!xfaData) { 529 return stream.bytes; 530 } 531 } else { 532 newRefs = refs.flat(2); 533 534 if (newRefs.length === 0) { 535 return stream.bytes; 536 } 537 } 538 539 const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null; 540 let xfaDatasetsRef = null; 541 let hasXfaDatasetsEntry = false;
vendor: 10,940 bytes, lines 542-897
542 543 if (Array.isArray(xfa)) { 544 for (let i = 0, ii = xfa.length; i < ii; i += 2) { 545 if (xfa[i] === "datasets") { 546 xfaDatasetsRef = xfa[i + 1]; 547 acroFormRef = null; 548 hasXfaDatasetsEntry = true; 549 } 550 } 551 552 if (xfaDatasetsRef === null) { 553 xfaDatasetsRef = xref.getNewRef(); 554 } 555 } else if (xfa) { 556 acroFormRef = null; 557 (0, _util.warn)("Unsupported XFA type."); 558 } 559 560 let newXrefInfo = Object.create(null); 561 562 if (xref.trailer) { 563 const infoObj = Object.create(null); 564 const xrefInfo = xref.trailer.get("Info") || null; 565 566 if (xrefInfo instanceof _primitives.Dict) { 567 xrefInfo.forEach((key, value) => { 568 if (typeof value === "string") { 569 infoObj[key] = (0, _util.stringToPDFString)(value); 570 } 571 }); 572 } 573 574 newXrefInfo = { 575 rootRef: xref.trailer.getRaw("Root") || null, 576 encryptRef: xref.trailer.getRaw("Encrypt") || null, 577 newRef: xref.getNewRef(), 578 infoRef: xref.trailer.getRaw("Info") || null, 579 info: infoObj, 580 fileIds: xref.trailer.get("ID") || null, 581 startXRef, 582 filename 583 }; 584 } 585 586 xref.resetNewRef(); 587 return (0, _writer.incrementalUpdate)({ 588 originalData: stream.bytes, 589 xrefInfo: newXrefInfo, 590 newRefs, 591 xref, 592 hasXfa: !!xfa, 593 xfaDatasetsRef, 594 hasXfaDatasetsEntry, 595 acroFormRef, 596 acroForm, 597 xfaData 598 }); 599 }); 600 }); 601 handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) { 602 const pageIndex = data.pageIndex; 603 pdfManager.getPage(pageIndex).then(function (page) { 604 const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`); 605 startWorkerTask(task); 606 const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0; 607 page.getOperatorList({ 608 handler, 609 sink, 610 task, 611 intent: data.intent, 612 cacheKey: data.cacheKey, 613 annotationStorage: data.annotationStorage 614 }).then(function (operatorListInfo) { 615 finishWorkerTask(task); 616 617 if (start) { 618 (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`); 619 } 620 621 sink.close(); 622 }, function (reason) { 623 finishWorkerTask(task); 624 625 if (task.terminated) { 626 return; 627 } 628 629 handler.send("UnsupportedFeature", { 630 featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList 631 }); 632 sink.error(reason); 633 }); 634 }); 635 }); 636 handler.on("GetTextContent", function wphExtractText(data, sink) { 637 const pageIndex = data.pageIndex; 638 pdfManager.getPage(pageIndex).then(function (page) { 639 const task = new WorkerTask("GetTextContent: page " + pageIndex); 640 startWorkerTask(task); 641 const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0; 642 page.extractTextContent({ 643 handler, 644 task, 645 sink, 646 includeMarkedContent: data.includeMarkedContent, 647 combineTextItems: data.combineTextItems 648 }).then(function () { 649 finishWorkerTask(task); 650 651 if (start) { 652 (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`); 653 } 654 655 sink.close(); 656 }, function (reason) { 657 finishWorkerTask(task); 658 659 if (task.terminated) { 660 return; 661 } 662 663 sink.error(reason); 664 }); 665 }); 666 }); 667 handler.on("GetStructTree", function wphGetStructTree(data) { 668 return pdfManager.getPage(data.pageIndex).then(function (page) { 669 return pdfManager.ensure(page, "getStructTree"); 670 }); 671 }); 672 handler.on("FontFallback", function (data) { 673 return pdfManager.fontFallback(data.id, handler); 674 }); 675 handler.on("Cleanup", function wphCleanup(data) { 676 return pdfManager.cleanup(true); 677 }); 678 handler.on("Terminate", function wphTerminate(data) { 679 terminated = true; 680 const waitOn = []; 681 682 if (pdfManager) { 683 pdfManager.terminate(new _util.AbortException("Worker was terminated.")); 684 const cleanupPromise = pdfManager.cleanup(); 685 waitOn.push(cleanupPromise); 686 pdfManager = null; 687 } else { 688 (0, _cleanup_helper.clearGlobalCaches)(); 689 } 690 691 if (cancelXHRs) { 692 cancelXHRs(new _util.AbortException("Worker was terminated.")); 693 } 694 695 for (const task of WorkerTasks) { 696 waitOn.push(task.finished); 697 task.terminate(); 698 } 699 700 return Promise.all(waitOn).then(function () { 701 handler.destroy(); 702 handler = null; 703 }); 704 }); 705 handler.on("Ready", function wphReady(data) { 706 setupDoc(docParams); 707 docParams = null; 708 }); 709 return workerHandlerName; 710 } 711 712 static initializeFromPort(port) { 713 const handler = new _message_handler.MessageHandler("worker", "main", port); 714 WorkerMessageHandler.setup(handler, port); 715 handler.send("ready", null); 716 } 717 718} 719 720exports.WorkerMessageHandler = WorkerMessageHandler; 721 722function isMessagePort(maybePort) { 723 return typeof maybePort.postMessage === "function" && "onmessage" in maybePort; 724} 725 726if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) { 727 WorkerMessageHandler.initializeFromPort(self); 728} 729 730/***/ }), 731/* 2 */ 732/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 733 734 735 736Object.defineProperty(exports, "__esModule", ({ 737 value: true 738})); 739exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.LINE_FACTOR = exports.LINE_DESCENT_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationEditorParamsType = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0; 740exports.arrayByteLength = arrayByteLength; 741exports.arraysToBytes = arraysToBytes; 742exports.assert = assert; 743exports.bytesToString = bytesToString; 744exports.createPromiseCapability = createPromiseCapability; 745exports.createValidAbsoluteUrl = createValidAbsoluteUrl; 746exports.escapeString = escapeString; 747exports.getModificationDate = getModificationDate; 748exports.getVerbosityLevel = getVerbosityLevel; 749exports.info = info; 750exports.isArrayBuffer = isArrayBuffer; 751exports.isArrayEqual = isArrayEqual; 752exports.isAscii = isAscii; 753exports.objectFromMap = objectFromMap; 754exports.objectSize = objectSize; 755exports.setVerbosityLevel = setVerbosityLevel; 756exports.shadow = shadow; 757exports.string32 = string32; 758exports.stringToBytes = stringToBytes; 759exports.stringToPDFString = stringToPDFString; 760exports.stringToUTF16BEString = stringToUTF16BEString; 761exports.stringToUTF8String = stringToUTF8String; 762exports.unreachable = unreachable; 763exports.utf8StringToString = utf8StringToString; 764exports.warn = warn; 765 766__w_pdfjs_require__(3); 767 768const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; 769exports.IDENTITY_MATRIX = IDENTITY_MATRIX; 770const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; 771exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; 772const LINE_FACTOR = 1.35; 773exports.LINE_FACTOR = LINE_FACTOR; 774const LINE_DESCENT_FACTOR = 0.35; 775exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR; 776const RenderingIntentFlag = { 777 ANY: 0x01, 778 DISPLAY: 0x02, 779 PRINT: 0x04, 780 ANNOTATIONS_FORMS: 0x10, 781 ANNOTATIONS_STORAGE: 0x20, 782 ANNOTATIONS_DISABLE: 0x40, 783 OPLIST: 0x100 784}; 785exports.RenderingIntentFlag = RenderingIntentFlag; 786const AnnotationMode = { 787 DISABLE: 0, 788 ENABLE: 1, 789 ENABLE_FORMS: 2, 790 ENABLE_STORAGE: 3 791}; 792exports.AnnotationMode = AnnotationMode; 793const AnnotationEditorPrefix = "pdfjs_internal_editor_"; 794exports.AnnotationEditorPrefix = AnnotationEditorPrefix; 795const AnnotationEditorType = { 796 DISABLE: -1, 797 NONE: 0, 798 FREETEXT: 3, 799 INK: 15 800}; 801exports.AnnotationEditorType = AnnotationEditorType; 802const AnnotationEditorParamsType = { 803 FREETEXT_SIZE: 1, 804 FREETEXT_COLOR: 2, 805 FREETEXT_OPACITY: 3, 806 INK_COLOR: 11, 807 INK_THICKNESS: 12, 808 INK_OPACITY: 13 809}; 810exports.AnnotationEditorParamsType = AnnotationEditorParamsType; 811const PermissionFlag = { 812 PRINT: 0x04, 813 MODIFY_CONTENTS: 0x08, 814 COPY: 0x10, 815 MODIFY_ANNOTATIONS: 0x20, 816 FILL_INTERACTIVE_FORMS: 0x100, 817 COPY_FOR_ACCESSIBILITY: 0x200, 818 ASSEMBLE: 0x400, 819 PRINT_HIGH_QUALITY: 0x800 820}; 821exports.PermissionFlag = PermissionFlag; 822const TextRenderingMode = { 823 FILL: 0, 824 STROKE: 1, 825 FILL_STROKE: 2, 826 INVISIBLE: 3, 827 FILL_ADD_TO_PATH: 4, 828 STROKE_ADD_TO_PATH: 5, 829 FILL_STROKE_ADD_TO_PATH: 6, 830 ADD_TO_PATH: 7, 831 FILL_STROKE_MASK: 3, 832 ADD_TO_PATH_FLAG: 4 833}; 834exports.TextRenderingMode = TextRenderingMode; 835const ImageKind = { 836 GRAYSCALE_1BPP: 1, 837 RGB_24BPP: 2, 838 RGBA_32BPP: 3 839}; 840exports.ImageKind = ImageKind; 841const AnnotationType = { 842 TEXT: 1, 843 LINK: 2, 844 FREETEXT: 3, 845 LINE: 4, 846 SQUARE: 5, 847 CIRCLE: 6, 848 POLYGON: 7, 849 POLYLINE: 8, 850 HIGHLIGHT: 9, 851 UNDERLINE: 10, 852 SQUIGGLY: 11, 853 STRIKEOUT: 12, 854 STAMP: 13, 855 CARET: 14, 856 INK: 15, 857 POPUP: 16, 858 FILEATTACHMENT: 17, 859 SOUND: 18, 860 MOVIE: 19, 861 WIDGET: 20, 862 SCREEN: 21, 863 PRINTERMARK: 22, 864 TRAPNET: 23, 865 WATERMARK: 24, 866 THREED: 25, 867 REDACT: 26 868}; 869exports.AnnotationType = AnnotationType; 870const AnnotationStateModelType = { 871 MARKED: "Marked", 872 REVIEW: "Review" 873}; 874exports.AnnotationStateModelType = AnnotationStateModelType; 875const AnnotationMarkedState = { 876 MARKED: "Marked", 877 UNMARKED: "Unmarked" 878}; 879exports.AnnotationMarkedState = AnnotationMarkedState; 880const AnnotationReviewState = { 881 ACCEPTED: "Accepted", 882 REJECTED: "Rejected", 883 CANCELLED: "Cancelled", 884 COMPLETED: "Completed", 885 NONE: "None" 886}; 887exports.AnnotationReviewState = AnnotationReviewState; 888const AnnotationReplyType = { 889 GROUP: "Group", 890 REPLY: "R" 891}; 892exports.AnnotationReplyType = AnnotationReplyType; 893const AnnotationFlag = { 894 INVISIBLE: 0x01, 895 HIDDEN: 0x02, 896 PRINT: 0x04, 897 NOZOOM: 0x08,
898 NOROTATE: 0x10, 899 NOVIEW: 0x20, 900 READONLY: 0x40, 901 LOCKED: 0x80, 902 TOGGLENOVIEW: 0x100, 903 LOCKEDCONTENTS: 0x200 904}; 905exports.AnnotationFlag = AnnotationFlag; 906const AnnotationFieldFlag = { 907 READONLY: 0x0000001, 908 REQUIRED: 0x0000002, 909 NOEXPORT: 0x0000004, 910 MULTILINE: 0x0001000, 911 PASSWORD: 0x0002000, 912 NOTOGGLETOOFF: 0x0004000, 913 RADIO: 0x0008000, 914 PUSHBUTTON: 0x0010000, 915 COMBO: 0x0020000, 916 EDIT: 0x0040000, 917 SORT: 0x0080000, 918 FILESELECT: 0x0100000, 919 MULTISELECT: 0x0200000, 920 DONOTSPELLCHECK: 0x0400000, 921 DONOTSCROLL: 0x0800000, 922 COMB: 0x1000000, 923 RICHTEXT: 0x2000000, 924 RADIOSINUNISON: 0x2000000, 925 COMMITONSELCHANGE: 0x4000000 926}; 927exports.AnnotationFieldFlag = AnnotationFieldFlag; 928const AnnotationBorderStyleType = { 929 SOLID: 1, 930 DASHED: 2, 931 BEVELED: 3, 932 INSET: 4, 933 UNDERLINE: 5 934}; 935exports.AnnotationBorderStyleType = AnnotationBorderStyleType; 936const AnnotationActionEventType = { 937 E: "Mouse Enter", 938 X: "Mouse Exit", 939 D: "Mouse Down", 940 U: "Mouse Up", 941 Fo: "Focus", 942 Bl: "Blur", 943 PO: "PageOpen", 944 PC: "PageClose", 945 PV: "PageVisible", 946 PI: "PageInvisible", 947 K: "Keystroke", 948 F: "Format", 949 V: "Validate", 950 C: "Calculate" 951}; 952exports.AnnotationActionEventType = AnnotationActionEventType; 953const DocumentActionEventType = { 954 WC: "WillClose", 955 WS: "WillSave", 956 DS: "DidSave", 957 WP: "WillPrint", 958 DP: "DidPrint" 959}; 960exports.DocumentActionEventType = DocumentActionEventType; 961const PageActionEventType = { 962 O: "PageOpen", 963 C: "PageClose" 964}; 965exports.PageActionEventType = PageActionEventType; 966const StreamType = { 967 UNKNOWN: "UNKNOWN", 968 FLATE: "FLATE", 969 LZW: "LZW", 970 DCT: "DCT", 971 JPX: "JPX", 972 JBIG: "JBIG", 973 A85: "A85", 974 AHX: "AHX", 975 CCF: "CCF", 976 RLX: "RLX" 977}; 978exports.StreamType = StreamType; 979const FontType = { 980 UNKNOWN: "UNKNOWN", 981 TYPE1: "TYPE1", 982 TYPE1STANDARD: "TYPE1STANDARD", 983 TYPE1C: "TYPE1C", 984 CIDFONTTYPE0: "CIDFONTTYPE0", 985 CIDFONTTYPE0C: "CIDFONTTYPE0C", 986 TRUETYPE: "TRUETYPE", 987 CIDFONTTYPE2: "CIDFONTTYPE2", 988 TYPE3: "TYPE3", 989 OPENTYPE: "OPENTYPE", 990 TYPE0: "TYPE0", 991 MMTYPE1: "MMTYPE1" 992}; 993exports.FontType = FontType; 994const VerbosityLevel = { 995 ERRORS: 0, 996 WARNINGS: 1, 997 INFOS: 5 998}; 999exports.VerbosityLevel = VerbosityLevel; 1000const CMapCompressionType = { 1001 NONE: 0, 1002 BINARY: 1, 1003 STREAM: 2 1004}; 1005exports.CMapCompressionType = CMapCompressionType; 1006const OPS = { 1007 dependency: 1, 1008 setLineWidth: 2, 1009 setLineCap: 3, 1010 setLineJoin: 4, 1011 setMiterLimit: 5, 1012 setDash: 6, 1013 setRenderingIntent: 7, 1014 setFlatness: 8, 1015 setGState: 9, 1016 save: 10, 1017 restore: 11, 1018 transform: 12, 1019 moveTo: 13, 1020 lineTo: 14, 1021 curveTo: 15, 1022 curveTo2: 16,
vendor: 138,556 bytes, lines 1023-6612
1023 curveTo3: 17, 1024 closePath: 18, 1025 rectangle: 19, 1026 stroke: 20, 1027 closeStroke: 21, 1028 fill: 22, 1029 eoFill: 23, 1030 fillStroke: 24, 1031 eoFillStroke: 25, 1032 closeFillStroke: 26, 1033 closeEOFillStroke: 27, 1034 endPath: 28, 1035 clip: 29, 1036 eoClip: 30, 1037 beginText: 31, 1038 endText: 32, 1039 setCharSpacing: 33, 1040 setWordSpacing: 34, 1041 setHScale: 35, 1042 setLeading: 36, 1043 setFont: 37, 1044 setTextRenderingMode: 38, 1045 setTextRise: 39, 1046 moveText: 40, 1047 setLeadingMoveText: 41, 1048 setTextMatrix: 42, 1049 nextLine: 43, 1050 showText: 44, 1051 showSpacedText: 45, 1052 nextLineShowText: 46, 1053 nextLineSetSpacingShowText: 47, 1054 setCharWidth: 48, 1055 setCharWidthAndBounds: 49, 1056 setStrokeColorSpace: 50, 1057 setFillColorSpace: 51, 1058 setStrokeColor: 52, 1059 setStrokeColorN: 53, 1060 setFillColor: 54, 1061 setFillColorN: 55, 1062 setStrokeGray: 56, 1063 setFillGray: 57, 1064 setStrokeRGBColor: 58, 1065 setFillRGBColor: 59, 1066 setStrokeCMYKColor: 60, 1067 setFillCMYKColor: 61, 1068 shadingFill: 62, 1069 beginInlineImage: 63, 1070 beginImageData: 64, 1071 endInlineImage: 65, 1072 paintXObject: 66, 1073 markPoint: 67, 1074 markPointProps: 68, 1075 beginMarkedContent: 69, 1076 beginMarkedContentProps: 70, 1077 endMarkedContent: 71, 1078 beginCompat: 72, 1079 endCompat: 73, 1080 paintFormXObjectBegin: 74, 1081 paintFormXObjectEnd: 75, 1082 beginGroup: 76, 1083 endGroup: 77, 1084 beginAnnotations: 78, 1085 endAnnotations: 79, 1086 beginAnnotation: 80, 1087 endAnnotation: 81, 1088 paintJpegXObject: 82, 1089 paintImageMaskXObject: 83, 1090 paintImageMaskXObjectGroup: 84, 1091 paintImageXObject: 85, 1092 paintInlineImageXObject: 86, 1093 paintInlineImageXObjectGroup: 87, 1094 paintImageXObjectRepeat: 88, 1095 paintImageMaskXObjectRepeat: 89, 1096 paintSolidColorImageMask: 90, 1097 constructPath: 91 1098}; 1099exports.OPS = OPS; 1100const UNSUPPORTED_FEATURES = { 1101 unknown: "unknown", 1102 forms: "forms", 1103 javaScript: "javaScript", 1104 signatures: "signatures", 1105 smask: "smask", 1106 shadingPattern: "shadingPattern", 1107 font: "font", 1108 errorTilingPattern: "errorTilingPattern", 1109 errorExtGState: "errorExtGState", 1110 errorXObject: "errorXObject", 1111 errorFontLoadType3: "errorFontLoadType3", 1112 errorFontState: "errorFontState", 1113 errorFontMissing: "errorFontMissing", 1114 errorFontTranslate: "errorFontTranslate", 1115 errorColorSpace: "errorColorSpace", 1116 errorOperatorList: "errorOperatorList", 1117 errorFontToUnicode: "errorFontToUnicode", 1118 errorFontLoadNative: "errorFontLoadNative", 1119 errorFontBuildPath: "errorFontBuildPath", 1120 errorFontGetPath: "errorFontGetPath", 1121 errorMarkedContent: "errorMarkedContent", 1122 errorContentSubStream: "errorContentSubStream" 1123}; 1124exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; 1125const PasswordResponses = { 1126 NEED_PASSWORD: 1, 1127 INCORRECT_PASSWORD: 2 1128}; 1129exports.PasswordResponses = PasswordResponses; 1130let verbosity = VerbosityLevel.WARNINGS; 1131 1132function setVerbosityLevel(level) { 1133 if (Number.isInteger(level)) { 1134 verbosity = level; 1135 } 1136} 1137 1138function getVerbosityLevel() { 1139 return verbosity; 1140} 1141 1142function info(msg) { 1143 if (verbosity >= VerbosityLevel.INFOS) { 1144 console.log(`Info: ${msg}`); 1145 } 1146} 1147 1148function warn(msg) { 1149 if (verbosity >= VerbosityLevel.WARNINGS) { 1150 console.log(`Warning: ${msg}`); 1151 } 1152} 1153 1154function unreachable(msg) { 1155 throw new Error(msg); 1156} 1157 1158function assert(cond, msg) { 1159 if (!cond) { 1160 unreachable(msg); 1161 } 1162} 1163 1164function _isValidProtocol(url) { 1165 if (!url) { 1166 return false; 1167 } 1168 1169 switch (url.protocol) { 1170 case "http:": 1171 case "https:": 1172 case "ftp:": 1173 case "mailto:": 1174 case "tel:": 1175 return true; 1176 1177 default: 1178 return false; 1179 } 1180} 1181 1182function createValidAbsoluteUrl(url, baseUrl = null, options = null) { 1183 if (!url) { 1184 return null; 1185 } 1186 1187 try { 1188 if (options && typeof url === "string") { 1189 if (options.addDefaultProtocol && url.startsWith("www.")) { 1190 const dots = url.match(/\./g); 1191 1192 if (dots && dots.length >= 2) { 1193 url = `http://${url}`; 1194 } 1195 } 1196 1197 if (options.tryConvertEncoding) { 1198 try { 1199 url = stringToUTF8String(url); 1200 } catch (ex) {} 1201 } 1202 } 1203 1204 const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); 1205 1206 if (_isValidProtocol(absoluteUrl)) { 1207 return absoluteUrl; 1208 } 1209 } catch (ex) {} 1210 1211 return null; 1212} 1213 1214function shadow(obj, prop, value) { 1215 Object.defineProperty(obj, prop, { 1216 value, 1217 enumerable: true, 1218 configurable: true, 1219 writable: false 1220 }); 1221 return value; 1222} 1223 1224const BaseException = function BaseExceptionClosure() { 1225 function BaseException(message, name) { 1226 if (this.constructor === BaseException) { 1227 unreachable("Cannot initialize BaseException."); 1228 } 1229 1230 this.message = message; 1231 this.name = name; 1232 } 1233 1234 BaseException.prototype = new Error(); 1235 BaseException.constructor = BaseException; 1236 return BaseException; 1237}(); 1238 1239exports.BaseException = BaseException; 1240 1241class PasswordException extends BaseException { 1242 constructor(msg, code) { 1243 super(msg, "PasswordException"); 1244 this.code = code; 1245 } 1246 1247} 1248 1249exports.PasswordException = PasswordException; 1250 1251class UnknownErrorException extends BaseException { 1252 constructor(msg, details) { 1253 super(msg, "UnknownErrorException"); 1254 this.details = details; 1255 } 1256 1257} 1258 1259exports.UnknownErrorException = UnknownErrorException; 1260 1261class InvalidPDFException extends BaseException { 1262 constructor(msg) { 1263 super(msg, "InvalidPDFException"); 1264 } 1265 1266} 1267 1268exports.InvalidPDFException = InvalidPDFException; 1269 1270class MissingPDFException extends BaseException { 1271 constructor(msg) { 1272 super(msg, "MissingPDFException"); 1273 } 1274 1275} 1276 1277exports.MissingPDFException = MissingPDFException; 1278 1279class UnexpectedResponseException extends BaseException { 1280 constructor(msg, status) { 1281 super(msg, "UnexpectedResponseException"); 1282 this.status = status; 1283 } 1284 1285} 1286 1287exports.UnexpectedResponseException = UnexpectedResponseException; 1288 1289class FormatError extends BaseException { 1290 constructor(msg) { 1291 super(msg, "FormatError"); 1292 } 1293 1294} 1295 1296exports.FormatError = FormatError; 1297 1298class AbortException extends BaseException { 1299 constructor(msg) { 1300 super(msg, "AbortException"); 1301 } 1302 1303} 1304 1305exports.AbortException = AbortException; 1306 1307function bytesToString(bytes) { 1308 if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) { 1309 unreachable("Invalid argument for bytesToString"); 1310 } 1311 1312 const length = bytes.length; 1313 const MAX_ARGUMENT_COUNT = 8192; 1314 1315 if (length < MAX_ARGUMENT_COUNT) { 1316 return String.fromCharCode.apply(null, bytes); 1317 } 1318 1319 const strBuf = []; 1320 1321 for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) { 1322 const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); 1323 const chunk = bytes.subarray(i, chunkEnd); 1324 strBuf.push(String.fromCharCode.apply(null, chunk)); 1325 } 1326 1327 return strBuf.join(""); 1328} 1329 1330function stringToBytes(str) { 1331 if (typeof str !== "string") { 1332 unreachable("Invalid argument for stringToBytes"); 1333 } 1334 1335 const length = str.length; 1336 const bytes = new Uint8Array(length); 1337 1338 for (let i = 0; i < length; ++i) { 1339 bytes[i] = str.charCodeAt(i) & 0xff; 1340 } 1341 1342 return bytes; 1343} 1344 1345function arrayByteLength(arr) { 1346 if (arr.length !== undefined) { 1347 return arr.length; 1348 } 1349 1350 if (arr.byteLength !== undefined) { 1351 return arr.byteLength; 1352 } 1353 1354 unreachable("Invalid argument for arrayByteLength"); 1355} 1356 1357function arraysToBytes(arr) { 1358 const length = arr.length; 1359 1360 if (length === 1 && arr[0] instanceof Uint8Array) { 1361 return arr[0]; 1362 } 1363 1364 let resultLength = 0; 1365 1366 for (let i = 0; i < length; i++) { 1367 resultLength += arrayByteLength(arr[i]); 1368 } 1369 1370 let pos = 0; 1371 const data = new Uint8Array(resultLength); 1372 1373 for (let i = 0; i < length; i++) { 1374 let item = arr[i]; 1375 1376 if (!(item instanceof Uint8Array)) { 1377 if (typeof item === "string") { 1378 item = stringToBytes(item); 1379 } else { 1380 item = new Uint8Array(item); 1381 } 1382 } 1383 1384 const itemLength = item.byteLength; 1385 data.set(item, pos); 1386 pos += itemLength; 1387 } 1388 1389 return data; 1390} 1391 1392function string32(value) { 1393 return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 1394} 1395 1396function objectSize(obj) { 1397 return Object.keys(obj).length; 1398} 1399 1400function objectFromMap(map) { 1401 const obj = Object.create(null); 1402 1403 for (const [key, value] of map) { 1404 obj[key] = value; 1405 } 1406 1407 return obj; 1408} 1409 1410function isLittleEndian() { 1411 const buffer8 = new Uint8Array(4); 1412 buffer8[0] = 1; 1413 const view32 = new Uint32Array(buffer8.buffer, 0, 1); 1414 return view32[0] === 1; 1415} 1416 1417function isEvalSupported() { 1418 try { 1419 new Function(""); 1420 return true; 1421 } catch (e) { 1422 return false; 1423 } 1424} 1425 1426class FeatureTest { 1427 static get isLittleEndian() { 1428 return shadow(this, "isLittleEndian", isLittleEndian()); 1429 } 1430 1431 static get isEvalSupported() { 1432 return shadow(this, "isEvalSupported", isEvalSupported()); 1433 } 1434 1435 static get isOffscreenCanvasSupported() { 1436 return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined"); 1437 } 1438 1439} 1440 1441exports.FeatureTest = FeatureTest; 1442const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0")); 1443 1444class Util { 1445 static makeHexColor(r, g, b) { 1446 return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`; 1447 } 1448 1449 static scaleMinMax(transform, minMax) { 1450 let temp; 1451 1452 if (transform[0]) { 1453 if (transform[0] < 0) { 1454 temp = minMax[0]; 1455 minMax[0] = minMax[1]; 1456 minMax[1] = temp; 1457 } 1458 1459 minMax[0] *= transform[0]; 1460 minMax[1] *= transform[0]; 1461 1462 if (transform[3] < 0) { 1463 temp = minMax[2]; 1464 minMax[2] = minMax[3]; 1465 minMax[3] = temp; 1466 } 1467 1468 minMax[2] *= transform[3]; 1469 minMax[3] *= transform[3]; 1470 } else { 1471 temp = minMax[0]; 1472 minMax[0] = minMax[2]; 1473 minMax[2] = temp; 1474 temp = minMax[1]; 1475 minMax[1] = minMax[3]; 1476 minMax[3] = temp; 1477 1478 if (transform[1] < 0) { 1479 temp = minMax[2]; 1480 minMax[2] = minMax[3]; 1481 minMax[3] = temp; 1482 } 1483 1484 minMax[2] *= transform[1]; 1485 minMax[3] *= transform[1]; 1486 1487 if (transform[2] < 0) { 1488 temp = minMax[0]; 1489 minMax[0] = minMax[1]; 1490 minMax[1] = temp; 1491 } 1492 1493 minMax[0] *= transform[2]; 1494 minMax[1] *= transform[2]; 1495 } 1496 1497 minMax[0] += transform[4]; 1498 minMax[1] += transform[4]; 1499 minMax[2] += transform[5]; 1500 minMax[3] += transform[5]; 1501 } 1502 1503 static transform(m1, m2) { 1504 return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]]; 1505 } 1506 1507 static applyTransform(p, m) { 1508 const xt = p[0] * m[0] + p[1] * m[2] + m[4]; 1509 const yt = p[0] * m[1] + p[1] * m[3] + m[5]; 1510 return [xt, yt]; 1511 } 1512 1513 static applyInverseTransform(p, m) { 1514 const d = m[0] * m[3] - m[1] * m[2]; 1515 const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; 1516 const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; 1517 return [xt, yt]; 1518 } 1519 1520 static getAxialAlignedBoundingBox(r, m) { 1521 const p1 = Util.applyTransform(r, m); 1522 const p2 = Util.applyTransform(r.slice(2, 4), m); 1523 const p3 = Util.applyTransform([r[0], r[3]], m); 1524 const p4 = Util.applyTransform([r[2], r[1]], m); 1525 return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])]; 1526 } 1527 1528 static inverseTransform(m) { 1529 const d = m[0] * m[3] - m[1] * m[2]; 1530 return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d]; 1531 } 1532 1533 static apply3dTransform(m, v) { 1534 return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]]; 1535 } 1536 1537 static singularValueDecompose2dScale(m) { 1538 const transpose = [m[0], m[2], m[1], m[3]]; 1539 const a = m[0] * transpose[0] + m[1] * transpose[2]; 1540 const b = m[0] * transpose[1] + m[1] * transpose[3]; 1541 const c = m[2] * transpose[0] + m[3] * transpose[2]; 1542 const d = m[2] * transpose[1] + m[3] * transpose[3]; 1543 const first = (a + d) / 2; 1544 const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2; 1545 const sx = first + second || 1; 1546 const sy = first - second || 1; 1547 return [Math.sqrt(sx), Math.sqrt(sy)]; 1548 } 1549 1550 static normalizeRect(rect) { 1551 const r = rect.slice(0); 1552 1553 if (rect[0] > rect[2]) { 1554 r[0] = rect[2]; 1555 r[2] = rect[0]; 1556 } 1557 1558 if (rect[1] > rect[3]) { 1559 r[1] = rect[3]; 1560 r[3] = rect[1]; 1561 } 1562 1563 return r; 1564 } 1565 1566 static intersect(rect1, rect2) { 1567 const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2])); 1568 const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2])); 1569 1570 if (xLow > xHigh) { 1571 return null; 1572 } 1573 1574 const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3])); 1575 const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3])); 1576 1577 if (yLow > yHigh) { 1578 return null; 1579 } 1580 1581 return [xLow, yLow, xHigh, yHigh]; 1582 } 1583 1584 static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) { 1585 const tvalues = [], 1586 bounds = [[], []]; 1587 let a, b, c, t, t1, t2, b2ac, sqrtb2ac; 1588 1589 for (let i = 0; i < 2; ++i) { 1590 if (i === 0) { 1591 b = 6 * x0 - 12 * x1 + 6 * x2; 1592 a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3; 1593 c = 3 * x1 - 3 * x0; 1594 } else { 1595 b = 6 * y0 - 12 * y1 + 6 * y2; 1596 a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3; 1597 c = 3 * y1 - 3 * y0; 1598 } 1599 1600 if (Math.abs(a) < 1e-12) { 1601 if (Math.abs(b) < 1e-12) { 1602 continue; 1603 } 1604 1605 t = -c / b; 1606 1607 if (0 < t && t < 1) { 1608 tvalues.push(t); 1609 } 1610 1611 continue; 1612 } 1613 1614 b2ac = b * b - 4 * c * a; 1615 sqrtb2ac = Math.sqrt(b2ac); 1616 1617 if (b2ac < 0) { 1618 continue; 1619 } 1620 1621 t1 = (-b + sqrtb2ac) / (2 * a); 1622 1623 if (0 < t1 && t1 < 1) { 1624 tvalues.push(t1); 1625 } 1626 1627 t2 = (-b - sqrtb2ac) / (2 * a); 1628 1629 if (0 < t2 && t2 < 1) { 1630 tvalues.push(t2); 1631 } 1632 } 1633 1634 let j = tvalues.length, 1635 mt; 1636 const jlen = j; 1637 1638 while (j--) { 1639 t = tvalues[j]; 1640 mt = 1 - t; 1641 bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3; 1642 bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3; 1643 } 1644 1645 bounds[0][jlen] = x0; 1646 bounds[1][jlen] = y0; 1647 bounds[0][jlen + 1] = x3; 1648 bounds[1][jlen + 1] = y3; 1649 bounds[0].length = bounds[1].length = jlen + 2; 1650 return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])]; 1651 } 1652 1653} 1654 1655exports.Util = Util; 1656const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac]; 1657 1658function stringToPDFString(str) { 1659 if (str[0] >= "\xEF") { 1660 let encoding; 1661 1662 if (str[0] === "\xFE" && str[1] === "\xFF") { 1663 encoding = "utf-16be"; 1664 } else if (str[0] === "\xFF" && str[1] === "\xFE") { 1665 encoding = "utf-16le"; 1666 } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") { 1667 encoding = "utf-8"; 1668 } 1669 1670 if (encoding) { 1671 try { 1672 const decoder = new TextDecoder(encoding, { 1673 fatal: true 1674 }); 1675 const buffer = stringToBytes(str); 1676 return decoder.decode(buffer); 1677 } catch (ex) { 1678 warn(`stringToPDFString: "${ex}".`); 1679 } 1680 } 1681 } 1682 1683 const strBuf = []; 1684 1685 for (let i = 0, ii = str.length; i < ii; i++) { 1686 const code = PDFStringTranslateTable[str.charCodeAt(i)]; 1687 strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); 1688 } 1689 1690 return strBuf.join(""); 1691} 1692 1693function escapeString(str) { 1694 return str.replace(/([()\\\n\r])/g, match => { 1695 if (match === "\n") { 1696 return "\\n"; 1697 } else if (match === "\r") { 1698 return "\\r"; 1699 } 1700 1701 return `\\${match}`; 1702 }); 1703} 1704 1705function isAscii(str) { 1706 return /^[\x00-\x7F]*$/.test(str); 1707} 1708 1709function stringToUTF16BEString(str) { 1710 const buf = ["\xFE\xFF"]; 1711 1712 for (let i = 0, ii = str.length; i < ii; i++) { 1713 const char = str.charCodeAt(i); 1714 buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff)); 1715 } 1716 1717 return buf.join(""); 1718} 1719 1720function stringToUTF8String(str) { 1721 return decodeURIComponent(escape(str)); 1722} 1723 1724function utf8StringToString(str) { 1725 return unescape(encodeURIComponent(str)); 1726} 1727 1728function isArrayBuffer(v) { 1729 return typeof v === "object" && v !== null && v.byteLength !== undefined; 1730} 1731 1732function isArrayEqual(arr1, arr2) { 1733 if (arr1.length !== arr2.length) { 1734 return false; 1735 } 1736 1737 for (let i = 0, ii = arr1.length; i < ii; i++) { 1738 if (arr1[i] !== arr2[i]) { 1739 return false; 1740 } 1741 } 1742 1743 return true; 1744} 1745 1746function getModificationDate(date = new Date()) { 1747 const buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, "0"), date.getUTCDate().toString().padStart(2, "0"), date.getUTCHours().toString().padStart(2, "0"), date.getUTCMinutes().toString().padStart(2, "0"), date.getUTCSeconds().toString().padStart(2, "0")]; 1748 return buffer.join(""); 1749} 1750 1751function createPromiseCapability() { 1752 const capability = Object.create(null); 1753 let isSettled = false; 1754 Object.defineProperty(capability, "settled", { 1755 get() { 1756 return isSettled; 1757 } 1758 1759 }); 1760 capability.promise = new Promise(function (resolve, reject) { 1761 capability.resolve = function (data) { 1762 isSettled = true; 1763 resolve(data); 1764 }; 1765 1766 capability.reject = function (reason) { 1767 isSettled = true; 1768 reject(reason); 1769 }; 1770 }); 1771 return capability; 1772} 1773 1774/***/ }), 1775/* 3 */ 1776/***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => { 1777 1778 1779 1780var _is_node = __w_pdfjs_require__(4); 1781 1782; 1783 1784/***/ }), 1785/* 4 */ 1786/***/ ((__unused_webpack_module, exports) => { 1787 1788 1789 1790Object.defineProperty(exports, "__esModule", ({ 1791 value: true 1792})); 1793exports.isNodeJS = void 0; 1794const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser"); 1795exports.isNodeJS = isNodeJS; 1796 1797/***/ }), 1798/* 5 */ 1799/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 1800 1801 1802 1803Object.defineProperty(exports, "__esModule", ({ 1804 value: true 1805})); 1806exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0; 1807exports.clearPrimitiveCaches = clearPrimitiveCaches; 1808exports.isCmd = isCmd; 1809exports.isDict = isDict; 1810exports.isName = isName; 1811exports.isRefsEqual = isRefsEqual; 1812 1813var _util = __w_pdfjs_require__(2); 1814 1815const CIRCULAR_REF = Symbol("CIRCULAR_REF"); 1816exports.CIRCULAR_REF = CIRCULAR_REF; 1817const EOF = Symbol("EOF"); 1818exports.EOF = EOF; 1819 1820const Name = function NameClosure() { 1821 let nameCache = Object.create(null); 1822 1823 class Name { 1824 constructor(name) { 1825 this.name = name; 1826 } 1827 1828 static get(name) { 1829 return nameCache[name] || (nameCache[name] = new Name(name)); 1830 } 1831 1832 static _clearCache() { 1833 nameCache = Object.create(null); 1834 } 1835 1836 } 1837 1838 return Name; 1839}(); 1840 1841exports.Name = Name; 1842 1843const Cmd = function CmdClosure() { 1844 let cmdCache = Object.create(null); 1845 1846 class Cmd { 1847 constructor(cmd) { 1848 this.cmd = cmd; 1849 } 1850 1851 static get(cmd) { 1852 return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd)); 1853 } 1854 1855 static _clearCache() { 1856 cmdCache = Object.create(null); 1857 } 1858 1859 } 1860 1861 return Cmd; 1862}(); 1863 1864exports.Cmd = Cmd; 1865 1866const nonSerializable = function nonSerializableClosure() { 1867 return nonSerializable; 1868}; 1869 1870class Dict { 1871 constructor(xref = null) { 1872 this._map = Object.create(null); 1873 this.xref = xref; 1874 this.objId = null; 1875 this.suppressEncryption = false; 1876 this.__nonSerializable__ = nonSerializable; 1877 } 1878 1879 assignXref(newXref) { 1880 this.xref = newXref; 1881 } 1882 1883 get size() { 1884 return Object.keys(this._map).length; 1885 } 1886 1887 get(key1, key2, key3) { 1888 let value = this._map[key1]; 1889 1890 if (value === undefined && key2 !== undefined) { 1891 value = this._map[key2]; 1892 1893 if (value === undefined && key3 !== undefined) { 1894 value = this._map[key3]; 1895 } 1896 } 1897 1898 if (value instanceof Ref && this.xref) { 1899 return this.xref.fetch(value, this.suppressEncryption); 1900 } 1901 1902 return value; 1903 } 1904 1905 async getAsync(key1, key2, key3) { 1906 let value = this._map[key1]; 1907 1908 if (value === undefined && key2 !== undefined) { 1909 value = this._map[key2]; 1910 1911 if (value === undefined && key3 !== undefined) { 1912 value = this._map[key3]; 1913 } 1914 } 1915 1916 if (value instanceof Ref && this.xref) { 1917 return this.xref.fetchAsync(value, this.suppressEncryption); 1918 } 1919 1920 return value; 1921 } 1922 1923 getArray(key1, key2, key3) { 1924 let value = this._map[key1]; 1925 1926 if (value === undefined && key2 !== undefined) { 1927 value = this._map[key2]; 1928 1929 if (value === undefined && key3 !== undefined) { 1930 value = this._map[key3]; 1931 } 1932 } 1933 1934 if (value instanceof Ref && this.xref) { 1935 value = this.xref.fetch(value, this.suppressEncryption); 1936 } 1937 1938 if (Array.isArray(value)) { 1939 value = value.slice(); 1940 1941 for (let i = 0, ii = value.length; i < ii; i++) { 1942 if (value[i] instanceof Ref && this.xref) { 1943 value[i] = this.xref.fetch(value[i], this.suppressEncryption); 1944 } 1945 } 1946 } 1947 1948 return value; 1949 } 1950 1951 getRaw(key) { 1952 return this._map[key]; 1953 } 1954 1955 getKeys() { 1956 return Object.keys(this._map); 1957 } 1958 1959 getRawValues() { 1960 return Object.values(this._map); 1961 } 1962 1963 set(key, value) { 1964 this._map[key] = value; 1965 } 1966 1967 has(key) { 1968 return this._map[key] !== undefined; 1969 } 1970 1971 forEach(callback) { 1972 for (const key in this._map) { 1973 callback(key, this.get(key)); 1974 } 1975 } 1976 1977 static get empty() { 1978 const emptyDict = new Dict(null); 1979 1980 emptyDict.set = (key, value) => { 1981 (0, _util.unreachable)("Should not call `set` on the empty dictionary."); 1982 }; 1983 1984 return (0, _util.shadow)(this, "empty", emptyDict); 1985 } 1986 1987 static merge({ 1988 xref, 1989 dictArray, 1990 mergeSubDicts = false 1991 }) { 1992 const mergedDict = new Dict(xref), 1993 properties = new Map(); 1994 1995 for (const dict of dictArray) { 1996 if (!(dict instanceof Dict)) { 1997 continue; 1998 } 1999 2000 for (const [key, value] of Object.entries(dict._map)) { 2001 let property = properties.get(key); 2002 2003 if (property === undefined) { 2004 property = []; 2005 properties.set(key, property); 2006 } else if (!mergeSubDicts || !(value instanceof Dict)) { 2007 continue; 2008 } 2009 2010 property.push(value); 2011 } 2012 } 2013 2014 for (const [name, values] of properties) { 2015 if (values.length === 1 || !(values[0] instanceof Dict)) { 2016 mergedDict._map[name] = values[0]; 2017 continue; 2018 } 2019 2020 const subDict = new Dict(xref); 2021 2022 for (const dict of values) { 2023 for (const [key, value] of Object.entries(dict._map)) { 2024 if (subDict._map[key] === undefined) { 2025 subDict._map[key] = value; 2026 } 2027 } 2028 } 2029 2030 if (subDict.size > 0) { 2031 mergedDict._map[name] = subDict; 2032 } 2033 } 2034 2035 properties.clear(); 2036 return mergedDict.size > 0 ? mergedDict : Dict.empty; 2037 } 2038 2039} 2040 2041exports.Dict = Dict; 2042 2043const Ref = function RefClosure() { 2044 let refCache = Object.create(null); 2045 2046 class Ref { 2047 constructor(num, gen) { 2048 this.num = num; 2049 this.gen = gen; 2050 } 2051 2052 toString() { 2053 if (this.gen === 0) { 2054 return `${this.num}R`; 2055 } 2056 2057 return `${this.num}R${this.gen}`; 2058 } 2059 2060 static get(num, gen) { 2061 const key = gen === 0 ? `${num}R` : `${num}R${gen}`; 2062 return refCache[key] || (refCache[key] = new Ref(num, gen)); 2063 } 2064 2065 static _clearCache() { 2066 refCache = Object.create(null); 2067 } 2068 2069 } 2070 2071 return Ref; 2072}(); 2073 2074exports.Ref = Ref; 2075 2076class RefSet { 2077 constructor(parent = null) { 2078 this._set = new Set(parent && parent._set); 2079 } 2080 2081 has(ref) { 2082 return this._set.has(ref.toString()); 2083 } 2084 2085 put(ref) { 2086 this._set.add(ref.toString()); 2087 } 2088 2089 remove(ref) { 2090 this._set.delete(ref.toString()); 2091 } 2092 2093 [Symbol.iterator]() { 2094 return this._set.values(); 2095 } 2096 2097 clear() { 2098 this._set.clear(); 2099 } 2100 2101} 2102 2103exports.RefSet = RefSet; 2104 2105class RefSetCache { 2106 constructor() { 2107 this._map = new Map(); 2108 } 2109 2110 get size() { 2111 return this._map.size; 2112 } 2113 2114 get(ref) { 2115 return this._map.get(ref.toString()); 2116 } 2117 2118 has(ref) { 2119 return this._map.has(ref.toString()); 2120 } 2121 2122 put(ref, obj) { 2123 this._map.set(ref.toString(), obj); 2124 } 2125 2126 putAlias(ref, aliasRef) { 2127 this._map.set(ref.toString(), this.get(aliasRef)); 2128 } 2129 2130 [Symbol.iterator]() { 2131 return this._map.values(); 2132 } 2133 2134 clear() { 2135 this._map.clear(); 2136 } 2137 2138} 2139 2140exports.RefSetCache = RefSetCache; 2141 2142function isName(v, name) { 2143 return v instanceof Name && (name === undefined || v.name === name); 2144} 2145 2146function isCmd(v, cmd) { 2147 return v instanceof Cmd && (cmd === undefined || v.cmd === cmd); 2148} 2149 2150function isDict(v, type) { 2151 return v instanceof Dict && (type === undefined || isName(v.get("Type"), type)); 2152} 2153 2154function isRefsEqual(v1, v2) { 2155 return v1.num === v2.num && v1.gen === v2.gen; 2156} 2157 2158function clearPrimitiveCaches() { 2159 Cmd._clearCache(); 2160 2161 Name._clearCache(); 2162 2163 Ref._clearCache(); 2164} 2165 2166/***/ }), 2167/* 6 */ 2168/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 2169 2170 2171 2172Object.defineProperty(exports, "__esModule", ({ 2173 value: true 2174})); 2175exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.MissingDataException = exports.DocStats = void 0; 2176exports.collectActions = collectActions; 2177exports.encodeToXmlString = encodeToXmlString; 2178exports.escapePDFName = escapePDFName; 2179exports.getArrayLookupTableFactory = getArrayLookupTableFactory; 2180exports.getInheritableProperty = getInheritableProperty; 2181exports.getLookupTableFactory = getLookupTableFactory; 2182exports.getNewAnnotationsMap = getNewAnnotationsMap; 2183exports.isWhiteSpace = isWhiteSpace; 2184exports.log2 = log2; 2185exports.numberToString = numberToString; 2186exports.parseXFAPath = parseXFAPath; 2187exports.readInt8 = readInt8; 2188exports.readUint16 = readUint16; 2189exports.readUint32 = readUint32; 2190exports.recoverJsURL = recoverJsURL; 2191exports.toRomanNumerals = toRomanNumerals; 2192exports.validateCSSFont = validateCSSFont; 2193 2194var _util = __w_pdfjs_require__(2); 2195 2196var _primitives = __w_pdfjs_require__(5); 2197 2198var _base_stream = __w_pdfjs_require__(7); 2199 2200function getLookupTableFactory(initializer) { 2201 let lookup; 2202 return function () { 2203 if (initializer) { 2204 lookup = Object.create(null); 2205 initializer(lookup); 2206 initializer = null; 2207 } 2208 2209 return lookup; 2210 }; 2211} 2212 2213function getArrayLookupTableFactory(initializer) { 2214 let lookup; 2215 return function () { 2216 if (initializer) { 2217 let arr = initializer(); 2218 initializer = null; 2219 lookup = Object.create(null); 2220 2221 for (let i = 0, ii = arr.length; i < ii; i += 2) { 2222 lookup[arr[i]] = arr[i + 1]; 2223 } 2224 2225 arr = null; 2226 } 2227 2228 return lookup; 2229 }; 2230} 2231 2232class MissingDataException extends _util.BaseException { 2233 constructor(begin, end) { 2234 super(`Missing data [${begin}, ${end})`, "MissingDataException"); 2235 this.begin = begin; 2236 this.end = end; 2237 } 2238 2239} 2240 2241exports.MissingDataException = MissingDataException; 2242 2243class ParserEOFException extends _util.BaseException { 2244 constructor(msg) { 2245 super(msg, "ParserEOFException"); 2246 } 2247 2248} 2249 2250exports.ParserEOFException = ParserEOFException; 2251 2252class XRefEntryException extends _util.BaseException { 2253 constructor(msg) { 2254 super(msg, "XRefEntryException"); 2255 } 2256 2257} 2258 2259exports.XRefEntryException = XRefEntryException; 2260 2261class XRefParseException extends _util.BaseException { 2262 constructor(msg) { 2263 super(msg, "XRefParseException"); 2264 } 2265 2266} 2267 2268exports.XRefParseException = XRefParseException; 2269 2270class DocStats { 2271 constructor(handler) { 2272 this._handler = handler; 2273 this._streamTypes = new Set(); 2274 this._fontTypes = new Set(); 2275 } 2276 2277 _send() { 2278 const streamTypes = Object.create(null), 2279 fontTypes = Object.create(null); 2280 2281 for (const type of this._streamTypes) { 2282 streamTypes[type] = true; 2283 } 2284 2285 for (const type of this._fontTypes) { 2286 fontTypes[type] = true; 2287 } 2288 2289 this._handler.send("DocStats", { 2290 streamTypes, 2291 fontTypes 2292 }); 2293 } 2294 2295 addStreamType(type) { 2296 if (this._streamTypes.has(type)) { 2297 return; 2298 } 2299 2300 this._streamTypes.add(type); 2301 2302 this._send(); 2303 } 2304 2305 addFontType(type) { 2306 if (this._fontTypes.has(type)) { 2307 return; 2308 } 2309 2310 this._fontTypes.add(type); 2311 2312 this._send(); 2313 } 2314 2315} 2316 2317exports.DocStats = DocStats; 2318 2319function getInheritableProperty({ 2320 dict, 2321 key, 2322 getArray = false, 2323 stopWhenFound = true 2324}) { 2325 let values; 2326 const visited = new _primitives.RefSet(); 2327 2328 while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) { 2329 if (dict.objId) { 2330 visited.put(dict.objId); 2331 } 2332 2333 const value = getArray ? dict.getArray(key) : dict.get(key); 2334 2335 if (value !== undefined) { 2336 if (stopWhenFound) { 2337 return value; 2338 } 2339 2340 if (!values) { 2341 values = []; 2342 } 2343 2344 values.push(value); 2345 } 2346 2347 dict = dict.get("Parent"); 2348 } 2349 2350 return values; 2351} 2352 2353const ROMAN_NUMBER_MAP = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"]; 2354 2355function toRomanNumerals(number, lowerCase = false) { 2356 (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer."); 2357 const romanBuf = []; 2358 let pos; 2359 2360 while (number >= 1000) { 2361 number -= 1000; 2362 romanBuf.push("M"); 2363 } 2364 2365 pos = number / 100 | 0; 2366 number %= 100; 2367 romanBuf.push(ROMAN_NUMBER_MAP[pos]); 2368 pos = number / 10 | 0; 2369 number %= 10; 2370 romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); 2371 romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); 2372 const romanStr = romanBuf.join(""); 2373 return lowerCase ? romanStr.toLowerCase() : romanStr; 2374} 2375 2376function log2(x) { 2377 if (x <= 0) { 2378 return 0; 2379 } 2380 2381 return Math.ceil(Math.log2(x)); 2382} 2383 2384function readInt8(data, offset) { 2385 return data[offset] << 24 >> 24; 2386} 2387 2388function readUint16(data, offset) { 2389 return data[offset] << 8 | data[offset + 1]; 2390} 2391 2392function readUint32(data, offset) { 2393 return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; 2394} 2395 2396function isWhiteSpace(ch) { 2397 return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a; 2398} 2399 2400function parseXFAPath(path) { 2401 const positionPattern = /(.+)\[(\d+)\]$/; 2402 return path.split(".").map(component => { 2403 const m = component.match(positionPattern); 2404 2405 if (m) { 2406 return { 2407 name: m[1], 2408 pos: parseInt(m[2], 10) 2409 }; 2410 } 2411 2412 return { 2413 name: component, 2414 pos: 0 2415 }; 2416 }); 2417} 2418 2419function escapePDFName(str) { 2420 const buffer = []; 2421 let start = 0; 2422 2423 for (let i = 0, ii = str.length; i < ii; i++) { 2424 const char = str.charCodeAt(i); 2425 2426 if (char < 0x21 || char > 0x7e || char === 0x23 || char === 0x28 || char === 0x29 || char === 0x3c || char === 0x3e || char === 0x5b || char === 0x5d || char === 0x7b || char === 0x7d || char === 0x2f || char === 0x25) { 2427 if (start < i) { 2428 buffer.push(str.substring(start, i)); 2429 } 2430 2431 buffer.push(`#${char.toString(16)}`); 2432 start = i + 1; 2433 } 2434 } 2435 2436 if (buffer.length === 0) { 2437 return str; 2438 } 2439 2440 if (start < str.length) { 2441 buffer.push(str.substring(start, str.length)); 2442 } 2443 2444 return buffer.join(""); 2445} 2446 2447function _collectJS(entry, xref, list, parents) { 2448 if (!entry) { 2449 return; 2450 } 2451 2452 let parent = null; 2453 2454 if (entry instanceof _primitives.Ref) { 2455 if (parents.has(entry)) { 2456 return; 2457 } 2458 2459 parent = entry; 2460 parents.put(parent); 2461 entry = xref.fetch(entry); 2462 } 2463 2464 if (Array.isArray(entry)) { 2465 for (const element of entry) { 2466 _collectJS(element, xref, list, parents); 2467 } 2468 } else if (entry instanceof _primitives.Dict) { 2469 if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) { 2470 const js = entry.get("JS"); 2471 let code; 2472 2473 if (js instanceof _base_stream.BaseStream) { 2474 code = js.getString(); 2475 } else if (typeof js === "string") { 2476 code = js; 2477 } 2478 2479 code = code && (0, _util.stringToPDFString)(code).replace(/\u0000/g, ""); 2480 2481 if (code) { 2482 list.push(code); 2483 } 2484 } 2485 2486 _collectJS(entry.getRaw("Next"), xref, list, parents); 2487 } 2488 2489 if (parent) { 2490 parents.remove(parent); 2491 } 2492} 2493 2494function collectActions(xref, dict, eventType) { 2495 const actions = Object.create(null); 2496 const additionalActionsDicts = getInheritableProperty({ 2497 dict, 2498 key: "AA", 2499 stopWhenFound: false 2500 }); 2501 2502 if (additionalActionsDicts) { 2503 for (let i = additionalActionsDicts.length - 1; i >= 0; i--) { 2504 const additionalActions = additionalActionsDicts[i]; 2505 2506 if (!(additionalActions instanceof _primitives.Dict)) { 2507 continue; 2508 } 2509 2510 for (const key of additionalActions.getKeys()) { 2511 const action = eventType[key]; 2512 2513 if (!action) { 2514 continue; 2515 } 2516 2517 const actionDict = additionalActions.getRaw(key); 2518 const parents = new _primitives.RefSet(); 2519 const list = []; 2520 2521 _collectJS(actionDict, xref, list, parents); 2522 2523 if (list.length > 0) { 2524 actions[action] = list; 2525 } 2526 } 2527 } 2528 } 2529 2530 if (dict.has("A")) { 2531 const actionDict = dict.get("A"); 2532 const parents = new _primitives.RefSet(); 2533 const list = []; 2534 2535 _collectJS(actionDict, xref, list, parents); 2536 2537 if (list.length > 0) { 2538 actions.Action = list; 2539 } 2540 } 2541 2542 return (0, _util.objectSize)(actions) > 0 ? actions : null; 2543} 2544 2545const XMLEntities = { 2546 0x3c: "<", 2547 0x3e: ">", 2548 0x26: "&", 2549 0x22: """, 2550 0x27: "'" 2551}; 2552 2553function encodeToXmlString(str) { 2554 const buffer = []; 2555 let start = 0; 2556 2557 for (let i = 0, ii = str.length; i < ii; i++) { 2558 const char = str.codePointAt(i); 2559 2560 if (0x20 <= char && char <= 0x7e) { 2561 const entity = XMLEntities[char]; 2562 2563 if (entity) { 2564 if (start < i) { 2565 buffer.push(str.substring(start, i)); 2566 } 2567 2568 buffer.push(entity); 2569 start = i + 1; 2570 } 2571 } else { 2572 if (start < i) { 2573 buffer.push(str.substring(start, i)); 2574 } 2575 2576 buffer.push(`&#x${char.toString(16).toUpperCase()};`); 2577 2578 if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) { 2579 i++; 2580 } 2581 2582 start = i + 1; 2583 } 2584 } 2585 2586 if (buffer.length === 0) { 2587 return str; 2588 } 2589 2590 if (start < str.length) { 2591 buffer.push(str.substring(start, str.length)); 2592 } 2593 2594 return buffer.join(""); 2595} 2596 2597function validateCSSFont(cssFontInfo) { 2598 const DEFAULT_CSS_FONT_OBLIQUE = "14"; 2599 const DEFAULT_CSS_FONT_WEIGHT = "400"; 2600 const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]); 2601 const { 2602 fontFamily, 2603 fontWeight, 2604 italicAngle 2605 } = cssFontInfo; 2606 2607 if (/^".*"$/.test(fontFamily)) { 2608 if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) { 2609 (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`); 2610 return false; 2611 } 2612 } else if (/^'.*'$/.test(fontFamily)) { 2613 if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) { 2614 (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`); 2615 return false; 2616 } 2617 } else { 2618 for (const ident of fontFamily.split(/[ \t]+/)) { 2619 if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) { 2620 (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`); 2621 return false; 2622 } 2623 } 2624 } 2625 2626 const weight = fontWeight ? fontWeight.toString() : ""; 2627 cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT; 2628 const angle = parseFloat(italicAngle); 2629 cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString(); 2630 return true; 2631} 2632 2633function recoverJsURL(str) { 2634 const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"]; 2635 const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i"); 2636 const jsUrl = regex.exec(str); 2637 2638 if (jsUrl && jsUrl[2]) { 2639 const url = jsUrl[2]; 2640 let newWindow = false; 2641 2642 if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") { 2643 newWindow = true; 2644 } 2645 2646 return { 2647 url, 2648 newWindow 2649 }; 2650 } 2651 2652 return null; 2653} 2654 2655function numberToString(value) { 2656 if (Number.isInteger(value)) { 2657 return value.toString(); 2658 } 2659 2660 const roundedValue = Math.round(value * 100); 2661 2662 if (roundedValue % 100 === 0) { 2663 return (roundedValue / 100).toString(); 2664 } 2665 2666 if (roundedValue % 10 === 0) { 2667 return value.toFixed(1); 2668 } 2669 2670 return value.toFixed(2); 2671} 2672 2673function getNewAnnotationsMap(annotationStorage) { 2674 if (!annotationStorage) { 2675 return null; 2676 } 2677 2678 const newAnnotationsByPage = new Map(); 2679 2680 for (const [key, value] of annotationStorage) { 2681 if (!key.startsWith(_util.AnnotationEditorPrefix)) { 2682 continue; 2683 } 2684 2685 let annotations = newAnnotationsByPage.get(value.pageIndex); 2686 2687 if (!annotations) { 2688 annotations = []; 2689 newAnnotationsByPage.set(value.pageIndex, annotations); 2690 } 2691 2692 annotations.push(value); 2693 } 2694 2695 return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null; 2696} 2697 2698/***/ }), 2699/* 7 */ 2700/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 2701 2702 2703 2704Object.defineProperty(exports, "__esModule", ({ 2705 value: true 2706})); 2707exports.BaseStream = void 0; 2708 2709var _util = __w_pdfjs_require__(2); 2710 2711class BaseStream { 2712 constructor() { 2713 if (this.constructor === BaseStream) { 2714 (0, _util.unreachable)("Cannot initialize BaseStream."); 2715 } 2716 } 2717 2718 get length() { 2719 (0, _util.unreachable)("Abstract getter `length` accessed"); 2720 } 2721 2722 get isEmpty() { 2723 (0, _util.unreachable)("Abstract getter `isEmpty` accessed"); 2724 } 2725 2726 get isDataLoaded() { 2727 return (0, _util.shadow)(this, "isDataLoaded", true); 2728 } 2729 2730 getByte() { 2731 (0, _util.unreachable)("Abstract method `getByte` called"); 2732 } 2733 2734 getBytes(length) { 2735 (0, _util.unreachable)("Abstract method `getBytes` called"); 2736 } 2737 2738 peekByte() { 2739 const peekedByte = this.getByte(); 2740 2741 if (peekedByte !== -1) { 2742 this.pos--; 2743 } 2744 2745 return peekedByte; 2746 } 2747 2748 peekBytes(length) { 2749 const bytes = this.getBytes(length); 2750 this.pos -= bytes.length; 2751 return bytes; 2752 } 2753 2754 getUint16() { 2755 const b0 = this.getByte(); 2756 const b1 = this.getByte(); 2757 2758 if (b0 === -1 || b1 === -1) { 2759 return -1; 2760 } 2761 2762 return (b0 << 8) + b1; 2763 } 2764 2765 getInt32() { 2766 const b0 = this.getByte(); 2767 const b1 = this.getByte(); 2768 const b2 = this.getByte(); 2769 const b3 = this.getByte(); 2770 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 2771 } 2772 2773 getByteRange(begin, end) { 2774 (0, _util.unreachable)("Abstract method `getByteRange` called"); 2775 } 2776 2777 getString(length) { 2778 return (0, _util.bytesToString)(this.getBytes(length)); 2779 } 2780 2781 skip(n) { 2782 this.pos += n || 1; 2783 } 2784 2785 reset() { 2786 (0, _util.unreachable)("Abstract method `reset` called"); 2787 } 2788 2789 moveStart() { 2790 (0, _util.unreachable)("Abstract method `moveStart` called"); 2791 } 2792 2793 makeSubStream(start, length, dict = null) { 2794 (0, _util.unreachable)("Abstract method `makeSubStream` called"); 2795 } 2796 2797 getBaseStreams() { 2798 return null; 2799 } 2800 2801} 2802 2803exports.BaseStream = BaseStream; 2804 2805/***/ }), 2806/* 8 */ 2807/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 2808 2809 2810 2811Object.defineProperty(exports, "__esModule", ({ 2812 value: true 2813})); 2814exports.NetworkPdfManager = exports.LocalPdfManager = void 0; 2815 2816var _util = __w_pdfjs_require__(2); 2817 2818var _chunked_stream = __w_pdfjs_require__(9); 2819 2820var _core_utils = __w_pdfjs_require__(6); 2821 2822var _document = __w_pdfjs_require__(11); 2823 2824var _stream = __w_pdfjs_require__(10); 2825 2826function parseDocBaseUrl(url) { 2827 if (url) { 2828 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url); 2829 2830 if (absoluteUrl) { 2831 return absoluteUrl.href; 2832 } 2833 2834 (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`); 2835 } 2836 2837 return null; 2838} 2839 2840class BasePdfManager { 2841 constructor() { 2842 if (this.constructor === BasePdfManager) { 2843 (0, _util.unreachable)("Cannot initialize BasePdfManager."); 2844 } 2845 } 2846 2847 get docId() { 2848 return this._docId; 2849 } 2850 2851 get password() { 2852 return this._password; 2853 } 2854 2855 get docBaseUrl() { 2856 const catalog = this.pdfDocument.catalog; 2857 return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl); 2858 } 2859 2860 onLoadedStream() { 2861 (0, _util.unreachable)("Abstract method `onLoadedStream` called"); 2862 } 2863 2864 ensureDoc(prop, args) { 2865 return this.ensure(this.pdfDocument, prop, args); 2866 } 2867 2868 ensureXRef(prop, args) { 2869 return this.ensure(this.pdfDocument.xref, prop, args); 2870 } 2871 2872 ensureCatalog(prop, args) { 2873 return this.ensure(this.pdfDocument.catalog, prop, args); 2874 } 2875 2876 getPage(pageIndex) { 2877 return this.pdfDocument.getPage(pageIndex); 2878 } 2879 2880 fontFallback(id, handler) { 2881 return this.pdfDocument.fontFallback(id, handler); 2882 } 2883 2884 loadXfaFonts(handler, task) { 2885 return this.pdfDocument.loadXfaFonts(handler, task); 2886 } 2887 2888 loadXfaImages() { 2889 return this.pdfDocument.loadXfaImages(); 2890 } 2891 2892 serializeXfaData(annotationStorage) { 2893 return this.pdfDocument.serializeXfaData(annotationStorage); 2894 } 2895 2896 cleanup(manuallyTriggered = false) { 2897 return this.pdfDocument.cleanup(manuallyTriggered); 2898 } 2899 2900 async ensure(obj, prop, args) { 2901 (0, _util.unreachable)("Abstract method `ensure` called"); 2902 } 2903 2904 requestRange(begin, end) { 2905 (0, _util.unreachable)("Abstract method `requestRange` called"); 2906 } 2907 2908 requestLoadedStream() { 2909 (0, _util.unreachable)("Abstract method `requestLoadedStream` called"); 2910 } 2911 2912 sendProgressiveData(chunk) { 2913 (0, _util.unreachable)("Abstract method `sendProgressiveData` called"); 2914 } 2915 2916 updatePassword(password) { 2917 this._password = password; 2918 } 2919 2920 terminate(reason) { 2921 (0, _util.unreachable)("Abstract method `terminate` called"); 2922 } 2923 2924} 2925 2926class LocalPdfManager extends BasePdfManager { 2927 constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) { 2928 super(); 2929 this._docId = docId; 2930 this._password = password; 2931 this._docBaseUrl = parseDocBaseUrl(docBaseUrl); 2932 this.msgHandler = msgHandler; 2933 this.evaluatorOptions = evaluatorOptions; 2934 this.enableXfa = enableXfa; 2935 const stream = new _stream.Stream(data); 2936 this.pdfDocument = new _document.PDFDocument(this, stream); 2937 this._loadedStreamPromise = Promise.resolve(stream); 2938 } 2939 2940 async ensure(obj, prop, args) { 2941 const value = obj[prop]; 2942 2943 if (typeof value === "function") { 2944 return value.apply(obj, args); 2945 } 2946 2947 return value; 2948 } 2949 2950 requestRange(begin, end) { 2951 return Promise.resolve(); 2952 } 2953 2954 requestLoadedStream() {} 2955 2956 onLoadedStream() { 2957 return this._loadedStreamPromise; 2958 } 2959 2960 terminate(reason) {} 2961 2962} 2963 2964exports.LocalPdfManager = LocalPdfManager; 2965 2966class NetworkPdfManager extends BasePdfManager { 2967 constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) { 2968 super(); 2969 this._docId = docId; 2970 this._password = args.password; 2971 this._docBaseUrl = parseDocBaseUrl(docBaseUrl); 2972 this.msgHandler = args.msgHandler; 2973 this.evaluatorOptions = evaluatorOptions; 2974 this.enableXfa = enableXfa; 2975 this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, { 2976 msgHandler: args.msgHandler, 2977 length: args.length, 2978 disableAutoFetch: args.disableAutoFetch, 2979 rangeChunkSize: args.rangeChunkSize 2980 }); 2981 this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream()); 2982 } 2983 2984 async ensure(obj, prop, args) { 2985 try { 2986 const value = obj[prop]; 2987 2988 if (typeof value === "function") { 2989 return value.apply(obj, args); 2990 } 2991 2992 return value; 2993 } catch (ex) { 2994 if (!(ex instanceof _core_utils.MissingDataException)) { 2995 throw ex; 2996 } 2997 2998 await this.requestRange(ex.begin, ex.end); 2999 return this.ensure(obj, prop, args); 3000 } 3001 } 3002 3003 requestRange(begin, end) { 3004 return this.streamManager.requestRange(begin, end); 3005 } 3006 3007 requestLoadedStream() { 3008 this.streamManager.requestAllChunks(); 3009 } 3010 3011 sendProgressiveData(chunk) { 3012 this.streamManager.onReceiveData({ 3013 chunk 3014 }); 3015 } 3016 3017 onLoadedStream() { 3018 return this.streamManager.onLoadedStream(); 3019 } 3020 3021 terminate(reason) { 3022 this.streamManager.abort(reason); 3023 } 3024 3025} 3026 3027exports.NetworkPdfManager = NetworkPdfManager; 3028 3029/***/ }), 3030/* 9 */ 3031/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 3032 3033 3034 3035Object.defineProperty(exports, "__esModule", ({ 3036 value: true 3037})); 3038exports.ChunkedStreamManager = exports.ChunkedStream = void 0; 3039 3040var _util = __w_pdfjs_require__(2); 3041 3042var _core_utils = __w_pdfjs_require__(6); 3043 3044var _stream = __w_pdfjs_require__(10); 3045 3046class ChunkedStream extends _stream.Stream { 3047 constructor(length, chunkSize, manager) { 3048 super(new Uint8Array(length), 0, length, null); 3049 this.chunkSize = chunkSize; 3050 this._loadedChunks = new Set(); 3051 this.numChunks = Math.ceil(length / chunkSize); 3052 this.manager = manager; 3053 this.progressiveDataLength = 0; 3054 this.lastSuccessfulEnsureByteChunk = -1; 3055 } 3056 3057 getMissingChunks() { 3058 const chunks = []; 3059 3060 for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) { 3061 if (!this._loadedChunks.has(chunk)) { 3062 chunks.push(chunk); 3063 } 3064 } 3065 3066 return chunks; 3067 } 3068 3069 get numChunksLoaded() { 3070 return this._loadedChunks.size; 3071 } 3072 3073 get isDataLoaded() { 3074 return this.numChunksLoaded === this.numChunks; 3075 } 3076 3077 onReceiveData(begin, chunk) { 3078 const chunkSize = this.chunkSize; 3079 3080 if (begin % chunkSize !== 0) { 3081 throw new Error(`Bad begin offset: ${begin}`); 3082 } 3083 3084 const end = begin + chunk.byteLength; 3085 3086 if (end % chunkSize !== 0 && end !== this.bytes.length) { 3087 throw new Error(`Bad end offset: ${end}`); 3088 } 3089 3090 this.bytes.set(new Uint8Array(chunk), begin); 3091 const beginChunk = Math.floor(begin / chunkSize); 3092 const endChunk = Math.floor((end - 1) / chunkSize) + 1; 3093 3094 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 3095 this._loadedChunks.add(curChunk); 3096 } 3097 } 3098 3099 onReceiveProgressiveData(data) { 3100 let position = this.progressiveDataLength; 3101 const beginChunk = Math.floor(position / this.chunkSize); 3102 this.bytes.set(new Uint8Array(data), position); 3103 position += data.byteLength; 3104 this.progressiveDataLength = position; 3105 const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize); 3106 3107 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 3108 this._loadedChunks.add(curChunk); 3109 } 3110 } 3111 3112 ensureByte(pos) { 3113 if (pos < this.progressiveDataLength) { 3114 return; 3115 } 3116 3117 const chunk = Math.floor(pos / this.chunkSize); 3118 3119 if (chunk > this.numChunks) { 3120 return; 3121 } 3122 3123 if (chunk === this.lastSuccessfulEnsureByteChunk) { 3124 return; 3125 } 3126 3127 if (!this._loadedChunks.has(chunk)) { 3128 throw new _core_utils.MissingDataException(pos, pos + 1); 3129 } 3130 3131 this.lastSuccessfulEnsureByteChunk = chunk; 3132 } 3133 3134 ensureRange(begin, end) { 3135 if (begin >= end) { 3136 return; 3137 } 3138 3139 if (end <= this.progressiveDataLength) { 3140 return; 3141 } 3142 3143 const beginChunk = Math.floor(begin / this.chunkSize); 3144 3145 if (beginChunk > this.numChunks) { 3146 return; 3147 } 3148 3149 const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks); 3150 3151 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 3152 if (!this._loadedChunks.has(chunk)) { 3153 throw new _core_utils.MissingDataException(begin, end); 3154 } 3155 } 3156 } 3157 3158 nextEmptyChunk(beginChunk) { 3159 const numChunks = this.numChunks; 3160 3161 for (let i = 0; i < numChunks; ++i) { 3162 const chunk = (beginChunk + i) % numChunks; 3163 3164 if (!this._loadedChunks.has(chunk)) { 3165 return chunk; 3166 } 3167 } 3168 3169 return null; 3170 } 3171 3172 hasChunk(chunk) { 3173 return this._loadedChunks.has(chunk); 3174 } 3175 3176 getByte() { 3177 const pos = this.pos; 3178 3179 if (pos >= this.end) { 3180 return -1; 3181 } 3182 3183 if (pos >= this.progressiveDataLength) { 3184 this.ensureByte(pos); 3185 } 3186 3187 return this.bytes[this.pos++]; 3188 } 3189 3190 getBytes(length) { 3191 const bytes = this.bytes; 3192 const pos = this.pos; 3193 const strEnd = this.end; 3194 3195 if (!length) { 3196 if (strEnd > this.progressiveDataLength) { 3197 this.ensureRange(pos, strEnd); 3198 } 3199 3200 return bytes.subarray(pos, strEnd); 3201 } 3202 3203 let end = pos + length; 3204 3205 if (end > strEnd) { 3206 end = strEnd; 3207 } 3208 3209 if (end > this.progressiveDataLength) { 3210 this.ensureRange(pos, end); 3211 } 3212 3213 this.pos = end; 3214 return bytes.subarray(pos, end); 3215 } 3216 3217 getByteRange(begin, end) { 3218 if (begin < 0) { 3219 begin = 0; 3220 } 3221 3222 if (end > this.end) { 3223 end = this.end; 3224 } 3225 3226 if (end > this.progressiveDataLength) { 3227 this.ensureRange(begin, end); 3228 } 3229 3230 return this.bytes.subarray(begin, end); 3231 } 3232 3233 makeSubStream(start, length, dict = null) { 3234 if (length) { 3235 if (start + length > this.progressiveDataLength) { 3236 this.ensureRange(start, start + length); 3237 } 3238 } else { 3239 if (start >= this.progressiveDataLength) { 3240 this.ensureByte(start); 3241 } 3242 } 3243 3244 function ChunkedStreamSubstream() {} 3245 3246 ChunkedStreamSubstream.prototype = Object.create(this); 3247 3248 ChunkedStreamSubstream.prototype.getMissingChunks = function () { 3249 const chunkSize = this.chunkSize; 3250 const beginChunk = Math.floor(this.start / chunkSize); 3251 const endChunk = Math.floor((this.end - 1) / chunkSize) + 1; 3252 const missingChunks = []; 3253 3254 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 3255 if (!this._loadedChunks.has(chunk)) { 3256 missingChunks.push(chunk); 3257 } 3258 } 3259 3260 return missingChunks; 3261 }; 3262 3263 Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", { 3264 get() { 3265 if (this.numChunksLoaded === this.numChunks) { 3266 return true; 3267 } 3268 3269 return this.getMissingChunks().length === 0; 3270 }, 3271 3272 configurable: true 3273 }); 3274 const subStream = new ChunkedStreamSubstream(); 3275 subStream.pos = subStream.start = start; 3276 subStream.end = start + length || this.end; 3277 subStream.dict = dict; 3278 return subStream; 3279 } 3280 3281 getBaseStreams() { 3282 return [this]; 3283 } 3284 3285} 3286 3287exports.ChunkedStream = ChunkedStream; 3288 3289class ChunkedStreamManager { 3290 constructor(pdfNetworkStream, args) { 3291 this.length = args.length; 3292 this.chunkSize = args.rangeChunkSize; 3293 this.stream = new ChunkedStream(this.length, this.chunkSize, this); 3294 this.pdfNetworkStream = pdfNetworkStream; 3295 this.disableAutoFetch = args.disableAutoFetch; 3296 this.msgHandler = args.msgHandler; 3297 this.currRequestId = 0; 3298 this._chunksNeededByRequest = new Map(); 3299 this._requestsByChunk = new Map(); 3300 this._promisesByRequest = new Map(); 3301 this.progressiveDataLength = 0; 3302 this.aborted = false; 3303 this._loadedStreamCapability = (0, _util.createPromiseCapability)(); 3304 } 3305 3306 onLoadedStream() { 3307 return this._loadedStreamCapability.promise; 3308 } 3309 3310 sendRequest(begin, end) { 3311 const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end); 3312 3313 if (!rangeReader.isStreamingSupported) { 3314 rangeReader.onProgress = this.onProgress.bind(this); 3315 } 3316 3317 let chunks = [], 3318 loaded = 0; 3319 return new Promise((resolve, reject) => { 3320 const readChunk = chunk => { 3321 try { 3322 if (!chunk.done) { 3323 const data = chunk.value; 3324 chunks.push(data); 3325 loaded += (0, _util.arrayByteLength)(data); 3326 3327 if (rangeReader.isStreamingSupported) { 3328 this.onProgress({ 3329 loaded 3330 }); 3331 } 3332 3333 rangeReader.read().then(readChunk, reject); 3334 return; 3335 } 3336 3337 const chunkData = (0, _util.arraysToBytes)(chunks); 3338 chunks = null; 3339 resolve(chunkData); 3340 } catch (e) { 3341 reject(e); 3342 } 3343 }; 3344 3345 rangeReader.read().then(readChunk, reject); 3346 }).then(data => { 3347 if (this.aborted) { 3348 return; 3349 } 3350 3351 this.onReceiveData({ 3352 chunk: data, 3353 begin 3354 }); 3355 }); 3356 } 3357 3358 requestAllChunks() { 3359 const missingChunks = this.stream.getMissingChunks(); 3360 3361 this._requestChunks(missingChunks); 3362 3363 return this._loadedStreamCapability.promise; 3364 } 3365 3366 _requestChunks(chunks) { 3367 const requestId = this.currRequestId++; 3368 const chunksNeeded = new Set(); 3369 3370 this._chunksNeededByRequest.set(requestId, chunksNeeded); 3371 3372 for (const chunk of chunks) { 3373 if (!this.stream.hasChunk(chunk)) { 3374 chunksNeeded.add(chunk); 3375 } 3376 } 3377 3378 if (chunksNeeded.size === 0) { 3379 return Promise.resolve(); 3380 } 3381 3382 const capability = (0, _util.createPromiseCapability)(); 3383 3384 this._promisesByRequest.set(requestId, capability); 3385 3386 const chunksToRequest = []; 3387 3388 for (const chunk of chunksNeeded) { 3389 let requestIds = this._requestsByChunk.get(chunk); 3390 3391 if (!requestIds) { 3392 requestIds = []; 3393 3394 this._requestsByChunk.set(chunk, requestIds); 3395 3396 chunksToRequest.push(chunk); 3397 } 3398 3399 requestIds.push(requestId); 3400 } 3401 3402 if (chunksToRequest.length > 0) { 3403 const groupedChunksToRequest = this.groupChunks(chunksToRequest); 3404 3405 for (const groupedChunk of groupedChunksToRequest) { 3406 const begin = groupedChunk.beginChunk * this.chunkSize; 3407 const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length); 3408 this.sendRequest(begin, end).catch(capability.reject); 3409 } 3410 } 3411 3412 return capability.promise.catch(reason => { 3413 if (this.aborted) { 3414 return; 3415 } 3416 3417 throw reason; 3418 }); 3419 } 3420 3421 getStream() { 3422 return this.stream; 3423 } 3424 3425 requestRange(begin, end) { 3426 end = Math.min(end, this.length); 3427 const beginChunk = this.getBeginChunk(begin); 3428 const endChunk = this.getEndChunk(end); 3429 const chunks = []; 3430 3431 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 3432 chunks.push(chunk); 3433 } 3434 3435 return this._requestChunks(chunks); 3436 } 3437 3438 requestRanges(ranges = []) { 3439 const chunksToRequest = []; 3440 3441 for (const range of ranges) { 3442 const beginChunk = this.getBeginChunk(range.begin); 3443 const endChunk = this.getEndChunk(range.end); 3444 3445 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 3446 if (!chunksToRequest.includes(chunk)) { 3447 chunksToRequest.push(chunk); 3448 } 3449 } 3450 } 3451 3452 chunksToRequest.sort(function (a, b) { 3453 return a - b; 3454 }); 3455 return this._requestChunks(chunksToRequest); 3456 } 3457 3458 groupChunks(chunks) { 3459 const groupedChunks = []; 3460 let beginChunk = -1; 3461 let prevChunk = -1; 3462 3463 for (let i = 0, ii = chunks.length; i < ii; ++i) { 3464 const chunk = chunks[i]; 3465 3466 if (beginChunk < 0) { 3467 beginChunk = chunk; 3468 } 3469 3470 if (prevChunk >= 0 && prevChunk + 1 !== chunk) { 3471 groupedChunks.push({ 3472 beginChunk, 3473 endChunk: prevChunk + 1 3474 }); 3475 beginChunk = chunk; 3476 } 3477 3478 if (i + 1 === chunks.length) { 3479 groupedChunks.push({ 3480 beginChunk, 3481 endChunk: chunk + 1 3482 }); 3483 } 3484 3485 prevChunk = chunk; 3486 } 3487 3488 return groupedChunks; 3489 } 3490 3491 onProgress(args) { 3492 this.msgHandler.send("DocProgress", { 3493 loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded, 3494 total: this.length 3495 }); 3496 } 3497 3498 onReceiveData(args) { 3499 const chunk = args.chunk; 3500 const isProgressive = args.begin === undefined; 3501 const begin = isProgressive ? this.progressiveDataLength : args.begin; 3502 const end = begin + chunk.byteLength; 3503 const beginChunk = Math.floor(begin / this.chunkSize); 3504 const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize); 3505 3506 if (isProgressive) { 3507 this.stream.onReceiveProgressiveData(chunk); 3508 this.progressiveDataLength = end; 3509 } else { 3510 this.stream.onReceiveData(begin, chunk); 3511 } 3512 3513 if (this.stream.isDataLoaded) { 3514 this._loadedStreamCapability.resolve(this.stream); 3515 } 3516 3517 const loadedRequests = []; 3518 3519 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 3520 const requestIds = this._requestsByChunk.get(curChunk); 3521 3522 if (!requestIds) { 3523 continue; 3524 } 3525 3526 this._requestsByChunk.delete(curChunk); 3527 3528 for (const requestId of requestIds) { 3529 const chunksNeeded = this._chunksNeededByRequest.get(requestId); 3530 3531 if (chunksNeeded.has(curChunk)) { 3532 chunksNeeded.delete(curChunk); 3533 } 3534 3535 if (chunksNeeded.size > 0) { 3536 continue; 3537 } 3538 3539 loadedRequests.push(requestId); 3540 } 3541 } 3542 3543 if (!this.disableAutoFetch && this._requestsByChunk.size === 0) { 3544 let nextEmptyChunk; 3545 3546 if (this.stream.numChunksLoaded === 1) { 3547 const lastChunk = this.stream.numChunks - 1; 3548 3549 if (!this.stream.hasChunk(lastChunk)) { 3550 nextEmptyChunk = lastChunk; 3551 } 3552 } else { 3553 nextEmptyChunk = this.stream.nextEmptyChunk(endChunk); 3554 } 3555 3556 if (Number.isInteger(nextEmptyChunk)) { 3557 this._requestChunks([nextEmptyChunk]); 3558 } 3559 } 3560 3561 for (const requestId of loadedRequests) { 3562 const capability = this._promisesByRequest.get(requestId); 3563 3564 this._promisesByRequest.delete(requestId); 3565 3566 capability.resolve(); 3567 } 3568 3569 this.msgHandler.send("DocProgress", { 3570 loaded: this.stream.numChunksLoaded * this.chunkSize, 3571 total: this.length 3572 }); 3573 } 3574 3575 onError(err) { 3576 this._loadedStreamCapability.reject(err); 3577 } 3578 3579 getBeginChunk(begin) { 3580 return Math.floor(begin / this.chunkSize); 3581 } 3582 3583 getEndChunk(end) { 3584 return Math.floor((end - 1) / this.chunkSize) + 1; 3585 } 3586 3587 abort(reason) { 3588 this.aborted = true; 3589 3590 if (this.pdfNetworkStream) { 3591 this.pdfNetworkStream.cancelAllRequests(reason); 3592 } 3593 3594 for (const capability of this._promisesByRequest.values()) { 3595 capability.reject(reason); 3596 } 3597 } 3598 3599} 3600 3601exports.ChunkedStreamManager = ChunkedStreamManager; 3602 3603/***/ }), 3604/* 10 */ 3605/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 3606 3607 3608 3609Object.defineProperty(exports, "__esModule", ({ 3610 value: true 3611})); 3612exports.StringStream = exports.Stream = exports.NullStream = void 0; 3613 3614var _base_stream = __w_pdfjs_require__(7); 3615 3616var _util = __w_pdfjs_require__(2); 3617 3618class Stream extends _base_stream.BaseStream { 3619 constructor(arrayBuffer, start, length, dict) { 3620 super(); 3621 this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer); 3622 this.start = start || 0; 3623 this.pos = this.start; 3624 this.end = start + length || this.bytes.length; 3625 this.dict = dict; 3626 } 3627 3628 get length() { 3629 return this.end - this.start; 3630 } 3631 3632 get isEmpty() { 3633 return this.length === 0; 3634 } 3635 3636 getByte() { 3637 if (this.pos >= this.end) { 3638 return -1; 3639 } 3640 3641 return this.bytes[this.pos++]; 3642 } 3643 3644 getBytes(length) { 3645 const bytes = this.bytes; 3646 const pos = this.pos; 3647 const strEnd = this.end; 3648 3649 if (!length) { 3650 return bytes.subarray(pos, strEnd); 3651 } 3652 3653 let end = pos + length; 3654 3655 if (end > strEnd) { 3656 end = strEnd; 3657 } 3658 3659 this.pos = end; 3660 return bytes.subarray(pos, end); 3661 } 3662 3663 getByteRange(begin, end) { 3664 if (begin < 0) { 3665 begin = 0; 3666 } 3667 3668 if (end > this.end) { 3669 end = this.end; 3670 } 3671 3672 return this.bytes.subarray(begin, end); 3673 } 3674 3675 reset() { 3676 this.pos = this.start; 3677 } 3678 3679 moveStart() { 3680 this.start = this.pos; 3681 } 3682 3683 makeSubStream(start, length, dict = null) { 3684 return new Stream(this.bytes.buffer, start, length, dict); 3685 } 3686 3687} 3688 3689exports.Stream = Stream; 3690 3691class StringStream extends Stream { 3692 constructor(str) { 3693 super((0, _util.stringToBytes)(str)); 3694 } 3695 3696} 3697 3698exports.StringStream = StringStream; 3699 3700class NullStream extends Stream { 3701 constructor() { 3702 super(new Uint8Array(0)); 3703 } 3704 3705} 3706 3707exports.NullStream = NullStream; 3708 3709/***/ }), 3710/* 11 */ 3711/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 3712 3713 3714 3715Object.defineProperty(exports, "__esModule", ({ 3716 value: true 3717})); 3718exports.Page = exports.PDFDocument = void 0; 3719 3720var _annotation = __w_pdfjs_require__(12); 3721 3722var _util = __w_pdfjs_require__(2); 3723 3724var _core_utils = __w_pdfjs_require__(6); 3725 3726var _primitives = __w_pdfjs_require__(5); 3727 3728var _xfa_fonts = __w_pdfjs_require__(51); 3729 3730var _base_stream = __w_pdfjs_require__(7); 3731 3732var _crypto = __w_pdfjs_require__(67); 3733 3734var _catalog = __w_pdfjs_require__(69); 3735 3736var _cleanup_helper = __w_pdfjs_require__(71); 3737 3738var _dataset_reader = __w_pdfjs_require__(100); 3739 3740var _parser = __w_pdfjs_require__(17); 3741 3742var _stream = __w_pdfjs_require__(10); 3743 3744var _object_loader = __w_pdfjs_require__(75); 3745 3746var _operator_list = __w_pdfjs_require__(62); 3747 3748var _evaluator = __w_pdfjs_require__(15); 3749 3750var _decode_stream = __w_pdfjs_require__(19); 3751 3752var _struct_tree = __w_pdfjs_require__(74); 3753 3754var _writer = __w_pdfjs_require__(65); 3755 3756var _factory = __w_pdfjs_require__(76); 3757 3758var _xref = __w_pdfjs_require__(101); 3759 3760const DEFAULT_USER_UNIT = 1.0; 3761const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792]; 3762 3763class Page { 3764 constructor({ 3765 pdfManager, 3766 xref, 3767 pageIndex, 3768 pageDict, 3769 ref, 3770 globalIdFactory, 3771 fontCache, 3772 builtInCMapCache, 3773 standardFontDataCache, 3774 globalImageCache, 3775 nonBlendModesSet, 3776 xfaFactory 3777 }) { 3778 this.pdfManager = pdfManager; 3779 this.pageIndex = pageIndex; 3780 this.pageDict = pageDict; 3781 this.xref = xref; 3782 this.ref = ref; 3783 this.fontCache = fontCache; 3784 this.builtInCMapCache = builtInCMapCache; 3785 this.standardFontDataCache = standardFontDataCache; 3786 this.globalImageCache = globalImageCache; 3787 this.nonBlendModesSet = nonBlendModesSet; 3788 this.evaluatorOptions = pdfManager.evaluatorOptions; 3789 this.resourcesPromise = null; 3790 this.xfaFactory = xfaFactory; 3791 const idCounters = { 3792 obj: 0 3793 }; 3794 this._localIdFactory = class extends globalIdFactory { 3795 static createObjId() { 3796 return `p${pageIndex}_${++idCounters.obj}`; 3797 } 3798 3799 static getPageObjId() { 3800 return `page${ref.toString()}`; 3801 } 3802 3803 }; 3804 } 3805 3806 _getInheritableProperty(key, getArray = false) { 3807 const value = (0, _core_utils.getInheritableProperty)({ 3808 dict: this.pageDict, 3809 key, 3810 getArray, 3811 stopWhenFound: false 3812 }); 3813 3814 if (!Array.isArray(value)) { 3815 return value; 3816 } 3817 3818 if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) { 3819 return value[0]; 3820 } 3821 3822 return _primitives.Dict.merge({ 3823 xref: this.xref, 3824 dictArray: value 3825 }); 3826 } 3827 3828 get content() { 3829 return this.pageDict.getArray("Contents"); 3830 } 3831 3832 get resources() { 3833 const resources = this._getInheritableProperty("Resources"); 3834 3835 return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty); 3836 } 3837 3838 _getBoundingBox(name) { 3839 if (this.xfaData) { 3840 return this.xfaData.bbox; 3841 } 3842 3843 const box = this._getInheritableProperty(name, true); 3844 3845 if (Array.isArray(box) && box.length === 4) { 3846 if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) { 3847 return box; 3848 } 3849 3850 (0, _util.warn)(`Empty /${name} entry.`); 3851 } 3852 3853 return null; 3854 } 3855 3856 get mediaBox() { 3857 return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX); 3858 } 3859 3860 get cropBox() { 3861 return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox); 3862 } 3863 3864 get userUnit() { 3865 let obj = this.pageDict.get("UserUnit"); 3866 3867 if (typeof obj !== "number" || obj <= 0) { 3868 obj = DEFAULT_USER_UNIT; 3869 } 3870 3871 return (0, _util.shadow)(this, "userUnit", obj); 3872 } 3873 3874 get view() { 3875 const { 3876 cropBox, 3877 mediaBox 3878 } = this; 3879 let view; 3880 3881 if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) { 3882 view = mediaBox; 3883 } else { 3884 const box = _util.Util.intersect(cropBox, mediaBox); 3885 3886 if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) { 3887 view = box; 3888 } else { 3889 (0, _util.warn)("Empty /CropBox and /MediaBox intersection."); 3890 } 3891 } 3892 3893 return (0, _util.shadow)(this, "view", view || mediaBox); 3894 } 3895 3896 get rotate() { 3897 let rotate = this._getInheritableProperty("Rotate") || 0; 3898 3899 if (rotate % 90 !== 0) { 3900 rotate = 0; 3901 } else if (rotate >= 360) { 3902 rotate %= 360; 3903 } else if (rotate < 0) { 3904 rotate = (rotate % 360 + 360) % 360; 3905 } 3906 3907 return (0, _util.shadow)(this, "rotate", rotate); 3908 } 3909 3910 _onSubStreamError(handler, reason, objId) { 3911 if (this.evaluatorOptions.ignoreErrors) { 3912 handler.send("UnsupportedFeature", { 3913 featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream 3914 }); 3915 (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`); 3916 return; 3917 } 3918 3919 throw reason; 3920 } 3921 3922 getContentStream(handler) { 3923 return this.pdfManager.ensure(this, "content").then(content => { 3924 if (content instanceof _base_stream.BaseStream) { 3925 return content; 3926 } 3927 3928 if (Array.isArray(content)) { 3929 return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler)); 3930 } 3931 3932 return new _stream.NullStream(); 3933 }); 3934 } 3935 3936 get xfaData() { 3937 return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? { 3938 bbox: this.xfaFactory.getBoundingBox(this.pageIndex) 3939 } : null); 3940 } 3941 3942 async saveNewAnnotations(handler, task, annotations) { 3943 if (this.xfaFactory) { 3944 throw new Error("XFA: Cannot save new annotations."); 3945 } 3946 3947 const partialEvaluator = new _evaluator.PartialEvaluator({ 3948 xref: this.xref, 3949 handler, 3950 pageIndex: this.pageIndex, 3951 idFactory: this._localIdFactory, 3952 fontCache: this.fontCache, 3953 builtInCMapCache: this.builtInCMapCache, 3954 standardFontDataCache: this.standardFontDataCache, 3955 globalImageCache: this.globalImageCache, 3956 options: this.evaluatorOptions 3957 }); 3958 const pageDict = this.pageDict; 3959 const annotationsArray = this.annotations.slice(); 3960 const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations); 3961 3962 for (const { 3963 ref 3964 } of newData.annotations) { 3965 annotationsArray.push(ref); 3966 } 3967 3968 const savedDict = pageDict.get("Annots"); 3969 pageDict.set("Annots", annotationsArray); 3970 const buffer = []; 3971 let transform = null; 3972 3973 if (this.xref.encrypt) { 3974 transform = this.xref.encrypt.createCipherTransform(this.ref.num, this.ref.gen); 3975 } 3976 3977 (0, _writer.writeObject)(this.ref, pageDict, buffer, transform); 3978 3979 if (savedDict) { 3980 pageDict.set("Annots", savedDict); 3981 } 3982 3983 const objects = newData.dependencies; 3984 objects.push({ 3985 ref: this.ref, 3986 data: buffer.join("") 3987 }, ...newData.annotations); 3988 return objects; 3989 } 3990 3991 save(handler, task, annotationStorage) { 3992 const partialEvaluator = new _evaluator.PartialEvaluator({ 3993 xref: this.xref, 3994 handler, 3995 pageIndex: this.pageIndex, 3996 idFactory: this._localIdFactory, 3997 fontCache: this.fontCache, 3998 builtInCMapCache: this.builtInCMapCache, 3999 standardFontDataCache: this.standardFontDataCache, 4000 globalImageCache: this.globalImageCache, 4001 options: this.evaluatorOptions 4002 }); 4003 return this._parsedAnnotations.then(function (annotations) { 4004 const newRefsPromises = []; 4005 4006 for (const annotation of annotations) { 4007 if (!annotation.mustBePrinted(annotationStorage)) { 4008 continue; 4009 } 4010 4011 newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) { 4012 (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`); 4013 return null; 4014 })); 4015 } 4016 4017 return Promise.all(newRefsPromises).then(function (newRefs) { 4018 return newRefs.filter(newRef => !!newRef); 4019 }); 4020 }); 4021 } 4022 4023 loadResources(keys) { 4024 if (!this.resourcesPromise) { 4025 this.resourcesPromise = this.pdfManager.ensure(this, "resources"); 4026 } 4027 4028 return this.resourcesPromise.then(() => { 4029 const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref); 4030 return objectLoader.load(); 4031 }); 4032 } 4033 4034 getOperatorList({ 4035 handler, 4036 sink, 4037 task, 4038 intent, 4039 cacheKey, 4040 annotationStorage = null 4041 }) { 4042 const contentStreamPromise = this.getContentStream(handler); 4043 const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]); 4044 const partialEvaluator = new _evaluator.PartialEvaluator({ 4045 xref: this.xref, 4046 handler, 4047 pageIndex: this.pageIndex, 4048 idFactory: this._localIdFactory, 4049 fontCache: this.fontCache, 4050 builtInCMapCache: this.builtInCMapCache, 4051 standardFontDataCache: this.standardFontDataCache, 4052 globalImageCache: this.globalImageCache, 4053 options: this.evaluatorOptions 4054 }); 4055 const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null; 4056 let newAnnotationsPromise = Promise.resolve(null); 4057 4058 if (newAnnotationsByPage) { 4059 const newAnnotations = newAnnotationsByPage.get(this.pageIndex); 4060 4061 if (newAnnotations) { 4062 newAnnotationsPromise = _annotation.AnnotationFactory.printNewAnnotations(partialEvaluator, task, newAnnotations); 4063 } 4064 } 4065 4066 const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); 4067 const pageListPromise = dataPromises.then(([contentStream]) => { 4068 const opList = new _operator_list.OperatorList(intent, sink); 4069 handler.send("StartRenderPage", { 4070 transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet), 4071 pageIndex: this.pageIndex, 4072 cacheKey 4073 }); 4074 return partialEvaluator.getOperatorList({ 4075 stream: contentStream, 4076 task, 4077 resources: this.resources, 4078 operatorList: opList 4079 }).then(function () { 4080 return opList; 4081 }); 4082 }); 4083 return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function ([pageOpList, annotations, newAnnotations]) { 4084 if (newAnnotations) { 4085 annotations = annotations.concat(newAnnotations); 4086 } 4087 4088 if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) { 4089 pageOpList.flush(true); 4090 return { 4091 length: pageOpList.totalLength 4092 }; 4093 } 4094 4095 const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS), 4096 intentAny = !!(intent & _util.RenderingIntentFlag.ANY), 4097 intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY), 4098 intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT); 4099 const opListPromises = []; 4100 4101 for (const annotation of annotations) { 4102 if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) { 4103 opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) { 4104 (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`); 4105 return null; 4106 })); 4107 } 4108 } 4109 4110 return Promise.all(opListPromises).then(function (opLists) { 4111 let form = false, 4112 canvas = false; 4113 4114 for (const { 4115 opList, 4116 separateForm, 4117 separateCanvas 4118 } of opLists) { 4119 pageOpList.addOpList(opList); 4120 4121 if (separateForm) { 4122 form = separateForm; 4123 } 4124 4125 if (separateCanvas) { 4126 canvas = separateCanvas; 4127 } 4128 } 4129 4130 pageOpList.flush(true, { 4131 form, 4132 canvas 4133 }); 4134 return { 4135 length: pageOpList.totalLength 4136 }; 4137 }); 4138 }); 4139 } 4140 4141 extractTextContent({ 4142 handler, 4143 task, 4144 includeMarkedContent, 4145 sink, 4146 combineTextItems 4147 }) { 4148 const contentStreamPromise = this.getContentStream(handler); 4149 const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]); 4150 const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); 4151 return dataPromises.then(([contentStream]) => { 4152 const partialEvaluator = new _evaluator.PartialEvaluator({ 4153 xref: this.xref, 4154 handler, 4155 pageIndex: this.pageIndex, 4156 idFactory: this._localIdFactory, 4157 fontCache: this.fontCache, 4158 builtInCMapCache: this.builtInCMapCache, 4159 standardFontDataCache: this.standardFontDataCache, 4160 globalImageCache: this.globalImageCache, 4161 options: this.evaluatorOptions 4162 }); 4163 return partialEvaluator.getTextContent({ 4164 stream: contentStream, 4165 task, 4166 resources: this.resources, 4167 includeMarkedContent, 4168 combineTextItems, 4169 sink, 4170 viewBox: this.view 4171 }); 4172 }); 4173 } 4174 4175 async getStructTree() { 4176 const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot"); 4177 4178 if (!structTreeRoot) { 4179 return null; 4180 } 4181 4182 const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]); 4183 return structTree.serializable; 4184 } 4185 4186 _parseStructTree(structTreeRoot) { 4187 const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict); 4188 tree.parse(); 4189 return tree; 4190 } 4191 4192 async getAnnotationsData(handler, task, intent) { 4193 const annotations = await this._parsedAnnotations; 4194 4195 if (annotations.length === 0) { 4196 return []; 4197 } 4198 4199 const textContentPromises = []; 4200 const annotationsData = []; 4201 let partialEvaluator; 4202 const intentAny = !!(intent & _util.RenderingIntentFlag.ANY), 4203 intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY), 4204 intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT); 4205 4206 for (const annotation of annotations) { 4207 const isVisible = intentAny || intentDisplay && annotation.viewable; 4208 4209 if (isVisible || intentPrint && annotation.printable) { 4210 annotationsData.push(annotation.data); 4211 } 4212 4213 if (annotation.hasTextContent && isVisible) { 4214 if (!partialEvaluator) { 4215 partialEvaluator = new _evaluator.PartialEvaluator({ 4216 xref: this.xref, 4217 handler, 4218 pageIndex: this.pageIndex, 4219 idFactory: this._localIdFactory, 4220 fontCache: this.fontCache, 4221 builtInCMapCache: this.builtInCMapCache, 4222 standardFontDataCache: this.standardFontDataCache, 4223 globalImageCache: this.globalImageCache, 4224 options: this.evaluatorOptions 4225 }); 4226 } 4227 4228 textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, this.view).catch(function (reason) { 4229 (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`); 4230 })); 4231 } 4232 } 4233 4234 await Promise.all(textContentPromises); 4235 return annotationsData; 4236 } 4237 4238 get annotations() { 4239 const annots = this._getInheritableProperty("Annots"); 4240 4241 return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []); 4242 } 4243 4244 get _parsedAnnotations() { 4245 const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => { 4246 const annotationPromises = []; 4247 4248 for (const annotationRef of this.annotations) { 4249 annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) { 4250 (0, _util.warn)(`_parsedAnnotations: "${reason}".`); 4251 return null; 4252 })); 4253 } 4254 4255 return Promise.all(annotationPromises).then(function (annotations) { 4256 if (annotations.length === 0) { 4257 return annotations; 4258 } 4259 4260 const sortedAnnotations = []; 4261 let popupAnnotations; 4262 4263 for (const annotation of annotations) { 4264 if (!annotation) { 4265 continue; 4266 } 4267 4268 if (annotation instanceof _annotation.PopupAnnotation) { 4269 if (!popupAnnotations) { 4270 popupAnnotations = []; 4271 } 4272 4273 popupAnnotations.push(annotation); 4274 continue; 4275 } 4276 4277 sortedAnnotations.push(annotation); 4278 } 4279 4280 if (popupAnnotations) { 4281 sortedAnnotations.push(...popupAnnotations); 4282 } 4283 4284 return sortedAnnotations; 4285 }); 4286 }); 4287 return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations); 4288 } 4289 4290 get jsActions() { 4291 const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType); 4292 return (0, _util.shadow)(this, "jsActions", actions); 4293 } 4294 4295} 4296 4297exports.Page = Page; 4298const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]); 4299const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]); 4300const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]); 4301const FINGERPRINT_FIRST_BYTES = 1024; 4302const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; 4303const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.\d$/; 4304 4305function find(stream, signature, limit = 1024, backwards = false) { 4306 const signatureLength = signature.length; 4307 const scanBytes = stream.peekBytes(limit); 4308 const scanLength = scanBytes.length - signatureLength; 4309 4310 if (scanLength <= 0) { 4311 return false; 4312 } 4313 4314 if (backwards) { 4315 const signatureEnd = signatureLength - 1; 4316 let pos = scanBytes.length - 1; 4317 4318 while (pos >= signatureEnd) { 4319 let j = 0; 4320 4321 while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) { 4322 j++; 4323 } 4324 4325 if (j >= signatureLength) { 4326 stream.pos += pos - signatureEnd; 4327 return true; 4328 } 4329 4330 pos--; 4331 } 4332 } else { 4333 let pos = 0; 4334 4335 while (pos <= scanLength) { 4336 let j = 0; 4337 4338 while (j < signatureLength && scanBytes[pos + j] === signature[j]) { 4339 j++; 4340 } 4341 4342 if (j >= signatureLength) { 4343 stream.pos += pos; 4344 return true; 4345 } 4346 4347 pos++; 4348 } 4349 } 4350 4351 return false; 4352} 4353 4354class PDFDocument { 4355 constructor(pdfManager, stream) { 4356 if (stream.length <= 0) { 4357 throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes."); 4358 } 4359 4360 this.pdfManager = pdfManager; 4361 this.stream = stream; 4362 this.xref = new _xref.XRef(stream, pdfManager); 4363 this._pagePromises = new Map(); 4364 this._version = null; 4365 const idCounters = { 4366 font: 0 4367 }; 4368 this._globalIdFactory = class { 4369 static getDocId() { 4370 return `g_${pdfManager.docId}`; 4371 } 4372 4373 static createFontId() { 4374 return `f${++idCounters.font}`; 4375 } 4376 4377 static createObjId() { 4378 (0, _util.unreachable)("Abstract method `createObjId` called."); 4379 } 4380 4381 static getPageObjId() { 4382 (0, _util.unreachable)("Abstract method `getPageObjId` called."); 4383 } 4384 4385 }; 4386 } 4387 4388 parse(recoveryMode) { 4389 this.xref.parse(recoveryMode); 4390 this.catalog = new _catalog.Catalog(this.pdfManager, this.xref); 4391 4392 if (this.catalog.version) { 4393 this._version = this.catalog.version; 4394 } 4395 } 4396 4397 get linearization() { 4398 let linearization = null; 4399 4400 try { 4401 linearization = _parser.Linearization.create(this.stream); 4402 } catch (err) { 4403 if (err instanceof _core_utils.MissingDataException) { 4404 throw err; 4405 } 4406 4407 (0, _util.info)(err); 4408 } 4409 4410 return (0, _util.shadow)(this, "linearization", linearization); 4411 } 4412 4413 get startXRef() { 4414 const stream = this.stream; 4415 let startXRef = 0; 4416 4417 if (this.linearization) { 4418 stream.reset(); 4419 4420 if (find(stream, ENDOBJ_SIGNATURE)) { 4421 startXRef = stream.pos + 6 - stream.start; 4422 } 4423 } else { 4424 const step = 1024; 4425 const startXRefLength = STARTXREF_SIGNATURE.length; 4426 let found = false, 4427 pos = stream.end; 4428 4429 while (!found && pos > 0) { 4430 pos -= step - startXRefLength; 4431 4432 if (pos < 0) { 4433 pos = 0; 4434 } 4435 4436 stream.pos = pos; 4437 found = find(stream, STARTXREF_SIGNATURE, step, true); 4438 } 4439 4440 if (found) { 4441 stream.skip(9); 4442 let ch; 4443 4444 do { 4445 ch = stream.getByte(); 4446 } while ((0, _core_utils.isWhiteSpace)(ch)); 4447 4448 let str = ""; 4449 4450 while (ch >= 0x20 && ch <= 0x39) { 4451 str += String.fromCharCode(ch); 4452 ch = stream.getByte(); 4453 } 4454 4455 startXRef = parseInt(str, 10); 4456 4457 if (isNaN(startXRef)) { 4458 startXRef = 0; 4459 } 4460 } 4461 } 4462 4463 return (0, _util.shadow)(this, "startXRef", startXRef); 4464 } 4465 4466 checkHeader() { 4467 const stream = this.stream; 4468 stream.reset(); 4469 4470 if (!find(stream, PDF_HEADER_SIGNATURE)) { 4471 return; 4472 } 4473 4474 stream.moveStart(); 4475 const MAX_PDF_VERSION_LENGTH = 12; 4476 let version = "", 4477 ch; 4478 4479 while ((ch = stream.getByte()) > 0x20) { 4480 if (version.length >= MAX_PDF_VERSION_LENGTH) { 4481 break; 4482 } 4483 4484 version += String.fromCharCode(ch); 4485 } 4486 4487 if (!this._version) { 4488 this._version = version.substring(5); 4489 } 4490 } 4491 4492 parseStartXRef() { 4493 this.xref.setStartXRef(this.startXRef); 4494 } 4495 4496 get numPages() { 4497 let num = 0; 4498 4499 if (this.catalog.hasActualNumPages) { 4500 num = this.catalog.numPages; 4501 } else if (this.xfaFactory) { 4502 num = this.xfaFactory.getNumPages(); 4503 } else if (this.linearization) { 4504 num = this.linearization.numPages; 4505 } else { 4506 num = this.catalog.numPages; 4507 } 4508 4509 return (0, _util.shadow)(this, "numPages", num); 4510 } 4511 4512 _hasOnlyDocumentSignatures(fields, recursionDepth = 0) { 4513 const RECURSION_LIMIT = 10; 4514 4515 if (!Array.isArray(fields)) { 4516 return false; 4517 } 4518 4519 return fields.every(field => { 4520 field = this.xref.fetchIfRef(field); 4521 4522 if (!(field instanceof _primitives.Dict)) { 4523 return false; 4524 } 4525 4526 if (field.has("Kids")) { 4527 if (++recursionDepth > RECURSION_LIMIT) { 4528 (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached"); 4529 return false; 4530 } 4531 4532 return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth); 4533 } 4534 4535 const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig"); 4536 const rectangle = field.get("Rect"); 4537 const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0); 4538 return isSignature && isInvisible; 4539 }); 4540 } 4541 4542 get _xfaStreams() { 4543 const acroForm = this.catalog.acroForm; 4544 4545 if (!acroForm) { 4546 return null; 4547 } 4548 4549 const xfa = acroForm.get("XFA"); 4550 const entries = { 4551 "xdp:xdp": "", 4552 template: "", 4553 datasets: "", 4554 config: "", 4555 connectionSet: "", 4556 localeSet: "", 4557 stylesheet: "", 4558 "/xdp:xdp": "" 4559 }; 4560 4561 if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) { 4562 entries["xdp:xdp"] = xfa; 4563 return entries; 4564 } 4565 4566 if (!Array.isArray(xfa) || xfa.length === 0) { 4567 return null; 4568 } 4569 4570 for (let i = 0, ii = xfa.length; i < ii; i += 2) { 4571 let name; 4572 4573 if (i === 0) { 4574 name = "xdp:xdp"; 4575 } else if (i === ii - 2) { 4576 name = "/xdp:xdp"; 4577 } else { 4578 name = xfa[i]; 4579 } 4580 4581 if (!entries.hasOwnProperty(name)) { 4582 continue; 4583 } 4584 4585 const data = this.xref.fetchIfRef(xfa[i + 1]); 4586 4587 if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) { 4588 continue; 4589 } 4590 4591 entries[name] = data; 4592 } 4593 4594 return entries; 4595 } 4596 4597 get xfaDatasets() { 4598 const streams = this._xfaStreams; 4599 4600 if (!streams) { 4601 return (0, _util.shadow)(this, "xfaDatasets", null); 4602 } 4603 4604 for (const key of ["datasets", "xdp:xdp"]) { 4605 const stream = streams[key]; 4606 4607 if (!stream) { 4608 continue; 4609 } 4610 4611 try { 4612 const str = (0, _util.stringToUTF8String)(stream.getString()); 4613 const data = { 4614 [key]: str 4615 }; 4616 return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data)); 4617 } catch (_) { 4618 (0, _util.warn)("XFA - Invalid utf-8 string."); 4619 break; 4620 } 4621 } 4622 4623 return (0, _util.shadow)(this, "xfaDatasets", null); 4624 } 4625 4626 get xfaData() { 4627 const streams = this._xfaStreams; 4628 4629 if (!streams) { 4630 return null; 4631 } 4632 4633 const data = Object.create(null); 4634 4635 for (const [key, stream] of Object.entries(streams)) { 4636 if (!stream) { 4637 continue; 4638 } 4639 4640 try { 4641 data[key] = (0, _util.stringToUTF8String)(stream.getString()); 4642 } catch (_) { 4643 (0, _util.warn)("XFA - Invalid utf-8 string."); 4644 return null; 4645 } 4646 } 4647 4648 return data; 4649 } 4650 4651 get xfaFactory() { 4652 let data; 4653 4654 if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) { 4655 data = this.xfaData; 4656 } 4657 4658 return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null); 4659 } 4660 4661 get isPureXfa() { 4662 return this.xfaFactory ? this.xfaFactory.isValid() : false; 4663 } 4664 4665 get htmlForXfa() { 4666 return this.xfaFactory ? this.xfaFactory.getPages() : null; 4667 } 4668 4669 async loadXfaImages() { 4670 const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages"); 4671 4672 if (!xfaImagesDict) { 4673 return; 4674 } 4675 4676 const keys = xfaImagesDict.getKeys(); 4677 const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref); 4678 await objectLoader.load(); 4679 const xfaImages = new Map(); 4680 4681 for (const key of keys) { 4682 const stream = xfaImagesDict.get(key); 4683 4684 if (stream instanceof _base_stream.BaseStream) { 4685 xfaImages.set(key, stream.getBytes()); 4686 } 4687 } 4688 4689 this.xfaFactory.setImages(xfaImages); 4690 } 4691 4692 async loadXfaFonts(handler, task) { 4693 const acroForm = await this.pdfManager.ensureCatalog("acroForm"); 4694 4695 if (!acroForm) { 4696 return; 4697 } 4698 4699 const resources = await acroForm.getAsync("DR"); 4700 4701 if (!(resources instanceof _primitives.Dict)) { 4702 return; 4703 } 4704 4705 const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref); 4706 await objectLoader.load(); 4707 const fontRes = resources.get("Font"); 4708 4709 if (!(fontRes instanceof _primitives.Dict)) { 4710 return; 4711 } 4712 4713 const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions); 4714 options.useSystemFonts = false; 4715 const partialEvaluator = new _evaluator.PartialEvaluator({ 4716 xref: this.xref, 4717 handler, 4718 pageIndex: -1, 4719 idFactory: this._globalIdFactory, 4720 fontCache: this.catalog.fontCache, 4721 builtInCMapCache: this.catalog.builtInCMapCache, 4722 standardFontDataCache: this.catalog.standardFontDataCache, 4723 options 4724 }); 4725 const operatorList = new _operator_list.OperatorList(); 4726 const pdfFonts = []; 4727 const initialState = { 4728 get font() { 4729 return pdfFonts.at(-1); 4730 }, 4731 4732 set font(font) { 4733 pdfFonts.push(font); 4734 }, 4735 4736 clone() { 4737 return this; 4738 } 4739 4740 }; 4741 const fonts = new Map(); 4742 fontRes.forEach((fontName, font) => { 4743 fonts.set(fontName, font); 4744 }); 4745 const promises = []; 4746 4747 for (const [fontName, font] of fonts) { 4748 const descriptor = font.get("FontDescriptor"); 4749 4750 if (!(descriptor instanceof _primitives.Dict)) { 4751 continue; 4752 } 4753 4754 let fontFamily = descriptor.get("FontFamily"); 4755 fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1"); 4756 const fontWeight = descriptor.get("FontWeight"); 4757 const italicAngle = -descriptor.get("ItalicAngle"); 4758 const cssFontInfo = { 4759 fontFamily, 4760 fontWeight, 4761 italicAngle 4762 }; 4763 4764 if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) { 4765 continue; 4766 } 4767 4768 promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) { 4769 (0, _util.warn)(`loadXfaFonts: "${reason}".`); 4770 return null; 4771 })); 4772 } 4773 4774 await Promise.all(promises); 4775 const missingFonts = this.xfaFactory.setFonts(pdfFonts); 4776 4777 if (!missingFonts) { 4778 return; 4779 } 4780 4781 options.ignoreErrors = true; 4782 promises.length = 0; 4783 pdfFonts.length = 0; 4784 const reallyMissingFonts = new Set(); 4785 4786 for (const missing of missingFonts) { 4787 if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) { 4788 reallyMissingFonts.add(missing); 4789 } 4790 } 4791 4792 if (reallyMissingFonts.size) { 4793 missingFonts.push("PdfJS-Fallback"); 4794 } 4795 4796 for (const missing of missingFonts) { 4797 if (reallyMissingFonts.has(missing)) { 4798 continue; 4799 } 4800 4801 for (const fontInfo of [{ 4802 name: "Regular", 4803 fontWeight: 400, 4804 italicAngle: 0 4805 }, { 4806 name: "Bold", 4807 fontWeight: 700, 4808 italicAngle: 0 4809 }, { 4810 name: "Italic", 4811 fontWeight: 400, 4812 italicAngle: 12 4813 }, { 4814 name: "BoldItalic", 4815 fontWeight: 700, 4816 italicAngle: 12 4817 }]) { 4818 const name = `${missing}-${fontInfo.name}`; 4819 const dict = (0, _xfa_fonts.getXfaFontDict)(name); 4820 promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, { 4821 fontFamily: missing, 4822 fontWeight: fontInfo.fontWeight, 4823 italicAngle: fontInfo.italicAngle 4824 }).catch(function (reason) { 4825 (0, _util.warn)(`loadXfaFonts: "${reason}".`); 4826 return null; 4827 })); 4828 } 4829 } 4830 4831 await Promise.all(promises); 4832 this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts); 4833 } 4834 4835 async serializeXfaData(annotationStorage) { 4836 return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null; 4837 } 4838 4839 get formInfo() { 4840 const formInfo = { 4841 hasFields: false, 4842 hasAcroForm: false, 4843 hasXfa: false, 4844 hasSignatures: false 4845 }; 4846 const acroForm = this.catalog.acroForm; 4847 4848 if (!acroForm) { 4849 return (0, _util.shadow)(this, "formInfo", formInfo); 4850 } 4851 4852 try { 4853 const fields = acroForm.get("Fields"); 4854 const hasFields = Array.isArray(fields) && fields.length > 0; 4855 formInfo.hasFields = hasFields; 4856 const xfa = acroForm.get("XFA"); 4857 formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty; 4858 const sigFlags = acroForm.get("SigFlags"); 4859 const hasSignatures = !!(sigFlags & 0x1); 4860 4861 const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields); 4862 4863 formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures; 4864 formInfo.hasSignatures = hasSignatures; 4865 } catch (ex) { 4866 if (ex instanceof _core_utils.MissingDataException) { 4867 throw ex; 4868 } 4869 4870 (0, _util.warn)(`Cannot fetch form information: "${ex}".`); 4871 } 4872 4873 return (0, _util.shadow)(this, "formInfo", formInfo); 4874 } 4875 4876 get documentInfo() { 4877 let version = this._version; 4878 4879 if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) { 4880 (0, _util.warn)(`Invalid PDF header version number: ${version}`); 4881 version = null; 4882 } 4883 4884 const docInfo = { 4885 PDFFormatVersion: version, 4886 Language: this.catalog.lang, 4887 EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null, 4888 IsLinearized: !!this.linearization, 4889 IsAcroFormPresent: this.formInfo.hasAcroForm, 4890 IsXFAPresent: this.formInfo.hasXfa, 4891 IsCollectionPresent: !!this.catalog.collection, 4892 IsSignaturesPresent: this.formInfo.hasSignatures 4893 }; 4894 let infoDict; 4895 4896 try { 4897 infoDict = this.xref.trailer.get("Info"); 4898 } catch (err) { 4899 if (err instanceof _core_utils.MissingDataException) { 4900 throw err; 4901 } 4902 4903 (0, _util.info)("The document information dictionary is invalid."); 4904 } 4905 4906 if (!(infoDict instanceof _primitives.Dict)) { 4907 return (0, _util.shadow)(this, "documentInfo", docInfo); 4908 } 4909 4910 for (const key of infoDict.getKeys()) { 4911 const value = infoDict.get(key); 4912 4913 switch (key) { 4914 case "Title": 4915 case "Author": 4916 case "Subject": 4917 case "Keywords": 4918 case "Creator": 4919 case "Producer": 4920 case "CreationDate": 4921 case "ModDate": 4922 if (typeof value === "string") { 4923 docInfo[key] = (0, _util.stringToPDFString)(value); 4924 continue; 4925 } 4926 4927 break; 4928 4929 case "Trapped": 4930 if (value instanceof _primitives.Name) { 4931 docInfo[key] = value; 4932 continue; 4933 } 4934 4935 break; 4936 4937 default: 4938 let customValue; 4939 4940 switch (typeof value) { 4941 case "string": 4942 customValue = (0, _util.stringToPDFString)(value); 4943 break; 4944 4945 case "number": 4946 case "boolean": 4947 customValue = value; 4948 break; 4949 4950 default: 4951 if (value instanceof _primitives.Name) { 4952 customValue = value; 4953 } 4954 4955 break; 4956 } 4957 4958 if (customValue === undefined) { 4959 (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`); 4960 continue; 4961 } 4962 4963 if (!docInfo.Custom) { 4964 docInfo.Custom = Object.create(null); 4965 } 4966 4967 docInfo.Custom[key] = customValue; 4968 continue; 4969 } 4970 4971 (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`); 4972 } 4973 4974 return (0, _util.shadow)(this, "documentInfo", docInfo); 4975 } 4976 4977 get fingerprints() { 4978 function validate(data) { 4979 return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT; 4980 } 4981 4982 function hexString(hash) { 4983 const buf = []; 4984 4985 for (let i = 0, ii = hash.length; i < ii; i++) { 4986 const hex = hash[i].toString(16); 4987 buf.push(hex.padStart(2, "0")); 4988 } 4989 4990 return buf.join(""); 4991 } 4992 4993 const idArray = this.xref.trailer.get("ID"); 4994 let hashOriginal, hashModified; 4995 4996 if (Array.isArray(idArray) && validate(idArray[0])) { 4997 hashOriginal = (0, _util.stringToBytes)(idArray[0]); 4998 4999 if (idArray[1] !== idArray[0] && validate(idArray[1])) { 5000 hashModified = (0, _util.stringToBytes)(idArray[1]); 5001 } 5002 } else { 5003 hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES); 5004 } 5005 5006 return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]); 5007 } 5008 5009 async _getLinearizationPage(pageIndex) { 5010 const { 5011 catalog, 5012 linearization, 5013 xref 5014 } = this; 5015 5016 const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0); 5017 5018 try { 5019 const obj = await xref.fetchAsync(ref); 5020 5021 if (obj instanceof _primitives.Dict) { 5022 let type = obj.getRaw("Type"); 5023 5024 if (type instanceof _primitives.Ref) { 5025 type = await xref.fetchAsync(type); 5026 } 5027 5028 if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) { 5029 if (!catalog.pageKidsCountCache.has(ref)) { 5030 catalog.pageKidsCountCache.put(ref, 1); 5031 } 5032 5033 if (!catalog.pageIndexCache.has(ref)) { 5034 catalog.pageIndexCache.put(ref, 0); 5035 } 5036 5037 return [obj, ref]; 5038 } 5039 } 5040 5041 throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary."); 5042 } catch (reason) { 5043 (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`); 5044 return catalog.getPageDict(pageIndex); 5045 } 5046 } 5047 5048 getPage(pageIndex) { 5049 const cachedPromise = this._pagePromises.get(pageIndex); 5050 5051 if (cachedPromise) { 5052 return cachedPromise; 5053 } 5054 5055 const { 5056 catalog, 5057 linearization, 5058 xfaFactory 5059 } = this; 5060 let promise; 5061 5062 if (xfaFactory) { 5063 promise = Promise.resolve([_primitives.Dict.empty, null]); 5064 } else if (linearization && linearization.pageFirst === pageIndex) { 5065 promise = this._getLinearizationPage(pageIndex); 5066 } else { 5067 promise = catalog.getPageDict(pageIndex); 5068 } 5069 5070 promise = promise.then(([pageDict, ref]) => { 5071 return new Page({ 5072 pdfManager: this.pdfManager, 5073 xref: this.xref, 5074 pageIndex, 5075 pageDict, 5076 ref, 5077 globalIdFactory: this._globalIdFactory, 5078 fontCache: catalog.fontCache, 5079 builtInCMapCache: catalog.builtInCMapCache, 5080 standardFontDataCache: catalog.standardFontDataCache, 5081 globalImageCache: catalog.globalImageCache, 5082 nonBlendModesSet: catalog.nonBlendModesSet, 5083 xfaFactory 5084 }); 5085 }); 5086 5087 this._pagePromises.set(pageIndex, promise); 5088 5089 return promise; 5090 } 5091 5092 async checkFirstPage(recoveryMode = false) { 5093 if (recoveryMode) { 5094 return; 5095 } 5096 5097 try { 5098 await this.getPage(0); 5099 } catch (reason) { 5100 if (reason instanceof _core_utils.XRefEntryException) { 5101 this._pagePromises.delete(0); 5102 5103 await this.cleanup(); 5104 throw new _core_utils.XRefParseException(); 5105 } 5106 } 5107 } 5108 5109 async checkLastPage(recoveryMode = false) { 5110 const { 5111 catalog, 5112 pdfManager 5113 } = this; 5114 catalog.setActualNumPages(); 5115 let numPages; 5116 5117 try { 5118 await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]); 5119 5120 if (this.xfaFactory) { 5121 return; 5122 } else if (this.linearization) { 5123 numPages = this.linearization.numPages; 5124 } else { 5125 numPages = catalog.numPages; 5126 } 5127 5128 if (!Number.isInteger(numPages)) { 5129 throw new _util.FormatError("Page count is not an integer."); 5130 } else if (numPages <= 1) { 5131 return; 5132 } 5133 5134 await this.getPage(numPages - 1); 5135 } catch (reason) { 5136 this._pagePromises.delete(numPages - 1); 5137 5138 await this.cleanup(); 5139 5140 if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) { 5141 throw new _core_utils.XRefParseException(); 5142 } 5143 5144 (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`); 5145 let pagesTree; 5146 5147 try { 5148 pagesTree = await catalog.getAllPageDicts(recoveryMode); 5149 } catch (reasonAll) { 5150 if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) { 5151 throw new _core_utils.XRefParseException(); 5152 } 5153 5154 catalog.setActualNumPages(1); 5155 return; 5156 } 5157 5158 for (const [pageIndex, [pageDict, ref]] of pagesTree) { 5159 let promise; 5160 5161 if (pageDict instanceof Error) { 5162 promise = Promise.reject(pageDict); 5163 promise.catch(() => {}); 5164 } else { 5165 promise = Promise.resolve(new Page({ 5166 pdfManager, 5167 xref: this.xref, 5168 pageIndex, 5169 pageDict, 5170 ref, 5171 globalIdFactory: this._globalIdFactory, 5172 fontCache: catalog.fontCache, 5173 builtInCMapCache: catalog.builtInCMapCache, 5174 standardFontDataCache: catalog.standardFontDataCache, 5175 globalImageCache: catalog.globalImageCache, 5176 nonBlendModesSet: catalog.nonBlendModesSet, 5177 xfaFactory: null 5178 })); 5179 } 5180 5181 this._pagePromises.set(pageIndex, promise); 5182 } 5183 5184 catalog.setActualNumPages(pagesTree.size); 5185 } 5186 } 5187 5188 fontFallback(id, handler) { 5189 return this.catalog.fontFallback(id, handler); 5190 } 5191 5192 async cleanup(manuallyTriggered = false) { 5193 return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)(); 5194 } 5195 5196 _collectFieldObjects(name, fieldRef, promises) { 5197 const field = this.xref.fetchIfRef(fieldRef); 5198 5199 if (field.has("T")) { 5200 const partName = (0, _util.stringToPDFString)(field.get("T")); 5201 5202 if (name === "") { 5203 name = partName; 5204 } else { 5205 name = `${name}.${partName}`; 5206 } 5207 } 5208 5209 if (!promises.has(name)) { 5210 promises.set(name, []); 5211 } 5212 5213 promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) { 5214 (0, _util.warn)(`_collectFieldObjects: "${reason}".`); 5215 return null; 5216 })); 5217 5218 if (field.has("Kids")) { 5219 const kids = field.get("Kids"); 5220 5221 for (const kid of kids) { 5222 this._collectFieldObjects(name, kid, promises); 5223 } 5224 } 5225 } 5226 5227 get fieldObjects() { 5228 if (!this.formInfo.hasFields) { 5229 return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null)); 5230 } 5231 5232 const allFields = Object.create(null); 5233 const fieldPromises = new Map(); 5234 5235 for (const fieldRef of this.catalog.acroForm.get("Fields")) { 5236 this._collectFieldObjects("", fieldRef, fieldPromises); 5237 } 5238 5239 const allPromises = []; 5240 5241 for (const [name, promises] of fieldPromises) { 5242 allPromises.push(Promise.all(promises).then(fields => { 5243 fields = fields.filter(field => !!field); 5244 5245 if (fields.length > 0) { 5246 allFields[name] = fields; 5247 } 5248 })); 5249 } 5250 5251 return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields)); 5252 } 5253 5254 get hasJSActions() { 5255 const promise = this.pdfManager.ensureDoc("_parseHasJSActions"); 5256 return (0, _util.shadow)(this, "hasJSActions", promise); 5257 } 5258 5259 async _parseHasJSActions() { 5260 const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]); 5261 5262 if (catalogJsActions) { 5263 return true; 5264 } 5265 5266 if (fieldObjects) { 5267 return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null)); 5268 } 5269 5270 return false; 5271 } 5272 5273 get calculationOrderIds() { 5274 const acroForm = this.catalog.acroForm; 5275 5276 if (!acroForm || !acroForm.has("CO")) { 5277 return (0, _util.shadow)(this, "calculationOrderIds", null); 5278 } 5279 5280 const calculationOrder = acroForm.get("CO"); 5281 5282 if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) { 5283 return (0, _util.shadow)(this, "calculationOrderIds", null); 5284 } 5285 5286 const ids = []; 5287 5288 for (const id of calculationOrder) { 5289 if (id instanceof _primitives.Ref) { 5290 ids.push(id.toString()); 5291 } 5292 } 5293 5294 if (ids.length === 0) { 5295 return (0, _util.shadow)(this, "calculationOrderIds", null); 5296 } 5297 5298 return (0, _util.shadow)(this, "calculationOrderIds", ids); 5299 } 5300 5301} 5302 5303exports.PDFDocument = PDFDocument; 5304 5305/***/ }), 5306/* 12 */ 5307/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 5308 5309 5310 5311Object.defineProperty(exports, "__esModule", ({ 5312 value: true 5313})); 5314exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0; 5315exports.getQuadPoints = getQuadPoints; 5316 5317var _util = __w_pdfjs_require__(2); 5318 5319var _core_utils = __w_pdfjs_require__(6); 5320 5321var _default_appearance = __w_pdfjs_require__(13); 5322 5323var _primitives = __w_pdfjs_require__(5); 5324 5325var _writer = __w_pdfjs_require__(65); 5326 5327var _base_stream = __w_pdfjs_require__(7); 5328 5329var _bidi = __w_pdfjs_require__(60); 5330 5331var _catalog = __w_pdfjs_require__(69); 5332 5333var _colorspace = __w_pdfjs_require__(14); 5334 5335var _file_spec = __w_pdfjs_require__(72); 5336 5337var _object_loader = __w_pdfjs_require__(75); 5338 5339var _operator_list = __w_pdfjs_require__(62); 5340 5341var _stream = __w_pdfjs_require__(10); 5342 5343var _factory = __w_pdfjs_require__(76); 5344 5345class AnnotationFactory { 5346 static create(xref, ref, pdfManager, idFactory, collectFields) { 5347 return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(([acroForm, baseUrl, xfaDatasets, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, xfaDatasets, collectFields, pageIndex])); 5348 } 5349 5350 static _create(xref, ref, pdfManager, idFactory, acroForm, xfaDatasets, collectFields, pageIndex = -1) { 5351 const dict = xref.fetchIfRef(ref); 5352 5353 if (!(dict instanceof _primitives.Dict)) { 5354 return undefined; 5355 } 5356 5357 const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`; 5358 let subtype = dict.get("Subtype"); 5359 subtype = subtype instanceof _primitives.Name ? subtype.name : null; 5360 const parameters = { 5361 xref, 5362 ref, 5363 dict, 5364 subtype, 5365 id, 5366 pdfManager, 5367 acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty, 5368 xfaDatasets, 5369 collectFields, 5370 pageIndex 5371 }; 5372 5373 switch (subtype) { 5374 case "Link": 5375 return new LinkAnnotation(parameters); 5376 5377 case "Text": 5378 return new TextAnnotation(parameters); 5379 5380 case "Widget": 5381 let fieldType = (0, _core_utils.getInheritableProperty)({ 5382 dict, 5383 key: "FT" 5384 }); 5385 fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null; 5386 5387 switch (fieldType) { 5388 case "Tx": 5389 return new TextWidgetAnnotation(parameters); 5390 5391 case "Btn": 5392 return new ButtonWidgetAnnotation(parameters); 5393 5394 case "Ch": 5395 return new ChoiceWidgetAnnotation(parameters); 5396 5397 case "Sig": 5398 return new SignatureWidgetAnnotation(parameters); 5399 } 5400 5401 (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type."); 5402 return new WidgetAnnotation(parameters); 5403 5404 case "Popup": 5405 return new PopupAnnotation(parameters); 5406 5407 case "FreeText": 5408 return new FreeTextAnnotation(parameters); 5409 5410 case "Line": 5411 return new LineAnnotation(parameters); 5412 5413 case "Square": 5414 return new SquareAnnotation(parameters); 5415 5416 case "Circle": 5417 return new CircleAnnotation(parameters); 5418 5419 case "PolyLine": 5420 return new PolylineAnnotation(parameters); 5421 5422 case "Polygon": 5423 return new PolygonAnnotation(parameters); 5424 5425 case "Caret": 5426 return new CaretAnnotation(parameters); 5427 5428 case "Ink": 5429 return new InkAnnotation(parameters); 5430 5431 case "Highlight": 5432 return new HighlightAnnotation(parameters); 5433 5434 case "Underline": 5435 return new UnderlineAnnotation(parameters); 5436 5437 case "Squiggly": 5438 return new SquigglyAnnotation(parameters); 5439 5440 case "StrikeOut": 5441 return new StrikeOutAnnotation(parameters); 5442 5443 case "Stamp": 5444 return new StampAnnotation(parameters); 5445 5446 case "FileAttachment": 5447 return new FileAttachmentAnnotation(parameters); 5448 5449 default: 5450 if (!collectFields) { 5451 if (!subtype) { 5452 (0, _util.warn)("Annotation is missing the required /Subtype."); 5453 } else { 5454 (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation."); 5455 } 5456 } 5457 5458 return new Annotation(parameters); 5459 } 5460 } 5461 5462 static async _getPageIndex(xref, ref, pdfManager) { 5463 try { 5464 const annotDict = await xref.fetchIfRefAsync(ref); 5465 5466 if (!(annotDict instanceof _primitives.Dict)) { 5467 return -1; 5468 } 5469 5470 const pageRef = annotDict.getRaw("P"); 5471 5472 if (!(pageRef instanceof _primitives.Ref)) { 5473 return -1; 5474 } 5475 5476 const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]); 5477 return pageIndex; 5478 } catch (ex) { 5479 (0, _util.warn)(`_getPageIndex: "${ex}".`); 5480 return -1; 5481 } 5482 } 5483 5484 static async saveNewAnnotations(evaluator, task, annotations) { 5485 const xref = evaluator.xref; 5486 let baseFontRef; 5487 const dependencies = []; 5488 const promises = []; 5489 5490 for (const annotation of annotations) { 5491 switch (annotation.annotationType) { 5492 case _util.AnnotationEditorType.FREETEXT: 5493 if (!baseFontRef) { 5494 const baseFont = new _primitives.Dict(xref); 5495 baseFont.set("BaseFont", _primitives.Name.get("Helvetica")); 5496 baseFont.set("Type", _primitives.Name.get("Font")); 5497 baseFont.set("Subtype", _primitives.Name.get("Type1")); 5498 baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding")); 5499 const buffer = []; 5500 baseFontRef = xref.getNewRef(); 5501 (0, _writer.writeObject)(baseFontRef, baseFont, buffer, null); 5502 dependencies.push({ 5503 ref: baseFontRef, 5504 data: buffer.join("") 5505 }); 5506 } 5507 5508 promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, { 5509 evaluator, 5510 task, 5511 baseFontRef 5512 })); 5513 break; 5514 5515 case _util.AnnotationEditorType.INK: 5516 promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies)); 5517 } 5518 } 5519 5520 return { 5521 annotations: await Promise.all(promises), 5522 dependencies 5523 }; 5524 } 5525 5526 static async printNewAnnotations(evaluator, task, annotations) { 5527 if (!annotations) { 5528 return null; 5529 } 5530 5531 const xref = evaluator.xref; 5532 const promises = []; 5533 5534 for (const annotation of annotations) { 5535 switch (annotation.annotationType) { 5536 case _util.AnnotationEditorType.FREETEXT: 5537 promises.push(FreeTextAnnotation.createNewPrintAnnotation(xref, annotation, { 5538 evaluator, 5539 task 5540 })); 5541 break; 5542 5543 case _util.AnnotationEditorType.INK: 5544 promises.push(InkAnnotation.createNewPrintAnnotation(xref, annotation)); 5545 break; 5546 } 5547 } 5548 5549 return Promise.all(promises); 5550 } 5551 5552} 5553 5554exports.AnnotationFactory = AnnotationFactory; 5555 5556function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) { 5557 if (!Array.isArray(color)) { 5558 return defaultColor; 5559 } 5560 5561 const rgbColor = defaultColor || new Uint8ClampedArray(3); 5562 5563 switch (color.length) { 5564 case 0: 5565 return null; 5566 5567 case 1: 5568 _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0); 5569 5570 return rgbColor; 5571 5572 case 3: 5573 _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0); 5574 5575 return rgbColor; 5576 5577 case 4: 5578 _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0); 5579 5580 return rgbColor; 5581 5582 default: 5583 return defaultColor; 5584 } 5585} 5586 5587function getQuadPoints(dict, rect) { 5588 if (!dict.has("QuadPoints")) { 5589 return null; 5590 } 5591 5592 const quadPoints = dict.getArray("QuadPoints"); 5593 5594 if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) { 5595 return null; 5596 } 5597 5598 const quadPointsLists = []; 5599 5600 for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) { 5601 quadPointsLists.push([]); 5602 5603 for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) { 5604 const x = quadPoints[j]; 5605 const y = quadPoints[j + 1]; 5606 5607 if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) { 5608 return null; 5609 } 5610 5611 quadPointsLists[i].push({ 5612 x, 5613 y 5614 }); 5615 } 5616 } 5617 5618 return quadPointsLists.map(quadPointsList => { 5619 const [minX, maxX, minY, maxY] = quadPointsList.reduce(([mX, MX, mY, MY], quadPoint) => [Math.min(mX, quadPoint.x), Math.max(MX, quadPoint.x), Math.min(mY, quadPoint.y), Math.max(MY, quadPoint.y)], [Number.MAX_VALUE, Number.MIN_VALUE, Number.MAX_VALUE, Number.MIN_VALUE]); 5620 return [{ 5621 x: minX, 5622 y: maxY 5623 }, { 5624 x: maxX, 5625 y: maxY 5626 }, { 5627 x: minX, 5628 y: minY 5629 }, { 5630 x: maxX, 5631 y: minY 5632 }]; 5633 }); 5634} 5635 5636function getTransformMatrix(rect, bbox, matrix) { 5637 const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix); 5638 5639 if (minX === maxX || minY === maxY) { 5640 return [1, 0, 0, 1, rect[0], rect[1]]; 5641 } 5642 5643 const xRatio = (rect[2] - rect[0]) / (maxX - minX); 5644 const yRatio = (rect[3] - rect[1]) / (maxY - minY); 5645 return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio]; 5646} 5647 5648class Annotation { 5649 constructor(params) { 5650 const dict = params.dict; 5651 this.setTitle(dict.get("T")); 5652 this.setContents(dict.get("Contents")); 5653 this.setModificationDate(dict.get("M")); 5654 this.setFlags(dict.get("F")); 5655 this.setRectangle(dict.getArray("Rect")); 5656 this.setColor(dict.getArray("C")); 5657 this.setBorderStyle(dict); 5658 this.setAppearance(dict); 5659 this.setOptionalContent(dict); 5660 const MK = dict.get("MK"); 5661 this.setBorderAndBackgroundColors(MK); 5662 this.setRotation(MK); 5663 this._streams = []; 5664 5665 if (this.appearance) { 5666 this._streams.push(this.appearance); 5667 } 5668 5669 this.data = { 5670 annotationFlags: this.flags, 5671 borderStyle: this.borderStyle, 5672 color: this.color, 5673 backgroundColor: this.backgroundColor, 5674 borderColor: this.borderColor, 5675 rotation: this.rotation, 5676 contentsObj: this._contents, 5677 hasAppearance: !!this.appearance, 5678 id: params.id, 5679 modificationDate: this.modificationDate, 5680 rect: this.rectangle, 5681 subtype: params.subtype, 5682 hasOwnCanvas: false 5683 }; 5684 5685 if (params.collectFields) { 5686 const kids = dict.get("Kids"); 5687 5688 if (Array.isArray(kids)) { 5689 const kidIds = []; 5690 5691 for (const kid of kids) { 5692 if (kid instanceof _primitives.Ref) { 5693 kidIds.push(kid.toString()); 5694 } 5695 } 5696 5697 if (kidIds.length !== 0) { 5698 this.data.kidIds = kidIds; 5699 } 5700 } 5701 5702 this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType); 5703 this.data.fieldName = this._constructFieldName(dict); 5704 this.data.pageIndex = params.pageIndex; 5705 } 5706 5707 this._fallbackFontDict = null; 5708 } 5709 5710 _hasFlag(flags, flag) { 5711 return !!(flags & flag); 5712 } 5713 5714 _isViewable(flags) { 5715 return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW); 5716 } 5717 5718 _isPrintable(flags) { 5719 return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE); 5720 } 5721 5722 mustBeViewed(annotationStorage) { 5723 const storageEntry = annotationStorage && annotationStorage.get(this.data.id); 5724 5725 if (storageEntry && storageEntry.hidden !== undefined) { 5726 return !storageEntry.hidden; 5727 } 5728 5729 return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN); 5730 } 5731 5732 mustBePrinted(annotationStorage) { 5733 const storageEntry = annotationStorage && annotationStorage.get(this.data.id); 5734 5735 if (storageEntry && storageEntry.print !== undefined) { 5736 return storageEntry.print; 5737 } 5738 5739 return this.printable; 5740 } 5741 5742 get viewable() { 5743 if (this.data.quadPoints === null) { 5744 return false; 5745 } 5746 5747 if (this.flags === 0) { 5748 return true; 5749 } 5750 5751 return this._isViewable(this.flags); 5752 } 5753 5754 get printable() { 5755 if (this.data.quadPoints === null) { 5756 return false; 5757 } 5758 5759 if (this.flags === 0) { 5760 return false; 5761 } 5762 5763 return this._isPrintable(this.flags); 5764 } 5765 5766 _parseStringHelper(data) { 5767 const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : ""; 5768 const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr"; 5769 return { 5770 str, 5771 dir 5772 }; 5773 } 5774 5775 setTitle(title) { 5776 this._title = this._parseStringHelper(title); 5777 } 5778 5779 setContents(contents) { 5780 this._contents = this._parseStringHelper(contents); 5781 } 5782 5783 setModificationDate(modificationDate) { 5784 this.modificationDate = typeof modificationDate === "string" ? modificationDate : null; 5785 } 5786 5787 setFlags(flags) { 5788 this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0; 5789 } 5790 5791 hasFlag(flag) { 5792 return this._hasFlag(this.flags, flag); 5793 } 5794 5795 setRectangle(rectangle) { 5796 if (Array.isArray(rectangle) && rectangle.length === 4) { 5797 this.rectangle = _util.Util.normalizeRect(rectangle); 5798 } else { 5799 this.rectangle = [0, 0, 0, 0]; 5800 } 5801 } 5802 5803 setColor(color) { 5804 this.color = getRgbColor(color); 5805 } 5806 5807 setLineEndings(lineEndings) { 5808 this.lineEndings = ["None", "None"]; 5809 5810 if (Array.isArray(lineEndings) && lineEndings.length === 2) { 5811 for (let i = 0; i < 2; i++) { 5812 const obj = lineEndings[i]; 5813 5814 if (obj instanceof _primitives.Name) { 5815 switch (obj.name) { 5816 case "None": 5817 continue; 5818 5819 case "Square": 5820 case "Circle": 5821 case "Diamond": 5822 case "OpenArrow": 5823 case "ClosedArrow": 5824 case "Butt": 5825 case "ROpenArrow": 5826 case "RClosedArrow": 5827 case "Slash": 5828 this.lineEndings[i] = obj.name; 5829 continue; 5830 } 5831 } 5832 5833 (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`); 5834 } 5835 } 5836 } 5837 5838 setRotation(mk) { 5839 this.rotation = 0; 5840 5841 if (mk instanceof _primitives.Dict) { 5842 let angle = mk.get("R") || 0; 5843 5844 if (Number.isInteger(angle) && angle !== 0) { 5845 angle %= 360; 5846 5847 if (angle < 0) { 5848 angle += 360; 5849 } 5850 5851 if (angle % 90 === 0) { 5852 this.rotation = angle; 5853 } 5854 } 5855 } 5856 } 5857 5858 setBorderAndBackgroundColors(mk) { 5859 if (mk instanceof _primitives.Dict) { 5860 this.borderColor = getRgbColor(mk.getArray("BC"), null); 5861 this.backgroundColor = getRgbColor(mk.getArray("BG"), null); 5862 } else { 5863 this.borderColor = this.backgroundColor = null; 5864 } 5865 } 5866 5867 setBorderStyle(borderStyle) { 5868 this.borderStyle = new AnnotationBorderStyle(); 5869 5870 if (!(borderStyle instanceof _primitives.Dict)) { 5871 return; 5872 } 5873 5874 if (borderStyle.has("BS")) { 5875 const dict = borderStyle.get("BS"); 5876 const dictType = dict.get("Type"); 5877 5878 if (!dictType || (0, _primitives.isName)(dictType, "Border")) { 5879 this.borderStyle.setWidth(dict.get("W"), this.rectangle); 5880 this.borderStyle.setStyle(dict.get("S")); 5881 this.borderStyle.setDashArray(dict.getArray("D")); 5882 } 5883 } else if (borderStyle.has("Border")) { 5884 const array = borderStyle.getArray("Border"); 5885 5886 if (Array.isArray(array) && array.length >= 3) { 5887 this.borderStyle.setHorizontalCornerRadius(array[0]); 5888 this.borderStyle.setVerticalCornerRadius(array[1]); 5889 this.borderStyle.setWidth(array[2], this.rectangle); 5890 5891 if (array.length === 4) { 5892 this.borderStyle.setDashArray(array[3], true); 5893 } 5894 } 5895 } else { 5896 this.borderStyle.setWidth(0); 5897 } 5898 } 5899 5900 setAppearance(dict) { 5901 this.appearance = null; 5902 const appearanceStates = dict.get("AP"); 5903 5904 if (!(appearanceStates instanceof _primitives.Dict)) { 5905 return; 5906 } 5907 5908 const normalAppearanceState = appearanceStates.get("N"); 5909 5910 if (normalAppearanceState instanceof _base_stream.BaseStream) { 5911 this.appearance = normalAppearanceState; 5912 return; 5913 } 5914 5915 if (!(normalAppearanceState instanceof _primitives.Dict)) { 5916 return; 5917 } 5918 5919 const as = dict.get("AS"); 5920 5921 if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) { 5922 return; 5923 } 5924 5925 this.appearance = normalAppearanceState.get(as.name); 5926 } 5927 5928 setOptionalContent(dict) { 5929 this.oc = null; 5930 const oc = dict.get("OC"); 5931 5932 if (oc instanceof _primitives.Name) { 5933 (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented."); 5934 } else if (oc instanceof _primitives.Dict) { 5935 this.oc = oc; 5936 } 5937 } 5938 5939 loadResources(keys, appearance) { 5940 return appearance.dict.getAsync("Resources").then(resources => { 5941 if (!resources) { 5942 return undefined; 5943 } 5944 5945 const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref); 5946 return objectLoader.load().then(function () { 5947 return resources; 5948 }); 5949 }); 5950 } 5951 5952 async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) { 5953 const data = this.data; 5954 let appearance = this.appearance; 5955 const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY); 5956 5957 if (!appearance) { 5958 if (!isUsingOwnCanvas) { 5959 return { 5960 opList: new _operator_list.OperatorList(), 5961 separateForm: false, 5962 separateCanvas: false 5963 }; 5964 } 5965 5966 appearance = new _stream.StringStream(""); 5967 appearance.dict = new _primitives.Dict(); 5968 } 5969 5970 const appearanceDict = appearance.dict; 5971 const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance); 5972 const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1]; 5973 const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0]; 5974 const transform = getTransformMatrix(data.rect, bbox, matrix); 5975 const opList = new _operator_list.OperatorList(); 5976 let optionalContent; 5977 5978 if (this.oc) { 5979 optionalContent = await evaluator.parseMarkedContentProps(this.oc, null); 5980 } 5981 5982 if (optionalContent !== undefined) { 5983 opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]); 5984 } 5985 5986 opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]); 5987 await evaluator.getOperatorList({ 5988 stream: appearance, 5989 task, 5990 resources, 5991 operatorList: opList, 5992 fallbackFontDict: this._fallbackFontDict 5993 }); 5994 opList.addOp(_util.OPS.endAnnotation, []); 5995 5996 if (optionalContent !== undefined) { 5997 opList.addOp(_util.OPS.endMarkedContent, []); 5998 } 5999 6000 this.reset(); 6001 return { 6002 opList, 6003 separateForm: false, 6004 separateCanvas: isUsingOwnCanvas 6005 }; 6006 } 6007 6008 async save(evaluator, task, annotationStorage) { 6009 return null; 6010 } 6011 6012 get hasTextContent() { 6013 return false; 6014 } 6015 6016 async extractTextContent(evaluator, task, viewBox) { 6017 if (!this.appearance) { 6018 return; 6019 } 6020 6021 const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance); 6022 const text = []; 6023 const buffer = []; 6024 const sink = { 6025 desiredSize: Math.Infinity, 6026 ready: true, 6027 6028 enqueue(chunk, size) { 6029 for (const item of chunk.items) { 6030 buffer.push(item.str); 6031 6032 if (item.hasEOL) { 6033 text.push(buffer.join("")); 6034 buffer.length = 0; 6035 } 6036 } 6037 } 6038 6039 }; 6040 await evaluator.getTextContent({ 6041 stream: this.appearance, 6042 task, 6043 resources, 6044 includeMarkedContent: true, 6045 combineTextItems: true, 6046 sink, 6047 viewBox 6048 }); 6049 this.reset(); 6050 6051 if (buffer.length) { 6052 text.push(buffer.join("")); 6053 } 6054 6055 if (text.length > 0) { 6056 this.data.textContent = text; 6057 } 6058 } 6059 6060 getFieldObject() { 6061 if (this.data.kidIds) { 6062 return { 6063 id: this.data.id, 6064 actions: this.data.actions, 6065 name: this.data.fieldName, 6066 strokeColor: this.data.borderColor, 6067 fillColor: this.data.backgroundColor, 6068 type: "", 6069 kidIds: this.data.kidIds, 6070 page: this.data.pageIndex, 6071 rotation: this.rotation 6072 }; 6073 } 6074 6075 return null; 6076 } 6077 6078 reset() { 6079 for (const stream of this._streams) { 6080 stream.reset(); 6081 } 6082 } 6083 6084 _constructFieldName(dict) { 6085 if (!dict.has("T") && !dict.has("Parent")) { 6086 (0, _util.warn)("Unknown field name, falling back to empty field name."); 6087 return ""; 6088 } 6089 6090 if (!dict.has("Parent")) { 6091 return (0, _util.stringToPDFString)(dict.get("T")); 6092 } 6093 6094 const fieldName = []; 6095 6096 if (dict.has("T")) { 6097 fieldName.unshift((0, _util.stringToPDFString)(dict.get("T"))); 6098 } 6099 6100 let loopDict = dict; 6101 const visited = new _primitives.RefSet(); 6102 6103 if (dict.objId) { 6104 visited.put(dict.objId); 6105 } 6106 6107 while (loopDict.has("Parent")) { 6108 loopDict = loopDict.get("Parent"); 6109 6110 if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) { 6111 break; 6112 } 6113 6114 if (loopDict.objId) { 6115 visited.put(loopDict.objId); 6116 } 6117 6118 if (loopDict.has("T")) { 6119 fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T"))); 6120 } 6121 } 6122 6123 return fieldName.join("."); 6124 } 6125 6126} 6127 6128exports.Annotation = Annotation; 6129 6130class AnnotationBorderStyle { 6131 constructor() { 6132 this.width = 1; 6133 this.style = _util.AnnotationBorderStyleType.SOLID; 6134 this.dashArray = [3]; 6135 this.horizontalCornerRadius = 0; 6136 this.verticalCornerRadius = 0; 6137 } 6138 6139 setWidth(width, rect = [0, 0, 0, 0]) { 6140 if (width instanceof _primitives.Name) { 6141 this.width = 0; 6142 return; 6143 } 6144 6145 if (typeof width === "number") { 6146 if (width > 0) { 6147 const maxWidth = (rect[2] - rect[0]) / 2; 6148 const maxHeight = (rect[3] - rect[1]) / 2; 6149 6150 if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) { 6151 (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`); 6152 width = 1; 6153 } 6154 } 6155 6156 this.width = width; 6157 } 6158 } 6159 6160 setStyle(style) { 6161 if (!(style instanceof _primitives.Name)) { 6162 return; 6163 } 6164 6165 switch (style.name) { 6166 case "S": 6167 this.style = _util.AnnotationBorderStyleType.SOLID; 6168 break; 6169 6170 case "D": 6171 this.style = _util.AnnotationBorderStyleType.DASHED; 6172 break; 6173 6174 case "B": 6175 this.style = _util.AnnotationBorderStyleType.BEVELED; 6176 break; 6177 6178 case "I": 6179 this.style = _util.AnnotationBorderStyleType.INSET; 6180 break; 6181 6182 case "U": 6183 this.style = _util.AnnotationBorderStyleType.UNDERLINE; 6184 break; 6185 6186 default: 6187 break; 6188 } 6189 } 6190 6191 setDashArray(dashArray, forceStyle = false) { 6192 if (Array.isArray(dashArray) && dashArray.length > 0) { 6193 let isValid = true; 6194 let allZeros = true; 6195 6196 for (const element of dashArray) { 6197 const validNumber = +element >= 0; 6198 6199 if (!validNumber) { 6200 isValid = false; 6201 break; 6202 } else if (element > 0) { 6203 allZeros = false; 6204 } 6205 } 6206 6207 if (isValid && !allZeros) { 6208 this.dashArray = dashArray; 6209 6210 if (forceStyle) { 6211 this.setStyle(_primitives.Name.get("D")); 6212 } 6213 } else { 6214 this.width = 0; 6215 } 6216 } else if (dashArray) { 6217 this.width = 0; 6218 } 6219 } 6220 6221 setHorizontalCornerRadius(radius) { 6222 if (Number.isInteger(radius)) { 6223 this.horizontalCornerRadius = radius; 6224 } 6225 } 6226 6227 setVerticalCornerRadius(radius) { 6228 if (Number.isInteger(radius)) { 6229 this.verticalCornerRadius = radius; 6230 } 6231 } 6232 6233} 6234 6235exports.AnnotationBorderStyle = AnnotationBorderStyle; 6236 6237class MarkupAnnotation extends Annotation { 6238 constructor(parameters) { 6239 super(parameters); 6240 const dict = parameters.dict; 6241 6242 if (dict.has("IRT")) { 6243 const rawIRT = dict.getRaw("IRT"); 6244 this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null; 6245 const rt = dict.get("RT"); 6246 this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY; 6247 } 6248 6249 if (this.data.replyType === _util.AnnotationReplyType.GROUP) { 6250 const parent = dict.get("IRT"); 6251 this.setTitle(parent.get("T")); 6252 this.data.titleObj = this._title; 6253 this.setContents(parent.get("Contents")); 6254 this.data.contentsObj = this._contents; 6255 6256 if (!parent.has("CreationDate")) { 6257 this.data.creationDate = null; 6258 } else { 6259 this.setCreationDate(parent.get("CreationDate")); 6260 this.data.creationDate = this.creationDate; 6261 } 6262 6263 if (!parent.has("M")) { 6264 this.data.modificationDate = null; 6265 } else { 6266 this.setModificationDate(parent.get("M")); 6267 this.data.modificationDate = this.modificationDate; 6268 } 6269 6270 this.data.hasPopup = parent.has("Popup"); 6271 6272 if (!parent.has("C")) { 6273 this.data.color = null; 6274 } else { 6275 this.setColor(parent.getArray("C")); 6276 this.data.color = this.color; 6277 } 6278 } else { 6279 this.data.titleObj = this._title; 6280 this.setCreationDate(dict.get("CreationDate")); 6281 this.data.creationDate = this.creationDate; 6282 this.data.hasPopup = dict.has("Popup"); 6283 6284 if (!dict.has("C")) { 6285 this.data.color = null; 6286 } 6287 } 6288 6289 if (dict.has("RC")) { 6290 this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC")); 6291 } 6292 } 6293 6294 setCreationDate(creationDate) { 6295 this.creationDate = typeof creationDate === "string" ? creationDate : null; 6296 } 6297 6298 _setDefaultAppearance({ 6299 xref, 6300 extra, 6301 strokeColor, 6302 fillColor, 6303 blendMode, 6304 strokeAlpha, 6305 fillAlpha, 6306 pointsCallback 6307 }) { 6308 let minX = Number.MAX_VALUE; 6309 let minY = Number.MAX_VALUE; 6310 let maxX = Number.MIN_VALUE; 6311 let maxY = Number.MIN_VALUE; 6312 const buffer = ["q"]; 6313 6314 if (extra) { 6315 buffer.push(extra); 6316 } 6317 6318 if (strokeColor) { 6319 buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`); 6320 } 6321 6322 if (fillColor) { 6323 buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`); 6324 } 6325 6326 let pointsArray = this.data.quadPoints; 6327 6328 if (!pointsArray) { 6329 pointsArray = [[{ 6330 x: this.rectangle[0], 6331 y: this.rectangle[3] 6332 }, { 6333 x: this.rectangle[2], 6334 y: this.rectangle[3] 6335 }, { 6336 x: this.rectangle[0], 6337 y: this.rectangle[1] 6338 }, { 6339 x: this.rectangle[2], 6340 y: this.rectangle[1] 6341 }]]; 6342 } 6343 6344 for (const points of pointsArray) { 6345 const [mX, MX, mY, MY] = pointsCallback(buffer, points); 6346 minX = Math.min(minX, mX); 6347 maxX = Math.max(maxX, MX); 6348 minY = Math.min(minY, mY); 6349 maxY = Math.max(maxY, MY); 6350 } 6351 6352 buffer.push("Q"); 6353 const formDict = new _primitives.Dict(xref); 6354 const appearanceStreamDict = new _primitives.Dict(xref); 6355 appearanceStreamDict.set("Subtype", _primitives.Name.get("Form")); 6356 const appearanceStream = new _stream.StringStream(buffer.join(" ")); 6357 appearanceStream.dict = appearanceStreamDict; 6358 formDict.set("Fm0", appearanceStream); 6359 const gsDict = new _primitives.Dict(xref); 6360 6361 if (blendMode) { 6362 gsDict.set("BM", _primitives.Name.get(blendMode)); 6363 } 6364 6365 if (typeof strokeAlpha === "number") { 6366 gsDict.set("CA", strokeAlpha); 6367 } 6368 6369 if (typeof fillAlpha === "number") { 6370 gsDict.set("ca", fillAlpha); 6371 } 6372 6373 const stateDict = new _primitives.Dict(xref); 6374 stateDict.set("GS0", gsDict); 6375 const resources = new _primitives.Dict(xref); 6376 resources.set("ExtGState", stateDict); 6377 resources.set("XObject", formDict); 6378 const appearanceDict = new _primitives.Dict(xref); 6379 appearanceDict.set("Resources", resources); 6380 const bbox = this.data.rect = [minX, minY, maxX, maxY]; 6381 appearanceDict.set("BBox", bbox); 6382 this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do"); 6383 this.appearance.dict = appearanceDict; 6384 6385 this._streams.push(this.appearance, appearanceStream); 6386 } 6387 6388 static async createNewAnnotation(xref, annotation, dependencies, params) { 6389 const annotationRef = xref.getNewRef(); 6390 const apRef = xref.getNewRef(); 6391 const annotationDict = this.createNewDict(annotation, xref, { 6392 apRef 6393 }); 6394 const ap = await this.createNewAppearanceStream(annotation, xref, params); 6395 const buffer = []; 6396 let transform = xref.encrypt ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen) : null; 6397 (0, _writer.writeObject)(apRef, ap, buffer, transform); 6398 dependencies.push({ 6399 ref: apRef, 6400 data: buffer.join("") 6401 }); 6402 buffer.length = 0; 6403 transform = xref.encrypt ? xref.encrypt.createCipherTransform(annotationRef.num, annotationRef.gen) : null; 6404 (0, _writer.writeObject)(annotationRef, annotationDict, buffer, transform); 6405 return { 6406 ref: annotationRef, 6407 data: buffer.join("") 6408 }; 6409 } 6410 6411 static async createNewPrintAnnotation(xref, annotation, params) { 6412 const ap = await this.createNewAppearanceStream(annotation, xref, params); 6413 const annotationDict = this.createNewDict(annotation, xref, { 6414 ap 6415 }); 6416 return new this.prototype.constructor({ 6417 dict: annotationDict, 6418 xref 6419 }); 6420 } 6421 6422} 6423 6424exports.MarkupAnnotation = MarkupAnnotation; 6425 6426class WidgetAnnotation extends Annotation { 6427 constructor(params) { 6428 super(params); 6429 const dict = params.dict; 6430 const data = this.data; 6431 this.ref = params.ref; 6432 data.annotationType = _util.AnnotationType.WIDGET; 6433 6434 if (data.fieldName === undefined) { 6435 data.fieldName = this._constructFieldName(dict); 6436 } 6437 6438 if (data.actions === undefined) { 6439 data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType); 6440 } 6441 6442 let fieldValue = (0, _core_utils.getInheritableProperty)({ 6443 dict, 6444 key: "V", 6445 getArray: true 6446 }); 6447 data.fieldValue = this._decodeFormValue(fieldValue); 6448 const defaultFieldValue = (0, _core_utils.getInheritableProperty)({ 6449 dict, 6450 key: "DV", 6451 getArray: true 6452 }); 6453 data.defaultFieldValue = this._decodeFormValue(defaultFieldValue); 6454 6455 if (fieldValue === undefined && params.xfaDatasets) { 6456 const path = this._title.str; 6457 6458 if (path) { 6459 this._hasValueFromXFA = true; 6460 data.fieldValue = fieldValue = params.xfaDatasets.getValue(path); 6461 } 6462 } 6463 6464 if (fieldValue === undefined && data.defaultFieldValue !== null) { 6465 data.fieldValue = data.defaultFieldValue; 6466 } 6467 6468 data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || ""); 6469 const defaultAppearance = (0, _core_utils.getInheritableProperty)({ 6470 dict, 6471 key: "DA" 6472 }) || params.acroForm.get("DA"); 6473 this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : ""; 6474 data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance); 6475 const fieldType = (0, _core_utils.getInheritableProperty)({ 6476 dict, 6477 key: "FT" 6478 }); 6479 data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null; 6480 const localResources = (0, _core_utils.getInheritableProperty)({ 6481 dict, 6482 key: "DR" 6483 }); 6484 const acroFormResources = params.acroForm.get("DR"); 6485 const appearanceResources = this.appearance && this.appearance.dict.get("Resources"); 6486 this._fieldResources = { 6487 localResources, 6488 acroFormResources, 6489 appearanceResources, 6490 mergedResources: _primitives.Dict.merge({ 6491 xref: params.xref, 6492 dictArray: [localResources, appearanceResources, acroFormResources], 6493 mergeSubDicts: true 6494 }) 6495 }; 6496 data.fieldFlags = (0, _core_utils.getInheritableProperty)({ 6497 dict, 6498 key: "Ff" 6499 }); 6500 6501 if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) { 6502 data.fieldFlags = 0; 6503 } 6504 6505 data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY); 6506 data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED); 6507 data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN); 6508 } 6509 6510 _decodeFormValue(formValue) { 6511 if (Array.isArray(formValue)) { 6512 return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item)); 6513 } else if (formValue instanceof _primitives.Name) { 6514 return (0, _util.stringToPDFString)(formValue.name); 6515 } else if (typeof formValue === "string") { 6516 return (0, _util.stringToPDFString)(formValue); 6517 } 6518 6519 return null; 6520 } 6521 6522 hasFieldFlag(flag) { 6523 return !!(this.data.fieldFlags & flag); 6524 } 6525 6526 static _getRotationMatrix(rotation, width, height) { 6527 switch (rotation) { 6528 case 90: 6529 return [0, 1, -1, 0, width, 0]; 6530 6531 case 180: 6532 return [-1, 0, 0, -1, width, height]; 6533 6534 case 270: 6535 return [0, -1, 1, 0, 0, height]; 6536 6537 default: 6538 throw new Error("Invalid rotation"); 6539 } 6540 } 6541 6542 getRotationMatrix(annotationStorage) { 6543 const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined; 6544 let rotation = storageEntry && storageEntry.rotation; 6545 6546 if (rotation === undefined) { 6547 rotation = this.rotation; 6548 } 6549 6550 if (rotation === 0) { 6551 return _util.IDENTITY_MATRIX; 6552 } 6553 6554 const width = this.data.rect[2] - this.data.rect[0]; 6555 const height = this.data.rect[3] - this.data.rect[1]; 6556 return WidgetAnnotation._getRotationMatrix(rotation, width, height); 6557 } 6558 6559 getBorderAndBackgroundAppearances(annotationStorage) { 6560 const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined; 6561 let rotation = storageEntry && storageEntry.rotation; 6562 6563 if (rotation === undefined) { 6564 rotation = this.rotation; 6565 } 6566 6567 if (!this.backgroundColor && !this.borderColor) { 6568 return ""; 6569 } 6570 6571 const width = this.data.rect[2] - this.data.rect[0]; 6572 const height = this.data.rect[3] - this.data.rect[1]; 6573 const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`; 6574 let str = ""; 6575 6576 if (this.backgroundColor) { 6577 str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `; 6578 } 6579 6580 if (this.borderColor) { 6581 const borderWidth = this.borderStyle.width || 1; 6582 str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `; 6583 } 6584 6585 return str; 6586 } 6587 6588 async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) { 6589 if (renderForms && !(this instanceof SignatureWidgetAnnotation)) { 6590 return { 6591 opList: new _operator_list.OperatorList(), 6592 separateForm: true, 6593 separateCanvas: false 6594 }; 6595 } 6596 6597 if (!this._hasText) { 6598 return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage); 6599 } 6600 6601 const content = await this._getAppearance(evaluator, task, annotationStorage); 6602 6603 if (this.appearance && content === null) { 6604 return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage); 6605 } 6606 6607 const opList = new _operator_list.OperatorList(); 6608 6609 if (!this._defaultAppearance || content === null) { 6610 return { 6611 opList, 6612 separateForm: false,
6613 separateCanvas: false 6614 }; 6615 } 6616 6617 const matrix = [1, 0, 0, 1, 0, 0]; 6618 const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]; 6619 const transform = getTransformMatrix(this.data.rect, bbox, matrix); 6620 let optionalContent; 6621 6622 if (this.oc) { 6623 optionalContent = await evaluator.parseMarkedContentProps(this.oc, null); 6624 } 6625 6626 if (optionalContent !== undefined) { 6627 opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]); 6628 } 6629 6630 opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), false]); 6631 const stream = new _stream.StringStream(content); 6632 await evaluator.getOperatorList({ 6633 stream, 6634 task, 6635 resources: this._fieldResources.mergedResources, 6636 operatorList: opList 6637 }); 6638 opList.addOp(_util.OPS.endAnnotation, []); 6639 6640 if (optionalContent !== undefined) { 6641 opList.addOp(_util.OPS.endMarkedContent, []); 6642 } 6643 6644 return { 6645 opList, 6646 separateForm: false, 6647 separateCanvas: false 6648 }; 6649 } 6650 6651 _getMKDict(rotation) { 6652 const mk = new _primitives.Dict(null); 6653 6654 if (rotation) { 6655 mk.set("R", rotation); 6656 } 6657 6658 if (this.borderColor) { 6659 mk.set("BC", Array.from(this.borderColor).map(c => c / 255)); 6660 } 6661 6662 if (this.backgroundColor) { 6663 mk.set("BG", Array.from(this.backgroundColor).map(c => c / 255)); 6664 } 6665 6666 return mk.size > 0 ? mk : null; 6667 } 6668 6669 async save(evaluator, task, annotationStorage) { 6670 const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined; 6671 let value = storageEntry && storageEntry.value; 6672 let rotation = storageEntry && storageEntry.rotation; 6673 6674 if (value === this.data.fieldValue || value === undefined) { 6675 if (!this._hasValueFromXFA && rotation === undefined) { 6676 return null; 6677 } 6678 6679 value = value || this.data.fieldValue; 6680 } 6681 6682 if (rotation === undefined && !this._hasValueFromXFA && Array.isArray(value) && Array.isArray(this.data.fieldValue) && value.length === this.data.fieldValue.length && value.every((x, i) => x === this.data.fieldValue[i])) { 6683 return null; 6684 } 6685 6686 if (rotation === undefined) { 6687 rotation = this.rotation; 6688 } 6689 6690 let appearance = await this._getAppearance(evaluator, task, annotationStorage); 6691 6692 if (appearance === null) { 6693 return null; 6694 } 6695 6696 const { 6697 xref 6698 } = evaluator; 6699 const dict = xref.fetchIfRef(this.ref); 6700 6701 if (!(dict instanceof _primitives.Dict)) { 6702 return null; 6703 } 6704 6705 const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]; 6706 const xfa = { 6707 path: (0, _util.stringToPDFString)(dict.get("T") || ""), 6708 value 6709 }; 6710 const newRef = xref.getNewRef(); 6711 const AP = new _primitives.Dict(xref); 6712 AP.set("N", newRef); 6713 const encrypt = xref.encrypt; 6714 let originalTransform = null; 6715 let newTransform = null; 6716 6717 if (encrypt) { 6718 originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen); 6719 newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen); 6720 appearance = newTransform.encryptString(appearance); 6721 } 6722 6723 const encoder = val => (0, _util.isAscii)(val) ? val : (0, _util.stringToUTF16BEString)(val); 6724 6725 dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value)); 6726 dict.set("AP", AP); 6727 dict.set("M", `D:${(0, _util.getModificationDate)()}`); 6728 6729 const maybeMK = this._getMKDict(rotation); 6730 6731 if (maybeMK) { 6732 dict.set("MK", maybeMK); 6733 } 6734 6735 const appearanceDict = new _primitives.Dict(xref); 6736 appearanceDict.set("Length", appearance.length); 6737 appearanceDict.set("Subtype", _primitives.Name.get("Form")); 6738 appearanceDict.set("Resources", this._getSaveFieldResources(xref)); 6739 appearanceDict.set("BBox", bbox); 6740 const rotationMatrix = this.getRotationMatrix(annotationStorage); 6741 6742 if (rotationMatrix !== _util.IDENTITY_MATRIX) { 6743 appearanceDict.set("Matrix", rotationMatrix); 6744 } 6745 6746 const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`]; 6747 (0, _writer.writeDict)(dict, bufferOriginal, originalTransform); 6748 bufferOriginal.push("\nendobj\n"); 6749 const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`]; 6750 (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform); 6751 bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n"); 6752 return [{ 6753 ref: this.ref, 6754 data: bufferOriginal.join(""), 6755 xfa 6756 }, {
6757 ref: newRef, 6758 data: bufferNew.join(""), 6759 xfa: null 6760 }]; 6761 } 6762 6763 async _getAppearance(evaluator, task, annotationStorage) { 6764 const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD); 6765 6766 if (isPassword) { 6767 return null; 6768 } 6769 6770 const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined; 6771 let value, rotation; 6772 6773 if (storageEntry) { 6774 value = storageEntry.formattedValue || storageEntry.value; 6775 rotation = storageEntry.rotation; 6776 } 6777 6778 if (rotation === undefined && value === undefined) { 6779 if (!this._hasValueFromXFA || this.appearance) { 6780 return null; 6781 } 6782 } 6783 6784 if (value === undefined) { 6785 value = this.data.fieldValue; 6786 6787 if (!value) { 6788 return ""; 6789 } 6790 } 6791 6792 if (Array.isArray(value) && value.length === 1) { 6793 value = value[0]; 6794 } 6795 6796 (0, _util.assert)(typeof value === "string", "Expected `value` to be a string."); 6797 value = value.trim(); 6798 6799 if (value === "") { 6800 return ""; 6801 } 6802 6803 if (rotation === undefined) { 6804 rotation = this.rotation; 6805 } 6806 6807 let lineCount = -1; 6808 6809 if (this.data.multiLine) { 6810 lineCount = value.split(/\r\n|\r|\n/).length; 6811 } 6812 6813 const defaultPadding = 2; 6814 const hPadding = defaultPadding; 6815 let totalHeight = this.data.rect[3] - this.data.rect[1]; 6816 let totalWidth = this.data.rect[2] - this.data.rect[0]; 6817 6818 if (rotation === 90 || rotation === 270) { 6819 [totalWidth, totalHeight] = [totalHeight, totalWidth]; 6820 } 6821 6822 if (!this._defaultAppearance) { 6823 this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g"); 6824 } 6825 6826 const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources); 6827 6828 const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight - defaultPadding, totalWidth - 2 * hPadding, value, font, lineCount); 6829 6830 let descent = font.descent; 6831 6832 if (isNaN(descent)) { 6833 descent = 0; 6834 } 6835 6836 const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding); 6837 const vPadding = defaultVPadding + Math.abs(descent) * fontSize; 6838 const alignment = this.data.textAlignment; 6839 6840 if (this.data.multiLine) { 6841 return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding, annotationStorage); 6842 } 6843 6844 const encodedString = font.encodeString(value).join(""); 6845 6846 if (this.data.comb) { 6847 return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding, annotationStorage); 6848 } 6849 6850 const colors = this.getBorderAndBackgroundAppearances(annotationStorage); 6851 6852 if (alignment === 0 || alignment > 2) { 6853 return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC"; 6854 } 6855 6856 const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding); 6857 6858 return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC"; 6859 } 6860 6861 static async _getFontData(evaluator, task, appearanceData, resources) { 6862 const operatorList = new _operator_list.OperatorList(); 6863 const initialState = { 6864 font: null, 6865 6866 clone() { 6867 return this; 6868 } 6869 6870 }; 6871 const { 6872 fontName, 6873 fontSize 6874 } = appearanceData; 6875 await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null); 6876 return initialState.font; 6877 } 6878 6879 _getTextWidth(text, font) { 6880 return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000; 6881 } 6882 6883 _computeFontSize(height, width, text, font, lineCount) { 6884 let { 6885 fontSize 6886 } = this.data.defaultAppearanceData; 6887 6888 if (!fontSize) { 6889 const roundWithTwoDigits = x => Math.floor(x * 100) / 100; 6890 6891 if (lineCount === -1) { 6892 const textWidth = this._getTextWidth(text, font); 6893 6894 fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, width / textWidth)); 6895 } else { 6896 const lines = text.split(/\r\n?|\n/); 6897 const cachedLines = []; 6898 6899 for (const line of lines) { 6900 const encoded = font.encodeString(line).join(""); 6901 const glyphs = font.charsToGlyphs(encoded); 6902 const positions = font.getCharPositions(encoded); 6903 cachedLines.push({ 6904 line: encoded, 6905 glyphs, 6906 positions 6907 }); 6908 } 6909 6910 const isTooBig = fsize => { 6911 let totalHeight = 0; 6912 6913 for (const cache of cachedLines) { 6914 const chunks = this._splitLine(null, font, fsize, width, cache); 6915 6916 totalHeight += chunks.length * fsize; 6917 6918 if (totalHeight > height) { 6919 return true; 6920 } 6921 } 6922 6923 return false;
vendor: 222,075 bytes, lines 6924-14471
6924 }; 6925 6926 fontSize = 12; 6927 let lineHeight = fontSize * _util.LINE_FACTOR; 6928 let numberOfLines = Math.round(height / lineHeight); 6929 numberOfLines = Math.max(numberOfLines, lineCount); 6930 6931 while (true) { 6932 lineHeight = height / numberOfLines; 6933 fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR); 6934 6935 if (isTooBig(fontSize)) { 6936 numberOfLines++; 6937 continue; 6938 } 6939 6940 break; 6941 } 6942 } 6943 6944 const { 6945 fontName, 6946 fontColor 6947 } = this.data.defaultAppearanceData; 6948 this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({ 6949 fontSize, 6950 fontName, 6951 fontColor 6952 }); 6953 } 6954 6955 return [this._defaultAppearance, fontSize]; 6956 } 6957 6958 _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) { 6959 let shift; 6960 6961 if (alignment === 1) { 6962 const width = this._getTextWidth(text, font) * fontSize; 6963 shift = (totalWidth - width) / 2; 6964 } else if (alignment === 2) { 6965 const width = this._getTextWidth(text, font) * fontSize; 6966 shift = totalWidth - width - hPadding; 6967 } else { 6968 shift = hPadding; 6969 } 6970 6971 shift = (0, _core_utils.numberToString)(shift); 6972 vPadding = (0, _core_utils.numberToString)(vPadding); 6973 return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`; 6974 } 6975 6976 _getSaveFieldResources(xref) { 6977 const { 6978 localResources, 6979 appearanceResources, 6980 acroFormResources 6981 } = this._fieldResources; 6982 const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName; 6983 6984 if (!fontName) { 6985 return localResources || _primitives.Dict.empty; 6986 } 6987 6988 for (const resources of [localResources, appearanceResources]) { 6989 if (resources instanceof _primitives.Dict) { 6990 const localFont = resources.get("Font"); 6991 6992 if (localFont instanceof _primitives.Dict && localFont.has(fontName)) { 6993 return resources; 6994 } 6995 } 6996 } 6997 6998 if (acroFormResources instanceof _primitives.Dict) { 6999 const acroFormFont = acroFormResources.get("Font"); 7000 7001 if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) { 7002 const subFontDict = new _primitives.Dict(xref); 7003 subFontDict.set(fontName, acroFormFont.getRaw(fontName)); 7004 const subResourcesDict = new _primitives.Dict(xref); 7005 subResourcesDict.set("Font", subFontDict); 7006 return _primitives.Dict.merge({ 7007 xref, 7008 dictArray: [subResourcesDict, localResources], 7009 mergeSubDicts: true 7010 }); 7011 } 7012 } 7013 7014 return localResources || _primitives.Dict.empty; 7015 } 7016 7017 getFieldObject() { 7018 return null; 7019 } 7020 7021} 7022 7023class TextWidgetAnnotation extends WidgetAnnotation { 7024 constructor(params) { 7025 super(params); 7026 this._hasText = true; 7027 const dict = params.dict; 7028 7029 if (typeof this.data.fieldValue !== "string") { 7030 this.data.fieldValue = ""; 7031 } 7032 7033 let alignment = (0, _core_utils.getInheritableProperty)({ 7034 dict, 7035 key: "Q" 7036 }); 7037 7038 if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) { 7039 alignment = null; 7040 } 7041 7042 this.data.textAlignment = alignment; 7043 let maximumLength = (0, _core_utils.getInheritableProperty)({ 7044 dict, 7045 key: "MaxLen" 7046 }); 7047 7048 if (!Number.isInteger(maximumLength) || maximumLength < 0) { 7049 maximumLength = 0; 7050 } 7051 7052 this.data.maxLen = maximumLength; 7053 this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE); 7054 this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== 0; 7055 this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL); 7056 } 7057 7058 _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding, annotationStorage) { 7059 const combWidth = (0, _core_utils.numberToString)(width / this.data.maxLen); 7060 const buf = []; 7061 const positions = font.getCharPositions(text); 7062 7063 for (const [start, end] of positions) { 7064 buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`); 7065 } 7066 7067 const colors = this.getBorderAndBackgroundAppearances(annotationStorage); 7068 const renderedComb = buf.join(` ${combWidth} 0 Td `); 7069 return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC"; 7070 } 7071 7072 _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding, annotationStorage) { 7073 const lines = text.split(/\r\n?|\n/); 7074 const buf = []; 7075 const totalWidth = width - 2 * hPadding; 7076 7077 for (const line of lines) { 7078 const chunks = this._splitLine(line, font, fontSize, totalWidth); 7079 7080 for (const chunk of chunks) { 7081 const padding = buf.length === 0 ? hPadding : 0; 7082 buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize)); 7083 } 7084 } 7085 7086 const renderedText = buf.join("\n"); 7087 const colors = this.getBorderAndBackgroundAppearances(annotationStorage); 7088 return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC"; 7089 } 7090 7091 _splitLine(line, font, fontSize, width, cache = {}) { 7092 line = cache.line || font.encodeString(line).join(""); 7093 const glyphs = cache.glyphs || font.charsToGlyphs(line); 7094 7095 if (glyphs.length <= 1) { 7096 return [line]; 7097 } 7098 7099 const positions = cache.positions || font.getCharPositions(line); 7100 const scale = fontSize / 1000; 7101 const chunks = []; 7102 let lastSpacePosInStringStart = -1, 7103 lastSpacePosInStringEnd = -1, 7104 lastSpacePos = -1, 7105 startChunk = 0, 7106 currentWidth = 0; 7107 7108 for (let i = 0, ii = glyphs.length; i < ii; i++) { 7109 const [start, end] = positions[i]; 7110 const glyph = glyphs[i]; 7111 const glyphWidth = glyph.width * scale; 7112 7113 if (glyph.unicode === " ") { 7114 if (currentWidth + glyphWidth > width) { 7115 chunks.push(line.substring(startChunk, start)); 7116 startChunk = start; 7117 currentWidth = glyphWidth; 7118 lastSpacePosInStringStart = -1; 7119 lastSpacePos = -1; 7120 } else { 7121 currentWidth += glyphWidth; 7122 lastSpacePosInStringStart = start; 7123 lastSpacePosInStringEnd = end; 7124 lastSpacePos = i; 7125 } 7126 } else { 7127 if (currentWidth + glyphWidth > width) { 7128 if (lastSpacePosInStringStart !== -1) { 7129 chunks.push(line.substring(startChunk, lastSpacePosInStringEnd)); 7130 startChunk = lastSpacePosInStringEnd; 7131 i = lastSpacePos + 1; 7132 lastSpacePosInStringStart = -1; 7133 currentWidth = 0; 7134 } else { 7135 chunks.push(line.substring(startChunk, start)); 7136 startChunk = start; 7137 currentWidth = glyphWidth; 7138 } 7139 } else { 7140 currentWidth += glyphWidth; 7141 } 7142 } 7143 } 7144 7145 if (startChunk < line.length) { 7146 chunks.push(line.substring(startChunk, line.length)); 7147 } 7148 7149 return chunks; 7150 } 7151 7152 getFieldObject() { 7153 return { 7154 id: this.data.id, 7155 value: this.data.fieldValue, 7156 defaultValue: this.data.defaultFieldValue || "", 7157 multiline: this.data.multiLine, 7158 password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD), 7159 charLimit: this.data.maxLen, 7160 comb: this.data.comb, 7161 editable: !this.data.readOnly, 7162 hidden: this.data.hidden, 7163 name: this.data.fieldName, 7164 rect: this.data.rect, 7165 actions: this.data.actions, 7166 page: this.data.pageIndex, 7167 strokeColor: this.data.borderColor, 7168 fillColor: this.data.backgroundColor, 7169 rotation: this.rotation, 7170 type: "text" 7171 }; 7172 } 7173 7174} 7175 7176class ButtonWidgetAnnotation extends WidgetAnnotation { 7177 constructor(params) { 7178 super(params); 7179 this.checkedAppearance = null; 7180 this.uncheckedAppearance = null; 7181 this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 7182 this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 7183 this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 7184 this.data.isTooltipOnly = false; 7185 7186 if (this.data.checkBox) { 7187 this._processCheckBox(params); 7188 } else if (this.data.radioButton) { 7189 this._processRadioButton(params); 7190 } else if (this.data.pushButton) { 7191 this.data.hasOwnCanvas = true; 7192 7193 this._processPushButton(params); 7194 } else { 7195 (0, _util.warn)("Invalid field flags for button widget annotation"); 7196 } 7197 } 7198 7199 async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) { 7200 if (this.data.pushButton) { 7201 return super.getOperatorList(evaluator, task, intent, false, annotationStorage); 7202 } 7203 7204 let value = null; 7205 let rotation = null; 7206 7207 if (annotationStorage) { 7208 const storageEntry = annotationStorage.get(this.data.id); 7209 value = storageEntry ? storageEntry.value : null; 7210 rotation = storageEntry ? storageEntry.rotation : null; 7211 } 7212 7213 if (value === null && this.appearance) { 7214 return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage); 7215 } 7216 7217 if (value === null || value === undefined) { 7218 if (this.data.checkBox) { 7219 value = this.data.fieldValue === this.data.exportValue; 7220 } else { 7221 value = this.data.fieldValue === this.data.buttonValue; 7222 } 7223 } 7224 7225 const appearance = value ? this.checkedAppearance : this.uncheckedAppearance; 7226 7227 if (appearance) { 7228 const savedAppearance = this.appearance; 7229 7230 const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX; 7231 7232 if (rotation) { 7233 appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage)); 7234 } 7235 7236 this.appearance = appearance; 7237 const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage); 7238 this.appearance = savedAppearance; 7239 appearance.dict.set("Matrix", savedMatrix); 7240 return operatorList; 7241 } 7242 7243 return { 7244 opList: new _operator_list.OperatorList(), 7245 separateForm: false, 7246 separateCanvas: false 7247 }; 7248 } 7249 7250 async save(evaluator, task, annotationStorage) { 7251 if (this.data.checkBox) { 7252 return this._saveCheckbox(evaluator, task, annotationStorage); 7253 } 7254 7255 if (this.data.radioButton) { 7256 return this._saveRadioButton(evaluator, task, annotationStorage); 7257 } 7258 7259 return null; 7260 } 7261 7262 async _saveCheckbox(evaluator, task, annotationStorage) { 7263 if (!annotationStorage) { 7264 return null; 7265 } 7266 7267 const storageEntry = annotationStorage.get(this.data.id); 7268 let rotation = storageEntry && storageEntry.rotation; 7269 let value = storageEntry && storageEntry.value; 7270 7271 if (rotation === undefined) { 7272 if (value === undefined) { 7273 return null; 7274 } 7275 7276 const defaultValue = this.data.fieldValue === this.data.exportValue; 7277 7278 if (defaultValue === value) { 7279 return null; 7280 } 7281 } 7282 7283 const dict = evaluator.xref.fetchIfRef(this.ref); 7284 7285 if (!(dict instanceof _primitives.Dict)) { 7286 return null; 7287 } 7288 7289 if (rotation === undefined) { 7290 rotation = this.rotation; 7291 } 7292 7293 if (value === undefined) { 7294 value = this.data.fieldValue === this.data.exportValue; 7295 } 7296 7297 const xfa = { 7298 path: (0, _util.stringToPDFString)(dict.get("T") || ""), 7299 value: value ? this.data.exportValue : "" 7300 }; 7301 7302 const name = _primitives.Name.get(value ? this.data.exportValue : "Off"); 7303 7304 dict.set("V", name); 7305 dict.set("AS", name); 7306 dict.set("M", `D:${(0, _util.getModificationDate)()}`); 7307 7308 const maybeMK = this._getMKDict(rotation); 7309 7310 if (maybeMK) { 7311 dict.set("MK", maybeMK); 7312 } 7313 7314 const encrypt = evaluator.xref.encrypt; 7315 let originalTransform = null; 7316 7317 if (encrypt) { 7318 originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen); 7319 } 7320 7321 const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`]; 7322 (0, _writer.writeDict)(dict, buffer, originalTransform); 7323 buffer.push("\nendobj\n"); 7324 return [{ 7325 ref: this.ref, 7326 data: buffer.join(""), 7327 xfa 7328 }]; 7329 } 7330 7331 async _saveRadioButton(evaluator, task, annotationStorage) { 7332 if (!annotationStorage) { 7333 return null; 7334 } 7335 7336 const storageEntry = annotationStorage.get(this.data.id); 7337 let rotation = storageEntry && storageEntry.rotation; 7338 let value = storageEntry && storageEntry.value; 7339 7340 if (rotation === undefined) { 7341 if (value === undefined) { 7342 return null; 7343 } 7344 7345 const defaultValue = this.data.fieldValue === this.data.buttonValue; 7346 7347 if (defaultValue === value) { 7348 return null; 7349 } 7350 } 7351 7352 const dict = evaluator.xref.fetchIfRef(this.ref); 7353 7354 if (!(dict instanceof _primitives.Dict)) { 7355 return null; 7356 } 7357 7358 if (value === undefined) { 7359 value = this.data.fieldValue === this.data.buttonValue; 7360 } 7361 7362 if (rotation === undefined) { 7363 rotation = this.rotation; 7364 } 7365 7366 const xfa = { 7367 path: (0, _util.stringToPDFString)(dict.get("T") || ""), 7368 value: value ? this.data.buttonValue : "" 7369 }; 7370 7371 const name = _primitives.Name.get(value ? this.data.buttonValue : "Off"); 7372 7373 let parentBuffer = null; 7374 const encrypt = evaluator.xref.encrypt; 7375 7376 if (value) { 7377 if (this.parent instanceof _primitives.Ref) { 7378 const parent = evaluator.xref.fetch(this.parent); 7379 let parentTransform = null; 7380 7381 if (encrypt) { 7382 parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen); 7383 } 7384 7385 parent.set("V", name); 7386 parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`]; 7387 (0, _writer.writeDict)(parent, parentBuffer, parentTransform); 7388 parentBuffer.push("\nendobj\n"); 7389 } else if (this.parent instanceof _primitives.Dict) { 7390 this.parent.set("V", name); 7391 } 7392 } 7393 7394 dict.set("AS", name); 7395 dict.set("M", `D:${(0, _util.getModificationDate)()}`); 7396 7397 const maybeMK = this._getMKDict(rotation); 7398 7399 if (maybeMK) { 7400 dict.set("MK", maybeMK); 7401 } 7402 7403 let originalTransform = null; 7404 7405 if (encrypt) { 7406 originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen); 7407 } 7408 7409 const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`]; 7410 (0, _writer.writeDict)(dict, buffer, originalTransform); 7411 buffer.push("\nendobj\n"); 7412 const newRefs = [{ 7413 ref: this.ref, 7414 data: buffer.join(""), 7415 xfa 7416 }]; 7417 7418 if (parentBuffer !== null) { 7419 newRefs.push({ 7420 ref: this.parent, 7421 data: parentBuffer.join(""), 7422 xfa: null 7423 }); 7424 } 7425 7426 return newRefs; 7427 } 7428 7429 _getDefaultCheckedAppearance(params, type) { 7430 const width = this.data.rect[2] - this.data.rect[0]; 7431 const height = this.data.rect[3] - this.data.rect[1]; 7432 const bbox = [0, 0, width, height]; 7433 const FONT_RATIO = 0.8; 7434 const fontSize = Math.min(width, height) * FONT_RATIO; 7435 let metrics, char; 7436 7437 if (type === "check") { 7438 metrics = { 7439 width: 0.755 * fontSize, 7440 height: 0.705 * fontSize 7441 }; 7442 char = "\x33"; 7443 } else if (type === "disc") { 7444 metrics = { 7445 width: 0.791 * fontSize, 7446 height: 0.705 * fontSize 7447 }; 7448 char = "\x6C"; 7449 } else { 7450 (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`); 7451 } 7452 7453 const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2); 7454 const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2); 7455 const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`; 7456 const appearanceStreamDict = new _primitives.Dict(params.xref); 7457 appearanceStreamDict.set("FormType", 1); 7458 appearanceStreamDict.set("Subtype", _primitives.Name.get("Form")); 7459 appearanceStreamDict.set("Type", _primitives.Name.get("XObject")); 7460 appearanceStreamDict.set("BBox", bbox); 7461 appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]); 7462 appearanceStreamDict.set("Length", appearance.length); 7463 const resources = new _primitives.Dict(params.xref); 7464 const font = new _primitives.Dict(params.xref); 7465 font.set("PdfJsZaDb", this.fallbackFontDict); 7466 resources.set("Font", font); 7467 appearanceStreamDict.set("Resources", resources); 7468 this.checkedAppearance = new _stream.StringStream(appearance); 7469 this.checkedAppearance.dict = appearanceStreamDict; 7470 7471 this._streams.push(this.checkedAppearance); 7472 } 7473 7474 _processCheckBox(params) { 7475 const customAppearance = params.dict.get("AP"); 7476 7477 if (!(customAppearance instanceof _primitives.Dict)) { 7478 return; 7479 } 7480 7481 const normalAppearance = customAppearance.get("N"); 7482 7483 if (!(normalAppearance instanceof _primitives.Dict)) { 7484 return; 7485 } 7486 7487 const asValue = this._decodeFormValue(params.dict.get("AS")); 7488 7489 if (typeof asValue === "string") { 7490 this.data.fieldValue = asValue; 7491 } 7492 7493 const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes"; 7494 const exportValues = normalAppearance.getKeys(); 7495 7496 if (exportValues.length === 0) { 7497 exportValues.push("Off", yes); 7498 } else if (exportValues.length === 1) { 7499 if (exportValues[0] === "Off") { 7500 exportValues.push(yes); 7501 } else { 7502 exportValues.unshift("Off"); 7503 } 7504 } else if (exportValues.includes(yes)) { 7505 exportValues.length = 0; 7506 exportValues.push("Off", yes); 7507 } else { 7508 const otherYes = exportValues.find(v => v !== "Off"); 7509 exportValues.length = 0; 7510 exportValues.push("Off", otherYes); 7511 } 7512 7513 if (!exportValues.includes(this.data.fieldValue)) { 7514 this.data.fieldValue = "Off"; 7515 } 7516 7517 this.data.exportValue = exportValues[1]; 7518 this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null; 7519 this.uncheckedAppearance = normalAppearance.get("Off") || null; 7520 7521 if (this.checkedAppearance) { 7522 this._streams.push(this.checkedAppearance); 7523 } else { 7524 this._getDefaultCheckedAppearance(params, "check"); 7525 } 7526 7527 if (this.uncheckedAppearance) { 7528 this._streams.push(this.uncheckedAppearance); 7529 } 7530 7531 this._fallbackFontDict = this.fallbackFontDict; 7532 } 7533 7534 _processRadioButton(params) { 7535 this.data.fieldValue = this.data.buttonValue = null; 7536 const fieldParent = params.dict.get("Parent"); 7537 7538 if (fieldParent instanceof _primitives.Dict) { 7539 this.parent = params.dict.getRaw("Parent"); 7540 const fieldParentValue = fieldParent.get("V"); 7541 7542 if (fieldParentValue instanceof _primitives.Name) { 7543 this.data.fieldValue = this._decodeFormValue(fieldParentValue); 7544 } 7545 } 7546 7547 const appearanceStates = params.dict.get("AP"); 7548 7549 if (!(appearanceStates instanceof _primitives.Dict)) { 7550 return; 7551 } 7552 7553 const normalAppearance = appearanceStates.get("N"); 7554 7555 if (!(normalAppearance instanceof _primitives.Dict)) { 7556 return; 7557 } 7558 7559 for (const key of normalAppearance.getKeys()) { 7560 if (key !== "Off") { 7561 this.data.buttonValue = this._decodeFormValue(key); 7562 break; 7563 } 7564 } 7565 7566 this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null; 7567 this.uncheckedAppearance = normalAppearance.get("Off") || null; 7568 7569 if (this.checkedAppearance) { 7570 this._streams.push(this.checkedAppearance); 7571 } else { 7572 this._getDefaultCheckedAppearance(params, "disc"); 7573 } 7574 7575 if (this.uncheckedAppearance) { 7576 this._streams.push(this.uncheckedAppearance); 7577 } 7578 7579 this._fallbackFontDict = this.fallbackFontDict; 7580 } 7581 7582 _processPushButton(params) { 7583 if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) { 7584 (0, _util.warn)("Push buttons without action dictionaries are not supported"); 7585 return; 7586 } 7587 7588 this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA"); 7589 7590 _catalog.Catalog.parseDestDictionary({ 7591 destDict: params.dict, 7592 resultObj: this.data, 7593 docBaseUrl: params.pdfManager.docBaseUrl 7594 }); 7595 } 7596 7597 getFieldObject() { 7598 let type = "button"; 7599 let exportValues; 7600 7601 if (this.data.checkBox) { 7602 type = "checkbox"; 7603 exportValues = this.data.exportValue; 7604 } else if (this.data.radioButton) { 7605 type = "radiobutton"; 7606 exportValues = this.data.buttonValue; 7607 } 7608 7609 return { 7610 id: this.data.id, 7611 value: this.data.fieldValue || "Off", 7612 defaultValue: this.data.defaultFieldValue, 7613 exportValues, 7614 editable: !this.data.readOnly, 7615 name: this.data.fieldName, 7616 rect: this.data.rect, 7617 hidden: this.data.hidden, 7618 actions: this.data.actions, 7619 page: this.data.pageIndex, 7620 strokeColor: this.data.borderColor, 7621 fillColor: this.data.backgroundColor, 7622 rotation: this.rotation, 7623 type 7624 }; 7625 } 7626 7627 get fallbackFontDict() { 7628 const dict = new _primitives.Dict(); 7629 dict.set("BaseFont", _primitives.Name.get("ZapfDingbats")); 7630 dict.set("Type", _primitives.Name.get("FallbackType")); 7631 dict.set("Subtype", _primitives.Name.get("FallbackType")); 7632 dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding")); 7633 return (0, _util.shadow)(this, "fallbackFontDict", dict); 7634 } 7635 7636} 7637 7638class ChoiceWidgetAnnotation extends WidgetAnnotation { 7639 constructor(params) { 7640 super(params); 7641 this.data.options = []; 7642 const options = (0, _core_utils.getInheritableProperty)({ 7643 dict: params.dict, 7644 key: "Opt" 7645 }); 7646 7647 if (Array.isArray(options)) { 7648 const xref = params.xref; 7649 7650 for (let i = 0, ii = options.length; i < ii; i++) { 7651 const option = xref.fetchIfRef(options[i]); 7652 const isOptionArray = Array.isArray(option); 7653 this.data.options[i] = { 7654 exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option), 7655 displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option) 7656 }; 7657 } 7658 } 7659 7660 if (typeof this.data.fieldValue === "string") { 7661 this.data.fieldValue = [this.data.fieldValue]; 7662 } else if (!this.data.fieldValue) { 7663 this.data.fieldValue = []; 7664 } 7665 7666 this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO); 7667 this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT); 7668 this._hasText = true; 7669 } 7670 7671 getFieldObject() { 7672 const type = this.data.combo ? "combobox" : "listbox"; 7673 const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null; 7674 return { 7675 id: this.data.id, 7676 value, 7677 defaultValue: this.data.defaultFieldValue, 7678 editable: !this.data.readOnly, 7679 name: this.data.fieldName, 7680 rect: this.data.rect, 7681 numItems: this.data.fieldValue.length, 7682 multipleSelection: this.data.multiSelect, 7683 hidden: this.data.hidden, 7684 actions: this.data.actions, 7685 items: this.data.options, 7686 page: this.data.pageIndex, 7687 strokeColor: this.data.borderColor, 7688 fillColor: this.data.backgroundColor, 7689 rotation: this.rotation, 7690 type 7691 }; 7692 } 7693 7694 async _getAppearance(evaluator, task, annotationStorage) { 7695 if (this.data.combo) { 7696 return super._getAppearance(evaluator, task, annotationStorage); 7697 } 7698 7699 if (!annotationStorage) { 7700 return null; 7701 } 7702 7703 const storageEntry = annotationStorage.get(this.data.id); 7704 7705 if (!storageEntry) { 7706 return null; 7707 } 7708 7709 const rotation = storageEntry.rotation; 7710 let exportedValue = storageEntry.value; 7711 7712 if (rotation === undefined && exportedValue === undefined) { 7713 return null; 7714 } 7715 7716 if (exportedValue === undefined) { 7717 exportedValue = this.data.fieldValue; 7718 } else if (!Array.isArray(exportedValue)) { 7719 exportedValue = [exportedValue]; 7720 } 7721 7722 const defaultPadding = 2; 7723 const hPadding = defaultPadding; 7724 let totalHeight = this.data.rect[3] - this.data.rect[1]; 7725 let totalWidth = this.data.rect[2] - this.data.rect[0]; 7726 7727 if (rotation === 90 || rotation === 270) { 7728 [totalWidth, totalHeight] = [totalHeight, totalWidth]; 7729 } 7730 7731 const lineCount = this.data.options.length; 7732 const valueIndices = []; 7733 7734 for (let i = 0; i < lineCount; i++) { 7735 const { 7736 exportValue 7737 } = this.data.options[i]; 7738 7739 if (exportedValue.includes(exportValue)) { 7740 valueIndices.push(i); 7741 } 7742 } 7743 7744 if (!this._defaultAppearance) { 7745 this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g"); 7746 } 7747 7748 const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources); 7749 let defaultAppearance; 7750 let { 7751 fontSize 7752 } = this.data.defaultAppearanceData; 7753 7754 if (!fontSize) { 7755 const lineHeight = (totalHeight - defaultPadding) / lineCount; 7756 let lineWidth = -1; 7757 let value; 7758 7759 for (const { 7760 displayValue 7761 } of this.data.options) { 7762 const width = this._getTextWidth(displayValue, font); 7763 7764 if (width > lineWidth) { 7765 lineWidth = width; 7766 value = displayValue; 7767 } 7768 } 7769 7770 [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * hPadding, value, font, -1); 7771 } else { 7772 defaultAppearance = this._defaultAppearance; 7773 } 7774 7775 const lineHeight = fontSize * _util.LINE_FACTOR; 7776 const vPadding = (lineHeight - fontSize) / 2; 7777 const numberOfVisibleLines = Math.floor(totalHeight / lineHeight); 7778 let firstIndex; 7779 7780 if (valueIndices.length === 1) { 7781 const valuePosition = valueIndices[0]; 7782 const indexInPage = valuePosition % numberOfVisibleLines; 7783 firstIndex = valuePosition - indexInPage; 7784 } else { 7785 firstIndex = valueIndices.length ? valueIndices[0] : 0; 7786 } 7787 7788 const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount); 7789 const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`]; 7790 7791 if (valueIndices.length) { 7792 buf.push("0.600006 0.756866 0.854904 rg"); 7793 7794 for (const index of valueIndices) { 7795 if (firstIndex <= index && index < end) { 7796 buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`); 7797 } 7798 } 7799 } 7800 7801 buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`); 7802 7803 for (let i = firstIndex; i < end; i++) { 7804 const { 7805 displayValue 7806 } = this.data.options[i]; 7807 const hpadding = i === firstIndex ? hPadding : 0; 7808 const vpadding = i === firstIndex ? vPadding : 0; 7809 buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, hpadding, -lineHeight + vpadding)); 7810 } 7811 7812 buf.push("ET Q EMC"); 7813 return buf.join("\n"); 7814 } 7815 7816} 7817 7818class SignatureWidgetAnnotation extends WidgetAnnotation { 7819 constructor(params) { 7820 super(params); 7821 this.data.fieldValue = null; 7822 } 7823 7824 getFieldObject() { 7825 return { 7826 id: this.data.id, 7827 value: null, 7828 page: this.data.pageIndex, 7829 type: "signature" 7830 }; 7831 } 7832 7833} 7834 7835class TextAnnotation extends MarkupAnnotation { 7836 constructor(parameters) { 7837 const DEFAULT_ICON_SIZE = 22; 7838 super(parameters); 7839 const dict = parameters.dict; 7840 this.data.annotationType = _util.AnnotationType.TEXT; 7841 7842 if (this.data.hasAppearance) { 7843 this.data.name = "NoIcon"; 7844 } else { 7845 this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE; 7846 this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE; 7847 this.data.name = dict.has("Name") ? dict.get("Name").name : "Note"; 7848 } 7849 7850 if (dict.has("State")) { 7851 this.data.state = dict.get("State") || null; 7852 this.data.stateModel = dict.get("StateModel") || null; 7853 } else { 7854 this.data.state = null; 7855 this.data.stateModel = null; 7856 } 7857 } 7858 7859} 7860 7861class LinkAnnotation extends Annotation { 7862 constructor(params) { 7863 super(params); 7864 this.data.annotationType = _util.AnnotationType.LINK; 7865 const quadPoints = getQuadPoints(params.dict, this.rectangle); 7866 7867 if (quadPoints) { 7868 this.data.quadPoints = quadPoints; 7869 } 7870 7871 this.data.borderColor = this.data.borderColor || this.data.color; 7872 7873 _catalog.Catalog.parseDestDictionary({ 7874 destDict: params.dict, 7875 resultObj: this.data, 7876 docBaseUrl: params.pdfManager.docBaseUrl 7877 }); 7878 } 7879 7880} 7881 7882class PopupAnnotation extends Annotation { 7883 constructor(parameters) { 7884 super(parameters); 7885 this.data.annotationType = _util.AnnotationType.POPUP; 7886 let parentItem = parameters.dict.get("Parent"); 7887 7888 if (!parentItem) { 7889 (0, _util.warn)("Popup annotation has a missing or invalid parent annotation."); 7890 return; 7891 } 7892 7893 const parentSubtype = parentItem.get("Subtype"); 7894 this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null; 7895 const rawParent = parameters.dict.getRaw("Parent"); 7896 this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null; 7897 const parentRect = parentItem.getArray("Rect"); 7898 7899 if (Array.isArray(parentRect) && parentRect.length === 4) { 7900 this.data.parentRect = _util.Util.normalizeRect(parentRect); 7901 } else { 7902 this.data.parentRect = [0, 0, 0, 0]; 7903 } 7904 7905 const rt = parentItem.get("RT"); 7906 7907 if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) { 7908 parentItem = parentItem.get("IRT"); 7909 } 7910 7911 if (!parentItem.has("M")) { 7912 this.data.modificationDate = null; 7913 } else { 7914 this.setModificationDate(parentItem.get("M")); 7915 this.data.modificationDate = this.modificationDate; 7916 } 7917 7918 if (!parentItem.has("C")) { 7919 this.data.color = null; 7920 } else { 7921 this.setColor(parentItem.getArray("C")); 7922 this.data.color = this.color; 7923 } 7924 7925 if (!this.viewable) { 7926 const parentFlags = parentItem.get("F"); 7927 7928 if (this._isViewable(parentFlags)) { 7929 this.setFlags(parentFlags); 7930 } 7931 } 7932 7933 this.setTitle(parentItem.get("T")); 7934 this.data.titleObj = this._title; 7935 this.setContents(parentItem.get("Contents")); 7936 this.data.contentsObj = this._contents; 7937 7938 if (parentItem.has("RC")) { 7939 this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC")); 7940 } 7941 } 7942 7943} 7944 7945exports.PopupAnnotation = PopupAnnotation; 7946 7947class FreeTextAnnotation extends MarkupAnnotation { 7948 constructor(parameters) { 7949 super(parameters); 7950 this.data.annotationType = _util.AnnotationType.FREETEXT; 7951 } 7952 7953 get hasTextContent() { 7954 return !!this.appearance; 7955 } 7956 7957 static createNewDict(annotation, xref, { 7958 apRef, 7959 ap 7960 }) { 7961 const { 7962 color, 7963 fontSize, 7964 rect, 7965 rotation, 7966 user, 7967 value 7968 } = annotation; 7969 const freetext = new _primitives.Dict(xref); 7970 freetext.set("Type", _primitives.Name.get("Annot")); 7971 freetext.set("Subtype", _primitives.Name.get("FreeText")); 7972 freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`); 7973 freetext.set("Rect", rect); 7974 const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`; 7975 freetext.set("DA", da); 7976 freetext.set("Contents", value); 7977 freetext.set("F", 4); 7978 freetext.set("Border", [0, 0, 0]); 7979 freetext.set("Rotate", rotation); 7980 7981 if (user) { 7982 freetext.set("T", (0, _util.stringToUTF8String)(user)); 7983 } 7984 7985 const n = new _primitives.Dict(xref); 7986 freetext.set("AP", n); 7987 7988 if (apRef) { 7989 n.set("N", apRef); 7990 } else { 7991 n.set("N", ap); 7992 } 7993 7994 return freetext; 7995 } 7996 7997 static async createNewAppearanceStream(annotation, xref, params) { 7998 const { 7999 baseFontRef, 8000 evaluator, 8001 task 8002 } = params; 8003 const { 8004 color, 8005 fontSize, 8006 rect, 8007 rotation, 8008 value 8009 } = annotation; 8010 const resources = new _primitives.Dict(xref); 8011 const font = new _primitives.Dict(xref); 8012 8013 if (baseFontRef) { 8014 font.set("Helv", baseFontRef); 8015 } else { 8016 const baseFont = new _primitives.Dict(xref); 8017 baseFont.set("BaseFont", _primitives.Name.get("Helvetica")); 8018 baseFont.set("Type", _primitives.Name.get("Font")); 8019 baseFont.set("Subtype", _primitives.Name.get("Type1")); 8020 baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding")); 8021 font.set("Helv", baseFont); 8022 } 8023 8024 resources.set("Font", font); 8025 const helv = await WidgetAnnotation._getFontData(evaluator, task, { 8026 fontName: "Helvetica", 8027 fontSize 8028 }, resources); 8029 const [x1, y1, x2, y2] = rect; 8030 let w = x2 - x1; 8031 let h = y2 - y1; 8032 8033 if (rotation % 180 !== 0) { 8034 [w, h] = [h, w]; 8035 } 8036 8037 const lines = value.split("\n"); 8038 const scale = fontSize / 1000; 8039 let totalWidth = -Infinity; 8040 const encodedLines = []; 8041 8042 for (let line of lines) { 8043 line = helv.encodeString(line).join(""); 8044 encodedLines.push(line); 8045 let lineWidth = 0; 8046 const glyphs = helv.charsToGlyphs(line); 8047 8048 for (const glyph of glyphs) { 8049 lineWidth += glyph.width * scale; 8050 } 8051 8052 totalWidth = Math.max(totalWidth, lineWidth); 8053 } 8054 8055 let hscale = 1; 8056 8057 if (totalWidth > w) { 8058 hscale = w / totalWidth; 8059 } 8060 8061 let vscale = 1; 8062 const lineHeight = _util.LINE_FACTOR * fontSize; 8063 const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize; 8064 const totalHeight = lineHeight * lines.length; 8065 8066 if (totalHeight > h) { 8067 vscale = h / totalHeight; 8068 } 8069 8070 const fscale = Math.min(hscale, vscale); 8071 const newFontSize = fontSize * fscale; 8072 const buffer = ["q", `0 0 ${(0, _core_utils.numberToString)(w)} ${(0, _core_utils.numberToString)(h)} re W n`, `BT`, `1 0 0 1 0 ${(0, _core_utils.numberToString)(h + lineDescent)} Tm 0 Tc ${(0, _default_appearance.getPdfColor)(color, true)}`, `/Helv ${(0, _core_utils.numberToString)(newFontSize)} Tf`]; 8073 const vShift = (0, _core_utils.numberToString)(lineHeight); 8074 8075 for (const line of encodedLines) { 8076 buffer.push(`0 -${vShift} Td (${(0, _util.escapeString)(line)}) Tj`); 8077 } 8078 8079 buffer.push("ET", "Q"); 8080 const appearance = buffer.join("\n"); 8081 const appearanceStreamDict = new _primitives.Dict(xref); 8082 appearanceStreamDict.set("FormType", 1); 8083 appearanceStreamDict.set("Subtype", _primitives.Name.get("Form")); 8084 appearanceStreamDict.set("Type", _primitives.Name.get("XObject")); 8085 appearanceStreamDict.set("BBox", [0, 0, w, h]); 8086 appearanceStreamDict.set("Length", appearance.length); 8087 appearanceStreamDict.set("Resources", resources); 8088 8089 if (rotation) { 8090 const matrix = WidgetAnnotation._getRotationMatrix(rotation, w, h); 8091 8092 appearanceStreamDict.set("Matrix", matrix); 8093 } 8094 8095 const ap = new _stream.StringStream(appearance); 8096 ap.dict = appearanceStreamDict; 8097 return ap; 8098 } 8099 8100} 8101 8102class LineAnnotation extends MarkupAnnotation { 8103 constructor(parameters) { 8104 super(parameters); 8105 const { 8106 dict 8107 } = parameters; 8108 this.data.annotationType = _util.AnnotationType.LINE; 8109 const lineCoordinates = dict.getArray("L"); 8110 this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates); 8111 this.setLineEndings(dict.getArray("LE")); 8112 this.data.lineEndings = this.lineEndings; 8113 8114 if (!this.appearance) { 8115 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 8116 const strokeAlpha = dict.get("CA"); 8117 let fillColor = null, 8118 interiorColor = dict.getArray("IC"); 8119 8120 if (interiorColor) { 8121 interiorColor = getRgbColor(interiorColor, null); 8122 fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null; 8123 } 8124 8125 const fillAlpha = fillColor ? strokeAlpha : null; 8126 const borderWidth = this.borderStyle.width || 1, 8127 borderAdjust = 2 * borderWidth; 8128 const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust]; 8129 8130 if (!_util.Util.intersect(this.rectangle, bbox)) { 8131 this.rectangle = bbox; 8132 } 8133 8134 this._setDefaultAppearance({ 8135 xref: parameters.xref, 8136 extra: `${borderWidth} w`, 8137 strokeColor, 8138 fillColor, 8139 strokeAlpha, 8140 fillAlpha, 8141 pointsCallback: (buffer, points) => { 8142 buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S"); 8143 return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth]; 8144 } 8145 }); 8146 } 8147 } 8148 8149} 8150 8151class SquareAnnotation extends MarkupAnnotation { 8152 constructor(parameters) { 8153 super(parameters); 8154 this.data.annotationType = _util.AnnotationType.SQUARE; 8155 8156 if (!this.appearance) { 8157 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 8158 const strokeAlpha = parameters.dict.get("CA"); 8159 let fillColor = null, 8160 interiorColor = parameters.dict.getArray("IC"); 8161 8162 if (interiorColor) { 8163 interiorColor = getRgbColor(interiorColor, null); 8164 fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null; 8165 } 8166 8167 const fillAlpha = fillColor ? strokeAlpha : null; 8168 8169 if (this.borderStyle.width === 0 && !fillColor) { 8170 return; 8171 } 8172 8173 this._setDefaultAppearance({ 8174 xref: parameters.xref, 8175 extra: `${this.borderStyle.width} w`, 8176 strokeColor, 8177 fillColor, 8178 strokeAlpha, 8179 fillAlpha, 8180 pointsCallback: (buffer, points) => { 8181 const x = points[2].x + this.borderStyle.width / 2; 8182 const y = points[2].y + this.borderStyle.width / 2; 8183 const width = points[3].x - points[2].x - this.borderStyle.width; 8184 const height = points[1].y - points[3].y - this.borderStyle.width; 8185 buffer.push(`${x} ${y} ${width} ${height} re`); 8186 8187 if (fillColor) { 8188 buffer.push("B"); 8189 } else { 8190 buffer.push("S"); 8191 } 8192 8193 return [points[0].x, points[1].x, points[3].y, points[1].y]; 8194 } 8195 }); 8196 } 8197 } 8198 8199} 8200 8201class CircleAnnotation extends MarkupAnnotation { 8202 constructor(parameters) { 8203 super(parameters); 8204 this.data.annotationType = _util.AnnotationType.CIRCLE; 8205 8206 if (!this.appearance) { 8207 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 8208 const strokeAlpha = parameters.dict.get("CA"); 8209 let fillColor = null; 8210 let interiorColor = parameters.dict.getArray("IC"); 8211 8212 if (interiorColor) { 8213 interiorColor = getRgbColor(interiorColor, null); 8214 fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null; 8215 } 8216 8217 const fillAlpha = fillColor ? strokeAlpha : null; 8218 8219 if (this.borderStyle.width === 0 && !fillColor) { 8220 return; 8221 } 8222 8223 const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4)); 8224 8225 this._setDefaultAppearance({ 8226 xref: parameters.xref, 8227 extra: `${this.borderStyle.width} w`, 8228 strokeColor, 8229 fillColor, 8230 strokeAlpha, 8231 fillAlpha, 8232 pointsCallback: (buffer, points) => { 8233 const x0 = points[0].x + this.borderStyle.width / 2; 8234 const y0 = points[0].y - this.borderStyle.width / 2; 8235 const x1 = points[3].x - this.borderStyle.width / 2; 8236 const y1 = points[3].y + this.borderStyle.width / 2; 8237 const xMid = x0 + (x1 - x0) / 2; 8238 const yMid = y0 + (y1 - y0) / 2; 8239 const xOffset = (x1 - x0) / 2 * controlPointsDistance; 8240 const yOffset = (y1 - y0) / 2 * controlPointsDistance; 8241 buffer.push(`${xMid} ${y1} m`, `${xMid + xOffset} ${y1} ${x1} ${yMid + yOffset} ${x1} ${yMid} c`, `${x1} ${yMid - yOffset} ${xMid + xOffset} ${y0} ${xMid} ${y0} c`, `${xMid - xOffset} ${y0} ${x0} ${yMid - yOffset} ${x0} ${yMid} c`, `${x0} ${yMid + yOffset} ${xMid - xOffset} ${y1} ${xMid} ${y1} c`, "h"); 8242 8243 if (fillColor) { 8244 buffer.push("B"); 8245 } else { 8246 buffer.push("S"); 8247 } 8248 8249 return [points[0].x, points[1].x, points[3].y, points[1].y]; 8250 } 8251 }); 8252 } 8253 } 8254 8255} 8256 8257class PolylineAnnotation extends MarkupAnnotation { 8258 constructor(parameters) { 8259 super(parameters); 8260 const { 8261 dict 8262 } = parameters; 8263 this.data.annotationType = _util.AnnotationType.POLYLINE; 8264 this.data.vertices = []; 8265 8266 if (!(this instanceof PolygonAnnotation)) { 8267 this.setLineEndings(dict.getArray("LE")); 8268 this.data.lineEndings = this.lineEndings; 8269 } 8270 8271 const rawVertices = dict.getArray("Vertices"); 8272 8273 if (!Array.isArray(rawVertices)) { 8274 return; 8275 } 8276 8277 for (let i = 0, ii = rawVertices.length; i < ii; i += 2) { 8278 this.data.vertices.push({ 8279 x: rawVertices[i], 8280 y: rawVertices[i + 1] 8281 }); 8282 } 8283 8284 if (!this.appearance) { 8285 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 8286 const strokeAlpha = dict.get("CA"); 8287 const borderWidth = this.borderStyle.width || 1, 8288 borderAdjust = 2 * borderWidth; 8289 const bbox = [Infinity, Infinity, -Infinity, -Infinity]; 8290 8291 for (const vertex of this.data.vertices) { 8292 bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust); 8293 bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust); 8294 bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust); 8295 bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust); 8296 } 8297 8298 if (!_util.Util.intersect(this.rectangle, bbox)) { 8299 this.rectangle = bbox; 8300 } 8301 8302 this._setDefaultAppearance({ 8303 xref: parameters.xref, 8304 extra: `${borderWidth} w`, 8305 strokeColor, 8306 strokeAlpha, 8307 pointsCallback: (buffer, points) => { 8308 const vertices = this.data.vertices; 8309 8310 for (let i = 0, ii = vertices.length; i < ii; i++) { 8311 buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`); 8312 } 8313 8314 buffer.push("S"); 8315 return [points[0].x, points[1].x, points[3].y, points[1].y]; 8316 } 8317 }); 8318 } 8319 } 8320 8321} 8322 8323class PolygonAnnotation extends PolylineAnnotation { 8324 constructor(parameters) { 8325 super(parameters); 8326 this.data.annotationType = _util.AnnotationType.POLYGON; 8327 } 8328 8329} 8330 8331class CaretAnnotation extends MarkupAnnotation { 8332 constructor(parameters) { 8333 super(parameters); 8334 this.data.annotationType = _util.AnnotationType.CARET; 8335 } 8336 8337} 8338 8339class InkAnnotation extends MarkupAnnotation { 8340 constructor(parameters) { 8341 super(parameters); 8342 this.data.annotationType = _util.AnnotationType.INK; 8343 this.data.inkLists = []; 8344 const rawInkLists = parameters.dict.getArray("InkList"); 8345 8346 if (!Array.isArray(rawInkLists)) { 8347 return; 8348 } 8349 8350 const xref = parameters.xref; 8351 8352 for (let i = 0, ii = rawInkLists.length; i < ii; ++i) { 8353 this.data.inkLists.push([]); 8354 8355 for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) { 8356 this.data.inkLists[i].push({ 8357 x: xref.fetchIfRef(rawInkLists[i][j]), 8358 y: xref.fetchIfRef(rawInkLists[i][j + 1]) 8359 }); 8360 } 8361 } 8362 8363 if (!this.appearance) { 8364 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 8365 const strokeAlpha = parameters.dict.get("CA"); 8366 const borderWidth = this.borderStyle.width || 1, 8367 borderAdjust = 2 * borderWidth; 8368 const bbox = [Infinity, Infinity, -Infinity, -Infinity]; 8369 8370 for (const inkLists of this.data.inkLists) { 8371 for (const vertex of inkLists) { 8372 bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust); 8373 bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust); 8374 bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust); 8375 bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust); 8376 } 8377 } 8378 8379 if (!_util.Util.intersect(this.rectangle, bbox)) { 8380 this.rectangle = bbox; 8381 } 8382 8383 this._setDefaultAppearance({ 8384 xref: parameters.xref, 8385 extra: `${borderWidth} w`, 8386 strokeColor, 8387 strokeAlpha, 8388 pointsCallback: (buffer, points) => { 8389 for (const inkList of this.data.inkLists) { 8390 for (let i = 0, ii = inkList.length; i < ii; i++) { 8391 buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`); 8392 } 8393 8394 buffer.push("S"); 8395 } 8396 8397 return [points[0].x, points[1].x, points[3].y, points[1].y]; 8398 } 8399 }); 8400 } 8401 } 8402 8403 static createNewDict(annotation, xref, { 8404 apRef, 8405 ap 8406 }) { 8407 const { 8408 paths, 8409 rect, 8410 rotation 8411 } = annotation; 8412 const ink = new _primitives.Dict(xref); 8413 ink.set("Type", _primitives.Name.get("Annot")); 8414 ink.set("Subtype", _primitives.Name.get("Ink")); 8415 ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`); 8416 ink.set("Rect", rect); 8417 ink.set("InkList", paths.map(p => p.points)); 8418 ink.set("F", 4); 8419 ink.set("Border", [0, 0, 0]); 8420 ink.set("Rotate", rotation); 8421 const n = new _primitives.Dict(xref); 8422 ink.set("AP", n); 8423 8424 if (apRef) { 8425 n.set("N", apRef); 8426 } else { 8427 n.set("N", ap); 8428 } 8429 8430 return ink; 8431 } 8432 8433 static async createNewAppearanceStream(annotation, xref, params) { 8434 const { 8435 color, 8436 rect, 8437 rotation, 8438 paths, 8439 thickness, 8440 opacity 8441 } = annotation; 8442 const [x1, y1, x2, y2] = rect; 8443 let w = x2 - x1; 8444 let h = y2 - y1; 8445 8446 if (rotation % 180 !== 0) { 8447 [w, h] = [h, w]; 8448 } 8449 8450 const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`]; 8451 8452 if (opacity !== 1) { 8453 appearanceBuffer.push("/R0 gs"); 8454 } 8455 8456 const buffer = []; 8457 8458 for (const { 8459 bezier 8460 } of paths) { 8461 buffer.length = 0; 8462 buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`); 8463 8464 for (let i = 2, ii = bezier.length; i < ii; i += 6) { 8465 const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" "); 8466 buffer.push(`${curve} c`); 8467 } 8468 8469 buffer.push("S"); 8470 appearanceBuffer.push(buffer.join("\n")); 8471 } 8472 8473 const appearance = appearanceBuffer.join("\n"); 8474 const appearanceStreamDict = new _primitives.Dict(xref); 8475 appearanceStreamDict.set("FormType", 1); 8476 appearanceStreamDict.set("Subtype", _primitives.Name.get("Form")); 8477 appearanceStreamDict.set("Type", _primitives.Name.get("XObject")); 8478 appearanceStreamDict.set("BBox", [0, 0, w, h]); 8479 appearanceStreamDict.set("Length", appearance.length); 8480 8481 if (rotation) { 8482 const matrix = WidgetAnnotation._getRotationMatrix(rotation, w, h); 8483 8484 appearanceStreamDict.set("Matrix", matrix); 8485 } 8486 8487 if (opacity !== 1) { 8488 const resources = new _primitives.Dict(xref); 8489 const extGState = new _primitives.Dict(xref); 8490 const r0 = new _primitives.Dict(xref); 8491 r0.set("CA", opacity); 8492 r0.set("Type", _primitives.Name.get("ExtGState")); 8493 extGState.set("R0", r0); 8494 resources.set("ExtGState", extGState); 8495 appearanceStreamDict.set("Resources", resources); 8496 } 8497 8498 const ap = new _stream.StringStream(appearance); 8499 ap.dict = appearanceStreamDict; 8500 return ap; 8501 } 8502 8503} 8504 8505class HighlightAnnotation extends MarkupAnnotation { 8506 constructor(parameters) { 8507 super(parameters); 8508 this.data.annotationType = _util.AnnotationType.HIGHLIGHT; 8509 const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null); 8510 8511 if (quadPoints) { 8512 const resources = this.appearance && this.appearance.dict.get("Resources"); 8513 8514 if (!this.appearance || !(resources && resources.has("ExtGState"))) { 8515 if (this.appearance) { 8516 (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream."); 8517 } 8518 8519 const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0]; 8520 const fillAlpha = parameters.dict.get("CA"); 8521 8522 this._setDefaultAppearance({ 8523 xref: parameters.xref, 8524 fillColor, 8525 blendMode: "Multiply", 8526 fillAlpha, 8527 pointsCallback: (buffer, points) => { 8528 buffer.push(`${points[0].x} ${points[0].y} m`, `${points[1].x} ${points[1].y} l`, `${points[3].x} ${points[3].y} l`, `${points[2].x} ${points[2].y} l`, "f"); 8529 return [points[0].x, points[1].x, points[3].y, points[1].y]; 8530 } 8531 }); 8532 } 8533 } else { 8534 this.data.hasPopup = false; 8535 } 8536 } 8537 8538} 8539 8540class UnderlineAnnotation extends MarkupAnnotation { 8541 constructor(parameters) { 8542 super(parameters); 8543 this.data.annotationType = _util.AnnotationType.UNDERLINE; 8544 const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null); 8545 8546 if (quadPoints) { 8547 if (!this.appearance) { 8548 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 8549 const strokeAlpha = parameters.dict.get("CA"); 8550 8551 this._setDefaultAppearance({ 8552 xref: parameters.xref, 8553 extra: "[] 0 d 1 w", 8554 strokeColor, 8555 strokeAlpha, 8556 pointsCallback: (buffer, points) => { 8557 buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S"); 8558 return [points[0].x, points[1].x, points[3].y, points[1].y]; 8559 } 8560 }); 8561 } 8562 } else { 8563 this.data.hasPopup = false; 8564 } 8565 } 8566 8567} 8568 8569class SquigglyAnnotation extends MarkupAnnotation { 8570 constructor(parameters) { 8571 super(parameters); 8572 this.data.annotationType = _util.AnnotationType.SQUIGGLY; 8573 const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null); 8574 8575 if (quadPoints) { 8576 if (!this.appearance) { 8577 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 8578 const strokeAlpha = parameters.dict.get("CA"); 8579 8580 this._setDefaultAppearance({ 8581 xref: parameters.xref, 8582 extra: "[] 0 d 1 w", 8583 strokeColor, 8584 strokeAlpha, 8585 pointsCallback: (buffer, points) => { 8586 const dy = (points[0].y - points[2].y) / 6; 8587 let shift = dy; 8588 let x = points[2].x; 8589 const y = points[2].y; 8590 const xEnd = points[3].x; 8591 buffer.push(`${x} ${y + shift} m`); 8592 8593 do { 8594 x += 2; 8595 shift = shift === 0 ? dy : 0; 8596 buffer.push(`${x} ${y + shift} l`); 8597 } while (x < xEnd); 8598 8599 buffer.push("S"); 8600 return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy]; 8601 } 8602 }); 8603 } 8604 } else { 8605 this.data.hasPopup = false; 8606 } 8607 } 8608 8609} 8610 8611class StrikeOutAnnotation extends MarkupAnnotation { 8612 constructor(parameters) { 8613 super(parameters); 8614 this.data.annotationType = _util.AnnotationType.STRIKEOUT; 8615 const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null); 8616 8617 if (quadPoints) { 8618 if (!this.appearance) { 8619 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 8620 const strokeAlpha = parameters.dict.get("CA"); 8621 8622 this._setDefaultAppearance({ 8623 xref: parameters.xref, 8624 extra: "[] 0 d 1 w", 8625 strokeColor, 8626 strokeAlpha, 8627 pointsCallback: (buffer, points) => { 8628 buffer.push(`${(points[0].x + points[2].x) / 2} ` + `${(points[0].y + points[2].y) / 2} m`, `${(points[1].x + points[3].x) / 2} ` + `${(points[1].y + points[3].y) / 2} l`, "S"); 8629 return [points[0].x, points[1].x, points[3].y, points[1].y]; 8630 } 8631 }); 8632 } 8633 } else { 8634 this.data.hasPopup = false; 8635 } 8636 } 8637 8638} 8639 8640class StampAnnotation extends MarkupAnnotation { 8641 constructor(parameters) { 8642 super(parameters); 8643 this.data.annotationType = _util.AnnotationType.STAMP; 8644 } 8645 8646} 8647 8648class FileAttachmentAnnotation extends MarkupAnnotation { 8649 constructor(parameters) { 8650 super(parameters); 8651 const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref); 8652 this.data.annotationType = _util.AnnotationType.FILEATTACHMENT; 8653 this.data.file = file.serializable; 8654 } 8655 8656} 8657 8658/***/ }), 8659/* 13 */ 8660/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 8661 8662 8663 8664Object.defineProperty(exports, "__esModule", ({ 8665 value: true 8666})); 8667exports.createDefaultAppearance = createDefaultAppearance; 8668exports.getPdfColor = getPdfColor; 8669exports.parseDefaultAppearance = parseDefaultAppearance; 8670 8671var _core_utils = __w_pdfjs_require__(6); 8672 8673var _util = __w_pdfjs_require__(2); 8674 8675var _colorspace = __w_pdfjs_require__(14); 8676 8677var _evaluator = __w_pdfjs_require__(15); 8678 8679var _primitives = __w_pdfjs_require__(5); 8680 8681var _stream = __w_pdfjs_require__(10); 8682 8683class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor { 8684 constructor(str) { 8685 super(new _stream.StringStream(str)); 8686 } 8687 8688 parse() { 8689 const operation = { 8690 fn: 0, 8691 args: [] 8692 }; 8693 const result = { 8694 fontSize: 0, 8695 fontName: "", 8696 fontColor: new Uint8ClampedArray(3) 8697 }; 8698 8699 try { 8700 while (true) { 8701 operation.args.length = 0; 8702 8703 if (!this.read(operation)) { 8704 break; 8705 } 8706 8707 if (this.savedStatesDepth !== 0) { 8708 continue; 8709 } 8710 8711 const { 8712 fn, 8713 args 8714 } = operation; 8715 8716 switch (fn | 0) { 8717 case _util.OPS.setFont: 8718 const [fontName, fontSize] = args; 8719 8720 if (fontName instanceof _primitives.Name) { 8721 result.fontName = fontName.name; 8722 } 8723 8724 if (typeof fontSize === "number" && fontSize > 0) { 8725 result.fontSize = fontSize; 8726 } 8727 8728 break; 8729 8730 case _util.OPS.setFillRGBColor: 8731 _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0); 8732 8733 break; 8734 8735 case _util.OPS.setFillGray: 8736 _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0); 8737 8738 break; 8739 8740 case _util.OPS.setFillColorSpace: 8741 _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0); 8742 8743 break; 8744 } 8745 } 8746 } catch (reason) { 8747 (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`); 8748 } 8749 8750 return result; 8751 } 8752 8753} 8754 8755function parseDefaultAppearance(str) { 8756 return new DefaultAppearanceEvaluator(str).parse(); 8757} 8758 8759function getPdfColor(color, isFill) { 8760 if (color[0] === color[1] && color[1] === color[2]) { 8761 const gray = color[0] / 255; 8762 return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`; 8763 } 8764 8765 return Array.from(color).map(c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`; 8766} 8767 8768function createDefaultAppearance({ 8769 fontSize, 8770 fontName, 8771 fontColor 8772}) { 8773 return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`; 8774} 8775 8776/***/ }), 8777/* 14 */ 8778/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 8779 8780 8781 8782Object.defineProperty(exports, "__esModule", ({ 8783 value: true 8784})); 8785exports.ColorSpace = void 0; 8786 8787var _util = __w_pdfjs_require__(2); 8788 8789var _primitives = __w_pdfjs_require__(5); 8790 8791var _base_stream = __w_pdfjs_require__(7); 8792 8793var _core_utils = __w_pdfjs_require__(6); 8794 8795function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) { 8796 const COMPONENTS = 3; 8797 alpha01 = alpha01 !== 1 ? 0 : alpha01; 8798 const xRatio = w1 / w2; 8799 const yRatio = h1 / h2; 8800 let newIndex = 0, 8801 oldIndex; 8802 const xScaled = new Uint16Array(w2); 8803 const w1Scanline = w1 * COMPONENTS; 8804 8805 for (let i = 0; i < w2; i++) { 8806 xScaled[i] = Math.floor(i * xRatio) * COMPONENTS; 8807 } 8808 8809 for (let i = 0; i < h2; i++) { 8810 const py = Math.floor(i * yRatio) * w1Scanline; 8811 8812 for (let j = 0; j < w2; j++) { 8813 oldIndex = py + xScaled[j]; 8814 dest[newIndex++] = src[oldIndex++]; 8815 dest[newIndex++] = src[oldIndex++]; 8816 dest[newIndex++] = src[oldIndex++]; 8817 newIndex += alpha01; 8818 } 8819 } 8820} 8821 8822class ColorSpace { 8823 constructor(name, numComps) { 8824 if (this.constructor === ColorSpace) { 8825 (0, _util.unreachable)("Cannot initialize ColorSpace."); 8826 } 8827 8828 this.name = name; 8829 this.numComps = numComps; 8830 } 8831 8832 getRgb(src, srcOffset) { 8833 const rgb = new Uint8ClampedArray(3); 8834 this.getRgbItem(src, srcOffset, rgb, 0); 8835 return rgb; 8836 } 8837 8838 getRgbItem(src, srcOffset, dest, destOffset) { 8839 (0, _util.unreachable)("Should not call ColorSpace.getRgbItem"); 8840 } 8841 8842 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8843 (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer"); 8844 } 8845 8846 getOutputLength(inputLength, alpha01) { 8847 (0, _util.unreachable)("Should not call ColorSpace.getOutputLength"); 8848 } 8849 8850 isPassthrough(bits) { 8851 return false; 8852 } 8853 8854 isDefaultDecode(decodeMap, bpc) { 8855 return ColorSpace.isDefaultDecode(decodeMap, this.numComps); 8856 } 8857 8858 fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) { 8859 const count = originalWidth * originalHeight; 8860 let rgbBuf = null; 8861 const numComponentColors = 1 << bpc; 8862 const needsResizing = originalHeight !== height || originalWidth !== width; 8863 8864 if (this.isPassthrough(bpc)) { 8865 rgbBuf = comps; 8866 } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") { 8867 const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors); 8868 8869 for (let i = 0; i < numComponentColors; i++) { 8870 allColors[i] = i; 8871 } 8872 8873 const colorMap = new Uint8ClampedArray(numComponentColors * 3); 8874 this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0); 8875 8876 if (!needsResizing) { 8877 let destPos = 0; 8878 8879 for (let i = 0; i < count; ++i) { 8880 const key = comps[i] * 3; 8881 dest[destPos++] = colorMap[key]; 8882 dest[destPos++] = colorMap[key + 1]; 8883 dest[destPos++] = colorMap[key + 2]; 8884 destPos += alpha01; 8885 } 8886 } else { 8887 rgbBuf = new Uint8Array(count * 3); 8888 let rgbPos = 0; 8889 8890 for (let i = 0; i < count; ++i) { 8891 const key = comps[i] * 3; 8892 rgbBuf[rgbPos++] = colorMap[key]; 8893 rgbBuf[rgbPos++] = colorMap[key + 1]; 8894 rgbBuf[rgbPos++] = colorMap[key + 2]; 8895 } 8896 } 8897 } else { 8898 if (!needsResizing) { 8899 this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01); 8900 } else { 8901 rgbBuf = new Uint8ClampedArray(count * 3); 8902 this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0); 8903 } 8904 } 8905 8906 if (rgbBuf) { 8907 if (needsResizing) { 8908 resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01); 8909 } else { 8910 let destPos = 0, 8911 rgbPos = 0; 8912 8913 for (let i = 0, ii = width * actualHeight; i < ii; i++) { 8914 dest[destPos++] = rgbBuf[rgbPos++]; 8915 dest[destPos++] = rgbBuf[rgbPos++]; 8916 dest[destPos++] = rgbBuf[rgbPos++]; 8917 destPos += alpha01; 8918 } 8919 } 8920 } 8921 } 8922 8923 get usesZeroToOneRange() { 8924 return (0, _util.shadow)(this, "usesZeroToOneRange", true); 8925 } 8926 8927 static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) { 8928 if (!localColorSpaceCache) { 8929 throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.'); 8930 } 8931 8932 if (!parsedColorSpace) { 8933 throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.'); 8934 } 8935 8936 let csName, csRef; 8937 8938 if (cacheKey instanceof _primitives.Ref) { 8939 csRef = cacheKey; 8940 cacheKey = xref.fetch(cacheKey); 8941 } 8942 8943 if (cacheKey instanceof _primitives.Name) { 8944 csName = cacheKey.name; 8945 } 8946 8947 if (csName || csRef) { 8948 localColorSpaceCache.set(csName, csRef, parsedColorSpace); 8949 } 8950 } 8951 8952 static getCached(cacheKey, xref, localColorSpaceCache) { 8953 if (!localColorSpaceCache) { 8954 throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.'); 8955 } 8956 8957 if (cacheKey instanceof _primitives.Ref) { 8958 const localColorSpace = localColorSpaceCache.getByRef(cacheKey); 8959 8960 if (localColorSpace) { 8961 return localColorSpace; 8962 } 8963 8964 try { 8965 cacheKey = xref.fetch(cacheKey); 8966 } catch (ex) { 8967 if (ex instanceof _core_utils.MissingDataException) { 8968 throw ex; 8969 } 8970 } 8971 } 8972 8973 if (cacheKey instanceof _primitives.Name) { 8974 const localColorSpace = localColorSpaceCache.getByName(cacheKey.name); 8975 8976 if (localColorSpace) { 8977 return localColorSpace; 8978 } 8979 } 8980 8981 return null; 8982 } 8983 8984 static async parseAsync({ 8985 cs, 8986 xref, 8987 resources = null, 8988 pdfFunctionFactory, 8989 localColorSpaceCache 8990 }) { 8991 const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory); 8992 8993 this._cache(cs, xref, localColorSpaceCache, parsedColorSpace); 8994 8995 return parsedColorSpace; 8996 } 8997 8998 static parse({ 8999 cs, 9000 xref, 9001 resources = null, 9002 pdfFunctionFactory, 9003 localColorSpaceCache 9004 }) { 9005 const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache); 9006 9007 if (cachedColorSpace) { 9008 return cachedColorSpace; 9009 } 9010 9011 const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory); 9012 9013 this._cache(cs, xref, localColorSpaceCache, parsedColorSpace); 9014 9015 return parsedColorSpace; 9016 } 9017 9018 static _parse(cs, xref, resources = null, pdfFunctionFactory) { 9019 cs = xref.fetchIfRef(cs); 9020 9021 if (cs instanceof _primitives.Name) { 9022 switch (cs.name) { 9023 case "G": 9024 case "DeviceGray": 9025 return this.singletons.gray; 9026 9027 case "RGB": 9028 case "DeviceRGB": 9029 return this.singletons.rgb; 9030 9031 case "CMYK": 9032 case "DeviceCMYK": 9033 return this.singletons.cmyk; 9034 9035 case "Pattern": 9036 return new PatternCS(null); 9037 9038 default: 9039 if (resources instanceof _primitives.Dict) { 9040 const colorSpaces = resources.get("ColorSpace"); 9041 9042 if (colorSpaces instanceof _primitives.Dict) { 9043 const resourcesCS = colorSpaces.get(cs.name); 9044 9045 if (resourcesCS) { 9046 if (resourcesCS instanceof _primitives.Name) { 9047 return this._parse(resourcesCS, xref, resources, pdfFunctionFactory); 9048 } 9049 9050 cs = resourcesCS; 9051 break; 9052 } 9053 } 9054 } 9055 9056 throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`); 9057 } 9058 } 9059 9060 if (Array.isArray(cs)) { 9061 const mode = xref.fetchIfRef(cs[0]).name; 9062 let params, numComps, baseCS, whitePoint, blackPoint, gamma; 9063 9064 switch (mode) { 9065 case "G": 9066 case "DeviceGray": 9067 return this.singletons.gray; 9068 9069 case "RGB": 9070 case "DeviceRGB": 9071 return this.singletons.rgb; 9072 9073 case "CMYK": 9074 case "DeviceCMYK": 9075 return this.singletons.cmyk; 9076 9077 case "CalGray": 9078 params = xref.fetchIfRef(cs[1]); 9079 whitePoint = params.getArray("WhitePoint"); 9080 blackPoint = params.getArray("BlackPoint"); 9081 gamma = params.get("Gamma"); 9082 return new CalGrayCS(whitePoint, blackPoint, gamma); 9083 9084 case "CalRGB": 9085 params = xref.fetchIfRef(cs[1]); 9086 whitePoint = params.getArray("WhitePoint"); 9087 blackPoint = params.getArray("BlackPoint"); 9088 gamma = params.getArray("Gamma"); 9089 const matrix = params.getArray("Matrix"); 9090 return new CalRGBCS(whitePoint, blackPoint, gamma, matrix); 9091 9092 case "ICCBased": 9093 const stream = xref.fetchIfRef(cs[1]); 9094 const dict = stream.dict; 9095 numComps = dict.get("N"); 9096 const alt = dict.get("Alternate"); 9097 9098 if (alt) { 9099 const altCS = this._parse(alt, xref, resources, pdfFunctionFactory); 9100 9101 if (altCS.numComps === numComps) { 9102 return altCS; 9103 } 9104 9105 (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry."); 9106 } 9107 9108 if (numComps === 1) { 9109 return this.singletons.gray; 9110 } else if (numComps === 3) { 9111 return this.singletons.rgb; 9112 } else if (numComps === 4) { 9113 return this.singletons.cmyk; 9114 } 9115 9116 break; 9117 9118 case "Pattern": 9119 baseCS = cs[1] || null; 9120 9121 if (baseCS) { 9122 baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory); 9123 } 9124 9125 return new PatternCS(baseCS); 9126 9127 case "I": 9128 case "Indexed": 9129 baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory); 9130 const hiVal = xref.fetchIfRef(cs[2]) + 1; 9131 const lookup = xref.fetchIfRef(cs[3]); 9132 return new IndexedCS(baseCS, hiVal, lookup); 9133 9134 case "Separation": 9135 case "DeviceN": 9136 const name = xref.fetchIfRef(cs[1]); 9137 numComps = Array.isArray(name) ? name.length : 1; 9138 baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory); 9139 const tintFn = pdfFunctionFactory.create(cs[3]); 9140 return new AlternateCS(numComps, baseCS, tintFn); 9141 9142 case "Lab": 9143 params = xref.fetchIfRef(cs[1]); 9144 whitePoint = params.getArray("WhitePoint"); 9145 blackPoint = params.getArray("BlackPoint"); 9146 const range = params.getArray("Range"); 9147 return new LabCS(whitePoint, blackPoint, range); 9148 9149 default: 9150 throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`); 9151 } 9152 } 9153 9154 throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`); 9155 } 9156 9157 static isDefaultDecode(decode, numComps) { 9158 if (!Array.isArray(decode)) { 9159 return true; 9160 } 9161 9162 if (numComps * 2 !== decode.length) { 9163 (0, _util.warn)("The decode map is not the correct length"); 9164 return true; 9165 } 9166 9167 for (let i = 0, ii = decode.length; i < ii; i += 2) { 9168 if (decode[i] !== 0 || decode[i + 1] !== 1) { 9169 return false; 9170 } 9171 } 9172 9173 return true; 9174 } 9175 9176 static get singletons() { 9177 return (0, _util.shadow)(this, "singletons", { 9178 get gray() { 9179 return (0, _util.shadow)(this, "gray", new DeviceGrayCS()); 9180 }, 9181 9182 get rgb() { 9183 return (0, _util.shadow)(this, "rgb", new DeviceRgbCS()); 9184 }, 9185 9186 get cmyk() { 9187 return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS()); 9188 } 9189 9190 }); 9191 } 9192 9193} 9194 9195exports.ColorSpace = ColorSpace; 9196 9197class AlternateCS extends ColorSpace { 9198 constructor(numComps, base, tintFn) { 9199 super("Alternate", numComps); 9200 this.base = base; 9201 this.tintFn = tintFn; 9202 this.tmpBuf = new Float32Array(base.numComps); 9203 } 9204 9205 getRgbItem(src, srcOffset, dest, destOffset) { 9206 const tmpBuf = this.tmpBuf; 9207 this.tintFn(src, srcOffset, tmpBuf, 0); 9208 this.base.getRgbItem(tmpBuf, 0, dest, destOffset); 9209 } 9210 9211 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 9212 const tintFn = this.tintFn; 9213 const base = this.base; 9214 const scale = 1 / ((1 << bits) - 1); 9215 const baseNumComps = base.numComps; 9216 const usesZeroToOneRange = base.usesZeroToOneRange; 9217 const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0; 9218 let pos = isPassthrough ? destOffset : 0; 9219 const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count); 9220 const numComps = this.numComps; 9221 const scaled = new Float32Array(numComps); 9222 const tinted = new Float32Array(baseNumComps); 9223 let i, j; 9224 9225 for (i = 0; i < count; i++) { 9226 for (j = 0; j < numComps; j++) { 9227 scaled[j] = src[srcOffset++] * scale; 9228 } 9229 9230 tintFn(scaled, 0, tinted, 0); 9231 9232 if (usesZeroToOneRange) { 9233 for (j = 0; j < baseNumComps; j++) { 9234 baseBuf[pos++] = tinted[j] * 255; 9235 } 9236 } else { 9237 base.getRgbItem(tinted, 0, baseBuf, pos); 9238 pos += baseNumComps; 9239 } 9240 } 9241 9242 if (!isPassthrough) { 9243 base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01); 9244 } 9245 } 9246 9247 getOutputLength(inputLength, alpha01) { 9248 return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01); 9249 } 9250 9251} 9252 9253class PatternCS extends ColorSpace { 9254 constructor(baseCS) { 9255 super("Pattern", null); 9256 this.base = baseCS; 9257 } 9258 9259 isDefaultDecode(decodeMap, bpc) { 9260 (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode"); 9261 } 9262 9263} 9264 9265class IndexedCS extends ColorSpace { 9266 constructor(base, highVal, lookup) { 9267 super("Indexed", 1); 9268 this.base = base; 9269 this.highVal = highVal; 9270 const length = base.numComps * highVal; 9271 this.lookup = new Uint8Array(length); 9272 9273 if (lookup instanceof _base_stream.BaseStream) { 9274 const bytes = lookup.getBytes(length); 9275 this.lookup.set(bytes); 9276 } else if (typeof lookup === "string") { 9277 for (let i = 0; i < length; ++i) { 9278 this.lookup[i] = lookup.charCodeAt(i) & 0xff; 9279 } 9280 } else { 9281 throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`); 9282 } 9283 } 9284 9285 getRgbItem(src, srcOffset, dest, destOffset) { 9286 const numComps = this.base.numComps; 9287 const start = src[srcOffset] * numComps; 9288 this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0); 9289 } 9290 9291 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 9292 const base = this.base; 9293 const numComps = base.numComps; 9294 const outputDelta = base.getOutputLength(numComps, alpha01); 9295 const lookup = this.lookup; 9296 9297 for (let i = 0; i < count; ++i) { 9298 const lookupPos = src[srcOffset++] * numComps; 9299 base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01); 9300 destOffset += outputDelta; 9301 } 9302 } 9303 9304 getOutputLength(inputLength, alpha01) { 9305 return this.base.getOutputLength(inputLength * this.base.numComps, alpha01); 9306 } 9307 9308 isDefaultDecode(decodeMap, bpc) { 9309 if (!Array.isArray(decodeMap)) { 9310 return true; 9311 } 9312 9313 if (decodeMap.length !== 2) { 9314 (0, _util.warn)("Decode map length is not correct"); 9315 return true; 9316 } 9317 9318 if (!Number.isInteger(bpc) || bpc < 1) { 9319 (0, _util.warn)("Bits per component is not correct"); 9320 return true; 9321 } 9322 9323 return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1; 9324 } 9325 9326} 9327 9328class DeviceGrayCS extends ColorSpace { 9329 constructor() { 9330 super("DeviceGray", 1); 9331 } 9332 9333 getRgbItem(src, srcOffset, dest, destOffset) { 9334 const c = src[srcOffset] * 255; 9335 dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c; 9336 } 9337 9338 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 9339 const scale = 255 / ((1 << bits) - 1); 9340 let j = srcOffset, 9341 q = destOffset; 9342 9343 for (let i = 0; i < count; ++i) { 9344 const c = scale * src[j++]; 9345 dest[q++] = c; 9346 dest[q++] = c; 9347 dest[q++] = c; 9348 q += alpha01; 9349 } 9350 } 9351 9352 getOutputLength(inputLength, alpha01) { 9353 return inputLength * (3 + alpha01); 9354 } 9355 9356} 9357 9358class DeviceRgbCS extends ColorSpace { 9359 constructor() { 9360 super("DeviceRGB", 3); 9361 } 9362 9363 getRgbItem(src, srcOffset, dest, destOffset) { 9364 dest[destOffset] = src[srcOffset] * 255; 9365 dest[destOffset + 1] = src[srcOffset + 1] * 255; 9366 dest[destOffset + 2] = src[srcOffset + 2] * 255; 9367 } 9368 9369 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 9370 if (bits === 8 && alpha01 === 0) { 9371 dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset); 9372 return; 9373 } 9374 9375 const scale = 255 / ((1 << bits) - 1); 9376 let j = srcOffset, 9377 q = destOffset; 9378 9379 for (let i = 0; i < count; ++i) { 9380 dest[q++] = scale * src[j++]; 9381 dest[q++] = scale * src[j++]; 9382 dest[q++] = scale * src[j++]; 9383 q += alpha01; 9384 } 9385 } 9386 9387 getOutputLength(inputLength, alpha01) { 9388 return inputLength * (3 + alpha01) / 3 | 0; 9389 } 9390 9391 isPassthrough(bits) { 9392 return bits === 8; 9393 } 9394 9395} 9396 9397const DeviceCmykCS = function DeviceCmykCSClosure() { 9398 function convertToRgb(src, srcOffset, srcScale, dest, destOffset) { 9399 const c = src[srcOffset] * srcScale; 9400 const m = src[srcOffset + 1] * srcScale; 9401 const y = src[srcOffset + 2] * srcScale; 9402 const k = src[srcOffset + 3] * srcScale; 9403 dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747); 9404 dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578); 9405 dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367); 9406 } 9407 9408 class DeviceCmykCS extends ColorSpace { 9409 constructor() { 9410 super("DeviceCMYK", 4); 9411 } 9412 9413 getRgbItem(src, srcOffset, dest, destOffset) { 9414 convertToRgb(src, srcOffset, 1, dest, destOffset); 9415 } 9416 9417 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 9418 const scale = 1 / ((1 << bits) - 1); 9419 9420 for (let i = 0; i < count; i++) { 9421 convertToRgb(src, srcOffset, scale, dest, destOffset); 9422 srcOffset += 4; 9423 destOffset += 3 + alpha01; 9424 } 9425 } 9426 9427 getOutputLength(inputLength, alpha01) { 9428 return inputLength / 4 * (3 + alpha01) | 0; 9429 } 9430 9431 } 9432 9433 return DeviceCmykCS; 9434}(); 9435 9436const CalGrayCS = function CalGrayCSClosure() { 9437 function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { 9438 const A = src[srcOffset] * scale; 9439 const AG = A ** cs.G; 9440 const L = cs.YW * AG; 9441 const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0); 9442 dest[destOffset] = val; 9443 dest[destOffset + 1] = val; 9444 dest[destOffset + 2] = val; 9445 } 9446 9447 class CalGrayCS extends ColorSpace { 9448 constructor(whitePoint, blackPoint, gamma) { 9449 super("CalGray", 1); 9450 9451 if (!whitePoint) { 9452 throw new _util.FormatError("WhitePoint missing - required for color space CalGray"); 9453 } 9454 9455 blackPoint = blackPoint || [0, 0, 0]; 9456 gamma = gamma || 1; 9457 this.XW = whitePoint[0]; 9458 this.YW = whitePoint[1]; 9459 this.ZW = whitePoint[2]; 9460 this.XB = blackPoint[0]; 9461 this.YB = blackPoint[1]; 9462 this.ZB = blackPoint[2]; 9463 this.G = gamma; 9464 9465 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 9466 throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available"); 9467 } 9468 9469 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 9470 (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`); 9471 this.XB = this.YB = this.ZB = 0; 9472 } 9473 9474 if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) { 9475 (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`); 9476 } 9477 9478 if (this.G < 1) { 9479 (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default."); 9480 this.G = 1; 9481 } 9482 } 9483 9484 getRgbItem(src, srcOffset, dest, destOffset) { 9485 convertToRgb(this, src, srcOffset, dest, destOffset, 1); 9486 } 9487 9488 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 9489 const scale = 1 / ((1 << bits) - 1); 9490 9491 for (let i = 0; i < count; ++i) { 9492 convertToRgb(this, src, srcOffset, dest, destOffset, scale); 9493 srcOffset += 1; 9494 destOffset += 3 + alpha01; 9495 } 9496 } 9497 9498 getOutputLength(inputLength, alpha01) { 9499 return inputLength * (3 + alpha01); 9500 } 9501 9502 } 9503 9504 return CalGrayCS; 9505}(); 9506 9507const CalRGBCS = function CalRGBCSClosure() { 9508 const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]); 9509 const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]); 9510 const SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]); 9511 const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]); 9512 const tempNormalizeMatrix = new Float32Array(3); 9513 const tempConvertMatrix1 = new Float32Array(3); 9514 const tempConvertMatrix2 = new Float32Array(3); 9515 const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0; 9516 9517 function matrixProduct(a, b, result) { 9518 result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; 9519 result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2]; 9520 result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2]; 9521 } 9522 9523 function convertToFlat(sourceWhitePoint, LMS, result) { 9524 result[0] = LMS[0] * 1 / sourceWhitePoint[0]; 9525 result[1] = LMS[1] * 1 / sourceWhitePoint[1]; 9526 result[2] = LMS[2] * 1 / sourceWhitePoint[2]; 9527 } 9528 9529 function convertToD65(sourceWhitePoint, LMS, result) { 9530 const D65X = 0.95047; 9531 const D65Y = 1; 9532 const D65Z = 1.08883; 9533 result[0] = LMS[0] * D65X / sourceWhitePoint[0]; 9534 result[1] = LMS[1] * D65Y / sourceWhitePoint[1]; 9535 result[2] = LMS[2] * D65Z / sourceWhitePoint[2]; 9536 } 9537 9538 function sRGBTransferFunction(color) { 9539 if (color <= 0.0031308) { 9540 return adjustToRange(0, 1, 12.92 * color); 9541 } 9542 9543 if (color >= 0.99554525) { 9544 return 1; 9545 } 9546 9547 return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055); 9548 } 9549 9550 function adjustToRange(min, max, value) { 9551 return Math.max(min, Math.min(max, value)); 9552 } 9553 9554 function decodeL(L) { 9555 if (L < 0) { 9556 return -decodeL(-L); 9557 } 9558 9559 if (L > 8.0) { 9560 return ((L + 16) / 116) ** 3; 9561 } 9562 9563 return L * DECODE_L_CONSTANT; 9564 } 9565 9566 function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) { 9567 if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) { 9568 result[0] = XYZ_Flat[0]; 9569 result[1] = XYZ_Flat[1]; 9570 result[2] = XYZ_Flat[2]; 9571 return; 9572 } 9573 9574 const zeroDecodeL = decodeL(0); 9575 const X_DST = zeroDecodeL; 9576 const X_SRC = decodeL(sourceBlackPoint[0]); 9577 const Y_DST = zeroDecodeL; 9578 const Y_SRC = decodeL(sourceBlackPoint[1]); 9579 const Z_DST = zeroDecodeL; 9580 const Z_SRC = decodeL(sourceBlackPoint[2]); 9581 const X_Scale = (1 - X_DST) / (1 - X_SRC); 9582 const X_Offset = 1 - X_Scale; 9583 const Y_Scale = (1 - Y_DST) / (1 - Y_SRC); 9584 const Y_Offset = 1 - Y_Scale; 9585 const Z_Scale = (1 - Z_DST) / (1 - Z_SRC); 9586 const Z_Offset = 1 - Z_Scale; 9587 result[0] = XYZ_Flat[0] * X_Scale + X_Offset; 9588 result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset; 9589 result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset; 9590 } 9591 9592 function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) { 9593 if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) { 9594 result[0] = XYZ_In[0]; 9595 result[1] = XYZ_In[1]; 9596 result[2] = XYZ_In[2]; 9597 return; 9598 } 9599 9600 const LMS = result; 9601 matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 9602 const LMS_Flat = tempNormalizeMatrix; 9603 convertToFlat(sourceWhitePoint, LMS, LMS_Flat); 9604 matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result); 9605 } 9606 9607 function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) { 9608 const LMS = result; 9609 matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 9610 const LMS_D65 = tempNormalizeMatrix; 9611 convertToD65(sourceWhitePoint, LMS, LMS_D65); 9612 matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result); 9613 } 9614 9615 function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { 9616 const A = adjustToRange(0, 1, src[srcOffset] * scale); 9617 const B = adjustToRange(0, 1, src[srcOffset + 1] * scale); 9618 const C = adjustToRange(0, 1, src[srcOffset + 2] * scale); 9619 const AGR = A === 1 ? 1 : A ** cs.GR; 9620 const BGG = B === 1 ? 1 : B ** cs.GG; 9621 const CGB = C === 1 ? 1 : C ** cs.GB; 9622 const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB; 9623 const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB; 9624 const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB; 9625 const XYZ = tempConvertMatrix1; 9626 XYZ[0] = X; 9627 XYZ[1] = Y; 9628 XYZ[2] = Z; 9629 const XYZ_Flat = tempConvertMatrix2; 9630 normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat); 9631 const XYZ_Black = tempConvertMatrix1; 9632 compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black); 9633 const XYZ_D65 = tempConvertMatrix2; 9634 normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65); 9635 const SRGB = tempConvertMatrix1; 9636 matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB); 9637 dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255; 9638 dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255; 9639 dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255; 9640 } 9641 9642 class CalRGBCS extends ColorSpace { 9643 constructor(whitePoint, blackPoint, gamma, matrix) { 9644 super("CalRGB", 3); 9645 9646 if (!whitePoint) { 9647 throw new _util.FormatError("WhitePoint missing - required for color space CalRGB"); 9648 } 9649 9650 blackPoint = blackPoint || new Float32Array(3); 9651 gamma = gamma || new Float32Array([1, 1, 1]); 9652 matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]); 9653 const XW = whitePoint[0]; 9654 const YW = whitePoint[1]; 9655 const ZW = whitePoint[2]; 9656 this.whitePoint = whitePoint; 9657 const XB = blackPoint[0]; 9658 const YB = blackPoint[1]; 9659 const ZB = blackPoint[2]; 9660 this.blackPoint = blackPoint; 9661 this.GR = gamma[0]; 9662 this.GG = gamma[1]; 9663 this.GB = gamma[2]; 9664 this.MXA = matrix[0]; 9665 this.MYA = matrix[1]; 9666 this.MZA = matrix[2]; 9667 this.MXB = matrix[3]; 9668 this.MYB = matrix[4]; 9669 this.MZB = matrix[5]; 9670 this.MXC = matrix[6]; 9671 this.MYC = matrix[7]; 9672 this.MZC = matrix[8]; 9673 9674 if (XW < 0 || ZW < 0 || YW !== 1) { 9675 throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available"); 9676 } 9677 9678 if (XB < 0 || YB < 0 || ZB < 0) { 9679 (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default."); 9680 this.blackPoint = new Float32Array(3); 9681 } 9682 9683 if (this.GR < 0 || this.GG < 0 || this.GB < 0) { 9684 (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`); 9685 this.GR = this.GG = this.GB = 1; 9686 } 9687 } 9688 9689 getRgbItem(src, srcOffset, dest, destOffset) { 9690 convertToRgb(this, src, srcOffset, dest, destOffset, 1); 9691 } 9692 9693 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 9694 const scale = 1 / ((1 << bits) - 1); 9695 9696 for (let i = 0; i < count; ++i) { 9697 convertToRgb(this, src, srcOffset, dest, destOffset, scale); 9698 srcOffset += 3; 9699 destOffset += 3 + alpha01; 9700 } 9701 } 9702 9703 getOutputLength(inputLength, alpha01) { 9704 return inputLength * (3 + alpha01) / 3 | 0; 9705 } 9706 9707 } 9708 9709 return CalRGBCS; 9710}(); 9711 9712const LabCS = function LabCSClosure() { 9713 function fn_g(x) { 9714 let result; 9715 9716 if (x >= 6 / 29) { 9717 result = x ** 3; 9718 } else { 9719 result = 108 / 841 * (x - 4 / 29); 9720 } 9721 9722 return result; 9723 } 9724 9725 function decode(value, high1, low2, high2) { 9726 return low2 + value * (high2 - low2) / high1; 9727 } 9728 9729 function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) { 9730 let Ls = src[srcOffset]; 9731 let as = src[srcOffset + 1]; 9732 let bs = src[srcOffset + 2]; 9733 9734 if (maxVal !== false) { 9735 Ls = decode(Ls, maxVal, 0, 100); 9736 as = decode(as, maxVal, cs.amin, cs.amax); 9737 bs = decode(bs, maxVal, cs.bmin, cs.bmax); 9738 } 9739 9740 if (as > cs.amax) { 9741 as = cs.amax; 9742 } else if (as < cs.amin) { 9743 as = cs.amin; 9744 } 9745 9746 if (bs > cs.bmax) { 9747 bs = cs.bmax; 9748 } else if (bs < cs.bmin) { 9749 bs = cs.bmin; 9750 } 9751 9752 const M = (Ls + 16) / 116; 9753 const L = M + as / 500; 9754 const N = M - bs / 200; 9755 const X = cs.XW * fn_g(L); 9756 const Y = cs.YW * fn_g(M); 9757 const Z = cs.ZW * fn_g(N); 9758 let r, g, b; 9759 9760 if (cs.ZW < 1) { 9761 r = X * 3.1339 + Y * -1.617 + Z * -0.4906; 9762 g = X * -0.9785 + Y * 1.916 + Z * 0.0333; 9763 b = X * 0.072 + Y * -0.229 + Z * 1.4057; 9764 } else { 9765 r = X * 3.2406 + Y * -1.5372 + Z * -0.4986; 9766 g = X * -0.9689 + Y * 1.8758 + Z * 0.0415; 9767 b = X * 0.0557 + Y * -0.204 + Z * 1.057; 9768 } 9769 9770 dest[destOffset] = Math.sqrt(r) * 255; 9771 dest[destOffset + 1] = Math.sqrt(g) * 255; 9772 dest[destOffset + 2] = Math.sqrt(b) * 255; 9773 } 9774 9775 class LabCS extends ColorSpace { 9776 constructor(whitePoint, blackPoint, range) { 9777 super("Lab", 3); 9778 9779 if (!whitePoint) { 9780 throw new _util.FormatError("WhitePoint missing - required for color space Lab"); 9781 } 9782 9783 blackPoint = blackPoint || [0, 0, 0]; 9784 range = range || [-100, 100, -100, 100]; 9785 this.XW = whitePoint[0]; 9786 this.YW = whitePoint[1]; 9787 this.ZW = whitePoint[2]; 9788 this.amin = range[0]; 9789 this.amax = range[1]; 9790 this.bmin = range[2]; 9791 this.bmax = range[3]; 9792 this.XB = blackPoint[0]; 9793 this.YB = blackPoint[1]; 9794 this.ZB = blackPoint[2]; 9795 9796 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 9797 throw new _util.FormatError("Invalid WhitePoint components, no fallback available"); 9798 } 9799 9800 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 9801 (0, _util.info)("Invalid BlackPoint, falling back to default"); 9802 this.XB = this.YB = this.ZB = 0; 9803 } 9804 9805 if (this.amin > this.amax || this.bmin > this.bmax) { 9806 (0, _util.info)("Invalid Range, falling back to defaults"); 9807 this.amin = -100; 9808 this.amax = 100; 9809 this.bmin = -100; 9810 this.bmax = 100; 9811 } 9812 } 9813 9814 getRgbItem(src, srcOffset, dest, destOffset) { 9815 convertToRgb(this, src, srcOffset, false, dest, destOffset); 9816 } 9817 9818 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 9819 const maxVal = (1 << bits) - 1; 9820 9821 for (let i = 0; i < count; i++) { 9822 convertToRgb(this, src, srcOffset, maxVal, dest, destOffset); 9823 srcOffset += 3; 9824 destOffset += 3 + alpha01; 9825 } 9826 } 9827 9828 getOutputLength(inputLength, alpha01) { 9829 return inputLength * (3 + alpha01) / 3 | 0; 9830 } 9831 9832 isDefaultDecode(decodeMap, bpc) { 9833 return true; 9834 } 9835 9836 get usesZeroToOneRange() { 9837 return (0, _util.shadow)(this, "usesZeroToOneRange", false); 9838 } 9839 9840 } 9841 9842 return LabCS; 9843}(); 9844 9845/***/ }), 9846/* 15 */ 9847/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 9848 9849 9850 9851Object.defineProperty(exports, "__esModule", ({ 9852 value: true 9853})); 9854exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0; 9855 9856var _util = __w_pdfjs_require__(2); 9857 9858var _cmap = __w_pdfjs_require__(16); 9859 9860var _primitives = __w_pdfjs_require__(5); 9861 9862var _fonts = __w_pdfjs_require__(34); 9863 9864var _fonts_utils = __w_pdfjs_require__(38); 9865 9866var _encodings = __w_pdfjs_require__(37); 9867 9868var _standard_fonts = __w_pdfjs_require__(41); 9869 9870var _unicode = __w_pdfjs_require__(40); 9871 9872var _pattern = __w_pdfjs_require__(50); 9873 9874var _xfa_fonts = __w_pdfjs_require__(51); 9875 9876var _to_unicode_map = __w_pdfjs_require__(42); 9877 9878var _function = __w_pdfjs_require__(57); 9879 9880var _parser = __w_pdfjs_require__(17); 9881 9882var _image_utils = __w_pdfjs_require__(59); 9883 9884var _stream = __w_pdfjs_require__(10); 9885 9886var _base_stream = __w_pdfjs_require__(7); 9887 9888var _bidi = __w_pdfjs_require__(60); 9889 9890var _colorspace = __w_pdfjs_require__(14); 9891 9892var _decode_stream = __w_pdfjs_require__(19); 9893 9894var _glyphlist = __w_pdfjs_require__(39); 9895 9896var _core_utils = __w_pdfjs_require__(6); 9897 9898var _metrics = __w_pdfjs_require__(45); 9899 9900var _murmurhash = __w_pdfjs_require__(61); 9901 9902var _operator_list = __w_pdfjs_require__(62); 9903 9904var _image = __w_pdfjs_require__(63); 9905 9906const DefaultPartialEvaluatorOptions = Object.freeze({ 9907 maxImageSize: -1, 9908 disableFontFace: false, 9909 ignoreErrors: false, 9910 isEvalSupported: true, 9911 fontExtraProperties: false, 9912 useSystemFonts: true, 9913 cMapUrl: null, 9914 standardFontDataUrl: null 9915}); 9916const PatternType = { 9917 TILING: 1, 9918 SHADING: 2 9919}; 9920const TEXT_CHUNK_BATCH_SIZE = 10; 9921const deferred = Promise.resolve(); 9922 9923function normalizeBlendMode(value, parsingArray = false) { 9924 if (Array.isArray(value)) { 9925 for (let i = 0, ii = value.length; i < ii; i++) { 9926 const maybeBM = normalizeBlendMode(value[i], true); 9927 9928 if (maybeBM) { 9929 return maybeBM; 9930 } 9931 } 9932 9933 (0, _util.warn)(`Unsupported blend mode Array: ${value}`); 9934 return "source-over"; 9935 } 9936 9937 if (!(value instanceof _primitives.Name)) { 9938 if (parsingArray) { 9939 return null; 9940 } 9941 9942 return "source-over"; 9943 } 9944 9945 switch (value.name) { 9946 case "Normal": 9947 case "Compatible": 9948 return "source-over"; 9949 9950 case "Multiply": 9951 return "multiply"; 9952 9953 case "Screen": 9954 return "screen"; 9955 9956 case "Overlay": 9957 return "overlay"; 9958 9959 case "Darken": 9960 return "darken"; 9961 9962 case "Lighten": 9963 return "lighten"; 9964 9965 case "ColorDodge": 9966 return "color-dodge"; 9967 9968 case "ColorBurn": 9969 return "color-burn"; 9970 9971 case "HardLight": 9972 return "hard-light"; 9973 9974 case "SoftLight": 9975 return "soft-light"; 9976 9977 case "Difference": 9978 return "difference"; 9979 9980 case "Exclusion": 9981 return "exclusion"; 9982 9983 case "Hue": 9984 return "hue"; 9985 9986 case "Saturation": 9987 return "saturation"; 9988 9989 case "Color": 9990 return "color"; 9991 9992 case "Luminosity": 9993 return "luminosity"; 9994 } 9995 9996 if (parsingArray) { 9997 return null; 9998 } 9999 10000 (0, _util.warn)(`Unsupported blend mode: ${value.name}`); 10001 return "source-over"; 10002} 10003 10004function incrementCachedImageMaskCount(data) { 10005 if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) { 10006 data.args[0].count++; 10007 } 10008} 10009 10010class TimeSlotManager { 10011 static get TIME_SLOT_DURATION_MS() { 10012 return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20); 10013 } 10014 10015 static get CHECK_TIME_EVERY() { 10016 return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100); 10017 } 10018 10019 constructor() { 10020 this.reset(); 10021 } 10022 10023 check() { 10024 if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) { 10025 return false; 10026 } 10027 10028 this.checked = 0; 10029 return this.endTime <= Date.now(); 10030 } 10031 10032 reset() { 10033 this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS; 10034 this.checked = 0; 10035 } 10036 10037} 10038 10039class PartialEvaluator { 10040 constructor({ 10041 xref, 10042 handler, 10043 pageIndex, 10044 idFactory, 10045 fontCache, 10046 builtInCMapCache, 10047 standardFontDataCache, 10048 globalImageCache, 10049 options = null 10050 }) { 10051 this.xref = xref; 10052 this.handler = handler; 10053 this.pageIndex = pageIndex; 10054 this.idFactory = idFactory; 10055 this.fontCache = fontCache; 10056 this.builtInCMapCache = builtInCMapCache; 10057 this.standardFontDataCache = standardFontDataCache; 10058 this.globalImageCache = globalImageCache; 10059 this.options = options || DefaultPartialEvaluatorOptions; 10060 this.parsingType3Font = false; 10061 this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this); 10062 } 10063 10064 get _pdfFunctionFactory() { 10065 const pdfFunctionFactory = new _function.PDFFunctionFactory({ 10066 xref: this.xref, 10067 isEvalSupported: this.options.isEvalSupported 10068 }); 10069 return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory); 10070 } 10071 10072 clone(newOptions = null) { 10073 const newEvaluator = Object.create(this); 10074 newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions); 10075 return newEvaluator; 10076 } 10077 10078 hasBlendModes(resources, nonBlendModesSet) { 10079 if (!(resources instanceof _primitives.Dict)) { 10080 return false; 10081 } 10082 10083 if (resources.objId && nonBlendModesSet.has(resources.objId)) { 10084 return false; 10085 } 10086 10087 const processed = new _primitives.RefSet(nonBlendModesSet); 10088 10089 if (resources.objId) { 10090 processed.put(resources.objId); 10091 } 10092 10093 const nodes = [resources], 10094 xref = this.xref; 10095 10096 while (nodes.length) { 10097 const node = nodes.shift(); 10098 const graphicStates = node.get("ExtGState"); 10099 10100 if (graphicStates instanceof _primitives.Dict) { 10101 for (let graphicState of graphicStates.getRawValues()) { 10102 if (graphicState instanceof _primitives.Ref) { 10103 if (processed.has(graphicState)) { 10104 continue; 10105 } 10106 10107 try { 10108 graphicState = xref.fetch(graphicState); 10109 } catch (ex) { 10110 processed.put(graphicState); 10111 (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`); 10112 continue; 10113 } 10114 } 10115 10116 if (!(graphicState instanceof _primitives.Dict)) { 10117 continue; 10118 } 10119 10120 if (graphicState.objId) { 10121 processed.put(graphicState.objId); 10122 } 10123 10124 const bm = graphicState.get("BM"); 10125 10126 if (bm instanceof _primitives.Name) { 10127 if (bm.name !== "Normal") { 10128 return true; 10129 } 10130 10131 continue; 10132 } 10133 10134 if (bm !== undefined && Array.isArray(bm)) { 10135 for (const element of bm) { 10136 if (element instanceof _primitives.Name && element.name !== "Normal") { 10137 return true; 10138 } 10139 } 10140 } 10141 } 10142 } 10143 10144 const xObjects = node.get("XObject"); 10145 10146 if (!(xObjects instanceof _primitives.Dict)) { 10147 continue; 10148 } 10149 10150 for (let xObject of xObjects.getRawValues()) { 10151 if (xObject instanceof _primitives.Ref) { 10152 if (processed.has(xObject)) { 10153 continue; 10154 } 10155 10156 try { 10157 xObject = xref.fetch(xObject); 10158 } catch (ex) { 10159 processed.put(xObject); 10160 (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`); 10161 continue; 10162 } 10163 } 10164 10165 if (!(xObject instanceof _base_stream.BaseStream)) { 10166 continue; 10167 } 10168 10169 if (xObject.dict.objId) { 10170 processed.put(xObject.dict.objId); 10171 } 10172 10173 const xResources = xObject.dict.get("Resources"); 10174 10175 if (!(xResources instanceof _primitives.Dict)) { 10176 continue; 10177 } 10178 10179 if (xResources.objId && processed.has(xResources.objId)) { 10180 continue; 10181 } 10182 10183 nodes.push(xResources); 10184 10185 if (xResources.objId) { 10186 processed.put(xResources.objId); 10187 } 10188 } 10189 } 10190 10191 for (const ref of processed) { 10192 nonBlendModesSet.put(ref); 10193 } 10194 10195 return false; 10196 } 10197 10198 async fetchBuiltInCMap(name) { 10199 const cachedData = this.builtInCMapCache.get(name); 10200 10201 if (cachedData) { 10202 return cachedData; 10203 } 10204 10205 let data; 10206 10207 if (this.options.cMapUrl !== null) { 10208 const url = `${this.options.cMapUrl}${name}.bcmap`; 10209 const response = await fetch(url); 10210 10211 if (!response.ok) { 10212 throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`); 10213 } 10214 10215 data = { 10216 cMapData: new Uint8Array(await response.arrayBuffer()), 10217 compressionType: _util.CMapCompressionType.BINARY 10218 }; 10219 } else { 10220 data = await this.handler.sendWithPromise("FetchBuiltInCMap", { 10221 name 10222 }); 10223 } 10224 10225 if (data.compressionType !== _util.CMapCompressionType.NONE) { 10226 this.builtInCMapCache.set(name, data); 10227 } 10228 10229 return data; 10230 } 10231 10232 async fetchStandardFontData(name) { 10233 const cachedData = this.standardFontDataCache.get(name); 10234 10235 if (cachedData) { 10236 return new _stream.Stream(cachedData); 10237 } 10238 10239 if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") { 10240 return null; 10241 } 10242 10243 const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(), 10244 filename = standardFontNameToFileName[name]; 10245 let data; 10246 10247 if (this.options.standardFontDataUrl !== null) { 10248 const url = `${this.options.standardFontDataUrl}${filename}`; 10249 const response = await fetch(url); 10250 10251 if (!response.ok) { 10252 (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`); 10253 } else { 10254 data = await response.arrayBuffer(); 10255 } 10256 } else { 10257 try { 10258 data = await this.handler.sendWithPromise("FetchStandardFontData", { 10259 filename 10260 }); 10261 } catch (e) { 10262 (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`); 10263 } 10264 } 10265 10266 if (!data) { 10267 return null; 10268 } 10269 10270 this.standardFontDataCache.set(name, data); 10271 return new _stream.Stream(data); 10272 } 10273 10274 async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) { 10275 const dict = xobj.dict; 10276 const matrix = dict.getArray("Matrix"); 10277 let bbox = dict.getArray("BBox"); 10278 10279 if (Array.isArray(bbox) && bbox.length === 4) { 10280 bbox = _util.Util.normalizeRect(bbox); 10281 } else { 10282 bbox = null; 10283 } 10284 10285 let optionalContent, groupOptions; 10286 10287 if (dict.has("OC")) { 10288 optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources); 10289 } 10290 10291 if (optionalContent !== undefined) { 10292 operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]); 10293 } 10294 10295 const group = dict.get("Group"); 10296 10297 if (group) { 10298 groupOptions = { 10299 matrix, 10300 bbox, 10301 smask, 10302 isolated: false, 10303 knockout: false 10304 }; 10305 const groupSubtype = group.get("S"); 10306 let colorSpace = null; 10307 10308 if ((0, _primitives.isName)(groupSubtype, "Transparency")) { 10309 groupOptions.isolated = group.get("I") || false; 10310 groupOptions.knockout = group.get("K") || false; 10311 10312 if (group.has("CS")) { 10313 const cs = group.getRaw("CS"); 10314 10315 const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache); 10316 10317 if (cachedColorSpace) { 10318 colorSpace = cachedColorSpace; 10319 } else { 10320 colorSpace = await this.parseColorSpace({ 10321 cs, 10322 resources, 10323 localColorSpaceCache 10324 }); 10325 } 10326 } 10327 } 10328 10329 if (smask && smask.backdrop) { 10330 colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb; 10331 smask.backdrop = colorSpace.getRgb(smask.backdrop, 0); 10332 } 10333 10334 operatorList.addOp(_util.OPS.beginGroup, [groupOptions]); 10335 } 10336 10337 const args = group ? [matrix, null] : [matrix, bbox]; 10338 operatorList.addOp(_util.OPS.paintFormXObjectBegin, args); 10339 return this.getOperatorList({ 10340 stream: xobj, 10341 task, 10342 resources: dict.get("Resources") || resources, 10343 operatorList, 10344 initialState 10345 }).then(function () { 10346 operatorList.addOp(_util.OPS.paintFormXObjectEnd, []); 10347 10348 if (group) { 10349 operatorList.addOp(_util.OPS.endGroup, [groupOptions]); 10350 } 10351 10352 if (optionalContent !== undefined) { 10353 operatorList.addOp(_util.OPS.endMarkedContent, []); 10354 } 10355 }); 10356 } 10357 10358 _sendImgData(objId, imgData, cacheGlobally = false) { 10359 const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null; 10360 10361 if (this.parsingType3Font || cacheGlobally) { 10362 return this.handler.send("commonobj", [objId, "Image", imgData], transfers); 10363 } 10364 10365 return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers); 10366 } 10367 10368 async buildPaintImageXObject({ 10369 resources, 10370 image, 10371 isInline = false, 10372 operatorList, 10373 cacheKey, 10374 localImageCache, 10375 localColorSpaceCache 10376 }) { 10377 const dict = image.dict; 10378 const imageRef = dict.objId; 10379 const w = dict.get("W", "Width"); 10380 const h = dict.get("H", "Height"); 10381 10382 if (!(w && typeof w === "number") || !(h && typeof h === "number")) { 10383 (0, _util.warn)("Image dimensions are missing, or not numbers."); 10384 return; 10385 } 10386 10387 const maxImageSize = this.options.maxImageSize; 10388 10389 if (maxImageSize !== -1 && w * h > maxImageSize) { 10390 const msg = "Image exceeded maximum allowed size and was removed."; 10391 10392 if (this.options.ignoreErrors) { 10393 (0, _util.warn)(msg); 10394 return; 10395 } 10396 10397 throw new Error(msg); 10398 } 10399 10400 let optionalContent; 10401 10402 if (dict.has("OC")) { 10403 optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources); 10404 } 10405 10406 const imageMask = dict.get("IM", "ImageMask") || false; 10407 let imgData, args; 10408 10409 if (imageMask) { 10410 const interpolate = dict.get("I", "Interpolate"); 10411 const bitStrideLength = w + 7 >> 3; 10412 const imgArray = image.getBytes(bitStrideLength * h); 10413 const decode = dict.getArray("D", "Decode"); 10414 10415 if (this.parsingType3Font) { 10416 imgData = _image.PDFImage.createRawMask({ 10417 imgArray, 10418 width: w, 10419 height: h, 10420 imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream, 10421 inverseDecode: !!decode && decode[0] > 0, 10422 interpolate 10423 }); 10424 imgData.cached = !!cacheKey; 10425 args = [imgData]; 10426 operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent); 10427 10428 if (cacheKey) { 10429 localImageCache.set(cacheKey, imageRef, { 10430 fn: _util.OPS.paintImageMaskXObject, 10431 args, 10432 optionalContent 10433 }); 10434 } 10435 10436 return; 10437 } 10438 10439 imgData = _image.PDFImage.createMask({ 10440 imgArray, 10441 width: w, 10442 height: h, 10443 imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream, 10444 inverseDecode: !!decode && decode[0] > 0, 10445 interpolate 10446 }); 10447 10448 if (imgData.isSingleOpaquePixel) { 10449 operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent); 10450 10451 if (cacheKey) { 10452 localImageCache.set(cacheKey, imageRef, { 10453 fn: _util.OPS.paintSolidColorImageMask, 10454 args: [], 10455 optionalContent 10456 }); 10457 } 10458 10459 return; 10460 } 10461 10462 const objId = `mask_${this.idFactory.createObjId()}`; 10463 operatorList.addDependency(objId); 10464 10465 this._sendImgData(objId, imgData); 10466 10467 args = [{ 10468 data: objId, 10469 width: imgData.width, 10470 height: imgData.height, 10471 interpolate: imgData.interpolate, 10472 count: 1 10473 }]; 10474 operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent); 10475 10476 if (cacheKey) { 10477 localImageCache.set(cacheKey, imageRef, { 10478 fn: _util.OPS.paintImageMaskXObject, 10479 args, 10480 optionalContent 10481 }); 10482 } 10483 10484 return; 10485 } 10486 10487 const softMask = dict.get("SM", "SMask") || false; 10488 const mask = dict.get("Mask") || false; 10489 const SMALL_IMAGE_DIMENSIONS = 200; 10490 10491 if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) { 10492 const imageObj = new _image.PDFImage({ 10493 xref: this.xref, 10494 res: resources, 10495 image, 10496 isInline, 10497 pdfFunctionFactory: this._pdfFunctionFactory, 10498 localColorSpaceCache 10499 }); 10500 imgData = imageObj.createImageData(true); 10501 operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent); 10502 return; 10503 } 10504 10505 let objId = `img_${this.idFactory.createObjId()}`, 10506 cacheGlobally = false; 10507 10508 if (this.parsingType3Font) { 10509 objId = `${this.idFactory.getDocId()}_type3_${objId}`; 10510 } else if (imageRef) { 10511 cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex); 10512 10513 if (cacheGlobally) { 10514 objId = `${this.idFactory.getDocId()}_${objId}`; 10515 } 10516 } 10517 10518 operatorList.addDependency(objId); 10519 args = [objId, w, h]; 10520 10521 _image.PDFImage.buildImage({ 10522 xref: this.xref, 10523 res: resources, 10524 image, 10525 isInline, 10526 pdfFunctionFactory: this._pdfFunctionFactory, 10527 localColorSpaceCache 10528 }).then(imageObj => { 10529 imgData = imageObj.createImageData(false); 10530 10531 if (cacheKey && imageRef && cacheGlobally) { 10532 this.globalImageCache.addByteSize(imageRef, imgData.data.length); 10533 } 10534 10535 return this._sendImgData(objId, imgData, cacheGlobally); 10536 }).catch(reason => { 10537 (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`); 10538 return this._sendImgData(objId, null, cacheGlobally); 10539 }); 10540 10541 operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent); 10542 10543 if (cacheKey) { 10544 localImageCache.set(cacheKey, imageRef, { 10545 fn: _util.OPS.paintImageXObject, 10546 args, 10547 optionalContent 10548 }); 10549 10550 if (imageRef) { 10551 (0, _util.assert)(!isInline, "Cannot cache an inline image globally."); 10552 this.globalImageCache.addPageIndex(imageRef, this.pageIndex); 10553 10554 if (cacheGlobally) { 10555 this.globalImageCache.setData(imageRef, { 10556 objId, 10557 fn: _util.OPS.paintImageXObject, 10558 args, 10559 optionalContent, 10560 byteSize: 0 10561 }); 10562 } 10563 } 10564 } 10565 } 10566 10567 handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) { 10568 const smaskContent = smask.get("G"); 10569 const smaskOptions = { 10570 subtype: smask.get("S").name, 10571 backdrop: smask.get("BC") 10572 }; 10573 const transferObj = smask.get("TR"); 10574 10575 if ((0, _function.isPDFFunction)(transferObj)) { 10576 const transferFn = this._pdfFunctionFactory.create(transferObj); 10577 10578 const transferMap = new Uint8Array(256); 10579 const tmp = new Float32Array(1); 10580 10581 for (let i = 0; i < 256; i++) { 10582 tmp[0] = i / 255; 10583 transferFn(tmp, 0, tmp, 0); 10584 transferMap[i] = tmp[0] * 255 | 0; 10585 } 10586 10587 smaskOptions.transferMap = transferMap; 10588 } 10589 10590 return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache); 10591 } 10592 10593 handleTransferFunction(tr) { 10594 let transferArray; 10595 10596 if (Array.isArray(tr)) { 10597 transferArray = tr; 10598 } else if ((0, _function.isPDFFunction)(tr)) { 10599 transferArray = [tr]; 10600 } else { 10601 return null; 10602 } 10603 10604 const transferMaps = []; 10605 let numFns = 0, 10606 numEffectfulFns = 0; 10607 10608 for (const entry of transferArray) { 10609 const transferObj = this.xref.fetchIfRef(entry); 10610 numFns++; 10611 10612 if ((0, _primitives.isName)(transferObj, "Identity")) { 10613 transferMaps.push(null); 10614 continue; 10615 } else if (!(0, _function.isPDFFunction)(transferObj)) { 10616 return null; 10617 } 10618 10619 const transferFn = this._pdfFunctionFactory.create(transferObj); 10620 10621 const transferMap = new Uint8Array(256), 10622 tmp = new Float32Array(1); 10623 10624 for (let j = 0; j < 256; j++) { 10625 tmp[0] = j / 255; 10626 transferFn(tmp, 0, tmp, 0); 10627 transferMap[j] = tmp[0] * 255 | 0; 10628 } 10629 10630 transferMaps.push(transferMap); 10631 numEffectfulFns++; 10632 } 10633 10634 if (!(numFns === 1 || numFns === 4)) { 10635 return null; 10636 } 10637 10638 if (numEffectfulFns === 0) { 10639 return null; 10640 } 10641 10642 return transferMaps; 10643 } 10644 10645 handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) { 10646 const tilingOpList = new _operator_list.OperatorList(); 10647 10648 const patternResources = _primitives.Dict.merge({ 10649 xref: this.xref, 10650 dictArray: [patternDict.get("Resources"), resources] 10651 }); 10652 10653 return this.getOperatorList({ 10654 stream: pattern, 10655 task, 10656 resources: patternResources, 10657 operatorList: tilingOpList 10658 }).then(function () { 10659 const operatorListIR = tilingOpList.getIR(); 10660 const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color); 10661 operatorList.addDependencies(tilingOpList.dependencies); 10662 operatorList.addOp(fn, tilingPatternIR); 10663 10664 if (patternDict.objId) { 10665 localTilingPatternCache.set(null, patternDict.objId, { 10666 operatorListIR, 10667 dict: patternDict 10668 }); 10669 } 10670 }).catch(reason => { 10671 if (reason instanceof _util.AbortException) { 10672 return; 10673 } 10674 10675 if (this.options.ignoreErrors) { 10676 this.handler.send("UnsupportedFeature", { 10677 featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern 10678 }); 10679 (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`); 10680 return; 10681 } 10682 10683 throw reason; 10684 }); 10685 } 10686 10687 handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) { 10688 const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null; 10689 return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => { 10690 if (!translated.font.isType3Font) { 10691 return translated; 10692 } 10693 10694 return translated.loadType3Data(this, resources, task).then(function () { 10695 operatorList.addDependencies(translated.type3Dependencies); 10696 return translated; 10697 }).catch(reason => { 10698 this.handler.send("UnsupportedFeature", { 10699 featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3 10700 }); 10701 return new TranslatedFont({ 10702 loadedName: "g_font_error", 10703 font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`), 10704 dict: translated.font, 10705 evaluatorOptions: this.options 10706 }); 10707 }); 10708 }).then(translated => { 10709 state.font = translated.font; 10710 translated.send(this.handler); 10711 return translated.loadedName; 10712 }); 10713 } 10714 10715 handleText(chars, state) { 10716 const font = state.font; 10717 const glyphs = font.charsToGlyphs(chars); 10718 10719 if (font.data) { 10720 const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG); 10721 10722 if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) { 10723 PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options); 10724 } 10725 } 10726 10727 return glyphs; 10728 } 10729 10730 ensureStateFont(state) { 10731 if (state.font) { 10732 return; 10733 } 10734 10735 const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator."); 10736 10737 if (this.options.ignoreErrors) { 10738 this.handler.send("UnsupportedFeature", { 10739 featureId: _util.UNSUPPORTED_FEATURES.errorFontState 10740 }); 10741 (0, _util.warn)(`ensureStateFont: "${reason}".`); 10742 return; 10743 } 10744 10745 throw reason; 10746 } 10747 10748 async setGState({ 10749 resources, 10750 gState, 10751 operatorList, 10752 cacheKey, 10753 task, 10754 stateManager, 10755 localGStateCache, 10756 localColorSpaceCache 10757 }) { 10758 const gStateRef = gState.objId; 10759 let isSimpleGState = true; 10760 const gStateObj = []; 10761 const gStateKeys = gState.getKeys(); 10762 let promise = Promise.resolve(); 10763 10764 for (let i = 0, ii = gStateKeys.length; i < ii; i++) { 10765 const key = gStateKeys[i]; 10766 const value = gState.get(key); 10767 10768 switch (key) { 10769 case "Type": 10770 break; 10771 10772 case "LW": 10773 case "LC": 10774 case "LJ": 10775 case "ML": 10776 case "D": 10777 case "RI": 10778 case "FL": 10779 case "CA": 10780 case "ca": 10781 gStateObj.push([key, value]); 10782 break; 10783 10784 case "Font": 10785 isSimpleGState = false; 10786 promise = promise.then(() => { 10787 return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) { 10788 operatorList.addDependency(loadedName); 10789 gStateObj.push([key, [loadedName, value[1]]]); 10790 }); 10791 }); 10792 break; 10793 10794 case "BM": 10795 gStateObj.push([key, normalizeBlendMode(value)]); 10796 break; 10797 10798 case "SMask": 10799 if ((0, _primitives.isName)(value, "None")) { 10800 gStateObj.push([key, false]); 10801 break; 10802 } 10803 10804 if (value instanceof _primitives.Dict) { 10805 isSimpleGState = false; 10806 promise = promise.then(() => { 10807 return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache); 10808 }); 10809 gStateObj.push([key, true]); 10810 } else { 10811 (0, _util.warn)("Unsupported SMask type"); 10812 } 10813 10814 break; 10815 10816 case "TR": 10817 const transferMaps = this.handleTransferFunction(value); 10818 gStateObj.push([key, transferMaps]); 10819 break; 10820 10821 case "OP": 10822 case "op": 10823 case "OPM": 10824 case "BG": 10825 case "BG2": 10826 case "UCR": 10827 case "UCR2": 10828 case "TR2": 10829 case "HT": 10830 case "SM": 10831 case "SA": 10832 case "AIS": 10833 case "TK": 10834 (0, _util.info)("graphic state operator " + key); 10835 break; 10836 10837 default: 10838 (0, _util.info)("Unknown graphic state operator " + key); 10839 break; 10840 } 10841 } 10842 10843 return promise.then(function () { 10844 if (gStateObj.length > 0) { 10845 operatorList.addOp(_util.OPS.setGState, [gStateObj]); 10846 } 10847 10848 if (isSimpleGState) { 10849 localGStateCache.set(cacheKey, gStateRef, gStateObj); 10850 } 10851 }); 10852 } 10853 10854 loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) { 10855 const errorFont = async () => { 10856 return new TranslatedFont({ 10857 loadedName: "g_font_error", 10858 font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`), 10859 dict: font, 10860 evaluatorOptions: this.options 10861 }); 10862 }; 10863 10864 const xref = this.xref; 10865 let fontRef; 10866 10867 if (font) { 10868 if (font instanceof _primitives.Ref) { 10869 fontRef = font; 10870 } 10871 } else { 10872 const fontRes = resources.get("Font"); 10873 10874 if (fontRes) { 10875 fontRef = fontRes.getRaw(fontName); 10876 } 10877 } 10878 10879 if (!fontRef) { 10880 const partialMsg = `Font "${fontName || font && font.toString()}" is not available`; 10881 10882 if (!this.options.ignoreErrors && !this.parsingType3Font) { 10883 (0, _util.warn)(`${partialMsg}.`); 10884 return errorFont(); 10885 } 10886 10887 this.handler.send("UnsupportedFeature", { 10888 featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing 10889 }); 10890 (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`); 10891 10892 if (fallbackFontDict) { 10893 fontRef = fallbackFontDict; 10894 } else { 10895 fontRef = PartialEvaluator.fallbackFontDict; 10896 } 10897 } 10898 10899 if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) { 10900 return errorFont(); 10901 } 10902 10903 if (this.fontCache.has(fontRef)) { 10904 return this.fontCache.get(fontRef); 10905 } 10906 10907 font = xref.fetchIfRef(fontRef); 10908 10909 if (!(font instanceof _primitives.Dict)) { 10910 return errorFont(); 10911 } 10912 10913 if (font.cacheKey && this.fontCache.has(font.cacheKey)) { 10914 return this.fontCache.get(font.cacheKey); 10915 } 10916 10917 const fontCapability = (0, _util.createPromiseCapability)(); 10918 let preEvaluatedFont; 10919 10920 try { 10921 preEvaluatedFont = this.preEvaluateFont(font); 10922 preEvaluatedFont.cssFontInfo = cssFontInfo; 10923 } catch (reason) { 10924 (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`); 10925 return errorFont(); 10926 } 10927 10928 const { 10929 descriptor, 10930 hash 10931 } = preEvaluatedFont; 10932 const fontRefIsRef = fontRef instanceof _primitives.Ref; 10933 let fontID; 10934 10935 if (fontRefIsRef) { 10936 fontID = `f${fontRef.toString()}`; 10937 } 10938 10939 if (hash && descriptor instanceof _primitives.Dict) { 10940 if (!descriptor.fontAliases) { 10941 descriptor.fontAliases = Object.create(null); 10942 } 10943 10944 const fontAliases = descriptor.fontAliases; 10945 10946 if (fontAliases[hash]) { 10947 const aliasFontRef = fontAliases[hash].aliasRef; 10948 10949 if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) { 10950 this.fontCache.putAlias(fontRef, aliasFontRef); 10951 return this.fontCache.get(fontRef); 10952 } 10953 } else { 10954 fontAliases[hash] = { 10955 fontID: this.idFactory.createFontId() 10956 }; 10957 } 10958 10959 if (fontRefIsRef) { 10960 fontAliases[hash].aliasRef = fontRef; 10961 } 10962 10963 fontID = fontAliases[hash].fontID; 10964 } 10965 10966 if (fontRefIsRef) { 10967 this.fontCache.put(fontRef, fontCapability.promise); 10968 } else { 10969 if (!fontID) { 10970 fontID = this.idFactory.createFontId(); 10971 } 10972 10973 font.cacheKey = `cacheKey_${fontID}`; 10974 this.fontCache.put(font.cacheKey, fontCapability.promise); 10975 } 10976 10977 (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.'); 10978 font.loadedName = `${this.idFactory.getDocId()}_${fontID}`; 10979 this.translateFont(preEvaluatedFont).then(translatedFont => { 10980 if (translatedFont.fontType !== undefined) { 10981 xref.stats.addFontType(translatedFont.fontType); 10982 } 10983 10984 fontCapability.resolve(new TranslatedFont({ 10985 loadedName: font.loadedName, 10986 font: translatedFont, 10987 dict: font, 10988 evaluatorOptions: this.options 10989 })); 10990 }).catch(reason => { 10991 this.handler.send("UnsupportedFeature", { 10992 featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate 10993 }); 10994 (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`); 10995 10996 try { 10997 const fontFile3 = descriptor && descriptor.get("FontFile3"); 10998 const subtype = fontFile3 && fontFile3.get("Subtype"); 10999 const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name); 11000 11001 if (fontType !== undefined) { 11002 xref.stats.addFontType(fontType); 11003 } 11004 } catch (ex) {} 11005 11006 fontCapability.resolve(new TranslatedFont({ 11007 loadedName: font.loadedName, 11008 font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason), 11009 dict: font, 11010 evaluatorOptions: this.options 11011 })); 11012 }); 11013 return fontCapability.promise; 11014 } 11015 11016 buildPath(operatorList, fn, args, parsingText = false) { 11017 const lastIndex = operatorList.length - 1; 11018 11019 if (!args) { 11020 args = []; 11021 } 11022 11023 let minMax; 11024 11025 if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) { 11026 if (parsingText) { 11027 (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`); 11028 operatorList.addOp(_util.OPS.save, null); 11029 } 11030 11031 minMax = [Infinity, -Infinity, Infinity, -Infinity]; 11032 operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]); 11033 11034 if (parsingText) { 11035 operatorList.addOp(_util.OPS.restore, null); 11036 } 11037 } else { 11038 const opArgs = operatorList.argsArray[lastIndex]; 11039 opArgs[0].push(fn); 11040 Array.prototype.push.apply(opArgs[1], args); 11041 minMax = opArgs[2]; 11042 } 11043 11044 switch (fn) { 11045 case _util.OPS.rectangle: 11046 minMax[0] = Math.min(minMax[0], args[0], args[0] + args[2]); 11047 minMax[1] = Math.max(minMax[1], args[0], args[0] + args[2]); 11048 minMax[2] = Math.min(minMax[2], args[1], args[1] + args[3]); 11049 minMax[3] = Math.max(minMax[3], args[1], args[1] + args[3]); 11050 break; 11051 11052 case _util.OPS.moveTo: 11053 case _util.OPS.lineTo: 11054 minMax[0] = Math.min(minMax[0], args[0]); 11055 minMax[1] = Math.max(minMax[1], args[0]); 11056 minMax[2] = Math.min(minMax[2], args[1]); 11057 minMax[3] = Math.max(minMax[3], args[1]); 11058 break; 11059 } 11060 } 11061 11062 parseColorSpace({ 11063 cs, 11064 resources, 11065 localColorSpaceCache 11066 }) { 11067 return _colorspace.ColorSpace.parseAsync({ 11068 cs, 11069 xref: this.xref, 11070 resources, 11071 pdfFunctionFactory: this._pdfFunctionFactory, 11072 localColorSpaceCache 11073 }).catch(reason => { 11074 if (reason instanceof _util.AbortException) { 11075 return null; 11076 } 11077 11078 if (this.options.ignoreErrors) { 11079 this.handler.send("UnsupportedFeature", { 11080 featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace 11081 }); 11082 (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`); 11083 return null; 11084 } 11085 11086 throw reason; 11087 }); 11088 } 11089 11090 parseShading({ 11091 shading, 11092 resources, 11093 localColorSpaceCache, 11094 localShadingPatternCache 11095 }) { 11096 let id = localShadingPatternCache.get(shading); 11097 11098 if (!id) { 11099 var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache); 11100 11101 const patternIR = shadingFill.getIR(); 11102 id = `pattern_${this.idFactory.createObjId()}`; 11103 localShadingPatternCache.set(shading, id); 11104 this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]); 11105 } 11106 11107 return id; 11108 } 11109 11110 handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) { 11111 const patternName = args.pop(); 11112 11113 if (patternName instanceof _primitives.Name) { 11114 const rawPattern = patterns.getRaw(patternName.name); 11115 const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern); 11116 11117 if (localTilingPattern) { 11118 try { 11119 const color = cs.base ? cs.base.getRgb(args, 0) : null; 11120 const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color); 11121 operatorList.addOp(fn, tilingPatternIR); 11122 return undefined; 11123 } catch (ex) {} 11124 } 11125 11126 const pattern = this.xref.fetchIfRef(rawPattern); 11127 11128 if (pattern) { 11129 const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern; 11130 const typeNum = dict.get("PatternType"); 11131 11132 if (typeNum === PatternType.TILING) { 11133 const color = cs.base ? cs.base.getRgb(args, 0) : null; 11134 return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache); 11135 } else if (typeNum === PatternType.SHADING) { 11136 const shading = dict.get("Shading"); 11137 const matrix = dict.getArray("Matrix"); 11138 const objId = this.parseShading({ 11139 shading, 11140 resources, 11141 localColorSpaceCache, 11142 localShadingPatternCache 11143 }); 11144 operatorList.addOp(fn, ["Shading", objId, matrix]); 11145 return undefined; 11146 } 11147 11148 throw new _util.FormatError(`Unknown PatternType: ${typeNum}`); 11149 } 11150 } 11151 11152 throw new _util.FormatError(`Unknown PatternName: ${patternName}`); 11153 } 11154 11155 _parseVisibilityExpression(array, nestingCounter, currentResult) { 11156 const MAX_NESTING = 10; 11157 11158 if (++nestingCounter > MAX_NESTING) { 11159 (0, _util.warn)("Visibility expression is too deeply nested"); 11160 return; 11161 } 11162 11163 const length = array.length; 11164 const operator = this.xref.fetchIfRef(array[0]); 11165 11166 if (length < 2 || !(operator instanceof _primitives.Name)) { 11167 (0, _util.warn)("Invalid visibility expression"); 11168 return; 11169 } 11170 11171 switch (operator.name) { 11172 case "And": 11173 case "Or": 11174 case "Not": 11175 currentResult.push(operator.name); 11176 break; 11177 11178 default: 11179 (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`); 11180 return; 11181 } 11182 11183 for (let i = 1; i < length; i++) { 11184 const raw = array[i]; 11185 const object = this.xref.fetchIfRef(raw); 11186 11187 if (Array.isArray(object)) { 11188 const nestedResult = []; 11189 currentResult.push(nestedResult); 11190 11191 this._parseVisibilityExpression(object, nestingCounter, nestedResult); 11192 } else if (raw instanceof _primitives.Ref) { 11193 currentResult.push(raw.toString()); 11194 } 11195 } 11196 } 11197 11198 async parseMarkedContentProps(contentProperties, resources) { 11199 let optionalContent; 11200 11201 if (contentProperties instanceof _primitives.Name) { 11202 const properties = resources.get("Properties"); 11203 optionalContent = properties.get(contentProperties.name); 11204 } else if (contentProperties instanceof _primitives.Dict) { 11205 optionalContent = contentProperties; 11206 } else { 11207 throw new _util.FormatError("Optional content properties malformed."); 11208 } 11209 11210 const optionalContentType = optionalContent.get("Type").name; 11211 11212 if (optionalContentType === "OCG") { 11213 return { 11214 type: optionalContentType, 11215 id: optionalContent.objId 11216 }; 11217 } else if (optionalContentType === "OCMD") { 11218 const expression = optionalContent.get("VE"); 11219 11220 if (Array.isArray(expression)) { 11221 const result = []; 11222 11223 this._parseVisibilityExpression(expression, 0, result); 11224 11225 if (result.length > 0) { 11226 return { 11227 type: "OCMD", 11228 expression: result 11229 }; 11230 } 11231 } 11232 11233 const optionalContentGroups = optionalContent.get("OCGs"); 11234 11235 if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) { 11236 const groupIds = []; 11237 11238 if (Array.isArray(optionalContentGroups)) { 11239 for (const ocg of optionalContentGroups) { 11240 groupIds.push(ocg.toString()); 11241 } 11242 } else { 11243 groupIds.push(optionalContentGroups.objId); 11244 } 11245 11246 return { 11247 type: optionalContentType, 11248 ids: groupIds, 11249 policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null, 11250 expression: null 11251 }; 11252 } else if (optionalContentGroups instanceof _primitives.Ref) { 11253 return { 11254 type: optionalContentType, 11255 id: optionalContentGroups.toString() 11256 }; 11257 } 11258 } 11259 11260 return null; 11261 } 11262 11263 getOperatorList({ 11264 stream, 11265 task, 11266 resources, 11267 operatorList, 11268 initialState = null, 11269 fallbackFontDict = null 11270 }) { 11271 resources = resources || _primitives.Dict.empty; 11272 initialState = initialState || new EvalState(); 11273 11274 if (!operatorList) { 11275 throw new Error('getOperatorList: missing "operatorList" parameter'); 11276 } 11277 11278 const self = this; 11279 const xref = this.xref; 11280 let parsingText = false; 11281 const localImageCache = new _image_utils.LocalImageCache(); 11282 const localColorSpaceCache = new _image_utils.LocalColorSpaceCache(); 11283 const localGStateCache = new _image_utils.LocalGStateCache(); 11284 const localTilingPatternCache = new _image_utils.LocalTilingPatternCache(); 11285 const localShadingPatternCache = new Map(); 11286 11287 const xobjs = resources.get("XObject") || _primitives.Dict.empty; 11288 11289 const patterns = resources.get("Pattern") || _primitives.Dict.empty; 11290 11291 const stateManager = new StateManager(initialState); 11292 const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 11293 const timeSlotManager = new TimeSlotManager(); 11294 11295 function closePendingRestoreOPS(argument) { 11296 for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) { 11297 operatorList.addOp(_util.OPS.restore, []); 11298 } 11299 } 11300 11301 return new Promise(function promiseBody(resolve, reject) { 11302 const next = function (promise) { 11303 Promise.all([promise, operatorList.ready]).then(function () { 11304 try { 11305 promiseBody(resolve, reject); 11306 } catch (ex) { 11307 reject(ex); 11308 } 11309 }, reject); 11310 }; 11311 11312 task.ensureNotTerminated(); 11313 timeSlotManager.reset(); 11314 const operation = {}; 11315 let stop, i, ii, cs, name, isValidName; 11316 11317 while (!(stop = timeSlotManager.check())) { 11318 operation.args = null; 11319 11320 if (!preprocessor.read(operation)) { 11321 break; 11322 } 11323 11324 let args = operation.args; 11325 let fn = operation.fn; 11326 11327 switch (fn | 0) { 11328 case _util.OPS.paintXObject: 11329 isValidName = args[0] instanceof _primitives.Name; 11330 name = args[0].name; 11331 11332 if (isValidName) { 11333 const localImage = localImageCache.getByName(name); 11334 11335 if (localImage) { 11336 operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent); 11337 incrementCachedImageMaskCount(localImage); 11338 args = null; 11339 continue; 11340 } 11341 } 11342 11343 next(new Promise(function (resolveXObject, rejectXObject) { 11344 if (!isValidName) { 11345 throw new _util.FormatError("XObject must be referred to by name."); 11346 } 11347 11348 let xobj = xobjs.getRaw(name); 11349 11350 if (xobj instanceof _primitives.Ref) { 11351 const localImage = localImageCache.getByRef(xobj); 11352 11353 if (localImage) { 11354 operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent); 11355 incrementCachedImageMaskCount(localImage); 11356 resolveXObject(); 11357 return; 11358 } 11359 11360 const globalImage = self.globalImageCache.getData(xobj, self.pageIndex); 11361 11362 if (globalImage) { 11363 operatorList.addDependency(globalImage.objId); 11364 operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent); 11365 resolveXObject(); 11366 return; 11367 } 11368 11369 xobj = xref.fetch(xobj); 11370 } 11371 11372 if (!(xobj instanceof _base_stream.BaseStream)) { 11373 throw new _util.FormatError("XObject should be a stream"); 11374 } 11375 11376 const type = xobj.dict.get("Subtype"); 11377 11378 if (!(type instanceof _primitives.Name)) { 11379 throw new _util.FormatError("XObject should have a Name subtype"); 11380 } 11381 11382 if (type.name === "Form") { 11383 stateManager.save(); 11384 self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () { 11385 stateManager.restore(); 11386 resolveXObject(); 11387 }, rejectXObject); 11388 return; 11389 } else if (type.name === "Image") { 11390 self.buildPaintImageXObject({ 11391 resources, 11392 image: xobj, 11393 operatorList, 11394 cacheKey: name, 11395 localImageCache, 11396 localColorSpaceCache 11397 }).then(resolveXObject, rejectXObject); 11398 return; 11399 } else if (type.name === "PS") { 11400 (0, _util.info)("Ignored XObject subtype PS"); 11401 } else { 11402 throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`); 11403 } 11404 11405 resolveXObject(); 11406 }).catch(function (reason) { 11407 if (reason instanceof _util.AbortException) { 11408 return; 11409 } 11410 11411 if (self.options.ignoreErrors) { 11412 self.handler.send("UnsupportedFeature", { 11413 featureId: _util.UNSUPPORTED_FEATURES.errorXObject 11414 }); 11415 (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`); 11416 return; 11417 } 11418 11419 throw reason; 11420 })); 11421 return; 11422 11423 case _util.OPS.setFont: 11424 var fontSize = args[1]; 11425 next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) { 11426 operatorList.addDependency(loadedName); 11427 operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]); 11428 })); 11429 return; 11430 11431 case _util.OPS.beginText: 11432 parsingText = true; 11433 break; 11434 11435 case _util.OPS.endText: 11436 parsingText = false; 11437 break; 11438 11439 case _util.OPS.endInlineImage: 11440 var cacheKey = args[0].cacheKey; 11441 11442 if (cacheKey) { 11443 const localImage = localImageCache.getByName(cacheKey); 11444 11445 if (localImage) { 11446 operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent); 11447 incrementCachedImageMaskCount(localImage); 11448 args = null; 11449 continue; 11450 } 11451 } 11452 11453 next(self.buildPaintImageXObject({ 11454 resources, 11455 image: args[0], 11456 isInline: true, 11457 operatorList, 11458 cacheKey, 11459 localImageCache, 11460 localColorSpaceCache 11461 })); 11462 return; 11463 11464 case _util.OPS.showText: 11465 if (!stateManager.state.font) { 11466 self.ensureStateFont(stateManager.state); 11467 continue; 11468 } 11469 11470 args[0] = self.handleText(args[0], stateManager.state); 11471 break; 11472 11473 case _util.OPS.showSpacedText: 11474 if (!stateManager.state.font) { 11475 self.ensureStateFont(stateManager.state); 11476 continue; 11477 } 11478 11479 var arr = args[0]; 11480 var combinedGlyphs = []; 11481 var arrLength = arr.length; 11482 var state = stateManager.state; 11483 11484 for (i = 0; i < arrLength; ++i) { 11485 const arrItem = arr[i]; 11486 11487 if (typeof arrItem === "string") { 11488 Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state)); 11489 } else if (typeof arrItem === "number") { 11490 combinedGlyphs.push(arrItem); 11491 } 11492 } 11493 11494 args[0] = combinedGlyphs; 11495 fn = _util.OPS.showText; 11496 break; 11497 11498 case _util.OPS.nextLineShowText: 11499 if (!stateManager.state.font) { 11500 self.ensureStateFont(stateManager.state); 11501 continue; 11502 } 11503 11504 operatorList.addOp(_util.OPS.nextLine); 11505 args[0] = self.handleText(args[0], stateManager.state); 11506 fn = _util.OPS.showText; 11507 break; 11508 11509 case _util.OPS.nextLineSetSpacingShowText: 11510 if (!stateManager.state.font) { 11511 self.ensureStateFont(stateManager.state); 11512 continue; 11513 } 11514 11515 operatorList.addOp(_util.OPS.nextLine); 11516 operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]); 11517 operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]); 11518 args[0] = self.handleText(args[0], stateManager.state); 11519 fn = _util.OPS.showText; 11520 break; 11521 11522 case _util.OPS.setTextRenderingMode: 11523 stateManager.state.textRenderingMode = args[0]; 11524 break; 11525 11526 case _util.OPS.setFillColorSpace: 11527 { 11528 const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache); 11529 11530 if (cachedColorSpace) { 11531 stateManager.state.fillColorSpace = cachedColorSpace; 11532 continue; 11533 } 11534 11535 next(self.parseColorSpace({ 11536 cs: args[0], 11537 resources, 11538 localColorSpaceCache 11539 }).then(function (colorSpace) { 11540 if (colorSpace) { 11541 stateManager.state.fillColorSpace = colorSpace; 11542 } 11543 })); 11544 return; 11545 } 11546 11547 case _util.OPS.setStrokeColorSpace: 11548 { 11549 const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache); 11550 11551 if (cachedColorSpace) { 11552 stateManager.state.strokeColorSpace = cachedColorSpace; 11553 continue; 11554 } 11555 11556 next(self.parseColorSpace({ 11557 cs: args[0], 11558 resources, 11559 localColorSpaceCache 11560 }).then(function (colorSpace) { 11561 if (colorSpace) { 11562 stateManager.state.strokeColorSpace = colorSpace; 11563 } 11564 })); 11565 return; 11566 } 11567 11568 case _util.OPS.setFillColor: 11569 cs = stateManager.state.fillColorSpace; 11570 args = cs.getRgb(args, 0); 11571 fn = _util.OPS.setFillRGBColor; 11572 break; 11573 11574 case _util.OPS.setStrokeColor: 11575 cs = stateManager.state.strokeColorSpace; 11576 args = cs.getRgb(args, 0); 11577 fn = _util.OPS.setStrokeRGBColor; 11578 break; 11579 11580 case _util.OPS.setFillGray: 11581 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray; 11582 args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0); 11583 fn = _util.OPS.setFillRGBColor; 11584 break; 11585 11586 case _util.OPS.setStrokeGray: 11587 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray; 11588 args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0); 11589 fn = _util.OPS.setStrokeRGBColor; 11590 break; 11591 11592 case _util.OPS.setFillCMYKColor: 11593 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk; 11594 args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0); 11595 fn = _util.OPS.setFillRGBColor; 11596 break; 11597 11598 case _util.OPS.setStrokeCMYKColor: 11599 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk; 11600 args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0); 11601 fn = _util.OPS.setStrokeRGBColor; 11602 break; 11603 11604 case _util.OPS.setFillRGBColor: 11605 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb; 11606 args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0); 11607 break; 11608 11609 case _util.OPS.setStrokeRGBColor: 11610 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb; 11611 args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0); 11612 break; 11613 11614 case _util.OPS.setFillColorN: 11615 cs = stateManager.state.fillColorSpace; 11616 11617 if (cs.name === "Pattern") { 11618 next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache)); 11619 return; 11620 } 11621 11622 args = cs.getRgb(args, 0); 11623 fn = _util.OPS.setFillRGBColor; 11624 break; 11625 11626 case _util.OPS.setStrokeColorN: 11627 cs = stateManager.state.strokeColorSpace; 11628 11629 if (cs.name === "Pattern") { 11630 next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache)); 11631 return; 11632 } 11633 11634 args = cs.getRgb(args, 0); 11635 fn = _util.OPS.setStrokeRGBColor; 11636 break; 11637 11638 case _util.OPS.shadingFill: 11639 var shadingRes = resources.get("Shading"); 11640 11641 if (!shadingRes) { 11642 throw new _util.FormatError("No shading resource found"); 11643 } 11644 11645 var shading = shadingRes.get(args[0].name); 11646 11647 if (!shading) { 11648 throw new _util.FormatError("No shading object found"); 11649 } 11650 11651 const patternId = self.parseShading({ 11652 shading, 11653 resources, 11654 localColorSpaceCache, 11655 localShadingPatternCache 11656 }); 11657 args = [patternId]; 11658 fn = _util.OPS.shadingFill; 11659 break; 11660 11661 case _util.OPS.setGState: 11662 isValidName = args[0] instanceof _primitives.Name; 11663 name = args[0].name; 11664 11665 if (isValidName) { 11666 const localGStateObj = localGStateCache.getByName(name); 11667 11668 if (localGStateObj) { 11669 if (localGStateObj.length > 0) { 11670 operatorList.addOp(_util.OPS.setGState, [localGStateObj]); 11671 } 11672 11673 args = null; 11674 continue; 11675 } 11676 } 11677 11678 next(new Promise(function (resolveGState, rejectGState) { 11679 if (!isValidName) { 11680 throw new _util.FormatError("GState must be referred to by name."); 11681 } 11682 11683 const extGState = resources.get("ExtGState"); 11684 11685 if (!(extGState instanceof _primitives.Dict)) { 11686 throw new _util.FormatError("ExtGState should be a dictionary."); 11687 } 11688 11689 const gState = extGState.get(name); 11690 11691 if (!(gState instanceof _primitives.Dict)) { 11692 throw new _util.FormatError("GState should be a dictionary."); 11693 } 11694 11695 self.setGState({ 11696 resources, 11697 gState, 11698 operatorList, 11699 cacheKey: name, 11700 task, 11701 stateManager, 11702 localGStateCache, 11703 localColorSpaceCache 11704 }).then(resolveGState, rejectGState); 11705 }).catch(function (reason) { 11706 if (reason instanceof _util.AbortException) { 11707 return; 11708 } 11709 11710 if (self.options.ignoreErrors) { 11711 self.handler.send("UnsupportedFeature", { 11712 featureId: _util.UNSUPPORTED_FEATURES.errorExtGState 11713 }); 11714 (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`); 11715 return; 11716 } 11717 11718 throw reason; 11719 })); 11720 return; 11721 11722 case _util.OPS.moveTo: 11723 case _util.OPS.lineTo: 11724 case _util.OPS.curveTo: 11725 case _util.OPS.curveTo2: 11726 case _util.OPS.curveTo3: 11727 case _util.OPS.closePath: 11728 case _util.OPS.rectangle: 11729 self.buildPath(operatorList, fn, args, parsingText); 11730 continue; 11731 11732 case _util.OPS.markPoint: 11733 case _util.OPS.markPointProps: 11734 case _util.OPS.beginCompat: 11735 case _util.OPS.endCompat: 11736 continue; 11737 11738 case _util.OPS.beginMarkedContentProps: 11739 if (!(args[0] instanceof _primitives.Name)) { 11740 (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`); 11741 continue; 11742 } 11743 11744 if (args[0].name === "OC") { 11745 next(self.parseMarkedContentProps(args[1], resources).then(data => { 11746 operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]); 11747 }).catch(reason => { 11748 if (reason instanceof _util.AbortException) { 11749 return; 11750 } 11751 11752 if (self.options.ignoreErrors) { 11753 self.handler.send("UnsupportedFeature", { 11754 featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent 11755 }); 11756 (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`); 11757 return; 11758 } 11759 11760 throw reason; 11761 })); 11762 return; 11763 } 11764 11765 args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null]; 11766 break; 11767 11768 case _util.OPS.beginMarkedContent: 11769 case _util.OPS.endMarkedContent: 11770 default: 11771 if (args !== null) { 11772 for (i = 0, ii = args.length; i < ii; i++) { 11773 if (args[i] instanceof _primitives.Dict) { 11774 break; 11775 } 11776 } 11777 11778 if (i < ii) { 11779 (0, _util.warn)("getOperatorList - ignoring operator: " + fn); 11780 continue; 11781 } 11782 } 11783 11784 } 11785 11786 operatorList.addOp(fn, args); 11787 } 11788 11789 if (stop) { 11790 next(deferred); 11791 return; 11792 } 11793 11794 closePendingRestoreOPS(); 11795 resolve(); 11796 }).catch(reason => { 11797 if (reason instanceof _util.AbortException) { 11798 return; 11799 } 11800 11801 if (this.options.ignoreErrors) { 11802 this.handler.send("UnsupportedFeature", { 11803 featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList 11804 }); 11805 (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`); 11806 closePendingRestoreOPS(); 11807 return; 11808 } 11809 11810 throw reason; 11811 }); 11812 } 11813 11814 getTextContent({ 11815 stream, 11816 task, 11817 resources, 11818 stateManager = null, 11819 combineTextItems = false, 11820 includeMarkedContent = false, 11821 sink, 11822 seenStyles = new Set(), 11823 viewBox 11824 }) { 11825 resources = resources || _primitives.Dict.empty; 11826 stateManager = stateManager || new StateManager(new TextState()); 11827 const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)(); 11828 const textContent = { 11829 items: [], 11830 styles: Object.create(null) 11831 }; 11832 const textContentItem = { 11833 initialized: false, 11834 str: [], 11835 totalWidth: 0, 11836 totalHeight: 0, 11837 width: 0, 11838 height: 0, 11839 vertical: false, 11840 prevTransform: null, 11841 textAdvanceScale: 0, 11842 spaceInFlowMin: 0, 11843 spaceInFlowMax: 0, 11844 trackingSpaceMin: Infinity, 11845 negativeSpaceMax: -Infinity, 11846 notASpace: -Infinity, 11847 transform: null, 11848 fontName: null, 11849 hasEOL: false 11850 }; 11851 const twoLastChars = [" ", " "]; 11852 let twoLastCharsPos = 0; 11853 11854 function saveLastChar(char) { 11855 const nextPos = (twoLastCharsPos + 1) % 2; 11856 const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " "; 11857 twoLastChars[twoLastCharsPos] = char; 11858 twoLastCharsPos = nextPos; 11859 return ret; 11860 } 11861 11862 function resetLastChars() { 11863 twoLastChars[0] = twoLastChars[1] = " "; 11864 twoLastCharsPos = 0; 11865 } 11866 11867 const TRACKING_SPACE_FACTOR = 0.1; 11868 const NOT_A_SPACE_FACTOR = 0.03; 11869 const NEGATIVE_SPACE_FACTOR = -0.2; 11870 const SPACE_IN_FLOW_MIN_FACTOR = 0.1; 11871 const SPACE_IN_FLOW_MAX_FACTOR = 0.6; 11872 const self = this; 11873 const xref = this.xref; 11874 const showSpacedTextBuffer = []; 11875 let xobjs = null; 11876 const emptyXObjectCache = new _image_utils.LocalImageCache(); 11877 const emptyGStateCache = new _image_utils.LocalGStateCache(); 11878 const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 11879 let textState; 11880 11881 function getCurrentTextTransform() { 11882 const font = textState.font; 11883 const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise]; 11884 11885 if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) { 11886 const glyphHeight = font.bbox[3] - font.bbox[1]; 11887 11888 if (glyphHeight > 0) { 11889 tsm[3] *= glyphHeight * textState.fontMatrix[3]; 11890 } 11891 } 11892 11893 return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm)); 11894 } 11895 11896 function ensureTextContentItem() { 11897 if (textContentItem.initialized) { 11898 return textContentItem; 11899 } 11900 11901 const font = textState.font, 11902 loadedName = font.loadedName; 11903 11904 if (!seenStyles.has(loadedName)) { 11905 seenStyles.add(loadedName); 11906 textContent.styles[loadedName] = { 11907 fontFamily: font.fallbackName, 11908 ascent: font.ascent, 11909 descent: font.descent, 11910 vertical: font.vertical 11911 }; 11912 } 11913 11914 textContentItem.fontName = loadedName; 11915 const trm = textContentItem.transform = getCurrentTextTransform(); 11916 11917 if (!font.vertical) { 11918 textContentItem.width = textContentItem.totalWidth = 0; 11919 textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]); 11920 textContentItem.vertical = false; 11921 } else { 11922 textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]); 11923 textContentItem.height = textContentItem.totalHeight = 0; 11924 textContentItem.vertical = true; 11925 } 11926 11927 const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]); 11928 const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]); 11929 textContentItem.textAdvanceScale = scaleCtmX * scaleLineX; 11930 textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR; 11931 textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR; 11932 textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR; 11933 textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR; 11934 textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR; 11935 textContentItem.hasEOL = false; 11936 textContentItem.initialized = true; 11937 return textContentItem; 11938 } 11939 11940 function updateAdvanceScale() { 11941 if (!textContentItem.initialized) { 11942 return; 11943 } 11944 11945 const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]); 11946 const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]); 11947 const scaleFactor = scaleCtmX * scaleLineX; 11948 11949 if (scaleFactor === textContentItem.textAdvanceScale) { 11950 return; 11951 } 11952 11953 if (!textContentItem.vertical) { 11954 textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale; 11955 textContentItem.width = 0; 11956 } else { 11957 textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale; 11958 textContentItem.height = 0; 11959 } 11960 11961 textContentItem.textAdvanceScale = scaleFactor; 11962 } 11963 11964 function runBidiTransform(textChunk) { 11965 const text = textChunk.str.join(""); 11966 const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical); 11967 return { 11968 str: bidiResult.str, 11969 dir: bidiResult.dir, 11970 width: Math.abs(textChunk.totalWidth), 11971 height: Math.abs(textChunk.totalHeight), 11972 transform: textChunk.transform, 11973 fontName: textChunk.fontName, 11974 hasEOL: textChunk.hasEOL 11975 }; 11976 } 11977 11978 function handleSetFont(fontName, fontRef) { 11979 return self.loadFont(fontName, fontRef, resources).then(function (translated) { 11980 if (!translated.font.isType3Font) { 11981 return translated; 11982 } 11983 11984 return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () { 11985 return translated; 11986 }); 11987 }).then(function (translated) { 11988 textState.font = translated.font; 11989 textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX; 11990 }); 11991 } 11992 11993 function applyInverseRotation(x, y, matrix) { 11994 const scale = Math.hypot(matrix[0], matrix[1]); 11995 return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale]; 11996 } 11997 11998 function compareWithLastPosition() { 11999 const currentTransform = getCurrentTextTransform(); 12000 let posX = currentTransform[4]; 12001 let posY = currentTransform[5]; 12002 const shiftedX = posX - viewBox[0]; 12003 const shiftedY = posY - viewBox[1]; 12004 12005 if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) { 12006 return false; 12007 } 12008 12009 if (!combineTextItems || !textState.font || !textContentItem.prevTransform) { 12010 return true; 12011 } 12012 12013 let lastPosX = textContentItem.prevTransform[4]; 12014 let lastPosY = textContentItem.prevTransform[5]; 12015 12016 if (lastPosX === posX && lastPosY === posY) { 12017 return true; 12018 } 12019 12020 let rotate = -1; 12021 12022 if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) { 12023 rotate = currentTransform[0] > 0 ? 0 : 180; 12024 } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) { 12025 rotate = currentTransform[1] > 0 ? 90 : 270; 12026 } 12027 12028 switch (rotate) { 12029 case 0: 12030 break; 12031 12032 case 90: 12033 [posX, posY] = [posY, posX]; 12034 [lastPosX, lastPosY] = [lastPosY, lastPosX]; 12035 break; 12036 12037 case 180: 12038 [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY]; 12039 break; 12040 12041 case 270: 12042 [posX, posY] = [-posY, -posX]; 12043 [lastPosX, lastPosY] = [-lastPosY, -lastPosX]; 12044 break; 12045 12046 default: 12047 [posX, posY] = applyInverseRotation(posX, posY, currentTransform); 12048 [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform); 12049 } 12050 12051 if (textState.font.vertical) { 12052 const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale; 12053 const advanceX = posX - lastPosX; 12054 const textOrientation = Math.sign(textContentItem.height); 12055 12056 if (advanceY < textOrientation * textContentItem.negativeSpaceMax) { 12057 if (Math.abs(advanceX) > 0.5 * textContentItem.width) { 12058 appendEOL(); 12059 return true; 12060 } 12061 12062 resetLastChars(); 12063 flushTextContentItem(); 12064 return true; 12065 } 12066 12067 if (Math.abs(advanceX) > textContentItem.width) { 12068 appendEOL(); 12069 return true; 12070 } 12071 12072 if (advanceY <= textOrientation * textContentItem.notASpace) { 12073 resetLastChars(); 12074 } 12075 12076 if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) { 12077 textContentItem.height += advanceY; 12078 } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) { 12079 if (textContentItem.str.length === 0) { 12080 resetLastChars(); 12081 textContent.items.push({ 12082 str: " ", 12083 dir: "ltr", 12084 width: 0, 12085 height: Math.abs(advanceY), 12086 transform: textContentItem.prevTransform, 12087 fontName: textContentItem.fontName, 12088 hasEOL: false 12089 }); 12090 } else { 12091 textContentItem.height += advanceY; 12092 } 12093 } 12094 12095 return true; 12096 } 12097 12098 const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale; 12099 const advanceY = posY - lastPosY; 12100 const textOrientation = Math.sign(textContentItem.width); 12101 12102 if (advanceX < textOrientation * textContentItem.negativeSpaceMax) { 12103 if (Math.abs(advanceY) > 0.5 * textContentItem.height) { 12104 appendEOL(); 12105 return true; 12106 } 12107 12108 resetLastChars(); 12109 flushTextContentItem(); 12110 return true; 12111 } 12112 12113 if (Math.abs(advanceY) > textContentItem.height) { 12114 appendEOL(); 12115 return true; 12116 } 12117 12118 if (advanceX <= textOrientation * textContentItem.notASpace) { 12119 resetLastChars(); 12120 } 12121 12122 if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) { 12123 textContentItem.width += advanceX; 12124 } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) { 12125 if (textContentItem.str.length === 0) { 12126 resetLastChars(); 12127 textContent.items.push({ 12128 str: " ", 12129 dir: "ltr", 12130 width: Math.abs(advanceX), 12131 height: 0, 12132 transform: textContentItem.prevTransform, 12133 fontName: textContentItem.fontName, 12134 hasEOL: false 12135 }); 12136 } else { 12137 textContentItem.width += advanceX; 12138 } 12139 } 12140 12141 return true; 12142 } 12143 12144 function buildTextContentItem({ 12145 chars, 12146 extraSpacing 12147 }) { 12148 const font = textState.font; 12149 12150 if (!chars) { 12151 const charSpacing = textState.charSpacing + extraSpacing; 12152 12153 if (charSpacing) { 12154 if (!font.vertical) { 12155 textState.translateTextMatrix(charSpacing * textState.textHScale, 0); 12156 } else { 12157 textState.translateTextMatrix(0, -charSpacing); 12158 } 12159 } 12160 12161 return; 12162 } 12163 12164 const glyphs = font.charsToGlyphs(chars); 12165 const scale = textState.fontMatrix[0] * textState.fontSize; 12166 12167 for (let i = 0, ii = glyphs.length; i < ii; i++) { 12168 const glyph = glyphs[i]; 12169 12170 if (glyph.isInvisibleFormatMark) { 12171 continue; 12172 } 12173 12174 let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0); 12175 let glyphWidth = glyph.width; 12176 12177 if (font.vertical) { 12178 glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth; 12179 } 12180 12181 let scaledDim = glyphWidth * scale; 12182 12183 if (glyph.isWhitespace) { 12184 if (!font.vertical) { 12185 charSpacing += scaledDim + textState.wordSpacing; 12186 textState.translateTextMatrix(charSpacing * textState.textHScale, 0); 12187 } else { 12188 charSpacing += -scaledDim + textState.wordSpacing; 12189 textState.translateTextMatrix(0, -charSpacing); 12190 } 12191 12192 saveLastChar(" "); 12193 continue; 12194 } 12195 12196 if (!compareWithLastPosition()) { 12197 continue; 12198 } 12199 12200 const textChunk = ensureTextContentItem(); 12201 12202 if (glyph.isZeroWidthDiacritic) { 12203 scaledDim = 0; 12204 } 12205 12206 if (!font.vertical) { 12207 scaledDim *= textState.textHScale; 12208 textState.translateTextMatrix(scaledDim, 0); 12209 textChunk.width += scaledDim; 12210 } else { 12211 textState.translateTextMatrix(0, scaledDim); 12212 scaledDim = Math.abs(scaledDim); 12213 textChunk.height += scaledDim; 12214 } 12215 12216 if (scaledDim) { 12217 textChunk.prevTransform = getCurrentTextTransform(); 12218 } 12219 12220 let glyphUnicode = glyph.unicode; 12221 glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode; 12222 glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode); 12223 12224 if (saveLastChar(glyphUnicode)) { 12225 textChunk.str.push(" "); 12226 } 12227 12228 textChunk.str.push(glyphUnicode); 12229 12230 if (charSpacing) { 12231 if (!font.vertical) { 12232 textState.translateTextMatrix(charSpacing * textState.textHScale, 0); 12233 } else { 12234 textState.translateTextMatrix(0, -charSpacing); 12235 } 12236 } 12237 } 12238 } 12239 12240 function appendEOL() { 12241 resetLastChars(); 12242 12243 if (textContentItem.initialized) { 12244 textContentItem.hasEOL = true; 12245 flushTextContentItem(); 12246 } else { 12247 textContent.items.push({ 12248 str: "", 12249 dir: "ltr", 12250 width: 0, 12251 height: 0, 12252 transform: getCurrentTextTransform(), 12253 fontName: textState.font.loadedName, 12254 hasEOL: true 12255 }); 12256 } 12257 } 12258 12259 function addFakeSpaces(width, transf, textOrientation) { 12260 if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) { 12261 if (textContentItem.initialized) { 12262 resetLastChars(); 12263 textContentItem.str.push(" "); 12264 } 12265 12266 return false; 12267 } 12268 12269 const fontName = textContentItem.fontName; 12270 let height = 0; 12271 12272 if (textContentItem.vertical) { 12273 height = width; 12274 width = 0; 12275 } 12276 12277 flushTextContentItem(); 12278 resetLastChars(); 12279 textContent.items.push({ 12280 str: " ", 12281 dir: "ltr", 12282 width: Math.abs(width), 12283 height: Math.abs(height), 12284 transform: transf || getCurrentTextTransform(), 12285 fontName, 12286 hasEOL: false 12287 }); 12288 return true; 12289 } 12290 12291 function flushTextContentItem() { 12292 if (!textContentItem.initialized || !textContentItem.str) { 12293 return; 12294 } 12295 12296 if (!textContentItem.vertical) { 12297 textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale; 12298 } else { 12299 textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale; 12300 } 12301 12302 textContent.items.push(runBidiTransform(textContentItem)); 12303 textContentItem.initialized = false; 12304 textContentItem.str.length = 0; 12305 } 12306 12307 function enqueueChunk(batch = false) { 12308 const length = textContent.items.length; 12309 12310 if (length === 0) { 12311 return; 12312 } 12313 12314 if (batch && length < TEXT_CHUNK_BATCH_SIZE) { 12315 return; 12316 } 12317 12318 sink.enqueue(textContent, length); 12319 textContent.items = []; 12320 textContent.styles = Object.create(null); 12321 } 12322 12323 const timeSlotManager = new TimeSlotManager(); 12324 return new Promise(function promiseBody(resolve, reject) { 12325 const next = function (promise) { 12326 enqueueChunk(true); 12327 Promise.all([promise, sink.ready]).then(function () { 12328 try { 12329 promiseBody(resolve, reject); 12330 } catch (ex) { 12331 reject(ex); 12332 } 12333 }, reject); 12334 }; 12335 12336 task.ensureNotTerminated(); 12337 timeSlotManager.reset(); 12338 const operation = {}; 12339 let stop, 12340 args = []; 12341 12342 while (!(stop = timeSlotManager.check())) { 12343 args.length = 0; 12344 operation.args = args; 12345 12346 if (!preprocessor.read(operation)) { 12347 break; 12348 } 12349 12350 textState = stateManager.state; 12351 const fn = operation.fn; 12352 args = operation.args; 12353 12354 switch (fn | 0) { 12355 case _util.OPS.setFont: 12356 var fontNameArg = args[0].name, 12357 fontSizeArg = args[1]; 12358 12359 if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) { 12360 break; 12361 } 12362 12363 flushTextContentItem(); 12364 textState.fontName = fontNameArg; 12365 textState.fontSize = fontSizeArg; 12366 next(handleSetFont(fontNameArg, null)); 12367 return; 12368 12369 case _util.OPS.setTextRise: 12370 textState.textRise = args[0]; 12371 break; 12372 12373 case _util.OPS.setHScale: 12374 textState.textHScale = args[0] / 100; 12375 break; 12376 12377 case _util.OPS.setLeading: 12378 textState.leading = args[0]; 12379 break; 12380 12381 case _util.OPS.moveText: 12382 textState.translateTextLineMatrix(args[0], args[1]); 12383 textState.textMatrix = textState.textLineMatrix.slice(); 12384 break; 12385 12386 case _util.OPS.setLeadingMoveText: 12387 textState.leading = -args[1]; 12388 textState.translateTextLineMatrix(args[0], args[1]); 12389 textState.textMatrix = textState.textLineMatrix.slice(); 12390 break; 12391 12392 case _util.OPS.nextLine: 12393 textState.carriageReturn(); 12394 break; 12395 12396 case _util.OPS.setTextMatrix: 12397 textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 12398 textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 12399 updateAdvanceScale(); 12400 break; 12401 12402 case _util.OPS.setCharSpacing: 12403 textState.charSpacing = args[0]; 12404 break; 12405 12406 case _util.OPS.setWordSpacing: 12407 textState.wordSpacing = args[0]; 12408 break; 12409 12410 case _util.OPS.beginText: 12411 textState.textMatrix = _util.IDENTITY_MATRIX.slice(); 12412 textState.textLineMatrix = _util.IDENTITY_MATRIX.slice(); 12413 break; 12414 12415 case _util.OPS.showSpacedText: 12416 if (!stateManager.state.font) { 12417 self.ensureStateFont(stateManager.state); 12418 continue; 12419 } 12420 12421 const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000; 12422 const elements = args[0]; 12423 12424 for (let i = 0, ii = elements.length; i < ii - 1; i++) { 12425 const item = elements[i]; 12426 12427 if (typeof item === "string") { 12428 showSpacedTextBuffer.push(item); 12429 } else if (typeof item === "number" && item !== 0) { 12430 const str = showSpacedTextBuffer.join(""); 12431 showSpacedTextBuffer.length = 0; 12432 buildTextContentItem({ 12433 chars: str, 12434 extraSpacing: item * spaceFactor 12435 }); 12436 } 12437 } 12438 12439 const item = elements.at(-1); 12440 12441 if (typeof item === "string") { 12442 showSpacedTextBuffer.push(item); 12443 } 12444 12445 if (showSpacedTextBuffer.length > 0) { 12446 const str = showSpacedTextBuffer.join(""); 12447 showSpacedTextBuffer.length = 0; 12448 buildTextContentItem({ 12449 chars: str, 12450 extraSpacing: 0 12451 }); 12452 } 12453 12454 break; 12455 12456 case _util.OPS.showText: 12457 if (!stateManager.state.font) { 12458 self.ensureStateFont(stateManager.state); 12459 continue; 12460 } 12461 12462 buildTextContentItem({ 12463 chars: args[0], 12464 extraSpacing: 0 12465 }); 12466 break; 12467 12468 case _util.OPS.nextLineShowText: 12469 if (!stateManager.state.font) { 12470 self.ensureStateFont(stateManager.state); 12471 continue; 12472 } 12473 12474 textState.carriageReturn(); 12475 buildTextContentItem({ 12476 chars: args[0], 12477 extraSpacing: 0 12478 }); 12479 break; 12480 12481 case _util.OPS.nextLineSetSpacingShowText: 12482 if (!stateManager.state.font) { 12483 self.ensureStateFont(stateManager.state); 12484 continue; 12485 } 12486 12487 textState.wordSpacing = args[0]; 12488 textState.charSpacing = args[1]; 12489 textState.carriageReturn(); 12490 buildTextContentItem({ 12491 chars: args[2], 12492 extraSpacing: 0 12493 }); 12494 break; 12495 12496 case _util.OPS.paintXObject: 12497 flushTextContentItem(); 12498 12499 if (!xobjs) { 12500 xobjs = resources.get("XObject") || _primitives.Dict.empty; 12501 } 12502 12503 var isValidName = args[0] instanceof _primitives.Name; 12504 var name = args[0].name; 12505 12506 if (isValidName && emptyXObjectCache.getByName(name)) { 12507 break; 12508 } 12509 12510 next(new Promise(function (resolveXObject, rejectXObject) { 12511 if (!isValidName) { 12512 throw new _util.FormatError("XObject must be referred to by name."); 12513 } 12514 12515 let xobj = xobjs.getRaw(name); 12516 12517 if (xobj instanceof _primitives.Ref) { 12518 if (emptyXObjectCache.getByRef(xobj)) { 12519 resolveXObject(); 12520 return; 12521 } 12522 12523 const globalImage = self.globalImageCache.getData(xobj, self.pageIndex); 12524 12525 if (globalImage) { 12526 resolveXObject(); 12527 return; 12528 } 12529 12530 xobj = xref.fetch(xobj); 12531 } 12532 12533 if (!(xobj instanceof _base_stream.BaseStream)) { 12534 throw new _util.FormatError("XObject should be a stream"); 12535 } 12536 12537 const type = xobj.dict.get("Subtype"); 12538 12539 if (!(type instanceof _primitives.Name)) { 12540 throw new _util.FormatError("XObject should have a Name subtype"); 12541 } 12542 12543 if (type.name !== "Form") { 12544 emptyXObjectCache.set(name, xobj.dict.objId, true); 12545 resolveXObject(); 12546 return; 12547 } 12548 12549 const currentState = stateManager.state.clone(); 12550 const xObjStateManager = new StateManager(currentState); 12551 const matrix = xobj.dict.getArray("Matrix"); 12552 12553 if (Array.isArray(matrix) && matrix.length === 6) { 12554 xObjStateManager.transform(matrix); 12555 } 12556 12557 enqueueChunk(); 12558 const sinkWrapper = { 12559 enqueueInvoked: false, 12560 12561 enqueue(chunk, size) { 12562 this.enqueueInvoked = true; 12563 sink.enqueue(chunk, size); 12564 }, 12565 12566 get desiredSize() { 12567 return sink.desiredSize; 12568 }, 12569 12570 get ready() { 12571 return sink.ready; 12572 } 12573 12574 }; 12575 self.getTextContent({ 12576 stream: xobj, 12577 task, 12578 resources: xobj.dict.get("Resources") || resources, 12579 stateManager: xObjStateManager, 12580 combineTextItems, 12581 includeMarkedContent, 12582 sink: sinkWrapper, 12583 seenStyles, 12584 viewBox 12585 }).then(function () { 12586 if (!sinkWrapper.enqueueInvoked) { 12587 emptyXObjectCache.set(name, xobj.dict.objId, true); 12588 } 12589 12590 resolveXObject(); 12591 }, rejectXObject); 12592 }).catch(function (reason) { 12593 if (reason instanceof _util.AbortException) { 12594 return; 12595 } 12596 12597 if (self.options.ignoreErrors) { 12598 (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`); 12599 return; 12600 } 12601 12602 throw reason; 12603 })); 12604 return; 12605 12606 case _util.OPS.setGState: 12607 isValidName = args[0] instanceof _primitives.Name; 12608 name = args[0].name; 12609 12610 if (isValidName && emptyGStateCache.getByName(name)) { 12611 break; 12612 } 12613 12614 next(new Promise(function (resolveGState, rejectGState) { 12615 if (!isValidName) { 12616 throw new _util.FormatError("GState must be referred to by name."); 12617 } 12618 12619 const extGState = resources.get("ExtGState"); 12620 12621 if (!(extGState instanceof _primitives.Dict)) { 12622 throw new _util.FormatError("ExtGState should be a dictionary."); 12623 } 12624 12625 const gState = extGState.get(name); 12626 12627 if (!(gState instanceof _primitives.Dict)) { 12628 throw new _util.FormatError("GState should be a dictionary."); 12629 } 12630 12631 const gStateFont = gState.get("Font"); 12632 12633 if (!gStateFont) { 12634 emptyGStateCache.set(name, gState.objId, true); 12635 resolveGState(); 12636 return; 12637 } 12638 12639 flushTextContentItem(); 12640 textState.fontName = null; 12641 textState.fontSize = gStateFont[1]; 12642 handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState); 12643 }).catch(function (reason) { 12644 if (reason instanceof _util.AbortException) { 12645 return; 12646 } 12647 12648 if (self.options.ignoreErrors) { 12649 (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`); 12650 return; 12651 } 12652 12653 throw reason; 12654 })); 12655 return; 12656 12657 case _util.OPS.beginMarkedContent: 12658 flushTextContentItem(); 12659 12660 if (includeMarkedContent) { 12661 textContent.items.push({ 12662 type: "beginMarkedContent", 12663 tag: args[0] instanceof _primitives.Name ? args[0].name : null 12664 }); 12665 } 12666 12667 break; 12668 12669 case _util.OPS.beginMarkedContentProps: 12670 flushTextContentItem(); 12671 12672 if (includeMarkedContent) { 12673 let mcid = null; 12674 12675 if (args[1] instanceof _primitives.Dict) { 12676 mcid = args[1].get("MCID"); 12677 } 12678 12679 textContent.items.push({ 12680 type: "beginMarkedContentProps", 12681 id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null, 12682 tag: args[0] instanceof _primitives.Name ? args[0].name : null 12683 }); 12684 } 12685 12686 break; 12687 12688 case _util.OPS.endMarkedContent: 12689 flushTextContentItem(); 12690 12691 if (includeMarkedContent) { 12692 textContent.items.push({ 12693 type: "endMarkedContent" 12694 }); 12695 } 12696 12697 break; 12698 } 12699 12700 if (textContent.items.length >= sink.desiredSize) { 12701 stop = true; 12702 break; 12703 } 12704 } 12705 12706 if (stop) { 12707 next(deferred); 12708 return; 12709 } 12710 12711 flushTextContentItem(); 12712 enqueueChunk(); 12713 resolve(); 12714 }).catch(reason => { 12715 if (reason instanceof _util.AbortException) { 12716 return; 12717 } 12718 12719 if (this.options.ignoreErrors) { 12720 (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`); 12721 flushTextContentItem(); 12722 enqueueChunk(); 12723 return; 12724 } 12725 12726 throw reason; 12727 }); 12728 } 12729 12730 extractDataStructures(dict, baseDict, properties) { 12731 const xref = this.xref; 12732 let cidToGidBytes; 12733 const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode")); 12734 12735 if (properties.composite) { 12736 const cidSystemInfo = dict.get("CIDSystemInfo"); 12737 12738 if (cidSystemInfo instanceof _primitives.Dict) { 12739 properties.cidSystemInfo = { 12740 registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")), 12741 ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")), 12742 supplement: cidSystemInfo.get("Supplement") 12743 }; 12744 } 12745 12746 try { 12747 const cidToGidMap = dict.get("CIDToGIDMap"); 12748 12749 if (cidToGidMap instanceof _base_stream.BaseStream) { 12750 cidToGidBytes = cidToGidMap.getBytes(); 12751 } 12752 } catch (ex) { 12753 if (!this.options.ignoreErrors) { 12754 throw ex; 12755 } 12756 12757 (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`); 12758 } 12759 } 12760 12761 const differences = []; 12762 let baseEncodingName = null; 12763 let encoding; 12764 12765 if (dict.has("Encoding")) { 12766 encoding = dict.get("Encoding"); 12767 12768 if (encoding instanceof _primitives.Dict) { 12769 baseEncodingName = encoding.get("BaseEncoding"); 12770 baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null; 12771 12772 if (encoding.has("Differences")) { 12773 const diffEncoding = encoding.get("Differences"); 12774 let index = 0; 12775 12776 for (let j = 0, jj = diffEncoding.length; j < jj; j++) { 12777 const data = xref.fetchIfRef(diffEncoding[j]); 12778 12779 if (typeof data === "number") { 12780 index = data; 12781 } else if (data instanceof _primitives.Name) { 12782 differences[index++] = data.name; 12783 } else { 12784 throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`); 12785 } 12786 } 12787 } 12788 } else if (encoding instanceof _primitives.Name) { 12789 baseEncodingName = encoding.name; 12790 } else { 12791 const msg = "Encoding is not a Name nor a Dict"; 12792 12793 if (!this.options.ignoreErrors) { 12794 throw new _util.FormatError(msg); 12795 } 12796 12797 (0, _util.warn)(msg); 12798 } 12799 12800 if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") { 12801 baseEncodingName = null; 12802 } 12803 } 12804 12805 if (baseEncodingName) { 12806 properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName); 12807 } else { 12808 const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic); 12809 const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic); 12810 encoding = _encodings.StandardEncoding; 12811 12812 if (properties.type === "TrueType" && !isNonsymbolicFont) { 12813 encoding = _encodings.WinAnsiEncoding; 12814 } 12815 12816 if (isSymbolicFont) { 12817 encoding = _encodings.MacRomanEncoding; 12818 12819 if (!properties.file || properties.isInternalFont) { 12820 if (/Symbol/i.test(properties.name)) { 12821 encoding = _encodings.SymbolSetEncoding; 12822 } else if (/Dingbats|Wingdings/i.test(properties.name)) { 12823 encoding = _encodings.ZapfDingbatsEncoding; 12824 } 12825 } 12826 } 12827 12828 properties.defaultEncoding = encoding; 12829 } 12830 12831 properties.differences = differences; 12832 properties.baseEncodingName = baseEncodingName; 12833 properties.hasEncoding = !!baseEncodingName || differences.length > 0; 12834 properties.dict = dict; 12835 return toUnicodePromise.then(readToUnicode => { 12836 properties.toUnicode = readToUnicode; 12837 return this.buildToUnicode(properties); 12838 }).then(builtToUnicode => { 12839 properties.toUnicode = builtToUnicode; 12840 12841 if (cidToGidBytes) { 12842 properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode); 12843 } 12844 12845 return properties; 12846 }); 12847 } 12848 12849 _simpleFontToUnicode(properties, forceGlyphs = false) { 12850 (0, _util.assert)(!properties.composite, "Must be a simple font."); 12851 const toUnicode = []; 12852 const encoding = properties.defaultEncoding.slice(); 12853 const baseEncodingName = properties.baseEncodingName; 12854 const differences = properties.differences; 12855 12856 for (const charcode in differences) { 12857 const glyphName = differences[charcode]; 12858 12859 if (glyphName === ".notdef") { 12860 continue; 12861 } 12862 12863 encoding[charcode] = glyphName; 12864 } 12865 12866 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 12867 12868 for (const charcode in encoding) { 12869 let glyphName = encoding[charcode]; 12870 12871 if (glyphName === "") { 12872 continue; 12873 } else if (glyphsUnicodeMap[glyphName] === undefined) { 12874 let code = 0; 12875 12876 switch (glyphName[0]) { 12877 case "G": 12878 if (glyphName.length === 3) { 12879 code = parseInt(glyphName.substring(1), 16); 12880 } 12881 12882 break; 12883 12884 case "g": 12885 if (glyphName.length === 5) { 12886 code = parseInt(glyphName.substring(1), 16); 12887 } 12888 12889 break; 12890 12891 case "C": 12892 case "c": 12893 if (glyphName.length >= 3 && glyphName.length <= 4) { 12894 const codeStr = glyphName.substring(1); 12895 12896 if (forceGlyphs) { 12897 code = parseInt(codeStr, 16); 12898 break; 12899 } 12900 12901 code = +codeStr; 12902 12903 if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) { 12904 return this._simpleFontToUnicode(properties, true); 12905 } 12906 } 12907 12908 break; 12909 12910 default: 12911 const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 12912 12913 if (unicode !== -1) { 12914 code = unicode; 12915 } 12916 12917 } 12918 12919 if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) { 12920 if (baseEncodingName && code === +charcode) { 12921 const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName); 12922 12923 if (baseEncoding && (glyphName = baseEncoding[charcode])) { 12924 toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); 12925 continue; 12926 } 12927 } 12928 12929 toUnicode[charcode] = String.fromCodePoint(code); 12930 } 12931 12932 continue; 12933 } 12934 12935 toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); 12936 } 12937 12938 return toUnicode; 12939 } 12940 12941 async buildToUnicode(properties) { 12942 properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0; 12943 12944 if (properties.hasIncludedToUnicodeMap) { 12945 if (!properties.composite && properties.hasEncoding) { 12946 properties.fallbackToUnicode = this._simpleFontToUnicode(properties); 12947 } 12948 12949 return properties.toUnicode; 12950 } 12951 12952 if (!properties.composite) { 12953 return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties)); 12954 } 12955 12956 if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof _cmap.IdentityCMap) || properties.cidSystemInfo.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) { 12957 const { 12958 registry, 12959 ordering 12960 } = properties.cidSystemInfo; 12961 12962 const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`); 12963 12964 const ucs2CMap = await _cmap.CMapFactory.create({ 12965 encoding: ucs2CMapName, 12966 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 12967 useCMap: null 12968 }); 12969 const toUnicode = []; 12970 properties.cMap.forEach(function (charcode, cid) { 12971 if (cid > 0xffff) { 12972 throw new _util.FormatError("Max size of CID is 65,535"); 12973 } 12974 12975 const ucs2 = ucs2CMap.lookup(cid); 12976 12977 if (ucs2) { 12978 toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1)); 12979 } 12980 }); 12981 return new _to_unicode_map.ToUnicodeMap(toUnicode); 12982 } 12983 12984 return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar); 12985 } 12986 12987 readToUnicode(cmapObj) { 12988 if (!cmapObj) { 12989 return Promise.resolve(null); 12990 } 12991 12992 if (cmapObj instanceof _primitives.Name) { 12993 return _cmap.CMapFactory.create({ 12994 encoding: cmapObj, 12995 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 12996 useCMap: null 12997 }).then(function (cmap) { 12998 if (cmap instanceof _cmap.IdentityCMap) { 12999 return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff); 13000 } 13001 13002 return new _to_unicode_map.ToUnicodeMap(cmap.getMap()); 13003 }); 13004 } else if (cmapObj instanceof _base_stream.BaseStream) { 13005 return _cmap.CMapFactory.create({ 13006 encoding: cmapObj, 13007 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 13008 useCMap: null 13009 }).then(function (cmap) { 13010 if (cmap instanceof _cmap.IdentityCMap) { 13011 return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff); 13012 } 13013 13014 const map = new Array(cmap.length); 13015 cmap.forEach(function (charCode, token) { 13016 if (typeof token === "number") { 13017 map[charCode] = String.fromCodePoint(token); 13018 return; 13019 } 13020 13021 const str = []; 13022 13023 for (let k = 0; k < token.length; k += 2) { 13024 const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 13025 13026 if ((w1 & 0xf800) !== 0xd800) { 13027 str.push(w1); 13028 continue; 13029 } 13030 13031 k += 2; 13032 const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 13033 str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000); 13034 } 13035 13036 map[charCode] = String.fromCodePoint(...str); 13037 }); 13038 return new _to_unicode_map.ToUnicodeMap(map); 13039 }, reason => { 13040 if (reason instanceof _util.AbortException) { 13041 return null; 13042 } 13043 13044 if (this.options.ignoreErrors) { 13045 this.handler.send("UnsupportedFeature", { 13046 featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode 13047 }); 13048 (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`); 13049 return null; 13050 } 13051 13052 throw reason; 13053 }); 13054 } 13055 13056 return Promise.resolve(null); 13057 } 13058 13059 readCidToGidMap(glyphsData, toUnicode) { 13060 const result = []; 13061 13062 for (let j = 0, jj = glyphsData.length; j < jj; j++) { 13063 const glyphID = glyphsData[j++] << 8 | glyphsData[j]; 13064 const code = j >> 1; 13065 13066 if (glyphID === 0 && !toUnicode.has(code)) { 13067 continue; 13068 } 13069 13070 result[code] = glyphID; 13071 } 13072 13073 return result; 13074 } 13075 13076 extractWidths(dict, descriptor, properties) { 13077 const xref = this.xref; 13078 let glyphsWidths = []; 13079 let defaultWidth = 0; 13080 const glyphsVMetrics = []; 13081 let defaultVMetrics; 13082 let i, ii, j, jj, start, code, widths; 13083 13084 if (properties.composite) { 13085 defaultWidth = dict.has("DW") ? dict.get("DW") : 1000; 13086 widths = dict.get("W"); 13087 13088 if (widths) { 13089 for (i = 0, ii = widths.length; i < ii; i++) { 13090 start = xref.fetchIfRef(widths[i++]); 13091 code = xref.fetchIfRef(widths[i]); 13092 13093 if (Array.isArray(code)) { 13094 for (j = 0, jj = code.length; j < jj; j++) { 13095 glyphsWidths[start++] = xref.fetchIfRef(code[j]); 13096 } 13097 } else { 13098 const width = xref.fetchIfRef(widths[++i]); 13099 13100 for (j = start; j <= code; j++) { 13101 glyphsWidths[j] = width; 13102 } 13103 } 13104 } 13105 } 13106 13107 if (properties.vertical) { 13108 let vmetrics = dict.getArray("DW2") || [880, -1000]; 13109 defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]]; 13110 vmetrics = dict.get("W2"); 13111 13112 if (vmetrics) { 13113 for (i = 0, ii = vmetrics.length; i < ii; i++) { 13114 start = xref.fetchIfRef(vmetrics[i++]); 13115 code = xref.fetchIfRef(vmetrics[i]); 13116 13117 if (Array.isArray(code)) { 13118 for (j = 0, jj = code.length; j < jj; j++) { 13119 glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])]; 13120 } 13121 } else { 13122 const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])]; 13123 13124 for (j = start; j <= code; j++) { 13125 glyphsVMetrics[j] = vmetric; 13126 } 13127 } 13128 } 13129 } 13130 } 13131 } else { 13132 const firstChar = properties.firstChar; 13133 widths = dict.get("Widths"); 13134 13135 if (widths) { 13136 j = firstChar; 13137 13138 for (i = 0, ii = widths.length; i < ii; i++) { 13139 glyphsWidths[j++] = xref.fetchIfRef(widths[i]); 13140 } 13141 13142 defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0; 13143 } else { 13144 const baseFontName = dict.get("BaseFont"); 13145 13146 if (baseFontName instanceof _primitives.Name) { 13147 const metrics = this.getBaseFontMetrics(baseFontName.name); 13148 glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties); 13149 defaultWidth = metrics.defaultWidth; 13150 } 13151 } 13152 } 13153 13154 let isMonospace = true; 13155 let firstWidth = defaultWidth; 13156 13157 for (const glyph in glyphsWidths) { 13158 const glyphWidth = glyphsWidths[glyph]; 13159 13160 if (!glyphWidth) { 13161 continue; 13162 } 13163 13164 if (!firstWidth) { 13165 firstWidth = glyphWidth; 13166 continue; 13167 } 13168 13169 if (firstWidth !== glyphWidth) { 13170 isMonospace = false; 13171 break; 13172 } 13173 } 13174 13175 if (isMonospace) { 13176 properties.flags |= _fonts_utils.FontFlags.FixedPitch; 13177 } 13178 13179 properties.defaultWidth = defaultWidth; 13180 properties.widths = glyphsWidths; 13181 properties.defaultVMetrics = defaultVMetrics; 13182 properties.vmetrics = glyphsVMetrics; 13183 } 13184 13185 isSerifFont(baseFontName) { 13186 const fontNameWoStyle = baseFontName.split("-")[0]; 13187 return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1; 13188 } 13189 13190 getBaseFontMetrics(name) { 13191 let defaultWidth = 0; 13192 let widths = Object.create(null); 13193 let monospace = false; 13194 const stdFontMap = (0, _standard_fonts.getStdFontMap)(); 13195 let lookupName = stdFontMap[name] || name; 13196 const Metrics = (0, _metrics.getMetrics)(); 13197 13198 if (!(lookupName in Metrics)) { 13199 if (this.isSerifFont(name)) { 13200 lookupName = "Times-Roman"; 13201 } else { 13202 lookupName = "Helvetica"; 13203 } 13204 } 13205 13206 const glyphWidths = Metrics[lookupName]; 13207 13208 if (typeof glyphWidths === "number") { 13209 defaultWidth = glyphWidths; 13210 monospace = true; 13211 } else { 13212 widths = glyphWidths(); 13213 } 13214 13215 return { 13216 defaultWidth, 13217 monospace, 13218 widths 13219 }; 13220 } 13221 13222 buildCharCodeToWidth(widthsByGlyphName, properties) { 13223 const widths = Object.create(null); 13224 const differences = properties.differences; 13225 const encoding = properties.defaultEncoding; 13226 13227 for (let charCode = 0; charCode < 256; charCode++) { 13228 if (charCode in differences && widthsByGlyphName[differences[charCode]]) { 13229 widths[charCode] = widthsByGlyphName[differences[charCode]]; 13230 continue; 13231 } 13232 13233 if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) { 13234 widths[charCode] = widthsByGlyphName[encoding[charCode]]; 13235 continue; 13236 } 13237 } 13238 13239 return widths; 13240 } 13241 13242 preEvaluateFont(dict) { 13243 const baseDict = dict; 13244 let type = dict.get("Subtype"); 13245 13246 if (!(type instanceof _primitives.Name)) { 13247 throw new _util.FormatError("invalid font Subtype"); 13248 } 13249 13250 let composite = false; 13251 let hash, toUnicode; 13252 13253 if (type.name === "Type0") { 13254 const df = dict.get("DescendantFonts"); 13255 13256 if (!df) { 13257 throw new _util.FormatError("Descendant fonts are not specified"); 13258 } 13259 13260 dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df; 13261 13262 if (!(dict instanceof _primitives.Dict)) { 13263 throw new _util.FormatError("Descendant font is not a dictionary."); 13264 } 13265 13266 type = dict.get("Subtype"); 13267 13268 if (!(type instanceof _primitives.Name)) { 13269 throw new _util.FormatError("invalid font Subtype"); 13270 } 13271 13272 composite = true; 13273 } 13274 13275 const firstChar = dict.get("FirstChar") || 0, 13276 lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff); 13277 const descriptor = dict.get("FontDescriptor"); 13278 13279 if (descriptor) { 13280 hash = new _murmurhash.MurmurHash3_64(); 13281 const encoding = baseDict.getRaw("Encoding"); 13282 13283 if (encoding instanceof _primitives.Name) { 13284 hash.update(encoding.name); 13285 } else if (encoding instanceof _primitives.Ref) { 13286 hash.update(encoding.toString()); 13287 } else if (encoding instanceof _primitives.Dict) { 13288 for (const entry of encoding.getRawValues()) { 13289 if (entry instanceof _primitives.Name) { 13290 hash.update(entry.name); 13291 } else if (entry instanceof _primitives.Ref) { 13292 hash.update(entry.toString()); 13293 } else if (Array.isArray(entry)) { 13294 const diffLength = entry.length, 13295 diffBuf = new Array(diffLength); 13296 13297 for (let j = 0; j < diffLength; j++) { 13298 const diffEntry = entry[j]; 13299 13300 if (diffEntry instanceof _primitives.Name) { 13301 diffBuf[j] = diffEntry.name; 13302 } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) { 13303 diffBuf[j] = diffEntry.toString(); 13304 } 13305 } 13306 13307 hash.update(diffBuf.join()); 13308 } 13309 } 13310 } 13311 13312 hash.update(`${firstChar}-${lastChar}`); 13313 toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode"); 13314 13315 if (toUnicode instanceof _base_stream.BaseStream) { 13316 const stream = toUnicode.str || toUnicode; 13317 const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start); 13318 hash.update(uint8array); 13319 } else if (toUnicode instanceof _primitives.Name) { 13320 hash.update(toUnicode.name); 13321 } 13322 13323 const widths = dict.get("Widths") || baseDict.get("Widths"); 13324 13325 if (Array.isArray(widths)) { 13326 const widthsBuf = []; 13327 13328 for (const entry of widths) { 13329 if (typeof entry === "number" || entry instanceof _primitives.Ref) { 13330 widthsBuf.push(entry.toString()); 13331 } 13332 } 13333 13334 hash.update(widthsBuf.join()); 13335 } 13336 13337 if (composite) { 13338 hash.update("compositeFont"); 13339 const compositeWidths = dict.get("W") || baseDict.get("W"); 13340 13341 if (Array.isArray(compositeWidths)) { 13342 const widthsBuf = []; 13343 13344 for (const entry of compositeWidths) { 13345 if (typeof entry === "number" || entry instanceof _primitives.Ref) { 13346 widthsBuf.push(entry.toString()); 13347 } else if (Array.isArray(entry)) { 13348 const subWidthsBuf = []; 13349 13350 for (const element of entry) { 13351 if (typeof element === "number" || element instanceof _primitives.Ref) { 13352 subWidthsBuf.push(element.toString()); 13353 } 13354 } 13355 13356 widthsBuf.push(`[${subWidthsBuf.join()}]`); 13357 } 13358 } 13359 13360 hash.update(widthsBuf.join()); 13361 } 13362 13363 const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap"); 13364 13365 if (cidToGidMap instanceof _primitives.Name) { 13366 hash.update(cidToGidMap.name); 13367 } else if (cidToGidMap instanceof _primitives.Ref) { 13368 hash.update(cidToGidMap.toString()); 13369 } else if (cidToGidMap instanceof _base_stream.BaseStream) { 13370 hash.update(cidToGidMap.peekBytes()); 13371 } 13372 } 13373 } 13374 13375 return { 13376 descriptor, 13377 dict, 13378 baseDict, 13379 composite, 13380 type: type.name, 13381 firstChar, 13382 lastChar, 13383 toUnicode, 13384 hash: hash ? hash.hexdigest() : "" 13385 }; 13386 } 13387 13388 async translateFont({ 13389 descriptor, 13390 dict, 13391 baseDict, 13392 composite, 13393 type, 13394 firstChar, 13395 lastChar, 13396 toUnicode, 13397 cssFontInfo 13398 }) { 13399 const isType3Font = type === "Type3"; 13400 let properties; 13401 13402 if (!descriptor) { 13403 if (isType3Font) { 13404 descriptor = new _primitives.Dict(null); 13405 descriptor.set("FontName", _primitives.Name.get(type)); 13406 descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]); 13407 } else { 13408 let baseFontName = dict.get("BaseFont"); 13409 13410 if (!(baseFontName instanceof _primitives.Name)) { 13411 throw new _util.FormatError("Base font is not specified"); 13412 } 13413 13414 baseFontName = baseFontName.name.replace(/[,_]/g, "-"); 13415 const metrics = this.getBaseFontMetrics(baseFontName); 13416 const fontNameWoStyle = baseFontName.split("-")[0]; 13417 const flags = (this.isSerifFont(fontNameWoStyle) ? _fonts_utils.FontFlags.Serif : 0) | (metrics.monospace ? _fonts_utils.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts_utils.FontFlags.Symbolic : _fonts_utils.FontFlags.Nonsymbolic); 13418 properties = { 13419 type, 13420 name: baseFontName, 13421 loadedName: baseDict.loadedName, 13422 widths: metrics.widths, 13423 defaultWidth: metrics.defaultWidth, 13424 isSimulatedFlags: true, 13425 flags, 13426 firstChar, 13427 lastChar, 13428 toUnicode, 13429 xHeight: 0, 13430 capHeight: 0, 13431 italicAngle: 0, 13432 isType3Font 13433 }; 13434 const widths = dict.get("Widths"); 13435 const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName); 13436 let file = null; 13437 13438 if (standardFontName) { 13439 properties.isStandardFont = true; 13440 file = await this.fetchStandardFontData(standardFontName); 13441 properties.isInternalFont = !!file; 13442 } 13443 13444 return this.extractDataStructures(dict, dict, properties).then(newProperties => { 13445 if (widths) { 13446 const glyphWidths = []; 13447 let j = firstChar; 13448 13449 for (let i = 0, ii = widths.length; i < ii; i++) { 13450 glyphWidths[j++] = this.xref.fetchIfRef(widths[i]); 13451 } 13452 13453 newProperties.widths = glyphWidths; 13454 } else { 13455 newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties); 13456 } 13457 13458 return new _fonts.Font(baseFontName, file, newProperties); 13459 }); 13460 } 13461 } 13462 13463 let fontName = descriptor.get("FontName"); 13464 let baseFont = dict.get("BaseFont"); 13465 13466 if (typeof fontName === "string") { 13467 fontName = _primitives.Name.get(fontName); 13468 } 13469 13470 if (typeof baseFont === "string") { 13471 baseFont = _primitives.Name.get(baseFont); 13472 } 13473 13474 if (!isType3Font) { 13475 const fontNameStr = fontName && fontName.name; 13476 const baseFontStr = baseFont && baseFont.name; 13477 13478 if (fontNameStr !== baseFontStr) { 13479 (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`); 13480 13481 if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) { 13482 fontName = baseFont; 13483 } 13484 } 13485 } 13486 13487 fontName = fontName || baseFont; 13488 13489 if (!(fontName instanceof _primitives.Name)) { 13490 throw new _util.FormatError("invalid font name"); 13491 } 13492 13493 let fontFile, subtype, length1, length2, length3; 13494 13495 try { 13496 fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3"); 13497 } catch (ex) { 13498 if (!this.options.ignoreErrors) { 13499 throw ex; 13500 } 13501 13502 (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`); 13503 fontFile = new _stream.NullStream(); 13504 } 13505 13506 let isStandardFont = false; 13507 let isInternalFont = false; 13508 let glyphScaleFactors = null; 13509 13510 if (fontFile) { 13511 if (fontFile.dict) { 13512 const subtypeEntry = fontFile.dict.get("Subtype"); 13513 13514 if (subtypeEntry instanceof _primitives.Name) { 13515 subtype = subtypeEntry.name; 13516 } 13517 13518 length1 = fontFile.dict.get("Length1"); 13519 length2 = fontFile.dict.get("Length2"); 13520 length3 = fontFile.dict.get("Length3"); 13521 } 13522 } else if (cssFontInfo) { 13523 const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name); 13524 13525 if (standardFontName) { 13526 cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`; 13527 cssFontInfo.metrics = standardFontName.metrics || null; 13528 glyphScaleFactors = standardFontName.factors || null; 13529 fontFile = await this.fetchStandardFontData(standardFontName.name); 13530 isInternalFont = !!fontFile; 13531 baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name); 13532 composite = true; 13533 } 13534 } else if (!isType3Font) { 13535 const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name); 13536 13537 if (standardFontName) { 13538 isStandardFont = true; 13539 fontFile = await this.fetchStandardFontData(standardFontName); 13540 isInternalFont = !!fontFile; 13541 } 13542 } 13543 13544 properties = { 13545 type, 13546 name: fontName.name, 13547 subtype, 13548 file: fontFile, 13549 length1, 13550 length2, 13551 length3, 13552 isStandardFont, 13553 isInternalFont, 13554 loadedName: baseDict.loadedName, 13555 composite, 13556 fixedPitch: false, 13557 fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX, 13558 firstChar, 13559 lastChar, 13560 toUnicode, 13561 bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"), 13562 ascent: descriptor.get("Ascent"), 13563 descent: descriptor.get("Descent"), 13564 xHeight: descriptor.get("XHeight") || 0, 13565 capHeight: descriptor.get("CapHeight") || 0, 13566 flags: descriptor.get("Flags"), 13567 italicAngle: descriptor.get("ItalicAngle") || 0, 13568 isType3Font, 13569 cssFontInfo, 13570 scaleFactors: glyphScaleFactors 13571 }; 13572 13573 if (composite) { 13574 const cidEncoding = baseDict.get("Encoding"); 13575 13576 if (cidEncoding instanceof _primitives.Name) { 13577 properties.cidEncoding = cidEncoding.name; 13578 } 13579 13580 const cMap = await _cmap.CMapFactory.create({ 13581 encoding: cidEncoding, 13582 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 13583 useCMap: null 13584 }); 13585 properties.cMap = cMap; 13586 properties.vertical = properties.cMap.vertical; 13587 } 13588 13589 return this.extractDataStructures(dict, baseDict, properties).then(newProperties => { 13590 this.extractWidths(dict, descriptor, newProperties); 13591 return new _fonts.Font(fontName.name, fontFile, newProperties); 13592 }); 13593 } 13594 13595 static buildFontPaths(font, glyphs, handler, evaluatorOptions) { 13596 function buildPath(fontChar) { 13597 const glyphName = `${font.loadedName}_path_${fontChar}`; 13598 13599 try { 13600 if (font.renderer.hasBuiltPath(fontChar)) { 13601 return; 13602 } 13603 13604 handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]); 13605 } catch (reason) { 13606 if (evaluatorOptions.ignoreErrors) { 13607 handler.send("UnsupportedFeature", { 13608 featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath 13609 }); 13610 (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`); 13611 return; 13612 } 13613 13614 throw reason; 13615 } 13616 } 13617 13618 for (const glyph of glyphs) { 13619 buildPath(glyph.fontChar); 13620 const accent = glyph.accent; 13621 13622 if (accent && accent.fontChar) { 13623 buildPath(accent.fontChar); 13624 } 13625 } 13626 } 13627 13628 static get fallbackFontDict() { 13629 const dict = new _primitives.Dict(); 13630 dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont")); 13631 dict.set("Type", _primitives.Name.get("FallbackType")); 13632 dict.set("Subtype", _primitives.Name.get("FallbackType")); 13633 dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding")); 13634 return (0, _util.shadow)(this, "fallbackFontDict", dict); 13635 } 13636 13637} 13638 13639exports.PartialEvaluator = PartialEvaluator; 13640 13641class TranslatedFont { 13642 constructor({ 13643 loadedName, 13644 font, 13645 dict, 13646 evaluatorOptions 13647 }) { 13648 this.loadedName = loadedName; 13649 this.font = font; 13650 this.dict = dict; 13651 this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions; 13652 this.type3Loaded = null; 13653 this.type3Dependencies = font.isType3Font ? new Set() : null; 13654 this.sent = false; 13655 } 13656 13657 send(handler) { 13658 if (this.sent) { 13659 return; 13660 } 13661 13662 this.sent = true; 13663 handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]); 13664 } 13665 13666 fallback(handler) { 13667 if (!this.font.data) { 13668 return; 13669 } 13670 13671 this.font.disableFontFace = true; 13672 PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions); 13673 } 13674 13675 loadType3Data(evaluator, resources, task) { 13676 if (this.type3Loaded) { 13677 return this.type3Loaded; 13678 } 13679 13680 if (!this.font.isType3Font) { 13681 throw new Error("Must be a Type3 font."); 13682 } 13683 13684 const type3Evaluator = evaluator.clone({ 13685 ignoreErrors: false 13686 }); 13687 type3Evaluator.parsingType3Font = true; 13688 const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs); 13689 13690 if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) { 13691 type3FontRefs.put(this.dict.objId); 13692 } 13693 13694 type3Evaluator.type3FontRefs = type3FontRefs; 13695 const translatedFont = this.font, 13696 type3Dependencies = this.type3Dependencies; 13697 let loadCharProcsPromise = Promise.resolve(); 13698 const charProcs = this.dict.get("CharProcs"); 13699 const fontResources = this.dict.get("Resources") || resources; 13700 const charProcOperatorList = Object.create(null); 13701 13702 const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]), 13703 width = fontBBox[2] - fontBBox[0], 13704 height = fontBBox[3] - fontBBox[1]; 13705 13706 const fontBBoxSize = Math.hypot(width, height); 13707 13708 for (const key of charProcs.getKeys()) { 13709 loadCharProcsPromise = loadCharProcsPromise.then(() => { 13710 const glyphStream = charProcs.get(key); 13711 const operatorList = new _operator_list.OperatorList(); 13712 return type3Evaluator.getOperatorList({ 13713 stream: glyphStream, 13714 task, 13715 resources: fontResources, 13716 operatorList 13717 }).then(() => { 13718 if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) { 13719 this._removeType3ColorOperators(operatorList, fontBBoxSize); 13720 } 13721 13722 charProcOperatorList[key] = operatorList.getIR(); 13723 13724 for (const dependency of operatorList.dependencies) { 13725 type3Dependencies.add(dependency); 13726 } 13727 }).catch(function (reason) { 13728 (0, _util.warn)(`Type3 font resource "${key}" is not available.`); 13729 const dummyOperatorList = new _operator_list.OperatorList(); 13730 charProcOperatorList[key] = dummyOperatorList.getIR(); 13731 }); 13732 }); 13733 } 13734 13735 this.type3Loaded = loadCharProcsPromise.then(() => { 13736 translatedFont.charProcOperatorList = charProcOperatorList; 13737 13738 if (this._bbox) { 13739 translatedFont.isCharBBox = true; 13740 translatedFont.bbox = this._bbox; 13741 } 13742 }); 13743 return this.type3Loaded; 13744 } 13745 13746 _removeType3ColorOperators(operatorList, fontBBoxSize = NaN) { 13747 const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)), 13748 width = charBBox[2] - charBBox[0], 13749 height = charBBox[3] - charBBox[1]; 13750 13751 const charBBoxSize = Math.hypot(width, height); 13752 13753 if (width === 0 || height === 0) { 13754 operatorList.fnArray.splice(0, 1); 13755 operatorList.argsArray.splice(0, 1); 13756 } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) { 13757 if (!this._bbox) { 13758 this._bbox = [Infinity, Infinity, -Infinity, -Infinity]; 13759 } 13760 13761 this._bbox[0] = Math.min(this._bbox[0], charBBox[0]); 13762 this._bbox[1] = Math.min(this._bbox[1], charBBox[1]); 13763 this._bbox[2] = Math.max(this._bbox[2], charBBox[2]); 13764 this._bbox[3] = Math.max(this._bbox[3], charBBox[3]); 13765 } 13766 13767 let i = 0, 13768 ii = operatorList.length; 13769 13770 while (i < ii) { 13771 switch (operatorList.fnArray[i]) { 13772 case _util.OPS.setCharWidthAndBounds: 13773 break; 13774 13775 case _util.OPS.setStrokeColorSpace: 13776 case _util.OPS.setFillColorSpace: 13777 case _util.OPS.setStrokeColor: 13778 case _util.OPS.setStrokeColorN: 13779 case _util.OPS.setFillColor: 13780 case _util.OPS.setFillColorN: 13781 case _util.OPS.setStrokeGray: 13782 case _util.OPS.setFillGray: 13783 case _util.OPS.setStrokeRGBColor: 13784 case _util.OPS.setFillRGBColor: 13785 case _util.OPS.setStrokeCMYKColor: 13786 case _util.OPS.setFillCMYKColor: 13787 case _util.OPS.shadingFill: 13788 case _util.OPS.setRenderingIntent: 13789 operatorList.fnArray.splice(i, 1); 13790 operatorList.argsArray.splice(i, 1); 13791 ii--; 13792 continue; 13793 13794 case _util.OPS.setGState: 13795 const [gStateObj] = operatorList.argsArray[i]; 13796 let j = 0, 13797 jj = gStateObj.length; 13798 13799 while (j < jj) { 13800 const [gStateKey] = gStateObj[j]; 13801 13802 switch (gStateKey) { 13803 case "TR": 13804 case "TR2": 13805 case "HT": 13806 case "BG": 13807 case "BG2": 13808 case "UCR": 13809 case "UCR2": 13810 gStateObj.splice(j, 1); 13811 jj--; 13812 continue; 13813 } 13814 13815 j++; 13816 } 13817 13818 break; 13819 } 13820 13821 i++; 13822 } 13823 } 13824 13825} 13826 13827class StateManager { 13828 constructor(initialState = new EvalState()) { 13829 this.state = initialState; 13830 this.stateStack = []; 13831 } 13832 13833 save() { 13834 const old = this.state; 13835 this.stateStack.push(this.state); 13836 this.state = old.clone(); 13837 } 13838 13839 restore() { 13840 const prev = this.stateStack.pop(); 13841 13842 if (prev) { 13843 this.state = prev; 13844 } 13845 } 13846 13847 transform(args) { 13848 this.state.ctm = _util.Util.transform(this.state.ctm, args); 13849 } 13850 13851} 13852 13853class TextState { 13854 constructor() { 13855 this.ctm = new Float32Array(_util.IDENTITY_MATRIX); 13856 this.fontName = null; 13857 this.fontSize = 0; 13858 this.font = null; 13859 this.fontMatrix = _util.FONT_IDENTITY_MATRIX; 13860 this.textMatrix = _util.IDENTITY_MATRIX.slice(); 13861 this.textLineMatrix = _util.IDENTITY_MATRIX.slice(); 13862 this.charSpacing = 0; 13863 this.wordSpacing = 0; 13864 this.leading = 0; 13865 this.textHScale = 1; 13866 this.textRise = 0; 13867 } 13868 13869 setTextMatrix(a, b, c, d, e, f) { 13870 const m = this.textMatrix; 13871 m[0] = a; 13872 m[1] = b; 13873 m[2] = c; 13874 m[3] = d; 13875 m[4] = e; 13876 m[5] = f; 13877 } 13878 13879 setTextLineMatrix(a, b, c, d, e, f) { 13880 const m = this.textLineMatrix; 13881 m[0] = a; 13882 m[1] = b; 13883 m[2] = c; 13884 m[3] = d; 13885 m[4] = e; 13886 m[5] = f; 13887 } 13888 13889 translateTextMatrix(x, y) { 13890 const m = this.textMatrix; 13891 m[4] = m[0] * x + m[2] * y + m[4]; 13892 m[5] = m[1] * x + m[3] * y + m[5]; 13893 } 13894 13895 translateTextLineMatrix(x, y) { 13896 const m = this.textLineMatrix; 13897 m[4] = m[0] * x + m[2] * y + m[4]; 13898 m[5] = m[1] * x + m[3] * y + m[5]; 13899 } 13900 13901 carriageReturn() { 13902 this.translateTextLineMatrix(0, -this.leading); 13903 this.textMatrix = this.textLineMatrix.slice(); 13904 } 13905 13906 clone() { 13907 const clone = Object.create(this); 13908 clone.textMatrix = this.textMatrix.slice(); 13909 clone.textLineMatrix = this.textLineMatrix.slice(); 13910 clone.fontMatrix = this.fontMatrix.slice(); 13911 return clone; 13912 } 13913 13914} 13915 13916class EvalState { 13917 constructor() { 13918 this.ctm = new Float32Array(_util.IDENTITY_MATRIX); 13919 this.font = null; 13920 this.textRenderingMode = _util.TextRenderingMode.FILL; 13921 this.fillColorSpace = _colorspace.ColorSpace.singletons.gray; 13922 this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray; 13923 } 13924 13925 clone() { 13926 return Object.create(this); 13927 } 13928 13929} 13930 13931class EvaluatorPreprocessor { 13932 static get opMap() { 13933 const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) { 13934 t.w = { 13935 id: _util.OPS.setLineWidth, 13936 numArgs: 1, 13937 variableArgs: false 13938 }; 13939 t.J = { 13940 id: _util.OPS.setLineCap, 13941 numArgs: 1, 13942 variableArgs: false 13943 }; 13944 t.j = { 13945 id: _util.OPS.setLineJoin, 13946 numArgs: 1, 13947 variableArgs: false 13948 }; 13949 t.M = { 13950 id: _util.OPS.setMiterLimit, 13951 numArgs: 1, 13952 variableArgs: false 13953 }; 13954 t.d = { 13955 id: _util.OPS.setDash, 13956 numArgs: 2, 13957 variableArgs: false 13958 }; 13959 t.ri = { 13960 id: _util.OPS.setRenderingIntent, 13961 numArgs: 1, 13962 variableArgs: false 13963 }; 13964 t.i = { 13965 id: _util.OPS.setFlatness, 13966 numArgs: 1, 13967 variableArgs: false 13968 }; 13969 t.gs = { 13970 id: _util.OPS.setGState, 13971 numArgs: 1, 13972 variableArgs: false 13973 }; 13974 t.q = { 13975 id: _util.OPS.save, 13976 numArgs: 0, 13977 variableArgs: false 13978 }; 13979 t.Q = { 13980 id: _util.OPS.restore, 13981 numArgs: 0, 13982 variableArgs: false 13983 }; 13984 t.cm = { 13985 id: _util.OPS.transform, 13986 numArgs: 6, 13987 variableArgs: false 13988 }; 13989 t.m = { 13990 id: _util.OPS.moveTo, 13991 numArgs: 2, 13992 variableArgs: false 13993 }; 13994 t.l = { 13995 id: _util.OPS.lineTo, 13996 numArgs: 2, 13997 variableArgs: false 13998 }; 13999 t.c = { 14000 id: _util.OPS.curveTo, 14001 numArgs: 6, 14002 variableArgs: false 14003 }; 14004 t.v = { 14005 id: _util.OPS.curveTo2, 14006 numArgs: 4, 14007 variableArgs: false 14008 }; 14009 t.y = { 14010 id: _util.OPS.curveTo3, 14011 numArgs: 4, 14012 variableArgs: false 14013 }; 14014 t.h = { 14015 id: _util.OPS.closePath, 14016 numArgs: 0, 14017 variableArgs: false 14018 }; 14019 t.re = { 14020 id: _util.OPS.rectangle, 14021 numArgs: 4, 14022 variableArgs: false 14023 }; 14024 t.S = { 14025 id: _util.OPS.stroke, 14026 numArgs: 0, 14027 variableArgs: false 14028 }; 14029 t.s = { 14030 id: _util.OPS.closeStroke, 14031 numArgs: 0, 14032 variableArgs: false 14033 }; 14034 t.f = { 14035 id: _util.OPS.fill, 14036 numArgs: 0, 14037 variableArgs: false 14038 }; 14039 t.F = { 14040 id: _util.OPS.fill, 14041 numArgs: 0, 14042 variableArgs: false 14043 }; 14044 t["f*"] = { 14045 id: _util.OPS.eoFill, 14046 numArgs: 0, 14047 variableArgs: false 14048 }; 14049 t.B = { 14050 id: _util.OPS.fillStroke, 14051 numArgs: 0, 14052 variableArgs: false 14053 }; 14054 t["B*"] = { 14055 id: _util.OPS.eoFillStroke, 14056 numArgs: 0, 14057 variableArgs: false 14058 }; 14059 t.b = { 14060 id: _util.OPS.closeFillStroke, 14061 numArgs: 0, 14062 variableArgs: false 14063 }; 14064 t["b*"] = { 14065 id: _util.OPS.closeEOFillStroke, 14066 numArgs: 0, 14067 variableArgs: false 14068 }; 14069 t.n = { 14070 id: _util.OPS.endPath, 14071 numArgs: 0, 14072 variableArgs: false 14073 }; 14074 t.W = { 14075 id: _util.OPS.clip, 14076 numArgs: 0, 14077 variableArgs: false 14078 }; 14079 t["W*"] = { 14080 id: _util.OPS.eoClip, 14081 numArgs: 0, 14082 variableArgs: false 14083 }; 14084 t.BT = { 14085 id: _util.OPS.beginText, 14086 numArgs: 0, 14087 variableArgs: false 14088 }; 14089 t.ET = { 14090 id: _util.OPS.endText, 14091 numArgs: 0, 14092 variableArgs: false 14093 }; 14094 t.Tc = { 14095 id: _util.OPS.setCharSpacing, 14096 numArgs: 1, 14097 variableArgs: false 14098 }; 14099 t.Tw = { 14100 id: _util.OPS.setWordSpacing, 14101 numArgs: 1, 14102 variableArgs: false 14103 }; 14104 t.Tz = { 14105 id: _util.OPS.setHScale, 14106 numArgs: 1, 14107 variableArgs: false 14108 }; 14109 t.TL = { 14110 id: _util.OPS.setLeading, 14111 numArgs: 1, 14112 variableArgs: false 14113 }; 14114 t.Tf = { 14115 id: _util.OPS.setFont, 14116 numArgs: 2, 14117 variableArgs: false 14118 }; 14119 t.Tr = { 14120 id: _util.OPS.setTextRenderingMode, 14121 numArgs: 1, 14122 variableArgs: false 14123 }; 14124 t.Ts = { 14125 id: _util.OPS.setTextRise, 14126 numArgs: 1, 14127 variableArgs: false 14128 }; 14129 t.Td = { 14130 id: _util.OPS.moveText, 14131 numArgs: 2, 14132 variableArgs: false 14133 }; 14134 t.TD = { 14135 id: _util.OPS.setLeadingMoveText, 14136 numArgs: 2, 14137 variableArgs: false 14138 }; 14139 t.Tm = { 14140 id: _util.OPS.setTextMatrix, 14141 numArgs: 6, 14142 variableArgs: false 14143 }; 14144 t["T*"] = { 14145 id: _util.OPS.nextLine, 14146 numArgs: 0, 14147 variableArgs: false 14148 }; 14149 t.Tj = { 14150 id: _util.OPS.showText, 14151 numArgs: 1, 14152 variableArgs: false 14153 }; 14154 t.TJ = { 14155 id: _util.OPS.showSpacedText, 14156 numArgs: 1, 14157 variableArgs: false 14158 }; 14159 t["'"] = { 14160 id: _util.OPS.nextLineShowText, 14161 numArgs: 1, 14162 variableArgs: false 14163 }; 14164 t['"'] = { 14165 id: _util.OPS.nextLineSetSpacingShowText, 14166 numArgs: 3, 14167 variableArgs: false 14168 }; 14169 t.d0 = { 14170 id: _util.OPS.setCharWidth, 14171 numArgs: 2, 14172 variableArgs: false 14173 }; 14174 t.d1 = { 14175 id: _util.OPS.setCharWidthAndBounds, 14176 numArgs: 6, 14177 variableArgs: false 14178 }; 14179 t.CS = { 14180 id: _util.OPS.setStrokeColorSpace, 14181 numArgs: 1, 14182 variableArgs: false 14183 }; 14184 t.cs = { 14185 id: _util.OPS.setFillColorSpace, 14186 numArgs: 1, 14187 variableArgs: false 14188 }; 14189 t.SC = { 14190 id: _util.OPS.setStrokeColor, 14191 numArgs: 4, 14192 variableArgs: true 14193 }; 14194 t.SCN = { 14195 id: _util.OPS.setStrokeColorN, 14196 numArgs: 33, 14197 variableArgs: true 14198 }; 14199 t.sc = { 14200 id: _util.OPS.setFillColor, 14201 numArgs: 4, 14202 variableArgs: true 14203 }; 14204 t.scn = { 14205 id: _util.OPS.setFillColorN, 14206 numArgs: 33, 14207 variableArgs: true 14208 }; 14209 t.G = { 14210 id: _util.OPS.setStrokeGray, 14211 numArgs: 1, 14212 variableArgs: false 14213 }; 14214 t.g = { 14215 id: _util.OPS.setFillGray, 14216 numArgs: 1, 14217 variableArgs: false 14218 }; 14219 t.RG = { 14220 id: _util.OPS.setStrokeRGBColor, 14221 numArgs: 3, 14222 variableArgs: false 14223 }; 14224 t.rg = { 14225 id: _util.OPS.setFillRGBColor, 14226 numArgs: 3, 14227 variableArgs: false 14228 }; 14229 t.K = { 14230 id: _util.OPS.setStrokeCMYKColor, 14231 numArgs: 4, 14232 variableArgs: false 14233 }; 14234 t.k = { 14235 id: _util.OPS.setFillCMYKColor, 14236 numArgs: 4, 14237 variableArgs: false 14238 }; 14239 t.sh = { 14240 id: _util.OPS.shadingFill, 14241 numArgs: 1, 14242 variableArgs: false 14243 }; 14244 t.BI = { 14245 id: _util.OPS.beginInlineImage, 14246 numArgs: 0, 14247 variableArgs: false 14248 }; 14249 t.ID = { 14250 id: _util.OPS.beginImageData, 14251 numArgs: 0, 14252 variableArgs: false 14253 }; 14254 t.EI = { 14255 id: _util.OPS.endInlineImage, 14256 numArgs: 1, 14257 variableArgs: false 14258 }; 14259 t.Do = { 14260 id: _util.OPS.paintXObject, 14261 numArgs: 1, 14262 variableArgs: false 14263 }; 14264 t.MP = { 14265 id: _util.OPS.markPoint, 14266 numArgs: 1, 14267 variableArgs: false 14268 }; 14269 t.DP = { 14270 id: _util.OPS.markPointProps, 14271 numArgs: 2, 14272 variableArgs: false 14273 }; 14274 t.BMC = { 14275 id: _util.OPS.beginMarkedContent, 14276 numArgs: 1, 14277 variableArgs: false 14278 }; 14279 t.BDC = { 14280 id: _util.OPS.beginMarkedContentProps, 14281 numArgs: 2, 14282 variableArgs: false 14283 }; 14284 t.EMC = { 14285 id: _util.OPS.endMarkedContent, 14286 numArgs: 0, 14287 variableArgs: false 14288 }; 14289 t.BX = { 14290 id: _util.OPS.beginCompat, 14291 numArgs: 0, 14292 variableArgs: false 14293 }; 14294 t.EX = { 14295 id: _util.OPS.endCompat, 14296 numArgs: 0, 14297 variableArgs: false 14298 }; 14299 t.BM = null; 14300 t.BD = null; 14301 t.true = null; 14302 t.fa = null; 14303 t.fal = null; 14304 t.fals = null; 14305 t.false = null; 14306 t.nu = null; 14307 t.nul = null; 14308 t.null = null; 14309 }); 14310 return (0, _util.shadow)(this, "opMap", getOPMap()); 14311 } 14312 14313 static get MAX_INVALID_PATH_OPS() { 14314 return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10); 14315 } 14316 14317 constructor(stream, xref, stateManager = new StateManager()) { 14318 this.parser = new _parser.Parser({ 14319 lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap), 14320 xref 14321 }); 14322 this.stateManager = stateManager; 14323 this.nonProcessedArgs = []; 14324 this._isPathOp = false; 14325 this._numInvalidPathOPS = 0; 14326 } 14327 14328 get savedStatesDepth() { 14329 return this.stateManager.stateStack.length; 14330 } 14331 14332 read(operation) { 14333 let args = operation.args; 14334 14335 while (true) { 14336 const obj = this.parser.getObj(); 14337 14338 if (obj instanceof _primitives.Cmd) { 14339 const cmd = obj.cmd; 14340 const opSpec = EvaluatorPreprocessor.opMap[cmd]; 14341 14342 if (!opSpec) { 14343 (0, _util.warn)(`Unknown command "${cmd}".`); 14344 continue; 14345 } 14346 14347 const fn = opSpec.id; 14348 const numArgs = opSpec.numArgs; 14349 let argsLength = args !== null ? args.length : 0; 14350 14351 if (!this._isPathOp) { 14352 this._numInvalidPathOPS = 0; 14353 } 14354 14355 this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath; 14356 14357 if (!opSpec.variableArgs) { 14358 if (argsLength !== numArgs) { 14359 const nonProcessedArgs = this.nonProcessedArgs; 14360 14361 while (argsLength > numArgs) { 14362 nonProcessedArgs.push(args.shift()); 14363 argsLength--; 14364 } 14365 14366 while (argsLength < numArgs && nonProcessedArgs.length !== 0) { 14367 if (args === null) { 14368 args = []; 14369 } 14370 14371 args.unshift(nonProcessedArgs.pop()); 14372 argsLength++; 14373 } 14374 } 14375 14376 if (argsLength < numArgs) { 14377 const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`; 14378 14379 if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) { 14380 throw new _util.FormatError(`Invalid ${partialMsg}`); 14381 } 14382 14383 (0, _util.warn)(`Skipping ${partialMsg}`); 14384 14385 if (args !== null) { 14386 args.length = 0; 14387 } 14388 14389 continue; 14390 } 14391 } else if (argsLength > numArgs) { 14392 (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`); 14393 } 14394 14395 this.preprocessCommand(fn, args); 14396 operation.fn = fn; 14397 operation.args = args; 14398 return true; 14399 } 14400 14401 if (obj === _primitives.EOF) { 14402 return false; 14403 } 14404 14405 if (obj !== null) { 14406 if (args === null) { 14407 args = []; 14408 } 14409 14410 args.push(obj); 14411 14412 if (args.length > 33) { 14413 throw new _util.FormatError("Too many arguments"); 14414 } 14415 } 14416 } 14417 } 14418 14419 preprocessCommand(fn, args) { 14420 switch (fn | 0) { 14421 case _util.OPS.save: 14422 this.stateManager.save(); 14423 break; 14424 14425 case _util.OPS.restore: 14426 this.stateManager.restore(); 14427 break; 14428 14429 case _util.OPS.transform: 14430 this.stateManager.transform(args); 14431 break; 14432 } 14433 } 14434 14435} 14436 14437exports.EvaluatorPreprocessor = EvaluatorPreprocessor; 14438 14439/***/ }), 14440/* 16 */ 14441/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 14442 14443 14444 14445Object.defineProperty(exports, "__esModule", ({ 14446 value: true 14447})); 14448exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0; 14449 14450var _util = __w_pdfjs_require__(2); 14451 14452var _primitives = __w_pdfjs_require__(5); 14453 14454var _base_stream = __w_pdfjs_require__(7); 14455 14456var _parser = __w_pdfjs_require__(17); 14457 14458var _core_utils = __w_pdfjs_require__(6); 14459 14460var _stream = __w_pdfjs_require__(10); 14461 14462const BUILT_IN_CMAPS = ["Adobe-GB1-UCS2", "Adobe-CNS1-UCS2", "Adobe-Japan1-UCS2", "Adobe-Korea1-UCS2", "78-EUC-H", "78-EUC-V", "78-H", "78-RKSJ-H", "78-RKSJ-V", "78-V", "78ms-RKSJ-H", "78ms-RKSJ-V", "83pv-RKSJ-H", "90ms-RKSJ-H", "90ms-RKSJ-V", "90msp-RKSJ-H", "90msp-RKSJ-V", "90pv-RKSJ-H", "90pv-RKSJ-V", "Add-H", "Add-RKSJ-H", "Add-RKSJ-V", "Add-V", "Adobe-CNS1-0", "Adobe-CNS1-1", "Adobe-CNS1-2", "Adobe-CNS1-3", "Adobe-CNS1-4", "Adobe-CNS1-5", "Adobe-CNS1-6", "Adobe-GB1-0", "Adobe-GB1-1", "Adobe-GB1-2", "Adobe-GB1-3", "Adobe-GB1-4", "Adobe-GB1-5", "Adobe-Japan1-0", "Adobe-Japan1-1", "Adobe-Japan1-2", "Adobe-Japan1-3", "Adobe-Japan1-4", "Adobe-Japan1-5", "Adobe-Japan1-6", "Adobe-Korea1-0", "Adobe-Korea1-1", "Adobe-Korea1-2", "B5-H", "B5-V", "B5pc-H", "B5pc-V", "CNS-EUC-H", "CNS-EUC-V", "CNS1-H", "CNS1-V", "CNS2-H", "CNS2-V", "ETHK-B5-H", "ETHK-B5-V", "ETen-B5-H", "ETen-B5-V", "ETenms-B5-H", "ETenms-B5-V", "EUC-H", "EUC-V", "Ext-H", "Ext-RKSJ-H", "Ext-RKSJ-V", "Ext-V", "GB-EUC-H", "GB-EUC-V", "GB-H", "GB-V", "GBK-EUC-H", "GBK-EUC-V", "GBK2K-H", "GBK2K-V", "GBKp-EUC-H", "GBKp-EUC-V", "GBT-EUC-H", "GBT-EUC-V", "GBT-H", "GBT-V", "GBTpc-EUC-H", "GBTpc-EUC-V", "GBpc-EUC-H", "GBpc-EUC-V", "H", "HKdla-B5-H", "HKdla-B5-V", "HKdlb-B5-H", "HKdlb-B5-V", "HKgccs-B5-H", "HKgccs-B5-V", "HKm314-B5-H", "HKm314-B5-V", "HKm471-B5-H", "HKm471-B5-V", "HKscs-B5-H", "HKscs-B5-V", "Hankaku", "Hiragana", "KSC-EUC-H", "KSC-EUC-V", "KSC-H", "KSC-Johab-H", "KSC-Johab-V", "KSC-V", "KSCms-UHC-H", "KSCms-UHC-HW-H", "KSCms-UHC-HW-V", "KSCms-UHC-V", "KSCpc-EUC-H", "KSCpc-EUC-V", "Katakana", "NWP-H", "NWP-V", "RKSJ-H", "RKSJ-V", "Roman", "UniCNS-UCS2-H", "UniCNS-UCS2-V", "UniCNS-UTF16-H", "UniCNS-UTF16-V", "UniCNS-UTF32-H", "UniCNS-UTF32-V", "UniCNS-UTF8-H", "UniCNS-UTF8-V", "UniGB-UCS2-H", "UniGB-UCS2-V", "UniGB-UTF16-H", "UniGB-UTF16-V", "UniGB-UTF32-H", "UniGB-UTF32-V", "UniGB-UTF8-H", "UniGB-UTF8-V", "UniJIS-UCS2-H", "UniJIS-UCS2-HW-H", "UniJIS-UCS2-HW-V", "UniJIS-UCS2-V", "UniJIS-UTF16-H", "UniJIS-UTF16-V", "UniJIS-UTF32-H", "UniJIS-UTF32-V", "UniJIS-UTF8-H", "UniJIS-UTF8-V", "UniJIS2004-UTF16-H", "UniJIS2004-UTF16-V", "UniJIS2004-UTF32-H", "UniJIS2004-UTF32-V", "UniJIS2004-UTF8-H", "UniJIS2004-UTF8-V", "UniJISPro-UCS2-HW-V", "UniJISPro-UCS2-V", "UniJISPro-UTF8-V", "UniJISX0213-UTF32-H", "UniJISX0213-UTF32-V", "UniJISX02132004-UTF32-H", "UniJISX02132004-UTF32-V", "UniKS-UCS2-H", "UniKS-UCS2-V", "UniKS-UTF16-H", "UniKS-UTF16-V", "UniKS-UTF32-H", "UniKS-UTF32-V", "UniKS-UTF8-H", "UniKS-UTF8-V", "V", "WP-Symbol"]; 14463const MAX_MAP_RANGE = 2 ** 24 - 1; 14464 14465class CMap { 14466 constructor(builtInCMap = false) { 14467 this.codespaceRanges = [[], [], [], []]; 14468 this.numCodespaceRanges = 0; 14469 this._map = []; 14470 this.name = ""; 14471 this.vertical = false;
vendor: 2,099 bytes, lines 14472-14573
14472 this.useCMap = null; 14473 this.builtInCMap = builtInCMap; 14474 } 14475 14476 addCodespaceRange(n, low, high) { 14477 this.codespaceRanges[n - 1].push(low, high); 14478 this.numCodespaceRanges++; 14479 } 14480 14481 mapCidRange(low, high, dstLow) { 14482 if (high - low > MAX_MAP_RANGE) { 14483 throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE."); 14484 } 14485 14486 while (low <= high) { 14487 this._map[low++] = dstLow++; 14488 } 14489 } 14490 14491 mapBfRange(low, high, dstLow) { 14492 if (high - low > MAX_MAP_RANGE) { 14493 throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE."); 14494 } 14495 14496 const lastByte = dstLow.length - 1; 14497 14498 while (low <= high) { 14499 this._map[low++] = dstLow; 14500 const nextCharCode = dstLow.charCodeAt(lastByte) + 1; 14501 14502 if (nextCharCode > 0xff) { 14503 dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00"; 14504 continue; 14505 } 14506 14507 dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode); 14508 } 14509 } 14510 14511 mapBfRangeToArray(low, high, array) { 14512 if (high - low > MAX_MAP_RANGE) { 14513 throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE."); 14514 } 14515 14516 const ii = array.length; 14517 let i = 0; 14518 14519 while (low <= high && i < ii) { 14520 this._map[low] = array[i++]; 14521 ++low; 14522 } 14523 } 14524 14525 mapOne(src, dst) { 14526 this._map[src] = dst; 14527 } 14528 14529 lookup(code) { 14530 return this._map[code]; 14531 } 14532 14533 contains(code) { 14534 return this._map[code] !== undefined; 14535 } 14536 14537 forEach(callback) { 14538 const map = this._map; 14539 const length = map.length; 14540 14541 if (length <= 0x10000) { 14542 for (let i = 0; i < length; i++) { 14543 if (map[i] !== undefined) { 14544 callback(i, map[i]); 14545 } 14546 } 14547 } else { 14548 for (const i in map) { 14549 callback(i, map[i]); 14550 } 14551 } 14552 } 14553 14554 charCodeOf(value) { 14555 const map = this._map; 14556 14557 if (map.length <= 0x10000) { 14558 return map.indexOf(value); 14559 } 14560 14561 for (const charCode in map) { 14562 if (map[charCode] === value) { 14563 return charCode | 0; 14564 } 14565 } 14566 14567 return -1; 14568 } 14569 14570 getMap() { 14571 return this._map; 14572 } 14573
vendor: 51,485 bytes, lines 14574-16706
14574 readCharCode(str, offset, out) { 14575 let c = 0; 14576 const codespaceRanges = this.codespaceRanges; 14577 14578 for (let n = 0, nn = codespaceRanges.length; n < nn; n++) { 14579 c = (c << 8 | str.charCodeAt(offset + n)) >>> 0; 14580 const codespaceRange = codespaceRanges[n]; 14581 14582 for (let k = 0, kk = codespaceRange.length; k < kk;) { 14583 const low = codespaceRange[k++]; 14584 const high = codespaceRange[k++]; 14585 14586 if (c >= low && c <= high) { 14587 out.charcode = c; 14588 out.length = n + 1; 14589 return; 14590 } 14591 } 14592 } 14593 14594 out.charcode = 0; 14595 out.length = 1; 14596 } 14597 14598 getCharCodeLength(charCode) { 14599 const codespaceRanges = this.codespaceRanges; 14600 14601 for (let n = 0, nn = codespaceRanges.length; n < nn; n++) { 14602 const codespaceRange = codespaceRanges[n]; 14603 14604 for (let k = 0, kk = codespaceRange.length; k < kk;) { 14605 const low = codespaceRange[k++]; 14606 const high = codespaceRange[k++]; 14607 14608 if (charCode >= low && charCode <= high) { 14609 return n + 1; 14610 } 14611 } 14612 } 14613 14614 return 1; 14615 } 14616 14617 get length() { 14618 return this._map.length; 14619 } 14620 14621 get isIdentityCMap() { 14622 if (!(this.name === "Identity-H" || this.name === "Identity-V")) { 14623 return false; 14624 } 14625 14626 if (this._map.length !== 0x10000) { 14627 return false; 14628 } 14629 14630 for (let i = 0; i < 0x10000; i++) { 14631 if (this._map[i] !== i) { 14632 return false; 14633 } 14634 } 14635 14636 return true; 14637 } 14638 14639} 14640 14641exports.CMap = CMap; 14642 14643class IdentityCMap extends CMap { 14644 constructor(vertical, n) { 14645 super(); 14646 this.vertical = vertical; 14647 this.addCodespaceRange(n, 0, 0xffff); 14648 } 14649 14650 mapCidRange(low, high, dstLow) { 14651 (0, _util.unreachable)("should not call mapCidRange"); 14652 } 14653 14654 mapBfRange(low, high, dstLow) { 14655 (0, _util.unreachable)("should not call mapBfRange"); 14656 } 14657 14658 mapBfRangeToArray(low, high, array) { 14659 (0, _util.unreachable)("should not call mapBfRangeToArray"); 14660 } 14661 14662 mapOne(src, dst) { 14663 (0, _util.unreachable)("should not call mapCidOne"); 14664 } 14665 14666 lookup(code) { 14667 return Number.isInteger(code) && code <= 0xffff ? code : undefined; 14668 } 14669 14670 contains(code) { 14671 return Number.isInteger(code) && code <= 0xffff; 14672 } 14673 14674 forEach(callback) { 14675 for (let i = 0; i <= 0xffff; i++) { 14676 callback(i, i); 14677 } 14678 } 14679 14680 charCodeOf(value) { 14681 return Number.isInteger(value) && value <= 0xffff ? value : -1; 14682 } 14683 14684 getMap() { 14685 const map = new Array(0x10000); 14686 14687 for (let i = 0; i <= 0xffff; i++) { 14688 map[i] = i; 14689 } 14690 14691 return map; 14692 } 14693 14694 get length() { 14695 return 0x10000; 14696 } 14697 14698 get isIdentityCMap() { 14699 (0, _util.unreachable)("should not access .isIdentityCMap"); 14700 } 14701 14702} 14703 14704exports.IdentityCMap = IdentityCMap; 14705 14706const BinaryCMapReader = function BinaryCMapReaderClosure() { 14707 function hexToInt(a, size) { 14708 let n = 0; 14709 14710 for (let i = 0; i <= size; i++) { 14711 n = n << 8 | a[i]; 14712 } 14713 14714 return n >>> 0; 14715 } 14716 14717 function hexToStr(a, size) { 14718 if (size === 1) { 14719 return String.fromCharCode(a[0], a[1]); 14720 } 14721 14722 if (size === 3) { 14723 return String.fromCharCode(a[0], a[1], a[2], a[3]); 14724 } 14725 14726 return String.fromCharCode.apply(null, a.subarray(0, size + 1)); 14727 } 14728 14729 function addHex(a, b, size) { 14730 let c = 0; 14731 14732 for (let i = size; i >= 0; i--) { 14733 c += a[i] + b[i]; 14734 a[i] = c & 255; 14735 c >>= 8; 14736 } 14737 } 14738 14739 function incHex(a, size) { 14740 let c = 1; 14741 14742 for (let i = size; i >= 0 && c > 0; i--) { 14743 c += a[i]; 14744 a[i] = c & 255; 14745 c >>= 8; 14746 } 14747 } 14748 14749 const MAX_NUM_SIZE = 16; 14750 const MAX_ENCODED_NUM_SIZE = 19; 14751 14752 class BinaryCMapStream { 14753 constructor(data) { 14754 this.buffer = data; 14755 this.pos = 0; 14756 this.end = data.length; 14757 this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE); 14758 } 14759 14760 readByte() { 14761 if (this.pos >= this.end) { 14762 return -1; 14763 } 14764 14765 return this.buffer[this.pos++]; 14766 } 14767 14768 readNumber() { 14769 let n = 0; 14770 let last; 14771 14772 do { 14773 const b = this.readByte(); 14774 14775 if (b < 0) { 14776 throw new _util.FormatError("unexpected EOF in bcmap"); 14777 } 14778 14779 last = !(b & 0x80); 14780 n = n << 7 | b & 0x7f; 14781 } while (!last); 14782 14783 return n; 14784 } 14785 14786 readSigned() { 14787 const n = this.readNumber(); 14788 return n & 1 ? ~(n >>> 1) : n >>> 1; 14789 } 14790 14791 readHex(num, size) { 14792 num.set(this.buffer.subarray(this.pos, this.pos + size + 1)); 14793 this.pos += size + 1; 14794 } 14795 14796 readHexNumber(num, size) { 14797 let last; 14798 const stack = this.tmpBuf; 14799 let sp = 0; 14800 14801 do { 14802 const b = this.readByte(); 14803 14804 if (b < 0) { 14805 throw new _util.FormatError("unexpected EOF in bcmap"); 14806 } 14807 14808 last = !(b & 0x80); 14809 stack[sp++] = b & 0x7f; 14810 } while (!last); 14811 14812 let i = size, 14813 buffer = 0, 14814 bufferSize = 0; 14815 14816 while (i >= 0) { 14817 while (bufferSize < 8 && stack.length > 0) { 14818 buffer |= stack[--sp] << bufferSize; 14819 bufferSize += 7; 14820 } 14821 14822 num[i] = buffer & 255; 14823 i--; 14824 buffer >>= 8; 14825 bufferSize -= 8; 14826 } 14827 } 14828 14829 readHexSigned(num, size) { 14830 this.readHexNumber(num, size); 14831 const sign = num[size] & 1 ? 255 : 0; 14832 let c = 0; 14833 14834 for (let i = 0; i <= size; i++) { 14835 c = (c & 1) << 8 | num[i]; 14836 num[i] = c >> 1 ^ sign; 14837 } 14838 } 14839 14840 readString() { 14841 const len = this.readNumber(); 14842 let s = ""; 14843 14844 for (let i = 0; i < len; i++) { 14845 s += String.fromCharCode(this.readNumber()); 14846 } 14847 14848 return s; 14849 } 14850 14851 } 14852 14853 class BinaryCMapReader { 14854 async process(data, cMap, extend) { 14855 const stream = new BinaryCMapStream(data); 14856 const header = stream.readByte(); 14857 cMap.vertical = !!(header & 1); 14858 let useCMap = null; 14859 const start = new Uint8Array(MAX_NUM_SIZE); 14860 const end = new Uint8Array(MAX_NUM_SIZE); 14861 const char = new Uint8Array(MAX_NUM_SIZE); 14862 const charCode = new Uint8Array(MAX_NUM_SIZE); 14863 const tmp = new Uint8Array(MAX_NUM_SIZE); 14864 let code; 14865 let b; 14866 14867 while ((b = stream.readByte()) >= 0) { 14868 const type = b >> 5; 14869 14870 if (type === 7) { 14871 switch (b & 0x1f) { 14872 case 0: 14873 stream.readString(); 14874 break; 14875 14876 case 1: 14877 useCMap = stream.readString(); 14878 break; 14879 } 14880 14881 continue; 14882 } 14883 14884 const sequence = !!(b & 0x10); 14885 const dataSize = b & 15; 14886 14887 if (dataSize + 1 > MAX_NUM_SIZE) { 14888 throw new Error("BinaryCMapReader.process: Invalid dataSize."); 14889 } 14890 14891 const ucs2DataSize = 1; 14892 const subitemsCount = stream.readNumber(); 14893 14894 switch (type) { 14895 case 0: 14896 stream.readHex(start, dataSize); 14897 stream.readHexNumber(end, dataSize); 14898 addHex(end, start, dataSize); 14899 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 14900 14901 for (let i = 1; i < subitemsCount; i++) { 14902 incHex(end, dataSize); 14903 stream.readHexNumber(start, dataSize); 14904 addHex(start, end, dataSize); 14905 stream.readHexNumber(end, dataSize); 14906 addHex(end, start, dataSize); 14907 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 14908 } 14909 14910 break; 14911 14912 case 1: 14913 stream.readHex(start, dataSize); 14914 stream.readHexNumber(end, dataSize); 14915 addHex(end, start, dataSize); 14916 stream.readNumber(); 14917 14918 for (let i = 1; i < subitemsCount; i++) { 14919 incHex(end, dataSize); 14920 stream.readHexNumber(start, dataSize); 14921 addHex(start, end, dataSize); 14922 stream.readHexNumber(end, dataSize); 14923 addHex(end, start, dataSize); 14924 stream.readNumber(); 14925 } 14926 14927 break; 14928 14929 case 2: 14930 stream.readHex(char, dataSize); 14931 code = stream.readNumber(); 14932 cMap.mapOne(hexToInt(char, dataSize), code); 14933 14934 for (let i = 1; i < subitemsCount; i++) { 14935 incHex(char, dataSize); 14936 14937 if (!sequence) { 14938 stream.readHexNumber(tmp, dataSize); 14939 addHex(char, tmp, dataSize); 14940 } 14941 14942 code = stream.readSigned() + (code + 1); 14943 cMap.mapOne(hexToInt(char, dataSize), code); 14944 } 14945 14946 break; 14947 14948 case 3: 14949 stream.readHex(start, dataSize); 14950 stream.readHexNumber(end, dataSize); 14951 addHex(end, start, dataSize); 14952 code = stream.readNumber(); 14953 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 14954 14955 for (let i = 1; i < subitemsCount; i++) { 14956 incHex(end, dataSize); 14957 14958 if (!sequence) { 14959 stream.readHexNumber(start, dataSize); 14960 addHex(start, end, dataSize); 14961 } else { 14962 start.set(end); 14963 } 14964 14965 stream.readHexNumber(end, dataSize); 14966 addHex(end, start, dataSize); 14967 code = stream.readNumber(); 14968 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 14969 } 14970 14971 break; 14972 14973 case 4: 14974 stream.readHex(char, ucs2DataSize); 14975 stream.readHex(charCode, dataSize); 14976 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 14977 14978 for (let i = 1; i < subitemsCount; i++) { 14979 incHex(char, ucs2DataSize); 14980 14981 if (!sequence) { 14982 stream.readHexNumber(tmp, ucs2DataSize); 14983 addHex(char, tmp, ucs2DataSize); 14984 } 14985 14986 incHex(charCode, dataSize); 14987 stream.readHexSigned(tmp, dataSize); 14988 addHex(charCode, tmp, dataSize); 14989 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 14990 } 14991 14992 break; 14993 14994 case 5: 14995 stream.readHex(start, ucs2DataSize); 14996 stream.readHexNumber(end, ucs2DataSize); 14997 addHex(end, start, ucs2DataSize); 14998 stream.readHex(charCode, dataSize); 14999 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 15000 15001 for (let i = 1; i < subitemsCount; i++) { 15002 incHex(end, ucs2DataSize); 15003 15004 if (!sequence) { 15005 stream.readHexNumber(start, ucs2DataSize); 15006 addHex(start, end, ucs2DataSize); 15007 } else { 15008 start.set(end); 15009 } 15010 15011 stream.readHexNumber(end, ucs2DataSize); 15012 addHex(end, start, ucs2DataSize); 15013 stream.readHex(charCode, dataSize); 15014 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 15015 } 15016 15017 break; 15018 15019 default: 15020 throw new Error(`BinaryCMapReader.process - unknown type: ${type}`); 15021 } 15022 } 15023 15024 if (useCMap) { 15025 return extend(useCMap); 15026 } 15027 15028 return cMap; 15029 } 15030 15031 } 15032 15033 return BinaryCMapReader; 15034}(); 15035 15036const CMapFactory = function CMapFactoryClosure() { 15037 function strToInt(str) { 15038 let a = 0; 15039 15040 for (let i = 0; i < str.length; i++) { 15041 a = a << 8 | str.charCodeAt(i); 15042 } 15043 15044 return a >>> 0; 15045 } 15046 15047 function expectString(obj) { 15048 if (typeof obj !== "string") { 15049 throw new _util.FormatError("Malformed CMap: expected string."); 15050 } 15051 } 15052 15053 function expectInt(obj) { 15054 if (!Number.isInteger(obj)) { 15055 throw new _util.FormatError("Malformed CMap: expected int."); 15056 } 15057 } 15058 15059 function parseBfChar(cMap, lexer) { 15060 while (true) { 15061 let obj = lexer.getObj(); 15062 15063 if (obj === _primitives.EOF) { 15064 break; 15065 } 15066 15067 if ((0, _primitives.isCmd)(obj, "endbfchar")) { 15068 return; 15069 } 15070 15071 expectString(obj); 15072 const src = strToInt(obj); 15073 obj = lexer.getObj(); 15074 expectString(obj); 15075 const dst = obj; 15076 cMap.mapOne(src, dst); 15077 } 15078 } 15079 15080 function parseBfRange(cMap, lexer) { 15081 while (true) { 15082 let obj = lexer.getObj(); 15083 15084 if (obj === _primitives.EOF) { 15085 break; 15086 } 15087 15088 if ((0, _primitives.isCmd)(obj, "endbfrange")) { 15089 return; 15090 } 15091 15092 expectString(obj); 15093 const low = strToInt(obj); 15094 obj = lexer.getObj(); 15095 expectString(obj); 15096 const high = strToInt(obj); 15097 obj = lexer.getObj(); 15098 15099 if (Number.isInteger(obj) || typeof obj === "string") { 15100 const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj; 15101 cMap.mapBfRange(low, high, dstLow); 15102 } else if ((0, _primitives.isCmd)(obj, "[")) { 15103 obj = lexer.getObj(); 15104 const array = []; 15105 15106 while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) { 15107 array.push(obj); 15108 obj = lexer.getObj(); 15109 } 15110 15111 cMap.mapBfRangeToArray(low, high, array); 15112 } else { 15113 break; 15114 } 15115 } 15116 15117 throw new _util.FormatError("Invalid bf range."); 15118 } 15119 15120 function parseCidChar(cMap, lexer) { 15121 while (true) { 15122 let obj = lexer.getObj(); 15123 15124 if (obj === _primitives.EOF) { 15125 break; 15126 } 15127 15128 if ((0, _primitives.isCmd)(obj, "endcidchar")) { 15129 return; 15130 } 15131 15132 expectString(obj); 15133 const src = strToInt(obj); 15134 obj = lexer.getObj(); 15135 expectInt(obj); 15136 const dst = obj; 15137 cMap.mapOne(src, dst); 15138 } 15139 } 15140 15141 function parseCidRange(cMap, lexer) { 15142 while (true) { 15143 let obj = lexer.getObj(); 15144 15145 if (obj === _primitives.EOF) { 15146 break; 15147 } 15148 15149 if ((0, _primitives.isCmd)(obj, "endcidrange")) { 15150 return; 15151 } 15152 15153 expectString(obj); 15154 const low = strToInt(obj); 15155 obj = lexer.getObj(); 15156 expectString(obj); 15157 const high = strToInt(obj); 15158 obj = lexer.getObj(); 15159 expectInt(obj); 15160 const dstLow = obj; 15161 cMap.mapCidRange(low, high, dstLow); 15162 } 15163 } 15164 15165 function parseCodespaceRange(cMap, lexer) { 15166 while (true) { 15167 let obj = lexer.getObj(); 15168 15169 if (obj === _primitives.EOF) { 15170 break; 15171 } 15172 15173 if ((0, _primitives.isCmd)(obj, "endcodespacerange")) { 15174 return; 15175 } 15176 15177 if (typeof obj !== "string") { 15178 break; 15179 } 15180 15181 const low = strToInt(obj); 15182 obj = lexer.getObj(); 15183 15184 if (typeof obj !== "string") { 15185 break; 15186 } 15187 15188 const high = strToInt(obj); 15189 cMap.addCodespaceRange(obj.length, low, high); 15190 } 15191 15192 throw new _util.FormatError("Invalid codespace range."); 15193 } 15194 15195 function parseWMode(cMap, lexer) { 15196 const obj = lexer.getObj(); 15197 15198 if (Number.isInteger(obj)) { 15199 cMap.vertical = !!obj; 15200 } 15201 } 15202 15203 function parseCMapName(cMap, lexer) { 15204 const obj = lexer.getObj(); 15205 15206 if (obj instanceof _primitives.Name) { 15207 cMap.name = obj.name; 15208 } 15209 } 15210 15211 async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) { 15212 let previous, embeddedUseCMap; 15213 15214 objLoop: while (true) { 15215 try { 15216 const obj = lexer.getObj(); 15217 15218 if (obj === _primitives.EOF) { 15219 break; 15220 } else if (obj instanceof _primitives.Name) { 15221 if (obj.name === "WMode") { 15222 parseWMode(cMap, lexer); 15223 } else if (obj.name === "CMapName") { 15224 parseCMapName(cMap, lexer); 15225 } 15226 15227 previous = obj; 15228 } else if (obj instanceof _primitives.Cmd) { 15229 switch (obj.cmd) { 15230 case "endcmap": 15231 break objLoop; 15232 15233 case "usecmap": 15234 if (previous instanceof _primitives.Name) { 15235 embeddedUseCMap = previous.name; 15236 } 15237 15238 break; 15239 15240 case "begincodespacerange": 15241 parseCodespaceRange(cMap, lexer); 15242 break; 15243 15244 case "beginbfchar": 15245 parseBfChar(cMap, lexer); 15246 break; 15247 15248 case "begincidchar": 15249 parseCidChar(cMap, lexer); 15250 break; 15251 15252 case "beginbfrange": 15253 parseBfRange(cMap, lexer); 15254 break; 15255 15256 case "begincidrange": 15257 parseCidRange(cMap, lexer); 15258 break; 15259 } 15260 } 15261 } catch (ex) { 15262 if (ex instanceof _core_utils.MissingDataException) { 15263 throw ex; 15264 } 15265 15266 (0, _util.warn)("Invalid cMap data: " + ex); 15267 continue; 15268 } 15269 } 15270 15271 if (!useCMap && embeddedUseCMap) { 15272 useCMap = embeddedUseCMap; 15273 } 15274 15275 if (useCMap) { 15276 return extendCMap(cMap, fetchBuiltInCMap, useCMap); 15277 } 15278 15279 return cMap; 15280 } 15281 15282 async function extendCMap(cMap, fetchBuiltInCMap, useCMap) { 15283 cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap); 15284 15285 if (cMap.numCodespaceRanges === 0) { 15286 const useCodespaceRanges = cMap.useCMap.codespaceRanges; 15287 15288 for (let i = 0; i < useCodespaceRanges.length; i++) { 15289 cMap.codespaceRanges[i] = useCodespaceRanges[i].slice(); 15290 } 15291 15292 cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges; 15293 } 15294 15295 cMap.useCMap.forEach(function (key, value) { 15296 if (!cMap.contains(key)) { 15297 cMap.mapOne(key, cMap.useCMap.lookup(key)); 15298 } 15299 }); 15300 return cMap; 15301 } 15302 15303 async function createBuiltInCMap(name, fetchBuiltInCMap) { 15304 if (name === "Identity-H") { 15305 return new IdentityCMap(false, 2); 15306 } else if (name === "Identity-V") { 15307 return new IdentityCMap(true, 2); 15308 } 15309 15310 if (!BUILT_IN_CMAPS.includes(name)) { 15311 throw new Error("Unknown CMap name: " + name); 15312 } 15313 15314 if (!fetchBuiltInCMap) { 15315 throw new Error("Built-in CMap parameters are not provided."); 15316 } 15317 15318 const { 15319 cMapData, 15320 compressionType 15321 } = await fetchBuiltInCMap(name); 15322 const cMap = new CMap(true); 15323 15324 if (compressionType === _util.CMapCompressionType.BINARY) { 15325 return new BinaryCMapReader().process(cMapData, cMap, useCMap => { 15326 return extendCMap(cMap, fetchBuiltInCMap, useCMap); 15327 }); 15328 } 15329 15330 if (compressionType === _util.CMapCompressionType.NONE) { 15331 const lexer = new _parser.Lexer(new _stream.Stream(cMapData)); 15332 return parseCMap(cMap, lexer, fetchBuiltInCMap, null); 15333 } 15334 15335 throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported."); 15336 } 15337 15338 return { 15339 async create(params) { 15340 const encoding = params.encoding; 15341 const fetchBuiltInCMap = params.fetchBuiltInCMap; 15342 const useCMap = params.useCMap; 15343 15344 if (encoding instanceof _primitives.Name) { 15345 return createBuiltInCMap(encoding.name, fetchBuiltInCMap); 15346 } else if (encoding instanceof _base_stream.BaseStream) { 15347 const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap); 15348 15349 if (parsedCMap.isIdentityCMap) { 15350 return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap); 15351 } 15352 15353 return parsedCMap; 15354 } 15355 15356 throw new Error("Encoding required."); 15357 } 15358 15359 }; 15360}(); 15361 15362exports.CMapFactory = CMapFactory; 15363 15364/***/ }), 15365/* 17 */ 15366/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 15367 15368 15369 15370Object.defineProperty(exports, "__esModule", ({ 15371 value: true 15372})); 15373exports.Parser = exports.Linearization = exports.Lexer = void 0; 15374 15375var _util = __w_pdfjs_require__(2); 15376 15377var _primitives = __w_pdfjs_require__(5); 15378 15379var _core_utils = __w_pdfjs_require__(6); 15380 15381var _ascii_85_stream = __w_pdfjs_require__(18); 15382 15383var _ascii_hex_stream = __w_pdfjs_require__(20); 15384 15385var _ccitt_stream = __w_pdfjs_require__(21); 15386 15387var _flate_stream = __w_pdfjs_require__(23); 15388 15389var _jbig2_stream = __w_pdfjs_require__(24); 15390 15391var _jpeg_stream = __w_pdfjs_require__(27); 15392 15393var _jpx_stream = __w_pdfjs_require__(29); 15394 15395var _lzw_stream = __w_pdfjs_require__(31); 15396 15397var _stream = __w_pdfjs_require__(10); 15398 15399var _predictor_stream = __w_pdfjs_require__(32); 15400 15401var _run_length_stream = __w_pdfjs_require__(33); 15402 15403const MAX_LENGTH_TO_CACHE = 1000; 15404const MAX_ADLER32_LENGTH = 5552; 15405 15406function computeAdler32(bytes) { 15407 const bytesLength = bytes.length; 15408 let a = 1, 15409 b = 0; 15410 15411 for (let i = 0; i < bytesLength; ++i) { 15412 a += bytes[i] & 0xff; 15413 b += a; 15414 } 15415 15416 return b % 65521 << 16 | a % 65521; 15417} 15418 15419class Parser { 15420 constructor({ 15421 lexer, 15422 xref, 15423 allowStreams = false, 15424 recoveryMode = false 15425 }) { 15426 this.lexer = lexer; 15427 this.xref = xref; 15428 this.allowStreams = allowStreams; 15429 this.recoveryMode = recoveryMode; 15430 this.imageCache = Object.create(null); 15431 this.refill(); 15432 } 15433 15434 refill() { 15435 this.buf1 = this.lexer.getObj(); 15436 this.buf2 = this.lexer.getObj(); 15437 } 15438 15439 shift() { 15440 if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") { 15441 this.buf1 = this.buf2; 15442 this.buf2 = null; 15443 } else { 15444 this.buf1 = this.buf2; 15445 this.buf2 = this.lexer.getObj(); 15446 } 15447 } 15448 15449 tryShift() { 15450 try { 15451 this.shift(); 15452 return true; 15453 } catch (e) { 15454 if (e instanceof _core_utils.MissingDataException) { 15455 throw e; 15456 } 15457 15458 return false; 15459 } 15460 } 15461 15462 getObj(cipherTransform = null) { 15463 const buf1 = this.buf1; 15464 this.shift(); 15465 15466 if (buf1 instanceof _primitives.Cmd) { 15467 switch (buf1.cmd) { 15468 case "BI": 15469 return this.makeInlineImage(cipherTransform); 15470 15471 case "[": 15472 const array = []; 15473 15474 while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) { 15475 array.push(this.getObj(cipherTransform)); 15476 } 15477 15478 if (this.buf1 === _primitives.EOF) { 15479 if (this.recoveryMode) { 15480 return array; 15481 } 15482 15483 throw new _core_utils.ParserEOFException("End of file inside array."); 15484 } 15485 15486 this.shift(); 15487 return array; 15488 15489 case "<<": 15490 const dict = new _primitives.Dict(this.xref); 15491 15492 while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) { 15493 if (!(this.buf1 instanceof _primitives.Name)) { 15494 (0, _util.info)("Malformed dictionary: key must be a name object"); 15495 this.shift(); 15496 continue; 15497 } 15498 15499 const key = this.buf1.name; 15500 this.shift(); 15501 15502 if (this.buf1 === _primitives.EOF) { 15503 break; 15504 } 15505 15506 dict.set(key, this.getObj(cipherTransform)); 15507 } 15508 15509 if (this.buf1 === _primitives.EOF) { 15510 if (this.recoveryMode) { 15511 return dict; 15512 } 15513 15514 throw new _core_utils.ParserEOFException("End of file inside dictionary."); 15515 } 15516 15517 if ((0, _primitives.isCmd)(this.buf2, "stream")) { 15518 return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict; 15519 } 15520 15521 this.shift(); 15522 return dict; 15523 15524 default: 15525 return buf1; 15526 } 15527 } 15528 15529 if (Number.isInteger(buf1)) { 15530 if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) { 15531 const ref = _primitives.Ref.get(buf1, this.buf1); 15532 15533 this.shift(); 15534 this.shift(); 15535 return ref; 15536 } 15537 15538 return buf1; 15539 } 15540 15541 if (typeof buf1 === "string") { 15542 if (cipherTransform) { 15543 return cipherTransform.decryptString(buf1); 15544 } 15545 15546 return buf1; 15547 } 15548 15549 return buf1; 15550 } 15551 15552 findDefaultInlineStreamEnd(stream) { 15553 const E = 0x45, 15554 I = 0x49, 15555 SPACE = 0x20, 15556 LF = 0xa, 15557 CR = 0xd, 15558 NUL = 0x0; 15559 const lexer = this.lexer, 15560 startPos = stream.pos, 15561 n = 10; 15562 let state = 0, 15563 ch, 15564 maybeEIPos; 15565 15566 while ((ch = stream.getByte()) !== -1) { 15567 if (state === 0) { 15568 state = ch === E ? 1 : 0; 15569 } else if (state === 1) { 15570 state = ch === I ? 2 : 0; 15571 } else { 15572 (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state."); 15573 15574 if (ch === SPACE || ch === LF || ch === CR) { 15575 maybeEIPos = stream.pos; 15576 const followingBytes = stream.peekBytes(n); 15577 15578 for (let i = 0, ii = followingBytes.length; i < ii; i++) { 15579 ch = followingBytes[i]; 15580 15581 if (ch === NUL && followingBytes[i + 1] !== NUL) { 15582 continue; 15583 } 15584 15585 if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) { 15586 state = 0; 15587 break; 15588 } 15589 } 15590 15591 if (state !== 2) { 15592 continue; 15593 } 15594 15595 if (lexer.knownCommands) { 15596 const nextObj = lexer.peekObj(); 15597 15598 if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) { 15599 state = 0; 15600 } 15601 } else { 15602 (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined."); 15603 } 15604 15605 if (state === 2) { 15606 break; 15607 } 15608 } else { 15609 state = 0; 15610 } 15611 } 15612 } 15613 15614 if (ch === -1) { 15615 (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker"); 15616 15617 if (maybeEIPos) { 15618 (0, _util.warn)('... trying to recover by using the last "EI" occurrence.'); 15619 stream.skip(-(stream.pos - maybeEIPos)); 15620 } 15621 } 15622 15623 let endOffset = 4; 15624 stream.skip(-endOffset); 15625 ch = stream.peekByte(); 15626 stream.skip(endOffset); 15627 15628 if (!(0, _core_utils.isWhiteSpace)(ch)) { 15629 endOffset--; 15630 } 15631 15632 return stream.pos - endOffset - startPos; 15633 } 15634 15635 findDCTDecodeInlineStreamEnd(stream) { 15636 const startPos = stream.pos; 15637 let foundEOI = false, 15638 b, 15639 markerLength; 15640 15641 while ((b = stream.getByte()) !== -1) { 15642 if (b !== 0xff) { 15643 continue; 15644 } 15645 15646 switch (stream.getByte()) { 15647 case 0x00: 15648 break; 15649 15650 case 0xff: 15651 stream.skip(-1); 15652 break; 15653 15654 case 0xd9: 15655 foundEOI = true; 15656 break; 15657 15658 case 0xc0: 15659 case 0xc1: 15660 case 0xc2: 15661 case 0xc3: 15662 case 0xc5: 15663 case 0xc6: 15664 case 0xc7: 15665 case 0xc9: 15666 case 0xca: 15667 case 0xcb: 15668 case 0xcd: 15669 case 0xce: 15670 case 0xcf: 15671 case 0xc4: 15672 case 0xcc: 15673 case 0xda: 15674 case 0xdb: 15675 case 0xdc: 15676 case 0xdd: 15677 case 0xde: 15678 case 0xdf: 15679 case 0xe0: 15680 case 0xe1: 15681 case 0xe2: 15682 case 0xe3: 15683 case 0xe4: 15684 case 0xe5: 15685 case 0xe6: 15686 case 0xe7: 15687 case 0xe8: 15688 case 0xe9: 15689 case 0xea: 15690 case 0xeb: 15691 case 0xec: 15692 case 0xed: 15693 case 0xee: 15694 case 0xef: 15695 case 0xfe: 15696 markerLength = stream.getUint16(); 15697 15698 if (markerLength > 2) { 15699 stream.skip(markerLength - 2); 15700 } else { 15701 stream.skip(-2); 15702 } 15703 15704 break; 15705 } 15706 15707 if (foundEOI) { 15708 break; 15709 } 15710 } 15711 15712 const length = stream.pos - startPos; 15713 15714 if (b === -1) { 15715 (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead."); 15716 stream.skip(-length); 15717 return this.findDefaultInlineStreamEnd(stream); 15718 } 15719 15720 this.inlineStreamSkipEI(stream); 15721 return length; 15722 } 15723 15724 findASCII85DecodeInlineStreamEnd(stream) { 15725 const TILDE = 0x7e, 15726 GT = 0x3e; 15727 const startPos = stream.pos; 15728 let ch; 15729 15730 while ((ch = stream.getByte()) !== -1) { 15731 if (ch === TILDE) { 15732 const tildePos = stream.pos; 15733 ch = stream.peekByte(); 15734 15735 while ((0, _core_utils.isWhiteSpace)(ch)) { 15736 stream.skip(); 15737 ch = stream.peekByte(); 15738 } 15739 15740 if (ch === GT) { 15741 stream.skip(); 15742 break; 15743 } 15744 15745 if (stream.pos > tildePos) { 15746 const maybeEI = stream.peekBytes(2); 15747 15748 if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) { 15749 break; 15750 } 15751 } 15752 } 15753 } 15754 15755 const length = stream.pos - startPos; 15756 15757 if (ch === -1) { 15758 (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead."); 15759 stream.skip(-length); 15760 return this.findDefaultInlineStreamEnd(stream); 15761 } 15762 15763 this.inlineStreamSkipEI(stream); 15764 return length; 15765 } 15766 15767 findASCIIHexDecodeInlineStreamEnd(stream) { 15768 const GT = 0x3e; 15769 const startPos = stream.pos; 15770 let ch; 15771 15772 while ((ch = stream.getByte()) !== -1) { 15773 if (ch === GT) { 15774 break; 15775 } 15776 } 15777 15778 const length = stream.pos - startPos; 15779 15780 if (ch === -1) { 15781 (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead."); 15782 stream.skip(-length); 15783 return this.findDefaultInlineStreamEnd(stream); 15784 } 15785 15786 this.inlineStreamSkipEI(stream); 15787 return length; 15788 } 15789 15790 inlineStreamSkipEI(stream) { 15791 const E = 0x45, 15792 I = 0x49; 15793 let state = 0, 15794 ch; 15795 15796 while ((ch = stream.getByte()) !== -1) { 15797 if (state === 0) { 15798 state = ch === E ? 1 : 0; 15799 } else if (state === 1) { 15800 state = ch === I ? 2 : 0; 15801 } else if (state === 2) { 15802 break; 15803 } 15804 } 15805 } 15806 15807 makeInlineImage(cipherTransform) { 15808 const lexer = this.lexer; 15809 const stream = lexer.stream; 15810 const dict = new _primitives.Dict(this.xref); 15811 let dictLength; 15812 15813 while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) { 15814 if (!(this.buf1 instanceof _primitives.Name)) { 15815 throw new _util.FormatError("Dictionary key must be a name object"); 15816 } 15817 15818 const key = this.buf1.name; 15819 this.shift(); 15820 15821 if (this.buf1 === _primitives.EOF) { 15822 break; 15823 } 15824 15825 dict.set(key, this.getObj(cipherTransform)); 15826 } 15827 15828 if (lexer.beginInlineImagePos !== -1) { 15829 dictLength = stream.pos - lexer.beginInlineImagePos; 15830 } 15831 15832 const filter = dict.get("F", "Filter"); 15833 let filterName; 15834 15835 if (filter instanceof _primitives.Name) { 15836 filterName = filter.name; 15837 } else if (Array.isArray(filter)) { 15838 const filterZero = this.xref.fetchIfRef(filter[0]); 15839 15840 if (filterZero instanceof _primitives.Name) { 15841 filterName = filterZero.name; 15842 } 15843 } 15844 15845 const startPos = stream.pos; 15846 let length; 15847 15848 switch (filterName) { 15849 case "DCT": 15850 case "DCTDecode": 15851 length = this.findDCTDecodeInlineStreamEnd(stream); 15852 break; 15853 15854 case "A85": 15855 case "ASCII85Decode": 15856 length = this.findASCII85DecodeInlineStreamEnd(stream); 15857 break; 15858 15859 case "AHx": 15860 case "ASCIIHexDecode": 15861 length = this.findASCIIHexDecodeInlineStreamEnd(stream); 15862 break; 15863 15864 default: 15865 length = this.findDefaultInlineStreamEnd(stream); 15866 } 15867 15868 let imageStream = stream.makeSubStream(startPos, length, dict); 15869 let cacheKey; 15870 15871 if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) { 15872 const imageBytes = imageStream.getBytes(); 15873 imageStream.reset(); 15874 const initialStreamPos = stream.pos; 15875 stream.pos = lexer.beginInlineImagePos; 15876 const dictBytes = stream.getBytes(dictLength); 15877 stream.pos = initialStreamPos; 15878 cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes); 15879 const cacheEntry = this.imageCache[cacheKey]; 15880 15881 if (cacheEntry !== undefined) { 15882 this.buf2 = _primitives.Cmd.get("EI"); 15883 this.shift(); 15884 cacheEntry.reset(); 15885 return cacheEntry; 15886 } 15887 } 15888 15889 if (cipherTransform) { 15890 imageStream = cipherTransform.createStream(imageStream, length); 15891 } 15892 15893 imageStream = this.filter(imageStream, dict, length); 15894 imageStream.dict = dict; 15895 15896 if (cacheKey !== undefined) { 15897 imageStream.cacheKey = `inline_${length}_${cacheKey}`; 15898 this.imageCache[cacheKey] = imageStream; 15899 } 15900 15901 this.buf2 = _primitives.Cmd.get("EI"); 15902 this.shift(); 15903 return imageStream; 15904 } 15905 15906 _findStreamLength(startPos, signature) { 15907 const { 15908 stream 15909 } = this.lexer; 15910 stream.pos = startPos; 15911 const SCAN_BLOCK_LENGTH = 2048; 15912 const signatureLength = signature.length; 15913 15914 while (stream.pos < stream.end) { 15915 const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 15916 const scanLength = scanBytes.length - signatureLength; 15917 15918 if (scanLength <= 0) { 15919 break; 15920 } 15921 15922 let pos = 0; 15923 15924 while (pos < scanLength) { 15925 let j = 0; 15926 15927 while (j < signatureLength && scanBytes[pos + j] === signature[j]) { 15928 j++; 15929 } 15930 15931 if (j >= signatureLength) { 15932 stream.pos += pos; 15933 return stream.pos - startPos; 15934 } 15935 15936 pos++; 15937 } 15938 15939 stream.pos += scanLength; 15940 } 15941 15942 return -1; 15943 } 15944 15945 makeStream(dict, cipherTransform) { 15946 const lexer = this.lexer; 15947 let stream = lexer.stream; 15948 lexer.skipToNextLine(); 15949 const startPos = stream.pos - 1; 15950 let length = dict.get("Length"); 15951 15952 if (!Number.isInteger(length)) { 15953 (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`); 15954 length = 0; 15955 } 15956 15957 stream.pos = startPos + length; 15958 lexer.nextChar(); 15959 15960 if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) { 15961 this.shift(); 15962 } else { 15963 const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]); 15964 15965 let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE); 15966 15967 if (actualLength < 0) { 15968 const MAX_TRUNCATION = 1; 15969 15970 for (let i = 1; i <= MAX_TRUNCATION; i++) { 15971 const end = ENDSTREAM_SIGNATURE.length - i; 15972 const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end); 15973 15974 const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE); 15975 15976 if (maybeLength >= 0) { 15977 const lastByte = stream.peekBytes(end + 1)[end]; 15978 15979 if (!(0, _core_utils.isWhiteSpace)(lastByte)) { 15980 break; 15981 } 15982 15983 (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command."); 15984 actualLength = maybeLength; 15985 break; 15986 } 15987 } 15988 15989 if (actualLength < 0) { 15990 throw new _util.FormatError("Missing endstream command."); 15991 } 15992 } 15993 15994 length = actualLength; 15995 lexer.nextChar(); 15996 this.shift(); 15997 this.shift(); 15998 } 15999 16000 this.shift(); 16001 stream = stream.makeSubStream(startPos, length, dict); 16002 16003 if (cipherTransform) { 16004 stream = cipherTransform.createStream(stream, length); 16005 } 16006 16007 stream = this.filter(stream, dict, length); 16008 stream.dict = dict; 16009 return stream; 16010 } 16011 16012 filter(stream, dict, length) { 16013 let filter = dict.get("F", "Filter"); 16014 let params = dict.get("DP", "DecodeParms"); 16015 16016 if (filter instanceof _primitives.Name) { 16017 if (Array.isArray(params)) { 16018 (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name."); 16019 } 16020 16021 return this.makeFilter(stream, filter.name, length, params); 16022 } 16023 16024 let maybeLength = length; 16025 16026 if (Array.isArray(filter)) { 16027 const filterArray = filter; 16028 const paramsArray = params; 16029 16030 for (let i = 0, ii = filterArray.length; i < ii; ++i) { 16031 filter = this.xref.fetchIfRef(filterArray[i]); 16032 16033 if (!(filter instanceof _primitives.Name)) { 16034 throw new _util.FormatError(`Bad filter name "${filter}"`); 16035 } 16036 16037 params = null; 16038 16039 if (Array.isArray(paramsArray) && i in paramsArray) { 16040 params = this.xref.fetchIfRef(paramsArray[i]); 16041 } 16042 16043 stream = this.makeFilter(stream, filter.name, maybeLength, params); 16044 maybeLength = null; 16045 } 16046 } 16047 16048 return stream; 16049 } 16050 16051 makeFilter(stream, name, maybeLength, params) { 16052 if (maybeLength === 0) { 16053 (0, _util.warn)(`Empty "${name}" stream.`); 16054 return new _stream.NullStream(); 16055 } 16056 16057 const xrefStats = this.xref.stats; 16058 16059 try { 16060 switch (name) { 16061 case "Fl": 16062 case "FlateDecode": 16063 xrefStats.addStreamType(_util.StreamType.FLATE); 16064 16065 if (params) { 16066 return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params); 16067 } 16068 16069 return new _flate_stream.FlateStream(stream, maybeLength); 16070 16071 case "LZW": 16072 case "LZWDecode": 16073 xrefStats.addStreamType(_util.StreamType.LZW); 16074 let earlyChange = 1; 16075 16076 if (params) { 16077 if (params.has("EarlyChange")) { 16078 earlyChange = params.get("EarlyChange"); 16079 } 16080 16081 return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params); 16082 } 16083 16084 return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange); 16085 16086 case "DCT": 16087 case "DCTDecode": 16088 xrefStats.addStreamType(_util.StreamType.DCT); 16089 return new _jpeg_stream.JpegStream(stream, maybeLength, params); 16090 16091 case "JPX": 16092 case "JPXDecode": 16093 xrefStats.addStreamType(_util.StreamType.JPX); 16094 return new _jpx_stream.JpxStream(stream, maybeLength, params); 16095 16096 case "A85": 16097 case "ASCII85Decode": 16098 xrefStats.addStreamType(_util.StreamType.A85); 16099 return new _ascii_85_stream.Ascii85Stream(stream, maybeLength); 16100 16101 case "AHx": 16102 case "ASCIIHexDecode": 16103 xrefStats.addStreamType(_util.StreamType.AHX); 16104 return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength); 16105 16106 case "CCF": 16107 case "CCITTFaxDecode": 16108 xrefStats.addStreamType(_util.StreamType.CCF); 16109 return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params); 16110 16111 case "RL": 16112 case "RunLengthDecode": 16113 xrefStats.addStreamType(_util.StreamType.RLX); 16114 return new _run_length_stream.RunLengthStream(stream, maybeLength); 16115 16116 case "JBIG2Decode": 16117 xrefStats.addStreamType(_util.StreamType.JBIG); 16118 return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params); 16119 } 16120 16121 (0, _util.warn)(`Filter "${name}" is not supported.`); 16122 return stream; 16123 } catch (ex) { 16124 if (ex instanceof _core_utils.MissingDataException) { 16125 throw ex; 16126 } 16127 16128 (0, _util.warn)(`Invalid stream: "${ex}"`); 16129 return new _stream.NullStream(); 16130 } 16131 } 16132 16133} 16134 16135exports.Parser = Parser; 16136const specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; 16137 16138function toHexDigit(ch) { 16139 if (ch >= 0x30 && ch <= 0x39) { 16140 return ch & 0x0f; 16141 } 16142 16143 if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 16144 return (ch & 0x0f) + 9; 16145 } 16146 16147 return -1; 16148} 16149 16150class Lexer { 16151 constructor(stream, knownCommands = null) { 16152 this.stream = stream; 16153 this.nextChar(); 16154 this.strBuf = []; 16155 this.knownCommands = knownCommands; 16156 this._hexStringNumWarn = 0; 16157 this.beginInlineImagePos = -1; 16158 } 16159 16160 nextChar() { 16161 return this.currentChar = this.stream.getByte(); 16162 } 16163 16164 peekChar() { 16165 return this.stream.peekByte(); 16166 } 16167 16168 getNumber() { 16169 let ch = this.currentChar; 16170 let eNotation = false; 16171 let divideBy = 0; 16172 let sign = 0; 16173 16174 if (ch === 0x2d) { 16175 sign = -1; 16176 ch = this.nextChar(); 16177 16178 if (ch === 0x2d) { 16179 ch = this.nextChar(); 16180 } 16181 } else if (ch === 0x2b) { 16182 sign = 1; 16183 ch = this.nextChar(); 16184 } 16185 16186 if (ch === 0x0a || ch === 0x0d) { 16187 do { 16188 ch = this.nextChar(); 16189 } while (ch === 0x0a || ch === 0x0d); 16190 } 16191 16192 if (ch === 0x2e) { 16193 divideBy = 10; 16194 ch = this.nextChar(); 16195 } 16196 16197 if (ch < 0x30 || ch > 0x39) { 16198 if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) { 16199 if (divideBy === 10 && sign === 0) { 16200 (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero."); 16201 return 0; 16202 } 16203 16204 if (divideBy === 0 && sign === -1) { 16205 (0, _util.warn)("Lexer.getNumber - treating a single minus sign as zero."); 16206 return 0; 16207 } 16208 } 16209 16210 throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`); 16211 } 16212 16213 sign = sign || 1; 16214 let baseValue = ch - 0x30; 16215 let powerValue = 0; 16216 let powerValueSign = 1; 16217 16218 while ((ch = this.nextChar()) >= 0) { 16219 if (ch >= 0x30 && ch <= 0x39) { 16220 const currentDigit = ch - 0x30; 16221 16222 if (eNotation) { 16223 powerValue = powerValue * 10 + currentDigit; 16224 } else { 16225 if (divideBy !== 0) { 16226 divideBy *= 10; 16227 } 16228 16229 baseValue = baseValue * 10 + currentDigit; 16230 } 16231 } else if (ch === 0x2e) { 16232 if (divideBy === 0) { 16233 divideBy = 1; 16234 } else { 16235 break; 16236 } 16237 } else if (ch === 0x2d) { 16238 (0, _util.warn)("Badly formatted number: minus sign in the middle"); 16239 } else if (ch === 0x45 || ch === 0x65) { 16240 ch = this.peekChar(); 16241 16242 if (ch === 0x2b || ch === 0x2d) { 16243 powerValueSign = ch === 0x2d ? -1 : 1; 16244 this.nextChar(); 16245 } else if (ch < 0x30 || ch > 0x39) { 16246 break; 16247 } 16248 16249 eNotation = true; 16250 } else { 16251 break; 16252 } 16253 } 16254 16255 if (divideBy !== 0) { 16256 baseValue /= divideBy; 16257 } 16258 16259 if (eNotation) { 16260 baseValue *= 10 ** (powerValueSign * powerValue); 16261 } 16262 16263 return sign * baseValue; 16264 } 16265 16266 getString() { 16267 let numParen = 1; 16268 let done = false; 16269 const strBuf = this.strBuf; 16270 strBuf.length = 0; 16271 let ch = this.nextChar(); 16272 16273 while (true) { 16274 let charBuffered = false; 16275 16276 switch (ch | 0) { 16277 case -1: 16278 (0, _util.warn)("Unterminated string"); 16279 done = true; 16280 break; 16281 16282 case 0x28: 16283 ++numParen; 16284 strBuf.push("("); 16285 break; 16286 16287 case 0x29: 16288 if (--numParen === 0) { 16289 this.nextChar(); 16290 done = true; 16291 } else { 16292 strBuf.push(")"); 16293 } 16294 16295 break; 16296 16297 case 0x5c: 16298 ch = this.nextChar(); 16299 16300 switch (ch) { 16301 case -1: 16302 (0, _util.warn)("Unterminated string"); 16303 done = true; 16304 break; 16305 16306 case 0x6e: 16307 strBuf.push("\n"); 16308 break; 16309 16310 case 0x72: 16311 strBuf.push("\r"); 16312 break; 16313 16314 case 0x74: 16315 strBuf.push("\t"); 16316 break; 16317 16318 case 0x62: 16319 strBuf.push("\b"); 16320 break; 16321 16322 case 0x66: 16323 strBuf.push("\f"); 16324 break; 16325 16326 case 0x5c: 16327 case 0x28: 16328 case 0x29: 16329 strBuf.push(String.fromCharCode(ch)); 16330 break; 16331 16332 case 0x30: 16333 case 0x31: 16334 case 0x32: 16335 case 0x33: 16336 case 0x34: 16337 case 0x35: 16338 case 0x36: 16339 case 0x37: 16340 let x = ch & 0x0f; 16341 ch = this.nextChar(); 16342 charBuffered = true; 16343 16344 if (ch >= 0x30 && ch <= 0x37) { 16345 x = (x << 3) + (ch & 0x0f); 16346 ch = this.nextChar(); 16347 16348 if (ch >= 0x30 && ch <= 0x37) { 16349 charBuffered = false; 16350 x = (x << 3) + (ch & 0x0f); 16351 } 16352 } 16353 16354 strBuf.push(String.fromCharCode(x)); 16355 break; 16356 16357 case 0x0d: 16358 if (this.peekChar() === 0x0a) { 16359 this.nextChar(); 16360 } 16361 16362 break; 16363 16364 case 0x0a: 16365 break; 16366 16367 default: 16368 strBuf.push(String.fromCharCode(ch)); 16369 break; 16370 } 16371 16372 break; 16373 16374 default: 16375 strBuf.push(String.fromCharCode(ch)); 16376 break; 16377 } 16378 16379 if (done) { 16380 break; 16381 } 16382 16383 if (!charBuffered) { 16384 ch = this.nextChar(); 16385 } 16386 } 16387 16388 return strBuf.join(""); 16389 } 16390 16391 getName() { 16392 let ch, previousCh; 16393 const strBuf = this.strBuf; 16394 strBuf.length = 0; 16395 16396 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 16397 if (ch === 0x23) { 16398 ch = this.nextChar(); 16399 16400 if (specialChars[ch]) { 16401 (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number."); 16402 strBuf.push("#"); 16403 break; 16404 } 16405 16406 const x = toHexDigit(ch); 16407 16408 if (x !== -1) { 16409 previousCh = ch; 16410 ch = this.nextChar(); 16411 const x2 = toHexDigit(ch); 16412 16413 if (x2 === -1) { 16414 (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number."); 16415 strBuf.push("#", String.fromCharCode(previousCh)); 16416 16417 if (specialChars[ch]) { 16418 break; 16419 } 16420 16421 strBuf.push(String.fromCharCode(ch)); 16422 continue; 16423 } 16424 16425 strBuf.push(String.fromCharCode(x << 4 | x2)); 16426 } else { 16427 strBuf.push("#", String.fromCharCode(ch)); 16428 } 16429 } else { 16430 strBuf.push(String.fromCharCode(ch)); 16431 } 16432 } 16433 16434 if (strBuf.length > 127) { 16435 (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`); 16436 } 16437 16438 return _primitives.Name.get(strBuf.join("")); 16439 } 16440 16441 _hexStringWarn(ch) { 16442 const MAX_HEX_STRING_NUM_WARN = 5; 16443 16444 if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) { 16445 (0, _util.warn)("getHexString - ignoring additional invalid characters."); 16446 return; 16447 } 16448 16449 if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) { 16450 return; 16451 } 16452 16453 (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`); 16454 } 16455 16456 getHexString() { 16457 const strBuf = this.strBuf; 16458 strBuf.length = 0; 16459 let ch = this.currentChar; 16460 let isFirstHex = true; 16461 let firstDigit, secondDigit; 16462 this._hexStringNumWarn = 0; 16463 16464 while (true) { 16465 if (ch < 0) { 16466 (0, _util.warn)("Unterminated hex string"); 16467 break; 16468 } else if (ch === 0x3e) { 16469 this.nextChar(); 16470 break; 16471 } else if (specialChars[ch] === 1) { 16472 ch = this.nextChar(); 16473 continue; 16474 } else { 16475 if (isFirstHex) { 16476 firstDigit = toHexDigit(ch); 16477 16478 if (firstDigit === -1) { 16479 this._hexStringWarn(ch); 16480 16481 ch = this.nextChar(); 16482 continue; 16483 } 16484 } else { 16485 secondDigit = toHexDigit(ch); 16486 16487 if (secondDigit === -1) { 16488 this._hexStringWarn(ch); 16489 16490 ch = this.nextChar(); 16491 continue; 16492 } 16493 16494 strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit)); 16495 } 16496 16497 isFirstHex = !isFirstHex; 16498 ch = this.nextChar(); 16499 } 16500 } 16501 16502 return strBuf.join(""); 16503 } 16504 16505 getObj() { 16506 let comment = false; 16507 let ch = this.currentChar; 16508 16509 while (true) { 16510 if (ch < 0) { 16511 return _primitives.EOF; 16512 } 16513 16514 if (comment) { 16515 if (ch === 0x0a || ch === 0x0d) { 16516 comment = false; 16517 } 16518 } else if (ch === 0x25) { 16519 comment = true; 16520 } else if (specialChars[ch] !== 1) { 16521 break; 16522 } 16523 16524 ch = this.nextChar(); 16525 } 16526 16527 switch (ch | 0) { 16528 case 0x30: 16529 case 0x31: 16530 case 0x32: 16531 case 0x33: 16532 case 0x34: 16533 case 0x35: 16534 case 0x36: 16535 case 0x37: 16536 case 0x38: 16537 case 0x39: 16538 case 0x2b: 16539 case 0x2d: 16540 case 0x2e: 16541 return this.getNumber(); 16542 16543 case 0x28: 16544 return this.getString(); 16545 16546 case 0x2f: 16547 return this.getName(); 16548 16549 case 0x5b: 16550 this.nextChar(); 16551 return _primitives.Cmd.get("["); 16552 16553 case 0x5d: 16554 this.nextChar(); 16555 return _primitives.Cmd.get("]"); 16556 16557 case 0x3c: 16558 ch = this.nextChar(); 16559 16560 if (ch === 0x3c) { 16561 this.nextChar(); 16562 return _primitives.Cmd.get("<<"); 16563 } 16564 16565 return this.getHexString(); 16566 16567 case 0x3e: 16568 ch = this.nextChar(); 16569 16570 if (ch === 0x3e) { 16571 this.nextChar(); 16572 return _primitives.Cmd.get(">>"); 16573 } 16574 16575 return _primitives.Cmd.get(">"); 16576 16577 case 0x7b: 16578 this.nextChar(); 16579 return _primitives.Cmd.get("{"); 16580 16581 case 0x7d: 16582 this.nextChar(); 16583 return _primitives.Cmd.get("}"); 16584 16585 case 0x29: 16586 this.nextChar(); 16587 throw new _util.FormatError(`Illegal character: ${ch}`); 16588 } 16589 16590 let str = String.fromCharCode(ch); 16591 16592 if (ch < 0x20 || ch > 0x7f) { 16593 const nextCh = this.peekChar(); 16594 16595 if (nextCh >= 0x20 && nextCh <= 0x7f) { 16596 this.nextChar(); 16597 return _primitives.Cmd.get(str); 16598 } 16599 } 16600 16601 const knownCommands = this.knownCommands; 16602 let knownCommandFound = knownCommands && knownCommands[str] !== undefined; 16603 16604 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 16605 const possibleCommand = str + String.fromCharCode(ch); 16606 16607 if (knownCommandFound && knownCommands[possibleCommand] === undefined) { 16608 break; 16609 } 16610 16611 if (str.length === 128) { 16612 throw new _util.FormatError(`Command token too long: ${str.length}`); 16613 } 16614 16615 str = possibleCommand; 16616 knownCommandFound = knownCommands && knownCommands[str] !== undefined; 16617 } 16618 16619 if (str === "true") { 16620 return true; 16621 } 16622 16623 if (str === "false") { 16624 return false; 16625 } 16626 16627 if (str === "null") { 16628 return null; 16629 } 16630 16631 if (str === "BI") { 16632 this.beginInlineImagePos = this.stream.pos; 16633 } 16634 16635 return _primitives.Cmd.get(str); 16636 } 16637 16638 peekObj() { 16639 const streamPos = this.stream.pos, 16640 currentChar = this.currentChar, 16641 beginInlineImagePos = this.beginInlineImagePos; 16642 let nextObj; 16643 16644 try { 16645 nextObj = this.getObj(); 16646 } catch (ex) { 16647 if (ex instanceof _core_utils.MissingDataException) { 16648 throw ex; 16649 } 16650 16651 (0, _util.warn)(`peekObj: ${ex}`); 16652 } 16653 16654 this.stream.pos = streamPos; 16655 this.currentChar = currentChar; 16656 this.beginInlineImagePos = beginInlineImagePos; 16657 return nextObj; 16658 } 16659 16660 skipToNextLine() { 16661 let ch = this.currentChar; 16662 16663 while (ch >= 0) { 16664 if (ch === 0x0d) { 16665 ch = this.nextChar(); 16666 16667 if (ch === 0x0a) { 16668 this.nextChar(); 16669 } 16670 16671 break; 16672 } else if (ch === 0x0a) { 16673 this.nextChar(); 16674 break; 16675 } 16676 16677 ch = this.nextChar(); 16678 } 16679 } 16680 16681} 16682 16683exports.Lexer = Lexer; 16684 16685class Linearization { 16686 static create(stream) { 16687 function getInt(linDict, name, allowZeroValue = false) { 16688 const obj = linDict.get(name); 16689 16690 if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) { 16691 return obj; 16692 } 16693 16694 throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid."); 16695 } 16696 16697 function getHints(linDict) { 16698 const hints = linDict.get("H"); 16699 let hintsLength; 16700 16701 if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) { 16702 for (let index = 0; index < hintsLength; index++) { 16703 const hint = hints[index]; 16704 16705 if (!(Number.isInteger(hint) && hint > 0)) { 16706 throw new Error(`Hint (${index}
16706) in the linearization dictionary is invalid.`); 16707 } 16708 } 16709 16710 return hints; 16711 } 16712 16713 throw new Error("Hint array in the linearization dictionary is invalid."); 16714 } 16715 16716 const parser = new Parser({ 16717 lexer: new Lexer(stream), 16718 xref: null 16719 }); 16720 const obj1 = parser.getObj(); 16721 const obj2 = parser.getObj(); 16722 const obj3 = parser.getObj(); 16723 const linDict = parser.getObj(); 16724 let obj, length; 16725 16726 if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) { 16727 return null; 16728 } else if ((length = getInt(linDict, "L")) !== stream.length) { 16729 throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length."); 16730 } 16731 16732 return { 16733 length, 16734 hints: getHints(linDict), 16735 objectNumberFirst: getInt(linDict, "O"), 16736 endFirst: getInt(linDict, "E"), 16737 numPages: getInt(linDict, "N"), 16738 mainXRefEntriesOffset: getInt(linDict, "T"), 16739 pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0 16740 }; 16741 } 16742 16743} 16744 16745exports.Linearization = Linearization; 16746 16747/***/ }), 16748/* 18 */ 16749/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 16750 16751 16752 16753Object.defineProperty(exports, "__esModule", ({ 16754 value: true 16755})); 16756exports.Ascii85Stream = void 0; 16757 16758var _decode_stream = __w_pdfjs_require__(19); 16759 16760var _core_utils = __w_pdfjs_require__(6); 16761 16762class Ascii85Stream extends _decode_stream.DecodeStream { 16763 constructor(str, maybeLength) { 16764 if (maybeLength) { 16765 maybeLength *= 0.8; 16766 } 16767 16768 super(maybeLength); 16769 this.str = str; 16770 this.dict = str.dict; 16771 this.input = new Uint8Array(5); 16772 } 16773 16774 readBlock() { 16775 const TILDA_CHAR = 0x7e; 16776 const Z_LOWER_CHAR = 0x7a; 16777 const EOF = -1; 16778 const str = this.str; 16779 let c = str.getByte(); 16780 16781 while ((0, _core_utils.isWhiteSpace)(c)) { 16782 c = str.getByte(); 16783 } 16784 16785 if (c === EOF || c === TILDA_CHAR) { 16786 this.eof = true; 16787 return; 16788 } 16789 16790 const bufferLength = this.bufferLength; 16791 let buffer, i; 16792 16793 if (c === Z_LOWER_CHAR) { 16794 buffer = this.ensureBuffer(bufferLength + 4); 16795 16796 for (i = 0; i < 4; ++i) { 16797 buffer[bufferLength + i] = 0; 16798 } 16799 16800 this.bufferLength += 4; 16801 } else { 16802 const input = this.input; 16803 input[0] = c; 16804 16805 for (i = 1; i < 5; ++i) { 16806 c = str.getByte(); 16807 16808 while ((0, _core_utils.isWhiteSpace)(c)) { 16809 c = str.getByte(); 16810 } 16811 16812 input[i] = c; 16813 16814 if (c === EOF || c === TILDA_CHAR) { 16815 break; 16816 } 16817 } 16818 16819 buffer = this.ensureBuffer(bufferLength + i - 1); 16820 this.bufferLength += i - 1; 16821 16822 if (i < 5) { 16823 for (; i < 5; ++i) { 16824 input[i] = 0x21 + 84; 16825 } 16826 16827 this.eof = true; 16828 } 16829 16830 let t = 0; 16831 16832 for (i = 0; i < 5; ++i) { 16833 t = t * 85 + (input[i] - 0x21); 16834 } 16835 16836 for (i = 3; i >= 0; --i) { 16837 buffer[bufferLength + i] = t & 0xff; 16838 t >>= 8; 16839 } 16840 } 16841 } 16842 16843} 16844 16845exports.Ascii85Stream = Ascii85Stream; 16846 16847/***/ }), 16848/* 19 */ 16849/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 16850 16851 16852 16853Object.defineProperty(exports, "__esModule", ({ 16854 value: true 16855})); 16856exports.StreamsSequenceStream = exports.DecodeStream = void 0; 16857 16858var _base_stream = __w_pdfjs_require__(7); 16859 16860var _stream = __w_pdfjs_require__(10); 16861 16862const emptyBuffer = new Uint8Array(0); 16863 16864class DecodeStream extends _base_stream.BaseStream { 16865 constructor(maybeMinBufferLength) { 16866 super(); 16867 this._rawMinBufferLength = maybeMinBufferLength || 0; 16868 this.pos = 0; 16869 this.bufferLength = 0; 16870 this.eof = false; 16871 this.buffer = emptyBuffer; 16872 this.minBufferLength = 512; 16873 16874 if (maybeMinBufferLength) { 16875 while (this.minBufferLength < maybeMinBufferLength) { 16876 this.minBufferLength *= 2; 16877 } 16878 } 16879 } 16880 16881 get isEmpty() { 16882 while (!this.eof && this.bufferLength === 0) { 16883 this.readBlock(); 16884 } 16885 16886 return this.bufferLength === 0; 16887 } 16888 16889 ensureBuffer(requested) { 16890 const buffer = this.buffer; 16891 16892 if (requested <= buffer.byteLength) { 16893 return buffer; 16894 } 16895 16896 let size = this.minBufferLength; 16897 16898 while (size < requested) { 16899 size *= 2; 16900 } 16901 16902 const buffer2 = new Uint8Array(size); 16903 buffer2.set(buffer); 16904 return this.buffer = buffer2; 16905 } 16906 16907 getByte() { 16908 const pos = this.pos; 16909 16910 while (this.bufferLength <= pos) { 16911 if (this.eof) { 16912 return -1; 16913 } 16914 16915 this.readBlock(); 16916 } 16917 16918 return this.buffer[this.pos++]; 16919 } 16920 16921 getBytes(length) { 16922 const pos = this.pos; 16923 let end; 16924 16925 if (length) { 16926 this.ensureBuffer(pos + length); 16927 end = pos + length; 16928 16929 while (!this.eof && this.bufferLength < end) { 16930 this.readBlock(); 16931 } 16932 16933 const bufEnd = this.bufferLength; 16934 16935 if (end > bufEnd) { 16936 end = bufEnd; 16937 } 16938 } else { 16939 while (!this.eof) { 16940 this.readBlock(); 16941 } 16942 16943 end = this.bufferLength; 16944 } 16945 16946 this.pos = end; 16947 return this.buffer.subarray(pos, end); 16948 } 16949 16950 reset() { 16951 this.pos = 0; 16952 } 16953 16954 makeSubStream(start, length, dict = null) { 16955 if (length === undefined) { 16956 while (!this.eof) { 16957 this.readBlock(); 16958 } 16959 } else { 16960 const end = start + length; 16961 16962 while (this.bufferLength <= end && !this.eof) { 16963 this.readBlock(); 16964 } 16965 } 16966 16967 return new _stream.Stream(this.buffer, start, length, dict); 16968 } 16969 16970 getBaseStreams() { 16971 return this.str ? this.str.getBaseStreams() : null; 16972 } 16973 16974} 16975 16976exports.DecodeStream = DecodeStream; 16977 16978class StreamsSequenceStream extends DecodeStream { 16979 constructor(streams, onError = null) { 16980 let maybeLength = 0; 16981 16982 for (const stream of streams) { 16983 maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length; 16984 } 16985 16986 super(maybeLength); 16987 this.streams = streams; 16988 this._onError = onError; 16989 } 16990 16991 readBlock() { 16992 const streams = this.streams; 16993 16994 if (streams.length === 0) { 16995 this.eof = true; 16996 return; 16997 } 16998 16999 const stream = streams.shift();
vendor: 3,988 bytes, lines 17000-17186
17000 let chunk; 17001 17002 try { 17003 chunk = stream.getBytes(); 17004 } catch (reason) { 17005 if (this._onError) { 17006 this._onError(reason, stream.dict && stream.dict.objId); 17007 17008 return; 17009 } 17010 17011 throw reason; 17012 } 17013 17014 const bufferLength = this.bufferLength; 17015 const newLength = bufferLength + chunk.length; 17016 const buffer = this.ensureBuffer(newLength); 17017 buffer.set(chunk, bufferLength); 17018 this.bufferLength = newLength; 17019 } 17020 17021 getBaseStreams() { 17022 const baseStreamsBuf = []; 17023 17024 for (const stream of this.streams) { 17025 const baseStreams = stream.getBaseStreams(); 17026 17027 if (baseStreams) { 17028 baseStreamsBuf.push(...baseStreams); 17029 } 17030 } 17031 17032 return baseStreamsBuf.length > 0 ? baseStreamsBuf : null; 17033 } 17034 17035} 17036 17037exports.StreamsSequenceStream = StreamsSequenceStream; 17038 17039/***/ }), 17040/* 20 */ 17041/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 17042 17043 17044 17045Object.defineProperty(exports, "__esModule", ({ 17046 value: true 17047})); 17048exports.AsciiHexStream = void 0; 17049 17050var _decode_stream = __w_pdfjs_require__(19); 17051 17052class AsciiHexStream extends _decode_stream.DecodeStream { 17053 constructor(str, maybeLength) { 17054 if (maybeLength) { 17055 maybeLength *= 0.5; 17056 } 17057 17058 super(maybeLength); 17059 this.str = str; 17060 this.dict = str.dict; 17061 this.firstDigit = -1; 17062 } 17063 17064 readBlock() { 17065 const UPSTREAM_BLOCK_SIZE = 8000; 17066 const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE); 17067 17068 if (!bytes.length) { 17069 this.eof = true; 17070 return; 17071 } 17072 17073 const maxDecodeLength = bytes.length + 1 >> 1; 17074 const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength); 17075 let bufferLength = this.bufferLength; 17076 let firstDigit = this.firstDigit; 17077 17078 for (const ch of bytes) { 17079 let digit; 17080 17081 if (ch >= 0x30 && ch <= 0x39) { 17082 digit = ch & 0x0f; 17083 } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 17084 digit = (ch & 0x0f) + 9; 17085 } else if (ch === 0x3e) { 17086 this.eof = true; 17087 break; 17088 } else { 17089 continue; 17090 } 17091 17092 if (firstDigit < 0) { 17093 firstDigit = digit; 17094 } else { 17095 buffer[bufferLength++] = firstDigit << 4 | digit; 17096 firstDigit = -1; 17097 } 17098 } 17099 17100 if (firstDigit >= 0 && this.eof) { 17101 buffer[bufferLength++] = firstDigit << 4; 17102 firstDigit = -1; 17103 } 17104 17105 this.firstDigit = firstDigit; 17106 this.bufferLength = bufferLength; 17107 } 17108 17109} 17110 17111exports.AsciiHexStream = AsciiHexStream; 17112 17113/***/ }), 17114/* 21 */ 17115/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 17116 17117 17118 17119Object.defineProperty(exports, "__esModule", ({ 17120 value: true 17121})); 17122exports.CCITTFaxStream = void 0; 17123 17124var _ccitt = __w_pdfjs_require__(22); 17125 17126var _decode_stream = __w_pdfjs_require__(19); 17127 17128var _primitives = __w_pdfjs_require__(5); 17129 17130class CCITTFaxStream extends _decode_stream.DecodeStream { 17131 constructor(str, maybeLength, params) { 17132 super(maybeLength); 17133 this.str = str; 17134 this.dict = str.dict; 17135 17136 if (!(params instanceof _primitives.Dict)) { 17137 params = _primitives.Dict.empty; 17138 } 17139 17140 const source = { 17141 next() { 17142 return str.getByte(); 17143 } 17144 17145 }; 17146 this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, { 17147 K: params.get("K"), 17148 EndOfLine: params.get("EndOfLine"), 17149 EncodedByteAlign: params.get("EncodedByteAlign"), 17150 Columns: params.get("Columns"), 17151 Rows: params.get("Rows"), 17152 EndOfBlock: params.get("EndOfBlock"), 17153 BlackIs1: params.get("BlackIs1") 17154 }); 17155 } 17156 17157 readBlock() { 17158 while (!this.eof) { 17159 const c = this.ccittFaxDecoder.readNextChar(); 17160 17161 if (c === -1) { 17162 this.eof = true; 17163 return; 17164 } 17165 17166 this.ensureBuffer(this.bufferLength + 1); 17167 this.buffer[this.bufferLength++] = c; 17168 } 17169 } 17170 17171} 17172 17173exports.CCITTFaxStream = CCITTFaxStream; 17174 17175/***/ }), 17176/* 22 */ 17177/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 17178 17179 17180 17181Object.defineProperty(exports, "__esModule", ({ 17182 value: true 17183})); 17184exports.CCITTFaxDecoder = void 0; 17185 17186var _util = __w_pdfjs_require__(2);
vendor: 11,221 bytes, lines 17187-17204
17187 17188const ccittEOL = -2; 17189const ccittEOF = -1; 17190const twoDimPass = 0; 17191const twoDimHoriz = 1; 17192const twoDimVert0 = 2; 17193const twoDimVertR1 = 3; 17194const twoDimVertL1 = 4; 17195const twoDimVertR2 = 5; 17196const twoDimVertL2 = 6; 17197const twoDimVertR3 = 7; 17198const twoDimVertL3 = 8; 17199const twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]]; 17200const whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]]; 17201const whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]]; 17202const blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]]; 17203const blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]]; 17204const blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]];
vendor: 988 bytes, lines 17205-17236
17205 17206class CCITTFaxDecoder { 17207 constructor(source, options = {}) { 17208 if (!source || typeof source.next !== "function") { 17209 throw new Error('CCITTFaxDecoder - invalid "source" parameter.'); 17210 } 17211 17212 this.source = source; 17213 this.eof = false; 17214 this.encoding = options.K || 0; 17215 this.eoline = options.EndOfLine || false; 17216 this.byteAlign = options.EncodedByteAlign || false; 17217 this.columns = options.Columns || 1728; 17218 this.rows = options.Rows || 0; 17219 let eoblock = options.EndOfBlock; 17220 17221 if (eoblock === null || eoblock === undefined) { 17222 eoblock = true; 17223 } 17224 17225 this.eoblock = eoblock; 17226 this.black = options.BlackIs1 || false; 17227 this.codingLine = new Uint32Array(this.columns + 1); 17228 this.refLine = new Uint32Array(this.columns + 2); 17229 this.codingLine[0] = this.columns; 17230 this.codingPos = 0; 17231 this.row = 0; 17232 this.nextLine2D = this.encoding < 0; 17233 this.inputBits = 0; 17234 this.inputBuf = 0; 17235 this.outputBits = 0; 17236 this.rowsDone = false;
vendor: 4,061 bytes, lines 17237-17398
17237 let code1; 17238 17239 while ((code1 = this._lookBits(12)) === 0) { 17240 this._eatBits(1); 17241 } 17242 17243 if (code1 === 1) { 17244 this._eatBits(12); 17245 } 17246 17247 if (this.encoding > 0) { 17248 this.nextLine2D = !this._lookBits(1); 17249 17250 this._eatBits(1); 17251 } 17252 } 17253 17254 readNextChar() { 17255 if (this.eof) { 17256 return -1; 17257 } 17258 17259 const refLine = this.refLine; 17260 const codingLine = this.codingLine; 17261 const columns = this.columns; 17262 let refPos, blackPixels, bits, i; 17263 17264 if (this.outputBits === 0) { 17265 if (this.rowsDone) { 17266 this.eof = true; 17267 } 17268 17269 if (this.eof) { 17270 return -1; 17271 } 17272 17273 this.err = false; 17274 let code1, code2, code3; 17275 17276 if (this.nextLine2D) { 17277 for (i = 0; codingLine[i] < columns; ++i) { 17278 refLine[i] = codingLine[i]; 17279 } 17280 17281 refLine[i++] = columns; 17282 refLine[i] = columns; 17283 codingLine[0] = 0; 17284 this.codingPos = 0; 17285 refPos = 0; 17286 blackPixels = 0; 17287 17288 while (codingLine[this.codingPos] < columns) { 17289 code1 = this._getTwoDimCode(); 17290 17291 switch (code1) { 17292 case twoDimPass: 17293 this._addPixels(refLine[refPos + 1], blackPixels); 17294 17295 if (refLine[refPos + 1] < columns) { 17296 refPos += 2; 17297 } 17298 17299 break; 17300 17301 case twoDimHoriz: 17302 code1 = code2 = 0; 17303 17304 if (blackPixels) { 17305 do { 17306 code1 += code3 = this._getBlackCode(); 17307 } while (code3 >= 64); 17308 17309 do { 17310 code2 += code3 = this._getWhiteCode(); 17311 } while (code3 >= 64); 17312 } else { 17313 do { 17314 code1 += code3 = this._getWhiteCode(); 17315 } while (code3 >= 64); 17316 17317 do { 17318 code2 += code3 = this._getBlackCode(); 17319 } while (code3 >= 64); 17320 } 17321 17322 this._addPixels(codingLine[this.codingPos] + code1, blackPixels); 17323 17324 if (codingLine[this.codingPos] < columns) { 17325 this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1); 17326 } 17327 17328 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 17329 refPos += 2; 17330 } 17331 17332 break; 17333 17334 case twoDimVertR3: 17335 this._addPixels(refLine[refPos] + 3, blackPixels); 17336 17337 blackPixels ^= 1; 17338 17339 if (codingLine[this.codingPos] < columns) { 17340 ++refPos; 17341 17342 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 17343 refPos += 2; 17344 } 17345 } 17346 17347 break; 17348 17349 case twoDimVertR2: 17350 this._addPixels(refLine[refPos] + 2, blackPixels); 17351 17352 blackPixels ^= 1; 17353 17354 if (codingLine[this.codingPos] < columns) { 17355 ++refPos; 17356 17357 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 17358 refPos += 2; 17359 } 17360 } 17361 17362 break; 17363 17364 case twoDimVertR1: 17365 this._addPixels(refLine[refPos] + 1, blackPixels); 17366 17367 blackPixels ^= 1; 17368 17369 if (codingLine[this.codingPos] < columns) { 17370 ++refPos; 17371 17372 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 17373 refPos += 2; 17374 } 17375 } 17376 17377 break; 17378 17379 case twoDimVert0: 17380 this._addPixels(refLine[refPos], blackPixels); 17381 17382 blackPixels ^= 1; 17383 17384 if (codingLine[this.codingPos] < columns) { 17385 ++refPos; 17386 17387 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 17388 refPos += 2; 17389 } 17390 } 17391 17392 break; 17393 17394 case twoDimVertL3: 17395 this._addPixelsNeg(refLine[refPos] - 3, blackPixels); 17396 17397 blackPixels ^= 1; 17398
vendor: 37,080 bytes, lines 17399-18821
17399 if (codingLine[this.codingPos] < columns) { 17400 if (refPos > 0) { 17401 --refPos; 17402 } else { 17403 ++refPos; 17404 } 17405 17406 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 17407 refPos += 2; 17408 } 17409 } 17410 17411 break; 17412 17413 case twoDimVertL2: 17414 this._addPixelsNeg(refLine[refPos] - 2, blackPixels); 17415 17416 blackPixels ^= 1; 17417 17418 if (codingLine[this.codingPos] < columns) { 17419 if (refPos > 0) { 17420 --refPos; 17421 } else { 17422 ++refPos; 17423 } 17424 17425 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 17426 refPos += 2; 17427 } 17428 } 17429 17430 break; 17431 17432 case twoDimVertL1: 17433 this._addPixelsNeg(refLine[refPos] - 1, blackPixels); 17434 17435 blackPixels ^= 1; 17436 17437 if (codingLine[this.codingPos] < columns) { 17438 if (refPos > 0) { 17439 --refPos; 17440 } else { 17441 ++refPos; 17442 } 17443 17444 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 17445 refPos += 2; 17446 } 17447 } 17448 17449 break; 17450 17451 case ccittEOF: 17452 this._addPixels(columns, 0); 17453 17454 this.eof = true; 17455 break; 17456 17457 default: 17458 (0, _util.info)("bad 2d code"); 17459 17460 this._addPixels(columns, 0); 17461 17462 this.err = true; 17463 } 17464 } 17465 } else { 17466 codingLine[0] = 0; 17467 this.codingPos = 0; 17468 blackPixels = 0; 17469 17470 while (codingLine[this.codingPos] < columns) { 17471 code1 = 0; 17472 17473 if (blackPixels) { 17474 do { 17475 code1 += code3 = this._getBlackCode(); 17476 } while (code3 >= 64); 17477 } else { 17478 do { 17479 code1 += code3 = this._getWhiteCode(); 17480 } while (code3 >= 64); 17481 } 17482 17483 this._addPixels(codingLine[this.codingPos] + code1, blackPixels); 17484 17485 blackPixels ^= 1; 17486 } 17487 } 17488 17489 let gotEOL = false; 17490 17491 if (this.byteAlign) { 17492 this.inputBits &= ~7; 17493 } 17494 17495 if (!this.eoblock && this.row === this.rows - 1) { 17496 this.rowsDone = true; 17497 } else { 17498 code1 = this._lookBits(12); 17499 17500 if (this.eoline) { 17501 while (code1 !== ccittEOF && code1 !== 1) { 17502 this._eatBits(1); 17503 17504 code1 = this._lookBits(12); 17505 } 17506 } else { 17507 while (code1 === 0) { 17508 this._eatBits(1); 17509 17510 code1 = this._lookBits(12); 17511 } 17512 } 17513 17514 if (code1 === 1) { 17515 this._eatBits(12); 17516 17517 gotEOL = true; 17518 } else if (code1 === ccittEOF) { 17519 this.eof = true; 17520 } 17521 } 17522 17523 if (!this.eof && this.encoding > 0 && !this.rowsDone) { 17524 this.nextLine2D = !this._lookBits(1); 17525 17526 this._eatBits(1); 17527 } 17528 17529 if (this.eoblock && gotEOL && this.byteAlign) { 17530 code1 = this._lookBits(12); 17531 17532 if (code1 === 1) { 17533 this._eatBits(12); 17534 17535 if (this.encoding > 0) { 17536 this._lookBits(1); 17537 17538 this._eatBits(1); 17539 } 17540 17541 if (this.encoding >= 0) { 17542 for (i = 0; i < 4; ++i) { 17543 code1 = this._lookBits(12); 17544 17545 if (code1 !== 1) { 17546 (0, _util.info)("bad rtc code: " + code1); 17547 } 17548 17549 this._eatBits(12); 17550 17551 if (this.encoding > 0) { 17552 this._lookBits(1); 17553 17554 this._eatBits(1); 17555 } 17556 } 17557 } 17558 17559 this.eof = true; 17560 } 17561 } else if (this.err && this.eoline) { 17562 while (true) { 17563 code1 = this._lookBits(13); 17564 17565 if (code1 === ccittEOF) { 17566 this.eof = true; 17567 return -1; 17568 } 17569 17570 if (code1 >> 1 === 1) { 17571 break; 17572 } 17573 17574 this._eatBits(1); 17575 } 17576 17577 this._eatBits(12); 17578 17579 if (this.encoding > 0) { 17580 this._eatBits(1); 17581 17582 this.nextLine2D = !(code1 & 1); 17583 } 17584 } 17585 17586 if (codingLine[0] > 0) { 17587 this.outputBits = codingLine[this.codingPos = 0]; 17588 } else { 17589 this.outputBits = codingLine[this.codingPos = 1]; 17590 } 17591 17592 this.row++; 17593 } 17594 17595 let c; 17596 17597 if (this.outputBits >= 8) { 17598 c = this.codingPos & 1 ? 0 : 0xff; 17599 this.outputBits -= 8; 17600 17601 if (this.outputBits === 0 && codingLine[this.codingPos] < columns) { 17602 this.codingPos++; 17603 this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1]; 17604 } 17605 } else { 17606 bits = 8; 17607 c = 0; 17608 17609 do { 17610 if (typeof this.outputBits !== "number") { 17611 throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.'); 17612 } 17613 17614 if (this.outputBits > bits) { 17615 c <<= bits; 17616 17617 if (!(this.codingPos & 1)) { 17618 c |= 0xff >> 8 - bits; 17619 } 17620 17621 this.outputBits -= bits; 17622 bits = 0; 17623 } else { 17624 c <<= this.outputBits; 17625 17626 if (!(this.codingPos & 1)) { 17627 c |= 0xff >> 8 - this.outputBits; 17628 } 17629 17630 bits -= this.outputBits; 17631 this.outputBits = 0; 17632 17633 if (codingLine[this.codingPos] < columns) { 17634 this.codingPos++; 17635 this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1]; 17636 } else if (bits > 0) { 17637 c <<= bits; 17638 bits = 0; 17639 } 17640 } 17641 } while (bits); 17642 } 17643 17644 if (this.black) { 17645 c ^= 0xff; 17646 } 17647 17648 return c; 17649 } 17650 17651 _addPixels(a1, blackPixels) { 17652 const codingLine = this.codingLine; 17653 let codingPos = this.codingPos; 17654 17655 if (a1 > codingLine[codingPos]) { 17656 if (a1 > this.columns) { 17657 (0, _util.info)("row is wrong length"); 17658 this.err = true; 17659 a1 = this.columns; 17660 } 17661 17662 if (codingPos & 1 ^ blackPixels) { 17663 ++codingPos; 17664 } 17665 17666 codingLine[codingPos] = a1; 17667 } 17668 17669 this.codingPos = codingPos; 17670 } 17671 17672 _addPixelsNeg(a1, blackPixels) { 17673 const codingLine = this.codingLine; 17674 let codingPos = this.codingPos; 17675 17676 if (a1 > codingLine[codingPos]) { 17677 if (a1 > this.columns) { 17678 (0, _util.info)("row is wrong length"); 17679 this.err = true; 17680 a1 = this.columns; 17681 } 17682 17683 if (codingPos & 1 ^ blackPixels) { 17684 ++codingPos; 17685 } 17686 17687 codingLine[codingPos] = a1; 17688 } else if (a1 < codingLine[codingPos]) { 17689 if (a1 < 0) { 17690 (0, _util.info)("invalid code"); 17691 this.err = true; 17692 a1 = 0; 17693 } 17694 17695 while (codingPos > 0 && a1 < codingLine[codingPos - 1]) { 17696 --codingPos; 17697 } 17698 17699 codingLine[codingPos] = a1; 17700 } 17701 17702 this.codingPos = codingPos; 17703 } 17704 17705 _findTableCode(start, end, table, limit) { 17706 const limitValue = limit || 0; 17707 17708 for (let i = start; i <= end; ++i) { 17709 let code = this._lookBits(i); 17710 17711 if (code === ccittEOF) { 17712 return [true, 1, false]; 17713 } 17714 17715 if (i < end) { 17716 code <<= end - i; 17717 } 17718 17719 if (!limitValue || code >= limitValue) { 17720 const p = table[code - limitValue]; 17721 17722 if (p[0] === i) { 17723 this._eatBits(i); 17724 17725 return [true, p[1], true]; 17726 } 17727 } 17728 } 17729 17730 return [false, 0, false]; 17731 } 17732 17733 _getTwoDimCode() { 17734 let code = 0; 17735 let p; 17736 17737 if (this.eoblock) { 17738 code = this._lookBits(7); 17739 p = twoDimTable[code]; 17740 17741 if (p && p[0] > 0) { 17742 this._eatBits(p[0]); 17743 17744 return p[1]; 17745 } 17746 } else { 17747 const result = this._findTableCode(1, 7, twoDimTable); 17748 17749 if (result[0] && result[2]) { 17750 return result[1]; 17751 } 17752 } 17753 17754 (0, _util.info)("Bad two dim code"); 17755 return ccittEOF; 17756 } 17757 17758 _getWhiteCode() { 17759 let code = 0; 17760 let p; 17761 17762 if (this.eoblock) { 17763 code = this._lookBits(12); 17764 17765 if (code === ccittEOF) { 17766 return 1; 17767 } 17768 17769 if (code >> 5 === 0) { 17770 p = whiteTable1[code]; 17771 } else { 17772 p = whiteTable2[code >> 3]; 17773 } 17774 17775 if (p[0] > 0) { 17776 this._eatBits(p[0]); 17777 17778 return p[1]; 17779 } 17780 } else { 17781 let result = this._findTableCode(1, 9, whiteTable2); 17782 17783 if (result[0]) { 17784 return result[1]; 17785 } 17786 17787 result = this._findTableCode(11, 12, whiteTable1); 17788 17789 if (result[0]) { 17790 return result[1]; 17791 } 17792 } 17793 17794 (0, _util.info)("bad white code"); 17795 17796 this._eatBits(1); 17797 17798 return 1; 17799 } 17800 17801 _getBlackCode() { 17802 let code, p; 17803 17804 if (this.eoblock) { 17805 code = this._lookBits(13); 17806 17807 if (code === ccittEOF) { 17808 return 1; 17809 } 17810 17811 if (code >> 7 === 0) { 17812 p = blackTable1[code]; 17813 } else if (code >> 9 === 0 && code >> 7 !== 0) { 17814 p = blackTable2[(code >> 1) - 64]; 17815 } else { 17816 p = blackTable3[code >> 7]; 17817 } 17818 17819 if (p[0] > 0) { 17820 this._eatBits(p[0]); 17821 17822 return p[1]; 17823 } 17824 } else { 17825 let result = this._findTableCode(2, 6, blackTable3); 17826 17827 if (result[0]) { 17828 return result[1]; 17829 } 17830 17831 result = this._findTableCode(7, 12, blackTable2, 64); 17832 17833 if (result[0]) { 17834 return result[1]; 17835 } 17836 17837 result = this._findTableCode(10, 13, blackTable1); 17838 17839 if (result[0]) { 17840 return result[1]; 17841 } 17842 } 17843 17844 (0, _util.info)("bad black code"); 17845 17846 this._eatBits(1); 17847 17848 return 1; 17849 } 17850 17851 _lookBits(n) { 17852 let c; 17853 17854 while (this.inputBits < n) { 17855 if ((c = this.source.next()) === -1) { 17856 if (this.inputBits === 0) { 17857 return ccittEOF; 17858 } 17859 17860 return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n; 17861 } 17862 17863 this.inputBuf = this.inputBuf << 8 | c; 17864 this.inputBits += 8; 17865 } 17866 17867 return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n; 17868 } 17869 17870 _eatBits(n) { 17871 if ((this.inputBits -= n) < 0) { 17872 this.inputBits = 0; 17873 } 17874 } 17875 17876} 17877 17878exports.CCITTFaxDecoder = CCITTFaxDecoder; 17879 17880/***/ }), 17881/* 23 */ 17882/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 17883 17884 17885 17886Object.defineProperty(exports, "__esModule", ({ 17887 value: true 17888})); 17889exports.FlateStream = void 0; 17890 17891var _decode_stream = __w_pdfjs_require__(19); 17892 17893var _util = __w_pdfjs_require__(2); 17894 17895const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); 17896const lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]); 17897const distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]); 17898const fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff]), 9]; 17899const fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5]; 17900 17901class FlateStream extends _decode_stream.DecodeStream { 17902 constructor(str, maybeLength) { 17903 super(maybeLength); 17904 this.str = str; 17905 this.dict = str.dict; 17906 const cmf = str.getByte(); 17907 const flg = str.getByte(); 17908 17909 if (cmf === -1 || flg === -1) { 17910 throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`); 17911 } 17912 17913 if ((cmf & 0x0f) !== 0x08) { 17914 throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`); 17915 } 17916 17917 if (((cmf << 8) + flg) % 31 !== 0) { 17918 throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`); 17919 } 17920 17921 if (flg & 0x20) { 17922 throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`); 17923 } 17924 17925 this.codeSize = 0; 17926 this.codeBuf = 0; 17927 } 17928 17929 getBits(bits) { 17930 const str = this.str; 17931 let codeSize = this.codeSize; 17932 let codeBuf = this.codeBuf; 17933 let b; 17934 17935 while (codeSize < bits) { 17936 if ((b = str.getByte()) === -1) { 17937 throw new _util.FormatError("Bad encoding in flate stream"); 17938 } 17939 17940 codeBuf |= b << codeSize; 17941 codeSize += 8; 17942 } 17943 17944 b = codeBuf & (1 << bits) - 1; 17945 this.codeBuf = codeBuf >> bits; 17946 this.codeSize = codeSize -= bits; 17947 return b; 17948 } 17949 17950 getCode(table) { 17951 const str = this.str; 17952 const codes = table[0]; 17953 const maxLen = table[1]; 17954 let codeSize = this.codeSize; 17955 let codeBuf = this.codeBuf; 17956 let b; 17957 17958 while (codeSize < maxLen) { 17959 if ((b = str.getByte()) === -1) { 17960 break; 17961 } 17962 17963 codeBuf |= b << codeSize; 17964 codeSize += 8; 17965 } 17966 17967 const code = codes[codeBuf & (1 << maxLen) - 1]; 17968 const codeLen = code >> 16; 17969 const codeVal = code & 0xffff; 17970 17971 if (codeLen < 1 || codeSize < codeLen) { 17972 throw new _util.FormatError("Bad encoding in flate stream"); 17973 } 17974 17975 this.codeBuf = codeBuf >> codeLen; 17976 this.codeSize = codeSize - codeLen; 17977 return codeVal; 17978 } 17979 17980 generateHuffmanTable(lengths) { 17981 const n = lengths.length; 17982 let maxLen = 0; 17983 let i; 17984 17985 for (i = 0; i < n; ++i) { 17986 if (lengths[i] > maxLen) { 17987 maxLen = lengths[i]; 17988 } 17989 } 17990 17991 const size = 1 << maxLen; 17992 const codes = new Int32Array(size); 17993 17994 for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) { 17995 for (let val = 0; val < n; ++val) { 17996 if (lengths[val] === len) { 17997 let code2 = 0; 17998 let t = code; 17999 18000 for (i = 0; i < len; ++i) { 18001 code2 = code2 << 1 | t & 1; 18002 t >>= 1; 18003 } 18004 18005 for (i = code2; i < size; i += skip) { 18006 codes[i] = len << 16 | val; 18007 } 18008 18009 ++code; 18010 } 18011 } 18012 } 18013 18014 return [codes, maxLen]; 18015 } 18016 18017 readBlock() { 18018 let buffer, len; 18019 const str = this.str; 18020 let hdr = this.getBits(3); 18021 18022 if (hdr & 1) { 18023 this.eof = true; 18024 } 18025 18026 hdr >>= 1; 18027 18028 if (hdr === 0) { 18029 let b; 18030 18031 if ((b = str.getByte()) === -1) { 18032 throw new _util.FormatError("Bad block header in flate stream"); 18033 } 18034 18035 let blockLen = b; 18036 18037 if ((b = str.getByte()) === -1) { 18038 throw new _util.FormatError("Bad block header in flate stream"); 18039 } 18040 18041 blockLen |= b << 8; 18042 18043 if ((b = str.getByte()) === -1) { 18044 throw new _util.FormatError("Bad block header in flate stream"); 18045 } 18046 18047 let check = b; 18048 18049 if ((b = str.getByte()) === -1) { 18050 throw new _util.FormatError("Bad block header in flate stream"); 18051 } 18052 18053 check |= b << 8; 18054 18055 if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) { 18056 throw new _util.FormatError("Bad uncompressed block length in flate stream"); 18057 } 18058 18059 this.codeBuf = 0; 18060 this.codeSize = 0; 18061 const bufferLength = this.bufferLength, 18062 end = bufferLength + blockLen; 18063 buffer = this.ensureBuffer(end); 18064 this.bufferLength = end; 18065 18066 if (blockLen === 0) { 18067 if (str.peekByte() === -1) { 18068 this.eof = true; 18069 } 18070 } else { 18071 const block = str.getBytes(blockLen); 18072 buffer.set(block, bufferLength); 18073 18074 if (block.length < blockLen) { 18075 this.eof = true; 18076 } 18077 } 18078 18079 return; 18080 } 18081 18082 let litCodeTable; 18083 let distCodeTable; 18084 18085 if (hdr === 1) { 18086 litCodeTable = fixedLitCodeTab; 18087 distCodeTable = fixedDistCodeTab; 18088 } else if (hdr === 2) { 18089 const numLitCodes = this.getBits(5) + 257; 18090 const numDistCodes = this.getBits(5) + 1; 18091 const numCodeLenCodes = this.getBits(4) + 4; 18092 const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length); 18093 let i; 18094 18095 for (i = 0; i < numCodeLenCodes; ++i) { 18096 codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3); 18097 } 18098 18099 const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths); 18100 len = 0; 18101 i = 0; 18102 const codes = numLitCodes + numDistCodes; 18103 const codeLengths = new Uint8Array(codes); 18104 let bitsLength, bitsOffset, what; 18105 18106 while (i < codes) { 18107 const code = this.getCode(codeLenCodeTab); 18108 18109 if (code === 16) { 18110 bitsLength = 2; 18111 bitsOffset = 3; 18112 what = len; 18113 } else if (code === 17) { 18114 bitsLength = 3; 18115 bitsOffset = 3; 18116 what = len = 0; 18117 } else if (code === 18) { 18118 bitsLength = 7; 18119 bitsOffset = 11; 18120 what = len = 0; 18121 } else { 18122 codeLengths[i++] = len = code; 18123 continue; 18124 } 18125 18126 let repeatLength = this.getBits(bitsLength) + bitsOffset; 18127 18128 while (repeatLength-- > 0) { 18129 codeLengths[i++] = what; 18130 } 18131 } 18132 18133 litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes)); 18134 distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes)); 18135 } else { 18136 throw new _util.FormatError("Unknown block type in flate stream"); 18137 } 18138 18139 buffer = this.buffer; 18140 let limit = buffer ? buffer.length : 0; 18141 let pos = this.bufferLength; 18142 18143 while (true) { 18144 let code1 = this.getCode(litCodeTable); 18145 18146 if (code1 < 256) { 18147 if (pos + 1 >= limit) { 18148 buffer = this.ensureBuffer(pos + 1); 18149 limit = buffer.length; 18150 } 18151 18152 buffer[pos++] = code1; 18153 continue; 18154 } 18155 18156 if (code1 === 256) { 18157 this.bufferLength = pos; 18158 return; 18159 } 18160 18161 code1 -= 257; 18162 code1 = lengthDecode[code1]; 18163 let code2 = code1 >> 16; 18164 18165 if (code2 > 0) { 18166 code2 = this.getBits(code2); 18167 } 18168 18169 len = (code1 & 0xffff) + code2; 18170 code1 = this.getCode(distCodeTable); 18171 code1 = distDecode[code1]; 18172 code2 = code1 >> 16; 18173 18174 if (code2 > 0) { 18175 code2 = this.getBits(code2); 18176 } 18177 18178 const dist = (code1 & 0xffff) + code2; 18179 18180 if (pos + len >= limit) { 18181 buffer = this.ensureBuffer(pos + len); 18182 limit = buffer.length; 18183 } 18184 18185 for (let k = 0; k < len; ++k, ++pos) { 18186 buffer[pos] = buffer[pos - dist]; 18187 } 18188 } 18189 } 18190 18191} 18192 18193exports.FlateStream = FlateStream; 18194 18195/***/ }), 18196/* 24 */ 18197/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 18198 18199 18200 18201Object.defineProperty(exports, "__esModule", ({ 18202 value: true 18203})); 18204exports.Jbig2Stream = void 0; 18205 18206var _base_stream = __w_pdfjs_require__(7); 18207 18208var _decode_stream = __w_pdfjs_require__(19); 18209 18210var _primitives = __w_pdfjs_require__(5); 18211 18212var _jbig = __w_pdfjs_require__(25); 18213 18214var _util = __w_pdfjs_require__(2); 18215 18216class Jbig2Stream extends _decode_stream.DecodeStream { 18217 constructor(stream, maybeLength, params) { 18218 super(maybeLength); 18219 this.stream = stream; 18220 this.dict = stream.dict; 18221 this.maybeLength = maybeLength; 18222 this.params = params; 18223 } 18224 18225 get bytes() { 18226 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 18227 } 18228 18229 ensureBuffer(requested) {} 18230 18231 readBlock() { 18232 if (this.eof) { 18233 return; 18234 } 18235 18236 const jbig2Image = new _jbig.Jbig2Image(); 18237 const chunks = []; 18238 18239 if (this.params instanceof _primitives.Dict) { 18240 const globalsStream = this.params.get("JBIG2Globals"); 18241 18242 if (globalsStream instanceof _base_stream.BaseStream) { 18243 const globals = globalsStream.getBytes(); 18244 chunks.push({ 18245 data: globals, 18246 start: 0, 18247 end: globals.length 18248 }); 18249 } 18250 } 18251 18252 chunks.push({ 18253 data: this.bytes, 18254 start: 0, 18255 end: this.bytes.length 18256 }); 18257 const data = jbig2Image.parseChunks(chunks); 18258 const dataLength = data.length; 18259 18260 for (let i = 0; i < dataLength; i++) { 18261 data[i] ^= 0xff; 18262 } 18263 18264 this.buffer = data; 18265 this.bufferLength = dataLength; 18266 this.eof = true; 18267 } 18268 18269} 18270 18271exports.Jbig2Stream = Jbig2Stream; 18272 18273/***/ }), 18274/* 25 */ 18275/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 18276 18277 18278 18279Object.defineProperty(exports, "__esModule", ({ 18280 value: true 18281})); 18282exports.Jbig2Image = void 0; 18283 18284var _util = __w_pdfjs_require__(2); 18285 18286var _core_utils = __w_pdfjs_require__(6); 18287 18288var _arithmetic_decoder = __w_pdfjs_require__(26); 18289 18290var _ccitt = __w_pdfjs_require__(22); 18291 18292class Jbig2Error extends _util.BaseException { 18293 constructor(msg) { 18294 super(`JBIG2 error: ${msg}`, "Jbig2Error"); 18295 } 18296 18297} 18298 18299class ContextCache { 18300 getContexts(id) { 18301 if (id in this) { 18302 return this[id]; 18303 } 18304 18305 return this[id] = new Int8Array(1 << 16); 18306 } 18307 18308} 18309 18310class DecodingContext { 18311 constructor(data, start, end) { 18312 this.data = data; 18313 this.start = start; 18314 this.end = end; 18315 } 18316 18317 get decoder() { 18318 const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end); 18319 return (0, _util.shadow)(this, "decoder", decoder); 18320 } 18321 18322 get contextCache() { 18323 const cache = new ContextCache(); 18324 return (0, _util.shadow)(this, "contextCache", cache); 18325 } 18326 18327} 18328 18329function decodeInteger(contextCache, procedure, decoder) { 18330 const contexts = contextCache.getContexts(procedure); 18331 let prev = 1; 18332 18333 function readBits(length) { 18334 let v = 0; 18335 18336 for (let i = 0; i < length; i++) { 18337 const bit = decoder.readBit(contexts, prev); 18338 prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256; 18339 v = v << 1 | bit; 18340 } 18341 18342 return v >>> 0; 18343 } 18344 18345 const sign = readBits(1); 18346 const value = readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(32) + 4436 : readBits(12) + 340 : readBits(8) + 84 : readBits(6) + 20 : readBits(4) + 4 : readBits(2); 18347 18348 if (sign === 0) { 18349 return value; 18350 } else if (value > 0) { 18351 return -value; 18352 } 18353 18354 return null; 18355} 18356 18357function decodeIAID(contextCache, decoder, codeLength) { 18358 const contexts = contextCache.getContexts("IAID"); 18359 let prev = 1; 18360 18361 for (let i = 0; i < codeLength; i++) { 18362 const bit = decoder.readBit(contexts, prev); 18363 prev = prev << 1 | bit; 18364 } 18365 18366 if (codeLength < 31) { 18367 return prev & (1 << codeLength) - 1; 18368 } 18369 18370 return prev & 0x7fffffff; 18371} 18372 18373const SegmentTypes = ["SymbolDictionary", null, null, null, "IntermediateTextRegion", null, "ImmediateTextRegion", "ImmediateLosslessTextRegion", null, null, null, null, null, null, null, null, "PatternDictionary", null, null, null, "IntermediateHalftoneRegion", null, "ImmediateHalftoneRegion", "ImmediateLosslessHalftoneRegion", null, null, null, null, null, null, null, null, null, null, null, null, "IntermediateGenericRegion", null, "ImmediateGenericRegion", "ImmediateLosslessGenericRegion", "IntermediateGenericRefinementRegion", null, "ImmediateGenericRefinementRegion", "ImmediateLosslessGenericRefinementRegion", null, null, null, null, "PageInformation", "EndOfPage", "EndOfStripe", "EndOfFile", "Profiles", "Tables", null, null, null, null, null, null, null, null, "Extension"]; 18374const CodingTemplates = [[{ 18375 x: -1, 18376 y: -2 18377}, { 18378 x: 0, 18379 y: -2 18380}, { 18381 x: 1, 18382 y: -2 18383}, { 18384 x: -2, 18385 y: -1 18386}, { 18387 x: -1, 18388 y: -1 18389}, { 18390 x: 0, 18391 y: -1 18392}, { 18393 x: 1, 18394 y: -1 18395}, { 18396 x: 2, 18397 y: -1 18398}, { 18399 x: -4, 18400 y: 0 18401}, { 18402 x: -3, 18403 y: 0 18404}, { 18405 x: -2, 18406 y: 0 18407}, { 18408 x: -1, 18409 y: 0 18410}], [{ 18411 x: -1, 18412 y: -2 18413}, { 18414 x: 0, 18415 y: -2 18416}, { 18417 x: 1, 18418 y: -2 18419}, { 18420 x: 2, 18421 y: -2 18422}, { 18423 x: -2, 18424 y: -1 18425}, { 18426 x: -1, 18427 y: -1 18428}, { 18429 x: 0, 18430 y: -1 18431}, { 18432 x: 1, 18433 y: -1 18434}, { 18435 x: 2, 18436 y: -1 18437}, { 18438 x: -3, 18439 y: 0 18440}, { 18441 x: -2, 18442 y: 0 18443}, { 18444 x: -1, 18445 y: 0 18446}], [{ 18447 x: -1, 18448 y: -2 18449}, { 18450 x: 0, 18451 y: -2 18452}, { 18453 x: 1, 18454 y: -2 18455}, { 18456 x: -2, 18457 y: -1 18458}, { 18459 x: -1, 18460 y: -1 18461}, { 18462 x: 0, 18463 y: -1 18464}, { 18465 x: 1, 18466 y: -1 18467}, { 18468 x: -2, 18469 y: 0 18470}, { 18471 x: -1, 18472 y: 0 18473}], [{ 18474 x: -3, 18475 y: -1 18476}, { 18477 x: -2, 18478 y: -1 18479}, { 18480 x: -1, 18481 y: -1 18482}, { 18483 x: 0, 18484 y: -1 18485}, { 18486 x: 1, 18487 y: -1 18488}, { 18489 x: -4, 18490 y: 0 18491}, { 18492 x: -3, 18493 y: 0 18494}, { 18495 x: -2, 18496 y: 0 18497}, { 18498 x: -1, 18499 y: 0 18500}]]; 18501const RefinementTemplates = [{ 18502 coding: [{ 18503 x: 0, 18504 y: -1 18505 }, { 18506 x: 1, 18507 y: -1 18508 }, { 18509 x: -1, 18510 y: 0 18511 }], 18512 reference: [{ 18513 x: 0, 18514 y: -1 18515 }, { 18516 x: 1, 18517 y: -1 18518 }, { 18519 x: -1, 18520 y: 0 18521 }, { 18522 x: 0, 18523 y: 0 18524 }, { 18525 x: 1, 18526 y: 0 18527 }, { 18528 x: -1, 18529 y: 1 18530 }, { 18531 x: 0, 18532 y: 1 18533 }, { 18534 x: 1, 18535 y: 1 18536 }] 18537}, { 18538 coding: [{ 18539 x: -1, 18540 y: -1 18541 }, { 18542 x: 0, 18543 y: -1 18544 }, { 18545 x: 1, 18546 y: -1 18547 }, { 18548 x: -1, 18549 y: 0 18550 }], 18551 reference: [{ 18552 x: 0, 18553 y: -1 18554 }, { 18555 x: -1, 18556 y: 0 18557 }, { 18558 x: 0, 18559 y: 0 18560 }, { 18561 x: 1, 18562 y: 0 18563 }, { 18564 x: 0, 18565 y: 1 18566 }, { 18567 x: 1, 18568 y: 1 18569 }] 18570}]; 18571const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195]; 18572const RefinementReusedContexts = [0x0020, 0x0008]; 18573 18574function decodeBitmapTemplate0(width, height, decodingContext) { 18575 const decoder = decodingContext.decoder; 18576 const contexts = decodingContext.contextCache.getContexts("GB"); 18577 const bitmap = []; 18578 let contextLabel, i, j, pixel, row, row1, row2; 18579 const OLD_PIXEL_MASK = 0x7bf7; 18580 18581 for (i = 0; i < height; i++) { 18582 row = bitmap[i] = new Uint8Array(width); 18583 row1 = i < 1 ? row : bitmap[i - 1]; 18584 row2 = i < 2 ? row : bitmap[i - 2]; 18585 contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4; 18586 18587 for (j = 0; j < width; j++) { 18588 row[j] = pixel = decoder.readBit(contexts, contextLabel); 18589 contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel; 18590 } 18591 } 18592 18593 return bitmap; 18594} 18595 18596function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) { 18597 if (mmr) { 18598 const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end); 18599 return decodeMMRBitmap(input, width, height, false); 18600 } 18601 18602 if (templateIndex === 0 && !skip && !prediction && at.length === 4 && at[0].x === 3 && at[0].y === -1 && at[1].x === -3 && at[1].y === -1 && at[2].x === 2 && at[2].y === -2 && at[3].x === -2 && at[3].y === -2) { 18603 return decodeBitmapTemplate0(width, height, decodingContext); 18604 } 18605 18606 const useskip = !!skip; 18607 const template = CodingTemplates[templateIndex].concat(at); 18608 template.sort(function (a, b) { 18609 return a.y - b.y || a.x - b.x; 18610 }); 18611 const templateLength = template.length; 18612 const templateX = new Int8Array(templateLength); 18613 const templateY = new Int8Array(templateLength); 18614 const changingTemplateEntries = []; 18615 let reuseMask = 0, 18616 minX = 0, 18617 maxX = 0, 18618 minY = 0; 18619 let c, k; 18620 18621 for (k = 0; k < templateLength; k++) { 18622 templateX[k] = template[k].x; 18623 templateY[k] = template[k].y; 18624 minX = Math.min(minX, template[k].x); 18625 maxX = Math.max(maxX, template[k].x); 18626 minY = Math.min(minY, template[k].y); 18627 18628 if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) { 18629 reuseMask |= 1 << templateLength - 1 - k; 18630 } else { 18631 changingTemplateEntries.push(k); 18632 } 18633 } 18634 18635 const changingEntriesLength = changingTemplateEntries.length; 18636 const changingTemplateX = new Int8Array(changingEntriesLength); 18637 const changingTemplateY = new Int8Array(changingEntriesLength); 18638 const changingTemplateBit = new Uint16Array(changingEntriesLength); 18639 18640 for (c = 0; c < changingEntriesLength; c++) { 18641 k = changingTemplateEntries[c]; 18642 changingTemplateX[c] = template[k].x; 18643 changingTemplateY[c] = template[k].y; 18644 changingTemplateBit[c] = 1 << templateLength - 1 - k; 18645 } 18646 18647 const sbb_left = -minX; 18648 const sbb_top = -minY; 18649 const sbb_right = width - maxX; 18650 const pseudoPixelContext = ReusedContexts[templateIndex]; 18651 let row = new Uint8Array(width); 18652 const bitmap = []; 18653 const decoder = decodingContext.decoder; 18654 const contexts = decodingContext.contextCache.getContexts("GB"); 18655 let ltp = 0, 18656 j, 18657 i0, 18658 j0, 18659 contextLabel = 0, 18660 bit, 18661 shift; 18662 18663 for (let i = 0; i < height; i++) { 18664 if (prediction) { 18665 const sltp = decoder.readBit(contexts, pseudoPixelContext); 18666 ltp ^= sltp; 18667 18668 if (ltp) { 18669 bitmap.push(row); 18670 continue; 18671 } 18672 } 18673 18674 row = new Uint8Array(row); 18675 bitmap.push(row); 18676 18677 for (j = 0; j < width; j++) { 18678 if (useskip && skip[i][j]) { 18679 row[j] = 0; 18680 continue; 18681 } 18682 18683 if (j >= sbb_left && j < sbb_right && i >= sbb_top) { 18684 contextLabel = contextLabel << 1 & reuseMask; 18685 18686 for (k = 0; k < changingEntriesLength; k++) { 18687 i0 = i + changingTemplateY[k]; 18688 j0 = j + changingTemplateX[k]; 18689 bit = bitmap[i0][j0]; 18690 18691 if (bit) { 18692 bit = changingTemplateBit[k]; 18693 contextLabel |= bit; 18694 } 18695 } 18696 } else { 18697 contextLabel = 0; 18698 shift = templateLength - 1; 18699 18700 for (k = 0; k < templateLength; k++, shift--) { 18701 j0 = j + templateX[k]; 18702 18703 if (j0 >= 0 && j0 < width) { 18704 i0 = i + templateY[k]; 18705 18706 if (i0 >= 0) { 18707 bit = bitmap[i0][j0]; 18708 18709 if (bit) { 18710 contextLabel |= bit << shift; 18711 } 18712 } 18713 } 18714 } 18715 } 18716 18717 const pixel = decoder.readBit(contexts, contextLabel); 18718 row[j] = pixel; 18719 } 18720 } 18721 18722 return bitmap; 18723} 18724 18725function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) { 18726 let codingTemplate = RefinementTemplates[templateIndex].coding; 18727 18728 if (templateIndex === 0) { 18729 codingTemplate = codingTemplate.concat([at[0]]); 18730 } 18731 18732 const codingTemplateLength = codingTemplate.length; 18733 const codingTemplateX = new Int32Array(codingTemplateLength); 18734 const codingTemplateY = new Int32Array(codingTemplateLength); 18735 let k; 18736 18737 for (k = 0; k < codingTemplateLength; k++) { 18738 codingTemplateX[k] = codingTemplate[k].x; 18739 codingTemplateY[k] = codingTemplate[k].y; 18740 } 18741 18742 let referenceTemplate = RefinementTemplates[templateIndex].reference; 18743 18744 if (templateIndex === 0) { 18745 referenceTemplate = referenceTemplate.concat([at[1]]); 18746 } 18747 18748 const referenceTemplateLength = referenceTemplate.length; 18749 const referenceTemplateX = new Int32Array(referenceTemplateLength); 18750 const referenceTemplateY = new Int32Array(referenceTemplateLength); 18751 18752 for (k = 0; k < referenceTemplateLength; k++) { 18753 referenceTemplateX[k] = referenceTemplate[k].x; 18754 referenceTemplateY[k] = referenceTemplate[k].y; 18755 } 18756 18757 const referenceWidth = referenceBitmap[0].length; 18758 const referenceHeight = referenceBitmap.length; 18759 const pseudoPixelContext = RefinementReusedContexts[templateIndex]; 18760 const bitmap = []; 18761 const decoder = decodingContext.decoder; 18762 const contexts = decodingContext.contextCache.getContexts("GR"); 18763 let ltp = 0; 18764 18765 for (let i = 0; i < height; i++) { 18766 if (prediction) { 18767 const sltp = decoder.readBit(contexts, pseudoPixelContext); 18768 ltp ^= sltp; 18769 18770 if (ltp) { 18771 throw new Jbig2Error("prediction is not supported"); 18772 } 18773 } 18774 18775 const row = new Uint8Array(width); 18776 bitmap.push(row); 18777 18778 for (let j = 0; j < width; j++) { 18779 let i0, j0; 18780 let contextLabel = 0; 18781 18782 for (k = 0; k < codingTemplateLength; k++) { 18783 i0 = i + codingTemplateY[k]; 18784 j0 = j + codingTemplateX[k]; 18785 18786 if (i0 < 0 || j0 < 0 || j0 >= width) { 18787 contextLabel <<= 1; 18788 } else { 18789 contextLabel = contextLabel << 1 | bitmap[i0][j0]; 18790 } 18791 } 18792 18793 for (k = 0; k < referenceTemplateLength; k++) { 18794 i0 = i + referenceTemplateY[k] - offsetY; 18795 j0 = j + referenceTemplateX[k] - offsetX; 18796 18797 if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) { 18798 contextLabel <<= 1; 18799 } else { 18800 contextLabel = contextLabel << 1 | referenceBitmap[i0][j0]; 18801 } 18802 } 18803 18804 const pixel = decoder.readBit(contexts, contextLabel); 18805 row[j] = pixel; 18806 } 18807 } 18808 18809 return bitmap; 18810} 18811 18812function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) { 18813 if (huffman && refinement) { 18814 throw new Jbig2Error("symbol refinement with Huffman is not supported"); 18815 } 18816 18817 const newSymbols = []; 18818 let currentHeight = 0; 18819 let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols); 18820 const decoder = decodingContext.decoder; 18821 const contextCache = decodingContext.contextCache;
vendor: 4,492 bytes, lines 18822-18954
18822 let tableB1, symbolWidths; 18823 18824 if (huffman) { 18825 tableB1 = getStandardTable(1); 18826 symbolWidths = []; 18827 symbolCodeLength = Math.max(symbolCodeLength, 1); 18828 } 18829 18830 while (newSymbols.length < numberOfNewSymbols) { 18831 const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder); 18832 currentHeight += deltaHeight; 18833 let currentWidth = 0, 18834 totalWidth = 0; 18835 const firstSymbol = huffman ? symbolWidths.length : 0; 18836 18837 while (true) { 18838 const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder); 18839 18840 if (deltaWidth === null) { 18841 break; 18842 } 18843 18844 currentWidth += deltaWidth; 18845 totalWidth += currentWidth; 18846 let bitmap; 18847 18848 if (refinement) { 18849 const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder); 18850 18851 if (numberOfInstances > 1) { 18852 bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput); 18853 } else { 18854 const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength); 18855 const rdx = decodeInteger(contextCache, "IARDX", decoder); 18856 const rdy = decodeInteger(contextCache, "IARDY", decoder); 18857 const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length]; 18858 bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext); 18859 } 18860 18861 newSymbols.push(bitmap); 18862 } else if (huffman) { 18863 symbolWidths.push(currentWidth); 18864 } else { 18865 bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext); 18866 newSymbols.push(bitmap); 18867 } 18868 } 18869 18870 if (huffman && !refinement) { 18871 const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput); 18872 huffmanInput.byteAlign(); 18873 let collectiveBitmap; 18874 18875 if (bitmapSize === 0) { 18876 collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight); 18877 } else { 18878 const originalEnd = huffmanInput.end; 18879 const bitmapEnd = huffmanInput.position + bitmapSize; 18880 huffmanInput.end = bitmapEnd; 18881 collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false); 18882 huffmanInput.end = originalEnd; 18883 huffmanInput.position = bitmapEnd; 18884 } 18885 18886 const numberOfSymbolsDecoded = symbolWidths.length; 18887 18888 if (firstSymbol === numberOfSymbolsDecoded - 1) { 18889 newSymbols.push(collectiveBitmap); 18890 } else { 18891 let i, 18892 y, 18893 xMin = 0, 18894 xMax, 18895 bitmapWidth, 18896 symbolBitmap; 18897 18898 for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) { 18899 bitmapWidth = symbolWidths[i]; 18900 xMax = xMin + bitmapWidth; 18901 symbolBitmap = []; 18902 18903 for (y = 0; y < currentHeight; y++) { 18904 symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax)); 18905 } 18906 18907 newSymbols.push(symbolBitmap); 18908 xMin = xMax; 18909 } 18910 } 18911 } 18912 } 18913 18914 const exportedSymbols = [], 18915 flags = []; 18916 let currentFlag = false, 18917 i, 18918 ii; 18919 const totalSymbolsLength = symbols.length + numberOfNewSymbols; 18920 18921 while (flags.length < totalSymbolsLength) { 18922 let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder); 18923 18924 while (runLength--) { 18925 flags.push(currentFlag); 18926 } 18927 18928 currentFlag = !currentFlag; 18929 } 18930 18931 for (i = 0, ii = symbols.length; i < ii; i++) { 18932 if (flags[i]) { 18933 exportedSymbols.push(symbols[i]); 18934 } 18935 } 18936 18937 for (let j = 0; j < numberOfNewSymbols; i++, j++) { 18938 if (flags[i]) { 18939 exportedSymbols.push(newSymbols[j]); 18940 } 18941 } 18942 18943 return exportedSymbols; 18944} 18945 18946function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) { 18947 if (huffman && refinement) { 18948 throw new Jbig2Error("refinement with Huffman is not supported"); 18949 } 18950 18951 const bitmap = []; 18952 let i, row; 18953 18954 for (i = 0; i < height; i++) {
vendor: 32,584 bytes, lines 18955-20041
18955 row = new Uint8Array(width); 18956 18957 if (defaultPixelValue) { 18958 for (let j = 0; j < width; j++) { 18959 row[j] = defaultPixelValue; 18960 } 18961 } 18962 18963 bitmap.push(row); 18964 } 18965 18966 const decoder = decodingContext.decoder; 18967 const contextCache = decodingContext.contextCache; 18968 let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder); 18969 let firstS = 0; 18970 i = 0; 18971 18972 while (i < numberOfSymbolInstances) { 18973 const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder); 18974 stripT += deltaT; 18975 const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder); 18976 firstS += deltaFirstS; 18977 let currentS = firstS; 18978 18979 do { 18980 let currentT = 0; 18981 18982 if (stripSize > 1) { 18983 currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder); 18984 } 18985 18986 const t = stripSize * stripT + currentT; 18987 const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength); 18988 const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder)); 18989 let symbolBitmap = inputSymbols[symbolId]; 18990 let symbolWidth = symbolBitmap[0].length; 18991 let symbolHeight = symbolBitmap.length; 18992 18993 if (applyRefinement) { 18994 const rdw = decodeInteger(contextCache, "IARDW", decoder); 18995 const rdh = decodeInteger(contextCache, "IARDH", decoder); 18996 const rdx = decodeInteger(contextCache, "IARDX", decoder); 18997 const rdy = decodeInteger(contextCache, "IARDY", decoder); 18998 symbolWidth += rdw; 18999 symbolHeight += rdh; 19000 symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext); 19001 } 19002 19003 const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1); 19004 const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0); 19005 let s2, t2, symbolRow; 19006 19007 if (transposed) { 19008 for (s2 = 0; s2 < symbolHeight; s2++) { 19009 row = bitmap[offsetS + s2]; 19010 19011 if (!row) { 19012 continue; 19013 } 19014 19015 symbolRow = symbolBitmap[s2]; 19016 const maxWidth = Math.min(width - offsetT, symbolWidth); 19017 19018 switch (combinationOperator) { 19019 case 0: 19020 for (t2 = 0; t2 < maxWidth; t2++) { 19021 row[offsetT + t2] |= symbolRow[t2]; 19022 } 19023 19024 break; 19025 19026 case 2: 19027 for (t2 = 0; t2 < maxWidth; t2++) { 19028 row[offsetT + t2] ^= symbolRow[t2]; 19029 } 19030 19031 break; 19032 19033 default: 19034 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 19035 } 19036 } 19037 19038 currentS += symbolHeight - 1; 19039 } else { 19040 for (t2 = 0; t2 < symbolHeight; t2++) { 19041 row = bitmap[offsetT + t2]; 19042 19043 if (!row) { 19044 continue; 19045 } 19046 19047 symbolRow = symbolBitmap[t2]; 19048 19049 switch (combinationOperator) { 19050 case 0: 19051 for (s2 = 0; s2 < symbolWidth; s2++) { 19052 row[offsetS + s2] |= symbolRow[s2]; 19053 } 19054 19055 break; 19056 19057 case 2: 19058 for (s2 = 0; s2 < symbolWidth; s2++) { 19059 row[offsetS + s2] ^= symbolRow[s2]; 19060 } 19061 19062 break; 19063 19064 default: 19065 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 19066 } 19067 } 19068 19069 currentS += symbolWidth - 1; 19070 } 19071 19072 i++; 19073 const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder); 19074 19075 if (deltaS === null) { 19076 break; 19077 } 19078 19079 currentS += deltaS + dsOffset; 19080 } while (true); 19081 } 19082 19083 return bitmap; 19084} 19085 19086function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) { 19087 const at = []; 19088 19089 if (!mmr) { 19090 at.push({ 19091 x: -patternWidth, 19092 y: 0 19093 }); 19094 19095 if (template === 0) { 19096 at.push({ 19097 x: -3, 19098 y: -1 19099 }, { 19100 x: 2, 19101 y: -2 19102 }, { 19103 x: -2, 19104 y: -2 19105 }); 19106 } 19107 } 19108 19109 const collectiveWidth = (maxPatternIndex + 1) * patternWidth; 19110 const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext); 19111 const patterns = []; 19112 19113 for (let i = 0; i <= maxPatternIndex; i++) { 19114 const patternBitmap = []; 19115 const xMin = patternWidth * i; 19116 const xMax = xMin + patternWidth; 19117 19118 for (let y = 0; y < patternHeight; y++) { 19119 patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax)); 19120 } 19121 19122 patterns.push(patternBitmap); 19123 } 19124 19125 return patterns; 19126} 19127 19128function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) { 19129 const skip = null; 19130 19131 if (enableSkip) { 19132 throw new Jbig2Error("skip is not supported"); 19133 } 19134 19135 if (combinationOperator !== 0) { 19136 throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`); 19137 } 19138 19139 const regionBitmap = []; 19140 let i, j, row; 19141 19142 for (i = 0; i < regionHeight; i++) { 19143 row = new Uint8Array(regionWidth); 19144 19145 if (defaultPixelValue) { 19146 for (j = 0; j < regionWidth; j++) { 19147 row[j] = defaultPixelValue; 19148 } 19149 } 19150 19151 regionBitmap.push(row); 19152 } 19153 19154 const numberOfPatterns = patterns.length; 19155 const pattern0 = patterns[0]; 19156 const patternWidth = pattern0[0].length, 19157 patternHeight = pattern0.length; 19158 const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns); 19159 const at = []; 19160 19161 if (!mmr) { 19162 at.push({ 19163 x: template <= 1 ? 3 : 2, 19164 y: -1 19165 }); 19166 19167 if (template === 0) { 19168 at.push({ 19169 x: -3, 19170 y: -1 19171 }, { 19172 x: 2, 19173 y: -2 19174 }, { 19175 x: -2, 19176 y: -2 19177 }); 19178 } 19179 } 19180 19181 const grayScaleBitPlanes = []; 19182 let mmrInput, bitmap; 19183 19184 if (mmr) { 19185 mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end); 19186 } 19187 19188 for (i = bitsPerValue - 1; i >= 0; i--) { 19189 if (mmr) { 19190 bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true); 19191 } else { 19192 bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext); 19193 } 19194 19195 grayScaleBitPlanes[i] = bitmap; 19196 } 19197 19198 let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow; 19199 19200 for (mg = 0; mg < gridHeight; mg++) { 19201 for (ng = 0; ng < gridWidth; ng++) { 19202 bit = 0; 19203 patternIndex = 0; 19204 19205 for (j = bitsPerValue - 1; j >= 0; j--) { 19206 bit ^= grayScaleBitPlanes[j][mg][ng]; 19207 patternIndex |= bit << j; 19208 } 19209 19210 patternBitmap = patterns[patternIndex]; 19211 x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8; 19212 y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8; 19213 19214 if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) { 19215 for (i = 0; i < patternHeight; i++) { 19216 regionRow = regionBitmap[y + i]; 19217 patternRow = patternBitmap[i]; 19218 19219 for (j = 0; j < patternWidth; j++) { 19220 regionRow[x + j] |= patternRow[j]; 19221 } 19222 } 19223 } else { 19224 let regionX, regionY; 19225 19226 for (i = 0; i < patternHeight; i++) { 19227 regionY = y + i; 19228 19229 if (regionY < 0 || regionY >= regionHeight) { 19230 continue; 19231 } 19232 19233 regionRow = regionBitmap[regionY]; 19234 patternRow = patternBitmap[i]; 19235 19236 for (j = 0; j < patternWidth; j++) { 19237 regionX = x + j; 19238 19239 if (regionX >= 0 && regionX < regionWidth) { 19240 regionRow[regionX] |= patternRow[j]; 19241 } 19242 } 19243 } 19244 } 19245 } 19246 } 19247 19248 return regionBitmap; 19249} 19250 19251function readSegmentHeader(data, start) { 19252 const segmentHeader = {}; 19253 segmentHeader.number = (0, _core_utils.readUint32)(data, start); 19254 const flags = data[start + 4]; 19255 const segmentType = flags & 0x3f; 19256 19257 if (!SegmentTypes[segmentType]) { 19258 throw new Jbig2Error("invalid segment type: " + segmentType); 19259 } 19260 19261 segmentHeader.type = segmentType; 19262 segmentHeader.typeName = SegmentTypes[segmentType]; 19263 segmentHeader.deferredNonRetain = !!(flags & 0x80); 19264 const pageAssociationFieldSize = !!(flags & 0x40); 19265 const referredFlags = data[start + 5]; 19266 let referredToCount = referredFlags >> 5 & 7; 19267 const retainBits = [referredFlags & 31]; 19268 let position = start + 6; 19269 19270 if (referredFlags === 7) { 19271 referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff; 19272 position += 3; 19273 let bytes = referredToCount + 7 >> 3; 19274 retainBits[0] = data[position++]; 19275 19276 while (--bytes > 0) { 19277 retainBits.push(data[position++]); 19278 } 19279 } else if (referredFlags === 5 || referredFlags === 6) { 19280 throw new Jbig2Error("invalid referred-to flags"); 19281 } 19282 19283 segmentHeader.retainBits = retainBits; 19284 let referredToSegmentNumberSize = 4; 19285 19286 if (segmentHeader.number <= 256) { 19287 referredToSegmentNumberSize = 1; 19288 } else if (segmentHeader.number <= 65536) { 19289 referredToSegmentNumberSize = 2; 19290 } 19291 19292 const referredTo = []; 19293 let i, ii; 19294 19295 for (i = 0; i < referredToCount; i++) { 19296 let number; 19297 19298 if (referredToSegmentNumberSize === 1) { 19299 number = data[position]; 19300 } else if (referredToSegmentNumberSize === 2) { 19301 number = (0, _core_utils.readUint16)(data, position); 19302 } else { 19303 number = (0, _core_utils.readUint32)(data, position); 19304 } 19305 19306 referredTo.push(number); 19307 position += referredToSegmentNumberSize; 19308 } 19309 19310 segmentHeader.referredTo = referredTo; 19311 19312 if (!pageAssociationFieldSize) { 19313 segmentHeader.pageAssociation = data[position++]; 19314 } else { 19315 segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position); 19316 position += 4; 19317 } 19318 19319 segmentHeader.length = (0, _core_utils.readUint32)(data, position); 19320 position += 4; 19321 19322 if (segmentHeader.length === 0xffffffff) { 19323 if (segmentType === 38) { 19324 const genericRegionInfo = readRegionSegmentInformation(data, position); 19325 const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength]; 19326 const genericRegionMmr = !!(genericRegionSegmentFlags & 1); 19327 const searchPatternLength = 6; 19328 const searchPattern = new Uint8Array(searchPatternLength); 19329 19330 if (!genericRegionMmr) { 19331 searchPattern[0] = 0xff; 19332 searchPattern[1] = 0xac; 19333 } 19334 19335 searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff; 19336 searchPattern[3] = genericRegionInfo.height >> 16 & 0xff; 19337 searchPattern[4] = genericRegionInfo.height >> 8 & 0xff; 19338 searchPattern[5] = genericRegionInfo.height & 0xff; 19339 19340 for (i = position, ii = data.length; i < ii; i++) { 19341 let j = 0; 19342 19343 while (j < searchPatternLength && searchPattern[j] === data[i + j]) { 19344 j++; 19345 } 19346 19347 if (j === searchPatternLength) { 19348 segmentHeader.length = i + searchPatternLength; 19349 break; 19350 } 19351 } 19352 19353 if (segmentHeader.length === 0xffffffff) { 19354 throw new Jbig2Error("segment end was not found"); 19355 } 19356 } else { 19357 throw new Jbig2Error("invalid unknown segment length"); 19358 } 19359 } 19360 19361 segmentHeader.headerEnd = position; 19362 return segmentHeader; 19363} 19364 19365function readSegments(header, data, start, end) { 19366 const segments = []; 19367 let position = start; 19368 19369 while (position < end) { 19370 const segmentHeader = readSegmentHeader(data, position); 19371 position = segmentHeader.headerEnd; 19372 const segment = { 19373 header: segmentHeader, 19374 data 19375 }; 19376 19377 if (!header.randomAccess) { 19378 segment.start = position; 19379 position += segmentHeader.length; 19380 segment.end = position; 19381 } 19382 19383 segments.push(segment); 19384 19385 if (segmentHeader.type === 51) { 19386 break; 19387 } 19388 } 19389 19390 if (header.randomAccess) { 19391 for (let i = 0, ii = segments.length; i < ii; i++) { 19392 segments[i].start = position; 19393 position += segments[i].header.length; 19394 segments[i].end = position; 19395 } 19396 } 19397 19398 return segments; 19399} 19400 19401function readRegionSegmentInformation(data, start) { 19402 return { 19403 width: (0, _core_utils.readUint32)(data, start), 19404 height: (0, _core_utils.readUint32)(data, start + 4), 19405 x: (0, _core_utils.readUint32)(data, start + 8), 19406 y: (0, _core_utils.readUint32)(data, start + 12), 19407 combinationOperator: data[start + 16] & 7 19408 }; 19409} 19410 19411const RegionSegmentInformationFieldLength = 17; 19412 19413function processSegment(segment, visitor) { 19414 const header = segment.header; 19415 const data = segment.data, 19416 end = segment.end; 19417 let position = segment.start; 19418 let args, at, i, atLength; 19419 19420 switch (header.type) { 19421 case 0: 19422 const dictionary = {}; 19423 const dictionaryFlags = (0, _core_utils.readUint16)(data, position); 19424 dictionary.huffman = !!(dictionaryFlags & 1); 19425 dictionary.refinement = !!(dictionaryFlags & 2); 19426 dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3; 19427 dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3; 19428 dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1; 19429 dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1; 19430 dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256); 19431 dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512); 19432 dictionary.template = dictionaryFlags >> 10 & 3; 19433 dictionary.refinementTemplate = dictionaryFlags >> 12 & 1; 19434 position += 2; 19435 19436 if (!dictionary.huffman) { 19437 atLength = dictionary.template === 0 ? 4 : 1; 19438 at = []; 19439 19440 for (i = 0; i < atLength; i++) { 19441 at.push({ 19442 x: (0, _core_utils.readInt8)(data, position), 19443 y: (0, _core_utils.readInt8)(data, position + 1) 19444 }); 19445 position += 2; 19446 } 19447 19448 dictionary.at = at; 19449 } 19450 19451 if (dictionary.refinement && !dictionary.refinementTemplate) { 19452 at = []; 19453 19454 for (i = 0; i < 2; i++) { 19455 at.push({ 19456 x: (0, _core_utils.readInt8)(data, position), 19457 y: (0, _core_utils.readInt8)(data, position + 1) 19458 }); 19459 position += 2; 19460 } 19461 19462 dictionary.refinementAt = at; 19463 } 19464 19465 dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position); 19466 position += 4; 19467 dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position); 19468 position += 4; 19469 args = [dictionary, header.number, header.referredTo, data, position, end]; 19470 break; 19471 19472 case 6: 19473 case 7: 19474 const textRegion = {}; 19475 textRegion.info = readRegionSegmentInformation(data, position); 19476 position += RegionSegmentInformationFieldLength; 19477 const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position); 19478 position += 2; 19479 textRegion.huffman = !!(textRegionSegmentFlags & 1); 19480 textRegion.refinement = !!(textRegionSegmentFlags & 2); 19481 textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3; 19482 textRegion.stripSize = 1 << textRegion.logStripSize; 19483 textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3; 19484 textRegion.transposed = !!(textRegionSegmentFlags & 64); 19485 textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3; 19486 textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1; 19487 textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27; 19488 textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1; 19489 19490 if (textRegion.huffman) { 19491 const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position); 19492 position += 2; 19493 textRegion.huffmanFS = textRegionHuffmanFlags & 3; 19494 textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3; 19495 textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3; 19496 textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3; 19497 textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3; 19498 textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3; 19499 textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3; 19500 textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000); 19501 } 19502 19503 if (textRegion.refinement && !textRegion.refinementTemplate) { 19504 at = []; 19505 19506 for (i = 0; i < 2; i++) { 19507 at.push({ 19508 x: (0, _core_utils.readInt8)(data, position), 19509 y: (0, _core_utils.readInt8)(data, position + 1) 19510 }); 19511 position += 2; 19512 } 19513 19514 textRegion.refinementAt = at; 19515 } 19516 19517 textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position); 19518 position += 4; 19519 args = [textRegion, header.referredTo, data, position, end]; 19520 break; 19521 19522 case 16: 19523 const patternDictionary = {}; 19524 const patternDictionaryFlags = data[position++]; 19525 patternDictionary.mmr = !!(patternDictionaryFlags & 1); 19526 patternDictionary.template = patternDictionaryFlags >> 1 & 3; 19527 patternDictionary.patternWidth = data[position++]; 19528 patternDictionary.patternHeight = data[position++]; 19529 patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position); 19530 position += 4; 19531 args = [patternDictionary, header.number, data, position, end]; 19532 break; 19533 19534 case 22: 19535 case 23: 19536 const halftoneRegion = {}; 19537 halftoneRegion.info = readRegionSegmentInformation(data, position); 19538 position += RegionSegmentInformationFieldLength; 19539 const halftoneRegionFlags = data[position++]; 19540 halftoneRegion.mmr = !!(halftoneRegionFlags & 1); 19541 halftoneRegion.template = halftoneRegionFlags >> 1 & 3; 19542 halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8); 19543 halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7; 19544 halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1; 19545 halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position); 19546 position += 4; 19547 halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position); 19548 position += 4; 19549 halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff; 19550 position += 4; 19551 halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff; 19552 position += 4; 19553 halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position); 19554 position += 2; 19555 halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position); 19556 position += 2; 19557 args = [halftoneRegion, header.referredTo, data, position, end]; 19558 break; 19559 19560 case 38: 19561 case 39: 19562 const genericRegion = {}; 19563 genericRegion.info = readRegionSegmentInformation(data, position); 19564 position += RegionSegmentInformationFieldLength; 19565 const genericRegionSegmentFlags = data[position++]; 19566 genericRegion.mmr = !!(genericRegionSegmentFlags & 1); 19567 genericRegion.template = genericRegionSegmentFlags >> 1 & 3; 19568 genericRegion.prediction = !!(genericRegionSegmentFlags & 8); 19569 19570 if (!genericRegion.mmr) { 19571 atLength = genericRegion.template === 0 ? 4 : 1; 19572 at = []; 19573 19574 for (i = 0; i < atLength; i++) { 19575 at.push({ 19576 x: (0, _core_utils.readInt8)(data, position), 19577 y: (0, _core_utils.readInt8)(data, position + 1) 19578 }); 19579 position += 2; 19580 } 19581 19582 genericRegion.at = at; 19583 } 19584 19585 args = [genericRegion, data, position, end]; 19586 break; 19587 19588 case 48: 19589 const pageInfo = { 19590 width: (0, _core_utils.readUint32)(data, position), 19591 height: (0, _core_utils.readUint32)(data, position + 4), 19592 resolutionX: (0, _core_utils.readUint32)(data, position + 8), 19593 resolutionY: (0, _core_utils.readUint32)(data, position + 12) 19594 }; 19595 19596 if (pageInfo.height === 0xffffffff) { 19597 delete pageInfo.height; 19598 } 19599 19600 const pageSegmentFlags = data[position + 16]; 19601 (0, _core_utils.readUint16)(data, position + 17); 19602 pageInfo.lossless = !!(pageSegmentFlags & 1); 19603 pageInfo.refinement = !!(pageSegmentFlags & 2); 19604 pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1; 19605 pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3; 19606 pageInfo.requiresBuffer = !!(pageSegmentFlags & 32); 19607 pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64); 19608 args = [pageInfo]; 19609 break; 19610 19611 case 49: 19612 break; 19613 19614 case 50: 19615 break; 19616 19617 case 51: 19618 break; 19619 19620 case 53: 19621 args = [header.number, data, position, end]; 19622 break; 19623 19624 case 62: 19625 break; 19626 19627 default: 19628 throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`); 19629 } 19630 19631 const callbackName = "on" + header.typeName; 19632 19633 if (callbackName in visitor) { 19634 visitor[callbackName].apply(visitor, args); 19635 } 19636} 19637 19638function processSegments(segments, visitor) { 19639 for (let i = 0, ii = segments.length; i < ii; i++) { 19640 processSegment(segments[i], visitor); 19641 } 19642} 19643 19644function parseJbig2Chunks(chunks) { 19645 const visitor = new SimpleSegmentVisitor(); 19646 19647 for (let i = 0, ii = chunks.length; i < ii; i++) { 19648 const chunk = chunks[i]; 19649 const segments = readSegments({}, chunk.data, chunk.start, chunk.end); 19650 processSegments(segments, visitor); 19651 } 19652 19653 return visitor.buffer; 19654} 19655 19656function parseJbig2(data) { 19657 throw new Error("Not implemented: parseJbig2"); 19658} 19659 19660class SimpleSegmentVisitor { 19661 onPageInformation(info) { 19662 this.currentPageInfo = info; 19663 const rowSize = info.width + 7 >> 3; 19664 const buffer = new Uint8ClampedArray(rowSize * info.height); 19665 19666 if (info.defaultPixelValue) { 19667 buffer.fill(0xff); 19668 } 19669 19670 this.buffer = buffer; 19671 } 19672 19673 drawBitmap(regionInfo, bitmap) { 19674 const pageInfo = this.currentPageInfo; 19675 const width = regionInfo.width, 19676 height = regionInfo.height; 19677 const rowSize = pageInfo.width + 7 >> 3; 19678 const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator; 19679 const buffer = this.buffer; 19680 const mask0 = 128 >> (regionInfo.x & 7); 19681 let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3); 19682 let i, j, mask, offset; 19683 19684 switch (combinationOperator) { 19685 case 0: 19686 for (i = 0; i < height; i++) { 19687 mask = mask0; 19688 offset = offset0; 19689 19690 for (j = 0; j < width; j++) { 19691 if (bitmap[i][j]) { 19692 buffer[offset] |= mask; 19693 } 19694 19695 mask >>= 1; 19696 19697 if (!mask) { 19698 mask = 128; 19699 offset++; 19700 } 19701 } 19702 19703 offset0 += rowSize; 19704 } 19705 19706 break; 19707 19708 case 2: 19709 for (i = 0; i < height; i++) { 19710 mask = mask0; 19711 offset = offset0; 19712 19713 for (j = 0; j < width; j++) { 19714 if (bitmap[i][j]) { 19715 buffer[offset] ^= mask; 19716 } 19717 19718 mask >>= 1; 19719 19720 if (!mask) { 19721 mask = 128; 19722 offset++; 19723 } 19724 } 19725 19726 offset0 += rowSize; 19727 } 19728 19729 break; 19730 19731 default: 19732 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 19733 } 19734 } 19735 19736 onImmediateGenericRegion(region, data, start, end) { 19737 const regionInfo = region.info; 19738 const decodingContext = new DecodingContext(data, start, end); 19739 const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext); 19740 this.drawBitmap(regionInfo, bitmap); 19741 } 19742 19743 onImmediateLosslessGenericRegion() { 19744 this.onImmediateGenericRegion(...arguments); 19745 } 19746 19747 onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) { 19748 let huffmanTables, huffmanInput; 19749 19750 if (dictionary.huffman) { 19751 huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables); 19752 huffmanInput = new Reader(data, start, end); 19753 } 19754 19755 let symbols = this.symbols; 19756 19757 if (!symbols) { 19758 this.symbols = symbols = {}; 19759 } 19760 19761 const inputSymbols = []; 19762 19763 for (const referredSegment of referredSegments) { 19764 const referredSymbols = symbols[referredSegment]; 19765 19766 if (referredSymbols) { 19767 inputSymbols.push(...referredSymbols); 19768 } 19769 } 19770 19771 const decodingContext = new DecodingContext(data, start, end); 19772 symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput); 19773 } 19774 19775 onImmediateTextRegion(region, referredSegments, data, start, end) { 19776 const regionInfo = region.info; 19777 let huffmanTables, huffmanInput; 19778 const symbols = this.symbols; 19779 const inputSymbols = []; 19780 19781 for (const referredSegment of referredSegments) { 19782 const referredSymbols = symbols[referredSegment]; 19783 19784 if (referredSymbols) { 19785 inputSymbols.push(...referredSymbols); 19786 } 19787 } 19788 19789 const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length); 19790 19791 if (region.huffman) { 19792 huffmanInput = new Reader(data, start, end); 19793 huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput); 19794 } 19795 19796 const decodingContext = new DecodingContext(data, start, end); 19797 const bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput); 19798 this.drawBitmap(regionInfo, bitmap); 19799 } 19800 19801 onImmediateLosslessTextRegion() { 19802 this.onImmediateTextRegion(...arguments); 19803 } 19804 19805 onPatternDictionary(dictionary, currentSegment, data, start, end) { 19806 let patterns = this.patterns; 19807 19808 if (!patterns) { 19809 this.patterns = patterns = {}; 19810 } 19811 19812 const decodingContext = new DecodingContext(data, start, end); 19813 patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext); 19814 } 19815 19816 onImmediateHalftoneRegion(region, referredSegments, data, start, end) { 19817 const patterns = this.patterns[referredSegments[0]]; 19818 const regionInfo = region.info; 19819 const decodingContext = new DecodingContext(data, start, end); 19820 const bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext); 19821 this.drawBitmap(regionInfo, bitmap); 19822 } 19823 19824 onImmediateLosslessHalftoneRegion() { 19825 this.onImmediateHalftoneRegion(...arguments); 19826 } 19827 19828 onTables(currentSegment, data, start, end) { 19829 let customTables = this.customTables; 19830 19831 if (!customTables) { 19832 this.customTables = customTables = {}; 19833 } 19834 19835 customTables[currentSegment] = decodeTablesSegment(data, start, end); 19836 } 19837 19838} 19839 19840class HuffmanLine { 19841 constructor(lineData) { 19842 if (lineData.length === 2) { 19843 this.isOOB = true; 19844 this.rangeLow = 0; 19845 this.prefixLength = lineData[0]; 19846 this.rangeLength = 0; 19847 this.prefixCode = lineData[1]; 19848 this.isLowerRange = false; 19849 } else { 19850 this.isOOB = false; 19851 this.rangeLow = lineData[0]; 19852 this.prefixLength = lineData[1]; 19853 this.rangeLength = lineData[2]; 19854 this.prefixCode = lineData[3]; 19855 this.isLowerRange = lineData[4] === "lower"; 19856 } 19857 } 19858 19859} 19860 19861class HuffmanTreeNode { 19862 constructor(line) { 19863 this.children = []; 19864 19865 if (line) { 19866 this.isLeaf = true; 19867 this.rangeLength = line.rangeLength; 19868 this.rangeLow = line.rangeLow; 19869 this.isLowerRange = line.isLowerRange; 19870 this.isOOB = line.isOOB; 19871 } else { 19872 this.isLeaf = false; 19873 } 19874 } 19875 19876 buildTree(line, shift) { 19877 const bit = line.prefixCode >> shift & 1; 19878 19879 if (shift <= 0) { 19880 this.children[bit] = new HuffmanTreeNode(line); 19881 } else { 19882 let node = this.children[bit]; 19883 19884 if (!node) { 19885 this.children[bit] = node = new HuffmanTreeNode(null); 19886 } 19887 19888 node.buildTree(line, shift - 1); 19889 } 19890 } 19891 19892 decodeNode(reader) { 19893 if (this.isLeaf) { 19894 if (this.isOOB) { 19895 return null; 19896 } 19897 19898 const htOffset = reader.readBits(this.rangeLength); 19899 return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset); 19900 } 19901 19902 const node = this.children[reader.readBit()]; 19903 19904 if (!node) { 19905 throw new Jbig2Error("invalid Huffman data"); 19906 } 19907 19908 return node.decodeNode(reader); 19909 } 19910 19911} 19912 19913class HuffmanTable { 19914 constructor(lines, prefixCodesDone) { 19915 if (!prefixCodesDone) { 19916 this.assignPrefixCodes(lines); 19917 } 19918 19919 this.rootNode = new HuffmanTreeNode(null); 19920 19921 for (let i = 0, ii = lines.length; i < ii; i++) { 19922 const line = lines[i]; 19923 19924 if (line.prefixLength > 0) { 19925 this.rootNode.buildTree(line, line.prefixLength - 1); 19926 } 19927 } 19928 } 19929 19930 decode(reader) { 19931 return this.rootNode.decodeNode(reader); 19932 } 19933 19934 assignPrefixCodes(lines) { 19935 const linesLength = lines.length; 19936 let prefixLengthMax = 0; 19937 19938 for (let i = 0; i < linesLength; i++) { 19939 prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength); 19940 } 19941 19942 const histogram = new Uint32Array(prefixLengthMax + 1); 19943 19944 for (let i = 0; i < linesLength; i++) { 19945 histogram[lines[i].prefixLength]++; 19946 } 19947 19948 let currentLength = 1, 19949 firstCode = 0, 19950 currentCode, 19951 currentTemp, 19952 line; 19953 histogram[0] = 0; 19954 19955 while (currentLength <= prefixLengthMax) { 19956 firstCode = firstCode + histogram[currentLength - 1] << 1; 19957 currentCode = firstCode; 19958 currentTemp = 0; 19959 19960 while (currentTemp < linesLength) { 19961 line = lines[currentTemp]; 19962 19963 if (line.prefixLength === currentLength) { 19964 line.prefixCode = currentCode; 19965 currentCode++; 19966 } 19967 19968 currentTemp++; 19969 } 19970 19971 currentLength++; 19972 } 19973 } 19974 19975} 19976 19977function decodeTablesSegment(data, start, end) { 19978 const flags = data[start]; 19979 const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff; 19980 const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff; 19981 const reader = new Reader(data, start + 9, end); 19982 const prefixSizeBits = (flags >> 1 & 7) + 1; 19983 const rangeSizeBits = (flags >> 4 & 7) + 1; 19984 const lines = []; 19985 let prefixLength, 19986 rangeLength, 19987 currentRangeLow = lowestValue; 19988 19989 do { 19990 prefixLength = reader.readBits(prefixSizeBits); 19991 rangeLength = reader.readBits(rangeSizeBits); 19992 lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0])); 19993 currentRangeLow += 1 << rangeLength; 19994 } while (currentRangeLow < highestValue); 19995 19996 prefixLength = reader.readBits(prefixSizeBits); 19997 lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"])); 19998 prefixLength = reader.readBits(prefixSizeBits); 19999 lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0])); 20000 20001 if (flags & 1) { 20002 prefixLength = reader.readBits(prefixSizeBits); 20003 lines.push(new HuffmanLine([prefixLength, 0])); 20004 } 20005 20006 return new HuffmanTable(lines, false); 20007} 20008 20009const standardTablesCache = {}; 20010 20011function getStandardTable(number) { 20012 let table = standardTablesCache[number]; 20013 20014 if (table) { 20015 return table; 20016 } 20017 20018 let lines; 20019 20020 switch (number) { 20021 case 1: 20022 lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]]; 20023 break; 20024 20025 case 2: 20026 lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [75, 6, 32, 0x3e], [6, 0x3f]]; 20027 break; 20028 20029 case 3: 20030 lines = [[-256, 8, 8, 0xfe], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [-257, 8, 32, 0xff, "lower"], [75, 7, 32, 0x7e], [6, 0x3e]]; 20031 break; 20032 20033 case 4: 20034 lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [76, 5, 32, 0x1f]]; 20035 break; 20036 20037 case 5: 20038 lines = [[-255, 7, 8, 0x7e], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [-256, 7, 32, 0x7f, "lower"], [76, 6, 32, 0x3e]]; 20039 break; 20040 20041 case 6:
vendor: 8,991 bytes, lines 20042-20340
20042 lines = [[-2048, 5, 10, 0x1c], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xa], [-128, 5, 6, 0x1d], [-64, 5, 5, 0x1e], [-32, 4, 5, 0xb], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xc], [1024, 4, 10, 0xd], [-2049, 6, 32, 0x3e, "lower"], [2048, 6, 32, 0x3f]]; 20043 break; 20044 20045 case 7: 20046 lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1a], [-64, 5, 5, 0x1b], [-32, 4, 5, 0xa], [0, 4, 5, 0xb], [32, 5, 5, 0x1c], [64, 5, 6, 0x1d], [128, 4, 7, 0xc], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1e, "lower"], [2048, 5, 32, 0x1f]]; 20047 break; 20048 20049 case 8: 20050 lines = [[-15, 8, 3, 0xfc], [-7, 9, 1, 0x1fc], [-5, 8, 1, 0xfd], [-3, 9, 0, 0x1fd], [-2, 7, 0, 0x7c], [-1, 4, 0, 0xa], [0, 2, 1, 0x0], [2, 5, 0, 0x1a], [3, 6, 0, 0x3a], [4, 3, 4, 0x4], [20, 6, 1, 0x3b], [22, 4, 4, 0xb], [38, 4, 5, 0xc], [70, 5, 6, 0x1b], [134, 5, 7, 0x1c], [262, 6, 7, 0x3c], [390, 7, 8, 0x7d], [646, 6, 10, 0x3d], [-16, 9, 32, 0x1fe, "lower"], [1670, 9, 32, 0x1ff], [2, 0x1]]; 20051 break; 20052 20053 case 9: 20054 lines = [[-31, 8, 4, 0xfc], [-15, 9, 2, 0x1fc], [-11, 8, 2, 0xfd], [-7, 9, 1, 0x1fd], [-5, 7, 1, 0x7c], [-3, 4, 1, 0xa], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1a], [5, 6, 1, 0x3a], [7, 3, 5, 0x4], [39, 6, 2, 0x3b], [43, 4, 5, 0xb], [75, 4, 6, 0xc], [139, 5, 7, 0x1b], [267, 5, 8, 0x1c], [523, 6, 8, 0x3c], [779, 7, 9, 0x7d], [1291, 6, 11, 0x3d], [-32, 9, 32, 0x1fe, "lower"], [3339, 9, 32, 0x1ff], [2, 0x0]]; 20055 break; 20056 20057 case 10: 20058 lines = [[-21, 7, 4, 0x7a], [-5, 8, 0, 0xfc], [-4, 7, 0, 0x7b], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7c], [5, 8, 0, 0xfd], [6, 2, 6, 0x1], [70, 5, 5, 0x1a], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3a], [582, 6, 9, 0x3b], [1094, 6, 10, 0x3c], [2118, 7, 11, 0x7d], [-22, 8, 32, 0xfe, "lower"], [4166, 8, 32, 0xff], [2, 0x2]]; 20059 break; 20060 20061 case 11: 20062 lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xc], [5, 4, 1, 0xd], [7, 5, 1, 0x1c], [9, 5, 2, 0x1d], [13, 6, 2, 0x3c], [17, 7, 2, 0x7a], [21, 7, 3, 0x7b], [29, 7, 4, 0x7c], [45, 7, 5, 0x7d], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]]; 20063 break; 20064 20065 case 12: 20066 lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1c], [6, 5, 1, 0x1d], [8, 6, 1, 0x3c], [10, 7, 0, 0x7a], [11, 7, 1, 0x7b], [13, 7, 2, 0x7c], [17, 7, 3, 0x7d], [25, 7, 4, 0x7e], [41, 8, 5, 0xfe], [73, 8, 32, 0xff]]; 20067 break; 20068 20069 case 13: 20070 lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xc], [4, 5, 0, 0x1c], [5, 4, 1, 0xd], [7, 3, 3, 0x5], [15, 6, 1, 0x3a], [17, 6, 2, 0x3b], [21, 6, 3, 0x3c], [29, 6, 4, 0x3d], [45, 6, 5, 0x3e], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]]; 20071 break; 20072 20073 case 14: 20074 lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]]; 20075 break; 20076 20077 case 15: 20078 lines = [[-24, 7, 4, 0x7c], [-8, 6, 2, 0x3c], [-4, 5, 1, 0x1c], [-2, 4, 0, 0xc], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xd], [3, 5, 1, 0x1d], [5, 6, 2, 0x3d], [9, 7, 4, 0x7d], [-25, 7, 32, 0x7e, "lower"], [25, 7, 32, 0x7f]]; 20079 break; 20080 20081 default: 20082 throw new Jbig2Error(`standard table B.${number} does not exist`); 20083 } 20084 20085 for (let i = 0, ii = lines.length; i < ii; i++) { 20086 lines[i] = new HuffmanLine(lines[i]); 20087 } 20088 20089 table = new HuffmanTable(lines, true); 20090 standardTablesCache[number] = table; 20091 return table; 20092} 20093 20094class Reader { 20095 constructor(data, start, end) { 20096 this.data = data; 20097 this.start = start; 20098 this.end = end; 20099 this.position = start; 20100 this.shift = -1; 20101 this.currentByte = 0; 20102 } 20103 20104 readBit() { 20105 if (this.shift < 0) { 20106 if (this.position >= this.end) { 20107 throw new Jbig2Error("end of data while reading bit"); 20108 } 20109 20110 this.currentByte = this.data[this.position++]; 20111 this.shift = 7; 20112 } 20113 20114 const bit = this.currentByte >> this.shift & 1; 20115 this.shift--; 20116 return bit; 20117 } 20118 20119 readBits(numBits) { 20120 let result = 0, 20121 i; 20122 20123 for (i = numBits - 1; i >= 0; i--) { 20124 result |= this.readBit() << i; 20125 } 20126 20127 return result; 20128 } 20129 20130 byteAlign() { 20131 this.shift = -1; 20132 } 20133 20134 next() { 20135 if (this.position >= this.end) { 20136 return -1; 20137 } 20138 20139 return this.data[this.position++]; 20140 } 20141 20142} 20143 20144function getCustomHuffmanTable(index, referredTo, customTables) { 20145 let currentIndex = 0; 20146 20147 for (let i = 0, ii = referredTo.length; i < ii; i++) { 20148 const table = customTables[referredTo[i]]; 20149 20150 if (table) { 20151 if (index === currentIndex) { 20152 return table; 20153 } 20154 20155 currentIndex++; 20156 } 20157 } 20158 20159 throw new Jbig2Error("can't find custom Huffman table"); 20160} 20161 20162function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) { 20163 const codes = []; 20164 20165 for (let i = 0; i <= 34; i++) { 20166 const codeLength = reader.readBits(4); 20167 codes.push(new HuffmanLine([i, codeLength, 0, 0])); 20168 } 20169 20170 const runCodesTable = new HuffmanTable(codes, false); 20171 codes.length = 0; 20172 20173 for (let i = 0; i < numberOfSymbols;) { 20174 const codeLength = runCodesTable.decode(reader); 20175 20176 if (codeLength >= 32) { 20177 let repeatedLength, numberOfRepeats, j; 20178 20179 switch (codeLength) { 20180 case 32: 20181 if (i === 0) { 20182 throw new Jbig2Error("no previous value in symbol ID table"); 20183 } 20184 20185 numberOfRepeats = reader.readBits(2) + 3; 20186 repeatedLength = codes[i - 1].prefixLength; 20187 break; 20188 20189 case 33: 20190 numberOfRepeats = reader.readBits(3) + 3; 20191 repeatedLength = 0; 20192 break; 20193 20194 case 34: 20195 numberOfRepeats = reader.readBits(7) + 11; 20196 repeatedLength = 0; 20197 break; 20198 20199 default: 20200 throw new Jbig2Error("invalid code length in symbol ID table"); 20201 } 20202 20203 for (j = 0; j < numberOfRepeats; j++) { 20204 codes.push(new HuffmanLine([i, repeatedLength, 0, 0])); 20205 i++; 20206 } 20207 } else { 20208 codes.push(new HuffmanLine([i, codeLength, 0, 0])); 20209 i++; 20210 } 20211 } 20212 20213 reader.byteAlign(); 20214 const symbolIDTable = new HuffmanTable(codes, false); 20215 let customIndex = 0, 20216 tableFirstS, 20217 tableDeltaS, 20218 tableDeltaT; 20219 20220 switch (textRegion.huffmanFS) { 20221 case 0: 20222 case 1: 20223 tableFirstS = getStandardTable(textRegion.huffmanFS + 6); 20224 break; 20225 20226 case 3: 20227 tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables); 20228 customIndex++; 20229 break; 20230 20231 default: 20232 throw new Jbig2Error("invalid Huffman FS selector"); 20233 } 20234 20235 switch (textRegion.huffmanDS) { 20236 case 0: 20237 case 1: 20238 case 2: 20239 tableDeltaS = getStandardTable(textRegion.huffmanDS + 8); 20240 break; 20241 20242 case 3: 20243 tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables); 20244 customIndex++; 20245 break; 20246 20247 default: 20248 throw new Jbig2Error("invalid Huffman DS selector"); 20249 } 20250 20251 switch (textRegion.huffmanDT) { 20252 case 0: 20253 case 1: 20254 case 2: 20255 tableDeltaT = getStandardTable(textRegion.huffmanDT + 11); 20256 break; 20257 20258 case 3: 20259 tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables); 20260 customIndex++; 20261 break; 20262 20263 default: 20264 throw new Jbig2Error("invalid Huffman DT selector"); 20265 } 20266 20267 if (textRegion.refinement) { 20268 throw new Jbig2Error("refinement with Huffman is not supported"); 20269 } 20270 20271 return { 20272 symbolIDTable, 20273 tableFirstS, 20274 tableDeltaS, 20275 tableDeltaT 20276 }; 20277} 20278 20279function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) { 20280 let customIndex = 0, 20281 tableDeltaHeight, 20282 tableDeltaWidth; 20283 20284 switch (dictionary.huffmanDHSelector) { 20285 case 0: 20286 case 1: 20287 tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4); 20288 break; 20289 20290 case 3: 20291 tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables); 20292 customIndex++; 20293 break; 20294 20295 default: 20296 throw new Jbig2Error("invalid Huffman DH selector"); 20297 } 20298 20299 switch (dictionary.huffmanDWSelector) { 20300 case 0: 20301 case 1: 20302 tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2); 20303 break; 20304 20305 case 3: 20306 tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables); 20307 customIndex++; 20308 break; 20309 20310 default: 20311 throw new Jbig2Error("invalid Huffman DW selector"); 20312 } 20313 20314 let tableBitmapSize, tableAggregateInstances; 20315 20316 if (dictionary.bitmapSizeSelector) { 20317 tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables); 20318 customIndex++; 20319 } else { 20320 tableBitmapSize = getStandardTable(1); 20321 } 20322 20323 if (dictionary.aggregationInstancesSelector) { 20324 tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables); 20325 } else { 20326 tableAggregateInstances = getStandardTable(1); 20327 } 20328 20329 return { 20330 tableDeltaHeight, 20331 tableDeltaWidth, 20332 tableBitmapSize, 20333 tableAggregateInstances 20334 }; 20335} 20336 20337function readUncompressedBitmap(reader, width, height) { 20338 const bitmap = []; 20339 20340 for (let y = 0; y < height; y++) {
vendor: 21,082 bytes, lines 20341-21378
20341 const row = new Uint8Array(width); 20342 bitmap.push(row); 20343 20344 for (let x = 0; x < width; x++) { 20345 row[x] = reader.readBit(); 20346 } 20347 20348 reader.byteAlign(); 20349 } 20350 20351 return bitmap; 20352} 20353 20354function decodeMMRBitmap(input, width, height, endOfBlock) { 20355 const params = { 20356 K: -1, 20357 Columns: width, 20358 Rows: height, 20359 BlackIs1: true, 20360 EndOfBlock: endOfBlock 20361 }; 20362 const decoder = new _ccitt.CCITTFaxDecoder(input, params); 20363 const bitmap = []; 20364 let currentByte, 20365 eof = false; 20366 20367 for (let y = 0; y < height; y++) { 20368 const row = new Uint8Array(width); 20369 bitmap.push(row); 20370 let shift = -1; 20371 20372 for (let x = 0; x < width; x++) { 20373 if (shift < 0) { 20374 currentByte = decoder.readNextChar(); 20375 20376 if (currentByte === -1) { 20377 currentByte = 0; 20378 eof = true; 20379 } 20380 20381 shift = 7; 20382 } 20383 20384 row[x] = currentByte >> shift & 1; 20385 shift--; 20386 } 20387 } 20388 20389 if (endOfBlock && !eof) { 20390 const lookForEOFLimit = 5; 20391 20392 for (let i = 0; i < lookForEOFLimit; i++) { 20393 if (decoder.readNextChar() === -1) { 20394 break; 20395 } 20396 } 20397 } 20398 20399 return bitmap; 20400} 20401 20402class Jbig2Image { 20403 parseChunks(chunks) { 20404 return parseJbig2Chunks(chunks); 20405 } 20406 20407 parse(data) { 20408 throw new Error("Not implemented: Jbig2Image.parse"); 20409 } 20410 20411} 20412 20413exports.Jbig2Image = Jbig2Image; 20414 20415/***/ }), 20416/* 26 */ 20417/***/ ((__unused_webpack_module, exports) => { 20418 20419 20420 20421Object.defineProperty(exports, "__esModule", ({ 20422 value: true 20423})); 20424exports.ArithmeticDecoder = void 0; 20425const QeTable = [{ 20426 qe: 0x5601, 20427 nmps: 1, 20428 nlps: 1, 20429 switchFlag: 1 20430}, { 20431 qe: 0x3401, 20432 nmps: 2, 20433 nlps: 6, 20434 switchFlag: 0 20435}, { 20436 qe: 0x1801, 20437 nmps: 3, 20438 nlps: 9, 20439 switchFlag: 0 20440}, { 20441 qe: 0x0ac1, 20442 nmps: 4, 20443 nlps: 12, 20444 switchFlag: 0 20445}, { 20446 qe: 0x0521, 20447 nmps: 5, 20448 nlps: 29, 20449 switchFlag: 0 20450}, { 20451 qe: 0x0221, 20452 nmps: 38, 20453 nlps: 33, 20454 switchFlag: 0 20455}, { 20456 qe: 0x5601, 20457 nmps: 7, 20458 nlps: 6, 20459 switchFlag: 1 20460}, { 20461 qe: 0x5401, 20462 nmps: 8, 20463 nlps: 14, 20464 switchFlag: 0 20465}, { 20466 qe: 0x4801, 20467 nmps: 9, 20468 nlps: 14, 20469 switchFlag: 0 20470}, { 20471 qe: 0x3801, 20472 nmps: 10, 20473 nlps: 14, 20474 switchFlag: 0 20475}, { 20476 qe: 0x3001, 20477 nmps: 11, 20478 nlps: 17, 20479 switchFlag: 0 20480}, { 20481 qe: 0x2401, 20482 nmps: 12, 20483 nlps: 18, 20484 switchFlag: 0 20485}, { 20486 qe: 0x1c01, 20487 nmps: 13, 20488 nlps: 20, 20489 switchFlag: 0 20490}, { 20491 qe: 0x1601, 20492 nmps: 29, 20493 nlps: 21, 20494 switchFlag: 0 20495}, { 20496 qe: 0x5601, 20497 nmps: 15, 20498 nlps: 14, 20499 switchFlag: 1 20500}, { 20501 qe: 0x5401, 20502 nmps: 16, 20503 nlps: 14, 20504 switchFlag: 0 20505}, { 20506 qe: 0x5101, 20507 nmps: 17, 20508 nlps: 15, 20509 switchFlag: 0 20510}, { 20511 qe: 0x4801, 20512 nmps: 18, 20513 nlps: 16, 20514 switchFlag: 0 20515}, { 20516 qe: 0x3801, 20517 nmps: 19, 20518 nlps: 17, 20519 switchFlag: 0 20520}, { 20521 qe: 0x3401, 20522 nmps: 20, 20523 nlps: 18, 20524 switchFlag: 0 20525}, { 20526 qe: 0x3001, 20527 nmps: 21, 20528 nlps: 19, 20529 switchFlag: 0 20530}, { 20531 qe: 0x2801, 20532 nmps: 22, 20533 nlps: 19, 20534 switchFlag: 0 20535}, { 20536 qe: 0x2401, 20537 nmps: 23, 20538 nlps: 20, 20539 switchFlag: 0 20540}, { 20541 qe: 0x2201, 20542 nmps: 24, 20543 nlps: 21, 20544 switchFlag: 0 20545}, { 20546 qe: 0x1c01, 20547 nmps: 25, 20548 nlps: 22, 20549 switchFlag: 0 20550}, { 20551 qe: 0x1801, 20552 nmps: 26, 20553 nlps: 23, 20554 switchFlag: 0 20555}, { 20556 qe: 0x1601, 20557 nmps: 27, 20558 nlps: 24, 20559 switchFlag: 0 20560}, { 20561 qe: 0x1401, 20562 nmps: 28, 20563 nlps: 25, 20564 switchFlag: 0 20565}, { 20566 qe: 0x1201, 20567 nmps: 29, 20568 nlps: 26, 20569 switchFlag: 0 20570}, { 20571 qe: 0x1101, 20572 nmps: 30, 20573 nlps: 27, 20574 switchFlag: 0 20575}, { 20576 qe: 0x0ac1, 20577 nmps: 31, 20578 nlps: 28, 20579 switchFlag: 0 20580}, { 20581 qe: 0x09c1, 20582 nmps: 32, 20583 nlps: 29, 20584 switchFlag: 0 20585}, { 20586 qe: 0x08a1, 20587 nmps: 33, 20588 nlps: 30, 20589 switchFlag: 0 20590}, { 20591 qe: 0x0521, 20592 nmps: 34, 20593 nlps: 31, 20594 switchFlag: 0 20595}, { 20596 qe: 0x0441, 20597 nmps: 35, 20598 nlps: 32, 20599 switchFlag: 0 20600}, { 20601 qe: 0x02a1, 20602 nmps: 36, 20603 nlps: 33, 20604 switchFlag: 0 20605}, { 20606 qe: 0x0221, 20607 nmps: 37, 20608 nlps: 34, 20609 switchFlag: 0 20610}, { 20611 qe: 0x0141, 20612 nmps: 38, 20613 nlps: 35, 20614 switchFlag: 0 20615}, { 20616 qe: 0x0111, 20617 nmps: 39, 20618 nlps: 36, 20619 switchFlag: 0 20620}, { 20621 qe: 0x0085, 20622 nmps: 40, 20623 nlps: 37, 20624 switchFlag: 0 20625}, { 20626 qe: 0x0049, 20627 nmps: 41, 20628 nlps: 38, 20629 switchFlag: 0 20630}, { 20631 qe: 0x0025, 20632 nmps: 42, 20633 nlps: 39, 20634 switchFlag: 0 20635}, { 20636 qe: 0x0015, 20637 nmps: 43, 20638 nlps: 40, 20639 switchFlag: 0 20640}, { 20641 qe: 0x0009, 20642 nmps: 44, 20643 nlps: 41, 20644 switchFlag: 0 20645}, { 20646 qe: 0x0005, 20647 nmps: 45, 20648 nlps: 42, 20649 switchFlag: 0 20650}, { 20651 qe: 0x0001, 20652 nmps: 45, 20653 nlps: 43, 20654 switchFlag: 0 20655}, { 20656 qe: 0x5601, 20657 nmps: 46, 20658 nlps: 46, 20659 switchFlag: 0 20660}]; 20661 20662class ArithmeticDecoder { 20663 constructor(data, start, end) { 20664 this.data = data; 20665 this.bp = start; 20666 this.dataEnd = end; 20667 this.chigh = data[start]; 20668 this.clow = 0; 20669 this.byteIn(); 20670 this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f; 20671 this.clow = this.clow << 7 & 0xffff; 20672 this.ct -= 7; 20673 this.a = 0x8000; 20674 } 20675 20676 byteIn() { 20677 const data = this.data; 20678 let bp = this.bp; 20679 20680 if (data[bp] === 0xff) { 20681 if (data[bp + 1] > 0x8f) { 20682 this.clow += 0xff00; 20683 this.ct = 8; 20684 } else { 20685 bp++; 20686 this.clow += data[bp] << 9; 20687 this.ct = 7; 20688 this.bp = bp; 20689 } 20690 } else { 20691 bp++; 20692 this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00; 20693 this.ct = 8; 20694 this.bp = bp; 20695 } 20696 20697 if (this.clow > 0xffff) { 20698 this.chigh += this.clow >> 16; 20699 this.clow &= 0xffff; 20700 } 20701 } 20702 20703 readBit(contexts, pos) { 20704 let cx_index = contexts[pos] >> 1, 20705 cx_mps = contexts[pos] & 1; 20706 const qeTableIcx = QeTable[cx_index]; 20707 const qeIcx = qeTableIcx.qe; 20708 let d; 20709 let a = this.a - qeIcx; 20710 20711 if (this.chigh < qeIcx) { 20712 if (a < qeIcx) { 20713 a = qeIcx; 20714 d = cx_mps; 20715 cx_index = qeTableIcx.nmps; 20716 } else { 20717 a = qeIcx; 20718 d = 1 ^ cx_mps; 20719 20720 if (qeTableIcx.switchFlag === 1) { 20721 cx_mps = d; 20722 } 20723 20724 cx_index = qeTableIcx.nlps; 20725 } 20726 } else { 20727 this.chigh -= qeIcx; 20728 20729 if ((a & 0x8000) !== 0) { 20730 this.a = a; 20731 return cx_mps; 20732 } 20733 20734 if (a < qeIcx) { 20735 d = 1 ^ cx_mps; 20736 20737 if (qeTableIcx.switchFlag === 1) { 20738 cx_mps = d; 20739 } 20740 20741 cx_index = qeTableIcx.nlps; 20742 } else { 20743 d = cx_mps; 20744 cx_index = qeTableIcx.nmps; 20745 } 20746 } 20747 20748 do { 20749 if (this.ct === 0) { 20750 this.byteIn(); 20751 } 20752 20753 a <<= 1; 20754 this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1; 20755 this.clow = this.clow << 1 & 0xffff; 20756 this.ct--; 20757 } while ((a & 0x8000) === 0); 20758 20759 this.a = a; 20760 contexts[pos] = cx_index << 1 | cx_mps; 20761 return d; 20762 } 20763 20764} 20765 20766exports.ArithmeticDecoder = ArithmeticDecoder; 20767 20768/***/ }), 20769/* 27 */ 20770/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 20771 20772 20773 20774Object.defineProperty(exports, "__esModule", ({ 20775 value: true 20776})); 20777exports.JpegStream = void 0; 20778 20779var _decode_stream = __w_pdfjs_require__(19); 20780 20781var _primitives = __w_pdfjs_require__(5); 20782 20783var _jpg = __w_pdfjs_require__(28); 20784 20785var _util = __w_pdfjs_require__(2); 20786 20787class JpegStream extends _decode_stream.DecodeStream { 20788 constructor(stream, maybeLength, params) { 20789 let ch; 20790 20791 while ((ch = stream.getByte()) !== -1) { 20792 if (ch === 0xff) { 20793 stream.skip(-1); 20794 break; 20795 } 20796 } 20797 20798 super(maybeLength); 20799 this.stream = stream; 20800 this.dict = stream.dict; 20801 this.maybeLength = maybeLength; 20802 this.params = params; 20803 } 20804 20805 get bytes() { 20806 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 20807 } 20808 20809 ensureBuffer(requested) {} 20810 20811 readBlock() { 20812 if (this.eof) { 20813 return; 20814 } 20815 20816 const jpegOptions = { 20817 decodeTransform: undefined, 20818 colorTransform: undefined 20819 }; 20820 const decodeArr = this.dict.getArray("D", "Decode"); 20821 20822 if (this.forceRGB && Array.isArray(decodeArr)) { 20823 const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8; 20824 const decodeArrLength = decodeArr.length; 20825 const transform = new Int32Array(decodeArrLength); 20826 let transformNeeded = false; 20827 const maxValue = (1 << bitsPerComponent) - 1; 20828 20829 for (let i = 0; i < decodeArrLength; i += 2) { 20830 transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0; 20831 transform[i + 1] = decodeArr[i] * maxValue | 0; 20832 20833 if (transform[i] !== 256 || transform[i + 1] !== 0) { 20834 transformNeeded = true; 20835 } 20836 } 20837 20838 if (transformNeeded) { 20839 jpegOptions.decodeTransform = transform; 20840 } 20841 } 20842 20843 if (this.params instanceof _primitives.Dict) { 20844 const colorTransform = this.params.get("ColorTransform"); 20845 20846 if (Number.isInteger(colorTransform)) { 20847 jpegOptions.colorTransform = colorTransform; 20848 } 20849 } 20850 20851 const jpegImage = new _jpg.JpegImage(jpegOptions); 20852 jpegImage.parse(this.bytes); 20853 const data = jpegImage.getData({ 20854 width: this.drawWidth, 20855 height: this.drawHeight, 20856 forceRGB: this.forceRGB, 20857 isSourcePDF: true 20858 }); 20859 this.buffer = data; 20860 this.bufferLength = data.length; 20861 this.eof = true; 20862 } 20863 20864} 20865 20866exports.JpegStream = JpegStream; 20867 20868/***/ }), 20869/* 28 */ 20870/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 20871 20872 20873 20874Object.defineProperty(exports, "__esModule", ({ 20875 value: true 20876})); 20877exports.JpegImage = void 0; 20878 20879var _util = __w_pdfjs_require__(2); 20880 20881var _core_utils = __w_pdfjs_require__(6); 20882 20883class JpegError extends _util.BaseException { 20884 constructor(msg) { 20885 super(`JPEG error: ${msg}`, "JpegError"); 20886 } 20887 20888} 20889 20890class DNLMarkerError extends _util.BaseException { 20891 constructor(message, scanLines) { 20892 super(message, "DNLMarkerError"); 20893 this.scanLines = scanLines; 20894 } 20895 20896} 20897 20898class EOIMarkerError extends _util.BaseException { 20899 constructor(msg) { 20900 super(msg, "EOIMarkerError"); 20901 } 20902 20903} 20904 20905const dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]); 20906const dctCos1 = 4017; 20907const dctSin1 = 799; 20908const dctCos3 = 3406; 20909const dctSin3 = 2276; 20910const dctCos6 = 1567; 20911const dctSin6 = 3784; 20912const dctSqrt2 = 5793; 20913const dctSqrt1d2 = 2896; 20914 20915function buildHuffmanTable(codeLengths, values) { 20916 let k = 0, 20917 i, 20918 j, 20919 length = 16; 20920 20921 while (length > 0 && !codeLengths[length - 1]) { 20922 length--; 20923 } 20924 20925 const code = [{ 20926 children: [], 20927 index: 0 20928 }]; 20929 let p = code[0], 20930 q; 20931 20932 for (i = 0; i < length; i++) { 20933 for (j = 0; j < codeLengths[i]; j++) { 20934 p = code.pop(); 20935 p.children[p.index] = values[k]; 20936 20937 while (p.index > 0) { 20938 p = code.pop(); 20939 } 20940 20941 p.index++; 20942 code.push(p); 20943 20944 while (code.length <= i) { 20945 code.push(q = { 20946 children: [], 20947 index: 0 20948 }); 20949 p.children[p.index] = q.children; 20950 p = q; 20951 } 20952 20953 k++; 20954 } 20955 20956 if (i + 1 < length) { 20957 code.push(q = { 20958 children: [], 20959 index: 0 20960 }); 20961 p.children[p.index] = q.children; 20962 p = q; 20963 } 20964 } 20965 20966 return code[0].children; 20967} 20968 20969function getBlockBufferOffset(component, row, col) { 20970 return 64 * ((component.blocksPerLine + 1) * row + col); 20971} 20972 20973function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) { 20974 const mcusPerLine = frame.mcusPerLine; 20975 const progressive = frame.progressive; 20976 const startOffset = offset; 20977 let bitsData = 0, 20978 bitsCount = 0; 20979 20980 function readBit() { 20981 if (bitsCount > 0) { 20982 bitsCount--; 20983 return bitsData >> bitsCount & 1; 20984 } 20985 20986 bitsData = data[offset++]; 20987 20988 if (bitsData === 0xff) { 20989 const nextByte = data[offset++]; 20990 20991 if (nextByte) { 20992 if (nextByte === 0xdc && parseDNLMarker) { 20993 offset += 2; 20994 const scanLines = (0, _core_utils.readUint16)(data, offset); 20995 offset += 2; 20996 20997 if (scanLines > 0 && scanLines !== frame.scanLines) { 20998 throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines); 20999 } 21000 } else if (nextByte === 0xd9) { 21001 if (parseDNLMarker) { 21002 const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0); 21003 21004 if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) { 21005 throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines); 21006 } 21007 } 21008 21009 throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data"); 21010 } 21011 21012 throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`); 21013 } 21014 } 21015 21016 bitsCount = 7; 21017 return bitsData >>> 7; 21018 } 21019 21020 function decodeHuffman(tree) { 21021 let node = tree; 21022 21023 while (true) { 21024 node = node[readBit()]; 21025 21026 switch (typeof node) { 21027 case "number": 21028 return node; 21029 21030 case "object": 21031 continue; 21032 } 21033 21034 throw new JpegError("invalid huffman sequence"); 21035 } 21036 } 21037 21038 function receive(length) { 21039 let n = 0; 21040 21041 while (length > 0) { 21042 n = n << 1 | readBit(); 21043 length--; 21044 } 21045 21046 return n; 21047 } 21048 21049 function receiveAndExtend(length) { 21050 if (length === 1) { 21051 return readBit() === 1 ? 1 : -1; 21052 } 21053 21054 const n = receive(length); 21055 21056 if (n >= 1 << length - 1) { 21057 return n; 21058 } 21059 21060 return n + (-1 << length) + 1; 21061 } 21062 21063 function decodeBaseline(component, blockOffset) { 21064 const t = decodeHuffman(component.huffmanTableDC); 21065 const diff = t === 0 ? 0 : receiveAndExtend(t); 21066 component.blockData[blockOffset] = component.pred += diff; 21067 let k = 1; 21068 21069 while (k < 64) { 21070 const rs = decodeHuffman(component.huffmanTableAC); 21071 const s = rs & 15, 21072 r = rs >> 4; 21073 21074 if (s === 0) { 21075 if (r < 15) { 21076 break; 21077 } 21078 21079 k += 16; 21080 continue; 21081 } 21082 21083 k += r; 21084 const z = dctZigZag[k]; 21085 component.blockData[blockOffset + z] = receiveAndExtend(s); 21086 k++; 21087 } 21088 } 21089 21090 function decodeDCFirst(component, blockOffset) { 21091 const t = decodeHuffman(component.huffmanTableDC); 21092 const diff = t === 0 ? 0 : receiveAndExtend(t) << successive; 21093 component.blockData[blockOffset] = component.pred += diff; 21094 } 21095 21096 function decodeDCSuccessive(component, blockOffset) { 21097 component.blockData[blockOffset] |= readBit() << successive; 21098 } 21099 21100 let eobrun = 0; 21101 21102 function decodeACFirst(component, blockOffset) { 21103 if (eobrun > 0) { 21104 eobrun--; 21105 return; 21106 } 21107 21108 let k = spectralStart; 21109 const e = spectralEnd; 21110 21111 while (k <= e) { 21112 const rs = decodeHuffman(component.huffmanTableAC); 21113 const s = rs & 15, 21114 r = rs >> 4; 21115 21116 if (s === 0) { 21117 if (r < 15) { 21118 eobrun = receive(r) + (1 << r) - 1; 21119 break; 21120 } 21121 21122 k += 16; 21123 continue; 21124 } 21125 21126 k += r; 21127 const z = dctZigZag[k]; 21128 component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive); 21129 k++; 21130 } 21131 } 21132 21133 let successiveACState = 0, 21134 successiveACNextValue; 21135 21136 function decodeACSuccessive(component, blockOffset) { 21137 let k = spectralStart; 21138 const e = spectralEnd; 21139 let r = 0; 21140 let s; 21141 let rs; 21142 21143 while (k <= e) { 21144 const offsetZ = blockOffset + dctZigZag[k]; 21145 const sign = component.blockData[offsetZ] < 0 ? -1 : 1; 21146 21147 switch (successiveACState) { 21148 case 0: 21149 rs = decodeHuffman(component.huffmanTableAC); 21150 s = rs & 15; 21151 r = rs >> 4; 21152 21153 if (s === 0) { 21154 if (r < 15) { 21155 eobrun = receive(r) + (1 << r); 21156 successiveACState = 4; 21157 } else { 21158 r = 16; 21159 successiveACState = 1; 21160 } 21161 } else { 21162 if (s !== 1) { 21163 throw new JpegError("invalid ACn encoding"); 21164 } 21165 21166 successiveACNextValue = receiveAndExtend(s); 21167 successiveACState = r ? 2 : 3; 21168 } 21169 21170 continue; 21171 21172 case 1: 21173 case 2: 21174 if (component.blockData[offsetZ]) { 21175 component.blockData[offsetZ] += sign * (readBit() << successive); 21176 } else { 21177 r--; 21178 21179 if (r === 0) { 21180 successiveACState = successiveACState === 2 ? 3 : 0; 21181 } 21182 } 21183 21184 break; 21185 21186 case 3: 21187 if (component.blockData[offsetZ]) { 21188 component.blockData[offsetZ] += sign * (readBit() << successive); 21189 } else { 21190 component.blockData[offsetZ] = successiveACNextValue << successive; 21191 successiveACState = 0; 21192 } 21193 21194 break; 21195 21196 case 4: 21197 if (component.blockData[offsetZ]) { 21198 component.blockData[offsetZ] += sign * (readBit() << successive); 21199 } 21200 21201 break; 21202 } 21203 21204 k++; 21205 } 21206 21207 if (successiveACState === 4) { 21208 eobrun--; 21209 21210 if (eobrun === 0) { 21211 successiveACState = 0; 21212 } 21213 } 21214 } 21215 21216 let blockRow = 0; 21217 21218 function decodeMcu(component, decode, mcu, row, col) { 21219 const mcuRow = mcu / mcusPerLine | 0; 21220 const mcuCol = mcu % mcusPerLine; 21221 blockRow = mcuRow * component.v + row; 21222 const blockCol = mcuCol * component.h + col; 21223 const blockOffset = getBlockBufferOffset(component, blockRow, blockCol); 21224 decode(component, blockOffset); 21225 } 21226 21227 function decodeBlock(component, decode, mcu) { 21228 blockRow = mcu / component.blocksPerLine | 0; 21229 const blockCol = mcu % component.blocksPerLine; 21230 const blockOffset = getBlockBufferOffset(component, blockRow, blockCol); 21231 decode(component, blockOffset); 21232 } 21233 21234 const componentsLength = components.length; 21235 let component, i, j, k, n; 21236 let decodeFn; 21237 21238 if (progressive) { 21239 if (spectralStart === 0) { 21240 decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive; 21241 } else { 21242 decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive; 21243 } 21244 } else { 21245 decodeFn = decodeBaseline; 21246 } 21247 21248 let mcu = 0, 21249 fileMarker; 21250 let mcuExpected; 21251 21252 if (componentsLength === 1) { 21253 mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn; 21254 } else { 21255 mcuExpected = mcusPerLine * frame.mcusPerColumn; 21256 } 21257 21258 let h, v; 21259 21260 while (mcu <= mcuExpected) { 21261 const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected; 21262 21263 if (mcuToRead > 0) { 21264 for (i = 0; i < componentsLength; i++) { 21265 components[i].pred = 0; 21266 } 21267 21268 eobrun = 0; 21269 21270 if (componentsLength === 1) { 21271 component = components[0]; 21272 21273 for (n = 0; n < mcuToRead; n++) { 21274 decodeBlock(component, decodeFn, mcu); 21275 mcu++; 21276 } 21277 } else { 21278 for (n = 0; n < mcuToRead; n++) { 21279 for (i = 0; i < componentsLength; i++) { 21280 component = components[i]; 21281 h = component.h; 21282 v = component.v; 21283 21284 for (j = 0; j < v; j++) { 21285 for (k = 0; k < h; k++) { 21286 decodeMcu(component, decodeFn, mcu, j, k); 21287 } 21288 } 21289 } 21290 21291 mcu++; 21292 } 21293 } 21294 } 21295 21296 bitsCount = 0; 21297 fileMarker = findNextFileMarker(data, offset); 21298 21299 if (!fileMarker) { 21300 break; 21301 } 21302 21303 if (fileMarker.invalid) { 21304 const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive"; 21305 (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`); 21306 offset = fileMarker.offset; 21307 } 21308 21309 if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) { 21310 offset += 2; 21311 } else { 21312 break; 21313 } 21314 } 21315 21316 return offset - startOffset; 21317} 21318 21319function quantizeAndInverse(component, blockBufferOffset, p) { 21320 const qt = component.quantizationTable, 21321 blockData = component.blockData; 21322 let v0, v1, v2, v3, v4, v5, v6, v7; 21323 let p0, p1, p2, p3, p4, p5, p6, p7; 21324 let t; 21325 21326 if (!qt) { 21327 throw new JpegError("missing required Quantization Table."); 21328 } 21329 21330 for (let row = 0; row < 64; row += 8) { 21331 p0 = blockData[blockBufferOffset + row]; 21332 p1 = blockData[blockBufferOffset + row + 1]; 21333 p2 = blockData[blockBufferOffset + row + 2]; 21334 p3 = blockData[blockBufferOffset + row + 3]; 21335 p4 = blockData[blockBufferOffset + row + 4]; 21336 p5 = blockData[blockBufferOffset + row + 5]; 21337 p6 = blockData[blockBufferOffset + row + 6]; 21338 p7 = blockData[blockBufferOffset + row + 7]; 21339 p0 *= qt[row]; 21340 21341 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 21342 t = dctSqrt2 * p0 + 512 >> 10; 21343 p[row] = t; 21344 p[row + 1] = t; 21345 p[row + 2] = t; 21346 p[row + 3] = t; 21347 p[row + 4] = t; 21348 p[row + 5] = t; 21349 p[row + 6] = t; 21350 p[row + 7] = t; 21351 continue; 21352 } 21353 21354 p1 *= qt[row + 1]; 21355 p2 *= qt[row + 2]; 21356 p3 *= qt[row + 3]; 21357 p4 *= qt[row + 4]; 21358 p5 *= qt[row + 5]; 21359 p6 *= qt[row + 6]; 21360 p7 *= qt[row + 7]; 21361 v0 = dctSqrt2 * p0 + 128 >> 8; 21362 v1 = dctSqrt2 * p4 + 128 >> 8; 21363 v2 = p2; 21364 v3 = p6; 21365 v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8; 21366 v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8; 21367 v5 = p3 << 4; 21368 v6 = p5 << 4; 21369 v0 = v0 + v1 + 1 >> 1; 21370 v1 = v0 - v1; 21371 t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8; 21372 v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8; 21373 v3 = t; 21374 v4 = v4 + v6 + 1 >> 1; 21375 v6 = v4 - v6; 21376 v7 = v7 + v5 + 1 >> 1; 21377 v5 = v7 - v5; 21378 v0 = v0 + v3 + 1 >> 1;
vendor: 1,969 bytes, lines 21379-21451
21379 v3 = v0 - v3; 21380 v1 = v1 + v2 + 1 >> 1; 21381 v2 = v1 - v2; 21382 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12; 21383 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 21384 v7 = t; 21385 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 21386 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 21387 v6 = t; 21388 p[row] = v0 + v7; 21389 p[row + 7] = v0 - v7; 21390 p[row + 1] = v1 + v6; 21391 p[row + 6] = v1 - v6; 21392 p[row + 2] = v2 + v5; 21393 p[row + 5] = v2 - v5; 21394 p[row + 3] = v3 + v4; 21395 p[row + 4] = v3 - v4; 21396 } 21397 21398 for (let col = 0; col < 8; ++col) { 21399 p0 = p[col]; 21400 p1 = p[col + 8]; 21401 p2 = p[col + 16]; 21402 p3 = p[col + 24]; 21403 p4 = p[col + 32]; 21404 p5 = p[col + 40]; 21405 p6 = p[col + 48]; 21406 p7 = p[col + 56]; 21407 21408 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 21409 t = dctSqrt2 * p0 + 8192 >> 14; 21410 21411 if (t < -2040) { 21412 t = 0; 21413 } else if (t >= 2024) { 21414 t = 255; 21415 } else { 21416 t = t + 2056 >> 4; 21417 } 21418 21419 blockData[blockBufferOffset + col] = t; 21420 blockData[blockBufferOffset + col + 8] = t; 21421 blockData[blockBufferOffset + col + 16] = t; 21422 blockData[blockBufferOffset + col + 24] = t; 21423 blockData[blockBufferOffset + col + 32] = t; 21424 blockData[blockBufferOffset + col + 40] = t; 21425 blockData[blockBufferOffset + col + 48] = t; 21426 blockData[blockBufferOffset + col + 56] = t; 21427 continue; 21428 } 21429 21430 v0 = dctSqrt2 * p0 + 2048 >> 12; 21431 v1 = dctSqrt2 * p4 + 2048 >> 12; 21432 v2 = p2; 21433 v3 = p6; 21434 v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12; 21435 v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12; 21436 v5 = p3; 21437 v6 = p5; 21438 v0 = (v0 + v1 + 1 >> 1) + 4112; 21439 v1 = v0 - v1; 21440 t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12; 21441 v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12; 21442 v3 = t; 21443 v4 = v4 + v6 + 1 >> 1; 21444 v6 = v4 - v6; 21445 v7 = v7 + v5 + 1 >> 1; 21446 v5 = v7 - v5; 21447 v0 = v0 + v3 + 1 >> 1; 21448 v3 = v0 - v3; 21449 v1 = v1 + v2 + 1 >> 1; 21450 v2 = v1 - v2; 21451 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >>
vendor: 191,856 bytes, lines 21451-27957
21451 12; 21452 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 21453 v7 = t; 21454 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 21455 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 21456 v6 = t; 21457 p0 = v0 + v7; 21458 p7 = v0 - v7; 21459 p1 = v1 + v6; 21460 p6 = v1 - v6; 21461 p2 = v2 + v5; 21462 p5 = v2 - v5; 21463 p3 = v3 + v4; 21464 p4 = v3 - v4; 21465 21466 if (p0 < 16) { 21467 p0 = 0; 21468 } else if (p0 >= 4080) { 21469 p0 = 255; 21470 } else { 21471 p0 >>= 4; 21472 } 21473 21474 if (p1 < 16) { 21475 p1 = 0; 21476 } else if (p1 >= 4080) { 21477 p1 = 255; 21478 } else { 21479 p1 >>= 4; 21480 } 21481 21482 if (p2 < 16) { 21483 p2 = 0; 21484 } else if (p2 >= 4080) { 21485 p2 = 255; 21486 } else { 21487 p2 >>= 4; 21488 } 21489 21490 if (p3 < 16) { 21491 p3 = 0; 21492 } else if (p3 >= 4080) { 21493 p3 = 255; 21494 } else { 21495 p3 >>= 4; 21496 } 21497 21498 if (p4 < 16) { 21499 p4 = 0; 21500 } else if (p4 >= 4080) { 21501 p4 = 255; 21502 } else { 21503 p4 >>= 4; 21504 } 21505 21506 if (p5 < 16) { 21507 p5 = 0; 21508 } else if (p5 >= 4080) { 21509 p5 = 255; 21510 } else { 21511 p5 >>= 4; 21512 } 21513 21514 if (p6 < 16) { 21515 p6 = 0; 21516 } else if (p6 >= 4080) { 21517 p6 = 255; 21518 } else { 21519 p6 >>= 4; 21520 } 21521 21522 if (p7 < 16) { 21523 p7 = 0; 21524 } else if (p7 >= 4080) { 21525 p7 = 255; 21526 } else { 21527 p7 >>= 4; 21528 } 21529 21530 blockData[blockBufferOffset + col] = p0; 21531 blockData[blockBufferOffset + col + 8] = p1; 21532 blockData[blockBufferOffset + col + 16] = p2; 21533 blockData[blockBufferOffset + col + 24] = p3; 21534 blockData[blockBufferOffset + col + 32] = p4; 21535 blockData[blockBufferOffset + col + 40] = p5; 21536 blockData[blockBufferOffset + col + 48] = p6; 21537 blockData[blockBufferOffset + col + 56] = p7; 21538 } 21539} 21540 21541function buildComponentData(frame, component) { 21542 const blocksPerLine = component.blocksPerLine; 21543 const blocksPerColumn = component.blocksPerColumn; 21544 const computationBuffer = new Int16Array(64); 21545 21546 for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) { 21547 for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) { 21548 const offset = getBlockBufferOffset(component, blockRow, blockCol); 21549 quantizeAndInverse(component, offset, computationBuffer); 21550 } 21551 } 21552 21553 return component.blockData; 21554} 21555 21556function findNextFileMarker(data, currentPos, startPos = currentPos) { 21557 const maxPos = data.length - 1; 21558 let newPos = startPos < currentPos ? startPos : currentPos; 21559 21560 if (currentPos >= maxPos) { 21561 return null; 21562 } 21563 21564 const currentMarker = (0, _core_utils.readUint16)(data, currentPos); 21565 21566 if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) { 21567 return { 21568 invalid: null, 21569 marker: currentMarker, 21570 offset: currentPos 21571 }; 21572 } 21573 21574 let newMarker = (0, _core_utils.readUint16)(data, newPos); 21575 21576 while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) { 21577 if (++newPos >= maxPos) { 21578 return null; 21579 } 21580 21581 newMarker = (0, _core_utils.readUint16)(data, newPos); 21582 } 21583 21584 return { 21585 invalid: currentMarker.toString(16), 21586 marker: newMarker, 21587 offset: newPos 21588 }; 21589} 21590 21591class JpegImage { 21592 constructor({ 21593 decodeTransform = null, 21594 colorTransform = -1 21595 } = {}) { 21596 this._decodeTransform = decodeTransform; 21597 this._colorTransform = colorTransform; 21598 } 21599 21600 parse(data, { 21601 dnlScanLines = null 21602 } = {}) { 21603 function readDataBlock() { 21604 const length = (0, _core_utils.readUint16)(data, offset); 21605 offset += 2; 21606 let endOffset = offset + length - 2; 21607 const fileMarker = findNextFileMarker(data, endOffset, offset); 21608 21609 if (fileMarker && fileMarker.invalid) { 21610 (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid); 21611 endOffset = fileMarker.offset; 21612 } 21613 21614 const array = data.subarray(offset, endOffset); 21615 offset += array.length; 21616 return array; 21617 } 21618 21619 function prepareComponents(frame) { 21620 const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH); 21621 const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV); 21622 21623 for (let i = 0, ii = frame.components.length; i < ii; i++) { 21624 const component = frame.components[i]; 21625 const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH); 21626 const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV); 21627 const blocksPerLineForMcu = mcusPerLine * component.h; 21628 const blocksPerColumnForMcu = mcusPerColumn * component.v; 21629 const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1); 21630 component.blockData = new Int16Array(blocksBufferSize); 21631 component.blocksPerLine = blocksPerLine; 21632 component.blocksPerColumn = blocksPerColumn; 21633 } 21634 21635 frame.mcusPerLine = mcusPerLine; 21636 frame.mcusPerColumn = mcusPerColumn; 21637 } 21638 21639 let offset = 0; 21640 let jfif = null; 21641 let adobe = null; 21642 let frame, resetInterval; 21643 let numSOSMarkers = 0; 21644 const quantizationTables = []; 21645 const huffmanTablesAC = [], 21646 huffmanTablesDC = []; 21647 let fileMarker = (0, _core_utils.readUint16)(data, offset); 21648 offset += 2; 21649 21650 if (fileMarker !== 0xffd8) { 21651 throw new JpegError("SOI not found"); 21652 } 21653 21654 fileMarker = (0, _core_utils.readUint16)(data, offset); 21655 offset += 2; 21656 21657 markerLoop: while (fileMarker !== 0xffd9) { 21658 let i, j, l; 21659 21660 switch (fileMarker) { 21661 case 0xffe0: 21662 case 0xffe1: 21663 case 0xffe2: 21664 case 0xffe3: 21665 case 0xffe4: 21666 case 0xffe5: 21667 case 0xffe6: 21668 case 0xffe7: 21669 case 0xffe8: 21670 case 0xffe9: 21671 case 0xffea: 21672 case 0xffeb: 21673 case 0xffec: 21674 case 0xffed: 21675 case 0xffee: 21676 case 0xffef: 21677 case 0xfffe: 21678 const appData = readDataBlock(); 21679 21680 if (fileMarker === 0xffe0) { 21681 if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) { 21682 jfif = { 21683 version: { 21684 major: appData[5], 21685 minor: appData[6] 21686 }, 21687 densityUnits: appData[7], 21688 xDensity: appData[8] << 8 | appData[9], 21689 yDensity: appData[10] << 8 | appData[11], 21690 thumbWidth: appData[12], 21691 thumbHeight: appData[13], 21692 thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13]) 21693 }; 21694 } 21695 } 21696 21697 if (fileMarker === 0xffee) { 21698 if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) { 21699 adobe = { 21700 version: appData[5] << 8 | appData[6], 21701 flags0: appData[7] << 8 | appData[8], 21702 flags1: appData[9] << 8 | appData[10], 21703 transformCode: appData[11] 21704 }; 21705 } 21706 } 21707 21708 break; 21709 21710 case 0xffdb: 21711 const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset); 21712 offset += 2; 21713 const quantizationTablesEnd = quantizationTablesLength + offset - 2; 21714 let z; 21715 21716 while (offset < quantizationTablesEnd) { 21717 const quantizationTableSpec = data[offset++]; 21718 const tableData = new Uint16Array(64); 21719 21720 if (quantizationTableSpec >> 4 === 0) { 21721 for (j = 0; j < 64; j++) { 21722 z = dctZigZag[j]; 21723 tableData[z] = data[offset++]; 21724 } 21725 } else if (quantizationTableSpec >> 4 === 1) { 21726 for (j = 0; j < 64; j++) { 21727 z = dctZigZag[j]; 21728 tableData[z] = (0, _core_utils.readUint16)(data, offset); 21729 offset += 2; 21730 } 21731 } else { 21732 throw new JpegError("DQT - invalid table spec"); 21733 } 21734 21735 quantizationTables[quantizationTableSpec & 15] = tableData; 21736 } 21737 21738 break; 21739 21740 case 0xffc0: 21741 case 0xffc1: 21742 case 0xffc2: 21743 if (frame) { 21744 throw new JpegError("Only single frame JPEGs supported"); 21745 } 21746 21747 offset += 2; 21748 frame = {}; 21749 frame.extended = fileMarker === 0xffc1; 21750 frame.progressive = fileMarker === 0xffc2; 21751 frame.precision = data[offset++]; 21752 const sofScanLines = (0, _core_utils.readUint16)(data, offset); 21753 offset += 2; 21754 frame.scanLines = dnlScanLines || sofScanLines; 21755 frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset); 21756 offset += 2; 21757 frame.components = []; 21758 frame.componentIds = {}; 21759 const componentsCount = data[offset++]; 21760 let maxH = 0, 21761 maxV = 0; 21762 21763 for (i = 0; i < componentsCount; i++) { 21764 const componentId = data[offset]; 21765 const h = data[offset + 1] >> 4; 21766 const v = data[offset + 1] & 15; 21767 21768 if (maxH < h) { 21769 maxH = h; 21770 } 21771 21772 if (maxV < v) { 21773 maxV = v; 21774 } 21775 21776 const qId = data[offset + 2]; 21777 l = frame.components.push({ 21778 h, 21779 v, 21780 quantizationId: qId, 21781 quantizationTable: null 21782 }); 21783 frame.componentIds[componentId] = l - 1; 21784 offset += 3; 21785 } 21786 21787 frame.maxH = maxH; 21788 frame.maxV = maxV; 21789 prepareComponents(frame); 21790 break; 21791 21792 case 0xffc4: 21793 const huffmanLength = (0, _core_utils.readUint16)(data, offset); 21794 offset += 2; 21795 21796 for (i = 2; i < huffmanLength;) { 21797 const huffmanTableSpec = data[offset++]; 21798 const codeLengths = new Uint8Array(16); 21799 let codeLengthSum = 0; 21800 21801 for (j = 0; j < 16; j++, offset++) { 21802 codeLengthSum += codeLengths[j] = data[offset]; 21803 } 21804 21805 const huffmanValues = new Uint8Array(codeLengthSum); 21806 21807 for (j = 0; j < codeLengthSum; j++, offset++) { 21808 huffmanValues[j] = data[offset]; 21809 } 21810 21811 i += 17 + codeLengthSum; 21812 (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues); 21813 } 21814 21815 break; 21816 21817 case 0xffdd: 21818 offset += 2; 21819 resetInterval = (0, _core_utils.readUint16)(data, offset); 21820 offset += 2; 21821 break; 21822 21823 case 0xffda: 21824 const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines; 21825 offset += 2; 21826 const selectorsCount = data[offset++], 21827 components = []; 21828 21829 for (i = 0; i < selectorsCount; i++) { 21830 const index = data[offset++]; 21831 const componentIndex = frame.componentIds[index]; 21832 const component = frame.components[componentIndex]; 21833 component.index = index; 21834 const tableSpec = data[offset++]; 21835 component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4]; 21836 component.huffmanTableAC = huffmanTablesAC[tableSpec & 15]; 21837 components.push(component); 21838 } 21839 21840 const spectralStart = data[offset++], 21841 spectralEnd = data[offset++], 21842 successiveApproximation = data[offset++]; 21843 21844 try { 21845 const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker); 21846 offset += processed; 21847 } catch (ex) { 21848 if (ex instanceof DNLMarkerError) { 21849 (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`); 21850 return this.parse(data, { 21851 dnlScanLines: ex.scanLines 21852 }); 21853 } else if (ex instanceof EOIMarkerError) { 21854 (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`); 21855 break markerLoop; 21856 } 21857 21858 throw ex; 21859 } 21860 21861 break; 21862 21863 case 0xffdc: 21864 offset += 4; 21865 break; 21866 21867 case 0xffff: 21868 if (data[offset] !== 0xff) { 21869 offset--; 21870 } 21871 21872 break; 21873 21874 default: 21875 const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3); 21876 21877 if (nextFileMarker && nextFileMarker.invalid) { 21878 (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid); 21879 offset = nextFileMarker.offset; 21880 break; 21881 } 21882 21883 if (!nextFileMarker || offset >= data.length - 1) { 21884 (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9)."); 21885 break markerLoop; 21886 } 21887 21888 throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16)); 21889 } 21890 21891 fileMarker = (0, _core_utils.readUint16)(data, offset); 21892 offset += 2; 21893 } 21894 21895 this.width = frame.samplesPerLine; 21896 this.height = frame.scanLines; 21897 this.jfif = jfif; 21898 this.adobe = adobe; 21899 this.components = []; 21900 21901 for (let i = 0, ii = frame.components.length; i < ii; i++) { 21902 const component = frame.components[i]; 21903 const quantizationTable = quantizationTables[component.quantizationId]; 21904 21905 if (quantizationTable) { 21906 component.quantizationTable = quantizationTable; 21907 } 21908 21909 this.components.push({ 21910 index: component.index, 21911 output: buildComponentData(frame, component), 21912 scaleX: component.h / frame.maxH, 21913 scaleY: component.v / frame.maxV, 21914 blocksPerLine: component.blocksPerLine, 21915 blocksPerColumn: component.blocksPerColumn 21916 }); 21917 } 21918 21919 this.numComponents = this.components.length; 21920 return undefined; 21921 } 21922 21923 _getLinearizedBlockData(width, height, isSourcePDF = false) { 21924 const scaleX = this.width / width, 21925 scaleY = this.height / height; 21926 let component, componentScaleX, componentScaleY, blocksPerScanline; 21927 let x, y, i, j, k; 21928 let index; 21929 let offset = 0; 21930 let output; 21931 const numComponents = this.components.length; 21932 const dataLength = width * height * numComponents; 21933 const data = new Uint8ClampedArray(dataLength); 21934 const xScaleBlockOffset = new Uint32Array(width); 21935 const mask3LSB = 0xfffffff8; 21936 let lastComponentScaleX; 21937 21938 for (i = 0; i < numComponents; i++) { 21939 component = this.components[i]; 21940 componentScaleX = component.scaleX * scaleX; 21941 componentScaleY = component.scaleY * scaleY; 21942 offset = i; 21943 output = component.output; 21944 blocksPerScanline = component.blocksPerLine + 1 << 3; 21945 21946 if (componentScaleX !== lastComponentScaleX) { 21947 for (x = 0; x < width; x++) { 21948 j = 0 | x * componentScaleX; 21949 xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7; 21950 } 21951 21952 lastComponentScaleX = componentScaleX; 21953 } 21954 21955 for (y = 0; y < height; y++) { 21956 j = 0 | y * componentScaleY; 21957 index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3; 21958 21959 for (x = 0; x < width; x++) { 21960 data[offset] = output[index + xScaleBlockOffset[x]]; 21961 offset += numComponents; 21962 } 21963 } 21964 } 21965 21966 let transform = this._decodeTransform; 21967 21968 if (!isSourcePDF && numComponents === 4 && !transform) { 21969 transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]); 21970 } 21971 21972 if (transform) { 21973 for (i = 0; i < dataLength;) { 21974 for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) { 21975 data[i] = (data[i] * transform[k] >> 8) + transform[k + 1]; 21976 } 21977 } 21978 } 21979 21980 return data; 21981 } 21982 21983 get _isColorConversionNeeded() { 21984 if (this.adobe) { 21985 return !!this.adobe.transformCode; 21986 } 21987 21988 if (this.numComponents === 3) { 21989 if (this._colorTransform === 0) { 21990 return false; 21991 } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) { 21992 return false; 21993 } 21994 21995 return true; 21996 } 21997 21998 if (this._colorTransform === 1) { 21999 return true; 22000 } 22001 22002 return false; 22003 } 22004 22005 _convertYccToRgb(data) { 22006 let Y, Cb, Cr; 22007 22008 for (let i = 0, length = data.length; i < length; i += 3) { 22009 Y = data[i]; 22010 Cb = data[i + 1]; 22011 Cr = data[i + 2]; 22012 data[i] = Y - 179.456 + 1.402 * Cr; 22013 data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr; 22014 data[i + 2] = Y - 226.816 + 1.772 * Cb; 22015 } 22016 22017 return data; 22018 } 22019 22020 _convertYcckToRgb(data) { 22021 let Y, Cb, Cr, k; 22022 let offset = 0; 22023 22024 for (let i = 0, length = data.length; i < length; i += 4) { 22025 Y = data[i]; 22026 Cb = data[i + 1]; 22027 Cr = data[i + 2]; 22028 k = data[i + 3]; 22029 data[offset++] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776); 22030 data[offset++] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665); 22031 data[offset++] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407); 22032 } 22033 22034 return data.subarray(0, offset); 22035 } 22036 22037 _convertYcckToCmyk(data) { 22038 let Y, Cb, Cr; 22039 22040 for (let i = 0, length = data.length; i < length; i += 4) { 22041 Y = data[i]; 22042 Cb = data[i + 1]; 22043 Cr = data[i + 2]; 22044 data[i] = 434.456 - Y - 1.402 * Cr; 22045 data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr; 22046 data[i + 2] = 481.816 - Y - 1.772 * Cb; 22047 } 22048 22049 return data; 22050 } 22051 22052 _convertCmykToRgb(data) { 22053 let c, m, y, k; 22054 let offset = 0; 22055 22056 for (let i = 0, length = data.length; i < length; i += 4) { 22057 c = data[i]; 22058 m = data[i + 1]; 22059 y = data[i + 2]; 22060 k = data[i + 3]; 22061 data[offset++] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254); 22062 data[offset++] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.0003189131175883281 * k + 0.7364883807733168); 22063 data[offset++] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144); 22064 } 22065 22066 return data.subarray(0, offset); 22067 } 22068 22069 getData({ 22070 width, 22071 height, 22072 forceRGB = false, 22073 isSourcePDF = false 22074 }) { 22075 if (this.numComponents > 4) { 22076 throw new JpegError("Unsupported color mode"); 22077 } 22078 22079 const data = this._getLinearizedBlockData(width, height, isSourcePDF); 22080 22081 if (this.numComponents === 1 && forceRGB) { 22082 const dataLength = data.length; 22083 const rgbData = new Uint8ClampedArray(dataLength * 3); 22084 let offset = 0; 22085 22086 for (let i = 0; i < dataLength; i++) { 22087 const grayColor = data[i]; 22088 rgbData[offset++] = grayColor; 22089 rgbData[offset++] = grayColor; 22090 rgbData[offset++] = grayColor; 22091 } 22092 22093 return rgbData; 22094 } else if (this.numComponents === 3 && this._isColorConversionNeeded) { 22095 return this._convertYccToRgb(data); 22096 } else if (this.numComponents === 4) { 22097 if (this._isColorConversionNeeded) { 22098 if (forceRGB) { 22099 return this._convertYcckToRgb(data); 22100 } 22101 22102 return this._convertYcckToCmyk(data); 22103 } else if (forceRGB) { 22104 return this._convertCmykToRgb(data); 22105 } 22106 } 22107 22108 return data; 22109 } 22110 22111} 22112 22113exports.JpegImage = JpegImage; 22114 22115/***/ }), 22116/* 29 */ 22117/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 22118 22119 22120 22121Object.defineProperty(exports, "__esModule", ({ 22122 value: true 22123})); 22124exports.JpxStream = void 0; 22125 22126var _decode_stream = __w_pdfjs_require__(19); 22127 22128var _jpx = __w_pdfjs_require__(30); 22129 22130var _util = __w_pdfjs_require__(2); 22131 22132class JpxStream extends _decode_stream.DecodeStream { 22133 constructor(stream, maybeLength, params) { 22134 super(maybeLength); 22135 this.stream = stream; 22136 this.dict = stream.dict; 22137 this.maybeLength = maybeLength; 22138 this.params = params; 22139 } 22140 22141 get bytes() { 22142 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 22143 } 22144 22145 ensureBuffer(requested) {} 22146 22147 readBlock() { 22148 if (this.eof) { 22149 return; 22150 } 22151 22152 const jpxImage = new _jpx.JpxImage(); 22153 jpxImage.parse(this.bytes); 22154 const width = jpxImage.width; 22155 const height = jpxImage.height; 22156 const componentsCount = jpxImage.componentsCount; 22157 const tileCount = jpxImage.tiles.length; 22158 22159 if (tileCount === 1) { 22160 this.buffer = jpxImage.tiles[0].items; 22161 } else { 22162 const data = new Uint8ClampedArray(width * height * componentsCount); 22163 22164 for (let k = 0; k < tileCount; k++) { 22165 const tileComponents = jpxImage.tiles[k]; 22166 const tileWidth = tileComponents.width; 22167 const tileHeight = tileComponents.height; 22168 const tileLeft = tileComponents.left; 22169 const tileTop = tileComponents.top; 22170 const src = tileComponents.items; 22171 let srcPosition = 0; 22172 let dataPosition = (width * tileTop + tileLeft) * componentsCount; 22173 const imgRowSize = width * componentsCount; 22174 const tileRowSize = tileWidth * componentsCount; 22175 22176 for (let j = 0; j < tileHeight; j++) { 22177 const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize); 22178 data.set(rowBytes, dataPosition); 22179 srcPosition += tileRowSize; 22180 dataPosition += imgRowSize; 22181 } 22182 } 22183 22184 this.buffer = data; 22185 } 22186 22187 this.bufferLength = this.buffer.length; 22188 this.eof = true; 22189 } 22190 22191} 22192 22193exports.JpxStream = JpxStream; 22194 22195/***/ }), 22196/* 30 */ 22197/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 22198 22199 22200 22201Object.defineProperty(exports, "__esModule", ({ 22202 value: true 22203})); 22204exports.JpxImage = void 0; 22205 22206var _util = __w_pdfjs_require__(2); 22207 22208var _core_utils = __w_pdfjs_require__(6); 22209 22210var _arithmetic_decoder = __w_pdfjs_require__(26); 22211 22212class JpxError extends _util.BaseException { 22213 constructor(msg) { 22214 super(`JPX error: ${msg}`, "JpxError"); 22215 } 22216 22217} 22218 22219const SubbandsGainLog2 = { 22220 LL: 0, 22221 LH: 1, 22222 HL: 1, 22223 HH: 2 22224}; 22225 22226class JpxImage { 22227 constructor() { 22228 this.failOnCorruptedImage = false; 22229 } 22230 22231 parse(data) { 22232 const head = (0, _core_utils.readUint16)(data, 0); 22233 22234 if (head === 0xff4f) { 22235 this.parseCodestream(data, 0, data.length); 22236 return; 22237 } 22238 22239 const length = data.length; 22240 let position = 0; 22241 22242 while (position < length) { 22243 let headerSize = 8; 22244 let lbox = (0, _core_utils.readUint32)(data, position); 22245 const tbox = (0, _core_utils.readUint32)(data, position + 4); 22246 position += headerSize; 22247 22248 if (lbox === 1) { 22249 lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4); 22250 position += 8; 22251 headerSize += 8; 22252 } 22253 22254 if (lbox === 0) { 22255 lbox = length - position + headerSize; 22256 } 22257 22258 if (lbox < headerSize) { 22259 throw new JpxError("Invalid box field size"); 22260 } 22261 22262 const dataLength = lbox - headerSize; 22263 let jumpDataLength = true; 22264 22265 switch (tbox) { 22266 case 0x6a703268: 22267 jumpDataLength = false; 22268 break; 22269 22270 case 0x636f6c72: 22271 const method = data[position]; 22272 22273 if (method === 1) { 22274 const colorspace = (0, _core_utils.readUint32)(data, position + 3); 22275 22276 switch (colorspace) { 22277 case 16: 22278 case 17: 22279 case 18: 22280 break; 22281 22282 default: 22283 (0, _util.warn)("Unknown colorspace " + colorspace); 22284 break; 22285 } 22286 } else if (method === 2) { 22287 (0, _util.info)("ICC profile not supported"); 22288 } 22289 22290 break; 22291 22292 case 0x6a703263: 22293 this.parseCodestream(data, position, position + dataLength); 22294 break; 22295 22296 case 0x6a502020: 22297 if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) { 22298 (0, _util.warn)("Invalid JP2 signature"); 22299 } 22300 22301 break; 22302 22303 case 0x6a501a1a: 22304 case 0x66747970: 22305 case 0x72726571: 22306 case 0x72657320: 22307 case 0x69686472: 22308 break; 22309 22310 default: 22311 const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff); 22312 (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`); 22313 break; 22314 } 22315 22316 if (jumpDataLength) { 22317 position += dataLength; 22318 } 22319 } 22320 } 22321 22322 parseImageProperties(stream) { 22323 let newByte = stream.getByte(); 22324 22325 while (newByte >= 0) { 22326 const oldByte = newByte; 22327 newByte = stream.getByte(); 22328 const code = oldByte << 8 | newByte; 22329 22330 if (code === 0xff51) { 22331 stream.skip(4); 22332 const Xsiz = stream.getInt32() >>> 0; 22333 const Ysiz = stream.getInt32() >>> 0; 22334 const XOsiz = stream.getInt32() >>> 0; 22335 const YOsiz = stream.getInt32() >>> 0; 22336 stream.skip(16); 22337 const Csiz = stream.getUint16(); 22338 this.width = Xsiz - XOsiz; 22339 this.height = Ysiz - YOsiz; 22340 this.componentsCount = Csiz; 22341 this.bitsPerComponent = 8; 22342 return; 22343 } 22344 } 22345 22346 throw new JpxError("No size marker found in JPX stream"); 22347 } 22348 22349 parseCodestream(data, start, end) { 22350 const context = {}; 22351 let doNotRecover = false; 22352 22353 try { 22354 let position = start; 22355 22356 while (position + 1 < end) { 22357 const code = (0, _core_utils.readUint16)(data, position); 22358 position += 2; 22359 let length = 0, 22360 j, 22361 sqcd, 22362 spqcds, 22363 spqcdSize, 22364 scalarExpounded, 22365 tile; 22366 22367 switch (code) { 22368 case 0xff4f: 22369 context.mainHeader = true; 22370 break; 22371 22372 case 0xffd9: 22373 break; 22374 22375 case 0xff51: 22376 length = (0, _core_utils.readUint16)(data, position); 22377 const siz = {}; 22378 siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4); 22379 siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8); 22380 siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12); 22381 siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16); 22382 siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20); 22383 siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24); 22384 siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28); 22385 siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32); 22386 const componentsCount = (0, _core_utils.readUint16)(data, position + 36); 22387 siz.Csiz = componentsCount; 22388 const components = []; 22389 j = position + 38; 22390 22391 for (let i = 0; i < componentsCount; i++) { 22392 const component = { 22393 precision: (data[j] & 0x7f) + 1, 22394 isSigned: !!(data[j] & 0x80), 22395 XRsiz: data[j + 1], 22396 YRsiz: data[j + 2] 22397 }; 22398 j += 3; 22399 calculateComponentDimensions(component, siz); 22400 components.push(component); 22401 } 22402 22403 context.SIZ = siz; 22404 context.components = components; 22405 calculateTileGrids(context, components); 22406 context.QCC = []; 22407 context.COC = []; 22408 break; 22409 22410 case 0xff5c: 22411 length = (0, _core_utils.readUint16)(data, position); 22412 const qcd = {}; 22413 j = position + 2; 22414 sqcd = data[j++]; 22415 22416 switch (sqcd & 0x1f) { 22417 case 0: 22418 spqcdSize = 8; 22419 scalarExpounded = true; 22420 break; 22421 22422 case 1: 22423 spqcdSize = 16; 22424 scalarExpounded = false; 22425 break; 22426 22427 case 2: 22428 spqcdSize = 16; 22429 scalarExpounded = true; 22430 break; 22431 22432 default: 22433 throw new Error("Invalid SQcd value " + sqcd); 22434 } 22435 22436 qcd.noQuantization = spqcdSize === 8; 22437 qcd.scalarExpounded = scalarExpounded; 22438 qcd.guardBits = sqcd >> 5; 22439 spqcds = []; 22440 22441 while (j < length + position) { 22442 const spqcd = {}; 22443 22444 if (spqcdSize === 8) { 22445 spqcd.epsilon = data[j++] >> 3; 22446 spqcd.mu = 0; 22447 } else { 22448 spqcd.epsilon = data[j] >> 3; 22449 spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1]; 22450 j += 2; 22451 } 22452 22453 spqcds.push(spqcd); 22454 } 22455 22456 qcd.SPqcds = spqcds; 22457 22458 if (context.mainHeader) { 22459 context.QCD = qcd; 22460 } else { 22461 context.currentTile.QCD = qcd; 22462 context.currentTile.QCC = []; 22463 } 22464 22465 break; 22466 22467 case 0xff5d: 22468 length = (0, _core_utils.readUint16)(data, position); 22469 const qcc = {}; 22470 j = position + 2; 22471 let cqcc; 22472 22473 if (context.SIZ.Csiz < 257) { 22474 cqcc = data[j++]; 22475 } else { 22476 cqcc = (0, _core_utils.readUint16)(data, j); 22477 j += 2; 22478 } 22479 22480 sqcd = data[j++]; 22481 22482 switch (sqcd & 0x1f) { 22483 case 0: 22484 spqcdSize = 8; 22485 scalarExpounded = true; 22486 break; 22487 22488 case 1: 22489 spqcdSize = 16; 22490 scalarExpounded = false; 22491 break; 22492 22493 case 2: 22494 spqcdSize = 16; 22495 scalarExpounded = true; 22496 break; 22497 22498 default: 22499 throw new Error("Invalid SQcd value " + sqcd); 22500 } 22501 22502 qcc.noQuantization = spqcdSize === 8; 22503 qcc.scalarExpounded = scalarExpounded; 22504 qcc.guardBits = sqcd >> 5; 22505 spqcds = []; 22506 22507 while (j < length + position) { 22508 const spqcd = {}; 22509 22510 if (spqcdSize === 8) { 22511 spqcd.epsilon = data[j++] >> 3; 22512 spqcd.mu = 0; 22513 } else { 22514 spqcd.epsilon = data[j] >> 3; 22515 spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1]; 22516 j += 2; 22517 } 22518 22519 spqcds.push(spqcd); 22520 } 22521 22522 qcc.SPqcds = spqcds; 22523 22524 if (context.mainHeader) { 22525 context.QCC[cqcc] = qcc; 22526 } else { 22527 context.currentTile.QCC[cqcc] = qcc; 22528 } 22529 22530 break; 22531 22532 case 0xff52: 22533 length = (0, _core_utils.readUint16)(data, position); 22534 const cod = {}; 22535 j = position + 2; 22536 const scod = data[j++]; 22537 cod.entropyCoderWithCustomPrecincts = !!(scod & 1); 22538 cod.sopMarkerUsed = !!(scod & 2); 22539 cod.ephMarkerUsed = !!(scod & 4); 22540 cod.progressionOrder = data[j++]; 22541 cod.layersCount = (0, _core_utils.readUint16)(data, j); 22542 j += 2; 22543 cod.multipleComponentTransform = data[j++]; 22544 cod.decompositionLevelsCount = data[j++]; 22545 cod.xcb = (data[j++] & 0xf) + 2; 22546 cod.ycb = (data[j++] & 0xf) + 2; 22547 const blockStyle = data[j++]; 22548 cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1); 22549 cod.resetContextProbabilities = !!(blockStyle & 2); 22550 cod.terminationOnEachCodingPass = !!(blockStyle & 4); 22551 cod.verticallyStripe = !!(blockStyle & 8); 22552 cod.predictableTermination = !!(blockStyle & 16); 22553 cod.segmentationSymbolUsed = !!(blockStyle & 32); 22554 cod.reversibleTransformation = data[j++]; 22555 22556 if (cod.entropyCoderWithCustomPrecincts) { 22557 const precinctsSizes = []; 22558 22559 while (j < length + position) { 22560 const precinctsSize = data[j++]; 22561 precinctsSizes.push({ 22562 PPx: precinctsSize & 0xf, 22563 PPy: precinctsSize >> 4 22564 }); 22565 } 22566 22567 cod.precinctsSizes = precinctsSizes; 22568 } 22569 22570 const unsupported = []; 22571 22572 if (cod.selectiveArithmeticCodingBypass) { 22573 unsupported.push("selectiveArithmeticCodingBypass"); 22574 } 22575 22576 if (cod.terminationOnEachCodingPass) { 22577 unsupported.push("terminationOnEachCodingPass"); 22578 } 22579 22580 if (cod.verticallyStripe) { 22581 unsupported.push("verticallyStripe"); 22582 } 22583 22584 if (cod.predictableTermination) { 22585 unsupported.push("predictableTermination"); 22586 } 22587 22588 if (unsupported.length > 0) { 22589 doNotRecover = true; 22590 (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`); 22591 } 22592 22593 if (context.mainHeader) { 22594 context.COD = cod; 22595 } else { 22596 context.currentTile.COD = cod; 22597 context.currentTile.COC = []; 22598 } 22599 22600 break; 22601 22602 case 0xff90: 22603 length = (0, _core_utils.readUint16)(data, position); 22604 tile = {}; 22605 tile.index = (0, _core_utils.readUint16)(data, position + 2); 22606 tile.length = (0, _core_utils.readUint32)(data, position + 4); 22607 tile.dataEnd = tile.length + position - 2; 22608 tile.partIndex = data[position + 8]; 22609 tile.partsCount = data[position + 9]; 22610 context.mainHeader = false; 22611 22612 if (tile.partIndex === 0) { 22613 tile.COD = context.COD; 22614 tile.COC = context.COC.slice(0); 22615 tile.QCD = context.QCD; 22616 tile.QCC = context.QCC.slice(0); 22617 } 22618 22619 context.currentTile = tile; 22620 break; 22621 22622 case 0xff93: 22623 tile = context.currentTile; 22624 22625 if (tile.partIndex === 0) { 22626 initializeTile(context, tile.index); 22627 buildPackets(context); 22628 } 22629 22630 length = tile.dataEnd - position; 22631 parseTilePackets(context, data, position, length); 22632 break; 22633 22634 case 0xff53: 22635 (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented."); 22636 22637 case 0xff55: 22638 case 0xff57: 22639 case 0xff58: 22640 case 0xff64: 22641 length = (0, _core_utils.readUint16)(data, position); 22642 break; 22643 22644 default: 22645 throw new Error("Unknown codestream code: " + code.toString(16)); 22646 } 22647 22648 position += length; 22649 } 22650 } catch (e) { 22651 if (doNotRecover || this.failOnCorruptedImage) { 22652 throw new JpxError(e.message); 22653 } else { 22654 (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`); 22655 } 22656 } 22657 22658 this.tiles = transformComponents(context); 22659 this.width = context.SIZ.Xsiz - context.SIZ.XOsiz; 22660 this.height = context.SIZ.Ysiz - context.SIZ.YOsiz; 22661 this.componentsCount = context.SIZ.Csiz; 22662 } 22663 22664} 22665 22666exports.JpxImage = JpxImage; 22667 22668function calculateComponentDimensions(component, siz) { 22669 component.x0 = Math.ceil(siz.XOsiz / component.XRsiz); 22670 component.x1 = Math.ceil(siz.Xsiz / component.XRsiz); 22671 component.y0 = Math.ceil(siz.YOsiz / component.YRsiz); 22672 component.y1 = Math.ceil(siz.Ysiz / component.YRsiz); 22673 component.width = component.x1 - component.x0; 22674 component.height = component.y1 - component.y0; 22675} 22676 22677function calculateTileGrids(context, components) { 22678 const siz = context.SIZ; 22679 const tiles = []; 22680 let tile; 22681 const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz); 22682 const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz); 22683 22684 for (let q = 0; q < numYtiles; q++) { 22685 for (let p = 0; p < numXtiles; p++) { 22686 tile = {}; 22687 tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz); 22688 tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz); 22689 tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz); 22690 tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz); 22691 tile.width = tile.tx1 - tile.tx0; 22692 tile.height = tile.ty1 - tile.ty0; 22693 tile.components = []; 22694 tiles.push(tile); 22695 } 22696 } 22697 22698 context.tiles = tiles; 22699 const componentsCount = siz.Csiz; 22700 22701 for (let i = 0, ii = componentsCount; i < ii; i++) { 22702 const component = components[i]; 22703 22704 for (let j = 0, jj = tiles.length; j < jj; j++) { 22705 const tileComponent = {}; 22706 tile = tiles[j]; 22707 tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz); 22708 tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz); 22709 tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz); 22710 tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz); 22711 tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0; 22712 tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0; 22713 tile.components[i] = tileComponent; 22714 } 22715 } 22716} 22717 22718function getBlocksDimensions(context, component, r) { 22719 const codOrCoc = component.codingStyleParameters; 22720 const result = {}; 22721 22722 if (!codOrCoc.entropyCoderWithCustomPrecincts) { 22723 result.PPx = 15; 22724 result.PPy = 15; 22725 } else { 22726 result.PPx = codOrCoc.precinctsSizes[r].PPx; 22727 result.PPy = codOrCoc.precinctsSizes[r].PPy; 22728 } 22729 22730 result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx); 22731 result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy); 22732 return result; 22733} 22734 22735function buildPrecincts(context, resolution, dimensions) { 22736 const precinctWidth = 1 << dimensions.PPx; 22737 const precinctHeight = 1 << dimensions.PPy; 22738 const isZeroRes = resolution.resLevel === 0; 22739 const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1); 22740 const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1); 22741 const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0; 22742 const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0; 22743 const numprecincts = numprecinctswide * numprecinctshigh; 22744 resolution.precinctParameters = { 22745 precinctWidth, 22746 precinctHeight, 22747 numprecinctswide, 22748 numprecinctshigh, 22749 numprecincts, 22750 precinctWidthInSubband, 22751 precinctHeightInSubband 22752 }; 22753} 22754 22755function buildCodeblocks(context, subband, dimensions) { 22756 const xcb_ = dimensions.xcb_; 22757 const ycb_ = dimensions.ycb_; 22758 const codeblockWidth = 1 << xcb_; 22759 const codeblockHeight = 1 << ycb_; 22760 const cbx0 = subband.tbx0 >> xcb_; 22761 const cby0 = subband.tby0 >> ycb_; 22762 const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_; 22763 const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_; 22764 const precinctParameters = subband.resolution.precinctParameters; 22765 const codeblocks = []; 22766 const precincts = []; 22767 let i, j, codeblock, precinctNumber; 22768 22769 for (j = cby0; j < cby1; j++) { 22770 for (i = cbx0; i < cbx1; i++) { 22771 codeblock = { 22772 cbx: i, 22773 cby: j, 22774 tbx0: codeblockWidth * i, 22775 tby0: codeblockHeight * j, 22776 tbx1: codeblockWidth * (i + 1), 22777 tby1: codeblockHeight * (j + 1) 22778 }; 22779 codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0); 22780 codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0); 22781 codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1); 22782 codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1); 22783 const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband); 22784 const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband); 22785 precinctNumber = pi + pj * precinctParameters.numprecinctswide; 22786 codeblock.precinctNumber = precinctNumber; 22787 codeblock.subbandType = subband.type; 22788 codeblock.Lblock = 3; 22789 22790 if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) { 22791 continue; 22792 } 22793 22794 codeblocks.push(codeblock); 22795 let precinct = precincts[precinctNumber]; 22796 22797 if (precinct !== undefined) { 22798 if (i < precinct.cbxMin) { 22799 precinct.cbxMin = i; 22800 } else if (i > precinct.cbxMax) { 22801 precinct.cbxMax = i; 22802 } 22803 22804 if (j < precinct.cbyMin) { 22805 precinct.cbxMin = j; 22806 } else if (j > precinct.cbyMax) { 22807 precinct.cbyMax = j; 22808 } 22809 } else { 22810 precincts[precinctNumber] = precinct = { 22811 cbxMin: i, 22812 cbyMin: j, 22813 cbxMax: i, 22814 cbyMax: j 22815 }; 22816 } 22817 22818 codeblock.precinct = precinct; 22819 } 22820 } 22821 22822 subband.codeblockParameters = { 22823 codeblockWidth: xcb_, 22824 codeblockHeight: ycb_, 22825 numcodeblockwide: cbx1 - cbx0 + 1, 22826 numcodeblockhigh: cby1 - cby0 + 1 22827 }; 22828 subband.codeblocks = codeblocks; 22829 subband.precincts = precincts; 22830} 22831 22832function createPacket(resolution, precinctNumber, layerNumber) { 22833 const precinctCodeblocks = []; 22834 const subbands = resolution.subbands; 22835 22836 for (let i = 0, ii = subbands.length; i < ii; i++) { 22837 const subband = subbands[i]; 22838 const codeblocks = subband.codeblocks; 22839 22840 for (let j = 0, jj = codeblocks.length; j < jj; j++) { 22841 const codeblock = codeblocks[j]; 22842 22843 if (codeblock.precinctNumber !== precinctNumber) { 22844 continue; 22845 } 22846 22847 precinctCodeblocks.push(codeblock); 22848 } 22849 } 22850 22851 return { 22852 layerNumber, 22853 codeblocks: precinctCodeblocks 22854 }; 22855} 22856 22857function LayerResolutionComponentPositionIterator(context) { 22858 const siz = context.SIZ; 22859 const tileIndex = context.currentTile.index; 22860 const tile = context.tiles[tileIndex]; 22861 const layersCount = tile.codingStyleDefaultParameters.layersCount; 22862 const componentsCount = siz.Csiz; 22863 let maxDecompositionLevelsCount = 0; 22864 22865 for (let q = 0; q < componentsCount; q++) { 22866 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount); 22867 } 22868 22869 let l = 0, 22870 r = 0, 22871 i = 0, 22872 k = 0; 22873 22874 this.nextPacket = function JpxImage_nextPacket() { 22875 for (; l < layersCount; l++) { 22876 for (; r <= maxDecompositionLevelsCount; r++) { 22877 for (; i < componentsCount; i++) { 22878 const component = tile.components[i]; 22879 22880 if (r > component.codingStyleParameters.decompositionLevelsCount) { 22881 continue; 22882 } 22883 22884 const resolution = component.resolutions[r]; 22885 const numprecincts = resolution.precinctParameters.numprecincts; 22886 22887 for (; k < numprecincts;) { 22888 const packet = createPacket(resolution, k, l); 22889 k++; 22890 return packet; 22891 } 22892 22893 k = 0; 22894 } 22895 22896 i = 0; 22897 } 22898 22899 r = 0; 22900 } 22901 22902 throw new JpxError("Out of packets"); 22903 }; 22904} 22905 22906function ResolutionLayerComponentPositionIterator(context) { 22907 const siz = context.SIZ; 22908 const tileIndex = context.currentTile.index; 22909 const tile = context.tiles[tileIndex]; 22910 const layersCount = tile.codingStyleDefaultParameters.layersCount; 22911 const componentsCount = siz.Csiz; 22912 let maxDecompositionLevelsCount = 0; 22913 22914 for (let q = 0; q < componentsCount; q++) { 22915 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount); 22916 } 22917 22918 let r = 0, 22919 l = 0, 22920 i = 0, 22921 k = 0; 22922 22923 this.nextPacket = function JpxImage_nextPacket() { 22924 for (; r <= maxDecompositionLevelsCount; r++) { 22925 for (; l < layersCount; l++) { 22926 for (; i < componentsCount; i++) { 22927 const component = tile.components[i]; 22928 22929 if (r > component.codingStyleParameters.decompositionLevelsCount) { 22930 continue; 22931 } 22932 22933 const resolution = component.resolutions[r]; 22934 const numprecincts = resolution.precinctParameters.numprecincts; 22935 22936 for (; k < numprecincts;) { 22937 const packet = createPacket(resolution, k, l); 22938 k++; 22939 return packet; 22940 } 22941 22942 k = 0; 22943 } 22944 22945 i = 0; 22946 } 22947 22948 l = 0; 22949 } 22950 22951 throw new JpxError("Out of packets"); 22952 }; 22953} 22954 22955function ResolutionPositionComponentLayerIterator(context) { 22956 const siz = context.SIZ; 22957 const tileIndex = context.currentTile.index; 22958 const tile = context.tiles[tileIndex]; 22959 const layersCount = tile.codingStyleDefaultParameters.layersCount; 22960 const componentsCount = siz.Csiz; 22961 let l, r, c, p; 22962 let maxDecompositionLevelsCount = 0; 22963 22964 for (c = 0; c < componentsCount; c++) { 22965 const component = tile.components[c]; 22966 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount); 22967 } 22968 22969 const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1); 22970 22971 for (r = 0; r <= maxDecompositionLevelsCount; ++r) { 22972 let maxNumPrecincts = 0; 22973 22974 for (c = 0; c < componentsCount; ++c) { 22975 const resolutions = tile.components[c].resolutions; 22976 22977 if (r < resolutions.length) { 22978 maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts); 22979 } 22980 } 22981 22982 maxNumPrecinctsInLevel[r] = maxNumPrecincts; 22983 } 22984 22985 l = 0; 22986 r = 0; 22987 c = 0; 22988 p = 0; 22989 22990 this.nextPacket = function JpxImage_nextPacket() { 22991 for (; r <= maxDecompositionLevelsCount; r++) { 22992 for (; p < maxNumPrecinctsInLevel[r]; p++) { 22993 for (; c < componentsCount; c++) { 22994 const component = tile.components[c]; 22995 22996 if (r > component.codingStyleParameters.decompositionLevelsCount) { 22997 continue; 22998 } 22999 23000 const resolution = component.resolutions[r]; 23001 const numprecincts = resolution.precinctParameters.numprecincts; 23002 23003 if (p >= numprecincts) { 23004 continue; 23005 } 23006 23007 for (; l < layersCount;) { 23008 const packet = createPacket(resolution, p, l); 23009 l++; 23010 return packet; 23011 } 23012 23013 l = 0; 23014 } 23015 23016 c = 0; 23017 } 23018 23019 p = 0; 23020 } 23021 23022 throw new JpxError("Out of packets"); 23023 }; 23024} 23025 23026function PositionComponentResolutionLayerIterator(context) { 23027 const siz = context.SIZ; 23028 const tileIndex = context.currentTile.index; 23029 const tile = context.tiles[tileIndex]; 23030 const layersCount = tile.codingStyleDefaultParameters.layersCount; 23031 const componentsCount = siz.Csiz; 23032 const precinctsSizes = getPrecinctSizesInImageScale(tile); 23033 const precinctsIterationSizes = precinctsSizes; 23034 let l = 0, 23035 r = 0, 23036 c = 0, 23037 px = 0, 23038 py = 0; 23039 23040 this.nextPacket = function JpxImage_nextPacket() { 23041 for (; py < precinctsIterationSizes.maxNumHigh; py++) { 23042 for (; px < precinctsIterationSizes.maxNumWide; px++) { 23043 for (; c < componentsCount; c++) { 23044 const component = tile.components[c]; 23045 const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 23046 23047 for (; r <= decompositionLevelsCount; r++) { 23048 const resolution = component.resolutions[r]; 23049 const sizeInImageScale = precinctsSizes.components[c].resolutions[r]; 23050 const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution); 23051 23052 if (k === null) { 23053 continue; 23054 } 23055 23056 for (; l < layersCount;) { 23057 const packet = createPacket(resolution, k, l); 23058 l++; 23059 return packet; 23060 } 23061 23062 l = 0; 23063 } 23064 23065 r = 0; 23066 } 23067 23068 c = 0; 23069 } 23070 23071 px = 0; 23072 } 23073 23074 throw new JpxError("Out of packets"); 23075 }; 23076} 23077 23078function ComponentPositionResolutionLayerIterator(context) { 23079 const siz = context.SIZ; 23080 const tileIndex = context.currentTile.index; 23081 const tile = context.tiles[tileIndex]; 23082 const layersCount = tile.codingStyleDefaultParameters.layersCount; 23083 const componentsCount = siz.Csiz; 23084 const precinctsSizes = getPrecinctSizesInImageScale(tile); 23085 let l = 0, 23086 r = 0, 23087 c = 0, 23088 px = 0, 23089 py = 0; 23090 23091 this.nextPacket = function JpxImage_nextPacket() { 23092 for (; c < componentsCount; ++c) { 23093 const component = tile.components[c]; 23094 const precinctsIterationSizes = precinctsSizes.components[c]; 23095 const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 23096 23097 for (; py < precinctsIterationSizes.maxNumHigh; py++) { 23098 for (; px < precinctsIterationSizes.maxNumWide; px++) { 23099 for (; r <= decompositionLevelsCount; r++) { 23100 const resolution = component.resolutions[r]; 23101 const sizeInImageScale = precinctsIterationSizes.resolutions[r]; 23102 const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution); 23103 23104 if (k === null) { 23105 continue; 23106 } 23107 23108 for (; l < layersCount;) { 23109 const packet = createPacket(resolution, k, l); 23110 l++; 23111 return packet; 23112 } 23113 23114 l = 0; 23115 } 23116 23117 r = 0; 23118 } 23119 23120 px = 0; 23121 } 23122 23123 py = 0; 23124 } 23125 23126 throw new JpxError("Out of packets"); 23127 }; 23128} 23129 23130function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) { 23131 const posX = pxIndex * precinctIterationSizes.minWidth; 23132 const posY = pyIndex * precinctIterationSizes.minHeight; 23133 23134 if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) { 23135 return null; 23136 } 23137 23138 const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide; 23139 return posX / sizeInImageScale.height + startPrecinctRowIndex; 23140} 23141 23142function getPrecinctSizesInImageScale(tile) { 23143 const componentsCount = tile.components.length; 23144 let minWidth = Number.MAX_VALUE; 23145 let minHeight = Number.MAX_VALUE; 23146 let maxNumWide = 0; 23147 let maxNumHigh = 0; 23148 const sizePerComponent = new Array(componentsCount); 23149 23150 for (let c = 0; c < componentsCount; c++) { 23151 const component = tile.components[c]; 23152 const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 23153 const sizePerResolution = new Array(decompositionLevelsCount + 1); 23154 let minWidthCurrentComponent = Number.MAX_VALUE; 23155 let minHeightCurrentComponent = Number.MAX_VALUE; 23156 let maxNumWideCurrentComponent = 0; 23157 let maxNumHighCurrentComponent = 0; 23158 let scale = 1; 23159 23160 for (let r = decompositionLevelsCount; r >= 0; --r) { 23161 const resolution = component.resolutions[r]; 23162 const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth; 23163 const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight; 23164 minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution); 23165 minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution); 23166 maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide); 23167 maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh); 23168 sizePerResolution[r] = { 23169 width: widthCurrentResolution, 23170 height: heightCurrentResolution 23171 }; 23172 scale <<= 1; 23173 } 23174 23175 minWidth = Math.min(minWidth, minWidthCurrentComponent); 23176 minHeight = Math.min(minHeight, minHeightCurrentComponent); 23177 maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent); 23178 maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent); 23179 sizePerComponent[c] = { 23180 resolutions: sizePerResolution, 23181 minWidth: minWidthCurrentComponent, 23182 minHeight: minHeightCurrentComponent, 23183 maxNumWide: maxNumWideCurrentComponent, 23184 maxNumHigh: maxNumHighCurrentComponent 23185 }; 23186 } 23187 23188 return { 23189 components: sizePerComponent, 23190 minWidth, 23191 minHeight, 23192 maxNumWide, 23193 maxNumHigh 23194 }; 23195} 23196 23197function buildPackets(context) { 23198 const siz = context.SIZ; 23199 const tileIndex = context.currentTile.index; 23200 const tile = context.tiles[tileIndex]; 23201 const componentsCount = siz.Csiz; 23202 23203 for (let c = 0; c < componentsCount; c++) { 23204 const component = tile.components[c]; 23205 const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 23206 const resolutions = []; 23207 const subbands = []; 23208 23209 for (let r = 0; r <= decompositionLevelsCount; r++) { 23210 const blocksDimensions = getBlocksDimensions(context, component, r); 23211 const resolution = {}; 23212 const scale = 1 << decompositionLevelsCount - r; 23213 resolution.trx0 = Math.ceil(component.tcx0 / scale); 23214 resolution.try0 = Math.ceil(component.tcy0 / scale); 23215 resolution.trx1 = Math.ceil(component.tcx1 / scale); 23216 resolution.try1 = Math.ceil(component.tcy1 / scale); 23217 resolution.resLevel = r; 23218 buildPrecincts(context, resolution, blocksDimensions); 23219 resolutions.push(resolution); 23220 let subband; 23221 23222 if (r === 0) { 23223 subband = {}; 23224 subband.type = "LL"; 23225 subband.tbx0 = Math.ceil(component.tcx0 / scale); 23226 subband.tby0 = Math.ceil(component.tcy0 / scale); 23227 subband.tbx1 = Math.ceil(component.tcx1 / scale); 23228 subband.tby1 = Math.ceil(component.tcy1 / scale); 23229 subband.resolution = resolution; 23230 buildCodeblocks(context, subband, blocksDimensions); 23231 subbands.push(subband); 23232 resolution.subbands = [subband]; 23233 } else { 23234 const bscale = 1 << decompositionLevelsCount - r + 1; 23235 const resolutionSubbands = []; 23236 subband = {}; 23237 subband.type = "HL"; 23238 subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); 23239 subband.tby0 = Math.ceil(component.tcy0 / bscale); 23240 subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); 23241 subband.tby1 = Math.ceil(component.tcy1 / bscale); 23242 subband.resolution = resolution; 23243 buildCodeblocks(context, subband, blocksDimensions); 23244 subbands.push(subband); 23245 resolutionSubbands.push(subband); 23246 subband = {}; 23247 subband.type = "LH"; 23248 subband.tbx0 = Math.ceil(component.tcx0 / bscale); 23249 subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); 23250 subband.tbx1 = Math.ceil(component.tcx1 / bscale); 23251 subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); 23252 subband.resolution = resolution; 23253 buildCodeblocks(context, subband, blocksDimensions); 23254 subbands.push(subband); 23255 resolutionSubbands.push(subband); 23256 subband = {}; 23257 subband.type = "HH"; 23258 subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); 23259 subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); 23260 subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); 23261 subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); 23262 subband.resolution = resolution; 23263 buildCodeblocks(context, subband, blocksDimensions); 23264 subbands.push(subband); 23265 resolutionSubbands.push(subband); 23266 resolution.subbands = resolutionSubbands; 23267 } 23268 } 23269 23270 component.resolutions = resolutions; 23271 component.subbands = subbands; 23272 } 23273 23274 const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder; 23275 23276 switch (progressionOrder) { 23277 case 0: 23278 tile.packetsIterator = new LayerResolutionComponentPositionIterator(context); 23279 break; 23280 23281 case 1: 23282 tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context); 23283 break; 23284 23285 case 2: 23286 tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context); 23287 break; 23288 23289 case 3: 23290 tile.packetsIterator = new PositionComponentResolutionLayerIterator(context); 23291 break; 23292 23293 case 4: 23294 tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context); 23295 break; 23296 23297 default: 23298 throw new JpxError(`Unsupported progression order ${progressionOrder}`); 23299 } 23300} 23301 23302function parseTilePackets(context, data, offset, dataLength) { 23303 let position = 0; 23304 let buffer, 23305 bufferSize = 0, 23306 skipNextBit = false; 23307 23308 function readBits(count) { 23309 while (bufferSize < count) { 23310 const b = data[offset + position]; 23311 position++; 23312 23313 if (skipNextBit) { 23314 buffer = buffer << 7 | b; 23315 bufferSize += 7; 23316 skipNextBit = false; 23317 } else { 23318 buffer = buffer << 8 | b; 23319 bufferSize += 8; 23320 } 23321 23322 if (b === 0xff) { 23323 skipNextBit = true; 23324 } 23325 } 23326 23327 bufferSize -= count; 23328 return buffer >>> bufferSize & (1 << count) - 1; 23329 } 23330 23331 function skipMarkerIfEqual(value) { 23332 if (data[offset + position - 1] === 0xff && data[offset + position] === value) { 23333 skipBytes(1); 23334 return true; 23335 } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) { 23336 skipBytes(2); 23337 return true; 23338 } 23339 23340 return false; 23341 } 23342 23343 function skipBytes(count) { 23344 position += count; 23345 } 23346 23347 function alignToByte() { 23348 bufferSize = 0; 23349 23350 if (skipNextBit) { 23351 position++; 23352 skipNextBit = false; 23353 } 23354 } 23355 23356 function readCodingpasses() { 23357 if (readBits(1) === 0) { 23358 return 1; 23359 } 23360 23361 if (readBits(1) === 0) { 23362 return 2; 23363 } 23364 23365 let value = readBits(2); 23366 23367 if (value < 3) { 23368 return value + 3; 23369 } 23370 23371 value = readBits(5); 23372 23373 if (value < 31) { 23374 return value + 6; 23375 } 23376 23377 value = readBits(7); 23378 return value + 37; 23379 } 23380 23381 const tileIndex = context.currentTile.index; 23382 const tile = context.tiles[tileIndex]; 23383 const sopMarkerUsed = context.COD.sopMarkerUsed; 23384 const ephMarkerUsed = context.COD.ephMarkerUsed; 23385 const packetsIterator = tile.packetsIterator; 23386 23387 while (position < dataLength) { 23388 alignToByte(); 23389 23390 if (sopMarkerUsed && skipMarkerIfEqual(0x91)) { 23391 skipBytes(4); 23392 } 23393 23394 const packet = packetsIterator.nextPacket(); 23395 23396 if (!readBits(1)) { 23397 continue; 23398 } 23399 23400 const layerNumber = packet.layerNumber, 23401 queue = []; 23402 let codeblock; 23403 23404 for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) { 23405 codeblock = packet.codeblocks[i]; 23406 let precinct = codeblock.precinct; 23407 const codeblockColumn = codeblock.cbx - precinct.cbxMin; 23408 const codeblockRow = codeblock.cby - precinct.cbyMin; 23409 let codeblockIncluded = false; 23410 let firstTimeInclusion = false; 23411 let valueReady, zeroBitPlanesTree; 23412 23413 if (codeblock.included !== undefined) { 23414 codeblockIncluded = !!readBits(1); 23415 } else { 23416 precinct = codeblock.precinct; 23417 let inclusionTree; 23418 23419 if (precinct.inclusionTree !== undefined) { 23420 inclusionTree = precinct.inclusionTree; 23421 } else { 23422 const width = precinct.cbxMax - precinct.cbxMin + 1; 23423 const height = precinct.cbyMax - precinct.cbyMin + 1; 23424 inclusionTree = new InclusionTree(width, height, layerNumber); 23425 zeroBitPlanesTree = new TagTree(width, height); 23426 precinct.inclusionTree = inclusionTree; 23427 precinct.zeroBitPlanesTree = zeroBitPlanesTree; 23428 23429 for (let l = 0; l < layerNumber; l++) { 23430 if (readBits(1) !== 0) { 23431 throw new JpxError("Invalid tag tree"); 23432 } 23433 } 23434 } 23435 23436 if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) { 23437 while (true) { 23438 if (readBits(1)) { 23439 valueReady = !inclusionTree.nextLevel(); 23440 23441 if (valueReady) { 23442 codeblock.included = true; 23443 codeblockIncluded = firstTimeInclusion = true; 23444 break; 23445 } 23446 } else { 23447 inclusionTree.incrementValue(layerNumber); 23448 break; 23449 } 23450 } 23451 } 23452 } 23453 23454 if (!codeblockIncluded) { 23455 continue; 23456 } 23457 23458 if (firstTimeInclusion) { 23459 zeroBitPlanesTree = precinct.zeroBitPlanesTree; 23460 zeroBitPlanesTree.reset(codeblockColumn, codeblockRow); 23461 23462 while (true) { 23463 if (readBits(1)) { 23464 valueReady = !zeroBitPlanesTree.nextLevel(); 23465 23466 if (valueReady) { 23467 break; 23468 } 23469 } else { 23470 zeroBitPlanesTree.incrementValue(); 23471 } 23472 } 23473 23474 codeblock.zeroBitPlanes = zeroBitPlanesTree.value; 23475 } 23476 23477 const codingpasses = readCodingpasses(); 23478 23479 while (readBits(1)) { 23480 codeblock.Lblock++; 23481 } 23482 23483 const codingpassesLog2 = (0, _core_utils.log2)(codingpasses); 23484 const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock; 23485 const codedDataLength = readBits(bits); 23486 queue.push({ 23487 codeblock, 23488 codingpasses, 23489 dataLength: codedDataLength 23490 }); 23491 } 23492 23493 alignToByte(); 23494 23495 if (ephMarkerUsed) { 23496 skipMarkerIfEqual(0x92); 23497 } 23498 23499 while (queue.length > 0) { 23500 const packetItem = queue.shift(); 23501 codeblock = packetItem.codeblock; 23502 23503 if (codeblock.data === undefined) { 23504 codeblock.data = []; 23505 } 23506 23507 codeblock.data.push({ 23508 data, 23509 start: offset + position, 23510 end: offset + position + packetItem.dataLength, 23511 codingpasses: packetItem.codingpasses 23512 }); 23513 position += packetItem.dataLength; 23514 } 23515 } 23516 23517 return position; 23518} 23519 23520function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) { 23521 const x0 = subband.tbx0; 23522 const y0 = subband.tby0; 23523 const width = subband.tbx1 - subband.tbx0; 23524 const codeblocks = subband.codeblocks; 23525 const right = subband.type.charAt(0) === "H" ? 1 : 0; 23526 const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0; 23527 23528 for (let i = 0, ii = codeblocks.length; i < ii; ++i) { 23529 const codeblock = codeblocks[i]; 23530 const blockWidth = codeblock.tbx1_ - codeblock.tbx0_; 23531 const blockHeight = codeblock.tby1_ - codeblock.tby0_; 23532 23533 if (blockWidth === 0 || blockHeight === 0) { 23534 continue; 23535 } 23536 23537 if (codeblock.data === undefined) { 23538 continue; 23539 } 23540 23541 const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb); 23542 let currentCodingpassType = 2; 23543 const data = codeblock.data; 23544 let totalLength = 0, 23545 codingpasses = 0; 23546 let j, jj, dataItem; 23547 23548 for (j = 0, jj = data.length; j < jj; j++) { 23549 dataItem = data[j]; 23550 totalLength += dataItem.end - dataItem.start; 23551 codingpasses += dataItem.codingpasses; 23552 } 23553 23554 const encodedData = new Uint8Array(totalLength); 23555 let position = 0; 23556 23557 for (j = 0, jj = data.length; j < jj; j++) { 23558 dataItem = data[j]; 23559 const chunk = dataItem.data.subarray(dataItem.start, dataItem.end); 23560 encodedData.set(chunk, position); 23561 position += chunk.length; 23562 } 23563 23564 const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength); 23565 bitModel.setDecoder(decoder); 23566 23567 for (j = 0; j < codingpasses; j++) { 23568 switch (currentCodingpassType) { 23569 case 0: 23570 bitModel.runSignificancePropagationPass(); 23571 break; 23572 23573 case 1: 23574 bitModel.runMagnitudeRefinementPass(); 23575 break; 23576 23577 case 2: 23578 bitModel.runCleanupPass(); 23579 23580 if (segmentationSymbolUsed) { 23581 bitModel.checkSegmentationSymbol(); 23582 } 23583 23584 break; 23585 } 23586 23587 if (resetContextProbabilities) { 23588 bitModel.reset(); 23589 } 23590 23591 currentCodingpassType = (currentCodingpassType + 1) % 3; 23592 } 23593 23594 let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width; 23595 const sign = bitModel.coefficentsSign; 23596 const magnitude = bitModel.coefficentsMagnitude; 23597 const bitsDecoded = bitModel.bitsDecoded; 23598 const magnitudeCorrection = reversible ? 0 : 0.5; 23599 let k, n, nb; 23600 position = 0; 23601 const interleave = subband.type !== "LL"; 23602 23603 for (j = 0; j < blockHeight; j++) { 23604 const row = offset / width | 0; 23605 const levelOffset = 2 * row * (levelWidth - width) + right + bottom; 23606 23607 for (k = 0; k < blockWidth; k++) { 23608 n = magnitude[position]; 23609 23610 if (n !== 0) { 23611 n = (n + magnitudeCorrection) * delta; 23612 23613 if (sign[position] !== 0) { 23614 n = -n; 23615 } 23616 23617 nb = bitsDecoded[position]; 23618 const pos = interleave ? levelOffset + (offset << 1) : offset; 23619 23620 if (reversible && nb >= mb) { 23621 coefficients[pos] = n; 23622 } else { 23623 coefficients[pos] = n * (1 << mb - nb); 23624 } 23625 } 23626 23627 offset++; 23628 position++; 23629 } 23630 23631 offset += width - blockWidth; 23632 } 23633 } 23634} 23635 23636function transformTile(context, tile, c) { 23637 const component = tile.components[c]; 23638 const codingStyleParameters = component.codingStyleParameters; 23639 const quantizationParameters = component.quantizationParameters; 23640 const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount; 23641 const spqcds = quantizationParameters.SPqcds; 23642 const scalarExpounded = quantizationParameters.scalarExpounded; 23643 const guardBits = quantizationParameters.guardBits; 23644 const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed; 23645 const resetContextProbabilities = codingStyleParameters.resetContextProbabilities; 23646 const precision = context.components[c].precision; 23647 const reversible = codingStyleParameters.reversibleTransformation; 23648 const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform(); 23649 const subbandCoefficients = []; 23650 let b = 0; 23651 23652 for (let i = 0; i <= decompositionLevelsCount; i++) { 23653 const resolution = component.resolutions[i]; 23654 const width = resolution.trx1 - resolution.trx0; 23655 const height = resolution.try1 - resolution.try0; 23656 const coefficients = new Float32Array(width * height); 23657 23658 for (let j = 0, jj = resolution.subbands.length; j < jj; j++) { 23659 let mu, epsilon; 23660 23661 if (!scalarExpounded) { 23662 mu = spqcds[0].mu; 23663 epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0); 23664 } else { 23665 mu = spqcds[b].mu; 23666 epsilon = spqcds[b].epsilon; 23667 b++; 23668 } 23669 23670 const subband = resolution.subbands[j]; 23671 const gainLog2 = SubbandsGainLog2[subband.type]; 23672 const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048); 23673 const mb = guardBits + epsilon - 1; 23674 copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities); 23675 } 23676 23677 subbandCoefficients.push({ 23678 width, 23679 height, 23680 items: coefficients 23681 }); 23682 } 23683 23684 const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0); 23685 return { 23686 left: component.tcx0, 23687 top: component.tcy0, 23688 width: result.width, 23689 height: result.height, 23690 items: result.items 23691 }; 23692} 23693 23694function transformComponents(context) { 23695 const siz = context.SIZ; 23696 const components = context.components; 23697 const componentsCount = siz.Csiz; 23698 const resultImages = []; 23699 23700 for (let i = 0, ii = context.tiles.length; i < ii; i++) { 23701 const tile = context.tiles[i]; 23702 const transformedTiles = []; 23703 23704 for (let c = 0; c < componentsCount; c++) { 23705 transformedTiles[c] = transformTile(context, tile, c); 23706 } 23707 23708 const tile0 = transformedTiles[0]; 23709 const out = new Uint8ClampedArray(tile0.items.length * componentsCount); 23710 const result = { 23711 left: tile0.left, 23712 top: tile0.top, 23713 width: tile0.width, 23714 height: tile0.height, 23715 items: out 23716 }; 23717 let shift, offset; 23718 let pos = 0, 23719 j, 23720 jj, 23721 y0, 23722 y1, 23723 y2; 23724 23725 if (tile.codingStyleDefaultParameters.multipleComponentTransform) { 23726 const fourComponents = componentsCount === 4; 23727 const y0items = transformedTiles[0].items; 23728 const y1items = transformedTiles[1].items; 23729 const y2items = transformedTiles[2].items; 23730 const y3items = fourComponents ? transformedTiles[3].items : null; 23731 shift = components[0].precision - 8; 23732 offset = (128 << shift) + 0.5; 23733 const component0 = tile.components[0]; 23734 const alpha01 = componentsCount - 3; 23735 jj = y0items.length; 23736 23737 if (!component0.codingStyleParameters.reversibleTransformation) { 23738 for (j = 0; j < jj; j++, pos += alpha01) { 23739 y0 = y0items[j] + offset; 23740 y1 = y1items[j]; 23741 y2 = y2items[j]; 23742 out[pos++] = y0 + 1.402 * y2 >> shift; 23743 out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift; 23744 out[pos++] = y0 + 1.772 * y1 >> shift; 23745 } 23746 } else { 23747 for (j = 0; j < jj; j++, pos += alpha01) { 23748 y0 = y0items[j] + offset; 23749 y1 = y1items[j]; 23750 y2 = y2items[j]; 23751 const g = y0 - (y2 + y1 >> 2); 23752 out[pos++] = g + y2 >> shift; 23753 out[pos++] = g >> shift; 23754 out[pos++] = g + y1 >> shift; 23755 } 23756 } 23757 23758 if (fourComponents) { 23759 for (j = 0, pos = 3; j < jj; j++, pos += 4) { 23760 out[pos] = y3items[j] + offset >> shift; 23761 } 23762 } 23763 } else { 23764 for (let c = 0; c < componentsCount; c++) { 23765 const items = transformedTiles[c].items; 23766 shift = components[c].precision - 8; 23767 offset = (128 << shift) + 0.5; 23768 23769 for (pos = c, j = 0, jj = items.length; j < jj; j++) { 23770 out[pos] = items[j] + offset >> shift; 23771 pos += componentsCount; 23772 } 23773 } 23774 } 23775 23776 resultImages.push(result); 23777 } 23778 23779 return resultImages; 23780} 23781 23782function initializeTile(context, tileIndex) { 23783 const siz = context.SIZ; 23784 const componentsCount = siz.Csiz; 23785 const tile = context.tiles[tileIndex]; 23786 23787 for (let c = 0; c < componentsCount; c++) { 23788 const component = tile.components[c]; 23789 const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD; 23790 component.quantizationParameters = qcdOrQcc; 23791 const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD; 23792 component.codingStyleParameters = codOrCoc; 23793 } 23794 23795 tile.codingStyleDefaultParameters = context.currentTile.COD; 23796} 23797 23798class TagTree { 23799 constructor(width, height) { 23800 const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1; 23801 this.levels = []; 23802 23803 for (let i = 0; i < levelsLength; i++) { 23804 const level = { 23805 width, 23806 height, 23807 items: [] 23808 }; 23809 this.levels.push(level); 23810 width = Math.ceil(width / 2); 23811 height = Math.ceil(height / 2); 23812 } 23813 } 23814 23815 reset(i, j) { 23816 let currentLevel = 0, 23817 value = 0, 23818 level; 23819 23820 while (currentLevel < this.levels.length) { 23821 level = this.levels[currentLevel]; 23822 const index = i + j * level.width; 23823 23824 if (level.items[index] !== undefined) { 23825 value = level.items[index]; 23826 break; 23827 } 23828 23829 level.index = index; 23830 i >>= 1; 23831 j >>= 1; 23832 currentLevel++; 23833 } 23834 23835 currentLevel--; 23836 level = this.levels[currentLevel]; 23837 level.items[level.index] = value; 23838 this.currentLevel = currentLevel; 23839 delete this.value; 23840 } 23841 23842 incrementValue() { 23843 const level = this.levels[this.currentLevel]; 23844 level.items[level.index]++; 23845 } 23846 23847 nextLevel() { 23848 let currentLevel = this.currentLevel; 23849 let level = this.levels[currentLevel]; 23850 const value = level.items[level.index]; 23851 currentLevel--; 23852 23853 if (currentLevel < 0) { 23854 this.value = value; 23855 return false; 23856 } 23857 23858 this.currentLevel = currentLevel; 23859 level = this.levels[currentLevel]; 23860 level.items[level.index] = value; 23861 return true; 23862 } 23863 23864} 23865 23866class InclusionTree { 23867 constructor(width, height, defaultValue) { 23868 const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1; 23869 this.levels = []; 23870 23871 for (let i = 0; i < levelsLength; i++) { 23872 const items = new Uint8Array(width * height); 23873 23874 for (let j = 0, jj = items.length; j < jj; j++) { 23875 items[j] = defaultValue; 23876 } 23877 23878 const level = { 23879 width, 23880 height, 23881 items 23882 }; 23883 this.levels.push(level); 23884 width = Math.ceil(width / 2); 23885 height = Math.ceil(height / 2); 23886 } 23887 } 23888 23889 reset(i, j, stopValue) { 23890 let currentLevel = 0; 23891 23892 while (currentLevel < this.levels.length) { 23893 const level = this.levels[currentLevel]; 23894 const index = i + j * level.width; 23895 level.index = index; 23896 const value = level.items[index]; 23897 23898 if (value === 0xff) { 23899 break; 23900 } 23901 23902 if (value > stopValue) { 23903 this.currentLevel = currentLevel; 23904 this.propagateValues(); 23905 return false; 23906 } 23907 23908 i >>= 1; 23909 j >>= 1; 23910 currentLevel++; 23911 } 23912 23913 this.currentLevel = currentLevel - 1; 23914 return true; 23915 } 23916 23917 incrementValue(stopValue) { 23918 const level = this.levels[this.currentLevel]; 23919 level.items[level.index] = stopValue + 1; 23920 this.propagateValues(); 23921 } 23922 23923 propagateValues() { 23924 let levelIndex = this.currentLevel; 23925 let level = this.levels[levelIndex]; 23926 const currentValue = level.items[level.index]; 23927 23928 while (--levelIndex >= 0) { 23929 level = this.levels[levelIndex]; 23930 level.items[level.index] = currentValue; 23931 } 23932 } 23933 23934 nextLevel() { 23935 let currentLevel = this.currentLevel; 23936 let level = this.levels[currentLevel]; 23937 const value = level.items[level.index]; 23938 level.items[level.index] = 0xff; 23939 currentLevel--; 23940 23941 if (currentLevel < 0) { 23942 return false; 23943 } 23944 23945 this.currentLevel = currentLevel; 23946 level = this.levels[currentLevel]; 23947 level.items[level.index] = value; 23948 return true; 23949 } 23950 23951} 23952 23953const BitModel = function BitModelClosure() { 23954 const UNIFORM_CONTEXT = 17; 23955 const RUNLENGTH_CONTEXT = 18; 23956 const LLAndLHContextsLabel = new Uint8Array([0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8]); 23957 const HLContextLabel = new Uint8Array([0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8]); 23958 const HHContextLabel = new Uint8Array([0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5, 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8]); 23959 23960 class BitModel { 23961 constructor(width, height, subband, zeroBitPlanes, mb) { 23962 this.width = width; 23963 this.height = height; 23964 let contextLabelTable; 23965 23966 if (subband === "HH") { 23967 contextLabelTable = HHContextLabel; 23968 } else if (subband === "HL") { 23969 contextLabelTable = HLContextLabel; 23970 } else { 23971 contextLabelTable = LLAndLHContextsLabel; 23972 } 23973 23974 this.contextLabelTable = contextLabelTable; 23975 const coefficientCount = width * height; 23976 this.neighborsSignificance = new Uint8Array(coefficientCount); 23977 this.coefficentsSign = new Uint8Array(coefficientCount); 23978 let coefficentsMagnitude; 23979 23980 if (mb > 14) { 23981 coefficentsMagnitude = new Uint32Array(coefficientCount); 23982 } else if (mb > 6) { 23983 coefficentsMagnitude = new Uint16Array(coefficientCount); 23984 } else { 23985 coefficentsMagnitude = new Uint8Array(coefficientCount); 23986 } 23987 23988 this.coefficentsMagnitude = coefficentsMagnitude; 23989 this.processingFlags = new Uint8Array(coefficientCount); 23990 const bitsDecoded = new Uint8Array(coefficientCount); 23991 23992 if (zeroBitPlanes !== 0) { 23993 for (let i = 0; i < coefficientCount; i++) { 23994 bitsDecoded[i] = zeroBitPlanes; 23995 } 23996 } 23997 23998 this.bitsDecoded = bitsDecoded; 23999 this.reset(); 24000 } 24001 24002 setDecoder(decoder) { 24003 this.decoder = decoder; 24004 } 24005 24006 reset() { 24007 this.contexts = new Int8Array(19); 24008 this.contexts[0] = 4 << 1 | 0; 24009 this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0; 24010 this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0; 24011 } 24012 24013 setNeighborsSignificance(row, column, index) { 24014 const neighborsSignificance = this.neighborsSignificance; 24015 const width = this.width, 24016 height = this.height; 24017 const left = column > 0; 24018 const right = column + 1 < width; 24019 let i; 24020 24021 if (row > 0) { 24022 i = index - width; 24023 24024 if (left) { 24025 neighborsSignificance[i - 1] += 0x10; 24026 } 24027 24028 if (right) { 24029 neighborsSignificance[i + 1] += 0x10; 24030 } 24031 24032 neighborsSignificance[i] += 0x04; 24033 } 24034 24035 if (row + 1 < height) { 24036 i = index + width; 24037 24038 if (left) { 24039 neighborsSignificance[i - 1] += 0x10; 24040 } 24041 24042 if (right) { 24043 neighborsSignificance[i + 1] += 0x10; 24044 } 24045 24046 neighborsSignificance[i] += 0x04; 24047 } 24048 24049 if (left) { 24050 neighborsSignificance[index - 1] += 0x01; 24051 } 24052 24053 if (right) { 24054 neighborsSignificance[index + 1] += 0x01; 24055 } 24056 24057 neighborsSignificance[index] |= 0x80; 24058 } 24059 24060 runSignificancePropagationPass() { 24061 const decoder = this.decoder; 24062 const width = this.width, 24063 height = this.height; 24064 const coefficentsMagnitude = this.coefficentsMagnitude; 24065 const coefficentsSign = this.coefficentsSign; 24066 const neighborsSignificance = this.neighborsSignificance; 24067 const processingFlags = this.processingFlags; 24068 const contexts = this.contexts; 24069 const labels = this.contextLabelTable; 24070 const bitsDecoded = this.bitsDecoded; 24071 const processedInverseMask = ~1; 24072 const processedMask = 1; 24073 const firstMagnitudeBitMask = 2; 24074 24075 for (let i0 = 0; i0 < height; i0 += 4) { 24076 for (let j = 0; j < width; j++) { 24077 let index = i0 * width + j; 24078 24079 for (let i1 = 0; i1 < 4; i1++, index += width) { 24080 const i = i0 + i1; 24081 24082 if (i >= height) { 24083 break; 24084 } 24085 24086 processingFlags[index] &= processedInverseMask; 24087 24088 if (coefficentsMagnitude[index] || !neighborsSignificance[index]) { 24089 continue; 24090 } 24091 24092 const contextLabel = labels[neighborsSignificance[index]]; 24093 const decision = decoder.readBit(contexts, contextLabel); 24094 24095 if (decision) { 24096 const sign = this.decodeSignBit(i, j, index); 24097 coefficentsSign[index] = sign; 24098 coefficentsMagnitude[index] = 1; 24099 this.setNeighborsSignificance(i, j, index); 24100 processingFlags[index] |= firstMagnitudeBitMask; 24101 } 24102 24103 bitsDecoded[index]++; 24104 processingFlags[index] |= processedMask; 24105 } 24106 } 24107 } 24108 } 24109 24110 decodeSignBit(row, column, index) { 24111 const width = this.width, 24112 height = this.height; 24113 const coefficentsMagnitude = this.coefficentsMagnitude; 24114 const coefficentsSign = this.coefficentsSign; 24115 let contribution, sign0, sign1, significance1; 24116 let contextLabel, decoded; 24117 significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0; 24118 24119 if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) { 24120 sign1 = coefficentsSign[index + 1]; 24121 24122 if (significance1) { 24123 sign0 = coefficentsSign[index - 1]; 24124 contribution = 1 - sign1 - sign0; 24125 } else { 24126 contribution = 1 - sign1 - sign1; 24127 } 24128 } else if (significance1) { 24129 sign0 = coefficentsSign[index - 1]; 24130 contribution = 1 - sign0 - sign0; 24131 } else { 24132 contribution = 0; 24133 } 24134 24135 const horizontalContribution = 3 * contribution; 24136 significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0; 24137 24138 if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) { 24139 sign1 = coefficentsSign[index + width]; 24140 24141 if (significance1) { 24142 sign0 = coefficentsSign[index - width]; 24143 contribution = 1 - sign1 - sign0 + horizontalContribution; 24144 } else { 24145 contribution = 1 - sign1 - sign1 + horizontalContribution; 24146 } 24147 } else if (significance1) { 24148 sign0 = coefficentsSign[index - width]; 24149 contribution = 1 - sign0 - sign0 + horizontalContribution; 24150 } else { 24151 contribution = horizontalContribution; 24152 } 24153 24154 if (contribution >= 0) { 24155 contextLabel = 9 + contribution; 24156 decoded = this.decoder.readBit(this.contexts, contextLabel); 24157 } else { 24158 contextLabel = 9 - contribution; 24159 decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1; 24160 } 24161 24162 return decoded; 24163 } 24164 24165 runMagnitudeRefinementPass() { 24166 const decoder = this.decoder; 24167 const width = this.width, 24168 height = this.height; 24169 const coefficentsMagnitude = this.coefficentsMagnitude; 24170 const neighborsSignificance = this.neighborsSignificance; 24171 const contexts = this.contexts; 24172 const bitsDecoded = this.bitsDecoded; 24173 const processingFlags = this.processingFlags; 24174 const processedMask = 1; 24175 const firstMagnitudeBitMask = 2; 24176 const length = width * height; 24177 const width4 = width * 4; 24178 24179 for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) { 24180 indexNext = Math.min(length, index0 + width4); 24181 24182 for (let j = 0; j < width; j++) { 24183 for (let index = index0 + j; index < indexNext; index += width) { 24184 if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) { 24185 continue; 24186 } 24187 24188 let contextLabel = 16; 24189 24190 if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) { 24191 processingFlags[index] ^= firstMagnitudeBitMask; 24192 const significance = neighborsSignificance[index] & 127; 24193 contextLabel = significance === 0 ? 15 : 14; 24194 } 24195 24196 const bit = decoder.readBit(contexts, contextLabel); 24197 coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit; 24198 bitsDecoded[index]++; 24199 processingFlags[index] |= processedMask; 24200 } 24201 } 24202 } 24203 } 24204 24205 runCleanupPass() { 24206 const decoder = this.decoder; 24207 const width = this.width, 24208 height = this.height; 24209 const neighborsSignificance = this.neighborsSignificance; 24210 const coefficentsMagnitude = this.coefficentsMagnitude; 24211 const coefficentsSign = this.coefficentsSign; 24212 const contexts = this.contexts; 24213 const labels = this.contextLabelTable; 24214 const bitsDecoded = this.bitsDecoded; 24215 const processingFlags = this.processingFlags; 24216 const processedMask = 1; 24217 const firstMagnitudeBitMask = 2; 24218 const oneRowDown = width; 24219 const twoRowsDown = width * 2; 24220 const threeRowsDown = width * 3; 24221 let iNext; 24222 24223 for (let i0 = 0; i0 < height; i0 = iNext) { 24224 iNext = Math.min(i0 + 4, height); 24225 const indexBase = i0 * width; 24226 const checkAllEmpty = i0 + 3 < height; 24227 24228 for (let j = 0; j < width; j++) { 24229 const index0 = indexBase + j; 24230 const allEmpty = checkAllEmpty && processingFlags[index0] === 0 && processingFlags[index0 + oneRowDown] === 0 && processingFlags[index0 + twoRowsDown] === 0 && processingFlags[index0 + threeRowsDown] === 0 && neighborsSignificance[index0] === 0 && neighborsSignificance[index0 + oneRowDown] === 0 && neighborsSignificance[index0 + twoRowsDown] === 0 && neighborsSignificance[index0 + threeRowsDown] === 0; 24231 let i1 = 0, 24232 index = index0; 24233 let i = i0, 24234 sign; 24235 24236 if (allEmpty) { 24237 const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT); 24238 24239 if (!hasSignificantCoefficent) { 24240 bitsDecoded[index0]++; 24241 bitsDecoded[index0 + oneRowDown]++; 24242 bitsDecoded[index0 + twoRowsDown]++; 24243 bitsDecoded[index0 + threeRowsDown]++; 24244 continue; 24245 } 24246 24247 i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT); 24248 24249 if (i1 !== 0) { 24250 i = i0 + i1; 24251 index += i1 * width; 24252 } 24253 24254 sign = this.decodeSignBit(i, j, index); 24255 coefficentsSign[index] = sign; 24256 coefficentsMagnitude[index] = 1; 24257 this.setNeighborsSignificance(i, j, index); 24258 processingFlags[index] |= firstMagnitudeBitMask; 24259 index = index0; 24260 24261 for (let i2 = i0; i2 <= i; i2++, index += width) { 24262 bitsDecoded[index]++; 24263 } 24264 24265 i1++; 24266 } 24267 24268 for (i = i0 + i1; i < iNext; i++, index += width) { 24269 if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) { 24270 continue; 24271 } 24272 24273 const contextLabel = labels[neighborsSignificance[index]]; 24274 const decision = decoder.readBit(contexts, contextLabel); 24275 24276 if (decision === 1) { 24277 sign = this.decodeSignBit(i, j, index); 24278 coefficentsSign[index] = sign; 24279 coefficentsMagnitude[index] = 1; 24280 this.setNeighborsSignificance(i, j, index); 24281 processingFlags[index] |= firstMagnitudeBitMask; 24282 } 24283 24284 bitsDecoded[index]++; 24285 } 24286 } 24287 } 24288 } 24289 24290 checkSegmentationSymbol() { 24291 const decoder = this.decoder; 24292 const contexts = this.contexts; 24293 const symbol = decoder.readBit(contexts, UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT); 24294 24295 if (symbol !== 0xa) { 24296 throw new JpxError("Invalid segmentation symbol"); 24297 } 24298 } 24299 24300 } 24301 24302 return BitModel; 24303}(); 24304 24305class Transform { 24306 constructor() { 24307 if (this.constructor === Transform) { 24308 (0, _util.unreachable)("Cannot initialize Transform."); 24309 } 24310 } 24311 24312 calculate(subbands, u0, v0) { 24313 let ll = subbands[0]; 24314 24315 for (let i = 1, ii = subbands.length; i < ii; i++) { 24316 ll = this.iterate(ll, subbands[i], u0, v0); 24317 } 24318 24319 return ll; 24320 } 24321 24322 extend(buffer, offset, size) { 24323 let i1 = offset - 1, 24324 j1 = offset + 1; 24325 let i2 = offset + size - 2, 24326 j2 = offset + size; 24327 buffer[i1--] = buffer[j1++]; 24328 buffer[j2++] = buffer[i2--]; 24329 buffer[i1--] = buffer[j1++]; 24330 buffer[j2++] = buffer[i2--]; 24331 buffer[i1--] = buffer[j1++]; 24332 buffer[j2++] = buffer[i2--]; 24333 buffer[i1] = buffer[j1]; 24334 buffer[j2] = buffer[i2]; 24335 } 24336 24337 filter(x, offset, length) { 24338 (0, _util.unreachable)("Abstract method `filter` called"); 24339 } 24340 24341 iterate(ll, hl_lh_hh, u0, v0) { 24342 const llWidth = ll.width, 24343 llHeight = ll.height; 24344 let llItems = ll.items; 24345 const width = hl_lh_hh.width; 24346 const height = hl_lh_hh.height; 24347 const items = hl_lh_hh.items; 24348 let i, j, k, l, u, v; 24349 24350 for (k = 0, i = 0; i < llHeight; i++) { 24351 l = i * 2 * width; 24352 24353 for (j = 0; j < llWidth; j++, k++, l += 2) { 24354 items[l] = llItems[k]; 24355 } 24356 } 24357 24358 llItems = ll.items = null; 24359 const bufferPadding = 4; 24360 const rowBuffer = new Float32Array(width + 2 * bufferPadding); 24361 24362 if (width === 1) { 24363 if ((u0 & 1) !== 0) { 24364 for (v = 0, k = 0; v < height; v++, k += width) { 24365 items[k] *= 0.5; 24366 } 24367 } 24368 } else { 24369 for (v = 0, k = 0; v < height; v++, k += width) { 24370 rowBuffer.set(items.subarray(k, k + width), bufferPadding); 24371 this.extend(rowBuffer, bufferPadding, width); 24372 this.filter(rowBuffer, bufferPadding, width); 24373 items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k); 24374 } 24375 } 24376 24377 let numBuffers = 16; 24378 const colBuffers = []; 24379 24380 for (i = 0; i < numBuffers; i++) { 24381 colBuffers.push(new Float32Array(height + 2 * bufferPadding)); 24382 } 24383 24384 let b, 24385 currentBuffer = 0; 24386 ll = bufferPadding + height; 24387 24388 if (height === 1) { 24389 if ((v0 & 1) !== 0) { 24390 for (u = 0; u < width; u++) { 24391 items[u] *= 0.5; 24392 } 24393 } 24394 } else { 24395 for (u = 0; u < width; u++) { 24396 if (currentBuffer === 0) { 24397 numBuffers = Math.min(width - u, numBuffers); 24398 24399 for (k = u, l = bufferPadding; l < ll; k += width, l++) { 24400 for (b = 0; b < numBuffers; b++) { 24401 colBuffers[b][l] = items[k + b]; 24402 } 24403 } 24404 24405 currentBuffer = numBuffers; 24406 } 24407 24408 currentBuffer--; 24409 const buffer = colBuffers[currentBuffer]; 24410 this.extend(buffer, bufferPadding, height); 24411 this.filter(buffer, bufferPadding, height); 24412 24413 if (currentBuffer === 0) { 24414 k = u - numBuffers + 1; 24415 24416 for (l = bufferPadding; l < ll; k += width, l++) { 24417 for (b = 0; b < numBuffers; b++) { 24418 items[k + b] = colBuffers[b][l]; 24419 } 24420 } 24421 } 24422 } 24423 } 24424 24425 return { 24426 width, 24427 height, 24428 items 24429 }; 24430 } 24431 24432} 24433 24434class IrreversibleTransform extends Transform { 24435 filter(x, offset, length) { 24436 const len = length >> 1; 24437 offset |= 0; 24438 let j, n, current, next; 24439 const alpha = -1.586134342059924; 24440 const beta = -0.052980118572961; 24441 const gamma = 0.882911075530934; 24442 const delta = 0.443506852043971; 24443 const K = 1.230174104914001; 24444 const K_ = 1 / K; 24445 j = offset - 3; 24446 24447 for (n = len + 4; n--; j += 2) { 24448 x[j] *= K_; 24449 } 24450 24451 j = offset - 2; 24452 current = delta * x[j - 1]; 24453 24454 for (n = len + 3; n--; j += 2) { 24455 next = delta * x[j + 1]; 24456 x[j] = K * x[j] - current - next; 24457 24458 if (n--) { 24459 j += 2; 24460 current = delta * x[j + 1]; 24461 x[j] = K * x[j] - current - next; 24462 } else { 24463 break; 24464 } 24465 } 24466 24467 j = offset - 1; 24468 current = gamma * x[j - 1]; 24469 24470 for (n = len + 2; n--; j += 2) { 24471 next = gamma * x[j + 1]; 24472 x[j] -= current + next; 24473 24474 if (n--) { 24475 j += 2; 24476 current = gamma * x[j + 1]; 24477 x[j] -= current + next; 24478 } else { 24479 break; 24480 } 24481 } 24482 24483 j = offset; 24484 current = beta * x[j - 1]; 24485 24486 for (n = len + 1; n--; j += 2) { 24487 next = beta * x[j + 1]; 24488 x[j] -= current + next; 24489 24490 if (n--) { 24491 j += 2; 24492 current = beta * x[j + 1]; 24493 x[j] -= current + next; 24494 } else { 24495 break; 24496 } 24497 } 24498 24499 if (len !== 0) { 24500 j = offset + 1; 24501 current = alpha * x[j - 1]; 24502 24503 for (n = len; n--; j += 2) { 24504 next = alpha * x[j + 1]; 24505 x[j] -= current + next; 24506 24507 if (n--) { 24508 j += 2; 24509 current = alpha * x[j + 1]; 24510 x[j] -= current + next; 24511 } else { 24512 break; 24513 } 24514 } 24515 } 24516 } 24517 24518} 24519 24520class ReversibleTransform extends Transform { 24521 filter(x, offset, length) { 24522 const len = length >> 1; 24523 offset |= 0; 24524 let j, n; 24525 24526 for (j = offset, n = len + 1; n--; j += 2) { 24527 x[j] -= x[j - 1] + x[j + 1] + 2 >> 2; 24528 } 24529 24530 for (j = offset + 1, n = len; n--; j += 2) { 24531 x[j] += x[j - 1] + x[j + 1] >> 1; 24532 } 24533 } 24534 24535} 24536 24537/***/ }), 24538/* 31 */ 24539/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 24540 24541 24542 24543Object.defineProperty(exports, "__esModule", ({ 24544 value: true 24545})); 24546exports.LZWStream = void 0; 24547 24548var _decode_stream = __w_pdfjs_require__(19); 24549 24550class LZWStream extends _decode_stream.DecodeStream { 24551 constructor(str, maybeLength, earlyChange) { 24552 super(maybeLength); 24553 this.str = str; 24554 this.dict = str.dict; 24555 this.cachedData = 0; 24556 this.bitsCached = 0; 24557 const maxLzwDictionarySize = 4096; 24558 const lzwState = { 24559 earlyChange, 24560 codeLength: 9, 24561 nextCode: 258, 24562 dictionaryValues: new Uint8Array(maxLzwDictionarySize), 24563 dictionaryLengths: new Uint16Array(maxLzwDictionarySize), 24564 dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize), 24565 currentSequence: new Uint8Array(maxLzwDictionarySize), 24566 currentSequenceLength: 0 24567 }; 24568 24569 for (let i = 0; i < 256; ++i) { 24570 lzwState.dictionaryValues[i] = i; 24571 lzwState.dictionaryLengths[i] = 1; 24572 } 24573 24574 this.lzwState = lzwState; 24575 } 24576 24577 readBits(n) { 24578 let bitsCached = this.bitsCached; 24579 let cachedData = this.cachedData; 24580 24581 while (bitsCached < n) { 24582 const c = this.str.getByte(); 24583 24584 if (c === -1) { 24585 this.eof = true; 24586 return null; 24587 } 24588 24589 cachedData = cachedData << 8 | c; 24590 bitsCached += 8; 24591 } 24592 24593 this.bitsCached = bitsCached -= n; 24594 this.cachedData = cachedData; 24595 this.lastCode = null; 24596 return cachedData >>> bitsCached & (1 << n) - 1; 24597 } 24598 24599 readBlock() { 24600 const blockSize = 512, 24601 decodedSizeDelta = blockSize; 24602 let estimatedDecodedSize = blockSize * 2; 24603 let i, j, q; 24604 const lzwState = this.lzwState; 24605 24606 if (!lzwState) { 24607 return; 24608 } 24609 24610 const earlyChange = lzwState.earlyChange; 24611 let nextCode = lzwState.nextCode; 24612 const dictionaryValues = lzwState.dictionaryValues; 24613 const dictionaryLengths = lzwState.dictionaryLengths; 24614 const dictionaryPrevCodes = lzwState.dictionaryPrevCodes; 24615 let codeLength = lzwState.codeLength; 24616 let prevCode = lzwState.prevCode; 24617 const currentSequence = lzwState.currentSequence; 24618 let currentSequenceLength = lzwState.currentSequenceLength; 24619 let decodedLength = 0; 24620 let currentBufferLength = this.bufferLength; 24621 let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 24622 24623 for (i = 0; i < blockSize; i++) { 24624 const code = this.readBits(codeLength); 24625 const hasPrev = currentSequenceLength > 0; 24626 24627 if (code < 256) { 24628 currentSequence[0] = code; 24629 currentSequenceLength = 1; 24630 } else if (code >= 258) { 24631 if (code < nextCode) { 24632 currentSequenceLength = dictionaryLengths[code]; 24633 24634 for (j = currentSequenceLength - 1, q = code; j >= 0; j--) { 24635 currentSequence[j] = dictionaryValues[q]; 24636 q = dictionaryPrevCodes[q]; 24637 } 24638 } else { 24639 currentSequence[currentSequenceLength++] = currentSequence[0]; 24640 } 24641 } else if (code === 256) { 24642 codeLength = 9; 24643 nextCode = 258; 24644 currentSequenceLength = 0; 24645 continue; 24646 } else { 24647 this.eof = true; 24648 delete this.lzwState; 24649 break; 24650 } 24651 24652 if (hasPrev) { 24653 dictionaryPrevCodes[nextCode] = prevCode; 24654 dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1; 24655 dictionaryValues[nextCode] = currentSequence[0]; 24656 nextCode++; 24657 codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0; 24658 } 24659 24660 prevCode = code; 24661 decodedLength += currentSequenceLength; 24662 24663 if (estimatedDecodedSize < decodedLength) { 24664 do { 24665 estimatedDecodedSize += decodedSizeDelta; 24666 } while (estimatedDecodedSize < decodedLength); 24667 24668 buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 24669 } 24670 24671 for (j = 0; j < currentSequenceLength; j++) { 24672 buffer[currentBufferLength++] = currentSequence[j]; 24673 } 24674 } 24675 24676 lzwState.nextCode = nextCode; 24677 lzwState.codeLength = codeLength; 24678 lzwState.prevCode = prevCode; 24679 lzwState.currentSequenceLength = currentSequenceLength; 24680 this.bufferLength = currentBufferLength; 24681 } 24682 24683} 24684 24685exports.LZWStream = LZWStream; 24686 24687/***/ }), 24688/* 32 */ 24689/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 24690 24691 24692 24693Object.defineProperty(exports, "__esModule", ({ 24694 value: true 24695})); 24696exports.PredictorStream = void 0; 24697 24698var _decode_stream = __w_pdfjs_require__(19); 24699 24700var _primitives = __w_pdfjs_require__(5); 24701 24702var _util = __w_pdfjs_require__(2); 24703 24704class PredictorStream extends _decode_stream.DecodeStream { 24705 constructor(str, maybeLength, params) { 24706 super(maybeLength); 24707 24708 if (!(params instanceof _primitives.Dict)) { 24709 return str; 24710 } 24711 24712 const predictor = this.predictor = params.get("Predictor") || 1; 24713 24714 if (predictor <= 1) { 24715 return str; 24716 } 24717 24718 if (predictor !== 2 && (predictor < 10 || predictor > 15)) { 24719 throw new _util.FormatError(`Unsupported predictor: ${predictor}`); 24720 } 24721 24722 if (predictor === 2) { 24723 this.readBlock = this.readBlockTiff; 24724 } else { 24725 this.readBlock = this.readBlockPng; 24726 } 24727 24728 this.str = str; 24729 this.dict = str.dict; 24730 const colors = this.colors = params.get("Colors") || 1; 24731 const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8; 24732 const columns = this.columns = params.get("Columns") || 1; 24733 this.pixBytes = colors * bits + 7 >> 3; 24734 this.rowBytes = columns * colors * bits + 7 >> 3; 24735 return this; 24736 } 24737 24738 readBlockTiff() { 24739 const rowBytes = this.rowBytes; 24740 const bufferLength = this.bufferLength; 24741 const buffer = this.ensureBuffer(bufferLength + rowBytes); 24742 const bits = this.bits; 24743 const colors = this.colors; 24744 const rawBytes = this.str.getBytes(rowBytes); 24745 this.eof = !rawBytes.length; 24746 24747 if (this.eof) { 24748 return; 24749 } 24750 24751 let inbuf = 0, 24752 outbuf = 0; 24753 let inbits = 0, 24754 outbits = 0; 24755 let pos = bufferLength; 24756 let i; 24757 24758 if (bits === 1 && colors === 1) { 24759 for (i = 0; i < rowBytes; ++i) { 24760 let c = rawBytes[i] ^ inbuf; 24761 c ^= c >> 1; 24762 c ^= c >> 2; 24763 c ^= c >> 4; 24764 inbuf = (c & 1) << 7; 24765 buffer[pos++] = c; 24766 } 24767 } else if (bits === 8) { 24768 for (i = 0; i < colors; ++i) { 24769 buffer[pos++] = rawBytes[i]; 24770 } 24771 24772 for (; i < rowBytes; ++i) { 24773 buffer[pos] = buffer[pos - colors] + rawBytes[i]; 24774 pos++; 24775 } 24776 } else if (bits === 16) { 24777 const bytesPerPixel = colors * 2; 24778 24779 for (i = 0; i < bytesPerPixel; ++i) { 24780 buffer[pos++] = rawBytes[i]; 24781 } 24782 24783 for (; i < rowBytes; i += 2) { 24784 const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff); 24785 buffer[pos++] = sum >> 8 & 0xff; 24786 buffer[pos++] = sum & 0xff; 24787 } 24788 } else { 24789 const compArray = new Uint8Array(colors + 1); 24790 const bitMask = (1 << bits) - 1; 24791 let j = 0, 24792 k = bufferLength; 24793 const columns = this.columns; 24794 24795 for (i = 0; i < columns; ++i) { 24796 for (let kk = 0; kk < colors; ++kk) { 24797 if (inbits < bits) { 24798 inbuf = inbuf << 8 | rawBytes[j++] & 0xff; 24799 inbits += 8; 24800 } 24801 24802 compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask; 24803 inbits -= bits; 24804 outbuf = outbuf << bits | compArray[kk]; 24805 outbits += bits; 24806 24807 if (outbits >= 8) { 24808 buffer[k++] = outbuf >> outbits - 8 & 0xff; 24809 outbits -= 8; 24810 } 24811 } 24812 } 24813 24814 if (outbits > 0) { 24815 buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1); 24816 } 24817 } 24818 24819 this.bufferLength += rowBytes; 24820 } 24821 24822 readBlockPng() { 24823 const rowBytes = this.rowBytes; 24824 const pixBytes = this.pixBytes; 24825 const predictor = this.str.getByte(); 24826 const rawBytes = this.str.getBytes(rowBytes); 24827 this.eof = !rawBytes.length; 24828 24829 if (this.eof) { 24830 return; 24831 } 24832 24833 const bufferLength = this.bufferLength; 24834 const buffer = this.ensureBuffer(bufferLength + rowBytes); 24835 let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength); 24836 24837 if (prevRow.length === 0) { 24838 prevRow = new Uint8Array(rowBytes); 24839 } 24840 24841 let i, 24842 j = bufferLength, 24843 up, 24844 c; 24845 24846 switch (predictor) { 24847 case 0: 24848 for (i = 0; i < rowBytes; ++i) { 24849 buffer[j++] = rawBytes[i]; 24850 } 24851 24852 break; 24853 24854 case 1: 24855 for (i = 0; i < pixBytes; ++i) { 24856 buffer[j++] = rawBytes[i]; 24857 } 24858 24859 for (; i < rowBytes; ++i) { 24860 buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff; 24861 j++; 24862 } 24863 24864 break; 24865 24866 case 2: 24867 for (i = 0; i < rowBytes; ++i) { 24868 buffer[j++] = prevRow[i] + rawBytes[i] & 0xff; 24869 } 24870 24871 break; 24872 24873 case 3: 24874 for (i = 0; i < pixBytes; ++i) { 24875 buffer[j++] = (prevRow[i] >> 1) + rawBytes[i]; 24876 } 24877 24878 for (; i < rowBytes; ++i) { 24879 buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff; 24880 j++; 24881 } 24882 24883 break; 24884 24885 case 4: 24886 for (i = 0; i < pixBytes; ++i) { 24887 up = prevRow[i]; 24888 c = rawBytes[i]; 24889 buffer[j++] = up + c; 24890 } 24891 24892 for (; i < rowBytes; ++i) { 24893 up = prevRow[i]; 24894 const upLeft = prevRow[i - pixBytes]; 24895 const left = buffer[j - pixBytes]; 24896 const p = left + up - upLeft; 24897 let pa = p - left; 24898 24899 if (pa < 0) { 24900 pa = -pa; 24901 } 24902 24903 let pb = p - up; 24904 24905 if (pb < 0) { 24906 pb = -pb; 24907 } 24908 24909 let pc = p - upLeft; 24910 24911 if (pc < 0) { 24912 pc = -pc; 24913 } 24914 24915 c = rawBytes[i]; 24916 24917 if (pa <= pb && pa <= pc) { 24918 buffer[j++] = left + c; 24919 } else if (pb <= pc) { 24920 buffer[j++] = up + c; 24921 } else { 24922 buffer[j++] = upLeft + c; 24923 } 24924 } 24925 24926 break; 24927 24928 default: 24929 throw new _util.FormatError(`Unsupported predictor: ${predictor}`); 24930 } 24931 24932 this.bufferLength += rowBytes; 24933 } 24934 24935} 24936 24937exports.PredictorStream = PredictorStream; 24938 24939/***/ }), 24940/* 33 */ 24941/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 24942 24943 24944 24945Object.defineProperty(exports, "__esModule", ({ 24946 value: true 24947})); 24948exports.RunLengthStream = void 0; 24949 24950var _decode_stream = __w_pdfjs_require__(19); 24951 24952class RunLengthStream extends _decode_stream.DecodeStream { 24953 constructor(str, maybeLength) { 24954 super(maybeLength); 24955 this.str = str; 24956 this.dict = str.dict; 24957 } 24958 24959 readBlock() { 24960 const repeatHeader = this.str.getBytes(2); 24961 24962 if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) { 24963 this.eof = true; 24964 return; 24965 } 24966 24967 let buffer; 24968 let bufferLength = this.bufferLength; 24969 let n = repeatHeader[0]; 24970 24971 if (n < 128) { 24972 buffer = this.ensureBuffer(bufferLength + n + 1); 24973 buffer[bufferLength++] = repeatHeader[1]; 24974 24975 if (n > 0) { 24976 const source = this.str.getBytes(n); 24977 buffer.set(source, bufferLength); 24978 bufferLength += n; 24979 } 24980 } else { 24981 n = 257 - n; 24982 const b = repeatHeader[1]; 24983 buffer = this.ensureBuffer(bufferLength + n + 1); 24984 24985 for (let i = 0; i < n; i++) { 24986 buffer[bufferLength++] = b; 24987 } 24988 } 24989 24990 this.bufferLength = bufferLength; 24991 } 24992 24993} 24994 24995exports.RunLengthStream = RunLengthStream; 24996 24997/***/ }), 24998/* 34 */ 24999/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 25000 25001 25002 25003Object.defineProperty(exports, "__esModule", ({ 25004 value: true 25005})); 25006exports.Font = exports.ErrorFont = void 0; 25007 25008var _util = __w_pdfjs_require__(2); 25009 25010var _cff_parser = __w_pdfjs_require__(35); 25011 25012var _fonts_utils = __w_pdfjs_require__(38); 25013 25014var _unicode = __w_pdfjs_require__(40); 25015 25016var _glyphlist = __w_pdfjs_require__(39); 25017 25018var _encodings = __w_pdfjs_require__(37); 25019 25020var _standard_fonts = __w_pdfjs_require__(41); 25021 25022var _to_unicode_map = __w_pdfjs_require__(42); 25023 25024var _cff_font = __w_pdfjs_require__(43); 25025 25026var _font_renderer = __w_pdfjs_require__(44); 25027 25028var _metrics = __w_pdfjs_require__(45); 25029 25030var _glyf = __w_pdfjs_require__(46); 25031 25032var _cmap = __w_pdfjs_require__(16); 25033 25034var _opentype_file_builder = __w_pdfjs_require__(47); 25035 25036var _core_utils = __w_pdfjs_require__(6); 25037 25038var _stream = __w_pdfjs_require__(10); 25039 25040var _type1_font = __w_pdfjs_require__(48); 25041 25042const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]]; 25043const PDF_GLYPH_SPACE_UNITS = 1000; 25044const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"]; 25045const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"]; 25046 25047function adjustWidths(properties) { 25048 if (!properties.fontMatrix) { 25049 return; 25050 } 25051 25052 if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) { 25053 return; 25054 } 25055 25056 const scale = 0.001 / properties.fontMatrix[0]; 25057 const glyphsWidths = properties.widths; 25058 25059 for (const glyph in glyphsWidths) { 25060 glyphsWidths[glyph] *= scale; 25061 } 25062 25063 properties.defaultWidth *= scale; 25064} 25065 25066function adjustToUnicode(properties, builtInEncoding) { 25067 if (properties.isInternalFont) { 25068 return; 25069 } 25070 25071 if (builtInEncoding === properties.defaultEncoding) { 25072 return; 25073 } 25074 25075 if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 25076 return; 25077 } 25078 25079 const toUnicode = [], 25080 glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 25081 25082 for (const charCode in builtInEncoding) { 25083 if (properties.hasIncludedToUnicodeMap) { 25084 if (properties.toUnicode.has(charCode)) { 25085 continue; 25086 } 25087 } else if (properties.hasEncoding) { 25088 if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) { 25089 continue; 25090 } 25091 } 25092 25093 const glyphName = builtInEncoding[charCode]; 25094 const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 25095 25096 if (unicode !== -1) { 25097 toUnicode[charCode] = String.fromCharCode(unicode); 25098 } 25099 } 25100 25101 if (toUnicode.length > 0) { 25102 properties.toUnicode.amend(toUnicode); 25103 } 25104} 25105 25106function amendFallbackToUnicode(properties) { 25107 if (!properties.fallbackToUnicode) { 25108 return; 25109 } 25110 25111 if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 25112 return; 25113 } 25114 25115 const toUnicode = []; 25116 25117 for (const charCode in properties.fallbackToUnicode) { 25118 if (properties.toUnicode.has(charCode)) { 25119 continue; 25120 } 25121 25122 toUnicode[charCode] = properties.fallbackToUnicode[charCode]; 25123 } 25124 25125 if (toUnicode.length > 0) { 25126 properties.toUnicode.amend(toUnicode); 25127 } 25128} 25129 25130class Glyph { 25131 constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { 25132 this.originalCharCode = originalCharCode; 25133 this.fontChar = fontChar; 25134 this.unicode = unicode; 25135 this.accent = accent; 25136 this.width = width; 25137 this.vmetric = vmetric; 25138 this.operatorListId = operatorListId; 25139 this.isSpace = isSpace; 25140 this.isInFont = isInFont; 25141 const category = (0, _unicode.getCharUnicodeCategory)(unicode); 25142 this.isWhitespace = category.isWhitespace; 25143 this.isZeroWidthDiacritic = category.isZeroWidthDiacritic; 25144 this.isInvisibleFormatMark = category.isInvisibleFormatMark; 25145 } 25146 25147 matchesForCache(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { 25148 return this.originalCharCode === originalCharCode && this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont; 25149 } 25150 25151} 25152 25153function int16(b0, b1) { 25154 return (b0 << 8) + b1; 25155} 25156 25157function writeSignedInt16(bytes, index, value) { 25158 bytes[index + 1] = value; 25159 bytes[index] = value >>> 8; 25160} 25161 25162function signedInt16(b0, b1) { 25163 const value = (b0 << 8) + b1; 25164 return value & 1 << 15 ? value - 0x10000 : value; 25165} 25166 25167function int32(b0, b1, b2, b3) { 25168 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 25169} 25170 25171function string16(value) { 25172 return String.fromCharCode(value >> 8 & 0xff, value & 0xff); 25173} 25174 25175function safeString16(value) { 25176 if (value > 0x7fff) { 25177 value = 0x7fff; 25178 } else if (value < -0x8000) { 25179 value = -0x8000; 25180 } 25181 25182 return String.fromCharCode(value >> 8 & 0xff, value & 0xff); 25183} 25184 25185function isTrueTypeFile(file) { 25186 const header = file.peekBytes(4); 25187 return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true"; 25188} 25189 25190function isTrueTypeCollectionFile(file) { 25191 const header = file.peekBytes(4); 25192 return (0, _util.bytesToString)(header) === "ttcf"; 25193} 25194 25195function isOpenTypeFile(file) { 25196 const header = file.peekBytes(4); 25197 return (0, _util.bytesToString)(header) === "OTTO"; 25198} 25199 25200function isType1File(file) { 25201 const header = file.peekBytes(2); 25202 25203 if (header[0] === 0x25 && header[1] === 0x21) { 25204 return true; 25205 } 25206 25207 if (header[0] === 0x80 && header[1] === 0x01) { 25208 return true; 25209 } 25210 25211 return false; 25212} 25213 25214function isCFFFile(file) { 25215 const header = file.peekBytes(4); 25216 25217 if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) { 25218 return true; 25219 } 25220 25221 return false; 25222} 25223 25224function getFontFileType(file, { 25225 type, 25226 subtype, 25227 composite 25228}) { 25229 let fileType, fileSubtype; 25230 25231 if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) { 25232 if (composite) { 25233 fileType = "CIDFontType2"; 25234 } else { 25235 fileType = "TrueType"; 25236 } 25237 } else if (isOpenTypeFile(file)) { 25238 if (composite) { 25239 fileType = "CIDFontType2"; 25240 } else { 25241 fileType = "OpenType"; 25242 } 25243 } else if (isType1File(file)) { 25244 if (composite) { 25245 fileType = "CIDFontType0"; 25246 } else { 25247 fileType = type === "MMType1" ? "MMType1" : "Type1"; 25248 } 25249 } else if (isCFFFile(file)) { 25250 if (composite) { 25251 fileType = "CIDFontType0"; 25252 fileSubtype = "CIDFontType0C"; 25253 } else { 25254 fileType = type === "MMType1" ? "MMType1" : "Type1"; 25255 fileSubtype = "Type1C"; 25256 } 25257 } else { 25258 (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype."); 25259 fileType = type; 25260 fileSubtype = subtype; 25261 } 25262 25263 return [fileType, fileSubtype]; 25264} 25265 25266function applyStandardFontGlyphMap(map, glyphMap) { 25267 for (const charCode in glyphMap) { 25268 map[+charCode] = glyphMap[charCode]; 25269 } 25270} 25271 25272function buildToFontChar(encoding, glyphsUnicodeMap, differences) { 25273 const toFontChar = []; 25274 let unicode; 25275 25276 for (let i = 0, ii = encoding.length; i < ii; i++) { 25277 unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap); 25278 25279 if (unicode !== -1) { 25280 toFontChar[i] = unicode; 25281 } 25282 } 25283 25284 for (const charCode in differences) { 25285 unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap); 25286 25287 if (unicode !== -1) { 25288 toFontChar[+charCode] = unicode; 25289 } 25290 } 25291 25292 return toFontChar; 25293} 25294 25295function convertCidString(charCode, cid, shouldThrow = false) { 25296 switch (cid.length) { 25297 case 1: 25298 return cid.charCodeAt(0); 25299 25300 case 2: 25301 return cid.charCodeAt(0) << 8 | cid.charCodeAt(1); 25302 } 25303 25304 const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`; 25305 25306 if (shouldThrow) { 25307 throw new _util.FormatError(msg); 25308 } 25309 25310 (0, _util.warn)(msg); 25311 return cid; 25312} 25313 25314function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) { 25315 const newMap = Object.create(null); 25316 const toUnicodeExtraMap = new Map(); 25317 const toFontChar = []; 25318 const usedGlyphIds = new Set(); 25319 let privateUseAreaIndex = 0; 25320 const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; 25321 let nextAvailableFontCharCode = privateUseOffetStart; 25322 let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; 25323 25324 for (let originalCharCode in charCodeToGlyphId) { 25325 originalCharCode |= 0; 25326 let glyphId = charCodeToGlyphId[originalCharCode]; 25327 25328 if (!hasGlyph(glyphId)) { 25329 continue; 25330 } 25331 25332 if (nextAvailableFontCharCode > privateUseOffetEnd) { 25333 privateUseAreaIndex++; 25334 25335 if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) { 25336 (0, _util.warn)("Ran out of space in font private use area."); 25337 break; 25338 } 25339 25340 nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; 25341 privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; 25342 } 25343 25344 const fontCharCode = nextAvailableFontCharCode++; 25345 25346 if (glyphId === 0) { 25347 glyphId = newGlyphZeroId; 25348 } 25349 25350 let unicode = toUnicode.get(originalCharCode); 25351 25352 if (typeof unicode === "string") { 25353 unicode = unicode.codePointAt(0); 25354 } 25355 25356 if (unicode && unicode < privateUseOffetStart && !usedGlyphIds.has(glyphId)) { 25357 toUnicodeExtraMap.set(unicode, glyphId); 25358 usedGlyphIds.add(glyphId); 25359 } 25360 25361 newMap[fontCharCode] = glyphId; 25362 toFontChar[originalCharCode] = fontCharCode; 25363 } 25364 25365 return { 25366 toFontChar, 25367 charCodeToGlyphId: newMap, 25368 toUnicodeExtraMap, 25369 nextAvailableFontCharCode 25370 }; 25371} 25372 25373function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) { 25374 const codes = []; 25375 25376 for (const charCode in glyphs) { 25377 if (glyphs[charCode] >= numGlyphs) { 25378 continue; 25379 } 25380 25381 codes.push({ 25382 fontCharCode: charCode | 0, 25383 glyphId: glyphs[charCode] 25384 }); 25385 } 25386 25387 if (toUnicodeExtraMap) { 25388 for (const [unicode, glyphId] of toUnicodeExtraMap) { 25389 if (glyphId >= numGlyphs) { 25390 continue; 25391 } 25392 25393 codes.push({ 25394 fontCharCode: unicode, 25395 glyphId 25396 }); 25397 } 25398 } 25399 25400 if (codes.length === 0) { 25401 codes.push({ 25402 fontCharCode: 0, 25403 glyphId: 0 25404 }); 25405 } 25406 25407 codes.sort(function fontGetRangesSort(a, b) { 25408 return a.fontCharCode - b.fontCharCode; 25409 }); 25410 const ranges = []; 25411 const length = codes.length; 25412 25413 for (let n = 0; n < length;) { 25414 const start = codes[n].fontCharCode; 25415 const codeIndices = [codes[n].glyphId]; 25416 ++n; 25417 let end = start; 25418 25419 while (n < length && end + 1 === codes[n].fontCharCode) { 25420 codeIndices.push(codes[n].glyphId); 25421 ++end; 25422 ++n; 25423 25424 if (end === 0xffff) { 25425 break; 25426 } 25427 } 25428 25429 ranges.push([start, end, codeIndices]); 25430 } 25431 25432 return ranges; 25433} 25434 25435function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) { 25436 const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs); 25437 const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1; 25438 let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8); 25439 let i, ii, j, jj; 25440 25441 for (i = ranges.length - 1; i >= 0; --i) { 25442 if (ranges[i][0] <= 0xffff) { 25443 break; 25444 } 25445 } 25446 25447 const bmpLength = i + 1; 25448 25449 if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) { 25450 ranges[i][1] = 0xfffe; 25451 } 25452 25453 const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0; 25454 const segCount = bmpLength + trailingRangesCount; 25455 25456 const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2); 25457 25458 let startCount = ""; 25459 let endCount = ""; 25460 let idDeltas = ""; 25461 let idRangeOffsets = ""; 25462 let glyphsIds = ""; 25463 let bias = 0; 25464 let range, start, end, codes; 25465 25466 for (i = 0, ii = bmpLength; i < ii; i++) { 25467 range = ranges[i]; 25468 start = range[0]; 25469 end = range[1]; 25470 startCount += string16(start); 25471 endCount += string16(end); 25472 codes = range[2]; 25473 let contiguous = true; 25474 25475 for (j = 1, jj = codes.length; j < jj; ++j) { 25476 if (codes[j] !== codes[j - 1] + 1) { 25477 contiguous = false; 25478 break; 25479 } 25480 } 25481 25482 if (!contiguous) { 25483 const offset = (segCount - i) * 2 + bias * 2; 25484 bias += end - start + 1; 25485 idDeltas += string16(0); 25486 idRangeOffsets += string16(offset); 25487 25488 for (j = 0, jj = codes.length; j < jj; ++j) { 25489 glyphsIds += string16(codes[j]); 25490 } 25491 } else { 25492 const startCode = codes[0]; 25493 idDeltas += string16(startCode - start & 0xffff); 25494 idRangeOffsets += string16(0); 25495 } 25496 } 25497 25498 if (trailingRangesCount > 0) { 25499 endCount += "\xFF\xFF"; 25500 startCount += "\xFF\xFF"; 25501 idDeltas += "\x00\x01"; 25502 idRangeOffsets += "\x00\x00"; 25503 } 25504 25505 const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds; 25506 let format31012 = ""; 25507 let header31012 = ""; 25508 25509 if (numTables > 1) { 25510 cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length); 25511 format31012 = ""; 25512 25513 for (i = 0, ii = ranges.length; i < ii; i++) { 25514 range = ranges[i]; 25515 start = range[0]; 25516 codes = range[2]; 25517 let code = codes[0]; 25518 25519 for (j = 1, jj = codes.length; j < jj; ++j) { 25520 if (codes[j] !== codes[j - 1] + 1) { 25521 end = range[0] + j - 1; 25522 format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code); 25523 start = end + 1; 25524 code = codes[j]; 25525 } 25526 } 25527 25528 format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code); 25529 } 25530 25531 header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12); 25532 } 25533 25534 return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012; 25535} 25536 25537function validateOS2Table(os2, file) { 25538 file.pos = (file.start || 0) + os2.offset; 25539 const version = file.getUint16(); 25540 file.skip(60); 25541 const selection = file.getUint16(); 25542 25543 if (version < 4 && selection & 0x0300) { 25544 return false; 25545 } 25546 25547 const firstChar = file.getUint16(); 25548 const lastChar = file.getUint16(); 25549 25550 if (firstChar > lastChar) { 25551 return false; 25552 } 25553 25554 file.skip(6); 25555 const usWinAscent = file.getUint16(); 25556 25557 if (usWinAscent === 0) { 25558 return false; 25559 } 25560 25561 os2.data[8] = os2.data[9] = 0; 25562 return true; 25563} 25564 25565function createOS2Table(properties, charstrings, override) { 25566 override = override || { 25567 unitsPerEm: 0, 25568 yMax: 0, 25569 yMin: 0, 25570 ascent: 0, 25571 descent: 0 25572 }; 25573 let ulUnicodeRange1 = 0; 25574 let ulUnicodeRange2 = 0; 25575 let ulUnicodeRange3 = 0; 25576 let ulUnicodeRange4 = 0; 25577 let firstCharIndex = null; 25578 let lastCharIndex = 0; 25579 25580 if (charstrings) { 25581 for (let code in charstrings) { 25582 code |= 0; 25583 25584 if (firstCharIndex > code || !firstCharIndex) { 25585 firstCharIndex = code; 25586 } 25587 25588 if (lastCharIndex < code) { 25589 lastCharIndex = code; 25590 } 25591 25592 const position = (0, _unicode.getUnicodeRangeFor)(code); 25593 25594 if (position < 32) { 25595 ulUnicodeRange1 |= 1 << position; 25596 } else if (position < 64) { 25597 ulUnicodeRange2 |= 1 << position - 32; 25598 } else if (position < 96) { 25599 ulUnicodeRange3 |= 1 << position - 64; 25600 } else if (position < 123) { 25601 ulUnicodeRange4 |= 1 << position - 96; 25602 } else { 25603 throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage"); 25604 } 25605 } 25606 25607 if (lastCharIndex > 0xffff) { 25608 lastCharIndex = 0xffff; 25609 } 25610 } else { 25611 firstCharIndex = 0; 25612 lastCharIndex = 255; 25613 } 25614 25615 const bbox = properties.bbox || [0, 0, 0, 0]; 25616 const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0]; 25617 const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS; 25618 const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3])); 25619 let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1])); 25620 25621 if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) { 25622 typoDescent = -typoDescent; 25623 } 25624 25625 const winAscent = override.yMax || typoAscent; 25626 const winDescent = -override.yMin || -typoDescent; 25627 return "\x00\x03" + "\x02\x24" + "\x01\xF4" + "\x00\x05" + "\x00\x00" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x00\x8C" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x01\xDF" + "\x00\x31" + "\x01\x02" + "\x00\x00" + "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + "\x00\x00\x00\x00\x00\x00" + (0, _util.string32)(ulUnicodeRange1) + (0, _util.string32)(ulUnicodeRange2) + (0, _util.string32)(ulUnicodeRange3) + (0, _util.string32)(ulUnicodeRange4) + "\x2A\x32\x31\x2A" + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + "\x00\x64" + string16(winAscent) + string16(winDescent) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + "\x00\x03"; 25628} 25629 25630function createPostTable(properties) { 25631 const angle = Math.floor(properties.italicAngle * 2 ** 16); 25632 return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch ? 1 : 0) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00"; 25633} 25634 25635function createPostscriptName(name) { 25636 return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63); 25637} 25638 25639function createNameTable(name, proto) { 25640 if (!proto) { 25641 proto = [[], []]; 25642 } 25643 25644 const strings = [proto[0][0] || "Original licence", proto[0][1] || name, proto[0][2] || "Unknown", proto[0][3] || "uniqueID", proto[0][4] || name, proto[0][5] || "Version 0.11", proto[0][6] || createPostscriptName(name), proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"]; 25645 const stringsUnicode = []; 25646 let i, ii, j, jj, str; 25647 25648 for (i = 0, ii = strings.length; i < ii; i++) { 25649 str = proto[1][i] || strings[i]; 25650 const strBufUnicode = []; 25651 25652 for (j = 0, jj = str.length; j < jj; j++) { 25653 strBufUnicode.push(string16(str.charCodeAt(j))); 25654 } 25655 25656 stringsUnicode.push(strBufUnicode.join("")); 25657 } 25658 25659 const names = [strings, stringsUnicode]; 25660 const platforms = ["\x00\x01", "\x00\x03"]; 25661 const encodings = ["\x00\x00", "\x00\x01"]; 25662 const languages = ["\x00\x00", "\x04\x09"]; 25663 const namesRecordCount = strings.length * platforms.length; 25664 let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6); 25665 let strOffset = 0; 25666 25667 for (i = 0, ii = platforms.length; i < ii; i++) { 25668 const strs = names[i]; 25669 25670 for (j = 0, jj = strs.length; j < jj; j++) { 25671 str = strs[j]; 25672 const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset); 25673 nameTable += nameRecord; 25674 strOffset += str.length; 25675 } 25676 } 25677 25678 nameTable += strings.join("") + stringsUnicode.join(""); 25679 return nameTable; 25680} 25681 25682class Font { 25683 constructor(name, file, properties) { 25684 this.name = name; 25685 this.psName = null; 25686 this.mimetype = null; 25687 this.disableFontFace = false; 25688 this.loadedName = properties.loadedName; 25689 this.isType3Font = properties.isType3Font; 25690 this.missingFile = false; 25691 this.cssFontInfo = properties.cssFontInfo; 25692 this._charsCache = Object.create(null); 25693 this._glyphCache = Object.create(null); 25694 let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif); 25695 25696 if (!isSerifFont && !properties.isSimulatedFlags) { 25697 const baseName = name.replace(/[,_]/g, "-").split("-")[0], 25698 serifFonts = (0, _standard_fonts.getSerifFonts)(); 25699 25700 for (const namePart of baseName.split("+")) { 25701 if (serifFonts[namePart]) { 25702 isSerifFont = true; 25703 break; 25704 } 25705 } 25706 } 25707 25708 this.isSerifFont = isSerifFont; 25709 this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic); 25710 this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch); 25711 let type = properties.type; 25712 let subtype = properties.subtype; 25713 this.type = type; 25714 this.subtype = subtype; 25715 let fallbackName = "sans-serif"; 25716 25717 if (this.isMonospace) { 25718 fallbackName = "monospace"; 25719 } else if (this.isSerifFont) { 25720 fallbackName = "serif"; 25721 } 25722 25723 this.fallbackName = fallbackName; 25724 this.differences = properties.differences; 25725 this.widths = properties.widths; 25726 this.defaultWidth = properties.defaultWidth; 25727 this.composite = properties.composite; 25728 this.cMap = properties.cMap; 25729 this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS; 25730 this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS; 25731 this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; 25732 this.lineHeight = this.ascent - this.descent; 25733 this.fontMatrix = properties.fontMatrix; 25734 this.bbox = properties.bbox; 25735 this.defaultEncoding = properties.defaultEncoding; 25736 this.toUnicode = properties.toUnicode; 25737 this.toFontChar = []; 25738 25739 if (properties.type === "Type3") { 25740 for (let charCode = 0; charCode < 256; charCode++) { 25741 this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode]; 25742 } 25743 25744 this.fontType = _util.FontType.TYPE3; 25745 return; 25746 } 25747 25748 this.cidEncoding = properties.cidEncoding || ""; 25749 this.vertical = !!properties.vertical; 25750 25751 if (this.vertical) { 25752 this.vmetrics = properties.vmetrics; 25753 this.defaultVMetrics = properties.defaultVMetrics; 25754 } 25755 25756 if (!file || file.isEmpty) { 25757 if (file) { 25758 (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")"); 25759 } 25760 25761 this.fallbackToSystemFont(properties); 25762 return; 25763 } 25764 25765 [type, subtype] = getFontFileType(file, properties); 25766 25767 if (type !== this.type || subtype !== this.subtype) { 25768 (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`); 25769 } 25770 25771 let data; 25772 25773 try { 25774 switch (type) { 25775 case "MMType1": 25776 (0, _util.info)("MMType1 font (" + name + "), falling back to Type1."); 25777 25778 case "Type1": 25779 case "CIDFontType0": 25780 this.mimetype = "font/opentype"; 25781 const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties); 25782 adjustWidths(properties); 25783 data = this.convert(name, cff, properties); 25784 break; 25785 25786 case "OpenType": 25787 case "TrueType": 25788 case "CIDFontType2": 25789 this.mimetype = "font/opentype"; 25790 data = this.checkAndRepair(name, file, properties); 25791 25792 if (this.isOpenType) { 25793 adjustWidths(properties); 25794 type = "OpenType"; 25795 } 25796 25797 break; 25798 25799 default: 25800 throw new _util.FormatError(`Font ${type} is not supported`); 25801 } 25802 } catch (e) { 25803 (0, _util.warn)(e); 25804 this.fallbackToSystemFont(properties); 25805 return; 25806 } 25807 25808 amendFallbackToUnicode(properties); 25809 this.data = data; 25810 this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont); 25811 this.fontMatrix = properties.fontMatrix; 25812 this.widths = properties.widths; 25813 this.defaultWidth = properties.defaultWidth; 25814 this.toUnicode = properties.toUnicode; 25815 this.seacMap = properties.seacMap; 25816 } 25817 25818 get renderer() { 25819 const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED); 25820 25821 return (0, _util.shadow)(this, "renderer", renderer); 25822 } 25823 25824 exportData(extraProperties = false) { 25825 const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES; 25826 const data = Object.create(null); 25827 let property, value; 25828 25829 for (property of exportDataProperties) { 25830 value = this[property]; 25831 25832 if (value !== undefined) { 25833 data[property] = value; 25834 } 25835 } 25836 25837 return data; 25838 } 25839 25840 fallbackToSystemFont(properties) { 25841 this.missingFile = true; 25842 const name = this.name; 25843 const type = this.type; 25844 const subtype = this.subtype; 25845 let fontName = (0, _fonts_utils.normalizeFontName)(name); 25846 const stdFontMap = (0, _standard_fonts.getStdFontMap)(), 25847 nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)(); 25848 const isStandardFont = !!stdFontMap[fontName]; 25849 const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]); 25850 fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; 25851 const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)(); 25852 const metrics = fontBasicMetricsMap[fontName]; 25853 25854 if (metrics) { 25855 if (isNaN(this.ascent)) { 25856 this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS; 25857 } 25858 25859 if (isNaN(this.descent)) { 25860 this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS; 25861 } 25862 25863 if (isNaN(this.capHeight)) { 25864 this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS; 25865 } 25866 } 25867 25868 this.bold = fontName.search(/bold/gi) !== -1; 25869 this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1; 25870 this.black = name.search(/Black/g) !== -1; 25871 const isNarrow = name.search(/Narrow/g) !== -1; 25872 this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0; 25873 25874 if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) { 25875 const cidToGidMap = properties.cidToGidMap; 25876 const map = []; 25877 applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)()); 25878 25879 if (/Arial-?Black/i.test(name)) { 25880 applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)()); 25881 } else if (/Calibri/i.test(name)) { 25882 applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)()); 25883 } 25884 25885 if (cidToGidMap) { 25886 for (const charCode in map) { 25887 const cid = map[charCode]; 25888 25889 if (cidToGidMap[cid] !== undefined) { 25890 map[+charCode] = cidToGidMap[cid]; 25891 } 25892 } 25893 25894 if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 25895 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 25896 const cid = map[charCode]; 25897 25898 if (cidToGidMap[cid] === undefined) { 25899 map[+charCode] = unicodeCharCode; 25900 } 25901 }); 25902 } 25903 } 25904 25905 if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) { 25906 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 25907 map[+charCode] = unicodeCharCode; 25908 }); 25909 } 25910 25911 this.toFontChar = map; 25912 this.toUnicode = new _to_unicode_map.ToUnicodeMap(map); 25913 } else if (/Symbol/i.test(fontName)) { 25914 this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences); 25915 } else if (/Dingbats/i.test(fontName)) { 25916 if (/Wingdings/i.test(name)) { 25917 (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats."); 25918 } 25919 25920 this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences); 25921 } else if (isStandardFont) { 25922 const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences); 25923 25924 if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) { 25925 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 25926 map[+charCode] = unicodeCharCode; 25927 }); 25928 } 25929 25930 this.toFontChar = map; 25931 } else { 25932 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 25933 const map = []; 25934 this.toUnicode.forEach((charCode, unicodeCharCode) => { 25935 if (!this.composite) { 25936 const glyphName = this.differences[charCode] || this.defaultEncoding[charCode]; 25937 const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 25938 25939 if (unicode !== -1) { 25940 unicodeCharCode = unicode; 25941 } 25942 } 25943 25944 map[+charCode] = unicodeCharCode; 25945 }); 25946 25947 if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 25948 if (/Verdana/i.test(name)) { 25949 applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)()); 25950 } 25951 } 25952 25953 this.toFontChar = map; 25954 } 25955 25956 amendFallbackToUnicode(properties); 25957 this.loadedName = fontName.split("-")[0]; 25958 this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont); 25959 } 25960 25961 checkAndRepair(name, font, properties) { 25962 const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "]; 25963 25964 function readTables(file, numTables) { 25965 const tables = Object.create(null); 25966 tables["OS/2"] = null; 25967 tables.cmap = null; 25968 tables.head = null; 25969 tables.hhea = null; 25970 tables.hmtx = null; 25971 tables.maxp = null; 25972 tables.name = null; 25973 tables.post = null; 25974 25975 for (let i = 0; i < numTables; i++) { 25976 const table = readTableEntry(file); 25977 25978 if (!VALID_TABLES.includes(table.tag)) { 25979 continue; 25980 } 25981 25982 if (table.length === 0) { 25983 continue; 25984 } 25985 25986 tables[table.tag] = table; 25987 } 25988 25989 return tables; 25990 } 25991 25992 function readTableEntry(file) { 25993 const tag = file.getString(4); 25994 const checksum = file.getInt32() >>> 0; 25995 const offset = file.getInt32() >>> 0; 25996 const length = file.getInt32() >>> 0; 25997 const previousPosition = file.pos; 25998 file.pos = file.start || 0; 25999 file.skip(offset); 26000 const data = file.getBytes(length); 26001 file.pos = previousPosition; 26002 26003 if (tag === "head") { 26004 data[8] = data[9] = data[10] = data[11] = 0; 26005 data[17] |= 0x20; 26006 } 26007 26008 return { 26009 tag, 26010 checksum, 26011 length, 26012 offset, 26013 data 26014 }; 26015 } 26016 26017 function readOpenTypeHeader(ttf) { 26018 return { 26019 version: ttf.getString(4), 26020 numTables: ttf.getUint16(), 26021 searchRange: ttf.getUint16(), 26022 entrySelector: ttf.getUint16(), 26023 rangeShift: ttf.getUint16() 26024 }; 26025 } 26026 26027 function readTrueTypeCollectionHeader(ttc) { 26028 const ttcTag = ttc.getString(4); 26029 (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font."); 26030 const majorVersion = ttc.getUint16(); 26031 const minorVersion = ttc.getUint16(); 26032 const numFonts = ttc.getInt32() >>> 0; 26033 const offsetTable = []; 26034 26035 for (let i = 0; i < numFonts; i++) { 26036 offsetTable.push(ttc.getInt32() >>> 0); 26037 } 26038 26039 const header = { 26040 ttcTag, 26041 majorVersion, 26042 minorVersion, 26043 numFonts, 26044 offsetTable 26045 }; 26046 26047 switch (majorVersion) { 26048 case 1: 26049 return header; 26050 26051 case 2: 26052 header.dsigTag = ttc.getInt32() >>> 0; 26053 header.dsigLength = ttc.getInt32() >>> 0; 26054 header.dsigOffset = ttc.getInt32() >>> 0; 26055 return header; 26056 } 26057 26058 throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`); 26059 } 26060 26061 function readTrueTypeCollectionData(ttc, fontName) { 26062 const { 26063 numFonts, 26064 offsetTable 26065 } = readTrueTypeCollectionHeader(ttc); 26066 const fontNameParts = fontName.split("+"); 26067 let fallbackData; 26068 26069 for (let i = 0; i < numFonts; i++) { 26070 ttc.pos = (ttc.start || 0) + offsetTable[i]; 26071 const potentialHeader = readOpenTypeHeader(ttc); 26072 const potentialTables = readTables(ttc, potentialHeader.numTables); 26073 26074 if (!potentialTables.name) { 26075 throw new _util.FormatError('TrueType Collection font must contain a "name" table.'); 26076 } 26077 26078 const nameTable = readNameTable(potentialTables.name); 26079 26080 for (let j = 0, jj = nameTable.length; j < jj; j++) { 26081 for (let k = 0, kk = nameTable[j].length; k < kk; k++) { 26082 const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, ""); 26083 26084 if (!nameEntry) { 26085 continue; 26086 } 26087 26088 if (nameEntry === fontName) { 26089 return { 26090 header: potentialHeader, 26091 tables: potentialTables 26092 }; 26093 } 26094 26095 if (fontNameParts.length < 2) { 26096 continue; 26097 } 26098 26099 for (const part of fontNameParts) { 26100 if (nameEntry === part) { 26101 fallbackData = { 26102 name: part, 26103 header: potentialHeader, 26104 tables: potentialTables 26105 }; 26106 } 26107 } 26108 } 26109 } 26110 } 26111 26112 if (fallbackData) { 26113 (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`); 26114 return { 26115 header: fallbackData.header, 26116 tables: fallbackData.tables 26117 }; 26118 } 26119 26120 throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`); 26121 } 26122 26123 function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) { 26124 if (!cmap) { 26125 (0, _util.warn)("No cmap table available."); 26126 return { 26127 platformId: -1, 26128 encodingId: -1, 26129 mappings: [], 26130 hasShortCmap: false 26131 }; 26132 } 26133 26134 let segment; 26135 let start = (file.start || 0) + cmap.offset; 26136 file.pos = start; 26137 file.skip(2); 26138 const numTables = file.getUint16(); 26139 let potentialTable; 26140 let canBreak = false; 26141 26142 for (let i = 0; i < numTables; i++) { 26143 const platformId = file.getUint16(); 26144 const encodingId = file.getUint16(); 26145 const offset = file.getInt32() >>> 0; 26146 let useTable = false; 26147 26148 if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) { 26149 continue; 26150 } 26151 26152 if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) { 26153 useTable = true; 26154 } else if (platformId === 1 && encodingId === 0) { 26155 useTable = true; 26156 } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) { 26157 useTable = true; 26158 26159 if (!isSymbolicFont) { 26160 canBreak = true; 26161 } 26162 } else if (isSymbolicFont && platformId === 3 && encodingId === 0) { 26163 useTable = true; 26164 let correctlySorted = true; 26165 26166 if (i < numTables - 1) { 26167 const nextBytes = file.peekBytes(2), 26168 nextPlatformId = int16(nextBytes[0], nextBytes[1]); 26169 26170 if (nextPlatformId < platformId) { 26171 correctlySorted = false; 26172 } 26173 } 26174 26175 if (correctlySorted) { 26176 canBreak = true; 26177 } 26178 } 26179 26180 if (useTable) { 26181 potentialTable = { 26182 platformId, 26183 encodingId, 26184 offset 26185 }; 26186 } 26187 26188 if (canBreak) { 26189 break; 26190 } 26191 } 26192 26193 if (potentialTable) { 26194 file.pos = start + potentialTable.offset; 26195 } 26196 26197 if (!potentialTable || file.peekByte() === -1) { 26198 (0, _util.warn)("Could not find a preferred cmap table."); 26199 return { 26200 platformId: -1, 26201 encodingId: -1, 26202 mappings: [], 26203 hasShortCmap: false 26204 }; 26205 } 26206 26207 const format = file.getUint16(); 26208 let hasShortCmap = false; 26209 const mappings = []; 26210 let j, glyphId; 26211 26212 if (format === 0) { 26213 file.skip(2 + 2); 26214 26215 for (j = 0; j < 256; j++) { 26216 const index = file.getByte(); 26217 26218 if (!index) { 26219 continue; 26220 } 26221 26222 mappings.push({ 26223 charCode: j, 26224 glyphId: index 26225 }); 26226 } 26227 26228 hasShortCmap = true; 26229 } else if (format === 2) { 26230 file.skip(2 + 2); 26231 const subHeaderKeys = []; 26232 let maxSubHeaderKey = 0; 26233 26234 for (let i = 0; i < 256; i++) { 26235 const subHeaderKey = file.getUint16() >> 3; 26236 subHeaderKeys.push(subHeaderKey); 26237 maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey); 26238 } 26239 26240 const subHeaders = []; 26241 26242 for (let i = 0; i <= maxSubHeaderKey; i++) { 26243 subHeaders.push({ 26244 firstCode: file.getUint16(), 26245 entryCount: file.getUint16(), 26246 idDelta: signedInt16(file.getByte(), file.getByte()), 26247 idRangePos: file.pos + file.getUint16() 26248 }); 26249 } 26250 26251 for (let i = 0; i < 256; i++) { 26252 if (subHeaderKeys[i] === 0) { 26253 file.pos = subHeaders[0].idRangePos + 2 * i; 26254 glyphId = file.getUint16(); 26255 mappings.push({ 26256 charCode: i, 26257 glyphId 26258 }); 26259 } else { 26260 const s = subHeaders[subHeaderKeys[i]]; 26261 26262 for (j = 0; j < s.entryCount; j++) { 26263 const charCode = (i << 8) + j + s.firstCode; 26264 file.pos = s.idRangePos + 2 * j; 26265 glyphId = file.getUint16(); 26266 26267 if (glyphId !== 0) { 26268 glyphId = (glyphId + s.idDelta) % 65536; 26269 } 26270 26271 mappings.push({ 26272 charCode, 26273 glyphId 26274 }); 26275 } 26276 } 26277 } 26278 } else if (format === 4) { 26279 file.skip(2 + 2); 26280 const segCount = file.getUint16() >> 1; 26281 file.skip(6); 26282 const segments = []; 26283 let segIndex; 26284 26285 for (segIndex = 0; segIndex < segCount; segIndex++) { 26286 segments.push({ 26287 end: file.getUint16() 26288 }); 26289 } 26290 26291 file.skip(2); 26292 26293 for (segIndex = 0; segIndex < segCount; segIndex++) { 26294 segments[segIndex].start = file.getUint16(); 26295 } 26296 26297 for (segIndex = 0; segIndex < segCount; segIndex++) { 26298 segments[segIndex].delta = file.getUint16(); 26299 } 26300 26301 let offsetsCount = 0, 26302 offsetIndex; 26303 26304 for (segIndex = 0; segIndex < segCount; segIndex++) { 26305 segment = segments[segIndex]; 26306 const rangeOffset = file.getUint16(); 26307 26308 if (!rangeOffset) { 26309 segment.offsetIndex = -1; 26310 continue; 26311 } 26312 26313 offsetIndex = (rangeOffset >> 1) - (segCount - segIndex); 26314 segment.offsetIndex = offsetIndex; 26315 offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1); 26316 } 26317 26318 const offsets = []; 26319 26320 for (j = 0; j < offsetsCount; j++) { 26321 offsets.push(file.getUint16()); 26322 } 26323 26324 for (segIndex = 0; segIndex < segCount; segIndex++) { 26325 segment = segments[segIndex]; 26326 start = segment.start; 26327 const end = segment.end; 26328 const delta = segment.delta; 26329 offsetIndex = segment.offsetIndex; 26330 26331 for (j = start; j <= end; j++) { 26332 if (j === 0xffff) { 26333 continue; 26334 } 26335 26336 glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start]; 26337 glyphId = glyphId + delta & 0xffff; 26338 mappings.push({ 26339 charCode: j, 26340 glyphId 26341 }); 26342 } 26343 } 26344 } else if (format === 6) { 26345 file.skip(2 + 2); 26346 const firstCode = file.getUint16(); 26347 const entryCount = file.getUint16(); 26348 26349 for (j = 0; j < entryCount; j++) { 26350 glyphId = file.getUint16(); 26351 const charCode = firstCode + j; 26352 mappings.push({ 26353 charCode, 26354 glyphId 26355 }); 26356 } 26357 } else if (format === 12) { 26358 file.skip(2 + 4 + 4); 26359 const nGroups = file.getInt32() >>> 0; 26360 26361 for (j = 0; j < nGroups; j++) { 26362 const startCharCode = file.getInt32() >>> 0; 26363 const endCharCode = file.getInt32() >>> 0; 26364 let glyphCode = file.getInt32() >>> 0; 26365 26366 for (let charCode = startCharCode; charCode <= endCharCode; charCode++) { 26367 mappings.push({ 26368 charCode, 26369 glyphId: glyphCode++ 26370 }); 26371 } 26372 } 26373 } else { 26374 (0, _util.warn)("cmap table has unsupported format: " + format); 26375 return { 26376 platformId: -1, 26377 encodingId: -1, 26378 mappings: [], 26379 hasShortCmap: false 26380 }; 26381 } 26382 26383 mappings.sort(function (a, b) { 26384 return a.charCode - b.charCode; 26385 }); 26386 26387 for (let i = 1; i < mappings.length; i++) { 26388 if (mappings[i - 1].charCode === mappings[i].charCode) { 26389 mappings.splice(i, 1); 26390 i--; 26391 } 26392 } 26393 26394 return { 26395 platformId: potentialTable.platformId, 26396 encodingId: potentialTable.encodingId, 26397 mappings, 26398 hasShortCmap 26399 }; 26400 } 26401 26402 function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) { 26403 if (!header) { 26404 if (metrics) { 26405 metrics.data = null; 26406 } 26407 26408 return; 26409 } 26410 26411 file.pos = (file.start || 0) + header.offset; 26412 file.pos += 4; 26413 file.pos += 2; 26414 file.pos += 2; 26415 file.pos += 2; 26416 file.pos += 2; 26417 file.pos += 2; 26418 file.pos += 2; 26419 file.pos += 2; 26420 file.pos += 2; 26421 file.pos += 2; 26422 const caretOffset = file.getUint16(); 26423 file.pos += 8; 26424 file.pos += 2; 26425 let numOfMetrics = file.getUint16(); 26426 26427 if (caretOffset !== 0) { 26428 const macStyle = int16(headTable.data[44], headTable.data[45]); 26429 26430 if (!(macStyle & 2)) { 26431 header.data[22] = 0; 26432 header.data[23] = 0; 26433 } 26434 } 26435 26436 if (numOfMetrics > numGlyphs) { 26437 (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`); 26438 numOfMetrics = numGlyphs; 26439 header.data[34] = (numOfMetrics & 0xff00) >> 8; 26440 header.data[35] = numOfMetrics & 0x00ff; 26441 } 26442 26443 const numOfSidebearings = numGlyphs - numOfMetrics; 26444 const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1); 26445 26446 if (numMissing > 0) { 26447 const entries = new Uint8Array(metrics.length + numMissing * 2); 26448 entries.set(metrics.data); 26449 26450 if (dupFirstEntry) { 26451 entries[metrics.length] = metrics.data[2]; 26452 entries[metrics.length + 1] = metrics.data[3]; 26453 } 26454 26455 metrics.data = entries; 26456 } 26457 } 26458 26459 function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) { 26460 const glyphProfile = { 26461 length: 0, 26462 sizeOfInstructions: 0 26463 }; 26464 26465 if (sourceEnd - sourceStart <= 12) { 26466 return glyphProfile; 26467 } 26468 26469 const glyf = source.subarray(sourceStart, sourceEnd); 26470 let contoursCount = signedInt16(glyf[0], glyf[1]); 26471 26472 if (contoursCount < 0) { 26473 contoursCount = -1; 26474 writeSignedInt16(glyf, 0, contoursCount); 26475 dest.set(glyf, destStart); 26476 glyphProfile.length = glyf.length; 26477 return glyphProfile; 26478 } 26479 26480 let i, 26481 j = 10, 26482 flagsCount = 0; 26483 26484 for (i = 0; i < contoursCount; i++) { 26485 const endPoint = glyf[j] << 8 | glyf[j + 1]; 26486 flagsCount = endPoint + 1; 26487 j += 2; 26488 } 26489 26490 const instructionsStart = j; 26491 const instructionsLength = glyf[j] << 8 | glyf[j + 1]; 26492 glyphProfile.sizeOfInstructions = instructionsLength; 26493 j += 2 + instructionsLength; 26494 const instructionsEnd = j; 26495 let coordinatesLength = 0; 26496 26497 for (i = 0; i < flagsCount; i++) { 26498 const flag = glyf[j++]; 26499 26500 if (flag & 0xc0) { 26501 glyf[j - 1] = flag & 0x3f; 26502 } 26503 26504 let xLength = 2; 26505 26506 if (flag & 2) { 26507 xLength = 1; 26508 } else if (flag & 16) { 26509 xLength = 0; 26510 } 26511 26512 let yLength = 2; 26513 26514 if (flag & 4) { 26515 yLength = 1; 26516 } else if (flag & 32) { 26517 yLength = 0; 26518 } 26519 26520 const xyLength = xLength + yLength; 26521 coordinatesLength += xyLength; 26522 26523 if (flag & 8) { 26524 const repeat = glyf[j++]; 26525 i += repeat; 26526 coordinatesLength += repeat * xyLength; 26527 } 26528 } 26529 26530 if (coordinatesLength === 0) { 26531 return glyphProfile; 26532 } 26533 26534 let glyphDataLength = j + coordinatesLength; 26535 26536 if (glyphDataLength > glyf.length) { 26537 return glyphProfile; 26538 } 26539 26540 if (!hintsValid && instructionsLength > 0) { 26541 dest.set(glyf.subarray(0, instructionsStart), destStart); 26542 dest.set([0, 0], destStart + instructionsStart); 26543 dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2); 26544 glyphDataLength -= instructionsLength; 26545 26546 if (glyf.length - glyphDataLength > 3) { 26547 glyphDataLength = glyphDataLength + 3 & ~3; 26548 } 26549 26550 glyphProfile.length = glyphDataLength; 26551 return glyphProfile; 26552 } 26553 26554 if (glyf.length - glyphDataLength > 3) { 26555 glyphDataLength = glyphDataLength + 3 & ~3; 26556 dest.set(glyf.subarray(0, glyphDataLength), destStart); 26557 glyphProfile.length = glyphDataLength; 26558 return glyphProfile; 26559 } 26560 26561 dest.set(glyf, destStart); 26562 glyphProfile.length = glyf.length; 26563 return glyphProfile; 26564 } 26565 26566 function sanitizeHead(head, numGlyphs, locaLength) { 26567 const data = head.data; 26568 const version = int32(data[0], data[1], data[2], data[3]); 26569 26570 if (version >> 16 !== 1) { 26571 (0, _util.info)("Attempting to fix invalid version in head table: " + version); 26572 data[0] = 0; 26573 data[1] = 1; 26574 data[2] = 0; 26575 data[3] = 0; 26576 } 26577 26578 const indexToLocFormat = int16(data[50], data[51]); 26579 26580 if (indexToLocFormat < 0 || indexToLocFormat > 1) { 26581 (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat); 26582 const numGlyphsPlusOne = numGlyphs + 1; 26583 26584 if (locaLength === numGlyphsPlusOne << 1) { 26585 data[50] = 0; 26586 data[51] = 0; 26587 } else if (locaLength === numGlyphsPlusOne << 2) { 26588 data[50] = 0; 26589 data[51] = 1; 26590 } else { 26591 throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat); 26592 } 26593 } 26594 } 26595 26596 function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) { 26597 let itemSize, itemDecode, itemEncode; 26598 26599 if (isGlyphLocationsLong) { 26600 itemSize = 4; 26601 26602 itemDecode = function fontItemDecodeLong(data, offset) { 26603 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 26604 }; 26605 26606 itemEncode = function fontItemEncodeLong(data, offset, value) { 26607 data[offset] = value >>> 24 & 0xff; 26608 data[offset + 1] = value >> 16 & 0xff; 26609 data[offset + 2] = value >> 8 & 0xff; 26610 data[offset + 3] = value & 0xff; 26611 }; 26612 } else { 26613 itemSize = 2; 26614 26615 itemDecode = function fontItemDecode(data, offset) { 26616 return data[offset] << 9 | data[offset + 1] << 1; 26617 }; 26618 26619 itemEncode = function fontItemEncode(data, offset, value) { 26620 data[offset] = value >> 9 & 0xff; 26621 data[offset + 1] = value >> 1 & 0xff; 26622 }; 26623 } 26624 26625 const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs; 26626 const locaDataSize = itemSize * (1 + numGlyphsOut); 26627 const locaData = new Uint8Array(locaDataSize); 26628 locaData.set(loca.data.subarray(0, locaDataSize)); 26629 loca.data = locaData; 26630 const oldGlyfData = glyf.data; 26631 const oldGlyfDataLength = oldGlyfData.length; 26632 const newGlyfData = new Uint8Array(oldGlyfDataLength); 26633 let i, j; 26634 const locaEntries = []; 26635 26636 for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) { 26637 let offset = itemDecode(locaData, j); 26638 26639 if (offset > oldGlyfDataLength) { 26640 offset = oldGlyfDataLength; 26641 } 26642 26643 locaEntries.push({ 26644 index: i, 26645 offset, 26646 endOffset: 0 26647 }); 26648 } 26649 26650 locaEntries.sort((a, b) => { 26651 return a.offset - b.offset; 26652 }); 26653 26654 for (i = 0; i < numGlyphs; i++) { 26655 locaEntries[i].endOffset = locaEntries[i + 1].offset; 26656 } 26657 26658 locaEntries.sort((a, b) => { 26659 return a.index - b.index; 26660 }); 26661 26662 for (i = 0; i < numGlyphs; i++) { 26663 const { 26664 offset, 26665 endOffset 26666 } = locaEntries[i]; 26667 26668 if (offset !== 0 || endOffset !== 0) { 26669 break; 26670 } 26671 26672 const nextOffset = locaEntries[i + 1].offset; 26673 26674 if (nextOffset === 0) { 26675 continue; 26676 } 26677 26678 locaEntries[i].endOffset = nextOffset; 26679 break; 26680 } 26681 26682 const missingGlyphs = Object.create(null); 26683 let writeOffset = 0; 26684 itemEncode(locaData, 0, writeOffset); 26685 26686 for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) { 26687 const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid); 26688 const newLength = glyphProfile.length; 26689 26690 if (newLength === 0) { 26691 missingGlyphs[i] = true; 26692 } 26693 26694 if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) { 26695 maxSizeOfInstructions = glyphProfile.sizeOfInstructions; 26696 } 26697 26698 writeOffset += newLength; 26699 itemEncode(locaData, j, writeOffset); 26700 } 26701 26702 if (writeOffset === 0) { 26703 const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]); 26704 26705 for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) { 26706 itemEncode(locaData, j, simpleGlyph.length); 26707 } 26708 26709 glyf.data = simpleGlyph; 26710 } else if (dupFirstEntry) { 26711 const firstEntryLength = itemDecode(locaData, itemSize); 26712 26713 if (newGlyfData.length > firstEntryLength + writeOffset) { 26714 glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset); 26715 } else { 26716 glyf.data = new Uint8Array(firstEntryLength + writeOffset); 26717 glyf.data.set(newGlyfData.subarray(0, writeOffset)); 26718 } 26719 26720 glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset); 26721 itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength); 26722 } else { 26723 glyf.data = newGlyfData.subarray(0, writeOffset); 26724 } 26725 26726 return { 26727 missingGlyphs, 26728 maxSizeOfInstructions 26729 }; 26730 } 26731 26732 function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) { 26733 const start = (font.start || 0) + post.offset; 26734 font.pos = start; 26735 const length = post.length, 26736 end = start + length; 26737 const version = font.getInt32(); 26738 font.skip(28); 26739 let glyphNames; 26740 let valid = true; 26741 let i; 26742 26743 switch (version) { 26744 case 0x00010000: 26745 glyphNames = _fonts_utils.MacStandardGlyphOrdering; 26746 break; 26747 26748 case 0x00020000: 26749 const numGlyphs = font.getUint16(); 26750 26751 if (numGlyphs !== maxpNumGlyphs) { 26752 valid = false; 26753 break; 26754 } 26755 26756 const glyphNameIndexes = []; 26757 26758 for (i = 0; i < numGlyphs; ++i) { 26759 const index = font.getUint16(); 26760 26761 if (index >= 32768) { 26762 valid = false; 26763 break; 26764 } 26765 26766 glyphNameIndexes.push(index); 26767 } 26768 26769 if (!valid) { 26770 break; 26771 } 26772 26773 const customNames = [], 26774 strBuf = []; 26775 26776 while (font.pos < end) { 26777 const stringLength = font.getByte(); 26778 strBuf.length = stringLength; 26779 26780 for (i = 0; i < stringLength; ++i) { 26781 strBuf[i] = String.fromCharCode(font.getByte()); 26782 } 26783 26784 customNames.push(strBuf.join("")); 26785 } 26786 26787 glyphNames = []; 26788 26789 for (i = 0; i < numGlyphs; ++i) { 26790 const j = glyphNameIndexes[i]; 26791 26792 if (j < 258) { 26793 glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]); 26794 continue; 26795 } 26796 26797 glyphNames.push(customNames[j - 258]); 26798 } 26799 26800 break; 26801 26802 case 0x00030000: 26803 break; 26804 26805 default: 26806 (0, _util.warn)("Unknown/unsupported post table version " + version); 26807 valid = false; 26808 26809 if (propertiesObj.defaultEncoding) { 26810 glyphNames = propertiesObj.defaultEncoding; 26811 } 26812 26813 break; 26814 } 26815 26816 propertiesObj.glyphNames = glyphNames; 26817 return valid; 26818 } 26819 26820 function readNameTable(nameTable) { 26821 const start = (font.start || 0) + nameTable.offset; 26822 font.pos = start; 26823 const names = [[], []]; 26824 const length = nameTable.length, 26825 end = start + length; 26826 const format = font.getUint16(); 26827 const FORMAT_0_HEADER_LENGTH = 6; 26828 26829 if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) { 26830 return names; 26831 } 26832 26833 const numRecords = font.getUint16(); 26834 const stringsStart = font.getUint16(); 26835 const records = []; 26836 const NAME_RECORD_LENGTH = 12; 26837 let i, ii; 26838 26839 for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) { 26840 const r = { 26841 platform: font.getUint16(), 26842 encoding: font.getUint16(), 26843 language: font.getUint16(), 26844 name: font.getUint16(), 26845 length: font.getUint16(), 26846 offset: font.getUint16() 26847 }; 26848 26849 if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) { 26850 records.push(r); 26851 } 26852 } 26853 26854 for (i = 0, ii = records.length; i < ii; i++) { 26855 const record = records[i]; 26856 26857 if (record.length <= 0) { 26858 continue; 26859 } 26860 26861 const pos = start + stringsStart + record.offset; 26862 26863 if (pos + record.length > end) { 26864 continue; 26865 } 26866 26867 font.pos = pos; 26868 const nameIndex = record.name; 26869 26870 if (record.encoding) { 26871 let str = ""; 26872 26873 for (let j = 0, jj = record.length; j < jj; j += 2) { 26874 str += String.fromCharCode(font.getUint16()); 26875 } 26876 26877 names[1][nameIndex] = str; 26878 } else { 26879 names[0][nameIndex] = font.getString(record.length); 26880 } 26881 } 26882 26883 return names; 26884 } 26885 26886 const TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2]; 26887 26888 function sanitizeTTProgram(table, ttContext) { 26889 let data = table.data; 26890 let i = 0, 26891 j, 26892 n, 26893 b, 26894 funcId, 26895 pc, 26896 lastEndf = 0, 26897 lastDeff = 0; 26898 const stack = []; 26899 const callstack = []; 26900 const functionsCalled = []; 26901 let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions; 26902 let inFDEF = false, 26903 ifLevel = 0, 26904 inELSE = 0; 26905 26906 for (let ii = data.length; i < ii;) { 26907 const op = data[i++]; 26908 26909 if (op === 0x40) { 26910 n = data[i++]; 26911 26912 if (inFDEF || inELSE) { 26913 i += n; 26914 } else { 26915 for (j = 0; j < n; j++) { 26916 stack.push(data[i++]); 26917 } 26918 } 26919 } else if (op === 0x41) { 26920 n = data[i++]; 26921 26922 if (inFDEF || inELSE) { 26923 i += n * 2; 26924 } else { 26925 for (j = 0; j < n; j++) { 26926 b = data[i++]; 26927 stack.push(b << 8 | data[i++]); 26928 } 26929 } 26930 } else if ((op & 0xf8) === 0xb0) { 26931 n = op - 0xb0 + 1; 26932 26933 if (inFDEF || inELSE) { 26934 i += n; 26935 } else { 26936 for (j = 0; j < n; j++) { 26937 stack.push(data[i++]); 26938 } 26939 } 26940 } else if ((op & 0xf8) === 0xb8) { 26941 n = op - 0xb8 + 1; 26942 26943 if (inFDEF || inELSE) { 26944 i += n * 2; 26945 } else { 26946 for (j = 0; j < n; j++) { 26947 b = data[i++]; 26948 stack.push(b << 8 | data[i++]); 26949 } 26950 } 26951 } else if (op === 0x2b && !tooComplexToFollowFunctions) { 26952 if (!inFDEF && !inELSE) { 26953 funcId = stack.at(-1); 26954 26955 if (isNaN(funcId)) { 26956 (0, _util.info)("TT: CALL empty stack (or invalid entry)."); 26957 } else { 26958 ttContext.functionsUsed[funcId] = true; 26959 26960 if (funcId in ttContext.functionsStackDeltas) { 26961 const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId]; 26962 26963 if (newStackLength < 0) { 26964 (0, _util.warn)("TT: CALL invalid functions stack delta."); 26965 ttContext.hintsValid = false; 26966 return; 26967 } 26968 26969 stack.length = newStackLength; 26970 } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) { 26971 callstack.push({ 26972 data, 26973 i, 26974 stackTop: stack.length - 1 26975 }); 26976 functionsCalled.push(funcId); 26977 pc = ttContext.functionsDefined[funcId]; 26978 26979 if (!pc) { 26980 (0, _util.warn)("TT: CALL non-existent function"); 26981 ttContext.hintsValid = false; 26982 return; 26983 } 26984 26985 data = pc.data; 26986 i = pc.i; 26987 } 26988 } 26989 } 26990 } else if (op === 0x2c && !tooComplexToFollowFunctions) { 26991 if (inFDEF || inELSE) { 26992 (0, _util.warn)("TT: nested FDEFs not allowed"); 26993 tooComplexToFollowFunctions = true; 26994 } 26995 26996 inFDEF = true; 26997 lastDeff = i; 26998 funcId = stack.pop(); 26999 ttContext.functionsDefined[funcId] = { 27000 data, 27001 i 27002 }; 27003 } else if (op === 0x2d) { 27004 if (inFDEF) { 27005 inFDEF = false; 27006 lastEndf = i; 27007 } else { 27008 pc = callstack.pop(); 27009 27010 if (!pc) { 27011 (0, _util.warn)("TT: ENDF bad stack"); 27012 ttContext.hintsValid = false; 27013 return; 27014 } 27015 27016 funcId = functionsCalled.pop(); 27017 data = pc.data; 27018 i = pc.i; 27019 ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop; 27020 } 27021 } else if (op === 0x89) { 27022 if (inFDEF || inELSE) { 27023 (0, _util.warn)("TT: nested IDEFs not allowed"); 27024 tooComplexToFollowFunctions = true; 27025 } 27026 27027 inFDEF = true; 27028 lastDeff = i; 27029 } else if (op === 0x58) { 27030 ++ifLevel; 27031 } else if (op === 0x1b) { 27032 inELSE = ifLevel; 27033 } else if (op === 0x59) { 27034 if (inELSE === ifLevel) { 27035 inELSE = 0; 27036 } 27037 27038 --ifLevel; 27039 } else if (op === 0x1c) { 27040 if (!inFDEF && !inELSE) { 27041 const offset = stack.at(-1); 27042 27043 if (offset > 0) { 27044 i += offset - 1; 27045 } 27046 } 27047 } 27048 27049 if (!inFDEF && !inELSE) { 27050 let stackDelta = 0; 27051 27052 if (op <= 0x8e) { 27053 stackDelta = TTOpsStackDeltas[op]; 27054 } else if (op >= 0xc0 && op <= 0xdf) { 27055 stackDelta = -1; 27056 } else if (op >= 0xe0) { 27057 stackDelta = -2; 27058 } 27059 27060 if (op >= 0x71 && op <= 0x75) { 27061 n = stack.pop(); 27062 27063 if (!isNaN(n)) { 27064 stackDelta = -n * 2; 27065 } 27066 } 27067 27068 while (stackDelta < 0 && stack.length > 0) { 27069 stack.pop(); 27070 stackDelta++; 27071 } 27072 27073 while (stackDelta > 0) { 27074 stack.push(NaN); 27075 stackDelta--; 27076 } 27077 } 27078 } 27079 27080 ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions; 27081 const content = [data]; 27082 27083 if (i > data.length) { 27084 content.push(new Uint8Array(i - data.length)); 27085 } 27086 27087 if (lastDeff > lastEndf) { 27088 (0, _util.warn)("TT: complementing a missing function tail"); 27089 content.push(new Uint8Array([0x22, 0x2d])); 27090 } 27091 27092 foldTTTable(table, content); 27093 } 27094 27095 function checkInvalidFunctions(ttContext, maxFunctionDefs) { 27096 if (ttContext.tooComplexToFollowFunctions) { 27097 return; 27098 } 27099 27100 if (ttContext.functionsDefined.length > maxFunctionDefs) { 27101 (0, _util.warn)("TT: more functions defined than expected"); 27102 ttContext.hintsValid = false; 27103 return; 27104 } 27105 27106 for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) { 27107 if (j > maxFunctionDefs) { 27108 (0, _util.warn)("TT: invalid function id: " + j); 27109 ttContext.hintsValid = false; 27110 return; 27111 } 27112 27113 if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) { 27114 (0, _util.warn)("TT: undefined function: " + j); 27115 ttContext.hintsValid = false; 27116 return; 27117 } 27118 } 27119 } 27120 27121 function foldTTTable(table, content) { 27122 if (content.length > 1) { 27123 let newLength = 0; 27124 let j, jj; 27125 27126 for (j = 0, jj = content.length; j < jj; j++) { 27127 newLength += content[j].length; 27128 } 27129 27130 newLength = newLength + 3 & ~3; 27131 const result = new Uint8Array(newLength); 27132 let pos = 0; 27133 27134 for (j = 0, jj = content.length; j < jj; j++) { 27135 result.set(content[j], pos); 27136 pos += content[j].length; 27137 } 27138 27139 table.data = result; 27140 table.length = newLength; 27141 } 27142 } 27143 27144 function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) { 27145 const ttContext = { 27146 functionsDefined: [], 27147 functionsUsed: [], 27148 functionsStackDeltas: [], 27149 tooComplexToFollowFunctions: false, 27150 hintsValid: true 27151 }; 27152 27153 if (fpgm) { 27154 sanitizeTTProgram(fpgm, ttContext); 27155 } 27156 27157 if (prep) { 27158 sanitizeTTProgram(prep, ttContext); 27159 } 27160 27161 if (fpgm) { 27162 checkInvalidFunctions(ttContext, maxFunctionDefs); 27163 } 27164 27165 if (cvt && cvt.length & 1) { 27166 const cvtData = new Uint8Array(cvt.length + 1); 27167 cvtData.set(cvt.data); 27168 cvt.data = cvtData; 27169 } 27170 27171 return ttContext.hintsValid; 27172 } 27173 27174 font = new _stream.Stream(new Uint8Array(font.getBytes())); 27175 let header, tables; 27176 27177 if (isTrueTypeCollectionFile(font)) { 27178 const ttcData = readTrueTypeCollectionData(font, this.name); 27179 header = ttcData.header; 27180 tables = ttcData.tables; 27181 } else { 27182 header = readOpenTypeHeader(font); 27183 tables = readTables(font, header.numTables); 27184 } 27185 27186 let cff, cffFile; 27187 const isTrueType = !tables["CFF "]; 27188 27189 if (!isTrueType) { 27190 const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap)); 27191 27192 if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) { 27193 cffFile = new _stream.Stream(tables["CFF "].data); 27194 cff = new _cff_font.CFFFont(cffFile, properties); 27195 adjustWidths(properties); 27196 return this.convert(name, cff, properties); 27197 } 27198 27199 delete tables.glyf; 27200 delete tables.loca; 27201 delete tables.fpgm; 27202 delete tables.prep; 27203 delete tables["cvt "]; 27204 this.isOpenType = true; 27205 } else { 27206 if (!tables.loca) { 27207 throw new _util.FormatError('Required "loca" table is not found'); 27208 } 27209 27210 if (!tables.glyf) { 27211 (0, _util.warn)('Required "glyf" table is not found -- trying to recover.'); 27212 tables.glyf = { 27213 tag: "glyf", 27214 data: new Uint8Array(0) 27215 }; 27216 } 27217 27218 this.isOpenType = false; 27219 } 27220 27221 if (!tables.maxp) { 27222 throw new _util.FormatError('Required "maxp" table is not found'); 27223 } 27224 27225 font.pos = (font.start || 0) + tables.maxp.offset; 27226 const version = font.getInt32(); 27227 const numGlyphs = font.getUint16(); 27228 27229 if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) { 27230 const { 27231 scaleFactors 27232 } = properties; 27233 const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]); 27234 const glyphs = new _glyf.GlyfTable({ 27235 glyfTable: tables.glyf.data, 27236 isGlyphLocationsLong, 27237 locaTable: tables.loca.data, 27238 numGlyphs 27239 }); 27240 glyphs.scale(scaleFactors); 27241 const { 27242 glyf, 27243 loca, 27244 isLocationLong 27245 } = glyphs.write(); 27246 tables.glyf.data = glyf; 27247 tables.loca.data = loca; 27248 27249 if (isLocationLong !== !!isGlyphLocationsLong) { 27250 tables.head.data[50] = 0; 27251 tables.head.data[51] = isLocationLong ? 1 : 0; 27252 } 27253 27254 const metrics = tables.hmtx.data; 27255 27256 for (let i = 0; i < numGlyphs; i++) { 27257 const j = 4 * i; 27258 const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1])); 27259 metrics[j] = advanceWidth >> 8 & 0xff; 27260 metrics[j + 1] = advanceWidth & 0xff; 27261 const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3])); 27262 writeSignedInt16(metrics, j + 2, lsb); 27263 } 27264 } 27265 27266 let numGlyphsOut = numGlyphs + 1; 27267 let dupFirstEntry = true; 27268 27269 if (numGlyphsOut > 0xffff) { 27270 dupFirstEntry = false; 27271 numGlyphsOut = numGlyphs; 27272 (0, _util.warn)("Not enough space in glyfs to duplicate first glyph."); 27273 } 27274 27275 let maxFunctionDefs = 0; 27276 let maxSizeOfInstructions = 0; 27277 27278 if (version >= 0x00010000 && tables.maxp.length >= 22) { 27279 font.pos += 8; 27280 const maxZones = font.getUint16(); 27281 27282 if (maxZones > 2) { 27283 tables.maxp.data[14] = 0; 27284 tables.maxp.data[15] = 2; 27285 } 27286 27287 font.pos += 4; 27288 maxFunctionDefs = font.getUint16(); 27289 font.pos += 4; 27290 maxSizeOfInstructions = font.getUint16(); 27291 } 27292 27293 tables.maxp.data[4] = numGlyphsOut >> 8; 27294 tables.maxp.data[5] = numGlyphsOut & 255; 27295 const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs); 27296 27297 if (!hintsValid) { 27298 delete tables.fpgm; 27299 delete tables.prep; 27300 delete tables["cvt "]; 27301 } 27302 27303 sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry); 27304 27305 if (!tables.head) { 27306 throw new _util.FormatError('Required "head" table is not found'); 27307 } 27308 27309 sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0); 27310 let missingGlyphs = Object.create(null); 27311 27312 if (isTrueType) { 27313 const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]); 27314 const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions); 27315 missingGlyphs = glyphsInfo.missingGlyphs; 27316 27317 if (version >= 0x00010000 && tables.maxp.length >= 22) { 27318 tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8; 27319 tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255; 27320 } 27321 } 27322 27323 if (!tables.hhea) { 27324 throw new _util.FormatError('Required "hhea" table is not found'); 27325 } 27326 27327 if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) { 27328 tables.hhea.data[10] = 0xff; 27329 tables.hhea.data[11] = 0xff; 27330 } 27331 27332 const metricsOverride = { 27333 unitsPerEm: int16(tables.head.data[18], tables.head.data[19]), 27334 yMax: int16(tables.head.data[42], tables.head.data[43]), 27335 yMin: signedInt16(tables.head.data[38], tables.head.data[39]), 27336 ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]), 27337 descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]), 27338 lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9]) 27339 }; 27340 this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm; 27341 this.descent = metricsOverride.descent / metricsOverride.unitsPerEm; 27342 this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm; 27343 27344 if (this.cssFontInfo && this.cssFontInfo.lineHeight) { 27345 this.lineHeight = this.cssFontInfo.metrics.lineHeight; 27346 this.lineGap = this.cssFontInfo.metrics.lineGap; 27347 } else { 27348 this.lineHeight = this.ascent - this.descent + this.lineGap; 27349 } 27350 27351 if (tables.post) { 27352 readPostScriptTable(tables.post, properties, numGlyphs); 27353 } 27354 27355 tables.post = { 27356 tag: "post", 27357 data: createPostTable(properties) 27358 }; 27359 const charCodeToGlyphId = []; 27360 27361 function hasGlyph(glyphId) { 27362 return !missingGlyphs[glyphId]; 27363 } 27364 27365 if (properties.composite) { 27366 const cidToGidMap = properties.cidToGidMap || []; 27367 const isCidToGidMapEmpty = cidToGidMap.length === 0; 27368 properties.cMap.forEach(function (charCode, cid) { 27369 if (typeof cid === "string") { 27370 cid = convertCidString(charCode, cid, true); 27371 } 27372 27373 if (cid > 0xffff) { 27374 throw new _util.FormatError("Max size of CID is 65,535"); 27375 } 27376 27377 let glyphId = -1; 27378 27379 if (isCidToGidMapEmpty) { 27380 glyphId = cid; 27381 } else if (cidToGidMap[cid] !== undefined) { 27382 glyphId = cidToGidMap[cid]; 27383 } 27384 27385 if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) { 27386 charCodeToGlyphId[charCode] = glyphId; 27387 } 27388 }); 27389 } else { 27390 const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding); 27391 const cmapPlatformId = cmapTable.platformId; 27392 const cmapEncodingId = cmapTable.encodingId; 27393 const cmapMappings = cmapTable.mappings; 27394 const cmapMappingsLength = cmapMappings.length; 27395 let baseEncoding = [], 27396 forcePostTable = false; 27397 27398 if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) { 27399 baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName); 27400 } 27401 27402 if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) { 27403 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 27404 27405 for (let charCode = 0; charCode < 256; charCode++) { 27406 let glyphName; 27407 27408 if (this.differences[charCode] !== undefined) { 27409 glyphName = this.differences[charCode]; 27410 } else if (baseEncoding.length && baseEncoding[charCode] !== "") { 27411 glyphName = baseEncoding[charCode]; 27412 } else { 27413 glyphName = _encodings.StandardEncoding[charCode]; 27414 } 27415 27416 if (!glyphName) { 27417 continue; 27418 } 27419 27420 const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap); 27421 let unicodeOrCharCode; 27422 27423 if (cmapPlatformId === 3 && cmapEncodingId === 1) { 27424 unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName]; 27425 } else if (cmapPlatformId === 1 && cmapEncodingId === 0) { 27426 unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName); 27427 } 27428 27429 if (unicodeOrCharCode === undefined) { 27430 if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) { 27431 const unicode = this.toUnicode.get(charCode); 27432 27433 if (unicode) { 27434 unicodeOrCharCode = unicode.codePointAt(0); 27435 } 27436 } 27437 27438 if (unicodeOrCharCode === undefined) { 27439 continue; 27440 } 27441 } 27442 27443 for (let i = 0; i < cmapMappingsLength; ++i) { 27444 if (cmapMappings[i].charCode !== unicodeOrCharCode) { 27445 continue; 27446 } 27447 27448 charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; 27449 break; 27450 } 27451 } 27452 } else if (cmapPlatformId === 0) { 27453 for (let i = 0; i < cmapMappingsLength; ++i) { 27454 charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId; 27455 } 27456 27457 forcePostTable = true; 27458 } else { 27459 for (let i = 0; i < cmapMappingsLength; ++i) { 27460 let charCode = cmapMappings[i].charCode; 27461 27462 if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) { 27463 charCode &= 0xff; 27464 } 27465 27466 charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; 27467 } 27468 } 27469 27470 if (properties.glyphNames && (baseEncoding.length || this.differences.length)) { 27471 for (let i = 0; i < 256; ++i) { 27472 if (!forcePostTable && charCodeToGlyphId[i] !== undefined) { 27473 continue; 27474 } 27475 27476 const glyphName = this.differences[i] || baseEncoding[i]; 27477 27478 if (!glyphName) { 27479 continue; 27480 } 27481 27482 const glyphId = properties.glyphNames.indexOf(glyphName); 27483 27484 if (glyphId > 0 && hasGlyph(glyphId)) { 27485 charCodeToGlyphId[i] = glyphId; 27486 } 27487 } 27488 } 27489 } 27490 27491 if (charCodeToGlyphId.length === 0) { 27492 charCodeToGlyphId[0] = 0; 27493 } 27494 27495 let glyphZeroId = numGlyphsOut - 1; 27496 27497 if (!dupFirstEntry) { 27498 glyphZeroId = 0; 27499 } 27500 27501 if (!properties.cssFontInfo) { 27502 const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode); 27503 this.toFontChar = newMapping.toFontChar; 27504 tables.cmap = { 27505 tag: "cmap", 27506 data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut) 27507 }; 27508 27509 if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) { 27510 tables["OS/2"] = { 27511 tag: "OS/2", 27512 data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride) 27513 }; 27514 } 27515 } 27516 27517 if (!isTrueType) { 27518 try { 27519 cffFile = new _stream.Stream(tables["CFF "].data); 27520 const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED); 27521 cff = parser.parse(); 27522 cff.duplicateFirstGlyph(); 27523 const compiler = new _cff_parser.CFFCompiler(cff); 27524 tables["CFF "].data = compiler.compile(); 27525 } catch (e) { 27526 (0, _util.warn)("Failed to compile font " + properties.loadedName); 27527 } 27528 } 27529 27530 if (!tables.name) { 27531 tables.name = { 27532 tag: "name", 27533 data: createNameTable(this.name) 27534 }; 27535 } else { 27536 const namePrototype = readNameTable(tables.name); 27537 tables.name.data = createNameTable(name, namePrototype); 27538 this.psName = namePrototype[0][6] || null; 27539 } 27540 27541 const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version); 27542 27543 for (const tableTag in tables) { 27544 builder.addTable(tableTag, tables[tableTag].data); 27545 } 27546 27547 return builder.toArray(); 27548 } 27549 27550 convert(fontName, font, properties) { 27551 properties.fixedPitch = false; 27552 27553 if (properties.builtInEncoding) { 27554 adjustToUnicode(properties, properties.builtInEncoding); 27555 } 27556 27557 let glyphZeroId = 1; 27558 27559 if (font instanceof _cff_font.CFFFont) { 27560 glyphZeroId = font.numGlyphs - 1; 27561 } 27562 27563 const mapping = font.getGlyphMapping(properties); 27564 let newMapping = null; 27565 let newCharCodeToGlyphId = mapping; 27566 let toUnicodeExtraMap = null; 27567 27568 if (!properties.cssFontInfo) { 27569 newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode); 27570 this.toFontChar = newMapping.toFontChar; 27571 newCharCodeToGlyphId = newMapping.charCodeToGlyphId; 27572 toUnicodeExtraMap = newMapping.toUnicodeExtraMap; 27573 } 27574 27575 const numGlyphs = font.numGlyphs; 27576 27577 function getCharCodes(charCodeToGlyphId, glyphId) { 27578 let charCodes = null; 27579 27580 for (const charCode in charCodeToGlyphId) { 27581 if (glyphId === charCodeToGlyphId[charCode]) { 27582 if (!charCodes) { 27583 charCodes = []; 27584 } 27585 27586 charCodes.push(charCode | 0); 27587 } 27588 } 27589 27590 return charCodes; 27591 } 27592 27593 function createCharCode(charCodeToGlyphId, glyphId) { 27594 for (const charCode in charCodeToGlyphId) { 27595 if (glyphId === charCodeToGlyphId[charCode]) { 27596 return charCode | 0; 27597 } 27598 } 27599 27600 newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId; 27601 return newMapping.nextAvailableFontCharCode++; 27602 } 27603 27604 const seacs = font.seacs; 27605 27606 if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) { 27607 const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX; 27608 const charset = font.getCharset(); 27609 const seacMap = Object.create(null); 27610 27611 for (let glyphId in seacs) { 27612 glyphId |= 0; 27613 const seac = seacs[glyphId]; 27614 const baseGlyphName = _encodings.StandardEncoding[seac[2]]; 27615 const accentGlyphName = _encodings.StandardEncoding[seac[3]]; 27616 const baseGlyphId = charset.indexOf(baseGlyphName); 27617 const accentGlyphId = charset.indexOf(accentGlyphName); 27618 27619 if (baseGlyphId < 0 || accentGlyphId < 0) { 27620 continue; 27621 } 27622 27623 const accentOffset = { 27624 x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4], 27625 y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5] 27626 }; 27627 const charCodes = getCharCodes(mapping, glyphId); 27628 27629 if (!charCodes) { 27630 continue; 27631 } 27632 27633 for (let i = 0, ii = charCodes.length; i < ii; i++) { 27634 const charCode = charCodes[i]; 27635 const charCodeToGlyphId = newMapping.charCodeToGlyphId; 27636 const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId); 27637 const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId); 27638 seacMap[charCode] = { 27639 baseFontCharCode, 27640 accentFontCharCode, 27641 accentOffset 27642 }; 27643 } 27644 } 27645 27646 properties.seacMap = seacMap; 27647 } 27648 27649 const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0]; 27650 const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F"); 27651 builder.addTable("CFF ", font.data); 27652 builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId)); 27653 builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs)); 27654 builder.addTable("head", "\x00\x01\x00\x00" + "\x00\x00\x10\x00" + "\x00\x00\x00\x00" + "\x5F\x0F\x3C\xF5" + "\x00\x00" + safeString16(unitsPerEm) + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00" + safeString16(properties.descent) + "\x0F\xFF" + safeString16(properties.ascent) + string16(properties.italicAngle ? 2 : 0) + "\x00\x11" + "\x00\x00" + "\x00\x00" + "\x00\x00"); 27655 builder.addTable("hhea", "\x00\x01\x00\x00" + safeString16(properties.ascent) + safeString16(properties.descent) + "\x00\x00" + "\xFF\xFF" + "\x00\x00" + "\x00\x00" + "\x00\x00" + safeString16(properties.capHeight) + safeString16(Math.tan(properties.italicAngle) * properties.xHeight) + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + string16(numGlyphs)); 27656 builder.addTable("hmtx", function fontFieldsHmtx() { 27657 const charstrings = font.charstrings; 27658 const cffWidths = font.cff ? font.cff.widths : null; 27659 let hmtx = "\x00\x00\x00\x00"; 27660 27661 for (let i = 1, ii = numGlyphs; i < ii; i++) { 27662 let width = 0; 27663 27664 if (charstrings) { 27665 const charstring = charstrings[i - 1]; 27666 width = "width" in charstring ? charstring.width : 0; 27667 } else if (cffWidths) { 27668 width = Math.ceil(cffWidths[i] || 0); 27669 } 27670 27671 hmtx += string16(width) + string16(0); 27672 } 27673 27674 return hmtx; 27675 }()); 27676 builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs)); 27677 builder.addTable("name", createNameTable(fontName)); 27678 builder.addTable("post", createPostTable(properties)); 27679 return builder.toArray(); 27680 } 27681 27682 get spaceWidth() { 27683 const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"]; 27684 let width; 27685 27686 for (let i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) { 27687 const glyphName = possibleSpaceReplacements[i]; 27688 27689 if (glyphName in this.widths) { 27690 width = this.widths[glyphName]; 27691 break; 27692 } 27693 27694 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 27695 const glyphUnicode = glyphsUnicodeMap[glyphName]; 27696 let charcode = 0; 27697 27698 if (this.composite && this.cMap.contains(glyphUnicode)) { 27699 charcode = this.cMap.lookup(glyphUnicode); 27700 27701 if (typeof charcode === "string") { 27702 charcode = convertCidString(glyphUnicode, charcode); 27703 } 27704 } 27705 27706 if (!charcode && this.toUnicode) { 27707 charcode = this.toUnicode.charCodeOf(glyphUnicode); 27708 } 27709 27710 if (charcode <= 0) { 27711 charcode = glyphUnicode; 27712 } 27713 27714 width = this.widths[charcode]; 27715 27716 if (width) { 27717 break; 27718 } 27719 } 27720 27721 width = width || this.defaultWidth; 27722 return (0, _util.shadow)(this, "spaceWidth", width); 27723 } 27724 27725 _charToGlyph(charcode, isSpace = false) { 27726 let fontCharCode, width, operatorListId; 27727 let widthCode = charcode; 27728 27729 if (this.cMap && this.cMap.contains(charcode)) { 27730 widthCode = this.cMap.lookup(charcode); 27731 27732 if (typeof widthCode === "string") { 27733 widthCode = convertCidString(charcode, widthCode); 27734 } 27735 } 27736 27737 width = this.widths[widthCode]; 27738 27739 if (typeof width !== "number") { 27740 width = this.defaultWidth; 27741 } 27742 27743 const vmetric = this.vmetrics && this.vmetrics[widthCode]; 27744 let unicode = this.toUnicode.get(charcode) || charcode; 27745 27746 if (typeof unicode === "number") { 27747 unicode = String.fromCharCode(unicode); 27748 } 27749 27750 let isInFont = this.toFontChar[charcode] !== undefined; 27751 fontCharCode = this.toFontChar[charcode] || charcode; 27752 27753 if (this.missingFile) { 27754 const glyphName = this.differences[charcode] || this.defaultEncoding[charcode]; 27755 27756 if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") { 27757 fontCharCode = 0x20; 27758 } 27759 27760 fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode); 27761 } 27762 27763 if (this.isType3Font) { 27764 operatorListId = fontCharCode; 27765 } 27766 27767 let accent = null; 27768 27769 if (this.seacMap && this.seacMap[charcode]) { 27770 isInFont = true; 27771 const seac = this.seacMap[charcode]; 27772 fontCharCode = seac.baseFontCharCode; 27773 accent = { 27774 fontChar: String.fromCodePoint(seac.accentFontCharCode), 27775 offset: seac.accentOffset 27776 }; 27777 } 27778 27779 let fontChar = ""; 27780 27781 if (typeof fontCharCode === "number") { 27782 if (fontCharCode <= 0x10ffff) { 27783 fontChar = String.fromCodePoint(fontCharCode); 27784 } else { 27785 (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`); 27786 } 27787 } 27788 27789 let glyph = this._glyphCache[charcode]; 27790 27791 if (!glyph || !glyph.matchesForCache(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) { 27792 glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont); 27793 this._glyphCache[charcode] = glyph; 27794 } 27795 27796 return glyph; 27797 } 27798 27799 charsToGlyphs(chars) { 27800 let glyphs = this._charsCache[chars]; 27801 27802 if (glyphs) { 27803 return glyphs; 27804 } 27805 27806 glyphs = []; 27807 27808 if (this.cMap) { 27809 const c = Object.create(null), 27810 ii = chars.length; 27811 let i = 0; 27812 27813 while (i < ii) { 27814 this.cMap.readCharCode(chars, i, c); 27815 const { 27816 charcode, 27817 length 27818 } = c; 27819 i += length; 27820 27821 const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20); 27822 27823 glyphs.push(glyph); 27824 } 27825 } else { 27826 for (let i = 0, ii = chars.length; i < ii; ++i) { 27827 const charcode = chars.charCodeAt(i); 27828 27829 const glyph = this._charToGlyph(charcode, charcode === 0x20); 27830 27831 glyphs.push(glyph); 27832 } 27833 } 27834 27835 return this._charsCache[chars] = glyphs; 27836 } 27837 27838 getCharPositions(chars) { 27839 const positions = []; 27840 27841 if (this.cMap) { 27842 const c = Object.create(null); 27843 let i = 0; 27844 27845 while (i < chars.length) { 27846 this.cMap.readCharCode(chars, i, c); 27847 const length = c.length; 27848 positions.push([i, i + length]); 27849 i += length; 27850 } 27851 } else { 27852 for (let i = 0, ii = chars.length; i < ii; ++i) { 27853 positions.push([i, i + 1]); 27854 } 27855 } 27856 27857 return positions; 27858 } 27859 27860 get glyphCacheValues() { 27861 return Object.values(this._glyphCache); 27862 } 27863 27864 encodeString(str) { 27865 const buffers = []; 27866 const currentBuf = []; 27867 27868 const hasCurrentBufErrors = () => buffers.length % 2 === 1; 27869 27870 const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode)); 27871 27872 for (let i = 0, ii = str.length; i < ii; i++) { 27873 const unicode = str.codePointAt(i); 27874 27875 if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) { 27876 i++; 27877 } 27878 27879 if (this.toUnicode) { 27880 const charCode = getCharCode(unicode); 27881 27882 if (charCode !== -1) { 27883 if (hasCurrentBufErrors()) { 27884 buffers.push(currentBuf.join("")); 27885 currentBuf.length = 0; 27886 } 27887 27888 const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1; 27889 27890 for (let j = charCodeLength - 1; j >= 0; j--) { 27891 currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff)); 27892 } 27893 27894 continue; 27895 } 27896 } 27897 27898 if (!hasCurrentBufErrors()) { 27899 buffers.push(currentBuf.join("")); 27900 currentBuf.length = 0; 27901 } 27902 27903 currentBuf.push(String.fromCodePoint(unicode)); 27904 } 27905 27906 buffers.push(currentBuf.join("")); 27907 return buffers; 27908 } 27909 27910} 27911 27912exports.Font = Font; 27913 27914class ErrorFont { 27915 constructor(error) { 27916 this.error = error; 27917 this.loadedName = "g_font_error"; 27918 this.missingFile = true; 27919 } 27920 27921 charsToGlyphs() { 27922 return []; 27923 } 27924 27925 encodeString(chars) { 27926 return [chars]; 27927 } 27928 27929 exportData(extraProperties = false) { 27930 return { 27931 error: this.error 27932 }; 27933 } 27934 27935} 27936 27937exports.ErrorFont = ErrorFont; 27938 27939/***/ }), 27940/* 35 */ 27941/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 27942 27943 27944 27945Object.defineProperty(exports, "__esModule", ({ 27946 value: true 27947})); 27948exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0; 27949 27950var _util = __w_pdfjs_require__(2); 27951 27952var _charsets = __w_pdfjs_require__(36); 27953 27954var _encodings = __w_pdfjs_require__(37); 27955 27956const MAX_SUBR_NESTING = 10; 27957const CFFStandardStrings = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodce
vendor: 8,303 bytes, lines 27957-28220
27957ntered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"]; 27958exports.CFFStandardStrings = CFFStandardStrings; 27959const NUM_STANDARD_CFF_STRINGS = 391; 27960const CharstringValidationData = [null, { 27961 id: "hstem", 27962 min: 2, 27963 stackClearing: true, 27964 stem: true 27965}, null, { 27966 id: "vstem", 27967 min: 2, 27968 stackClearing: true, 27969 stem: true 27970}, { 27971 id: "vmoveto", 27972 min: 1, 27973 stackClearing: true 27974}, { 27975 id: "rlineto", 27976 min: 2, 27977 resetStack: true 27978}, { 27979 id: "hlineto", 27980 min: 1, 27981 resetStack: true 27982}, { 27983 id: "vlineto", 27984 min: 1, 27985 resetStack: true 27986}, { 27987 id: "rrcurveto", 27988 min: 6, 27989 resetStack: true 27990}, null, { 27991 id: "callsubr", 27992 min: 1, 27993 undefStack: true 27994}, { 27995 id: "return", 27996 min: 0, 27997 undefStack: true 27998}, null, null, { 27999 id: "endchar", 28000 min: 0, 28001 stackClearing: true 28002}, null, null, null, { 28003 id: "hstemhm", 28004 min: 2, 28005 stackClearing: true, 28006 stem: true 28007}, { 28008 id: "hintmask", 28009 min: 0, 28010 stackClearing: true 28011}, { 28012 id: "cntrmask", 28013 min: 0, 28014 stackClearing: true 28015}, { 28016 id: "rmoveto", 28017 min: 2, 28018 stackClearing: true 28019}, { 28020 id: "hmoveto", 28021 min: 1, 28022 stackClearing: true 28023}, { 28024 id: "vstemhm", 28025 min: 2, 28026 stackClearing: true, 28027 stem: true 28028}, { 28029 id: "rcurveline", 28030 min: 8, 28031 resetStack: true 28032}, { 28033 id: "rlinecurve", 28034 min: 8, 28035 resetStack: true 28036}, { 28037 id: "vvcurveto", 28038 min: 4, 28039 resetStack: true 28040}, { 28041 id: "hhcurveto", 28042 min: 4, 28043 resetStack: true 28044}, null, { 28045 id: "callgsubr", 28046 min: 1, 28047 undefStack: true 28048}, { 28049 id: "vhcurveto", 28050 min: 4, 28051 resetStack: true 28052}, { 28053 id: "hvcurveto", 28054 min: 4, 28055 resetStack: true 28056}]; 28057const CharstringValidationData12 = [null, null, null, { 28058 id: "and", 28059 min: 2, 28060 stackDelta: -1 28061}, { 28062 id: "or", 28063 min: 2, 28064 stackDelta: -1 28065}, { 28066 id: "not", 28067 min: 1, 28068 stackDelta: 0 28069}, null, null, null, { 28070 id: "abs", 28071 min: 1, 28072 stackDelta: 0 28073}, { 28074 id: "add", 28075 min: 2, 28076 stackDelta: -1, 28077 28078 stackFn(stack, index) { 28079 stack[index - 2] = stack[index - 2] + stack[index - 1]; 28080 } 28081 28082}, { 28083 id: "sub", 28084 min: 2, 28085 stackDelta: -1, 28086 28087 stackFn(stack, index) { 28088 stack[index - 2] = stack[index - 2] - stack[index - 1]; 28089 } 28090 28091}, { 28092 id: "div", 28093 min: 2, 28094 stackDelta: -1, 28095 28096 stackFn(stack, index) { 28097 stack[index - 2] = stack[index - 2] / stack[index - 1]; 28098 } 28099 28100}, null, { 28101 id: "neg", 28102 min: 1, 28103 stackDelta: 0, 28104 28105 stackFn(stack, index) { 28106 stack[index - 1] = -stack[index - 1]; 28107 } 28108 28109}, { 28110 id: "eq", 28111 min: 2, 28112 stackDelta: -1 28113}, null, null, { 28114 id: "drop", 28115 min: 1, 28116 stackDelta: -1 28117}, null, { 28118 id: "put", 28119 min: 2, 28120 stackDelta: -2 28121}, { 28122 id: "get", 28123 min: 1, 28124 stackDelta: 0 28125}, { 28126 id: "ifelse", 28127 min: 4, 28128 stackDelta: -3 28129}, { 28130 id: "random", 28131 min: 0, 28132 stackDelta: 1 28133}, { 28134 id: "mul", 28135 min: 2, 28136 stackDelta: -1, 28137 28138 stackFn(stack, index) { 28139 stack[index - 2] = stack[index - 2] * stack[index - 1]; 28140 } 28141 28142}, null, { 28143 id: "sqrt", 28144 min: 1, 28145 stackDelta: 0 28146}, { 28147 id: "dup", 28148 min: 1, 28149 stackDelta: 1 28150}, { 28151 id: "exch", 28152 min: 2, 28153 stackDelta: 0 28154}, { 28155 id: "index", 28156 min: 2, 28157 stackDelta: 0 28158}, { 28159 id: "roll", 28160 min: 3, 28161 stackDelta: -2 28162}, null, null, null, { 28163 id: "hflex", 28164 min: 7, 28165 resetStack: true 28166}, { 28167 id: "flex", 28168 min: 13, 28169 resetStack: true 28170}, { 28171 id: "hflex1", 28172 min: 9, 28173 resetStack: true 28174}, { 28175 id: "flex1", 28176 min: 11, 28177 resetStack: true 28178}]; 28179 28180class CFFParser { 28181 constructor(file, properties, seacAnalysisEnabled) { 28182 this.bytes = file.getBytes(); 28183 this.properties = properties; 28184 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 28185 } 28186 28187 parse() { 28188 const properties = this.properties; 28189 const cff = new CFF(); 28190 this.cff = cff; 28191 const header = this.parseHeader(); 28192 const nameIndex = this.parseIndex(header.endPos); 28193 const topDictIndex = this.parseIndex(nameIndex.endPos); 28194 const stringIndex = this.parseIndex(topDictIndex.endPos); 28195 const globalSubrIndex = this.parseIndex(stringIndex.endPos); 28196 const topDictParsed = this.parseDict(topDictIndex.obj.get(0)); 28197 const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings); 28198 cff.header = header.obj; 28199 cff.names = this.parseNameIndex(nameIndex.obj); 28200 cff.strings = this.parseStringIndex(stringIndex.obj); 28201 cff.topDict = topDict; 28202 cff.globalSubrIndex = globalSubrIndex.obj; 28203 this.parsePrivateDict(cff.topDict); 28204 cff.isCIDFont = topDict.hasName("ROS"); 28205 const charStringOffset = topDict.getByName("CharStrings"); 28206 const charStringIndex = this.parseIndex(charStringOffset).obj; 28207 const fontMatrix = topDict.getByName("FontMatrix"); 28208 28209 if (fontMatrix) { 28210 properties.fontMatrix = fontMatrix; 28211 } 28212 28213 const fontBBox = topDict.getByName("FontBBox"); 28214 28215 if (fontBBox) { 28216 properties.ascent = Math.max(fontBBox[3], fontBBox[1]); 28217 properties.descent = Math.min(fontBBox[1], fontBBox[3]); 28218 properties.ascentScaled = true; 28219 } 28220
vendor: 41,386 bytes, lines 28221-29778
28221 let charset, encoding; 28222 28223 if (cff.isCIDFont) { 28224 const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj; 28225 28226 for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) { 28227 const dictRaw = fdArrayIndex.get(i); 28228 const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings); 28229 this.parsePrivateDict(fontDict); 28230 cff.fdArray.push(fontDict); 28231 } 28232 28233 encoding = null; 28234 charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true); 28235 cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count); 28236 } else { 28237 charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false); 28238 encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset); 28239 } 28240 28241 cff.charset = charset; 28242 cff.encoding = encoding; 28243 const charStringsAndSeacs = this.parseCharStrings({ 28244 charStrings: charStringIndex, 28245 localSubrIndex: topDict.privateDict.subrsIndex, 28246 globalSubrIndex: globalSubrIndex.obj, 28247 fdSelect: cff.fdSelect, 28248 fdArray: cff.fdArray, 28249 privateDict: topDict.privateDict 28250 }); 28251 cff.charStrings = charStringsAndSeacs.charStrings; 28252 cff.seacs = charStringsAndSeacs.seacs; 28253 cff.widths = charStringsAndSeacs.widths; 28254 return cff; 28255 } 28256 28257 parseHeader() { 28258 let bytes = this.bytes; 28259 const bytesLength = bytes.length; 28260 let offset = 0; 28261 28262 while (offset < bytesLength && bytes[offset] !== 1) { 28263 ++offset; 28264 } 28265 28266 if (offset >= bytesLength) { 28267 throw new _util.FormatError("Invalid CFF header"); 28268 } 28269 28270 if (offset !== 0) { 28271 (0, _util.info)("cff data is shifted"); 28272 bytes = bytes.subarray(offset); 28273 this.bytes = bytes; 28274 } 28275 28276 const major = bytes[0]; 28277 const minor = bytes[1]; 28278 const hdrSize = bytes[2]; 28279 const offSize = bytes[3]; 28280 const header = new CFFHeader(major, minor, hdrSize, offSize); 28281 return { 28282 obj: header, 28283 endPos: hdrSize 28284 }; 28285 } 28286 28287 parseDict(dict) { 28288 let pos = 0; 28289 28290 function parseOperand() { 28291 let value = dict[pos++]; 28292 28293 if (value === 30) { 28294 return parseFloatOperand(); 28295 } else if (value === 28) { 28296 value = dict[pos++]; 28297 value = (value << 24 | dict[pos++] << 16) >> 16; 28298 return value; 28299 } else if (value === 29) { 28300 value = dict[pos++]; 28301 value = value << 8 | dict[pos++]; 28302 value = value << 8 | dict[pos++]; 28303 value = value << 8 | dict[pos++]; 28304 return value; 28305 } else if (value >= 32 && value <= 246) { 28306 return value - 139; 28307 } else if (value >= 247 && value <= 250) { 28308 return (value - 247) * 256 + dict[pos++] + 108; 28309 } else if (value >= 251 && value <= 254) { 28310 return -((value - 251) * 256) - dict[pos++] - 108; 28311 } 28312 28313 (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.'); 28314 return NaN; 28315 } 28316 28317 function parseFloatOperand() { 28318 let str = ""; 28319 const eof = 15; 28320 const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"]; 28321 const length = dict.length; 28322 28323 while (pos < length) { 28324 const b = dict[pos++]; 28325 const b1 = b >> 4; 28326 const b2 = b & 15; 28327 28328 if (b1 === eof) { 28329 break; 28330 } 28331 28332 str += lookup[b1]; 28333 28334 if (b2 === eof) { 28335 break; 28336 } 28337 28338 str += lookup[b2]; 28339 } 28340 28341 return parseFloat(str); 28342 } 28343 28344 let operands = []; 28345 const entries = []; 28346 pos = 0; 28347 const end = dict.length; 28348 28349 while (pos < end) { 28350 let b = dict[pos]; 28351 28352 if (b <= 21) { 28353 if (b === 12) { 28354 b = b << 8 | dict[++pos]; 28355 } 28356 28357 entries.push([b, operands]); 28358 operands = []; 28359 ++pos; 28360 } else { 28361 operands.push(parseOperand()); 28362 } 28363 } 28364 28365 return entries; 28366 } 28367 28368 parseIndex(pos) { 28369 const cffIndex = new CFFIndex(); 28370 const bytes = this.bytes; 28371 const count = bytes[pos++] << 8 | bytes[pos++]; 28372 const offsets = []; 28373 let end = pos; 28374 let i, ii; 28375 28376 if (count !== 0) { 28377 const offsetSize = bytes[pos++]; 28378 const startPos = pos + (count + 1) * offsetSize - 1; 28379 28380 for (i = 0, ii = count + 1; i < ii; ++i) { 28381 let offset = 0; 28382 28383 for (let j = 0; j < offsetSize; ++j) { 28384 offset <<= 8; 28385 offset += bytes[pos++]; 28386 } 28387 28388 offsets.push(startPos + offset); 28389 } 28390 28391 end = offsets[count]; 28392 } 28393 28394 for (i = 0, ii = offsets.length - 1; i < ii; ++i) { 28395 const offsetStart = offsets[i]; 28396 const offsetEnd = offsets[i + 1]; 28397 cffIndex.add(bytes.subarray(offsetStart, offsetEnd)); 28398 } 28399 28400 return { 28401 obj: cffIndex, 28402 endPos: end 28403 }; 28404 } 28405 28406 parseNameIndex(index) { 28407 const names = []; 28408 28409 for (let i = 0, ii = index.count; i < ii; ++i) { 28410 const name = index.get(i); 28411 names.push((0, _util.bytesToString)(name)); 28412 } 28413 28414 return names; 28415 } 28416 28417 parseStringIndex(index) { 28418 const strings = new CFFStrings(); 28419 28420 for (let i = 0, ii = index.count; i < ii; ++i) { 28421 const data = index.get(i); 28422 strings.add((0, _util.bytesToString)(data)); 28423 } 28424 28425 return strings; 28426 } 28427 28428 createDict(Type, dict, strings) { 28429 const cffDict = new Type(strings); 28430 28431 for (let i = 0, ii = dict.length; i < ii; ++i) { 28432 const pair = dict[i]; 28433 const key = pair[0]; 28434 const value = pair[1]; 28435 cffDict.setByKey(key, value); 28436 } 28437 28438 return cffDict; 28439 } 28440 28441 parseCharString(state, data, localSubrIndex, globalSubrIndex) { 28442 if (!data || state.callDepth > MAX_SUBR_NESTING) { 28443 return false; 28444 } 28445 28446 let stackSize = state.stackSize; 28447 const stack = state.stack; 28448 const length = data.length; 28449 28450 for (let j = 0; j < length;) { 28451 const value = data[j++]; 28452 let validationCommand = null; 28453 28454 if (value === 12) { 28455 const q = data[j++]; 28456 28457 if (q === 0) { 28458 data[j - 2] = 139; 28459 data[j - 1] = 22; 28460 stackSize = 0; 28461 } else { 28462 validationCommand = CharstringValidationData12[q]; 28463 } 28464 } else if (value === 28) { 28465 stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16; 28466 j += 2; 28467 stackSize++; 28468 } else if (value === 14) { 28469 if (stackSize >= 4) { 28470 stackSize -= 4; 28471 28472 if (this.seacAnalysisEnabled) { 28473 state.seac = stack.slice(stackSize, stackSize + 4); 28474 return false; 28475 } 28476 } 28477 28478 validationCommand = CharstringValidationData[value]; 28479 } else if (value >= 32 && value <= 246) { 28480 stack[stackSize] = value - 139; 28481 stackSize++; 28482 } else if (value >= 247 && value <= 254) { 28483 stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108; 28484 j++; 28485 stackSize++; 28486 } else if (value === 255) { 28487 stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536; 28488 j += 4; 28489 stackSize++; 28490 } else if (value === 19 || value === 20) { 28491 state.hints += stackSize >> 1; 28492 j += state.hints + 7 >> 3; 28493 stackSize %= 2; 28494 validationCommand = CharstringValidationData[value]; 28495 } else if (value === 10 || value === 29) { 28496 let subrsIndex; 28497 28498 if (value === 10) { 28499 subrsIndex = localSubrIndex; 28500 } else { 28501 subrsIndex = globalSubrIndex; 28502 } 28503 28504 if (!subrsIndex) { 28505 validationCommand = CharstringValidationData[value]; 28506 (0, _util.warn)("Missing subrsIndex for " + validationCommand.id); 28507 return false; 28508 } 28509 28510 let bias = 32768; 28511 28512 if (subrsIndex.count < 1240) { 28513 bias = 107; 28514 } else if (subrsIndex.count < 33900) { 28515 bias = 1131; 28516 } 28517 28518 const subrNumber = stack[--stackSize] + bias; 28519 28520 if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) { 28521 validationCommand = CharstringValidationData[value]; 28522 (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id); 28523 return false; 28524 } 28525 28526 state.stackSize = stackSize; 28527 state.callDepth++; 28528 const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex); 28529 28530 if (!valid) { 28531 return false; 28532 } 28533 28534 state.callDepth--; 28535 stackSize = state.stackSize; 28536 continue; 28537 } else if (value === 11) { 28538 state.stackSize = stackSize; 28539 return true; 28540 } else if (value === 0 && j === data.length) { 28541 data[j - 1] = 14; 28542 validationCommand = CharstringValidationData[14]; 28543 } else { 28544 validationCommand = CharstringValidationData[value]; 28545 } 28546 28547 if (validationCommand) { 28548 if (validationCommand.stem) { 28549 state.hints += stackSize >> 1; 28550 28551 if (value === 3 || value === 23) { 28552 state.hasVStems = true; 28553 } else if (state.hasVStems && (value === 1 || value === 18)) { 28554 (0, _util.warn)("CFF stem hints are in wrong order"); 28555 data[j - 1] = value === 1 ? 3 : 23; 28556 } 28557 } 28558 28559 if ("min" in validationCommand) { 28560 if (!state.undefStack && stackSize < validationCommand.min) { 28561 (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min); 28562 28563 if (stackSize === 0) { 28564 data[j - 1] = 14; 28565 return true; 28566 } 28567 28568 return false; 28569 } 28570 } 28571 28572 if (state.firstStackClearing && validationCommand.stackClearing) { 28573 state.firstStackClearing = false; 28574 stackSize -= validationCommand.min; 28575 28576 if (stackSize >= 2 && validationCommand.stem) { 28577 stackSize %= 2; 28578 } else if (stackSize > 1) { 28579 (0, _util.warn)("Found too many parameters for stack-clearing command"); 28580 } 28581 28582 if (stackSize > 0) { 28583 state.width = stack[stackSize - 1]; 28584 } 28585 } 28586 28587 if ("stackDelta" in validationCommand) { 28588 if ("stackFn" in validationCommand) { 28589 validationCommand.stackFn(stack, stackSize); 28590 } 28591 28592 stackSize += validationCommand.stackDelta; 28593 } else if (validationCommand.stackClearing) { 28594 stackSize = 0; 28595 } else if (validationCommand.resetStack) { 28596 stackSize = 0; 28597 state.undefStack = false; 28598 } else if (validationCommand.undefStack) { 28599 stackSize = 0; 28600 state.undefStack = true; 28601 state.firstStackClearing = false; 28602 } 28603 } 28604 } 28605 28606 state.stackSize = stackSize; 28607 return true; 28608 } 28609 28610 parseCharStrings({ 28611 charStrings, 28612 localSubrIndex, 28613 globalSubrIndex, 28614 fdSelect, 28615 fdArray, 28616 privateDict 28617 }) { 28618 const seacs = []; 28619 const widths = []; 28620 const count = charStrings.count; 28621 28622 for (let i = 0; i < count; i++) { 28623 const charstring = charStrings.get(i); 28624 const state = { 28625 callDepth: 0, 28626 stackSize: 0, 28627 stack: [], 28628 undefStack: true, 28629 hints: 0, 28630 firstStackClearing: true, 28631 seac: null, 28632 width: null, 28633 hasVStems: false 28634 }; 28635 let valid = true; 28636 let localSubrToUse = null; 28637 let privateDictToUse = privateDict; 28638 28639 if (fdSelect && fdArray.length) { 28640 const fdIndex = fdSelect.getFDIndex(i); 28641 28642 if (fdIndex === -1) { 28643 (0, _util.warn)("Glyph index is not in fd select."); 28644 valid = false; 28645 } 28646 28647 if (fdIndex >= fdArray.length) { 28648 (0, _util.warn)("Invalid fd index for glyph index."); 28649 valid = false; 28650 } 28651 28652 if (valid) { 28653 privateDictToUse = fdArray[fdIndex].privateDict; 28654 localSubrToUse = privateDictToUse.subrsIndex; 28655 } 28656 } else if (localSubrIndex) { 28657 localSubrToUse = localSubrIndex; 28658 } 28659 28660 if (valid) { 28661 valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex); 28662 } 28663 28664 if (state.width !== null) { 28665 const nominalWidth = privateDictToUse.getByName("nominalWidthX"); 28666 widths[i] = nominalWidth + state.width; 28667 } else { 28668 const defaultWidth = privateDictToUse.getByName("defaultWidthX"); 28669 widths[i] = defaultWidth; 28670 } 28671 28672 if (state.seac !== null) { 28673 seacs[i] = state.seac; 28674 } 28675 28676 if (!valid) { 28677 charStrings.set(i, new Uint8Array([14])); 28678 } 28679 } 28680 28681 return { 28682 charStrings, 28683 seacs, 28684 widths 28685 }; 28686 } 28687 28688 emptyPrivateDictionary(parentDict) { 28689 const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings); 28690 parentDict.setByKey(18, [0, 0]); 28691 parentDict.privateDict = privateDict; 28692 } 28693 28694 parsePrivateDict(parentDict) { 28695 if (!parentDict.hasName("Private")) { 28696 this.emptyPrivateDictionary(parentDict); 28697 return; 28698 } 28699 28700 const privateOffset = parentDict.getByName("Private"); 28701 28702 if (!Array.isArray(privateOffset) || privateOffset.length !== 2) { 28703 parentDict.removeByName("Private"); 28704 return; 28705 } 28706 28707 const size = privateOffset[0]; 28708 const offset = privateOffset[1]; 28709 28710 if (size === 0 || offset >= this.bytes.length) { 28711 this.emptyPrivateDictionary(parentDict); 28712 return; 28713 } 28714 28715 const privateDictEnd = offset + size; 28716 const dictData = this.bytes.subarray(offset, privateDictEnd); 28717 const dict = this.parseDict(dictData); 28718 const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings); 28719 parentDict.privateDict = privateDict; 28720 28721 if (!privateDict.getByName("Subrs")) { 28722 return; 28723 } 28724 28725 const subrsOffset = privateDict.getByName("Subrs"); 28726 const relativeOffset = offset + subrsOffset; 28727 28728 if (subrsOffset === 0 || relativeOffset >= this.bytes.length) { 28729 this.emptyPrivateDictionary(parentDict); 28730 return; 28731 } 28732 28733 const subrsIndex = this.parseIndex(relativeOffset); 28734 privateDict.subrsIndex = subrsIndex.obj; 28735 } 28736 28737 parseCharsets(pos, length, strings, cid) { 28738 if (pos === 0) { 28739 return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset); 28740 } else if (pos === 1) { 28741 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset); 28742 } else if (pos === 2) { 28743 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset); 28744 } 28745 28746 const bytes = this.bytes; 28747 const start = pos; 28748 const format = bytes[pos++]; 28749 const charset = [cid ? 0 : ".notdef"]; 28750 let id, count, i; 28751 length -= 1; 28752 28753 switch (format) { 28754 case 0: 28755 for (i = 0; i < length; i++) { 28756 id = bytes[pos++] << 8 | bytes[pos++]; 28757 charset.push(cid ? id : strings.get(id)); 28758 } 28759 28760 break; 28761 28762 case 1: 28763 while (charset.length <= length) { 28764 id = bytes[pos++] << 8 | bytes[pos++]; 28765 count = bytes[pos++]; 28766 28767 for (i = 0; i <= count; i++) { 28768 charset.push(cid ? id++ : strings.get(id++)); 28769 } 28770 } 28771 28772 break; 28773 28774 case 2: 28775 while (charset.length <= length) { 28776 id = bytes[pos++] << 8 | bytes[pos++]; 28777 count = bytes[pos++] << 8 | bytes[pos++]; 28778 28779 for (i = 0; i <= count; i++) { 28780 charset.push(cid ? id++ : strings.get(id++)); 28781 } 28782 } 28783 28784 break; 28785 28786 default: 28787 throw new _util.FormatError("Unknown charset format"); 28788 } 28789 28790 const end = pos; 28791 const raw = bytes.subarray(start, end); 28792 return new CFFCharset(false, format, charset, raw); 28793 } 28794 28795 parseEncoding(pos, properties, strings, charset) { 28796 const encoding = Object.create(null); 28797 const bytes = this.bytes; 28798 let predefined = false; 28799 let format, i, ii; 28800 let raw = null; 28801 28802 function readSupplement() { 28803 const supplementsCount = bytes[pos++]; 28804 28805 for (i = 0; i < supplementsCount; i++) { 28806 const code = bytes[pos++]; 28807 const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff); 28808 encoding[code] = charset.indexOf(strings.get(sid)); 28809 } 28810 } 28811 28812 if (pos === 0 || pos === 1) { 28813 predefined = true; 28814 format = pos; 28815 const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding; 28816 28817 for (i = 0, ii = charset.length; i < ii; i++) { 28818 const index = baseEncoding.indexOf(charset[i]); 28819 28820 if (index !== -1) { 28821 encoding[index] = i; 28822 } 28823 } 28824 } else { 28825 const dataStart = pos; 28826 format = bytes[pos++]; 28827 28828 switch (format & 0x7f) { 28829 case 0: 28830 const glyphsCount = bytes[pos++]; 28831 28832 for (i = 1; i <= glyphsCount; i++) { 28833 encoding[bytes[pos++]] = i; 28834 } 28835 28836 break; 28837 28838 case 1: 28839 const rangesCount = bytes[pos++]; 28840 let gid = 1; 28841 28842 for (i = 0; i < rangesCount; i++) { 28843 const start = bytes[pos++]; 28844 const left = bytes[pos++]; 28845 28846 for (let j = start; j <= start + left; j++) { 28847 encoding[j] = gid++; 28848 } 28849 } 28850 28851 break; 28852 28853 default: 28854 throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`); 28855 } 28856 28857 const dataEnd = pos; 28858 28859 if (format & 0x80) { 28860 bytes[dataStart] &= 0x7f; 28861 readSupplement(); 28862 } 28863 28864 raw = bytes.subarray(dataStart, dataEnd); 28865 } 28866 28867 format &= 0x7f; 28868 return new CFFEncoding(predefined, format, encoding, raw); 28869 } 28870 28871 parseFDSelect(pos, length) { 28872 const bytes = this.bytes; 28873 const format = bytes[pos++]; 28874 const fdSelect = []; 28875 let i; 28876 28877 switch (format) { 28878 case 0: 28879 for (i = 0; i < length; ++i) { 28880 const id = bytes[pos++]; 28881 fdSelect.push(id); 28882 } 28883 28884 break; 28885 28886 case 3: 28887 const rangesCount = bytes[pos++] << 8 | bytes[pos++]; 28888 28889 for (i = 0; i < rangesCount; ++i) { 28890 let first = bytes[pos++] << 8 | bytes[pos++]; 28891 28892 if (i === 0 && first !== 0) { 28893 (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover."); 28894 first = 0; 28895 } 28896 28897 const fdIndex = bytes[pos++]; 28898 const next = bytes[pos] << 8 | bytes[pos + 1]; 28899 28900 for (let j = first; j < next; ++j) { 28901 fdSelect.push(fdIndex); 28902 } 28903 } 28904 28905 pos += 2; 28906 break; 28907 28908 default: 28909 throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`); 28910 } 28911 28912 if (fdSelect.length !== length) { 28913 throw new _util.FormatError("parseFDSelect: Invalid font data."); 28914 } 28915 28916 return new CFFFDSelect(format, fdSelect); 28917 } 28918 28919} 28920 28921exports.CFFParser = CFFParser; 28922 28923class CFF { 28924 constructor() { 28925 this.header = null; 28926 this.names = []; 28927 this.topDict = null; 28928 this.strings = new CFFStrings(); 28929 this.globalSubrIndex = null; 28930 this.encoding = null; 28931 this.charset = null; 28932 this.charStrings = null; 28933 this.fdArray = []; 28934 this.fdSelect = null; 28935 this.isCIDFont = false; 28936 } 28937 28938 duplicateFirstGlyph() { 28939 if (this.charStrings.count >= 65535) { 28940 (0, _util.warn)("Not enough space in charstrings to duplicate first glyph."); 28941 return; 28942 } 28943 28944 const glyphZero = this.charStrings.get(0); 28945 this.charStrings.add(glyphZero); 28946 28947 if (this.isCIDFont) { 28948 this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]); 28949 } 28950 } 28951 28952 hasGlyphId(id) { 28953 if (id < 0 || id >= this.charStrings.count) { 28954 return false; 28955 } 28956 28957 const glyph = this.charStrings.get(id); 28958 return glyph.length > 0; 28959 } 28960 28961} 28962 28963exports.CFF = CFF; 28964 28965class CFFHeader { 28966 constructor(major, minor, hdrSize, offSize) { 28967 this.major = major; 28968 this.minor = minor; 28969 this.hdrSize = hdrSize; 28970 this.offSize = offSize; 28971 } 28972 28973} 28974 28975exports.CFFHeader = CFFHeader; 28976 28977class CFFStrings { 28978 constructor() { 28979 this.strings = []; 28980 } 28981 28982 get(index) { 28983 if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) { 28984 return CFFStandardStrings[index]; 28985 } 28986 28987 if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) { 28988 return this.strings[index - NUM_STANDARD_CFF_STRINGS]; 28989 } 28990 28991 return CFFStandardStrings[0]; 28992 } 28993 28994 getSID(str) { 28995 let index = CFFStandardStrings.indexOf(str); 28996 28997 if (index !== -1) { 28998 return index; 28999 } 29000 29001 index = this.strings.indexOf(str); 29002 29003 if (index !== -1) { 29004 return index + NUM_STANDARD_CFF_STRINGS; 29005 } 29006 29007 return -1; 29008 } 29009 29010 add(value) { 29011 this.strings.push(value); 29012 } 29013 29014 get count() { 29015 return this.strings.length; 29016 } 29017 29018} 29019 29020exports.CFFStrings = CFFStrings; 29021 29022class CFFIndex { 29023 constructor() { 29024 this.objects = []; 29025 this.length = 0; 29026 } 29027 29028 add(data) { 29029 this.length += data.length; 29030 this.objects.push(data); 29031 } 29032 29033 set(index, data) { 29034 this.length += data.length - this.objects[index].length; 29035 this.objects[index] = data; 29036 } 29037 29038 get(index) { 29039 return this.objects[index]; 29040 } 29041 29042 get count() { 29043 return this.objects.length; 29044 } 29045 29046} 29047 29048exports.CFFIndex = CFFIndex; 29049 29050class CFFDict { 29051 constructor(tables, strings) { 29052 this.keyToNameMap = tables.keyToNameMap; 29053 this.nameToKeyMap = tables.nameToKeyMap; 29054 this.defaults = tables.defaults; 29055 this.types = tables.types; 29056 this.opcodes = tables.opcodes; 29057 this.order = tables.order; 29058 this.strings = strings; 29059 this.values = Object.create(null); 29060 } 29061 29062 setByKey(key, value) { 29063 if (!(key in this.keyToNameMap)) { 29064 return false; 29065 } 29066 29067 const valueLength = value.length; 29068 29069 if (valueLength === 0) { 29070 return true; 29071 } 29072 29073 for (let i = 0; i < valueLength; i++) { 29074 if (isNaN(value[i])) { 29075 (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".'); 29076 return true; 29077 } 29078 } 29079 29080 const type = this.types[key]; 29081 29082 if (type === "num" || type === "sid" || type === "offset") { 29083 value = value[0]; 29084 } 29085 29086 this.values[key] = value; 29087 return true; 29088 } 29089 29090 setByName(name, value) { 29091 if (!(name in this.nameToKeyMap)) { 29092 throw new _util.FormatError(`Invalid dictionary name "${name}"`); 29093 } 29094 29095 this.values[this.nameToKeyMap[name]] = value; 29096 } 29097 29098 hasName(name) { 29099 return this.nameToKeyMap[name] in this.values; 29100 } 29101 29102 getByName(name) { 29103 if (!(name in this.nameToKeyMap)) { 29104 throw new _util.FormatError(`Invalid dictionary name ${name}"`); 29105 } 29106 29107 const key = this.nameToKeyMap[name]; 29108 29109 if (!(key in this.values)) { 29110 return this.defaults[key]; 29111 } 29112 29113 return this.values[key]; 29114 } 29115 29116 removeByName(name) { 29117 delete this.values[this.nameToKeyMap[name]]; 29118 } 29119 29120 static createTables(layout) { 29121 const tables = { 29122 keyToNameMap: {}, 29123 nameToKeyMap: {}, 29124 defaults: {}, 29125 types: {}, 29126 opcodes: {}, 29127 order: [] 29128 }; 29129 29130 for (let i = 0, ii = layout.length; i < ii; ++i) { 29131 const entry = layout[i]; 29132 const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0]; 29133 tables.keyToNameMap[key] = entry[1]; 29134 tables.nameToKeyMap[entry[1]] = key; 29135 tables.types[key] = entry[2]; 29136 tables.defaults[key] = entry[3]; 29137 tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]]; 29138 tables.order.push(key); 29139 } 29140 29141 return tables; 29142 } 29143 29144} 29145 29146const CFFTopDictLayout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]]; 29147 29148class CFFTopDict extends CFFDict { 29149 static get tables() { 29150 return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout)); 29151 } 29152 29153 constructor(strings) { 29154 super(CFFTopDict.tables, strings); 29155 this.privateDict = null; 29156 } 29157 29158} 29159 29160exports.CFFTopDict = CFFTopDict; 29161const CFFPrivateDictLayout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]]; 29162 29163class CFFPrivateDict extends CFFDict { 29164 static get tables() { 29165 return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout)); 29166 } 29167 29168 constructor(strings) { 29169 super(CFFPrivateDict.tables, strings); 29170 this.subrsIndex = null; 29171 } 29172 29173} 29174 29175exports.CFFPrivateDict = CFFPrivateDict; 29176const CFFCharsetPredefinedTypes = { 29177 ISO_ADOBE: 0, 29178 EXPERT: 1, 29179 EXPERT_SUBSET: 2 29180}; 29181 29182class CFFCharset { 29183 constructor(predefined, format, charset, raw) { 29184 this.predefined = predefined; 29185 this.format = format; 29186 this.charset = charset; 29187 this.raw = raw; 29188 } 29189 29190} 29191 29192exports.CFFCharset = CFFCharset; 29193 29194class CFFEncoding { 29195 constructor(predefined, format, encoding, raw) { 29196 this.predefined = predefined; 29197 this.format = format; 29198 this.encoding = encoding; 29199 this.raw = raw; 29200 } 29201 29202} 29203 29204class CFFFDSelect { 29205 constructor(format, fdSelect) { 29206 this.format = format; 29207 this.fdSelect = fdSelect; 29208 } 29209 29210 getFDIndex(glyphIndex) { 29211 if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) { 29212 return -1; 29213 } 29214 29215 return this.fdSelect[glyphIndex]; 29216 } 29217 29218} 29219 29220exports.CFFFDSelect = CFFFDSelect; 29221 29222class CFFOffsetTracker { 29223 constructor() { 29224 this.offsets = Object.create(null); 29225 } 29226 29227 isTracking(key) { 29228 return key in this.offsets; 29229 } 29230 29231 track(key, location) { 29232 if (key in this.offsets) { 29233 throw new _util.FormatError(`Already tracking location of ${key}`); 29234 } 29235 29236 this.offsets[key] = location; 29237 } 29238 29239 offset(value) { 29240 for (const key in this.offsets) { 29241 this.offsets[key] += value; 29242 } 29243 } 29244 29245 setEntryLocation(key, values, output) { 29246 if (!(key in this.offsets)) { 29247 throw new _util.FormatError(`Not tracking location of ${key}`); 29248 } 29249 29250 const data = output.data; 29251 const dataOffset = this.offsets[key]; 29252 const size = 5; 29253 29254 for (let i = 0, ii = values.length; i < ii; ++i) { 29255 const offset0 = i * size + dataOffset; 29256 const offset1 = offset0 + 1; 29257 const offset2 = offset0 + 2; 29258 const offset3 = offset0 + 3; 29259 const offset4 = offset0 + 4; 29260 29261 if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) { 29262 throw new _util.FormatError("writing to an offset that is not empty"); 29263 } 29264 29265 const value = values[i]; 29266 data[offset0] = 0x1d; 29267 data[offset1] = value >> 24 & 0xff; 29268 data[offset2] = value >> 16 & 0xff; 29269 data[offset3] = value >> 8 & 0xff; 29270 data[offset4] = value & 0xff; 29271 } 29272 } 29273 29274} 29275 29276class CFFCompiler { 29277 constructor(cff) { 29278 this.cff = cff; 29279 } 29280 29281 compile() { 29282 const cff = this.cff; 29283 const output = { 29284 data: [], 29285 length: 0, 29286 29287 add(data) { 29288 this.data = this.data.concat(data); 29289 this.length = this.data.length; 29290 } 29291 29292 }; 29293 const header = this.compileHeader(cff.header); 29294 output.add(header); 29295 const nameIndex = this.compileNameIndex(cff.names); 29296 output.add(nameIndex); 29297 29298 if (cff.isCIDFont) { 29299 if (cff.topDict.hasName("FontMatrix")) { 29300 const base = cff.topDict.getByName("FontMatrix"); 29301 cff.topDict.removeByName("FontMatrix"); 29302 29303 for (let i = 0, ii = cff.fdArray.length; i < ii; i++) { 29304 const subDict = cff.fdArray[i]; 29305 let matrix = base.slice(0); 29306 29307 if (subDict.hasName("FontMatrix")) { 29308 matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix")); 29309 } 29310 29311 subDict.setByName("FontMatrix", matrix); 29312 } 29313 } 29314 } 29315 29316 const xuid = cff.topDict.getByName("XUID"); 29317 29318 if (xuid && xuid.length > 16) { 29319 cff.topDict.removeByName("XUID"); 29320 } 29321 29322 cff.topDict.setByName("charset", 0); 29323 let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont); 29324 output.add(compiled.output); 29325 const topDictTracker = compiled.trackers[0]; 29326 const stringIndex = this.compileStringIndex(cff.strings.strings); 29327 output.add(stringIndex); 29328 const globalSubrIndex = this.compileIndex(cff.globalSubrIndex); 29329 output.add(globalSubrIndex); 29330 29331 if (cff.encoding && cff.topDict.hasName("Encoding")) { 29332 if (cff.encoding.predefined) { 29333 topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output); 29334 } else { 29335 const encoding = this.compileEncoding(cff.encoding); 29336 topDictTracker.setEntryLocation("Encoding", [output.length], output); 29337 output.add(encoding); 29338 } 29339 } 29340 29341 const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont); 29342 topDictTracker.setEntryLocation("charset", [output.length], output); 29343 output.add(charset); 29344 const charStrings = this.compileCharStrings(cff.charStrings); 29345 topDictTracker.setEntryLocation("CharStrings", [output.length], output); 29346 output.add(charStrings); 29347 29348 if (cff.isCIDFont) { 29349 topDictTracker.setEntryLocation("FDSelect", [output.length], output); 29350 const fdSelect = this.compileFDSelect(cff.fdSelect); 29351 output.add(fdSelect); 29352 compiled = this.compileTopDicts(cff.fdArray, output.length, true); 29353 topDictTracker.setEntryLocation("FDArray", [output.length], output); 29354 output.add(compiled.output); 29355 const fontDictTrackers = compiled.trackers; 29356 this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output); 29357 } 29358 29359 this.compilePrivateDicts([cff.topDict], [topDictTracker], output); 29360 output.add([0]); 29361 return output.data; 29362 } 29363 29364 encodeNumber(value) { 29365 if (Number.isInteger(value)) { 29366 return this.encodeInteger(value); 29367 } 29368 29369 return this.encodeFloat(value); 29370 } 29371 29372 static get EncodeFloatRegExp() { 29373 return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/); 29374 } 29375 29376 encodeFloat(num) { 29377 let value = num.toString(); 29378 const m = CFFCompiler.EncodeFloatRegExp.exec(value); 29379 29380 if (m) { 29381 const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length)); 29382 value = (Math.round(num * epsilon) / epsilon).toString(); 29383 } 29384 29385 let nibbles = ""; 29386 let i, ii; 29387 29388 for (i = 0, ii = value.length; i < ii; ++i) { 29389 const a = value[i]; 29390 29391 if (a === "e") { 29392 nibbles += value[++i] === "-" ? "c" : "b"; 29393 } else if (a === ".") { 29394 nibbles += "a"; 29395 } else if (a === "-") { 29396 nibbles += "e"; 29397 } else { 29398 nibbles += a; 29399 } 29400 } 29401 29402 nibbles += nibbles.length & 1 ? "f" : "ff"; 29403 const out = [30]; 29404 29405 for (i = 0, ii = nibbles.length; i < ii; i += 2) { 29406 out.push(parseInt(nibbles.substring(i, i + 2), 16)); 29407 } 29408 29409 return out; 29410 } 29411 29412 encodeInteger(value) { 29413 let code; 29414 29415 if (value >= -107 && value <= 107) { 29416 code = [value + 139]; 29417 } else if (value >= 108 && value <= 1131) { 29418 value -= 108; 29419 code = [(value >> 8) + 247, value & 0xff]; 29420 } else if (value >= -1131 && value <= -108) { 29421 value = -value - 108; 29422 code = [(value >> 8) + 251, value & 0xff]; 29423 } else if (value >= -32768 && value <= 32767) { 29424 code = [0x1c, value >> 8 & 0xff, value & 0xff]; 29425 } else { 29426 code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff]; 29427 } 29428 29429 return code; 29430 } 29431 29432 compileHeader(header) { 29433 return [header.major, header.minor, 4, header.offSize]; 29434 } 29435 29436 compileNameIndex(names) { 29437 const nameIndex = new CFFIndex(); 29438 29439 for (let i = 0, ii = names.length; i < ii; ++i) { 29440 const name = names[i]; 29441 const length = Math.min(name.length, 127); 29442 let sanitizedName = new Array(length); 29443 29444 for (let j = 0; j < length; j++) { 29445 let char = name[j]; 29446 29447 if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") { 29448 char = "_"; 29449 } 29450 29451 sanitizedName[j] = char; 29452 } 29453 29454 sanitizedName = sanitizedName.join(""); 29455 29456 if (sanitizedName === "") { 29457 sanitizedName = "Bad_Font_Name"; 29458 } 29459 29460 nameIndex.add((0, _util.stringToBytes)(sanitizedName)); 29461 } 29462 29463 return this.compileIndex(nameIndex); 29464 } 29465 29466 compileTopDicts(dicts, length, removeCidKeys) { 29467 const fontDictTrackers = []; 29468 let fdArrayIndex = new CFFIndex(); 29469 29470 for (let i = 0, ii = dicts.length; i < ii; ++i) { 29471 const fontDict = dicts[i]; 29472 29473 if (removeCidKeys) { 29474 fontDict.removeByName("CIDFontVersion"); 29475 fontDict.removeByName("CIDFontRevision"); 29476 fontDict.removeByName("CIDFontType"); 29477 fontDict.removeByName("CIDCount"); 29478 fontDict.removeByName("UIDBase"); 29479 } 29480 29481 const fontDictTracker = new CFFOffsetTracker(); 29482 const fontDictData = this.compileDict(fontDict, fontDictTracker); 29483 fontDictTrackers.push(fontDictTracker); 29484 fdArrayIndex.add(fontDictData); 29485 fontDictTracker.offset(length); 29486 } 29487 29488 fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers); 29489 return { 29490 trackers: fontDictTrackers, 29491 output: fdArrayIndex 29492 }; 29493 } 29494 29495 compilePrivateDicts(dicts, trackers, output) { 29496 for (let i = 0, ii = dicts.length; i < ii; ++i) { 29497 const fontDict = dicts[i]; 29498 const privateDict = fontDict.privateDict; 29499 29500 if (!privateDict || !fontDict.hasName("Private")) { 29501 throw new _util.FormatError("There must be a private dictionary."); 29502 } 29503 29504 const privateDictTracker = new CFFOffsetTracker(); 29505 const privateDictData = this.compileDict(privateDict, privateDictTracker); 29506 let outputLength = output.length; 29507 privateDictTracker.offset(outputLength); 29508 29509 if (!privateDictData.length) { 29510 outputLength = 0; 29511 } 29512 29513 trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output); 29514 output.add(privateDictData); 29515 29516 if (privateDict.subrsIndex && privateDict.hasName("Subrs")) { 29517 const subrs = this.compileIndex(privateDict.subrsIndex); 29518 privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output); 29519 output.add(subrs); 29520 } 29521 } 29522 } 29523 29524 compileDict(dict, offsetTracker) { 29525 const out = []; 29526 29527 for (const key of dict.order) { 29528 if (!(key in dict.values)) { 29529 continue; 29530 } 29531 29532 let values = dict.values[key]; 29533 let types = dict.types[key]; 29534 29535 if (!Array.isArray(types)) { 29536 types = [types]; 29537 } 29538 29539 if (!Array.isArray(values)) { 29540 values = [values]; 29541 } 29542 29543 if (values.length === 0) { 29544 continue; 29545 } 29546 29547 for (let j = 0, jj = types.length; j < jj; ++j) { 29548 const type = types[j]; 29549 const value = values[j]; 29550 29551 switch (type) { 29552 case "num": 29553 case "sid": 29554 out.push(...this.encodeNumber(value)); 29555 break; 29556 29557 case "offset": 29558 const name = dict.keyToNameMap[key]; 29559 29560 if (!offsetTracker.isTracking(name)) { 29561 offsetTracker.track(name, out.length); 29562 } 29563 29564 out.push(0x1d, 0, 0, 0, 0); 29565 break; 29566 29567 case "array": 29568 case "delta": 29569 out.push(...this.encodeNumber(value)); 29570 29571 for (let k = 1, kk = values.length; k < kk; ++k) { 29572 out.push(...this.encodeNumber(values[k])); 29573 } 29574 29575 break; 29576 29577 default: 29578 throw new _util.FormatError(`Unknown data type of ${type}`); 29579 } 29580 } 29581 29582 out.push(...dict.opcodes[key]); 29583 } 29584 29585 return out; 29586 } 29587 29588 compileStringIndex(strings) { 29589 const stringIndex = new CFFIndex(); 29590 29591 for (let i = 0, ii = strings.length; i < ii; ++i) { 29592 stringIndex.add((0, _util.stringToBytes)(strings[i])); 29593 } 29594 29595 return this.compileIndex(stringIndex); 29596 } 29597 29598 compileGlobalSubrIndex() { 29599 const globalSubrIndex = this.cff.globalSubrIndex; 29600 this.out.writeByteArray(this.compileIndex(globalSubrIndex)); 29601 } 29602 29603 compileCharStrings(charStrings) { 29604 const charStringsIndex = new CFFIndex(); 29605 29606 for (let i = 0; i < charStrings.count; i++) { 29607 const glyph = charStrings.get(i); 29608 29609 if (glyph.length === 0) { 29610 charStringsIndex.add(new Uint8Array([0x8b, 0x0e])); 29611 continue; 29612 } 29613 29614 charStringsIndex.add(glyph); 29615 } 29616 29617 return this.compileIndex(charStringsIndex); 29618 } 29619 29620 compileCharset(charset, numGlyphs, strings, isCIDFont) { 29621 let out; 29622 const numGlyphsLessNotDef = numGlyphs - 1; 29623 29624 if (isCIDFont) { 29625 out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]); 29626 } else { 29627 const length = 1 + numGlyphsLessNotDef * 2; 29628 out = new Uint8Array(length); 29629 out[0] = 0; 29630 let charsetIndex = 0; 29631 const numCharsets = charset.charset.length; 29632 let warned = false; 29633 29634 for (let i = 1; i < out.length; i += 2) { 29635 let sid = 0; 29636 29637 if (charsetIndex < numCharsets) { 29638 const name = charset.charset[charsetIndex++]; 29639 sid = strings.getSID(name); 29640 29641 if (sid === -1) { 29642 sid = 0; 29643 29644 if (!warned) { 29645 warned = true; 29646 (0, _util.warn)(`Couldn't find ${name} in CFF strings`); 29647 } 29648 } 29649 } 29650 29651 out[i] = sid >> 8 & 0xff; 29652 out[i + 1] = sid & 0xff; 29653 } 29654 } 29655 29656 return this.compileTypedArray(out); 29657 } 29658 29659 compileEncoding(encoding) { 29660 return this.compileTypedArray(encoding.raw); 29661 } 29662 29663 compileFDSelect(fdSelect) { 29664 const format = fdSelect.format; 29665 let out, i; 29666 29667 switch (format) { 29668 case 0: 29669 out = new Uint8Array(1 + fdSelect.fdSelect.length); 29670 out[0] = format; 29671 29672 for (i = 0; i < fdSelect.fdSelect.length; i++) { 29673 out[i + 1] = fdSelect.fdSelect[i]; 29674 } 29675 29676 break; 29677 29678 case 3: 29679 const start = 0; 29680 let lastFD = fdSelect.fdSelect[0]; 29681 const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD]; 29682 29683 for (i = 1; i < fdSelect.fdSelect.length; i++) { 29684 const currentFD = fdSelect.fdSelect[i]; 29685 29686 if (currentFD !== lastFD) { 29687 ranges.push(i >> 8 & 0xff, i & 0xff, currentFD); 29688 lastFD = currentFD; 29689 } 29690 } 29691 29692 const numRanges = (ranges.length - 3) / 3; 29693 ranges[1] = numRanges >> 8 & 0xff; 29694 ranges[2] = numRanges & 0xff; 29695 ranges.push(i >> 8 & 0xff, i & 0xff); 29696 out = new Uint8Array(ranges); 29697 break; 29698 } 29699 29700 return this.compileTypedArray(out); 29701 } 29702 29703 compileTypedArray(data) { 29704 const out = []; 29705 29706 for (let i = 0, ii = data.length; i < ii; ++i) { 29707 out[i] = data[i]; 29708 } 29709 29710 return out; 29711 } 29712 29713 compileIndex(index, trackers = []) { 29714 const objects = index.objects; 29715 const count = objects.length; 29716 29717 if (count === 0) { 29718 return [0, 0]; 29719 } 29720 29721 const data = [count >> 8 & 0xff, count & 0xff]; 29722 let lastOffset = 1, 29723 i; 29724 29725 for (i = 0; i < count; ++i) { 29726 lastOffset += objects[i].length; 29727 } 29728 29729 let offsetSize; 29730 29731 if (lastOffset < 0x100) { 29732 offsetSize = 1; 29733 } else if (lastOffset < 0x10000) { 29734 offsetSize = 2; 29735 } else if (lastOffset < 0x1000000) { 29736 offsetSize = 3; 29737 } else { 29738 offsetSize = 4; 29739 } 29740 29741 data.push(offsetSize); 29742 let relativeOffset = 1; 29743 29744 for (i = 0; i < count + 1; i++) { 29745 if (offsetSize === 1) { 29746 data.push(relativeOffset & 0xff); 29747 } else if (offsetSize === 2) { 29748 data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 29749 } else if (offsetSize === 3) { 29750 data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 29751 } else { 29752 data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 29753 } 29754 29755 if (objects[i]) { 29756 relativeOffset += objects[i].length; 29757 } 29758 } 29759 29760 for (i = 0; i < count; i++) { 29761 if (trackers[i]) { 29762 trackers[i].offset(data.length); 29763 } 29764 29765 for (let j = 0, jj = objects[i].length; j < jj; j++) { 29766 data.push(objects[i][j]); 29767 } 29768 } 29769 29770 return data; 29771 } 29772 29773} 29774 29775exports.CFFCompiler = CFFCompiler; 29776 29777/***/ }), 29778/* 36
vendor: 6,402 bytes, lines 29778-29795
29778 */ 29779/***/ ((__unused_webpack_module, exports) => { 29780 29781 29782 29783Object.defineProperty(exports, "__esModule", ({ 29784 value: true 29785})); 29786exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0; 29787const ISOAdobeCharset = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron"]; 29788exports.ISOAdobeCharset = ISOAdobeCharset; 29789const ExpertCharset = [".notdef", "space", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"]; 29790exports.ExpertCharset = ExpertCharset; 29791const ExpertSubsetCharset = [".notdef", "space", "dollaroldstyle", "dollarsuperior", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "hyphensuperior", "colonmonetary", "onefitted", "rupiah", "centoldstyle", "figuredash", "hypheninferior", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior"]; 29792exports.ExpertSubsetCharset = ExpertSubsetCharset; 29793 29794/***/ }), 29795/* 3
297957
vendor: 16,987 bytes, lines 29795-29817
29795 */ 29796/***/ ((__unused_webpack_module, exports) => { 29797 29798 29799 29800Object.defineProperty(exports, "__esModule", ({ 29801 value: true 29802})); 29803exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0; 29804exports.getEncoding = getEncoding; 29805const ExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "", "", "", "isuperior", "", "", "lsuperior", "msuperior", "nsuperior", "osuperior", "", "", "rsuperior", "ssuperior", "tsuperior", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdownsmall", "centoldstyle", "Lslashsmall", "", "", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "", "Dotaccentsmall", "", "", "Macronsmall", "", "", "figuredash", "hypheninferior", "", "", "Ogoneksmall", "Ringsmall", "Cedillasmall", "", "", "", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"]; 29806exports.ExpertEncoding = ExpertEncoding; 29807const MacExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "", "threequartersemdash", "", "questionsmall", "", "", "", "", "Ethsmall", "", "", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "", "", "", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hypheninferior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "asuperior", "centsuperior", "", "", "", "", "Aacutesmall", "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall", "Aringsmall", "Ccedillasmall", "Eacutesmall", "Egravesmall", "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", "Igravesmall", "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall", "Ogravesmall", "Ocircumflexsmall", "Odieresissmall", "Otildesmall", "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", "Udieresissmall", "", "eightsuperior", "fourinferior", "threeinferior", "sixinferior", "eightinferior", "seveninferior", "Scaronsmall", "", "centinferior", "twoinferior", "", "Dieresissmall", "", "Caronsmall", "osuperior", "fiveinferior", "", "commainferior", "periodinferior", "Yacutesmall", "", "dollarinferior", "", "", "Thornsmall", "", "nineinferior", "zeroinferior", "Zcaronsmall", "AEsmall", "Oslashsmall", "questiondownsmall", "oneinferior", "Lslashsmall", "", "", "", "", "", "", "Cedillasmall", "", "", "", "", "", "OEsmall", "figuredash", "hyphensuperior", "", "", "", "", "exclamdownsmall", "", "Ydieresissmall", "", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "ninesuperior", "zerosuperior", "", "esuperior", "rsuperior", "tsuperior", "", "", "isuperior", "ssuperior", "dsuperior", "", "", "", "", "", "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", "", "", "", ""]; 29808const MacRomanEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "space", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron"]; 29809exports.MacRomanEncoding = MacRomanEncoding; 29810const StandardEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "", "endash", "dagger", "daggerdbl", "periodcentered", "", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "", "questiondown", "", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "", "ring", "cedilla", "", "hungarumlaut", "ogonek", "caron", "emdash", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "AE", "", "ordfeminine", "", "", "", "", "Lslash", "Oslash", "OE", "ordmasculine", "", "", "", "", "", "ae", "", "", "", "dotlessi", "", "", "lslash", "oslash", "oe", "germandbls", "", "", "", ""]; 29811exports.StandardEncoding = StandardEncoding; 29812const WinAnsiEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "bullet", "Euro", "bullet", "quotesinglbase", "florin", "quotedblbase", "ellipsis", "dagger", "daggerdbl", "circumflex", "perthousand", "Scaron", "guilsinglleft", "OE", "bullet", "Zcaron", "bullet", "bullet", "quoteleft", "quoteright", "quotedblleft", "quotedblright", "bullet", "endash", "emdash", "tilde", "trademark", "scaron", "guilsinglright", "oe", "bullet", "zcaron", "Ydieresis", "space", "exclamdown", "cent", "sterling", "currency", "yen", "brokenbar", "section", "dieresis", "copyright", "ordfeminine", "guillemotleft", "logicalnot", "hyphen", "registered", "macron", "degree", "plusminus", "twosuperior", "threesuperior", "acute", "mu", "paragraph", "periodcentered", "cedilla", "onesuperior", "ordmasculine", "guillemotright", "onequarter", "onehalf", "threequarters", "questiondown", "Agrave", "Aacute", "Acircumflex", "Atilde", "Adieresis", "Aring", "AE", "Ccedilla", "Egrave", "Eacute", "Ecircumflex", "Edieresis", "Igrave", "Iacute", "Icircumflex", "Idieresis", "Eth", "Ntilde", "Ograve", "Oacute", "Ocircumflex", "Otilde", "Odieresis", "multiply", "Oslash", "Ugrave", "Uacute", "Ucircumflex", "Udieresis", "Yacute", "Thorn", "germandbls", "agrave", "aacute", "acircumflex", "atilde", "adieresis", "aring", "ae", "ccedilla", "egrave", "eacute", "ecircumflex", "edieresis", "igrave", "iacute", "icircumflex", "idieresis", "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis"]; 29813exports.WinAnsiEncoding = WinAnsiEncoding; 29814const SymbolSetEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "congruent", "Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi", "Gamma", "Eta", "Iota", "theta1", "Kappa", "Lambda", "Mu", "Nu", "Omicron", "Pi", "Theta", "Rho", "Sigma", "Tau", "Upsilon", "sigma1", "Omega", "Xi", "Psi", "Zeta", "bracketleft", "therefore", "bracketright", "perpendicular", "underscore", "radicalex", "alpha", "beta", "chi", "delta", "epsilon", "phi", "gamma", "eta", "iota", "phi1", "kappa", "lambda", "mu", "nu", "omicron", "pi", "theta", "rho", "sigma", "tau", "upsilon", "omega1", "omega", "xi", "psi", "zeta", "braceleft", "bar", "braceright", "similar", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Euro", "Upsilon1", "minute", "lessequal", "fraction", "infinity", "florin", "club", "diamond", "heart", "spade", "arrowboth", "arrowleft", "arrowup", "arrowright", "arrowdown", "degree", "plusminus", "second", "greaterequal", "multiply", "proportional", "partialdiff", "bullet", "divide", "notequal", "equivalence", "approxequal", "ellipsis", "arrowvertex", "arrowhorizex", "carriagereturn", "aleph", "Ifraktur", "Rfraktur", "weierstrass", "circlemultiply", "circleplus", "emptyset", "intersection", "union", "propersuperset", "reflexsuperset", "notsubset", "propersubset", "reflexsubset", "element", "notelement", "angle", "gradient", "registerserif", "copyrightserif", "trademarkserif", "product", "radical", "dotmath", "logicalnot", "logicaland", "logicalor", "arrowdblboth", "arrowdblleft", "arrowdblup", "arrowdblright", "arrowdbldown", "lozenge", "angleleft", "registersans", "copyrightsans", "trademarksans", "summation", "parenlefttp", "parenleftex", "parenleftbt", "bracketlefttp", "bracketleftex", "bracketleftbt", "bracelefttp", "braceleftmid", "braceleftbt", "braceex", "", "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", ""]; 29815exports.SymbolSetEncoding = SymbolSetEncoding; 29816const ZapfDingbatsEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26", "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30", "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39", "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48", "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57", "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203", "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83", "a84", "a97", "a98", "a99", "a100", "", "a89", "a90", "a93", "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88", "a95", "a96", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "a101", "a102", "a103", "a104", "a106", "a107", "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132", "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141", "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150", "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159", "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167", "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175", "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200", "a182", "", "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", ""]; 29817exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
vendor: 8,136 bytes, lines 29818-30029
29818 29819function getEncoding(encodingName) { 29820 switch (encodingName) { 29821 case "WinAnsiEncoding": 29822 return WinAnsiEncoding; 29823 29824 case "StandardEncoding": 29825 return StandardEncoding; 29826 29827 case "MacRomanEncoding": 29828 return MacRomanEncoding; 29829 29830 case "SymbolSetEncoding": 29831 return SymbolSetEncoding; 29832 29833 case "ZapfDingbatsEncoding": 29834 return ZapfDingbatsEncoding; 29835 29836 case "ExpertEncoding": 29837 return ExpertEncoding; 29838 29839 case "MacExpertEncoding": 29840 return MacExpertEncoding; 29841 29842 default: 29843 return null; 29844 } 29845} 29846 29847/***/ }), 29848/* 38 */ 29849/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 29850 29851 29852 29853Object.defineProperty(exports, "__esModule", ({ 29854 value: true 29855})); 29856exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0; 29857exports.getFontType = getFontType; 29858exports.normalizeFontName = normalizeFontName; 29859exports.recoverGlyphName = recoverGlyphName; 29860exports.type1FontGlyphMapping = type1FontGlyphMapping; 29861 29862var _util = __w_pdfjs_require__(2); 29863 29864var _encodings = __w_pdfjs_require__(37); 29865 29866var _glyphlist = __w_pdfjs_require__(39); 29867 29868var _unicode = __w_pdfjs_require__(40); 29869 29870const SEAC_ANALYSIS_ENABLED = true; 29871exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED; 29872const FontFlags = { 29873 FixedPitch: 1, 29874 Serif: 2, 29875 Symbolic: 4, 29876 Script: 8, 29877 Nonsymbolic: 32, 29878 Italic: 64, 29879 AllCap: 65536, 29880 SmallCap: 131072, 29881 ForceBold: 262144 29882}; 29883exports.FontFlags = FontFlags; 29884const MacStandardGlyphOrdering = [".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"]; 29885exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering; 29886 29887function getFontType(type, subtype, isStandardFont = false) { 29888 switch (type) { 29889 case "Type1": 29890 if (isStandardFont) { 29891 return _util.FontType.TYPE1STANDARD; 29892 } 29893 29894 return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1; 29895 29896 case "CIDFontType0": 29897 return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0; 29898 29899 case "OpenType": 29900 return _util.FontType.OPENTYPE; 29901 29902 case "TrueType": 29903 return _util.FontType.TRUETYPE; 29904 29905 case "CIDFontType2": 29906 return _util.FontType.CIDFONTTYPE2; 29907 29908 case "MMType1": 29909 return _util.FontType.MMTYPE1; 29910 29911 case "Type0": 29912 return _util.FontType.TYPE0; 29913 29914 default: 29915 return _util.FontType.UNKNOWN; 29916 } 29917} 29918 29919function recoverGlyphName(name, glyphsUnicodeMap) { 29920 if (glyphsUnicodeMap[name] !== undefined) { 29921 return name; 29922 } 29923 29924 const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap); 29925 29926 if (unicode !== -1) { 29927 for (const key in glyphsUnicodeMap) { 29928 if (glyphsUnicodeMap[key] === unicode) { 29929 return key; 29930 } 29931 } 29932 } 29933 29934 (0, _util.info)("Unable to recover a standard glyph name for: " + name); 29935 return name; 29936} 29937 29938function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { 29939 const charCodeToGlyphId = Object.create(null); 29940 let glyphId, charCode, baseEncoding; 29941 const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 29942 29943 if (properties.isInternalFont) { 29944 baseEncoding = builtInEncoding; 29945 29946 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 29947 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 29948 29949 if (glyphId >= 0) { 29950 charCodeToGlyphId[charCode] = glyphId; 29951 } else { 29952 charCodeToGlyphId[charCode] = 0; 29953 } 29954 } 29955 } else if (properties.baseEncodingName) { 29956 baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName); 29957 29958 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 29959 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 29960 29961 if (glyphId >= 0) { 29962 charCodeToGlyphId[charCode] = glyphId; 29963 } else { 29964 charCodeToGlyphId[charCode] = 0; 29965 } 29966 } 29967 } else if (isSymbolicFont) { 29968 for (charCode in builtInEncoding) { 29969 charCodeToGlyphId[charCode] = builtInEncoding[charCode]; 29970 } 29971 } else { 29972 baseEncoding = _encodings.StandardEncoding; 29973 29974 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 29975 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 29976 29977 if (glyphId >= 0) { 29978 charCodeToGlyphId[charCode] = glyphId; 29979 } else { 29980 charCodeToGlyphId[charCode] = 0; 29981 } 29982 } 29983 } 29984 29985 const differences = properties.differences; 29986 let glyphsUnicodeMap; 29987 29988 if (differences) { 29989 for (charCode in differences) { 29990 const glyphName = differences[charCode]; 29991 glyphId = glyphNames.indexOf(glyphName); 29992 29993 if (glyphId === -1) { 29994 if (!glyphsUnicodeMap) { 29995 glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 29996 } 29997 29998 const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); 29999 30000 if (standardGlyphName !== glyphName) { 30001 glyphId = glyphNames.indexOf(standardGlyphName); 30002 } 30003 } 30004 30005 if (glyphId >= 0) { 30006 charCodeToGlyphId[charCode] = glyphId; 30007 } else { 30008 charCodeToGlyphId[charCode] = 0; 30009 } 30010 } 30011 } 30012 30013 return charCodeToGlyphId; 30014} 30015 30016function normalizeFontName(name) { 30017 return name.replace(/[,_]/g, "-").replace(/\s/g, ""); 30018} 30019 30020/***/ }), 30021/* 39 */ 30022/***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => { 30023 30024__w_pdfjs_require__.r(__webpack_exports__); 30025/* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, { 30026/* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode), 30027/* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode) 30028/* harmony export */ }); 30029/* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(6
vendor: 48,309 bytes, lines 30029-33655
30029); 30030 30031const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () { 30032 return [ 30033 "A", 30034 0x0041, 30035 "AE", 30036 0x00c6, 30037 "AEacute", 30038 0x01fc, 30039 "AEmacron", 30040 0x01e2, 30041 "AEsmall", 30042 0xf7e6, 30043 "Aacute", 30044 0x00c1, 30045 "Aacutesmall", 30046 0xf7e1, 30047 "Abreve", 30048 0x0102, 30049 "Abreveacute", 30050 0x1eae, 30051 "Abrevecyrillic", 30052 0x04d0, 30053 "Abrevedotbelow", 30054 0x1eb6, 30055 "Abrevegrave", 30056 0x1eb0, 30057 "Abrevehookabove", 30058 0x1eb2, 30059 "Abrevetilde", 30060 0x1eb4, 30061 "Acaron", 30062 0x01cd, 30063 "Acircle", 30064 0x24b6, 30065 "Acircumflex", 30066 0x00c2, 30067 "Acircumflexacute", 30068 0x1ea4, 30069 "Acircumflexdotbelow", 30070 0x1eac, 30071 "Acircumflexgrave", 30072 0x1ea6, 30073 "Acircumflexhookabove", 30074 0x1ea8, 30075 "Acircumflexsmall", 30076 0xf7e2, 30077 "Acircumflextilde", 30078 0x1eaa, 30079 "Acute", 30080 0xf6c9, 30081 "Acutesmall", 30082 0xf7b4, 30083 "Acyrillic", 30084 0x0410, 30085 "Adblgrave", 30086 0x0200, 30087 "Adieresis", 30088 0x00c4, 30089 "Adieresiscyrillic", 30090 0x04d2, 30091 "Adieresismacron", 30092 0x01de, 30093 "Adieresissmall", 30094 0xf7e4, 30095 "Adotbelow", 30096 0x1ea0, 30097 "Adotmacron", 30098 0x01e0, 30099 "Agrave", 30100 0x00c0, 30101 "Agravesmall", 30102 0xf7e0, 30103 "Ahookabove", 30104 0x1ea2, 30105 "Aiecyrillic", 30106 0x04d4, 30107 "Ainvertedbreve", 30108 0x0202, 30109 "Alpha", 30110 0x0391, 30111 "Alphatonos", 30112 0x0386, 30113 "Amacron", 30114 0x0100, 30115 "Amonospace", 30116 0xff21, 30117 "Aogonek", 30118 0x0104, 30119 "Aring", 30120 0x00c5, 30121 "Aringacute", 30122 0x01fa, 30123 "Aringbelow", 30124 0x1e00, 30125 "Aringsmall", 30126 0xf7e5, 30127 "Asmall", 30128 0xf761, 30129 "Atilde", 30130 0x00c3, 30131 "Atildesmall", 30132 0xf7e3, 30133 "Aybarmenian", 30134 0x0531, 30135 "B", 30136 0x0042, 30137 "Bcircle", 30138 0x24b7, 30139 "Bdotaccent", 30140 0x1e02, 30141 "Bdotbelow", 30142 0x1e04, 30143 "Becyrillic", 30144 0x0411, 30145 "Benarmenian", 30146 0x0532, 30147 "Beta", 30148 0x0392, 30149 "Bhook", 30150 0x0181, 30151 "Blinebelow", 30152 0x1e06, 30153 "Bmonospace", 30154 0xff22, 30155 "Brevesmall", 30156 0xf6f4, 30157 "Bsmall", 30158 0xf762, 30159 "Btopbar", 30160 0x0182, 30161 "C", 30162 0x0043, 30163 "Caarmenian", 30164 0x053e, 30165 "Cacute", 30166 0x0106, 30167 "Caron", 30168 0xf6ca, 30169 "Caronsmall", 30170 0xf6f5, 30171 "Ccaron", 30172 0x010c, 30173 "Ccedilla", 30174 0x00c7, 30175 "Ccedillaacute", 30176 0x1e08, 30177 "Ccedillasmall", 30178 0xf7e7, 30179 "Ccircle", 30180 0x24b8, 30181 "Ccircumflex", 30182 0x0108, 30183 "Cdot", 30184 0x010a, 30185 "Cdotaccent", 30186 0x010a, 30187 "Cedillasmall", 30188 0xf7b8, 30189 "Chaarmenian", 30190 0x0549, 30191 "Cheabkhasiancyrillic", 30192 0x04bc, 30193 "Checyrillic", 30194 0x0427, 30195 "Chedescenderabkhasiancyrillic", 30196 0x04be, 30197 "Chedescendercyrillic", 30198 0x04b6, 30199 "Chedieresiscyrillic", 30200 0x04f4, 30201 "Cheharmenian", 30202 0x0543, 30203 "Chekhakassiancyrillic", 30204 0x04cb, 30205 "Cheverticalstrokecyrillic", 30206 0x04b8, 30207 "Chi", 30208 0x03a7, 30209 "Chook", 30210 0x0187, 30211 "Circumflexsmall", 30212 0xf6f6, 30213 "Cmonospace", 30214 0xff23, 30215 "Coarmenian", 30216 0x0551, 30217 "Csmall", 30218 0xf763, 30219 "D", 30220 0x0044, 30221 "DZ", 30222 0x01f1, 30223 "DZcaron", 30224 0x01c4, 30225 "Daarmenian", 30226 0x0534, 30227 "Dafrican", 30228 0x0189, 30229 "Dcaron", 30230 0x010e, 30231 "Dcedilla", 30232 0x1e10, 30233 "Dcircle", 30234 0x24b9, 30235 "Dcircumflexbelow", 30236 0x1e12, 30237 "Dcroat", 30238 0x0110, 30239 "Ddotaccent", 30240 0x1e0a, 30241 "Ddotbelow", 30242 0x1e0c, 30243 "Decyrillic", 30244 0x0414, 30245 "Deicoptic", 30246 0x03ee, 30247 "Delta", 30248 0x2206, 30249 "Deltagreek", 30250 0x0394, 30251 "Dhook", 30252 0x018a, 30253 "Dieresis", 30254 0xf6cb, 30255 "DieresisAcute", 30256 0xf6cc, 30257 "DieresisGrave", 30258 0xf6cd, 30259 "Dieresissmall", 30260 0xf7a8, 30261 "Digammagreek", 30262 0x03dc, 30263 "Djecyrillic", 30264 0x0402, 30265 "Dlinebelow", 30266 0x1e0e, 30267 "Dmonospace", 30268 0xff24, 30269 "Dotaccentsmall", 30270 0xf6f7, 30271 "Dslash", 30272 0x0110, 30273 "Dsmall", 30274 0xf764, 30275 "Dtopbar", 30276 0x018b, 30277 "Dz", 30278 0x01f2, 30279 "Dzcaron", 30280 0x01c5, 30281 "Dzeabkhasiancyrillic", 30282 0x04e0, 30283 "Dzecyrillic", 30284 0x0405, 30285 "Dzhecyrillic", 30286 0x040f, 30287 "E", 30288 0x0045, 30289 "Eacute", 30290 0x00c9, 30291 "Eacutesmall", 30292 0xf7e9, 30293 "Ebreve", 30294 0x0114, 30295 "Ecaron", 30296 0x011a, 30297 "Ecedillabreve", 30298 0x1e1c, 30299 "Echarmenian", 30300 0x0535, 30301 "Ecircle", 30302 0x24ba, 30303 "Ecircumflex", 30304 0x00ca, 30305 "Ecircumflexacute", 30306 0x1ebe, 30307 "Ecircumflexbelow", 30308 0x1e18, 30309 "Ecircumflexdotbelow", 30310 0x1ec6, 30311 "Ecircumflexgrave", 30312 0x1ec0, 30313 "Ecircumflexhookabove", 30314 0x1ec2, 30315 "Ecircumflexsmall", 30316 0xf7ea, 30317 "Ecircumflextilde", 30318 0x1ec4, 30319 "Ecyrillic", 30320 0x0404, 30321 "Edblgrave", 30322 0x0204, 30323 "Edieresis", 30324 0x00cb, 30325 "Edieresissmall", 30326 0xf7eb, 30327 "Edot", 30328 0x0116, 30329 "Edotaccent", 30330 0x0116, 30331 "Edotbelow", 30332 0x1eb8, 30333 "Efcyrillic", 30334 0x0424, 30335 "Egrave", 30336 0x00c8, 30337 "Egravesmall", 30338 0xf7e8, 30339 "Eharmenian", 30340 0x0537, 30341 "Ehookabove", 30342 0x1eba, 30343 "Eightroman", 30344 0x2167, 30345 "Einvertedbreve", 30346 0x0206, 30347 "Eiotifiedcyrillic", 30348 0x0464, 30349 "Elcyrillic", 30350 0x041b, 30351 "Elevenroman", 30352 0x216a, 30353 "Emacron", 30354 0x0112, 30355 "Emacronacute", 30356 0x1e16, 30357 "Emacrongrave", 30358 0x1e14, 30359 "Emcyrillic", 30360 0x041c, 30361 "Emonospace", 30362 0xff25, 30363 "Encyrillic", 30364 0x041d, 30365 "Endescendercyrillic", 30366 0x04a2, 30367 "Eng", 30368 0x014a, 30369 "Enghecyrillic", 30370 0x04a4, 30371 "Enhookcyrillic", 30372 0x04c7, 30373 "Eogonek", 30374 0x0118, 30375 "Eopen", 30376 0x0190, 30377 "Epsilon", 30378 0x0395, 30379 "Epsilontonos", 30380 0x0388, 30381 "Ercyrillic", 30382 0x0420, 30383 "Ereversed", 30384 0x018e, 30385 "Ereversedcyrillic", 30386 0x042d, 30387 "Escyrillic", 30388 0x0421, 30389 "Esdescendercyrillic", 30390 0x04aa, 30391 "Esh", 30392 0x01a9, 30393 "Esmall", 30394 0xf765, 30395 "Eta", 30396 0x0397, 30397 "Etarmenian", 30398 0x0538, 30399 "Etatonos", 30400 0x0389, 30401 "Eth", 30402 0x00d0, 30403 "Ethsmall", 30404 0xf7f0, 30405 "Etilde", 30406 0x1ebc, 30407 "Etildebelow", 30408 0x1e1a, 30409 "Euro", 30410 0x20ac, 30411 "Ezh", 30412 0x01b7, 30413 "Ezhcaron", 30414 0x01ee, 30415 "Ezhreversed", 30416 0x01b8, 30417 "F", 30418 0x0046, 30419 "Fcircle", 30420 0x24bb, 30421 "Fdotaccent", 30422 0x1e1e, 30423 "Feharmenian", 30424 0x0556, 30425 "Feicoptic", 30426 0x03e4, 30427 "Fhook", 30428 0x0191, 30429 "Fitacyrillic", 30430 0x0472, 30431 "Fiveroman", 30432 0x2164, 30433 "Fmonospace", 30434 0xff26, 30435 "Fourroman", 30436 0x2163, 30437 "Fsmall", 30438 0xf766, 30439 "G", 30440 0x0047, 30441 "GBsquare", 30442 0x3387, 30443 "Gacute", 30444 0x01f4, 30445 "Gamma", 30446 0x0393, 30447 "Gammaafrican", 30448 0x0194, 30449 "Gangiacoptic", 30450 0x03ea, 30451 "Gbreve", 30452 0x011e, 30453 "Gcaron", 30454 0x01e6, 30455 "Gcedilla", 30456 0x0122, 30457 "Gcircle", 30458 0x24bc, 30459 "Gcircumflex", 30460 0x011c, 30461 "Gcommaaccent", 30462 0x0122, 30463 "Gdot", 30464 0x0120, 30465 "Gdotaccent", 30466 0x0120, 30467 "Gecyrillic", 30468 0x0413, 30469 "Ghadarmenian", 30470 0x0542, 30471 "Ghemiddlehookcyrillic", 30472 0x0494, 30473 "Ghestrokecyrillic", 30474 0x0492, 30475 "Gheupturncyrillic", 30476 0x0490, 30477 "Ghook", 30478 0x0193, 30479 "Gimarmenian", 30480 0x0533, 30481 "Gjecyrillic", 30482 0x0403, 30483 "Gmacron", 30484 0x1e20, 30485 "Gmonospace", 30486 0xff27, 30487 "Grave", 30488 0xf6ce, 30489 "Gravesmall", 30490 0xf760, 30491 "Gsmall", 30492 0xf767, 30493 "Gsmallhook", 30494 0x029b, 30495 "Gstroke", 30496 0x01e4, 30497 "H", 30498 0x0048, 30499 "H18533", 30500 0x25cf, 30501 "H18543", 30502 0x25aa, 30503 "H18551", 30504 0x25ab, 30505 "H22073", 30506 0x25a1, 30507 "HPsquare", 30508 0x33cb, 30509 "Haabkhasiancyrillic", 30510 0x04a8, 30511 "Hadescendercyrillic", 30512 0x04b2, 30513 "Hardsigncyrillic", 30514 0x042a, 30515 "Hbar", 30516 0x0126, 30517 "Hbrevebelow", 30518 0x1e2a, 30519 "Hcedilla", 30520 0x1e28, 30521 "Hcircle", 30522 0x24bd, 30523 "Hcircumflex", 30524 0x0124, 30525 "Hdieresis", 30526 0x1e26, 30527 "Hdotaccent", 30528 0x1e22, 30529 "Hdotbelow", 30530 0x1e24, 30531 "Hmonospace", 30532 0xff28, 30533 "Hoarmenian", 30534 0x0540, 30535 "Horicoptic", 30536 0x03e8, 30537 "Hsmall", 30538 0xf768, 30539 "Hungarumlaut", 30540 0xf6cf, 30541 "Hungarumlautsmall", 30542 0xf6f8, 30543 "Hzsquare", 30544 0x3390, 30545 "I", 30546 0x0049, 30547 "IAcyrillic", 30548 0x042f, 30549 "IJ", 30550 0x0132, 30551 "IUcyrillic", 30552 0x042e, 30553 "Iacute", 30554 0x00cd, 30555 "Iacutesmall", 30556 0xf7ed, 30557 "Ibreve", 30558 0x012c, 30559 "Icaron", 30560 0x01cf, 30561 "Icircle", 30562 0x24be, 30563 "Icircumflex", 30564 0x00ce, 30565 "Icircumflexsmall", 30566 0xf7ee, 30567 "Icyrillic", 30568 0x0406, 30569 "Idblgrave", 30570 0x0208, 30571 "Idieresis", 30572 0x00cf, 30573 "Idieresisacute", 30574 0x1e2e, 30575 "Idieresiscyrillic", 30576 0x04e4, 30577 "Idieresissmall", 30578 0xf7ef, 30579 "Idot", 30580 0x0130, 30581 "Idotaccent", 30582 0x0130, 30583 "Idotbelow", 30584 0x1eca, 30585 "Iebrevecyrillic", 30586 0x04d6, 30587 "Iecyrillic", 30588 0x0415, 30589 "Ifraktur", 30590 0x2111, 30591 "Igrave", 30592 0x00cc, 30593 "Igravesmall", 30594 0xf7ec, 30595 "Ihookabove", 30596 0x1ec8, 30597 "Iicyrillic", 30598 0x0418, 30599 "Iinvertedbreve", 30600 0x020a, 30601 "Iishortcyrillic", 30602 0x0419, 30603 "Imacron", 30604 0x012a, 30605 "Imacroncyrillic", 30606 0x04e2, 30607 "Imonospace", 30608 0xff29, 30609 "Iniarmenian", 30610 0x053b, 30611 "Iocyrillic", 30612 0x0401, 30613 "Iogonek", 30614 0x012e, 30615 "Iota", 30616 0x0399, 30617 "Iotaafrican", 30618 0x0196, 30619 "Iotadieresis", 30620 0x03aa, 30621 "Iotatonos", 30622 0x038a, 30623 "Ismall", 30624 0xf769, 30625 "Istroke", 30626 0x0197, 30627 "Itilde", 30628 0x0128, 30629 "Itildebelow", 30630 0x1e2c, 30631 "Izhitsacyrillic", 30632 0x0474, 30633 "Izhitsadblgravecyrillic", 30634 0x0476, 30635 "J", 30636 0x004a, 30637 "Jaarmenian", 30638 0x0541, 30639 "Jcircle", 30640 0x24bf, 30641 "Jcircumflex", 30642 0x0134, 30643 "Jecyrillic", 30644 0x0408, 30645 "Jheharmenian", 30646 0x054b, 30647 "Jmonospace", 30648 0xff2a, 30649 "Jsmall", 30650 0xf76a, 30651 "K", 30652 0x004b, 30653 "KBsquare", 30654 0x3385, 30655 "KKsquare", 30656 0x33cd, 30657 "Kabashkircyrillic", 30658 0x04a0, 30659 "Kacute", 30660 0x1e30, 30661 "Kacyrillic", 30662 0x041a, 30663 "Kadescendercyrillic", 30664 0x049a, 30665 "Kahookcyrillic", 30666 0x04c3, 30667 "Kappa", 30668 0x039a, 30669 "Kastrokecyrillic", 30670 0x049e, 30671 "Kaverticalstrokecyrillic", 30672 0x049c, 30673 "Kcaron", 30674 0x01e8, 30675 "Kcedilla", 30676 0x0136, 30677 "Kcircle", 30678 0x24c0, 30679 "Kcommaaccent", 30680 0x0136, 30681 "Kdotbelow", 30682 0x1e32, 30683 "Keharmenian", 30684 0x0554, 30685 "Kenarmenian", 30686 0x053f, 30687 "Khacyrillic", 30688 0x0425, 30689 "Kheicoptic", 30690 0x03e6, 30691 "Khook", 30692 0x0198, 30693 "Kjecyrillic", 30694 0x040c, 30695 "Klinebelow", 30696 0x1e34, 30697 "Kmonospace", 30698 0xff2b, 30699 "Koppacyrillic", 30700 0x0480, 30701 "Koppagreek", 30702 0x03de, 30703 "Ksicyrillic", 30704 0x046e, 30705 "Ksmall", 30706 0xf76b, 30707 "L", 30708 0x004c, 30709 "LJ", 30710 0x01c7, 30711 "LL", 30712 0xf6bf, 30713 "Lacute", 30714 0x0139, 30715 "Lambda", 30716 0x039b, 30717 "Lcaron", 30718 0x013d, 30719 "Lcedilla", 30720 0x013b, 30721 "Lcircle", 30722 0x24c1, 30723 "Lcircumflexbelow", 30724 0x1e3c, 30725 "Lcommaaccent", 30726 0x013b, 30727 "Ldot", 30728 0x013f, 30729 "Ldotaccent", 30730 0x013f, 30731 "Ldotbelow", 30732 0x1e36, 30733 "Ldotbelowmacron", 30734 0x1e38, 30735 "Liwnarmenian", 30736 0x053c, 30737 "Lj", 30738 0x01c8, 30739 "Ljecyrillic", 30740 0x0409, 30741 "Llinebelow", 30742 0x1e3a, 30743 "Lmonospace", 30744 0xff2c, 30745 "Lslash", 30746 0x0141, 30747 "Lslashsmall", 30748 0xf6f9, 30749 "Lsmall", 30750 0xf76c, 30751 "M", 30752 0x004d, 30753 "MBsquare", 30754 0x3386, 30755 "Macron", 30756 0xf6d0, 30757 "Macronsmall", 30758 0xf7af, 30759 "Macute", 30760 0x1e3e, 30761 "Mcircle", 30762 0x24c2, 30763 "Mdotaccent", 30764 0x1e40, 30765 "Mdotbelow", 30766 0x1e42, 30767 "Menarmenian", 30768 0x0544, 30769 "Mmonospace", 30770 0xff2d, 30771 "Msmall", 30772 0xf76d, 30773 "Mturned", 30774 0x019c, 30775 "Mu", 30776 0x039c, 30777 "N", 30778 0x004e, 30779 "NJ", 30780 0x01ca, 30781 "Nacute", 30782 0x0143, 30783 "Ncaron", 30784 0x0147, 30785 "Ncedilla", 30786 0x0145, 30787 "Ncircle", 30788 0x24c3, 30789 "Ncircumflexbelow", 30790 0x1e4a, 30791 "Ncommaaccent", 30792 0x0145, 30793 "Ndotaccent", 30794 0x1e44, 30795 "Ndotbelow", 30796 0x1e46, 30797 "Nhookleft", 30798 0x019d, 30799 "Nineroman", 30800 0x2168, 30801 "Nj", 30802 0x01cb, 30803 "Njecyrillic", 30804 0x040a, 30805 "Nlinebelow", 30806 0x1e48, 30807 "Nmonospace", 30808 0xff2e, 30809 "Nowarmenian", 30810 0x0546, 30811 "Nsmall", 30812 0xf76e, 30813 "Ntilde", 30814 0x00d1, 30815 "Ntildesmall", 30816 0xf7f1, 30817 "Nu", 30818 0x039d, 30819 "O", 30820 0x004f, 30821 "OE", 30822 0x0152, 30823 "OEsmall", 30824 0xf6fa, 30825 "Oacute", 30826 0x00d3, 30827 "Oacutesmall", 30828 0xf7f3, 30829 "Obarredcyrillic", 30830 0x04e8, 30831 "Obarreddieresiscyrillic", 30832 0x04ea, 30833 "Obreve", 30834 0x014e, 30835 "Ocaron", 30836 0x01d1, 30837 "Ocenteredtilde", 30838 0x019f, 30839 "Ocircle", 30840 0x24c4, 30841 "Ocircumflex", 30842 0x00d4, 30843 "Ocircumflexacute", 30844 0x1ed0, 30845 "Ocircumflexdotbelow", 30846 0x1ed8, 30847 "Ocircumflexgrave", 30848 0x1ed2, 30849 "Ocircumflexhookabove", 30850 0x1ed4, 30851 "Ocircumflexsmall", 30852 0xf7f4, 30853 "Ocircumflextilde", 30854 0x1ed6, 30855 "Ocyrillic", 30856 0x041e, 30857 "Odblacute", 30858 0x0150, 30859 "Odblgrave", 30860 0x020c, 30861 "Odieresis", 30862 0x00d6, 30863 "Odieresiscyrillic", 30864 0x04e6, 30865 "Odieresissmall", 30866 0xf7f6, 30867 "Odotbelow", 30868 0x1ecc, 30869 "Ogoneksmall", 30870 0xf6fb, 30871 "Ograve", 30872 0x00d2, 30873 "Ogravesmall", 30874 0xf7f2, 30875 "Oharmenian", 30876 0x0555, 30877 "Ohm", 30878 0x2126, 30879 "Ohookabove", 30880 0x1ece, 30881 "Ohorn", 30882 0x01a0, 30883 "Ohornacute", 30884 0x1eda, 30885 "Ohorndotbelow", 30886 0x1ee2, 30887 "Ohorngrave", 30888 0x1edc, 30889 "Ohornhookabove", 30890 0x1ede, 30891 "Ohorntilde", 30892 0x1ee0, 30893 "Ohungarumlaut", 30894 0x0150, 30895 "Oi", 30896 0x01a2, 30897 "Oinvertedbreve", 30898 0x020e, 30899 "Omacron", 30900 0x014c, 30901 "Omacronacute", 30902 0x1e52, 30903 "Omacrongrave", 30904 0x1e50, 30905 "Omega", 30906 0x2126, 30907 "Omegacyrillic", 30908 0x0460, 30909 "Omegagreek", 30910 0x03a9, 30911 "Omegaroundcyrillic", 30912 0x047a, 30913 "Omegatitlocyrillic", 30914 0x047c, 30915 "Omegatonos", 30916 0x038f, 30917 "Omicron", 30918 0x039f, 30919 "Omicrontonos", 30920 0x038c, 30921 "Omonospace", 30922 0xff2f, 30923 "Oneroman", 30924 0x2160, 30925 "Oogonek", 30926 0x01ea, 30927 "Oogonekmacron", 30928 0x01ec, 30929 "Oopen", 30930 0x0186, 30931 "Oslash", 30932 0x00d8, 30933 "Oslashacute", 30934 0x01fe, 30935 "Oslashsmall", 30936 0xf7f8, 30937 "Osmall", 30938 0xf76f, 30939 "Ostrokeacute", 30940 0x01fe, 30941 "Otcyrillic", 30942 0x047e, 30943 "Otilde", 30944 0x00d5, 30945 "Otildeacute", 30946 0x1e4c, 30947 "Otildedieresis", 30948 0x1e4e, 30949 "Otildesmall", 30950 0xf7f5, 30951 "P", 30952 0x0050, 30953 "Pacute", 30954 0x1e54, 30955 "Pcircle", 30956 0x24c5, 30957 "Pdotaccent", 30958 0x1e56, 30959 "Pecyrillic", 30960 0x041f, 30961 "Peharmenian", 30962 0x054a, 30963 "Pemiddlehookcyrillic", 30964 0x04a6, 30965 "Phi", 30966 0x03a6, 30967 "Phook", 30968 0x01a4, 30969 "Pi", 30970 0x03a0, 30971 "Piwrarmenian", 30972 0x0553, 30973 "Pmonospace", 30974 0xff30, 30975 "Psi", 30976 0x03a8, 30977 "Psicyrillic", 30978 0x0470, 30979 "Psmall", 30980 0xf770, 30981 "Q", 30982 0x0051, 30983 "Qcircle", 30984 0x24c6, 30985 "Qmonospace", 30986 0xff31, 30987 "Qsmall", 30988 0xf771, 30989 "R", 30990 0x0052, 30991 "Raarmenian", 30992 0x054c, 30993 "Racute", 30994 0x0154, 30995 "Rcaron", 30996 0x0158, 30997 "Rcedilla", 30998 0x0156, 30999 "Rcircle", 31000 0x24c7, 31001 "Rcommaaccent", 31002 0x0156, 31003 "Rdblgrave", 31004 0x0210, 31005 "Rdotaccent", 31006 0x1e58, 31007 "Rdotbelow", 31008 0x1e5a, 31009 "Rdotbelowmacron", 31010 0x1e5c, 31011 "Reharmenian", 31012 0x0550, 31013 "Rfraktur", 31014 0x211c, 31015 "Rho", 31016 0x03a1, 31017 "Ringsmall", 31018 0xf6fc, 31019 "Rinvertedbreve", 31020 0x0212, 31021 "Rlinebelow", 31022 0x1e5e, 31023 "Rmonospace", 31024 0xff32, 31025 "Rsmall", 31026 0xf772, 31027 "Rsmallinverted", 31028 0x0281, 31029 "Rsmallinvertedsuperior", 31030 0x02b6, 31031 "S", 31032 0x0053, 31033 "SF010000", 31034 0x250c, 31035 "SF020000", 31036 0x2514, 31037 "SF030000", 31038 0x2510, 31039 "SF040000", 31040 0x2518, 31041 "SF050000", 31042 0x253c, 31043 "SF060000", 31044 0x252c, 31045 "SF070000", 31046 0x2534, 31047 "SF080000", 31048 0x251c, 31049 "SF090000", 31050 0x2524, 31051 "SF100000", 31052 0x2500, 31053 "SF110000", 31054 0x2502, 31055 "SF190000", 31056 0x2561, 31057 "SF200000", 31058 0x2562, 31059 "SF210000", 31060 0x2556, 31061 "SF220000", 31062 0x2555, 31063 "SF230000", 31064 0x2563, 31065 "SF240000", 31066 0x2551, 31067 "SF250000", 31068 0x2557, 31069 "SF260000", 31070 0x255d, 31071 "SF270000", 31072 0x255c, 31073 "SF280000", 31074 0x255b, 31075 "SF360000", 31076 0x255e, 31077 "SF370000", 31078 0x255f, 31079 "SF380000", 31080 0x255a, 31081 "SF390000", 31082 0x2554, 31083 "SF400000", 31084 0x2569, 31085 "SF410000", 31086 0x2566, 31087 "SF420000", 31088 0x2560, 31089 "SF430000", 31090 0x2550, 31091 "SF440000", 31092 0x256c, 31093 "SF450000", 31094 0x2567, 31095 "SF460000", 31096 0x2568, 31097 "SF470000", 31098 0x2564, 31099 "SF480000", 31100 0x2565, 31101 "SF490000", 31102 0x2559, 31103 "SF500000", 31104 0x2558, 31105 "SF510000", 31106 0x2552, 31107 "SF520000", 31108 0x2553, 31109 "SF530000", 31110 0x256b, 31111 "SF540000", 31112 0x256a, 31113 "Sacute", 31114 0x015a, 31115 "Sacutedotaccent", 31116 0x1e64, 31117 "Sampigreek", 31118 0x03e0, 31119 "Scaron", 31120 0x0160, 31121 "Scarondotaccent", 31122 0x1e66, 31123 "Scaronsmall", 31124 0xf6fd, 31125 "Scedilla", 31126 0x015e, 31127 "Schwa", 31128 0x018f, 31129 "Schwacyrillic", 31130 0x04d8, 31131 "Schwadieresiscyrillic", 31132 0x04da, 31133 "Scircle", 31134 0x24c8, 31135 "Scircumflex", 31136 0x015c, 31137 "Scommaaccent", 31138 0x0218, 31139 "Sdotaccent", 31140 0x1e60, 31141 "Sdotbelow", 31142 0x1e62, 31143 "Sdotbelowdotaccent", 31144 0x1e68, 31145 "Seharmenian", 31146 0x054d, 31147 "Sevenroman", 31148 0x2166, 31149 "Shaarmenian", 31150 0x0547, 31151 "Shacyrillic", 31152 0x0428, 31153 "Shchacyrillic", 31154 0x0429, 31155 "Sheicoptic", 31156 0x03e2, 31157 "Shhacyrillic", 31158 0x04ba, 31159 "Shimacoptic", 31160 0x03ec, 31161 "Sigma", 31162 0x03a3, 31163 "Sixroman", 31164 0x2165, 31165 "Smonospace", 31166 0xff33, 31167 "Softsigncyrillic", 31168 0x042c, 31169 "Ssmall", 31170 0xf773, 31171 "Stigmagreek", 31172 0x03da, 31173 "T", 31174 0x0054, 31175 "Tau", 31176 0x03a4, 31177 "Tbar", 31178 0x0166, 31179 "Tcaron", 31180 0x0164, 31181 "Tcedilla", 31182 0x0162, 31183 "Tcircle", 31184 0x24c9, 31185 "Tcircumflexbelow", 31186 0x1e70, 31187 "Tcommaaccent", 31188 0x0162, 31189 "Tdotaccent", 31190 0x1e6a, 31191 "Tdotbelow", 31192 0x1e6c, 31193 "Tecyrillic", 31194 0x0422, 31195 "Tedescendercyrillic", 31196 0x04ac, 31197 "Tenroman", 31198 0x2169, 31199 "Tetsecyrillic", 31200 0x04b4, 31201 "Theta", 31202 0x0398, 31203 "Thook", 31204 0x01ac, 31205 "Thorn", 31206 0x00de, 31207 "Thornsmall", 31208 0xf7fe, 31209 "Threeroman", 31210 0x2162, 31211 "Tildesmall", 31212 0xf6fe, 31213 "Tiwnarmenian", 31214 0x054f, 31215 "Tlinebelow", 31216 0x1e6e, 31217 "Tmonospace", 31218 0xff34, 31219 "Toarmenian", 31220 0x0539, 31221 "Tonefive", 31222 0x01bc, 31223 "Tonesix", 31224 0x0184, 31225 "Tonetwo", 31226 0x01a7, 31227 "Tretroflexhook", 31228 0x01ae, 31229 "Tsecyrillic", 31230 0x0426, 31231 "Tshecyrillic", 31232 0x040b, 31233 "Tsmall", 31234 0xf774, 31235 "Twelveroman", 31236 0x216b, 31237 "Tworoman", 31238 0x2161, 31239 "U", 31240 0x0055, 31241 "Uacute", 31242 0x00da, 31243 "Uacutesmall", 31244 0xf7fa, 31245 "Ubreve", 31246 0x016c, 31247 "Ucaron", 31248 0x01d3, 31249 "Ucircle", 31250 0x24ca, 31251 "Ucircumflex", 31252 0x00db, 31253 "Ucircumflexbelow", 31254 0x1e76, 31255 "Ucircumflexsmall", 31256 0xf7fb, 31257 "Ucyrillic", 31258 0x0423, 31259 "Udblacute", 31260 0x0170, 31261 "Udblgrave", 31262 0x0214, 31263 "Udieresis", 31264 0x00dc, 31265 "Udieresisacute", 31266 0x01d7, 31267 "Udieresisbelow", 31268 0x1e72, 31269 "Udieresiscaron", 31270 0x01d9, 31271 "Udieresiscyrillic", 31272 0x04f0, 31273 "Udieresisgrave", 31274 0x01db, 31275 "Udieresismacron", 31276 0x01d5, 31277 "Udieresissmall", 31278 0xf7fc, 31279 "Udotbelow", 31280 0x1ee4, 31281 "Ugrave", 31282 0x00d9, 31283 "Ugravesmall", 31284 0xf7f9, 31285 "Uhookabove", 31286 0x1ee6, 31287 "Uhorn", 31288 0x01af, 31289 "Uhornacute", 31290 0x1ee8, 31291 "Uhorndotbelow", 31292 0x1ef0, 31293 "Uhorngrave", 31294 0x1eea, 31295 "Uhornhookabove", 31296 0x1eec, 31297 "Uhorntilde", 31298 0x1eee, 31299 "Uhungarumlaut", 31300 0x0170, 31301 "Uhungarumlautcyrillic", 31302 0x04f2, 31303 "Uinvertedbreve", 31304 0x0216, 31305 "Ukcyrillic", 31306 0x0478, 31307 "Umacron", 31308 0x016a, 31309 "Umacroncyrillic", 31310 0x04ee, 31311 "Umacrondieresis", 31312 0x1e7a, 31313 "Umonospace", 31314 0xff35, 31315 "Uogonek", 31316 0x0172, 31317 "Upsilon", 31318 0x03a5, 31319 "Upsilon1", 31320 0x03d2, 31321 "Upsilonacutehooksymbolgreek", 31322 0x03d3, 31323 "Upsilonafrican", 31324 0x01b1, 31325 "Upsilondieresis", 31326 0x03ab, 31327 "Upsilondieresishooksymbolgreek", 31328 0x03d4, 31329 "Upsilonhooksymbol", 31330 0x03d2, 31331 "Upsilontonos", 31332 0x038e, 31333 "Uring", 31334 0x016e, 31335 "Ushortcyrillic", 31336 0x040e, 31337 "Usmall", 31338 0xf775, 31339 "Ustraightcyrillic", 31340 0x04ae, 31341 "Ustraightstrokecyrillic", 31342 0x04b0, 31343 "Utilde", 31344 0x0168, 31345 "Utildeacute", 31346 0x1e78, 31347 "Utildebelow", 31348 0x1e74, 31349 "V", 31350 0x0056, 31351 "Vcircle", 31352 0x24cb, 31353 "Vdotbelow", 31354 0x1e7e, 31355 "Vecyrillic", 31356 0x0412, 31357 "Vewarmenian", 31358 0x054e, 31359 "Vhook", 31360 0x01b2, 31361 "Vmonospace", 31362 0xff36, 31363 "Voarmenian", 31364 0x0548, 31365 "Vsmall", 31366 0xf776, 31367 "Vtilde", 31368 0x1e7c, 31369 "W", 31370 0x0057, 31371 "Wacute", 31372 0x1e82, 31373 "Wcircle", 31374 0x24cc, 31375 "Wcircumflex", 31376 0x0174, 31377 "Wdieresis", 31378 0x1e84, 31379 "Wdotaccent", 31380 0x1e86, 31381 "Wdotbelow", 31382 0x1e88, 31383 "Wgrave", 31384 0x1e80, 31385 "Wmonospace", 31386 0xff37, 31387 "Wsmall", 31388 0xf777, 31389 "X", 31390 0x0058, 31391 "Xcircle", 31392 0x24cd, 31393 "Xdieresis", 31394 0x1e8c, 31395 "Xdotaccent", 31396 0x1e8a, 31397 "Xeharmenian", 31398 0x053d, 31399 "Xi", 31400 0x039e, 31401 "Xmonospace", 31402 0xff38, 31403 "Xsmall", 31404 0xf778, 31405 "Y", 31406 0x0059, 31407 "Yacute", 31408 0x00dd, 31409 "Yacutesmall", 31410 0xf7fd, 31411 "Yatcyrillic", 31412 0x0462, 31413 "Ycircle", 31414 0x24ce, 31415 "Ycircumflex", 31416 0x0176, 31417 "Ydieresis", 31418 0x0178, 31419 "Ydieresissmall", 31420 0xf7ff, 31421 "Ydotaccent", 31422 0x1e8e, 31423 "Ydotbelow", 31424 0x1ef4, 31425 "Yericyrillic", 31426 0x042b, 31427 "Yerudieresiscyrillic", 31428 0x04f8, 31429 "Ygrave", 31430 0x1ef2, 31431 "Yhook", 31432 0x01b3, 31433 "Yhookabove", 31434 0x1ef6, 31435 "Yiarmenian", 31436 0x0545, 31437 "Yicyrillic", 31438 0x0407, 31439 "Yiwnarmenian", 31440 0x0552, 31441 "Ymonospace", 31442 0xff39, 31443 "Ysmall", 31444 0xf779, 31445 "Ytilde", 31446 0x1ef8, 31447 "Yusbigcyrillic", 31448 0x046a, 31449 "Yusbigiotifiedcyrillic", 31450 0x046c, 31451 "Yuslittlecyrillic", 31452 0x0466, 31453 "Yuslittleiotifiedcyrillic", 31454 0x0468, 31455 "Z", 31456 0x005a, 31457 "Zaarmenian", 31458 0x0536, 31459 "Zacute", 31460 0x0179, 31461 "Zcaron", 31462 0x017d, 31463 "Zcaronsmall", 31464 0xf6ff, 31465 "Zcircle", 31466 0x24cf, 31467 "Zcircumflex", 31468 0x1e90, 31469 "Zdot", 31470 0x017b, 31471 "Zdotaccent", 31472 0x017b, 31473 "Zdotbelow", 31474 0x1e92, 31475 "Zecyrillic", 31476 0x0417, 31477 "Zedescendercyrillic", 31478 0x0498, 31479 "Zedieresiscyrillic", 31480 0x04de, 31481 "Zeta", 31482 0x0396, 31483 "Zhearmenian", 31484 0x053a, 31485 "Zhebrevecyrillic", 31486 0x04c1, 31487 "Zhecyrillic", 31488 0x0416, 31489 "Zhedescendercyrillic", 31490 0x0496, 31491 "Zhedieresiscyrillic", 31492 0x04dc, 31493 "Zlinebelow", 31494 0x1e94, 31495 "Zmonospace", 31496 0xff3a, 31497 "Zsmall", 31498 0xf77a, 31499 "Zstroke", 31500 0x01b5, 31501 "a", 31502 0x0061, 31503 "aabengali", 31504 0x0986, 31505 "aacute", 31506 0x00e1, 31507 "aadeva", 31508 0x0906, 31509 "aagujarati", 31510 0x0a86, 31511 "aagurmukhi", 31512 0x0a06, 31513 "aamatragurmukhi", 31514 0x0a3e, 31515 "aarusquare", 31516 0x3303, 31517 "aavowelsignbengali", 31518 0x09be, 31519 "aavowelsigndeva", 31520 0x093e, 31521 "aavowelsigngujarati", 31522 0x0abe, 31523 "abbreviationmarkarmenian", 31524 0x055f, 31525 "abbreviationsigndeva", 31526 0x0970, 31527 "abengali", 31528 0x0985, 31529 "abopomofo", 31530 0x311a, 31531 "abreve", 31532 0x0103, 31533 "abreveacute", 31534 0x1eaf, 31535 "abrevecyrillic", 31536 0x04d1, 31537 "abrevedotbelow", 31538 0x1eb7, 31539 "abrevegrave", 31540 0x1eb1, 31541 "abrevehookabove", 31542 0x1eb3, 31543 "abrevetilde", 31544 0x1eb5, 31545 "acaron", 31546 0x01ce, 31547 "acircle", 31548 0x24d0, 31549 "acircumflex", 31550 0x00e2, 31551 "acircumflexacute", 31552 0x1ea5, 31553 "acircumflexdotbelow", 31554 0x1ead, 31555 "acircumflexgrave", 31556 0x1ea7, 31557 "acircumflexhookabove", 31558 0x1ea9, 31559 "acircumflextilde", 31560 0x1eab, 31561 "acute", 31562 0x00b4, 31563 "acutebelowcmb", 31564 0x0317, 31565 "acutecmb", 31566 0x0301, 31567 "acutecomb", 31568 0x0301, 31569 "acutedeva", 31570 0x0954, 31571 "acutelowmod", 31572 0x02cf, 31573 "acutetonecmb", 31574 0x0341, 31575 "acyrillic", 31576 0x0430, 31577 "adblgrave", 31578 0x0201, 31579 "addakgurmukhi", 31580 0x0a71, 31581 "adeva", 31582 0x0905, 31583 "adieresis", 31584 0x00e4, 31585 "adieresiscyrillic", 31586 0x04d3, 31587 "adieresismacron", 31588 0x01df, 31589 "adotbelow", 31590 0x1ea1, 31591 "adotmacron", 31592 0x01e1, 31593 "ae", 31594 0x00e6, 31595 "aeacute", 31596 0x01fd, 31597 "aekorean", 31598 0x3150, 31599 "aemacron", 31600 0x01e3, 31601 "afii00208", 31602 0x2015, 31603 "afii08941", 31604 0x20a4, 31605 "afii10017", 31606 0x0410, 31607 "afii10018", 31608 0x0411, 31609 "afii10019", 31610 0x0412, 31611 "afii10020", 31612 0x0413, 31613 "afii10021", 31614 0x0414, 31615 "afii10022", 31616 0x0415, 31617 "afii10023", 31618 0x0401, 31619 "afii10024", 31620 0x0416, 31621 "afii10025", 31622 0x0417, 31623 "afii10026", 31624 0x0418, 31625 "afii10027", 31626 0x0419, 31627 "afii10028", 31628 0x041a, 31629 "afii10029", 31630 0x041b, 31631 "afii10030", 31632 0x041c, 31633 "afii10031", 31634 0x041d, 31635 "afii10032", 31636 0x041e, 31637 "afii10033", 31638 0x041f, 31639 "afii10034", 31640 0x0420, 31641 "afii10035", 31642 0x0421, 31643 "afii10036", 31644 0x0422, 31645 "afii10037", 31646 0x0423, 31647 "afii10038", 31648 0x0424, 31649 "afii10039", 31650 0x0425, 31651 "afii10040", 31652 0x0426, 31653 "afii10041", 31654 0x0427, 31655 "afii10042", 31656 0x0428, 31657 "afii10043", 31658 0x0429, 31659 "afii10044", 31660 0x042a, 31661 "afii10045", 31662 0x042b, 31663 "afii10046", 31664 0x042c, 31665 "afii10047", 31666 0x042d, 31667 "afii10048", 31668 0x042e, 31669 "afii10049", 31670 0x042f, 31671 "afii10050", 31672 0x0490, 31673 "afii10051", 31674 0x0402, 31675 "afii10052", 31676 0x0403, 31677 "afii10053", 31678 0x0404, 31679 "afii10054", 31680 0x0405, 31681 "afii10055", 31682 0x0406, 31683 "afii10056", 31684 0x0407, 31685 "afii10057", 31686 0x0408, 31687 "afii10058", 31688 0x0409, 31689 "afii10059", 31690 0x040a, 31691 "afii10060", 31692 0x040b, 31693 "afii10061", 31694 0x040c, 31695 "afii10062", 31696 0x040e, 31697 "afii10063", 31698 0xf6c4, 31699 "afii10064", 31700 0xf6c5, 31701 "afii10065", 31702 0x0430, 31703 "afii10066", 31704 0x0431, 31705 "afii10067", 31706 0x0432, 31707 "afii10068", 31708 0x0433, 31709 "afii10069", 31710 0x0434, 31711 "afii10070", 31712 0x0435, 31713 "afii10071", 31714 0x0451, 31715 "afii10072", 31716 0x0436, 31717 "afii10073", 31718 0x0437, 31719 "afii10074", 31720 0x0438, 31721 "afii10075", 31722 0x0439, 31723 "afii10076", 31724 0x043a, 31725 "afii10077", 31726 0x043b, 31727 "afii10078", 31728 0x043c, 31729 "afii10079", 31730 0x043d, 31731 "afii10080", 31732 0x043e, 31733 "afii10081", 31734 0x043f, 31735 "afii10082", 31736 0x0440, 31737 "afii10083", 31738 0x0441, 31739 "afii10084", 31740 0x0442, 31741 "afii10085", 31742 0x0443, 31743 "afii10086", 31744 0x0444, 31745 "afii10087", 31746 0x0445, 31747 "afii10088", 31748 0x0446, 31749 "afii10089", 31750 0x0447, 31751 "afii10090", 31752 0x0448, 31753 "afii10091", 31754 0x0449, 31755 "afii10092", 31756 0x044a, 31757 "afii10093", 31758 0x044b, 31759 "afii10094", 31760 0x044c, 31761 "afii10095", 31762 0x044d, 31763 "afii10096", 31764 0x044e, 31765 "afii10097", 31766 0x044f, 31767 "afii10098", 31768 0x0491, 31769 "afii10099", 31770 0x0452, 31771 "afii10100", 31772 0x0453, 31773 "afii10101", 31774 0x0454, 31775 "afii10102", 31776 0x0455, 31777 "afii10103", 31778 0x0456, 31779 "afii10104", 31780 0x0457, 31781 "afii10105", 31782 0x0458, 31783 "afii10106", 31784 0x0459, 31785 "afii10107", 31786 0x045a, 31787 "afii10108", 31788 0x045b, 31789 "afii10109", 31790 0x045c, 31791 "afii10110", 31792 0x045e, 31793 "afii10145", 31794 0x040f, 31795 "afii10146", 31796 0x0462, 31797 "afii10147", 31798 0x0472, 31799 "afii10148", 31800 0x0474, 31801 "afii10192", 31802 0xf6c6, 31803 "afii10193", 31804 0x045f, 31805 "afii10194", 31806 0x0463, 31807 "afii10195", 31808 0x0473, 31809 "afii10196", 31810 0x0475, 31811 "afii10831", 31812 0xf6c7, 31813 "afii10832", 31814 0xf6c8, 31815 "afii10846", 31816 0x04d9, 31817 "afii299", 31818 0x200e, 31819 "afii300", 31820 0x200f, 31821 "afii301", 31822 0x200d, 31823 "afii57381", 31824 0x066a, 31825 "afii57388", 31826 0x060c, 31827 "afii57392", 31828 0x0660, 31829 "afii57393", 31830 0x0661, 31831 "afii57394", 31832 0x0662, 31833 "afii57395", 31834 0x0663, 31835 "afii57396", 31836 0x0664, 31837 "afii57397", 31838 0x0665, 31839 "afii57398", 31840 0x0666, 31841 "afii57399", 31842 0x0667, 31843 "afii57400", 31844 0x0668, 31845 "afii57401", 31846 0x0669, 31847 "afii57403", 31848 0x061b, 31849 "afii57407", 31850 0x061f, 31851 "afii57409", 31852 0x0621, 31853 "afii57410", 31854 0x0622, 31855 "afii57411", 31856 0x0623, 31857 "afii57412", 31858 0x0624, 31859 "afii57413", 31860 0x0625, 31861 "afii57414", 31862 0x0626, 31863 "afii57415", 31864 0x0627, 31865 "afii57416", 31866 0x0628, 31867 "afii57417", 31868 0x0629, 31869 "afii57418", 31870 0x062a, 31871 "afii57419", 31872 0x062b, 31873 "afii57420", 31874 0x062c, 31875 "afii57421", 31876 0x062d, 31877 "afii57422", 31878 0x062e, 31879 "afii57423", 31880 0x062f, 31881 "afii57424", 31882 0x0630, 31883 "afii57425", 31884 0x0631, 31885 "afii57426", 31886 0x0632, 31887 "afii57427", 31888 0x0633, 31889 "afii57428", 31890 0x0634, 31891 "afii57429", 31892 0x0635, 31893 "afii57430", 31894 0x0636, 31895 "afii57431", 31896 0x0637, 31897 "afii57432", 31898 0x0638, 31899 "afii57433", 31900 0x0639, 31901 "afii57434", 31902 0x063a, 31903 "afii57440", 31904 0x0640, 31905 "afii57441", 31906 0x0641, 31907 "afii57442", 31908 0x0642, 31909 "afii57443", 31910 0x0643, 31911 "afii57444", 31912 0x0644, 31913 "afii57445", 31914 0x0645, 31915 "afii57446", 31916 0x0646, 31917 "afii57448", 31918 0x0648, 31919 "afii57449", 31920 0x0649, 31921 "afii57450", 31922 0x064a, 31923 "afii57451", 31924 0x064b, 31925 "afii57452", 31926 0x064c, 31927 "afii57453", 31928 0x064d, 31929 "afii57454", 31930 0x064e, 31931 "afii57455", 31932 0x064f, 31933 "afii57456", 31934 0x0650, 31935 "afii57457", 31936 0x0651, 31937 "afii57458", 31938 0x0652, 31939 "afii57470", 31940 0x0647, 31941 "afii57505", 31942 0x06a4, 31943 "afii57506", 31944 0x067e, 31945 "afii57507", 31946 0x0686, 31947 "afii57508", 31948 0x0698, 31949 "afii57509", 31950 0x06af, 31951 "afii57511", 31952 0x0679, 31953 "afii57512", 31954 0x0688, 31955 "afii57513", 31956 0x0691, 31957 "afii57514", 31958 0x06ba, 31959 "afii57519", 31960 0x06d2, 31961 "afii57534", 31962 0x06d5, 31963 "afii57636", 31964 0x20aa, 31965 "afii57645", 31966 0x05be, 31967 "afii57658", 31968 0x05c3, 31969 "afii57664", 31970 0x05d0, 31971 "afii57665", 31972 0x05d1, 31973 "afii57666", 31974 0x05d2, 31975 "afii57667", 31976 0x05d3, 31977 "afii57668", 31978 0x05d4, 31979 "afii57669", 31980 0x05d5, 31981 "afii57670", 31982 0x05d6, 31983 "afii57671", 31984 0x05d7, 31985 "afii57672", 31986 0x05d8, 31987 "afii57673", 31988 0x05d9, 31989 "afii57674", 31990 0x05da, 31991 "afii57675", 31992 0x05db, 31993 "afii57676", 31994 0x05dc, 31995 "afii57677", 31996 0x05dd, 31997 "afii57678", 31998 0x05de, 31999 "afii57679", 32000 0x05df, 32001 "afii57680", 32002 0x05e0, 32003 "afii57681", 32004 0x05e1, 32005 "afii57682", 32006 0x05e2, 32007 "afii57683", 32008 0x05e3, 32009 "afii57684", 32010 0x05e4, 32011 "afii57685", 32012 0x05e5, 32013 "afii57686", 32014 0x05e6, 32015 "afii57687", 32016 0x05e7, 32017 "afii57688", 32018 0x05e8, 32019 "afii57689", 32020 0x05e9, 32021 "afii57690", 32022 0x05ea, 32023 "afii57694", 32024 0xfb2a, 32025 "afii57695", 32026 0xfb2b, 32027 "afii57700", 32028 0xfb4b, 32029 "afii57705", 32030 0xfb1f, 32031 "afii57716", 32032 0x05f0, 32033 "afii57717", 32034 0x05f1, 32035 "afii57718", 32036 0x05f2, 32037 "afii57723", 32038 0xfb35, 32039 "afii57793", 32040 0x05b4, 32041 "afii57794", 32042 0x05b5, 32043 "afii57795", 32044 0x05b6, 32045 "afii57796", 32046 0x05bb, 32047 "afii57797", 32048 0x05b8, 32049 "afii57798", 32050 0x05b7, 32051 "afii57799", 32052 0x05b0, 32053 "afii57800", 32054 0x05b2, 32055 "afii57801", 32056 0x05b1, 32057 "afii57802", 32058 0x05b3, 32059 "afii57803", 32060 0x05c2, 32061 "afii57804", 32062 0x05c1, 32063 "afii57806", 32064 0x05b9, 32065 "afii57807", 32066 0x05bc, 32067 "afii57839", 32068 0x05bd, 32069 "afii57841", 32070 0x05bf, 32071 "afii57842", 32072 0x05c0, 32073 "afii57929", 32074 0x02bc, 32075 "afii61248", 32076 0x2105, 32077 "afii61289", 32078 0x2113, 32079 "afii61352", 32080 0x2116, 32081 "afii61573", 32082 0x202c, 32083 "afii61574", 32084 0x202d, 32085 "afii61575", 32086 0x202e, 32087 "afii61664", 32088 0x200c, 32089 "afii63167", 32090 0x066d, 32091 "afii64937", 32092 0x02bd, 32093 "agrave", 32094 0x00e0, 32095 "agujarati", 32096 0x0a85, 32097 "agurmukhi", 32098 0x0a05, 32099 "ahiragana", 32100 0x3042, 32101 "ahookabove", 32102 0x1ea3, 32103 "aibengali", 32104 0x0990, 32105 "aibopomofo", 32106 0x311e, 32107 "aideva", 32108 0x0910, 32109 "aiecyrillic", 32110 0x04d5, 32111 "aigujarati", 32112 0x0a90, 32113 "aigurmukhi", 32114 0x0a10, 32115 "aimatragurmukhi", 32116 0x0a48, 32117 "ainarabic", 32118 0x0639, 32119 "ainfinalarabic", 32120 0xfeca, 32121 "aininitialarabic", 32122 0xfecb, 32123 "ainmedialarabic", 32124 0xfecc, 32125 "ainvertedbreve", 32126 0x0203, 32127 "aivowelsignbengali", 32128 0x09c8, 32129 "aivowelsigndeva", 32130 0x0948, 32131 "aivowelsigngujarati", 32132 0x0ac8, 32133 "akatakana", 32134 0x30a2, 32135 "akatakanahalfwidth", 32136 0xff71, 32137 "akorean", 32138 0x314f, 32139 "alef", 32140 0x05d0, 32141 "alefarabic", 32142 0x0627, 32143 "alefdageshhebrew", 32144 0xfb30, 32145 "aleffinalarabic", 32146 0xfe8e, 32147 "alefhamzaabovearabic", 32148 0x0623, 32149 "alefhamzaabovefinalarabic", 32150 0xfe84, 32151 "alefhamzabelowarabic", 32152 0x0625, 32153 "alefhamzabelowfinalarabic", 32154 0xfe88, 32155 "alefhebrew", 32156 0x05d0, 32157 "aleflamedhebrew", 32158 0xfb4f, 32159 "alefmaddaabovearabic", 32160 0x0622, 32161 "alefmaddaabovefinalarabic", 32162 0xfe82, 32163 "alefmaksuraarabic", 32164 0x0649, 32165 "alefmaksurafinalarabic", 32166 0xfef0, 32167 "alefmaksurainitialarabic", 32168 0xfef3, 32169 "alefmaksuramedialarabic", 32170 0xfef4, 32171 "alefpatahhebrew", 32172 0xfb2e, 32173 "alefqamatshebrew", 32174 0xfb2f, 32175 "aleph", 32176 0x2135, 32177 "allequal", 32178 0x224c, 32179 "alpha", 32180 0x03b1, 32181 "alphatonos", 32182 0x03ac, 32183 "amacron", 32184 0x0101, 32185 "amonospace", 32186 0xff41, 32187 "ampersand", 32188 0x0026, 32189 "ampersandmonospace", 32190 0xff06, 32191 "ampersandsmall", 32192 0xf726, 32193 "amsquare", 32194 0x33c2, 32195 "anbopomofo", 32196 0x3122, 32197 "angbopomofo", 32198 0x3124, 32199 "angbracketleft", 32200 0x3008, 32201 "angbracketright", 32202 0x3009, 32203 "angkhankhuthai", 32204 0x0e5a, 32205 "angle", 32206 0x2220, 32207 "anglebracketleft", 32208 0x3008, 32209 "anglebracketleftvertical", 32210 0xfe3f, 32211 "anglebracketright", 32212 0x3009, 32213 "anglebracketrightvertical", 32214 0xfe40, 32215 "angleleft", 32216 0x2329, 32217 "angleright", 32218 0x232a, 32219 "angstrom", 32220 0x212b, 32221 "anoteleia", 32222 0x0387, 32223 "anudattadeva", 32224 0x0952, 32225 "anusvarabengali", 32226 0x0982, 32227 "anusvaradeva", 32228 0x0902, 32229 "anusvaragujarati", 32230 0x0a82, 32231 "aogonek", 32232 0x0105, 32233 "apaatosquare", 32234 0x3300, 32235 "aparen", 32236 0x249c, 32237 "apostrophearmenian", 32238 0x055a, 32239 "apostrophemod", 32240 0x02bc, 32241 "apple", 32242 0xf8ff, 32243 "approaches", 32244 0x2250, 32245 "approxequal", 32246 0x2248, 32247 "approxequalorimage", 32248 0x2252, 32249 "approximatelyequal", 32250 0x2245, 32251 "araeaekorean", 32252 0x318e, 32253 "araeakorean", 32254 0x318d, 32255 "arc", 32256 0x2312, 32257 "arighthalfring", 32258 0x1e9a, 32259 "aring", 32260 0x00e5, 32261 "aringacute", 32262 0x01fb, 32263 "aringbelow", 32264 0x1e01, 32265 "arrowboth", 32266 0x2194, 32267 "arrowdashdown", 32268 0x21e3, 32269 "arrowdashleft", 32270 0x21e0, 32271 "arrowdashright", 32272 0x21e2, 32273 "arrowdashup", 32274 0x21e1, 32275 "arrowdblboth", 32276 0x21d4, 32277 "arrowdbldown", 32278 0x21d3, 32279 "arrowdblleft", 32280 0x21d0, 32281 "arrowdblright", 32282 0x21d2, 32283 "arrowdblup", 32284 0x21d1, 32285 "arrowdown", 32286 0x2193, 32287 "arrowdownleft", 32288 0x2199, 32289 "arrowdownright", 32290 0x2198, 32291 "arrowdownwhite", 32292 0x21e9, 32293 "arrowheaddownmod", 32294 0x02c5, 32295 "arrowheadleftmod", 32296 0x02c2, 32297 "arrowheadrightmod", 32298 0x02c3, 32299 "arrowheadupmod", 32300 0x02c4, 32301 "arrowhorizex", 32302 0xf8e7, 32303 "arrowleft", 32304 0x2190, 32305 "arrowleftdbl", 32306 0x21d0, 32307 "arrowleftdblstroke", 32308 0x21cd, 32309 "arrowleftoverright", 32310 0x21c6, 32311 "arrowleftwhite", 32312 0x21e6, 32313 "arrowright", 32314 0x2192, 32315 "arrowrightdblstroke", 32316 0x21cf, 32317 "arrowrightheavy", 32318 0x279e, 32319 "arrowrightoverleft", 32320 0x21c4, 32321 "arrowrightwhite", 32322 0x21e8, 32323 "arrowtableft", 32324 0x21e4, 32325 "arrowtabright", 32326 0x21e5, 32327 "arrowup", 32328 0x2191, 32329 "arrowupdn", 32330 0x2195, 32331 "arrowupdnbse", 32332 0x21a8, 32333 "arrowupdownbase", 32334 0x21a8, 32335 "arrowupleft", 32336 0x2196, 32337 "arrowupleftofdown", 32338 0x21c5, 32339 "arrowupright", 32340 0x2197, 32341 "arrowupwhite", 32342 0x21e7, 32343 "arrowvertex", 32344 0xf8e6, 32345 "asciicircum", 32346 0x005e, 32347 "asciicircummonospace", 32348 0xff3e, 32349 "asciitilde", 32350 0x007e, 32351 "asciitildemonospace", 32352 0xff5e, 32353 "ascript", 32354 0x0251, 32355 "ascriptturned", 32356 0x0252, 32357 "asmallhiragana", 32358 0x3041, 32359 "asmallkatakana", 32360 0x30a1, 32361 "asmallkatakanahalfwidth", 32362 0xff67, 32363 "asterisk", 32364 0x002a, 32365 "asteriskaltonearabic", 32366 0x066d, 32367 "asteriskarabic", 32368 0x066d, 32369 "asteriskmath", 32370 0x2217, 32371 "asteriskmonospace", 32372 0xff0a, 32373 "asterisksmall", 32374 0xfe61, 32375 "asterism", 32376 0x2042, 32377 "asuperior", 32378 0xf6e9, 32379 "asymptoticallyequal", 32380 0x2243, 32381 "at", 32382 0x0040, 32383 "atilde", 32384 0x00e3, 32385 "atmonospace", 32386 0xff20, 32387 "atsmall", 32388 0xfe6b, 32389 "aturned", 32390 0x0250, 32391 "aubengali", 32392 0x0994, 32393 "aubopomofo", 32394 0x3120, 32395 "audeva", 32396 0x0914, 32397 "augujarati", 32398 0x0a94, 32399 "augurmukhi", 32400 0x0a14, 32401 "aulengthmarkbengali", 32402 0x09d7, 32403 "aumatragurmukhi", 32404 0x0a4c, 32405 "auvowelsignbengali", 32406 0x09cc, 32407 "auvowelsigndeva", 32408 0x094c, 32409 "auvowelsigngujarati", 32410 0x0acc, 32411 "avagrahadeva", 32412 0x093d, 32413 "aybarmenian", 32414 0x0561, 32415 "ayin", 32416 0x05e2, 32417 "ayinaltonehebrew", 32418 0xfb20, 32419 "ayinhebrew", 32420 0x05e2, 32421 "b", 32422 0x0062, 32423 "babengali", 32424 0x09ac, 32425 "backslash", 32426 0x005c, 32427 "backslashmonospace", 32428 0xff3c, 32429 "badeva", 32430 0x092c, 32431 "bagujarati", 32432 0x0aac, 32433 "bagurmukhi", 32434 0x0a2c, 32435 "bahiragana", 32436 0x3070, 32437 "bahtthai", 32438 0x0e3f, 32439 "bakatakana", 32440 0x30d0, 32441 "bar", 32442 0x007c, 32443 "barmonospace", 32444 0xff5c, 32445 "bbopomofo", 32446 0x3105, 32447 "bcircle", 32448 0x24d1, 32449 "bdotaccent", 32450 0x1e03, 32451 "bdotbelow", 32452 0x1e05, 32453 "beamedsixteenthnotes", 32454 0x266c, 32455 "because", 32456 0x2235, 32457 "becyrillic", 32458 0x0431, 32459 "beharabic", 32460 0x0628, 32461 "behfinalarabic", 32462 0xfe90, 32463 "behinitialarabic", 32464 0xfe91, 32465 "behiragana", 32466 0x3079, 32467 "behmedialarabic", 32468 0xfe92, 32469 "behmeeminitialarabic", 32470 0xfc9f, 32471 "behmeemisolatedarabic", 32472 0xfc08, 32473 "behnoonfinalarabic", 32474 0xfc6d, 32475 "bekatakana", 32476 0x30d9, 32477 "benarmenian", 32478 0x0562, 32479 "bet", 32480 0x05d1, 32481 "beta", 32482 0x03b2, 32483 "betasymbolgreek", 32484 0x03d0, 32485 "betdagesh", 32486 0xfb31, 32487 "betdageshhebrew", 32488 0xfb31, 32489 "bethebrew", 32490 0x05d1, 32491 "betrafehebrew", 32492 0xfb4c, 32493 "bhabengali", 32494 0x09ad, 32495 "bhadeva", 32496 0x092d, 32497 "bhagujarati", 32498 0x0aad, 32499 "bhagurmukhi", 32500 0x0a2d, 32501 "bhook", 32502 0x0253, 32503 "bihiragana", 32504 0x3073, 32505 "bikatakana", 32506 0x30d3, 32507 "bilabialclick", 32508 0x0298, 32509 "bindigurmukhi", 32510 0x0a02, 32511 "birusquare", 32512 0x3331, 32513 "blackcircle", 32514 0x25cf, 32515 "blackdiamond", 32516 0x25c6, 32517 "blackdownpointingtriangle", 32518 0x25bc, 32519 "blackleftpointingpointer", 32520 0x25c4, 32521 "blackleftpointingtriangle", 32522 0x25c0, 32523 "blacklenticularbracketleft", 32524 0x3010, 32525 "blacklenticularbracketleftvertical", 32526 0xfe3b, 32527 "blacklenticularbracketright", 32528 0x3011, 32529 "blacklenticularbracketrightvertical", 32530 0xfe3c, 32531 "blacklowerlefttriangle", 32532 0x25e3, 32533 "blacklowerrighttriangle", 32534 0x25e2, 32535 "blackrectangle", 32536 0x25ac, 32537 "blackrightpointingpointer", 32538 0x25ba, 32539 "blackrightpointingtriangle", 32540 0x25b6, 32541 "blacksmallsquare", 32542 0x25aa, 32543 "blacksmilingface", 32544 0x263b, 32545 "blacksquare", 32546 0x25a0, 32547 "blackstar", 32548 0x2605, 32549 "blackupperlefttriangle", 32550 0x25e4, 32551 "blackupperrighttriangle", 32552 0x25e5, 32553 "blackuppointingsmalltriangle", 32554 0x25b4, 32555 "blackuppointingtriangle", 32556 0x25b2, 32557 "blank", 32558 0x2423, 32559 "blinebelow", 32560 0x1e07, 32561 "block", 32562 0x2588, 32563 "bmonospace", 32564 0xff42, 32565 "bobaimaithai", 32566 0x0e1a, 32567 "bohiragana", 32568 0x307c, 32569 "bokatakana", 32570 0x30dc, 32571 "bparen", 32572 0x249d, 32573 "bqsquare", 32574 0x33c3, 32575 "braceex", 32576 0xf8f4, 32577 "braceleft", 32578 0x007b, 32579 "braceleftbt", 32580 0xf8f3, 32581 "braceleftmid", 32582 0xf8f2, 32583 "braceleftmonospace", 32584 0xff5b, 32585 "braceleftsmall", 32586 0xfe5b, 32587 "bracelefttp", 32588 0xf8f1, 32589 "braceleftvertical", 32590 0xfe37, 32591 "braceright", 32592 0x007d, 32593 "bracerightbt", 32594 0xf8fe, 32595 "bracerightmid", 32596 0xf8fd, 32597 "bracerightmonospace", 32598 0xff5d, 32599 "bracerightsmall", 32600 0xfe5c, 32601 "bracerighttp", 32602 0xf8fc, 32603 "bracerightvertical", 32604 0xfe38, 32605 "bracketleft", 32606 0x005b, 32607 "bracketleftbt", 32608 0xf8f0, 32609 "bracketleftex", 32610 0xf8ef, 32611 "bracketleftmonospace", 32612 0xff3b, 32613 "bracketlefttp", 32614 0xf8ee, 32615 "bracketright", 32616 0x005d, 32617 "bracketrightbt", 32618 0xf8fb, 32619 "bracketrightex", 32620 0xf8fa, 32621 "bracketrightmonospace", 32622 0xff3d, 32623 "bracketrighttp", 32624 0xf8f9, 32625 "breve", 32626 0x02d8, 32627 "brevebelowcmb", 32628 0x032e, 32629 "brevecmb", 32630 0x0306, 32631 "breveinvertedbelowcmb", 32632 0x032f, 32633 "breveinvertedcmb", 32634 0x0311, 32635 "breveinverteddoublecmb", 32636 0x0361, 32637 "bridgebelowcmb", 32638 0x032a, 32639 "bridgeinvertedbelowcmb", 32640 0x033a, 32641 "brokenbar", 32642 0x00a6, 32643 "bstroke", 32644 0x0180, 32645 "bsuperior", 32646 0xf6ea, 32647 "btopbar", 32648 0x0183, 32649 "buhiragana", 32650 0x3076, 32651 "bukatakana", 32652 0x30d6, 32653 "bullet", 32654 0x2022, 32655 "bulletinverse", 32656 0x25d8, 32657 "bulletoperator", 32658 0x2219, 32659 "bullseye", 32660 0x25ce, 32661 "c", 32662 0x0063, 32663 "caarmenian", 32664 0x056e, 32665 "cabengali", 32666 0x099a, 32667 "cacute", 32668 0x0107, 32669 "cadeva", 32670 0x091a, 32671 "cagujarati", 32672 0x0a9a, 32673 "cagurmukhi", 32674 0x0a1a, 32675 "calsquare", 32676 0x3388, 32677 "candrabindubengali", 32678 0x0981, 32679 "candrabinducmb", 32680 0x0310, 32681 "candrabindudeva", 32682 0x0901, 32683 "candrabindugujarati", 32684 0x0a81, 32685 "capslock", 32686 0x21ea, 32687 "careof", 32688 0x2105, 32689 "caron", 32690 0x02c7, 32691 "caronbelowcmb", 32692 0x032c, 32693 "caroncmb", 32694 0x030c, 32695 "carriagereturn", 32696 0x21b5, 32697 "cbopomofo", 32698 0x3118, 32699 "ccaron", 32700 0x010d, 32701 "ccedilla", 32702 0x00e7, 32703 "ccedillaacute", 32704 0x1e09, 32705 "ccircle", 32706 0x24d2, 32707 "ccircumflex", 32708 0x0109, 32709 "ccurl", 32710 0x0255, 32711 "cdot", 32712 0x010b, 32713 "cdotaccent", 32714 0x010b, 32715 "cdsquare", 32716 0x33c5, 32717 "cedilla", 32718 0x00b8, 32719 "cedillacmb", 32720 0x0327, 32721 "cent", 32722 0x00a2, 32723 "centigrade", 32724 0x2103, 32725 "centinferior", 32726 0xf6df, 32727 "centmonospace", 32728 0xffe0, 32729 "centoldstyle", 32730 0xf7a2, 32731 "centsuperior", 32732 0xf6e0, 32733 "chaarmenian", 32734 0x0579, 32735 "chabengali", 32736 0x099b, 32737 "chadeva", 32738 0x091b, 32739 "chagujarati", 32740 0x0a9b, 32741 "chagurmukhi", 32742 0x0a1b, 32743 "chbopomofo", 32744 0x3114, 32745 "cheabkhasiancyrillic", 32746 0x04bd, 32747 "checkmark", 32748 0x2713, 32749 "checyrillic", 32750 0x0447, 32751 "chedescenderabkhasiancyrillic", 32752 0x04bf, 32753 "chedescendercyrillic", 32754 0x04b7, 32755 "chedieresiscyrillic", 32756 0x04f5, 32757 "cheharmenian", 32758 0x0573, 32759 "chekhakassiancyrillic", 32760 0x04cc, 32761 "cheverticalstrokecyrillic", 32762 0x04b9, 32763 "chi", 32764 0x03c7, 32765 "chieuchacirclekorean", 32766 0x3277, 32767 "chieuchaparenkorean", 32768 0x3217, 32769 "chieuchcirclekorean", 32770 0x3269, 32771 "chieuchkorean", 32772 0x314a, 32773 "chieuchparenkorean", 32774 0x3209, 32775 "chochangthai", 32776 0x0e0a, 32777 "chochanthai", 32778 0x0e08, 32779 "chochingthai", 32780 0x0e09, 32781 "chochoethai", 32782 0x0e0c, 32783 "chook", 32784 0x0188, 32785 "cieucacirclekorean", 32786 0x3276, 32787 "cieucaparenkorean", 32788 0x3216, 32789 "cieuccirclekorean", 32790 0x3268, 32791 "cieuckorean", 32792 0x3148, 32793 "cieucparenkorean", 32794 0x3208, 32795 "cieucuparenkorean", 32796 0x321c, 32797 "circle", 32798 0x25cb, 32799 "circlecopyrt", 32800 0x00a9, 32801 "circlemultiply", 32802 0x2297, 32803 "circleot", 32804 0x2299, 32805 "circleplus", 32806 0x2295, 32807 "circlepostalmark", 32808 0x3036, 32809 "circlewithlefthalfblack", 32810 0x25d0, 32811 "circlewithrighthalfblack", 32812 0x25d1, 32813 "circumflex", 32814 0x02c6, 32815 "circumflexbelowcmb", 32816 0x032d, 32817 "circumflexcmb", 32818 0x0302, 32819 "clear", 32820 0x2327, 32821 "clickalveolar", 32822 0x01c2, 32823 "clickdental", 32824 0x01c0, 32825 "clicklateral", 32826 0x01c1, 32827 "clickretroflex", 32828 0x01c3, 32829 "club", 32830 0x2663, 32831 "clubsuitblack", 32832 0x2663, 32833 "clubsuitwhite", 32834 0x2667, 32835 "cmcubedsquare", 32836 0x33a4, 32837 "cmonospace", 32838 0xff43, 32839 "cmsquaredsquare", 32840 0x33a0, 32841 "coarmenian", 32842 0x0581, 32843 "colon", 32844 0x003a, 32845 "colonmonetary", 32846 0x20a1, 32847 "colonmonospace", 32848 0xff1a, 32849 "colonsign", 32850 0x20a1, 32851 "colonsmall", 32852 0xfe55, 32853 "colontriangularhalfmod", 32854 0x02d1, 32855 "colontriangularmod", 32856 0x02d0, 32857 "comma", 32858 0x002c, 32859 "commaabovecmb", 32860 0x0313, 32861 "commaaboverightcmb", 32862 0x0315, 32863 "commaaccent", 32864 0xf6c3, 32865 "commaarabic", 32866 0x060c, 32867 "commaarmenian", 32868 0x055d, 32869 "commainferior", 32870 0xf6e1, 32871 "commamonospace", 32872 0xff0c, 32873 "commareversedabovecmb", 32874 0x0314, 32875 "commareversedmod", 32876 0x02bd, 32877 "commasmall", 32878 0xfe50, 32879 "commasuperior", 32880 0xf6e2, 32881 "commaturnedabovecmb", 32882 0x0312, 32883 "commaturnedmod", 32884 0x02bb, 32885 "compass", 32886 0x263c, 32887 "congruent", 32888 0x2245, 32889 "contourintegral", 32890 0x222e, 32891 "control", 32892 0x2303, 32893 "controlACK", 32894 0x0006, 32895 "controlBEL", 32896 0x0007, 32897 "controlBS", 32898 0x0008, 32899 "controlCAN", 32900 0x0018, 32901 "controlCR", 32902 0x000d, 32903 "controlDC1", 32904 0x0011, 32905 "controlDC2", 32906 0x0012, 32907 "controlDC3", 32908 0x0013, 32909 "controlDC4", 32910 0x0014, 32911 "controlDEL", 32912 0x007f, 32913 "controlDLE", 32914 0x0010, 32915 "controlEM", 32916 0x0019, 32917 "controlENQ", 32918 0x0005, 32919 "controlEOT", 32920 0x0004, 32921 "controlESC", 32922 0x001b, 32923 "controlETB", 32924 0x0017, 32925 "controlETX", 32926 0x0003, 32927 "controlFF", 32928 0x000c, 32929 "controlFS", 32930 0x001c, 32931 "controlGS", 32932 0x001d, 32933 "controlHT", 32934 0x0009, 32935 "controlLF", 32936 0x000a, 32937 "controlNAK", 32938 0x0015, 32939 "controlNULL", 32940 0x0000, 32941 "controlRS", 32942 0x001e, 32943 "controlSI", 32944 0x000f, 32945 "controlSO", 32946 0x000e, 32947 "controlSOT", 32948 0x0002, 32949 "controlSTX", 32950 0x0001, 32951 "controlSUB", 32952 0x001a, 32953 "controlSYN", 32954 0x0016, 32955 "controlUS", 32956 0x001f, 32957 "controlVT", 32958 0x000b, 32959 "copyright", 32960 0x00a9, 32961 "copyrightsans", 32962 0xf8e9, 32963 "copyrightserif", 32964 0xf6d9, 32965 "cornerbracketleft", 32966 0x300c, 32967 "cornerbracketlefthalfwidth", 32968 0xff62, 32969 "cornerbracketleftvertical", 32970 0xfe41, 32971 "cornerbracketright", 32972 0x300d, 32973 "cornerbracketrighthalfwidth", 32974 0xff63, 32975 "cornerbracketrightvertical", 32976 0xfe42, 32977 "corporationsquare", 32978 0x337f, 32979 "cosquare", 32980 0x33c7, 32981 "coverkgsquare", 32982 0x33c6, 32983 "cparen", 32984 0x249e, 32985 "cruzeiro", 32986 0x20a2, 32987 "cstretched", 32988 0x0297, 32989 "curlyand", 32990 0x22cf, 32991 "curlyor", 32992 0x22ce, 32993 "currency", 32994 0x00a4, 32995 "cyrBreve", 32996 0xf6d1, 32997 "cyrFlex", 32998 0xf6d2, 32999 "cyrbreve", 33000 0xf6d4, 33001 "cyrflex", 33002 0xf6d5, 33003 "d", 33004 0x0064, 33005 "daarmenian", 33006 0x0564, 33007 "dabengali", 33008 0x09a6, 33009 "dadarabic", 33010 0x0636, 33011 "dadeva", 33012 0x0926, 33013 "dadfinalarabic", 33014 0xfebe, 33015 "dadinitialarabic", 33016 0xfebf, 33017 "dadmedialarabic", 33018 0xfec0, 33019 "dagesh", 33020 0x05bc, 33021 "dageshhebrew", 33022 0x05bc, 33023 "dagger", 33024 0x2020, 33025 "daggerdbl", 33026 0x2021, 33027 "dagujarati", 33028 0x0aa6, 33029 "dagurmukhi", 33030 0x0a26, 33031 "dahiragana", 33032 0x3060, 33033 "dakatakana", 33034 0x30c0, 33035 "dalarabic", 33036 0x062f, 33037 "dalet", 33038 0x05d3, 33039 "daletdagesh", 33040 0xfb33, 33041 "daletdageshhebrew", 33042 0xfb33, 33043 "dalethebrew", 33044 0x05d3, 33045 "dalfinalarabic", 33046 0xfeaa, 33047 "dammaarabic", 33048 0x064f, 33049 "dammalowarabic", 33050 0x064f, 33051 "dammatanaltonearabic", 33052 0x064c, 33053 "dammatanarabic", 33054 0x064c, 33055 "danda", 33056 0x0964, 33057 "dargahebrew", 33058 0x05a7, 33059 "dargalefthebrew", 33060 0x05a7, 33061 "dasiapneumatacyrilliccmb", 33062 0x0485, 33063 "dblGrave", 33064 0xf6d3, 33065 "dblanglebracketleft", 33066 0x300a, 33067 "dblanglebracketleftvertical", 33068 0xfe3d, 33069 "dblanglebracketright", 33070 0x300b, 33071 "dblanglebracketrightvertical", 33072 0xfe3e, 33073 "dblarchinvertedbelowcmb", 33074 0x032b, 33075 "dblarrowleft", 33076 0x21d4, 33077 "dblarrowright", 33078 0x21d2, 33079 "dbldanda", 33080 0x0965, 33081 "dblgrave", 33082 0xf6d6, 33083 "dblgravecmb", 33084 0x030f, 33085 "dblintegral", 33086 0x222c, 33087 "dbllowline", 33088 0x2017, 33089 "dbllowlinecmb", 33090 0x0333, 33091 "dbloverlinecmb", 33092 0x033f, 33093 "dblprimemod", 33094 0x02ba, 33095 "dblverticalbar", 33096 0x2016, 33097 "dblverticallineabovecmb", 33098 0x030e, 33099 "dbopomofo", 33100 0x3109, 33101 "dbsquare", 33102 0x33c8, 33103 "dcaron", 33104 0x010f, 33105 "dcedilla", 33106 0x1e11, 33107 "dcircle", 33108 0x24d3, 33109 "dcircumflexbelow", 33110 0x1e13, 33111 "dcroat", 33112 0x0111, 33113 "ddabengali", 33114 0x09a1, 33115 "ddadeva", 33116 0x0921, 33117 "ddagujarati", 33118 0x0aa1, 33119 "ddagurmukhi", 33120 0x0a21, 33121 "ddalarabic", 33122 0x0688, 33123 "ddalfinalarabic", 33124 0xfb89, 33125 "dddhadeva", 33126 0x095c, 33127 "ddhabengali", 33128 0x09a2, 33129 "ddhadeva", 33130 0x0922, 33131 "ddhagujarati", 33132 0x0aa2, 33133 "ddhagurmukhi", 33134 0x0a22, 33135 "ddotaccent", 33136 0x1e0b, 33137 "ddotbelow", 33138 0x1e0d, 33139 "decimalseparatorarabic", 33140 0x066b, 33141 "decimalseparatorpersian", 33142 0x066b, 33143 "decyrillic", 33144 0x0434, 33145 "degree", 33146 0x00b0, 33147 "dehihebrew", 33148 0x05ad, 33149 "dehiragana", 33150 0x3067, 33151 "deicoptic", 33152 0x03ef, 33153 "dekatakana", 33154 0x30c7, 33155 "deleteleft", 33156 0x232b, 33157 "deleteright", 33158 0x2326, 33159 "delta", 33160 0x03b4, 33161 "deltaturned", 33162 0x018d, 33163 "denominatorminusonenumeratorbengali", 33164 0x09f8, 33165 "dezh", 33166 0x02a4, 33167 "dhabengali", 33168 0x09a7, 33169 "dhadeva", 33170 0x0927, 33171 "dhagujarati", 33172 0x0aa7, 33173 "dhagurmukhi", 33174 0x0a27, 33175 "dhook", 33176 0x0257, 33177 "dialytikatonos", 33178 0x0385, 33179 "dialytikatonoscmb", 33180 0x0344, 33181 "diamond", 33182 0x2666, 33183 "diamondsuitwhite", 33184 0x2662, 33185 "dieresis", 33186 0x00a8, 33187 "dieresisacute", 33188 0xf6d7, 33189 "dieresisbelowcmb", 33190 0x0324, 33191 "dieresiscmb", 33192 0x0308, 33193 "dieresisgrave", 33194 0xf6d8, 33195 "dieresistonos", 33196 0x0385, 33197 "dihiragana", 33198 0x3062, 33199 "dikatakana", 33200 0x30c2, 33201 "dittomark", 33202 0x3003, 33203 "divide", 33204 0x00f7, 33205 "divides", 33206 0x2223, 33207 "divisionslash", 33208 0x2215, 33209 "djecyrillic", 33210 0x0452, 33211 "dkshade", 33212 0x2593, 33213 "dlinebelow", 33214 0x1e0f, 33215 "dlsquare", 33216 0x3397, 33217 "dmacron", 33218 0x0111, 33219 "dmonospace", 33220 0xff44, 33221 "dnblock", 33222 0x2584, 33223 "dochadathai", 33224 0x0e0e, 33225 "dodekthai", 33226 0x0e14, 33227 "dohiragana", 33228 0x3069, 33229 "dokatakana", 33230 0x30c9, 33231 "dollar", 33232 0x0024, 33233 "dollarinferior", 33234 0xf6e3, 33235 "dollarmonospace", 33236 0xff04, 33237 "dollaroldstyle", 33238 0xf724, 33239 "dollarsmall", 33240 0xfe69, 33241 "dollarsuperior", 33242 0xf6e4, 33243 "dong", 33244 0x20ab, 33245 "dorusquare", 33246 0x3326, 33247 "dotaccent", 33248 0x02d9, 33249 "dotaccentcmb", 33250 0x0307, 33251 "dotbelowcmb", 33252 0x0323, 33253 "dotbelowcomb", 33254 0x0323, 33255 "dotkatakana", 33256 0x30fb, 33257 "dotlessi", 33258 0x0131, 33259 "dotlessj", 33260 0xf6be, 33261 "dotlessjstrokehook", 33262 0x0284, 33263 "dotmath", 33264 0x22c5, 33265 "dottedcircle", 33266 0x25cc, 33267 "doubleyodpatah", 33268 0xfb1f, 33269 "doubleyodpatahhebrew", 33270 0xfb1f, 33271 "downtackbelowcmb", 33272 0x031e, 33273 "downtackmod", 33274 0x02d5, 33275 "dparen", 33276 0x249f, 33277 "dsuperior", 33278 0xf6eb, 33279 "dtail", 33280 0x0256, 33281 "dtopbar", 33282 0x018c, 33283 "duhiragana", 33284 0x3065, 33285 "dukatakana", 33286 0x30c5, 33287 "dz", 33288 0x01f3, 33289 "dzaltone", 33290 0x02a3, 33291 "dzcaron", 33292 0x01c6, 33293 "dzcurl", 33294 0x02a5, 33295 "dzeabkhasiancyrillic", 33296 0x04e1, 33297 "dzecyrillic", 33298 0x0455, 33299 "dzhecyrillic", 33300 0x045f, 33301 "e", 33302 0x0065, 33303 "eacute", 33304 0x00e9, 33305 "earth", 33306 0x2641, 33307 "ebengali", 33308 0x098f, 33309 "ebopomofo", 33310 0x311c, 33311 "ebreve", 33312 0x0115, 33313 "ecandradeva", 33314 0x090d, 33315 "ecandragujarati", 33316 0x0a8d, 33317 "ecandravowelsigndeva", 33318 0x0945, 33319 "ecandravowelsigngujarati", 33320 0x0ac5, 33321 "ecaron", 33322 0x011b, 33323 "ecedillabreve", 33324 0x1e1d, 33325 "echarmenian", 33326 0x0565, 33327 "echyiwnarmenian", 33328 0x0587, 33329 "ecircle", 33330 0x24d4, 33331 "ecircumflex", 33332 0x00ea, 33333 "ecircumflexacute", 33334 0x1ebf, 33335 "ecircumflexbelow", 33336 0x1e19, 33337 "ecircumflexdotbelow", 33338 0x1ec7, 33339 "ecircumflexgrave", 33340 0x1ec1, 33341 "ecircumflexhookabove", 33342 0x1ec3, 33343 "ecircumflextilde", 33344 0x1ec5, 33345 "ecyrillic", 33346 0x0454, 33347 "edblgrave", 33348 0x0205, 33349 "edeva", 33350 0x090f, 33351 "edieresis", 33352 0x00eb, 33353 "edot", 33354 0x0117, 33355 "edotaccent", 33356 0x0117, 33357 "edotbelow", 33358 0x1eb9, 33359 "eegurmukhi", 33360 0x0a0f, 33361 "eematragurmukhi", 33362 0x0a47, 33363 "efcyrillic", 33364 0x0444, 33365 "egrave", 33366 0x00e8, 33367 "egujarati", 33368 0x0a8f, 33369 "eharmenian", 33370 0x0567, 33371 "ehbopomofo", 33372 0x311d, 33373 "ehiragana", 33374 0x3048, 33375 "ehookabove", 33376 0x1ebb, 33377 "eibopomofo", 33378 0x311f, 33379 "eight", 33380 0x0038, 33381 "eightarabic", 33382 0x0668, 33383 "eightbengali", 33384 0x09ee, 33385 "eightcircle", 33386 0x2467, 33387 "eightcircleinversesansserif", 33388 0x2791, 33389 "eightdeva", 33390 0x096e, 33391 "eighteencircle", 33392 0x2471, 33393 "eighteenparen", 33394 0x2485, 33395 "eighteenperiod", 33396 0x2499, 33397 "eightgujarati", 33398 0x0aee, 33399 "eightgurmukhi", 33400 0x0a6e, 33401 "eighthackarabic", 33402 0x0668, 33403 "eighthangzhou", 33404 0x3028, 33405 "eighthnotebeamed", 33406 0x266b, 33407 "eightideographicparen", 33408 0x3227, 33409 "eightinferior", 33410 0x2088, 33411 "eightmonospace", 33412 0xff18, 33413 "eightoldstyle", 33414 0xf738, 33415 "eightparen", 33416 0x247b, 33417 "eightperiod", 33418 0x248f, 33419 "eightpersian", 33420 0x06f8, 33421 "eightroman", 33422 0x2177, 33423 "eightsuperior", 33424 0x2078, 33425 "eightthai", 33426 0x0e58, 33427 "einvertedbreve", 33428 0x0207, 33429 "eiotifiedcyrillic", 33430 0x0465, 33431 "ekatakana", 33432 0x30a8, 33433 "ekatakanahalfwidth", 33434 0xff74, 33435 "ekonkargurmukhi", 33436 0x0a74, 33437 "ekorean", 33438 0x3154, 33439 "elcyrillic", 33440 0x043b, 33441 "element", 33442 0x2208, 33443 "elevencircle", 33444 0x246a, 33445 "elevenparen", 33446 0x247e, 33447 "elevenperiod", 33448 0x2492, 33449 "elevenroman", 33450 0x217a, 33451 "ellipsis", 33452 0x2026, 33453 "ellipsisvertical", 33454 0x22ee, 33455 "emacron", 33456 0x0113, 33457 "emacronacute", 33458 0x1e17, 33459 "emacrongrave", 33460 0x1e15, 33461 "emcyrillic", 33462 0x043c, 33463 "emdash", 33464 0x2014, 33465 "emdashvertical", 33466 0xfe31, 33467 "emonospace", 33468 0xff45, 33469 "emphasismarkarmenian", 33470 0x055b, 33471 "emptyset", 33472 0x2205, 33473 "enbopomofo", 33474 0x3123, 33475 "encyrillic", 33476 0x043d, 33477 "endash", 33478 0x2013, 33479 "endashvertical", 33480 0xfe32, 33481 "endescendercyrillic", 33482 0x04a3, 33483 "eng", 33484 0x014b, 33485 "engbopomofo", 33486 0x3125, 33487 "enghecyrillic", 33488 0x04a5, 33489 "enhookcyrillic", 33490 0x04c8, 33491 "enspace", 33492 0x2002, 33493 "eogonek", 33494 0x0119, 33495 "eokorean", 33496 0x3153, 33497 "eopen", 33498 0x025b, 33499 "eopenclosed", 33500 0x029a, 33501 "eopenreversed", 33502 0x025c, 33503 "eopenreversedclosed", 33504 0x025e, 33505 "eopenreversedhook", 33506 0x025d, 33507 "eparen", 33508 0x24a0, 33509 "epsilon", 33510 0x03b5, 33511 "epsilontonos", 33512 0x03ad, 33513 "equal", 33514 0x003d, 33515 "equalmonospace", 33516 0xff1d, 33517 "equalsmall", 33518 0xfe66, 33519 "equalsuperior", 33520 0x207c, 33521 "equivalence", 33522 0x2261, 33523 "erbopomofo", 33524 0x3126, 33525 "ercyrillic", 33526 0x0440, 33527 "ereversed", 33528 0x0258, 33529 "ereversedcyrillic", 33530 0x044d, 33531 "escyrillic", 33532 0x0441, 33533 "esdescendercyrillic", 33534 0x04ab, 33535 "esh", 33536 0x0283, 33537 "eshcurl", 33538 0x0286, 33539 "eshortdeva", 33540 0x090e, 33541 "eshortvowelsigndeva", 33542 0x0946, 33543 "eshreversedloop", 33544 0x01aa, 33545 "eshsquatreversed", 33546 0x0285, 33547 "esmallhiragana", 33548 0x3047, 33549 "esmallkatakana", 33550 0x30a7, 33551 "esmallkatakanahalfwidth", 33552 0xff6a, 33553 "estimated", 33554 0x212e, 33555 "esuperior", 33556 0xf6ec, 33557 "eta", 33558 0x03b7, 33559 "etarmenian", 33560 0x0568, 33561 "etatonos", 33562 0x03ae, 33563 "eth", 33564 0x00f0, 33565 "etilde", 33566 0x1ebd, 33567 "etildebelow", 33568 0x1e1b, 33569 "etnahtafoukhhebrew", 33570 0x0591, 33571 "etnahtafoukhlefthebrew", 33572 0x0591, 33573 "etnahtahebrew", 33574 0x0591, 33575 "etnahtalefthebrew", 33576 0x0591, 33577 "eturned", 33578 0x01dd, 33579 "eukorean", 33580 0x3161, 33581 "euro", 33582 0x20ac, 33583 "evowelsignbengali", 33584 0x09c7, 33585 "evowelsigndeva", 33586 0x0947, 33587 "evowelsigngujarati", 33588 0x0ac7, 33589 "exclam", 33590 0x0021, 33591 "exclamarmenian", 33592 0x055c, 33593 "exclamdbl", 33594 0x203c, 33595 "exclamdown", 33596 0x00a1, 33597 "exclamdownsmall", 33598 0xf7a1, 33599 "exclammonospace", 33600 0xff01, 33601 "exclamsmall", 33602 0xf721, 33603 "existential", 33604 0x2203, 33605 "ezh", 33606 0x0292, 33607 "ezhcaron", 33608 0x01ef, 33609 "ezhcurl", 33610 0x0293, 33611 "ezhreversed", 33612 0x01b9, 33613 "ezhtail", 33614 0x01ba, 33615 "f", 33616 0x0066, 33617 "fadeva", 33618 0x095e, 33619 "fagurmukhi", 33620 0x0a5e, 33621 "fahrenheit", 33622 0x2109, 33623 "fathaarabic", 33624 0x064e, 33625 "fathalowarabic", 33626 0x064e, 33627 "fathatanarabic", 33628 0x064b, 33629 "fbopomofo", 33630 0x3108, 33631 "fcircle", 33632 0x24d5, 33633 "fdotaccent", 33634 0x1e1f, 33635 "feharabic", 33636 0x0641, 33637 "feharmenian", 33638 0x0586, 33639 "fehfinalarabic", 33640 0xfed2, 33641 "fehinitialarabic", 33642 0xfed3, 33643 "fehmedialarabic", 33644 0xfed4, 33645 "feicoptic", 33646 0x03e5, 33647 "female", 33648 0x2640, 33649 "ff", 33650 0xfb00, 33651 "f_f", 33652 0xfb00, 33653 "ffi", 33654 0xfb03, 33655 "f
33655fl", 33656 0xfb04, 33657 "fi", 33658 0xfb01, 33659 "fifteencircle", 33660 0x246e, 33661 "fifteenparen", 33662 0x2482, 33663 "fifteenperiod", 33664 0x2496, 33665 "figuredash", 33666 0x2012, 33667 "filledbox", 33668 0x25a0, 33669 "filledrect", 33670 0x25ac, 33671 "finalkaf", 33672 0x05da, 33673 "finalkafdagesh", 33674 0xfb3a, 33675 "finalkafdageshhebrew", 33676 0xfb3a, 33677 "finalkafhebrew", 33678 0x05da, 33679 "finalmem", 33680 0x05dd, 33681 "finalmemhebrew", 33682 0x05dd, 33683 "finalnun", 33684 0x05df, 33685 "finalnunhebrew", 33686 0x05df, 33687 "finalpe", 33688 0x05e3, 33689 "finalpehebrew", 33690 0x05e3, 33691 "finaltsadi", 33692 0x05e5, 33693 "finaltsadihebrew", 33694 0x05e5, 33695 "firsttonechinese", 33696 0x02c9, 33697 "fisheye", 33698 0x25c9, 33699 "fitacyrillic", 33700 0x0473, 33701 "five", 33702 0x0035, 33703 "fivearabic", 33704 0x0665, 33705 "fivebengali", 33706 0x09eb, 33707 "fivecircle", 33708 0x2464, 33709 "fivecircleinversesansserif", 33710 0x278e, 33711 "fivedeva", 33712 0x096b, 33713 "fiveeighths", 33714 0x215d, 33715 "fivegujarati", 33716 0x0aeb, 33717 "fivegurmukhi", 33718 0x0a6b, 33719 "fivehackarabic", 33720 0x0665, 33721 "fivehangzhou", 33722 0x3025, 33723 "fiveideographicparen", 33724 0x3224, 33725 "fiveinferior", 33726 0x2085, 33727 "fivemonospace", 33728 0xff15, 33729 "fiveoldstyle", 33730 0xf735, 33731 "fiveparen", 33732 0x2478, 33733 "fiveperiod", 33734 0x248c, 33735 "fivepersian", 33736 0x06f5, 33737 "fiveroman", 33738 0x2174, 33739 "fivesuperior", 33740 0x2075, 33741 "fivethai", 33742 0x0e55, 33743 "f
vendor: 74,328 bytes, lines 33743-39092
33743l", 33744 0xfb02, 33745 "florin", 33746 0x0192, 33747 "fmonospace", 33748 0xff46, 33749 "fmsquare", 33750 0x3399, 33751 "fofanthai", 33752 0x0e1f, 33753 "fofathai", 33754 0x0e1d, 33755 "fongmanthai", 33756 0x0e4f, 33757 "forall", 33758 0x2200, 33759 "four", 33760 0x0034, 33761 "fourarabic", 33762 0x0664, 33763 "fourbengali", 33764 0x09ea, 33765 "fourcircle", 33766 0x2463, 33767 "fourcircleinversesansserif", 33768 0x278d, 33769 "fourdeva", 33770 0x096a, 33771 "fourgujarati", 33772 0x0aea, 33773 "fourgurmukhi", 33774 0x0a6a, 33775 "fourhackarabic", 33776 0x0664, 33777 "fourhangzhou", 33778 0x3024, 33779 "fourideographicparen", 33780 0x3223, 33781 "fourinferior", 33782 0x2084, 33783 "fourmonospace", 33784 0xff14, 33785 "fournumeratorbengali", 33786 0x09f7, 33787 "fouroldstyle", 33788 0xf734, 33789 "fourparen", 33790 0x2477, 33791 "fourperiod", 33792 0x248b, 33793 "fourpersian", 33794 0x06f4, 33795 "fourroman", 33796 0x2173, 33797 "foursuperior", 33798 0x2074, 33799 "fourteencircle", 33800 0x246d, 33801 "fourteenparen", 33802 0x2481, 33803 "fourteenperiod", 33804 0x2495, 33805 "fourthai", 33806 0x0e54, 33807 "fourthtonechinese", 33808 0x02cb, 33809 "fparen", 33810 0x24a1, 33811 "fraction", 33812 0x2044, 33813 "franc", 33814 0x20a3, 33815 "g", 33816 0x0067, 33817 "gabengali", 33818 0x0997, 33819 "gacute", 33820 0x01f5, 33821 "gadeva", 33822 0x0917, 33823 "gafarabic", 33824 0x06af, 33825 "gaffinalarabic", 33826 0xfb93, 33827 "gafinitialarabic", 33828 0xfb94, 33829 "gafmedialarabic", 33830 0xfb95, 33831 "gagujarati", 33832 0x0a97, 33833 "gagurmukhi", 33834 0x0a17, 33835 "gahiragana", 33836 0x304c, 33837 "gakatakana", 33838 0x30ac, 33839 "gamma", 33840 0x03b3, 33841 "gammalatinsmall", 33842 0x0263, 33843 "gammasuperior", 33844 0x02e0, 33845 "gangiacoptic", 33846 0x03eb, 33847 "gbopomofo", 33848 0x310d, 33849 "gbreve", 33850 0x011f, 33851 "gcaron", 33852 0x01e7, 33853 "gcedilla", 33854 0x0123, 33855 "gcircle", 33856 0x24d6, 33857 "gcircumflex", 33858 0x011d, 33859 "gcommaaccent", 33860 0x0123, 33861 "gdot", 33862 0x0121, 33863 "gdotaccent", 33864 0x0121, 33865 "gecyrillic", 33866 0x0433, 33867 "gehiragana", 33868 0x3052, 33869 "gekatakana", 33870 0x30b2, 33871 "geometricallyequal", 33872 0x2251, 33873 "gereshaccenthebrew", 33874 0x059c, 33875 "gereshhebrew", 33876 0x05f3, 33877 "gereshmuqdamhebrew", 33878 0x059d, 33879 "germandbls", 33880 0x00df, 33881 "gershayimaccenthebrew", 33882 0x059e, 33883 "gershayimhebrew", 33884 0x05f4, 33885 "getamark", 33886 0x3013, 33887 "ghabengali", 33888 0x0998, 33889 "ghadarmenian", 33890 0x0572, 33891 "ghadeva", 33892 0x0918, 33893 "ghagujarati", 33894 0x0a98, 33895 "ghagurmukhi", 33896 0x0a18, 33897 "ghainarabic", 33898 0x063a, 33899 "ghainfinalarabic", 33900 0xfece, 33901 "ghaininitialarabic", 33902 0xfecf, 33903 "ghainmedialarabic", 33904 0xfed0, 33905 "ghemiddlehookcyrillic", 33906 0x0495, 33907 "ghestrokecyrillic", 33908 0x0493, 33909 "gheupturncyrillic", 33910 0x0491, 33911 "ghhadeva", 33912 0x095a, 33913 "ghhagurmukhi", 33914 0x0a5a, 33915 "ghook", 33916 0x0260, 33917 "ghzsquare", 33918 0x3393, 33919 "gihiragana", 33920 0x304e, 33921 "gikatakana", 33922 0x30ae, 33923 "gimarmenian", 33924 0x0563, 33925 "gimel", 33926 0x05d2, 33927 "gimeldagesh", 33928 0xfb32, 33929 "gimeldageshhebrew", 33930 0xfb32, 33931 "gimelhebrew", 33932 0x05d2, 33933 "gjecyrillic", 33934 0x0453, 33935 "glottalinvertedstroke", 33936 0x01be, 33937 "glottalstop", 33938 0x0294, 33939 "glottalstopinverted", 33940 0x0296, 33941 "glottalstopmod", 33942 0x02c0, 33943 "glottalstopreversed", 33944 0x0295, 33945 "glottalstopreversedmod", 33946 0x02c1, 33947 "glottalstopreversedsuperior", 33948 0x02e4, 33949 "glottalstopstroke", 33950 0x02a1, 33951 "glottalstopstrokereversed", 33952 0x02a2, 33953 "gmacron", 33954 0x1e21, 33955 "gmonospace", 33956 0xff47, 33957 "gohiragana", 33958 0x3054, 33959 "gokatakana", 33960 0x30b4, 33961 "gparen", 33962 0x24a2, 33963 "gpasquare", 33964 0x33ac, 33965 "gradient", 33966 0x2207, 33967 "grave", 33968 0x0060, 33969 "gravebelowcmb", 33970 0x0316, 33971 "gravecmb", 33972 0x0300, 33973 "gravecomb", 33974 0x0300, 33975 "gravedeva", 33976 0x0953, 33977 "gravelowmod", 33978 0x02ce, 33979 "gravemonospace", 33980 0xff40, 33981 "gravetonecmb", 33982 0x0340, 33983 "greater", 33984 0x003e, 33985 "greaterequal", 33986 0x2265, 33987 "greaterequalorless", 33988 0x22db, 33989 "greatermonospace", 33990 0xff1e, 33991 "greaterorequivalent", 33992 0x2273, 33993 "greaterorless", 33994 0x2277, 33995 "greateroverequal", 33996 0x2267, 33997 "greatersmall", 33998 0xfe65, 33999 "gscript", 34000 0x0261, 34001 "gstroke", 34002 0x01e5, 34003 "guhiragana", 34004 0x3050, 34005 "guillemotleft", 34006 0x00ab, 34007 "guillemotright", 34008 0x00bb, 34009 "guilsinglleft", 34010 0x2039, 34011 "guilsinglright", 34012 0x203a, 34013 "gukatakana", 34014 0x30b0, 34015 "guramusquare", 34016 0x3318, 34017 "gysquare", 34018 0x33c9, 34019 "h", 34020 0x0068, 34021 "haabkhasiancyrillic", 34022 0x04a9, 34023 "haaltonearabic", 34024 0x06c1, 34025 "habengali", 34026 0x09b9, 34027 "hadescendercyrillic", 34028 0x04b3, 34029 "hadeva", 34030 0x0939, 34031 "hagujarati", 34032 0x0ab9, 34033 "hagurmukhi", 34034 0x0a39, 34035 "haharabic", 34036 0x062d, 34037 "hahfinalarabic", 34038 0xfea2, 34039 "hahinitialarabic", 34040 0xfea3, 34041 "hahiragana", 34042 0x306f, 34043 "hahmedialarabic", 34044 0xfea4, 34045 "haitusquare", 34046 0x332a, 34047 "hakatakana", 34048 0x30cf, 34049 "hakatakanahalfwidth", 34050 0xff8a, 34051 "halantgurmukhi", 34052 0x0a4d, 34053 "hamzaarabic", 34054 0x0621, 34055 "hamzalowarabic", 34056 0x0621, 34057 "hangulfiller", 34058 0x3164, 34059 "hardsigncyrillic", 34060 0x044a, 34061 "harpoonleftbarbup", 34062 0x21bc, 34063 "harpoonrightbarbup", 34064 0x21c0, 34065 "hasquare", 34066 0x33ca, 34067 "hatafpatah", 34068 0x05b2, 34069 "hatafpatah16", 34070 0x05b2, 34071 "hatafpatah23", 34072 0x05b2, 34073 "hatafpatah2f", 34074 0x05b2, 34075 "hatafpatahhebrew", 34076 0x05b2, 34077 "hatafpatahnarrowhebrew", 34078 0x05b2, 34079 "hatafpatahquarterhebrew", 34080 0x05b2, 34081 "hatafpatahwidehebrew", 34082 0x05b2, 34083 "hatafqamats", 34084 0x05b3, 34085 "hatafqamats1b", 34086 0x05b3, 34087 "hatafqamats28", 34088 0x05b3, 34089 "hatafqamats34", 34090 0x05b3, 34091 "hatafqamatshebrew", 34092 0x05b3, 34093 "hatafqamatsnarrowhebrew", 34094 0x05b3, 34095 "hatafqamatsquarterhebrew", 34096 0x05b3, 34097 "hatafqamatswidehebrew", 34098 0x05b3, 34099 "hatafsegol", 34100 0x05b1, 34101 "hatafsegol17", 34102 0x05b1, 34103 "hatafsegol24", 34104 0x05b1, 34105 "hatafsegol30", 34106 0x05b1, 34107 "hatafsegolhebrew", 34108 0x05b1, 34109 "hatafsegolnarrowhebrew", 34110 0x05b1, 34111 "hatafsegolquarterhebrew", 34112 0x05b1, 34113 "hatafsegolwidehebrew", 34114 0x05b1, 34115 "hbar", 34116 0x0127, 34117 "hbopomofo", 34118 0x310f, 34119 "hbrevebelow", 34120 0x1e2b, 34121 "hcedilla", 34122 0x1e29, 34123 "hcircle", 34124 0x24d7, 34125 "hcircumflex", 34126 0x0125, 34127 "hdieresis", 34128 0x1e27, 34129 "hdotaccent", 34130 0x1e23, 34131 "hdotbelow", 34132 0x1e25, 34133 "he", 34134 0x05d4, 34135 "heart", 34136 0x2665, 34137 "heartsuitblack", 34138 0x2665, 34139 "heartsuitwhite", 34140 0x2661, 34141 "hedagesh", 34142 0xfb34, 34143 "hedageshhebrew", 34144 0xfb34, 34145 "hehaltonearabic", 34146 0x06c1, 34147 "heharabic", 34148 0x0647, 34149 "hehebrew", 34150 0x05d4, 34151 "hehfinalaltonearabic", 34152 0xfba7, 34153 "hehfinalalttwoarabic", 34154 0xfeea, 34155 "hehfinalarabic", 34156 0xfeea, 34157 "hehhamzaabovefinalarabic", 34158 0xfba5, 34159 "hehhamzaaboveisolatedarabic", 34160 0xfba4, 34161 "hehinitialaltonearabic", 34162 0xfba8, 34163 "hehinitialarabic", 34164 0xfeeb, 34165 "hehiragana", 34166 0x3078, 34167 "hehmedialaltonearabic", 34168 0xfba9, 34169 "hehmedialarabic", 34170 0xfeec, 34171 "heiseierasquare", 34172 0x337b, 34173 "hekatakana", 34174 0x30d8, 34175 "hekatakanahalfwidth", 34176 0xff8d, 34177 "hekutaarusquare", 34178 0x3336, 34179 "henghook", 34180 0x0267, 34181 "herutusquare", 34182 0x3339, 34183 "het", 34184 0x05d7, 34185 "hethebrew", 34186 0x05d7, 34187 "hhook", 34188 0x0266, 34189 "hhooksuperior", 34190 0x02b1, 34191 "hieuhacirclekorean", 34192 0x327b, 34193 "hieuhaparenkorean", 34194 0x321b, 34195 "hieuhcirclekorean", 34196 0x326d, 34197 "hieuhkorean", 34198 0x314e, 34199 "hieuhparenkorean", 34200 0x320d, 34201 "hihiragana", 34202 0x3072, 34203 "hikatakana", 34204 0x30d2, 34205 "hikatakanahalfwidth", 34206 0xff8b, 34207 "hiriq", 34208 0x05b4, 34209 "hiriq14", 34210 0x05b4, 34211 "hiriq21", 34212 0x05b4, 34213 "hiriq2d", 34214 0x05b4, 34215 "hiriqhebrew", 34216 0x05b4, 34217 "hiriqnarrowhebrew", 34218 0x05b4, 34219 "hiriqquarterhebrew", 34220 0x05b4, 34221 "hiriqwidehebrew", 34222 0x05b4, 34223 "hlinebelow", 34224 0x1e96, 34225 "hmonospace", 34226 0xff48, 34227 "hoarmenian", 34228 0x0570, 34229 "hohipthai", 34230 0x0e2b, 34231 "hohiragana", 34232 0x307b, 34233 "hokatakana", 34234 0x30db, 34235 "hokatakanahalfwidth", 34236 0xff8e, 34237 "holam", 34238 0x05b9, 34239 "holam19", 34240 0x05b9, 34241 "holam26", 34242 0x05b9, 34243 "holam32", 34244 0x05b9, 34245 "holamhebrew", 34246 0x05b9, 34247 "holamnarrowhebrew", 34248 0x05b9, 34249 "holamquarterhebrew", 34250 0x05b9, 34251 "holamwidehebrew", 34252 0x05b9, 34253 "honokhukthai", 34254 0x0e2e, 34255 "hookabovecomb", 34256 0x0309, 34257 "hookcmb", 34258 0x0309, 34259 "hookpalatalizedbelowcmb", 34260 0x0321, 34261 "hookretroflexbelowcmb", 34262 0x0322, 34263 "hoonsquare", 34264 0x3342, 34265 "horicoptic", 34266 0x03e9, 34267 "horizontalbar", 34268 0x2015, 34269 "horncmb", 34270 0x031b, 34271 "hotsprings", 34272 0x2668, 34273 "house", 34274 0x2302, 34275 "hparen", 34276 0x24a3, 34277 "hsuperior", 34278 0x02b0, 34279 "hturned", 34280 0x0265, 34281 "huhiragana", 34282 0x3075, 34283 "huiitosquare", 34284 0x3333, 34285 "hukatakana", 34286 0x30d5, 34287 "hukatakanahalfwidth", 34288 0xff8c, 34289 "hungarumlaut", 34290 0x02dd, 34291 "hungarumlautcmb", 34292 0x030b, 34293 "hv", 34294 0x0195, 34295 "hyphen", 34296 0x002d, 34297 "hypheninferior", 34298 0xf6e5, 34299 "hyphenmonospace", 34300 0xff0d, 34301 "hyphensmall", 34302 0xfe63, 34303 "hyphensuperior", 34304 0xf6e6, 34305 "hyphentwo", 34306 0x2010, 34307 "i", 34308 0x0069, 34309 "iacute", 34310 0x00ed, 34311 "iacyrillic", 34312 0x044f, 34313 "ibengali", 34314 0x0987, 34315 "ibopomofo", 34316 0x3127, 34317 "ibreve", 34318 0x012d, 34319 "icaron", 34320 0x01d0, 34321 "icircle", 34322 0x24d8, 34323 "icircumflex", 34324 0x00ee, 34325 "icyrillic", 34326 0x0456, 34327 "idblgrave", 34328 0x0209, 34329 "ideographearthcircle", 34330 0x328f, 34331 "ideographfirecircle", 34332 0x328b, 34333 "ideographicallianceparen", 34334 0x323f, 34335 "ideographiccallparen", 34336 0x323a, 34337 "ideographiccentrecircle", 34338 0x32a5, 34339 "ideographicclose", 34340 0x3006, 34341 "ideographiccomma", 34342 0x3001, 34343 "ideographiccommaleft", 34344 0xff64, 34345 "ideographiccongratulationparen", 34346 0x3237, 34347 "ideographiccorrectcircle", 34348 0x32a3, 34349 "ideographicearthparen", 34350 0x322f, 34351 "ideographicenterpriseparen", 34352 0x323d, 34353 "ideographicexcellentcircle", 34354 0x329d, 34355 "ideographicfestivalparen", 34356 0x3240, 34357 "ideographicfinancialcircle", 34358 0x3296, 34359 "ideographicfinancialparen", 34360 0x3236, 34361 "ideographicfireparen", 34362 0x322b, 34363 "ideographichaveparen", 34364 0x3232, 34365 "ideographichighcircle", 34366 0x32a4, 34367 "ideographiciterationmark", 34368 0x3005, 34369 "ideographiclaborcircle", 34370 0x3298, 34371 "ideographiclaborparen", 34372 0x3238, 34373 "ideographicleftcircle", 34374 0x32a7, 34375 "ideographiclowcircle", 34376 0x32a6, 34377 "ideographicmedicinecircle", 34378 0x32a9, 34379 "ideographicmetalparen", 34380 0x322e, 34381 "ideographicmoonparen", 34382 0x322a, 34383 "ideographicnameparen", 34384 0x3234, 34385 "ideographicperiod", 34386 0x3002, 34387 "ideographicprintcircle", 34388 0x329e, 34389 "ideographicreachparen", 34390 0x3243, 34391 "ideographicrepresentparen", 34392 0x3239, 34393 "ideographicresourceparen", 34394 0x323e, 34395 "ideographicrightcircle", 34396 0x32a8, 34397 "ideographicsecretcircle", 34398 0x3299, 34399 "ideographicselfparen", 34400 0x3242, 34401 "ideographicsocietyparen", 34402 0x3233, 34403 "ideographicspace", 34404 0x3000, 34405 "ideographicspecialparen", 34406 0x3235, 34407 "ideographicstockparen", 34408 0x3231, 34409 "ideographicstudyparen", 34410 0x323b, 34411 "ideographicsunparen", 34412 0x3230, 34413 "ideographicsuperviseparen", 34414 0x323c, 34415 "ideographicwaterparen", 34416 0x322c, 34417 "ideographicwoodparen", 34418 0x322d, 34419 "ideographiczero", 34420 0x3007, 34421 "ideographmetalcircle", 34422 0x328e, 34423 "ideographmooncircle", 34424 0x328a, 34425 "ideographnamecircle", 34426 0x3294, 34427 "ideographsuncircle", 34428 0x3290, 34429 "ideographwatercircle", 34430 0x328c, 34431 "ideographwoodcircle", 34432 0x328d, 34433 "ideva", 34434 0x0907, 34435 "idieresis", 34436 0x00ef, 34437 "idieresisacute", 34438 0x1e2f, 34439 "idieresiscyrillic", 34440 0x04e5, 34441 "idotbelow", 34442 0x1ecb, 34443 "iebrevecyrillic", 34444 0x04d7, 34445 "iecyrillic", 34446 0x0435, 34447 "ieungacirclekorean", 34448 0x3275, 34449 "ieungaparenkorean", 34450 0x3215, 34451 "ieungcirclekorean", 34452 0x3267, 34453 "ieungkorean", 34454 0x3147, 34455 "ieungparenkorean", 34456 0x3207, 34457 "igrave", 34458 0x00ec, 34459 "igujarati", 34460 0x0a87, 34461 "igurmukhi", 34462 0x0a07, 34463 "ihiragana", 34464 0x3044, 34465 "ihookabove", 34466 0x1ec9, 34467 "iibengali", 34468 0x0988, 34469 "iicyrillic", 34470 0x0438, 34471 "iideva", 34472 0x0908, 34473 "iigujarati", 34474 0x0a88, 34475 "iigurmukhi", 34476 0x0a08, 34477 "iimatragurmukhi", 34478 0x0a40, 34479 "iinvertedbreve", 34480 0x020b, 34481 "iishortcyrillic", 34482 0x0439, 34483 "iivowelsignbengali", 34484 0x09c0, 34485 "iivowelsigndeva", 34486 0x0940, 34487 "iivowelsigngujarati", 34488 0x0ac0, 34489 "ij", 34490 0x0133, 34491 "ikatakana", 34492 0x30a4, 34493 "ikatakanahalfwidth", 34494 0xff72, 34495 "ikorean", 34496 0x3163, 34497 "ilde", 34498 0x02dc, 34499 "iluyhebrew", 34500 0x05ac, 34501 "imacron", 34502 0x012b, 34503 "imacroncyrillic", 34504 0x04e3, 34505 "imageorapproximatelyequal", 34506 0x2253, 34507 "imatragurmukhi", 34508 0x0a3f, 34509 "imonospace", 34510 0xff49, 34511 "increment", 34512 0x2206, 34513 "infinity", 34514 0x221e, 34515 "iniarmenian", 34516 0x056b, 34517 "integral", 34518 0x222b, 34519 "integralbottom", 34520 0x2321, 34521 "integralbt", 34522 0x2321, 34523 "integralex", 34524 0xf8f5, 34525 "integraltop", 34526 0x2320, 34527 "integraltp", 34528 0x2320, 34529 "intersection", 34530 0x2229, 34531 "intisquare", 34532 0x3305, 34533 "invbullet", 34534 0x25d8, 34535 "invcircle", 34536 0x25d9, 34537 "invsmileface", 34538 0x263b, 34539 "iocyrillic", 34540 0x0451, 34541 "iogonek", 34542 0x012f, 34543 "iota", 34544 0x03b9, 34545 "iotadieresis", 34546 0x03ca, 34547 "iotadieresistonos", 34548 0x0390, 34549 "iotalatin", 34550 0x0269, 34551 "iotatonos", 34552 0x03af, 34553 "iparen", 34554 0x24a4, 34555 "irigurmukhi", 34556 0x0a72, 34557 "ismallhiragana", 34558 0x3043, 34559 "ismallkatakana", 34560 0x30a3, 34561 "ismallkatakanahalfwidth", 34562 0xff68, 34563 "issharbengali", 34564 0x09fa, 34565 "istroke", 34566 0x0268, 34567 "isuperior", 34568 0xf6ed, 34569 "iterationhiragana", 34570 0x309d, 34571 "iterationkatakana", 34572 0x30fd, 34573 "itilde", 34574 0x0129, 34575 "itildebelow", 34576 0x1e2d, 34577 "iubopomofo", 34578 0x3129, 34579 "iucyrillic", 34580 0x044e, 34581 "ivowelsignbengali", 34582 0x09bf, 34583 "ivowelsigndeva", 34584 0x093f, 34585 "ivowelsigngujarati", 34586 0x0abf, 34587 "izhitsacyrillic", 34588 0x0475, 34589 "izhitsadblgravecyrillic", 34590 0x0477, 34591 "j", 34592 0x006a, 34593 "jaarmenian", 34594 0x0571, 34595 "jabengali", 34596 0x099c, 34597 "jadeva", 34598 0x091c, 34599 "jagujarati", 34600 0x0a9c, 34601 "jagurmukhi", 34602 0x0a1c, 34603 "jbopomofo", 34604 0x3110, 34605 "jcaron", 34606 0x01f0, 34607 "jcircle", 34608 0x24d9, 34609 "jcircumflex", 34610 0x0135, 34611 "jcrossedtail", 34612 0x029d, 34613 "jdotlessstroke", 34614 0x025f, 34615 "jecyrillic", 34616 0x0458, 34617 "jeemarabic", 34618 0x062c, 34619 "jeemfinalarabic", 34620 0xfe9e, 34621 "jeeminitialarabic", 34622 0xfe9f, 34623 "jeemmedialarabic", 34624 0xfea0, 34625 "jeharabic", 34626 0x0698, 34627 "jehfinalarabic", 34628 0xfb8b, 34629 "jhabengali", 34630 0x099d, 34631 "jhadeva", 34632 0x091d, 34633 "jhagujarati", 34634 0x0a9d, 34635 "jhagurmukhi", 34636 0x0a1d, 34637 "jheharmenian", 34638 0x057b, 34639 "jis", 34640 0x3004, 34641 "jmonospace", 34642 0xff4a, 34643 "jparen", 34644 0x24a5, 34645 "jsuperior", 34646 0x02b2, 34647 "k", 34648 0x006b, 34649 "kabashkircyrillic", 34650 0x04a1, 34651 "kabengali", 34652 0x0995, 34653 "kacute", 34654 0x1e31, 34655 "kacyrillic", 34656 0x043a, 34657 "kadescendercyrillic", 34658 0x049b, 34659 "kadeva", 34660 0x0915, 34661 "kaf", 34662 0x05db, 34663 "kafarabic", 34664 0x0643, 34665 "kafdagesh", 34666 0xfb3b, 34667 "kafdageshhebrew", 34668 0xfb3b, 34669 "kaffinalarabic", 34670 0xfeda, 34671 "kafhebrew", 34672 0x05db, 34673 "kafinitialarabic", 34674 0xfedb, 34675 "kafmedialarabic", 34676 0xfedc, 34677 "kafrafehebrew", 34678 0xfb4d, 34679 "kagujarati", 34680 0x0a95, 34681 "kagurmukhi", 34682 0x0a15, 34683 "kahiragana", 34684 0x304b, 34685 "kahookcyrillic", 34686 0x04c4, 34687 "kakatakana", 34688 0x30ab, 34689 "kakatakanahalfwidth", 34690 0xff76, 34691 "kappa", 34692 0x03ba, 34693 "kappasymbolgreek", 34694 0x03f0, 34695 "kapyeounmieumkorean", 34696 0x3171, 34697 "kapyeounphieuphkorean", 34698 0x3184, 34699 "kapyeounpieupkorean", 34700 0x3178, 34701 "kapyeounssangpieupkorean", 34702 0x3179, 34703 "karoriisquare", 34704 0x330d, 34705 "kashidaautoarabic", 34706 0x0640, 34707 "kashidaautonosidebearingarabic", 34708 0x0640, 34709 "kasmallkatakana", 34710 0x30f5, 34711 "kasquare", 34712 0x3384, 34713 "kasraarabic", 34714 0x0650, 34715 "kasratanarabic", 34716 0x064d, 34717 "kastrokecyrillic", 34718 0x049f, 34719 "katahiraprolongmarkhalfwidth", 34720 0xff70, 34721 "kaverticalstrokecyrillic", 34722 0x049d, 34723 "kbopomofo", 34724 0x310e, 34725 "kcalsquare", 34726 0x3389, 34727 "kcaron", 34728 0x01e9, 34729 "kcedilla", 34730 0x0137, 34731 "kcircle", 34732 0x24da, 34733 "kcommaaccent", 34734 0x0137, 34735 "kdotbelow", 34736 0x1e33, 34737 "keharmenian", 34738 0x0584, 34739 "kehiragana", 34740 0x3051, 34741 "kekatakana", 34742 0x30b1, 34743 "kekatakanahalfwidth", 34744 0xff79, 34745 "kenarmenian", 34746 0x056f, 34747 "kesmallkatakana", 34748 0x30f6, 34749 "kgreenlandic", 34750 0x0138, 34751 "khabengali", 34752 0x0996, 34753 "khacyrillic", 34754 0x0445, 34755 "khadeva", 34756 0x0916, 34757 "khagujarati", 34758 0x0a96, 34759 "khagurmukhi", 34760 0x0a16, 34761 "khaharabic", 34762 0x062e, 34763 "khahfinalarabic", 34764 0xfea6, 34765 "khahinitialarabic", 34766 0xfea7, 34767 "khahmedialarabic", 34768 0xfea8, 34769 "kheicoptic", 34770 0x03e7, 34771 "khhadeva", 34772 0x0959, 34773 "khhagurmukhi", 34774 0x0a59, 34775 "khieukhacirclekorean", 34776 0x3278, 34777 "khieukhaparenkorean", 34778 0x3218, 34779 "khieukhcirclekorean", 34780 0x326a, 34781 "khieukhkorean", 34782 0x314b, 34783 "khieukhparenkorean", 34784 0x320a, 34785 "khokhaithai", 34786 0x0e02, 34787 "khokhonthai", 34788 0x0e05, 34789 "khokhuatthai", 34790 0x0e03, 34791 "khokhwaithai", 34792 0x0e04, 34793 "khomutthai", 34794 0x0e5b, 34795 "khook", 34796 0x0199, 34797 "khorakhangthai", 34798 0x0e06, 34799 "khzsquare", 34800 0x3391, 34801 "kihiragana", 34802 0x304d, 34803 "kikatakana", 34804 0x30ad, 34805 "kikatakanahalfwidth", 34806 0xff77, 34807 "kiroguramusquare", 34808 0x3315, 34809 "kiromeetorusquare", 34810 0x3316, 34811 "kirosquare", 34812 0x3314, 34813 "kiyeokacirclekorean", 34814 0x326e, 34815 "kiyeokaparenkorean", 34816 0x320e, 34817 "kiyeokcirclekorean", 34818 0x3260, 34819 "kiyeokkorean", 34820 0x3131, 34821 "kiyeokparenkorean", 34822 0x3200, 34823 "kiyeoksioskorean", 34824 0x3133, 34825 "kjecyrillic", 34826 0x045c, 34827 "klinebelow", 34828 0x1e35, 34829 "klsquare", 34830 0x3398, 34831 "kmcubedsquare", 34832 0x33a6, 34833 "kmonospace", 34834 0xff4b, 34835 "kmsquaredsquare", 34836 0x33a2, 34837 "kohiragana", 34838 0x3053, 34839 "kohmsquare", 34840 0x33c0, 34841 "kokaithai", 34842 0x0e01, 34843 "kokatakana", 34844 0x30b3, 34845 "kokatakanahalfwidth", 34846 0xff7a, 34847 "kooposquare", 34848 0x331e, 34849 "koppacyrillic", 34850 0x0481, 34851 "koreanstandardsymbol", 34852 0x327f, 34853 "koroniscmb", 34854 0x0343, 34855 "kparen", 34856 0x24a6, 34857 "kpasquare", 34858 0x33aa, 34859 "ksicyrillic", 34860 0x046f, 34861 "ktsquare", 34862 0x33cf, 34863 "kturned", 34864 0x029e, 34865 "kuhiragana", 34866 0x304f, 34867 "kukatakana", 34868 0x30af, 34869 "kukatakanahalfwidth", 34870 0xff78, 34871 "kvsquare", 34872 0x33b8, 34873 "kwsquare", 34874 0x33be, 34875 "l", 34876 0x006c, 34877 "labengali", 34878 0x09b2, 34879 "lacute", 34880 0x013a, 34881 "ladeva", 34882 0x0932, 34883 "lagujarati", 34884 0x0ab2, 34885 "lagurmukhi", 34886 0x0a32, 34887 "lakkhangyaothai", 34888 0x0e45, 34889 "lamaleffinalarabic", 34890 0xfefc, 34891 "lamalefhamzaabovefinalarabic", 34892 0xfef8, 34893 "lamalefhamzaaboveisolatedarabic", 34894 0xfef7, 34895 "lamalefhamzabelowfinalarabic", 34896 0xfefa, 34897 "lamalefhamzabelowisolatedarabic", 34898 0xfef9, 34899 "lamalefisolatedarabic", 34900 0xfefb, 34901 "lamalefmaddaabovefinalarabic", 34902 0xfef6, 34903 "lamalefmaddaaboveisolatedarabic", 34904 0xfef5, 34905 "lamarabic", 34906 0x0644, 34907 "lambda", 34908 0x03bb, 34909 "lambdastroke", 34910 0x019b, 34911 "lamed", 34912 0x05dc, 34913 "lameddagesh", 34914 0xfb3c, 34915 "lameddageshhebrew", 34916 0xfb3c, 34917 "lamedhebrew", 34918 0x05dc, 34919 "lamfinalarabic", 34920 0xfede, 34921 "lamhahinitialarabic", 34922 0xfcca, 34923 "laminitialarabic", 34924 0xfedf, 34925 "lamjeeminitialarabic", 34926 0xfcc9, 34927 "lamkhahinitialarabic", 34928 0xfccb, 34929 "lamlamhehisolatedarabic", 34930 0xfdf2, 34931 "lammedialarabic", 34932 0xfee0, 34933 "lammeemhahinitialarabic", 34934 0xfd88, 34935 "lammeeminitialarabic", 34936 0xfccc, 34937 "largecircle", 34938 0x25ef, 34939 "lbar", 34940 0x019a, 34941 "lbelt", 34942 0x026c, 34943 "lbopomofo", 34944 0x310c, 34945 "lcaron", 34946 0x013e, 34947 "lcedilla", 34948 0x013c, 34949 "lcircle", 34950 0x24db, 34951 "lcircumflexbelow", 34952 0x1e3d, 34953 "lcommaaccent", 34954 0x013c, 34955 "ldot", 34956 0x0140, 34957 "ldotaccent", 34958 0x0140, 34959 "ldotbelow", 34960 0x1e37, 34961 "ldotbelowmacron", 34962 0x1e39, 34963 "leftangleabovecmb", 34964 0x031a, 34965 "lefttackbelowcmb", 34966 0x0318, 34967 "less", 34968 0x003c, 34969 "lessequal", 34970 0x2264, 34971 "lessequalorgreater", 34972 0x22da, 34973 "lessmonospace", 34974 0xff1c, 34975 "lessorequivalent", 34976 0x2272, 34977 "lessorgreater", 34978 0x2276, 34979 "lessoverequal", 34980 0x2266, 34981 "lesssmall", 34982 0xfe64, 34983 "lezh", 34984 0x026e, 34985 "lfblock", 34986 0x258c, 34987 "lhookretroflex", 34988 0x026d, 34989 "lira", 34990 0x20a4, 34991 "liwnarmenian", 34992 0x056c, 34993 "lj", 34994 0x01c9, 34995 "ljecyrillic", 34996 0x0459, 34997 "ll", 34998 0xf6c0, 34999 "lladeva", 35000 0x0933, 35001 "llagujarati", 35002 0x0ab3, 35003 "llinebelow", 35004 0x1e3b, 35005 "llladeva", 35006 0x0934, 35007 "llvocalicbengali", 35008 0x09e1, 35009 "llvocalicdeva", 35010 0x0961, 35011 "llvocalicvowelsignbengali", 35012 0x09e3, 35013 "llvocalicvowelsigndeva", 35014 0x0963, 35015 "lmiddletilde", 35016 0x026b, 35017 "lmonospace", 35018 0xff4c, 35019 "lmsquare", 35020 0x33d0, 35021 "lochulathai", 35022 0x0e2c, 35023 "logicaland", 35024 0x2227, 35025 "logicalnot", 35026 0x00ac, 35027 "logicalnotreversed", 35028 0x2310, 35029 "logicalor", 35030 0x2228, 35031 "lolingthai", 35032 0x0e25, 35033 "longs", 35034 0x017f, 35035 "lowlinecenterline", 35036 0xfe4e, 35037 "lowlinecmb", 35038 0x0332, 35039 "lowlinedashed", 35040 0xfe4d, 35041 "lozenge", 35042 0x25ca, 35043 "lparen", 35044 0x24a7, 35045 "lslash", 35046 0x0142, 35047 "lsquare", 35048 0x2113, 35049 "lsuperior", 35050 0xf6ee, 35051 "ltshade", 35052 0x2591, 35053 "luthai", 35054 0x0e26, 35055 "lvocalicbengali", 35056 0x098c, 35057 "lvocalicdeva", 35058 0x090c, 35059 "lvocalicvowelsignbengali", 35060 0x09e2, 35061 "lvocalicvowelsigndeva", 35062 0x0962, 35063 "lxsquare", 35064 0x33d3, 35065 "m", 35066 0x006d, 35067 "mabengali", 35068 0x09ae, 35069 "macron", 35070 0x00af, 35071 "macronbelowcmb", 35072 0x0331, 35073 "macroncmb", 35074 0x0304, 35075 "macronlowmod", 35076 0x02cd, 35077 "macronmonospace", 35078 0xffe3, 35079 "macute", 35080 0x1e3f, 35081 "madeva", 35082 0x092e, 35083 "magujarati", 35084 0x0aae, 35085 "magurmukhi", 35086 0x0a2e, 35087 "mahapakhhebrew", 35088 0x05a4, 35089 "mahapakhlefthebrew", 35090 0x05a4, 35091 "mahiragana", 35092 0x307e, 35093 "maichattawalowleftthai", 35094 0xf895, 35095 "maichattawalowrightthai", 35096 0xf894, 35097 "maichattawathai", 35098 0x0e4b, 35099 "maichattawaupperleftthai", 35100 0xf893, 35101 "maieklowleftthai", 35102 0xf88c, 35103 "maieklowrightthai", 35104 0xf88b, 35105 "maiekthai", 35106 0x0e48, 35107 "maiekupperleftthai", 35108 0xf88a, 35109 "maihanakatleftthai", 35110 0xf884, 35111 "maihanakatthai", 35112 0x0e31, 35113 "maitaikhuleftthai", 35114 0xf889, 35115 "maitaikhuthai", 35116 0x0e47, 35117 "maitholowleftthai", 35118 0xf88f, 35119 "maitholowrightthai", 35120 0xf88e, 35121 "maithothai", 35122 0x0e49, 35123 "maithoupperleftthai", 35124 0xf88d, 35125 "maitrilowleftthai", 35126 0xf892, 35127 "maitrilowrightthai", 35128 0xf891, 35129 "maitrithai", 35130 0x0e4a, 35131 "maitriupperleftthai", 35132 0xf890, 35133 "maiyamokthai", 35134 0x0e46, 35135 "makatakana", 35136 0x30de, 35137 "makatakanahalfwidth", 35138 0xff8f, 35139 "male", 35140 0x2642, 35141 "mansyonsquare", 35142 0x3347, 35143 "maqafhebrew", 35144 0x05be, 35145 "mars", 35146 0x2642, 35147 "masoracirclehebrew", 35148 0x05af, 35149 "masquare", 35150 0x3383, 35151 "mbopomofo", 35152 0x3107, 35153 "mbsquare", 35154 0x33d4, 35155 "mcircle", 35156 0x24dc, 35157 "mcubedsquare", 35158 0x33a5, 35159 "mdotaccent", 35160 0x1e41, 35161 "mdotbelow", 35162 0x1e43, 35163 "meemarabic", 35164 0x0645, 35165 "meemfinalarabic", 35166 0xfee2, 35167 "meeminitialarabic", 35168 0xfee3, 35169 "meemmedialarabic", 35170 0xfee4, 35171 "meemmeeminitialarabic", 35172 0xfcd1, 35173 "meemmeemisolatedarabic", 35174 0xfc48, 35175 "meetorusquare", 35176 0x334d, 35177 "mehiragana", 35178 0x3081, 35179 "meizierasquare", 35180 0x337e, 35181 "mekatakana", 35182 0x30e1, 35183 "mekatakanahalfwidth", 35184 0xff92, 35185 "mem", 35186 0x05de, 35187 "memdagesh", 35188 0xfb3e, 35189 "memdageshhebrew", 35190 0xfb3e, 35191 "memhebrew", 35192 0x05de, 35193 "menarmenian", 35194 0x0574, 35195 "merkhahebrew", 35196 0x05a5, 35197 "merkhakefulahebrew", 35198 0x05a6, 35199 "merkhakefulalefthebrew", 35200 0x05a6, 35201 "merkhalefthebrew", 35202 0x05a5, 35203 "mhook", 35204 0x0271, 35205 "mhzsquare", 35206 0x3392, 35207 "middledotkatakanahalfwidth", 35208 0xff65, 35209 "middot", 35210 0x00b7, 35211 "mieumacirclekorean", 35212 0x3272, 35213 "mieumaparenkorean", 35214 0x3212, 35215 "mieumcirclekorean", 35216 0x3264, 35217 "mieumkorean", 35218 0x3141, 35219 "mieumpansioskorean", 35220 0x3170, 35221 "mieumparenkorean", 35222 0x3204, 35223 "mieumpieupkorean", 35224 0x316e, 35225 "mieumsioskorean", 35226 0x316f, 35227 "mihiragana", 35228 0x307f, 35229 "mikatakana", 35230 0x30df, 35231 "mikatakanahalfwidth", 35232 0xff90, 35233 "minus", 35234 0x2212, 35235 "minusbelowcmb", 35236 0x0320, 35237 "minuscircle", 35238 0x2296, 35239 "minusmod", 35240 0x02d7, 35241 "minusplus", 35242 0x2213, 35243 "minute", 35244 0x2032, 35245 "miribaarusquare", 35246 0x334a, 35247 "mirisquare", 35248 0x3349, 35249 "mlonglegturned", 35250 0x0270, 35251 "mlsquare", 35252 0x3396, 35253 "mmcubedsquare", 35254 0x33a3, 35255 "mmonospace", 35256 0xff4d, 35257 "mmsquaredsquare", 35258 0x339f, 35259 "mohiragana", 35260 0x3082, 35261 "mohmsquare", 35262 0x33c1, 35263 "mokatakana", 35264 0x30e2, 35265 "mokatakanahalfwidth", 35266 0xff93, 35267 "molsquare", 35268 0x33d6, 35269 "momathai", 35270 0x0e21, 35271 "moverssquare", 35272 0x33a7, 35273 "moverssquaredsquare", 35274 0x33a8, 35275 "mparen", 35276 0x24a8, 35277 "mpasquare", 35278 0x33ab, 35279 "mssquare", 35280 0x33b3, 35281 "msuperior", 35282 0xf6ef, 35283 "mturned", 35284 0x026f, 35285 "mu", 35286 0x00b5, 35287 "mu1", 35288 0x00b5, 35289 "muasquare", 35290 0x3382, 35291 "muchgreater", 35292 0x226b, 35293 "muchless", 35294 0x226a, 35295 "mufsquare", 35296 0x338c, 35297 "mugreek", 35298 0x03bc, 35299 "mugsquare", 35300 0x338d, 35301 "muhiragana", 35302 0x3080, 35303 "mukatakana", 35304 0x30e0, 35305 "mukatakanahalfwidth", 35306 0xff91, 35307 "mulsquare", 35308 0x3395, 35309 "multiply", 35310 0x00d7, 35311 "mumsquare", 35312 0x339b, 35313 "munahhebrew", 35314 0x05a3, 35315 "munahlefthebrew", 35316 0x05a3, 35317 "musicalnote", 35318 0x266a, 35319 "musicalnotedbl", 35320 0x266b, 35321 "musicflatsign", 35322 0x266d, 35323 "musicsharpsign", 35324 0x266f, 35325 "mussquare", 35326 0x33b2, 35327 "muvsquare", 35328 0x33b6, 35329 "muwsquare", 35330 0x33bc, 35331 "mvmegasquare", 35332 0x33b9, 35333 "mvsquare", 35334 0x33b7, 35335 "mwmegasquare", 35336 0x33bf, 35337 "mwsquare", 35338 0x33bd, 35339 "n", 35340 0x006e, 35341 "nabengali", 35342 0x09a8, 35343 "nabla", 35344 0x2207, 35345 "nacute", 35346 0x0144, 35347 "nadeva", 35348 0x0928, 35349 "nagujarati", 35350 0x0aa8, 35351 "nagurmukhi", 35352 0x0a28, 35353 "nahiragana", 35354 0x306a, 35355 "nakatakana", 35356 0x30ca, 35357 "nakatakanahalfwidth", 35358 0xff85, 35359 "napostrophe", 35360 0x0149, 35361 "nasquare", 35362 0x3381, 35363 "nbopomofo", 35364 0x310b, 35365 "nbspace", 35366 0x00a0, 35367 "ncaron", 35368 0x0148, 35369 "ncedilla", 35370 0x0146, 35371 "ncircle", 35372 0x24dd, 35373 "ncircumflexbelow", 35374 0x1e4b, 35375 "ncommaaccent", 35376 0x0146, 35377 "ndotaccent", 35378 0x1e45, 35379 "ndotbelow", 35380 0x1e47, 35381 "nehiragana", 35382 0x306d, 35383 "nekatakana", 35384 0x30cd, 35385 "nekatakanahalfwidth", 35386 0xff88, 35387 "newsheqelsign", 35388 0x20aa, 35389 "nfsquare", 35390 0x338b, 35391 "ngabengali", 35392 0x0999, 35393 "ngadeva", 35394 0x0919, 35395 "ngagujarati", 35396 0x0a99, 35397 "ngagurmukhi", 35398 0x0a19, 35399 "ngonguthai", 35400 0x0e07, 35401 "nhiragana", 35402 0x3093, 35403 "nhookleft", 35404 0x0272, 35405 "nhookretroflex", 35406 0x0273, 35407 "nieunacirclekorean", 35408 0x326f, 35409 "nieunaparenkorean", 35410 0x320f, 35411 "nieuncieuckorean", 35412 0x3135, 35413 "nieuncirclekorean", 35414 0x3261, 35415 "nieunhieuhkorean", 35416 0x3136, 35417 "nieunkorean", 35418 0x3134, 35419 "nieunpansioskorean", 35420 0x3168, 35421 "nieunparenkorean", 35422 0x3201, 35423 "nieunsioskorean", 35424 0x3167, 35425 "nieuntikeutkorean", 35426 0x3166, 35427 "nihiragana", 35428 0x306b, 35429 "nikatakana", 35430 0x30cb, 35431 "nikatakanahalfwidth", 35432 0xff86, 35433 "nikhahitleftthai", 35434 0xf899, 35435 "nikhahitthai", 35436 0x0e4d, 35437 "nine", 35438 0x0039, 35439 "ninearabic", 35440 0x0669, 35441 "ninebengali", 35442 0x09ef, 35443 "ninecircle", 35444 0x2468, 35445 "ninecircleinversesansserif", 35446 0x2792, 35447 "ninedeva", 35448 0x096f, 35449 "ninegujarati", 35450 0x0aef, 35451 "ninegurmukhi", 35452 0x0a6f, 35453 "ninehackarabic", 35454 0x0669, 35455 "ninehangzhou", 35456 0x3029, 35457 "nineideographicparen", 35458 0x3228, 35459 "nineinferior", 35460 0x2089, 35461 "ninemonospace", 35462 0xff19, 35463 "nineoldstyle", 35464 0xf739, 35465 "nineparen", 35466 0x247c, 35467 "nineperiod", 35468 0x2490, 35469 "ninepersian", 35470 0x06f9, 35471 "nineroman", 35472 0x2178, 35473 "ninesuperior", 35474 0x2079, 35475 "nineteencircle", 35476 0x2472, 35477 "nineteenparen", 35478 0x2486, 35479 "nineteenperiod", 35480 0x249a, 35481 "ninethai", 35482 0x0e59, 35483 "nj", 35484 0x01cc, 35485 "njecyrillic", 35486 0x045a, 35487 "nkatakana", 35488 0x30f3, 35489 "nkatakanahalfwidth", 35490 0xff9d, 35491 "nlegrightlong", 35492 0x019e, 35493 "nlinebelow", 35494 0x1e49, 35495 "nmonospace", 35496 0xff4e, 35497 "nmsquare", 35498 0x339a, 35499 "nnabengali", 35500 0x09a3, 35501 "nnadeva", 35502 0x0923, 35503 "nnagujarati", 35504 0x0aa3, 35505 "nnagurmukhi", 35506 0x0a23, 35507 "nnnadeva", 35508 0x0929, 35509 "nohiragana", 35510 0x306e, 35511 "nokatakana", 35512 0x30ce, 35513 "nokatakanahalfwidth", 35514 0xff89, 35515 "nonbreakingspace", 35516 0x00a0, 35517 "nonenthai", 35518 0x0e13, 35519 "nonuthai", 35520 0x0e19, 35521 "noonarabic", 35522 0x0646, 35523 "noonfinalarabic", 35524 0xfee6, 35525 "noonghunnaarabic", 35526 0x06ba, 35527 "noonghunnafinalarabic", 35528 0xfb9f, 35529 "nooninitialarabic", 35530 0xfee7, 35531 "noonjeeminitialarabic", 35532 0xfcd2, 35533 "noonjeemisolatedarabic", 35534 0xfc4b, 35535 "noonmedialarabic", 35536 0xfee8, 35537 "noonmeeminitialarabic", 35538 0xfcd5, 35539 "noonmeemisolatedarabic", 35540 0xfc4e, 35541 "noonnoonfinalarabic", 35542 0xfc8d, 35543 "notcontains", 35544 0x220c, 35545 "notelement", 35546 0x2209, 35547 "notelementof", 35548 0x2209, 35549 "notequal", 35550 0x2260, 35551 "notgreater", 35552 0x226f, 35553 "notgreaternorequal", 35554 0x2271, 35555 "notgreaternorless", 35556 0x2279, 35557 "notidentical", 35558 0x2262, 35559 "notless", 35560 0x226e, 35561 "notlessnorequal", 35562 0x2270, 35563 "notparallel", 35564 0x2226, 35565 "notprecedes", 35566 0x2280, 35567 "notsubset", 35568 0x2284, 35569 "notsucceeds", 35570 0x2281, 35571 "notsuperset", 35572 0x2285, 35573 "nowarmenian", 35574 0x0576, 35575 "nparen", 35576 0x24a9, 35577 "nssquare", 35578 0x33b1, 35579 "nsuperior", 35580 0x207f, 35581 "ntilde", 35582 0x00f1, 35583 "nu", 35584 0x03bd, 35585 "nuhiragana", 35586 0x306c, 35587 "nukatakana", 35588 0x30cc, 35589 "nukatakanahalfwidth", 35590 0xff87, 35591 "nuktabengali", 35592 0x09bc, 35593 "nuktadeva", 35594 0x093c, 35595 "nuktagujarati", 35596 0x0abc, 35597 "nuktagurmukhi", 35598 0x0a3c, 35599 "numbersign", 35600 0x0023, 35601 "numbersignmonospace", 35602 0xff03, 35603 "numbersignsmall", 35604 0xfe5f, 35605 "numeralsigngreek", 35606 0x0374, 35607 "numeralsignlowergreek", 35608 0x0375, 35609 "numero", 35610 0x2116, 35611 "nun", 35612 0x05e0, 35613 "nundagesh", 35614 0xfb40, 35615 "nundageshhebrew", 35616 0xfb40, 35617 "nunhebrew", 35618 0x05e0, 35619 "nvsquare", 35620 0x33b5, 35621 "nwsquare", 35622 0x33bb, 35623 "nyabengali", 35624 0x099e, 35625 "nyadeva", 35626 0x091e, 35627 "nyagujarati", 35628 0x0a9e, 35629 "nyagurmukhi", 35630 0x0a1e, 35631 "o", 35632 0x006f, 35633 "oacute", 35634 0x00f3, 35635 "oangthai", 35636 0x0e2d, 35637 "obarred", 35638 0x0275, 35639 "obarredcyrillic", 35640 0x04e9, 35641 "obarreddieresiscyrillic", 35642 0x04eb, 35643 "obengali", 35644 0x0993, 35645 "obopomofo", 35646 0x311b, 35647 "obreve", 35648 0x014f, 35649 "ocandradeva", 35650 0x0911, 35651 "ocandragujarati", 35652 0x0a91, 35653 "ocandravowelsigndeva", 35654 0x0949, 35655 "ocandravowelsigngujarati", 35656 0x0ac9, 35657 "ocaron", 35658 0x01d2, 35659 "ocircle", 35660 0x24de, 35661 "ocircumflex", 35662 0x00f4, 35663 "ocircumflexacute", 35664 0x1ed1, 35665 "ocircumflexdotbelow", 35666 0x1ed9, 35667 "ocircumflexgrave", 35668 0x1ed3, 35669 "ocircumflexhookabove", 35670 0x1ed5, 35671 "ocircumflextilde", 35672 0x1ed7, 35673 "ocyrillic", 35674 0x043e, 35675 "odblacute", 35676 0x0151, 35677 "odblgrave", 35678 0x020d, 35679 "odeva", 35680 0x0913, 35681 "odieresis", 35682 0x00f6, 35683 "odieresiscyrillic", 35684 0x04e7, 35685 "odotbelow", 35686 0x1ecd, 35687 "oe", 35688 0x0153, 35689 "oekorean", 35690 0x315a, 35691 "ogonek", 35692 0x02db, 35693 "ogonekcmb", 35694 0x0328, 35695 "ograve", 35696 0x00f2, 35697 "ogujarati", 35698 0x0a93, 35699 "oharmenian", 35700 0x0585, 35701 "ohiragana", 35702 0x304a, 35703 "ohookabove", 35704 0x1ecf, 35705 "ohorn", 35706 0x01a1, 35707 "ohornacute", 35708 0x1edb, 35709 "ohorndotbelow", 35710 0x1ee3, 35711 "ohorngrave", 35712 0x1edd, 35713 "ohornhookabove", 35714 0x1edf, 35715 "ohorntilde", 35716 0x1ee1, 35717 "ohungarumlaut", 35718 0x0151, 35719 "oi", 35720 0x01a3, 35721 "oinvertedbreve", 35722 0x020f, 35723 "okatakana", 35724 0x30aa, 35725 "okatakanahalfwidth", 35726 0xff75, 35727 "okorean", 35728 0x3157, 35729 "olehebrew", 35730 0x05ab, 35731 "omacron", 35732 0x014d, 35733 "omacronacute", 35734 0x1e53, 35735 "omacrongrave", 35736 0x1e51, 35737 "omdeva", 35738 0x0950, 35739 "omega", 35740 0x03c9, 35741 "omega1", 35742 0x03d6, 35743 "omegacyrillic", 35744 0x0461, 35745 "omegalatinclosed", 35746 0x0277, 35747 "omegaroundcyrillic", 35748 0x047b, 35749 "omegatitlocyrillic", 35750 0x047d, 35751 "omegatonos", 35752 0x03ce, 35753 "omgujarati", 35754 0x0ad0, 35755 "omicron", 35756 0x03bf, 35757 "omicrontonos", 35758 0x03cc, 35759 "omonospace", 35760 0xff4f, 35761 "one", 35762 0x0031, 35763 "onearabic", 35764 0x0661, 35765 "onebengali", 35766 0x09e7, 35767 "onecircle", 35768 0x2460, 35769 "onecircleinversesansserif", 35770 0x278a, 35771 "onedeva", 35772 0x0967, 35773 "onedotenleader", 35774 0x2024, 35775 "oneeighth", 35776 0x215b, 35777 "onefitted", 35778 0xf6dc, 35779 "onegujarati", 35780 0x0ae7, 35781 "onegurmukhi", 35782 0x0a67, 35783 "onehackarabic", 35784 0x0661, 35785 "onehalf", 35786 0x00bd, 35787 "onehangzhou", 35788 0x3021, 35789 "oneideographicparen", 35790 0x3220, 35791 "oneinferior", 35792 0x2081, 35793 "onemonospace", 35794 0xff11, 35795 "onenumeratorbengali", 35796 0x09f4, 35797 "oneoldstyle", 35798 0xf731, 35799 "oneparen", 35800 0x2474, 35801 "oneperiod", 35802 0x2488, 35803 "onepersian", 35804 0x06f1, 35805 "onequarter", 35806 0x00bc, 35807 "oneroman", 35808 0x2170, 35809 "onesuperior", 35810 0x00b9, 35811 "onethai", 35812 0x0e51, 35813 "onethird", 35814 0x2153, 35815 "oogonek", 35816 0x01eb, 35817 "oogonekmacron", 35818 0x01ed, 35819 "oogurmukhi", 35820 0x0a13, 35821 "oomatragurmukhi", 35822 0x0a4b, 35823 "oopen", 35824 0x0254, 35825 "oparen", 35826 0x24aa, 35827 "openbullet", 35828 0x25e6, 35829 "option", 35830 0x2325, 35831 "ordfeminine", 35832 0x00aa, 35833 "ordmasculine", 35834 0x00ba, 35835 "orthogonal", 35836 0x221f, 35837 "oshortdeva", 35838 0x0912, 35839 "oshortvowelsigndeva", 35840 0x094a, 35841 "oslash", 35842 0x00f8, 35843 "oslashacute", 35844 0x01ff, 35845 "osmallhiragana", 35846 0x3049, 35847 "osmallkatakana", 35848 0x30a9, 35849 "osmallkatakanahalfwidth", 35850 0xff6b, 35851 "ostrokeacute", 35852 0x01ff, 35853 "osuperior", 35854 0xf6f0, 35855 "otcyrillic", 35856 0x047f, 35857 "otilde", 35858 0x00f5, 35859 "otildeacute", 35860 0x1e4d, 35861 "otildedieresis", 35862 0x1e4f, 35863 "oubopomofo", 35864 0x3121, 35865 "overline", 35866 0x203e, 35867 "overlinecenterline", 35868 0xfe4a, 35869 "overlinecmb", 35870 0x0305, 35871 "overlinedashed", 35872 0xfe49, 35873 "overlinedblwavy", 35874 0xfe4c, 35875 "overlinewavy", 35876 0xfe4b, 35877 "overscore", 35878 0x00af, 35879 "ovowelsignbengali", 35880 0x09cb, 35881 "ovowelsigndeva", 35882 0x094b, 35883 "ovowelsigngujarati", 35884 0x0acb, 35885 "p", 35886 0x0070, 35887 "paampssquare", 35888 0x3380, 35889 "paasentosquare", 35890 0x332b, 35891 "pabengali", 35892 0x09aa, 35893 "pacute", 35894 0x1e55, 35895 "padeva", 35896 0x092a, 35897 "pagedown", 35898 0x21df, 35899 "pageup", 35900 0x21de, 35901 "pagujarati", 35902 0x0aaa, 35903 "pagurmukhi", 35904 0x0a2a, 35905 "pahiragana", 35906 0x3071, 35907 "paiyannoithai", 35908 0x0e2f, 35909 "pakatakana", 35910 0x30d1, 35911 "palatalizationcyrilliccmb", 35912 0x0484, 35913 "palochkacyrillic", 35914 0x04c0, 35915 "pansioskorean", 35916 0x317f, 35917 "paragraph", 35918 0x00b6, 35919 "parallel", 35920 0x2225, 35921 "parenleft", 35922 0x0028, 35923 "parenleftaltonearabic", 35924 0xfd3e, 35925 "parenleftbt", 35926 0xf8ed, 35927 "parenleftex", 35928 0xf8ec, 35929 "parenleftinferior", 35930 0x208d, 35931 "parenleftmonospace", 35932 0xff08, 35933 "parenleftsmall", 35934 0xfe59, 35935 "parenleftsuperior", 35936 0x207d, 35937 "parenlefttp", 35938 0xf8eb, 35939 "parenleftvertical", 35940 0xfe35, 35941 "parenright", 35942 0x0029, 35943 "parenrightaltonearabic", 35944 0xfd3f, 35945 "parenrightbt", 35946 0xf8f8, 35947 "parenrightex", 35948 0xf8f7, 35949 "parenrightinferior", 35950 0x208e, 35951 "parenrightmonospace", 35952 0xff09, 35953 "parenrightsmall", 35954 0xfe5a, 35955 "parenrightsuperior", 35956 0x207e, 35957 "parenrighttp", 35958 0xf8f6, 35959 "parenrightvertical", 35960 0xfe36, 35961 "partialdiff", 35962 0x2202, 35963 "paseqhebrew", 35964 0x05c0, 35965 "pashtahebrew", 35966 0x0599, 35967 "pasquare", 35968 0x33a9, 35969 "patah", 35970 0x05b7, 35971 "patah11", 35972 0x05b7, 35973 "patah1d", 35974 0x05b7, 35975 "patah2a", 35976 0x05b7, 35977 "patahhebrew", 35978 0x05b7, 35979 "patahnarrowhebrew", 35980 0x05b7, 35981 "patahquarterhebrew", 35982 0x05b7, 35983 "patahwidehebrew", 35984 0x05b7, 35985 "pazerhebrew", 35986 0x05a1, 35987 "pbopomofo", 35988 0x3106, 35989 "pcircle", 35990 0x24df, 35991 "pdotaccent", 35992 0x1e57, 35993 "pe", 35994 0x05e4, 35995 "pecyrillic", 35996 0x043f, 35997 "pedagesh", 35998 0xfb44, 35999 "pedageshhebrew", 36000 0xfb44, 36001 "peezisquare", 36002 0x333b, 36003 "pefinaldageshhebrew", 36004 0xfb43, 36005 "peharabic", 36006 0x067e, 36007 "peharmenian", 36008 0x057a, 36009 "pehebrew", 36010 0x05e4, 36011 "pehfinalarabic", 36012 0xfb57, 36013 "pehinitialarabic", 36014 0xfb58, 36015 "pehiragana", 36016 0x307a, 36017 "pehmedialarabic", 36018 0xfb59, 36019 "pekatakana", 36020 0x30da, 36021 "pemiddlehookcyrillic", 36022 0x04a7, 36023 "perafehebrew", 36024 0xfb4e, 36025 "percent", 36026 0x0025, 36027 "percentarabic", 36028 0x066a, 36029 "percentmonospace", 36030 0xff05, 36031 "percentsmall", 36032 0xfe6a, 36033 "period", 36034 0x002e, 36035 "periodarmenian", 36036 0x0589, 36037 "periodcentered", 36038 0x00b7, 36039 "periodhalfwidth", 36040 0xff61, 36041 "periodinferior", 36042 0xf6e7, 36043 "periodmonospace", 36044 0xff0e, 36045 "periodsmall", 36046 0xfe52, 36047 "periodsuperior", 36048 0xf6e8, 36049 "perispomenigreekcmb", 36050 0x0342, 36051 "perpendicular", 36052 0x22a5, 36053 "perthousand", 36054 0x2030, 36055 "peseta", 36056 0x20a7, 36057 "pfsquare", 36058 0x338a, 36059 "phabengali", 36060 0x09ab, 36061 "phadeva", 36062 0x092b, 36063 "phagujarati", 36064 0x0aab, 36065 "phagurmukhi", 36066 0x0a2b, 36067 "phi", 36068 0x03c6, 36069 "phi1", 36070 0x03d5, 36071 "phieuphacirclekorean", 36072 0x327a, 36073 "phieuphaparenkorean", 36074 0x321a, 36075 "phieuphcirclekorean", 36076 0x326c, 36077 "phieuphkorean", 36078 0x314d, 36079 "phieuphparenkorean", 36080 0x320c, 36081 "philatin", 36082 0x0278, 36083 "phinthuthai", 36084 0x0e3a, 36085 "phisymbolgreek", 36086 0x03d5, 36087 "phook", 36088 0x01a5, 36089 "phophanthai", 36090 0x0e1e, 36091 "phophungthai", 36092 0x0e1c, 36093 "phosamphaothai", 36094 0x0e20, 36095 "pi", 36096 0x03c0, 36097 "pieupacirclekorean", 36098 0x3273, 36099 "pieupaparenkorean", 36100 0x3213, 36101 "pieupcieuckorean", 36102 0x3176, 36103 "pieupcirclekorean", 36104 0x3265, 36105 "pieupkiyeokkorean", 36106 0x3172, 36107 "pieupkorean", 36108 0x3142, 36109 "pieupparenkorean", 36110 0x3205, 36111 "pieupsioskiyeokkorean", 36112 0x3174, 36113 "pieupsioskorean", 36114 0x3144, 36115 "pieupsiostikeutkorean", 36116 0x3175, 36117 "pieupthieuthkorean", 36118 0x3177, 36119 "pieuptikeutkorean", 36120 0x3173, 36121 "pihiragana", 36122 0x3074, 36123 "pikatakana", 36124 0x30d4, 36125 "pisymbolgreek", 36126 0x03d6, 36127 "piwrarmenian", 36128 0x0583, 36129 "plus", 36130 0x002b, 36131 "plusbelowcmb", 36132 0x031f, 36133 "pluscircle", 36134 0x2295, 36135 "plusminus", 36136 0x00b1, 36137 "plusmod", 36138 0x02d6, 36139 "plusmonospace", 36140 0xff0b, 36141 "plussmall", 36142 0xfe62, 36143 "plussuperior", 36144 0x207a, 36145 "pmonospace", 36146 0xff50, 36147 "pmsquare", 36148 0x33d8, 36149 "pohiragana", 36150 0x307d, 36151 "pointingindexdownwhite", 36152 0x261f, 36153 "pointingindexleftwhite", 36154 0x261c, 36155 "pointingindexrightwhite", 36156 0x261e, 36157 "pointingindexupwhite", 36158 0x261d, 36159 "pokatakana", 36160 0x30dd, 36161 "poplathai", 36162 0x0e1b, 36163 "postalmark", 36164 0x3012, 36165 "postalmarkface", 36166 0x3020, 36167 "pparen", 36168 0x24ab, 36169 "precedes", 36170 0x227a, 36171 "prescription", 36172 0x211e, 36173 "primemod", 36174 0x02b9, 36175 "primereversed", 36176 0x2035, 36177 "product", 36178 0x220f, 36179 "projective", 36180 0x2305, 36181 "prolongedkana", 36182 0x30fc, 36183 "propellor", 36184 0x2318, 36185 "propersubset", 36186 0x2282, 36187 "propersuperset", 36188 0x2283, 36189 "proportion", 36190 0x2237, 36191 "proportional", 36192 0x221d, 36193 "psi", 36194 0x03c8, 36195 "psicyrillic", 36196 0x0471, 36197 "psilipneumatacyrilliccmb", 36198 0x0486, 36199 "pssquare", 36200 0x33b0, 36201 "puhiragana", 36202 0x3077, 36203 "pukatakana", 36204 0x30d7, 36205 "pvsquare", 36206 0x33b4, 36207 "pwsquare", 36208 0x33ba, 36209 "q", 36210 0x0071, 36211 "qadeva", 36212 0x0958, 36213 "qadmahebrew", 36214 0x05a8, 36215 "qafarabic", 36216 0x0642, 36217 "qaffinalarabic", 36218 0xfed6, 36219 "qafinitialarabic", 36220 0xfed7, 36221 "qafmedialarabic", 36222 0xfed8, 36223 "qamats", 36224 0x05b8, 36225 "qamats10", 36226 0x05b8, 36227 "qamats1a", 36228 0x05b8, 36229 "qamats1c", 36230 0x05b8, 36231 "qamats27", 36232 0x05b8, 36233 "qamats29", 36234 0x05b8, 36235 "qamats33", 36236 0x05b8, 36237 "qamatsde", 36238 0x05b8, 36239 "qamatshebrew", 36240 0x05b8, 36241 "qamatsnarrowhebrew", 36242 0x05b8, 36243 "qamatsqatanhebrew", 36244 0x05b8, 36245 "qamatsqatannarrowhebrew", 36246 0x05b8, 36247 "qamatsqatanquarterhebrew", 36248 0x05b8, 36249 "qamatsqatanwidehebrew", 36250 0x05b8, 36251 "qamatsquarterhebrew", 36252 0x05b8, 36253 "qamatswidehebrew", 36254 0x05b8, 36255 "qarneyparahebrew", 36256 0x059f, 36257 "qbopomofo", 36258 0x3111, 36259 "qcircle", 36260 0x24e0, 36261 "qhook", 36262 0x02a0, 36263 "qmonospace", 36264 0xff51, 36265 "qof", 36266 0x05e7, 36267 "qofdagesh", 36268 0xfb47, 36269 "qofdageshhebrew", 36270 0xfb47, 36271 "qofhebrew", 36272 0x05e7, 36273 "qparen", 36274 0x24ac, 36275 "quarternote", 36276 0x2669, 36277 "qubuts", 36278 0x05bb, 36279 "qubuts18", 36280 0x05bb, 36281 "qubuts25", 36282 0x05bb, 36283 "qubuts31", 36284 0x05bb, 36285 "qubutshebrew", 36286 0x05bb, 36287 "qubutsnarrowhebrew", 36288 0x05bb, 36289 "qubutsquarterhebrew", 36290 0x05bb, 36291 "qubutswidehebrew", 36292 0x05bb, 36293 "question", 36294 0x003f, 36295 "questionarabic", 36296 0x061f, 36297 "questionarmenian", 36298 0x055e, 36299 "questiondown", 36300 0x00bf, 36301 "questiondownsmall", 36302 0xf7bf, 36303 "questiongreek", 36304 0x037e, 36305 "questionmonospace", 36306 0xff1f, 36307 "questionsmall", 36308 0xf73f, 36309 "quotedbl", 36310 0x0022, 36311 "quotedblbase", 36312 0x201e, 36313 "quotedblleft", 36314 0x201c, 36315 "quotedblmonospace", 36316 0xff02, 36317 "quotedblprime", 36318 0x301e, 36319 "quotedblprimereversed", 36320 0x301d, 36321 "quotedblright", 36322 0x201d, 36323 "quoteleft", 36324 0x2018, 36325 "quoteleftreversed", 36326 0x201b, 36327 "quotereversed", 36328 0x201b, 36329 "quoteright", 36330 0x2019, 36331 "quoterightn", 36332 0x0149, 36333 "quotesinglbase", 36334 0x201a, 36335 "quotesingle", 36336 0x0027, 36337 "quotesinglemonospace", 36338 0xff07, 36339 "r", 36340 0x0072, 36341 "raarmenian", 36342 0x057c, 36343 "rabengali", 36344 0x09b0, 36345 "racute", 36346 0x0155, 36347 "radeva", 36348 0x0930, 36349 "radical", 36350 0x221a, 36351 "radicalex", 36352 0xf8e5, 36353 "radoverssquare", 36354 0x33ae, 36355 "radoverssquaredsquare", 36356 0x33af, 36357 "radsquare", 36358 0x33ad, 36359 "rafe", 36360 0x05bf, 36361 "rafehebrew", 36362 0x05bf, 36363 "ragujarati", 36364 0x0ab0, 36365 "ragurmukhi", 36366 0x0a30, 36367 "rahiragana", 36368 0x3089, 36369 "rakatakana", 36370 0x30e9, 36371 "rakatakanahalfwidth", 36372 0xff97, 36373 "ralowerdiagonalbengali", 36374 0x09f1, 36375 "ramiddlediagonalbengali", 36376 0x09f0, 36377 "ramshorn", 36378 0x0264, 36379 "ratio", 36380 0x2236, 36381 "rbopomofo", 36382 0x3116, 36383 "rcaron", 36384 0x0159, 36385 "rcedilla", 36386 0x0157, 36387 "rcircle", 36388 0x24e1, 36389 "rcommaaccent", 36390 0x0157, 36391 "rdblgrave", 36392 0x0211, 36393 "rdotaccent", 36394 0x1e59, 36395 "rdotbelow", 36396 0x1e5b, 36397 "rdotbelowmacron", 36398 0x1e5d, 36399 "referencemark", 36400 0x203b, 36401 "reflexsubset", 36402 0x2286, 36403 "reflexsuperset", 36404 0x2287, 36405 "registered", 36406 0x00ae, 36407 "registersans", 36408 0xf8e8, 36409 "registerserif", 36410 0xf6da, 36411 "reharabic", 36412 0x0631, 36413 "reharmenian", 36414 0x0580, 36415 "rehfinalarabic", 36416 0xfeae, 36417 "rehiragana", 36418 0x308c, 36419 "rekatakana", 36420 0x30ec, 36421 "rekatakanahalfwidth", 36422 0xff9a, 36423 "resh", 36424 0x05e8, 36425 "reshdageshhebrew", 36426 0xfb48, 36427 "reshhebrew", 36428 0x05e8, 36429 "reversedtilde", 36430 0x223d, 36431 "reviahebrew", 36432 0x0597, 36433 "reviamugrashhebrew", 36434 0x0597, 36435 "revlogicalnot", 36436 0x2310, 36437 "rfishhook", 36438 0x027e, 36439 "rfishhookreversed", 36440 0x027f, 36441 "rhabengali", 36442 0x09dd, 36443 "rhadeva", 36444 0x095d, 36445 "rho", 36446 0x03c1, 36447 "rhook", 36448 0x027d, 36449 "rhookturned", 36450 0x027b, 36451 "rhookturnedsuperior", 36452 0x02b5, 36453 "rhosymbolgreek", 36454 0x03f1, 36455 "rhotichookmod", 36456 0x02de, 36457 "rieulacirclekorean", 36458 0x3271, 36459 "rieulaparenkorean", 36460 0x3211, 36461 "rieulcirclekorean", 36462 0x3263, 36463 "rieulhieuhkorean", 36464 0x3140, 36465 "rieulkiyeokkorean", 36466 0x313a, 36467 "rieulkiyeoksioskorean", 36468 0x3169, 36469 "rieulkorean", 36470 0x3139, 36471 "rieulmieumkorean", 36472 0x313b, 36473 "rieulpansioskorean", 36474 0x316c, 36475 "rieulparenkorean", 36476 0x3203, 36477 "rieulphieuphkorean", 36478 0x313f, 36479 "rieulpieupkorean", 36480 0x313c, 36481 "rieulpieupsioskorean", 36482 0x316b, 36483 "rieulsioskorean", 36484 0x313d, 36485 "rieulthieuthkorean", 36486 0x313e, 36487 "rieultikeutkorean", 36488 0x316a, 36489 "rieulyeorinhieuhkorean", 36490 0x316d, 36491 "rightangle", 36492 0x221f, 36493 "righttackbelowcmb", 36494 0x0319, 36495 "righttriangle", 36496 0x22bf, 36497 "rihiragana", 36498 0x308a, 36499 "rikatakana", 36500 0x30ea, 36501 "rikatakanahalfwidth", 36502 0xff98, 36503 "ring", 36504 0x02da, 36505 "ringbelowcmb", 36506 0x0325, 36507 "ringcmb", 36508 0x030a, 36509 "ringhalfleft", 36510 0x02bf, 36511 "ringhalfleftarmenian", 36512 0x0559, 36513 "ringhalfleftbelowcmb", 36514 0x031c, 36515 "ringhalfleftcentered", 36516 0x02d3, 36517 "ringhalfright", 36518 0x02be, 36519 "ringhalfrightbelowcmb", 36520 0x0339, 36521 "ringhalfrightcentered", 36522 0x02d2, 36523 "rinvertedbreve", 36524 0x0213, 36525 "rittorusquare", 36526 0x3351, 36527 "rlinebelow", 36528 0x1e5f, 36529 "rlongleg", 36530 0x027c, 36531 "rlonglegturned", 36532 0x027a, 36533 "rmonospace", 36534 0xff52, 36535 "rohiragana", 36536 0x308d, 36537 "rokatakana", 36538 0x30ed, 36539 "rokatakanahalfwidth", 36540 0xff9b, 36541 "roruathai", 36542 0x0e23, 36543 "rparen", 36544 0x24ad, 36545 "rrabengali", 36546 0x09dc, 36547 "rradeva", 36548 0x0931, 36549 "rragurmukhi", 36550 0x0a5c, 36551 "rreharabic", 36552 0x0691, 36553 "rrehfinalarabic", 36554 0xfb8d, 36555 "rrvocalicbengali", 36556 0x09e0, 36557 "rrvocalicdeva", 36558 0x0960, 36559 "rrvocalicgujarati", 36560 0x0ae0, 36561 "rrvocalicvowelsignbengali", 36562 0x09c4, 36563 "rrvocalicvowelsigndeva", 36564 0x0944, 36565 "rrvocalicvowelsigngujarati", 36566 0x0ac4, 36567 "rsuperior", 36568 0xf6f1, 36569 "rtblock", 36570 0x2590, 36571 "rturned", 36572 0x0279, 36573 "rturnedsuperior", 36574 0x02b4, 36575 "ruhiragana", 36576 0x308b, 36577 "rukatakana", 36578 0x30eb, 36579 "rukatakanahalfwidth", 36580 0xff99, 36581 "rupeemarkbengali", 36582 0x09f2, 36583 "rupeesignbengali", 36584 0x09f3, 36585 "rupiah", 36586 0xf6dd, 36587 "ruthai", 36588 0x0e24, 36589 "rvocalicbengali", 36590 0x098b, 36591 "rvocalicdeva", 36592 0x090b, 36593 "rvocalicgujarati", 36594 0x0a8b, 36595 "rvocalicvowelsignbengali", 36596 0x09c3, 36597 "rvocalicvowelsigndeva", 36598 0x0943, 36599 "rvocalicvowelsigngujarati", 36600 0x0ac3, 36601 "s", 36602 0x0073, 36603 "sabengali", 36604 0x09b8, 36605 "sacute", 36606 0x015b, 36607 "sacutedotaccent", 36608 0x1e65, 36609 "sadarabic", 36610 0x0635, 36611 "sadeva", 36612 0x0938, 36613 "sadfinalarabic", 36614 0xfeba, 36615 "sadinitialarabic", 36616 0xfebb, 36617 "sadmedialarabic", 36618 0xfebc, 36619 "sagujarati", 36620 0x0ab8, 36621 "sagurmukhi", 36622 0x0a38, 36623 "sahiragana", 36624 0x3055, 36625 "sakatakana", 36626 0x30b5, 36627 "sakatakanahalfwidth", 36628 0xff7b, 36629 "sallallahoualayhewasallamarabic", 36630 0xfdfa, 36631 "samekh", 36632 0x05e1, 36633 "samekhdagesh", 36634 0xfb41, 36635 "samekhdageshhebrew", 36636 0xfb41, 36637 "samekhhebrew", 36638 0x05e1, 36639 "saraaathai", 36640 0x0e32, 36641 "saraaethai", 36642 0x0e41, 36643 "saraaimaimalaithai", 36644 0x0e44, 36645 "saraaimaimuanthai", 36646 0x0e43, 36647 "saraamthai", 36648 0x0e33, 36649 "saraathai", 36650 0x0e30, 36651 "saraethai", 36652 0x0e40, 36653 "saraiileftthai", 36654 0xf886, 36655 "saraiithai", 36656 0x0e35, 36657 "saraileftthai", 36658 0xf885, 36659 "saraithai", 36660 0x0e34, 36661 "saraothai", 36662 0x0e42, 36663 "saraueeleftthai", 36664 0xf888, 36665 "saraueethai", 36666 0x0e37, 36667 "saraueleftthai", 36668 0xf887, 36669 "sarauethai", 36670 0x0e36, 36671 "sarauthai", 36672 0x0e38, 36673 "sarauuthai", 36674 0x0e39, 36675 "sbopomofo", 36676 0x3119, 36677 "scaron", 36678 0x0161, 36679 "scarondotaccent", 36680 0x1e67, 36681 "scedilla", 36682 0x015f, 36683 "schwa", 36684 0x0259, 36685 "schwacyrillic", 36686 0x04d9, 36687 "schwadieresiscyrillic", 36688 0x04db, 36689 "schwahook", 36690 0x025a, 36691 "scircle", 36692 0x24e2, 36693 "scircumflex", 36694 0x015d, 36695 "scommaaccent", 36696 0x0219, 36697 "sdotaccent", 36698 0x1e61, 36699 "sdotbelow", 36700 0x1e63, 36701 "sdotbelowdotaccent", 36702 0x1e69, 36703 "seagullbelowcmb", 36704 0x033c, 36705 "second", 36706 0x2033, 36707 "secondtonechinese", 36708 0x02ca, 36709 "section", 36710 0x00a7, 36711 "seenarabic", 36712 0x0633, 36713 "seenfinalarabic", 36714 0xfeb2, 36715 "seeninitialarabic", 36716 0xfeb3, 36717 "seenmedialarabic", 36718 0xfeb4, 36719 "segol", 36720 0x05b6, 36721 "segol13", 36722 0x05b6, 36723 "segol1f", 36724 0x05b6, 36725 "segol2c", 36726 0x05b6, 36727 "segolhebrew", 36728 0x05b6, 36729 "segolnarrowhebrew", 36730 0x05b6, 36731 "segolquarterhebrew", 36732 0x05b6, 36733 "segoltahebrew", 36734 0x0592, 36735 "segolwidehebrew", 36736 0x05b6, 36737 "seharmenian", 36738 0x057d, 36739 "sehiragana", 36740 0x305b, 36741 "sekatakana", 36742 0x30bb, 36743 "sekatakanahalfwidth", 36744 0xff7e, 36745 "semicolon", 36746 0x003b, 36747 "semicolonarabic", 36748 0x061b, 36749 "semicolonmonospace", 36750 0xff1b, 36751 "semicolonsmall", 36752 0xfe54, 36753 "semivoicedmarkkana", 36754 0x309c, 36755 "semivoicedmarkkanahalfwidth", 36756 0xff9f, 36757 "sentisquare", 36758 0x3322, 36759 "sentosquare", 36760 0x3323, 36761 "seven", 36762 0x0037, 36763 "sevenarabic", 36764 0x0667, 36765 "sevenbengali", 36766 0x09ed, 36767 "sevencircle", 36768 0x2466, 36769 "sevencircleinversesansserif", 36770 0x2790, 36771 "sevendeva", 36772 0x096d, 36773 "seveneighths", 36774 0x215e, 36775 "sevengujarati", 36776 0x0aed, 36777 "sevengurmukhi", 36778 0x0a6d, 36779 "sevenhackarabic", 36780 0x0667, 36781 "sevenhangzhou", 36782 0x3027, 36783 "sevenideographicparen", 36784 0x3226, 36785 "seveninferior", 36786 0x2087, 36787 "sevenmonospace", 36788 0xff17, 36789 "sevenoldstyle", 36790 0xf737, 36791 "sevenparen", 36792 0x247a, 36793 "sevenperiod", 36794 0x248e, 36795 "sevenpersian", 36796 0x06f7, 36797 "sevenroman", 36798 0x2176, 36799 "sevensuperior", 36800 0x2077, 36801 "seventeencircle", 36802 0x2470, 36803 "seventeenparen", 36804 0x2484, 36805 "seventeenperiod", 36806 0x2498, 36807 "seventhai", 36808 0x0e57, 36809 "sfthyphen", 36810 0x00ad, 36811 "shaarmenian", 36812 0x0577, 36813 "shabengali", 36814 0x09b6, 36815 "shacyrillic", 36816 0x0448, 36817 "shaddaarabic", 36818 0x0651, 36819 "shaddadammaarabic", 36820 0xfc61, 36821 "shaddadammatanarabic", 36822 0xfc5e, 36823 "shaddafathaarabic", 36824 0xfc60, 36825 "shaddakasraarabic", 36826 0xfc62, 36827 "shaddakasratanarabic", 36828 0xfc5f, 36829 "shade", 36830 0x2592, 36831 "shadedark", 36832 0x2593, 36833 "shadelight", 36834 0x2591, 36835 "shademedium", 36836 0x2592, 36837 "shadeva", 36838 0x0936, 36839 "shagujarati", 36840 0x0ab6, 36841 "shagurmukhi", 36842 0x0a36, 36843 "shalshelethebrew", 36844 0x0593, 36845 "shbopomofo", 36846 0x3115, 36847 "shchacyrillic", 36848 0x0449, 36849 "sheenarabic", 36850 0x0634, 36851 "sheenfinalarabic", 36852 0xfeb6, 36853 "sheeninitialarabic", 36854 0xfeb7, 36855 "sheenmedialarabic", 36856 0xfeb8, 36857 "sheicoptic", 36858 0x03e3, 36859 "sheqel", 36860 0x20aa, 36861 "sheqelhebrew", 36862 0x20aa, 36863 "sheva", 36864 0x05b0, 36865 "sheva115", 36866 0x05b0, 36867 "sheva15", 36868 0x05b0, 36869 "sheva22", 36870 0x05b0, 36871 "sheva2e", 36872 0x05b0, 36873 "shevahebrew", 36874 0x05b0, 36875 "shevanarrowhebrew", 36876 0x05b0, 36877 "shevaquarterhebrew", 36878 0x05b0, 36879 "shevawidehebrew", 36880 0x05b0, 36881 "shhacyrillic", 36882 0x04bb, 36883 "shimacoptic", 36884 0x03ed, 36885 "shin", 36886 0x05e9, 36887 "shindagesh", 36888 0xfb49, 36889 "shindageshhebrew", 36890 0xfb49, 36891 "shindageshshindot", 36892 0xfb2c, 36893 "shindageshshindothebrew", 36894 0xfb2c, 36895 "shindageshsindot", 36896 0xfb2d, 36897 "shindageshsindothebrew", 36898 0xfb2d, 36899 "shindothebrew", 36900 0x05c1, 36901 "shinhebrew", 36902 0x05e9, 36903 "shinshindot", 36904 0xfb2a, 36905 "shinshindothebrew", 36906 0xfb2a, 36907 "shinsindot", 36908 0xfb2b, 36909 "shinsindothebrew", 36910 0xfb2b, 36911 "shook", 36912 0x0282, 36913 "sigma", 36914 0x03c3, 36915 "sigma1", 36916 0x03c2, 36917 "sigmafinal", 36918 0x03c2, 36919 "sigmalunatesymbolgreek", 36920 0x03f2, 36921 "sihiragana", 36922 0x3057, 36923 "sikatakana", 36924 0x30b7, 36925 "sikatakanahalfwidth", 36926 0xff7c, 36927 "siluqhebrew", 36928 0x05bd, 36929 "siluqlefthebrew", 36930 0x05bd, 36931 "similar", 36932 0x223c, 36933 "sindothebrew", 36934 0x05c2, 36935 "siosacirclekorean", 36936 0x3274, 36937 "siosaparenkorean", 36938 0x3214, 36939 "sioscieuckorean", 36940 0x317e, 36941 "sioscirclekorean", 36942 0x3266, 36943 "sioskiyeokkorean", 36944 0x317a, 36945 "sioskorean", 36946 0x3145, 36947 "siosnieunkorean", 36948 0x317b, 36949 "siosparenkorean", 36950 0x3206, 36951 "siospieupkorean", 36952 0x317d, 36953 "siostikeutkorean", 36954 0x317c, 36955 "six", 36956 0x0036, 36957 "sixarabic", 36958 0x0666, 36959 "sixbengali", 36960 0x09ec, 36961 "sixcircle", 36962 0x2465, 36963 "sixcircleinversesansserif", 36964 0x278f, 36965 "sixdeva", 36966 0x096c, 36967 "sixgujarati", 36968 0x0aec, 36969 "sixgurmukhi", 36970 0x0a6c, 36971 "sixhackarabic", 36972 0x0666, 36973 "sixhangzhou", 36974 0x3026, 36975 "sixideographicparen", 36976 0x3225, 36977 "sixinferior", 36978 0x2086, 36979 "sixmonospace", 36980 0xff16, 36981 "sixoldstyle", 36982 0xf736, 36983 "sixparen", 36984 0x2479, 36985 "sixperiod", 36986 0x248d, 36987 "sixpersian", 36988 0x06f6, 36989 "sixroman", 36990 0x2175, 36991 "sixsuperior", 36992 0x2076, 36993 "sixteencircle", 36994 0x246f, 36995 "sixteencurrencydenominatorbengali", 36996 0x09f9, 36997 "sixteenparen", 36998 0x2483, 36999 "sixteenperiod", 37000 0x2497, 37001 "sixthai", 37002 0x0e56, 37003 "slash", 37004 0x002f, 37005 "slashmonospace", 37006 0xff0f, 37007 "slong", 37008 0x017f, 37009 "slongdotaccent", 37010 0x1e9b, 37011 "smileface", 37012 0x263a, 37013 "smonospace", 37014 0xff53, 37015 "sofpasuqhebrew", 37016 0x05c3, 37017 "softhyphen", 37018 0x00ad, 37019 "softsigncyrillic", 37020 0x044c, 37021 "sohiragana", 37022 0x305d, 37023 "sokatakana", 37024 0x30bd, 37025 "sokatakanahalfwidth", 37026 0xff7f, 37027 "soliduslongoverlaycmb", 37028 0x0338, 37029 "solidusshortoverlaycmb", 37030 0x0337, 37031 "sorusithai", 37032 0x0e29, 37033 "sosalathai", 37034 0x0e28, 37035 "sosothai", 37036 0x0e0b, 37037 "sosuathai", 37038 0x0e2a, 37039 "space", 37040 0x0020, 37041 "spacehackarabic", 37042 0x0020, 37043 "spade", 37044 0x2660, 37045 "spadesuitblack", 37046 0x2660, 37047 "spadesuitwhite", 37048 0x2664, 37049 "sparen", 37050 0x24ae, 37051 "squarebelowcmb", 37052 0x033b, 37053 "squarecc", 37054 0x33c4, 37055 "squarecm", 37056 0x339d, 37057 "squarediagonalcrosshatchfill", 37058 0x25a9, 37059 "squarehorizontalfill", 37060 0x25a4, 37061 "squarekg", 37062 0x338f, 37063 "squarekm", 37064 0x339e, 37065 "squarekmcapital", 37066 0x33ce, 37067 "squareln", 37068 0x33d1, 37069 "squarelog", 37070 0x33d2, 37071 "squaremg", 37072 0x338e, 37073 "squaremil", 37074 0x33d5, 37075 "squaremm", 37076 0x339c, 37077 "squaremsquared", 37078 0x33a1, 37079 "squareorthogonalcrosshatchfill", 37080 0x25a6, 37081 "squareupperlefttolowerrightfill", 37082 0x25a7, 37083 "squareupperrighttolowerleftfill", 37084 0x25a8, 37085 "squareverticalfill", 37086 0x25a5, 37087 "squarewhitewithsmallblack", 37088 0x25a3, 37089 "srsquare", 37090 0x33db, 37091 "ssabengali", 37092 0x09b7, 37093 "ssadeva", 37094 0x0937, 37095 "ssagujarati", 37096 0x0ab7, 37097 "ssangcieuckorean", 37098 0x3149, 37099 "ssanghieuhkorean", 37100 0x3185, 37101 "ssangieungkorean", 37102 0x3180, 37103 "ssangkiyeokkorean", 37104 0x3132, 37105 "ssangnieunkorean", 37106 0x3165, 37107 "ssangpieupkorean", 37108 0x3143, 37109 "ssangsioskorean", 37110 0x3146, 37111 "ssangtikeutkorean", 37112 0x3138, 37113 "ssuperior", 37114 0xf6f2, 37115 "sterling", 37116 0x00a3, 37117 "sterlingmonospace", 37118 0xffe1, 37119 "strokelongoverlaycmb", 37120 0x0336, 37121 "strokeshortoverlaycmb", 37122 0x0335, 37123 "subset", 37124 0x2282, 37125 "subsetnotequal", 37126 0x228a, 37127 "subsetorequal", 37128 0x2286, 37129 "succeeds", 37130 0x227b, 37131 "suchthat", 37132 0x220b, 37133 "suhiragana", 37134 0x3059, 37135 "sukatakana", 37136 0x30b9, 37137 "sukatakanahalfwidth", 37138 0xff7d, 37139 "sukunarabic", 37140 0x0652, 37141 "summation", 37142 0x2211, 37143 "sun", 37144 0x263c, 37145 "superset", 37146 0x2283, 37147 "supersetnotequal", 37148 0x228b, 37149 "supersetorequal", 37150 0x2287, 37151 "svsquare", 37152 0x33dc, 37153 "syouwaerasquare", 37154 0x337c, 37155 "t", 37156 0x0074, 37157 "tabengali", 37158 0x09a4, 37159 "tackdown", 37160 0x22a4, 37161 "tackleft", 37162 0x22a3, 37163 "tadeva", 37164 0x0924, 37165 "tagujarati", 37166 0x0aa4, 37167 "tagurmukhi", 37168 0x0a24, 37169 "taharabic", 37170 0x0637, 37171 "tahfinalarabic", 37172 0xfec2, 37173 "tahinitialarabic", 37174 0xfec3, 37175 "tahiragana", 37176 0x305f, 37177 "tahmedialarabic", 37178 0xfec4, 37179 "taisyouerasquare", 37180 0x337d, 37181 "takatakana", 37182 0x30bf, 37183 "takatakanahalfwidth", 37184 0xff80, 37185 "tatweelarabic", 37186 0x0640, 37187 "tau", 37188 0x03c4, 37189 "tav", 37190 0x05ea, 37191 "tavdages", 37192 0xfb4a, 37193 "tavdagesh", 37194 0xfb4a, 37195 "tavdageshhebrew", 37196 0xfb4a, 37197 "tavhebrew", 37198 0x05ea, 37199 "tbar", 37200 0x0167, 37201 "tbopomofo", 37202 0x310a, 37203 "tcaron", 37204 0x0165, 37205 "tccurl", 37206 0x02a8, 37207 "tcedilla", 37208 0x0163, 37209 "tcheharabic", 37210 0x0686, 37211 "tchehfinalarabic", 37212 0xfb7b, 37213 "tchehinitialarabic", 37214 0xfb7c, 37215 "tchehmedialarabic", 37216 0xfb7d, 37217 "tcircle", 37218 0x24e3, 37219 "tcircumflexbelow", 37220 0x1e71, 37221 "tcommaaccent", 37222 0x0163, 37223 "tdieresis", 37224 0x1e97, 37225 "tdotaccent", 37226 0x1e6b, 37227 "tdotbelow", 37228 0x1e6d, 37229 "tecyrillic", 37230 0x0442, 37231 "tedescendercyrillic", 37232 0x04ad, 37233 "teharabic", 37234 0x062a, 37235 "tehfinalarabic", 37236 0xfe96, 37237 "tehhahinitialarabic", 37238 0xfca2, 37239 "tehhahisolatedarabic", 37240 0xfc0c, 37241 "tehinitialarabic", 37242 0xfe97, 37243 "tehiragana", 37244 0x3066, 37245 "tehjeeminitialarabic", 37246 0xfca1, 37247 "tehjeemisolatedarabic", 37248 0xfc0b, 37249 "tehmarbutaarabic", 37250 0x0629, 37251 "tehmarbutafinalarabic", 37252 0xfe94, 37253 "tehmedialarabic", 37254 0xfe98, 37255 "tehmeeminitialarabic", 37256 0xfca4, 37257 "tehmeemisolatedarabic", 37258 0xfc0e, 37259 "tehnoonfinalarabic", 37260 0xfc73, 37261 "tekatakana", 37262 0x30c6, 37263 "tekatakanahalfwidth", 37264 0xff83, 37265 "telephone", 37266 0x2121, 37267 "telephoneblack", 37268 0x260e, 37269 "telishagedolahebrew", 37270 0x05a0, 37271 "telishaqetanahebrew", 37272 0x05a9, 37273 "tencircle", 37274 0x2469, 37275 "tenideographicparen", 37276 0x3229, 37277 "tenparen", 37278 0x247d, 37279 "tenperiod", 37280 0x2491, 37281 "tenroman", 37282 0x2179, 37283 "tesh", 37284 0x02a7, 37285 "tet", 37286 0x05d8, 37287 "tetdagesh", 37288 0xfb38, 37289 "tetdageshhebrew", 37290 0xfb38, 37291 "tethebrew", 37292 0x05d8, 37293 "tetsecyrillic", 37294 0x04b5, 37295 "tevirhebrew", 37296 0x059b, 37297 "tevirlefthebrew", 37298 0x059b, 37299 "thabengali", 37300 0x09a5, 37301 "thadeva", 37302 0x0925, 37303 "thagujarati", 37304 0x0aa5, 37305 "thagurmukhi", 37306 0x0a25, 37307 "thalarabic", 37308 0x0630, 37309 "thalfinalarabic", 37310 0xfeac, 37311 "thanthakhatlowleftthai", 37312 0xf898, 37313 "thanthakhatlowrightthai", 37314 0xf897, 37315 "thanthakhatthai", 37316 0x0e4c, 37317 "thanthakhatupperleftthai", 37318 0xf896, 37319 "theharabic", 37320 0x062b, 37321 "thehfinalarabic", 37322 0xfe9a, 37323 "thehinitialarabic", 37324 0xfe9b, 37325 "thehmedialarabic", 37326 0xfe9c, 37327 "thereexists", 37328 0x2203, 37329 "therefore", 37330 0x2234, 37331 "theta", 37332 0x03b8, 37333 "theta1", 37334 0x03d1, 37335 "thetasymbolgreek", 37336 0x03d1, 37337 "thieuthacirclekorean", 37338 0x3279, 37339 "thieuthaparenkorean", 37340 0x3219, 37341 "thieuthcirclekorean", 37342 0x326b, 37343 "thieuthkorean", 37344 0x314c, 37345 "thieuthparenkorean", 37346 0x320b, 37347 "thirteencircle", 37348 0x246c, 37349 "thirteenparen", 37350 0x2480, 37351 "thirteenperiod", 37352 0x2494, 37353 "thonangmonthothai", 37354 0x0e11, 37355 "thook", 37356 0x01ad, 37357 "thophuthaothai", 37358 0x0e12, 37359 "thorn", 37360 0x00fe, 37361 "thothahanthai", 37362 0x0e17, 37363 "thothanthai", 37364 0x0e10, 37365 "thothongthai", 37366 0x0e18, 37367 "thothungthai", 37368 0x0e16, 37369 "thousandcyrillic", 37370 0x0482, 37371 "thousandsseparatorarabic", 37372 0x066c, 37373 "thousandsseparatorpersian", 37374 0x066c, 37375 "three", 37376 0x0033, 37377 "threearabic", 37378 0x0663, 37379 "threebengali", 37380 0x09e9, 37381 "threecircle", 37382 0x2462, 37383 "threecircleinversesansserif", 37384 0x278c, 37385 "threedeva", 37386 0x0969, 37387 "threeeighths", 37388 0x215c, 37389 "threegujarati", 37390 0x0ae9, 37391 "threegurmukhi", 37392 0x0a69, 37393 "threehackarabic", 37394 0x0663, 37395 "threehangzhou", 37396 0x3023, 37397 "threeideographicparen", 37398 0x3222, 37399 "threeinferior", 37400 0x2083, 37401 "threemonospace", 37402 0xff13, 37403 "threenumeratorbengali", 37404 0x09f6, 37405 "threeoldstyle", 37406 0xf733, 37407 "threeparen", 37408 0x2476, 37409 "threeperiod", 37410 0x248a, 37411 "threepersian", 37412 0x06f3, 37413 "threequarters", 37414 0x00be, 37415 "threequartersemdash", 37416 0xf6de, 37417 "threeroman", 37418 0x2172, 37419 "threesuperior", 37420 0x00b3, 37421 "threethai", 37422 0x0e53, 37423 "thzsquare", 37424 0x3394, 37425 "tihiragana", 37426 0x3061, 37427 "tikatakana", 37428 0x30c1, 37429 "tikatakanahalfwidth", 37430 0xff81, 37431 "tikeutacirclekorean", 37432 0x3270, 37433 "tikeutaparenkorean", 37434 0x3210, 37435 "tikeutcirclekorean", 37436 0x3262, 37437 "tikeutkorean", 37438 0x3137, 37439 "tikeutparenkorean", 37440 0x3202, 37441 "tilde", 37442 0x02dc, 37443 "tildebelowcmb", 37444 0x0330, 37445 "tildecmb", 37446 0x0303, 37447 "tildecomb", 37448 0x0303, 37449 "tildedoublecmb", 37450 0x0360, 37451 "tildeoperator", 37452 0x223c, 37453 "tildeoverlaycmb", 37454 0x0334, 37455 "tildeverticalcmb", 37456 0x033e, 37457 "timescircle", 37458 0x2297, 37459 "tipehahebrew", 37460 0x0596, 37461 "tipehalefthebrew", 37462 0x0596, 37463 "tippigurmukhi", 37464 0x0a70, 37465 "titlocyrilliccmb", 37466 0x0483, 37467 "tiwnarmenian", 37468 0x057f, 37469 "tlinebelow", 37470 0x1e6f, 37471 "tmonospace", 37472 0xff54, 37473 "toarmenian", 37474 0x0569, 37475 "tohiragana", 37476 0x3068, 37477 "tokatakana", 37478 0x30c8, 37479 "tokatakanahalfwidth", 37480 0xff84, 37481 "tonebarextrahighmod", 37482 0x02e5, 37483 "tonebarextralowmod", 37484 0x02e9, 37485 "tonebarhighmod", 37486 0x02e6, 37487 "tonebarlowmod", 37488 0x02e8, 37489 "tonebarmidmod", 37490 0x02e7, 37491 "tonefive", 37492 0x01bd, 37493 "tonesix", 37494 0x0185, 37495 "tonetwo", 37496 0x01a8, 37497 "tonos", 37498 0x0384, 37499 "tonsquare", 37500 0x3327, 37501 "topatakthai", 37502 0x0e0f, 37503 "tortoiseshellbracketleft", 37504 0x3014, 37505 "tortoiseshellbracketleftsmall", 37506 0xfe5d, 37507 "tortoiseshellbracketleftvertical", 37508 0xfe39, 37509 "tortoiseshellbracketright", 37510 0x3015, 37511 "tortoiseshellbracketrightsmall", 37512 0xfe5e, 37513 "tortoiseshellbracketrightvertical", 37514 0xfe3a, 37515 "totaothai", 37516 0x0e15, 37517 "tpalatalhook", 37518 0x01ab, 37519 "tparen", 37520 0x24af, 37521 "trademark", 37522 0x2122, 37523 "trademarksans", 37524 0xf8ea, 37525 "trademarkserif", 37526 0xf6db, 37527 "tretroflexhook", 37528 0x0288, 37529 "triagdn", 37530 0x25bc, 37531 "triaglf", 37532 0x25c4, 37533 "triagrt", 37534 0x25ba, 37535 "triagup", 37536 0x25b2, 37537 "ts", 37538 0x02a6, 37539 "tsadi", 37540 0x05e6, 37541 "tsadidagesh", 37542 0xfb46, 37543 "tsadidageshhebrew", 37544 0xfb46, 37545 "tsadihebrew", 37546 0x05e6, 37547 "tsecyrillic", 37548 0x0446, 37549 "tsere", 37550 0x05b5, 37551 "tsere12", 37552 0x05b5, 37553 "tsere1e", 37554 0x05b5, 37555 "tsere2b", 37556 0x05b5, 37557 "tserehebrew", 37558 0x05b5, 37559 "tserenarrowhebrew", 37560 0x05b5, 37561 "tserequarterhebrew", 37562 0x05b5, 37563 "tserewidehebrew", 37564 0x05b5, 37565 "tshecyrillic", 37566 0x045b, 37567 "tsuperior", 37568 0xf6f3, 37569 "ttabengali", 37570 0x099f, 37571 "ttadeva", 37572 0x091f, 37573 "ttagujarati", 37574 0x0a9f, 37575 "ttagurmukhi", 37576 0x0a1f, 37577 "tteharabic", 37578 0x0679, 37579 "ttehfinalarabic", 37580 0xfb67, 37581 "ttehinitialarabic", 37582 0xfb68, 37583 "ttehmedialarabic", 37584 0xfb69, 37585 "tthabengali", 37586 0x09a0, 37587 "tthadeva", 37588 0x0920, 37589 "tthagujarati", 37590 0x0aa0, 37591 "tthagurmukhi", 37592 0x0a20, 37593 "tturned", 37594 0x0287, 37595 "tuhiragana", 37596 0x3064, 37597 "tukatakana", 37598 0x30c4, 37599 "tukatakanahalfwidth", 37600 0xff82, 37601 "tusmallhiragana", 37602 0x3063, 37603 "tusmallkatakana", 37604 0x30c3, 37605 "tusmallkatakanahalfwidth", 37606 0xff6f, 37607 "twelvecircle", 37608 0x246b, 37609 "twelveparen", 37610 0x247f, 37611 "twelveperiod", 37612 0x2493, 37613 "twelveroman", 37614 0x217b, 37615 "twentycircle", 37616 0x2473, 37617 "twentyhangzhou", 37618 0x5344, 37619 "twentyparen", 37620 0x2487, 37621 "twentyperiod", 37622 0x249b, 37623 "two", 37624 0x0032, 37625 "twoarabic", 37626 0x0662, 37627 "twobengali", 37628 0x09e8, 37629 "twocircle", 37630 0x2461, 37631 "twocircleinversesansserif", 37632 0x278b, 37633 "twodeva", 37634 0x0968, 37635 "twodotenleader", 37636 0x2025, 37637 "twodotleader", 37638 0x2025, 37639 "twodotleadervertical", 37640 0xfe30, 37641 "twogujarati", 37642 0x0ae8, 37643 "twogurmukhi", 37644 0x0a68, 37645 "twohackarabic", 37646 0x0662, 37647 "twohangzhou", 37648 0x3022, 37649 "twoideographicparen", 37650 0x3221, 37651 "twoinferior", 37652 0x2082, 37653 "twomonospace", 37654 0xff12, 37655 "twonumeratorbengali", 37656 0x09f5, 37657 "twooldstyle", 37658 0xf732, 37659 "twoparen", 37660 0x2475, 37661 "twoperiod", 37662 0x2489, 37663 "twopersian", 37664 0x06f2, 37665 "tworoman", 37666 0x2171, 37667 "twostroke", 37668 0x01bb, 37669 "twosuperior", 37670 0x00b2, 37671 "twothai", 37672 0x0e52, 37673 "twothirds", 37674 0x2154, 37675 "u", 37676 0x0075, 37677 "uacute", 37678 0x00fa, 37679 "ubar", 37680 0x0289, 37681 "ubengali", 37682 0x0989, 37683 "ubopomofo", 37684 0x3128, 37685 "ubreve", 37686 0x016d, 37687 "ucaron", 37688 0x01d4, 37689 "ucircle", 37690 0x24e4, 37691 "ucircumflex", 37692 0x00fb, 37693 "ucircumflexbelow", 37694 0x1e77, 37695 "ucyrillic", 37696 0x0443, 37697 "udattadeva", 37698 0x0951, 37699 "udblacute", 37700 0x0171, 37701 "udblgrave", 37702 0x0215, 37703 "udeva", 37704 0x0909, 37705 "udieresis", 37706 0x00fc, 37707 "udieresisacute", 37708 0x01d8, 37709 "udieresisbelow", 37710 0x1e73, 37711 "udieresiscaron", 37712 0x01da, 37713 "udieresiscyrillic", 37714 0x04f1, 37715 "udieresisgrave", 37716 0x01dc, 37717 "udieresismacron", 37718 0x01d6, 37719 "udotbelow", 37720 0x1ee5, 37721 "ugrave", 37722 0x00f9, 37723 "ugujarati", 37724 0x0a89, 37725 "ugurmukhi", 37726 0x0a09, 37727 "uhiragana", 37728 0x3046, 37729 "uhookabove", 37730 0x1ee7, 37731 "uhorn", 37732 0x01b0, 37733 "uhornacute", 37734 0x1ee9, 37735 "uhorndotbelow", 37736 0x1ef1, 37737 "uhorngrave", 37738 0x1eeb, 37739 "uhornhookabove", 37740 0x1eed, 37741 "uhorntilde", 37742 0x1eef, 37743 "uhungarumlaut", 37744 0x0171, 37745 "uhungarumlautcyrillic", 37746 0x04f3, 37747 "uinvertedbreve", 37748 0x0217, 37749 "ukatakana", 37750 0x30a6, 37751 "ukatakanahalfwidth", 37752 0xff73, 37753 "ukcyrillic", 37754 0x0479, 37755 "ukorean", 37756 0x315c, 37757 "umacron", 37758 0x016b, 37759 "umacroncyrillic", 37760 0x04ef, 37761 "umacrondieresis", 37762 0x1e7b, 37763 "umatragurmukhi", 37764 0x0a41, 37765 "umonospace", 37766 0xff55, 37767 "underscore", 37768 0x005f, 37769 "underscoredbl", 37770 0x2017, 37771 "underscoremonospace", 37772 0xff3f, 37773 "underscorevertical", 37774 0xfe33, 37775 "underscorewavy", 37776 0xfe4f, 37777 "union", 37778 0x222a, 37779 "universal", 37780 0x2200, 37781 "uogonek", 37782 0x0173, 37783 "uparen", 37784 0x24b0, 37785 "upblock", 37786 0x2580, 37787 "upperdothebrew", 37788 0x05c4, 37789 "upsilon", 37790 0x03c5, 37791 "upsilondieresis", 37792 0x03cb, 37793 "upsilondieresistonos", 37794 0x03b0, 37795 "upsilonlatin", 37796 0x028a, 37797 "upsilontonos", 37798 0x03cd, 37799 "uptackbelowcmb", 37800 0x031d, 37801 "uptackmod", 37802 0x02d4, 37803 "uragurmukhi", 37804 0x0a73, 37805 "uring", 37806 0x016f, 37807 "ushortcyrillic", 37808 0x045e, 37809 "usmallhiragana", 37810 0x3045, 37811 "usmallkatakana", 37812 0x30a5, 37813 "usmallkatakanahalfwidth", 37814 0xff69, 37815 "ustraightcyrillic", 37816 0x04af, 37817 "ustraightstrokecyrillic", 37818 0x04b1, 37819 "utilde", 37820 0x0169, 37821 "utildeacute", 37822 0x1e79, 37823 "utildebelow", 37824 0x1e75, 37825 "uubengali", 37826 0x098a, 37827 "uudeva", 37828 0x090a, 37829 "uugujarati", 37830 0x0a8a, 37831 "uugurmukhi", 37832 0x0a0a, 37833 "uumatragurmukhi", 37834 0x0a42, 37835 "uuvowelsignbengali", 37836 0x09c2, 37837 "uuvowelsigndeva", 37838 0x0942, 37839 "uuvowelsigngujarati", 37840 0x0ac2, 37841 "uvowelsignbengali", 37842 0x09c1, 37843 "uvowelsigndeva", 37844 0x0941, 37845 "uvowelsigngujarati", 37846 0x0ac1, 37847 "v", 37848 0x0076, 37849 "vadeva", 37850 0x0935, 37851 "vagujarati", 37852 0x0ab5, 37853 "vagurmukhi", 37854 0x0a35, 37855 "vakatakana", 37856 0x30f7, 37857 "vav", 37858 0x05d5, 37859 "vavdagesh", 37860 0xfb35, 37861 "vavdagesh65", 37862 0xfb35, 37863 "vavdageshhebrew", 37864 0xfb35, 37865 "vavhebrew", 37866 0x05d5, 37867 "vavholam", 37868 0xfb4b, 37869 "vavholamhebrew", 37870 0xfb4b, 37871 "vavvavhebrew", 37872 0x05f0, 37873 "vavyodhebrew", 37874 0x05f1, 37875 "vcircle", 37876 0x24e5, 37877 "vdotbelow", 37878 0x1e7f, 37879 "vecyrillic", 37880 0x0432, 37881 "veharabic", 37882 0x06a4, 37883 "vehfinalarabic", 37884 0xfb6b, 37885 "vehinitialarabic", 37886 0xfb6c, 37887 "vehmedialarabic", 37888 0xfb6d, 37889 "vekatakana", 37890 0x30f9, 37891 "venus", 37892 0x2640, 37893 "verticalbar", 37894 0x007c, 37895 "verticallineabovecmb", 37896 0x030d, 37897 "verticallinebelowcmb", 37898 0x0329, 37899 "verticallinelowmod", 37900 0x02cc, 37901 "verticallinemod", 37902 0x02c8, 37903 "vewarmenian", 37904 0x057e, 37905 "vhook", 37906 0x028b, 37907 "vikatakana", 37908 0x30f8, 37909 "viramabengali", 37910 0x09cd, 37911 "viramadeva", 37912 0x094d, 37913 "viramagujarati", 37914 0x0acd, 37915 "visargabengali", 37916 0x0983, 37917 "visargadeva", 37918 0x0903, 37919 "visargagujarati", 37920 0x0a83, 37921 "vmonospace", 37922 0xff56, 37923 "voarmenian", 37924 0x0578, 37925 "voicediterationhiragana", 37926 0x309e, 37927 "voicediterationkatakana", 37928 0x30fe, 37929 "voicedmarkkana", 37930 0x309b, 37931 "voicedmarkkanahalfwidth", 37932 0xff9e, 37933 "vokatakana", 37934 0x30fa, 37935 "vparen", 37936 0x24b1, 37937 "vtilde", 37938 0x1e7d, 37939 "vturned", 37940 0x028c, 37941 "vuhiragana", 37942 0x3094, 37943 "vukatakana", 37944 0x30f4, 37945 "w", 37946 0x0077, 37947 "wacute", 37948 0x1e83, 37949 "waekorean", 37950 0x3159, 37951 "wahiragana", 37952 0x308f, 37953 "wakatakana", 37954 0x30ef, 37955 "wakatakanahalfwidth", 37956 0xff9c, 37957 "wakorean", 37958 0x3158, 37959 "wasmallhiragana", 37960 0x308e, 37961 "wasmallkatakana", 37962 0x30ee, 37963 "wattosquare", 37964 0x3357, 37965 "wavedash", 37966 0x301c, 37967 "wavyunderscorevertical", 37968 0xfe34, 37969 "wawarabic", 37970 0x0648, 37971 "wawfinalarabic", 37972 0xfeee, 37973 "wawhamzaabovearabic", 37974 0x0624, 37975 "wawhamzaabovefinalarabic", 37976 0xfe86, 37977 "wbsquare", 37978 0x33dd, 37979 "wcircle", 37980 0x24e6, 37981 "wcircumflex", 37982 0x0175, 37983 "wdieresis", 37984 0x1e85, 37985 "wdotaccent", 37986 0x1e87, 37987 "wdotbelow", 37988 0x1e89, 37989 "wehiragana", 37990 0x3091, 37991 "weierstrass", 37992 0x2118, 37993 "wekatakana", 37994 0x30f1, 37995 "wekorean", 37996 0x315e, 37997 "weokorean", 37998 0x315d, 37999 "wgrave", 38000 0x1e81, 38001 "whitebullet", 38002 0x25e6, 38003 "whitecircle", 38004 0x25cb, 38005 "whitecircleinverse", 38006 0x25d9, 38007 "whitecornerbracketleft", 38008 0x300e, 38009 "whitecornerbracketleftvertical", 38010 0xfe43, 38011 "whitecornerbracketright", 38012 0x300f, 38013 "whitecornerbracketrightvertical", 38014 0xfe44, 38015 "whitediamond", 38016 0x25c7, 38017 "whitediamondcontainingblacksmalldiamond", 38018 0x25c8, 38019 "whitedownpointingsmalltriangle", 38020 0x25bf, 38021 "whitedownpointingtriangle", 38022 0x25bd, 38023 "whiteleftpointingsmalltriangle", 38024 0x25c3, 38025 "whiteleftpointingtriangle", 38026 0x25c1, 38027 "whitelenticularbracketleft", 38028 0x3016, 38029 "whitelenticularbracketright", 38030 0x3017, 38031 "whiterightpointingsmalltriangle", 38032 0x25b9, 38033 "whiterightpointingtriangle", 38034 0x25b7, 38035 "whitesmallsquare", 38036 0x25ab, 38037 "whitesmilingface", 38038 0x263a, 38039 "whitesquare", 38040 0x25a1, 38041 "whitestar", 38042 0x2606, 38043 "whitetelephone", 38044 0x260f, 38045 "whitetortoiseshellbracketleft", 38046 0x3018, 38047 "whitetortoiseshellbracketright", 38048 0x3019, 38049 "whiteuppointingsmalltriangle", 38050 0x25b5, 38051 "whiteuppointingtriangle", 38052 0x25b3, 38053 "wihiragana", 38054 0x3090, 38055 "wikatakana", 38056 0x30f0, 38057 "wikorean", 38058 0x315f, 38059 "wmonospace", 38060 0xff57, 38061 "wohiragana", 38062 0x3092, 38063 "wokatakana", 38064 0x30f2, 38065 "wokatakanahalfwidth", 38066 0xff66, 38067 "won", 38068 0x20a9, 38069 "wonmonospace", 38070 0xffe6, 38071 "wowaenthai", 38072 0x0e27, 38073 "wparen", 38074 0x24b2, 38075 "wring", 38076 0x1e98, 38077 "wsuperior", 38078 0x02b7, 38079 "wturned", 38080 0x028d, 38081 "wynn", 38082 0x01bf, 38083 "x", 38084 0x0078, 38085 "xabovecmb", 38086 0x033d, 38087 "xbopomofo", 38088 0x3112, 38089 "xcircle", 38090 0x24e7, 38091 "xdieresis", 38092 0x1e8d, 38093 "xdotaccent", 38094 0x1e8b, 38095 "xeharmenian", 38096 0x056d, 38097 "xi", 38098 0x03be, 38099 "xmonospace", 38100 0xff58, 38101 "xparen", 38102 0x24b3, 38103 "xsuperior", 38104 0x02e3, 38105 "y", 38106 0x0079, 38107 "yaadosquare", 38108 0x334e, 38109 "yabengali", 38110 0x09af, 38111 "yacute", 38112 0x00fd, 38113 "yadeva", 38114 0x092f, 38115 "yaekorean", 38116 0x3152, 38117 "yagujarati", 38118 0x0aaf, 38119 "yagurmukhi", 38120 0x0a2f, 38121 "yahiragana", 38122 0x3084, 38123 "yakatakana", 38124 0x30e4, 38125 "yakatakanahalfwidth", 38126 0xff94, 38127 "yakorean", 38128 0x3151, 38129 "yamakkanthai", 38130 0x0e4e, 38131 "yasmallhiragana", 38132 0x3083, 38133 "yasmallkatakana", 38134 0x30e3, 38135 "yasmallkatakanahalfwidth", 38136 0xff6c, 38137 "yatcyrillic", 38138 0x0463, 38139 "ycircle", 38140 0x24e8, 38141 "ycircumflex", 38142 0x0177, 38143 "ydieresis", 38144 0x00ff, 38145 "ydotaccent", 38146 0x1e8f, 38147 "ydotbelow", 38148 0x1ef5, 38149 "yeharabic", 38150 0x064a, 38151 "yehbarreearabic", 38152 0x06d2, 38153 "yehbarreefinalarabic", 38154 0xfbaf, 38155 "yehfinalarabic", 38156 0xfef2, 38157 "yehhamzaabovearabic", 38158 0x0626, 38159 "yehhamzaabovefinalarabic", 38160 0xfe8a, 38161 "yehhamzaaboveinitialarabic", 38162 0xfe8b, 38163 "yehhamzaabovemedialarabic", 38164 0xfe8c, 38165 "yehinitialarabic", 38166 0xfef3, 38167 "yehmedialarabic", 38168 0xfef4, 38169 "yehmeeminitialarabic", 38170 0xfcdd, 38171 "yehmeemisolatedarabic", 38172 0xfc58, 38173 "yehnoonfinalarabic", 38174 0xfc94, 38175 "yehthreedotsbelowarabic", 38176 0x06d1, 38177 "yekorean", 38178 0x3156, 38179 "yen", 38180 0x00a5, 38181 "yenmonospace", 38182 0xffe5, 38183 "yeokorean", 38184 0x3155, 38185 "yeorinhieuhkorean", 38186 0x3186, 38187 "yerahbenyomohebrew", 38188 0x05aa, 38189 "yerahbenyomolefthebrew", 38190 0x05aa, 38191 "yericyrillic", 38192 0x044b, 38193 "yerudieresiscyrillic", 38194 0x04f9, 38195 "yesieungkorean", 38196 0x3181, 38197 "yesieungpansioskorean", 38198 0x3183, 38199 "yesieungsioskorean", 38200 0x3182, 38201 "yetivhebrew", 38202 0x059a, 38203 "ygrave", 38204 0x1ef3, 38205 "yhook", 38206 0x01b4, 38207 "yhookabove", 38208 0x1ef7, 38209 "yiarmenian", 38210 0x0575, 38211 "yicyrillic", 38212 0x0457, 38213 "yikorean", 38214 0x3162, 38215 "yinyang", 38216 0x262f, 38217 "yiwnarmenian", 38218 0x0582, 38219 "ymonospace", 38220 0xff59, 38221 "yod", 38222 0x05d9, 38223 "yoddagesh", 38224 0xfb39, 38225 "yoddageshhebrew", 38226 0xfb39, 38227 "yodhebrew", 38228 0x05d9, 38229 "yodyodhebrew", 38230 0x05f2, 38231 "yodyodpatahhebrew", 38232 0xfb1f, 38233 "yohiragana", 38234 0x3088, 38235 "yoikorean", 38236 0x3189, 38237 "yokatakana", 38238 0x30e8, 38239 "yokatakanahalfwidth", 38240 0xff96, 38241 "yokorean", 38242 0x315b, 38243 "yosmallhiragana", 38244 0x3087, 38245 "yosmallkatakana", 38246 0x30e7, 38247 "yosmallkatakanahalfwidth", 38248 0xff6e, 38249 "yotgreek", 38250 0x03f3, 38251 "yoyaekorean", 38252 0x3188, 38253 "yoyakorean", 38254 0x3187, 38255 "yoyakthai", 38256 0x0e22, 38257 "yoyingthai", 38258 0x0e0d, 38259 "yparen", 38260 0x24b4, 38261 "ypogegrammeni", 38262 0x037a, 38263 "ypogegrammenigreekcmb", 38264 0x0345, 38265 "yr", 38266 0x01a6, 38267 "yring", 38268 0x1e99, 38269 "ysuperior", 38270 0x02b8, 38271 "ytilde", 38272 0x1ef9, 38273 "yturned", 38274 0x028e, 38275 "yuhiragana", 38276 0x3086, 38277 "yuikorean", 38278 0x318c, 38279 "yukatakana", 38280 0x30e6, 38281 "yukatakanahalfwidth", 38282 0xff95, 38283 "yukorean", 38284 0x3160, 38285 "yusbigcyrillic", 38286 0x046b, 38287 "yusbigiotifiedcyrillic", 38288 0x046d, 38289 "yuslittlecyrillic", 38290 0x0467, 38291 "yuslittleiotifiedcyrillic", 38292 0x0469, 38293 "yusmallhiragana", 38294 0x3085, 38295 "yusmallkatakana", 38296 0x30e5, 38297 "yusmallkatakanahalfwidth", 38298 0xff6d, 38299 "yuyekorean", 38300 0x318b, 38301 "yuyeokorean", 38302 0x318a, 38303 "yyabengali", 38304 0x09df, 38305 "yyadeva", 38306 0x095f, 38307 "z", 38308 0x007a, 38309 "zaarmenian", 38310 0x0566, 38311 "zacute", 38312 0x017a, 38313 "zadeva", 38314 0x095b, 38315 "zagurmukhi", 38316 0x0a5b, 38317 "zaharabic", 38318 0x0638, 38319 "zahfinalarabic", 38320 0xfec6, 38321 "zahinitialarabic", 38322 0xfec7, 38323 "zahiragana", 38324 0x3056, 38325 "zahmedialarabic", 38326 0xfec8, 38327 "zainarabic", 38328 0x0632, 38329 "zainfinalarabic", 38330 0xfeb0, 38331 "zakatakana", 38332 0x30b6, 38333 "zaqefgadolhebrew", 38334 0x0595, 38335 "zaqefqatanhebrew", 38336 0x0594, 38337 "zarqahebrew", 38338 0x0598, 38339 "zayin", 38340 0x05d6, 38341 "zayindagesh", 38342 0xfb36, 38343 "zayindageshhebrew", 38344 0xfb36, 38345 "zayinhebrew", 38346 0x05d6, 38347 "zbopomofo", 38348 0x3117, 38349 "zcaron", 38350 0x017e, 38351 "zcircle", 38352 0x24e9, 38353 "zcircumflex", 38354 0x1e91, 38355 "zcurl", 38356 0x0291, 38357 "zdot", 38358 0x017c, 38359 "zdotaccent", 38360 0x017c, 38361 "zdotbelow", 38362 0x1e93, 38363 "zecyrillic", 38364 0x0437, 38365 "zedescendercyrillic", 38366 0x0499, 38367 "zedieresiscyrillic", 38368 0x04df, 38369 "zehiragana", 38370 0x305c, 38371 "zekatakana", 38372 0x30bc, 38373 "zero", 38374 0x0030, 38375 "zeroarabic", 38376 0x0660, 38377 "zerobengali", 38378 0x09e6, 38379 "zerodeva", 38380 0x0966, 38381 "zerogujarati", 38382 0x0ae6, 38383 "zerogurmukhi", 38384 0x0a66, 38385 "zerohackarabic", 38386 0x0660, 38387 "zeroinferior", 38388 0x2080, 38389 "zeromonospace", 38390 0xff10, 38391 "zerooldstyle", 38392 0xf730, 38393 "zeropersian", 38394 0x06f0, 38395 "zerosuperior", 38396 0x2070, 38397 "zerothai", 38398 0x0e50, 38399 "zerowidthjoiner", 38400 0xfeff, 38401 "zerowidthnonjoiner", 38402 0x200c, 38403 "zerowidthspace", 38404 0x200b, 38405 "zeta", 38406 0x03b6, 38407 "zhbopomofo", 38408 0x3113, 38409 "zhearmenian", 38410 0x056a, 38411 "zhebrevecyrillic", 38412 0x04c2, 38413 "zhecyrillic", 38414 0x0436, 38415 "zhedescendercyrillic", 38416 0x0497, 38417 "zhedieresiscyrillic", 38418 0x04dd, 38419 "zihiragana", 38420 0x3058, 38421 "zikatakana", 38422 0x30b8, 38423 "zinorhebrew", 38424 0x05ae, 38425 "zlinebelow", 38426 0x1e95, 38427 "zmonospace", 38428 0xff5a, 38429 "zohiragana", 38430 0x305e, 38431 "zokatakana", 38432 0x30be, 38433 "zparen", 38434 0x24b5, 38435 "zretroflexhook", 38436 0x0290, 38437 "zstroke", 38438 0x01b6, 38439 "zuhiragana", 38440 0x305a, 38441 "zukatakana", 38442 0x30ba, 38443 ".notdef", 38444 0x0000, 38445 "angbracketleftbig", 38446 0x2329, 38447 "angbracketleftBig", 38448 0x2329, 38449 "angbracketleftbigg", 38450 0x2329, 38451 "angbracketleftBigg", 38452 0x2329, 38453 "angbracketrightBig", 38454 0x232a, 38455 "angbracketrightbig", 38456 0x232a, 38457 "angbracketrightBigg", 38458 0x232a, 38459 "angbracketrightbigg", 38460 0x232a, 38461 "arrowhookleft", 38462 0x21aa, 38463 "arrowhookright", 38464 0x21a9, 38465 "arrowlefttophalf", 38466 0x21bc, 38467 "arrowleftbothalf", 38468 0x21bd, 38469 "arrownortheast", 38470 0x2197, 38471 "arrownorthwest", 38472 0x2196, 38473 "arrowrighttophalf", 38474 0x21c0, 38475 "arrowrightbothalf", 38476 0x21c1, 38477 "arrowsoutheast", 38478 0x2198, 38479 "arrowsouthwest", 38480 0x2199, 38481 "backslashbig", 38482 0x2216, 38483 "backslashBig", 38484 0x2216, 38485 "backslashBigg", 38486 0x2216, 38487 "backslashbigg", 38488 0x2216, 38489 "bardbl", 38490 0x2016, 38491 "bracehtipdownleft", 38492 0xfe37, 38493 "bracehtipdownright", 38494 0xfe37, 38495 "bracehtipupleft", 38496 0xfe38, 38497 "bracehtipupright", 38498 0xfe38, 38499 "braceleftBig", 38500 0x007b, 38501 "braceleftbig", 38502 0x007b, 38503 "braceleftbigg", 38504 0x007b, 38505 "braceleftBigg", 38506 0x007b, 38507 "bracerightBig", 38508 0x007d, 38509 "bracerightbig", 38510 0x007d, 38511 "bracerightbigg", 38512 0x007d, 38513 "bracerightBigg", 38514 0x007d, 38515 "bracketleftbig", 38516 0x005b, 38517 "bracketleftBig", 38518 0x005b, 38519 "bracketleftbigg", 38520 0x005b, 38521 "bracketleftBigg", 38522 0x005b, 38523 "bracketrightBig", 38524 0x005d, 38525 "bracketrightbig", 38526 0x005d, 38527 "bracketrightbigg", 38528 0x005d, 38529 "bracketrightBigg", 38530 0x005d, 38531 "ceilingleftbig", 38532 0x2308, 38533 "ceilingleftBig", 38534 0x2308, 38535 "ceilingleftBigg", 38536 0x2308, 38537 "ceilingleftbigg", 38538 0x2308, 38539 "ceilingrightbig", 38540 0x2309, 38541 "ceilingrightBig", 38542 0x2309, 38543 "ceilingrightbigg", 38544 0x2309, 38545 "ceilingrightBigg", 38546 0x2309, 38547 "circledotdisplay", 38548 0x2299, 38549 "circledottext", 38550 0x2299, 38551 "circlemultiplydisplay", 38552 0x2297, 38553 "circlemultiplytext", 38554 0x2297, 38555 "circleplusdisplay", 38556 0x2295, 38557 "circleplustext", 38558 0x2295, 38559 "contintegraldisplay", 38560 0x222e, 38561 "contintegraltext", 38562 0x222e, 38563 "coproductdisplay", 38564 0x2210, 38565 "coproducttext", 38566 0x2210, 38567 "floorleftBig", 38568 0x230a, 38569 "floorleftbig", 38570 0x230a, 38571 "floorleftbigg", 38572 0x230a, 38573 "floorleftBigg", 38574 0x230a, 38575 "floorrightbig", 38576 0x230b, 38577 "floorrightBig", 38578 0x230b, 38579 "floorrightBigg", 38580 0x230b, 38581 "floorrightbigg", 38582 0x230b, 38583 "hatwide", 38584 0x0302, 38585 "hatwider", 38586 0x0302, 38587 "hatwidest", 38588 0x0302, 38589 "intercal", 38590 0x1d40, 38591 "integraldisplay", 38592 0x222b, 38593 "integraltext", 38594 0x222b, 38595 "intersectiondisplay", 38596 0x22c2, 38597 "intersectiontext", 38598 0x22c2, 38599 "logicalanddisplay", 38600 0x2227, 38601 "logicalandtext", 38602 0x2227, 38603 "logicalordisplay", 38604 0x2228, 38605 "logicalortext", 38606 0x2228, 38607 "parenleftBig", 38608 0x0028, 38609 "parenleftbig", 38610 0x0028, 38611 "parenleftBigg", 38612 0x0028, 38613 "parenleftbigg", 38614 0x0028, 38615 "parenrightBig", 38616 0x0029, 38617 "parenrightbig", 38618 0x0029, 38619 "parenrightBigg", 38620 0x0029, 38621 "parenrightbigg", 38622 0x0029, 38623 "prime", 38624 0x2032, 38625 "productdisplay", 38626 0x220f, 38627 "producttext", 38628 0x220f, 38629 "radicalbig", 38630 0x221a, 38631 "radicalBig", 38632 0x221a, 38633 "radicalBigg", 38634 0x221a, 38635 "radicalbigg", 38636 0x221a, 38637 "radicalbt", 38638 0x221a, 38639 "radicaltp", 38640 0x221a, 38641 "radicalvertex", 38642 0x221a, 38643 "slashbig", 38644 0x002f, 38645 "slashBig", 38646 0x002f, 38647 "slashBigg", 38648 0x002f, 38649 "slashbigg", 38650 0x002f, 38651 "summationdisplay", 38652 0x2211, 38653 "summationtext", 38654 0x2211, 38655 "tildewide", 38656 0x02dc, 38657 "tildewider", 38658 0x02dc, 38659 "tildewidest", 38660 0x02dc, 38661 "uniondisplay", 38662 0x22c3, 38663 "unionmultidisplay", 38664 0x228e, 38665 "unionmultitext", 38666 0x228e, 38667 "unionsqdisplay", 38668 0x2294, 38669 "unionsqtext", 38670 0x2294, 38671 "uniontext", 38672 0x22c3, 38673 "vextenddouble", 38674 0x2225, 38675 "vextendsingle", 38676 0x2223 38677 ]; 38678}); 38679const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () { 38680 return [ 38681 "space", 38682 0x0020, 38683 "a1", 38684 0x2701, 38685 "a2", 38686 0x2702, 38687 "a202", 38688 0x2703, 38689 "a3", 38690 0x2704, 38691 "a4", 38692 0x260e, 38693 "a5", 38694 0x2706, 38695 "a119", 38696 0x2707, 38697 "a118", 38698 0x2708, 38699 "a117", 38700 0x2709, 38701 "a11", 38702 0x261b, 38703 "a12", 38704 0x261e, 38705 "a13", 38706 0x270c, 38707 "a14", 38708 0x270d, 38709 "a15", 38710 0x270e, 38711 "a16", 38712 0x270f, 38713 "a105", 38714 0x2710, 38715 "a17", 38716 0x2711, 38717 "a18", 38718 0x2712, 38719 "a19", 38720 0x2713, 38721 "a20", 38722 0x2714, 38723 "a21", 38724 0x2715, 38725 "a22", 38726 0x2716, 38727 "a23", 38728 0x2717, 38729 "a24", 38730 0x2718, 38731 "a25", 38732 0x2719, 38733 "a26", 38734 0x271a, 38735 "a27", 38736 0x271b, 38737 "a28", 38738 0x271c, 38739 "a6", 38740 0x271d, 38741 "a7", 38742 0x271e, 38743 "a8", 38744 0x271f, 38745 "a9", 38746 0x2720, 38747 "a10", 38748 0x2721, 38749 "a29", 38750 0x2722, 38751 "a30", 38752 0x2723, 38753 "a31", 38754 0x2724, 38755 "a32", 38756 0x2725, 38757 "a33", 38758 0x2726, 38759 "a34", 38760 0x2727, 38761 "a35", 38762 0x2605, 38763 "a36", 38764 0x2729, 38765 "a37", 38766 0x272a, 38767 "a38", 38768 0x272b, 38769 "a39", 38770 0x272c, 38771 "a40", 38772 0x272d, 38773 "a41", 38774 0x272e, 38775 "a42", 38776 0x272f, 38777 "a43", 38778 0x2730, 38779 "a44", 38780 0x2731, 38781 "a45", 38782 0x2732, 38783 "a46", 38784 0x2733, 38785 "a47", 38786 0x2734, 38787 "a48", 38788 0x2735, 38789 "a49", 38790 0x2736, 38791 "a50", 38792 0x2737, 38793 "a51", 38794 0x2738, 38795 "a52", 38796 0x2739, 38797 "a53", 38798 0x273a, 38799 "a54", 38800 0x273b, 38801 "a55", 38802 0x273c, 38803 "a56", 38804 0x273d, 38805 "a57", 38806 0x273e, 38807 "a58", 38808 0x273f, 38809 "a59", 38810 0x2740, 38811 "a60", 38812 0x2741, 38813 "a61", 38814 0x2742, 38815 "a62", 38816 0x2743, 38817 "a63", 38818 0x2744, 38819 "a64", 38820 0x2745, 38821 "a65", 38822 0x2746, 38823 "a66", 38824 0x2747, 38825 "a67", 38826 0x2748, 38827 "a68", 38828 0x2749, 38829 "a69", 38830 0x274a, 38831 "a70", 38832 0x274b, 38833 "a71", 38834 0x25cf, 38835 "a72", 38836 0x274d, 38837 "a73", 38838 0x25a0, 38839 "a74", 38840 0x274f, 38841 "a203", 38842 0x2750, 38843 "a75", 38844 0x2751, 38845 "a204", 38846 0x2752, 38847 "a76", 38848 0x25b2, 38849 "a77", 38850 0x25bc, 38851 "a78", 38852 0x25c6, 38853 "a79", 38854 0x2756, 38855 "a81", 38856 0x25d7, 38857 "a82", 38858 0x2758, 38859 "a83", 38860 0x2759, 38861 "a84", 38862 0x275a, 38863 "a97", 38864 0x275b, 38865 "a98", 38866 0x275c, 38867 "a99", 38868 0x275d, 38869 "a100", 38870 0x275e, 38871 "a101", 38872 0x2761, 38873 "a102", 38874 0x2762, 38875 "a103", 38876 0x2763, 38877 "a104", 38878 0x2764, 38879 "a106", 38880 0x2765, 38881 "a107", 38882 0x2766, 38883 "a108", 38884 0x2767, 38885 "a112", 38886 0x2663, 38887 "a111", 38888 0x2666, 38889 "a110", 38890 0x2665, 38891 "a109", 38892 0x2660, 38893 "a120", 38894 0x2460, 38895 "a121", 38896 0x2461, 38897 "a122", 38898 0x2462, 38899 "a123", 38900 0x2463, 38901 "a124", 38902 0x2464, 38903 "a125", 38904 0x2465, 38905 "a126", 38906 0x2466, 38907 "a127", 38908 0x2467, 38909 "a128", 38910 0x2468, 38911 "a129", 38912 0x2469, 38913 "a130", 38914 0x2776, 38915 "a131", 38916 0x2777, 38917 "a132", 38918 0x2778, 38919 "a133", 38920 0x2779, 38921 "a134", 38922 0x277a, 38923 "a135", 38924 0x277b, 38925 "a136", 38926 0x277c, 38927 "a137", 38928 0x277d, 38929 "a138", 38930 0x277e, 38931 "a139", 38932 0x277f, 38933 "a140", 38934 0x2780, 38935 "a141", 38936 0x2781, 38937 "a142", 38938 0x2782, 38939 "a143", 38940 0x2783, 38941 "a144", 38942 0x2784, 38943 "a145", 38944 0x2785, 38945 "a146", 38946 0x2786, 38947 "a147", 38948 0x2787, 38949 "a148", 38950 0x2788, 38951 "a149", 38952 0x2789, 38953 "a150", 38954 0x278a, 38955 "a151", 38956 0x278b, 38957 "a152", 38958 0x278c, 38959 "a153", 38960 0x278d, 38961 "a154", 38962 0x278e, 38963 "a155", 38964 0x278f, 38965 "a156", 38966 0x2790, 38967 "a157", 38968 0x2791, 38969 "a158", 38970 0x2792, 38971 "a159", 38972 0x2793, 38973 "a160", 38974 0x2794, 38975 "a161", 38976 0x2192, 38977 "a163", 38978 0x2194, 38979 "a164", 38980 0x2195, 38981 "a196", 38982 0x2798, 38983 "a165", 38984 0x2799, 38985 "a192", 38986 0x279a, 38987 "a166", 38988 0x279b, 38989 "a167", 38990 0x279c, 38991 "a168", 38992 0x279d, 38993 "a169", 38994 0x279e, 38995 "a170", 38996 0x279f, 38997 "a171", 38998 0x27a0, 38999 "a172", 39000 0x27a1, 39001 "a173", 39002 0x27a2, 39003 "a162", 39004 0x27a3, 39005 "a174", 39006 0x27a4, 39007 "a175", 39008 0x27a5, 39009 "a176", 39010 0x27a6, 39011 "a177", 39012 0x27a7, 39013 "a178", 39014 0x27a8, 39015 "a179", 39016 0x27a9, 39017 "a193", 39018 0x27aa, 39019 "a180", 39020 0x27ab, 39021 "a199", 39022 0x27ac, 39023 "a181", 39024 0x27ad, 39025 "a200", 39026 0x27ae, 39027 "a182", 39028 0x27af, 39029 "a201", 39030 0x27b1, 39031 "a183", 39032 0x27b2, 39033 "a184", 39034 0x27b3, 39035 "a197", 39036 0x27b4, 39037 "a185", 39038 0x27b5, 39039 "a194", 39040 0x27b6, 39041 "a198", 39042 0x27b7, 39043 "a186", 39044 0x27b8, 39045 "a195", 39046 0x27b9, 39047 "a187", 39048 0x27ba, 39049 "a188", 39050 0x27bb, 39051 "a189", 39052 0x27bc, 39053 "a190", 39054 0x27bd, 39055 "a191", 39056 0x27be, 39057 "a89", 39058 0x2768, 39059 "a90", 39060 0x2769, 39061 "a93", 39062 0x276a, 39063 "a94", 39064 0x276b, 39065 "a91", 39066 0x276c, 39067 "a92", 39068 0x276d, 39069 "a205", 39070 0x276e, 39071 "a85", 39072 0x276f, 39073 "a206", 39074 0x2770, 39075 "a86", 39076 0x2771, 39077 "a87", 39078 0x2772, 39079 "a88", 39080 0x2773, 39081 "a95", 39082 0x2774, 39083 "a96", 39084 0x2775, 39085 ".notdef", 39086 0x0000 39087 ]; 39088}); 39089 39090 39091/***/ }), 39092/*
3909240 */ 39093/***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => { 39094 39095__w_pdfjs_require__.r(__webpack_exports__); 39096/* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, { 39097/* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches), 39098/* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory), 39099/* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes), 39100/* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph), 39101/* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor), 39102/* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues), 39103/* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl) 39104/* harmony export */ }); 39105/* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(6
vendor: 47,434 bytes, lines 39105-42475
39105); 39106 39107const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) { 39108 t[63721] = 0x00a9; 39109 t[63193] = 0x00a9; 39110 t[63720] = 0x00ae; 39111 t[63194] = 0x00ae; 39112 t[63722] = 0x2122; 39113 t[63195] = 0x2122; 39114 t[63729] = 0x23a7; 39115 t[63730] = 0x23a8; 39116 t[63731] = 0x23a9; 39117 t[63740] = 0x23ab; 39118 t[63741] = 0x23ac; 39119 t[63742] = 0x23ad; 39120 t[63726] = 0x23a1; 39121 t[63727] = 0x23a2; 39122 t[63728] = 0x23a3; 39123 t[63737] = 0x23a4; 39124 t[63738] = 0x23a5; 39125 t[63739] = 0x23a6; 39126 t[63723] = 0x239b; 39127 t[63724] = 0x239c; 39128 t[63725] = 0x239d; 39129 t[63734] = 0x239e; 39130 t[63735] = 0x239f; 39131 t[63736] = 0x23a0; 39132}); 39133function mapSpecialUnicodeValues(code) { 39134 if (code >= 0xfff0 && code <= 0xffff) { 39135 return 0; 39136 } else if (code >= 0xf600 && code <= 0xf8ff) { 39137 return getSpecialPUASymbols()[code] || code; 39138 } else if (code === 0x00ad) { 39139 return 0x002d; 39140 } 39141 return code; 39142} 39143function getUnicodeForGlyph(name, glyphsUnicodeMap) { 39144 let unicode = glyphsUnicodeMap[name]; 39145 if (unicode !== undefined) { 39146 return unicode; 39147 } 39148 if (!name) { 39149 return -1; 39150 } 39151 if (name[0] === "u") { 39152 const nameLen = name.length; 39153 let hexStr; 39154 if (nameLen === 7 && name[1] === "n" && name[2] === "i") { 39155 hexStr = name.substring(3); 39156 } else if (nameLen >= 5 && nameLen <= 7) { 39157 hexStr = name.substring(1); 39158 } else { 39159 return -1; 39160 } 39161 if (hexStr === hexStr.toUpperCase()) { 39162 unicode = parseInt(hexStr, 16); 39163 if (unicode >= 0) { 39164 return unicode; 39165 } 39166 } 39167 } 39168 return -1; 39169} 39170const UnicodeRanges = [ 39171 { 39172 begin: 0x0000, 39173 end: 0x007f 39174 }, 39175 { 39176 begin: 0x0080, 39177 end: 0x00ff 39178 }, 39179 { 39180 begin: 0x0100, 39181 end: 0x017f 39182 }, 39183 { 39184 begin: 0x0180, 39185 end: 0x024f 39186 }, 39187 { 39188 begin: 0x0250, 39189 end: 0x02af 39190 }, 39191 { 39192 begin: 0x02b0, 39193 end: 0x02ff 39194 }, 39195 { 39196 begin: 0x0300, 39197 end: 0x036f 39198 }, 39199 { 39200 begin: 0x0370, 39201 end: 0x03ff 39202 }, 39203 { 39204 begin: 0x2c80, 39205 end: 0x2cff 39206 }, 39207 { 39208 begin: 0x0400, 39209 end: 0x04ff 39210 }, 39211 { 39212 begin: 0x0530, 39213 end: 0x058f 39214 }, 39215 { 39216 begin: 0x0590, 39217 end: 0x05ff 39218 }, 39219 { 39220 begin: 0xa500, 39221 end: 0xa63f 39222 }, 39223 { 39224 begin: 0x0600, 39225 end: 0x06ff 39226 }, 39227 { 39228 begin: 0x07c0, 39229 end: 0x07ff 39230 }, 39231 { 39232 begin: 0x0900, 39233 end: 0x097f 39234 }, 39235 { 39236 begin: 0x0980, 39237 end: 0x09ff 39238 }, 39239 { 39240 begin: 0x0a00, 39241 end: 0x0a7f 39242 }, 39243 { 39244 begin: 0x0a80, 39245 end: 0x0aff 39246 }, 39247 { 39248 begin: 0x0b00, 39249 end: 0x0b7f 39250 }, 39251 { 39252 begin: 0x0b80, 39253 end: 0x0bff 39254 }, 39255 { 39256 begin: 0x0c00, 39257 end: 0x0c7f 39258 }, 39259 { 39260 begin: 0x0c80, 39261 end: 0x0cff 39262 }, 39263 { 39264 begin: 0x0d00, 39265 end: 0x0d7f 39266 }, 39267 { 39268 begin: 0x0e00, 39269 end: 0x0e7f 39270 }, 39271 { 39272 begin: 0x0e80, 39273 end: 0x0eff 39274 }, 39275 { 39276 begin: 0x10a0, 39277 end: 0x10ff 39278 }, 39279 { 39280 begin: 0x1b00, 39281 end: 0x1b7f 39282 }, 39283 { 39284 begin: 0x1100, 39285 end: 0x11ff 39286 }, 39287 { 39288 begin: 0x1e00, 39289 end: 0x1eff 39290 }, 39291 { 39292 begin: 0x1f00, 39293 end: 0x1fff 39294 }, 39295 { 39296 begin: 0x2000, 39297 end: 0x206f 39298 }, 39299 { 39300 begin: 0x2070, 39301 end: 0x209f 39302 }, 39303 { 39304 begin: 0x20a0, 39305 end: 0x20cf 39306 }, 39307 { 39308 begin: 0x20d0, 39309 end: 0x20ff 39310 }, 39311 { 39312 begin: 0x2100, 39313 end: 0x214f 39314 }, 39315 { 39316 begin: 0x2150, 39317 end: 0x218f 39318 }, 39319 { 39320 begin: 0x2190, 39321 end: 0x21ff 39322 }, 39323 { 39324 begin: 0x2200, 39325 end: 0x22ff 39326 }, 39327 { 39328 begin: 0x2300, 39329 end: 0x23ff 39330 }, 39331 { 39332 begin: 0x2400, 39333 end: 0x243f 39334 }, 39335 { 39336 begin: 0x2440, 39337 end: 0x245f 39338 }, 39339 { 39340 begin: 0x2460, 39341 end: 0x24ff 39342 }, 39343 { 39344 begin: 0x2500, 39345 end: 0x257f 39346 }, 39347 { 39348 begin: 0x2580, 39349 end: 0x259f 39350 }, 39351 { 39352 begin: 0x25a0, 39353 end: 0x25ff 39354 }, 39355 { 39356 begin: 0x2600, 39357 end: 0x26ff 39358 }, 39359 { 39360 begin: 0x2700, 39361 end: 0x27bf 39362 }, 39363 { 39364 begin: 0x3000, 39365 end: 0x303f 39366 }, 39367 { 39368 begin: 0x3040, 39369 end: 0x309f 39370 }, 39371 { 39372 begin: 0x30a0, 39373 end: 0x30ff 39374 }, 39375 { 39376 begin: 0x3100, 39377 end: 0x312f 39378 }, 39379 { 39380 begin: 0x3130, 39381 end: 0x318f 39382 }, 39383 { 39384 begin: 0xa840, 39385 end: 0xa87f 39386 }, 39387 { 39388 begin: 0x3200, 39389 end: 0x32ff 39390 }, 39391 { 39392 begin: 0x3300, 39393 end: 0x33ff 39394 }, 39395 { 39396 begin: 0xac00, 39397 end: 0xd7af 39398 }, 39399 { 39400 begin: 0xd800, 39401 end: 0xdfff 39402 }, 39403 { 39404 begin: 0x10900, 39405 end: 0x1091f 39406 }, 39407 { 39408 begin: 0x4e00, 39409 end: 0x9fff 39410 }, 39411 { 39412 begin: 0xe000, 39413 end: 0xf8ff 39414 }, 39415 { 39416 begin: 0x31c0, 39417 end: 0x31ef 39418 }, 39419 { 39420 begin: 0xfb00, 39421 end: 0xfb4f 39422 }, 39423 { 39424 begin: 0xfb50, 39425 end: 0xfdff 39426 }, 39427 { 39428 begin: 0xfe20, 39429 end: 0xfe2f 39430 }, 39431 { 39432 begin: 0xfe10, 39433 end: 0xfe1f 39434 }, 39435 { 39436 begin: 0xfe50, 39437 end: 0xfe6f 39438 }, 39439 { 39440 begin: 0xfe70, 39441 end: 0xfeff 39442 }, 39443 { 39444 begin: 0xff00, 39445 end: 0xffef 39446 }, 39447 { 39448 begin: 0xfff0, 39449 end: 0xffff 39450 }, 39451 { 39452 begin: 0x0f00, 39453 end: 0x0fff 39454 }, 39455 { 39456 begin: 0x0700, 39457 end: 0x074f 39458 }, 39459 { 39460 begin: 0x0780, 39461 end: 0x07bf 39462 }, 39463 { 39464 begin: 0x0d80, 39465 end: 0x0dff 39466 }, 39467 { 39468 begin: 0x1000, 39469 end: 0x109f 39470 }, 39471 { 39472 begin: 0x1200, 39473 end: 0x137f 39474 }, 39475 { 39476 begin: 0x13a0, 39477 end: 0x13ff 39478 }, 39479 { 39480 begin: 0x1400, 39481 end: 0x167f 39482 }, 39483 { 39484 begin: 0x1680, 39485 end: 0x169f 39486 }, 39487 { 39488 begin: 0x16a0, 39489 end: 0x16ff 39490 }, 39491 { 39492 begin: 0x1780, 39493 end: 0x17ff 39494 }, 39495 { 39496 begin: 0x1800, 39497 end: 0x18af 39498 }, 39499 { 39500 begin: 0x2800, 39501 end: 0x28ff 39502 }, 39503 { 39504 begin: 0xa000, 39505 end: 0xa48f 39506 }, 39507 { 39508 begin: 0x1700, 39509 end: 0x171f 39510 }, 39511 { 39512 begin: 0x10300, 39513 end: 0x1032f 39514 }, 39515 { 39516 begin: 0x10330, 39517 end: 0x1034f 39518 }, 39519 { 39520 begin: 0x10400, 39521 end: 0x1044f 39522 }, 39523 { 39524 begin: 0x1d000, 39525 end: 0x1d0ff 39526 }, 39527 { 39528 begin: 0x1d400, 39529 end: 0x1d7ff 39530 }, 39531 { 39532 begin: 0xff000, 39533 end: 0xffffd 39534 }, 39535 { 39536 begin: 0xfe00, 39537 end: 0xfe0f 39538 }, 39539 { 39540 begin: 0xe0000, 39541 end: 0xe007f 39542 }, 39543 { 39544 begin: 0x1900, 39545 end: 0x194f 39546 }, 39547 { 39548 begin: 0x1950, 39549 end: 0x197f 39550 }, 39551 { 39552 begin: 0x1980, 39553 end: 0x19df 39554 }, 39555 { 39556 begin: 0x1a00, 39557 end: 0x1a1f 39558 }, 39559 { 39560 begin: 0x2c00, 39561 end: 0x2c5f 39562 }, 39563 { 39564 begin: 0x2d30, 39565 end: 0x2d7f 39566 }, 39567 { 39568 begin: 0x4dc0, 39569 end: 0x4dff 39570 }, 39571 { 39572 begin: 0xa800, 39573 end: 0xa82f 39574 }, 39575 { 39576 begin: 0x10000, 39577 end: 0x1007f 39578 }, 39579 { 39580 begin: 0x10140, 39581 end: 0x1018f 39582 }, 39583 { 39584 begin: 0x10380, 39585 end: 0x1039f 39586 }, 39587 { 39588 begin: 0x103a0, 39589 end: 0x103df 39590 }, 39591 { 39592 begin: 0x10450, 39593 end: 0x1047f 39594 }, 39595 { 39596 begin: 0x10480, 39597 end: 0x104af 39598 }, 39599 { 39600 begin: 0x10800, 39601 end: 0x1083f 39602 }, 39603 { 39604 begin: 0x10a00, 39605 end: 0x10a5f 39606 }, 39607 { 39608 begin: 0x1d300, 39609 end: 0x1d35f 39610 }, 39611 { 39612 begin: 0x12000, 39613 end: 0x123ff 39614 }, 39615 { 39616 begin: 0x1d360, 39617 end: 0x1d37f 39618 }, 39619 { 39620 begin: 0x1b80, 39621 end: 0x1bbf 39622 }, 39623 { 39624 begin: 0x1c00, 39625 end: 0x1c4f 39626 }, 39627 { 39628 begin: 0x1c50, 39629 end: 0x1c7f 39630 }, 39631 { 39632 begin: 0xa880, 39633 end: 0xa8df 39634 }, 39635 { 39636 begin: 0xa900, 39637 end: 0xa92f 39638 }, 39639 { 39640 begin: 0xa930, 39641 end: 0xa95f 39642 }, 39643 { 39644 begin: 0xaa00, 39645 end: 0xaa5f 39646 }, 39647 { 39648 begin: 0x10190, 39649 end: 0x101cf 39650 }, 39651 { 39652 begin: 0x101d0, 39653 end: 0x101ff 39654 }, 39655 { 39656 begin: 0x102a0, 39657 end: 0x102df 39658 }, 39659 { 39660 begin: 0x1f030, 39661 end: 0x1f09f 39662 } 39663]; 39664function getUnicodeRangeFor(value) { 39665 for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) { 39666 const range = UnicodeRanges[i]; 39667 if (value >= range.begin && value < range.end) { 39668 return i; 39669 } 39670 } 39671 return -1; 39672} 39673function isRTLRangeFor(value) { 39674 let range = UnicodeRanges[13]; 39675 if (value >= range.begin && value < range.end) { 39676 return true; 39677 } 39678 range = UnicodeRanges[11]; 39679 if (value >= range.begin && value < range.end) { 39680 return true; 39681 } 39682 return false; 39683} 39684const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () { 39685 return [ 39686 "\u00A8", 39687 "\u0020\u0308", 39688 "\u00AF", 39689 "\u0020\u0304", 39690 "\u00B4", 39691 "\u0020\u0301", 39692 "\u00B5", 39693 "\u03BC", 39694 "\u00B8", 39695 "\u0020\u0327", 39696 "\u0132", 39697 "\u0049\u004A", 39698 "\u0133", 39699 "\u0069\u006A", 39700 "\u013F", 39701 "\u004C\u00B7", 39702 "\u0140", 39703 "\u006C\u00B7", 39704 "\u0149", 39705 "\u02BC\u006E", 39706 "\u017F", 39707 "\u0073", 39708 "\u01C4", 39709 "\u0044\u017D", 39710 "\u01C5", 39711 "\u0044\u017E", 39712 "\u01C6", 39713 "\u0064\u017E", 39714 "\u01C7", 39715 "\u004C\u004A", 39716 "\u01C8", 39717 "\u004C\u006A", 39718 "\u01C9", 39719 "\u006C\u006A", 39720 "\u01CA", 39721 "\u004E\u004A", 39722 "\u01CB", 39723 "\u004E\u006A", 39724 "\u01CC", 39725 "\u006E\u006A", 39726 "\u01F1", 39727 "\u0044\u005A", 39728 "\u01F2", 39729 "\u0044\u007A", 39730 "\u01F3", 39731 "\u0064\u007A", 39732 "\u02D8", 39733 "\u0020\u0306", 39734 "\u02D9", 39735 "\u0020\u0307", 39736 "\u02DA", 39737 "\u0020\u030A", 39738 "\u02DB", 39739 "\u0020\u0328", 39740 "\u02DC", 39741 "\u0020\u0303", 39742 "\u02DD", 39743 "\u0020\u030B", 39744 "\u037A", 39745 "\u0020\u0345", 39746 "\u0384", 39747 "\u0020\u0301", 39748 "\u03D0", 39749 "\u03B2", 39750 "\u03D1", 39751 "\u03B8", 39752 "\u03D2", 39753 "\u03A5", 39754 "\u03D5", 39755 "\u03C6", 39756 "\u03D6", 39757 "\u03C0", 39758 "\u03F0", 39759 "\u03BA", 39760 "\u03F1", 39761 "\u03C1", 39762 "\u03F2", 39763 "\u03C2", 39764 "\u03F4", 39765 "\u0398", 39766 "\u03F5", 39767 "\u03B5", 39768 "\u03F9", 39769 "\u03A3", 39770 "\u0587", 39771 "\u0565\u0582", 39772 "\u0675", 39773 "\u0627\u0674", 39774 "\u0676", 39775 "\u0648\u0674", 39776 "\u0677", 39777 "\u06C7\u0674", 39778 "\u0678", 39779 "\u064A\u0674", 39780 "\u0E33", 39781 "\u0E4D\u0E32", 39782 "\u0EB3", 39783 "\u0ECD\u0EB2", 39784 "\u0EDC", 39785 "\u0EAB\u0E99", 39786 "\u0EDD", 39787 "\u0EAB\u0EA1", 39788 "\u0F77", 39789 "\u0FB2\u0F81", 39790 "\u0F79", 39791 "\u0FB3\u0F81", 39792 "\u1E9A", 39793 "\u0061\u02BE", 39794 "\u1FBD", 39795 "\u0020\u0313", 39796 "\u1FBF", 39797 "\u0020\u0313", 39798 "\u1FC0", 39799 "\u0020\u0342", 39800 "\u1FFE", 39801 "\u0020\u0314", 39802 "\u2002", 39803 "\u0020", 39804 "\u2003", 39805 "\u0020", 39806 "\u2004", 39807 "\u0020", 39808 "\u2005", 39809 "\u0020", 39810 "\u2006", 39811 "\u0020", 39812 "\u2008", 39813 "\u0020", 39814 "\u2009", 39815 "\u0020", 39816 "\u200A", 39817 "\u0020", 39818 "\u2017", 39819 "\u0020\u0333", 39820 "\u2024", 39821 "\u002E", 39822 "\u2025", 39823 "\u002E\u002E", 39824 "\u2026", 39825 "\u002E\u002E\u002E", 39826 "\u2033", 39827 "\u2032\u2032", 39828 "\u2034", 39829 "\u2032\u2032\u2032", 39830 "\u2036", 39831 "\u2035\u2035", 39832 "\u2037", 39833 "\u2035\u2035\u2035", 39834 "\u203C", 39835 "\u0021\u0021", 39836 "\u203E", 39837 "\u0020\u0305", 39838 "\u2047", 39839 "\u003F\u003F", 39840 "\u2048", 39841 "\u003F\u0021", 39842 "\u2049", 39843 "\u0021\u003F", 39844 "\u2057", 39845 "\u2032\u2032\u2032\u2032", 39846 "\u205F", 39847 "\u0020", 39848 "\u20A8", 39849 "\u0052\u0073", 39850 "\u2100", 39851 "\u0061\u002F\u0063", 39852 "\u2101", 39853 "\u0061\u002F\u0073", 39854 "\u2103", 39855 "\u00B0\u0043", 39856 "\u2105", 39857 "\u0063\u002F\u006F", 39858 "\u2106", 39859 "\u0063\u002F\u0075", 39860 "\u2107", 39861 "\u0190", 39862 "\u2109", 39863 "\u00B0\u0046", 39864 "\u2116", 39865 "\u004E\u006F", 39866 "\u2121", 39867 "\u0054\u0045\u004C", 39868 "\u2135", 39869 "\u05D0", 39870 "\u2136", 39871 "\u05D1", 39872 "\u2137", 39873 "\u05D2", 39874 "\u2138", 39875 "\u05D3", 39876 "\u213B", 39877 "\u0046\u0041\u0058", 39878 "\u2160", 39879 "\u0049", 39880 "\u2161", 39881 "\u0049\u0049", 39882 "\u2162", 39883 "\u0049\u0049\u0049", 39884 "\u2163", 39885 "\u0049\u0056", 39886 "\u2164", 39887 "\u0056", 39888 "\u2165", 39889 "\u0056\u0049", 39890 "\u2166", 39891 "\u0056\u0049\u0049", 39892 "\u2167", 39893 "\u0056\u0049\u0049\u0049", 39894 "\u2168", 39895 "\u0049\u0058", 39896 "\u2169", 39897 "\u0058", 39898 "\u216A", 39899 "\u0058\u0049", 39900 "\u216B", 39901 "\u0058\u0049\u0049", 39902 "\u216C", 39903 "\u004C", 39904 "\u216D", 39905 "\u0043", 39906 "\u216E", 39907 "\u0044", 39908 "\u216F", 39909 "\u004D", 39910 "\u2170", 39911 "\u0069", 39912 "\u2171", 39913 "\u0069\u0069", 39914 "\u2172", 39915 "\u0069\u0069\u0069", 39916 "\u2173", 39917 "\u0069\u0076", 39918 "\u2174", 39919 "\u0076", 39920 "\u2175", 39921 "\u0076\u0069", 39922 "\u2176", 39923 "\u0076\u0069\u0069", 39924 "\u2177", 39925 "\u0076\u0069\u0069\u0069", 39926 "\u2178", 39927 "\u0069\u0078", 39928 "\u2179", 39929 "\u0078", 39930 "\u217A", 39931 "\u0078\u0069", 39932 "\u217B", 39933 "\u0078\u0069\u0069", 39934 "\u217C", 39935 "\u006C", 39936 "\u217D", 39937 "\u0063", 39938 "\u217E", 39939 "\u0064", 39940 "\u217F", 39941 "\u006D", 39942 "\u222C", 39943 "\u222B\u222B", 39944 "\u222D", 39945 "\u222B\u222B\u222B", 39946 "\u222F", 39947 "\u222E\u222E", 39948 "\u2230", 39949 "\u222E\u222E\u222E", 39950 "\u2474", 39951 "\u0028\u0031\u0029", 39952 "\u2475", 39953 "\u0028\u0032\u0029", 39954 "\u2476", 39955 "\u0028\u0033\u0029", 39956 "\u2477", 39957 "\u0028\u0034\u0029", 39958 "\u2478", 39959 "\u0028\u0035\u0029", 39960 "\u2479", 39961 "\u0028\u0036\u0029", 39962 "\u247A", 39963 "\u0028\u0037\u0029", 39964 "\u247B", 39965 "\u0028\u0038\u0029", 39966 "\u247C", 39967 "\u0028\u0039\u0029", 39968 "\u247D", 39969 "\u0028\u0031\u0030\u0029", 39970 "\u247E", 39971 "\u0028\u0031\u0031\u0029", 39972 "\u247F", 39973 "\u0028\u0031\u0032\u0029", 39974 "\u2480", 39975 "\u0028\u0031\u0033\u0029", 39976 "\u2481", 39977 "\u0028\u0031\u0034\u0029", 39978 "\u2482", 39979 "\u0028\u0031\u0035\u0029", 39980 "\u2483", 39981 "\u0028\u0031\u0036\u0029", 39982 "\u2484", 39983 "\u0028\u0031\u0037\u0029", 39984 "\u2485", 39985 "\u0028\u0031\u0038\u0029", 39986 "\u2486", 39987 "\u0028\u0031\u0039\u0029", 39988 "\u2487", 39989 "\u0028\u0032\u0030\u0029", 39990 "\u2488", 39991 "\u0031\u002E", 39992 "\u2489", 39993 "\u0032\u002E", 39994 "\u248A", 39995 "\u0033\u002E", 39996 "\u248B", 39997 "\u0034\u002E", 39998 "\u248C", 39999 "\u0035\u002E", 40000 "\u248D", 40001 "\u0036\u002E", 40002 "\u248E", 40003 "\u0037\u002E", 40004 "\u248F", 40005 "\u0038\u002E", 40006 "\u2490", 40007 "\u0039\u002E", 40008 "\u2491", 40009 "\u0031\u0030\u002E", 40010 "\u2492", 40011 "\u0031\u0031\u002E", 40012 "\u2493", 40013 "\u0031\u0032\u002E", 40014 "\u2494", 40015 "\u0031\u0033\u002E", 40016 "\u2495", 40017 "\u0031\u0034\u002E", 40018 "\u2496", 40019 "\u0031\u0035\u002E", 40020 "\u2497", 40021 "\u0031\u0036\u002E", 40022 "\u2498", 40023 "\u0031\u0037\u002E", 40024 "\u2499", 40025 "\u0031\u0038\u002E", 40026 "\u249A", 40027 "\u0031\u0039\u002E", 40028 "\u249B", 40029 "\u0032\u0030\u002E", 40030 "\u249C", 40031 "\u0028\u0061\u0029", 40032 "\u249D", 40033 "\u0028\u0062\u0029", 40034 "\u249E", 40035 "\u0028\u0063\u0029", 40036 "\u249F", 40037 "\u0028\u0064\u0029", 40038 "\u24A0", 40039 "\u0028\u0065\u0029", 40040 "\u24A1", 40041 "\u0028\u0066\u0029", 40042 "\u24A2", 40043 "\u0028\u0067\u0029", 40044 "\u24A3", 40045 "\u0028\u0068\u0029", 40046 "\u24A4", 40047 "\u0028\u0069\u0029", 40048 "\u24A5", 40049 "\u0028\u006A\u0029", 40050 "\u24A6", 40051 "\u0028\u006B\u0029", 40052 "\u24A7", 40053 "\u0028\u006C\u0029", 40054 "\u24A8", 40055 "\u0028\u006D\u0029", 40056 "\u24A9", 40057 "\u0028\u006E\u0029", 40058 "\u24AA", 40059 "\u0028\u006F\u0029", 40060 "\u24AB", 40061 "\u0028\u0070\u0029", 40062 "\u24AC", 40063 "\u0028\u0071\u0029", 40064 "\u24AD", 40065 "\u0028\u0072\u0029", 40066 "\u24AE", 40067 "\u0028\u0073\u0029", 40068 "\u24AF", 40069 "\u0028\u0074\u0029", 40070 "\u24B0", 40071 "\u0028\u0075\u0029", 40072 "\u24B1", 40073 "\u0028\u0076\u0029", 40074 "\u24B2", 40075 "\u0028\u0077\u0029", 40076 "\u24B3", 40077 "\u0028\u0078\u0029", 40078 "\u24B4", 40079 "\u0028\u0079\u0029", 40080 "\u24B5", 40081 "\u0028\u007A\u0029", 40082 "\u2A0C", 40083 "\u222B\u222B\u222B\u222B", 40084 "\u2A74", 40085 "\u003A\u003A\u003D", 40086 "\u2A75", 40087 "\u003D\u003D", 40088 "\u2A76", 40089 "\u003D\u003D\u003D", 40090 "\u2E9F", 40091 "\u6BCD", 40092 "\u2EF3", 40093 "\u9F9F", 40094 "\u2F00", 40095 "\u4E00", 40096 "\u2F01", 40097 "\u4E28", 40098 "\u2F02", 40099 "\u4E36", 40100 "\u2F03", 40101 "\u4E3F", 40102 "\u2F04", 40103 "\u4E59", 40104 "\u2F05", 40105 "\u4E85", 40106 "\u2F06", 40107 "\u4E8C", 40108 "\u2F07", 40109 "\u4EA0", 40110 "\u2F08", 40111 "\u4EBA", 40112 "\u2F09", 40113 "\u513F", 40114 "\u2F0A", 40115 "\u5165", 40116 "\u2F0B", 40117 "\u516B", 40118 "\u2F0C", 40119 "\u5182", 40120 "\u2F0D", 40121 "\u5196", 40122 "\u2F0E", 40123 "\u51AB", 40124 "\u2F0F", 40125 "\u51E0", 40126 "\u2F10", 40127 "\u51F5", 40128 "\u2F11", 40129 "\u5200", 40130 "\u2F12", 40131 "\u529B", 40132 "\u2F13", 40133 "\u52F9", 40134 "\u2F14", 40135 "\u5315", 40136 "\u2F15", 40137 "\u531A", 40138 "\u2F16", 40139 "\u5338", 40140 "\u2F17", 40141 "\u5341", 40142 "\u2F18", 40143 "\u535C", 40144 "\u2F19", 40145 "\u5369", 40146 "\u2F1A", 40147 "\u5382", 40148 "\u2F1B", 40149 "\u53B6", 40150 "\u2F1C", 40151 "\u53C8", 40152 "\u2F1D", 40153 "\u53E3", 40154 "\u2F1E", 40155 "\u56D7", 40156 "\u2F1F", 40157 "\u571F", 40158 "\u2F20", 40159 "\u58EB", 40160 "\u2F21", 40161 "\u5902", 40162 "\u2F22", 40163 "\u590A", 40164 "\u2F23", 40165 "\u5915", 40166 "\u2F24", 40167 "\u5927", 40168 "\u2F25", 40169 "\u5973", 40170 "\u2F26", 40171 "\u5B50", 40172 "\u2F27", 40173 "\u5B80", 40174 "\u2F28", 40175 "\u5BF8", 40176 "\u2F29", 40177 "\u5C0F", 40178 "\u2F2A", 40179 "\u5C22", 40180 "\u2F2B", 40181 "\u5C38", 40182 "\u2F2C", 40183 "\u5C6E", 40184 "\u2F2D", 40185 "\u5C71", 40186 "\u2F2E", 40187 "\u5DDB", 40188 "\u2F2F", 40189 "\u5DE5", 40190 "\u2F30", 40191 "\u5DF1", 40192 "\u2F31", 40193 "\u5DFE", 40194 "\u2F32", 40195 "\u5E72", 40196 "\u2F33", 40197 "\u5E7A", 40198 "\u2F34", 40199 "\u5E7F", 40200 "\u2F35", 40201 "\u5EF4", 40202 "\u2F36", 40203 "\u5EFE", 40204 "\u2F37", 40205 "\u5F0B", 40206 "\u2F38", 40207 "\u5F13", 40208 "\u2F39", 40209 "\u5F50", 40210 "\u2F3A", 40211 "\u5F61", 40212 "\u2F3B", 40213 "\u5F73", 40214 "\u2F3C", 40215 "\u5FC3", 40216 "\u2F3D", 40217 "\u6208", 40218 "\u2F3E", 40219 "\u6236", 40220 "\u2F3F", 40221 "\u624B", 40222 "\u2F40", 40223 "\u652F", 40224 "\u2F41", 40225 "\u6534", 40226 "\u2F42", 40227 "\u6587", 40228 "\u2F43", 40229 "\u6597", 40230 "\u2F44", 40231 "\u65A4", 40232 "\u2F45", 40233 "\u65B9", 40234 "\u2F46", 40235 "\u65E0", 40236 "\u2F47", 40237 "\u65E5", 40238 "\u2F48", 40239 "\u66F0", 40240 "\u2F49", 40241 "\u6708", 40242 "\u2F4A", 40243 "\u6728", 40244 "\u2F4B", 40245 "\u6B20", 40246 "\u2F4C", 40247 "\u6B62", 40248 "\u2F4D", 40249 "\u6B79", 40250 "\u2F4E", 40251 "\u6BB3", 40252 "\u2F4F", 40253 "\u6BCB", 40254 "\u2F50", 40255 "\u6BD4", 40256 "\u2F51", 40257 "\u6BDB", 40258 "\u2F52", 40259 "\u6C0F", 40260 "\u2F53", 40261 "\u6C14", 40262 "\u2F54", 40263 "\u6C34", 40264 "\u2F55", 40265 "\u706B", 40266 "\u2F56", 40267 "\u722A", 40268 "\u2F57", 40269 "\u7236", 40270 "\u2F58", 40271 "\u723B", 40272 "\u2F59", 40273 "\u723F", 40274 "\u2F5A", 40275 "\u7247", 40276 "\u2F5B", 40277 "\u7259", 40278 "\u2F5C", 40279 "\u725B", 40280 "\u2F5D", 40281 "\u72AC", 40282 "\u2F5E", 40283 "\u7384", 40284 "\u2F5F", 40285 "\u7389", 40286 "\u2F60", 40287 "\u74DC", 40288 "\u2F61", 40289 "\u74E6", 40290 "\u2F62", 40291 "\u7518", 40292 "\u2F63", 40293 "\u751F", 40294 "\u2F64", 40295 "\u7528", 40296 "\u2F65", 40297 "\u7530", 40298 "\u2F66", 40299 "\u758B", 40300 "\u2F67", 40301 "\u7592", 40302 "\u2F68", 40303 "\u7676", 40304 "\u2F69", 40305 "\u767D", 40306 "\u2F6A", 40307 "\u76AE", 40308 "\u2F6B", 40309 "\u76BF", 40310 "\u2F6C", 40311 "\u76EE", 40312 "\u2F6D", 40313 "\u77DB", 40314 "\u2F6E", 40315 "\u77E2", 40316 "\u2F6F", 40317 "\u77F3", 40318 "\u2F70", 40319 "\u793A", 40320 "\u2F71", 40321 "\u79B8", 40322 "\u2F72", 40323 "\u79BE", 40324 "\u2F73", 40325 "\u7A74", 40326 "\u2F74", 40327 "\u7ACB", 40328 "\u2F75", 40329 "\u7AF9", 40330 "\u2F76", 40331 "\u7C73", 40332 "\u2F77", 40333 "\u7CF8", 40334 "\u2F78", 40335 "\u7F36", 40336 "\u2F79", 40337 "\u7F51", 40338 "\u2F7A", 40339 "\u7F8A", 40340 "\u2F7B", 40341 "\u7FBD", 40342 "\u2F7C", 40343 "\u8001", 40344 "\u2F7D", 40345 "\u800C", 40346 "\u2F7E", 40347 "\u8012", 40348 "\u2F7F", 40349 "\u8033", 40350 "\u2F80", 40351 "\u807F", 40352 "\u2F81", 40353 "\u8089", 40354 "\u2F82", 40355 "\u81E3", 40356 "\u2F83", 40357 "\u81EA", 40358 "\u2F84", 40359 "\u81F3", 40360 "\u2F85", 40361 "\u81FC", 40362 "\u2F86", 40363 "\u820C", 40364 "\u2F87", 40365 "\u821B", 40366 "\u2F88", 40367 "\u821F", 40368 "\u2F89", 40369 "\u826E", 40370 "\u2F8A", 40371 "\u8272", 40372 "\u2F8B", 40373 "\u8278", 40374 "\u2F8C", 40375 "\u864D", 40376 "\u2F8D", 40377 "\u866B", 40378 "\u2F8E", 40379 "\u8840", 40380 "\u2F8F", 40381 "\u884C", 40382 "\u2F90", 40383 "\u8863", 40384 "\u2F91", 40385 "\u897E", 40386 "\u2F92", 40387 "\u898B", 40388 "\u2F93", 40389 "\u89D2", 40390 "\u2F94", 40391 "\u8A00", 40392 "\u2F95", 40393 "\u8C37", 40394 "\u2F96", 40395 "\u8C46", 40396 "\u2F97", 40397 "\u8C55", 40398 "\u2F98", 40399 "\u8C78", 40400 "\u2F99", 40401 "\u8C9D", 40402 "\u2F9A", 40403 "\u8D64", 40404 "\u2F9B", 40405 "\u8D70", 40406 "\u2F9C", 40407 "\u8DB3", 40408 "\u2F9D", 40409 "\u8EAB", 40410 "\u2F9E", 40411 "\u8ECA", 40412 "\u2F9F", 40413 "\u8F9B", 40414 "\u2FA0", 40415 "\u8FB0", 40416 "\u2FA1", 40417 "\u8FB5", 40418 "\u2FA2", 40419 "\u9091", 40420 "\u2FA3", 40421 "\u9149", 40422 "\u2FA4", 40423 "\u91C6", 40424 "\u2FA5", 40425 "\u91CC", 40426 "\u2FA6", 40427 "\u91D1", 40428 "\u2FA7", 40429 "\u9577", 40430 "\u2FA8", 40431 "\u9580", 40432 "\u2FA9", 40433 "\u961C", 40434 "\u2FAA", 40435 "\u96B6", 40436 "\u2FAB", 40437 "\u96B9", 40438 "\u2FAC", 40439 "\u96E8", 40440 "\u2FAD", 40441 "\u9751", 40442 "\u2FAE", 40443 "\u975E", 40444 "\u2FAF", 40445 "\u9762", 40446 "\u2FB0", 40447 "\u9769", 40448 "\u2FB1", 40449 "\u97CB", 40450 "\u2FB2", 40451 "\u97ED", 40452 "\u2FB3", 40453 "\u97F3", 40454 "\u2FB4", 40455 "\u9801", 40456 "\u2FB5", 40457 "\u98A8", 40458 "\u2FB6", 40459 "\u98DB", 40460 "\u2FB7", 40461 "\u98DF", 40462 "\u2FB8", 40463 "\u9996", 40464 "\u2FB9", 40465 "\u9999", 40466 "\u2FBA", 40467 "\u99AC", 40468 "\u2FBB", 40469 "\u9AA8", 40470 "\u2FBC", 40471 "\u9AD8", 40472 "\u2FBD", 40473 "\u9ADF", 40474 "\u2FBE", 40475 "\u9B25", 40476 "\u2FBF", 40477 "\u9B2F", 40478 "\u2FC0", 40479 "\u9B32", 40480 "\u2FC1", 40481 "\u9B3C", 40482 "\u2FC2", 40483 "\u9B5A", 40484 "\u2FC3", 40485 "\u9CE5", 40486 "\u2FC4", 40487 "\u9E75", 40488 "\u2FC5", 40489 "\u9E7F", 40490 "\u2FC6", 40491 "\u9EA5", 40492 "\u2FC7", 40493 "\u9EBB", 40494 "\u2FC8", 40495 "\u9EC3", 40496 "\u2FC9", 40497 "\u9ECD", 40498 "\u2FCA", 40499 "\u9ED1", 40500 "\u2FCB", 40501 "\u9EF9", 40502 "\u2FCC", 40503 "\u9EFD", 40504 "\u2FCD", 40505 "\u9F0E", 40506 "\u2FCE", 40507 "\u9F13", 40508 "\u2FCF", 40509 "\u9F20", 40510 "\u2FD0", 40511 "\u9F3B", 40512 "\u2FD1", 40513 "\u9F4A", 40514 "\u2FD2", 40515 "\u9F52", 40516 "\u2FD3", 40517 "\u9F8D", 40518 "\u2FD4", 40519 "\u9F9C", 40520 "\u2FD5", 40521 "\u9FA0", 40522 "\u3036", 40523 "\u3012", 40524 "\u3038", 40525 "\u5341", 40526 "\u3039", 40527 "\u5344", 40528 "\u303A", 40529 "\u5345", 40530 "\u309B", 40531 "\u0020\u3099", 40532 "\u309C", 40533 "\u0020\u309A", 40534 "\u3131", 40535 "\u1100", 40536 "\u3132", 40537 "\u1101", 40538 "\u3133", 40539 "\u11AA", 40540 "\u3134", 40541 "\u1102", 40542 "\u3135", 40543 "\u11AC", 40544 "\u3136", 40545 "\u11AD", 40546 "\u3137", 40547 "\u1103", 40548 "\u3138", 40549 "\u1104", 40550 "\u3139", 40551 "\u1105", 40552 "\u313A", 40553 "\u11B0", 40554 "\u313B", 40555 "\u11B1", 40556 "\u313C", 40557 "\u11B2", 40558 "\u313D", 40559 "\u11B3", 40560 "\u313E", 40561 "\u11B4", 40562 "\u313F", 40563 "\u11B5", 40564 "\u3140", 40565 "\u111A", 40566 "\u3141", 40567 "\u1106", 40568 "\u3142", 40569 "\u1107", 40570 "\u3143", 40571 "\u1108", 40572 "\u3144", 40573 "\u1121", 40574 "\u3145", 40575 "\u1109", 40576 "\u3146", 40577 "\u110A", 40578 "\u3147", 40579 "\u110B", 40580 "\u3148", 40581 "\u110C", 40582 "\u3149", 40583 "\u110D", 40584 "\u314A", 40585 "\u110E", 40586 "\u314B", 40587 "\u110F", 40588 "\u314C", 40589 "\u1110", 40590 "\u314D", 40591 "\u1111", 40592 "\u314E", 40593 "\u1112", 40594 "\u314F", 40595 "\u1161", 40596 "\u3150", 40597 "\u1162", 40598 "\u3151", 40599 "\u1163", 40600 "\u3152", 40601 "\u1164", 40602 "\u3153", 40603 "\u1165", 40604 "\u3154", 40605 "\u1166", 40606 "\u3155", 40607 "\u1167", 40608 "\u3156", 40609 "\u1168", 40610 "\u3157", 40611 "\u1169", 40612 "\u3158", 40613 "\u116A", 40614 "\u3159", 40615 "\u116B", 40616 "\u315A", 40617 "\u116C", 40618 "\u315B", 40619 "\u116D", 40620 "\u315C", 40621 "\u116E", 40622 "\u315D", 40623 "\u116F", 40624 "\u315E", 40625 "\u1170", 40626 "\u315F", 40627 "\u1171", 40628 "\u3160", 40629 "\u1172", 40630 "\u3161", 40631 "\u1173", 40632 "\u3162", 40633 "\u1174", 40634 "\u3163", 40635 "\u1175", 40636 "\u3164", 40637 "\u1160", 40638 "\u3165", 40639 "\u1114", 40640 "\u3166", 40641 "\u1115", 40642 "\u3167", 40643 "\u11C7", 40644 "\u3168", 40645 "\u11C8", 40646 "\u3169", 40647 "\u11CC", 40648 "\u316A", 40649 "\u11CE", 40650 "\u316B", 40651 "\u11D3", 40652 "\u316C", 40653 "\u11D7", 40654 "\u316D", 40655 "\u11D9", 40656 "\u316E", 40657 "\u111C", 40658 "\u316F", 40659 "\u11DD", 40660 "\u3170", 40661 "\u11DF", 40662 "\u3171", 40663 "\u111D", 40664 "\u3172", 40665 "\u111E", 40666 "\u3173", 40667 "\u1120", 40668 "\u3174", 40669 "\u1122", 40670 "\u3175", 40671 "\u1123", 40672 "\u3176", 40673 "\u1127", 40674 "\u3177", 40675 "\u1129", 40676 "\u3178", 40677 "\u112B", 40678 "\u3179", 40679 "\u112C", 40680 "\u317A", 40681 "\u112D", 40682 "\u317B", 40683 "\u112E", 40684 "\u317C", 40685 "\u112F", 40686 "\u317D", 40687 "\u1132", 40688 "\u317E", 40689 "\u1136", 40690 "\u317F", 40691 "\u1140", 40692 "\u3180", 40693 "\u1147", 40694 "\u3181", 40695 "\u114C", 40696 "\u3182", 40697 "\u11F1", 40698 "\u3183", 40699 "\u11F2", 40700 "\u3184", 40701 "\u1157", 40702 "\u3185", 40703 "\u1158", 40704 "\u3186", 40705 "\u1159", 40706 "\u3187", 40707 "\u1184", 40708 "\u3188", 40709 "\u1185", 40710 "\u3189", 40711 "\u1188", 40712 "\u318A", 40713 "\u1191", 40714 "\u318B", 40715 "\u1192", 40716 "\u318C", 40717 "\u1194", 40718 "\u318D", 40719 "\u119E", 40720 "\u318E", 40721 "\u11A1", 40722 "\u3200", 40723 "\u0028\u1100\u0029", 40724 "\u3201", 40725 "\u0028\u1102\u0029", 40726 "\u3202", 40727 "\u0028\u1103\u0029", 40728 "\u3203", 40729 "\u0028\u1105\u0029", 40730 "\u3204", 40731 "\u0028\u1106\u0029", 40732 "\u3205", 40733 "\u0028\u1107\u0029", 40734 "\u3206", 40735 "\u0028\u1109\u0029", 40736 "\u3207", 40737 "\u0028\u110B\u0029", 40738 "\u3208", 40739 "\u0028\u110C\u0029", 40740 "\u3209", 40741 "\u0028\u110E\u0029", 40742 "\u320A", 40743 "\u0028\u110F\u0029", 40744 "\u320B", 40745 "\u0028\u1110\u0029", 40746 "\u320C", 40747 "\u0028\u1111\u0029", 40748 "\u320D", 40749 "\u0028\u1112\u0029", 40750 "\u320E", 40751 "\u0028\u1100\u1161\u0029", 40752 "\u320F", 40753 "\u0028\u1102\u1161\u0029", 40754 "\u3210", 40755 "\u0028\u1103\u1161\u0029", 40756 "\u3211", 40757 "\u0028\u1105\u1161\u0029", 40758 "\u3212", 40759 "\u0028\u1106\u1161\u0029", 40760 "\u3213", 40761 "\u0028\u1107\u1161\u0029", 40762 "\u3214", 40763 "\u0028\u1109\u1161\u0029", 40764 "\u3215", 40765 "\u0028\u110B\u1161\u0029", 40766 "\u3216", 40767 "\u0028\u110C\u1161\u0029", 40768 "\u3217", 40769 "\u0028\u110E\u1161\u0029", 40770 "\u3218", 40771 "\u0028\u110F\u1161\u0029", 40772 "\u3219", 40773 "\u0028\u1110\u1161\u0029", 40774 "\u321A", 40775 "\u0028\u1111\u1161\u0029", 40776 "\u321B", 40777 "\u0028\u1112\u1161\u0029", 40778 "\u321C", 40779 "\u0028\u110C\u116E\u0029", 40780 "\u321D", 40781 "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029", 40782 "\u321E", 40783 "\u0028\u110B\u1169\u1112\u116E\u0029", 40784 "\u3220", 40785 "\u0028\u4E00\u0029", 40786 "\u3221", 40787 "\u0028\u4E8C\u0029", 40788 "\u3222", 40789 "\u0028\u4E09\u0029", 40790 "\u3223", 40791 "\u0028\u56DB\u0029", 40792 "\u3224", 40793 "\u0028\u4E94\u0029", 40794 "\u3225", 40795 "\u0028\u516D\u0029", 40796 "\u3226", 40797 "\u0028\u4E03\u0029", 40798 "\u3227", 40799 "\u0028\u516B\u0029", 40800 "\u3228", 40801 "\u0028\u4E5D\u0029", 40802 "\u3229", 40803 "\u0028\u5341\u0029", 40804 "\u322A", 40805 "\u0028\u6708\u0029", 40806 "\u322B", 40807 "\u0028\u706B\u0029", 40808 "\u322C", 40809 "\u0028\u6C34\u0029", 40810 "\u322D", 40811 "\u0028\u6728\u0029", 40812 "\u322E", 40813 "\u0028\u91D1\u0029", 40814 "\u322F", 40815 "\u0028\u571F\u0029", 40816 "\u3230", 40817 "\u0028\u65E5\u0029", 40818 "\u3231", 40819 "\u0028\u682A\u0029", 40820 "\u3232", 40821 "\u0028\u6709\u0029", 40822 "\u3233", 40823 "\u0028\u793E\u0029", 40824 "\u3234", 40825 "\u0028\u540D\u0029", 40826 "\u3235", 40827 "\u0028\u7279\u0029", 40828 "\u3236", 40829 "\u0028\u8CA1\u0029", 40830 "\u3237", 40831 "\u0028\u795D\u0029", 40832 "\u3238", 40833 "\u0028\u52B4\u0029", 40834 "\u3239", 40835 "\u0028\u4EE3\u0029", 40836 "\u323A", 40837 "\u0028\u547C\u0029", 40838 "\u323B", 40839 "\u0028\u5B66\u0029", 40840 "\u323C", 40841 "\u0028\u76E3\u0029", 40842 "\u323D", 40843 "\u0028\u4F01\u0029", 40844 "\u323E", 40845 "\u0028\u8CC7\u0029", 40846 "\u323F", 40847 "\u0028\u5354\u0029", 40848 "\u3240", 40849 "\u0028\u796D\u0029", 40850 "\u3241", 40851 "\u0028\u4F11\u0029", 40852 "\u3242", 40853 "\u0028\u81EA\u0029", 40854 "\u3243", 40855 "\u0028\u81F3\u0029", 40856 "\u32C0", 40857 "\u0031\u6708", 40858 "\u32C1", 40859 "\u0032\u6708", 40860 "\u32C2", 40861 "\u0033\u6708", 40862 "\u32C3", 40863 "\u0034\u6708", 40864 "\u32C4", 40865 "\u0035\u6708", 40866 "\u32C5", 40867 "\u0036\u6708", 40868 "\u32C6", 40869 "\u0037\u6708", 40870 "\u32C7", 40871 "\u0038\u6708", 40872 "\u32C8", 40873 "\u0039\u6708", 40874 "\u32C9", 40875 "\u0031\u0030\u6708", 40876 "\u32CA", 40877 "\u0031\u0031\u6708", 40878 "\u32CB", 40879 "\u0031\u0032\u6708", 40880 "\u3358", 40881 "\u0030\u70B9", 40882 "\u3359", 40883 "\u0031\u70B9", 40884 "\u335A", 40885 "\u0032\u70B9", 40886 "\u335B", 40887 "\u0033\u70B9", 40888 "\u335C", 40889 "\u0034\u70B9", 40890 "\u335D", 40891 "\u0035\u70B9", 40892 "\u335E", 40893 "\u0036\u70B9", 40894 "\u335F", 40895 "\u0037\u70B9", 40896 "\u3360", 40897 "\u0038\u70B9", 40898 "\u3361", 40899 "\u0039\u70B9", 40900 "\u3362", 40901 "\u0031\u0030\u70B9", 40902 "\u3363", 40903 "\u0031\u0031\u70B9", 40904 "\u3364", 40905 "\u0031\u0032\u70B9", 40906 "\u3365", 40907 "\u0031\u0033\u70B9", 40908 "\u3366", 40909 "\u0031\u0034\u70B9", 40910 "\u3367", 40911 "\u0031\u0035\u70B9", 40912 "\u3368", 40913 "\u0031\u0036\u70B9", 40914 "\u3369", 40915 "\u0031\u0037\u70B9", 40916 "\u336A", 40917 "\u0031\u0038\u70B9", 40918 "\u336B", 40919 "\u0031\u0039\u70B9", 40920 "\u336C", 40921 "\u0032\u0030\u70B9", 40922 "\u336D", 40923 "\u0032\u0031\u70B9", 40924 "\u336E", 40925 "\u0032\u0032\u70B9", 40926 "\u336F", 40927 "\u0032\u0033\u70B9", 40928 "\u3370", 40929 "\u0032\u0034\u70B9", 40930 "\u33E0", 40931 "\u0031\u65E5", 40932 "\u33E1", 40933 "\u0032\u65E5", 40934 "\u33E2", 40935 "\u0033\u65E5", 40936 "\u33E3", 40937 "\u0034\u65E5", 40938 "\u33E4", 40939 "\u0035\u65E5", 40940 "\u33E5", 40941 "\u0036\u65E5", 40942 "\u33E6", 40943 "\u0037\u65E5", 40944 "\u33E7", 40945 "\u0038\u65E5", 40946 "\u33E8", 40947 "\u0039\u65E5", 40948 "\u33E9", 40949 "\u0031\u0030\u65E5", 40950 "\u33EA", 40951 "\u0031\u0031\u65E5", 40952 "\u33EB", 40953 "\u0031\u0032\u65E5", 40954 "\u33EC", 40955 "\u0031\u0033\u65E5", 40956 "\u33ED", 40957 "\u0031\u0034\u65E5", 40958 "\u33EE", 40959 "\u0031\u0035\u65E5", 40960 "\u33EF", 40961 "\u0031\u0036\u65E5", 40962 "\u33F0", 40963 "\u0031\u0037\u65E5", 40964 "\u33F1", 40965 "\u0031\u0038\u65E5", 40966 "\u33F2", 40967 "\u0031\u0039\u65E5", 40968 "\u33F3", 40969 "\u0032\u0030\u65E5", 40970 "\u33F4", 40971 "\u0032\u0031\u65E5", 40972 "\u33F5", 40973 "\u0032\u0032\u65E5", 40974 "\u33F6", 40975 "\u0032\u0033\u65E5", 40976 "\u33F7", 40977 "\u0032\u0034\u65E5", 40978 "\u33F8", 40979 "\u0032\u0035\u65E5", 40980 "\u33F9", 40981 "\u0032\u0036\u65E5", 40982 "\u33FA", 40983 "\u0032\u0037\u65E5", 40984 "\u33FB", 40985 "\u0032\u0038\u65E5", 40986 "\u33FC", 40987 "\u0032\u0039\u65E5", 40988 "\u33FD", 40989 "\u0033\u0030\u65E5", 40990 "\u33FE", 40991 "\u0033\u0031\u65E5", 40992 "\uFB00", 40993 "\u0066\u0066", 40994 "\uFB01", 40995 "\u0066\u0069", 40996 "\uFB02", 40997 "\u0066\u006C", 40998 "\uFB03", 40999 "\u0066\u0066\u0069", 41000 "\uFB04", 41001 "\u0066\u0066\u006C", 41002 "\uFB05", 41003 "\u017F\u0074", 41004 "\uFB06", 41005 "\u0073\u0074", 41006 "\uFB13", 41007 "\u0574\u0576", 41008 "\uFB14", 41009 "\u0574\u0565", 41010 "\uFB15", 41011 "\u0574\u056B", 41012 "\uFB16", 41013 "\u057E\u0576", 41014 "\uFB17", 41015 "\u0574\u056D", 41016 "\uFB4F", 41017 "\u05D0\u05DC", 41018 "\uFB50", 41019 "\u0671", 41020 "\uFB51", 41021 "\u0671", 41022 "\uFB52", 41023 "\u067B", 41024 "\uFB53", 41025 "\u067B", 41026 "\uFB54", 41027 "\u067B", 41028 "\uFB55", 41029 "\u067B", 41030 "\uFB56", 41031 "\u067E", 41032 "\uFB57", 41033 "\u067E", 41034 "\uFB58", 41035 "\u067E", 41036 "\uFB59", 41037 "\u067E", 41038 "\uFB5A", 41039 "\u0680", 41040 "\uFB5B", 41041 "\u0680", 41042 "\uFB5C", 41043 "\u0680", 41044 "\uFB5D", 41045 "\u0680", 41046 "\uFB5E", 41047 "\u067A", 41048 "\uFB5F", 41049 "\u067A", 41050 "\uFB60", 41051 "\u067A", 41052 "\uFB61", 41053 "\u067A", 41054 "\uFB62", 41055 "\u067F", 41056 "\uFB63", 41057 "\u067F", 41058 "\uFB64", 41059 "\u067F", 41060 "\uFB65", 41061 "\u067F", 41062 "\uFB66", 41063 "\u0679", 41064 "\uFB67", 41065 "\u0679", 41066 "\uFB68", 41067 "\u0679", 41068 "\uFB69", 41069 "\u0679", 41070 "\uFB6A", 41071 "\u06A4", 41072 "\uFB6B", 41073 "\u06A4", 41074 "\uFB6C", 41075 "\u06A4", 41076 "\uFB6D", 41077 "\u06A4", 41078 "\uFB6E", 41079 "\u06A6", 41080 "\uFB6F", 41081 "\u06A6", 41082 "\uFB70", 41083 "\u06A6", 41084 "\uFB71", 41085 "\u06A6", 41086 "\uFB72", 41087 "\u0684", 41088 "\uFB73", 41089 "\u0684", 41090 "\uFB74", 41091 "\u0684", 41092 "\uFB75", 41093 "\u0684", 41094 "\uFB76", 41095 "\u0683", 41096 "\uFB77", 41097 "\u0683", 41098 "\uFB78", 41099 "\u0683", 41100 "\uFB79", 41101 "\u0683", 41102 "\uFB7A", 41103 "\u0686", 41104 "\uFB7B", 41105 "\u0686", 41106 "\uFB7C", 41107 "\u0686", 41108 "\uFB7D", 41109 "\u0686", 41110 "\uFB7E", 41111 "\u0687", 41112 "\uFB7F", 41113 "\u0687", 41114 "\uFB80", 41115 "\u0687", 41116 "\uFB81", 41117 "\u0687", 41118 "\uFB82", 41119 "\u068D", 41120 "\uFB83", 41121 "\u068D", 41122 "\uFB84", 41123 "\u068C", 41124 "\uFB85", 41125 "\u068C", 41126 "\uFB86", 41127 "\u068E", 41128 "\uFB87", 41129 "\u068E", 41130 "\uFB88", 41131 "\u0688", 41132 "\uFB89", 41133 "\u0688", 41134 "\uFB8A", 41135 "\u0698", 41136 "\uFB8B", 41137 "\u0698", 41138 "\uFB8C", 41139 "\u0691", 41140 "\uFB8D", 41141 "\u0691", 41142 "\uFB8E", 41143 "\u06A9", 41144 "\uFB8F", 41145 "\u06A9", 41146 "\uFB90", 41147 "\u06A9", 41148 "\uFB91", 41149 "\u06A9", 41150 "\uFB92", 41151 "\u06AF", 41152 "\uFB93", 41153 "\u06AF", 41154 "\uFB94", 41155 "\u06AF", 41156 "\uFB95", 41157 "\u06AF", 41158 "\uFB96", 41159 "\u06B3", 41160 "\uFB97", 41161 "\u06B3", 41162 "\uFB98", 41163 "\u06B3", 41164 "\uFB99", 41165 "\u06B3", 41166 "\uFB9A", 41167 "\u06B1", 41168 "\uFB9B", 41169 "\u06B1", 41170 "\uFB9C", 41171 "\u06B1", 41172 "\uFB9D", 41173 "\u06B1", 41174 "\uFB9E", 41175 "\u06BA", 41176 "\uFB9F", 41177 "\u06BA", 41178 "\uFBA0", 41179 "\u06BB", 41180 "\uFBA1", 41181 "\u06BB", 41182 "\uFBA2", 41183 "\u06BB", 41184 "\uFBA3", 41185 "\u06BB", 41186 "\uFBA4", 41187 "\u06C0", 41188 "\uFBA5", 41189 "\u06C0", 41190 "\uFBA6", 41191 "\u06C1", 41192 "\uFBA7", 41193 "\u06C1", 41194 "\uFBA8", 41195 "\u06C1", 41196 "\uFBA9", 41197 "\u06C1", 41198 "\uFBAA", 41199 "\u06BE", 41200 "\uFBAB", 41201 "\u06BE", 41202 "\uFBAC", 41203 "\u06BE", 41204 "\uFBAD", 41205 "\u06BE", 41206 "\uFBAE", 41207 "\u06D2", 41208 "\uFBAF", 41209 "\u06D2", 41210 "\uFBB0", 41211 "\u06D3", 41212 "\uFBB1", 41213 "\u06D3", 41214 "\uFBD3", 41215 "\u06AD", 41216 "\uFBD4", 41217 "\u06AD", 41218 "\uFBD5", 41219 "\u06AD", 41220 "\uFBD6", 41221 "\u06AD", 41222 "\uFBD7", 41223 "\u06C7", 41224 "\uFBD8", 41225 "\u06C7", 41226 "\uFBD9", 41227 "\u06C6", 41228 "\uFBDA", 41229 "\u06C6", 41230 "\uFBDB", 41231 "\u06C8", 41232 "\uFBDC", 41233 "\u06C8", 41234 "\uFBDD", 41235 "\u0677", 41236 "\uFBDE", 41237 "\u06CB", 41238 "\uFBDF", 41239 "\u06CB", 41240 "\uFBE0", 41241 "\u06C5", 41242 "\uFBE1", 41243 "\u06C5", 41244 "\uFBE2", 41245 "\u06C9", 41246 "\uFBE3", 41247 "\u06C9", 41248 "\uFBE4", 41249 "\u06D0", 41250 "\uFBE5", 41251 "\u06D0", 41252 "\uFBE6", 41253 "\u06D0", 41254 "\uFBE7", 41255 "\u06D0", 41256 "\uFBE8", 41257 "\u0649", 41258 "\uFBE9", 41259 "\u0649", 41260 "\uFBEA", 41261 "\u0626\u0627", 41262 "\uFBEB", 41263 "\u0626\u0627", 41264 "\uFBEC", 41265 "\u0626\u06D5", 41266 "\uFBED", 41267 "\u0626\u06D5", 41268 "\uFBEE", 41269 "\u0626\u0648", 41270 "\uFBEF", 41271 "\u0626\u0648", 41272 "\uFBF0", 41273 "\u0626\u06C7", 41274 "\uFBF1", 41275 "\u0626\u06C7", 41276 "\uFBF2", 41277 "\u0626\u06C6", 41278 "\uFBF3", 41279 "\u0626\u06C6", 41280 "\uFBF4", 41281 "\u0626\u06C8", 41282 "\uFBF5", 41283 "\u0626\u06C8", 41284 "\uFBF6", 41285 "\u0626\u06D0", 41286 "\uFBF7", 41287 "\u0626\u06D0", 41288 "\uFBF8", 41289 "\u0626\u06D0", 41290 "\uFBF9", 41291 "\u0626\u0649", 41292 "\uFBFA", 41293 "\u0626\u0649", 41294 "\uFBFB", 41295 "\u0626\u0649", 41296 "\uFBFC", 41297 "\u06CC", 41298 "\uFBFD", 41299 "\u06CC", 41300 "\uFBFE", 41301 "\u06CC", 41302 "\uFBFF", 41303 "\u06CC", 41304 "\uFC00", 41305 "\u0626\u062C", 41306 "\uFC01", 41307 "\u0626\u062D", 41308 "\uFC02", 41309 "\u0626\u0645", 41310 "\uFC03", 41311 "\u0626\u0649", 41312 "\uFC04", 41313 "\u0626\u064A", 41314 "\uFC05", 41315 "\u0628\u062C", 41316 "\uFC06", 41317 "\u0628\u062D", 41318 "\uFC07", 41319 "\u0628\u062E", 41320 "\uFC08", 41321 "\u0628\u0645", 41322 "\uFC09", 41323 "\u0628\u0649", 41324 "\uFC0A", 41325 "\u0628\u064A", 41326 "\uFC0B", 41327 "\u062A\u062C", 41328 "\uFC0C", 41329 "\u062A\u062D", 41330 "\uFC0D", 41331 "\u062A\u062E", 41332 "\uFC0E", 41333 "\u062A\u0645", 41334 "\uFC0F", 41335 "\u062A\u0649", 41336 "\uFC10", 41337 "\u062A\u064A", 41338 "\uFC11", 41339 "\u062B\u062C", 41340 "\uFC12", 41341 "\u062B\u0645", 41342 "\uFC13", 41343 "\u062B\u0649", 41344 "\uFC14", 41345 "\u062B\u064A", 41346 "\uFC15", 41347 "\u062C\u062D", 41348 "\uFC16", 41349 "\u062C\u0645", 41350 "\uFC17", 41351 "\u062D\u062C", 41352 "\uFC18", 41353 "\u062D\u0645", 41354 "\uFC19", 41355 "\u062E\u062C", 41356 "\uFC1A", 41357 "\u062E\u062D", 41358 "\uFC1B", 41359 "\u062E\u0645", 41360 "\uFC1C", 41361 "\u0633\u062C", 41362 "\uFC1D", 41363 "\u0633\u062D", 41364 "\uFC1E", 41365 "\u0633\u062E", 41366 "\uFC1F", 41367 "\u0633\u0645", 41368 "\uFC20", 41369 "\u0635\u062D", 41370 "\uFC21", 41371 "\u0635\u0645", 41372 "\uFC22", 41373 "\u0636\u062C", 41374 "\uFC23", 41375 "\u0636\u062D", 41376 "\uFC24", 41377 "\u0636\u062E", 41378 "\uFC25", 41379 "\u0636\u0645", 41380 "\uFC26", 41381 "\u0637\u062D", 41382 "\uFC27", 41383 "\u0637\u0645", 41384 "\uFC28", 41385 "\u0638\u0645", 41386 "\uFC29", 41387 "\u0639\u062C", 41388 "\uFC2A", 41389 "\u0639\u0645", 41390 "\uFC2B", 41391 "\u063A\u062C", 41392 "\uFC2C", 41393 "\u063A\u0645", 41394 "\uFC2D", 41395 "\u0641\u062C", 41396 "\uFC2E", 41397 "\u0641\u062D", 41398 "\uFC2F", 41399 "\u0641\u062E", 41400 "\uFC30", 41401 "\u0641\u0645", 41402 "\uFC31", 41403 "\u0641\u0649", 41404 "\uFC32", 41405 "\u0641\u064A", 41406 "\uFC33", 41407 "\u0642\u062D", 41408 "\uFC34", 41409 "\u0642\u0645", 41410 "\uFC35", 41411 "\u0642\u0649", 41412 "\uFC36", 41413 "\u0642\u064A", 41414 "\uFC37", 41415 "\u0643\u0627", 41416 "\uFC38", 41417 "\u0643\u062C", 41418 "\uFC39", 41419 "\u0643\u062D", 41420 "\uFC3A", 41421 "\u0643\u062E", 41422 "\uFC3B", 41423 "\u0643\u0644", 41424 "\uFC3C", 41425 "\u0643\u0645", 41426 "\uFC3D", 41427 "\u0643\u0649", 41428 "\uFC3E", 41429 "\u0643\u064A", 41430 "\uFC3F", 41431 "\u0644\u062C", 41432 "\uFC40", 41433 "\u0644\u062D", 41434 "\uFC41", 41435 "\u0644\u062E", 41436 "\uFC42", 41437 "\u0644\u0645", 41438 "\uFC43", 41439 "\u0644\u0649", 41440 "\uFC44", 41441 "\u0644\u064A", 41442 "\uFC45", 41443 "\u0645\u062C", 41444 "\uFC46", 41445 "\u0645\u062D", 41446 "\uFC47", 41447 "\u0645\u062E", 41448 "\uFC48", 41449 "\u0645\u0645", 41450 "\uFC49", 41451 "\u0645\u0649", 41452 "\uFC4A", 41453 "\u0645\u064A", 41454 "\uFC4B", 41455 "\u0646\u062C", 41456 "\uFC4C", 41457 "\u0646\u062D", 41458 "\uFC4D", 41459 "\u0646\u062E", 41460 "\uFC4E", 41461 "\u0646\u0645", 41462 "\uFC4F", 41463 "\u0646\u0649", 41464 "\uFC50", 41465 "\u0646\u064A", 41466 "\uFC51", 41467 "\u0647\u062C", 41468 "\uFC52", 41469 "\u0647\u0645", 41470 "\uFC53", 41471 "\u0647\u0649", 41472 "\uFC54", 41473 "\u0647\u064A", 41474 "\uFC55", 41475 "\u064A\u062C", 41476 "\uFC56", 41477 "\u064A\u062D", 41478 "\uFC57", 41479 "\u064A\u062E", 41480 "\uFC58", 41481 "\u064A\u0645", 41482 "\uFC59", 41483 "\u064A\u0649", 41484 "\uFC5A", 41485 "\u064A\u064A", 41486 "\uFC5B", 41487 "\u0630\u0670", 41488 "\uFC5C", 41489 "\u0631\u0670", 41490 "\uFC5D", 41491 "\u0649\u0670", 41492 "\uFC5E", 41493 "\u0020\u064C\u0651", 41494 "\uFC5F", 41495 "\u0020\u064D\u0651", 41496 "\uFC60", 41497 "\u0020\u064E\u0651", 41498 "\uFC61", 41499 "\u0020\u064F\u0651", 41500 "\uFC62", 41501 "\u0020\u0650\u0651", 41502 "\uFC63", 41503 "\u0020\u0651\u0670", 41504 "\uFC64", 41505 "\u0626\u0631", 41506 "\uFC65", 41507 "\u0626\u0632", 41508 "\uFC66", 41509 "\u0626\u0645", 41510 "\uFC67", 41511 "\u0626\u0646", 41512 "\uFC68", 41513 "\u0626\u0649", 41514 "\uFC69", 41515 "\u0626\u064A", 41516 "\uFC6A", 41517 "\u0628\u0631", 41518 "\uFC6B", 41519 "\u0628\u0632", 41520 "\uFC6C", 41521 "\u0628\u0645", 41522 "\uFC6D", 41523 "\u0628\u0646", 41524 "\uFC6E", 41525 "\u0628\u0649", 41526 "\uFC6F", 41527 "\u0628\u064A", 41528 "\uFC70", 41529 "\u062A\u0631", 41530 "\uFC71", 41531 "\u062A\u0632", 41532 "\uFC72", 41533 "\u062A\u0645", 41534 "\uFC73", 41535 "\u062A\u0646", 41536 "\uFC74", 41537 "\u062A\u0649", 41538 "\uFC75", 41539 "\u062A\u064A", 41540 "\uFC76", 41541 "\u062B\u0631", 41542 "\uFC77", 41543 "\u062B\u0632", 41544 "\uFC78", 41545 "\u062B\u0645", 41546 "\uFC79", 41547 "\u062B\u0646", 41548 "\uFC7A", 41549 "\u062B\u0649", 41550 "\uFC7B", 41551 "\u062B\u064A", 41552 "\uFC7C", 41553 "\u0641\u0649", 41554 "\uFC7D", 41555 "\u0641\u064A", 41556 "\uFC7E", 41557 "\u0642\u0649", 41558 "\uFC7F", 41559 "\u0642\u064A", 41560 "\uFC80", 41561 "\u0643\u0627", 41562 "\uFC81", 41563 "\u0643\u0644", 41564 "\uFC82", 41565 "\u0643\u0645", 41566 "\uFC83", 41567 "\u0643\u0649", 41568 "\uFC84", 41569 "\u0643\u064A", 41570 "\uFC85", 41571 "\u0644\u0645", 41572 "\uFC86", 41573 "\u0644\u0649", 41574 "\uFC87", 41575 "\u0644\u064A", 41576 "\uFC88", 41577 "\u0645\u0627", 41578 "\uFC89", 41579 "\u0645\u0645", 41580 "\uFC8A", 41581 "\u0646\u0631", 41582 "\uFC8B", 41583 "\u0646\u0632", 41584 "\uFC8C", 41585 "\u0646\u0645", 41586 "\uFC8D", 41587 "\u0646\u0646", 41588 "\uFC8E", 41589 "\u0646\u0649", 41590 "\uFC8F", 41591 "\u0646\u064A", 41592 "\uFC90", 41593 "\u0649\u0670", 41594 "\uFC91", 41595 "\u064A\u0631", 41596 "\uFC92", 41597 "\u064A\u0632", 41598 "\uFC93", 41599 "\u064A\u0645", 41600 "\uFC94", 41601 "\u064A\u0646", 41602 "\uFC95", 41603 "\u064A\u0649", 41604 "\uFC96", 41605 "\u064A\u064A", 41606 "\uFC97", 41607 "\u0626\u062C", 41608 "\uFC98", 41609 "\u0626\u062D", 41610 "\uFC99", 41611 "\u0626\u062E", 41612 "\uFC9A", 41613 "\u0626\u0645", 41614 "\uFC9B", 41615 "\u0626\u0647", 41616 "\uFC9C", 41617 "\u0628\u062C", 41618 "\uFC9D", 41619 "\u0628\u062D", 41620 "\uFC9E", 41621 "\u0628\u062E", 41622 "\uFC9F", 41623 "\u0628\u0645", 41624 "\uFCA0", 41625 "\u0628\u0647", 41626 "\uFCA1", 41627 "\u062A\u062C", 41628 "\uFCA2", 41629 "\u062A\u062D", 41630 "\uFCA3", 41631 "\u062A\u062E", 41632 "\uFCA4", 41633 "\u062A\u0645", 41634 "\uFCA5", 41635 "\u062A\u0647", 41636 "\uFCA6", 41637 "\u062B\u0645", 41638 "\uFCA7", 41639 "\u062C\u062D", 41640 "\uFCA8", 41641 "\u062C\u0645", 41642 "\uFCA9", 41643 "\u062D\u062C", 41644 "\uFCAA", 41645 "\u062D\u0645", 41646 "\uFCAB", 41647 "\u062E\u062C", 41648 "\uFCAC", 41649 "\u062E\u0645", 41650 "\uFCAD", 41651 "\u0633\u062C", 41652 "\uFCAE", 41653 "\u0633\u062D", 41654 "\uFCAF", 41655 "\u0633\u062E", 41656 "\uFCB0", 41657 "\u0633\u0645", 41658 "\uFCB1", 41659 "\u0635\u062D", 41660 "\uFCB2", 41661 "\u0635\u062E", 41662 "\uFCB3", 41663 "\u0635\u0645", 41664 "\uFCB4", 41665 "\u0636\u062C", 41666 "\uFCB5", 41667 "\u0636\u062D", 41668 "\uFCB6", 41669 "\u0636\u062E", 41670 "\uFCB7", 41671 "\u0636\u0645", 41672 "\uFCB8", 41673 "\u0637\u062D", 41674 "\uFCB9", 41675 "\u0638\u0645", 41676 "\uFCBA", 41677 "\u0639\u062C", 41678 "\uFCBB", 41679 "\u0639\u0645", 41680 "\uFCBC", 41681 "\u063A\u062C", 41682 "\uFCBD", 41683 "\u063A\u0645", 41684 "\uFCBE", 41685 "\u0641\u062C", 41686 "\uFCBF", 41687 "\u0641\u062D", 41688 "\uFCC0", 41689 "\u0641\u062E", 41690 "\uFCC1", 41691 "\u0641\u0645", 41692 "\uFCC2", 41693 "\u0642\u062D", 41694 "\uFCC3", 41695 "\u0642\u0645", 41696 "\uFCC4", 41697 "\u0643\u062C", 41698 "\uFCC5", 41699 "\u0643\u062D", 41700 "\uFCC6", 41701 "\u0643\u062E", 41702 "\uFCC7", 41703 "\u0643\u0644", 41704 "\uFCC8", 41705 "\u0643\u0645", 41706 "\uFCC9", 41707 "\u0644\u062C", 41708 "\uFCCA", 41709 "\u0644\u062D", 41710 "\uFCCB", 41711 "\u0644\u062E", 41712 "\uFCCC", 41713 "\u0644\u0645", 41714 "\uFCCD", 41715 "\u0644\u0647", 41716 "\uFCCE", 41717 "\u0645\u062C", 41718 "\uFCCF", 41719 "\u0645\u062D", 41720 "\uFCD0", 41721 "\u0645\u062E", 41722 "\uFCD1", 41723 "\u0645\u0645", 41724 "\uFCD2", 41725 "\u0646\u062C", 41726 "\uFCD3", 41727 "\u0646\u062D", 41728 "\uFCD4", 41729 "\u0646\u062E", 41730 "\uFCD5", 41731 "\u0646\u0645", 41732 "\uFCD6", 41733 "\u0646\u0647", 41734 "\uFCD7", 41735 "\u0647\u062C", 41736 "\uFCD8", 41737 "\u0647\u0645", 41738 "\uFCD9", 41739 "\u0647\u0670", 41740 "\uFCDA", 41741 "\u064A\u062C", 41742 "\uFCDB", 41743 "\u064A\u062D", 41744 "\uFCDC", 41745 "\u064A\u062E", 41746 "\uFCDD", 41747 "\u064A\u0645", 41748 "\uFCDE", 41749 "\u064A\u0647", 41750 "\uFCDF", 41751 "\u0626\u0645", 41752 "\uFCE0", 41753 "\u0626\u0647", 41754 "\uFCE1", 41755 "\u0628\u0645", 41756 "\uFCE2", 41757 "\u0628\u0647", 41758 "\uFCE3", 41759 "\u062A\u0645", 41760 "\uFCE4", 41761 "\u062A\u0647", 41762 "\uFCE5", 41763 "\u062B\u0645", 41764 "\uFCE6", 41765 "\u062B\u0647", 41766 "\uFCE7", 41767 "\u0633\u0645", 41768 "\uFCE8", 41769 "\u0633\u0647", 41770 "\uFCE9", 41771 "\u0634\u0645", 41772 "\uFCEA", 41773 "\u0634\u0647", 41774 "\uFCEB", 41775 "\u0643\u0644", 41776 "\uFCEC", 41777 "\u0643\u0645", 41778 "\uFCED", 41779 "\u0644\u0645", 41780 "\uFCEE", 41781 "\u0646\u0645", 41782 "\uFCEF", 41783 "\u0646\u0647", 41784 "\uFCF0", 41785 "\u064A\u0645", 41786 "\uFCF1", 41787 "\u064A\u0647", 41788 "\uFCF2", 41789 "\u0640\u064E\u0651", 41790 "\uFCF3", 41791 "\u0640\u064F\u0651", 41792 "\uFCF4", 41793 "\u0640\u0650\u0651", 41794 "\uFCF5", 41795 "\u0637\u0649", 41796 "\uFCF6", 41797 "\u0637\u064A", 41798 "\uFCF7", 41799 "\u0639\u0649", 41800 "\uFCF8", 41801 "\u0639\u064A", 41802 "\uFCF9", 41803 "\u063A\u0649", 41804 "\uFCFA", 41805 "\u063A\u064A", 41806 "\uFCFB", 41807 "\u0633\u0649", 41808 "\uFCFC", 41809 "\u0633\u064A", 41810 "\uFCFD", 41811 "\u0634\u0649", 41812 "\uFCFE", 41813 "\u0634\u064A", 41814 "\uFCFF", 41815 "\u062D\u0649", 41816 "\uFD00", 41817 "\u062D\u064A", 41818 "\uFD01", 41819 "\u062C\u0649", 41820 "\uFD02", 41821 "\u062C\u064A", 41822 "\uFD03", 41823 "\u062E\u0649", 41824 "\uFD04", 41825 "\u062E\u064A", 41826 "\uFD05", 41827 "\u0635\u0649", 41828 "\uFD06", 41829 "\u0635\u064A", 41830 "\uFD07", 41831 "\u0636\u0649", 41832 "\uFD08", 41833 "\u0636\u064A", 41834 "\uFD09", 41835 "\u0634\u062C", 41836 "\uFD0A", 41837 "\u0634\u062D", 41838 "\uFD0B", 41839 "\u0634\u062E", 41840 "\uFD0C", 41841 "\u0634\u0645", 41842 "\uFD0D", 41843 "\u0634\u0631", 41844 "\uFD0E", 41845 "\u0633\u0631", 41846 "\uFD0F", 41847 "\u0635\u0631", 41848 "\uFD10", 41849 "\u0636\u0631", 41850 "\uFD11", 41851 "\u0637\u0649", 41852 "\uFD12", 41853 "\u0637\u064A", 41854 "\uFD13", 41855 "\u0639\u0649", 41856 "\uFD14", 41857 "\u0639\u064A", 41858 "\uFD15", 41859 "\u063A\u0649", 41860 "\uFD16", 41861 "\u063A\u064A", 41862 "\uFD17", 41863 "\u0633\u0649", 41864 "\uFD18", 41865 "\u0633\u064A", 41866 "\uFD19", 41867 "\u0634\u0649", 41868 "\uFD1A", 41869 "\u0634\u064A", 41870 "\uFD1B", 41871 "\u062D\u0649", 41872 "\uFD1C", 41873 "\u062D\u064A", 41874 "\uFD1D", 41875 "\u062C\u0649", 41876 "\uFD1E", 41877 "\u062C\u064A", 41878 "\uFD1F", 41879 "\u062E\u0649", 41880 "\uFD20", 41881 "\u062E\u064A", 41882 "\uFD21", 41883 "\u0635\u0649", 41884 "\uFD22", 41885 "\u0635\u064A", 41886 "\uFD23", 41887 "\u0636\u0649", 41888 "\uFD24", 41889 "\u0636\u064A", 41890 "\uFD25", 41891 "\u0634\u062C", 41892 "\uFD26", 41893 "\u0634\u062D", 41894 "\uFD27", 41895 "\u0634\u062E", 41896 "\uFD28", 41897 "\u0634\u0645", 41898 "\uFD29", 41899 "\u0634\u0631", 41900 "\uFD2A", 41901 "\u0633\u0631", 41902 "\uFD2B", 41903 "\u0635\u0631", 41904 "\uFD2C", 41905 "\u0636\u0631", 41906 "\uFD2D", 41907 "\u0634\u062C", 41908 "\uFD2E", 41909 "\u0634\u062D", 41910 "\uFD2F", 41911 "\u0634\u062E", 41912 "\uFD30", 41913 "\u0634\u0645", 41914 "\uFD31", 41915 "\u0633\u0647", 41916 "\uFD32", 41917 "\u0634\u0647", 41918 "\uFD33", 41919 "\u0637\u0645", 41920 "\uFD34", 41921 "\u0633\u062C", 41922 "\uFD35", 41923 "\u0633\u062D", 41924 "\uFD36", 41925 "\u0633\u062E", 41926 "\uFD37", 41927 "\u0634\u062C", 41928 "\uFD38", 41929 "\u0634\u062D", 41930 "\uFD39", 41931 "\u0634\u062E", 41932 "\uFD3A", 41933 "\u0637\u0645", 41934 "\uFD3B", 41935 "\u0638\u0645", 41936 "\uFD3C", 41937 "\u0627\u064B", 41938 "\uFD3D", 41939 "\u0627\u064B", 41940 "\uFD50", 41941 "\u062A\u062C\u0645", 41942 "\uFD51", 41943 "\u062A\u062D\u062C", 41944 "\uFD52", 41945 "\u062A\u062D\u062C", 41946 "\uFD53", 41947 "\u062A\u062D\u0645", 41948 "\uFD54", 41949 "\u062A\u062E\u0645", 41950 "\uFD55", 41951 "\u062A\u0645\u062C", 41952 "\uFD56", 41953 "\u062A\u0645\u062D", 41954 "\uFD57", 41955 "\u062A\u0645\u062E", 41956 "\uFD58", 41957 "\u062C\u0645\u062D", 41958 "\uFD59", 41959 "\u062C\u0645\u062D", 41960 "\uFD5A", 41961 "\u062D\u0645\u064A", 41962 "\uFD5B", 41963 "\u062D\u0645\u0649", 41964 "\uFD5C", 41965 "\u0633\u062D\u062C", 41966 "\uFD5D", 41967 "\u0633\u062C\u062D", 41968 "\uFD5E", 41969 "\u0633\u062C\u0649", 41970 "\uFD5F", 41971 "\u0633\u0645\u062D", 41972 "\uFD60", 41973 "\u0633\u0645\u062D", 41974 "\uFD61", 41975 "\u0633\u0645\u062C", 41976 "\uFD62", 41977 "\u0633\u0645\u0645", 41978 "\uFD63", 41979 "\u0633\u0645\u0645", 41980 "\uFD64", 41981 "\u0635\u062D\u062D", 41982 "\uFD65", 41983 "\u0635\u062D\u062D", 41984 "\uFD66", 41985 "\u0635\u0645\u0645", 41986 "\uFD67", 41987 "\u0634\u062D\u0645", 41988 "\uFD68", 41989 "\u0634\u062D\u0645", 41990 "\uFD69", 41991 "\u0634\u062C\u064A", 41992 "\uFD6A", 41993 "\u0634\u0645\u062E", 41994 "\uFD6B", 41995 "\u0634\u0645\u062E", 41996 "\uFD6C", 41997 "\u0634\u0645\u0645", 41998 "\uFD6D", 41999 "\u0634\u0645\u0645", 42000 "\uFD6E", 42001 "\u0636\u062D\u0649", 42002 "\uFD6F", 42003 "\u0636\u062E\u0645", 42004 "\uFD70", 42005 "\u0636\u062E\u0645", 42006 "\uFD71", 42007 "\u0637\u0645\u062D", 42008 "\uFD72", 42009 "\u0637\u0645\u062D", 42010 "\uFD73", 42011 "\u0637\u0645\u0645", 42012 "\uFD74", 42013 "\u0637\u0645\u064A", 42014 "\uFD75", 42015 "\u0639\u062C\u0645", 42016 "\uFD76", 42017 "\u0639\u0645\u0645", 42018 "\uFD77", 42019 "\u0639\u0645\u0645", 42020 "\uFD78", 42021 "\u0639\u0645\u0649", 42022 "\uFD79", 42023 "\u063A\u0645\u0645", 42024 "\uFD7A", 42025 "\u063A\u0645\u064A", 42026 "\uFD7B", 42027 "\u063A\u0645\u0649", 42028 "\uFD7C", 42029 "\u0641\u062E\u0645", 42030 "\uFD7D", 42031 "\u0641\u062E\u0645", 42032 "\uFD7E", 42033 "\u0642\u0645\u062D", 42034 "\uFD7F", 42035 "\u0642\u0645\u0645", 42036 "\uFD80", 42037 "\u0644\u062D\u0645", 42038 "\uFD81", 42039 "\u0644\u062D\u064A", 42040 "\uFD82", 42041 "\u0644\u062D\u0649", 42042 "\uFD83", 42043 "\u0644\u062C\u062C", 42044 "\uFD84", 42045 "\u0644\u062C\u062C", 42046 "\uFD85", 42047 "\u0644\u062E\u0645", 42048 "\uFD86", 42049 "\u0644\u062E\u0645", 42050 "\uFD87", 42051 "\u0644\u0645\u062D", 42052 "\uFD88", 42053 "\u0644\u0645\u062D", 42054 "\uFD89", 42055 "\u0645\u062D\u062C", 42056 "\uFD8A", 42057 "\u0645\u062D\u0645", 42058 "\uFD8B", 42059 "\u0645\u062D\u064A", 42060 "\uFD8C", 42061 "\u0645\u062C\u062D", 42062 "\uFD8D", 42063 "\u0645\u062C\u0645", 42064 "\uFD8E", 42065 "\u0645\u062E\u062C", 42066 "\uFD8F", 42067 "\u0645\u062E\u0645", 42068 "\uFD92", 42069 "\u0645\u062C\u062E", 42070 "\uFD93", 42071 "\u0647\u0645\u062C", 42072 "\uFD94", 42073 "\u0647\u0645\u0645", 42074 "\uFD95", 42075 "\u0646\u062D\u0645", 42076 "\uFD96", 42077 "\u0646\u062D\u0649", 42078 "\uFD97", 42079 "\u0646\u062C\u0645", 42080 "\uFD98", 42081 "\u0646\u062C\u0645", 42082 "\uFD99", 42083 "\u0646\u062C\u0649", 42084 "\uFD9A", 42085 "\u0646\u0645\u064A", 42086 "\uFD9B", 42087 "\u0646\u0645\u0649", 42088 "\uFD9C", 42089 "\u064A\u0645\u0645", 42090 "\uFD9D", 42091 "\u064A\u0645\u0645", 42092 "\uFD9E", 42093 "\u0628\u062E\u064A", 42094 "\uFD9F", 42095 "\u062A\u062C\u064A", 42096 "\uFDA0", 42097 "\u062A\u062C\u0649", 42098 "\uFDA1", 42099 "\u062A\u062E\u064A", 42100 "\uFDA2", 42101 "\u062A\u062E\u0649", 42102 "\uFDA3", 42103 "\u062A\u0645\u064A", 42104 "\uFDA4", 42105 "\u062A\u0645\u0649", 42106 "\uFDA5", 42107 "\u062C\u0645\u064A", 42108 "\uFDA6", 42109 "\u062C\u062D\u0649", 42110 "\uFDA7", 42111 "\u062C\u0645\u0649", 42112 "\uFDA8", 42113 "\u0633\u062E\u0649", 42114 "\uFDA9", 42115 "\u0635\u062D\u064A", 42116 "\uFDAA", 42117 "\u0634\u062D\u064A", 42118 "\uFDAB", 42119 "\u0636\u062D\u064A", 42120 "\uFDAC", 42121 "\u0644\u062C\u064A", 42122 "\uFDAD", 42123 "\u0644\u0645\u064A", 42124 "\uFDAE", 42125 "\u064A\u062D\u064A", 42126 "\uFDAF", 42127 "\u064A\u062C\u064A", 42128 "\uFDB0", 42129 "\u064A\u0645\u064A", 42130 "\uFDB1", 42131 "\u0645\u0645\u064A", 42132 "\uFDB2", 42133 "\u0642\u0645\u064A", 42134 "\uFDB3", 42135 "\u0646\u062D\u064A", 42136 "\uFDB4", 42137 "\u0642\u0645\u062D", 42138 "\uFDB5", 42139 "\u0644\u062D\u0645", 42140 "\uFDB6", 42141 "\u0639\u0645\u064A", 42142 "\uFDB7", 42143 "\u0643\u0645\u064A", 42144 "\uFDB8", 42145 "\u0646\u062C\u062D", 42146 "\uFDB9", 42147 "\u0645\u062E\u064A", 42148 "\uFDBA", 42149 "\u0644\u062C\u0645", 42150 "\uFDBB", 42151 "\u0643\u0645\u0645", 42152 "\uFDBC", 42153 "\u0644\u062C\u0645", 42154 "\uFDBD", 42155 "\u0646\u062C\u062D", 42156 "\uFDBE", 42157 "\u062C\u062D\u064A", 42158 "\uFDBF", 42159 "\u062D\u062C\u064A", 42160 "\uFDC0", 42161 "\u0645\u062C\u064A", 42162 "\uFDC1", 42163 "\u0641\u0645\u064A", 42164 "\uFDC2", 42165 "\u0628\u062D\u064A", 42166 "\uFDC3", 42167 "\u0643\u0645\u0645", 42168 "\uFDC4", 42169 "\u0639\u062C\u0645", 42170 "\uFDC5", 42171 "\u0635\u0645\u0645", 42172 "\uFDC6", 42173 "\u0633\u062E\u064A", 42174 "\uFDC7", 42175 "\u0646\u062C\u064A", 42176 "\uFE49", 42177 "\u203E", 42178 "\uFE4A", 42179 "\u203E", 42180 "\uFE4B", 42181 "\u203E", 42182 "\uFE4C", 42183 "\u203E", 42184 "\uFE4D", 42185 "\u005F", 42186 "\uFE4E", 42187 "\u005F", 42188 "\uFE4F", 42189 "\u005F", 42190 "\uFE80", 42191 "\u0621", 42192 "\uFE81", 42193 "\u0622", 42194 "\uFE82", 42195 "\u0622", 42196 "\uFE83", 42197 "\u0623", 42198 "\uFE84", 42199 "\u0623", 42200 "\uFE85", 42201 "\u0624", 42202 "\uFE86", 42203 "\u0624", 42204 "\uFE87", 42205 "\u0625", 42206 "\uFE88", 42207 "\u0625", 42208 "\uFE89", 42209 "\u0626", 42210 "\uFE8A", 42211 "\u0626", 42212 "\uFE8B", 42213 "\u0626", 42214 "\uFE8C", 42215 "\u0626", 42216 "\uFE8D", 42217 "\u0627", 42218 "\uFE8E", 42219 "\u0627", 42220 "\uFE8F", 42221 "\u0628", 42222 "\uFE90", 42223 "\u0628", 42224 "\uFE91", 42225 "\u0628", 42226 "\uFE92", 42227 "\u0628", 42228 "\uFE93", 42229 "\u0629", 42230 "\uFE94", 42231 "\u0629", 42232 "\uFE95", 42233 "\u062A", 42234 "\uFE96", 42235 "\u062A", 42236 "\uFE97", 42237 "\u062A", 42238 "\uFE98", 42239 "\u062A", 42240 "\uFE99", 42241 "\u062B", 42242 "\uFE9A", 42243 "\u062B", 42244 "\uFE9B", 42245 "\u062B", 42246 "\uFE9C", 42247 "\u062B", 42248 "\uFE9D", 42249 "\u062C", 42250 "\uFE9E", 42251 "\u062C", 42252 "\uFE9F", 42253 "\u062C", 42254 "\uFEA0", 42255 "\u062C", 42256 "\uFEA1", 42257 "\u062D", 42258 "\uFEA2", 42259 "\u062D", 42260 "\uFEA3", 42261 "\u062D", 42262 "\uFEA4", 42263 "\u062D", 42264 "\uFEA5", 42265 "\u062E", 42266 "\uFEA6", 42267 "\u062E", 42268 "\uFEA7", 42269 "\u062E", 42270 "\uFEA8", 42271 "\u062E", 42272 "\uFEA9", 42273 "\u062F", 42274 "\uFEAA", 42275 "\u062F", 42276 "\uFEAB", 42277 "\u0630", 42278 "\uFEAC", 42279 "\u0630", 42280 "\uFEAD", 42281 "\u0631", 42282 "\uFEAE", 42283 "\u0631", 42284 "\uFEAF", 42285 "\u0632", 42286 "\uFEB0", 42287 "\u0632", 42288 "\uFEB1", 42289 "\u0633", 42290 "\uFEB2", 42291 "\u0633", 42292 "\uFEB3", 42293 "\u0633", 42294 "\uFEB4", 42295 "\u0633", 42296 "\uFEB5", 42297 "\u0634", 42298 "\uFEB6", 42299 "\u0634", 42300 "\uFEB7", 42301 "\u0634", 42302 "\uFEB8", 42303 "\u0634", 42304 "\uFEB9", 42305 "\u0635", 42306 "\uFEBA", 42307 "\u0635", 42308 "\uFEBB", 42309 "\u0635", 42310 "\uFEBC", 42311 "\u0635", 42312 "\uFEBD", 42313 "\u0636", 42314 "\uFEBE", 42315 "\u0636", 42316 "\uFEBF", 42317 "\u0636", 42318 "\uFEC0", 42319 "\u0636", 42320 "\uFEC1", 42321 "\u0637", 42322 "\uFEC2", 42323 "\u0637", 42324 "\uFEC3", 42325 "\u0637", 42326 "\uFEC4", 42327 "\u0637", 42328 "\uFEC5", 42329 "\u0638", 42330 "\uFEC6", 42331 "\u0638", 42332 "\uFEC7", 42333 "\u0638", 42334 "\uFEC8", 42335 "\u0638", 42336 "\uFEC9", 42337 "\u0639", 42338 "\uFECA", 42339 "\u0639", 42340 "\uFECB", 42341 "\u0639", 42342 "\uFECC", 42343 "\u0639", 42344 "\uFECD", 42345 "\u063A", 42346 "\uFECE", 42347 "\u063A", 42348 "\uFECF", 42349 "\u063A", 42350 "\uFED0", 42351 "\u063A", 42352 "\uFED1", 42353 "\u0641", 42354 "\uFED2", 42355 "\u0641", 42356 "\uFED3", 42357 "\u0641", 42358 "\uFED4", 42359 "\u0641", 42360 "\uFED5", 42361 "\u0642", 42362 "\uFED6", 42363 "\u0642", 42364 "\uFED7", 42365 "\u0642", 42366 "\uFED8", 42367 "\u0642", 42368 "\uFED9", 42369 "\u0643", 42370 "\uFEDA", 42371 "\u0643", 42372 "\uFEDB", 42373 "\u0643", 42374 "\uFEDC", 42375 "\u0643", 42376 "\uFEDD", 42377 "\u0644", 42378 "\uFEDE", 42379 "\u0644", 42380 "\uFEDF", 42381 "\u0644", 42382 "\uFEE0", 42383 "\u0644", 42384 "\uFEE1", 42385 "\u0645", 42386 "\uFEE2", 42387 "\u0645", 42388 "\uFEE3", 42389 "\u0645", 42390 "\uFEE4", 42391 "\u0645", 42392 "\uFEE5", 42393 "\u0646", 42394 "\uFEE6", 42395 "\u0646", 42396 "\uFEE7", 42397 "\u0646", 42398 "\uFEE8", 42399 "\u0646", 42400 "\uFEE9", 42401 "\u0647", 42402 "\uFEEA", 42403 "\u0647", 42404 "\uFEEB", 42405 "\u0647", 42406 "\uFEEC", 42407 "\u0647", 42408 "\uFEED", 42409 "\u0648", 42410 "\uFEEE", 42411 "\u0648", 42412 "\uFEEF", 42413 "\u0649", 42414 "\uFEF0", 42415 "\u0649", 42416 "\uFEF1", 42417 "\u064A", 42418 "\uFEF2", 42419 "\u064A", 42420 "\uFEF3", 42421 "\u064A", 42422 "\uFEF4", 42423 "\u064A", 42424 "\uFEF5", 42425 "\u0644\u0622", 42426 "\uFEF6", 42427 "\u0644\u0622", 42428 "\uFEF7", 42429 "\u0644\u0623", 42430 "\uFEF8", 42431 "\u0644\u0623", 42432 "\uFEF9", 42433 "\u0644\u0625", 42434 "\uFEFA", 42435 "\u0644\u0625", 42436 "\uFEFB", 42437 "\u0644\u0627", 42438 "\uFEFC", 42439 "\u0644\u0627" 42440 ]; 42441}); 42442function reverseIfRtl(chars) { 42443 const charsLength = chars.length; 42444 if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) { 42445 return chars; 42446 } 42447 const buf = []; 42448 for (let ii = charsLength - 1; ii >= 0; ii--) { 42449 buf.push(chars[ii]); 42450 } 42451 return buf.join(""); 42452} 42453const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u"); 42454const CategoryCache = new Map(); 42455function getCharUnicodeCategory(char) { 42456 const cachedCategory = CategoryCache.get(char); 42457 if (cachedCategory) { 42458 return cachedCategory; 42459 } 42460 const groups = char.match(SpecialCharRegExp); 42461 const category = { 42462 isWhitespace: !!(groups && groups[1]), 42463 isZeroWidthDiacritic: !!(groups && groups[2]), 42464 isInvisibleFormatMark: !!(groups && groups[3]) 42465 }; 42466 CategoryCache.set(char, category); 42467 return category; 42468} 42469function clearUnicodeCaches() { 42470 CategoryCache.clear(); 42471} 42472 42473 42474/***/ }), 42475/*
4247541 */ 42476/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 42477 42478 42479 42480Object.defineProperty(exports, "__esModule", ({ 42481 value: true 42482})); 42483exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0; 42484exports.getStandardFontName = getStandardFontName; 42485exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0; 42486 42487var _core_utils = __w_pdfjs_require__(6); 42488 42489var _fonts_utils = __w_pdfjs_require__(38);
vendor: 12,231 bytes, lines 42490-42942
42490 42491const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 42492 t["Times-Roman"] = "Times-Roman"; 42493 t.Helvetica = "Helvetica"; 42494 t.Courier = "Courier"; 42495 t.Symbol = "Symbol"; 42496 t["Times-Bold"] = "Times-Bold"; 42497 t["Helvetica-Bold"] = "Helvetica-Bold"; 42498 t["Courier-Bold"] = "Courier-Bold"; 42499 t.ZapfDingbats = "ZapfDingbats"; 42500 t["Times-Italic"] = "Times-Italic"; 42501 t["Helvetica-Oblique"] = "Helvetica-Oblique"; 42502 t["Courier-Oblique"] = "Courier-Oblique"; 42503 t["Times-BoldItalic"] = "Times-BoldItalic"; 42504 t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique"; 42505 t["Courier-BoldOblique"] = "Courier-BoldOblique"; 42506 t.ArialNarrow = "Helvetica"; 42507 t["ArialNarrow-Bold"] = "Helvetica-Bold"; 42508 t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique"; 42509 t["ArialNarrow-Italic"] = "Helvetica-Oblique"; 42510 t.ArialBlack = "Helvetica"; 42511 t["ArialBlack-Bold"] = "Helvetica-Bold"; 42512 t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique"; 42513 t["ArialBlack-Italic"] = "Helvetica-Oblique"; 42514 t["Arial-Black"] = "Helvetica"; 42515 t["Arial-Black-Bold"] = "Helvetica-Bold"; 42516 t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique"; 42517 t["Arial-Black-Italic"] = "Helvetica-Oblique"; 42518 t.Arial = "Helvetica"; 42519 t["Arial-Bold"] = "Helvetica-Bold"; 42520 t["Arial-BoldItalic"] = "Helvetica-BoldOblique"; 42521 t["Arial-Italic"] = "Helvetica-Oblique"; 42522 t.ArialMT = "Helvetica"; 42523 t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique"; 42524 t["Arial-BoldMT"] = "Helvetica-Bold"; 42525 t["Arial-ItalicMT"] = "Helvetica-Oblique"; 42526 t.ArialUnicodeMS = "Helvetica"; 42527 t["ArialUnicodeMS-Bold"] = "Helvetica-Bold"; 42528 t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique"; 42529 t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique"; 42530 t["Courier-BoldItalic"] = "Courier-BoldOblique"; 42531 t["Courier-Italic"] = "Courier-Oblique"; 42532 t.CourierNew = "Courier"; 42533 t["CourierNew-Bold"] = "Courier-Bold"; 42534 t["CourierNew-BoldItalic"] = "Courier-BoldOblique"; 42535 t["CourierNew-Italic"] = "Courier-Oblique"; 42536 t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique"; 42537 t["CourierNewPS-BoldMT"] = "Courier-Bold"; 42538 t["CourierNewPS-ItalicMT"] = "Courier-Oblique"; 42539 t.CourierNewPSMT = "Courier"; 42540 t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique"; 42541 t["Helvetica-Italic"] = "Helvetica-Oblique"; 42542 t["Symbol-Bold"] = "Symbol"; 42543 t["Symbol-BoldItalic"] = "Symbol"; 42544 t["Symbol-Italic"] = "Symbol"; 42545 t.TimesNewRoman = "Times-Roman"; 42546 t["TimesNewRoman-Bold"] = "Times-Bold"; 42547 t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic"; 42548 t["TimesNewRoman-Italic"] = "Times-Italic"; 42549 t.TimesNewRomanPS = "Times-Roman"; 42550 t["TimesNewRomanPS-Bold"] = "Times-Bold"; 42551 t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic"; 42552 t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic"; 42553 t["TimesNewRomanPS-BoldMT"] = "Times-Bold"; 42554 t["TimesNewRomanPS-Italic"] = "Times-Italic"; 42555 t["TimesNewRomanPS-ItalicMT"] = "Times-Italic"; 42556 t.TimesNewRomanPSMT = "Times-Roman"; 42557 t["TimesNewRomanPSMT-Bold"] = "Times-Bold"; 42558 t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic"; 42559 t["TimesNewRomanPSMT-Italic"] = "Times-Italic"; 42560}); 42561exports.getStdFontMap = getStdFontMap; 42562const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) { 42563 t.Courier = "FoxitFixed.pfb"; 42564 t["Courier-Bold"] = "FoxitFixedBold.pfb"; 42565 t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb"; 42566 t["Courier-Oblique"] = "FoxitFixedItalic.pfb"; 42567 t.Helvetica = "FoxitSans.pfb"; 42568 t["Helvetica-Bold"] = "FoxitSansBold.pfb"; 42569 t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb"; 42570 t["Helvetica-Oblique"] = "FoxitSansItalic.pfb"; 42571 t["Times-Roman"] = "FoxitSerif.pfb"; 42572 t["Times-Bold"] = "FoxitSerifBold.pfb"; 42573 t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb"; 42574 t["Times-Italic"] = "FoxitSerifItalic.pfb"; 42575 t.Symbol = "FoxitSymbol.pfb"; 42576 t.ZapfDingbats = "FoxitDingbats.pfb"; 42577 t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf"; 42578 t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf"; 42579 t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf"; 42580 t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf"; 42581}); 42582exports.getFontNameToFileMap = getFontNameToFileMap; 42583const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 42584 t.Calibri = "Helvetica"; 42585 t["Calibri-Bold"] = "Helvetica-Bold"; 42586 t["Calibri-BoldItalic"] = "Helvetica-BoldOblique"; 42587 t["Calibri-Italic"] = "Helvetica-Oblique"; 42588 t.CenturyGothic = "Helvetica"; 42589 t["CenturyGothic-Bold"] = "Helvetica-Bold"; 42590 t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique"; 42591 t["CenturyGothic-Italic"] = "Helvetica-Oblique"; 42592 t.ComicSansMS = "Comic Sans MS"; 42593 t["ComicSansMS-Bold"] = "Comic Sans MS-Bold"; 42594 t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic"; 42595 t["ComicSansMS-Italic"] = "Comic Sans MS-Italic"; 42596 t["ItcSymbol-Bold"] = "Helvetica-Bold"; 42597 t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique"; 42598 t["ItcSymbol-Book"] = "Helvetica"; 42599 t["ItcSymbol-BookItalic"] = "Helvetica-Oblique"; 42600 t["ItcSymbol-Medium"] = "Helvetica"; 42601 t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique"; 42602 t.LucidaConsole = "Courier"; 42603 t["LucidaConsole-Bold"] = "Courier-Bold"; 42604 t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique"; 42605 t["LucidaConsole-Italic"] = "Courier-Oblique"; 42606 t["LucidaSans-Demi"] = "Helvetica-Bold"; 42607 t["MS-Gothic"] = "MS Gothic"; 42608 t["MS-Gothic-Bold"] = "MS Gothic-Bold"; 42609 t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic"; 42610 t["MS-Gothic-Italic"] = "MS Gothic-Italic"; 42611 t["MS-Mincho"] = "MS Mincho"; 42612 t["MS-Mincho-Bold"] = "MS Mincho-Bold"; 42613 t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic"; 42614 t["MS-Mincho-Italic"] = "MS Mincho-Italic"; 42615 t["MS-PGothic"] = "MS PGothic"; 42616 t["MS-PGothic-Bold"] = "MS PGothic-Bold"; 42617 t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic"; 42618 t["MS-PGothic-Italic"] = "MS PGothic-Italic"; 42619 t["MS-PMincho"] = "MS PMincho"; 42620 t["MS-PMincho-Bold"] = "MS PMincho-Bold"; 42621 t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic"; 42622 t["MS-PMincho-Italic"] = "MS PMincho-Italic"; 42623 t.NuptialScript = "Times-Italic"; 42624 t.SegoeUISymbol = "Helvetica"; 42625 t.Wingdings = "ZapfDingbats"; 42626 t["Wingdings-Regular"] = "ZapfDingbats"; 42627}); 42628exports.getNonStdFontMap = getNonStdFontMap; 42629const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 42630 t["Adobe Jenson"] = true; 42631 t["Adobe Text"] = true; 42632 t.Albertus = true; 42633 t.Aldus = true; 42634 t.Alexandria = true; 42635 t.Algerian = true; 42636 t["American Typewriter"] = true; 42637 t.Antiqua = true; 42638 t.Apex = true; 42639 t.Arno = true; 42640 t.Aster = true; 42641 t.Aurora = true; 42642 t.Baskerville = true; 42643 t.Bell = true; 42644 t.Bembo = true; 42645 t["Bembo Schoolbook"] = true; 42646 t.Benguiat = true; 42647 t["Berkeley Old Style"] = true; 42648 t["Bernhard Modern"] = true; 42649 t["Berthold City"] = true; 42650 t.Bodoni = true; 42651 t["Bauer Bodoni"] = true; 42652 t["Book Antiqua"] = true; 42653 t.Bookman = true; 42654 t["Bordeaux Roman"] = true; 42655 t["Californian FB"] = true; 42656 t.Calisto = true; 42657 t.Calvert = true; 42658 t.Capitals = true; 42659 t.Cambria = true; 42660 t.Cartier = true; 42661 t.Caslon = true; 42662 t.Catull = true; 42663 t.Centaur = true; 42664 t["Century Old Style"] = true; 42665 t["Century Schoolbook"] = true; 42666 t.Chaparral = true; 42667 t["Charis SIL"] = true; 42668 t.Cheltenham = true; 42669 t["Cholla Slab"] = true; 42670 t.Clarendon = true; 42671 t.Clearface = true; 42672 t.Cochin = true; 42673 t.Colonna = true; 42674 t["Computer Modern"] = true; 42675 t["Concrete Roman"] = true; 42676 t.Constantia = true; 42677 t["Cooper Black"] = true; 42678 t.Corona = true; 42679 t.Ecotype = true; 42680 t.Egyptienne = true; 42681 t.Elephant = true; 42682 t.Excelsior = true; 42683 t.Fairfield = true; 42684 t["FF Scala"] = true; 42685 t.Folkard = true; 42686 t.Footlight = true; 42687 t.FreeSerif = true; 42688 t["Friz Quadrata"] = true; 42689 t.Garamond = true; 42690 t.Gentium = true; 42691 t.Georgia = true; 42692 t.Gloucester = true; 42693 t["Goudy Old Style"] = true; 42694 t["Goudy Schoolbook"] = true; 42695 t["Goudy Pro Font"] = true; 42696 t.Granjon = true; 42697 t["Guardian Egyptian"] = true; 42698 t.Heather = true; 42699 t.Hercules = true; 42700 t["High Tower Text"] = true; 42701 t.Hiroshige = true; 42702 t["Hoefler Text"] = true; 42703 t["Humana Serif"] = true; 42704 t.Imprint = true; 42705 t["Ionic No. 5"] = true; 42706 t.Janson = true; 42707 t.Joanna = true; 42708 t.Korinna = true; 42709 t.Lexicon = true; 42710 t.LiberationSerif = true; 42711 t["Liberation Serif"] = true; 42712 t["Linux Libertine"] = true; 42713 t.Literaturnaya = true; 42714 t.Lucida = true; 42715 t["Lucida Bright"] = true; 42716 t.Melior = true; 42717 t.Memphis = true; 42718 t.Miller = true; 42719 t.Minion = true; 42720 t.Modern = true; 42721 t["Mona Lisa"] = true; 42722 t["Mrs Eaves"] = true; 42723 t["MS Serif"] = true; 42724 t["Museo Slab"] = true; 42725 t["New York"] = true; 42726 t["Nimbus Roman"] = true; 42727 t["NPS Rawlinson Roadway"] = true; 42728 t.NuptialScript = true; 42729 t.Palatino = true; 42730 t.Perpetua = true; 42731 t.Plantin = true; 42732 t["Plantin Schoolbook"] = true; 42733 t.Playbill = true; 42734 t["Poor Richard"] = true; 42735 t["Rawlinson Roadway"] = true; 42736 t.Renault = true; 42737 t.Requiem = true; 42738 t.Rockwell = true; 42739 t.Roman = true; 42740 t["Rotis Serif"] = true; 42741 t.Sabon = true; 42742 t.Scala = true; 42743 t.Seagull = true; 42744 t.Sistina = true; 42745 t.Souvenir = true; 42746 t.STIX = true; 42747 t["Stone Informal"] = true; 42748 t["Stone Serif"] = true; 42749 t.Sylfaen = true; 42750 t.Times = true; 42751 t.Trajan = true; 42752 t["Trinité"] = true; 42753 t["Trump Mediaeval"] = true; 42754 t.Utopia = true; 42755 t["Vale Type"] = true; 42756 t["Bitstream Vera"] = true; 42757 t["Vera Serif"] = true; 42758 t.Versailles = true; 42759 t.Wanted = true; 42760 t.Weiss = true; 42761 t["Wide Latin"] = true; 42762 t.Windsor = true; 42763 t.XITS = true; 42764}); 42765exports.getSerifFonts = getSerifFonts; 42766const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 42767 t.Dingbats = true; 42768 t.Symbol = true; 42769 t.ZapfDingbats = true; 42770}); 42771exports.getSymbolsFonts = getSymbolsFonts; 42772const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 42773 t[2] = 10; 42774 t[3] = 32; 42775 t[4] = 33; 42776 t[5] = 34; 42777 t[6] = 35; 42778 t[7] = 36; 42779 t[8] = 37; 42780 t[9] = 38; 42781 t[10] = 39; 42782 t[11] = 40; 42783 t[12] = 41; 42784 t[13] = 42; 42785 t[14] = 43; 42786 t[15] = 44; 42787 t[16] = 45; 42788 t[17] = 46; 42789 t[18] = 47; 42790 t[19] = 48; 42791 t[20] = 49; 42792 t[21] = 50; 42793 t[22] = 51; 42794 t[23] = 52; 42795 t[24] = 53; 42796 t[25] = 54; 42797 t[26] = 55; 42798 t[27] = 56; 42799 t[28] = 57; 42800 t[29] = 58; 42801 t[30] = 894; 42802 t[31] = 60; 42803 t[32] = 61; 42804 t[33] = 62; 42805 t[34] = 63; 42806 t[35] = 64; 42807 t[36] = 65; 42808 t[37] = 66; 42809 t[38] = 67; 42810 t[39] = 68; 42811 t[40] = 69; 42812 t[41] = 70; 42813 t[42] = 71; 42814 t[43] = 72; 42815 t[44] = 73; 42816 t[45] = 74; 42817 t[46] = 75; 42818 t[47] = 76; 42819 t[48] = 77; 42820 t[49] = 78; 42821 t[50] = 79; 42822 t[51] = 80; 42823 t[52] = 81; 42824 t[53] = 82; 42825 t[54] = 83; 42826 t[55] = 84; 42827 t[56] = 85; 42828 t[57] = 86; 42829 t[58] = 87; 42830 t[59] = 88; 42831 t[60] = 89; 42832 t[61] = 90; 42833 t[62] = 91; 42834 t[63] = 92; 42835 t[64] = 93; 42836 t[65] = 94; 42837 t[66] = 95; 42838 t[67] = 96; 42839 t[68] = 97; 42840 t[69] = 98; 42841 t[70] = 99; 42842 t[71] = 100; 42843 t[72] = 101; 42844 t[73] = 102; 42845 t[74] = 103; 42846 t[75] = 104; 42847 t[76] = 105; 42848 t[77] = 106; 42849 t[78] = 107; 42850 t[79] = 108; 42851 t[80] = 109; 42852 t[81] = 110; 42853 t[82] = 111; 42854 t[83] = 112; 42855 t[84] = 113; 42856 t[85] = 114; 42857 t[86] = 115; 42858 t[87] = 116; 42859 t[88] = 117; 42860 t[89] = 118; 42861 t[90] = 119; 42862 t[91] = 120; 42863 t[92] = 121; 42864 t[93] = 122; 42865 t[94] = 123; 42866 t[95] = 124; 42867 t[96] = 125; 42868 t[97] = 126; 42869 t[98] = 196; 42870 t[99] = 197; 42871 t[100] = 199; 42872 t[101] = 201; 42873 t[102] = 209; 42874 t[103] = 214; 42875 t[104] = 220; 42876 t[105] = 225; 42877 t[106] = 224; 42878 t[107] = 226; 42879 t[108] = 228; 42880 t[109] = 227; 42881 t[110] = 229; 42882 t[111] = 231; 42883 t[112] = 233; 42884 t[113] = 232; 42885 t[114] = 234; 42886 t[115] = 235; 42887 t[116] = 237; 42888 t[117] = 236; 42889 t[118] = 238; 42890 t[119] = 239; 42891 t[120] = 241; 42892 t[121] = 243; 42893 t[122] = 242; 42894 t[123] = 244; 42895 t[124] = 246; 42896 t[125] = 245; 42897 t[126] = 250; 42898 t[127] = 249; 42899 t[128] = 251; 42900 t[129] = 252; 42901 t[130] = 8224; 42902 t[131] = 176; 42903 t[132] = 162; 42904 t[133] = 163; 42905 t[134] = 167; 42906 t[135] = 8226; 42907 t[136] = 182; 42908 t[137] = 223; 42909 t[138] = 174; 42910 t[139] = 169; 42911 t[140] = 8482; 42912 t[141] = 180; 42913 t[142] = 168; 42914 t[143] = 8800; 42915 t[144] = 198; 42916 t[145] = 216; 42917 t[146] = 8734; 42918 t[147] = 177; 42919 t[148] = 8804; 42920 t[149] = 8805; 42921 t[150] = 165; 42922 t[151] = 181; 42923 t[152] = 8706; 42924 t[153] = 8721; 42925 t[154] = 8719; 42926 t[156] = 8747; 42927 t[157] = 170; 42928 t[158] = 186; 42929 t[159] = 8486; 42930 t[160] = 230; 42931 t[161] = 248; 42932 t[162] = 191; 42933 t[163] = 161; 42934 t[164] = 172; 42935 t[165] = 8730; 42936 t[166] = 402; 42937 t[167] = 8776; 42938 t[168] = 8710; 42939 t[169] = 171; 42940 t[170] = 187; 42941 t[171] = 8230; 42942 t[
42942200] = 193; 42943 t[203] = 205; 42944 t[210] = 218; 42945 t[223] = 711; 42946 t[224] = 321; 42947 t[225] = 322; 42948 t[226] = 352; 42949 t[227] = 353; 42950 t[228] = 381; 42951 t[229] = 382; 42952 t[233] = 221; 42953 t[234] = 253; 42954 t[252] = 263; 42955 t[253] = 268; 42956 t[254] = 269; 42957 t[258] = 258; 42958 t[260] = 260; 42959 t[261] = 261; 42960 t[265] = 280; 42961 t[266] = 281; 42962 t[267] = 282; 42963 t[268] = 283; 42964 t[269] = 313; 42965 t[275] = 323; 42966 t[276] = 324; 42967 t[278] = 328; 42968 t[283] = 344; 42969 t[284] = 345; 42970 t[285] = 346; 42971 t[286] = 347; 42972 t[292] = 367; 42973 t[295] = 377; 42974 t[296] = 378; 42975 t[298] = 380; 42976 t[305] = 963; 42977 t[306] = 964; 42978 t[307] = 966; 42979 t[308] = 8215; 42980 t[309] = 8252; 42981 t[310] = 8319; 42982 t[311] = 8359; 42983 t[312] = 8592; 42984 t[313] = 8593; 42985 t[337] = 9552; 42986 t[493] = 1039; 42987 t[494] = 1040; 42988 t[672] = 1488; 42989 t[673] = 1489; 42990 t[674] = 1490; 42991 t[675] = 1491; 42992 t[676] = 1492; 42993 t[677] = 1493; 42994 t[678] = 1494; 42995 t[679] = 1495; 42996 t[680] = 1496; 42997 t[681] = 1497; 42998 t[682] = 1498; 42999 t[683] = 1499; 43000 t[684] = 1500; 43001 t[685] = 1501; 43002 t[686] = 1502; 43003 t[687] = 1503; 43004 t[688] = 1504; 43005 t[689] = 1505; 43006 t[690] = 1506; 43007 t[691] = 1507; 43008 t[692] = 1508; 43009 t[693] = 1509; 43010 t[694] = 1510; 43011 t[695] = 1511; 43012 t[696] = 1512; 43013 t[697] = 1513; 43014 t[698] = 1514; 43015 t[705] = 1524; 43016 t[706] = 8362; 43017 t[710] = 64288; 43018 t[711] = 64298; 43019 t[759] = 1617; 43020 t[761] = 1776; 43021 t[763] = 1778; 43022 t[775] = 1652; 43023 t[777] = 1764; 43024 t[778] = 1780; 43025 t[779] = 1781; 43026 t[780] = 1782; 43027 t[782] = 771; 43028 t[783] = 64726; 43029 t[786] = 8363; 43030 t[788] = 8532; 43031 t[790] = 768; 43032 t[791] = 769; 43033 t[792] = 768; 43034 t[795] = 803; 43035 t[797] = 64336; 43036 t[798] = 64337; 43037 t[799] = 64342; 43038 t[800] = 64343; 43039 t[801] = 64344; 43040 t[802] = 64345; 43041 t[803] = 64362; 43042 t[804] = 64363; 43043 t[805] = 64364; 43044 t[2424] = 7821; 43045 t[2425] = 7822; 43046 t[2426] = 7823; 43047 t[2427] = 7824; 43048 t[2428] = 7825; 43049 t[2429] = 7826; 43050 t[2430] = 7827; 43051 t[2433] = 7682; 43052 t[2678] = 8045; 43053 t[2679] = 8046; 43054 t[2830] = 1552; 43055 t[2838] = 686; 43056 t[2840] = 751; 43057 t[2842] = 753; 43058 t[2843] = 754; 43059 t[2844] = 755; 43060 t[2846] = 757; 43061 t[2856] = 767; 43062 t[2857] = 848; 43063 t[2858] = 849; 43064 t[2862] = 853; 43065 t[2863] = 854; 43066 t[2864] = 855; 43067 t[2865] = 861; 43068 t[2866] = 862; 43069 t[2906] = 7460; 43070 t[2908] = 7462; 43071 t[2909] = 7463; 43072 t[2910] = 7464; 43073 t[2912] = 7466; 43074 t[2913] = 7467; 43075 t[2914] = 7468; 43076 t[2916] = 7470; 43077 t[2917] = 7471; 43078 t[2918] = 7472; 43079 t[2920] = 7474; 43080 t[2921] = 7475; 43081 t[2922] = 7476; 43082 t[2924] = 7478; 43083 t[2925] = 7479; 43084 t[2926] = 7480; 43085 t[2928] = 7482; 43086 t[2929] = 7483; 43087 t[2930] = 7484; 43088 t[2932] = 7486; 43089 t[2933] = 7487; 43090 t[2934] = 7488; 43091 t[2936] = 7490; 43092 t[2937] = 7491; 43093 t[2938] = 7492; 43094 t[2940] = 7494; 43095 t[2941] = 7495; 43096 t[2942] = 7496; 43097 t[2944] = 7498; 43098 t[2946] = 7500; 43099 t[2948] = 7502; 43100 t[2950] = 7504; 43101 t[2951] = 7505; 43102 t[2952] = 7506; 43103 t[2954] = 7508; 43104 t[2955] = 7509; 43105 t[2956] = 7510; 43106 t[2958] = 7512; 43107 t[2959] = 7513; 43108 t[2960] = 7514; 43109 t[2962] = 7516; 43110 t[2963] = 7517; 43111 t[2964] = 7518; 43112 t[2966] = 7520; 43113 t[2967] = 7521; 43114 t[2968] = 7522; 43115 t[2970] = 7524; 43116 t[2971] = 7525; 43117 t[2972] = 7526; 43118 t[2974] = 7528; 43119 t[2975] = 7529; 43120 t[2976] = 7530; 43121 t[2978] = 1537; 43122 t[2979] = 1538; 43123 t[2980] = 1539; 43124 t[2982] = 1549; 43125 t[2983] = 1551; 43126 t[2984] = 1552; 43127 t[2986] = 1554; 43128 t[2987] = 1555; 43129 t[2988] = 1556; 43130 t[2990] = 1623; 43131 t[2991] = 1624; 43132 t[2995] = 1775; 43133 t[2999] = 1791; 43134 t[3002] = 64290; 43135 t[3003] = 64291; 43136 t[3004] = 64292; 43137 t[3006] = 64294; 43138 t[3007] = 64295; 43139 t[3008] = 64296; 43140 t[3011] = 1900; 43141 t[3014] = 8223; 43142 t[3015] = 8244; 43143 t[3017] = 7532; 43144 t[3018] = 7533; 43145 t[3019] = 7534; 43146 t[3075] = 7590; 43147 t[3076] = 7591; 43148 t[3079] = 7594; 43149 t[3080] = 7595; 43150 t[3083] = 7598; 43151 t[3084] = 7599; 43152 t[3087] = 7602; 43153 t[3088] = 7603; 43154 t[3091] = 7606; 43155 t[3092] = 7607; 43156 t[3095] = 7610; 43157 t[3096] = 7611; 43158 t[3099] = 7614; 43159 t[3100] = 7615; 43160 t[3103] = 7618; 43161 t[3104] = 7619; 43162 t[3107] = 8337; 43163 t[3108] = 8338; 43164 t[3116] = 1884; 43165 t[3119] = 1885; 43166 t[3120] = 1885; 43167 t[3123] = 1886; 43168 t[3124] = 1886; 43169 t[3127] = 1887; 43170 t[3128] = 1887; 43171 t[3131] = 1888; 43172 t[3132] = 1888; 43173 t[3135] = 1889; 43174 t[3136] = 1889; 43175 t[3139] = 1890; 43176 t[3140] = 1890; 43177 t[3143] = 1891; 43178 t[3144] = 1891; 43179 t[3147] = 1892; 43180 t[3148] = 1892; 43181 t[3153] = 580; 43182 t[3154] = 581; 43183 t[3157] = 584; 43184 t[3158] = 585; 43185 t[3161] = 588; 43186 t[3162] = 589; 43187 t[3165] = 891; 43188 t[3166] = 892; 43189 t[3169] = 1274; 43190 t[3170] = 1275; 43191 t[3173] = 1278; 43192 t[3174] = 1279; 43193 t[3181] = 7622; 43194 t[3182] = 7623; 43195 t[3282] = 11799; 43196 t[3316] = 578; 43197 t[3379] = 42785; 43198 t[3393] = 1159; 43199 t[3416] = 8377; 43200}); 43201exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts; 43202const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) { 43203 t[227] = 322; 43204 t[264] = 261; 43205 t[291] = 346; 43206}); 43207exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack; 43208const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) { 43209 t[1] = 32; 43210 t[4] = 65; 43211 t[6] = 193; 43212 t[17] = 66; 43213 t[18] = 67; 43214 t[21] = 268; 43215 t[24] = 68; 43216 t[28] = 69; 43217 t[30] = 201; 43218 t[32] = 282; 43219 t[38] = 70; 43220 t[39] = 71; 43221 t[44] = 72; 43222 t[47] = 73; 43223 t[49] = 205; 43224 t[58] = 74; 43225 t[60] = 75; 43226 t[62] = 76; 43227 t[68] = 77; 43228 t[69] = 78; 43229 t[75] = 79; 43230 t[87] = 80; 43231 t[89] = 81; 43232 t[90] = 82; 43233 t[92] = 344; 43234 t[94] = 83; 43235 t[97] = 352; 43236 t[100] = 84; 43237 t[104] = 85; 43238 t[115] = 86; 43239 t[116] = 87; 43240 t[121] = 88; 43241 t[122] = 89; 43242 t[124] = 221; 43243 t[127] = 90; 43244 t[129] = 381; 43245 t[258] = 97; 43246 t[260] = 225; 43247 t[268] = 261; 43248 t[271] = 98; 43249 t[272] = 99; 43250 t[273] = 263; 43251 t[275] = 269; 43252 t[282] = 100; 43253 t[286] = 101;
vendor: 30,227 bytes, lines 43254-44549
43254 t[288] = 233; 43255 t[290] = 283; 43256 t[295] = 281; 43257 t[296] = 102; 43258 t[336] = 103; 43259 t[346] = 104; 43260 t[349] = 105; 43261 t[351] = 237; 43262 t[361] = 106; 43263 t[364] = 107; 43264 t[367] = 108; 43265 t[371] = 322; 43266 t[373] = 109; 43267 t[374] = 110; 43268 t[381] = 111; 43269 t[383] = 243; 43270 t[393] = 112; 43271 t[395] = 113; 43272 t[396] = 114; 43273 t[398] = 345; 43274 t[400] = 115; 43275 t[401] = 347; 43276 t[403] = 353; 43277 t[410] = 116; 43278 t[437] = 117; 43279 t[448] = 118; 43280 t[449] = 119; 43281 t[454] = 120; 43282 t[455] = 121; 43283 t[457] = 253; 43284 t[460] = 122; 43285 t[462] = 382; 43286 t[463] = 380; 43287 t[853] = 44; 43288 t[855] = 58; 43289 t[856] = 46; 43290 t[876] = 47; 43291 t[878] = 45; 43292 t[882] = 45; 43293 t[894] = 40; 43294 t[895] = 41; 43295 t[896] = 91; 43296 t[897] = 93; 43297 t[923] = 64; 43298 t[1004] = 48; 43299 t[1005] = 49; 43300 t[1006] = 50; 43301 t[1007] = 51; 43302 t[1008] = 52; 43303 t[1009] = 53; 43304 t[1010] = 54; 43305 t[1011] = 55; 43306 t[1012] = 56; 43307 t[1013] = 57; 43308 t[1081] = 37; 43309 t[1085] = 43; 43310 t[1086] = 45; 43311}); 43312exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri; 43313 43314function getStandardFontName(name) { 43315 const fontName = (0, _fonts_utils.normalizeFontName)(name); 43316 const stdFontMap = getStdFontMap(); 43317 return stdFontMap[fontName]; 43318} 43319 43320/***/ }), 43321/* 42 */ 43322/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 43323 43324 43325 43326Object.defineProperty(exports, "__esModule", ({ 43327 value: true 43328})); 43329exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0; 43330 43331var _util = __w_pdfjs_require__(2); 43332 43333class ToUnicodeMap { 43334 constructor(cmap = []) { 43335 this._map = cmap; 43336 } 43337 43338 get length() { 43339 return this._map.length; 43340 } 43341 43342 forEach(callback) { 43343 for (const charCode in this._map) { 43344 callback(charCode, this._map[charCode].charCodeAt(0)); 43345 } 43346 } 43347 43348 has(i) { 43349 return this._map[i] !== undefined; 43350 } 43351 43352 get(i) { 43353 return this._map[i]; 43354 } 43355 43356 charCodeOf(value) { 43357 const map = this._map; 43358 43359 if (map.length <= 0x10000) { 43360 return map.indexOf(value); 43361 } 43362 43363 for (const charCode in map) { 43364 if (map[charCode] === value) { 43365 return charCode | 0; 43366 } 43367 } 43368 43369 return -1; 43370 } 43371 43372 amend(map) { 43373 for (const charCode in map) { 43374 this._map[charCode] = map[charCode]; 43375 } 43376 } 43377 43378} 43379 43380exports.ToUnicodeMap = ToUnicodeMap; 43381 43382class IdentityToUnicodeMap { 43383 constructor(firstChar, lastChar) { 43384 this.firstChar = firstChar; 43385 this.lastChar = lastChar; 43386 } 43387 43388 get length() { 43389 return this.lastChar + 1 - this.firstChar; 43390 } 43391 43392 forEach(callback) { 43393 for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) { 43394 callback(i, i); 43395 } 43396 } 43397 43398 has(i) { 43399 return this.firstChar <= i && i <= this.lastChar; 43400 } 43401 43402 get(i) { 43403 if (this.firstChar <= i && i <= this.lastChar) { 43404 return String.fromCharCode(i); 43405 } 43406 43407 return undefined; 43408 } 43409 43410 charCodeOf(v) { 43411 return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1; 43412 } 43413 43414 amend(map) { 43415 (0, _util.unreachable)("Should not call amend()"); 43416 } 43417 43418} 43419 43420exports.IdentityToUnicodeMap = IdentityToUnicodeMap; 43421 43422/***/ }), 43423/* 43 */ 43424/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 43425 43426 43427 43428Object.defineProperty(exports, "__esModule", ({ 43429 value: true 43430})); 43431exports.CFFFont = void 0; 43432 43433var _cff_parser = __w_pdfjs_require__(35); 43434 43435var _fonts_utils = __w_pdfjs_require__(38); 43436 43437var _util = __w_pdfjs_require__(2); 43438 43439class CFFFont { 43440 constructor(file, properties) { 43441 this.properties = properties; 43442 const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED); 43443 this.cff = parser.parse(); 43444 this.cff.duplicateFirstGlyph(); 43445 const compiler = new _cff_parser.CFFCompiler(this.cff); 43446 this.seacs = this.cff.seacs; 43447 43448 try { 43449 this.data = compiler.compile(); 43450 } catch (e) { 43451 (0, _util.warn)("Failed to compile font " + properties.loadedName); 43452 this.data = file; 43453 } 43454 43455 this._createBuiltInEncoding(); 43456 } 43457 43458 get numGlyphs() { 43459 return this.cff.charStrings.count; 43460 } 43461 43462 getCharset() { 43463 return this.cff.charset.charset; 43464 } 43465 43466 getGlyphMapping() { 43467 const cff = this.cff; 43468 const properties = this.properties; 43469 const charsets = cff.charset.charset; 43470 let charCodeToGlyphId; 43471 let glyphId; 43472 43473 if (properties.composite) { 43474 charCodeToGlyphId = Object.create(null); 43475 let charCode; 43476 43477 if (cff.isCIDFont) { 43478 for (glyphId = 0; glyphId < charsets.length; glyphId++) { 43479 const cid = charsets[glyphId]; 43480 charCode = properties.cMap.charCodeOf(cid); 43481 charCodeToGlyphId[charCode] = glyphId; 43482 } 43483 } else { 43484 for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) { 43485 charCode = properties.cMap.charCodeOf(glyphId); 43486 charCodeToGlyphId[charCode] = glyphId; 43487 } 43488 } 43489 43490 return charCodeToGlyphId; 43491 } 43492 43493 let encoding = cff.encoding ? cff.encoding.encoding : null; 43494 43495 if (properties.isInternalFont) { 43496 encoding = properties.defaultEncoding; 43497 } 43498 43499 charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets); 43500 return charCodeToGlyphId; 43501 } 43502 43503 hasGlyphId(id) { 43504 return this.cff.hasGlyphId(id); 43505 } 43506 43507 _createBuiltInEncoding() { 43508 const { 43509 charset, 43510 encoding 43511 } = this.cff; 43512 43513 if (!charset || !encoding) { 43514 return; 43515 } 43516 43517 const charsets = charset.charset, 43518 encodings = encoding.encoding; 43519 const map = []; 43520 43521 for (const charCode in encodings) { 43522 const glyphId = encodings[charCode]; 43523 43524 if (glyphId >= 0) { 43525 const glyphName = charsets[glyphId]; 43526 43527 if (glyphName) { 43528 map[charCode] = glyphName; 43529 } 43530 } 43531 } 43532 43533 if (map.length > 0) { 43534 this.properties.builtInEncoding = map; 43535 } 43536 } 43537 43538} 43539 43540exports.CFFFont = CFFFont; 43541 43542/***/ }), 43543/* 44 */ 43544/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 43545 43546 43547 43548Object.defineProperty(exports, "__esModule", ({ 43549 value: true 43550})); 43551exports.FontRendererFactory = void 0; 43552 43553var _util = __w_pdfjs_require__(2); 43554 43555var _cff_parser = __w_pdfjs_require__(35); 43556 43557var _glyphlist = __w_pdfjs_require__(39); 43558 43559var _encodings = __w_pdfjs_require__(37); 43560 43561var _stream = __w_pdfjs_require__(10); 43562 43563function getUint32(data, offset) { 43564 return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; 43565} 43566 43567function getUint16(data, offset) { 43568 return data[offset] << 8 | data[offset + 1]; 43569} 43570 43571function getInt16(data, offset) { 43572 return (data[offset] << 24 | data[offset + 1] << 16) >> 16; 43573} 43574 43575function getInt8(data, offset) { 43576 return data[offset] << 24 >> 24; 43577} 43578 43579function getFloat214(data, offset) { 43580 return getInt16(data, offset) / 16384; 43581} 43582 43583function getSubroutineBias(subrs) { 43584 const numSubrs = subrs.length; 43585 let bias = 32768; 43586 43587 if (numSubrs < 1240) { 43588 bias = 107; 43589 } else if (numSubrs < 33900) { 43590 bias = 1131; 43591 } 43592 43593 return bias; 43594} 43595 43596function parseCmap(data, start, end) { 43597 const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16); 43598 const format = getUint16(data, start + offset); 43599 let ranges, p, i; 43600 43601 if (format === 4) { 43602 getUint16(data, start + offset + 2); 43603 const segCount = getUint16(data, start + offset + 6) >> 1; 43604 p = start + offset + 14; 43605 ranges = []; 43606 43607 for (i = 0; i < segCount; i++, p += 2) { 43608 ranges[i] = { 43609 end: getUint16(data, p) 43610 }; 43611 } 43612 43613 p += 2; 43614 43615 for (i = 0; i < segCount; i++, p += 2) { 43616 ranges[i].start = getUint16(data, p); 43617 } 43618 43619 for (i = 0; i < segCount; i++, p += 2) { 43620 ranges[i].idDelta = getUint16(data, p); 43621 } 43622 43623 for (i = 0; i < segCount; i++, p += 2) { 43624 let idOffset = getUint16(data, p); 43625 43626 if (idOffset === 0) { 43627 continue; 43628 } 43629 43630 ranges[i].ids = []; 43631 43632 for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) { 43633 ranges[i].ids[j] = getUint16(data, p + idOffset); 43634 idOffset += 2; 43635 } 43636 } 43637 43638 return ranges; 43639 } else if (format === 12) { 43640 const groups = getUint32(data, start + offset + 12); 43641 p = start + offset + 16; 43642 ranges = []; 43643 43644 for (i = 0; i < groups; i++) { 43645 start = getUint32(data, p); 43646 ranges.push({ 43647 start, 43648 end: getUint32(data, p + 4), 43649 idDelta: getUint32(data, p + 8) - start 43650 }); 43651 p += 12; 43652 } 43653 43654 return ranges; 43655 } 43656 43657 throw new _util.FormatError(`unsupported cmap: ${format}`); 43658} 43659 43660function parseCff(data, start, end, seacAnalysisEnabled) { 43661 const properties = {}; 43662 const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled); 43663 const cff = parser.parse(); 43664 return { 43665 glyphs: cff.charStrings.objects, 43666 subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects, 43667 gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects, 43668 isCFFCIDFont: cff.isCIDFont, 43669 fdSelect: cff.fdSelect, 43670 fdArray: cff.fdArray 43671 }; 43672} 43673 43674function parseGlyfTable(glyf, loca, isGlyphLocationsLong) { 43675 let itemSize, itemDecode; 43676 43677 if (isGlyphLocationsLong) { 43678 itemSize = 4; 43679 itemDecode = getUint32; 43680 } else { 43681 itemSize = 2; 43682 43683 itemDecode = (data, offset) => 2 * getUint16(data, offset); 43684 } 43685 43686 const glyphs = []; 43687 let startOffset = itemDecode(loca, 0); 43688 43689 for (let j = itemSize; j < loca.length; j += itemSize) { 43690 const endOffset = itemDecode(loca, j); 43691 glyphs.push(glyf.subarray(startOffset, endOffset)); 43692 startOffset = endOffset; 43693 } 43694 43695 return glyphs; 43696} 43697 43698function lookupCmap(ranges, unicode) { 43699 const code = unicode.codePointAt(0); 43700 let gid = 0, 43701 l = 0, 43702 r = ranges.length - 1; 43703 43704 while (l < r) { 43705 const c = l + r + 1 >> 1; 43706 43707 if (code < ranges[c].start) { 43708 r = c - 1; 43709 } else { 43710 l = c; 43711 } 43712 } 43713 43714 if (ranges[l].start <= code && code <= ranges[l].end) { 43715 gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff; 43716 } 43717 43718 return { 43719 charCode: code, 43720 glyphId: gid 43721 }; 43722} 43723 43724function compileGlyf(code, cmds, font) { 43725 function moveTo(x, y) { 43726 cmds.push({ 43727 cmd: "moveTo", 43728 args: [x, y] 43729 }); 43730 } 43731 43732 function lineTo(x, y) { 43733 cmds.push({ 43734 cmd: "lineTo", 43735 args: [x, y] 43736 }); 43737 } 43738 43739 function quadraticCurveTo(xa, ya, x, y) { 43740 cmds.push({ 43741 cmd: "quadraticCurveTo", 43742 args: [xa, ya, x, y] 43743 }); 43744 } 43745 43746 let i = 0; 43747 const numberOfContours = getInt16(code, i); 43748 let flags; 43749 let x = 0, 43750 y = 0; 43751 i += 10; 43752 43753 if (numberOfContours < 0) { 43754 do { 43755 flags = getUint16(code, i); 43756 const glyphIndex = getUint16(code, i + 2); 43757 i += 4; 43758 let arg1, arg2; 43759 43760 if (flags & 0x01) { 43761 if (flags & 0x02) { 43762 arg1 = getInt16(code, i); 43763 arg2 = getInt16(code, i + 2); 43764 } else { 43765 arg1 = getUint16(code, i); 43766 arg2 = getUint16(code, i + 2); 43767 } 43768 43769 i += 4; 43770 } else { 43771 if (flags & 0x02) { 43772 arg1 = getInt8(code, i++); 43773 arg2 = getInt8(code, i++); 43774 } else { 43775 arg1 = code[i++]; 43776 arg2 = code[i++]; 43777 } 43778 } 43779 43780 if (flags & 0x02) { 43781 x = arg1; 43782 y = arg2; 43783 } else { 43784 x = 0; 43785 y = 0; 43786 } 43787 43788 let scaleX = 1, 43789 scaleY = 1, 43790 scale01 = 0, 43791 scale10 = 0; 43792 43793 if (flags & 0x08) { 43794 scaleX = scaleY = getFloat214(code, i); 43795 i += 2; 43796 } else if (flags & 0x40) { 43797 scaleX = getFloat214(code, i); 43798 scaleY = getFloat214(code, i + 2); 43799 i += 4; 43800 } else if (flags & 0x80) { 43801 scaleX = getFloat214(code, i); 43802 scale01 = getFloat214(code, i + 2); 43803 scale10 = getFloat214(code, i + 4); 43804 scaleY = getFloat214(code, i + 6); 43805 i += 8; 43806 } 43807 43808 const subglyph = font.glyphs[glyphIndex]; 43809 43810 if (subglyph) { 43811 cmds.push({ 43812 cmd: "save" 43813 }, { 43814 cmd: "transform", 43815 args: [scaleX, scale01, scale10, scaleY, x, y] 43816 }); 43817 43818 if (!(flags & 0x02)) {} 43819 43820 compileGlyf(subglyph, cmds, font); 43821 cmds.push({ 43822 cmd: "restore" 43823 }); 43824 } 43825 } while (flags & 0x20); 43826 } else { 43827 const endPtsOfContours = []; 43828 let j, jj; 43829 43830 for (j = 0; j < numberOfContours; j++) { 43831 endPtsOfContours.push(getUint16(code, i)); 43832 i += 2; 43833 } 43834 43835 const instructionLength = getUint16(code, i); 43836 i += 2 + instructionLength; 43837 const numberOfPoints = endPtsOfContours.at(-1) + 1; 43838 const points = []; 43839 43840 while (points.length < numberOfPoints) { 43841 flags = code[i++]; 43842 let repeat = 1; 43843 43844 if (flags & 0x08) { 43845 repeat += code[i++]; 43846 } 43847 43848 while (repeat-- > 0) { 43849 points.push({ 43850 flags 43851 }); 43852 } 43853 } 43854 43855 for (j = 0; j < numberOfPoints; j++) { 43856 switch (points[j].flags & 0x12) { 43857 case 0x00: 43858 x += getInt16(code, i); 43859 i += 2; 43860 break; 43861 43862 case 0x02: 43863 x -= code[i++]; 43864 break; 43865 43866 case 0x12: 43867 x += code[i++]; 43868 break; 43869 } 43870 43871 points[j].x = x; 43872 } 43873 43874 for (j = 0; j < numberOfPoints; j++) { 43875 switch (points[j].flags & 0x24) { 43876 case 0x00: 43877 y += getInt16(code, i); 43878 i += 2; 43879 break; 43880 43881 case 0x04: 43882 y -= code[i++]; 43883 break; 43884 43885 case 0x24: 43886 y += code[i++]; 43887 break; 43888 } 43889 43890 points[j].y = y; 43891 } 43892 43893 let startPoint = 0; 43894 43895 for (i = 0; i < numberOfContours; i++) { 43896 const endPoint = endPtsOfContours[i]; 43897 const contour = points.slice(startPoint, endPoint + 1); 43898 43899 if (contour[0].flags & 1) { 43900 contour.push(contour[0]); 43901 } else if (contour.at(-1).flags & 1) { 43902 contour.unshift(contour.at(-1)); 43903 } else { 43904 const p = { 43905 flags: 1, 43906 x: (contour[0].x + contour.at(-1).x) / 2, 43907 y: (contour[0].y + contour.at(-1).y) / 2 43908 }; 43909 contour.unshift(p); 43910 contour.push(p); 43911 } 43912 43913 moveTo(contour[0].x, contour[0].y); 43914 43915 for (j = 1, jj = contour.length; j < jj; j++) { 43916 if (contour[j].flags & 1) { 43917 lineTo(contour[j].x, contour[j].y); 43918 } else if (contour[j + 1].flags & 1) { 43919 quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y); 43920 j++; 43921 } else { 43922 quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2); 43923 } 43924 } 43925 43926 startPoint = endPoint + 1; 43927 } 43928 } 43929} 43930 43931function compileCharString(charStringCode, cmds, font, glyphId) { 43932 function moveTo(x, y) { 43933 cmds.push({ 43934 cmd: "moveTo", 43935 args: [x, y] 43936 }); 43937 } 43938 43939 function lineTo(x, y) { 43940 cmds.push({ 43941 cmd: "lineTo", 43942 args: [x, y] 43943 }); 43944 } 43945 43946 function bezierCurveTo(x1, y1, x2, y2, x, y) { 43947 cmds.push({ 43948 cmd: "bezierCurveTo", 43949 args: [x1, y1, x2, y2, x, y] 43950 }); 43951 } 43952 43953 const stack = []; 43954 let x = 0, 43955 y = 0; 43956 let stems = 0; 43957 43958 function parse(code) { 43959 let i = 0; 43960 43961 while (i < code.length) { 43962 let stackClean = false; 43963 let v = code[i++]; 43964 let xa, xb, ya, yb, y1, y2, y3, n, subrCode; 43965 43966 switch (v) { 43967 case 1: 43968 stems += stack.length >> 1; 43969 stackClean = true; 43970 break; 43971 43972 case 3: 43973 stems += stack.length >> 1; 43974 stackClean = true; 43975 break; 43976 43977 case 4: 43978 y += stack.pop(); 43979 moveTo(x, y); 43980 stackClean = true; 43981 break; 43982 43983 case 5: 43984 while (stack.length > 0) { 43985 x += stack.shift(); 43986 y += stack.shift(); 43987 lineTo(x, y); 43988 } 43989 43990 break; 43991 43992 case 6: 43993 while (stack.length > 0) { 43994 x += stack.shift(); 43995 lineTo(x, y); 43996 43997 if (stack.length === 0) { 43998 break; 43999 } 44000 44001 y += stack.shift(); 44002 lineTo(x, y); 44003 } 44004 44005 break; 44006 44007 case 7: 44008 while (stack.length > 0) { 44009 y += stack.shift(); 44010 lineTo(x, y); 44011 44012 if (stack.length === 0) { 44013 break; 44014 } 44015 44016 x += stack.shift(); 44017 lineTo(x, y); 44018 } 44019 44020 break; 44021 44022 case 8: 44023 while (stack.length > 0) { 44024 xa = x + stack.shift(); 44025 ya = y + stack.shift(); 44026 xb = xa + stack.shift(); 44027 yb = ya + stack.shift(); 44028 x = xb + stack.shift(); 44029 y = yb + stack.shift(); 44030 bezierCurveTo(xa, ya, xb, yb, x, y); 44031 } 44032 44033 break; 44034 44035 case 10: 44036 n = stack.pop(); 44037 subrCode = null; 44038 44039 if (font.isCFFCIDFont) { 44040 const fdIndex = font.fdSelect.getFDIndex(glyphId); 44041 44042 if (fdIndex >= 0 && fdIndex < font.fdArray.length) { 44043 const fontDict = font.fdArray[fdIndex]; 44044 let subrs; 44045 44046 if (fontDict.privateDict && fontDict.privateDict.subrsIndex) { 44047 subrs = fontDict.privateDict.subrsIndex.objects; 44048 } 44049 44050 if (subrs) { 44051 n += getSubroutineBias(subrs); 44052 subrCode = subrs[n]; 44053 } 44054 } else { 44055 (0, _util.warn)("Invalid fd index for glyph index."); 44056 } 44057 } else { 44058 subrCode = font.subrs[n + font.subrsBias]; 44059 } 44060 44061 if (subrCode) { 44062 parse(subrCode); 44063 } 44064 44065 break; 44066 44067 case 11: 44068 return; 44069 44070 case 12: 44071 v = code[i++]; 44072 44073 switch (v) { 44074 case 34: 44075 xa = x + stack.shift(); 44076 xb = xa + stack.shift(); 44077 y1 = y + stack.shift(); 44078 x = xb + stack.shift(); 44079 bezierCurveTo(xa, y, xb, y1, x, y1); 44080 xa = x + stack.shift(); 44081 xb = xa + stack.shift(); 44082 x = xb + stack.shift(); 44083 bezierCurveTo(xa, y1, xb, y, x, y); 44084 break; 44085 44086 case 35: 44087 xa = x + stack.shift(); 44088 ya = y + stack.shift(); 44089 xb = xa + stack.shift(); 44090 yb = ya + stack.shift(); 44091 x = xb + stack.shift(); 44092 y = yb + stack.shift(); 44093 bezierCurveTo(xa, ya, xb, yb, x, y); 44094 xa = x + stack.shift(); 44095 ya = y + stack.shift(); 44096 xb = xa + stack.shift(); 44097 yb = ya + stack.shift(); 44098 x = xb + stack.shift(); 44099 y = yb + stack.shift(); 44100 bezierCurveTo(xa, ya, xb, yb, x, y); 44101 stack.pop(); 44102 break; 44103 44104 case 36: 44105 xa = x + stack.shift(); 44106 y1 = y + stack.shift(); 44107 xb = xa + stack.shift(); 44108 y2 = y1 + stack.shift(); 44109 x = xb + stack.shift(); 44110 bezierCurveTo(xa, y1, xb, y2, x, y2); 44111 xa = x + stack.shift(); 44112 xb = xa + stack.shift(); 44113 y3 = y2 + stack.shift(); 44114 x = xb + stack.shift(); 44115 bezierCurveTo(xa, y2, xb, y3, x, y); 44116 break; 44117 44118 case 37: 44119 const x0 = x, 44120 y0 = y; 44121 xa = x + stack.shift(); 44122 ya = y + stack.shift(); 44123 xb = xa + stack.shift(); 44124 yb = ya + stack.shift(); 44125 x = xb + stack.shift(); 44126 y = yb + stack.shift(); 44127 bezierCurveTo(xa, ya, xb, yb, x, y); 44128 xa = x + stack.shift(); 44129 ya = y + stack.shift(); 44130 xb = xa + stack.shift(); 44131 yb = ya + stack.shift(); 44132 x = xb; 44133 y = yb; 44134 44135 if (Math.abs(x - x0) > Math.abs(y - y0)) { 44136 x += stack.shift(); 44137 } else { 44138 y += stack.shift(); 44139 } 44140 44141 bezierCurveTo(xa, ya, xb, yb, x, y); 44142 break; 44143 44144 default: 44145 throw new _util.FormatError(`unknown operator: 12 ${v}`); 44146 } 44147 44148 break; 44149 44150 case 14: 44151 if (stack.length >= 4) { 44152 const achar = stack.pop(); 44153 const bchar = stack.pop(); 44154 y = stack.pop(); 44155 x = stack.pop(); 44156 cmds.push({ 44157 cmd: "save" 44158 }, { 44159 cmd: "translate", 44160 args: [x, y] 44161 }); 44162 let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]])); 44163 compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); 44164 cmds.push({ 44165 cmd: "restore" 44166 }); 44167 cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]])); 44168 compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); 44169 } 44170 44171 return; 44172 44173 case 18: 44174 stems += stack.length >> 1; 44175 stackClean = true; 44176 break; 44177 44178 case 19: 44179 stems += stack.length >> 1; 44180 i += stems + 7 >> 3; 44181 stackClean = true; 44182 break; 44183 44184 case 20: 44185 stems += stack.length >> 1; 44186 i += stems + 7 >> 3; 44187 stackClean = true; 44188 break; 44189 44190 case 21: 44191 y += stack.pop(); 44192 x += stack.pop(); 44193 moveTo(x, y); 44194 stackClean = true; 44195 break; 44196 44197 case 22: 44198 x += stack.pop(); 44199 moveTo(x, y); 44200 stackClean = true; 44201 break; 44202 44203 case 23: 44204 stems += stack.length >> 1; 44205 stackClean = true; 44206 break; 44207 44208 case 24: 44209 while (stack.length > 2) { 44210 xa = x + stack.shift(); 44211 ya = y + stack.shift(); 44212 xb = xa + stack.shift(); 44213 yb = ya + stack.shift(); 44214 x = xb + stack.shift(); 44215 y = yb + stack.shift(); 44216 bezierCurveTo(xa, ya, xb, yb, x, y); 44217 } 44218 44219 x += stack.shift(); 44220 y += stack.shift(); 44221 lineTo(x, y); 44222 break; 44223 44224 case 25: 44225 while (stack.length > 6) { 44226 x += stack.shift(); 44227 y += stack.shift(); 44228 lineTo(x, y); 44229 } 44230 44231 xa = x + stack.shift(); 44232 ya = y + stack.shift(); 44233 xb = xa + stack.shift(); 44234 yb = ya + stack.shift(); 44235 x = xb + stack.shift(); 44236 y = yb + stack.shift(); 44237 bezierCurveTo(xa, ya, xb, yb, x, y); 44238 break; 44239 44240 case 26: 44241 if (stack.length % 2) { 44242 x += stack.shift(); 44243 } 44244 44245 while (stack.length > 0) { 44246 xa = x; 44247 ya = y + stack.shift(); 44248 xb = xa + stack.shift(); 44249 yb = ya + stack.shift(); 44250 x = xb; 44251 y = yb + stack.shift(); 44252 bezierCurveTo(xa, ya, xb, yb, x, y); 44253 } 44254 44255 break; 44256 44257 case 27: 44258 if (stack.length % 2) { 44259 y += stack.shift(); 44260 } 44261 44262 while (stack.length > 0) { 44263 xa = x + stack.shift(); 44264 ya = y; 44265 xb = xa + stack.shift(); 44266 yb = ya + stack.shift(); 44267 x = xb + stack.shift(); 44268 y = yb; 44269 bezierCurveTo(xa, ya, xb, yb, x, y); 44270 } 44271 44272 break; 44273 44274 case 28: 44275 stack.push((code[i] << 24 | code[i + 1] << 16) >> 16); 44276 i += 2; 44277 break; 44278 44279 case 29: 44280 n = stack.pop() + font.gsubrsBias; 44281 subrCode = font.gsubrs[n]; 44282 44283 if (subrCode) { 44284 parse(subrCode); 44285 } 44286 44287 break; 44288 44289 case 30: 44290 while (stack.length > 0) { 44291 xa = x; 44292 ya = y + stack.shift(); 44293 xb = xa + stack.shift(); 44294 yb = ya + stack.shift(); 44295 x = xb + stack.shift(); 44296 y = yb + (stack.length === 1 ? stack.shift() : 0); 44297 bezierCurveTo(xa, ya, xb, yb, x, y); 44298 44299 if (stack.length === 0) { 44300 break; 44301 } 44302 44303 xa = x + stack.shift(); 44304 ya = y; 44305 xb = xa + stack.shift(); 44306 yb = ya + stack.shift(); 44307 y = yb + stack.shift(); 44308 x = xb + (stack.length === 1 ? stack.shift() : 0); 44309 bezierCurveTo(xa, ya, xb, yb, x, y); 44310 } 44311 44312 break; 44313 44314 case 31: 44315 while (stack.length > 0) { 44316 xa = x + stack.shift(); 44317 ya = y; 44318 xb = xa + stack.shift(); 44319 yb = ya + stack.shift(); 44320 y = yb + stack.shift(); 44321 x = xb + (stack.length === 1 ? stack.shift() : 0); 44322 bezierCurveTo(xa, ya, xb, yb, x, y); 44323 44324 if (stack.length === 0) { 44325 break; 44326 } 44327 44328 xa = x; 44329 ya = y + stack.shift(); 44330 xb = xa + stack.shift(); 44331 yb = ya + stack.shift(); 44332 x = xb + stack.shift(); 44333 y = yb + (stack.length === 1 ? stack.shift() : 0); 44334 bezierCurveTo(xa, ya, xb, yb, x, y); 44335 } 44336 44337 break; 44338 44339 default: 44340 if (v < 32) { 44341 throw new _util.FormatError(`unknown operator: ${v}`); 44342 } 44343 44344 if (v < 247) { 44345 stack.push(v - 139); 44346 } else if (v < 251) { 44347 stack.push((v - 247) * 256 + code[i++] + 108); 44348 } else if (v < 255) { 44349 stack.push(-(v - 251) * 256 - code[i++] - 108); 44350 } else { 44351 stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536); 44352 i += 4; 44353 } 44354 44355 break; 44356 } 44357 44358 if (stackClean) { 44359 stack.length = 0; 44360 } 44361 } 44362 } 44363 44364 parse(charStringCode); 44365} 44366 44367const NOOP = []; 44368 44369class CompiledFont { 44370 constructor(fontMatrix) { 44371 if (this.constructor === CompiledFont) { 44372 (0, _util.unreachable)("Cannot initialize CompiledFont."); 44373 } 44374 44375 this.fontMatrix = fontMatrix; 44376 this.compiledGlyphs = Object.create(null); 44377 this.compiledCharCodeToGlyphId = Object.create(null); 44378 } 44379 44380 getPathJs(unicode) { 44381 const { 44382 charCode, 44383 glyphId 44384 } = lookupCmap(this.cmap, unicode); 44385 let fn = this.compiledGlyphs[glyphId]; 44386 44387 if (!fn) { 44388 try { 44389 fn = this.compileGlyph(this.glyphs[glyphId], glyphId); 44390 this.compiledGlyphs[glyphId] = fn; 44391 } catch (ex) { 44392 this.compiledGlyphs[glyphId] = NOOP; 44393 44394 if (this.compiledCharCodeToGlyphId[charCode] === undefined) { 44395 this.compiledCharCodeToGlyphId[charCode] = glyphId; 44396 } 44397 44398 throw ex; 44399 } 44400 } 44401 44402 if (this.compiledCharCodeToGlyphId[charCode] === undefined) { 44403 this.compiledCharCodeToGlyphId[charCode] = glyphId; 44404 } 44405 44406 return fn; 44407 } 44408 44409 compileGlyph(code, glyphId) { 44410 if (!code || code.length === 0 || code[0] === 14) { 44411 return NOOP; 44412 } 44413 44414 let fontMatrix = this.fontMatrix; 44415 44416 if (this.isCFFCIDFont) { 44417 const fdIndex = this.fdSelect.getFDIndex(glyphId); 44418 44419 if (fdIndex >= 0 && fdIndex < this.fdArray.length) { 44420 const fontDict = this.fdArray[fdIndex]; 44421 fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX; 44422 } else { 44423 (0, _util.warn)("Invalid fd index for glyph index."); 44424 } 44425 } 44426 44427 const cmds = [{ 44428 cmd: "save" 44429 }, { 44430 cmd: "transform", 44431 args: fontMatrix.slice() 44432 }, { 44433 cmd: "scale", 44434 args: ["size", "-size"] 44435 }]; 44436 this.compileGlyphImpl(code, cmds, glyphId); 44437 cmds.push({ 44438 cmd: "restore" 44439 }); 44440 return cmds; 44441 } 44442 44443 compileGlyphImpl() { 44444 (0, _util.unreachable)("Children classes should implement this."); 44445 } 44446 44447 hasBuiltPath(unicode) { 44448 const { 44449 charCode, 44450 glyphId 44451 } = lookupCmap(this.cmap, unicode); 44452 return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined; 44453 } 44454 44455} 44456 44457class TrueTypeCompiled extends CompiledFont { 44458 constructor(glyphs, cmap, fontMatrix) { 44459 super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]); 44460 this.glyphs = glyphs; 44461 this.cmap = cmap; 44462 } 44463 44464 compileGlyphImpl(code, cmds) { 44465 compileGlyf(code, cmds, this); 44466 } 44467 44468} 44469 44470class Type2Compiled extends CompiledFont { 44471 constructor(cffInfo, cmap, fontMatrix, glyphNameMap) { 44472 super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]); 44473 this.glyphs = cffInfo.glyphs; 44474 this.gsubrs = cffInfo.gsubrs || []; 44475 this.subrs = cffInfo.subrs || []; 44476 this.cmap = cmap; 44477 this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)(); 44478 this.gsubrsBias = getSubroutineBias(this.gsubrs); 44479 this.subrsBias = getSubroutineBias(this.subrs); 44480 this.isCFFCIDFont = cffInfo.isCFFCIDFont; 44481 this.fdSelect = cffInfo.fdSelect; 44482 this.fdArray = cffInfo.fdArray; 44483 } 44484 44485 compileGlyphImpl(code, cmds, glyphId) { 44486 compileCharString(code, cmds, this, glyphId); 44487 } 44488 44489} 44490 44491class FontRendererFactory { 44492 static create(font, seacAnalysisEnabled) { 44493 const data = new Uint8Array(font.data); 44494 let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm; 44495 const numTables = getUint16(data, 4); 44496 44497 for (let i = 0, p = 12; i < numTables; i++, p += 16) { 44498 const tag = (0, _util.bytesToString)(data.subarray(p, p + 4)); 44499 const offset = getUint32(data, p + 8); 44500 const length = getUint32(data, p + 12); 44501 44502 switch (tag) { 44503 case "cmap": 44504 cmap = parseCmap(data, offset, offset + length); 44505 break; 44506 44507 case "glyf": 44508 glyf = data.subarray(offset, offset + length); 44509 break; 44510 44511 case "loca": 44512 loca = data.subarray(offset, offset + length); 44513 break; 44514 44515 case "head": 44516 unitsPerEm = getUint16(data, offset + 18); 44517 indexToLocFormat = getUint16(data, offset + 50); 44518 break; 44519 44520 case "CFF ": 44521 cff = parseCff(data, offset, offset + length, seacAnalysisEnabled); 44522 break; 44523 } 44524 } 44525 44526 if (glyf) { 44527 const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0]; 44528 return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix); 44529 } 44530 44531 return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap); 44532 } 44533 44534} 44535 44536exports.FontRendererFactory = FontRendererFactory; 44537 44538/***/ }), 44539/* 45 */ 44540/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 44541 44542 44543 44544Object.defineProperty(exports, "__esModule", ({ 44545 value: true 44546})); 44547exports.getMetrics = exports.getFontBasicMetrics = void 0; 44548 44549var _core_utils = __w_pdfjs_require__(6);
vendor: 51,189 bytes, lines 44550-47012
44550 44551const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) { 44552 t.Courier = 600; 44553 t["Courier-Bold"] = 600; 44554 t["Courier-BoldOblique"] = 600; 44555 t["Courier-Oblique"] = 600; 44556 t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) { 44557 t.space = 278; 44558 t.exclam = 278; 44559 t.quotedbl = 355; 44560 t.numbersign = 556; 44561 t.dollar = 556; 44562 t.percent = 889; 44563 t.ampersand = 667; 44564 t.quoteright = 222; 44565 t.parenleft = 333; 44566 t.parenright = 333; 44567 t.asterisk = 389; 44568 t.plus = 584; 44569 t.comma = 278; 44570 t.hyphen = 333; 44571 t.period = 278; 44572 t.slash = 278; 44573 t.zero = 556; 44574 t.one = 556; 44575 t.two = 556; 44576 t.three = 556; 44577 t.four = 556; 44578 t.five = 556; 44579 t.six = 556; 44580 t.seven = 556; 44581 t.eight = 556; 44582 t.nine = 556; 44583 t.colon = 278; 44584 t.semicolon = 278; 44585 t.less = 584; 44586 t.equal = 584; 44587 t.greater = 584; 44588 t.question = 556; 44589 t.at = 1015; 44590 t.A = 667; 44591 t.B = 667; 44592 t.C = 722; 44593 t.D = 722; 44594 t.E = 667; 44595 t.F = 611; 44596 t.G = 778; 44597 t.H = 722; 44598 t.I = 278; 44599 t.J = 500; 44600 t.K = 667; 44601 t.L = 556; 44602 t.M = 833; 44603 t.N = 722; 44604 t.O = 778; 44605 t.P = 667; 44606 t.Q = 778; 44607 t.R = 722; 44608 t.S = 667; 44609 t.T = 611; 44610 t.U = 722; 44611 t.V = 667; 44612 t.W = 944; 44613 t.X = 667; 44614 t.Y = 667; 44615 t.Z = 611; 44616 t.bracketleft = 278; 44617 t.backslash = 278; 44618 t.bracketright = 278; 44619 t.asciicircum = 469; 44620 t.underscore = 556; 44621 t.quoteleft = 222; 44622 t.a = 556; 44623 t.b = 556; 44624 t.c = 500; 44625 t.d = 556; 44626 t.e = 556; 44627 t.f = 278; 44628 t.g = 556; 44629 t.h = 556; 44630 t.i = 222; 44631 t.j = 222; 44632 t.k = 500; 44633 t.l = 222; 44634 t.m = 833; 44635 t.n = 556; 44636 t.o = 556; 44637 t.p = 556; 44638 t.q = 556; 44639 t.r = 333; 44640 t.s = 500; 44641 t.t = 278; 44642 t.u = 556; 44643 t.v = 500; 44644 t.w = 722; 44645 t.x = 500; 44646 t.y = 500; 44647 t.z = 500; 44648 t.braceleft = 334; 44649 t.bar = 260; 44650 t.braceright = 334; 44651 t.asciitilde = 584; 44652 t.exclamdown = 333; 44653 t.cent = 556; 44654 t.sterling = 556; 44655 t.fraction = 167; 44656 t.yen = 556; 44657 t.florin = 556; 44658 t.section = 556; 44659 t.currency = 556; 44660 t.quotesingle = 191; 44661 t.quotedblleft = 333; 44662 t.guillemotleft = 556; 44663 t.guilsinglleft = 333; 44664 t.guilsinglright = 333; 44665 t.fi = 500; 44666 t.fl = 500; 44667 t.endash = 556; 44668 t.dagger = 556; 44669 t.daggerdbl = 556; 44670 t.periodcentered = 278; 44671 t.paragraph = 537; 44672 t.bullet = 350; 44673 t.quotesinglbase = 222; 44674 t.quotedblbase = 333; 44675 t.quotedblright = 333; 44676 t.guillemotright = 556; 44677 t.ellipsis = 1000; 44678 t.perthousand = 1000; 44679 t.questiondown = 611; 44680 t.grave = 333; 44681 t.acute = 333; 44682 t.circumflex = 333; 44683 t.tilde = 333; 44684 t.macron = 333; 44685 t.breve = 333; 44686 t.dotaccent = 333; 44687 t.dieresis = 333; 44688 t.ring = 333; 44689 t.cedilla = 333; 44690 t.hungarumlaut = 333; 44691 t.ogonek = 333; 44692 t.caron = 333; 44693 t.emdash = 1000; 44694 t.AE = 1000; 44695 t.ordfeminine = 370; 44696 t.Lslash = 556; 44697 t.Oslash = 778; 44698 t.OE = 1000; 44699 t.ordmasculine = 365; 44700 t.ae = 889; 44701 t.dotlessi = 278; 44702 t.lslash = 222; 44703 t.oslash = 611; 44704 t.oe = 944; 44705 t.germandbls = 611; 44706 t.Idieresis = 278; 44707 t.eacute = 556; 44708 t.abreve = 556; 44709 t.uhungarumlaut = 556; 44710 t.ecaron = 556; 44711 t.Ydieresis = 667; 44712 t.divide = 584; 44713 t.Yacute = 667; 44714 t.Acircumflex = 667; 44715 t.aacute = 556; 44716 t.Ucircumflex = 722; 44717 t.yacute = 500; 44718 t.scommaaccent = 500; 44719 t.ecircumflex = 556; 44720 t.Uring = 722; 44721 t.Udieresis = 722; 44722 t.aogonek = 556; 44723 t.Uacute = 722; 44724 t.uogonek = 556; 44725 t.Edieresis = 667; 44726 t.Dcroat = 722; 44727 t.commaaccent = 250; 44728 t.copyright = 737; 44729 t.Emacron = 667; 44730 t.ccaron = 500; 44731 t.aring = 556; 44732 t.Ncommaaccent = 722; 44733 t.lacute = 222; 44734 t.agrave = 556; 44735 t.Tcommaaccent = 611; 44736 t.Cacute = 722; 44737 t.atilde = 556; 44738 t.Edotaccent = 667; 44739 t.scaron = 500; 44740 t.scedilla = 500; 44741 t.iacute = 278; 44742 t.lozenge = 471; 44743 t.Rcaron = 722; 44744 t.Gcommaaccent = 778; 44745 t.ucircumflex = 556; 44746 t.acircumflex = 556; 44747 t.Amacron = 667; 44748 t.rcaron = 333; 44749 t.ccedilla = 500; 44750 t.Zdotaccent = 611; 44751 t.Thorn = 667; 44752 t.Omacron = 778; 44753 t.Racute = 722; 44754 t.Sacute = 667; 44755 t.dcaron = 643; 44756 t.Umacron = 722; 44757 t.uring = 556; 44758 t.threesuperior = 333; 44759 t.Ograve = 778; 44760 t.Agrave = 667; 44761 t.Abreve = 667; 44762 t.multiply = 584; 44763 t.uacute = 556; 44764 t.Tcaron = 611; 44765 t.partialdiff = 476; 44766 t.ydieresis = 500; 44767 t.Nacute = 722; 44768 t.icircumflex = 278; 44769 t.Ecircumflex = 667; 44770 t.adieresis = 556; 44771 t.edieresis = 556; 44772 t.cacute = 500; 44773 t.nacute = 556; 44774 t.umacron = 556; 44775 t.Ncaron = 722; 44776 t.Iacute = 278; 44777 t.plusminus = 584; 44778 t.brokenbar = 260; 44779 t.registered = 737; 44780 t.Gbreve = 778; 44781 t.Idotaccent = 278; 44782 t.summation = 600; 44783 t.Egrave = 667; 44784 t.racute = 333; 44785 t.omacron = 556; 44786 t.Zacute = 611; 44787 t.Zcaron = 611; 44788 t.greaterequal = 549; 44789 t.Eth = 722; 44790 t.Ccedilla = 722; 44791 t.lcommaaccent = 222; 44792 t.tcaron = 317; 44793 t.eogonek = 556; 44794 t.Uogonek = 722; 44795 t.Aacute = 667; 44796 t.Adieresis = 667; 44797 t.egrave = 556; 44798 t.zacute = 500; 44799 t.iogonek = 222; 44800 t.Oacute = 778; 44801 t.oacute = 556; 44802 t.amacron = 556; 44803 t.sacute = 500; 44804 t.idieresis = 278; 44805 t.Ocircumflex = 778; 44806 t.Ugrave = 722; 44807 t.Delta = 612; 44808 t.thorn = 556; 44809 t.twosuperior = 333; 44810 t.Odieresis = 778; 44811 t.mu = 556; 44812 t.igrave = 278; 44813 t.ohungarumlaut = 556; 44814 t.Eogonek = 667; 44815 t.dcroat = 556; 44816 t.threequarters = 834; 44817 t.Scedilla = 667; 44818 t.lcaron = 299; 44819 t.Kcommaaccent = 667; 44820 t.Lacute = 556; 44821 t.trademark = 1000; 44822 t.edotaccent = 556; 44823 t.Igrave = 278; 44824 t.Imacron = 278; 44825 t.Lcaron = 556; 44826 t.onehalf = 834; 44827 t.lessequal = 549; 44828 t.ocircumflex = 556; 44829 t.ntilde = 556; 44830 t.Uhungarumlaut = 722; 44831 t.Eacute = 667; 44832 t.emacron = 556; 44833 t.gbreve = 556; 44834 t.onequarter = 834; 44835 t.Scaron = 667; 44836 t.Scommaaccent = 667; 44837 t.Ohungarumlaut = 778; 44838 t.degree = 400; 44839 t.ograve = 556; 44840 t.Ccaron = 722; 44841 t.ugrave = 556; 44842 t.radical = 453; 44843 t.Dcaron = 722; 44844 t.rcommaaccent = 333; 44845 t.Ntilde = 722; 44846 t.otilde = 556; 44847 t.Rcommaaccent = 722; 44848 t.Lcommaaccent = 556; 44849 t.Atilde = 667; 44850 t.Aogonek = 667; 44851 t.Aring = 667; 44852 t.Otilde = 778; 44853 t.zdotaccent = 500; 44854 t.Ecaron = 667; 44855 t.Iogonek = 278; 44856 t.kcommaaccent = 500; 44857 t.minus = 584; 44858 t.Icircumflex = 278; 44859 t.ncaron = 556; 44860 t.tcommaaccent = 278; 44861 t.logicalnot = 584; 44862 t.odieresis = 556; 44863 t.udieresis = 556; 44864 t.notequal = 549; 44865 t.gcommaaccent = 556; 44866 t.eth = 556; 44867 t.zcaron = 500; 44868 t.ncommaaccent = 556; 44869 t.onesuperior = 333; 44870 t.imacron = 278; 44871 t.Euro = 556; 44872 }); 44873 t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) { 44874 t.space = 278; 44875 t.exclam = 333; 44876 t.quotedbl = 474; 44877 t.numbersign = 556; 44878 t.dollar = 556; 44879 t.percent = 889; 44880 t.ampersand = 722; 44881 t.quoteright = 278; 44882 t.parenleft = 333; 44883 t.parenright = 333; 44884 t.asterisk = 389; 44885 t.plus = 584; 44886 t.comma = 278; 44887 t.hyphen = 333; 44888 t.period = 278; 44889 t.slash = 278; 44890 t.zero = 556; 44891 t.one = 556; 44892 t.two = 556; 44893 t.three = 556; 44894 t.four = 556; 44895 t.five = 556; 44896 t.six = 556; 44897 t.seven = 556; 44898 t.eight = 556; 44899 t.nine = 556; 44900 t.colon = 333; 44901 t.semicolon = 333; 44902 t.less = 584; 44903 t.equal = 584; 44904 t.greater = 584; 44905 t.question = 611; 44906 t.at = 975; 44907 t.A = 722; 44908 t.B = 722; 44909 t.C = 722; 44910 t.D = 722; 44911 t.E = 667; 44912 t.F = 611; 44913 t.G = 778; 44914 t.H = 722; 44915 t.I = 278; 44916 t.J = 556; 44917 t.K = 722; 44918 t.L = 611; 44919 t.M = 833; 44920 t.N = 722; 44921 t.O = 778; 44922 t.P = 667; 44923 t.Q = 778; 44924 t.R = 722; 44925 t.S = 667; 44926 t.T = 611; 44927 t.U = 722; 44928 t.V = 667; 44929 t.W = 944; 44930 t.X = 667; 44931 t.Y = 667; 44932 t.Z = 611; 44933 t.bracketleft = 333; 44934 t.backslash = 278; 44935 t.bracketright = 333; 44936 t.asciicircum = 584; 44937 t.underscore = 556; 44938 t.quoteleft = 278; 44939 t.a = 556; 44940 t.b = 611; 44941 t.c = 556; 44942 t.d = 611; 44943 t.e = 556; 44944 t.f = 333; 44945 t.g = 611; 44946 t.h = 611; 44947 t.i = 278; 44948 t.j = 278; 44949 t.k = 556; 44950 t.l = 278; 44951 t.m = 889; 44952 t.n = 611; 44953 t.o = 611; 44954 t.p = 611; 44955 t.q = 611; 44956 t.r = 389; 44957 t.s = 556; 44958 t.t = 333; 44959 t.u = 611; 44960 t.v = 556; 44961 t.w = 778; 44962 t.x = 556; 44963 t.y = 556; 44964 t.z = 500; 44965 t.braceleft = 389; 44966 t.bar = 280; 44967 t.braceright = 389; 44968 t.asciitilde = 584; 44969 t.exclamdown = 333; 44970 t.cent = 556; 44971 t.sterling = 556; 44972 t.fraction = 167; 44973 t.yen = 556; 44974 t.florin = 556; 44975 t.section = 556; 44976 t.currency = 556; 44977 t.quotesingle = 238; 44978 t.quotedblleft = 500; 44979 t.guillemotleft = 556; 44980 t.guilsinglleft = 333; 44981 t.guilsinglright = 333; 44982 t.fi = 611; 44983 t.fl = 611; 44984 t.endash = 556; 44985 t.dagger = 556; 44986 t.daggerdbl = 556; 44987 t.periodcentered = 278; 44988 t.paragraph = 556; 44989 t.bullet = 350; 44990 t.quotesinglbase = 278; 44991 t.quotedblbase = 500; 44992 t.quotedblright = 500; 44993 t.guillemotright = 556; 44994 t.ellipsis = 1000; 44995 t.perthousand = 1000; 44996 t.questiondown = 611; 44997 t.grave = 333; 44998 t.acute = 333; 44999 t.circumflex = 333; 45000 t.tilde = 333; 45001 t.macron = 333; 45002 t.breve = 333; 45003 t.dotaccent = 333; 45004 t.dieresis = 333; 45005 t.ring = 333; 45006 t.cedilla = 333; 45007 t.hungarumlaut = 333; 45008 t.ogonek = 333; 45009 t.caron = 333; 45010 t.emdash = 1000; 45011 t.AE = 1000; 45012 t.ordfeminine = 370; 45013 t.Lslash = 611; 45014 t.Oslash = 778; 45015 t.OE = 1000; 45016 t.ordmasculine = 365; 45017 t.ae = 889; 45018 t.dotlessi = 278; 45019 t.lslash = 278; 45020 t.oslash = 611; 45021 t.oe = 944; 45022 t.germandbls = 611; 45023 t.Idieresis = 278; 45024 t.eacute = 556; 45025 t.abreve = 556; 45026 t.uhungarumlaut = 611; 45027 t.ecaron = 556; 45028 t.Ydieresis = 667; 45029 t.divide = 584; 45030 t.Yacute = 667; 45031 t.Acircumflex = 722; 45032 t.aacute = 556; 45033 t.Ucircumflex = 722; 45034 t.yacute = 556; 45035 t.scommaaccent = 556; 45036 t.ecircumflex = 556; 45037 t.Uring = 722; 45038 t.Udieresis = 722; 45039 t.aogonek = 556; 45040 t.Uacute = 722; 45041 t.uogonek = 611; 45042 t.Edieresis = 667; 45043 t.Dcroat = 722; 45044 t.commaaccent = 250; 45045 t.copyright = 737; 45046 t.Emacron = 667; 45047 t.ccaron = 556; 45048 t.aring = 556; 45049 t.Ncommaaccent = 722; 45050 t.lacute = 278; 45051 t.agrave = 556; 45052 t.Tcommaaccent = 611; 45053 t.Cacute = 722; 45054 t.atilde = 556; 45055 t.Edotaccent = 667; 45056 t.scaron = 556; 45057 t.scedilla = 556; 45058 t.iacute = 278; 45059 t.lozenge = 494; 45060 t.Rcaron = 722; 45061 t.Gcommaaccent = 778; 45062 t.ucircumflex = 611; 45063 t.acircumflex = 556; 45064 t.Amacron = 722; 45065 t.rcaron = 389; 45066 t.ccedilla = 556; 45067 t.Zdotaccent = 611; 45068 t.Thorn = 667; 45069 t.Omacron = 778; 45070 t.Racute = 722; 45071 t.Sacute = 667; 45072 t.dcaron = 743; 45073 t.Umacron = 722; 45074 t.uring = 611; 45075 t.threesuperior = 333; 45076 t.Ograve = 778; 45077 t.Agrave = 722; 45078 t.Abreve = 722; 45079 t.multiply = 584; 45080 t.uacute = 611; 45081 t.Tcaron = 611; 45082 t.partialdiff = 494; 45083 t.ydieresis = 556; 45084 t.Nacute = 722; 45085 t.icircumflex = 278; 45086 t.Ecircumflex = 667; 45087 t.adieresis = 556; 45088 t.edieresis = 556; 45089 t.cacute = 556; 45090 t.nacute = 611; 45091 t.umacron = 611; 45092 t.Ncaron = 722; 45093 t.Iacute = 278; 45094 t.plusminus = 584; 45095 t.brokenbar = 280; 45096 t.registered = 737; 45097 t.Gbreve = 778; 45098 t.Idotaccent = 278; 45099 t.summation = 600; 45100 t.Egrave = 667; 45101 t.racute = 389; 45102 t.omacron = 611; 45103 t.Zacute = 611; 45104 t.Zcaron = 611; 45105 t.greaterequal = 549; 45106 t.Eth = 722; 45107 t.Ccedilla = 722; 45108 t.lcommaaccent = 278; 45109 t.tcaron = 389; 45110 t.eogonek = 556; 45111 t.Uogonek = 722; 45112 t.Aacute = 722; 45113 t.Adieresis = 722; 45114 t.egrave = 556; 45115 t.zacute = 500; 45116 t.iogonek = 278; 45117 t.Oacute = 778; 45118 t.oacute = 611; 45119 t.amacron = 556; 45120 t.sacute = 556; 45121 t.idieresis = 278; 45122 t.Ocircumflex = 778; 45123 t.Ugrave = 722; 45124 t.Delta = 612; 45125 t.thorn = 611; 45126 t.twosuperior = 333; 45127 t.Odieresis = 778; 45128 t.mu = 611; 45129 t.igrave = 278; 45130 t.ohungarumlaut = 611; 45131 t.Eogonek = 667; 45132 t.dcroat = 611; 45133 t.threequarters = 834; 45134 t.Scedilla = 667; 45135 t.lcaron = 400; 45136 t.Kcommaaccent = 722; 45137 t.Lacute = 611; 45138 t.trademark = 1000; 45139 t.edotaccent = 556; 45140 t.Igrave = 278; 45141 t.Imacron = 278; 45142 t.Lcaron = 611; 45143 t.onehalf = 834; 45144 t.lessequal = 549; 45145 t.ocircumflex = 611; 45146 t.ntilde = 611; 45147 t.Uhungarumlaut = 722; 45148 t.Eacute = 667; 45149 t.emacron = 556; 45150 t.gbreve = 611; 45151 t.onequarter = 834; 45152 t.Scaron = 667; 45153 t.Scommaaccent = 667; 45154 t.Ohungarumlaut = 778; 45155 t.degree = 400; 45156 t.ograve = 611; 45157 t.Ccaron = 722; 45158 t.ugrave = 611; 45159 t.radical = 549; 45160 t.Dcaron = 722; 45161 t.rcommaaccent = 389; 45162 t.Ntilde = 722; 45163 t.otilde = 611; 45164 t.Rcommaaccent = 722; 45165 t.Lcommaaccent = 611; 45166 t.Atilde = 722; 45167 t.Aogonek = 722; 45168 t.Aring = 722; 45169 t.Otilde = 778; 45170 t.zdotaccent = 500; 45171 t.Ecaron = 667; 45172 t.Iogonek = 278; 45173 t.kcommaaccent = 556; 45174 t.minus = 584; 45175 t.Icircumflex = 278; 45176 t.ncaron = 611; 45177 t.tcommaaccent = 333; 45178 t.logicalnot = 584; 45179 t.odieresis = 611; 45180 t.udieresis = 611; 45181 t.notequal = 549; 45182 t.gcommaaccent = 611; 45183 t.eth = 611; 45184 t.zcaron = 500; 45185 t.ncommaaccent = 611; 45186 t.onesuperior = 333; 45187 t.imacron = 278; 45188 t.Euro = 556; 45189 }); 45190 t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) { 45191 t.space = 278; 45192 t.exclam = 333; 45193 t.quotedbl = 474; 45194 t.numbersign = 556; 45195 t.dollar = 556; 45196 t.percent = 889; 45197 t.ampersand = 722; 45198 t.quoteright = 278; 45199 t.parenleft = 333; 45200 t.parenright = 333; 45201 t.asterisk = 389; 45202 t.plus = 584; 45203 t.comma = 278; 45204 t.hyphen = 333; 45205 t.period = 278; 45206 t.slash = 278; 45207 t.zero = 556; 45208 t.one = 556; 45209 t.two = 556; 45210 t.three = 556; 45211 t.four = 556; 45212 t.five = 556; 45213 t.six = 556; 45214 t.seven = 556; 45215 t.eight = 556; 45216 t.nine = 556; 45217 t.colon = 333; 45218 t.semicolon = 333; 45219 t.less = 584; 45220 t.equal = 584; 45221 t.greater = 584; 45222 t.question = 611; 45223 t.at = 975; 45224 t.A = 722; 45225 t.B = 722; 45226 t.C = 722; 45227 t.D = 722; 45228 t.E = 667; 45229 t.F = 611; 45230 t.G = 778; 45231 t.H = 722; 45232 t.I = 278; 45233 t.J = 556; 45234 t.K = 722; 45235 t.L = 611; 45236 t.M = 833; 45237 t.N = 722; 45238 t.O = 778; 45239 t.P = 667; 45240 t.Q = 778; 45241 t.R = 722; 45242 t.S = 667; 45243 t.T = 611; 45244 t.U = 722; 45245 t.V = 667; 45246 t.W = 944; 45247 t.X = 667; 45248 t.Y = 667; 45249 t.Z = 611; 45250 t.bracketleft = 333; 45251 t.backslash = 278; 45252 t.bracketright = 333; 45253 t.asciicircum = 584; 45254 t.underscore = 556; 45255 t.quoteleft = 278; 45256 t.a = 556; 45257 t.b = 611; 45258 t.c = 556; 45259 t.d = 611; 45260 t.e = 556; 45261 t.f = 333; 45262 t.g = 611; 45263 t.h = 611; 45264 t.i = 278; 45265 t.j = 278; 45266 t.k = 556; 45267 t.l = 278; 45268 t.m = 889; 45269 t.n = 611; 45270 t.o = 611; 45271 t.p = 611; 45272 t.q = 611; 45273 t.r = 389; 45274 t.s = 556; 45275 t.t = 333; 45276 t.u = 611; 45277 t.v = 556; 45278 t.w = 778; 45279 t.x = 556; 45280 t.y = 556; 45281 t.z = 500; 45282 t.braceleft = 389; 45283 t.bar = 280; 45284 t.braceright = 389; 45285 t.asciitilde = 584; 45286 t.exclamdown = 333; 45287 t.cent = 556; 45288 t.sterling = 556; 45289 t.fraction = 167; 45290 t.yen = 556; 45291 t.florin = 556; 45292 t.section = 556; 45293 t.currency = 556; 45294 t.quotesingle = 238; 45295 t.quotedblleft = 500; 45296 t.guillemotleft = 556; 45297 t.guilsinglleft = 333; 45298 t.guilsinglright = 333; 45299 t.fi = 611; 45300 t.fl = 611; 45301 t.endash = 556; 45302 t.dagger = 556; 45303 t.daggerdbl = 556; 45304 t.periodcentered = 278; 45305 t.paragraph = 556; 45306 t.bullet = 350; 45307 t.quotesinglbase = 278; 45308 t.quotedblbase = 500; 45309 t.quotedblright = 500; 45310 t.guillemotright = 556; 45311 t.ellipsis = 1000; 45312 t.perthousand = 1000; 45313 t.questiondown = 611; 45314 t.grave = 333; 45315 t.acute = 333; 45316 t.circumflex = 333; 45317 t.tilde = 333; 45318 t.macron = 333; 45319 t.breve = 333; 45320 t.dotaccent = 333; 45321 t.dieresis = 333; 45322 t.ring = 333; 45323 t.cedilla = 333; 45324 t.hungarumlaut = 333; 45325 t.ogonek = 333; 45326 t.caron = 333; 45327 t.emdash = 1000; 45328 t.AE = 1000; 45329 t.ordfeminine = 370; 45330 t.Lslash = 611; 45331 t.Oslash = 778; 45332 t.OE = 1000; 45333 t.ordmasculine = 365; 45334 t.ae = 889; 45335 t.dotlessi = 278; 45336 t.lslash = 278; 45337 t.oslash = 611; 45338 t.oe = 944; 45339 t.germandbls = 611; 45340 t.Idieresis = 278; 45341 t.eacute = 556; 45342 t.abreve = 556; 45343 t.uhungarumlaut = 611; 45344 t.ecaron = 556; 45345 t.Ydieresis = 667; 45346 t.divide = 584; 45347 t.Yacute = 667; 45348 t.Acircumflex = 722; 45349 t.aacute = 556; 45350 t.Ucircumflex = 722; 45351 t.yacute = 556; 45352 t.scommaaccent = 556; 45353 t.ecircumflex = 556; 45354 t.Uring = 722; 45355 t.Udieresis = 722; 45356 t.aogonek = 556; 45357 t.Uacute = 722; 45358 t.uogonek = 611; 45359 t.Edieresis = 667; 45360 t.Dcroat = 722; 45361 t.commaaccent = 250; 45362 t.copyright = 737; 45363 t.Emacron = 667; 45364 t.ccaron = 556; 45365 t.aring = 556; 45366 t.Ncommaaccent = 722; 45367 t.lacute = 278; 45368 t.agrave = 556; 45369 t.Tcommaaccent = 611; 45370 t.Cacute = 722; 45371 t.atilde = 556; 45372 t.Edotaccent = 667; 45373 t.scaron = 556; 45374 t.scedilla = 556; 45375 t.iacute = 278; 45376 t.lozenge = 494; 45377 t.Rcaron = 722; 45378 t.Gcommaaccent = 778; 45379 t.ucircumflex = 611; 45380 t.acircumflex = 556; 45381 t.Amacron = 722; 45382 t.rcaron = 389; 45383 t.ccedilla = 556; 45384 t.Zdotaccent = 611; 45385 t.Thorn = 667; 45386 t.Omacron = 778; 45387 t.Racute = 722; 45388 t.Sacute = 667; 45389 t.dcaron = 743; 45390 t.Umacron = 722; 45391 t.uring = 611; 45392 t.threesuperior = 333; 45393 t.Ograve = 778; 45394 t.Agrave = 722; 45395 t.Abreve = 722; 45396 t.multiply = 584; 45397 t.uacute = 611; 45398 t.Tcaron = 611; 45399 t.partialdiff = 494; 45400 t.ydieresis = 556; 45401 t.Nacute = 722; 45402 t.icircumflex = 278; 45403 t.Ecircumflex = 667; 45404 t.adieresis = 556; 45405 t.edieresis = 556; 45406 t.cacute = 556; 45407 t.nacute = 611; 45408 t.umacron = 611; 45409 t.Ncaron = 722; 45410 t.Iacute = 278; 45411 t.plusminus = 584; 45412 t.brokenbar = 280; 45413 t.registered = 737; 45414 t.Gbreve = 778; 45415 t.Idotaccent = 278; 45416 t.summation = 600; 45417 t.Egrave = 667; 45418 t.racute = 389; 45419 t.omacron = 611; 45420 t.Zacute = 611; 45421 t.Zcaron = 611; 45422 t.greaterequal = 549; 45423 t.Eth = 722; 45424 t.Ccedilla = 722; 45425 t.lcommaaccent = 278; 45426 t.tcaron = 389; 45427 t.eogonek = 556; 45428 t.Uogonek = 722; 45429 t.Aacute = 722; 45430 t.Adieresis = 722; 45431 t.egrave = 556; 45432 t.zacute = 500; 45433 t.iogonek = 278; 45434 t.Oacute = 778; 45435 t.oacute = 611; 45436 t.amacron = 556; 45437 t.sacute = 556; 45438 t.idieresis = 278; 45439 t.Ocircumflex = 778; 45440 t.Ugrave = 722; 45441 t.Delta = 612; 45442 t.thorn = 611; 45443 t.twosuperior = 333; 45444 t.Odieresis = 778; 45445 t.mu = 611; 45446 t.igrave = 278; 45447 t.ohungarumlaut = 611; 45448 t.Eogonek = 667; 45449 t.dcroat = 611; 45450 t.threequarters = 834; 45451 t.Scedilla = 667; 45452 t.lcaron = 400; 45453 t.Kcommaaccent = 722; 45454 t.Lacute = 611; 45455 t.trademark = 1000; 45456 t.edotaccent = 556; 45457 t.Igrave = 278; 45458 t.Imacron = 278; 45459 t.Lcaron = 611; 45460 t.onehalf = 834; 45461 t.lessequal = 549; 45462 t.ocircumflex = 611; 45463 t.ntilde = 611; 45464 t.Uhungarumlaut = 722; 45465 t.Eacute = 667; 45466 t.emacron = 556; 45467 t.gbreve = 611; 45468 t.onequarter = 834; 45469 t.Scaron = 667; 45470 t.Scommaaccent = 667; 45471 t.Ohungarumlaut = 778; 45472 t.degree = 400; 45473 t.ograve = 611; 45474 t.Ccaron = 722; 45475 t.ugrave = 611; 45476 t.radical = 549; 45477 t.Dcaron = 722; 45478 t.rcommaaccent = 389; 45479 t.Ntilde = 722; 45480 t.otilde = 611; 45481 t.Rcommaaccent = 722; 45482 t.Lcommaaccent = 611; 45483 t.Atilde = 722; 45484 t.Aogonek = 722; 45485 t.Aring = 722; 45486 t.Otilde = 778; 45487 t.zdotaccent = 500; 45488 t.Ecaron = 667; 45489 t.Iogonek = 278; 45490 t.kcommaaccent = 556; 45491 t.minus = 584; 45492 t.Icircumflex = 278; 45493 t.ncaron = 611; 45494 t.tcommaaccent = 333; 45495 t.logicalnot = 584; 45496 t.odieresis = 611; 45497 t.udieresis = 611; 45498 t.notequal = 549; 45499 t.gcommaaccent = 611; 45500 t.eth = 611; 45501 t.zcaron = 500; 45502 t.ncommaaccent = 611; 45503 t.onesuperior = 333; 45504 t.imacron = 278; 45505 t.Euro = 556; 45506 }); 45507 t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) { 45508 t.space = 278; 45509 t.exclam = 278; 45510 t.quotedbl = 355; 45511 t.numbersign = 556; 45512 t.dollar = 556; 45513 t.percent = 889; 45514 t.ampersand = 667; 45515 t.quoteright = 222; 45516 t.parenleft = 333; 45517 t.parenright = 333; 45518 t.asterisk = 389; 45519 t.plus = 584; 45520 t.comma = 278; 45521 t.hyphen = 333; 45522 t.period = 278; 45523 t.slash = 278; 45524 t.zero = 556; 45525 t.one = 556; 45526 t.two = 556; 45527 t.three = 556; 45528 t.four = 556; 45529 t.five = 556; 45530 t.six = 556; 45531 t.seven = 556; 45532 t.eight = 556; 45533 t.nine = 556; 45534 t.colon = 278; 45535 t.semicolon = 278; 45536 t.less = 584; 45537 t.equal = 584; 45538 t.greater = 584; 45539 t.question = 556; 45540 t.at = 1015; 45541 t.A = 667; 45542 t.B = 667; 45543 t.C = 722; 45544 t.D = 722; 45545 t.E = 667; 45546 t.F = 611; 45547 t.G = 778; 45548 t.H = 722; 45549 t.I = 278; 45550 t.J = 500; 45551 t.K = 667; 45552 t.L = 556; 45553 t.M = 833; 45554 t.N = 722; 45555 t.O = 778; 45556 t.P = 667; 45557 t.Q = 778; 45558 t.R = 722; 45559 t.S = 667; 45560 t.T = 611; 45561 t.U = 722; 45562 t.V = 667; 45563 t.W = 944; 45564 t.X = 667; 45565 t.Y = 667; 45566 t.Z = 611; 45567 t.bracketleft = 278; 45568 t.backslash = 278; 45569 t.bracketright = 278; 45570 t.asciicircum = 469; 45571 t.underscore = 556; 45572 t.quoteleft = 222; 45573 t.a = 556; 45574 t.b = 556; 45575 t.c = 500; 45576 t.d = 556; 45577 t.e = 556; 45578 t.f = 278; 45579 t.g = 556; 45580 t.h = 556; 45581 t.i = 222; 45582 t.j = 222; 45583 t.k = 500; 45584 t.l = 222; 45585 t.m = 833; 45586 t.n = 556; 45587 t.o = 556; 45588 t.p = 556; 45589 t.q = 556; 45590 t.r = 333; 45591 t.s = 500; 45592 t.t = 278; 45593 t.u = 556; 45594 t.v = 500; 45595 t.w = 722; 45596 t.x = 500; 45597 t.y = 500; 45598 t.z = 500; 45599 t.braceleft = 334; 45600 t.bar = 260; 45601 t.braceright = 334; 45602 t.asciitilde = 584; 45603 t.exclamdown = 333; 45604 t.cent = 556; 45605 t.sterling = 556; 45606 t.fraction = 167; 45607 t.yen = 556; 45608 t.florin = 556; 45609 t.section = 556; 45610 t.currency = 556; 45611 t.quotesingle = 191; 45612 t.quotedblleft = 333; 45613 t.guillemotleft = 556; 45614 t.guilsinglleft = 333; 45615 t.guilsinglright = 333; 45616 t.fi = 500; 45617 t.fl = 500; 45618 t.endash = 556; 45619 t.dagger = 556; 45620 t.daggerdbl = 556; 45621 t.periodcentered = 278; 45622 t.paragraph = 537; 45623 t.bullet = 350; 45624 t.quotesinglbase = 222; 45625 t.quotedblbase = 333; 45626 t.quotedblright = 333; 45627 t.guillemotright = 556; 45628 t.ellipsis = 1000; 45629 t.perthousand = 1000; 45630 t.questiondown = 611; 45631 t.grave = 333; 45632 t.acute = 333; 45633 t.circumflex = 333; 45634 t.tilde = 333; 45635 t.macron = 333; 45636 t.breve = 333; 45637 t.dotaccent = 333; 45638 t.dieresis = 333; 45639 t.ring = 333; 45640 t.cedilla = 333; 45641 t.hungarumlaut = 333; 45642 t.ogonek = 333; 45643 t.caron = 333; 45644 t.emdash = 1000; 45645 t.AE = 1000; 45646 t.ordfeminine = 370; 45647 t.Lslash = 556; 45648 t.Oslash = 778; 45649 t.OE = 1000; 45650 t.ordmasculine = 365; 45651 t.ae = 889; 45652 t.dotlessi = 278; 45653 t.lslash = 222; 45654 t.oslash = 611; 45655 t.oe = 944; 45656 t.germandbls = 611; 45657 t.Idieresis = 278; 45658 t.eacute = 556; 45659 t.abreve = 556; 45660 t.uhungarumlaut = 556; 45661 t.ecaron = 556; 45662 t.Ydieresis = 667; 45663 t.divide = 584; 45664 t.Yacute = 667; 45665 t.Acircumflex = 667; 45666 t.aacute = 556; 45667 t.Ucircumflex = 722; 45668 t.yacute = 500; 45669 t.scommaaccent = 500; 45670 t.ecircumflex = 556; 45671 t.Uring = 722; 45672 t.Udieresis = 722; 45673 t.aogonek = 556; 45674 t.Uacute = 722; 45675 t.uogonek = 556; 45676 t.Edieresis = 667; 45677 t.Dcroat = 722; 45678 t.commaaccent = 250; 45679 t.copyright = 737; 45680 t.Emacron = 667; 45681 t.ccaron = 500; 45682 t.aring = 556; 45683 t.Ncommaaccent = 722; 45684 t.lacute = 222; 45685 t.agrave = 556; 45686 t.Tcommaaccent = 611; 45687 t.Cacute = 722; 45688 t.atilde = 556; 45689 t.Edotaccent = 667; 45690 t.scaron = 500; 45691 t.scedilla = 500; 45692 t.iacute = 278; 45693 t.lozenge = 471; 45694 t.Rcaron = 722; 45695 t.Gcommaaccent = 778; 45696 t.ucircumflex = 556; 45697 t.acircumflex = 556; 45698 t.Amacron = 667; 45699 t.rcaron = 333; 45700 t.ccedilla = 500; 45701 t.Zdotaccent = 611; 45702 t.Thorn = 667; 45703 t.Omacron = 778; 45704 t.Racute = 722; 45705 t.Sacute = 667; 45706 t.dcaron = 643; 45707 t.Umacron = 722; 45708 t.uring = 556; 45709 t.threesuperior = 333; 45710 t.Ograve = 778; 45711 t.Agrave = 667; 45712 t.Abreve = 667; 45713 t.multiply = 584; 45714 t.uacute = 556; 45715 t.Tcaron = 611; 45716 t.partialdiff = 476; 45717 t.ydieresis = 500; 45718 t.Nacute = 722; 45719 t.icircumflex = 278; 45720 t.Ecircumflex = 667; 45721 t.adieresis = 556; 45722 t.edieresis = 556; 45723 t.cacute = 500; 45724 t.nacute = 556; 45725 t.umacron = 556; 45726 t.Ncaron = 722; 45727 t.Iacute = 278; 45728 t.plusminus = 584; 45729 t.brokenbar = 260; 45730 t.registered = 737; 45731 t.Gbreve = 778; 45732 t.Idotaccent = 278; 45733 t.summation = 600; 45734 t.Egrave = 667; 45735 t.racute = 333; 45736 t.omacron = 556; 45737 t.Zacute = 611; 45738 t.Zcaron = 611; 45739 t.greaterequal = 549; 45740 t.Eth = 722; 45741 t.Ccedilla = 722; 45742 t.lcommaaccent = 222; 45743 t.tcaron = 317; 45744 t.eogonek = 556; 45745 t.Uogonek = 722; 45746 t.Aacute = 667; 45747 t.Adieresis = 667; 45748 t.egrave = 556; 45749 t.zacute = 500; 45750 t.iogonek = 222; 45751 t.Oacute = 778; 45752 t.oacute = 556; 45753 t.amacron = 556; 45754 t.sacute = 500; 45755 t.idieresis = 278; 45756 t.Ocircumflex = 778; 45757 t.Ugrave = 722; 45758 t.Delta = 612; 45759 t.thorn = 556; 45760 t.twosuperior = 333; 45761 t.Odieresis = 778; 45762 t.mu = 556; 45763 t.igrave = 278; 45764 t.ohungarumlaut = 556; 45765 t.Eogonek = 667; 45766 t.dcroat = 556; 45767 t.threequarters = 834; 45768 t.Scedilla = 667; 45769 t.lcaron = 299; 45770 t.Kcommaaccent = 667; 45771 t.Lacute = 556; 45772 t.trademark = 1000; 45773 t.edotaccent = 556; 45774 t.Igrave = 278; 45775 t.Imacron = 278; 45776 t.Lcaron = 556; 45777 t.onehalf = 834; 45778 t.lessequal = 549; 45779 t.ocircumflex = 556; 45780 t.ntilde = 556; 45781 t.Uhungarumlaut = 722; 45782 t.Eacute = 667; 45783 t.emacron = 556; 45784 t.gbreve = 556; 45785 t.onequarter = 834; 45786 t.Scaron = 667; 45787 t.Scommaaccent = 667; 45788 t.Ohungarumlaut = 778; 45789 t.degree = 400; 45790 t.ograve = 556; 45791 t.Ccaron = 722; 45792 t.ugrave = 556; 45793 t.radical = 453; 45794 t.Dcaron = 722; 45795 t.rcommaaccent = 333; 45796 t.Ntilde = 722; 45797 t.otilde = 556; 45798 t.Rcommaaccent = 722; 45799 t.Lcommaaccent = 556; 45800 t.Atilde = 667; 45801 t.Aogonek = 667; 45802 t.Aring = 667; 45803 t.Otilde = 778; 45804 t.zdotaccent = 500; 45805 t.Ecaron = 667; 45806 t.Iogonek = 278; 45807 t.kcommaaccent = 500; 45808 t.minus = 584; 45809 t.Icircumflex = 278; 45810 t.ncaron = 556; 45811 t.tcommaaccent = 278; 45812 t.logicalnot = 584; 45813 t.odieresis = 556; 45814 t.udieresis = 556; 45815 t.notequal = 549; 45816 t.gcommaaccent = 556; 45817 t.eth = 556; 45818 t.zcaron = 500; 45819 t.ncommaaccent = 556; 45820 t.onesuperior = 333; 45821 t.imacron = 278; 45822 t.Euro = 556; 45823 }); 45824 t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) { 45825 t.space = 250; 45826 t.exclam = 333; 45827 t.universal = 713; 45828 t.numbersign = 500; 45829 t.existential = 549; 45830 t.percent = 833; 45831 t.ampersand = 778; 45832 t.suchthat = 439; 45833 t.parenleft = 333; 45834 t.parenright = 333; 45835 t.asteriskmath = 500; 45836 t.plus = 549; 45837 t.comma = 250; 45838 t.minus = 549; 45839 t.period = 250; 45840 t.slash = 278; 45841 t.zero = 500; 45842 t.one = 500; 45843 t.two = 500; 45844 t.three = 500; 45845 t.four = 500; 45846 t.five = 500; 45847 t.six = 500; 45848 t.seven = 500; 45849 t.eight = 500; 45850 t.nine = 500; 45851 t.colon = 278; 45852 t.semicolon = 278; 45853 t.less = 549; 45854 t.equal = 549; 45855 t.greater = 549; 45856 t.question = 444; 45857 t.congruent = 549; 45858 t.Alpha = 722; 45859 t.Beta = 667; 45860 t.Chi = 722; 45861 t.Delta = 612; 45862 t.Epsilon = 611; 45863 t.Phi = 763; 45864 t.Gamma = 603; 45865 t.Eta = 722; 45866 t.Iota = 333; 45867 t.theta1 = 631; 45868 t.Kappa = 722; 45869 t.Lambda = 686; 45870 t.Mu = 889; 45871 t.Nu = 722; 45872 t.Omicron = 722; 45873 t.Pi = 768; 45874 t.Theta = 741; 45875 t.Rho = 556; 45876 t.Sigma = 592; 45877 t.Tau = 611; 45878 t.Upsilon = 690; 45879 t.sigma1 = 439; 45880 t.Omega = 768; 45881 t.Xi = 645; 45882 t.Psi = 795; 45883 t.Zeta = 611; 45884 t.bracketleft = 333; 45885 t.therefore = 863; 45886 t.bracketright = 333; 45887 t.perpendicular = 658; 45888 t.underscore = 500; 45889 t.radicalex = 500; 45890 t.alpha = 631; 45891 t.beta = 549; 45892 t.chi = 549; 45893 t.delta = 494; 45894 t.epsilon = 439; 45895 t.phi = 521; 45896 t.gamma = 411; 45897 t.eta = 603; 45898 t.iota = 329; 45899 t.phi1 = 603; 45900 t.kappa = 549; 45901 t.lambda = 549; 45902 t.mu = 576; 45903 t.nu = 521; 45904 t.omicron = 549; 45905 t.pi = 549; 45906 t.theta = 521; 45907 t.rho = 549; 45908 t.sigma = 603; 45909 t.tau = 439; 45910 t.upsilon = 576; 45911 t.omega1 = 713; 45912 t.omega = 686; 45913 t.xi = 493; 45914 t.psi = 686; 45915 t.zeta = 494; 45916 t.braceleft = 480; 45917 t.bar = 200; 45918 t.braceright = 480; 45919 t.similar = 549; 45920 t.Euro = 750; 45921 t.Upsilon1 = 620; 45922 t.minute = 247; 45923 t.lessequal = 549; 45924 t.fraction = 167; 45925 t.infinity = 713; 45926 t.florin = 500; 45927 t.club = 753; 45928 t.diamond = 753; 45929 t.heart = 753; 45930 t.spade = 753; 45931 t.arrowboth = 1042; 45932 t.arrowleft = 987; 45933 t.arrowup = 603; 45934 t.arrowright = 987; 45935 t.arrowdown = 603; 45936 t.degree = 400; 45937 t.plusminus = 549; 45938 t.second = 411; 45939 t.greaterequal = 549; 45940 t.multiply = 549; 45941 t.proportional = 713; 45942 t.partialdiff = 494; 45943 t.bullet = 460; 45944 t.divide = 549; 45945 t.notequal = 549; 45946 t.equivalence = 549; 45947 t.approxequal = 549; 45948 t.ellipsis = 1000; 45949 t.arrowvertex = 603; 45950 t.arrowhorizex = 1000; 45951 t.carriagereturn = 658; 45952 t.aleph = 823; 45953 t.Ifraktur = 686; 45954 t.Rfraktur = 795; 45955 t.weierstrass = 987; 45956 t.circlemultiply = 768; 45957 t.circleplus = 768; 45958 t.emptyset = 823; 45959 t.intersection = 768; 45960 t.union = 768; 45961 t.propersuperset = 713; 45962 t.reflexsuperset = 713; 45963 t.notsubset = 713; 45964 t.propersubset = 713; 45965 t.reflexsubset = 713; 45966 t.element = 713; 45967 t.notelement = 713; 45968 t.angle = 768; 45969 t.gradient = 713; 45970 t.registerserif = 790; 45971 t.copyrightserif = 790; 45972 t.trademarkserif = 890; 45973 t.product = 823; 45974 t.radical = 549; 45975 t.dotmath = 250; 45976 t.logicalnot = 713; 45977 t.logicaland = 603; 45978 t.logicalor = 603; 45979 t.arrowdblboth = 1042; 45980 t.arrowdblleft = 987; 45981 t.arrowdblup = 603; 45982 t.arrowdblright = 987; 45983 t.arrowdbldown = 603; 45984 t.lozenge = 494; 45985 t.angleleft = 329; 45986 t.registersans = 790; 45987 t.copyrightsans = 790; 45988 t.trademarksans = 786; 45989 t.summation = 713; 45990 t.parenlefttp = 384; 45991 t.parenleftex = 384; 45992 t.parenleftbt = 384; 45993 t.bracketlefttp = 384; 45994 t.bracketleftex = 384; 45995 t.bracketleftbt = 384; 45996 t.bracelefttp = 494; 45997 t.braceleftmid = 494; 45998 t.braceleftbt = 494; 45999 t.braceex = 494; 46000 t.angleright = 329; 46001 t.integral = 274; 46002 t.integraltp = 686; 46003 t.integralex = 686; 46004 t.integralbt = 686; 46005 t.parenrighttp = 384; 46006 t.parenrightex = 384; 46007 t.parenrightbt = 384; 46008 t.bracketrighttp = 384; 46009 t.bracketrightex = 384; 46010 t.bracketrightbt = 384; 46011 t.bracerighttp = 494; 46012 t.bracerightmid = 494; 46013 t.bracerightbt = 494; 46014 t.apple = 790; 46015 }); 46016 t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) { 46017 t.space = 250; 46018 t.exclam = 333; 46019 t.quotedbl = 408; 46020 t.numbersign = 500; 46021 t.dollar = 500; 46022 t.percent = 833; 46023 t.ampersand = 778; 46024 t.quoteright = 333; 46025 t.parenleft = 333; 46026 t.parenright = 333; 46027 t.asterisk = 500; 46028 t.plus = 564; 46029 t.comma = 250; 46030 t.hyphen = 333; 46031 t.period = 250; 46032 t.slash = 278; 46033 t.zero = 500; 46034 t.one = 500; 46035 t.two = 500; 46036 t.three = 500; 46037 t.four = 500; 46038 t.five = 500; 46039 t.six = 500; 46040 t.seven = 500; 46041 t.eight = 500; 46042 t.nine = 500; 46043 t.colon = 278; 46044 t.semicolon = 278; 46045 t.less = 564; 46046 t.equal = 564; 46047 t.greater = 564; 46048 t.question = 444; 46049 t.at = 921; 46050 t.A = 722; 46051 t.B = 667; 46052 t.C = 667; 46053 t.D = 722; 46054 t.E = 611; 46055 t.F = 556; 46056 t.G = 722; 46057 t.H = 722; 46058 t.I = 333; 46059 t.J = 389; 46060 t.K = 722; 46061 t.L = 611; 46062 t.M = 889; 46063 t.N = 722; 46064 t.O = 722; 46065 t.P = 556; 46066 t.Q = 722; 46067 t.R = 667; 46068 t.S = 556; 46069 t.T = 611; 46070 t.U = 722; 46071 t.V = 722; 46072 t.W = 944; 46073 t.X = 722; 46074 t.Y = 722; 46075 t.Z = 611; 46076 t.bracketleft = 333; 46077 t.backslash = 278; 46078 t.bracketright = 333; 46079 t.asciicircum = 469; 46080 t.underscore = 500; 46081 t.quoteleft = 333; 46082 t.a = 444; 46083 t.b = 500; 46084 t.c = 444; 46085 t.d = 500; 46086 t.e = 444; 46087 t.f = 333; 46088 t.g = 500; 46089 t.h = 500; 46090 t.i = 278; 46091 t.j = 278; 46092 t.k = 500; 46093 t.l = 278; 46094 t.m = 778; 46095 t.n = 500; 46096 t.o = 500; 46097 t.p = 500; 46098 t.q = 500; 46099 t.r = 333; 46100 t.s = 389; 46101 t.t = 278; 46102 t.u = 500; 46103 t.v = 500; 46104 t.w = 722; 46105 t.x = 500; 46106 t.y = 500; 46107 t.z = 444; 46108 t.braceleft = 480; 46109 t.bar = 200; 46110 t.braceright = 480; 46111 t.asciitilde = 541; 46112 t.exclamdown = 333; 46113 t.cent = 500; 46114 t.sterling = 500; 46115 t.fraction = 167; 46116 t.yen = 500; 46117 t.florin = 500; 46118 t.section = 500; 46119 t.currency = 500; 46120 t.quotesingle = 180; 46121 t.quotedblleft = 444; 46122 t.guillemotleft = 500; 46123 t.guilsinglleft = 333; 46124 t.guilsinglright = 333; 46125 t.fi = 556; 46126 t.fl = 556; 46127 t.endash = 500; 46128 t.dagger = 500; 46129 t.daggerdbl = 500; 46130 t.periodcentered = 250; 46131 t.paragraph = 453; 46132 t.bullet = 350; 46133 t.quotesinglbase = 333; 46134 t.quotedblbase = 444; 46135 t.quotedblright = 444; 46136 t.guillemotright = 500; 46137 t.ellipsis = 1000; 46138 t.perthousand = 1000; 46139 t.questiondown = 444; 46140 t.grave = 333; 46141 t.acute = 333; 46142 t.circumflex = 333; 46143 t.tilde = 333; 46144 t.macron = 333; 46145 t.breve = 333; 46146 t.dotaccent = 333; 46147 t.dieresis = 333; 46148 t.ring = 333; 46149 t.cedilla = 333; 46150 t.hungarumlaut = 333; 46151 t.ogonek = 333; 46152 t.caron = 333; 46153 t.emdash = 1000; 46154 t.AE = 889; 46155 t.ordfeminine = 276; 46156 t.Lslash = 611; 46157 t.Oslash = 722; 46158 t.OE = 889; 46159 t.ordmasculine = 310; 46160 t.ae = 667; 46161 t.dotlessi = 278; 46162 t.lslash = 278; 46163 t.oslash = 500; 46164 t.oe = 722; 46165 t.germandbls = 500; 46166 t.Idieresis = 333; 46167 t.eacute = 444; 46168 t.abreve = 444; 46169 t.uhungarumlaut = 500; 46170 t.ecaron = 444; 46171 t.Ydieresis = 722; 46172 t.divide = 564; 46173 t.Yacute = 722; 46174 t.Acircumflex = 722; 46175 t.aacute = 444; 46176 t.Ucircumflex = 722; 46177 t.yacute = 500; 46178 t.scommaaccent = 389; 46179 t.ecircumflex = 444; 46180 t.Uring = 722; 46181 t.Udieresis = 722; 46182 t.aogonek = 444; 46183 t.Uacute = 722; 46184 t.uogonek = 500; 46185 t.Edieresis = 611; 46186 t.Dcroat = 722; 46187 t.commaaccent = 250; 46188 t.copyright = 760; 46189 t.Emacron = 611; 46190 t.ccaron = 444; 46191 t.aring = 444; 46192 t.Ncommaaccent = 722; 46193 t.lacute = 278; 46194 t.agrave = 444; 46195 t.Tcommaaccent = 611; 46196 t.Cacute = 667; 46197 t.atilde = 444; 46198 t.Edotaccent = 611; 46199 t.scaron = 389; 46200 t.scedilla = 389; 46201 t.iacute = 278; 46202 t.lozenge = 471; 46203 t.Rcaron = 667; 46204 t.Gcommaaccent = 722; 46205 t.ucircumflex = 500; 46206 t.acircumflex = 444; 46207 t.Amacron = 722; 46208 t.rcaron = 333; 46209 t.ccedilla = 444; 46210 t.Zdotaccent = 611; 46211 t.Thorn = 556; 46212 t.Omacron = 722; 46213 t.Racute = 667; 46214 t.Sacute = 556; 46215 t.dcaron = 588; 46216 t.Umacron = 722; 46217 t.uring = 500; 46218 t.threesuperior = 300; 46219 t.Ograve = 722; 46220 t.Agrave = 722; 46221 t.Abreve = 722; 46222 t.multiply = 564; 46223 t.uacute = 500; 46224 t.Tcaron = 611; 46225 t.partialdiff = 476; 46226 t.ydieresis = 500; 46227 t.Nacute = 722; 46228 t.icircumflex = 278; 46229 t.Ecircumflex = 611; 46230 t.adieresis = 444; 46231 t.edieresis = 444; 46232 t.cacute = 444; 46233 t.nacute = 500; 46234 t.umacron = 500; 46235 t.Ncaron = 722; 46236 t.Iacute = 333; 46237 t.plusminus = 564; 46238 t.brokenbar = 200; 46239 t.registered = 760; 46240 t.Gbreve = 722; 46241 t.Idotaccent = 333; 46242 t.summation = 600; 46243 t.Egrave = 611; 46244 t.racute = 333; 46245 t.omacron = 500; 46246 t.Zacute = 611; 46247 t.Zcaron = 611; 46248 t.greaterequal = 549; 46249 t.Eth = 722; 46250 t.Ccedilla = 667; 46251 t.lcommaaccent = 278; 46252 t.tcaron = 326; 46253 t.eogonek = 444; 46254 t.Uogonek = 722; 46255 t.Aacute = 722; 46256 t.Adieresis = 722; 46257 t.egrave = 444; 46258 t.zacute = 444; 46259 t.iogonek = 278; 46260 t.Oacute = 722; 46261 t.oacute = 500; 46262 t.amacron = 444; 46263 t.sacute = 389; 46264 t.idieresis = 278; 46265 t.Ocircumflex = 722; 46266 t.Ugrave = 722; 46267 t.Delta = 612; 46268 t.thorn = 500; 46269 t.twosuperior = 300; 46270 t.Odieresis = 722; 46271 t.mu = 500; 46272 t.igrave = 278; 46273 t.ohungarumlaut = 500; 46274 t.Eogonek = 611; 46275 t.dcroat = 500; 46276 t.threequarters = 750; 46277 t.Scedilla = 556; 46278 t.lcaron = 344; 46279 t.Kcommaaccent = 722; 46280 t.Lacute = 611; 46281 t.trademark = 980; 46282 t.edotaccent = 444; 46283 t.Igrave = 333; 46284 t.Imacron = 333; 46285 t.Lcaron = 611; 46286 t.onehalf = 750; 46287 t.lessequal = 549; 46288 t.ocircumflex = 500; 46289 t.ntilde = 500; 46290 t.Uhungarumlaut = 722; 46291 t.Eacute = 611; 46292 t.emacron = 444; 46293 t.gbreve = 500; 46294 t.onequarter = 750; 46295 t.Scaron = 556; 46296 t.Scommaaccent = 556; 46297 t.Ohungarumlaut = 722; 46298 t.degree = 400; 46299 t.ograve = 500; 46300 t.Ccaron = 667; 46301 t.ugrave = 500; 46302 t.radical = 453; 46303 t.Dcaron = 722; 46304 t.rcommaaccent = 333; 46305 t.Ntilde = 722; 46306 t.otilde = 500; 46307 t.Rcommaaccent = 667; 46308 t.Lcommaaccent = 611; 46309 t.Atilde = 722; 46310 t.Aogonek = 722; 46311 t.Aring = 722; 46312 t.Otilde = 722; 46313 t.zdotaccent = 444; 46314 t.Ecaron = 611; 46315 t.Iogonek = 333; 46316 t.kcommaaccent = 500; 46317 t.minus = 564; 46318 t.Icircumflex = 333; 46319 t.ncaron = 500; 46320 t.tcommaaccent = 278; 46321 t.logicalnot = 564; 46322 t.odieresis = 500; 46323 t.udieresis = 500; 46324 t.notequal = 549; 46325 t.gcommaaccent = 500; 46326 t.eth = 500; 46327 t.zcaron = 444; 46328 t.ncommaaccent = 500; 46329 t.onesuperior = 300; 46330 t.imacron = 278; 46331 t.Euro = 500; 46332 }); 46333 t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) { 46334 t.space = 250; 46335 t.exclam = 333; 46336 t.quotedbl = 555; 46337 t.numbersign = 500; 46338 t.dollar = 500; 46339 t.percent = 1000; 46340 t.ampersand = 833; 46341 t.quoteright = 333; 46342 t.parenleft = 333; 46343 t.parenright = 333; 46344 t.asterisk = 500; 46345 t.plus = 570; 46346 t.comma = 250; 46347 t.hyphen = 333; 46348 t.period = 250; 46349 t.slash = 278; 46350 t.zero = 500; 46351 t.one = 500; 46352 t.two = 500; 46353 t.three = 500; 46354 t.four = 500; 46355 t.five = 500; 46356 t.six = 500; 46357 t.seven = 500; 46358 t.eight = 500; 46359 t.nine = 500; 46360 t.colon = 333; 46361 t.semicolon = 333; 46362 t.less = 570; 46363 t.equal = 570; 46364 t.greater = 570; 46365 t.question = 500; 46366 t.at = 930; 46367 t.A = 722; 46368 t.B = 667; 46369 t.C = 722; 46370 t.D = 722; 46371 t.E = 667; 46372 t.F = 611; 46373 t.G = 778; 46374 t.H = 778; 46375 t.I = 389; 46376 t.J = 500; 46377 t.K = 778; 46378 t.L = 667; 46379 t.M = 944; 46380 t.N = 722; 46381 t.O = 778; 46382 t.P = 611; 46383 t.Q = 778; 46384 t.R = 722; 46385 t.S = 556; 46386 t.T = 667; 46387 t.U = 722; 46388 t.V = 722; 46389 t.W = 1000; 46390 t.X = 722; 46391 t.Y = 722; 46392 t.Z = 667; 46393 t.bracketleft = 333; 46394 t.backslash = 278; 46395 t.bracketright = 333; 46396 t.asciicircum = 581; 46397 t.underscore = 500; 46398 t.quoteleft = 333; 46399 t.a = 500; 46400 t.b = 556; 46401 t.c = 444; 46402 t.d = 556; 46403 t.e = 444; 46404 t.f = 333; 46405 t.g = 500; 46406 t.h = 556; 46407 t.i = 278; 46408 t.j = 333; 46409 t.k = 556; 46410 t.l = 278; 46411 t.m = 833; 46412 t.n = 556; 46413 t.o = 500; 46414 t.p = 556; 46415 t.q = 556; 46416 t.r = 444; 46417 t.s = 389; 46418 t.t = 333; 46419 t.u = 556; 46420 t.v = 500; 46421 t.w = 722; 46422 t.x = 500; 46423 t.y = 500; 46424 t.z = 444; 46425 t.braceleft = 394; 46426 t.bar = 220; 46427 t.braceright = 394; 46428 t.asciitilde = 520; 46429 t.exclamdown = 333; 46430 t.cent = 500; 46431 t.sterling = 500; 46432 t.fraction = 167; 46433 t.yen = 500; 46434 t.florin = 500; 46435 t.section = 500; 46436 t.currency = 500; 46437 t.quotesingle = 278; 46438 t.quotedblleft = 500; 46439 t.guillemotleft = 500; 46440 t.guilsinglleft = 333; 46441 t.guilsinglright = 333; 46442 t.fi = 556; 46443 t.fl = 556; 46444 t.endash = 500; 46445 t.dagger = 500; 46446 t.daggerdbl = 500; 46447 t.periodcentered = 250; 46448 t.paragraph = 540; 46449 t.bullet = 350; 46450 t.quotesinglbase = 333; 46451 t.quotedblbase = 500; 46452 t.quotedblright = 500; 46453 t.guillemotright = 500; 46454 t.ellipsis = 1000; 46455 t.perthousand = 1000; 46456 t.questiondown = 500; 46457 t.grave = 333; 46458 t.acute = 333; 46459 t.circumflex = 333; 46460 t.tilde = 333; 46461 t.macron = 333; 46462 t.breve = 333; 46463 t.dotaccent = 333; 46464 t.dieresis = 333; 46465 t.ring = 333; 46466 t.cedilla = 333; 46467 t.hungarumlaut = 333; 46468 t.ogonek = 333; 46469 t.caron = 333; 46470 t.emdash = 1000; 46471 t.AE = 1000; 46472 t.ordfeminine = 300; 46473 t.Lslash = 667; 46474 t.Oslash = 778; 46475 t.OE = 1000; 46476 t.ordmasculine = 330; 46477 t.ae = 722; 46478 t.dotlessi = 278; 46479 t.lslash = 278; 46480 t.oslash = 500; 46481 t.oe = 722; 46482 t.germandbls = 556; 46483 t.Idieresis = 389; 46484 t.eacute = 444; 46485 t.abreve = 500; 46486 t.uhungarumlaut = 556; 46487 t.ecaron = 444; 46488 t.Ydieresis = 722; 46489 t.divide = 570; 46490 t.Yacute = 722; 46491 t.Acircumflex = 722; 46492 t.aacute = 500; 46493 t.Ucircumflex = 722; 46494 t.yacute = 500; 46495 t.scommaaccent = 389; 46496 t.ecircumflex = 444; 46497 t.Uring = 722; 46498 t.Udieresis = 722; 46499 t.aogonek = 500; 46500 t.Uacute = 722; 46501 t.uogonek = 556; 46502 t.Edieresis = 667; 46503 t.Dcroat = 722; 46504 t.commaaccent = 250; 46505 t.copyright = 747; 46506 t.Emacron = 667; 46507 t.ccaron = 444; 46508 t.aring = 500; 46509 t.Ncommaaccent = 722; 46510 t.lacute = 278; 46511 t.agrave = 500; 46512 t.Tcommaaccent = 667; 46513 t.Cacute = 722; 46514 t.atilde = 500; 46515 t.Edotaccent = 667; 46516 t.scaron = 389; 46517 t.scedilla = 389; 46518 t.iacute = 278; 46519 t.lozenge = 494; 46520 t.Rcaron = 722; 46521 t.Gcommaaccent = 778; 46522 t.ucircumflex = 556; 46523 t.acircumflex = 500; 46524 t.Amacron = 722; 46525 t.rcaron = 444; 46526 t.ccedilla = 444; 46527 t.Zdotaccent = 667; 46528 t.Thorn = 611; 46529 t.Omacron = 778; 46530 t.Racute = 722; 46531 t.Sacute = 556; 46532 t.dcaron = 672; 46533 t.Umacron = 722; 46534 t.uring = 556; 46535 t.threesuperior = 300; 46536 t.Ograve = 778; 46537 t.Agrave = 722; 46538 t.Abreve = 722; 46539 t.multiply = 570; 46540 t.uacute = 556; 46541 t.Tcaron = 667; 46542 t.partialdiff = 494; 46543 t.ydieresis = 500; 46544 t.Nacute = 722; 46545 t.icircumflex = 278; 46546 t.Ecircumflex = 667; 46547 t.adieresis = 500; 46548 t.edieresis = 444; 46549 t.cacute = 444; 46550 t.nacute = 556; 46551 t.umacron = 556; 46552 t.Ncaron = 722; 46553 t.Iacute = 389; 46554 t.plusminus = 570; 46555 t.brokenbar = 220; 46556 t.registered = 747; 46557 t.Gbreve = 778; 46558 t.Idotaccent = 389; 46559 t.summation = 600; 46560 t.Egrave = 667; 46561 t.racute = 444; 46562 t.omacron = 500; 46563 t.Zacute = 667; 46564 t.Zcaron = 667; 46565 t.greaterequal = 549; 46566 t.Eth = 722; 46567 t.Ccedilla = 722; 46568 t.lcommaaccent = 278; 46569 t.tcaron = 416; 46570 t.eogonek = 444; 46571 t.Uogonek = 722; 46572 t.Aacute = 722; 46573 t.Adieresis = 722; 46574 t.egrave = 444; 46575 t.zacute = 444; 46576 t.iogonek = 278; 46577 t.Oacute = 778; 46578 t.oacute = 500; 46579 t.amacron = 500; 46580 t.sacute = 389; 46581 t.idieresis = 278; 46582 t.Ocircumflex = 778; 46583 t.Ugrave = 722; 46584 t.Delta = 612; 46585 t.thorn = 556; 46586 t.twosuperior = 300; 46587 t.Odieresis = 778; 46588 t.mu = 556; 46589 t.igrave = 278; 46590 t.ohungarumlaut = 500; 46591 t.Eogonek = 667; 46592 t.dcroat = 556; 46593 t.threequarters = 750; 46594 t.Scedilla = 556; 46595 t.lcaron = 394; 46596 t.Kcommaaccent = 778; 46597 t.Lacute = 667; 46598 t.trademark = 1000; 46599 t.edotaccent = 444; 46600 t.Igrave = 389; 46601 t.Imacron = 389; 46602 t.Lcaron = 667; 46603 t.onehalf = 750; 46604 t.lessequal = 549; 46605 t.ocircumflex = 500; 46606 t.ntilde = 556; 46607 t.Uhungarumlaut = 722; 46608 t.Eacute = 667; 46609 t.emacron = 444; 46610 t.gbreve = 500; 46611 t.onequarter = 750; 46612 t.Scaron = 556; 46613 t.Scommaaccent = 556; 46614 t.Ohungarumlaut = 778; 46615 t.degree = 400; 46616 t.ograve = 500; 46617 t.Ccaron = 722; 46618 t.ugrave = 556; 46619 t.radical = 549; 46620 t.Dcaron = 722; 46621 t.rcommaaccent = 444; 46622 t.Ntilde = 722; 46623 t.otilde = 500; 46624 t.Rcommaaccent = 722; 46625 t.Lcommaaccent = 667; 46626 t.Atilde = 722; 46627 t.Aogonek = 722; 46628 t.Aring = 722; 46629 t.Otilde = 778; 46630 t.zdotaccent = 444; 46631 t.Ecaron = 667; 46632 t.Iogonek = 389; 46633 t.kcommaaccent = 556; 46634 t.minus = 570; 46635 t.Icircumflex = 389; 46636 t.ncaron = 556; 46637 t.tcommaaccent = 333; 46638 t.logicalnot = 570; 46639 t.odieresis = 500; 46640 t.udieresis = 556; 46641 t.notequal = 549; 46642 t.gcommaaccent = 500; 46643 t.eth = 500; 46644 t.zcaron = 444; 46645 t.ncommaaccent = 556; 46646 t.onesuperior = 300; 46647 t.imacron = 278; 46648 t.Euro = 500; 46649 }); 46650 t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) { 46651 t.space = 250; 46652 t.exclam = 389; 46653 t.quotedbl = 555; 46654 t.numbersign = 500; 46655 t.dollar = 500; 46656 t.percent = 833; 46657 t.ampersand = 778; 46658 t.quoteright = 333; 46659 t.parenleft = 333; 46660 t.parenright = 333; 46661 t.asterisk = 500; 46662 t.plus = 570; 46663 t.comma = 250; 46664 t.hyphen = 333; 46665 t.period = 250; 46666 t.slash = 278; 46667 t.zero = 500; 46668 t.one = 500; 46669 t.two = 500; 46670 t.three = 500; 46671 t.four = 500; 46672 t.five = 500; 46673 t.six = 500; 46674 t.seven = 500; 46675 t.eight = 500; 46676 t.nine = 500; 46677 t.colon = 333; 46678 t.semicolon = 333; 46679 t.less = 570; 46680 t.equal = 570; 46681 t.greater = 570; 46682 t.question = 500; 46683 t.at = 832; 46684 t.A = 667; 46685 t.B = 667; 46686 t.C = 667; 46687 t.D = 722; 46688 t.E = 667; 46689 t.F = 667; 46690 t.G = 722; 46691 t.H = 778; 46692 t.I = 389; 46693 t.J = 500; 46694 t.K = 667; 46695 t.L = 611; 46696 t.M = 889; 46697 t.N = 722; 46698 t.O = 722; 46699 t.P = 611; 46700 t.Q = 722; 46701 t.R = 667; 46702 t.S = 556; 46703 t.T = 611; 46704 t.U = 722; 46705 t.V = 667; 46706 t.W = 889; 46707 t.X = 667; 46708 t.Y = 611; 46709 t.Z = 611; 46710 t.bracketleft = 333; 46711 t.backslash = 278; 46712 t.bracketright = 333; 46713 t.asciicircum = 570; 46714 t.underscore = 500; 46715 t.quoteleft = 333; 46716 t.a = 500; 46717 t.b = 500; 46718 t.c = 444; 46719 t.d = 500; 46720 t.e = 444; 46721 t.f = 333; 46722 t.g = 500; 46723 t.h = 556; 46724 t.i = 278; 46725 t.j = 278; 46726 t.k = 500; 46727 t.l = 278; 46728 t.m = 778; 46729 t.n = 556; 46730 t.o = 500; 46731 t.p = 500; 46732 t.q = 500; 46733 t.r = 389; 46734 t.s = 389; 46735 t.t = 278; 46736 t.u = 556; 46737 t.v = 444; 46738 t.w = 667; 46739 t.x = 500; 46740 t.y = 444; 46741 t.z = 389; 46742 t.braceleft = 348; 46743 t.bar = 220; 46744 t.braceright = 348; 46745 t.asciitilde = 570; 46746 t.exclamdown = 389; 46747 t.cent = 500; 46748 t.sterling = 500; 46749 t.fraction = 167; 46750 t.yen = 500; 46751 t.florin = 500; 46752 t.section = 500; 46753 t.currency = 500; 46754 t.quotesingle = 278; 46755 t.quotedblleft = 500; 46756 t.guillemotleft = 500; 46757 t.guilsinglleft = 333; 46758 t.guilsinglright = 333; 46759 t.fi = 556; 46760 t.fl = 556; 46761 t.endash = 500; 46762 t.dagger = 500; 46763 t.daggerdbl = 500; 46764 t.periodcentered = 250; 46765 t.paragraph = 500; 46766 t.bullet = 350; 46767 t.quotesinglbase = 333; 46768 t.quotedblbase = 500; 46769 t.quotedblright = 500; 46770 t.guillemotright = 500; 46771 t.ellipsis = 1000; 46772 t.perthousand = 1000; 46773 t.questiondown = 500; 46774 t.grave = 333; 46775 t.acute = 333; 46776 t.circumflex = 333; 46777 t.tilde = 333; 46778 t.macron = 333; 46779 t.breve = 333; 46780 t.dotaccent = 333; 46781 t.dieresis = 333; 46782 t.ring = 333; 46783 t.cedilla = 333; 46784 t.hungarumlaut = 333; 46785 t.ogonek = 333; 46786 t.caron = 333; 46787 t.emdash = 1000; 46788 t.AE = 944; 46789 t.ordfeminine = 266; 46790 t.Lslash = 611; 46791 t.Oslash = 722; 46792 t.OE = 944; 46793 t.ordmasculine = 300; 46794 t.ae = 722; 46795 t.dotlessi = 278; 46796 t.lslash = 278; 46797 t.oslash = 500; 46798 t.oe = 722; 46799 t.germandbls = 500; 46800 t.Idieresis = 389; 46801 t.eacute = 444; 46802 t.abreve = 500; 46803 t.uhungarumlaut = 556; 46804 t.ecaron = 444; 46805 t.Ydieresis = 611; 46806 t.divide = 570; 46807 t.Yacute = 611; 46808 t.Acircumflex = 667; 46809 t.aacute = 500; 46810 t.Ucircumflex = 722; 46811 t.yacute = 444; 46812 t.scommaaccent = 389; 46813 t.ecircumflex = 444; 46814 t.Uring = 722; 46815 t.Udieresis = 722; 46816 t.aogonek = 500; 46817 t.Uacute = 722; 46818 t.uogonek = 556; 46819 t.Edieresis = 667; 46820 t.Dcroat = 722; 46821 t.commaaccent = 250; 46822 t.copyright = 747; 46823 t.Emacron = 667; 46824 t.ccaron = 444; 46825 t.aring = 500; 46826 t.Ncommaaccent = 722; 46827 t.lacute = 278; 46828 t.agrave = 500; 46829 t.Tcommaaccent = 611; 46830 t.Cacute = 667; 46831 t.atilde = 500; 46832 t.Edotaccent = 667; 46833 t.scaron = 389; 46834 t.scedilla = 389; 46835 t.iacute = 278; 46836 t.lozenge = 494; 46837 t.Rcaron = 667; 46838 t.Gcommaaccent = 722; 46839 t.ucircumflex = 556; 46840 t.acircumflex = 500; 46841 t.Amacron = 667; 46842 t.rcaron = 389; 46843 t.ccedilla = 444; 46844 t.Zdotaccent = 611; 46845 t.Thorn = 611; 46846 t.Omacron = 722; 46847 t.Racute = 667; 46848 t.Sacute = 556; 46849 t.dcaron = 608; 46850 t.Umacron = 722; 46851 t.uring = 556; 46852 t.threesuperior = 300; 46853 t.Ograve = 722; 46854 t.Agrave = 667; 46855 t.Abreve = 667; 46856 t.multiply = 570; 46857 t.uacute = 556; 46858 t.Tcaron = 611; 46859 t.partialdiff = 494; 46860 t.ydieresis = 444; 46861 t.Nacute = 722; 46862 t.icircumflex = 278; 46863 t.Ecircumflex = 667; 46864 t.adieresis = 500; 46865 t.edieresis = 444; 46866 t.cacute = 444; 46867 t.nacute = 556; 46868 t.umacron = 556; 46869 t.Ncaron = 722; 46870 t.Iacute = 389; 46871 t.plusminus = 570; 46872 t.brokenbar = 220; 46873 t.registered = 747; 46874 t.Gbreve = 722; 46875 t.Idotaccent = 389; 46876 t.summation = 600; 46877 t.Egrave = 667; 46878 t.racute = 389; 46879 t.omacron = 500; 46880 t.Zacute = 611; 46881 t.Zcaron = 611; 46882 t.greaterequal = 549; 46883 t.Eth = 722; 46884 t.Ccedilla = 667; 46885 t.lcommaaccent = 278; 46886 t.tcaron = 366; 46887 t.eogonek = 444; 46888 t.Uogonek = 722; 46889 t.Aacute = 667; 46890 t.Adieresis = 667; 46891 t.egrave = 444; 46892 t.zacute = 389; 46893 t.iogonek = 278; 46894 t.Oacute = 722; 46895 t.oacute = 500; 46896 t.amacron = 500; 46897 t.sacute = 389; 46898 t.idieresis = 278; 46899 t.Ocircumflex = 722; 46900 t.Ugrave = 722; 46901 t.Delta = 612; 46902 t.thorn = 500; 46903 t.twosuperior = 300; 46904 t.Odieresis = 722; 46905 t.mu = 576; 46906 t.igrave = 278; 46907 t.ohungarumlaut = 500; 46908 t.Eogonek = 667; 46909 t.dcroat = 500; 46910 t.threequarters = 750; 46911 t.Scedilla = 556; 46912 t.lcaron = 382; 46913 t.Kcommaaccent = 667; 46914 t.Lacute = 611; 46915 t.trademark = 1000; 46916 t.edotaccent = 444; 46917 t.Igrave = 389; 46918 t.Imacron = 389; 46919 t.Lcaron = 611; 46920 t.onehalf = 750; 46921 t.lessequal = 549; 46922 t.ocircumflex = 500; 46923 t.ntilde = 556; 46924 t.Uhungarumlaut = 722; 46925 t.Eacute = 667; 46926 t.emacron = 444; 46927 t.gbreve = 500; 46928 t.onequarter = 750; 46929 t.Scaron = 556; 46930 t.Scommaaccent = 556; 46931 t.Ohungarumlaut = 722; 46932 t.degree = 400; 46933 t.ograve = 500; 46934 t.Ccaron = 667; 46935 t.ugrave = 556; 46936 t.radical = 549; 46937 t.Dcaron = 722; 46938 t.rcommaaccent = 389; 46939 t.Ntilde = 722; 46940 t.otilde = 500; 46941 t.Rcommaaccent = 667; 46942 t.Lcommaaccent = 611; 46943 t.Atilde = 667; 46944 t.Aogonek = 667; 46945 t.Aring = 667; 46946 t.Otilde = 722; 46947 t.zdotaccent = 389; 46948 t.Ecaron = 667; 46949 t.Iogonek = 389; 46950 t.kcommaaccent = 500; 46951 t.minus = 606; 46952 t.Icircumflex = 389; 46953 t.ncaron = 556; 46954 t.tcommaaccent = 278; 46955 t.logicalnot = 606; 46956 t.odieresis = 500; 46957 t.udieresis = 556; 46958 t.notequal = 549; 46959 t.gcommaaccent = 500; 46960 t.eth = 500; 46961 t.zcaron = 389; 46962 t.ncommaaccent = 556; 46963 t.onesuperior = 300; 46964 t.imacron = 278; 46965 t.Euro = 500; 46966 }); 46967 t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) { 46968 t.space = 250; 46969 t.exclam = 333; 46970 t.quotedbl = 420; 46971 t.numbersign = 500; 46972 t.dollar = 500; 46973 t.percent = 833; 46974 t.ampersand = 778; 46975 t.quoteright = 333; 46976 t.parenleft = 333; 46977 t.parenright = 333; 46978 t.asterisk = 500; 46979 t.plus = 675; 46980 t.comma = 250; 46981 t.hyphen = 333; 46982 t.period = 250; 46983 t.slash = 278; 46984 t.zero = 500; 46985 t.one = 500; 46986 t.two = 500; 46987 t.three = 500; 46988 t.four = 500; 46989 t.five = 500; 46990 t.six = 500; 46991 t.seven = 500; 46992 t.eight = 500; 46993 t.nine = 500; 46994 t.colon = 333; 46995 t.semicolon = 333; 46996 t.less = 675; 46997 t.equal = 675; 46998 t.greater = 675; 46999 t.question = 500; 47000 t.at = 920; 47001 t.A = 611; 47002 t.B = 611; 47003 t.C = 667; 47004 t.D = 722; 47005 t.E = 611; 47006 t.F = 611; 47007 t.G = 722; 47008 t.H = 722; 47009 t.I = 333; 47010 t.J = 444; 47011 t.K = 667; 47012 t.L = 556;
vendor: 4,861 bytes, lines 47013-47247
47013 t.M = 833; 47014 t.N = 667; 47015 t.O = 722; 47016 t.P = 611; 47017 t.Q = 722; 47018 t.R = 611; 47019 t.S = 500; 47020 t.T = 556; 47021 t.U = 722; 47022 t.V = 611; 47023 t.W = 833; 47024 t.X = 611; 47025 t.Y = 556; 47026 t.Z = 556; 47027 t.bracketleft = 389; 47028 t.backslash = 278; 47029 t.bracketright = 389; 47030 t.asciicircum = 422; 47031 t.underscore = 500; 47032 t.quoteleft = 333; 47033 t.a = 500; 47034 t.b = 500; 47035 t.c = 444; 47036 t.d = 500; 47037 t.e = 444; 47038 t.f = 278; 47039 t.g = 500; 47040 t.h = 500; 47041 t.i = 278; 47042 t.j = 278; 47043 t.k = 444; 47044 t.l = 278; 47045 t.m = 722; 47046 t.n = 500; 47047 t.o = 500; 47048 t.p = 500; 47049 t.q = 500; 47050 t.r = 389; 47051 t.s = 389; 47052 t.t = 278; 47053 t.u = 500; 47054 t.v = 444; 47055 t.w = 667; 47056 t.x = 444; 47057 t.y = 444; 47058 t.z = 389; 47059 t.braceleft = 400; 47060 t.bar = 275; 47061 t.braceright = 400; 47062 t.asciitilde = 541; 47063 t.exclamdown = 389; 47064 t.cent = 500; 47065 t.sterling = 500; 47066 t.fraction = 167; 47067 t.yen = 500; 47068 t.florin = 500; 47069 t.section = 500; 47070 t.currency = 500; 47071 t.quotesingle = 214; 47072 t.quotedblleft = 556; 47073 t.guillemotleft = 500; 47074 t.guilsinglleft = 333; 47075 t.guilsinglright = 333; 47076 t.fi = 500; 47077 t.fl = 500; 47078 t.endash = 500; 47079 t.dagger = 500; 47080 t.daggerdbl = 500; 47081 t.periodcentered = 250; 47082 t.paragraph = 523; 47083 t.bullet = 350; 47084 t.quotesinglbase = 333; 47085 t.quotedblbase = 556; 47086 t.quotedblright = 556; 47087 t.guillemotright = 500; 47088 t.ellipsis = 889; 47089 t.perthousand = 1000; 47090 t.questiondown = 500; 47091 t.grave = 333; 47092 t.acute = 333; 47093 t.circumflex = 333; 47094 t.tilde = 333; 47095 t.macron = 333; 47096 t.breve = 333; 47097 t.dotaccent = 333; 47098 t.dieresis = 333; 47099 t.ring = 333; 47100 t.cedilla = 333; 47101 t.hungarumlaut = 333; 47102 t.ogonek = 333; 47103 t.caron = 333; 47104 t.emdash = 889; 47105 t.AE = 889; 47106 t.ordfeminine = 276; 47107 t.Lslash = 556; 47108 t.Oslash = 722; 47109 t.OE = 944; 47110 t.ordmasculine = 310; 47111 t.ae = 667; 47112 t.dotlessi = 278; 47113 t.lslash = 278; 47114 t.oslash = 500; 47115 t.oe = 667; 47116 t.germandbls = 500; 47117 t.Idieresis = 333; 47118 t.eacute = 444; 47119 t.abreve = 500; 47120 t.uhungarumlaut = 500; 47121 t.ecaron = 444; 47122 t.Ydieresis = 556; 47123 t.divide = 675; 47124 t.Yacute = 556; 47125 t.Acircumflex = 611; 47126 t.aacute = 500; 47127 t.Ucircumflex = 722; 47128 t.yacute = 444; 47129 t.scommaaccent = 389; 47130 t.ecircumflex = 444; 47131 t.Uring = 722; 47132 t.Udieresis = 722; 47133 t.aogonek = 500; 47134 t.Uacute = 722; 47135 t.uogonek = 500; 47136 t.Edieresis = 611; 47137 t.Dcroat = 722; 47138 t.commaaccent = 250; 47139 t.copyright = 760; 47140 t.Emacron = 611; 47141 t.ccaron = 444; 47142 t.aring = 500; 47143 t.Ncommaaccent = 667; 47144 t.lacute = 278; 47145 t.agrave = 500; 47146 t.Tcommaaccent = 556; 47147 t.Cacute = 667; 47148 t.atilde = 500; 47149 t.Edotaccent = 611; 47150 t.scaron = 389; 47151 t.scedilla = 389; 47152 t.iacute = 278; 47153 t.lozenge = 471; 47154 t.Rcaron = 611; 47155 t.Gcommaaccent = 722; 47156 t.ucircumflex = 500; 47157 t.acircumflex = 500; 47158 t.Amacron = 611; 47159 t.rcaron = 389; 47160 t.ccedilla = 444; 47161 t.Zdotaccent = 556; 47162 t.Thorn = 611; 47163 t.Omacron = 722; 47164 t.Racute = 611; 47165 t.Sacute = 500; 47166 t.dcaron = 544; 47167 t.Umacron = 722; 47168 t.uring = 500; 47169 t.threesuperior = 300; 47170 t.Ograve = 722; 47171 t.Agrave = 611; 47172 t.Abreve = 611; 47173 t.multiply = 675; 47174 t.uacute = 500; 47175 t.Tcaron = 556; 47176 t.partialdiff = 476; 47177 t.ydieresis = 444; 47178 t.Nacute = 667; 47179 t.icircumflex = 278; 47180 t.Ecircumflex = 611; 47181 t.adieresis = 500; 47182 t.edieresis = 444; 47183 t.cacute = 444; 47184 t.nacute = 500; 47185 t.umacron = 500; 47186 t.Ncaron = 667; 47187 t.Iacute = 333; 47188 t.plusminus = 675; 47189 t.brokenbar = 275; 47190 t.registered = 760; 47191 t.Gbreve = 722; 47192 t.Idotaccent = 333; 47193 t.summation = 600; 47194 t.Egrave = 611; 47195 t.racute = 389; 47196 t.omacron = 500; 47197 t.Zacute = 556; 47198 t.Zcaron = 556; 47199 t.greaterequal = 549; 47200 t.Eth = 722; 47201 t.Ccedilla = 667; 47202 t.lcommaaccent = 278; 47203 t.tcaron = 300; 47204 t.eogonek = 444; 47205 t.Uogonek = 722; 47206 t.Aacute = 611; 47207 t.Adieresis = 611; 47208 t.egrave = 444; 47209 t.zacute = 389; 47210 t.iogonek = 278; 47211 t.Oacute = 722; 47212 t.oacute = 500; 47213 t.amacron = 500; 47214 t.sacute = 389; 47215 t.idieresis = 278; 47216 t.Ocircumflex = 722; 47217 t.Ugrave = 722; 47218 t.Delta = 612; 47219 t.thorn = 500; 47220 t.twosuperior = 300; 47221 t.Odieresis = 722; 47222 t.mu = 500; 47223 t.igrave = 278; 47224 t.ohungarumlaut = 500; 47225 t.Eogonek = 611; 47226 t.dcroat = 500; 47227 t.threequarters = 750; 47228 t.Scedilla = 500; 47229 t.lcaron = 300; 47230 t.Kcommaaccent = 667; 47231 t.Lacute = 556; 47232 t.trademark = 980; 47233 t.edotaccent = 444; 47234 t.Igrave = 333; 47235 t.Imacron = 333; 47236 t.Lcaron = 611; 47237 t.onehalf = 750; 47238 t.lessequal = 549; 47239 t.ocircumflex = 500; 47240 t.ntilde = 500; 47241 t.Uhungarumlaut = 722; 47242 t.Eacute = 611; 47243 t.emacron = 444; 47244 t.gbreve = 500; 47245 t.onequarter = 750; 47246 t.Scaron = 500; 47247 t.Scommaaccent = 500;
vendor: 6,045 bytes, lines 47248-47579
47248 t.Ohungarumlaut = 722; 47249 t.degree = 400; 47250 t.ograve = 500; 47251 t.Ccaron = 667; 47252 t.ugrave = 500; 47253 t.radical = 453; 47254 t.Dcaron = 722; 47255 t.rcommaaccent = 389; 47256 t.Ntilde = 667; 47257 t.otilde = 500; 47258 t.Rcommaaccent = 611; 47259 t.Lcommaaccent = 556; 47260 t.Atilde = 611; 47261 t.Aogonek = 611; 47262 t.Aring = 611; 47263 t.Otilde = 722; 47264 t.zdotaccent = 389; 47265 t.Ecaron = 611; 47266 t.Iogonek = 333; 47267 t.kcommaaccent = 444; 47268 t.minus = 675; 47269 t.Icircumflex = 333; 47270 t.ncaron = 500; 47271 t.tcommaaccent = 278; 47272 t.logicalnot = 675; 47273 t.odieresis = 500; 47274 t.udieresis = 500; 47275 t.notequal = 549; 47276 t.gcommaaccent = 500; 47277 t.eth = 500; 47278 t.zcaron = 389; 47279 t.ncommaaccent = 500; 47280 t.onesuperior = 300; 47281 t.imacron = 278; 47282 t.Euro = 500; 47283 }); 47284 t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) { 47285 t.space = 278; 47286 t.a1 = 974; 47287 t.a2 = 961; 47288 t.a202 = 974; 47289 t.a3 = 980; 47290 t.a4 = 719; 47291 t.a5 = 789; 47292 t.a119 = 790; 47293 t.a118 = 791; 47294 t.a117 = 690; 47295 t.a11 = 960; 47296 t.a12 = 939; 47297 t.a13 = 549; 47298 t.a14 = 855; 47299 t.a15 = 911; 47300 t.a16 = 933; 47301 t.a105 = 911; 47302 t.a17 = 945; 47303 t.a18 = 974; 47304 t.a19 = 755; 47305 t.a20 = 846; 47306 t.a21 = 762; 47307 t.a22 = 761; 47308 t.a23 = 571; 47309 t.a24 = 677; 47310 t.a25 = 763; 47311 t.a26 = 760; 47312 t.a27 = 759; 47313 t.a28 = 754; 47314 t.a6 = 494; 47315 t.a7 = 552; 47316 t.a8 = 537; 47317 t.a9 = 577; 47318 t.a10 = 692; 47319 t.a29 = 786; 47320 t.a30 = 788; 47321 t.a31 = 788; 47322 t.a32 = 790; 47323 t.a33 = 793; 47324 t.a34 = 794; 47325 t.a35 = 816; 47326 t.a36 = 823; 47327 t.a37 = 789; 47328 t.a38 = 841; 47329 t.a39 = 823; 47330 t.a40 = 833; 47331 t.a41 = 816; 47332 t.a42 = 831; 47333 t.a43 = 923; 47334 t.a44 = 744; 47335 t.a45 = 723; 47336 t.a46 = 749; 47337 t.a47 = 790; 47338 t.a48 = 792; 47339 t.a49 = 695; 47340 t.a50 = 776; 47341 t.a51 = 768; 47342 t.a52 = 792; 47343 t.a53 = 759; 47344 t.a54 = 707; 47345 t.a55 = 708; 47346 t.a56 = 682; 47347 t.a57 = 701; 47348 t.a58 = 826; 47349 t.a59 = 815; 47350 t.a60 = 789; 47351 t.a61 = 789; 47352 t.a62 = 707; 47353 t.a63 = 687; 47354 t.a64 = 696; 47355 t.a65 = 689; 47356 t.a66 = 786; 47357 t.a67 = 787; 47358 t.a68 = 713; 47359 t.a69 = 791; 47360 t.a70 = 785; 47361 t.a71 = 791; 47362 t.a72 = 873; 47363 t.a73 = 761; 47364 t.a74 = 762; 47365 t.a203 = 762; 47366 t.a75 = 759; 47367 t.a204 = 759; 47368 t.a76 = 892; 47369 t.a77 = 892; 47370 t.a78 = 788; 47371 t.a79 = 784; 47372 t.a81 = 438; 47373 t.a82 = 138; 47374 t.a83 = 277; 47375 t.a84 = 415; 47376 t.a97 = 392; 47377 t.a98 = 392; 47378 t.a99 = 668; 47379 t.a100 = 668; 47380 t.a89 = 390; 47381 t.a90 = 390; 47382 t.a93 = 317; 47383 t.a94 = 317; 47384 t.a91 = 276; 47385 t.a92 = 276; 47386 t.a205 = 509; 47387 t.a85 = 509; 47388 t.a206 = 410; 47389 t.a86 = 410; 47390 t.a87 = 234; 47391 t.a88 = 234; 47392 t.a95 = 334; 47393 t.a96 = 334; 47394 t.a101 = 732; 47395 t.a102 = 544; 47396 t.a103 = 544; 47397 t.a104 = 910; 47398 t.a106 = 667; 47399 t.a107 = 760; 47400 t.a108 = 760; 47401 t.a112 = 776; 47402 t.a111 = 595; 47403 t.a110 = 694; 47404 t.a109 = 626; 47405 t.a120 = 788; 47406 t.a121 = 788; 47407 t.a122 = 788; 47408 t.a123 = 788; 47409 t.a124 = 788; 47410 t.a125 = 788; 47411 t.a126 = 788; 47412 t.a127 = 788; 47413 t.a128 = 788; 47414 t.a129 = 788; 47415 t.a130 = 788; 47416 t.a131 = 788; 47417 t.a132 = 788; 47418 t.a133 = 788; 47419 t.a134 = 788; 47420 t.a135 = 788; 47421 t.a136 = 788; 47422 t.a137 = 788; 47423 t.a138 = 788; 47424 t.a139 = 788; 47425 t.a140 = 788; 47426 t.a141 = 788; 47427 t.a142 = 788; 47428 t.a143 = 788; 47429 t.a144 = 788; 47430 t.a145 = 788; 47431 t.a146 = 788; 47432 t.a147 = 788; 47433 t.a148 = 788; 47434 t.a149 = 788; 47435 t.a150 = 788; 47436 t.a151 = 788; 47437 t.a152 = 788; 47438 t.a153 = 788; 47439 t.a154 = 788; 47440 t.a155 = 788; 47441 t.a156 = 788; 47442 t.a157 = 788; 47443 t.a158 = 788; 47444 t.a159 = 788; 47445 t.a160 = 894; 47446 t.a161 = 838; 47447 t.a163 = 1016; 47448 t.a164 = 458; 47449 t.a196 = 748; 47450 t.a165 = 924; 47451 t.a192 = 748; 47452 t.a166 = 918; 47453 t.a167 = 927; 47454 t.a168 = 928; 47455 t.a169 = 928; 47456 t.a170 = 834; 47457 t.a171 = 873; 47458 t.a172 = 828; 47459 t.a173 = 924; 47460 t.a162 = 924; 47461 t.a174 = 917; 47462 t.a175 = 930; 47463 t.a176 = 931; 47464 t.a177 = 463; 47465 t.a178 = 883; 47466 t.a179 = 836; 47467 t.a193 = 836; 47468 t.a180 = 867; 47469 t.a199 = 867; 47470 t.a181 = 696; 47471 t.a200 = 696; 47472 t.a182 = 874; 47473 t.a201 = 874; 47474 t.a183 = 760; 47475 t.a184 = 946; 47476 t.a197 = 771; 47477 t.a185 = 865; 47478 t.a194 = 771; 47479 t.a198 = 888; 47480 t.a186 = 967; 47481 t.a195 = 888; 47482 t.a187 = 831; 47483 t.a188 = 873; 47484 t.a189 = 927; 47485 t.a190 = 970; 47486 t.a191 = 918; 47487 }); 47488}); 47489exports.getMetrics = getMetrics; 47490const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) { 47491 t.Courier = { 47492 ascent: 629, 47493 descent: -157, 47494 capHeight: 562, 47495 xHeight: -426 47496 }; 47497 t["Courier-Bold"] = { 47498 ascent: 629, 47499 descent: -157, 47500 capHeight: 562, 47501 xHeight: 439 47502 }; 47503 t["Courier-Oblique"] = { 47504 ascent: 629, 47505 descent: -157, 47506 capHeight: 562, 47507 xHeight: 426 47508 }; 47509 t["Courier-BoldOblique"] = { 47510 ascent: 629, 47511 descent: -157, 47512 capHeight: 562, 47513 xHeight: 426 47514 }; 47515 t.Helvetica = { 47516 ascent: 718, 47517 descent: -207, 47518 capHeight: 718, 47519 xHeight: 523 47520 }; 47521 t["Helvetica-Bold"] = { 47522 ascent: 718, 47523 descent: -207, 47524 capHeight: 718, 47525 xHeight: 532 47526 }; 47527 t["Helvetica-Oblique"] = { 47528 ascent: 718, 47529 descent: -207, 47530 capHeight: 718, 47531 xHeight: 523 47532 }; 47533 t["Helvetica-BoldOblique"] = { 47534 ascent: 718, 47535 descent: -207, 47536 capHeight: 718, 47537 xHeight: 532 47538 }; 47539 t["Times-Roman"] = { 47540 ascent: 683, 47541 descent: -217, 47542 capHeight: 662, 47543 xHeight: 450 47544 }; 47545 t["Times-Bold"] = { 47546 ascent: 683, 47547 descent: -217, 47548 capHeight: 676, 47549 xHeight: 461 47550 }; 47551 t["Times-Italic"] = { 47552 ascent: 683, 47553 descent: -217, 47554 capHeight: 653, 47555 xHeight: 441 47556 }; 47557 t["Times-BoldItalic"] = { 47558 ascent: 683, 47559 descent: -217, 47560 capHeight: 669, 47561 xHeight: 462 47562 }; 47563 t.Symbol = { 47564 ascent: Math.NaN, 47565 descent: Math.NaN, 47566 capHeight: Math.NaN, 47567 xHeight: Math.NaN 47568 }; 47569 t.ZapfDingbats = { 47570 ascent: Math.NaN, 47571 descent: Math.NaN, 47572 capHeight: Math.NaN, 47573 xHeight: Math.NaN 47574 }; 47575}); 47576exports.getFontBasicMetrics = getFontBasicMetrics; 47577 47578/***/ }), 47579/* 4
vendor: 73,687 bytes, lines 47579-50429
475796 */ 47580/***/ ((__unused_webpack_module, exports) => { 47581 47582 47583 47584Object.defineProperty(exports, "__esModule", ({ 47585 value: true 47586})); 47587exports.GlyfTable = void 0; 47588const ON_CURVE_POINT = 1 << 0; 47589const X_SHORT_VECTOR = 1 << 1; 47590const Y_SHORT_VECTOR = 1 << 2; 47591const REPEAT_FLAG = 1 << 3; 47592const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4; 47593const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5; 47594const OVERLAP_SIMPLE = 1 << 6; 47595const ARG_1_AND_2_ARE_WORDS = 1 << 0; 47596const ARGS_ARE_XY_VALUES = 1 << 1; 47597const WE_HAVE_A_SCALE = 1 << 3; 47598const MORE_COMPONENTS = 1 << 5; 47599const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6; 47600const WE_HAVE_A_TWO_BY_TWO = 1 << 7; 47601const WE_HAVE_INSTRUCTIONS = 1 << 8; 47602 47603class GlyfTable { 47604 constructor({ 47605 glyfTable, 47606 isGlyphLocationsLong, 47607 locaTable, 47608 numGlyphs 47609 }) { 47610 this.glyphs = []; 47611 const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength); 47612 const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength); 47613 const offsetSize = isGlyphLocationsLong ? 4 : 2; 47614 let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0); 47615 let pos = 0; 47616 47617 for (let i = 0; i < numGlyphs; i++) { 47618 pos += offsetSize; 47619 const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos); 47620 47621 if (next === prev) { 47622 this.glyphs.push(new Glyph({})); 47623 continue; 47624 } 47625 47626 const glyph = Glyph.parse(prev, glyf); 47627 this.glyphs.push(glyph); 47628 prev = next; 47629 } 47630 } 47631 47632 getSize() { 47633 return this.glyphs.reduce((a, g) => { 47634 const size = g.getSize(); 47635 return a + (size + 3 & ~3); 47636 }, 0); 47637 } 47638 47639 write() { 47640 const totalSize = this.getSize(); 47641 const glyfTable = new DataView(new ArrayBuffer(totalSize)); 47642 const isLocationLong = totalSize > 0x1fffe; 47643 const offsetSize = isLocationLong ? 4 : 2; 47644 const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize)); 47645 47646 if (isLocationLong) { 47647 locaTable.setUint32(0, 0); 47648 } else { 47649 locaTable.setUint16(0, 0); 47650 } 47651 47652 let pos = 0; 47653 let locaIndex = 0; 47654 47655 for (const glyph of this.glyphs) { 47656 pos += glyph.write(pos, glyfTable); 47657 pos = pos + 3 & ~3; 47658 locaIndex += offsetSize; 47659 47660 if (isLocationLong) { 47661 locaTable.setUint32(locaIndex, pos); 47662 } else { 47663 locaTable.setUint16(locaIndex, pos >> 1); 47664 } 47665 } 47666 47667 return { 47668 isLocationLong, 47669 loca: new Uint8Array(locaTable.buffer), 47670 glyf: new Uint8Array(glyfTable.buffer) 47671 }; 47672 } 47673 47674 scale(factors) { 47675 for (let i = 0, ii = this.glyphs.length; i < ii; i++) { 47676 this.glyphs[i].scale(factors[i]); 47677 } 47678 } 47679 47680} 47681 47682exports.GlyfTable = GlyfTable; 47683 47684class Glyph { 47685 constructor({ 47686 header = null, 47687 simple = null, 47688 composites = null 47689 }) { 47690 this.header = header; 47691 this.simple = simple; 47692 this.composites = composites; 47693 } 47694 47695 static parse(pos, glyf) { 47696 const [read, header] = GlyphHeader.parse(pos, glyf); 47697 pos += read; 47698 47699 if (header.numberOfContours < 0) { 47700 const composites = []; 47701 47702 while (true) { 47703 const [n, composite] = CompositeGlyph.parse(pos, glyf); 47704 pos += n; 47705 composites.push(composite); 47706 47707 if (!(composite.flags & MORE_COMPONENTS)) { 47708 break; 47709 } 47710 } 47711 47712 return new Glyph({ 47713 header, 47714 composites 47715 }); 47716 } 47717 47718 const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours); 47719 return new Glyph({ 47720 header, 47721 simple 47722 }); 47723 } 47724 47725 getSize() { 47726 if (!this.header) { 47727 return 0; 47728 } 47729 47730 const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0); 47731 return this.header.getSize() + size; 47732 } 47733 47734 write(pos, buf) { 47735 if (!this.header) { 47736 return 0; 47737 } 47738 47739 const spos = pos; 47740 pos += this.header.write(pos, buf); 47741 47742 if (this.simple) { 47743 pos += this.simple.write(pos, buf); 47744 } else { 47745 for (const composite of this.composites) { 47746 pos += composite.write(pos, buf); 47747 } 47748 } 47749 47750 return pos - spos; 47751 } 47752 47753 scale(factor) { 47754 if (!this.header) { 47755 return; 47756 } 47757 47758 const xMiddle = (this.header.xMin + this.header.xMax) / 2; 47759 this.header.scale(xMiddle, factor); 47760 47761 if (this.simple) { 47762 this.simple.scale(xMiddle, factor); 47763 } else { 47764 for (const composite of this.composites) { 47765 composite.scale(xMiddle, factor); 47766 } 47767 } 47768 } 47769 47770} 47771 47772class GlyphHeader { 47773 constructor({ 47774 numberOfContours, 47775 xMin, 47776 yMin, 47777 xMax, 47778 yMax 47779 }) { 47780 this.numberOfContours = numberOfContours; 47781 this.xMin = xMin; 47782 this.yMin = yMin; 47783 this.xMax = xMax; 47784 this.yMax = yMax; 47785 } 47786 47787 static parse(pos, glyf) { 47788 return [10, new GlyphHeader({ 47789 numberOfContours: glyf.getInt16(pos), 47790 xMin: glyf.getInt16(pos + 2), 47791 yMin: glyf.getInt16(pos + 4), 47792 xMax: glyf.getInt16(pos + 6), 47793 yMax: glyf.getInt16(pos + 8) 47794 })]; 47795 } 47796 47797 getSize() { 47798 return 10; 47799 } 47800 47801 write(pos, buf) { 47802 buf.setInt16(pos, this.numberOfContours); 47803 buf.setInt16(pos + 2, this.xMin); 47804 buf.setInt16(pos + 4, this.yMin); 47805 buf.setInt16(pos + 6, this.xMax); 47806 buf.setInt16(pos + 8, this.yMax); 47807 return 10; 47808 } 47809 47810 scale(x, factor) { 47811 this.xMin = Math.round(x + (this.xMin - x) * factor); 47812 this.xMax = Math.round(x + (this.xMax - x) * factor); 47813 } 47814 47815} 47816 47817class Contour { 47818 constructor({ 47819 flags, 47820 xCoordinates, 47821 yCoordinates 47822 }) { 47823 this.xCoordinates = xCoordinates; 47824 this.yCoordinates = yCoordinates; 47825 this.flags = flags; 47826 } 47827 47828} 47829 47830class SimpleGlyph { 47831 constructor({ 47832 contours, 47833 instructions 47834 }) { 47835 this.contours = contours; 47836 this.instructions = instructions; 47837 } 47838 47839 static parse(pos, glyf, numberOfContours) { 47840 const endPtsOfContours = []; 47841 47842 for (let i = 0; i < numberOfContours; i++) { 47843 const endPt = glyf.getUint16(pos); 47844 pos += 2; 47845 endPtsOfContours.push(endPt); 47846 } 47847 47848 const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1; 47849 const instructionLength = glyf.getUint16(pos); 47850 pos += 2; 47851 const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); 47852 pos += instructionLength; 47853 const flags = []; 47854 47855 for (let i = 0; i < numberOfPt; pos++, i++) { 47856 let flag = glyf.getUint8(pos); 47857 flags.push(flag); 47858 47859 if (flag & REPEAT_FLAG) { 47860 const count = glyf.getUint8(++pos); 47861 flag ^= REPEAT_FLAG; 47862 47863 for (let m = 0; m < count; m++) { 47864 flags.push(flag); 47865 } 47866 47867 i += count; 47868 } 47869 } 47870 47871 const allXCoordinates = []; 47872 let xCoordinates = []; 47873 let yCoordinates = []; 47874 let pointFlags = []; 47875 const contours = []; 47876 let endPtsOfContoursIndex = 0; 47877 let lastCoordinate = 0; 47878 47879 for (let i = 0; i < numberOfPt; i++) { 47880 const flag = flags[i]; 47881 47882 if (flag & X_SHORT_VECTOR) { 47883 const x = glyf.getUint8(pos++); 47884 lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x; 47885 xCoordinates.push(lastCoordinate); 47886 } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) { 47887 xCoordinates.push(lastCoordinate); 47888 } else { 47889 lastCoordinate += glyf.getInt16(pos); 47890 pos += 2; 47891 xCoordinates.push(lastCoordinate); 47892 } 47893 47894 if (endPtsOfContours[endPtsOfContoursIndex] === i) { 47895 endPtsOfContoursIndex++; 47896 allXCoordinates.push(xCoordinates); 47897 xCoordinates = []; 47898 } 47899 } 47900 47901 lastCoordinate = 0; 47902 endPtsOfContoursIndex = 0; 47903 47904 for (let i = 0; i < numberOfPt; i++) { 47905 const flag = flags[i]; 47906 47907 if (flag & Y_SHORT_VECTOR) { 47908 const y = glyf.getUint8(pos++); 47909 lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y; 47910 yCoordinates.push(lastCoordinate); 47911 } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) { 47912 yCoordinates.push(lastCoordinate); 47913 } else { 47914 lastCoordinate += glyf.getInt16(pos); 47915 pos += 2; 47916 yCoordinates.push(lastCoordinate); 47917 } 47918 47919 pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE); 47920 47921 if (endPtsOfContours[endPtsOfContoursIndex] === i) { 47922 xCoordinates = allXCoordinates[endPtsOfContoursIndex]; 47923 endPtsOfContoursIndex++; 47924 contours.push(new Contour({ 47925 flags: pointFlags, 47926 xCoordinates, 47927 yCoordinates 47928 })); 47929 yCoordinates = []; 47930 pointFlags = []; 47931 } 47932 } 47933 47934 return new SimpleGlyph({ 47935 contours, 47936 instructions 47937 }); 47938 } 47939 47940 getSize() { 47941 let size = this.contours.length * 2 + 2 + this.instructions.length; 47942 let lastX = 0; 47943 let lastY = 0; 47944 47945 for (const contour of this.contours) { 47946 size += contour.flags.length; 47947 47948 for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { 47949 const x = contour.xCoordinates[i]; 47950 const y = contour.yCoordinates[i]; 47951 let abs = Math.abs(x - lastX); 47952 47953 if (abs > 255) { 47954 size += 2; 47955 } else if (abs > 0) { 47956 size += 1; 47957 } 47958 47959 lastX = x; 47960 abs = Math.abs(y - lastY); 47961 47962 if (abs > 255) { 47963 size += 2; 47964 } else if (abs > 0) { 47965 size += 1; 47966 } 47967 47968 lastY = y; 47969 } 47970 } 47971 47972 return size; 47973 } 47974 47975 write(pos, buf) { 47976 const spos = pos; 47977 const xCoordinates = []; 47978 const yCoordinates = []; 47979 const flags = []; 47980 let lastX = 0; 47981 let lastY = 0; 47982 47983 for (const contour of this.contours) { 47984 for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { 47985 let flag = contour.flags[i]; 47986 const x = contour.xCoordinates[i]; 47987 let delta = x - lastX; 47988 47989 if (delta === 0) { 47990 flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR; 47991 xCoordinates.push(0); 47992 } else { 47993 const abs = Math.abs(delta); 47994 47995 if (abs <= 255) { 47996 flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR; 47997 xCoordinates.push(abs); 47998 } else { 47999 xCoordinates.push(delta); 48000 } 48001 } 48002 48003 lastX = x; 48004 const y = contour.yCoordinates[i]; 48005 delta = y - lastY; 48006 48007 if (delta === 0) { 48008 flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR; 48009 yCoordinates.push(0); 48010 } else { 48011 const abs = Math.abs(delta); 48012 48013 if (abs <= 255) { 48014 flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR; 48015 yCoordinates.push(abs); 48016 } else { 48017 yCoordinates.push(delta); 48018 } 48019 } 48020 48021 lastY = y; 48022 flags.push(flag); 48023 } 48024 48025 buf.setUint16(pos, xCoordinates.length - 1); 48026 pos += 2; 48027 } 48028 48029 buf.setUint16(pos, this.instructions.length); 48030 pos += 2; 48031 48032 if (this.instructions.length) { 48033 new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos); 48034 pos += this.instructions.length; 48035 } 48036 48037 for (const flag of flags) { 48038 buf.setUint8(pos++, flag); 48039 } 48040 48041 for (let i = 0, ii = xCoordinates.length; i < ii; i++) { 48042 const x = xCoordinates[i]; 48043 const flag = flags[i]; 48044 48045 if (flag & X_SHORT_VECTOR) { 48046 buf.setUint8(pos++, x); 48047 } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) { 48048 buf.setInt16(pos, x); 48049 pos += 2; 48050 } 48051 } 48052 48053 for (let i = 0, ii = yCoordinates.length; i < ii; i++) { 48054 const y = yCoordinates[i]; 48055 const flag = flags[i]; 48056 48057 if (flag & Y_SHORT_VECTOR) { 48058 buf.setUint8(pos++, y); 48059 } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) { 48060 buf.setInt16(pos, y); 48061 pos += 2; 48062 } 48063 } 48064 48065 return pos - spos; 48066 } 48067 48068 scale(x, factor) { 48069 for (const contour of this.contours) { 48070 if (contour.xCoordinates.length === 0) { 48071 continue; 48072 } 48073 48074 for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { 48075 contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor); 48076 } 48077 } 48078 } 48079 48080} 48081 48082class CompositeGlyph { 48083 constructor({ 48084 flags, 48085 glyphIndex, 48086 argument1, 48087 argument2, 48088 transf, 48089 instructions 48090 }) { 48091 this.flags = flags; 48092 this.glyphIndex = glyphIndex; 48093 this.argument1 = argument1; 48094 this.argument2 = argument2; 48095 this.transf = transf; 48096 this.instructions = instructions; 48097 } 48098 48099 static parse(pos, glyf) { 48100 const spos = pos; 48101 const transf = []; 48102 let flags = glyf.getUint16(pos); 48103 const glyphIndex = glyf.getUint16(pos + 2); 48104 pos += 4; 48105 let argument1, argument2; 48106 48107 if (flags & ARG_1_AND_2_ARE_WORDS) { 48108 if (flags & ARGS_ARE_XY_VALUES) { 48109 argument1 = glyf.getInt16(pos); 48110 argument2 = glyf.getInt16(pos + 2); 48111 } else { 48112 argument1 = glyf.getUint16(pos); 48113 argument2 = glyf.getUint16(pos + 2); 48114 } 48115 48116 pos += 4; 48117 flags ^= ARG_1_AND_2_ARE_WORDS; 48118 } else { 48119 if (flags & ARGS_ARE_XY_VALUES) { 48120 argument1 = glyf.getInt8(pos); 48121 argument2 = glyf.getInt8(pos + 1); 48122 } else { 48123 argument1 = glyf.getUint8(pos); 48124 argument2 = glyf.getUint8(pos + 1); 48125 } 48126 48127 pos += 2; 48128 } 48129 48130 if (flags & WE_HAVE_A_SCALE) { 48131 transf.push(glyf.getUint16(pos)); 48132 pos += 2; 48133 } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { 48134 transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2)); 48135 pos += 4; 48136 } else if (flags & WE_HAVE_A_TWO_BY_TWO) { 48137 transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6)); 48138 pos += 8; 48139 } 48140 48141 let instructions = null; 48142 48143 if (flags & WE_HAVE_INSTRUCTIONS) { 48144 const instructionLength = glyf.getUint16(pos); 48145 pos += 2; 48146 instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); 48147 pos += instructionLength; 48148 } 48149 48150 return [pos - spos, new CompositeGlyph({ 48151 flags, 48152 glyphIndex, 48153 argument1, 48154 argument2, 48155 transf, 48156 instructions 48157 })]; 48158 } 48159 48160 getSize() { 48161 let size = 2 + 2 + this.transf.length * 2; 48162 48163 if (this.flags & WE_HAVE_INSTRUCTIONS) { 48164 size += 2 + this.instructions.length; 48165 } 48166 48167 size += 2; 48168 48169 if (this.flags & 2) { 48170 if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) { 48171 size += 2; 48172 } 48173 } else { 48174 if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) { 48175 size += 2; 48176 } 48177 } 48178 48179 return size; 48180 } 48181 48182 write(pos, buf) { 48183 const spos = pos; 48184 48185 if (this.flags & ARGS_ARE_XY_VALUES) { 48186 if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) { 48187 this.flags |= ARG_1_AND_2_ARE_WORDS; 48188 } 48189 } else { 48190 if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) { 48191 this.flags |= ARG_1_AND_2_ARE_WORDS; 48192 } 48193 } 48194 48195 buf.setUint16(pos, this.flags); 48196 buf.setUint16(pos + 2, this.glyphIndex); 48197 pos += 4; 48198 48199 if (this.flags & ARG_1_AND_2_ARE_WORDS) { 48200 if (this.flags & ARGS_ARE_XY_VALUES) { 48201 buf.setInt16(pos, this.argument1); 48202 buf.setInt16(pos + 2, this.argument2); 48203 } else { 48204 buf.setUint16(pos, this.argument1); 48205 buf.setUint16(pos + 2, this.argument2); 48206 } 48207 48208 pos += 4; 48209 } else { 48210 buf.setUint8(pos, this.argument1); 48211 buf.setUint8(pos + 1, this.argument2); 48212 pos += 2; 48213 } 48214 48215 if (this.flags & WE_HAVE_INSTRUCTIONS) { 48216 buf.setUint16(pos, this.instructions.length); 48217 pos += 2; 48218 48219 if (this.instructions.length) { 48220 new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos); 48221 pos += this.instructions.length; 48222 } 48223 } 48224 48225 return pos - spos; 48226 } 48227 48228 scale(x, factor) {} 48229 48230} 48231 48232/***/ }), 48233/* 47 */ 48234/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 48235 48236 48237 48238Object.defineProperty(exports, "__esModule", ({ 48239 value: true 48240})); 48241exports.OpenTypeFileBuilder = void 0; 48242 48243var _core_utils = __w_pdfjs_require__(6); 48244 48245var _util = __w_pdfjs_require__(2); 48246 48247function writeInt16(dest, offset, num) { 48248 dest[offset] = num >> 8 & 0xff; 48249 dest[offset + 1] = num & 0xff; 48250} 48251 48252function writeInt32(dest, offset, num) { 48253 dest[offset] = num >> 24 & 0xff; 48254 dest[offset + 1] = num >> 16 & 0xff; 48255 dest[offset + 2] = num >> 8 & 0xff; 48256 dest[offset + 3] = num & 0xff; 48257} 48258 48259function writeData(dest, offset, data) { 48260 if (data instanceof Uint8Array) { 48261 dest.set(data, offset); 48262 } else if (typeof data === "string") { 48263 for (let i = 0, ii = data.length; i < ii; i++) { 48264 dest[offset++] = data.charCodeAt(i) & 0xff; 48265 } 48266 } else { 48267 for (let i = 0, ii = data.length; i < ii; i++) { 48268 dest[offset++] = data[i] & 0xff; 48269 } 48270 } 48271} 48272 48273const OTF_HEADER_SIZE = 12; 48274const OTF_TABLE_ENTRY_SIZE = 16; 48275 48276class OpenTypeFileBuilder { 48277 constructor(sfnt) { 48278 this.sfnt = sfnt; 48279 this.tables = Object.create(null); 48280 } 48281 48282 static getSearchParams(entriesCount, entrySize) { 48283 let maxPower2 = 1, 48284 log2 = 0; 48285 48286 while ((maxPower2 ^ entriesCount) > maxPower2) { 48287 maxPower2 <<= 1; 48288 log2++; 48289 } 48290 48291 const searchRange = maxPower2 * entrySize; 48292 return { 48293 range: searchRange, 48294 entry: log2, 48295 rangeShift: entrySize * entriesCount - searchRange 48296 }; 48297 } 48298 48299 toArray() { 48300 let sfnt = this.sfnt; 48301 const tables = this.tables; 48302 const tablesNames = Object.keys(tables); 48303 tablesNames.sort(); 48304 const numTables = tablesNames.length; 48305 let i, j, jj, table, tableName; 48306 let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE; 48307 const tableOffsets = [offset]; 48308 48309 for (i = 0; i < numTables; i++) { 48310 table = tables[tablesNames[i]]; 48311 const paddedLength = (table.length + 3 & ~3) >>> 0; 48312 offset += paddedLength; 48313 tableOffsets.push(offset); 48314 } 48315 48316 const file = new Uint8Array(offset); 48317 48318 for (i = 0; i < numTables; i++) { 48319 table = tables[tablesNames[i]]; 48320 writeData(file, tableOffsets[i], table); 48321 } 48322 48323 if (sfnt === "true") { 48324 sfnt = (0, _util.string32)(0x00010000); 48325 } 48326 48327 file[0] = sfnt.charCodeAt(0) & 0xff; 48328 file[1] = sfnt.charCodeAt(1) & 0xff; 48329 file[2] = sfnt.charCodeAt(2) & 0xff; 48330 file[3] = sfnt.charCodeAt(3) & 0xff; 48331 writeInt16(file, 4, numTables); 48332 const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16); 48333 writeInt16(file, 6, searchParams.range); 48334 writeInt16(file, 8, searchParams.entry); 48335 writeInt16(file, 10, searchParams.rangeShift); 48336 offset = OTF_HEADER_SIZE; 48337 48338 for (i = 0; i < numTables; i++) { 48339 tableName = tablesNames[i]; 48340 file[offset] = tableName.charCodeAt(0) & 0xff; 48341 file[offset + 1] = tableName.charCodeAt(1) & 0xff; 48342 file[offset + 2] = tableName.charCodeAt(2) & 0xff; 48343 file[offset + 3] = tableName.charCodeAt(3) & 0xff; 48344 let checksum = 0; 48345 48346 for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) { 48347 const quad = (0, _core_utils.readUint32)(file, j); 48348 checksum = checksum + quad >>> 0; 48349 } 48350 48351 writeInt32(file, offset + 4, checksum); 48352 writeInt32(file, offset + 8, tableOffsets[i]); 48353 writeInt32(file, offset + 12, tables[tableName].length); 48354 offset += OTF_TABLE_ENTRY_SIZE; 48355 } 48356 48357 return file; 48358 } 48359 48360 addTable(tag, data) { 48361 if (tag in this.tables) { 48362 throw new Error("Table " + tag + " already exists"); 48363 } 48364 48365 this.tables[tag] = data; 48366 } 48367 48368} 48369 48370exports.OpenTypeFileBuilder = OpenTypeFileBuilder; 48371 48372/***/ }), 48373/* 48 */ 48374/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 48375 48376 48377 48378Object.defineProperty(exports, "__esModule", ({ 48379 value: true 48380})); 48381exports.Type1Font = void 0; 48382 48383var _cff_parser = __w_pdfjs_require__(35); 48384 48385var _fonts_utils = __w_pdfjs_require__(38); 48386 48387var _core_utils = __w_pdfjs_require__(6); 48388 48389var _stream = __w_pdfjs_require__(10); 48390 48391var _type1_parser = __w_pdfjs_require__(49); 48392 48393var _util = __w_pdfjs_require__(2); 48394 48395function findBlock(streamBytes, signature, startIndex) { 48396 const streamBytesLength = streamBytes.length; 48397 const signatureLength = signature.length; 48398 const scanLength = streamBytesLength - signatureLength; 48399 let i = startIndex, 48400 found = false; 48401 48402 while (i < scanLength) { 48403 let j = 0; 48404 48405 while (j < signatureLength && streamBytes[i + j] === signature[j]) { 48406 j++; 48407 } 48408 48409 if (j >= signatureLength) { 48410 i += j; 48411 48412 while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) { 48413 i++; 48414 } 48415 48416 found = true; 48417 break; 48418 } 48419 48420 i++; 48421 } 48422 48423 return { 48424 found, 48425 length: i 48426 }; 48427} 48428 48429function getHeaderBlock(stream, suggestedLength) { 48430 const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63]; 48431 const streamStartPos = stream.pos; 48432 let headerBytes, headerBytesLength, block; 48433 48434 try { 48435 headerBytes = stream.getBytes(suggestedLength); 48436 headerBytesLength = headerBytes.length; 48437 } catch (ex) {} 48438 48439 if (headerBytesLength === suggestedLength) { 48440 block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length); 48441 48442 if (block.found && block.length === suggestedLength) { 48443 return { 48444 stream: new _stream.Stream(headerBytes), 48445 length: suggestedLength 48446 }; 48447 } 48448 } 48449 48450 (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.'); 48451 stream.pos = streamStartPos; 48452 const SCAN_BLOCK_LENGTH = 2048; 48453 let actualLength; 48454 48455 while (true) { 48456 const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 48457 block = findBlock(scanBytes, EEXEC_SIGNATURE, 0); 48458 48459 if (block.length === 0) { 48460 break; 48461 } 48462 48463 stream.pos += block.length; 48464 48465 if (block.found) { 48466 actualLength = stream.pos - streamStartPos; 48467 break; 48468 } 48469 } 48470 48471 stream.pos = streamStartPos; 48472 48473 if (actualLength) { 48474 return { 48475 stream: new _stream.Stream(stream.getBytes(actualLength)), 48476 length: actualLength 48477 }; 48478 } 48479 48480 (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.'); 48481 return { 48482 stream: new _stream.Stream(stream.getBytes(suggestedLength)), 48483 length: suggestedLength 48484 }; 48485} 48486 48487function getEexecBlock(stream, suggestedLength) { 48488 const eexecBytes = stream.getBytes(); 48489 return { 48490 stream: new _stream.Stream(eexecBytes), 48491 length: eexecBytes.length 48492 }; 48493} 48494 48495class Type1Font { 48496 constructor(name, file, properties) { 48497 const PFB_HEADER_SIZE = 6; 48498 let headerBlockLength = properties.length1; 48499 let eexecBlockLength = properties.length2; 48500 let pfbHeader = file.peekBytes(PFB_HEADER_SIZE); 48501 const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01; 48502 48503 if (pfbHeaderPresent) { 48504 file.skip(PFB_HEADER_SIZE); 48505 headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 48506 } 48507 48508 const headerBlock = getHeaderBlock(file, headerBlockLength); 48509 const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED); 48510 headerBlockParser.extractFontHeader(properties); 48511 48512 if (pfbHeaderPresent) { 48513 pfbHeader = file.getBytes(PFB_HEADER_SIZE); 48514 eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 48515 } 48516 48517 const eexecBlock = getEexecBlock(file, eexecBlockLength); 48518 const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED); 48519 const data = eexecBlockParser.extractFontProgram(properties); 48520 48521 for (const key in data.properties) { 48522 properties[key] = data.properties[key]; 48523 } 48524 48525 const charstrings = data.charstrings; 48526 const type2Charstrings = this.getType2Charstrings(charstrings); 48527 const subrs = this.getType2Subrs(data.subrs); 48528 this.charstrings = charstrings; 48529 this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties); 48530 this.seacs = this.getSeacs(data.charstrings); 48531 } 48532 48533 get numGlyphs() { 48534 return this.charstrings.length + 1; 48535 } 48536 48537 getCharset() { 48538 const charset = [".notdef"]; 48539 48540 for (const { 48541 glyphName 48542 } of this.charstrings) { 48543 charset.push(glyphName); 48544 } 48545 48546 return charset; 48547 } 48548 48549 getGlyphMapping(properties) { 48550 const charstrings = this.charstrings; 48551 48552 if (properties.composite) { 48553 const charCodeToGlyphId = Object.create(null); 48554 48555 for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) { 48556 const charCode = properties.cMap.charCodeOf(glyphId); 48557 charCodeToGlyphId[charCode] = glyphId + 1; 48558 } 48559 48560 return charCodeToGlyphId; 48561 } 48562 48563 const glyphNames = [".notdef"]; 48564 let builtInEncoding, glyphId; 48565 48566 for (glyphId = 0; glyphId < charstrings.length; glyphId++) { 48567 glyphNames.push(charstrings[glyphId].glyphName); 48568 } 48569 48570 const encoding = properties.builtInEncoding; 48571 48572 if (encoding) { 48573 builtInEncoding = Object.create(null); 48574 48575 for (const charCode in encoding) { 48576 glyphId = glyphNames.indexOf(encoding[charCode]); 48577 48578 if (glyphId >= 0) { 48579 builtInEncoding[charCode] = glyphId; 48580 } 48581 } 48582 } 48583 48584 return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames); 48585 } 48586 48587 hasGlyphId(id) { 48588 if (id < 0 || id >= this.numGlyphs) { 48589 return false; 48590 } 48591 48592 if (id === 0) { 48593 return true; 48594 } 48595 48596 const glyph = this.charstrings[id - 1]; 48597 return glyph.charstring.length > 0; 48598 } 48599 48600 getSeacs(charstrings) { 48601 const seacMap = []; 48602 48603 for (let i = 0, ii = charstrings.length; i < ii; i++) { 48604 const charstring = charstrings[i]; 48605 48606 if (charstring.seac) { 48607 seacMap[i + 1] = charstring.seac; 48608 } 48609 } 48610 48611 return seacMap; 48612 } 48613 48614 getType2Charstrings(type1Charstrings) { 48615 const type2Charstrings = []; 48616 48617 for (let i = 0, ii = type1Charstrings.length; i < ii; i++) { 48618 type2Charstrings.push(type1Charstrings[i].charstring); 48619 } 48620 48621 return type2Charstrings; 48622 } 48623 48624 getType2Subrs(type1Subrs) { 48625 let bias = 0; 48626 const count = type1Subrs.length; 48627 48628 if (count < 1133) { 48629 bias = 107; 48630 } else if (count < 33769) { 48631 bias = 1131; 48632 } else { 48633 bias = 32768; 48634 } 48635 48636 const type2Subrs = []; 48637 let i; 48638 48639 for (i = 0; i < bias; i++) { 48640 type2Subrs.push([0x0b]); 48641 } 48642 48643 for (i = 0; i < count; i++) { 48644 type2Subrs.push(type1Subrs[i]); 48645 } 48646 48647 return type2Subrs; 48648 } 48649 48650 wrap(name, glyphs, charstrings, subrs, properties) { 48651 const cff = new _cff_parser.CFF(); 48652 cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4); 48653 cff.names = [name]; 48654 const topDict = new _cff_parser.CFFTopDict(); 48655 topDict.setByName("version", 391); 48656 topDict.setByName("Notice", 392); 48657 topDict.setByName("FullName", 393); 48658 topDict.setByName("FamilyName", 394); 48659 topDict.setByName("Weight", 395); 48660 topDict.setByName("Encoding", null); 48661 topDict.setByName("FontMatrix", properties.fontMatrix); 48662 topDict.setByName("FontBBox", properties.bbox); 48663 topDict.setByName("charset", null); 48664 topDict.setByName("CharStrings", null); 48665 topDict.setByName("Private", null); 48666 cff.topDict = topDict; 48667 const strings = new _cff_parser.CFFStrings(); 48668 strings.add("Version 0.11"); 48669 strings.add("See original notice"); 48670 strings.add(name); 48671 strings.add(name); 48672 strings.add("Medium"); 48673 cff.strings = strings; 48674 cff.globalSubrIndex = new _cff_parser.CFFIndex(); 48675 const count = glyphs.length; 48676 const charsetArray = [".notdef"]; 48677 let i, ii; 48678 48679 for (i = 0; i < count; i++) { 48680 const glyphName = charstrings[i].glyphName; 48681 48682 const index = _cff_parser.CFFStandardStrings.indexOf(glyphName); 48683 48684 if (index === -1) { 48685 strings.add(glyphName); 48686 } 48687 48688 charsetArray.push(glyphName); 48689 } 48690 48691 cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray); 48692 const charStringsIndex = new _cff_parser.CFFIndex(); 48693 charStringsIndex.add([0x8b, 0x0e]); 48694 48695 for (i = 0; i < count; i++) { 48696 charStringsIndex.add(glyphs[i]); 48697 } 48698 48699 cff.charStrings = charStringsIndex; 48700 const privateDict = new _cff_parser.CFFPrivateDict(); 48701 privateDict.setByName("Subrs", null); 48702 const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"]; 48703 48704 for (i = 0, ii = fields.length; i < ii; i++) { 48705 const field = fields[i]; 48706 48707 if (!(field in properties.privateData)) { 48708 continue; 48709 } 48710 48711 const value = properties.privateData[field]; 48712 48713 if (Array.isArray(value)) { 48714 for (let j = value.length - 1; j > 0; j--) { 48715 value[j] -= value[j - 1]; 48716 } 48717 } 48718 48719 privateDict.setByName(field, value); 48720 } 48721 48722 cff.topDict.privateDict = privateDict; 48723 const subrIndex = new _cff_parser.CFFIndex(); 48724 48725 for (i = 0, ii = subrs.length; i < ii; i++) { 48726 subrIndex.add(subrs[i]); 48727 } 48728 48729 privateDict.subrsIndex = subrIndex; 48730 const compiler = new _cff_parser.CFFCompiler(cff); 48731 return compiler.compile(); 48732 } 48733 48734} 48735 48736exports.Type1Font = Type1Font; 48737 48738/***/ }), 48739/* 49 */ 48740/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 48741 48742 48743 48744Object.defineProperty(exports, "__esModule", ({ 48745 value: true 48746})); 48747exports.Type1Parser = void 0; 48748 48749var _encodings = __w_pdfjs_require__(37); 48750 48751var _core_utils = __w_pdfjs_require__(6); 48752 48753var _stream = __w_pdfjs_require__(10); 48754 48755var _util = __w_pdfjs_require__(2); 48756 48757const HINTING_ENABLED = false; 48758const COMMAND_MAP = { 48759 hstem: [1], 48760 vstem: [3], 48761 vmoveto: [4], 48762 rlineto: [5], 48763 hlineto: [6], 48764 vlineto: [7], 48765 rrcurveto: [8], 48766 callsubr: [10], 48767 flex: [12, 35], 48768 drop: [12, 18], 48769 endchar: [14], 48770 rmoveto: [21], 48771 hmoveto: [22], 48772 vhcurveto: [30], 48773 hvcurveto: [31] 48774}; 48775 48776class Type1CharString { 48777 constructor() { 48778 this.width = 0; 48779 this.lsb = 0; 48780 this.flexing = false; 48781 this.output = []; 48782 this.stack = []; 48783 } 48784 48785 convert(encoded, subrs, seacAnalysisEnabled) { 48786 const count = encoded.length; 48787 let error = false; 48788 let wx, sbx, subrNumber; 48789 48790 for (let i = 0; i < count; i++) { 48791 let value = encoded[i]; 48792 48793 if (value < 32) { 48794 if (value === 12) { 48795 value = (value << 8) + encoded[++i]; 48796 } 48797 48798 switch (value) { 48799 case 1: 48800 if (!HINTING_ENABLED) { 48801 this.stack = []; 48802 break; 48803 } 48804 48805 error = this.executeCommand(2, COMMAND_MAP.hstem); 48806 break; 48807 48808 case 3: 48809 if (!HINTING_ENABLED) { 48810 this.stack = []; 48811 break; 48812 } 48813 48814 error = this.executeCommand(2, COMMAND_MAP.vstem); 48815 break; 48816 48817 case 4: 48818 if (this.flexing) { 48819 if (this.stack.length < 1) { 48820 error = true; 48821 break; 48822 } 48823 48824 const dy = this.stack.pop(); 48825 this.stack.push(0, dy); 48826 break; 48827 } 48828 48829 error = this.executeCommand(1, COMMAND_MAP.vmoveto); 48830 break; 48831 48832 case 5: 48833 error = this.executeCommand(2, COMMAND_MAP.rlineto); 48834 break; 48835 48836 case 6: 48837 error = this.executeCommand(1, COMMAND_MAP.hlineto); 48838 break; 48839 48840 case 7: 48841 error = this.executeCommand(1, COMMAND_MAP.vlineto); 48842 break; 48843 48844 case 8: 48845 error = this.executeCommand(6, COMMAND_MAP.rrcurveto); 48846 break; 48847 48848 case 9: 48849 this.stack = []; 48850 break; 48851 48852 case 10: 48853 if (this.stack.length < 1) { 48854 error = true; 48855 break; 48856 } 48857 48858 subrNumber = this.stack.pop(); 48859 48860 if (!subrs[subrNumber]) { 48861 error = true; 48862 break; 48863 } 48864 48865 error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled); 48866 break; 48867 48868 case 11: 48869 return error; 48870 48871 case 13: 48872 if (this.stack.length < 2) { 48873 error = true; 48874 break; 48875 } 48876 48877 wx = this.stack.pop(); 48878 sbx = this.stack.pop(); 48879 this.lsb = sbx; 48880 this.width = wx; 48881 this.stack.push(wx, sbx); 48882 error = this.executeCommand(2, COMMAND_MAP.hmoveto); 48883 break; 48884 48885 case 14: 48886 this.output.push(COMMAND_MAP.endchar[0]); 48887 break; 48888 48889 case 21: 48890 if (this.flexing) { 48891 break; 48892 } 48893 48894 error = this.executeCommand(2, COMMAND_MAP.rmoveto); 48895 break; 48896 48897 case 22: 48898 if (this.flexing) { 48899 this.stack.push(0); 48900 break; 48901 } 48902 48903 error = this.executeCommand(1, COMMAND_MAP.hmoveto); 48904 break; 48905 48906 case 30: 48907 error = this.executeCommand(4, COMMAND_MAP.vhcurveto); 48908 break; 48909 48910 case 31: 48911 error = this.executeCommand(4, COMMAND_MAP.hvcurveto); 48912 break; 48913 48914 case (12 << 8) + 0: 48915 this.stack = []; 48916 break; 48917 48918 case (12 << 8) + 1: 48919 if (!HINTING_ENABLED) { 48920 this.stack = []; 48921 break; 48922 } 48923 48924 error = this.executeCommand(2, COMMAND_MAP.vstem); 48925 break; 48926 48927 case (12 << 8) + 2: 48928 if (!HINTING_ENABLED) { 48929 this.stack = []; 48930 break; 48931 } 48932 48933 error = this.executeCommand(2, COMMAND_MAP.hstem); 48934 break; 48935 48936 case (12 << 8) + 6: 48937 if (seacAnalysisEnabled) { 48938 const asb = this.stack.at(-5); 48939 this.seac = this.stack.splice(-4, 4); 48940 this.seac[0] += this.lsb - asb; 48941 error = this.executeCommand(0, COMMAND_MAP.endchar); 48942 } else { 48943 error = this.executeCommand(4, COMMAND_MAP.endchar); 48944 } 48945 48946 break; 48947 48948 case (12 << 8) + 7: 48949 if (this.stack.length < 4) { 48950 error = true; 48951 break; 48952 } 48953 48954 this.stack.pop(); 48955 wx = this.stack.pop(); 48956 const sby = this.stack.pop(); 48957 sbx = this.stack.pop(); 48958 this.lsb = sbx; 48959 this.width = wx; 48960 this.stack.push(wx, sbx, sby); 48961 error = this.executeCommand(3, COMMAND_MAP.rmoveto); 48962 break; 48963 48964 case (12 << 8) + 12: 48965 if (this.stack.length < 2) { 48966 error = true; 48967 break; 48968 } 48969 48970 const num2 = this.stack.pop(); 48971 const num1 = this.stack.pop(); 48972 this.stack.push(num1 / num2); 48973 break; 48974 48975 case (12 << 8) + 16: 48976 if (this.stack.length < 2) { 48977 error = true; 48978 break; 48979 } 48980 48981 subrNumber = this.stack.pop(); 48982 const numArgs = this.stack.pop(); 48983 48984 if (subrNumber === 0 && numArgs === 3) { 48985 const flexArgs = this.stack.splice(this.stack.length - 17, 17); 48986 this.stack.push(flexArgs[2] + flexArgs[0], flexArgs[3] + flexArgs[1], flexArgs[4], flexArgs[5], flexArgs[6], flexArgs[7], flexArgs[8], flexArgs[9], flexArgs[10], flexArgs[11], flexArgs[12], flexArgs[13], flexArgs[14]); 48987 error = this.executeCommand(13, COMMAND_MAP.flex, true); 48988 this.flexing = false; 48989 this.stack.push(flexArgs[15], flexArgs[16]); 48990 } else if (subrNumber === 1 && numArgs === 0) { 48991 this.flexing = true; 48992 } 48993 48994 break; 48995 48996 case (12 << 8) + 17: 48997 break; 48998 48999 case (12 << 8) + 33: 49000 this.stack = []; 49001 break; 49002 49003 default: 49004 (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"'); 49005 break; 49006 } 49007 49008 if (error) { 49009 break; 49010 } 49011 49012 continue; 49013 } else if (value <= 246) { 49014 value -= 139; 49015 } else if (value <= 250) { 49016 value = (value - 247) * 256 + encoded[++i] + 108; 49017 } else if (value <= 254) { 49018 value = -((value - 251) * 256) - encoded[++i] - 108; 49019 } else { 49020 value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0; 49021 } 49022 49023 this.stack.push(value); 49024 } 49025 49026 return error; 49027 } 49028 49029 executeCommand(howManyArgs, command, keepStack) { 49030 const stackLength = this.stack.length; 49031 49032 if (howManyArgs > stackLength) { 49033 return true; 49034 } 49035 49036 const start = stackLength - howManyArgs; 49037 49038 for (let i = start; i < stackLength; i++) { 49039 let value = this.stack[i]; 49040 49041 if (Number.isInteger(value)) { 49042 this.output.push(28, value >> 8 & 0xff, value & 0xff); 49043 } else { 49044 value = 65536 * value | 0; 49045 this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 49046 } 49047 } 49048 49049 this.output.push(...command); 49050 49051 if (keepStack) { 49052 this.stack.splice(start, howManyArgs); 49053 } else { 49054 this.stack.length = 0; 49055 } 49056 49057 return false; 49058 } 49059 49060} 49061 49062const EEXEC_ENCRYPT_KEY = 55665; 49063const CHAR_STRS_ENCRYPT_KEY = 4330; 49064 49065function isHexDigit(code) { 49066 return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102; 49067} 49068 49069function decrypt(data, key, discardNumber) { 49070 if (discardNumber >= data.length) { 49071 return new Uint8Array(0); 49072 } 49073 49074 const c1 = 52845, 49075 c2 = 22719; 49076 let r = key | 0, 49077 i, 49078 j; 49079 49080 for (i = 0; i < discardNumber; i++) { 49081 r = (data[i] + r) * c1 + c2 & (1 << 16) - 1; 49082 } 49083 49084 const count = data.length - discardNumber; 49085 const decrypted = new Uint8Array(count); 49086 49087 for (i = discardNumber, j = 0; j < count; i++, j++) { 49088 const value = data[i]; 49089 decrypted[j] = value ^ r >> 8; 49090 r = (value + r) * c1 + c2 & (1 << 16) - 1; 49091 } 49092 49093 return decrypted; 49094} 49095 49096function decryptAscii(data, key, discardNumber) { 49097 const c1 = 52845, 49098 c2 = 22719; 49099 let r = key | 0; 49100 const count = data.length, 49101 maybeLength = count >>> 1; 49102 const decrypted = new Uint8Array(maybeLength); 49103 let i, j; 49104 49105 for (i = 0, j = 0; i < count; i++) { 49106 const digit1 = data[i]; 49107 49108 if (!isHexDigit(digit1)) { 49109 continue; 49110 } 49111 49112 i++; 49113 let digit2; 49114 49115 while (i < count && !isHexDigit(digit2 = data[i])) { 49116 i++; 49117 } 49118 49119 if (i < count) { 49120 const value = parseInt(String.fromCharCode(digit1, digit2), 16); 49121 decrypted[j++] = value ^ r >> 8; 49122 r = (value + r) * c1 + c2 & (1 << 16) - 1; 49123 } 49124 } 49125 49126 return decrypted.slice(discardNumber, j); 49127} 49128 49129function isSpecial(c) { 49130 return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29; 49131} 49132 49133class Type1Parser { 49134 constructor(stream, encrypted, seacAnalysisEnabled) { 49135 if (encrypted) { 49136 const data = stream.getBytes(); 49137 const isBinary = !((isHexDigit(data[0]) || (0, _core_utils.isWhiteSpace)(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7])); 49138 stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4)); 49139 } 49140 49141 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 49142 this.stream = stream; 49143 this.nextChar(); 49144 } 49145 49146 readNumberArray() { 49147 this.getToken(); 49148 const array = []; 49149 49150 while (true) { 49151 const token = this.getToken(); 49152 49153 if (token === null || token === "]" || token === "}") { 49154 break; 49155 } 49156 49157 array.push(parseFloat(token || 0)); 49158 } 49159 49160 return array; 49161 } 49162 49163 readNumber() { 49164 const token = this.getToken(); 49165 return parseFloat(token || 0); 49166 } 49167 49168 readInt() { 49169 const token = this.getToken(); 49170 return parseInt(token || 0, 10) | 0; 49171 } 49172 49173 readBoolean() { 49174 const token = this.getToken(); 49175 return token === "true" ? 1 : 0; 49176 } 49177 49178 nextChar() { 49179 return this.currentChar = this.stream.getByte(); 49180 } 49181 49182 prevChar() { 49183 this.stream.skip(-2); 49184 return this.currentChar = this.stream.getByte(); 49185 } 49186 49187 getToken() { 49188 let comment = false; 49189 let ch = this.currentChar; 49190 49191 while (true) { 49192 if (ch === -1) { 49193 return null; 49194 } 49195 49196 if (comment) { 49197 if (ch === 0x0a || ch === 0x0d) { 49198 comment = false; 49199 } 49200 } else if (ch === 0x25) { 49201 comment = true; 49202 } else if (!(0, _core_utils.isWhiteSpace)(ch)) { 49203 break; 49204 } 49205 49206 ch = this.nextChar(); 49207 } 49208 49209 if (isSpecial(ch)) { 49210 this.nextChar(); 49211 return String.fromCharCode(ch); 49212 } 49213 49214 let token = ""; 49215 49216 do { 49217 token += String.fromCharCode(ch); 49218 ch = this.nextChar(); 49219 } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch)); 49220 49221 return token; 49222 } 49223 49224 readCharStrings(bytes, lenIV) { 49225 if (lenIV === -1) { 49226 return bytes; 49227 } 49228 49229 return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV); 49230 } 49231 49232 extractFontProgram(properties) { 49233 const stream = this.stream; 49234 const subrs = [], 49235 charstrings = []; 49236 const privateData = Object.create(null); 49237 privateData.lenIV = 4; 49238 const program = { 49239 subrs: [], 49240 charstrings: [], 49241 properties: { 49242 privateData 49243 } 49244 }; 49245 let token, length, data, lenIV; 49246 49247 while ((token = this.getToken()) !== null) { 49248 if (token !== "/") { 49249 continue; 49250 } 49251 49252 token = this.getToken(); 49253 49254 switch (token) { 49255 case "CharStrings": 49256 this.getToken(); 49257 this.getToken(); 49258 this.getToken(); 49259 this.getToken(); 49260 49261 while (true) { 49262 token = this.getToken(); 49263 49264 if (token === null || token === "end") { 49265 break; 49266 } 49267 49268 if (token !== "/") { 49269 continue; 49270 } 49271 49272 const glyph = this.getToken(); 49273 length = this.readInt(); 49274 this.getToken(); 49275 data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); 49276 lenIV = program.properties.privateData.lenIV; 49277 const encoded = this.readCharStrings(data, lenIV); 49278 this.nextChar(); 49279 token = this.getToken(); 49280 49281 if (token === "noaccess") { 49282 this.getToken(); 49283 } else if (token === "/") { 49284 this.prevChar(); 49285 } 49286 49287 charstrings.push({ 49288 glyph, 49289 encoded 49290 }); 49291 } 49292 49293 break; 49294 49295 case "Subrs": 49296 this.readInt(); 49297 this.getToken(); 49298 49299 while (this.getToken() === "dup") { 49300 const index = this.readInt(); 49301 length = this.readInt(); 49302 this.getToken(); 49303 data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); 49304 lenIV = program.properties.privateData.lenIV; 49305 const encoded = this.readCharStrings(data, lenIV); 49306 this.nextChar(); 49307 token = this.getToken(); 49308 49309 if (token === "noaccess") { 49310 this.getToken(); 49311 } 49312 49313 subrs[index] = encoded; 49314 } 49315 49316 break; 49317 49318 case "BlueValues": 49319 case "OtherBlues": 49320 case "FamilyBlues": 49321 case "FamilyOtherBlues": 49322 const blueArray = this.readNumberArray(); 49323 49324 if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) { 49325 program.properties.privateData[token] = blueArray; 49326 } 49327 49328 break; 49329 49330 case "StemSnapH": 49331 case "StemSnapV": 49332 program.properties.privateData[token] = this.readNumberArray(); 49333 break; 49334 49335 case "StdHW": 49336 case "StdVW": 49337 program.properties.privateData[token] = this.readNumberArray()[0]; 49338 break; 49339 49340 case "BlueShift": 49341 case "lenIV": 49342 case "BlueFuzz": 49343 case "BlueScale": 49344 case "LanguageGroup": 49345 case "ExpansionFactor": 49346 program.properties.privateData[token] = this.readNumber(); 49347 break; 49348 49349 case "ForceBold": 49350 program.properties.privateData[token] = this.readBoolean(); 49351 break; 49352 } 49353 } 49354 49355 for (const { 49356 encoded, 49357 glyph 49358 } of charstrings) { 49359 const charString = new Type1CharString(); 49360 const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled); 49361 let output = charString.output; 49362 49363 if (error) { 49364 output = [14]; 49365 } 49366 49367 const charStringObject = { 49368 glyphName: glyph, 49369 charstring: output, 49370 width: charString.width, 49371 lsb: charString.lsb, 49372 seac: charString.seac 49373 }; 49374 49375 if (glyph === ".notdef") { 49376 program.charstrings.unshift(charStringObject); 49377 } else { 49378 program.charstrings.push(charStringObject); 49379 } 49380 49381 if (properties.builtInEncoding) { 49382 const index = properties.builtInEncoding.indexOf(glyph); 49383 49384 if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) { 49385 properties.widths[index] = charString.width; 49386 } 49387 } 49388 } 49389 49390 return program; 49391 } 49392 49393 extractFontHeader(properties) { 49394 let token; 49395 49396 while ((token = this.getToken()) !== null) { 49397 if (token !== "/") { 49398 continue; 49399 } 49400 49401 token = this.getToken(); 49402 49403 switch (token) { 49404 case "FontMatrix": 49405 const matrix = this.readNumberArray(); 49406 properties.fontMatrix = matrix; 49407 break; 49408 49409 case "Encoding": 49410 const encodingArg = this.getToken(); 49411 let encoding; 49412 49413 if (!/^\d+$/.test(encodingArg)) { 49414 encoding = (0, _encodings.getEncoding)(encodingArg); 49415 } else { 49416 encoding = []; 49417 const size = parseInt(encodingArg, 10) | 0; 49418 this.getToken(); 49419 49420 for (let j = 0; j < size; j++) { 49421 token = this.getToken(); 49422 49423 while (token !== "dup" && token !== "def") { 49424 token = this.getToken(); 49425 49426 if (token === null) { 49427 return; 49428 } 49429 } 49430 49431 if (token === "def") { 49432 break; 49433 } 49434 49435 const index = this.readInt(); 49436 this.getToken(); 49437 const glyph = this.getToken(); 49438 encoding[index] = glyph; 49439 this.getToken(); 49440 } 49441 } 49442 49443 properties.builtInEncoding = encoding; 49444 break; 49445 49446 case "FontBBox": 49447 const fontBBox = this.readNumberArray(); 49448 properties.ascent = Math.max(fontBBox[3], fontBBox[1]); 49449 properties.descent = Math.min(fontBBox[1], fontBBox[3]); 49450 properties.ascentScaled = true; 49451 break; 49452 } 49453 } 49454 } 49455 49456} 49457 49458exports.Type1Parser = Type1Parser; 49459 49460/***/ }), 49461/* 50 */ 49462/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 49463 49464 49465 49466Object.defineProperty(exports, "__esModule", ({ 49467 value: true 49468})); 49469exports.Pattern = void 0; 49470exports.getTilingPatternIR = getTilingPatternIR; 49471 49472var _util = __w_pdfjs_require__(2); 49473 49474var _base_stream = __w_pdfjs_require__(7); 49475 49476var _colorspace = __w_pdfjs_require__(14); 49477 49478var _core_utils = __w_pdfjs_require__(6); 49479 49480const ShadingType = { 49481 FUNCTION_BASED: 1, 49482 AXIAL: 2, 49483 RADIAL: 3, 49484 FREE_FORM_MESH: 4, 49485 LATTICE_FORM_MESH: 5, 49486 COONS_PATCH_MESH: 6, 49487 TENSOR_PATCH_MESH: 7 49488}; 49489 49490class Pattern { 49491 constructor() { 49492 (0, _util.unreachable)("Cannot initialize Pattern."); 49493 } 49494 49495 static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) { 49496 const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading; 49497 const type = dict.get("ShadingType"); 49498 49499 try { 49500 switch (type) { 49501 case ShadingType.AXIAL: 49502 case ShadingType.RADIAL: 49503 return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache); 49504 49505 case ShadingType.FREE_FORM_MESH: 49506 case ShadingType.LATTICE_FORM_MESH: 49507 case ShadingType.COONS_PATCH_MESH: 49508 case ShadingType.TENSOR_PATCH_MESH: 49509 return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache); 49510 49511 default: 49512 throw new _util.FormatError("Unsupported ShadingType: " + type); 49513 } 49514 } catch (ex) { 49515 if (ex instanceof _core_utils.MissingDataException) { 49516 throw ex; 49517 } 49518 49519 handler.send("UnsupportedFeature", { 49520 featureId: _util.UNSUPPORTED_FEATURES.shadingPattern 49521 }); 49522 (0, _util.warn)(ex); 49523 return new DummyShading(); 49524 } 49525 } 49526 49527} 49528 49529exports.Pattern = Pattern; 49530 49531class BaseShading { 49532 static get SMALL_NUMBER() { 49533 return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6); 49534 } 49535 49536 constructor() { 49537 if (this.constructor === BaseShading) { 49538 (0, _util.unreachable)("Cannot initialize BaseShading."); 49539 } 49540 } 49541 49542 getIR() { 49543 (0, _util.unreachable)("Abstract method `getIR` called."); 49544 } 49545 49546} 49547 49548class RadialAxialShading extends BaseShading { 49549 constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) { 49550 super(); 49551 this.coordsArr = dict.getArray("Coords"); 49552 this.shadingType = dict.get("ShadingType"); 49553 49554 const cs = _colorspace.ColorSpace.parse({ 49555 cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"), 49556 xref, 49557 resources, 49558 pdfFunctionFactory, 49559 localColorSpaceCache 49560 }); 49561 49562 const bbox = dict.getArray("BBox"); 49563 49564 if (Array.isArray(bbox) && bbox.length === 4) { 49565 this.bbox = _util.Util.normalizeRect(bbox); 49566 } else { 49567 this.bbox = null; 49568 } 49569 49570 let t0 = 0.0, 49571 t1 = 1.0; 49572 49573 if (dict.has("Domain")) { 49574 const domainArr = dict.getArray("Domain"); 49575 t0 = domainArr[0]; 49576 t1 = domainArr[1]; 49577 } 49578 49579 let extendStart = false, 49580 extendEnd = false; 49581 49582 if (dict.has("Extend")) { 49583 const extendArr = dict.getArray("Extend"); 49584 extendStart = extendArr[0]; 49585 extendEnd = extendArr[1]; 49586 } 49587 49588 if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) { 49589 const [x1, y1, r1, x2, y2, r2] = this.coordsArr; 49590 const distance = Math.hypot(x1 - x2, y1 - y2); 49591 49592 if (r1 <= r2 + distance && r2 <= r1 + distance) { 49593 (0, _util.warn)("Unsupported radial gradient."); 49594 } 49595 } 49596 49597 this.extendStart = extendStart; 49598 this.extendEnd = extendEnd; 49599 const fnObj = dict.getRaw("Function"); 49600 const fn = pdfFunctionFactory.createFromArray(fnObj); 49601 const NUMBER_OF_SAMPLES = 10; 49602 const step = (t1 - t0) / NUMBER_OF_SAMPLES; 49603 const colorStops = this.colorStops = []; 49604 49605 if (t0 >= t1 || step <= 0) { 49606 (0, _util.info)("Bad shading domain."); 49607 return; 49608 } 49609 49610 const color = new Float32Array(cs.numComps), 49611 ratio = new Float32Array(1); 49612 let rgbColor; 49613 49614 for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) { 49615 ratio[0] = t0 + i * step; 49616 fn(ratio, 0, color, 0); 49617 rgbColor = cs.getRgb(color, 0); 49618 49619 const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]); 49620 49621 colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]); 49622 } 49623 49624 let background = "transparent"; 49625 49626 if (dict.has("Background")) { 49627 rgbColor = cs.getRgb(dict.get("Background"), 0); 49628 background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]); 49629 } 49630 49631 if (!extendStart) { 49632 colorStops.unshift([0, background]); 49633 colorStops[1][0] += BaseShading.SMALL_NUMBER; 49634 } 49635 49636 if (!extendEnd) { 49637 colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER; 49638 colorStops.push([1, background]); 49639 } 49640 49641 this.colorStops = colorStops; 49642 } 49643 49644 getIR() { 49645 const coordsArr = this.coordsArr; 49646 const shadingType = this.shadingType; 49647 let type, p0, p1, r0, r1; 49648 49649 if (shadingType === ShadingType.AXIAL) { 49650 p0 = [coordsArr[0], coordsArr[1]]; 49651 p1 = [coordsArr[2], coordsArr[3]]; 49652 r0 = null; 49653 r1 = null; 49654 type = "axial"; 49655 } else if (shadingType === ShadingType.RADIAL) { 49656 p0 = [coordsArr[0], coordsArr[1]]; 49657 p1 = [coordsArr[3], coordsArr[4]]; 49658 r0 = coordsArr[2]; 49659 r1 = coordsArr[5]; 49660 type = "radial"; 49661 } else { 49662 (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`); 49663 } 49664 49665 return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1]; 49666 } 49667 49668} 49669 49670class MeshStreamReader { 49671 constructor(stream, context) { 49672 this.stream = stream; 49673 this.context = context; 49674 this.buffer = 0; 49675 this.bufferLength = 0; 49676 const numComps = context.numComps; 49677 this.tmpCompsBuf = new Float32Array(numComps); 49678 const csNumComps = context.colorSpace.numComps; 49679 this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf; 49680 } 49681 49682 get hasData() { 49683 if (this.stream.end) { 49684 return this.stream.pos < this.stream.end; 49685 } 49686 49687 if (this.bufferLength > 0) { 49688 return true; 49689 } 49690 49691 const nextByte = this.stream.getByte(); 49692 49693 if (nextByte < 0) { 49694 return false; 49695 } 49696 49697 this.buffer = nextByte; 49698 this.bufferLength = 8; 49699 return true; 49700 } 49701 49702 readBits(n) { 49703 let buffer = this.buffer; 49704 let bufferLength = this.bufferLength; 49705 49706 if (n === 32) { 49707 if (bufferLength === 0) { 49708 return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0; 49709 } 49710 49711 buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte(); 49712 const nextByte = this.stream.getByte(); 49713 this.buffer = nextByte & (1 << bufferLength) - 1; 49714 return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0; 49715 } 49716 49717 if (n === 8 && bufferLength === 0) { 49718 return this.stream.getByte(); 49719 } 49720 49721 while (bufferLength < n) { 49722 buffer = buffer << 8 | this.stream.getByte(); 49723 bufferLength += 8; 49724 } 49725 49726 bufferLength -= n; 49727 this.bufferLength = bufferLength; 49728 this.buffer = buffer & (1 << bufferLength) - 1; 49729 return buffer >> bufferLength; 49730 } 49731 49732 align() { 49733 this.buffer = 0; 49734 this.bufferLength = 0; 49735 } 49736 49737 readFlag() { 49738 return this.readBits(this.context.bitsPerFlag); 49739 } 49740 49741 readCoordinate() { 49742 const bitsPerCoordinate = this.context.bitsPerCoordinate; 49743 const xi = this.readBits(bitsPerCoordinate); 49744 const yi = this.readBits(bitsPerCoordinate); 49745 const decode = this.context.decode; 49746 const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10; 49747 return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]]; 49748 } 49749 49750 readComponents() { 49751 const numComps = this.context.numComps; 49752 const bitsPerComponent = this.context.bitsPerComponent; 49753 const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10; 49754 const decode = this.context.decode; 49755 const components = this.tmpCompsBuf; 49756 49757 for (let i = 0, j = 4; i < numComps; i++, j += 2) { 49758 const ci = this.readBits(bitsPerComponent); 49759 components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j]; 49760 } 49761 49762 const color = this.tmpCsCompsBuf; 49763 49764 if (this.context.colorFn) { 49765 this.context.colorFn(components, 0, color, 0); 49766 } 49767 49768 return this.context.colorSpace.getRgb(color, 0); 49769 } 49770 49771} 49772 49773const getB = function getBClosure() { 49774 function buildB(count) { 49775 const lut = []; 49776 49777 for (let i = 0; i <= count; i++) { 49778 const t = i / count, 49779 t_ = 1 - t; 49780 lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t])); 49781 } 49782 49783 return lut; 49784 } 49785 49786 const cache = []; 49787 return function (count) { 49788 if (!cache[count]) { 49789 cache[count] = buildB(count); 49790 } 49791 49792 return cache[count]; 49793 }; 49794}(); 49795 49796class MeshShading extends BaseShading { 49797 static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() { 49798 return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3); 49799 } 49800 49801 static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() { 49802 return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20); 49803 } 49804 49805 static get TRIANGLE_DENSITY() { 49806 return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20); 49807 } 49808 49809 constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) { 49810 super(); 49811 49812 if (!(stream instanceof _base_stream.BaseStream)) { 49813 throw new _util.FormatError("Mesh data is not a stream"); 49814 } 49815 49816 const dict = stream.dict; 49817 this.shadingType = dict.get("ShadingType"); 49818 const bbox = dict.getArray("BBox"); 49819 49820 if (Array.isArray(bbox) && bbox.length === 4) { 49821 this.bbox = _util.Util.normalizeRect(bbox); 49822 } else { 49823 this.bbox = null; 49824 } 49825 49826 const cs = _colorspace.ColorSpace.parse({ 49827 cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"), 49828 xref, 49829 resources, 49830 pdfFunctionFactory, 49831 localColorSpaceCache 49832 }); 49833 49834 this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null; 49835 const fnObj = dict.getRaw("Function"); 49836 const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null; 49837 this.coords = []; 49838 this.colors = []; 49839 this.figures = []; 49840 const decodeContext = { 49841 bitsPerCoordinate: dict.get("BitsPerCoordinate"), 49842 bitsPerComponent: dict.get("BitsPerComponent"), 49843 bitsPerFlag: dict.get("BitsPerFlag"), 49844 decode: dict.getArray("Decode"), 49845 colorFn: fn, 49846 colorSpace: cs, 49847 numComps: fn ? 1 : cs.numComps 49848 }; 49849 const reader = new MeshStreamReader(stream, decodeContext); 49850 let patchMesh = false; 49851 49852 switch (this.shadingType) { 49853 case ShadingType.FREE_FORM_MESH: 49854 this._decodeType4Shading(reader); 49855 49856 break; 49857 49858 case ShadingType.LATTICE_FORM_MESH: 49859 const verticesPerRow = dict.get("VerticesPerRow") | 0; 49860 49861 if (verticesPerRow < 2) { 49862 throw new _util.FormatError("Invalid VerticesPerRow"); 49863 } 49864 49865 this._decodeType5Shading(reader, verticesPerRow); 49866 49867 break; 49868 49869 case ShadingType.COONS_PATCH_MESH: 49870 this._decodeType6Shading(reader); 49871 49872 patchMesh = true; 49873 break; 49874 49875 case ShadingType.TENSOR_PATCH_MESH: 49876 this._decodeType7Shading(reader); 49877 49878 patchMesh = true; 49879 break; 49880 49881 default: 49882 (0, _util.unreachable)("Unsupported mesh type."); 49883 break; 49884 } 49885 49886 if (patchMesh) { 49887 this._updateBounds(); 49888 49889 for (let i = 0, ii = this.figures.length; i < ii; i++) { 49890 this._buildFigureFromPatch(i); 49891 } 49892 } 49893 49894 this._updateBounds(); 49895 49896 this._packData(); 49897 } 49898 49899 _decodeType4Shading(reader) { 49900 const coords = this.coords; 49901 const colors = this.colors; 49902 const operators = []; 49903 const ps = []; 49904 let verticesLeft = 0; 49905 49906 while (reader.hasData) { 49907 const f = reader.readFlag(); 49908 const coord = reader.readCoordinate(); 49909 const color = reader.readComponents(); 49910 49911 if (verticesLeft === 0) { 49912 if (!(0 <= f && f <= 2)) { 49913 throw new _util.FormatError("Unknown type4 flag"); 49914 } 49915 49916 switch (f) { 49917 case 0: 49918 verticesLeft = 3; 49919 break; 49920 49921 case 1: 49922 ps.push(ps.at(-2), ps.at(-1)); 49923 verticesLeft = 1; 49924 break; 49925 49926 case 2: 49927 ps.push(ps.at(-3), ps.at(-1)); 49928 verticesLeft = 1; 49929 break; 49930 } 49931 49932 operators.push(f); 49933 } 49934 49935 ps.push(coords.length); 49936 coords.push(coord); 49937 colors.push(color); 49938 verticesLeft--; 49939 reader.align(); 49940 } 49941 49942 this.figures.push({ 49943 type: "triangles", 49944 coords: new Int32Array(ps), 49945 colors: new Int32Array(ps) 49946 }); 49947 } 49948 49949 _decodeType5Shading(reader, verticesPerRow) { 49950 const coords = this.coords; 49951 const colors = this.colors; 49952 const ps = []; 49953 49954 while (reader.hasData) { 49955 const coord = reader.readCoordinate(); 49956 const color = reader.readComponents(); 49957 ps.push(coords.length); 49958 coords.push(coord); 49959 colors.push(color); 49960 } 49961 49962 this.figures.push({ 49963 type: "lattice", 49964 coords: new Int32Array(ps), 49965 colors: new Int32Array(ps), 49966 verticesPerRow 49967 }); 49968 } 49969 49970 _decodeType6Shading(reader) { 49971 const coords = this.coords; 49972 const colors = this.colors; 49973 const ps = new Int32Array(16); 49974 const cs = new Int32Array(4); 49975 49976 while (reader.hasData) { 49977 const f = reader.readFlag(); 49978 49979 if (!(0 <= f && f <= 3)) { 49980 throw new _util.FormatError("Unknown type6 flag"); 49981 } 49982 49983 const pi = coords.length; 49984 49985 for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) { 49986 coords.push(reader.readCoordinate()); 49987 } 49988 49989 const ci = colors.length; 49990 49991 for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 49992 colors.push(reader.readComponents()); 49993 } 49994 49995 let tmp1, tmp2, tmp3, tmp4; 49996 49997 switch (f) { 49998 case 0: 49999 ps[12] = pi + 3; 50000 ps[13] = pi + 4; 50001 ps[14] = pi + 5; 50002 ps[15] = pi + 6; 50003 ps[8] = pi + 2; 50004 ps[11] = pi + 7; 50005 ps[4] = pi + 1; 50006 ps[7] = pi + 8; 50007 ps[0] = pi; 50008 ps[1] = pi + 11; 50009 ps[2] = pi + 10; 50010 ps[3] = pi + 9; 50011 cs[2] = ci + 1; 50012 cs[3] = ci + 2; 50013 cs[0] = ci; 50014 cs[1] = ci + 3; 50015 break; 50016 50017 case 1: 50018 tmp1 = ps[12]; 50019 tmp2 = ps[13]; 50020 tmp3 = ps[14]; 50021 tmp4 = ps[15]; 50022 ps[12] = tmp4; 50023 ps[13] = pi + 0; 50024 ps[14] = pi + 1; 50025 ps[15] = pi + 2; 50026 ps[8] = tmp3; 50027 ps[11] = pi + 3; 50028 ps[4] = tmp2; 50029 ps[7] = pi + 4; 50030 ps[0] = tmp1; 50031 ps[1] = pi + 7; 50032 ps[2] = pi + 6; 50033 ps[3] = pi + 5; 50034 tmp1 = cs[2]; 50035 tmp2 = cs[3]; 50036 cs[2] = tmp2; 50037 cs[3] = ci; 50038 cs[0] = tmp1; 50039 cs[1] = ci + 1; 50040 break; 50041 50042 case 2: 50043 tmp1 = ps[15]; 50044 tmp2 = ps[11]; 50045 ps[12] = ps[3]; 50046 ps[13] = pi + 0; 50047 ps[14] = pi + 1; 50048 ps[15] = pi + 2; 50049 ps[8] = ps[7]; 50050 ps[11] = pi + 3; 50051 ps[4] = tmp2; 50052 ps[7] = pi + 4; 50053 ps[0] = tmp1; 50054 ps[1] = pi + 7; 50055 ps[2] = pi + 6; 50056 ps[3] = pi + 5; 50057 tmp1 = cs[3]; 50058 cs[2] = cs[1]; 50059 cs[3] = ci; 50060 cs[0] = tmp1; 50061 cs[1] = ci + 1; 50062 break; 50063 50064 case 3: 50065 ps[12] = ps[0]; 50066 ps[13] = pi + 0; 50067 ps[14] = pi + 1; 50068 ps[15] = pi + 2; 50069 ps[8] = ps[1]; 50070 ps[11] = pi + 3; 50071 ps[4] = ps[2]; 50072 ps[7] = pi + 4; 50073 ps[0] = ps[3]; 50074 ps[1] = pi + 7; 50075 ps[2] = pi + 6; 50076 ps[3] = pi + 5; 50077 cs[2] = cs[0]; 50078 cs[3] = ci; 50079 cs[0] = cs[1]; 50080 cs[1] = ci + 1; 50081 break; 50082 } 50083 50084 ps[5] = coords.length; 50085 coords.push([(-4 * coords[ps[0]][0] - coords[ps[15]][0] + 6 * (coords[ps[4]][0] + coords[ps[1]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[13]][0] + coords[ps[7]][0])) / 9, (-4 * coords[ps[0]][1] - coords[ps[15]][1] + 6 * (coords[ps[4]][1] + coords[ps[1]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[13]][1] + coords[ps[7]][1])) / 9]); 50086 ps[6] = coords.length; 50087 coords.push([(-4 * coords[ps[3]][0] - coords[ps[12]][0] + 6 * (coords[ps[2]][0] + coords[ps[7]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[4]][0] + coords[ps[14]][0])) / 9, (-4 * coords[ps[3]][1] - coords[ps[12]][1] + 6 * (coords[ps[2]][1] + coords[ps[7]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[4]][1] + coords[ps[14]][1])) / 9]); 50088 ps[9] = coords.length; 50089 coords.push([(-4 * coords[ps[12]][0] - coords[ps[3]][0] + 6 * (coords[ps[8]][0] + coords[ps[13]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[11]][0] + coords[ps[1]][0])) / 9, (-4 * coords[ps[12]][1] - coords[ps[3]][1] + 6 * (coords[ps[8]][1] + coords[ps[13]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[11]][1] + coords[ps[1]][1])) / 9]); 50090 ps[10] = coords.length; 50091 coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]); 50092 this.figures.push({ 50093 type: "patch", 50094 coords: new Int32Array(ps), 50095 colors: new Int32Array(cs) 50096 }); 50097 } 50098 } 50099 50100 _decodeType7Shading(reader) { 50101 const coords = this.coords; 50102 const colors = this.colors; 50103 const ps = new Int32Array(16); 50104 const cs = new Int32Array(4); 50105 50106 while (reader.hasData) { 50107 const f = reader.readFlag(); 50108 50109 if (!(0 <= f && f <= 3)) { 50110 throw new _util.FormatError("Unknown type7 flag"); 50111 } 50112 50113 const pi = coords.length; 50114 50115 for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) { 50116 coords.push(reader.readCoordinate()); 50117 } 50118 50119 const ci = colors.length; 50120 50121 for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 50122 colors.push(reader.readComponents()); 50123 } 50124 50125 let tmp1, tmp2, tmp3, tmp4; 50126 50127 switch (f) { 50128 case 0: 50129 ps[12] = pi + 3; 50130 ps[13] = pi + 4; 50131 ps[14] = pi + 5; 50132 ps[15] = pi + 6; 50133 ps[8] = pi + 2; 50134 ps[9] = pi + 13; 50135 ps[10] = pi + 14; 50136 ps[11] = pi + 7; 50137 ps[4] = pi + 1; 50138 ps[5] = pi + 12; 50139 ps[6] = pi + 15; 50140 ps[7] = pi + 8; 50141 ps[0] = pi; 50142 ps[1] = pi + 11; 50143 ps[2] = pi + 10; 50144 ps[3] = pi + 9; 50145 cs[2] = ci + 1; 50146 cs[3] = ci + 2; 50147 cs[0] = ci; 50148 cs[1] = ci + 3; 50149 break; 50150 50151 case 1: 50152 tmp1 = ps[12]; 50153 tmp2 = ps[13]; 50154 tmp3 = ps[14]; 50155 tmp4 = ps[15]; 50156 ps[12] = tmp4; 50157 ps[13] = pi + 0; 50158 ps[14] = pi + 1; 50159 ps[15] = pi + 2; 50160 ps[8] = tmp3; 50161 ps[9] = pi + 9; 50162 ps[10] = pi + 10; 50163 ps[11] = pi + 3; 50164 ps[4] = tmp2; 50165 ps[5] = pi + 8; 50166 ps[6] = pi + 11; 50167 ps[7] = pi + 4; 50168 ps[0] = tmp1; 50169 ps[1] = pi + 7; 50170 ps[2] = pi + 6; 50171 ps[3] = pi + 5; 50172 tmp1 = cs[2]; 50173 tmp2 = cs[3]; 50174 cs[2] = tmp2; 50175 cs[3] = ci; 50176 cs[0] = tmp1; 50177 cs[1] = ci + 1; 50178 break; 50179 50180 case 2: 50181 tmp1 = ps[15]; 50182 tmp2 = ps[11]; 50183 ps[12] = ps[3]; 50184 ps[13] = pi + 0; 50185 ps[14] = pi + 1; 50186 ps[15] = pi + 2; 50187 ps[8] = ps[7]; 50188 ps[9] = pi + 9; 50189 ps[10] = pi + 10; 50190 ps[11] = pi + 3; 50191 ps[4] = tmp2; 50192 ps[5] = pi + 8; 50193 ps[6] = pi + 11; 50194 ps[7] = pi + 4; 50195 ps[0] = tmp1; 50196 ps[1] = pi + 7; 50197 ps[2] = pi + 6; 50198 ps[3] = pi + 5; 50199 tmp1 = cs[3]; 50200 cs[2] = cs[1]; 50201 cs[3] = ci; 50202 cs[0] = tmp1; 50203 cs[1] = ci + 1; 50204 break; 50205 50206 case 3: 50207 ps[12] = ps[0]; 50208 ps[13] = pi + 0; 50209 ps[14] = pi + 1; 50210 ps[15] = pi + 2; 50211 ps[8] = ps[1]; 50212 ps[9] = pi + 9; 50213 ps[10] = pi + 10; 50214 ps[11] = pi + 3; 50215 ps[4] = ps[2]; 50216 ps[5] = pi + 8; 50217 ps[6] = pi + 11; 50218 ps[7] = pi + 4; 50219 ps[0] = ps[3]; 50220 ps[1] = pi + 7; 50221 ps[2] = pi + 6; 50222 ps[3] = pi + 5; 50223 cs[2] = cs[0]; 50224 cs[3] = ci; 50225 cs[0] = cs[1]; 50226 cs[1] = ci + 1; 50227 break; 50228 } 50229 50230 this.figures.push({ 50231 type: "patch", 50232 coords: new Int32Array(ps), 50233 colors: new Int32Array(cs) 50234 }); 50235 } 50236 } 50237 50238 _buildFigureFromPatch(index) { 50239 const figure = this.figures[index]; 50240 (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure"); 50241 const coords = this.coords, 50242 colors = this.colors; 50243 const pi = figure.coords; 50244 const ci = figure.colors; 50245 const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 50246 const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 50247 const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 50248 const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 50249 let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0])); 50250 splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy)); 50251 let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1])); 50252 splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy)); 50253 const verticesPerRow = splitXBy + 1; 50254 const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow); 50255 const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow); 50256 let k = 0; 50257 const cl = new Uint8Array(3), 50258 cr = new Uint8Array(3); 50259 const c0 = colors[ci[0]], 50260 c1 = colors[ci[1]], 50261 c2 = colors[ci[2]], 50262 c3 = colors[ci[3]]; 50263 const bRow = getB(splitYBy), 50264 bCol = getB(splitXBy); 50265 50266 for (let row = 0; row <= splitYBy; row++) { 50267 cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0; 50268 cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0; 50269 cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0; 50270 cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0; 50271 cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0; 50272 cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0; 50273 50274 for (let col = 0; col <= splitXBy; col++, k++) { 50275 if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) { 50276 continue; 50277 } 50278 50279 let x = 0, 50280 y = 0; 50281 let q = 0; 50282 50283 for (let i = 0; i <= 3; i++) { 50284 for (let j = 0; j <= 3; j++, q++) { 50285 const m = bRow[row][i] * bCol[col][j]; 50286 x += coords[pi[q]][0] * m; 50287 y += coords[pi[q]][1] * m; 50288 } 50289 } 50290 50291 figureCoords[k] = coords.length; 50292 coords.push([x, y]); 50293 figureColors[k] = colors.length; 50294 const newColor = new Uint8Array(3); 50295 newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0; 50296 newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0; 50297 newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0; 50298 colors.push(newColor); 50299 } 50300 } 50301 50302 figureCoords[0] = pi[0]; 50303 figureColors[0] = ci[0]; 50304 figureCoords[splitXBy] = pi[3]; 50305 figureColors[splitXBy] = ci[1]; 50306 figureCoords[verticesPerRow * splitYBy] = pi[12]; 50307 figureColors[verticesPerRow * splitYBy] = ci[2]; 50308 figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15]; 50309 figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3]; 50310 this.figures[index] = { 50311 type: "lattice", 50312 coords: figureCoords, 50313 colors: figureColors, 50314 verticesPerRow 50315 }; 50316 } 50317 50318 _updateBounds() { 50319 let minX = this.coords[0][0], 50320 minY = this.coords[0][1], 50321 maxX = minX, 50322 maxY = minY; 50323 50324 for (let i = 1, ii = this.coords.length; i < ii; i++) { 50325 const x = this.coords[i][0], 50326 y = this.coords[i][1]; 50327 minX = minX > x ? x : minX; 50328 minY = minY > y ? y : minY; 50329 maxX = maxX < x ? x : maxX; 50330 maxY = maxY < y ? y : maxY; 50331 } 50332 50333 this.bounds = [minX, minY, maxX, maxY]; 50334 } 50335 50336 _packData() { 50337 let i, ii, j, jj; 50338 const coords = this.coords; 50339 const coordsPacked = new Float32Array(coords.length * 2); 50340 50341 for (i = 0, j = 0, ii = coords.length; i < ii; i++) { 50342 const xy = coords[i]; 50343 coordsPacked[j++] = xy[0]; 50344 coordsPacked[j++] = xy[1]; 50345 } 50346 50347 this.coords = coordsPacked; 50348 const colors = this.colors; 50349 const colorsPacked = new Uint8Array(colors.length * 3); 50350 50351 for (i = 0, j = 0, ii = colors.length; i < ii; i++) { 50352 const c = colors[i]; 50353 colorsPacked[j++] = c[0]; 50354 colorsPacked[j++] = c[1]; 50355 colorsPacked[j++] = c[2]; 50356 } 50357 50358 this.colors = colorsPacked; 50359 const figures = this.figures; 50360 50361 for (i = 0, ii = figures.length; i < ii; i++) { 50362 const figure = figures[i], 50363 ps = figure.coords, 50364 cs = figure.colors; 50365 50366 for (j = 0, jj = ps.length; j < jj; j++) { 50367 ps[j] *= 2; 50368 cs[j] *= 3; 50369 } 50370 } 50371 } 50372 50373 getIR() { 50374 return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background]; 50375 } 50376 50377} 50378 50379class DummyShading extends BaseShading { 50380 getIR() { 50381 return ["Dummy"]; 50382 } 50383 50384} 50385 50386function getTilingPatternIR(operatorList, dict, color) { 50387 const matrix = dict.getArray("Matrix"); 50388 50389 const bbox = _util.Util.normalizeRect(dict.getArray("BBox")); 50390 50391 const xstep = dict.get("XStep"); 50392 const ystep = dict.get("YStep"); 50393 const paintType = dict.get("PaintType"); 50394 const tilingType = dict.get("TilingType"); 50395 50396 if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) { 50397 throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`); 50398 } 50399 50400 return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType]; 50401} 50402 50403/***/ }), 50404/* 51 */ 50405/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 50406 50407 50408 50409Object.defineProperty(exports, "__esModule", ({ 50410 value: true 50411})); 50412exports.getXfaFontDict = getXfaFontDict; 50413exports.getXfaFontName = getXfaFontName; 50414 50415var _calibri_factors = __w_pdfjs_require__(52); 50416 50417var _primitives = __w_pdfjs_require__(5); 50418 50419var _helvetica_factors = __w_pdfjs_require__(53); 50420 50421var _liberationsans_widths = __w_pdfjs_require__(54); 50422 50423var _myriadpro_factors = __w_pdfjs_require__(55); 50424 50425var _segoeui_factors = __w_pdfjs_require__(56); 50426 50427var _core_utils = __w_pdfjs_require__(6); 50428 50429var _fonts_utils = __w_pdfjs_require__(38);
vendor: 6,188 bytes, lines 50430-50564
50430 50431const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 50432 t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = { 50433 name: "LiberationSans-Regular", 50434 factors: _myriadpro_factors.MyriadProRegularFactors, 50435 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 50436 baseMapping: _liberationsans_widths.LiberationSansRegularMapping, 50437 metrics: _myriadpro_factors.MyriadProRegularMetrics 50438 }; 50439 t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = { 50440 name: "LiberationSans-Bold", 50441 factors: _myriadpro_factors.MyriadProBoldFactors, 50442 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 50443 baseMapping: _liberationsans_widths.LiberationSansBoldMapping, 50444 metrics: _myriadpro_factors.MyriadProBoldMetrics 50445 }; 50446 t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = { 50447 name: "LiberationSans-Italic", 50448 factors: _myriadpro_factors.MyriadProItalicFactors, 50449 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 50450 baseMapping: _liberationsans_widths.LiberationSansItalicMapping, 50451 metrics: _myriadpro_factors.MyriadProItalicMetrics 50452 }; 50453 t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = { 50454 name: "LiberationSans-BoldItalic", 50455 factors: _myriadpro_factors.MyriadProBoldItalicFactors, 50456 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 50457 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping, 50458 metrics: _myriadpro_factors.MyriadProBoldItalicMetrics 50459 }; 50460 t.ArialMT = t.Arial = t["Arial-Regular"] = { 50461 name: "LiberationSans-Regular", 50462 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 50463 baseMapping: _liberationsans_widths.LiberationSansRegularMapping 50464 }; 50465 t["Arial-BoldMT"] = t["Arial-Bold"] = { 50466 name: "LiberationSans-Bold", 50467 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 50468 baseMapping: _liberationsans_widths.LiberationSansBoldMapping 50469 }; 50470 t["Arial-ItalicMT"] = t["Arial-Italic"] = { 50471 name: "LiberationSans-Italic", 50472 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 50473 baseMapping: _liberationsans_widths.LiberationSansItalicMapping 50474 }; 50475 t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = { 50476 name: "LiberationSans-BoldItalic", 50477 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 50478 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping 50479 }; 50480 t["Calibri-Regular"] = { 50481 name: "LiberationSans-Regular", 50482 factors: _calibri_factors.CalibriRegularFactors, 50483 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 50484 baseMapping: _liberationsans_widths.LiberationSansRegularMapping, 50485 metrics: _calibri_factors.CalibriRegularMetrics 50486 }; 50487 t["Calibri-Bold"] = { 50488 name: "LiberationSans-Bold", 50489 factors: _calibri_factors.CalibriBoldFactors, 50490 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 50491 baseMapping: _liberationsans_widths.LiberationSansBoldMapping, 50492 metrics: _calibri_factors.CalibriBoldMetrics 50493 }; 50494 t["Calibri-Italic"] = { 50495 name: "LiberationSans-Italic", 50496 factors: _calibri_factors.CalibriItalicFactors, 50497 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 50498 baseMapping: _liberationsans_widths.LiberationSansItalicMapping, 50499 metrics: _calibri_factors.CalibriItalicMetrics 50500 }; 50501 t["Calibri-BoldItalic"] = { 50502 name: "LiberationSans-BoldItalic", 50503 factors: _calibri_factors.CalibriBoldItalicFactors, 50504 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 50505 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping, 50506 metrics: _calibri_factors.CalibriBoldItalicMetrics 50507 }; 50508 t["Segoeui-Regular"] = { 50509 name: "LiberationSans-Regular", 50510 factors: _segoeui_factors.SegoeuiRegularFactors, 50511 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 50512 baseMapping: _liberationsans_widths.LiberationSansRegularMapping, 50513 metrics: _segoeui_factors.SegoeuiRegularMetrics 50514 }; 50515 t["Segoeui-Bold"] = { 50516 name: "LiberationSans-Bold", 50517 factors: _segoeui_factors.SegoeuiBoldFactors, 50518 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 50519 baseMapping: _liberationsans_widths.LiberationSansBoldMapping, 50520 metrics: _segoeui_factors.SegoeuiBoldMetrics 50521 }; 50522 t["Segoeui-Italic"] = { 50523 name: "LiberationSans-Italic", 50524 factors: _segoeui_factors.SegoeuiItalicFactors, 50525 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 50526 baseMapping: _liberationsans_widths.LiberationSansItalicMapping, 50527 metrics: _segoeui_factors.SegoeuiItalicMetrics 50528 }; 50529 t["Segoeui-BoldItalic"] = { 50530 name: "LiberationSans-BoldItalic", 50531 factors: _segoeui_factors.SegoeuiBoldItalicFactors, 50532 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 50533 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping, 50534 metrics: _segoeui_factors.SegoeuiBoldItalicMetrics 50535 }; 50536 t["Helvetica-Regular"] = t.Helvetica = { 50537 name: "LiberationSans-Regular", 50538 factors: _helvetica_factors.HelveticaRegularFactors, 50539 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 50540 baseMapping: _liberationsans_widths.LiberationSansRegularMapping, 50541 metrics: _helvetica_factors.HelveticaRegularMetrics 50542 }; 50543 t["Helvetica-Bold"] = { 50544 name: "LiberationSans-Bold", 50545 factors: _helvetica_factors.HelveticaBoldFactors, 50546 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 50547 baseMapping: _liberationsans_widths.LiberationSansBoldMapping, 50548 metrics: _helvetica_factors.HelveticaBoldMetrics 50549 }; 50550 t["Helvetica-Italic"] = { 50551 name: "LiberationSans-Italic", 50552 factors: _helvetica_factors.HelveticaItalicFactors, 50553 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 50554 baseMapping: _liberationsans_widths.LiberationSansItalicMapping, 50555 metrics: _helvetica_factors.HelveticaItalicMetrics 50556 }; 50557 t["Helvetica-BoldItalic"] = { 50558 name: "LiberationSans-BoldItalic", 50559 factors: _helvetica_factors.HelveticaBoldItalicFactors, 50560 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 50561 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping, 50562 metrics: _helvetica_factors.HelveticaBoldItalicMetrics 50563 }; 50564});
vendor: 2,312 bytes, lines 50565-50644
50565 50566function getXfaFontName(name) { 50567 const fontName = (0, _fonts_utils.normalizeFontName)(name); 50568 const fontMap = getXFAFontMap(); 50569 return fontMap[fontName]; 50570} 50571 50572function getXfaFontWidths(name) { 50573 const info = getXfaFontName(name); 50574 50575 if (!info) { 50576 return null; 50577 } 50578 50579 const { 50580 baseWidths, 50581 baseMapping, 50582 factors 50583 } = info; 50584 let rescaledBaseWidths; 50585 50586 if (!factors) { 50587 rescaledBaseWidths = baseWidths; 50588 } else { 50589 rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]); 50590 } 50591 50592 let currentCode = -2; 50593 let currentArray; 50594 const newWidths = []; 50595 50596 for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) { 50597 if (unicode === -1) { 50598 continue; 50599 } 50600 50601 if (unicode === currentCode + 1) { 50602 currentArray.push(rescaledBaseWidths[glyphIndex]); 50603 currentCode += 1; 50604 } else { 50605 currentCode = unicode; 50606 currentArray = [rescaledBaseWidths[glyphIndex]]; 50607 newWidths.push(unicode, currentArray); 50608 } 50609 } 50610 50611 return newWidths; 50612} 50613 50614function getXfaFontDict(name) { 50615 const widths = getXfaFontWidths(name); 50616 const dict = new _primitives.Dict(null); 50617 dict.set("BaseFont", _primitives.Name.get(name)); 50618 dict.set("Type", _primitives.Name.get("Font")); 50619 dict.set("Subtype", _primitives.Name.get("CIDFontType2")); 50620 dict.set("Encoding", _primitives.Name.get("Identity-H")); 50621 dict.set("CIDToGIDMap", _primitives.Name.get("Identity")); 50622 dict.set("W", widths); 50623 dict.set("FirstChar", widths[0]); 50624 dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1); 50625 const descriptor = new _primitives.Dict(null); 50626 dict.set("FontDescriptor", descriptor); 50627 const systemInfo = new _primitives.Dict(null); 50628 systemInfo.set("Ordering", "Identity"); 50629 systemInfo.set("Registry", "Adobe"); 50630 systemInfo.set("Supplement", 0); 50631 dict.set("CIDSystemInfo", systemInfo); 50632 return dict; 50633} 50634 50635/***/ }), 50636/* 52 */ 50637/***/ ((__unused_webpack_module, exports) => { 50638 50639 50640 50641Object.defineProperty(exports, "__esModule", ({ 50642 value: true 50643})); 50644exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
vendor: 3,187 bytes, lines 50644-50645
50644 50645const CalibriBoldFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.54657, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.73293, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.9121, 0.86943, 0.79795, 0.88198, 0.77958, 0.70864, 0.81055, 0.90399, 0.88653, 0.96017, 0.82577, 0.77892, 0.78257, 0.97507, 1.54657, 0.97507, 0.85284, 0.89552, 0.90176, 0.88762, 0.8785, 0.75241, 0.8785, 0.90518, 0.95015, 0.77618, 0.8785, 0.88401, 0.91916, 0.86304, 0.88401, 0.91488, 0.8785, 0.8801, 0.8785, 0.8785, 0.91343, 0.7173, 1.04106, 0.8785, 0.85075, 0.95794, 0.82616, 0.85162, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.12401, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.73293, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.9121, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.85284, 0.87508, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.8715, 0.75241, 0.90518, 0.90518, 0.90518, 0.90518, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.8785, 0.8801, 0.8801, 0.8801, 0.8801, 0.8801, 0.90747, 0.89049, 0.8785, 0.8785, 0.8785, 0.8785, 0.85162, 0.8785, 0.85162, 0.83908, 0.88762, 0.83908, 0.88762, 0.83908, 0.88762, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.87289, 0.83016, 0.88506, 0.93125, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.81921, 0.77618, 0.81921, 0.77618, 0.81921, 0.77618, 1, 1, 0.87356, 0.8785, 0.91075, 0.89608, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76229, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.79468, 0.91926, 0.88175, 0.70823, 0.94903, 0.9121, 0.8785, 1, 1, 0.9121, 0.8785, 0.87802, 0.88656, 0.8785, 0.86943, 0.8801, 0.86943, 0.8801, 0.86943, 0.8801, 0.87402, 0.89291, 0.77958, 0.91343, 1, 1, 0.77958, 0.91343, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.96017, 0.95794, 0.77892, 0.85162, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.88762, 0.77539, 0.8715, 0.87508, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70674, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.06303, 0.83908, 0.80352, 0.57184, 0.6965, 0.56289, 0.82001, 0.56029, 0.81235, 1.02988, 0.83908, 0.7762, 0.68156, 0.80367, 0.73133, 0.78257, 0.87356, 0.86943, 0.95958, 0.75727, 0.89019, 1.04924, 0.9121, 0.7648, 0.86943, 0.87356, 0.79795, 0.78275, 0.81055, 0.77892,
vendor: 7,325 bytes, lines 50645-50659
506450.9762, 0.82577, 0.99819, 0.84896, 0.95958, 0.77892, 0.96108, 1.01407, 0.89049, 1.02988, 0.94211, 0.96108, 0.8936, 0.84021, 0.87842, 0.96399, 0.79109, 0.89049, 1.00813, 1.02988, 0.86077, 0.87445, 0.92099, 0.84723, 0.86513, 0.8801, 0.75638, 0.85714, 0.78216, 0.79586, 0.87965, 0.94211, 0.97747, 0.78287, 0.97926, 0.84971, 1.02988, 0.94211, 0.8801, 0.94211, 0.84971, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90264, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90518, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90548, 1, 1, 1, 1, 1, 1, 0.96017, 0.95794, 0.96017, 0.95794, 0.96017, 0.95794, 0.77892, 0.85162, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.92794, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71143, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.93835, 0.83406, 0.91133, 0.84107, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90527, 1.81055, 0.90527, 1.81055, 1.31006, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50646exports.CalibriBoldFactors = CalibriBoldFactors; 50647const CalibriBoldMetrics = { 50648 lineHeight: 1.2207, 50649 lineGap: 0.2207 50650}; 50651exports.CalibriBoldMetrics = CalibriBoldMetrics; 50652const CalibriBoldItalicFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.56239, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.71805, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.90872, 0.85938, 0.79795, 0.87068, 0.77958, 0.69766, 0.81055, 0.90399, 0.88653, 0.96068, 0.82577, 0.77892, 0.78257, 0.97507, 1.529, 0.97507, 0.85284, 0.89552, 0.90176, 0.94908, 0.86411, 0.74012, 0.86411, 0.88323, 0.95015, 0.86411, 0.86331, 0.88401, 0.91916, 0.86304, 0.88401, 0.9039, 0.86331, 0.86331, 0.86411, 0.86411, 0.90464, 0.70852, 1.04106, 0.86331, 0.84372, 0.95794, 0.82616, 0.84548, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.19129, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.71805, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.90872, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.85284, 0.87068, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.85887, 0.74012, 0.88323, 0.88323, 0.88323, 0.88323, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.90747, 0.89049, 0.86331, 0.86331, 0.86331, 0.86331, 0.84548, 0.86411, 0.84548, 0.83908, 0.94908, 0.83908, 0.94908, 0.83908, 0.94908, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.87289, 0.79538, 0.88506, 0.92726, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.81921, 0.86411, 0.81921, 0.86411, 0.81921, 0.86411, 1, 1, 0.87356, 0.86331, 0.91075, 0.8777, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76467, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.77312, 0.91926, 0.88175, 0.70823, 0.94903, 0.90872, 0.86331, 1, 1, 0.90872, 0.86331, 0.86906, 0.88116, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.87402, 0.86549, 0.77958, 0.90464, 1, 1, 0.77958, 0.90464, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.96068, 0.95794, 0.77892, 0.84548, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.94908, 0.77539, 0.85887, 0.87068, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70088, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.48387, 0.83908, 0.80352, 0.57118, 0.6965, 0.56347, 0.79179, 0.55853, 0.80346, 1.02988, 0.83908, 0.7762, 0.67174, 0.86036, 0.73133, 0.78257, 0.87356, 0.86441, 0.95958, 0.75727, 0.89019, 1.04924, 0.90872, 0.74889, 0.85938, 0.87891, 0.79795, 0.7957, 0.81055, 0.77892, 0.97447, 0.82577, 0.97466, 0.87179, 0.95958, 0.77892, 0.94252, 0.95612, 0.8753, 1.02988, 0.92733, 0.94252, 0.87411, 0.84021, 0.8728, 0.95612, 0.74081, 0.8753, 1.02189, 1.02988, 0.84814, 0.87445, 0.91822, 0.84723, 0.85668, 0.86331, 0.81344, 0.87581, 0.76422, 0.82046, 0.96057, 0.92733, 0.99375, 0.78022, 0.95452, 0.86015, 1.02988, 0.92733, 0.86331, 0.92733, 0.86015, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90631, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88323, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85174, 1, 1, 1, 1, 1, 1, 0.96068, 0.95794, 0.96068, 0.95794, 0.96068, 0.95794, 0.77892, 0.84548, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.89807, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71094, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.92972, 0.83406, 0.91133, 0.83326, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90616, 1.81055, 0.90527, 1.81055, 1.3107, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50653exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors; 50654const CalibriBoldItalicMetrics = { 50655 lineHeight: 1.2207, 50656 lineGap: 0.2207 50657}; 50658exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics; 50659const CalibriItalicFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39543, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.72346, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892,
vendor: 3,657 bytes, line 50659
506590.75593, 1.02638, 0.89249, 0.84118, 0.77452, 0.85374, 0.75186, 0.67789, 0.79776, 0.88844, 0.85066, 0.94309, 0.77818, 0.7306, 0.76659, 1.10369, 1.38313, 1.10369, 1.06139, 0.89552, 0.8739, 0.9245, 0.9245, 0.83203, 0.9245, 0.85865, 1.09842, 0.9245, 0.9245, 1.03297, 1.07692, 0.90918, 1.03297, 0.94959, 0.9245, 0.92274, 0.9245, 0.9245, 1.02933, 0.77832, 1.20562, 0.9245, 0.8916, 0.98986, 0.86621, 0.89453, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.16359, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.72346, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89249, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.85284, 0.84557, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.84843, 0.83203, 0.85865, 0.85865, 0.85865, 0.85865, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.9245, 0.92274, 0.92274, 0.92274, 0.92274, 0.92274, 0.90747, 0.86651, 0.9245, 0.9245, 0.9245, 0.9245, 0.89453, 0.9245, 0.89453, 0.8675, 0.9245, 0.8675, 0.9245, 0.8675, 0.9245, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.85193, 0.8875, 0.86477, 0.99034, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.81105, 0.9245, 0.81105, 0.9245, 0.81105, 0.9245, 1, 1, 0.86275, 0.9245, 0.90872, 0.93591, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77896, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.9375, 0.98156, 0.93407, 0.77261, 1.11429, 0.89249, 0.9245, 1, 1, 0.89249, 0.9245, 0.92534, 0.86698, 0.9245, 0.84118, 0.92274, 0.84118, 0.92274, 0.84118, 0.92274, 0.8667, 0.86291, 0.75186, 1.02933, 1, 1, 0.75186, 1.02933, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 1, 1, 0.79776, 0.97655, 0.79776, 1.23023, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.94309, 0.98986, 0.7306, 0.89453, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.9245, 0.76318, 0.84843, 0.84557, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67009, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.8675, 0.90861, 0.6192, 0.7363, 0.64824, 0.82411, 0.56321, 0.85696, 1.23516, 0.8675, 0.81552, 0.7286, 0.84134, 0.73206, 0.76659, 0.86275, 0.84369, 0.90685, 0.77892, 0.85871, 1.02638, 0.89249, 0.75828, 0.84118, 0.85984, 0.77452, 0.76466, 0.79776, 0.7306, 0.90782, 0.77818, 0.903, 0.87291, 0.90685, 0.7306, 0.99058, 1.03667, 0.94635, 1.23516, 0.9849, 0.99058, 0.92393, 0.8916, 0.942, 1.03667, 0.75026, 0.94635, 1.0297, 1.23516, 0.90918, 0.94048, 0.98217, 0.89746, 0.84153, 0.92274, 0.82507, 0.88832, 0.84438, 0.88178, 1.03525, 0.9849, 1.00225, 0.78086, 0.97248, 0.89404, 1.23516, 0.9849, 0.92274, 0.9849, 0.89404, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89693, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85865, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90933, 1, 1, 1, 1, 1, 1, 0.94309, 0.98986, 0.94309, 0.98986, 0.94309, 0.98986, 0.7306, 0.89453, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.68994, 1.03809, 1, 1, 1.0176, 1.01
vendor: 1,327 bytes, lines 50659-50666
5065976, 1.11523, 1.4956, 2.01462, 0.97858, 0.82616, 0.91133, 0.83437, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90572, 1.81055, 0.90749, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85284, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50660exports.CalibriItalicFactors = CalibriItalicFactors; 50661const CalibriItalicMetrics = { 50662 lineHeight: 1.2207, 50663 lineGap: 0.2207 50664}; 50665exports.CalibriItalicMetrics = CalibriItalicMetrics; 50666const CalibriRegularFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39016, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.73834, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892,
vendor: 4,437 bytes, line 50666
506660.75593, 1.02638, 0.89385, 0.85122, 0.77452, 0.86503, 0.75186, 0.68887, 0.79776, 0.88844, 0.85066, 0.94258, 0.77818, 0.7306, 0.76659, 1.10369, 1.39016, 1.10369, 1.06139, 0.89552, 0.8739, 0.86128, 0.94469, 0.8457, 0.94469, 0.89464, 1.09842, 0.84636, 0.94469, 1.03297, 1.07692, 0.90918, 1.03297, 0.95897, 0.94469, 0.9482, 0.94469, 0.94469, 1.04692, 0.78223, 1.20562, 0.94469, 0.90332, 0.98986, 0.86621, 0.90527, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.08707, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.73834, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89385, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.85284, 0.85311, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.8693, 0.8457, 0.89464, 0.89464, 0.89464, 0.89464, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.94469, 0.9482, 0.9482, 0.9482, 0.9482, 0.9482, 0.90747, 0.86651, 0.94469, 0.94469, 0.94469, 0.94469, 0.90527, 0.94469, 0.90527, 0.8675, 0.86128, 0.8675, 0.86128, 0.8675, 0.86128, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.85193, 0.92454, 0.86477, 0.9921, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.81105, 0.84636, 0.81105, 0.84636, 0.81105, 0.84636, 1, 1, 0.86275, 0.94469, 0.90872, 0.95786, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77741, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.90452, 0.98156, 1.11842, 0.77261, 1.11429, 0.89385, 0.94469, 1, 1, 0.89385, 0.94469, 0.95877, 0.86901, 0.94469, 0.85122, 0.9482, 0.85122, 0.9482, 0.85122, 0.9482, 0.8667, 0.90016, 0.75186, 1.04692, 1, 1, 0.75186, 1.04692, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 1, 1, 0.79776, 0.92188, 0.79776, 1.23023, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.94258, 0.98986, 0.7306, 0.90527, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.86128, 0.76318, 0.8693, 0.85311, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67742, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.86686, 0.90861, 0.62267, 0.74359, 0.65649, 0.85498, 0.56963, 0.88254, 1.23516, 0.8675, 0.81552, 0.75443, 0.84503, 0.73206, 0.76659, 0.86275, 0.85122, 0.90685, 0.77892, 0.85746, 1.02638, 0.89385, 0.75657, 0.85122, 0.86275, 0.77452, 0.74171, 0.79776, 0.7306, 0.95165, 0.77818, 0.89772, 0.88831, 0.90685, 0.7306, 0.98142, 1.02191, 0.96576, 1.23516, 0.99018, 0.98142, 0.9236, 0.89258, 0.94035, 1.02191, 0.78848, 0.96576, 0.9561, 1.23516, 0.90918, 0.92578, 0.95424, 0.89746, 0.83969, 0.9482, 0.80113, 0.89442, 0.85208, 0.86155, 0.98022, 0.99018, 1.00452, 0.81209, 0.99247, 0.89181, 1.23516, 0.99018, 0.9482, 0.99018, 0.89181, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88844, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89464, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96766, 1, 1, 1, 1, 1, 1, 0.94258, 0.98986, 0.94258, 0.98986, 0.94258, 0.98986, 0.7306, 0.90527, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.69043, 1.03809, 1, 1, 1.0176, 1.0176, 1.11523, 1.4956, 2.01462, 0.99331, 0.82616, 0.91133, 0.84286, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90527, 1.81055, 0.90527, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1.07185, 0.99413, 0.96334, 1.08065, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
50667exports.CalibriRegularFactors = CalibriRegularFactors; 50668const CalibriRegularMetrics = { 50669 lineHeight: 1.2207, 50670 lineGap: 0.2207 50671}; 50672exports.CalibriRegularMetrics = CalibriRegularMetrics; 50673 50674/***/ }), 50675/* 53
vendor: 23,599 bytes, lines 50675-50714
50675 */ 50676/***/ ((__unused_webpack_module, exports) => { 50677 50678 50679 50680Object.defineProperty(exports, "__esModule", ({ 50681 value: true 50682})); 50683exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0; 50684const HelveticaBoldFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.03374, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00042, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.03828, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00034, 0.99977, 1, 0.99997, 1.00026, 1.00078, 1.00036, 0.99973, 1.00013, 1.0006, 0.99977, 0.99977, 0.99988, 0.85148, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 1.00069, 1.00022, 0.99977, 1.00001, 0.99984, 1.00026, 1.00001, 1.00024, 1.00001, 0.9999, 1, 1.0006, 1.00001, 1.00041, 0.99962, 1.00026, 1.0006, 0.99995, 1.00041, 0.99942, 0.99973, 0.99927, 1.00082, 0.99902, 1.00026, 1.00087, 1.0006, 1.00069, 0.99973, 0.99867, 0.99973, 0.9993, 1.00026, 1.00049, 1.00056, 1, 0.99988, 0.99935, 0.99995, 0.99954, 1.00055, 0.99945, 1.00032, 1.0006, 0.99995, 1.00026, 0.99995, 1.00032, 1.00001, 1.00008, 0.99971, 1.00019, 0.9994, 1.00001, 1.0006, 1.00044, 0.99973, 1.00023, 1.00047, 1, 0.99942, 0.99561, 0.99989, 1.00035, 0.99977, 1.00035, 0.99977, 1.00019, 0.99944, 1.00001, 1.00021, 0.99926, 1.00035, 1.00035, 0.99942, 1.00048, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.99989, 1.00057, 1.00001, 0.99936, 1.00052, 1.00012, 0.99996, 1.00043, 1, 1.00035, 0.9994, 0.99976, 1.00035, 0.99973, 1.00052, 1.00041, 1.00119, 1.00037, 0.99973, 1.00002, 0.99986, 1.00041, 1.00041, 0.99902, 0.9996, 1.00034, 0.99999, 1.00026, 0.99999, 1.00026, 0.99973, 1.00052, 0.99973, 1, 0.99973, 1.00041, 1.00075, 0.9994, 1.0003, 0.99999, 1, 1.00041, 0.99955, 1, 0.99915, 0.99973, 0.99973, 1.00026, 1.00119, 0.99955, 0.99973, 1.0006, 0.99911, 1.0006, 1.00026, 0.99972, 1.00026, 0.99902, 1.00041, 0.99973, 0.99999, 1, 1, 1.00038, 1.0005, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 1.00047, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50685exports.HelveticaBoldFactors = HelveticaBoldFactors; 50686const HelveticaBoldMetrics = { 50687 lineHeight: 1.2, 50688 lineGap: 0.2 50689}; 50690exports.HelveticaBoldMetrics = HelveticaBoldMetrics; 50691const HelveticaBoldItalicFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.0044, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99971, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.01011, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99977, 1, 1, 1.00026, 0.99969, 0.99972, 0.99981, 0.9998, 1.0006, 0.99977, 0.99977, 1.00022, 0.91155, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 0.99966, 1.00022, 1.00032, 1.00001, 0.99944, 1.00026, 1.00001, 0.99968, 1.00001, 1.00047, 1, 1.0006, 1.00001, 0.99981, 1.00101, 1.00026, 1.0006, 0.99948, 0.99981, 1.00064, 0.99973, 0.99942, 1.00101, 1.00061, 1.00026, 1.00069, 1.0006, 1.00014, 0.99973, 1.01322, 0.99973, 1.00065, 1.00026, 1.00012, 0.99923, 1, 1.00064, 1.00076, 0.99948, 1.00055, 1.00063, 1.00007, 0.99943, 1.0006, 0.99948, 1.00026, 0.99948, 0.99943, 1.00001, 1.00001, 1.00029, 1.00038, 1.00035, 1.00001, 1.0006, 1.0006, 0.99973, 0.99978, 1.00001, 1.00057, 0.99989, 0.99967, 0.99964, 0.99967, 0.99977, 0.99999, 0.99977, 1.00038, 0.99977, 1.00001, 0.99973, 1.00066, 0.99967, 0.99967, 1.00041, 0.99998, 0.99999, 0.99977, 1.00022, 0.99967, 1.00001, 0.99977, 1.00026, 0.99964, 1.00031, 1.00001, 0.99999, 0.99999, 1, 1.00023, 1, 1, 0.99999, 1.00035, 1.00001, 0.99999, 0.99973, 0.99977, 0.99999, 1.00058, 0.99973, 0.99973, 0.99955, 0.9995, 1.00026, 1.00026, 1.00032, 0.99989, 1.00034, 0.99999, 1.00026, 1.00026, 1.00026, 0.99973, 0.45998, 0.99973, 1.00026, 0.99973, 1.00001, 0.99999, 0.99982, 0.99994, 0.99996, 1, 1.00042, 1.00044, 1.00029, 1.00023, 0.99973, 0.99973, 1.00026, 0.99949, 1.00002, 0.99973, 1.0006, 1.0006, 1.0006, 0.99975, 1.00026, 1.00026, 1.00032, 0.98685, 0.99973, 1.00026, 1, 1, 0.99966, 1.00044, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1, 0.99973, 0.99971, 0.99978, 1, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00098, 1, 1, 1, 1.00049, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50692exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors; 50693const HelveticaBoldItalicMetrics = { 50694 lineHeight: 1.35, 50695 lineGap: 0.2 50696}; 50697exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics; 50698const HelveticaItalicFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.0288, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 0.99946, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.06311, 0.99973, 1.00024, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00041, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.89547, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00001, 1, 1.00054, 0.99977, 1.00084, 1.00007, 0.99973, 1.00013, 0.99924, 1.00001, 1.00001, 0.99945, 0.91221, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00001, 0.99999, 0.99977, 0.99933, 1.00022, 1.00054, 1.00001, 1.00065, 1.00026, 1.00001, 1.0001, 1.00001, 1.00052, 1, 1.0006, 1.00001, 0.99945, 0.99897, 0.99968, 0.99924, 1.00036, 0.99945, 0.99949, 1, 1.0006, 0.99897, 0.99918, 0.99968, 0.99911, 0.99924, 1, 0.99962, 1.01487, 1, 1.0005, 0.99973, 1.00012, 1.00043, 1, 0.99995, 0.99994, 1.00036, 0.99947, 1.00019, 1.00063, 1.00025, 0.99924, 1.00036, 0.99973, 1.00036, 1.00025, 1.00001, 1.00001, 1.00027, 1.0001, 1.00068, 1.00001, 1.0006, 1.0006, 1, 1.00008, 0.99957, 0.99972, 0.9994, 0.99954, 0.99975, 1.00051, 1.00001, 1.00019, 1.00001, 1.0001, 0.99986, 1.00001, 1.00001, 1.00038, 0.99954, 0.99954, 0.9994, 1.00066, 0.99999, 0.99977, 1.00022, 1.00054, 1.00001, 0.99977, 1.00026, 0.99975, 1.0001, 1.00001, 0.99993, 0.9995, 0.99955, 1.00016, 0.99978, 0.99974, 1.00019, 1.00022, 0.99955, 1.00053, 0.99973, 1.00089, 1.00005, 0.99967, 1.00048, 0.99973, 1.00002, 1.00034, 0.99973, 0.99973, 0.99964, 1.00006, 1.00066, 0.99947, 0.99973, 0.98894, 0.99973, 1, 0.44898, 1, 0.99946, 1, 1.00039, 1.00082, 0.99991, 0.99991, 0.99985, 1.00022, 1.00023, 1.00061, 1.00006, 0.99966, 0.99973, 0.99973, 0.99973, 1.00019, 1.0008, 1, 0.99924, 0.99924, 0.99924, 0.99983, 1.00044, 0.99973, 0.99964, 0.98332, 1, 0.99973, 1, 1, 0.99962, 0.99895, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 1.00423, 0.99925, 0.99999, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00049, 1, 1.00245, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 1.00003, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50699exports.HelveticaItalicFactors = HelveticaItalicFactors; 50700const HelveticaItalicMetrics = { 50701 lineHeight: 1.35, 50702 lineGap: 0.2 50703}; 50704exports.HelveticaItalicMetrics = HelveticaItalicMetrics; 50705const HelveticaRegularFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.04596, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 1.00019, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.02572, 0.99973, 1.00005, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99999, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.84533, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99928, 1, 0.99977, 1.00013, 1.00055, 0.99947, 0.99945, 0.99941, 0.99924, 1.00001, 1.00001, 1.0004, 0.91621, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00005, 0.99999, 0.99977, 1.00015, 1.00022, 0.99977, 1.00001, 0.99973, 1.00026, 1.00001, 1.00019, 1.00001, 0.99946, 1, 1.0006, 1.00001, 0.99978, 1.00045, 0.99973, 0.99924, 1.00023, 0.99978, 0.99966, 1, 1.00065, 1.00045, 1.00019, 0.99973, 0.99973, 0.99924, 1, 1, 0.96499, 1, 1.00055, 0.99973, 1.00008, 1.00027, 1, 0.9997, 0.99995, 1.00023, 0.99933, 1.00019, 1.00015, 1.00031, 0.99924, 1.00023, 0.99973, 1.00023, 1.00031, 1.00001, 0.99928, 1.00029, 1.00092, 1.00035, 1.00001, 1.0006, 1.0006, 1, 0.99988, 0.99975, 1, 1.00082, 0.99561, 0.9996, 1.00035, 1.00001, 0.99962, 1.00001, 1.00092, 0.99964, 1.00001, 0.99963, 0.99999, 1.00035, 1.00035, 1.00082, 0.99962, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.9996, 0.99967, 1.00001, 1.00034, 1.00074, 1.00054, 1.00053, 1.00063, 0.99971, 0.99962, 1.00035, 0.99975, 0.99977, 0.99973, 1.00043, 0.99953, 1.0007, 0.99915, 0.99973, 1.00008, 0.99892, 1.00073, 1.00073, 1.00114, 0.99915, 1.00073, 0.99955, 0.99973, 1.00092, 0.99973, 1, 0.99998, 1, 1.0003, 1, 1.00043, 1.00001, 0.99969, 1.0003, 1, 1.00035, 1.00001, 0.9995, 1, 1.00092, 0.99973, 0.99973, 0.99973, 1.0007, 0.9995, 1, 0.99924, 1.0006, 0.99924, 0.99972, 1.00062, 0.99973, 1.00114, 1.00073, 1, 0.99955, 1, 1, 1.00047, 0.99968, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 0.99925, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50706exports.HelveticaRegularFactors = HelveticaRegularFactors; 50707const HelveticaRegularMetrics = { 50708 lineHeight: 1.2, 50709 lineGap: 0.2 50710}; 50711exports.HelveticaRegularMetrics = HelveticaRegularMetrics; 50712 50713/***/ }), 50714/* 5
507144
vendor: 29,274 bytes, lines 50714-50741
50714 */ 50715/***/ ((__unused_webpack_module, exports) => { 50716 50717 50718 50719Object.defineProperty(exports, "__esModule", ({ 50720 value: true 50721})); 50722exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0; 50723const LiberationSansBoldWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 719, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 785, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 385, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 465, 722, 333, 853, 906, 474, 825, 927, 838, 278, 722, 722, 601, 719, 667, 611, 722, 778, 278, 722, 667, 833, 722, 644, 778, 722, 667, 600, 611, 667, 821, 667, 809, 802, 278, 667, 615, 451, 611, 278, 582, 615, 610, 556, 606, 475, 460, 611, 541, 278, 558, 556, 612, 556, 445, 611, 766, 619, 520, 684, 446, 582, 715, 576, 753, 845, 278, 582, 611, 582, 845, 667, 669, 885, 567, 711, 667, 278, 276, 556, 1094, 1062, 875, 610, 722, 622, 719, 722, 719, 722, 567, 712, 667, 904, 626, 719, 719, 610, 702, 833, 722, 778, 719, 667, 722, 611, 622, 854, 667, 730, 703, 1005, 1019, 870, 979, 719, 711, 1031, 719, 556, 618, 615, 417, 635, 556, 709, 497, 615, 615, 500, 635, 740, 604, 611, 604, 611, 556, 490, 556, 875, 556, 615, 581, 833, 844, 729, 854, 615, 552, 854, 583, 556, 556, 611, 417, 552, 556, 278, 281, 278, 969, 906, 611, 500, 615, 556, 604, 778, 611, 487, 447, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1094, 556, 885, 489, 1115, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333]; 50724exports.LiberationSansBoldWidths = LiberationSansBoldWidths; 50725const LiberationSansBoldMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; 50726exports.LiberationSansBoldMapping = LiberationSansBoldMapping; 50727const LiberationSansBoldItalicWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 740, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 782, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 396, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 722, 333, 854, 906, 473, 844, 930, 847, 278, 722, 722, 610, 671, 667, 611, 722, 778, 278, 722, 667, 833, 722, 657, 778, 718, 667, 590, 611, 667, 822, 667, 829, 781, 278, 667, 620, 479, 611, 278, 591, 620, 621, 556, 610, 479, 492, 611, 558, 278, 566, 556, 603, 556, 450, 611, 712, 605, 532, 664, 409, 591, 704, 578, 773, 834, 278, 591, 611, 591, 834, 667, 667, 886, 614, 719, 667, 278, 278, 556, 1094, 1042, 854, 622, 719, 677, 719, 722, 708, 722, 614, 722, 667, 927, 643, 719, 719, 615, 687, 833, 722, 778, 719, 667, 722, 611, 677, 781, 667, 729, 708, 979, 989, 854, 1000, 708, 719, 1042, 729, 556, 619, 604, 534, 618, 556, 736, 510, 611, 611, 507, 622, 740, 604, 611, 611, 611, 556, 889, 556, 885, 556, 646, 583, 889, 935, 707, 854, 594, 552, 865, 589, 556, 556, 611, 469, 563, 556, 278, 278, 278, 969, 906, 611, 507, 619, 556, 611, 778, 611, 575, 467, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1104, 556, 885, 516, 1146, 1000, 768, 600, 834, 834, 834, 834, 999, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333]; 50728exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths; 50729const LiberationSansBoldItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; 50730exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping; 50731const LiberationSansItalicWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 625, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 733, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 281, 556, 400, 556, 222, 722, 556, 722, 556, 722, 556, 615, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 354, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 789, 846, 389, 794, 865, 775, 222, 667, 667, 570, 671, 667, 611, 722, 778, 278, 667, 667, 833, 722, 648, 778, 725, 667, 600, 611, 667, 837, 667, 831, 761, 278, 667, 570, 439, 555, 222, 550, 570, 571, 500, 556, 439, 463, 555, 542, 222, 500, 492, 548, 500, 447, 556, 670, 573, 486, 603, 374, 550, 652, 546, 728, 779, 222, 550, 556, 550, 779, 667, 667, 843, 544, 708, 667, 278, 278, 500, 1066, 982, 844, 589, 715, 639, 724, 667, 651, 667, 544, 704, 667, 917, 614, 715, 715, 589, 686, 833, 722, 778, 725, 667, 722, 611, 639, 795, 667, 727, 673, 920, 923, 805, 886, 651, 694, 1022, 682, 556, 562, 522, 493, 553, 556, 688, 465, 556, 556, 472, 564, 686, 550, 556, 556, 556, 500, 833, 500, 835, 500, 572, 518, 830, 851, 621, 736, 526, 492, 752, 534, 556, 556, 556, 378, 496, 500, 222, 222, 222, 910, 828, 556, 472, 565, 500, 556, 778, 556, 492, 339, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1083, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 998, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 584, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285]; 50732exports.LiberationSansItalicWidths = LiberationSansItalicWidths; 50733const LiberationSansItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; 50734exports.LiberationSansItalicMapping = LiberationSansItalicMapping; 50735const LiberationSansRegularWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 615, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 735, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 292, 556, 334, 556, 222, 722, 556, 722, 556, 722, 556, 604, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 375, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 784, 838, 384, 774, 855, 752, 222, 667, 667, 551, 668, 667, 611, 722, 778, 278, 667, 668, 833, 722, 650, 778, 722, 667, 618, 611, 667, 798, 667, 835, 748, 278, 667, 578, 446, 556, 222, 547, 578, 575, 500, 557, 446, 441, 556, 556, 222, 500, 500, 576, 500, 448, 556, 690, 569, 482, 617, 395, 547, 648, 525, 713, 781, 222, 547, 556, 547, 781, 667, 667, 865, 542, 719, 667, 278, 278, 500, 1057, 1010, 854, 583, 722, 635, 719, 667, 656, 667, 542, 677, 667, 923, 604, 719, 719, 583, 656, 833, 722, 778, 719, 667, 722, 611, 635, 760, 667, 740, 667, 917, 938, 792, 885, 656, 719, 1010, 722, 556, 573, 531, 365, 583, 556, 669, 458, 559, 559, 438, 583, 688, 552, 556, 542, 556, 500, 458, 500, 823, 500, 573, 521, 802, 823, 625, 719, 521, 510, 750, 542, 556, 556, 556, 365, 510, 500, 222, 278, 222, 906, 812, 556, 438, 559, 500, 552, 778, 556, 489, 411, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1073, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285]; 50736exports.LiberationSansRegularWidths = LiberationSansRegularWidths; 50737const LiberationSansRegularMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; 50738exports.LiberationSansRegularMapping = LiberationSansRegularMapping; 50739 50740/***/ }), 50741/* 5
507415
vendor: 5,531 bytes, lines 50741-50757
50741 */ 50742/***/ ((__unused_webpack_module, exports) => { 50743 50744 50745 50746Object.defineProperty(exports, "__esModule", ({ 50747 value: true 50748})); 50749exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0; 50750const MyriadProBoldFactors = [1.36898, 1, 1, 0.72706, 0.80479, 0.83734, 0.98894, 0.99793, 0.9897, 0.93884, 0.86209, 0.94292, 0.94292, 1.16661, 1.02058, 0.93582, 0.96694, 0.93582, 1.19137, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.72851, 0.78966, 0.90838, 0.83637, 0.82391, 0.96376, 0.80061, 0.86275, 0.8768, 0.95407, 1.0258, 0.73901, 0.85022, 0.83655, 1.0156, 0.95546, 0.92179, 0.87107, 0.92179, 0.82114, 0.8096, 0.89713, 0.94438, 0.95353, 0.94083, 0.91905, 0.90406, 0.9446, 0.94292, 1.18777, 0.94292, 1.02058, 0.89903, 0.90088, 0.94938, 0.97898, 0.81093, 0.97571, 0.94938, 1.024, 0.9577, 0.95933, 0.98621, 1.0474, 0.97455, 0.98981, 0.9672, 0.95933, 0.9446, 0.97898, 0.97407, 0.97646, 0.78036, 1.10208, 0.95442, 0.95298, 0.97579, 0.9332, 0.94039, 0.938, 0.80687, 1.01149, 0.80687, 1.02058, 0.80479, 0.99793, 0.99793, 0.99793, 0.99793, 1.01149, 1.00872, 0.90088, 0.91882, 1.0213, 0.8361, 1.02058, 0.62295, 0.54324, 0.89022, 1.08595, 1, 1, 0.90088, 1, 0.97455, 0.93582, 0.90088, 1, 1.05686, 0.8361, 0.99642, 0.99642, 0.99642, 0.72851, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.868, 0.82391, 0.80061, 0.80061, 0.80061, 0.80061, 1.0258, 1.0258, 1.0258, 1.0258, 0.97484, 0.95546, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 1.02058, 0.92179, 0.94438, 0.94438, 0.94438, 0.94438, 0.90406, 0.86958, 0.98225, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.9031, 0.81093, 0.94938, 0.94938, 0.94938, 0.94938, 0.98621, 0.98621, 0.98621, 0.98621, 0.93969, 0.95933, 0.9446, 0.9446, 0.9446, 0.9446, 0.9446, 1.08595, 0.9446, 0.95442, 0.95442, 0.95442, 0.95442, 0.94039, 0.97898, 0.94039, 0.90838, 0.94938, 0.90838, 0.94938, 0.90838, 0.94938, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.96376, 0.84313, 0.97484, 0.97571, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.8768, 0.9577, 0.8768, 0.9577, 0.8768, 0.9577, 1, 1, 0.95407, 0.95933, 0.97069, 0.95933, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 0.887, 1.01591, 0.73901, 1.0474, 1, 1, 0.97455, 0.83655, 0.98981, 1, 1, 0.83655, 0.73977, 0.83655, 0.73903, 0.84638, 1.033, 0.95546, 0.95933, 1, 1, 0.95546, 0.95933, 0.8271, 0.95417, 0.95933, 0.92179, 0.9446, 0.92179, 0.9446, 0.92179, 0.9446, 0.936, 0.91964, 0.82114, 0.97646, 1, 1, 0.82114, 0.97646, 0.8096, 0.78036, 0.8096, 0.78036, 1, 1, 0.8096, 0.78036, 1, 1, 0.89713, 0.77452, 0.89713, 1.10208, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94083, 0.97579, 0.90406, 0.94039, 0.90406, 0.9446, 0.938, 0.9446, 0.938, 0.9446, 0.938, 1, 0.99793, 0.90838, 0.94938, 0.868, 0.9031, 0.92179, 0.9446, 1, 1, 0.89713, 1.10208, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90989, 0.9358, 0.91945, 0.83181, 0.75261, 0.87992, 0.82976, 0.96034, 0.83689, 0.97268, 1.0078, 0.90838, 0.83637, 0.8019, 0.90157, 0.80061, 0.9446, 0.95407, 0.92436, 1.0258, 0.85022, 0.97153, 1.0156, 0.95546, 0.89192, 0.92179, 0.92361, 0.87107, 0.96318, 0.89713, 0.93704, 0.95638, 0.91905, 0.91709, 0.92796, 1.0258, 0.93704, 0.94836, 1.0373, 0.95933, 1.0078, 0.95871, 0.94836, 0.96174, 0.92601, 0.9498, 0.98607, 0.95776, 0.95933, 1.05453, 1.0078, 0.98275, 0.9314, 0.95617, 0.91701, 1.05993, 0.9446, 0.78367, 0.9553, 1, 0.86832, 1.0128, 0.95871, 0.99394, 0.87548, 0.96361, 0.86774, 1.0078, 0.95871, 0.9446, 0.95871, 0.86774, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.94083, 0.97579, 0.94083, 0.97579, 0.94083, 0.97579, 0.90406, 0.94039, 0.96694, 1, 0.89903, 1, 1, 1, 0.93582, 0.93582, 0.93582, 1, 0.908, 0.908, 0.918, 0.94219, 0.94219, 0.96544, 1, 1.285, 1, 1, 0.81079, 0.81079, 1, 1, 0.74854, 1, 1, 1, 1, 0.99793, 1, 1, 1, 0.65, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.17173, 1, 0.80535, 0.76169, 1.02058, 1.0732, 1.05486, 1, 1, 1.30692, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.16161, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50751exports.MyriadProBoldFactors = MyriadProBoldFactors; 50752const MyriadProBoldMetrics = { 50753 lineHeight: 1.2, 50754 lineGap: 0.2 50755}; 50756exports.MyriadProBoldMetrics = MyriadProBoldMetrics; 50757const MyriadProBoldItalicFactors = [1.36898, 1, 1, 0.66227, 0.80779, 0.81625, 0.97276, 0.97276, 0.97733, 0.92222, 0.83266, 0.94292, 0.94292, 1.16148, 1.02058, 0.93582, 0.96694, 0.93582, 1.17337, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.71541, 0.76813, 0.85576, 0.80591, 0.80729, 0.94299, 0.77512, 0.83655, 0.86523, 0.92222, 0.9862
vendor: 1,447 bytes, line 50757
507571, 0.71743, 0.81698, 0.79726, 0.98558, 0.92222, 0.90637, 0.83809, 0.90637, 0.80729, 0.76463, 0.86275, 0.90699, 0.91605, 0.9154, 0.85308, 0.85458, 0.90531, 0.94292, 1.21296, 0.94292, 1.02058, 0.89903, 1.18616, 0.99613, 0.91677, 0.78216, 0.91677, 0.90083, 0.98796, 0.9135, 0.92168, 0.95381, 0.98981, 0.95298, 0.95381, 0.93459, 0.92168, 0.91513, 0.92004, 0.91677, 0.95077, 0.748, 1.04502, 0.91677, 0.92061, 0.94236, 0.89544, 0.89364, 0.9, 0.80687, 0.8578, 0.80687, 1.02058, 0.80779, 0.97276, 0.97276, 0.97276, 0.97276, 0.8578, 0.99973, 1.18616, 0.91339, 1.08074, 0.82891, 1.02058, 0.55509, 0.71526, 0.89022, 1.08595, 1, 1, 1.18616, 1, 0.96736, 0.93582, 1.18616, 1, 1.04864, 0.82711, 0.99043, 0.99043, 0.99043, 0.71541, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.845, 0.80729, 0.77512, 0.77512, 0.77512, 0.77512, 0.98621, 0.98621, 0.98621, 0.98621, 0.95961, 0.92222, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 1.02058, 0.90251, 0.90699, 0.90699, 0.90699, 0.90699, 0.85458, 0.83659, 0.94951, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.85811, 0.78216, 0.90083, 0.90083, 0.90083, 0.90083, 0.95381, 0.95381, 0.95381, 0.95381, 0.9135, 0.92168, 0.91513, 0.91513, 0.91513, 0.91513, 0.91513, 1.08595, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.89364, 0.92332, 0.89364, 0.85576, 0.99613, 0.85576, 0.99613, 0.85576, 0.99613, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.94299, 0.76783, 0.95961, 0.916
vendor: 12,325 bytes, lines 50757-50780
5075777, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.86523, 0.9135, 0.86523, 0.9135, 0.86523, 0.9135, 1, 1, 0.92222, 0.92168, 0.92222, 0.92168, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.86036, 0.97096, 0.71743, 0.98981, 1, 1, 0.95298, 0.79726, 0.95381, 1, 1, 0.79726, 0.6894, 0.79726, 0.74321, 0.81691, 1.0006, 0.92222, 0.92168, 1, 1, 0.92222, 0.92168, 0.79464, 0.92098, 0.92168, 0.90637, 0.91513, 0.90637, 0.91513, 0.90637, 0.91513, 0.909, 0.87514, 0.80729, 0.95077, 1, 1, 0.80729, 0.95077, 0.76463, 0.748, 0.76463, 0.748, 1, 1, 0.76463, 0.748, 1, 1, 0.86275, 0.72651, 0.86275, 1.04502, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.9154, 0.94236, 0.85458, 0.89364, 0.85458, 0.90531, 0.9, 0.90531, 0.9, 0.90531, 0.9, 1, 0.97276, 0.85576, 0.99613, 0.845, 0.85811, 0.90251, 0.91677, 1, 1, 0.86275, 1.04502, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.00899, 1.30628, 0.85576, 0.80178, 0.66862, 0.7927, 0.69323, 0.88127, 0.72459, 0.89711, 0.95381, 0.85576, 0.80591, 0.7805, 0.94729, 0.77512, 0.90531, 0.92222, 0.90637, 0.98621, 0.81698, 0.92655, 0.98558, 0.92222, 0.85359, 0.90637, 0.90976, 0.83809, 0.94523, 0.86275, 0.83509, 0.93157, 0.85308, 0.83392, 0.92346, 0.98621, 0.83509, 0.92886, 0.91324, 0.92168, 0.95381, 0.90646, 0.92886, 0.90557, 0.86847, 0.90276, 0.91324, 0.86842, 0.92168, 0.99531, 0.95381, 0.9224, 0.85408, 0.92699, 0.86847, 1.0051, 0.91513, 0.80487, 0.93481, 1, 0.88159, 1.05214, 0.90646, 0.97355, 0.81539, 0.89398, 0.85923, 0.95381, 0.90646, 0.91513, 0.90646, 0.85923, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9154, 0.94236, 0.9154, 0.94236, 0.9154, 0.94236, 0.85458, 0.89364, 0.96694, 1, 0.89903, 1, 1, 1, 0.91782, 0.91782, 0.91782, 1, 0.896, 0.896, 0.896, 0.9332, 0.9332, 0.95973, 1, 1.26, 1, 1, 0.80479, 0.80178, 1, 1, 0.85633, 1, 1, 1, 1, 0.97276, 1, 1, 1, 0.698, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.14542, 1, 0.79199, 0.78694, 1.02058, 1.03493, 1.05486, 1, 1, 1.23026, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.20006, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50758exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors; 50759const MyriadProBoldItalicMetrics = { 50760 lineHeight: 1.2, 50761 lineGap: 0.2 50762}; 50763exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics; 50764const MyriadProItalicFactors = [1.36898, 1, 1, 0.65507, 0.84943, 0.85639, 0.88465, 0.88465, 0.86936, 0.88307, 0.86948, 0.85283, 0.85283, 1.06383, 1.02058, 0.75945, 0.9219, 0.75945, 1.17337, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.75945, 0.75945, 1.02058, 1.02058, 1.02058, 0.69046, 0.70926, 0.85158, 0.77812, 0.76852, 0.89591, 0.70466, 0.76125, 0.80094, 0.86822, 0.83864, 0.728, 0.77212, 0.79475, 0.93637, 0.87514, 0.8588, 0.76013, 0.8588, 0.72421, 0.69866, 0.77598, 0.85991, 0.80811, 0.87832, 0.78112, 0.77512, 0.8562, 1.0222, 1.18417, 1.0222, 1.27014, 0.89903, 1.15012, 0.93859, 0.94399, 0.846, 0.94399, 0.81453, 1.0186, 0.94219, 0.96017, 1.03075, 1.02175, 0.912, 1.03075, 0.96998, 0.96017, 0.93859, 0.94399, 0.94399, 0.95493, 0.746, 1.12658, 0.94578, 0.91, 0.979, 0.882, 0.882, 0.83, 0.85034, 0.83537, 0.85034, 1.02058, 0.70869, 0.88465, 0.88465, 0.88465, 0.88465, 0.83537, 0.90083, 1.15012, 0.9161, 0.94565, 0.73541, 1.02058, 0.53609, 0.69353, 0.79519, 1.08595, 1, 1, 1.15012, 1, 0.91974, 0.75945, 1.15012, 1, 0.9446, 0.73361, 0.9005, 0.9005, 0.9005, 0.62864, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.773, 0.76852, 0.70466, 0.70466, 0.70466, 0.70466, 0.83864, 0.83864, 0.83864, 0.83864, 0.90561, 0.87514, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 1.02058, 0.85751, 0.85991, 0.85991, 0.85991, 0.85991, 0.77512, 0.76013, 0.88075, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.8075, 0.846, 0.81453, 0.81453, 0.81453, 0.81453, 0.82424, 0.82424, 0.82424, 0.82424, 0.9278, 0.96017, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 1.08595, 0.8562, 0.94578, 0.94578, 0.94578, 0.94578, 0.882, 0.94578, 0.882, 0.85158, 0.93859, 0.85158, 0.93859, 0.85158, 0.93859, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.89591, 0.8544, 0.90561, 0.94399, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.80094, 0.94219, 0.80094, 0.94219, 0.80094, 0.94219, 1, 1, 0.86822, 0.96017, 0.86822, 0.96017, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 1.03075, 0.83864, 0.82424, 0.81402, 1.02738, 0.728, 1.02175, 1, 1, 0.912, 0.79475, 1.03075, 1, 1, 0.79475, 0.83911, 0.79475, 0.66266, 0.80553, 1.06676, 0.87514, 0.96017, 1, 1, 0.87514, 0.96017, 0.86865, 0.87396, 0.96017, 0.8588, 0.93859, 0.8588, 0.93859, 0.8588, 0.93859, 0.867, 0.84759, 0.72421, 0.95493, 1, 1, 0.72421, 0.95493, 0.69866, 0.746, 0.69866, 0.746, 1, 1, 0.69866, 0.746, 1, 1, 0.77598, 0.88417, 0.77598, 1.12658, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.87832, 0.979, 0.77512, 0.882, 0.77512, 0.8562, 0.83, 0.8562, 0.83, 0.8562, 0.83, 1, 0.88465, 0.85158, 0.93859, 0.773, 0.8075, 0.85751, 0.8562, 1, 1, 0.77598, 1.12658, 1.15012, 1.15012, 1.15012, 1.15012, 1.15012, 1.15313, 1.15012, 1.15012, 1.15012, 1.08106, 1.03901, 0.85158, 0.77025, 0.62264, 0.7646, 0.65351, 0.86026, 0.69461, 0.89947, 1.03075, 0.85158, 0.77812, 0.76449, 0.88836, 0.70466, 0.8562, 0.86822, 0.8588, 0.83864, 0.77212, 0.85308, 0.93637, 0.87514, 0.82352, 0.8588, 0.85701, 0.76013, 0.89058, 0.77598, 0.8156, 0.82565, 0.78112, 0.77899, 0.89386, 0.83864, 0.8156, 0.9486, 0.92388, 0.96186, 1.03075, 0.91123, 0.9486, 0.93298, 0.878, 0.93942, 0.92388, 0.84596, 0.96186, 0.95119, 1.03075, 0.922, 0.88787, 0.95829, 0.88, 0.93559, 0.93859, 0.78815, 0.93758, 1, 0.89217, 1.03737, 0.91123, 0.93969, 0.77487, 0.85769, 0.86799, 1.03075, 0.91123, 0.93859, 0.91123, 0.86799, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87832, 0.979, 0.87832, 0.979, 0.87832, 0.979, 0.77512, 0.882, 0.9219, 1, 0.89903, 1, 1, 1, 0.87321, 0.87321, 0.87321, 1, 1.027, 1.027, 1.027, 0.86847, 0.86847, 0.79121, 1, 1.124, 1, 1, 0.73572, 0.73572, 1, 1, 0.85034, 1, 1, 1, 1, 0.88465, 1, 1, 1, 0.669, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04828, 1, 0.74948, 0.75187, 1.02058, 0.98391, 1.02119, 1, 1, 1.06233, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05233, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50765exports.MyriadProItalicFactors = MyriadProItalicFactors; 50766const MyriadProItalicMetrics = { 50767 lineHeight: 1.2, 50768 lineGap: 0.2 50769}; 50770exports.MyriadProItalicMetrics = MyriadProItalicMetrics; 50771const MyriadProRegularFactors = [1.36898, 1, 1, 0.76305, 0.82784, 0.94935, 0.89364, 0.92241, 0.89073, 0.90706, 0.98472, 0.85283, 0.85283, 1.0664, 1.02058, 0.74505, 0.9219, 0.74505, 1.23456, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.74505, 0.74505, 1.02058, 1.02058, 1.02058, 0.73002, 0.72601, 0.91755, 0.8126, 0.80314, 0.92222, 0.73764, 0.79726, 0.83051, 0.90284, 0.86023, 0.74, 0.8126, 0.84869, 0.96518, 0.91115, 0.8858, 0.79761, 0.8858, 0.74498, 0.73914, 0.81363, 0.89591, 0.83659, 0.89633, 0.85608, 0.8111, 0.90531, 1.0222, 1.22736, 1.0222, 1.27014, 0.89903, 0.90088, 0.86667, 1.0231, 0.896, 1.01411, 0.90083, 1.05099, 1.00512, 0.99793, 1.05326, 1.09377, 0.938, 1.06226, 1.00119, 0.99793, 0.98714, 1.0231, 1.01231, 0.98196, 0.792, 1.19137, 0.99074, 0.962, 1.01915, 0.926, 0.942, 0.856, 0.85034, 0.92006, 0.85034, 1.02058, 0.69067, 0.92241, 0.92241, 0.92241, 0.92241, 0.92006, 0.9332, 0.90088, 0.91882, 0.93484, 0.75339, 1.02058, 0.56866, 0.54324, 0.79519, 1.08595, 1, 1, 0.90088, 1, 0.95325, 0.74505, 0.90088, 1, 0.97198, 0.75339, 0.91009, 0.91009, 0.91009, 0.66466, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.788, 0.80314, 0.73764, 0.73764, 0.73764, 0.73764, 0.86023, 0.86023, 0.86023, 0.86023, 0.92915, 0.91115, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 1.02058, 0.8858, 0.89591, 0.89591, 0.89591, 0.89591, 0.8111, 0.79611, 0.89713, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86936, 0.896, 0.90083, 0.90083, 0.90083, 0.90083, 0.84224, 0.84224, 0.84224, 0.84224, 0.97276, 0.99793, 0.98714, 0.98714, 0.98714, 0.98714, 0.98714, 1.08595, 0.89876, 0.99074, 0.99074, 0.99074, 0.99074, 0.942, 1.0231, 0.942, 0.91755, 0.86667, 0.91755, 0.86667, 0.91755, 0.86667, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.92222, 0.93372, 0.92915, 1.01411, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.83051, 1.00512, 0.83051, 1.00512, 0.83051, 1.00512, 1, 1, 0.90284, 0.99793, 0.90976, 0.99793, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 1.05326, 0.86023, 0.84224, 0.82873, 1.07469, 0.74, 1.09377, 1, 1, 0.938, 0.84869, 1.06226, 1, 1, 0.84869, 0.83704, 0.84869, 0.81441, 0.85588, 1.08927, 0.91115, 0.99793, 1, 1, 0.91115, 0.99793, 0.91887, 0.90991, 0.99793, 0.8858, 0.98714, 0.8858, 0.98714, 0.8858, 0.98714, 0.894, 0.91434, 0.74498, 0.98196, 1, 1, 0.74498, 0.98196, 0.73914, 0.792, 0.73914, 0.792, 1, 1, 0.73914, 0.792, 1, 1, 0.81363, 0.904, 0.81363, 1.19137, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89633, 1.01915, 0.8111, 0.942, 0.8111, 0.90531, 0.856, 0.90531, 0.856, 0.90531, 0.856, 1, 0.92241, 0.91755, 0.86667, 0.788, 0.86936, 0.8858, 0.89876, 1, 1, 0.81363, 1.19137, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90388, 1.03901, 0.92138, 0.78105, 0.7154, 0.86169, 0.80513, 0.94007, 0.82528, 0.98612, 1.06226, 0.91755, 0.8126, 0.81884, 0.92819, 0.73764, 0.90531, 0.90284, 0.8858, 0.86023, 0.8126, 0.91172, 0.96518, 0.91115, 0.83089, 0.8858, 0.87791, 0.79761, 0.89297, 0.81363, 0.88157, 0.89992, 0.85608, 0.81992, 0.94307, 0.86023, 0.88157, 0.95308, 0.98699, 0.99793, 1.06226, 0.95817, 0.95308, 0.97358, 0.928, 0.98088, 0.98699, 0.92761, 0.99793, 0.96017, 1.06226, 0.986, 0.944, 0.95978, 0.938, 0.96705, 0.98714, 0.80442, 0.98972, 1, 0.89762, 1.04552, 0.95817, 0.99007, 0.87064, 0.91879, 0.88888, 1.06226, 0.95817, 0.98714, 0.95817, 0.88888, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89633, 1.01915, 0.89633, 1.01915, 0.89633, 1.01915, 0.8111, 0.942, 0.9219, 1, 0.89903, 1, 1, 1, 0.93173, 0.93173, 0.93173, 1, 1.06304, 1.06304, 1.06904, 0.89903, 0.89903, 0.80549, 1, 1.156, 1, 1, 0.76575, 0.76575, 1, 1, 0.72458, 1, 1, 1, 1, 0.92241, 1, 1, 1, 0.619, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.07257, 1, 0.74705, 0.71119, 1.02058, 1.024, 1.02119, 1, 1, 1.1536, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05638, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50772exports.MyriadProRegularFactors = MyriadProRegularFactors; 50773const MyriadProRegularMetrics = { 50774 lineHeight: 1.2, 50775 lineGap: 0.2 50776}; 50777exports.MyriadProRegularMetrics = MyriadProRegularMetrics; 50778 50779/***/ }), 50780/* 5
507806
vendor: 20,492 bytes, lines 50780-50819
50780 */ 50781/***/ ((__unused_webpack_module, exports) => { 50782 50783 50784 50785Object.defineProperty(exports, "__esModule", ({ 50786 value: true 50787})); 50788exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0; 50789const SegoeuiBoldFactors = [1.76738, 1, 1, 0.99297, 0.9824, 1.04016, 1.06497, 1.03424, 0.97529, 1.17647, 1.23203, 1.1085, 1.1085, 1.16939, 1.2107, 0.9754, 1.21408, 0.9754, 1.59578, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 0.81378, 0.81378, 1.2107, 1.2107, 1.2107, 0.71703, 0.97847, 0.97363, 0.88776, 0.8641, 1.02096, 0.79795, 0.85132, 0.914, 1.06085, 1.1406, 0.8007, 0.89858, 0.83693, 1.14889, 1.09398, 0.97489, 0.92094, 0.97489, 0.90399, 0.84041, 0.95923, 1.00135, 1, 1.06467, 0.98243, 0.90996, 0.99361, 1.1085, 1.56942, 1.1085, 1.2107, 0.74627, 0.94282, 0.96752, 1.01519, 0.86304, 1.01359, 0.97278, 1.15103, 1.01359, 0.98561, 1.02285, 1.02285, 1.00527, 1.02285, 1.0302, 0.99041, 1.0008, 1.01519, 1.01359, 1.02258, 0.79104, 1.16862, 0.99041, 0.97454, 1.02511, 0.99298, 0.96752, 0.95801, 0.94856, 1.16579, 0.94856, 1.2107, 0.9824, 1.03424, 1.03424, 1, 1.03424, 1.16579, 0.8727, 1.3871, 1.18622, 1.10818, 1.04478, 1.2107, 1.18622, 0.75155, 0.94994, 1.28826, 1.21408, 1.21408, 0.91056, 1, 0.91572, 0.9754, 0.64663, 1.18328, 1.24866, 1.04478, 1.14169, 1.15749, 1.17389, 0.71703, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.93506, 0.8641, 0.79795, 0.79795, 0.79795, 0.79795, 1.1406, 1.1406, 1.1406, 1.1406, 1.02096, 1.09398, 0.97426, 0.97426, 0.97426, 0.97426, 0.97426, 1.2107, 0.97489, 1.00135, 1.00135, 1.00135, 1.00135, 0.90996, 0.92094, 1.02798, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.93136, 0.86304, 0.97278, 0.97278, 0.97278, 0.97278, 1.02285, 1.02285, 1.02285, 1.02285, 0.97122, 0.99041, 1, 1, 1, 1, 1, 1.28826, 1.0008, 0.99041, 0.99041, 0.99041, 0.99041, 0.96752, 1.01519, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 1.02096, 1.03057, 1.02096, 1.03517, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.914, 1.01359, 0.914, 1.01359, 0.914, 1.01359, 1, 1, 1.06085, 0.98561, 1.06085, 1.00879, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 0.97138, 1.08692, 0.8007, 1.02285, 1, 1, 1.00527, 0.83693, 1.02285, 1, 1, 0.83693, 0.9455, 0.83693, 0.90418, 0.83693, 1.13005, 1.09398, 0.99041, 1, 1, 1.09398, 0.99041, 0.96692, 1.09251, 0.99041, 0.97489, 1.0008, 0.97489, 1.0008, 0.97489, 1.0008, 0.93994, 0.97931, 0.90399, 1.02258, 1, 1, 0.90399, 1.02258, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 1, 1, 0.95923, 1.07034, 0.95923, 1.16862, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.06467, 1.02511, 0.90996, 0.96752, 0.90996, 0.99361, 0.95801, 0.99361, 0.95801, 0.99361, 0.95801, 1.07733, 1.03424, 0.97363, 0.96752, 0.93506, 0.93136, 0.97489, 1.0008, 1, 1, 0.95923, 1.16862, 1.15103, 1.15103, 1.01173, 1.03959, 0.75953, 0.81378, 0.79912, 1.15103, 1.21994, 0.95161, 0.87815, 1.01149, 0.81525, 0.7676, 0.98167, 1.01134, 1.02546, 0.84097, 1.03089, 1.18102, 0.97363, 0.88776, 0.85134, 0.97826, 0.79795, 0.99361, 1.06085, 0.97489, 1.1406, 0.89858, 1.0388, 1.14889, 1.09398, 0.86039, 0.97489, 1.0595, 0.92094, 0.94793, 0.95923, 0.90996, 0.99346, 0.98243, 1.02112, 0.95493, 1.1406, 0.90996, 1.03574, 1.02597, 1.0008, 1.18102, 1.06628, 1.03574, 1.0192, 1.01932, 1.00886, 0.97531, 1.0106, 1.0008, 1.13189, 1.18102, 1.02277, 0.98683, 1.0016, 0.99561, 1.07237, 1.0008, 0.90434, 0.99921, 0.93803, 0.8965, 1.23085, 1.06628, 1.04983, 0.96268, 1.0499, 0.98439, 1.18102, 1.06628, 1.0008, 1.06628, 0.98439, 0.79795, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09466, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.97278, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.02065, 1, 1, 1, 1, 1, 1, 1.06467, 1.02511, 1.06467, 1.02511, 1.06467, 1.02511, 0.90996, 0.96752, 1, 1.21408, 0.89903, 1, 1, 0.75155, 1.04394, 1.04394, 1.04394, 1.04394, 0.98633, 0.98633, 0.98633, 0.73047, 0.73047, 1.20642, 0.91211, 1.25635, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.12454, 0.93503, 1.03424, 1.19687, 1.03424, 1, 1, 1, 0.771, 1, 1, 1.15749, 1.15749, 1.15749, 1.10948, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.16897, 1, 0.96085, 0.90137, 1.2107, 1.18416, 1.13973, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21172, 1.29004, 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18874, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.09193, 1.09193, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50790exports.SegoeuiBoldFactors = SegoeuiBoldFactors; 50791const SegoeuiBoldMetrics = { 50792 lineHeight: 1.33008, 50793 lineGap: 0 50794}; 50795exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics; 50796const SegoeuiBoldItalicFactors = [1.76738, 1, 1, 0.98946, 1.03959, 1.04016, 1.02809, 1.036, 0.97639, 1.10953, 1.23203, 1.11144, 1.11144, 1.16939, 1.21237, 0.9754, 1.21261, 0.9754, 1.59754, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 0.81378, 0.81378, 1.21237, 1.21237, 1.21237, 0.73541, 0.97847, 0.97363, 0.89723, 0.87897, 1.0426, 0.79429, 0.85292, 0.91149, 1.05815, 1.1406, 0.79631, 0.90128, 0.83853, 1.04396, 1.10615, 0.97552, 0.94436, 0.97552, 0.88641, 0.80527, 0.96083, 1.00135, 1, 1.06777, 0.9817, 0.91142, 0.99361, 1.11144, 1.57293, 1.11144, 1.21237, 0.74627, 1.31818, 1.06585, 0.97042, 0.83055, 0.97042, 0.93503, 1.1261, 0.97042, 0.97922, 1.14236, 0.94552, 1.01054, 1.14236, 1.02471, 0.97922, 0.94165, 0.97042, 0.97042, 1.0276, 0.78929, 1.1261, 0.97922, 0.95874, 1.02197, 0.98507, 0.96752, 0.97168, 0.95107, 1.16579, 0.95107, 1.21237, 1.03959, 1.036, 1.036, 1, 1.036, 1.16579, 0.87357, 1.31818, 1.18754, 1.26781, 1.05356, 1.21237, 1.18622, 0.79487, 0.94994, 1.29004, 1.24047, 1.24047, 1.31818, 1, 0.91484, 0.9754, 1.31818, 1.1349, 1.24866, 1.05356, 1.13934, 1.15574, 1.17389, 0.73541, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.94385, 0.87897, 0.79429, 0.79429, 0.79429, 0.79429, 1.1406, 1.1406, 1.1406, 1.1406, 1.0426, 1.10615, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 1.21237, 0.97552, 1.00135, 1.00135, 1.00135, 1.00135, 0.91142, 0.94436, 0.98721, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 0.96705, 0.83055, 0.93503, 0.93503, 0.93503, 0.93503, 1.14236, 1.14236, 1.14236, 1.14236, 0.93125, 0.97922, 0.94165, 0.94165, 0.94165, 0.94165, 0.94165, 1.29004, 0.94165, 0.97922, 0.97922, 0.97922, 0.97922, 0.96752, 0.97042, 0.96752, 0.97363, 1.06585, 0.97363, 1.06585, 0.97363, 1.06585, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 1.0426, 1.0033, 1.0426, 0.97042, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.91149, 0.97042, 0.91149, 0.97042, 0.91149, 0.97042, 1, 1, 1.05815, 0.97922, 1.05815, 0.97922, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 0.97441, 1.04302, 0.79631, 1.01582, 1, 1, 1.01054, 0.83853, 1.14236, 1, 1, 0.83853, 1.09125, 0.83853, 0.90418, 0.83853, 1.19508, 1.10615, 0.97922, 1, 1, 1.10615, 0.97922, 1.01034, 1.10466, 0.97922, 0.97552, 0.94165, 0.97552, 0.94165, 0.97552, 0.94165, 0.91602, 0.91981, 0.88641, 1.0276, 1, 1, 0.88641, 1.0276, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 1, 1, 0.96083, 1.05403, 0.95923, 1.16862, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.06777, 1.02197, 0.91142, 0.96752, 0.91142, 0.99361, 0.97168, 0.99361, 0.97168, 0.99361, 0.97168, 1.23199, 1.036, 0.97363, 1.06585, 0.94385, 0.96705, 0.97552, 0.94165, 1, 1, 0.96083, 1.1261, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 0.95161, 1.27126, 1.00811, 0.83284, 0.77702, 0.99137, 0.95253, 1.0347, 0.86142, 1.07205, 1.14236, 0.97363, 0.89723, 0.86869, 1.09818, 0.79429, 0.99361, 1.05815, 0.97552, 1.1406, 0.90128, 1.06662, 1.04396, 1.10615, 0.84918, 0.97552, 1.04694, 0.94436, 0.98015, 0.96083, 0.91142, 1.00356, 0.9817, 1.01945, 0.98999, 1.1406, 0.91142, 1.04961, 0.9898, 1.00639, 1.14236, 1.07514, 1.04961, 0.99607, 1.02897, 1.008, 0.9898, 0.95134, 1.00639, 1.11121, 1.14236, 1.00518, 0.97981, 1.02186, 1, 1.08578, 0.94165, 0.99314, 0.98387, 0.93028, 0.93377, 1.35125, 1.07514, 1.10687, 0.93491, 1.04232, 1.00351, 1.14236, 1.07514, 0.94165, 1.07514, 1.00351, 0.79429, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09097, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.93503, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96609, 1, 1, 1, 1, 1, 1, 1.06777, 1.02197, 1.06777, 1.02197, 1.06777, 1.02197, 0.91142, 0.96752, 1, 1.21261, 0.89903, 1, 1, 0.75155, 1.04745, 1.04745, 1.04745, 1.04394, 0.98633, 0.98633, 0.98633, 0.72959, 0.72959, 1.20502, 0.91406, 1.26514, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.09125, 0.93327, 1.03336, 1.16541, 1.036, 1, 1, 1, 0.771, 1, 1, 1.15574, 1.15574, 1.15574, 1.15574, 0.86364, 0.94434, 0.86279, 0.94434, 0.86224, 1, 1, 1.16798, 1, 0.96085, 0.90068, 1.21237, 1.18416, 1.13904, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21339, 1.29004, 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18775, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.13269, 1.13269, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50797exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors; 50798const SegoeuiBoldItalicMetrics = { 50799 lineHeight: 1.33008, 50800 lineGap: 0 50801}; 50802exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics; 50803const SegoeuiItalicFactors = [1.76738, 1, 1, 0.98946, 1.14763, 1.05365, 1.06234, 0.96927, 0.92586, 1.15373, 1.18414, 0.91349, 0.91349, 1.07403, 1.17308, 0.78383, 1.20088, 0.78383, 1.42531, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78383, 0.78383, 1.17308, 1.17308, 1.17308, 0.77349, 0.94565, 0.94729, 0.85944, 0.88506, 0.9858, 0.74817, 0.80016, 0.88449, 0.98039, 0.95782, 0.69238, 0.89898, 0.83231, 0.98183, 1.03989, 0.96924, 0.86237, 0.96924, 0.80595, 0.74524, 0.86091, 0.95402, 0.94143, 0.98448, 0.8858, 0.83089, 0.93285, 1.0949, 1.39016, 1.0949, 1.45994, 0.74627, 1.04839, 0.97454, 0.97454, 0.87207, 0.97454, 0.87533, 1.06151, 0.97454, 1.00176, 1.16484, 1.08132, 0.98047, 1.16484, 1.02989, 1.01054, 0.96225, 0.97454, 0.97454, 1.06598, 0.79004, 1.16344, 1.00351, 0.94629, 0.9973, 0.91016, 0.96777, 0.9043, 0.91082, 0.92481, 0.91082, 1.17308, 0.95748, 0.96927, 0.96927, 1, 0.96927, 0.92481, 0.80597, 1.04839, 1.23393, 1.1781, 0.9245, 1.17308, 1.20808, 0.63218, 0.94261, 1.24822, 1.09971, 1.09971, 1.04839, 1, 0.85273, 0.78032, 1.04839, 1.09971, 1.22326, 0.9245, 1.09836, 1.13525, 1.15222, 0.70424, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.85498, 0.88506, 0.74817, 0.74817, 0.74817, 0.74817, 0.95782, 0.95782, 0.95782, 0.95782, 0.9858, 1.03989, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.17308, 0.96924, 0.95402, 0.95402, 0.95402, 0.95402, 0.83089, 0.86237, 0.88409, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.92916, 0.87207, 0.87533, 0.87533, 0.87533, 0.87533, 0.93146, 0.93146, 0.93146, 0.93146, 0.93854, 1.01054, 0.96225, 0.96225, 0.96225, 0.96225, 0.96225, 1.24822, 0.8761, 1.00351, 1.00351, 1.00351, 1.00351, 0.96777, 0.97454, 0.96777, 0.94729, 0.97454, 0.94729, 0.97454, 0.94729, 0.97454, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.9858, 0.95391, 0.9858, 0.97454, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.88449, 0.97454, 0.88449, 0.97454, 0.88449, 0.97454, 1, 1, 0.98039, 1.00176, 0.98039, 1.00176, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 1.16484, 0.95782, 0.93146, 0.84421, 1.12761, 0.69238, 1.08132, 1, 1, 0.98047, 0.83231, 1.16484, 1, 1, 0.84723, 1.04861, 0.84723, 0.78755, 0.83231, 1.23736, 1.03989, 1.01054, 1, 1, 1.03989, 1.01054, 0.9857, 1.03849, 1.01054, 0.96924, 0.96225, 0.96924, 0.96225, 0.96924, 0.96225, 0.92383, 0.90171, 0.80595, 1.06598, 1, 1, 0.80595, 1.06598, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 1, 1, 0.86091, 1.02759, 0.85771, 1.16344, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.98448, 0.9973, 0.83089, 0.96777, 0.83089, 0.93285, 0.9043, 0.93285, 0.9043, 0.93285, 0.9043, 1.31868, 0.96927, 0.94729, 0.97454, 0.85498, 0.92916, 0.96924, 0.8761, 1, 1, 0.86091, 1.16344, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 0.81965, 0.81965, 0.94729, 0.78032, 0.71022, 0.90883, 0.84171, 0.99877, 0.77596, 1.05734, 1.2, 0.94729, 0.85944, 0.82791, 0.9607, 0.74817, 0.93285, 0.98039, 0.96924, 0.95782, 0.89898, 0.98316, 0.98183, 1.03989, 0.78614, 0.96924, 0.97642, 0.86237, 0.86075, 0.86091, 0.83089, 0.90082, 0.8858, 0.97296, 1.01284, 0.95782, 0.83089, 1.0976, 1.04, 1.03342, 1.2, 1.0675, 1.0976, 0.98205, 1.03809, 1.05097, 1.04, 0.95364, 1.03342, 1.05401, 1.2, 1.02148, 1.0119, 1.04724, 1.0127, 1.02732, 0.96225, 0.8965, 0.97783, 0.93574, 0.94818, 1.30679, 1.0675, 1.11826, 0.99821, 1.0557, 1.0326, 1.2, 1.0675, 0.96225, 1.0675, 1.0326, 0.74817, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03754, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87533, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.98705, 1, 1, 1, 1, 1, 1, 0.98448, 0.9973, 0.98448, 0.9973, 0.98448, 0.9973, 0.83089, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 0.94945, 0.94945, 0.94945, 0.94945, 1.12317, 1.12317, 1.12317, 0.67603, 0.67603, 1.15621, 0.73584, 1.21191, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87709, 0.96927, 1.01473, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.09836, 1.09836, 1.09836, 1.01522, 0.86321, 0.94434, 0.8649, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86438, 1.17308, 1.18416, 1.14589, 0.69825, 0.97622, 1.96791, 1.24822, 1.24822, 1.17308, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.17984, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10742, 1.10742, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50804exports.SegoeuiItalicFactors = SegoeuiItalicFactors; 50805const SegoeuiItalicMetrics = { 50806 lineHeight: 1.33008, 50807 lineGap: 0 50808}; 50809exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics; 50810const SegoeuiRegularFactors = [1.76738, 1, 1, 0.98594, 1.02285, 1.10454, 1.06234, 0.96927, 0.92037, 1.19985, 1.2046, 0.90616, 0.90616, 1.07152, 1.1714, 0.78032, 1.20088, 0.78032, 1.40246, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78032, 0.78032, 1.1714, 1.1714, 1.1714, 0.80597, 0.94084, 0.96706, 0.85944, 0.85734, 0.97093, 0.75842, 0.79936, 0.88198, 0.9831, 0.95782, 0.71387, 0.86969, 0.84636, 1.07796, 1.03584, 0.96924, 0.83968, 0.96924, 0.82826, 0.79649, 0.85771, 0.95132, 0.93119, 0.98965, 0.88433, 0.8287, 0.93365, 1.08612, 1.3638, 1.08612, 1.45786, 0.74627, 0.80499, 0.91484, 1.05707, 0.92383, 1.05882, 0.9403, 1.12654, 1.05882, 1.01756, 1.09011, 1.09011, 0.99414, 1.09011, 1.034, 1.01756, 1.05356, 1.05707, 1.05882, 1.04399, 0.84863, 1.21968, 1.01756, 0.95801, 1.00068, 0.91797, 0.96777, 0.9043, 0.90351, 0.92105, 0.90351, 1.1714, 0.85337, 0.96927, 0.96927, 0.99912, 0.96927, 0.92105, 0.80597, 1.2434, 1.20808, 1.05937, 0.90957, 1.1714, 1.20808, 0.75155, 0.94261, 1.24644, 1.09971, 1.09971, 0.84751, 1, 0.85273, 0.78032, 0.61584, 1.05425, 1.17914, 0.90957, 1.08665, 1.11593, 1.14169, 0.73381, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.86035, 0.85734, 0.75842, 0.75842, 0.75842, 0.75842, 0.95782, 0.95782, 0.95782, 0.95782, 0.97093, 1.03584, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.1714, 0.96924, 0.95132, 0.95132, 0.95132, 0.95132, 0.8287, 0.83968, 0.89049, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.93575, 0.92383, 0.9403, 0.9403, 0.9403, 0.9403, 0.8717, 0.8717, 0.8717, 0.8717, 1.00527, 1.01756, 1.05356, 1.05356, 1.05356, 1.05356, 1.05356, 1.24644, 0.95923, 1.01756, 1.01756, 1.01756, 1.01756, 0.96777, 1.05707, 0.96777, 0.96706, 0.91484, 0.96706, 0.91484, 0.96706, 0.91484, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.97093, 1.0969, 0.97093, 1.05882, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.88198, 1.05882, 0.88198, 1.05882, 0.88198, 1.05882, 1, 1, 0.9831, 1.01756, 0.9831, 1.01756, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 1.09011, 0.95782, 0.8717, 0.84784, 1.11551, 0.71387, 1.09011, 1, 1, 0.99414, 0.84636, 1.09011, 1, 1, 0.84636, 1.0536, 0.84636, 0.94298, 0.84636, 1.23297, 1.03584, 1.01756, 1, 1, 1.03584, 1.01756, 1.00323, 1.03444, 1.01756, 0.96924, 1.05356, 0.96924, 1.05356, 0.96924, 1.05356, 0.93066, 0.98293, 0.82826, 1.04399, 1, 1, 0.82826, 1.04399, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 1, 1, 0.85771, 1.17318, 0.85771, 1.21968, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.98965, 1.00068, 0.8287, 0.96777, 0.8287, 0.93365, 0.9043, 0.93365, 0.9043, 0.93365, 0.9043, 1.08571, 0.96927, 0.96706, 0.91484, 0.86035, 0.93575, 0.96924, 0.95923, 1, 1, 0.85771, 1.21968, 1.11437, 1.11437, 0.93109, 0.91202, 0.60411, 0.84164, 0.55572, 1.01173, 0.97361, 0.81818, 0.81818, 0.96635, 0.78032, 0.72727, 0.92366, 0.98601, 1.03405, 0.77968, 1.09799, 1.2, 0.96706, 0.85944, 0.85638, 0.96491, 0.75842, 0.93365, 0.9831, 0.96924, 0.95782, 0.86969, 0.94152, 1.07796, 1.03584, 0.78437, 0.96924, 0.98715, 0.83968, 0.83491, 0.85771, 0.8287, 0.94492, 0.88433, 0.9287, 1.0098, 0.95782, 0.8287, 1.0625, 0.98248, 1.03424, 1.2, 1.01071, 1.0625, 0.95246, 1.03809, 1.04912, 0.98248, 1.00221, 1.03424, 1.05443, 1.2, 1.04785, 0.99609, 1.00169, 1.05176, 0.99346, 1.05356, 0.9087, 1.03004, 0.95542, 0.93117, 1.23362, 1.01071, 1.07831, 1.02512, 1.05205, 1.03502, 1.2, 1.01071, 1.05356, 1.01071, 1.03502, 0.75842, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03719, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9403, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04021, 1, 1, 1, 1, 1, 1, 0.98965, 1.00068, 0.98965, 1.00068, 0.98965, 1.00068, 0.8287, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 1.03077, 1.03077, 1.03077, 1.03077, 1.13196, 1.13196, 1.13196, 0.67428, 0.67428, 1.16039, 0.73291, 1.20996, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87796, 0.96927, 1.01518, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.10539, 1.10539, 1.11358, 1.06967, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86507, 1.1714, 1.18416, 1.14589, 0.69825, 0.97622, 1.9697, 1.24822, 1.24822, 1.17238, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18083, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10938, 1.10938, 1, 1, 1, 1.05425, 1.09971, 1.09971, 1.09971, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 50811exports.SegoeuiRegularFactors = SegoeuiRegularFactors; 50812const SegoeuiRegularMetrics = { 50813 lineHeight: 1.33008, 50814 lineGap: 0 50815}; 50816exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics; 50817 50818/***/ }), 50819/* 5
vendor: 21,921 bytes, lines 50819-51841
508197 */ 50820/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 50821 50822 50823 50824Object.defineProperty(exports, "__esModule", ({ 50825 value: true 50826})); 50827exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0; 50828exports.isPDFFunction = isPDFFunction; 50829 50830var _primitives = __w_pdfjs_require__(5); 50831 50832var _util = __w_pdfjs_require__(2); 50833 50834var _ps_parser = __w_pdfjs_require__(58); 50835 50836var _base_stream = __w_pdfjs_require__(7); 50837 50838var _image_utils = __w_pdfjs_require__(59); 50839 50840class PDFFunctionFactory { 50841 constructor({ 50842 xref, 50843 isEvalSupported = true 50844 }) { 50845 this.xref = xref; 50846 this.isEvalSupported = isEvalSupported !== false; 50847 } 50848 50849 create(fn) { 50850 const cachedFunction = this.getCached(fn); 50851 50852 if (cachedFunction) { 50853 return cachedFunction; 50854 } 50855 50856 const parsedFunction = PDFFunction.parse({ 50857 xref: this.xref, 50858 isEvalSupported: this.isEvalSupported, 50859 fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn 50860 }); 50861 50862 this._cache(fn, parsedFunction); 50863 50864 return parsedFunction; 50865 } 50866 50867 createFromArray(fnObj) { 50868 const cachedFunction = this.getCached(fnObj); 50869 50870 if (cachedFunction) { 50871 return cachedFunction; 50872 } 50873 50874 const parsedFunction = PDFFunction.parseArray({ 50875 xref: this.xref, 50876 isEvalSupported: this.isEvalSupported, 50877 fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj 50878 }); 50879 50880 this._cache(fnObj, parsedFunction); 50881 50882 return parsedFunction; 50883 } 50884 50885 getCached(cacheKey) { 50886 let fnRef; 50887 50888 if (cacheKey instanceof _primitives.Ref) { 50889 fnRef = cacheKey; 50890 } else if (cacheKey instanceof _primitives.Dict) { 50891 fnRef = cacheKey.objId; 50892 } else if (cacheKey instanceof _base_stream.BaseStream) { 50893 fnRef = cacheKey.dict && cacheKey.dict.objId; 50894 } 50895 50896 if (fnRef) { 50897 const localFunction = this._localFunctionCache.getByRef(fnRef); 50898 50899 if (localFunction) { 50900 return localFunction; 50901 } 50902 } 50903 50904 return null; 50905 } 50906 50907 _cache(cacheKey, parsedFunction) { 50908 if (!parsedFunction) { 50909 throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.'); 50910 } 50911 50912 let fnRef; 50913 50914 if (cacheKey instanceof _primitives.Ref) { 50915 fnRef = cacheKey; 50916 } else if (cacheKey instanceof _primitives.Dict) { 50917 fnRef = cacheKey.objId; 50918 } else if (cacheKey instanceof _base_stream.BaseStream) { 50919 fnRef = cacheKey.dict && cacheKey.dict.objId; 50920 } 50921 50922 if (fnRef) { 50923 this._localFunctionCache.set(null, fnRef, parsedFunction); 50924 } 50925 } 50926 50927 get _localFunctionCache() { 50928 return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache()); 50929 } 50930 50931} 50932 50933exports.PDFFunctionFactory = PDFFunctionFactory; 50934 50935function toNumberArray(arr) { 50936 if (!Array.isArray(arr)) { 50937 return null; 50938 } 50939 50940 const length = arr.length; 50941 50942 for (let i = 0; i < length; i++) { 50943 if (typeof arr[i] !== "number") { 50944 const result = new Array(length); 50945 50946 for (let j = 0; j < length; j++) { 50947 result[j] = +arr[j]; 50948 } 50949 50950 return result; 50951 } 50952 } 50953 50954 return arr; 50955} 50956 50957class PDFFunction { 50958 static getSampleArray(size, outputSize, bps, stream) { 50959 let i, ii; 50960 let length = 1; 50961 50962 for (i = 0, ii = size.length; i < ii; i++) { 50963 length *= size[i]; 50964 } 50965 50966 length *= outputSize; 50967 const array = new Array(length); 50968 let codeSize = 0; 50969 let codeBuf = 0; 50970 const sampleMul = 1.0 / (2.0 ** bps - 1); 50971 const strBytes = stream.getBytes((length * bps + 7) / 8); 50972 let strIdx = 0; 50973 50974 for (i = 0; i < length; i++) { 50975 while (codeSize < bps) { 50976 codeBuf <<= 8; 50977 codeBuf |= strBytes[strIdx++]; 50978 codeSize += 8; 50979 } 50980 50981 codeSize -= bps; 50982 array[i] = (codeBuf >> codeSize) * sampleMul; 50983 codeBuf &= (1 << codeSize) - 1; 50984 } 50985 50986 return array; 50987 } 50988 50989 static parse({ 50990 xref, 50991 isEvalSupported, 50992 fn 50993 }) { 50994 const dict = fn.dict || fn; 50995 const typeNum = dict.get("FunctionType"); 50996 50997 switch (typeNum) { 50998 case 0: 50999 return this.constructSampled({ 51000 xref, 51001 isEvalSupported, 51002 fn, 51003 dict 51004 }); 51005 51006 case 1: 51007 break; 51008 51009 case 2: 51010 return this.constructInterpolated({ 51011 xref, 51012 isEvalSupported, 51013 dict 51014 }); 51015 51016 case 3: 51017 return this.constructStiched({ 51018 xref, 51019 isEvalSupported, 51020 dict 51021 }); 51022 51023 case 4: 51024 return this.constructPostScript({ 51025 xref, 51026 isEvalSupported, 51027 fn, 51028 dict 51029 }); 51030 } 51031 51032 throw new _util.FormatError("Unknown type of function"); 51033 } 51034 51035 static parseArray({ 51036 xref, 51037 isEvalSupported, 51038 fnObj 51039 }) { 51040 if (!Array.isArray(fnObj)) { 51041 return this.parse({ 51042 xref, 51043 isEvalSupported, 51044 fn: fnObj 51045 }); 51046 } 51047 51048 const fnArray = []; 51049 51050 for (let j = 0, jj = fnObj.length; j < jj; j++) { 51051 fnArray.push(this.parse({ 51052 xref, 51053 isEvalSupported, 51054 fn: xref.fetchIfRef(fnObj[j]) 51055 })); 51056 } 51057 51058 return function (src, srcOffset, dest, destOffset) { 51059 for (let i = 0, ii = fnArray.length; i < ii; i++) { 51060 fnArray[i](src, srcOffset, dest, destOffset + i); 51061 } 51062 }; 51063 } 51064 51065 static constructSampled({ 51066 xref, 51067 isEvalSupported, 51068 fn, 51069 dict 51070 }) { 51071 function toMultiArray(arr) { 51072 const inputLength = arr.length; 51073 const out = []; 51074 let index = 0; 51075 51076 for (let i = 0; i < inputLength; i += 2) { 51077 out[index++] = [arr[i], arr[i + 1]]; 51078 } 51079 51080 return out; 51081 } 51082 51083 function interpolate(x, xmin, xmax, ymin, ymax) { 51084 return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin)); 51085 } 51086 51087 let domain = toNumberArray(dict.getArray("Domain")); 51088 let range = toNumberArray(dict.getArray("Range")); 51089 51090 if (!domain || !range) { 51091 throw new _util.FormatError("No domain or range"); 51092 } 51093 51094 const inputSize = domain.length / 2; 51095 const outputSize = range.length / 2; 51096 domain = toMultiArray(domain); 51097 range = toMultiArray(range); 51098 const size = toNumberArray(dict.getArray("Size")); 51099 const bps = dict.get("BitsPerSample"); 51100 const order = dict.get("Order") || 1; 51101 51102 if (order !== 1) { 51103 (0, _util.info)("No support for cubic spline interpolation: " + order); 51104 } 51105 51106 let encode = toNumberArray(dict.getArray("Encode")); 51107 51108 if (!encode) { 51109 encode = []; 51110 51111 for (let i = 0; i < inputSize; ++i) { 51112 encode.push([0, size[i] - 1]); 51113 } 51114 } else { 51115 encode = toMultiArray(encode); 51116 } 51117 51118 let decode = toNumberArray(dict.getArray("Decode")); 51119 51120 if (!decode) { 51121 decode = range; 51122 } else { 51123 decode = toMultiArray(decode); 51124 } 51125 51126 const samples = this.getSampleArray(size, outputSize, bps, fn); 51127 return function constructSampledFn(src, srcOffset, dest, destOffset) { 51128 const cubeVertices = 1 << inputSize; 51129 const cubeN = new Float64Array(cubeVertices); 51130 const cubeVertex = new Uint32Array(cubeVertices); 51131 let i, j; 51132 51133 for (j = 0; j < cubeVertices; j++) { 51134 cubeN[j] = 1; 51135 } 51136 51137 let k = outputSize, 51138 pos = 1; 51139 51140 for (i = 0; i < inputSize; ++i) { 51141 const domain_2i = domain[i][0]; 51142 const domain_2i_1 = domain[i][1]; 51143 const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1); 51144 let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]); 51145 const size_i = size[i]; 51146 e = Math.min(Math.max(e, 0), size_i - 1); 51147 const e0 = e < size_i - 1 ? Math.floor(e) : e - 1; 51148 const n0 = e0 + 1 - e; 51149 const n1 = e - e0; 51150 const offset0 = e0 * k; 51151 const offset1 = offset0 + k; 51152 51153 for (j = 0; j < cubeVertices; j++) { 51154 if (j & pos) { 51155 cubeN[j] *= n1; 51156 cubeVertex[j] += offset1; 51157 } else { 51158 cubeN[j] *= n0; 51159 cubeVertex[j] += offset0; 51160 } 51161 } 51162 51163 k *= size_i; 51164 pos <<= 1; 51165 } 51166 51167 for (j = 0; j < outputSize; ++j) { 51168 let rj = 0; 51169 51170 for (i = 0; i < cubeVertices; i++) { 51171 rj += samples[cubeVertex[i] + j] * cubeN[i]; 51172 } 51173 51174 rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]); 51175 dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]); 51176 } 51177 }; 51178 } 51179 51180 static constructInterpolated({ 51181 xref, 51182 isEvalSupported, 51183 dict 51184 }) { 51185 const c0 = toNumberArray(dict.getArray("C0")) || [0]; 51186 const c1 = toNumberArray(dict.getArray("C1")) || [1]; 51187 const n = dict.get("N"); 51188 const diff = []; 51189 51190 for (let i = 0, ii = c0.length; i < ii; ++i) { 51191 diff.push(c1[i] - c0[i]); 51192 } 51193 51194 const length = diff.length; 51195 return function constructInterpolatedFn(src, srcOffset, dest, destOffset) { 51196 const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n; 51197 51198 for (let j = 0; j < length; ++j) { 51199 dest[destOffset + j] = c0[j] + x * diff[j]; 51200 } 51201 }; 51202 } 51203 51204 static constructStiched({ 51205 xref, 51206 isEvalSupported, 51207 dict 51208 }) { 51209 const domain = toNumberArray(dict.getArray("Domain")); 51210 51211 if (!domain) { 51212 throw new _util.FormatError("No domain"); 51213 } 51214 51215 const inputSize = domain.length / 2; 51216 51217 if (inputSize !== 1) { 51218 throw new _util.FormatError("Bad domain for stiched function"); 51219 } 51220 51221 const fnRefs = dict.get("Functions"); 51222 const fns = []; 51223 51224 for (let i = 0, ii = fnRefs.length; i < ii; ++i) { 51225 fns.push(this.parse({ 51226 xref, 51227 isEvalSupported, 51228 fn: xref.fetchIfRef(fnRefs[i]) 51229 })); 51230 } 51231 51232 const bounds = toNumberArray(dict.getArray("Bounds")); 51233 const encode = toNumberArray(dict.getArray("Encode")); 51234 const tmpBuf = new Float32Array(1); 51235 return function constructStichedFn(src, srcOffset, dest, destOffset) { 51236 const clip = function constructStichedFromIRClip(v, min, max) { 51237 if (v > max) { 51238 v = max; 51239 } else if (v < min) { 51240 v = min; 51241 } 51242 51243 return v; 51244 }; 51245 51246 const v = clip(src[srcOffset], domain[0], domain[1]); 51247 const length = bounds.length; 51248 let i; 51249 51250 for (i = 0; i < length; ++i) { 51251 if (v < bounds[i]) { 51252 break; 51253 } 51254 } 51255 51256 let dmin = domain[0]; 51257 51258 if (i > 0) { 51259 dmin = bounds[i - 1]; 51260 } 51261 51262 let dmax = domain[1]; 51263 51264 if (i < bounds.length) { 51265 dmax = bounds[i]; 51266 } 51267 51268 const rmin = encode[2 * i]; 51269 const rmax = encode[2 * i + 1]; 51270 tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin); 51271 fns[i](tmpBuf, 0, dest, destOffset); 51272 }; 51273 } 51274 51275 static constructPostScript({ 51276 xref, 51277 isEvalSupported, 51278 fn, 51279 dict 51280 }) { 51281 const domain = toNumberArray(dict.getArray("Domain")); 51282 const range = toNumberArray(dict.getArray("Range")); 51283 51284 if (!domain) { 51285 throw new _util.FormatError("No domain."); 51286 } 51287 51288 if (!range) { 51289 throw new _util.FormatError("No range."); 51290 } 51291 51292 const lexer = new _ps_parser.PostScriptLexer(fn); 51293 const parser = new _ps_parser.PostScriptParser(lexer); 51294 const code = parser.parse(); 51295 51296 if (isEvalSupported && _util.FeatureTest.isEvalSupported) { 51297 const compiled = new PostScriptCompiler().compile(code, domain, range); 51298 51299 if (compiled) { 51300 return new Function("src", "srcOffset", "dest", "destOffset", compiled); 51301 } 51302 } 51303 51304 (0, _util.info)("Unable to compile PS function"); 51305 const numOutputs = range.length >> 1; 51306 const numInputs = domain.length >> 1; 51307 const evaluator = new PostScriptEvaluator(code); 51308 const cache = Object.create(null); 51309 const MAX_CACHE_SIZE = 2048 * 4; 51310 let cache_available = MAX_CACHE_SIZE; 51311 const tmpBuf = new Float32Array(numInputs); 51312 return function constructPostScriptFn(src, srcOffset, dest, destOffset) { 51313 let i, value; 51314 let key = ""; 51315 const input = tmpBuf; 51316 51317 for (i = 0; i < numInputs; i++) { 51318 value = src[srcOffset + i]; 51319 input[i] = value; 51320 key += value + "_"; 51321 } 51322 51323 const cachedValue = cache[key]; 51324 51325 if (cachedValue !== undefined) { 51326 dest.set(cachedValue, destOffset); 51327 return; 51328 } 51329 51330 const output = new Float32Array(numOutputs); 51331 const stack = evaluator.execute(input); 51332 const stackIndex = stack.length - numOutputs; 51333 51334 for (i = 0; i < numOutputs; i++) { 51335 value = stack[stackIndex + i]; 51336 let bound = range[i * 2]; 51337 51338 if (value < bound) { 51339 value = bound; 51340 } else { 51341 bound = range[i * 2 + 1]; 51342 51343 if (value > bound) { 51344 value = bound; 51345 } 51346 } 51347 51348 output[i] = value; 51349 } 51350 51351 if (cache_available > 0) { 51352 cache_available--; 51353 cache[key] = output; 51354 } 51355 51356 dest.set(output, destOffset); 51357 }; 51358 } 51359 51360} 51361 51362function isPDFFunction(v) { 51363 let fnDict; 51364 51365 if (typeof v !== "object") { 51366 return false; 51367 } else if (v instanceof _primitives.Dict) { 51368 fnDict = v; 51369 } else if (v instanceof _base_stream.BaseStream) { 51370 fnDict = v.dict; 51371 } else { 51372 return false; 51373 } 51374 51375 return fnDict.has("FunctionType"); 51376} 51377 51378class PostScriptStack { 51379 static get MAX_STACK_SIZE() { 51380 return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100); 51381 } 51382 51383 constructor(initialStack) { 51384 this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0); 51385 } 51386 51387 push(value) { 51388 if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) { 51389 throw new Error("PostScript function stack overflow."); 51390 } 51391 51392 this.stack.push(value); 51393 } 51394 51395 pop() { 51396 if (this.stack.length <= 0) { 51397 throw new Error("PostScript function stack underflow."); 51398 } 51399 51400 return this.stack.pop(); 51401 } 51402 51403 copy(n) { 51404 if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) { 51405 throw new Error("PostScript function stack overflow."); 51406 } 51407 51408 const stack = this.stack; 51409 51410 for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) { 51411 stack.push(stack[i]); 51412 } 51413 } 51414 51415 index(n) { 51416 this.push(this.stack[this.stack.length - n - 1]); 51417 } 51418 51419 roll(n, p) { 51420 const stack = this.stack; 51421 const l = stack.length - n; 51422 const r = stack.length - 1; 51423 const c = l + (p - Math.floor(p / n) * n); 51424 51425 for (let i = l, j = r; i < j; i++, j--) { 51426 const t = stack[i]; 51427 stack[i] = stack[j]; 51428 stack[j] = t; 51429 } 51430 51431 for (let i = l, j = c - 1; i < j; i++, j--) { 51432 const t = stack[i]; 51433 stack[i] = stack[j]; 51434 stack[j] = t; 51435 } 51436 51437 for (let i = c, j = r; i < j; i++, j--) { 51438 const t = stack[i]; 51439 stack[i] = stack[j]; 51440 stack[j] = t; 51441 } 51442 } 51443 51444} 51445 51446class PostScriptEvaluator { 51447 constructor(operators) { 51448 this.operators = operators; 51449 } 51450 51451 execute(initialStack) { 51452 const stack = new PostScriptStack(initialStack); 51453 let counter = 0; 51454 const operators = this.operators; 51455 const length = operators.length; 51456 let operator, a, b; 51457 51458 while (counter < length) { 51459 operator = operators[counter++]; 51460 51461 if (typeof operator === "number") { 51462 stack.push(operator); 51463 continue; 51464 } 51465 51466 switch (operator) { 51467 case "jz": 51468 b = stack.pop(); 51469 a = stack.pop(); 51470 51471 if (!a) { 51472 counter = b; 51473 } 51474 51475 break; 51476 51477 case "j": 51478 a = stack.pop(); 51479 counter = a; 51480 break; 51481 51482 case "abs": 51483 a = stack.pop(); 51484 stack.push(Math.abs(a)); 51485 break; 51486 51487 case "add": 51488 b = stack.pop(); 51489 a = stack.pop(); 51490 stack.push(a + b); 51491 break; 51492 51493 case "and": 51494 b = stack.pop(); 51495 a = stack.pop(); 51496 51497 if (typeof a === "boolean" && typeof b === "boolean") { 51498 stack.push(a && b); 51499 } else { 51500 stack.push(a & b); 51501 } 51502 51503 break; 51504 51505 case "atan": 51506 a = stack.pop(); 51507 stack.push(Math.atan(a)); 51508 break; 51509 51510 case "bitshift": 51511 b = stack.pop(); 51512 a = stack.pop(); 51513 51514 if (a > 0) { 51515 stack.push(a << b); 51516 } else { 51517 stack.push(a >> b); 51518 } 51519 51520 break; 51521 51522 case "ceiling": 51523 a = stack.pop(); 51524 stack.push(Math.ceil(a)); 51525 break; 51526 51527 case "copy": 51528 a = stack.pop(); 51529 stack.copy(a); 51530 break; 51531 51532 case "cos": 51533 a = stack.pop(); 51534 stack.push(Math.cos(a)); 51535 break; 51536 51537 case "cvi": 51538 a = stack.pop() | 0; 51539 stack.push(a); 51540 break; 51541 51542 case "cvr": 51543 break; 51544 51545 case "div": 51546 b = stack.pop(); 51547 a = stack.pop(); 51548 stack.push(a / b); 51549 break; 51550 51551 case "dup": 51552 stack.copy(1); 51553 break; 51554 51555 case "eq": 51556 b = stack.pop(); 51557 a = stack.pop(); 51558 stack.push(a === b); 51559 break; 51560 51561 case "exch": 51562 stack.roll(2, 1); 51563 break; 51564 51565 case "exp": 51566 b = stack.pop(); 51567 a = stack.pop(); 51568 stack.push(a ** b); 51569 break; 51570 51571 case "false": 51572 stack.push(false); 51573 break; 51574 51575 case "floor": 51576 a = stack.pop(); 51577 stack.push(Math.floor(a)); 51578 break; 51579 51580 case "ge": 51581 b = stack.pop(); 51582 a = stack.pop(); 51583 stack.push(a >= b); 51584 break; 51585 51586 case "gt": 51587 b = stack.pop(); 51588 a = stack.pop(); 51589 stack.push(a > b); 51590 break; 51591 51592 case "idiv": 51593 b = stack.pop(); 51594 a = stack.pop(); 51595 stack.push(a / b | 0); 51596 break; 51597 51598 case "index": 51599 a = stack.pop(); 51600 stack.index(a); 51601 break; 51602 51603 case "le": 51604 b = stack.pop(); 51605 a = stack.pop(); 51606 stack.push(a <= b); 51607 break; 51608 51609 case "ln": 51610 a = stack.pop(); 51611 stack.push(Math.log(a)); 51612 break; 51613 51614 case "log": 51615 a = stack.pop(); 51616 stack.push(Math.log(a) / Math.LN10); 51617 break; 51618 51619 case "lt": 51620 b = stack.pop(); 51621 a = stack.pop(); 51622 stack.push(a < b); 51623 break; 51624 51625 case "mod": 51626 b = stack.pop(); 51627 a = stack.pop(); 51628 stack.push(a % b); 51629 break; 51630 51631 case "mul": 51632 b = stack.pop(); 51633 a = stack.pop(); 51634 stack.push(a * b); 51635 break; 51636 51637 case "ne": 51638 b = stack.pop(); 51639 a = stack.pop(); 51640 stack.push(a !== b); 51641 break; 51642 51643 case "neg": 51644 a = stack.pop(); 51645 stack.push(-a); 51646 break; 51647 51648 case "not": 51649 a = stack.pop(); 51650 51651 if (typeof a === "boolean") { 51652 stack.push(!a); 51653 } else { 51654 stack.push(~a); 51655 } 51656 51657 break; 51658 51659 case "or": 51660 b = stack.pop(); 51661 a = stack.pop(); 51662 51663 if (typeof a === "boolean" && typeof b === "boolean") { 51664 stack.push(a || b); 51665 } else { 51666 stack.push(a | b); 51667 } 51668 51669 break; 51670 51671 case "pop": 51672 stack.pop(); 51673 break; 51674 51675 case "roll": 51676 b = stack.pop(); 51677 a = stack.pop(); 51678 stack.roll(a, b); 51679 break; 51680 51681 case "round": 51682 a = stack.pop(); 51683 stack.push(Math.round(a)); 51684 break; 51685 51686 case "sin": 51687 a = stack.pop(); 51688 stack.push(Math.sin(a)); 51689 break; 51690 51691 case "sqrt": 51692 a = stack.pop(); 51693 stack.push(Math.sqrt(a)); 51694 break; 51695 51696 case "sub": 51697 b = stack.pop(); 51698 a = stack.pop(); 51699 stack.push(a - b); 51700 break; 51701 51702 case "true": 51703 stack.push(true); 51704 break; 51705 51706 case "truncate": 51707 a = stack.pop(); 51708 a = a < 0 ? Math.ceil(a) : Math.floor(a); 51709 stack.push(a); 51710 break; 51711 51712 case "xor": 51713 b = stack.pop(); 51714 a = stack.pop(); 51715 51716 if (typeof a === "boolean" && typeof b === "boolean") { 51717 stack.push(a !== b); 51718 } else { 51719 stack.push(a ^ b); 51720 } 51721 51722 break; 51723 51724 default: 51725 throw new _util.FormatError(`Unknown operator ${operator}`); 51726 } 51727 } 51728 51729 return stack.stack; 51730 } 51731 51732} 51733 51734exports.PostScriptEvaluator = PostScriptEvaluator; 51735 51736class AstNode { 51737 constructor(type) { 51738 this.type = type; 51739 } 51740 51741 visit(visitor) { 51742 (0, _util.unreachable)("abstract method"); 51743 } 51744 51745} 51746 51747class AstArgument extends AstNode { 51748 constructor(index, min, max) { 51749 super("args"); 51750 this.index = index; 51751 this.min = min; 51752 this.max = max; 51753 } 51754 51755 visit(visitor) { 51756 visitor.visitArgument(this); 51757 } 51758 51759} 51760 51761class AstLiteral extends AstNode { 51762 constructor(number) { 51763 super("literal"); 51764 this.number = number; 51765 this.min = number; 51766 this.max = number; 51767 } 51768 51769 visit(visitor) { 51770 visitor.visitLiteral(this); 51771 } 51772 51773} 51774 51775class AstBinaryOperation extends AstNode { 51776 constructor(op, arg1, arg2, min, max) { 51777 super("binary"); 51778 this.op = op; 51779 this.arg1 = arg1; 51780 this.arg2 = arg2; 51781 this.min = min; 51782 this.max = max; 51783 } 51784 51785 visit(visitor) { 51786 visitor.visitBinaryOperation(this); 51787 } 51788 51789} 51790 51791class AstMin extends AstNode { 51792 constructor(arg, max) { 51793 super("max"); 51794 this.arg = arg; 51795 this.min = arg.min; 51796 this.max = max; 51797 } 51798 51799 visit(visitor) { 51800 visitor.visitMin(this); 51801 } 51802 51803} 51804 51805class AstVariable extends AstNode { 51806 constructor(index, min, max) { 51807 super("var"); 51808 this.index = index; 51809 this.min = min; 51810 this.max = max; 51811 } 51812 51813 visit(visitor) { 51814 visitor.visitVariable(this); 51815 } 51816 51817} 51818 51819class AstVariableDefinition extends AstNode { 51820 constructor(variable, arg) { 51821 super("definition"); 51822 this.variable = variable; 51823 this.arg = arg; 51824 } 51825 51826 visit(visitor) { 51827 visitor.visitVariableDefinition(this); 51828 } 51829 51830} 51831 51832class ExpressionBuilderVisitor { 51833 constructor() { 51834 this.parts = []; 51835 } 51836 51837 visitArgument(arg) { 51838 this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))"); 51839 } 51840 51841 visitVariable(variable) {
vendor: 5,098 bytes, lines 51842-52055
51842 this.parts.push("v", variable.index); 51843 } 51844 51845 visitLiteral(literal) { 51846 this.parts.push(literal.number); 51847 } 51848 51849 visitBinaryOperation(operation) { 51850 this.parts.push("("); 51851 operation.arg1.visit(this); 51852 this.parts.push(" ", operation.op, " "); 51853 operation.arg2.visit(this); 51854 this.parts.push(")"); 51855 } 51856 51857 visitVariableDefinition(definition) { 51858 this.parts.push("var "); 51859 definition.variable.visit(this); 51860 this.parts.push(" = "); 51861 definition.arg.visit(this); 51862 this.parts.push(";"); 51863 } 51864 51865 visitMin(max) { 51866 this.parts.push("Math.min("); 51867 max.arg.visit(this); 51868 this.parts.push(", ", max.max, ")"); 51869 } 51870 51871 toString() { 51872 return this.parts.join(""); 51873 } 51874 51875} 51876 51877function buildAddOperation(num1, num2) { 51878 if (num2.type === "literal" && num2.number === 0) { 51879 return num1; 51880 } 51881 51882 if (num1.type === "literal" && num1.number === 0) { 51883 return num2; 51884 } 51885 51886 if (num2.type === "literal" && num1.type === "literal") { 51887 return new AstLiteral(num1.number + num2.number); 51888 } 51889 51890 return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max); 51891} 51892 51893function buildMulOperation(num1, num2) { 51894 if (num2.type === "literal") { 51895 if (num2.number === 0) { 51896 return new AstLiteral(0); 51897 } else if (num2.number === 1) { 51898 return num1; 51899 } else if (num1.type === "literal") { 51900 return new AstLiteral(num1.number * num2.number); 51901 } 51902 } 51903 51904 if (num1.type === "literal") { 51905 if (num1.number === 0) { 51906 return new AstLiteral(0); 51907 } else if (num1.number === 1) { 51908 return num2; 51909 } 51910 } 51911 51912 const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max); 51913 const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max); 51914 return new AstBinaryOperation("*", num1, num2, min, max); 51915} 51916 51917function buildSubOperation(num1, num2) { 51918 if (num2.type === "literal") { 51919 if (num2.number === 0) { 51920 return num1; 51921 } else if (num1.type === "literal") { 51922 return new AstLiteral(num1.number - num2.number); 51923 } 51924 } 51925 51926 if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) { 51927 return num2.arg2; 51928 } 51929 51930 return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min); 51931} 51932 51933function buildMinOperation(num1, max) { 51934 if (num1.min >= max) { 51935 return new AstLiteral(max); 51936 } else if (num1.max <= max) { 51937 return num1; 51938 } 51939 51940 return new AstMin(num1, max); 51941} 51942 51943class PostScriptCompiler { 51944 compile(code, domain, range) { 51945 const stack = []; 51946 const instructions = []; 51947 const inputSize = domain.length >> 1, 51948 outputSize = range.length >> 1; 51949 let lastRegister = 0; 51950 let n, j; 51951 let num1, num2, ast1, ast2, tmpVar, item; 51952 51953 for (let i = 0; i < inputSize; i++) { 51954 stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1])); 51955 } 51956 51957 for (let i = 0, ii = code.length; i < ii; i++) { 51958 item = code[i]; 51959 51960 if (typeof item === "number") { 51961 stack.push(new AstLiteral(item)); 51962 continue; 51963 } 51964 51965 switch (item) { 51966 case "add": 51967 if (stack.length < 2) { 51968 return null; 51969 } 51970 51971 num2 = stack.pop(); 51972 num1 = stack.pop(); 51973 stack.push(buildAddOperation(num1, num2)); 51974 break; 51975 51976 case "cvr": 51977 if (stack.length < 1) { 51978 return null; 51979 } 51980 51981 break; 51982 51983 case "mul": 51984 if (stack.length < 2) { 51985 return null; 51986 } 51987 51988 num2 = stack.pop(); 51989 num1 = stack.pop(); 51990 stack.push(buildMulOperation(num1, num2)); 51991 break; 51992 51993 case "sub": 51994 if (stack.length < 2) { 51995 return null; 51996 } 51997 51998 num2 = stack.pop(); 51999 num1 = stack.pop(); 52000 stack.push(buildSubOperation(num1, num2)); 52001 break; 52002 52003 case "exch": 52004 if (stack.length < 2) { 52005 return null; 52006 } 52007 52008 ast1 = stack.pop(); 52009 ast2 = stack.pop(); 52010 stack.push(ast1, ast2); 52011 break; 52012 52013 case "pop": 52014 if (stack.length < 1) { 52015 return null; 52016 } 52017 52018 stack.pop(); 52019 break; 52020 52021 case "index": 52022 if (stack.length < 1) { 52023 return null; 52024 } 52025 52026 num1 = stack.pop(); 52027 52028 if (num1.type !== "literal") { 52029 return null; 52030 } 52031 52032 n = num1.number; 52033 52034 if (n < 0 || !Number.isInteger(n) || stack.length < n) { 52035 return null; 52036 } 52037 52038 ast1 = stack[stack.length - n - 1]; 52039 52040 if (ast1.type === "literal" || ast1.type === "var") { 52041 stack.push(ast1); 52042 break; 52043 } 52044 52045 tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); 52046 stack[stack.length - n - 1] = tmpVar; 52047 stack.push(tmpVar); 52048 instructions.push(new AstVariableDefinition(tmpVar, ast1)); 52049 break; 52050 52051 case "dup": 52052 if (stack.length < 1) { 52053 return null; 52054 } 52055
vendor: 107,147 bytes, lines 52056-56145
52056 if (typeof code[i + 1] === "number" && code[i + 2] === "gt" && code[i + 3] === i + 7 && code[i + 4] === "jz" && code[i + 5] === "pop" && code[i + 6] === code[i + 1]) { 52057 num1 = stack.pop(); 52058 stack.push(buildMinOperation(num1, code[i + 1])); 52059 i += 6; 52060 break; 52061 } 52062 52063 ast1 = stack.at(-1); 52064 52065 if (ast1.type === "literal" || ast1.type === "var") { 52066 stack.push(ast1); 52067 break; 52068 } 52069 52070 tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); 52071 stack[stack.length - 1] = tmpVar; 52072 stack.push(tmpVar); 52073 instructions.push(new AstVariableDefinition(tmpVar, ast1)); 52074 break; 52075 52076 case "roll": 52077 if (stack.length < 2) { 52078 return null; 52079 } 52080 52081 num2 = stack.pop(); 52082 num1 = stack.pop(); 52083 52084 if (num2.type !== "literal" || num1.type !== "literal") { 52085 return null; 52086 } 52087 52088 j = num2.number; 52089 n = num1.number; 52090 52091 if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) { 52092 return null; 52093 } 52094 52095 j = (j % n + n) % n; 52096 52097 if (j === 0) { 52098 break; 52099 } 52100 52101 Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j)); 52102 break; 52103 52104 default: 52105 return null; 52106 } 52107 } 52108 52109 if (stack.length !== outputSize) { 52110 return null; 52111 } 52112 52113 const result = []; 52114 52115 for (const instruction of instructions) { 52116 const statementBuilder = new ExpressionBuilderVisitor(); 52117 instruction.visit(statementBuilder); 52118 result.push(statementBuilder.toString()); 52119 } 52120 52121 for (let i = 0, ii = stack.length; i < ii; i++) { 52122 const expr = stack[i], 52123 statementBuilder = new ExpressionBuilderVisitor(); 52124 expr.visit(statementBuilder); 52125 const min = range[i * 2], 52126 max = range[i * 2 + 1]; 52127 const out = [statementBuilder.toString()]; 52128 52129 if (min > expr.min) { 52130 out.unshift("Math.max(", min, ", "); 52131 out.push(")"); 52132 } 52133 52134 if (max < expr.max) { 52135 out.unshift("Math.min(", max, ", "); 52136 out.push(")"); 52137 } 52138 52139 out.unshift("dest[destOffset + ", i, "] = "); 52140 out.push(";"); 52141 result.push(out.join("")); 52142 } 52143 52144 return result.join("\n"); 52145 } 52146 52147} 52148 52149exports.PostScriptCompiler = PostScriptCompiler; 52150 52151/***/ }), 52152/* 58 */ 52153/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 52154 52155 52156 52157Object.defineProperty(exports, "__esModule", ({ 52158 value: true 52159})); 52160exports.PostScriptParser = exports.PostScriptLexer = void 0; 52161 52162var _util = __w_pdfjs_require__(2); 52163 52164var _primitives = __w_pdfjs_require__(5); 52165 52166var _core_utils = __w_pdfjs_require__(6); 52167 52168class PostScriptParser { 52169 constructor(lexer) { 52170 this.lexer = lexer; 52171 this.operators = []; 52172 this.token = null; 52173 this.prev = null; 52174 } 52175 52176 nextToken() { 52177 this.prev = this.token; 52178 this.token = this.lexer.getToken(); 52179 } 52180 52181 accept(type) { 52182 if (this.token.type === type) { 52183 this.nextToken(); 52184 return true; 52185 } 52186 52187 return false; 52188 } 52189 52190 expect(type) { 52191 if (this.accept(type)) { 52192 return true; 52193 } 52194 52195 throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`); 52196 } 52197 52198 parse() { 52199 this.nextToken(); 52200 this.expect(PostScriptTokenTypes.LBRACE); 52201 this.parseBlock(); 52202 this.expect(PostScriptTokenTypes.RBRACE); 52203 return this.operators; 52204 } 52205 52206 parseBlock() { 52207 while (true) { 52208 if (this.accept(PostScriptTokenTypes.NUMBER)) { 52209 this.operators.push(this.prev.value); 52210 } else if (this.accept(PostScriptTokenTypes.OPERATOR)) { 52211 this.operators.push(this.prev.value); 52212 } else if (this.accept(PostScriptTokenTypes.LBRACE)) { 52213 this.parseCondition(); 52214 } else { 52215 return; 52216 } 52217 } 52218 } 52219 52220 parseCondition() { 52221 const conditionLocation = this.operators.length; 52222 this.operators.push(null, null); 52223 this.parseBlock(); 52224 this.expect(PostScriptTokenTypes.RBRACE); 52225 52226 if (this.accept(PostScriptTokenTypes.IF)) { 52227 this.operators[conditionLocation] = this.operators.length; 52228 this.operators[conditionLocation + 1] = "jz"; 52229 } else if (this.accept(PostScriptTokenTypes.LBRACE)) { 52230 const jumpLocation = this.operators.length; 52231 this.operators.push(null, null); 52232 const endOfTrue = this.operators.length; 52233 this.parseBlock(); 52234 this.expect(PostScriptTokenTypes.RBRACE); 52235 this.expect(PostScriptTokenTypes.IFELSE); 52236 this.operators[jumpLocation] = this.operators.length; 52237 this.operators[jumpLocation + 1] = "j"; 52238 this.operators[conditionLocation] = endOfTrue; 52239 this.operators[conditionLocation + 1] = "jz"; 52240 } else { 52241 throw new _util.FormatError("PS Function: error parsing conditional."); 52242 } 52243 } 52244 52245} 52246 52247exports.PostScriptParser = PostScriptParser; 52248const PostScriptTokenTypes = { 52249 LBRACE: 0, 52250 RBRACE: 1, 52251 NUMBER: 2, 52252 OPERATOR: 3, 52253 IF: 4, 52254 IFELSE: 5 52255}; 52256 52257class PostScriptToken { 52258 static get opCache() { 52259 return (0, _util.shadow)(this, "opCache", Object.create(null)); 52260 } 52261 52262 constructor(type, value) { 52263 this.type = type; 52264 this.value = value; 52265 } 52266 52267 static getOperator(op) { 52268 const opValue = PostScriptToken.opCache[op]; 52269 52270 if (opValue) { 52271 return opValue; 52272 } 52273 52274 return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op); 52275 } 52276 52277 static get LBRACE() { 52278 return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{")); 52279 } 52280 52281 static get RBRACE() { 52282 return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}")); 52283 } 52284 52285 static get IF() { 52286 return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF")); 52287 } 52288 52289 static get IFELSE() { 52290 return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE")); 52291 } 52292 52293} 52294 52295class PostScriptLexer { 52296 constructor(stream) { 52297 this.stream = stream; 52298 this.nextChar(); 52299 this.strBuf = []; 52300 } 52301 52302 nextChar() { 52303 return this.currentChar = this.stream.getByte(); 52304 } 52305 52306 getToken() { 52307 let comment = false; 52308 let ch = this.currentChar; 52309 52310 while (true) { 52311 if (ch < 0) { 52312 return _primitives.EOF; 52313 } 52314 52315 if (comment) { 52316 if (ch === 0x0a || ch === 0x0d) { 52317 comment = false; 52318 } 52319 } else if (ch === 0x25) { 52320 comment = true; 52321 } else if (!(0, _core_utils.isWhiteSpace)(ch)) { 52322 break; 52323 } 52324 52325 ch = this.nextChar(); 52326 } 52327 52328 switch (ch | 0) { 52329 case 0x30: 52330 case 0x31: 52331 case 0x32: 52332 case 0x33: 52333 case 0x34: 52334 case 0x35: 52335 case 0x36: 52336 case 0x37: 52337 case 0x38: 52338 case 0x39: 52339 case 0x2b: 52340 case 0x2d: 52341 case 0x2e: 52342 return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber()); 52343 52344 case 0x7b: 52345 this.nextChar(); 52346 return PostScriptToken.LBRACE; 52347 52348 case 0x7d: 52349 this.nextChar(); 52350 return PostScriptToken.RBRACE; 52351 } 52352 52353 const strBuf = this.strBuf; 52354 strBuf.length = 0; 52355 strBuf[0] = String.fromCharCode(ch); 52356 52357 while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) { 52358 strBuf.push(String.fromCharCode(ch)); 52359 } 52360 52361 const str = strBuf.join(""); 52362 52363 switch (str.toLowerCase()) { 52364 case "if": 52365 return PostScriptToken.IF; 52366 52367 case "ifelse": 52368 return PostScriptToken.IFELSE; 52369 52370 default: 52371 return PostScriptToken.getOperator(str); 52372 } 52373 } 52374 52375 getNumber() { 52376 let ch = this.currentChar; 52377 const strBuf = this.strBuf; 52378 strBuf.length = 0; 52379 strBuf[0] = String.fromCharCode(ch); 52380 52381 while ((ch = this.nextChar()) >= 0) { 52382 if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) { 52383 strBuf.push(String.fromCharCode(ch)); 52384 } else { 52385 break; 52386 } 52387 } 52388 52389 const value = parseFloat(strBuf.join("")); 52390 52391 if (isNaN(value)) { 52392 throw new _util.FormatError(`Invalid floating point number: ${value}`); 52393 } 52394 52395 return value; 52396 } 52397 52398} 52399 52400exports.PostScriptLexer = PostScriptLexer; 52401 52402/***/ }), 52403/* 59 */ 52404/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 52405 52406 52407 52408Object.defineProperty(exports, "__esModule", ({ 52409 value: true 52410})); 52411exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0; 52412 52413var _util = __w_pdfjs_require__(2); 52414 52415var _primitives = __w_pdfjs_require__(5); 52416 52417class BaseLocalCache { 52418 constructor(options) { 52419 if (this.constructor === BaseLocalCache) { 52420 (0, _util.unreachable)("Cannot initialize BaseLocalCache."); 52421 } 52422 52423 this._onlyRefs = (options && options.onlyRefs) === true; 52424 52425 if (!this._onlyRefs) { 52426 this._nameRefMap = new Map(); 52427 this._imageMap = new Map(); 52428 } 52429 52430 this._imageCache = new _primitives.RefSetCache(); 52431 } 52432 52433 getByName(name) { 52434 if (this._onlyRefs) { 52435 (0, _util.unreachable)("Should not call `getByName` method."); 52436 } 52437 52438 const ref = this._nameRefMap.get(name); 52439 52440 if (ref) { 52441 return this.getByRef(ref); 52442 } 52443 52444 return this._imageMap.get(name) || null; 52445 } 52446 52447 getByRef(ref) { 52448 return this._imageCache.get(ref) || null; 52449 } 52450 52451 set(name, ref, data) { 52452 (0, _util.unreachable)("Abstract method `set` called."); 52453 } 52454 52455} 52456 52457class LocalImageCache extends BaseLocalCache { 52458 set(name, ref = null, data) { 52459 if (typeof name !== "string") { 52460 throw new Error('LocalImageCache.set - expected "name" argument.'); 52461 } 52462 52463 if (ref) { 52464 if (this._imageCache.has(ref)) { 52465 return; 52466 } 52467 52468 this._nameRefMap.set(name, ref); 52469 52470 this._imageCache.put(ref, data); 52471 52472 return; 52473 } 52474 52475 if (this._imageMap.has(name)) { 52476 return; 52477 } 52478 52479 this._imageMap.set(name, data); 52480 } 52481 52482} 52483 52484exports.LocalImageCache = LocalImageCache; 52485 52486class LocalColorSpaceCache extends BaseLocalCache { 52487 set(name = null, ref = null, data) { 52488 if (typeof name !== "string" && !ref) { 52489 throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.'); 52490 } 52491 52492 if (ref) { 52493 if (this._imageCache.has(ref)) { 52494 return; 52495 } 52496 52497 if (name !== null) { 52498 this._nameRefMap.set(name, ref); 52499 } 52500 52501 this._imageCache.put(ref, data); 52502 52503 return; 52504 } 52505 52506 if (this._imageMap.has(name)) { 52507 return; 52508 } 52509 52510 this._imageMap.set(name, data); 52511 } 52512 52513} 52514 52515exports.LocalColorSpaceCache = LocalColorSpaceCache; 52516 52517class LocalFunctionCache extends BaseLocalCache { 52518 constructor(options) { 52519 super({ 52520 onlyRefs: true 52521 }); 52522 } 52523 52524 set(name = null, ref, data) { 52525 if (!ref) { 52526 throw new Error('LocalFunctionCache.set - expected "ref" argument.'); 52527 } 52528 52529 if (this._imageCache.has(ref)) { 52530 return; 52531 } 52532 52533 this._imageCache.put(ref, data); 52534 } 52535 52536} 52537 52538exports.LocalFunctionCache = LocalFunctionCache; 52539 52540class LocalGStateCache extends BaseLocalCache { 52541 set(name, ref = null, data) { 52542 if (typeof name !== "string") { 52543 throw new Error('LocalGStateCache.set - expected "name" argument.'); 52544 } 52545 52546 if (ref) { 52547 if (this._imageCache.has(ref)) { 52548 return; 52549 } 52550 52551 this._nameRefMap.set(name, ref); 52552 52553 this._imageCache.put(ref, data); 52554 52555 return; 52556 } 52557 52558 if (this._imageMap.has(name)) { 52559 return; 52560 } 52561 52562 this._imageMap.set(name, data); 52563 } 52564 52565} 52566 52567exports.LocalGStateCache = LocalGStateCache; 52568 52569class LocalTilingPatternCache extends BaseLocalCache { 52570 constructor(options) { 52571 super({ 52572 onlyRefs: true 52573 }); 52574 } 52575 52576 set(name = null, ref, data) { 52577 if (!ref) { 52578 throw new Error('LocalTilingPatternCache.set - expected "ref" argument.'); 52579 } 52580 52581 if (this._imageCache.has(ref)) { 52582 return; 52583 } 52584 52585 this._imageCache.put(ref, data); 52586 } 52587 52588} 52589 52590exports.LocalTilingPatternCache = LocalTilingPatternCache; 52591 52592class GlobalImageCache { 52593 static get NUM_PAGES_THRESHOLD() { 52594 return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2); 52595 } 52596 52597 static get MIN_IMAGES_TO_CACHE() { 52598 return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10); 52599 } 52600 52601 static get MAX_BYTE_SIZE() { 52602 return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6); 52603 } 52604 52605 constructor() { 52606 this._refCache = new _primitives.RefSetCache(); 52607 this._imageCache = new _primitives.RefSetCache(); 52608 } 52609 52610 get _byteSize() { 52611 let byteSize = 0; 52612 52613 for (const imageData of this._imageCache) { 52614 byteSize += imageData.byteSize; 52615 } 52616 52617 return byteSize; 52618 } 52619 52620 get _cacheLimitReached() { 52621 if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) { 52622 return false; 52623 } 52624 52625 if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) { 52626 return false; 52627 } 52628 52629 return true; 52630 } 52631 52632 shouldCache(ref, pageIndex) { 52633 const pageIndexSet = this._refCache.get(ref); 52634 52635 const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1; 52636 52637 if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) { 52638 return false; 52639 } 52640 52641 if (!this._imageCache.has(ref) && this._cacheLimitReached) { 52642 return false; 52643 } 52644 52645 return true; 52646 } 52647 52648 addPageIndex(ref, pageIndex) { 52649 let pageIndexSet = this._refCache.get(ref); 52650 52651 if (!pageIndexSet) { 52652 pageIndexSet = new Set(); 52653 52654 this._refCache.put(ref, pageIndexSet); 52655 } 52656 52657 pageIndexSet.add(pageIndex); 52658 } 52659 52660 addByteSize(ref, byteSize) { 52661 const imageData = this._imageCache.get(ref); 52662 52663 if (!imageData) { 52664 return; 52665 } 52666 52667 if (imageData.byteSize) { 52668 return; 52669 } 52670 52671 imageData.byteSize = byteSize; 52672 } 52673 52674 getData(ref, pageIndex) { 52675 const pageIndexSet = this._refCache.get(ref); 52676 52677 if (!pageIndexSet) { 52678 return null; 52679 } 52680 52681 if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) { 52682 return null; 52683 } 52684 52685 const imageData = this._imageCache.get(ref); 52686 52687 if (!imageData) { 52688 return null; 52689 } 52690 52691 pageIndexSet.add(pageIndex); 52692 return imageData; 52693 } 52694 52695 setData(ref, data) { 52696 if (!this._refCache.has(ref)) { 52697 throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.'); 52698 } 52699 52700 if (this._imageCache.has(ref)) { 52701 return; 52702 } 52703 52704 if (this._cacheLimitReached) { 52705 (0, _util.warn)("GlobalImageCache.setData - cache limit reached."); 52706 return; 52707 } 52708 52709 this._imageCache.put(ref, data); 52710 } 52711 52712 clear(onlyData = false) { 52713 if (!onlyData) { 52714 this._refCache.clear(); 52715 } 52716 52717 this._imageCache.clear(); 52718 } 52719 52720} 52721 52722exports.GlobalImageCache = GlobalImageCache; 52723 52724/***/ }), 52725/* 60 */ 52726/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 52727 52728 52729 52730Object.defineProperty(exports, "__esModule", ({ 52731 value: true 52732})); 52733exports.bidi = bidi; 52734 52735var _util = __w_pdfjs_require__(2); 52736 52737const baseTypes = ["BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "S", "B", "S", "WS", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "B", "B", "B", "S", "WS", "ON", "ON", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "ON", "ES", "CS", "ES", "CS", "CS", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "CS", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "BN", "BN", "BN", "BN", "BN", "BN", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "CS", "ON", "ET", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "L", "ON", "ON", "BN", "ON", "ON", "ET", "ET", "EN", "EN", "ON", "L", "ON", "ON", "ON", "EN", "L", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L"]; 52738const arabicTypes = ["AN", "AN", "AN", "AN", "AN", "AN", "ON", "ON", "AL", "ET", "ET", "AL", "CS", "AL", "ON", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "ET", "AN", "AN", "AL", "AL", "AL", "NSM", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "NSM", "NSM", "ON", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "AL", "AL", "AL", "AL", "AL", "AL"]; 52739 52740function isOdd(i) { 52741 return (i & 1) !== 0; 52742} 52743 52744function isEven(i) { 52745 return (i & 1) === 0; 52746} 52747 52748function findUnequal(arr, start, value) { 52749 let j, jj; 52750 52751 for (j = start, jj = arr.length; j < jj; ++j) { 52752 if (arr[j] !== value) { 52753 return j; 52754 } 52755 } 52756 52757 return j; 52758} 52759 52760function setValues(arr, start, end, value) { 52761 for (let j = start; j < end; ++j) { 52762 arr[j] = value; 52763 } 52764} 52765 52766function reverseValues(arr, start, end) { 52767 for (let i = start, j = end - 1; i < j; ++i, --j) { 52768 const temp = arr[i]; 52769 arr[i] = arr[j]; 52770 arr[j] = temp; 52771 } 52772} 52773 52774function createBidiText(str, isLTR, vertical = false) { 52775 let dir = "ltr"; 52776 52777 if (vertical) { 52778 dir = "ttb"; 52779 } else if (!isLTR) { 52780 dir = "rtl"; 52781 } 52782 52783 return { 52784 str, 52785 dir 52786 }; 52787} 52788 52789const chars = []; 52790const types = []; 52791 52792function bidi(str, startLevel = -1, vertical = false) { 52793 let isLTR = true; 52794 const strLength = str.length; 52795 52796 if (strLength === 0 || vertical) { 52797 return createBidiText(str, isLTR, vertical); 52798 } 52799 52800 chars.length = strLength; 52801 types.length = strLength; 52802 let numBidi = 0; 52803 let i, ii; 52804 52805 for (i = 0; i < strLength; ++i) { 52806 chars[i] = str.charAt(i); 52807 const charCode = str.charCodeAt(i); 52808 let charType = "L"; 52809 52810 if (charCode <= 0x00ff) { 52811 charType = baseTypes[charCode]; 52812 } else if (0x0590 <= charCode && charCode <= 0x05f4) { 52813 charType = "R"; 52814 } else if (0x0600 <= charCode && charCode <= 0x06ff) { 52815 charType = arabicTypes[charCode & 0xff]; 52816 52817 if (!charType) { 52818 (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16)); 52819 } 52820 } else if (0x0700 <= charCode && charCode <= 0x08ac) { 52821 charType = "AL"; 52822 } 52823 52824 if (charType === "R" || charType === "AL" || charType === "AN") { 52825 numBidi++; 52826 } 52827 52828 types[i] = charType; 52829 } 52830 52831 if (numBidi === 0) { 52832 isLTR = true; 52833 return createBidiText(str, isLTR); 52834 } 52835 52836 if (startLevel === -1) { 52837 if (numBidi / strLength < 0.3 && strLength > 4) { 52838 isLTR = true; 52839 startLevel = 0; 52840 } else { 52841 isLTR = false; 52842 startLevel = 1; 52843 } 52844 } 52845 52846 const levels = []; 52847 52848 for (i = 0; i < strLength; ++i) { 52849 levels[i] = startLevel; 52850 } 52851 52852 const e = isOdd(startLevel) ? "R" : "L"; 52853 const sor = e; 52854 const eor = sor; 52855 let lastType = sor; 52856 52857 for (i = 0; i < strLength; ++i) { 52858 if (types[i] === "NSM") { 52859 types[i] = lastType; 52860 } else { 52861 lastType = types[i]; 52862 } 52863 } 52864 52865 lastType = sor; 52866 let t; 52867 52868 for (i = 0; i < strLength; ++i) { 52869 t = types[i]; 52870 52871 if (t === "EN") { 52872 types[i] = lastType === "AL" ? "AN" : "EN"; 52873 } else if (t === "R" || t === "L" || t === "AL") { 52874 lastType = t; 52875 } 52876 } 52877 52878 for (i = 0; i < strLength; ++i) { 52879 t = types[i]; 52880 52881 if (t === "AL") { 52882 types[i] = "R"; 52883 } 52884 } 52885 52886 for (i = 1; i < strLength - 1; ++i) { 52887 if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") { 52888 types[i] = "EN"; 52889 } 52890 52891 if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) { 52892 types[i] = types[i - 1]; 52893 } 52894 } 52895 52896 for (i = 0; i < strLength; ++i) { 52897 if (types[i] === "EN") { 52898 for (let j = i - 1; j >= 0; --j) { 52899 if (types[j] !== "ET") { 52900 break; 52901 } 52902 52903 types[j] = "EN"; 52904 } 52905 52906 for (let j = i + 1; j < strLength; ++j) { 52907 if (types[j] !== "ET") { 52908 break; 52909 } 52910 52911 types[j] = "EN"; 52912 } 52913 } 52914 } 52915 52916 for (i = 0; i < strLength; ++i) { 52917 t = types[i]; 52918 52919 if (t === "WS" || t === "ES" || t === "ET" || t === "CS") { 52920 types[i] = "ON"; 52921 } 52922 } 52923 52924 lastType = sor; 52925 52926 for (i = 0; i < strLength; ++i) { 52927 t = types[i]; 52928 52929 if (t === "EN") { 52930 types[i] = lastType === "L" ? "L" : "EN"; 52931 } else if (t === "R" || t === "L") { 52932 lastType = t; 52933 } 52934 } 52935 52936 for (i = 0; i < strLength; ++i) { 52937 if (types[i] === "ON") { 52938 const end = findUnequal(types, i + 1, "ON"); 52939 let before = sor; 52940 52941 if (i > 0) { 52942 before = types[i - 1]; 52943 } 52944 52945 let after = eor; 52946 52947 if (end + 1 < strLength) { 52948 after = types[end + 1]; 52949 } 52950 52951 if (before !== "L") { 52952 before = "R"; 52953 } 52954 52955 if (after !== "L") { 52956 after = "R"; 52957 } 52958 52959 if (before === after) { 52960 setValues(types, i, end, before); 52961 } 52962 52963 i = end - 1; 52964 } 52965 } 52966 52967 for (i = 0; i < strLength; ++i) { 52968 if (types[i] === "ON") { 52969 types[i] = e; 52970 } 52971 } 52972 52973 for (i = 0; i < strLength; ++i) { 52974 t = types[i]; 52975 52976 if (isEven(levels[i])) { 52977 if (t === "R") { 52978 levels[i] += 1; 52979 } else if (t === "AN" || t === "EN") { 52980 levels[i] += 2; 52981 } 52982 } else { 52983 if (t === "L" || t === "AN" || t === "EN") { 52984 levels[i] += 1; 52985 } 52986 } 52987 } 52988 52989 let highestLevel = -1; 52990 let lowestOddLevel = 99; 52991 let level; 52992 52993 for (i = 0, ii = levels.length; i < ii; ++i) { 52994 level = levels[i]; 52995 52996 if (highestLevel < level) { 52997 highestLevel = level; 52998 } 52999 53000 if (lowestOddLevel > level && isOdd(level)) { 53001 lowestOddLevel = level; 53002 } 53003 } 53004 53005 for (level = highestLevel; level >= lowestOddLevel; --level) { 53006 let start = -1; 53007 53008 for (i = 0, ii = levels.length; i < ii; ++i) { 53009 if (levels[i] < level) { 53010 if (start >= 0) { 53011 reverseValues(chars, start, i); 53012 start = -1; 53013 } 53014 } else if (start < 0) { 53015 start = i; 53016 } 53017 } 53018 53019 if (start >= 0) { 53020 reverseValues(chars, start, levels.length); 53021 } 53022 } 53023 53024 for (i = 0, ii = chars.length; i < ii; ++i) { 53025 const ch = chars[i]; 53026 53027 if (ch === "<" || ch === ">") { 53028 chars[i] = ""; 53029 } 53030 } 53031 53032 return createBidiText(chars.join(""), isLTR); 53033} 53034 53035/***/ }), 53036/* 61 */ 53037/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 53038 53039 53040 53041Object.defineProperty(exports, "__esModule", ({ 53042 value: true 53043})); 53044exports.MurmurHash3_64 = void 0; 53045 53046var _util = __w_pdfjs_require__(2); 53047 53048const SEED = 0xc3d2e1f0; 53049const MASK_HIGH = 0xffff0000; 53050const MASK_LOW = 0xffff; 53051 53052class MurmurHash3_64 { 53053 constructor(seed) { 53054 this.h1 = seed ? seed & 0xffffffff : SEED; 53055 this.h2 = seed ? seed & 0xffffffff : SEED; 53056 } 53057 53058 update(input) { 53059 let data, length; 53060 53061 if (typeof input === "string") { 53062 data = new Uint8Array(input.length * 2); 53063 length = 0; 53064 53065 for (let i = 0, ii = input.length; i < ii; i++) { 53066 const code = input.charCodeAt(i); 53067 53068 if (code <= 0xff) { 53069 data[length++] = code; 53070 } else { 53071 data[length++] = code >>> 8; 53072 data[length++] = code & 0xff; 53073 } 53074 } 53075 } else if ((0, _util.isArrayBuffer)(input)) { 53076 data = input.slice(); 53077 length = data.byteLength; 53078 } else { 53079 throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array."); 53080 } 53081 53082 const blockCounts = length >> 2; 53083 const tailLength = length - blockCounts * 4; 53084 const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts); 53085 let k1 = 0, 53086 k2 = 0; 53087 let h1 = this.h1, 53088 h2 = this.h2; 53089 const C1 = 0xcc9e2d51, 53090 C2 = 0x1b873593; 53091 const C1_LOW = C1 & MASK_LOW, 53092 C2_LOW = C2 & MASK_LOW; 53093 53094 for (let i = 0; i < blockCounts; i++) { 53095 if (i & 1) { 53096 k1 = dataUint32[i]; 53097 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 53098 k1 = k1 << 15 | k1 >>> 17; 53099 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 53100 h1 ^= k1; 53101 h1 = h1 << 13 | h1 >>> 19; 53102 h1 = h1 * 5 + 0xe6546b64; 53103 } else { 53104 k2 = dataUint32[i]; 53105 k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW; 53106 k2 = k2 << 15 | k2 >>> 17; 53107 k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW; 53108 h2 ^= k2; 53109 h2 = h2 << 13 | h2 >>> 19; 53110 h2 = h2 * 5 + 0xe6546b64; 53111 } 53112 } 53113 53114 k1 = 0; 53115 53116 switch (tailLength) { 53117 case 3: 53118 k1 ^= data[blockCounts * 4 + 2] << 16; 53119 53120 case 2: 53121 k1 ^= data[blockCounts * 4 + 1] << 8; 53122 53123 case 1: 53124 k1 ^= data[blockCounts * 4]; 53125 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 53126 k1 = k1 << 15 | k1 >>> 17; 53127 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 53128 53129 if (blockCounts & 1) { 53130 h1 ^= k1; 53131 } else { 53132 h2 ^= k1; 53133 } 53134 53135 } 53136 53137 this.h1 = h1; 53138 this.h2 = h2; 53139 } 53140 53141 hexdigest() { 53142 let h1 = this.h1, 53143 h2 = this.h2; 53144 h1 ^= h2 >>> 1; 53145 h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW; 53146 h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16; 53147 h1 ^= h2 >>> 1; 53148 h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW; 53149 h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16; 53150 h1 ^= h2 >>> 1; 53151 const hex1 = (h1 >>> 0).toString(16), 53152 hex2 = (h2 >>> 0).toString(16); 53153 return hex1.padStart(8, "0") + hex2.padStart(8, "0"); 53154 } 53155 53156} 53157 53158exports.MurmurHash3_64 = MurmurHash3_64; 53159 53160/***/ }), 53161/* 62 */ 53162/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 53163 53164 53165 53166Object.defineProperty(exports, "__esModule", ({ 53167 value: true 53168})); 53169exports.OperatorList = void 0; 53170 53171var _util = __w_pdfjs_require__(2); 53172 53173function addState(parentState, pattern, checkFn, iterateFn, processFn) { 53174 let state = parentState; 53175 53176 for (let i = 0, ii = pattern.length - 1; i < ii; i++) { 53177 const item = pattern[i]; 53178 state = state[item] || (state[item] = []); 53179 } 53180 53181 state[pattern.at(-1)] = { 53182 checkFn, 53183 iterateFn, 53184 processFn 53185 }; 53186} 53187 53188const InitialState = []; 53189addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) { 53190 const fnArray = context.fnArray; 53191 const iFirstSave = context.iCurr - 3; 53192 const pos = (i - iFirstSave) % 4; 53193 53194 switch (pos) { 53195 case 0: 53196 return fnArray[i] === _util.OPS.save; 53197 53198 case 1: 53199 return fnArray[i] === _util.OPS.transform; 53200 53201 case 2: 53202 return fnArray[i] === _util.OPS.paintInlineImageXObject; 53203 53204 case 3: 53205 return fnArray[i] === _util.OPS.restore; 53206 } 53207 53208 throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`); 53209}, function foundInlineImageGroup(context, i) { 53210 const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10; 53211 const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200; 53212 const MAX_WIDTH = 1000; 53213 const IMAGE_PADDING = 1; 53214 const fnArray = context.fnArray, 53215 argsArray = context.argsArray; 53216 const curr = context.iCurr; 53217 const iFirstSave = curr - 3; 53218 const iFirstTransform = curr - 2; 53219 const iFirstPIIXO = curr - 1; 53220 const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK); 53221 53222 if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) { 53223 return i - (i - iFirstSave) % 4; 53224 } 53225 53226 let maxX = 0; 53227 const map = []; 53228 let maxLineHeight = 0; 53229 let currentX = IMAGE_PADDING, 53230 currentY = IMAGE_PADDING; 53231 53232 for (let q = 0; q < count; q++) { 53233 const transform = argsArray[iFirstTransform + (q << 2)]; 53234 const img = argsArray[iFirstPIIXO + (q << 2)][0]; 53235 53236 if (currentX + img.width > MAX_WIDTH) { 53237 maxX = Math.max(maxX, currentX); 53238 currentY += maxLineHeight + 2 * IMAGE_PADDING; 53239 currentX = 0; 53240 maxLineHeight = 0; 53241 } 53242 53243 map.push({ 53244 transform, 53245 x: currentX, 53246 y: currentY, 53247 w: img.width, 53248 h: img.height 53249 }); 53250 currentX += img.width + 2 * IMAGE_PADDING; 53251 maxLineHeight = Math.max(maxLineHeight, img.height); 53252 } 53253 53254 const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING; 53255 const imgHeight = currentY + maxLineHeight + IMAGE_PADDING; 53256 const imgData = new Uint8Array(imgWidth * imgHeight * 4); 53257 const imgRowSize = imgWidth << 2; 53258 53259 for (let q = 0; q < count; q++) { 53260 const data = argsArray[iFirstPIIXO + (q << 2)][0].data; 53261 const rowSize = map[q].w << 2; 53262 let dataOffset = 0; 53263 let offset = map[q].x + map[q].y * imgWidth << 2; 53264 imgData.set(data.subarray(0, rowSize), offset - imgRowSize); 53265 53266 for (let k = 0, kk = map[q].h; k < kk; k++) { 53267 imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset); 53268 dataOffset += rowSize; 53269 offset += imgRowSize; 53270 } 53271 53272 imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset); 53273 53274 while (offset >= 0) { 53275 data[offset - 4] = data[offset]; 53276 data[offset - 3] = data[offset + 1]; 53277 data[offset - 2] = data[offset + 2]; 53278 data[offset - 1] = data[offset + 3]; 53279 data[offset + rowSize] = data[offset + rowSize - 4]; 53280 data[offset + rowSize + 1] = data[offset + rowSize - 3]; 53281 data[offset + rowSize + 2] = data[offset + rowSize - 2]; 53282 data[offset + rowSize + 3] = data[offset + rowSize - 1]; 53283 offset -= imgRowSize; 53284 } 53285 } 53286 53287 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup); 53288 argsArray.splice(iFirstSave, count * 4, [{ 53289 width: imgWidth, 53290 height: imgHeight, 53291 kind: _util.ImageKind.RGBA_32BPP, 53292 data: imgData 53293 }, map]); 53294 return iFirstSave + 1; 53295}); 53296addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) { 53297 const fnArray = context.fnArray; 53298 const iFirstSave = context.iCurr - 3; 53299 const pos = (i - iFirstSave) % 4; 53300 53301 switch (pos) { 53302 case 0: 53303 return fnArray[i] === _util.OPS.save; 53304 53305 case 1: 53306 return fnArray[i] === _util.OPS.transform; 53307 53308 case 2: 53309 return fnArray[i] === _util.OPS.paintImageMaskXObject; 53310 53311 case 3: 53312 return fnArray[i] === _util.OPS.restore; 53313 } 53314 53315 throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`); 53316}, function foundImageMaskGroup(context, i) { 53317 const MIN_IMAGES_IN_MASKS_BLOCK = 10; 53318 const MAX_IMAGES_IN_MASKS_BLOCK = 100; 53319 const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000; 53320 const fnArray = context.fnArray, 53321 argsArray = context.argsArray; 53322 const curr = context.iCurr; 53323 const iFirstSave = curr - 3; 53324 const iFirstTransform = curr - 2; 53325 const iFirstPIMXO = curr - 1; 53326 let count = Math.floor((i - iFirstSave) / 4); 53327 53328 if (count < MIN_IMAGES_IN_MASKS_BLOCK) { 53329 return i - (i - iFirstSave) % 4; 53330 } 53331 53332 let isSameImage = false; 53333 let iTransform, transformArgs; 53334 const firstPIMXOArg0 = argsArray[iFirstPIMXO][0]; 53335 const firstTransformArg0 = argsArray[iFirstTransform][0], 53336 firstTransformArg1 = argsArray[iFirstTransform][1], 53337 firstTransformArg2 = argsArray[iFirstTransform][2], 53338 firstTransformArg3 = argsArray[iFirstTransform][3]; 53339 53340 if (firstTransformArg1 === firstTransformArg2) { 53341 isSameImage = true; 53342 iTransform = iFirstTransform + 4; 53343 let iPIMXO = iFirstPIMXO + 4; 53344 53345 for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) { 53346 transformArgs = argsArray[iTransform]; 53347 53348 if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) { 53349 if (q < MIN_IMAGES_IN_MASKS_BLOCK) { 53350 isSameImage = false; 53351 } else { 53352 count = q; 53353 } 53354 53355 break; 53356 } 53357 } 53358 } 53359 53360 if (isSameImage) { 53361 count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK); 53362 const positions = new Float32Array(count * 2); 53363 iTransform = iFirstTransform; 53364 53365 for (let q = 0; q < count; q++, iTransform += 4) { 53366 transformArgs = argsArray[iTransform]; 53367 positions[q << 1] = transformArgs[4]; 53368 positions[(q << 1) + 1] = transformArgs[5]; 53369 } 53370 53371 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat); 53372 argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]); 53373 } else { 53374 count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK); 53375 const images = []; 53376 53377 for (let q = 0; q < count; q++) { 53378 transformArgs = argsArray[iFirstTransform + (q << 2)]; 53379 const maskParams = argsArray[iFirstPIMXO + (q << 2)][0]; 53380 images.push({ 53381 data: maskParams.data, 53382 width: maskParams.width, 53383 height: maskParams.height, 53384 interpolate: maskParams.interpolate, 53385 count: maskParams.count, 53386 transform: transformArgs 53387 }); 53388 } 53389 53390 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup); 53391 argsArray.splice(iFirstSave, count * 4, [images]); 53392 } 53393 53394 return iFirstSave + 1; 53395}); 53396addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) { 53397 const argsArray = context.argsArray; 53398 const iFirstTransform = context.iCurr - 2; 53399 return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0; 53400}, function iterateImageGroup(context, i) { 53401 const fnArray = context.fnArray, 53402 argsArray = context.argsArray; 53403 const iFirstSave = context.iCurr - 3; 53404 const pos = (i - iFirstSave) % 4; 53405 53406 switch (pos) { 53407 case 0: 53408 return fnArray[i] === _util.OPS.save; 53409 53410 case 1: 53411 if (fnArray[i] !== _util.OPS.transform) { 53412 return false; 53413 } 53414 53415 const iFirstTransform = context.iCurr - 2; 53416 const firstTransformArg0 = argsArray[iFirstTransform][0]; 53417 const firstTransformArg3 = argsArray[iFirstTransform][3]; 53418 53419 if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) { 53420 return false; 53421 } 53422 53423 return true; 53424 53425 case 2: 53426 if (fnArray[i] !== _util.OPS.paintImageXObject) { 53427 return false; 53428 } 53429 53430 const iFirstPIXO = context.iCurr - 1; 53431 const firstPIXOArg0 = argsArray[iFirstPIXO][0]; 53432 53433 if (argsArray[i][0] !== firstPIXOArg0) { 53434 return false; 53435 } 53436 53437 return true; 53438 53439 case 3: 53440 return fnArray[i] === _util.OPS.restore; 53441 } 53442 53443 throw new Error(`iterateImageGroup - invalid pos: ${pos}`); 53444}, function (context, i) { 53445 const MIN_IMAGES_IN_BLOCK = 3; 53446 const MAX_IMAGES_IN_BLOCK = 1000; 53447 const fnArray = context.fnArray, 53448 argsArray = context.argsArray; 53449 const curr = context.iCurr; 53450 const iFirstSave = curr - 3; 53451 const iFirstTransform = curr - 2; 53452 const iFirstPIXO = curr - 1; 53453 const firstPIXOArg0 = argsArray[iFirstPIXO][0]; 53454 const firstTransformArg0 = argsArray[iFirstTransform][0]; 53455 const firstTransformArg3 = argsArray[iFirstTransform][3]; 53456 const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK); 53457 53458 if (count < MIN_IMAGES_IN_BLOCK) { 53459 return i - (i - iFirstSave) % 4; 53460 } 53461 53462 const positions = new Float32Array(count * 2); 53463 let iTransform = iFirstTransform; 53464 53465 for (let q = 0; q < count; q++, iTransform += 4) { 53466 const transformArgs = argsArray[iTransform]; 53467 positions[q << 1] = transformArgs[4]; 53468 positions[(q << 1) + 1] = transformArgs[5]; 53469 } 53470 53471 const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions]; 53472 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat); 53473 argsArray.splice(iFirstSave, count * 4, args); 53474 return iFirstSave + 1; 53475}); 53476addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) { 53477 const fnArray = context.fnArray, 53478 argsArray = context.argsArray; 53479 const iFirstSave = context.iCurr - 4; 53480 const pos = (i - iFirstSave) % 5; 53481 53482 switch (pos) { 53483 case 0: 53484 return fnArray[i] === _util.OPS.beginText; 53485 53486 case 1: 53487 return fnArray[i] === _util.OPS.setFont; 53488 53489 case 2: 53490 return fnArray[i] === _util.OPS.setTextMatrix; 53491 53492 case 3: 53493 if (fnArray[i] !== _util.OPS.showText) { 53494 return false; 53495 } 53496 53497 const iFirstSetFont = context.iCurr - 3; 53498 const firstSetFontArg0 = argsArray[iFirstSetFont][0]; 53499 const firstSetFontArg1 = argsArray[iFirstSetFont][1]; 53500 53501 if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) { 53502 return false; 53503 } 53504 53505 return true; 53506 53507 case 4: 53508 return fnArray[i] === _util.OPS.endText; 53509 } 53510 53511 throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`); 53512}, function (context, i) { 53513 const MIN_CHARS_IN_BLOCK = 3; 53514 const MAX_CHARS_IN_BLOCK = 1000; 53515 const fnArray = context.fnArray, 53516 argsArray = context.argsArray; 53517 const curr = context.iCurr; 53518 const iFirstBeginText = curr - 4; 53519 const iFirstSetFont = curr - 3; 53520 const iFirstSetTextMatrix = curr - 2; 53521 const iFirstShowText = curr - 1; 53522 const iFirstEndText = curr; 53523 const firstSetFontArg0 = argsArray[iFirstSetFont][0]; 53524 const firstSetFontArg1 = argsArray[iFirstSetFont][1]; 53525 let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK); 53526 53527 if (count < MIN_CHARS_IN_BLOCK) { 53528 return i - (i - iFirstBeginText) % 5; 53529 } 53530 53531 let iFirst = iFirstBeginText; 53532 53533 if (iFirstBeginText >= 4 && fnArray[iFirstBeginText - 4] === fnArray[iFirstSetFont] && fnArray[iFirstBeginText - 3] === fnArray[iFirstSetTextMatrix] && fnArray[iFirstBeginText - 2] === fnArray[iFirstShowText] && fnArray[iFirstBeginText - 1] === fnArray[iFirstEndText] && argsArray[iFirstBeginText - 4][0] === firstSetFontArg0 && argsArray[iFirstBeginText - 4][1] === firstSetFontArg1) { 53534 count++; 53535 iFirst -= 5; 53536 } 53537 53538 let iEndText = iFirst + 4; 53539 53540 for (let q = 1; q < count; q++) { 53541 fnArray.splice(iEndText, 3); 53542 argsArray.splice(iEndText, 3); 53543 iEndText += 2; 53544 } 53545 53546 return iEndText + 1; 53547}); 53548 53549class NullOptimizer { 53550 constructor(queue) { 53551 this.queue = queue; 53552 } 53553 53554 _optimize() {} 53555 53556 push(fn, args) { 53557 this.queue.fnArray.push(fn); 53558 this.queue.argsArray.push(args); 53559 53560 this._optimize(); 53561 } 53562 53563 flush() {} 53564 53565 reset() {} 53566 53567} 53568 53569class QueueOptimizer extends NullOptimizer { 53570 constructor(queue) { 53571 super(queue); 53572 this.state = null; 53573 this.context = { 53574 iCurr: 0, 53575 fnArray: queue.fnArray, 53576 argsArray: queue.argsArray 53577 }; 53578 this.match = null; 53579 this.lastProcessed = 0; 53580 } 53581 53582 _optimize() { 53583 const fnArray = this.queue.fnArray; 53584 let i = this.lastProcessed, 53585 ii = fnArray.length; 53586 let state = this.state; 53587 let match = this.match; 53588 53589 if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) { 53590 this.lastProcessed = ii; 53591 return; 53592 } 53593 53594 const context = this.context; 53595 53596 while (i < ii) { 53597 if (match) { 53598 const iterate = (0, match.iterateFn)(context, i); 53599 53600 if (iterate) { 53601 i++; 53602 continue; 53603 } 53604 53605 i = (0, match.processFn)(context, i + 1); 53606 ii = fnArray.length; 53607 match = null; 53608 state = null; 53609 53610 if (i >= ii) { 53611 break; 53612 } 53613 } 53614 53615 state = (state || InitialState)[fnArray[i]]; 53616 53617 if (!state || Array.isArray(state)) { 53618 i++; 53619 continue; 53620 } 53621 53622 context.iCurr = i; 53623 i++; 53624 53625 if (state.checkFn && !(0, state.checkFn)(context)) { 53626 state = null; 53627 continue; 53628 } 53629 53630 match = state; 53631 state = null; 53632 } 53633 53634 this.state = state; 53635 this.match = match; 53636 this.lastProcessed = i; 53637 } 53638 53639 flush() { 53640 while (this.match) { 53641 const length = this.queue.fnArray.length; 53642 this.lastProcessed = (0, this.match.processFn)(this.context, length); 53643 this.match = null; 53644 this.state = null; 53645 53646 this._optimize(); 53647 } 53648 } 53649 53650 reset() { 53651 this.state = null; 53652 this.match = null; 53653 this.lastProcessed = 0; 53654 } 53655 53656} 53657 53658class OperatorList { 53659 static get CHUNK_SIZE() { 53660 return (0, _util.shadow)(this, "CHUNK_SIZE", 1000); 53661 } 53662 53663 static get CHUNK_SIZE_ABOUT() { 53664 return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5); 53665 } 53666 53667 constructor(intent = 0, streamSink) { 53668 this._streamSink = streamSink; 53669 this.fnArray = []; 53670 this.argsArray = []; 53671 53672 if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) { 53673 this.optimizer = new QueueOptimizer(this); 53674 } else { 53675 this.optimizer = new NullOptimizer(this); 53676 } 53677 53678 this.dependencies = new Set(); 53679 this._totalLength = 0; 53680 this.weight = 0; 53681 this._resolved = streamSink ? null : Promise.resolve(); 53682 } 53683 53684 get length() { 53685 return this.argsArray.length; 53686 } 53687 53688 get ready() { 53689 return this._resolved || this._streamSink.ready; 53690 } 53691 53692 get totalLength() { 53693 return this._totalLength + this.length; 53694 } 53695 53696 addOp(fn, args) { 53697 this.optimizer.push(fn, args); 53698 this.weight++; 53699 53700 if (this._streamSink) { 53701 if (this.weight >= OperatorList.CHUNK_SIZE) { 53702 this.flush(); 53703 } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) { 53704 this.flush(); 53705 } 53706 } 53707 } 53708 53709 addImageOps(fn, args, optionalContent) { 53710 if (optionalContent !== undefined) { 53711 this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]); 53712 } 53713 53714 this.addOp(fn, args); 53715 53716 if (optionalContent !== undefined) { 53717 this.addOp(_util.OPS.endMarkedContent, []); 53718 } 53719 } 53720 53721 addDependency(dependency) { 53722 if (this.dependencies.has(dependency)) { 53723 return; 53724 } 53725 53726 this.dependencies.add(dependency); 53727 this.addOp(_util.OPS.dependency, [dependency]); 53728 } 53729 53730 addDependencies(dependencies) { 53731 for (const dependency of dependencies) { 53732 this.addDependency(dependency); 53733 } 53734 } 53735 53736 addOpList(opList) { 53737 if (!(opList instanceof OperatorList)) { 53738 (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.'); 53739 return; 53740 } 53741 53742 for (const dependency of opList.dependencies) { 53743 this.dependencies.add(dependency); 53744 } 53745 53746 for (let i = 0, ii = opList.length; i < ii; i++) { 53747 this.addOp(opList.fnArray[i], opList.argsArray[i]); 53748 } 53749 } 53750 53751 getIR() { 53752 return { 53753 fnArray: this.fnArray, 53754 argsArray: this.argsArray, 53755 length: this.length 53756 }; 53757 } 53758 53759 get _transfers() { 53760 const transfers = []; 53761 const { 53762 fnArray, 53763 argsArray, 53764 length 53765 } = this; 53766 53767 for (let i = 0; i < length; i++) { 53768 switch (fnArray[i]) { 53769 case _util.OPS.paintInlineImageXObject: 53770 case _util.OPS.paintInlineImageXObjectGroup: 53771 case _util.OPS.paintImageMaskXObject: 53772 const arg = argsArray[i][0]; 53773 53774 if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) { 53775 transfers.push(arg.data.buffer); 53776 } 53777 53778 break; 53779 } 53780 } 53781 53782 return transfers; 53783 } 53784 53785 flush(lastChunk = false, separateAnnots = null) { 53786 this.optimizer.flush(); 53787 const length = this.length; 53788 this._totalLength += length; 53789 53790 this._streamSink.enqueue({ 53791 fnArray: this.fnArray, 53792 argsArray: this.argsArray, 53793 lastChunk, 53794 separateAnnots, 53795 length 53796 }, 1, this._transfers); 53797 53798 this.dependencies.clear(); 53799 this.fnArray.length = 0; 53800 this.argsArray.length = 0; 53801 this.weight = 0; 53802 this.optimizer.reset(); 53803 } 53804 53805} 53806 53807exports.OperatorList = OperatorList; 53808 53809/***/ }), 53810/* 63 */ 53811/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 53812 53813 53814 53815Object.defineProperty(exports, "__esModule", ({ 53816 value: true 53817})); 53818exports.PDFImage = void 0; 53819 53820var _util = __w_pdfjs_require__(2); 53821 53822var _image_utils = __w_pdfjs_require__(64); 53823 53824var _base_stream = __w_pdfjs_require__(7); 53825 53826var _colorspace = __w_pdfjs_require__(14); 53827 53828var _decode_stream = __w_pdfjs_require__(19); 53829 53830var _jpeg_stream = __w_pdfjs_require__(27); 53831 53832var _jpx = __w_pdfjs_require__(30); 53833 53834var _primitives = __w_pdfjs_require__(5); 53835 53836function decodeAndClamp(value, addend, coefficient, max) { 53837 value = addend + value * coefficient; 53838 53839 if (value < 0) { 53840 value = 0; 53841 } else if (value > max) { 53842 value = max; 53843 } 53844 53845 return value; 53846} 53847 53848function resizeImageMask(src, bpc, w1, h1, w2, h2) { 53849 const length = w2 * h2; 53850 let dest; 53851 53852 if (bpc <= 8) { 53853 dest = new Uint8Array(length); 53854 } else if (bpc <= 16) { 53855 dest = new Uint16Array(length); 53856 } else { 53857 dest = new Uint32Array(length); 53858 } 53859 53860 const xRatio = w1 / w2; 53861 const yRatio = h1 / h2; 53862 let i, 53863 j, 53864 py, 53865 newIndex = 0, 53866 oldIndex; 53867 const xScaled = new Uint16Array(w2); 53868 const w1Scanline = w1; 53869 53870 for (i = 0; i < w2; i++) { 53871 xScaled[i] = Math.floor(i * xRatio); 53872 } 53873 53874 for (i = 0; i < h2; i++) { 53875 py = Math.floor(i * yRatio) * w1Scanline; 53876 53877 for (j = 0; j < w2; j++) { 53878 oldIndex = py + xScaled[j]; 53879 dest[newIndex++] = src[oldIndex]; 53880 } 53881 } 53882 53883 return dest; 53884} 53885 53886class PDFImage { 53887 constructor({ 53888 xref, 53889 res, 53890 image, 53891 isInline = false, 53892 smask = null, 53893 mask = null, 53894 isMask = false, 53895 pdfFunctionFactory, 53896 localColorSpaceCache 53897 }) { 53898 this.image = image; 53899 const dict = image.dict; 53900 const filter = dict.get("F", "Filter"); 53901 let filterName; 53902 53903 if (filter instanceof _primitives.Name) { 53904 filterName = filter.name; 53905 } else if (Array.isArray(filter)) { 53906 const filterZero = xref.fetchIfRef(filter[0]); 53907 53908 if (filterZero instanceof _primitives.Name) { 53909 filterName = filterZero.name; 53910 } 53911 } 53912 53913 switch (filterName) { 53914 case "JPXDecode": 53915 const jpxImage = new _jpx.JpxImage(); 53916 jpxImage.parseImageProperties(image.stream); 53917 image.stream.reset(); 53918 image.width = jpxImage.width; 53919 image.height = jpxImage.height; 53920 image.bitsPerComponent = jpxImage.bitsPerComponent; 53921 image.numComps = jpxImage.componentsCount; 53922 break; 53923 53924 case "JBIG2Decode": 53925 image.bitsPerComponent = 1; 53926 image.numComps = 1; 53927 break; 53928 } 53929 53930 let width = dict.get("W", "Width"); 53931 let height = dict.get("H", "Height"); 53932 53933 if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) { 53934 (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary."); 53935 width = image.width; 53936 height = image.height; 53937 } 53938 53939 if (width < 1 || height < 1) { 53940 throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`); 53941 } 53942 53943 this.width = width; 53944 this.height = height; 53945 this.interpolate = dict.get("I", "Interpolate"); 53946 this.imageMask = dict.get("IM", "ImageMask") || false; 53947 this.matte = dict.get("Matte") || false; 53948 let bitsPerComponent = image.bitsPerComponent; 53949 53950 if (!bitsPerComponent) { 53951 bitsPerComponent = dict.get("BPC", "BitsPerComponent"); 53952 53953 if (!bitsPerComponent) { 53954 if (this.imageMask) { 53955 bitsPerComponent = 1; 53956 } else { 53957 throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`); 53958 } 53959 } 53960 } 53961 53962 this.bpc = bitsPerComponent; 53963 53964 if (!this.imageMask) { 53965 let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace"); 53966 53967 if (!colorSpace) { 53968 (0, _util.info)("JPX images (which do not require color spaces)"); 53969 53970 switch (image.numComps) { 53971 case 1: 53972 colorSpace = _primitives.Name.get("DeviceGray"); 53973 break; 53974 53975 case 3: 53976 colorSpace = _primitives.Name.get("DeviceRGB"); 53977 break; 53978 53979 case 4: 53980 colorSpace = _primitives.Name.get("DeviceCMYK"); 53981 break; 53982 53983 default: 53984 throw new Error(`JPX images with ${image.numComps} color components not supported.`); 53985 } 53986 } 53987 53988 this.colorSpace = _colorspace.ColorSpace.parse({ 53989 cs: colorSpace, 53990 xref, 53991 resources: isInline ? res : null, 53992 pdfFunctionFactory, 53993 localColorSpaceCache 53994 }); 53995 this.numComps = this.colorSpace.numComps; 53996 } 53997 53998 this.decode = dict.getArray("D", "Decode"); 53999 this.needsDecode = false; 54000 54001 if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) { 54002 this.needsDecode = true; 54003 const max = (1 << bitsPerComponent) - 1; 54004 this.decodeCoefficients = []; 54005 this.decodeAddends = []; 54006 const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed"; 54007 54008 for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) { 54009 const dmin = this.decode[i]; 54010 const dmax = this.decode[i + 1]; 54011 this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin; 54012 this.decodeAddends[j] = isIndexed ? dmin : max * dmin; 54013 } 54014 } 54015 54016 if (smask) { 54017 this.smask = new PDFImage({ 54018 xref, 54019 res, 54020 image: smask, 54021 isInline, 54022 pdfFunctionFactory, 54023 localColorSpaceCache 54024 }); 54025 } else if (mask) { 54026 if (mask instanceof _base_stream.BaseStream) { 54027 const maskDict = mask.dict, 54028 imageMask = maskDict.get("IM", "ImageMask"); 54029 54030 if (!imageMask) { 54031 (0, _util.warn)("Ignoring /Mask in image without /ImageMask."); 54032 } else { 54033 this.mask = new PDFImage({ 54034 xref, 54035 res, 54036 image: mask, 54037 isInline, 54038 isMask: true, 54039 pdfFunctionFactory, 54040 localColorSpaceCache 54041 }); 54042 } 54043 } else { 54044 this.mask = mask; 54045 } 54046 } 54047 } 54048 54049 static async buildImage({ 54050 xref, 54051 res, 54052 image, 54053 isInline = false, 54054 pdfFunctionFactory, 54055 localColorSpaceCache 54056 }) { 54057 const imageData = image; 54058 let smaskData = null; 54059 let maskData = null; 54060 const smask = image.dict.get("SMask"); 54061 const mask = image.dict.get("Mask"); 54062 54063 if (smask) { 54064 if (smask instanceof _base_stream.BaseStream) { 54065 smaskData = smask; 54066 } else { 54067 (0, _util.warn)("Unsupported /SMask format."); 54068 } 54069 } else if (mask) { 54070 if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) { 54071 maskData = mask; 54072 } else { 54073 (0, _util.warn)("Unsupported /Mask format."); 54074 } 54075 } 54076 54077 return new PDFImage({ 54078 xref, 54079 res, 54080 image: imageData, 54081 isInline, 54082 smask: smaskData, 54083 mask: maskData, 54084 pdfFunctionFactory, 54085 localColorSpaceCache 54086 }); 54087 } 54088 54089 static createRawMask({ 54090 imgArray, 54091 width, 54092 height, 54093 imageIsFromDecodeStream, 54094 inverseDecode, 54095 interpolate 54096 }) { 54097 const computedLength = (width + 7 >> 3) * height; 54098 const actualLength = imgArray.byteLength; 54099 const haveFullData = computedLength === actualLength; 54100 let data, i; 54101 54102 if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) { 54103 data = imgArray; 54104 } else if (!inverseDecode) { 54105 data = new Uint8Array(imgArray); 54106 } else { 54107 data = new Uint8Array(computedLength); 54108 data.set(imgArray); 54109 data.fill(0xff, actualLength); 54110 } 54111 54112 if (inverseDecode) { 54113 for (i = 0; i < actualLength; i++) { 54114 data[i] ^= 0xff; 54115 } 54116 } 54117 54118 return { 54119 data, 54120 width, 54121 height, 54122 interpolate 54123 }; 54124 } 54125 54126 static createMask({ 54127 imgArray, 54128 width, 54129 height, 54130 imageIsFromDecodeStream, 54131 inverseDecode, 54132 interpolate 54133 }) { 54134 const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128)); 54135 54136 if (isSingleOpaquePixel) { 54137 return { 54138 isSingleOpaquePixel 54139 }; 54140 } 54141 54142 if (_util.FeatureTest.isOffscreenCanvasSupported) { 54143 const canvas = new OffscreenCanvas(width, height); 54144 const ctx = canvas.getContext("2d"); 54145 const imgData = ctx.createImageData(width, height); 54146 (0, _image_utils.applyMaskImageData)({ 54147 src: imgArray, 54148 dest: imgData.data, 54149 width, 54150 height, 54151 inverseDecode 54152 }); 54153 ctx.putImageData(imgData, 0, 0); 54154 const bitmap = canvas.transferToImageBitmap(); 54155 return { 54156 data: null, 54157 width, 54158 height, 54159 interpolate, 54160 bitmap 54161 }; 54162 } 54163 54164 return this.createRawMask({ 54165 imgArray, 54166 width, 54167 height, 54168 inverseDecode, 54169 imageIsFromDecodeStream, 54170 interpolate 54171 }); 54172 } 54173 54174 get drawWidth() { 54175 return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0); 54176 } 54177 54178 get drawHeight() { 54179 return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0); 54180 } 54181 54182 decodeBuffer(buffer) { 54183 const bpc = this.bpc; 54184 const numComps = this.numComps; 54185 const decodeAddends = this.decodeAddends; 54186 const decodeCoefficients = this.decodeCoefficients; 54187 const max = (1 << bpc) - 1; 54188 let i, ii; 54189 54190 if (bpc === 1) { 54191 for (i = 0, ii = buffer.length; i < ii; i++) { 54192 buffer[i] = +!buffer[i]; 54193 } 54194 54195 return; 54196 } 54197 54198 let index = 0; 54199 54200 for (i = 0, ii = this.width * this.height; i < ii; i++) { 54201 for (let j = 0; j < numComps; j++) { 54202 buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max); 54203 index++; 54204 } 54205 } 54206 } 54207 54208 getComponents(buffer) { 54209 const bpc = this.bpc; 54210 54211 if (bpc === 8) { 54212 return buffer; 54213 } 54214 54215 const width = this.width; 54216 const height = this.height; 54217 const numComps = this.numComps; 54218 const length = width * height * numComps; 54219 let bufferPos = 0; 54220 let output; 54221 54222 if (bpc <= 8) { 54223 output = new Uint8Array(length); 54224 } else if (bpc <= 16) { 54225 output = new Uint16Array(length); 54226 } else { 54227 output = new Uint32Array(length); 54228 } 54229 54230 const rowComps = width * numComps; 54231 const max = (1 << bpc) - 1; 54232 let i = 0, 54233 ii, 54234 buf; 54235 54236 if (bpc === 1) { 54237 let mask, loop1End, loop2End; 54238 54239 for (let j = 0; j < height; j++) { 54240 loop1End = i + (rowComps & ~7); 54241 loop2End = i + rowComps; 54242 54243 while (i < loop1End) { 54244 buf = buffer[bufferPos++]; 54245 output[i] = buf >> 7 & 1; 54246 output[i + 1] = buf >> 6 & 1; 54247 output[i + 2] = buf >> 5 & 1; 54248 output[i + 3] = buf >> 4 & 1; 54249 output[i + 4] = buf >> 3 & 1; 54250 output[i + 5] = buf >> 2 & 1; 54251 output[i + 6] = buf >> 1 & 1; 54252 output[i + 7] = buf & 1; 54253 i += 8; 54254 } 54255 54256 if (i < loop2End) { 54257 buf = buffer[bufferPos++]; 54258 mask = 128; 54259 54260 while (i < loop2End) { 54261 output[i++] = +!!(buf & mask); 54262 mask >>= 1; 54263 } 54264 } 54265 } 54266 } else { 54267 let bits = 0; 54268 buf = 0; 54269 54270 for (i = 0, ii = length; i < ii; ++i) { 54271 if (i % rowComps === 0) { 54272 buf = 0; 54273 bits = 0; 54274 } 54275 54276 while (bits < bpc) { 54277 buf = buf << 8 | buffer[bufferPos++]; 54278 bits += 8; 54279 } 54280 54281 const remainingBits = bits - bpc; 54282 let value = buf >> remainingBits; 54283 54284 if (value < 0) { 54285 value = 0; 54286 } else if (value > max) { 54287 value = max; 54288 } 54289 54290 output[i] = value; 54291 buf &= (1 << remainingBits) - 1; 54292 bits = remainingBits; 54293 } 54294 } 54295 54296 return output; 54297 } 54298 54299 fillOpacity(rgbaBuf, width, height, actualHeight, image) { 54300 const smask = this.smask; 54301 const mask = this.mask; 54302 let alphaBuf, sw, sh, i, ii, j; 54303 54304 if (smask) { 54305 sw = smask.width; 54306 sh = smask.height; 54307 alphaBuf = new Uint8ClampedArray(sw * sh); 54308 smask.fillGrayBuffer(alphaBuf); 54309 54310 if (sw !== width || sh !== height) { 54311 alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height); 54312 } 54313 } else if (mask) { 54314 if (mask instanceof PDFImage) { 54315 sw = mask.width; 54316 sh = mask.height; 54317 alphaBuf = new Uint8ClampedArray(sw * sh); 54318 mask.numComps = 1; 54319 mask.fillGrayBuffer(alphaBuf); 54320 54321 for (i = 0, ii = sw * sh; i < ii; ++i) { 54322 alphaBuf[i] = 255 - alphaBuf[i]; 54323 } 54324 54325 if (sw !== width || sh !== height) { 54326 alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height); 54327 } 54328 } else if (Array.isArray(mask)) { 54329 alphaBuf = new Uint8ClampedArray(width * height); 54330 const numComps = this.numComps; 54331 54332 for (i = 0, ii = width * height; i < ii; ++i) { 54333 let opacity = 0; 54334 const imageOffset = i * numComps; 54335 54336 for (j = 0; j < numComps; ++j) { 54337 const color = image[imageOffset + j]; 54338 const maskOffset = j * 2; 54339 54340 if (color < mask[maskOffset] || color > mask[maskOffset + 1]) { 54341 opacity = 255; 54342 break; 54343 } 54344 } 54345 54346 alphaBuf[i] = opacity; 54347 } 54348 } else { 54349 throw new _util.FormatError("Unknown mask format."); 54350 } 54351 } 54352 54353 if (alphaBuf) { 54354 for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { 54355 rgbaBuf[j] = alphaBuf[i]; 54356 } 54357 } else { 54358 for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { 54359 rgbaBuf[j] = 255; 54360 } 54361 } 54362 } 54363 54364 undoPreblend(buffer, width, height) { 54365 const matte = this.smask && this.smask.matte; 54366 54367 if (!matte) { 54368 return; 54369 } 54370 54371 const matteRgb = this.colorSpace.getRgb(matte, 0); 54372 const matteR = matteRgb[0]; 54373 const matteG = matteRgb[1]; 54374 const matteB = matteRgb[2]; 54375 const length = width * height * 4; 54376 54377 for (let i = 0; i < length; i += 4) { 54378 const alpha = buffer[i + 3]; 54379 54380 if (alpha === 0) { 54381 buffer[i] = 255; 54382 buffer[i + 1] = 255; 54383 buffer[i + 2] = 255; 54384 continue; 54385 } 54386 54387 const k = 255 / alpha; 54388 buffer[i] = (buffer[i] - matteR) * k + matteR; 54389 buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG; 54390 buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB; 54391 } 54392 } 54393 54394 createImageData(forceRGBA = false) { 54395 const drawWidth = this.drawWidth; 54396 const drawHeight = this.drawHeight; 54397 const imgData = { 54398 width: drawWidth, 54399 height: drawHeight, 54400 interpolate: this.interpolate, 54401 kind: 0, 54402 data: null 54403 }; 54404 const numComps = this.numComps; 54405 const originalWidth = this.width; 54406 const originalHeight = this.height; 54407 const bpc = this.bpc; 54408 const rowBytes = originalWidth * numComps * bpc + 7 >> 3; 54409 54410 if (!forceRGBA) { 54411 let kind; 54412 54413 if (this.colorSpace.name === "DeviceGray" && bpc === 1) { 54414 kind = _util.ImageKind.GRAYSCALE_1BPP; 54415 } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) { 54416 kind = _util.ImageKind.RGB_24BPP; 54417 } 54418 54419 if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) { 54420 imgData.kind = kind; 54421 imgData.data = this.getImageBytes(originalHeight * rowBytes, {}); 54422 54423 if (this.needsDecode) { 54424 (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale."); 54425 const buffer = imgData.data; 54426 54427 for (let i = 0, ii = buffer.length; i < ii; i++) { 54428 buffer[i] ^= 0xff; 54429 } 54430 } 54431 54432 return imgData; 54433 } 54434 54435 if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) { 54436 let imageLength = originalHeight * rowBytes; 54437 54438 switch (this.colorSpace.name) { 54439 case "DeviceGray": 54440 imageLength *= 3; 54441 54442 case "DeviceRGB": 54443 case "DeviceCMYK": 54444 imgData.kind = _util.ImageKind.RGB_24BPP; 54445 imgData.data = this.getImageBytes(imageLength, { 54446 drawWidth, 54447 drawHeight, 54448 forceRGB: true 54449 }); 54450 return imgData; 54451 } 54452 } 54453 } 54454 54455 const imgArray = this.getImageBytes(originalHeight * rowBytes, { 54456 internal: true 54457 }); 54458 const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight; 54459 const comps = this.getComponents(imgArray); 54460 let alpha01, maybeUndoPreblend; 54461 54462 if (!forceRGBA && !this.smask && !this.mask) { 54463 imgData.kind = _util.ImageKind.RGB_24BPP; 54464 imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3); 54465 alpha01 = 0; 54466 maybeUndoPreblend = false; 54467 } else { 54468 imgData.kind = _util.ImageKind.RGBA_32BPP; 54469 imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4); 54470 alpha01 = 1; 54471 maybeUndoPreblend = true; 54472 this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps); 54473 } 54474 54475 if (this.needsDecode) { 54476 this.decodeBuffer(comps); 54477 } 54478 54479 this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01); 54480 54481 if (maybeUndoPreblend) { 54482 this.undoPreblend(imgData.data, drawWidth, actualHeight); 54483 } 54484 54485 return imgData; 54486 } 54487 54488 fillGrayBuffer(buffer) { 54489 const numComps = this.numComps; 54490 54491 if (numComps !== 1) { 54492 throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`); 54493 } 54494 54495 const width = this.width; 54496 const height = this.height; 54497 const bpc = this.bpc; 54498 const rowBytes = width * numComps * bpc + 7 >> 3; 54499 const imgArray = this.getImageBytes(height * rowBytes, { 54500 internal: true 54501 }); 54502 const comps = this.getComponents(imgArray); 54503 let i, length; 54504 54505 if (bpc === 1) { 54506 length = width * height; 54507 54508 if (this.needsDecode) { 54509 for (i = 0; i < length; ++i) { 54510 buffer[i] = comps[i] - 1 & 255; 54511 } 54512 } else { 54513 for (i = 0; i < length; ++i) { 54514 buffer[i] = -comps[i] & 255; 54515 } 54516 } 54517 54518 return; 54519 } 54520 54521 if (this.needsDecode) { 54522 this.decodeBuffer(comps); 54523 } 54524 54525 length = width * height; 54526 const scale = 255 / ((1 << bpc) - 1); 54527 54528 for (i = 0; i < length; ++i) { 54529 buffer[i] = scale * comps[i]; 54530 } 54531 } 54532 54533 getImageBytes(length, { 54534 drawWidth, 54535 drawHeight, 54536 forceRGB = false, 54537 internal = false 54538 }) { 54539 this.image.reset(); 54540 this.image.drawWidth = drawWidth || this.width; 54541 this.image.drawHeight = drawHeight || this.height; 54542 this.image.forceRGB = !!forceRGB; 54543 const imageBytes = this.image.getBytes(length); 54544 54545 if (internal || this.image instanceof _decode_stream.DecodeStream) { 54546 return imageBytes; 54547 } 54548 54549 (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.'); 54550 return new Uint8Array(imageBytes); 54551 } 54552 54553} 54554 54555exports.PDFImage = PDFImage; 54556 54557/***/ }), 54558/* 64 */ 54559/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 54560 54561 54562 54563Object.defineProperty(exports, "__esModule", ({ 54564 value: true 54565})); 54566exports.applyMaskImageData = applyMaskImageData; 54567 54568var _util = __w_pdfjs_require__(2); 54569 54570function applyMaskImageData({ 54571 src, 54572 srcPos = 0, 54573 dest, 54574 destPos = 0, 54575 width, 54576 height, 54577 inverseDecode = false 54578}) { 54579 const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff; 54580 const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque]; 54581 const widthInSource = width >> 3; 54582 const widthRemainder = width & 7; 54583 const srcLength = src.length; 54584 dest = new Uint32Array(dest.buffer); 54585 54586 for (let i = 0; i < height; i++) { 54587 for (const max = srcPos + widthInSource; srcPos < max; srcPos++) { 54588 const elem = srcPos < srcLength ? src[srcPos] : 255; 54589 dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping; 54590 dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping; 54591 dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping; 54592 dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping; 54593 dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping; 54594 dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping; 54595 dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping; 54596 dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping; 54597 } 54598 54599 if (widthRemainder === 0) { 54600 continue; 54601 } 54602 54603 const elem = srcPos < srcLength ? src[srcPos++] : 255; 54604 54605 for (let j = 0; j < widthRemainder; j++) { 54606 dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping; 54607 } 54608 } 54609 54610 return { 54611 srcPos, 54612 destPos 54613 }; 54614} 54615 54616/***/ }), 54617/* 65 */ 54618/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 54619 54620 54621 54622Object.defineProperty(exports, "__esModule", ({ 54623 value: true 54624})); 54625exports.incrementalUpdate = incrementalUpdate; 54626exports.writeDict = writeDict; 54627exports.writeObject = writeObject; 54628 54629var _util = __w_pdfjs_require__(2); 54630 54631var _primitives = __w_pdfjs_require__(5); 54632 54633var _core_utils = __w_pdfjs_require__(6); 54634 54635var _xml_parser = __w_pdfjs_require__(66); 54636 54637var _base_stream = __w_pdfjs_require__(7); 54638 54639var _crypto = __w_pdfjs_require__(67); 54640 54641function writeObject(ref, obj, buffer, transform) { 54642 buffer.push(`${ref.num} ${ref.gen} obj\n`); 54643 54644 if (obj instanceof _primitives.Dict) { 54645 writeDict(obj, buffer, transform); 54646 } else if (obj instanceof _base_stream.BaseStream) { 54647 writeStream(obj, buffer, transform); 54648 } 54649 54650 buffer.push("\nendobj\n"); 54651} 54652 54653function writeDict(dict, buffer, transform) { 54654 buffer.push("<<"); 54655 54656 for (const key of dict.getKeys()) { 54657 buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `); 54658 writeValue(dict.getRaw(key), buffer, transform); 54659 } 54660 54661 buffer.push(">>"); 54662} 54663 54664function writeStream(stream, buffer, transform) { 54665 writeDict(stream.dict, buffer, transform); 54666 buffer.push(" stream\n"); 54667 let string = stream.getString(); 54668 54669 if (transform !== null) { 54670 string = transform.encryptString(string); 54671 } 54672 54673 buffer.push(string, "\nendstream\n"); 54674} 54675 54676function writeArray(array, buffer, transform) { 54677 buffer.push("["); 54678 let first = true; 54679 54680 for (const val of array) { 54681 if (!first) { 54682 buffer.push(" "); 54683 } else { 54684 first = false; 54685 } 54686 54687 writeValue(val, buffer, transform); 54688 } 54689 54690 buffer.push("]"); 54691} 54692 54693function writeValue(value, buffer, transform) { 54694 if (value instanceof _primitives.Name) { 54695 buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`); 54696 } else if (value instanceof _primitives.Ref) { 54697 buffer.push(`${value.num} ${value.gen} R`); 54698 } else if (Array.isArray(value)) { 54699 writeArray(value, buffer, transform); 54700 } else if (typeof value === "string") { 54701 if (transform !== null) { 54702 value = transform.encryptString(value); 54703 } 54704 54705 buffer.push(`(${(0, _util.escapeString)(value)})`); 54706 } else if (typeof value === "number") { 54707 buffer.push((0, _core_utils.numberToString)(value)); 54708 } else if (typeof value === "boolean") { 54709 buffer.push(value.toString()); 54710 } else if (value instanceof _primitives.Dict) { 54711 writeDict(value, buffer, transform); 54712 } else if (value instanceof _base_stream.BaseStream) { 54713 writeStream(value, buffer, transform); 54714 } else if (value === null) { 54715 buffer.push("null"); 54716 } else { 54717 (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`); 54718 } 54719} 54720 54721function writeInt(number, size, offset, buffer) { 54722 for (let i = size + offset - 1; i > offset - 1; i--) { 54723 buffer[i] = number & 0xff; 54724 number >>= 8; 54725 } 54726 54727 return offset + size; 54728} 54729 54730function writeString(string, offset, buffer) { 54731 for (let i = 0, len = string.length; i < len; i++) { 54732 buffer[offset + i] = string.charCodeAt(i) & 0xff; 54733 } 54734} 54735 54736function computeMD5(filesize, xrefInfo) { 54737 const time = Math.floor(Date.now() / 1000); 54738 const filename = xrefInfo.filename || ""; 54739 const md5Buffer = [time.toString(), filename, filesize.toString()]; 54740 let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0); 54741 54742 for (const value of Object.values(xrefInfo.info)) { 54743 md5Buffer.push(value); 54744 md5BufferLen += value.length; 54745 } 54746 54747 const array = new Uint8Array(md5BufferLen); 54748 let offset = 0; 54749 54750 for (const str of md5Buffer) { 54751 writeString(str, offset, array); 54752 offset += str.length; 54753 } 54754 54755 return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array)); 54756} 54757 54758function writeXFADataForAcroform(str, newRefs) { 54759 const xml = new _xml_parser.SimpleXMLParser({ 54760 hasAttributes: true 54761 }).parseFromString(str); 54762 54763 for (const { 54764 xfa 54765 } of newRefs) { 54766 if (!xfa) { 54767 continue; 54768 } 54769 54770 const { 54771 path, 54772 value 54773 } = xfa; 54774 54775 if (!path) { 54776 continue; 54777 } 54778 54779 const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0); 54780 54781 if (node) { 54782 if (Array.isArray(value)) { 54783 node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val)); 54784 } else { 54785 node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)]; 54786 } 54787 } else { 54788 (0, _util.warn)(`Node not found for path: ${path}`); 54789 } 54790 } 54791 54792 const buffer = []; 54793 xml.documentElement.dump(buffer); 54794 return buffer.join(""); 54795} 54796 54797function updateXFA({ 54798 xfaData, 54799 xfaDatasetsRef, 54800 hasXfaDatasetsEntry, 54801 acroFormRef, 54802 acroForm, 54803 newRefs, 54804 xref, 54805 xrefInfo 54806}) { 54807 if (xref === null) { 54808 return; 54809 } 54810 54811 if (!hasXfaDatasetsEntry) { 54812 if (!acroFormRef) { 54813 (0, _util.warn)("XFA - Cannot save it"); 54814 return; 54815 } 54816 54817 const oldXfa = acroForm.get("XFA"); 54818 const newXfa = oldXfa.slice(); 54819 newXfa.splice(2, 0, "datasets"); 54820 newXfa.splice(3, 0, xfaDatasetsRef); 54821 acroForm.set("XFA", newXfa); 54822 const encrypt = xref.encrypt; 54823 let transform = null; 54824 54825 if (encrypt) { 54826 transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen); 54827 } 54828 54829 const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`]; 54830 writeDict(acroForm, buffer, transform); 54831 buffer.push("\n"); 54832 acroForm.set("XFA", oldXfa); 54833 newRefs.push({ 54834 ref: acroFormRef, 54835 data: buffer.join("") 54836 }); 54837 } 54838 54839 if (xfaData === null) { 54840 const datasets = xref.fetchIfRef(xfaDatasetsRef); 54841 xfaData = writeXFADataForAcroform(datasets.getString(), newRefs); 54842 } 54843 54844 const encrypt = xref.encrypt; 54845 54846 if (encrypt) { 54847 const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen); 54848 xfaData = transform.encryptString(xfaData); 54849 } 54850 54851 const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n"; 54852 newRefs.push({ 54853 ref: xfaDatasetsRef, 54854 data 54855 }); 54856} 54857 54858function incrementalUpdate({ 54859 originalData, 54860 xrefInfo, 54861 newRefs, 54862 xref = null, 54863 hasXfa = false, 54864 xfaDatasetsRef = null, 54865 hasXfaDatasetsEntry = false, 54866 acroFormRef = null, 54867 acroForm = null, 54868 xfaData = null 54869}) { 54870 if (hasXfa) { 54871 updateXFA({ 54872 xfaData, 54873 xfaDatasetsRef, 54874 hasXfaDatasetsEntry, 54875 acroFormRef, 54876 acroForm, 54877 newRefs, 54878 xref, 54879 xrefInfo 54880 }); 54881 } 54882 54883 const newXref = new _primitives.Dict(null); 54884 const refForXrefTable = xrefInfo.newRef; 54885 let buffer, baseOffset; 54886 const lastByte = originalData.at(-1); 54887 54888 if (lastByte === 0x0a || lastByte === 0x0d) { 54889 buffer = []; 54890 baseOffset = originalData.length; 54891 } else { 54892 buffer = ["\n"]; 54893 baseOffset = originalData.length + 1; 54894 } 54895 54896 newXref.set("Size", refForXrefTable.num + 1); 54897 newXref.set("Prev", xrefInfo.startXRef); 54898 newXref.set("Type", _primitives.Name.get("XRef")); 54899 54900 if (xrefInfo.rootRef !== null) { 54901 newXref.set("Root", xrefInfo.rootRef); 54902 } 54903 54904 if (xrefInfo.infoRef !== null) { 54905 newXref.set("Info", xrefInfo.infoRef); 54906 } 54907 54908 if (xrefInfo.encryptRef !== null) { 54909 newXref.set("Encrypt", xrefInfo.encryptRef); 54910 } 54911 54912 newRefs.push({ 54913 ref: refForXrefTable, 54914 data: "" 54915 }); 54916 newRefs = newRefs.sort((a, b) => { 54917 return a.ref.num - b.ref.num; 54918 }); 54919 const xrefTableData = [[0, 1, 0xffff]]; 54920 const indexes = [0, 1]; 54921 let maxOffset = 0; 54922 54923 for (const { 54924 ref, 54925 data 54926 } of newRefs) { 54927 maxOffset = Math.max(maxOffset, baseOffset); 54928 xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]); 54929 baseOffset += data.length; 54930 indexes.push(ref.num, 1); 54931 buffer.push(data); 54932 } 54933 54934 newXref.set("Index", indexes); 54935 54936 if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) { 54937 const md5 = computeMD5(baseOffset, xrefInfo); 54938 newXref.set("ID", [xrefInfo.fileIds[0], md5]); 54939 } 54940 54941 const offsetSize = Math.ceil(Math.log2(maxOffset) / 8); 54942 const sizes = [1, offsetSize, 2]; 54943 const structSize = sizes[0] + sizes[1] + sizes[2]; 54944 const tableLength = structSize * xrefTableData.length; 54945 newXref.set("W", sizes); 54946 newXref.set("Length", tableLength); 54947 buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`); 54948 writeDict(newXref, buffer, null); 54949 buffer.push(" stream\n"); 54950 const bufferLen = buffer.reduce((a, str) => a + str.length, 0); 54951 const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`; 54952 const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length); 54953 array.set(originalData); 54954 let offset = originalData.length; 54955 54956 for (const str of buffer) { 54957 writeString(str, offset, array); 54958 offset += str.length; 54959 } 54960 54961 for (const [type, objOffset, gen] of xrefTableData) { 54962 offset = writeInt(type, sizes[0], offset, array); 54963 offset = writeInt(objOffset, sizes[1], offset, array); 54964 offset = writeInt(gen, sizes[2], offset, array); 54965 } 54966 54967 writeString(footer, offset, array); 54968 return array; 54969} 54970 54971/***/ }), 54972/* 66 */ 54973/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 54974 54975 54976 54977Object.defineProperty(exports, "__esModule", ({ 54978 value: true 54979})); 54980exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0; 54981 54982var _core_utils = __w_pdfjs_require__(6); 54983 54984const XMLParserErrorCode = { 54985 NoError: 0, 54986 EndOfDocument: -1, 54987 UnterminatedCdat: -2, 54988 UnterminatedXmlDeclaration: -3, 54989 UnterminatedDoctypeDeclaration: -4, 54990 UnterminatedComment: -5, 54991 MalformedElement: -6, 54992 OutOfMemory: -7, 54993 UnterminatedAttributeValue: -8, 54994 UnterminatedElement: -9, 54995 ElementNeverBegun: -10 54996}; 54997exports.XMLParserErrorCode = XMLParserErrorCode; 54998 54999function isWhitespace(s, index) { 55000 const ch = s[index]; 55001 return ch === " " || ch === "\n" || ch === "\r" || ch === "\t"; 55002} 55003 55004function isWhitespaceString(s) { 55005 for (let i = 0, ii = s.length; i < ii; i++) { 55006 if (!isWhitespace(s, i)) { 55007 return false; 55008 } 55009 } 55010 55011 return true; 55012} 55013 55014class XMLParserBase { 55015 _resolveEntities(s) { 55016 return s.replace(/&([^;]+);/g, (all, entity) => { 55017 if (entity.substring(0, 2) === "#x") { 55018 return String.fromCodePoint(parseInt(entity.substring(2), 16)); 55019 } else if (entity.substring(0, 1) === "#") { 55020 return String.fromCodePoint(parseInt(entity.substring(1), 10)); 55021 } 55022 55023 switch (entity) { 55024 case "lt": 55025 return "<"; 55026 55027 case "gt": 55028 return ">"; 55029 55030 case "amp": 55031 return "&"; 55032 55033 case "quot": 55034 return '"'; 55035 55036 case "apos": 55037 return "'"; 55038 } 55039 55040 return this.onResolveEntity(entity); 55041 }); 55042 } 55043 55044 _parseContent(s, start) { 55045 const attributes = []; 55046 let pos = start; 55047 55048 function skipWs() { 55049 while (pos < s.length && isWhitespace(s, pos)) { 55050 ++pos; 55051 } 55052 } 55053 55054 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") { 55055 ++pos; 55056 } 55057 55058 const name = s.substring(start, pos); 55059 skipWs(); 55060 55061 while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") { 55062 skipWs(); 55063 let attrName = "", 55064 attrValue = ""; 55065 55066 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") { 55067 attrName += s[pos]; 55068 ++pos; 55069 } 55070 55071 skipWs(); 55072 55073 if (s[pos] !== "=") { 55074 return null; 55075 } 55076 55077 ++pos; 55078 skipWs(); 55079 const attrEndChar = s[pos]; 55080 55081 if (attrEndChar !== '"' && attrEndChar !== "'") { 55082 return null; 55083 } 55084 55085 const attrEndIndex = s.indexOf(attrEndChar, ++pos); 55086 55087 if (attrEndIndex < 0) { 55088 return null; 55089 } 55090 55091 attrValue = s.substring(pos, attrEndIndex); 55092 attributes.push({ 55093 name: attrName, 55094 value: this._resolveEntities(attrValue) 55095 }); 55096 pos = attrEndIndex + 1; 55097 skipWs(); 55098 } 55099 55100 return { 55101 name, 55102 attributes, 55103 parsed: pos - start 55104 }; 55105 } 55106 55107 _parseProcessingInstruction(s, start) { 55108 let pos = start; 55109 55110 function skipWs() { 55111 while (pos < s.length && isWhitespace(s, pos)) { 55112 ++pos; 55113 } 55114 } 55115 55116 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") { 55117 ++pos; 55118 } 55119 55120 const name = s.substring(start, pos); 55121 skipWs(); 55122 const attrStart = pos; 55123 55124 while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) { 55125 ++pos; 55126 } 55127 55128 const value = s.substring(attrStart, pos); 55129 return { 55130 name, 55131 value, 55132 parsed: pos - start 55133 }; 55134 } 55135 55136 parseXml(s) { 55137 let i = 0; 55138 55139 while (i < s.length) { 55140 const ch = s[i]; 55141 let j = i; 55142 55143 if (ch === "<") { 55144 ++j; 55145 const ch2 = s[j]; 55146 let q; 55147 55148 switch (ch2) { 55149 case "/": 55150 ++j; 55151 q = s.indexOf(">", j); 55152 55153 if (q < 0) { 55154 this.onError(XMLParserErrorCode.UnterminatedElement); 55155 return; 55156 } 55157 55158 this.onEndElement(s.substring(j, q)); 55159 j = q + 1; 55160 break; 55161 55162 case "?": 55163 ++j; 55164 55165 const pi = this._parseProcessingInstruction(s, j); 55166 55167 if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") { 55168 this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration); 55169 return; 55170 } 55171 55172 this.onPi(pi.name, pi.value); 55173 j += pi.parsed + 2; 55174 break; 55175 55176 case "!": 55177 if (s.substring(j + 1, j + 3) === "--") { 55178 q = s.indexOf("-->", j + 3); 55179 55180 if (q < 0) { 55181 this.onError(XMLParserErrorCode.UnterminatedComment); 55182 return; 55183 } 55184 55185 this.onComment(s.substring(j + 3, q)); 55186 j = q + 3; 55187 } else if (s.substring(j + 1, j + 8) === "[CDATA[") { 55188 q = s.indexOf("]]>", j + 8); 55189 55190 if (q < 0) { 55191 this.onError(XMLParserErrorCode.UnterminatedCdat); 55192 return; 55193 } 55194 55195 this.onCdata(s.substring(j + 8, q)); 55196 j = q + 3; 55197 } else if (s.substring(j + 1, j + 8) === "DOCTYPE") { 55198 const q2 = s.indexOf("[", j + 8); 55199 let complexDoctype = false; 55200 q = s.indexOf(">", j + 8); 55201 55202 if (q < 0) { 55203 this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); 55204 return; 55205 } 55206 55207 if (q2 > 0 && q > q2) { 55208 q = s.indexOf("]>", j + 8); 55209 55210 if (q < 0) { 55211 this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); 55212 return; 55213 } 55214 55215 complexDoctype = true; 55216 } 55217 55218 const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0)); 55219 this.onDoctype(doctypeContent); 55220 j = q + (complexDoctype ? 2 : 1); 55221 } else { 55222 this.onError(XMLParserErrorCode.MalformedElement); 55223 return; 55224 } 55225 55226 break; 55227 55228 default: 55229 const content = this._parseContent(s, j); 55230 55231 if (content === null) { 55232 this.onError(XMLParserErrorCode.MalformedElement); 55233 return; 55234 } 55235 55236 let isClosed = false; 55237 55238 if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") { 55239 isClosed = true; 55240 } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") { 55241 this.onError(XMLParserErrorCode.UnterminatedElement); 55242 return; 55243 } 55244 55245 this.onBeginElement(content.name, content.attributes, isClosed); 55246 j += content.parsed + (isClosed ? 2 : 1); 55247 break; 55248 } 55249 } else { 55250 while (j < s.length && s[j] !== "<") { 55251 j++; 55252 } 55253 55254 const text = s.substring(i, j); 55255 this.onText(this._resolveEntities(text)); 55256 } 55257 55258 i = j; 55259 } 55260 } 55261 55262 onResolveEntity(name) { 55263 return `&${name};`; 55264 } 55265 55266 onPi(name, value) {} 55267 55268 onComment(text) {} 55269 55270 onCdata(text) {} 55271 55272 onDoctype(doctypeContent) {} 55273 55274 onText(text) {} 55275 55276 onBeginElement(name, attributes, isEmpty) {} 55277 55278 onEndElement(name) {} 55279 55280 onError(code) {} 55281 55282} 55283 55284exports.XMLParserBase = XMLParserBase; 55285 55286class SimpleDOMNode { 55287 constructor(nodeName, nodeValue) { 55288 this.nodeName = nodeName; 55289 this.nodeValue = nodeValue; 55290 Object.defineProperty(this, "parentNode", { 55291 value: null, 55292 writable: true 55293 }); 55294 } 55295 55296 get firstChild() { 55297 return this.childNodes && this.childNodes[0]; 55298 } 55299 55300 get nextSibling() { 55301 const childNodes = this.parentNode.childNodes; 55302 55303 if (!childNodes) { 55304 return undefined; 55305 } 55306 55307 const index = childNodes.indexOf(this); 55308 55309 if (index === -1) { 55310 return undefined; 55311 } 55312 55313 return childNodes[index + 1]; 55314 } 55315 55316 get textContent() { 55317 if (!this.childNodes) { 55318 return this.nodeValue || ""; 55319 } 55320 55321 return this.childNodes.map(function (child) { 55322 return child.textContent; 55323 }).join(""); 55324 } 55325 55326 get children() { 55327 return this.childNodes || []; 55328 } 55329 55330 hasChildNodes() { 55331 return this.childNodes && this.childNodes.length > 0; 55332 } 55333 55334 searchNode(paths, pos) { 55335 if (pos >= paths.length) { 55336 return this; 55337 } 55338 55339 const component = paths[pos]; 55340 const stack = []; 55341 let node = this; 55342 55343 while (true) { 55344 if (component.name === node.nodeName) { 55345 if (component.pos === 0) { 55346 const res = node.searchNode(paths, pos + 1); 55347 55348 if (res !== null) { 55349 return res; 55350 } 55351 } else if (stack.length === 0) { 55352 return null; 55353 } else { 55354 const [parent] = stack.pop(); 55355 let siblingPos = 0; 55356 55357 for (const child of parent.childNodes) { 55358 if (component.name === child.nodeName) { 55359 if (siblingPos === component.pos) { 55360 return child.searchNode(paths, pos + 1); 55361 } 55362 55363 siblingPos++; 55364 } 55365 } 55366 55367 return node.searchNode(paths, pos + 1); 55368 } 55369 } 55370 55371 if (node.childNodes && node.childNodes.length !== 0) { 55372 stack.push([node, 0]); 55373 node = node.childNodes[0]; 55374 } else if (stack.length === 0) { 55375 return null; 55376 } else { 55377 while (stack.length !== 0) { 55378 const [parent, currentPos] = stack.pop(); 55379 const newPos = currentPos + 1; 55380 55381 if (newPos < parent.childNodes.length) { 55382 stack.push([parent, newPos]); 55383 node = parent.childNodes[newPos]; 55384 break; 55385 } 55386 } 55387 55388 if (stack.length === 0) { 55389 return null; 55390 } 55391 } 55392 } 55393 } 55394 55395 dump(buffer) { 55396 if (this.nodeName === "#text") { 55397 buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue)); 55398 return; 55399 } 55400 55401 buffer.push(`<${this.nodeName}`); 55402 55403 if (this.attributes) { 55404 for (const attribute of this.attributes) { 55405 buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`); 55406 } 55407 } 55408 55409 if (this.hasChildNodes()) { 55410 buffer.push(">"); 55411 55412 for (const child of this.childNodes) { 55413 child.dump(buffer); 55414 } 55415 55416 buffer.push(`</${this.nodeName}>`); 55417 } else if (this.nodeValue) { 55418 buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`); 55419 } else { 55420 buffer.push("/>"); 55421 } 55422 } 55423 55424} 55425 55426exports.SimpleDOMNode = SimpleDOMNode; 55427 55428class SimpleXMLParser extends XMLParserBase { 55429 constructor({ 55430 hasAttributes = false, 55431 lowerCaseName = false 55432 }) { 55433 super(); 55434 this._currentFragment = null; 55435 this._stack = null; 55436 this._errorCode = XMLParserErrorCode.NoError; 55437 this._hasAttributes = hasAttributes; 55438 this._lowerCaseName = lowerCaseName; 55439 } 55440 55441 parseFromString(data) { 55442 this._currentFragment = []; 55443 this._stack = []; 55444 this._errorCode = XMLParserErrorCode.NoError; 55445 this.parseXml(data); 55446 55447 if (this._errorCode !== XMLParserErrorCode.NoError) { 55448 return undefined; 55449 } 55450 55451 const [documentElement] = this._currentFragment; 55452 55453 if (!documentElement) { 55454 return undefined; 55455 } 55456 55457 return { 55458 documentElement 55459 }; 55460 } 55461 55462 onText(text) { 55463 if (isWhitespaceString(text)) { 55464 return; 55465 } 55466 55467 const node = new SimpleDOMNode("#text", text); 55468 55469 this._currentFragment.push(node); 55470 } 55471 55472 onCdata(text) { 55473 const node = new SimpleDOMNode("#text", text); 55474 55475 this._currentFragment.push(node); 55476 } 55477 55478 onBeginElement(name, attributes, isEmpty) { 55479 if (this._lowerCaseName) { 55480 name = name.toLowerCase(); 55481 } 55482 55483 const node = new SimpleDOMNode(name); 55484 node.childNodes = []; 55485 55486 if (this._hasAttributes) { 55487 node.attributes = attributes; 55488 } 55489 55490 this._currentFragment.push(node); 55491 55492 if (isEmpty) { 55493 return; 55494 } 55495 55496 this._stack.push(this._currentFragment); 55497 55498 this._currentFragment = node.childNodes; 55499 } 55500 55501 onEndElement(name) { 55502 this._currentFragment = this._stack.pop() || []; 55503 55504 const lastElement = this._currentFragment.at(-1); 55505 55506 if (!lastElement) { 55507 return null; 55508 } 55509 55510 for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) { 55511 lastElement.childNodes[i].parentNode = lastElement; 55512 } 55513 55514 return lastElement; 55515 } 55516 55517 onError(code) { 55518 this._errorCode = code; 55519 } 55520 55521} 55522 55523exports.SimpleXMLParser = SimpleXMLParser; 55524 55525/***/ }), 55526/* 67 */ 55527/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 55528 55529 55530 55531Object.defineProperty(exports, "__esModule", ({ 55532 value: true 55533})); 55534exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0; 55535exports.calculateSHA384 = calculateSHA384; 55536exports.calculateSHA512 = void 0; 55537 55538var _util = __w_pdfjs_require__(2); 55539 55540var _primitives = __w_pdfjs_require__(5); 55541 55542var _decrypt_stream = __w_pdfjs_require__(68); 55543 55544class ARCFourCipher { 55545 constructor(key) { 55546 this.a = 0; 55547 this.b = 0; 55548 const s = new Uint8Array(256); 55549 const keyLength = key.length; 55550 55551 for (let i = 0; i < 256; ++i) { 55552 s[i] = i; 55553 } 55554 55555 for (let i = 0, j = 0; i < 256; ++i) { 55556 const tmp = s[i]; 55557 j = j + tmp + key[i % keyLength] & 0xff; 55558 s[i] = s[j]; 55559 s[j] = tmp; 55560 } 55561 55562 this.s = s; 55563 } 55564 55565 encryptBlock(data) { 55566 let a = this.a, 55567 b = this.b; 55568 const s = this.s; 55569 const n = data.length; 55570 const output = new Uint8Array(n); 55571 55572 for (let i = 0; i < n; ++i) { 55573 a = a + 1 & 0xff; 55574 const tmp = s[a]; 55575 b = b + tmp & 0xff; 55576 const tmp2 = s[b]; 55577 s[a] = tmp2; 55578 s[b] = tmp; 55579 output[i] = data[i] ^ s[tmp + tmp2 & 0xff]; 55580 } 55581 55582 this.a = a; 55583 this.b = b; 55584 return output; 55585 } 55586 55587 decryptBlock(data) { 55588 return this.encryptBlock(data); 55589 } 55590 55591 encrypt(data) { 55592 return this.encryptBlock(data); 55593 } 55594 55595} 55596 55597exports.ARCFourCipher = ARCFourCipher; 55598 55599const calculateMD5 = function calculateMD5Closure() { 55600 const r = new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]); 55601 const k = new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]); 55602 55603 function hash(data, offset, length) { 55604 let h0 = 1732584193, 55605 h1 = -271733879, 55606 h2 = -1732584194, 55607 h3 = 271733878; 55608 const paddedLength = length + 72 & ~63; 55609 const padded = new Uint8Array(paddedLength); 55610 let i, j; 55611 55612 for (i = 0; i < length; ++i) { 55613 padded[i] = data[offset++]; 55614 } 55615 55616 padded[i++] = 0x80; 55617 const n = paddedLength - 8; 55618 55619 while (i < n) { 55620 padded[i++] = 0; 55621 } 55622 55623 padded[i++] = length << 3 & 0xff; 55624 padded[i++] = length >> 5 & 0xff; 55625 padded[i++] = length >> 13 & 0xff; 55626 padded[i++] = length >> 21 & 0xff; 55627 padded[i++] = length >>> 29 & 0xff; 55628 padded[i++] = 0; 55629 padded[i++] = 0; 55630 padded[i++] = 0; 55631 const w = new Int32Array(16); 55632 55633 for (i = 0; i < paddedLength;) { 55634 for (j = 0; j < 16; ++j, i += 4) { 55635 w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24; 55636 } 55637 55638 let a = h0, 55639 b = h1, 55640 c = h2, 55641 d = h3, 55642 f, 55643 g; 55644 55645 for (j = 0; j < 64; ++j) { 55646 if (j < 16) { 55647 f = b & c | ~b & d; 55648 g = j; 55649 } else if (j < 32) { 55650 f = d & b | ~d & c; 55651 g = 5 * j + 1 & 15; 55652 } else if (j < 48) { 55653 f = b ^ c ^ d; 55654 g = 3 * j + 5 & 15; 55655 } else { 55656 f = c ^ (b | ~d); 55657 g = 7 * j & 15; 55658 } 55659 55660 const tmp = d, 55661 rotateArg = a + f + k[j] + w[g] | 0, 55662 rotate = r[j]; 55663 d = c; 55664 c = b; 55665 b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0; 55666 a = tmp; 55667 } 55668 55669 h0 = h0 + a | 0; 55670 h1 = h1 + b | 0; 55671 h2 = h2 + c | 0; 55672 h3 = h3 + d | 0; 55673 } 55674 55675 return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]); 55676 } 55677 55678 return hash; 55679}(); 55680 55681exports.calculateMD5 = calculateMD5; 55682 55683class Word64 { 55684 constructor(highInteger, lowInteger) { 55685 this.high = highInteger | 0; 55686 this.low = lowInteger | 0; 55687 } 55688 55689 and(word) { 55690 this.high &= word.high; 55691 this.low &= word.low; 55692 } 55693 55694 xor(word) { 55695 this.high ^= word.high; 55696 this.low ^= word.low; 55697 } 55698 55699 or(word) { 55700 this.high |= word.high; 55701 this.low |= word.low; 55702 } 55703 55704 shiftRight(places) { 55705 if (places >= 32) { 55706 this.low = this.high >>> places - 32 | 0; 55707 this.high = 0; 55708 } else { 55709 this.low = this.low >>> places | this.high << 32 - places; 55710 this.high = this.high >>> places | 0; 55711 } 55712 } 55713 55714 shiftLeft(places) { 55715 if (places >= 32) { 55716 this.high = this.low << places - 32; 55717 this.low = 0; 55718 } else { 55719 this.high = this.high << places | this.low >>> 32 - places; 55720 this.low <<= places; 55721 } 55722 } 55723 55724 rotateRight(places) { 55725 let low, high; 55726 55727 if (places & 32) { 55728 high = this.low; 55729 low = this.high; 55730 } else { 55731 low = this.low; 55732 high = this.high; 55733 } 55734 55735 places &= 31; 55736 this.low = low >>> places | high << 32 - places; 55737 this.high = high >>> places | low << 32 - places; 55738 } 55739 55740 not() { 55741 this.high = ~this.high; 55742 this.low = ~this.low; 55743 } 55744 55745 add(word) { 55746 const lowAdd = (this.low >>> 0) + (word.low >>> 0); 55747 let highAdd = (this.high >>> 0) + (word.high >>> 0); 55748 55749 if (lowAdd > 0xffffffff) { 55750 highAdd += 1; 55751 } 55752 55753 this.low = lowAdd | 0; 55754 this.high = highAdd | 0; 55755 } 55756 55757 copyTo(bytes, offset) { 55758 bytes[offset] = this.high >>> 24 & 0xff; 55759 bytes[offset + 1] = this.high >> 16 & 0xff; 55760 bytes[offset + 2] = this.high >> 8 & 0xff; 55761 bytes[offset + 3] = this.high & 0xff; 55762 bytes[offset + 4] = this.low >>> 24 & 0xff; 55763 bytes[offset + 5] = this.low >> 16 & 0xff; 55764 bytes[offset + 6] = this.low >> 8 & 0xff; 55765 bytes[offset + 7] = this.low & 0xff; 55766 } 55767 55768 assign(word) { 55769 this.high = word.high; 55770 this.low = word.low; 55771 } 55772 55773} 55774 55775const calculateSHA256 = function calculateSHA256Closure() { 55776 function rotr(x, n) { 55777 return x >>> n | x << 32 - n; 55778 } 55779 55780 function ch(x, y, z) { 55781 return x & y ^ ~x & z; 55782 } 55783 55784 function maj(x, y, z) { 55785 return x & y ^ x & z ^ y & z; 55786 } 55787 55788 function sigma(x) { 55789 return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); 55790 } 55791 55792 function sigmaPrime(x) { 55793 return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); 55794 } 55795 55796 function littleSigma(x) { 55797 return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3; 55798 } 55799 55800 function littleSigmaPrime(x) { 55801 return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10; 55802 } 55803 55804 const k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]; 55805 55806 function hash(data, offset, length) { 55807 let h0 = 0x6a09e667, 55808 h1 = 0xbb67ae85, 55809 h2 = 0x3c6ef372, 55810 h3 = 0xa54ff53a, 55811 h4 = 0x510e527f, 55812 h5 = 0x9b05688c, 55813 h6 = 0x1f83d9ab, 55814 h7 = 0x5be0cd19; 55815 const paddedLength = Math.ceil((length + 9) / 64) * 64; 55816 const padded = new Uint8Array(paddedLength); 55817 let i, j; 55818 55819 for (i = 0; i < length; ++i) { 55820 padded[i] = data[offset++]; 55821 } 55822 55823 padded[i++] = 0x80; 55824 const n = paddedLength - 8; 55825 55826 while (i < n) { 55827 padded[i++] = 0; 55828 } 55829 55830 padded[i++] = 0; 55831 padded[i++] = 0; 55832 padded[i++] = 0; 55833 padded[i++] = length >>> 29 & 0xff; 55834 padded[i++] = length >> 21 & 0xff; 55835 padded[i++] = length >> 13 & 0xff; 55836 padded[i++] = length >> 5 & 0xff; 55837 padded[i++] = length << 3 & 0xff; 55838 const w = new Uint32Array(64); 55839 55840 for (i = 0; i < paddedLength;) { 55841 for (j = 0; j < 16; ++j) { 55842 w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 55843 i += 4; 55844 } 55845 55846 for (j = 16; j < 64; ++j) { 55847 w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0; 55848 } 55849 55850 let a = h0, 55851 b = h1, 55852 c = h2, 55853 d = h3, 55854 e = h4, 55855 f = h5, 55856 g = h6, 55857 h = h7, 55858 t1, 55859 t2; 55860 55861 for (j = 0; j < 64; ++j) { 55862 t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j]; 55863 t2 = sigma(a) + maj(a, b, c); 55864 h = g; 55865 g = f; 55866 f = e; 55867 e = d + t1 | 0; 55868 d = c; 55869 c = b; 55870 b = a; 55871 a = t1 + t2 | 0; 55872 } 55873 55874 h0 = h0 + a | 0; 55875 h1 = h1 + b | 0; 55876 h2 = h2 + c | 0; 55877 h3 = h3 + d | 0; 55878 h4 = h4 + e | 0; 55879 h5 = h5 + f | 0; 55880 h6 = h6 + g | 0; 55881 h7 = h7 + h | 0; 55882 } 55883 55884 return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]); 55885 } 55886 55887 return hash; 55888}(); 55889 55890exports.calculateSHA256 = calculateSHA256; 55891 55892const calculateSHA512 = function calculateSHA512Closure() { 55893 function ch(result, x, y, z, tmp) { 55894 result.assign(x); 55895 result.and(y); 55896 tmp.assign(x); 55897 tmp.not(); 55898 tmp.and(z); 55899 result.xor(tmp); 55900 } 55901 55902 function maj(result, x, y, z, tmp) { 55903 result.assign(x); 55904 result.and(y); 55905 tmp.assign(x); 55906 tmp.and(z); 55907 result.xor(tmp); 55908 tmp.assign(y); 55909 tmp.and(z); 55910 result.xor(tmp); 55911 } 55912 55913 function sigma(result, x, tmp) { 55914 result.assign(x); 55915 result.rotateRight(28); 55916 tmp.assign(x); 55917 tmp.rotateRight(34); 55918 result.xor(tmp); 55919 tmp.assign(x); 55920 tmp.rotateRight(39); 55921 result.xor(tmp); 55922 } 55923 55924 function sigmaPrime(result, x, tmp) { 55925 result.assign(x); 55926 result.rotateRight(14); 55927 tmp.assign(x); 55928 tmp.rotateRight(18); 55929 result.xor(tmp); 55930 tmp.assign(x); 55931 tmp.rotateRight(41); 55932 result.xor(tmp); 55933 } 55934 55935 function littleSigma(result, x, tmp) { 55936 result.assign(x); 55937 result.rotateRight(1); 55938 tmp.assign(x); 55939 tmp.rotateRight(8); 55940 result.xor(tmp); 55941 tmp.assign(x); 55942 tmp.shiftRight(7); 55943 result.xor(tmp); 55944 } 55945 55946 function littleSigmaPrime(result, x, tmp) { 55947 result.assign(x); 55948 result.rotateRight(19); 55949 tmp.assign(x); 55950 tmp.rotateRight(61); 55951 result.xor(tmp); 55952 tmp.assign(x); 55953 tmp.shiftRight(6); 55954 result.xor(tmp); 55955 } 55956 55957 const k = [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)]; 55958 55959 function hash(data, offset, length, mode384 = false) { 55960 let h0, h1, h2, h3, h4, h5, h6, h7; 55961 55962 if (!mode384) { 55963 h0 = new Word64(0x6a09e667, 0xf3bcc908); 55964 h1 = new Word64(0xbb67ae85, 0x84caa73b); 55965 h2 = new Word64(0x3c6ef372, 0xfe94f82b); 55966 h3 = new Word64(0xa54ff53a, 0x5f1d36f1); 55967 h4 = new Word64(0x510e527f, 0xade682d1); 55968 h5 = new Word64(0x9b05688c, 0x2b3e6c1f); 55969 h6 = new Word64(0x1f83d9ab, 0xfb41bd6b); 55970 h7 = new Word64(0x5be0cd19, 0x137e2179); 55971 } else { 55972 h0 = new Word64(0xcbbb9d5d, 0xc1059ed8); 55973 h1 = new Word64(0x629a292a, 0x367cd507); 55974 h2 = new Word64(0x9159015a, 0x3070dd17); 55975 h3 = new Word64(0x152fecd8, 0xf70e5939); 55976 h4 = new Word64(0x67332667, 0xffc00b31); 55977 h5 = new Word64(0x8eb44a87, 0x68581511); 55978 h6 = new Word64(0xdb0c2e0d, 0x64f98fa7); 55979 h7 = new Word64(0x47b5481d, 0xbefa4fa4); 55980 } 55981 55982 const paddedLength = Math.ceil((length + 17) / 128) * 128; 55983 const padded = new Uint8Array(paddedLength); 55984 let i, j; 55985 55986 for (i = 0; i < length; ++i) { 55987 padded[i] = data[offset++]; 55988 } 55989 55990 padded[i++] = 0x80; 55991 const n = paddedLength - 16; 55992 55993 while (i < n) { 55994 padded[i++] = 0; 55995 } 55996 55997 padded[i++] = 0; 55998 padded[i++] = 0; 55999 padded[i++] = 0; 56000 padded[i++] = 0; 56001 padded[i++] = 0; 56002 padded[i++] = 0; 56003 padded[i++] = 0; 56004 padded[i++] = 0; 56005 padded[i++] = 0; 56006 padded[i++] = 0; 56007 padded[i++] = 0; 56008 padded[i++] = length >>> 29 & 0xff; 56009 padded[i++] = length >> 21 & 0xff; 56010 padded[i++] = length >> 13 & 0xff; 56011 padded[i++] = length >> 5 & 0xff; 56012 padded[i++] = length << 3 & 0xff; 56013 const w = new Array(80); 56014 56015 for (i = 0; i < 80; i++) { 56016 w[i] = new Word64(0, 0); 56017 } 56018 56019 let a = new Word64(0, 0), 56020 b = new Word64(0, 0), 56021 c = new Word64(0, 0); 56022 let d = new Word64(0, 0), 56023 e = new Word64(0, 0), 56024 f = new Word64(0, 0); 56025 let g = new Word64(0, 0), 56026 h = new Word64(0, 0); 56027 const t1 = new Word64(0, 0), 56028 t2 = new Word64(0, 0); 56029 const tmp1 = new Word64(0, 0), 56030 tmp2 = new Word64(0, 0); 56031 let tmp3; 56032 56033 for (i = 0; i < paddedLength;) { 56034 for (j = 0; j < 16; ++j) { 56035 w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 56036 w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7]; 56037 i += 8; 56038 } 56039 56040 for (j = 16; j < 80; ++j) { 56041 tmp3 = w[j]; 56042 littleSigmaPrime(tmp3, w[j - 2], tmp2); 56043 tmp3.add(w[j - 7]); 56044 littleSigma(tmp1, w[j - 15], tmp2); 56045 tmp3.add(tmp1); 56046 tmp3.add(w[j - 16]); 56047 } 56048 56049 a.assign(h0); 56050 b.assign(h1); 56051 c.assign(h2); 56052 d.assign(h3); 56053 e.assign(h4); 56054 f.assign(h5); 56055 g.assign(h6); 56056 h.assign(h7); 56057 56058 for (j = 0; j < 80; ++j) { 56059 t1.assign(h); 56060 sigmaPrime(tmp1, e, tmp2); 56061 t1.add(tmp1); 56062 ch(tmp1, e, f, g, tmp2); 56063 t1.add(tmp1); 56064 t1.add(k[j]); 56065 t1.add(w[j]); 56066 sigma(t2, a, tmp2); 56067 maj(tmp1, a, b, c, tmp2); 56068 t2.add(tmp1); 56069 tmp3 = h; 56070 h = g; 56071 g = f; 56072 f = e; 56073 d.add(t1); 56074 e = d; 56075 d = c; 56076 c = b; 56077 b = a; 56078 tmp3.assign(t1); 56079 tmp3.add(t2); 56080 a = tmp3; 56081 } 56082 56083 h0.add(a); 56084 h1.add(b); 56085 h2.add(c); 56086 h3.add(d); 56087 h4.add(e); 56088 h5.add(f); 56089 h6.add(g); 56090 h7.add(h); 56091 } 56092 56093 let result; 56094 56095 if (!mode384) { 56096 result = new Uint8Array(64); 56097 h0.copyTo(result, 0); 56098 h1.copyTo(result, 8); 56099 h2.copyTo(result, 16); 56100 h3.copyTo(result, 24); 56101 h4.copyTo(result, 32); 56102 h5.copyTo(result, 40); 56103 h6.copyTo(result, 48); 56104 h7.copyTo(result, 56); 56105 } else { 56106 result = new Uint8Array(48); 56107 h0.copyTo(result, 0); 56108 h1.copyTo(result, 8); 56109 h2.copyTo(result, 16); 56110 h3.copyTo(result, 24); 56111 h4.copyTo(result, 32); 56112 h5.copyTo(result, 40); 56113 } 56114 56115 return result; 56116 } 56117 56118 return hash; 56119}(); 56120 56121exports.calculateSHA512 = calculateSHA512; 56122 56123function calculateSHA384(data, offset, length) { 56124 return calculateSHA512(data, offset, length, true); 56125} 56126 56127class NullCipher { 56128 decryptBlock(data) { 56129 return data; 56130 } 56131 56132 encrypt(data) { 56133 return data; 56134 } 56135 56136} 56137 56138class AESBaseCipher { 56139 constructor() { 56140 if (this.constructor === AESBaseCipher) { 56141 (0, _util.unreachable)("Cannot initialize AESBaseCipher."); 56142 } 56143 56144 this._s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]); 56145 this._inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42,
561450xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]); 56146 this._mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23
vendor: 153,751 bytes, lines 56146-62462
56146c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]); 56147 this._mixCol = new Uint8Array(256); 56148 56149 for (let i = 0; i < 256; i++) { 56150 if (i < 128) { 56151 this._mixCol[i] = i << 1; 56152 } else { 56153 this._mixCol[i] = i << 1 ^ 0x1b; 56154 } 56155 } 56156 56157 this.buffer = new Uint8Array(16); 56158 this.bufferPosition = 0; 56159 } 56160 56161 _expandKey(cipherKey) { 56162 (0, _util.unreachable)("Cannot call `_expandKey` on the base class"); 56163 } 56164 56165 _decrypt(input, key) { 56166 let t, u, v; 56167 const state = new Uint8Array(16); 56168 state.set(input); 56169 56170 for (let j = 0, k = this._keySize; j < 16; ++j, ++k) { 56171 state[j] ^= key[k]; 56172 } 56173 56174 for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) { 56175 t = state[13]; 56176 state[13] = state[9]; 56177 state[9] = state[5]; 56178 state[5] = state[1]; 56179 state[1] = t; 56180 t = state[14]; 56181 u = state[10]; 56182 state[14] = state[6]; 56183 state[10] = state[2]; 56184 state[6] = t; 56185 state[2] = u; 56186 t = state[15]; 56187 u = state[11]; 56188 v = state[7]; 56189 state[15] = state[3]; 56190 state[11] = t; 56191 state[7] = u; 56192 state[3] = v; 56193 56194 for (let j = 0; j < 16; ++j) { 56195 state[j] = this._inv_s[state[j]]; 56196 } 56197 56198 for (let j = 0, k = i * 16; j < 16; ++j, ++k) { 56199 state[j] ^= key[k]; 56200 } 56201 56202 for (let j = 0; j < 16; j += 4) { 56203 const s0 = this._mix[state[j]]; 56204 const s1 = this._mix[state[j + 1]]; 56205 const s2 = this._mix[state[j + 2]]; 56206 const s3 = this._mix[state[j + 3]]; 56207 t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8; 56208 state[j] = t >>> 24 & 0xff; 56209 state[j + 1] = t >> 16 & 0xff; 56210 state[j + 2] = t >> 8 & 0xff; 56211 state[j + 3] = t & 0xff; 56212 } 56213 } 56214 56215 t = state[13]; 56216 state[13] = state[9]; 56217 state[9] = state[5]; 56218 state[5] = state[1]; 56219 state[1] = t; 56220 t = state[14]; 56221 u = state[10]; 56222 state[14] = state[6]; 56223 state[10] = state[2]; 56224 state[6] = t; 56225 state[2] = u; 56226 t = state[15]; 56227 u = state[11]; 56228 v = state[7]; 56229 state[15] = state[3]; 56230 state[11] = t; 56231 state[7] = u; 56232 state[3] = v; 56233 56234 for (let j = 0; j < 16; ++j) { 56235 state[j] = this._inv_s[state[j]]; 56236 state[j] ^= key[j]; 56237 } 56238 56239 return state; 56240 } 56241 56242 _encrypt(input, key) { 56243 const s = this._s; 56244 let t, u, v; 56245 const state = new Uint8Array(16); 56246 state.set(input); 56247 56248 for (let j = 0; j < 16; ++j) { 56249 state[j] ^= key[j]; 56250 } 56251 56252 for (let i = 1; i < this._cyclesOfRepetition; i++) { 56253 for (let j = 0; j < 16; ++j) { 56254 state[j] = s[state[j]]; 56255 } 56256 56257 v = state[1]; 56258 state[1] = state[5]; 56259 state[5] = state[9]; 56260 state[9] = state[13]; 56261 state[13] = v; 56262 v = state[2]; 56263 u = state[6]; 56264 state[2] = state[10]; 56265 state[6] = state[14]; 56266 state[10] = v; 56267 state[14] = u; 56268 v = state[3]; 56269 u = state[7]; 56270 t = state[11]; 56271 state[3] = state[15]; 56272 state[7] = v; 56273 state[11] = u; 56274 state[15] = t; 56275 56276 for (let j = 0; j < 16; j += 4) { 56277 const s0 = state[j + 0]; 56278 const s1 = state[j + 1]; 56279 const s2 = state[j + 2]; 56280 const s3 = state[j + 3]; 56281 t = s0 ^ s1 ^ s2 ^ s3; 56282 state[j + 0] ^= t ^ this._mixCol[s0 ^ s1]; 56283 state[j + 1] ^= t ^ this._mixCol[s1 ^ s2]; 56284 state[j + 2] ^= t ^ this._mixCol[s2 ^ s3]; 56285 state[j + 3] ^= t ^ this._mixCol[s3 ^ s0]; 56286 } 56287 56288 for (let j = 0, k = i * 16; j < 16; ++j, ++k) { 56289 state[j] ^= key[k]; 56290 } 56291 } 56292 56293 for (let j = 0; j < 16; ++j) { 56294 state[j] = s[state[j]]; 56295 } 56296 56297 v = state[1]; 56298 state[1] = state[5]; 56299 state[5] = state[9]; 56300 state[9] = state[13]; 56301 state[13] = v; 56302 v = state[2]; 56303 u = state[6]; 56304 state[2] = state[10]; 56305 state[6] = state[14]; 56306 state[10] = v; 56307 state[14] = u; 56308 v = state[3]; 56309 u = state[7]; 56310 t = state[11]; 56311 state[3] = state[15]; 56312 state[7] = v; 56313 state[11] = u; 56314 state[15] = t; 56315 56316 for (let j = 0, k = this._keySize; j < 16; ++j, ++k) { 56317 state[j] ^= key[k]; 56318 } 56319 56320 return state; 56321 } 56322 56323 _decryptBlock2(data, finalize) { 56324 const sourceLength = data.length; 56325 let buffer = this.buffer, 56326 bufferLength = this.bufferPosition; 56327 const result = []; 56328 let iv = this.iv; 56329 56330 for (let i = 0; i < sourceLength; ++i) { 56331 buffer[bufferLength] = data[i]; 56332 ++bufferLength; 56333 56334 if (bufferLength < 16) { 56335 continue; 56336 } 56337 56338 const plain = this._decrypt(buffer, this._key); 56339 56340 for (let j = 0; j < 16; ++j) { 56341 plain[j] ^= iv[j]; 56342 } 56343 56344 iv = buffer; 56345 result.push(plain); 56346 buffer = new Uint8Array(16); 56347 bufferLength = 0; 56348 } 56349 56350 this.buffer = buffer; 56351 this.bufferLength = bufferLength; 56352 this.iv = iv; 56353 56354 if (result.length === 0) { 56355 return new Uint8Array(0); 56356 } 56357 56358 let outputLength = 16 * result.length; 56359 56360 if (finalize) { 56361 const lastBlock = result.at(-1); 56362 let psLen = lastBlock[15]; 56363 56364 if (psLen <= 16) { 56365 for (let i = 15, ii = 16 - psLen; i >= ii; --i) { 56366 if (lastBlock[i] !== psLen) { 56367 psLen = 0; 56368 break; 56369 } 56370 } 56371 56372 outputLength -= psLen; 56373 result[result.length - 1] = lastBlock.subarray(0, 16 - psLen); 56374 } 56375 } 56376 56377 const output = new Uint8Array(outputLength); 56378 56379 for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 56380 output.set(result[i], j); 56381 } 56382 56383 return output; 56384 } 56385 56386 decryptBlock(data, finalize, iv = null) { 56387 const sourceLength = data.length; 56388 const buffer = this.buffer; 56389 let bufferLength = this.bufferPosition; 56390 56391 if (iv) { 56392 this.iv = iv; 56393 } else { 56394 for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) { 56395 buffer[bufferLength] = data[i]; 56396 } 56397 56398 if (bufferLength < 16) { 56399 this.bufferLength = bufferLength; 56400 return new Uint8Array(0); 56401 } 56402 56403 this.iv = buffer; 56404 data = data.subarray(16); 56405 } 56406 56407 this.buffer = new Uint8Array(16); 56408 this.bufferLength = 0; 56409 this.decryptBlock = this._decryptBlock2; 56410 return this.decryptBlock(data, finalize); 56411 } 56412 56413 encrypt(data, iv) { 56414 const sourceLength = data.length; 56415 let buffer = this.buffer, 56416 bufferLength = this.bufferPosition; 56417 const result = []; 56418 56419 if (!iv) { 56420 iv = new Uint8Array(16); 56421 } 56422 56423 for (let i = 0; i < sourceLength; ++i) { 56424 buffer[bufferLength] = data[i]; 56425 ++bufferLength; 56426 56427 if (bufferLength < 16) { 56428 continue; 56429 } 56430 56431 for (let j = 0; j < 16; ++j) { 56432 buffer[j] ^= iv[j]; 56433 } 56434 56435 const cipher = this._encrypt(buffer, this._key); 56436 56437 iv = cipher; 56438 result.push(cipher); 56439 buffer = new Uint8Array(16); 56440 bufferLength = 0; 56441 } 56442 56443 this.buffer = buffer; 56444 this.bufferLength = bufferLength; 56445 this.iv = iv; 56446 56447 if (result.length === 0) { 56448 return new Uint8Array(0); 56449 } 56450 56451 const outputLength = 16 * result.length; 56452 const output = new Uint8Array(outputLength); 56453 56454 for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 56455 output.set(result[i], j); 56456 } 56457 56458 return output; 56459 } 56460 56461} 56462 56463class AES128Cipher extends AESBaseCipher { 56464 constructor(key) { 56465 super(); 56466 this._cyclesOfRepetition = 10; 56467 this._keySize = 160; 56468 this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]); 56469 this._key = this._expandKey(key); 56470 } 56471 56472 _expandKey(cipherKey) { 56473 const b = 176; 56474 const s = this._s; 56475 const rcon = this._rcon; 56476 const result = new Uint8Array(b); 56477 result.set(cipherKey); 56478 56479 for (let j = 16, i = 1; j < b; ++i) { 56480 let t1 = result[j - 3]; 56481 let t2 = result[j - 2]; 56482 let t3 = result[j - 1]; 56483 let t4 = result[j - 4]; 56484 t1 = s[t1]; 56485 t2 = s[t2]; 56486 t3 = s[t3]; 56487 t4 = s[t4]; 56488 t1 ^= rcon[i]; 56489 56490 for (let n = 0; n < 4; ++n) { 56491 result[j] = t1 ^= result[j - 16]; 56492 j++; 56493 result[j] = t2 ^= result[j - 16]; 56494 j++; 56495 result[j] = t3 ^= result[j - 16]; 56496 j++; 56497 result[j] = t4 ^= result[j - 16]; 56498 j++; 56499 } 56500 } 56501 56502 return result; 56503 } 56504 56505} 56506 56507exports.AES128Cipher = AES128Cipher; 56508 56509class AES256Cipher extends AESBaseCipher { 56510 constructor(key) { 56511 super(); 56512 this._cyclesOfRepetition = 14; 56513 this._keySize = 224; 56514 this._key = this._expandKey(key); 56515 } 56516 56517 _expandKey(cipherKey) { 56518 const b = 240; 56519 const s = this._s; 56520 const result = new Uint8Array(b); 56521 result.set(cipherKey); 56522 let r = 1; 56523 let t1, t2, t3, t4; 56524 56525 for (let j = 32, i = 1; j < b; ++i) { 56526 if (j % 32 === 16) { 56527 t1 = s[t1]; 56528 t2 = s[t2]; 56529 t3 = s[t3]; 56530 t4 = s[t4]; 56531 } else if (j % 32 === 0) { 56532 t1 = result[j - 3]; 56533 t2 = result[j - 2]; 56534 t3 = result[j - 1]; 56535 t4 = result[j - 4]; 56536 t1 = s[t1]; 56537 t2 = s[t2]; 56538 t3 = s[t3]; 56539 t4 = s[t4]; 56540 t1 ^= r; 56541 56542 if ((r <<= 1) >= 256) { 56543 r = (r ^ 0x1b) & 0xff; 56544 } 56545 } 56546 56547 for (let n = 0; n < 4; ++n) { 56548 result[j] = t1 ^= result[j - 32]; 56549 j++; 56550 result[j] = t2 ^= result[j - 32]; 56551 j++; 56552 result[j] = t3 ^= result[j - 32]; 56553 j++; 56554 result[j] = t4 ^= result[j - 32]; 56555 j++; 56556 } 56557 } 56558 56559 return result; 56560 } 56561 56562} 56563 56564exports.AES256Cipher = AES256Cipher; 56565 56566class PDF17 { 56567 checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 56568 const hashData = new Uint8Array(password.length + 56); 56569 hashData.set(password, 0); 56570 hashData.set(ownerValidationSalt, password.length); 56571 hashData.set(userBytes, password.length + ownerValidationSalt.length); 56572 const result = calculateSHA256(hashData, 0, hashData.length); 56573 return (0, _util.isArrayEqual)(result, ownerPassword); 56574 } 56575 56576 checkUserPassword(password, userValidationSalt, userPassword) { 56577 const hashData = new Uint8Array(password.length + 8); 56578 hashData.set(password, 0); 56579 hashData.set(userValidationSalt, password.length); 56580 const result = calculateSHA256(hashData, 0, hashData.length); 56581 return (0, _util.isArrayEqual)(result, userPassword); 56582 } 56583 56584 getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 56585 const hashData = new Uint8Array(password.length + 56); 56586 hashData.set(password, 0); 56587 hashData.set(ownerKeySalt, password.length); 56588 hashData.set(userBytes, password.length + ownerKeySalt.length); 56589 const key = calculateSHA256(hashData, 0, hashData.length); 56590 const cipher = new AES256Cipher(key); 56591 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 56592 } 56593 56594 getUserKey(password, userKeySalt, userEncryption) { 56595 const hashData = new Uint8Array(password.length + 8); 56596 hashData.set(password, 0); 56597 hashData.set(userKeySalt, password.length); 56598 const key = calculateSHA256(hashData, 0, hashData.length); 56599 const cipher = new AES256Cipher(key); 56600 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 56601 } 56602 56603} 56604 56605exports.PDF17 = PDF17; 56606 56607const PDF20 = function PDF20Closure() { 56608 function calculatePDF20Hash(password, input, userBytes) { 56609 let k = calculateSHA256(input, 0, input.length).subarray(0, 32); 56610 let e = [0]; 56611 let i = 0; 56612 56613 while (i < 64 || e.at(-1) > i - 32) { 56614 const combinedLength = password.length + k.length + userBytes.length, 56615 combinedArray = new Uint8Array(combinedLength); 56616 let writeOffset = 0; 56617 combinedArray.set(password, writeOffset); 56618 writeOffset += password.length; 56619 combinedArray.set(k, writeOffset); 56620 writeOffset += k.length; 56621 combinedArray.set(userBytes, writeOffset); 56622 const k1 = new Uint8Array(combinedLength * 64); 56623 56624 for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) { 56625 k1.set(combinedArray, pos); 56626 } 56627 56628 const cipher = new AES128Cipher(k.subarray(0, 16)); 56629 e = cipher.encrypt(k1, k.subarray(16, 32)); 56630 let remainder = 0; 56631 56632 for (let z = 0; z < 16; z++) { 56633 remainder *= 256 % 3; 56634 remainder %= 3; 56635 remainder += (e[z] >>> 0) % 3; 56636 remainder %= 3; 56637 } 56638 56639 if (remainder === 0) { 56640 k = calculateSHA256(e, 0, e.length); 56641 } else if (remainder === 1) { 56642 k = calculateSHA384(e, 0, e.length); 56643 } else if (remainder === 2) { 56644 k = calculateSHA512(e, 0, e.length); 56645 } 56646 56647 i++; 56648 } 56649 56650 return k.subarray(0, 32); 56651 } 56652 56653 class PDF20 { 56654 hash(password, concatBytes, userBytes) { 56655 return calculatePDF20Hash(password, concatBytes, userBytes); 56656 } 56657 56658 checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 56659 const hashData = new Uint8Array(password.length + 56); 56660 hashData.set(password, 0); 56661 hashData.set(ownerValidationSalt, password.length); 56662 hashData.set(userBytes, password.length + ownerValidationSalt.length); 56663 const result = calculatePDF20Hash(password, hashData, userBytes); 56664 return (0, _util.isArrayEqual)(result, ownerPassword); 56665 } 56666 56667 checkUserPassword(password, userValidationSalt, userPassword) { 56668 const hashData = new Uint8Array(password.length + 8); 56669 hashData.set(password, 0); 56670 hashData.set(userValidationSalt, password.length); 56671 const result = calculatePDF20Hash(password, hashData, []); 56672 return (0, _util.isArrayEqual)(result, userPassword); 56673 } 56674 56675 getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 56676 const hashData = new Uint8Array(password.length + 56); 56677 hashData.set(password, 0); 56678 hashData.set(ownerKeySalt, password.length); 56679 hashData.set(userBytes, password.length + ownerKeySalt.length); 56680 const key = calculatePDF20Hash(password, hashData, userBytes); 56681 const cipher = new AES256Cipher(key); 56682 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 56683 } 56684 56685 getUserKey(password, userKeySalt, userEncryption) { 56686 const hashData = new Uint8Array(password.length + 8); 56687 hashData.set(password, 0); 56688 hashData.set(userKeySalt, password.length); 56689 const key = calculatePDF20Hash(password, hashData, []); 56690 const cipher = new AES256Cipher(key); 56691 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 56692 } 56693 56694 } 56695 56696 return PDF20; 56697}(); 56698 56699exports.PDF20 = PDF20; 56700 56701class CipherTransform { 56702 constructor(stringCipherConstructor, streamCipherConstructor) { 56703 this.StringCipherConstructor = stringCipherConstructor; 56704 this.StreamCipherConstructor = streamCipherConstructor; 56705 } 56706 56707 createStream(stream, length) { 56708 const cipher = new this.StreamCipherConstructor(); 56709 return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) { 56710 return cipher.decryptBlock(data, finalize); 56711 }); 56712 } 56713 56714 decryptString(s) { 56715 const cipher = new this.StringCipherConstructor(); 56716 let data = (0, _util.stringToBytes)(s); 56717 data = cipher.decryptBlock(data, true); 56718 return (0, _util.bytesToString)(data); 56719 } 56720 56721 encryptString(s) { 56722 const cipher = new this.StringCipherConstructor(); 56723 56724 if (cipher instanceof AESBaseCipher) { 56725 const strLen = s.length; 56726 const pad = 16 - strLen % 16; 56727 s += String.fromCharCode(pad).repeat(pad); 56728 const iv = new Uint8Array(16); 56729 56730 if (typeof crypto !== "undefined") { 56731 crypto.getRandomValues(iv); 56732 } else { 56733 for (let i = 0; i < 16; i++) { 56734 iv[i] = Math.floor(256 * Math.random()); 56735 } 56736 } 56737 56738 let data = (0, _util.stringToBytes)(s); 56739 data = cipher.encrypt(data, iv); 56740 const buf = new Uint8Array(16 + data.length); 56741 buf.set(iv); 56742 buf.set(data, 16); 56743 return (0, _util.bytesToString)(buf); 56744 } 56745 56746 let data = (0, _util.stringToBytes)(s); 56747 data = cipher.encrypt(data); 56748 return (0, _util.bytesToString)(data); 56749 } 56750 56751} 56752 56753const CipherTransformFactory = function CipherTransformFactoryClosure() { 56754 const defaultPasswordBytes = new Uint8Array([0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a]); 56755 56756 function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) { 56757 if (password) { 56758 const passwordLength = Math.min(127, password.length); 56759 password = password.subarray(0, passwordLength); 56760 } else { 56761 password = []; 56762 } 56763 56764 let pdfAlgorithm; 56765 56766 if (revision === 6) { 56767 pdfAlgorithm = new PDF20(); 56768 } else { 56769 pdfAlgorithm = new PDF17(); 56770 } 56771 56772 if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) { 56773 return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption); 56774 } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) { 56775 return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption); 56776 } 56777 56778 return null; 56779 } 56780 56781 function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) { 56782 const hashDataSize = 40 + ownerPassword.length + fileId.length; 56783 const hashData = new Uint8Array(hashDataSize); 56784 let i = 0, 56785 j, 56786 n; 56787 56788 if (password) { 56789 n = Math.min(32, password.length); 56790 56791 for (; i < n; ++i) { 56792 hashData[i] = password[i]; 56793 } 56794 } 56795 56796 j = 0; 56797 56798 while (i < 32) { 56799 hashData[i++] = defaultPasswordBytes[j++]; 56800 } 56801 56802 for (j = 0, n = ownerPassword.length; j < n; ++j) { 56803 hashData[i++] = ownerPassword[j]; 56804 } 56805 56806 hashData[i++] = flags & 0xff; 56807 hashData[i++] = flags >> 8 & 0xff; 56808 hashData[i++] = flags >> 16 & 0xff; 56809 hashData[i++] = flags >>> 24 & 0xff; 56810 56811 for (j = 0, n = fileId.length; j < n; ++j) { 56812 hashData[i++] = fileId[j]; 56813 } 56814 56815 if (revision >= 4 && !encryptMetadata) { 56816 hashData[i++] = 0xff; 56817 hashData[i++] = 0xff; 56818 hashData[i++] = 0xff; 56819 hashData[i++] = 0xff; 56820 } 56821 56822 let hash = calculateMD5(hashData, 0, i); 56823 const keyLengthInBytes = keyLength >> 3; 56824 56825 if (revision >= 3) { 56826 for (j = 0; j < 50; ++j) { 56827 hash = calculateMD5(hash, 0, keyLengthInBytes); 56828 } 56829 } 56830 56831 const encryptionKey = hash.subarray(0, keyLengthInBytes); 56832 let cipher, checkData; 56833 56834 if (revision >= 3) { 56835 for (i = 0; i < 32; ++i) { 56836 hashData[i] = defaultPasswordBytes[i]; 56837 } 56838 56839 for (j = 0, n = fileId.length; j < n; ++j) { 56840 hashData[i++] = fileId[j]; 56841 } 56842 56843 cipher = new ARCFourCipher(encryptionKey); 56844 checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i)); 56845 n = encryptionKey.length; 56846 const derivedKey = new Uint8Array(n); 56847 56848 for (j = 1; j <= 19; ++j) { 56849 for (let k = 0; k < n; ++k) { 56850 derivedKey[k] = encryptionKey[k] ^ j; 56851 } 56852 56853 cipher = new ARCFourCipher(derivedKey); 56854 checkData = cipher.encryptBlock(checkData); 56855 } 56856 56857 for (j = 0, n = checkData.length; j < n; ++j) { 56858 if (userPassword[j] !== checkData[j]) { 56859 return null; 56860 } 56861 } 56862 } else { 56863 cipher = new ARCFourCipher(encryptionKey); 56864 checkData = cipher.encryptBlock(defaultPasswordBytes); 56865 56866 for (j = 0, n = checkData.length; j < n; ++j) { 56867 if (userPassword[j] !== checkData[j]) { 56868 return null; 56869 } 56870 } 56871 } 56872 56873 return encryptionKey; 56874 } 56875 56876 function decodeUserPassword(password, ownerPassword, revision, keyLength) { 56877 const hashData = new Uint8Array(32); 56878 let i = 0; 56879 const n = Math.min(32, password.length); 56880 56881 for (; i < n; ++i) { 56882 hashData[i] = password[i]; 56883 } 56884 56885 let j = 0; 56886 56887 while (i < 32) { 56888 hashData[i++] = defaultPasswordBytes[j++]; 56889 } 56890 56891 let hash = calculateMD5(hashData, 0, i); 56892 const keyLengthInBytes = keyLength >> 3; 56893 56894 if (revision >= 3) { 56895 for (j = 0; j < 50; ++j) { 56896 hash = calculateMD5(hash, 0, hash.length); 56897 } 56898 } 56899 56900 let cipher, userPassword; 56901 56902 if (revision >= 3) { 56903 userPassword = ownerPassword; 56904 const derivedKey = new Uint8Array(keyLengthInBytes); 56905 56906 for (j = 19; j >= 0; j--) { 56907 for (let k = 0; k < keyLengthInBytes; ++k) { 56908 derivedKey[k] = hash[k] ^ j; 56909 } 56910 56911 cipher = new ARCFourCipher(derivedKey); 56912 userPassword = cipher.encryptBlock(userPassword); 56913 } 56914 } else { 56915 cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes)); 56916 userPassword = cipher.encryptBlock(ownerPassword); 56917 } 56918 56919 return userPassword; 56920 } 56921 56922 const identityName = _primitives.Name.get("Identity"); 56923 56924 function buildObjectKey(num, gen, encryptionKey, isAes = false) { 56925 const key = new Uint8Array(encryptionKey.length + 9); 56926 const n = encryptionKey.length; 56927 let i; 56928 56929 for (i = 0; i < n; ++i) { 56930 key[i] = encryptionKey[i]; 56931 } 56932 56933 key[i++] = num & 0xff; 56934 key[i++] = num >> 8 & 0xff; 56935 key[i++] = num >> 16 & 0xff; 56936 key[i++] = gen & 0xff; 56937 key[i++] = gen >> 8 & 0xff; 56938 56939 if (isAes) { 56940 key[i++] = 0x73; 56941 key[i++] = 0x41; 56942 key[i++] = 0x6c; 56943 key[i++] = 0x54; 56944 } 56945 56946 const hash = calculateMD5(key, 0, i); 56947 return hash.subarray(0, Math.min(encryptionKey.length + 5, 16)); 56948 } 56949 56950 function buildCipherConstructor(cf, name, num, gen, key) { 56951 if (!(name instanceof _primitives.Name)) { 56952 throw new _util.FormatError("Invalid crypt filter name."); 56953 } 56954 56955 const cryptFilter = cf.get(name.name); 56956 let cfm; 56957 56958 if (cryptFilter !== null && cryptFilter !== undefined) { 56959 cfm = cryptFilter.get("CFM"); 56960 } 56961 56962 if (!cfm || cfm.name === "None") { 56963 return function cipherTransformFactoryBuildCipherConstructorNone() { 56964 return new NullCipher(); 56965 }; 56966 } 56967 56968 if (cfm.name === "V2") { 56969 return function cipherTransformFactoryBuildCipherConstructorV2() { 56970 return new ARCFourCipher(buildObjectKey(num, gen, key, false)); 56971 }; 56972 } 56973 56974 if (cfm.name === "AESV2") { 56975 return function cipherTransformFactoryBuildCipherConstructorAESV2() { 56976 return new AES128Cipher(buildObjectKey(num, gen, key, true)); 56977 }; 56978 } 56979 56980 if (cfm.name === "AESV3") { 56981 return function cipherTransformFactoryBuildCipherConstructorAESV3() { 56982 return new AES256Cipher(key); 56983 }; 56984 } 56985 56986 throw new _util.FormatError("Unknown crypto method"); 56987 } 56988 56989 class CipherTransformFactory { 56990 constructor(dict, fileId, password) { 56991 const filter = dict.get("Filter"); 56992 56993 if (!(0, _primitives.isName)(filter, "Standard")) { 56994 throw new _util.FormatError("unknown encryption method"); 56995 } 56996 56997 this.filterName = filter.name; 56998 this.dict = dict; 56999 const algorithm = dict.get("V"); 57000 57001 if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) { 57002 throw new _util.FormatError("unsupported encryption algorithm"); 57003 } 57004 57005 this.algorithm = algorithm; 57006 let keyLength = dict.get("Length"); 57007 57008 if (!keyLength) { 57009 if (algorithm <= 3) { 57010 keyLength = 40; 57011 } else { 57012 const cfDict = dict.get("CF"); 57013 const streamCryptoName = dict.get("StmF"); 57014 57015 if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) { 57016 cfDict.suppressEncryption = true; 57017 const handlerDict = cfDict.get(streamCryptoName.name); 57018 keyLength = handlerDict && handlerDict.get("Length") || 128; 57019 57020 if (keyLength < 40) { 57021 keyLength <<= 3; 57022 } 57023 } 57024 } 57025 } 57026 57027 if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) { 57028 throw new _util.FormatError("invalid key length"); 57029 } 57030 57031 const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32); 57032 const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32); 57033 const flags = dict.get("P"); 57034 const revision = dict.get("R"); 57035 const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false; 57036 this.encryptMetadata = encryptMetadata; 57037 const fileIdBytes = (0, _util.stringToBytes)(fileId); 57038 let passwordBytes; 57039 57040 if (password) { 57041 if (revision === 6) { 57042 try { 57043 password = (0, _util.utf8StringToString)(password); 57044 } catch (ex) { 57045 (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password."); 57046 } 57047 } 57048 57049 passwordBytes = (0, _util.stringToBytes)(password); 57050 } 57051 57052 let encryptionKey; 57053 57054 if (algorithm !== 5) { 57055 encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 57056 } else { 57057 const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40); 57058 const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48); 57059 const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48); 57060 const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40); 57061 const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48); 57062 const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE")); 57063 const userEncryption = (0, _util.stringToBytes)(dict.get("UE")); 57064 const perms = (0, _util.stringToBytes)(dict.get("Perms")); 57065 encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms); 57066 } 57067 57068 if (!encryptionKey && !password) { 57069 throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD); 57070 } else if (!encryptionKey && password) { 57071 const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength); 57072 encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 57073 } 57074 57075 if (!encryptionKey) { 57076 throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD); 57077 } 57078 57079 this.encryptionKey = encryptionKey; 57080 57081 if (algorithm >= 4) { 57082 const cf = dict.get("CF"); 57083 57084 if (cf instanceof _primitives.Dict) { 57085 cf.suppressEncryption = true; 57086 } 57087 57088 this.cf = cf; 57089 this.stmf = dict.get("StmF") || identityName; 57090 this.strf = dict.get("StrF") || identityName; 57091 this.eff = dict.get("EFF") || this.stmf; 57092 } 57093 } 57094 57095 createCipherTransform(num, gen) { 57096 if (this.algorithm === 4 || this.algorithm === 5) { 57097 return new CipherTransform(buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey)); 57098 } 57099 57100 const key = buildObjectKey(num, gen, this.encryptionKey, false); 57101 57102 const cipherConstructor = function buildCipherCipherConstructor() { 57103 return new ARCFourCipher(key); 57104 }; 57105 57106 return new CipherTransform(cipherConstructor, cipherConstructor); 57107 } 57108 57109 } 57110 57111 return CipherTransformFactory; 57112}(); 57113 57114exports.CipherTransformFactory = CipherTransformFactory; 57115 57116/***/ }), 57117/* 68 */ 57118/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 57119 57120 57121 57122Object.defineProperty(exports, "__esModule", ({ 57123 value: true 57124})); 57125exports.DecryptStream = void 0; 57126 57127var _decode_stream = __w_pdfjs_require__(19); 57128 57129const chunkSize = 512; 57130 57131class DecryptStream extends _decode_stream.DecodeStream { 57132 constructor(str, maybeLength, decrypt) { 57133 super(maybeLength); 57134 this.str = str; 57135 this.dict = str.dict; 57136 this.decrypt = decrypt; 57137 this.nextChunk = null; 57138 this.initialized = false; 57139 } 57140 57141 readBlock() { 57142 let chunk; 57143 57144 if (this.initialized) { 57145 chunk = this.nextChunk; 57146 } else { 57147 chunk = this.str.getBytes(chunkSize); 57148 this.initialized = true; 57149 } 57150 57151 if (!chunk || chunk.length === 0) { 57152 this.eof = true; 57153 return; 57154 } 57155 57156 this.nextChunk = this.str.getBytes(chunkSize); 57157 const hasMoreData = this.nextChunk && this.nextChunk.length > 0; 57158 const decrypt = this.decrypt; 57159 chunk = decrypt(chunk, !hasMoreData); 57160 let bufferLength = this.bufferLength; 57161 const n = chunk.length, 57162 buffer = this.ensureBuffer(bufferLength + n); 57163 57164 for (let i = 0; i < n; i++) { 57165 buffer[bufferLength++] = chunk[i]; 57166 } 57167 57168 this.bufferLength = bufferLength; 57169 } 57170 57171} 57172 57173exports.DecryptStream = DecryptStream; 57174 57175/***/ }), 57176/* 69 */ 57177/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 57178 57179 57180 57181Object.defineProperty(exports, "__esModule", ({ 57182 value: true 57183})); 57184exports.Catalog = void 0; 57185 57186var _core_utils = __w_pdfjs_require__(6); 57187 57188var _util = __w_pdfjs_require__(2); 57189 57190var _primitives = __w_pdfjs_require__(5); 57191 57192var _name_number_tree = __w_pdfjs_require__(70); 57193 57194var _base_stream = __w_pdfjs_require__(7); 57195 57196var _cleanup_helper = __w_pdfjs_require__(71); 57197 57198var _colorspace = __w_pdfjs_require__(14); 57199 57200var _file_spec = __w_pdfjs_require__(72); 57201 57202var _image_utils = __w_pdfjs_require__(59); 57203 57204var _metadata_parser = __w_pdfjs_require__(73); 57205 57206var _struct_tree = __w_pdfjs_require__(74); 57207 57208function fetchDestination(dest) { 57209 if (dest instanceof _primitives.Dict) { 57210 dest = dest.get("D"); 57211 } 57212 57213 return Array.isArray(dest) ? dest : null; 57214} 57215 57216class Catalog { 57217 constructor(pdfManager, xref) { 57218 this.pdfManager = pdfManager; 57219 this.xref = xref; 57220 this._catDict = xref.getCatalogObj(); 57221 57222 if (!(this._catDict instanceof _primitives.Dict)) { 57223 throw new _util.FormatError("Catalog object is not a dictionary."); 57224 } 57225 57226 this.toplevelPagesDict; 57227 this._actualNumPages = null; 57228 this.fontCache = new _primitives.RefSetCache(); 57229 this.builtInCMapCache = new Map(); 57230 this.standardFontDataCache = new Map(); 57231 this.globalImageCache = new _image_utils.GlobalImageCache(); 57232 this.pageKidsCountCache = new _primitives.RefSetCache(); 57233 this.pageIndexCache = new _primitives.RefSetCache(); 57234 this.nonBlendModesSet = new _primitives.RefSet(); 57235 } 57236 57237 get version() { 57238 const version = this._catDict.get("Version"); 57239 57240 return (0, _util.shadow)(this, "version", version instanceof _primitives.Name ? version.name : null); 57241 } 57242 57243 get lang() { 57244 const lang = this._catDict.get("Lang"); 57245 57246 return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null); 57247 } 57248 57249 get needsRendering() { 57250 const needsRendering = this._catDict.get("NeedsRendering"); 57251 57252 return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false); 57253 } 57254 57255 get collection() { 57256 let collection = null; 57257 57258 try { 57259 const obj = this._catDict.get("Collection"); 57260 57261 if (obj instanceof _primitives.Dict && obj.size > 0) { 57262 collection = obj; 57263 } 57264 } catch (ex) { 57265 if (ex instanceof _core_utils.MissingDataException) { 57266 throw ex; 57267 } 57268 57269 (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present."); 57270 } 57271 57272 return (0, _util.shadow)(this, "collection", collection); 57273 } 57274 57275 get acroForm() { 57276 let acroForm = null; 57277 57278 try { 57279 const obj = this._catDict.get("AcroForm"); 57280 57281 if (obj instanceof _primitives.Dict && obj.size > 0) { 57282 acroForm = obj; 57283 } 57284 } catch (ex) { 57285 if (ex instanceof _core_utils.MissingDataException) { 57286 throw ex; 57287 } 57288 57289 (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present."); 57290 } 57291 57292 return (0, _util.shadow)(this, "acroForm", acroForm); 57293 } 57294 57295 get acroFormRef() { 57296 const value = this._catDict.getRaw("AcroForm"); 57297 57298 return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null); 57299 } 57300 57301 get metadata() { 57302 const streamRef = this._catDict.getRaw("Metadata"); 57303 57304 if (!(streamRef instanceof _primitives.Ref)) { 57305 return (0, _util.shadow)(this, "metadata", null); 57306 } 57307 57308 let metadata = null; 57309 57310 try { 57311 const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata); 57312 const stream = this.xref.fetch(streamRef, suppressEncryption); 57313 57314 if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) { 57315 const type = stream.dict.get("Type"); 57316 const subtype = stream.dict.get("Subtype"); 57317 57318 if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) { 57319 const data = (0, _util.stringToUTF8String)(stream.getString()); 57320 57321 if (data) { 57322 metadata = new _metadata_parser.MetadataParser(data).serializable; 57323 } 57324 } 57325 } 57326 } catch (ex) { 57327 if (ex instanceof _core_utils.MissingDataException) { 57328 throw ex; 57329 } 57330 57331 (0, _util.info)(`Skipping invalid Metadata: "${ex}".`); 57332 } 57333 57334 return (0, _util.shadow)(this, "metadata", metadata); 57335 } 57336 57337 get markInfo() { 57338 let markInfo = null; 57339 57340 try { 57341 markInfo = this._readMarkInfo(); 57342 } catch (ex) { 57343 if (ex instanceof _core_utils.MissingDataException) { 57344 throw ex; 57345 } 57346 57347 (0, _util.warn)("Unable to read mark info."); 57348 } 57349 57350 return (0, _util.shadow)(this, "markInfo", markInfo); 57351 } 57352 57353 _readMarkInfo() { 57354 const obj = this._catDict.get("MarkInfo"); 57355 57356 if (!(obj instanceof _primitives.Dict)) { 57357 return null; 57358 } 57359 57360 const markInfo = { 57361 Marked: false, 57362 UserProperties: false, 57363 Suspects: false 57364 }; 57365 57366 for (const key in markInfo) { 57367 const value = obj.get(key); 57368 57369 if (typeof value === "boolean") { 57370 markInfo[key] = value; 57371 } 57372 } 57373 57374 return markInfo; 57375 } 57376 57377 get structTreeRoot() { 57378 let structTree = null; 57379 57380 try { 57381 structTree = this._readStructTreeRoot(); 57382 } catch (ex) { 57383 if (ex instanceof _core_utils.MissingDataException) { 57384 throw ex; 57385 } 57386 57387 (0, _util.warn)("Unable read to structTreeRoot info."); 57388 } 57389 57390 return (0, _util.shadow)(this, "structTreeRoot", structTree); 57391 } 57392 57393 _readStructTreeRoot() { 57394 const obj = this._catDict.get("StructTreeRoot"); 57395 57396 if (!(obj instanceof _primitives.Dict)) { 57397 return null; 57398 } 57399 57400 const root = new _struct_tree.StructTreeRoot(obj); 57401 root.init(); 57402 return root; 57403 } 57404 57405 get toplevelPagesDict() { 57406 const pagesObj = this._catDict.get("Pages"); 57407 57408 if (!(pagesObj instanceof _primitives.Dict)) { 57409 throw new _util.FormatError("Invalid top-level pages dictionary."); 57410 } 57411 57412 return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj); 57413 } 57414 57415 get documentOutline() { 57416 let obj = null; 57417 57418 try { 57419 obj = this._readDocumentOutline(); 57420 } catch (ex) { 57421 if (ex instanceof _core_utils.MissingDataException) { 57422 throw ex; 57423 } 57424 57425 (0, _util.warn)("Unable to read document outline."); 57426 } 57427 57428 return (0, _util.shadow)(this, "documentOutline", obj); 57429 } 57430 57431 _readDocumentOutline() { 57432 let obj = this._catDict.get("Outlines"); 57433 57434 if (!(obj instanceof _primitives.Dict)) { 57435 return null; 57436 } 57437 57438 obj = obj.getRaw("First"); 57439 57440 if (!(obj instanceof _primitives.Ref)) { 57441 return null; 57442 } 57443 57444 const root = { 57445 items: [] 57446 }; 57447 const queue = [{ 57448 obj, 57449 parent: root 57450 }]; 57451 const processed = new _primitives.RefSet(); 57452 processed.put(obj); 57453 const xref = this.xref, 57454 blackColor = new Uint8ClampedArray(3); 57455 57456 while (queue.length > 0) { 57457 const i = queue.shift(); 57458 const outlineDict = xref.fetchIfRef(i.obj); 57459 57460 if (outlineDict === null) { 57461 continue; 57462 } 57463 57464 if (!outlineDict.has("Title")) { 57465 throw new _util.FormatError("Invalid outline item encountered."); 57466 } 57467 57468 const data = { 57469 url: null, 57470 dest: null 57471 }; 57472 Catalog.parseDestDictionary({ 57473 destDict: outlineDict, 57474 resultObj: data, 57475 docBaseUrl: this.pdfManager.docBaseUrl 57476 }); 57477 const title = outlineDict.get("Title"); 57478 const flags = outlineDict.get("F") || 0; 57479 const color = outlineDict.getArray("C"); 57480 const count = outlineDict.get("Count"); 57481 let rgbColor = blackColor; 57482 57483 if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) { 57484 rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0); 57485 } 57486 57487 const outlineItem = { 57488 dest: data.dest, 57489 url: data.url, 57490 unsafeUrl: data.unsafeUrl, 57491 newWindow: data.newWindow, 57492 title: (0, _util.stringToPDFString)(title), 57493 color: rgbColor, 57494 count: Number.isInteger(count) ? count : undefined, 57495 bold: !!(flags & 2), 57496 italic: !!(flags & 1), 57497 items: [] 57498 }; 57499 i.parent.items.push(outlineItem); 57500 obj = outlineDict.getRaw("First"); 57501 57502 if (obj instanceof _primitives.Ref && !processed.has(obj)) { 57503 queue.push({ 57504 obj, 57505 parent: outlineItem 57506 }); 57507 processed.put(obj); 57508 } 57509 57510 obj = outlineDict.getRaw("Next"); 57511 57512 if (obj instanceof _primitives.Ref && !processed.has(obj)) { 57513 queue.push({ 57514 obj, 57515 parent: i.parent 57516 }); 57517 processed.put(obj); 57518 } 57519 } 57520 57521 return root.items.length > 0 ? root.items : null; 57522 } 57523 57524 get permissions() { 57525 let permissions = null; 57526 57527 try { 57528 permissions = this._readPermissions(); 57529 } catch (ex) { 57530 if (ex instanceof _core_utils.MissingDataException) { 57531 throw ex; 57532 } 57533 57534 (0, _util.warn)("Unable to read permissions."); 57535 } 57536 57537 return (0, _util.shadow)(this, "permissions", permissions); 57538 } 57539 57540 _readPermissions() { 57541 const encrypt = this.xref.trailer.get("Encrypt"); 57542 57543 if (!(encrypt instanceof _primitives.Dict)) { 57544 return null; 57545 } 57546 57547 let flags = encrypt.get("P"); 57548 57549 if (typeof flags !== "number") { 57550 return null; 57551 } 57552 57553 flags += 2 ** 32; 57554 const permissions = []; 57555 57556 for (const key in _util.PermissionFlag) { 57557 const value = _util.PermissionFlag[key]; 57558 57559 if (flags & value) { 57560 permissions.push(value); 57561 } 57562 } 57563 57564 return permissions; 57565 } 57566 57567 get optionalContentConfig() { 57568 let config = null; 57569 57570 try { 57571 const properties = this._catDict.get("OCProperties"); 57572 57573 if (!properties) { 57574 return (0, _util.shadow)(this, "optionalContentConfig", null); 57575 } 57576 57577 const defaultConfig = properties.get("D"); 57578 57579 if (!defaultConfig) { 57580 return (0, _util.shadow)(this, "optionalContentConfig", null); 57581 } 57582 57583 const groupsData = properties.get("OCGs"); 57584 57585 if (!Array.isArray(groupsData)) { 57586 return (0, _util.shadow)(this, "optionalContentConfig", null); 57587 } 57588 57589 const groups = []; 57590 const groupRefs = []; 57591 57592 for (const groupRef of groupsData) { 57593 if (!(groupRef instanceof _primitives.Ref)) { 57594 continue; 57595 } 57596 57597 groupRefs.push(groupRef); 57598 const group = this.xref.fetchIfRef(groupRef); 57599 groups.push({ 57600 id: groupRef.toString(), 57601 name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null, 57602 intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null 57603 }); 57604 } 57605 57606 config = this._readOptionalContentConfig(defaultConfig, groupRefs); 57607 config.groups = groups; 57608 } catch (ex) { 57609 if (ex instanceof _core_utils.MissingDataException) { 57610 throw ex; 57611 } 57612 57613 (0, _util.warn)(`Unable to read optional content config: ${ex}`); 57614 } 57615 57616 return (0, _util.shadow)(this, "optionalContentConfig", config); 57617 } 57618 57619 _readOptionalContentConfig(config, contentGroupRefs) { 57620 function parseOnOff(refs) { 57621 const onParsed = []; 57622 57623 if (Array.isArray(refs)) { 57624 for (const value of refs) { 57625 if (!(value instanceof _primitives.Ref)) { 57626 continue; 57627 } 57628 57629 if (contentGroupRefs.includes(value)) { 57630 onParsed.push(value.toString()); 57631 } 57632 } 57633 } 57634 57635 return onParsed; 57636 } 57637 57638 function parseOrder(refs, nestedLevels = 0) { 57639 if (!Array.isArray(refs)) { 57640 return null; 57641 } 57642 57643 const order = []; 57644 57645 for (const value of refs) { 57646 if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) { 57647 parsedOrderRefs.put(value); 57648 order.push(value.toString()); 57649 continue; 57650 } 57651 57652 const nestedOrder = parseNestedOrder(value, nestedLevels); 57653 57654 if (nestedOrder) { 57655 order.push(nestedOrder); 57656 } 57657 } 57658 57659 if (nestedLevels > 0) { 57660 return order; 57661 } 57662 57663 const hiddenGroups = []; 57664 57665 for (const groupRef of contentGroupRefs) { 57666 if (parsedOrderRefs.has(groupRef)) { 57667 continue; 57668 } 57669 57670 hiddenGroups.push(groupRef.toString()); 57671 } 57672 57673 if (hiddenGroups.length) { 57674 order.push({ 57675 name: null, 57676 order: hiddenGroups 57677 }); 57678 } 57679 57680 return order; 57681 } 57682 57683 function parseNestedOrder(ref, nestedLevels) { 57684 if (++nestedLevels > MAX_NESTED_LEVELS) { 57685 (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS."); 57686 return null; 57687 } 57688 57689 const value = xref.fetchIfRef(ref); 57690 57691 if (!Array.isArray(value)) { 57692 return null; 57693 } 57694 57695 const nestedName = xref.fetchIfRef(value[0]); 57696 57697 if (typeof nestedName !== "string") { 57698 return null; 57699 } 57700 57701 const nestedOrder = parseOrder(value.slice(1), nestedLevels); 57702 57703 if (!nestedOrder || !nestedOrder.length) { 57704 return null; 57705 } 57706 57707 return { 57708 name: (0, _util.stringToPDFString)(nestedName), 57709 order: nestedOrder 57710 }; 57711 } 57712 57713 const xref = this.xref, 57714 parsedOrderRefs = new _primitives.RefSet(), 57715 MAX_NESTED_LEVELS = 10; 57716 return { 57717 name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null, 57718 creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null, 57719 baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null, 57720 on: parseOnOff(config.get("ON")), 57721 off: parseOnOff(config.get("OFF")), 57722 order: parseOrder(config.get("Order")), 57723 groups: null 57724 }; 57725 } 57726 57727 setActualNumPages(num = null) { 57728 this._actualNumPages = num; 57729 } 57730 57731 get hasActualNumPages() { 57732 return this._actualNumPages !== null; 57733 } 57734 57735 get _pagesCount() { 57736 const obj = this.toplevelPagesDict.get("Count"); 57737 57738 if (!Number.isInteger(obj)) { 57739 throw new _util.FormatError("Page count in top-level pages dictionary is not an integer."); 57740 } 57741 57742 return (0, _util.shadow)(this, "_pagesCount", obj); 57743 } 57744 57745 get numPages() { 57746 return this.hasActualNumPages ? this._actualNumPages : this._pagesCount; 57747 } 57748 57749 get destinations() { 57750 const obj = this._readDests(), 57751 dests = Object.create(null); 57752 57753 if (obj instanceof _name_number_tree.NameTree) { 57754 for (const [key, value] of obj.getAll()) { 57755 const dest = fetchDestination(value); 57756 57757 if (dest) { 57758 dests[(0, _util.stringToPDFString)(key)] = dest; 57759 } 57760 } 57761 } else if (obj instanceof _primitives.Dict) { 57762 obj.forEach(function (key, value) { 57763 const dest = fetchDestination(value); 57764 57765 if (dest) { 57766 dests[key] = dest; 57767 } 57768 }); 57769 } 57770 57771 return (0, _util.shadow)(this, "destinations", dests); 57772 } 57773 57774 getDestination(id) { 57775 const obj = this._readDests(); 57776 57777 if (obj instanceof _name_number_tree.NameTree) { 57778 const dest = fetchDestination(obj.get(id)); 57779 57780 if (dest) { 57781 return dest; 57782 } 57783 57784 const allDest = this.destinations[id]; 57785 57786 if (allDest) { 57787 (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`); 57788 return allDest; 57789 } 57790 } else if (obj instanceof _primitives.Dict) { 57791 const dest = fetchDestination(obj.get(id)); 57792 57793 if (dest) { 57794 return dest; 57795 } 57796 } 57797 57798 return null; 57799 } 57800 57801 _readDests() { 57802 const obj = this._catDict.get("Names"); 57803 57804 if (obj && obj.has("Dests")) { 57805 return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref); 57806 } else if (this._catDict.has("Dests")) { 57807 return this._catDict.get("Dests"); 57808 } 57809 57810 return undefined; 57811 } 57812 57813 get pageLabels() { 57814 let obj = null; 57815 57816 try { 57817 obj = this._readPageLabels(); 57818 } catch (ex) { 57819 if (ex instanceof _core_utils.MissingDataException) { 57820 throw ex; 57821 } 57822 57823 (0, _util.warn)("Unable to read page labels."); 57824 } 57825 57826 return (0, _util.shadow)(this, "pageLabels", obj); 57827 } 57828 57829 _readPageLabels() { 57830 const obj = this._catDict.getRaw("PageLabels"); 57831 57832 if (!obj) { 57833 return null; 57834 } 57835 57836 const pageLabels = new Array(this.numPages); 57837 let style = null, 57838 prefix = ""; 57839 const numberTree = new _name_number_tree.NumberTree(obj, this.xref); 57840 const nums = numberTree.getAll(); 57841 let currentLabel = "", 57842 currentIndex = 1; 57843 57844 for (let i = 0, ii = this.numPages; i < ii; i++) { 57845 const labelDict = nums.get(i); 57846 57847 if (labelDict !== undefined) { 57848 if (!(labelDict instanceof _primitives.Dict)) { 57849 throw new _util.FormatError("PageLabel is not a dictionary."); 57850 } 57851 57852 if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) { 57853 throw new _util.FormatError("Invalid type in PageLabel dictionary."); 57854 } 57855 57856 if (labelDict.has("S")) { 57857 const s = labelDict.get("S"); 57858 57859 if (!(s instanceof _primitives.Name)) { 57860 throw new _util.FormatError("Invalid style in PageLabel dictionary."); 57861 } 57862 57863 style = s.name; 57864 } else { 57865 style = null; 57866 } 57867 57868 if (labelDict.has("P")) { 57869 const p = labelDict.get("P"); 57870 57871 if (typeof p !== "string") { 57872 throw new _util.FormatError("Invalid prefix in PageLabel dictionary."); 57873 } 57874 57875 prefix = (0, _util.stringToPDFString)(p); 57876 } else { 57877 prefix = ""; 57878 } 57879 57880 if (labelDict.has("St")) { 57881 const st = labelDict.get("St"); 57882 57883 if (!(Number.isInteger(st) && st >= 1)) { 57884 throw new _util.FormatError("Invalid start in PageLabel dictionary."); 57885 } 57886 57887 currentIndex = st; 57888 } else { 57889 currentIndex = 1; 57890 } 57891 } 57892 57893 switch (style) { 57894 case "D": 57895 currentLabel = currentIndex; 57896 break; 57897 57898 case "R": 57899 case "r": 57900 currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r"); 57901 break; 57902 57903 case "A": 57904 case "a": 57905 const LIMIT = 26; 57906 const A_UPPER_CASE = 0x41, 57907 A_LOWER_CASE = 0x61; 57908 const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE; 57909 const letterIndex = currentIndex - 1; 57910 const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT); 57911 currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1); 57912 break; 57913 57914 default: 57915 if (style) { 57916 throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`); 57917 } 57918 57919 currentLabel = ""; 57920 } 57921 57922 pageLabels[i] = prefix + currentLabel; 57923 currentIndex++; 57924 } 57925 57926 return pageLabels; 57927 } 57928 57929 get pageLayout() { 57930 const obj = this._catDict.get("PageLayout"); 57931 57932 let pageLayout = ""; 57933 57934 if (obj instanceof _primitives.Name) { 57935 switch (obj.name) { 57936 case "SinglePage": 57937 case "OneColumn": 57938 case "TwoColumnLeft": 57939 case "TwoColumnRight": 57940 case "TwoPageLeft": 57941 case "TwoPageRight": 57942 pageLayout = obj.name; 57943 } 57944 } 57945 57946 return (0, _util.shadow)(this, "pageLayout", pageLayout); 57947 } 57948 57949 get pageMode() { 57950 const obj = this._catDict.get("PageMode"); 57951 57952 let pageMode = "UseNone"; 57953 57954 if (obj instanceof _primitives.Name) { 57955 switch (obj.name) { 57956 case "UseNone": 57957 case "UseOutlines": 57958 case "UseThumbs": 57959 case "FullScreen": 57960 case "UseOC": 57961 case "UseAttachments": 57962 pageMode = obj.name; 57963 } 57964 } 57965 57966 return (0, _util.shadow)(this, "pageMode", pageMode); 57967 } 57968 57969 get viewerPreferences() { 57970 const obj = this._catDict.get("ViewerPreferences"); 57971 57972 if (!(obj instanceof _primitives.Dict)) { 57973 return (0, _util.shadow)(this, "viewerPreferences", null); 57974 } 57975 57976 let prefs = null; 57977 57978 for (const key of obj.getKeys()) { 57979 const value = obj.get(key); 57980 let prefValue; 57981 57982 switch (key) { 57983 case "HideToolbar": 57984 case "HideMenubar": 57985 case "HideWindowUI": 57986 case "FitWindow": 57987 case "CenterWindow": 57988 case "DisplayDocTitle": 57989 case "PickTrayByPDFSize": 57990 if (typeof value === "boolean") { 57991 prefValue = value; 57992 } 57993 57994 break; 57995 57996 case "NonFullScreenPageMode": 57997 if (value instanceof _primitives.Name) { 57998 switch (value.name) { 57999 case "UseNone": 58000 case "UseOutlines": 58001 case "UseThumbs": 58002 case "UseOC": 58003 prefValue = value.name; 58004 break; 58005 58006 default: 58007 prefValue = "UseNone"; 58008 } 58009 } 58010 58011 break; 58012 58013 case "Direction": 58014 if (value instanceof _primitives.Name) { 58015 switch (value.name) { 58016 case "L2R": 58017 case "R2L": 58018 prefValue = value.name; 58019 break; 58020 58021 default: 58022 prefValue = "L2R"; 58023 } 58024 } 58025 58026 break; 58027 58028 case "ViewArea": 58029 case "ViewClip": 58030 case "PrintArea": 58031 case "PrintClip": 58032 if (value instanceof _primitives.Name) { 58033 switch (value.name) { 58034 case "MediaBox": 58035 case "CropBox": 58036 case "BleedBox": 58037 case "TrimBox": 58038 case "ArtBox": 58039 prefValue = value.name; 58040 break; 58041 58042 default: 58043 prefValue = "CropBox"; 58044 } 58045 } 58046 58047 break; 58048 58049 case "PrintScaling": 58050 if (value instanceof _primitives.Name) { 58051 switch (value.name) { 58052 case "None": 58053 case "AppDefault": 58054 prefValue = value.name; 58055 break; 58056 58057 default: 58058 prefValue = "AppDefault"; 58059 } 58060 } 58061 58062 break; 58063 58064 case "Duplex": 58065 if (value instanceof _primitives.Name) { 58066 switch (value.name) { 58067 case "Simplex": 58068 case "DuplexFlipShortEdge": 58069 case "DuplexFlipLongEdge": 58070 prefValue = value.name; 58071 break; 58072 58073 default: 58074 prefValue = "None"; 58075 } 58076 } 58077 58078 break; 58079 58080 case "PrintPageRange": 58081 if (Array.isArray(value) && value.length % 2 === 0) { 58082 const isValid = value.every((page, i, arr) => { 58083 return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages; 58084 }); 58085 58086 if (isValid) { 58087 prefValue = value; 58088 } 58089 } 58090 58091 break; 58092 58093 case "NumCopies": 58094 if (Number.isInteger(value) && value > 0) { 58095 prefValue = value; 58096 } 58097 58098 break; 58099 58100 default: 58101 (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`); 58102 continue; 58103 } 58104 58105 if (prefValue === undefined) { 58106 (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`); 58107 continue; 58108 } 58109 58110 if (!prefs) { 58111 prefs = Object.create(null); 58112 } 58113 58114 prefs[key] = prefValue; 58115 } 58116 58117 return (0, _util.shadow)(this, "viewerPreferences", prefs); 58118 } 58119 58120 get openAction() { 58121 const obj = this._catDict.get("OpenAction"); 58122 58123 const openAction = Object.create(null); 58124 58125 if (obj instanceof _primitives.Dict) { 58126 const destDict = new _primitives.Dict(this.xref); 58127 destDict.set("A", obj); 58128 const resultObj = { 58129 url: null, 58130 dest: null, 58131 action: null 58132 }; 58133 Catalog.parseDestDictionary({ 58134 destDict, 58135 resultObj 58136 }); 58137 58138 if (Array.isArray(resultObj.dest)) { 58139 openAction.dest = resultObj.dest; 58140 } else if (resultObj.action) { 58141 openAction.action = resultObj.action; 58142 } 58143 } else if (Array.isArray(obj)) { 58144 openAction.dest = obj; 58145 } 58146 58147 return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null); 58148 } 58149 58150 get attachments() { 58151 const obj = this._catDict.get("Names"); 58152 58153 let attachments = null; 58154 58155 if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) { 58156 const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref); 58157 58158 for (const [key, value] of nameTree.getAll()) { 58159 const fs = new _file_spec.FileSpec(value, this.xref); 58160 58161 if (!attachments) { 58162 attachments = Object.create(null); 58163 } 58164 58165 attachments[(0, _util.stringToPDFString)(key)] = fs.serializable; 58166 } 58167 } 58168 58169 return (0, _util.shadow)(this, "attachments", attachments); 58170 } 58171 58172 get xfaImages() { 58173 const obj = this._catDict.get("Names"); 58174 58175 let xfaImages = null; 58176 58177 if (obj instanceof _primitives.Dict && obj.has("XFAImages")) { 58178 const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref); 58179 58180 for (const [key, value] of nameTree.getAll()) { 58181 if (!xfaImages) { 58182 xfaImages = new _primitives.Dict(this.xref); 58183 } 58184 58185 xfaImages.set((0, _util.stringToPDFString)(key), value); 58186 } 58187 } 58188 58189 return (0, _util.shadow)(this, "xfaImages", xfaImages); 58190 } 58191 58192 _collectJavaScript() { 58193 const obj = this._catDict.get("Names"); 58194 58195 let javaScript = null; 58196 58197 function appendIfJavaScriptDict(name, jsDict) { 58198 if (!(jsDict instanceof _primitives.Dict)) { 58199 return; 58200 } 58201 58202 if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) { 58203 return; 58204 } 58205 58206 let js = jsDict.get("JS"); 58207 58208 if (js instanceof _base_stream.BaseStream) { 58209 js = js.getString(); 58210 } else if (typeof js !== "string") { 58211 return; 58212 } 58213 58214 if (javaScript === null) { 58215 javaScript = new Map(); 58216 } 58217 58218 js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, ""); 58219 javaScript.set(name, js); 58220 } 58221 58222 if (obj instanceof _primitives.Dict && obj.has("JavaScript")) { 58223 const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref); 58224 58225 for (const [key, value] of nameTree.getAll()) { 58226 appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value); 58227 } 58228 } 58229 58230 const openAction = this._catDict.get("OpenAction"); 58231 58232 if (openAction) { 58233 appendIfJavaScriptDict("OpenAction", openAction); 58234 } 58235 58236 return javaScript; 58237 } 58238 58239 get javaScript() { 58240 const javaScript = this._collectJavaScript(); 58241 58242 return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null); 58243 } 58244 58245 get jsActions() { 58246 const javaScript = this._collectJavaScript(); 58247 58248 let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType); 58249 58250 if (javaScript) { 58251 if (!actions) { 58252 actions = Object.create(null); 58253 } 58254 58255 for (const [key, val] of javaScript) { 58256 if (key in actions) { 58257 actions[key].push(val); 58258 } else { 58259 actions[key] = [val]; 58260 } 58261 } 58262 } 58263 58264 return (0, _util.shadow)(this, "jsActions", actions); 58265 } 58266 58267 async fontFallback(id, handler) { 58268 const translatedFonts = await Promise.all(this.fontCache); 58269 58270 for (const translatedFont of translatedFonts) { 58271 if (translatedFont.loadedName === id) { 58272 translatedFont.fallback(handler); 58273 return; 58274 } 58275 } 58276 } 58277 58278 async cleanup(manuallyTriggered = false) { 58279 (0, _cleanup_helper.clearGlobalCaches)(); 58280 this.globalImageCache.clear(manuallyTriggered); 58281 this.pageKidsCountCache.clear(); 58282 this.pageIndexCache.clear(); 58283 this.nonBlendModesSet.clear(); 58284 const translatedFonts = await Promise.all(this.fontCache); 58285 58286 for (const { 58287 dict 58288 } of translatedFonts) { 58289 delete dict.cacheKey; 58290 } 58291 58292 this.fontCache.clear(); 58293 this.builtInCMapCache.clear(); 58294 this.standardFontDataCache.clear(); 58295 } 58296 58297 async getPageDict(pageIndex) { 58298 const nodesToVisit = [this.toplevelPagesDict]; 58299 const visitedNodes = new _primitives.RefSet(); 58300 58301 const pagesRef = this._catDict.getRaw("Pages"); 58302 58303 if (pagesRef instanceof _primitives.Ref) { 58304 visitedNodes.put(pagesRef); 58305 } 58306 58307 const xref = this.xref, 58308 pageKidsCountCache = this.pageKidsCountCache, 58309 pageIndexCache = this.pageIndexCache; 58310 let currentPageIndex = 0; 58311 58312 while (nodesToVisit.length) { 58313 const currentNode = nodesToVisit.pop(); 58314 58315 if (currentNode instanceof _primitives.Ref) { 58316 const count = pageKidsCountCache.get(currentNode); 58317 58318 if (count >= 0 && currentPageIndex + count <= pageIndex) { 58319 currentPageIndex += count; 58320 continue; 58321 } 58322 58323 if (visitedNodes.has(currentNode)) { 58324 throw new _util.FormatError("Pages tree contains circular reference."); 58325 } 58326 58327 visitedNodes.put(currentNode); 58328 const obj = await xref.fetchAsync(currentNode); 58329 58330 if (obj instanceof _primitives.Dict) { 58331 let type = obj.getRaw("Type"); 58332 58333 if (type instanceof _primitives.Ref) { 58334 type = await xref.fetchAsync(type); 58335 } 58336 58337 if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) { 58338 if (!pageKidsCountCache.has(currentNode)) { 58339 pageKidsCountCache.put(currentNode, 1); 58340 } 58341 58342 if (!pageIndexCache.has(currentNode)) { 58343 pageIndexCache.put(currentNode, currentPageIndex); 58344 } 58345 58346 if (currentPageIndex === pageIndex) { 58347 return [obj, currentNode]; 58348 } 58349 58350 currentPageIndex++; 58351 continue; 58352 } 58353 } 58354 58355 nodesToVisit.push(obj); 58356 continue; 58357 } 58358 58359 if (!(currentNode instanceof _primitives.Dict)) { 58360 throw new _util.FormatError("Page dictionary kid reference points to wrong type of object."); 58361 } 58362 58363 const { 58364 objId 58365 } = currentNode; 58366 let count = currentNode.getRaw("Count"); 58367 58368 if (count instanceof _primitives.Ref) { 58369 count = await xref.fetchAsync(count); 58370 } 58371 58372 if (Number.isInteger(count) && count >= 0) { 58373 if (objId && !pageKidsCountCache.has(objId)) { 58374 pageKidsCountCache.put(objId, count); 58375 } 58376 58377 if (currentPageIndex + count <= pageIndex) { 58378 currentPageIndex += count; 58379 continue; 58380 } 58381 } 58382 58383 let kids = currentNode.getRaw("Kids"); 58384 58385 if (kids instanceof _primitives.Ref) { 58386 kids = await xref.fetchAsync(kids); 58387 } 58388 58389 if (!Array.isArray(kids)) { 58390 let type = currentNode.getRaw("Type"); 58391 58392 if (type instanceof _primitives.Ref) { 58393 type = await xref.fetchAsync(type); 58394 } 58395 58396 if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) { 58397 if (currentPageIndex === pageIndex) { 58398 return [currentNode, null]; 58399 } 58400 58401 currentPageIndex++; 58402 continue; 58403 } 58404 58405 throw new _util.FormatError("Page dictionary kids object is not an array."); 58406 } 58407 58408 for (let last = kids.length - 1; last >= 0; last--) { 58409 nodesToVisit.push(kids[last]); 58410 } 58411 } 58412 58413 throw new Error(`Page index ${pageIndex} not found.`); 58414 } 58415 58416 async getAllPageDicts(recoveryMode = false) { 58417 const queue = [{ 58418 currentNode: this.toplevelPagesDict, 58419 posInKids: 0 58420 }]; 58421 const visitedNodes = new _primitives.RefSet(); 58422 58423 const pagesRef = this._catDict.getRaw("Pages"); 58424 58425 if (pagesRef instanceof _primitives.Ref) { 58426 visitedNodes.put(pagesRef); 58427 } 58428 58429 const map = new Map(), 58430 xref = this.xref, 58431 pageIndexCache = this.pageIndexCache; 58432 let pageIndex = 0; 58433 58434 function addPageDict(pageDict, pageRef) { 58435 if (pageRef && !pageIndexCache.has(pageRef)) { 58436 pageIndexCache.put(pageRef, pageIndex); 58437 } 58438 58439 map.set(pageIndex++, [pageDict, pageRef]); 58440 } 58441 58442 function addPageError(error) { 58443 if (error instanceof _core_utils.XRefEntryException && !recoveryMode) { 58444 throw error; 58445 } 58446 58447 map.set(pageIndex++, [error, null]); 58448 } 58449 58450 while (queue.length > 0) { 58451 const queueItem = queue.at(-1); 58452 const { 58453 currentNode, 58454 posInKids 58455 } = queueItem; 58456 let kids = currentNode.getRaw("Kids"); 58457 58458 if (kids instanceof _primitives.Ref) { 58459 try { 58460 kids = await xref.fetchAsync(kids); 58461 } catch (ex) { 58462 addPageError(ex); 58463 break; 58464 } 58465 } 58466 58467 if (!Array.isArray(kids)) { 58468 addPageError(new _util.FormatError("Page dictionary kids object is not an array.")); 58469 break; 58470 } 58471 58472 if (posInKids >= kids.length) { 58473 queue.pop(); 58474 continue; 58475 } 58476 58477 const kidObj = kids[posInKids]; 58478 let obj; 58479 58480 if (kidObj instanceof _primitives.Ref) { 58481 if (visitedNodes.has(kidObj)) { 58482 addPageError(new _util.FormatError("Pages tree contains circular reference.")); 58483 break; 58484 } 58485 58486 visitedNodes.put(kidObj); 58487 58488 try { 58489 obj = await xref.fetchAsync(kidObj); 58490 } catch (ex) { 58491 addPageError(ex); 58492 break; 58493 } 58494 } else { 58495 obj = kidObj; 58496 } 58497 58498 if (!(obj instanceof _primitives.Dict)) { 58499 addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object.")); 58500 break; 58501 } 58502 58503 let type = obj.getRaw("Type"); 58504 58505 if (type instanceof _primitives.Ref) { 58506 try { 58507 type = await xref.fetchAsync(type); 58508 } catch (ex) { 58509 addPageError(ex); 58510 break; 58511 } 58512 } 58513 58514 if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) { 58515 addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null); 58516 } else { 58517 queue.push({ 58518 currentNode: obj, 58519 posInKids: 0 58520 }); 58521 } 58522 58523 queueItem.posInKids++; 58524 } 58525 58526 return map; 58527 } 58528 58529 getPageIndex(pageRef) { 58530 const cachedPageIndex = this.pageIndexCache.get(pageRef); 58531 58532 if (cachedPageIndex !== undefined) { 58533 return Promise.resolve(cachedPageIndex); 58534 } 58535 58536 const xref = this.xref; 58537 58538 function pagesBeforeRef(kidRef) { 58539 let total = 0, 58540 parentRef; 58541 return xref.fetchAsync(kidRef).then(function (node) { 58542 if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) { 58543 throw new _util.FormatError("The reference does not point to a /Page dictionary."); 58544 } 58545 58546 if (!node) { 58547 return null; 58548 } 58549 58550 if (!(node instanceof _primitives.Dict)) { 58551 throw new _util.FormatError("Node must be a dictionary."); 58552 } 58553 58554 parentRef = node.getRaw("Parent"); 58555 return node.getAsync("Parent"); 58556 }).then(function (parent) { 58557 if (!parent) { 58558 return null; 58559 } 58560 58561 if (!(parent instanceof _primitives.Dict)) { 58562 throw new _util.FormatError("Parent must be a dictionary."); 58563 } 58564 58565 return parent.getAsync("Kids"); 58566 }).then(function (kids) { 58567 if (!kids) { 58568 return null; 58569 } 58570 58571 const kidPromises = []; 58572 let found = false; 58573 58574 for (let i = 0, ii = kids.length; i < ii; i++) { 58575 const kid = kids[i]; 58576 58577 if (!(kid instanceof _primitives.Ref)) { 58578 throw new _util.FormatError("Kid must be a reference."); 58579 } 58580 58581 if ((0, _primitives.isRefsEqual)(kid, kidRef)) { 58582 found = true; 58583 break; 58584 } 58585 58586 kidPromises.push(xref.fetchAsync(kid).then(function (obj) { 58587 if (!(obj instanceof _primitives.Dict)) { 58588 throw new _util.FormatError("Kid node must be a dictionary."); 58589 } 58590 58591 if (obj.has("Count")) { 58592 total += obj.get("Count"); 58593 } else { 58594 total++; 58595 } 58596 })); 58597 } 58598 58599 if (!found) { 58600 throw new _util.FormatError("Kid reference not found in parent's kids."); 58601 } 58602 58603 return Promise.all(kidPromises).then(function () { 58604 return [total, parentRef]; 58605 }); 58606 }); 58607 } 58608 58609 let total = 0; 58610 58611 const next = ref => pagesBeforeRef(ref).then(args => { 58612 if (!args) { 58613 this.pageIndexCache.put(pageRef, total); 58614 return total; 58615 } 58616 58617 const [count, parentRef] = args; 58618 total += count; 58619 return next(parentRef); 58620 }); 58621 58622 return next(pageRef); 58623 } 58624 58625 get baseUrl() { 58626 const uri = this._catDict.get("URI"); 58627 58628 if (uri instanceof _primitives.Dict) { 58629 const base = uri.get("Base"); 58630 58631 if (typeof base === "string") { 58632 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, { 58633 tryConvertEncoding: true 58634 }); 58635 58636 if (absoluteUrl) { 58637 return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href); 58638 } 58639 } 58640 } 58641 58642 return (0, _util.shadow)(this, "baseUrl", null); 58643 } 58644 58645 static parseDestDictionary(params) { 58646 const destDict = params.destDict; 58647 58648 if (!(destDict instanceof _primitives.Dict)) { 58649 (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary."); 58650 return; 58651 } 58652 58653 const resultObj = params.resultObj; 58654 58655 if (typeof resultObj !== "object") { 58656 (0, _util.warn)("parseDestDictionary: `resultObj` must be an object."); 58657 return; 58658 } 58659 58660 const docBaseUrl = params.docBaseUrl || null; 58661 let action = destDict.get("A"), 58662 url, 58663 dest; 58664 58665 if (!(action instanceof _primitives.Dict)) { 58666 if (destDict.has("Dest")) { 58667 action = destDict.get("Dest"); 58668 } else { 58669 action = destDict.get("AA"); 58670 58671 if (action instanceof _primitives.Dict) { 58672 if (action.has("D")) { 58673 action = action.get("D"); 58674 } else if (action.has("U")) { 58675 action = action.get("U"); 58676 } 58677 } 58678 } 58679 } 58680 58681 if (action instanceof _primitives.Dict) { 58682 const actionType = action.get("S"); 58683 58684 if (!(actionType instanceof _primitives.Name)) { 58685 (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary."); 58686 return; 58687 } 58688 58689 const actionName = actionType.name; 58690 58691 switch (actionName) { 58692 case "ResetForm": 58693 const flags = action.get("Flags"); 58694 const include = ((typeof flags === "number" ? flags : 0) & 1) === 0; 58695 const fields = []; 58696 const refs = []; 58697 58698 for (const obj of action.get("Fields") || []) { 58699 if (obj instanceof _primitives.Ref) { 58700 refs.push(obj.toString()); 58701 } else if (typeof obj === "string") { 58702 fields.push((0, _util.stringToPDFString)(obj)); 58703 } 58704 } 58705 58706 resultObj.resetForm = { 58707 fields, 58708 refs, 58709 include 58710 }; 58711 break; 58712 58713 case "URI": 58714 url = action.get("URI"); 58715 58716 if (url instanceof _primitives.Name) { 58717 url = "/" + url.name; 58718 } 58719 58720 break; 58721 58722 case "GoTo": 58723 dest = action.get("D"); 58724 break; 58725 58726 case "Launch": 58727 case "GoToR": 58728 const urlDict = action.get("F"); 58729 58730 if (urlDict instanceof _primitives.Dict) { 58731 url = urlDict.get("F") || null; 58732 } else if (typeof urlDict === "string") { 58733 url = urlDict; 58734 } 58735 58736 let remoteDest = action.get("D"); 58737 58738 if (remoteDest) { 58739 if (remoteDest instanceof _primitives.Name) { 58740 remoteDest = remoteDest.name; 58741 } 58742 58743 if (typeof url === "string") { 58744 const baseUrl = url.split("#")[0]; 58745 58746 if (typeof remoteDest === "string") { 58747 url = baseUrl + "#" + remoteDest; 58748 } else if (Array.isArray(remoteDest)) { 58749 url = baseUrl + "#" + JSON.stringify(remoteDest); 58750 } 58751 } 58752 } 58753 58754 const newWindow = action.get("NewWindow"); 58755 58756 if (typeof newWindow === "boolean") { 58757 resultObj.newWindow = newWindow; 58758 } 58759 58760 break; 58761 58762 case "Named": 58763 const namedAction = action.get("N"); 58764 58765 if (namedAction instanceof _primitives.Name) { 58766 resultObj.action = namedAction.name; 58767 } 58768 58769 break; 58770 58771 case "JavaScript": 58772 const jsAction = action.get("JS"); 58773 let js; 58774 58775 if (jsAction instanceof _base_stream.BaseStream) { 58776 js = jsAction.getString(); 58777 } else if (typeof jsAction === "string") { 58778 js = jsAction; 58779 } 58780 58781 const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js)); 58782 58783 if (jsURL) { 58784 url = jsURL.url; 58785 resultObj.newWindow = jsURL.newWindow; 58786 break; 58787 } 58788 58789 default: 58790 if (actionName === "JavaScript" || actionName === "SubmitForm") { 58791 break; 58792 } 58793 58794 (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`); 58795 break; 58796 } 58797 } else if (destDict.has("Dest")) { 58798 dest = destDict.get("Dest"); 58799 } 58800 58801 if (typeof url === "string") { 58802 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, { 58803 addDefaultProtocol: true, 58804 tryConvertEncoding: true 58805 }); 58806 58807 if (absoluteUrl) { 58808 resultObj.url = absoluteUrl.href; 58809 } 58810 58811 resultObj.unsafeUrl = url; 58812 } 58813 58814 if (dest) { 58815 if (dest instanceof _primitives.Name) { 58816 dest = dest.name; 58817 } 58818 58819 if (typeof dest === "string") { 58820 resultObj.dest = (0, _util.stringToPDFString)(dest); 58821 } else if (Array.isArray(dest)) { 58822 resultObj.dest = dest; 58823 } 58824 } 58825 } 58826 58827} 58828 58829exports.Catalog = Catalog; 58830 58831/***/ }), 58832/* 70 */ 58833/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 58834 58835 58836 58837Object.defineProperty(exports, "__esModule", ({ 58838 value: true 58839})); 58840exports.NumberTree = exports.NameTree = void 0; 58841 58842var _primitives = __w_pdfjs_require__(5); 58843 58844var _util = __w_pdfjs_require__(2); 58845 58846class NameOrNumberTree { 58847 constructor(root, xref, type) { 58848 if (this.constructor === NameOrNumberTree) { 58849 (0, _util.unreachable)("Cannot initialize NameOrNumberTree."); 58850 } 58851 58852 this.root = root; 58853 this.xref = xref; 58854 this._type = type; 58855 } 58856 58857 getAll() { 58858 const map = new Map(); 58859 58860 if (!this.root) { 58861 return map; 58862 } 58863 58864 const xref = this.xref; 58865 const processed = new _primitives.RefSet(); 58866 processed.put(this.root); 58867 const queue = [this.root]; 58868 58869 while (queue.length > 0) { 58870 const obj = xref.fetchIfRef(queue.shift()); 58871 58872 if (!(obj instanceof _primitives.Dict)) { 58873 continue; 58874 } 58875 58876 if (obj.has("Kids")) { 58877 const kids = obj.get("Kids"); 58878 58879 if (!Array.isArray(kids)) { 58880 continue; 58881 } 58882 58883 for (const kid of kids) { 58884 if (processed.has(kid)) { 58885 throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`); 58886 } 58887 58888 queue.push(kid); 58889 processed.put(kid); 58890 } 58891 58892 continue; 58893 } 58894 58895 const entries = obj.get(this._type); 58896 58897 if (!Array.isArray(entries)) { 58898 continue; 58899 } 58900 58901 for (let i = 0, ii = entries.length; i < ii; i += 2) { 58902 map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1])); 58903 } 58904 } 58905 58906 return map; 58907 } 58908 58909 get(key) { 58910 if (!this.root) { 58911 return null; 58912 } 58913 58914 const xref = this.xref; 58915 let kidsOrEntries = xref.fetchIfRef(this.root); 58916 let loopCount = 0; 58917 const MAX_LEVELS = 10; 58918 58919 while (kidsOrEntries.has("Kids")) { 58920 if (++loopCount > MAX_LEVELS) { 58921 (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`); 58922 return null; 58923 } 58924 58925 const kids = kidsOrEntries.get("Kids"); 58926 58927 if (!Array.isArray(kids)) { 58928 return null; 58929 } 58930 58931 let l = 0, 58932 r = kids.length - 1; 58933 58934 while (l <= r) { 58935 const m = l + r >> 1; 58936 const kid = xref.fetchIfRef(kids[m]); 58937 const limits = kid.get("Limits"); 58938 58939 if (key < xref.fetchIfRef(limits[0])) { 58940 r = m - 1; 58941 } else if (key > xref.fetchIfRef(limits[1])) { 58942 l = m + 1; 58943 } else { 58944 kidsOrEntries = kid; 58945 break; 58946 } 58947 } 58948 58949 if (l > r) { 58950 return null; 58951 } 58952 } 58953 58954 const entries = kidsOrEntries.get(this._type); 58955 58956 if (Array.isArray(entries)) { 58957 let l = 0, 58958 r = entries.length - 2; 58959 58960 while (l <= r) { 58961 const tmp = l + r >> 1, 58962 m = tmp + (tmp & 1); 58963 const currentKey = xref.fetchIfRef(entries[m]); 58964 58965 if (key < currentKey) { 58966 r = m - 2; 58967 } else if (key > currentKey) { 58968 l = m + 2; 58969 } else { 58970 return xref.fetchIfRef(entries[m + 1]); 58971 } 58972 } 58973 } 58974 58975 return null; 58976 } 58977 58978} 58979 58980class NameTree extends NameOrNumberTree { 58981 constructor(root, xref) { 58982 super(root, xref, "Names"); 58983 } 58984 58985} 58986 58987exports.NameTree = NameTree; 58988 58989class NumberTree extends NameOrNumberTree { 58990 constructor(root, xref) { 58991 super(root, xref, "Nums"); 58992 } 58993 58994} 58995 58996exports.NumberTree = NumberTree; 58997 58998/***/ }), 58999/* 71 */ 59000/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 59001 59002 59003 59004Object.defineProperty(exports, "__esModule", ({ 59005 value: true 59006})); 59007exports.clearGlobalCaches = clearGlobalCaches; 59008 59009var _primitives = __w_pdfjs_require__(5); 59010 59011var _unicode = __w_pdfjs_require__(40); 59012 59013function clearGlobalCaches() { 59014 (0, _primitives.clearPrimitiveCaches)(); 59015 (0, _unicode.clearUnicodeCaches)(); 59016} 59017 59018/***/ }), 59019/* 72 */ 59020/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 59021 59022 59023 59024Object.defineProperty(exports, "__esModule", ({ 59025 value: true 59026})); 59027exports.FileSpec = void 0; 59028 59029var _util = __w_pdfjs_require__(2); 59030 59031var _base_stream = __w_pdfjs_require__(7); 59032 59033var _primitives = __w_pdfjs_require__(5); 59034 59035function pickPlatformItem(dict) { 59036 if (dict.has("UF")) { 59037 return dict.get("UF"); 59038 } else if (dict.has("F")) { 59039 return dict.get("F"); 59040 } else if (dict.has("Unix")) { 59041 return dict.get("Unix"); 59042 } else if (dict.has("Mac")) { 59043 return dict.get("Mac"); 59044 } else if (dict.has("DOS")) { 59045 return dict.get("DOS"); 59046 } 59047 59048 return null; 59049} 59050 59051class FileSpec { 59052 constructor(root, xref) { 59053 if (!(root instanceof _primitives.Dict)) { 59054 return; 59055 } 59056 59057 this.xref = xref; 59058 this.root = root; 59059 59060 if (root.has("FS")) { 59061 this.fs = root.get("FS"); 59062 } 59063 59064 this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : ""; 59065 59066 if (root.has("RF")) { 59067 (0, _util.warn)("Related file specifications are not supported"); 59068 } 59069 59070 this.contentAvailable = true; 59071 59072 if (!root.has("EF")) { 59073 this.contentAvailable = false; 59074 (0, _util.warn)("Non-embedded file specifications are not supported"); 59075 } 59076 } 59077 59078 get filename() { 59079 if (!this._filename && this.root) { 59080 const filename = pickPlatformItem(this.root) || "unnamed"; 59081 this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/"); 59082 } 59083 59084 return this._filename; 59085 } 59086 59087 get content() { 59088 if (!this.contentAvailable) { 59089 return null; 59090 } 59091 59092 if (!this.contentRef && this.root) { 59093 this.contentRef = pickPlatformItem(this.root.get("EF")); 59094 } 59095 59096 let content = null; 59097 59098 if (this.contentRef) { 59099 const fileObj = this.xref.fetchIfRef(this.contentRef); 59100 59101 if (fileObj instanceof _base_stream.BaseStream) { 59102 content = fileObj.getBytes(); 59103 } else { 59104 (0, _util.warn)("Embedded file specification points to non-existing/invalid content"); 59105 } 59106 } else { 59107 (0, _util.warn)("Embedded file specification does not have a content"); 59108 } 59109 59110 return content; 59111 } 59112 59113 get serializable() { 59114 return { 59115 filename: this.filename, 59116 content: this.content 59117 }; 59118 } 59119 59120} 59121 59122exports.FileSpec = FileSpec; 59123 59124/***/ }), 59125/* 73 */ 59126/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 59127 59128 59129 59130Object.defineProperty(exports, "__esModule", ({ 59131 value: true 59132})); 59133exports.MetadataParser = void 0; 59134 59135var _xml_parser = __w_pdfjs_require__(66); 59136 59137class MetadataParser { 59138 constructor(data) { 59139 data = this._repair(data); 59140 const parser = new _xml_parser.SimpleXMLParser({ 59141 lowerCaseName: true 59142 }); 59143 const xmlDocument = parser.parseFromString(data); 59144 this._metadataMap = new Map(); 59145 this._data = data; 59146 59147 if (xmlDocument) { 59148 this._parse(xmlDocument); 59149 } 59150 } 59151 59152 _repair(data) { 59153 return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) { 59154 const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) { 59155 return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1); 59156 }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) { 59157 switch (name) { 59158 case "amp": 59159 return "&"; 59160 59161 case "apos": 59162 return "'"; 59163 59164 case "gt": 59165 return ">"; 59166 59167 case "lt": 59168 return "<"; 59169 59170 case "quot": 59171 return '"'; 59172 } 59173 59174 throw new Error(`_repair: ${name} isn't defined.`); 59175 }); 59176 const charBuf = []; 59177 59178 for (let i = 0, ii = bytes.length; i < ii; i += 2) { 59179 const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1); 59180 59181 if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) { 59182 charBuf.push(String.fromCharCode(code)); 59183 } else { 59184 charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";"); 59185 } 59186 } 59187 59188 return ">" + charBuf.join(""); 59189 }); 59190 } 59191 59192 _getSequence(entry) { 59193 const name = entry.nodeName; 59194 59195 if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") { 59196 return null; 59197 } 59198 59199 return entry.childNodes.filter(node => node.nodeName === "rdf:li"); 59200 } 59201 59202 _parseArray(entry) { 59203 if (!entry.hasChildNodes()) { 59204 return; 59205 } 59206 59207 const [seqNode] = entry.childNodes; 59208 const sequence = this._getSequence(seqNode) || []; 59209 59210 this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim())); 59211 } 59212 59213 _parse(xmlDocument) { 59214 let rdf = xmlDocument.documentElement; 59215 59216 if (rdf.nodeName !== "rdf:rdf") { 59217 rdf = rdf.firstChild; 59218 59219 while (rdf && rdf.nodeName !== "rdf:rdf") { 59220 rdf = rdf.nextSibling; 59221 } 59222 } 59223 59224 if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) { 59225 return; 59226 } 59227 59228 for (const desc of rdf.childNodes) { 59229 if (desc.nodeName !== "rdf:description") { 59230 continue; 59231 } 59232 59233 for (const entry of desc.childNodes) { 59234 const name = entry.nodeName; 59235 59236 switch (name) { 59237 case "#text": 59238 continue; 59239 59240 case "dc:creator": 59241 case "dc:subject": 59242 this._parseArray(entry); 59243 59244 continue; 59245 } 59246 59247 this._metadataMap.set(name, entry.textContent.trim()); 59248 } 59249 } 59250 } 59251 59252 get serializable() { 59253 return { 59254 parsedData: this._metadataMap, 59255 rawData: this._data 59256 }; 59257 } 59258 59259} 59260 59261exports.MetadataParser = MetadataParser; 59262 59263/***/ }), 59264/* 74 */ 59265/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 59266 59267 59268 59269Object.defineProperty(exports, "__esModule", ({ 59270 value: true 59271})); 59272exports.StructTreeRoot = exports.StructTreePage = void 0; 59273 59274var _primitives = __w_pdfjs_require__(5); 59275 59276var _util = __w_pdfjs_require__(2); 59277 59278var _name_number_tree = __w_pdfjs_require__(70); 59279 59280const MAX_DEPTH = 40; 59281const StructElementType = { 59282 PAGE_CONTENT: "PAGE_CONTENT", 59283 STREAM_CONTENT: "STREAM_CONTENT", 59284 OBJECT: "OBJECT", 59285 ELEMENT: "ELEMENT" 59286}; 59287 59288class StructTreeRoot { 59289 constructor(rootDict) { 59290 this.dict = rootDict; 59291 this.roleMap = new Map(); 59292 } 59293 59294 init() { 59295 this.readRoleMap(); 59296 } 59297 59298 readRoleMap() { 59299 const roleMapDict = this.dict.get("RoleMap"); 59300 59301 if (!(roleMapDict instanceof _primitives.Dict)) { 59302 return; 59303 } 59304 59305 roleMapDict.forEach((key, value) => { 59306 if (!(value instanceof _primitives.Name)) { 59307 return; 59308 } 59309 59310 this.roleMap.set(key, value.name); 59311 }); 59312 } 59313 59314} 59315 59316exports.StructTreeRoot = StructTreeRoot; 59317 59318class StructElementNode { 59319 constructor(tree, dict) { 59320 this.tree = tree; 59321 this.dict = dict; 59322 this.kids = []; 59323 this.parseKids(); 59324 } 59325 59326 get role() { 59327 const nameObj = this.dict.get("S"); 59328 const name = nameObj instanceof _primitives.Name ? nameObj.name : ""; 59329 const { 59330 root 59331 } = this.tree; 59332 59333 if (root.roleMap.has(name)) { 59334 return root.roleMap.get(name); 59335 } 59336 59337 return name; 59338 } 59339 59340 parseKids() { 59341 let pageObjId = null; 59342 const objRef = this.dict.getRaw("Pg"); 59343 59344 if (objRef instanceof _primitives.Ref) { 59345 pageObjId = objRef.toString(); 59346 } 59347 59348 const kids = this.dict.get("K"); 59349 59350 if (Array.isArray(kids)) { 59351 for (const kid of kids) { 59352 const element = this.parseKid(pageObjId, kid); 59353 59354 if (element) { 59355 this.kids.push(element); 59356 } 59357 } 59358 } else { 59359 const element = this.parseKid(pageObjId, kids); 59360 59361 if (element) { 59362 this.kids.push(element); 59363 } 59364 } 59365 } 59366 59367 parseKid(pageObjId, kid) { 59368 if (Number.isInteger(kid)) { 59369 if (this.tree.pageDict.objId !== pageObjId) { 59370 return null; 59371 } 59372 59373 return new StructElement({ 59374 type: StructElementType.PAGE_CONTENT, 59375 mcid: kid, 59376 pageObjId 59377 }); 59378 } 59379 59380 let kidDict = null; 59381 59382 if (kid instanceof _primitives.Ref) { 59383 kidDict = this.dict.xref.fetch(kid); 59384 } else if (kid instanceof _primitives.Dict) { 59385 kidDict = kid; 59386 } 59387 59388 if (!kidDict) { 59389 return null; 59390 } 59391 59392 const pageRef = kidDict.getRaw("Pg"); 59393 59394 if (pageRef instanceof _primitives.Ref) { 59395 pageObjId = pageRef.toString(); 59396 } 59397 59398 const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null; 59399 59400 if (type === "MCR") { 59401 if (this.tree.pageDict.objId !== pageObjId) { 59402 return null; 59403 } 59404 59405 return new StructElement({ 59406 type: StructElementType.STREAM_CONTENT, 59407 refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null, 59408 pageObjId, 59409 mcid: kidDict.get("MCID") 59410 }); 59411 } 59412 59413 if (type === "OBJR") { 59414 if (this.tree.pageDict.objId !== pageObjId) { 59415 return null; 59416 } 59417 59418 return new StructElement({ 59419 type: StructElementType.OBJECT, 59420 refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null, 59421 pageObjId 59422 }); 59423 } 59424 59425 return new StructElement({ 59426 type: StructElementType.ELEMENT, 59427 dict: kidDict 59428 }); 59429 } 59430 59431} 59432 59433class StructElement { 59434 constructor({ 59435 type, 59436 dict = null, 59437 mcid = null, 59438 pageObjId = null, 59439 refObjId = null 59440 }) { 59441 this.type = type; 59442 this.dict = dict; 59443 this.mcid = mcid; 59444 this.pageObjId = pageObjId; 59445 this.refObjId = refObjId; 59446 this.parentNode = null; 59447 } 59448 59449} 59450 59451class StructTreePage { 59452 constructor(structTreeRoot, pageDict) { 59453 this.root = structTreeRoot; 59454 this.rootDict = structTreeRoot ? structTreeRoot.dict : null; 59455 this.pageDict = pageDict; 59456 this.nodes = []; 59457 } 59458 59459 parse() { 59460 if (!this.root || !this.rootDict) { 59461 return; 59462 } 59463 59464 const parentTree = this.rootDict.get("ParentTree"); 59465 59466 if (!parentTree) { 59467 return; 59468 } 59469 59470 const id = this.pageDict.get("StructParents"); 59471 59472 if (!Number.isInteger(id)) { 59473 return; 59474 } 59475 59476 const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref); 59477 const parentArray = numberTree.get(id); 59478 59479 if (!Array.isArray(parentArray)) { 59480 return; 59481 } 59482 59483 const map = new Map(); 59484 59485 for (const ref of parentArray) { 59486 if (ref instanceof _primitives.Ref) { 59487 this.addNode(this.rootDict.xref.fetch(ref), map); 59488 } 59489 } 59490 } 59491 59492 addNode(dict, map, level = 0) { 59493 if (level > MAX_DEPTH) { 59494 (0, _util.warn)("StructTree MAX_DEPTH reached."); 59495 return null; 59496 } 59497 59498 if (map.has(dict)) { 59499 return map.get(dict); 59500 } 59501 59502 const element = new StructElementNode(this, dict); 59503 map.set(dict, element); 59504 const parent = dict.get("P"); 59505 59506 if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) { 59507 if (!this.addTopLevelNode(dict, element)) { 59508 map.delete(dict); 59509 } 59510 59511 return element; 59512 } 59513 59514 const parentNode = this.addNode(parent, map, level + 1); 59515 59516 if (!parentNode) { 59517 return element; 59518 } 59519 59520 let save = false; 59521 59522 for (const kid of parentNode.kids) { 59523 if (kid.type === StructElementType.ELEMENT && kid.dict === dict) { 59524 kid.parentNode = element; 59525 save = true; 59526 } 59527 } 59528 59529 if (!save) { 59530 map.delete(dict); 59531 } 59532 59533 return element; 59534 } 59535 59536 addTopLevelNode(dict, element) { 59537 const obj = this.rootDict.get("K"); 59538 59539 if (!obj) { 59540 return false; 59541 } 59542 59543 if (obj instanceof _primitives.Dict) { 59544 if (obj.objId !== dict.objId) { 59545 return false; 59546 } 59547 59548 this.nodes[0] = element; 59549 return true; 59550 } 59551 59552 if (!Array.isArray(obj)) { 59553 return true; 59554 } 59555 59556 let save = false; 59557 59558 for (let i = 0; i < obj.length; i++) { 59559 const kidRef = obj[i]; 59560 59561 if (kidRef && kidRef.toString() === dict.objId) { 59562 this.nodes[i] = element; 59563 save = true; 59564 } 59565 } 59566 59567 return save; 59568 } 59569 59570 get serializable() { 59571 function nodeToSerializable(node, parent, level = 0) { 59572 if (level > MAX_DEPTH) { 59573 (0, _util.warn)("StructTree too deep to be fully serialized."); 59574 return; 59575 } 59576 59577 const obj = Object.create(null); 59578 obj.role = node.role; 59579 obj.children = []; 59580 parent.children.push(obj); 59581 const alt = node.dict.get("Alt"); 59582 59583 if (typeof alt === "string") { 59584 obj.alt = (0, _util.stringToPDFString)(alt); 59585 } 59586 59587 const lang = node.dict.get("Lang"); 59588 59589 if (typeof lang === "string") { 59590 obj.lang = (0, _util.stringToPDFString)(lang); 59591 } 59592 59593 for (const kid of node.kids) { 59594 const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null; 59595 59596 if (kidElement) { 59597 nodeToSerializable(kidElement, obj, level + 1); 59598 continue; 59599 } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) { 59600 obj.children.push({ 59601 type: "content", 59602 id: `page${kid.pageObjId}_mcid${kid.mcid}` 59603 }); 59604 } else if (kid.type === StructElementType.OBJECT) { 59605 obj.children.push({ 59606 type: "object", 59607 id: kid.refObjId 59608 }); 59609 } 59610 } 59611 } 59612 59613 const root = Object.create(null); 59614 root.children = []; 59615 root.role = "Root"; 59616 59617 for (const child of this.nodes) { 59618 if (!child) { 59619 continue; 59620 } 59621 59622 nodeToSerializable(child, root); 59623 } 59624 59625 return root; 59626 } 59627 59628} 59629 59630exports.StructTreePage = StructTreePage; 59631 59632/***/ }), 59633/* 75 */ 59634/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 59635 59636 59637 59638Object.defineProperty(exports, "__esModule", ({ 59639 value: true 59640})); 59641exports.ObjectLoader = void 0; 59642 59643var _primitives = __w_pdfjs_require__(5); 59644 59645var _base_stream = __w_pdfjs_require__(7); 59646 59647var _core_utils = __w_pdfjs_require__(6); 59648 59649var _util = __w_pdfjs_require__(2); 59650 59651function mayHaveChildren(value) { 59652 return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value); 59653} 59654 59655function addChildren(node, nodesToVisit) { 59656 if (node instanceof _primitives.Dict) { 59657 node = node.getRawValues(); 59658 } else if (node instanceof _base_stream.BaseStream) { 59659 node = node.dict.getRawValues(); 59660 } else if (!Array.isArray(node)) { 59661 return; 59662 } 59663 59664 for (const rawValue of node) { 59665 if (mayHaveChildren(rawValue)) { 59666 nodesToVisit.push(rawValue); 59667 } 59668 } 59669} 59670 59671class ObjectLoader { 59672 constructor(dict, keys, xref) { 59673 this.dict = dict; 59674 this.keys = keys; 59675 this.xref = xref; 59676 this.refSet = null; 59677 } 59678 59679 async load() { 59680 if (this.xref.stream.isDataLoaded) { 59681 return undefined; 59682 } 59683 59684 const { 59685 keys, 59686 dict 59687 } = this; 59688 this.refSet = new _primitives.RefSet(); 59689 const nodesToVisit = []; 59690 59691 for (let i = 0, ii = keys.length; i < ii; i++) { 59692 const rawValue = dict.getRaw(keys[i]); 59693 59694 if (rawValue !== undefined) { 59695 nodesToVisit.push(rawValue); 59696 } 59697 } 59698 59699 return this._walk(nodesToVisit); 59700 } 59701 59702 async _walk(nodesToVisit) { 59703 const nodesToRevisit = []; 59704 const pendingRequests = []; 59705 59706 while (nodesToVisit.length) { 59707 let currentNode = nodesToVisit.pop(); 59708 59709 if (currentNode instanceof _primitives.Ref) { 59710 if (this.refSet.has(currentNode)) { 59711 continue; 59712 } 59713 59714 try { 59715 this.refSet.put(currentNode); 59716 currentNode = this.xref.fetch(currentNode); 59717 } catch (ex) { 59718 if (!(ex instanceof _core_utils.MissingDataException)) { 59719 (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`); 59720 this.refSet = null; 59721 const { 59722 manager 59723 } = this.xref.stream; 59724 return manager.requestAllChunks(); 59725 } 59726 59727 nodesToRevisit.push(currentNode); 59728 pendingRequests.push({ 59729 begin: ex.begin, 59730 end: ex.end 59731 }); 59732 } 59733 } 59734 59735 if (currentNode instanceof _base_stream.BaseStream) { 59736 const baseStreams = currentNode.getBaseStreams(); 59737 59738 if (baseStreams) { 59739 let foundMissingData = false; 59740 59741 for (const stream of baseStreams) { 59742 if (stream.isDataLoaded) { 59743 continue; 59744 } 59745 59746 foundMissingData = true; 59747 pendingRequests.push({ 59748 begin: stream.start, 59749 end: stream.end 59750 }); 59751 } 59752 59753 if (foundMissingData) { 59754 nodesToRevisit.push(currentNode); 59755 } 59756 } 59757 } 59758 59759 addChildren(currentNode, nodesToVisit); 59760 } 59761 59762 if (pendingRequests.length) { 59763 await this.xref.stream.manager.requestRanges(pendingRequests); 59764 59765 for (const node of nodesToRevisit) { 59766 if (node instanceof _primitives.Ref) { 59767 this.refSet.remove(node); 59768 } 59769 } 59770 59771 return this._walk(nodesToRevisit); 59772 } 59773 59774 this.refSet = null; 59775 return undefined; 59776 } 59777 59778} 59779 59780exports.ObjectLoader = ObjectLoader; 59781 59782/***/ }), 59783/* 76 */ 59784/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 59785 59786 59787 59788Object.defineProperty(exports, "__esModule", ({ 59789 value: true 59790})); 59791exports.XFAFactory = void 0; 59792 59793var _xfa_object = __w_pdfjs_require__(77); 59794 59795var _bind = __w_pdfjs_require__(81); 59796 59797var _data = __w_pdfjs_require__(87); 59798 59799var _fonts = __w_pdfjs_require__(85); 59800 59801var _utils = __w_pdfjs_require__(78); 59802 59803var _util = __w_pdfjs_require__(2); 59804 59805var _parser = __w_pdfjs_require__(88); 59806 59807var _xhtml = __w_pdfjs_require__(98); 59808 59809class XFAFactory { 59810 constructor(data) { 59811 try { 59812 this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data)); 59813 const binder = new _bind.Binder(this.root); 59814 this.form = binder.bind(); 59815 this.dataHandler = new _data.DataHandler(this.root, binder.getData()); 59816 this.form[_xfa_object.$globalData].template = this.form; 59817 } catch (e) { 59818 (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`); 59819 } 59820 } 59821 59822 isValid() { 59823 return this.root && this.form; 59824 } 59825 59826 _createPagesHelper() { 59827 const iterator = this.form[_xfa_object.$toPages](); 59828 59829 return new Promise((resolve, reject) => { 59830 const nextIteration = () => { 59831 try { 59832 const value = iterator.next(); 59833 59834 if (value.done) { 59835 resolve(value.value); 59836 } else { 59837 setTimeout(nextIteration, 0); 59838 } 59839 } catch (e) { 59840 reject(e); 59841 } 59842 }; 59843 59844 setTimeout(nextIteration, 0); 59845 }); 59846 } 59847 59848 async _createPages() { 59849 try { 59850 this.pages = await this._createPagesHelper(); 59851 this.dims = this.pages.children.map(c => { 59852 const { 59853 width, 59854 height 59855 } = c.attributes.style; 59856 return [0, 0, parseInt(width), parseInt(height)]; 59857 }); 59858 } catch (e) { 59859 (0, _util.warn)(`XFA - an error occurred during layout: ${e}`); 59860 } 59861 } 59862 59863 getBoundingBox(pageIndex) { 59864 return this.dims[pageIndex]; 59865 } 59866 59867 async getNumPages() { 59868 if (!this.pages) { 59869 await this._createPages(); 59870 } 59871 59872 return this.dims.length; 59873 } 59874 59875 setImages(images) { 59876 this.form[_xfa_object.$globalData].images = images; 59877 } 59878 59879 setFonts(fonts) { 59880 this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts); 59881 const missingFonts = []; 59882 59883 for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) { 59884 typeface = (0, _utils.stripQuotes)(typeface); 59885 59886 const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface); 59887 59888 if (!font) { 59889 missingFonts.push(typeface); 59890 } 59891 } 59892 59893 if (missingFonts.length > 0) { 59894 return missingFonts; 59895 } 59896 59897 return null; 59898 } 59899 59900 appendFonts(fonts, reallyMissingFonts) { 59901 this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts); 59902 } 59903 59904 async getPages() { 59905 if (!this.pages) { 59906 await this._createPages(); 59907 } 59908 59909 const pages = this.pages; 59910 this.pages = null; 59911 return pages; 59912 } 59913 59914 serializeData(storage) { 59915 return this.dataHandler.serialize(storage); 59916 } 59917 59918 static _createDocument(data) { 59919 if (!data["/xdp:xdp"]) { 59920 return data["xdp:xdp"]; 59921 } 59922 59923 return Object.values(data).join(""); 59924 } 59925 59926 static getRichTextAsHtml(rc) { 59927 if (!rc || typeof rc !== "string") { 59928 return null; 59929 } 59930 59931 try { 59932 let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc); 59933 59934 if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) { 59935 const newRoot = _xhtml.XhtmlNamespace.body({}); 59936 59937 newRoot[_xfa_object.$appendChild](root); 59938 59939 root = newRoot; 59940 } 59941 59942 const result = root[_xfa_object.$toHTML](); 59943 59944 if (!result.success) { 59945 return null; 59946 } 59947 59948 const { 59949 html 59950 } = result; 59951 const { 59952 attributes 59953 } = html; 59954 59955 if (attributes) { 59956 if (attributes.class) { 59957 attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa")); 59958 } 59959 59960 attributes.dir = "auto"; 59961 } 59962 59963 return { 59964 html, 59965 str: root[_xfa_object.$text]() 59966 }; 59967 } catch (e) { 59968 (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`); 59969 } 59970 59971 return null; 59972 } 59973 59974} 59975 59976exports.XFAFactory = XFAFactory; 59977 59978/***/ }), 59979/* 77 */ 59980/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 59981 59982 59983 59984Object.defineProperty(exports, "__esModule", ({ 59985 value: true 59986})); 59987exports.XmlObject = exports.XFAObjectArray = exports.XFAObject = exports.XFAAttribute = exports.StringObject = exports.OptionObject = exports.Option10 = exports.Option01 = exports.IntegerObject = exports.ContentObject = exports.$uid = exports.$toStyle = exports.$toString = exports.$toPages = exports.$toHTML = exports.$text = exports.$tabIndex = exports.$setValue = exports.$setSetAttributes = exports.$setId = exports.$searchNode = exports.$root = exports.$resolvePrototypes = exports.$removeChild = exports.$pushPara = exports.$pushGlyphs = exports.$popPara = exports.$onText = exports.$onChildCheck = exports.$onChild = exports.$nsAttributes = exports.$nodeName = exports.$namespaceId = exports.$isUsable = exports.$isTransparent = exports.$isThereMoreWidth = exports.$isSplittable = exports.$isNsAgnostic = exports.$isDescendent = exports.$isDataValue = exports.$isCDATAXml = exports.$isBindable = exports.$insertAt = exports.$indexOf = exports.$ids = exports.$hasSettableValue = exports.$globalData = exports.$getTemplateRoot = exports.$getSubformParent = exports.$getRealChildrenByNameIt = exports.$getParent = exports.$getNextPage = exports.$getExtra = exports.$getDataValue = exports.$getContainedChildren = exports.$getChildrenByNameIt = exports.$getChildrenByName = exports.$getChildrenByClass = exports.$getChildren = exports.$getAvailableSpace = exports.$getAttributes = exports.$getAttributeIt = exports.$flushHTML = exports.$finalize = exports.$extra = exports.$dump = exports.$data = exports.$content = exports.$consumed = exports.$clone = exports.$cleanup = exports.$cleanPage = exports.$clean = exports.$childrenToHTML = exports.$appendChild = exports.$addHTML = exports.$acceptWhitespace = void 0; 59988 59989var _utils = __w_pdfjs_require__(78); 59990 59991var _util = __w_pdfjs_require__(2); 59992 59993var _core_utils = __w_pdfjs_require__(6); 59994 59995var _namespaces = __w_pdfjs_require__(79); 59996 59997var _som = __w_pdfjs_require__(80); 59998 59999const $acceptWhitespace = Symbol(); 60000exports.$acceptWhitespace = $acceptWhitespace; 60001const $addHTML = Symbol(); 60002exports.$addHTML = $addHTML; 60003const $appendChild = Symbol(); 60004exports.$appendChild = $appendChild; 60005const $childrenToHTML = Symbol(); 60006exports.$childrenToHTML = $childrenToHTML; 60007const $clean = Symbol(); 60008exports.$clean = $clean; 60009const $cleanPage = Symbol(); 60010exports.$cleanPage = $cleanPage; 60011const $cleanup = Symbol(); 60012exports.$cleanup = $cleanup; 60013const $clone = Symbol(); 60014exports.$clone = $clone; 60015const $consumed = Symbol(); 60016exports.$consumed = $consumed; 60017const $content = Symbol("content"); 60018exports.$content = $content; 60019const $data = Symbol("data"); 60020exports.$data = $data; 60021const $dump = Symbol(); 60022exports.$dump = $dump; 60023const $extra = Symbol("extra"); 60024exports.$extra = $extra; 60025const $finalize = Symbol(); 60026exports.$finalize = $finalize; 60027const $flushHTML = Symbol(); 60028exports.$flushHTML = $flushHTML; 60029const $getAttributeIt = Symbol(); 60030exports.$getAttributeIt = $getAttributeIt; 60031const $getAttributes = Symbol(); 60032exports.$getAttributes = $getAttributes; 60033const $getAvailableSpace = Symbol(); 60034exports.$getAvailableSpace = $getAvailableSpace; 60035const $getChildrenByClass = Symbol(); 60036exports.$getChildrenByClass = $getChildrenByClass; 60037const $getChildrenByName = Symbol(); 60038exports.$getChildrenByName = $getChildrenByName; 60039const $getChildrenByNameIt = Symbol(); 60040exports.$getChildrenByNameIt = $getChildrenByNameIt; 60041const $getDataValue = Symbol(); 60042exports.$getDataValue = $getDataValue; 60043const $getExtra = Symbol(); 60044exports.$getExtra = $getExtra; 60045const $getRealChildrenByNameIt = Symbol(); 60046exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt; 60047const $getChildren = Symbol(); 60048exports.$getChildren = $getChildren; 60049const $getContainedChildren = Symbol(); 60050exports.$getContainedChildren = $getContainedChildren; 60051const $getNextPage = Symbol(); 60052exports.$getNextPage = $getNextPage; 60053const $getSubformParent = Symbol(); 60054exports.$getSubformParent = $getSubformParent; 60055const $getParent = Symbol(); 60056exports.$getParent = $getParent; 60057const $getTemplateRoot = Symbol(); 60058exports.$getTemplateRoot = $getTemplateRoot; 60059const $globalData = Symbol(); 60060exports.$globalData = $globalData; 60061const $hasSettableValue = Symbol(); 60062exports.$hasSettableValue = $hasSettableValue; 60063const $ids = Symbol(); 60064exports.$ids = $ids; 60065const $indexOf = Symbol(); 60066exports.$indexOf = $indexOf; 60067const $insertAt = Symbol(); 60068exports.$insertAt = $insertAt; 60069const $isCDATAXml = Symbol(); 60070exports.$isCDATAXml = $isCDATAXml; 60071const $isBindable = Symbol(); 60072exports.$isBindable = $isBindable; 60073const $isDataValue = Symbol(); 60074exports.$isDataValue = $isDataValue; 60075const $isDescendent = Symbol(); 60076exports.$isDescendent = $isDescendent; 60077const $isNsAgnostic = Symbol(); 60078exports.$isNsAgnostic = $isNsAgnostic; 60079const $isSplittable = Symbol(); 60080exports.$isSplittable = $isSplittable; 60081const $isThereMoreWidth = Symbol(); 60082exports.$isThereMoreWidth = $isThereMoreWidth; 60083const $isTransparent = Symbol(); 60084exports.$isTransparent = $isTransparent; 60085const $isUsable = Symbol(); 60086exports.$isUsable = $isUsable; 60087const $lastAttribute = Symbol(); 60088const $namespaceId = Symbol("namespaceId"); 60089exports.$namespaceId = $namespaceId; 60090const $nodeName = Symbol("nodeName"); 60091exports.$nodeName = $nodeName; 60092const $nsAttributes = Symbol(); 60093exports.$nsAttributes = $nsAttributes; 60094const $onChild = Symbol(); 60095exports.$onChild = $onChild; 60096const $onChildCheck = Symbol(); 60097exports.$onChildCheck = $onChildCheck; 60098const $onText = Symbol(); 60099exports.$onText = $onText; 60100const $pushGlyphs = Symbol(); 60101exports.$pushGlyphs = $pushGlyphs; 60102const $popPara = Symbol(); 60103exports.$popPara = $popPara; 60104const $pushPara = Symbol(); 60105exports.$pushPara = $pushPara; 60106const $removeChild = Symbol(); 60107exports.$removeChild = $removeChild; 60108const $root = Symbol("root"); 60109exports.$root = $root; 60110const $resolvePrototypes = Symbol(); 60111exports.$resolvePrototypes = $resolvePrototypes; 60112const $searchNode = Symbol(); 60113exports.$searchNode = $searchNode; 60114const $setId = Symbol(); 60115exports.$setId = $setId; 60116const $setSetAttributes = Symbol(); 60117exports.$setSetAttributes = $setSetAttributes; 60118const $setValue = Symbol(); 60119exports.$setValue = $setValue; 60120const $tabIndex = Symbol(); 60121exports.$tabIndex = $tabIndex; 60122const $text = Symbol(); 60123exports.$text = $text; 60124const $toPages = Symbol(); 60125exports.$toPages = $toPages; 60126const $toHTML = Symbol(); 60127exports.$toHTML = $toHTML; 60128const $toString = Symbol(); 60129exports.$toString = $toString; 60130const $toStyle = Symbol(); 60131exports.$toStyle = $toStyle; 60132const $uid = Symbol("uid"); 60133exports.$uid = $uid; 60134 60135const _applyPrototype = Symbol(); 60136 60137const _attributes = Symbol(); 60138 60139const _attributeNames = Symbol(); 60140 60141const _children = Symbol("_children"); 60142 60143const _cloneAttribute = Symbol(); 60144 60145const _dataValue = Symbol(); 60146 60147const _defaultValue = Symbol(); 60148 60149const _filteredChildrenGenerator = Symbol(); 60150 60151const _getPrototype = Symbol(); 60152 60153const _getUnsetAttributes = Symbol(); 60154 60155const _hasChildren = Symbol(); 60156 60157const _max = Symbol(); 60158 60159const _options = Symbol(); 60160 60161const _parent = Symbol("parent"); 60162 60163const _resolvePrototypesHelper = Symbol(); 60164 60165const _setAttributes = Symbol(); 60166 60167const _validator = Symbol(); 60168 60169let uid = 0; 60170const NS_DATASETS = _namespaces.NamespaceIds.datasets.id; 60171 60172class XFAObject { 60173 constructor(nsId, name, hasChildren = false) { 60174 this[$namespaceId] = nsId; 60175 this[$nodeName] = name; 60176 this[_hasChildren] = hasChildren; 60177 this[_parent] = null; 60178 this[_children] = []; 60179 this[$uid] = `${name}${uid++}`; 60180 this[$globalData] = null; 60181 } 60182 60183 [$onChild](child) { 60184 if (!this[_hasChildren] || !this[$onChildCheck](child)) { 60185 return false; 60186 } 60187 60188 const name = child[$nodeName]; 60189 const node = this[name]; 60190 60191 if (node instanceof XFAObjectArray) { 60192 if (node.push(child)) { 60193 this[$appendChild](child); 60194 return true; 60195 } 60196 } else { 60197 if (node !== null) { 60198 this[$removeChild](node); 60199 } 60200 60201 this[name] = child; 60202 this[$appendChild](child); 60203 return true; 60204 } 60205 60206 let id = ""; 60207 60208 if (this.id) { 60209 id = ` (id: ${this.id})`; 60210 } else if (this.name) { 60211 id = ` (name: ${this.name} ${this.h.value})`; 60212 } 60213 60214 (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`); 60215 return false; 60216 } 60217 60218 [$onChildCheck](child) { 60219 return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId]; 60220 } 60221 60222 [$isNsAgnostic]() { 60223 return false; 60224 } 60225 60226 [$acceptWhitespace]() { 60227 return false; 60228 } 60229 60230 [$isCDATAXml]() { 60231 return false; 60232 } 60233 60234 [$isBindable]() { 60235 return false; 60236 } 60237 60238 [$popPara]() { 60239 if (this.para) { 60240 this[$getTemplateRoot]()[$extra].paraStack.pop(); 60241 } 60242 } 60243 60244 [$pushPara]() { 60245 this[$getTemplateRoot]()[$extra].paraStack.push(this.para); 60246 } 60247 60248 [$setId](ids) { 60249 if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) { 60250 ids.set(this.id, this); 60251 } 60252 } 60253 60254 [$getTemplateRoot]() { 60255 return this[$globalData].template; 60256 } 60257 60258 [$isSplittable]() { 60259 return false; 60260 } 60261 60262 [$isThereMoreWidth]() { 60263 return false; 60264 } 60265 60266 [$appendChild](child) { 60267 child[_parent] = this; 60268 60269 this[_children].push(child); 60270 60271 if (!child[$globalData] && this[$globalData]) { 60272 child[$globalData] = this[$globalData]; 60273 } 60274 } 60275 60276 [$removeChild](child) { 60277 const i = this[_children].indexOf(child); 60278 60279 this[_children].splice(i, 1); 60280 } 60281 60282 [$hasSettableValue]() { 60283 return this.hasOwnProperty("value"); 60284 } 60285 60286 [$setValue](_) {} 60287 60288 [$onText](_) {} 60289 60290 [$finalize]() {} 60291 60292 [$clean](builder) { 60293 delete this[_hasChildren]; 60294 60295 if (this[$cleanup]) { 60296 builder.clean(this[$cleanup]); 60297 delete this[$cleanup]; 60298 } 60299 } 60300 60301 [$indexOf](child) { 60302 return this[_children].indexOf(child); 60303 } 60304 60305 [$insertAt](i, child) { 60306 child[_parent] = this; 60307 60308 this[_children].splice(i, 0, child); 60309 60310 if (!child[$globalData] && this[$globalData]) { 60311 child[$globalData] = this[$globalData]; 60312 } 60313 } 60314 60315 [$isTransparent]() { 60316 return !this.name; 60317 } 60318 60319 [$lastAttribute]() { 60320 return ""; 60321 } 60322 60323 [$text]() { 60324 if (this[_children].length === 0) { 60325 return this[$content]; 60326 } 60327 60328 return this[_children].map(c => c[$text]()).join(""); 60329 } 60330 60331 get [_attributeNames]() { 60332 const proto = Object.getPrototypeOf(this); 60333 60334 if (!proto._attributes) { 60335 const attributes = proto._attributes = new Set(); 60336 60337 for (const name of Object.getOwnPropertyNames(this)) { 60338 if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) { 60339 break; 60340 } 60341 60342 attributes.add(name); 60343 } 60344 } 60345 60346 return (0, _util.shadow)(this, _attributeNames, proto._attributes); 60347 } 60348 60349 [$isDescendent](parent) { 60350 let node = this; 60351 60352 while (node) { 60353 if (node === parent) { 60354 return true; 60355 } 60356 60357 node = node[$getParent](); 60358 } 60359 60360 return false; 60361 } 60362 60363 [$getParent]() { 60364 return this[_parent]; 60365 } 60366 60367 [$getSubformParent]() { 60368 return this[$getParent](); 60369 } 60370 60371 [$getChildren](name = null) { 60372 if (!name) { 60373 return this[_children]; 60374 } 60375 60376 return this[name]; 60377 } 60378 60379 [$dump]() { 60380 const dumped = Object.create(null); 60381 60382 if (this[$content]) { 60383 dumped.$content = this[$content]; 60384 } 60385 60386 for (const name of Object.getOwnPropertyNames(this)) { 60387 const value = this[name]; 60388 60389 if (value === null) { 60390 continue; 60391 } 60392 60393 if (value instanceof XFAObject) { 60394 dumped[name] = value[$dump](); 60395 } else if (value instanceof XFAObjectArray) { 60396 if (!value.isEmpty()) { 60397 dumped[name] = value.dump(); 60398 } 60399 } else { 60400 dumped[name] = value; 60401 } 60402 } 60403 60404 return dumped; 60405 } 60406 60407 [$toStyle]() { 60408 return null; 60409 } 60410 60411 [$toHTML]() { 60412 return _utils.HTMLResult.EMPTY; 60413 } 60414 60415 *[$getContainedChildren]() { 60416 for (const node of this[$getChildren]()) { 60417 yield node; 60418 } 60419 } 60420 60421 *[_filteredChildrenGenerator](filter, include) { 60422 for (const node of this[$getContainedChildren]()) { 60423 if (!filter || include === filter.has(node[$nodeName])) { 60424 const availableSpace = this[$getAvailableSpace](); 60425 const res = node[$toHTML](availableSpace); 60426 60427 if (!res.success) { 60428 this[$extra].failingNode = node; 60429 } 60430 60431 yield res; 60432 } 60433 } 60434 } 60435 60436 [$flushHTML]() { 60437 return null; 60438 } 60439 60440 [$addHTML](html, bbox) { 60441 this[$extra].children.push(html); 60442 } 60443 60444 [$getAvailableSpace]() {} 60445 60446 [$childrenToHTML]({ 60447 filter = null, 60448 include = true 60449 }) { 60450 if (!this[$extra].generator) { 60451 this[$extra].generator = this[_filteredChildrenGenerator](filter, include); 60452 } else { 60453 const availableSpace = this[$getAvailableSpace](); 60454 const res = this[$extra].failingNode[$toHTML](availableSpace); 60455 60456 if (!res.success) { 60457 return res; 60458 } 60459 60460 if (res.html) { 60461 this[$addHTML](res.html, res.bbox); 60462 } 60463 60464 delete this[$extra].failingNode; 60465 } 60466 60467 while (true) { 60468 const gen = this[$extra].generator.next(); 60469 60470 if (gen.done) { 60471 break; 60472 } 60473 60474 const res = gen.value; 60475 60476 if (!res.success) { 60477 return res; 60478 } 60479 60480 if (res.html) { 60481 this[$addHTML](res.html, res.bbox); 60482 } 60483 } 60484 60485 this[$extra].generator = null; 60486 return _utils.HTMLResult.EMPTY; 60487 } 60488 60489 [$setSetAttributes](attributes) { 60490 this[_setAttributes] = new Set(Object.keys(attributes)); 60491 } 60492 60493 [_getUnsetAttributes](protoAttributes) { 60494 const allAttr = this[_attributeNames]; 60495 const setAttr = this[_setAttributes]; 60496 return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x)); 60497 } 60498 60499 [$resolvePrototypes](ids, ancestors = new Set()) { 60500 for (const child of this[_children]) { 60501 child[_resolvePrototypesHelper](ids, ancestors); 60502 } 60503 } 60504 60505 [_resolvePrototypesHelper](ids, ancestors) { 60506 const proto = this[_getPrototype](ids, ancestors); 60507 60508 if (proto) { 60509 this[_applyPrototype](proto, ids, ancestors); 60510 } else { 60511 this[$resolvePrototypes](ids, ancestors); 60512 } 60513 } 60514 60515 [_getPrototype](ids, ancestors) { 60516 const { 60517 use, 60518 usehref 60519 } = this; 60520 60521 if (!use && !usehref) { 60522 return null; 60523 } 60524 60525 let proto = null; 60526 let somExpression = null; 60527 let id = null; 60528 let ref = use; 60529 60530 if (usehref) { 60531 ref = usehref; 60532 60533 if (usehref.startsWith("#som(") && usehref.endsWith(")")) { 60534 somExpression = usehref.slice("#som(".length, usehref.length - 1); 60535 } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) { 60536 somExpression = usehref.slice(".#som(".length, usehref.length - 1); 60537 } else if (usehref.startsWith("#")) { 60538 id = usehref.slice(1); 60539 } else if (usehref.startsWith(".#")) { 60540 id = usehref.slice(2); 60541 } 60542 } else if (use.startsWith("#")) { 60543 id = use.slice(1); 60544 } else { 60545 somExpression = use; 60546 } 60547 60548 this.use = this.usehref = ""; 60549 60550 if (id) { 60551 proto = ids.get(id); 60552 } else { 60553 proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false); 60554 60555 if (proto) { 60556 proto = proto[0]; 60557 } 60558 } 60559 60560 if (!proto) { 60561 (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`); 60562 return null; 60563 } 60564 60565 if (proto[$nodeName] !== this[$nodeName]) { 60566 (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`); 60567 return null; 60568 } 60569 60570 if (ancestors.has(proto)) { 60571 (0, _util.warn)(`XFA - Cycle detected in prototypes use.`); 60572 return null; 60573 } 60574 60575 ancestors.add(proto); 60576 60577 const protoProto = proto[_getPrototype](ids, ancestors); 60578 60579 if (protoProto) { 60580 proto[_applyPrototype](protoProto, ids, ancestors); 60581 } 60582 60583 proto[$resolvePrototypes](ids, ancestors); 60584 ancestors.delete(proto); 60585 return proto; 60586 } 60587 60588 [_applyPrototype](proto, ids, ancestors) { 60589 if (ancestors.has(proto)) { 60590 (0, _util.warn)(`XFA - Cycle detected in prototypes use.`); 60591 return; 60592 } 60593 60594 if (!this[$content] && proto[$content]) { 60595 this[$content] = proto[$content]; 60596 } 60597 60598 const newAncestors = new Set(ancestors); 60599 newAncestors.add(proto); 60600 60601 for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) { 60602 this[unsetAttrName] = proto[unsetAttrName]; 60603 60604 if (this[_setAttributes]) { 60605 this[_setAttributes].add(unsetAttrName); 60606 } 60607 } 60608 60609 for (const name of Object.getOwnPropertyNames(this)) { 60610 if (this[_attributeNames].has(name)) { 60611 continue; 60612 } 60613 60614 const value = this[name]; 60615 const protoValue = proto[name]; 60616 60617 if (value instanceof XFAObjectArray) { 60618 for (const child of value[_children]) { 60619 child[_resolvePrototypesHelper](ids, ancestors); 60620 } 60621 60622 for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) { 60623 const child = proto[_children][i][$clone](); 60624 60625 if (value.push(child)) { 60626 child[_parent] = this; 60627 60628 this[_children].push(child); 60629 60630 child[_resolvePrototypesHelper](ids, ancestors); 60631 } else { 60632 break; 60633 } 60634 } 60635 60636 continue; 60637 } 60638 60639 if (value !== null) { 60640 value[$resolvePrototypes](ids, ancestors); 60641 60642 if (protoValue) { 60643 value[_applyPrototype](protoValue, ids, ancestors); 60644 } 60645 60646 continue; 60647 } 60648 60649 if (protoValue !== null) { 60650 const child = protoValue[$clone](); 60651 child[_parent] = this; 60652 this[name] = child; 60653 60654 this[_children].push(child); 60655 60656 child[_resolvePrototypesHelper](ids, ancestors); 60657 } 60658 } 60659 } 60660 60661 static [_cloneAttribute](obj) { 60662 if (Array.isArray(obj)) { 60663 return obj.map(x => XFAObject[_cloneAttribute](x)); 60664 } 60665 60666 if (typeof obj === "object" && obj !== null) { 60667 return Object.assign({}, obj); 60668 } 60669 60670 return obj; 60671 } 60672 60673 [$clone]() { 60674 const clone = Object.create(Object.getPrototypeOf(this)); 60675 60676 for (const $symbol of Object.getOwnPropertySymbols(this)) { 60677 try { 60678 clone[$symbol] = this[$symbol]; 60679 } catch (_) { 60680 (0, _util.shadow)(clone, $symbol, this[$symbol]); 60681 } 60682 } 60683 60684 clone[$uid] = `${clone[$nodeName]}${uid++}`; 60685 clone[_children] = []; 60686 60687 for (const name of Object.getOwnPropertyNames(this)) { 60688 if (this[_attributeNames].has(name)) { 60689 clone[name] = XFAObject[_cloneAttribute](this[name]); 60690 continue; 60691 } 60692 60693 const value = this[name]; 60694 60695 if (value instanceof XFAObjectArray) { 60696 clone[name] = new XFAObjectArray(value[_max]); 60697 } else { 60698 clone[name] = null; 60699 } 60700 } 60701 60702 for (const child of this[_children]) { 60703 const name = child[$nodeName]; 60704 const clonedChild = child[$clone](); 60705 60706 clone[_children].push(clonedChild); 60707 60708 clonedChild[_parent] = clone; 60709 60710 if (clone[name] === null) { 60711 clone[name] = clonedChild; 60712 } else { 60713 clone[name][_children].push(clonedChild); 60714 } 60715 } 60716 60717 return clone; 60718 } 60719 60720 [$getChildren](name = null) { 60721 if (!name) { 60722 return this[_children]; 60723 } 60724 60725 return this[_children].filter(c => c[$nodeName] === name); 60726 } 60727 60728 [$getChildrenByClass](name) { 60729 return this[name]; 60730 } 60731 60732 [$getChildrenByName](name, allTransparent, first = true) { 60733 return Array.from(this[$getChildrenByNameIt](name, allTransparent, first)); 60734 } 60735 60736 *[$getChildrenByNameIt](name, allTransparent, first = true) { 60737 if (name === "parent") { 60738 yield this[_parent]; 60739 return; 60740 } 60741 60742 for (const child of this[_children]) { 60743 if (child[$nodeName] === name) { 60744 yield child; 60745 } 60746 60747 if (child.name === name) { 60748 yield child; 60749 } 60750 60751 if (allTransparent || child[$isTransparent]()) { 60752 yield* child[$getChildrenByNameIt](name, allTransparent, false); 60753 } 60754 } 60755 60756 if (first && this[_attributeNames].has(name)) { 60757 yield new XFAAttribute(this, name, this[name]); 60758 } 60759 } 60760 60761} 60762 60763exports.XFAObject = XFAObject; 60764 60765class XFAObjectArray { 60766 constructor(max = Infinity) { 60767 this[_max] = max; 60768 this[_children] = []; 60769 } 60770 60771 push(child) { 60772 const len = this[_children].length; 60773 60774 if (len <= this[_max]) { 60775 this[_children].push(child); 60776 60777 return true; 60778 } 60779 60780 (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`); 60781 return false; 60782 } 60783 60784 isEmpty() { 60785 return this[_children].length === 0; 60786 } 60787 60788 dump() { 60789 return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]()); 60790 } 60791 60792 [$clone]() { 60793 const clone = new XFAObjectArray(this[_max]); 60794 clone[_children] = this[_children].map(c => c[$clone]()); 60795 return clone; 60796 } 60797 60798 get children() { 60799 return this[_children]; 60800 } 60801 60802 clear() { 60803 this[_children].length = 0; 60804 } 60805 60806} 60807 60808exports.XFAObjectArray = XFAObjectArray; 60809 60810class XFAAttribute { 60811 constructor(node, name, value) { 60812 this[_parent] = node; 60813 this[$nodeName] = name; 60814 this[$content] = value; 60815 this[$consumed] = false; 60816 this[$uid] = `attribute${uid++}`; 60817 } 60818 60819 [$getParent]() { 60820 return this[_parent]; 60821 } 60822 60823 [$isDataValue]() { 60824 return true; 60825 } 60826 60827 [$getDataValue]() { 60828 return this[$content].trim(); 60829 } 60830 60831 [$setValue](value) { 60832 value = value.value || ""; 60833 this[$content] = value.toString(); 60834 } 60835 60836 [$text]() { 60837 return this[$content]; 60838 } 60839 60840 [$isDescendent](parent) { 60841 return this[_parent] === parent || this[_parent][$isDescendent](parent); 60842 } 60843 60844} 60845 60846exports.XFAAttribute = XFAAttribute; 60847 60848class XmlObject extends XFAObject { 60849 constructor(nsId, name, attributes = {}) { 60850 super(nsId, name); 60851 this[$content] = ""; 60852 this[_dataValue] = null; 60853 60854 if (name !== "#text") { 60855 const map = new Map(); 60856 this[_attributes] = map; 60857 60858 for (const [attrName, value] of Object.entries(attributes)) { 60859 map.set(attrName, new XFAAttribute(this, attrName, value)); 60860 } 60861 60862 if (attributes.hasOwnProperty($nsAttributes)) { 60863 const dataNode = attributes[$nsAttributes].xfa.dataNode; 60864 60865 if (dataNode !== undefined) { 60866 if (dataNode === "dataGroup") { 60867 this[_dataValue] = false; 60868 } else if (dataNode === "dataValue") { 60869 this[_dataValue] = true; 60870 } 60871 } 60872 } 60873 } 60874 60875 this[$consumed] = false; 60876 } 60877 60878 [$toString](buf) { 60879 const tagName = this[$nodeName]; 60880 60881 if (tagName === "#text") { 60882 buf.push((0, _core_utils.encodeToXmlString)(this[$content])); 60883 return; 60884 } 60885 60886 const utf8TagName = (0, _util.utf8StringToString)(tagName); 60887 const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : ""; 60888 buf.push(`<${prefix}${utf8TagName}`); 60889 60890 for (const [name, value] of this[_attributes].entries()) { 60891 const utf8Name = (0, _util.utf8StringToString)(name); 60892 buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`); 60893 } 60894 60895 if (this[_dataValue] !== null) { 60896 if (this[_dataValue]) { 60897 buf.push(` xfa:dataNode="dataValue"`); 60898 } else { 60899 buf.push(` xfa:dataNode="dataGroup"`); 60900 } 60901 } 60902 60903 if (!this[$content] && this[_children].length === 0) { 60904 buf.push("/>"); 60905 return; 60906 } 60907 60908 buf.push(">"); 60909 60910 if (this[$content]) { 60911 if (typeof this[$content] === "string") { 60912 buf.push((0, _core_utils.encodeToXmlString)(this[$content])); 60913 } else { 60914 this[$content][$toString](buf); 60915 } 60916 } else { 60917 for (const child of this[_children]) { 60918 child[$toString](buf); 60919 } 60920 } 60921 60922 buf.push(`</${prefix}${utf8TagName}>`); 60923 } 60924 60925 [$onChild](child) { 60926 if (this[$content]) { 60927 const node = new XmlObject(this[$namespaceId], "#text"); 60928 this[$appendChild](node); 60929 node[$content] = this[$content]; 60930 this[$content] = ""; 60931 } 60932 60933 this[$appendChild](child); 60934 return true; 60935 } 60936 60937 [$onText](str) { 60938 this[$content] += str; 60939 } 60940 60941 [$finalize]() { 60942 if (this[$content] && this[_children].length > 0) { 60943 const node = new XmlObject(this[$namespaceId], "#text"); 60944 this[$appendChild](node); 60945 node[$content] = this[$content]; 60946 delete this[$content]; 60947 } 60948 } 60949 60950 [$toHTML]() { 60951 if (this[$nodeName] === "#text") { 60952 return _utils.HTMLResult.success({ 60953 name: "#text", 60954 value: this[$content] 60955 }); 60956 } 60957 60958 return _utils.HTMLResult.EMPTY; 60959 } 60960 60961 [$getChildren](name = null) { 60962 if (!name) { 60963 return this[_children]; 60964 } 60965 60966 return this[_children].filter(c => c[$nodeName] === name); 60967 } 60968 60969 [$getAttributes]() { 60970 return this[_attributes]; 60971 } 60972 60973 [$getChildrenByClass](name) { 60974 const value = this[_attributes].get(name); 60975 60976 if (value !== undefined) { 60977 return value; 60978 } 60979 60980 return this[$getChildren](name); 60981 } 60982 60983 *[$getChildrenByNameIt](name, allTransparent) { 60984 const value = this[_attributes].get(name); 60985 60986 if (value) { 60987 yield value; 60988 } 60989 60990 for (const child of this[_children]) { 60991 if (child[$nodeName] === name) { 60992 yield child; 60993 } 60994 60995 if (allTransparent) { 60996 yield* child[$getChildrenByNameIt](name, allTransparent); 60997 } 60998 } 60999 } 61000 61001 *[$getAttributeIt](name, skipConsumed) { 61002 const value = this[_attributes].get(name); 61003 61004 if (value && (!skipConsumed || !value[$consumed])) { 61005 yield value; 61006 } 61007 61008 for (const child of this[_children]) { 61009 yield* child[$getAttributeIt](name, skipConsumed); 61010 } 61011 } 61012 61013 *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) { 61014 for (const child of this[_children]) { 61015 if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) { 61016 yield child; 61017 } 61018 61019 if (allTransparent) { 61020 yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed); 61021 } 61022 } 61023 } 61024 61025 [$isDataValue]() { 61026 if (this[_dataValue] === null) { 61027 return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id; 61028 } 61029 61030 return this[_dataValue]; 61031 } 61032 61033 [$getDataValue]() { 61034 if (this[_dataValue] === null) { 61035 if (this[_children].length === 0) { 61036 return this[$content].trim(); 61037 } 61038 61039 if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) { 61040 return this[_children][0][$text]().trim(); 61041 } 61042 61043 return null; 61044 } 61045 61046 return this[$content].trim(); 61047 } 61048 61049 [$setValue](value) { 61050 value = value.value || ""; 61051 this[$content] = value.toString(); 61052 } 61053 61054 [$dump](hasNS = false) { 61055 const dumped = Object.create(null); 61056 61057 if (hasNS) { 61058 dumped.$ns = this[$namespaceId]; 61059 } 61060 61061 if (this[$content]) { 61062 dumped.$content = this[$content]; 61063 } 61064 61065 dumped.$name = this[$nodeName]; 61066 dumped.children = []; 61067 61068 for (const child of this[_children]) { 61069 dumped.children.push(child[$dump](hasNS)); 61070 } 61071 61072 dumped.attributes = Object.create(null); 61073 61074 for (const [name, value] of this[_attributes]) { 61075 dumped.attributes[name] = value[$content]; 61076 } 61077 61078 return dumped; 61079 } 61080 61081} 61082 61083exports.XmlObject = XmlObject; 61084 61085class ContentObject extends XFAObject { 61086 constructor(nsId, name) { 61087 super(nsId, name); 61088 this[$content] = ""; 61089 } 61090 61091 [$onText](text) { 61092 this[$content] += text; 61093 } 61094 61095 [$finalize]() {} 61096 61097} 61098 61099exports.ContentObject = ContentObject; 61100 61101class OptionObject extends ContentObject { 61102 constructor(nsId, name, options) { 61103 super(nsId, name); 61104 this[_options] = options; 61105 } 61106 61107 [$finalize]() { 61108 this[$content] = (0, _utils.getKeyword)({ 61109 data: this[$content], 61110 defaultValue: this[_options][0], 61111 validate: k => this[_options].includes(k) 61112 }); 61113 } 61114 61115 [$clean](builder) { 61116 super[$clean](builder); 61117 delete this[_options]; 61118 } 61119 61120} 61121 61122exports.OptionObject = OptionObject; 61123 61124class StringObject extends ContentObject { 61125 [$finalize]() { 61126 this[$content] = this[$content].trim(); 61127 } 61128 61129} 61130 61131exports.StringObject = StringObject; 61132 61133class IntegerObject extends ContentObject { 61134 constructor(nsId, name, defaultValue, validator) { 61135 super(nsId, name); 61136 this[_defaultValue] = defaultValue; 61137 this[_validator] = validator; 61138 } 61139 61140 [$finalize]() { 61141 this[$content] = (0, _utils.getInteger)({ 61142 data: this[$content], 61143 defaultValue: this[_defaultValue], 61144 validate: this[_validator] 61145 }); 61146 } 61147 61148 [$clean](builder) { 61149 super[$clean](builder); 61150 delete this[_defaultValue]; 61151 delete this[_validator]; 61152 } 61153 61154} 61155 61156exports.IntegerObject = IntegerObject; 61157 61158class Option01 extends IntegerObject { 61159 constructor(nsId, name) { 61160 super(nsId, name, 0, n => n === 1); 61161 } 61162 61163} 61164 61165exports.Option01 = Option01; 61166 61167class Option10 extends IntegerObject { 61168 constructor(nsId, name) { 61169 super(nsId, name, 1, n => n === 0); 61170 } 61171 61172} 61173 61174exports.Option10 = Option10; 61175 61176/***/ }), 61177/* 78 */ 61178/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 61179 61180 61181 61182Object.defineProperty(exports, "__esModule", ({ 61183 value: true 61184})); 61185exports.HTMLResult = void 0; 61186exports.getBBox = getBBox; 61187exports.getColor = getColor; 61188exports.getFloat = getFloat; 61189exports.getInteger = getInteger; 61190exports.getKeyword = getKeyword; 61191exports.getMeasurement = getMeasurement; 61192exports.getRatio = getRatio; 61193exports.getRelevant = getRelevant; 61194exports.getStringOption = getStringOption; 61195exports.stripQuotes = stripQuotes; 61196 61197var _util = __w_pdfjs_require__(2); 61198 61199const dimConverters = { 61200 pt: x => x, 61201 cm: x => x / 2.54 * 72, 61202 mm: x => x / (10 * 2.54) * 72, 61203 in: x => x * 72, 61204 px: x => x 61205}; 61206const measurementPattern = /([+-]?\d+\.?\d*)(.*)/; 61207 61208function stripQuotes(str) { 61209 if (str.startsWith("'") || str.startsWith('"')) { 61210 return str.slice(1, str.length - 1); 61211 } 61212 61213 return str; 61214} 61215 61216function getInteger({ 61217 data, 61218 defaultValue, 61219 validate 61220}) { 61221 if (!data) { 61222 return defaultValue; 61223 } 61224 61225 data = data.trim(); 61226 const n = parseInt(data, 10); 61227 61228 if (!isNaN(n) && validate(n)) { 61229 return n; 61230 } 61231 61232 return defaultValue; 61233} 61234 61235function getFloat({ 61236 data, 61237 defaultValue, 61238 validate 61239}) { 61240 if (!data) { 61241 return defaultValue; 61242 } 61243 61244 data = data.trim(); 61245 const n = parseFloat(data); 61246 61247 if (!isNaN(n) && validate(n)) { 61248 return n; 61249 } 61250 61251 return defaultValue; 61252} 61253 61254function getKeyword({ 61255 data, 61256 defaultValue, 61257 validate 61258}) { 61259 if (!data) { 61260 return defaultValue; 61261 } 61262 61263 data = data.trim(); 61264 61265 if (validate(data)) { 61266 return data; 61267 } 61268 61269 return defaultValue; 61270} 61271 61272function getStringOption(data, options) { 61273 return getKeyword({ 61274 data, 61275 defaultValue: options[0], 61276 validate: k => options.includes(k) 61277 }); 61278} 61279 61280function getMeasurement(str, def = "0") { 61281 def = def || "0"; 61282 61283 if (!str) { 61284 return getMeasurement(def); 61285 } 61286 61287 const match = str.trim().match(measurementPattern); 61288 61289 if (!match) { 61290 return getMeasurement(def); 61291 } 61292 61293 const [, valueStr, unit] = match; 61294 const value = parseFloat(valueStr); 61295 61296 if (isNaN(value)) { 61297 return getMeasurement(def); 61298 } 61299 61300 if (value === 0) { 61301 return 0; 61302 } 61303 61304 const conv = dimConverters[unit]; 61305 61306 if (conv) { 61307 return conv(value); 61308 } 61309 61310 return value; 61311} 61312 61313function getRatio(data) { 61314 if (!data) { 61315 return { 61316 num: 1, 61317 den: 1 61318 }; 61319 } 61320 61321 const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x)); 61322 61323 if (ratio.length === 1) { 61324 ratio.push(1); 61325 } 61326 61327 if (ratio.length === 0) { 61328 return { 61329 num: 1, 61330 den: 1 61331 }; 61332 } 61333 61334 const [num, den] = ratio; 61335 return { 61336 num, 61337 den 61338 }; 61339} 61340 61341function getRelevant(data) { 61342 if (!data) { 61343 return []; 61344 } 61345 61346 return data.trim().split(/\s+/).map(e => { 61347 return { 61348 excluded: e[0] === "-", 61349 viewname: e.substring(1) 61350 }; 61351 }); 61352} 61353 61354function getColor(data, def = [0, 0, 0]) { 61355 let [r, g, b] = def; 61356 61357 if (!data) { 61358 return { 61359 r, 61360 g, 61361 b 61362 }; 61363 } 61364 61365 const color = data.trim().split(/\s*,\s*/).map(c => Math.min(Math.max(0, parseInt(c.trim(), 10)), 255)).map(c => isNaN(c) ? 0 : c); 61366 61367 if (color.length < 3) { 61368 return { 61369 r, 61370 g, 61371 b 61372 }; 61373 } 61374 61375 [r, g, b] = color; 61376 return { 61377 r, 61378 g, 61379 b 61380 }; 61381} 61382 61383function getBBox(data) { 61384 const def = -1; 61385 61386 if (!data) { 61387 return { 61388 x: def, 61389 y: def, 61390 width: def, 61391 height: def 61392 }; 61393 } 61394 61395 const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1")); 61396 61397 if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) { 61398 return { 61399 x: def, 61400 y: def, 61401 width: def, 61402 height: def 61403 }; 61404 } 61405 61406 const [x, y, width, height] = bbox; 61407 return { 61408 x, 61409 y, 61410 width, 61411 height 61412 }; 61413} 61414 61415class HTMLResult { 61416 static get FAILURE() { 61417 return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null)); 61418 } 61419 61420 static get EMPTY() { 61421 return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null)); 61422 } 61423 61424 constructor(success, html, bbox, breakNode) { 61425 this.success = success; 61426 this.html = html; 61427 this.bbox = bbox; 61428 this.breakNode = breakNode; 61429 } 61430 61431 isBreak() { 61432 return !!this.breakNode; 61433 } 61434 61435 static breakNode(node) { 61436 return new HTMLResult(false, null, null, node); 61437 } 61438 61439 static success(html, bbox = null) { 61440 return new HTMLResult(true, html, bbox, null); 61441 } 61442 61443} 61444 61445exports.HTMLResult = HTMLResult; 61446 61447/***/ }), 61448/* 79 */ 61449/***/ ((__unused_webpack_module, exports) => { 61450 61451 61452 61453Object.defineProperty(exports, "__esModule", ({ 61454 value: true 61455})); 61456exports.NamespaceIds = exports.$buildXFAObject = void 0; 61457const $buildXFAObject = Symbol(); 61458exports.$buildXFAObject = $buildXFAObject; 61459const NamespaceIds = { 61460 config: { 61461 id: 0, 61462 check: ns => ns.startsWith("http://www.xfa.org/schema/xci/") 61463 }, 61464 connectionSet: { 61465 id: 1, 61466 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/") 61467 }, 61468 datasets: { 61469 id: 2, 61470 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/") 61471 }, 61472 form: { 61473 id: 3, 61474 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/") 61475 }, 61476 localeSet: { 61477 id: 4, 61478 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/") 61479 }, 61480 pdf: { 61481 id: 5, 61482 check: ns => ns === "http://ns.adobe.com/xdp/pdf/" 61483 }, 61484 signature: { 61485 id: 6, 61486 check: ns => ns === "http://www.w3.org/2000/09/xmldsig#" 61487 }, 61488 sourceSet: { 61489 id: 7, 61490 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/") 61491 }, 61492 stylesheet: { 61493 id: 8, 61494 check: ns => ns === "http://www.w3.org/1999/XSL/Transform" 61495 }, 61496 template: { 61497 id: 9, 61498 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/") 61499 }, 61500 xdc: { 61501 id: 10, 61502 check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/") 61503 }, 61504 xdp: { 61505 id: 11, 61506 check: ns => ns === "http://ns.adobe.com/xdp/" 61507 }, 61508 xfdf: { 61509 id: 12, 61510 check: ns => ns === "http://ns.adobe.com/xfdf/" 61511 }, 61512 xhtml: { 61513 id: 13, 61514 check: ns => ns === "http://www.w3.org/1999/xhtml" 61515 }, 61516 xmpmeta: { 61517 id: 14, 61518 check: ns => ns === "http://ns.adobe.com/xmpmeta/" 61519 } 61520}; 61521exports.NamespaceIds = NamespaceIds; 61522 61523/***/ }), 61524/* 80 */ 61525/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 61526 61527 61528 61529Object.defineProperty(exports, "__esModule", ({ 61530 value: true 61531})); 61532exports.createDataNode = createDataNode; 61533exports.searchNode = searchNode; 61534 61535var _xfa_object = __w_pdfjs_require__(77); 61536 61537var _namespaces = __w_pdfjs_require__(79); 61538 61539var _util = __w_pdfjs_require__(2); 61540 61541const namePattern = /^[^.[]+/; 61542const indexPattern = /^[^\]]+/; 61543const operators = { 61544 dot: 0, 61545 dotDot: 1, 61546 dotHash: 2, 61547 dotBracket: 3, 61548 dotParen: 4 61549}; 61550const shortcuts = new Map([["$data", (root, current) => root.datasets ? root.datasets.data : root], ["$record", (root, current) => (root.datasets ? root.datasets.data : root)[_xfa_object.$getChildren]()[0]], ["$template", (root, current) => root.template], ["$connectionSet", (root, current) => root.connectionSet], ["$form", (root, current) => root.form], ["$layout", (root, current) => root.layout], ["$host", (root, current) => root.host], ["$dataWindow", (root, current) => root.dataWindow], ["$event", (root, current) => root.event], ["!", (root, current) => root.datasets], ["$xfa", (root, current) => root], ["xfa", (root, current) => root], ["$", (root, current) => current]]); 61551const somCache = new WeakMap(); 61552const NS_DATASETS = _namespaces.NamespaceIds.datasets.id; 61553 61554function parseIndex(index) { 61555 index = index.trim(); 61556 61557 if (index === "*") { 61558 return Infinity; 61559 } 61560 61561 return parseInt(index, 10) || 0; 61562} 61563 61564function parseExpression(expr, dotDotAllowed, noExpr = true) { 61565 let match = expr.match(namePattern); 61566 61567 if (!match) { 61568 return null; 61569 } 61570 61571 let [name] = match; 61572 const parsed = [{ 61573 name, 61574 cacheName: "." + name, 61575 index: 0, 61576 js: null, 61577 formCalc: null, 61578 operator: operators.dot 61579 }]; 61580 let pos = name.length; 61581 61582 while (pos < expr.length) { 61583 const spos = pos; 61584 const char = expr.charAt(pos++); 61585 61586 if (char === "[") { 61587 match = expr.slice(pos).match(indexPattern); 61588 61589 if (!match) { 61590 (0, _util.warn)("XFA - Invalid index in SOM expression"); 61591 return null; 61592 } 61593 61594 parsed.at(-1).index = parseIndex(match[0]); 61595 pos += match[0].length + 1; 61596 continue; 61597 } 61598 61599 let operator; 61600 61601 switch (expr.charAt(pos)) { 61602 case ".": 61603 if (!dotDotAllowed) { 61604 return null; 61605 } 61606 61607 pos++; 61608 operator = operators.dotDot; 61609 break; 61610 61611 case "#": 61612 pos++; 61613 operator = operators.dotHash; 61614 break; 61615 61616 case "[": 61617 if (noExpr) { 61618 (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now."); 61619 return null; 61620 } 61621 61622 operator = operators.dotBracket; 61623 break; 61624 61625 case "(": 61626 if (noExpr) { 61627 (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now."); 61628 return null; 61629 } 61630 61631 operator = operators.dotParen; 61632 break; 61633 61634 default: 61635 operator = operators.dot; 61636 break; 61637 } 61638 61639 match = expr.slice(pos).match(namePattern); 61640 61641 if (!match) { 61642 break; 61643 } 61644 61645 [name] = match; 61646 pos += name.length; 61647 parsed.push({ 61648 name, 61649 cacheName: expr.slice(spos, pos), 61650 operator, 61651 index: 0, 61652 js: null, 61653 formCalc: null 61654 }); 61655 } 61656 61657 return parsed; 61658} 61659 61660function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) { 61661 const parsed = parseExpression(expr, dotDotAllowed); 61662 61663 if (!parsed) { 61664 return null; 61665 } 61666 61667 const fn = shortcuts.get(parsed[0].name); 61668 let i = 0; 61669 let isQualified; 61670 61671 if (fn) { 61672 isQualified = true; 61673 root = [fn(root, container)]; 61674 i = 1; 61675 } else { 61676 isQualified = container === null; 61677 root = [container || root]; 61678 } 61679 61680 for (let ii = parsed.length; i < ii; i++) { 61681 const { 61682 name, 61683 cacheName, 61684 operator, 61685 index 61686 } = parsed[i]; 61687 const nodes = []; 61688 61689 for (const node of root) { 61690 if (!(node instanceof _xfa_object.XFAObject)) { 61691 continue; 61692 } 61693 61694 let children, cached; 61695 61696 if (useCache) { 61697 cached = somCache.get(node); 61698 61699 if (!cached) { 61700 cached = new Map(); 61701 somCache.set(node, cached); 61702 } 61703 61704 children = cached.get(cacheName); 61705 } 61706 61707 if (!children) { 61708 switch (operator) { 61709 case operators.dot: 61710 children = node[_xfa_object.$getChildrenByName](name, false); 61711 break; 61712 61713 case operators.dotDot: 61714 children = node[_xfa_object.$getChildrenByName](name, true); 61715 break; 61716 61717 case operators.dotHash: 61718 children = node[_xfa_object.$getChildrenByClass](name); 61719 61720 if (children instanceof _xfa_object.XFAObjectArray) { 61721 children = children.children; 61722 } else { 61723 children = [children]; 61724 } 61725 61726 break; 61727 61728 default: 61729 break; 61730 } 61731 61732 if (useCache) { 61733 cached.set(cacheName, children); 61734 } 61735 } 61736 61737 if (children.length > 0) { 61738 nodes.push(children); 61739 } 61740 } 61741 61742 if (nodes.length === 0 && !isQualified && i === 0) { 61743 const parent = container[_xfa_object.$getParent](); 61744 61745 container = parent; 61746 61747 if (!container) { 61748 return null; 61749 } 61750 61751 i = -1; 61752 root = [container]; 61753 continue; 61754 } 61755 61756 if (isFinite(index)) { 61757 root = nodes.filter(node => index < node.length).map(node => node[index]); 61758 } else { 61759 root = nodes.flat(); 61760 } 61761 } 61762 61763 if (root.length === 0) { 61764 return null; 61765 } 61766 61767 return root; 61768} 61769 61770function createNodes(root, path) { 61771 let node = null; 61772 61773 for (const { 61774 name, 61775 index 61776 } of path) { 61777 for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) { 61778 const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId]; 61779 node = new _xfa_object.XmlObject(nsId, name); 61780 61781 root[_xfa_object.$appendChild](node); 61782 } 61783 61784 root = node; 61785 } 61786 61787 return node; 61788} 61789 61790function createDataNode(root, container, expr) { 61791 const parsed = parseExpression(expr); 61792 61793 if (!parsed) { 61794 return null; 61795 } 61796 61797 if (parsed.some(x => x.operator === operators.dotDot)) { 61798 return null; 61799 } 61800 61801 const fn = shortcuts.get(parsed[0].name); 61802 let i = 0; 61803 61804 if (fn) { 61805 root = fn(root, container); 61806 i = 1; 61807 } else { 61808 root = container || root; 61809 } 61810 61811 for (let ii = parsed.length; i < ii; i++) { 61812 const { 61813 name, 61814 operator, 61815 index 61816 } = parsed[i]; 61817 61818 if (!isFinite(index)) { 61819 parsed[i].index = 0; 61820 return createNodes(root, parsed.slice(i)); 61821 } 61822 61823 let children; 61824 61825 switch (operator) { 61826 case operators.dot: 61827 children = root[_xfa_object.$getChildrenByName](name, false); 61828 break; 61829 61830 case operators.dotDot: 61831 children = root[_xfa_object.$getChildrenByName](name, true); 61832 break; 61833 61834 case operators.dotHash: 61835 children = root[_xfa_object.$getChildrenByClass](name); 61836 61837 if (children instanceof _xfa_object.XFAObjectArray) { 61838 children = children.children; 61839 } else { 61840 children = [children]; 61841 } 61842 61843 break; 61844 61845 default: 61846 break; 61847 } 61848 61849 if (children.length === 0) { 61850 return createNodes(root, parsed.slice(i)); 61851 } 61852 61853 if (index < children.length) { 61854 const child = children[index]; 61855 61856 if (!(child instanceof _xfa_object.XFAObject)) { 61857 (0, _util.warn)(`XFA - Cannot create a node.`); 61858 return null; 61859 } 61860 61861 root = child; 61862 } else { 61863 parsed[i].index = index - children.length; 61864 return createNodes(root, parsed.slice(i)); 61865 } 61866 } 61867 61868 return null; 61869} 61870 61871/***/ }), 61872/* 81 */ 61873/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 61874 61875 61876 61877Object.defineProperty(exports, "__esModule", ({ 61878 value: true 61879})); 61880exports.Binder = void 0; 61881 61882var _xfa_object = __w_pdfjs_require__(77); 61883 61884var _template = __w_pdfjs_require__(82); 61885 61886var _som = __w_pdfjs_require__(80); 61887 61888var _namespaces = __w_pdfjs_require__(79); 61889 61890var _util = __w_pdfjs_require__(2); 61891 61892const NS_DATASETS = _namespaces.NamespaceIds.datasets.id; 61893 61894function createText(content) { 61895 const node = new _template.Text({}); 61896 node[_xfa_object.$content] = content; 61897 return node; 61898} 61899 61900class Binder { 61901 constructor(root) { 61902 this.root = root; 61903 this.datasets = root.datasets; 61904 61905 if (root.datasets && root.datasets.data) { 61906 this.data = root.datasets.data; 61907 } else { 61908 this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data"); 61909 } 61910 61911 this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0; 61912 this.root.form = this.form = root.template[_xfa_object.$clone](); 61913 } 61914 61915 _isConsumeData() { 61916 return !this.emptyMerge && this._mergeMode; 61917 } 61918 61919 _isMatchTemplate() { 61920 return !this._isConsumeData(); 61921 } 61922 61923 bind() { 61924 this._bindElement(this.form, this.data); 61925 61926 return this.form; 61927 } 61928 61929 getData() { 61930 return this.data; 61931 } 61932 61933 _bindValue(formNode, data, picture) { 61934 formNode[_xfa_object.$data] = data; 61935 61936 if (formNode[_xfa_object.$hasSettableValue]()) { 61937 if (data[_xfa_object.$isDataValue]()) { 61938 const value = data[_xfa_object.$getDataValue](); 61939 61940 formNode[_xfa_object.$setValue](createText(value)); 61941 } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") { 61942 const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n"); 61943 61944 formNode[_xfa_object.$setValue](createText(value)); 61945 } else if (this._isConsumeData()) { 61946 (0, _util.warn)(`XFA - Nodes haven't the same type.`); 61947 } 61948 } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) { 61949 this._bindElement(formNode, data); 61950 } else { 61951 (0, _util.warn)(`XFA - Nodes haven't the same type.`); 61952 } 61953 } 61954 61955 _findDataByNameToConsume(name, isValue, dataNode, global) { 61956 if (!name) { 61957 return null; 61958 } 61959 61960 let generator, match; 61961 61962 for (let i = 0; i < 3; i++) { 61963 generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true); 61964 61965 while (true) { 61966 match = generator.next().value; 61967 61968 if (!match) { 61969 break; 61970 } 61971 61972 if (isValue === match[_xfa_object.$isDataValue]()) { 61973 return match; 61974 } 61975 } 61976 61977 if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") { 61978 break; 61979 } 61980 61981 dataNode = dataNode[_xfa_object.$getParent](); 61982 } 61983 61984 if (!global) { 61985 return null; 61986 } 61987 61988 generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false); 61989 match = generator.next().value; 61990 61991 if (match) { 61992 return match; 61993 } 61994 61995 generator = this.data[_xfa_object.$getAttributeIt](name, true); 61996 match = generator.next().value; 61997 61998 if (match && match[_xfa_object.$isDataValue]()) { 61999 return match; 62000 } 62001 62002 return null; 62003 } 62004 62005 _setProperties(formNode, dataNode) { 62006 if (!formNode.hasOwnProperty("setProperty")) { 62007 return; 62008 } 62009 62010 for (const { 62011 ref, 62012 target, 62013 connection 62014 } of formNode.setProperty.children) { 62015 if (connection) { 62016 continue; 62017 } 62018 62019 if (!ref) { 62020 continue; 62021 } 62022 62023 const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false); 62024 62025 if (!nodes) { 62026 (0, _util.warn)(`XFA - Invalid reference: ${ref}.`); 62027 continue; 62028 } 62029 62030 const [node] = nodes; 62031 62032 if (!node[_xfa_object.$isDescendent](this.data)) { 62033 (0, _util.warn)(`XFA - Invalid node: must be a data node.`); 62034 continue; 62035 } 62036 62037 const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false); 62038 62039 if (!targetNodes) { 62040 (0, _util.warn)(`XFA - Invalid target: ${target}.`); 62041 continue; 62042 } 62043 62044 const [targetNode] = targetNodes; 62045 62046 if (!targetNode[_xfa_object.$isDescendent](formNode)) { 62047 (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`); 62048 continue; 62049 } 62050 62051 const targetParent = targetNode[_xfa_object.$getParent](); 62052 62053 if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) { 62054 (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`); 62055 continue; 62056 } 62057 62058 if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) { 62059 (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`); 62060 continue; 62061 } 62062 62063 const content = node[_xfa_object.$text](); 62064 62065 const name = targetNode[_xfa_object.$nodeName]; 62066 62067 if (targetNode instanceof _xfa_object.XFAAttribute) { 62068 const attrs = Object.create(null); 62069 attrs[name] = content; 62070 const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]); 62071 targetParent[name] = obj[name]; 62072 continue; 62073 } 62074 62075 if (!targetNode.hasOwnProperty(_xfa_object.$content)) { 62076 (0, _util.warn)(`XFA - Invalid node to use in setProperty`); 62077 continue; 62078 } 62079 62080 targetNode[_xfa_object.$data] = node; 62081 targetNode[_xfa_object.$content] = content; 62082 62083 targetNode[_xfa_object.$finalize](); 62084 } 62085 } 62086 62087 _bindItems(formNode, dataNode) { 62088 if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) { 62089 return; 62090 } 62091 62092 for (const item of formNode.items.children) { 62093 formNode[_xfa_object.$removeChild](item); 62094 } 62095 62096 formNode.items.clear(); 62097 const labels = new _template.Items({}); 62098 const values = new _template.Items({}); 62099 62100 formNode[_xfa_object.$appendChild](labels); 62101 62102 formNode.items.push(labels); 62103 62104 formNode[_xfa_object.$appendChild](values); 62105 62106 formNode.items.push(values); 62107 62108 for (const { 62109 ref, 62110 labelRef, 62111 valueRef, 62112 connection 62113 } of formNode.bindItems.children) { 62114 if (connection) { 62115 continue; 62116 } 62117 62118 if (!ref) { 62119 continue; 62120 } 62121 62122 const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false); 62123 62124 if (!nodes) { 62125 (0, _util.warn)(`XFA - Invalid reference: ${ref}.`); 62126 continue; 62127 } 62128 62129 for (const node of nodes) { 62130 if (!node[_xfa_object.$isDescendent](this.datasets)) { 62131 (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`); 62132 continue; 62133 } 62134 62135 const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false); 62136 62137 if (!labelNodes) { 62138 (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`); 62139 continue; 62140 } 62141 62142 const [labelNode] = labelNodes; 62143 62144 if (!labelNode[_xfa_object.$isDescendent](this.datasets)) { 62145 (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`); 62146 continue; 62147 } 62148 62149 const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false); 62150 62151 if (!valueNodes) { 62152 (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`); 62153 continue; 62154 } 62155 62156 const [valueNode] = valueNodes; 62157 62158 if (!valueNode[_xfa_object.$isDescendent](this.datasets)) { 62159 (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`); 62160 continue; 62161 } 62162 62163 const label = createText(labelNode[_xfa_object.$text]()); 62164 const value = createText(valueNode[_xfa_object.$text]()); 62165 62166 labels[_xfa_object.$appendChild](label); 62167 62168 labels.text.push(label); 62169 62170 values[_xfa_object.$appendChild](value); 62171 62172 values.text.push(value); 62173 } 62174 } 62175 } 62176 62177 _bindOccurrences(formNode, matches, picture) { 62178 let baseClone; 62179 62180 if (matches.length > 1) { 62181 baseClone = formNode[_xfa_object.$clone](); 62182 62183 baseClone[_xfa_object.$removeChild](baseClone.occur); 62184 62185 baseClone.occur = null; 62186 } 62187 62188 this._bindValue(formNode, matches[0], picture); 62189 62190 this._setProperties(formNode, matches[0]); 62191 62192 this._bindItems(formNode, matches[0]); 62193 62194 if (matches.length === 1) { 62195 return; 62196 } 62197 62198 const parent = formNode[_xfa_object.$getParent](); 62199 62200 const name = formNode[_xfa_object.$nodeName]; 62201 62202 const pos = parent[_xfa_object.$indexOf](formNode); 62203 62204 for (let i = 1, ii = matches.length; i < ii; i++) { 62205 const match = matches[i]; 62206 62207 const clone = baseClone[_xfa_object.$clone](); 62208 62209 parent[name].push(clone); 62210 62211 parent[_xfa_object.$insertAt](pos + i, clone); 62212 62213 this._bindValue(clone, match, picture); 62214 62215 this._setProperties(clone, match); 62216 62217 this._bindItems(clone, match); 62218 } 62219 } 62220 62221 _createOccurrences(formNode) { 62222 if (!this.emptyMerge) { 62223 return; 62224 } 62225 62226 const { 62227 occur 62228 } = formNode; 62229 62230 if (!occur || occur.initial <= 1) { 62231 return; 62232 } 62233 62234 const parent = formNode[_xfa_object.$getParent](); 62235 62236 const name = formNode[_xfa_object.$nodeName]; 62237 62238 if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) { 62239 return; 62240 } 62241 62242 let currentNumber; 62243 62244 if (formNode.name) { 62245 currentNumber = parent[name].children.filter(e => e.name === formNode.name).length; 62246 } else { 62247 currentNumber = parent[name].children.length; 62248 } 62249 62250 const pos = parent[_xfa_object.$indexOf](formNode) + 1; 62251 const ii = occur.initial - currentNumber; 62252 62253 if (ii) { 62254 const nodeClone = formNode[_xfa_object.$clone](); 62255 62256 nodeClone[_xfa_object.$removeChild](nodeClone.occur); 62257 62258 nodeClone.occur = null; 62259 parent[name].push(nodeClone); 62260 62261 parent[_xfa_object.$insertAt](pos, nodeClone); 62262 62263 for (let i = 1; i < ii; i++) { 62264 const clone = nodeClone[_xfa_object.$clone](); 62265 62266 parent[name].push(clone); 62267 62268 parent[_xfa_object.$insertAt](pos + i, clone); 62269 } 62270 } 62271 } 62272 62273 _getOccurInfo(formNode) { 62274 const { 62275 name, 62276 occur 62277 } = formNode; 62278 62279 if (!occur || !name) { 62280 return [1, 1]; 62281 } 62282 62283 const max = occur.max === -1 ? Infinity : occur.max; 62284 return [occur.min, max]; 62285 } 62286 62287 _setAndBind(formNode, dataNode) { 62288 this._setProperties(formNode, dataNode); 62289 62290 this._bindItems(formNode, dataNode); 62291 62292 this._bindElement(formNode, dataNode); 62293 } 62294 62295 _bindElement(formNode, dataNode) { 62296 const uselessNodes = []; 62297 62298 this._createOccurrences(formNode); 62299 62300 for (const child of formNode[_xfa_object.$getChildren]()) { 62301 if (child[_xfa_object.$data]) { 62302 continue; 62303 } 62304 62305 if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") { 62306 this._mergeMode = child.mergeMode === "consumeData"; 62307 62308 const dataChildren = dataNode[_xfa_object.$getChildren](); 62309 62310 if (dataChildren.length > 0) { 62311 this._bindOccurrences(child, [dataChildren[0]], null); 62312 } else if (this.emptyMerge) { 62313 const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId]; 62314 const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root"); 62315 62316 dataNode[_xfa_object.$appendChild](dataChild); 62317 62318 this._bindElement(child, dataChild); 62319 } 62320 62321 continue; 62322 } 62323 62324 if (!child[_xfa_object.$isBindable]()) { 62325 continue; 62326 } 62327 62328 let global = false; 62329 let picture = null; 62330 let ref = null; 62331 let match = null; 62332 62333 if (child.bind) { 62334 switch (child.bind.match) { 62335 case "none": 62336 this._setAndBind(child, dataNode); 62337 62338 continue; 62339 62340 case "global": 62341 global = true; 62342 break; 62343 62344 case "dataRef": 62345 if (!child.bind.ref) { 62346 (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`); 62347 62348 this._setAndBind(child, dataNode); 62349 62350 continue; 62351 } 62352 62353 ref = child.bind.ref; 62354 break; 62355 62356 default: 62357 break; 62358 } 62359 62360 if (child.bind.picture) { 62361 picture = child.bind.picture[_xfa_object.$content]; 62362 } 62363 } 62364 62365 const [min, max] = this._getOccurInfo(child); 62366 62367 if (ref) { 62368 match = (0, _som.searchNode)(this.root, dataNode, ref, true, false); 62369 62370 if (match === null) { 62371 match = (0, _som.createDataNode)(this.data, dataNode, ref); 62372 62373 if (!match) { 62374 continue; 62375 } 62376 62377 if (this._isConsumeData()) { 62378 match[_xfa_object.$consumed] = true; 62379 } 62380 62381 this._setAndBind(child, match); 62382 62383 continue; 62384 } else { 62385 if (this._isConsumeData()) { 62386 match = match.filter(node => !node[_xfa_object.$consumed]); 62387 } 62388 62389 if (match.length > max) { 62390 match = match.slice(0, max); 62391 } else if (match.length === 0) { 62392 match = null; 62393 } 62394 62395 if (match && this._isConsumeData()) { 62396 match.forEach(node => { 62397 node[_xfa_object.$consumed] = true; 62398 }); 62399 } 62400 } 62401 } else { 62402 if (!child.name) { 62403 this._setAndBind(child, dataNode); 62404 62405 continue; 62406 } 62407 62408 if (this._isConsumeData()) { 62409 const matches = []; 62410 62411 while (matches.length < max) { 62412 const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global); 62413 62414 if (!found) { 62415 break; 62416 } 62417 62418 found[_xfa_object.$consumed] = true; 62419 matches.push(found); 62420 } 62421 62422 match = matches.length > 0 ? matches : null; 62423 } else { 62424 match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value; 62425 62426 if (!match) { 62427 if (min === 0) { 62428 uselessNodes.push(child); 62429 continue; 62430 } 62431 62432 const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId]; 62433 match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name); 62434 62435 if (this.emptyMerge) { 62436 match[_xfa_object.$consumed] = true; 62437 } 62438 62439 dataNode[_xfa_object.$appendChild](match); 62440 62441 this._setAndBind(child, match); 62442 62443 continue; 62444 } 62445 62446 if (this.emptyMerge) { 62447 match[_xfa_object.$consumed] = true; 62448 } 62449 62450 match = [match]; 62451 } 62452 } 62453 62454 if (match) { 62455 this._bindOccurrences(child, match, picture); 62456 } else if (min > 0) { 62457 this._setAndBind(child, dataNode); 62458 } else { 62459 uselessNodes.push(child); 62460 } 62461 } 62462
62463 uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node)); 62464 } 62465 62466} 62467 62468exports.Binder = Binder; 62469 62470/***/ }), 62471/* 82 */ 62472/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 62473 62474 62475 62476Object.defineProperty(exports, "__esModule", ({ 62477 value: true 62478})); 62479exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0; 62480 62481var _xfa_object = __w_pdfjs_require__(77); 62482 62483var _namespaces = __w_pdfjs_require__(79); 62484 62485var _layout = __w_pdfjs_require__(83); 62486 62487var _html_utils = __w_pdfjs_require__(84); 62488 62489var _utils = __w_pdfjs_require__(78); 62490 62491var _util = __w_pdfjs_require__(2); 62492 62493var _fonts = __w_pdfjs_require__(85); 62494 62495var _core_utils = __w_pdfjs_require__(6); 62496 62497var _som = __w_pdfjs_require__(80); 62498 62499const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id; 62500const SVG_NS = "http://www.w3.org/2000/svg"; 62501const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2; 62502const MAX_EMPTY_PAGES = 3; 62503const DEFAULT_TAB_INDEX = 5000; 62504const HEADING_PATTERN = /^H(\d+)$/;
vendor: 113,688 bytes, lines 62505-66334
62505const MIMES = new Set(["image/gif", "image/jpeg", "image/jpg", "image/pjpeg", "image/png", "image/apng", "image/x-png", "image/bmp", "image/x-ms-bmp", "image/tiff", "image/tif", "application/octet-stream"]); 62506const IMAGES_HEADERS = [[[0x42, 0x4d], "image/bmp"], [[0xff, 0xd8, 0xff], "image/jpeg"], [[0x49, 0x49, 0x2a, 0x00], "image/tiff"], [[0x4d, 0x4d, 0x00, 0x2a], "image/tiff"], [[0x47, 0x49, 0x46, 0x38, 0x39, 0x61], "image/gif"], [[0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], "image/png"]]; 62507 62508function getBorderDims(node) { 62509 if (!node || !node.border) { 62510 return { 62511 w: 0, 62512 h: 0 62513 }; 62514 } 62515 62516 const borderExtra = node.border[_xfa_object.$getExtra](); 62517 62518 if (!borderExtra) { 62519 return { 62520 w: 0, 62521 h: 0 62522 }; 62523 } 62524 62525 return { 62526 w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2], 62527 h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3] 62528 }; 62529} 62530 62531function hasMargin(node) { 62532 return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset); 62533} 62534 62535function _setValue(templateNode, value) { 62536 if (!templateNode.value) { 62537 const nodeValue = new Value({}); 62538 62539 templateNode[_xfa_object.$appendChild](nodeValue); 62540 62541 templateNode.value = nodeValue; 62542 } 62543 62544 templateNode.value[_xfa_object.$setValue](value); 62545} 62546 62547function* getContainedChildren(node) { 62548 for (const child of node[_xfa_object.$getChildren]()) { 62549 if (child instanceof SubformSet) { 62550 yield* child[_xfa_object.$getContainedChildren](); 62551 continue; 62552 } 62553 62554 yield child; 62555 } 62556} 62557 62558function isRequired(node) { 62559 return node.validate && node.validate.nullTest === "error"; 62560} 62561 62562function setTabIndex(node) { 62563 while (node) { 62564 if (!node.traversal) { 62565 node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex]; 62566 return; 62567 } 62568 62569 if (node[_xfa_object.$tabIndex]) { 62570 return; 62571 } 62572 62573 let next = null; 62574 62575 for (const child of node.traversal[_xfa_object.$getChildren]()) { 62576 if (child.operation === "next") { 62577 next = child; 62578 break; 62579 } 62580 } 62581 62582 if (!next || !next.ref) { 62583 node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex]; 62584 return; 62585 } 62586 62587 const root = node[_xfa_object.$getTemplateRoot](); 62588 62589 node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex]; 62590 62591 const ref = root[_xfa_object.$searchNode](next.ref, node); 62592 62593 if (!ref) { 62594 return; 62595 } 62596 62597 node = ref[0]; 62598 } 62599} 62600 62601function applyAssist(obj, attributes) { 62602 const assist = obj.assist; 62603 62604 if (assist) { 62605 const assistTitle = assist[_xfa_object.$toHTML](); 62606 62607 if (assistTitle) { 62608 attributes.title = assistTitle; 62609 } 62610 62611 const role = assist.role; 62612 const match = role.match(HEADING_PATTERN); 62613 62614 if (match) { 62615 const ariaRole = "heading"; 62616 const ariaLevel = match[1]; 62617 attributes.role = ariaRole; 62618 attributes["aria-level"] = ariaLevel; 62619 } 62620 } 62621 62622 if (obj.layout === "table") { 62623 attributes.role = "table"; 62624 } else if (obj.layout === "row") { 62625 attributes.role = "row"; 62626 } else { 62627 const parent = obj[_xfa_object.$getParent](); 62628 62629 if (parent.layout === "row") { 62630 if (parent.assist && parent.assist.role === "TH") { 62631 attributes.role = "columnheader"; 62632 } else { 62633 attributes.role = "cell"; 62634 } 62635 } 62636 } 62637} 62638 62639function ariaLabel(obj) { 62640 if (!obj.assist) { 62641 return null; 62642 } 62643 62644 const assist = obj.assist; 62645 62646 if (assist.speak && assist.speak[_xfa_object.$content] !== "") { 62647 return assist.speak[_xfa_object.$content]; 62648 } 62649 62650 if (assist.toolTip) { 62651 return assist.toolTip[_xfa_object.$content]; 62652 } 62653 62654 return null; 62655} 62656 62657function valueToHtml(value) { 62658 return _utils.HTMLResult.success({ 62659 name: "div", 62660 attributes: { 62661 class: ["xfaRich"], 62662 style: Object.create(null) 62663 }, 62664 children: [{ 62665 name: "span", 62666 attributes: { 62667 style: Object.create(null) 62668 }, 62669 value 62670 }] 62671 }); 62672} 62673 62674function setFirstUnsplittable(node) { 62675 const root = node[_xfa_object.$getTemplateRoot](); 62676 62677 if (root[_xfa_object.$extra].firstUnsplittable === null) { 62678 root[_xfa_object.$extra].firstUnsplittable = node; 62679 root[_xfa_object.$extra].noLayoutFailure = true; 62680 } 62681} 62682 62683function unsetFirstUnsplittable(node) { 62684 const root = node[_xfa_object.$getTemplateRoot](); 62685 62686 if (root[_xfa_object.$extra].firstUnsplittable === node) { 62687 root[_xfa_object.$extra].noLayoutFailure = false; 62688 } 62689} 62690 62691function handleBreak(node) { 62692 if (node[_xfa_object.$extra]) { 62693 return false; 62694 } 62695 62696 node[_xfa_object.$extra] = Object.create(null); 62697 62698 if (node.targetType === "auto") { 62699 return false; 62700 } 62701 62702 const root = node[_xfa_object.$getTemplateRoot](); 62703 62704 let target = null; 62705 62706 if (node.target) { 62707 target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]()); 62708 62709 if (!target) { 62710 return false; 62711 } 62712 62713 target = target[0]; 62714 } 62715 62716 const { 62717 currentPageArea, 62718 currentContentArea 62719 } = root[_xfa_object.$extra]; 62720 62721 if (node.targetType === "pageArea") { 62722 if (!(target instanceof PageArea)) { 62723 target = null; 62724 } 62725 62726 if (node.startNew) { 62727 node[_xfa_object.$extra].target = target || currentPageArea; 62728 return true; 62729 } else if (target && target !== currentPageArea) { 62730 node[_xfa_object.$extra].target = target; 62731 return true; 62732 } 62733 62734 return false; 62735 } 62736 62737 if (!(target instanceof ContentArea)) { 62738 target = null; 62739 } 62740 62741 const pageArea = target && target[_xfa_object.$getParent](); 62742 62743 let index; 62744 let nextPageArea = pageArea; 62745 62746 if (node.startNew) { 62747 if (target) { 62748 const contentAreas = pageArea.contentArea.children; 62749 const indexForCurrent = contentAreas.indexOf(currentContentArea); 62750 const indexForTarget = contentAreas.indexOf(target); 62751 62752 if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) { 62753 nextPageArea = null; 62754 } 62755 62756 index = indexForTarget - 1; 62757 } else { 62758 index = currentPageArea.contentArea.children.indexOf(currentContentArea); 62759 } 62760 } else if (target && target !== currentContentArea) { 62761 const contentAreas = pageArea.contentArea.children; 62762 index = contentAreas.indexOf(target) - 1; 62763 nextPageArea = pageArea === currentPageArea ? null : pageArea; 62764 } else { 62765 return false; 62766 } 62767 62768 node[_xfa_object.$extra].target = nextPageArea; 62769 node[_xfa_object.$extra].index = index; 62770 return true; 62771} 62772 62773function handleOverflow(node, extraNode, space) { 62774 const root = node[_xfa_object.$getTemplateRoot](); 62775 62776 const saved = root[_xfa_object.$extra].noLayoutFailure; 62777 const savedMethod = extraNode[_xfa_object.$getSubformParent]; 62778 62779 extraNode[_xfa_object.$getSubformParent] = () => node; 62780 62781 root[_xfa_object.$extra].noLayoutFailure = true; 62782 62783 const res = extraNode[_xfa_object.$toHTML](space); 62784 62785 node[_xfa_object.$addHTML](res.html, res.bbox); 62786 62787 root[_xfa_object.$extra].noLayoutFailure = saved; 62788 extraNode[_xfa_object.$getSubformParent] = savedMethod; 62789} 62790 62791class AppearanceFilter extends _xfa_object.StringObject { 62792 constructor(attributes) { 62793 super(TEMPLATE_NS_ID, "appearanceFilter"); 62794 this.id = attributes.id || ""; 62795 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 62796 this.use = attributes.use || ""; 62797 this.usehref = attributes.usehref || ""; 62798 } 62799 62800} 62801 62802class Arc extends _xfa_object.XFAObject { 62803 constructor(attributes) { 62804 super(TEMPLATE_NS_ID, "arc", true); 62805 this.circular = (0, _utils.getInteger)({ 62806 data: attributes.circular, 62807 defaultValue: 0, 62808 validate: x => x === 1 62809 }); 62810 this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]); 62811 this.id = attributes.id || ""; 62812 this.startAngle = (0, _utils.getFloat)({ 62813 data: attributes.startAngle, 62814 defaultValue: 0, 62815 validate: x => true 62816 }); 62817 this.sweepAngle = (0, _utils.getFloat)({ 62818 data: attributes.sweepAngle, 62819 defaultValue: 360, 62820 validate: x => true 62821 }); 62822 this.use = attributes.use || ""; 62823 this.usehref = attributes.usehref || ""; 62824 this.edge = null; 62825 this.fill = null; 62826 } 62827 62828 [_xfa_object.$toHTML]() { 62829 const edge = this.edge || new Edge({}); 62830 62831 const edgeStyle = edge[_xfa_object.$toStyle](); 62832 62833 const style = Object.create(null); 62834 62835 if (this.fill && this.fill.presence === "visible") { 62836 Object.assign(style, this.fill[_xfa_object.$toStyle]()); 62837 } else { 62838 style.fill = "transparent"; 62839 } 62840 62841 style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0); 62842 style.stroke = edgeStyle.color; 62843 let arc; 62844 const attributes = { 62845 xmlns: SVG_NS, 62846 style: { 62847 width: "100%", 62848 height: "100%", 62849 overflow: "visible" 62850 } 62851 }; 62852 62853 if (this.sweepAngle === 360) { 62854 arc = { 62855 name: "ellipse", 62856 attributes: { 62857 xmlns: SVG_NS, 62858 cx: "50%", 62859 cy: "50%", 62860 rx: "50%", 62861 ry: "50%", 62862 style 62863 } 62864 }; 62865 } else { 62866 const startAngle = this.startAngle * Math.PI / 180; 62867 const sweepAngle = this.sweepAngle * Math.PI / 180; 62868 const largeArc = this.sweepAngle > 180 ? 1 : 0; 62869 const [x1, y1, x2, y2] = [50 * (1 + Math.cos(startAngle)), 50 * (1 - Math.sin(startAngle)), 50 * (1 + Math.cos(startAngle + sweepAngle)), 50 * (1 - Math.sin(startAngle + sweepAngle))]; 62870 arc = { 62871 name: "path", 62872 attributes: { 62873 xmlns: SVG_NS, 62874 d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`, 62875 vectorEffect: "non-scaling-stroke", 62876 style 62877 } 62878 }; 62879 Object.assign(attributes, { 62880 viewBox: "0 0 100 100", 62881 preserveAspectRatio: "none" 62882 }); 62883 } 62884 62885 const svg = { 62886 name: "svg", 62887 children: [arc], 62888 attributes 62889 }; 62890 62891 const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 62892 62893 if (hasMargin(parent)) { 62894 return _utils.HTMLResult.success({ 62895 name: "div", 62896 attributes: { 62897 style: { 62898 display: "inline", 62899 width: "100%", 62900 height: "100%" 62901 } 62902 }, 62903 children: [svg] 62904 }); 62905 } 62906 62907 svg.attributes.style.position = "absolute"; 62908 return _utils.HTMLResult.success(svg); 62909 } 62910 62911} 62912 62913class Area extends _xfa_object.XFAObject { 62914 constructor(attributes) { 62915 super(TEMPLATE_NS_ID, "area", true); 62916 this.colSpan = (0, _utils.getInteger)({ 62917 data: attributes.colSpan, 62918 defaultValue: 1, 62919 validate: n => n >= 1 || n === -1 62920 }); 62921 this.id = attributes.id || ""; 62922 this.name = attributes.name || ""; 62923 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 62924 this.use = attributes.use || ""; 62925 this.usehref = attributes.usehref || ""; 62926 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 62927 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 62928 this.desc = null; 62929 this.extras = null; 62930 this.area = new _xfa_object.XFAObjectArray(); 62931 this.draw = new _xfa_object.XFAObjectArray(); 62932 this.exObject = new _xfa_object.XFAObjectArray(); 62933 this.exclGroup = new _xfa_object.XFAObjectArray(); 62934 this.field = new _xfa_object.XFAObjectArray(); 62935 this.subform = new _xfa_object.XFAObjectArray(); 62936 this.subformSet = new _xfa_object.XFAObjectArray(); 62937 } 62938 62939 *[_xfa_object.$getContainedChildren]() { 62940 yield* getContainedChildren(this); 62941 } 62942 62943 [_xfa_object.$isTransparent]() { 62944 return true; 62945 } 62946 62947 [_xfa_object.$isBindable]() { 62948 return true; 62949 } 62950 62951 [_xfa_object.$addHTML](html, bbox) { 62952 const [x, y, w, h] = bbox; 62953 this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w); 62954 this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h); 62955 62956 this[_xfa_object.$extra].children.push(html); 62957 } 62958 62959 [_xfa_object.$getAvailableSpace]() { 62960 return this[_xfa_object.$extra].availableSpace; 62961 } 62962 62963 [_xfa_object.$toHTML](availableSpace) { 62964 const style = (0, _html_utils.toStyle)(this, "position"); 62965 const attributes = { 62966 style, 62967 id: this[_xfa_object.$uid], 62968 class: ["xfaArea"] 62969 }; 62970 62971 if ((0, _html_utils.isPrintOnly)(this)) { 62972 attributes.class.push("xfaPrintOnly"); 62973 } 62974 62975 if (this.name) { 62976 attributes.xfaName = this.name; 62977 } 62978 62979 const children = []; 62980 this[_xfa_object.$extra] = { 62981 children, 62982 width: 0, 62983 height: 0, 62984 availableSpace 62985 }; 62986 62987 const result = this[_xfa_object.$childrenToHTML]({ 62988 filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]), 62989 include: true 62990 }); 62991 62992 if (!result.success) { 62993 if (result.isBreak()) { 62994 return result; 62995 } 62996 62997 delete this[_xfa_object.$extra]; 62998 return _utils.HTMLResult.FAILURE; 62999 } 63000 63001 style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width); 63002 style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height); 63003 const html = { 63004 name: "div", 63005 attributes, 63006 children 63007 }; 63008 const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height]; 63009 delete this[_xfa_object.$extra]; 63010 return _utils.HTMLResult.success(html, bbox); 63011 } 63012 63013} 63014 63015class Assist extends _xfa_object.XFAObject { 63016 constructor(attributes) { 63017 super(TEMPLATE_NS_ID, "assist", true); 63018 this.id = attributes.id || ""; 63019 this.role = attributes.role || ""; 63020 this.use = attributes.use || ""; 63021 this.usehref = attributes.usehref || ""; 63022 this.speak = null; 63023 this.toolTip = null; 63024 } 63025 63026 [_xfa_object.$toHTML]() { 63027 return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null; 63028 } 63029 63030} 63031 63032class Barcode extends _xfa_object.XFAObject { 63033 constructor(attributes) { 63034 super(TEMPLATE_NS_ID, "barcode", true); 63035 this.charEncoding = (0, _utils.getKeyword)({ 63036 data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "", 63037 defaultValue: "", 63038 validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-\d{2}/) 63039 }); 63040 this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]); 63041 this.dataColumnCount = (0, _utils.getInteger)({ 63042 data: attributes.dataColumnCount, 63043 defaultValue: -1, 63044 validate: x => x >= 0 63045 }); 63046 this.dataLength = (0, _utils.getInteger)({ 63047 data: attributes.dataLength, 63048 defaultValue: -1, 63049 validate: x => x >= 0 63050 }); 63051 this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]); 63052 this.dataRowCount = (0, _utils.getInteger)({ 63053 data: attributes.dataRowCount, 63054 defaultValue: -1, 63055 validate: x => x >= 0 63056 }); 63057 this.endChar = attributes.endChar || ""; 63058 this.errorCorrectionLevel = (0, _utils.getInteger)({ 63059 data: attributes.errorCorrectionLevel, 63060 defaultValue: -1, 63061 validate: x => x >= 0 && x <= 8 63062 }); 63063 this.id = attributes.id || ""; 63064 this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm"); 63065 this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm"); 63066 this.printCheckDigit = (0, _utils.getInteger)({ 63067 data: attributes.printCheckDigit, 63068 defaultValue: 0, 63069 validate: x => x === 1 63070 }); 63071 this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio); 63072 this.startChar = attributes.startChar || ""; 63073 this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]); 63074 this.truncate = (0, _utils.getInteger)({ 63075 data: attributes.truncate, 63076 defaultValue: 0, 63077 validate: x => x === 1 63078 }); 63079 this.type = (0, _utils.getStringOption)(attributes.type ? attributes.type.toLowerCase() : "", ["aztec", "codabar", "code2of5industrial", "code2of5interleaved", "code2of5matrix", "code2of5standard", "code3of9", "code3of9extended", "code11", "code49", "code93", "code128", "code128a", "code128b", "code128c", "code128sscc", "datamatrix", "ean8", "ean8add2", "ean8add5", "ean13", "ean13add2", "ean13add5", "ean13pwcd", "fim", "logmars", "maxicode", "msi", "pdf417", "pdf417macro", "plessey", "postauscust2", "postauscust3", "postausreplypaid", "postausstandard", "postukrm4scc", "postusdpbc", "postusimb", "postusstandard", "postus5zip", "qrcode", "rfid", "rss14", "rss14expanded", "rss14limited", "rss14stacked", "rss14stackedomni", "rss14truncated", "telepen", "ucc128", "ucc128random", "ucc128sscc", "upca", "upcaadd2", "upcaadd5", "upcapwcd", "upce", "upceadd2", "upceadd5", "upcean2", "upcean5", "upsmaxicode"]); 63080 this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]); 63081 this.use = attributes.use || ""; 63082 this.usehref = attributes.usehref || ""; 63083 this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio); 63084 this.encrypt = null; 63085 this.extras = null; 63086 } 63087 63088} 63089 63090class Bind extends _xfa_object.XFAObject { 63091 constructor(attributes) { 63092 super(TEMPLATE_NS_ID, "bind", true); 63093 this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]); 63094 this.ref = attributes.ref || ""; 63095 this.picture = null; 63096 } 63097 63098} 63099 63100class BindItems extends _xfa_object.XFAObject { 63101 constructor(attributes) { 63102 super(TEMPLATE_NS_ID, "bindItems"); 63103 this.connection = attributes.connection || ""; 63104 this.labelRef = attributes.labelRef || ""; 63105 this.ref = attributes.ref || ""; 63106 this.valueRef = attributes.valueRef || ""; 63107 } 63108 63109} 63110 63111exports.BindItems = BindItems; 63112 63113class Bookend extends _xfa_object.XFAObject { 63114 constructor(attributes) { 63115 super(TEMPLATE_NS_ID, "bookend"); 63116 this.id = attributes.id || ""; 63117 this.leader = attributes.leader || ""; 63118 this.trailer = attributes.trailer || ""; 63119 this.use = attributes.use || ""; 63120 this.usehref = attributes.usehref || ""; 63121 } 63122 63123} 63124 63125class BooleanElement extends _xfa_object.Option01 { 63126 constructor(attributes) { 63127 super(TEMPLATE_NS_ID, "boolean"); 63128 this.id = attributes.id || ""; 63129 this.name = attributes.name || ""; 63130 this.use = attributes.use || ""; 63131 this.usehref = attributes.usehref || ""; 63132 } 63133 63134 [_xfa_object.$toHTML](availableSpace) { 63135 return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0"); 63136 } 63137 63138} 63139 63140class Border extends _xfa_object.XFAObject { 63141 constructor(attributes) { 63142 super(TEMPLATE_NS_ID, "border", true); 63143 this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]); 63144 this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]); 63145 this.id = attributes.id || ""; 63146 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 63147 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 63148 this.use = attributes.use || ""; 63149 this.usehref = attributes.usehref || ""; 63150 this.corner = new _xfa_object.XFAObjectArray(4); 63151 this.edge = new _xfa_object.XFAObjectArray(4); 63152 this.extras = null; 63153 this.fill = null; 63154 this.margin = null; 63155 } 63156 63157 [_xfa_object.$getExtra]() { 63158 if (!this[_xfa_object.$extra]) { 63159 const edges = this.edge.children.slice(); 63160 63161 if (edges.length < 4) { 63162 const defaultEdge = edges.at(-1) || new Edge({}); 63163 63164 for (let i = edges.length; i < 4; i++) { 63165 edges.push(defaultEdge); 63166 } 63167 } 63168 63169 const widths = edges.map(edge => edge.thickness); 63170 const insets = [0, 0, 0, 0]; 63171 63172 if (this.margin) { 63173 insets[0] = this.margin.topInset; 63174 insets[1] = this.margin.rightInset; 63175 insets[2] = this.margin.bottomInset; 63176 insets[3] = this.margin.leftInset; 63177 } 63178 63179 this[_xfa_object.$extra] = { 63180 widths, 63181 insets, 63182 edges 63183 }; 63184 } 63185 63186 return this[_xfa_object.$extra]; 63187 } 63188 63189 [_xfa_object.$toStyle]() { 63190 const { 63191 edges 63192 } = this[_xfa_object.$getExtra](); 63193 63194 const edgeStyles = edges.map(node => { 63195 const style = node[_xfa_object.$toStyle](); 63196 63197 style.color = style.color || "#000000"; 63198 return style; 63199 }); 63200 const style = Object.create(null); 63201 63202 if (this.margin) { 63203 Object.assign(style, this.margin[_xfa_object.$toStyle]()); 63204 } 63205 63206 if (this.fill && this.fill.presence === "visible") { 63207 Object.assign(style, this.fill[_xfa_object.$toStyle]()); 63208 } 63209 63210 if (this.corner.children.some(node => node.radius !== 0)) { 63211 const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]()); 63212 63213 if (cornerStyles.length === 2 || cornerStyles.length === 3) { 63214 const last = cornerStyles.at(-1); 63215 63216 for (let i = cornerStyles.length; i < 4; i++) { 63217 cornerStyles.push(last); 63218 } 63219 } 63220 63221 style.borderRadius = cornerStyles.map(s => s.radius).join(" "); 63222 } 63223 63224 switch (this.presence) { 63225 case "invisible": 63226 case "hidden": 63227 style.borderStyle = ""; 63228 break; 63229 63230 case "inactive": 63231 style.borderStyle = "none"; 63232 break; 63233 63234 default: 63235 style.borderStyle = edgeStyles.map(s => s.style).join(" "); 63236 break; 63237 } 63238 63239 style.borderWidth = edgeStyles.map(s => s.width).join(" "); 63240 style.borderColor = edgeStyles.map(s => s.color).join(" "); 63241 return style; 63242 } 63243 63244} 63245 63246class Break extends _xfa_object.XFAObject { 63247 constructor(attributes) { 63248 super(TEMPLATE_NS_ID, "break", true); 63249 this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]); 63250 this.afterTarget = attributes.afterTarget || ""; 63251 this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]); 63252 this.beforeTarget = attributes.beforeTarget || ""; 63253 this.bookendLeader = attributes.bookendLeader || ""; 63254 this.bookendTrailer = attributes.bookendTrailer || ""; 63255 this.id = attributes.id || ""; 63256 this.overflowLeader = attributes.overflowLeader || ""; 63257 this.overflowTarget = attributes.overflowTarget || ""; 63258 this.overflowTrailer = attributes.overflowTrailer || ""; 63259 this.startNew = (0, _utils.getInteger)({ 63260 data: attributes.startNew, 63261 defaultValue: 0, 63262 validate: x => x === 1 63263 }); 63264 this.use = attributes.use || ""; 63265 this.usehref = attributes.usehref || ""; 63266 this.extras = null; 63267 } 63268 63269} 63270 63271class BreakAfter extends _xfa_object.XFAObject { 63272 constructor(attributes) { 63273 super(TEMPLATE_NS_ID, "breakAfter", true); 63274 this.id = attributes.id || ""; 63275 this.leader = attributes.leader || ""; 63276 this.startNew = (0, _utils.getInteger)({ 63277 data: attributes.startNew, 63278 defaultValue: 0, 63279 validate: x => x === 1 63280 }); 63281 this.target = attributes.target || ""; 63282 this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]); 63283 this.trailer = attributes.trailer || ""; 63284 this.use = attributes.use || ""; 63285 this.usehref = attributes.usehref || ""; 63286 this.script = null; 63287 } 63288 63289} 63290 63291class BreakBefore extends _xfa_object.XFAObject { 63292 constructor(attributes) { 63293 super(TEMPLATE_NS_ID, "breakBefore", true); 63294 this.id = attributes.id || ""; 63295 this.leader = attributes.leader || ""; 63296 this.startNew = (0, _utils.getInteger)({ 63297 data: attributes.startNew, 63298 defaultValue: 0, 63299 validate: x => x === 1 63300 }); 63301 this.target = attributes.target || ""; 63302 this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]); 63303 this.trailer = attributes.trailer || ""; 63304 this.use = attributes.use || ""; 63305 this.usehref = attributes.usehref || ""; 63306 this.script = null; 63307 } 63308 63309 [_xfa_object.$toHTML](availableSpace) { 63310 this[_xfa_object.$extra] = {}; 63311 return _utils.HTMLResult.FAILURE; 63312 } 63313 63314} 63315 63316class Button extends _xfa_object.XFAObject { 63317 constructor(attributes) { 63318 super(TEMPLATE_NS_ID, "button", true); 63319 this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]); 63320 this.id = attributes.id || ""; 63321 this.use = attributes.use || ""; 63322 this.usehref = attributes.usehref || ""; 63323 this.extras = null; 63324 } 63325 63326 [_xfa_object.$toHTML](availableSpace) { 63327 const parent = this[_xfa_object.$getParent](); 63328 63329 const grandpa = parent[_xfa_object.$getParent](); 63330 63331 const htmlButton = { 63332 name: "button", 63333 attributes: { 63334 id: this[_xfa_object.$uid], 63335 class: ["xfaButton"], 63336 style: {} 63337 }, 63338 children: [] 63339 }; 63340 63341 for (const event of grandpa.event.children) { 63342 if (event.activity !== "click" || !event.script) { 63343 continue; 63344 } 63345 63346 const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]); 63347 63348 if (!jsURL) { 63349 continue; 63350 } 63351 63352 const href = (0, _html_utils.fixURL)(jsURL.url); 63353 63354 if (!href) { 63355 continue; 63356 } 63357 63358 htmlButton.children.push({ 63359 name: "a", 63360 attributes: { 63361 id: "link" + this[_xfa_object.$uid], 63362 href, 63363 newWindow: jsURL.newWindow, 63364 class: ["xfaLink"], 63365 style: {} 63366 }, 63367 children: [] 63368 }); 63369 } 63370 63371 return _utils.HTMLResult.success(htmlButton); 63372 } 63373 63374} 63375 63376class Calculate extends _xfa_object.XFAObject { 63377 constructor(attributes) { 63378 super(TEMPLATE_NS_ID, "calculate", true); 63379 this.id = attributes.id || ""; 63380 this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]); 63381 this.use = attributes.use || ""; 63382 this.usehref = attributes.usehref || ""; 63383 this.extras = null; 63384 this.message = null; 63385 this.script = null; 63386 } 63387 63388} 63389 63390class Caption extends _xfa_object.XFAObject { 63391 constructor(attributes) { 63392 super(TEMPLATE_NS_ID, "caption", true); 63393 this.id = attributes.id || ""; 63394 this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]); 63395 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 63396 this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve)); 63397 this.use = attributes.use || ""; 63398 this.usehref = attributes.usehref || ""; 63399 this.extras = null; 63400 this.font = null; 63401 this.margin = null; 63402 this.para = null; 63403 this.value = null; 63404 } 63405 63406 [_xfa_object.$setValue](value) { 63407 _setValue(this, value); 63408 } 63409 63410 [_xfa_object.$getExtra](availableSpace) { 63411 if (!this[_xfa_object.$extra]) { 63412 let { 63413 width, 63414 height 63415 } = availableSpace; 63416 63417 switch (this.placement) { 63418 case "left": 63419 case "right": 63420 case "inline": 63421 width = this.reserve <= 0 ? width : this.reserve; 63422 break; 63423 63424 case "top": 63425 case "bottom": 63426 height = this.reserve <= 0 ? height : this.reserve; 63427 break; 63428 } 63429 63430 this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, { 63431 width, 63432 height 63433 }); 63434 } 63435 63436 return this[_xfa_object.$extra]; 63437 } 63438 63439 [_xfa_object.$toHTML](availableSpace) { 63440 if (!this.value) { 63441 return _utils.HTMLResult.EMPTY; 63442 } 63443 63444 this[_xfa_object.$pushPara](); 63445 63446 const value = this.value[_xfa_object.$toHTML](availableSpace).html; 63447 63448 if (!value) { 63449 this[_xfa_object.$popPara](); 63450 63451 return _utils.HTMLResult.EMPTY; 63452 } 63453 63454 const savedReserve = this.reserve; 63455 63456 if (this.reserve <= 0) { 63457 const { 63458 w, 63459 h 63460 } = this[_xfa_object.$getExtra](availableSpace); 63461 63462 switch (this.placement) { 63463 case "left": 63464 case "right": 63465 case "inline": 63466 this.reserve = w; 63467 break; 63468 63469 case "top": 63470 case "bottom": 63471 this.reserve = h; 63472 break; 63473 } 63474 } 63475 63476 const children = []; 63477 63478 if (typeof value === "string") { 63479 children.push({ 63480 name: "#text", 63481 value 63482 }); 63483 } else { 63484 children.push(value); 63485 } 63486 63487 const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility"); 63488 63489 switch (this.placement) { 63490 case "left": 63491 case "right": 63492 if (this.reserve > 0) { 63493 style.width = (0, _html_utils.measureToString)(this.reserve); 63494 } 63495 63496 break; 63497 63498 case "top": 63499 case "bottom": 63500 if (this.reserve > 0) { 63501 style.height = (0, _html_utils.measureToString)(this.reserve); 63502 } 63503 63504 break; 63505 } 63506 63507 (0, _html_utils.setPara)(this, null, value); 63508 63509 this[_xfa_object.$popPara](); 63510 63511 this.reserve = savedReserve; 63512 return _utils.HTMLResult.success({ 63513 name: "div", 63514 attributes: { 63515 style, 63516 class: ["xfaCaption"] 63517 }, 63518 children 63519 }); 63520 } 63521 63522} 63523 63524class Certificate extends _xfa_object.StringObject { 63525 constructor(attributes) { 63526 super(TEMPLATE_NS_ID, "certificate"); 63527 this.id = attributes.id || ""; 63528 this.name = attributes.name || ""; 63529 this.use = attributes.use || ""; 63530 this.usehref = attributes.usehref || ""; 63531 } 63532 63533} 63534 63535class Certificates extends _xfa_object.XFAObject { 63536 constructor(attributes) { 63537 super(TEMPLATE_NS_ID, "certificates", true); 63538 this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]); 63539 this.id = attributes.id || ""; 63540 this.url = attributes.url || ""; 63541 this.urlPolicy = attributes.urlPolicy || ""; 63542 this.use = attributes.use || ""; 63543 this.usehref = attributes.usehref || ""; 63544 this.encryption = null; 63545 this.issuers = null; 63546 this.keyUsage = null; 63547 this.oids = null; 63548 this.signing = null; 63549 this.subjectDNs = null; 63550 } 63551 63552} 63553 63554class CheckButton extends _xfa_object.XFAObject { 63555 constructor(attributes) { 63556 super(TEMPLATE_NS_ID, "checkButton", true); 63557 this.id = attributes.id || ""; 63558 this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]); 63559 this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]); 63560 this.size = (0, _utils.getMeasurement)(attributes.size, "10pt"); 63561 this.use = attributes.use || ""; 63562 this.usehref = attributes.usehref || ""; 63563 this.border = null; 63564 this.extras = null; 63565 this.margin = null; 63566 } 63567 63568 [_xfa_object.$toHTML](availableSpace) { 63569 const style = (0, _html_utils.toStyle)("margin"); 63570 const size = (0, _html_utils.measureToString)(this.size); 63571 style.width = style.height = size; 63572 let type; 63573 let className; 63574 let groupId; 63575 63576 const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 63577 63578 const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || []; 63579 const exportedValue = { 63580 on: (items[0] !== undefined ? items[0] : "on").toString(), 63581 off: (items[1] !== undefined ? items[1] : "off").toString() 63582 }; 63583 const value = field.value && field.value[_xfa_object.$text]() || "off"; 63584 const checked = value === exportedValue.on || undefined; 63585 63586 const container = field[_xfa_object.$getSubformParent](); 63587 63588 const fieldId = field[_xfa_object.$uid]; 63589 let dataId; 63590 63591 if (container instanceof ExclGroup) { 63592 groupId = container[_xfa_object.$uid]; 63593 type = "radio"; 63594 className = "xfaRadio"; 63595 dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid]; 63596 } else { 63597 type = "checkbox"; 63598 className = "xfaCheckbox"; 63599 dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid]; 63600 } 63601 63602 const input = { 63603 name: "input", 63604 attributes: { 63605 class: [className], 63606 style, 63607 fieldId, 63608 dataId, 63609 type, 63610 checked, 63611 xfaOn: exportedValue.on, 63612 xfaOff: exportedValue.off, 63613 "aria-label": ariaLabel(field), 63614 "aria-required": false 63615 } 63616 }; 63617 63618 if (groupId) { 63619 input.attributes.name = groupId; 63620 } 63621 63622 if (isRequired(field)) { 63623 input.attributes["aria-required"] = true; 63624 input.attributes.required = true; 63625 } 63626 63627 return _utils.HTMLResult.success({ 63628 name: "label", 63629 attributes: { 63630 class: ["xfaLabel"] 63631 }, 63632 children: [input] 63633 }); 63634 } 63635 63636} 63637 63638class ChoiceList extends _xfa_object.XFAObject { 63639 constructor(attributes) { 63640 super(TEMPLATE_NS_ID, "choiceList", true); 63641 this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]); 63642 this.id = attributes.id || ""; 63643 this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]); 63644 this.textEntry = (0, _utils.getInteger)({ 63645 data: attributes.textEntry, 63646 defaultValue: 0, 63647 validate: x => x === 1 63648 }); 63649 this.use = attributes.use || ""; 63650 this.usehref = attributes.usehref || ""; 63651 this.border = null; 63652 this.extras = null; 63653 this.margin = null; 63654 } 63655 63656 [_xfa_object.$toHTML](availableSpace) { 63657 const style = (0, _html_utils.toStyle)(this, "border", "margin"); 63658 63659 const ui = this[_xfa_object.$getParent](); 63660 63661 const field = ui[_xfa_object.$getParent](); 63662 63663 const fontSize = field.font && field.font.size || 10; 63664 const optionStyle = { 63665 fontSize: `calc(${fontSize}px * var(--scale-factor))` 63666 }; 63667 const children = []; 63668 63669 if (field.items.children.length > 0) { 63670 const items = field.items; 63671 let displayedIndex = 0; 63672 let saveIndex = 0; 63673 63674 if (items.children.length === 2) { 63675 displayedIndex = items.children[0].save; 63676 saveIndex = 1 - displayedIndex; 63677 } 63678 63679 const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html; 63680 63681 const values = items.children[saveIndex][_xfa_object.$toHTML]().html; 63682 63683 let selected = false; 63684 const value = field.value && field.value[_xfa_object.$text]() || ""; 63685 63686 for (let i = 0, ii = displayed.length; i < ii; i++) { 63687 const option = { 63688 name: "option", 63689 attributes: { 63690 value: values[i] || displayed[i], 63691 style: optionStyle 63692 }, 63693 value: displayed[i] 63694 }; 63695 63696 if (values[i] === value) { 63697 option.attributes.selected = selected = true; 63698 } 63699 63700 children.push(option); 63701 } 63702 63703 if (!selected) { 63704 children.splice(0, 0, { 63705 name: "option", 63706 attributes: { 63707 hidden: true, 63708 selected: true 63709 }, 63710 value: " " 63711 }); 63712 } 63713 } 63714 63715 const selectAttributes = { 63716 class: ["xfaSelect"], 63717 fieldId: field[_xfa_object.$uid], 63718 dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], 63719 style, 63720 "aria-label": ariaLabel(field), 63721 "aria-required": false 63722 }; 63723 63724 if (isRequired(field)) { 63725 selectAttributes["aria-required"] = true; 63726 selectAttributes.required = true; 63727 } 63728 63729 if (this.open === "multiSelect") { 63730 selectAttributes.multiple = true; 63731 } 63732 63733 return _utils.HTMLResult.success({ 63734 name: "label", 63735 attributes: { 63736 class: ["xfaLabel"] 63737 }, 63738 children: [{ 63739 name: "select", 63740 children, 63741 attributes: selectAttributes 63742 }] 63743 }); 63744 } 63745 63746} 63747 63748class Color extends _xfa_object.XFAObject { 63749 constructor(attributes) { 63750 super(TEMPLATE_NS_ID, "color", true); 63751 this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]); 63752 this.id = attributes.id || ""; 63753 this.use = attributes.use || ""; 63754 this.usehref = attributes.usehref || ""; 63755 this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : ""; 63756 this.extras = null; 63757 } 63758 63759 [_xfa_object.$hasSettableValue]() { 63760 return false; 63761 } 63762 63763 [_xfa_object.$toStyle]() { 63764 return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null; 63765 } 63766 63767} 63768 63769class Comb extends _xfa_object.XFAObject { 63770 constructor(attributes) { 63771 super(TEMPLATE_NS_ID, "comb"); 63772 this.id = attributes.id || ""; 63773 this.numberOfCells = (0, _utils.getInteger)({ 63774 data: attributes.numberOfCells, 63775 defaultValue: 0, 63776 validate: x => x >= 0 63777 }); 63778 this.use = attributes.use || ""; 63779 this.usehref = attributes.usehref || ""; 63780 } 63781 63782} 63783 63784class Connect extends _xfa_object.XFAObject { 63785 constructor(attributes) { 63786 super(TEMPLATE_NS_ID, "connect", true); 63787 this.connection = attributes.connection || ""; 63788 this.id = attributes.id || ""; 63789 this.ref = attributes.ref || ""; 63790 this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]); 63791 this.use = attributes.use || ""; 63792 this.usehref = attributes.usehref || ""; 63793 this.picture = null; 63794 } 63795 63796} 63797 63798class ContentArea extends _xfa_object.XFAObject { 63799 constructor(attributes) { 63800 super(TEMPLATE_NS_ID, "contentArea", true); 63801 this.h = (0, _utils.getMeasurement)(attributes.h); 63802 this.id = attributes.id || ""; 63803 this.name = attributes.name || ""; 63804 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 63805 this.use = attributes.use || ""; 63806 this.usehref = attributes.usehref || ""; 63807 this.w = (0, _utils.getMeasurement)(attributes.w); 63808 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 63809 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 63810 this.desc = null; 63811 this.extras = null; 63812 } 63813 63814 [_xfa_object.$toHTML](availableSpace) { 63815 const left = (0, _html_utils.measureToString)(this.x); 63816 const top = (0, _html_utils.measureToString)(this.y); 63817 const style = { 63818 left, 63819 top, 63820 width: (0, _html_utils.measureToString)(this.w), 63821 height: (0, _html_utils.measureToString)(this.h) 63822 }; 63823 const classNames = ["xfaContentarea"]; 63824 63825 if ((0, _html_utils.isPrintOnly)(this)) { 63826 classNames.push("xfaPrintOnly"); 63827 } 63828 63829 return _utils.HTMLResult.success({ 63830 name: "div", 63831 children: [], 63832 attributes: { 63833 style, 63834 class: classNames, 63835 id: this[_xfa_object.$uid] 63836 } 63837 }); 63838 } 63839 63840} 63841 63842class Corner extends _xfa_object.XFAObject { 63843 constructor(attributes) { 63844 super(TEMPLATE_NS_ID, "corner", true); 63845 this.id = attributes.id || ""; 63846 this.inverted = (0, _utils.getInteger)({ 63847 data: attributes.inverted, 63848 defaultValue: 0, 63849 validate: x => x === 1 63850 }); 63851 this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]); 63852 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 63853 this.radius = (0, _utils.getMeasurement)(attributes.radius); 63854 this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]); 63855 this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt"); 63856 this.use = attributes.use || ""; 63857 this.usehref = attributes.usehref || ""; 63858 this.color = null; 63859 this.extras = null; 63860 } 63861 63862 [_xfa_object.$toStyle]() { 63863 const style = (0, _html_utils.toStyle)(this, "visibility"); 63864 style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius); 63865 return style; 63866 } 63867 63868} 63869 63870class DateElement extends _xfa_object.ContentObject { 63871 constructor(attributes) { 63872 super(TEMPLATE_NS_ID, "date"); 63873 this.id = attributes.id || ""; 63874 this.name = attributes.name || ""; 63875 this.use = attributes.use || ""; 63876 this.usehref = attributes.usehref || ""; 63877 } 63878 63879 [_xfa_object.$finalize]() { 63880 const date = this[_xfa_object.$content].trim(); 63881 63882 this[_xfa_object.$content] = date ? new Date(date) : null; 63883 } 63884 63885 [_xfa_object.$toHTML](availableSpace) { 63886 return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : ""); 63887 } 63888 63889} 63890 63891class DateTime extends _xfa_object.ContentObject { 63892 constructor(attributes) { 63893 super(TEMPLATE_NS_ID, "dateTime"); 63894 this.id = attributes.id || ""; 63895 this.name = attributes.name || ""; 63896 this.use = attributes.use || ""; 63897 this.usehref = attributes.usehref || ""; 63898 } 63899 63900 [_xfa_object.$finalize]() { 63901 const date = this[_xfa_object.$content].trim(); 63902 63903 this[_xfa_object.$content] = date ? new Date(date) : null; 63904 } 63905 63906 [_xfa_object.$toHTML](availableSpace) { 63907 return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : ""); 63908 } 63909 63910} 63911 63912class DateTimeEdit extends _xfa_object.XFAObject { 63913 constructor(attributes) { 63914 super(TEMPLATE_NS_ID, "dateTimeEdit", true); 63915 this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); 63916 this.id = attributes.id || ""; 63917 this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]); 63918 this.use = attributes.use || ""; 63919 this.usehref = attributes.usehref || ""; 63920 this.border = null; 63921 this.comb = null; 63922 this.extras = null; 63923 this.margin = null; 63924 } 63925 63926 [_xfa_object.$toHTML](availableSpace) { 63927 const style = (0, _html_utils.toStyle)(this, "border", "font", "margin"); 63928 63929 const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 63930 63931 const html = { 63932 name: "input", 63933 attributes: { 63934 type: "text", 63935 fieldId: field[_xfa_object.$uid], 63936 dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], 63937 class: ["xfaTextfield"], 63938 style, 63939 "aria-label": ariaLabel(field), 63940 "aria-required": false 63941 } 63942 }; 63943 63944 if (isRequired(field)) { 63945 html.attributes["aria-required"] = true; 63946 html.attributes.required = true; 63947 } 63948 63949 return _utils.HTMLResult.success({ 63950 name: "label", 63951 attributes: { 63952 class: ["xfaLabel"] 63953 }, 63954 children: [html] 63955 }); 63956 } 63957 63958} 63959 63960class Decimal extends _xfa_object.ContentObject { 63961 constructor(attributes) { 63962 super(TEMPLATE_NS_ID, "decimal"); 63963 this.fracDigits = (0, _utils.getInteger)({ 63964 data: attributes.fracDigits, 63965 defaultValue: 2, 63966 validate: x => true 63967 }); 63968 this.id = attributes.id || ""; 63969 this.leadDigits = (0, _utils.getInteger)({ 63970 data: attributes.leadDigits, 63971 defaultValue: -1, 63972 validate: x => true 63973 }); 63974 this.name = attributes.name || ""; 63975 this.use = attributes.use || ""; 63976 this.usehref = attributes.usehref || ""; 63977 } 63978 63979 [_xfa_object.$finalize]() { 63980 const number = parseFloat(this[_xfa_object.$content].trim()); 63981 this[_xfa_object.$content] = isNaN(number) ? null : number; 63982 } 63983 63984 [_xfa_object.$toHTML](availableSpace) { 63985 return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : ""); 63986 } 63987 63988} 63989 63990class DefaultUi extends _xfa_object.XFAObject { 63991 constructor(attributes) { 63992 super(TEMPLATE_NS_ID, "defaultUi", true); 63993 this.id = attributes.id || ""; 63994 this.use = attributes.use || ""; 63995 this.usehref = attributes.usehref || ""; 63996 this.extras = null; 63997 } 63998 63999} 64000 64001class Desc extends _xfa_object.XFAObject { 64002 constructor(attributes) { 64003 super(TEMPLATE_NS_ID, "desc", true); 64004 this.id = attributes.id || ""; 64005 this.use = attributes.use || ""; 64006 this.usehref = attributes.usehref || ""; 64007 this.boolean = new _xfa_object.XFAObjectArray(); 64008 this.date = new _xfa_object.XFAObjectArray(); 64009 this.dateTime = new _xfa_object.XFAObjectArray(); 64010 this.decimal = new _xfa_object.XFAObjectArray(); 64011 this.exData = new _xfa_object.XFAObjectArray(); 64012 this.float = new _xfa_object.XFAObjectArray(); 64013 this.image = new _xfa_object.XFAObjectArray(); 64014 this.integer = new _xfa_object.XFAObjectArray(); 64015 this.text = new _xfa_object.XFAObjectArray(); 64016 this.time = new _xfa_object.XFAObjectArray(); 64017 } 64018 64019} 64020 64021class DigestMethod extends _xfa_object.OptionObject { 64022 constructor(attributes) { 64023 super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]); 64024 this.id = attributes.id || ""; 64025 this.use = attributes.use || ""; 64026 this.usehref = attributes.usehref || ""; 64027 } 64028 64029} 64030 64031class DigestMethods extends _xfa_object.XFAObject { 64032 constructor(attributes) { 64033 super(TEMPLATE_NS_ID, "digestMethods", true); 64034 this.id = attributes.id || ""; 64035 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 64036 this.use = attributes.use || ""; 64037 this.usehref = attributes.usehref || ""; 64038 this.digestMethod = new _xfa_object.XFAObjectArray(); 64039 } 64040 64041} 64042 64043class Draw extends _xfa_object.XFAObject { 64044 constructor(attributes) { 64045 super(TEMPLATE_NS_ID, "draw", true); 64046 this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 64047 this.colSpan = (0, _utils.getInteger)({ 64048 data: attributes.colSpan, 64049 defaultValue: 1, 64050 validate: n => n >= 1 || n === -1 64051 }); 64052 this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : ""; 64053 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 64054 this.id = attributes.id || ""; 64055 this.locale = attributes.locale || ""; 64056 this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt"); 64057 this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt"); 64058 this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt"); 64059 this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt"); 64060 this.name = attributes.name || ""; 64061 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 64062 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 64063 this.rotate = (0, _utils.getInteger)({ 64064 data: attributes.rotate, 64065 defaultValue: 0, 64066 validate: x => x % 90 === 0 64067 }); 64068 this.use = attributes.use || ""; 64069 this.usehref = attributes.usehref || ""; 64070 this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : ""; 64071 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 64072 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 64073 this.assist = null; 64074 this.border = null; 64075 this.caption = null; 64076 this.desc = null; 64077 this.extras = null; 64078 this.font = null; 64079 this.keep = null; 64080 this.margin = null; 64081 this.para = null; 64082 this.traversal = null; 64083 this.ui = null; 64084 this.value = null; 64085 this.setProperty = new _xfa_object.XFAObjectArray(); 64086 } 64087 64088 [_xfa_object.$setValue](value) { 64089 _setValue(this, value); 64090 } 64091 64092 [_xfa_object.$toHTML](availableSpace) { 64093 setTabIndex(this); 64094 64095 if (this.presence === "hidden" || this.presence === "inactive") { 64096 return _utils.HTMLResult.EMPTY; 64097 } 64098 64099 (0, _html_utils.fixDimensions)(this); 64100 64101 this[_xfa_object.$pushPara](); 64102 64103 const savedW = this.w; 64104 const savedH = this.h; 64105 const { 64106 w, 64107 h, 64108 isBroken 64109 } = (0, _html_utils.layoutNode)(this, availableSpace); 64110 64111 if (w && this.w === "") { 64112 if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) { 64113 this[_xfa_object.$popPara](); 64114 64115 return _utils.HTMLResult.FAILURE; 64116 } 64117 64118 this.w = w; 64119 } 64120 64121 if (h && this.h === "") { 64122 this.h = h; 64123 } 64124 64125 setFirstUnsplittable(this); 64126 64127 if (!(0, _layout.checkDimensions)(this, availableSpace)) { 64128 this.w = savedW; 64129 this.h = savedH; 64130 64131 this[_xfa_object.$popPara](); 64132 64133 return _utils.HTMLResult.FAILURE; 64134 } 64135 64136 unsetFirstUnsplittable(this); 64137 const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin"); 64138 (0, _html_utils.setMinMaxDimensions)(this, style); 64139 64140 if (style.margin) { 64141 style.padding = style.margin; 64142 delete style.margin; 64143 } 64144 64145 const classNames = ["xfaDraw"]; 64146 64147 if (this.font) { 64148 classNames.push("xfaFont"); 64149 } 64150 64151 if ((0, _html_utils.isPrintOnly)(this)) { 64152 classNames.push("xfaPrintOnly"); 64153 } 64154 64155 const attributes = { 64156 style, 64157 id: this[_xfa_object.$uid], 64158 class: classNames 64159 }; 64160 64161 if (this.name) { 64162 attributes.xfaName = this.name; 64163 } 64164 64165 const html = { 64166 name: "div", 64167 attributes, 64168 children: [] 64169 }; 64170 applyAssist(this, attributes); 64171 const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace); 64172 const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null; 64173 64174 if (value === null) { 64175 this.w = savedW; 64176 this.h = savedH; 64177 64178 this[_xfa_object.$popPara](); 64179 64180 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 64181 } 64182 64183 html.children.push(value); 64184 (0, _html_utils.setPara)(this, style, value); 64185 this.w = savedW; 64186 this.h = savedH; 64187 64188 this[_xfa_object.$popPara](); 64189 64190 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 64191 } 64192 64193} 64194 64195class Edge extends _xfa_object.XFAObject { 64196 constructor(attributes) { 64197 super(TEMPLATE_NS_ID, "edge", true); 64198 this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]); 64199 this.id = attributes.id || ""; 64200 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 64201 this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]); 64202 this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt"); 64203 this.use = attributes.use || ""; 64204 this.usehref = attributes.usehref || ""; 64205 this.color = null; 64206 this.extras = null; 64207 } 64208 64209 [_xfa_object.$toStyle]() { 64210 const style = (0, _html_utils.toStyle)(this, "visibility"); 64211 Object.assign(style, { 64212 linecap: this.cap, 64213 width: (0, _html_utils.measureToString)(this.thickness), 64214 color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000", 64215 style: "" 64216 }); 64217 64218 if (this.presence !== "visible") { 64219 style.style = "none"; 64220 } else { 64221 switch (this.stroke) { 64222 case "solid": 64223 style.style = "solid"; 64224 break; 64225 64226 case "dashDot": 64227 style.style = "dashed"; 64228 break; 64229 64230 case "dashDotDot": 64231 style.style = "dashed"; 64232 break; 64233 64234 case "dashed": 64235 style.style = "dashed"; 64236 break; 64237 64238 case "dotted": 64239 style.style = "dotted"; 64240 break; 64241 64242 case "embossed": 64243 style.style = "ridge"; 64244 break; 64245 64246 case "etched": 64247 style.style = "groove"; 64248 break; 64249 64250 case "lowered": 64251 style.style = "inset"; 64252 break; 64253 64254 case "raised": 64255 style.style = "outset"; 64256 break; 64257 } 64258 } 64259 64260 return style; 64261 } 64262 64263} 64264 64265class Encoding extends _xfa_object.OptionObject { 64266 constructor(attributes) { 64267 super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]); 64268 this.id = attributes.id || ""; 64269 this.use = attributes.use || ""; 64270 this.usehref = attributes.usehref || ""; 64271 } 64272 64273} 64274 64275class Encodings extends _xfa_object.XFAObject { 64276 constructor(attributes) { 64277 super(TEMPLATE_NS_ID, "encodings", true); 64278 this.id = attributes.id || ""; 64279 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 64280 this.use = attributes.use || ""; 64281 this.usehref = attributes.usehref || ""; 64282 this.encoding = new _xfa_object.XFAObjectArray(); 64283 } 64284 64285} 64286 64287class Encrypt extends _xfa_object.XFAObject { 64288 constructor(attributes) { 64289 super(TEMPLATE_NS_ID, "encrypt", true); 64290 this.id = attributes.id || ""; 64291 this.use = attributes.use || ""; 64292 this.usehref = attributes.usehref || ""; 64293 this.certificate = null; 64294 } 64295 64296} 64297 64298class EncryptData extends _xfa_object.XFAObject { 64299 constructor(attributes) { 64300 super(TEMPLATE_NS_ID, "encryptData", true); 64301 this.id = attributes.id || ""; 64302 this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]); 64303 this.target = attributes.target || ""; 64304 this.use = attributes.use || ""; 64305 this.usehref = attributes.usehref || ""; 64306 this.filter = null; 64307 this.manifest = null; 64308 } 64309 64310} 64311 64312class Encryption extends _xfa_object.XFAObject { 64313 constructor(attributes) { 64314 super(TEMPLATE_NS_ID, "encryption", true); 64315 this.id = attributes.id || ""; 64316 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 64317 this.use = attributes.use || ""; 64318 this.usehref = attributes.usehref || ""; 64319 this.certificate = new _xfa_object.XFAObjectArray(); 64320 } 64321 64322} 64323 64324class EncryptionMethod extends _xfa_object.OptionObject { 64325 constructor(attributes) { 64326 super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]); 64327 this.id = attributes.id || ""; 64328 this.use = attributes.use || ""; 64329 this.usehref = attributes.usehref || ""; 64330 } 64331 64332} 64333 64334class EncryptionMethods extends _xfa_object.XFAObject { 64335 constructor(attributes) { 64336 super(TEMPLATE_NS_ID, "encryptionMethods", true); 64337 this.id = attributes.id || ""; 64338 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 64339 this.use = attributes.use || ""; 64340 this.usehref = attributes.usehref || ""; 64341 this.encryptionMethod = new _xfa_object.XFAObjectArray(); 64342 } 64343 64344} 64345 64346class Event extends _xfa_object.XFAObject { 64347 constructor(attributes) { 64348 super(TEMPLATE_NS_ID, "event", true); 64349 this.activity = (0, _utils.getStringOption)(attributes.activity, ["click", "change", "docClose", "docReady", "enter", "exit", "full", "indexChange", "initialize", "mouseDown", "mouseEnter", "mouseExit", "mouseUp", "postExecute", "postOpen", "postPrint", "postSave", "postSign", "postSubmit", "preExecute", "preOpen", "prePrint", "preSave", "preSign", "preSubmit", "ready", "validationState"]); 64350 this.id = attributes.id || ""; 64351 this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]); 64352 this.name = attributes.name || ""; 64353 this.ref = attributes.ref || ""; 64354 this.use = attributes.use || ""; 64355 this.usehref = attributes.usehref || ""; 64356 this.extras = null; 64357 this.encryptData = null; 64358 this.execute = null; 64359 this.script = null; 64360 this.signData = null; 64361 this.submit = null; 64362 } 64363 64364} 64365 64366class ExData extends _xfa_object.ContentObject { 64367 constructor(attributes) { 64368 super(TEMPLATE_NS_ID, "exData"); 64369 this.contentType = attributes.contentType || ""; 64370 this.href = attributes.href || ""; 64371 this.id = attributes.id || ""; 64372 this.maxLength = (0, _utils.getInteger)({ 64373 data: attributes.maxLength, 64374 defaultValue: -1, 64375 validate: x => x >= -1 64376 }); 64377 this.name = attributes.name || ""; 64378 this.rid = attributes.rid || ""; 64379 this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]); 64380 this.use = attributes.use || ""; 64381 this.usehref = attributes.usehref || ""; 64382 } 64383 64384 [_xfa_object.$isCDATAXml]() { 64385 return this.contentType === "text/html"; 64386 } 64387 64388 [_xfa_object.$onChild](child) { 64389 if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) { 64390 this[_xfa_object.$content] = child; 64391 return true; 64392 } 64393 64394 if (this.contentType === "text/xml") { 64395 this[_xfa_object.$content] = child; 64396 return true; 64397 } 64398 64399 return false; 64400 } 64401 64402 [_xfa_object.$toHTML](availableSpace) { 64403 if (this.contentType !== "text/html" || !this[_xfa_object.$content]) { 64404 return _utils.HTMLResult.EMPTY; 64405 } 64406 64407 return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace); 64408 } 64409 64410} 64411 64412class ExObject extends _xfa_object.XFAObject { 64413 constructor(attributes) { 64414 super(TEMPLATE_NS_ID, "exObject", true); 64415 this.archive = attributes.archive || ""; 64416 this.classId = attributes.classId || ""; 64417 this.codeBase = attributes.codeBase || ""; 64418 this.codeType = attributes.codeType || ""; 64419 this.id = attributes.id || ""; 64420 this.name = attributes.name || ""; 64421 this.use = attributes.use || ""; 64422 this.usehref = attributes.usehref || ""; 64423 this.extras = null; 64424 this.boolean = new _xfa_object.XFAObjectArray(); 64425 this.date = new _xfa_object.XFAObjectArray(); 64426 this.dateTime = new _xfa_object.XFAObjectArray(); 64427 this.decimal = new _xfa_object.XFAObjectArray(); 64428 this.exData = new _xfa_object.XFAObjectArray(); 64429 this.exObject = new _xfa_object.XFAObjectArray(); 64430 this.float = new _xfa_object.XFAObjectArray(); 64431 this.image = new _xfa_object.XFAObjectArray(); 64432 this.integer = new _xfa_object.XFAObjectArray(); 64433 this.text = new _xfa_object.XFAObjectArray(); 64434 this.time = new _xfa_object.XFAObjectArray(); 64435 } 64436 64437} 64438 64439class ExclGroup extends _xfa_object.XFAObject { 64440 constructor(attributes) { 64441 super(TEMPLATE_NS_ID, "exclGroup", true); 64442 this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]); 64443 this.accessKey = attributes.accessKey || ""; 64444 this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 64445 this.colSpan = (0, _utils.getInteger)({ 64446 data: attributes.colSpan, 64447 defaultValue: 1, 64448 validate: n => n >= 1 || n === -1 64449 }); 64450 this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : ""; 64451 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 64452 this.id = attributes.id || ""; 64453 this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]); 64454 this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt"); 64455 this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt"); 64456 this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt"); 64457 this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt"); 64458 this.name = attributes.name || ""; 64459 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 64460 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 64461 this.use = attributes.use || ""; 64462 this.usehref = attributes.usehref || ""; 64463 this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : ""; 64464 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 64465 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 64466 this.assist = null; 64467 this.bind = null; 64468 this.border = null; 64469 this.calculate = null; 64470 this.caption = null; 64471 this.desc = null; 64472 this.extras = null; 64473 this.margin = null; 64474 this.para = null; 64475 this.traversal = null; 64476 this.validate = null; 64477 this.connect = new _xfa_object.XFAObjectArray(); 64478 this.event = new _xfa_object.XFAObjectArray(); 64479 this.field = new _xfa_object.XFAObjectArray(); 64480 this.setProperty = new _xfa_object.XFAObjectArray(); 64481 } 64482 64483 [_xfa_object.$isBindable]() { 64484 return true; 64485 } 64486 64487 [_xfa_object.$hasSettableValue]() { 64488 return true; 64489 } 64490 64491 [_xfa_object.$setValue](value) { 64492 for (const field of this.field.children) { 64493 if (!field.value) { 64494 const nodeValue = new Value({}); 64495 64496 field[_xfa_object.$appendChild](nodeValue); 64497 64498 field.value = nodeValue; 64499 } 64500 64501 field.value[_xfa_object.$setValue](value); 64502 } 64503 } 64504 64505 [_xfa_object.$isThereMoreWidth]() { 64506 return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth](); 64507 } 64508 64509 [_xfa_object.$isSplittable]() { 64510 const parent = this[_xfa_object.$getSubformParent](); 64511 64512 if (!parent[_xfa_object.$isSplittable]()) { 64513 return false; 64514 } 64515 64516 if (this[_xfa_object.$extra]._isSplittable !== undefined) { 64517 return this[_xfa_object.$extra]._isSplittable; 64518 } 64519 64520 if (this.layout === "position" || this.layout.includes("row")) { 64521 this[_xfa_object.$extra]._isSplittable = false; 64522 return false; 64523 } 64524 64525 if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) { 64526 return false; 64527 } 64528 64529 this[_xfa_object.$extra]._isSplittable = true; 64530 return true; 64531 } 64532 64533 [_xfa_object.$flushHTML]() { 64534 return (0, _layout.flushHTML)(this); 64535 } 64536 64537 [_xfa_object.$addHTML](html, bbox) { 64538 (0, _layout.addHTML)(this, html, bbox); 64539 } 64540 64541 [_xfa_object.$getAvailableSpace]() { 64542 return (0, _layout.getAvailableSpace)(this); 64543 } 64544 64545 [_xfa_object.$toHTML](availableSpace) { 64546 setTabIndex(this); 64547 64548 if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) { 64549 return _utils.HTMLResult.EMPTY; 64550 } 64551 64552 (0, _html_utils.fixDimensions)(this); 64553 const children = []; 64554 const attributes = { 64555 id: this[_xfa_object.$uid], 64556 class: [] 64557 }; 64558 (0, _html_utils.setAccess)(this, attributes.class); 64559 64560 if (!this[_xfa_object.$extra]) { 64561 this[_xfa_object.$extra] = Object.create(null); 64562 } 64563 64564 Object.assign(this[_xfa_object.$extra], { 64565 children, 64566 attributes, 64567 attempt: 0, 64568 line: null, 64569 numberInLine: 0, 64570 availableSpace: { 64571 width: Math.min(this.w || Infinity, availableSpace.width), 64572 height: Math.min(this.h || Infinity, availableSpace.height) 64573 }, 64574 width: 0, 64575 height: 0, 64576 prevHeight: 0, 64577 currentWidth: 0 64578 }); 64579 64580 const isSplittable = this[_xfa_object.$isSplittable](); 64581 64582 if (!isSplittable) { 64583 setFirstUnsplittable(this); 64584 } 64585 64586 if (!(0, _layout.checkDimensions)(this, availableSpace)) { 64587 return _utils.HTMLResult.FAILURE; 64588 } 64589 64590 const filter = new Set(["field"]); 64591 64592 if (this.layout.includes("row")) { 64593 const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths; 64594 64595 if (Array.isArray(columnWidths) && columnWidths.length > 0) { 64596 this[_xfa_object.$extra].columnWidths = columnWidths; 64597 this[_xfa_object.$extra].currentColumn = 0; 64598 } 64599 } 64600 64601 const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign"); 64602 const classNames = ["xfaExclgroup"]; 64603 const cl = (0, _html_utils.layoutClass)(this); 64604 64605 if (cl) { 64606 classNames.push(cl); 64607 } 64608 64609 if ((0, _html_utils.isPrintOnly)(this)) { 64610 classNames.push("xfaPrintOnly"); 64611 } 64612 64613 attributes.style = style; 64614 attributes.class = classNames; 64615 64616 if (this.name) { 64617 attributes.xfaName = this.name; 64618 } 64619 64620 this[_xfa_object.$pushPara](); 64621 64622 const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb"; 64623 const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1; 64624 64625 for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) { 64626 if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) { 64627 this[_xfa_object.$extra].numberInLine = 0; 64628 } 64629 64630 const result = this[_xfa_object.$childrenToHTML]({ 64631 filter, 64632 include: true 64633 }); 64634 64635 if (result.success) { 64636 break; 64637 } 64638 64639 if (result.isBreak()) { 64640 this[_xfa_object.$popPara](); 64641 64642 return result; 64643 } 64644 64645 if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { 64646 this[_xfa_object.$extra].attempt = maxRun; 64647 break; 64648 } 64649 } 64650 64651 this[_xfa_object.$popPara](); 64652 64653 if (!isSplittable) { 64654 unsetFirstUnsplittable(this); 64655 } 64656 64657 if (this[_xfa_object.$extra].attempt === maxRun) { 64658 if (!isSplittable) { 64659 delete this[_xfa_object.$extra]; 64660 } 64661 64662 return _utils.HTMLResult.FAILURE; 64663 } 64664 64665 let marginH = 0; 64666 let marginV = 0; 64667 64668 if (this.margin) { 64669 marginH = this.margin.leftInset + this.margin.rightInset; 64670 marginV = this.margin.topInset + this.margin.bottomInset; 64671 } 64672 64673 const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0); 64674 const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0); 64675 const bbox = [this.x, this.y, width, height]; 64676 64677 if (this.w === "") { 64678 style.width = (0, _html_utils.measureToString)(width); 64679 } 64680 64681 if (this.h === "") { 64682 style.height = (0, _html_utils.measureToString)(height); 64683 } 64684 64685 const html = { 64686 name: "div", 64687 attributes, 64688 children 64689 }; 64690 applyAssist(this, attributes); 64691 delete this[_xfa_object.$extra]; 64692 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 64693 } 64694 64695} 64696 64697class Execute extends _xfa_object.XFAObject { 64698 constructor(attributes) { 64699 super(TEMPLATE_NS_ID, "execute"); 64700 this.connection = attributes.connection || ""; 64701 this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]); 64702 this.id = attributes.id || ""; 64703 this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]); 64704 this.use = attributes.use || ""; 64705 this.usehref = attributes.usehref || ""; 64706 } 64707 64708} 64709 64710class Extras extends _xfa_object.XFAObject { 64711 constructor(attributes) { 64712 super(TEMPLATE_NS_ID, "extras", true); 64713 this.id = attributes.id || ""; 64714 this.name = attributes.name || ""; 64715 this.use = attributes.use || ""; 64716 this.usehref = attributes.usehref || ""; 64717 this.boolean = new _xfa_object.XFAObjectArray(); 64718 this.date = new _xfa_object.XFAObjectArray(); 64719 this.dateTime = new _xfa_object.XFAObjectArray(); 64720 this.decimal = new _xfa_object.XFAObjectArray(); 64721 this.exData = new _xfa_object.XFAObjectArray(); 64722 this.extras = new _xfa_object.XFAObjectArray(); 64723 this.float = new _xfa_object.XFAObjectArray(); 64724 this.image = new _xfa_object.XFAObjectArray(); 64725 this.integer = new _xfa_object.XFAObjectArray(); 64726 this.text = new _xfa_object.XFAObjectArray(); 64727 this.time = new _xfa_object.XFAObjectArray(); 64728 } 64729 64730} 64731 64732class Field extends _xfa_object.XFAObject { 64733 constructor(attributes) { 64734 super(TEMPLATE_NS_ID, "field", true); 64735 this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]); 64736 this.accessKey = attributes.accessKey || ""; 64737 this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 64738 this.colSpan = (0, _utils.getInteger)({ 64739 data: attributes.colSpan, 64740 defaultValue: 1, 64741 validate: n => n >= 1 || n === -1 64742 }); 64743 this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : ""; 64744 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 64745 this.id = attributes.id || ""; 64746 this.locale = attributes.locale || ""; 64747 this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt"); 64748 this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt"); 64749 this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt"); 64750 this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt"); 64751 this.name = attributes.name || ""; 64752 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 64753 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 64754 this.rotate = (0, _utils.getInteger)({ 64755 data: attributes.rotate, 64756 defaultValue: 0, 64757 validate: x => x % 90 === 0 64758 }); 64759 this.use = attributes.use || ""; 64760 this.usehref = attributes.usehref || ""; 64761 this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : ""; 64762 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 64763 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 64764 this.assist = null; 64765 this.bind = null; 64766 this.border = null; 64767 this.calculate = null; 64768 this.caption = null; 64769 this.desc = null; 64770 this.extras = null; 64771 this.font = null; 64772 this.format = null; 64773 this.items = new _xfa_object.XFAObjectArray(2); 64774 this.keep = null; 64775 this.margin = null; 64776 this.para = null; 64777 this.traversal = null; 64778 this.ui = null; 64779 this.validate = null; 64780 this.value = null; 64781 this.bindItems = new _xfa_object.XFAObjectArray(); 64782 this.connect = new _xfa_object.XFAObjectArray(); 64783 this.event = new _xfa_object.XFAObjectArray(); 64784 this.setProperty = new _xfa_object.XFAObjectArray(); 64785 } 64786 64787 [_xfa_object.$isBindable]() { 64788 return true; 64789 } 64790 64791 [_xfa_object.$setValue](value) { 64792 _setValue(this, value); 64793 } 64794 64795 [_xfa_object.$toHTML](availableSpace) { 64796 setTabIndex(this); 64797 64798 if (!this.ui) { 64799 this.ui = new Ui({}); 64800 this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData]; 64801 64802 this[_xfa_object.$appendChild](this.ui); 64803 64804 let node; 64805 64806 switch (this.items.children.length) { 64807 case 0: 64808 node = new TextEdit({}); 64809 this.ui.textEdit = node; 64810 break; 64811 64812 case 1: 64813 node = new CheckButton({}); 64814 this.ui.checkButton = node; 64815 break; 64816 64817 case 2: 64818 node = new ChoiceList({}); 64819 this.ui.choiceList = node; 64820 break; 64821 } 64822 64823 this.ui[_xfa_object.$appendChild](node); 64824 } 64825 64826 if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) { 64827 return _utils.HTMLResult.EMPTY; 64828 } 64829 64830 if (this.caption) { 64831 delete this.caption[_xfa_object.$extra]; 64832 } 64833 64834 this[_xfa_object.$pushPara](); 64835 64836 const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null; 64837 const savedW = this.w; 64838 const savedH = this.h; 64839 let marginH = 0; 64840 let marginV = 0; 64841 64842 if (this.margin) { 64843 marginH = this.margin.leftInset + this.margin.rightInset; 64844 marginV = this.margin.topInset + this.margin.bottomInset; 64845 } 64846 64847 let borderDims = null; 64848 64849 if (this.w === "" || this.h === "") { 64850 let width = null; 64851 let height = null; 64852 let uiW = 0; 64853 let uiH = 0; 64854 64855 if (this.ui.checkButton) { 64856 uiW = uiH = this.ui.checkButton.size; 64857 } else { 64858 const { 64859 w, 64860 h 64861 } = (0, _html_utils.layoutNode)(this, availableSpace); 64862 64863 if (w !== null) { 64864 uiW = w; 64865 uiH = h; 64866 } else { 64867 uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap; 64868 } 64869 } 64870 64871 borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]()); 64872 uiW += borderDims.w; 64873 uiH += borderDims.h; 64874 64875 if (this.caption) { 64876 const { 64877 w, 64878 h, 64879 isBroken 64880 } = this.caption[_xfa_object.$getExtra](availableSpace); 64881 64882 if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) { 64883 this[_xfa_object.$popPara](); 64884 64885 return _utils.HTMLResult.FAILURE; 64886 } 64887 64888 width = w; 64889 height = h; 64890 64891 switch (this.caption.placement) { 64892 case "left": 64893 case "right": 64894 case "inline": 64895 width += uiW; 64896 break; 64897 64898 case "top": 64899 case "bottom": 64900 height += uiH; 64901 break; 64902 } 64903 } else { 64904 width = uiW; 64905 height = uiH; 64906 } 64907 64908 if (width && this.w === "") { 64909 width += marginH; 64910 this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW); 64911 } 64912 64913 if (height && this.h === "") { 64914 height += marginV; 64915 this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH); 64916 } 64917 } 64918 64919 this[_xfa_object.$popPara](); 64920 64921 (0, _html_utils.fixDimensions)(this); 64922 setFirstUnsplittable(this); 64923 64924 if (!(0, _layout.checkDimensions)(this, availableSpace)) { 64925 this.w = savedW; 64926 this.h = savedH; 64927 64928 this[_xfa_object.$popPara](); 64929 64930 return _utils.HTMLResult.FAILURE; 64931 } 64932 64933 unsetFirstUnsplittable(this); 64934 const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign"); 64935 (0, _html_utils.setMinMaxDimensions)(this, style); 64936 const classNames = ["xfaField"]; 64937 64938 if (this.font) { 64939 classNames.push("xfaFont"); 64940 } 64941 64942 if ((0, _html_utils.isPrintOnly)(this)) { 64943 classNames.push("xfaPrintOnly"); 64944 } 64945 64946 const attributes = { 64947 style, 64948 id: this[_xfa_object.$uid], 64949 class: classNames 64950 }; 64951 64952 if (style.margin) { 64953 style.padding = style.margin; 64954 delete style.margin; 64955 } 64956 64957 (0, _html_utils.setAccess)(this, classNames); 64958 64959 if (this.name) { 64960 attributes.xfaName = this.name; 64961 } 64962 64963 const children = []; 64964 const html = { 64965 name: "div", 64966 attributes, 64967 children 64968 }; 64969 applyAssist(this, attributes); 64970 const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null; 64971 const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace); 64972 64973 const ui = this.ui[_xfa_object.$toHTML]().html; 64974 64975 if (!ui) { 64976 Object.assign(style, borderStyle); 64977 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 64978 } 64979 64980 if (this[_xfa_object.$tabIndex]) { 64981 if (ui.children && ui.children[0]) { 64982 ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex]; 64983 } else { 64984 ui.attributes.tabindex = this[_xfa_object.$tabIndex]; 64985 } 64986 } 64987 64988 if (!ui.attributes.style) { 64989 ui.attributes.style = Object.create(null); 64990 } 64991 64992 let aElement = null; 64993 64994 if (this.ui.button) { 64995 if (ui.children.length === 1) { 64996 [aElement] = ui.children.splice(0, 1); 64997 } 64998 64999 Object.assign(ui.attributes.style, borderStyle); 65000 } else { 65001 Object.assign(style, borderStyle); 65002 } 65003 65004 children.push(ui); 65005 65006 if (this.value) { 65007 if (this.ui.imageEdit) { 65008 ui.children.push(this.value[_xfa_object.$toHTML]().html); 65009 } else if (!this.ui.button) { 65010 let value = ""; 65011 65012 if (this.value.exData) { 65013 value = this.value.exData[_xfa_object.$text](); 65014 } else if (this.value.text) { 65015 value = this.value.text[_xfa_object.$getExtra](); 65016 } else { 65017 const htmlValue = this.value[_xfa_object.$toHTML]().html; 65018 65019 if (htmlValue !== null) { 65020 value = htmlValue.children[0].value; 65021 } 65022 } 65023 65024 if (this.ui.textEdit && this.value.text && this.value.text.maxChars) { 65025 ui.children[0].attributes.maxLength = this.value.text.maxChars; 65026 } 65027 65028 if (value) { 65029 if (this.ui.numericEdit) { 65030 value = parseFloat(value); 65031 value = isNaN(value) ? "" : value.toString(); 65032 } 65033 65034 if (ui.children[0].name === "textarea") { 65035 ui.children[0].attributes.textContent = value; 65036 } else { 65037 ui.children[0].attributes.value = value; 65038 } 65039 } 65040 } 65041 } 65042 65043 if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) { 65044 borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]()); 65045 let captionHeight = 0; 65046 65047 if (this.caption && ["top", "bottom"].includes(this.caption.placement)) { 65048 captionHeight = this.caption.reserve; 65049 65050 if (captionHeight <= 0) { 65051 captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h; 65052 } 65053 65054 const inputHeight = this.h - captionHeight - marginV - borderDims.h; 65055 ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight); 65056 } else { 65057 ui.children[0].attributes.style.height = "100%"; 65058 } 65059 } 65060 65061 if (aElement) { 65062 ui.children.push(aElement); 65063 } 65064 65065 if (!caption) { 65066 if (ui.attributes.class) { 65067 ui.attributes.class.push("xfaLeft"); 65068 } 65069 65070 this.w = savedW; 65071 this.h = savedH; 65072 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 65073 } 65074 65075 if (this.ui.button) { 65076 if (style.padding) { 65077 delete style.padding; 65078 } 65079 65080 if (caption.name === "div") { 65081 caption.name = "span"; 65082 } 65083 65084 ui.children.push(caption); 65085 return _utils.HTMLResult.success(html, bbox); 65086 } else if (this.ui.checkButton) { 65087 caption.attributes.class[0] = "xfaCaptionForCheckButton"; 65088 } 65089 65090 if (!ui.attributes.class) { 65091 ui.attributes.class = []; 65092 } 65093 65094 ui.children.splice(0, 0, caption); 65095 65096 switch (this.caption.placement) { 65097 case "left": 65098 ui.attributes.class.push("xfaLeft"); 65099 break; 65100 65101 case "right": 65102 ui.attributes.class.push("xfaRight"); 65103 break; 65104 65105 case "top": 65106 ui.attributes.class.push("xfaTop"); 65107 break; 65108 65109 case "bottom": 65110 ui.attributes.class.push("xfaBottom"); 65111 break; 65112 65113 case "inline": 65114 ui.attributes.class.push("xfaLeft"); 65115 break; 65116 } 65117 65118 this.w = savedW; 65119 this.h = savedH; 65120 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 65121 } 65122 65123} 65124 65125exports.Field = Field; 65126 65127class Fill extends _xfa_object.XFAObject { 65128 constructor(attributes) { 65129 super(TEMPLATE_NS_ID, "fill", true); 65130 this.id = attributes.id || ""; 65131 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 65132 this.use = attributes.use || ""; 65133 this.usehref = attributes.usehref || ""; 65134 this.color = null; 65135 this.extras = null; 65136 this.linear = null; 65137 this.pattern = null; 65138 this.radial = null; 65139 this.solid = null; 65140 this.stipple = null; 65141 } 65142 65143 [_xfa_object.$toStyle]() { 65144 const parent = this[_xfa_object.$getParent](); 65145 65146 const grandpa = parent[_xfa_object.$getParent](); 65147 65148 const ggrandpa = grandpa[_xfa_object.$getParent](); 65149 65150 const style = Object.create(null); 65151 let propName = "color"; 65152 let altPropName = propName; 65153 65154 if (parent instanceof Border) { 65155 propName = "background-color"; 65156 altPropName = "background"; 65157 65158 if (ggrandpa instanceof Ui) { 65159 style.backgroundColor = "white"; 65160 } 65161 } 65162 65163 if (parent instanceof Rectangle || parent instanceof Arc) { 65164 propName = altPropName = "fill"; 65165 style.fill = "white"; 65166 } 65167 65168 for (const name of Object.getOwnPropertyNames(this)) { 65169 if (name === "extras" || name === "color") { 65170 continue; 65171 } 65172 65173 const obj = this[name]; 65174 65175 if (!(obj instanceof _xfa_object.XFAObject)) { 65176 continue; 65177 } 65178 65179 const color = obj[_xfa_object.$toStyle](this.color); 65180 65181 if (color) { 65182 style[color.startsWith("#") ? propName : altPropName] = color; 65183 } 65184 65185 return style; 65186 } 65187 65188 if (this.color && this.color.value) { 65189 const color = this.color[_xfa_object.$toStyle](); 65190 65191 style[color.startsWith("#") ? propName : altPropName] = color; 65192 } 65193 65194 return style; 65195 } 65196 65197} 65198 65199class Filter extends _xfa_object.XFAObject { 65200 constructor(attributes) { 65201 super(TEMPLATE_NS_ID, "filter", true); 65202 this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]); 65203 this.id = attributes.id || ""; 65204 this.name = attributes.name || ""; 65205 this.use = attributes.use || ""; 65206 this.usehref = attributes.usehref || ""; 65207 this.version = (0, _utils.getInteger)({ 65208 data: this.version, 65209 defaultValue: 5, 65210 validate: x => x >= 1 && x <= 5 65211 }); 65212 this.appearanceFilter = null; 65213 this.certificates = null; 65214 this.digestMethods = null; 65215 this.encodings = null; 65216 this.encryptionMethods = null; 65217 this.handler = null; 65218 this.lockDocument = null; 65219 this.mdp = null; 65220 this.reasons = null; 65221 this.timeStamp = null; 65222 } 65223 65224} 65225 65226class Float extends _xfa_object.ContentObject { 65227 constructor(attributes) { 65228 super(TEMPLATE_NS_ID, "float"); 65229 this.id = attributes.id || ""; 65230 this.name = attributes.name || ""; 65231 this.use = attributes.use || ""; 65232 this.usehref = attributes.usehref || ""; 65233 } 65234 65235 [_xfa_object.$finalize]() { 65236 const number = parseFloat(this[_xfa_object.$content].trim()); 65237 this[_xfa_object.$content] = isNaN(number) ? null : number; 65238 } 65239 65240 [_xfa_object.$toHTML](availableSpace) { 65241 return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : ""); 65242 } 65243 65244} 65245 65246class Font extends _xfa_object.XFAObject { 65247 constructor(attributes) { 65248 super(TEMPLATE_NS_ID, "font", true); 65249 this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift); 65250 this.fontHorizontalScale = (0, _utils.getFloat)({ 65251 data: attributes.fontHorizontalScale, 65252 defaultValue: 100, 65253 validate: x => x >= 0 65254 }); 65255 this.fontVerticalScale = (0, _utils.getFloat)({ 65256 data: attributes.fontVerticalScale, 65257 defaultValue: 100, 65258 validate: x => x >= 0 65259 }); 65260 this.id = attributes.id || ""; 65261 this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]); 65262 this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0"); 65263 this.lineThrough = (0, _utils.getInteger)({ 65264 data: attributes.lineThrough, 65265 defaultValue: 0, 65266 validate: x => x === 1 || x === 2 65267 }); 65268 this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]); 65269 this.overline = (0, _utils.getInteger)({ 65270 data: attributes.overline, 65271 defaultValue: 0, 65272 validate: x => x === 1 || x === 2 65273 }); 65274 this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]); 65275 this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]); 65276 this.size = (0, _utils.getMeasurement)(attributes.size, "10pt"); 65277 this.typeface = attributes.typeface || "Courier"; 65278 this.underline = (0, _utils.getInteger)({ 65279 data: attributes.underline, 65280 defaultValue: 0, 65281 validate: x => x === 1 || x === 2 65282 }); 65283 this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]); 65284 this.use = attributes.use || ""; 65285 this.usehref = attributes.usehref || ""; 65286 this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]); 65287 this.extras = null; 65288 this.fill = null; 65289 } 65290 65291 [_xfa_object.$clean](builder) { 65292 super[_xfa_object.$clean](builder); 65293 65294 this[_xfa_object.$globalData].usedTypefaces.add(this.typeface); 65295 } 65296 65297 [_xfa_object.$toStyle]() { 65298 const style = (0, _html_utils.toStyle)(this, "fill"); 65299 const color = style.color; 65300 65301 if (color) { 65302 if (color === "#000000") { 65303 delete style.color; 65304 } else if (!color.startsWith("#")) { 65305 style.background = color; 65306 style.backgroundClip = "text"; 65307 style.color = "transparent"; 65308 } 65309 } 65310 65311 if (this.baselineShift) { 65312 style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift); 65313 } 65314 65315 style.fontKerning = this.kerningMode === "none" ? "none" : "normal"; 65316 style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing); 65317 65318 if (this.lineThrough !== 0) { 65319 style.textDecoration = "line-through"; 65320 65321 if (this.lineThrough === 2) { 65322 style.textDecorationStyle = "double"; 65323 } 65324 } 65325 65326 if (this.overline !== 0) { 65327 style.textDecoration = "overline"; 65328 65329 if (this.overline === 2) { 65330 style.textDecorationStyle = "double"; 65331 } 65332 } 65333 65334 style.fontStyle = this.posture; 65335 style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size); 65336 (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style); 65337 65338 if (this.underline !== 0) { 65339 style.textDecoration = "underline"; 65340 65341 if (this.underline === 2) { 65342 style.textDecorationStyle = "double"; 65343 } 65344 } 65345 65346 style.fontWeight = this.weight; 65347 return style; 65348 } 65349 65350} 65351 65352class Format extends _xfa_object.XFAObject { 65353 constructor(attributes) { 65354 super(TEMPLATE_NS_ID, "format", true); 65355 this.id = attributes.id || ""; 65356 this.use = attributes.use || ""; 65357 this.usehref = attributes.usehref || ""; 65358 this.extras = null; 65359 this.picture = null; 65360 } 65361 65362} 65363 65364class Handler extends _xfa_object.StringObject { 65365 constructor(attributes) { 65366 super(TEMPLATE_NS_ID, "handler"); 65367 this.id = attributes.id || ""; 65368 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 65369 this.use = attributes.use || ""; 65370 this.usehref = attributes.usehref || ""; 65371 } 65372 65373} 65374 65375class Hyphenation extends _xfa_object.XFAObject { 65376 constructor(attributes) { 65377 super(TEMPLATE_NS_ID, "hyphenation"); 65378 this.excludeAllCaps = (0, _utils.getInteger)({ 65379 data: attributes.excludeAllCaps, 65380 defaultValue: 0, 65381 validate: x => x === 1 65382 }); 65383 this.excludeInitialCap = (0, _utils.getInteger)({ 65384 data: attributes.excludeInitialCap, 65385 defaultValue: 0, 65386 validate: x => x === 1 65387 }); 65388 this.hyphenate = (0, _utils.getInteger)({ 65389 data: attributes.hyphenate, 65390 defaultValue: 0, 65391 validate: x => x === 1 65392 }); 65393 this.id = attributes.id || ""; 65394 this.pushCharacterCount = (0, _utils.getInteger)({ 65395 data: attributes.pushCharacterCount, 65396 defaultValue: 3, 65397 validate: x => x >= 0 65398 }); 65399 this.remainCharacterCount = (0, _utils.getInteger)({ 65400 data: attributes.remainCharacterCount, 65401 defaultValue: 3, 65402 validate: x => x >= 0 65403 }); 65404 this.use = attributes.use || ""; 65405 this.usehref = attributes.usehref || ""; 65406 this.wordCharacterCount = (0, _utils.getInteger)({ 65407 data: attributes.wordCharacterCount, 65408 defaultValue: 7, 65409 validate: x => x >= 0 65410 }); 65411 } 65412 65413} 65414 65415class Image extends _xfa_object.StringObject { 65416 constructor(attributes) { 65417 super(TEMPLATE_NS_ID, "image"); 65418 this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]); 65419 this.contentType = attributes.contentType || ""; 65420 this.href = attributes.href || ""; 65421 this.id = attributes.id || ""; 65422 this.name = attributes.name || ""; 65423 this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]); 65424 this.use = attributes.use || ""; 65425 this.usehref = attributes.usehref || ""; 65426 } 65427 65428 [_xfa_object.$toHTML]() { 65429 if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) { 65430 return _utils.HTMLResult.EMPTY; 65431 } 65432 65433 let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href); 65434 65435 if (!buffer && (this.href || !this[_xfa_object.$content])) { 65436 return _utils.HTMLResult.EMPTY; 65437 } 65438 65439 if (!buffer && this.transferEncoding === "base64") { 65440 buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content])); 65441 } 65442 65443 if (!buffer) { 65444 return _utils.HTMLResult.EMPTY; 65445 } 65446 65447 if (!this.contentType) { 65448 for (const [header, type] of IMAGES_HEADERS) { 65449 if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) { 65450 this.contentType = type; 65451 break; 65452 } 65453 } 65454 65455 if (!this.contentType) { 65456 return _utils.HTMLResult.EMPTY; 65457 } 65458 } 65459 65460 const blob = new Blob([buffer], { 65461 type: this.contentType 65462 }); 65463 let style; 65464 65465 switch (this.aspect) { 65466 case "fit": 65467 case "actual": 65468 break; 65469 65470 case "height": 65471 style = { 65472 height: "100%", 65473 objectFit: "fill" 65474 }; 65475 break; 65476 65477 case "none": 65478 style = { 65479 width: "100%", 65480 height: "100%", 65481 objectFit: "fill" 65482 }; 65483 break; 65484 65485 case "width": 65486 style = { 65487 width: "100%", 65488 objectFit: "fill" 65489 }; 65490 break; 65491 } 65492 65493 const parent = this[_xfa_object.$getParent](); 65494 65495 return _utils.HTMLResult.success({ 65496 name: "img", 65497 attributes: { 65498 class: ["xfaImage"], 65499 style, 65500 src: URL.createObjectURL(blob), 65501 alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null 65502 } 65503 }); 65504 } 65505 65506} 65507 65508class ImageEdit extends _xfa_object.XFAObject { 65509 constructor(attributes) { 65510 super(TEMPLATE_NS_ID, "imageEdit", true); 65511 this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]); 65512 this.id = attributes.id || ""; 65513 this.use = attributes.use || ""; 65514 this.usehref = attributes.usehref || ""; 65515 this.border = null; 65516 this.extras = null; 65517 this.margin = null; 65518 } 65519 65520 [_xfa_object.$toHTML](availableSpace) { 65521 if (this.data === "embed") { 65522 return _utils.HTMLResult.success({ 65523 name: "div", 65524 children: [], 65525 attributes: {} 65526 }); 65527 } 65528 65529 return _utils.HTMLResult.EMPTY; 65530 } 65531 65532} 65533 65534class Integer extends _xfa_object.ContentObject { 65535 constructor(attributes) { 65536 super(TEMPLATE_NS_ID, "integer"); 65537 this.id = attributes.id || ""; 65538 this.name = attributes.name || ""; 65539 this.use = attributes.use || ""; 65540 this.usehref = attributes.usehref || ""; 65541 } 65542 65543 [_xfa_object.$finalize]() { 65544 const number = parseInt(this[_xfa_object.$content].trim(), 10); 65545 this[_xfa_object.$content] = isNaN(number) ? null : number; 65546 } 65547 65548 [_xfa_object.$toHTML](availableSpace) { 65549 return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : ""); 65550 } 65551 65552} 65553 65554class Issuers extends _xfa_object.XFAObject { 65555 constructor(attributes) { 65556 super(TEMPLATE_NS_ID, "issuers", true); 65557 this.id = attributes.id || ""; 65558 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 65559 this.use = attributes.use || ""; 65560 this.usehref = attributes.usehref || ""; 65561 this.certificate = new _xfa_object.XFAObjectArray(); 65562 } 65563 65564} 65565 65566class Items extends _xfa_object.XFAObject { 65567 constructor(attributes) { 65568 super(TEMPLATE_NS_ID, "items", true); 65569 this.id = attributes.id || ""; 65570 this.name = attributes.name || ""; 65571 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 65572 this.ref = attributes.ref || ""; 65573 this.save = (0, _utils.getInteger)({ 65574 data: attributes.save, 65575 defaultValue: 0, 65576 validate: x => x === 1 65577 }); 65578 this.use = attributes.use || ""; 65579 this.usehref = attributes.usehref || ""; 65580 this.boolean = new _xfa_object.XFAObjectArray(); 65581 this.date = new _xfa_object.XFAObjectArray(); 65582 this.dateTime = new _xfa_object.XFAObjectArray(); 65583 this.decimal = new _xfa_object.XFAObjectArray(); 65584 this.exData = new _xfa_object.XFAObjectArray(); 65585 this.float = new _xfa_object.XFAObjectArray(); 65586 this.image = new _xfa_object.XFAObjectArray(); 65587 this.integer = new _xfa_object.XFAObjectArray(); 65588 this.text = new _xfa_object.XFAObjectArray(); 65589 this.time = new _xfa_object.XFAObjectArray(); 65590 } 65591 65592 [_xfa_object.$toHTML]() { 65593 const output = []; 65594 65595 for (const child of this[_xfa_object.$getChildren]()) { 65596 output.push(child[_xfa_object.$text]()); 65597 } 65598 65599 return _utils.HTMLResult.success(output); 65600 } 65601 65602} 65603 65604exports.Items = Items; 65605 65606class Keep extends _xfa_object.XFAObject { 65607 constructor(attributes) { 65608 super(TEMPLATE_NS_ID, "keep", true); 65609 this.id = attributes.id || ""; 65610 const options = ["none", "contentArea", "pageArea"]; 65611 this.intact = (0, _utils.getStringOption)(attributes.intact, options); 65612 this.next = (0, _utils.getStringOption)(attributes.next, options); 65613 this.previous = (0, _utils.getStringOption)(attributes.previous, options); 65614 this.use = attributes.use || ""; 65615 this.usehref = attributes.usehref || ""; 65616 this.extras = null; 65617 } 65618 65619} 65620 65621class KeyUsage extends _xfa_object.XFAObject { 65622 constructor(attributes) { 65623 super(TEMPLATE_NS_ID, "keyUsage"); 65624 const options = ["", "yes", "no"]; 65625 this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options); 65626 this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options); 65627 this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options); 65628 this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options); 65629 this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options); 65630 this.id = attributes.id || ""; 65631 this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options); 65632 this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options); 65633 this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options); 65634 this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options); 65635 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 65636 this.use = attributes.use || ""; 65637 this.usehref = attributes.usehref || ""; 65638 } 65639 65640} 65641 65642class Line extends _xfa_object.XFAObject { 65643 constructor(attributes) { 65644 super(TEMPLATE_NS_ID, "line", true); 65645 this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]); 65646 this.id = attributes.id || ""; 65647 this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]); 65648 this.use = attributes.use || ""; 65649 this.usehref = attributes.usehref || ""; 65650 this.edge = null; 65651 } 65652 65653 [_xfa_object.$toHTML]() { 65654 const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 65655 65656 const edge = this.edge || new Edge({}); 65657 65658 const edgeStyle = edge[_xfa_object.$toStyle](); 65659 65660 const style = Object.create(null); 65661 const thickness = edge.presence === "visible" ? edge.thickness : 0; 65662 style.strokeWidth = (0, _html_utils.measureToString)(thickness); 65663 style.stroke = edgeStyle.color; 65664 let x1, y1, x2, y2; 65665 let width = "100%"; 65666 let height = "100%"; 65667 65668 if (parent.w <= thickness) { 65669 [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"]; 65670 width = style.strokeWidth; 65671 } else if (parent.h <= thickness) { 65672 [x1, y1, x2, y2] = [0, "50%", "100%", "50%"]; 65673 height = style.strokeWidth; 65674 } else { 65675 if (this.slope === "\\") { 65676 [x1, y1, x2, y2] = [0, 0, "100%", "100%"]; 65677 } else { 65678 [x1, y1, x2, y2] = [0, "100%", "100%", 0]; 65679 } 65680 } 65681 65682 const line = { 65683 name: "line", 65684 attributes: { 65685 xmlns: SVG_NS, 65686 x1, 65687 y1, 65688 x2, 65689 y2, 65690 style 65691 } 65692 }; 65693 const svg = { 65694 name: "svg", 65695 children: [line], 65696 attributes: { 65697 xmlns: SVG_NS, 65698 width, 65699 height, 65700 style: { 65701 overflow: "visible" 65702 } 65703 } 65704 }; 65705 65706 if (hasMargin(parent)) { 65707 return _utils.HTMLResult.success({ 65708 name: "div", 65709 attributes: { 65710 style: { 65711 display: "inline", 65712 width: "100%", 65713 height: "100%" 65714 } 65715 }, 65716 children: [svg] 65717 }); 65718 } 65719 65720 svg.attributes.style.position = "absolute"; 65721 return _utils.HTMLResult.success(svg); 65722 } 65723 65724} 65725 65726class Linear extends _xfa_object.XFAObject { 65727 constructor(attributes) { 65728 super(TEMPLATE_NS_ID, "linear", true); 65729 this.id = attributes.id || ""; 65730 this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]); 65731 this.use = attributes.use || ""; 65732 this.usehref = attributes.usehref || ""; 65733 this.color = null; 65734 this.extras = null; 65735 } 65736 65737 [_xfa_object.$toStyle](startColor) { 65738 startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF"; 65739 const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase(); 65740 const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000"; 65741 return `linear-gradient(${transf}, ${startColor}, ${endColor})`; 65742 } 65743 65744} 65745 65746class LockDocument extends _xfa_object.ContentObject { 65747 constructor(attributes) { 65748 super(TEMPLATE_NS_ID, "lockDocument"); 65749 this.id = attributes.id || ""; 65750 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 65751 this.use = attributes.use || ""; 65752 this.usehref = attributes.usehref || ""; 65753 } 65754 65755 [_xfa_object.$finalize]() { 65756 this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]); 65757 } 65758 65759} 65760 65761class Manifest extends _xfa_object.XFAObject { 65762 constructor(attributes) { 65763 super(TEMPLATE_NS_ID, "manifest", true); 65764 this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]); 65765 this.id = attributes.id || ""; 65766 this.name = attributes.name || ""; 65767 this.use = attributes.use || ""; 65768 this.usehref = attributes.usehref || ""; 65769 this.extras = null; 65770 this.ref = new _xfa_object.XFAObjectArray(); 65771 } 65772 65773} 65774 65775class Margin extends _xfa_object.XFAObject { 65776 constructor(attributes) { 65777 super(TEMPLATE_NS_ID, "margin", true); 65778 this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0"); 65779 this.id = attributes.id || ""; 65780 this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0"); 65781 this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0"); 65782 this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0"); 65783 this.use = attributes.use || ""; 65784 this.usehref = attributes.usehref || ""; 65785 this.extras = null; 65786 } 65787 65788 [_xfa_object.$toStyle]() { 65789 return { 65790 margin: (0, _html_utils.measureToString)(this.topInset) + " " + (0, _html_utils.measureToString)(this.rightInset) + " " + (0, _html_utils.measureToString)(this.bottomInset) + " " + (0, _html_utils.measureToString)(this.leftInset) 65791 }; 65792 } 65793 65794} 65795 65796class Mdp extends _xfa_object.XFAObject { 65797 constructor(attributes) { 65798 super(TEMPLATE_NS_ID, "mdp"); 65799 this.id = attributes.id || ""; 65800 this.permissions = (0, _utils.getInteger)({ 65801 data: attributes.permissions, 65802 defaultValue: 2, 65803 validate: x => x === 1 || x === 3 65804 }); 65805 this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]); 65806 this.use = attributes.use || ""; 65807 this.usehref = attributes.usehref || ""; 65808 } 65809 65810} 65811 65812class Medium extends _xfa_object.XFAObject { 65813 constructor(attributes) { 65814 super(TEMPLATE_NS_ID, "medium"); 65815 this.id = attributes.id || ""; 65816 this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox); 65817 this.long = (0, _utils.getMeasurement)(attributes.long); 65818 this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]); 65819 this.short = (0, _utils.getMeasurement)(attributes.short); 65820 this.stock = attributes.stock || ""; 65821 this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]); 65822 this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]); 65823 this.use = attributes.use || ""; 65824 this.usehref = attributes.usehref || ""; 65825 } 65826 65827} 65828 65829class Message extends _xfa_object.XFAObject { 65830 constructor(attributes) { 65831 super(TEMPLATE_NS_ID, "message", true); 65832 this.id = attributes.id || ""; 65833 this.use = attributes.use || ""; 65834 this.usehref = attributes.usehref || ""; 65835 this.text = new _xfa_object.XFAObjectArray(); 65836 } 65837 65838} 65839 65840class NumericEdit extends _xfa_object.XFAObject { 65841 constructor(attributes) { 65842 super(TEMPLATE_NS_ID, "numericEdit", true); 65843 this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); 65844 this.id = attributes.id || ""; 65845 this.use = attributes.use || ""; 65846 this.usehref = attributes.usehref || ""; 65847 this.border = null; 65848 this.comb = null; 65849 this.extras = null; 65850 this.margin = null; 65851 } 65852 65853 [_xfa_object.$toHTML](availableSpace) { 65854 const style = (0, _html_utils.toStyle)(this, "border", "font", "margin"); 65855 65856 const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 65857 65858 const html = { 65859 name: "input", 65860 attributes: { 65861 type: "text", 65862 fieldId: field[_xfa_object.$uid], 65863 dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], 65864 class: ["xfaTextfield"], 65865 style, 65866 "aria-label": ariaLabel(field), 65867 "aria-required": false 65868 } 65869 }; 65870 65871 if (isRequired(field)) { 65872 html.attributes["aria-required"] = true; 65873 html.attributes.required = true; 65874 } 65875 65876 return _utils.HTMLResult.success({ 65877 name: "label", 65878 attributes: { 65879 class: ["xfaLabel"] 65880 }, 65881 children: [html] 65882 }); 65883 } 65884 65885} 65886 65887class Occur extends _xfa_object.XFAObject { 65888 constructor(attributes) { 65889 super(TEMPLATE_NS_ID, "occur", true); 65890 this.id = attributes.id || ""; 65891 this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({ 65892 data: attributes.initial, 65893 defaultValue: "", 65894 validate: x => true 65895 }) : ""; 65896 this.max = attributes.max !== "" ? (0, _utils.getInteger)({ 65897 data: attributes.max, 65898 defaultValue: 1, 65899 validate: x => true 65900 }) : ""; 65901 this.min = attributes.min !== "" ? (0, _utils.getInteger)({ 65902 data: attributes.min, 65903 defaultValue: 1, 65904 validate: x => true 65905 }) : ""; 65906 this.use = attributes.use || ""; 65907 this.usehref = attributes.usehref || ""; 65908 this.extras = null; 65909 } 65910 65911 [_xfa_object.$clean]() { 65912 const parent = this[_xfa_object.$getParent](); 65913 65914 const originalMin = this.min; 65915 65916 if (this.min === "") { 65917 this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1; 65918 } 65919 65920 if (this.max === "") { 65921 if (originalMin === "") { 65922 this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1; 65923 } else { 65924 this.max = this.min; 65925 } 65926 } 65927 65928 if (this.max !== -1 && this.max < this.min) { 65929 this.max = this.min; 65930 } 65931 65932 if (this.initial === "") { 65933 this.initial = parent instanceof Template ? 1 : this.min; 65934 } 65935 } 65936 65937} 65938 65939class Oid extends _xfa_object.StringObject { 65940 constructor(attributes) { 65941 super(TEMPLATE_NS_ID, "oid"); 65942 this.id = attributes.id || ""; 65943 this.name = attributes.name || ""; 65944 this.use = attributes.use || ""; 65945 this.usehref = attributes.usehref || ""; 65946 } 65947 65948} 65949 65950class Oids extends _xfa_object.XFAObject { 65951 constructor(attributes) { 65952 super(TEMPLATE_NS_ID, "oids", true); 65953 this.id = attributes.id || ""; 65954 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 65955 this.use = attributes.use || ""; 65956 this.usehref = attributes.usehref || ""; 65957 this.oid = new _xfa_object.XFAObjectArray(); 65958 } 65959 65960} 65961 65962class Overflow extends _xfa_object.XFAObject { 65963 constructor(attributes) { 65964 super(TEMPLATE_NS_ID, "overflow"); 65965 this.id = attributes.id || ""; 65966 this.leader = attributes.leader || ""; 65967 this.target = attributes.target || ""; 65968 this.trailer = attributes.trailer || ""; 65969 this.use = attributes.use || ""; 65970 this.usehref = attributes.usehref || ""; 65971 } 65972 65973 [_xfa_object.$getExtra]() { 65974 if (!this[_xfa_object.$extra]) { 65975 const parent = this[_xfa_object.$getParent](); 65976 65977 const root = this[_xfa_object.$getTemplateRoot](); 65978 65979 const target = root[_xfa_object.$searchNode](this.target, parent); 65980 65981 const leader = root[_xfa_object.$searchNode](this.leader, parent); 65982 65983 const trailer = root[_xfa_object.$searchNode](this.trailer, parent); 65984 65985 this[_xfa_object.$extra] = { 65986 target: target && target[0] || null, 65987 leader: leader && leader[0] || null, 65988 trailer: trailer && trailer[0] || null, 65989 addLeader: false, 65990 addTrailer: false 65991 }; 65992 } 65993 65994 return this[_xfa_object.$extra]; 65995 } 65996 65997} 65998 65999class PageArea extends _xfa_object.XFAObject { 66000 constructor(attributes) { 66001 super(TEMPLATE_NS_ID, "pageArea", true); 66002 this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]); 66003 this.id = attributes.id || ""; 66004 this.initialNumber = (0, _utils.getInteger)({ 66005 data: attributes.initialNumber, 66006 defaultValue: 1, 66007 validate: x => true 66008 }); 66009 this.name = attributes.name || ""; 66010 this.numbered = (0, _utils.getInteger)({ 66011 data: attributes.numbered, 66012 defaultValue: 1, 66013 validate: x => true 66014 }); 66015 this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]); 66016 this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]); 66017 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 66018 this.use = attributes.use || ""; 66019 this.usehref = attributes.usehref || ""; 66020 this.desc = null; 66021 this.extras = null; 66022 this.medium = null; 66023 this.occur = null; 66024 this.area = new _xfa_object.XFAObjectArray(); 66025 this.contentArea = new _xfa_object.XFAObjectArray(); 66026 this.draw = new _xfa_object.XFAObjectArray(); 66027 this.exclGroup = new _xfa_object.XFAObjectArray(); 66028 this.field = new _xfa_object.XFAObjectArray(); 66029 this.subform = new _xfa_object.XFAObjectArray(); 66030 } 66031 66032 [_xfa_object.$isUsable]() { 66033 if (!this[_xfa_object.$extra]) { 66034 this[_xfa_object.$extra] = { 66035 numberOfUse: 0 66036 }; 66037 return true; 66038 } 66039 66040 return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max; 66041 } 66042 66043 [_xfa_object.$cleanPage]() { 66044 delete this[_xfa_object.$extra]; 66045 } 66046 66047 [_xfa_object.$getNextPage]() { 66048 if (!this[_xfa_object.$extra]) { 66049 this[_xfa_object.$extra] = { 66050 numberOfUse: 0 66051 }; 66052 } 66053 66054 const parent = this[_xfa_object.$getParent](); 66055 66056 if (parent.relation === "orderedOccurrence") { 66057 if (this[_xfa_object.$isUsable]()) { 66058 this[_xfa_object.$extra].numberOfUse += 1; 66059 return this; 66060 } 66061 } 66062 66063 return parent[_xfa_object.$getNextPage](); 66064 } 66065 66066 [_xfa_object.$getAvailableSpace]() { 66067 return this[_xfa_object.$extra].space || { 66068 width: 0, 66069 height: 0 66070 }; 66071 } 66072 66073 [_xfa_object.$toHTML]() { 66074 if (!this[_xfa_object.$extra]) { 66075 this[_xfa_object.$extra] = { 66076 numberOfUse: 1 66077 }; 66078 } 66079 66080 const children = []; 66081 this[_xfa_object.$extra].children = children; 66082 const style = Object.create(null); 66083 66084 if (this.medium && this.medium.short && this.medium.long) { 66085 style.width = (0, _html_utils.measureToString)(this.medium.short); 66086 style.height = (0, _html_utils.measureToString)(this.medium.long); 66087 this[_xfa_object.$extra].space = { 66088 width: this.medium.short, 66089 height: this.medium.long 66090 }; 66091 66092 if (this.medium.orientation === "landscape") { 66093 const x = style.width; 66094 style.width = style.height; 66095 style.height = x; 66096 this[_xfa_object.$extra].space = { 66097 width: this.medium.long, 66098 height: this.medium.short 66099 }; 66100 } 66101 } else { 66102 (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug."); 66103 } 66104 66105 this[_xfa_object.$childrenToHTML]({ 66106 filter: new Set(["area", "draw", "field", "subform"]), 66107 include: true 66108 }); 66109 66110 this[_xfa_object.$childrenToHTML]({ 66111 filter: new Set(["contentArea"]), 66112 include: true 66113 }); 66114 66115 return _utils.HTMLResult.success({ 66116 name: "div", 66117 children, 66118 attributes: { 66119 class: ["xfaPage"], 66120 id: this[_xfa_object.$uid], 66121 style, 66122 xfaName: this.name 66123 } 66124 }); 66125 } 66126 66127} 66128 66129class PageSet extends _xfa_object.XFAObject { 66130 constructor(attributes) { 66131 super(TEMPLATE_NS_ID, "pageSet", true); 66132 this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]); 66133 this.id = attributes.id || ""; 66134 this.name = attributes.name || ""; 66135 this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]); 66136 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 66137 this.use = attributes.use || ""; 66138 this.usehref = attributes.usehref || ""; 66139 this.extras = null; 66140 this.occur = null; 66141 this.pageArea = new _xfa_object.XFAObjectArray(); 66142 this.pageSet = new _xfa_object.XFAObjectArray(); 66143 } 66144 66145 [_xfa_object.$cleanPage]() { 66146 for (const page of this.pageArea.children) { 66147 page[_xfa_object.$cleanPage](); 66148 } 66149 66150 for (const page of this.pageSet.children) { 66151 page[_xfa_object.$cleanPage](); 66152 } 66153 } 66154 66155 [_xfa_object.$isUsable]() { 66156 return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max; 66157 } 66158 66159 [_xfa_object.$getNextPage]() { 66160 if (!this[_xfa_object.$extra]) { 66161 this[_xfa_object.$extra] = { 66162 numberOfUse: 1, 66163 pageIndex: -1, 66164 pageSetIndex: -1 66165 }; 66166 } 66167 66168 if (this.relation === "orderedOccurrence") { 66169 if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) { 66170 this[_xfa_object.$extra].pageIndex += 1; 66171 const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex]; 66172 return pageArea[_xfa_object.$getNextPage](); 66173 } 66174 66175 if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) { 66176 this[_xfa_object.$extra].pageSetIndex += 1; 66177 return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage](); 66178 } 66179 66180 if (this[_xfa_object.$isUsable]()) { 66181 this[_xfa_object.$extra].numberOfUse += 1; 66182 this[_xfa_object.$extra].pageIndex = -1; 66183 this[_xfa_object.$extra].pageSetIndex = -1; 66184 return this[_xfa_object.$getNextPage](); 66185 } 66186 66187 const parent = this[_xfa_object.$getParent](); 66188 66189 if (parent instanceof PageSet) { 66190 return parent[_xfa_object.$getNextPage](); 66191 } 66192 66193 this[_xfa_object.$cleanPage](); 66194 66195 return this[_xfa_object.$getNextPage](); 66196 } 66197 66198 const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber; 66199 66200 const parity = pageNumber % 2 === 0 ? "even" : "odd"; 66201 const position = pageNumber === 0 ? "first" : "rest"; 66202 let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position); 66203 66204 if (page) { 66205 return page; 66206 } 66207 66208 page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position); 66209 66210 if (page) { 66211 return page; 66212 } 66213 66214 page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any"); 66215 66216 if (page) { 66217 return page; 66218 } 66219 66220 return this.pageArea.children[0]; 66221 } 66222 66223} 66224 66225class Para extends _xfa_object.XFAObject { 66226 constructor(attributes) { 66227 super(TEMPLATE_NS_ID, "para", true); 66228 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 66229 this.id = attributes.id || ""; 66230 this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : ""; 66231 this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : ""; 66232 this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : ""; 66233 this.orphans = (0, _utils.getInteger)({ 66234 data: attributes.orphans, 66235 defaultValue: 0, 66236 validate: x => x >= 0 66237 }); 66238 this.preserve = attributes.preserve || ""; 66239 this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : ""; 66240 this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : ""; 66241 this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : ""; 66242 this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : ""; 66243 this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x); 66244 this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : ""; 66245 this.use = attributes.use || ""; 66246 this.usehref = attributes.usehref || ""; 66247 this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]); 66248 this.widows = (0, _utils.getInteger)({ 66249 data: attributes.widows, 66250 defaultValue: 0, 66251 validate: x => x >= 0 66252 }); 66253 this.hyphenation = null; 66254 } 66255 66256 [_xfa_object.$toStyle]() { 66257 const style = (0, _html_utils.toStyle)(this, "hAlign"); 66258 66259 if (this.marginLeft !== "") { 66260 style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft); 66261 } 66262 66263 if (this.marginRight !== "") { 66264 style.paddingight = (0, _html_utils.measureToString)(this.marginRight); 66265 } 66266 66267 if (this.spaceAbove !== "") { 66268 style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove); 66269 } 66270 66271 if (this.spaceBelow !== "") { 66272 style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow); 66273 } 66274 66275 if (this.textIndent !== "") { 66276 style.textIndent = (0, _html_utils.measureToString)(this.textIndent); 66277 (0, _html_utils.fixTextIndent)(style); 66278 } 66279 66280 if (this.lineHeight > 0) { 66281 style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight); 66282 } 66283 66284 if (this.tabDefault !== "") { 66285 style.tabSize = (0, _html_utils.measureToString)(this.tabDefault); 66286 } 66287 66288 if (this.tabStops.length > 0) {} 66289 66290 if (this.hyphenatation) { 66291 Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]()); 66292 } 66293 66294 return style; 66295 } 66296 66297} 66298 66299class PasswordEdit extends _xfa_object.XFAObject { 66300 constructor(attributes) { 66301 super(TEMPLATE_NS_ID, "passwordEdit", true); 66302 this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); 66303 this.id = attributes.id || ""; 66304 this.passwordChar = attributes.passwordChar || "*"; 66305 this.use = attributes.use || ""; 66306 this.usehref = attributes.usehref || ""; 66307 this.border = null; 66308 this.extras = null; 66309 this.margin = null; 66310 } 66311 66312} 66313 66314class Pattern extends _xfa_object.XFAObject { 66315 constructor(attributes) { 66316 super(TEMPLATE_NS_ID, "pattern", true); 66317 this.id = attributes.id || ""; 66318 this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]); 66319 this.use = attributes.use || ""; 66320 this.usehref = attributes.usehref || ""; 66321 this.color = null; 66322 this.extras = null; 66323 } 66324 66325 [_xfa_object.$toStyle](startColor) { 66326 startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF"; 66327 const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000"; 66328 const width = 5; 66329 const cmd = "repeating-linear-gradient"; 66330 const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`; 66331 66332 switch (this.type) { 66333 case "crossHatch": 66334 return `${cmd}
66334(to top,${colors}) ${cmd}(to right,${colors})`; 66335 66336 case "crossDiagonal": 66337 return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`; 66338 66339 case "diagonalLeft": 66340 return `${cmd}(45deg,${colors})`; 66341 66342 case "diagonalRight": 66343 return `${cmd}(-45deg,${colors})`; 66344 66345 case "horizontal": 66346 return `${cmd}(to top,${colors})`; 66347 66348 case "vertical": 66349 return `${cmd}(to right,${colors})`; 66350 } 66351 66352 return ""; 66353 } 66354 66355} 66356 66357class Picture extends _xfa_object.StringObject { 66358 constructor(attributes) { 66359 super(TEMPLATE_NS_ID, "picture"); 66360 this.id = attributes.id || ""; 66361 this.use = attributes.use || ""; 66362 this.usehref = attributes.usehref || ""; 66363 } 66364 66365} 66366 66367class Proto extends _xfa_object.XFAObject { 66368 constructor(attributes) { 66369 super(TEMPLATE_NS_ID, "proto", true); 66370 this.appearanceFilter = new _xfa_object.XFAObjectArray(); 66371 this.arc = new _xfa_object.XFAObjectArray(); 66372 this.area = new _xfa_object.XFAObjectArray(); 66373 this.assist = new _xfa_object.XFAObjectArray(); 66374 this.barcode = new _xfa_object.XFAObjectArray(); 66375 this.bindItems = new _xfa_object.XFAObjectArray(); 66376 this.bookend = new _xfa_object.XFAObjectArray(); 66377 this.boolean = new _xfa_object.XFAObjectArray(); 66378 this.border = new _xfa_object.XFAObjectArray(); 66379 this.break = new _xfa_object.XFAObjectArray(); 66380 this.breakAfter = new _xfa_object.XFAObjectArray(); 66381 this.breakBefore = new _xfa_object.XFAObjectArray(); 66382 this.button = new _xfa_object.XFAObjectArray(); 66383 this.calculate = new _xfa_object.XFAObjectArray(); 66384 this.caption = new _xfa_object.XFAObjectArray(); 66385 this.certificate = new _xfa_object.XFAObjectArray(); 66386 this.certificates = new _xfa_object.XFAObjectArray(); 66387 this.checkButton = new _xfa_object.XFAObjectArray(); 66388 this.choiceList = new _xfa_object.XFAObjectArray(); 66389 this.color = new _xfa_object.XFAObjectArray(); 66390 this.comb = new _xfa_object.XFAObjectArray(); 66391 this.connect = new _xfa_object.XFAObjectArray(); 66392 this.contentArea = new _xfa_object.XFAObjectArray(); 66393 this.corner = new _xfa_object.XFAObjectArray(); 66394 this.date = new _xfa_object.XFAObjectArray(); 66395 this.dateTime = new _xfa_object.XFAObjectArray(); 66396 this.dateTimeEdit = new _xfa_object.XFAObjectArray(); 66397 this.decimal = new _xfa_object.XFAObjectArray(); 66398 this.defaultUi = new _xfa_object.XFAObjectArray(); 66399 this.desc = new _xfa_object.XFAObjectArray(); 66400 this.digestMethod = new _xfa_object.XFAObjectArray(); 66401 this.digestMethods = new _xfa_object.XFAObjectArray(); 66402 this.draw = new _xfa_object.XFAObjectArray(); 66403 this.edge = new _xfa_object.XFAObjectArray(); 66404 this.encoding = new _xfa_object.XFAObjectArray(); 66405 this.encodings = new _xfa_object.XFAObjectArray(); 66406 this.encrypt = new _xfa_object.XFAObjectArray(); 66407 this.encryptData = new _xfa_object.XFAObjectArray(); 66408 this.encryption = new _xfa_object.XFAObjectArray(); 66409 this.encryptionMethod = new _xfa_object.XFAObjectArray(); 66410 this.encryptionMethods = new _xfa_object.XFAObjectArray(); 66411 this.event = new _xfa_object.XFAObjectArray(); 66412 this.exData = new _xfa_object.XFAObjectArray(); 66413 this.exObject = new _xfa_object.XFAObjectArray(); 66414 this.exclGroup = new _xfa_object.XFAObjectArray(); 66415 this.execute = new _xfa_object.XFAObjectArray(); 66416 this.extras = new _xfa_object.XFAObjectArray(); 66417 this.field = new _xfa_object.XFAObjectArray(); 66418 this.fill = new _xfa_object.XFAObjectArray(); 66419 this.filter = new _xfa_object.XFAObjectArray(); 66420 this.float = new _xfa_object.XFAObjectArray(); 66421 this.font = new _xfa_object.XFAObjectArray(); 66422 this.format = new _xfa_object.XFAObjectArray(); 66423 this.handler = new _xfa_object.XFAObjectArray(); 66424 this.hyphenation = new _xfa_object.XFAObjectArray(); 66425 this.image = new _xfa_object.XFAObjectArray(); 66426 this.imageEdit = new _xfa_object.XFAObjectArray(); 66427 this.integer = new _xfa_object.XFAObjectArray(); 66428 this.issuers = new _xfa_object.XFAObjectArray(); 66429 this.items = new _xfa_object.XFAObjectArray(); 66430 this.keep = new _xfa_object.XFAObjectArray(); 66431 this.keyUsage = new _xfa_object.XFAObjectArray(); 66432 this.line = new _xfa_object.XFAObjectArray(); 66433 this.linear = new _xfa_object.XFAObjectArray(); 66434 this.lockDocument = new _xfa_object.XFAObjectArray(); 66435 this.manifest = new _xfa_object.XFAObjectArray(); 66436 this.margin = new _xfa_object.XFAObjectArray(); 66437 this.mdp = new _xfa_object.XFAObjectArray(); 66438 this.medium = new _xfa_object.XFAObjectArray(); 66439 this.message = new _xfa_object.XFAObjectArray(); 66440 this.numericEdit = new _xfa_object.XFAObjectArray(); 66441 this.occur = new _xfa_object.XFAObjectArray(); 66442 this.oid = new _xfa_object.XFAObjectArray(); 66443 this.oids = new _xfa_object.XFAObjectArray(); 66444 this.overflow = new _xfa_object.XFAObjectArray(); 66445 this.pageArea = new _xfa_object.XFAObjectArray(); 66446 this.pageSet = new _xfa_object.XFAObjectArray(); 66447 this.para = new _xfa_object.XFAObjectArray(); 66448 this.passwordEdit = new _xfa_object.XFAObjectArray(); 66449 this.pattern = new _xfa_object.XFAObjectArray(); 66450 this.picture = new _xfa_object.XFAObjectArray(); 66451 this.radial = new _xfa_object.XFAObjectArray(); 66452 this.reason = new _xfa_object.XFAObjectArray(); 66453 this.reasons = new _xfa_object.XFAObjectArray(); 66454 this.rectangle = new _xfa_object.XFAObjectArray(); 66455 this.ref = new _xfa_object.XFAObjectArray(); 66456 this.script = new _xfa_object.XFAObjectArray(); 66457 this.setProperty = new _xfa_object.XFAObjectArray(); 66458 this.signData = new _xfa_object.XFAObjectArray(); 66459 this.signature = new _xfa_object.XFAObjectArray(); 66460 this.signing = new _xfa_object.XFAObjectArray(); 66461 this.solid = new _xfa_object.XFAObjectArray(); 66462 this.speak = new _xfa_object.XFAObjectArray(); 66463 this.stipple = new _xfa_object.XFAObjectArray(); 66464 this.subform = new _xfa_object.XFAObjectArray(); 66465 this.subformSet = new _xfa_object.XFAObjectArray(); 66466 this.subjectDN = new _xfa_object.XFAObjectArray(); 66467 this.subjectDNs = new _xfa_object.XFAObjectArray(); 66468 this.submit = new _xfa_object.XFAObjectArray(); 66469 this.text = new _xfa_object.XFAObjectArray(); 66470 this.textEdit = new _xfa_object.XFAObjectArray(); 66471 this.time = new _xfa_object.XFAObjectArray(); 66472 this.timeStamp = new _xfa_object.XFAObjectArray(); 66473 this.toolTip = new _xfa_object.XFAObjectArray(); 66474 this.traversal = new _xfa_object.XFAObjectArray(); 66475 this.traverse = new _xfa_object.XFAObjectArray(); 66476 this.ui = new _xfa_object.XFAObjectArray(); 66477 this.validate = new _xfa_object.XFAObjectArray(); 66478 this.value = new _xfa_object.XFAObjectArray(); 66479 this.variables = new _xfa_object.XFAObjectArray(); 66480 } 66481 66482} 66483 66484class Radial extends _xfa_object.XFAObject { 66485 constructor(attributes) { 66486 super(TEMPLATE_NS_ID, "radial", true); 66487 this.id = attributes.id || ""; 66488 this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]); 66489 this.use = attributes.use || ""; 66490 this.usehref = attributes.usehref || ""; 66491 this.color = null; 66492 this.extras = null; 66493 } 66494 66495 [_xfa_object.$toStyle](startColor) { 66496 startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF"; 66497 const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000"; 66498 const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`; 66499 return `radial-gradient(circle at center, ${colors})`; 66500 } 66501 66502} 66503 66504class Reason extends _xfa_object.StringObject { 66505 constructor(attributes) { 66506 super(TEMPLATE_NS_ID, "reason"); 66507 this.id = attributes.id || ""; 66508 this.name = attributes.name || ""; 66509 this.use = attributes.use || ""; 66510 this.usehref = attributes.usehref || ""; 66511 } 66512 66513} 66514 66515class Reasons extends _xfa_object.XFAObject { 66516 constructor(attributes) { 66517 super(TEMPLATE_NS_ID, "reasons", true); 66518 this.id = attributes.id || ""; 66519 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 66520 this.use = attributes.use || ""; 66521 this.usehref = attributes.usehref || ""; 66522 this.reason = new _xfa_object.XFAObjectArray(); 66523 } 66524 66525} 66526 66527class Rectangle extends _xfa_object.XFAObject { 66528 constructor(attributes) { 66529 super(TEMPLATE_NS_ID, "rectangle", true); 66530 this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]); 66531 this.id = attributes.id || ""; 66532 this.use = attributes.use || ""; 66533 this.usehref = attributes.usehref || ""; 66534 this.corner = new _xfa_object.XFAObjectArray(4); 66535 this.edge = new _xfa_object.XFAObjectArray(4); 66536 this.fill = null; 66537 } 66538 66539 [_xfa_object.$toHTML]() { 66540 const edge = this.edge.children.length ? this.edge.children[0] : new Edge({}); 66541 66542 const edgeStyle = edge[_xfa_object.$toStyle](); 66543 66544 const style = Object.create(null); 66545 66546 if (this.fill && this.fill.presence === "visible") { 66547 Object.assign(style, this.fill[_xfa_object.$toStyle]()); 66548 } else { 66549 style.fill = "transparent";
vendor: 130,957 bytes, lines 66550-72012
66550 } 66551 66552 style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0); 66553 style.stroke = edgeStyle.color; 66554 const corner = this.corner.children.length ? this.corner.children[0] : new Corner({}); 66555 66556 const cornerStyle = corner[_xfa_object.$toStyle](); 66557 66558 const rect = { 66559 name: "rect", 66560 attributes: { 66561 xmlns: SVG_NS, 66562 width: "100%", 66563 height: "100%", 66564 x: 0, 66565 y: 0, 66566 rx: cornerStyle.radius, 66567 ry: cornerStyle.radius, 66568 style 66569 } 66570 }; 66571 const svg = { 66572 name: "svg", 66573 children: [rect], 66574 attributes: { 66575 xmlns: SVG_NS, 66576 style: { 66577 overflow: "visible" 66578 }, 66579 width: "100%", 66580 height: "100%" 66581 } 66582 }; 66583 66584 const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 66585 66586 if (hasMargin(parent)) { 66587 return _utils.HTMLResult.success({ 66588 name: "div", 66589 attributes: { 66590 style: { 66591 display: "inline", 66592 width: "100%", 66593 height: "100%" 66594 } 66595 }, 66596 children: [svg] 66597 }); 66598 } 66599 66600 svg.attributes.style.position = "absolute"; 66601 return _utils.HTMLResult.success(svg); 66602 } 66603 66604} 66605 66606class RefElement extends _xfa_object.StringObject { 66607 constructor(attributes) { 66608 super(TEMPLATE_NS_ID, "ref"); 66609 this.id = attributes.id || ""; 66610 this.use = attributes.use || ""; 66611 this.usehref = attributes.usehref || ""; 66612 } 66613 66614} 66615 66616class Script extends _xfa_object.StringObject { 66617 constructor(attributes) { 66618 super(TEMPLATE_NS_ID, "script"); 66619 this.binding = attributes.binding || ""; 66620 this.contentType = attributes.contentType || ""; 66621 this.id = attributes.id || ""; 66622 this.name = attributes.name || ""; 66623 this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]); 66624 this.use = attributes.use || ""; 66625 this.usehref = attributes.usehref || ""; 66626 } 66627 66628} 66629 66630class SetProperty extends _xfa_object.XFAObject { 66631 constructor(attributes) { 66632 super(TEMPLATE_NS_ID, "setProperty"); 66633 this.connection = attributes.connection || ""; 66634 this.ref = attributes.ref || ""; 66635 this.target = attributes.target || ""; 66636 } 66637 66638} 66639 66640exports.SetProperty = SetProperty; 66641 66642class SignData extends _xfa_object.XFAObject { 66643 constructor(attributes) { 66644 super(TEMPLATE_NS_ID, "signData", true); 66645 this.id = attributes.id || ""; 66646 this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]); 66647 this.ref = attributes.ref || ""; 66648 this.target = attributes.target || ""; 66649 this.use = attributes.use || ""; 66650 this.usehref = attributes.usehref || ""; 66651 this.filter = null; 66652 this.manifest = null; 66653 } 66654 66655} 66656 66657class Signature extends _xfa_object.XFAObject { 66658 constructor(attributes) { 66659 super(TEMPLATE_NS_ID, "signature", true); 66660 this.id = attributes.id || ""; 66661 this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]); 66662 this.use = attributes.use || ""; 66663 this.usehref = attributes.usehref || ""; 66664 this.border = null; 66665 this.extras = null; 66666 this.filter = null; 66667 this.manifest = null; 66668 this.margin = null; 66669 } 66670 66671} 66672 66673class Signing extends _xfa_object.XFAObject { 66674 constructor(attributes) { 66675 super(TEMPLATE_NS_ID, "signing", true); 66676 this.id = attributes.id || ""; 66677 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 66678 this.use = attributes.use || ""; 66679 this.usehref = attributes.usehref || ""; 66680 this.certificate = new _xfa_object.XFAObjectArray(); 66681 } 66682 66683} 66684 66685class Solid extends _xfa_object.XFAObject { 66686 constructor(attributes) { 66687 super(TEMPLATE_NS_ID, "solid", true); 66688 this.id = attributes.id || ""; 66689 this.use = attributes.use || ""; 66690 this.usehref = attributes.usehref || ""; 66691 this.extras = null; 66692 } 66693 66694 [_xfa_object.$toStyle](startColor) { 66695 return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF"; 66696 } 66697 66698} 66699 66700class Speak extends _xfa_object.StringObject { 66701 constructor(attributes) { 66702 super(TEMPLATE_NS_ID, "speak"); 66703 this.disable = (0, _utils.getInteger)({ 66704 data: attributes.disable, 66705 defaultValue: 0, 66706 validate: x => x === 1 66707 }); 66708 this.id = attributes.id || ""; 66709 this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]); 66710 this.rid = attributes.rid || ""; 66711 this.use = attributes.use || ""; 66712 this.usehref = attributes.usehref || ""; 66713 } 66714 66715} 66716 66717class Stipple extends _xfa_object.XFAObject { 66718 constructor(attributes) { 66719 super(TEMPLATE_NS_ID, "stipple", true); 66720 this.id = attributes.id || ""; 66721 this.rate = (0, _utils.getInteger)({ 66722 data: attributes.rate, 66723 defaultValue: 50, 66724 validate: x => x >= 0 && x <= 100 66725 }); 66726 this.use = attributes.use || ""; 66727 this.usehref = attributes.usehref || ""; 66728 this.color = null; 66729 this.extras = null; 66730 } 66731 66732 [_xfa_object.$toStyle](bgColor) { 66733 const alpha = this.rate / 100; 66734 return _util.Util.makeHexColor(Math.round(bgColor.value.r * (1 - alpha) + this.value.r * alpha), Math.round(bgColor.value.g * (1 - alpha) + this.value.g * alpha), Math.round(bgColor.value.b * (1 - alpha) + this.value.b * alpha)); 66735 } 66736 66737} 66738 66739class Subform extends _xfa_object.XFAObject { 66740 constructor(attributes) { 66741 super(TEMPLATE_NS_ID, "subform", true); 66742 this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]); 66743 this.allowMacro = (0, _utils.getInteger)({ 66744 data: attributes.allowMacro, 66745 defaultValue: 0, 66746 validate: x => x === 1 66747 }); 66748 this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 66749 this.colSpan = (0, _utils.getInteger)({ 66750 data: attributes.colSpan, 66751 defaultValue: 1, 66752 validate: n => n >= 1 || n === -1 66753 }); 66754 this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x)); 66755 this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : ""; 66756 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 66757 this.id = attributes.id || ""; 66758 this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]); 66759 this.locale = attributes.locale || ""; 66760 this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt"); 66761 this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt"); 66762 this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]); 66763 this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt"); 66764 this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt"); 66765 this.name = attributes.name || ""; 66766 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 66767 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 66768 this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]); 66769 this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]); 66770 this.use = attributes.use || ""; 66771 this.usehref = attributes.usehref || ""; 66772 this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : ""; 66773 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 66774 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 66775 this.assist = null; 66776 this.bind = null; 66777 this.bookend = null; 66778 this.border = null; 66779 this.break = null; 66780 this.calculate = null; 66781 this.desc = null; 66782 this.extras = null; 66783 this.keep = null; 66784 this.margin = null; 66785 this.occur = null; 66786 this.overflow = null; 66787 this.pageSet = null; 66788 this.para = null; 66789 this.traversal = null; 66790 this.validate = null; 66791 this.variables = null; 66792 this.area = new _xfa_object.XFAObjectArray(); 66793 this.breakAfter = new _xfa_object.XFAObjectArray(); 66794 this.breakBefore = new _xfa_object.XFAObjectArray(); 66795 this.connect = new _xfa_object.XFAObjectArray(); 66796 this.draw = new _xfa_object.XFAObjectArray(); 66797 this.event = new _xfa_object.XFAObjectArray(); 66798 this.exObject = new _xfa_object.XFAObjectArray(); 66799 this.exclGroup = new _xfa_object.XFAObjectArray(); 66800 this.field = new _xfa_object.XFAObjectArray(); 66801 this.proto = new _xfa_object.XFAObjectArray(); 66802 this.setProperty = new _xfa_object.XFAObjectArray(); 66803 this.subform = new _xfa_object.XFAObjectArray(); 66804 this.subformSet = new _xfa_object.XFAObjectArray(); 66805 } 66806 66807 [_xfa_object.$getSubformParent]() { 66808 const parent = this[_xfa_object.$getParent](); 66809 66810 if (parent instanceof SubformSet) { 66811 return parent[_xfa_object.$getSubformParent](); 66812 } 66813 66814 return parent; 66815 } 66816 66817 [_xfa_object.$isBindable]() { 66818 return true; 66819 } 66820 66821 [_xfa_object.$isThereMoreWidth]() { 66822 return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth](); 66823 } 66824 66825 *[_xfa_object.$getContainedChildren]() { 66826 yield* getContainedChildren(this); 66827 } 66828 66829 [_xfa_object.$flushHTML]() { 66830 return (0, _layout.flushHTML)(this); 66831 } 66832 66833 [_xfa_object.$addHTML](html, bbox) { 66834 (0, _layout.addHTML)(this, html, bbox); 66835 } 66836 66837 [_xfa_object.$getAvailableSpace]() { 66838 return (0, _layout.getAvailableSpace)(this); 66839 } 66840 66841 [_xfa_object.$isSplittable]() { 66842 const parent = this[_xfa_object.$getSubformParent](); 66843 66844 if (!parent[_xfa_object.$isSplittable]()) { 66845 return false; 66846 } 66847 66848 if (this[_xfa_object.$extra]._isSplittable !== undefined) { 66849 return this[_xfa_object.$extra]._isSplittable; 66850 } 66851 66852 if (this.layout === "position" || this.layout.includes("row")) { 66853 this[_xfa_object.$extra]._isSplittable = false; 66854 return false; 66855 } 66856 66857 if (this.keep && this.keep.intact !== "none") { 66858 this[_xfa_object.$extra]._isSplittable = false; 66859 return false; 66860 } 66861 66862 if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) { 66863 return false; 66864 } 66865 66866 this[_xfa_object.$extra]._isSplittable = true; 66867 return true; 66868 } 66869 66870 [_xfa_object.$toHTML](availableSpace) { 66871 setTabIndex(this); 66872 66873 if (this.break) { 66874 if (this.break.after !== "auto" || this.break.afterTarget !== "") { 66875 const node = new BreakAfter({ 66876 targetType: this.break.after, 66877 target: this.break.afterTarget, 66878 startNew: this.break.startNew.toString() 66879 }); 66880 node[_xfa_object.$globalData] = this[_xfa_object.$globalData]; 66881 66882 this[_xfa_object.$appendChild](node); 66883 66884 this.breakAfter.push(node); 66885 } 66886 66887 if (this.break.before !== "auto" || this.break.beforeTarget !== "") { 66888 const node = new BreakBefore({ 66889 targetType: this.break.before, 66890 target: this.break.beforeTarget, 66891 startNew: this.break.startNew.toString() 66892 }); 66893 node[_xfa_object.$globalData] = this[_xfa_object.$globalData]; 66894 66895 this[_xfa_object.$appendChild](node); 66896 66897 this.breakBefore.push(node); 66898 } 66899 66900 if (this.break.overflowTarget !== "") { 66901 const node = new Overflow({ 66902 target: this.break.overflowTarget, 66903 leader: this.break.overflowLeader, 66904 trailer: this.break.overflowTrailer 66905 }); 66906 node[_xfa_object.$globalData] = this[_xfa_object.$globalData]; 66907 66908 this[_xfa_object.$appendChild](node); 66909 66910 this.overflow.push(node); 66911 } 66912 66913 this[_xfa_object.$removeChild](this.break); 66914 66915 this.break = null; 66916 } 66917 66918 if (this.presence === "hidden" || this.presence === "inactive") { 66919 return _utils.HTMLResult.EMPTY; 66920 } 66921 66922 if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) { 66923 (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug."); 66924 } 66925 66926 if (this.breakBefore.children.length >= 1) { 66927 const breakBefore = this.breakBefore.children[0]; 66928 66929 if (handleBreak(breakBefore)) { 66930 return _utils.HTMLResult.breakNode(breakBefore); 66931 } 66932 } 66933 66934 if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) { 66935 return _utils.HTMLResult.EMPTY; 66936 } 66937 66938 (0, _html_utils.fixDimensions)(this); 66939 const children = []; 66940 const attributes = { 66941 id: this[_xfa_object.$uid], 66942 class: [] 66943 }; 66944 (0, _html_utils.setAccess)(this, attributes.class); 66945 66946 if (!this[_xfa_object.$extra]) { 66947 this[_xfa_object.$extra] = Object.create(null); 66948 } 66949 66950 Object.assign(this[_xfa_object.$extra], { 66951 children, 66952 line: null, 66953 attributes, 66954 attempt: 0, 66955 numberInLine: 0, 66956 availableSpace: { 66957 width: Math.min(this.w || Infinity, availableSpace.width), 66958 height: Math.min(this.h || Infinity, availableSpace.height) 66959 }, 66960 width: 0, 66961 height: 0, 66962 prevHeight: 0, 66963 currentWidth: 0 66964 }); 66965 66966 const root = this[_xfa_object.$getTemplateRoot](); 66967 66968 const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure; 66969 66970 const isSplittable = this[_xfa_object.$isSplittable](); 66971 66972 if (!isSplittable) { 66973 setFirstUnsplittable(this); 66974 } 66975 66976 if (!(0, _layout.checkDimensions)(this, availableSpace)) { 66977 return _utils.HTMLResult.FAILURE; 66978 } 66979 66980 const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]); 66981 66982 if (this.layout.includes("row")) { 66983 const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths; 66984 66985 if (Array.isArray(columnWidths) && columnWidths.length > 0) { 66986 this[_xfa_object.$extra].columnWidths = columnWidths; 66987 this[_xfa_object.$extra].currentColumn = 0; 66988 } 66989 } 66990 66991 const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign"); 66992 const classNames = ["xfaSubform"]; 66993 const cl = (0, _html_utils.layoutClass)(this); 66994 66995 if (cl) { 66996 classNames.push(cl); 66997 } 66998 66999 attributes.style = style; 67000 attributes.class = classNames; 67001 67002 if (this.name) { 67003 attributes.xfaName = this.name; 67004 } 67005 67006 if (this.overflow) { 67007 const overflowExtra = this.overflow[_xfa_object.$getExtra](); 67008 67009 if (overflowExtra.addLeader) { 67010 overflowExtra.addLeader = false; 67011 handleOverflow(this, overflowExtra.leader, availableSpace); 67012 } 67013 } 67014 67015 this[_xfa_object.$pushPara](); 67016 67017 const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb"; 67018 const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1; 67019 67020 for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) { 67021 if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) { 67022 this[_xfa_object.$extra].numberInLine = 0; 67023 } 67024 67025 const result = this[_xfa_object.$childrenToHTML]({ 67026 filter, 67027 include: true 67028 }); 67029 67030 if (result.success) { 67031 break; 67032 } 67033 67034 if (result.isBreak()) { 67035 this[_xfa_object.$popPara](); 67036 67037 return result; 67038 } 67039 67040 if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) { 67041 this[_xfa_object.$extra].attempt = maxRun; 67042 break; 67043 } 67044 } 67045 67046 this[_xfa_object.$popPara](); 67047 67048 if (!isSplittable) { 67049 unsetFirstUnsplittable(this); 67050 } 67051 67052 root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure; 67053 67054 if (this[_xfa_object.$extra].attempt === maxRun) { 67055 if (this.overflow) { 67056 this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow; 67057 } 67058 67059 if (!isSplittable) { 67060 delete this[_xfa_object.$extra]; 67061 } 67062 67063 return _utils.HTMLResult.FAILURE; 67064 } 67065 67066 if (this.overflow) { 67067 const overflowExtra = this.overflow[_xfa_object.$getExtra](); 67068 67069 if (overflowExtra.addTrailer) { 67070 overflowExtra.addTrailer = false; 67071 handleOverflow(this, overflowExtra.trailer, availableSpace); 67072 } 67073 } 67074 67075 let marginH = 0; 67076 let marginV = 0; 67077 67078 if (this.margin) { 67079 marginH = this.margin.leftInset + this.margin.rightInset; 67080 marginV = this.margin.topInset + this.margin.bottomInset; 67081 } 67082 67083 const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0); 67084 const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0); 67085 const bbox = [this.x, this.y, width, height]; 67086 67087 if (this.w === "") { 67088 style.width = (0, _html_utils.measureToString)(width); 67089 } 67090 67091 if (this.h === "") { 67092 style.height = (0, _html_utils.measureToString)(height); 67093 } 67094 67095 if ((style.width === "0px" || style.height === "0px") && children.length === 0) { 67096 return _utils.HTMLResult.EMPTY; 67097 } 67098 67099 const html = { 67100 name: "div", 67101 attributes, 67102 children 67103 }; 67104 applyAssist(this, attributes); 67105 67106 const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 67107 67108 if (this.breakAfter.children.length >= 1) { 67109 const breakAfter = this.breakAfter.children[0]; 67110 67111 if (handleBreak(breakAfter)) { 67112 this[_xfa_object.$extra].afterBreakAfter = result; 67113 return _utils.HTMLResult.breakNode(breakAfter); 67114 } 67115 } 67116 67117 delete this[_xfa_object.$extra]; 67118 return result; 67119 } 67120 67121} 67122 67123class SubformSet extends _xfa_object.XFAObject { 67124 constructor(attributes) { 67125 super(TEMPLATE_NS_ID, "subformSet", true); 67126 this.id = attributes.id || ""; 67127 this.name = attributes.name || ""; 67128 this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]); 67129 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 67130 this.use = attributes.use || ""; 67131 this.usehref = attributes.usehref || ""; 67132 this.bookend = null; 67133 this.break = null; 67134 this.desc = null; 67135 this.extras = null; 67136 this.occur = null; 67137 this.overflow = null; 67138 this.breakAfter = new _xfa_object.XFAObjectArray(); 67139 this.breakBefore = new _xfa_object.XFAObjectArray(); 67140 this.subform = new _xfa_object.XFAObjectArray(); 67141 this.subformSet = new _xfa_object.XFAObjectArray(); 67142 } 67143 67144 *[_xfa_object.$getContainedChildren]() { 67145 yield* getContainedChildren(this); 67146 } 67147 67148 [_xfa_object.$getSubformParent]() { 67149 let parent = this[_xfa_object.$getParent](); 67150 67151 while (!(parent instanceof Subform)) { 67152 parent = parent[_xfa_object.$getParent](); 67153 } 67154 67155 return parent; 67156 } 67157 67158 [_xfa_object.$isBindable]() { 67159 return true; 67160 } 67161 67162} 67163 67164class SubjectDN extends _xfa_object.ContentObject { 67165 constructor(attributes) { 67166 super(TEMPLATE_NS_ID, "subjectDN"); 67167 this.delimiter = attributes.delimiter || ","; 67168 this.id = attributes.id || ""; 67169 this.name = attributes.name || ""; 67170 this.use = attributes.use || ""; 67171 this.usehref = attributes.usehref || ""; 67172 } 67173 67174 [_xfa_object.$finalize]() { 67175 this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => { 67176 kv = kv.split("=", 2); 67177 kv[0] = kv[0].trim(); 67178 return kv; 67179 })); 67180 } 67181 67182} 67183 67184class SubjectDNs extends _xfa_object.XFAObject { 67185 constructor(attributes) { 67186 super(TEMPLATE_NS_ID, "subjectDNs", true); 67187 this.id = attributes.id || ""; 67188 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 67189 this.use = attributes.use || ""; 67190 this.usehref = attributes.usehref || ""; 67191 this.subjectDN = new _xfa_object.XFAObjectArray(); 67192 } 67193 67194} 67195 67196class Submit extends _xfa_object.XFAObject { 67197 constructor(attributes) { 67198 super(TEMPLATE_NS_ID, "submit", true); 67199 this.embedPDF = (0, _utils.getInteger)({ 67200 data: attributes.embedPDF, 67201 defaultValue: 0, 67202 validate: x => x === 1 67203 }); 67204 this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]); 67205 this.id = attributes.id || ""; 67206 this.target = attributes.target || ""; 67207 this.textEncoding = (0, _utils.getKeyword)({ 67208 data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "", 67209 defaultValue: "", 67210 validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-\d{2}/) 67211 }); 67212 this.use = attributes.use || ""; 67213 this.usehref = attributes.usehref || ""; 67214 this.xdpContent = attributes.xdpContent || ""; 67215 this.encrypt = null; 67216 this.encryptData = new _xfa_object.XFAObjectArray(); 67217 this.signData = new _xfa_object.XFAObjectArray(); 67218 } 67219 67220} 67221 67222class Template extends _xfa_object.XFAObject { 67223 constructor(attributes) { 67224 super(TEMPLATE_NS_ID, "template", true); 67225 this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]); 67226 this.extras = null; 67227 this.subform = new _xfa_object.XFAObjectArray(); 67228 } 67229 67230 [_xfa_object.$finalize]() { 67231 if (this.subform.children.length === 0) { 67232 (0, _util.warn)("XFA - No subforms in template node."); 67233 } 67234 67235 if (this.subform.children.length >= 2) { 67236 (0, _util.warn)("XFA - Several subforms in template node: please file a bug."); 67237 } 67238 67239 this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX; 67240 } 67241 67242 [_xfa_object.$isSplittable]() { 67243 return true; 67244 } 67245 67246 [_xfa_object.$searchNode](expr, container) { 67247 if (expr.startsWith("#")) { 67248 return [this[_xfa_object.$ids].get(expr.slice(1))]; 67249 } 67250 67251 return (0, _som.searchNode)(this, container, expr, true, true); 67252 } 67253 67254 *[_xfa_object.$toPages]() { 67255 if (!this.subform.children.length) { 67256 return _utils.HTMLResult.success({ 67257 name: "div", 67258 children: [] 67259 }); 67260 } 67261 67262 this[_xfa_object.$extra] = { 67263 overflowNode: null, 67264 firstUnsplittable: null, 67265 currentContentArea: null, 67266 currentPageArea: null, 67267 noLayoutFailure: false, 67268 pageNumber: 1, 67269 pagePosition: "first", 67270 oddOrEven: "odd", 67271 blankOrNotBlank: "nonBlank", 67272 paraStack: [] 67273 }; 67274 const root = this.subform.children[0]; 67275 67276 root.pageSet[_xfa_object.$cleanPage](); 67277 67278 const pageAreas = root.pageSet.pageArea.children; 67279 const mainHtml = { 67280 name: "div", 67281 children: [] 67282 }; 67283 let pageArea = null; 67284 let breakBefore = null; 67285 let breakBeforeTarget = null; 67286 67287 if (root.breakBefore.children.length >= 1) { 67288 breakBefore = root.breakBefore.children[0]; 67289 breakBeforeTarget = breakBefore.target; 67290 } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) { 67291 breakBefore = root.subform.children[0].breakBefore.children[0]; 67292 breakBeforeTarget = breakBefore.target; 67293 } else if (root.break && root.break.beforeTarget) { 67294 breakBefore = root.break; 67295 breakBeforeTarget = breakBefore.beforeTarget; 67296 } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) { 67297 breakBefore = root.subform.children[0].break; 67298 breakBeforeTarget = breakBefore.beforeTarget; 67299 } 67300 67301 if (breakBefore) { 67302 const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]()); 67303 67304 if (target instanceof PageArea) { 67305 pageArea = target; 67306 breakBefore[_xfa_object.$extra] = {}; 67307 } 67308 } 67309 67310 if (!pageArea) { 67311 pageArea = pageAreas[0]; 67312 } 67313 67314 pageArea[_xfa_object.$extra] = { 67315 numberOfUse: 1 67316 }; 67317 67318 const pageAreaParent = pageArea[_xfa_object.$getParent](); 67319 67320 pageAreaParent[_xfa_object.$extra] = { 67321 numberOfUse: 1, 67322 pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea), 67323 pageSetIndex: 0 67324 }; 67325 let targetPageArea; 67326 let leader = null; 67327 let trailer = null; 67328 let hasSomething = true; 67329 let hasSomethingCounter = 0; 67330 let startIndex = 0; 67331 67332 while (true) { 67333 if (!hasSomething) { 67334 mainHtml.children.pop(); 67335 67336 if (++hasSomethingCounter === MAX_EMPTY_PAGES) { 67337 (0, _util.warn)("XFA - Something goes wrong: please file a bug."); 67338 return mainHtml; 67339 } 67340 } else { 67341 hasSomethingCounter = 0; 67342 } 67343 67344 targetPageArea = null; 67345 this[_xfa_object.$extra].currentPageArea = pageArea; 67346 67347 const page = pageArea[_xfa_object.$toHTML]().html; 67348 67349 mainHtml.children.push(page); 67350 67351 if (leader) { 67352 this[_xfa_object.$extra].noLayoutFailure = true; 67353 page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html); 67354 leader = null; 67355 } 67356 67357 if (trailer) { 67358 this[_xfa_object.$extra].noLayoutFailure = true; 67359 page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html); 67360 trailer = null; 67361 } 67362 67363 const contentAreas = pageArea.contentArea.children; 67364 const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea")); 67365 hasSomething = false; 67366 this[_xfa_object.$extra].firstUnsplittable = null; 67367 this[_xfa_object.$extra].noLayoutFailure = false; 67368 67369 const flush = index => { 67370 const html = root[_xfa_object.$flushHTML](); 67371 67372 if (html) { 67373 hasSomething = hasSomething || html.children && html.children.length !== 0; 67374 htmlContentAreas[index].children.push(html); 67375 } 67376 }; 67377 67378 for (let i = startIndex, ii = contentAreas.length; i < ii; i++) { 67379 const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i]; 67380 const space = { 67381 width: contentArea.w, 67382 height: contentArea.h 67383 }; 67384 startIndex = 0; 67385 67386 if (leader) { 67387 htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html); 67388 leader = null; 67389 } 67390 67391 if (trailer) { 67392 htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html); 67393 trailer = null; 67394 } 67395 67396 const html = root[_xfa_object.$toHTML](space); 67397 67398 if (html.success) { 67399 if (html.html) { 67400 hasSomething = hasSomething || html.html.children && html.html.children.length !== 0; 67401 htmlContentAreas[i].children.push(html.html); 67402 } else if (!hasSomething && mainHtml.children.length > 1) { 67403 mainHtml.children.pop(); 67404 } 67405 67406 return mainHtml; 67407 } 67408 67409 if (html.isBreak()) { 67410 const node = html.breakNode; 67411 flush(i); 67412 67413 if (node.targetType === "auto") { 67414 continue; 67415 } 67416 67417 if (node.leader) { 67418 leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]()); 67419 leader = leader ? leader[0] : null; 67420 } 67421 67422 if (node.trailer) { 67423 trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]()); 67424 trailer = trailer ? trailer[0] : null; 67425 } 67426 67427 if (node.targetType === "pageArea") { 67428 targetPageArea = node[_xfa_object.$extra].target; 67429 i = Infinity; 67430 } else if (!node[_xfa_object.$extra].target) { 67431 i = node[_xfa_object.$extra].index; 67432 } else { 67433 targetPageArea = node[_xfa_object.$extra].target; 67434 startIndex = node[_xfa_object.$extra].index + 1; 67435 i = Infinity; 67436 } 67437 67438 continue; 67439 } 67440 67441 if (this[_xfa_object.$extra].overflowNode) { 67442 const node = this[_xfa_object.$extra].overflowNode; 67443 this[_xfa_object.$extra].overflowNode = null; 67444 67445 const overflowExtra = node[_xfa_object.$getExtra](); 67446 67447 const target = overflowExtra.target; 67448 overflowExtra.addLeader = overflowExtra.leader !== null; 67449 overflowExtra.addTrailer = overflowExtra.trailer !== null; 67450 flush(i); 67451 const currentIndex = i; 67452 i = Infinity; 67453 67454 if (target instanceof PageArea) { 67455 targetPageArea = target; 67456 } else if (target instanceof ContentArea) { 67457 const index = contentAreas.indexOf(target); 67458 67459 if (index !== -1) { 67460 if (index > currentIndex) { 67461 i = index - 1; 67462 } else { 67463 startIndex = index; 67464 } 67465 } else { 67466 targetPageArea = target[_xfa_object.$getParent](); 67467 startIndex = targetPageArea.contentArea.children.indexOf(target); 67468 } 67469 } 67470 67471 continue; 67472 } 67473 67474 flush(i); 67475 } 67476 67477 this[_xfa_object.$extra].pageNumber += 1; 67478 67479 if (targetPageArea) { 67480 if (targetPageArea[_xfa_object.$isUsable]()) { 67481 targetPageArea[_xfa_object.$extra].numberOfUse += 1; 67482 } else { 67483 targetPageArea = null; 67484 } 67485 } 67486 67487 pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage](); 67488 yield null; 67489 } 67490 } 67491 67492} 67493 67494exports.Template = Template; 67495 67496class Text extends _xfa_object.ContentObject { 67497 constructor(attributes) { 67498 super(TEMPLATE_NS_ID, "text"); 67499 this.id = attributes.id || ""; 67500 this.maxChars = (0, _utils.getInteger)({ 67501 data: attributes.maxChars, 67502 defaultValue: 0, 67503 validate: x => x >= 0 67504 }); 67505 this.name = attributes.name || ""; 67506 this.rid = attributes.rid || ""; 67507 this.use = attributes.use || ""; 67508 this.usehref = attributes.usehref || ""; 67509 } 67510 67511 [_xfa_object.$acceptWhitespace]() { 67512 return true; 67513 } 67514 67515 [_xfa_object.$onChild](child) { 67516 if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) { 67517 this[_xfa_object.$content] = child; 67518 return true; 67519 } 67520 67521 (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`); 67522 return false; 67523 } 67524 67525 [_xfa_object.$onText](str) { 67526 if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) { 67527 return; 67528 } 67529 67530 super[_xfa_object.$onText](str); 67531 } 67532 67533 [_xfa_object.$finalize]() { 67534 if (typeof this[_xfa_object.$content] === "string") { 67535 this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n"); 67536 } 67537 } 67538 67539 [_xfa_object.$getExtra]() { 67540 if (typeof this[_xfa_object.$content] === "string") { 67541 return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => { 67542 if (line) { 67543 acc.push(line); 67544 } 67545 67546 return acc; 67547 }, []).join("\n"); 67548 } 67549 67550 return this[_xfa_object.$content][_xfa_object.$text](); 67551 } 67552 67553 [_xfa_object.$toHTML](availableSpace) { 67554 if (typeof this[_xfa_object.$content] === "string") { 67555 const html = valueToHtml(this[_xfa_object.$content]).html; 67556 67557 if (this[_xfa_object.$content].includes("\u2029")) { 67558 html.name = "div"; 67559 html.children = []; 67560 67561 this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => { 67562 acc.push({ 67563 name: "span", 67564 value: line 67565 }, { 67566 name: "br" 67567 }); 67568 return acc; 67569 }, [])).forEach(lines => { 67570 html.children.push({ 67571 name: "p", 67572 children: lines 67573 }); 67574 }); 67575 } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) { 67576 html.name = "div"; 67577 html.children = []; 67578 67579 this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => { 67580 html.children.push({ 67581 name: "span", 67582 value: line 67583 }, { 67584 name: "br" 67585 }); 67586 }); 67587 } 67588 67589 return _utils.HTMLResult.success(html); 67590 } 67591 67592 return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace); 67593 } 67594 67595} 67596 67597exports.Text = Text; 67598 67599class TextEdit extends _xfa_object.XFAObject { 67600 constructor(attributes) { 67601 super(TEMPLATE_NS_ID, "textEdit", true); 67602 this.allowRichText = (0, _utils.getInteger)({ 67603 data: attributes.allowRichText, 67604 defaultValue: 0, 67605 validate: x => x === 1 67606 }); 67607 this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); 67608 this.id = attributes.id || ""; 67609 this.multiLine = (0, _utils.getInteger)({ 67610 data: attributes.multiLine, 67611 defaultValue: "", 67612 validate: x => x === 0 || x === 1 67613 }); 67614 this.use = attributes.use || ""; 67615 this.usehref = attributes.usehref || ""; 67616 this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]); 67617 this.border = null; 67618 this.comb = null; 67619 this.extras = null; 67620 this.margin = null; 67621 } 67622 67623 [_xfa_object.$toHTML](availableSpace) { 67624 const style = (0, _html_utils.toStyle)(this, "border", "font", "margin"); 67625 let html; 67626 67627 const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 67628 67629 if (this.multiLine === "") { 67630 this.multiLine = field instanceof Draw ? 1 : 0; 67631 } 67632 67633 if (this.multiLine === 1) { 67634 html = { 67635 name: "textarea", 67636 attributes: { 67637 dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], 67638 fieldId: field[_xfa_object.$uid], 67639 class: ["xfaTextfield"], 67640 style, 67641 "aria-label": ariaLabel(field), 67642 "aria-required": false 67643 } 67644 }; 67645 } else { 67646 html = { 67647 name: "input", 67648 attributes: { 67649 type: "text", 67650 dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], 67651 fieldId: field[_xfa_object.$uid], 67652 class: ["xfaTextfield"], 67653 style, 67654 "aria-label": ariaLabel(field), 67655 "aria-required": false 67656 } 67657 }; 67658 } 67659 67660 if (isRequired(field)) { 67661 html.attributes["aria-required"] = true; 67662 html.attributes.required = true; 67663 } 67664 67665 return _utils.HTMLResult.success({ 67666 name: "label", 67667 attributes: { 67668 class: ["xfaLabel"] 67669 }, 67670 children: [html] 67671 }); 67672 } 67673 67674} 67675 67676class Time extends _xfa_object.StringObject { 67677 constructor(attributes) { 67678 super(TEMPLATE_NS_ID, "time"); 67679 this.id = attributes.id || ""; 67680 this.name = attributes.name || ""; 67681 this.use = attributes.use || ""; 67682 this.usehref = attributes.usehref || ""; 67683 } 67684 67685 [_xfa_object.$finalize]() { 67686 const date = this[_xfa_object.$content].trim(); 67687 67688 this[_xfa_object.$content] = date ? new Date(date) : null; 67689 } 67690 67691 [_xfa_object.$toHTML](availableSpace) { 67692 return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : ""); 67693 } 67694 67695} 67696 67697class TimeStamp extends _xfa_object.XFAObject { 67698 constructor(attributes) { 67699 super(TEMPLATE_NS_ID, "timeStamp"); 67700 this.id = attributes.id || ""; 67701 this.server = attributes.server || ""; 67702 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 67703 this.use = attributes.use || ""; 67704 this.usehref = attributes.usehref || ""; 67705 } 67706 67707} 67708 67709class ToolTip extends _xfa_object.StringObject { 67710 constructor(attributes) { 67711 super(TEMPLATE_NS_ID, "toolTip"); 67712 this.id = attributes.id || ""; 67713 this.rid = attributes.rid || ""; 67714 this.use = attributes.use || ""; 67715 this.usehref = attributes.usehref || ""; 67716 } 67717 67718} 67719 67720class Traversal extends _xfa_object.XFAObject { 67721 constructor(attributes) { 67722 super(TEMPLATE_NS_ID, "traversal", true); 67723 this.id = attributes.id || ""; 67724 this.use = attributes.use || ""; 67725 this.usehref = attributes.usehref || ""; 67726 this.extras = null; 67727 this.traverse = new _xfa_object.XFAObjectArray(); 67728 } 67729 67730} 67731 67732class Traverse extends _xfa_object.XFAObject { 67733 constructor(attributes) { 67734 super(TEMPLATE_NS_ID, "traverse", true); 67735 this.id = attributes.id || ""; 67736 this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]); 67737 this.ref = attributes.ref || ""; 67738 this.use = attributes.use || ""; 67739 this.usehref = attributes.usehref || ""; 67740 this.extras = null; 67741 this.script = null; 67742 } 67743 67744 get name() { 67745 return this.operation; 67746 } 67747 67748 [_xfa_object.$isTransparent]() { 67749 return false; 67750 } 67751 67752} 67753 67754class Ui extends _xfa_object.XFAObject { 67755 constructor(attributes) { 67756 super(TEMPLATE_NS_ID, "ui", true); 67757 this.id = attributes.id || ""; 67758 this.use = attributes.use || ""; 67759 this.usehref = attributes.usehref || ""; 67760 this.extras = null; 67761 this.picture = null; 67762 this.barcode = null; 67763 this.button = null; 67764 this.checkButton = null; 67765 this.choiceList = null; 67766 this.dateTimeEdit = null; 67767 this.defaultUi = null; 67768 this.imageEdit = null; 67769 this.numericEdit = null; 67770 this.passwordEdit = null; 67771 this.signature = null; 67772 this.textEdit = null; 67773 } 67774 67775 [_xfa_object.$getExtra]() { 67776 if (this[_xfa_object.$extra] === undefined) { 67777 for (const name of Object.getOwnPropertyNames(this)) { 67778 if (name === "extras" || name === "picture") { 67779 continue; 67780 } 67781 67782 const obj = this[name]; 67783 67784 if (!(obj instanceof _xfa_object.XFAObject)) { 67785 continue; 67786 } 67787 67788 this[_xfa_object.$extra] = obj; 67789 return obj; 67790 } 67791 67792 this[_xfa_object.$extra] = null; 67793 } 67794 67795 return this[_xfa_object.$extra]; 67796 } 67797 67798 [_xfa_object.$toHTML](availableSpace) { 67799 const obj = this[_xfa_object.$getExtra](); 67800 67801 if (obj) { 67802 return obj[_xfa_object.$toHTML](availableSpace); 67803 } 67804 67805 return _utils.HTMLResult.EMPTY; 67806 } 67807 67808} 67809 67810class Validate extends _xfa_object.XFAObject { 67811 constructor(attributes) { 67812 super(TEMPLATE_NS_ID, "validate", true); 67813 this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]); 67814 this.id = attributes.id || ""; 67815 this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]); 67816 this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]); 67817 this.use = attributes.use || ""; 67818 this.usehref = attributes.usehref || ""; 67819 this.extras = null; 67820 this.message = null; 67821 this.picture = null; 67822 this.script = null; 67823 } 67824 67825} 67826 67827class Value extends _xfa_object.XFAObject { 67828 constructor(attributes) { 67829 super(TEMPLATE_NS_ID, "value", true); 67830 this.id = attributes.id || ""; 67831 this.override = (0, _utils.getInteger)({ 67832 data: attributes.override, 67833 defaultValue: 0, 67834 validate: x => x === 1 67835 }); 67836 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 67837 this.use = attributes.use || ""; 67838 this.usehref = attributes.usehref || ""; 67839 this.arc = null; 67840 this.boolean = null; 67841 this.date = null; 67842 this.dateTime = null; 67843 this.decimal = null; 67844 this.exData = null; 67845 this.float = null; 67846 this.image = null; 67847 this.integer = null; 67848 this.line = null; 67849 this.rectangle = null; 67850 this.text = null; 67851 this.time = null; 67852 } 67853 67854 [_xfa_object.$setValue](value) { 67855 const parent = this[_xfa_object.$getParent](); 67856 67857 if (parent instanceof Field) { 67858 if (parent.ui && parent.ui.imageEdit) { 67859 if (!this.image) { 67860 this.image = new Image({}); 67861 67862 this[_xfa_object.$appendChild](this.image); 67863 } 67864 67865 this.image[_xfa_object.$content] = value[_xfa_object.$content]; 67866 return; 67867 } 67868 } 67869 67870 const valueName = value[_xfa_object.$nodeName]; 67871 67872 if (this[valueName] !== null) { 67873 this[valueName][_xfa_object.$content] = value[_xfa_object.$content]; 67874 return; 67875 } 67876 67877 for (const name of Object.getOwnPropertyNames(this)) { 67878 const obj = this[name]; 67879 67880 if (obj instanceof _xfa_object.XFAObject) { 67881 this[name] = null; 67882 67883 this[_xfa_object.$removeChild](obj); 67884 } 67885 } 67886 67887 this[value[_xfa_object.$nodeName]] = value; 67888 67889 this[_xfa_object.$appendChild](value); 67890 } 67891 67892 [_xfa_object.$text]() { 67893 if (this.exData) { 67894 if (typeof this.exData[_xfa_object.$content] === "string") { 67895 return this.exData[_xfa_object.$content].trim(); 67896 } 67897 67898 return this.exData[_xfa_object.$content][_xfa_object.$text]().trim(); 67899 } 67900 67901 for (const name of Object.getOwnPropertyNames(this)) { 67902 if (name === "image") { 67903 continue; 67904 } 67905 67906 const obj = this[name]; 67907 67908 if (obj instanceof _xfa_object.XFAObject) { 67909 return (obj[_xfa_object.$content] || "").toString().trim(); 67910 } 67911 } 67912 67913 return null; 67914 } 67915 67916 [_xfa_object.$toHTML](availableSpace) { 67917 for (const name of Object.getOwnPropertyNames(this)) { 67918 const obj = this[name]; 67919 67920 if (!(obj instanceof _xfa_object.XFAObject)) { 67921 continue; 67922 } 67923 67924 return obj[_xfa_object.$toHTML](availableSpace); 67925 } 67926 67927 return _utils.HTMLResult.EMPTY; 67928 } 67929 67930} 67931 67932exports.Value = Value; 67933 67934class Variables extends _xfa_object.XFAObject { 67935 constructor(attributes) { 67936 super(TEMPLATE_NS_ID, "variables", true); 67937 this.id = attributes.id || ""; 67938 this.use = attributes.use || ""; 67939 this.usehref = attributes.usehref || ""; 67940 this.boolean = new _xfa_object.XFAObjectArray(); 67941 this.date = new _xfa_object.XFAObjectArray(); 67942 this.dateTime = new _xfa_object.XFAObjectArray(); 67943 this.decimal = new _xfa_object.XFAObjectArray(); 67944 this.exData = new _xfa_object.XFAObjectArray(); 67945 this.float = new _xfa_object.XFAObjectArray(); 67946 this.image = new _xfa_object.XFAObjectArray(); 67947 this.integer = new _xfa_object.XFAObjectArray(); 67948 this.manifest = new _xfa_object.XFAObjectArray(); 67949 this.script = new _xfa_object.XFAObjectArray(); 67950 this.text = new _xfa_object.XFAObjectArray(); 67951 this.time = new _xfa_object.XFAObjectArray(); 67952 } 67953 67954 [_xfa_object.$isTransparent]() { 67955 return true; 67956 } 67957 67958} 67959 67960class TemplateNamespace { 67961 static [_namespaces.$buildXFAObject](name, attributes) { 67962 if (TemplateNamespace.hasOwnProperty(name)) { 67963 const node = TemplateNamespace[name](attributes); 67964 67965 node[_xfa_object.$setSetAttributes](attributes); 67966 67967 return node; 67968 } 67969 67970 return undefined; 67971 } 67972 67973 static appearanceFilter(attrs) { 67974 return new AppearanceFilter(attrs); 67975 } 67976 67977 static arc(attrs) { 67978 return new Arc(attrs); 67979 } 67980 67981 static area(attrs) { 67982 return new Area(attrs); 67983 } 67984 67985 static assist(attrs) { 67986 return new Assist(attrs); 67987 } 67988 67989 static barcode(attrs) { 67990 return new Barcode(attrs); 67991 } 67992 67993 static bind(attrs) { 67994 return new Bind(attrs); 67995 } 67996 67997 static bindItems(attrs) { 67998 return new BindItems(attrs); 67999 } 68000 68001 static bookend(attrs) { 68002 return new Bookend(attrs); 68003 } 68004 68005 static boolean(attrs) { 68006 return new BooleanElement(attrs); 68007 } 68008 68009 static border(attrs) { 68010 return new Border(attrs); 68011 } 68012 68013 static break(attrs) { 68014 return new Break(attrs); 68015 } 68016 68017 static breakAfter(attrs) { 68018 return new BreakAfter(attrs); 68019 } 68020 68021 static breakBefore(attrs) { 68022 return new BreakBefore(attrs); 68023 } 68024 68025 static button(attrs) { 68026 return new Button(attrs); 68027 } 68028 68029 static calculate(attrs) { 68030 return new Calculate(attrs); 68031 } 68032 68033 static caption(attrs) { 68034 return new Caption(attrs); 68035 } 68036 68037 static certificate(attrs) { 68038 return new Certificate(attrs); 68039 } 68040 68041 static certificates(attrs) { 68042 return new Certificates(attrs); 68043 } 68044 68045 static checkButton(attrs) { 68046 return new CheckButton(attrs); 68047 } 68048 68049 static choiceList(attrs) { 68050 return new ChoiceList(attrs); 68051 } 68052 68053 static color(attrs) { 68054 return new Color(attrs); 68055 } 68056 68057 static comb(attrs) { 68058 return new Comb(attrs); 68059 } 68060 68061 static connect(attrs) { 68062 return new Connect(attrs); 68063 } 68064 68065 static contentArea(attrs) { 68066 return new ContentArea(attrs); 68067 } 68068 68069 static corner(attrs) { 68070 return new Corner(attrs); 68071 } 68072 68073 static date(attrs) { 68074 return new DateElement(attrs); 68075 } 68076 68077 static dateTime(attrs) { 68078 return new DateTime(attrs); 68079 } 68080 68081 static dateTimeEdit(attrs) { 68082 return new DateTimeEdit(attrs); 68083 } 68084 68085 static decimal(attrs) { 68086 return new Decimal(attrs); 68087 } 68088 68089 static defaultUi(attrs) { 68090 return new DefaultUi(attrs); 68091 } 68092 68093 static desc(attrs) { 68094 return new Desc(attrs); 68095 } 68096 68097 static digestMethod(attrs) { 68098 return new DigestMethod(attrs); 68099 } 68100 68101 static digestMethods(attrs) { 68102 return new DigestMethods(attrs); 68103 } 68104 68105 static draw(attrs) { 68106 return new Draw(attrs); 68107 } 68108 68109 static edge(attrs) { 68110 return new Edge(attrs); 68111 } 68112 68113 static encoding(attrs) { 68114 return new Encoding(attrs); 68115 } 68116 68117 static encodings(attrs) { 68118 return new Encodings(attrs); 68119 } 68120 68121 static encrypt(attrs) { 68122 return new Encrypt(attrs); 68123 } 68124 68125 static encryptData(attrs) { 68126 return new EncryptData(attrs); 68127 } 68128 68129 static encryption(attrs) { 68130 return new Encryption(attrs); 68131 } 68132 68133 static encryptionMethod(attrs) { 68134 return new EncryptionMethod(attrs); 68135 } 68136 68137 static encryptionMethods(attrs) { 68138 return new EncryptionMethods(attrs); 68139 } 68140 68141 static event(attrs) { 68142 return new Event(attrs); 68143 } 68144 68145 static exData(attrs) { 68146 return new ExData(attrs); 68147 } 68148 68149 static exObject(attrs) { 68150 return new ExObject(attrs); 68151 } 68152 68153 static exclGroup(attrs) { 68154 return new ExclGroup(attrs); 68155 } 68156 68157 static execute(attrs) { 68158 return new Execute(attrs); 68159 } 68160 68161 static extras(attrs) { 68162 return new Extras(attrs); 68163 } 68164 68165 static field(attrs) { 68166 return new Field(attrs); 68167 } 68168 68169 static fill(attrs) { 68170 return new Fill(attrs); 68171 } 68172 68173 static filter(attrs) { 68174 return new Filter(attrs); 68175 } 68176 68177 static float(attrs) { 68178 return new Float(attrs); 68179 } 68180 68181 static font(attrs) { 68182 return new Font(attrs); 68183 } 68184 68185 static format(attrs) { 68186 return new Format(attrs); 68187 } 68188 68189 static handler(attrs) { 68190 return new Handler(attrs); 68191 } 68192 68193 static hyphenation(attrs) { 68194 return new Hyphenation(attrs); 68195 } 68196 68197 static image(attrs) { 68198 return new Image(attrs); 68199 } 68200 68201 static imageEdit(attrs) { 68202 return new ImageEdit(attrs); 68203 } 68204 68205 static integer(attrs) { 68206 return new Integer(attrs); 68207 } 68208 68209 static issuers(attrs) { 68210 return new Issuers(attrs); 68211 } 68212 68213 static items(attrs) { 68214 return new Items(attrs); 68215 } 68216 68217 static keep(attrs) { 68218 return new Keep(attrs); 68219 } 68220 68221 static keyUsage(attrs) { 68222 return new KeyUsage(attrs); 68223 } 68224 68225 static line(attrs) { 68226 return new Line(attrs); 68227 } 68228 68229 static linear(attrs) { 68230 return new Linear(attrs); 68231 } 68232 68233 static lockDocument(attrs) { 68234 return new LockDocument(attrs); 68235 } 68236 68237 static manifest(attrs) { 68238 return new Manifest(attrs); 68239 } 68240 68241 static margin(attrs) { 68242 return new Margin(attrs); 68243 } 68244 68245 static mdp(attrs) { 68246 return new Mdp(attrs); 68247 } 68248 68249 static medium(attrs) { 68250 return new Medium(attrs); 68251 } 68252 68253 static message(attrs) { 68254 return new Message(attrs); 68255 } 68256 68257 static numericEdit(attrs) { 68258 return new NumericEdit(attrs); 68259 } 68260 68261 static occur(attrs) { 68262 return new Occur(attrs); 68263 } 68264 68265 static oid(attrs) { 68266 return new Oid(attrs); 68267 } 68268 68269 static oids(attrs) { 68270 return new Oids(attrs); 68271 } 68272 68273 static overflow(attrs) { 68274 return new Overflow(attrs); 68275 } 68276 68277 static pageArea(attrs) { 68278 return new PageArea(attrs); 68279 } 68280 68281 static pageSet(attrs) { 68282 return new PageSet(attrs); 68283 } 68284 68285 static para(attrs) { 68286 return new Para(attrs); 68287 } 68288 68289 static passwordEdit(attrs) { 68290 return new PasswordEdit(attrs); 68291 } 68292 68293 static pattern(attrs) { 68294 return new Pattern(attrs); 68295 } 68296 68297 static picture(attrs) { 68298 return new Picture(attrs); 68299 } 68300 68301 static proto(attrs) { 68302 return new Proto(attrs); 68303 } 68304 68305 static radial(attrs) { 68306 return new Radial(attrs); 68307 } 68308 68309 static reason(attrs) { 68310 return new Reason(attrs); 68311 } 68312 68313 static reasons(attrs) { 68314 return new Reasons(attrs); 68315 } 68316 68317 static rectangle(attrs) { 68318 return new Rectangle(attrs); 68319 } 68320 68321 static ref(attrs) { 68322 return new RefElement(attrs); 68323 } 68324 68325 static script(attrs) { 68326 return new Script(attrs); 68327 } 68328 68329 static setProperty(attrs) { 68330 return new SetProperty(attrs); 68331 } 68332 68333 static signData(attrs) { 68334 return new SignData(attrs); 68335 } 68336 68337 static signature(attrs) { 68338 return new Signature(attrs); 68339 } 68340 68341 static signing(attrs) { 68342 return new Signing(attrs); 68343 } 68344 68345 static solid(attrs) { 68346 return new Solid(attrs); 68347 } 68348 68349 static speak(attrs) { 68350 return new Speak(attrs); 68351 } 68352 68353 static stipple(attrs) { 68354 return new Stipple(attrs); 68355 } 68356 68357 static subform(attrs) { 68358 return new Subform(attrs); 68359 } 68360 68361 static subformSet(attrs) { 68362 return new SubformSet(attrs); 68363 } 68364 68365 static subjectDN(attrs) { 68366 return new SubjectDN(attrs); 68367 } 68368 68369 static subjectDNs(attrs) { 68370 return new SubjectDNs(attrs); 68371 } 68372 68373 static submit(attrs) { 68374 return new Submit(attrs); 68375 } 68376 68377 static template(attrs) { 68378 return new Template(attrs); 68379 } 68380 68381 static text(attrs) { 68382 return new Text(attrs); 68383 } 68384 68385 static textEdit(attrs) { 68386 return new TextEdit(attrs); 68387 } 68388 68389 static time(attrs) { 68390 return new Time(attrs); 68391 } 68392 68393 static timeStamp(attrs) { 68394 return new TimeStamp(attrs); 68395 } 68396 68397 static toolTip(attrs) { 68398 return new ToolTip(attrs); 68399 } 68400 68401 static traversal(attrs) { 68402 return new Traversal(attrs); 68403 } 68404 68405 static traverse(attrs) { 68406 return new Traverse(attrs); 68407 } 68408 68409 static ui(attrs) { 68410 return new Ui(attrs); 68411 } 68412 68413 static validate(attrs) { 68414 return new Validate(attrs); 68415 } 68416 68417 static value(attrs) { 68418 return new Value(attrs); 68419 } 68420 68421 static variables(attrs) { 68422 return new Variables(attrs); 68423 } 68424 68425} 68426 68427exports.TemplateNamespace = TemplateNamespace; 68428 68429/***/ }), 68430/* 83 */ 68431/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 68432 68433 68434 68435Object.defineProperty(exports, "__esModule", ({ 68436 value: true 68437})); 68438exports.addHTML = addHTML; 68439exports.checkDimensions = checkDimensions; 68440exports.flushHTML = flushHTML; 68441exports.getAvailableSpace = getAvailableSpace; 68442 68443var _xfa_object = __w_pdfjs_require__(77); 68444 68445var _html_utils = __w_pdfjs_require__(84); 68446 68447function createLine(node, children) { 68448 return { 68449 name: "div", 68450 attributes: { 68451 class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"] 68452 }, 68453 children 68454 }; 68455} 68456 68457function flushHTML(node) { 68458 if (!node[_xfa_object.$extra]) { 68459 return null; 68460 } 68461 68462 const attributes = node[_xfa_object.$extra].attributes; 68463 const html = { 68464 name: "div", 68465 attributes, 68466 children: node[_xfa_object.$extra].children 68467 }; 68468 68469 if (node[_xfa_object.$extra].failingNode) { 68470 const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML](); 68471 68472 if (htmlFromFailing) { 68473 if (node.layout.endsWith("-tb")) { 68474 html.children.push(createLine(node, [htmlFromFailing])); 68475 } else { 68476 html.children.push(htmlFromFailing); 68477 } 68478 } 68479 } 68480 68481 if (html.children.length === 0) { 68482 return null; 68483 } 68484 68485 return html; 68486} 68487 68488function addHTML(node, html, bbox) { 68489 const extra = node[_xfa_object.$extra]; 68490 const availableSpace = extra.availableSpace; 68491 const [x, y, w, h] = bbox; 68492 68493 switch (node.layout) { 68494 case "position": 68495 { 68496 extra.width = Math.max(extra.width, x + w); 68497 extra.height = Math.max(extra.height, y + h); 68498 extra.children.push(html); 68499 break; 68500 } 68501 68502 case "lr-tb": 68503 case "rl-tb": 68504 if (!extra.line || extra.attempt === 1) { 68505 extra.line = createLine(node, []); 68506 extra.children.push(extra.line); 68507 extra.numberInLine = 0; 68508 } 68509 68510 extra.numberInLine += 1; 68511 extra.line.children.push(html); 68512 68513 if (extra.attempt === 0) { 68514 extra.currentWidth += w; 68515 extra.height = Math.max(extra.height, extra.prevHeight + h); 68516 } else { 68517 extra.currentWidth = w; 68518 extra.prevHeight = extra.height; 68519 extra.height += h; 68520 extra.attempt = 0; 68521 } 68522 68523 extra.width = Math.max(extra.width, extra.currentWidth); 68524 break; 68525 68526 case "rl-row": 68527 case "row": 68528 { 68529 extra.children.push(html); 68530 extra.width += w; 68531 extra.height = Math.max(extra.height, h); 68532 const height = (0, _html_utils.measureToString)(extra.height); 68533 68534 for (const child of extra.children) { 68535 child.attributes.style.height = height; 68536 } 68537 68538 break; 68539 } 68540 68541 case "table": 68542 { 68543 extra.width = Math.min(availableSpace.width, Math.max(extra.width, w)); 68544 extra.height += h; 68545 extra.children.push(html); 68546 break; 68547 } 68548 68549 case "tb": 68550 { 68551 extra.width = Math.min(availableSpace.width, Math.max(extra.width, w)); 68552 extra.height += h; 68553 extra.children.push(html); 68554 break; 68555 } 68556 } 68557} 68558 68559function getAvailableSpace(node) { 68560 const availableSpace = node[_xfa_object.$extra].availableSpace; 68561 const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0; 68562 const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0; 68563 68564 switch (node.layout) { 68565 case "lr-tb": 68566 case "rl-tb": 68567 if (node[_xfa_object.$extra].attempt === 0) { 68568 return { 68569 width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth, 68570 height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight 68571 }; 68572 } 68573 68574 return { 68575 width: availableSpace.width - marginH, 68576 height: availableSpace.height - marginV - node[_xfa_object.$extra].height 68577 }; 68578 68579 case "rl-row": 68580 case "row": 68581 const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x); 68582 68583 return { 68584 width, 68585 height: availableSpace.height - marginH 68586 }; 68587 68588 case "table": 68589 case "tb": 68590 return { 68591 width: availableSpace.width - marginH, 68592 height: availableSpace.height - marginV - node[_xfa_object.$extra].height 68593 }; 68594 68595 case "position": 68596 default: 68597 return availableSpace; 68598 } 68599} 68600 68601function getTransformedBBox(node) { 68602 let w = node.w === "" ? NaN : node.w; 68603 let h = node.h === "" ? NaN : node.h; 68604 let [centerX, centerY] = [0, 0]; 68605 68606 switch (node.anchorType || "") { 68607 case "bottomCenter": 68608 [centerX, centerY] = [w / 2, h]; 68609 break; 68610 68611 case "bottomLeft": 68612 [centerX, centerY] = [0, h]; 68613 break; 68614 68615 case "bottomRight": 68616 [centerX, centerY] = [w, h]; 68617 break; 68618 68619 case "middleCenter": 68620 [centerX, centerY] = [w / 2, h / 2]; 68621 break; 68622 68623 case "middleLeft": 68624 [centerX, centerY] = [0, h / 2]; 68625 break; 68626 68627 case "middleRight": 68628 [centerX, centerY] = [w, h / 2]; 68629 break; 68630 68631 case "topCenter": 68632 [centerX, centerY] = [w / 2, 0]; 68633 break; 68634 68635 case "topRight": 68636 [centerX, centerY] = [w, 0]; 68637 break; 68638 } 68639 68640 let x, y; 68641 68642 switch (node.rotate || 0) { 68643 case 0: 68644 [x, y] = [-centerX, -centerY]; 68645 break; 68646 68647 case 90: 68648 [x, y] = [-centerY, centerX]; 68649 [w, h] = [h, -w]; 68650 break; 68651 68652 case 180: 68653 [x, y] = [centerX, centerY]; 68654 [w, h] = [-w, -h]; 68655 break; 68656 68657 case 270: 68658 [x, y] = [centerY, -centerX]; 68659 [w, h] = [-h, w]; 68660 break; 68661 } 68662 68663 return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)]; 68664} 68665 68666function checkDimensions(node, space) { 68667 if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) { 68668 return true; 68669 } 68670 68671 if (node.w === 0 || node.h === 0) { 68672 return true; 68673 } 68674 68675 const ERROR = 2; 68676 68677 const parent = node[_xfa_object.$getSubformParent](); 68678 68679 const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0; 68680 const [, y, w, h] = getTransformedBBox(node); 68681 68682 switch (parent.layout) { 68683 case "lr-tb": 68684 case "rl-tb": 68685 if (attempt === 0) { 68686 if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { 68687 if (node.h !== "" && Math.round(h - space.height) > ERROR) { 68688 return false; 68689 } 68690 68691 if (node.w !== "") { 68692 if (Math.round(w - space.width) <= ERROR) { 68693 return true; 68694 } 68695 68696 if (parent[_xfa_object.$extra].numberInLine === 0) { 68697 return space.height > ERROR; 68698 } 68699 68700 return false; 68701 } 68702 68703 return space.width > ERROR; 68704 } 68705 68706 if (node.w !== "") { 68707 return Math.round(w - space.width) <= ERROR; 68708 } 68709 68710 return space.width > ERROR; 68711 } 68712 68713 if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { 68714 return true; 68715 } 68716 68717 if (node.h !== "" && Math.round(h - space.height) > ERROR) { 68718 return false; 68719 } 68720 68721 if (node.w === "" || Math.round(w - space.width) <= ERROR) { 68722 return space.height > ERROR; 68723 } 68724 68725 if (parent[_xfa_object.$isThereMoreWidth]()) { 68726 return false; 68727 } 68728 68729 return space.height > ERROR; 68730 68731 case "table": 68732 case "tb": 68733 if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { 68734 return true; 68735 } 68736 68737 if (node.h !== "" && !node[_xfa_object.$isSplittable]()) { 68738 return Math.round(h - space.height) <= ERROR; 68739 } 68740 68741 if (node.w === "" || Math.round(w - space.width) <= ERROR) { 68742 return space.height > ERROR; 68743 } 68744 68745 if (parent[_xfa_object.$isThereMoreWidth]()) { 68746 return false; 68747 } 68748 68749 return space.height > ERROR; 68750 68751 case "position": 68752 if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { 68753 return true; 68754 } 68755 68756 if (node.h === "" || Math.round(h + y - space.height) <= ERROR) { 68757 return true; 68758 } 68759 68760 const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea; 68761 68762 return h + y > area.h; 68763 68764 case "rl-row": 68765 case "row": 68766 if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { 68767 return true; 68768 } 68769 68770 if (node.h !== "") { 68771 return Math.round(h - space.height) <= ERROR; 68772 } 68773 68774 return true; 68775 68776 default: 68777 return true; 68778 } 68779} 68780 68781/***/ }), 68782/* 84 */ 68783/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 68784 68785 68786 68787Object.defineProperty(exports, "__esModule", ({ 68788 value: true 68789})); 68790exports.computeBbox = computeBbox; 68791exports.createWrapper = createWrapper; 68792exports.fixDimensions = fixDimensions; 68793exports.fixTextIndent = fixTextIndent; 68794exports.fixURL = fixURL; 68795exports.isPrintOnly = isPrintOnly; 68796exports.layoutClass = layoutClass; 68797exports.layoutNode = layoutNode; 68798exports.measureToString = measureToString; 68799exports.setAccess = setAccess; 68800exports.setFontFamily = setFontFamily; 68801exports.setMinMaxDimensions = setMinMaxDimensions; 68802exports.setPara = setPara; 68803exports.toStyle = toStyle; 68804 68805var _xfa_object = __w_pdfjs_require__(77); 68806 68807var _util = __w_pdfjs_require__(2); 68808 68809var _utils = __w_pdfjs_require__(78); 68810 68811var _fonts = __w_pdfjs_require__(85); 68812 68813var _text = __w_pdfjs_require__(86); 68814 68815function measureToString(m) { 68816 if (typeof m === "string") { 68817 return "0px"; 68818 } 68819 68820 return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`; 68821} 68822 68823const converters = { 68824 anchorType(node, style) { 68825 const parent = node[_xfa_object.$getSubformParent](); 68826 68827 if (!parent || parent.layout && parent.layout !== "position") { 68828 return; 68829 } 68830 68831 if (!("transform" in style)) { 68832 style.transform = ""; 68833 } 68834 68835 switch (node.anchorType) { 68836 case "bottomCenter": 68837 style.transform += "translate(-50%, -100%)"; 68838 break; 68839 68840 case "bottomLeft": 68841 style.transform += "translate(0,-100%)"; 68842 break; 68843 68844 case "bottomRight": 68845 style.transform += "translate(-100%,-100%)"; 68846 break; 68847 68848 case "middleCenter": 68849 style.transform += "translate(-50%,-50%)"; 68850 break; 68851 68852 case "middleLeft": 68853 style.transform += "translate(0,-50%)"; 68854 break; 68855 68856 case "middleRight": 68857 style.transform += "translate(-100%,-50%)"; 68858 break; 68859 68860 case "topCenter": 68861 style.transform += "translate(-50%,0)"; 68862 break; 68863 68864 case "topRight": 68865 style.transform += "translate(-100%,0)"; 68866 break; 68867 } 68868 }, 68869 68870 dimensions(node, style) { 68871 const parent = node[_xfa_object.$getSubformParent](); 68872 68873 let width = node.w; 68874 const height = node.h; 68875 68876 if (parent.layout && parent.layout.includes("row")) { 68877 const extra = parent[_xfa_object.$extra]; 68878 const colSpan = node.colSpan; 68879 let w; 68880 68881 if (colSpan === -1) { 68882 w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0); 68883 extra.currentColumn = 0; 68884 } else { 68885 w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0); 68886 extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length; 68887 } 68888 68889 if (!isNaN(w)) { 68890 width = node.w = w; 68891 } 68892 } 68893 68894 if (width !== "") { 68895 style.width = measureToString(width); 68896 } else { 68897 style.width = "auto"; 68898 } 68899 68900 if (height !== "") { 68901 style.height = measureToString(height); 68902 } else { 68903 style.height = "auto"; 68904 } 68905 }, 68906 68907 position(node, style) { 68908 const parent = node[_xfa_object.$getSubformParent](); 68909 68910 if (parent && parent.layout && parent.layout !== "position") { 68911 return; 68912 } 68913 68914 style.position = "absolute"; 68915 style.left = measureToString(node.x); 68916 style.top = measureToString(node.y); 68917 }, 68918 68919 rotate(node, style) { 68920 if (node.rotate) { 68921 if (!("transform" in style)) { 68922 style.transform = ""; 68923 } 68924 68925 style.transform += `rotate(-${node.rotate}deg)`; 68926 style.transformOrigin = "top left"; 68927 } 68928 }, 68929 68930 presence(node, style) { 68931 switch (node.presence) { 68932 case "invisible": 68933 style.visibility = "hidden"; 68934 break; 68935 68936 case "hidden": 68937 case "inactive": 68938 style.display = "none"; 68939 break; 68940 } 68941 }, 68942 68943 hAlign(node, style) { 68944 if (node[_xfa_object.$nodeName] === "para") { 68945 switch (node.hAlign) { 68946 case "justifyAll": 68947 style.textAlign = "justify-all"; 68948 break; 68949 68950 case "radix": 68951 style.textAlign = "left"; 68952 break; 68953 68954 default: 68955 style.textAlign = node.hAlign; 68956 } 68957 } else { 68958 switch (node.hAlign) { 68959 case "left": 68960 style.alignSelf = "start"; 68961 break; 68962 68963 case "center": 68964 style.alignSelf = "center"; 68965 break; 68966 68967 case "right": 68968 style.alignSelf = "end"; 68969 break; 68970 } 68971 } 68972 }, 68973 68974 margin(node, style) { 68975 if (node.margin) { 68976 style.margin = node.margin[_xfa_object.$toStyle]().margin; 68977 } 68978 } 68979 68980}; 68981 68982function setMinMaxDimensions(node, style) { 68983 const parent = node[_xfa_object.$getSubformParent](); 68984 68985 if (parent.layout === "position") { 68986 if (node.minW > 0) { 68987 style.minWidth = measureToString(node.minW); 68988 } 68989 68990 if (node.maxW > 0) { 68991 style.maxWidth = measureToString(node.maxW); 68992 } 68993 68994 if (node.minH > 0) { 68995 style.minHeight = measureToString(node.minH); 68996 } 68997 68998 if (node.maxH > 0) { 68999 style.maxHeight = measureToString(node.maxH); 69000 } 69001 } 69002} 69003 69004function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) { 69005 const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder); 69006 69007 if (typeof text === "string") { 69008 measure.addString(text); 69009 } else { 69010 text[_xfa_object.$pushGlyphs](measure); 69011 } 69012 69013 return measure.compute(width); 69014} 69015 69016function layoutNode(node, availableSpace) { 69017 let height = null; 69018 let width = null; 69019 let isBroken = false; 69020 69021 if ((!node.w || !node.h) && node.value) { 69022 let marginH = 0; 69023 let marginV = 0; 69024 69025 if (node.margin) { 69026 marginH = node.margin.leftInset + node.margin.rightInset; 69027 marginV = node.margin.topInset + node.margin.bottomInset; 69028 } 69029 69030 let lineHeight = null; 69031 let margin = null; 69032 69033 if (node.para) { 69034 margin = Object.create(null); 69035 lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight; 69036 margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove; 69037 margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow; 69038 margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft; 69039 margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight; 69040 } 69041 69042 let font = node.font; 69043 69044 if (!font) { 69045 const root = node[_xfa_object.$getTemplateRoot](); 69046 69047 let parent = node[_xfa_object.$getParent](); 69048 69049 while (parent && parent !== root) { 69050 if (parent.font) { 69051 font = parent.font; 69052 break; 69053 } 69054 69055 parent = parent[_xfa_object.$getParent](); 69056 } 69057 } 69058 69059 const maxWidth = (node.w || availableSpace.width) - marginH; 69060 const fontFinder = node[_xfa_object.$globalData].fontFinder; 69061 69062 if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") { 69063 const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth); 69064 width = res.width; 69065 height = res.height; 69066 isBroken = res.isBroken; 69067 } else { 69068 const text = node.value[_xfa_object.$text](); 69069 69070 if (text) { 69071 const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth); 69072 width = res.width; 69073 height = res.height; 69074 isBroken = res.isBroken; 69075 } 69076 } 69077 69078 if (width !== null && !node.w) { 69079 width += marginH; 69080 } 69081 69082 if (height !== null && !node.h) { 69083 height += marginV; 69084 } 69085 } 69086 69087 return { 69088 w: width, 69089 h: height, 69090 isBroken 69091 }; 69092} 69093 69094function computeBbox(node, html, availableSpace) { 69095 let bbox; 69096 69097 if (node.w !== "" && node.h !== "") { 69098 bbox = [node.x, node.y, node.w, node.h]; 69099 } else { 69100 if (!availableSpace) { 69101 return null; 69102 } 69103 69104 let width = node.w; 69105 69106 if (width === "") { 69107 if (node.maxW === 0) { 69108 const parent = node[_xfa_object.$getSubformParent](); 69109 69110 if (parent.layout === "position" && parent.w !== "") { 69111 width = 0; 69112 } else { 69113 width = node.minW; 69114 } 69115 } else { 69116 width = Math.min(node.maxW, availableSpace.width); 69117 } 69118 69119 html.attributes.style.width = measureToString(width); 69120 } 69121 69122 let height = node.h; 69123 69124 if (height === "") { 69125 if (node.maxH === 0) { 69126 const parent = node[_xfa_object.$getSubformParent](); 69127 69128 if (parent.layout === "position" && parent.h !== "") { 69129 height = 0; 69130 } else { 69131 height = node.minH; 69132 } 69133 } else { 69134 height = Math.min(node.maxH, availableSpace.height); 69135 } 69136 69137 html.attributes.style.height = measureToString(height); 69138 } 69139 69140 bbox = [node.x, node.y, width, height]; 69141 } 69142 69143 return bbox; 69144} 69145 69146function fixDimensions(node) { 69147 const parent = node[_xfa_object.$getSubformParent](); 69148 69149 if (parent.layout && parent.layout.includes("row")) { 69150 const extra = parent[_xfa_object.$extra]; 69151 const colSpan = node.colSpan; 69152 let width; 69153 69154 if (colSpan === -1) { 69155 width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0); 69156 } else { 69157 width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0); 69158 } 69159 69160 if (!isNaN(width)) { 69161 node.w = width; 69162 } 69163 } 69164 69165 if (parent.layout && parent.layout !== "position") { 69166 node.x = node.y = 0; 69167 } 69168 69169 if (node.layout === "table") { 69170 if (node.w === "" && Array.isArray(node.columnWidths)) { 69171 node.w = node.columnWidths.reduce((a, x) => a + x, 0); 69172 } 69173 } 69174} 69175 69176function layoutClass(node) { 69177 switch (node.layout) { 69178 case "position": 69179 return "xfaPosition"; 69180 69181 case "lr-tb": 69182 return "xfaLrTb"; 69183 69184 case "rl-row": 69185 return "xfaRlRow"; 69186 69187 case "rl-tb": 69188 return "xfaRlTb"; 69189 69190 case "row": 69191 return "xfaRow"; 69192 69193 case "table": 69194 return "xfaTable"; 69195 69196 case "tb": 69197 return "xfaTb"; 69198 69199 default: 69200 return "xfaPosition"; 69201 } 69202} 69203 69204function toStyle(node, ...names) { 69205 const style = Object.create(null); 69206 69207 for (const name of names) { 69208 const value = node[name]; 69209 69210 if (value === null) { 69211 continue; 69212 } 69213 69214 if (converters.hasOwnProperty(name)) { 69215 converters[name](node, style); 69216 continue; 69217 } 69218 69219 if (value instanceof _xfa_object.XFAObject) { 69220 const newStyle = value[_xfa_object.$toStyle](); 69221 69222 if (newStyle) { 69223 Object.assign(style, newStyle); 69224 } else { 69225 (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`); 69226 } 69227 } 69228 } 69229 69230 return style; 69231} 69232 69233function createWrapper(node, html) { 69234 const { 69235 attributes 69236 } = html; 69237 const { 69238 style 69239 } = attributes; 69240 const wrapper = { 69241 name: "div", 69242 attributes: { 69243 class: ["xfaWrapper"], 69244 style: Object.create(null) 69245 }, 69246 children: [] 69247 }; 69248 attributes.class.push("xfaWrapped"); 69249 69250 if (node.border) { 69251 const { 69252 widths, 69253 insets 69254 } = node.border[_xfa_object.$extra]; 69255 let width, height; 69256 let top = insets[0]; 69257 let left = insets[3]; 69258 const insetsH = insets[0] + insets[2]; 69259 const insetsW = insets[1] + insets[3]; 69260 69261 switch (node.border.hand) { 69262 case "even": 69263 top -= widths[0] / 2; 69264 left -= widths[3] / 2; 69265 width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`; 69266 height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`; 69267 break; 69268 69269 case "left": 69270 top -= widths[0]; 69271 left -= widths[3]; 69272 width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`; 69273 height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`; 69274 break; 69275 69276 case "right": 69277 width = insetsW ? `calc(100% - ${insetsW}px)` : "100%"; 69278 height = insetsH ? `calc(100% - ${insetsH}px)` : "100%"; 69279 break; 69280 } 69281 69282 const classNames = ["xfaBorder"]; 69283 69284 if (isPrintOnly(node.border)) { 69285 classNames.push("xfaPrintOnly"); 69286 } 69287 69288 const border = { 69289 name: "div", 69290 attributes: { 69291 class: classNames, 69292 style: { 69293 top: `${top}px`, 69294 left: `${left}px`, 69295 width, 69296 height 69297 } 69298 }, 69299 children: [] 69300 }; 69301 69302 for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) { 69303 if (style[key] !== undefined) { 69304 border.attributes.style[key] = style[key]; 69305 delete style[key]; 69306 } 69307 } 69308 69309 wrapper.children.push(border, html); 69310 } else { 69311 wrapper.children.push(html); 69312 } 69313 69314 for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) { 69315 if (style[key] !== undefined) { 69316 wrapper.attributes.style[key] = style[key]; 69317 delete style[key]; 69318 } 69319 } 69320 69321 if (style.position === "absolute") { 69322 wrapper.attributes.style.position = "absolute"; 69323 } else { 69324 wrapper.attributes.style.position = "relative"; 69325 } 69326 69327 delete style.position; 69328 69329 if (style.alignSelf) { 69330 wrapper.attributes.style.alignSelf = style.alignSelf; 69331 delete style.alignSelf; 69332 } 69333 69334 return wrapper; 69335} 69336 69337function fixTextIndent(styles) { 69338 const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px"); 69339 69340 if (indent >= 0) { 69341 return; 69342 } 69343 69344 const align = styles.textAlign === "right" ? "right" : "left"; 69345 const name = "padding" + (align === "left" ? "Left" : "Right"); 69346 const padding = (0, _utils.getMeasurement)(styles[name], "0px"); 69347 styles[name] = `${padding - indent}px`; 69348} 69349 69350function setAccess(node, classNames) { 69351 switch (node.access) { 69352 case "nonInteractive": 69353 classNames.push("xfaNonInteractive"); 69354 break; 69355 69356 case "readOnly": 69357 classNames.push("xfaReadOnly"); 69358 break; 69359 69360 case "protected": 69361 classNames.push("xfaDisabled"); 69362 break; 69363 } 69364} 69365 69366function isPrintOnly(node) { 69367 return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print"; 69368} 69369 69370function getCurrentPara(node) { 69371 const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack; 69372 69373 return stack.length ? stack.at(-1) : null; 69374} 69375 69376function setPara(node, nodeStyle, value) { 69377 if (value.attributes.class && value.attributes.class.includes("xfaRich")) { 69378 if (nodeStyle) { 69379 if (node.h === "") { 69380 nodeStyle.height = "auto"; 69381 } 69382 69383 if (node.w === "") { 69384 nodeStyle.width = "auto"; 69385 } 69386 } 69387 69388 const para = getCurrentPara(node); 69389 69390 if (para) { 69391 const valueStyle = value.attributes.style; 69392 valueStyle.display = "flex"; 69393 valueStyle.flexDirection = "column"; 69394 69395 switch (para.vAlign) { 69396 case "top": 69397 valueStyle.justifyContent = "start"; 69398 break; 69399 69400 case "bottom": 69401 valueStyle.justifyContent = "end"; 69402 break; 69403 69404 case "middle": 69405 valueStyle.justifyContent = "center"; 69406 break; 69407 } 69408 69409 const paraStyle = para[_xfa_object.$toStyle](); 69410 69411 for (const [key, val] of Object.entries(paraStyle)) { 69412 if (!(key in valueStyle)) { 69413 valueStyle[key] = val; 69414 } 69415 } 69416 } 69417 } 69418} 69419 69420function setFontFamily(xfaFont, node, fontFinder, style) { 69421 if (!fontFinder) { 69422 delete style.fontFamily; 69423 return; 69424 } 69425 69426 const name = (0, _utils.stripQuotes)(xfaFont.typeface); 69427 style.fontFamily = `"${name}"`; 69428 const typeface = fontFinder.find(name); 69429 69430 if (typeface) { 69431 const { 69432 fontFamily 69433 } = typeface.regular.cssFontInfo; 69434 69435 if (fontFamily !== name) { 69436 style.fontFamily = `"${fontFamily}"`; 69437 } 69438 69439 const para = getCurrentPara(node); 69440 69441 if (para && para.lineHeight !== "") { 69442 return; 69443 } 69444 69445 if (style.lineHeight) { 69446 return; 69447 } 69448 69449 const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface); 69450 69451 if (pdfFont) { 69452 style.lineHeight = Math.max(1.2, pdfFont.lineHeight); 69453 } 69454 } 69455} 69456 69457function fixURL(str) { 69458 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, { 69459 addDefaultProtocol: true, 69460 tryConvertEncoding: true 69461 }); 69462 return absoluteUrl ? absoluteUrl.href : null; 69463} 69464 69465/***/ }), 69466/* 85 */ 69467/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 69468 69469 69470 69471Object.defineProperty(exports, "__esModule", ({ 69472 value: true 69473})); 69474exports.FontFinder = void 0; 69475exports.getMetrics = getMetrics; 69476exports.selectFont = selectFont; 69477 69478var _xfa_object = __w_pdfjs_require__(77); 69479 69480var _utils = __w_pdfjs_require__(78); 69481 69482var _util = __w_pdfjs_require__(2); 69483 69484class FontFinder { 69485 constructor(pdfFonts) { 69486 this.fonts = new Map(); 69487 this.cache = new Map(); 69488 this.warned = new Set(); 69489 this.defaultFont = null; 69490 this.add(pdfFonts); 69491 } 69492 69493 add(pdfFonts, reallyMissingFonts = null) { 69494 for (const pdfFont of pdfFonts) { 69495 this.addPdfFont(pdfFont); 69496 } 69497 69498 for (const pdfFont of this.fonts.values()) { 69499 if (!pdfFont.regular) { 69500 pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic; 69501 } 69502 } 69503 69504 if (!reallyMissingFonts || reallyMissingFonts.size === 0) { 69505 return; 69506 } 69507 69508 const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA"); 69509 69510 for (const missing of reallyMissingFonts) { 69511 this.fonts.set(missing, myriad); 69512 } 69513 } 69514 69515 addPdfFont(pdfFont) { 69516 const cssFontInfo = pdfFont.cssFontInfo; 69517 const name = cssFontInfo.fontFamily; 69518 let font = this.fonts.get(name); 69519 69520 if (!font) { 69521 font = Object.create(null); 69522 this.fonts.set(name, font); 69523 69524 if (!this.defaultFont) { 69525 this.defaultFont = font; 69526 } 69527 } 69528 69529 let property = ""; 69530 const fontWeight = parseFloat(cssFontInfo.fontWeight); 69531 69532 if (parseFloat(cssFontInfo.italicAngle) !== 0) { 69533 property = fontWeight >= 700 ? "bolditalic" : "italic"; 69534 } else if (fontWeight >= 700) { 69535 property = "bold"; 69536 } 69537 69538 if (!property) { 69539 if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) { 69540 property = "bold"; 69541 } 69542 69543 if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) { 69544 property += "italic"; 69545 } 69546 } 69547 69548 if (!property) { 69549 property = "regular"; 69550 } 69551 69552 font[property] = pdfFont; 69553 } 69554 69555 getDefault() { 69556 return this.defaultFont; 69557 } 69558 69559 find(fontName, mustWarn = true) { 69560 let font = this.fonts.get(fontName) || this.cache.get(fontName); 69561 69562 if (font) { 69563 return font; 69564 } 69565 69566 const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi; 69567 let name = fontName.replace(pattern, ""); 69568 font = this.fonts.get(name); 69569 69570 if (font) { 69571 this.cache.set(fontName, font); 69572 return font; 69573 } 69574 69575 name = name.toLowerCase(); 69576 const maybe = []; 69577 69578 for (const [family, pdfFont] of this.fonts.entries()) { 69579 if (family.replace(pattern, "").toLowerCase().startsWith(name)) { 69580 maybe.push(pdfFont); 69581 } 69582 } 69583 69584 if (maybe.length === 0) { 69585 for (const [, pdfFont] of this.fonts.entries()) { 69586 if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) { 69587 maybe.push(pdfFont); 69588 } 69589 } 69590 } 69591 69592 if (maybe.length === 0) { 69593 name = name.replace(/psmt|mt/gi, ""); 69594 69595 for (const [family, pdfFont] of this.fonts.entries()) { 69596 if (family.replace(pattern, "").toLowerCase().startsWith(name)) { 69597 maybe.push(pdfFont); 69598 } 69599 } 69600 } 69601 69602 if (maybe.length === 0) { 69603 for (const pdfFont of this.fonts.values()) { 69604 if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) { 69605 maybe.push(pdfFont); 69606 } 69607 } 69608 } 69609 69610 if (maybe.length >= 1) { 69611 if (maybe.length !== 1 && mustWarn) { 69612 (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`); 69613 } 69614 69615 this.cache.set(fontName, maybe[0]); 69616 return maybe[0]; 69617 } 69618 69619 if (mustWarn && !this.warned.has(fontName)) { 69620 this.warned.add(fontName); 69621 (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`); 69622 } 69623 69624 return null; 69625 } 69626 69627} 69628 69629exports.FontFinder = FontFinder; 69630 69631function selectFont(xfaFont, typeface) { 69632 if (xfaFont.posture === "italic") { 69633 if (xfaFont.weight === "bold") { 69634 return typeface.bolditalic; 69635 } 69636 69637 return typeface.italic; 69638 } else if (xfaFont.weight === "bold") { 69639 return typeface.bold; 69640 } 69641 69642 return typeface.regular; 69643} 69644 69645function getMetrics(xfaFont, real = false) { 69646 let pdfFont = null; 69647 69648 if (xfaFont) { 69649 const name = (0, _utils.stripQuotes)(xfaFont.typeface); 69650 69651 const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name); 69652 69653 pdfFont = selectFont(xfaFont, typeface); 69654 } 69655 69656 if (!pdfFont) { 69657 return { 69658 lineHeight: 12, 69659 lineGap: 2, 69660 lineNoGap: 10 69661 }; 69662 } 69663 69664 const size = xfaFont.size || 10; 69665 const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2; 69666 const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap; 69667 return { 69668 lineHeight: lineHeight * size, 69669 lineGap: lineGap * size, 69670 lineNoGap: Math.max(1, lineHeight - lineGap) * size 69671 }; 69672} 69673 69674/***/ }), 69675/* 86 */ 69676/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 69677 69678 69679 69680Object.defineProperty(exports, "__esModule", ({ 69681 value: true 69682})); 69683exports.TextMeasure = void 0; 69684 69685var _fonts = __w_pdfjs_require__(85); 69686 69687const WIDTH_FACTOR = 1.02; 69688 69689class FontInfo { 69690 constructor(xfaFont, margin, lineHeight, fontFinder) { 69691 this.lineHeight = lineHeight; 69692 this.paraMargin = margin || { 69693 top: 0, 69694 bottom: 0, 69695 left: 0, 69696 right: 0 69697 }; 69698 69699 if (!xfaFont) { 69700 [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); 69701 return; 69702 } 69703 69704 this.xfaFont = { 69705 typeface: xfaFont.typeface, 69706 posture: xfaFont.posture, 69707 weight: xfaFont.weight, 69708 size: xfaFont.size, 69709 letterSpacing: xfaFont.letterSpacing 69710 }; 69711 const typeface = fontFinder.find(xfaFont.typeface); 69712 69713 if (!typeface) { 69714 [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); 69715 return; 69716 } 69717 69718 this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface); 69719 69720 if (!this.pdfFont) { 69721 [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); 69722 } 69723 } 69724 69725 defaultFont(fontFinder) { 69726 const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault(); 69727 69728 if (font && font.regular) { 69729 const pdfFont = font.regular; 69730 const info = pdfFont.cssFontInfo; 69731 const xfaFont = { 69732 typeface: info.fontFamily, 69733 posture: "normal", 69734 weight: "normal", 69735 size: 10, 69736 letterSpacing: 0 69737 }; 69738 return [pdfFont, xfaFont]; 69739 } 69740 69741 const xfaFont = { 69742 typeface: "Courier", 69743 posture: "normal", 69744 weight: "normal", 69745 size: 10, 69746 letterSpacing: 0 69747 }; 69748 return [null, xfaFont]; 69749 } 69750 69751} 69752 69753class FontSelector { 69754 constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) { 69755 this.fontFinder = fontFinder; 69756 this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)]; 69757 } 69758 69759 pushData(xfaFont, margin, lineHeight) { 69760 const lastFont = this.stack.at(-1); 69761 69762 for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) { 69763 if (!xfaFont[name]) { 69764 xfaFont[name] = lastFont.xfaFont[name]; 69765 } 69766 } 69767 69768 for (const name of ["top", "bottom", "left", "right"]) { 69769 if (isNaN(margin[name])) { 69770 margin[name] = lastFont.paraMargin[name]; 69771 } 69772 } 69773 69774 const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder); 69775 69776 if (!fontInfo.pdfFont) { 69777 fontInfo.pdfFont = lastFont.pdfFont; 69778 } 69779 69780 this.stack.push(fontInfo); 69781 } 69782 69783 popFont() { 69784 this.stack.pop(); 69785 } 69786 69787 topFont() { 69788 return this.stack.at(-1); 69789 } 69790 69791} 69792 69793class TextMeasure { 69794 constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) { 69795 this.glyphs = []; 69796 this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts); 69797 this.extraHeight = 0; 69798 } 69799 69800 pushData(xfaFont, margin, lineHeight) { 69801 this.fontSelector.pushData(xfaFont, margin, lineHeight); 69802 } 69803 69804 popFont(xfaFont) { 69805 return this.fontSelector.popFont(); 69806 } 69807 69808 addPara() { 69809 const lastFont = this.fontSelector.topFont(); 69810 this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom; 69811 } 69812 69813 addString(str) { 69814 if (!str) { 69815 return; 69816 } 69817 69818 const lastFont = this.fontSelector.topFont(); 69819 const fontSize = lastFont.xfaFont.size; 69820 69821 if (lastFont.pdfFont) { 69822 const letterSpacing = lastFont.xfaFont.letterSpacing; 69823 const pdfFont = lastFont.pdfFont; 69824 const fontLineHeight = pdfFont.lineHeight || 1.2; 69825 const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize; 69826 const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap; 69827 const noGap = fontLineHeight - lineGap; 69828 const firstLineHeight = Math.max(1, noGap) * fontSize; 69829 const scale = fontSize / 1000; 69830 const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width; 69831 69832 for (const line of str.split(/[\u2029\n]/)) { 69833 const encodedLine = pdfFont.encodeString(line).join(""); 69834 const glyphs = pdfFont.charsToGlyphs(encodedLine); 69835 69836 for (const glyph of glyphs) { 69837 const width = glyph.width || fallbackWidth; 69838 this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]); 69839 } 69840 69841 this.glyphs.push([0, 0, 0, "\n", true]); 69842 } 69843 69844 this.glyphs.pop(); 69845 return; 69846 } 69847 69848 for (const line of str.split(/[\u2029\n]/)) { 69849 for (const char of line.split("")) { 69850 this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]); 69851 } 69852 69853 this.glyphs.push([0, 0, 0, "\n", true]); 69854 } 69855 69856 this.glyphs.pop(); 69857 } 69858 69859 compute(maxWidth) { 69860 let lastSpacePos = -1, 69861 lastSpaceWidth = 0, 69862 width = 0, 69863 height = 0, 69864 currentLineWidth = 0, 69865 currentLineHeight = 0; 69866 let isBroken = false; 69867 let isFirstLine = true; 69868 69869 for (let i = 0, ii = this.glyphs.length; i < ii; i++) { 69870 const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i]; 69871 const isSpace = char === " "; 69872 const glyphHeight = isFirstLine ? firstLineHeight : lineHeight; 69873 69874 if (isEOL) { 69875 width = Math.max(width, currentLineWidth); 69876 currentLineWidth = 0; 69877 height += currentLineHeight; 69878 currentLineHeight = glyphHeight; 69879 lastSpacePos = -1; 69880 lastSpaceWidth = 0; 69881 isFirstLine = false; 69882 continue; 69883 } 69884 69885 if (isSpace) { 69886 if (currentLineWidth + glyphWidth > maxWidth) { 69887 width = Math.max(width, currentLineWidth); 69888 currentLineWidth = 0; 69889 height += currentLineHeight; 69890 currentLineHeight = glyphHeight; 69891 lastSpacePos = -1; 69892 lastSpaceWidth = 0; 69893 isBroken = true; 69894 isFirstLine = false; 69895 } else { 69896 currentLineHeight = Math.max(glyphHeight, currentLineHeight); 69897 lastSpaceWidth = currentLineWidth; 69898 currentLineWidth += glyphWidth; 69899 lastSpacePos = i; 69900 } 69901 69902 continue; 69903 } 69904 69905 if (currentLineWidth + glyphWidth > maxWidth) { 69906 height += currentLineHeight; 69907 currentLineHeight = glyphHeight; 69908 69909 if (lastSpacePos !== -1) { 69910 i = lastSpacePos; 69911 width = Math.max(width, lastSpaceWidth); 69912 currentLineWidth = 0; 69913 lastSpacePos = -1; 69914 lastSpaceWidth = 0; 69915 } else { 69916 width = Math.max(width, currentLineWidth); 69917 currentLineWidth = glyphWidth; 69918 } 69919 69920 isBroken = true; 69921 isFirstLine = false; 69922 continue; 69923 } 69924 69925 currentLineWidth += glyphWidth; 69926 currentLineHeight = Math.max(glyphHeight, currentLineHeight); 69927 } 69928 69929 width = Math.max(width, currentLineWidth); 69930 height += currentLineHeight + this.extraHeight; 69931 return { 69932 width: WIDTH_FACTOR * width, 69933 height, 69934 isBroken 69935 }; 69936 } 69937 69938} 69939 69940exports.TextMeasure = TextMeasure; 69941 69942/***/ }), 69943/* 87 */ 69944/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 69945 69946 69947 69948Object.defineProperty(exports, "__esModule", ({ 69949 value: true 69950})); 69951exports.DataHandler = void 0; 69952 69953var _xfa_object = __w_pdfjs_require__(77); 69954 69955class DataHandler { 69956 constructor(root, data) { 69957 this.data = data; 69958 this.dataset = root.datasets || null; 69959 } 69960 69961 serialize(storage) { 69962 const stack = [[-1, this.data[_xfa_object.$getChildren]()]]; 69963 69964 while (stack.length > 0) { 69965 const last = stack.at(-1); 69966 const [i, children] = last; 69967 69968 if (i + 1 === children.length) { 69969 stack.pop(); 69970 continue; 69971 } 69972 69973 const child = children[++last[0]]; 69974 const storageEntry = storage.get(child[_xfa_object.$uid]); 69975 69976 if (storageEntry) { 69977 child[_xfa_object.$setValue](storageEntry); 69978 } else { 69979 const attributes = child[_xfa_object.$getAttributes](); 69980 69981 for (const value of attributes.values()) { 69982 const entry = storage.get(value[_xfa_object.$uid]); 69983 69984 if (entry) { 69985 value[_xfa_object.$setValue](entry); 69986 69987 break; 69988 } 69989 } 69990 } 69991 69992 const nodes = child[_xfa_object.$getChildren](); 69993 69994 if (nodes.length > 0) { 69995 stack.push([-1, nodes]); 69996 } 69997 } 69998 69999 const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`]; 70000 70001 if (this.dataset) { 70002 for (const child of this.dataset[_xfa_object.$getChildren]()) { 70003 if (child[_xfa_object.$nodeName] !== "data") { 70004 child[_xfa_object.$toString](buf); 70005 } 70006 } 70007 } 70008 70009 this.data[_xfa_object.$toString](buf); 70010 70011 buf.push("</xfa:datasets>"); 70012 return buf.join(""); 70013 } 70014 70015} 70016 70017exports.DataHandler = DataHandler; 70018 70019/***/ }), 70020/* 88 */ 70021/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 70022 70023 70024 70025Object.defineProperty(exports, "__esModule", ({ 70026 value: true 70027})); 70028exports.XFAParser = void 0; 70029 70030var _xfa_object = __w_pdfjs_require__(77); 70031 70032var _xml_parser = __w_pdfjs_require__(66); 70033 70034var _builder = __w_pdfjs_require__(89); 70035 70036var _util = __w_pdfjs_require__(2); 70037 70038class XFAParser extends _xml_parser.XMLParserBase { 70039 constructor(rootNameSpace = null, richText = false) { 70040 super(); 70041 this._builder = new _builder.Builder(rootNameSpace); 70042 this._stack = []; 70043 this._globalData = { 70044 usedTypefaces: new Set() 70045 }; 70046 this._ids = new Map(); 70047 this._current = this._builder.buildRoot(this._ids); 70048 this._errorCode = _xml_parser.XMLParserErrorCode.NoError; 70049 this._whiteRegex = /^\s+$/; 70050 this._nbsps = /\xa0+/g; 70051 this._richText = richText; 70052 } 70053 70054 parse(data) { 70055 this.parseXml(data); 70056 70057 if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) { 70058 return undefined; 70059 } 70060 70061 this._current[_xfa_object.$finalize](); 70062 70063 return this._current.element; 70064 } 70065 70066 onText(text) { 70067 text = text.replace(this._nbsps, match => match.slice(1) + " "); 70068 70069 if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) { 70070 this._current[_xfa_object.$onText](text, this._richText); 70071 70072 return; 70073 } 70074 70075 if (this._whiteRegex.test(text)) { 70076 return; 70077 } 70078 70079 this._current[_xfa_object.$onText](text.trim()); 70080 } 70081 70082 onCdata(text) { 70083 this._current[_xfa_object.$onText](text); 70084 } 70085 70086 _mkAttributes(attributes, tagName) { 70087 let namespace = null; 70088 let prefixes = null; 70089 const attributeObj = Object.create({}); 70090 70091 for (const { 70092 name, 70093 value 70094 } of attributes) { 70095 if (name === "xmlns") { 70096 if (!namespace) { 70097 namespace = value; 70098 } else { 70099 (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`); 70100 } 70101 } else if (name.startsWith("xmlns:")) { 70102 const prefix = name.substring("xmlns:".length); 70103 70104 if (!prefixes) { 70105 prefixes = []; 70106 } 70107 70108 prefixes.push({ 70109 prefix, 70110 value 70111 }); 70112 } else { 70113 const i = name.indexOf(":"); 70114 70115 if (i === -1) { 70116 attributeObj[name] = value; 70117 } else { 70118 let nsAttrs = attributeObj[_xfa_object.$nsAttributes]; 70119 70120 if (!nsAttrs) { 70121 nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null); 70122 } 70123 70124 const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)]; 70125 let attrs = nsAttrs[ns]; 70126 70127 if (!attrs) { 70128 attrs = nsAttrs[ns] = Object.create(null); 70129 } 70130 70131 attrs[attrName] = value; 70132 } 70133 } 70134 } 70135 70136 return [namespace, prefixes, attributeObj]; 70137 } 70138 70139 _getNameAndPrefix(name, nsAgnostic) { 70140 const i = name.indexOf(":"); 70141 70142 if (i === -1) { 70143 return [name, null]; 70144 } 70145 70146 return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)]; 70147 } 70148 70149 onBeginElement(tagName, attributes, isEmpty) { 70150 const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName); 70151 70152 const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic()); 70153 70154 const node = this._builder.build({ 70155 nsPrefix, 70156 name, 70157 attributes: attributesObj, 70158 namespace, 70159 prefixes 70160 }); 70161 70162 node[_xfa_object.$globalData] = this._globalData; 70163 70164 if (isEmpty) { 70165 node[_xfa_object.$finalize](); 70166 70167 if (this._current[_xfa_object.$onChild](node)) { 70168 node[_xfa_object.$setId](this._ids); 70169 } 70170 70171 node[_xfa_object.$clean](this._builder); 70172 70173 return; 70174 } 70175 70176 this._stack.push(this._current); 70177 70178 this._current = node; 70179 } 70180 70181 onEndElement(name) { 70182 const node = this._current; 70183 70184 if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") { 70185 const parser = new XFAParser(); 70186 parser._globalData = this._globalData; 70187 const root = parser.parse(node[_xfa_object.$content]); 70188 node[_xfa_object.$content] = null; 70189 70190 node[_xfa_object.$onChild](root); 70191 } 70192 70193 node[_xfa_object.$finalize](); 70194 70195 this._current = this._stack.pop(); 70196 70197 if (this._current[_xfa_object.$onChild](node)) { 70198 node[_xfa_object.$setId](this._ids); 70199 } 70200 70201 node[_xfa_object.$clean](this._builder); 70202 } 70203 70204 onError(code) { 70205 this._errorCode = code; 70206 } 70207 70208} 70209 70210exports.XFAParser = XFAParser; 70211 70212/***/ }), 70213/* 89 */ 70214/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 70215 70216 70217 70218Object.defineProperty(exports, "__esModule", ({ 70219 value: true 70220})); 70221exports.Builder = void 0; 70222 70223var _namespaces = __w_pdfjs_require__(79); 70224 70225var _xfa_object = __w_pdfjs_require__(77); 70226 70227var _setup = __w_pdfjs_require__(90); 70228 70229var _template = __w_pdfjs_require__(82); 70230 70231var _unknown = __w_pdfjs_require__(99); 70232 70233var _util = __w_pdfjs_require__(2); 70234 70235class Root extends _xfa_object.XFAObject { 70236 constructor(ids) { 70237 super(-1, "root", Object.create(null)); 70238 this.element = null; 70239 this[_xfa_object.$ids] = ids; 70240 } 70241 70242 [_xfa_object.$onChild](child) { 70243 this.element = child; 70244 return true; 70245 } 70246 70247 [_xfa_object.$finalize]() { 70248 super[_xfa_object.$finalize](); 70249 70250 if (this.element.template instanceof _template.Template) { 70251 this[_xfa_object.$ids].set(_xfa_object.$root, this.element); 70252 70253 this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]); 70254 70255 this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids]; 70256 } 70257 } 70258 70259} 70260 70261class Empty extends _xfa_object.XFAObject { 70262 constructor() { 70263 super(-1, "", Object.create(null)); 70264 } 70265 70266 [_xfa_object.$onChild](_) { 70267 return false; 70268 } 70269 70270} 70271 70272class Builder { 70273 constructor(rootNameSpace = null) { 70274 this._namespaceStack = []; 70275 this._nsAgnosticLevel = 0; 70276 this._namespacePrefixes = new Map(); 70277 this._namespaces = new Map(); 70278 this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({ 70279 id 70280 }) => id)); 70281 this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId); 70282 } 70283 70284 buildRoot(ids) { 70285 return new Root(ids); 70286 } 70287 70288 build({ 70289 nsPrefix, 70290 name, 70291 attributes, 70292 namespace, 70293 prefixes 70294 }) { 70295 const hasNamespaceDef = namespace !== null; 70296 70297 if (hasNamespaceDef) { 70298 this._namespaceStack.push(this._currentNamespace); 70299 70300 this._currentNamespace = this._searchNamespace(namespace); 70301 } 70302 70303 if (prefixes) { 70304 this._addNamespacePrefix(prefixes); 70305 } 70306 70307 if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) { 70308 const dataTemplate = _setup.NamespaceSetUp.datasets; 70309 const nsAttrs = attributes[_xfa_object.$nsAttributes]; 70310 let xfaAttrs = null; 70311 70312 for (const [ns, attrs] of Object.entries(nsAttrs)) { 70313 const nsToUse = this._getNamespaceToUse(ns); 70314 70315 if (nsToUse === dataTemplate) { 70316 xfaAttrs = { 70317 xfa: attrs 70318 }; 70319 break; 70320 } 70321 } 70322 70323 if (xfaAttrs) { 70324 attributes[_xfa_object.$nsAttributes] = xfaAttrs; 70325 } else { 70326 delete attributes[_xfa_object.$nsAttributes]; 70327 } 70328 } 70329 70330 const namespaceToUse = this._getNamespaceToUse(nsPrefix); 70331 70332 const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty(); 70333 70334 if (node[_xfa_object.$isNsAgnostic]()) { 70335 this._nsAgnosticLevel++; 70336 } 70337 70338 if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) { 70339 node[_xfa_object.$cleanup] = { 70340 hasNamespace: hasNamespaceDef, 70341 prefixes, 70342 nsAgnostic: node[_xfa_object.$isNsAgnostic]() 70343 }; 70344 } 70345 70346 return node; 70347 } 70348 70349 isNsAgnostic() { 70350 return this._nsAgnosticLevel > 0; 70351 } 70352 70353 _searchNamespace(nsName) { 70354 let ns = this._namespaces.get(nsName); 70355 70356 if (ns) { 70357 return ns; 70358 } 70359 70360 for (const [name, { 70361 check 70362 }] of Object.entries(_namespaces.NamespaceIds)) { 70363 if (check(nsName)) { 70364 ns = _setup.NamespaceSetUp[name]; 70365 70366 if (ns) { 70367 this._namespaces.set(nsName, ns); 70368 70369 return ns; 70370 } 70371 70372 break; 70373 } 70374 } 70375 70376 ns = new _unknown.UnknownNamespace(++this._nextNsId); 70377 70378 this._namespaces.set(nsName, ns); 70379 70380 return ns; 70381 } 70382 70383 _addNamespacePrefix(prefixes) { 70384 for (const { 70385 prefix, 70386 value 70387 } of prefixes) { 70388 const namespace = this._searchNamespace(value); 70389 70390 let prefixStack = this._namespacePrefixes.get(prefix); 70391 70392 if (!prefixStack) { 70393 prefixStack = []; 70394 70395 this._namespacePrefixes.set(prefix, prefixStack); 70396 } 70397 70398 prefixStack.push(namespace); 70399 } 70400 } 70401 70402 _getNamespaceToUse(prefix) { 70403 if (!prefix) { 70404 return this._currentNamespace; 70405 } 70406 70407 const prefixStack = this._namespacePrefixes.get(prefix); 70408 70409 if (prefixStack && prefixStack.length > 0) { 70410 return prefixStack.at(-1); 70411 } 70412 70413 (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`); 70414 return null; 70415 } 70416 70417 clean(data) { 70418 const { 70419 hasNamespace, 70420 prefixes, 70421 nsAgnostic 70422 } = data; 70423 70424 if (hasNamespace) { 70425 this._currentNamespace = this._namespaceStack.pop(); 70426 } 70427 70428 if (prefixes) { 70429 prefixes.forEach(({ 70430 prefix 70431 }) => { 70432 this._namespacePrefixes.get(prefix).pop(); 70433 }); 70434 } 70435 70436 if (nsAgnostic) { 70437 this._nsAgnosticLevel--; 70438 } 70439 } 70440 70441} 70442 70443exports.Builder = Builder; 70444 70445/***/ }), 70446/* 90 */ 70447/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 70448 70449 70450 70451Object.defineProperty(exports, "__esModule", ({ 70452 value: true 70453})); 70454exports.NamespaceSetUp = void 0; 70455 70456var _config = __w_pdfjs_require__(91); 70457 70458var _connection_set = __w_pdfjs_require__(92); 70459 70460var _datasets = __w_pdfjs_require__(93); 70461 70462var _locale_set = __w_pdfjs_require__(94); 70463 70464var _signature = __w_pdfjs_require__(95); 70465 70466var _stylesheet = __w_pdfjs_require__(96); 70467 70468var _template = __w_pdfjs_require__(82); 70469 70470var _xdp = __w_pdfjs_require__(97); 70471 70472var _xhtml = __w_pdfjs_require__(98); 70473 70474const NamespaceSetUp = { 70475 config: _config.ConfigNamespace, 70476 connection: _connection_set.ConnectionSetNamespace, 70477 datasets: _datasets.DatasetsNamespace, 70478 localeSet: _locale_set.LocaleSetNamespace, 70479 signature: _signature.SignatureNamespace, 70480 stylesheet: _stylesheet.StylesheetNamespace, 70481 template: _template.TemplateNamespace, 70482 xdp: _xdp.XdpNamespace, 70483 xhtml: _xhtml.XhtmlNamespace 70484}; 70485exports.NamespaceSetUp = NamespaceSetUp; 70486 70487/***/ }), 70488/* 91 */ 70489/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 70490 70491 70492 70493Object.defineProperty(exports, "__esModule", ({ 70494 value: true 70495})); 70496exports.ConfigNamespace = void 0; 70497 70498var _namespaces = __w_pdfjs_require__(79); 70499 70500var _xfa_object = __w_pdfjs_require__(77); 70501 70502var _utils = __w_pdfjs_require__(78); 70503 70504var _util = __w_pdfjs_require__(2); 70505 70506const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id; 70507 70508class Acrobat extends _xfa_object.XFAObject { 70509 constructor(attributes) { 70510 super(CONFIG_NS_ID, "acrobat", true); 70511 this.acrobat7 = null; 70512 this.autoSave = null; 70513 this.common = null; 70514 this.validate = null; 70515 this.validateApprovalSignatures = null; 70516 this.submitUrl = new _xfa_object.XFAObjectArray(); 70517 } 70518 70519} 70520 70521class Acrobat7 extends _xfa_object.XFAObject { 70522 constructor(attributes) { 70523 super(CONFIG_NS_ID, "acrobat7", true); 70524 this.dynamicRender = null; 70525 } 70526 70527} 70528 70529class ADBE_JSConsole extends _xfa_object.OptionObject { 70530 constructor(attributes) { 70531 super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]); 70532 } 70533 70534} 70535 70536class ADBE_JSDebugger extends _xfa_object.OptionObject { 70537 constructor(attributes) { 70538 super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]); 70539 } 70540 70541} 70542 70543class AddSilentPrint extends _xfa_object.Option01 { 70544 constructor(attributes) { 70545 super(CONFIG_NS_ID, "addSilentPrint"); 70546 } 70547 70548} 70549 70550class AddViewerPreferences extends _xfa_object.Option01 { 70551 constructor(attributes) { 70552 super(CONFIG_NS_ID, "addViewerPreferences"); 70553 } 70554 70555} 70556 70557class AdjustData extends _xfa_object.Option10 { 70558 constructor(attributes) { 70559 super(CONFIG_NS_ID, "adjustData"); 70560 } 70561 70562} 70563 70564class AdobeExtensionLevel extends _xfa_object.IntegerObject { 70565 constructor(attributes) { 70566 super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8); 70567 } 70568 70569} 70570 70571class Agent extends _xfa_object.XFAObject { 70572 constructor(attributes) { 70573 super(CONFIG_NS_ID, "agent", true); 70574 this.name = attributes.name ? attributes.name.trim() : ""; 70575 this.common = new _xfa_object.XFAObjectArray(); 70576 } 70577 70578} 70579 70580class AlwaysEmbed extends _xfa_object.ContentObject { 70581 constructor(attributes) { 70582 super(CONFIG_NS_ID, "alwaysEmbed"); 70583 } 70584 70585} 70586 70587class Amd extends _xfa_object.StringObject { 70588 constructor(attributes) { 70589 super(CONFIG_NS_ID, "amd"); 70590 } 70591 70592} 70593 70594class Area extends _xfa_object.XFAObject { 70595 constructor(attributes) { 70596 super(CONFIG_NS_ID, "area"); 70597 this.level = (0, _utils.getInteger)({ 70598 data: attributes.level, 70599 defaultValue: 0, 70600 validate: n => n >= 1 && n <= 3 70601 }); 70602 this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]); 70603 } 70604 70605} 70606 70607class Attributes extends _xfa_object.OptionObject { 70608 constructor(attributes) { 70609 super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]); 70610 } 70611 70612} 70613 70614class AutoSave extends _xfa_object.OptionObject { 70615 constructor(attributes) { 70616 super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]); 70617 } 70618 70619} 70620 70621class Base extends _xfa_object.StringObject { 70622 constructor(attributes) { 70623 super(CONFIG_NS_ID, "base"); 70624 } 70625 70626} 70627 70628class BatchOutput extends _xfa_object.XFAObject { 70629 constructor(attributes) { 70630 super(CONFIG_NS_ID, "batchOutput"); 70631 this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]); 70632 } 70633 70634} 70635 70636class BehaviorOverride extends _xfa_object.ContentObject { 70637 constructor(attributes) { 70638 super(CONFIG_NS_ID, "behaviorOverride"); 70639 } 70640 70641 [_xfa_object.$finalize]() { 70642 this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2))); 70643 } 70644 70645} 70646 70647class Cache extends _xfa_object.XFAObject { 70648 constructor(attributes) { 70649 super(CONFIG_NS_ID, "cache", true); 70650 this.templateCache = null; 70651 } 70652 70653} 70654 70655class Change extends _xfa_object.Option01 { 70656 constructor(attributes) { 70657 super(CONFIG_NS_ID, "change"); 70658 } 70659 70660} 70661 70662class Common extends _xfa_object.XFAObject { 70663 constructor(attributes) { 70664 super(CONFIG_NS_ID, "common", true); 70665 this.data = null; 70666 this.locale = null; 70667 this.localeSet = null; 70668 this.messaging = null; 70669 this.suppressBanner = null; 70670 this.template = null; 70671 this.validationMessaging = null; 70672 this.versionControl = null; 70673 this.log = new _xfa_object.XFAObjectArray(); 70674 } 70675 70676} 70677 70678class Compress extends _xfa_object.XFAObject { 70679 constructor(attributes) { 70680 super(CONFIG_NS_ID, "compress"); 70681 this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]); 70682 } 70683 70684} 70685 70686class CompressLogicalStructure extends _xfa_object.Option01 { 70687 constructor(attributes) { 70688 super(CONFIG_NS_ID, "compressLogicalStructure"); 70689 } 70690 70691} 70692 70693class CompressObjectStream extends _xfa_object.Option10 { 70694 constructor(attributes) { 70695 super(CONFIG_NS_ID, "compressObjectStream"); 70696 } 70697 70698} 70699 70700class Compression extends _xfa_object.XFAObject { 70701 constructor(attributes) { 70702 super(CONFIG_NS_ID, "compression", true); 70703 this.compressLogicalStructure = null; 70704 this.compressObjectStream = null; 70705 this.level = null; 70706 this.type = null; 70707 } 70708 70709} 70710 70711class Config extends _xfa_object.XFAObject { 70712 constructor(attributes) { 70713 super(CONFIG_NS_ID, "config", true); 70714 this.acrobat = null; 70715 this.present = null; 70716 this.trace = null; 70717 this.agent = new _xfa_object.XFAObjectArray(); 70718 } 70719 70720} 70721 70722class Conformance extends _xfa_object.OptionObject { 70723 constructor(attributes) { 70724 super(CONFIG_NS_ID, "conformance", ["A", "B"]); 70725 } 70726 70727} 70728 70729class ContentCopy extends _xfa_object.Option01 { 70730 constructor(attributes) { 70731 super(CONFIG_NS_ID, "contentCopy"); 70732 } 70733 70734} 70735 70736class Copies extends _xfa_object.IntegerObject { 70737 constructor(attributes) { 70738 super(CONFIG_NS_ID, "copies", 1, n => n >= 1); 70739 } 70740 70741} 70742 70743class Creator extends _xfa_object.StringObject { 70744 constructor(attributes) { 70745 super(CONFIG_NS_ID, "creator"); 70746 } 70747 70748} 70749 70750class CurrentPage extends _xfa_object.IntegerObject { 70751 constructor(attributes) { 70752 super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0); 70753 } 70754 70755} 70756 70757class Data extends _xfa_object.XFAObject { 70758 constructor(attributes) { 70759 super(CONFIG_NS_ID, "data", true); 70760 this.adjustData = null; 70761 this.attributes = null; 70762 this.incrementalLoad = null; 70763 this.outputXSL = null; 70764 this.range = null; 70765 this.record = null; 70766 this.startNode = null; 70767 this.uri = null; 70768 this.window = null; 70769 this.xsl = null; 70770 this.excludeNS = new _xfa_object.XFAObjectArray(); 70771 this.transform = new _xfa_object.XFAObjectArray(); 70772 } 70773 70774} 70775 70776class Debug extends _xfa_object.XFAObject { 70777 constructor(attributes) { 70778 super(CONFIG_NS_ID, "debug", true); 70779 this.uri = null; 70780 } 70781 70782} 70783 70784class DefaultTypeface extends _xfa_object.ContentObject { 70785 constructor(attributes) { 70786 super(CONFIG_NS_ID, "defaultTypeface"); 70787 this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]); 70788 } 70789 70790} 70791 70792class Destination extends _xfa_object.OptionObject { 70793 constructor(attributes) { 70794 super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]); 70795 } 70796 70797} 70798 70799class DocumentAssembly extends _xfa_object.Option01 { 70800 constructor(attributes) { 70801 super(CONFIG_NS_ID, "documentAssembly"); 70802 } 70803 70804} 70805 70806class Driver extends _xfa_object.XFAObject { 70807 constructor(attributes) { 70808 super(CONFIG_NS_ID, "driver", true); 70809 this.name = attributes.name ? attributes.name.trim() : ""; 70810 this.fontInfo = null; 70811 this.xdc = null; 70812 } 70813 70814} 70815 70816class DuplexOption extends _xfa_object.OptionObject { 70817 constructor(attributes) { 70818 super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]); 70819 } 70820 70821} 70822 70823class DynamicRender extends _xfa_object.OptionObject { 70824 constructor(attributes) { 70825 super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]); 70826 } 70827 70828} 70829 70830class Embed extends _xfa_object.Option01 { 70831 constructor(attributes) { 70832 super(CONFIG_NS_ID, "embed"); 70833 } 70834 70835} 70836 70837class Encrypt extends _xfa_object.Option01 { 70838 constructor(attributes) { 70839 super(CONFIG_NS_ID, "encrypt"); 70840 } 70841 70842} 70843 70844class Encryption extends _xfa_object.XFAObject { 70845 constructor(attributes) { 70846 super(CONFIG_NS_ID, "encryption", true); 70847 this.encrypt = null; 70848 this.encryptionLevel = null; 70849 this.permissions = null; 70850 } 70851 70852} 70853 70854class EncryptionLevel extends _xfa_object.OptionObject { 70855 constructor(attributes) { 70856 super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]); 70857 } 70858 70859} 70860 70861class Enforce extends _xfa_object.StringObject { 70862 constructor(attributes) { 70863 super(CONFIG_NS_ID, "enforce"); 70864 } 70865 70866} 70867 70868class Equate extends _xfa_object.XFAObject { 70869 constructor(attributes) { 70870 super(CONFIG_NS_ID, "equate"); 70871 this.force = (0, _utils.getInteger)({ 70872 data: attributes.force, 70873 defaultValue: 1, 70874 validate: n => n === 0 70875 }); 70876 this.from = attributes.from || ""; 70877 this.to = attributes.to || ""; 70878 } 70879 70880} 70881 70882class EquateRange extends _xfa_object.XFAObject { 70883 constructor(attributes) { 70884 super(CONFIG_NS_ID, "equateRange"); 70885 this.from = attributes.from || ""; 70886 this.to = attributes.to || ""; 70887 this._unicodeRange = attributes.unicodeRange || ""; 70888 } 70889 70890 get unicodeRange() { 70891 const ranges = []; 70892 const unicodeRegex = /U\+([0-9a-fA-F]+)/; 70893 const unicodeRange = this._unicodeRange; 70894 70895 for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) { 70896 range = range.split("-", 2).map(x => { 70897 const found = x.match(unicodeRegex); 70898 70899 if (!found) { 70900 return 0; 70901 } 70902 70903 return parseInt(found[1], 16); 70904 }); 70905 70906 if (range.length === 1) { 70907 range.push(range[0]); 70908 } 70909 70910 ranges.push(range); 70911 } 70912 70913 return (0, _util.shadow)(this, "unicodeRange", ranges); 70914 } 70915 70916} 70917 70918class Exclude extends _xfa_object.ContentObject { 70919 constructor(attributes) { 70920 super(CONFIG_NS_ID, "exclude"); 70921 } 70922 70923 [_xfa_object.$finalize]() { 70924 this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x)); 70925 } 70926 70927} 70928 70929class ExcludeNS extends _xfa_object.StringObject { 70930 constructor(attributes) { 70931 super(CONFIG_NS_ID, "excludeNS"); 70932 } 70933 70934} 70935 70936class FlipLabel extends _xfa_object.OptionObject { 70937 constructor(attributes) { 70938 super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]); 70939 } 70940 70941} 70942 70943class FontInfo extends _xfa_object.XFAObject { 70944 constructor(attributes) { 70945 super(CONFIG_NS_ID, "fontInfo", true); 70946 this.embed = null; 70947 this.map = null; 70948 this.subsetBelow = null; 70949 this.alwaysEmbed = new _xfa_object.XFAObjectArray(); 70950 this.defaultTypeface = new _xfa_object.XFAObjectArray(); 70951 this.neverEmbed = new _xfa_object.XFAObjectArray(); 70952 } 70953 70954} 70955 70956class FormFieldFilling extends _xfa_object.Option01 { 70957 constructor(attributes) { 70958 super(CONFIG_NS_ID, "formFieldFilling"); 70959 } 70960 70961} 70962 70963class GroupParent extends _xfa_object.StringObject { 70964 constructor(attributes) { 70965 super(CONFIG_NS_ID, "groupParent"); 70966 } 70967 70968} 70969 70970class IfEmpty extends _xfa_object.OptionObject { 70971 constructor(attributes) { 70972 super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]); 70973 } 70974 70975} 70976 70977class IncludeXDPContent extends _xfa_object.StringObject { 70978 constructor(attributes) { 70979 super(CONFIG_NS_ID, "includeXDPContent"); 70980 } 70981 70982} 70983 70984class IncrementalLoad extends _xfa_object.OptionObject { 70985 constructor(attributes) { 70986 super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]); 70987 } 70988 70989} 70990 70991class IncrementalMerge extends _xfa_object.Option01 { 70992 constructor(attributes) { 70993 super(CONFIG_NS_ID, "incrementalMerge"); 70994 } 70995 70996} 70997 70998class Interactive extends _xfa_object.Option01 { 70999 constructor(attributes) { 71000 super(CONFIG_NS_ID, "interactive"); 71001 } 71002 71003} 71004 71005class Jog extends _xfa_object.OptionObject { 71006 constructor(attributes) { 71007 super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]); 71008 } 71009 71010} 71011 71012class LabelPrinter extends _xfa_object.XFAObject { 71013 constructor(attributes) { 71014 super(CONFIG_NS_ID, "labelPrinter", true); 71015 this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]); 71016 this.batchOutput = null; 71017 this.flipLabel = null; 71018 this.fontInfo = null; 71019 this.xdc = null; 71020 } 71021 71022} 71023 71024class Layout extends _xfa_object.OptionObject { 71025 constructor(attributes) { 71026 super(CONFIG_NS_ID, "layout", ["paginate", "panel"]); 71027 } 71028 71029} 71030 71031class Level extends _xfa_object.IntegerObject { 71032 constructor(attributes) { 71033 super(CONFIG_NS_ID, "level", 0, n => n > 0); 71034 } 71035 71036} 71037 71038class Linearized extends _xfa_object.Option01 { 71039 constructor(attributes) { 71040 super(CONFIG_NS_ID, "linearized"); 71041 } 71042 71043} 71044 71045class Locale extends _xfa_object.StringObject { 71046 constructor(attributes) { 71047 super(CONFIG_NS_ID, "locale"); 71048 } 71049 71050} 71051 71052class LocaleSet extends _xfa_object.StringObject { 71053 constructor(attributes) { 71054 super(CONFIG_NS_ID, "localeSet"); 71055 } 71056 71057} 71058 71059class Log extends _xfa_object.XFAObject { 71060 constructor(attributes) { 71061 super(CONFIG_NS_ID, "log", true); 71062 this.mode = null; 71063 this.threshold = null; 71064 this.to = null; 71065 this.uri = null; 71066 } 71067 71068} 71069 71070class MapElement extends _xfa_object.XFAObject { 71071 constructor(attributes) { 71072 super(CONFIG_NS_ID, "map", true); 71073 this.equate = new _xfa_object.XFAObjectArray(); 71074 this.equateRange = new _xfa_object.XFAObjectArray(); 71075 } 71076 71077} 71078 71079class MediumInfo extends _xfa_object.XFAObject { 71080 constructor(attributes) { 71081 super(CONFIG_NS_ID, "mediumInfo", true); 71082 this.map = null; 71083 } 71084 71085} 71086 71087class Message extends _xfa_object.XFAObject { 71088 constructor(attributes) { 71089 super(CONFIG_NS_ID, "message", true); 71090 this.msgId = null; 71091 this.severity = null; 71092 } 71093 71094} 71095 71096class Messaging extends _xfa_object.XFAObject { 71097 constructor(attributes) { 71098 super(CONFIG_NS_ID, "messaging", true); 71099 this.message = new _xfa_object.XFAObjectArray(); 71100 } 71101 71102} 71103 71104class Mode extends _xfa_object.OptionObject { 71105 constructor(attributes) { 71106 super(CONFIG_NS_ID, "mode", ["append", "overwrite"]); 71107 } 71108 71109} 71110 71111class ModifyAnnots extends _xfa_object.Option01 { 71112 constructor(attributes) { 71113 super(CONFIG_NS_ID, "modifyAnnots"); 71114 } 71115 71116} 71117 71118class MsgId extends _xfa_object.IntegerObject { 71119 constructor(attributes) { 71120 super(CONFIG_NS_ID, "msgId", 1, n => n >= 1); 71121 } 71122 71123} 71124 71125class NameAttr extends _xfa_object.StringObject { 71126 constructor(attributes) { 71127 super(CONFIG_NS_ID, "nameAttr"); 71128 } 71129 71130} 71131 71132class NeverEmbed extends _xfa_object.ContentObject { 71133 constructor(attributes) { 71134 super(CONFIG_NS_ID, "neverEmbed"); 71135 } 71136 71137} 71138 71139class NumberOfCopies extends _xfa_object.IntegerObject { 71140 constructor(attributes) { 71141 super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5); 71142 } 71143 71144} 71145 71146class OpenAction extends _xfa_object.XFAObject { 71147 constructor(attributes) { 71148 super(CONFIG_NS_ID, "openAction", true); 71149 this.destination = null; 71150 } 71151 71152} 71153 71154class Output extends _xfa_object.XFAObject { 71155 constructor(attributes) { 71156 super(CONFIG_NS_ID, "output", true); 71157 this.to = null; 71158 this.type = null; 71159 this.uri = null; 71160 } 71161 71162} 71163 71164class OutputBin extends _xfa_object.StringObject { 71165 constructor(attributes) { 71166 super(CONFIG_NS_ID, "outputBin"); 71167 } 71168 71169} 71170 71171class OutputXSL extends _xfa_object.XFAObject { 71172 constructor(attributes) { 71173 super(CONFIG_NS_ID, "outputXSL", true); 71174 this.uri = null; 71175 } 71176 71177} 71178 71179class Overprint extends _xfa_object.OptionObject { 71180 constructor(attributes) { 71181 super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]); 71182 } 71183 71184} 71185 71186class Packets extends _xfa_object.StringObject { 71187 constructor(attributes) { 71188 super(CONFIG_NS_ID, "packets"); 71189 } 71190 71191 [_xfa_object.$finalize]() { 71192 if (this[_xfa_object.$content] === "*") { 71193 return; 71194 } 71195 71196 this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x)); 71197 } 71198 71199} 71200 71201class PageOffset extends _xfa_object.XFAObject { 71202 constructor(attributes) { 71203 super(CONFIG_NS_ID, "pageOffset"); 71204 this.x = (0, _utils.getInteger)({ 71205 data: attributes.x, 71206 defaultValue: "useXDCSetting", 71207 validate: n => true 71208 }); 71209 this.y = (0, _utils.getInteger)({ 71210 data: attributes.y, 71211 defaultValue: "useXDCSetting", 71212 validate: n => true 71213 }); 71214 } 71215 71216} 71217 71218class PageRange extends _xfa_object.StringObject { 71219 constructor(attributes) { 71220 super(CONFIG_NS_ID, "pageRange"); 71221 } 71222 71223 [_xfa_object.$finalize]() { 71224 const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10)); 71225 71226 const ranges = []; 71227 71228 for (let i = 0, ii = numbers.length; i < ii; i += 2) { 71229 ranges.push(numbers.slice(i, i + 2)); 71230 } 71231 71232 this[_xfa_object.$content] = ranges; 71233 } 71234 71235} 71236 71237class Pagination extends _xfa_object.OptionObject { 71238 constructor(attributes) { 71239 super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]); 71240 } 71241 71242} 71243 71244class PaginationOverride extends _xfa_object.OptionObject { 71245 constructor(attributes) { 71246 super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]); 71247 } 71248 71249} 71250 71251class Part extends _xfa_object.IntegerObject { 71252 constructor(attributes) { 71253 super(CONFIG_NS_ID, "part", 1, n => false); 71254 } 71255 71256} 71257 71258class Pcl extends _xfa_object.XFAObject { 71259 constructor(attributes) { 71260 super(CONFIG_NS_ID, "pcl", true); 71261 this.name = attributes.name || ""; 71262 this.batchOutput = null; 71263 this.fontInfo = null; 71264 this.jog = null; 71265 this.mediumInfo = null; 71266 this.outputBin = null; 71267 this.pageOffset = null; 71268 this.staple = null; 71269 this.xdc = null; 71270 } 71271 71272} 71273 71274class Pdf extends _xfa_object.XFAObject { 71275 constructor(attributes) { 71276 super(CONFIG_NS_ID, "pdf", true); 71277 this.name = attributes.name || ""; 71278 this.adobeExtensionLevel = null; 71279 this.batchOutput = null; 71280 this.compression = null; 71281 this.creator = null; 71282 this.encryption = null; 71283 this.fontInfo = null; 71284 this.interactive = null; 71285 this.linearized = null; 71286 this.openAction = null; 71287 this.pdfa = null; 71288 this.producer = null; 71289 this.renderPolicy = null; 71290 this.scriptModel = null; 71291 this.silentPrint = null; 71292 this.submitFormat = null; 71293 this.tagged = null; 71294 this.version = null; 71295 this.viewerPreferences = null; 71296 this.xdc = null; 71297 } 71298 71299} 71300 71301class Pdfa extends _xfa_object.XFAObject { 71302 constructor(attributes) { 71303 super(CONFIG_NS_ID, "pdfa", true); 71304 this.amd = null; 71305 this.conformance = null; 71306 this.includeXDPContent = null; 71307 this.part = null; 71308 } 71309 71310} 71311 71312class Permissions extends _xfa_object.XFAObject { 71313 constructor(attributes) { 71314 super(CONFIG_NS_ID, "permissions", true); 71315 this.accessibleContent = null; 71316 this.change = null; 71317 this.contentCopy = null; 71318 this.documentAssembly = null; 71319 this.formFieldFilling = null; 71320 this.modifyAnnots = null; 71321 this.plaintextMetadata = null; 71322 this.print = null; 71323 this.printHighQuality = null; 71324 } 71325 71326} 71327 71328class PickTrayByPDFSize extends _xfa_object.Option01 { 71329 constructor(attributes) { 71330 super(CONFIG_NS_ID, "pickTrayByPDFSize"); 71331 } 71332 71333} 71334 71335class Picture extends _xfa_object.StringObject { 71336 constructor(attributes) { 71337 super(CONFIG_NS_ID, "picture"); 71338 } 71339 71340} 71341 71342class PlaintextMetadata extends _xfa_object.Option01 { 71343 constructor(attributes) { 71344 super(CONFIG_NS_ID, "plaintextMetadata"); 71345 } 71346 71347} 71348 71349class Presence extends _xfa_object.OptionObject { 71350 constructor(attributes) { 71351 super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]); 71352 } 71353 71354} 71355 71356class Present extends _xfa_object.XFAObject { 71357 constructor(attributes) { 71358 super(CONFIG_NS_ID, "present", true); 71359 this.behaviorOverride = null; 71360 this.cache = null; 71361 this.common = null; 71362 this.copies = null; 71363 this.destination = null; 71364 this.incrementalMerge = null; 71365 this.layout = null; 71366 this.output = null; 71367 this.overprint = null; 71368 this.pagination = null; 71369 this.paginationOverride = null; 71370 this.script = null; 71371 this.validate = null; 71372 this.xdp = null; 71373 this.driver = new _xfa_object.XFAObjectArray(); 71374 this.labelPrinter = new _xfa_object.XFAObjectArray(); 71375 this.pcl = new _xfa_object.XFAObjectArray(); 71376 this.pdf = new _xfa_object.XFAObjectArray(); 71377 this.ps = new _xfa_object.XFAObjectArray(); 71378 this.submitUrl = new _xfa_object.XFAObjectArray(); 71379 this.webClient = new _xfa_object.XFAObjectArray(); 71380 this.zpl = new _xfa_object.XFAObjectArray(); 71381 } 71382 71383} 71384 71385class Print extends _xfa_object.Option01 { 71386 constructor(attributes) { 71387 super(CONFIG_NS_ID, "print"); 71388 } 71389 71390} 71391 71392class PrintHighQuality extends _xfa_object.Option01 { 71393 constructor(attributes) { 71394 super(CONFIG_NS_ID, "printHighQuality"); 71395 } 71396 71397} 71398 71399class PrintScaling extends _xfa_object.OptionObject { 71400 constructor(attributes) { 71401 super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]); 71402 } 71403 71404} 71405 71406class PrinterName extends _xfa_object.StringObject { 71407 constructor(attributes) { 71408 super(CONFIG_NS_ID, "printerName"); 71409 } 71410 71411} 71412 71413class Producer extends _xfa_object.StringObject { 71414 constructor(attributes) { 71415 super(CONFIG_NS_ID, "producer"); 71416 } 71417 71418} 71419 71420class Ps extends _xfa_object.XFAObject { 71421 constructor(attributes) { 71422 super(CONFIG_NS_ID, "ps", true); 71423 this.name = attributes.name || ""; 71424 this.batchOutput = null; 71425 this.fontInfo = null; 71426 this.jog = null; 71427 this.mediumInfo = null; 71428 this.outputBin = null; 71429 this.staple = null; 71430 this.xdc = null; 71431 } 71432 71433} 71434 71435class Range extends _xfa_object.ContentObject { 71436 constructor(attributes) { 71437 super(CONFIG_NS_ID, "range"); 71438 } 71439 71440 [_xfa_object.$finalize]() { 71441 this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(range => range.split("-").map(x => parseInt(x.trim(), 10))).filter(range => range.every(x => !isNaN(x))).map(range => { 71442 if (range.length === 1) { 71443 range.push(range[0]); 71444 } 71445 71446 return range; 71447 }); 71448 } 71449 71450} 71451 71452class Record extends _xfa_object.ContentObject { 71453 constructor(attributes) { 71454 super(CONFIG_NS_ID, "record"); 71455 } 71456 71457 [_xfa_object.$finalize]() { 71458 this[_xfa_object.$content] = this[_xfa_object.$content].trim(); 71459 const n = parseInt(this[_xfa_object.$content], 10); 71460 71461 if (!isNaN(n) && n >= 0) { 71462 this[_xfa_object.$content] = n; 71463 } 71464 } 71465 71466} 71467 71468class Relevant extends _xfa_object.ContentObject { 71469 constructor(attributes) { 71470 super(CONFIG_NS_ID, "relevant"); 71471 } 71472 71473 [_xfa_object.$finalize]() { 71474 this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/); 71475 } 71476 71477} 71478 71479class Rename extends _xfa_object.ContentObject { 71480 constructor(attributes) { 71481 super(CONFIG_NS_ID, "rename"); 71482 } 71483 71484 [_xfa_object.$finalize]() { 71485 this[_xfa_object.$content] = this[_xfa_object.$content].trim(); 71486 71487 if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) { 71488 (0, _util.warn)("XFA - Rename: invalid XFA name"); 71489 } 71490 } 71491 71492} 71493 71494class RenderPolicy extends _xfa_object.OptionObject { 71495 constructor(attributes) { 71496 super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]); 71497 } 71498 71499} 71500 71501class RunScripts extends _xfa_object.OptionObject { 71502 constructor(attributes) { 71503 super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]); 71504 } 71505 71506} 71507 71508class Script extends _xfa_object.XFAObject { 71509 constructor(attributes) { 71510 super(CONFIG_NS_ID, "script", true); 71511 this.currentPage = null; 71512 this.exclude = null; 71513 this.runScripts = null; 71514 } 71515 71516} 71517 71518class ScriptModel extends _xfa_object.OptionObject { 71519 constructor(attributes) { 71520 super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]); 71521 } 71522 71523} 71524 71525class Severity extends _xfa_object.OptionObject { 71526 constructor(attributes) { 71527 super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]); 71528 } 71529 71530} 71531 71532class SilentPrint extends _xfa_object.XFAObject { 71533 constructor(attributes) { 71534 super(CONFIG_NS_ID, "silentPrint", true); 71535 this.addSilentPrint = null; 71536 this.printerName = null; 71537 } 71538 71539} 71540 71541class Staple extends _xfa_object.XFAObject { 71542 constructor(attributes) { 71543 super(CONFIG_NS_ID, "staple"); 71544 this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]); 71545 } 71546 71547} 71548 71549class StartNode extends _xfa_object.StringObject { 71550 constructor(attributes) { 71551 super(CONFIG_NS_ID, "startNode"); 71552 } 71553 71554} 71555 71556class StartPage extends _xfa_object.IntegerObject { 71557 constructor(attributes) { 71558 super(CONFIG_NS_ID, "startPage", 0, n => true); 71559 } 71560 71561} 71562 71563class SubmitFormat extends _xfa_object.OptionObject { 71564 constructor(attributes) { 71565 super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]); 71566 } 71567 71568} 71569 71570class SubmitUrl extends _xfa_object.StringObject { 71571 constructor(attributes) { 71572 super(CONFIG_NS_ID, "submitUrl"); 71573 } 71574 71575} 71576 71577class SubsetBelow extends _xfa_object.IntegerObject { 71578 constructor(attributes) { 71579 super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100); 71580 } 71581 71582} 71583 71584class SuppressBanner extends _xfa_object.Option01 { 71585 constructor(attributes) { 71586 super(CONFIG_NS_ID, "suppressBanner"); 71587 } 71588 71589} 71590 71591class Tagged extends _xfa_object.Option01 { 71592 constructor(attributes) { 71593 super(CONFIG_NS_ID, "tagged"); 71594 } 71595 71596} 71597 71598class Template extends _xfa_object.XFAObject { 71599 constructor(attributes) { 71600 super(CONFIG_NS_ID, "template", true); 71601 this.base = null; 71602 this.relevant = null; 71603 this.startPage = null; 71604 this.uri = null; 71605 this.xsl = null; 71606 } 71607 71608} 71609 71610class Threshold extends _xfa_object.OptionObject { 71611 constructor(attributes) { 71612 super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]); 71613 } 71614 71615} 71616 71617class To extends _xfa_object.OptionObject { 71618 constructor(attributes) { 71619 super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]); 71620 } 71621 71622} 71623 71624class TemplateCache extends _xfa_object.XFAObject { 71625 constructor(attributes) { 71626 super(CONFIG_NS_ID, "templateCache"); 71627 this.maxEntries = (0, _utils.getInteger)({ 71628 data: attributes.maxEntries, 71629 defaultValue: 5, 71630 validate: n => n >= 0 71631 }); 71632 } 71633 71634} 71635 71636class Trace extends _xfa_object.XFAObject { 71637 constructor(attributes) { 71638 super(CONFIG_NS_ID, "trace", true); 71639 this.area = new _xfa_object.XFAObjectArray(); 71640 } 71641 71642} 71643 71644class Transform extends _xfa_object.XFAObject { 71645 constructor(attributes) { 71646 super(CONFIG_NS_ID, "transform", true); 71647 this.groupParent = null; 71648 this.ifEmpty = null; 71649 this.nameAttr = null; 71650 this.picture = null; 71651 this.presence = null; 71652 this.rename = null; 71653 this.whitespace = null; 71654 } 71655 71656} 71657 71658class Type extends _xfa_object.OptionObject { 71659 constructor(attributes) { 71660 super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]); 71661 } 71662 71663} 71664 71665class Uri extends _xfa_object.StringObject { 71666 constructor(attributes) { 71667 super(CONFIG_NS_ID, "uri"); 71668 } 71669 71670} 71671 71672class Validate extends _xfa_object.OptionObject { 71673 constructor(attributes) { 71674 super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]); 71675 } 71676 71677} 71678 71679class ValidateApprovalSignatures extends _xfa_object.ContentObject { 71680 constructor(attributes) { 71681 super(CONFIG_NS_ID, "validateApprovalSignatures"); 71682 } 71683 71684 [_xfa_object.$finalize]() { 71685 this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x)); 71686 } 71687 71688} 71689 71690class ValidationMessaging extends _xfa_object.OptionObject { 71691 constructor(attributes) { 71692 super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]); 71693 } 71694 71695} 71696 71697class Version extends _xfa_object.OptionObject { 71698 constructor(attributes) { 71699 super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]); 71700 } 71701 71702} 71703 71704class VersionControl extends _xfa_object.XFAObject { 71705 constructor(attributes) { 71706 super(CONFIG_NS_ID, "VersionControl"); 71707 this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]); 71708 this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]); 71709 this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]); 71710 } 71711 71712} 71713 71714class ViewerPreferences extends _xfa_object.XFAObject { 71715 constructor(attributes) { 71716 super(CONFIG_NS_ID, "viewerPreferences", true); 71717 this.ADBE_JSConsole = null; 71718 this.ADBE_JSDebugger = null; 71719 this.addViewerPreferences = null; 71720 this.duplexOption = null; 71721 this.enforce = null; 71722 this.numberOfCopies = null; 71723 this.pageRange = null; 71724 this.pickTrayByPDFSize = null; 71725 this.printScaling = null; 71726 } 71727 71728} 71729 71730class WebClient extends _xfa_object.XFAObject { 71731 constructor(attributes) { 71732 super(CONFIG_NS_ID, "webClient", true); 71733 this.name = attributes.name ? attributes.name.trim() : ""; 71734 this.fontInfo = null; 71735 this.xdc = null; 71736 } 71737 71738} 71739 71740class Whitespace extends _xfa_object.OptionObject { 71741 constructor(attributes) { 71742 super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]); 71743 } 71744 71745} 71746 71747class Window extends _xfa_object.ContentObject { 71748 constructor(attributes) { 71749 super(CONFIG_NS_ID, "window"); 71750 } 71751 71752 [_xfa_object.$finalize]() { 71753 const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10)); 71754 71755 if (pair.some(x => isNaN(x))) { 71756 this[_xfa_object.$content] = [0, 0]; 71757 return; 71758 } 71759 71760 if (pair.length === 1) { 71761 pair.push(pair[0]); 71762 } 71763 71764 this[_xfa_object.$content] = pair; 71765 } 71766 71767} 71768 71769class Xdc extends _xfa_object.XFAObject { 71770 constructor(attributes) { 71771 super(CONFIG_NS_ID, "xdc", true); 71772 this.uri = new _xfa_object.XFAObjectArray(); 71773 this.xsl = new _xfa_object.XFAObjectArray(); 71774 } 71775 71776} 71777 71778class Xdp extends _xfa_object.XFAObject { 71779 constructor(attributes) { 71780 super(CONFIG_NS_ID, "xdp", true); 71781 this.packets = null; 71782 } 71783 71784} 71785 71786class Xsl extends _xfa_object.XFAObject { 71787 constructor(attributes) { 71788 super(CONFIG_NS_ID, "xsl", true); 71789 this.debug = null; 71790 this.uri = null; 71791 } 71792 71793} 71794 71795class Zpl extends _xfa_object.XFAObject { 71796 constructor(attributes) { 71797 super(CONFIG_NS_ID, "zpl", true); 71798 this.name = attributes.name ? attributes.name.trim() : ""; 71799 this.batchOutput = null; 71800 this.flipLabel = null; 71801 this.fontInfo = null; 71802 this.xdc = null; 71803 } 71804 71805} 71806 71807class ConfigNamespace { 71808 static [_namespaces.$buildXFAObject](name, attributes) { 71809 if (ConfigNamespace.hasOwnProperty(name)) { 71810 return ConfigNamespace[name](attributes); 71811 } 71812 71813 return undefined; 71814 } 71815 71816 static acrobat(attrs) { 71817 return new Acrobat(attrs); 71818 } 71819 71820 static acrobat7(attrs) { 71821 return new Acrobat7(attrs); 71822 } 71823 71824 static ADBE_JSConsole(attrs) { 71825 return new ADBE_JSConsole(attrs); 71826 } 71827 71828 static ADBE_JSDebugger(attrs) { 71829 return new ADBE_JSDebugger(attrs); 71830 } 71831 71832 static addSilentPrint(attrs) { 71833 return new AddSilentPrint(attrs); 71834 } 71835 71836 static addViewerPreferences(attrs) { 71837 return new AddViewerPreferences(attrs); 71838 } 71839 71840 static adjustData(attrs) { 71841 return new AdjustData(attrs); 71842 } 71843 71844 static adobeExtensionLevel(attrs) { 71845 return new AdobeExtensionLevel(attrs); 71846 } 71847 71848 static agent(attrs) { 71849 return new Agent(attrs); 71850 } 71851 71852 static alwaysEmbed(attrs) { 71853 return new AlwaysEmbed(attrs); 71854 } 71855 71856 static amd(attrs) { 71857 return new Amd(attrs); 71858 } 71859 71860 static area(attrs) { 71861 return new Area(attrs); 71862 } 71863 71864 static attributes(attrs) { 71865 return new Attributes(attrs); 71866 } 71867 71868 static autoSave(attrs) { 71869 return new AutoSave(attrs); 71870 } 71871 71872 static base(attrs) { 71873 return new Base(attrs); 71874 } 71875 71876 static batchOutput(attrs) { 71877 return new BatchOutput(attrs); 71878 } 71879 71880 static behaviorOverride(attrs) { 71881 return new BehaviorOverride(attrs); 71882 } 71883 71884 static cache(attrs) { 71885 return new Cache(attrs); 71886 } 71887 71888 static change(attrs) { 71889 return new Change(attrs); 71890 } 71891 71892 static common(attrs) { 71893 return new Common(attrs); 71894 } 71895 71896 static compress(attrs) { 71897 return new Compress(attrs); 71898 } 71899 71900 static compressLogicalStructure(attrs) { 71901 return new CompressLogicalStructure(attrs); 71902 } 71903 71904 static compressObjectStream(attrs) { 71905 return new CompressObjectStream(attrs); 71906 } 71907 71908 static compression(attrs) { 71909 return new Compression(attrs); 71910 } 71911 71912 static config(attrs) { 71913 return new Config(attrs); 71914 } 71915 71916 static conformance(attrs) { 71917 return new Conformance(attrs); 71918 } 71919 71920 static contentCopy(attrs) { 71921 return new ContentCopy(attrs); 71922 } 71923 71924 static copies(attrs) { 71925 return new Copies(attrs); 71926 } 71927 71928 static creator(attrs) { 71929 return new Creator(attrs); 71930 } 71931 71932 static currentPage(attrs) { 71933 return new CurrentPage(attrs); 71934 } 71935 71936 static data(attrs) { 71937 return new Data(attrs); 71938 } 71939 71940 static debug(attrs) { 71941 return new Debug(attrs); 71942 } 71943 71944 static defaultTypeface(attrs) { 71945 return new DefaultTypeface(attrs); 71946 } 71947 71948 static destination(attrs) { 71949 return new Destination(attrs); 71950 } 71951 71952 static documentAssembly(attrs) { 71953 return new DocumentAssembly(attrs); 71954 } 71955 71956 static driver(attrs) { 71957 return new Driver(attrs); 71958 } 71959 71960 static duplexOption(attrs) { 71961 return new DuplexOption(attrs); 71962 } 71963 71964 static dynamicRender(attrs) { 71965 return new DynamicRender(attrs); 71966 } 71967 71968 static embed(attrs) { 71969 return new Embed(attrs); 71970 } 71971 71972 static encrypt(attrs) { 71973 return new Encrypt(attrs); 71974 } 71975 71976 static encryption(attrs) { 71977 return new Encryption(attrs); 71978 } 71979 71980 static encryptionLevel(attrs) { 71981 return new EncryptionLevel(attrs); 71982 } 71983 71984 static enforce(attrs) { 71985 return new Enforce(attrs); 71986 } 71987 71988 static equate(attrs) { 71989 return new Equate(attrs); 71990 } 71991 71992 static equateRange(attrs) { 71993 return new EquateRange(attrs); 71994 } 71995 71996 static exclude(attrs) { 71997 return new Exclude(attrs); 71998 } 71999 72000 static excludeNS(attrs) { 72001 return new ExcludeNS(attrs); 72002 } 72003 72004 static flipLabel(attrs) { 72005 return new FlipLabel(attrs); 72006 } 72007 72008 static fontInfo(attrs) { 72009 return new FontInfo(attrs); 72010 } 72011 72012 static formFieldFilling(attrs) {
72013 return new FormFieldFilling(attrs); 72014 } 72015 72016 static groupParent(attrs) { 72017 return new GroupParent(attrs); 72018 } 72019 72020 static ifEmpty(attrs) { 72021 return new IfEmpty(attrs); 72022 } 72023 72024 static includeXDPContent(attrs) { 72025 return new IncludeXDPContent(attrs); 72026 } 72027 72028 static incrementalLoad(attrs) { 72029 return new IncrementalLoad(attrs); 72030 } 72031 72032 static incrementalMerge(attrs) { 72033 return new IncrementalMerge(attrs); 72034 } 72035 72036 static interactive(attrs) { 72037 return new Interactive(attrs); 72038 } 72039 72040 static jog(attrs) { 72041 return new Jog(attrs); 72042 } 72043 72044 static labelPrinter(attrs) { 72045 return new LabelPrinter(attrs); 72046 } 72047 72048 static layout(attrs) { 72049 return new Layout(attrs); 72050 } 72051 72052 static level(attrs) { 72053 return new Level(attrs); 72054 } 72055 72056 static linearized(attrs) { 72057 return new Linearized(attrs); 72058 } 72059 72060 static locale(attrs) { 72061 return new Locale(attrs); 72062 } 72063 72064 static localeSet(attrs) { 72065 return new LocaleSet(attrs); 72066 } 72067 72068 static log(attrs) { 72069 return new Log(attrs); 72070 } 72071 72072 static map(attrs) { 72073 return new MapElement(attrs); 72074 } 72075 72076 static mediumInfo(attrs) { 72077 return new MediumInfo(attrs); 72078 } 72079 72080 static message(attrs) { 72081 return new Message(attrs); 72082 } 72083 72084 static messaging(attrs) { 72085 return new Messaging(attrs); 72086 } 72087 72088 static mode(attrs) { 72089 return new Mode(attrs); 72090 } 72091 72092 static modifyAnnots(attrs) { 72093 return new ModifyAnnots(attrs); 72094 } 72095 72096 static msgId(attrs) { 72097 return new MsgId(attrs); 72098 } 72099 72100 static nameAttr(attrs) { 72101 return new NameAttr(attrs); 72102 } 72103 72104 static neverEmbed(attrs) { 72105 return new NeverEmbed(attrs); 72106 } 72107 72108 static numberOfCopies(attrs) { 72109 return new NumberOfCopies(attrs); 72110 } 72111 72112 static openAction(attrs) { 72113 return new OpenAction(attrs); 72114 } 72115 72116 static output(attrs) { 72117 return new Output(attrs); 72118 } 72119 72120 static outputBin(attrs) { 72121 return new OutputBin(attrs); 72122 } 72123 72124 static outputXSL(attrs) { 72125 return new OutputXSL(attrs); 72126 } 72127 72128 static overprint(attrs) { 72129 return new Overprint(attrs); 72130 } 72131 72132 static packets(attrs) { 72133 return new Packets(attrs); 72134 } 72135 72136 static pageOffset(attrs) { 72137 return new PageOffset(attrs); 72138 } 72139 72140 static pageRange(attrs) { 72141 return new PageRange(attrs); 72142 } 72143 72144 static pagination(attrs) { 72145 return new Pagination(attrs); 72146 } 72147 72148 static paginationOverride(attrs) { 72149 return new PaginationOverride(attrs); 72150 } 72151 72152 static part(attrs) { 72153 return new Part(attrs); 72154 } 72155 72156 static pcl(attrs) { 72157 return new Pcl(attrs); 72158 } 72159 72160 static pdf(attrs) { 72161 return new Pdf(attrs); 72162 } 72163 72164 static pdfa(attrs) { 72165 return new Pdfa(attrs); 72166 } 72167 72168 static permissions(attrs) { 72169 return new Permissions(attrs); 72170 } 72171 72172 static pickTrayByPDFSize(attrs) { 72173 return new PickTrayByPDFSize(attrs); 72174 } 72175 72176 static picture(attrs) { 72177 return new Picture(attrs); 72178 } 72179 72180 static plaintextMetadata(attrs) { 72181 return new PlaintextMetadata(attrs); 72182 } 72183 72184 static presence(attrs) { 72185 return new Presence(attrs); 72186 } 72187 72188 static present(attrs) { 72189 return new Present(attrs); 72190 } 72191 72192 static print(attrs) { 72193 return new Print(attrs); 72194 } 72195 72196 static printHighQuality(attrs) { 72197 return new PrintHighQuality(attrs); 72198 } 72199 72200 static printScaling(attrs) { 72201 return new PrintScaling(attrs); 72202 } 72203 72204 static printerName(attrs) { 72205 return new PrinterName(attrs); 72206 } 72207 72208 static producer(attrs) { 72209 return new Producer(attrs); 72210 } 72211 72212 static ps(attrs) { 72213 return new Ps(attrs); 72214 } 72215 72216 static range(attrs) { 72217 return new Range(attrs); 72218 } 72219 72220 static record(attrs) { 72221 return new Record(attrs); 72222 } 72223 72224 static relevant(attrs) { 72225 return new Relevant(attrs); 72226 } 72227 72228 static rename(attrs) { 72229 return new Rename(attrs); 72230 } 72231 72232 static renderPolicy(attrs) { 72233 return new RenderPolicy(attrs); 72234 } 72235 72236 static runScripts(attrs) { 72237 return new RunScripts(attrs); 72238 } 72239 72240 static script(attrs) { 72241 return new Script(attrs); 72242 } 72243 72244 static scriptModel(attrs) { 72245 return new ScriptModel(attrs); 72246 } 72247 72248 static severity(attrs) { 72249 return new Severity(attrs); 72250 } 72251 72252 static silentPrint(attrs) { 72253 return new SilentPrint(attrs); 72254 } 72255 72256 static staple(attrs) { 72257 return new Staple(attrs); 72258 } 72259 72260 static startNode(attrs) { 72261 return new StartNode(attrs); 72262 } 72263 72264 static startPage(attrs) { 72265 return new StartPage(attrs); 72266 } 72267 72268 static submitFormat(attrs) { 72269 return new SubmitFormat(attrs); 72270 } 72271 72272 static submitUrl(attrs) { 72273 return new SubmitUrl(attrs); 72274 } 72275 72276 static subsetBelow(attrs) { 72277 return new SubsetBelow(attrs); 72278 } 72279 72280 static suppressBanner(attrs) { 72281 return new SuppressBanner(attrs); 72282 } 72283 72284 static tagged(attrs) { 72285 return new Tagged(attrs); 72286 } 72287 72288 static template(attrs) { 72289 return new Template(attrs); 72290 } 72291 72292 static templateCache(attrs) { 72293 return new TemplateCache(attrs); 72294 } 72295 72296 static threshold(attrs) { 72297 return new Threshold(attrs); 72298 } 72299 72300 static to(attrs) { 72301 return new To(attrs); 72302 } 72303 72304 static trace(attrs) { 72305 return new Trace(attrs); 72306 } 72307 72308 static transform(attrs) { 72309 return new Transform(attrs); 72310 } 72311 72312 static type(attrs) { 72313 return new Type(attrs); 72314 } 72315 72316 static uri(attrs) { 72317 return new Uri(attrs); 72318 } 72319 72320 static validate(attrs) {
vendor: 75,434 bytes, lines 72321-75383
72321 return new Validate(attrs); 72322 } 72323 72324 static validateApprovalSignatures(attrs) { 72325 return new ValidateApprovalSignatures(attrs); 72326 } 72327 72328 static validationMessaging(attrs) { 72329 return new ValidationMessaging(attrs); 72330 } 72331 72332 static version(attrs) { 72333 return new Version(attrs); 72334 } 72335 72336 static versionControl(attrs) { 72337 return new VersionControl(attrs); 72338 } 72339 72340 static viewerPreferences(attrs) { 72341 return new ViewerPreferences(attrs); 72342 } 72343 72344 static webClient(attrs) { 72345 return new WebClient(attrs); 72346 } 72347 72348 static whitespace(attrs) { 72349 return new Whitespace(attrs); 72350 } 72351 72352 static window(attrs) { 72353 return new Window(attrs); 72354 } 72355 72356 static xdc(attrs) { 72357 return new Xdc(attrs); 72358 } 72359 72360 static xdp(attrs) { 72361 return new Xdp(attrs); 72362 } 72363 72364 static xsl(attrs) { 72365 return new Xsl(attrs); 72366 } 72367 72368 static zpl(attrs) { 72369 return new Zpl(attrs); 72370 } 72371 72372} 72373 72374exports.ConfigNamespace = ConfigNamespace; 72375 72376/***/ }), 72377/* 92 */ 72378/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 72379 72380 72381 72382Object.defineProperty(exports, "__esModule", ({ 72383 value: true 72384})); 72385exports.ConnectionSetNamespace = void 0; 72386 72387var _namespaces = __w_pdfjs_require__(79); 72388 72389var _xfa_object = __w_pdfjs_require__(77); 72390 72391const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id; 72392 72393class ConnectionSet extends _xfa_object.XFAObject { 72394 constructor(attributes) { 72395 super(CONNECTION_SET_NS_ID, "connectionSet", true); 72396 this.wsdlConnection = new _xfa_object.XFAObjectArray(); 72397 this.xmlConnection = new _xfa_object.XFAObjectArray(); 72398 this.xsdConnection = new _xfa_object.XFAObjectArray(); 72399 } 72400 72401} 72402 72403class EffectiveInputPolicy extends _xfa_object.XFAObject { 72404 constructor(attributes) { 72405 super(CONNECTION_SET_NS_ID, "effectiveInputPolicy"); 72406 this.id = attributes.id || ""; 72407 this.name = attributes.name || ""; 72408 this.use = attributes.use || ""; 72409 this.usehref = attributes.usehref || ""; 72410 } 72411 72412} 72413 72414class EffectiveOutputPolicy extends _xfa_object.XFAObject { 72415 constructor(attributes) { 72416 super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy"); 72417 this.id = attributes.id || ""; 72418 this.name = attributes.name || ""; 72419 this.use = attributes.use || ""; 72420 this.usehref = attributes.usehref || ""; 72421 } 72422 72423} 72424 72425class Operation extends _xfa_object.StringObject { 72426 constructor(attributes) { 72427 super(CONNECTION_SET_NS_ID, "operation"); 72428 this.id = attributes.id || ""; 72429 this.input = attributes.input || ""; 72430 this.name = attributes.name || ""; 72431 this.output = attributes.output || ""; 72432 this.use = attributes.use || ""; 72433 this.usehref = attributes.usehref || ""; 72434 } 72435 72436} 72437 72438class RootElement extends _xfa_object.StringObject { 72439 constructor(attributes) { 72440 super(CONNECTION_SET_NS_ID, "rootElement"); 72441 this.id = attributes.id || ""; 72442 this.name = attributes.name || ""; 72443 this.use = attributes.use || ""; 72444 this.usehref = attributes.usehref || ""; 72445 } 72446 72447} 72448 72449class SoapAction extends _xfa_object.StringObject { 72450 constructor(attributes) { 72451 super(CONNECTION_SET_NS_ID, "soapAction"); 72452 this.id = attributes.id || ""; 72453 this.name = attributes.name || ""; 72454 this.use = attributes.use || ""; 72455 this.usehref = attributes.usehref || ""; 72456 } 72457 72458} 72459 72460class SoapAddress extends _xfa_object.StringObject { 72461 constructor(attributes) { 72462 super(CONNECTION_SET_NS_ID, "soapAddress"); 72463 this.id = attributes.id || ""; 72464 this.name = attributes.name || ""; 72465 this.use = attributes.use || ""; 72466 this.usehref = attributes.usehref || ""; 72467 } 72468 72469} 72470 72471class Uri extends _xfa_object.StringObject { 72472 constructor(attributes) { 72473 super(CONNECTION_SET_NS_ID, "uri"); 72474 this.id = attributes.id || ""; 72475 this.name = attributes.name || ""; 72476 this.use = attributes.use || ""; 72477 this.usehref = attributes.usehref || ""; 72478 } 72479 72480} 72481 72482class WsdlAddress extends _xfa_object.StringObject { 72483 constructor(attributes) { 72484 super(CONNECTION_SET_NS_ID, "wsdlAddress"); 72485 this.id = attributes.id || ""; 72486 this.name = attributes.name || ""; 72487 this.use = attributes.use || ""; 72488 this.usehref = attributes.usehref || ""; 72489 } 72490 72491} 72492 72493class WsdlConnection extends _xfa_object.XFAObject { 72494 constructor(attributes) { 72495 super(CONNECTION_SET_NS_ID, "wsdlConnection", true); 72496 this.dataDescription = attributes.dataDescription || ""; 72497 this.name = attributes.name || ""; 72498 this.effectiveInputPolicy = null; 72499 this.effectiveOutputPolicy = null; 72500 this.operation = null; 72501 this.soapAction = null; 72502 this.soapAddress = null; 72503 this.wsdlAddress = null; 72504 } 72505 72506} 72507 72508class XmlConnection extends _xfa_object.XFAObject { 72509 constructor(attributes) { 72510 super(CONNECTION_SET_NS_ID, "xmlConnection", true); 72511 this.dataDescription = attributes.dataDescription || ""; 72512 this.name = attributes.name || ""; 72513 this.uri = null; 72514 } 72515 72516} 72517 72518class XsdConnection extends _xfa_object.XFAObject { 72519 constructor(attributes) { 72520 super(CONNECTION_SET_NS_ID, "xsdConnection", true); 72521 this.dataDescription = attributes.dataDescription || ""; 72522 this.name = attributes.name || ""; 72523 this.rootElement = null; 72524 this.uri = null; 72525 } 72526 72527} 72528 72529class ConnectionSetNamespace { 72530 static [_namespaces.$buildXFAObject](name, attributes) { 72531 if (ConnectionSetNamespace.hasOwnProperty(name)) { 72532 return ConnectionSetNamespace[name](attributes); 72533 } 72534 72535 return undefined; 72536 } 72537 72538 static connectionSet(attrs) { 72539 return new ConnectionSet(attrs); 72540 } 72541 72542 static effectiveInputPolicy(attrs) { 72543 return new EffectiveInputPolicy(attrs); 72544 } 72545 72546 static effectiveOutputPolicy(attrs) { 72547 return new EffectiveOutputPolicy(attrs); 72548 } 72549 72550 static operation(attrs) { 72551 return new Operation(attrs); 72552 } 72553 72554 static rootElement(attrs) { 72555 return new RootElement(attrs); 72556 } 72557 72558 static soapAction(attrs) { 72559 return new SoapAction(attrs); 72560 } 72561 72562 static soapAddress(attrs) { 72563 return new SoapAddress(attrs); 72564 } 72565 72566 static uri(attrs) { 72567 return new Uri(attrs); 72568 } 72569 72570 static wsdlAddress(attrs) { 72571 return new WsdlAddress(attrs); 72572 } 72573 72574 static wsdlConnection(attrs) { 72575 return new WsdlConnection(attrs); 72576 } 72577 72578 static xmlConnection(attrs) { 72579 return new XmlConnection(attrs); 72580 } 72581 72582 static xsdConnection(attrs) { 72583 return new XsdConnection(attrs); 72584 } 72585 72586} 72587 72588exports.ConnectionSetNamespace = ConnectionSetNamespace; 72589 72590/***/ }), 72591/* 93 */ 72592/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 72593 72594 72595 72596Object.defineProperty(exports, "__esModule", ({ 72597 value: true 72598})); 72599exports.DatasetsNamespace = void 0; 72600 72601var _xfa_object = __w_pdfjs_require__(77); 72602 72603var _namespaces = __w_pdfjs_require__(79); 72604 72605const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id; 72606 72607class Data extends _xfa_object.XmlObject { 72608 constructor(attributes) { 72609 super(DATASETS_NS_ID, "data", attributes); 72610 } 72611 72612 [_xfa_object.$isNsAgnostic]() { 72613 return true; 72614 } 72615 72616} 72617 72618class Datasets extends _xfa_object.XFAObject { 72619 constructor(attributes) { 72620 super(DATASETS_NS_ID, "datasets", true); 72621 this.data = null; 72622 this.Signature = null; 72623 } 72624 72625 [_xfa_object.$onChild](child) { 72626 const name = child[_xfa_object.$nodeName]; 72627 72628 if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) { 72629 this[name] = child; 72630 } 72631 72632 this[_xfa_object.$appendChild](child); 72633 } 72634 72635} 72636 72637class DatasetsNamespace { 72638 static [_namespaces.$buildXFAObject](name, attributes) { 72639 if (DatasetsNamespace.hasOwnProperty(name)) { 72640 return DatasetsNamespace[name](attributes); 72641 } 72642 72643 return undefined; 72644 } 72645 72646 static datasets(attributes) { 72647 return new Datasets(attributes); 72648 } 72649 72650 static data(attributes) { 72651 return new Data(attributes); 72652 } 72653 72654} 72655 72656exports.DatasetsNamespace = DatasetsNamespace; 72657 72658/***/ }), 72659/* 94 */ 72660/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 72661 72662 72663 72664Object.defineProperty(exports, "__esModule", ({ 72665 value: true 72666})); 72667exports.LocaleSetNamespace = void 0; 72668 72669var _namespaces = __w_pdfjs_require__(79); 72670 72671var _xfa_object = __w_pdfjs_require__(77); 72672 72673var _utils = __w_pdfjs_require__(78); 72674 72675const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id; 72676 72677class CalendarSymbols extends _xfa_object.XFAObject { 72678 constructor(attributes) { 72679 super(LOCALE_SET_NS_ID, "calendarSymbols", true); 72680 this.name = "gregorian"; 72681 this.dayNames = new _xfa_object.XFAObjectArray(2); 72682 this.eraNames = null; 72683 this.meridiemNames = null; 72684 this.monthNames = new _xfa_object.XFAObjectArray(2); 72685 } 72686 72687} 72688 72689class CurrencySymbol extends _xfa_object.StringObject { 72690 constructor(attributes) { 72691 super(LOCALE_SET_NS_ID, "currencySymbol"); 72692 this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]); 72693 } 72694 72695} 72696 72697class CurrencySymbols extends _xfa_object.XFAObject { 72698 constructor(attributes) { 72699 super(LOCALE_SET_NS_ID, "currencySymbols", true); 72700 this.currencySymbol = new _xfa_object.XFAObjectArray(3); 72701 } 72702 72703} 72704 72705class DatePattern extends _xfa_object.StringObject { 72706 constructor(attributes) { 72707 super(LOCALE_SET_NS_ID, "datePattern"); 72708 this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]); 72709 } 72710 72711} 72712 72713class DatePatterns extends _xfa_object.XFAObject { 72714 constructor(attributes) { 72715 super(LOCALE_SET_NS_ID, "datePatterns", true); 72716 this.datePattern = new _xfa_object.XFAObjectArray(4); 72717 } 72718 72719} 72720 72721class DateTimeSymbols extends _xfa_object.ContentObject { 72722 constructor(attributes) { 72723 super(LOCALE_SET_NS_ID, "dateTimeSymbols"); 72724 } 72725 72726} 72727 72728class Day extends _xfa_object.StringObject { 72729 constructor(attributes) { 72730 super(LOCALE_SET_NS_ID, "day"); 72731 } 72732 72733} 72734 72735class DayNames extends _xfa_object.XFAObject { 72736 constructor(attributes) { 72737 super(LOCALE_SET_NS_ID, "dayNames", true); 72738 this.abbr = (0, _utils.getInteger)({ 72739 data: attributes.abbr, 72740 defaultValue: 0, 72741 validate: x => x === 1 72742 }); 72743 this.day = new _xfa_object.XFAObjectArray(7); 72744 } 72745 72746} 72747 72748class Era extends _xfa_object.StringObject { 72749 constructor(attributes) { 72750 super(LOCALE_SET_NS_ID, "era"); 72751 } 72752 72753} 72754 72755class EraNames extends _xfa_object.XFAObject { 72756 constructor(attributes) { 72757 super(LOCALE_SET_NS_ID, "eraNames", true); 72758 this.era = new _xfa_object.XFAObjectArray(2); 72759 } 72760 72761} 72762 72763class Locale extends _xfa_object.XFAObject { 72764 constructor(attributes) { 72765 super(LOCALE_SET_NS_ID, "locale", true); 72766 this.desc = attributes.desc || ""; 72767 this.name = "isoname"; 72768 this.calendarSymbols = null; 72769 this.currencySymbols = null; 72770 this.datePatterns = null; 72771 this.dateTimeSymbols = null; 72772 this.numberPatterns = null; 72773 this.numberSymbols = null; 72774 this.timePatterns = null; 72775 this.typeFaces = null; 72776 } 72777 72778} 72779 72780class LocaleSet extends _xfa_object.XFAObject { 72781 constructor(attributes) { 72782 super(LOCALE_SET_NS_ID, "localeSet", true); 72783 this.locale = new _xfa_object.XFAObjectArray(); 72784 } 72785 72786} 72787 72788class Meridiem extends _xfa_object.StringObject { 72789 constructor(attributes) { 72790 super(LOCALE_SET_NS_ID, "meridiem"); 72791 } 72792 72793} 72794 72795class MeridiemNames extends _xfa_object.XFAObject { 72796 constructor(attributes) { 72797 super(LOCALE_SET_NS_ID, "meridiemNames", true); 72798 this.meridiem = new _xfa_object.XFAObjectArray(2); 72799 } 72800 72801} 72802 72803class Month extends _xfa_object.StringObject { 72804 constructor(attributes) { 72805 super(LOCALE_SET_NS_ID, "month"); 72806 } 72807 72808} 72809 72810class MonthNames extends _xfa_object.XFAObject { 72811 constructor(attributes) { 72812 super(LOCALE_SET_NS_ID, "monthNames", true); 72813 this.abbr = (0, _utils.getInteger)({ 72814 data: attributes.abbr, 72815 defaultValue: 0, 72816 validate: x => x === 1 72817 }); 72818 this.month = new _xfa_object.XFAObjectArray(12); 72819 } 72820 72821} 72822 72823class NumberPattern extends _xfa_object.StringObject { 72824 constructor(attributes) { 72825 super(LOCALE_SET_NS_ID, "numberPattern"); 72826 this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]); 72827 } 72828 72829} 72830 72831class NumberPatterns extends _xfa_object.XFAObject { 72832 constructor(attributes) { 72833 super(LOCALE_SET_NS_ID, "numberPatterns", true); 72834 this.numberPattern = new _xfa_object.XFAObjectArray(4); 72835 } 72836 72837} 72838 72839class NumberSymbol extends _xfa_object.StringObject { 72840 constructor(attributes) { 72841 super(LOCALE_SET_NS_ID, "numberSymbol"); 72842 this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]); 72843 } 72844 72845} 72846 72847class NumberSymbols extends _xfa_object.XFAObject { 72848 constructor(attributes) { 72849 super(LOCALE_SET_NS_ID, "numberSymbols", true); 72850 this.numberSymbol = new _xfa_object.XFAObjectArray(5); 72851 } 72852 72853} 72854 72855class TimePattern extends _xfa_object.StringObject { 72856 constructor(attributes) { 72857 super(LOCALE_SET_NS_ID, "timePattern"); 72858 this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]); 72859 } 72860 72861} 72862 72863class TimePatterns extends _xfa_object.XFAObject { 72864 constructor(attributes) { 72865 super(LOCALE_SET_NS_ID, "timePatterns", true); 72866 this.timePattern = new _xfa_object.XFAObjectArray(4); 72867 } 72868 72869} 72870 72871class TypeFace extends _xfa_object.XFAObject { 72872 constructor(attributes) { 72873 super(LOCALE_SET_NS_ID, "typeFace", true); 72874 this.name = attributes.name | ""; 72875 } 72876 72877} 72878 72879class TypeFaces extends _xfa_object.XFAObject { 72880 constructor(attributes) { 72881 super(LOCALE_SET_NS_ID, "typeFaces", true); 72882 this.typeFace = new _xfa_object.XFAObjectArray(); 72883 } 72884 72885} 72886 72887class LocaleSetNamespace { 72888 static [_namespaces.$buildXFAObject](name, attributes) { 72889 if (LocaleSetNamespace.hasOwnProperty(name)) { 72890 return LocaleSetNamespace[name](attributes); 72891 } 72892 72893 return undefined; 72894 } 72895 72896 static calendarSymbols(attrs) { 72897 return new CalendarSymbols(attrs); 72898 } 72899 72900 static currencySymbol(attrs) { 72901 return new CurrencySymbol(attrs); 72902 } 72903 72904 static currencySymbols(attrs) { 72905 return new CurrencySymbols(attrs); 72906 } 72907 72908 static datePattern(attrs) { 72909 return new DatePattern(attrs); 72910 } 72911 72912 static datePatterns(attrs) { 72913 return new DatePatterns(attrs); 72914 } 72915 72916 static dateTimeSymbols(attrs) { 72917 return new DateTimeSymbols(attrs); 72918 } 72919 72920 static day(attrs) { 72921 return new Day(attrs); 72922 } 72923 72924 static dayNames(attrs) { 72925 return new DayNames(attrs); 72926 } 72927 72928 static era(attrs) { 72929 return new Era(attrs); 72930 } 72931 72932 static eraNames(attrs) { 72933 return new EraNames(attrs); 72934 } 72935 72936 static locale(attrs) { 72937 return new Locale(attrs); 72938 } 72939 72940 static localeSet(attrs) { 72941 return new LocaleSet(attrs); 72942 } 72943 72944 static meridiem(attrs) { 72945 return new Meridiem(attrs); 72946 } 72947 72948 static meridiemNames(attrs) { 72949 return new MeridiemNames(attrs); 72950 } 72951 72952 static month(attrs) { 72953 return new Month(attrs); 72954 } 72955 72956 static monthNames(attrs) { 72957 return new MonthNames(attrs); 72958 } 72959 72960 static numberPattern(attrs) { 72961 return new NumberPattern(attrs); 72962 } 72963 72964 static numberPatterns(attrs) { 72965 return new NumberPatterns(attrs); 72966 } 72967 72968 static numberSymbol(attrs) { 72969 return new NumberSymbol(attrs); 72970 } 72971 72972 static numberSymbols(attrs) { 72973 return new NumberSymbols(attrs); 72974 } 72975 72976 static timePattern(attrs) { 72977 return new TimePattern(attrs); 72978 } 72979 72980 static timePatterns(attrs) { 72981 return new TimePatterns(attrs); 72982 } 72983 72984 static typeFace(attrs) { 72985 return new TypeFace(attrs); 72986 } 72987 72988 static typeFaces(attrs) { 72989 return new TypeFaces(attrs); 72990 } 72991 72992} 72993 72994exports.LocaleSetNamespace = LocaleSetNamespace; 72995 72996/***/ }), 72997/* 95 */ 72998/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 72999 73000 73001 73002Object.defineProperty(exports, "__esModule", ({ 73003 value: true 73004})); 73005exports.SignatureNamespace = void 0; 73006 73007var _namespaces = __w_pdfjs_require__(79); 73008 73009var _xfa_object = __w_pdfjs_require__(77); 73010 73011const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id; 73012 73013class Signature extends _xfa_object.XFAObject { 73014 constructor(attributes) { 73015 super(SIGNATURE_NS_ID, "signature", true); 73016 } 73017 73018} 73019 73020class SignatureNamespace { 73021 static [_namespaces.$buildXFAObject](name, attributes) { 73022 if (SignatureNamespace.hasOwnProperty(name)) { 73023 return SignatureNamespace[name](attributes); 73024 } 73025 73026 return undefined; 73027 } 73028 73029 static signature(attributes) { 73030 return new Signature(attributes); 73031 } 73032 73033} 73034 73035exports.SignatureNamespace = SignatureNamespace; 73036 73037/***/ }), 73038/* 96 */ 73039/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 73040 73041 73042 73043Object.defineProperty(exports, "__esModule", ({ 73044 value: true 73045})); 73046exports.StylesheetNamespace = void 0; 73047 73048var _namespaces = __w_pdfjs_require__(79); 73049 73050var _xfa_object = __w_pdfjs_require__(77); 73051 73052const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id; 73053 73054class Stylesheet extends _xfa_object.XFAObject { 73055 constructor(attributes) { 73056 super(STYLESHEET_NS_ID, "stylesheet", true); 73057 } 73058 73059} 73060 73061class StylesheetNamespace { 73062 static [_namespaces.$buildXFAObject](name, attributes) { 73063 if (StylesheetNamespace.hasOwnProperty(name)) { 73064 return StylesheetNamespace[name](attributes); 73065 } 73066 73067 return undefined; 73068 } 73069 73070 static stylesheet(attributes) { 73071 return new Stylesheet(attributes); 73072 } 73073 73074} 73075 73076exports.StylesheetNamespace = StylesheetNamespace; 73077 73078/***/ }), 73079/* 97 */ 73080/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 73081 73082 73083 73084Object.defineProperty(exports, "__esModule", ({ 73085 value: true 73086})); 73087exports.XdpNamespace = void 0; 73088 73089var _namespaces = __w_pdfjs_require__(79); 73090 73091var _xfa_object = __w_pdfjs_require__(77); 73092 73093const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id; 73094 73095class Xdp extends _xfa_object.XFAObject { 73096 constructor(attributes) { 73097 super(XDP_NS_ID, "xdp", true); 73098 this.uuid = attributes.uuid || ""; 73099 this.timeStamp = attributes.timeStamp || ""; 73100 this.config = null; 73101 this.connectionSet = null; 73102 this.datasets = null; 73103 this.localeSet = null; 73104 this.stylesheet = new _xfa_object.XFAObjectArray(); 73105 this.template = null; 73106 } 73107 73108 [_xfa_object.$onChildCheck](child) { 73109 const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]]; 73110 return ns && child[_xfa_object.$namespaceId] === ns.id; 73111 } 73112 73113} 73114 73115class XdpNamespace { 73116 static [_namespaces.$buildXFAObject](name, attributes) { 73117 if (XdpNamespace.hasOwnProperty(name)) { 73118 return XdpNamespace[name](attributes); 73119 } 73120 73121 return undefined; 73122 } 73123 73124 static xdp(attributes) { 73125 return new Xdp(attributes); 73126 } 73127 73128} 73129 73130exports.XdpNamespace = XdpNamespace; 73131 73132/***/ }), 73133/* 98 */ 73134/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 73135 73136 73137 73138Object.defineProperty(exports, "__esModule", ({ 73139 value: true 73140})); 73141exports.XhtmlNamespace = void 0; 73142 73143var _xfa_object = __w_pdfjs_require__(77); 73144 73145var _namespaces = __w_pdfjs_require__(79); 73146 73147var _html_utils = __w_pdfjs_require__(84); 73148 73149var _utils = __w_pdfjs_require__(78); 73150 73151const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id; 73152const $richText = Symbol(); 73153const VALID_STYLES = new Set(["color", "font", "font-family", "font-size", "font-stretch", "font-style", "font-weight", "margin", "margin-bottom", "margin-left", "margin-right", "margin-top", "letter-spacing", "line-height", "orphans", "page-break-after", "page-break-before", "page-break-inside", "tab-interval", "tab-stop", "text-align", "text-decoration", "text-indent", "vertical-align", "widows", "kerning-mode", "xfa-font-horizontal-scale", "xfa-font-vertical-scale", "xfa-spacerun", "xfa-tab-stops"]); 73154const StyleMapping = new Map([["page-break-after", "breakAfter"], ["page-break-before", "breakBefore"], ["page-break-inside", "breakInside"], ["kerning-mode", value => value === "none" ? "none" : "normal"], ["xfa-font-horizontal-scale", value => `scaleX(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], ["xfa-font-vertical-scale", value => `scaleY(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], ["xfa-spacerun", ""], ["xfa-tab-stops", ""], ["font-size", (value, original) => { 73155 value = original.fontSize = (0, _utils.getMeasurement)(value); 73156 return (0, _html_utils.measureToString)(0.99 * value); 73157}], ["letter-spacing", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["line-height", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-bottom", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-left", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-right", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-top", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["text-indent", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["font-family", value => value], ["vertical-align", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))]]); 73158const spacesRegExp = /\s+/g; 73159const crlfRegExp = /[\r\n]+/g; 73160const crlfForRichTextRegExp = /\r\n?/g; 73161 73162function mapStyle(styleStr, node, richText) { 73163 const style = Object.create(null); 73164 73165 if (!styleStr) { 73166 return style; 73167 } 73168 73169 const original = Object.create(null); 73170 73171 for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) { 73172 const mapping = StyleMapping.get(key); 73173 73174 if (mapping === "") { 73175 continue; 73176 } 73177 73178 let newValue = value; 73179 73180 if (mapping) { 73181 if (typeof mapping === "string") { 73182 newValue = mapping; 73183 } else { 73184 newValue = mapping(value, original); 73185 } 73186 } 73187 73188 if (key.endsWith("scale")) { 73189 if (style.transform) { 73190 style.transform = `${style[key]} ${newValue}`; 73191 } else { 73192 style.transform = newValue; 73193 } 73194 } else { 73195 style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue; 73196 } 73197 } 73198 73199 if (style.fontFamily) { 73200 (0, _html_utils.setFontFamily)({ 73201 typeface: style.fontFamily, 73202 weight: style.fontWeight || "normal", 73203 posture: style.fontStyle || "normal", 73204 size: original.fontSize || 0 73205 }, node, node[_xfa_object.$globalData].fontFinder, style); 73206 } 73207 73208 if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) { 73209 const SUB_SUPER_SCRIPT_FACTOR = 0.583; 73210 const VERTICAL_FACTOR = 0.333; 73211 const fontSize = (0, _utils.getMeasurement)(style.fontSize); 73212 style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR); 73213 style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR); 73214 } 73215 73216 if (richText && style.fontSize) { 73217 style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`; 73218 } 73219 73220 (0, _html_utils.fixTextIndent)(style); 73221 return style; 73222} 73223 73224function checkStyle(node) { 73225 if (!node.style) { 73226 return ""; 73227 } 73228 73229 return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => { 73230 if (key === "font-family") { 73231 node[_xfa_object.$globalData].usedTypefaces.add(value); 73232 } 73233 73234 return VALID_STYLES.has(key); 73235 }).map(kv => kv.join(":")).join(";"); 73236} 73237 73238const NoWhites = new Set(["body", "html"]); 73239 73240class XhtmlObject extends _xfa_object.XmlObject { 73241 constructor(attributes, name) { 73242 super(XHTML_NS_ID, name); 73243 this[$richText] = false; 73244 this.style = attributes.style || ""; 73245 } 73246 73247 [_xfa_object.$clean](builder) { 73248 super[_xfa_object.$clean](builder); 73249 73250 this.style = checkStyle(this); 73251 } 73252 73253 [_xfa_object.$acceptWhitespace]() { 73254 return !NoWhites.has(this[_xfa_object.$nodeName]); 73255 } 73256 73257 [_xfa_object.$onText](str, richText = false) { 73258 if (!richText) { 73259 str = str.replace(crlfRegExp, ""); 73260 73261 if (!this.style.includes("xfa-spacerun:yes")) { 73262 str = str.replace(spacesRegExp, " "); 73263 } 73264 } else { 73265 this[$richText] = true; 73266 } 73267 73268 if (str) { 73269 this[_xfa_object.$content] += str; 73270 } 73271 } 73272 73273 [_xfa_object.$pushGlyphs](measure, mustPop = true) { 73274 const xfaFont = Object.create(null); 73275 const margin = { 73276 top: NaN, 73277 bottom: NaN, 73278 left: NaN, 73279 right: NaN 73280 }; 73281 let lineHeight = null; 73282 73283 for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) { 73284 switch (key) { 73285 case "font-family": 73286 xfaFont.typeface = (0, _utils.stripQuotes)(value); 73287 break; 73288 73289 case "font-size": 73290 xfaFont.size = (0, _utils.getMeasurement)(value); 73291 break; 73292 73293 case "font-weight": 73294 xfaFont.weight = value; 73295 break; 73296 73297 case "font-style": 73298 xfaFont.posture = value; 73299 break; 73300 73301 case "letter-spacing": 73302 xfaFont.letterSpacing = (0, _utils.getMeasurement)(value); 73303 break; 73304 73305 case "margin": 73306 const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x)); 73307 73308 switch (values.length) { 73309 case 1: 73310 margin.top = margin.bottom = margin.left = margin.right = values[0]; 73311 break; 73312 73313 case 2: 73314 margin.top = margin.bottom = values[0]; 73315 margin.left = margin.right = values[1]; 73316 break; 73317 73318 case 3: 73319 margin.top = values[0]; 73320 margin.bottom = values[2]; 73321 margin.left = margin.right = values[1]; 73322 break; 73323 73324 case 4: 73325 margin.top = values[0]; 73326 margin.left = values[1]; 73327 margin.bottom = values[2]; 73328 margin.right = values[3]; 73329 break; 73330 } 73331 73332 break; 73333 73334 case "margin-top": 73335 margin.top = (0, _utils.getMeasurement)(value); 73336 break; 73337 73338 case "margin-bottom": 73339 margin.bottom = (0, _utils.getMeasurement)(value); 73340 break; 73341 73342 case "margin-left": 73343 margin.left = (0, _utils.getMeasurement)(value); 73344 break; 73345 73346 case "margin-right": 73347 margin.right = (0, _utils.getMeasurement)(value); 73348 break; 73349 73350 case "line-height": 73351 lineHeight = (0, _utils.getMeasurement)(value); 73352 break; 73353 } 73354 } 73355 73356 measure.pushData(xfaFont, margin, lineHeight); 73357 73358 if (this[_xfa_object.$content]) { 73359 measure.addString(this[_xfa_object.$content]); 73360 } else { 73361 for (const child of this[_xfa_object.$getChildren]()) { 73362 if (child[_xfa_object.$nodeName] === "#text") { 73363 measure.addString(child[_xfa_object.$content]); 73364 continue; 73365 } 73366 73367 child[_xfa_object.$pushGlyphs](measure); 73368 } 73369 } 73370 73371 if (mustPop) { 73372 measure.popFont(); 73373 } 73374 } 73375 73376 [_xfa_object.$toHTML](availableSpace) { 73377 const children = []; 73378 this[_xfa_object.$extra] = { 73379 children 73380 }; 73381 73382 this[_xfa_object.$childrenToHTML]({}); 73383 73384 if (children.length === 0 && !this[_xfa_object.$content]) { 73385 return _utils.HTMLResult.EMPTY; 73386 } 73387 73388 let value; 73389 73390 if (this[$richText]) { 73391 value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined; 73392 } else { 73393 value = this[_xfa_object.$content] || undefined; 73394 } 73395 73396 return _utils.HTMLResult.success({ 73397 name: this[_xfa_object.$nodeName], 73398 attributes: { 73399 href: this.href, 73400 style: mapStyle(this.style, this, this[$richText]) 73401 }, 73402 children, 73403 value 73404 }); 73405 } 73406 73407} 73408 73409class A extends XhtmlObject { 73410 constructor(attributes) { 73411 super(attributes, "a"); 73412 this.href = (0, _html_utils.fixURL)(attributes.href) || ""; 73413 } 73414 73415} 73416 73417class B extends XhtmlObject { 73418 constructor(attributes) { 73419 super(attributes, "b"); 73420 } 73421 73422 [_xfa_object.$pushGlyphs](measure) { 73423 measure.pushFont({ 73424 weight: "bold" 73425 }); 73426 73427 super[_xfa_object.$pushGlyphs](measure); 73428 73429 measure.popFont(); 73430 } 73431 73432} 73433 73434class Body extends XhtmlObject { 73435 constructor(attributes) { 73436 super(attributes, "body"); 73437 } 73438 73439 [_xfa_object.$toHTML](availableSpace) { 73440 const res = super[_xfa_object.$toHTML](availableSpace); 73441 73442 const { 73443 html 73444 } = res; 73445 73446 if (!html) { 73447 return _utils.HTMLResult.EMPTY; 73448 } 73449 73450 html.name = "div"; 73451 html.attributes.class = ["xfaRich"]; 73452 return res; 73453 } 73454 73455} 73456 73457class Br extends XhtmlObject { 73458 constructor(attributes) { 73459 super(attributes, "br"); 73460 } 73461 73462 [_xfa_object.$text]() { 73463 return "\n"; 73464 } 73465 73466 [_xfa_object.$pushGlyphs](measure) { 73467 measure.addString("\n"); 73468 } 73469 73470 [_xfa_object.$toHTML](availableSpace) { 73471 return _utils.HTMLResult.success({ 73472 name: "br" 73473 }); 73474 } 73475 73476} 73477 73478class Html extends XhtmlObject { 73479 constructor(attributes) { 73480 super(attributes, "html"); 73481 } 73482 73483 [_xfa_object.$toHTML](availableSpace) { 73484 const children = []; 73485 this[_xfa_object.$extra] = { 73486 children 73487 }; 73488 73489 this[_xfa_object.$childrenToHTML]({}); 73490 73491 if (children.length === 0) { 73492 return _utils.HTMLResult.success({ 73493 name: "div", 73494 attributes: { 73495 class: ["xfaRich"], 73496 style: {} 73497 }, 73498 value: this[_xfa_object.$content] || "" 73499 }); 73500 } 73501 73502 if (children.length === 1) { 73503 const child = children[0]; 73504 73505 if (child.attributes && child.attributes.class.includes("xfaRich")) { 73506 return _utils.HTMLResult.success(child); 73507 } 73508 } 73509 73510 return _utils.HTMLResult.success({ 73511 name: "div", 73512 attributes: { 73513 class: ["xfaRich"], 73514 style: {} 73515 }, 73516 children 73517 }); 73518 } 73519 73520} 73521 73522class I extends XhtmlObject { 73523 constructor(attributes) { 73524 super(attributes, "i"); 73525 } 73526 73527 [_xfa_object.$pushGlyphs](measure) { 73528 measure.pushFont({ 73529 posture: "italic" 73530 }); 73531 73532 super[_xfa_object.$pushGlyphs](measure); 73533 73534 measure.popFont(); 73535 } 73536 73537} 73538 73539class Li extends XhtmlObject { 73540 constructor(attributes) { 73541 super(attributes, "li"); 73542 } 73543 73544} 73545 73546class Ol extends XhtmlObject { 73547 constructor(attributes) { 73548 super(attributes, "ol"); 73549 } 73550 73551} 73552 73553class P extends XhtmlObject { 73554 constructor(attributes) { 73555 super(attributes, "p"); 73556 } 73557 73558 [_xfa_object.$pushGlyphs](measure) { 73559 super[_xfa_object.$pushGlyphs](measure, false); 73560 73561 measure.addString("\n"); 73562 measure.addPara(); 73563 measure.popFont(); 73564 } 73565 73566 [_xfa_object.$text]() { 73567 const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren](); 73568 73569 if (siblings.at(-1) === this) { 73570 return super[_xfa_object.$text](); 73571 } 73572 73573 return super[_xfa_object.$text]() + "\n"; 73574 } 73575 73576} 73577 73578class Span extends XhtmlObject { 73579 constructor(attributes) { 73580 super(attributes, "span"); 73581 } 73582 73583} 73584 73585class Sub extends XhtmlObject { 73586 constructor(attributes) { 73587 super(attributes, "sub"); 73588 } 73589 73590} 73591 73592class Sup extends XhtmlObject { 73593 constructor(attributes) { 73594 super(attributes, "sup"); 73595 } 73596 73597} 73598 73599class Ul extends XhtmlObject { 73600 constructor(attributes) { 73601 super(attributes, "ul"); 73602 } 73603 73604} 73605 73606class XhtmlNamespace { 73607 static [_namespaces.$buildXFAObject](name, attributes) { 73608 if (XhtmlNamespace.hasOwnProperty(name)) { 73609 return XhtmlNamespace[name](attributes); 73610 } 73611 73612 return undefined; 73613 } 73614 73615 static a(attributes) { 73616 return new A(attributes); 73617 } 73618 73619 static b(attributes) { 73620 return new B(attributes); 73621 } 73622 73623 static body(attributes) { 73624 return new Body(attributes); 73625 } 73626 73627 static br(attributes) { 73628 return new Br(attributes); 73629 } 73630 73631 static html(attributes) { 73632 return new Html(attributes); 73633 } 73634 73635 static i(attributes) { 73636 return new I(attributes); 73637 } 73638 73639 static li(attributes) { 73640 return new Li(attributes); 73641 } 73642 73643 static ol(attributes) { 73644 return new Ol(attributes); 73645 } 73646 73647 static p(attributes) { 73648 return new P(attributes); 73649 } 73650 73651 static span(attributes) { 73652 return new Span(attributes); 73653 } 73654 73655 static sub(attributes) { 73656 return new Sub(attributes); 73657 } 73658 73659 static sup(attributes) { 73660 return new Sup(attributes); 73661 } 73662 73663 static ul(attributes) { 73664 return new Ul(attributes); 73665 } 73666 73667} 73668 73669exports.XhtmlNamespace = XhtmlNamespace; 73670 73671/***/ }), 73672/* 99 */ 73673/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 73674 73675 73676 73677Object.defineProperty(exports, "__esModule", ({ 73678 value: true 73679})); 73680exports.UnknownNamespace = void 0; 73681 73682var _namespaces = __w_pdfjs_require__(79); 73683 73684var _xfa_object = __w_pdfjs_require__(77); 73685 73686class UnknownNamespace { 73687 constructor(nsId) { 73688 this.namespaceId = nsId; 73689 } 73690 73691 [_namespaces.$buildXFAObject](name, attributes) { 73692 return new _xfa_object.XmlObject(this.namespaceId, name, attributes); 73693 } 73694 73695} 73696 73697exports.UnknownNamespace = UnknownNamespace; 73698 73699/***/ }), 73700/* 100 */ 73701/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 73702 73703 73704 73705Object.defineProperty(exports, "__esModule", ({ 73706 value: true 73707})); 73708exports.DatasetReader = void 0; 73709 73710var _util = __w_pdfjs_require__(2); 73711 73712var _core_utils = __w_pdfjs_require__(6); 73713 73714var _xml_parser = __w_pdfjs_require__(66); 73715 73716function decodeString(str) { 73717 try { 73718 return (0, _util.stringToUTF8String)(str); 73719 } catch (ex) { 73720 (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`); 73721 return str; 73722 } 73723} 73724 73725class DatasetXMLParser extends _xml_parser.SimpleXMLParser { 73726 constructor(options) { 73727 super(options); 73728 this.node = null; 73729 } 73730 73731 onEndElement(name) { 73732 const node = super.onEndElement(name); 73733 73734 if (node && name === "xfa:datasets") { 73735 this.node = node; 73736 throw new Error("Aborting DatasetXMLParser."); 73737 } 73738 } 73739 73740} 73741 73742class DatasetReader { 73743 constructor(data) { 73744 if (data.datasets) { 73745 this.node = new _xml_parser.SimpleXMLParser({ 73746 hasAttributes: true 73747 }).parseFromString(data.datasets).documentElement; 73748 } else { 73749 const parser = new DatasetXMLParser({ 73750 hasAttributes: true 73751 }); 73752 73753 try { 73754 parser.parseFromString(data["xdp:xdp"]); 73755 } catch (_) {} 73756 73757 this.node = parser.node; 73758 } 73759 } 73760 73761 getValue(path) { 73762 if (!this.node || !path) { 73763 return ""; 73764 } 73765 73766 const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0); 73767 73768 if (!node) { 73769 return ""; 73770 } 73771 73772 const first = node.firstChild; 73773 73774 if (first && first.nodeName === "value") { 73775 return node.children.map(child => decodeString(child.textContent)); 73776 } 73777 73778 return decodeString(node.textContent); 73779 } 73780 73781} 73782 73783exports.DatasetReader = DatasetReader; 73784 73785/***/ }), 73786/* 101 */ 73787/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 73788 73789 73790 73791Object.defineProperty(exports, "__esModule", ({ 73792 value: true 73793})); 73794exports.XRef = void 0; 73795 73796var _util = __w_pdfjs_require__(2); 73797 73798var _primitives = __w_pdfjs_require__(5); 73799 73800var _core_utils = __w_pdfjs_require__(6); 73801 73802var _parser = __w_pdfjs_require__(17); 73803 73804var _base_stream = __w_pdfjs_require__(7); 73805 73806var _crypto = __w_pdfjs_require__(67); 73807 73808class XRef { 73809 constructor(stream, pdfManager) { 73810 this.stream = stream; 73811 this.pdfManager = pdfManager; 73812 this.entries = []; 73813 this.xrefstms = Object.create(null); 73814 this._cacheMap = new Map(); 73815 this._pendingRefs = new _primitives.RefSet(); 73816 this.stats = new _core_utils.DocStats(pdfManager.msgHandler); 73817 this._newRefNum = null; 73818 } 73819 73820 getNewRef() { 73821 if (this._newRefNum === null) { 73822 this._newRefNum = this.entries.length || 1; 73823 } 73824 73825 return _primitives.Ref.get(this._newRefNum++, 0); 73826 } 73827 73828 resetNewRef() { 73829 this._newRefNum = null; 73830 } 73831 73832 setStartXRef(startXRef) { 73833 this.startXRefQueue = [startXRef]; 73834 } 73835 73836 parse(recoveryMode = false) { 73837 let trailerDict; 73838 73839 if (!recoveryMode) { 73840 trailerDict = this.readXRef(); 73841 } else { 73842 (0, _util.warn)("Indexing all PDF objects"); 73843 trailerDict = this.indexObjects(); 73844 } 73845 73846 trailerDict.assignXref(this); 73847 this.trailer = trailerDict; 73848 let encrypt; 73849 73850 try { 73851 encrypt = trailerDict.get("Encrypt"); 73852 } catch (ex) { 73853 if (ex instanceof _core_utils.MissingDataException) { 73854 throw ex; 73855 } 73856 73857 (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`); 73858 } 73859 73860 if (encrypt instanceof _primitives.Dict) { 73861 const ids = trailerDict.get("ID"); 73862 const fileId = ids && ids.length ? ids[0] : ""; 73863 encrypt.suppressEncryption = true; 73864 this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password); 73865 } 73866 73867 let root; 73868 73869 try { 73870 root = trailerDict.get("Root"); 73871 } catch (ex) { 73872 if (ex instanceof _core_utils.MissingDataException) { 73873 throw ex; 73874 } 73875 73876 (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`); 73877 } 73878 73879 if (root instanceof _primitives.Dict) { 73880 try { 73881 const pages = root.get("Pages"); 73882 73883 if (pages instanceof _primitives.Dict) { 73884 this.root = root; 73885 return; 73886 } 73887 } catch (ex) { 73888 if (ex instanceof _core_utils.MissingDataException) { 73889 throw ex; 73890 } 73891 73892 (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`); 73893 } 73894 } 73895 73896 if (!recoveryMode) { 73897 throw new _core_utils.XRefParseException(); 73898 } 73899 73900 throw new _util.InvalidPDFException("Invalid Root reference."); 73901 } 73902 73903 processXRefTable(parser) { 73904 if (!("tableState" in this)) { 73905 this.tableState = { 73906 entryNum: 0, 73907 streamPos: parser.lexer.stream.pos, 73908 parserBuf1: parser.buf1, 73909 parserBuf2: parser.buf2 73910 }; 73911 } 73912 73913 const obj = this.readXRefTable(parser); 73914 73915 if (!(0, _primitives.isCmd)(obj, "trailer")) { 73916 throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary"); 73917 } 73918 73919 let dict = parser.getObj(); 73920 73921 if (!(dict instanceof _primitives.Dict) && dict.dict) { 73922 dict = dict.dict; 73923 } 73924 73925 if (!(dict instanceof _primitives.Dict)) { 73926 throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary"); 73927 } 73928 73929 delete this.tableState; 73930 return dict; 73931 } 73932 73933 readXRefTable(parser) { 73934 const stream = parser.lexer.stream; 73935 const tableState = this.tableState; 73936 stream.pos = tableState.streamPos; 73937 parser.buf1 = tableState.parserBuf1; 73938 parser.buf2 = tableState.parserBuf2; 73939 let obj; 73940 73941 while (true) { 73942 if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) { 73943 if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) { 73944 break; 73945 } 73946 73947 tableState.firstEntryNum = obj; 73948 tableState.entryCount = parser.getObj(); 73949 } 73950 73951 let first = tableState.firstEntryNum; 73952 const count = tableState.entryCount; 73953 73954 if (!Number.isInteger(first) || !Number.isInteger(count)) { 73955 throw new _util.FormatError("Invalid XRef table: wrong types in subsection header"); 73956 } 73957 73958 for (let i = tableState.entryNum; i < count; i++) { 73959 tableState.streamPos = stream.pos; 73960 tableState.entryNum = i; 73961 tableState.parserBuf1 = parser.buf1; 73962 tableState.parserBuf2 = parser.buf2; 73963 const entry = {}; 73964 entry.offset = parser.getObj(); 73965 entry.gen = parser.getObj(); 73966 const type = parser.getObj(); 73967 73968 if (type instanceof _primitives.Cmd) { 73969 switch (type.cmd) { 73970 case "f": 73971 entry.free = true; 73972 break; 73973 73974 case "n": 73975 entry.uncompressed = true; 73976 break; 73977 } 73978 } 73979 73980 if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) { 73981 throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`); 73982 } 73983 73984 if (i === 0 && entry.free && first === 1) { 73985 first = 0; 73986 } 73987 73988 if (!this.entries[i + first]) { 73989 this.entries[i + first] = entry; 73990 } 73991 } 73992 73993 tableState.entryNum = 0; 73994 tableState.streamPos = stream.pos; 73995 tableState.parserBuf1 = parser.buf1; 73996 tableState.parserBuf2 = parser.buf2; 73997 delete tableState.firstEntryNum; 73998 delete tableState.entryCount; 73999 } 74000 74001 if (this.entries[0] && !this.entries[0].free) { 74002 throw new _util.FormatError("Invalid XRef table: unexpected first object"); 74003 } 74004 74005 return obj; 74006 } 74007 74008 processXRefStream(stream) { 74009 if (!("streamState" in this)) { 74010 const streamParameters = stream.dict; 74011 const byteWidths = streamParameters.get("W"); 74012 let range = streamParameters.get("Index"); 74013 74014 if (!range) { 74015 range = [0, streamParameters.get("Size")]; 74016 } 74017 74018 this.streamState = { 74019 entryRanges: range, 74020 byteWidths, 74021 entryNum: 0, 74022 streamPos: stream.pos 74023 }; 74024 } 74025 74026 this.readXRefStream(stream); 74027 delete this.streamState; 74028 return stream.dict; 74029 } 74030 74031 readXRefStream(stream) { 74032 const streamState = this.streamState; 74033 stream.pos = streamState.streamPos; 74034 const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths; 74035 const entryRanges = streamState.entryRanges; 74036 74037 while (entryRanges.length > 0) { 74038 const [first, n] = entryRanges; 74039 74040 if (!Number.isInteger(first) || !Number.isInteger(n)) { 74041 throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`); 74042 } 74043 74044 if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) { 74045 throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`); 74046 } 74047 74048 for (let i = streamState.entryNum; i < n; ++i) { 74049 streamState.entryNum = i; 74050 streamState.streamPos = stream.pos; 74051 let type = 0, 74052 offset = 0, 74053 generation = 0; 74054 74055 for (let j = 0; j < typeFieldWidth; ++j) { 74056 const typeByte = stream.getByte(); 74057 74058 if (typeByte === -1) { 74059 throw new _util.FormatError("Invalid XRef byteWidths 'type'."); 74060 } 74061 74062 type = type << 8 | typeByte; 74063 } 74064 74065 if (typeFieldWidth === 0) { 74066 type = 1; 74067 } 74068 74069 for (let j = 0; j < offsetFieldWidth; ++j) { 74070 const offsetByte = stream.getByte(); 74071 74072 if (offsetByte === -1) { 74073 throw new _util.FormatError("Invalid XRef byteWidths 'offset'."); 74074 } 74075 74076 offset = offset << 8 | offsetByte; 74077 } 74078 74079 for (let j = 0; j < generationFieldWidth; ++j) { 74080 const generationByte = stream.getByte(); 74081 74082 if (generationByte === -1) { 74083 throw new _util.FormatError("Invalid XRef byteWidths 'generation'."); 74084 } 74085 74086 generation = generation << 8 | generationByte; 74087 } 74088 74089 const entry = {}; 74090 entry.offset = offset; 74091 entry.gen = generation; 74092 74093 switch (type) { 74094 case 0: 74095 entry.free = true; 74096 break; 74097 74098 case 1: 74099 entry.uncompressed = true; 74100 break; 74101 74102 case 2: 74103 break; 74104 74105 default: 74106 throw new _util.FormatError(`Invalid XRef entry type: ${type}`); 74107 } 74108 74109 if (!this.entries[first + i]) { 74110 this.entries[first + i] = entry; 74111 } 74112 } 74113 74114 streamState.entryNum = 0; 74115 streamState.streamPos = stream.pos; 74116 entryRanges.splice(0, 2); 74117 } 74118 } 74119 74120 indexObjects() { 74121 const TAB = 0x9, 74122 LF = 0xa, 74123 CR = 0xd, 74124 SPACE = 0x20; 74125 const PERCENT = 0x25, 74126 LT = 0x3c; 74127 74128 function readToken(data, offset) { 74129 let token = "", 74130 ch = data[offset]; 74131 74132 while (ch !== LF && ch !== CR && ch !== LT) { 74133 if (++offset >= data.length) { 74134 break; 74135 } 74136 74137 token += String.fromCharCode(ch); 74138 ch = data[offset]; 74139 } 74140 74141 return token; 74142 } 74143 74144 function skipUntil(data, offset, what) { 74145 const length = what.length, 74146 dataLength = data.length; 74147 let skipped = 0; 74148 74149 while (offset < dataLength) { 74150 let i = 0; 74151 74152 while (i < length && data[offset + i] === what[i]) { 74153 ++i; 74154 } 74155 74156 if (i >= length) { 74157 break; 74158 } 74159 74160 offset++; 74161 skipped++; 74162 } 74163 74164 return skipped; 74165 } 74166 74167 const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/; 74168 const endobjRegExp = /\bendobj[\b\s]$/; 74169 const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/; 74170 const CHECK_CONTENT_LENGTH = 25; 74171 const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]); 74172 const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]); 74173 const objBytes = new Uint8Array([111, 98, 106]); 74174 const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]); 74175 this.entries.length = 0; 74176 74177 this._cacheMap.clear(); 74178 74179 const stream = this.stream; 74180 stream.pos = 0; 74181 const buffer = stream.getBytes(), 74182 length = buffer.length; 74183 let position = stream.start; 74184 const trailers = [], 74185 xrefStms = []; 74186 74187 while (position < length) { 74188 let ch = buffer[position]; 74189 74190 if (ch === TAB || ch === LF || ch === CR || ch === SPACE) { 74191 ++position; 74192 continue; 74193 } 74194 74195 if (ch === PERCENT) { 74196 do { 74197 ++position; 74198 74199 if (position >= length) { 74200 break; 74201 } 74202 74203 ch = buffer[position]; 74204 } while (ch !== LF && ch !== CR); 74205 74206 continue; 74207 } 74208 74209 const token = readToken(buffer, position); 74210 let m; 74211 74212 if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) { 74213 position += skipUntil(buffer, position, trailerBytes); 74214 trailers.push(position); 74215 position += skipUntil(buffer, position, startxrefBytes); 74216 } else if (m = objRegExp.exec(token)) { 74217 const num = m[1] | 0, 74218 gen = m[2] | 0; 74219 let contentLength, 74220 startPos = position + token.length, 74221 updateEntries = false; 74222 74223 if (!this.entries[num]) { 74224 updateEntries = true; 74225 } else if (this.entries[num].gen === gen) { 74226 try { 74227 const parser = new _parser.Parser({ 74228 lexer: new _parser.Lexer(stream.makeSubStream(startPos)) 74229 }); 74230 parser.getObj(); 74231 updateEntries = true; 74232 } catch (ex) { 74233 if (ex instanceof _core_utils.ParserEOFException) { 74234 (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`); 74235 } else { 74236 updateEntries = true; 74237 } 74238 } 74239 } 74240 74241 if (updateEntries) { 74242 this.entries[num] = { 74243 offset: position - stream.start, 74244 gen, 74245 uncompressed: true 74246 }; 74247 } 74248 74249 while (startPos < buffer.length) { 74250 const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4; 74251 contentLength = endPos - position; 74252 const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos); 74253 const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos)); 74254 74255 if (endobjRegExp.test(tokenStr)) { 74256 break; 74257 } else { 74258 const objToken = nestedObjRegExp.exec(tokenStr); 74259 74260 if (objToken && objToken[1]) { 74261 (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.'); 74262 contentLength -= objToken[1].length; 74263 break; 74264 } 74265 } 74266 74267 startPos = endPos; 74268 } 74269 74270 const content = buffer.subarray(position, position + contentLength); 74271 const xrefTagOffset = skipUntil(content, 0, xrefBytes); 74272 74273 if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) { 74274 xrefStms.push(position - stream.start); 74275 this.xrefstms[position - stream.start] = 1; 74276 } 74277 74278 position += contentLength; 74279 } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) { 74280 trailers.push(position); 74281 position += skipUntil(buffer, position, startxrefBytes); 74282 } else { 74283 position += token.length + 1; 74284 } 74285 } 74286 74287 for (let i = 0, ii = xrefStms.length; i < ii; ++i) { 74288 this.startXRefQueue.push(xrefStms[i]); 74289 this.readXRef(true); 74290 } 74291 74292 let trailerDict; 74293 74294 for (let i = 0, ii = trailers.length; i < ii; ++i) { 74295 stream.pos = trailers[i]; 74296 const parser = new _parser.Parser({ 74297 lexer: new _parser.Lexer(stream), 74298 xref: this, 74299 allowStreams: true, 74300 recoveryMode: true 74301 }); 74302 const obj = parser.getObj(); 74303 74304 if (!(0, _primitives.isCmd)(obj, "trailer")) { 74305 continue; 74306 } 74307 74308 const dict = parser.getObj(); 74309 74310 if (!(dict instanceof _primitives.Dict)) { 74311 continue; 74312 } 74313 74314 try { 74315 const rootDict = dict.get("Root"); 74316 74317 if (!(rootDict instanceof _primitives.Dict)) { 74318 continue; 74319 } 74320 74321 const pagesDict = rootDict.get("Pages"); 74322 74323 if (!(pagesDict instanceof _primitives.Dict)) { 74324 continue; 74325 } 74326 74327 const pagesCount = pagesDict.get("Count"); 74328 74329 if (!Number.isInteger(pagesCount)) { 74330 continue; 74331 } 74332 } catch (ex) { 74333 continue; 74334 } 74335 74336 if (dict.has("ID")) { 74337 return dict; 74338 } 74339 74340 trailerDict = dict; 74341 } 74342 74343 if (trailerDict) { 74344 return trailerDict; 74345 } 74346 74347 if (this.topDict) { 74348 return this.topDict; 74349 } 74350 74351 throw new _util.InvalidPDFException("Invalid PDF structure."); 74352 } 74353 74354 readXRef(recoveryMode = false) { 74355 const stream = this.stream; 74356 const startXRefParsedCache = new Set(); 74357 74358 try { 74359 while (this.startXRefQueue.length) { 74360 const startXRef = this.startXRefQueue[0]; 74361 74362 if (startXRefParsedCache.has(startXRef)) { 74363 (0, _util.warn)("readXRef - skipping XRef table since it was already parsed."); 74364 this.startXRefQueue.shift(); 74365 continue; 74366 } 74367 74368 startXRefParsedCache.add(startXRef); 74369 stream.pos = startXRef + stream.start; 74370 const parser = new _parser.Parser({ 74371 lexer: new _parser.Lexer(stream), 74372 xref: this, 74373 allowStreams: true 74374 }); 74375 let obj = parser.getObj(); 74376 let dict; 74377 74378 if ((0, _primitives.isCmd)(obj, "xref")) { 74379 dict = this.processXRefTable(parser); 74380 74381 if (!this.topDict) { 74382 this.topDict = dict; 74383 } 74384 74385 obj = dict.get("XRefStm"); 74386 74387 if (Number.isInteger(obj)) { 74388 const pos = obj; 74389 74390 if (!(pos in this.xrefstms)) { 74391 this.xrefstms[pos] = 1; 74392 this.startXRefQueue.push(pos); 74393 } 74394 } 74395 } else if (Number.isInteger(obj)) { 74396 if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) { 74397 throw new _util.FormatError("Invalid XRef stream"); 74398 } 74399 74400 dict = this.processXRefStream(obj); 74401 74402 if (!this.topDict) { 74403 this.topDict = dict; 74404 } 74405 74406 if (!dict) { 74407 throw new _util.FormatError("Failed to read XRef stream"); 74408 } 74409 } else { 74410 throw new _util.FormatError("Invalid XRef stream header"); 74411 } 74412 74413 obj = dict.get("Prev"); 74414 74415 if (Number.isInteger(obj)) { 74416 this.startXRefQueue.push(obj); 74417 } else if (obj instanceof _primitives.Ref) { 74418 this.startXRefQueue.push(obj.num); 74419 } 74420 74421 this.startXRefQueue.shift(); 74422 } 74423 74424 return this.topDict; 74425 } catch (e) { 74426 if (e instanceof _core_utils.MissingDataException) { 74427 throw e; 74428 } 74429 74430 (0, _util.info)("(while reading XRef): " + e); 74431 this.startXRefQueue.shift(); 74432 } 74433 74434 if (recoveryMode) { 74435 return undefined; 74436 } 74437 74438 throw new _core_utils.XRefParseException(); 74439 } 74440 74441 getEntry(i) { 74442 const xrefEntry = this.entries[i]; 74443 74444 if (xrefEntry && !xrefEntry.free && xrefEntry.offset) { 74445 return xrefEntry; 74446 } 74447 74448 return null; 74449 } 74450 74451 fetchIfRef(obj, suppressEncryption = false) { 74452 if (obj instanceof _primitives.Ref) { 74453 return this.fetch(obj, suppressEncryption); 74454 } 74455 74456 return obj; 74457 } 74458 74459 fetch(ref, suppressEncryption = false) { 74460 if (!(ref instanceof _primitives.Ref)) { 74461 throw new Error("ref object is not a reference"); 74462 } 74463 74464 const num = ref.num; 74465 74466 const cacheEntry = this._cacheMap.get(num); 74467 74468 if (cacheEntry !== undefined) { 74469 if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) { 74470 cacheEntry.objId = ref.toString(); 74471 } 74472 74473 return cacheEntry; 74474 } 74475 74476 let xrefEntry = this.getEntry(num); 74477 74478 if (xrefEntry === null) { 74479 this._cacheMap.set(num, xrefEntry); 74480 74481 return xrefEntry; 74482 } 74483 74484 if (this._pendingRefs.has(ref)) { 74485 this._pendingRefs.remove(ref); 74486 74487 (0, _util.warn)(`Ignoring circular reference: ${ref}.`); 74488 return _primitives.CIRCULAR_REF; 74489 } 74490 74491 this._pendingRefs.put(ref); 74492 74493 try { 74494 if (xrefEntry.uncompressed) { 74495 xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption); 74496 } else { 74497 xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption); 74498 } 74499 74500 this._pendingRefs.remove(ref); 74501 } catch (ex) { 74502 this._pendingRefs.remove(ref); 74503 74504 throw ex; 74505 } 74506 74507 if (xrefEntry instanceof _primitives.Dict) { 74508 xrefEntry.objId = ref.toString(); 74509 } else if (xrefEntry instanceof _base_stream.BaseStream) { 74510 xrefEntry.dict.objId = ref.toString(); 74511 } 74512 74513 return xrefEntry; 74514 } 74515 74516 fetchUncompressed(ref, xrefEntry, suppressEncryption = false) { 74517 const gen = ref.gen; 74518 let num = ref.num; 74519 74520 if (xrefEntry.gen !== gen) { 74521 throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`); 74522 } 74523 74524 const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start); 74525 const parser = new _parser.Parser({ 74526 lexer: new _parser.Lexer(stream), 74527 xref: this, 74528 allowStreams: true 74529 }); 74530 const obj1 = parser.getObj(); 74531 const obj2 = parser.getObj(); 74532 const obj3 = parser.getObj(); 74533 74534 if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) { 74535 throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`); 74536 } 74537 74538 if (obj3.cmd !== "obj") { 74539 if (obj3.cmd.startsWith("obj")) { 74540 num = parseInt(obj3.cmd.substring(3), 10); 74541 74542 if (!Number.isNaN(num)) { 74543 return num; 74544 } 74545 } 74546 74547 throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`); 74548 } 74549 74550 if (this.encrypt && !suppressEncryption) { 74551 xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen)); 74552 } else { 74553 xrefEntry = parser.getObj(); 74554 } 74555 74556 if (!(xrefEntry instanceof _base_stream.BaseStream)) { 74557 this._cacheMap.set(num, xrefEntry); 74558 } 74559 74560 return xrefEntry; 74561 } 74562 74563 fetchCompressed(ref, xrefEntry, suppressEncryption = false) { 74564 const tableOffset = xrefEntry.offset; 74565 const stream = this.fetch(_primitives.Ref.get(tableOffset, 0)); 74566 74567 if (!(stream instanceof _base_stream.BaseStream)) { 74568 throw new _util.FormatError("bad ObjStm stream"); 74569 } 74570 74571 const first = stream.dict.get("First"); 74572 const n = stream.dict.get("N"); 74573 74574 if (!Number.isInteger(first) || !Number.isInteger(n)) { 74575 throw new _util.FormatError("invalid first and n parameters for ObjStm stream"); 74576 } 74577 74578 let parser = new _parser.Parser({ 74579 lexer: new _parser.Lexer(stream), 74580 xref: this, 74581 allowStreams: true 74582 }); 74583 const nums = new Array(n); 74584 const offsets = new Array(n); 74585 74586 for (let i = 0; i < n; ++i) { 74587 const num = parser.getObj(); 74588 74589 if (!Number.isInteger(num)) { 74590 throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`); 74591 } 74592 74593 const offset = parser.getObj(); 74594 74595 if (!Number.isInteger(offset)) { 74596 throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`); 74597 } 74598 74599 nums[i] = num; 74600 offsets[i] = offset; 74601 } 74602 74603 const start = (stream.start || 0) + first; 74604 const entries = new Array(n); 74605 74606 for (let i = 0; i < n; ++i) { 74607 const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined; 74608 74609 if (length < 0) { 74610 throw new _util.FormatError("Invalid offset in the ObjStm stream."); 74611 } 74612 74613 parser = new _parser.Parser({ 74614 lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)), 74615 xref: this, 74616 allowStreams: true 74617 }); 74618 const obj = parser.getObj(); 74619 entries[i] = obj; 74620 74621 if (obj instanceof _base_stream.BaseStream) { 74622 continue; 74623 } 74624 74625 const num = nums[i], 74626 entry = this.entries[num]; 74627 74628 if (entry && entry.offset === tableOffset && entry.gen === i) { 74629 this._cacheMap.set(num, obj); 74630 } 74631 } 74632 74633 xrefEntry = entries[xrefEntry.gen]; 74634 74635 if (xrefEntry === undefined) { 74636 throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`); 74637 } 74638 74639 return xrefEntry; 74640 } 74641 74642 async fetchIfRefAsync(obj, suppressEncryption) { 74643 if (obj instanceof _primitives.Ref) { 74644 return this.fetchAsync(obj, suppressEncryption); 74645 } 74646 74647 return obj; 74648 } 74649 74650 async fetchAsync(ref, suppressEncryption) { 74651 try { 74652 return this.fetch(ref, suppressEncryption); 74653 } catch (ex) { 74654 if (!(ex instanceof _core_utils.MissingDataException)) { 74655 throw ex; 74656 } 74657 74658 await this.pdfManager.requestRange(ex.begin, ex.end); 74659 return this.fetchAsync(ref, suppressEncryption); 74660 } 74661 } 74662 74663 getCatalogObj() { 74664 return this.root; 74665 } 74666 74667} 74668 74669exports.XRef = XRef; 74670 74671/***/ }), 74672/* 102 */ 74673/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 74674 74675 74676 74677Object.defineProperty(exports, "__esModule", ({ 74678 value: true 74679})); 74680exports.MessageHandler = void 0; 74681 74682var _util = __w_pdfjs_require__(2); 74683 74684const CallbackKind = { 74685 UNKNOWN: 0, 74686 DATA: 1, 74687 ERROR: 2 74688}; 74689const StreamKind = { 74690 UNKNOWN: 0, 74691 CANCEL: 1, 74692 CANCEL_COMPLETE: 2, 74693 CLOSE: 3, 74694 ENQUEUE: 4, 74695 ERROR: 5, 74696 PULL: 6, 74697 PULL_COMPLETE: 7, 74698 START_COMPLETE: 8 74699}; 74700 74701function wrapReason(reason) { 74702 if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) { 74703 (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'); 74704 } 74705 74706 switch (reason.name) { 74707 case "AbortException": 74708 return new _util.AbortException(reason.message); 74709 74710 case "MissingPDFException": 74711 return new _util.MissingPDFException(reason.message); 74712 74713 case "PasswordException": 74714 return new _util.PasswordException(reason.message, reason.code); 74715 74716 case "UnexpectedResponseException": 74717 return new _util.UnexpectedResponseException(reason.message, reason.status); 74718 74719 case "UnknownErrorException": 74720 return new _util.UnknownErrorException(reason.message, reason.details); 74721 74722 default: 74723 return new _util.UnknownErrorException(reason.message, reason.toString()); 74724 } 74725} 74726 74727class MessageHandler { 74728 constructor(sourceName, targetName, comObj) { 74729 this.sourceName = sourceName; 74730 this.targetName = targetName; 74731 this.comObj = comObj; 74732 this.callbackId = 1; 74733 this.streamId = 1; 74734 this.streamSinks = Object.create(null); 74735 this.streamControllers = Object.create(null); 74736 this.callbackCapabilities = Object.create(null); 74737 this.actionHandler = Object.create(null); 74738 74739 this._onComObjOnMessage = event => { 74740 const data = event.data; 74741 74742 if (data.targetName !== this.sourceName) { 74743 return; 74744 } 74745 74746 if (data.stream) { 74747 this._processStreamMessage(data); 74748 74749 return; 74750 } 74751 74752 if (data.callback) { 74753 const callbackId = data.callbackId; 74754 const capability = this.callbackCapabilities[callbackId]; 74755 74756 if (!capability) { 74757 throw new Error(`Cannot resolve callback ${callbackId}`); 74758 } 74759 74760 delete this.callbackCapabilities[callbackId]; 74761 74762 if (data.callback === CallbackKind.DATA) { 74763 capability.resolve(data.data); 74764 } else if (data.callback === CallbackKind.ERROR) { 74765 capability.reject(wrapReason(data.reason)); 74766 } else { 74767 throw new Error("Unexpected callback case"); 74768 } 74769 74770 return; 74771 } 74772 74773 const action = this.actionHandler[data.action]; 74774 74775 if (!action) { 74776 throw new Error(`Unknown action from worker: ${data.action}`); 74777 } 74778 74779 if (data.callbackId) { 74780 const cbSourceName = this.sourceName; 74781 const cbTargetName = data.sourceName; 74782 new Promise(function (resolve) { 74783 resolve(action(data.data)); 74784 }).then(function (result) { 74785 comObj.postMessage({ 74786 sourceName: cbSourceName, 74787 targetName: cbTargetName, 74788 callback: CallbackKind.DATA, 74789 callbackId: data.callbackId, 74790 data: result 74791 }); 74792 }, function (reason) { 74793 comObj.postMessage({ 74794 sourceName: cbSourceName, 74795 targetName: cbTargetName, 74796 callback: CallbackKind.ERROR, 74797 callbackId: data.callbackId, 74798 reason: wrapReason(reason) 74799 }); 74800 }); 74801 return; 74802 } 74803 74804 if (data.streamId) { 74805 this._createStreamSink(data); 74806 74807 return; 74808 } 74809 74810 action(data.data); 74811 }; 74812 74813 comObj.addEventListener("message", this._onComObjOnMessage); 74814 } 74815 74816 on(actionName, handler) { 74817 const ah = this.actionHandler; 74818 74819 if (ah[actionName]) { 74820 throw new Error(`There is already an actionName called "${actionName}"`); 74821 } 74822 74823 ah[actionName] = handler; 74824 } 74825 74826 send(actionName, data, transfers) { 74827 this.comObj.postMessage({ 74828 sourceName: this.sourceName, 74829 targetName: this.targetName, 74830 action: actionName, 74831 data 74832 }, transfers); 74833 } 74834 74835 sendWithPromise(actionName, data, transfers) { 74836 const callbackId = this.callbackId++; 74837 const capability = (0, _util.createPromiseCapability)(); 74838 this.callbackCapabilities[callbackId] = capability; 74839 74840 try { 74841 this.comObj.postMessage({ 74842 sourceName: this.sourceName, 74843 targetName: this.targetName, 74844 action: actionName, 74845 callbackId, 74846 data 74847 }, transfers); 74848 } catch (ex) { 74849 capability.reject(ex); 74850 } 74851 74852 return capability.promise; 74853 } 74854 74855 sendWithStream(actionName, data, queueingStrategy, transfers) { 74856 const streamId = this.streamId++, 74857 sourceName = this.sourceName, 74858 targetName = this.targetName, 74859 comObj = this.comObj; 74860 return new ReadableStream({ 74861 start: controller => { 74862 const startCapability = (0, _util.createPromiseCapability)(); 74863 this.streamControllers[streamId] = { 74864 controller, 74865 startCall: startCapability, 74866 pullCall: null, 74867 cancelCall: null, 74868 isClosed: false 74869 }; 74870 comObj.postMessage({ 74871 sourceName, 74872 targetName, 74873 action: actionName, 74874 streamId, 74875 data, 74876 desiredSize: controller.desiredSize 74877 }, transfers); 74878 return startCapability.promise; 74879 }, 74880 pull: controller => { 74881 const pullCapability = (0, _util.createPromiseCapability)(); 74882 this.streamControllers[streamId].pullCall = pullCapability; 74883 comObj.postMessage({ 74884 sourceName, 74885 targetName, 74886 stream: StreamKind.PULL, 74887 streamId, 74888 desiredSize: controller.desiredSize 74889 }); 74890 return pullCapability.promise; 74891 }, 74892 cancel: reason => { 74893 (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason"); 74894 const cancelCapability = (0, _util.createPromiseCapability)(); 74895 this.streamControllers[streamId].cancelCall = cancelCapability; 74896 this.streamControllers[streamId].isClosed = true; 74897 comObj.postMessage({ 74898 sourceName, 74899 targetName, 74900 stream: StreamKind.CANCEL, 74901 streamId, 74902 reason: wrapReason(reason) 74903 }); 74904 return cancelCapability.promise; 74905 } 74906 }, queueingStrategy); 74907 } 74908 74909 _createStreamSink(data) { 74910 const streamId = data.streamId, 74911 sourceName = this.sourceName, 74912 targetName = data.sourceName, 74913 comObj = this.comObj; 74914 const self = this, 74915 action = this.actionHandler[data.action]; 74916 const streamSink = { 74917 enqueue(chunk, size = 1, transfers) { 74918 if (this.isCancelled) { 74919 return; 74920 } 74921 74922 const lastDesiredSize = this.desiredSize; 74923 this.desiredSize -= size; 74924 74925 if (lastDesiredSize > 0 && this.desiredSize <= 0) { 74926 this.sinkCapability = (0, _util.createPromiseCapability)(); 74927 this.ready = this.sinkCapability.promise; 74928 } 74929 74930 comObj.postMessage({ 74931 sourceName, 74932 targetName, 74933 stream: StreamKind.ENQUEUE, 74934 streamId, 74935 chunk 74936 }, transfers); 74937 }, 74938 74939 close() { 74940 if (this.isCancelled) { 74941 return; 74942 } 74943 74944 this.isCancelled = true; 74945 comObj.postMessage({ 74946 sourceName, 74947 targetName, 74948 stream: StreamKind.CLOSE, 74949 streamId 74950 }); 74951 delete self.streamSinks[streamId]; 74952 }, 74953 74954 error(reason) { 74955 (0, _util.assert)(reason instanceof Error, "error must have a valid reason"); 74956 74957 if (this.isCancelled) { 74958 return; 74959 } 74960 74961 this.isCancelled = true; 74962 comObj.postMessage({ 74963 sourceName, 74964 targetName, 74965 stream: StreamKind.ERROR, 74966 streamId, 74967 reason: wrapReason(reason) 74968 }); 74969 }, 74970 74971 sinkCapability: (0, _util.createPromiseCapability)(), 74972 onPull: null, 74973 onCancel: null, 74974 isCancelled: false, 74975 desiredSize: data.desiredSize, 74976 ready: null 74977 }; 74978 streamSink.sinkCapability.resolve(); 74979 streamSink.ready = streamSink.sinkCapability.promise; 74980 this.streamSinks[streamId] = streamSink; 74981 new Promise(function (resolve) { 74982 resolve(action(data.data, streamSink)); 74983 }).then(function () { 74984 comObj.postMessage({ 74985 sourceName, 74986 targetName, 74987 stream: StreamKind.START_COMPLETE, 74988 streamId, 74989 success: true 74990 }); 74991 }, function (reason) { 74992 comObj.postMessage({ 74993 sourceName, 74994 targetName, 74995 stream: StreamKind.START_COMPLETE, 74996 streamId, 74997 reason: wrapReason(reason) 74998 }); 74999 }); 75000 } 75001 75002 _processStreamMessage(data) { 75003 const streamId = data.streamId, 75004 sourceName = this.sourceName, 75005 targetName = data.sourceName, 75006 comObj = this.comObj; 75007 const streamController = this.streamControllers[streamId], 75008 streamSink = this.streamSinks[streamId]; 75009 75010 switch (data.stream) { 75011 case StreamKind.START_COMPLETE: 75012 if (data.success) { 75013 streamController.startCall.resolve(); 75014 } else { 75015 streamController.startCall.reject(wrapReason(data.reason)); 75016 } 75017 75018 break; 75019 75020 case StreamKind.PULL_COMPLETE: 75021 if (data.success) { 75022 streamController.pullCall.resolve(); 75023 } else { 75024 streamController.pullCall.reject(wrapReason(data.reason)); 75025 } 75026 75027 break; 75028 75029 case StreamKind.PULL: 75030 if (!streamSink) { 75031 comObj.postMessage({ 75032 sourceName, 75033 targetName, 75034 stream: StreamKind.PULL_COMPLETE, 75035 streamId, 75036 success: true 75037 }); 75038 break; 75039 } 75040 75041 if (streamSink.desiredSize <= 0 && data.desiredSize > 0) { 75042 streamSink.sinkCapability.resolve(); 75043 } 75044 75045 streamSink.desiredSize = data.desiredSize; 75046 new Promise(function (resolve) { 75047 resolve(streamSink.onPull && streamSink.onPull()); 75048 }).then(function () { 75049 comObj.postMessage({ 75050 sourceName, 75051 targetName, 75052 stream: StreamKind.PULL_COMPLETE, 75053 streamId, 75054 success: true 75055 }); 75056 }, function (reason) { 75057 comObj.postMessage({ 75058 sourceName, 75059 targetName, 75060 stream: StreamKind.PULL_COMPLETE, 75061 streamId, 75062 reason: wrapReason(reason) 75063 }); 75064 }); 75065 break; 75066 75067 case StreamKind.ENQUEUE: 75068 (0, _util.assert)(streamController, "enqueue should have stream controller"); 75069 75070 if (streamController.isClosed) { 75071 break; 75072 } 75073 75074 streamController.controller.enqueue(data.chunk); 75075 break; 75076 75077 case StreamKind.CLOSE: 75078 (0, _util.assert)(streamController, "close should have stream controller"); 75079 75080 if (streamController.isClosed) { 75081 break; 75082 } 75083 75084 streamController.isClosed = true; 75085 streamController.controller.close(); 75086 75087 this._deleteStreamController(streamController, streamId); 75088 75089 break; 75090 75091 case StreamKind.ERROR: 75092 (0, _util.assert)(streamController, "error should have stream controller"); 75093 streamController.controller.error(wrapReason(data.reason)); 75094 75095 this._deleteStreamController(streamController, streamId); 75096 75097 break; 75098 75099 case StreamKind.CANCEL_COMPLETE: 75100 if (data.success) { 75101 streamController.cancelCall.resolve(); 75102 } else { 75103 streamController.cancelCall.reject(wrapReason(data.reason)); 75104 } 75105 75106 this._deleteStreamController(streamController, streamId); 75107 75108 break; 75109 75110 case StreamKind.CANCEL: 75111 if (!streamSink) { 75112 break; 75113 } 75114 75115 new Promise(function (resolve) { 75116 resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason))); 75117 }).then(function () { 75118 comObj.postMessage({ 75119 sourceName, 75120 targetName, 75121 stream: StreamKind.CANCEL_COMPLETE, 75122 streamId, 75123 success: true 75124 }); 75125 }, function (reason) { 75126 comObj.postMessage({ 75127 sourceName, 75128 targetName, 75129 stream: StreamKind.CANCEL_COMPLETE, 75130 streamId, 75131 reason: wrapReason(reason) 75132 }); 75133 }); 75134 streamSink.sinkCapability.reject(wrapReason(data.reason)); 75135 streamSink.isCancelled = true; 75136 delete this.streamSinks[streamId]; 75137 break; 75138 75139 default: 75140 throw new Error("Unexpected stream case"); 75141 } 75142 } 75143 75144 async _deleteStreamController(streamController, streamId) { 75145 await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]); 75146 delete this.streamControllers[streamId]; 75147 } 75148 75149 destroy() { 75150 this.comObj.removeEventListener("message", this._onComObjOnMessage); 75151 } 75152 75153} 75154 75155exports.MessageHandler = MessageHandler; 75156 75157/***/ }), 75158/* 103 */ 75159/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 75160 75161 75162 75163Object.defineProperty(exports, "__esModule", ({ 75164 value: true 75165})); 75166exports.PDFWorkerStream = void 0; 75167 75168var _util = __w_pdfjs_require__(2); 75169 75170class PDFWorkerStream { 75171 constructor(msgHandler) { 75172 this._msgHandler = msgHandler; 75173 this._contentLength = null; 75174 this._fullRequestReader = null; 75175 this._rangeRequestReaders = []; 75176 } 75177 75178 getFullReader() { 75179 (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once."); 75180 this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler); 75181 return this._fullRequestReader; 75182 } 75183 75184 getRangeReader(begin, end) { 75185 const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler); 75186 75187 this._rangeRequestReaders.push(reader); 75188 75189 return reader; 75190 } 75191 75192 cancelAllRequests(reason) { 75193 if (this._fullRequestReader) { 75194 this._fullRequestReader.cancel(reason); 75195 } 75196 75197 for (const reader of this._rangeRequestReaders.slice(0)) { 75198 reader.cancel(reason); 75199 } 75200 } 75201 75202} 75203 75204exports.PDFWorkerStream = PDFWorkerStream; 75205 75206class PDFWorkerStreamReader { 75207 constructor(msgHandler) { 75208 this._msgHandler = msgHandler; 75209 this.onProgress = null; 75210 this._contentLength = null; 75211 this._isRangeSupported = false; 75212 this._isStreamingSupported = false; 75213 75214 const readableStream = this._msgHandler.sendWithStream("GetReader"); 75215 75216 this._reader = readableStream.getReader(); 75217 this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => { 75218 this._isStreamingSupported = data.isStreamingSupported; 75219 this._isRangeSupported = data.isRangeSupported; 75220 this._contentLength = data.contentLength; 75221 }); 75222 } 75223 75224 get headersReady() { 75225 return this._headersReady; 75226 } 75227 75228 get contentLength() { 75229 return this._contentLength; 75230 } 75231 75232 get isStreamingSupported() { 75233 return this._isStreamingSupported; 75234 } 75235 75236 get isRangeSupported() { 75237 return this._isRangeSupported; 75238 } 75239 75240 async read() { 75241 const { 75242 value, 75243 done 75244 } = await this._reader.read(); 75245 75246 if (done) { 75247 return { 75248 value: undefined, 75249 done: true 75250 }; 75251 } 75252 75253 return { 75254 value: value.buffer, 75255 done: false 75256 }; 75257 } 75258 75259 cancel(reason) { 75260 this._reader.cancel(reason); 75261 } 75262 75263} 75264 75265class PDFWorkerStreamRangeReader { 75266 constructor(begin, end, msgHandler) { 75267 this._msgHandler = msgHandler; 75268 this.onProgress = null; 75269 75270 const readableStream = this._msgHandler.sendWithStream("GetRangeReader", { 75271 begin, 75272 end 75273 }); 75274 75275 this._reader = readableStream.getReader(); 75276 } 75277 75278 get isStreamingSupported() { 75279 return false; 75280 } 75281 75282 async read() { 75283 const { 75284 value, 75285 done 75286 } = await this._reader.read(); 75287 75288 if (done) { 75289 return { 75290 value: undefined, 75291 done: true 75292 }; 75293 } 75294 75295 return { 75296 value: value.buffer, 75297 done: false 75298 }; 75299 } 75300 75301 cancel(reason) { 75302 this._reader.cancel(reason); 75303 } 75304 75305} 75306 75307/***/ }) 75308/******/ ]); 75309/************************************************************************/ 75310/******/ // The module cache 75311/******/ var __webpack_module_cache__ = {}; 75312/******/ 75313/******/ // The require function 75314/******/ function __w_pdfjs_require__(moduleId) { 75315/******/ // Check if module is in cache 75316/******/ var cachedModule = __webpack_module_cache__[moduleId]; 75317/******/ if (cachedModule !== undefined) { 75318/******/ return cachedModule.exports; 75319/******/ } 75320/******/ // Create a new module (and put it into the cache) 75321/******/ var module = __webpack_module_cache__[moduleId] = { 75322/******/ // no module.id needed 75323/******/ // no module.loaded needed 75324/******/ exports: {} 75325/******/ }; 75326/******/ 75327/******/ // Execute the module function 75328/******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__); 75329/******/ 75330/******/ // Return the exports of the module 75331/******/ return module.exports; 75332/******/ } 75333/******/ 75334/************************************************************************/ 75335/******/ /* webpack/runtime/define property getters */ 75336/******/ (() => { 75337/******/ // define getter functions for harmony exports 75338/******/ __w_pdfjs_require__.d = (exports, definition) => { 75339/******/ for(var key in definition) { 75340/******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) { 75341/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 75342/******/ } 75343/******/ } 75344/******/ }; 75345/******/ })(); 75346/******/ 75347/******/ /* webpack/runtime/hasOwnProperty shorthand */ 75348/******/ (() => { 75349/******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 75350/******/ })(); 75351/******/ 75352/******/ /* webpack/runtime/make namespace object */ 75353/******/ (() => { 75354/******/ // define __esModule on exports 75355/******/ __w_pdfjs_require__.r = (exports) => { 75356/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 75357/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 75358/******/ } 75359/******/ Object.defineProperty(exports, '__esModule', { value: true }); 75360/******/ }; 75361/******/ })(); 75362/******/ 75363/************************************************************************/ 75364var __webpack_exports__ = {}; 75365// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 75366(() => { 75367var exports = __webpack_exports__; 75368 75369 75370Object.defineProperty(exports, "__esModule", ({ 75371 value: true 75372})); 75373Object.defineProperty(exports, "WorkerMessageHandler", ({ 75374 enumerable: true, 75375 get: function () { 75376 return _worker.WorkerMessageHandler; 75377 } 75378})); 75379 75380var _worker = __w_pdfjs_require__(1); 75381 75382const pdfjsVersion = '2.16.105'; 75383const pdfjsBuild = '172ccdbe
vendor: 107 bytes, lines 75383-75390
753835'; 75384})(); 75385 75386/******/ return __webpack_exports__; 75387/******/ })() 75388; 75389}); 75390//# sourceMappingURL=pdf.worker.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.