1/** 2 * @licstart The following is the entire license notice for the 3 * Javascript code in this page 4 * 5 * Copyright 2021 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})(this, function() { 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 _pdf_manager = __w_pdfjs_require__(7); 52 53var _writer = __w_pdfjs_require__(71); 54 55var _is_node = __w_pdfjs_require__(4); 56 57var _message_handler = __w_pdfjs_require__(99); 58 59var _worker_stream = __w_pdfjs_require__(100); 60 61var _core_utils = __w_pdfjs_require__(9); 62 63class WorkerTask { 64 constructor(name) { 65 this.name = name; 66 this.terminated = false; 67 this._capability = (0, _util.createPromiseCapability)(); 68 } 69 70 get finished() { 71 return this._capability.promise; 72 } 73 74 finish() { 75 this._capability.resolve(); 76 } 77 78 terminate() { 79 this.terminated = true; 80 } 81 82 ensureNotTerminated() { 83 if (this.terminated) { 84 throw new Error("Worker task was terminated"); 85 } 86 } 87 88} 89 90exports.WorkerTask = WorkerTask; 91 92class WorkerMessageHandler { 93 static setup(handler, port) { 94 let testMessageProcessed = false; 95 handler.on("test", function wphSetupTest(data) { 96 if (testMessageProcessed) { 97 return; 98 } 99 100 testMessageProcessed = true; 101 handler.send("test", data instanceof Uint8Array && data[0] === 255); 102 }); 103 handler.on("configure", function wphConfigure(data) { 104 (0, _util.setVerbosityLevel)(data.verbosity); 105 }); 106 handler.on("GetDocRequest", function wphSetupDoc(data) { 107 return WorkerMessageHandler.createDocumentHandler(data, port); 108 }); 109 } 110 111 static createDocumentHandler(docParams, port) { 112 let pdfManager; 113 let terminated = false; 114 let cancelXHRs = null; 115 const WorkerTasks = []; 116 const verbosity = (0, _util.getVerbosityLevel)(); 117 const apiVersion = docParams.apiVersion; 118 const workerVersion = '2.12.313'; 119 120 if (apiVersion !== workerVersion) { 121 throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); 122 } 123 124 const enumerableProperties = []; 125 126 for (const property in []) { 127 enumerableProperties.push(property); 128 } 129 130 if (enumerableProperties.length) { 131 throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s."); 132 } 133 134 if (typeof ReadableStream === "undefined") { 135 throw new Error("The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); " + "please use a `legacy`-build instead."); 136 } 137 138 const docId = docParams.docId; 139 const docBaseUrl = docParams.docBaseUrl; 140 const workerHandlerName = docParams.docId + "_worker"; 141 let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port); 142 143 function ensureNotTerminated() { 144 if (terminated) { 145 throw new Error("Worker was terminated"); 146 } 147 } 148 149 function startWorkerTask(task) { 150 WorkerTasks.push(task); 151 } 152 153 function finishWorkerTask(task) { 154 task.finish(); 155 const i = WorkerTasks.indexOf(task); 156 WorkerTasks.splice(i, 1); 157 } 158 159 async function loadDocument(recoveryMode) { 160 await pdfManager.ensureDoc("checkHeader"); 161 await pdfManager.ensureDoc("parseStartXRef"); 162 await pdfManager.ensureDoc("parse", [recoveryMode]); 163 await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]); 164 await pdfManager.ensureDoc("checkLastPage", [recoveryMode]); 165 const isPureXfa = await pdfManager.ensureDoc("isPureXfa"); 166 167 if (isPureXfa) { 168 const task = new WorkerTask("loadXfaFonts"); 169 startWorkerTask(task); 170 await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]); 171 } 172 173 const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]); 174 const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null; 175 return { 176 numPages, 177 fingerprints, 178 htmlForXfa 179 }; 180 } 181 182 function getPdfManager(data, evaluatorOptions, enableXfa) { 183 const pdfManagerCapability = (0, _util.createPromiseCapability)(); 184 let newPdfManager; 185 const source = data.source; 186 187 if (source.data) { 188 try { 189 newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl); 190 pdfManagerCapability.resolve(newPdfManager); 191 } catch (ex) { 192 pdfManagerCapability.reject(ex); 193 } 194 195 return pdfManagerCapability.promise; 196 } 197 198 let pdfStream, 199 cachedChunks = []; 200
201 try { 202 pdfStream = new _worker_stream.PDFWorkerStream(handler); 203 } catch (ex) { 204 pdfManagerCapability.reject(ex); 205 return pdfManagerCapability.promise; 206 } 207 208 const fullRequest = pdfStream.getFullReader(); 209 fullRequest.headersReady.then(function () { 210 if (!fullRequest.isRangeSupported) { 211 return; 212 } 213 214 const disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported; 215 newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, { 216 msgHandler: handler, 217 password: source.password, 218 length: fullRequest.contentLength, 219 disableAutoFetch, 220 rangeChunkSize: source.rangeChunkSize 221 }, evaluatorOptions, enableXfa, docBaseUrl); 222 223 for (let i = 0; i < cachedChunks.length; i++) { 224 newPdfManager.sendProgressiveData(cachedChunks[i]); 225 } 226 227 cachedChunks = []; 228 pdfManagerCapability.resolve(newPdfManager); 229 cancelXHRs = null; 230 }).catch(function (reason) { 231 pdfManagerCapability.reject(reason); 232 cancelXHRs = null; 233 }); 234 let loaded = 0; 235 236 const flushChunks = function () { 237 const pdfFile = (0, _util.arraysToBytes)(cachedChunks); 238 239 if (source.length && pdfFile.length !== source.length) { 240 (0, _util.warn)("reported HTTP length is different from actual"); 241 } 242 243 try { 244 newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl); 245 pdfManagerCapability.resolve(newPdfManager); 246 } catch (ex) { 247 pdfManagerCapability.reject(ex); 248 } 249 250 cachedChunks = []; 251 }; 252 253 const readPromise = new Promise(function (resolve, reject) { 254 const readChunk = function ({ 255 value, 256 done 257 }) { 258 try { 259 ensureNotTerminated(); 260 261 if (done) { 262 if (!newPdfManager) { 263 flushChunks(); 264 } 265 266 cancelXHRs = null; 267 return; 268 } 269 270 loaded += (0, _util.arrayByteLength)(value); 271 272 if (!fullRequest.isStreamingSupported) { 273 handler.send("DocProgress", { 274 loaded, 275 total: Math.max(loaded, fullRequest.contentLength || 0) 276 }); 277 } 278 279 if (newPdfManager) { 280 newPdfManager.sendProgressiveData(value); 281 } else { 282 cachedChunks.push(value); 283 } 284 285 fullRequest.read().then(readChunk, reject); 286 } catch (e) { 287 reject(e); 288 } 289 }; 290 291 fullRequest.read().then(readChunk, reject); 292 }); 293 readPromise.catch(function (e) { 294 pdfManagerCapability.reject(e); 295 cancelXHRs = null; 296 }); 297 298 cancelXHRs = function (reason) { 299 pdfStream.cancelAllRequests(reason); 300 }; 301 302 return pdfManagerCapability.promise; 303 } 304 305 function setupDoc(data) { 306 function onSuccess(doc) { 307 ensureNotTerminated(); 308 handler.send("GetDoc", { 309 pdfInfo: doc 310 }); 311 } 312 313 function onFailure(ex) { 314 ensureNotTerminated(); 315 316 if (ex instanceof _util.PasswordException) { 317 const task = new WorkerTask(`PasswordException: response ${ex.code}`); 318 startWorkerTask(task); 319 handler.sendWithPromise("PasswordRequest", ex).then(function ({ 320 password 321 }) { 322 finishWorkerTask(task); 323 pdfManager.updatePassword(password); 324 pdfManagerReady(); 325 }).catch(function () { 326 finishWorkerTask(task); 327 handler.send("DocException", ex); 328 }); 329 } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) { 330 handler.send("DocException", ex); 331 } else { 332 handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString())); 333 } 334 } 335 336 function pdfManagerReady() { 337 ensureNotTerminated(); 338 loadDocument(false).then(onSuccess, function (reason) { 339 ensureNotTerminated(); 340 341 if (!(reason instanceof _core_utils.XRefParseException)) { 342 onFailure(reason); 343 return; 344 } 345 346 pdfManager.requestLoadedStream(); 347 pdfManager.onLoadedStream().then(function () { 348 ensureNotTerminated();
349 loadDocument(true).then(onSuccess, onFailure); 350 }); 351 }); 352 } 353 354 ensureNotTerminated(); 355 const evaluatorOptions = { 356 maxImageSize: data.maxImageSize, 357 disableFontFace: data.disableFontFace, 358 ignoreErrors: data.ignoreErrors, 359 isEvalSupported: data.isEvalSupported, 360 fontExtraProperties: data.fontExtraProperties, 361 useSystemFonts: data.useSystemFonts, 362 cMapUrl: data.cMapUrl, 363 standardFontDataUrl: data.standardFontDataUrl 364 }; 365 getPdfManager(data, evaluatorOptions, data.enableXfa).then(function (newPdfManager) { 366 if (terminated) { 367 newPdfManager.terminate(new _util.AbortException("Worker was terminated.")); 368 throw new Error("Worker was terminated"); 369 } 370 371 pdfManager = newPdfManager; 372 pdfManager.onLoadedStream().then(function (stream) { 373 handler.send("DataLoaded", { 374 length: stream.bytes.byteLength 375 }); 376 }); 377 }).then(pdfManagerReady, onFailure); 378 } 379 380 handler.on("GetPage", function wphSetupGetPage(data) { 381 return pdfManager.getPage(data.pageIndex).then(function (page) { 382 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]) { 383 return { 384 rotate, 385 ref, 386 userUnit, 387 view 388 }; 389 }); 390 }); 391 }); 392 handler.on("GetPageIndex", function wphSetupGetPageIndex({ 393 ref 394 }) { 395 const pageRef = _primitives.Ref.get(ref.num, ref.gen); 396 397 return pdfManager.ensureCatalog("getPageIndex", [pageRef]); 398 }); 399 handler.on("GetDestinations", function wphSetupGetDestinations(data) { 400 return pdfManager.ensureCatalog("destinations"); 401 }); 402 handler.on("GetDestination", function wphSetupGetDestination(data) { 403 return pdfManager.ensureCatalog("getDestination", [data.id]); 404 }); 405 handler.on("GetPageLabels", function wphSetupGetPageLabels(data) { 406 return pdfManager.ensureCatalog("pageLabels"); 407 }); 408 handler.on("GetPageLayout", function wphSetupGetPageLayout(data) { 409 return pdfManager.ensureCatalog("pageLayout"); 410 }); 411 handler.on("GetPageMode", function wphSetupGetPageMode(data) { 412 return pdfManager.ensureCatalog("pageMode"); 413 }); 414 handler.on("GetViewerPreferences", function (data) { 415 return pdfManager.ensureCatalog("viewerPreferences"); 416 }); 417 handler.on("GetOpenAction", function (data) { 418 return pdfManager.ensureCatalog("openAction"); 419 }); 420 handler.on("GetAttachments", function wphSetupGetAttachments(data) { 421 return pdfManager.ensureCatalog("attachments"); 422 }); 423 handler.on("GetJavaScript", function wphSetupGetJavaScript(data) { 424 return pdfManager.ensureCatalog("javaScript"); 425 }); 426 handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) { 427 return pdfManager.ensureCatalog("jsActions"); 428 }); 429 handler.on("GetPageJSActions", function ({ 430 pageIndex 431 }) { 432 return pdfManager.getPage(pageIndex).then(function (page) { 433 return pdfManager.ensure(page, "jsActions"); 434 }); 435 }); 436 handler.on("GetOutline", function wphSetupGetOutline(data) { 437 return pdfManager.ensureCatalog("documentOutline"); 438 }); 439 handler.on("GetOptionalContentConfig", function (data) { 440 return pdfManager.ensureCatalog("optionalContentConfig"); 441 }); 442 handler.on("GetPermissions", function (data) { 443 return pdfManager.ensureCatalog("permissions"); 444 }); 445 handler.on("GetMetadata", function wphSetupGetMetadata(data) { 446 return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]); 447 }); 448 handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) { 449 return pdfManager.ensureCatalog("markInfo"); 450 }); 451 handler.on("GetData", function wphSetupGetData(data) { 452 pdfManager.requestLoadedStream(); 453 return pdfManager.onLoadedStream().then(function (stream) { 454 return stream.bytes; 455 }); 456 }); 457 handler.on("GetAnnotations", function ({ 458 pageIndex, 459 intent 460 }) { 461 return pdfManager.getPage(pageIndex).then(function (page) { 462 return page.getAnnotationsData(intent); 463 }); 464 }); 465 handler.on("GetFieldObjects", function (data) { 466 return pdfManager.ensureDoc("fieldObjects"); 467 }); 468 handler.on("HasJSActions", function (data) { 469 return pdfManager.ensureDoc("hasJSActions"); 470 }); 471 handler.on("GetCalculationOrderIds", function (data) { 472 return pdfManager.ensureDoc("calculationOrderIds"); 473 }); 474 handler.on("SaveDocument", function ({ 475 isPureXfa, 476 numPages, 477 annotationStorage, 478 filename 479 }) { 480 pdfManager.requestLoadedStream(); 481 const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")]; 482 483 if (isPureXfa) { 484 promises.push(pdfManager.serializeXfaData(annotationStorage)); 485 } else { 486 for (let pageIndex = 0; pageIndex < numPages; pageIndex++) { 487 promises.push(pdfManager.getPage(pageIndex).then(function (page) { 488 const task = new WorkerTask(`Save: page ${pageIndex}`); 489 return page.save(handler, task, annotationStorage).finally(function () { 490 finishWorkerTask(task); 491 }); 492 })); 493 } 494 } 495 496 return Promise.all(promises).then(function ([stream, acroForm, acroFormRef, xref, startXRef, ...refs]) { 497 let newRefs = []; 498 let xfaData = null; 499 500 if (isPureXfa) { 501 xfaData = refs[0]; 502 503 if (!xfaData) { 504 return stream.bytes; 505 } 506 } else { 507 for (const ref of refs) { 508 newRefs = ref.filter(x => x !== null).reduce((a, b) =>
508 a.concat(b), newRefs); 509 } 510 511 if (newRefs.length === 0) { 512 return stream.bytes; 513 } 514 } 515 516 const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null; 517 let xfaDatasetsRef = null; 518 let hasXfaDatasetsEntry = false; 519 520 if (Array.isArray(xfa)) { 521 for (let i = 0, ii = xfa.length; i < ii; i += 2) { 522 if (xfa[i] === "datasets") { 523 xfaDatasetsRef = xfa[i + 1]; 524 acroFormRef = null; 525 hasXfaDatasetsEntry = true; 526 } 527 } 528 529 if (xfaDatasetsRef === null) { 530 xfaDatasetsRef = xref.getNewRef(); 531 } 532 } else if (xfa) { 533 acroFormRef = null; 534 (0, _util.warn)("Unsupported XFA type."); 535 } 536 537 let newXrefInfo = Object.create(null); 538 539 if (xref.trailer) { 540 const infoObj = Object.create(null); 541 const xrefInfo = xref.trailer.get("Info") || null; 542 543 if (xrefInfo instanceof _primitives.Dict) { 544 xrefInfo.forEach((key, value) => { 545 if ((0, _util.isString)(key) && (0, _util.isString)(value)) { 546 infoObj[key] = (0, _util.stringToPDFString)(value); 547 } 548 }); 549 } 550 551 newXrefInfo = { 552 rootRef: xref.trailer.getRaw("Root") || null, 553 encryptRef: xref.trailer.getRaw("Encrypt") || null, 554 newRef: xref.getNewRef(), 555 infoRef: xref.trailer.getRaw("Info") || null, 556 info: infoObj, 557 fileIds: xref.trailer.get("ID") || null, 558 startXRef, 559 filename 560 }; 561 } 562 563 xref.resetNewRef(); 564 return (0, _writer.incrementalUpdate)({ 565 originalData: stream.bytes, 566 xrefInfo: newXrefInfo, 567 newRefs, 568 xref, 569 hasXfa: !!xfa, 570 xfaDatasetsRef, 571 hasXfaDatasetsEntry, 572 acroFormRef, 573 acroForm, 574 xfaData 575 }); 576 }); 577 }); 578 handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) { 579 const pageIndex = data.pageIndex; 580 pdfManager.getPage(pageIndex).then(function (page) { 581 const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`); 582 startWorkerTask(task); 583 const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0; 584 page.getOperatorList({ 585 handler, 586 sink, 587 task, 588 intent: data.intent, 589 cacheKey: data.cacheKey, 590 annotationStorage: data.annotationStorage 591 }).then(function (operatorListInfo) { 592 finishWorkerTask(task); 593 594 if (start) { 595 (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`); 596 } 597 598 sink.close(); 599 }, function (reason) { 600 finishWorkerTask(task); 601 602 if (task.terminated) { 603 return; 604 } 605 606 handler.send("UnsupportedFeature", { 607 featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList 608 }); 609 sink.error(reason); 610 }); 611 }); 612 }); 613 handler.on("GetTextContent", function wphExtractText(data, sink) { 614 const pageIndex = data.pageIndex; 615 pdfManager.getPage(pageIndex).then(function (page) { 616 const task = new WorkerTask("GetTextContent: page " + pageIndex); 617 startWorkerTask(task); 618 const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0; 619 page.extractTextContent({ 620 handler, 621 task, 622 sink, 623 normalizeWhitespace: data.normalizeWhitespace, 624 includeMarkedContent: data.includeMarkedContent, 625 combineTextItems: data.combineTextItems 626 }).then(function () { 627 finishWorkerTask(task); 628 629 if (start) { 630 (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`); 631 } 632 633 sink.close(); 634 }, function (reason) { 635 finishWorkerTask(task); 636 637 if (task.terminated) { 638 return; 639 } 640 641 sink.error(reason); 642 }); 643 }); 644 }); 645 handler.on("GetStructTree", function wphGetStructTree(data) { 646 return pdfManager.getPage(data.pageIndex).then(function (page) { 647 return pdfManager.ensure(page, "getStructTree"); 648 }); 649 }); 650 handler.on("FontFallback", function (data) { 651 return pdfManager.fontFallback(data.id, handler); 652 }); 653 handler.on("Cleanup", function wphCleanup(data) { 654 return pdfManager.cleanup(true); 655 }); 656 handler.on("Terminate", function wphTerminate(data) { 657 terminated = true; 658 const waitOn = []; 659 660 if (pdfManager) { 661 pdfManager.terminate(new _util.AbortException("Worker was terminated.")); 662 const cleanupPromise = pdfManager.cleanup(); 663 waitOn.push(cleanupPromise); 664 pdfManager = null; 665 } else { 666 (0, _primitives.clearPrimitiveCaches)(); 667 } 668 669 if (cancelXHRs) { 670 cancelXHRs(new _util.AbortException("Worker was terminated.")); 671 } 672 673 for (const task of WorkerTasks) { 674 waitOn.push(task.finished); 675 task.terminate(); 676 } 677 678 return Promise.all(waitOn).then(function () { 679 handler.destroy(); 680 handler = null; 681 }); 682 }); 683 handler.on("Ready", function wphReady(data) { 684 setupDoc(docParams); 685 docParams = null; 686 }); 687 return workerHandlerName; 688 } 689 690 static initializeFromPort(port) { 691 const handler = new _message_handler.MessageHandler("worker", "main", port); 692 WorkerMessageHandler.setup(handler, port); 693 handler.send("ready", null); 694 } 695 696} 697 698exports.WorkerMessageHandler = WorkerMessageHandler; 699 700function isMessagePort(maybePort) { 701 return typeof maybePort.postMessage === "function" && "onmessage" in maybePort; 702} 703 704if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) { 705 WorkerMessageHandler.initializeFromPort(self); 706} 707 708/***/ }), 709/* 2 */ 710/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 711 712 713 714Object.defineProperty(exports, "__esModule", ({ 715 value: true 716})); 717exports.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.IsLittleEndianCached = exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exp
717orts.IDENTITY_MATRIX = exports.FormatError = exports.FontType = 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.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0; 718exports.arrayByteLength = arrayByteLength; 719exports.arraysToBytes = arraysToBytes; 720exports.assert = assert; 721exports.bytesToString = bytesToString; 722exports.createObjectURL = createObjectURL; 723exports.createPromiseCapability = createPromiseCapability; 724exports.createValidAbsoluteUrl = createValidAbsoluteUrl; 725exports.escapeString = escapeString; 726exports.getModificationDate = getModificationDate; 727exports.getVerbosityLevel = getVerbosityLevel; 728exports.info = info; 729exports.isArrayBuffer = isArrayBuffer; 730exports.isArrayEqual = isArrayEqual; 731exports.isAscii = isAscii; 732exports.isBool = isBool; 733exports.isNum = isNum; 734exports.isSameOrigin = isSameOrigin; 735exports.isString = isString; 736exports.objectFromMap = objectFromMap; 737exports.objectSize = objectSize; 738exports.removeNullCharacters = removeNullCharacters; 739exports.setVerbosityLevel = setVerbosityLevel; 740exports.shadow = shadow; 741exports.string32 = string32; 742exports.stringToBytes = stringToBytes; 743exports.stringToPDFString = stringToPDFString; 744exports.stringToUTF16BEString = stringToUTF16BEString; 745exports.stringToUTF8String = stringToUTF8String; 746exports.unreachable = unreachable; 747exports.utf8StringToString = utf8StringToString; 748exports.warn = warn; 749 750__w_pdfjs_require__(3); 751 752const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; 753exports.IDENTITY_MATRIX = IDENTITY_MATRIX; 754const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; 755exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; 756const RenderingIntentFlag = { 757 ANY: 0x01, 758 DISPLAY: 0x02, 759 PRINT: 0x04, 760 ANNOTATIONS_FORMS: 0x10, 761 ANNOTATIONS_STORAGE: 0x20, 762 ANNOTATIONS_DISABLE: 0x40, 763 OPLIST: 0x100 764}; 765exports.RenderingIntentFlag = RenderingIntentFlag; 766const AnnotationMode = { 767 DISABLE: 0, 768 ENABLE: 1, 769 ENABLE_FORMS: 2, 770 ENABLE_STORAGE: 3 771}; 772exports.AnnotationMode = AnnotationMode; 773const PermissionFlag = { 774 PRINT: 0x04, 775 MODIFY_CONTENTS: 0x08, 776 COPY: 0x10, 777 MODIFY_ANNOTATIONS: 0x20, 778 FILL_INTERACTIVE_FORMS: 0x100, 779 COPY_FOR_ACCESSIBILITY: 0x200, 780 ASSEMBLE: 0x400, 781 PRINT_HIGH_QUALITY: 0x800 782}; 783exports.PermissionFlag = PermissionFlag; 784const TextRenderingMode = { 785 FILL: 0, 786 STROKE: 1, 787 FILL_STROKE: 2, 788 INVISIBLE: 3, 789 FILL_ADD_TO_PATH: 4, 790 STROKE_ADD_TO_PATH: 5, 791 FILL_STROKE_ADD_TO_PATH: 6, 792 ADD_TO_PATH: 7, 793 FILL_STROKE_MASK: 3, 794 ADD_TO_PATH_FLAG: 4 795}; 796exports.TextRenderingMode = TextRenderingMode; 797const ImageKind = { 798 GRAYSCALE_1BPP: 1, 799 RGB_24BPP: 2, 800 RGBA_32BPP: 3 801}; 802exports.ImageKind = ImageKind; 803const AnnotationType = { 804 TEXT: 1, 805 LINK: 2, 806 FREETEXT: 3, 807 LINE: 4, 808 SQUARE: 5, 809 CIRCLE: 6, 810 POLYGON: 7, 811 POLYLINE: 8, 812 HIGHLIGHT: 9, 813 UNDERLINE: 10, 814 SQUIGGLY: 11, 815 STRIKEOUT: 12, 816 STAMP: 13, 817 CARET: 14, 818 INK: 15, 819 POPUP: 16, 820 FILEATTACHMENT: 17, 821 SOUND: 18, 822 MOVIE: 19, 823 WIDGET: 20, 824 SCREEN: 21, 825 PRINTERMARK: 22, 826 TRAPNET: 23, 827 WATERMARK: 24, 828 THREED: 25, 829 REDACT: 26 830}; 831exports.AnnotationType = AnnotationType; 832const AnnotationStateModelType = { 833 MARKED: "Marked", 834 REVIEW: "Review" 835}; 836exports.AnnotationStateModelType = AnnotationStateModelType; 837const AnnotationMarkedState = { 838 MARKED: "Marked", 839 UNMARKED: "Unmarked" 840}; 841exports.AnnotationMarkedState = AnnotationMarkedState; 842const AnnotationReviewState = { 843 ACCEPTED: "Accepted", 844 REJECTED: "Rejected", 845 CANCELLED: "Cancelled", 846 COMPLETED: "Completed", 847 NONE: "None" 848}; 849exports.AnnotationReviewState = AnnotationReviewState; 850const AnnotationReplyType = { 851 GROUP: "Group", 852 REPLY: "R" 853}; 854exports.AnnotationReplyType = AnnotationReplyType; 855const AnnotationFlag = { 856 INVISIBLE: 0x01, 857 HIDDEN: 0x02, 858 PRINT: 0x04, 859 NOZOOM: 0x08, 860 NOROTATE: 0x10, 861 NOVIEW: 0x20, 862 READONLY: 0x40, 863 LOCKED: 0x80, 864 TOGGLENOVIEW: 0x100, 865 LOCKEDCONTENTS: 0x200 866}; 867exports.AnnotationFlag = AnnotationFlag; 868const AnnotationFieldFlag = { 869 READONLY: 0x0000001,
870 REQUIRED: 0x0000002, 871 NOEXPORT: 0x0000004, 872 MULTILINE: 0x0001000, 873 PASSWORD: 0x0002000, 874 NOTOGGLETOOFF: 0x0004000, 875 RADIO: 0x0008000, 876 PUSHBUTTON: 0x0010000, 877 COMBO: 0x0020000, 878 EDIT: 0x0040000, 879 SORT: 0x0080000, 880 FILESELECT: 0x0100000, 881 MULTISELECT: 0x0200000, 882 DONOTSPELLCHECK: 0x0400000, 883 DONOTSCROLL: 0x0800000, 884 COMB: 0x1000000, 885 RICHTEXT: 0x2000000, 886 RADIOSINUNISON: 0x2000000, 887 COMMITONSELCHANGE: 0x4000000 888}; 889exports.AnnotationFieldFlag = AnnotationFieldFlag; 890const AnnotationBorderStyleType = { 891 SOLID: 1, 892 DASHED: 2, 893 BEVELED: 3, 894 INSET: 4, 895 UNDERLINE: 5 896}; 897exports.AnnotationBorderStyleType = AnnotationBorderStyleType; 898const AnnotationActionEventType = { 899 E: "Mouse Enter", 900 X: "Mouse Exit", 901 D: "Mouse Down", 902 U: "Mouse Up", 903 Fo: "Focus", 904 Bl: "Blur", 905 PO: "PageOpen", 906 PC: "PageClose", 907 PV: "PageVisible", 908 PI: "PageInvisible", 909 K: "Keystroke", 910 F: "Format", 911 V: "Validate", 912 C: "Calculate" 913}; 914exports.AnnotationActionEventType = AnnotationActionEventType; 915const DocumentActionEventType = { 916 WC: "WillClose", 917 WS: "WillSave", 918 DS: "DidSave", 919 WP: "WillPrint", 920 DP: "DidPrint" 921}; 922exports.DocumentActionEventType = DocumentActionEventType; 923const PageActionEventType = { 924 O: "PageOpen", 925 C: "PageClose" 926}; 927exports.PageActionEventType = PageActionEventType; 928const StreamType = { 929 UNKNOWN: "UNKNOWN", 930 FLATE: "FLATE", 931 LZW: "LZW", 932 DCT: "DCT", 933 JPX: "JPX", 934 JBIG: "JBIG", 935 A85: "A85", 936 AHX: "AHX", 937 CCF: "CCF", 938 RLX: "RLX" 939}; 940exports.StreamType = StreamType; 941const FontType = { 942 UNKNOWN: "UNKNOWN", 943 TYPE1: "TYPE1", 944 TYPE1STANDARD: "TYPE1STANDARD", 945 TYPE1C: "TYPE1C", 946 CIDFONTTYPE0: "CIDFONTTYPE0", 947 CIDFONTTYPE0C: "CIDFONTTYPE0C", 948 TRUETYPE: "TRUETYPE", 949 CIDFONTTYPE2: "CIDFONTTYPE2", 950 TYPE3: "TYPE3", 951 OPENTYPE: "OPENTYPE", 952 TYPE0: "TYPE0", 953 MMTYPE1: "MMTYPE1" 954}; 955exports.FontType = FontType; 956const VerbosityLevel = { 957 ERRORS: 0, 958 WARNINGS: 1, 959 INFOS: 5 960}; 961exports.VerbosityLevel = VerbosityLevel; 962const CMapCompressionType = { 963 NONE: 0, 964 BINARY: 1, 965 STREAM: 2 966}; 967exports.CMapCompressionType = CMapCompressionType; 968const OPS = { 969 dependency: 1, 970 setLineWidth: 2, 971 setLineCap: 3, 972 setLineJoin: 4, 973 setMiterLimit: 5, 974 setDash: 6, 975 setRenderingIntent: 7, 976 setFlatness: 8, 977 setGState: 9, 978 save: 10, 979 restore: 11, 980 transform: 12, 981 moveTo: 13, 982 lineTo: 14, 983 curveTo: 15, 984 curveTo2: 16,
985 curveTo3: 17, 986 closePath: 18, 987 rectangle: 19, 988 stroke: 20, 989 closeStroke: 21, 990 fill: 22, 991 eoFill: 23, 992 fillStroke: 24, 993 eoFillStroke: 25, 994 closeFillStroke: 26, 995 closeEOFillStroke: 27, 996 endPath: 28, 997 clip: 29, 998 eoClip: 30, 999 beginText: 31, 1000 endText: 32, 1001 setCharSpacing: 33, 1002 setWordSpacing: 34, 1003 setHScale: 35, 1004 setLeading: 36, 1005 setFont: 37, 1006 setTextRenderingMode: 38, 1007 setTextRise: 39, 1008 moveText: 40, 1009 setLeadingMoveText: 41, 1010 setTextMatrix: 42, 1011 nextLine: 43, 1012 showText: 44, 1013 showSpacedText: 45, 1014 nextLineShowText: 46, 1015 nextLineSetSpacingShowText: 47, 1016 setCharWidth: 48, 1017 setCharWidthAndBounds: 49, 1018 setStrokeColorSpace: 50, 1019 setFillColorSpace: 51, 1020 setStrokeColor: 52, 1021 setStrokeColorN: 53, 1022 setFillColor: 54, 1023 setFillColorN: 55, 1024 setStrokeGray: 56, 1025 setFillGray: 57, 1026 setStrokeRGBColor: 58, 1027 setFillRGBColor: 59, 1028 setStrokeCMYKColor: 60, 1029 setFillCMYKColor: 61, 1030 shadingFill: 62, 1031 beginInlineImage: 63, 1032 beginImageData: 64, 1033 endInlineImage: 65, 1034 paintXObject: 66, 1035 markPoint: 67, 1036 markPointProps: 68, 1037 beginMarkedContent: 69, 1038 beginMarkedContentProps: 70, 1039 endMarkedContent: 71, 1040 beginCompat: 72, 1041 endCompat: 73, 1042 paintFormXObjectBegin: 74, 1043 paintFormXObjectEnd: 75, 1044 beginGroup: 76, 1045 endGroup: 77, 1046 beginAnnotations: 78, 1047 endAnnotations: 79, 1048 beginAnnotation: 80, 1049 endAnnotation: 81, 1050 paintJpegXObject: 82, 1051 paintImageMaskXObject: 83, 1052 paintImageMaskXObjectGroup: 84, 1053 paintImageXObject: 85, 1054 paintInlineImageXObject: 86, 1055 paintInlineImageXObjectGroup: 87, 1056 paintImageXObjectRepeat: 88, 1057 paintImageMaskXObjectRepeat: 89, 1058 paintSolidColorImageMask: 90, 1059 constructPath: 91 1060}; 1061exports.OPS = OPS; 1062const UNSUPPORTED_FEATURES = { 1063 unknown: "unknown", 1064 forms: "forms", 1065 javaScript: "javaScript", 1066 signatures: "signatures", 1067 smask: "smask", 1068 shadingPattern: "shadingPattern", 1069 font: "font", 1070 errorTilingPattern: "errorTilingPattern", 1071 errorExtGState: "errorExtGState", 1072 errorXObject: "errorXObject", 1073 errorFontLoadType3: "errorFontLoadType3", 1074 errorFontState: "errorFontState", 1075 errorFontMissing: "errorFontMissing", 1076 errorFontTranslate: "errorFontTranslate", 1077 errorColorSpace: "errorColorSpace", 1078 errorOperatorList: "errorOperatorList", 1079 errorFontToUnicode: "errorFontToUnicode", 1080 errorFontLoadNative: "errorFontLoadNative", 1081 errorFontBuildPath: "errorFontBuildPath", 1082 errorFontGetPath: "errorFontGetPath", 1083 errorMarkedContent: "errorMarkedContent", 1084 errorContentSubStream: "errorContentSubStream" 1085}; 1086exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; 1087const PasswordResponses = { 1088 NEED_PASSWORD: 1, 1089 INCORRECT_PASSWORD: 2 1090}; 1091exports.PasswordResponses = PasswordResponses; 1092let verbosity = VerbosityLevel.WARNINGS; 1093 1094function setVerbosityLevel(level) { 1095 if (Number.isInteger(level)) { 1096 verbosity = level; 1097 } 1098} 1099 1100function getVerbosityLevel() { 1101 return verbosity; 1102} 1103 1104function info(msg) { 1105 if (verbosity >= VerbosityLevel.INFOS) { 1106 console.log(`Info: ${msg}`); 1107 } 1108} 1109 1110function warn(msg) { 1111 if (verbosity >= VerbosityLevel.WARNINGS) { 1112 console.log(`Warning: ${msg}`); 1113 } 1114} 1115 1116function unreachable(msg) { 1117 throw new Error(msg); 1118} 1119 1120function assert(cond, msg) { 1121 if (!cond) { 1122 unreachable(msg); 1123 } 1124} 1125 1126function isSameOrigin(baseUrl, otherUrl) { 1127 let base; 1128 1129 try { 1130 base = new URL(baseUrl); 1131 1132 if (!base.origin || base.origin === "null") { 1133 return false; 1134 } 1135 } catch (e) { 1136 return false; 1137 } 1138 1139 const other = new URL(otherUrl, base); 1140 return base.origin === other.origin; 1141} 1142 1143function _isValidProtocol(url) { 1144 if (!url) { 1145 return false; 1146 } 1147 1148 switch (url.protocol) { 1149 case "http:": 1150 case "https:": 1151 case "ftp:": 1152 case "mailto:": 1153 case "tel:": 1154 return true; 1155 1156 default: 1157 return false; 1158 } 1159} 1160 1161function createValidAbsoluteUrl(url, baseUrl = null, options = null) { 1162 if (!url) { 1163 return null; 1164 } 1165 1166 try { 1167 if (options && typeof url === "string") { 1168 if (options.addDefaultProtocol && url.startsWith("www.")) { 1169 const dots = url.match(/\./g); 1170 1171 if (dots && dots.length >= 2) { 1172 url = `http://${url}`; 1173 } 1174 } 1175 1176 if (options.tryConvertEncoding) { 1177 try { 1178 url = stringToUTF8String(url); 1179 } catch (ex) {} 1180 } 1181 } 1182 1183 const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); 1184 1185 if (_isValidProtocol(absoluteUrl)) { 1186 return absoluteUrl; 1187 } 1188 } catch (ex) {} 1189 1190 return null; 1191} 1192 1193function shadow(obj, prop, value) { 1194 Object.defineProperty(obj, prop, { 1195 value, 1196 enumerable: true, 1197 configurable: true, 1198 writable: false 1199 }); 1200 return value; 1201} 1202 1203const BaseException = function BaseExceptionClosure() { 1204 function BaseException(message, name) { 1205 if (this.constructor === BaseException) { 1206 unreachable("Cannot initialize BaseException."); 1207 } 1208 1209 this.message = message; 1210 this.name = name; 1211 } 1212 1213 BaseException.prototype = new Error(); 1214 BaseException.constructor = BaseException; 1215 return BaseException; 1216}(); 1217 1218exports.BaseException = BaseException; 1219 1220class PasswordException extends BaseException { 1221 constructor(msg, code) { 1222 super(msg, "PasswordException"); 1223 this.code = code; 1224 } 1225 1226} 1227 1228exports.PasswordException = PasswordException; 1229 1230class UnknownErrorException extends BaseException { 1231 constructor(msg, details) { 1232 super(msg, "UnknownErrorException"); 1233 this.details = details; 1234 } 1235 1236} 1237 1238exports.UnknownErrorException = UnknownErrorException; 1239 1240class InvalidPDFException extends BaseException { 1241 constructor(msg) { 1242 super(msg, "InvalidPDFException"); 1243 } 1244 1245} 1246 1247exports.InvalidPDFException = InvalidPDFException; 1248 1249class MissingPDFException extends BaseException { 1250 constructor(msg) { 1251 super(msg, "MissingPDFException"); 1252 } 1253 1254} 1255 1256exports.MissingPDFException = MissingPDFException; 1257 1258class UnexpectedResponseException extends BaseException { 1259 constructor(msg, status) { 1260 super(msg, "UnexpectedResponseException"); 1261 this.status = status; 1262 } 1263 1264} 1265 1266exports.UnexpectedResponseException = UnexpectedResponseException; 1267 1268class FormatError extends BaseException { 1269 constructor(msg) { 1270 super(msg, "FormatError"); 1271 } 1272 1273} 1274 1275exports.FormatError = FormatError; 1276 1277class AbortException extends BaseException { 1278 constructor(msg) { 1279 super(msg, "AbortException"); 1280 } 1281 1282} 1283 1284exports.AbortException = AbortException; 1285const NullCharactersRegExp = /\x00+/g; 1286const InvisibleCharactersRegExp = /[\x01-\x1F]/g; 1287 1288function removeNullCharacters(str, replaceInvisible = false) { 1289 if (typeof str !== "string") { 1290 warn("The argument for removeNullCharacters must be a string."); 1291 return str; 1292 } 1293 1294 if (replaceInvisible) { 1295 str = str.replace(InvisibleCharactersRegExp, " "); 1296 } 1297 1298 return str.replace(NullCharactersRegExp, ""); 1299} 1300 1301function bytesToString(bytes) { 1302 assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString"); 1303 const length = bytes.length; 1304 const MAX_ARGUMENT_COUNT = 8192; 1305 1306 if (length < MAX_ARGUMENT_COUNT) { 1307 return String.fromCharCode.apply(null, bytes); 1308 } 1309 1310 const strBuf = []; 1311 1312 for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) { 1313 const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); 1314 const chunk = bytes.subarray(i, chunkEnd); 1315 strBuf.push(String.fromCharCode.apply(null, chunk)); 1316 } 1317 1318 return strBuf.join(""); 1319} 1320 1321function stringToBytes(str) { 1322 assert(typeof str === "string", "Invalid argument for stringToBytes"); 1323 const length = str.length; 1324 const bytes = new Uint8Array(length); 1325 1326 for (let i = 0; i < length; ++i) { 1327 bytes[i] = str.charCodeAt(i) & 0xff;
1328 } 1329 1330 return bytes; 1331} 1332 1333function arrayByteLength(arr) { 1334 if (arr.length !== undefined) { 1335 return arr.length; 1336 } 1337 1338 assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument."); 1339 return arr.byteLength; 1340} 1341 1342function arraysToBytes(arr) { 1343 const length = arr.length; 1344 1345 if (length === 1 && arr[0] instanceof Uint8Array) { 1346 return arr[0]; 1347 } 1348 1349 let resultLength = 0; 1350 1351 for (let i = 0; i < length; i++) { 1352 resultLength += arrayByteLength(arr[i]); 1353 } 1354 1355 let pos = 0; 1356 const data = new Uint8Array(resultLength); 1357 1358 for (let i = 0; i < length; i++) { 1359 let item = arr[i]; 1360 1361 if (!(item instanceof Uint8Array)) { 1362 if (typeof item === "string") { 1363 item = stringToBytes(item); 1364 } else { 1365 item = new Uint8Array(item); 1366 } 1367 } 1368 1369 const itemLength = item.byteLength; 1370 data.set(item, pos); 1371 pos += itemLength; 1372 } 1373 1374 return data; 1375} 1376 1377function string32(value) { 1378 return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 1379} 1380 1381function objectSize(obj) { 1382 return Object.keys(obj).length; 1383} 1384 1385function objectFromMap(map) { 1386 const obj = Object.create(null); 1387 1388 for (const [key, value] of map) { 1389 obj[key] = value; 1390 } 1391 1392 return obj; 1393} 1394 1395function isLittleEndian() { 1396 const buffer8 = new Uint8Array(4); 1397 buffer8[0] = 1; 1398 const view32 = new Uint32Array(buffer8.buffer, 0, 1); 1399 return view32[0] === 1; 1400} 1401 1402const IsLittleEndianCached = { 1403 get value() { 1404 return shadow(this, "value", isLittleEndian()); 1405 } 1406 1407}; 1408exports.IsLittleEndianCached = IsLittleEndianCached; 1409 1410function isEvalSupported() { 1411 try { 1412 new Function(""); 1413 return true; 1414 } catch (e) { 1415 return false; 1416 } 1417} 1418 1419const IsEvalSupportedCached = { 1420 get value() { 1421 return shadow(this, "value", isEvalSupported()); 1422 } 1423 1424}; 1425exports.IsEvalSupportedCached = IsEvalSupportedCached; 1426const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0")); 1427 1428class Util { 1429 static makeHexColor(r, g, b) { 1430 return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`; 1431 } 1432 1433 static transform(m1, m2) { 1434 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]]; 1435 } 1436 1437 static applyTransform(p, m) { 1438 const xt = p[0] * m[0] + p[1] * m[2] + m[4]; 1439 const yt = p[0] * m[1] + p[1] * m[3] + m[5]; 1440 return [xt, yt]; 1441 } 1442 1443 static applyInverseTransform(p, m) { 1444 const d = m[0] * m[3] - m[1] * m[2]; 1445 const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; 1446 const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; 1447 return [xt, yt]; 1448 } 1449 1450 static getAxialAlignedBoundingBox(r, m) { 1451 const p1 = Util.applyTransform(r, m); 1452 const p2 = Util.applyTransform(r.slice(2, 4), m); 1453 const p3 = Util.applyTransform([r[0], r[3]], m); 1454 const p4 = Util.applyTransform([r[2], r[1]], m); 1455 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])]; 1456 } 1457 1458 static inverseTransform(m) { 1459 const d = m[0] * m[3] - m[1] * m[2]; 1460 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]; 1461 } 1462 1463 static apply3dTransform(m, v) { 1464 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]]; 1465 } 1466 1467 static singularValueDecompose2dScale(m) { 1468 const transpose = [m[0], m[2], m[1], m[3]]; 1469 const a = m[0] * transpose[0] + m[1] * transpose[2]; 1470 const b = m[0] * transpose[1] + m[1] * transpose[3]; 1471 const c = m[2] * transpose[0] + m[3] * transpose[2]; 1472 const d = m[2] * transpose[1] + m[3] * transpose[3]; 1473 const first = (a + d) / 2; 1474 const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2; 1475 const sx = first + second || 1; 1476 const sy = first - second || 1; 1477 return [Math.sqrt(sx), Math.sqrt(sy)]; 1478 } 1479 1480 static normalizeRect(rect) { 1481 const r = rect.slice(0); 1482 1483 if (rect[0] > rect[2]) { 1484 r[0] = rect[2]; 1485 r[2] = rect[0]; 1486 } 1487 1488 if (rect[1] > rect[3]) { 1489 r[1] = rect[3]; 1490 r[3] = rect[1]; 1491 } 1492 1493 return r; 1494 } 1495 1496 static intersect(rect1, rect2) { 1497 function compare(a, b) { 1498 return a - b; 1499 } 1500 1501 const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
1502 const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare); 1503 const result = []; 1504 rect1 = Util.normalizeRect(rect1); 1505 rect2 = Util.normalizeRect(rect2); 1506 1507 if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) { 1508 result[0] = orderedX[1]; 1509 result[2] = orderedX[2]; 1510 } else { 1511 return null; 1512 } 1513 1514 if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) { 1515 result[1] = orderedY[1]; 1516 result[3] = orderedY[2]; 1517 } else { 1518 return null; 1519 } 1520 1521 return result; 1522 } 1523 1524 static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) { 1525 const tvalues = [], 1526 bounds = [[], []]; 1527 let a, b, c, t, t1, t2, b2ac, sqrtb2ac; 1528 1529 for (let i = 0; i < 2; ++i) { 1530 if (i === 0) { 1531 b = 6 * x0 - 12 * x1 + 6 * x2; 1532 a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3; 1533 c = 3 * x1 - 3 * x0; 1534 } else { 1535 b = 6 * y0 - 12 * y1 + 6 * y2; 1536 a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3; 1537 c = 3 * y1 - 3 * y0; 1538 } 1539 1540 if (Math.abs(a) < 1e-12) { 1541 if (Math.abs(b) < 1e-12) { 1542 continue; 1543 } 1544 1545 t = -c / b; 1546 1547 if (0 < t && t < 1) { 1548 tvalues.push(t); 1549 } 1550 1551 continue; 1552 } 1553 1554 b2ac = b * b - 4 * c * a; 1555 sqrtb2ac = Math.sqrt(b2ac); 1556 1557 if (b2ac < 0) { 1558 continue; 1559 } 1560 1561 t1 = (-b + sqrtb2ac) / (2 * a); 1562 1563 if (0 < t1 && t1 < 1) { 1564 tvalues.push(t1); 1565 } 1566 1567 t2 = (-b - sqrtb2ac) / (2 * a); 1568 1569 if (0 < t2 && t2 < 1) { 1570 tvalues.push(t2); 1571 } 1572 } 1573 1574 let j = tvalues.length, 1575 mt; 1576 const jlen = j; 1577 1578 while (j--) { 1579 t = tvalues[j]; 1580 mt = 1 - t; 1581 bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3; 1582 bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3; 1583 } 1584 1585 bounds[0][jlen] = x0; 1586 bounds[1][jlen] = y0; 1587 bounds[0][jlen + 1] = x3; 1588 bounds[1][jlen + 1] = y3; 1589 bounds[0].length = bounds[1].length = jlen + 2; 1590 return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])]; 1591 } 1592 1593} 1594 1595exports.Util = Util; 1596const 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]; 1597 1598function stringToPDFString(str) { 1599 const length = str.length, 1600 strBuf = []; 1601 1602 if (str[0] === "\xFE" && str[1] === "\xFF") { 1603 for (let i = 2; i < length; i += 2) { 1604 strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1))); 1605 } 1606 } else if (str[0] === "\xFF" && str[1] === "\xFE") { 1607 for (let i = 2; i < length; i += 2) { 1608 strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i))); 1609 } 1610 } else { 1611 for (let i = 0; i < length; ++i) { 1612 const code = PDFStringTranslateTable[str.charCodeAt(i)]; 1613 strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); 1614 } 1615 } 1616 1617 return strBuf.join(""); 1618} 1619 1620function escapeString(str) { 1621 return str.replace(/([()\\\n\r])/g, match => { 1622 if (match === "\n") { 1623 return "\\n"; 1624 } else if (match === "\r") { 1625 return "\\r"; 1626 } 1627 1628 return `\\${match}`; 1629 }); 1630} 1631 1632function isAscii(str) { 1633 return /^[\x00-\x7F]*$/.test(str); 1634} 1635 1636function stringToUTF16BEString(str) { 1637 const buf = ["\xFE\xFF"]; 1638 1639 for (let i = 0, ii = str.length; i < ii; i++) { 1640 const char = str.charCodeAt(i); 1641 buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff)); 1642 } 1643 1644 return buf.join(""); 1645} 1646 1647function stringToUTF8String(str) { 1648 return decodeURIComponent(escape(str)); 1649} 1650 1651function utf8StringToString(str) { 1652 return unescape(encodeURIComponent(str)); 1653} 1654 1655function isBool(v) { 1656 return typeof v === "boolean"; 1657} 1658 1659function isNum(v) { 1660 return typeof v === "number"; 1661} 1662 1663function isString(v) { 1664 return typeof v === "string"; 1665} 1666 1667function isArrayBuffer(v) { 1668 return typeof v === "object" && v !== null && v.byteLength !== undefined; 1669} 1670 1671function isArrayEqual(arr1, arr2) { 1672 if (arr1.length !== arr2.length) { 1673 return false;
1674 } 1675 1676 for (let i = 0, ii = arr1.length; i < ii; i++) { 1677 if (arr1[i] !== arr2[i]) { 1678 return false; 1679 } 1680 } 1681 1682 return true; 1683} 1684 1685function getModificationDate(date = new Date()) { 1686 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")]; 1687 return buffer.join(""); 1688} 1689 1690function createPromiseCapability() { 1691 const capability = Object.create(null); 1692 let isSettled = false; 1693 Object.defineProperty(capability, "settled", { 1694 get() { 1695 return isSettled; 1696 } 1697 1698 }); 1699 capability.promise = new Promise(function (resolve, reject) { 1700 capability.resolve = function (data) { 1701 isSettled = true; 1702 resolve(data); 1703 }; 1704 1705 capability.reject = function (reason) { 1706 isSettled = true; 1707 reject(reason); 1708 }; 1709 }); 1710 return capability; 1711} 1712 1713function createObjectURL(data, contentType = "", forceDataSchema = false) { 1714 if (URL.createObjectURL && typeof Blob !== "undefined" && !forceDataSchema) { 1715 return URL.createObjectURL(new Blob([data], { 1716 type: contentType 1717 })); 1718 } 1719 1720 const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; 1721 let buffer = `data:${contentType};base64,`; 1722 1723 for (let i = 0, ii = data.length; i < ii; i += 3) { 1724 const b1 = data[i] & 0xff; 1725 const b2 = data[i + 1] & 0xff; 1726 const b3 = data[i + 2] & 0xff;
1727 const d1 = b1 >> 2, 1728 d2 = (b1 & 3) << 4 | b2 >> 4; 1729 const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64; 1730 const d4 = i + 2 < ii ? b3 & 0x3f : 64; 1731 buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; 1732 } 1733 1734 return buffer; 1735} 1736 1737/***/ }), 1738/* 3 */ 1739/***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => { 1740 1741 1742 1743var _is_node = __w_pdfjs_require__(4); 1744 1745; 1746 1747/***/ }), 1748/* 4 */ 1749/***/ ((__unused_webpack_module, exports) => { 1750 1751 1752 1753Object.defineProperty(exports, "__esModule", ({ 1754 value: true 1755})); 1756exports.isNodeJS = void 0; 1757const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser"); 1758exports.isNodeJS = isNodeJS; 1759 1760/***/ }), 1761/* 5 */ 1762/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 1763 1764 1765 1766Object.defineProperty(exports, "__esModule", ({ 1767 value: true 1768})); 1769exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0; 1770exports.clearPrimitiveCaches = clearPrimitiveCaches; 1771exports.isCmd = isCmd; 1772exports.isDict = isDict; 1773exports.isName = isName; 1774exports.isRef = isRef; 1775exports.isRefsEqual = isRefsEqual; 1776exports.isStream = isStream; 1777 1778var _util = __w_pdfjs_require__(2); 1779 1780var _base_stream = __w_pdfjs_require__(6); 1781 1782const CIRCULAR_REF = Symbol("CIRCULAR_REF"); 1783exports.CIRCULAR_REF = CIRCULAR_REF; 1784const EOF = Symbol("EOF"); 1785exports.EOF = EOF; 1786 1787const Name = function NameClosure() { 1788 let nameCache = Object.create(null); 1789 1790 class Name { 1791 constructor(name) { 1792 this.name = name; 1793 } 1794 1795 static get(name) { 1796 const nameValue = nameCache[name]; 1797 return nameValue ? nameValue : nameCache[name] = new Name(name); 1798 } 1799 1800 static _clearCache() { 1801 nameCache = Object.create(null); 1802 } 1803 1804 } 1805 1806 return Name; 1807}(); 1808 1809exports.Name = Name; 1810 1811const Cmd = function CmdClosure() { 1812 let cmdCache = Object.create(null); 1813 1814 class Cmd { 1815 constructor(cmd) { 1816 this.cmd = cmd; 1817 } 1818 1819 static get(cmd) { 1820 const cmdValue = cmdCache[cmd]; 1821 return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd); 1822 } 1823 1824 static _clearCache() { 1825 cmdCache = Object.create(null); 1826 } 1827 1828 } 1829 1830 return Cmd; 1831}(); 1832 1833exports.Cmd = Cmd; 1834 1835const nonSerializable = function nonSerializableClosure() { 1836 return nonSerializable; 1837}; 1838 1839class Dict { 1840 constructor(xref = null) { 1841 this._map = Object.create(null); 1842 this.xref = xref; 1843 this.objId = null; 1844 this.suppressEncryption = false; 1845 this.__nonSerializable__ = nonSerializable; 1846 } 1847 1848 assignXref(newXref) { 1849 this.xref = newXref; 1850 } 1851 1852 get size() { 1853 return Object.keys(this._map).length; 1854 } 1855 1856 get(key1, key2, key3) { 1857 let value = this._map[key1]; 1858 1859 if (value === undefined && key2 !== undefined) { 1860 value = this._map[key2]; 1861 1862 if (value === undefined && key3 !== undefined) { 1863 value = this._map[key3]; 1864 } 1865 } 1866 1867 if (value instanceof Ref && this.xref) { 1868 return this.xref.fetch(value, this.suppressEncryption); 1869 } 1870 1871 return value; 1872 } 1873 1874 async getAsync(key1, key2, key3) { 1875 let value = this._map[key1]; 1876 1877 if (value === undefined && key2 !== undefined) { 1878 value = this._map[key2]; 1879 1880 if (value === undefined && key3 !== undefined) { 1881 value = this._map[key3]; 1882 } 1883 } 1884 1885 if (value instanceof Ref && this.xref) { 1886 return this.xref.fetchAsync(value, this.suppressEncryption); 1887 } 1888 1889 return value; 1890 } 1891 1892 getArray(key1, key2, key3) { 1893 let value = this._map[key1]; 1894 1895 if (value === undefined && key2 !== undefined) { 1896 value = this._map[key2]; 1897 1898 if (value === undefined && key3 !== undefined) { 1899 value = this._map[key3]; 1900 } 1901 } 1902 1903 if (value instanceof Ref && this.xref) { 1904 value = this.xref.fetch(value, this.suppressEncryption); 1905 } 1906 1907 if (Array.isArray(value)) { 1908 value = value.slice(); 1909 1910 for (let i = 0, ii = value.length; i < ii; i++) { 1911 if (value[i] instanceof Ref && this.xref) { 1912 value[i] = this.xref.fetch(value[i], this.suppressEncryption); 1913 } 1914 } 1915 } 1916 1917 return value; 1918 } 1919 1920 getRaw(key) { 1921 return this._map[key]; 1922 } 1923 1924 getKeys() { 1925 return Object.keys(this._map); 1926 } 1927 1928 getRawValues() { 1929 return Object.values(this._map); 1930 } 1931 1932 set(key, value) { 1933 this._map[key] = value; 1934 } 1935 1936 has(key) { 1937 return this._map[key] !== undefined; 1938 } 1939 1940 forEach(callback) { 1941 for (const key in this._map) { 1942 callback(key, this.get(key)); 1943 } 1944 } 1945 1946 static get empty() { 1947 const emptyDict = new Dict(null); 1948 1949 emptyDict.set = (key, value) => { 1950 (0, _util.unreachable)("Should not call `set` on the empty dictionary."); 1951 }; 1952 1953 return (0, _util.shadow)(this, "empty", emptyDict); 1954 } 1955 1956 static merge({ 1957 xref, 1958 dictArray, 1959 mergeSubDicts = false 1960 }) { 1961 const mergedDict = new Dict(xref), 1962 properties = new Map(); 1963 1964 for (const dict of dictArray) { 1965 if (!(dict instanceof Dict)) { 1966 continue; 1967 } 1968 1969 for (const [key, value] of Object.entries(dict._map)) { 1970 let property = properties.get(key); 1971 1972 if (property === undefined) { 1973 property = []; 1974 properties.set(key, property); 1975 } else if (!mergeSubDicts || !(value instanceof Dict)) { 1976 continue; 1977 } 1978 1979 property.push(value); 1980 } 1981 } 1982 1983 for (const [name, values] of properties) { 1984 if (values.length === 1 || !(values[0] instanceof Dict)) { 1985 mergedDict._map[name] = values[0]; 1986 continue; 1987 } 1988 1989 const subDict = new Dict(xref); 1990 1991 for (const dict of values) { 1992 for (const [key, value] of Object.entries(dict._map)) { 1993 if (subDict._map[key] === undefined) { 1994 subDict._map[key] = value; 1995 } 1996 } 1997 } 1998 1999 if (subDict.size > 0) { 2000 mergedDict._map[name] = subDict; 2001 } 2002 } 2003 2004 properties.clear(); 2005 return mergedDict.size > 0 ? mergedDict : Dict.empty; 2006 } 2007 2008} 2009 2010exports.Dict = Dict; 2011 2012const Ref = function RefClosure() { 2013 let refCache = Object.create(null); 2014 2015 class Ref { 2016 constructor(num, gen) { 2017 this.num = num; 2018 this.gen = gen; 2019 } 2020 2021 toString() { 2022 if (this.gen === 0) { 2023 return `${this.num}R`; 2024 } 2025 2026 return `${this.num}R${this.gen}`; 2027 } 2028 2029 static get(num, gen) {
2030 const key = gen === 0 ? `${num}R` : `${num}R${gen}`; 2031 const refValue = refCache[key]; 2032 return refValue ? refValue : refCache[key] = new Ref(num, gen); 2033 } 2034 2035 static _clearCache() { 2036 refCache = Object.create(null); 2037 } 2038 2039 } 2040 2041 return Ref; 2042}(); 2043 2044exports.Ref = Ref; 2045 2046class RefSet { 2047 constructor(parent = null) { 2048 this._set = new Set(parent && parent._set); 2049 } 2050 2051 has(ref) { 2052 return this._set.has(ref.toString()); 2053 } 2054 2055 put(ref) { 2056 this._set.add(ref.toString()); 2057 } 2058 2059 remove(ref) { 2060 this._set.delete(ref.toString()); 2061 } 2062 2063 forEach(callback) { 2064 for (const ref of this._set.values()) { 2065 callback(ref); 2066 } 2067 } 2068 2069 clear() { 2070 this._set.clear(); 2071 } 2072 2073} 2074 2075exports.RefSet = RefSet; 2076 2077class RefSetCache { 2078 constructor() { 2079 this._map = new Map(); 2080 } 2081 2082 get size() { 2083 return this._map.size; 2084 } 2085 2086 get(ref) { 2087 return this._map.get(ref.toString()); 2088 } 2089 2090 has(ref) { 2091 return this._map.has(ref.toString()); 2092 } 2093 2094 put(ref, obj) { 2095 this._map.set(ref.toString(), obj); 2096 } 2097 2098 putAlias(ref, aliasRef) { 2099 this._map.set(ref.toString(), this.get(aliasRef)); 2100 } 2101 2102 forEach(callback) { 2103 for (const value of this._map.values()) { 2104 callback(value); 2105 } 2106 } 2107 2108 clear() { 2109 this._map.clear(); 2110 } 2111 2112} 2113 2114exports.RefSetCache = RefSetCache; 2115 2116function isName(v, name) { 2117 return v instanceof Name && (name === undefined || v.name === name); 2118} 2119 2120function isCmd(v, cmd) { 2121 return v instanceof Cmd && (cmd === undefined || v.cmd === cmd); 2122} 2123 2124function isDict(v, type) { 2125 return v instanceof Dict && (type === undefined || isName(v.get("Type"), type)); 2126} 2127 2128function isRef(v) { 2129 return v instanceof Ref; 2130} 2131 2132function isRefsEqual(v1, v2) { 2133 return v1.num === v2.num && v1.gen === v2.gen; 2134} 2135 2136function isStream(v) { 2137 return v instanceof _base_stream.BaseStream; 2138} 2139 2140function clearPrimitiveCaches() { 2141 Cmd._clearCache(); 2142 2143 Name._clearCache(); 2144 2145 Ref._clearCache(); 2146} 2147 2148/***/ }), 2149/* 6 */ 2150/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 2151 2152 2153 2154Object.defineProperty(exports, "__esModule", ({ 2155 value: true 2156})); 2157exports.BaseStream = void 0; 2158 2159var _util = __w_pdfjs_require__(2); 2160 2161class BaseStream { 2162 constructor() { 2163 if (this.constructor === BaseStream) { 2164 (0, _util.unreachable)("Cannot initialize BaseStream."); 2165 } 2166 } 2167 2168 get length() { 2169 (0, _util.unreachable)("Abstract getter `length` accessed"); 2170 } 2171 2172 get isEmpty() { 2173 (0, _util.unreachable)("Abstract getter `isEmpty` accessed"); 2174 } 2175 2176 get isDataLoaded() { 2177 return (0, _util.shadow)(this, "isDataLoaded", true); 2178 } 2179 2180 getByte() { 2181 (0, _util.unreachable)("Abstract method `getByte` called"); 2182 } 2183 2184 getBytes(length, forceClamped = false) { 2185 (0, _util.unreachable)("Abstract method `getBytes` called"); 2186 } 2187 2188 peekByte() { 2189 const peekedByte = this.getByte(); 2190 2191 if (peekedByte !== -1) { 2192 this.pos--; 2193 } 2194 2195 return peekedByte; 2196 } 2197 2198 peekBytes(length, forceClamped = false) { 2199 const bytes = this.getBytes(length, forceClamped); 2200 this.pos -= bytes.length; 2201 return bytes; 2202 } 2203 2204 getUint16() { 2205 const b0 = this.getByte(); 2206 const b1 = this.getByte(); 2207 2208 if (b0 === -1 || b1 === -1) { 2209 return -1; 2210 } 2211 2212 return (b0 << 8) + b1; 2213 } 2214 2215 getInt32() { 2216 const b0 = this.getByte(); 2217 const b1 = this.getByte(); 2218 const b2 = this.getByte(); 2219 const b3 = this.getByte(); 2220 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 2221 } 2222 2223 getByteRange(begin, end) { 2224 (0, _util.unreachable)("Abstract method `getByteRange` called"); 2225 } 2226 2227 getString(length) { 2228 return (0, _util.bytesToString)(this.getBytes(length, false)); 2229 } 2230 2231 skip(n) { 2232 this.pos += n || 1; 2233 } 2234 2235 reset() { 2236 (0, _util.unreachable)("Abstract method `reset` called"); 2237 } 2238 2239 moveStart() { 2240 (0, _util.unreachable)("Abstract method `moveStart` called"); 2241 } 2242 2243 makeSubStream(start, length, dict = null) { 2244 (0, _util.unreachable)("Abstract method `makeSubStream` called"); 2245 } 2246 2247 getBaseStreams() { 2248 return null; 2249 } 2250 2251} 2252 2253exports.BaseStream = BaseStream; 2254 2255/***/ }), 2256/* 7 */ 2257/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 2258 2259 2260 2261Object.defineProperty(exports, "__esModule", ({ 2262 value: true 2263})); 2264exports.NetworkPdfManager = exports.LocalPdfManager = void 0; 2265 2266var _util = __w_pdfjs_require__(2); 2267 2268var _chunked_stream = __w_pdfjs_require__(8); 2269 2270var _core_utils = __w_pdfjs_require__(9); 2271 2272var _document = __w_pdfjs_require__(11); 2273 2274var _stream = __w_pdfjs_require__(10); 2275 2276function parseDocBaseUrl(url) { 2277 if (url) { 2278 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url); 2279 2280 if (absoluteUrl) { 2281 return absoluteUrl.href; 2282 } 2283 2284 (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`); 2285 } 2286 2287 return null; 2288} 2289 2290class BasePdfManager { 2291 constructor() { 2292 if (this.constructor === BasePdfManager) { 2293 (0, _util.unreachable)("Cannot initialize BasePdfManager."); 2294 } 2295 } 2296 2297 get docId() { 2298 return this._docId; 2299 } 2300 2301 get password() { 2302 return this._password; 2303 } 2304 2305 get docBaseUrl() { 2306 return this._docBaseUrl; 2307 } 2308 2309 onLoadedStream() { 2310 (0, _util.unreachable)("Abstract method `onLoadedStream` called"); 2311 } 2312 2313 ensureDoc(prop, args) { 2314 return this.ensure(this.pdfDocument, prop, args); 2315 } 2316 2317 ensureXRef(prop, args) { 2318 return this.ensure(this.pdfDocument.xref, prop, args); 2319 } 2320 2321 ensureCatalog(prop, args) { 2322 return this.ensure(this.pdfDocument.catalog, prop, args); 2323 } 2324 2325 getPage(pageIndex) { 2326 return this.pdfDocument.getPage(pageIndex); 2327 } 2328 2329 fontFallback(id, handler) { 2330 return this.pdfDocument.fontFallback(id, handler); 2331 } 2332 2333 loadXfaFonts(handler, task) { 2334 return this.pdfDocument.loadXfaFonts(handler, task); 2335 } 2336 2337 loadXfaImages() { 2338 return this.pdfDocument.loadXfaImages(); 2339 } 2340 2341 serializeXfaData(annotationStorage) { 2342 return this.pdfDocument.serializeXfaData(annotationStorage); 2343 } 2344 2345 cleanup(manuallyTriggered = false) { 2346 return this.pdfDocument.cleanup(manuallyTriggered); 2347 } 2348 2349 async ensure(obj, prop, args) { 2350 (0, _util.unreachable)("Abstract method `ensure` called"); 2351 } 2352 2353 requestRange(begin, end) { 2354 (0, _util.unreachable)("Abstract method `requestRange` called"); 2355 } 2356 2357 requestLoadedStream() { 2358 (0, _util.unreachable)("Abstract method `requestLoadedStream` called"); 2359 } 2360 2361 sendProgressiveData(chunk) { 2362 (0, _util.unreachable)("Abstract method `sendProgressiveData` called"); 2363 } 2364 2365 updatePassword(password) { 2366 this._password = password; 2367 } 2368 2369 terminate(reason) { 2370 (0, _util.unreachable)("Abstract method `terminate` called"); 2371 } 2372 2373} 2374 2375class LocalPdfManager extends BasePdfManager { 2376 constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) { 2377 super(); 2378 this._docId = docId; 2379 this._password = password; 2380 this._docBaseUrl = parseDocBaseUrl(docBaseUrl); 2381 this.msgHandler = msgHandler; 2382 this.evaluatorOptions = evaluatorOptions; 2383 this.enableXfa = enableXfa; 2384 const stream = new _stream.Stream(data); 2385 this.pdfDocument = new _document.PDFDocument(this, stream); 2386 this._loadedStreamPromise = Promise.resolve(stream); 2387 } 2388 2389 async ensure(obj, prop, args) { 2390 const value = obj[prop]; 2391 2392 if (typeof value === "function") {
vendor: 7,083 bytes, lines 2393-2701
2393 return value.apply(obj, args); 2394 } 2395 2396 return value; 2397 } 2398 2399 requestRange(begin, end) { 2400 return Promise.resolve(); 2401 } 2402 2403 requestLoadedStream() {} 2404 2405 onLoadedStream() { 2406 return this._loadedStreamPromise; 2407 } 2408 2409 terminate(reason) {} 2410 2411} 2412 2413exports.LocalPdfManager = LocalPdfManager; 2414 2415class NetworkPdfManager extends BasePdfManager { 2416 constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) { 2417 super(); 2418 this._docId = docId; 2419 this._password = args.password; 2420 this._docBaseUrl = parseDocBaseUrl(docBaseUrl); 2421 this.msgHandler = args.msgHandler; 2422 this.evaluatorOptions = evaluatorOptions; 2423 this.enableXfa = enableXfa; 2424 this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, { 2425 msgHandler: args.msgHandler, 2426 length: args.length, 2427 disableAutoFetch: args.disableAutoFetch, 2428 rangeChunkSize: args.rangeChunkSize 2429 }); 2430 this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream()); 2431 } 2432 2433 async ensure(obj, prop, args) { 2434 try { 2435 const value = obj[prop]; 2436 2437 if (typeof value === "function") { 2438 return value.apply(obj, args); 2439 } 2440 2441 return value; 2442 } catch (ex) { 2443 if (!(ex instanceof _core_utils.MissingDataException)) { 2444 throw ex; 2445 } 2446 2447 await this.requestRange(ex.begin, ex.end); 2448 return this.ensure(obj, prop, args); 2449 } 2450 } 2451 2452 requestRange(begin, end) { 2453 return this.streamManager.requestRange(begin, end); 2454 } 2455 2456 requestLoadedStream() { 2457 this.streamManager.requestAllChunks(); 2458 } 2459 2460 sendProgressiveData(chunk) { 2461 this.streamManager.onReceiveData({ 2462 chunk 2463 }); 2464 } 2465 2466 onLoadedStream() { 2467 return this.streamManager.onLoadedStream(); 2468 } 2469 2470 terminate(reason) { 2471 this.streamManager.abort(reason); 2472 } 2473 2474} 2475 2476exports.NetworkPdfManager = NetworkPdfManager; 2477 2478/***/ }), 2479/* 8 */ 2480/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 2481 2482 2483 2484Object.defineProperty(exports, "__esModule", ({ 2485 value: true 2486})); 2487exports.ChunkedStreamManager = exports.ChunkedStream = void 0; 2488 2489var _util = __w_pdfjs_require__(2); 2490 2491var _core_utils = __w_pdfjs_require__(9); 2492 2493var _stream = __w_pdfjs_require__(10); 2494 2495class ChunkedStream extends _stream.Stream { 2496 constructor(length, chunkSize, manager) { 2497 super(new Uint8Array(length), 0, length, null); 2498 this.chunkSize = chunkSize; 2499 this._loadedChunks = new Set(); 2500 this.numChunks = Math.ceil(length / chunkSize); 2501 this.manager = manager; 2502 this.progressiveDataLength = 0; 2503 this.lastSuccessfulEnsureByteChunk = -1; 2504 } 2505 2506 getMissingChunks() { 2507 const chunks = []; 2508 2509 for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) { 2510 if (!this._loadedChunks.has(chunk)) { 2511 chunks.push(chunk); 2512 } 2513 } 2514 2515 return chunks; 2516 } 2517 2518 get numChunksLoaded() { 2519 return this._loadedChunks.size; 2520 } 2521 2522 get isDataLoaded() { 2523 return this.numChunksLoaded === this.numChunks; 2524 } 2525 2526 onReceiveData(begin, chunk) { 2527 const chunkSize = this.chunkSize; 2528 2529 if (begin % chunkSize !== 0) { 2530 throw new Error(`Bad begin offset: ${begin}`); 2531 } 2532 2533 const end = begin + chunk.byteLength; 2534 2535 if (end % chunkSize !== 0 && end !== this.bytes.length) { 2536 throw new Error(`Bad end offset: ${end}`); 2537 } 2538 2539 this.bytes.set(new Uint8Array(chunk), begin); 2540 const beginChunk = Math.floor(begin / chunkSize); 2541 const endChunk = Math.floor((end - 1) / chunkSize) + 1; 2542 2543 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 2544 this._loadedChunks.add(curChunk); 2545 } 2546 } 2547 2548 onReceiveProgressiveData(data) { 2549 let position = this.progressiveDataLength; 2550 const beginChunk = Math.floor(position / this.chunkSize); 2551 this.bytes.set(new Uint8Array(data), position); 2552 position += data.byteLength; 2553 this.progressiveDataLength = position; 2554 const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize); 2555 2556 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 2557 this._loadedChunks.add(curChunk); 2558 } 2559 } 2560 2561 ensureByte(pos) { 2562 if (pos < this.progressiveDataLength) { 2563 return; 2564 } 2565 2566 const chunk = Math.floor(pos / this.chunkSize); 2567 2568 if (chunk > this.numChunks) { 2569 return; 2570 } 2571 2572 if (chunk === this.lastSuccessfulEnsureByteChunk) { 2573 return; 2574 } 2575 2576 if (!this._loadedChunks.has(chunk)) { 2577 throw new _core_utils.MissingDataException(pos, pos + 1); 2578 } 2579 2580 this.lastSuccessfulEnsureByteChunk = chunk; 2581 } 2582 2583 ensureRange(begin, end) { 2584 if (begin >= end) { 2585 return; 2586 } 2587 2588 if (end <= this.progressiveDataLength) { 2589 return; 2590 } 2591 2592 const beginChunk = Math.floor(begin / this.chunkSize); 2593 2594 if (beginChunk > this.numChunks) { 2595 return; 2596 } 2597 2598 const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks); 2599 2600 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 2601 if (!this._loadedChunks.has(chunk)) { 2602 throw new _core_utils.MissingDataException(begin, end); 2603 } 2604 } 2605 } 2606 2607 nextEmptyChunk(beginChunk) { 2608 const numChunks = this.numChunks; 2609 2610 for (let i = 0; i < numChunks; ++i) { 2611 const chunk = (beginChunk + i) % numChunks; 2612 2613 if (!this._loadedChunks.has(chunk)) { 2614 return chunk; 2615 } 2616 } 2617 2618 return null; 2619 } 2620 2621 hasChunk(chunk) { 2622 return this._loadedChunks.has(chunk); 2623 } 2624 2625 getByte() { 2626 const pos = this.pos; 2627 2628 if (pos >= this.end) { 2629 return -1; 2630 } 2631 2632 if (pos >= this.progressiveDataLength) { 2633 this.ensureByte(pos); 2634 } 2635 2636 return this.bytes[this.pos++]; 2637 } 2638 2639 getBytes(length, forceClamped = false) { 2640 const bytes = this.bytes; 2641 const pos = this.pos; 2642 const strEnd = this.end; 2643 2644 if (!length) { 2645 if (strEnd > this.progressiveDataLength) { 2646 this.ensureRange(pos, strEnd); 2647 } 2648 2649 const subarray = bytes.subarray(pos, strEnd); 2650 return forceClamped ? new Uint8ClampedArray(subarray) : subarray; 2651 } 2652 2653 let end = pos + length; 2654 2655 if (end > strEnd) { 2656 end = strEnd; 2657 } 2658 2659 if (end > this.progressiveDataLength) { 2660 this.ensureRange(pos, end); 2661 } 2662 2663 this.pos = end; 2664 const subarray = bytes.subarray(pos, end); 2665 return forceClamped ? new Uint8ClampedArray(subarray) : subarray; 2666 } 2667 2668 getByteRange(begin, end) { 2669 if (begin < 0) { 2670 begin = 0; 2671 } 2672 2673 if (end > this.end) { 2674 end = this.end; 2675 } 2676 2677 if (end > this.progressiveDataLength) { 2678 this.ensureRange(begin, end); 2679 } 2680 2681 return this.bytes.subarray(begin, end); 2682 } 2683 2684 makeSubStream(start, length, dict = null) { 2685 if (length) { 2686 if (start + length > this.progressiveDataLength) { 2687 this.ensureRange(start, start + length); 2688 } 2689 } else { 2690 if (start >= this.progressiveDataLength) { 2691 this.ensureByte(start); 2692 } 2693 } 2694 2695 function ChunkedStreamSubstream() {} 2696 2697 ChunkedStreamSubstream.prototype = Object.create(this); 2698 2699 ChunkedStreamSubstream.prototype.getMissingChunks = function () { 2700 const chunkSize = this.chunkSize; 2701 const beginChunk = Math.floor(this.start / chunkSize);
2702 const endChunk = Math.floor((this.end - 1) / chunkSize) + 1; 2703 const missingChunks = []; 2704 2705 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 2706 if (!this._loadedChunks.has(chunk)) { 2707 missingChunks.push(chunk); 2708 } 2709 } 2710 2711 return missingChunks; 2712 }; 2713 2714 Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", { 2715 get() { 2716 if (this.numChunksLoaded === this.numChunks) { 2717 return true; 2718 } 2719 2720 return this.getMissingChunks().length === 0; 2721 }, 2722 2723 configurable: true 2724 }); 2725 const subStream = new ChunkedStreamSubstream(); 2726 subStream.pos = subStream.start = start; 2727 subStream.end = start + length || this.end; 2728 subStream.dict = dict; 2729 return subStream; 2730 } 2731 2732 getBaseStreams() { 2733 return [this]; 2734 } 2735 2736} 2737 2738exports.ChunkedStream = ChunkedStream; 2739 2740class ChunkedStreamManager { 2741 constructor(pdfNetworkStream, args) { 2742 this.length = args.length; 2743 this.chunkSize = args.rangeChunkSize; 2744 this.stream = new ChunkedStream(this.length, this.chunkSize, this); 2745 this.pdfNetworkStream = pdfNetworkStream; 2746 this.disableAutoFetch = args.disableAutoFetch; 2747 this.msgHandler = args.msgHandler; 2748 this.currRequestId = 0; 2749 this._chunksNeededByRequest = new Map(); 2750 this._requestsByChunk = new Map(); 2751 this._promisesByRequest = new Map(); 2752 this.progressiveDataLength = 0; 2753 this.aborted = false; 2754 this._loadedStreamCapability = (0, _util.createPromiseCapability)(); 2755 } 2756 2757 onLoadedStream() { 2758 return this._loadedStreamCapability.promise; 2759 } 2760 2761 sendRequest(begin, end) { 2762 const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end); 2763 2764 if (!rangeReader.isStreamingSupported) { 2765 rangeReader.onProgress = this.onProgress.bind(this); 2766 } 2767 2768 let chunks = [], 2769 loaded = 0; 2770 return new Promise((resolve, reject) => { 2771 const readChunk = chunk => { 2772 try { 2773 if (!chunk.done) { 2774 const data = chunk.value; 2775 chunks.push(data); 2776 loaded += (0, _util.arrayByteLength)(data); 2777 2778 if (rangeReader.isStreamingSupported) { 2779 this.onProgress({ 2780 loaded 2781 }); 2782 } 2783 2784 rangeReader.read().then(readChunk, reject); 2785 return; 2786 } 2787 2788 const chunkData = (0, _util.arraysToBytes)(chunks); 2789 chunks = null; 2790 resolve(chunkData); 2791 } catch (e) { 2792 reject(e); 2793 } 2794 }; 2795 2796 rangeReader.read().then(readChunk, reject); 2797 }).then(data => { 2798 if (this.aborted) { 2799 return; 2800 } 2801 2802 this.onReceiveData({ 2803 chunk: data, 2804 begin 2805 }); 2806 }); 2807 } 2808 2809 requestAllChunks() { 2810 const missingChunks = this.stream.getMissingChunks(); 2811 2812 this._requestChunks(missingChunks); 2813 2814 return this._loadedStreamCapability.promise; 2815 } 2816 2817 _requestChunks(chunks) { 2818 const requestId = this.currRequestId++; 2819 const chunksNeeded = new Set(); 2820 2821 this._chunksNeededByRequest.set(requestId, chunksNeeded); 2822 2823 for (const chunk of chunks) { 2824 if (!this.stream.hasChunk(chunk)) { 2825 chunksNeeded.add(chunk); 2826 } 2827 } 2828 2829 if (chunksNeeded.size === 0) { 2830 return Promise.resolve(); 2831 } 2832 2833 const capability = (0, _util.createPromiseCapability)(); 2834 2835 this._promisesByRequest.set(requestId, capability); 2836 2837 const chunksToRequest = []; 2838 2839 for (const chunk of chunksNeeded) { 2840 let requestIds = this._requestsByChunk.get(chunk); 2841 2842 if (!requestIds) { 2843 requestIds = []; 2844 2845 this._requestsByChunk.set(chunk, requestIds); 2846 2847 chunksToRequest.push(chunk); 2848 } 2849 2850 requestIds.push(requestId); 2851 } 2852 2853 if (chunksToRequest.length > 0) { 2854 const groupedChunksToRequest = this.groupChunks(chunksToRequest); 2855 2856 for (const groupedChunk of groupedChunksToRequest) { 2857 const begin = groupedChunk.beginChunk * this.chunkSize; 2858 const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length); 2859 this.sendRequest(begin, end).catch(capability.reject); 2860 } 2861 } 2862 2863 return capability.promise.catch(reason => { 2864 if (this.aborted) { 2865 return; 2866 } 2867 2868 throw reason; 2869 }); 2870 } 2871 2872 getStream() { 2873 return this.stream; 2874 } 2875 2876 requestRange(begin, end) { 2877 end = Math.min(end, this.length); 2878 const beginChunk = this.getBeginChunk(begin);
2879 const endChunk = this.getEndChunk(end); 2880 const chunks = []; 2881 2882 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 2883 chunks.push(chunk); 2884 } 2885 2886 return this._requestChunks(chunks); 2887 } 2888 2889 requestRanges(ranges = []) { 2890 const chunksToRequest = []; 2891 2892 for (const range of ranges) { 2893 const beginChunk = this.getBeginChunk(range.begin); 2894 const endChunk = this.getEndChunk(range.end); 2895 2896 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 2897 if (!chunksToRequest.includes(chunk)) { 2898 chunksToRequest.push(chunk); 2899 } 2900 } 2901 } 2902 2903 chunksToRequest.sort(function (a, b) { 2904 return a - b; 2905 }); 2906 return this._requestChunks(chunksToRequest); 2907 } 2908 2909 groupChunks(chunks) { 2910 const groupedChunks = []; 2911 let beginChunk = -1; 2912 let prevChunk = -1; 2913 2914 for (let i = 0, ii = chunks.length; i < ii; ++i) { 2915 const chunk = chunks[i]; 2916 2917 if (beginChunk < 0) { 2918 beginChunk = chunk; 2919 } 2920 2921 if (prevChunk >= 0 && prevChunk + 1 !== chunk) { 2922 groupedChunks.push({ 2923 beginChunk, 2924 endChunk: prevChunk + 1 2925 }); 2926 beginChunk = chunk; 2927 } 2928 2929 if (i + 1 === chunks.length) { 2930 groupedChunks.push({ 2931 beginChunk, 2932 endChunk: chunk + 1 2933 }); 2934 } 2935 2936 prevChunk = chunk; 2937 } 2938 2939 return groupedChunks; 2940 } 2941 2942 onProgress(args) { 2943 this.msgHandler.send("DocProgress", { 2944 loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded, 2945 total: this.length 2946 }); 2947 } 2948 2949 onReceiveData(args) { 2950 const chunk = args.chunk; 2951 const isProgressive = args.begin === undefined; 2952 const begin = isProgressive ? this.progressiveDataLength : args.begin; 2953 const end = begin + chunk.byteLength; 2954 const beginChunk = Math.floor(begin / this.chunkSize); 2955 const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize); 2956 2957 if (isProgressive) { 2958 this.stream.onReceiveProgressiveData(chunk); 2959 this.progressiveDataLength = end; 2960 } else { 2961 this.stream.onReceiveData(begin, chunk); 2962 } 2963 2964 if (this.stream.isDataLoaded) { 2965 this._loadedStreamCapability.resolve(this.stream); 2966 } 2967 2968 const loadedRequests = []; 2969 2970 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 2971 const requestIds = this._requestsByChunk.get(curChunk); 2972 2973 if (!requestIds) { 2974 continue; 2975 } 2976 2977 this._requestsByChunk.delete(curChunk); 2978 2979 for (const requestId of requestIds) { 2980 const chunksNeeded = this._chunksNeededByRequest.get(requestId); 2981 2982 if (chunksNeeded.has(curChunk)) { 2983 chunksNeeded.delete(curChunk); 2984 } 2985 2986 if (chunksNeeded.size > 0) { 2987 continue; 2988 } 2989 2990 loadedRequests.push(requestId); 2991 } 2992 } 2993 2994 if (!this.disableAutoFetch && this._requestsByChunk.size === 0) { 2995 let nextEmptyChunk; 2996 2997 if (this.stream.numChunksLoaded === 1) { 2998 const lastChunk = this.stream.numChunks - 1; 2999 3000 if (!this.stream.hasChunk(lastChunk)) { 3001 nextEmptyChunk = lastChunk; 3002 } 3003 } else { 3004 nextEmptyChunk = this.stream.nextEmptyChunk(endChunk); 3005 } 3006 3007 if (Number.isInteger(nextEmptyChunk)) { 3008 this._requestChunks([nextEmptyChunk]); 3009 } 3010 } 3011 3012 for (const requestId of loadedRequests) { 3013 const capability = this._promisesByRequest.get(requestId); 3014 3015 this._promisesByRequest.delete(requestId); 3016 3017 capability.resolve(); 3018 } 3019 3020 this.msgHandler.send("DocProgress", { 3021 loaded: this.stream.numChunksLoaded * this.chunkSize, 3022 total: this.length 3023 }); 3024 } 3025 3026 onError(err) { 3027 this._loadedStreamCapability.reject(err); 3028 } 3029 3030 getBeginChunk(begin) { 3031 return Math.floor(begin / this.chunkSize); 3032 } 3033 3034 getEndChunk(end) { 3035 return Math.floor((end - 1) / this.chunkSize) + 1; 3036 } 3037 3038 abort(reason) { 3039 this.aborted = true; 3040 3041 if (this.pdfNetworkStream) { 3042 this.pdfNetworkStream.cancelAllRequests(reason); 3043 } 3044 3045 for (const capability of this._promisesByRequest.values()) { 3046 capability.reject(reason); 3047 } 3048 } 3049 3050} 3051 3052exports.ChunkedStreamManager = ChunkedStreamManager; 3053 3054/***/ }), 3055/* 9 */ 3056/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 3057 3058 3059 3060Object.defineProperty(exports, "__esModule", ({ 3061 value: true 3062})); 3063exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.MissingDataException = exports.DocStats = void 0; 3064exports.collectActions = collectActions; 3065exports.encodeToXmlString = encodeToXmlString; 3066exports.escapePDFName = escapePDFName; 3067exports.getArrayLookupTableFactory = getArrayLookupTableFactory; 3068exports.getInheritableProperty = getInheritableProperty; 3069exports.getLookupTableFactory = getLookupTableFactory; 3070exports.isWhiteSpace = isWhiteSpace; 3071exports.log2 = log2; 3072exports.parseXFAPath = parseXFAPath; 3073exports.readInt8 = readInt8; 3074exports.readUint16 = readUint16; 3075exports.readUint32 = readUint32; 3076exports.recoverJsURL = recoverJsURL; 3077exports.toRomanNumerals = toRomanNumerals; 3078exports.validateCSSFont = validateCSSFont; 3079 3080var _util = __w_pdfjs_require__(2); 3081 3082var _primitives = __w_pdfjs_require__(5); 3083 3084function getLookupTableFactory(initializer) { 3085 let lookup; 3086 return function () { 3087 if (initializer) { 3088 lookup = Object.create(null); 3089 initializer(lookup); 3090 initializer = null; 3091 } 3092 3093 return lookup; 3094 }; 3095} 3096 3097function getArrayLookupTableFactory(initializer) { 3098 let lookup; 3099 return function () { 3100 if (initializer) { 3101 let arr = initializer(); 3102 initializer = null; 3103 lookup = Object.create(null); 3104 3105 for (let i = 0, ii = arr.length; i < ii; i += 2) { 3106 lookup[arr[i]] = arr[i + 1]; 3107 } 3108 3109 arr = null; 3110 } 3111 3112 return lookup; 3113 }; 3114} 3115 3116class MissingDataException extends _util.BaseException { 3117 constructor(begin, end) { 3118 super(`Missing data [${begin}, ${end})`, "MissingDataException"); 3119 this.begin = begin; 3120 this.end = end; 3121 } 3122 3123} 3124 3125exports.MissingDataException = MissingDataException; 3126 3127class ParserEOFException extends _util.BaseException { 3128 constructor(msg) { 3129 super(msg, "ParserEOFException"); 3130 } 3131 3132} 3133 3134exports.ParserEOFException = ParserEOFException; 3135 3136class XRefEntryException extends _util.BaseException { 3137 constructor(msg) {
3138 super(msg, "XRefEntryException"); 3139 } 3140 3141} 3142 3143exports.XRefEntryException = XRefEntryException; 3144 3145class XRefParseException extends _util.BaseException { 3146 constructor(msg) { 3147 super(msg, "XRefParseException"); 3148 } 3149 3150} 3151 3152exports.XRefParseException = XRefParseException; 3153 3154class DocStats { 3155 constructor(handler) { 3156 this._handler = handler; 3157 this._streamTypes = new Set(); 3158 this._fontTypes = new Set(); 3159 } 3160 3161 _send() { 3162 const streamTypes = Object.create(null), 3163 fontTypes = Object.create(null); 3164 3165 for (const type of this._streamTypes) { 3166 streamTypes[type] = true; 3167 } 3168 3169 for (const type of this._fontTypes) { 3170 fontTypes[type] = true; 3171 } 3172 3173 this._handler.send("DocStats", { 3174 streamTypes, 3175 fontTypes 3176 }); 3177 } 3178 3179 addStreamType(type) { 3180 if (this._streamTypes.has(type)) { 3181 return; 3182 } 3183 3184 this._streamTypes.add(type); 3185 3186 this._send(); 3187 } 3188 3189 addFontType(type) { 3190 if (this._fontTypes.has(type)) { 3191 return; 3192 } 3193 3194 this._fontTypes.add(type); 3195 3196 this._send(); 3197 } 3198 3199} 3200 3201exports.DocStats = DocStats; 3202 3203function getInheritableProperty({ 3204 dict, 3205 key, 3206 getArray = false, 3207 stopWhenFound = true 3208}) { 3209 let values; 3210 const visited = new _primitives.RefSet(); 3211 3212 while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) { 3213 if (dict.objId) { 3214 visited.put(dict.objId); 3215 } 3216 3217 const value = getArray ? dict.getArray(key) : dict.get(key); 3218 3219 if (value !== undefined) { 3220 if (stopWhenFound) { 3221 return value; 3222 } 3223 3224 if (!values) { 3225 values = []; 3226 } 3227 3228 values.push(value); 3229 } 3230 3231 dict = dict.get("Parent"); 3232 } 3233 3234 return values; 3235} 3236 3237const 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"]; 3238 3239function toRomanNumerals(number, lowerCase = false) { 3240 (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer."); 3241 const romanBuf = []; 3242 let pos; 3243 3244 while (number >= 1000) { 3245 number -= 1000; 3246 romanBuf.push("M"); 3247 } 3248 3249 pos = number / 100 | 0; 3250 number %= 100; 3251 romanBuf.push(ROMAN_NUMBER_MAP[pos]); 3252 pos = number / 10 | 0; 3253 number %= 10; 3254 romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); 3255 romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); 3256 const romanStr = romanBuf.join(""); 3257 return lowerCase ? romanStr.toLowerCase() : romanStr; 3258} 3259 3260function log2(x) { 3261 if (x <= 0) { 3262 return 0; 3263 } 3264 3265 return Math.ceil(Math.log2(x)); 3266} 3267 3268function readInt8(data, offset) { 3269 return data[offset] << 24 >> 24; 3270} 3271 3272function readUint16(data, offset) { 3273 return data[offset] << 8 | data[offset + 1]; 3274} 3275 3276function readUint32(data, offset) { 3277 return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; 3278} 3279 3280function isWhiteSpace(ch) { 3281 return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a; 3282} 3283 3284function parseXFAPath(path) { 3285 const positionPattern = /(.+)\[(\d+)\]$/; 3286 return path.split(".").map(component => { 3287 const m = component.match(positionPattern); 3288 3289 if (m) { 3290 return { 3291 name: m[1], 3292 pos: parseInt(m[2], 10) 3293 }; 3294 } 3295 3296 return { 3297 name: component, 3298 pos: 0 3299 }; 3300 }); 3301} 3302 3303function escapePDFName(str) { 3304 const buffer = []; 3305 let start = 0; 3306 3307 for (let i = 0, ii = str.length; i < ii; i++) { 3308 const char = str.charCodeAt(i); 3309 3310 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) { 3311 if (start < i) { 3312 buffer.push(str.substring(start, i)); 3313 } 3314 3315 buffer.push(`#${char.toString(16)}`); 3316 start = i + 1; 3317 } 3318 } 3319 3320 if (buffer.length === 0) { 3321 return str; 3322 } 3323 3324 if (start < str.length) { 3325 buffer.push(str.substring(start, str.length)); 3326 } 3327 3328 return buffer.join(""); 3329} 3330 3331function _collectJS(entry, xref, list, parents) { 3332 if (!entry) { 3333 return; 3334 } 3335 3336 let parent = null; 3337 3338 if ((0, _primitives.isRef)(entry)) { 3339 if (parents.has(entry)) { 3340 return; 3341 } 3342 3343 parent = entry; 3344 parents.put(parent); 3345 entry = xref.fetch(entry); 3346 } 3347 3348 if (Array.isArray(entry)) { 3349 for (const element of entry) { 3350 _collectJS(element, xref, list, parents); 3351 } 3352 } else if (entry instanceof _primitives.Dict) { 3353 if ((0, _primitives.isName)(entry.get("S"), "JavaScript") && entry.has("JS")) { 3354 const js = entry.get("JS"); 3355 let code; 3356 3357 if ((0, _primitives.isStream)(js)) { 3358 code = js.getString(); 3359 } else { 3360 code = js; 3361 } 3362 3363 code = (0, _util.stringToPDFString)(code); 3364 3365 if (code) { 3366 list.push(code); 3367 } 3368 } 3369 3370 _collectJS(entry.getRaw("Next"), xref, list, parents); 3371 } 3372 3373 if (parent) { 3374 parents.remove(parent); 3375 } 3376} 3377 3378function collectActions(xref, dict, eventType) { 3379 const actions = Object.create(null); 3380 const additionalActionsDicts = getInheritableProperty({ 3381 dict, 3382 key: "AA", 3383 stopWhenFound: false 3384 }); 3385 3386 if (additionalActionsDicts) { 3387 for (let i = additionalActionsDicts.length - 1; i >= 0; i--) { 3388 const additionalActions = additionalActionsDicts[i]; 3389 3390 if (!(additionalActions instanceof _primitives.Dict)) { 3391 continue; 3392 } 3393 3394 for (const key of additionalActions.getKeys()) { 3395 const action = eventType[key]; 3396 3397 if (!action) { 3398 continue; 3399 } 3400 3401 const actionDict = additionalActions.getRaw(key); 3402 const parents = new _primitives.RefSet(); 3403 const list = []; 3404 3405 _collectJS(actionDict, xref, list, parents); 3406 3407 if (list.length > 0) { 3408 actions[action] = list; 3409 } 3410 } 3411 } 3412 } 3413 3414 if (dict.has("A")) { 3415 const actionDict = dict.get("A"); 3416 const parents = new _primitives.RefSet(); 3417 const list = []; 3418 3419 _collectJS(actionDict, xref, list, parents); 3420 3421 if (list.length > 0) { 3422 actions.Action = list; 3423 } 3424 } 3425 3426 return (0, _util.objectSize)(actions) > 0 ? actions : null; 3427} 3428 3429const XMLEntities = { 3430 0x3c: "<", 3431 0x3e: ">", 3432 0x26: "&", 3433 0x22: """, 3434 0x27: "'" 3435}; 3436 3437function encodeToXmlString(str) { 3438 const buffer = []; 3439 let start = 0; 3440 3441 for (let i = 0, ii = str.length; i < ii; i++) { 3442 const char = str.codePointAt(i); 3443 3444 if (0x20 <= char && char <= 0x7e) { 3445 const entity = XMLEntities[char]; 3446 3447 if (entity) { 3448 if (start < i) { 3449 buffer.push(str.substring(start, i)); 3450 } 3451 3452 buffer.push(entity); 3453 start = i + 1; 3454 } 3455 } else { 3456 if (start < i) { 3457 buffer.push(str.substring(start, i)); 3458 } 3459 3460 buffer.push(`&#x${char.toString(16).toUpperCase()};`); 3461 3462 if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) { 3463 i++; 3464 } 3465 3466 start = i + 1; 3467 } 3468 } 3469 3470 if (buffer.length === 0) { 3471 return str; 3472 } 3473 3474 if (start < str.length) { 3475 buffer.push(str.substring(start, str.length)); 3476 } 3477 3478 return buffer.join(""); 3479} 3480 3481function validateCSSFont(cssFontInfo) { 3482 const DEFAULT_CSS_FONT_OBLIQUE = "14"; 3483 const DEFAULT_CSS_FONT_WEIGHT = "400"; 3484 const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]); 3485 const { 3486 fontFamily, 3487 fontWeight, 3488 italicAngle 3489 } = cssFontInfo; 3490 3491 if (/^".*"$/.test(fontFamily)) { 3492 if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) { 3493 (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`); 3494 return false;
3495 } 3496 } else if (/^'.*'$/.test(fontFamily)) { 3497 if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) { 3498 (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`); 3499 return false; 3500 } 3501 } else { 3502 for (const ident of fontFamily.split(/[ \t]+/)) { 3503 if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) { 3504 (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`); 3505 return false; 3506 } 3507 } 3508 } 3509 3510 const weight = fontWeight ? fontWeight.toString() : ""; 3511 cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT; 3512 const angle = parseFloat(italicAngle); 3513 cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString(); 3514 return true; 3515} 3516 3517function recoverJsURL(str) { 3518 const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"]; 3519 const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i"); 3520 const jsUrl = regex.exec(str); 3521 3522 if (jsUrl && jsUrl[2]) { 3523 const url = jsUrl[2]; 3524 let newWindow = false; 3525 3526 if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") { 3527 newWindow = true; 3528 } 3529 3530 return { 3531 url, 3532 newWindow 3533 }; 3534 } 3535 3536 return null; 3537} 3538 3539/***/ }), 3540/* 10 */ 3541/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 3542 3543 3544 3545Object.defineProperty(exports, "__esModule", ({ 3546 value: true 3547})); 3548exports.StringStream = exports.Stream = exports.NullStream = void 0; 3549 3550var _base_stream = __w_pdfjs_require__(6); 3551 3552var _util = __w_pdfjs_require__(2); 3553 3554class Stream extends _base_stream.BaseStream { 3555 constructor(arrayBuffer, start, length, dict) { 3556 super(); 3557 this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer); 3558 this.start = start || 0; 3559 this.pos = this.start; 3560 this.end = start + length || this.bytes.length; 3561 this.dict = dict; 3562 } 3563 3564 get length() { 3565 return this.end - this.start; 3566 } 3567 3568 get isEmpty() { 3569 return this.length === 0; 3570 } 3571 3572 getByte() { 3573 if (this.pos >= this.end) { 3574 return -1; 3575 } 3576 3577 return this.bytes[this.pos++]; 3578 } 3579 3580 getBytes(length, forceClamped = false) { 3581 const bytes = this.bytes; 3582 const pos = this.pos; 3583 const strEnd = this.end; 3584 3585 if (!length) { 3586 const subarray = bytes.subarray(pos, strEnd); 3587 return forceClamped ? new Uint8ClampedArray(subarray) : subarray; 3588 } 3589 3590 let end = pos + length; 3591 3592 if (end > strEnd) { 3593 end = strEnd; 3594 } 3595 3596 this.pos = end; 3597 const subarray = bytes.subarray(pos, end); 3598 return forceClamped ? new Uint8ClampedArray(subarray) : subarray; 3599 } 3600 3601 getByteRange(begin, end) { 3602 if (begin < 0) { 3603 begin = 0; 3604 } 3605 3606 if (end > this.end) { 3607 end = this.end; 3608 } 3609 3610 return this.bytes.subarray(begin, end); 3611 } 3612 3613 reset() { 3614 this.pos = this.start; 3615 } 3616 3617 moveStart() { 3618 this.start = this.pos; 3619 } 3620 3621 makeSubStream(start, length, dict = null) { 3622 return new Stream(this.bytes.buffer, start, length, dict); 3623 } 3624 3625} 3626 3627exports.Stream = Stream; 3628 3629class StringStream extends Stream { 3630 constructor(str) { 3631 super((0, _util.stringToBytes)(str)); 3632 } 3633 3634} 3635 3636exports.StringStream = StringStream; 3637 3638class NullStream extends Stream { 3639 constructor() { 3640 super(new Uint8Array(0)); 3641 } 3642 3643} 3644 3645exports.NullStream = NullStream; 3646 3647/***/ }), 3648/* 11 */ 3649/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 3650 3651 3652 3653Object.defineProperty(exports, "__esModule", ({ 3654 value: true 3655})); 3656exports.Page = exports.PDFDocument = void 0; 3657 3658var _util = __w_pdfjs_require__(2); 3659 3660var _primitives = __w_pdfjs_require__(5); 3661 3662var _core_utils = __w_pdfjs_require__(9); 3663 3664var _xfa_fonts = __w_pdfjs_require__(12); 3665 3666var _stream = __w_pdfjs_require__(10); 3667 3668var _annotation = __w_pdfjs_require__(22); 3669 3670var _base_stream = __w_pdfjs_require__(6); 3671 3672var _crypto = __w_pdfjs_require__(72); 3673 3674var _catalog = __w_pdfjs_require__(64); 3675 3676var _parser = __w_pdfjs_require__(27); 3677 3678var _object_loader = __w_pdfjs_require__(70); 3679 3680var _operator_list = __w_pdfjs_require__(62); 3681 3682var _evaluator = __w_pdfjs_require__(25); 3683 3684var _decode_stream = __w_pdfjs_require__(29); 3685 3686var _struct_tree = __w_pdfjs_require__(69); 3687 3688var _factory = __w_pdfjs_require__(74); 3689 3690var _xref = __w_pdfjs_require__(98); 3691 3692const DEFAULT_USER_UNIT = 1.0; 3693const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792]; 3694 3695class Page { 3696 constructor({ 3697 pdfManager, 3698 xref, 3699 pageIndex, 3700 pageDict, 3701 ref, 3702 globalIdFactory, 3703 fontCache, 3704 builtInCMapCache, 3705 standardFontDataCache, 3706 globalImageCache, 3707 nonBlendModesSet, 3708 xfaFactory 3709 }) { 3710 this.pdfManager = pdfManager; 3711 this.pageIndex = pageIndex; 3712 this.pageDict = pageDict; 3713 this.xref = xref; 3714 this.ref = ref; 3715 this.fontCache = fontCache; 3716 this.builtInCMapCache = builtInCMapCache; 3717 this.standardFontDataCache = standardFontDataCache; 3718 this.globalImageCache = globalImageCache; 3719 this.nonBlendModesSet = nonBlendModesSet; 3720 this.evaluatorOptions = pdfManager.evaluatorOptions; 3721 this.resourcesPromise = null; 3722 this.xfaFactory = xfaFactory; 3723 const idCounters = { 3724 obj: 0 3725 }; 3726 this._localIdFactory = class extends globalIdFactory { 3727 static createObjId() { 3728 return `p${pageIndex}_${++idCounters.obj}`; 3729 } 3730 3731 static getPageObjId() { 3732 return `page${ref.toString()}`; 3733 } 3734 3735 }; 3736 } 3737 3738 _getInheritableProperty(key, getArray = false) { 3739 const value = (0, _core_utils.getInheritableProperty)({ 3740 dict: this.pageDict, 3741 key, 3742 getArray, 3743 stopWhenFound: false 3744 }); 3745 3746 if (!Array.isArray(value)) { 3747 return value; 3748 } 3749 3750 if (value.length === 1 || !(0, _primitives.isDict)(value[0])) { 3751 return value[0]; 3752 } 3753 3754 return _primitives.Dict.merge({ 3755 xref: this.xref, 3756 dictArray: value 3757 }); 3758 } 3759 3760 get content() { 3761 return this.pageDict.getArray("Contents"); 3762 } 3763 3764 get resources() { 3765 return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty); 3766 } 3767 3768 _getBoundingBox(name) { 3769 if (this.xfaData) { 3770 return this.xfaData.bbox; 3771 } 3772 3773 const box = this._getInheritableProperty(name, true); 3774 3775 if (Array.isArray(box) && box.length === 4) { 3776 if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) { 3777 return box; 3778 } 3779 3780 (0, _util.warn)(`Empty /${name} entry.`); 3781 } 3782 3783 return null; 3784 } 3785 3786 get mediaBox() { 3787 return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX); 3788 } 3789 3790 get cropBox() { 3791 return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox); 3792 } 3793 3794 get userUnit() { 3795 let obj = this.pageDict.get("UserUnit"); 3796 3797 if (!(0, _util.isNum)(obj) || obj <= 0) { 3798 obj = DEFAULT_USER_UNIT; 3799 } 3800 3801 return (0, _util.shadow)(this, "userUnit", obj); 3802 } 3803 3804 get view() { 3805 const { 3806 cropBox, 3807 mediaBox 3808 } = this; 3809 let view; 3810 3811 if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) { 3812 view = mediaBox; 3813 } else { 3814 const box = _util.Util.intersect(cropBox, mediaBox); 3815 3816 if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) { 3817 view = box; 3818 } else { 3819 (0, _util.warn)("Empty /CropBox and /MediaBox intersection."); 3820 } 3821 } 3822 3823 return (0, _util.shadow)(this, "view", view || mediaBox); 3824 } 3825 3826 get rotate() { 3827 let rotate = this._getInheritableProperty("Rotate") || 0; 3828 3829 if (rotate % 90 !== 0) { 3830 rotate = 0; 3831 } else if (rotate >= 360) {
3832 rotate %= 360; 3833 } else if (rotate < 0) { 3834 rotate = (rotate % 360 + 360) % 360; 3835 } 3836 3837 return (0, _util.shadow)(this, "rotate", rotate); 3838 } 3839 3840 _onSubStreamError(handler, reason, objId) { 3841 if (this.evaluatorOptions.ignoreErrors) { 3842 handler.send("UnsupportedFeature", { 3843 featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream 3844 }); 3845 (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`); 3846 return; 3847 } 3848 3849 throw reason; 3850 } 3851 3852 getContentStream(handler) { 3853 return this.pdfManager.ensure(this, "content").then(content => { 3854 if (content instanceof _base_stream.BaseStream) { 3855 return content; 3856 } 3857 3858 if (Array.isArray(content)) { 3859 return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler)); 3860 } 3861 3862 return new _stream.NullStream(); 3863 }); 3864 } 3865 3866 get xfaData() { 3867 return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? { 3868 bbox: this.xfaFactory.getBoundingBox(this.pageIndex) 3869 } : null); 3870 } 3871 3872 save(handler, task, annotationStorage) { 3873 const partialEvaluator = new _evaluator.PartialEvaluator({ 3874 xref: this.xref, 3875 handler, 3876 pageIndex: this.pageIndex, 3877 idFactory: this._localIdFactory, 3878 fontCache: this.fontCache, 3879 builtInCMapCache: this.builtInCMapCache, 3880 standardFontDataCache: this.standardFontDataCache, 3881 globalImageCache: this.globalImageCache, 3882 options: this.evaluatorOptions 3883 }); 3884 return this._parsedAnnotations.then(function (annotations) { 3885 const newRefsPromises = []; 3886 3887 for (const annotation of annotations) { 3888 if (!annotation.mustBePrinted(annotationStorage)) { 3889 continue; 3890 } 3891 3892 newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) { 3893 (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`); 3894 return null; 3895 })); 3896 } 3897 3898 return Promise.all(newRefsPromises); 3899 }); 3900 } 3901 3902 loadResources(keys) { 3903 if (!this.resourcesPromise) { 3904 this.resourcesPromise = this.pdfManager.ensure(this, "resources"); 3905 } 3906 3907 return this.resourcesPromise.then(() => { 3908 const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref); 3909 return objectLoader.load(); 3910 }); 3911 } 3912 3913 getOperatorList({ 3914 handler, 3915 sink, 3916 task, 3917 intent, 3918 cacheKey, 3919 annotationStorage = null 3920 }) { 3921 const contentStreamPromise = this.getContentStream(handler); 3922 const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]); 3923 const partialEvaluator = new _evaluator.PartialEvaluator({ 3924 xref: this.xref, 3925 handler, 3926 pageIndex: this.pageIndex, 3927 idFactory: this._localIdFactory, 3928 fontCache: this.fontCache, 3929 builtInCMapCache: this.builtInCMapCache, 3930 standardFontDataCache: this.standardFontDataCache, 3931 globalImageCache: this.globalImageCache, 3932 options: this.evaluatorOptions 3933 }); 3934 const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); 3935 const pageListPromise = dataPromises.then(([contentStream]) => { 3936 const opList = new _operator_list.OperatorList(intent, sink); 3937 handler.send("StartRenderPage", { 3938 transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet), 3939 pageIndex: this.pageIndex, 3940 cacheKey 3941 }); 3942 return partialEvaluator.getOperatorList({ 3943 stream: contentStream, 3944 task, 3945 resources: this.resources, 3946 operatorList: opList 3947 }).then(function () { 3948 return opList; 3949 }); 3950 }); 3951 return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) { 3952 if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) { 3953 pageOpList.flush(true); 3954 return { 3955 length: pageOpList.totalLength 3956 }; 3957 } 3958 3959 const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS), 3960 intentAny = !!(intent & _util.RenderingIntentFlag.ANY), 3961 intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY), 3962 intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT); 3963 const opListPromises = []; 3964 3965 for (const annotation of annotations) { 3966 if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) { 3967 opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) { 3968 (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`); 3969 return null; 3970 })); 3971 } 3972 } 3973 3974 return Promise.all(opListPromises).then(function (opLists) { 3975 pageOpList.addOp(_util.OPS.beginAnnotations, []); 3976 3977 for (const opList of opLists) { 3978 pageOpList.addOpList(opList); 3979 } 3980 3981 pageOpList.addOp(_util.OPS.endAnnotations, []); 3982 pageOpList.flush(true); 3983 return { 3984 length: pageOpList.totalLength 3985 }; 3986 }); 3987 }); 3988 } 3989 3990 extractTextContent({ 3991 handler, 3992 task, 3993 normalizeWhitespace, 3994 includeMarkedContent, 3995 sink, 3996 combineTextItems 3997 }) { 3998 const contentStreamPromise = this.getContentStream(handler); 3999 const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]); 4000 const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); 4001 return dataPromises.then(([contentStream]) => { 4002 const partialEvaluator = new _evaluator.PartialEvaluator({ 4003 xref: this.xref, 4004 handler, 4005 pageIndex: this.pageIndex, 4006 idFactory: this._localIdFactory, 4007 fontCache: this.fontCache, 4008 builtInCMapCache: this.builtInCMapCache, 4009 standardFontDataCache: this.standardFontDataCache, 4010 globalImageCache: this.globalImageCache, 4011 options: this.evaluatorOptions 4012 }); 4013 return partialEvaluator.getTextContent({ 4014 stream: contentStream, 4015 task, 4016 resources: this.resources, 4017 normalizeWhitespace, 4018 includeMarkedContent, 4019 combineTextItems, 4020 sink 4021 }); 4022 }); 4023 } 4024 4025 async getStructTree() { 4026 const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot"); 4027
4028 if (!structTreeRoot) { 4029 return null; 4030 } 4031 4032 const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]); 4033 return structTree.serializable; 4034 } 4035 4036 _parseStructTree(structTreeRoot) { 4037 const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict); 4038 tree.parse(); 4039 return tree; 4040 } 4041 4042 getAnnotationsData(intent) { 4043 return this._parsedAnnotations.then(function (annotations) { 4044 const annotationsData = []; 4045 4046 if (annotations.length === 0) { 4047 return annotationsData; 4048 } 4049 4050 const intentAny = !!(intent & _util.RenderingIntentFlag.ANY), 4051 intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY), 4052 intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT); 4053 4054 for (const annotation of annotations) { 4055 if (intentAny || intentDisplay && annotation.viewable || intentPrint && annotation.printable) { 4056 annotationsData.push(annotation.data); 4057 } 4058 } 4059 4060 return annotationsData; 4061 }); 4062 } 4063 4064 get annotations() { 4065 const annots = this._getInheritableProperty("Annots"); 4066 4067 return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []); 4068 } 4069 4070 get _parsedAnnotations() { 4071 const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => { 4072 const annotationPromises = []; 4073 4074 for (const annotationRef of this.annotations) { 4075 annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) { 4076 (0, _util.warn)(`_parsedAnnotations: "${reason}".`); 4077 return null; 4078 })); 4079 } 4080 4081 return Promise.all(annotationPromises).then(function (annotations) { 4082 return annotations.filter(annotation => !!annotation); 4083 }); 4084 }); 4085 return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations); 4086 } 4087 4088 get jsActions() { 4089 const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType); 4090 return (0, _util.shadow)(this, "jsActions", actions); 4091 } 4092 4093} 4094 4095exports.Page = Page; 4096const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]); 4097const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]); 4098const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]); 4099const FINGERPRINT_FIRST_BYTES = 1024; 4100const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; 4101const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.\d$/; 4102 4103function find(stream, signature, limit = 1024, backwards = false) { 4104 const signatureLength = signature.length; 4105 const scanBytes = stream.peekBytes(limit); 4106 const scanLength = scanBytes.length - signatureLength; 4107 4108 if (scanLength <= 0) { 4109 return false; 4110 } 4111 4112 if (backwards) { 4113 const signatureEnd = signatureLength - 1; 4114 let pos = scanBytes.length - 1; 4115 4116 while (pos >= signatureEnd) { 4117 let j = 0; 4118 4119 while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) { 4120 j++; 4121 } 4122 4123 if (j >= signatureLength) { 4124 stream.pos += pos - signatureEnd; 4125 return true; 4126 } 4127 4128 pos--; 4129 } 4130 } else { 4131 let pos = 0; 4132 4133 while (pos <= scanLength) { 4134 let j = 0; 4135 4136 while (j < signatureLength && scanBytes[pos + j] === signature[j]) { 4137 j++; 4138 } 4139 4140 if (j >= signatureLength) { 4141 stream.pos += pos; 4142 return true; 4143 } 4144 4145 pos++; 4146 } 4147 } 4148 4149 return false; 4150} 4151 4152class PDFDocument { 4153 constructor(pdfManager, arg) { 4154 let stream; 4155 4156 if ((0, _primitives.isStream)(arg)) { 4157 stream = arg; 4158 } else if ((0, _util.isArrayBuffer)(arg)) { 4159 stream = new _stream.Stream(arg); 4160 } else { 4161 throw new Error("PDFDocument: Unknown argument type"); 4162 } 4163 4164 if (stream.length <= 0) { 4165 throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes."); 4166 } 4167 4168 this.pdfManager = pdfManager; 4169 this.stream = stream; 4170 this.xref = new _xref.XRef(stream, pdfManager); 4171 this._pagePromises = new Map(); 4172 this._version = null; 4173 const idCounters = { 4174 font: 0 4175 }; 4176 this._globalIdFactory = class { 4177 static getDocId() { 4178 return `g_${pdfManager.docId}`; 4179 } 4180 4181 static createFontId() { 4182 return `f${++idCounters.font}`; 4183 } 4184 4185 static createObjId() { 4186 (0, _util.unreachable)("Abstract method `createObjId` called."); 4187 } 4188 4189 static getPageObjId() { 4190 (0, _util.unreachable)("Abstract method `getPageObjId` called."); 4191 } 4192 4193 }; 4194 } 4195 4196 parse(recoveryMode) { 4197 this.xref.parse(recoveryMode); 4198 this.catalog = new _catalog.Catalog(this.pdfManager, this.xref); 4199
4200 if (this.catalog.version) { 4201 this._version = this.catalog.version; 4202 } 4203 } 4204 4205 get linearization() { 4206 let linearization = null; 4207 4208 try { 4209 linearization = _parser.Linearization.create(this.stream); 4210 } catch (err) { 4211 if (err instanceof _core_utils.MissingDataException) { 4212 throw err; 4213 } 4214 4215 (0, _util.info)(err); 4216 } 4217 4218 return (0, _util.shadow)(this, "linearization", linearization); 4219 } 4220 4221 get startXRef() { 4222 const stream = this.stream; 4223 let startXRef = 0; 4224 4225 if (this.linearization) { 4226 stream.reset(); 4227 4228 if (find(stream, ENDOBJ_SIGNATURE)) { 4229 startXRef = stream.pos + 6 - stream.start; 4230 } 4231 } else { 4232 const step = 1024; 4233 const startXRefLength = STARTXREF_SIGNATURE.length; 4234 let found = false, 4235 pos = stream.end; 4236 4237 while (!found && pos > 0) { 4238 pos -= step - startXRefLength; 4239 4240 if (pos < 0) { 4241 pos = 0; 4242 } 4243 4244 stream.pos = pos; 4245 found = find(stream, STARTXREF_SIGNATURE, step, true); 4246 } 4247 4248 if (found) { 4249 stream.skip(9); 4250 let ch; 4251 4252 do { 4253 ch = stream.getByte(); 4254 } while ((0, _core_utils.isWhiteSpace)(ch)); 4255 4256 let str = ""; 4257 4258 while (ch >= 0x20 && ch <= 0x39) { 4259 str += String.fromCharCode(ch); 4260 ch = stream.getByte(); 4261 } 4262 4263 startXRef = parseInt(str, 10); 4264 4265 if (isNaN(startXRef)) { 4266 startXRef = 0; 4267 } 4268 } 4269 } 4270 4271 return (0, _util.shadow)(this, "startXRef", startXRef); 4272 } 4273 4274 checkHeader() { 4275 const stream = this.stream; 4276 stream.reset(); 4277 4278 if (!find(stream, PDF_HEADER_SIGNATURE)) { 4279 return; 4280 } 4281 4282 stream.moveStart(); 4283 const MAX_PDF_VERSION_LENGTH = 12; 4284 let version = "", 4285 ch; 4286 4287 while ((ch = stream.getByte()) > 0x20) { 4288 if (version.length >= MAX_PDF_VERSION_LENGTH) { 4289 break; 4290 } 4291 4292 version += String.fromCharCode(ch); 4293 } 4294 4295 if (!this._version) { 4296 this._version = version.substring(5); 4297 } 4298 } 4299 4300 parseStartXRef() { 4301 this.xref.setStartXRef(this.startXRef); 4302 } 4303 4304 get numPages() { 4305 let num = 0; 4306 4307 if (this.catalog.hasActualNumPages) { 4308 num = this.catalog.numPages; 4309 } else if (this.xfaFactory) { 4310 num = this.xfaFactory.getNumPages(); 4311 } else if (this.linearization) { 4312 num = this.linearization.numPages; 4313 } else { 4314 num = this.catalog.numPages; 4315 } 4316 4317 return (0, _util.shadow)(this, "numPages", num); 4318 } 4319 4320 _hasOnlyDocumentSignatures(fields, recursionDepth = 0) { 4321 const RECURSION_LIMIT = 10; 4322 4323 if (!Array.isArray(fields)) { 4324 return false; 4325 } 4326 4327 return fields.every(field => { 4328 field = this.xref.fetchIfRef(field); 4329 4330 if (!(field instanceof _primitives.Dict)) { 4331 return false; 4332 } 4333 4334 if (field.has("Kids")) { 4335 if (++recursionDepth > RECURSION_LIMIT) { 4336 (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached"); 4337 return false; 4338 } 4339 4340 return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth); 4341 } 4342 4343 const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig"); 4344 const rectangle = field.get("Rect"); 4345 const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0); 4346 return isSignature && isInvisible; 4347 }); 4348 } 4349 4350 get xfaData() { 4351 const acroForm = this.catalog.acroForm; 4352 4353 if (!acroForm) { 4354 return null; 4355 } 4356 4357 const xfa = acroForm.get("XFA"); 4358 const entries = { 4359 "xdp:xdp": "", 4360 template: "", 4361 datasets: "", 4362 config: "", 4363 connectionSet: "", 4364 localeSet: "", 4365 stylesheet: "", 4366 "/xdp:xdp": "" 4367 }; 4368 4369 if ((0, _primitives.isStream)(xfa) && !xfa.isEmpty) { 4370 try { 4371 entries["xdp:xdp"] = (0, _util.stringToUTF8String)(xfa.getString()); 4372 return entries; 4373 } catch (_) { 4374 (0, _util.warn)("XFA - Invalid utf-8 string."); 4375 return null; 4376 } 4377 } 4378 4379 if (!Array.isArray(xfa) || xfa.length === 0) { 4380 return null; 4381 } 4382 4383 for (let i = 0, ii = xfa.length; i < ii; i += 2) { 4384 let name; 4385 4386 if (i === 0) { 4387 name = "xdp:xdp"; 4388 } else if (i === ii - 2) { 4389 name = "/xdp:xdp"; 4390 } else { 4391 name = xfa[i]; 4392 } 4393 4394 if (!entries.hasOwnProperty(name)) { 4395 continue; 4396 } 4397 4398 const data = this.xref.fetchIfRef(xfa[i + 1]); 4399 4400 if (!(0, _primitives.isStream)(data) || data.isEmpty) { 4401 continue; 4402 } 4403
4404 try { 4405 entries[name] = (0, _util.stringToUTF8String)(data.getString()); 4406 } catch (_) { 4407 (0, _util.warn)("XFA - Invalid utf-8 string."); 4408 return null; 4409 } 4410 } 4411 4412 return entries; 4413 } 4414 4415 get xfaFactory() { 4416 let data; 4417 4418 if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) { 4419 data = this.xfaData; 4420 } 4421 4422 return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null); 4423 } 4424 4425 get isPureXfa() { 4426 return this.xfaFactory ? this.xfaFactory.isValid() : false; 4427 } 4428 4429 get htmlForXfa() { 4430 return this.xfaFactory ? this.xfaFactory.getPages() : null; 4431 } 4432 4433 async loadXfaImages() { 4434 const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages"); 4435 4436 if (!xfaImagesDict) { 4437 return; 4438 } 4439 4440 const keys = xfaImagesDict.getKeys(); 4441 const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref); 4442 await objectLoader.load(); 4443 const xfaImages = new Map(); 4444 4445 for (const key of keys) { 4446 const stream = xfaImagesDict.get(key); 4447 4448 if (!(0, _primitives.isStream)(stream)) { 4449 continue; 4450 } 4451 4452 xfaImages.set(key, stream.getBytes()); 4453 } 4454 4455 this.xfaFactory.setImages(xfaImages); 4456 } 4457 4458 async loadXfaFonts(handler, task) { 4459 const acroForm = await this.pdfManager.ensureCatalog("acroForm"); 4460 4461 if (!acroForm) { 4462 return; 4463 } 4464 4465 const resources = await acroForm.getAsync("DR"); 4466 4467 if (!(resources instanceof _primitives.Dict)) { 4468 return; 4469 } 4470 4471 const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref); 4472 await objectLoader.load(); 4473 const fontRes = resources.get("Font"); 4474 4475 if (!(fontRes instanceof _primitives.Dict)) { 4476 return; 4477 } 4478 4479 const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions); 4480 options.useSystemFonts = false; 4481 const partialEvaluator = new _evaluator.PartialEvaluator({ 4482 xref: this.xref, 4483 handler, 4484 pageIndex: -1, 4485 idFactory: this._globalIdFactory, 4486 fontCache: this.catalog.fontCache, 4487 builtInCMapCache: this.catalog.builtInCMapCache, 4488 standardFontDataCache: this.catalog.standardFontDataCache, 4489 options 4490 }); 4491 const operatorList = new _operator_list.OperatorList(); 4492 const pdfFonts = []; 4493 const initialState = { 4494 get font() { 4495 return pdfFonts[pdfFonts.length - 1]; 4496 }, 4497 4498 set font(font) { 4499 pdfFonts.push(font); 4500 }, 4501 4502 clone() { 4503 return this; 4504 } 4505 4506 }; 4507 const fonts = new Map(); 4508 fontRes.forEach((fontName, font) => { 4509 fonts.set(fontName, font); 4510 }); 4511 const promises = []; 4512 4513 for (const [fontName, font] of fonts) { 4514 const descriptor = font.get("FontDescriptor"); 4515 4516 if (!(descriptor instanceof _primitives.Dict)) { 4517 continue; 4518 } 4519 4520 let fontFamily = descriptor.get("FontFamily"); 4521 fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1"); 4522 const fontWeight = descriptor.get("FontWeight"); 4523 const italicAngle = -descriptor.get("ItalicAngle"); 4524 const cssFontInfo = { 4525 fontFamily, 4526 fontWeight, 4527 italicAngle 4528 }; 4529 4530 if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) { 4531 continue; 4532 } 4533 4534 promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) { 4535 (0, _util.warn)(`loadXfaFonts: "${reason}".`); 4536 return null; 4537 })); 4538 } 4539 4540 await Promise.all(promises); 4541 const missingFonts = this.xfaFactory.setFonts(pdfFonts); 4542 4543 if (!missingFonts) { 4544 return; 4545 } 4546 4547 options.ignoreErrors = true; 4548 promises.length = 0; 4549 pdfFonts.length = 0; 4550 const reallyMissingFonts = new Set(); 4551 4552 for (const missing of missingFonts) { 4553 if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) { 4554 reallyMissingFonts.add(missing); 4555 } 4556 } 4557 4558 if (reallyMissingFonts.size) { 4559 missingFonts.push("PdfJS-Fallback"); 4560 } 4561 4562 for (const missing of missingFonts) { 4563 if (reallyMissingFonts.has(missing)) { 4564 continue; 4565 } 4566 4567 for (const fontInfo of [{ 4568 name: "Regular", 4569 fontWeight: 400, 4570 italicAngle: 0 4571 }, { 4572 name: "Bold", 4573 fontWeight: 700, 4574 italicAngle: 0 4575 }, { 4576 name: "Italic", 4577 fontWeight: 400, 4578 italicAngle: 12 4579 }, { 4580 name: "BoldItalic", 4581 fontWeight: 700, 4582 italicAngle: 12 4583 }]) { 4584 const name = `${missing}-${fontInfo.name}`; 4585 const dict = (0, _xfa_fonts.getXfaFontDict)(name); 4586 promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, { 4587 fontFamily: missing, 4588 fontWeight: fontInfo.fontWeight, 4589 italicAngle: fontInfo.italicAngle 4590 }).catch(function (reason) { 4591 (0, _util.warn)(`loadXfaFonts: "${reason}".`); 4592 return null; 4593 })); 4594 } 4595 } 4596 4597 await Promise.all(promises); 4598 this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts); 4599 } 4600 4601 async serializeXfaData(annotationStorage) { 4602 return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null; 4603 } 4604 4605 get formInfo() { 4606 const formInfo = { 4607 hasFields: false, 4608 hasAcroForm: false, 4609 hasXfa: false, 4610 hasSignatures: false 4611 }; 4612 const acroForm = this.catalog.acroForm; 4613 4614 if (!acroForm) { 4615 return (0, _util.shadow)(this, "formInfo", formInfo); 4616 } 4617 4618 try { 4619 const fields = acroForm.get("Fields"); 4620 const hasFields = Array.isArray(fields) && fields.length > 0; 4621 formInfo.hasFields = hasFields; 4622 const xfa = acroForm.get("XFA"); 4623 formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || (0, _primitives.isStream)(xfa) && !xfa.isEmpty; 4624 const sigFlags = acroForm.get("SigFlags"); 4625 const hasSignatures = !!(sigFlags & 0x1); 4626 4627 const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields); 4628 4629 formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures; 4630 formInfo.hasSignatures = hasSignatures; 4631 } catch (ex) { 4632 if (ex instanceof _core_utils.MissingDataException) { 4633 throw ex; 4634 } 4635 4636 (0, _util.warn)(`Cannot fetch form information: "${ex}".`); 4637 } 4638 4639 return (0, _util.shadow)(this, "formInfo", formInfo); 4640 } 4641 4642 get documentInfo() { 4643 const DocumentInfoValidators = { 4644 Title: _util.isString, 4645 Author: _util.isString, 4646 Subject: _util.isString, 4647 Keywords: _util.isString, 4648 Creator: _util.isString, 4649 Producer: _util.isString, 4650 CreationDate: _util.isString, 4651 ModDate: _util.isString, 4652 Trapped: _primitives.isName 4653 }; 4654 let version = this._version; 4655 4656 if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) { 4657 (0, _util.warn)(`Invalid PDF header version number: ${version}`); 4658 version = null; 4659 } 4660 4661 const docInfo = { 4662 PDFFormatVersion: version, 4663 Language: this.catalog.lang, 4664 EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null, 4665 IsLinearized: !!this.linearization, 4666 IsAcroFormPresent: this.formInfo.hasAcroForm, 4667 IsXFAPresent: this.formInfo.hasXfa, 4668 IsCollectionPresent: !!this.catalog.collection, 4669 IsSignaturesPresent: this.formInfo.hasSignatures 4670 }; 4671 let infoDict; 4672 4673 try { 4674 infoDict = this.xref.trailer.get("Info"); 4675 } catch (err) { 4676 if (err instanceof _core_utils.MissingDataException) { 4677 throw err; 4678 } 4679 4680 (0, _util.info)("The document information dictionary is invali
4680d."); 4681 } 4682 4683 if ((0, _primitives.isDict)(infoDict)) { 4684 for (const key of infoDict.getKeys()) { 4685 const value = infoDict.get(key); 4686 4687 if (DocumentInfoValidators[key]) { 4688 if (DocumentInfoValidators[key](value)) { 4689 docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value); 4690 } else { 4691 (0, _util.info)(`Bad value in document info for "${key}".`); 4692 } 4693 } else if (typeof key === "string") { 4694 let customValue; 4695 4696 if ((0, _util.isString)(value)) { 4697 customValue = (0, _util.stringToPDFString)(value); 4698 } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) { 4699 customValue = value; 4700 } else { 4701 (0, _util.info)(`Unsupported value in document info for (custom) "${key}".`); 4702 continue; 4703 } 4704 4705 if (!docInfo.Custom) { 4706 docInfo.Custom = Object.create(null); 4707 } 4708 4709 docInfo.Custom[key] = customValue; 4710 } 4711 } 4712 } 4713 4714 return (0, _util.shadow)(this, "documentInfo", docInfo); 4715 } 4716 4717 get fingerprints() { 4718 function validate(data) { 4719 return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT; 4720 } 4721 4722 function hexString(hash) { 4723 const buf = []; 4724 4725 for (let i = 0, ii = hash.length; i < ii; i++) { 4726 const hex = hash[i].toString(16); 4727 buf.push(hex.padStart(2, "0")); 4728 } 4729 4730 return buf.join(""); 4731 } 4732 4733 const idArray = this.xref.trailer.get("ID"); 4734 let hashOriginal, hashModified; 4735 4736 if (Array.isArray(idArray) && validate(idArray[0])) { 4737 hashOriginal = (0, _util.stringToBytes)(idArray[0]); 4738 4739 if (idArray[1] !== idArray[0] && validate(idArray[1])) { 4740 hashModified = (0, _util.stringToBytes)(idArray[1]); 4741 } 4742 } else { 4743 hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES); 4744 } 4745 4746 return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]); 4747 } 4748 4749 async _getLinearizationPage(pageIndex) { 4750 const { 4751 catalog, 4752 linearization 4753 } = this; 4754 4755 const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0); 4756 4757 try { 4758 const obj = await this.xref.fetchAsync(ref); 4759 4760 if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) { 4761 if (ref && !catalog.pageKidsCountCache.has(ref)) { 4762 catalog.pageKidsCountCache.put(ref, 1); 4763 } 4764 4765 return [obj, ref]; 4766 } 4767 4768 throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary."); 4769 } catch (reason) { 4770 (0, _util.info)(reason); 4771 return catalog.getPageDict(pageIndex); 4772 } 4773 } 4774 4775 getPage(pageIndex) { 4776 const cachedPromise = this._pagePromises.get(pageIndex); 4777 4778 if (cachedPromise) { 4779 return cachedPromise; 4780 } 4781 4782 const { 4783 catalog, 4784 linearization, 4785 xfaFactory 4786 } = this; 4787 let promise; 4788 4789 if (xfaFactory) { 4790 promise = Promise.resolve([_primitives.Dict.empty, null]); 4791 } else if (linearization && linearization.pageFirst === pageIndex) { 4792 promise = this._getLinearizationPage(pageIndex); 4793 } else { 4794 promise = catalog.getPageDict(pageIndex); 4795 } 4796 4797 promise = promise.then(([pageDict, ref]) => { 4798 return new Page({ 4799 pdfManager: this.pdfManager, 4800 xref: this.xref, 4801 pageIndex, 4802 pageDict, 4803 ref, 4804 globalIdFactory: this._globalIdFactory, 4805 fontCache: catalog.fontCache, 4806 builtInCMapCache: catalog.builtInCMapCache, 4807 standardFontDataCache: catalog.standardFontDataCache, 4808 globalImageCache: catalog.globalImageCache, 4809 nonBlendModesSet: catalog.nonBlendModesSet, 4810 xfaFactory 4811 }); 4812 }); 4813 4814 this._pagePromises.set(pageIndex, promise); 4815 4816 return promise; 4817 } 4818 4819 async checkFirstPage(recoveryMode = false) { 4820 if (recoveryMode) { 4821 return; 4822 } 4823 4824 try { 4825 await this.getPage(0); 4826 } catch (reason) { 4827 if (reason instanceof _core_utils.XRefEntryException) { 4828 this._pagePromises.delete(0); 4829 4830 await this.cleanup(); 4831 throw new _core_utils.XRefParseException(); 4832 } 4833 } 4834 } 4835 4836 async checkLastPage(recoveryMode = false) { 4837 const { 4838 catalog, 4839 pdfManager 4840 } = this; 4841 catalog.setActualNumPages(); 4842 let numPages; 4843 4844 try { 4845 await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]); 4846 4847 if (this.xfaFactory) { 4848 return; 4849 } else if (this.linearization) { 4850 numPages = this.linearization.numPages; 4851 } else { 4852 numPages = catalog.numPages; 4853 } 4854 4855 if (!Number.isInteger(numPages)) { 4856 throw new _util.FormatError("Page count is not an integer."); 4857 } else if (numPages <= 1) { 4858 return; 4859 } 4860 4861 await this.getPage(numPages - 1); 4862 } catch (reason) { 4863 this._pagePromises.delete(numPages - 1); 4864 4865 await this.cleanup(); 4866 4867 if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) { 4868 throw new _core_utils.XRefParseException(); 4869 } 4870 4871 (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`); 4872 let pagesTree; 4873
4874 try { 4875 pagesTree = await pdfManager.ensureCatalog("getAllPageDicts", [recoveryMode]); 4876 } catch (reasonAll) { 4877 if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) { 4878 throw new _core_utils.XRefParseException(); 4879 } 4880 4881 catalog.setActualNumPages(1); 4882 return; 4883 } 4884 4885 for (const [pageIndex, [pageDict, ref]] of pagesTree) { 4886 let promise; 4887 4888 if (pageDict instanceof Error) { 4889 promise = Promise.reject(pageDict); 4890 promise.catch(() => {}); 4891 } else { 4892 promise = Promise.resolve(new Page({ 4893 pdfManager, 4894 xref: this.xref, 4895 pageIndex, 4896 pageDict, 4897 ref, 4898 globalIdFactory: this._globalIdFactory, 4899 fontCache: catalog.fontCache, 4900 builtInCMapCache: catalog.builtInCMapCache, 4901 standardFontDataCache: catalog.standardFontDataCache, 4902 globalImageCache: catalog.globalImageCache, 4903 nonBlendModesSet: catalog.nonBlendModesSet, 4904 xfaFactory: null 4905 })); 4906 } 4907 4908 this._pagePromises.set(pageIndex, promise); 4909 } 4910 4911 catalog.setActualNumPages(pagesTree.size); 4912 } 4913 } 4914 4915 fontFallback(id, handler) { 4916 return this.catalog.fontFallback(id, handler); 4917 } 4918 4919 async cleanup(manuallyTriggered = false) { 4920 return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)(); 4921 } 4922 4923 _collectFieldObjects(name, fieldRef, promises) { 4924 const field = this.xref.fetchIfRef(fieldRef); 4925 4926 if (field.has("T")) { 4927 const partName = (0, _util.stringToPDFString)(field.get("T")); 4928 4929 if (name === "") { 4930 name = partName; 4931 } else { 4932 name = `${name}.${partName}`; 4933 } 4934 } 4935 4936 if (!promises.has(name)) { 4937 promises.set(name, []); 4938 } 4939 4940 promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) { 4941 (0, _util.warn)(`_collectFieldObjects: "${reason}".`); 4942 return null; 4943 })); 4944 4945 if (field.has("Kids")) { 4946 const kids = field.get("Kids"); 4947 4948 for (const kid of kids) { 4949 this._collectFieldObjects(name, kid, promises); 4950 } 4951 } 4952 } 4953 4954 get fieldObjects() { 4955 if (!this.formInfo.hasFields) { 4956 return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null)); 4957 } 4958 4959 const allFields = Object.create(null); 4960 const fieldPromises = new Map(); 4961 4962 for (const fieldRef of this.catalog.acroForm.get("Fields")) { 4963 this._collectFieldObjects("", fieldRef, fieldPromises); 4964 } 4965 4966 const allPromises = []; 4967 4968 for (const [name, promises] of fieldPromises) { 4969 allPromises.push(Promise.all(promises).then(fields => { 4970 fields = fields.filter(field => !!field); 4971 4972 if (fields.length > 0) { 4973 allFields[name] = fields; 4974 } 4975 })); 4976 } 4977 4978 return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields)); 4979 } 4980 4981 get hasJSActions() { 4982 const promise = this.pdfManager.ensureDoc("_parseHasJSActions"); 4983 return (0, _util.shadow)(this, "hasJSActions", promise); 4984 } 4985 4986 async _parseHasJSActions() { 4987 const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]); 4988 4989 if (catalogJsActions) { 4990 return true; 4991 } 4992 4993 if (fieldObjects) { 4994 return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null)); 4995 } 4996 4997 return false; 4998 } 4999 5000 get calculationOrderIds() { 5001 const acroForm = this.catalog.acroForm; 5002 5003 if (!acroForm || !acroForm.has("CO")) { 5004 return (0, _util.shadow)(this, "calculationOrderIds", null); 5005 } 5006 5007 const calculationOrder = acroForm.get("CO"); 5008 5009 if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) { 5010 return (0, _util.shadow)(this, "calculationOrderIds", null); 5011 } 5012 5013 const ids = calculationOrder.filter(_primitives.isRef).map(ref => ref.toString()); 5014 5015 if (ids.length === 0) { 5016 return (0, _util.shadow)(this, "calculationOrderIds", null); 5017 } 5018 5019 return (0, _util.shadow)(this, "calculationOrderIds", ids); 5020 } 5021 5022} 5023 5024exports.PDFDocument = PDFDocument; 5025 5026/***/ }), 5027/* 12 */ 5028/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 5029 5030 5031 5032Object.defineProperty(exports, "__esModule", ({ 5033 value: true 5034})); 5035exports.getXfaFontDict = getXfaFontDict; 5036exports.getXfaFontName = getXfaFontName; 5037 5038var _calibri_factors = __w_pdfjs_require__(13); 5039 5040var _primitives = __w_pdfjs_require__(5); 5041 5042var _helvetica_factors = __w_pdfjs_require__(14); 5043 5044var _liberationsans_widths = __w_pdfjs_require__(15); 5045 5046var _myriadpro_factors = __w_pdfjs_require__(16); 5047 5048var _segoeui_factors = __w_pdfjs_require__(17); 5049 5050var _core_utils = __w_pdfjs_require__(9); 5051 5052var _fonts_utils = __w_pdfjs_require__(18); 5053 5054const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 5055 t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = { 5056 name: "LiberationSans-Regular", 5057 factors: _myriadpro_factors.MyriadProRegularFactors, 5058 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 5059 baseMapping: _liberationsans_widths.LiberationSansRegularMapping, 5060 metrics: _myriadpro_factors.MyriadProRegularMetrics 5061 }; 5062 t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = { 5063 name: "LiberationSans-Bold", 5064 factors: _myriadpro_factors.MyriadProBoldFactors, 5065 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 5066 baseMapping: _liberationsans_widths.LiberationSansBoldMapping, 5067 metrics: _myriadpro_factors.MyriadProBoldMetrics 5068 }; 5069 t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = { 5070 name: "LiberationSans-Italic", 5071 factors: _myriadpro_factors.MyriadProItalicFactors, 5072 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 5073 baseMapping: _liberationsans_widths.LiberationSansItalicMapping, 5074 metrics: _myriadpro_factors.MyriadProItalicMetrics 5075 }; 5076 t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = { 5077 name: "LiberationSans-BoldItalic", 5078 factors: _myriadpro_factors.MyriadProBoldItalicFactors, 5079 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 5080 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping, 5081 metrics: _myriadpro_factors.MyriadProBoldItalicMetrics 5082 }; 5083 t.ArialMT = t.Arial = t["Arial-Regular"] = { 5084 name: "LiberationSans-Regular", 5085 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 5086 baseMapping: _liberationsans_widths.LiberationSansRegularMapping 5087 };
5088 t["Arial-BoldMT"] = t["Arial-Bold"] = { 5089 name: "LiberationSans-Bold", 5090 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 5091 baseMapping: _liberationsans_widths.LiberationSansBoldMapping 5092 }; 5093 t["Arial-ItalicMT"] = t["Arial-Italic"] = { 5094 name: "LiberationSans-Italic", 5095 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 5096 baseMapping: _liberationsans_widths.LiberationSansItalicMapping 5097 }; 5098 t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = { 5099 name: "LiberationSans-BoldItalic", 5100 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 5101 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping 5102 }; 5103 t["Calibri-Regular"] = { 5104 name: "LiberationSans-Regular", 5105 factors: _calibri_factors.CalibriRegularFactors, 5106 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 5107 baseMapping: _liberationsans_widths.LiberationSansRegularMapping, 5108 metrics: _calibri_factors.CalibriRegularMetrics 5109 }; 5110 t["Calibri-Bold"] = { 5111 name: "LiberationSans-Bold", 5112 factors: _calibri_factors.CalibriBoldFactors, 5113 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 5114 baseMapping: _liberationsans_widths.LiberationSansBoldMapping, 5115 metrics: _calibri_factors.CalibriBoldMetrics 5116 }; 5117 t["Calibri-Italic"] = { 5118 name: "LiberationSans-Italic", 5119 factors: _calibri_factors.CalibriItalicFactors, 5120 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 5121 baseMapping: _liberationsans_widths.LiberationSansItalicMapping, 5122 metrics: _calibri_factors.CalibriItalicMetrics 5123 }; 5124 t["Calibri-BoldItalic"] = { 5125 name: "LiberationSans-BoldItalic", 5126 factors: _calibri_factors.CalibriBoldItalicFactors, 5127 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 5128 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping, 5129 metrics: _calibri_factors.CalibriBoldItalicMetrics 5130 }; 5131 t["Segoeui-Regular"] = { 5132 name: "LiberationSans-Regular", 5133 factors: _segoeui_factors.SegoeuiRegularFactors, 5134 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 5135 baseMapping: _liberationsans_widths.LiberationSansRegularMapping, 5136 metrics: _segoeui_factors.SegoeuiRegularMetrics 5137 }; 5138 t["Segoeui-Bold"] = { 5139 name: "LiberationSans-Bold", 5140 factors: _segoeui_factors.SegoeuiBoldFactors, 5141 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 5142 baseMapping: _liberationsans_widths.LiberationSansBoldMapping, 5143 metrics: _segoeui_factors.SegoeuiBoldMetrics 5144 }; 5145 t["Segoeui-Italic"] = { 5146 name: "LiberationSans-Italic", 5147 factors: _segoeui_factors.SegoeuiItalicFactors, 5148 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 5149 baseMapping: _liberationsans_widths.LiberationSansItalicMapping, 5150 metrics: _segoeui_factors.SegoeuiItalicMetrics 5151 }; 5152 t["Segoeui-BoldItalic"] = { 5153 name: "LiberationSans-BoldItalic", 5154 factors: _segoeui_factors.SegoeuiBoldItalicFactors, 5155 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 5156 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping, 5157 metrics: _segoeui_factors.SegoeuiBoldItalicMetrics 5158 }; 5159 t["Helvetica-Regular"] = t.Helvetica = { 5160 name: "LiberationSans-Regular", 5161 factors: _helvetica_factors.HelveticaRegularFactors, 5162 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 5163 baseMapping: _liberationsans_widths.LiberationSansRegularMapping, 5164 metrics: _helvetica_factors.HelveticaRegularMetrics 5165 }; 5166 t["Helvetica-Bold"] = { 5167 name: "LiberationSans-Bold", 5168 factors: _helvetica_factors.HelveticaBoldFactors, 5169 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 5170 baseMapping: _liberationsans_widths.LiberationSansBoldMapping, 5171 metrics: _helvetica_factors.HelveticaBoldMetrics 5172 }; 5173 t["Helvetica-Italic"] = { 5174 name: "LiberationSans-Italic", 5175 factors: _helvetica_factors.HelveticaItalicFactors, 5176 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 5177 baseMapping: _liberationsans_widths.LiberationSansItalicMapping, 5178 metrics: _helvetica_factors.HelveticaItalicMetrics 5179 }; 5180 t["Helvetica-BoldItalic"] = { 5181 name: "LiberationSans-BoldItalic",
5182 factors: _helvetica_factors.HelveticaBoldItalicFactors, 5183 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 5184 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping, 5185 metrics: _helvetica_factors.HelveticaBoldItalicMetrics 5186 }; 5187}); 5188 5189function getXfaFontName(name) { 5190 const fontName = (0, _fonts_utils.normalizeFontName)(name); 5191 const fontMap = getXFAFontMap(); 5192 return fontMap[fontName]; 5193} 5194 5195function getXfaFontWidths(name) { 5196 const info = getXfaFontName(name); 5197 5198 if (!info) { 5199 return null; 5200 } 5201 5202 const { 5203 baseWidths, 5204 baseMapping, 5205 factors 5206 } = info; 5207 let rescaledBaseWidths; 5208 5209 if (!factors) { 5210 rescaledBaseWidths = baseWidths; 5211 } else { 5212 rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]); 5213 } 5214 5215 let currentCode = -2; 5216 let currentArray; 5217 const newWidths = []; 5218 5219 for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) { 5220 if (unicode === -1) { 5221 continue; 5222 } 5223 5224 if (unicode === currentCode + 1) { 5225 currentArray.push(rescaledBaseWidths[glyphIndex]); 5226 currentCode += 1; 5227 } else { 5228 currentCode = unicode; 5229 currentArray = [rescaledBaseWidths[glyphIndex]]; 5230 newWidths.push(unicode, currentArray); 5231 } 5232 } 5233 5234 return newWidths; 5235} 5236 5237function getXfaFontDict(name) { 5238 const widths = getXfaFontWidths(name); 5239 const dict = new _primitives.Dict(null); 5240 dict.set("BaseFont", _primitives.Name.get(name)); 5241 dict.set("Type", _primitives.Name.get("Font")); 5242 dict.set("Subtype", _primitives.Name.get("CIDFontType2")); 5243 dict.set("Encoding", _primitives.Name.get("Identity-H")); 5244 dict.set("CIDToGIDMap", _primitives.Name.get("Identity")); 5245 dict.set("W", widths); 5246 dict.set("FirstChar", widths[0]); 5247 dict.set("LastChar", widths[widths.length - 2] + widths[widths.length - 1].length - 1); 5248 const descriptor = new _primitives.Dict(null); 5249 dict.set("FontDescriptor", descriptor); 5250 const systemInfo = new _primitives.Dict(null); 5251 systemInfo.set("Ordering", "Identity"); 5252 systemInfo.set("Registry", "Adobe"); 5253 systemInfo.set("Supplement", 0); 5254 dict.set("CIDSystemInfo", systemInfo); 5255 return dict; 5256} 5257 5258/***/ }), 5259/* 13 */ 5260/***/ ((__unused_webpack_module, exports) => { 5261 5262 5263 5264Object.defineProperty(exports, "__esModule", ({ 5265 value: true 5266})); 5267exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
vendor: 4,837 bytes, lines 5267-5268
5267 5268const 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, 0.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];
5269exports.CalibriBoldFactors = CalibriBoldFactors; 5270const CalibriBoldMetrics = { 5271 lineHeight: 1.2207, 5272 lineGap: 0.2207 5273}; 5274exports.CalibriBoldMetrics = CalibriBoldMetrics
vendor: 4,884 bytes, lines 5274-5275
5274; 5275const 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];
5276exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors; 5277const CalibriBoldItalicMetrics = { 5278 lineHeight: 1.2207, 5279 lineGap: 0.2207 5280}; 5281exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics
vendor: 4,805 bytes, lines 5281-5282
5281; 5282const 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, 0.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.0176, 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];
5283exports.CalibriItalicFactors = CalibriItalicFactors; 5284const CalibriItalicMetrics = { 5285 lineHeight: 1.2207, 5286 lineGap: 0.2207 5287}; 5288exports.CalibriItalicMetrics = CalibriItalicMetrics
vendor: 4,863 bytes, lines 5288-5289
5288; 5289const 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, 0.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];
5290exports.CalibriRegularFactors = CalibriRegularFactors; 5291const CalibriRegularMetrics = { 5292 lineHeight: 1.2207, 5293 lineGap: 0.2207 5294}; 5295exports.CalibriRegularMetrics = CalibriRegularMetrics; 5296 5297/***/ }), 5298/* 14 */ 5299/***/ ((__unused_webpack_module, exports) => { 5300 5301 5302 5303Object.defineProperty(exports, "__esModule", ({ 5304 value: true 5305})); 5306exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0; 5307const 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];
5308exports.HelveticaBoldFactors = HelveticaBoldFactors; 5309const HelveticaBoldMetrics = { 5310 lineHeight: 1.2, 5311 lineGap: 0.2 5312}; 5313exports.HelveticaBoldMetrics = HelveticaBoldMetrics; 5314const 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];
5315exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors; 5316const HelveticaBoldItalicMetrics = { 5317 lineHeight: 1.35, 5318 lineGap: 0.2 5319}; 5320exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics; 5321const 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]; 5322exports.HelveticaItalicFactors = HelveticaItalicFactors; 5323const HelveticaItalicMetrics = { 5324 lineHeight: 1.35, 5325 lineGap: 0.2 5326}; 5327exports.HelveticaItalicMetrics = HelveticaItalicMetrics; 5328const 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,
53281.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]; 5329exports.HelveticaRegularFactors = HelveticaRegularFactors; 5330const HelveticaRegularMetrics = { 5331 lineHeight: 1.2, 5332 lineGap: 0.2 5333}; 5334exports.HelveticaRegularMetrics = HelveticaRegularMetrics; 5335 5336/***/ }), 5337/* 15 */ 5338/***/ ((__unused_webpack_module, exports) => { 5339 5340 5341 5342Object.defineProperty(exports, "__esModule", ({ 5343 value: true 5344})); 5345exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0; 5346const 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,
5346604, 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]; 5347exports.LiberationSansBoldWidths = LiberationSansBoldWidths; 5348const 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]; 5349exports.LiberationSansBoldMapping = LiberationSansBoldMapping; 5350const 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, 66
53507, 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]; 5351exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths; 5352const 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]; 5353exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping; 5354const LiberationSansItalicWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889,
5354667, 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]; 5355exports.LiberationSansItalicWidths = LiberationSansItalicWidths; 5356const 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]; 5357exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
5358const 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]; 5359exports.LiberationSansRegularWidths = LiberationSansRegularWidths; 5360const 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]; 5361exports.LiberationSansRegularMapping = LiberationSansRegularMapping; 5362 5363/***/ }), 5364/* 16 */
5365/***/ ((__unused_webpack_module, exports) => { 5366 5367 5368 5369Object.defineProperty(exports, "__esModule", ({ 5370 value: true 5371})); 5372exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0; 5373const 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]; 5374exports.MyriadProBoldFactors = MyriadProBoldFactors; 5375const MyriadProBoldMetrics = { 5376 lineHeight: 1.2, 5377 lineGap: 0.2 5378}; 5379exports.MyriadProBoldMetrics = MyriadProBoldMetrics
vendor: 4,577 bytes, lines 5379-5380
5379; 5380const 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.98621, 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.91677, 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];
5381exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors; 5382const MyriadProBoldItalicMetrics = { 5383 lineHeight: 1.2, 5384 lineGap: 0.2 5385}; 5386exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics; 5387const 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,
53871, 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]; 5388exports.MyriadProItalicFactors = MyriadProItalicFactors; 5389const MyriadProItalicMetrics = { 5390 lineHeight: 1.2, 5391 lineGap: 0.2 5392}; 5393exports.MyriadProItalicMetrics = MyriadProItalicMetrics; 5394const 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,
53941.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]; 5395exports.MyriadProRegularFactors = MyriadProRegularFactors; 5396const MyriadProRegularMetrics = { 5397 lineHeight: 1.2, 5398 lineGap: 0.2 5399}; 5400exports.MyriadProRegularMetrics = MyriadProRegularMetrics; 5401 5402/***/ }), 5403/* 17 */ 5404/***/ ((__unused_webpack_module, exports) => { 5405 5406 5407 5408Object.defineProperty(exports, "__esModule", ({ 5409 value: true 5410})); 5411exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0; 5412const 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]; 5413exports.SegoeuiBoldFactors = SegoeuiBoldFactors; 5414const SegoeuiBoldMetrics = { 5415 lineHeight: 1.33008, 5416 lineGap: 0 5417}; 5418exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics; 5419const 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,
54191.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]; 5420exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors; 5421const SegoeuiBoldItalicMetrics = { 5422 lineHeight: 1.33008, 5423 lineGap: 0 5424}; 5425exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics; 5426const 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,
54260.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]; 5427exports.SegoeuiItalicFactors = SegoeuiItalicFactors; 5428const SegoeuiItalicMetrics = { 5429 lineHeight: 1.33008, 5430 lineGap: 0 5431}; 5432exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics; 5433const 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,
54330.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]; 5434exports.SegoeuiRegularFactors = SegoeuiRegularFactors; 5435const SegoeuiRegularMetrics = { 5436 lineHeight: 1.33008, 5437 lineGap: 0 5438}; 5439exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics; 5440 5441/***/ }), 5442/* 18 */ 5443/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 5444 5445 5446 5447Object.defineProperty(exports, "__esModule", ({ 5448 value: true 5449})); 5450exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0; 5451exports.getFontType = getFontType; 5452exports.normalizeFontName = normalizeFontName; 5453exports.recoverGlyphName = recoverGlyphName; 5454exports.type1FontGlyphMapping = type1FontGlyphMapping; 5455 5456var _util = __w_pdfjs_require__(2); 5457 5458var _encodings = __w_pdfjs_require__(19); 5459 5460var _glyphlist = __w_pdfjs_require__(20); 5461 5462var _unicode = __w_pdfjs_require__(21); 5463 5464const SEAC_ANALYSIS_ENABLED = true; 5465exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED; 5466const FontFlags = { 5467 FixedPitch: 1, 5468 Serif: 2, 5469 Symbolic: 4, 5470 Script: 8, 5471 Nonsymbolic: 32, 5472 Italic: 64, 5473 AllCap: 65536, 5474 SmallCap: 131072, 5475 ForceBold: 262144 5476}; 5477exports.FontFlags = FontFlags; 5478const 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", "periodce
5478ntered", "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"]; 5479exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering; 5480 5481function getFontType(type, subtype, isStandardFont = false) { 5482 switch (type) { 5483 case "Type1": 5484 if (isStandardFont) { 5485 return _util.FontType.TYPE1STANDARD; 5486 } 5487 5488 return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1; 5489 5490 case "CIDFontType0": 5491 return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0; 5492 5493 case "OpenType": 5494 return _util.FontType.OPENTYPE; 5495 5496 case "TrueType": 5497 return _util.FontType.TRUETYPE; 5498 5499 case "CIDFontType2": 5500 return _util.FontType.CIDFONTTYPE2; 5501 5502 case "MMType1": 5503 return _util.FontType.MMTYPE1; 5504 5505 case "Type0": 5506 return _util.FontType.TYPE0; 5507 5508 default: 5509 return _util.FontType.UNKNOWN; 5510 } 5511} 5512 5513function recoverGlyphName(name, glyphsUnicodeMap) { 5514 if (glyphsUnicodeMap[name] !== undefined) { 5515 return name; 5516 } 5517 5518 const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap); 5519 5520 if (unicode !== -1) { 5521 for (const key in glyphsUnicodeMap) { 5522 if (glyphsUnicodeMap[key] === unicode) { 5523 return key; 5524 } 5525 } 5526 } 5527 5528 (0, _util.info)("Unable to recover a standard glyph name for: " + name); 5529 return name; 5530} 5531 5532function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { 5533 const charCodeToGlyphId = Object.create(null); 5534 let glyphId, charCode, baseEncoding; 5535 const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 5536 5537 if (properties.isInternalFont) { 5538 baseEncoding = builtInEncoding; 5539 5540 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 5541 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 5542 5543 if (glyphId >= 0) { 5544 charCodeToGlyphId[charCode] = glyphId; 5545 } else { 5546 charCodeToGlyphId[charCode] = 0; 5547 } 5548 } 5549 } else if (properties.baseEncodingName) { 5550 baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName); 5551 5552 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 5553 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 5554 5555 if (glyphId >= 0) { 5556 charCodeToGlyphId[charCode] = glyphId; 5557 } else { 5558 charCodeToGlyphId[charCode] = 0; 5559 } 5560 } 5561 } else if (isSymbolicFont) { 5562 for (charCode in builtInEncoding) { 5563 charCodeToGlyphId[charCode] = builtInEncoding[charCode]; 5564 } 5565 } else { 5566 baseEncoding = _encodings.StandardEncoding; 5567 5568 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 5569 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 5570 5571 if (glyphId >= 0) { 5572 charCodeToGlyphId[charCode] = glyphId; 5573 } else { 5574 charCodeToGlyphId[charCode] = 0; 5575 } 5576 } 5577 } 5578 5579 const differences = properties.differences; 5580 let glyphsUnicodeMap; 5581 5582 if (differences) { 5583 for (charCode in differences) { 5584 const glyphName = differences[charCode]; 5585 glyphId = glyphNames.indexOf(glyphName); 5586 5587 if (glyphId === -1) { 5588 if (!glyphsUnicodeMap) { 5589 glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 5590 } 5591 5592 const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); 5593 5594 if (standardGlyphName !== glyphName) { 5595 glyphId = glyphNames.indexOf(standardGlyphName); 5596 } 5597 } 5598 5599 if (glyphId >= 0) { 5600 charCodeToGlyphId[charCode] = glyphId; 5601 } else { 5602 charCodeToGlyphId[charCode] = 0; 5603 } 5604 } 5605 } 5606 5607 return charCodeToGlyphId; 5608} 5609 5610function normalizeFontName(name) { 5611 return name.replace(/[,_]/g, "-").replace(/\s/g, ""); 5612} 5613 5614/***/ }), 5615/* 19 */
5616/***/ ((__unused_webpack_module, exports) => { 5617 5618 5619 5620Object.defineProperty(exports, "__esModule", ({ 5621 value: true 5622})); 5623exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0; 5624exports.getEncoding = getEncoding; 5625const 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"]; 5626exports.ExpertEncoding = ExpertEncoding; 5627const 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", "", "", "", ""]; 5628const 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", "periodce
5628ntered", "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"]; 5629exports.MacRomanEncoding = MacRomanEncoding; 5630const 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", "periodce
5630ntered", "", "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", "", "", "", ""]; 5631exports.StandardEncoding = StandardEncoding; 5632const 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"]; 5633exports.WinAnsiEncoding = WinAnsiEncoding; 5634const 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", "cir
5634clemultiply", "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", ""]; 5635exports.SymbolSetEncoding = SymbolSetEncoding; 5636const 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", ""]; 5637exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding; 5638 5639function getEncoding(encodingName) { 5640 switch (encodingName) { 5641 case "WinAnsiEncoding": 5642 return WinAnsiEncoding; 5643 5644 case "StandardEncoding": 5645 return StandardEncoding; 5646 5647 case "MacRomanEncoding": 5648 return MacRomanEncoding; 5649 5650 case "SymbolSetEncoding": 5651 return SymbolSetEncoding; 5652 5653 case "ZapfDingbatsEncoding": 5654 return ZapfDingbatsEncoding; 5655 5656 case "ExpertEncoding": 5657 return ExpertEncoding; 5658 5659 case "MacExpertEncoding": 5660 return MacExpertEncoding; 5661 5662 default: 5663 return null; 5664 } 5665} 5666 5667/***/ }), 5668/* 20 */ 5669/***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => { 5670 5671__w_pdfjs_require__.r(__webpack_exports__); 5672/* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, { 5673/* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode), 5674/* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode) 5675/* harmony export */ }); 5676/* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(9); 5677 5678const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () { 5679 return [ 5680 "A", 5681 0x0041, 5682 "AE", 5683 0x00c6, 5684 "AEacute", 5685 0x01fc, 5686 "AEmacron", 5687 0x01e2, 5688 "AEsmall", 5689 0xf7e6, 5690 "Aacute", 5691 0x00c1, 5692 "Aacutesmall", 5693 0xf7e1, 5694 "Abreve", 5695 0x0102, 5696 "Abreveacute", 5697 0x1eae, 5698 "Abrevecyrillic", 5699 0x04d0, 5700 "Abrevedotbelow", 5701 0x1eb6, 5702 "Abrevegrave", 5703 0x1eb0, 5704 "Abrevehookabove", 5705 0x1eb2, 5706 "Abrevetilde", 5707 0x1eb4, 5708 "Acaron", 5709 0x01cd, 5710 "Acircle", 5711 0x24b6, 5712 "Acircumflex", 5713 0x00c2, 5714 "Acircumflexacute", 5715 0x1ea4, 5716 "Acircumflexdotbelow", 5717 0x1eac, 5718 "Acircumflexgrave", 5719 0x1ea6, 5720 "Acircumflexhookabove", 5721 0x1ea8, 5722 "Acircumflexsmall", 5723 0xf7e2, 5724 "Acircumflextilde", 5725 0x1eaa, 5726 "Acute", 5727 0xf6c9, 5728 "Acutesmall", 5729 0xf7b4, 5730 "Acyrillic", 5731 0x0410, 5732 "Adblgrave", 5733 0x0200, 5734 "Adieresis", 5735 0x00c4, 5736 "Adieresiscyrillic", 5737 0x04d2, 5738 "Adieresismacron", 5739 0x01de, 5740 "Adieresissmall", 5741 0xf7e4, 5742 "Adotbelow", 5743 0x1ea0, 5744 "Adotmacron", 5745 0x01e0, 5746 "Agrave", 5747 0x00c0, 5748 "Agravesmall", 5749 0xf7e0, 5750 "Ahookabove", 5751 0x1ea2, 5752 "Aiecyrillic", 5753 0x04d4, 5754 "Ainvertedbreve", 5755 0x0202, 5756 "Alpha", 5757 0x0391, 5758 "Alphatonos", 5759 0x0386, 5760 "Amacron", 5761 0x0100, 5762 "Amonospace", 5763 0xff21, 5764 "Aogonek",
5765 0x0104, 5766 "Aring", 5767 0x00c5, 5768 "Aringacute", 5769 0x01fa, 5770 "Aringbelow", 5771 0x1e00, 5772 "Aringsmall", 5773 0xf7e5, 5774 "Asmall", 5775 0xf761, 5776 "Atilde", 5777 0x00c3, 5778 "Atildesmall", 5779 0xf7e3, 5780 "Aybarmenian", 5781 0x0531, 5782 "B", 5783 0x0042, 5784 "Bcircle", 5785 0x24b7, 5786 "Bdotaccent", 5787 0x1e02, 5788 "Bdotbelow", 5789 0x1e04, 5790 "Becyrillic", 5791 0x0411, 5792 "Benarmenian", 5793 0x0532, 5794 "Beta", 5795 0x0392, 5796 "Bhook", 5797 0x0181, 5798 "Blinebelow", 5799 0x1e06, 5800 "Bmonospace", 5801 0xff22, 5802 "Brevesmall", 5803 0xf6f4, 5804 "Bsmall", 5805 0xf762, 5806 "Btopbar", 5807 0x0182, 5808 "C", 5809 0x0043, 5810 "Caarmenian", 5811 0x053e, 5812 "Cacute", 5813 0x0106, 5814 "Caron", 5815 0xf6ca, 5816 "Caronsmall", 5817 0xf6f5, 5818 "Ccaron", 5819 0x010c, 5820 "Ccedilla", 5821 0x00c7, 5822 "Ccedillaacute", 5823 0x1e08, 5824 "Ccedillasmall", 5825 0xf7e7, 5826 "Ccircle", 5827 0x24b8, 5828 "Ccircumflex", 5829 0x0108, 5830 "Cdot", 5831 0x010a, 5832 "Cdotaccent", 5833 0x010a, 5834 "Cedillasmall", 5835 0xf7b8, 5836 "Chaarmenian", 5837 0x0549, 5838 "Cheabkhasiancyrillic", 5839 0x04bc, 5840 "Checyrillic", 5841 0x0427, 5842 "Chedescenderabkhasiancyrillic", 5843 0x04be, 5844 "Chedescendercyrillic", 5845 0x04b6, 5846 "Chedieresiscyrillic", 5847 0x04f4, 5848 "Cheharmenian", 5849 0x0543, 5850 "Chekhakassiancyrillic", 5851 0x04cb, 5852 "Cheverticalstrokecyrillic", 5853 0x04b8, 5854 "Chi", 5855 0x03a7, 5856 "Chook", 5857 0x0187, 5858 "Circumflexsmall", 5859 0xf6f6, 5860 "Cmonospace", 5861 0xff23, 5862 "Coarmenian", 5863 0x0551, 5864 "Csmall", 5865 0xf763, 5866 "D", 5867 0x0044, 5868 "DZ", 5869 0x01f1, 5870 "DZcaron", 5871 0x01c4, 5872 "Daarmenian", 5873 0x0534, 5874 "Dafrican", 5875 0x0189, 5876 "Dcaron", 5877 0x010e, 5878 "Dcedilla", 5879 0x1e10, 5880 "Dcircle", 5881 0x24b9, 5882 "Dcircumflexbelow", 5883 0x1e12, 5884 "Dcroat", 5885 0x0110, 5886 "Ddotaccent", 5887 0x1e0a, 5888 "Ddotbelow", 5889 0x1e0c, 5890 "Decyrillic", 5891 0x0414, 5892 "Deicoptic", 5893 0x03ee, 5894 "Delta", 5895 0x2206, 5896 "Deltagreek", 5897 0x0394, 5898 "Dhook", 5899 0x018a, 5900 "Dieresis", 5901 0xf6cb, 5902 "DieresisAcute", 5903 0xf6cc, 5904 "DieresisGrave", 5905 0xf6cd, 5906 "Dieresissmall", 5907 0xf7a8, 5908 "Digammagreek", 5909 0x03dc, 5910 "Djecyrillic", 5911 0x0402, 5912 "Dlinebelow", 5913 0x1e0e, 5914 "Dmonospace", 5915 0xff24, 5916 "Dotaccentsmall", 5917 0xf6f7, 5918 "Dslash", 5919 0x0110, 5920 "Dsmall", 5921 0xf764, 5922 "Dtopbar", 5923 0x018b, 5924 "Dz", 5925 0x01f2, 5926 "Dzcaron", 5927 0x01c5, 5928 "Dzeabkhasiancyrillic", 5929 0x04e0, 5930 "Dzecyrillic", 5931 0x0405, 5932 "Dzhecyrillic", 5933 0x040f, 5934 "E", 5935 0x0045, 5936 "Eacute", 5937 0x00c9, 5938 "Eacutesmall", 5939 0xf7e9, 5940 "Ebreve", 5941 0x0114, 5942 "Ecaron", 5943 0x011a, 5944 "Ecedillabreve", 5945 0x1e1c, 5946 "Echarmenian", 5947 0x0535, 5948 "Ecircle", 5949 0x24ba, 5950 "Ecircumflex", 5951 0x00ca, 5952 "Ecircumflexacute", 5953 0x1ebe, 5954 "Ecircumflexbelow", 5955 0x1e18, 5956 "Ecircumflexdotbelow", 5957 0x1ec6, 5958 "Ecircumflexgrave", 5959 0x1ec0, 5960 "Ecircumflexhookabove", 5961 0x1ec2, 5962 "Ecircumflexsmall", 5963 0xf7ea, 5964 "Ecircumflextilde", 5965 0x1ec4, 5966 "Ecyrillic", 5967 0x0404, 5968 "Edblgrave", 5969 0x0204, 5970 "Edieresis", 5971 0x00cb, 5972 "Edieresissmall", 5973 0xf7eb, 5974 "Edot", 5975 0x0116, 5976 "Edotaccent", 5977 0x0116, 5978 "Edotbelow", 5979 0x1eb8, 5980 "Efcyrillic", 5981 0x0424, 5982 "Egrave", 5983 0x00c8, 5984 "Egravesmall", 5985 0xf7e8, 5986 "Eharmenian", 5987 0x0537, 5988 "Ehookabove", 5989 0x1eba, 5990 "Eightroman", 5991 0x2167, 5992 "Einvertedbreve", 5993 0x0206, 5994 "Eiotifiedcyrillic", 5995 0x0464, 5996 "Elcyrillic", 5997 0x041b, 5998 "Elevenroman", 5999 0x216a, 6000 "Emacron", 6001 0x0112, 6002 "Emacronacute", 6003 0x1e16, 6004 "Emacrongrave", 6005 0x1e14, 6006 "Emcyrillic", 6007 0x041c, 6008 "Emonospace", 6009 0xff25, 6010 "Encyrillic", 6011 0x041d, 6012 "Endescendercyrillic", 6013 0x04a2, 6014 "Eng", 6015 0x014a, 6016 "Enghecyrillic", 6017 0x04a4, 6018 "Enhookcyrillic", 6019 0x04c7, 6020 "Eogonek", 6021 0x0118, 6022 "Eopen", 6023 0x0190, 6024 "Epsilon", 6025 0x0395, 6026 "Epsilontonos", 6027 0x0388, 6028 "Ercyrillic", 6029 0x0420, 6030 "Ereversed", 6031 0x018e, 6032 "Ereversedcyrillic", 6033 0x042d, 6034 "Escyrillic", 6035 0x0421, 6036 "Esdescendercyrillic", 6037 0x04aa, 6038 "Esh", 6039 0x01a9, 6040 "Esmall", 6041 0xf765, 6042 "Eta", 6043 0x0397, 6044 "Etarmenian", 6045 0x0538, 6046 "Etatonos", 6047 0x0389, 6048 "Eth", 6049 0x00d0, 6050 "Ethsmall", 6051 0xf7f0, 6052 "Etilde", 6053 0x1ebc, 6054 "Etildebelow", 6055 0x1e1a, 6056 "Euro", 6057 0x20ac, 6058 "Ezh", 6059 0x01b7, 6060 "Ezhcaron", 6061 0x01ee, 6062 "Ezhreversed", 6063 0x01b8, 6064 "F", 6065 0x0046, 6066 "Fcircle", 6067 0x24bb, 6068 "Fdotaccent", 6069 0x1e1e, 6070 "Feharmenian", 6071 0x0556, 6072 "Feicoptic", 6073 0x03e4, 6074 "Fhook", 6075 0x0191, 6076 "Fitacyrillic", 6077 0x0472, 6078 "Fiveroman", 6079 0x2164, 6080 "Fmonospace", 6081 0xff26, 6082 "Fourroman", 6083 0x2163, 6084 "Fsmall", 6085 0xf766, 6086 "G", 6087 0x0047, 6088 "GBsquare", 6089 0x3387, 6090 "Gacute", 6091 0x01f4, 6092 "Gamma", 6093 0x0393, 6094 "Gammaafrican", 6095 0x0194, 6096 "Gangiacoptic", 6097 0x03ea, 6098 "Gbreve", 6099 0x011e, 6100 "Gcaron", 6101 0x01e6, 6102 "Gcedilla", 6103 0x0122, 6104 "Gcircle", 6105 0x24bc, 6106 "Gcircumflex", 6107 0x011c, 6108 "Gcommaaccent", 6109 0x0122, 6110 "Gdot", 6111 0x0120, 6112 "Gdotaccent", 6113 0x0120, 6114 "Gecyrillic", 6115 0x0413, 6116 "Ghadarmenian", 6117 0x0542, 6118 "Ghemiddlehookcyrillic", 6119 0x0494, 6120 "Ghestrokecyrillic", 6121 0x0492,
6122 "Gheupturncyrillic", 6123 0x0490, 6124 "Ghook", 6125 0x0193, 6126 "Gimarmenian", 6127 0x0533, 6128 "Gjecyrillic", 6129 0x0403, 6130 "Gmacron", 6131 0x1e20, 6132 "Gmonospace", 6133 0xff27, 6134 "Grave", 6135 0xf6ce, 6136 "Gravesmall", 6137 0xf760, 6138 "Gsmall", 6139 0xf767, 6140 "Gsmallhook", 6141 0x029b, 6142 "Gstroke", 6143 0x01e4, 6144 "H", 6145 0x0048, 6146 "H18533", 6147 0x25cf, 6148 "H18543", 6149 0x25aa, 6150 "H18551", 6151 0x25ab, 6152 "H22073", 6153 0x25a1, 6154 "HPsquare", 6155 0x33cb, 6156 "Haabkhasiancyrillic", 6157 0x04a8, 6158 "Hadescendercyrillic", 6159 0x04b2, 6160 "Hardsigncyrillic", 6161 0x042a, 6162 "Hbar", 6163 0x0126, 6164 "Hbrevebelow", 6165 0x1e2a, 6166 "Hcedilla", 6167 0x1e28, 6168 "Hcircle", 6169 0x24bd, 6170 "Hcircumflex", 6171 0x0124, 6172 "Hdieresis", 6173 0x1e26, 6174 "Hdotaccent", 6175 0x1e22, 6176 "Hdotbelow", 6177 0x1e24, 6178 "Hmonospace", 6179 0xff28, 6180 "Hoarmenian", 6181 0x0540, 6182 "Horicoptic", 6183 0x03e8, 6184 "Hsmall", 6185 0xf768, 6186 "Hungarumlaut", 6187 0xf6cf, 6188 "Hungarumlautsmall", 6189 0xf6f8, 6190 "Hzsquare", 6191 0x3390, 6192 "I", 6193 0x0049, 6194 "IAcyrillic", 6195 0x042f, 6196 "IJ", 6197 0x0132, 6198 "IUcyrillic", 6199 0x042e, 6200 "Iacute", 6201 0x00cd, 6202 "Iacutesmall", 6203 0xf7ed, 6204 "Ibreve", 6205 0x012c, 6206 "Icaron", 6207 0x01cf, 6208 "Icircle", 6209 0x24be, 6210 "Icircumflex", 6211 0x00ce, 6212 "Icircumflexsmall", 6213 0xf7ee, 6214 "Icyrillic", 6215 0x0406, 6216 "Idblgrave", 6217 0x0208, 6218 "Idieresis", 6219 0x00cf, 6220 "Idieresisacute", 6221 0x1e2e, 6222 "Idieresiscyrillic", 6223 0x04e4, 6224 "Idieresissmall", 6225 0xf7ef, 6226 "Idot", 6227 0x0130, 6228 "Idotaccent", 6229 0x0130, 6230 "Idotbelow", 6231 0x1eca, 6232 "Iebrevecyrillic", 6233 0x04d6, 6234 "Iecyrillic", 6235 0x0415, 6236 "Ifraktur", 6237 0x2111, 6238 "Igrave", 6239 0x00cc, 6240 "Igravesmall", 6241 0xf7ec, 6242 "Ihookabove", 6243 0x1ec8, 6244 "Iicyrillic", 6245 0x0418, 6246 "Iinvertedbreve", 6247 0x020a, 6248 "Iishortcyrillic", 6249 0x0419, 6250 "Imacron", 6251 0x012a, 6252 "Imacroncyrillic", 6253 0x04e2, 6254 "Imonospace", 6255 0xff29, 6256 "Iniarmenian", 6257 0x053b, 6258 "Iocyrillic", 6259 0x0401, 6260 "Iogonek", 6261 0x012e, 6262 "Iota", 6263 0x0399, 6264 "Iotaafrican", 6265 0x0196, 6266 "Iotadieresis", 6267 0x03aa, 6268 "Iotatonos", 6269 0x038a, 6270 "Ismall", 6271 0xf769, 6272 "Istroke", 6273 0x0197, 6274 "Itilde", 6275 0x0128, 6276 "Itildebelow", 6277 0x1e2c, 6278 "Izhitsacyrillic", 6279 0x0474, 6280 "Izhitsadblgravecyrillic", 6281 0x0476, 6282 "J", 6283 0x004a, 6284 "Jaarmenian", 6285 0x0541, 6286 "Jcircle", 6287 0x24bf, 6288 "Jcircumflex", 6289 0x0134, 6290 "Jecyrillic", 6291 0x0408, 6292 "Jheharmenian", 6293 0x054b, 6294 "Jmonospace", 6295 0xff2a, 6296 "Jsmall", 6297 0xf76a, 6298 "K", 6299 0x004b, 6300 "KBsquare", 6301 0x3385, 6302 "KKsquare", 6303 0x33cd, 6304 "Kabashkircyrillic", 6305 0x04a0, 6306 "Kacute", 6307 0x1e30, 6308 "Kacyrillic", 6309 0x041a, 6310 "Kadescendercyrillic", 6311 0x049a, 6312 "Kahookcyrillic", 6313 0x04c3, 6314 "Kappa", 6315 0x039a, 6316 "Kastrokecyrillic", 6317 0x049e, 6318 "Kaverticalstrokecyrillic", 6319 0x049c, 6320 "Kcaron", 6321 0x01e8, 6322 "Kcedilla", 6323 0x0136, 6324 "Kcircle", 6325 0x24c0, 6326 "Kcommaaccent", 6327 0x0136, 6328 "Kdotbelow", 6329 0x1e32, 6330 "Keharmenian", 6331 0x0554, 6332 "Kenarmenian", 6333 0x053f, 6334 "Khacyrillic", 6335 0x0425, 6336 "Kheicoptic", 6337 0x03e6, 6338 "Khook", 6339 0x0198, 6340 "Kjecyrillic", 6341 0x040c, 6342 "Klinebelow", 6343 0x1e34, 6344 "Kmonospace", 6345 0xff2b, 6346 "Koppacyrillic", 6347 0x0480, 6348 "Koppagreek", 6349 0x03de, 6350 "Ksicyrillic", 6351 0x046e, 6352 "Ksmall", 6353 0xf76b, 6354 "L", 6355 0x004c, 6356 "LJ", 6357 0x01c7, 6358 "LL", 6359 0xf6bf, 6360 "Lacute", 6361 0x0139, 6362 "Lambda", 6363 0x039b, 6364 "Lcaron", 6365 0x013d, 6366 "Lcedilla", 6367 0x013b, 6368 "Lcircle", 6369 0x24c1, 6370 "Lcircumflexbelow", 6371 0x1e3c, 6372 "Lcommaaccent", 6373 0x013b, 6374 "Ldot", 6375 0x013f, 6376 "Ldotaccent", 6377 0x013f, 6378 "Ldotbelow", 6379 0x1e36, 6380 "Ldotbelowmacron", 6381 0x1e38, 6382 "Liwnarmenian", 6383 0x053c, 6384 "Lj", 6385 0x01c8, 6386 "Ljecyrillic", 6387 0x0409, 6388 "Llinebelow", 6389 0x1e3a, 6390 "Lmonospace", 6391 0xff2c, 6392 "Lslash", 6393 0x0141, 6394 "Lslashsmall", 6395 0xf6f9, 6396 "Lsmall", 6397 0xf76c, 6398 "M", 6399 0x004d, 6400 "MBsquare", 6401 0x3386, 6402 "Macron", 6403 0xf6d0, 6404 "Macronsmall", 6405 0xf7af, 6406 "Macute", 6407 0x1e3e, 6408 "Mcircle", 6409 0x24c2, 6410 "Mdotaccent", 6411 0x1e40, 6412 "Mdotbelow", 6413 0x1e42, 6414 "Menarmenian", 6415 0x0544, 6416 "Mmonospace", 6417 0xff2d, 6418 "Msmall", 6419 0xf76d, 6420 "Mturned", 6421 0x019c, 6422 "Mu", 6423 0x039c, 6424 "N", 6425 0x004e, 6426 "NJ", 6427 0x01ca, 6428 "Nacute", 6429 0x0143, 6430 "Ncaron", 6431 0x0147, 6432 "Ncedilla", 6433 0x0145, 6434 "Ncircle", 6435 0x24c3, 6436 "Ncircumflexbelow", 6437 0x1e4a, 6438 "Ncommaaccent", 6439 0x0145, 6440 "Ndotaccent", 6441 0x1e44, 6442 "Ndotbelow", 6443 0x1e46, 6444 "Nhookleft", 6445 0x019d, 6446 "Nineroman", 6447 0x2168, 6448 "Nj", 6449 0x01cb, 6450 "Njecyrillic", 6451 0x040a, 6452 "Nlinebelow", 6453 0x1e48, 6454 "Nmonospace", 6455 0xff2e, 6456 "Nowarmenian", 6457 0x0546, 6458 "Nsmall", 6459 0xf76e, 6460 "Ntilde", 6461 0x00d1, 6462 "Ntildesmall", 6463 0xf7f1, 6464 "Nu", 6465 0x039d, 6466 "O", 6467 0x004f, 6468 "OE", 6469 0x0152, 6470 "OEsmall", 6471 0xf6fa, 6472 "Oacute", 6473 0x00d3, 6474 "Oacutesmall", 6475 0xf7f3, 6476 "Obarredcyrillic", 6477 0x04e8, 6478 "Obarreddieresiscyrillic", 6479 0x04ea, 6480 "Obreve", 6481 0x014e, 6482 "Ocaron", 6483 0x01d1, 6484 "Ocenteredtilde", 6485 0x019f, 6486 "Ocircle", 6487 0x24c4, 6488 "Ocircumflex", 6489 0x00d4, 6490 "Ocircumflexacute", 6491 0x1ed0, 6492 "Ocircumflexdotbelow", 6493 0x1ed8, 6494 "Ocircumflexgrave", 6495 0x1ed2, 6496 "Ocircumflexhookabove", 6497 0x1ed4, 6498 "Ocircumflexsmall", 6499 0xf7f4, 6500 "Ocircumflextilde", 6501 0x1ed6, 6502 "Ocyrillic", 6503 0x041e, 6504 "Odblacute", 6505 0x0150, 6506 "Odblgrave", 6507 0x020c, 6508 "Odieresis", 6509 0x00d6, 6510 "Odieresiscyrillic", 6511 0x04e6, 6512 "Odieresissmall", 6513 0xf7f6, 6514 "Odotbelow", 6515 0x1ecc, 6516 "Ogoneksmall", 6517 0xf6fb, 6518 "Ograve", 6519 0x00d2, 6520 "Ogravesmall", 6521 0xf7f2, 6522 "Oharmenian", 6523 0x0555, 6524 "Ohm", 6525 0x2126, 6526 "Ohookabove", 6527 0x1ece, 6528 "Ohorn", 6529 0x01a0, 6530 "Ohornacute", 6531 0x1eda, 6532 "Ohorndotbelow", 6533 0x1ee2, 6534 "Ohorngrave", 6535 0x1edc, 6536 "Ohornhookabove", 6537 0x1ede, 6538 "Ohorntilde", 6539 0x1ee0, 6540 "Ohungarumlaut", 6541 0x0150, 6542 "Oi", 6543 0x01a2, 6544 "Oinvertedbreve", 6545 0x020e, 6546 "Omacron", 6547 0x014c, 6548 "Omacronacute", 6549 0x1e52, 6550 "Omacrongrave", 6551 0x1e50, 6552 "Omega", 6553 0x2126, 6554 "Omegacyrillic", 6555 0x0460, 6556 "Omegagreek", 6557 0x03a9, 6558 "Omegaroundcyrillic", 6559 0x047a, 6560 "Omegatitlocyrillic", 6561 0x047c, 6562 "Omegatonos", 6563 0x038f, 6564 "Omicron", 6565 0x039f, 6566 "Omicrontonos", 6567 0x038c, 6568 "Omonospace", 6569 0xff2f, 6570 "Oneroman", 6571 0x2160, 6572 "Oogonek",
6573 0x01ea, 6574 "Oogonekmacron", 6575 0x01ec, 6576 "Oopen", 6577 0x0186, 6578 "Oslash", 6579 0x00d8, 6580 "Oslashacute", 6581 0x01fe, 6582 "Oslashsmall", 6583 0xf7f8, 6584 "Osmall", 6585 0xf76f, 6586 "Ostrokeacute", 6587 0x01fe, 6588 "Otcyrillic", 6589 0x047e, 6590 "Otilde", 6591 0x00d5, 6592 "Otildeacute", 6593 0x1e4c, 6594 "Otildedieresis", 6595 0x1e4e, 6596 "Otildesmall", 6597 0xf7f5, 6598 "P", 6599 0x0050, 6600 "Pacute", 6601 0x1e54, 6602 "Pcircle", 6603 0x24c5, 6604 "Pdotaccent", 6605 0x1e56, 6606 "Pecyrillic", 6607 0x041f, 6608 "Peharmenian", 6609 0x054a, 6610 "Pemiddlehookcyrillic", 6611 0x04a6, 6612 "Phi", 6613 0x03a6, 6614 "Phook", 6615 0x01a4, 6616 "Pi", 6617 0x03a0, 6618 "Piwrarmenian", 6619 0x0553, 6620 "Pmonospace", 6621 0xff30, 6622 "Psi", 6623 0x03a8, 6624 "Psicyrillic", 6625 0x0470, 6626 "Psmall", 6627 0xf770, 6628 "Q", 6629 0x0051, 6630 "Qcircle", 6631 0x24c6, 6632 "Qmonospace", 6633 0xff31, 6634 "Qsmall", 6635 0xf771, 6636 "R", 6637 0x0052, 6638 "Raarmenian", 6639 0x054c, 6640 "Racute", 6641 0x0154, 6642 "Rcaron", 6643 0x0158, 6644 "Rcedilla", 6645 0x0156, 6646 "Rcircle", 6647 0x24c7, 6648 "Rcommaaccent", 6649 0x0156, 6650 "Rdblgrave", 6651 0x0210, 6652 "Rdotaccent", 6653 0x1e58, 6654 "Rdotbelow", 6655 0x1e5a, 6656 "Rdotbelowmacron", 6657 0x1e5c, 6658 "Reharmenian", 6659 0x0550, 6660 "Rfraktur", 6661 0x211c, 6662 "Rho", 6663 0x03a1, 6664 "Ringsmall", 6665 0xf6fc, 6666 "Rinvertedbreve", 6667 0x0212, 6668 "Rlinebelow", 6669 0x1e5e, 6670 "Rmonospace", 6671 0xff32, 6672 "Rsmall", 6673 0xf772, 6674 "Rsmallinverted", 6675 0x0281, 6676 "Rsmallinvertedsuperior", 6677 0x02b6, 6678 "S", 6679 0x0053, 6680 "SF010000", 6681 0x250c, 6682 "SF020000", 6683 0x2514, 6684 "SF030000", 6685 0x2510, 6686 "SF040000", 6687 0x2518, 6688 "SF050000", 6689 0x253c, 6690 "SF060000", 6691 0x252c, 6692 "SF070000", 6693 0x2534, 6694 "SF080000", 6695 0x251c, 6696 "SF090000", 6697 0x2524, 6698 "SF100000", 6699 0x2500, 6700 "SF110000", 6701 0x2502, 6702 "SF190000", 6703 0x2561, 6704 "SF200000", 6705 0x2562, 6706 "SF210000", 6707 0x2556, 6708 "SF220000", 6709 0x2555, 6710 "SF230000", 6711 0x2563, 6712 "SF240000", 6713 0x2551, 6714 "SF250000", 6715 0x2557, 6716 "SF260000", 6717 0x255d, 6718 "SF270000", 6719 0x255c, 6720 "SF280000", 6721 0x255b, 6722 "SF360000", 6723 0x255e, 6724 "SF370000", 6725 0x255f, 6726 "SF380000", 6727 0x255a, 6728 "SF390000", 6729 0x2554, 6730 "SF400000", 6731 0x2569, 6732 "SF410000", 6733 0x2566, 6734 "SF420000", 6735 0x2560, 6736 "SF430000", 6737 0x2550, 6738 "SF440000", 6739 0x256c, 6740 "SF450000", 6741 0x2567, 6742 "SF460000", 6743 0x2568, 6744 "SF470000", 6745 0x2564, 6746 "SF480000", 6747 0x2565, 6748 "SF490000", 6749 0x2559, 6750 "SF500000", 6751 0x2558, 6752 "SF510000", 6753 0x2552, 6754 "SF520000", 6755 0x2553, 6756 "SF530000", 6757 0x256b, 6758 "SF540000", 6759 0x256a, 6760 "Sacute", 6761 0x015a, 6762 "Sacutedotaccent", 6763 0x1e64, 6764 "Sampigreek", 6765 0x03e0, 6766 "Scaron", 6767 0x0160, 6768 "Scarondotaccent", 6769 0x1e66, 6770 "Scaronsmall", 6771 0xf6fd, 6772 "Scedilla", 6773 0x015e, 6774 "Schwa", 6775 0x018f, 6776 "Schwacyrillic", 6777 0x04d8, 6778 "Schwadieresiscyrillic", 6779 0x04da, 6780 "Scircle", 6781 0x24c8, 6782 "Scircumflex", 6783 0x015c, 6784 "Scommaaccent", 6785 0x0218, 6786 "Sdotaccent", 6787 0x1e60, 6788 "Sdotbelow", 6789 0x1e62, 6790 "Sdotbelowdotaccent", 6791 0x1e68, 6792 "Seharmenian", 6793 0x054d,
6794 "Sevenroman", 6795 0x2166, 6796 "Shaarmenian", 6797 0x0547, 6798 "Shacyrillic", 6799 0x0428, 6800 "Shchacyrillic", 6801 0x0429, 6802 "Sheicoptic", 6803 0x03e2, 6804 "Shhacyrillic", 6805 0x04ba, 6806 "Shimacoptic", 6807 0x03ec, 6808 "Sigma", 6809 0x03a3, 6810 "Sixroman", 6811 0x2165, 6812 "Smonospace", 6813 0xff33, 6814 "Softsigncyrillic", 6815 0x042c, 6816 "Ssmall", 6817 0xf773, 6818 "Stigmagreek", 6819 0x03da, 6820 "T", 6821 0x0054, 6822 "Tau", 6823 0x03a4, 6824 "Tbar", 6825 0x0166, 6826 "Tcaron", 6827 0x0164, 6828 "Tcedilla", 6829 0x0162, 6830 "Tcircle", 6831 0x24c9, 6832 "Tcircumflexbelow", 6833 0x1e70, 6834 "Tcommaaccent", 6835 0x0162, 6836 "Tdotaccent", 6837 0x1e6a, 6838 "Tdotbelow", 6839 0x1e6c, 6840 "Tecyrillic", 6841 0x0422, 6842 "Tedescendercyrillic", 6843 0x04ac, 6844 "Tenroman", 6845 0x2169, 6846 "Tetsecyrillic", 6847 0x04b4, 6848 "Theta", 6849 0x0398, 6850 "Thook", 6851 0x01ac, 6852 "Thorn", 6853 0x00de, 6854 "Thornsmall", 6855 0xf7fe, 6856 "Threeroman", 6857 0x2162, 6858 "Tildesmall", 6859 0xf6fe, 6860 "Tiwnarmenian", 6861 0x054f, 6862 "Tlinebelow", 6863 0x1e6e, 6864 "Tmonospace", 6865 0xff34, 6866 "Toarmenian", 6867 0x0539, 6868 "Tonefive", 6869 0x01bc, 6870 "Tonesix", 6871 0x0184, 6872 "Tonetwo", 6873 0x01a7, 6874 "Tretroflexhook", 6875 0x01ae, 6876 "Tsecyrillic", 6877 0x0426, 6878 "Tshecyrillic", 6879 0x040b, 6880 "Tsmall", 6881 0xf774, 6882 "Twelveroman", 6883 0x216b, 6884 "Tworoman", 6885 0x2161, 6886 "U", 6887 0x0055, 6888 "Uacute", 6889 0x00da, 6890 "Uacutesmall", 6891 0xf7fa, 6892 "Ubreve", 6893 0x016c, 6894 "Ucaron", 6895 0x01d3, 6896 "Ucircle", 6897 0x24ca, 6898 "Ucircumflex", 6899 0x00db, 6900 "Ucircumflexbelow", 6901 0x1e76, 6902 "Ucircumflexsmall", 6903 0xf7fb, 6904 "Ucyrillic", 6905 0x0423, 6906 "Udblacute", 6907 0x0170, 6908 "Udblgrave", 6909 0x0214, 6910 "Udieresis", 6911 0x00dc, 6912 "Udieresisacute", 6913 0x01d7, 6914 "Udieresisbelow", 6915 0x1e72, 6916 "Udieresiscaron", 6917 0x01d9, 6918 "Udieresiscyrillic", 6919 0x04f0, 6920 "Udieresisgrave", 6921 0x01db, 6922 "Udieresismacron", 6923 0x01d5, 6924 "Udieresissmall", 6925 0xf7fc, 6926 "Udotbelow", 6927 0x1ee4, 6928 "Ugrave", 6929 0x00d9, 6930 "Ugravesmall", 6931 0xf7f9, 6932 "Uhookabove", 6933 0x1ee6, 6934 "Uhorn", 6935 0x01af, 6936 "Uhornacute", 6937 0x1ee8, 6938 "Uhorndotbelow", 6939 0x1ef0, 6940 "Uhorngrave", 6941 0x1eea, 6942 "Uhornhookabove", 6943 0x1eec, 6944 "Uhorntilde", 6945 0x1eee, 6946 "Uhungarumlaut", 6947 0x0170, 6948 "Uhungarumlautcyrillic", 6949 0x04f2, 6950 "Uinvertedbreve", 6951 0x0216, 6952 "Ukcyrillic", 6953 0x0478, 6954 "Umacron", 6955 0x016a, 6956 "Umacroncyrillic", 6957 0x04ee, 6958 "Umacrondieresis", 6959 0x1e7a, 6960 "Umonospace", 6961 0xff35, 6962 "Uogonek", 6963 0x0172, 6964 "Upsilon", 6965 0x03a5, 6966 "Upsilon1", 6967 0x03d2, 6968 "Upsilonacutehooksymbolgreek", 6969 0x03d3, 6970 "Upsilonafrican", 6971 0x01b1, 6972 "Upsilondieresis", 6973 0x03ab, 6974 "Upsilondieresishooksymbolgreek", 6975 0x03d4, 6976 "Upsilonhooksymbol", 6977 0x03d2, 6978 "Upsilontonos", 6979 0x038e, 6980 "Uring", 6981 0x016e, 6982 "Ushortcyrillic", 6983 0x040e, 6984 "Usmall", 6985 0xf775, 6986 "Ustraightcyrillic", 6987 0x04ae, 6988 "Ustraightstrokecyrillic", 6989 0x04b0, 6990 "Utilde", 6991 0x0168, 6992 "Utildeacute", 6993 0x1e78, 6994 "Utildebelow", 6995 0x1e74, 6996 "V", 6997 0x0056, 6998 "Vcircle", 6999 0x24cb, 7000 "Vdotbelow", 7001 0x1e7e, 7002 "Vecyrillic", 7003 0x0412, 7004 "Vewarmenian", 7005 0x054e, 7006 "Vhook", 7007 0x01b2, 7008 "Vmonospace", 7009 0xff36, 7010 "Voarmenian", 7011 0x0548, 7012 "Vsmall", 7013 0xf776, 7014 "Vtilde", 7015 0x1e7c, 7016 "W", 7017 0x0057, 7018 "Wacute", 7019 0x1e82, 7020 "Wcircle", 7021 0x24cc, 7022 "Wcircumflex", 7023 0x0174, 7024 "Wdieresis", 7025 0x1e84, 7026 "Wdotaccent", 7027 0x1e86, 7028 "Wdotbelow", 7029 0x1e88, 7030 "Wgrave", 7031 0x1e80, 7032 "Wmonospace", 7033 0xff37, 7034 "Wsmall", 7035 0xf777, 7036 "X", 7037 0x0058, 7038 "Xcircle", 7039 0x24cd, 7040 "Xdieresis", 7041 0x1e8c, 7042 "Xdotaccent", 7043 0x1e8a, 7044 "Xeharmenian", 7045 0x053d, 7046 "Xi", 7047 0x039e, 7048 "Xmonospace", 7049 0xff38, 7050 "Xsmall", 7051 0xf778, 7052 "Y", 7053 0x0059, 7054 "Yacute", 7055 0x00dd, 7056 "Yacutesmall", 7057 0xf7fd, 7058 "Yatcyrillic", 7059 0x0462, 7060 "Ycircle", 7061 0x24ce, 7062 "Ycircumflex", 7063 0x0176, 7064 "Ydieresis", 7065 0x0178, 7066 "Ydieresissmall", 7067 0xf7ff, 7068 "Ydotaccent", 7069 0x1e8e, 7070 "Ydotbelow", 7071 0x1ef4, 7072 "Yericyrillic", 7073 0x042b, 7074 "Yerudieresiscyrillic", 7075 0x04f8, 7076 "Ygrave", 7077 0x1ef2, 7078 "Yhook", 7079 0x01b3, 7080 "Yhookabove", 7081 0x1ef6, 7082 "Yiarmenian", 7083 0x0545, 7084 "Yicyrillic", 7085 0x0407, 7086 "Yiwnarmenian", 7087 0x0552, 7088 "Ymonospace", 7089 0xff39, 7090 "Ysmall", 7091 0xf779, 7092 "Ytilde", 7093 0x1ef8, 7094 "Yusbigcyrillic", 7095 0x046a, 7096 "Yusbigiotifiedcyrillic", 7097 0x046c, 7098 "Yuslittlecyrillic", 7099 0x0466, 7100 "Yuslittleiotifiedcyrillic", 7101 0x0468, 7102 "Z", 7103 0x005a, 7104 "Zaarmenian", 7105 0x0536, 7106 "Zacute", 7107 0x0179, 7108 "Zcaron", 7109 0x017d, 7110 "Zcaronsmall", 7111 0xf6ff, 7112 "Zcircle", 7113 0x24cf, 7114 "Zcircumflex", 7115 0x1e90, 7116 "Zdot", 7117 0x017b, 7118 "Zdotaccent", 7119 0x017b, 7120 "Zdotbelow", 7121 0x1e92, 7122 "Zecyrillic", 7123 0x0417, 7124 "Zedescendercyrillic", 7125 0x0498, 7126 "Zedieresiscyrillic", 7127 0x04de, 7128 "Zeta", 7129 0x0396, 7130 "Zhearmenian", 7131 0x053a, 7132 "Zhebrevecyrillic", 7133 0x04c1, 7134 "Zhecyrillic", 7135 0x0416, 7136 "Zhedescendercyrillic", 7137 0x0496, 7138 "Zhedieresiscyrillic", 7139 0x04dc, 7140 "Zlinebelow", 7141 0x1e94, 7142 "Zmonospace", 7143 0xff3a, 7144 "Zsmall", 7145 0xf77a, 7146 "Zstroke", 7147 0x01b5, 7148 "a", 7149 0x0061, 7150 "aabengali", 7151 0x0986, 7152 "aacute", 7153 0x00e1, 7154 "aadeva", 7155 0x0906, 7156 "aagujarati", 7157 0x0a86, 7158 "aagurmukhi", 7159 0x0a06, 7160 "aamatragurmukhi", 7161 0x0a3e, 7162 "aarusquare", 7163 0x3303, 7164 "aavowelsignbengali", 7165 0x09be, 7166 "aavowelsigndeva", 7167 0x093e, 7168 "aavowelsigngujarati", 7169 0x0abe, 7170 "abbreviationmarkarmenian", 7171 0x055f, 7172 "abbreviationsigndeva", 7173 0x0970, 7174 "abengali", 7175 0x0985, 7176 "abopomofo", 7177 0x311a, 7178 "abreve", 7179 0x0103, 7180 "abreveacute", 7181 0x1eaf, 7182 "abrevecyrillic", 7183 0x04d1, 7184 "abrevedotbelow", 7185 0x1eb7, 7186 "abrevegrave", 7187 0x1eb1, 7188 "abrevehookabove", 7189 0x1eb3, 7190 "abrevetilde", 7191 0x1eb5, 7192 "acaron", 7193 0x01ce, 7194 "acircle", 7195 0x24d0, 7196 "acircumflex", 7197 0x00e2, 7198 "acircumflexacute", 7199 0x1ea5, 7200 "acircumflexdotbelow", 7201 0x1ead, 7202 "acircumflexgrave", 7203 0x1ea7, 7204 "acircumflexhookabove", 7205 0x1ea9, 7206 "acircumflextilde", 7207 0x1eab, 7208 "acute", 7209 0x00b4, 7210 "acutebelowcmb", 7211 0x0317, 7212 "acutecmb", 7213 0x0301, 7214 "acutecomb", 7215 0x0301, 7216 "acutedeva", 7217 0x0954, 7218 "acutelowmod", 7219 0x02cf, 7220 "acutetonecmb", 7221 0x0341, 7222 "acyrillic", 7223 0x0430, 7224 "adblgrave", 7225 0x0201, 7226 "addakgurmukhi", 7227 0x0a71, 7228 "adeva", 7229 0x0905, 7230 "adieresis", 7231 0x00e4, 7232 "adieresiscyrillic", 7233 0x04d3, 7234 "adieresismacron", 7235 0x01df, 7236 "adotbelow", 7237 0x1ea1, 7238 "adotmacron", 7239 0x01e1, 7240 "ae", 7241 0x00e6, 7242 "aeacute", 7243 0x01fd, 7244 "aekorean", 7245 0x3150, 7246 "aemacron", 7247 0x01e3, 7248 "afii00208", 7249 0x2015, 7250 "afii08941", 7251 0x20a4, 7252 "afii10017", 7253 0x0410, 7254 "afii10018", 7255 0x0411, 7256 "afii10019", 7257 0x0412, 7258 "afii10020", 7259 0x0413, 7260 "afii10021", 7261 0x0414, 7262 "afii10022", 7263 0x0415, 7264 "afii10023", 7265 0x0401, 7266 "afii10024", 7267 0x0416, 7268 "afii10025", 7269 0x0417, 7270 "afii10026", 7271 0x0418, 7272 "afii10027", 7273 0x0419, 7274 "afii10028", 7275 0x041a, 7276 "afii10029", 7277 0x041b, 7278 "afii10030", 7279 0x041c, 7280 "afii10031", 7281 0x041d, 7282 "afii10032", 7283 0x041e, 7284 "afii10033", 7285 0x041f, 7286 "afii10034", 7287 0x0420, 7288 "afii10035", 7289 0x0421, 7290 "afii10036", 7291 0x0422, 7292 "afii10037", 7293 0x0423, 7294 "afii10038", 7295 0x0424, 7296 "afii10039", 7297 0x0425, 7298 "afii10040", 7299 0x0426, 7300 "afii10041", 7301 0x0427,
7302 "afii10042", 7303 0x0428, 7304 "afii10043", 7305 0x0429, 7306 "afii10044", 7307 0x042a, 7308 "afii10045", 7309 0x042b, 7310 "afii10046", 7311 0x042c, 7312 "afii10047", 7313 0x042d, 7314 "afii10048", 7315 0x042e, 7316 "afii10049", 7317 0x042f, 7318 "afii10050", 7319 0x0490, 7320 "afii10051", 7321 0x0402, 7322 "afii10052", 7323 0x0403, 7324 "afii10053", 7325 0x0404, 7326 "afii10054", 7327 0x0405, 7328 "afii10055", 7329 0x0406, 7330 "afii10056", 7331 0x0407, 7332 "afii10057", 7333 0x0408, 7334 "afii10058", 7335 0x0409, 7336 "afii10059", 7337 0x040a, 7338 "afii10060", 7339 0x040b, 7340 "afii10061", 7341 0x040c, 7342 "afii10062", 7343 0x040e, 7344 "afii10063", 7345 0xf6c4, 7346 "afii10064", 7347 0xf6c5, 7348 "afii10065", 7349 0x0430, 7350 "afii10066", 7351 0x0431, 7352 "afii10067", 7353 0x0432, 7354 "afii10068", 7355 0x0433, 7356 "afii10069", 7357 0x0434, 7358 "afii10070", 7359 0x0435, 7360 "afii10071", 7361 0x0451, 7362 "afii10072", 7363 0x0436, 7364 "afii10073", 7365 0x0437, 7366 "afii10074", 7367 0x0438, 7368 "afii10075", 7369 0x0439, 7370 "afii10076", 7371 0x043a, 7372 "afii10077", 7373 0x043b, 7374 "afii10078", 7375 0x043c, 7376 "afii10079", 7377 0x043d, 7378 "afii10080", 7379 0x043e, 7380 "afii10081", 7381 0x043f, 7382 "afii10082", 7383 0x0440, 7384 "afii10083", 7385 0x0441, 7386 "afii10084", 7387 0x0442, 7388 "afii10085", 7389 0x0443, 7390 "afii10086", 7391 0x0444, 7392 "afii10087", 7393 0x0445, 7394 "afii10088", 7395 0x0446, 7396 "afii10089", 7397 0x0447, 7398 "afii10090", 7399 0x0448, 7400 "afii10091", 7401 0x0449, 7402 "afii10092", 7403 0x044a, 7404 "afii10093", 7405 0x044b, 7406 "afii10094", 7407 0x044c, 7408 "afii10095", 7409 0x044d, 7410 "afii10096", 7411 0x044e, 7412 "afii10097", 7413 0x044f, 7414 "afii10098", 7415 0x0491, 7416 "afii10099", 7417 0x0452, 7418 "afii10100", 7419 0x0453, 7420 "afii10101", 7421 0x0454, 7422 "afii10102", 7423 0x0455, 7424 "afii10103", 7425 0x0456, 7426 "afii10104", 7427 0x0457, 7428 "afii10105", 7429 0x0458, 7430 "afii10106", 7431 0x0459, 7432 "afii10107", 7433 0x045a, 7434 "afii10108", 7435 0x045b, 7436 "afii10109", 7437 0x045c, 7438 "afii10110", 7439 0x045e, 7440 "afii10145", 7441 0x040f, 7442 "afii10146", 7443 0x0462, 7444 "afii10147", 7445 0x0472, 7446 "afii10148", 7447 0x0474, 7448 "afii10192", 7449 0xf6c6, 7450 "afii10193", 7451 0x045f, 7452 "afii10194", 7453 0x0463, 7454 "afii10195", 7455 0x0473, 7456 "afii10196", 7457 0x0475, 7458 "afii10831", 7459 0xf6c7, 7460 "afii10832", 7461 0xf6c8, 7462 "afii10846", 7463 0x04d9, 7464 "afii299", 7465 0x200e, 7466 "afii300", 7467 0x200f, 7468 "afii301", 7469 0x200d, 7470 "afii57381", 7471 0x066a, 7472 "afii57388", 7473 0x060c, 7474 "afii57392", 7475 0x0660, 7476 "afii57393", 7477 0x0661, 7478 "afii57394", 7479 0x0662, 7480 "afii57395", 7481 0x0663, 7482 "afii57396", 7483 0x0664, 7484 "afii57397", 7485 0x0665, 7486 "afii57398", 7487 0x0666, 7488 "afii57399", 7489 0x0667, 7490 "afii57400", 7491 0x0668, 7492 "afii57401", 7493 0x0669, 7494 "afii57403", 7495 0x061b, 7496 "afii57407", 7497 0x061f, 7498 "afii57409", 7499 0x0621, 7500 "afii57410", 7501 0x0622, 7502 "afii57411", 7503 0x0623, 7504 "afii57412", 7505 0x0624, 7506 "afii57413", 7507 0x0625, 7508 "afii57414", 7509 0x0626, 7510 "afii57415", 7511 0x0627, 7512 "afii57416", 7513 0x0628, 7514 "afii57417", 7515 0x0629, 7516 "afii57418", 7517 0x062a, 7518 "afii57419", 7519 0x062b, 7520 "afii57420", 7521 0x062c, 7522 "afii57421", 7523 0x062d, 7524 "afii57422", 7525 0x062e, 7526 "afii57423", 7527 0x062f, 7528 "afii57424", 7529 0x0630, 7530 "afii57425", 7531 0x0631, 7532 "afii57426", 7533 0x0632, 7534 "afii57427", 7535 0x0633, 7536 "afii57428", 7537 0x0634, 7538 "afii57429", 7539 0x0635, 7540 "afii57430", 7541 0x0636, 7542 "afii57431", 7543 0x0637, 7544 "afii57432", 7545 0x0638, 7546 "afii57433", 7547 0x0639, 7548 "afii57434", 7549 0x063a, 7550 "afii57440", 7551 0x0640, 7552 "afii57441", 7553 0x0641, 7554 "afii57442", 7555 0x0642, 7556 "afii57443", 7557 0x0643, 7558 "afii57444", 7559 0x0644, 7560 "afii57445", 7561 0x0645, 7562 "afii57446", 7563 0x0646, 7564 "afii57448", 7565 0x0648, 7566 "afii57449", 7567 0x0649, 7568 "afii57450", 7569 0x064a, 7570 "afii57451", 7571 0x064b, 7572 "afii57452", 7573 0x064c, 7574 "afii57453", 7575 0x064d, 7576 "afii57454", 7577 0x064e, 7578 "afii57455", 7579 0x064f, 7580 "afii57456", 7581 0x0650, 7582 "afii57457", 7583 0x0651, 7584 "afii57458", 7585 0x0652, 7586 "afii57470", 7587 0x0647, 7588 "afii57505", 7589 0x06a4, 7590 "afii57506", 7591 0x067e, 7592 "afii57507", 7593 0x0686, 7594 "afii57508", 7595 0x0698, 7596 "afii57509", 7597 0x06af, 7598 "afii57511", 7599 0x0679, 7600 "afii57512", 7601 0x0688, 7602 "afii57513", 7603 0x0691, 7604 "afii57514", 7605 0x06ba, 7606 "afii57519", 7607 0x06d2, 7608 "afii57534", 7609 0x06d5, 7610 "afii57636", 7611 0x20aa, 7612 "afii57645", 7613 0x05be, 7614 "afii57658", 7615 0x05c3, 7616 "afii57664", 7617 0x05d0, 7618 "afii57665", 7619 0x05d1, 7620 "afii57666", 7621 0x05d2, 7622 "afii57667", 7623 0x05d3, 7624 "afii57668", 7625 0x05d4, 7626 "afii57669", 7627 0x05d5, 7628 "afii57670", 7629 0x05d6, 7630 "afii57671", 7631 0x05d7, 7632 "afii57672", 7633 0x05d8, 7634 "afii57673", 7635 0x05d9, 7636 "afii57674", 7637 0x05da, 7638 "afii57675", 7639 0x05db, 7640 "afii57676", 7641 0x05dc, 7642 "afii57677",
7643 0x05dd, 7644 "afii57678", 7645 0x05de, 7646 "afii57679", 7647 0x05df, 7648 "afii57680", 7649 0x05e0, 7650 "afii57681", 7651 0x05e1, 7652 "afii57682", 7653 0x05e2, 7654 "afii57683", 7655 0x05e3, 7656 "afii57684", 7657 0x05e4, 7658 "afii57685", 7659 0x05e5, 7660 "afii57686", 7661 0x05e6, 7662 "afii57687", 7663 0x05e7, 7664 "afii57688", 7665 0x05e8, 7666 "afii57689", 7667 0x05e9, 7668 "afii57690", 7669 0x05ea, 7670 "afii57694", 7671 0xfb2a, 7672 "afii57695", 7673 0xfb2b, 7674 "afii57700", 7675 0xfb4b, 7676 "afii57705", 7677 0xfb1f, 7678 "afii57716", 7679 0x05f0, 7680 "afii57717", 7681 0x05f1, 7682 "afii57718", 7683 0x05f2, 7684 "afii57723", 7685 0xfb35, 7686 "afii57793", 7687 0x05b4, 7688 "afii57794", 7689 0x05b5, 7690 "afii57795", 7691 0x05b6, 7692 "afii57796", 7693 0x05bb, 7694 "afii57797", 7695 0x05b8, 7696 "afii57798", 7697 0x05b7, 7698 "afii57799", 7699 0x05b0, 7700 "afii57800", 7701 0x05b2, 7702 "afii57801", 7703 0x05b1, 7704 "afii57802", 7705 0x05b3, 7706 "afii57803", 7707 0x05c2, 7708 "afii57804", 7709 0x05c1, 7710 "afii57806", 7711 0x05b9, 7712 "afii57807", 7713 0x05bc, 7714 "afii57839", 7715 0x05bd, 7716 "afii57841", 7717 0x05bf, 7718 "afii57842", 7719 0x05c0, 7720 "afii57929", 7721 0x02bc, 7722 "afii61248", 7723 0x2105, 7724 "afii61289", 7725 0x2113, 7726 "afii61352", 7727 0x2116, 7728 "afii61573", 7729 0x202c, 7730 "afii61574", 7731 0x202d, 7732 "afii61575", 7733 0x202e, 7734 "afii61664", 7735 0x200c, 7736 "afii63167", 7737 0x066d, 7738 "afii64937", 7739 0x02bd, 7740 "agrave", 7741 0x00e0, 7742 "agujarati", 7743 0x0a85, 7744 "agurmukhi", 7745 0x0a05, 7746 "ahiragana", 7747 0x3042, 7748 "ahookabove", 7749 0x1ea3, 7750 "aibengali", 7751 0x0990, 7752 "aibopomofo", 7753 0x311e, 7754 "aideva", 7755 0x0910, 7756 "aiecyrillic", 7757 0x04d5, 7758 "aigujarati", 7759 0x0a90, 7760 "aigurmukhi", 7761 0x0a10, 7762 "aimatragurmukhi", 7763 0x0a48, 7764 "ainarabic", 7765 0x0639, 7766 "ainfinalarabic", 7767 0xfeca, 7768 "aininitialarabic", 7769 0xfecb, 7770 "ainmedialarabic", 7771 0xfecc, 7772 "ainvertedbreve", 7773 0x0203, 7774 "aivowelsignbengali", 7775 0x09c8, 7776 "aivowelsigndeva", 7777 0x0948, 7778 "aivowelsigngujarati", 7779 0x0ac8, 7780 "akatakana", 7781 0x30a2, 7782 "akatakanahalfwidth", 7783 0xff71, 7784 "akorean", 7785 0x314f, 7786 "alef", 7787 0x05d0, 7788 "alefarabic", 7789 0x0627, 7790 "alefdageshhebrew",
7791 0xfb30, 7792 "aleffinalarabic", 7793 0xfe8e, 7794 "alefhamzaabovearabic", 7795 0x0623, 7796 "alefhamzaabovefinalarabic", 7797 0xfe84, 7798 "alefhamzabelowarabic", 7799 0x0625, 7800 "alefhamzabelowfinalarabic", 7801 0xfe88, 7802 "alefhebrew", 7803 0x05d0, 7804 "aleflamedhebrew", 7805 0xfb4f, 7806 "alefmaddaabovearabic", 7807 0x0622, 7808 "alefmaddaabovefinalarabic", 7809 0xfe82, 7810 "alefmaksuraarabic", 7811 0x0649, 7812 "alefmaksurafinalarabic", 7813 0xfef0, 7814 "alefmaksurainitialarabic", 7815 0xfef3, 7816 "alefmaksuramedialarabic", 7817 0xfef4, 7818 "alefpatahhebrew", 7819 0xfb2e, 7820 "alefqamatshebrew", 7821 0xfb2f, 7822 "aleph", 7823 0x2135, 7824 "allequal", 7825 0x224c, 7826 "alpha", 7827 0x03b1, 7828 "alphatonos", 7829 0x03ac, 7830 "amacron", 7831 0x0101, 7832 "amonospace", 7833 0xff41, 7834 "ampersand", 7835 0x0026, 7836 "ampersandmonospace", 7837 0xff06, 7838 "ampersandsmall", 7839 0xf726, 7840 "amsquare", 7841 0x33c2, 7842 "anbopomofo", 7843 0x3122, 7844 "angbopomofo", 7845 0x3124, 7846 "angbracketleft", 7847 0x3008, 7848 "angbracketright", 7849 0x3009, 7850 "angkhankhuthai", 7851 0x0e5a, 7852 "angle", 7853 0x2220, 7854 "anglebracketleft", 7855 0x3008, 7856 "anglebracketleftvertical", 7857 0xfe3f, 7858 "anglebracketright", 7859 0x3009, 7860 "anglebracketrightvertical", 7861 0xfe40, 7862 "angleleft", 7863 0x2329, 7864 "angleright", 7865 0x232a, 7866 "angstrom", 7867 0x212b, 7868 "anoteleia", 7869 0x0387, 7870 "anudattadeva", 7871 0x0952, 7872 "anusvarabengali", 7873 0x0982, 7874 "anusvaradeva", 7875 0x0902, 7876 "anusvaragujarati", 7877 0x0a82, 7878 "aogonek", 7879 0x0105, 7880 "apaatosquare", 7881 0x3300, 7882 "aparen", 7883 0x249c, 7884 "apostrophearmenian", 7885 0x055a, 7886 "apostrophemod", 7887 0x02bc, 7888 "apple", 7889 0xf8ff, 7890 "approaches", 7891 0x2250, 7892 "approxequal", 7893 0x2248, 7894 "approxequalorimage", 7895 0x2252, 7896 "approximatelyequal", 7897 0x2245, 7898 "araeaekorean", 7899 0x318e, 7900 "araeakorean", 7901 0x318d, 7902 "arc", 7903 0x2312, 7904 "arighthalfring", 7905 0x1e9a, 7906 "aring", 7907 0x00e5, 7908 "aringacute", 7909 0x01fb, 7910 "aringbelow", 7911 0x1e01, 7912 "arrowboth", 7913 0x2194, 7914 "arrowdashdown", 7915 0x21e3, 7916 "arrowdashleft", 7917 0x21e0, 7918 "arrowdashright", 7919 0x21e2, 7920 "arrowdashup", 7921 0x21e1, 7922 "arrowdblboth", 7923 0x21d4, 7924 "arrowdbldown", 7925 0x21d3, 7926 "arrowdblleft", 7927 0x21d0, 7928 "arrowdblright", 7929 0x21d2, 7930 "arrowdblup", 7931 0x21d1, 7932 "arrowdown", 7933 0x2193, 7934 "arrowdownleft", 7935 0x2199, 7936 "arrowdownright", 7937 0x2198, 7938 "arrowdownwhite", 7939 0x21e9, 7940 "arrowheaddownmod", 7941 0x02c5, 7942 "arrowheadleftmod",
7943 0x02c2, 7944 "arrowheadrightmod", 7945 0x02c3, 7946 "arrowheadupmod", 7947 0x02c4, 7948 "arrowhorizex", 7949 0xf8e7, 7950 "arrowleft", 7951 0x2190, 7952 "arrowleftdbl", 7953 0x21d0, 7954 "arrowleftdblstroke", 7955 0x21cd, 7956 "arrowleftoverright", 7957 0x21c6, 7958 "arrowleftwhite", 7959 0x21e6, 7960 "arrowright", 7961 0x2192, 7962 "arrowrightdblstroke", 7963 0x21cf, 7964 "arrowrightheavy", 7965 0x279e, 7966 "arrowrightoverleft", 7967 0x21c4, 7968 "arrowrightwhite", 7969 0x21e8, 7970 "arrowtableft", 7971 0x21e4, 7972 "arrowtabright", 7973 0x21e5, 7974 "arrowup", 7975 0x2191, 7976 "arrowupdn", 7977 0x2195, 7978 "arrowupdnbse", 7979 0x21a8, 7980 "arrowupdownbase", 7981 0x21a8, 7982 "arrowupleft", 7983 0x2196, 7984 "arrowupleftofdown", 7985 0x21c5, 7986 "arrowupright", 7987 0x2197, 7988 "arrowupwhite", 7989 0x21e7, 7990 "arrowvertex", 7991 0xf8e6, 7992 "asciicircum", 7993 0x005e, 7994 "asciicircummonospace", 7995 0xff3e, 7996 "asciitilde", 7997 0x007e, 7998 "asciitildemonospace", 7999 0xff5e, 8000 "ascript", 8001 0x0251, 8002 "ascriptturned", 8003 0x0252, 8004 "asmallhiragana", 8005 0x3041, 8006 "asmallkatakana", 8007 0x30a1, 8008 "asmallkatakanahalfwidth", 8009 0xff67, 8010 "asterisk", 8011 0x002a, 8012 "asteriskaltonearabic", 8013 0x066d, 8014 "asteriskarabic", 8015 0x066d, 8016 "asteriskmath", 8017 0x2217, 8018 "asteriskmonospace", 8019 0xff0a, 8020 "asterisksmall", 8021 0xfe61, 8022 "asterism", 8023 0x2042, 8024 "asuperior", 8025 0xf6e9, 8026 "asymptoticallyequal", 8027 0x2243, 8028 "at", 8029 0x0040, 8030 "atilde", 8031 0x00e3, 8032 "atmonospace", 8033 0xff20, 8034 "atsmall", 8035 0xfe6b, 8036 "aturned", 8037 0x0250, 8038 "aubengali", 8039 0x0994, 8040 "aubopomofo", 8041 0x3120, 8042 "audeva", 8043 0x0914, 8044 "augujarati", 8045 0x0a94, 8046 "augurmukhi", 8047 0x0a14, 8048 "aulengthmarkbengali", 8049 0x09d7, 8050 "aumatragurmukhi", 8051 0x0a4c, 8052 "auvowelsignbengali", 8053 0x09cc, 8054 "auvowelsigndeva", 8055 0x094c, 8056 "auvowelsigngujarati", 8057 0x0acc, 8058 "avagrahadeva", 8059 0x093d, 8060 "aybarmenian", 8061 0x0561, 8062 "ayin", 8063 0x05e2, 8064 "ayinaltonehebrew", 8065 0xfb20, 8066 "ayinhebrew", 8067 0x05e2, 8068 "b", 8069 0x0062, 8070 "babengali", 8071 0x09ac, 8072 "backslash", 8073 0x005c, 8074 "backslashmonospace", 8075 0xff3c, 8076 "badeva", 8077 0x092c, 8078 "bagujarati", 8079 0x0aac, 8080 "bagurmukhi", 8081 0x0a2c, 8082 "bahiragana", 8083 0x3070, 8084 "bahtthai", 8085 0x0e3f, 8086 "bakatakana", 8087 0x30d0, 8088 "bar", 8089 0x007c, 8090 "barmonospace", 8091 0xff5c, 8092 "bbopomofo", 8093 0x3105, 8094 "bcircle", 8095 0x24d1, 8096 "bdotaccent", 8097 0x1e03, 8098 "bdotbelow", 8099 0x1e05, 8100 "beamedsixteenthnotes", 8101 0x266c, 8102 "because", 8103 0x2235, 8104 "becyrillic", 8105 0x0431, 8106 "beharabic", 8107 0x0628, 8108 "behfinalarabic", 8109 0xfe90, 8110 "behinitialarabic", 8111 0xfe91, 8112 "behiragana", 8113 0x3079, 8114 "behmedialarabic", 8115 0xfe92, 8116 "behmeeminitialarabic", 8117 0xfc9f, 8118 "behmeemisolatedarabic", 8119 0xfc08, 8120 "behnoonfinalarabic", 8121 0xfc6d, 8122 "bekatakana", 8123 0x30d9, 8124 "benarmenian", 8125 0x0562, 8126 "bet", 8127 0x05d1, 8128 "beta", 8129 0x03b2, 8130 "betasymbolgreek", 8131 0x03d0, 8132 "betdagesh", 8133 0xfb31, 8134 "betdageshhebrew",
8135 0xfb31, 8136 "bethebrew", 8137 0x05d1, 8138 "betrafehebrew", 8139 0xfb4c, 8140 "bhabengali", 8141 0x09ad, 8142 "bhadeva", 8143 0x092d, 8144 "bhagujarati", 8145 0x0aad, 8146 "bhagurmukhi", 8147 0x0a2d, 8148 "bhook", 8149 0x0253, 8150 "bihiragana", 8151 0x3073, 8152 "bikatakana", 8153 0x30d3, 8154 "bilabialclick", 8155 0x0298, 8156 "bindigurmukhi", 8157 0x0a02, 8158 "birusquare", 8159 0x3331, 8160 "blackcircle", 8161 0x25cf, 8162 "blackdiamond", 8163 0x25c6, 8164 "blackdownpointingtriangle", 8165 0x25bc, 8166 "blackleftpointingpointer", 8167 0x25c4, 8168 "blackleftpointingtriangle", 8169 0x25c0, 8170 "blacklenticularbracketleft", 8171 0x3010, 8172 "blacklenticularbracketleftvertical", 8173 0xfe3b, 8174 "blacklenticularbracketright", 8175 0x3011, 8176 "blacklenticularbracketrightvertical", 8177 0xfe3c, 8178 "blacklowerlefttriangle", 8179 0x25e3, 8180 "blacklowerrighttriangle", 8181 0x25e2, 8182 "blackrectangle", 8183 0x25ac, 8184 "blackrightpointingpointer", 8185 0x25ba, 8186 "blackrightpointingtriangle", 8187 0x25b6, 8188 "blacksmallsquare", 8189 0x25aa, 8190 "blacksmilingface", 8191 0x263b, 8192 "blacksquare", 8193 0x25a0, 8194 "blackstar", 8195 0x2605, 8196 "blackupperlefttriangle", 8197 0x25e4, 8198 "blackupperrighttriangle", 8199 0x25e5, 8200 "blackuppointingsmalltriangle", 8201 0x25b4, 8202 "blackuppointingtriangle", 8203 0x25b2, 8204 "blank", 8205 0x2423, 8206 "blinebelow", 8207 0x1e07, 8208 "block", 8209 0x2588, 8210 "bmonospace", 8211 0xff42, 8212 "bobaimaithai", 8213 0x0e1a, 8214 "bohiragana", 8215 0x307c, 8216 "bokatakana", 8217 0x30dc, 8218 "bparen", 8219 0x249d, 8220 "bqsquare", 8221 0x33c3, 8222 "braceex", 8223 0xf8f4, 8224 "braceleft", 8225 0x007b, 8226 "braceleftbt", 8227 0xf8f3, 8228 "braceleftmid", 8229 0xf8f2, 8230 "braceleftmonospace", 8231 0xff5b, 8232 "braceleftsmall", 8233 0xfe5b, 8234 "bracelefttp", 8235 0xf8f1, 8236 "braceleftvertical", 8237 0xfe37, 8238 "braceright", 8239 0x007d, 8240 "bracerightbt", 8241 0xf8fe, 8242 "bracerightmid", 8243 0xf8fd, 8244 "bracerightmonospace", 8245 0xff5d, 8246 "bracerightsmall", 8247 0xfe5c, 8248 "bracerighttp", 8249 0xf8fc, 8250 "bracerightvertical", 8251 0xfe38, 8252 "bracketleft", 8253 0x005b, 8254 "bracketleftbt", 8255 0xf8f0, 8256 "bracketleftex", 8257 0xf8ef, 8258 "bracketleftmonospace", 8259 0xff3b, 8260 "bracketlefttp", 8261 0xf8ee, 8262 "bracketright", 8263 0x005d, 8264 "bracketrightbt", 8265 0xf8fb, 8266 "bracketrightex", 8267 0xf8fa, 8268 "bracketrightmonospace", 8269 0xff3d, 8270 "bracketrighttp", 8271 0xf8f9, 8272 "breve", 8273 0x02d8, 8274 "brevebelowcmb", 8275 0x032e, 8276 "brevecmb", 8277 0x0306, 8278 "breveinvertedbelowcmb", 8279 0x032f, 8280 "breveinvertedcmb", 8281 0x0311, 8282 "breveinverteddoublecmb", 8283 0x0361, 8284 "bridgebelowcmb", 8285 0x032a, 8286 "bridgeinvertedbelowcmb", 8287 0x033a, 8288 "brokenbar", 8289 0x00a6, 8290 "bstroke", 8291 0x0180, 8292 "bsuperior", 8293 0xf6ea, 8294 "btopbar", 8295 0x0183, 8296 "buhiragana", 8297 0x3076, 8298 "bukatakana", 8299 0x30d6, 8300 "bullet", 8301 0x2022, 8302 "bulletinverse", 8303 0x25d8, 8304 "bulletoperator", 8305 0x2219, 8306 "bullseye", 8307 0x25ce, 8308 "c", 8309 0x0063, 8310 "caarmenian", 8311 0x056e, 8312 "cabengali", 8313 0x099a, 8314 "cacute", 8315 0x0107, 8316 "cadeva", 8317 0x091a, 8318 "cagujarati", 8319 0x0a9a, 8320 "cagurmukhi", 8321 0x0a1a, 8322 "calsquare", 8323 0x3388, 8324 "candrabindubengali", 8325 0x0981, 8326 "candrabinducmb", 8327 0x0310, 8328 "candrabindudeva", 8329 0x0901, 8330 "candrabindugujarati", 8331 0x0a81, 8332 "capslock", 8333 0x21ea, 8334 "careof", 8335 0x2105, 8336 "caron", 8337 0x02c7, 8338 "caronbelowcmb", 8339 0x032c, 8340 "caroncmb", 8341 0x030c, 8342 "carriagereturn", 8343 0x21b5, 8344 "cbopomofo", 8345 0x3118, 8346 "ccaron", 8347 0x010d, 8348 "ccedilla", 8349 0x00e7, 8350 "ccedillaacute", 8351 0x1e09, 8352 "ccircle", 8353 0x24d2, 8354 "ccircumflex", 8355 0x0109, 8356 "ccurl", 8357 0x0255, 8358 "cdot", 8359 0x010b, 8360 "cdotaccent", 8361 0x010b, 8362 "cdsquare", 8363 0x33c5, 8364 "cedilla", 8365 0x00b8, 8366 "cedillacmb", 8367 0x0327, 8368 "cent", 8369 0x00a2, 8370 "centigrade", 8371 0x2103, 8372 "centinferior", 8373 0xf6df, 8374 "centmonospace", 8375 0xffe0, 8376 "centoldstyle", 8377 0xf7a2, 8378 "centsuperior", 8379 0xf6e0, 8380 "chaarmenian", 8381 0x0579, 8382 "chabengali", 8383 0x099b, 8384 "chadeva", 8385 0x091b, 8386 "chagujarati", 8387 0x0a9b, 8388 "chagurmukhi", 8389 0x0a1b, 8390 "chbopomofo", 8391 0x3114, 8392 "cheabkhasiancyrillic", 8393 0x04bd, 8394 "checkmark", 8395 0x2713, 8396 "checyrillic", 8397 0x0447, 8398 "chedescenderabkhasiancyrillic", 8399 0x04bf, 8400 "chedescendercyrillic", 8401 0x04b7, 8402 "chedieresiscyrillic", 8403 0x04f5, 8404 "cheharmenian", 8405 0x0573, 8406 "chekhakassiancyrillic", 8407 0x04cc, 8408 "cheverticalstrokecyrillic", 8409 0x04b9, 8410 "chi", 8411 0x03c7, 8412 "chieuchacirclekorean", 8413 0x3277, 8414 "chieuchaparenkorean", 8415 0x3217, 8416 "chieuchcirclekorean", 8417 0x3269, 8418 "chieuchkorean", 8419 0x314a, 8420 "chieuchparenkorean", 8421 0x3209, 8422 "chochangthai", 8423 0x0e0a, 8424 "chochanthai", 8425 0x0e08, 8426 "chochingthai", 8427 0x0e09, 8428 "chochoethai", 8429 0x0e0c, 8430 "chook", 8431 0x0188, 8432 "cieucacirclekorean", 8433 0x3276, 8434 "cieucaparenkorean", 8435 0x3216, 8436 "cieuccirclekorean", 8437 0x3268, 8438 "cieuckorean", 8439 0x3148, 8440 "cieucparenkorean", 8441 0x3208, 8442 "cieucuparenkorean", 8443 0x321c, 8444 "circle", 8445 0x25cb, 8446 "circlecopyrt", 8447 0x00a9, 8448 "circlemultiply", 8449 0x2297, 8450 "circleot", 8451 0x2299, 8452 "circleplus",
8453 0x2295, 8454 "circlepostalmark", 8455 0x3036, 8456 "circlewithlefthalfblack", 8457 0x25d0, 8458 "circlewithrighthalfblack", 8459 0x25d1, 8460 "circumflex", 8461 0x02c6, 8462 "circumflexbelowcmb", 8463 0x032d, 8464 "circumflexcmb", 8465 0x0302, 8466 "clear", 8467 0x2327, 8468 "clickalveolar", 8469 0x01c2, 8470 "clickdental", 8471 0x01c0, 8472 "clicklateral", 8473 0x01c1, 8474 "clickretroflex", 8475 0x01c3, 8476 "club", 8477 0x2663, 8478 "clubsuitblack", 8479 0x2663, 8480 "clubsuitwhite", 8481 0x2667, 8482 "cmcubedsquare", 8483 0x33a4, 8484 "cmonospace", 8485 0xff43, 8486 "cmsquaredsquare", 8487 0x33a0, 8488 "coarmenian", 8489 0x0581, 8490 "colon", 8491 0x003a, 8492 "colonmonetary", 8493 0x20a1, 8494 "colonmonospace", 8495 0xff1a, 8496 "colonsign", 8497 0x20a1, 8498 "colonsmall", 8499 0xfe55, 8500 "colontriangularhalfmod", 8501 0x02d1, 8502 "colontriangularmod", 8503 0x02d0, 8504 "comma", 8505 0x002c, 8506 "commaabovecmb", 8507 0x0313, 8508 "commaaboverightcmb", 8509 0x0315, 8510 "commaaccent", 8511 0xf6c3, 8512 "commaarabic", 8513 0x060c, 8514 "commaarmenian", 8515 0x055d, 8516 "commainferior", 8517 0xf6e1, 8518 "commamonospace", 8519 0xff0c, 8520 "commareversedabovecmb", 8521 0x0314, 8522 "commareversedmod", 8523 0x02bd, 8524 "commasmall", 8525 0xfe50, 8526 "commasuperior", 8527 0xf6e2, 8528 "commaturnedabovecmb", 8529 0x0312, 8530 "commaturnedmod", 8531 0x02bb, 8532 "compass", 8533 0x263c, 8534 "congruent", 8535 0x2245, 8536 "contourintegral", 8537 0x222e, 8538 "control", 8539 0x2303, 8540 "controlACK", 8541 0x0006, 8542 "controlBEL", 8543 0x0007, 8544 "controlBS", 8545 0x0008, 8546 "controlCAN", 8547 0x0018, 8548 "controlCR", 8549 0x000d, 8550 "controlDC1", 8551 0x0011, 8552 "controlDC2", 8553 0x0012, 8554 "controlDC3", 8555 0x0013, 8556 "controlDC4", 8557 0x0014, 8558 "controlDEL", 8559 0x007f, 8560 "controlDLE", 8561 0x0010, 8562 "controlEM", 8563 0x0019, 8564 "controlENQ", 8565 0x0005, 8566 "controlEOT", 8567 0x0004, 8568 "controlESC", 8569 0x001b, 8570 "controlETB", 8571 0x0017, 8572 "controlETX", 8573 0x0003, 8574 "controlFF", 8575 0x000c, 8576 "controlFS", 8577 0x001c, 8578 "controlGS", 8579 0x001d, 8580 "controlHT", 8581 0x0009, 8582 "controlLF", 8583 0x000a, 8584 "controlNAK", 8585 0x0015, 8586 "controlNULL", 8587 0x0000, 8588 "controlRS", 8589 0x001e, 8590 "controlSI", 8591 0x000f, 8592 "controlSO", 8593 0x000e, 8594 "controlSOT", 8595 0x0002, 8596 "controlSTX", 8597 0x0001, 8598 "controlSUB", 8599 0x001a, 8600 "controlSYN", 8601 0x0016, 8602 "controlUS", 8603 0x001f, 8604 "controlVT", 8605 0x000b, 8606 "copyright", 8607 0x00a9, 8608 "copyrightsans", 8609 0xf8e9, 8610 "copyrightserif", 8611 0xf6d9, 8612 "cornerbracketleft", 8613 0x300c, 8614 "cornerbracketlefthalfwidth", 8615 0xff62, 8616 "cornerbracketleftvertical", 8617 0xfe41, 8618 "cornerbracketright", 8619 0x300d, 8620 "cornerbracketrighthalfwidth", 8621 0xff63, 8622 "cornerbracketrightvertical", 8623 0xfe42, 8624 "corporationsquare", 8625 0x337f, 8626 "cosquare", 8627 0x33c7, 8628 "coverkgsquare", 8629 0x33c6, 8630 "cparen", 8631 0x249e, 8632 "cruzeiro", 8633 0x20a2, 8634 "cstretched", 8635 0x0297, 8636 "curlyand", 8637 0x22cf, 8638 "curlyor", 8639 0x22ce, 8640 "currency", 8641 0x00a4, 8642 "cyrBreve", 8643 0xf6d1, 8644 "cyrFlex", 8645 0xf6d2, 8646 "cyrbreve", 8647 0xf6d4, 8648 "cyrflex", 8649 0xf6d5, 8650 "d", 8651 0x0064, 8652 "daarmenian", 8653 0x0564, 8654 "dabengali", 8655 0x09a6, 8656 "dadarabic", 8657 0x0636, 8658 "dadeva", 8659 0x0926, 8660 "dadfinalarabic", 8661 0xfebe, 8662 "dadinitialarabic", 8663 0xfebf, 8664 "dadmedialarabic", 8665 0xfec0, 8666 "dagesh", 8667 0x05bc, 8668 "dageshhebrew",
8669 0x05bc, 8670 "dagger", 8671 0x2020, 8672 "daggerdbl", 8673 0x2021, 8674 "dagujarati", 8675 0x0aa6, 8676 "dagurmukhi", 8677 0x0a26, 8678 "dahiragana", 8679 0x3060, 8680 "dakatakana", 8681 0x30c0, 8682 "dalarabic", 8683 0x062f, 8684 "dalet", 8685 0x05d3, 8686 "daletdagesh", 8687 0xfb33, 8688 "daletdageshhebrew", 8689 0xfb33, 8690 "dalethebrew", 8691 0x05d3, 8692 "dalfinalarabic", 8693 0xfeaa, 8694 "dammaarabic", 8695 0x064f, 8696 "dammalowarabic", 8697 0x064f, 8698 "dammatanaltonearabic", 8699 0x064c, 8700 "dammatanarabic", 8701 0x064c, 8702 "danda", 8703 0x0964, 8704 "dargahebrew", 8705 0x05a7, 8706 "dargalefthebrew", 8707 0x05a7, 8708 "dasiapneumatacyrilliccmb", 8709 0x0485, 8710 "dblGrave", 8711 0xf6d3, 8712 "dblanglebracketleft", 8713 0x300a, 8714 "dblanglebracketleftvertical", 8715 0xfe3d, 8716 "dblanglebracketright", 8717 0x300b, 8718 "dblanglebracketrightvertical", 8719 0xfe3e, 8720 "dblarchinvertedbelowcmb", 8721 0x032b, 8722 "dblarrowleft", 8723 0x21d4, 8724 "dblarrowright", 8725 0x21d2, 8726 "dbldanda", 8727 0x0965, 8728 "dblgrave", 8729 0xf6d6, 8730 "dblgravecmb", 8731 0x030f, 8732 "dblintegral", 8733 0x222c, 8734 "dbllowline", 8735 0x2017, 8736 "dbllowlinecmb", 8737 0x0333, 8738 "dbloverlinecmb", 8739 0x033f, 8740 "dblprimemod", 8741 0x02ba, 8742 "dblverticalbar", 8743 0x2016, 8744 "dblverticallineabovecmb", 8745 0x030e, 8746 "dbopomofo", 8747 0x3109, 8748 "dbsquare", 8749 0x33c8, 8750 "dcaron", 8751 0x010f, 8752 "dcedilla", 8753 0x1e11, 8754 "dcircle", 8755 0x24d3, 8756 "dcircumflexbelow", 8757 0x1e13, 8758 "dcroat", 8759 0x0111, 8760 "ddabengali", 8761 0x09a1, 8762 "ddadeva", 8763 0x0921, 8764 "ddagujarati", 8765 0x0aa1, 8766 "ddagurmukhi", 8767 0x0a21, 8768 "ddalarabic", 8769 0x0688, 8770 "ddalfinalarabic", 8771 0xfb89, 8772 "dddhadeva", 8773 0x095c, 8774 "ddhabengali", 8775 0x09a2, 8776 "ddhadeva", 8777 0x0922, 8778 "ddhagujarati", 8779 0x0aa2, 8780 "ddhagurmukhi", 8781 0x0a22, 8782 "ddotaccent", 8783 0x1e0b, 8784 "ddotbelow", 8785 0x1e0d, 8786 "decimalseparatorarabic", 8787 0x066b, 8788 "decimalseparatorpersian", 8789 0x066b, 8790 "decyrillic", 8791 0x0434, 8792 "degree", 8793 0x00b0, 8794 "dehihebrew", 8795 0x05ad, 8796 "dehiragana", 8797 0x3067, 8798 "deicoptic", 8799 0x03ef, 8800 "dekatakana", 8801 0x30c7, 8802 "deleteleft", 8803 0x232b, 8804 "deleteright", 8805 0x2326, 8806 "delta", 8807 0x03b4, 8808 "deltaturned", 8809 0x018d, 8810 "denominatorminusonenumeratorbengali", 8811 0x09f8, 8812 "dezh", 8813 0x02a4, 8814 "dhabengali", 8815 0x09a7, 8816 "dhadeva", 8817 0x0927, 8818 "dhagujarati", 8819 0x0aa7, 8820 "dhagurmukhi", 8821 0x0a27, 8822 "dhook", 8823 0x0257, 8824 "dialytikatonos", 8825 0x0385, 8826 "dialytikatonoscmb", 8827 0x0344, 8828 "diamond", 8829 0x2666, 8830 "diamondsuitwhite", 8831 0x2662, 8832 "dieresis", 8833 0x00a8, 8834 "dieresisacute", 8835 0xf6d7, 8836 "dieresisbelowcmb", 8837 0x0324, 8838 "dieresiscmb", 8839 0x0308, 8840 "dieresisgrave", 8841 0xf6d8, 8842 "dieresistonos", 8843 0x0385, 8844 "dihiragana", 8845 0x3062, 8846 "dikatakana", 8847 0x30c2, 8848 "dittomark", 8849 0x3003, 8850 "divide", 8851 0x00f7, 8852 "divides", 8853 0x2223, 8854 "divisionslash", 8855 0x2215, 8856 "djecyrillic", 8857 0x0452, 8858 "dkshade", 8859 0x2593, 8860 "dlinebelow", 8861 0x1e0f, 8862 "dlsquare", 8863 0x3397, 8864 "dmacron", 8865 0x0111, 8866 "dmonospace", 8867 0xff44, 8868 "dnblock", 8869 0x2584, 8870 "dochadathai", 8871 0x0e0e, 8872 "dodekthai", 8873 0x0e14, 8874 "dohiragana", 8875 0x3069, 8876 "dokatakana", 8877 0x30c9, 8878 "dollar", 8879 0x0024, 8880 "dollarinferior", 8881 0xf6e3, 8882 "dollarmonospace", 8883 0xff04, 8884 "dollaroldstyle", 8885 0xf724, 8886 "dollarsmall", 8887 0xfe69, 8888 "dollarsuperior", 8889 0xf6e4, 8890 "dong", 8891 0x20ab, 8892 "dorusquare", 8893 0x3326, 8894 "dotaccent", 8895 0x02d9, 8896 "dotaccentcmb", 8897 0x0307, 8898 "dotbelowcmb", 8899 0x0323, 8900 "dotbelowcomb", 8901 0x0323, 8902 "dotkatakana", 8903 0x30fb, 8904 "dotlessi", 8905 0x0131, 8906 "dotlessj", 8907 0xf6be, 8908 "dotlessjstrokehook", 8909 0x0284, 8910 "dotmath", 8911 0x22c5, 8912 "dottedcircle", 8913 0x25cc, 8914 "doubleyodpatah", 8915 0xfb1f, 8916 "doubleyodpatahhebrew",
8917 0xfb1f, 8918 "downtackbelowcmb", 8919 0x031e, 8920 "downtackmod", 8921 0x02d5, 8922 "dparen", 8923 0x249f, 8924 "dsuperior", 8925 0xf6eb, 8926 "dtail", 8927 0x0256, 8928 "dtopbar", 8929 0x018c, 8930 "duhiragana", 8931 0x3065, 8932 "dukatakana", 8933 0x30c5, 8934 "dz", 8935 0x01f3, 8936 "dzaltone", 8937 0x02a3, 8938 "dzcaron", 8939 0x01c6, 8940 "dzcurl", 8941 0x02a5, 8942 "dzeabkhasiancyrillic", 8943 0x04e1, 8944 "dzecyrillic", 8945 0x0455, 8946 "dzhecyrillic", 8947 0x045f, 8948 "e", 8949 0x0065, 8950 "eacute", 8951 0x00e9, 8952 "earth", 8953 0x2641, 8954 "ebengali", 8955 0x098f, 8956 "ebopomofo", 8957 0x311c, 8958 "ebreve", 8959 0x0115, 8960 "ecandradeva", 8961 0x090d, 8962 "ecandragujarati", 8963 0x0a8d, 8964 "ecandravowelsigndeva", 8965 0x0945, 8966 "ecandravowelsigngujarati", 8967 0x0ac5, 8968 "ecaron", 8969 0x011b, 8970 "ecedillabreve", 8971 0x1e1d, 8972 "echarmenian", 8973 0x0565, 8974 "echyiwnarmenian", 8975 0x0587, 8976 "ecircle", 8977 0x24d4, 8978 "ecircumflex", 8979 0x00ea, 8980 "ecircumflexacute", 8981 0x1ebf, 8982 "ecircumflexbelow", 8983 0x1e19, 8984 "ecircumflexdotbelow", 8985 0x1ec7, 8986 "ecircumflexgrave", 8987 0x1ec1, 8988 "ecircumflexhookabove", 8989 0x1ec3, 8990 "ecircumflextilde", 8991 0x1ec5, 8992 "ecyrillic", 8993 0x0454, 8994 "edblgrave", 8995 0x0205, 8996 "edeva", 8997 0x090f, 8998 "edieresis", 8999 0x00eb, 9000 "edot", 9001 0x0117, 9002 "edotaccent", 9003 0x0117, 9004 "edotbelow", 9005 0x1eb9, 9006 "eegurmukhi", 9007 0x0a0f, 9008 "eematragurmukhi", 9009 0x0a47, 9010 "efcyrillic", 9011 0x0444, 9012 "egrave", 9013 0x00e8, 9014 "egujarati", 9015 0x0a8f, 9016 "eharmenian", 9017 0x0567, 9018 "ehbopomofo", 9019 0x311d, 9020 "ehiragana", 9021 0x3048, 9022 "ehookabove", 9023 0x1ebb, 9024 "eibopomofo", 9025 0x311f, 9026 "eight", 9027 0x0038, 9028 "eightarabic", 9029 0x0668, 9030 "eightbengali", 9031 0x09ee, 9032 "eightcircle", 9033 0x2467, 9034 "eightcircleinversesansserif", 9035 0x2791, 9036 "eightdeva", 9037 0x096e, 9038 "eighteencircle", 9039 0x2471, 9040 "eighteenparen", 9041 0x2485, 9042 "eighteenperiod", 9043 0x2499, 9044 "eightgujarati", 9045 0x0aee, 9046 "eightgurmukhi", 9047 0x0a6e, 9048 "eighthackarabic", 9049 0x0668, 9050 "eighthangzhou", 9051 0x3028, 9052 "eighthnotebeamed", 9053 0x266b, 9054 "eightideographicparen", 9055 0x3227, 9056 "eightinferior", 9057 0x2088, 9058 "eightmonospace", 9059 0xff18, 9060 "eightoldstyle", 9061 0xf738, 9062 "eightparen", 9063 0x247b, 9064 "eightperiod", 9065 0x248f, 9066 "eightpersian", 9067 0x06f8, 9068 "eightroman", 9069 0x2177, 9070 "eightsuperior", 9071 0x2078, 9072 "eightthai", 9073 0x0e58, 9074 "einvertedbreve", 9075 0x0207, 9076 "eiotifiedcyrillic", 9077 0x0465, 9078 "ekatakana", 9079 0x30a8, 9080 "ekatakanahalfwidth", 9081 0xff74,
9082 "ekonkargurmukhi", 9083 0x0a74, 9084 "ekorean", 9085 0x3154, 9086 "elcyrillic", 9087 0x043b, 9088 "element", 9089 0x2208, 9090 "elevencircle", 9091 0x246a, 9092 "elevenparen", 9093 0x247e, 9094 "elevenperiod", 9095 0x2492, 9096 "elevenroman", 9097 0x217a, 9098 "ellipsis", 9099 0x2026, 9100 "ellipsisvertical", 9101 0x22ee, 9102 "emacron", 9103 0x0113, 9104 "emacronacute", 9105 0x1e17, 9106 "emacrongrave", 9107 0x1e15, 9108 "emcyrillic", 9109 0x043c, 9110 "emdash", 9111 0x2014, 9112 "emdashvertical", 9113 0xfe31, 9114 "emonospace", 9115 0xff45, 9116 "emphasismarkarmenian", 9117 0x055b, 9118 "emptyset", 9119 0x2205, 9120 "enbopomofo", 9121 0x3123, 9122 "encyrillic", 9123 0x043d, 9124 "endash", 9125 0x2013, 9126 "endashvertical", 9127 0xfe32, 9128 "endescendercyrillic", 9129 0x04a3, 9130 "eng", 9131 0x014b, 9132 "engbopomofo", 9133 0x3125, 9134 "enghecyrillic", 9135 0x04a5, 9136 "enhookcyrillic", 9137 0x04c8, 9138 "enspace", 9139 0x2002, 9140 "eogonek", 9141 0x0119, 9142 "eokorean", 9143 0x3153, 9144 "eopen", 9145 0x025b, 9146 "eopenclosed", 9147 0x029a, 9148 "eopenreversed", 9149 0x025c, 9150 "eopenreversedclosed", 9151 0x025e, 9152 "eopenreversedhook", 9153 0x025d, 9154 "eparen", 9155 0x24a0, 9156 "epsilon", 9157 0x03b5, 9158 "epsilontonos", 9159 0x03ad, 9160 "equal", 9161 0x003d, 9162 "equalmonospace", 9163 0xff1d, 9164 "equalsmall", 9165 0xfe66, 9166 "equalsuperior", 9167 0x207c, 9168 "equivalence", 9169 0x2261, 9170 "erbopomofo", 9171 0x3126, 9172 "ercyrillic", 9173 0x0440, 9174 "ereversed", 9175 0x0258, 9176 "ereversedcyrillic", 9177 0x044d, 9178 "escyrillic", 9179 0x0441, 9180 "esdescendercyrillic", 9181 0x04ab, 9182 "esh", 9183 0x0283, 9184 "eshcurl", 9185 0x0286, 9186 "eshortdeva", 9187 0x090e, 9188 "eshortvowelsigndeva", 9189 0x0946, 9190 "eshreversedloop", 9191 0x01aa, 9192 "eshsquatreversed", 9193 0x0285, 9194 "esmallhiragana", 9195 0x3047, 9196 "esmallkatakana", 9197 0x30a7, 9198 "esmallkatakanahalfwidth", 9199 0xff6a, 9200 "estimated", 9201 0x212e, 9202 "esuperior", 9203 0xf6ec, 9204 "eta", 9205 0x03b7, 9206 "etarmenian", 9207 0x0568, 9208 "etatonos", 9209 0x03ae, 9210 "eth", 9211 0x00f0, 9212 "etilde", 9213 0x1ebd, 9214 "etildebelow", 9215 0x1e1b, 9216 "etnahtafoukhhebrew",
9217 0x0591, 9218 "etnahtafoukhlefthebrew", 9219 0x0591, 9220 "etnahtahebrew", 9221 0x0591, 9222 "etnahtalefthebrew", 9223 0x0591, 9224 "eturned", 9225 0x01dd, 9226 "eukorean", 9227 0x3161, 9228 "euro", 9229 0x20ac, 9230 "evowelsignbengali", 9231 0x09c7, 9232 "evowelsigndeva", 9233 0x0947, 9234 "evowelsigngujarati", 9235 0x0ac7, 9236 "exclam", 9237 0x0021, 9238 "exclamarmenian", 9239 0x055c, 9240 "exclamdbl", 9241 0x203c, 9242 "exclamdown", 9243 0x00a1, 9244 "exclamdownsmall", 9245 0xf7a1, 9246 "exclammonospace", 9247 0xff01, 9248 "exclamsmall", 9249 0xf721, 9250 "existential", 9251 0x2203, 9252 "ezh", 9253 0x0292, 9254 "ezhcaron", 9255 0x01ef, 9256 "ezhcurl", 9257 0x0293, 9258 "ezhreversed", 9259 0x01b9, 9260 "ezhtail", 9261 0x01ba, 9262 "f", 9263 0x0066, 9264 "fadeva", 9265 0x095e, 9266 "fagurmukhi", 9267 0x0a5e, 9268 "fahrenheit", 9269 0x2109, 9270 "fathaarabic", 9271 0x064e, 9272 "fathalowarabic", 9273 0x064e, 9274 "fathatanarabic", 9275 0x064b, 9276 "fbopomofo", 9277 0x3108, 9278 "fcircle", 9279 0x24d5, 9280 "fdotaccent", 9281 0x1e1f, 9282 "feharabic", 9283 0x0641, 9284 "feharmenian", 9285 0x0586, 9286 "fehfinalarabic", 9287 0xfed2, 9288 "fehinitialarabic", 9289 0xfed3, 9290 "fehmedialarabic", 9291 0xfed4, 9292 "feicoptic", 9293 0x03e5, 9294 "female", 9295 0x2640, 9296 "ff", 9297 0xfb00, 9298 "f_f", 9299 0xfb00, 9300 "ffi", 9301 0xfb03, 9302 "ffl", 9303 0xfb04, 9304 "fi", 9305 0xfb01, 9306 "fifteencircle", 9307 0x246e, 9308 "fifteenparen", 9309 0x2482, 9310 "fifteenperiod", 9311 0x2496, 9312 "figuredash", 9313 0x2012, 9314 "filledbox", 9315 0x25a0, 9316 "filledrect", 9317 0x25ac, 9318 "finalkaf", 9319 0x05da, 9320 "finalkafdagesh", 9321 0xfb3a, 9322 "finalkafdageshhebrew",
9323 0xfb3a, 9324 "finalkafhebrew", 9325 0x05da, 9326 "finalmem", 9327 0x05dd, 9328 "finalmemhebrew", 9329 0x05dd, 9330 "finalnun", 9331 0x05df, 9332 "finalnunhebrew", 9333 0x05df, 9334 "finalpe", 9335 0x05e3, 9336 "finalpehebrew", 9337 0x05e3, 9338 "finaltsadi", 9339 0x05e5, 9340 "finaltsadihebrew", 9341 0x05e5, 9342 "firsttonechinese", 9343 0x02c9, 9344 "fisheye", 9345 0x25c9, 9346 "fitacyrillic", 9347 0x0473, 9348 "five", 9349 0x0035, 9350 "fivearabic", 9351 0x0665, 9352 "fivebengali", 9353 0x09eb, 9354 "fivecircle", 9355 0x2464, 9356 "fivecircleinversesansserif", 9357 0x278e, 9358 "fivedeva", 9359 0x096b, 9360 "fiveeighths", 9361 0x215d, 9362 "fivegujarati", 9363 0x0aeb, 9364 "fivegurmukhi", 9365 0x0a6b, 9366 "fivehackarabic", 9367 0x0665, 9368 "fivehangzhou", 9369 0x3025, 9370 "fiveideographicparen", 9371 0x3224, 9372 "fiveinferior", 9373 0x2085, 9374 "fivemonospace", 9375 0xff15, 9376 "fiveoldstyle", 9377 0xf735, 9378 "fiveparen", 9379 0x2478, 9380 "fiveperiod", 9381 0x248c, 9382 "fivepersian", 9383 0x06f5, 9384 "fiveroman", 9385 0x2174, 9386 "fivesuperior", 9387 0x2075, 9388 "fivethai", 9389 0x0e55, 9390 "fl", 9391 0xfb02, 9392 "florin", 9393 0x0192, 9394 "fmonospace", 9395 0xff46, 9396 "fmsquare", 9397 0x3399, 9398 "fofanthai", 9399 0x0e1f, 9400 "fofathai", 9401 0x0e1d, 9402 "fongmanthai", 9403 0x0e4f, 9404 "forall", 9405 0x2200, 9406 "four", 9407 0x0034, 9408 "fourarabic", 9409 0x0664, 9410 "fourbengali", 9411 0x09ea, 9412 "fourcircle", 9413 0x2463, 9414 "fourcircleinversesansserif", 9415 0x278d, 9416 "fourdeva", 9417 0x096a, 9418 "fourgujarati", 9419 0x0aea, 9420 "fourgurmukhi", 9421 0x0a6a, 9422 "fourhackarabic", 9423 0x0664, 9424 "fourhangzhou", 9425 0x3024, 9426 "fourideographicparen", 9427 0x3223, 9428 "fourinferior", 9429 0x2084, 9430 "fourmonospace", 9431 0xff14, 9432 "fournumeratorbengali", 9433 0x09f7, 9434 "fouroldstyle", 9435 0xf734, 9436 "fourparen", 9437 0x2477, 9438 "fourperiod", 9439 0x248b, 9440 "fourpersian", 9441 0x06f4, 9442 "fourroman", 9443 0x2173, 9444 "foursuperior", 9445 0x2074, 9446 "fourteencircle", 9447 0x246d, 9448 "fourteenparen", 9449 0x2481, 9450 "fourteenperiod", 9451 0x2495, 9452 "fourthai", 9453 0x0e54, 9454 "fourthtonechinese", 9455 0x02cb, 9456 "fparen", 9457 0x24a1, 9458 "fraction", 9459 0x2044, 9460 "franc", 9461 0x20a3, 9462 "g", 9463 0x0067, 9464 "gabengali", 9465 0x0997, 9466 "gacute", 9467 0x01f5, 9468 "gadeva", 9469 0x0917, 9470 "gafarabic", 9471 0x06af, 9472 "gaffinalarabic", 9473 0xfb93, 9474 "gafinitialarabic", 9475 0xfb94, 9476 "gafmedialarabic", 9477 0xfb95, 9478 "gagujarati", 9479 0x0a97, 9480 "gagurmukhi", 9481 0x0a17, 9482 "gahiragana", 9483 0x304c, 9484 "gakatakana", 9485 0x30ac, 9486 "gamma", 9487 0x03b3, 9488 "gammalatinsmall", 9489 0x0263, 9490 "gammasuperior", 9491 0x02e0, 9492 "gangiacoptic", 9493 0x03eb, 9494 "gbopomofo", 9495 0x310d, 9496 "gbreve", 9497 0x011f, 9498 "gcaron", 9499 0x01e7, 9500 "gcedilla", 9501 0x0123, 9502 "gcircle", 9503 0x24d6, 9504 "gcircumflex", 9505 0x011d, 9506 "gcommaaccent", 9507 0x0123, 9508 "gdot", 9509 0x0121, 9510 "gdotaccent", 9511 0x0121, 9512 "gecyrillic", 9513 0x0433, 9514 "gehiragana", 9515 0x3052, 9516 "gekatakana", 9517 0x30b2, 9518 "geometricallyequal", 9519 0x2251, 9520 "gereshaccenthebrew", 9521 0x059c, 9522 "gereshhebrew",
9523 0x05f3, 9524 "gereshmuqdamhebrew", 9525 0x059d, 9526 "germandbls", 9527 0x00df, 9528 "gershayimaccenthebrew", 9529 0x059e, 9530 "gershayimhebrew", 9531 0x05f4, 9532 "getamark", 9533 0x3013, 9534 "ghabengali", 9535 0x0998, 9536 "ghadarmenian", 9537 0x0572, 9538 "ghadeva", 9539 0x0918, 9540 "ghagujarati", 9541 0x0a98, 9542 "ghagurmukhi", 9543 0x0a18, 9544 "ghainarabic", 9545 0x063a, 9546 "ghainfinalarabic", 9547 0xfece, 9548 "ghaininitialarabic", 9549 0xfecf, 9550 "ghainmedialarabic", 9551 0xfed0, 9552 "ghemiddlehookcyrillic", 9553 0x0495, 9554 "ghestrokecyrillic", 9555 0x0493, 9556 "gheupturncyrillic", 9557 0x0491, 9558 "ghhadeva", 9559 0x095a, 9560 "ghhagurmukhi", 9561 0x0a5a, 9562 "ghook", 9563 0x0260, 9564 "ghzsquare", 9565 0x3393, 9566 "gihiragana", 9567 0x304e, 9568 "gikatakana", 9569 0x30ae, 9570 "gimarmenian", 9571 0x0563, 9572 "gimel", 9573 0x05d2, 9574 "gimeldagesh", 9575 0xfb32, 9576 "gimeldageshhebrew", 9577 0xfb32, 9578 "gimelhebrew", 9579 0x05d2, 9580 "gjecyrillic", 9581 0x0453, 9582 "glottalinvertedstroke", 9583 0x01be, 9584 "glottalstop", 9585 0x0294, 9586 "glottalstopinverted", 9587 0x0296, 9588 "glottalstopmod", 9589 0x02c0, 9590 "glottalstopreversed", 9591 0x0295, 9592 "glottalstopreversedmod", 9593 0x02c1, 9594 "glottalstopreversedsuperior", 9595 0x02e4, 9596 "glottalstopstroke", 9597 0x02a1, 9598 "glottalstopstrokereversed", 9599 0x02a2, 9600 "gmacron", 9601 0x1e21, 9602 "gmonospace", 9603 0xff47, 9604 "gohiragana", 9605 0x3054, 9606 "gokatakana", 9607 0x30b4, 9608 "gparen", 9609 0x24a2, 9610 "gpasquare", 9611 0x33ac, 9612 "gradient", 9613 0x2207, 9614 "grave", 9615 0x0060, 9616 "gravebelowcmb", 9617 0x0316, 9618 "gravecmb", 9619 0x0300, 9620 "gravecomb", 9621 0x0300, 9622 "gravedeva", 9623 0x0953, 9624 "gravelowmod", 9625 0x02ce, 9626 "gravemonospace", 9627 0xff40, 9628 "gravetonecmb", 9629 0x0340, 9630 "greater", 9631 0x003e, 9632 "greaterequal", 9633 0x2265, 9634 "greaterequalorless", 9635 0x22db, 9636 "greatermonospace", 9637 0xff1e, 9638 "greaterorequivalent", 9639 0x2273, 9640 "greaterorless", 9641 0x2277, 9642 "greateroverequal", 9643 0x2267, 9644 "greatersmall", 9645 0xfe65, 9646 "gscript", 9647 0x0261, 9648 "gstroke", 9649 0x01e5, 9650 "guhiragana", 9651 0x3050, 9652 "guillemotleft", 9653 0x00ab, 9654 "guillemotright", 9655 0x00bb, 9656 "guilsinglleft", 9657 0x2039, 9658 "guilsinglright", 9659 0x203a, 9660 "gukatakana", 9661 0x30b0, 9662 "guramusquare", 9663 0x3318, 9664 "gysquare", 9665 0x33c9, 9666 "h", 9667 0x0068, 9668 "haabkhasiancyrillic", 9669 0x04a9, 9670 "haaltonearabic", 9671 0x06c1, 9672 "habengali", 9673 0x09b9, 9674 "hadescendercyrillic", 9675 0x04b3, 9676 "hadeva", 9677 0x0939, 9678 "hagujarati", 9679 0x0ab9, 9680 "hagurmukhi", 9681 0x0a39, 9682 "haharabic", 9683 0x062d, 9684 "hahfinalarabic", 9685 0xfea2, 9686 "hahinitialarabic", 9687 0xfea3, 9688 "hahiragana", 9689 0x306f, 9690 "hahmedialarabic", 9691 0xfea4, 9692 "haitusquare", 9693 0x332a, 9694 "hakatakana", 9695 0x30cf, 9696 "hakatakanahalfwidth", 9697 0xff8a, 9698 "halantgurmukhi", 9699 0x0a4d, 9700 "hamzaarabic", 9701 0x0621, 9702 "hamzalowarabic", 9703 0x0621, 9704 "hangulfiller", 9705 0x3164, 9706 "hardsigncyrillic", 9707 0x044a, 9708 "harpoonleftbarbup", 9709 0x21bc, 9710 "harpoonrightbarbup", 9711 0x21c0, 9712 "hasquare", 9713 0x33ca, 9714 "hatafpatah", 9715 0x05b2, 9716 "hatafpatah16", 9717 0x05b2, 9718 "hatafpatah23", 9719 0x05b2, 9720 "hatafpatah2f", 9721 0x05b2, 9722 "hatafpatahhebrew",
9723 0x05b2, 9724 "hatafpatahnarrowhebrew", 9725 0x05b2, 9726 "hatafpatahquarterhebrew", 9727 0x05b2, 9728 "hatafpatahwidehebrew", 9729 0x05b2, 9730 "hatafqamats", 9731 0x05b3, 9732 "hatafqamats1b", 9733 0x05b3, 9734 "hatafqamats28", 9735 0x05b3, 9736 "hatafqamats34", 9737 0x05b3, 9738 "hatafqamatshebrew", 9739 0x05b3, 9740 "hatafqamatsnarrowhebrew", 9741 0x05b3, 9742 "hatafqamatsquarterhebrew", 9743 0x05b3, 9744 "hatafqamatswidehebrew", 9745 0x05b3, 9746 "hatafsegol", 9747 0x05b1, 9748 "hatafsegol17", 9749 0x05b1, 9750 "hatafsegol24", 9751 0x05b1, 9752 "hatafsegol30", 9753 0x05b1, 9754 "hatafsegolhebrew", 9755 0x05b1, 9756 "hatafsegolnarrowhebrew", 9757 0x05b1, 9758 "hatafsegolquarterhebrew", 9759 0x05b1, 9760 "hatafsegolwidehebrew", 9761 0x05b1, 9762 "hbar", 9763 0x0127, 9764 "hbopomofo", 9765 0x310f, 9766 "hbrevebelow", 9767 0x1e2b, 9768 "hcedilla", 9769 0x1e29, 9770 "hcircle", 9771 0x24d7, 9772 "hcircumflex", 9773 0x0125, 9774 "hdieresis", 9775 0x1e27, 9776 "hdotaccent", 9777 0x1e23, 9778 "hdotbelow", 9779 0x1e25, 9780 "he", 9781 0x05d4, 9782 "heart", 9783 0x2665, 9784 "heartsuitblack", 9785 0x2665, 9786 "heartsuitwhite", 9787 0x2661, 9788 "hedagesh", 9789 0xfb34, 9790 "hedageshhebrew", 9791 0xfb34, 9792 "hehaltonearabic", 9793 0x06c1, 9794 "heharabic", 9795 0x0647, 9796 "hehebrew", 9797 0x05d4, 9798 "hehfinalaltonearabic", 9799 0xfba7, 9800 "hehfinalalttwoarabic", 9801 0xfeea, 9802 "hehfinalarabic", 9803 0xfeea, 9804 "hehhamzaabovefinalarabic", 9805 0xfba5, 9806 "hehhamzaaboveisolatedarabic", 9807 0xfba4, 9808 "hehinitialaltonearabic", 9809 0xfba8, 9810 "hehinitialarabic", 9811 0xfeeb, 9812 "hehiragana", 9813 0x3078, 9814 "hehmedialaltonearabic", 9815 0xfba9, 9816 "hehmedialarabic", 9817 0xfeec, 9818 "heiseierasquare", 9819 0x337b, 9820 "hekatakana", 9821 0x30d8, 9822 "hekatakanahalfwidth", 9823 0xff8d, 9824 "hekutaarusquare", 9825 0x3336, 9826 "henghook", 9827 0x0267, 9828 "herutusquare", 9829 0x3339, 9830 "het", 9831 0x05d7, 9832 "hethebrew", 9833 0x05d7, 9834 "hhook", 9835 0x0266, 9836 "hhooksuperior", 9837 0x02b1, 9838 "hieuhacirclekorean", 9839 0x327b, 9840 "hieuhaparenkorean", 9841 0x321b, 9842 "hieuhcirclekorean", 9843 0x326d, 9844 "hieuhkorean", 9845 0x314e, 9846 "hieuhparenkorean", 9847 0x320d, 9848 "hihiragana", 9849 0x3072, 9850 "hikatakana", 9851 0x30d2, 9852 "hikatakanahalfwidth", 9853 0xff8b, 9854 "hiriq", 9855 0x05b4, 9856 "hiriq14", 9857 0x05b4, 9858 "hiriq21", 9859 0x05b4, 9860 "hiriq2d", 9861 0x05b4, 9862 "hiriqhebrew", 9863 0x05b4, 9864 "hiriqnarrowhebrew", 9865 0x05b4, 9866 "hiriqquarterhebrew", 9867 0x05b4, 9868 "hiriqwidehebrew", 9869 0x05b4, 9870 "hlinebelow", 9871 0x1e96, 9872 "hmonospace", 9873 0xff48, 9874 "hoarmenian", 9875 0x0570, 9876 "hohipthai", 9877 0x0e2b, 9878 "hohiragana", 9879 0x307b, 9880 "hokatakana", 9881 0x30db, 9882 "hokatakanahalfwidth", 9883 0xff8e, 9884 "holam", 9885 0x05b9, 9886 "holam19", 9887 0x05b9, 9888 "holam26", 9889 0x05b9, 9890 "holam32", 9891 0x05b9, 9892 "holamhebrew", 9893 0x05b9, 9894 "holamnarrowhebrew", 9895 0x05b9, 9896 "holamquarterhebrew", 9897 0x05b9, 9898 "holamwidehebrew", 9899 0x05b9, 9900 "honokhukthai", 9901 0x0e2e, 9902 "hookabovecomb", 9903 0x0309, 9904 "hookcmb", 9905 0x0309, 9906 "hookpalatalizedbelowcmb", 9907 0x0321, 9908 "hookretroflexbelowcmb", 9909 0x0322, 9910 "hoonsquare", 9911 0x3342, 9912 "horicoptic", 9913 0x03e9, 9914 "horizontalbar", 9915 0x2015, 9916 "horncmb", 9917 0x031b, 9918 "hotsprings", 9919 0x2668, 9920 "house", 9921 0x2302, 9922 "hparen", 9923 0x24a3, 9924 "hsuperior", 9925 0x02b0, 9926 "hturned", 9927 0x0265, 9928 "huhiragana", 9929 0x3075, 9930 "huiitosquare", 9931 0x3333, 9932 "hukatakana", 9933 0x30d5, 9934 "hukatakanahalfwidth", 9935 0xff8c, 9936 "hungarumlaut", 9937 0x02dd, 9938 "hungarumlautcmb", 9939 0x030b, 9940 "hv", 9941 0x0195, 9942 "hyphen", 9943 0x002d, 9944 "hypheninferior", 9945 0xf6e5, 9946 "hyphenmonospace", 9947 0xff0d, 9948 "hyphensmall", 9949 0xfe63, 9950 "hyphensuperior", 9951 0xf6e6, 9952 "hyphentwo", 9953 0x2010, 9954 "i", 9955 0x0069, 9956 "iacute", 9957 0x00ed, 9958 "iacyrillic", 9959 0x044f, 9960 "ibengali", 9961 0x0987, 9962 "ibopomofo", 9963 0x3127, 9964 "ibreve", 9965 0x012d, 9966 "icaron", 9967 0x01d0, 9968 "icircle", 9969 0x24d8, 9970 "icircumflex", 9971 0x00ee, 9972 "icyrillic", 9973 0x0456, 9974 "idblgrave", 9975 0x0209, 9976 "ideographearthcircle", 9977 0x328f, 9978 "ideographfirecircle", 9979 0x328b, 9980 "ideographicallianceparen", 9981 0x323f, 9982 "ideographiccallparen", 9983 0x323a, 9984 "ideographiccentrecircle", 9985 0x32a5, 9986 "ideographicclose", 9987 0x3006, 9988 "ideographiccomma", 9989 0x3001, 9990 "ideographiccommaleft", 9991 0xff64, 9992 "ideographiccongratulationparen", 9993 0x3237, 9994 "ideographiccorrectcircle", 9995 0x32a3, 9996 "ideographicearthparen", 9997 0x322f, 9998 "ideographicenterpriseparen", 9999 0x323d, 10000 "ideographicexcellentcircle", 10001 0x329d, 10002 "ideographicfestivalparen", 10003 0x3240, 10004 "ideographicfinancialcircle", 10005 0x3296, 10006 "ideographicfinancialparen", 10007 0x3236, 10008 "ideographicfireparen", 10009 0x322b, 10010 "ideographichaveparen", 10011 0x3232, 10012 "ideographichighcircle", 10013 0x32a4, 10014 "ideographiciterationmark", 10015 0x3005, 10016 "ideographiclaborcircle", 10017 0x3298, 10018 "ideographiclaborparen", 10019 0x3238, 10020 "ideographicleftcircle", 10021 0x32a7, 10022 "ideographiclowcircle", 10023 0x32a6, 10024 "ideographicmedicinecircle", 10025 0x32a9, 10026 "ideographicmetalparen", 10027 0x322e, 10028 "ideographicmoonparen", 10029 0x322a, 10030 "ideographicnameparen", 10031 0x3234, 10032 "ideographicperiod", 10033 0x3002, 10034 "ideographicprintcircle", 10035 0x329e, 10036 "ideographicreachparen", 10037 0x3243, 10038 "ideographicrepresentparen", 10039 0x3239, 10040 "ideographicresourceparen", 10041 0x323e, 10042 "ideographicrightcircle", 10043 0x32a8,
10044 "ideographicsecretcircle", 10045 0x3299, 10046 "ideographicselfparen", 10047 0x3242, 10048 "ideographicsocietyparen", 10049 0x3233, 10050 "ideographicspace", 10051 0x3000, 10052 "ideographicspecialparen", 10053 0x3235, 10054 "ideographicstockparen", 10055 0x3231, 10056 "ideographicstudyparen", 10057 0x323b, 10058 "ideographicsunparen", 10059 0x3230, 10060 "ideographicsuperviseparen", 10061 0x323c, 10062 "ideographicwaterparen", 10063 0x322c, 10064 "ideographicwoodparen", 10065 0x322d, 10066 "ideographiczero", 10067 0x3007, 10068 "ideographmetalcircle", 10069 0x328e, 10070 "ideographmooncircle", 10071 0x328a, 10072 "ideographnamecircle", 10073 0x3294, 10074 "ideographsuncircle", 10075 0x3290, 10076 "ideographwatercircle", 10077 0x328c, 10078 "ideographwoodcircle", 10079 0x328d, 10080 "ideva", 10081 0x0907, 10082 "idieresis", 10083 0x00ef, 10084 "idieresisacute", 10085 0x1e2f, 10086 "idieresiscyrillic", 10087 0x04e5, 10088 "idotbelow", 10089 0x1ecb, 10090 "iebrevecyrillic", 10091 0x04d7, 10092 "iecyrillic", 10093 0x0435, 10094 "ieungacirclekorean", 10095 0x3275, 10096 "ieungaparenkorean", 10097 0x3215, 10098 "ieungcirclekorean", 10099 0x3267, 10100 "ieungkorean", 10101 0x3147, 10102 "ieungparenkorean", 10103 0x3207, 10104 "igrave", 10105 0x00ec, 10106 "igujarati", 10107 0x0a87, 10108 "igurmukhi", 10109 0x0a07, 10110 "ihiragana", 10111 0x3044, 10112 "ihookabove", 10113 0x1ec9, 10114 "iibengali", 10115 0x0988, 10116 "iicyrillic", 10117 0x0438, 10118 "iideva", 10119 0x0908, 10120 "iigujarati", 10121 0x0a88, 10122 "iigurmukhi", 10123 0x0a08, 10124 "iimatragurmukhi", 10125 0x0a40, 10126 "iinvertedbreve", 10127 0x020b, 10128 "iishortcyrillic", 10129 0x0439, 10130 "iivowelsignbengali", 10131 0x09c0, 10132 "iivowelsigndeva", 10133 0x0940, 10134 "iivowelsigngujarati", 10135 0x0ac0, 10136 "ij", 10137 0x0133, 10138 "ikatakana", 10139 0x30a4, 10140 "ikatakanahalfwidth", 10141 0xff72, 10142 "ikorean", 10143 0x3163, 10144 "ilde", 10145 0x02dc, 10146 "iluyhebrew",
10147 0x05ac, 10148 "imacron", 10149 0x012b, 10150 "imacroncyrillic", 10151 0x04e3, 10152 "imageorapproximatelyequal", 10153 0x2253, 10154 "imatragurmukhi", 10155 0x0a3f, 10156 "imonospace", 10157 0xff49, 10158 "increment", 10159 0x2206, 10160 "infinity", 10161 0x221e, 10162 "iniarmenian", 10163 0x056b, 10164 "integral", 10165 0x222b, 10166 "integralbottom", 10167 0x2321, 10168 "integralbt", 10169 0x2321, 10170 "integralex", 10171 0xf8f5, 10172 "integraltop", 10173 0x2320, 10174 "integraltp", 10175 0x2320, 10176 "intersection", 10177 0x2229, 10178 "intisquare", 10179 0x3305, 10180 "invbullet", 10181 0x25d8, 10182 "invcircle", 10183 0x25d9, 10184 "invsmileface", 10185 0x263b, 10186 "iocyrillic", 10187 0x0451, 10188 "iogonek", 10189 0x012f, 10190 "iota", 10191 0x03b9, 10192 "iotadieresis", 10193 0x03ca, 10194 "iotadieresistonos", 10195 0x0390, 10196 "iotalatin", 10197 0x0269, 10198 "iotatonos", 10199 0x03af, 10200 "iparen", 10201 0x24a4, 10202 "irigurmukhi", 10203 0x0a72, 10204 "ismallhiragana", 10205 0x3043, 10206 "ismallkatakana", 10207 0x30a3, 10208 "ismallkatakanahalfwidth", 10209 0xff68, 10210 "issharbengali", 10211 0x09fa, 10212 "istroke", 10213 0x0268, 10214 "isuperior", 10215 0xf6ed, 10216 "iterationhiragana", 10217 0x309d, 10218 "iterationkatakana", 10219 0x30fd, 10220 "itilde", 10221 0x0129, 10222 "itildebelow", 10223 0x1e2d, 10224 "iubopomofo", 10225 0x3129, 10226 "iucyrillic", 10227 0x044e, 10228 "ivowelsignbengali", 10229 0x09bf, 10230 "ivowelsigndeva", 10231 0x093f, 10232 "ivowelsigngujarati", 10233 0x0abf, 10234 "izhitsacyrillic", 10235 0x0475, 10236 "izhitsadblgravecyrillic", 10237 0x0477, 10238 "j", 10239 0x006a, 10240 "jaarmenian", 10241 0x0571, 10242 "jabengali", 10243 0x099c, 10244 "jadeva", 10245 0x091c, 10246 "jagujarati", 10247 0x0a9c, 10248 "jagurmukhi", 10249 0x0a1c, 10250 "jbopomofo", 10251 0x3110, 10252 "jcaron", 10253 0x01f0, 10254 "jcircle", 10255 0x24d9, 10256 "jcircumflex", 10257 0x0135, 10258 "jcrossedtail", 10259 0x029d, 10260 "jdotlessstroke", 10261 0x025f, 10262 "jecyrillic", 10263 0x0458, 10264 "jeemarabic", 10265 0x062c, 10266 "jeemfinalarabic", 10267 0xfe9e, 10268 "jeeminitialarabic", 10269 0xfe9f, 10270 "jeemmedialarabic", 10271 0xfea0, 10272 "jeharabic", 10273 0x0698, 10274 "jehfinalarabic", 10275 0xfb8b, 10276 "jhabengali", 10277 0x099d, 10278 "jhadeva", 10279 0x091d, 10280 "jhagujarati", 10281 0x0a9d, 10282 "jhagurmukhi", 10283 0x0a1d, 10284 "jheharmenian", 10285 0x057b, 10286 "jis", 10287 0x3004, 10288 "jmonospace", 10289 0xff4a, 10290 "jparen", 10291 0x24a5, 10292 "jsuperior", 10293 0x02b2, 10294 "k", 10295 0x006b, 10296 "kabashkircyrillic", 10297 0x04a1, 10298 "kabengali", 10299 0x0995, 10300 "kacute", 10301 0x1e31, 10302 "kacyrillic", 10303 0x043a, 10304 "kadescendercyrillic", 10305 0x049b, 10306 "kadeva", 10307 0x0915, 10308 "kaf", 10309 0x05db, 10310 "kafarabic", 10311 0x0643, 10312 "kafdagesh", 10313 0xfb3b, 10314 "kafdageshhebrew",
10315 0xfb3b, 10316 "kaffinalarabic", 10317 0xfeda, 10318 "kafhebrew", 10319 0x05db, 10320 "kafinitialarabic", 10321 0xfedb, 10322 "kafmedialarabic", 10323 0xfedc, 10324 "kafrafehebrew", 10325 0xfb4d, 10326 "kagujarati", 10327 0x0a95, 10328 "kagurmukhi", 10329 0x0a15, 10330 "kahiragana", 10331 0x304b, 10332 "kahookcyrillic", 10333 0x04c4, 10334 "kakatakana", 10335 0x30ab, 10336 "kakatakanahalfwidth", 10337 0xff76, 10338 "kappa", 10339 0x03ba, 10340 "kappasymbolgreek", 10341 0x03f0, 10342 "kapyeounmieumkorean", 10343 0x3171, 10344 "kapyeounphieuphkorean", 10345 0x3184, 10346 "kapyeounpieupkorean", 10347 0x3178, 10348 "kapyeounssangpieupkorean", 10349 0x3179, 10350 "karoriisquare", 10351 0x330d, 10352 "kashidaautoarabic", 10353 0x0640, 10354 "kashidaautonosidebearingarabic", 10355 0x0640, 10356 "kasmallkatakana", 10357 0x30f5, 10358 "kasquare", 10359 0x3384, 10360 "kasraarabic", 10361 0x0650, 10362 "kasratanarabic", 10363 0x064d, 10364 "kastrokecyrillic", 10365 0x049f, 10366 "katahiraprolongmarkhalfwidth", 10367 0xff70, 10368 "kaverticalstrokecyrillic", 10369 0x049d, 10370 "kbopomofo", 10371 0x310e, 10372 "kcalsquare", 10373 0x3389, 10374 "kcaron", 10375 0x01e9, 10376 "kcedilla", 10377 0x0137, 10378 "kcircle", 10379 0x24da, 10380 "kcommaaccent", 10381 0x0137, 10382 "kdotbelow", 10383 0x1e33, 10384 "keharmenian", 10385 0x0584, 10386 "kehiragana", 10387 0x3051, 10388 "kekatakana", 10389 0x30b1, 10390 "kekatakanahalfwidth", 10391 0xff79, 10392 "kenarmenian", 10393 0x056f, 10394 "kesmallkatakana", 10395 0x30f6, 10396 "kgreenlandic", 10397 0x0138, 10398 "khabengali", 10399 0x0996, 10400 "khacyrillic", 10401 0x0445, 10402 "khadeva", 10403 0x0916, 10404 "khagujarati", 10405 0x0a96, 10406 "khagurmukhi", 10407 0x0a16, 10408 "khaharabic", 10409 0x062e, 10410 "khahfinalarabic", 10411 0xfea6, 10412 "khahinitialarabic", 10413 0xfea7, 10414 "khahmedialarabic", 10415 0xfea8, 10416 "kheicoptic", 10417 0x03e7, 10418 "khhadeva", 10419 0x0959, 10420 "khhagurmukhi", 10421 0x0a59, 10422 "khieukhacirclekorean", 10423 0x3278, 10424 "khieukhaparenkorean", 10425 0x3218, 10426 "khieukhcirclekorean", 10427 0x326a, 10428 "khieukhkorean", 10429 0x314b, 10430 "khieukhparenkorean", 10431 0x320a, 10432 "khokhaithai", 10433 0x0e02, 10434 "khokhonthai", 10435 0x0e05, 10436 "khokhuatthai", 10437 0x0e03, 10438 "khokhwaithai", 10439 0x0e04, 10440 "khomutthai", 10441 0x0e5b, 10442 "khook", 10443 0x0199, 10444 "khorakhangthai", 10445 0x0e06, 10446 "khzsquare", 10447 0x3391, 10448 "kihiragana", 10449 0x304d, 10450 "kikatakana", 10451 0x30ad, 10452 "kikatakanahalfwidth", 10453 0xff77, 10454 "kiroguramusquare", 10455 0x3315, 10456 "kiromeetorusquare", 10457 0x3316, 10458 "kirosquare", 10459 0x3314, 10460 "kiyeokacirclekorean", 10461 0x326e, 10462 "kiyeokaparenkorean", 10463 0x320e, 10464 "kiyeokcirclekorean", 10465 0x3260, 10466 "kiyeokkorean", 10467 0x3131, 10468 "kiyeokparenkorean", 10469 0x3200, 10470 "kiyeoksioskorean", 10471 0x3133, 10472 "kjecyrillic", 10473 0x045c, 10474 "klinebelow", 10475 0x1e35, 10476 "klsquare", 10477 0x3398, 10478 "kmcubedsquare", 10479 0x33a6, 10480 "kmonospace", 10481 0xff4b, 10482 "kmsquaredsquare", 10483 0x33a2, 10484 "kohiragana", 10485 0x3053, 10486 "kohmsquare", 10487 0x33c0, 10488 "kokaithai", 10489 0x0e01, 10490 "kokatakana", 10491 0x30b3, 10492 "kokatakanahalfwidth", 10493 0xff7a, 10494 "kooposquare", 10495 0x331e, 10496 "koppacyrillic", 10497 0x0481, 10498 "koreanstandardsymbol", 10499 0x327f, 10500 "koroniscmb", 10501 0x0343, 10502 "kparen", 10503 0x24a6, 10504 "kpasquare", 10505 0x33aa, 10506 "ksicyrillic", 10507 0x046f, 10508 "ktsquare", 10509 0x33cf, 10510 "kturned", 10511 0x029e, 10512 "kuhiragana", 10513 0x304f, 10514 "kukatakana", 10515 0x30af, 10516 "kukatakanahalfwidth", 10517 0xff78, 10518 "kvsquare", 10519 0x33b8, 10520 "kwsquare", 10521 0x33be, 10522 "l", 10523 0x006c, 10524 "labengali", 10525 0x09b2, 10526 "lacute", 10527 0x013a, 10528 "ladeva", 10529 0x0932, 10530 "lagujarati", 10531 0x0ab2, 10532 "lagurmukhi", 10533 0x0a32, 10534 "lakkhangyaothai", 10535 0x0e45, 10536 "lamaleffinalarabic", 10537 0xfefc, 10538 "lamalefhamzaabovefinalarabic", 10539 0xfef8, 10540 "lamalefhamzaaboveisolatedarabic", 10541 0xfef7, 10542 "lamalefhamzabelowfinalarabic", 10543 0xfefa, 10544 "lamalefhamzabelowisolatedarabic", 10545 0xfef9, 10546 "lamalefisolatedarabic", 10547 0xfefb, 10548 "lamalefmaddaabovefinalarabic", 10549 0xfef6, 10550 "lamalefmaddaaboveisolatedarabic", 10551 0xfef5, 10552 "lamarabic", 10553 0x0644, 10554 "lambda", 10555 0x03bb, 10556 "lambdastroke", 10557 0x019b, 10558 "lamed", 10559 0x05dc, 10560 "lameddagesh", 10561 0xfb3c, 10562 "lameddageshhebrew",
10563 0xfb3c, 10564 "lamedhebrew", 10565 0x05dc, 10566 "lamfinalarabic", 10567 0xfede, 10568 "lamhahinitialarabic", 10569 0xfcca, 10570 "laminitialarabic", 10571 0xfedf, 10572 "lamjeeminitialarabic", 10573 0xfcc9, 10574 "lamkhahinitialarabic", 10575 0xfccb, 10576 "lamlamhehisolatedarabic", 10577 0xfdf2, 10578 "lammedialarabic", 10579 0xfee0, 10580 "lammeemhahinitialarabic", 10581 0xfd88, 10582 "lammeeminitialarabic", 10583 0xfccc, 10584 "largecircle", 10585 0x25ef, 10586 "lbar", 10587 0x019a, 10588 "lbelt", 10589 0x026c, 10590 "lbopomofo", 10591 0x310c, 10592 "lcaron", 10593 0x013e, 10594 "lcedilla", 10595 0x013c, 10596 "lcircle", 10597 0x24db, 10598 "lcircumflexbelow", 10599 0x1e3d, 10600 "lcommaaccent", 10601 0x013c, 10602 "ldot", 10603 0x0140, 10604 "ldotaccent", 10605 0x0140, 10606 "ldotbelow", 10607 0x1e37, 10608 "ldotbelowmacron", 10609 0x1e39, 10610 "leftangleabovecmb", 10611 0x031a, 10612 "lefttackbelowcmb", 10613 0x0318, 10614 "less", 10615 0x003c, 10616 "lessequal", 10617 0x2264, 10618 "lessequalorgreater", 10619 0x22da, 10620 "lessmonospace", 10621 0xff1c, 10622 "lessorequivalent", 10623 0x2272, 10624 "lessorgreater", 10625 0x2276, 10626 "lessoverequal", 10627 0x2266, 10628 "lesssmall", 10629 0xfe64, 10630 "lezh", 10631 0x026e, 10632 "lfblock", 10633 0x258c, 10634 "lhookretroflex", 10635 0x026d, 10636 "lira", 10637 0x20a4, 10638 "liwnarmenian", 10639 0x056c, 10640 "lj", 10641 0x01c9, 10642 "ljecyrillic", 10643 0x0459, 10644 "ll", 10645 0xf6c0, 10646 "lladeva", 10647 0x0933, 10648 "llagujarati", 10649 0x0ab3, 10650 "llinebelow", 10651 0x1e3b, 10652 "llladeva", 10653 0x0934, 10654 "llvocalicbengali", 10655 0x09e1, 10656 "llvocalicdeva", 10657 0x0961, 10658 "llvocalicvowelsignbengali", 10659 0x09e3, 10660 "llvocalicvowelsigndeva", 10661 0x0963, 10662 "lmiddletilde", 10663 0x026b, 10664 "lmonospace", 10665 0xff4c, 10666 "lmsquare", 10667 0x33d0, 10668 "lochulathai", 10669 0x0e2c, 10670 "logicaland", 10671 0x2227, 10672 "logicalnot", 10673 0x00ac, 10674 "logicalnotreversed", 10675 0x2310, 10676 "logicalor", 10677 0x2228, 10678 "lolingthai", 10679 0x0e25, 10680 "longs", 10681 0x017f, 10682 "lowlinecenterline", 10683 0xfe4e, 10684 "lowlinecmb", 10685 0x0332, 10686 "lowlinedashed", 10687 0xfe4d, 10688 "lozenge", 10689 0x25ca, 10690 "lparen", 10691 0x24a7, 10692 "lslash", 10693 0x0142, 10694 "lsquare", 10695 0x2113, 10696 "lsuperior", 10697 0xf6ee, 10698 "ltshade", 10699 0x2591, 10700 "luthai", 10701 0x0e26, 10702 "lvocalicbengali", 10703 0x098c, 10704 "lvocalicdeva", 10705 0x090c, 10706 "lvocalicvowelsignbengali", 10707 0x09e2, 10708 "lvocalicvowelsigndeva", 10709 0x0962, 10710 "lxsquare", 10711 0x33d3, 10712 "m", 10713 0x006d, 10714 "mabengali", 10715 0x09ae, 10716 "macron", 10717 0x00af, 10718 "macronbelowcmb", 10719 0x0331, 10720 "macroncmb", 10721 0x0304, 10722 "macronlowmod", 10723 0x02cd, 10724 "macronmonospace", 10725 0xffe3, 10726 "macute", 10727 0x1e3f, 10728 "madeva", 10729 0x092e, 10730 "magujarati", 10731 0x0aae, 10732 "magurmukhi", 10733 0x0a2e, 10734 "mahapakhhebrew",
10735 0x05a4, 10736 "mahapakhlefthebrew", 10737 0x05a4, 10738 "mahiragana", 10739 0x307e, 10740 "maichattawalowleftthai", 10741 0xf895, 10742 "maichattawalowrightthai", 10743 0xf894, 10744 "maichattawathai", 10745 0x0e4b, 10746 "maichattawaupperleftthai", 10747 0xf893, 10748 "maieklowleftthai", 10749 0xf88c, 10750 "maieklowrightthai", 10751 0xf88b, 10752 "maiekthai", 10753 0x0e48, 10754 "maiekupperleftthai", 10755 0xf88a, 10756 "maihanakatleftthai", 10757 0xf884, 10758 "maihanakatthai", 10759 0x0e31, 10760 "maitaikhuleftthai", 10761 0xf889, 10762 "maitaikhuthai", 10763 0x0e47, 10764 "maitholowleftthai", 10765 0xf88f, 10766 "maitholowrightthai", 10767 0xf88e, 10768 "maithothai", 10769 0x0e49, 10770 "maithoupperleftthai", 10771 0xf88d, 10772 "maitrilowleftthai", 10773 0xf892, 10774 "maitrilowrightthai", 10775 0xf891, 10776 "maitrithai", 10777 0x0e4a, 10778 "maitriupperleftthai", 10779 0xf890, 10780 "maiyamokthai", 10781 0x0e46, 10782 "makatakana", 10783 0x30de, 10784 "makatakanahalfwidth", 10785 0xff8f, 10786 "male", 10787 0x2642, 10788 "mansyonsquare", 10789 0x3347, 10790 "maqafhebrew", 10791 0x05be, 10792 "mars", 10793 0x2642, 10794 "masoracirclehebrew", 10795 0x05af, 10796 "masquare", 10797 0x3383, 10798 "mbopomofo", 10799 0x3107, 10800 "mbsquare", 10801 0x33d4, 10802 "mcircle", 10803 0x24dc, 10804 "mcubedsquare", 10805 0x33a5, 10806 "mdotaccent", 10807 0x1e41, 10808 "mdotbelow", 10809 0x1e43, 10810 "meemarabic", 10811 0x0645, 10812 "meemfinalarabic", 10813 0xfee2, 10814 "meeminitialarabic", 10815 0xfee3, 10816 "meemmedialarabic", 10817 0xfee4, 10818 "meemmeeminitialarabic", 10819 0xfcd1, 10820 "meemmeemisolatedarabic", 10821 0xfc48, 10822 "meetorusquare", 10823 0x334d, 10824 "mehiragana", 10825 0x3081, 10826 "meizierasquare", 10827 0x337e, 10828 "mekatakana", 10829 0x30e1, 10830 "mekatakanahalfwidth", 10831 0xff92, 10832 "mem", 10833 0x05de, 10834 "memdagesh", 10835 0xfb3e, 10836 "memdageshhebrew",
10837 0xfb3e, 10838 "memhebrew", 10839 0x05de, 10840 "menarmenian", 10841 0x0574, 10842 "merkhahebrew", 10843 0x05a5, 10844 "merkhakefulahebrew", 10845 0x05a6, 10846 "merkhakefulalefthebrew", 10847 0x05a6, 10848 "merkhalefthebrew", 10849 0x05a5, 10850 "mhook", 10851 0x0271, 10852 "mhzsquare", 10853 0x3392, 10854 "middledotkatakanahalfwidth", 10855 0xff65, 10856 "middot", 10857 0x00b7, 10858 "mieumacirclekorean", 10859 0x3272, 10860 "mieumaparenkorean", 10861 0x3212, 10862 "mieumcirclekorean", 10863 0x3264, 10864 "mieumkorean", 10865 0x3141, 10866 "mieumpansioskorean", 10867 0x3170, 10868 "mieumparenkorean", 10869 0x3204, 10870 "mieumpieupkorean", 10871 0x316e, 10872 "mieumsioskorean", 10873 0x316f, 10874 "mihiragana", 10875 0x307f, 10876 "mikatakana", 10877 0x30df, 10878 "mikatakanahalfwidth", 10879 0xff90, 10880 "minus", 10881 0x2212, 10882 "minusbelowcmb", 10883 0x0320, 10884 "minuscircle", 10885 0x2296, 10886 "minusmod", 10887 0x02d7, 10888 "minusplus", 10889 0x2213, 10890 "minute", 10891 0x2032, 10892 "miribaarusquare", 10893 0x334a, 10894 "mirisquare", 10895 0x3349, 10896 "mlonglegturned", 10897 0x0270, 10898 "mlsquare", 10899 0x3396, 10900 "mmcubedsquare", 10901 0x33a3, 10902 "mmonospace", 10903 0xff4d, 10904 "mmsquaredsquare", 10905 0x339f, 10906 "mohiragana", 10907 0x3082, 10908 "mohmsquare", 10909 0x33c1, 10910 "mokatakana", 10911 0x30e2, 10912 "mokatakanahalfwidth", 10913 0xff93, 10914 "molsquare", 10915 0x33d6, 10916 "momathai", 10917 0x0e21, 10918 "moverssquare", 10919 0x33a7, 10920 "moverssquaredsquare", 10921 0x33a8, 10922 "mparen", 10923 0x24a8, 10924 "mpasquare", 10925 0x33ab, 10926 "mssquare", 10927 0x33b3, 10928 "msuperior", 10929 0xf6ef, 10930 "mturned", 10931 0x026f, 10932 "mu", 10933 0x00b5, 10934 "mu1", 10935 0x00b5, 10936 "muasquare", 10937 0x3382, 10938 "muchgreater", 10939 0x226b, 10940 "muchless", 10941 0x226a, 10942 "mufsquare", 10943 0x338c, 10944 "mugreek", 10945 0x03bc, 10946 "mugsquare", 10947 0x338d, 10948 "muhiragana", 10949 0x3080, 10950 "mukatakana", 10951 0x30e0, 10952 "mukatakanahalfwidth", 10953 0xff91, 10954 "mulsquare", 10955 0x3395, 10956 "multiply", 10957 0x00d7, 10958 "mumsquare", 10959 0x339b, 10960 "munahhebrew",
10961 0x05a3, 10962 "munahlefthebrew", 10963 0x05a3, 10964 "musicalnote", 10965 0x266a, 10966 "musicalnotedbl", 10967 0x266b, 10968 "musicflatsign", 10969 0x266d, 10970 "musicsharpsign", 10971 0x266f, 10972 "mussquare", 10973 0x33b2, 10974 "muvsquare", 10975 0x33b6, 10976 "muwsquare", 10977 0x33bc, 10978 "mvmegasquare", 10979 0x33b9, 10980 "mvsquare", 10981 0x33b7, 10982 "mwmegasquare", 10983 0x33bf, 10984 "mwsquare", 10985 0x33bd, 10986 "n", 10987 0x006e, 10988 "nabengali", 10989 0x09a8, 10990 "nabla", 10991 0x2207, 10992 "nacute", 10993 0x0144, 10994 "nadeva", 10995 0x0928, 10996 "nagujarati", 10997 0x0aa8, 10998 "nagurmukhi", 10999 0x0a28, 11000 "nahiragana", 11001 0x306a, 11002 "nakatakana", 11003 0x30ca, 11004 "nakatakanahalfwidth", 11005 0xff85, 11006 "napostrophe", 11007 0x0149, 11008 "nasquare", 11009 0x3381, 11010 "nbopomofo", 11011 0x310b, 11012 "nbspace", 11013 0x00a0, 11014 "ncaron", 11015 0x0148, 11016 "ncedilla", 11017 0x0146, 11018 "ncircle", 11019 0x24dd, 11020 "ncircumflexbelow", 11021 0x1e4b, 11022 "ncommaaccent", 11023 0x0146, 11024 "ndotaccent", 11025 0x1e45, 11026 "ndotbelow", 11027 0x1e47, 11028 "nehiragana", 11029 0x306d, 11030 "nekatakana", 11031 0x30cd, 11032 "nekatakanahalfwidth", 11033 0xff88, 11034 "newsheqelsign", 11035 0x20aa, 11036 "nfsquare", 11037 0x338b, 11038 "ngabengali", 11039 0x0999, 11040 "ngadeva", 11041 0x0919, 11042 "ngagujarati", 11043 0x0a99, 11044 "ngagurmukhi", 11045 0x0a19, 11046 "ngonguthai", 11047 0x0e07, 11048 "nhiragana", 11049 0x3093, 11050 "nhookleft", 11051 0x0272, 11052 "nhookretroflex", 11053 0x0273, 11054 "nieunacirclekorean", 11055 0x326f, 11056 "nieunaparenkorean", 11057 0x320f, 11058 "nieuncieuckorean", 11059 0x3135, 11060 "nieuncirclekorean", 11061 0x3261, 11062 "nieunhieuhkorean", 11063 0x3136, 11064 "nieunkorean", 11065 0x3134, 11066 "nieunpansioskorean", 11067 0x3168, 11068 "nieunparenkorean", 11069 0x3201, 11070 "nieunsioskorean", 11071 0x3167, 11072 "nieuntikeutkorean", 11073 0x3166, 11074 "nihiragana", 11075 0x306b, 11076 "nikatakana", 11077 0x30cb, 11078 "nikatakanahalfwidth", 11079 0xff86, 11080 "nikhahitleftthai", 11081 0xf899, 11082 "nikhahitthai", 11083 0x0e4d, 11084 "nine", 11085 0x0039, 11086 "ninearabic", 11087 0x0669, 11088 "ninebengali", 11089 0x09ef, 11090 "ninecircle", 11091 0x2468, 11092 "ninecircleinversesansserif", 11093 0x2792, 11094 "ninedeva", 11095 0x096f, 11096 "ninegujarati", 11097 0x0aef, 11098 "ninegurmukhi", 11099 0x0a6f, 11100 "ninehackarabic", 11101 0x0669, 11102 "ninehangzhou", 11103 0x3029, 11104 "nineideographicparen", 11105 0x3228, 11106 "nineinferior", 11107 0x2089, 11108 "ninemonospace", 11109 0xff19, 11110 "nineoldstyle", 11111 0xf739, 11112 "nineparen", 11113 0x247c, 11114 "nineperiod", 11115 0x2490, 11116 "ninepersian", 11117 0x06f9, 11118 "nineroman", 11119 0x2178, 11120 "ninesuperior", 11121 0x2079, 11122 "nineteencircle", 11123 0x2472, 11124 "nineteenparen", 11125 0x2486, 11126 "nineteenperiod", 11127 0x249a, 11128 "ninethai", 11129 0x0e59, 11130 "nj", 11131 0x01cc, 11132 "njecyrillic", 11133 0x045a, 11134 "nkatakana", 11135 0x30f3, 11136 "nkatakanahalfwidth", 11137 0xff9d, 11138 "nlegrightlong", 11139 0x019e, 11140 "nlinebelow", 11141 0x1e49, 11142 "nmonospace", 11143 0xff4e, 11144 "nmsquare", 11145 0x339a, 11146 "nnabengali", 11147 0x09a3, 11148 "nnadeva", 11149 0x0923, 11150 "nnagujarati", 11151 0x0aa3, 11152 "nnagurmukhi", 11153 0x0a23, 11154 "nnnadeva", 11155 0x0929, 11156 "nohiragana", 11157 0x306e, 11158 "nokatakana", 11159 0x30ce, 11160 "nokatakanahalfwidth", 11161 0xff89, 11162 "nonbreakingspace", 11163 0x00a0, 11164 "nonenthai", 11165 0x0e13, 11166 "nonuthai", 11167 0x0e19, 11168 "noonarabic", 11169 0x0646, 11170 "noonfinalarabic", 11171 0xfee6, 11172 "noonghunnaarabic", 11173 0x06ba, 11174 "noonghunnafinalarabic", 11175 0xfb9f, 11176 "nooninitialarabic", 11177 0xfee7, 11178 "noonjeeminitialarabic", 11179 0xfcd2, 11180 "noonjeemisolatedarabic", 11181 0xfc4b, 11182 "noonmedialarabic", 11183 0xfee8, 11184 "noonmeeminitialarabic", 11185 0xfcd5, 11186 "noonmeemisolatedarabic", 11187 0xfc4e, 11188 "noonnoonfinalarabic", 11189 0xfc8d, 11190 "notcontains", 11191 0x220c, 11192 "notelement", 11193 0x2209, 11194 "notelementof", 11195 0x2209, 11196 "notequal", 11197 0x2260, 11198 "notgreater", 11199 0x226f, 11200 "notgreaternorequal", 11201 0x2271, 11202 "notgreaternorless", 11203 0x2279, 11204 "notidentical", 11205 0x2262, 11206 "notless", 11207 0x226e, 11208 "notlessnorequal", 11209 0x2270, 11210 "notparallel", 11211 0x2226, 11212 "notprecedes", 11213 0x2280, 11214 "notsubset", 11215 0x2284, 11216 "notsucceeds", 11217 0x2281, 11218 "notsuperset", 11219 0x2285, 11220 "nowarmenian", 11221 0x0576, 11222 "nparen", 11223 0x24a9, 11224 "nssquare", 11225 0x33b1, 11226 "nsuperior", 11227 0x207f, 11228 "ntilde", 11229 0x00f1, 11230 "nu", 11231 0x03bd, 11232 "nuhiragana", 11233 0x306c, 11234 "nukatakana", 11235 0x30cc, 11236 "nukatakanahalfwidth", 11237 0xff87, 11238 "nuktabengali", 11239 0x09bc, 11240 "nuktadeva", 11241 0x093c, 11242 "nuktagujarati", 11243 0x0abc, 11244 "nuktagurmukhi", 11245 0x0a3c, 11246 "numbersign", 11247 0x0023, 11248 "numbersignmonospace", 11249 0xff03, 11250 "numbersignsmall", 11251 0xfe5f, 11252 "numeralsigngreek", 11253 0x0374, 11254 "numeralsignlowergreek", 11255 0x0375, 11256 "numero", 11257 0x2116, 11258 "nun", 11259 0x05e0, 11260 "nundagesh", 11261 0xfb40, 11262 "nundageshhebrew",
11263 0xfb40, 11264 "nunhebrew", 11265 0x05e0, 11266 "nvsquare", 11267 0x33b5, 11268 "nwsquare", 11269 0x33bb, 11270 "nyabengali", 11271 0x099e, 11272 "nyadeva", 11273 0x091e, 11274 "nyagujarati", 11275 0x0a9e, 11276 "nyagurmukhi", 11277 0x0a1e, 11278 "o", 11279 0x006f, 11280 "oacute", 11281 0x00f3, 11282 "oangthai", 11283 0x0e2d, 11284 "obarred", 11285 0x0275, 11286 "obarredcyrillic", 11287 0x04e9, 11288 "obarreddieresiscyrillic", 11289 0x04eb, 11290 "obengali", 11291 0x0993, 11292 "obopomofo", 11293 0x311b, 11294 "obreve", 11295 0x014f, 11296 "ocandradeva", 11297 0x0911, 11298 "ocandragujarati", 11299 0x0a91, 11300 "ocandravowelsigndeva", 11301 0x0949, 11302 "ocandravowelsigngujarati", 11303 0x0ac9, 11304 "ocaron", 11305 0x01d2, 11306 "ocircle", 11307 0x24de, 11308 "ocircumflex", 11309 0x00f4, 11310 "ocircumflexacute", 11311 0x1ed1, 11312 "ocircumflexdotbelow", 11313 0x1ed9, 11314 "ocircumflexgrave", 11315 0x1ed3, 11316 "ocircumflexhookabove", 11317 0x1ed5, 11318 "ocircumflextilde", 11319 0x1ed7, 11320 "ocyrillic", 11321 0x043e, 11322 "odblacute", 11323 0x0151, 11324 "odblgrave", 11325 0x020d, 11326 "odeva", 11327 0x0913, 11328 "odieresis", 11329 0x00f6, 11330 "odieresiscyrillic", 11331 0x04e7, 11332 "odotbelow", 11333 0x1ecd, 11334 "oe", 11335 0x0153, 11336 "oekorean", 11337 0x315a, 11338 "ogonek", 11339 0x02db, 11340 "ogonekcmb", 11341 0x0328, 11342 "ograve", 11343 0x00f2, 11344 "ogujarati", 11345 0x0a93, 11346 "oharmenian", 11347 0x0585, 11348 "ohiragana", 11349 0x304a, 11350 "ohookabove", 11351 0x1ecf, 11352 "ohorn", 11353 0x01a1, 11354 "ohornacute", 11355 0x1edb, 11356 "ohorndotbelow", 11357 0x1ee3, 11358 "ohorngrave", 11359 0x1edd, 11360 "ohornhookabove", 11361 0x1edf, 11362 "ohorntilde", 11363 0x1ee1, 11364 "ohungarumlaut", 11365 0x0151, 11366 "oi", 11367 0x01a3, 11368 "oinvertedbreve", 11369 0x020f, 11370 "okatakana", 11371 0x30aa, 11372 "okatakanahalfwidth", 11373 0xff75, 11374 "okorean", 11375 0x3157, 11376 "olehebrew", 11377 0x05ab, 11378 "omacron", 11379 0x014d, 11380 "omacronacute", 11381 0x1e53, 11382 "omacrongrave", 11383 0x1e51, 11384 "omdeva", 11385 0x0950, 11386 "omega", 11387 0x03c9, 11388 "omega1", 11389 0x03d6, 11390 "omegacyrillic", 11391 0x0461, 11392 "omegalatinclosed", 11393 0x0277, 11394 "omegaroundcyrillic", 11395 0x047b, 11396 "omegatitlocyrillic", 11397 0x047d, 11398 "omegatonos", 11399 0x03ce, 11400 "omgujarati", 11401 0x0ad0, 11402 "omicron", 11403 0x03bf, 11404 "omicrontonos", 11405 0x03cc, 11406 "omonospace", 11407 0xff4f, 11408 "one", 11409 0x0031, 11410 "onearabic", 11411 0x0661, 11412 "onebengali", 11413 0x09e7, 11414 "onecircle", 11415 0x2460, 11416 "onecircleinversesansserif", 11417 0x278a, 11418 "onedeva", 11419 0x0967, 11420 "onedotenleader", 11421 0x2024, 11422 "oneeighth", 11423 0x215b, 11424 "onefitted", 11425 0xf6dc, 11426 "onegujarati", 11427 0x0ae7, 11428 "onegurmukhi", 11429 0x0a67, 11430 "onehackarabic", 11431 0x0661, 11432 "onehalf", 11433 0x00bd, 11434 "onehangzhou", 11435 0x3021, 11436 "oneideographicparen", 11437 0x3220, 11438 "oneinferior", 11439 0x2081, 11440 "onemonospace", 11441 0xff11, 11442 "onenumeratorbengali", 11443 0x09f4, 11444 "oneoldstyle", 11445 0xf731, 11446 "oneparen", 11447 0x2474, 11448 "oneperiod", 11449 0x2488, 11450 "onepersian", 11451 0x06f1, 11452 "onequarter", 11453 0x00bc, 11454 "oneroman", 11455 0x2170, 11456 "onesuperior", 11457 0x00b9, 11458 "onethai", 11459 0x0e51, 11460 "onethird", 11461 0x2153, 11462 "oogonek", 11463 0x01eb, 11464 "oogonekmacron", 11465 0x01ed, 11466 "oogurmukhi", 11467 0x0a13, 11468 "oomatragurmukhi", 11469 0x0a4b, 11470 "oopen", 11471 0x0254, 11472 "oparen", 11473 0x24aa, 11474 "openbullet", 11475 0x25e6, 11476 "option", 11477 0x2325, 11478 "ordfeminine", 11479 0x00aa, 11480 "ordmasculine", 11481 0x00ba, 11482 "orthogonal", 11483 0x221f, 11484 "oshortdeva", 11485 0x0912, 11486 "oshortvowelsigndeva", 11487 0x094a, 11488 "oslash", 11489 0x00f8, 11490 "oslashacute", 11491 0x01ff, 11492 "osmallhiragana", 11493 0x3049, 11494 "osmallkatakana", 11495 0x30a9, 11496 "osmallkatakanahalfwidth", 11497 0xff6b, 11498 "ostrokeacute", 11499 0x01ff, 11500 "osuperior", 11501 0xf6f0, 11502 "otcyrillic", 11503 0x047f, 11504 "otilde", 11505 0x00f5, 11506 "otildeacute", 11507 0x1e4d, 11508 "otildedieresis", 11509 0x1e4f, 11510 "oubopomofo", 11511 0x3121, 11512 "overline", 11513 0x203e, 11514 "overlinecenterline", 11515 0xfe4a, 11516 "overlinecmb", 11517 0x0305, 11518 "overlinedashed", 11519 0xfe49, 11520 "overlinedblwavy", 11521 0xfe4c, 11522 "overlinewavy", 11523 0xfe4b, 11524 "overscore", 11525 0x00af, 11526 "ovowelsignbengali", 11527 0x09cb, 11528 "ovowelsigndeva", 11529 0x094b, 11530 "ovowelsigngujarati", 11531 0x0acb, 11532 "p", 11533 0x0070, 11534 "paampssquare", 11535 0x3380, 11536 "paasentosquare", 11537 0x332b, 11538 "pabengali", 11539 0x09aa, 11540 "pacute", 11541 0x1e55, 11542 "padeva", 11543 0x092a, 11544 "pagedown", 11545 0x21df, 11546 "pageup", 11547 0x21de, 11548 "pagujarati", 11549 0x0aaa, 11550 "pagurmukhi", 11551 0x0a2a, 11552 "pahiragana", 11553 0x3071, 11554 "paiyannoithai", 11555 0x0e2f, 11556 "pakatakana", 11557 0x30d1, 11558 "palatalizationcyrilliccmb", 11559 0x0484, 11560 "palochkacyrillic", 11561 0x04c0, 11562 "pansioskorean", 11563 0x317f, 11564 "paragraph", 11565 0x00b6, 11566 "parallel", 11567 0x2225, 11568 "parenleft", 11569 0x0028, 11570 "parenleftaltonearabic", 11571 0xfd3e, 11572 "parenleftbt", 11573 0xf8ed,
11574 "parenleftex", 11575 0xf8ec, 11576 "parenleftinferior", 11577 0x208d, 11578 "parenleftmonospace", 11579 0xff08, 11580 "parenleftsmall", 11581 0xfe59, 11582 "parenleftsuperior", 11583 0x207d, 11584 "parenlefttp", 11585 0xf8eb, 11586 "parenleftvertical", 11587 0xfe35, 11588 "parenright", 11589 0x0029, 11590 "parenrightaltonearabic", 11591 0xfd3f, 11592 "parenrightbt", 11593 0xf8f8, 11594 "parenrightex", 11595 0xf8f7, 11596 "parenrightinferior", 11597 0x208e, 11598 "parenrightmonospace", 11599 0xff09, 11600 "parenrightsmall", 11601 0xfe5a, 11602 "parenrightsuperior", 11603 0x207e, 11604 "parenrighttp", 11605 0xf8f6, 11606 "parenrightvertical", 11607 0xfe36, 11608 "partialdiff", 11609 0x2202, 11610 "paseqhebrew", 11611 0x05c0, 11612 "pashtahebrew", 11613 0x0599, 11614 "pasquare", 11615 0x33a9, 11616 "patah", 11617 0x05b7, 11618 "patah11", 11619 0x05b7, 11620 "patah1d", 11621 0x05b7, 11622 "patah2a", 11623 0x05b7, 11624 "patahhebrew", 11625 0x05b7, 11626 "patahnarrowhebrew", 11627 0x05b7, 11628 "patahquarterhebrew", 11629 0x05b7, 11630 "patahwidehebrew", 11631 0x05b7, 11632 "pazerhebrew", 11633 0x05a1, 11634 "pbopomofo", 11635 0x3106, 11636 "pcircle", 11637 0x24df, 11638 "pdotaccent", 11639 0x1e57, 11640 "pe", 11641 0x05e4, 11642 "pecyrillic", 11643 0x043f, 11644 "pedagesh", 11645 0xfb44, 11646 "pedageshhebrew",
11647 0xfb44, 11648 "peezisquare", 11649 0x333b, 11650 "pefinaldageshhebrew", 11651 0xfb43, 11652 "peharabic", 11653 0x067e, 11654 "peharmenian", 11655 0x057a, 11656 "pehebrew", 11657 0x05e4, 11658 "pehfinalarabic", 11659 0xfb57, 11660 "pehinitialarabic", 11661 0xfb58, 11662 "pehiragana", 11663 0x307a, 11664 "pehmedialarabic", 11665 0xfb59, 11666 "pekatakana", 11667 0x30da, 11668 "pemiddlehookcyrillic", 11669 0x04a7, 11670 "perafehebrew", 11671 0xfb4e, 11672 "percent", 11673 0x0025, 11674 "percentarabic", 11675 0x066a, 11676 "percentmonospace", 11677 0xff05, 11678 "percentsmall", 11679 0xfe6a, 11680 "period", 11681 0x002e, 11682 "periodarmenian", 11683 0x0589, 11684 "periodcentered", 11685 0x00b7, 11686 "periodhalfwidth", 11687 0xff61, 11688 "periodinferior", 11689 0xf6e7, 11690 "periodmonospace", 11691 0xff0e, 11692 "periodsmall", 11693 0xfe52, 11694 "periodsuperior", 11695 0xf6e8, 11696 "perispomenigreekcmb", 11697 0x0342, 11698 "perpendicular", 11699 0x22a5, 11700 "perthousand", 11701 0x2030, 11702 "peseta", 11703 0x20a7, 11704 "pfsquare", 11705 0x338a, 11706 "phabengali", 11707 0x09ab, 11708 "phadeva", 11709 0x092b, 11710 "phagujarati", 11711 0x0aab, 11712 "phagurmukhi", 11713 0x0a2b, 11714 "phi", 11715 0x03c6, 11716 "phi1", 11717 0x03d5, 11718 "phieuphacirclekorean", 11719 0x327a, 11720 "phieuphaparenkorean", 11721 0x321a, 11722 "phieuphcirclekorean", 11723 0x326c, 11724 "phieuphkorean", 11725 0x314d, 11726 "phieuphparenkorean", 11727 0x320c, 11728 "philatin", 11729 0x0278, 11730 "phinthuthai", 11731 0x0e3a, 11732 "phisymbolgreek", 11733 0x03d5, 11734 "phook", 11735 0x01a5, 11736 "phophanthai", 11737 0x0e1e, 11738 "phophungthai", 11739 0x0e1c, 11740 "phosamphaothai", 11741 0x0e20, 11742 "pi", 11743 0x03c0, 11744 "pieupacirclekorean", 11745 0x3273, 11746 "pieupaparenkorean", 11747 0x3213, 11748 "pieupcieuckorean", 11749 0x3176, 11750 "pieupcirclekorean", 11751 0x3265, 11752 "pieupkiyeokkorean", 11753 0x3172, 11754 "pieupkorean", 11755 0x3142, 11756 "pieupparenkorean", 11757 0x3205, 11758 "pieupsioskiyeokkorean", 11759 0x3174, 11760 "pieupsioskorean", 11761 0x3144, 11762 "pieupsiostikeutkorean", 11763 0x3175, 11764 "pieupthieuthkorean", 11765 0x3177, 11766 "pieuptikeutkorean", 11767 0x3173, 11768 "pihiragana", 11769 0x3074, 11770 "pikatakana", 11771 0x30d4, 11772 "pisymbolgreek", 11773 0x03d6, 11774 "piwrarmenian", 11775 0x0583, 11776 "plus", 11777 0x002b, 11778 "plusbelowcmb", 11779 0x031f, 11780 "pluscircle", 11781 0x2295, 11782 "plusminus", 11783 0x00b1, 11784 "plusmod", 11785 0x02d6, 11786 "plusmonospace", 11787 0xff0b, 11788 "plussmall", 11789 0xfe62, 11790 "plussuperior", 11791 0x207a, 11792 "pmonospace", 11793 0xff50, 11794 "pmsquare", 11795 0x33d8, 11796 "pohiragana", 11797 0x307d, 11798 "pointingindexdownwhite", 11799 0x261f, 11800 "pointingindexleftwhite", 11801 0x261c, 11802 "pointingindexrightwhite", 11803 0x261e, 11804 "pointingindexupwhite", 11805 0x261d, 11806 "pokatakana", 11807 0x30dd, 11808 "poplathai", 11809 0x0e1b, 11810 "postalmark", 11811 0x3012, 11812 "postalmarkface", 11813 0x3020, 11814 "pparen", 11815 0x24ab, 11816 "precedes", 11817 0x227a, 11818 "prescription", 11819 0x211e, 11820 "primemod", 11821 0x02b9, 11822 "primereversed", 11823 0x2035, 11824 "product", 11825 0x220f, 11826 "projective", 11827 0x2305, 11828 "prolongedkana", 11829 0x30fc, 11830 "propellor", 11831 0x2318, 11832 "propersubset", 11833 0x2282, 11834 "propersuperset", 11835 0x2283, 11836 "proportion", 11837 0x2237, 11838 "proportional", 11839 0x221d, 11840 "psi", 11841 0x03c8, 11842 "psicyrillic", 11843 0x0471, 11844 "psilipneumatacyrilliccmb", 11845 0x0486, 11846 "pssquare", 11847 0x33b0, 11848 "puhiragana", 11849 0x3077, 11850 "pukatakana", 11851 0x30d7, 11852 "pvsquare", 11853 0x33b4, 11854 "pwsquare", 11855 0x33ba, 11856 "q", 11857 0x0071, 11858 "qadeva", 11859 0x0958, 11860 "qadmahebrew", 11861 0x05a8, 11862 "qafarabic", 11863 0x0642, 11864 "qaffinalarabic", 11865 0xfed6, 11866 "qafinitialarabic", 11867 0xfed7, 11868 "qafmedialarabic", 11869 0xfed8, 11870 "qamats", 11871 0x05b8, 11872 "qamats10", 11873 0x05b8, 11874 "qamats1a", 11875 0x05b8, 11876 "qamats1c", 11877 0x05b8, 11878 "qamats27", 11879 0x05b8, 11880 "qamats29", 11881 0x05b8, 11882 "qamats33", 11883 0x05b8, 11884 "qamatsde", 11885 0x05b8, 11886 "qamatshebrew",
11887 0x05b8, 11888 "qamatsnarrowhebrew", 11889 0x05b8, 11890 "qamatsqatanhebrew", 11891 0x05b8, 11892 "qamatsqatannarrowhebrew", 11893 0x05b8, 11894 "qamatsqatanquarterhebrew", 11895 0x05b8, 11896 "qamatsqatanwidehebrew", 11897 0x05b8, 11898 "qamatsquarterhebrew", 11899 0x05b8, 11900 "qamatswidehebrew", 11901 0x05b8, 11902 "qarneyparahebrew", 11903 0x059f, 11904 "qbopomofo", 11905 0x3111, 11906 "qcircle", 11907 0x24e0, 11908 "qhook", 11909 0x02a0, 11910 "qmonospace", 11911 0xff51, 11912 "qof", 11913 0x05e7, 11914 "qofdagesh", 11915 0xfb47, 11916 "qofdageshhebrew", 11917 0xfb47, 11918 "qofhebrew", 11919 0x05e7, 11920 "qparen", 11921 0x24ac, 11922 "quarternote", 11923 0x2669, 11924 "qubuts", 11925 0x05bb, 11926 "qubuts18", 11927 0x05bb, 11928 "qubuts25", 11929 0x05bb, 11930 "qubuts31", 11931 0x05bb, 11932 "qubutshebrew", 11933 0x05bb, 11934 "qubutsnarrowhebrew", 11935 0x05bb, 11936 "qubutsquarterhebrew", 11937 0x05bb, 11938 "qubutswidehebrew", 11939 0x05bb, 11940 "question", 11941 0x003f, 11942 "questionarabic", 11943 0x061f, 11944 "questionarmenian", 11945 0x055e, 11946 "questiondown", 11947 0x00bf, 11948 "questiondownsmall", 11949 0xf7bf, 11950 "questiongreek", 11951 0x037e, 11952 "questionmonospace", 11953 0xff1f, 11954 "questionsmall", 11955 0xf73f, 11956 "quotedbl", 11957 0x0022, 11958 "quotedblbase", 11959 0x201e, 11960 "quotedblleft", 11961 0x201c, 11962 "quotedblmonospace", 11963 0xff02, 11964 "quotedblprime", 11965 0x301e, 11966 "quotedblprimereversed", 11967 0x301d, 11968 "quotedblright", 11969 0x201d, 11970 "quoteleft", 11971 0x2018, 11972 "quoteleftreversed", 11973 0x201b, 11974 "quotereversed", 11975 0x201b, 11976 "quoteright", 11977 0x2019, 11978 "quoterightn", 11979 0x0149, 11980 "quotesinglbase", 11981 0x201a, 11982 "quotesingle", 11983 0x0027, 11984 "quotesinglemonospace", 11985 0xff07, 11986 "r", 11987 0x0072, 11988 "raarmenian", 11989 0x057c, 11990 "rabengali", 11991 0x09b0, 11992 "racute", 11993 0x0155, 11994 "radeva", 11995 0x0930, 11996 "radical", 11997 0x221a, 11998 "radicalex", 11999 0xf8e5, 12000 "radoverssquare", 12001 0x33ae, 12002 "radoverssquaredsquare", 12003 0x33af, 12004 "radsquare", 12005 0x33ad, 12006 "rafe", 12007 0x05bf, 12008 "rafehebrew", 12009 0x05bf, 12010 "ragujarati", 12011 0x0ab0, 12012 "ragurmukhi", 12013 0x0a30, 12014 "rahiragana", 12015 0x3089, 12016 "rakatakana", 12017 0x30e9, 12018 "rakatakanahalfwidth", 12019 0xff97, 12020 "ralowerdiagonalbengali", 12021 0x09f1, 12022 "ramiddlediagonalbengali", 12023 0x09f0, 12024 "ramshorn", 12025 0x0264, 12026 "ratio", 12027 0x2236, 12028 "rbopomofo", 12029 0x3116, 12030 "rcaron", 12031 0x0159, 12032 "rcedilla", 12033 0x0157, 12034 "rcircle", 12035 0x24e1, 12036 "rcommaaccent", 12037 0x0157, 12038 "rdblgrave", 12039 0x0211, 12040 "rdotaccent", 12041 0x1e59, 12042 "rdotbelow", 12043 0x1e5b, 12044 "rdotbelowmacron", 12045 0x1e5d, 12046 "referencemark", 12047 0x203b, 12048 "reflexsubset", 12049 0x2286, 12050 "reflexsuperset", 12051 0x2287, 12052 "registered", 12053 0x00ae, 12054 "registersans", 12055 0xf8e8, 12056 "registerserif", 12057 0xf6da, 12058 "reharabic", 12059 0x0631, 12060 "reharmenian", 12061 0x0580, 12062 "rehfinalarabic", 12063 0xfeae, 12064 "rehiragana", 12065 0x308c, 12066 "rekatakana", 12067 0x30ec, 12068 "rekatakanahalfwidth", 12069 0xff9a, 12070 "resh", 12071 0x05e8, 12072 "reshdageshhebrew",
12073 0xfb48, 12074 "reshhebrew", 12075 0x05e8, 12076 "reversedtilde", 12077 0x223d, 12078 "reviahebrew", 12079 0x0597, 12080 "reviamugrashhebrew", 12081 0x0597, 12082 "revlogicalnot", 12083 0x2310, 12084 "rfishhook", 12085 0x027e, 12086 "rfishhookreversed", 12087 0x027f, 12088 "rhabengali", 12089 0x09dd, 12090 "rhadeva", 12091 0x095d, 12092 "rho", 12093 0x03c1, 12094 "rhook", 12095 0x027d, 12096 "rhookturned", 12097 0x027b, 12098 "rhookturnedsuperior", 12099 0x02b5, 12100 "rhosymbolgreek", 12101 0x03f1, 12102 "rhotichookmod", 12103 0x02de, 12104 "rieulacirclekorean", 12105 0x3271, 12106 "rieulaparenkorean", 12107 0x3211, 12108 "rieulcirclekorean", 12109 0x3263, 12110 "rieulhieuhkorean", 12111 0x3140, 12112 "rieulkiyeokkorean", 12113 0x313a, 12114 "rieulkiyeoksioskorean", 12115 0x3169, 12116 "rieulkorean", 12117 0x3139, 12118 "rieulmieumkorean", 12119 0x313b, 12120 "rieulpansioskorean", 12121 0x316c, 12122 "rieulparenkorean", 12123 0x3203, 12124 "rieulphieuphkorean", 12125 0x313f, 12126 "rieulpieupkorean", 12127 0x313c, 12128 "rieulpieupsioskorean", 12129 0x316b, 12130 "rieulsioskorean", 12131 0x313d, 12132 "rieulthieuthkorean", 12133 0x313e, 12134 "rieultikeutkorean", 12135 0x316a, 12136 "rieulyeorinhieuhkorean", 12137 0x316d, 12138 "rightangle", 12139 0x221f, 12140 "righttackbelowcmb", 12141 0x0319, 12142 "righttriangle", 12143 0x22bf, 12144 "rihiragana", 12145 0x308a, 12146 "rikatakana", 12147 0x30ea, 12148 "rikatakanahalfwidth", 12149 0xff98, 12150 "ring", 12151 0x02da, 12152 "ringbelowcmb", 12153 0x0325, 12154 "ringcmb", 12155 0x030a, 12156 "ringhalfleft", 12157 0x02bf, 12158 "ringhalfleftarmenian", 12159 0x0559, 12160 "ringhalfleftbelowcmb", 12161 0x031c, 12162 "ringhalfleftcentered", 12163 0x02d3, 12164 "ringhalfright", 12165 0x02be, 12166 "ringhalfrightbelowcmb", 12167 0x0339, 12168 "ringhalfrightcentered", 12169 0x02d2, 12170 "rinvertedbreve", 12171 0x0213, 12172 "rittorusquare", 12173 0x3351, 12174 "rlinebelow", 12175 0x1e5f, 12176 "rlongleg", 12177 0x027c, 12178 "rlonglegturned", 12179 0x027a, 12180 "rmonospace", 12181 0xff52, 12182 "rohiragana", 12183 0x308d, 12184 "rokatakana", 12185 0x30ed, 12186 "rokatakanahalfwidth", 12187 0xff9b, 12188 "roruathai", 12189 0x0e23, 12190 "rparen", 12191 0x24ad, 12192 "rrabengali", 12193 0x09dc, 12194 "rradeva", 12195 0x0931, 12196 "rragurmukhi", 12197 0x0a5c, 12198 "rreharabic", 12199 0x0691, 12200 "rrehfinalarabic", 12201 0xfb8d, 12202 "rrvocalicbengali", 12203 0x09e0, 12204 "rrvocalicdeva", 12205 0x0960, 12206 "rrvocalicgujarati", 12207 0x0ae0, 12208 "rrvocalicvowelsignbengali", 12209 0x09c4, 12210 "rrvocalicvowelsigndeva", 12211 0x0944, 12212 "rrvocalicvowelsigngujarati", 12213 0x0ac4, 12214 "rsuperior", 12215 0xf6f1, 12216 "rtblock", 12217 0x2590, 12218 "rturned", 12219 0x0279, 12220 "rturnedsuperior", 12221 0x02b4, 12222 "ruhiragana", 12223 0x308b, 12224 "rukatakana", 12225 0x30eb, 12226 "rukatakanahalfwidth", 12227 0xff99, 12228 "rupeemarkbengali", 12229 0x09f2, 12230 "rupeesignbengali", 12231 0x09f3, 12232 "rupiah", 12233 0xf6dd, 12234 "ruthai", 12235 0x0e24, 12236 "rvocalicbengali", 12237 0x098b, 12238 "rvocalicdeva", 12239 0x090b, 12240 "rvocalicgujarati", 12241 0x0a8b, 12242 "rvocalicvowelsignbengali", 12243 0x09c3, 12244 "rvocalicvowelsigndeva", 12245 0x0943, 12246 "rvocalicvowelsigngujarati", 12247 0x0ac3, 12248 "s", 12249 0x0073, 12250 "sabengali", 12251 0x09b8, 12252 "sacute", 12253 0x015b, 12254 "sacutedotaccent", 12255 0x1e65, 12256 "sadarabic", 12257 0x0635, 12258 "sadeva", 12259 0x0938, 12260 "sadfinalarabic", 12261 0xfeba, 12262 "sadinitialarabic", 12263 0xfebb, 12264 "sadmedialarabic", 12265 0xfebc, 12266 "sagujarati", 12267 0x0ab8, 12268 "sagurmukhi", 12269 0x0a38, 12270 "sahiragana", 12271 0x3055, 12272 "sakatakana", 12273 0x30b5, 12274 "sakatakanahalfwidth", 12275 0xff7b, 12276 "sallallahoualayhewasallamarabic", 12277 0xfdfa, 12278 "samekh", 12279 0x05e1, 12280 "samekhdagesh", 12281 0xfb41, 12282 "samekhdageshhebrew",
12283 0xfb41, 12284 "samekhhebrew", 12285 0x05e1, 12286 "saraaathai", 12287 0x0e32, 12288 "saraaethai", 12289 0x0e41, 12290 "saraaimaimalaithai", 12291 0x0e44, 12292 "saraaimaimuanthai", 12293 0x0e43, 12294 "saraamthai", 12295 0x0e33, 12296 "saraathai", 12297 0x0e30, 12298 "saraethai", 12299 0x0e40, 12300 "saraiileftthai", 12301 0xf886, 12302 "saraiithai", 12303 0x0e35, 12304 "saraileftthai", 12305 0xf885, 12306 "saraithai", 12307 0x0e34, 12308 "saraothai", 12309 0x0e42, 12310 "saraueeleftthai", 12311 0xf888, 12312 "saraueethai", 12313 0x0e37, 12314 "saraueleftthai", 12315 0xf887, 12316 "sarauethai", 12317 0x0e36, 12318 "sarauthai", 12319 0x0e38, 12320 "sarauuthai", 12321 0x0e39, 12322 "sbopomofo", 12323 0x3119, 12324 "scaron", 12325 0x0161, 12326 "scarondotaccent", 12327 0x1e67, 12328 "scedilla", 12329 0x015f, 12330 "schwa", 12331 0x0259, 12332 "schwacyrillic", 12333 0x04d9, 12334 "schwadieresiscyrillic", 12335 0x04db, 12336 "schwahook", 12337 0x025a, 12338 "scircle", 12339 0x24e2, 12340 "scircumflex", 12341 0x015d, 12342 "scommaaccent", 12343 0x0219, 12344 "sdotaccent", 12345 0x1e61, 12346 "sdotbelow", 12347 0x1e63, 12348 "sdotbelowdotaccent", 12349 0x1e69, 12350 "seagullbelowcmb", 12351 0x033c, 12352 "second", 12353 0x2033, 12354 "secondtonechinese", 12355 0x02ca, 12356 "section", 12357 0x00a7, 12358 "seenarabic", 12359 0x0633, 12360 "seenfinalarabic", 12361 0xfeb2, 12362 "seeninitialarabic", 12363 0xfeb3, 12364 "seenmedialarabic", 12365 0xfeb4, 12366 "segol", 12367 0x05b6, 12368 "segol13", 12369 0x05b6, 12370 "segol1f", 12371 0x05b6, 12372 "segol2c", 12373 0x05b6, 12374 "segolhebrew", 12375 0x05b6, 12376 "segolnarrowhebrew", 12377 0x05b6, 12378 "segolquarterhebrew", 12379 0x05b6, 12380 "segoltahebrew", 12381 0x0592, 12382 "segolwidehebrew", 12383 0x05b6, 12384 "seharmenian", 12385 0x057d, 12386 "sehiragana", 12387 0x305b, 12388 "sekatakana", 12389 0x30bb, 12390 "sekatakanahalfwidth", 12391 0xff7e, 12392 "semicolon", 12393 0x003b, 12394 "semicolonarabic", 12395 0x061b, 12396 "semicolonmonospace", 12397 0xff1b, 12398 "semicolonsmall", 12399 0xfe54, 12400 "semivoicedmarkkana", 12401 0x309c, 12402 "semivoicedmarkkanahalfwidth", 12403 0xff9f, 12404 "sentisquare", 12405 0x3322, 12406 "sentosquare", 12407 0x3323, 12408 "seven", 12409 0x0037, 12410 "sevenarabic", 12411 0x0667, 12412 "sevenbengali", 12413 0x09ed, 12414 "sevencircle", 12415 0x2466, 12416 "sevencircleinversesansserif", 12417 0x2790, 12418 "sevendeva", 12419 0x096d, 12420 "seveneighths", 12421 0x215e, 12422 "sevengujarati", 12423 0x0aed, 12424 "sevengurmukhi", 12425 0x0a6d, 12426 "sevenhackarabic", 12427 0x0667, 12428 "sevenhangzhou", 12429 0x3027, 12430 "sevenideographicparen", 12431 0x3226, 12432 "seveninferior", 12433 0x2087, 12434 "sevenmonospace", 12435 0xff17, 12436 "sevenoldstyle", 12437 0xf737, 12438 "sevenparen", 12439 0x247a, 12440 "sevenperiod", 12441 0x248e, 12442 "sevenpersian", 12443 0x06f7, 12444 "sevenroman", 12445 0x2176, 12446 "sevensuperior", 12447 0x2077, 12448 "seventeencircle", 12449 0x2470, 12450 "seventeenparen", 12451 0x2484, 12452 "seventeenperiod", 12453 0x2498, 12454 "seventhai", 12455 0x0e57, 12456 "sfthyphen", 12457 0x00ad, 12458 "shaarmenian", 12459 0x0577, 12460 "shabengali", 12461 0x09b6, 12462 "shacyrillic", 12463 0x0448, 12464 "shaddaarabic", 12465 0x0651, 12466 "shaddadammaarabic", 12467 0xfc61, 12468 "shaddadammatanarabic", 12469 0xfc5e, 12470 "shaddafathaarabic", 12471 0xfc60, 12472 "shaddakasraarabic", 12473 0xfc62, 12474 "shaddakasratanarabic", 12475 0xfc5f, 12476 "shade", 12477 0x2592, 12478 "shadedark", 12479 0x2593, 12480 "shadelight", 12481 0x2591, 12482 "shademedium", 12483 0x2592, 12484 "shadeva", 12485 0x0936, 12486 "shagujarati", 12487 0x0ab6, 12488 "shagurmukhi", 12489 0x0a36, 12490 "shalshelethebrew", 12491 0x0593, 12492 "shbopomofo", 12493 0x3115, 12494 "shchacyrillic", 12495 0x0449, 12496 "sheenarabic", 12497 0x0634, 12498 "sheenfinalarabic", 12499 0xfeb6, 12500 "sheeninitialarabic", 12501 0xfeb7, 12502 "sheenmedialarabic", 12503 0xfeb8, 12504 "sheicoptic", 12505 0x03e3, 12506 "sheqel", 12507 0x20aa, 12508 "sheqelhebrew", 12509 0x20aa, 12510 "sheva", 12511 0x05b0, 12512 "sheva115", 12513 0x05b0, 12514 "sheva15", 12515 0x05b0, 12516 "sheva22", 12517 0x05b0, 12518 "sheva2e", 12519 0x05b0, 12520 "shevahebrew", 12521 0x05b0, 12522 "shevanarrowhebrew", 12523 0x05b0, 12524 "shevaquarterhebrew", 12525 0x05b0, 12526 "shevawidehebrew", 12527 0x05b0, 12528 "shhacyrillic", 12529 0x04bb, 12530 "shimacoptic", 12531 0x03ed, 12532 "shin", 12533 0x05e9, 12534 "shindagesh", 12535 0xfb49, 12536 "shindageshhebrew",
12537 0xfb49, 12538 "shindageshshindot", 12539 0xfb2c, 12540 "shindageshshindothebrew", 12541 0xfb2c, 12542 "shindageshsindot", 12543 0xfb2d, 12544 "shindageshsindothebrew", 12545 0xfb2d, 12546 "shindothebrew", 12547 0x05c1, 12548 "shinhebrew", 12549 0x05e9, 12550 "shinshindot", 12551 0xfb2a, 12552 "shinshindothebrew", 12553 0xfb2a, 12554 "shinsindot", 12555 0xfb2b, 12556 "shinsindothebrew", 12557 0xfb2b, 12558 "shook", 12559 0x0282, 12560 "sigma", 12561 0x03c3, 12562 "sigma1", 12563 0x03c2, 12564 "sigmafinal", 12565 0x03c2, 12566 "sigmalunatesymbolgreek", 12567 0x03f2, 12568 "sihiragana", 12569 0x3057, 12570 "sikatakana", 12571 0x30b7, 12572 "sikatakanahalfwidth", 12573 0xff7c, 12574 "siluqhebrew", 12575 0x05bd, 12576 "siluqlefthebrew", 12577 0x05bd, 12578 "similar", 12579 0x223c, 12580 "sindothebrew", 12581 0x05c2, 12582 "siosacirclekorean", 12583 0x3274, 12584 "siosaparenkorean", 12585 0x3214, 12586 "sioscieuckorean", 12587 0x317e, 12588 "sioscirclekorean", 12589 0x3266, 12590 "sioskiyeokkorean", 12591 0x317a, 12592 "sioskorean", 12593 0x3145, 12594 "siosnieunkorean", 12595 0x317b, 12596 "siosparenkorean", 12597 0x3206, 12598 "siospieupkorean", 12599 0x317d, 12600 "siostikeutkorean", 12601 0x317c, 12602 "six", 12603 0x0036, 12604 "sixarabic", 12605 0x0666, 12606 "sixbengali", 12607 0x09ec, 12608 "sixcircle", 12609 0x2465, 12610 "sixcircleinversesansserif", 12611 0x278f, 12612 "sixdeva", 12613 0x096c, 12614 "sixgujarati", 12615 0x0aec, 12616 "sixgurmukhi", 12617 0x0a6c, 12618 "sixhackarabic", 12619 0x0666, 12620 "sixhangzhou", 12621 0x3026, 12622 "sixideographicparen", 12623 0x3225, 12624 "sixinferior", 12625 0x2086, 12626 "sixmonospace", 12627 0xff16, 12628 "sixoldstyle", 12629 0xf736, 12630 "sixparen", 12631 0x2479, 12632 "sixperiod", 12633 0x248d, 12634 "sixpersian", 12635 0x06f6, 12636 "sixroman", 12637 0x2175, 12638 "sixsuperior", 12639 0x2076, 12640 "sixteencircle", 12641 0x246f, 12642 "sixteencurrencydenominatorbengali", 12643 0x09f9, 12644 "sixteenparen", 12645 0x2483, 12646 "sixteenperiod", 12647 0x2497, 12648 "sixthai", 12649 0x0e56, 12650 "slash", 12651 0x002f, 12652 "slashmonospace", 12653 0xff0f, 12654 "slong", 12655 0x017f, 12656 "slongdotaccent", 12657 0x1e9b, 12658 "smileface", 12659 0x263a, 12660 "smonospace", 12661 0xff53, 12662 "sofpasuqhebrew", 12663 0x05c3, 12664 "softhyphen", 12665 0x00ad, 12666 "softsigncyrillic", 12667 0x044c, 12668 "sohiragana", 12669 0x305d, 12670 "sokatakana", 12671 0x30bd, 12672 "sokatakanahalfwidth", 12673 0xff7f, 12674 "soliduslongoverlaycmb", 12675 0x0338, 12676 "solidusshortoverlaycmb", 12677 0x0337, 12678 "sorusithai", 12679 0x0e29, 12680 "sosalathai", 12681 0x0e28, 12682 "sosothai", 12683 0x0e0b, 12684 "sosuathai", 12685 0x0e2a, 12686 "space", 12687 0x0020, 12688 "spacehackarabic", 12689 0x0020, 12690 "spade", 12691 0x2660, 12692 "spadesuitblack", 12693 0x2660, 12694 "spadesuitwhite", 12695 0x2664, 12696 "sparen", 12697 0x24ae, 12698 "squarebelowcmb", 12699 0x033b, 12700 "squarecc", 12701 0x33c4, 12702 "squarecm", 12703 0x339d, 12704 "squarediagonalcrosshatchfill", 12705 0x25a9, 12706 "squarehorizontalfill", 12707 0x25a4, 12708 "squarekg", 12709 0x338f, 12710 "squarekm", 12711 0x339e, 12712 "squarekmcapital", 12713 0x33ce, 12714 "squareln", 12715 0x33d1, 12716 "squarelog", 12717 0x33d2, 12718 "squaremg", 12719 0x338e, 12720 "squaremil", 12721 0x33d5, 12722 "squaremm", 12723 0x339c, 12724 "squaremsquared", 12725 0x33a1, 12726 "squareorthogonalcrosshatchfill", 12727 0x25a6, 12728 "squareupperlefttolowerrightfill", 12729 0x25a7, 12730 "squareupperrighttolowerleftfill", 12731 0x25a8, 12732 "squareverticalfill", 12733 0x25a5, 12734 "squarewhitewithsmallblack", 12735 0x25a3, 12736 "srsquare", 12737 0x33db, 12738 "ssabengali", 12739 0x09b7, 12740 "ssadeva", 12741 0x0937, 12742 "ssagujarati", 12743 0x0ab7, 12744 "ssangcieuckorean", 12745 0x3149, 12746 "ssanghieuhkorean", 12747 0x3185, 12748 "ssangieungkorean", 12749 0x3180, 12750 "ssangkiyeokkorean", 12751 0x3132, 12752 "ssangnieunkorean", 12753 0x3165, 12754 "ssangpieupkorean", 12755 0x3143, 12756 "ssangsioskorean", 12757 0x3146, 12758 "ssangtikeutkorean", 12759 0x3138, 12760 "ssuperior", 12761 0xf6f2, 12762 "sterling", 12763 0x00a3, 12764 "sterlingmonospace", 12765 0xffe1, 12766 "strokelongoverlaycmb", 12767 0x0336, 12768 "strokeshortoverlaycmb", 12769 0x0335, 12770 "subset", 12771 0x2282, 12772 "subsetnotequal", 12773 0x228a, 12774 "subsetorequal", 12775 0x2286, 12776 "succeeds", 12777 0x227b, 12778 "suchthat", 12779 0x220b, 12780 "suhiragana", 12781 0x3059, 12782 "sukatakana", 12783 0x30b9, 12784 "sukatakanahalfwidth", 12785 0xff7d, 12786 "sukunarabic", 12787 0x0652, 12788 "summation", 12789 0x2211, 12790 "sun", 12791 0x263c, 12792 "superset", 12793 0x2283, 12794 "supersetnotequal", 12795 0x228b, 12796 "supersetorequal", 12797 0x2287, 12798 "svsquare", 12799 0x33dc, 12800 "syouwaerasquare", 12801 0x337c, 12802 "t", 12803 0x0074, 12804 "tabengali", 12805 0x09a4, 12806 "tackdown", 12807 0x22a4, 12808 "tackleft", 12809 0x22a3, 12810 "tadeva", 12811 0x0924, 12812 "tagujarati", 12813 0x0aa4, 12814 "tagurmukhi", 12815 0x0a24, 12816 "taharabic", 12817 0x0637, 12818 "tahfinalarabic", 12819 0xfec2, 12820 "tahinitialarabic", 12821 0xfec3, 12822 "tahiragana", 12823 0x305f, 12824 "tahmedialarabic", 12825 0xfec4, 12826 "taisyouerasquare", 12827 0x337d, 12828 "takatakana",
12829 0x30bf, 12830 "takatakanahalfwidth", 12831 0xff80, 12832 "tatweelarabic", 12833 0x0640, 12834 "tau", 12835 0x03c4, 12836 "tav", 12837 0x05ea, 12838 "tavdages", 12839 0xfb4a, 12840 "tavdagesh", 12841 0xfb4a, 12842 "tavdageshhebrew", 12843 0xfb4a, 12844 "tavhebrew", 12845 0x05ea, 12846 "tbar", 12847 0x0167, 12848 "tbopomofo", 12849 0x310a, 12850 "tcaron", 12851 0x0165, 12852 "tccurl", 12853 0x02a8, 12854 "tcedilla", 12855 0x0163, 12856 "tcheharabic", 12857 0x0686, 12858 "tchehfinalarabic", 12859 0xfb7b, 12860 "tchehinitialarabic", 12861 0xfb7c, 12862 "tchehmedialarabic", 12863 0xfb7d, 12864 "tcircle", 12865 0x24e3, 12866 "tcircumflexbelow", 12867 0x1e71, 12868 "tcommaaccent", 12869 0x0163, 12870 "tdieresis", 12871 0x1e97, 12872 "tdotaccent", 12873 0x1e6b, 12874 "tdotbelow", 12875 0x1e6d, 12876 "tecyrillic", 12877 0x0442, 12878 "tedescendercyrillic", 12879 0x04ad, 12880 "teharabic", 12881 0x062a, 12882 "tehfinalarabic", 12883 0xfe96, 12884 "tehhahinitialarabic", 12885 0xfca2, 12886 "tehhahisolatedarabic", 12887 0xfc0c, 12888 "tehinitialarabic", 12889 0xfe97, 12890 "tehiragana", 12891 0x3066, 12892 "tehjeeminitialarabic", 12893 0xfca1, 12894 "tehjeemisolatedarabic", 12895 0xfc0b, 12896 "tehmarbutaarabic", 12897 0x0629, 12898 "tehmarbutafinalarabic", 12899 0xfe94, 12900 "tehmedialarabic", 12901 0xfe98, 12902 "tehmeeminitialarabic", 12903 0xfca4, 12904 "tehmeemisolatedarabic", 12905 0xfc0e, 12906 "tehnoonfinalarabic", 12907 0xfc73, 12908 "tekatakana", 12909 0x30c6, 12910 "tekatakanahalfwidth", 12911 0xff83, 12912 "telephone", 12913 0x2121, 12914 "telephoneblack", 12915 0x260e, 12916 "telishagedolahebrew", 12917 0x05a0, 12918 "telishaqetanahebrew",
12919 0x05a9, 12920 "tencircle", 12921 0x2469, 12922 "tenideographicparen", 12923 0x3229, 12924 "tenparen", 12925 0x247d, 12926 "tenperiod", 12927 0x2491, 12928 "tenroman", 12929 0x2179, 12930 "tesh", 12931 0x02a7, 12932 "tet", 12933 0x05d8, 12934 "tetdagesh", 12935 0xfb38, 12936 "tetdageshhebrew", 12937 0xfb38, 12938 "tethebrew", 12939 0x05d8, 12940 "tetsecyrillic", 12941 0x04b5, 12942 "tevirhebrew", 12943 0x059b, 12944 "tevirlefthebrew", 12945 0x059b, 12946 "thabengali", 12947 0x09a5, 12948 "thadeva", 12949 0x0925, 12950 "thagujarati", 12951 0x0aa5, 12952 "thagurmukhi", 12953 0x0a25, 12954 "thalarabic", 12955 0x0630, 12956 "thalfinalarabic", 12957 0xfeac, 12958 "thanthakhatlowleftthai", 12959 0xf898, 12960 "thanthakhatlowrightthai", 12961 0xf897, 12962 "thanthakhatthai", 12963 0x0e4c, 12964 "thanthakhatupperleftthai", 12965 0xf896, 12966 "theharabic", 12967 0x062b, 12968 "thehfinalarabic", 12969 0xfe9a, 12970 "thehinitialarabic", 12971 0xfe9b, 12972 "thehmedialarabic", 12973 0xfe9c, 12974 "thereexists", 12975 0x2203, 12976 "therefore", 12977 0x2234, 12978 "theta", 12979 0x03b8, 12980 "theta1", 12981 0x03d1, 12982 "thetasymbolgreek", 12983 0x03d1, 12984 "thieuthacirclekorean", 12985 0x3279, 12986 "thieuthaparenkorean", 12987 0x3219, 12988 "thieuthcirclekorean", 12989 0x326b, 12990 "thieuthkorean", 12991 0x314c, 12992 "thieuthparenkorean", 12993 0x320b, 12994 "thirteencircle", 12995 0x246c, 12996 "thirteenparen", 12997 0x2480, 12998 "thirteenperiod", 12999 0x2494, 13000 "thonangmonthothai", 13001 0x0e11, 13002 "thook", 13003 0x01ad, 13004 "thophuthaothai", 13005 0x0e12, 13006 "thorn", 13007 0x00fe, 13008 "thothahanthai", 13009 0x0e17, 13010 "thothanthai", 13011 0x0e10, 13012 "thothongthai", 13013 0x0e18, 13014 "thothungthai", 13015 0x0e16, 13016 "thousandcyrillic", 13017 0x0482, 13018 "thousandsseparatorarabic", 13019 0x066c, 13020 "thousandsseparatorpersian", 13021 0x066c, 13022 "three", 13023 0x0033, 13024 "threearabic", 13025 0x0663, 13026 "threebengali", 13027 0x09e9, 13028 "threecircle", 13029 0x2462, 13030 "threecircleinversesansserif", 13031 0x278c, 13032 "threedeva", 13033 0x0969, 13034 "threeeighths", 13035 0x215c, 13036 "threegujarati", 13037 0x0ae9, 13038 "threegurmukhi", 13039 0x0a69, 13040 "threehackarabic", 13041 0x0663, 13042 "threehangzhou", 13043 0x3023, 13044 "threeideographicparen", 13045 0x3222, 13046 "threeinferior", 13047 0x2083, 13048 "threemonospace", 13049 0xff13, 13050 "threenumeratorbengali", 13051 0x09f6, 13052 "threeoldstyle", 13053 0xf733, 13054 "threeparen", 13055 0x2476, 13056 "threeperiod", 13057 0x248a, 13058 "threepersian", 13059 0x06f3, 13060 "threequarters", 13061 0x00be, 13062 "threequartersemdash", 13063 0xf6de, 13064 "threeroman", 13065 0x2172, 13066 "threesuperior", 13067 0x00b3, 13068 "threethai", 13069 0x0e53, 13070 "thzsquare", 13071 0x3394, 13072 "tihiragana", 13073 0x3061, 13074 "tikatakana", 13075 0x30c1, 13076 "tikatakanahalfwidth", 13077 0xff81, 13078 "tikeutacirclekorean", 13079 0x3270, 13080 "tikeutaparenkorean", 13081 0x3210, 13082 "tikeutcirclekorean", 13083 0x3262, 13084 "tikeutkorean", 13085 0x3137, 13086 "tikeutparenkorean", 13087 0x3202, 13088 "tilde", 13089 0x02dc, 13090 "tildebelowcmb", 13091 0x0330, 13092 "tildecmb", 13093 0x0303, 13094 "tildecomb", 13095 0x0303, 13096 "tildedoublecmb", 13097 0x0360, 13098 "tildeoperator", 13099 0x223c, 13100 "tildeoverlaycmb", 13101 0x0334, 13102 "tildeverticalcmb", 13103 0x033e, 13104 "timescircle", 13105 0x2297, 13106 "tipehahebrew",
13107 0x0596, 13108 "tipehalefthebrew", 13109 0x0596, 13110 "tippigurmukhi", 13111 0x0a70, 13112 "titlocyrilliccmb", 13113 0x0483, 13114 "tiwnarmenian", 13115 0x057f, 13116 "tlinebelow", 13117 0x1e6f, 13118 "tmonospace", 13119 0xff54, 13120 "toarmenian", 13121 0x0569, 13122 "tohiragana", 13123 0x3068, 13124 "tokatakana", 13125 0x30c8, 13126 "tokatakanahalfwidth", 13127 0xff84, 13128 "tonebarextrahighmod", 13129 0x02e5, 13130 "tonebarextralowmod", 13131 0x02e9, 13132 "tonebarhighmod", 13133 0x02e6, 13134 "tonebarlowmod", 13135 0x02e8, 13136 "tonebarmidmod", 13137 0x02e7, 13138 "tonefive", 13139 0x01bd, 13140 "tonesix", 13141 0x0185, 13142 "tonetwo", 13143 0x01a8, 13144 "tonos", 13145 0x0384, 13146 "tonsquare", 13147 0x3327, 13148 "topatakthai", 13149 0x0e0f, 13150 "tortoiseshellbracketleft", 13151 0x3014, 13152 "tortoiseshellbracketleftsmall", 13153 0xfe5d, 13154 "tortoiseshellbracketleftvertical", 13155 0xfe39, 13156 "tortoiseshellbracketright", 13157 0x3015, 13158 "tortoiseshellbracketrightsmall", 13159 0xfe5e, 13160 "tortoiseshellbracketrightvertical", 13161 0xfe3a, 13162 "totaothai", 13163 0x0e15, 13164 "tpalatalhook", 13165 0x01ab, 13166 "tparen", 13167 0x24af, 13168 "trademark", 13169 0x2122, 13170 "trademarksans", 13171 0xf8ea, 13172 "trademarkserif", 13173 0xf6db, 13174 "tretroflexhook", 13175 0x0288, 13176 "triagdn", 13177 0x25bc, 13178 "triaglf", 13179 0x25c4, 13180 "triagrt", 13181 0x25ba, 13182 "triagup", 13183 0x25b2, 13184 "ts", 13185 0x02a6, 13186 "tsadi", 13187 0x05e6, 13188 "tsadidagesh", 13189 0xfb46, 13190 "tsadidageshhebrew",
13191 0xfb46, 13192 "tsadihebrew", 13193 0x05e6, 13194 "tsecyrillic", 13195 0x0446, 13196 "tsere", 13197 0x05b5, 13198 "tsere12", 13199 0x05b5, 13200 "tsere1e", 13201 0x05b5, 13202 "tsere2b", 13203 0x05b5, 13204 "tserehebrew", 13205 0x05b5, 13206 "tserenarrowhebrew", 13207 0x05b5, 13208 "tserequarterhebrew", 13209 0x05b5, 13210 "tserewidehebrew", 13211 0x05b5, 13212 "tshecyrillic", 13213 0x045b, 13214 "tsuperior", 13215 0xf6f3, 13216 "ttabengali", 13217 0x099f, 13218 "ttadeva", 13219 0x091f, 13220 "ttagujarati", 13221 0x0a9f, 13222 "ttagurmukhi", 13223 0x0a1f, 13224 "tteharabic", 13225 0x0679, 13226 "ttehfinalarabic", 13227 0xfb67, 13228 "ttehinitialarabic", 13229 0xfb68, 13230 "ttehmedialarabic", 13231 0xfb69, 13232 "tthabengali", 13233 0x09a0, 13234 "tthadeva", 13235 0x0920, 13236 "tthagujarati", 13237 0x0aa0, 13238 "tthagurmukhi", 13239 0x0a20, 13240 "tturned", 13241 0x0287, 13242 "tuhiragana", 13243 0x3064, 13244 "tukatakana", 13245 0x30c4, 13246 "tukatakanahalfwidth", 13247 0xff82, 13248 "tusmallhiragana", 13249 0x3063, 13250 "tusmallkatakana", 13251 0x30c3, 13252 "tusmallkatakanahalfwidth", 13253 0xff6f, 13254 "twelvecircle", 13255 0x246b, 13256 "twelveparen", 13257 0x247f, 13258 "twelveperiod", 13259 0x2493, 13260 "twelveroman", 13261 0x217b, 13262 "twentycircle", 13263 0x2473, 13264 "twentyhangzhou", 13265 0x5344, 13266 "twentyparen", 13267 0x2487, 13268 "twentyperiod", 13269 0x249b, 13270 "two", 13271 0x0032, 13272 "twoarabic", 13273 0x0662, 13274 "twobengali", 13275 0x09e8, 13276 "twocircle", 13277 0x2461, 13278 "twocircleinversesansserif", 13279 0x278b, 13280 "twodeva", 13281 0x0968, 13282 "twodotenleader", 13283 0x2025, 13284 "twodotleader", 13285 0x2025, 13286 "twodotleadervertical", 13287 0xfe30, 13288 "twogujarati", 13289 0x0ae8, 13290 "twogurmukhi", 13291 0x0a68, 13292 "twohackarabic", 13293 0x0662, 13294 "twohangzhou", 13295 0x3022, 13296 "twoideographicparen", 13297 0x3221, 13298 "twoinferior", 13299 0x2082, 13300 "twomonospace", 13301 0xff12, 13302 "twonumeratorbengali", 13303 0x09f5, 13304 "twooldstyle", 13305 0xf732, 13306 "twoparen", 13307 0x2475, 13308 "twoperiod", 13309 0x2489, 13310 "twopersian", 13311 0x06f2, 13312 "tworoman", 13313 0x2171, 13314 "twostroke", 13315 0x01bb, 13316 "twosuperior", 13317 0x00b2, 13318 "twothai", 13319 0x0e52, 13320 "twothirds", 13321 0x2154, 13322 "u", 13323 0x0075, 13324 "uacute", 13325 0x00fa, 13326 "ubar", 13327 0x0289, 13328 "ubengali", 13329 0x0989, 13330 "ubopomofo", 13331 0x3128, 13332 "ubreve", 13333 0x016d, 13334 "ucaron", 13335 0x01d4, 13336 "ucircle", 13337 0x24e4, 13338 "ucircumflex", 13339 0x00fb, 13340 "ucircumflexbelow", 13341 0x1e77, 13342 "ucyrillic", 13343 0x0443, 13344 "udattadeva", 13345 0x0951, 13346 "udblacute", 13347 0x0171, 13348 "udblgrave", 13349 0x0215, 13350 "udeva", 13351 0x0909, 13352 "udieresis", 13353 0x00fc, 13354 "udieresisacute", 13355 0x01d8, 13356 "udieresisbelow", 13357 0x1e73, 13358 "udieresiscaron", 13359 0x01da, 13360 "udieresiscyrillic", 13361 0x04f1, 13362 "udieresisgrave", 13363 0x01dc, 13364 "udieresismacron", 13365 0x01d6, 13366 "udotbelow", 13367 0x1ee5, 13368 "ugrave", 13369 0x00f9, 13370 "ugujarati", 13371 0x0a89, 13372 "ugurmukhi", 13373 0x0a09, 13374 "uhiragana", 13375 0x3046, 13376 "uhookabove", 13377 0x1ee7, 13378 "uhorn", 13379 0x01b0, 13380 "uhornacute", 13381 0x1ee9, 13382 "uhorndotbelow", 13383 0x1ef1, 13384 "uhorngrave", 13385 0x1eeb, 13386 "uhornhookabove", 13387 0x1eed, 13388 "uhorntilde", 13389 0x1eef, 13390 "uhungarumlaut", 13391 0x0171, 13392 "uhungarumlautcyrillic", 13393 0x04f3, 13394 "uinvertedbreve", 13395 0x0217, 13396 "ukatakana", 13397 0x30a6, 13398 "ukatakanahalfwidth", 13399 0xff73, 13400 "ukcyrillic", 13401 0x0479, 13402 "ukorean", 13403 0x315c, 13404 "umacron", 13405 0x016b, 13406 "umacroncyrillic", 13407 0x04ef, 13408 "umacrondieresis", 13409 0x1e7b, 13410 "umatragurmukhi", 13411 0x0a41, 13412 "umonospace", 13413 0xff55, 13414 "underscore", 13415 0x005f, 13416 "underscoredbl", 13417 0x2017, 13418 "underscoremonospace", 13419 0xff3f, 13420 "underscorevertical", 13421 0xfe33, 13422 "underscorewavy", 13423 0xfe4f, 13424 "union", 13425 0x222a, 13426 "universal", 13427 0x2200, 13428 "uogonek", 13429 0x0173, 13430 "uparen", 13431 0x24b0, 13432 "upblock", 13433 0x2580, 13434 "upperdothebrew", 13435 0x05c4, 13436 "upsilon", 13437 0x03c5, 13438 "upsilondieresis", 13439 0x03cb, 13440 "upsilondieresistonos", 13441 0x03b0, 13442 "upsilonlatin", 13443 0x028a, 13444 "upsilontonos", 13445 0x03cd, 13446 "uptackbelowcmb", 13447 0x031d, 13448 "uptackmod", 13449 0x02d4, 13450 "uragurmukhi", 13451 0x0a73, 13452 "uring", 13453 0x016f, 13454 "ushortcyrillic", 13455 0x045e, 13456 "usmallhiragana", 13457 0x3045, 13458 "usmallkatakana", 13459 0x30a5, 13460 "usmallkatakanahalfwidth", 13461 0xff69, 13462 "ustraightcyrillic", 13463 0x04af, 13464 "ustraightstrokecyrillic", 13465 0x04b1, 13466 "utilde", 13467 0x0169, 13468 "utildeacute", 13469 0x1e79, 13470 "utildebelow", 13471 0x1e75, 13472 "uubengali", 13473 0x098a, 13474 "uudeva", 13475 0x090a, 13476 "uugujarati", 13477 0x0a8a, 13478 "uugurmukhi", 13479 0x0a0a, 13480 "uumatragurmukhi", 13481 0x0a42, 13482 "uuvowelsignbengali", 13483 0x09c2, 13484 "uuvowelsigndeva", 13485 0x0942, 13486 "uuvowelsigngujarati", 13487 0x0ac2, 13488 "uvowelsignbengali", 13489 0x09c1, 13490 "uvowelsigndeva", 13491 0x0941, 13492 "uvowelsigngujarati", 13493 0x0ac1, 13494 "v", 13495 0x0076, 13496 "vadeva", 13497 0x0935, 13498 "vagujarati", 13499 0x0ab5, 13500 "vagurmukhi", 13501 0x0a35, 13502 "vakatakana",
13503 0x30f7, 13504 "vav", 13505 0x05d5, 13506 "vavdagesh", 13507 0xfb35, 13508 "vavdagesh65", 13509 0xfb35, 13510 "vavdageshhebrew", 13511 0xfb35, 13512 "vavhebrew", 13513 0x05d5, 13514 "vavholam", 13515 0xfb4b, 13516 "vavholamhebrew", 13517 0xfb4b, 13518 "vavvavhebrew", 13519 0x05f0, 13520 "vavyodhebrew", 13521 0x05f1, 13522 "vcircle", 13523 0x24e5, 13524 "vdotbelow", 13525 0x1e7f, 13526 "vecyrillic", 13527 0x0432, 13528 "veharabic", 13529 0x06a4, 13530 "vehfinalarabic", 13531 0xfb6b, 13532 "vehinitialarabic", 13533 0xfb6c, 13534 "vehmedialarabic", 13535 0xfb6d, 13536 "vekatakana", 13537 0x30f9, 13538 "venus", 13539 0x2640, 13540 "verticalbar", 13541 0x007c, 13542 "verticallineabovecmb", 13543 0x030d, 13544 "verticallinebelowcmb", 13545 0x0329, 13546 "verticallinelowmod", 13547 0x02cc, 13548 "verticallinemod", 13549 0x02c8, 13550 "vewarmenian", 13551 0x057e, 13552 "vhook", 13553 0x028b, 13554 "vikatakana", 13555 0x30f8, 13556 "viramabengali", 13557 0x09cd, 13558 "viramadeva", 13559 0x094d, 13560 "viramagujarati", 13561 0x0acd, 13562 "visargabengali", 13563 0x0983, 13564 "visargadeva", 13565 0x0903, 13566 "visargagujarati", 13567 0x0a83, 13568 "vmonospace", 13569 0xff56, 13570 "voarmenian", 13571 0x0578, 13572 "voicediterationhiragana", 13573 0x309e, 13574 "voicediterationkatakana", 13575 0x30fe, 13576 "voicedmarkkana", 13577 0x309b, 13578 "voicedmarkkanahalfwidth", 13579 0xff9e, 13580 "vokatakana", 13581 0x30fa, 13582 "vparen", 13583 0x24b1, 13584 "vtilde", 13585 0x1e7d, 13586 "vturned", 13587 0x028c, 13588 "vuhiragana", 13589 0x3094, 13590 "vukatakana", 13591 0x30f4, 13592 "w", 13593 0x0077, 13594 "wacute", 13595 0x1e83, 13596 "waekorean", 13597 0x3159, 13598 "wahiragana", 13599 0x308f, 13600 "wakatakana", 13601 0x30ef, 13602 "wakatakanahalfwidth", 13603 0xff9c, 13604 "wakorean", 13605 0x3158, 13606 "wasmallhiragana", 13607 0x308e, 13608 "wasmallkatakana", 13609 0x30ee, 13610 "wattosquare", 13611 0x3357, 13612 "wavedash", 13613 0x301c, 13614 "wavyunderscorevertical", 13615 0xfe34, 13616 "wawarabic", 13617 0x0648, 13618 "wawfinalarabic", 13619 0xfeee, 13620 "wawhamzaabovearabic", 13621 0x0624, 13622 "wawhamzaabovefinalarabic", 13623 0xfe86, 13624 "wbsquare", 13625 0x33dd, 13626 "wcircle", 13627 0x24e6, 13628 "wcircumflex", 13629 0x0175, 13630 "wdieresis", 13631 0x1e85, 13632 "wdotaccent", 13633 0x1e87, 13634 "wdotbelow", 13635 0x1e89, 13636 "wehiragana", 13637 0x3091, 13638 "weierstrass", 13639 0x2118, 13640 "wekatakana", 13641 0x30f1, 13642 "wekorean", 13643 0x315e, 13644 "weokorean", 13645 0x315d, 13646 "wgrave", 13647 0x1e81, 13648 "whitebullet", 13649 0x25e6, 13650 "whitecircle", 13651 0x25cb, 13652 "whitecircleinverse", 13653 0x25d9, 13654 "whitecornerbracketleft", 13655 0x300e, 13656 "whitecornerbracketleftvertical", 13657 0xfe43, 13658 "whitecornerbracketright", 13659 0x300f, 13660 "whitecornerbracketrightvertical", 13661 0xfe44, 13662 "whitediamond", 13663 0x25c7, 13664 "whitediamondcontainingblacksmalldiamond", 13665 0x25c8, 13666 "whitedownpointingsmalltriangle", 13667 0x25bf, 13668 "whitedownpointingtriangle", 13669 0x25bd, 13670 "whiteleftpointingsmalltriangle", 13671 0x25c3, 13672 "whiteleftpointingtriangle", 13673 0x25c1, 13674 "whitelenticularbracketleft", 13675 0x3016, 13676 "whitelenticularbracketright", 13677 0x3017, 13678 "whiterightpointingsmalltriangle", 13679 0x25b9, 13680 "whiterightpointingtriangle", 13681 0x25b7, 13682 "whitesmallsquare", 13683 0x25ab, 13684 "whitesmilingface", 13685 0x263a, 13686 "whitesquare", 13687 0x25a1, 13688 "whitestar", 13689 0x2606, 13690 "whitetelephone", 13691 0x260f, 13692 "whitetortoiseshellbracketleft", 13693 0x3018, 13694 "whitetortoiseshellbracketright", 13695 0x3019, 13696 "whiteuppointingsmalltriangle", 13697 0x25b5, 13698 "whiteuppointingtriangle", 13699 0x25b3, 13700 "wihiragana", 13701 0x3090, 13702 "wikatakana", 13703 0x30f0, 13704 "wikorean", 13705 0x315f, 13706 "wmonospace", 13707 0xff57, 13708 "wohiragana", 13709 0x3092, 13710 "wokatakana", 13711 0x30f2, 13712 "wokatakanahalfwidth", 13713 0xff66, 13714 "won", 13715 0x20a9, 13716 "wonmonospace", 13717 0xffe6, 13718 "wowaenthai", 13719 0x0e27, 13720 "wparen", 13721 0x24b2, 13722 "wring", 13723 0x1e98, 13724 "wsuperior", 13725 0x02b7, 13726 "wturned", 13727 0x028d, 13728 "wynn", 13729 0x01bf, 13730 "x", 13731 0x0078, 13732 "xabovecmb", 13733 0x033d, 13734 "xbopomofo", 13735 0x3112, 13736 "xcircle", 13737 0x24e7, 13738 "xdieresis", 13739 0x1e8d, 13740 "xdotaccent", 13741 0x1e8b, 13742 "xeharmenian", 13743 0x056d, 13744 "xi", 13745 0x03be, 13746 "xmonospace", 13747 0xff58, 13748 "xparen", 13749 0x24b3, 13750 "xsuperior", 13751 0x02e3, 13752 "y", 13753 0x0079, 13754 "yaadosquare", 13755 0x334e, 13756 "yabengali", 13757 0x09af, 13758 "yacute", 13759 0x00fd, 13760 "yadeva", 13761 0x092f, 13762 "yaekorean", 13763 0x3152, 13764 "yagujarati", 13765 0x0aaf, 13766 "yagurmukhi", 13767 0x0a2f, 13768 "yahiragana", 13769 0x3084, 13770 "yakatakana", 13771 0x30e4, 13772 "yakatakanahalfwidth", 13773 0xff94, 13774 "yakorean", 13775 0x3151, 13776 "yamakkanthai", 13777 0x0e4e, 13778 "yasmallhiragana", 13779 0x3083, 13780 "yasmallkatakana", 13781 0x30e3, 13782 "yasmallkatakanahalfwidth", 13783 0xff6c, 13784 "yatcyrillic", 13785 0x0463, 13786 "ycircle", 13787 0x24e8, 13788 "ycircumflex", 13789 0x0177, 13790 "ydieresis", 13791 0x00ff, 13792 "ydotaccent", 13793 0x1e8f, 13794 "ydotbelow", 13795 0x1ef5, 13796 "yeharabic", 13797 0x064a, 13798 "yehbarreearabic", 13799 0x06d2, 13800 "yehbarreefinalarabic", 13801 0xfbaf, 13802 "yehfinalarabic", 13803 0xfef2, 13804 "yehhamzaabovearabic", 13805 0x0626, 13806 "yehhamzaabovefinalarabic", 13807 0xfe8a, 13808 "yehhamzaaboveinitialarabic", 13809 0xfe8b, 13810 "yehhamzaabovemedialarabic", 13811 0xfe8c, 13812 "yehinitialarabic", 13813 0xfef3, 13814 "yehmedialarabic", 13815 0xfef4, 13816 "yehmeeminitialarabic", 13817 0xfcdd, 13818 "yehmeemisolatedarabic", 13819 0xfc58, 13820 "yehnoonfinalarabic", 13821 0xfc94, 13822 "yehthreedotsbelowarabic", 13823 0x06d1, 13824 "yekorean", 13825 0x3156, 13826 "yen", 13827 0x00a5, 13828 "yenmonospace", 13829 0xffe5, 13830 "yeokorean", 13831 0x3155, 13832 "yeorinhieuhkorean", 13833 0x3186, 13834 "yerahbenyomohebrew",
13835 0x05aa, 13836 "yerahbenyomolefthebrew", 13837 0x05aa, 13838 "yericyrillic", 13839 0x044b, 13840 "yerudieresiscyrillic", 13841 0x04f9, 13842 "yesieungkorean", 13843 0x3181, 13844 "yesieungpansioskorean", 13845 0x3183, 13846 "yesieungsioskorean", 13847 0x3182, 13848 "yetivhebrew", 13849 0x059a, 13850 "ygrave", 13851 0x1ef3, 13852 "yhook", 13853 0x01b4, 13854 "yhookabove", 13855 0x1ef7, 13856 "yiarmenian", 13857 0x0575, 13858 "yicyrillic", 13859 0x0457, 13860 "yikorean", 13861 0x3162, 13862 "yinyang", 13863 0x262f, 13864 "yiwnarmenian", 13865 0x0582, 13866 "ymonospace", 13867 0xff59, 13868 "yod", 13869 0x05d9, 13870 "yoddagesh", 13871 0xfb39, 13872 "yoddageshhebrew", 13873 0xfb39, 13874 "yodhebrew", 13875 0x05d9, 13876 "yodyodhebrew", 13877 0x05f2, 13878 "yodyodpatahhebrew", 13879 0xfb1f, 13880 "yohiragana", 13881 0x3088, 13882 "yoikorean", 13883 0x3189, 13884 "yokatakana", 13885 0x30e8, 13886 "yokatakanahalfwidth", 13887 0xff96, 13888 "yokorean", 13889 0x315b, 13890 "yosmallhiragana", 13891 0x3087, 13892 "yosmallkatakana", 13893 0x30e7, 13894 "yosmallkatakanahalfwidth", 13895 0xff6e, 13896 "yotgreek", 13897 0x03f3, 13898 "yoyaekorean", 13899 0x3188, 13900 "yoyakorean", 13901 0x3187, 13902 "yoyakthai", 13903 0x0e22, 13904 "yoyingthai", 13905 0x0e0d, 13906 "yparen", 13907 0x24b4, 13908 "ypogegrammeni", 13909 0x037a, 13910 "ypogegrammenigreekcmb", 13911 0x0345, 13912 "yr", 13913 0x01a6, 13914 "yring", 13915 0x1e99, 13916 "ysuperior", 13917 0x02b8, 13918 "ytilde", 13919 0x1ef9, 13920 "yturned", 13921 0x028e, 13922 "yuhiragana", 13923 0x3086, 13924 "yuikorean", 13925 0x318c, 13926 "yukatakana", 13927 0x30e6, 13928 "yukatakanahalfwidth", 13929 0xff95, 13930 "yukorean", 13931 0x3160, 13932 "yusbigcyrillic", 13933 0x046b, 13934 "yusbigiotifiedcyrillic", 13935 0x046d, 13936 "yuslittlecyrillic", 13937 0x0467, 13938 "yuslittleiotifiedcyrillic", 13939 0x0469, 13940 "yusmallhiragana", 13941 0x3085, 13942 "yusmallkatakana", 13943 0x30e5, 13944 "yusmallkatakanahalfwidth", 13945 0xff6d, 13946 "yuyekorean", 13947 0x318b, 13948 "yuyeokorean", 13949 0x318a, 13950 "yyabengali", 13951 0x09df, 13952 "yyadeva", 13953 0x095f, 13954 "z", 13955 0x007a, 13956 "zaarmenian", 13957 0x0566, 13958 "zacute", 13959 0x017a, 13960 "zadeva", 13961 0x095b, 13962 "zagurmukhi", 13963 0x0a5b, 13964 "zaharabic", 13965 0x0638, 13966 "zahfinalarabic", 13967 0xfec6, 13968 "zahinitialarabic", 13969 0xfec7, 13970 "zahiragana", 13971 0x3056, 13972 "zahmedialarabic", 13973 0xfec8, 13974 "zainarabic", 13975 0x0632, 13976 "zainfinalarabic", 13977 0xfeb0, 13978 "zakatakana", 13979 0x30b6, 13980 "zaqefgadolhebrew", 13981 0x0595, 13982 "zaqefqatanhebrew", 13983 0x0594, 13984 "zarqahebrew", 13985 0x0598, 13986 "zayin", 13987 0x05d6, 13988 "zayindagesh", 13989 0xfb36, 13990 "zayindageshhebrew",
13991 0xfb36, 13992 "zayinhebrew", 13993 0x05d6, 13994 "zbopomofo", 13995 0x3117, 13996 "zcaron", 13997 0x017e, 13998 "zcircle", 13999 0x24e9, 14000 "zcircumflex", 14001 0x1e91, 14002 "zcurl", 14003 0x0291, 14004 "zdot", 14005 0x017c, 14006 "zdotaccent", 14007 0x017c, 14008 "zdotbelow", 14009 0x1e93, 14010 "zecyrillic", 14011 0x0437, 14012 "zedescendercyrillic", 14013 0x0499, 14014 "zedieresiscyrillic", 14015 0x04df, 14016 "zehiragana", 14017 0x305c, 14018 "zekatakana", 14019 0x30bc, 14020 "zero", 14021 0x0030, 14022 "zeroarabic", 14023 0x0660, 14024 "zerobengali", 14025 0x09e6, 14026 "zerodeva", 14027 0x0966, 14028 "zerogujarati", 14029 0x0ae6, 14030 "zerogurmukhi", 14031 0x0a66, 14032 "zerohackarabic", 14033 0x0660, 14034 "zeroinferior", 14035 0x2080, 14036 "zeromonospace", 14037 0xff10, 14038 "zerooldstyle", 14039 0xf730, 14040 "zeropersian", 14041 0x06f0, 14042 "zerosuperior", 14043 0x2070, 14044 "zerothai", 14045 0x0e50, 14046 "zerowidthjoiner", 14047 0xfeff, 14048 "zerowidthnonjoiner", 14049 0x200c, 14050 "zerowidthspace", 14051 0x200b, 14052 "zeta", 14053 0x03b6, 14054 "zhbopomofo", 14055 0x3113, 14056 "zhearmenian", 14057 0x056a, 14058 "zhebrevecyrillic", 14059 0x04c2, 14060 "zhecyrillic", 14061 0x0436, 14062 "zhedescendercyrillic", 14063 0x0497, 14064 "zhedieresiscyrillic", 14065 0x04dd, 14066 "zihiragana", 14067 0x3058, 14068 "zikatakana", 14069 0x30b8, 14070 "zinorhebrew", 14071 0x05ae, 14072 "zlinebelow", 14073 0x1e95, 14074 "zmonospace", 14075 0xff5a, 14076 "zohiragana", 14077 0x305e, 14078 "zokatakana", 14079 0x30be, 14080 "zparen", 14081 0x24b5, 14082 "zretroflexhook", 14083 0x0290, 14084 "zstroke", 14085 0x01b6, 14086 "zuhiragana", 14087 0x305a, 14088 "zukatakana", 14089 0x30ba, 14090 ".notdef", 14091 0x0000, 14092 "angbracketleftbig", 14093 0x2329, 14094 "angbracketleftBig", 14095 0x2329, 14096 "angbracketleftbigg", 14097 0x2329, 14098 "angbracketleftBigg", 14099 0x2329, 14100 "angbracketrightBig", 14101 0x232a, 14102 "angbracketrightbig", 14103 0x232a, 14104 "angbracketrightBigg", 14105 0x232a, 14106 "angbracketrightbigg", 14107 0x232a, 14108 "arrowhookleft", 14109 0x21aa, 14110 "arrowhookright", 14111 0x21a9, 14112 "arrowlefttophalf", 14113 0x21bc, 14114 "arrowleftbothalf", 14115 0x21bd, 14116 "arrownortheast", 14117 0x2197, 14118 "arrownorthwest", 14119 0x2196, 14120 "arrowrighttophalf", 14121 0x21c0, 14122 "arrowrightbothalf", 14123 0x21c1, 14124 "arrowsoutheast", 14125 0x2198, 14126 "arrowsouthwest", 14127 0x2199, 14128 "backslashbig", 14129 0x2216, 14130 "backslashBig", 14131 0x2216, 14132 "backslashBigg", 14133 0x2216, 14134 "backslashbigg", 14135 0x2216, 14136 "bardbl", 14137 0x2016, 14138 "bracehtipdownleft", 14139 0xfe37, 14140 "bracehtipdownright", 14141 0xfe37, 14142 "bracehtipupleft", 14143 0xfe38, 14144 "bracehtipupright", 14145 0xfe38, 14146 "braceleftBig", 14147 0x007b, 14148 "braceleftbig", 14149 0x007b, 14150 "braceleftbigg", 14151 0x007b, 14152 "braceleftBigg", 14153 0x007b, 14154 "bracerightBig", 14155 0x007d, 14156 "bracerightbig", 14157 0x007d, 14158 "bracerightbigg", 14159 0x007d, 14160 "bracerightBigg", 14161 0x007d, 14162 "bracketleftbig", 14163 0x005b, 14164 "bracketleftBig", 14165 0x005b, 14166 "bracketleftbigg", 14167 0x005b, 14168 "bracketleftBigg", 14169 0x005b, 14170 "bracketrightBig", 14171 0x005d, 14172 "bracketrightbig", 14173 0x005d, 14174 "bracketrightbigg", 14175 0x005d, 14176 "bracketrightBigg", 14177 0x005d, 14178 "ceilingleftbig", 14179 0x2308, 14180 "ceilingleftBig", 14181 0x2308, 14182 "ceilingleftBigg", 14183 0x2308, 14184 "ceilingleftbigg", 14185 0x2308, 14186 "ceilingrightbig", 14187 0x2309, 14188 "ceilingrightBig", 14189 0x2309, 14190 "ceilingrightbigg", 14191 0x2309, 14192 "ceilingrightBigg", 14193 0x2309, 14194 "circledotdisplay", 14195 0x2299, 14196 "circledottext", 14197 0x2299, 14198 "circlemultiplydisplay", 14199 0x2297, 14200 "circlemultiplytext", 14201 0x2297, 14202 "circleplusdisplay", 14203 0x2295, 14204 "circleplustext", 14205 0x2295, 14206 "contintegraldisplay", 14207 0x222e, 14208 "contintegraltext", 14209 0x222e, 14210 "coproductdisplay", 14211 0x2210, 14212 "coproducttext", 14213 0x2210, 14214 "floorleftBig", 14215 0x230a, 14216 "floorleftbig", 14217 0x230a, 14218 "floorleftbigg", 14219 0x230a, 14220 "floorleftBigg", 14221 0x230a, 14222 "floorrightbig", 14223 0x230b, 14224 "floorrightBig", 14225 0x230b, 14226 "floorrightBigg", 14227 0x230b, 14228 "floorrightbigg", 14229 0x230b, 14230 "hatwide", 14231 0x0302, 14232 "hatwider", 14233 0x0302, 14234 "hatwidest", 14235 0x0302, 14236 "intercal", 14237 0x1d40, 14238 "integraldisplay", 14239 0x222b, 14240 "integraltext", 14241 0x222b, 14242 "intersectiondisplay", 14243 0x22c2, 14244 "intersectiontext", 14245 0x22c2, 14246 "logicalanddisplay", 14247 0x2227, 14248 "logicalandtext", 14249 0x2227, 14250 "logicalordisplay", 14251 0x2228, 14252 "logicalortext", 14253 0x2228, 14254 "parenleftBig", 14255 0x0028, 14256 "parenleftbig", 14257 0x0028, 14258 "parenleftBigg", 14259 0x0028, 14260 "parenleftbigg", 14261 0x0028, 14262 "parenrightBig", 14263 0x0029, 14264 "parenrightbig", 14265 0x0029, 14266 "parenrightBigg", 14267 0x0029, 14268 "parenrightbigg", 14269 0x0029, 14270 "prime", 14271 0x2032, 14272 "productdisplay", 14273 0x220f, 14274 "producttext", 14275 0x220f, 14276 "radicalbig", 14277 0x221a, 14278 "radicalBig", 14279 0x221a, 14280 "radicalBigg", 14281 0x221a, 14282 "radicalbigg", 14283 0x221a, 14284 "radicalbt", 14285 0x221a, 14286 "radicaltp", 14287 0x221a, 14288 "radicalvertex", 14289 0x221a, 14290 "slashbig", 14291 0x002f, 14292 "slashBig", 14293 0x002f, 14294 "slashBigg", 14295 0x002f, 14296 "slashbigg", 14297 0x002f, 14298 "summationdisplay", 14299 0x2211, 14300 "summationtext", 14301 0x2211, 14302 "tildewide", 14303 0x02dc, 14304 "tildewider", 14305 0x02dc, 14306 "tildewidest", 14307 0x02dc, 14308 "uniondisplay", 14309 0x22c3, 14310 "unionmultidisplay", 14311 0x228e, 14312 "unionmultitext", 14313 0x228e, 14314 "unionsqdisplay", 14315 0x2294, 14316 "unionsqtext", 14317 0x2294, 14318 "uniontext", 14319 0x22c3, 14320 "vextenddouble", 14321 0x2225, 14322 "vextendsingle", 14323 0x2223 14324 ]; 14325}); 14326const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () { 14327 return [ 14328 "space", 14329 0x0020, 14330 "a1", 14331 0x2701, 14332 "a2", 14333 0x2702, 14334 "a202", 14335 0x2703, 14336 "a3", 14337 0x2704, 14338 "a4", 14339 0x260e, 14340 "a5", 14341 0x2706, 14342 "a119", 14343 0x2707, 14344 "a118", 14345 0x2708, 14346 "a117", 14347 0x2709, 14348 "a11", 14349 0x261b, 14350 "a12", 14351 0x261e, 14352 "a13", 14353 0x270c, 14354 "a14", 14355 0x270d, 14356 "a15", 14357 0x270e, 14358 "a16", 14359 0x270f, 14360 "a105", 14361 0x2710, 14362 "a17", 14363 0x2711, 14364 "a18", 14365 0x2712, 14366 "a19", 14367 0x2713, 14368 "a20", 14369 0x2714, 14370 "a21", 14371 0x2715, 14372 "a22", 14373 0x2716, 14374 "a23", 14375 0x2717, 14376 "a24", 14377 0x2718, 14378 "a25", 14379 0x2719, 14380 "a26", 14381 0x271a, 14382 "a27", 14383 0x271b, 14384 "a28", 14385 0x271c, 14386 "a6", 14387 0x271d, 14388 "a7", 14389 0x271e, 14390 "a8", 14391 0x271f, 14392 "a9", 14393 0x2720, 14394 "a10", 14395 0x2721, 14396 "a29", 14397 0x2722, 14398 "a30", 14399 0x2723, 14400 "a31", 14401 0x2724, 14402 "a32", 14403 0x2725, 14404 "a33", 14405 0x2726, 14406 "a34", 14407 0x2727, 14408 "a35", 14409 0x2605, 14410 "a36", 14411 0x2729, 14412 "a37", 14413 0x272a, 14414 "a38", 14415 0x272b, 14416 "a39", 14417 0x272c, 14418 "a40", 14419 0x272d, 14420 "a41", 14421 0x272e, 14422 "a42", 14423 0x272f, 14424 "a43", 14425 0x2730, 14426 "a44", 14427 0x2731, 14428 "a45", 14429 0x2732, 14430 "a46", 14431 0x2733, 14432 "a47", 14433 0x2734, 14434 "a48", 14435 0x2735, 14436 "a49", 14437 0x2736, 14438 "a50", 14439 0x2737, 14440 "a51", 14441 0x2738, 14442 "a52", 14443 0x2739, 14444 "a53", 14445 0x273a, 14446 "a54", 14447 0x273b, 14448 "a55", 14449 0x273c, 14450 "a56", 14451 0x273d, 14452 "a57",
14453 0x273e, 14454 "a58", 14455 0x273f, 14456 "a59", 14457 0x2740, 14458 "a60", 14459 0x2741, 14460 "a61", 14461 0x2742, 14462 "a62", 14463 0x2743, 14464 "a63", 14465 0x2744, 14466 "a64", 14467 0x2745, 14468 "a65", 14469 0x2746, 14470 "a66", 14471 0x2747, 14472 "a67", 14473 0x2748, 14474 "a68", 14475 0x2749, 14476 "a69", 14477 0x274a, 14478 "a70", 14479 0x274b, 14480 "a71", 14481 0x25cf, 14482 "a72", 14483 0x274d, 14484 "a73", 14485 0x25a0, 14486 "a74", 14487 0x274f, 14488 "a203", 14489 0x2750, 14490 "a75", 14491 0x2751, 14492 "a204", 14493 0x2752, 14494 "a76", 14495 0x25b2, 14496 "a77", 14497 0x25bc, 14498 "a78", 14499 0x25c6, 14500 "a79", 14501 0x2756, 14502 "a81", 14503 0x25d7, 14504 "a82", 14505 0x2758, 14506 "a83", 14507 0x2759, 14508 "a84", 14509 0x275a, 14510 "a97", 14511 0x275b, 14512 "a98", 14513 0x275c, 14514 "a99", 14515 0x275d, 14516 "a100", 14517 0x275e, 14518 "a101", 14519 0x2761, 14520 "a102", 14521 0x2762, 14522 "a103", 14523 0x2763, 14524 "a104", 14525 0x2764, 14526 "a106", 14527 0x2765, 14528 "a107", 14529 0x2766, 14530 "a108", 14531 0x2767, 14532 "a112", 14533 0x2663, 14534 "a111", 14535 0x2666, 14536 "a110", 14537 0x2665, 14538 "a109", 14539 0x2660, 14540 "a120", 14541 0x2460, 14542 "a121", 14543 0x2461, 14544 "a122", 14545 0x2462, 14546 "a123", 14547 0x2463, 14548 "a124", 14549 0x2464, 14550 "a125", 14551 0x2465, 14552 "a126", 14553 0x2466, 14554 "a127", 14555 0x2467, 14556 "a128", 14557 0x2468, 14558 "a129", 14559 0x2469, 14560 "a130", 14561 0x2776, 14562 "a131", 14563 0x2777, 14564 "a132", 14565 0x2778, 14566 "a133", 14567 0x2779, 14568 "a134", 14569 0x277a, 14570 "a135", 14571 0x277b, 14572 "a136", 14573 0x277c, 14574 "a137", 14575 0x277d, 14576 "a138", 14577 0x277e, 14578 "a139", 14579 0x277f, 14580 "a140", 14581 0x2780, 14582 "a141", 14583 0x2781, 14584 "a142", 14585 0x2782, 14586 "a143", 14587 0x2783, 14588 "a144", 14589 0x2784, 14590 "a145", 14591 0x2785, 14592 "a146", 14593 0x2786, 14594 "a147", 14595 0x2787, 14596 "a148", 14597 0x2788, 14598 "a149", 14599 0x2789, 14600 "a150", 14601 0x278a, 14602 "a151", 14603 0x278b, 14604 "a152", 14605 0x278c, 14606 "a153", 14607 0x278d, 14608 "a154", 14609 0x278e, 14610 "a155", 14611 0x278f, 14612 "a156", 14613 0x2790, 14614 "a157", 14615 0x2791, 14616 "a158", 14617 0x2792, 14618 "a159", 14619 0x2793, 14620 "a160", 14621 0x2794, 14622 "a161", 14623 0x2192, 14624 "a163", 14625 0x2194, 14626 "a164", 14627 0x2195, 14628 "a196", 14629 0x2798, 14630 "a165", 14631 0x2799, 14632 "a192", 14633 0x279a, 14634 "a166", 14635 0x279b, 14636 "a167", 14637 0x279c, 14638 "a168", 14639 0x279d, 14640 "a169", 14641 0x279e, 14642 "a170", 14643 0x279f, 14644 "a171", 14645 0x27a0, 14646 "a172", 14647 0x27a1, 14648 "a173", 14649 0x27a2, 14650 "a162", 14651 0x27a3, 14652 "a174", 14653 0x27a4, 14654 "a175", 14655 0x27a5, 14656 "a176", 14657 0x27a6, 14658 "a177", 14659 0x27a7, 14660 "a178", 14661 0x27a8, 14662 "a179", 14663 0x27a9, 14664 "a193", 14665 0x27aa, 14666 "a180", 14667 0x27ab, 14668 "a199", 14669 0x27ac, 14670 "a181", 14671 0x27ad, 14672 "a200", 14673 0x27ae, 14674 "a182", 14675 0x27af, 14676 "a201", 14677 0x27b1, 14678 "a183", 14679 0x27b2, 14680 "a184", 14681 0x27b3, 14682 "a197", 14683 0x27b4, 14684 "a185", 14685 0x27b5, 14686 "a194", 14687 0x27b6, 14688 "a198", 14689 0x27b7, 14690 "a186", 14691 0x27b8, 14692 "a195", 14693 0x27b9, 14694 "a187", 14695 0x27ba, 14696 "a188", 14697 0x27bb, 14698 "a189", 14699 0x27bc, 14700 "a190", 14701 0x27bd, 14702 "a191", 14703 0x27be, 14704 "a89", 14705 0x2768, 14706 "a90", 14707 0x2769, 14708 "a93", 14709 0x276a, 14710 "a94", 14711 0x276b, 14712 "a91", 14713 0x276c, 14714 "a92", 14715 0x276d, 14716 "a205", 14717 0x276e, 14718 "a85", 14719 0x276f, 14720 "a206", 14721 0x2770, 14722 "a86", 14723 0x2771, 14724 "a87", 14725 0x2772, 14726 "a88", 14727 0x2773, 14728 "a95", 14729 0x2774, 14730 "a96", 14731 0x2775, 14732 ".notdef", 14733 0x0000 14734 ]; 14735}); 14736 14737 14738/***/ }), 14739/* 21 */ 14740/***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => { 14741 14742__w_pdfjs_require__.r(__webpack_exports__); 14743/* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, { 14744/* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes), 14745/* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph), 14746/* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor), 14747/* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues), 14748/* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl) 14749/* harmony export */ }); 14750/* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(9); 14751
14752const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) { 14753 t[63721] = 0x00a9; 14754 t[63193] = 0x00a9; 14755 t[63720] = 0x00ae; 14756 t[63194] = 0x00ae; 14757 t[63722] = 0x2122; 14758 t[63195] = 0x2122; 14759 t[63729] = 0x23a7; 14760 t[63730] = 0x23a8; 14761 t[63731] = 0x23a9; 14762 t[63740] = 0x23ab; 14763 t[63741] = 0x23ac; 14764 t[63742] = 0x23ad; 14765 t[63726] = 0x23a1; 14766 t[63727] = 0x23a2; 14767 t[63728] = 0x23a3; 14768 t[63737] = 0x23a4; 14769 t[63738] = 0x23a5; 14770 t[63739] = 0x23a6; 14771 t[63723] = 0x239b; 14772 t[63724] = 0x239c; 14773 t[63725] = 0x239d; 14774 t[63734] = 0x239e; 14775 t[63735] = 0x239f; 14776 t[63736] = 0x23a0; 14777}); 14778function mapSpecialUnicodeValues(code) { 14779 if (code >= 0xfff0 && code <= 0xffff) { 14780 return 0; 14781 } else if (code >= 0xf600 && code <= 0xf8ff) { 14782 return getSpecialPUASymbols()[code] || code; 14783 } else if (code === 0x00ad) { 14784 return 0x002d; 14785 } 14786 return code; 14787} 14788function getUnicodeForGlyph(name, glyphsUnicodeMap) { 14789 let unicode = glyphsUnicodeMap[name]; 14790 if (unicode !== undefined) { 14791 return unicode; 14792 } 14793 if (!name) { 14794 return -1; 14795 } 14796 if (name[0] === "u") { 14797 const nameLen = name.length; 14798 let hexStr; 14799 if (nameLen === 7 && name[1] === "n" && name[2] === "i") { 14800 hexStr = name.substring(3); 14801 } else if (nameLen >= 5 && nameLen <= 7) { 14802 hexStr = name.substring(1); 14803 } else { 14804 return -1; 14805 } 14806 if (hexStr === hexStr.toUpperCase()) { 14807 unicode = parseInt(hexStr, 16); 14808 if (unicode >= 0) { 14809 return unicode; 14810 } 14811 } 14812 } 14813 return -1; 14814} 14815const UnicodeRanges = [ 14816 { 14817 begin: 0x0000, 14818 end: 0x007f 14819 }, 14820 { 14821 begin: 0x0080, 14822 end: 0x00ff 14823 }, 14824 { 14825 begin: 0x0100, 14826 end: 0x017f 14827 }, 14828 { 14829 begin: 0x0180, 14830 end: 0x024f 14831 }, 14832 { 14833 begin: 0x0250, 14834 end: 0x02af 14835 }, 14836 { 14837 begin: 0x02b0, 14838 end: 0x02ff 14839 }, 14840 { 14841 begin: 0x0300, 14842 end: 0x036f 14843 }, 14844 { 14845 begin: 0x0370, 14846 end: 0x03ff 14847 }, 14848 { 14849 begin: 0x2c80, 14850 end: 0x2cff 14851 }, 14852 { 14853 begin: 0x0400, 14854 end: 0x04ff 14855 }, 14856 { 14857 begin: 0x0530, 14858 end: 0x058f 14859 }, 14860 { 14861 begin: 0x0590, 14862 end: 0x05ff 14863 }, 14864 { 14865 begin: 0xa500, 14866 end: 0xa63f 14867 }, 14868 { 14869 begin: 0x0600, 14870 end: 0x06ff 14871 }, 14872 { 14873 begin: 0x07c0, 14874 end: 0x07ff 14875 }, 14876 { 14877 begin: 0x0900, 14878 end: 0x097f 14879 }, 14880 { 14881 begin: 0x0980, 14882 end: 0x09ff 14883 }, 14884 { 14885 begin: 0x0a00, 14886 end: 0x0a7f 14887 }, 14888 { 14889 begin: 0x0a80, 14890 end: 0x0aff 14891 }, 14892 { 14893 begin: 0x0b00, 14894 end: 0x0b7f 14895 }, 14896 { 14897 begin: 0x0b80, 14898 end: 0x0bff 14899 }, 14900 { 14901 begin: 0x0c00, 14902 end: 0x0c7f 14903 }, 14904 { 14905 begin: 0x0c80, 14906 end: 0x0cff 14907 }, 14908 { 14909 begin: 0x0d00, 14910 end: 0x0d7f 14911 }, 14912 { 14913 begin: 0x0e00, 14914 end: 0x0e7f 14915 }, 14916 { 14917 begin: 0x0e80, 14918 end: 0x0eff 14919 }, 14920 { 14921 begin: 0x10a0, 14922 end: 0x10ff 14923 }, 14924 { 14925 begin: 0x1b00, 14926 end: 0x1b7f 14927 }, 14928 { 14929 begin: 0x1100, 14930 end: 0x11ff 14931 }, 14932 { 14933 begin: 0x1e00, 14934 end: 0x1eff 14935 }, 14936 { 14937 begin: 0x1f00, 14938 end: 0x1fff 14939 }, 14940 { 14941 begin: 0x2000, 14942 end: 0x206f 14943 }, 14944 { 14945 begin: 0x2070, 14946 end: 0x209f 14947 }, 14948 { 14949 begin: 0x20a0, 14950 end: 0x20cf 14951 }, 14952 { 14953 begin: 0x20d0, 14954 end: 0x20ff 14955 }, 14956 { 14957 begin: 0x2100, 14958 end: 0x214f 14959 }, 14960 { 14961 begin: 0x2150, 14962 end: 0x218f 14963 }, 14964 { 14965 begin: 0x2190, 14966 end: 0x21ff 14967 }, 14968 { 14969 begin: 0x2200, 14970 end: 0x22ff 14971 }, 14972 { 14973 begin: 0x2300, 14974 end: 0x23ff 14975 }, 14976 { 14977 begin: 0x2400, 14978 end: 0x243f 14979 }, 14980 { 14981 begin: 0x2440, 14982 end: 0x245f 14983 }, 14984 { 14985 begin: 0x2460, 14986 end: 0x24ff 14987 }, 14988 { 14989 begin: 0x2500, 14990 end: 0x257f 14991 }, 14992 { 14993 begin: 0x2580, 14994 end: 0x259f 14995 }, 14996 { 14997 begin: 0x25a0, 14998 end: 0x25ff 14999 }, 15000 { 15001 begin: 0x2600, 15002 end: 0x26ff 15003 }, 15004 { 15005 begin: 0x2700, 15006 end: 0x27bf 15007 }, 15008 { 15009 begin: 0x3000, 15010 end: 0x303f 15011 }, 15012 { 15013 begin: 0x3040, 15014 end: 0x309f 15015 }, 15016 { 15017 begin: 0x30a0, 15018 end: 0x30ff 15019 }, 15020 { 15021 begin: 0x3100, 15022 end: 0x312f 15023 }, 15024 { 15025 begin: 0x3130, 15026 end: 0x318f 15027 }, 15028 { 15029 begin: 0xa840, 15030 end: 0xa87f 15031 }, 15032 { 15033 begin: 0x3200, 15034 end: 0x32ff 15035 }, 15036 { 15037 begin: 0x3300, 15038 end: 0x33ff 15039 }, 15040 { 15041 begin: 0xac00, 15042 end: 0xd7af 15043 }, 15044 { 15045 begin: 0xd800, 15046 end: 0xdfff 15047 }, 15048 { 15049 begin: 0x10900, 15050 end: 0x1091f 15051 }, 15052 { 15053 begin: 0x4e00, 15054 end: 0x9fff 15055 }, 15056 { 15057 begin: 0xe000, 15058 end: 0xf8ff 15059 }, 15060 { 15061 begin: 0x31c0, 15062 end: 0x31ef 15063 }, 15064 { 15065 begin: 0xfb00, 15066 end: 0xfb4f 15067 }, 15068 { 15069 begin: 0xfb50, 15070 end: 0xfdff 15071 }, 15072 { 15073 begin: 0xfe20, 15074 end: 0xfe2f 15075 }, 15076 { 15077 begin: 0xfe10, 15078 end: 0xfe1f 15079 }, 15080 { 15081 begin: 0xfe50, 15082 end: 0xfe6f 15083 }, 15084 { 15085 begin: 0xfe70, 15086 end: 0xfeff 15087 }, 15088 { 15089 begin: 0xff00, 15090 end: 0xffef 15091 }, 15092 { 15093 begin: 0xfff0, 15094 end: 0xffff 15095 }, 15096 { 15097 begin: 0x0f00, 15098 end: 0x0fff 15099 }, 15100 { 15101 begin: 0x0700, 15102 end: 0x074f 15103 }, 15104 { 15105 begin: 0x0780, 15106 end: 0x07bf 15107 }, 15108 { 15109 begin: 0x0d80, 15110 end: 0x0dff 15111 }, 15112 { 15113 begin: 0x1000, 15114 end: 0x109f 15115 }, 15116 { 15117 begin: 0x1200, 15118 end: 0x137f 15119 }, 15120 { 15121 begin: 0x13a0, 15122 end: 0x13ff 15123 }, 15124 { 15125 begin: 0x1400, 15126 end: 0x167f 15127 }, 15128 { 15129 begin: 0x1680, 15130 end: 0x169f 15131 }, 15132 { 15133 begin: 0x16a0, 15134 end: 0x16ff 15135 }, 15136 { 15137 begin: 0x1780, 15138 end: 0x17ff 15139 }, 15140 { 15141 begin: 0x1800, 15142 end: 0x18af 15143 }, 15144 { 15145 begin: 0x2800, 15146 end: 0x28ff 15147 }, 15148 { 15149 begin: 0xa000, 15150 end: 0xa48f 15151 }, 15152 { 15153 begin: 0x1700, 15154 end: 0x171f 15155 }, 15156 { 15157 begin: 0x10300, 15158 end: 0x1032f 15159 }, 15160 { 15161 begin: 0x10330, 15162 end: 0x1034f 15163 }, 15164 { 15165 begin: 0x10400, 15166 end: 0x1044f 15167 }, 15168 { 15169 begin: 0x1d000, 15170 end: 0x1d0ff 15171 }, 15172 { 15173 begin: 0x1d400, 15174 end: 0x1d7ff 15175 }, 15176 { 15177 begin: 0xff000, 15178 end: 0xffffd 15179 }, 15180 { 15181 begin: 0xfe00, 15182 end: 0xfe0f 15183 }, 15184 { 15185 begin: 0xe0000, 15186 end: 0xe007f 15187 }, 15188 { 15189 begin: 0x1900, 15190 end: 0x194f 15191 }, 15192 { 15193 begin: 0x1950, 15194 end: 0x197f 15195 }, 15196 { 15197 begin: 0x1980, 15198 end: 0x19df 15199 }, 15200 { 15201 begin: 0x1a00, 15202 end: 0x1a1f 15203 }, 15204 { 15205 begin: 0x2c00, 15206 end: 0x2c5f 15207 }, 15208 { 15209 begin: 0x2d30, 15210 end: 0x2d7f 15211 }, 15212 { 15213 begin: 0x4dc0, 15214 end: 0x4dff 15215 }, 15216 { 15217 begin: 0xa800, 15218 end: 0xa82f 15219 }, 15220 { 15221 begin: 0x10000, 15222 end: 0x1007f 15223 }, 15224 { 15225 begin: 0x10140, 15226 end: 0x1018f 15227 }, 15228 { 15229 begin: 0x10380, 15230 end: 0x1039f 15231 }, 15232 { 15233 begin: 0x103a0, 15234 end: 0x103df 15235 }, 15236 { 15237 begin: 0x10450, 15238 end: 0x1047f 15239 }, 15240 { 15241 begin: 0x10480, 15242 end: 0x104af 15243 }, 15244 { 15245 begin: 0x10800, 15246 end: 0x1083f 15247 }, 15248 { 15249 begin: 0x10a00, 15250 end: 0x10a5f 15251 }, 15252 { 15253 begin: 0x1d300, 15254 end: 0x1d35f 15255 }, 15256 { 15257 begin: 0x12000, 15258 end: 0x123ff 15259 }, 15260 { 15261 begin: 0x1d360, 15262 end: 0x1d37f 15263 }, 15264 { 15265 begin: 0x1b80, 15266 end: 0x1bbf 15267 }, 15268 { 15269 begin: 0x1c00, 15270 end: 0x1c4f 15271 }, 15272 { 15273 begin: 0x1c50, 15274 end: 0x1c7f 15275 }, 15276 { 15277 begin: 0xa880, 15278 end: 0xa8df 15279 }, 15280 { 15281 begin: 0xa900, 15282 end: 0xa92f 15283 }, 15284 { 15285 begin: 0xa930, 15286 end: 0xa95f 15287 }, 15288 { 15289 begin: 0xaa00, 15290 end: 0xaa5f 15291 }, 15292 { 15293 begin: 0x10190, 15294 end: 0x101cf 15295 }, 15296 { 15297 begin: 0x101d0, 15298 end: 0x101ff 15299 }, 15300 { 15301 begin: 0x102a0, 15302 end: 0x102df 15303 }, 15304 { 15305 begin: 0x1f030, 15306 end: 0x1f09f 15307 } 15308]; 15309function getUnicodeRangeFor(value) { 15310 for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) { 15311 const range = UnicodeRanges[i]; 15312 if (value >= range.begin && value < range.end) { 15313 return i; 15314 } 15315 } 15316 return -1; 15317} 15318function isRTLRangeFor(value) { 15319 let range = UnicodeRanges[13]; 15320 if (value >= range.begin && value < range.end) { 15321 return true; 15322 } 15323 range = UnicodeRanges[11]; 15324 if (value >= range.begin && value < range.end) { 15325 return true; 15326 } 15327 return false;
15328} 15329const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () { 15330 return [ 15331 "\u00A8", 15332 "\u0020\u0308", 15333 "\u00AF", 15334 "\u0020\u0304", 15335 "\u00B4", 15336 "\u0020\u0301", 15337 "\u00B5", 15338 "\u03BC", 15339 "\u00B8", 15340 "\u0020\u0327", 15341 "\u0132", 15342 "\u0049\u004A", 15343 "\u0133", 15344 "\u0069\u006A", 15345 "\u013F", 15346 "\u004C\u00B7", 15347 "\u0140", 15348 "\u006C\u00B7", 15349 "\u0149", 15350 "\u02BC\u006E", 15351 "\u017F", 15352 "\u0073", 15353 "\u01C4", 15354 "\u0044\u017D", 15355 "\u01C5", 15356 "\u0044\u017E", 15357 "\u01C6", 15358 "\u0064\u017E", 15359 "\u01C7", 15360 "\u004C\u004A", 15361 "\u01C8", 15362 "\u004C\u006A", 15363 "\u01C9", 15364 "\u006C\u006A", 15365 "\u01CA", 15366 "\u004E\u004A", 15367 "\u01CB", 15368 "\u004E\u006A", 15369 "\u01CC", 15370 "\u006E\u006A", 15371 "\u01F1", 15372 "\u0044\u005A", 15373 "\u01F2", 15374 "\u0044\u007A", 15375 "\u01F3", 15376 "\u0064\u007A", 15377 "\u02D8", 15378 "\u0020\u0306", 15379 "\u02D9", 15380 "\u0020\u0307", 15381 "\u02DA", 15382 "\u0020\u030A", 15383 "\u02DB", 15384 "\u0020\u0328", 15385 "\u02DC", 15386 "\u0020\u0303", 15387 "\u02DD", 15388 "\u0020\u030B", 15389 "\u037A", 15390 "\u0020\u0345", 15391 "\u0384", 15392 "\u0020\u0301", 15393 "\u03D0", 15394 "\u03B2", 15395 "\u03D1", 15396 "\u03B8", 15397 "\u03D2", 15398 "\u03A5", 15399 "\u03D5", 15400 "\u03C6", 15401 "\u03D6", 15402 "\u03C0", 15403 "\u03F0", 15404 "\u03BA", 15405 "\u03F1", 15406 "\u03C1", 15407 "\u03F2", 15408 "\u03C2", 15409 "\u03F4", 15410 "\u0398", 15411 "\u03F5", 15412 "\u03B5", 15413 "\u03F9", 15414 "\u03A3", 15415 "\u0587", 15416 "\u0565\u0582", 15417 "\u0675", 15418 "\u0627\u0674", 15419 "\u0676", 15420 "\u0648\u0674", 15421 "\u0677", 15422 "\u06C7\u0674", 15423 "\u0678", 15424 "\u064A\u0674", 15425 "\u0E33", 15426 "\u0E4D\u0E32", 15427 "\u0EB3", 15428 "\u0ECD\u0EB2", 15429 "\u0EDC", 15430 "\u0EAB\u0E99", 15431 "\u0EDD", 15432 "\u0EAB\u0EA1", 15433 "\u0F77", 15434 "\u0FB2\u0F81", 15435 "\u0F79", 15436 "\u0FB3\u0F81", 15437 "\u1E9A", 15438 "\u0061\u02BE", 15439 "\u1FBD", 15440 "\u0020\u0313", 15441 "\u1FBF", 15442 "\u0020\u0313", 15443 "\u1FC0", 15444 "\u0020\u0342", 15445 "\u1FFE", 15446 "\u0020\u0314", 15447 "\u2002", 15448 "\u0020", 15449 "\u2003", 15450 "\u0020", 15451 "\u2004", 15452 "\u0020", 15453 "\u2005", 15454 "\u0020", 15455 "\u2006", 15456 "\u0020", 15457 "\u2008", 15458 "\u0020", 15459 "\u2009", 15460 "\u0020", 15461 "\u200A", 15462 "\u0020", 15463 "\u2017", 15464 "\u0020\u0333", 15465 "\u2024", 15466 "\u002E", 15467 "\u2025", 15468 "\u002E\u002E", 15469 "\u2026", 15470 "\u002E\u002E\u002E", 15471 "\u2033", 15472 "\u2032\u2032", 15473 "\u2034", 15474 "\u2032\u2032\u2032", 15475 "\u2036", 15476 "\u2035\u2035", 15477 "\u2037", 15478 "\u2035\u2035\u2035", 15479 "\u203C", 15480 "\u0021\u0021", 15481 "\u203E", 15482 "\u0020\u0305", 15483 "\u2047", 15484 "\u003F\u003F", 15485 "\u2048", 15486 "\u003F\u0021", 15487 "\u2049", 15488 "\u0021\u003F", 15489 "\u2057", 15490 "\u2032\u2032\u2032\u2032", 15491 "\u205F", 15492 "\u0020", 15493 "\u20A8", 15494 "\u0052\u0073", 15495 "\u2100", 15496 "\u0061\u002F\u0063", 15497 "\u2101", 15498 "\u0061\u002F\u0073", 15499 "\u2103", 15500 "\u00B0\u0043", 15501 "\u2105", 15502 "\u0063\u002F\u006F", 15503 "\u2106", 15504 "\u0063\u002F\u0075", 15505 "\u2107", 15506 "\u0190", 15507 "\u2109", 15508 "\u00B0\u0046", 15509 "\u2116", 15510 "\u004E\u006F", 15511 "\u2121", 15512 "\u0054\u0045\u004C", 15513 "\u2135", 15514 "\u05D0", 15515 "\u2136", 15516 "\u05D1", 15517 "\u2137", 15518 "\u05D2", 15519 "\u2138", 15520 "\u05D3", 15521 "\u213B", 15522 "\u0046\u0041\u0058", 15523 "\u2160", 15524 "\u0049", 15525 "\u2161", 15526 "\u0049\u0049", 15527 "\u2162", 15528 "\u0049\u0049\u0049", 15529 "\u2163", 15530 "\u0049\u0056", 15531 "\u2164", 15532 "\u0056", 15533 "\u2165", 15534 "\u0056\u0049", 15535 "\u2166", 15536 "\u0056\u0049\u0049", 15537 "\u2167", 15538 "\u0056\u0049\u0049\u0049", 15539 "\u2168", 15540 "\u0049\u0058", 15541 "\u2169", 15542 "\u0058", 15543 "\u216A", 15544 "\u0058\u0049", 15545 "\u216B", 15546 "\u0058\u0049\u0049", 15547 "\u216C", 15548 "\u004C", 15549 "\u216D", 15550 "\u0043", 15551 "\u216E", 15552 "\u0044", 15553 "\u216F", 15554 "\u004D", 15555 "\u2170", 15556 "\u0069", 15557 "\u2171", 15558 "\u0069\u0069", 15559 "\u2172", 15560 "\u0069\u0069\u0069", 15561 "\u2173", 15562 "\u0069\u0076", 15563 "\u2174", 15564 "\u0076", 15565 "\u2175", 15566 "\u0076\u0069", 15567 "\u2176", 15568 "\u0076\u0069\u0069", 15569 "\u2177", 15570 "\u0076\u0069\u0069\u0069", 15571 "\u2178", 15572 "\u0069\u0078", 15573 "\u2179", 15574 "\u0078", 15575 "\u217A", 15576 "\u0078\u0069", 15577 "\u217B", 15578 "\u0078\u0069\u0069", 15579 "\u217C", 15580 "\u006C", 15581 "\u217D", 15582 "\u0063", 15583 "\u217E", 15584 "\u0064", 15585 "\u217F", 15586 "\u006D", 15587 "\u222C", 15588 "\u222B\u222B", 15589 "\u222D", 15590 "\u222B\u222B\u222B", 15591 "\u222F", 15592 "\u222E\u222E", 15593 "\u2230", 15594 "\u222E\u222E\u222E", 15595 "\u2474", 15596 "\u0028\u0031\u0029", 15597 "\u2475", 15598 "\u0028\u0032\u0029", 15599 "\u2476", 15600 "\u0028\u0033\u0029", 15601 "\u2477", 15602 "\u0028\u0034\u0029", 15603 "\u2478", 15604 "\u0028\u0035\u0029", 15605 "\u2479", 15606 "\u0028\u0036\u0029", 15607 "\u247A", 15608 "\u0028\u0037\u0029", 15609 "\u247B", 15610 "\u0028\u0038\u0029", 15611 "\u247C", 15612 "\u0028\u0039\u0029", 15613 "\u247D", 15614 "\u0028\u0031\u0030\u0029", 15615 "\u247E", 15616 "\u0028\u0031\u0031\u0029", 15617 "\u247F", 15618 "\u0028\u0031\u0032\u0029", 15619 "\u2480", 15620 "\u0028\u0031\u0033\u0029", 15621 "\u2481", 15622 "\u0028\u0031\u0034\u0029", 15623 "\u2482", 15624 "\u0028\u0031\u0035\u0029", 15625 "\u2483", 15626 "\u0028\u0031\u0036\u0029", 15627 "\u2484", 15628 "\u0028\u0031\u0037\u0029", 15629 "\u2485", 15630 "\u0028\u0031\u0038\u0029", 15631 "\u2486", 15632 "\u0028\u0031\u0039\u0029", 15633 "\u2487", 15634 "\u0028\u0032\u0030\u0029", 15635 "\u2488", 15636 "\u0031\u002E", 15637 "\u2489", 15638 "\u0032\u002E", 15639 "\u248A", 15640 "\u0033\u002E", 15641 "\u248B", 15642 "\u0034\u002E", 15643 "\u248C", 15644 "\u0035\u002E", 15645 "\u248D", 15646 "\u0036\u002E", 15647 "\u248E", 15648 "\u0037\u002E", 15649 "\u248F", 15650 "\u0038\u002E", 15651 "\u2490", 15652 "\u0039\u002E", 15653 "\u2491", 15654 "\u0031\u0030\u002E", 15655 "\u2492", 15656 "\u0031\u0031\u002E", 15657 "\u2493", 15658 "\u0031\u0032\u002E", 15659 "\u2494", 15660 "\u0031\u0033\u002E", 15661 "\u2495", 15662 "\u0031\u0034\u002E", 15663 "\u2496", 15664 "\u0031\u0035\u002E", 15665 "\u2497", 15666 "\u0031\u0036\u002E", 15667 "\u2498", 15668 "\u0031\u0037\u002E", 15669 "\u2499", 15670 "\u0031\u0038\u002E", 15671 "\u249A", 15672 "\u0031\u0039\u002E", 15673 "\u249B", 15674 "\u0032\u0030\u002E", 15675 "\u249C", 15676 "\u0028\u0061\u0029", 15677 "\u249D", 15678 "\u0028\u0062\u0029", 15679 "\u249E", 15680 "\u0028\u0063\u0029", 15681 "\u249F", 15682 "\u0028\u0064\u0029", 15683 "\u24A0", 15684 "\u0028\u0065\u0029", 15685 "\u24A1", 15686 "\u0028\u0066\u0029", 15687 "\u24A2", 15688 "\u0028\u0067\u0029", 15689 "\u24A3", 15690 "\u0028\u0068\u0029", 15691 "\u24A4", 15692 "\u0028\u0069\u0029", 15693 "\u24A5", 15694 "\u0028\u006A\u0029", 15695 "\u24A6", 15696 "\u0028\u006B\u0029", 15697 "\u24A7", 15698 "\u0028\u006C\u0029", 15699 "\u24A8", 15700 "\u0028\u006D\u0029", 15701 "\u24A9", 15702 "\u0028\u006E\u0029", 15703 "\u24AA", 15704 "\u0028\u006F\u0029", 15705 "\u24AB", 15706 "\u0028\u0070\u0029", 15707 "\u24AC", 15708 "\u0028\u0071\u0029", 15709 "\u24AD", 15710 "\u0028\u0072\u0029", 15711 "\u24AE", 15712 "\u0028\u0073\u0029", 15713 "\u24AF", 15714 "\u0028\u0074\u0029", 15715 "\u24B0", 15716 "\u0028\u0075\u0029", 15717 "\u24B1", 15718 "\u0028\u0076\u0029", 15719 "\u24B2", 15720 "\u0028\u0077\u0029", 15721 "\u24B3", 15722 "\u0028\u0078\u0029", 15723 "\u24B4", 15724 "\u0028\u0079\u0029", 15725 "\u24B5", 15726 "\u0028\u007A\u0029", 15727 "\u2A0C", 15728 "\u222B\u222B\u222B\u222B", 15729 "\u2A74", 15730 "\u003A\u003A\u003D", 15731 "\u2A75", 15732 "\u003D\u003D", 15733 "\u2A76", 15734 "\u003D\u003D\u003D", 15735 "\u2E9F", 15736 "\u6BCD", 15737 "\u2EF3", 15738 "\u9F9F", 15739 "\u2F00", 15740 "\u4E00", 15741 "\u2F01", 15742 "\u4E28", 15743 "\u2F02", 15744 "\u4E36", 15745 "\u2F03", 15746 "\u4E3F", 15747 "\u2F04", 15748 "\u4E59", 15749 "\u2F05", 15750 "\u4E85", 15751 "\u2F06", 15752 "\u4E8C", 15753 "\u2F07", 15754 "\u4EA0", 15755 "\u2F08", 15756 "\u4EBA", 15757 "\u2F09", 15758 "\u513F", 15759 "\u2F0A", 15760 "\u5165", 15761 "\u2F0B", 15762 "\u516B", 15763 "\u2F0C", 15764 "\u5182", 15765 "\u2F0D", 15766 "\u5196", 15767 "\u2F0E", 15768 "\u51AB", 15769 "\u2F0F", 15770 "\u51E0", 15771 "\u2F10", 15772 "\u51F5", 15773 "\u2F11", 15774 "\u5200", 15775 "\u2F12", 15776 "\u529B", 15777 "\u2F13", 15778 "\u52F9", 15779 "\u2F14", 15780 "\u5315", 15781 "\u2F15", 15782 "\u531A", 15783 "\u2F16", 15784 "\u5338", 15785 "\u2F17", 15786 "\u5341", 15787 "\u2F18", 15788 "\u535C", 15789 "\u2F19", 15790 "\u5369", 15791 "\u2F1A", 15792 "\u5382", 15793 "\u2F1B", 15794 "\u53B6", 15795 "\u2F1C", 15796 "\u53C8", 15797 "\u2F1D", 15798 "\u53E3", 15799 "\u2F1E", 15800 "\u56D7", 15801 "\u2F1F", 15802 "\u571F", 15803 "\u2F20", 15804 "\u58EB", 15805 "\u2F21", 15806 "\u5902", 15807 "\u2F22", 15808 "\u590A", 15809 "\u2F23", 15810 "\u5915", 15811 "\u2F24", 15812 "\u5927", 15813 "\u2F25", 15814 "\u5973", 15815 "\u2F26", 15816 "\u5B50", 15817 "\u2F27", 15818 "\u5B80", 15819 "\u2F28", 15820 "\u5BF8", 15821 "\u2F29", 15822 "\u5C0F", 15823 "\u2F2A", 15824 "\u5C22", 15825 "\u2F2B", 15826 "\u5C38", 15827 "\u2F2C", 15828 "\u5C6E", 15829 "\u2F2D", 15830 "\u5C71", 15831 "\u2F2E", 15832 "\u5DDB", 15833 "\u2F2F", 15834 "\u5DE5", 15835 "\u2F30", 15836 "\u5DF1", 15837 "\u2F31", 15838 "\u5DFE", 15839 "\u2F32", 15840 "\u5E72", 15841 "\u2F33", 15842 "\u5E7A", 15843 "\u2F34", 15844 "\u5E7F", 15845 "\u2F35", 15846 "\u5EF4", 15847 "\u2F36", 15848 "\u5EFE", 15849 "\u2F37", 15850 "\u5F0B", 15851 "\u2F38", 15852 "\u5F13", 15853 "\u2F39", 15854 "\u5F50", 15855 "\u2F3A", 15856 "\u5F61", 15857 "\u2F3B", 15858 "\u5F73", 15859 "\u2F3C", 15860 "\u5FC3", 15861 "\u2F3D", 15862 "\u6208", 15863 "\u2F3E", 15864 "\u6236", 15865 "\u2F3F", 15866 "\u624B", 15867 "\u2F40", 15868 "\u652F", 15869 "\u2F41", 15870 "\u6534", 15871 "\u2F42", 15872 "\u6587", 15873 "\u2F43", 15874 "\u6597", 15875 "\u2F44", 15876 "\u65A4", 15877 "\u2F45", 15878 "\u65B9", 15879 "\u2F46", 15880 "\u65E0", 15881 "\u2F47", 15882 "\u65E5", 15883 "\u2F48", 15884 "\u66F0", 15885 "\u2F49", 15886 "\u6708", 15887 "\u2F4A", 15888 "\u6728", 15889 "\u2F4B", 15890 "\u6B20", 15891 "\u2F4C", 15892 "\u6B62", 15893 "\u2F4D", 15894 "\u6B79", 15895 "\u2F4E", 15896 "\u6BB3", 15897 "\u2F4F", 15898 "\u6BCB", 15899 "\u2F50", 15900 "\u6BD4", 15901 "\u2F51", 15902 "\u6BDB", 15903 "\u2F52", 15904 "\u6C0F", 15905 "\u2F53", 15906 "\u6C14", 15907 "\u2F54", 15908 "\u6C34", 15909 "\u2F55", 15910 "\u706B", 15911 "\u2F56", 15912 "\u722A", 15913 "\u2F57", 15914 "\u7236", 15915 "\u2F58", 15916 "\u723B", 15917 "\u2F59", 15918 "\u723F", 15919 "\u2F5A", 15920 "\u7247", 15921 "\u2F5B", 15922 "\u7259", 15923 "\u2F5C", 15924 "\u725B", 15925 "\u2F5D", 15926 "\u72AC", 15927 "\u2F5E", 15928 "\u7384", 15929 "\u2F5F", 15930 "\u7389", 15931 "\u2F60", 15932 "\u74DC", 15933 "\u2F61", 15934 "\u74E6", 15935 "\u2F62", 15936 "\u7518", 15937 "\u2F63", 15938 "\u751F", 15939 "\u2F64", 15940 "\u7528", 15941 "\u2F65", 15942 "\u7530", 15943 "\u2F66", 15944 "\u758B", 15945 "\u2F67", 15946 "\u7592", 15947 "\u2F68", 15948 "\u7676", 15949 "\u2F69", 15950 "\u767D", 15951 "\u2F6A", 15952 "\u76AE", 15953 "\u2F6B", 15954 "\u76BF", 15955 "\u2F6C", 15956 "\u76EE", 15957 "\u2F6D", 15958 "\u77DB", 15959 "\u2F6E", 15960 "\u77E2", 15961 "\u2F6F", 15962 "\u77F3", 15963 "\u2F70", 15964 "\u793A", 15965 "\u2F71", 15966 "\u79B8", 15967 "\u2F72", 15968 "\u79BE", 15969 "\u2F73", 15970 "\u7A74", 15971 "\u2F74", 15972 "\u7ACB", 15973 "\u2F75", 15974 "\u7AF9", 15975 "\u2F76", 15976 "\u7C73", 15977 "\u2F77", 15978 "\u7CF8", 15979 "\u2F78", 15980 "\u7F36", 15981 "\u2F79", 15982 "\u7F51", 15983 "\u2F7A", 15984 "\u7F8A", 15985 "\u2F7B", 15986 "\u7FBD", 15987 "\u2F7C", 15988 "\u8001", 15989 "\u2F7D", 15990 "\u800C", 15991 "\u2F7E", 15992 "\u8012", 15993 "\u2F7F", 15994 "\u8033", 15995 "\u2F80", 15996 "\u807F", 15997 "\u2F81", 15998 "\u8089", 15999 "\u2F82", 16000 "\u81E3", 16001 "\u2F83", 16002 "\u81EA", 16003 "\u2F84", 16004 "\u81F3", 16005 "\u2F85", 16006 "\u81FC", 16007 "\u2F86", 16008 "\u820C", 16009 "\u2F87", 16010 "\u821B", 16011 "\u2F88", 16012 "\u821F", 16013 "\u2F89", 16014 "\u826E", 16015 "\u2F8A", 16016 "\u8272", 16017 "\u2F8B", 16018 "\u8278", 16019 "\u2F8C", 16020 "\u864D", 16021 "\u2F8D", 16022 "\u866B", 16023 "\u2F8E", 16024 "\u8840", 16025 "\u2F8F", 16026 "\u884C", 16027 "\u2F90", 16028 "\u8863", 16029 "\u2F91", 16030 "\u897E", 16031 "\u2F92", 16032 "\u898B", 16033 "\u2F93", 16034 "\u89D2", 16035 "\u2F94", 16036 "\u8A00", 16037 "\u2F95", 16038 "\u8C37", 16039 "\u2F96", 16040 "\u8C46", 16041 "\u2F97", 16042 "\u8C55", 16043 "\u2F98", 16044 "\u8C78", 16045 "\u2F99", 16046 "\u8C9D", 16047 "\u2F9A", 16048 "\u8D64", 16049 "\u2F9B", 16050 "\u8D70", 16051 "\u2F9C", 16052 "\u8DB3", 16053 "\u2F9D", 16054 "\u8EAB", 16055 "\u2F9E", 16056 "\u8ECA", 16057 "\u2F9F", 16058 "\u8F9B", 16059 "\u2FA0", 16060 "\u8FB0", 16061 "\u2FA1", 16062 "\u8FB5", 16063 "\u2FA2", 16064 "\u9091", 16065 "\u2FA3", 16066 "\u9149", 16067 "\u2FA4", 16068 "\u91C6", 16069 "\u2FA5", 16070 "\u91CC", 16071 "\u2FA6", 16072 "\u91D1", 16073 "\u2FA7", 16074 "\u9577", 16075 "\u2FA8", 16076 "\u9580", 16077 "\u2FA9", 16078 "\u961C", 16079 "\u2FAA", 16080 "\u96B6", 16081 "\u2FAB", 16082 "\u96B9", 16083 "\u2FAC", 16084 "\u96E8", 16085 "\u2FAD", 16086 "\u9751", 16087 "\u2FAE", 16088 "\u975E", 16089 "\u2FAF", 16090 "\u9762", 16091 "\u2FB0", 16092 "\u9769", 16093 "\u2FB1", 16094 "\u97CB", 16095 "\u2FB2", 16096 "\u97ED", 16097 "\u2FB3", 16098 "\u97F3", 16099 "\u2FB4", 16100 "\u9801", 16101 "\u2FB5", 16102 "\u98A8", 16103 "\u2FB6", 16104 "\u98DB", 16105 "\u2FB7", 16106 "\u98DF", 16107 "\u2FB8", 16108 "\u9996", 16109 "\u2FB9", 16110 "\u9999", 16111 "\u2FBA", 16112 "\u99AC", 16113 "\u2FBB", 16114 "\u9AA8", 16115 "\u2FBC", 16116 "\u9AD8", 16117 "\u2FBD", 16118 "\u9ADF", 16119 "\u2FBE", 16120 "\u9B25", 16121 "\u2FBF", 16122 "\u9B2F", 16123 "\u2FC0", 16124 "\u9B32", 16125 "\u2FC1", 16126 "\u9B3C", 16127 "\u2FC2", 16128 "\u9B5A", 16129 "\u2FC3", 16130 "\u9CE5", 16131 "\u2FC4", 16132 "\u9E75", 16133 "\u2FC5", 16134 "\u9E7F", 16135 "\u2FC6", 16136 "\u9EA5", 16137 "\u2FC7", 16138 "\u9EBB", 16139 "\u2FC8", 16140 "\u9EC3", 16141 "\u2FC9", 16142 "\u9ECD", 16143 "\u2FCA", 16144 "\u9ED1", 16145 "\u2FCB", 16146 "\u9EF9", 16147 "\u2FCC", 16148 "\u9EFD", 16149 "\u2FCD", 16150 "\u9F0E", 16151 "\u2FCE", 16152 "\u9F13", 16153 "\u2FCF", 16154 "\u9F20", 16155 "\u2FD0", 16156 "\u9F3B", 16157 "\u2FD1", 16158 "\u9F4A", 16159 "\u2FD2", 16160 "\u9F52", 16161 "\u2FD3", 16162 "\u9F8D", 16163 "\u2FD4", 16164 "\u9F9C", 16165 "\u2FD5", 16166 "\u9FA0", 16167 "\u3036", 16168 "\u3012", 16169 "\u3038", 16170 "\u5341", 16171 "\u3039", 16172 "\u5344", 16173 "\u303A", 16174 "\u5345", 16175 "\u309B", 16176 "\u0020\u3099", 16177 "\u309C", 16178 "\u0020\u309A", 16179 "\u3131", 16180 "\u1100", 16181 "\u3132", 16182 "\u1101", 16183 "\u3133", 16184 "\u11AA", 16185 "\u3134", 16186 "\u1102", 16187 "\u3135", 16188 "\u11AC", 16189 "\u3136", 16190 "\u11AD", 16191 "\u3137", 16192 "\u1103", 16193 "\u3138", 16194 "\u1104", 16195 "\u3139", 16196 "\u1105", 16197 "\u313A", 16198 "\u11B0", 16199 "\u313B", 16200 "\u11B1", 16201 "\u313C", 16202 "\u11B2", 16203 "\u313D", 16204 "\u11B3", 16205 "\u313E", 16206 "\u11B4", 16207 "\u313F", 16208 "\u11B5", 16209 "\u3140", 16210 "\u111A", 16211 "\u3141", 16212 "\u1106", 16213 "\u3142", 16214 "\u1107", 16215 "\u3143", 16216 "\u1108", 16217 "\u3144", 16218 "\u1121", 16219 "\u3145", 16220 "\u1109", 16221 "\u3146", 16222 "\u110A", 16223 "\u3147", 16224 "\u110B", 16225 "\u3148", 16226 "\u110C", 16227 "\u3149", 16228 "\u110D", 16229 "\u314A", 16230 "\u110E", 16231 "\u314B", 16232 "\u110F", 16233 "\u314C", 16234 "\u1110", 16235 "\u314D", 16236 "\u1111", 16237 "\u314E", 16238 "\u1112", 16239 "\u314F", 16240 "\u1161", 16241 "\u3150", 16242 "\u1162", 16243 "\u3151", 16244 "\u1163", 16245 "\u3152", 16246 "\u1164", 16247 "\u3153", 16248 "\u1165", 16249 "\u3154", 16250 "\u1166", 16251 "\u3155", 16252 "\u1167", 16253 "\u3156", 16254 "\u1168", 16255 "\u3157", 16256 "\u1169", 16257 "\u3158", 16258 "\u116A", 16259 "\u3159", 16260 "\u116B", 16261 "\u315A", 16262 "\u116C", 16263 "\u315B", 16264 "\u116D", 16265 "\u315C", 16266 "\u116E", 16267 "\u315D", 16268 "\u116F", 16269 "\u315E", 16270 "\u1170", 16271 "\u315F", 16272 "\u1171", 16273 "\u3160", 16274 "\u1172", 16275 "\u3161", 16276 "\u1173", 16277 "\u3162", 16278 "\u1174", 16279 "\u3163", 16280 "\u1175", 16281 "\u3164", 16282 "\u1160", 16283 "\u3165", 16284 "\u1114", 16285 "\u3166", 16286 "\u1115", 16287 "\u3167", 16288 "\u11C7", 16289 "\u3168", 16290 "\u11C8", 16291 "\u3169", 16292 "\u11CC", 16293 "\u316A", 16294 "\u11CE", 16295 "\u316B", 16296 "\u11D3", 16297 "\u316C", 16298 "\u11D7", 16299 "\u316D", 16300 "\u11D9", 16301 "\u316E", 16302 "\u111C", 16303 "\u316F", 16304 "\u11DD", 16305 "\u3170", 16306 "\u11DF", 16307 "\u3171", 16308 "\u111D", 16309 "\u3172", 16310 "\u111E", 16311 "\u3173", 16312 "\u1120", 16313 "\u3174", 16314 "\u1122", 16315 "\u3175", 16316 "\u1123", 16317 "\u3176", 16318 "\u1127", 16319 "\u3177", 16320 "\u1129", 16321 "\u3178", 16322 "\u112B", 16323 "\u3179", 16324 "\u112C", 16325 "\u317A", 16326 "\u112D", 16327 "\u317B", 16328 "\u112E", 16329 "\u317C", 16330 "\u112F", 16331 "\u317D", 16332 "\u1132", 16333 "\u317E", 16334 "\u1136", 16335 "\u317F", 16336 "\u1140", 16337 "\u3180", 16338 "\u1147", 16339 "\u3181", 16340 "\u114C", 16341 "\u3182", 16342 "\u11F1", 16343 "\u3183", 16344 "\u11F2", 16345 "\u3184", 16346 "\u1157", 16347 "\u3185", 16348 "\u1158", 16349 "\u3186", 16350 "\u1159", 16351 "\u3187", 16352 "\u1184", 16353 "\u3188", 16354 "\u1185", 16355 "\u3189", 16356 "\u1188", 16357 "\u318A", 16358 "\u1191", 16359 "\u318B", 16360 "\u1192", 16361 "\u318C", 16362 "\u1194", 16363 "\u318D", 16364 "\u119E", 16365 "\u318E", 16366 "\u11A1", 16367 "\u3200", 16368 "\u0028\u1100\u0029", 16369 "\u3201", 16370 "\u0028\u1102\u0029", 16371 "\u3202", 16372 "\u0028\u1103\u0029", 16373 "\u3203", 16374 "\u0028\u1105\u0029", 16375 "\u3204", 16376 "\u0028\u1106\u0029", 16377 "\u3205", 16378 "\u0028\u1107\u0029", 16379 "\u3206", 16380 "\u0028\u1109\u0029", 16381 "\u3207", 16382 "\u0028\u110B\u0029", 16383 "\u3208", 16384 "\u0028\u110C\u0029", 16385 "\u3209", 16386 "\u0028\u110E\u0029", 16387 "\u320A", 16388 "\u0028\u110F\u0029", 16389 "\u320B", 16390 "\u0028\u1110\u0029", 16391 "\u320C", 16392 "\u0028\u1111\u0029", 16393 "\u320D", 16394 "\u0028\u1112\u0029", 16395 "\u320E", 16396 "\u0028\u1100\u1161\u0029", 16397 "\u320F", 16398 "\u0028\u1102\u1161\u0029", 16399 "\u3210", 16400 "\u0028\u1103\u1161\u0029", 16401 "\u3211", 16402 "\u0028\u1105\u1161\u0029", 16403 "\u3212", 16404 "\u0028\u1106\u1161\u0029", 16405 "\u3213", 16406 "\u0028\u1107\u1161\u0029", 16407 "\u3214", 16408 "\u0028\u1109\u1161\u0029", 16409 "\u3215", 16410 "\u0028\u110B\u1161\u0029", 16411 "\u3216", 16412 "\u0028\u110C\u1161\u0029", 16413 "\u3217", 16414 "\u0028\u110E\u1161\u0029", 16415 "\u3218", 16416 "\u0028\u110F\u1161\u0029", 16417 "\u3219", 16418 "\u0028\u1110\u1161\u0029", 16419 "\u321A", 16420 "\u0028\u1111\u1161\u0029", 16421 "\u321B", 16422 "\u0028\u1112\u1161\u0029", 16423 "\u321C", 16424 "\u0028\u110C\u116E\u0029", 16425 "\u321D", 16426 "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029", 16427 "\u321E", 16428 "\u0028\u110B\u1169\u1112\u116E\u0029", 16429 "\u3220", 16430 "\u0028\u4E00\u0029", 16431 "\u3221", 16432 "\u0028\u4E8C\u0029", 16433 "\u3222", 16434 "\u0028\u4E09\u0029", 16435 "\u3223", 16436 "\u0028\u56DB\u0029", 16437 "\u3224", 16438 "\u0028\u4E94\u0029", 16439 "\u3225", 16440 "\u0028\u516D\u0029", 16441 "\u3226", 16442 "\u0028\u4E03\u0029", 16443 "\u3227", 16444 "\u0028\u516B\u0029", 16445 "\u3228", 16446 "\u0028\u4E5D\u0029", 16447 "\u3229", 16448 "\u0028\u5341\u0029", 16449 "\u322A", 16450 "\u0028\u6708\u0029", 16451 "\u322B", 16452 "\u0028\u706B\u0029", 16453 "\u322C", 16454 "\u0028\u6C34\u0029", 16455 "\u322D", 16456 "\u0028\u6728\u0029", 16457 "\u322E", 16458 "\u0028\u91D1\u0029", 16459 "\u322F", 16460 "\u0028\u571F\u0029", 16461 "\u3230", 16462 "\u0028\u65E5\u0029", 16463 "\u3231", 16464 "\u0028\u682A\u0029", 16465 "\u3232", 16466 "\u0028\u6709\u0029", 16467 "\u3233", 16468 "\u0028\u793E\u0029", 16469 "\u3234", 16470 "\u0028\u540D\u0029", 16471 "\u3235", 16472 "\u0028\u7279\u0029", 16473 "\u3236", 16474 "\u0028\u8CA1\u0029", 16475 "\u3237", 16476 "\u0028\u795D\u0029", 16477 "\u3238", 16478 "\u0028\u52B4\u0029", 16479 "\u3239", 16480 "\u0028\u4EE3\u0029", 16481 "\u323A", 16482 "\u0028\u547C\u0029", 16483 "\u323B", 16484 "\u0028\u5B66\u0029", 16485 "\u323C", 16486 "\u0028\u
1648676E3\u0029", 16487 "\u323D", 16488 "\u0028\u4F01\u0029", 16489 "\u323E", 16490 "\u0028\u8CC7\u0029", 16491 "\u323F", 16492 "\u0028\u5354\u0029", 16493 "\u3240", 16494 "\u0028\u796D\u0029", 16495 "\u3241", 16496 "\u0028\u4F11\u0029", 16497 "\u3242", 16498 "\u0028\u81EA\u0029", 16499 "\u3243", 16500 "\u0028\u81F3\u0029", 16501 "\u32C0", 16502 "\u0031\u6708", 16503 "\u32C1", 16504 "\u0032\u6708", 16505 "\u32C2", 16506 "\u0033\u6708", 16507 "\u32C3", 16508 "\u0034\u6708", 16509 "\u32C4", 16510 "\u0035\u6708", 16511 "\u32C5", 16512 "\u0036\u6708", 16513 "\u32C6", 16514 "\u0037\u6708", 16515 "\u32C7", 16516 "\u0038\u6708", 16517 "\u32C8", 16518 "\u0039\u6708", 16519 "\u32C9", 16520 "\u0031\u0030\u6708", 16521 "\u32CA", 16522 "\u0031\u0031\u6708", 16523 "\u32CB", 16524 "\u0031\u0032\u6708", 16525 "\u3358", 16526 "\u0030\u70B9", 16527 "\u3359", 16528 "\u0031\u70B9", 16529 "\u335A", 16530 "\u0032\u70B9", 16531 "\u335B", 16532 "\u0033\u70B9", 16533 "\u335C", 16534 "\u0034\u70B9", 16535 "\u335D", 16536 "\u0035\u70B9", 16537 "\u335E", 16538 "\u0036\u70B9", 16539 "\u335F", 16540 "\u0037\u70B9", 16541 "\u3360", 16542 "\u0038\u70B9", 16543 "\u3361", 16544 "\u0039\u70B9", 16545 "\u3362", 16546 "\u0031\u0030\u70B9", 16547 "\u3363", 16548 "\u0031\u0031\u70B9", 16549 "\u3364", 16550 "\u0031\u0032\u70B9", 16551 "\u3365", 16552 "\u0031\u0033\u70B9", 16553 "\u3366", 16554 "\u0031\u0034\u70B9", 16555 "\u3367", 16556 "\u0031\u0035\u70B9", 16557 "\u3368", 16558 "\u0031\u0036\u70B9", 16559 "\u3369", 16560 "\u0031\u0037\u70B9", 16561 "\u336A", 16562 "\u0031\u0038\u70B9", 16563 "\u336B", 16564 "\u0031\u0039\u70B9", 16565 "\u336C", 16566 "\u0032\u0030\u70B9", 16567 "\u336D", 16568 "\u0032\u0031\u70B9", 16569 "\u336E", 16570 "\u0032\u0032\u70B9", 16571 "\u336F", 16572 "\u0032\u0033\u70B9", 16573 "\u3370", 16574 "\u0032\u0034\u70B9", 16575 "\u33E0", 16576 "\u0031\u65E5", 16577 "\u33E1", 16578 "\u0032\u65E5", 16579 "\u33E2", 16580 "\u0033\u65E5", 16581 "\u33E3", 16582 "\u0034\u65E5", 16583 "\u33E4", 16584 "\u0035\u65E5", 16585 "\u33E5", 16586 "\u0036\u65E5", 16587 "\u33E6", 16588 "\u0037\u65E5", 16589 "\u33E7", 16590 "\u0038\u65E5", 16591 "\u33E8", 16592 "\u0039\u65E5", 16593 "\u33E9", 16594 "\u0031\u0030\u65E5", 16595 "\u33EA", 16596 "\u0031\u0031\u65E5", 16597 "\u33EB", 16598 "\u0031\u0032\u65E5", 16599 "\u33EC", 16600 "\u0031\u0033\u65E5", 16601 "\u33ED", 16602 "\u0031\u0034\u65E5", 16603 "\u33EE", 16604 "\u0031\u0035\u65E5", 16605 "\u33EF", 16606 "\u0031\u0036\u65E5", 16607 "\u33F0", 16608 "\u0031\u0037\u65E5", 16609 "\u33F1", 16610 "\u0031\u0038\u65E5", 16611 "\u33F2", 16612 "\u0031\u0039\u65E5", 16613 "\u33F3", 16614 "\u0032\u0030\u65E5", 16615 "\u33F4", 16616 "\u0032\u0031\u65E5", 16617 "\u33F5", 16618 "\u0032\u0032\u65E5", 16619 "\u33F6", 16620 "\u0032\u0033\u65E5", 16621 "\u33F7", 16622 "\u0032\u0034\u65E5", 16623 "\u33F8", 16624 "\u0032\u0035\u65E5", 16625 "\u33F9", 16626 "\u0032\u0036\u65E5", 16627 "\u33FA", 16628 "\u0032\u0037\u65E5", 16629 "\u33FB", 16630 "\u0032\u0038\u65E5", 16631 "\u33FC", 16632 "\u0032\u0039\u65E5", 16633 "\u33FD", 16634 "\u0033\u0030\u65E5", 16635 "\u33FE", 16636 "\u0033\u0031\u65E5", 16637 "\uFB00", 16638 "\u0066\u0066", 16639 "\uFB01", 16640 "\u0066\u0069", 16641 "\uFB02", 16642 "\u0066\u006C", 16643 "\uFB03", 16644 "\u0066\u0066\u0069", 16645 "\uFB04", 16646 "\u0066\u0066\u006C", 16647 "\uFB05", 16648 "\u017F\u0074", 16649 "\uFB06", 16650 "\u0073\u0074", 16651 "\uFB13", 16652 "\u0574\u0576", 16653 "\uFB14", 16654 "\u0574\u0565", 16655 "\uFB15", 16656 "\u0574\u056B", 16657 "\uFB16", 16658 "\u057E\u0576", 16659 "\uFB17", 16660 "\u0574\u056D", 16661 "\uFB4F", 16662 "\u05D0\u05DC", 16663 "\uFB50", 16664 "\u0671", 16665 "\uFB51", 16666 "\u0671", 16667 "\uFB52", 16668 "\u067B", 16669 "\uFB53", 16670 "\u067B", 16671 "\uFB54", 16672 "\u067B", 16673 "\uFB55", 16674 "\u067B", 16675 "\uFB56", 16676 "\u067E", 16677 "\uFB57", 16678 "\u067E", 16679 "\uFB58", 16680 "\u067E", 16681 "\uFB59", 16682 "\u067E", 16683 "\uFB5A", 16684 "\u0680", 16685 "\uFB5B", 16686 "\u0680", 16687 "\uFB5C", 16688 "\u0680", 16689 "\uFB5D", 16690 "\u0680", 16691 "\uFB5E", 16692 "\u067A", 16693 "\uFB5F", 16694 "\u067A", 16695 "\uFB60", 16696 "\u067A", 16697 "\uFB61", 16698 "\u067A", 16699 "\uFB62", 16700 "\u067F", 16701 "\uFB63", 16702 "\u067F", 16703 "\uFB64", 16704 "\u067F", 16705 "\uFB65", 16706 "\u067F", 16707 "\uFB66", 16708 "\u0679", 16709 "\uFB67", 16710 "\u0679", 16711 "\uFB68", 16712 "\u0679", 16713 "\uFB69", 16714 "\u0679", 16715 "\uFB6A", 16716 "\u06A4", 16717 "\uFB6B", 16718 "\u06A4", 16719 "\uFB6C", 16720 "\u06A4", 16721 "\uFB6D", 16722 "\u06A4", 16723 "\uFB6E", 16724 "\u06A6", 16725 "\uFB6F", 16726 "\u06A6", 16727 "\uFB70", 16728 "\u06A6", 16729 "\uFB71", 16730 "\u06A6", 16731 "\uFB72", 16732 "\u0684", 16733 "\uFB73", 16734 "\u0684", 16735 "\uFB74", 16736 "\u0684", 16737 "\uFB75", 16738 "\u0684", 16739 "\uFB76", 16740 "\u0683", 16741 "\uFB77", 16742 "\u0683", 16743 "\uFB78", 16744 "\u0683", 16745 "\uFB79", 16746 "\u0683", 16747 "\uFB7A", 16748 "\u0686", 16749 "\uFB7B", 16750 "\u0686", 16751 "\uFB7C", 16752 "\u0686", 16753 "\uFB7D", 16754 "\u0686", 16755 "\uFB7E", 16756 "\u0687", 16757 "\uFB7F", 16758 "\u0687", 16759 "\uFB80", 16760 "\u0687", 16761 "\uFB81", 16762 "\u0687", 16763 "\uFB82", 16764 "\u068D", 16765 "\uFB83", 16766 "\u068D", 16767 "\uFB84", 16768 "\u068C", 16769 "\uFB85", 16770 "\u068C", 16771 "\uFB86", 16772 "\u068E", 16773 "\uFB87", 16774 "\u068E", 16775 "\uFB88", 16776 "\u0688", 16777 "\uFB89", 16778 "\u0688", 16779 "\uFB8A", 16780 "\u0698", 16781 "\uFB8B", 16782 "\u0698", 16783 "\uFB8C", 16784 "\u0691", 16785 "\uFB8D", 16786 "\u0691", 16787 "\uFB8E", 16788 "\u06A9", 16789 "\uFB8F", 16790 "\u06A9", 16791 "\uFB90", 16792 "\u06A9", 16793 "\uFB91", 16794 "\u06A9", 16795 "\uFB92", 16796 "\u06AF", 16797 "\uFB93", 16798 "\u06AF", 16799 "\uFB94", 16800 "\u06AF", 16801 "\uFB95", 16802 "\u06AF", 16803 "\uFB96", 16804 "\u06B3", 16805 "\uFB97", 16806 "\u06B3", 16807 "\uFB98", 16808 "\u06B3", 16809 "\uFB99", 16810 "\u06B3", 16811 "\uFB9A", 16812 "\u06B1", 16813 "\uFB9B", 16814 "\u06B1", 16815 "\uFB9C", 16816 "\u06B1", 16817 "\uFB9D", 16818 "\u06B1", 16819 "\uFB9E", 16820 "\u06BA", 16821 "\uFB9F", 16822 "\u06BA", 16823 "\uFBA0", 16824 "\u06BB", 16825 "\uFBA1", 16826 "\u06BB", 16827 "\uFBA2", 16828 "\u06BB", 16829 "\uFBA3", 16830 "\u06BB", 16831 "\uFBA4", 16832 "\u06C0", 16833 "\uFBA5", 16834 "\u06C0", 16835 "\uFBA6", 16836 "\u06C1", 16837 "\uFBA7", 16838 "\u06C1", 16839 "\uFBA8", 16840 "\u06C1", 16841 "\uFBA9", 16842 "\u06C1", 16843 "\uFBAA", 16844 "\u06BE", 16845 "\uFBAB", 16846 "\u06BE", 16847 "\uFBAC", 16848 "\u06BE", 16849 "\uFBAD", 16850 "\u06BE", 16851 "\uFBAE", 16852 "\u06D2", 16853 "\uFBAF", 16854 "\u06D2", 16855 "\uFBB0", 16856 "\u06D3", 16857 "\uFBB1", 16858 "\u06D3", 16859 "\uFBD3", 16860 "\u06AD", 16861 "\uFBD4", 16862 "\u06AD", 16863 "\uFBD5", 16864 "\u06AD", 16865 "\uFBD6", 16866 "\u06AD", 16867 "\uFBD7", 16868 "\u06C7", 16869 "\uFBD8", 16870 "\u06C7", 16871 "\uFBD9", 16872 "\u06C6", 16873 "\uFBDA", 16874 "\u06C6", 16875 "\uFBDB", 16876 "\u06C8", 16877 "\uFBDC", 16878 "\u06C8", 16879 "\uFBDD", 16880 "\u0677", 16881 "\uFBDE", 16882 "\u06CB", 16883 "\uFBDF", 16884 "\u06CB", 16885 "\uFBE0", 16886 "\u06C5", 16887 "\uFBE1", 16888 "\u06C5", 16889 "\uFBE2", 16890 "\u06C9", 16891 "\uFBE3", 16892 "\u06C9", 16893 "\uFBE4", 16894 "\u06D0", 16895 "\uFBE5", 16896 "\u06D0", 16897 "\uFBE6", 16898 "\u06D0", 16899 "\uFBE7", 16900 "\u06D0", 16901 "\uFBE8", 16902 "\u0649", 16903 "\uFBE9", 16904 "\u0649", 16905 "\uFBEA", 16906 "\u0626\u0627", 16907 "\uFBEB", 16908 "\u0626\u0627", 16909 "\uFBEC", 16910 "\u0626\u06D5", 16911 "\uFBED", 16912 "\u0626\u06D5", 16913 "\uFBEE", 16914 "\u0626\u0648", 16915 "\uFBEF", 16916 "\u0626\u0648", 16917 "\uFBF0", 16918 "\u0626\u06C7", 16919 "\uFBF1", 16920 "\u0626\u06C7", 16921 "\uFBF2", 16922 "\u0626\u06C6", 16923 "\uFBF3", 16924 "\u0626\u06C6", 16925 "\uFBF4", 16926 "\u0626\u06C8", 16927 "\uFBF5", 16928 "\u0626\u06C8", 16929 "\uFBF6", 16930 "\u0626\u06D0", 16931 "\uFBF7", 16932 "\u0626\u06D0", 16933 "\uFBF8", 16934 "\u0626\u06D0", 16935 "\uFBF9", 16936 "\u0626\u0649", 16937 "\uFBFA", 16938 "\u0626\u0649", 16939 "\uFBFB", 16940 "\u0626\u0649", 16941 "\uFBFC", 16942 "\u06CC", 16943 "\uFBFD", 16944 "\u06CC", 16945 "\uFBFE", 16946 "\u06CC", 16947 "\uFBFF", 16948 "\u06CC", 16949 "\uFC00", 16950 "\u0626\u062C", 16951 "\uFC01", 16952 "\u0626\u062D", 16953 "\uFC02", 16954 "\u0626\u0645", 16955 "\uFC03", 16956 "\u0626\u0649", 16957 "\uFC04", 16958 "\u0626\u064A", 16959 "\uFC05", 16960 "\u0628\u062C", 16961 "\uFC06", 16962 "\u0628\u062D", 16963 "\uFC07", 16964 "\u0628\u062E", 16965 "\uFC08", 16966 "\u0628\u0645", 16967 "\uFC09", 16968 "\u0628\u0649", 16969 "\uFC0A", 16970 "\u0628\u064A", 16971 "\uFC0B", 16972 "\u062A\u062C", 16973 "\uFC0C", 16974 "\u062A\u062D", 16975 "\uFC0D", 16976 "\u062A\u062E", 16977 "\uFC0E", 16978 "\u062A\u0645", 16979 "\uFC0F", 16980 "\u062A\u0649", 16981 "\uFC10", 16982 "\u062A\u064A", 16983 "\uFC11", 16984 "\u062B\u062C", 16985 "\uFC12", 16986 "\u062B\u0645", 16987 "\uFC13", 16988 "\u062B\u0649", 16989 "\uFC14", 16990 "\u062B\u064A", 16991 "\uFC15", 16992 "\u062C\u062D", 16993 "\uFC16", 16994 "\u062C\u0645", 16995 "\uFC17", 16996 "\u062D\u062C", 16997 "\uFC18", 16998 "\u062D\u0645", 16999 "\uFC19", 17000 "\u062E\u062C", 17001 "\uFC1A", 17002 "\u062E\u062D", 17003 "\uFC1B", 17004 "\u062E\u0645", 17005 "\uFC1C",
17006 "\u0633\u062C", 17007 "\uFC1D", 17008 "\u0633\u062D", 17009 "\uFC1E", 17010 "\u0633\u062E", 17011 "\uFC1F", 17012 "\u0633\u0645", 17013 "\uFC20", 17014 "\u0635\u062D", 17015 "\uFC21", 17016 "\u0635\u0645", 17017 "\uFC22", 17018 "\u0636\u062C", 17019 "\uFC23", 17020 "\u0636\u062D", 17021 "\uFC24", 17022 "\u0636\u062E", 17023 "\uFC25", 17024 "\u0636\u0645", 17025 "\uFC26", 17026 "\u0637\u062D", 17027 "\uFC27", 17028 "\u0637\u0645", 17029 "\uFC28", 17030 "\u0638\u0645", 17031 "\uFC29", 17032 "\u0639\u062C", 17033 "\uFC2A", 17034 "\u0639\u0645", 17035 "\uFC2B", 17036 "\u063A\u062C", 17037 "\uFC2C", 17038 "\u063A\u0645", 17039 "\uFC2D", 17040 "\u0641\u062C", 17041 "\uFC2E", 17042 "\u0641\u062D", 17043 "\uFC2F", 17044 "\u0641\u062E", 17045 "\uFC30", 17046 "\u0641\u0645", 17047 "\uFC31", 17048 "\u0641\u0649", 17049 "\uFC32", 17050 "\u0641\u064A", 17051 "\uFC33", 17052 "\u0642\u062D", 17053 "\uFC34", 17054 "\u0642\u0645", 17055 "\uFC35", 17056 "\u0642\u0649", 17057 "\uFC36", 17058 "\u0642\u064A", 17059 "\uFC37", 17060 "\u0643\u0627", 17061 "\uFC38", 17062 "\u0643\u062C", 17063 "\uFC39", 17064 "\u0643\u062D", 17065 "\uFC3A", 17066 "\u0643\u062E", 17067 "\uFC3B", 17068 "\u0643\u0644", 17069 "\uFC3C", 17070 "\u0643\u0645", 17071 "\uFC3D", 17072 "\u0643\u0649", 17073 "\uFC3E", 17074 "\u0643\u064A", 17075 "\uFC3F", 17076 "\u0644\u062C", 17077 "\uFC40", 17078 "\u0644\u062D", 17079 "\uFC41", 17080 "\u0644\u062E", 17081 "\uFC42", 17082 "\u0644\u0645", 17083 "\uFC43", 17084 "\u0644\u0649", 17085 "\uFC44", 17086 "\u0644\u064A", 17087 "\uFC45", 17088 "\u0645\u062C", 17089 "\uFC46", 17090 "\u0645\u062D", 17091 "\uFC47", 17092 "\u0645\u062E", 17093 "\uFC48", 17094 "\u0645\u0645", 17095 "\uFC49", 17096 "\u0645\u0649", 17097 "\uFC4A", 17098 "\u0645\u064A", 17099 "\uFC4B", 17100 "\u0646\u062C", 17101 "\uFC4C", 17102 "\u0646\u062D", 17103 "\uFC4D", 17104 "\u0646\u062E", 17105 "\uFC4E", 17106 "\u0646\u0645", 17107 "\uFC4F", 17108 "\u0646\u0649", 17109 "\uFC50", 17110 "\u0646\u064A", 17111 "\uFC51", 17112 "\u0647\u062C", 17113 "\uFC52", 17114 "\u0647\u0645", 17115 "\uFC53", 17116 "\u0647\u0649", 17117 "\uFC54", 17118 "\u0647\u064A", 17119 "\uFC55", 17120 "\u064A\u062C", 17121 "\uFC56", 17122 "\u064A\u062D", 17123 "\uFC57", 17124 "\u064A\u062E", 17125 "\uFC58", 17126 "\u064A\u0645", 17127 "\uFC59", 17128 "\u064A\u0649", 17129 "\uFC5A", 17130 "\u064A\u064A", 17131 "\uFC5B", 17132 "\u0630\u0670", 17133 "\uFC5C", 17134 "\u0631\u0670", 17135 "\uFC5D", 17136 "\u0649\u0670", 17137 "\uFC5E", 17138 "\u0020\u064C\u0651", 17139 "\uFC5F", 17140 "\u0020\u064D\u0651", 17141 "\uFC60", 17142 "\u0020\u064E\u0651", 17143 "\uFC61", 17144 "\u0020\u064F\u0651", 17145 "\uFC62", 17146 "\u0020\u0650\u0651", 17147 "\uFC63", 17148 "\u0020\u0651\u0670", 17149 "\uFC64", 17150 "\u0626\u0631", 17151 "\uFC65", 17152 "\u0626\u0632", 17153 "\uFC66", 17154 "\u0626\u0645", 17155 "\uFC67", 17156 "\u0626\u0646", 17157 "\uFC68", 17158 "\u0626\u0649", 17159 "\uFC69", 17160 "\u0626\u064A", 17161 "\uFC6A", 17162 "\u0628\u0631", 17163 "\uFC6B", 17164 "\u0628\u0632", 17165 "\uFC6C", 17166 "\u0628\u0645", 17167 "\uFC6D", 17168 "\u0628\u0646", 17169 "\uFC6E", 17170 "\u0628\u0649", 17171 "\uFC6F", 17172 "\u0628\u064A", 17173 "\uFC70", 17174 "\u062A\u0631", 17175 "\uFC71", 17176 "\u062A\u0632", 17177 "\uFC72", 17178 "\u062A\u0645", 17179 "\uFC73", 17180 "\u062A\u0646", 17181 "\uFC74", 17182 "\u062A\u0649", 17183 "\uFC75", 17184 "\u062A\u064A", 17185 "\uFC76", 17186 "\u062B\u0631", 17187 "\uFC77", 17188 "\u062B\u0632", 17189 "\uFC78", 17190 "\u062B\u0645", 17191 "\uFC79", 17192 "\u062B\u0646", 17193 "\uFC7A", 17194 "\u062B\u0649", 17195 "\uFC7B", 17196 "\u062B\u064A", 17197 "\uFC7C", 17198 "\u0641\u0649", 17199 "\uFC7D", 17200 "\u0641\u064A", 17201 "\uFC7E", 17202 "\u0642\u0649", 17203 "\uFC7F", 17204 "\u0642\u064A", 17205 "\uFC80", 17206 "\u0643\u0627", 17207 "\uFC81", 17208 "\u0643\u0644", 17209 "\uFC82", 17210 "\u0643\u0645", 17211 "\uFC83", 17212 "\u0643\u0649", 17213 "\uFC84", 17214 "\u0643\u064A", 17215 "\uFC85", 17216 "\u0644\u0645", 17217 "\uFC86", 17218 "\u0644\u0649", 17219 "\uFC87", 17220 "\u0644\u064A", 17221 "\uFC88", 17222 "\u0645\u0627", 17223 "\uFC89", 17224 "\u0645\u0645", 17225 "\uFC8A", 17226 "\u0646\u0631", 17227 "\uFC8B", 17228 "\u0646\u0632", 17229 "\uFC8C", 17230 "\u0646\u0645", 17231 "\uFC8D", 17232 "\u0646\u0646", 17233 "\uFC8E", 17234 "\u0646\u0649", 17235 "\uFC8F", 17236 "\u0646\u064A", 17237 "\uFC90", 17238 "\u0649\u0670", 17239 "\uFC91", 17240 "\u064A\u0631", 17241 "\uFC92", 17242 "\u064A\u0632", 17243 "\uFC93", 17244 "\u064A\u0645", 17245 "\uFC94", 17246 "\u064A\u0646", 17247 "\uFC95", 17248 "\u064A\u0649", 17249 "\uFC96", 17250 "\u064A\u064A", 17251 "\uFC97", 17252 "\u0626\u062C", 17253 "\uFC98", 17254 "\u0626\u062D", 17255 "\uFC99", 17256 "\u0626\u062E", 17257 "\uFC9A", 17258 "\u0626\u0645", 17259 "\uFC9B", 17260 "\u0626\u0647", 17261 "\uFC9C", 17262 "\u0628\u062C", 17263 "\uFC9D", 17264 "\u0628\u062D", 17265 "\uFC9E", 17266 "\u0628\u062E", 17267 "\uFC9F", 17268 "\u0628\u0645", 17269 "\uFCA0", 17270 "\u0628\u0647", 17271 "\uFCA1", 17272 "\u062A\u062C", 17273 "\uFCA2", 17274 "\u062A\u062D", 17275 "\uFCA3", 17276 "\u062A\u062E", 17277 "\uFCA4", 17278 "\u062A\u0645", 17279 "\uFCA5", 17280 "\u062A\u0647", 17281 "\uFCA6", 17282 "\u062B\u0645", 17283 "\uFCA7", 17284 "\u062C\u062D", 17285 "\uFCA8", 17286 "\u062C\u0645", 17287 "\uFCA9", 17288 "\u062D\u062C", 17289 "\uFCAA", 17290 "\u062D\u0645", 17291 "\uFCAB", 17292 "\u062E\u062C", 17293 "\uFCAC", 17294 "\u062E\u0645", 17295 "\uFCAD",
17296 "\u0633\u062C", 17297 "\uFCAE", 17298 "\u0633\u062D", 17299 "\uFCAF", 17300 "\u0633\u062E", 17301 "\uFCB0", 17302 "\u0633\u0645", 17303 "\uFCB1", 17304 "\u0635\u062D", 17305 "\uFCB2", 17306 "\u0635\u062E", 17307 "\uFCB3", 17308 "\u0635\u0645", 17309 "\uFCB4", 17310 "\u0636\u062C", 17311 "\uFCB5", 17312 "\u0636\u062D", 17313 "\uFCB6", 17314 "\u0636\u062E", 17315 "\uFCB7", 17316 "\u0636\u0645", 17317 "\uFCB8", 17318 "\u0637\u062D", 17319 "\uFCB9", 17320 "\u0638\u0645", 17321 "\uFCBA", 17322 "\u0639\u062C", 17323 "\uFCBB", 17324 "\u0639\u0645", 17325 "\uFCBC", 17326 "\u063A\u062C", 17327 "\uFCBD", 17328 "\u063A\u0645", 17329 "\uFCBE", 17330 "\u0641\u062C", 17331 "\uFCBF", 17332 "\u0641\u062D", 17333 "\uFCC0", 17334 "\u0641\u062E", 17335 "\uFCC1", 17336 "\u0641\u0645", 17337 "\uFCC2", 17338 "\u0642\u062D", 17339 "\uFCC3", 17340 "\u0642\u0645", 17341 "\uFCC4", 17342 "\u0643\u062C", 17343 "\uFCC5", 17344 "\u0643\u062D", 17345 "\uFCC6", 17346 "\u0643\u062E", 17347 "\uFCC7", 17348 "\u0643\u0644", 17349 "\uFCC8", 17350 "\u0643\u0645", 17351 "\uFCC9", 17352 "\u0644\u062C", 17353 "\uFCCA", 17354 "\u0644\u062D", 17355 "\uFCCB", 17356 "\u0644\u062E", 17357 "\uFCCC", 17358 "\u0644\u0645", 17359 "\uFCCD", 17360 "\u0644\u0647", 17361 "\uFCCE", 17362 "\u0645\u062C", 17363 "\uFCCF", 17364 "\u0645\u062D", 17365 "\uFCD0", 17366 "\u0645\u062E", 17367 "\uFCD1", 17368 "\u0645\u0645", 17369 "\uFCD2", 17370 "\u0646\u062C", 17371 "\uFCD3", 17372 "\u0646\u062D", 17373 "\uFCD4", 17374 "\u0646\u062E", 17375 "\uFCD5", 17376 "\u0646\u0645", 17377 "\uFCD6", 17378 "\u0646\u0647", 17379 "\uFCD7", 17380 "\u0647\u062C", 17381 "\uFCD8", 17382 "\u0647\u0645", 17383 "\uFCD9", 17384 "\u0647\u0670", 17385 "\uFCDA", 17386 "\u064A\u062C", 17387 "\uFCDB", 17388 "\u064A\u062D", 17389 "\uFCDC", 17390 "\u064A\u062E", 17391 "\uFCDD", 17392 "\u064A\u0645", 17393 "\uFCDE", 17394 "\u064A\u0647", 17395 "\uFCDF", 17396 "\u0626\u0645", 17397 "\uFCE0", 17398 "\u0626\u0647", 17399 "\uFCE1", 17400 "\u0628\u0645", 17401 "\uFCE2", 17402 "\u0628\u0647", 17403 "\uFCE3", 17404 "\u062A\u0645", 17405 "\uFCE4", 17406 "\u062A\u0647", 17407 "\uFCE5", 17408 "\u062B\u0645", 17409 "\uFCE6", 17410 "\u062B\u0647", 17411 "\uFCE7", 17412 "\u0633\u0645", 17413 "\uFCE8", 17414 "\u0633\u0647", 17415 "\uFCE9", 17416 "\u0634\u0645", 17417 "\uFCEA", 17418 "\u0634\u0647", 17419 "\uFCEB", 17420 "\u0643\u0644", 17421 "\uFCEC", 17422 "\u0643\u0645", 17423 "\uFCED", 17424 "\u0644\u0645", 17425 "\uFCEE", 17426 "\u0646\u0645", 17427 "\uFCEF", 17428 "\u0646\u0647", 17429 "\uFCF0", 17430 "\u064A\u0645", 17431 "\uFCF1", 17432 "\u064A\u0647", 17433 "\uFCF2", 17434 "\u0640\u064E\u0651", 17435 "\uFCF3", 17436 "\u0640\u064F\u0651", 17437 "\uFCF4", 17438 "\u0640\u0650\u0651", 17439 "\uFCF5", 17440 "\u0637\u0649", 17441 "\uFCF6", 17442 "\u0637\u064A", 17443 "\uFCF7", 17444 "\u0639\u0649", 17445 "\uFCF8", 17446 "\u0639\u064A", 17447 "\uFCF9", 17448 "\u063A\u0649", 17449 "\uFCFA", 17450 "\u063A\u064A", 17451 "\uFCFB", 17452 "\u0633\u0649", 17453 "\uFCFC", 17454 "\u0633\u064A", 17455 "\uFCFD", 17456 "\u0634\u0649", 17457 "\uFCFE", 17458 "\u0634\u064A", 17459 "\uFCFF", 17460 "\u062D\u0649", 17461 "\uFD00", 17462 "\u062D\u064A", 17463 "\uFD01", 17464 "\u062C\u0649", 17465 "\uFD02", 17466 "\u062C\u064A", 17467 "\uFD03", 17468 "\u062E\u0649", 17469 "\uFD04", 17470 "\u062E\u064A", 17471 "\uFD05", 17472 "\u0635\u0649", 17473 "\uFD06", 17474 "\u0635\u064A", 17475 "\uFD07", 17476 "\u0636\u0649", 17477 "\uFD08", 17478 "\u0636\u064A", 17479 "\uFD09", 17480 "\u0634\u062C", 17481 "\uFD0A", 17482 "\u0634\u062D", 17483 "\uFD0B", 17484 "\u0634\u062E", 17485 "\uFD0C", 17486 "\u0634\u0645", 17487 "\uFD0D", 17488 "\u0634\u0631", 17489 "\uFD0E", 17490 "\u0633\u0631", 17491 "\uFD0F", 17492 "\u0635\u0631", 17493 "\uFD10", 17494 "\u0636\u0631", 17495 "\uFD11", 17496 "\u0637\u0649", 17497 "\uFD12", 17498 "\u0637\u064A", 17499 "\uFD13", 17500 "\u0639\u0649", 17501 "\uFD14", 17502 "\u0639\u064A", 17503 "\uFD15", 17504 "\u063A\u0649", 17505 "\uFD16", 17506 "\u063A\u064A", 17507 "\uFD17", 17508 "\u0633\u0649", 17509 "\uFD18", 17510 "\u0633\u064A", 17511 "\uFD19", 17512 "\u0634\u0649", 17513 "\uFD1A", 17514 "\u0634\u064A", 17515 "\uFD1B", 17516 "\u062D\u0649", 17517 "\uFD1C", 17518 "\u062D\u064A", 17519 "\uFD1D", 17520 "\u062C\u0649", 17521 "\uFD1E", 17522 "\u062C\u064A", 17523 "\uFD1F", 17524 "\u062E\u0649", 17525 "\uFD20", 17526 "\u062E\u064A", 17527 "\uFD21", 17528 "\u0635\u0649", 17529 "\uFD22", 17530 "\u0635\u064A", 17531 "\uFD23", 17532 "\u0636\u0649", 17533 "\uFD24", 17534 "\u0636\u064A", 17535 "\uFD25", 17536 "\u0634\u062C", 17537 "\uFD26", 17538 "\u0634\u062D", 17539 "\uFD27", 17540 "\u0634\u062E", 17541 "\uFD28", 17542 "\u0634\u0645", 17543 "\uFD29", 17544 "\u0634\u0631", 17545 "\uFD2A", 17546 "\u0633\u0631", 17547 "\uFD2B", 17548 "\u0635\u0631", 17549 "\uFD2C", 17550 "\u0636\u0631", 17551 "\uFD2D", 17552 "\u0634\u062C", 17553 "\uFD2E", 17554 "\u0634\u062D", 17555 "\uFD2F", 17556 "\u0634\u062E", 17557 "\uFD30", 17558 "\u0634\u0645", 17559 "\uFD31", 17560 "\u0633\u0647", 17561 "\uFD32", 17562 "\u0634\u0647", 17563 "\uFD33", 17564 "\u0637\u0645", 17565 "\uFD34", 17566 "\u0633\u062C", 17567 "\uFD35", 17568 "\u0633\u062D", 17569 "\uFD36", 17570 "\u0633\u062E", 17571 "\uFD37", 17572 "\u0634\u062C", 17573 "\uFD38", 17574 "\u0634\u062D", 17575 "\uFD39", 17576 "\u0634\u062E", 17577 "\uFD3A", 17578 "\u0637\u0645", 17579 "\uFD3B", 17580 "\u0638\u0645", 17581 "\uFD3C", 17582 "\u0627\u064B", 17583 "\uFD3D", 17584 "\u0627\u064B", 17585 "\uFD50", 17586 "\u062A\u062C\u0645", 17587 "\uFD51", 17588 "\u062A\u062D\u062C", 17589 "\uFD52", 17590 "\u062A\u062D\u062C", 17591 "\uFD53", 17592 "\u062A\u062D\u0645", 17593 "\uFD54", 17594 "\u062A\u062E\u0645", 17595 "\uFD55", 17596 "\u062A\u0645\u062C", 17597 "\uFD56", 17598 "\u062A\u0645\u062D", 17599 "\uFD57", 17600 "\u062A\u0645\u062E", 17601 "\uFD58", 17602 "\u062C\u0645\u062D", 17603 "\uFD59", 17604 "\u062C\u0645\u062D", 17605 "\uFD5A", 17606 "\u062D\u0645\u064A", 17607 "\uFD5B", 17608 "\u062D\u0645\u0649", 17609 "\uFD5C", 17610 "\u0633\u062D\u062C", 17611 "\uFD5D",
17612 "\u0633\u062C\u062D", 17613 "\uFD5E", 17614 "\u0633\u062C\u0649", 17615 "\uFD5F", 17616 "\u0633\u0645\u062D", 17617 "\uFD60", 17618 "\u0633\u0645\u062D", 17619 "\uFD61", 17620 "\u0633\u0645\u062C", 17621 "\uFD62", 17622 "\u0633\u0645\u0645", 17623 "\uFD63", 17624 "\u0633\u0645\u0645", 17625 "\uFD64", 17626 "\u0635\u062D\u062D", 17627 "\uFD65", 17628 "\u0635\u062D\u062D", 17629 "\uFD66", 17630 "\u0635\u0645\u0645", 17631 "\uFD67", 17632 "\u0634\u062D\u0645", 17633 "\uFD68", 17634 "\u0634\u062D\u0645", 17635 "\uFD69", 17636 "\u0634\u062C\u064A", 17637 "\uFD6A", 17638 "\u0634\u0645\u062E", 17639 "\uFD6B", 17640 "\u0634\u0645\u062E", 17641 "\uFD6C", 17642 "\u0634\u0645\u0645", 17643 "\uFD6D", 17644 "\u0634\u0645\u0645", 17645 "\uFD6E", 17646 "\u0636\u062D\u0649", 17647 "\uFD6F", 17648 "\u0636\u062E\u0645", 17649 "\uFD70", 17650 "\u0636\u062E\u0645", 17651 "\uFD71", 17652 "\u0637\u0645\u062D", 17653 "\uFD72", 17654 "\u0637\u0645\u062D", 17655 "\uFD73", 17656 "\u0637\u0645\u0645", 17657 "\uFD74", 17658 "\u0637\u0645\u064A", 17659 "\uFD75", 17660 "\u0639\u062C\u0645", 17661 "\uFD76", 17662 "\u0639\u0645\u0645", 17663 "\uFD77", 17664 "\u0639\u0645\u0645", 17665 "\uFD78", 17666 "\u0639\u0645\u0649", 17667 "\uFD79", 17668 "\u063A\u0645\u0645", 17669 "\uFD7A", 17670 "\u063A\u0645\u064A", 17671 "\uFD7B", 17672 "\u063A\u0645\u0649", 17673 "\uFD7C", 17674 "\u0641\u062E\u0645", 17675 "\uFD7D", 17676 "\u0641\u062E\u0645", 17677 "\uFD7E", 17678 "\u0642\u0645\u062D", 17679 "\uFD7F", 17680 "\u0642\u0645\u0645", 17681 "\uFD80", 17682 "\u0644\u062D\u0645", 17683 "\uFD81", 17684 "\u0644\u062D\u064A", 17685 "\uFD82", 17686 "\u0644\u062D\u0649", 17687 "\uFD83", 17688 "\u0644\u062C\u062C", 17689 "\uFD84", 17690 "\u0644\u062C\u062C", 17691 "\uFD85", 17692 "\u0644\u062E\u0645", 17693 "\uFD86", 17694 "\u0644\u062E\u0645", 17695 "\uFD87", 17696 "\u0644\u0645\u062D", 17697 "\uFD88", 17698 "\u0644\u0645\u062D", 17699 "\uFD89", 17700 "\u0645\u062D\u062C", 17701 "\uFD8A", 17702 "\u0645\u062D\u0645", 17703 "\uFD8B", 17704 "\u0645\u062D\u064A", 17705 "\uFD8C", 17706 "\u0645\u062C\u062D", 17707 "\uFD8D", 17708 "\u0645\u062C\u0645", 17709 "\uFD8E", 17710 "\u0645\u062E\u062C", 17711 "\uFD8F", 17712 "\u0645\u062E\u0645", 17713 "\uFD92", 17714 "\u0645\u062C\u062E", 17715 "\uFD93", 17716 "\u0647\u0645\u062C", 17717 "\uFD94", 17718 "\u0647\u0645\u0645", 17719 "\uFD95", 17720 "\u0646\u062D\u0645", 17721 "\uFD96", 17722 "\u0646\u062D\u0649", 17723 "\uFD97", 17724 "\u0646\u062C\u0645", 17725 "\uFD98", 17726 "\u0646\u062C\u0645", 17727 "\uFD99", 17728 "\u0646\u062C\u0649", 17729 "\uFD9A", 17730 "\u0646\u0645\u064A", 17731 "\uFD9B", 17732 "\u0646\u0645\u0649", 17733 "\uFD9C", 17734 "\u064A\u0645\u0645", 17735 "\uFD9D", 17736 "\u064A\u0645\u0645", 17737 "\uFD9E", 17738 "\u0628\u062E\u064A", 17739 "\uFD9F", 17740 "\u062A\u062C\u064A", 17741 "\uFDA0", 17742 "\u062A\u062C\u0649", 17743 "\uFDA1", 17744 "\u062A\u062E\u064A", 17745 "\uFDA2", 17746 "\u062A\u062E\u0649", 17747 "\uFDA3", 17748 "\u062A\u0645\u064A", 17749 "\uFDA4", 17750 "\u062A\u0645\u0649", 17751 "\uFDA5", 17752 "\u062C\u0645\u064A", 17753 "\uFDA6", 17754 "\u062C\u062D\u0649", 17755 "\uFDA7", 17756 "\u062C\u0645\u0649", 17757 "\uFDA8", 17758 "\u0633\u062E\u0649", 17759 "\uFDA9", 17760 "\u0635\u062D\u064A", 17761 "\uFDAA", 17762 "\u0634\u062D\u064A", 17763 "\uFDAB", 17764 "\u0636\u062D\u064A", 17765 "\uFDAC", 17766 "\u0644\u062C\u064A", 17767 "\uFDAD", 17768 "\u0644\u0645\u064A", 17769 "\uFDAE", 17770 "\u064A\u062D\u064A", 17771 "\uFDAF", 17772 "\u064A\u062C\u064A", 17773 "\uFDB0", 17774 "\u064A\u0645\u064A", 17775 "\uFDB1", 17776 "\u0645\u0645\u064A", 17777 "\uFDB2", 17778 "\u0642\u0645\u064A", 17779 "\uFDB3", 17780 "\u0646\u062D\u064A", 17781 "\uFDB4", 17782 "\u0642\u0645\u062D", 17783 "\uFDB5", 17784 "\u0644\u062D\u0645", 17785 "\uFDB6", 17786 "\u0639\u0645\u064A", 17787 "\uFDB7", 17788 "\u0643\u0645\u064A", 17789 "\uFDB8", 17790 "\u0646\u062C\u062D", 17791 "\uFDB9", 17792 "\u0645\u062E\u064A", 17793 "\uFDBA", 17794 "\u0644\u062C\u0645", 17795 "\uFDBB", 17796 "\u0643\u0645\u0645", 17797 "\uFDBC", 17798 "\u0644\u062C\u0645", 17799 "\uFDBD", 17800 "\u0646\u062C\u062D", 17801 "\uFDBE", 17802 "\u062C\u062D\u064A", 17803 "\uFDBF", 17804 "\u062D\u062C\u064A", 17805 "\uFDC0", 17806 "\u0645\u062C\u064A", 17807 "\uFDC1", 17808 "\u0641\u0645\u064A", 17809 "\uFDC2", 17810 "\u0628\u062D\u064A", 17811 "\uFDC3", 17812 "\u0643\u0645\u0645", 17813 "\uFDC4", 17814 "\u0639\u062C\u0645", 17815 "\uFDC5", 17816 "\u0635\u0645\u0645", 17817 "\uFDC6", 17818 "\u0633\u062E\u064A", 17819 "\uFDC7", 17820 "\u0646\u062C\u064A", 17821 "\uFE49", 17822 "\u203E", 17823 "\uFE4A", 17824 "\u203E", 17825 "\uFE4B", 17826 "\u203E", 17827 "\uFE4C", 17828 "\u203E", 17829 "\uFE4D", 17830 "\u005F", 17831 "\uFE4E", 17832 "\u005F", 17833 "\uFE4F", 17834 "\u005F", 17835 "\uFE80", 17836 "\u0621", 17837 "\uFE81", 17838 "\u0622", 17839 "\uFE82", 17840 "\u0622", 17841 "\uFE83", 17842 "\u0623", 17843 "\uFE84", 17844 "\u0623", 17845 "\uFE85", 17846 "\u0624", 17847 "\uFE86", 17848 "\u0624", 17849 "\uFE87", 17850 "\u0625", 17851 "\uFE88", 17852 "\u0625", 17853 "\uFE89", 17854 "\u0626", 17855 "\uFE8A", 17856 "\u0626", 17857 "\uFE8B", 17858 "\u0626", 17859 "\uFE8C", 17860 "\u0626", 17861 "\uFE8D", 17862 "\u0627", 17863 "\uFE8E", 17864 "\u0627", 17865 "\uFE8F", 17866 "\u0628", 17867 "\uFE90", 17868 "\u0628", 17869 "\uFE91", 17870 "\u0628", 17871 "\uFE92", 17872 "\u0628", 17873 "\uFE93", 17874 "\u0629", 17875 "\uFE94", 17876 "\u0629", 17877 "\uFE95", 17878 "\u062A", 17879 "\uFE96", 17880 "\u062A", 17881 "\uFE97", 17882 "\u062A", 17883 "\uFE98", 17884 "\u062A", 17885 "\uFE99", 17886 "\u062B", 17887 "\uFE9A", 17888 "\u062B", 17889 "\uFE9B", 17890 "\u062B", 17891 "\uFE9C", 17892 "\u062B", 17893 "\uFE9D", 17894 "\u062C", 17895 "\uFE9E", 17896 "\u062C", 17897 "\uFE9F", 17898 "\u062C", 17899 "\uFEA0", 17900 "\u062C", 17901 "\uFEA1", 17902 "\u062D", 17903 "\uFEA2", 17904 "\u062D", 17905 "\uFEA3", 17906 "\u062D", 17907 "\uFEA4", 17908 "\u062D", 17909 "\uFEA5", 17910 "\u062E", 17911 "\uFEA6", 17912 "\u062E", 17913 "\uFEA7", 17914 "\u062E", 17915 "\uFEA8", 17916 "\u062E", 17917 "\uFEA9", 17918 "\u062F", 17919 "\uFEAA", 17920 "\u062F", 17921 "\uFEAB", 17922 "\u0630", 17923 "\uFEAC", 17924 "\u0630", 17925 "\uFEAD", 17926 "\u0631", 17927 "\uFEAE", 17928 "\u0631", 17929 "\uFEAF", 17930 "\u0632", 17931 "\uFEB0", 17932 "\u0632", 17933 "\uFEB1", 17934 "\u0633", 17935 "\uFEB2", 17936 "\u0633", 17937 "\uFEB3", 17938 "\u0633", 17939 "\uFEB4", 17940 "\u0633", 17941 "\uFEB5", 17942 "\u0634", 17943 "\uFEB6", 17944 "\u0634", 17945 "\uFEB7", 17946 "\u0634", 17947 "\uFEB8", 17948 "\u0634", 17949 "\uFEB9", 17950 "\u0635", 17951 "\uFEBA", 17952 "\u0635", 17953 "\uFEBB", 17954 "\u0635", 17955 "\uFEBC", 17956 "\u0635", 17957 "\uFEBD", 17958 "\u0636", 17959 "\uFEBE", 17960 "\u0636", 17961 "\uFEBF", 17962 "\u0636", 17963 "\uFEC0", 17964 "\u0636", 17965 "\uFEC1", 17966 "\u0637", 17967 "\uFEC2", 17968 "\u0637", 17969 "\uFEC3", 17970 "\u0637", 17971 "\uFEC4", 17972 "\u0637", 17973 "\uFEC5", 17974 "\u0638", 17975 "\uFEC6", 17976 "\u0638", 17977 "\uFEC7", 17978 "\u0638", 17979 "\uFEC8", 17980 "\u0638", 17981 "\uFEC9", 17982 "\u0639", 17983 "\uFECA", 17984 "\u0639", 17985 "\uFECB", 17986 "\u0639", 17987 "\uFECC", 17988 "\u0639", 17989 "\uFECD", 17990 "\u063A", 17991 "\uFECE", 17992 "\u063A", 17993 "\uFECF", 17994 "\u063A", 17995 "\uFED0", 17996 "\u063A", 17997 "\uFED1", 17998 "\u0641", 17999 "\uFED2", 18000 "\u0641", 18001 "\uFED3", 18002 "\u0641", 18003 "\uFED4", 18004 "\u0641", 18005 "\uFED5", 18006 "\u0642", 18007 "\uFED6", 18008 "\u0642", 18009 "\uFED7", 18010 "\u0642", 18011 "\uFED8", 18012 "\u0642", 18013 "\uFED9", 18014 "\u0643", 18015 "\uFEDA", 18016 "\u0643", 18017 "\uFEDB", 18018 "\u0643", 18019 "\uFEDC", 18020 "\u0643", 18021 "\uFEDD", 18022 "\u0644", 18023 "\uFEDE", 18024 "\u0644", 18025 "\uFEDF", 18026 "\u0644", 18027 "\uFEE0", 18028 "\u0644", 18029 "\uFEE1", 18030 "\u0645", 18031 "\uFEE2", 18032 "\u0645", 18033 "\uFEE3", 18034 "\u0645", 18035 "\uFEE4", 18036 "\u0645", 18037 "\uFEE5", 18038 "\u0646", 18039 "\uFEE6", 18040 "\u0646", 18041 "\uFEE7", 18042 "\u0646", 18043 "\uFEE8", 18044 "\u0646", 18045 "\uFEE9", 18046 "\u0647", 18047 "\uFEEA", 18048 "\u0647", 18049 "\uFEEB", 18050 "\u0647", 18051 "\uFEEC", 18052 "\u0647", 18053 "\uFEED", 18054 "\u0648", 18055 "\uFEEE", 18056 "\u0648", 18057 "\uFEEF", 18058 "\u0649", 18059 "\uFEF0", 18060 "\u0649", 18061 "\uFEF1", 18062 "\u064A", 18063 "\uFEF2", 18064 "\u064A", 18065 "\uFEF3", 18066 "\u064A", 18067 "\uFEF4", 18068 "\u064A", 18069 "\uFEF5", 18070 "\u0644\u0622", 18071 "\uFEF6", 18072 "\u0644\u0622", 18073 "\uFEF7", 18074 "\u0644\u0623", 18075 "\uFEF8", 18076 "\u0644\u0623", 18077 "\uFEF9", 18078 "\u0644\u0625", 18079 "\uFEFA", 18080 "\u0644\u0625", 18081 "\uFEFB", 18082 "\u0644\u0627", 18083 "\uFEFC", 18084 "\u0644\u0627" 18085 ]; 18086}); 18087function reverseIfRtl(chars) { 18088 const charsLength = chars.length;
18089 if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) { 18090 return chars; 18091 } 18092 const buf = []; 18093 for (let ii = charsLength - 1; ii >= 0; ii--) { 18094 buf.push(chars[ii]); 18095 } 18096 return buf.join(""); 18097} 18098 18099 18100/***/ }), 18101/* 22 */ 18102/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 18103 18104 18105 18106Object.defineProperty(exports, "__esModule", ({ 18107 value: true 18108})); 18109exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0; 18110exports.getQuadPoints = getQuadPoints; 18111 18112var _util = __w_pdfjs_require__(2); 18113 18114var _core_utils = __w_pdfjs_require__(9); 18115 18116var _default_appearance = __w_pdfjs_require__(23); 18117 18118var _primitives = __w_pdfjs_require__(5); 18119 18120var _bidi = __w_pdfjs_require__(59); 18121 18122var _catalog = __w_pdfjs_require__(64); 18123 18124var _colorspace = __w_pdfjs_require__(24); 18125 18126var _file_spec = __w_pdfjs_require__(66); 18127 18128var _object_loader = __w_pdfjs_require__(70); 18129 18130var _operator_list = __w_pdfjs_require__(62); 18131 18132var _stream = __w_pdfjs_require__(10); 18133 18134var _writer = __w_pdfjs_require__(71); 18135 18136var _factory = __w_pdfjs_require__(74); 18137 18138class AnnotationFactory { 18139 static create(xref, ref, pdfManager, idFactory, collectFields) { 18140 return Promise.all([pdfManager.ensureCatalog("acroForm"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(([acroForm, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, collectFields, pageIndex])); 18141 } 18142 18143 static _create(xref, ref, pdfManager, idFactory, acroForm, collectFields, pageIndex = -1) { 18144 const dict = xref.fetchIfRef(ref); 18145 18146 if (!(0, _primitives.isDict)(dict)) { 18147 return undefined; 18148 } 18149 18150 const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`; 18151 let subtype = dict.get("Subtype"); 18152 subtype = (0, _primitives.isName)(subtype) ? subtype.name : null; 18153 const parameters = { 18154 xref, 18155 ref, 18156 dict, 18157 subtype, 18158 id, 18159 pdfManager, 18160 acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty, 18161 collectFields, 18162 pageIndex 18163 }; 18164 18165 switch (subtype) { 18166 case "Link": 18167 return new LinkAnnotation(parameters); 18168 18169 case "Text": 18170 return new TextAnnotation(parameters); 18171 18172 case "Widget": 18173 let fieldType = (0, _core_utils.getInheritableProperty)({ 18174 dict, 18175 key: "FT" 18176 }); 18177 fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null; 18178 18179 switch (fieldType) { 18180 case "Tx": 18181 return new TextWidgetAnnotation(parameters); 18182 18183 case "Btn": 18184 return new ButtonWidgetAnnotation(parameters); 18185 18186 case "Ch": 18187 return new ChoiceWidgetAnnotation(parameters); 18188 18189 case "Sig": 18190 return new SignatureWidgetAnnotation(parameters); 18191 } 18192 18193 (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type."); 18194 return new WidgetAnnotation(parameters); 18195 18196 case "Popup": 18197 return new PopupAnnotation(parameters); 18198 18199 case "FreeText": 18200 return new FreeTextAnnotation(parameters); 18201 18202 case "Line": 18203 return new LineAnnotation(parameters); 18204 18205 case "Square": 18206 return new SquareAnnotation(parameters); 18207 18208 case "Circle": 18209 return new CircleAnnotation(parameters); 18210 18211 case "PolyLine": 18212 return new PolylineAnnotation(parameters); 18213 18214 case "Polygon": 18215 return new PolygonAnnotation(parameters); 18216 18217 case "Caret": 18218 return new CaretAnnotation(parameters); 18219 18220 case "Ink": 18221 return new InkAnnotation(parameters); 18222 18223 case "Highlight": 18224 return new HighlightAnnotation(parameters); 18225 18226 case "Underline": 18227 return new UnderlineAnnotation(parameters); 18228 18229 case "Squiggly": 18230 return new SquigglyAnnotation(parameters); 18231 18232 case "StrikeOut": 18233 return new StrikeOutAnnotation(parameters); 18234 18235 case "Stamp": 18236 return new StampAnnotation(parameters); 18237 18238 case "FileAttachment": 18239 return new FileAttachmentAnnotation(parameters); 18240 18241 default: 18242 if (!collectFields) { 18243 if (!subtype) { 18244 (0, _util.warn)("Annotation is missing the required /Subtype."); 18245 } else { 18246 (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation."); 18247 } 18248 } 18249 18250 return new Annotation(parameters); 18251 } 18252 } 18253 18254 static async _getPageIndex(xref, ref, pdfManager) { 18255 try { 18256 const annotDict = await xref.fetchIfRefAsync(ref); 18257 18258 if (!(0, _primitives.isDict)(annotDict)) { 18259 return -1; 18260 } 18261 18262 const pageRef = annotDict.getRaw("P"); 18263 18264 if (!(0, _primitives.isRef)(pageRef)) { 18265 return -1; 18266 } 18267 18268 const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]); 18269 return pageIndex; 18270 } catch (ex) { 18271 (0, _util.warn)(`_getPageIndex: "${ex}".`); 18272 return -1; 18273 } 18274 } 18275 18276} 18277 18278exports.AnnotationFactory = AnnotationFactory; 18279 18280function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) { 18281 if (!Array.isArray(color)) { 18282 return defaultColor; 18283 } 18284 18285 const rgbColor = defaultColor || new Uint8ClampedArray(3); 18286 18287 switch (color.length) { 18288 case 0: 18289 return null; 18290 18291 case 1: 18292 _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0); 18293 18294 return rgbColor; 18295 18296 case 3: 18297 _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0); 18298 18299 return rgbColor; 18300 18301 case 4: 18302 _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0); 18303 18304 return rgbColor; 18305 18306 default: 18307 return defaultColor; 18308 } 18309} 18310 18311function getQuadPoints(dict, rect) { 18312 if (!dict.has("QuadPoints")) { 18313 return null; 18314 } 18315 18316 const quadPoints = dict.getArray("QuadPoints"); 18317 18318 if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) { 18319 return null; 18320 } 18321 18322 const quadPointsLists = []; 18323 18324 for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) { 18325 quadPointsLists.push([]); 18326 18327 for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) { 18328 const x = quadPoints[j]; 18329 const y = quadPoints[j + 1]; 18330 18331 if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) { 18332 return null; 18333 } 18334 18335 quadPointsLists[i].push({ 18336 x, 18337 y 18338 }); 18339 } 18340 } 18341 18342 return quadPointsLists.map(quadPointsList => { 18343 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]); 18344 return [{ 18345 x: minX, 18346 y: maxY 18347 }, {
18348 x: maxX, 18349 y: maxY 18350 }, { 18351 x: minX, 18352 y: minY 18353 }, { 18354 x: maxX, 18355 y: minY 18356 }]; 18357 }); 18358} 18359 18360function getTransformMatrix(rect, bbox, matrix) { 18361 const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix); 18362 18363 if (minX === maxX || minY === maxY) { 18364 return [1, 0, 0, 1, rect[0], rect[1]]; 18365 } 18366 18367 const xRatio = (rect[2] - rect[0]) / (maxX - minX); 18368 const yRatio = (rect[3] - rect[1]) / (maxY - minY); 18369 return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio]; 18370} 18371 18372class Annotation { 18373 constructor(params) { 18374 const dict = params.dict; 18375 this.setTitle(dict.get("T")); 18376 this.setContents(dict.get("Contents")); 18377 this.setModificationDate(dict.get("M")); 18378 this.setFlags(dict.get("F")); 18379 this.setRectangle(dict.getArray("Rect")); 18380 this.setColor(dict.getArray("C")); 18381 this.setBorderStyle(dict); 18382 this.setAppearance(dict); 18383 this.setBorderAndBackgroundColors(dict.get("MK")); 18384 this._streams = []; 18385 18386 if (this.appearance) { 18387 this._streams.push(this.appearance); 18388 } 18389 18390 this.data = { 18391 annotationFlags: this.flags, 18392 borderStyle: this.borderStyle, 18393 color: this.color, 18394 backgroundColor: this.backgroundColor, 18395 borderColor: this.borderColor, 18396 contentsObj: this._contents, 18397 hasAppearance: !!this.appearance, 18398 id: params.id, 18399 modificationDate: this.modificationDate, 18400 rect: this.rectangle, 18401 subtype: params.subtype, 18402 hasOwnCanvas: false 18403 }; 18404 18405 if (params.collectFields) { 18406 const kids = dict.get("Kids"); 18407 18408 if (Array.isArray(kids)) { 18409 const kidIds = []; 18410 18411 for (const kid of kids) { 18412 if ((0, _primitives.isRef)(kid)) { 18413 kidIds.push(kid.toString()); 18414 } 18415 } 18416 18417 if (kidIds.length !== 0) { 18418 this.data.kidIds = kidIds; 18419 } 18420 } 18421 18422 this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType); 18423 this.data.fieldName = this._constructFieldName(dict); 18424 this.data.pageIndex = params.pageIndex; 18425 } 18426 18427 this._fallbackFontDict = null; 18428 } 18429 18430 _hasFlag(flags, flag) { 18431 return !!(flags & flag); 18432 } 18433 18434 _isViewable(flags) { 18435 return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW); 18436 } 18437 18438 _isPrintable(flags) { 18439 return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE); 18440 } 18441 18442 mustBeViewed(annotationStorage) { 18443 const storageEntry = annotationStorage && annotationStorage.get(this.data.id); 18444 18445 if (storageEntry && storageEntry.hidden !== undefined) { 18446 return !storageEntry.hidden; 18447 } 18448 18449 return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN); 18450 } 18451 18452 mustBePrinted(annotationStorage) { 18453 const storageEntry = annotationStorage && annotationStorage.get(this.data.id); 18454 18455 if (storageEntry && storageEntry.print !== undefined) { 18456 return storageEntry.print; 18457 } 18458 18459 return this.printable; 18460 } 18461 18462 get viewable() { 18463 if (this.data.quadPoints === null) { 18464 return false; 18465 } 18466 18467 if (this.flags === 0) { 18468 return true; 18469 } 18470 18471 return this._isViewable(this.flags); 18472 } 18473 18474 get printable() { 18475 if (this.data.quadPoints === null) { 18476 return false; 18477 } 18478 18479 if (this.flags === 0) { 18480 return false; 18481 } 18482 18483 return this._isPrintable(this.flags); 18484 } 18485 18486 _parseStringHelper(data) { 18487 const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : ""; 18488 const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr"; 18489 return { 18490 str, 18491 dir 18492 }; 18493 } 18494 18495 setTitle(title) { 18496 this._title = this._parseStringHelper(title); 18497 } 18498 18499 setContents(contents) { 18500 this._contents = this._parseStringHelper(contents); 18501 } 18502 18503 setModificationDate(modificationDate) { 18504 this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null; 18505 } 18506 18507 setFlags(flags) { 18508 this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0; 18509 } 18510 18511 hasFlag(flag) { 18512 return this._hasFlag(this.flags, flag); 18513 } 18514 18515 setRectangle(rectangle) { 18516 if (Array.isArray(rectangle) && rectangle.length === 4) { 18517 this.rectangle = _util.Util.normalizeRect(rectangle); 18518 } else { 18519 this.rectangle = [0, 0, 0, 0]; 18520 } 18521 } 18522 18523 setColor(color) { 18524 this.color = getRgbColor(color); 18525 } 18526
18527 setBorderAndBackgroundColors(mk) { 18528 if (mk instanceof _primitives.Dict) { 18529 this.borderColor = getRgbColor(mk.getArray("BC"), null); 18530 this.backgroundColor = getRgbColor(mk.getArray("BG"), null); 18531 } else { 18532 this.borderColor = this.backgroundColor = null; 18533 } 18534 } 18535 18536 setBorderStyle(borderStyle) { 18537 this.borderStyle = new AnnotationBorderStyle(); 18538 18539 if (!(0, _primitives.isDict)(borderStyle)) { 18540 return; 18541 } 18542 18543 if (borderStyle.has("BS")) { 18544 const dict = borderStyle.get("BS"); 18545 const dictType = dict.get("Type"); 18546 18547 if (!dictType || (0, _primitives.isName)(dictType, "Border")) { 18548 this.borderStyle.setWidth(dict.get("W"), this.rectangle); 18549 this.borderStyle.setStyle(dict.get("S")); 18550 this.borderStyle.setDashArray(dict.getArray("D")); 18551 } 18552 } else if (borderStyle.has("Border")) { 18553 const array = borderStyle.getArray("Border"); 18554 18555 if (Array.isArray(array) && array.length >= 3) { 18556 this.borderStyle.setHorizontalCornerRadius(array[0]); 18557 this.borderStyle.setVerticalCornerRadius(array[1]); 18558 this.borderStyle.setWidth(array[2], this.rectangle); 18559 18560 if (array.length === 4) { 18561 this.borderStyle.setDashArray(array[3], true); 18562 } 18563 } 18564 } else { 18565 this.borderStyle.setWidth(0); 18566 } 18567 } 18568 18569 setAppearance(dict) { 18570 this.appearance = null; 18571 const appearanceStates = dict.get("AP"); 18572 18573 if (!(0, _primitives.isDict)(appearanceStates)) { 18574 return; 18575 } 18576 18577 const normalAppearanceState = appearanceStates.get("N"); 18578 18579 if ((0, _primitives.isStream)(normalAppearanceState)) { 18580 this.appearance = normalAppearanceState; 18581 return; 18582 } 18583 18584 if (!(0, _primitives.isDict)(normalAppearanceState)) { 18585 return; 18586 } 18587 18588 const as = dict.get("AS"); 18589 18590 if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) { 18591 return; 18592 } 18593 18594 this.appearance = normalAppearanceState.get(as.name); 18595 } 18596 18597 loadResources(keys, appearance) { 18598 return appearance.dict.getAsync("Resources").then(resources => { 18599 if (!resources) { 18600 return undefined; 18601 } 18602 18603 const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref); 18604 return objectLoader.load().then(function () { 18605 return resources; 18606 }); 18607 }); 18608 } 18609 18610 getOperatorList(evaluator, task, intent, renderForms, annotationStorage) { 18611 const data = this.data; 18612 let appearance = this.appearance; 18613 const isUsingOwnCanvas = data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY; 18614 18615 if (!appearance) { 18616 if (!isUsingOwnCanvas) { 18617 return Promise.resolve(new _operator_list.OperatorList()); 18618 } 18619 18620 appearance = new _stream.StringStream(""); 18621 appearance.dict = new _primitives.Dict(); 18622 } 18623 18624 const appearanceDict = appearance.dict; 18625 const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance); 18626 const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1]; 18627 const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0]; 18628 const transform = getTransformMatrix(data.rect, bbox, matrix); 18629 return resourcesPromise.then(resources => { 18630 const opList = new _operator_list.OperatorList(); 18631 opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]); 18632 return evaluator.getOperatorList({ 18633 stream: appearance, 18634 task, 18635 resources, 18636 operatorList: opList, 18637 fallbackFontDict: this._fallbackFontDict 18638 }).then(() => { 18639 opList.addOp(_util.OPS.endAnnotation, []); 18640 this.reset(); 18641 return opList; 18642 }); 18643 }); 18644 } 18645 18646 async save(evaluator, task, annotationStorage) { 18647 return null; 18648 } 18649 18650 getFieldObject() { 18651 if (this.data.kidIds) { 18652 return { 18653 id: this.data.id, 18654 actions: this.data.actions, 18655 name: this.data.fieldName, 18656 strokeColor: this.data.borderColor, 18657 fillColor: this.data.backgroundColor, 18658 type: "", 18659 kidIds: this.data.kidIds, 18660 page: this.data.pageIndex 18661 }; 18662 } 18663 18664 return null; 18665 } 18666 18667 reset() { 18668 for (const stream of this._streams) { 18669 stream.reset(); 18670 } 18671 } 18672 18673 _constructFieldName(dict) { 18674 if (!dict.has("T") && !dict.has("Parent")) { 18675 (0, _util.warn)("Unknown field name, falling back to empty field name."); 18676 return ""; 18677 } 18678 18679 if (!dict.has("Parent")) { 18680 return (0, _util.stringToPDFString)(dict.get("T")); 18681 } 18682 18683 const fieldName = []; 18684 18685 if (dict.has("T")) { 18686 fieldName.unshift((0, _util.stringToPDFString)(dict.get("T"))); 18687 } 18688 18689 let loopDict = dict; 18690 const visited = new _primitives.RefSet(); 18691 18692 if (dict.objId) { 18693 visited.put(dict.objId); 18694 } 18695 18696 while (loopDict.has("Parent")) { 18697 loopDict = loopDict.get("Parent"); 18698 18699 if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) { 18700 break; 18701 } 18702 18703 if (loopDict.objId) { 18704 visited.put(loopDict.objId); 18705 } 18706 18707 if (loopDict.has("T")) { 18708 fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T"))); 18709 } 18710 } 18711 18712 return fieldName.join("."); 18713 } 18714 18715} 18716 18717exports.Annotation = Annotation; 18718 18719class AnnotationBorderStyle { 18720 constructor() { 18721 this.width = 1; 18722 this.style = _util.AnnotationBorderStyleType.SOLID; 18723 this.dashArray = [3]; 18724 this.horizontalCornerRadius = 0; 18725 this.verticalCornerRadius = 0; 18726 } 18727 18728 setWidth(width, rect = [0, 0, 0, 0]) { 18729 if ((0, _primitives.isName)(width)) { 18730 this.width = 0; 18731 return; 18732 } 18733 18734 if (Number.isInteger(width)) { 18735 if (width > 0) { 18736 const maxWidth = (rect[2] - rect[0]) / 2; 18737 const maxHeight = (rect[3] - rect[1]) / 2; 18738 18739 if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) { 18740 (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`); 18741 width = 1; 18742 } 18743 } 18744 18745 this.width = width; 18746 } 18747 } 18748 18749 setStyle(style) { 18750 if (!(0, _primitives.isName)(style)) { 18751 return; 18752 } 18753 18754 switch (style.name) { 18755 case "S": 18756 this.style = _util.AnnotationBorderStyleType.SOLID; 18757 break; 18758 18759 case "D": 18760 this.style = _util.AnnotationBorderStyleType.DASHED; 18761 break; 18762 18763 case "B": 18764 this.style = _util.AnnotationBorderStyleType.BEVELED; 18765 break; 18766 18767 case "I": 18768 this.style = _util.AnnotationBorderStyleType.INSET; 18769 break; 18770 18771 case "U": 18772 this.style = _util.AnnotationBorderStyleType.UNDERLINE; 18773 break; 18774 18775 default: 18776 break; 18777 } 18778 } 18779 18780 setDashArray(dashArray, forceStyle = false) { 18781 if (Array.isArray(dashArray) && dashArray.length > 0) { 18782 let isValid = true; 18783 let allZeros = true; 18784 18785 for (const element of dashArray) { 18786 const validNumber = +element >= 0; 18787 18788 if (!validNumber) { 18789 isValid = false;
18790 break; 18791 } else if (element > 0) { 18792 allZeros = false; 18793 } 18794 } 18795 18796 if (isValid && !allZeros) { 18797 this.dashArray = dashArray; 18798 18799 if (forceStyle) { 18800 this.setStyle(_primitives.Name.get("D")); 18801 } 18802 } else { 18803 this.width = 0; 18804 } 18805 } else if (dashArray) { 18806 this.width = 0; 18807 } 18808 } 18809 18810 setHorizontalCornerRadius(radius) { 18811 if (Number.isInteger(radius)) { 18812 this.horizontalCornerRadius = radius; 18813 } 18814 } 18815 18816 setVerticalCornerRadius(radius) { 18817 if (Number.isInteger(radius)) { 18818 this.verticalCornerRadius = radius; 18819 } 18820 } 18821 18822} 18823 18824exports.AnnotationBorderStyle = AnnotationBorderStyle; 18825 18826class MarkupAnnotation extends Annotation { 18827 constructor(parameters) { 18828 super(parameters); 18829 const dict = parameters.dict; 18830 18831 if (dict.has("IRT")) { 18832 const rawIRT = dict.getRaw("IRT"); 18833 this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null; 18834 const rt = dict.get("RT"); 18835 this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY; 18836 } 18837 18838 if (this.data.replyType === _util.AnnotationReplyType.GROUP) { 18839 const parent = dict.get("IRT"); 18840 this.setTitle(parent.get("T")); 18841 this.data.titleObj = this._title; 18842 this.setContents(parent.get("Contents")); 18843 this.data.contentsObj = this._contents; 18844 18845 if (!parent.has("CreationDate")) { 18846 this.data.creationDate = null; 18847 } else { 18848 this.setCreationDate(parent.get("CreationDate")); 18849 this.data.creationDate = this.creationDate; 18850 } 18851 18852 if (!parent.has("M")) { 18853 this.data.modificationDate = null; 18854 } else { 18855 this.setModificationDate(parent.get("M")); 18856 this.data.modificationDate = this.modificationDate; 18857 } 18858 18859 this.data.hasPopup = parent.has("Popup"); 18860 18861 if (!parent.has("C")) { 18862 this.data.color = null; 18863 } else { 18864 this.setColor(parent.getArray("C")); 18865 this.data.color = this.color; 18866 } 18867 } else { 18868 this.data.titleObj = this._title; 18869 this.setCreationDate(dict.get("CreationDate")); 18870 this.data.creationDate = this.creationDate; 18871 this.data.hasPopup = dict.has("Popup"); 18872 18873 if (!dict.has("C")) { 18874 this.data.color = null; 18875 } 18876 } 18877 18878 if (dict.has("RC")) { 18879 this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC")); 18880 } 18881 } 18882 18883 setCreationDate(creationDate) { 18884 this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null; 18885 } 18886 18887 _setDefaultAppearance({ 18888 xref, 18889 extra, 18890 strokeColor, 18891 fillColor, 18892 blendMode, 18893 strokeAlpha, 18894 fillAlpha, 18895 pointsCallback 18896 }) { 18897 let minX = Number.MAX_VALUE; 18898 let minY = Number.MAX_VALUE; 18899 let maxX = Number.MIN_VALUE; 18900 let maxY = Number.MIN_VALUE; 18901 const buffer = ["q"]; 18902 18903 if (extra) { 18904 buffer.push(extra); 18905 } 18906 18907 if (strokeColor) { 18908 buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`); 18909 } 18910 18911 if (fillColor) { 18912 buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`); 18913 } 18914 18915 let pointsArray = this.data.quadPoints; 18916 18917 if (!pointsArray) { 18918 pointsArray = [[{ 18919 x: this.rectangle[0], 18920 y: this.rectangle[3] 18921 }, { 18922 x: this.rectangle[2], 18923 y: this.rectangle[3] 18924 }, { 18925 x: this.rectangle[0], 18926 y: this.rectangle[1] 18927 }, { 18928 x: this.rectangle[2], 18929 y: this.rectangle[1] 18930 }]]; 18931 } 18932 18933 for (const points of pointsArray) { 18934 const [mX, MX, mY, MY] = pointsCallback(buffer, points); 18935 minX = Math.min(minX, mX); 18936 maxX = Math.max(maxX, MX); 18937 minY = Math.min(minY, mY); 18938 maxY = Math.max(maxY, MY); 18939 } 18940 18941 buffer.push("Q"); 18942 const formDict = new _primitives.Dict(xref); 18943 const appearanceStreamDict = new _primitives.Dict(xref); 18944 appearanceStreamDict.set("Subtype", _primitives.Name.get("Form")); 18945 const appearanceStream = new _stream.StringStream(buffer.join(" ")); 18946 appearanceStream.dict = appearanceStreamDict; 18947 formDict.set("Fm0", appearanceStream); 18948 const gsDict = new _primitives.Dict(xref); 18949 18950 if (blendMode) { 18951 gsDict.set("BM", _primitives.Name.get(blendMode)); 18952 } 18953 18954 if (typeof strokeAlpha === "number") { 18955 gsDict.set("CA", strokeAlpha); 18956 } 18957 18958 if (typeof fillAlpha === "number") { 18959 gsDict.set("ca", fillAlpha); 18960 } 18961 18962 const stateDict = new _primitives.Dict(xref); 18963 stateDict.set("GS0", gsDict); 18964 const resources = new _primitives.Dict(xref); 18965 resources.set("ExtGState", stateDict); 18966 resources.set("XObject", formDict); 18967 const appearanceDict = new _primitives.Dict(xref); 18968 appearanceDict.set("Resources", resources); 18969 const bbox = this.data.rect = [minX, minY, maxX, maxY]; 18970 appearanceDict.set("BBox", bbox); 18971 this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do"); 18972 this.appearance.dict = appearanceDict; 18973 18974 this._streams.push(this.appearance, appearanceStream); 18975 } 18976 18977} 18978 18979exports.MarkupAnnotation = MarkupAnnotation; 18980 18981class WidgetAnnotation extends Annotation { 18982 constructor(params) { 18983 super(params); 18984 const dict = params.dict; 18985 const data = this.data; 18986 this.ref = params.ref; 18987 data.annotationType = _util.AnnotationType.WIDGET; 18988 18989 if (data.fieldName === undefined) { 18990 data.fieldName = this._constructFieldName(dict); 18991 } 18992 18993 if (data.actions === undefined) { 18994 data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType); 18995 } 18996 18997 const fieldValue = (0, _core_utils.getInheritableProperty)({ 18998 dict, 18999 key: "V", 19000 getArray: true 19001 }); 19002 data.fieldValue = this._decodeFormValue(fieldValue); 19003 const defaultFieldValue = (0, _core_utils.getInheritableProperty)({ 19004 dict, 19005 key: "DV", 19006 getArray: true 19007 }); 19008 data.defaultFieldValue = this._decodeFormValue(defaultFieldValue); 19009 19010 if (fieldValue === undefined && data.defaultFieldValue !== null) { 19011 data.fieldValue = data.defaultFieldValue; 19012 } 19013 19014 data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || ""); 19015 const defaultAppearance = (0, _core_utils.getInheritableProperty)({ 19016 dict, 19017 key: "DA" 19018 }) || params.acroForm.get("DA"); 19019 this._defaultAppearance = (0, _util.isString)(defaultAppearance) ? defaultAppearance : ""; 19020 data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance); 19021 const fieldType = (0, _core_utils.getInheritableProperty)({ 19022 dict, 19023 key: "FT" 19024 }); 19025 data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.n
19025ame : null; 19026 const localResources = (0, _core_utils.getInheritableProperty)({ 19027 dict, 19028 key: "DR" 19029 }); 19030 const acroFormResources = params.acroForm.get("DR"); 19031 const appearanceResources = this.appearance && this.appearance.dict.get("Resources"); 19032 this._fieldResources = { 19033 localResources, 19034 acroFormResources, 19035 appearanceResources, 19036 mergedResources: _primitives.Dict.merge({ 19037 xref: params.xref, 19038 dictArray: [localResources, appearanceResources, acroFormResources], 19039 mergeSubDicts: true 19040 }) 19041 }; 19042 data.fieldFlags = (0, _core_utils.getInheritableProperty)({ 19043 dict, 19044 key: "Ff" 19045 }); 19046 19047 if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) { 19048 data.fieldFlags = 0; 19049 } 19050 19051 data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY); 19052 data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN); 19053 } 19054 19055 _decodeFormValue(formValue) { 19056 if (Array.isArray(formValue)) { 19057 return formValue.filter(item => (0, _util.isString)(item)).map(item => (0, _util.stringToPDFString)(item)); 19058 } else if ((0, _primitives.isName)(formValue)) { 19059 return (0, _util.stringToPDFString)(formValue.name); 19060 } else if ((0, _util.isString)(formValue)) { 19061 return (0, _util.stringToPDFString)(formValue); 19062 } 19063 19064 return null; 19065 } 19066 19067 hasFieldFlag(flag) { 19068 return !!(this.data.fieldFlags & flag); 19069 } 19070 19071 getOperatorList(evaluator, task, intent, renderForms, annotationStorage) { 19072 if (renderForms && !(this instanceof SignatureWidgetAnnotation)) { 19073 return Promise.resolve(new _operator_list.OperatorList()); 19074 } 19075 19076 if (!this._hasText) { 19077 return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage); 19078 } 19079 19080 return this._getAppearance(evaluator, task, annotationStorage).then(content => { 19081 if (this.appearance && content === null) { 19082 return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage); 19083 } 19084 19085 const operatorList = new _operator_list.OperatorList(); 19086 19087 if (!this._defaultAppearance || content === null) { 19088 return operatorList; 19089 } 19090 19091 const matrix = [1, 0, 0, 1, 0, 0]; 19092 const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]; 19093 const transform = getTransformMatrix(this.data.rect, bbox, matrix); 19094 operatorList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, matrix]); 19095 const stream = new _stream.StringStream(content); 19096 return evaluator.getOperatorList({ 19097 stream, 19098 task, 19099 resources: this._fieldResources.mergedResources, 19100 operatorList 19101 }).then(function () { 19102 operatorList.addOp(_util.OPS.endAnnotation, []); 19103 return operatorList; 19104 }); 19105 }); 19106 } 19107 19108 async save(evaluator, task, annotationStorage) { 19109 if (!annotationStorage) { 19110 return null; 19111 } 19112 19113 const storageEntry = annotationStorage.get(this.data.id); 19114 const value = storageEntry && storageEntry.value; 19115 19116 if (value === this.data.fieldValue || value === undefined) { 19117 return null; 19118 } 19119 19120 let appearance = await this._getAppearance(evaluator, task, annotationStorage); 19121 19122 if (appearance === null) { 19123 return null; 19124 } 19125 19126 const { 19127 xref 19128 } = evaluator; 19129 const dict = xref.fetchIfRef(this.ref); 19130 19131 if (!(0, _primitives.isDict)(dict)) { 19132 return null; 19133 } 19134 19135 const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]; 19136 const xfa = { 19137 path: (0, _util.stringToPDFString)(dict.get("T") || ""), 19138 value 19139 }; 19140 const newRef = xref.getNewRef(); 19141 const AP = new _primitives.Dict(xref); 19142 AP.set("N", newRef); 19143 const encrypt = xref.encrypt; 19144 let originalTransform = null; 19145 let newTransform = null; 19146 19147 if (encrypt) { 19148 originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen); 19149 newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen); 19150 appearance = newTransform.encryptString(appearance); 19151 } 19152 19153 dict.set("V", (0, _util.isAscii)(value) ? value : (0, _util.stringToUTF16BEString)(value)); 19154 dict.set("AP", AP); 19155 dict.set("M", `D:${(0, _util.getModificationDate)()}`); 19156 const appearanceDict = new _primitives.Dict(xref); 19157 appearanceDict.set("Length", appearance.length); 19158 appearanceDict.set("Subtype", _primitives.Name.get("Form")); 19159 appearanceDict.set("Resources", this._getSaveFieldResources(xref)); 19160 appearanceDict.set("BBox", bbox); 19161 const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`]; 19162 (0, _writer.writeDict)(dict, bufferOriginal, originalTransform); 19163 bufferOriginal.push("\nendobj\n"); 19164 const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`]; 19165 (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform); 19166 bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n"); 19167 return [{ 19168 ref: this.ref, 19169 data: bufferOriginal.join(""), 19170 xfa 19171 }, {
19172 ref: newRef, 19173 data: bufferNew.join(""), 19174 xfa: null 19175 }]; 19176 } 19177 19178 async _getAppearance(evaluator, task, annotationStorage) { 19179 const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD); 19180 19181 if (!annotationStorage || isPassword) { 19182 return null; 19183 } 19184 19185 const storageEntry = annotationStorage.get(this.data.id); 19186 let value = storageEntry && storageEntry.value; 19187 19188 if (value === undefined) { 19189 return null; 19190 } 19191 19192 value = value.trim(); 19193 19194 if (value === "") { 19195 return ""; 19196 } 19197 19198 let lineCount = -1; 19199 19200 if (this.data.multiLine) { 19201 lineCount = value.split(/\r\n|\r|\n/).length; 19202 } 19203 19204 const defaultPadding = 2; 19205 const hPadding = defaultPadding; 19206 const totalHeight = this.data.rect[3] - this.data.rect[1]; 19207 const totalWidth = this.data.rect[2] - this.data.rect[0]; 19208 19209 if (!this._defaultAppearance) { 19210 this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g"); 19211 } 19212 19213 const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight, lineCount); 19214 19215 const font = await this._getFontData(evaluator, task); 19216 let descent = font.descent; 19217 19218 if (isNaN(descent)) { 19219 descent = 0; 19220 } 19221 19222 const vPadding = defaultPadding + Math.abs(descent) * fontSize; 19223 const alignment = this.data.textAlignment; 19224 19225 if (this.data.multiLine) { 19226 return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding); 19227 } 19228 19229 const encodedString = font.encodeString(value).join(""); 19230 19231 if (this.data.comb) { 19232 return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding); 19233 } 19234 19235 if (alignment === 0 || alignment > 2) { 19236 return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC"; 19237 } 19238 19239 const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding); 19240 19241 return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC"; 19242 } 19243 19244 async _getFontData(evaluator, task) { 19245 const operatorList = new _operator_list.OperatorList(); 19246 const initialState = { 19247 font: null, 19248 19249 clone() { 19250 return this; 19251 } 19252 19253 }; 19254 const { 19255 fontName, 19256 fontSize 19257 } = this.data.defaultAppearanceData; 19258 await evaluator.handleSetFont(this._fieldResources.mergedResources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null); 19259 return initialState.font; 19260 } 19261 19262 _computeFontSize(height, lineCount) { 19263 let { 19264 fontSize 19265 } = this.data.defaultAppearanceData; 19266 19267 if (!fontSize) { 19268 const roundWithOneDigit = x => Math.round(x * 10) / 10; 19269 19270 const FONT_FACTOR = 0.8; 19271 19272 if (lineCount === -1) { 19273 fontSize = roundWithOneDigit(FONT_FACTOR * height); 19274 } else { 19275 fontSize = 10; 19276 let lineHeight = fontSize / FONT_FACTOR; 19277 let numberOfLines = Math.round(height / lineHeight); 19278 numberOfLines = Math.max(numberOfLines, lineCount); 19279 lineHeight = height / numberOfLines; 19280 fontSize = roundWithOneDigit(FONT_FACTOR * lineHeight); 19281 } 19282 19283 const { 19284 fontName, 19285 fontColor 19286 } = this.data.defaultAppearanceData; 19287 this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({ 19288 fontSize, 19289 fontName, 19290 fontColor 19291 }); 19292 } 19293 19294 return [this._defaultAppearance, fontSize]; 19295 } 19296 19297 _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) { 19298 const glyphs = font.charsToGlyphs(text); 19299 const scale = fontSize / 1000; 19300 let width = 0; 19301 19302 for (const glyph of glyphs) { 19303 width += glyph.width * scale; 19304 } 19305 19306 let shift; 19307 19308 if (alignment === 1) { 19309 shift = (totalWidth - width) / 2; 19310 } else if (alignment === 2) { 19311 shift = totalWidth - width - hPadding; 19312 } else { 19313 shift = hPadding; 19314 } 19315 19316 shift = shift.toFixed(2); 19317 vPadding = vPadding.toFixed(2); 19318 return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`; 19319 } 19320 19321 _getSaveFieldResources(xref) { 19322 const { 19323 localResources, 19324 appearanceResources, 19325 acroFormResources 19326 } = this._fieldResources; 19327 const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName; 19328 19329 if (!fontName) { 19330 return localResources || _primitives.Dict.empty; 19331 } 19332 19333 for (const resources of [localResources, appearanceResources]) { 19334 if (resources instanceof _primitives.Dict) { 19335 const localFont = resources.get("Font"); 19336 19337 if (localFont instanceof _primitives.Dict && localFont.has(fontName)) { 19338 return resources; 19339 } 19340 } 19341 } 19342 19343 if (acroFormResources instanceof _primitives.Dict) { 19344 const acroFormFont = acroFormResources.get("Font"); 19345 19346 if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) { 19347 const subFontDict = new _primitives.Dict(xref); 19348 subFontDict.set(fontName, acroFormFont.getRaw(fontName)); 19349 const subResourcesDict = new _primitives.Dict(xref); 19350 subResourcesDict.set("Font", subFontDict); 19351 return _primitives.Dict.merge({ 19352 xref, 19353 dictArray: [subResourcesDict, localResources], 19354 mergeSubDicts: true 19355 }); 19356 } 19357 } 19358 19359 return localResources || _primitives.Dict.empty; 19360 } 19361 19362 getFieldObject() { 19363 return null; 19364 } 19365 19366} 19367 19368class TextWidgetAnnotation extends WidgetAnnotation { 19369 constructor(params) { 19370 super(params); 19371 this._hasText = true; 19372 const dict = params.dict; 19373 19374 if (!(0, _util.isString)(this.data.fieldValue)) { 19375 this.data.fieldValue = ""; 19376 } 19377 19378 let alignment = (0, _core_utils.getInheritableProperty)({ 19379 dict, 19380 key: "Q" 19381 }); 19382 19383 if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) { 19384 alignment = null; 19385 } 19386 19387 this.data.textAlignment = alignment; 19388 let maximumLength = (0, _core_utils.getInheritableProperty)({ 19389 dict, 19390 key: "MaxLen" 19391 }); 19392 19393 if (!Number.isInteger(maximumLength) || maximumLength < 0) { 19394 maximumLength = null; 19395 } 19396 19397 this.data.maxLen = maximumLength; 19398 this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE); 19399 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 !== null; 19400 } 19401 19402 _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding) { 19403 const combWidth = (width / this.data.maxLen).toFixed(2); 19404 const buf = []; 19405 const positions = font.getCharPositions(text); 19406 19407 for (const [start, end] of positions) { 19408 buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`); 19409 } 19410 19411 const renderedComb = buf.join(` ${combWidth} 0 Td `); 19412 return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC"; 19413 } 19414 19415 _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding) { 19416 const lines = text.split(/\r\n|\r|\n/); 19417 const buf = []; 19418 const totalWidth = width - 2 * hPadding; 19419 19420 for (const line of lines) { 19421 const chunks = this._splitLine(line, font, fontSize, totalWidth); 19422 19423 for (const chunk of chunks) { 19424 const padding = buf.length === 0 ? hPadding : 0; 19425 buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize)); 19426 } 19427 } 19428 19429 const renderedText = buf.join("\n"); 19430 return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC"; 19431 } 19432 19433 _splitLine(line, font, fontSize, width) { 19434 line = font.encodeString(line).join(""); 19435 const glyphs = font.charsToGlyphs(line); 19436 19437 if (glyphs.length <= 1) { 19438 return [line]; 19439 } 19440
19441 const positions = font.getCharPositions(line); 19442 const scale = fontSize / 1000; 19443 const chunks = []; 19444 let lastSpacePosInStringStart = -1, 19445 lastSpacePosInStringEnd = -1, 19446 lastSpacePos = -1, 19447 startChunk = 0, 19448 currentWidth = 0; 19449 19450 for (let i = 0, ii = glyphs.length; i < ii; i++) { 19451 const [start, end] = positions[i]; 19452 const glyph = glyphs[i]; 19453 const glyphWidth = glyph.width * scale; 19454 19455 if (glyph.unicode === " ") { 19456 if (currentWidth + glyphWidth > width) { 19457 chunks.push(line.substring(startChunk, start)); 19458 startChunk = start; 19459 currentWidth = glyphWidth; 19460 lastSpacePosInStringStart = -1; 19461 lastSpacePos = -1; 19462 } else { 19463 currentWidth += glyphWidth; 19464 lastSpacePosInStringStart = start; 19465 lastSpacePosInStringEnd = end; 19466 lastSpacePos = i; 19467 } 19468 } else { 19469 if (currentWidth + glyphWidth > width) { 19470 if (lastSpacePosInStringStart !== -1) { 19471 chunks.push(line.substring(startChunk, lastSpacePosInStringEnd)); 19472 startChunk = lastSpacePosInStringEnd; 19473 i = lastSpacePos + 1; 19474 lastSpacePosInStringStart = -1; 19475 currentWidth = 0; 19476 } else { 19477 chunks.push(line.substring(startChunk, start)); 19478 startChunk = start; 19479 currentWidth = glyphWidth; 19480 } 19481 } else { 19482 currentWidth += glyphWidth; 19483 } 19484 } 19485 } 19486 19487 if (startChunk < line.length) { 19488 chunks.push(line.substring(startChunk, line.length)); 19489 } 19490 19491 return chunks; 19492 } 19493 19494 getFieldObject() { 19495 return { 19496 id: this.data.id, 19497 value: this.data.fieldValue, 19498 defaultValue: this.data.defaultFieldValue, 19499 multiline: this.data.multiLine, 19500 password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD), 19501 charLimit: this.data.maxLen, 19502 comb: this.data.comb, 19503 editable: !this.data.readOnly, 19504 hidden: this.data.hidden, 19505 name: this.data.fieldName, 19506 rect: this.data.rect, 19507 actions: this.data.actions, 19508 page: this.data.pageIndex, 19509 strokeColor: this.data.borderColor, 19510 fillColor: this.data.backgroundColor, 19511 type: "text" 19512 }; 19513 } 19514 19515} 19516 19517class ButtonWidgetAnnotation extends WidgetAnnotation { 19518 constructor(params) { 19519 super(params); 19520 this.checkedAppearance = null; 19521 this.uncheckedAppearance = null; 19522 this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 19523 this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 19524 this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 19525 this.data.isTooltipOnly = false; 19526 19527 if (this.data.checkBox) { 19528 this._processCheckBox(params); 19529 } else if (this.data.radioButton) { 19530 this._processRadioButton(params); 19531 } else if (this.data.pushButton) { 19532 this.data.hasOwnCanvas = true; 19533 19534 this._processPushButton(params); 19535 } else { 19536 (0, _util.warn)("Invalid field flags for button widget annotation"); 19537 } 19538 } 19539 19540 async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) { 19541 if (this.data.pushButton) { 19542 return super.getOperatorList(evaluator, task, intent, false, annotationStorage); 19543 } 19544 19545 let value = null; 19546 19547 if (annotationStorage) { 19548 const storageEntry = annotationStorage.get(this.data.id); 19549 value = storageEntry ? storageEntry.value : null; 19550 } 19551 19552 if (value === null) { 19553 if (this.appearance) { 19554 return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage); 19555 } 19556 19557 if (this.data.checkBox) { 19558 value = this.data.fieldValue === this.data.exportValue; 19559 } else { 19560 value = this.data.fieldValue === this.data.buttonValue; 19561 } 19562 } 19563 19564 const appearance = value ? this.checkedAppearance : this.uncheckedAppearance; 19565 19566 if (appearance) { 19567 const savedAppearance = this.appearance; 19568 this.appearance = appearance; 19569 const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage); 19570 this.appearance = savedAppearance; 19571 return operatorList; 19572 } 19573 19574 return new _operator_list.OperatorList(); 19575 } 19576 19577 async save(evaluator, task, annotationStorage) { 19578 if (this.data.checkBox) { 19579 return this._saveCheckbox(evaluator, task, annotationStorage); 19580 } 19581 19582 if (this.data.radioButton) { 19583 return this._saveRadioButton(evaluator, task, annotationStorage); 19584 } 19585 19586 return null; 19587 } 19588 19589 async _saveCheckbox(evaluator, task, annotationStorage) { 19590 if (!annotationStorage) { 19591 return null; 19592 } 19593 19594 const storageEntry = annotationStorage.get(this.data.id); 19595 const value = storageEntry && storageEntry.value; 19596 19597 if (value === undefined) { 19598 return null; 19599 } 19600 19601 const defaultValue = this.data.fieldValue === this.data.exportValue; 19602 19603 if (defaultValue === value) { 19604 return null; 19605 } 19606 19607 const dict = evaluator.xref.fetchIfRef(this.ref); 19608 19609 if (!(0, _primitives.isDict)(dict)) { 19610 return null; 19611 } 19612 19613 const xfa = { 19614 path: (0, _util.stringToPDFString)(dict.get("T") || ""), 19615 value: value ? this.data.exportValue : "" 19616 }; 19617 19618 const name = _primitives.Name.get(value ? this.data.exportValue : "Off"); 19619 19620 dict.set("V", name); 19621 dict.set("AS", name); 19622 dict.set("M", `D:${(0, _util.getModificationDate)()}`); 19623 const encrypt = evaluator.xref.encrypt; 19624 let originalTransform = null; 19625 19626 if (encrypt) { 19627 originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen); 19628 } 19629 19630 const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`]; 19631 (0, _writer.writeDict)(dict, buffer, originalTransform); 19632 buffer.push("\nendobj\n"); 19633 return [{ 19634 ref: this.ref, 19635 data: buffer.join(""), 19636 xfa 19637 }]; 19638 } 19639 19640 async _saveRadioButton(evaluator, task, annotationStorage) { 19641 if (!annotationStorage) { 19642 return null; 19643 } 19644 19645 const storageEntry = annotationStorage.get(this.data.id); 19646 const value = storageEntry && storageEntry.value; 19647 19648 if (value === undefined) { 19649 return null; 19650 } 19651 19652 const defaultValue = this.data.fieldValue === this.data.buttonValue; 19653 19654 if (defaultValue === value) { 19655 return null; 19656 } 19657 19658 const dict = evaluator.xref.fetchIfRef(this.ref); 19659 19660 if (!(0, _primitives.isDict)(dict)) { 19661 return null; 19662 } 19663 19664 const xfa = { 19665 path: (0, _util.stringToPDFString)(dict.get("T") || ""), 19666 value: value ? this.data.buttonValue : "" 19667 }; 19668 19669 const name = _primitives.Name.get(value ? this.data.buttonValue : "Off"); 19670 19671 let parentBuffer = null; 19672 const encrypt = evaluator.xref.encrypt; 19673 19674 if (value) { 19675 if ((0, _primitives.isRef)(this.parent)) { 19676 const parent = evaluator.xref.fetch(this.parent); 19677 let parentTransform = null; 19678 19679 if (encrypt) { 19680 parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen); 19681 } 19682 19683 parent.set("V", name); 19684 parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
19685 (0, _writer.writeDict)(parent, parentBuffer, parentTransform); 19686 parentBuffer.push("\nendobj\n"); 19687 } else if ((0, _primitives.isDict)(this.parent)) { 19688 this.parent.set("V", name); 19689 } 19690 } 19691 19692 dict.set("AS", name); 19693 dict.set("M", `D:${(0, _util.getModificationDate)()}`); 19694 let originalTransform = null; 19695 19696 if (encrypt) { 19697 originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen); 19698 } 19699 19700 const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`]; 19701 (0, _writer.writeDict)(dict, buffer, originalTransform); 19702 buffer.push("\nendobj\n"); 19703 const newRefs = [{ 19704 ref: this.ref, 19705 data: buffer.join(""), 19706 xfa 19707 }]; 19708 19709 if (parentBuffer !== null) { 19710 newRefs.push({ 19711 ref: this.parent, 19712 data: parentBuffer.join(""), 19713 xfa: null 19714 }); 19715 } 19716 19717 return newRefs; 19718 } 19719 19720 _getDefaultCheckedAppearance(params, type) { 19721 const width = this.data.rect[2] - this.data.rect[0]; 19722 const height = this.data.rect[3] - this.data.rect[1]; 19723 const bbox = [0, 0, width, height]; 19724 const FONT_RATIO = 0.8; 19725 const fontSize = Math.min(width, height) * FONT_RATIO; 19726 let metrics, char; 19727 19728 if (type === "check") { 19729 metrics = { 19730 width: 0.755 * fontSize, 19731 height: 0.705 * fontSize 19732 }; 19733 char = "\x33"; 19734 } else if (type === "disc") { 19735 metrics = { 19736 width: 0.791 * fontSize, 19737 height: 0.705 * fontSize 19738 }; 19739 char = "\x6C"; 19740 } else { 19741 (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`); 19742 } 19743 19744 const xShift = (width - metrics.width) / 2; 19745 const yShift = (height - metrics.height) / 2; 19746 const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`; 19747 const appearanceStreamDict = new _primitives.Dict(params.xref); 19748 appearanceStreamDict.set("FormType", 1); 19749 appearanceStreamDict.set("Subtype", _primitives.Name.get("Form")); 19750 appearanceStreamDict.set("Type", _primitives.Name.get("XObject")); 19751 appearanceStreamDict.set("BBox", bbox); 19752 appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]); 19753 appearanceStreamDict.set("Length", appearance.length); 19754 const resources = new _primitives.Dict(params.xref); 19755 const font = new _primitives.Dict(params.xref); 19756 font.set("PdfJsZaDb", this.fallbackFontDict); 19757 resources.set("Font", font); 19758 appearanceStreamDict.set("Resources", resources); 19759 this.checkedAppearance = new _stream.StringStream(appearance); 19760 this.checkedAppearance.dict = appearanceStreamDict; 19761 19762 this._streams.push(this.checkedAppearance); 19763 } 19764 19765 _processCheckBox(params) { 19766 const customAppearance = params.dict.get("AP"); 19767 19768 if (!(0, _primitives.isDict)(customAppearance)) { 19769 return; 19770 } 19771 19772 const normalAppearance = customAppearance.get("N"); 19773 19774 if (!(0, _primitives.isDict)(normalAppearance)) { 19775 return; 19776 } 19777 19778 const asValue = this._decodeFormValue(params.dict.get("AS")); 19779 19780 if (typeof asValue === "string") { 19781 this.data.fieldValue = asValue; 19782 } 19783 19784 const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes"; 19785 const exportValues = normalAppearance.getKeys(); 19786 19787 if (exportValues.length === 0) { 19788 exportValues.push("Off", yes); 19789 } else if (exportValues.length === 1) { 19790 if (exportValues[0] === "Off") { 19791 exportValues.push(yes); 19792 } else { 19793 exportValues.unshift("Off"); 19794 } 19795 } else if (exportValues.includes(yes)) { 19796 exportValues.length = 0; 19797 exportValues.push("Off", yes); 19798 } else { 19799 const otherYes = exportValues.find(v => v !== "Off"); 19800 exportValues.length = 0; 19801 exportValues.push("Off", otherYes); 19802 } 19803 19804 if (!exportValues.includes(this.data.fieldValue)) { 19805 this.data.fieldValue = "Off"; 19806 } 19807 19808 this.data.exportValue = exportValues[1]; 19809 this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null; 19810 this.uncheckedAppearance = normalAppearance.get("Off") || null; 19811 19812 if (this.checkedAppearance) { 19813 this._streams.push(this.checkedAppearance); 19814 } else { 19815 this._getDefaultCheckedAppearance(params, "check"); 19816 } 19817 19818 if (this.uncheckedAppearance) { 19819 this._streams.push(this.uncheckedAppearance); 19820 } 19821 19822 this._fallbackFontDict = this.fallbackFontDict; 19823 } 19824 19825 _processRadioButton(params) { 19826 this.data.fieldValue = this.data.buttonValue = null; 19827 const fieldParent = params.dict.get("Parent"); 19828 19829 if ((0, _primitives.isDict)(fieldParent)) { 19830 this.parent = params.dict.getRaw("Parent"); 19831 const fieldParentValue = fieldParent.get("V"); 19832 19833 if ((0, _primitives.isName)(fieldParentValue)) { 19834 this.data.fieldValue = this._decodeFormValue(fieldParentValue); 19835 } 19836 } 19837 19838 const appearanceStates = params.dict.get("AP"); 19839 19840 if (!(0, _primitives.isDict)(appearanceStates)) { 19841 return; 19842 } 19843 19844 const normalAppearance = appearanceStates.get("N"); 19845 19846 if (!(0, _primitives.isDict)(normalAppearance)) { 19847 return; 19848 } 19849 19850 for (const key of normalAppearance.getKeys()) { 19851 if (key !== "Off") { 19852 this.data.buttonValue = this._decodeFormValue(key); 19853 break; 19854 } 19855 } 19856 19857 this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null; 19858 this.uncheckedAppearance = normalAppearance.get("Off") || null; 19859 19860 if (this.checkedAppearance) { 19861 this._streams.push(this.checkedAppearance); 19862 } else { 19863 this._getDefaultCheckedAppearance(params, "disc"); 19864 } 19865 19866 if (this.uncheckedAppearance) { 19867 this._streams.push(this.uncheckedAppearance); 19868 } 19869 19870 this._fallbackFontDict = this.fallbackFontDict; 19871 } 19872 19873 _processPushButton(params) { 19874 if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) { 19875 (0, _util.warn)("Push buttons without action dictionaries are not supported"); 19876 return; 19877 } 19878 19879 this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA"); 19880 19881 _catalog.Catalog.parseDestDictionary({ 19882 destDict: params.dict, 19883 resultObj: this.data, 19884 docBaseUrl: params.pdfManager.docBaseUrl 19885 }); 19886 } 19887 19888 getFieldObject() { 19889 let type = "button"; 19890 let exportValues; 19891 19892 if (this.data.checkBox) { 19893 type = "checkbox"; 19894 exportValues = this.data.exportValue; 19895 } else if (this.data.radioButton) { 19896 type = "radiobutton"; 19897 exportValues = this.data.buttonValue; 19898 } 19899 19900 return { 19901 id: this.data.id, 19902 value: this.data.fieldValue || "Off", 19903 defaultValue: this.data.defaultFieldValue, 19904 exportValues, 19905 editable: !this.data.readOnly, 19906 name: this.data.fieldName, 19907 rect: this.data.rect, 19908 hidden: this.data.hidden, 19909 actions: this.data.actions, 19910 page: this.data.pageIndex, 19911 strokeColor: this.data.borderColor, 19912 fillColor: this.data.backgroundColor, 19913 type 19914 }; 19915 } 19916 19917 get fallbackFontDict() { 19918 const dict = new _primitives.Dict(); 19919 dict.set("BaseFont", _primitives.Name.get("ZapfDingbats")); 19920 dict.set("Type", _primitives.Name.get("FallbackType")); 19921 dict.set("Subtype", _primitives.Name.get("FallbackType")); 19922 dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding")); 19923 return (0, _util.shadow)(this, "fallbackFontDict", dict); 19924 } 19925 19926} 19927 19928class ChoiceWidgetAnnotation extends WidgetAnnotation { 19929 constructor(params) { 19930 super(params); 19931 this.data.options = []; 19932 const options = (0, _core_utils.getInheritableProperty)({ 19933 dict: params.dict, 19934 key: "Opt" 19935 }); 19936 19937 if (Array.isArray(options)) { 19938 const xref = params.xref; 19939 19940 for (let i = 0, ii = options.length; i < ii; i++) { 19941 const option = xref.fetchIfRef(options[i]); 19942 const isOptionArray = Array.isArray(option); 19943 this.data.options[i] = { 19944 exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option), 19945 displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option) 19946 }; 19947 } 19948 } 19949 19950 if ((0, _util.isString)(this.data.fieldValue)) { 19951 this.data.fieldValue = [this.data.fieldValue]; 19952 } else if (!this.data.fieldValue) { 19953 this.data.fieldValue = []; 19954 } 19955 19956 this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO); 19957 this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT); 19958 this._hasText = true; 19959 } 19960 19961 getFieldObject() { 19962 const type = this.data.combo ? "combobox" : "listbox"; 19963 const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null; 19964 return { 19965 id: this.data.id, 19966 value, 19967 defaultValue: this.data.defaultFieldValue, 19968 editable: !this.data.readOnly, 19969 name: this.data.fieldName, 19970 rect: this.data.rect, 19971 numItems: this.data.fieldValue.length, 19972 multipleSelection: this.data.multiSelect, 19973 hidden: this.data.hidden, 19974 actions: this.data.actions, 19975 items: this.data.options, 19976 page: this.data.pageIndex, 19977 strokeColor: this.data.borderColor, 19978 fillColor: this.data.backgroundColor, 19979 type 19980 }; 19981 } 19982 19983} 19984 19985class SignatureWidgetAnnotation extends WidgetAnnotation { 19986 constructor(params) { 19987 super(params); 19988 this.data.fieldValue = null; 19989 } 19990 19991 getFieldObject() { 19992 return { 19993 id: this.data.id, 19994 value: null, 19995 page: this.data.pageIndex, 19996 type: "signature" 19997 }; 19998 } 19999 20000} 20001 20002class TextAnnotation extends MarkupAnnotation { 20003 constructor(parameters) {
20004 const DEFAULT_ICON_SIZE = 22; 20005 super(parameters); 20006 const dict = parameters.dict; 20007 this.data.annotationType = _util.AnnotationType.TEXT; 20008 20009 if (this.data.hasAppearance) { 20010 this.data.name = "NoIcon"; 20011 } else { 20012 this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE; 20013 this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE; 20014 this.data.name = dict.has("Name") ? dict.get("Name").name : "Note"; 20015 } 20016 20017 if (dict.has("State")) { 20018 this.data.state = dict.get("State") || null; 20019 this.data.stateModel = dict.get("StateModel") || null; 20020 } else { 20021 this.data.state = null; 20022 this.data.stateModel = null; 20023 } 20024 } 20025 20026} 20027 20028class LinkAnnotation extends Annotation { 20029 constructor(params) { 20030 super(params); 20031 this.data.annotationType = _util.AnnotationType.LINK; 20032 const quadPoints = getQuadPoints(params.dict, this.rectangle); 20033 20034 if (quadPoints) { 20035 this.data.quadPoints = quadPoints; 20036 } 20037 20038 _catalog.Catalog.parseDestDictionary({ 20039 destDict: params.dict, 20040 resultObj: this.data, 20041 docBaseUrl: params.pdfManager.docBaseUrl 20042 }); 20043 } 20044 20045} 20046 20047class PopupAnnotation extends Annotation { 20048 constructor(parameters) { 20049 super(parameters); 20050 this.data.annotationType = _util.AnnotationType.POPUP; 20051 let parentItem = parameters.dict.get("Parent"); 20052 20053 if (!parentItem) { 20054 (0, _util.warn)("Popup annotation has a missing or invalid parent annotation."); 20055 return; 20056 } 20057 20058 const parentSubtype = parentItem.get("Subtype"); 20059 this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null; 20060 const rawParent = parameters.dict.getRaw("Parent"); 20061 this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null; 20062 const parentRect = parentItem.getArray("Rect"); 20063 20064 if (Array.isArray(parentRect) && parentRect.length === 4) { 20065 this.data.parentRect = _util.Util.normalizeRect(parentRect); 20066 } else { 20067 this.data.parentRect = [0, 0, 0, 0]; 20068 } 20069 20070 const rt = parentItem.get("RT"); 20071 20072 if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) { 20073 parentItem = parentItem.get("IRT"); 20074 } 20075 20076 if (!parentItem.has("M")) { 20077 this.data.modificationDate = null; 20078 } else { 20079 this.setModificationDate(parentItem.get("M")); 20080 this.data.modificationDate = this.modificationDate; 20081 } 20082 20083 if (!parentItem.has("C")) { 20084 this.data.color = null; 20085 } else { 20086 this.setColor(parentItem.getArray("C")); 20087 this.data.color = this.color; 20088 } 20089 20090 if (!this.viewable) { 20091 const parentFlags = parentItem.get("F"); 20092 20093 if (this._isViewable(parentFlags)) { 20094 this.setFlags(parentFlags); 20095 } 20096 } 20097 20098 this.setTitle(parentItem.get("T")); 20099 this.data.titleObj = this._title; 20100 this.setContents(parentItem.get("Contents")); 20101 this.data.contentsObj = this._contents; 20102 20103 if (parentItem.has("RC")) { 20104 this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC")); 20105 } 20106 } 20107 20108} 20109 20110class FreeTextAnnotation extends MarkupAnnotation { 20111 constructor(parameters) { 20112 super(parameters); 20113 this.data.annotationType = _util.AnnotationType.FREETEXT; 20114 } 20115 20116} 20117 20118class LineAnnotation extends MarkupAnnotation { 20119 constructor(parameters) { 20120 super(parameters); 20121 this.data.annotationType = _util.AnnotationType.LINE; 20122 const lineCoordinates = parameters.dict.getArray("L"); 20123 this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates); 20124 20125 if (!this.appearance) { 20126 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 20127 const strokeAlpha = parameters.dict.get("CA"); 20128 let fillColor = null, 20129 interiorColor = parameters.dict.getArray("IC"); 20130 20131 if (interiorColor) { 20132 interiorColor = getRgbColor(interiorColor, null); 20133 fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null; 20134 } 20135 20136 const fillAlpha = fillColor ? strokeAlpha : null; 20137 const borderWidth = this.borderStyle.width || 1, 20138 borderAdjust = 2 * borderWidth; 20139 const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust]; 20140 20141 if (!_util.Util.intersect(this.rectangle, bbox)) { 20142 this.rectangle = bbox; 20143 } 20144 20145 this._setDefaultAppearance({ 20146 xref: parameters.xref, 20147 extra: `${borderWidth} w`, 20148 strokeColor, 20149 fillColor, 20150 strokeAlpha, 20151 fillAlpha, 20152 pointsCallback: (buffer, points) => { 20153 buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S"); 20154 return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth]; 20155 } 20156 }); 20157 } 20158 } 20159 20160} 20161 20162class SquareAnnotation extends MarkupAnnotation { 20163 constructor(parameters) { 20164 super(parameters); 20165 this.data.annotationType = _util.AnnotationType.SQUARE; 20166 20167 if (!this.appearance) { 20168 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 20169 const strokeAlpha = parameters.dict.get("CA"); 20170 let fillColor = null,
20171 interiorColor = parameters.dict.getArray("IC"); 20172 20173 if (interiorColor) { 20174 interiorColor = getRgbColor(interiorColor, null); 20175 fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null; 20176 } 20177 20178 const fillAlpha = fillColor ? strokeAlpha : null; 20179 20180 if (this.borderStyle.width === 0 && !fillColor) { 20181 return; 20182 } 20183 20184 this._setDefaultAppearance({ 20185 xref: parameters.xref, 20186 extra: `${this.borderStyle.width} w`, 20187 strokeColor, 20188 fillColor, 20189 strokeAlpha, 20190 fillAlpha, 20191 pointsCallback: (buffer, points) => { 20192 const x = points[2].x + this.borderStyle.width / 2; 20193 const y = points[2].y + this.borderStyle.width / 2; 20194 const width = points[3].x - points[2].x - this.borderStyle.width; 20195 const height = points[1].y - points[3].y - this.borderStyle.width; 20196 buffer.push(`${x} ${y} ${width} ${height} re`); 20197 20198 if (fillColor) { 20199 buffer.push("B"); 20200 } else { 20201 buffer.push("S"); 20202 } 20203 20204 return [points[0].x, points[1].x, points[3].y, points[1].y]; 20205 } 20206 }); 20207 } 20208 } 20209 20210} 20211 20212class CircleAnnotation extends MarkupAnnotation { 20213 constructor(parameters) { 20214 super(parameters); 20215 this.data.annotationType = _util.AnnotationType.CIRCLE; 20216 20217 if (!this.appearance) { 20218 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 20219 const strokeAlpha = parameters.dict.get("CA"); 20220 let fillColor = null; 20221 let interiorColor = parameters.dict.getArray("IC"); 20222 20223 if (interiorColor) { 20224 interiorColor = getRgbColor(interiorColor, null); 20225 fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null; 20226 } 20227 20228 const fillAlpha = fillColor ? strokeAlpha : null; 20229 20230 if (this.borderStyle.width === 0 && !fillColor) { 20231 return; 20232 } 20233 20234 const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4)); 20235 20236 this._setDefaultAppearance({ 20237 xref: parameters.xref, 20238 extra: `${this.borderStyle.width} w`, 20239 strokeColor, 20240 fillColor, 20241 strokeAlpha, 20242 fillAlpha, 20243 pointsCallback: (buffer, points) => { 20244 const x0 = points[0].x + this.borderStyle.width / 2; 20245 const y0 = points[0].y - this.borderStyle.width / 2; 20246 const x1 = points[3].x - this.borderStyle.width / 2; 20247 const y1 = points[3].y + this.borderStyle.width / 2; 20248 const xMid = x0 + (x1 - x0) / 2; 20249 const yMid = y0 + (y1 - y0) / 2; 20250 const xOffset = (x1 - x0) / 2 * controlPointsDistance; 20251 const yOffset = (y1 - y0) / 2 * controlPointsDistance; 20252 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"); 20253 20254 if (fillColor) { 20255 buffer.push("B"); 20256 } else { 20257 buffer.push("S"); 20258 } 20259 20260 return [points[0].x, points[1].x, points[3].y, points[1].y]; 20261 } 20262 }); 20263 } 20264 } 20265 20266} 20267 20268class PolylineAnnotation extends MarkupAnnotation { 20269 constructor(parameters) { 20270 super(parameters); 20271 this.data.annotationType = _util.AnnotationType.POLYLINE; 20272 this.data.vertices = []; 20273 const rawVertices = parameters.dict.getArray("Vertices"); 20274 20275 if (!Array.isArray(rawVertices)) { 20276 return; 20277 } 20278 20279 for (let i = 0, ii = rawVertices.length; i < ii; i += 2) { 20280 this.data.vertices.push({ 20281 x: rawVertices[i], 20282 y: rawVertices[i + 1] 20283 }); 20284 } 20285 20286 if (!this.appearance) { 20287 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 20288 const strokeAlpha = parameters.dict.get("CA"); 20289 const borderWidth = this.borderStyle.width || 1, 20290 borderAdjust = 2 * borderWidth; 20291 const bbox = [Infinity, Infinity, -Infinity, -Infinity]; 20292 20293 for (const vertex of this.data.vertices) { 20294 bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust); 20295 bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust); 20296 bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust); 20297 bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust); 20298 } 20299 20300 if (!_util.Util.intersect(this.rectangle, bbox)) { 20301 this.rectangle = bbox; 20302 } 20303 20304 this._setDefaultAppearance({ 20305 xref: parameters.xref, 20306 extra: `${borderWidth} w`, 20307 strokeColor, 20308 strokeAlpha, 20309 pointsCallback: (buffer, points) => { 20310 const vertices = this.data.vertices; 20311 20312 for (let i = 0, ii = vertices.length; i < ii; i++) { 20313 buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`); 20314 } 20315 20316 buffer.push("S"); 20317 return [points[0].x, points[1].x, points[3].y, points[1].y]; 20318 } 20319 }); 20320 } 20321 } 20322 20323} 20324 20325class PolygonAnnotation extends PolylineAnnotation { 20326 constructor(parameters) { 20327 super(parameters); 20328 this.data.annotationType = _util.AnnotationType.POLYGON; 20329 } 20330 20331} 20332 20333class CaretAnnotation extends MarkupAnnotation { 20334 constructor(parameters) { 20335 super(parameters); 20336 this.data.annotationType = _util.AnnotationType.CARET; 20337 } 20338 20339} 20340 20341class InkAnnotation extends MarkupAnnotation { 20342 constructor(parameters) { 20343 super(parameters); 20344 this.data.annotationType = _util.AnnotationType.INK; 20345 this.data.inkLists = []; 20346 const rawInkLists = parameters.dict.getArray("InkList"); 20347 20348 if (!Array.isArray(rawInkLists)) { 20349 return; 20350 } 20351 20352 const xref = parameters.xref; 20353 20354 for (let i = 0, ii = rawInkLists.length; i < ii; ++i) { 20355 this.data.inkLists.push([]); 20356 20357 for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) { 20358 this.data.inkLists[i].push({ 20359 x: xref.fetchIfRef(rawInkLists[i][j]), 20360 y: xref.fetchIfRef(rawInkLists[i][j + 1]) 20361 }); 20362 } 20363 } 20364 20365 if (!this.appearance) { 20366 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 20367 const strokeAlpha = parameters.dict.get("CA"); 20368 const borderWidth = this.borderStyle.width || 1, 20369 borderAdjust = 2 * borderWidth; 20370 const bbox = [Infinity, Infinity, -Infinity, -Infinity]; 20371 20372 for (const inkLists of this.data.inkLists) { 20373 for (const vertex of inkLists) { 20374 bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust); 20375 bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust); 20376 bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust); 20377 bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust); 20378 } 20379 } 20380 20381 if (!_util.Util.intersect(this.rectangle, bbox)) { 20382 this.rectangle = bbox; 20383 } 20384 20385 this._setDefaultAppearance({ 20386 xref: parameters.xref, 20387 extra: `${borderWidth} w`, 20388 strokeColor, 20389 strokeAlpha, 20390 pointsCallback: (buffer, points) => { 20391 for (const inkList of this.data.inkLists) { 20392 for (let i = 0, ii = inkList.length; i < ii; i++) { 20393 buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`); 20394 } 20395 20396 buffer.push("S"); 20397 } 20398 20399 return [points[0].x, points[1].x, points[3].y, points[1].y]; 20400 } 20401 }); 20402 } 20403 } 20404 20405} 20406 20407class HighlightAnnotation extends MarkupAnnotation { 20408 constructor(parameters) { 20409 super(parameters); 20410 this.data.annotationType = _util.AnnotationType.HIGHLIGHT; 20411 const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null); 20412 20413 if (quadPoints) { 20414 const resources = this.appearance && this.appearance.dict.get("Resources"); 20415 20416 if (!this.appearance || !(resources && resources.has("ExtGState"))) { 20417 if (this.appearance) { 20418 (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream."); 20419 } 20420 20421 const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0]; 20422 const fillAlpha = parameters.dict.get("CA"); 20423 20424 this._setDefaultAppearance({ 20425 xref: parameters.xref, 20426 fillColor, 20427 blendMode: "Multiply", 20428 fillAlpha, 20429 pointsCallback: (buffer, points) => { 20430 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"); 20431 return [points[0].x, points[1].x, points[3].y, points[1].y]; 20432 } 20433 }); 20434 } 20435 } else { 20436 this.data.hasPopup = false;
20437 } 20438 } 20439 20440} 20441 20442class UnderlineAnnotation extends MarkupAnnotation { 20443 constructor(parameters) { 20444 super(parameters); 20445 this.data.annotationType = _util.AnnotationType.UNDERLINE; 20446 const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null); 20447 20448 if (quadPoints) { 20449 if (!this.appearance) { 20450 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 20451 const strokeAlpha = parameters.dict.get("CA"); 20452 20453 this._setDefaultAppearance({ 20454 xref: parameters.xref, 20455 extra: "[] 0 d 1 w", 20456 strokeColor, 20457 strokeAlpha, 20458 pointsCallback: (buffer, points) => { 20459 buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S"); 20460 return [points[0].x, points[1].x, points[3].y, points[1].y]; 20461 } 20462 }); 20463 } 20464 } else { 20465 this.data.hasPopup = false; 20466 } 20467 } 20468 20469} 20470 20471class SquigglyAnnotation extends MarkupAnnotation { 20472 constructor(parameters) { 20473 super(parameters); 20474 this.data.annotationType = _util.AnnotationType.SQUIGGLY; 20475 const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null); 20476 20477 if (quadPoints) { 20478 if (!this.appearance) { 20479 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 20480 const strokeAlpha = parameters.dict.get("CA"); 20481 20482 this._setDefaultAppearance({ 20483 xref: parameters.xref, 20484 extra: "[] 0 d 1 w", 20485 strokeColor, 20486 strokeAlpha, 20487 pointsCallback: (buffer, points) => { 20488 const dy = (points[0].y - points[2].y) / 6; 20489 let shift = dy; 20490 let x = points[2].x; 20491 const y = points[2].y; 20492 const xEnd = points[3].x; 20493 buffer.push(`${x} ${y + shift} m`); 20494 20495 do { 20496 x += 2; 20497 shift = shift === 0 ? dy : 0; 20498 buffer.push(`${x} ${y + shift} l`); 20499 } while (x < xEnd); 20500 20501 buffer.push("S"); 20502 return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy]; 20503 } 20504 }); 20505 } 20506 } else { 20507 this.data.hasPopup = false; 20508 } 20509 } 20510 20511} 20512 20513class StrikeOutAnnotation extends MarkupAnnotation { 20514 constructor(parameters) { 20515 super(parameters); 20516 this.data.annotationType = _util.AnnotationType.STRIKEOUT; 20517 const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null); 20518 20519 if (quadPoints) { 20520 if (!this.appearance) { 20521 const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0]; 20522 const strokeAlpha = parameters.dict.get("CA"); 20523 20524 this._setDefaultAppearance({ 20525 xref: parameters.xref, 20526 extra: "[] 0 d 1 w", 20527 strokeColor, 20528 strokeAlpha, 20529 pointsCallback: (buffer, points) => { 20530 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"); 20531 return [points[0].x, points[1].x, points[3].y, points[1].y]; 20532 } 20533 }); 20534 } 20535 } else { 20536 this.data.hasPopup = false; 20537 } 20538 } 20539 20540} 20541 20542class StampAnnotation extends MarkupAnnotation { 20543 constructor(parameters) { 20544 super(parameters); 20545 this.data.annotationType = _util.AnnotationType.STAMP; 20546 } 20547 20548} 20549 20550class FileAttachmentAnnotation extends MarkupAnnotation { 20551 constructor(parameters) { 20552 super(parameters); 20553 const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref); 20554 this.data.annotationType = _util.AnnotationType.FILEATTACHMENT; 20555 this.data.file = file.serializable; 20556 } 20557 20558} 20559 20560/***/ }), 20561/* 23 */ 20562/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 20563 20564 20565 20566Object.defineProperty(exports, "__esModule", ({ 20567 value: true 20568})); 20569exports.createDefaultAppearance = createDefaultAppearance; 20570exports.parseDefaultAppearance = parseDefaultAppearance; 20571 20572var _util = __w_pdfjs_require__(2); 20573 20574var _colorspace = __w_pdfjs_require__(24); 20575 20576var _core_utils = __w_pdfjs_require__(9); 20577 20578var _evaluator = __w_pdfjs_require__(25); 20579 20580var _primitives = __w_pdfjs_require__(5); 20581 20582var _stream = __w_pdfjs_require__(10); 20583 20584class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor { 20585 constructor(str) { 20586 super(new _stream.StringStream(str)); 20587 } 20588 20589 parse() { 20590 const operation = { 20591 fn: 0, 20592 args: [] 20593 }; 20594 const result = { 20595 fontSize: 0, 20596 fontName: "", 20597 fontColor: new Uint8ClampedArray(3) 20598 }; 20599 20600 try { 20601 while (true) { 20602 operation.args.length = 0; 20603 20604 if (!this.read(operation)) { 20605 break; 20606 } 20607 20608 if (this.savedStatesDepth !== 0) { 20609 continue; 20610 } 20611 20612 const { 20613 fn, 20614 args 20615 } = operation; 20616 20617 switch (fn | 0) { 20618 case _util.OPS.setFont: 20619 const [fontName, fontSize] = args; 20620 20621 if (fontName instanceof _primitives.Name) { 20622 result.fontName = fontName.name; 20623 } 20624 20625 if (typeof fontSize === "number" && fontSize > 0) { 20626 result.fontSize = fontSize; 20627 } 20628 20629 break; 20630 20631 case _util.OPS.setFillRGBColor: 20632 _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0); 20633 20634 break; 20635 20636 case _util.OPS.setFillGray: 20637 _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0); 20638 20639 break; 20640 20641 case _util.OPS.setFillColorSpace: 20642 _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0); 20643 20644 break; 20645 } 20646 } 20647 } catch (reason) { 20648 (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`); 20649 } 20650 20651 return result; 20652 } 20653 20654} 20655 20656function parseDefaultAppearance(str) { 20657 return new DefaultAppearanceEvaluator(str).parse(); 20658} 20659 20660function createDefaultAppearance({ 20661 fontSize, 20662 fontName, 20663 fontColor 20664}) { 20665 let colorCmd; 20666 20667 if (fontColor.every(c => c === 0)) { 20668 colorCmd = "0 g"; 20669 } else { 20670 colorCmd = Array.from(fontColor).map(c => (c / 255).toFixed(2)).join(" ") + " rg"; 20671 } 20672 20673 return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${colorCmd}`; 20674} 20675 20676/***/ }), 20677/* 24 */ 20678/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 20679 20680 20681 20682Object.defineProperty(exports, "__esModule", ({ 20683 value: true 20684})); 20685exports.ColorSpace = void 0; 20686 20687var _util = __w_pdfjs_require__(2); 20688 20689var _primitives = __w_pdfjs_require__(5); 20690 20691var _core_utils = __w_pdfjs_require__(9); 20692 20693function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) { 20694 const COMPONENTS = 3; 20695 alpha01 = alpha01 !== 1 ? 0 : alpha01; 20696 const xRatio = w1 / w2;
20697 const yRatio = h1 / h2; 20698 let newIndex = 0, 20699 oldIndex; 20700 const xScaled = new Uint16Array(w2); 20701 const w1Scanline = w1 * COMPONENTS; 20702 20703 for (let i = 0; i < w2; i++) { 20704 xScaled[i] = Math.floor(i * xRatio) * COMPONENTS; 20705 } 20706 20707 for (let i = 0; i < h2; i++) { 20708 const py = Math.floor(i * yRatio) * w1Scanline; 20709 20710 for (let j = 0; j < w2; j++) { 20711 oldIndex = py + xScaled[j]; 20712 dest[newIndex++] = src[oldIndex++]; 20713 dest[newIndex++] = src[oldIndex++]; 20714 dest[newIndex++] = src[oldIndex++]; 20715 newIndex += alpha01; 20716 } 20717 } 20718} 20719 20720class ColorSpace { 20721 constructor(name, numComps) { 20722 if (this.constructor === ColorSpace) { 20723 (0, _util.unreachable)("Cannot initialize ColorSpace."); 20724 } 20725 20726 this.name = name; 20727 this.numComps = numComps; 20728 } 20729 20730 getRgb(src, srcOffset) { 20731 const rgb = new Uint8ClampedArray(3); 20732 this.getRgbItem(src, srcOffset, rgb, 0); 20733 return rgb; 20734 } 20735 20736 getRgbItem(src, srcOffset, dest, destOffset) { 20737 (0, _util.unreachable)("Should not call ColorSpace.getRgbItem"); 20738 } 20739 20740 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 20741 (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer"); 20742 } 20743 20744 getOutputLength(inputLength, alpha01) { 20745 (0, _util.unreachable)("Should not call ColorSpace.getOutputLength"); 20746 } 20747 20748 isPassthrough(bits) { 20749 return false; 20750 } 20751 20752 isDefaultDecode(decodeMap, bpc) { 20753 return ColorSpace.isDefaultDecode(decodeMap, this.numComps); 20754 } 20755 20756 fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) { 20757 const count = originalWidth * originalHeight; 20758 let rgbBuf = null; 20759 const numComponentColors = 1 << bpc; 20760 const needsResizing = originalHeight !== height || originalWidth !== width; 20761 20762 if (this.isPassthrough(bpc)) { 20763 rgbBuf = comps; 20764 } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") { 20765 const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors); 20766 20767 for (let i = 0; i < numComponentColors; i++) { 20768 allColors[i] = i; 20769 } 20770 20771 const colorMap = new Uint8ClampedArray(numComponentColors * 3); 20772 this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0); 20773 20774 if (!needsResizing) { 20775 let destPos = 0; 20776 20777 for (let i = 0; i < count; ++i) { 20778 const key = comps[i] * 3; 20779 dest[destPos++] = colorMap[key]; 20780 dest[destPos++] = colorMap[key + 1]; 20781 dest[destPos++] = colorMap[key + 2]; 20782 destPos += alpha01; 20783 } 20784 } else { 20785 rgbBuf = new Uint8Array(count * 3); 20786 let rgbPos = 0; 20787 20788 for (let i = 0; i < count; ++i) { 20789 const key = comps[i] * 3; 20790 rgbBuf[rgbPos++] = colorMap[key]; 20791 rgbBuf[rgbPos++] = colorMap[key + 1]; 20792 rgbBuf[rgbPos++] = colorMap[key + 2]; 20793 } 20794 } 20795 } else { 20796 if (!needsResizing) { 20797 this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01); 20798 } else { 20799 rgbBuf = new Uint8ClampedArray(count * 3); 20800 this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0); 20801 } 20802 } 20803 20804 if (rgbBuf) { 20805 if (needsResizing) { 20806 resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01); 20807 } else { 20808 let destPos = 0, 20809 rgbPos = 0; 20810 20811 for (let i = 0, ii = width * actualHeight; i < ii; i++) { 20812 dest[destPos++] = rgbBuf[rgbPos++]; 20813 dest[destPos++] = rgbBuf[rgbPos++]; 20814 dest[destPos++] = rgbBuf[rgbPos++]; 20815 destPos += alpha01; 20816 } 20817 } 20818 } 20819 } 20820 20821 get usesZeroToOneRange() { 20822 return (0, _util.shadow)(this, "usesZeroToOneRange", true); 20823 } 20824 20825 static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) { 20826 if (!localColorSpaceCache) { 20827 throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.'); 20828 } 20829 20830 if (!parsedColorSpace) { 20831 throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.'); 20832 } 20833 20834 let csName, csRef; 20835 20836 if (cacheKey instanceof _primitives.Ref) { 20837 csRef = cacheKey; 20838 cacheKey = xref.fetch(cacheKey); 20839 } 20840 20841 if (cacheKey instanceof _primitives.Name) { 20842 csName = cacheKey.name; 20843 } 20844 20845 if (csName || csRef) { 20846 localColorSpaceCache.set(csName, csRef, parsedColorSpace); 20847 } 20848 } 20849 20850 static getCached(cacheKey, xref, localColorSpaceCache) { 20851 if (!localColorSpaceCache) { 20852 throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.'); 20853 } 20854 20855 if (cacheKey instanceof _primitives.Ref) { 20856 const localColorSpace = localColorSpaceCache.getByRef(cacheKey); 20857 20858 if (localColorSpace) { 20859 return localColorSpace; 20860 } 20861
20862 try { 20863 cacheKey = xref.fetch(cacheKey); 20864 } catch (ex) { 20865 if (ex instanceof _core_utils.MissingDataException) { 20866 throw ex; 20867 } 20868 } 20869 } 20870 20871 if (cacheKey instanceof _primitives.Name) { 20872 const localColorSpace = localColorSpaceCache.getByName(cacheKey.name); 20873 20874 if (localColorSpace) { 20875 return localColorSpace; 20876 } 20877 } 20878 20879 return null; 20880 } 20881 20882 static async parseAsync({ 20883 cs, 20884 xref, 20885 resources = null, 20886 pdfFunctionFactory, 20887 localColorSpaceCache 20888 }) { 20889 const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory); 20890 20891 this._cache(cs, xref, localColorSpaceCache, parsedColorSpace); 20892 20893 return parsedColorSpace; 20894 } 20895 20896 static parse({ 20897 cs, 20898 xref, 20899 resources = null, 20900 pdfFunctionFactory, 20901 localColorSpaceCache 20902 }) { 20903 const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache); 20904 20905 if (cachedColorSpace) { 20906 return cachedColorSpace; 20907 } 20908 20909 const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory); 20910 20911 this._cache(cs, xref, localColorSpaceCache, parsedColorSpace); 20912 20913 return parsedColorSpace; 20914 } 20915 20916 static _parse(cs, xref, resources = null, pdfFunctionFactory) { 20917 cs = xref.fetchIfRef(cs); 20918 20919 if ((0, _primitives.isName)(cs)) { 20920 switch (cs.name) { 20921 case "G": 20922 case "DeviceGray": 20923 return this.singletons.gray; 20924 20925 case "RGB": 20926 case "DeviceRGB": 20927 return this.singletons.rgb; 20928 20929 case "CMYK": 20930 case "DeviceCMYK": 20931 return this.singletons.cmyk; 20932 20933 case "Pattern": 20934 return new PatternCS(null); 20935 20936 default: 20937 if ((0, _primitives.isDict)(resources)) { 20938 const colorSpaces = resources.get("ColorSpace"); 20939 20940 if ((0, _primitives.isDict)(colorSpaces)) { 20941 const resourcesCS = colorSpaces.get(cs.name); 20942 20943 if (resourcesCS) { 20944 if ((0, _primitives.isName)(resourcesCS)) { 20945 return this._parse(resourcesCS, xref, resources, pdfFunctionFactory); 20946 } 20947 20948 cs = resourcesCS; 20949 break; 20950 } 20951 } 20952 } 20953 20954 throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`); 20955 } 20956 } 20957 20958 if (Array.isArray(cs)) { 20959 const mode = xref.fetchIfRef(cs[0]).name; 20960 let params, numComps, baseCS, whitePoint, blackPoint, gamma; 20961 20962 switch (mode) { 20963 case "G": 20964 case "DeviceGray": 20965 return this.singletons.gray; 20966 20967 case "RGB": 20968 case "DeviceRGB": 20969 return this.singletons.rgb; 20970 20971 case "CMYK": 20972 case "DeviceCMYK": 20973 return this.singletons.cmyk; 20974 20975 case "CalGray": 20976 params = xref.fetchIfRef(cs[1]); 20977 whitePoint = params.getArray("WhitePoint"); 20978 blackPoint = params.getArray("BlackPoint"); 20979 gamma = params.get("Gamma"); 20980 return new CalGrayCS(whitePoint, blackPoint, gamma); 20981 20982 case "CalRGB": 20983 params = xref.fetchIfRef(cs[1]); 20984 whitePoint = params.getArray("WhitePoint"); 20985 blackPoint = params.getArray("BlackPoint"); 20986 gamma = params.getArray("Gamma"); 20987 const matrix = params.getArray("Matrix"); 20988 return new CalRGBCS(whitePoint, blackPoint, gamma, matrix); 20989 20990 case "ICCBased": 20991 const stream = xref.fetchIfRef(cs[1]); 20992 const dict = stream.dict; 20993 numComps = dict.get("N"); 20994 const alt = dict.get("Alternate"); 20995 20996 if (alt) { 20997 const altCS = this._parse(alt, xref, resources, pdfFunctionFactory); 20998 20999 if (altCS.numComps === numComps) { 21000 return altCS; 21001 } 21002 21003 (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry."); 21004 } 21005 21006 if (numComps === 1) { 21007 return this.singletons.gray; 21008 } else if (numComps === 3) { 21009 return this.singletons.rgb; 21010 } else if (numComps === 4) { 21011 return this.singletons.cmyk; 21012 } 21013 21014 break; 21015 21016 case "Pattern": 21017 baseCS = cs[1] || null; 21018 21019 if (baseCS) { 21020 baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory); 21021 } 21022 21023 return new PatternCS(baseCS); 21024 21025 case "I": 21026 case "Indexed": 21027 baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory); 21028 const hiVal = xref.fetchIfRef(cs[2]) + 1; 21029 const lookup = xref.fetchIfRef(cs[3]); 21030 return new IndexedCS(baseCS, hiVal, lookup); 21031 21032 case "Separation": 21033 case "DeviceN": 21034 const name = xref.fetchIfRef(cs[1]); 21035 numComps = Array.isArray(name) ? name.length : 1; 21036 baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory); 21037 const tintFn = pdfFunctionFactory.create(cs[3]); 21038 return new AlternateCS(numComps, baseCS, tintFn); 21039 21040 case "Lab": 21041 params = xref.fetchIfRef(cs[1]); 21042 whitePoint = params.getArray("WhitePoint"); 21043 blackPoint = params.getArray("BlackPoint"); 21044 const range = params.getArray("Range");
21045 return new LabCS(whitePoint, blackPoint, range); 21046 21047 default: 21048 throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`); 21049 } 21050 } 21051 21052 throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`); 21053 } 21054 21055 static isDefaultDecode(decode, numComps) { 21056 if (!Array.isArray(decode)) { 21057 return true; 21058 } 21059 21060 if (numComps * 2 !== decode.length) { 21061 (0, _util.warn)("The decode map is not the correct length"); 21062 return true; 21063 } 21064 21065 for (let i = 0, ii = decode.length; i < ii; i += 2) { 21066 if (decode[i] !== 0 || decode[i + 1] !== 1) { 21067 return false; 21068 } 21069 } 21070 21071 return true; 21072 } 21073 21074 static get singletons() { 21075 return (0, _util.shadow)(this, "singletons", { 21076 get gray() { 21077 return (0, _util.shadow)(this, "gray", new DeviceGrayCS()); 21078 }, 21079 21080 get rgb() { 21081 return (0, _util.shadow)(this, "rgb", new DeviceRgbCS()); 21082 }, 21083 21084 get cmyk() { 21085 return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS()); 21086 } 21087 21088 }); 21089 } 21090 21091} 21092 21093exports.ColorSpace = ColorSpace; 21094 21095class AlternateCS extends ColorSpace { 21096 constructor(numComps, base, tintFn) { 21097 super("Alternate", numComps); 21098 this.base = base; 21099 this.tintFn = tintFn; 21100 this.tmpBuf = new Float32Array(base.numComps); 21101 } 21102 21103 getRgbItem(src, srcOffset, dest, destOffset) { 21104 const tmpBuf = this.tmpBuf; 21105 this.tintFn(src, srcOffset, tmpBuf, 0); 21106 this.base.getRgbItem(tmpBuf, 0, dest, destOffset); 21107 } 21108 21109 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 21110 const tintFn = this.tintFn; 21111 const base = this.base; 21112 const scale = 1 / ((1 << bits) - 1); 21113 const baseNumComps = base.numComps; 21114 const usesZeroToOneRange = base.usesZeroToOneRange; 21115 const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0; 21116 let pos = isPassthrough ? destOffset : 0; 21117 const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count); 21118 const numComps = this.numComps; 21119 const scaled = new Float32Array(numComps); 21120 const tinted = new Float32Array(baseNumComps); 21121 let i, j; 21122 21123 for (i = 0; i < count; i++) { 21124 for (j = 0; j < numComps; j++) { 21125 scaled[j] = src[srcOffset++] * scale; 21126 } 21127 21128 tintFn(scaled, 0, tinted, 0); 21129 21130 if (usesZeroToOneRange) { 21131 for (j = 0; j < baseNumComps; j++) { 21132 baseBuf[pos++] = tinted[j] * 255; 21133 } 21134 } else { 21135 base.getRgbItem(tinted, 0, baseBuf, pos); 21136 pos += baseNumComps; 21137 } 21138 } 21139 21140 if (!isPassthrough) { 21141 base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01); 21142 } 21143 } 21144 21145 getOutputLength(inputLength, alpha01) { 21146 return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01); 21147 } 21148 21149} 21150 21151class PatternCS extends ColorSpace { 21152 constructor(baseCS) { 21153 super("Pattern", null); 21154 this.base = baseCS; 21155 } 21156 21157 isDefaultDecode(decodeMap, bpc) { 21158 (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode"); 21159 } 21160 21161} 21162 21163class IndexedCS extends ColorSpace { 21164 constructor(base, highVal, lookup) { 21165 super("Indexed", 1); 21166 this.base = base; 21167 this.highVal = highVal; 21168 const length = base.numComps * highVal; 21169 this.lookup = new Uint8Array(length); 21170 21171 if ((0, _primitives.isStream)(lookup)) { 21172 const bytes = lookup.getBytes(length); 21173 this.lookup.set(bytes); 21174 } else if (typeof lookup === "string") { 21175 for (let i = 0; i < length; ++i) { 21176 this.lookup[i] = lookup.charCodeAt(i) & 0xff; 21177 } 21178 } else { 21179 throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`); 21180 } 21181 } 21182 21183 getRgbItem(src, srcOffset, dest, destOffset) { 21184 const numComps = this.base.numComps; 21185 const start = src[srcOffset] * numComps; 21186 this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0); 21187 } 21188 21189 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 21190 const base = this.base; 21191 const numComps = base.numComps; 21192 const outputDelta = base.getOutputLength(numComps, alpha01); 21193 const lookup = this.lookup; 21194 21195 for (let i = 0; i < count; ++i) {
vendor: 4,153 bytes, lines 21196-21318
21196 const lookupPos = src[srcOffset++] * numComps; 21197 base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01); 21198 destOffset += outputDelta; 21199 } 21200 } 21201 21202 getOutputLength(inputLength, alpha01) { 21203 return this.base.getOutputLength(inputLength * this.base.numComps, alpha01); 21204 } 21205 21206 isDefaultDecode(decodeMap, bpc) { 21207 if (!Array.isArray(decodeMap)) { 21208 return true; 21209 } 21210 21211 if (decodeMap.length !== 2) { 21212 (0, _util.warn)("Decode map length is not correct"); 21213 return true; 21214 } 21215 21216 if (!Number.isInteger(bpc) || bpc < 1) { 21217 (0, _util.warn)("Bits per component is not correct"); 21218 return true; 21219 } 21220 21221 return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1; 21222 } 21223 21224} 21225 21226class DeviceGrayCS extends ColorSpace { 21227 constructor() { 21228 super("DeviceGray", 1); 21229 } 21230 21231 getRgbItem(src, srcOffset, dest, destOffset) { 21232 const c = src[srcOffset] * 255; 21233 dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c; 21234 } 21235 21236 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 21237 const scale = 255 / ((1 << bits) - 1); 21238 let j = srcOffset, 21239 q = destOffset; 21240 21241 for (let i = 0; i < count; ++i) { 21242 const c = scale * src[j++]; 21243 dest[q++] = c; 21244 dest[q++] = c; 21245 dest[q++] = c; 21246 q += alpha01; 21247 } 21248 } 21249 21250 getOutputLength(inputLength, alpha01) { 21251 return inputLength * (3 + alpha01); 21252 } 21253 21254} 21255 21256class DeviceRgbCS extends ColorSpace { 21257 constructor() { 21258 super("DeviceRGB", 3); 21259 } 21260 21261 getRgbItem(src, srcOffset, dest, destOffset) { 21262 dest[destOffset] = src[srcOffset] * 255; 21263 dest[destOffset + 1] = src[srcOffset + 1] * 255; 21264 dest[destOffset + 2] = src[srcOffset + 2] * 255; 21265 } 21266 21267 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 21268 if (bits === 8 && alpha01 === 0) { 21269 dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset); 21270 return; 21271 } 21272 21273 const scale = 255 / ((1 << bits) - 1); 21274 let j = srcOffset, 21275 q = destOffset; 21276 21277 for (let i = 0; i < count; ++i) { 21278 dest[q++] = scale * src[j++]; 21279 dest[q++] = scale * src[j++]; 21280 dest[q++] = scale * src[j++]; 21281 q += alpha01; 21282 } 21283 } 21284 21285 getOutputLength(inputLength, alpha01) { 21286 return inputLength * (3 + alpha01) / 3 | 0; 21287 } 21288 21289 isPassthrough(bits) { 21290 return bits === 8; 21291 } 21292 21293} 21294 21295const DeviceCmykCS = function DeviceCmykCSClosure() { 21296 function convertToRgb(src, srcOffset, srcScale, dest, destOffset) { 21297 const c = src[srcOffset] * srcScale; 21298 const m = src[srcOffset + 1] * srcScale; 21299 const y = src[srcOffset + 2] * srcScale; 21300 const k = src[srcOffset + 3] * srcScale; 21301 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); 21302 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); 21303 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); 21304 } 21305 21306 class DeviceCmykCS extends ColorSpace { 21307 constructor() { 21308 super("DeviceCMYK", 4); 21309 } 21310 21311 getRgbItem(src, srcOffset, dest, destOffset) { 21312 convertToRgb(src, srcOffset, 1, dest, destOffset); 21313 } 21314 21315 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 21316 const scale = 1 / ((1 << bits) - 1); 21317 21318 for (let i = 0; i < count; i++) {
21319 convertToRgb(src, srcOffset, scale, dest, destOffset); 21320 srcOffset += 4; 21321 destOffset += 3 + alpha01; 21322 } 21323 } 21324 21325 getOutputLength(inputLength, alpha01) { 21326 return inputLength / 4 * (3 + alpha01) | 0; 21327 } 21328 21329 } 21330 21331 return DeviceCmykCS; 21332}(); 21333 21334const CalGrayCS = function CalGrayCSClosure() { 21335 function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { 21336 const A = src[srcOffset] * scale; 21337 const AG = A ** cs.G; 21338 const L = cs.YW * AG; 21339 const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0); 21340 dest[destOffset] = val; 21341 dest[destOffset + 1] = val; 21342 dest[destOffset + 2] = val; 21343 } 21344 21345 class CalGrayCS extends ColorSpace { 21346 constructor(whitePoint, blackPoint, gamma) { 21347 super("CalGray", 1); 21348 21349 if (!whitePoint) { 21350 throw new _util.FormatError("WhitePoint missing - required for color space CalGray"); 21351 } 21352 21353 blackPoint = blackPoint || [0, 0, 0]; 21354 gamma = gamma || 1; 21355 this.XW = whitePoint[0]; 21356 this.YW = whitePoint[1]; 21357 this.ZW = whitePoint[2]; 21358 this.XB = blackPoint[0]; 21359 this.YB = blackPoint[1]; 21360 this.ZB = blackPoint[2]; 21361 this.G = gamma; 21362 21363 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 21364 throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available"); 21365 } 21366 21367 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 21368 (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`); 21369 this.XB = this.YB = this.ZB = 0; 21370 } 21371 21372 if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) { 21373 (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`); 21374 } 21375 21376 if (this.G < 1) { 21377 (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default."); 21378 this.G = 1; 21379 } 21380 } 21381 21382 getRgbItem(src, srcOffset, dest, destOffset) { 21383 convertToRgb(this, src, srcOffset, dest, destOffset, 1); 21384 } 21385 21386 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 21387 const scale = 1 / ((1 << bits) - 1); 21388 21389 for (let i = 0; i < count; ++i) { 21390 convertToRgb(this, src, srcOffset, dest, destOffset, scale); 21391 srcOffset += 1; 21392 destOffset += 3 + alpha01; 21393 } 21394 } 21395 21396 getOutputLength(inputLength, alpha01) { 21397 return inputLength * (3 + alpha01); 21398 } 21399 21400 } 21401 21402 return CalGrayCS; 21403}(); 21404 21405const CalRGBCS = function CalRGBCSClosure() { 21406 const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]); 21407 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]); 21408 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]); 21409 const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]); 21410 const tempNormalizeMatrix = new Float32Array(3); 21411 const tempConvertMatrix1 = new Float32Array(3); 21412 const tempConvertMatrix2 = new Float32Array(3); 21413 const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0; 21414 21415 function matrixProduct(a, b, result) { 21416 result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; 21417 result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2]; 21418 result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2]; 21419 } 21420 21421 function convertToFlat(sourceWhitePoint, LMS, result) { 21422 result[0] = LMS[0] * 1 / sourceWhitePoint[0]; 21423 result[1] = LMS[1] * 1 / sourceWhitePoint[1]; 21424 result[2] = LMS[2] * 1 / sourceWhitePoint[2]; 21425 } 21426 21427 function convertToD65(sourceWhitePoint, LMS, result) { 21428 const D65X = 0.95047; 21429 const D65Y = 1; 21430 const D65Z = 1.08883; 21431 result[0] = LMS[0] * D65X / sourceWhitePoint[0]; 21432 result[1] = LMS[1] * D65Y / sourceWhitePoint[1]; 21433 result[2] = LMS[2] * D65Z / sourceWhitePoint[2]; 21434 } 21435 21436 function sRGBTransferFunction(color) { 21437 if (color <= 0.0031308) { 21438 return adjustToRange(0, 1, 12.92 * color); 21439 } 21440 21441 if (color >= 0.99554525) { 21442 return 1; 21443 } 21444 21445 return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055); 21446 } 21447 21448 function adjustToRange(min, max, value) { 21449 return Math.max(min, Math.min(max, value)); 21450 } 21451 21452 function decodeL(L) { 21453 if (L < 0) { 21454 return -decodeL(-L); 21455 } 21456 21457 if (L > 8.0) { 21458 return ((L + 16) / 116) ** 3; 21459 } 21460 21461 return L * DECODE_L_CONSTANT;
21462 } 21463 21464 function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) { 21465 if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) { 21466 result[0] = XYZ_Flat[0]; 21467 result[1] = XYZ_Flat[1]; 21468 result[2] = XYZ_Flat[2]; 21469 return; 21470 } 21471 21472 const zeroDecodeL = decodeL(0); 21473 const X_DST = zeroDecodeL; 21474 const X_SRC = decodeL(sourceBlackPoint[0]); 21475 const Y_DST = zeroDecodeL; 21476 const Y_SRC = decodeL(sourceBlackPoint[1]); 21477 const Z_DST = zeroDecodeL; 21478 const Z_SRC = decodeL(sourceBlackPoint[2]); 21479 const X_Scale = (1 - X_DST) / (1 - X_SRC); 21480 const X_Offset = 1 - X_Scale; 21481 const Y_Scale = (1 - Y_DST) / (1 - Y_SRC); 21482 const Y_Offset = 1 - Y_Scale; 21483 const Z_Scale = (1 - Z_DST) / (1 - Z_SRC); 21484 const Z_Offset = 1 - Z_Scale; 21485 result[0] = XYZ_Flat[0] * X_Scale + X_Offset; 21486 result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset; 21487 result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset; 21488 } 21489 21490 function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) { 21491 if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) { 21492 result[0] = XYZ_In[0]; 21493 result[1] = XYZ_In[1]; 21494 result[2] = XYZ_In[2]; 21495 return; 21496 } 21497 21498 const LMS = result; 21499 matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 21500 const LMS_Flat = tempNormalizeMatrix; 21501 convertToFlat(sourceWhitePoint, LMS, LMS_Flat); 21502 matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result); 21503 } 21504 21505 function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) { 21506 const LMS = result; 21507 matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 21508 const LMS_D65 = tempNormalizeMatrix; 21509 convertToD65(sourceWhitePoint, LMS, LMS_D65); 21510 matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result); 21511 } 21512 21513 function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { 21514 const A = adjustToRange(0, 1, src[srcOffset] * scale); 21515 const B = adjustToRange(0, 1, src[srcOffset + 1] * scale); 21516 const C = adjustToRange(0, 1, src[srcOffset + 2] * scale); 21517 const AGR = A === 1 ? 1 : A ** cs.GR; 21518 const BGG = B === 1 ? 1 : B ** cs.GG; 21519 const CGB = C === 1 ? 1 : C ** cs.GB; 21520 const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB; 21521 const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB; 21522 const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB; 21523 const XYZ = tempConvertMatrix1; 21524 XYZ[0] = X; 21525 XYZ[1] = Y; 21526 XYZ[2] = Z; 21527 const XYZ_Flat = tempConvertMatrix2; 21528 normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat); 21529 const XYZ_Black = tempConvertMatrix1; 21530 compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black); 21531 const XYZ_D65 = tempConvertMatrix2; 21532 normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65); 21533 const SRGB = tempConvertMatrix1; 21534 matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB); 21535 dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255; 21536 dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255; 21537 dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255; 21538 } 21539 21540 class CalRGBCS extends ColorSpace { 21541 constructor(whitePoint, blackPoint, gamma, matrix) { 21542 super("CalRGB", 3); 21543 21544 if (!whitePoint) { 21545 throw new _util.FormatError("WhitePoint missing - required for color space CalRGB"); 21546 } 21547 21548 blackPoint = blackPoint || new Float32Array(3); 21549 gamma = gamma || new Float32Array([1, 1, 1]); 21550 matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]); 21551 const XW = whitePoint[0]; 21552 const YW = whitePoint[1]; 21553 const ZW = whitePoint[2]; 21554 this.whitePoint = whitePoint; 21555 const XB = blackPoint[0]; 21556 const YB = blackPoint[1]; 21557 const ZB = blackPoint[2]; 21558 this.blackPoint = blackPoint; 21559 this.GR = gamma[0]; 21560 this.GG = gamma[1]; 21561 this.GB = gamma[2]; 21562 this.MXA = matrix[0]; 21563 this.MYA = matrix[1]; 21564 this.MZA = matrix[2]; 21565 this.MXB = matrix[3]; 21566 this.MYB = matrix[4]; 21567 this.MZB = matrix[5]; 21568 this.MXC = matrix[6]; 21569 this.MYC = matrix[7]; 21570 this.MZC = matrix[8]; 21571 21572 if (XW < 0 || ZW < 0 || YW !== 1) { 21573 throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available"); 21574 } 21575 21576 if (XB < 0 || YB < 0 || ZB < 0) { 21577 (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default."); 21578 this.blackPoint = new Float32Array(3); 21579 } 21580 21581 if (this.GR < 0 || this.GG < 0 || this.GB < 0) { 21582 (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`); 21583 this.GR = this.GG = this.GB = 1; 21584 } 21585 } 21586
21587 getRgbItem(src, srcOffset, dest, destOffset) { 21588 convertToRgb(this, src, srcOffset, dest, destOffset, 1); 21589 } 21590 21591 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 21592 const scale = 1 / ((1 << bits) - 1); 21593 21594 for (let i = 0; i < count; ++i) { 21595 convertToRgb(this, src, srcOffset, dest, destOffset, scale); 21596 srcOffset += 3; 21597 destOffset += 3 + alpha01; 21598 } 21599 } 21600 21601 getOutputLength(inputLength, alpha01) { 21602 return inputLength * (3 + alpha01) / 3 | 0; 21603 } 21604 21605 } 21606 21607 return CalRGBCS; 21608}(); 21609 21610const LabCS = function LabCSClosure() { 21611 function fn_g(x) { 21612 let result; 21613 21614 if (x >= 6 / 29) { 21615 result = x ** 3; 21616 } else { 21617 result = 108 / 841 * (x - 4 / 29); 21618 } 21619 21620 return result; 21621 } 21622 21623 function decode(value, high1, low2, high2) { 21624 return low2 + value * (high2 - low2) / high1; 21625 } 21626 21627 function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) { 21628 let Ls = src[srcOffset]; 21629 let as = src[srcOffset + 1]; 21630 let bs = src[srcOffset + 2]; 21631 21632 if (maxVal !== false) { 21633 Ls = decode(Ls, maxVal, 0, 100); 21634 as = decode(as, maxVal, cs.amin, cs.amax); 21635 bs = decode(bs, maxVal, cs.bmin, cs.bmax); 21636 } 21637 21638 if (as > cs.amax) { 21639 as = cs.amax; 21640 } else if (as < cs.amin) { 21641 as = cs.amin; 21642 } 21643 21644 if (bs > cs.bmax) { 21645 bs = cs.bmax; 21646 } else if (bs < cs.bmin) { 21647 bs = cs.bmin; 21648 } 21649 21650 const M = (Ls + 16) / 116; 21651 const L = M + as / 500; 21652 const N = M - bs / 200; 21653 const X = cs.XW * fn_g(L); 21654 const Y = cs.YW * fn_g(M); 21655 const Z = cs.ZW * fn_g(N); 21656 let r, g, b; 21657 21658 if (cs.ZW < 1) { 21659 r = X * 3.1339 + Y * -1.617 + Z * -0.4906; 21660 g = X * -0.9785 + Y * 1.916 + Z * 0.0333; 21661 b = X * 0.072 + Y * -0.229 + Z * 1.4057; 21662 } else { 21663 r = X * 3.2406 + Y * -1.5372 + Z * -0.4986; 21664 g = X * -0.9689 + Y * 1.8758 + Z * 0.0415; 21665 b = X * 0.0557 + Y * -0.204 + Z * 1.057; 21666 } 21667 21668 dest[destOffset] = Math.sqrt(r) * 255; 21669 dest[destOffset + 1] = Math.sqrt(g) * 255; 21670 dest[destOffset + 2] = Math.sqrt(b) * 255; 21671 } 21672 21673 class LabCS extends ColorSpace { 21674 constructor(whitePoint, blackPoint, range) { 21675 super("Lab", 3); 21676 21677 if (!whitePoint) { 21678 throw new _util.FormatError("WhitePoint missing - required for color space Lab"); 21679 } 21680 21681 blackPoint = blackPoint || [0, 0, 0]; 21682 range = range || [-100, 100, -100, 100]; 21683 this.XW = whitePoint[0]; 21684 this.YW = whitePoint[1]; 21685 this.ZW = whitePoint[2]; 21686 this.amin = range[0]; 21687 this.amax = range[1]; 21688 this.bmin = range[2]; 21689 this.bmax = range[3]; 21690 this.XB = blackPoint[0]; 21691 this.YB = blackPoint[1]; 21692 this.ZB = blackPoint[2]; 21693 21694 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 21695 throw new _util.FormatError("Invalid WhitePoint components, no fallback available"); 21696 } 21697 21698 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 21699 (0, _util.info)("Invalid BlackPoint, falling back to default"); 21700 this.XB = this.YB = this.ZB = 0; 21701 } 21702 21703 if (this.amin > this.amax || this.bmin > this.bmax) { 21704 (0, _util.info)("Invalid Range, falling back to defaults"); 21705 this.amin = -100; 21706 this.amax = 100; 21707 this.bmin = -100; 21708 this.bmax = 100; 21709 } 21710 } 21711 21712 getRgbItem(src, srcOffset, dest, destOffset) { 21713 convertToRgb(this, src, srcOffset, false, dest, destOffset); 21714 } 21715 21716 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 21717 const maxVal = (1 << bits) - 1; 21718 21719 for (let i = 0; i < count; i++) { 21720 convertToRgb(this, src, srcOffset, maxVal, dest, destOffset); 21721 srcOffset += 3; 21722 destOffset += 3 + alpha01; 21723 } 21724 } 21725 21726 getOutputLength(inputLength, alpha01) { 21727 return inputLength * (3 + alpha01) / 3 | 0; 21728 } 21729 21730 isDefaultDecode(decodeMap, bpc) { 21731 return true; 21732 } 21733 21734 get usesZeroToOneRange() { 21735 return (0, _util.shadow)(this, "usesZeroToOneRange", false); 21736 } 21737 21738 } 21739 21740 return LabCS; 21741}(); 21742 21743/***/ }), 21744/* 25 */ 21745/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 21746 21747 21748 21749Object.defineProperty(exports, "__esModule", ({ 21750 value: true 21751}));
21752exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0; 21753 21754var _util = __w_pdfjs_require__(2); 21755 21756var _cmap = __w_pdfjs_require__(26); 21757 21758var _primitives = __w_pdfjs_require__(5); 21759 21760var _fonts = __w_pdfjs_require__(44); 21761 21762var _fonts_utils = __w_pdfjs_require__(18); 21763 21764var _encodings = __w_pdfjs_require__(19); 21765 21766var _standard_fonts = __w_pdfjs_require__(47); 21767 21768var _unicode = __w_pdfjs_require__(21); 21769 21770var _pattern = __w_pdfjs_require__(55); 21771 21772var _xfa_fonts = __w_pdfjs_require__(12); 21773 21774var _to_unicode_map = __w_pdfjs_require__(48); 21775 21776var _function = __w_pdfjs_require__(56); 21777 21778var _parser = __w_pdfjs_require__(27); 21779 21780var _image_utils = __w_pdfjs_require__(58); 21781 21782var _stream = __w_pdfjs_require__(10); 21783 21784var _base_stream = __w_pdfjs_require__(6); 21785 21786var _bidi = __w_pdfjs_require__(59); 21787 21788var _colorspace = __w_pdfjs_require__(24); 21789 21790var _decode_stream = __w_pdfjs_require__(29); 21791 21792var _glyphlist = __w_pdfjs_require__(20); 21793 21794var _core_utils = __w_pdfjs_require__(9); 21795 21796var _metrics = __w_pdfjs_require__(60); 21797 21798var _murmurhash = __w_pdfjs_require__(61); 21799 21800var _operator_list = __w_pdfjs_require__(62); 21801 21802var _image = __w_pdfjs_require__(63); 21803 21804const DefaultPartialEvaluatorOptions = Object.freeze({ 21805 maxImageSize: -1, 21806 disableFontFace: false, 21807 ignoreErrors: false, 21808 isEvalSupported: true, 21809 fontExtraProperties: false, 21810 useSystemFonts: true, 21811 cMapUrl: null, 21812 standardFontDataUrl: null 21813}); 21814const PatternType = { 21815 TILING: 1, 21816 SHADING: 2 21817}; 21818const TEXT_CHUNK_BATCH_SIZE = 10; 21819const deferred = Promise.resolve(); 21820 21821function normalizeBlendMode(value, parsingArray = false) { 21822 if (Array.isArray(value)) { 21823 for (let i = 0, ii = value.length; i < ii; i++) { 21824 const maybeBM = normalizeBlendMode(value[i], true); 21825 21826 if (maybeBM) { 21827 return maybeBM; 21828 } 21829 } 21830 21831 (0, _util.warn)(`Unsupported blend mode Array: ${value}`); 21832 return "source-over"; 21833 } 21834 21835 if (!(0, _primitives.isName)(value)) { 21836 if (parsingArray) { 21837 return null; 21838 } 21839 21840 return "source-over"; 21841 } 21842 21843 switch (value.name) { 21844 case "Normal": 21845 case "Compatible": 21846 return "source-over"; 21847 21848 case "Multiply": 21849 return "multiply"; 21850 21851 case "Screen": 21852 return "screen"; 21853 21854 case "Overlay": 21855 return "overlay"; 21856 21857 case "Darken": 21858 return "darken"; 21859 21860 case "Lighten": 21861 return "lighten"; 21862 21863 case "ColorDodge": 21864 return "color-dodge"; 21865 21866 case "ColorBurn": 21867 return "color-burn"; 21868 21869 case "HardLight": 21870 return "hard-light"; 21871 21872 case "SoftLight": 21873 return "soft-light"; 21874 21875 case "Difference": 21876 return "difference"; 21877 21878 case "Exclusion": 21879 return "exclusion"; 21880 21881 case "Hue": 21882 return "hue"; 21883 21884 case "Saturation": 21885 return "saturation"; 21886 21887 case "Color": 21888 return "color"; 21889 21890 case "Luminosity": 21891 return "luminosity"; 21892 } 21893 21894 if (parsingArray) { 21895 return null; 21896 } 21897 21898 (0, _util.warn)(`Unsupported blend mode: ${value.name}`); 21899 return "source-over"; 21900} 21901 21902class TimeSlotManager { 21903 static get TIME_SLOT_DURATION_MS() { 21904 return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20); 21905 } 21906 21907 static get CHECK_TIME_EVERY() { 21908 return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100); 21909 } 21910 21911 constructor() { 21912 this.reset(); 21913 } 21914 21915 check() { 21916 if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) { 21917 return false; 21918 } 21919 21920 this.checked = 0; 21921 return this.endTime <= Date.now(); 21922 } 21923 21924 reset() { 21925 this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS; 21926 this.checked = 0; 21927 } 21928 21929} 21930 21931class PartialEvaluator { 21932 constructor({ 21933 xref, 21934 handler, 21935 pageIndex, 21936 idFactory, 21937 fontCache, 21938 builtInCMapCache, 21939 standardFontDataCache, 21940 globalImageCache, 21941 options = null 21942 }) { 21943 this.xref = xref; 21944 this.handler = handler; 21945 this.pageIndex = pageIndex; 21946 this.idFactory = idFactory; 21947 this.fontCache = fontCache; 21948 this.builtInCMapCache = builtInCMapCache; 21949 this.standardFontDataCache = standardFontDataCache; 21950 this.globalImageCache = globalImageCache; 21951 this.options = options || DefaultPartialEvaluatorOptions; 21952 this.parsingType3Font = false; 21953 this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this); 21954 } 21955 21956 get _pdfFunctionFactory() { 21957 const pdfFunctionFactory = new _function.PDFFunctionFactory({ 21958 xref: this.xref, 21959 isEvalSupported: this.options.isEvalSupported 21960 }); 21961 return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory); 21962 } 21963 21964 clone(newOptions = null) { 21965 const newEvaluator = Object.create(this); 21966 newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions); 21967 return newEvaluator; 21968 } 21969 21970 hasBlendModes(resources, nonBlendModesSet) { 21971 if (!(resources instanceof _primitives.Dict)) { 21972 return false;
21973 } 21974 21975 if (resources.objId && nonBlendModesSet.has(resources.objId)) { 21976 return false; 21977 } 21978 21979 const processed = new _primitives.RefSet(nonBlendModesSet); 21980 21981 if (resources.objId) { 21982 processed.put(resources.objId); 21983 } 21984 21985 const nodes = [resources], 21986 xref = this.xref; 21987 21988 while (nodes.length) { 21989 const node = nodes.shift(); 21990 const graphicStates = node.get("ExtGState"); 21991 21992 if (graphicStates instanceof _primitives.Dict) { 21993 for (let graphicState of graphicStates.getRawValues()) { 21994 if (graphicState instanceof _primitives.Ref) { 21995 if (processed.has(graphicState)) { 21996 continue; 21997 } 21998 21999 try { 22000 graphicState = xref.fetch(graphicState); 22001 } catch (ex) { 22002 processed.put(graphicState); 22003 (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`); 22004 continue; 22005 } 22006 } 22007 22008 if (!(graphicState instanceof _primitives.Dict)) { 22009 continue; 22010 } 22011 22012 if (graphicState.objId) { 22013 processed.put(graphicState.objId); 22014 } 22015 22016 const bm = graphicState.get("BM"); 22017 22018 if (bm instanceof _primitives.Name) { 22019 if (bm.name !== "Normal") { 22020 return true; 22021 } 22022 22023 continue; 22024 } 22025 22026 if (bm !== undefined && Array.isArray(bm)) { 22027 for (const element of bm) { 22028 if (element instanceof _primitives.Name && element.name !== "Normal") { 22029 return true; 22030 } 22031 } 22032 } 22033 } 22034 } 22035 22036 const xObjects = node.get("XObject"); 22037 22038 if (!(xObjects instanceof _primitives.Dict)) { 22039 continue; 22040 } 22041 22042 for (let xObject of xObjects.getRawValues()) { 22043 if (xObject instanceof _primitives.Ref) { 22044 if (processed.has(xObject)) { 22045 continue; 22046 } 22047 22048 try { 22049 xObject = xref.fetch(xObject); 22050 } catch (ex) { 22051 processed.put(xObject); 22052 (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`); 22053 continue; 22054 } 22055 } 22056 22057 if (!(0, _primitives.isStream)(xObject)) { 22058 continue; 22059 } 22060 22061 if (xObject.dict.objId) { 22062 processed.put(xObject.dict.objId); 22063 } 22064 22065 const xResources = xObject.dict.get("Resources"); 22066 22067 if (!(xResources instanceof _primitives.Dict)) { 22068 continue; 22069 } 22070 22071 if (xResources.objId && processed.has(xResources.objId)) { 22072 continue; 22073 } 22074 22075 nodes.push(xResources); 22076 22077 if (xResources.objId) { 22078 processed.put(xResources.objId); 22079 } 22080 } 22081 } 22082 22083 processed.forEach(ref => { 22084 nonBlendModesSet.put(ref); 22085 }); 22086 return false; 22087 } 22088 22089 async fetchBuiltInCMap(name) { 22090 const cachedData = this.builtInCMapCache.get(name); 22091 22092 if (cachedData) { 22093 return cachedData; 22094 } 22095 22096 let data; 22097 22098 if (this.options.cMapUrl !== null) { 22099 const url = `${this.options.cMapUrl}${name}.bcmap`; 22100 const response = await fetch(url); 22101 22102 if (!response.ok) { 22103 throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`); 22104 } 22105 22106 data = { 22107 cMapData: new Uint8Array(await response.arrayBuffer()), 22108 compressionType: _util.CMapCompressionType.BINARY 22109 }; 22110 } else { 22111 data = await this.handler.sendWithPromise("FetchBuiltInCMap", { 22112 name 22113 }); 22114 } 22115 22116 if (data.compressionType !== _util.CMapCompressionType.NONE) { 22117 this.builtInCMapCache.set(name, data); 22118 } 22119 22120 return data; 22121 } 22122 22123 async fetchStandardFontData(name) { 22124 const cachedData = this.standardFontDataCache.get(name); 22125 22126 if (cachedData) { 22127 return new _stream.Stream(cachedData); 22128 } 22129 22130 if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") { 22131 return null; 22132 } 22133 22134 const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(), 22135 filename = standardFontNameToFileName[name]; 22136 let data; 22137 22138 if (this.options.standardFontDataUrl !== null) { 22139 const url = `${this.options.standardFontDataUrl}${filename}`; 22140 const response = await fetch(url); 22141 22142 if (!response.ok) { 22143 (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`); 22144 } else { 22145 data = await response.arrayBuffer(); 22146 } 22147 } else {
22148 try { 22149 data = await this.handler.sendWithPromise("FetchStandardFontData", { 22150 filename 22151 }); 22152 } catch (e) { 22153 (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`); 22154 } 22155 } 22156 22157 if (!data) { 22158 return null; 22159 } 22160 22161 this.standardFontDataCache.set(name, data); 22162 return new _stream.Stream(data); 22163 } 22164 22165 async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) { 22166 const dict = xobj.dict; 22167 const matrix = dict.getArray("Matrix"); 22168 let bbox = dict.getArray("BBox"); 22169 22170 if (Array.isArray(bbox) && bbox.length === 4) { 22171 bbox = _util.Util.normalizeRect(bbox); 22172 } else { 22173 bbox = null; 22174 } 22175 22176 let optionalContent, groupOptions; 22177 22178 if (dict.has("OC")) { 22179 optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources); 22180 } 22181 22182 if (optionalContent !== undefined) { 22183 operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]); 22184 } 22185 22186 const group = dict.get("Group"); 22187 22188 if (group) { 22189 groupOptions = { 22190 matrix, 22191 bbox, 22192 smask, 22193 isolated: false, 22194 knockout: false 22195 }; 22196 const groupSubtype = group.get("S"); 22197 let colorSpace = null; 22198 22199 if ((0, _primitives.isName)(groupSubtype, "Transparency")) { 22200 groupOptions.isolated = group.get("I") || false; 22201 groupOptions.knockout = group.get("K") || false; 22202 22203 if (group.has("CS")) { 22204 const cs = group.getRaw("CS"); 22205 22206 const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache); 22207 22208 if (cachedColorSpace) { 22209 colorSpace = cachedColorSpace; 22210 } else { 22211 colorSpace = await this.parseColorSpace({ 22212 cs, 22213 resources, 22214 localColorSpaceCache 22215 }); 22216 } 22217 } 22218 } 22219 22220 if (smask && smask.backdrop) { 22221 colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb; 22222 smask.backdrop = colorSpace.getRgb(smask.backdrop, 0); 22223 } 22224 22225 operatorList.addOp(_util.OPS.beginGroup, [groupOptions]); 22226 } 22227 22228 const args = group ? [matrix, null] : [matrix, bbox]; 22229 operatorList.addOp(_util.OPS.paintFormXObjectBegin, args); 22230 return this.getOperatorList({ 22231 stream: xobj, 22232 task, 22233 resources: dict.get("Resources") || resources, 22234 operatorList, 22235 initialState 22236 }).then(function () { 22237 operatorList.addOp(_util.OPS.paintFormXObjectEnd, []); 22238 22239 if (group) { 22240 operatorList.addOp(_util.OPS.endGroup, [groupOptions]); 22241 } 22242 22243 if (optionalContent !== undefined) { 22244 operatorList.addOp(_util.OPS.endMarkedContent, []); 22245 } 22246 }); 22247 } 22248 22249 _sendImgData(objId, imgData, cacheGlobally = false) { 22250 const transfers = imgData ? [imgData.data.buffer] : null; 22251 22252 if (this.parsingType3Font || cacheGlobally) { 22253 return this.handler.send("commonobj", [objId, "Image", imgData], transfers); 22254 } 22255 22256 return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers); 22257 } 22258 22259 async buildPaintImageXObject({ 22260 resources, 22261 image, 22262 isInline = false, 22263 operatorList, 22264 cacheKey, 22265 localImageCache, 22266 localColorSpaceCache 22267 }) { 22268 const dict = image.dict; 22269 const imageRef = dict.objId; 22270 const w = dict.get("W", "Width"); 22271 const h = dict.get("H", "Height"); 22272 22273 if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) { 22274 (0, _util.warn)("Image dimensions are missing, or not numbers."); 22275 return; 22276 } 22277 22278 const maxImageSize = this.options.maxImageSize; 22279 22280 if (maxImageSize !== -1 && w * h > maxImageSize) { 22281 (0, _util.warn)("Image exceeded maximum allowed size and was removed."); 22282 return; 22283 } 22284 22285 let optionalContent; 22286 22287 if (dict.has("OC")) { 22288 optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources); 22289 } 22290 22291 if (optionalContent !== undefined) { 22292 operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]); 22293 } 22294 22295 const imageMask = dict.get("IM", "ImageMask") || false; 22296 const interpolate = dict.get("I", "Interpolate"); 22297 let imgData, args; 22298 22299 if (imageMask) { 22300 const bitStrideLength = w + 7 >> 3; 22301 const imgArray = image.getBytes(bitStrideLength * h, true); 22302 const decode = dict.getArray("D", "Decode"); 22303 imgData = _image.PDFImage.createMask({ 22304 imgArray, 22305 width: w, 22306 height: h,
22307 imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream, 22308 inverseDecode: !!decode && decode[0] > 0, 22309 interpolate 22310 }); 22311 imgData.cached = !!cacheKey; 22312 args = [imgData]; 22313 operatorList.addOp(_util.OPS.paintImageMaskXObject, args); 22314 22315 if (cacheKey) { 22316 localImageCache.set(cacheKey, imageRef, { 22317 fn: _util.OPS.paintImageMaskXObject, 22318 args 22319 }); 22320 } 22321 22322 if (optionalContent !== undefined) { 22323 operatorList.addOp(_util.OPS.endMarkedContent, []); 22324 } 22325 22326 return; 22327 } 22328 22329 const softMask = dict.get("SM", "SMask") || false; 22330 const mask = dict.get("Mask") || false; 22331 const SMALL_IMAGE_DIMENSIONS = 200; 22332 22333 if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) { 22334 const imageObj = new _image.PDFImage({ 22335 xref: this.xref, 22336 res: resources, 22337 image, 22338 isInline, 22339 pdfFunctionFactory: this._pdfFunctionFactory, 22340 localColorSpaceCache 22341 }); 22342 imgData = imageObj.createImageData(true); 22343 operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]); 22344 22345 if (optionalContent !== undefined) { 22346 operatorList.addOp(_util.OPS.endMarkedContent, []); 22347 } 22348 22349 return; 22350 } 22351 22352 let objId = `img_${this.idFactory.createObjId()}`, 22353 cacheGlobally = false; 22354 22355 if (this.parsingType3Font) { 22356 objId = `${this.idFactory.getDocId()}_type3_${objId}`; 22357 } else if (imageRef) { 22358 cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex); 22359 22360 if (cacheGlobally) { 22361 objId = `${this.idFactory.getDocId()}_${objId}`; 22362 } 22363 } 22364 22365 operatorList.addDependency(objId); 22366 args = [objId, w, h]; 22367 22368 _image.PDFImage.buildImage({ 22369 xref: this.xref, 22370 res: resources, 22371 image, 22372 isInline, 22373 pdfFunctionFactory: this._pdfFunctionFactory, 22374 localColorSpaceCache 22375 }).then(imageObj => { 22376 imgData = imageObj.createImageData(false); 22377 22378 if (cacheKey && imageRef && cacheGlobally) { 22379 this.globalImageCache.addByteSize(imageRef, imgData.data.length); 22380 } 22381 22382 return this._sendImgData(objId, imgData, cacheGlobally); 22383 }).catch(reason => { 22384 (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`); 22385 return this._sendImgData(objId, null, cacheGlobally); 22386 }); 22387 22388 operatorList.addOp(_util.OPS.paintImageXObject, args); 22389 22390 if (cacheKey) { 22391 localImageCache.set(cacheKey, imageRef, { 22392 fn: _util.OPS.paintImageXObject, 22393 args 22394 }); 22395 22396 if (imageRef) { 22397 (0, _util.assert)(!isInline, "Cannot cache an inline image globally."); 22398 this.globalImageCache.addPageIndex(imageRef, this.pageIndex); 22399 22400 if (cacheGlobally) { 22401 this.globalImageCache.setData(imageRef, { 22402 objId, 22403 fn: _util.OPS.paintImageXObject, 22404 args, 22405 byteSize: 0 22406 }); 22407 } 22408 } 22409 } 22410 22411 if (optionalContent !== undefined) { 22412 operatorList.addOp(_util.OPS.endMarkedContent, []); 22413 } 22414 } 22415 22416 handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) { 22417 const smaskContent = smask.get("G"); 22418 const smaskOptions = { 22419 subtype: smask.get("S").name, 22420 backdrop: smask.get("BC") 22421 }; 22422 const transferObj = smask.get("TR"); 22423 22424 if ((0, _function.isPDFFunction)(transferObj)) { 22425 const transferFn = this._pdfFunctionFactory.create(transferObj); 22426 22427 const transferMap = new Uint8Array(256); 22428 const tmp = new Float32Array(1); 22429 22430 for (let i = 0; i < 256; i++) { 22431 tmp[0] = i / 255; 22432 transferFn(tmp, 0, tmp, 0); 22433 transferMap[i] = tmp[0] * 255 | 0; 22434 } 22435 22436 smaskOptions.transferMap = transferMap; 22437 } 22438 22439 return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache); 22440 } 22441 22442 handleTransferFunction(tr) { 22443 let transferArray; 22444 22445 if (Array.isArray(tr)) { 22446 transferArray = tr; 22447 } else if ((0, _function.isPDFFunction)(tr)) { 22448 transferArray = [tr]; 22449 } else { 22450 return null; 22451 } 22452 22453 const transferMaps = []; 22454 let numFns = 0, 22455 numEffectfulFns = 0; 22456 22457 for (const entry of transferArray) { 22458 const transferObj = this.xref.fetchIfRef(entry); 22459 numFns++; 22460 22461 if ((0, _primitives.isName)(transferObj, "Identity")) { 22462 transferMaps.push(null); 22463 continue; 22464 } else if (!(0, _function.isPDFFunction)(transferObj)) { 22465 return null; 22466 } 22467 22468 const transferFn = this._pdfFunctionFactory.create(transferObj); 22469 22470 const transferMap = new Uint8Array(256), 22471 tmp = new Float32Array(1); 22472 22473 for (let j = 0; j < 256; j++) { 22474 tmp[0] = j / 255; 22475 transferFn(tmp, 0, tmp, 0); 22476 transferMap[j] = tmp[0] * 255 | 0; 22477 } 22478 22479 transferMaps.push(transferMap); 22480 numEffectfulFns++; 22481 } 22482 22483 if (!(numFns === 1 || numFns === 4)) { 22484 return null; 22485 } 22486 22487 if (numEffectfulFns === 0) { 22488 return null; 22489 } 22490 22491 return transferMaps; 22492 } 22493 22494 handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) { 22495 const tilingOpList = new _operator_list.OperatorList(); 22496 22497 const patternResources = _primitives.Dict.merge({ 22498 xref: this.xref, 22499 dictArray: [patternDict.get("Resources"), resources] 22500 }); 22501 22502 return this.getOperatorList({ 22503 stream: pattern, 22504 task,
22505 resources: patternResources, 22506 operatorList: tilingOpList 22507 }).then(function () { 22508 const operatorListIR = tilingOpList.getIR(); 22509 const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color); 22510 operatorList.addDependencies(tilingOpList.dependencies); 22511 operatorList.addOp(fn, tilingPatternIR); 22512 22513 if (patternDict.objId) { 22514 localTilingPatternCache.set(null, patternDict.objId, { 22515 operatorListIR, 22516 dict: patternDict 22517 }); 22518 } 22519 }).catch(reason => { 22520 if (reason instanceof _util.AbortException) { 22521 return; 22522 } 22523 22524 if (this.options.ignoreErrors) { 22525 this.handler.send("UnsupportedFeature", { 22526 featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern 22527 }); 22528 (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`); 22529 return; 22530 } 22531 22532 throw reason; 22533 }); 22534 } 22535 22536 handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) { 22537 const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null; 22538 return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => { 22539 if (!translated.font.isType3Font) { 22540 return translated; 22541 } 22542 22543 return translated.loadType3Data(this, resources, task).then(function () { 22544 operatorList.addDependencies(translated.type3Dependencies); 22545 return translated; 22546 }).catch(reason => { 22547 this.handler.send("UnsupportedFeature", { 22548 featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3 22549 }); 22550 return new TranslatedFont({ 22551 loadedName: "g_font_error", 22552 font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`), 22553 dict: translated.font, 22554 evaluatorOptions: this.options 22555 }); 22556 }); 22557 }).then(translated => { 22558 state.font = translated.font; 22559 translated.send(this.handler); 22560 return translated.loadedName; 22561 }); 22562 } 22563
22564 handleText(chars, state) { 22565 const font = state.font; 22566 const glyphs = font.charsToGlyphs(chars); 22567 22568 if (font.data) { 22569 const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG); 22570 22571 if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) { 22572 PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options); 22573 } 22574 } 22575 22576 return glyphs; 22577 } 22578 22579 ensureStateFont(state) { 22580 if (state.font) { 22581 return; 22582 } 22583 22584 const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator."); 22585 22586 if (this.options.ignoreErrors) { 22587 this.handler.send("UnsupportedFeature", { 22588 featureId: _util.UNSUPPORTED_FEATURES.errorFontState 22589 }); 22590 (0, _util.warn)(`ensureStateFont: "${reason}".`); 22591 return; 22592 } 22593 22594 throw reason; 22595 } 22596 22597 async setGState({ 22598 resources, 22599 gState, 22600 operatorList, 22601 cacheKey, 22602 task, 22603 stateManager, 22604 localGStateCache, 22605 localColorSpaceCache 22606 }) { 22607 const gStateRef = gState.objId; 22608 let isSimpleGState = true; 22609 const gStateObj = []; 22610 const gStateKeys = gState.getKeys(); 22611 let promise = Promise.resolve(); 22612 22613 for (let i = 0, ii = gStateKeys.length; i < ii; i++) { 22614 const key = gStateKeys[i]; 22615 const value = gState.get(key); 22616 22617 switch (key) { 22618 case "Type": 22619 break; 22620 22621 case "LW": 22622 case "LC": 22623 case "LJ": 22624 case "ML": 22625 case "D": 22626 case "RI": 22627 case "FL": 22628 case "CA": 22629 case "ca": 22630 gStateObj.push([key, value]); 22631 break; 22632 22633 case "Font": 22634 isSimpleGState = false; 22635 promise = promise.then(() => { 22636 return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) { 22637 operatorList.addDependency(loadedName); 22638 gStateObj.push([key, [loadedName, value[1]]]); 22639 }); 22640 }); 22641 break; 22642 22643 case "BM": 22644 gStateObj.push([key, normalizeBlendMode(value)]); 22645 break; 22646 22647 case "SMask": 22648 if ((0, _primitives.isName)(value, "None")) { 22649 gStateObj.push([key, false]); 22650 break; 22651 } 22652 22653 if ((0, _primitives.isDict)(value)) { 22654 isSimpleGState = false; 22655 promise = promise.then(() => { 22656 return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache); 22657 }); 22658 gStateObj.push([key, true]); 22659 } else { 22660 (0, _util.warn)("Unsupported SMask type"); 22661 } 22662 22663 break; 22664 22665 case "TR": 22666 const transferMaps = this.handleTransferFunction(value); 22667 gStateObj.push([key, transferMaps]); 22668 break; 22669 22670 case "OP": 22671 case "op": 22672 case "OPM": 22673 case "BG": 22674 case "BG2": 22675 case "UCR": 22676 case "UCR2": 22677 case "TR2": 22678 case "HT": 22679 case "SM": 22680 case "SA": 22681 case "AIS": 22682 case "TK": 22683 (0, _util.info)("graphic state operator " + key); 22684 break; 22685 22686 default: 22687 (0, _util.info)("Unknown graphic state operator " + key); 22688 break; 22689 } 22690 } 22691 22692 return promise.then(function () { 22693 if (gStateObj.length > 0) { 22694 operatorList.addOp(_util.OPS.setGState, [gStateObj]); 22695 } 22696 22697 if (isSimpleGState) { 22698 localGStateCache.set(cacheKey, gStateRef, gStateObj); 22699 } 22700 }); 22701 } 22702 22703 loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) { 22704 const errorFont = async () => { 22705 return new TranslatedFont({ 22706 loadedName: "g_font_error", 22707 font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`), 22708 dict: font, 22709 evaluatorOptions: this.options 22710 }); 22711 }; 22712 22713 const xref = this.xref; 22714 let fontRef; 22715 22716 if (font) { 22717 if (!(0, _primitives.isRef)(font)) { 22718 throw new _util.FormatError('The "font" object should be a reference.'); 22719 } 22720 22721 fontRef = font; 22722 } else { 22723 const fontRes = resources.get("Font"); 22724 22725 if (fontRes) { 22726 fontRef = fontRes.getRaw(fontName); 22727 } 22728 } 22729 22730 if (!fontRef) { 22731 const partialMsg = `Font "${fontName || font && font.toString()}" is not available`; 22732 22733 if (!this.options.ignoreErrors && !this.parsingType3Font) { 22734 (0, _util.warn)(`${partialMsg}.`); 22735 return errorFont(); 22736 } 22737 22738 this.handler.send("UnsupportedFeature", { 22739 featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing 22740 }); 22741 (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`); 22742 22743 if (fallbackFontDict) { 22744 fontRef = fallbackFontDict; 22745 } else { 22746 fontRef = PartialEvaluator.fallbackFontDict; 22747 } 22748 } 22749 22750 if (this.fontCache.has(fontRef)) { 22751 return this.fontCache.get(fontRef); 22752 } 22753 22754 font = xref.fetchIfRef(fontRef); 22755 22756 if (!(0, _primitives.isDict)(font)) { 22757 return errorFont(); 22758 } 22759 22760 if (font.cacheKey && this.fontCache.has(font.cacheKey)) { 22761 return this.fontCache.get(font.cacheKey); 22762 } 22763 22764 const fontCapability = (0, _util.createPromiseCapability)(); 22765 let preEvaluatedFont; 22766 22767 try { 22768 preEvaluatedFont = this.preEvaluateFont(font); 22769 preEvaluatedFont.cssFontInfo = cssFontInfo; 22770 } catch (reason) { 22771 (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`); 22772 return errorFont(); 22773 } 22774 22775 const { 22776 descriptor, 22777 hash 22778 } = preEvaluatedFont; 22779 const fontRefIsRef = (0, _primitives.isRef)(fontRef); 22780 let fontID; 22781 22782 if (fontRefIsRef) { 22783 fontID = `f${fontRef.toString()}`; 22784 } 22785 22786 if (hash && (0, _primitives.isDict)(descriptor)) { 22787 if (!descriptor.fontAliases) { 22788 descriptor.fontAliases = Object.create(null); 22789 } 22790 22791 const fontAliases = descriptor.fontAliases; 22792 22793 if (fontAliases[hash]) { 22794 const aliasFontRef = fontAliases[hash].aliasRef; 22795 22796 if (fontRefIsRef && aliasFontRef && this.fontCache.has(ali
22796asFontRef)) { 22797 this.fontCache.putAlias(fontRef, aliasFontRef); 22798 return this.fontCache.get(fontRef); 22799 } 22800 } else { 22801 fontAliases[hash] = { 22802 fontID: this.idFactory.createFontId() 22803 }; 22804 } 22805 22806 if (fontRefIsRef) { 22807 fontAliases[hash].aliasRef = fontRef; 22808 } 22809 22810 fontID = fontAliases[hash].fontID; 22811 } 22812 22813 if (fontRefIsRef) { 22814 this.fontCache.put(fontRef, fontCapability.promise); 22815 } else { 22816 if (!fontID) { 22817 fontID = this.idFactory.createFontId(); 22818 } 22819 22820 font.cacheKey = `cacheKey_${fontID}`; 22821 this.fontCache.put(font.cacheKey, fontCapability.promise); 22822 } 22823 22824 (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.'); 22825 font.loadedName = `${this.idFactory.getDocId()}_${fontID}`; 22826 this.translateFont(preEvaluatedFont).then(translatedFont => { 22827 if (translatedFont.fontType !== undefined) { 22828 xref.stats.addFontType(translatedFont.fontType); 22829 } 22830 22831 fontCapability.resolve(new TranslatedFont({ 22832 loadedName: font.loadedName, 22833 font: translatedFont, 22834 dict: font, 22835 evaluatorOptions: this.options 22836 })); 22837 }).catch(reason => { 22838 this.handler.send("UnsupportedFeature", { 22839 featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate 22840 }); 22841 (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`); 22842 22843 try { 22844 const fontFile3 = descriptor && descriptor.get("FontFile3"); 22845 const subtype = fontFile3 && fontFile3.get("Subtype"); 22846 const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name); 22847 22848 if (fontType !== undefined) { 22849 xref.stats.addFontType(fontType); 22850 } 22851 } catch (ex) {} 22852 22853 fontCapability.resolve(new TranslatedFont({ 22854 loadedName: font.loadedName, 22855 font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason), 22856 dict: font, 22857 evaluatorOptions: this.options 22858 })); 22859 }); 22860 return fontCapability.promise; 22861 } 22862 22863 buildPath(operatorList, fn, args, parsingText = false) { 22864 const lastIndex = operatorList.length - 1; 22865 22866 if (!args) { 22867 args = []; 22868 } 22869 22870 if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) { 22871 if (parsingText) { 22872 (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`); 22873 operatorList.addOp(_util.OPS.save, null); 22874 } 22875 22876 operatorList.addOp(_util.OPS.constructPath, [[fn], args]); 22877 22878 if (parsingText) { 22879 operatorList.addOp(_util.OPS.restore, null); 22880 } 22881 } else { 22882 const opArgs = operatorList.argsArray[lastIndex]; 22883 opArgs[0].push(fn); 22884 Array.prototype.push.apply(opArgs[1], args); 22885 } 22886 } 22887 22888 parseColorSpace({ 22889 cs, 22890 resources, 22891 localColorSpaceCache 22892 }) { 22893 return _colorspace.ColorSpace.parseAsync({ 22894 cs, 22895 xref: this.xref, 22896 resources, 22897 pdfFunctionFactory: this._pdfFunctionFactory, 22898 localColorSpaceCache 22899 }).catch(reason => { 22900 if (reason instanceof _util.AbortException) { 22901 return null; 22902 } 22903 22904 if (this.options.ignoreErrors) { 22905 this.handler.send("UnsupportedFeature", { 22906 featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace 22907 }); 22908 (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`); 22909 return null; 22910 } 22911 22912 throw reason; 22913 }); 22914 } 22915 22916 parseShading({ 22917 shading, 22918 resources, 22919 localColorSpaceCache, 22920 localShadingPatternCache 22921 }) { 22922 let id = localShadingPatternCache.get(shading); 22923 22924 if (!id) { 22925 var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache); 22926 22927 const patternIR = shadingFill.getIR(); 22928 id = `pattern_${this.idFactory.createObjId()}`; 22929 localShadingPatternCache.set(shading, id); 22930 this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]); 22931 } 22932 22933 return id; 22934 } 22935 22936 handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) { 22937 const patternName = args.pop(); 22938 22939 if (patternName instanceof _primitives.Name) { 22940 const rawPattern = patterns.getRaw(patternName.name); 22941 const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern); 22942 22943 if (localTilingPattern) { 22944 try { 22945 const color = cs.base ? cs.base.getRgb(args, 0) : null; 22946 const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color); 22947 operatorList.addOp(fn, tilingPatternIR); 22948 return undefined; 22949 } catch (ex) {} 22950 } 22951 22952 const pattern = this.xref.fetchIfRef(rawPattern); 22953 22954 if (pattern) { 22955 const dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern; 22956 const typeNum = dict.get("PatternType"); 22957 22958 if (typeNum === PatternType.TILING) { 22959 const color = cs.base ? cs.base.getRgb(args, 0) : null; 22960 return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache); 22961 } else if (typeNum === PatternType.SHADING) { 22962 const shading = dict.get("Shading"); 22963 const matrix = dict.getArray("Matrix"); 22964 const objId = this.parseShading({ 22965 shading, 22966 resources, 22967 localColorSpaceCache, 22968 localShadingPatternCache 22969 }); 22970 operatorList.addOp(fn, ["Shading", objId, matrix]); 22971 return undefined; 22972 } 22973 22974 throw new _util.FormatError(`Unknown PatternType: ${typeNum}`); 22975 } 22976 } 22977 22978 throw new _util.FormatError(`Unknown PatternName: ${patternName}`); 22979 } 22980 22981 _parseVisibilityExpression(array, nestingCounter, currentResult) { 22982 const MAX_NESTING = 10; 22983 22984 if (++nestingCounter > MAX_NESTING) { 22985 (0, _util.warn)("Visibility expression is too deeply nested"); 22986 return; 22987 } 22988 22989 const length = array.length; 22990 const operator = this.xref.fetchIfRef(array[0]); 22991 22992 if (length < 2 || !(0, _primitives.isName)(operator)) { 22993 (0, _util.warn)("Invalid visibility expression"); 22994 return; 22995 } 22996 22997 switch (operator.name) { 22998 case "And": 22999 case "Or": 23000 case "Not": 23001 currentResult.push(operator.name); 23002 break; 23003 23004 default: 23005 (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`); 23006 return; 23007 } 23008 23009 for (let i = 1; i < length; i++) { 23010 const raw = array[i]; 23011 const object = this.xref.fetchIfRef(raw); 23012 23013 if (Array.isArray(object)) { 23014 const nestedResult = []; 23015 currentResult.push(nestedResult); 23016 23017 this._parseVisibilityExpression(object, nestingCounter, nestedResult); 23018 } else if ((0, _primitives.isRef)(raw)) { 23019 currentResult.push(raw.toString()); 23020 } 23021 } 23022 } 23023 23024 async parseMarkedContentProps(contentProperties, resources) { 23025 let optionalContent; 23026 23027 if ((0, _primitives.isName)(contentProperties)) { 23028 const properties = resources.get("Properties"); 23029 optionalContent = properties.get(contentProperties.name); 23030 } else if ((0, _primitives.isDict)(contentProperties)) { 23031 optionalContent = contentProperties; 23032 } else { 23033 throw new _util.FormatError("Optional content properties malformed."); 23034 } 23035 23036 const optionalContentType = optionalContent.get("Type").name; 23037 23038 if (optionalContentType === "OCG") { 23039 return { 23040 type: optionalContentType, 23041 id: optionalContent.objId 23042 }; 23043 } else if (optionalContentType === "OCMD") { 23044 const expression = optionalContent.get("VE"); 23045 23046 if (Array.isArray(expression)) { 23047 const result = []; 23048 23049 this._parseVisibilityExpression(expression, 0, result); 23050 23051 if (result.length > 0) { 23052 return { 23053 type: "OCMD", 23054 expression: result 23055 }; 23056 } 23057 } 23058 23059 const optionalContentGroups = optionalContent.get("OCGs"); 23060 23061 if (Array.isArray(optionalContentGroups) || (0, _primitives.isDict)(optionalContentGroups)) { 23062 const groupIds = []; 23063 23064 if (Array.isArray(optionalContentGroups)) { 23065 for (const ocg of optionalContentGroups) { 23066 groupIds.push(ocg.toString()); 23067 } 23068 } else { 23069 groupIds.push(optionalContentGroups.objId); 23070 } 23071 23072 return { 23073 type: optionalContentType, 23074 ids: groupIds, 23075 policy: (0, _primitives.isName)(optionalContent.get("P")) ? optionalContent.get("P").name : null, 23076 expression: null 23077 }; 23078 } else if ((0, _primitives.isRef)(optionalContentGroups)) { 23079 return { 23080 type: optionalContentType, 23081 id: optionalContentGroups.toString() 23082 }; 23083 } 23084 } 23085 23086 return null; 23087 } 23088 23089 getOperatorList({ 23090 stream, 23091 task, 23092 resources, 23093 operatorList, 23094 initialState = null, 23095 fallbackFontDict = null 23096 }) { 23097 resources = resources || _primitives.Dict.empty; 23098 initialState = initialState || new EvalState(); 23099 23100 if (!operatorList) { 23101 throw new Error('getOperatorList: missing "operatorList" parameter'); 23102 } 23103 23104 const self = this; 23105 const xref = this.xref; 23106 let parsingText = false;
23107 const localImageCache = new _image_utils.LocalImageCache(); 23108 const localColorSpaceCache = new _image_utils.LocalColorSpaceCache(); 23109 const localGStateCache = new _image_utils.LocalGStateCache(); 23110 const localTilingPatternCache = new _image_utils.LocalTilingPatternCache(); 23111 const localShadingPatternCache = new Map(); 23112 23113 const xobjs = resources.get("XObject") || _primitives.Dict.empty; 23114 23115 const patterns = resources.get("Pattern") || _primitives.Dict.empty; 23116 23117 const stateManager = new StateManager(initialState); 23118 const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 23119 const timeSlotManager = new TimeSlotManager(); 23120 23121 function closePendingRestoreOPS(argument) { 23122 for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) { 23123 operatorList.addOp(_util.OPS.restore, []); 23124 } 23125 } 23126 23127 return new Promise(function promiseBody(resolve, reject) { 23128 const next = function (promise) { 23129 Promise.all([promise, operatorList.ready]).then(function () { 23130 try { 23131 promiseBody(resolve, reject); 23132 } catch (ex) { 23133 reject(ex); 23134 } 23135 }, reject); 23136 }; 23137 23138 task.ensureNotTerminated(); 23139 timeSlotManager.reset(); 23140 const operation = {}; 23141 let stop, i, ii, cs, name, isValidName; 23142 23143 while (!(stop = timeSlotManager.check())) { 23144 operation.args = null; 23145 23146 if (!preprocessor.read(operation)) { 23147 break; 23148 } 23149 23150 let args = operation.args; 23151 let fn = operation.fn; 23152 23153 switch (fn | 0) { 23154 case _util.OPS.paintXObject: 23155 isValidName = args[0] instanceof _primitives.Name; 23156 name = args[0].name; 23157 23158 if (isValidName) { 23159 const localImage = localImageCache.getByName(name); 23160 23161 if (localImage) { 23162 operatorList.addOp(localImage.fn, localImage.args); 23163 args = null; 23164 continue; 23165 } 23166 } 23167 23168 next(new Promise(function (resolveXObject, rejectXObject) { 23169 if (!isValidName) { 23170 throw new _util.FormatError("XObject must be referred to by name."); 23171 } 23172 23173 let xobj = xobjs.getRaw(name); 23174 23175 if (xobj instanceof _primitives.Ref) { 23176 const localImage = localImageCache.getByRef(xobj); 23177 23178 if (localImage) { 23179 operatorList.addOp(localImage.fn, localImage.args); 23180 resolveXObject(); 23181 return; 23182 } 23183 23184 const globalImage = self.globalImageCache.getData(xobj, self.pageIndex); 23185 23186 if (globalImage) { 23187 operatorList.addDependency(globalImage.objId); 23188 operatorList.addOp(globalImage.fn, globalImage.args); 23189 resolveXObject(); 23190 return; 23191 } 23192 23193 xobj = xref.fetch(xobj); 23194 } 23195 23196 if (!(0, _primitives.isStream)(xobj)) { 23197 throw new _util.FormatError("XObject should be a stream"); 23198 } 23199 23200 const type = xobj.dict.get("Subtype"); 23201 23202 if (!(0, _primitives.isName)(type)) { 23203 throw new _util.FormatError("XObject should have a Name subtype"); 23204 } 23205 23206 if (type.name === "Form") { 23207 stateManager.save(); 23208 self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () { 23209 stateManager.restore(); 23210 resolveXObject(); 23211 }, rejectXObject); 23212 return; 23213 } else if (type.name === "Image") { 23214 self.buildPaintImageXObject({ 23215 resources, 23216 image: xobj, 23217 operatorList, 23218 cacheKey: name, 23219 localImageCache, 23220 localColorSpaceCache 23221 }).then(resolveXObject, rejectXObject); 23222 return; 23223 } else if (type.name === "PS") { 23224 (0, _util.info)("Ignored XObject subtype PS"); 23225 } else { 23226 throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`); 23227 } 23228 23229 resolveXObject(); 23230 }).catch(function (reason) { 23231 if (reason instanceof _util.AbortException) { 23232 return; 23233 } 23234 23235 if (self.options.ignoreErrors) { 23236 self.handler.send("UnsupportedFeature", { 23237 featureId: _util.UNSUPPORTED_FEATURES.errorXObject 23238 }); 23239 (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`); 23240 return; 23241 } 23242 23243 throw reason; 23244 })); 23245 return; 23246 23247 case _util.OPS.setFont: 23248 var fontSize = args[1]; 23249 next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) { 23250 operatorList.addDependency(loadedName); 23251 operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]); 23252 })); 23253 return; 23254 23255 case _util.OPS.beginText: 23256 parsingText = true; 23257 break; 23258 23259 case _util.OPS.endText: 23260 parsingText = false;
23261 break; 23262 23263 case _util.OPS.endInlineImage: 23264 var cacheKey = args[0].cacheKey; 23265 23266 if (cacheKey) { 23267 const localImage = localImageCache.getByName(cacheKey); 23268 23269 if (localImage) { 23270 operatorList.addOp(localImage.fn, localImage.args); 23271 args = null; 23272 continue; 23273 } 23274 } 23275 23276 next(self.buildPaintImageXObject({ 23277 resources, 23278 image: args[0], 23279 isInline: true, 23280 operatorList, 23281 cacheKey, 23282 localImageCache, 23283 localColorSpaceCache 23284 })); 23285 return; 23286 23287 case _util.OPS.showText: 23288 if (!stateManager.state.font) { 23289 self.ensureStateFont(stateManager.state); 23290 continue; 23291 } 23292 23293 args[0] = self.handleText(args[0], stateManager.state); 23294 break; 23295 23296 case _util.OPS.showSpacedText: 23297 if (!stateManager.state.font) { 23298 self.ensureStateFont(stateManager.state); 23299 continue; 23300 } 23301 23302 var arr = args[0]; 23303 var combinedGlyphs = []; 23304 var arrLength = arr.length; 23305 var state = stateManager.state; 23306 23307 for (i = 0; i < arrLength; ++i) { 23308 const arrItem = arr[i]; 23309 23310 if ((0, _util.isString)(arrItem)) { 23311 Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state)); 23312 } else if ((0, _util.isNum)(arrItem)) { 23313 combinedGlyphs.push(arrItem); 23314 } 23315 } 23316 23317 args[0] = combinedGlyphs; 23318 fn = _util.OPS.showText; 23319 break; 23320 23321 case _util.OPS.nextLineShowText: 23322 if (!stateManager.state.font) { 23323 self.ensureStateFont(stateManager.state); 23324 continue; 23325 } 23326 23327 operatorList.addOp(_util.OPS.nextLine); 23328 args[0] = self.handleText(args[0], stateManager.state); 23329 fn = _util.OPS.showText; 23330 break; 23331 23332 case _util.OPS.nextLineSetSpacingShowText: 23333 if (!stateManager.state.font) { 23334 self.ensureStateFont(stateManager.state); 23335 continue; 23336 } 23337 23338 operatorList.addOp(_util.OPS.nextLine); 23339 operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]); 23340 operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]); 23341 args[0] = self.handleText(args[0], stateManager.state); 23342 fn = _util.OPS.showText; 23343 break; 23344 23345 case _util.OPS.setTextRenderingMode: 23346 stateManager.state.textRenderingMode = args[0]; 23347 break; 23348 23349 case _util.OPS.setFillColorSpace: 23350 { 23351 const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache); 23352 23353 if (cachedColorSpace) { 23354 stateManager.state.fillColorSpace = cachedColorSpace; 23355 continue; 23356 } 23357 23358 next(self.parseColorSpace({ 23359 cs: args[0], 23360 resources, 23361 localColorSpaceCache 23362 }).then(function (colorSpace) { 23363 if (colorSpace) { 23364 stateManager.state.fillColorSpace = colorSpace; 23365 } 23366 })); 23367 return; 23368 } 23369 23370 case _util.OPS.setStrokeColorSpace: 23371 { 23372 const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache); 23373 23374 if (cachedColorSpace) { 23375 stateManager.state.strokeColorSpace = cachedColorSpace; 23376 continue; 23377 } 23378 23379 next(self.parseColorSpace({ 23380 cs: args[0], 23381 resources, 23382 localColorSpaceCache 23383 }).then(function (colorSpace) { 23384 if (colorSpace) { 23385 stateManager.state.strokeColorSpace = colorSpace; 23386 } 23387 })); 23388 return; 23389 } 23390 23391 case _util.OPS.setFillColor: 23392 cs = stateManager.state.fillColorSpace; 23393 args = cs.getRgb(args, 0); 23394 fn = _util.OPS.setFillRGBColor; 23395 break; 23396 23397 case _util.OPS.setStrokeColor: 23398 cs = stateManager.state.strokeColorSpace; 23399 args = cs.getRgb(args, 0); 23400 fn = _util.OPS.setStrokeRGBColor; 23401 break; 23402 23403 case _util.OPS.setFillGray: 23404 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray; 23405 args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0); 23406 fn = _util.OPS.setFillRGBColor; 23407 break; 23408 23409 case _util.OPS.setStrokeGray: 23410 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray; 23411 args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0); 23412 fn = _util.OPS.setStrokeRGBColor; 23413 break; 23414 23415 case _util.OPS.setFillCMYKColor: 23416 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk; 23417 args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0); 23418 fn = _util.OPS.setFillRGBColor; 23419 break; 23420 23421 case _util.OPS.setStrokeCMYKColor: 23422 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk; 23423 args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0); 23424 fn = _util.OPS.setStrokeRGBColor; 23425 break; 23426 23427 case _util.OPS.setFillRGBColor: 23428 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb; 23429 args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0); 23430 break; 23431 23432 case _util.OPS.setStrokeRGBColor: 23433 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb; 23434 args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0); 23435 break; 23436 23437 case _util.OPS.setFillColorN: 23438 cs = stateManager.state.fillColorSpace; 23439 23440 if (cs.name === "Pattern") { 23441 next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache)); 23442 return; 23443 } 23444 23445 args = cs.getRgb(args, 0); 23446 fn = _util.OPS.setFillRGBColor; 23447 break; 23448 23449 case _util.OPS.setStrokeColorN: 23450 cs = stateManager.state.strokeColorSpace; 23451 23452 if (cs.name === "Pattern") { 23453 next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache)); 23454 return; 23455 } 23456 23457 args = cs.getRgb(args, 0); 23458 fn = _util.OPS.setStrokeRGBColor; 23459 break; 23460 23461 case _util.OPS.shadingFill: 23462 var shadingRes = resources.get("Shading"); 23463 23464 if (!shadingRes) { 23465 throw new _util.FormatError("No shading resource found"); 23466 } 23467 23468 var shading = shadingRes.get(args[0].name); 23469 23470 if (!shading) { 23471 throw new _util.FormatError("No shading object found"); 23472 } 23473 23474 const patternId = self.parseShading({ 23475 shading, 23476 resources, 23477 localColorSpaceCache, 23478 localShadingPatternCache 23479 }); 23480 args = [patternId]; 23481 fn = _util.OPS.shadingFill; 23482 break; 23483 23484 case _util.OPS.setGState: 23485 isValidName = args[0] instanceof _primitives.Name; 23486 name = args[0].name; 23487 23488 if (isValidName) { 23489 const localGStateObj = localGStateCache.getByName(name); 23490 23491 if (localGStateObj) { 23492 if (localGStateObj.length > 0) { 23493 operatorList.addOp(_util.OPS.setGState, [localGStateObj]); 23494 } 23495 23496 args = null; 23497 continue; 23498 } 23499 } 23500 23501 next(new Promise(function (resolveGState, rejectGState) { 23502 if (!isValidName) { 23503 throw new _util.FormatError("GState must be referred to by name."); 23504 } 23505
23506 const extGState = resources.get("ExtGState"); 23507 23508 if (!(extGState instanceof _primitives.Dict)) { 23509 throw new _util.FormatError("ExtGState should be a dictionary."); 23510 } 23511 23512 const gState = extGState.get(name); 23513 23514 if (!(gState instanceof _primitives.Dict)) { 23515 throw new _util.FormatError("GState should be a dictionary."); 23516 } 23517 23518 self.setGState({ 23519 resources, 23520 gState, 23521 operatorList, 23522 cacheKey: name, 23523 task, 23524 stateManager, 23525 localGStateCache, 23526 localColorSpaceCache 23527 }).then(resolveGState, rejectGState); 23528 }).catch(function (reason) { 23529 if (reason instanceof _util.AbortException) { 23530 return; 23531 } 23532 23533 if (self.options.ignoreErrors) { 23534 self.handler.send("UnsupportedFeature", { 23535 featureId: _util.UNSUPPORTED_FEATURES.errorExtGState 23536 }); 23537 (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`); 23538 return; 23539 } 23540 23541 throw reason; 23542 })); 23543 return; 23544 23545 case _util.OPS.moveTo: 23546 case _util.OPS.lineTo: 23547 case _util.OPS.curveTo: 23548 case _util.OPS.curveTo2: 23549 case _util.OPS.curveTo3: 23550 case _util.OPS.closePath: 23551 case _util.OPS.rectangle: 23552 self.buildPath(operatorList, fn, args, parsingText); 23553 continue; 23554 23555 case _util.OPS.markPoint: 23556 case _util.OPS.markPointProps: 23557 case _util.OPS.beginCompat: 23558 case _util.OPS.endCompat: 23559 continue; 23560 23561 case _util.OPS.beginMarkedContentProps: 23562 if (!(0, _primitives.isName)(args[0])) { 23563 (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`); 23564 continue; 23565 } 23566 23567 if (args[0].name === "OC") { 23568 next(self.parseMarkedContentProps(args[1], resources).then(data => { 23569 operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]); 23570 }).catch(reason => { 23571 if (reason instanceof _util.AbortException) { 23572 return; 23573 } 23574 23575 if (self.options.ignoreErrors) { 23576 self.handler.send("UnsupportedFeature", { 23577 featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent 23578 }); 23579 (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`); 23580 return; 23581 } 23582 23583 throw reason; 23584 })); 23585 return; 23586 } 23587 23588 args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null]; 23589 break; 23590 23591 case _util.OPS.beginMarkedContent: 23592 case _util.OPS.endMarkedContent: 23593 default: 23594 if (args !== null) { 23595 for (i = 0, ii = args.length; i < ii; i++) { 23596 if (args[i] instanceof _primitives.Dict) { 23597 break; 23598 } 23599 } 23600 23601 if (i < ii) { 23602 (0, _util.warn)("getOperatorList - ignoring operator: " + fn); 23603 continue; 23604 } 23605 } 23606 23607 } 23608 23609 operatorList.addOp(fn, args); 23610 } 23611 23612 if (stop) { 23613 next(deferred); 23614 return; 23615 } 23616 23617 closePendingRestoreOPS(); 23618 resolve(); 23619 }).catch(reason => { 23620 if (reason instanceof _util.AbortException) { 23621 return; 23622 } 23623 23624 if (this.options.ignoreErrors) { 23625 this.handler.send("UnsupportedFeature", { 23626 featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList 23627 }); 23628 (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`); 23629 closePendingRestoreOPS(); 23630 return; 23631 } 23632 23633 throw reason; 23634 }); 23635 } 23636 23637 getTextContent({ 23638 stream, 23639 task, 23640 resources, 23641 stateManager = null, 23642 normalizeWhitespace = false, 23643 combineTextItems = false, 23644 includeMarkedContent = false, 23645 sink, 23646 seenStyles = new Set() 23647 }) { 23648 resources = resources || _primitives.Dict.empty; 23649 stateManager = stateManager || new StateManager(new TextState()); 23650 const WhitespaceRegexp = /\s/g; 23651 const DiacriticRegExp = new RegExp("^\\p{Mn}$", "u"); 23652 const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)(); 23653 const textContent = { 23654 items: [], 23655 styles: Object.create(null) 23656 }; 23657 const textContentItem = { 23658 initialized: false, 23659 str: [], 23660 totalWidth: 0, 23661 totalHeight: 0, 23662 width: 0, 23663 height: 0, 23664 vertical: false, 23665 prevTransform: null, 23666 textAdvanceScale: 0, 23667 spaceInFlowMin: 0, 23668 spaceInFlowMax: 0, 23669 trackingSpaceMin: Infinity,
23670 negativeSpaceMax: -Infinity, 23671 transform: null, 23672 fontName: null, 23673 hasEOL: false 23674 }; 23675 const TRACKING_SPACE_FACTOR = 0.1; 23676 const NEGATIVE_SPACE_FACTOR = -0.2; 23677 const SPACE_IN_FLOW_MIN_FACTOR = 0.1; 23678 const SPACE_IN_FLOW_MAX_FACTOR = 0.6; 23679 const self = this; 23680 const xref = this.xref; 23681 const showSpacedTextBuffer = []; 23682 let xobjs = null; 23683 const emptyXObjectCache = new _image_utils.LocalImageCache(); 23684 const emptyGStateCache = new _image_utils.LocalGStateCache(); 23685 const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 23686 let textState; 23687 23688 function getCurrentTextTransform() { 23689 const font = textState.font; 23690 const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise]; 23691 23692 if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) { 23693 const glyphHeight = font.bbox[3] - font.bbox[1]; 23694 23695 if (glyphHeight > 0) { 23696 tsm[3] *= glyphHeight * textState.fontMatrix[3]; 23697 } 23698 } 23699 23700 return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm)); 23701 } 23702 23703 function ensureTextContentItem() { 23704 if (textContentItem.initialized) { 23705 return textContentItem; 23706 } 23707 23708 const font = textState.font, 23709 loadedName = font.loadedName; 23710 23711 if (!seenStyles.has(loadedName)) { 23712 seenStyles.add(loadedName); 23713 textContent.styles[loadedName] = { 23714 fontFamily: font.fallbackName, 23715 ascent: font.ascent, 23716 descent: font.descent, 23717 vertical: font.vertical 23718 }; 23719 } 23720 23721 textContentItem.fontName = loadedName; 23722 const trm = textContentItem.transform = getCurrentTextTransform(); 23723 23724 if (!font.vertical) { 23725 textContentItem.width = textContentItem.totalWidth = 0; 23726 textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]); 23727 textContentItem.vertical = false;
23728 } else { 23729 textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]); 23730 textContentItem.height = textContentItem.totalHeight = 0; 23731 textContentItem.vertical = true; 23732 } 23733 23734 const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]); 23735 const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]); 23736 textContentItem.textAdvanceScale = scaleCtmX * scaleLineX; 23737 textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR; 23738 textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR; 23739 textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR; 23740 textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR; 23741 textContentItem.hasEOL = false; 23742 textContentItem.initialized = true; 23743 return textContentItem; 23744 } 23745 23746 function updateAdvanceScale() { 23747 if (!textContentItem.initialized) { 23748 return; 23749 } 23750 23751 const scaleLineX = Math.hypot(textState.textLineMatr
23751ix[0], textState.textLineMatrix[1]); 23752 const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]); 23753 const scaleFactor = scaleCtmX * scaleLineX; 23754 23755 if (scaleFactor === textContentItem.textAdvanceScale) { 23756 return; 23757 } 23758 23759 if (!textContentItem.vertical) { 23760 textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale; 23761 textContentItem.width = 0; 23762 } else { 23763 textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale; 23764 textContentItem.height = 0; 23765 } 23766 23767 textContentItem.textAdvanceScale = scaleFactor; 23768 } 23769 23770 function replaceWhitespace(str) { 23771 const ii = str.length; 23772 let i = 0, 23773 code; 23774 23775 while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7f) { 23776 i++; 23777 } 23778 23779 return i < ii ? str.replace(WhitespaceRegexp, " ") : str; 23780 } 23781 23782 function runBidiTransform(textChunk) { 23783 const text = textChunk.str.join(""); 23784 const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical); 23785 const str = normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str; 23786 return { 23787 str, 23788 dir: bidiResult.dir, 23789 width: textChunk.totalWidth, 23790 height: textChunk.totalHeight, 23791 transform: textChunk.transform, 23792 fontName: textChunk.fontName, 23793 hasEOL: textChunk.hasEOL 23794 }; 23795 } 23796 23797 function handleSetFont(fontName, fontRef) { 23798 return self.loadFont(fontName, fontRef, resources).then(function (translated) { 23799 if (!translated.font.isType3Font) { 23800 return translated; 23801 } 23802 23803 return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () { 23804 return translated; 23805 }); 23806 }).then(function (translated) { 23807 textState.font = translated.font; 23808 textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX; 23809 }); 23810 } 23811 23812 function compareWithLastPosition() { 23813 if (!combineTextItems || !textState.font || !textContentItem.prevTransform) { 23814 return; 23815 } 23816 23817 const currentTransform = getCurrentTextTransform(); 23818 let posX = currentTransform[4]; 23819 let posY = currentTransform[5]; 23820 let lastPosX = textContentItem.prevTransform[4]; 23821 let lastPosY = textContentItem.prevTransform[5]; 23822 23823 if (lastPosX === posX && lastPosY === posY) { 23824 return; 23825 } 23826 23827 let rotate = 0; 23828 23829 if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) { 23830 rotate = currentTransform[0] > 0 ? 0 : 180; 23831 } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) { 23832 rotate += currentTransform[1] > 0 ? 90 : 270; 23833 } 23834 23835 if (rotate !== 0) { 23836 switch (rotate) { 23837 case 90: 23838 [posX, posY] = [posY, posX]; 23839 [lastPosX, lastPosY] = [lastPosY, lastPosX]; 23840 break; 23841 23842 case 180: 23843 [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY]; 23844 break; 23845 23846 case 270: 23847 [posX, posY] = [-posY, -posX]; 23848 [lastPosX, lastPosY] = [-lastPosY, -lastPosX]; 23849 break; 23850 } 23851 } 23852 23853 if (textState.font.vertical) { 23854 const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale; 23855 const advanceX = posX - lastPosX; 23856 23857 if (advanceY < textContentItem.negativeSpaceMax) { 23858 if (Math.abs(advanceX) > 0.5 * textContentItem.width) { 23859 appendEOL(); 23860 return; 23861 } 23862 23863 flushTextContentItem(); 23864 return; 23865 } 23866 23867 if (Math.abs(advanceX) > textContentItem.height) { 23868 appendEOL(); 23869 return; 23870 } 23871 23872 if (advanceY <= textContentItem.trackingSpaceMin) { 23873 textContentItem.height += advanceY; 23874 } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform)) { 23875 if (textContentItem.str.length === 0) { 23876 textContent.items.push({ 23877 str: " ", 23878 dir: "ltr", 23879 width: 0, 23880 height: advanceY, 23881 transform: textContentItem.prevTransform, 23882 fontName: textContentItem.fontName, 23883 hasEOL: false 23884 }); 23885 } else { 23886 textContentItem.height += advanceY; 23887 } 23888 } 23889 23890 return; 23891 } 23892 23893 const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale; 23894 const advanceY = posY - lastPosY; 23895
23896 if (advanceX < textContentItem.negativeSpaceMax) { 23897 if (Math.abs(advanceY) > 0.5 * textContentItem.height) { 23898 appendEOL(); 23899 return; 23900 } 23901 23902 flushTextContentItem(); 23903 return; 23904 } 23905 23906 if (Math.abs(advanceY) > textContentItem.height) { 23907 appendEOL(); 23908 return; 23909 } 23910 23911 if (advanceX <= textContentItem.trackingSpaceMin) { 23912 textContentItem.width += advanceX; 23913 } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform)) { 23914 if (textContentItem.str.length === 0) { 23915 textContent.items.push({ 23916 str: " ", 23917 dir: "ltr", 23918 width: advanceX, 23919 height: 0, 23920 transform: textContentItem.prevTransform, 23921 fontName: textContentItem.fontName, 23922 hasEOL: false 23923 }); 23924 } else { 23925 textContentItem.width += advanceX; 23926 } 23927 } 23928 } 23929 23930 function buildTextContentItem({ 23931 chars, 23932 extraSpacing 23933 }) { 23934 const font = textState.font; 23935 23936 if (!chars) { 23937 const charSpacing = textState.charSpacing + extraSpacing; 23938 23939 if (charSpacing) { 23940 if (!font.vertical) { 23941 textState.translateTextMatrix(charSpacing * textState.textHScale, 0); 23942 } else { 23943 textState.translateTextMatrix(0, -charSpacing); 23944 } 23945 } 23946 23947 return; 23948 } 23949 23950 const glyphs = font.charsToGlyphs(chars); 23951 const scale = textState.fontMatrix[0] * textState.fontSize; 23952 23953 for (let i = 0, ii = glyphs.length; i < ii; i++) { 23954 const glyph = glyphs[i]; 23955 let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0); 23956 let glyphWidth = glyph.width; 23957 23958 if (font.vertical) { 23959 glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth; 23960 } 23961 23962 let scaledDim = glyphWidth * scale; 23963 let glyphUnicode = glyph.unicode; 23964 23965 if (glyphUnicode === " " && (i === 0 || i + 1 === ii || glyphs[i - 1].unicode === " " || glyphs[i + 1].unicode === " " || extraSpacing)) { 23966 if (!font.vertical) { 23967 charSpacing += scaledDim + textState.wordSpacing; 23968 textState.translateTextMatrix(charSpacing * textState.textHScale, 0); 23969 } else { 23970 charSpacing += -scaledDim + textState.wordSpacing; 23971 textState.translateTextMatrix(0, -charSpacing); 23972 } 23973 23974 continue; 23975 } 23976 23977 compareWithLastPosition(); 23978 const textChunk = ensureTextContentItem(); 23979 23980 if (DiacriticRegExp.test(glyph.unicode)) { 23981 scaledDim = 0; 23982 } 23983 23984 if (!font.vertical) { 23985 scaledDim *= textState.textHScale; 23986 textState.translateTextMatrix(scaledDim, 0); 23987 textChunk.width += scaledDim; 23988 } else { 23989 textState.translateTextMatrix(0, scaledDim); 23990 scaledDim = Math.abs(scaledDim); 23991 textChunk.height += scaledDim; 23992 } 23993 23994 if (scaledDim) { 23995 textChunk.prevTransform = getCurrentTextTransform(); 23996 } 23997 23998 glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode; 23999 glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode); 24000 textChunk.str.push(glyphUnicode); 24001 24002 if (charSpacing) { 24003 if (!font.vertical) { 24004 textState.translateTextMatrix(charSpacing * textState.textHScale, 0); 24005 } else { 24006 textState.translateTextMatrix(0, -charSpacing); 24007 } 24008 } 24009 } 24010 } 24011 24012 function appendEOL() { 24013 if (textContentItem.initialized) { 24014 textContentItem.hasEOL = true; 24015 flushTextContentItem(); 24016 } else { 24017 textContent.items.push({ 24018 str: "", 24019 dir: "ltr", 24020 width: 0, 24021 height: 0, 24022 transform: getCurrentTextTransform(), 24023 fontName: textState.font.loadedName, 24024 hasEOL: true 24025 }); 24026 } 24027 } 24028 24029 function addFakeSpaces(width, transf) { 24030 if (textContentItem.spaceInFlowMin <= width && width <= textContentItem.spaceInFlowMax) { 24031 if (textContentItem.initialized) { 24032 textContentItem.str.push(" "); 24033 } 24034 24035 return false;
24036 } 24037 24038 const fontName = textContentItem.fontName; 24039 let height = 0; 24040 24041 if (textContentItem.vertical) { 24042 height = width; 24043 width = 0; 24044 } 24045 24046 flushTextContentItem(); 24047 textContent.items.push({ 24048 str: " ", 24049 dir: "ltr", 24050 width, 24051 height, 24052 transform: transf || getCurrentTextTransform(), 24053 fontName, 24054 hasEOL: false 24055 }); 24056 return true; 24057 } 24058 24059 function flushTextContentItem() { 24060 if (!textContentItem.initialized || !textContentItem.str) { 24061 return; 24062 } 24063 24064 if (!textContentItem.vertical) { 24065 textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale; 24066 } else { 24067 textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale; 24068 } 24069 24070 textContent.items.push(runBidiTransform(textContentItem)); 24071 textContentItem.initialized = false; 24072 textContentItem.str.length = 0; 24073 } 24074 24075 function enqueueChunk(batch = false) { 24076 const length = textContent.items.length; 24077 24078 if (length === 0) { 24079 return; 24080 } 24081 24082 if (batch && length < TEXT_CHUNK_BATCH_SIZE) { 24083 return; 24084 } 24085 24086 sink.enqueue(textContent, length); 24087 textContent.items = []; 24088 textContent.styles = Object.create(null); 24089 } 24090 24091 const timeSlotManager = new TimeSlotManager(); 24092 return new Promise(function promiseBody(resolve, reject) { 24093 const next = function (promise) { 24094 enqueueChunk(true); 24095 Promise.all([promise, sink.ready]).then(function () { 24096 try { 24097 promiseBody(resolve, reject); 24098 } catch (ex) { 24099 reject(ex); 24100 } 24101 }, reject); 24102 }; 24103 24104 task.ensureNotTerminated(); 24105 timeSlotManager.reset(); 24106 const operation = {}; 24107 let stop, 24108 args = []; 24109 24110 while (!(stop = timeSlotManager.check())) { 24111 args.length = 0; 24112 operation.args = args; 24113 24114 if (!preprocessor.read(operation)) { 24115 break; 24116 } 24117 24118 textState = stateManager.state; 24119 const fn = operation.fn; 24120 args = operation.args; 24121 24122 switch (fn | 0) { 24123 case _util.OPS.setFont: 24124 var fontNameArg = args[0].name, 24125 fontSizeArg = args[1]; 24126 24127 if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) { 24128 break; 24129 } 24130 24131 flushTextContentItem(); 24132 textState.fontName = fontNameArg; 24133 textState.fontSize = fontSizeArg; 24134 next(handleSetFont(fontNameArg, null)); 24135 return; 24136 24137 case _util.OPS.setTextRise: 24138 textState.textRise = args[0]; 24139 break; 24140 24141 case _util.OPS.setHScale: 24142 textState.textHScale = args[0] / 100; 24143 break; 24144 24145 case _util.OPS.setLeading: 24146 textState.leading = args[0]; 24147 break; 24148 24149 case _util.OPS.moveText: 24150 textState.translateTextLineMatrix(args[0], args[1]);
24151 textState.textMatrix = textState.textLineMatrix.slice(); 24152 break; 24153 24154 case _util.OPS.setLeadingMoveText: 24155 textState.leading = -args[1]; 24156 textState.translateTextLineMatrix(args[0], args[1]); 24157 textState.textMatrix = textState.textLineMatrix.slice(); 24158 break; 24159 24160 case _util.OPS.nextLine: 24161 textState.carriageReturn(); 24162 break; 24163 24164 case _util.OPS.setTextMatrix: 24165 textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 24166 textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 24167 updateAdvanceScale(); 24168 break; 24169 24170 case _util.OPS.setCharSpacing: 24171 textState.charSpacing = args[0]; 24172 break; 24173 24174 case _util.OPS.setWordSpacing: 24175 textState.wordSpacing = args[0]; 24176 break; 24177 24178 case _util.OPS.beginText: 24179 textState.textMatrix = _util.IDENTITY_MATRIX.slice(); 24180 textState.textLineMatr
24180ix = _util.IDENTITY_MATRIX.slice(); 24181 break; 24182 24183 case _util.OPS.showSpacedText: 24184 if (!stateManager.state.font) { 24185 self.ensureStateFont(stateManager.state); 24186 continue; 24187 } 24188 24189 const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000; 24190 const elements = args[0]; 24191 24192 for (let i = 0, ii = elements.length; i < ii - 1; i++) { 24193 const item = elements[i]; 24194 24195 if (typeof item === "string") { 24196 showSpacedTextBuffer.push(item); 24197 } else if (typeof item === "number" && item !== 0) { 24198 const str = showSpacedTextBuffer.join(""); 24199 showSpacedTextBuffer.length = 0; 24200 buildTextContentItem({ 24201 chars: str, 24202 extraSpacing: item * spaceFactor 24203 }); 24204 } 24205 } 24206 24207 const item = elements[elements.length - 1]; 24208 24209 if (typeof item === "string") { 24210 showSpacedTextBuffer.push(item); 24211 } 24212 24213 if (showSpacedTextBuffer.length > 0) { 24214 const str = showSpacedTextBuffer.join(""); 24215 showSpacedTextBuffer.length = 0; 24216 buildTextContentItem({ 24217 chars: str, 24218 extraSpacing: 0 24219 }); 24220 } 24221 24222 break; 24223 24224 case _util.OPS.showText: 24225 if (!stateManager.state.font) { 24226 self.ensureStateFont(stateManager.state); 24227 continue; 24228 } 24229 24230 buildTextContentItem({ 24231 chars: args[0], 24232 extraSpacing: 0 24233 }); 24234 break; 24235 24236 case _util.OPS.nextLineShowText: 24237 if (!stateManager.state.font) { 24238 self.ensureStateFont(stateManager.state); 24239 continue; 24240 } 24241 24242 textState.carriageReturn(); 24243 buildTextContentItem({ 24244 chars: args[0], 24245 extraSpacing: 0 24246 }); 24247 break; 24248 24249 case _util.OPS.nextLineSetSpacingShowText: 24250 if (!stateManager.state.font) { 24251 self.ensureStateFont(stateManager.state); 24252 continue; 24253 } 24254 24255 textState.wordSpacing = args[0]; 24256 textState.charSpacing = args[1]; 24257 textState.carriageReturn(); 24258 buildTextContentItem({ 24259 chars: args[2], 24260 extraSpacing: 0 24261 }); 24262 break; 24263 24264 case _util.OPS.paintXObject: 24265 flushTextContentItem(); 24266 24267 if (!xobjs) { 24268 xobjs = resources.get("XObject") || _primitives.Dict.empty; 24269 } 24270 24271 var isValidName = args[0] instanceof _primitives.Name; 24272 var name = args[0].name; 24273 24274 if (isValidName && emptyXObjectCache.getByName(name)) { 24275 break; 24276 } 24277 24278 next(new Promise(function (resolveXObject, rejectXObject) { 24279 if (!isValidName) { 24280 throw new _util.FormatError("XObject must be referred to by name."); 24281 } 24282 24283 let xobj = xobjs.getRaw(name); 24284 24285 if (xobj instanceof _primitives.Ref) { 24286 if (emptyXObjectCache.getByRef(xobj)) { 24287 resolveXObject(); 24288 return; 24289 } 24290 24291 const globalImage = self.globalImageCache.getData(xobj, self.pageIndex); 24292 24293 if (globalImage) { 24294 resolveXObject(); 24295 return; 24296 } 24297 24298 xobj = xref.fetch(xobj); 24299 } 24300 24301 if (!(0, _primitives.isStream)(xobj)) { 24302 throw new _util.FormatError("XObject should be a stream"); 24303 } 24304 24305 const type = xobj.dict.get("Subtype"); 24306 24307 if (!(0, _primitives.isName)(type)) { 24308 throw new _util.FormatError("XObject should have a Name subtype"); 24309 } 24310 24311 if (type.name !== "Form") { 24312 emptyXObjectCache.set(name, xobj.dict.objId, true); 24313 resolveXObject(); 24314 return; 24315 } 24316 24317 const currentState = stateManager.state.clone(); 24318 const xObjStateManager = new StateManager(currentState); 24319 const matrix = xobj.dict.getArray("Matrix"); 24320 24321 if (Array.isArray(matrix) && matrix.length === 6) { 24322 xObjStateManager.transform(matrix); 24323 } 24324 24325 enqueueChunk(); 24326 const sinkWrapper = {
24327 enqueueInvoked: false, 24328 24329 enqueue(chunk, size) { 24330 this.enqueueInvoked = true; 24331 sink.enqueue(chunk, size); 24332 }, 24333 24334 get desiredSize() { 24335 return sink.desiredSize; 24336 }, 24337 24338 get ready() { 24339 return sink.ready; 24340 } 24341 24342 }; 24343 self.getTextContent({ 24344 stream: xobj, 24345 task, 24346 resources: xobj.dict.get("Resources") || resources, 24347 stateManager: xObjStateManager, 24348 normalizeWhitespace, 24349 combineTextItems, 24350 includeMarkedContent, 24351 sink: sinkWrapper, 24352 seenStyles 24353 }).then(function () { 24354 if (!sinkWrapper.enqueueInvoked) { 24355 emptyXObjectCache.set(name, xobj.dict.objId, true); 24356 } 24357 24358 resolveXObject(); 24359 }, rejectXObject); 24360 }).catch(function (reason) { 24361 if (reason instanceof _util.AbortException) { 24362 return; 24363 } 24364 24365 if (self.options.ignoreErrors) { 24366 (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`); 24367 return; 24368 } 24369 24370 throw reason; 24371 })); 24372 return; 24373 24374 case _util.OPS.setGState: 24375 isValidName = args[0] instanceof _primitives.Name; 24376 name = args[0].name; 24377 24378 if (isValidName && emptyGStateCache.getByName(name)) { 24379 break; 24380 } 24381 24382 next(new Promise(function (resolveGState, rejectGState) { 24383 if (!isValidName) { 24384 throw new _util.FormatError("GState must be referred to by name."); 24385 } 24386 24387 const extGState = resources.get("ExtGState"); 24388 24389 if (!(extGState instanceof _primitives.Dict)) { 24390 throw new _util.FormatError("ExtGState should be a dictionary."); 24391 } 24392 24393 const gState = extGState.get(name); 24394 24395 if (!(gState instanceof _primitives.Dict)) { 24396 throw new _util.FormatError("GState should be a dictionary."); 24397 } 24398 24399 const gStateFont = gState.get("Font"); 24400 24401 if (!gStateFont) { 24402 emptyGStateCache.set(name, gState.objId, true); 24403 resolveGState(); 24404 return; 24405 } 24406 24407 flushTextContentItem(); 24408 textState.fontName = null; 24409 textState.fontSize = gStateFont[1]; 24410 handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState); 24411 }).catch(function (reason) { 24412 if (reason instanceof _util.AbortException) { 24413 return; 24414 } 24415 24416 if (self.options.ignoreErrors) { 24417 (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`); 24418 return; 24419 } 24420 24421 throw reason; 24422 })); 24423 return; 24424 24425 case _util.OPS.beginMarkedContent: 24426 if (includeMarkedContent) { 24427 textContent.items.push({ 24428 type: "beginMarkedContent", 24429 tag: (0, _primitives.isName)(args[0]) ? args[0].name : null 24430 }); 24431 } 24432 24433 break; 24434 24435 case _util.OPS.beginMarkedContentProps: 24436 if (includeMarkedContent) { 24437 flushTextContentItem(); 24438 let mcid = null; 24439 24440 if ((0, _primitives.isDict)(args[1])) { 24441 mcid = args[1].get("MCID"); 24442 } 24443 24444 textContent.items.push({ 24445 type: "beginMarkedContentProps", 24446 id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null, 24447 tag: (0, _primitives.isName)(args[0]) ? args[0].name : null 24448 }); 24449 } 24450 24451 break; 24452 24453 case _util.OPS.endMarkedContent: 24454 if (includeMarkedContent) { 24455 flushTextContentItem(); 24456 textContent.items.push({ 24457 type: "endMarkedContent" 24458 }); 24459 } 24460 24461 break; 24462 } 24463 24464 if (textContent.items.length >= sink.desiredSize) { 24465 stop = true; 24466 break; 24467 } 24468 } 24469 24470 if (stop) { 24471 next(deferred); 24472 return; 24473 } 24474 24475 flushTextContentItem(); 24476 enqueueChunk(); 24477 resolve(); 24478 }).catch(reason => { 24479 if (reason instanceof _util.AbortException) { 24480 return; 24481 } 24482 24483 if (this.options.ignoreErrors) { 24484 (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`); 24485 flushTextContentItem(); 24486 enqueueChunk(); 24487 return; 24488 } 24489 24490 throw reason; 24491 }); 24492 } 24493 24494 extractDataStructures(dict, baseDict, properties) { 24495 const xref = this.xref;
24496 let cidToGidBytes; 24497 const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode")); 24498 24499 if (properties.composite) { 24500 const cidSystemInfo = dict.get("CIDSystemInfo"); 24501 24502 if ((0, _primitives.isDict)(cidSystemInfo)) { 24503 properties.cidSystemInfo = { 24504 registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")), 24505 ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")), 24506 supplement: cidSystemInfo.get("Supplement") 24507 }; 24508 } 24509 24510 const cidToGidMap = dict.get("CIDToGIDMap"); 24511 24512 if (cidToGidMap instanceof _base_stream.BaseStream) { 24513 cidToGidBytes = cidToGidMap.getBytes(); 24514 } 24515 } 24516 24517 const differences = []; 24518 let baseEncodingName = null; 24519 let encoding; 24520 24521 if (dict.has("Encoding")) { 24522 encoding = dict.get("Encoding"); 24523 24524 if ((0, _primitives.isDict)(encoding)) { 24525 baseEncodingName = encoding.get("BaseEncoding"); 24526 baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null; 24527 24528 if (encoding.has("Differences")) { 24529 const diffEncoding = encoding.get("Differences"); 24530 let index = 0; 24531 24532 for (let j = 0, jj = diffEncoding.length; j < jj; j++) { 24533 const data = xref.fetchIfRef(diffEncoding[j]); 24534 24535 if ((0, _util.isNum)(data)) { 24536 index = data; 24537 } else if ((0, _primitives.isName)(data)) { 24538 differences[index++] = data.name; 24539 } else { 24540 throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`); 24541 } 24542 } 24543 } 24544 } else if ((0, _primitives.isName)(encoding)) { 24545 baseEncodingName = encoding.name; 24546 } else { 24547 throw new _util.FormatError("Encoding is not a Name nor a Dict"); 24548 } 24549 24550 if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") { 24551 baseEncodingName = null; 24552 } 24553 } 24554 24555 if (baseEncodingName) { 24556 properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName); 24557 } else { 24558 const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic); 24559 const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic); 24560 encoding = _encodings.StandardEncoding; 24561 24562 if (properties.type === "TrueType" && !isNonsymbolicFont) { 24563 encoding = _encodings.WinAnsiEncoding; 24564 } 24565 24566 if (isSymbolicFont) { 24567 encoding = _encodings.MacRomanEncoding; 24568 24569 if (!properties.file || properties.isInternalFont) { 24570 if (/Symbol/i.test(properties.name)) { 24571 encoding = _encodings.SymbolSetEncoding; 24572 } else if (/Dingbats|Wingdings/i.test(properties.name)) { 24573 encoding = _encodings.ZapfDingbatsEncoding; 24574 } 24575 } 24576 } 24577 24578 properties.defaultEncoding = encoding; 24579 } 24580 24581 properties.differences = differences; 24582 properties.baseEncodingName = baseEncodingName; 24583 properties.hasEncoding = !!baseEncodingName || differences.length > 0; 24584 properties.dict = dict; 24585 return toUnicodePromise.then(readToUnicode => { 24586 properties.toUnicode = readToUnicode; 24587 return this.buildToUnicode(properties); 24588 }).then(builtToUnicode => { 24589 properties.toUnicode = builtToUnicode; 24590 24591 if (cidToGidBytes) { 24592 properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode); 24593 } 24594 24595 return properties; 24596 }); 24597 } 24598 24599 _simpleFontToUnicode(properties, forceGlyphs = false) { 24600 (0, _util.assert)(!properties.composite, "Must be a simple font."); 24601 const toUnicode = []; 24602 const encoding = properties.defaultEncoding.slice(); 24603 const baseEncodingName = properties.baseEncodingName; 24604 const differences = properties.differences; 24605 24606 for (const charcode in differences) { 24607 const glyphName = differences[charcode]; 24608 24609 if (glyphName === ".notdef") { 24610 continue; 24611 } 24612 24613 encoding[charcode] = glyphName; 24614 } 24615 24616 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 24617 24618 for (const charcode in encoding) { 24619 let glyphName = encoding[charcode]; 24620 24621 if (glyphName === "") { 24622 continue; 24623 } else if (glyphsUnicodeMap[glyphName] === undefined) { 24624 let code = 0; 24625 24626 switch (glyphName[0]) { 24627 case "G": 24628 if (glyphName.length === 3) { 24629 code = parseInt(glyphName.substring(1), 16); 24630 } 24631 24632 break; 24633 24634 case "g": 24635 if (glyphName.length === 5) { 24636 code = parseInt(glyphName.substring(1), 16); 24637 } 24638 24639 break; 24640 24641 case "C": 24642 case "c": 24643 if (glyphName.length >= 3 && glyphName.length <= 4) { 24644 const codeStr = glyphName.substring(1); 24645 24646 if (forceGlyphs) { 24647 code = parseInt(codeStr, 16); 24648 break; 24649 } 24650 24651 code = +codeStr; 24652 24653 if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) { 24654 return this._simpleFontToUnicode(properties, true); 24655 } 24656 } 24657 24658 break; 24659 24660 default: 24661 const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 24662 24663 if (unicode !== -1) { 24664 code = unicode; 24665 } 24666 24667 } 24668 24669 if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) { 24670 if (baseEncodingName && code === +charcode) { 24671 const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName); 24672 24673 if (baseEncoding && (glyphName = baseEncoding[charcode])) { 24674 toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); 24675 continue; 24676 } 24677 } 24678 24679 toUnicode[charcode] = String.fromCodePoint(code); 24680 } 24681 24682 continue; 24683 } 24684 24685 toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); 24686 } 24687 24688 return toUnicode; 24689 } 24690 24691 async buildToUnicode(properties) { 24692 properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0; 24693 24694 if (properties.hasIncludedToUnicodeMap) { 24695 if (!properties.composite && properties.hasEncoding) { 24696 properties.fallbackToUnicode = this._simpleFontToUnicode(properties); 24697 } 24698 24699 return properties.toUnicode; 24700 } 24701 24702 if (!properties.composite) { 24703 return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties)); 24704 } 24705 24706 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"))) { 24707 const { 24708 registry, 24709 ordering 24710 } = properties.cidSystemInfo; 24711 24712 const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`); 24713 24714 const ucs2CMap = await _cmap.CMapFactory.create({ 24715 encoding: ucs2CMapName, 24716 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 24717 useCMap: null 24718 }); 24719 const toUnicode = [];
24720 properties.cMap.forEach(function (charcode, cid) { 24721 if (cid > 0xffff) { 24722 throw new _util.FormatError("Max size of CID is 65,535"); 24723 } 24724 24725 const ucs2 = ucs2CMap.lookup(cid); 24726 24727 if (ucs2) { 24728 toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1)); 24729 } 24730 }); 24731 return new _to_unicode_map.ToUnicodeMap(toUnicode); 24732 } 24733 24734 return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar); 24735 } 24736 24737 readToUnicode(cmapObj) { 24738 if (!cmapObj) { 24739 return Promise.resolve(null); 24740 } 24741 24742 if ((0, _primitives.isName)(cmapObj)) { 24743 return _cmap.CMapFactory.create({ 24744 encoding: cmapObj, 24745 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 24746 useCMap: null 24747 }).then(function (cmap) { 24748 if (cmap instanceof _cmap.IdentityCMap) { 24749 return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff); 24750 } 24751 24752 return new _to_unicode_map.ToUnicodeMap(cmap.getMap()); 24753 }); 24754 } else if ((0, _primitives.isStream)(cmapObj)) { 24755 return _cmap.CMapFactory.create({ 24756 encoding: cmapObj, 24757 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 24758 useCMap: null 24759 }).then(function (cmap) { 24760 if (cmap instanceof _cmap.IdentityCMap) { 24761 return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff); 24762 } 24763 24764 const map = new Array(cmap.length); 24765 cmap.forEach(function (charCode, token) { 24766 if (typeof token === "number") { 24767 map[charCode] = String.fromCodePoint(token); 24768 return; 24769 } 24770 24771 const str = []; 24772 24773 for (let k = 0; k < token.length; k += 2) {
24774 const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 24775 24776 if ((w1 & 0xf800) !== 0xd800) { 24777 str.push(w1); 24778 continue; 24779 } 24780 24781 k += 2; 24782 const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 24783 str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000); 24784 } 24785 24786 map[charCode] = String.fromCodePoint.apply(String, str); 24787 }); 24788 return new _to_unicode_map.ToUnicodeMap(map); 24789 }, reason => { 24790 if (reason instanceof _util.AbortException) { 24791 return null; 24792 } 24793 24794 if (this.options.ignoreErrors) { 24795 this.handler.send("UnsupportedFeature", { 24796 featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode 24797 }); 24798 (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`); 24799 return null; 24800 } 24801 24802 throw reason; 24803 }); 24804 } 24805 24806 return Promise.resolve(null); 24807 } 24808 24809 readCidToGidMap(glyphsData, toUnicode) { 24810 const result = []; 24811 24812 for (let j = 0, jj = glyphsData.length; j < jj; j++) { 24813 const glyphID = glyphsData[j++] << 8 | glyphsData[j]; 24814 const code = j >> 1; 24815 24816 if (glyphID === 0 && !toUnicode.has(code)) { 24817 continue; 24818 } 24819 24820 result[code] = glyphID; 24821 } 24822 24823 return result; 24824 } 24825 24826 extractWidths(dict, descriptor, properties) { 24827 const xref = this.xref; 24828 let glyphsWidths = []; 24829 let defaultWidth = 0; 24830 const glyphsVMetrics = []; 24831 let defaultVMetrics; 24832 let i, ii, j, jj, start, code, widths; 24833 24834 if (properties.composite) { 24835 defaultWidth = dict.has("DW") ? dict.get("DW") : 1000; 24836 widths = dict.get("W"); 24837 24838 if (widths) { 24839 for (i = 0, ii = widths.length; i < ii; i++) { 24840 start = xref.fetchIfRef(widths[i++]); 24841 code = xref.fetchIfRef(widths[i]); 24842 24843 if (Array.isArray(code)) { 24844 for (j = 0, jj = code.length; j < jj; j++) { 24845 glyphsWidths[start++] = xref.fetchIfRef(code[j]); 24846 } 24847 } else { 24848 const width = xref.fetchIfRef(widths[++i]); 24849 24850 for (j = start; j <= code; j++) { 24851 glyphsWidths[j] = width; 24852 } 24853 } 24854 } 24855 } 24856 24857 if (properties.vertical) { 24858 let vmetrics = dict.getArray("DW2") || [880, -1000]; 24859 defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]]; 24860 vmetrics = dict.get("W2"); 24861 24862 if (vmetrics) { 24863 for (i = 0, ii = vmetrics.length; i < ii; i++) { 24864 start = xref.fetchIfRef(vmetrics[i++]); 24865 code = xref.fetchIfRef(vmetrics[i]); 24866 24867 if (Array.isArray(code)) { 24868 for (j = 0, jj = code.length; j < jj; j++) { 24869 glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])]; 24870 } 24871 } else { 24872 const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])]; 24873 24874 for (j = start; j <= code; j++) { 24875 glyphsVMetrics[j] = vmetric; 24876 } 24877 } 24878 } 24879 } 24880 } 24881 } else { 24882 const firstChar = properties.firstChar; 24883 widths = dict.get("Widths"); 24884 24885 if (widths) { 24886 j = firstChar; 24887 24888 for (i = 0, ii = widths.length; i < ii; i++) { 24889 glyphsWidths[j++] = xref.fetchIfRef(widths[i]); 24890 } 24891 24892 defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0; 24893 } else { 24894 const baseFontName = dict.get("BaseFont"); 24895 24896 if ((0, _primitives.isName)(baseFontName)) { 24897 const metrics = this.getBaseFontMetrics(baseFontName.name); 24898 glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties); 24899 defaultWidth = metrics.defaultWidth; 24900 } 24901 } 24902 } 24903 24904 let isMonospace = true; 24905 let firstWidth = defaultWidth; 24906 24907 for (const glyph in glyphsWidths) { 24908 const glyphWidth = glyphsWidths[glyph]; 24909 24910 if (!glyphWidth) { 24911 continue; 24912 } 24913 24914 if (!firstWidth) { 24915 firstWidth = glyphWidth; 24916 continue; 24917 } 24918 24919 if (firstWidth !== glyphWidth) { 24920 isMonospace = false;
24921 break; 24922 } 24923 } 24924 24925 if (isMonospace) { 24926 properties.flags |= _fonts_utils.FontFlags.FixedPitch; 24927 } 24928 24929 properties.defaultWidth = defaultWidth; 24930 properties.widths = glyphsWidths; 24931 properties.defaultVMetrics = defaultVMetrics; 24932 properties.vmetrics = glyphsVMetrics; 24933 } 24934 24935 isSerifFont(baseFontName) { 24936 const fontNameWoStyle = baseFontName.split("-")[0]; 24937 return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1; 24938 } 24939 24940 getBaseFontMetrics(name) { 24941 let defaultWidth = 0; 24942 let widths = Object.create(null); 24943 let monospace = false; 24944 const stdFontMap = (0, _standard_fonts.getStdFontMap)(); 24945 let lookupName = stdFontMap[name] || name; 24946 const Metrics = (0, _metrics.getMetrics)(); 24947 24948 if (!(lookupName in Metrics)) { 24949 if (this.isSerifFont(name)) { 24950 lookupName = "Times-Roman"; 24951 } else { 24952 lookupName = "Helvetica"; 24953 } 24954 } 24955 24956 const glyphWidths = Metrics[lookupName]; 24957 24958 if ((0, _util.isNum)(glyphWidths)) { 24959 defaultWidth = glyphWidths; 24960 monospace = true; 24961 } else { 24962 widths = glyphWidths(); 24963 } 24964 24965 return { 24966 defaultWidth, 24967 monospace, 24968 widths 24969 }; 24970 } 24971 24972 buildCharCodeToWidth(widthsByGlyphName, properties) { 24973 const widths = Object.create(null); 24974 const differences = properties.differences; 24975 const encoding = properties.defaultEncoding; 24976 24977 for (let charCode = 0; charCode < 256; charCode++) { 24978 if (charCode in differences && widthsByGlyphName[differences[charCode]]) { 24979 widths[charCode] = widthsByGlyphName[differences[charCode]]; 24980 continue; 24981 } 24982 24983 if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) { 24984 widths[charCode] = widthsByGlyphName[encoding[charCode]]; 24985 continue; 24986 } 24987 } 24988 24989 return widths; 24990 } 24991 24992 preEvaluateFont(dict) { 24993 const baseDict = dict; 24994 let type = dict.get("Subtype"); 24995 24996 if (!(0, _primitives.isName)(type)) { 24997 throw new _util.FormatError("invalid font Subtype"); 24998 } 24999 25000 let composite = false; 25001 let hash, toUnicode; 25002 25003 if (type.name === "Type0") { 25004 const df = dict.get("DescendantFonts"); 25005 25006 if (!df) { 25007 throw new _util.FormatError("Descendant fonts are not specified"); 25008 } 25009 25010 dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df; 25011 25012 if (!(dict instanceof _primitives.Dict)) { 25013 throw new _util.FormatError("Descendant font is not a dictionary."); 25014 } 25015 25016 type = dict.get("Subtype"); 25017 25018 if (!(0, _primitives.isName)(type)) { 25019 throw new _util.FormatError("invalid font Subtype"); 25020 } 25021 25022 composite = true; 25023 } 25024 25025 const firstChar = dict.get("FirstChar") || 0, 25026 lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff); 25027 const descriptor = dict.get("FontDescriptor"); 25028 25029 if (descriptor) { 25030 hash = new _murmurhash.MurmurHash3_64(); 25031 const encoding = baseDict.getRaw("Encoding"); 25032 25033 if ((0, _primitives.isName)(encoding)) { 25034 hash.update(encoding.name); 25035 } else if ((0, _primitives.isRef)(encoding)) { 25036 hash.update(encoding.toString()); 25037 } else if ((0, _primitives.isDict)(encoding)) { 25038 for (const entry of encoding.getRawValues()) { 25039 if ((0, _primitives.isName)(entry)) { 25040 hash.update(entry.name); 25041 } else if ((0, _primitives.isRef)(entry)) { 25042 hash.update(entry.toString()); 25043 } else if (Array.isArray(entry)) { 25044 const diffLength = entry.length, 25045 diffBuf = new Array(diffLength); 25046 25047 for (let j = 0; j < diffLength; j++) { 25048 const diffEntry = entry[j]; 25049 25050 if ((0, _primitives.isName)(diffEntry)) { 25051 diffBuf[j] = diffEntry.name; 25052 } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) { 25053 diffBuf[j] = diffEntry.toString(); 25054 } 25055 } 25056 25057 hash.update(diffBuf.join()); 25058 } 25059 } 25060 } 25061 25062 hash.update(`${firstChar}-${lastChar}`); 25063 toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode"); 25064 25065 if ((0, _primitives.isStream)(toUnicode)) { 25066 const stream = toUnicode.str || toUnicode; 25067 const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start); 25068 hash.update(uint8array); 25069 } else if ((0, _primitives.isName)(toUnicode)) { 25070 hash.update(toUnicode.name); 25071 } 25072 25073 const widths = dict.get("Widths") || baseDict.get("Widths"); 25074 25075 if (Array.isArray(widths)) { 25076 const widthsBuf = []; 25077 25078 for (const entry of widths) { 25079 if ((0, _util.isNum)(entry) || (0, _primitives.isRef)(entry)) { 25080 widthsBuf.push(entry.toString()); 25081 } 25082 } 25083 25084 hash.update(widthsBuf.join()); 25085 } 25086 25087 if (composite) { 25088 hash.update("compositeFont");
25089 const compositeWidths = dict.get("W") || baseDict.get("W"); 25090 25091 if (Array.isArray(compositeWidths)) { 25092 const widthsBuf = []; 25093 25094 for (const entry of compositeWidths) { 25095 if ((0, _util.isNum)(entry) || (0, _primitives.isRef)(entry)) { 25096 widthsBuf.push(entry.toString()); 25097 } else if (Array.isArray(entry)) { 25098 const subWidthsBuf = []; 25099 25100 for (const element of entry) { 25101 if ((0, _util.isNum)(element) || (0, _primitives.isRef)(element)) { 25102 subWidthsBuf.push(element.toString()); 25103 } 25104 } 25105 25106 widthsBuf.push(`[${subWidthsBuf.join()}]`); 25107 } 25108 } 25109 25110 hash.update(widthsBuf.join()); 25111 } 25112 25113 const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap"); 25114 25115 if (cidToGidMap instanceof _primitives.Name) { 25116 hash.update(cidToGidMap.name); 25117 } else if (cidToGidMap instanceof _primitives.Ref) { 25118 hash.update(cidToGidMap.toString()); 25119 } else if (cidToGidMap instanceof _base_stream.BaseStream) { 25120 hash.update(cidToGidMap.peekBytes()); 25121 } 25122 } 25123 } 25124 25125 return { 25126 descriptor, 25127 dict, 25128 baseDict, 25129 composite, 25130 type: type.name, 25131 firstChar, 25132 lastChar, 25133 toUnicode, 25134 hash: hash ? hash.hexdigest() : "" 25135 }; 25136 } 25137 25138 async translateFont({ 25139 descriptor, 25140 dict, 25141 baseDict, 25142 composite, 25143 type, 25144 firstChar, 25145 lastChar, 25146 toUnicode, 25147 cssFontInfo 25148 }) { 25149 const isType3Font = type === "Type3"; 25150 let properties; 25151 25152 if (!descriptor) { 25153 if (isType3Font) { 25154 descriptor = new _primitives.Dict(null); 25155 descriptor.set("FontName", _primitives.Name.get(type)); 25156 descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]); 25157 } else { 25158 let baseFontName = dict.get("BaseFont"); 25159 25160 if (!(0, _primitives.isName)(baseFontName)) { 25161 throw new _util.FormatError("Base font is not specified"); 25162 } 25163 25164 baseFontName = baseFontName.name.replace(/[,_]/g, "-"); 25165 const metrics = this.getBaseFontMetrics(baseFontName); 25166 const fontNameWoStyle = baseFontName.split("-")[0]; 25167 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); 25168 properties = { 25169 type, 25170 name: baseFontName, 25171 loadedName: baseDict.loadedName, 25172 widths: metrics.widths, 25173 defaultWidth: metrics.defaultWidth, 25174 isSimulatedFlags: true, 25175 flags, 25176 firstChar, 25177 lastChar, 25178 toUnicode, 25179 xHeight: 0, 25180 capHeight: 0, 25181 italicAngle: 0, 25182 isType3Font 25183 }; 25184 const widths = dict.get("Widths"); 25185 const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName); 25186 let file = null; 25187 25188 if (standardFontName) { 25189 properties.isStandardFont = true; 25190 file = await this.fetchStandardFontData(standardFontName); 25191 properties.isInternalFont = !!file; 25192 } 25193 25194 return this.extractDataStructures(dict, dict, properties).then(newProperties => { 25195 if (widths) { 25196 const glyphWidths = []; 25197 let j = firstChar; 25198 25199 for (let i = 0, ii = widths.length; i < ii; i++) { 25200 glyphWidths[j++] = this.xref.fetchIfRef(widths[i]); 25201 } 25202 25203 newProperties.widths = glyphWidths; 25204 } else { 25205 newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties); 25206 } 25207 25208 return new _fonts.Font(baseFontName, file, newProperties); 25209 }); 25210 } 25211 } 25212 25213 let fontName = descriptor.get("FontName"); 25214 let baseFont = dict.get("BaseFont"); 25215 25216 if ((0, _util.isString)(fontName)) { 25217 fontName = _primitives.Name.get(fontName); 25218 } 25219 25220 if ((0, _util.isString)(baseFont)) { 25221 baseFont = _primitives.Name.get(baseFont); 25222 } 25223 25224 if (!isType3Font) { 25225 const fontNameStr = fontName && fontName.name; 25226 const baseFontStr = baseFont && baseFont.name; 25227 25228 if (fontNameStr !== baseFontStr) { 25229 (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`); 25230 25231 if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) { 25232 fontName = baseFont; 25233 } 25234 } 25235 } 25236 25237 fontName = fontName || baseFont; 25238 25239 if (!(0, _primitives.isName)(fontName)) { 25240 throw new _util.FormatError("invalid font name"); 25241 } 25242 25243 let fontFile, subtype, length1, length2, length3; 25244 25245 try { 25246 fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3"); 25247 } catch (ex) { 25248 if (!this.options.ignoreErrors) { 25249 throw ex; 25250 } 25251 25252 (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`); 25253 fontFile = new _stream.NullStream(); 25254 } 25255 25256 let isStandardFont = false;
25257 let isInternalFont = false; 25258 let glyphScaleFactors = null; 25259 25260 if (fontFile) { 25261 if (fontFile.dict) { 25262 const subtypeEntry = fontFile.dict.get("Subtype"); 25263 25264 if (subtypeEntry instanceof _primitives.Name) { 25265 subtype = subtypeEntry.name; 25266 } 25267 25268 length1 = fontFile.dict.get("Length1"); 25269 length2 = fontFile.dict.get("Length2"); 25270 length3 = fontFile.dict.get("Length3"); 25271 } 25272 } else if (cssFontInfo) { 25273 const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name); 25274 25275 if (standardFontName) { 25276 cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`; 25277 cssFontInfo.metrics = standardFontName.metrics || null; 25278 glyphScaleFactors = standardFontName.factors || null; 25279 fontFile = await this.fetchStandardFontData(standardFontName.name); 25280 isInternalFont = !!fontFile; 25281 baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name); 25282 composite = true; 25283 } 25284 } else if (!isType3Font) { 25285 const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name); 25286 25287 if (standardFontName) { 25288 isStandardFont = true; 25289 fontFile = await this.fetchStandardFontData(standardFontName); 25290 isInternalFont = !!fontFile; 25291 } 25292 } 25293 25294 properties = { 25295 type, 25296 name: fontName.name, 25297 subtype, 25298 file: fontFile, 25299 length1, 25300 length2, 25301 length3, 25302 isStandardFont, 25303 isInternalFont, 25304 loadedName: baseDict.loadedName, 25305 composite, 25306 fixedPitch: false, 25307 fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX, 25308 firstChar, 25309 lastChar, 25310 toUnicode, 25311 bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"), 25312 ascent: descriptor.get("Ascent"), 25313 descent: descriptor.get("Descent"), 25314 xHeight: descriptor.get("XHeight") || 0, 25315 capHeight: descriptor.get("CapHeight") || 0, 25316 flags: descriptor.get("Flags"), 25317 italicAngle: descriptor.get("ItalicAngle") || 0, 25318 isType3Font, 25319 cssFontInfo, 25320 scaleFactors: glyphScaleFactors 25321 }; 25322 25323 if (composite) { 25324 const cidEncoding = baseDict.get("Encoding"); 25325 25326 if ((0, _primitives.isName)(cidEncoding)) { 25327 properties.cidEncoding = cidEncoding.name; 25328 } 25329 25330 const cMap = await _cmap.CMapFactory.create({ 25331 encoding: cidEncoding, 25332 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 25333 useCMap: null 25334 }); 25335 properties.cMap = cMap; 25336 properties.vertical = properties.cMap.vertical; 25337 } 25338 25339 return this.extractDataStructures(dict, baseDict, properties).then(newProperties => { 25340 this.extractWidths(dict, descriptor, newProperties); 25341 return new _fonts.Font(fontName.name, fontFile, newProperties); 25342 }); 25343 } 25344 25345 static buildFontPaths(font, glyphs, handler, evaluatorOptions) { 25346 function buildPath(fontChar) { 25347 const glyphName = `${font.loadedName}_path_${fontChar}`; 25348 25349 try { 25350 if (font.renderer.hasBuiltPath(fontChar)) { 25351 return; 25352 } 25353 25354 handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]); 25355 } catch (reason) { 25356 if (evaluatorOptions.ignoreErrors) { 25357 handler.send("UnsupportedFeature", { 25358 featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath 25359 }); 25360 (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`); 25361 return; 25362 } 25363 25364 throw reason; 25365 } 25366 } 25367 25368 for (const glyph of glyphs) { 25369 buildPath(glyph.fontChar); 25370 const accent = glyph.accent; 25371 25372 if (accent && accent.fontChar) { 25373 buildPath(accent.fontChar); 25374 } 25375 } 25376 } 25377 25378 static get fallbackFontDict() { 25379 const dict = new _primitives.Dict(); 25380 dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont")); 25381 dict.set("Type", _primitives.Name.get("FallbackType")); 25382 dict.set("Subtype", _primitives.Name.get("FallbackType")); 25383 dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding")); 25384 return (0, _util.shadow)(this, "fallbackFontDict", dict); 25385 } 25386 25387} 25388
25389exports.PartialEvaluator = PartialEvaluator; 25390 25391class TranslatedFont { 25392 constructor({ 25393 loadedName, 25394 font, 25395 dict, 25396 evaluatorOptions 25397 }) { 25398 this.loadedName = loadedName; 25399 this.font = font; 25400 this.dict = dict; 25401 this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions; 25402 this.type3Loaded = null; 25403 this.type3Dependencies = font.isType3Font ? new Set() : null; 25404 this.sent = false; 25405 } 25406 25407 send(handler) { 25408 if (this.sent) { 25409 return; 25410 } 25411 25412 this.sent = true; 25413 handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]); 25414 } 25415 25416 fallback(handler) { 25417 if (!this.font.data) { 25418 return; 25419 } 25420 25421 this.font.disableFontFace = true; 25422 PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions); 25423 } 25424 25425 loadType3Data(evaluator, resources, task) { 25426 if (this.type3Loaded) { 25427 return this.type3Loaded; 25428 } 25429 25430 if (!this.font.isType3Font) { 25431 throw new Error("Must be a Type3 font."); 25432 } 25433 25434 const type3Evaluator = evaluator.clone({ 25435 ignoreErrors: false 25436 }); 25437 type3Evaluator.parsingType3Font = true; 25438 const translatedFont = this.font, 25439 type3Dependencies = this.type3Dependencies; 25440 let loadCharProcsPromise = Promise.resolve(); 25441 const charProcs = this.dict.get("CharProcs"); 25442 const fontResources = this.dict.get("Resources") || resources; 25443 const charProcOperatorList = Object.create(null); 25444 const isEmptyBBox = !translatedFont.bbox || (0, _util.isArrayEqual)(translatedFont.bbox, [0, 0, 0, 0]); 25445 25446 for (const key of charProcs.getKeys()) { 25447 loadCharProcsPromise = loadCharProcsPromise.then(() => { 25448 const glyphStream = charProcs.get(key); 25449 const operatorList = new _operator_list.OperatorList(); 25450 return type3Evaluator.getOperatorList({ 25451 stream: glyphStream, 25452 task, 25453 resources: fontResources, 25454 operatorList 25455 }).then(() => { 25456 if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) { 25457 this._removeType3ColorOperators(operatorList, isEmptyBBox); 25458 } 25459 25460 charProcOperatorList[key] = operatorList.getIR(); 25461 25462 for (const dependency of operatorList.dependencies) { 25463 type3Dependencies.add(dependency); 25464 } 25465 }).catch(function (reason) { 25466 (0, _util.warn)(`Type3 font resource "${key}" is not available.`); 25467 const dummyOperatorList = new _operator_list.OperatorList(); 25468 charProcOperatorList[key] = dummyOperatorList.getIR(); 25469 }); 25470 }); 25471 } 25472 25473 this.type3Loaded = loadCharProcsPromise.then(() => { 25474 translatedFont.charProcOperatorList = charProcOperatorList; 25475 25476 if (this._bbox) { 25477 translatedFont.isCharBBox = true; 25478 translatedFont.bbox = this._bbox; 25479 } 25480 }); 25481 return this.type3Loaded; 25482 } 25483 25484 _removeType3ColorOperators(operatorList, isEmptyBBox = false) { 25485 if (isEmptyBBox) { 25486 if (!this._bbox) { 25487 this._bbox = [Infinity, Infinity, -Infinity, -Infinity]; 25488 } 25489 25490 const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)); 25491 25492 this._bbox[0] = Math.min(this._bbox[0], charBBox[0]); 25493 this._bbox[1] = Math.min(this._bbox[1], charBBox[1]); 25494 this._bbox[2] = Math.max(this._bbox[2], charBBox[2]); 25495 this._bbox[3] = Math.max(this._bbox[3], charBBox[3]); 25496 } 25497 25498 let i = 1, 25499 ii = operatorList.length; 25500 25501 while (i < ii) { 25502 switch (operatorList.fnArray[i]) { 25503 case _util.OPS.setStrokeColorSpace: 25504 case _util.OPS.setFillColorSpace: 25505 case _util.OPS.setStrokeColor: 25506 case _util.OPS.setStrokeColorN: 25507 case _util.OPS.setFillColor: 25508 case _util.OPS.setFillColorN: 25509 case _util.OPS.setStrokeGray: 25510 case _util.OPS.setFillGray: 25511 case _util.OPS.setStrokeRGBColor: 25512 case _util.OPS.setFillRGBColor: 25513 case _util.OPS.setStrokeCMYKColor: 25514 case _util.OPS.setFillCMYKColor: 25515 case _util.OPS.shadingFill: 25516 case _util.OPS.setRenderingIntent: 25517 operatorList.fnArray.splice(i, 1); 25518 operatorList.argsArray.splice(i, 1); 25519 ii--; 25520 continue; 25521 25522 case _util.OPS.setGState: 25523 const [gStateObj] = operatorList.argsArray[i]; 25524 let j = 0, 25525 jj = gStateObj.length; 25526 25527 while (j < jj) { 25528 const [gStateKey] = gStateObj[j]; 25529 25530 switch (gStateKey) { 25531 case "TR": 25532 case "TR2": 25533 case "HT": 25534 case "BG": 25535 case "BG2": 25536 case "UCR": 25537 case "UCR2": 25538 gStateObj.splice(j, 1); 25539 jj--; 25540 continue; 25541 } 25542 25543 j++; 25544 } 25545 25546 break; 25547 } 25548 25549 i++; 25550 } 25551 } 25552 25553} 25554 25555class StateManager { 25556 constructor(initialState = new EvalState()) { 25557 this.state = initialState; 25558 this.stateStack = []; 25559 } 25560 25561 save() { 25562 const old = this.state; 25563 this.stateStack.push(this.state); 25564 this.state = old.clone(); 25565 } 25566
25567 restore() { 25568 const prev = this.stateStack.pop(); 25569 25570 if (prev) { 25571 this.state = prev; 25572 } 25573 } 25574 25575 transform(args) { 25576 this.state.ctm = _util.Util.transform(this.state.ctm, args); 25577 } 25578 25579} 25580 25581class TextState { 25582 constructor() { 25583 this.ctm = new Float32Array(_util.IDENTITY_MATRIX); 25584 this.fontName = null; 25585 this.fontSize = 0; 25586 this.font = null; 25587 this.fontMatrix = _util.FONT_IDENTITY_MATRIX; 25588 this.textMatrix = _util.IDENTITY_MATRIX.slice(); 25589 this.textLineMatrix = _util.IDENTITY_MATRIX.slice(); 25590 this.charSpacing = 0; 25591 this.wordSpacing = 0; 25592 this.leading = 0; 25593 this.textHScale = 1; 25594 this.textRise = 0; 25595 } 25596 25597 setTextMatrix(a, b, c, d, e, f) { 25598 const m = this.textMatrix; 25599 m[0] = a; 25600 m[1] = b; 25601 m[2] = c; 25602 m[3] = d; 25603 m[4] = e; 25604 m[5] = f; 25605 } 25606 25607 setTextLineMatrix(a, b, c, d, e, f) { 25608 const m = this.textLineMatrix; 25609 m[0] = a; 25610 m[1] = b; 25611 m[2] = c; 25612 m[3] = d; 25613 m[4] = e; 25614 m[5] = f; 25615 } 25616 25617 translateTextMatrix(x, y) { 25618 const m = this.textMatrix; 25619 m[4] = m[0] * x + m[2] * y + m[4]; 25620 m[5] = m[1] * x + m[3] * y + m[5]; 25621 } 25622 25623 translateTextLineMatrix(x, y) {
25624 const m = this.textLineMatrix; 25625 m[4] = m[0] * x + m[2] * y + m[4]; 25626 m[5] = m[1] * x + m[3] * y + m[5]; 25627 } 25628 25629 carriageReturn() { 25630 this.translateTextLineMatrix(0, -this.leading); 25631 this.textMatrix = this.textLineMatrix.slice(); 25632 } 25633 25634 clone() { 25635 const clone = Object.create(this); 25636 clone.textMatrix = this.textMatrix.slice(); 25637 clone.textLineMatrix = this.textLineMatrix.slice(); 25638 clone.fontMatrix = this.fontMatrix.slice(); 25639 return clone; 25640 } 25641 25642} 25643 25644class EvalState { 25645 constructor() { 25646 this.ctm = new Float32Array(_util.IDENTITY_MATRIX); 25647 this.font = null; 25648 this.textRenderingMode = _util.TextRenderingMode.FILL; 25649 this.fillColorSpace = _colorspace.ColorSpace.singletons.gray; 25650 this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray; 25651 } 25652 25653 clone() { 25654 return Object.create(this); 25655 } 25656 25657} 25658 25659class EvaluatorPreprocessor { 25660 static get opMap() { 25661 const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) { 25662 t.w = { 25663 id: _util.OPS.setLineWidth, 25664 numArgs: 1, 25665 variableArgs: false 25666 }; 25667 t.J = { 25668 id: _util.OPS.setLineCap, 25669 numArgs: 1, 25670 variableArgs: false 25671 }; 25672 t.j = { 25673 id: _util.OPS.setLineJoin, 25674 numArgs: 1, 25675 variableArgs: false 25676 }; 25677 t.M = { 25678 id: _util.OPS.setMiterLimit, 25679 numArgs: 1, 25680 variableArgs: false 25681 }; 25682 t.d = { 25683 id: _util.OPS.setDash, 25684 numArgs: 2, 25685 variableArgs: false 25686 }; 25687 t.ri = { 25688 id: _util.OPS.setRenderingIntent, 25689 numArgs: 1, 25690 variableArgs: false 25691 }; 25692 t.i = { 25693 id: _util.OPS.setFlatness, 25694 numArgs: 1, 25695 variableArgs: false 25696 }; 25697 t.gs = { 25698 id: _util.OPS.setGState, 25699 numArgs: 1, 25700 variableArgs: false 25701 }; 25702 t.q = { 25703 id: _util.OPS.save, 25704 numArgs: 0, 25705 variableArgs: false 25706 }; 25707 t.Q = { 25708 id: _util.OPS.restore, 25709 numArgs: 0, 25710 variableArgs: false 25711 }; 25712 t.cm = { 25713 id: _util.OPS.transform, 25714 numArgs: 6, 25715 variableArgs: false 25716 }; 25717 t.m = { 25718 id: _util.OPS.moveTo, 25719 numArgs: 2, 25720 variableArgs: false 25721 }; 25722 t.l = { 25723 id: _util.OPS.lineTo, 25724 numArgs: 2, 25725 variableArgs: false 25726 }; 25727 t.c = { 25728 id: _util.OPS.curveTo, 25729 numArgs: 6, 25730 variableArgs: false 25731 }; 25732 t.v = { 25733 id: _util.OPS.curveTo2, 25734 numArgs: 4, 25735 variableArgs: false 25736 }; 25737 t.y = { 25738 id: _util.OPS.curveTo3, 25739 numArgs: 4, 25740 variableArgs: false 25741 }; 25742 t.h = { 25743 id: _util.OPS.closePath, 25744 numArgs: 0, 25745 variableArgs: false 25746 }; 25747 t.re = { 25748 id: _util.OPS.rectangle, 25749 numArgs: 4, 25750 variableArgs: false 25751 }; 25752 t.S = { 25753 id: _util.OPS.stroke, 25754 numArgs: 0, 25755 variableArgs: false 25756 }; 25757 t.s = { 25758 id: _util.OPS.closeStroke, 25759 numArgs: 0, 25760 variableArgs: false 25761 }; 25762 t.f = { 25763 id: _util.OPS.fill, 25764 numArgs: 0, 25765 variableArgs: false 25766 }; 25767 t.F = { 25768 id: _util.OPS.fill, 25769 numArgs: 0, 25770 variableArgs: false 25771 }; 25772 t["f*"] = { 25773 id: _util.OPS.eoFill, 25774 numArgs: 0, 25775 variableArgs: false 25776 }; 25777 t.B = { 25778 id: _util.OPS.fillStroke, 25779 numArgs: 0, 25780 variableArgs: false 25781 }; 25782 t["B*"] = { 25783 id: _util.OPS.eoFillStroke, 25784 numArgs: 0, 25785 variableArgs: false 25786 }; 25787 t.b = { 25788 id: _util.OPS.closeFillStroke, 25789 numArgs: 0, 25790 variableArgs: false 25791 }; 25792 t["b*"] = { 25793 id: _util.OPS.closeEOFillStroke, 25794 numArgs: 0, 25795 variableArgs: false 25796 }; 25797 t.n = { 25798 id: _util.OPS.endPath, 25799 numArgs: 0, 25800 variableArgs: false 25801 }; 25802 t.W = { 25803 id: _util.OPS.clip, 25804 numArgs: 0, 25805 variableArgs: false 25806 }; 25807 t["W*"] = { 25808 id: _util.OPS.eoClip, 25809 numArgs: 0, 25810 variableArgs: false 25811 }; 25812 t.BT = { 25813 id: _util.OPS.beginText, 25814 numArgs: 0, 25815 variableArgs: false 25816 }; 25817 t.ET = { 25818 id: _util.OPS.endText, 25819 numArgs: 0, 25820 variableArgs: false 25821 }; 25822 t.Tc = { 25823 id: _util.OPS.setCharSpacing, 25824 numArgs: 1, 25825 variableArgs: false 25826 }; 25827 t.Tw = { 25828 id: _util.OPS.setWordSpacing, 25829 numArgs: 1, 25830 variableArgs: false 25831 }; 25832 t.Tz = { 25833 id: _util.OPS.setHScale, 25834 numArgs: 1, 25835 variableArgs: false 25836 }; 25837 t.TL = { 25838 id: _util.OPS.setLeading, 25839 numArgs: 1, 25840 variableArgs: false 25841 }; 25842 t.Tf = { 25843 id: _util.OPS.setFont, 25844 numArgs: 2, 25845 variableArgs: false 25846 }; 25847 t.Tr = { 25848 id: _util.OPS.setTextRenderingMode, 25849 numArgs: 1, 25850 variableArgs: false 25851 }; 25852 t.Ts = { 25853 id: _util.OPS.setTextRise, 25854 numArgs: 1, 25855 variableArgs: false 25856 }; 25857 t.Td = { 25858 id: _util.OPS.moveText, 25859 numArgs: 2, 25860 variableArgs: false 25861 }; 25862 t.TD = { 25863 id: _util.OPS.setLeadingMoveText, 25864 numArgs: 2, 25865 variableArgs: false 25866 }; 25867 t.Tm = { 25868 id: _util.OPS.setTextMatrix, 25869 numArgs: 6, 25870 variableArgs: false 25871 }; 25872 t["T*"] = { 25873 id: _util.OPS.nextLine, 25874 numArgs: 0, 25875 variableArgs: false 25876 }; 25877 t.Tj = { 25878 id: _util.OPS.showText, 25879 numArgs: 1, 25880 variableArgs: false 25881 }; 25882 t.TJ = { 25883 id: _util.OPS.showSpacedText, 25884 numArgs: 1, 25885 variableArgs: false 25886 }; 25887 t["'"] = { 25888 id: _util.OPS.nextLineShowText, 25889 numArgs: 1, 25890 variableArgs: false 25891 }; 25892 t['"'] = { 25893 id: _util.OPS.nextLineSetSpacingShowText, 25894 numArgs: 3, 25895 variableArgs: false 25896 }; 25897 t.d0 = { 25898 id: _util.OPS.setCharWidth, 25899 numArgs: 2, 25900 variableArgs: false 25901 }; 25902 t.d1 = { 25903 id: _util.OPS.setCharWidthAndBounds, 25904 numArgs: 6, 25905 variableArgs: false 25906 }; 25907 t.CS = { 25908 id: _util.OPS.setStrokeColorSpace, 25909 numArgs: 1, 25910 variableArgs: false 25911 }; 25912 t.cs = { 25913 id: _util.OPS.setFillColorSpace, 25914 numArgs: 1, 25915 variableArgs: false 25916 }; 25917 t.SC = { 25918 id: _util.OPS.setStrokeColor, 25919 numArgs: 4, 25920 variableArgs: true 25921 }; 25922 t.SCN = { 25923 id: _util.OPS.setStrokeColorN, 25924 numArgs: 33, 25925 variableArgs: true 25926 }; 25927 t.sc = { 25928 id: _util.OPS.setFillColor, 25929 numArgs: 4, 25930 variableArgs: true 25931 }; 25932 t.scn = { 25933 id: _util.OPS.setFillColorN, 25934 numArgs: 33, 25935 variableArgs: true 25936 }; 25937 t.G = { 25938 id: _util.OPS.setStrokeGray, 25939 numArgs: 1, 25940 variableArgs: false 25941 }; 25942 t.g = { 25943 id: _util.OPS.setFillGray, 25944 numArgs: 1, 25945 variableArgs: false 25946 }; 25947 t.RG = { 25948 id: _util.OPS.setStrokeRGBColor, 25949 numArgs: 3, 25950 variableArgs: false 25951 }; 25952 t.rg = { 25953 id: _util.OPS.setFillRGBColor, 25954 numArgs: 3, 25955 variableArgs: false 25956 }; 25957 t.K = { 25958 id: _util.OPS.setStrokeCMYKColor, 25959 numArgs: 4, 25960 variableArgs: false 25961 }; 25962 t.k = { 25963 id: _util.OPS.setFillCMYKColor, 25964 numArgs: 4, 25965 variableArgs: false 25966 }; 25967 t.sh = { 25968 id: _util.OPS.shadingFill, 25969 numArgs: 1, 25970 variableArgs: false 25971 }; 25972 t.BI = { 25973 id: _util.OPS.beginInlineImage, 25974 numArgs: 0, 25975 variableArgs: false 25976 }; 25977 t.ID = { 25978 id: _util.OPS.beginImageData, 25979 numArgs: 0, 25980 variableArgs: false 25981 }; 25982 t.EI = { 25983 id: _util.OPS.endInlineImage, 25984 numArgs: 1, 25985 variableArgs: false 25986 }; 25987 t.Do = { 25988 id: _util.OPS.paintXObject, 25989 numArgs: 1, 25990 variableArgs: false 25991 }; 25992 t.MP = { 25993 id: _util.OPS.markPoint, 25994 numArgs: 1, 25995 variableArgs: false 25996 }; 25997 t.DP = { 25998 id: _util.OPS.markPointProps, 25999 numArgs: 2, 26000 variableArgs: false 26001 }; 26002 t.BMC = { 26003 id: _util.OPS.beginMarkedContent, 26004 numArgs: 1, 26005 variableArgs: false 26006 }; 26007 t.BDC = { 26008 id: _util.OPS.beginMarkedContentProps, 26009 numArgs: 2, 26010 variableArgs: false 26011 }; 26012 t.EMC = { 26013 id: _util.OPS.endMarkedContent, 26014 numArgs: 0, 26015 variableArgs: false 26016 }; 26017 t.BX = { 26018 id: _util.OPS.beginCompat, 26019 numArgs: 0, 26020 variableArgs: false 26021 }; 26022 t.EX = { 26023 id: _util.OPS.endCompat, 26024 numArgs: 0, 26025 variableArgs: false 26026 }; 26027 t.BM = null; 26028 t.BD = null; 26029 t.true = null; 26030 t.fa = null; 26031 t.fal = null; 26032 t.fals = null; 26033 t.false = null; 26034 t.nu = null; 26035 t.nul = null; 26036 t.null = null; 26037 }); 26038 return (0, _util.shadow)(this, "opMap", getOPMap()); 26039 } 26040
26041 static get MAX_INVALID_PATH_OPS() { 26042 return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 20); 26043 } 26044 26045 constructor(stream, xref, stateManager = new StateManager()) { 26046 this.parser = new _parser.Parser({ 26047 lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap), 26048 xref 26049 }); 26050 this.stateManager = stateManager; 26051 this.nonProcessedArgs = []; 26052 this._numInvalidPathOPS = 0; 26053 } 26054 26055 get savedStatesDepth() { 26056 return this.stateManager.stateStack.length; 26057 } 26058 26059 read(operation) { 26060 let args = operation.args; 26061 26062 while (true) { 26063 const obj = this.parser.getObj(); 26064 26065 if (obj instanceof _primitives.Cmd) { 26066 const cmd = obj.cmd; 26067 const opSpec = EvaluatorPreprocessor.opMap[cmd]; 26068 26069 if (!opSpec) { 26070 (0, _util.warn)(`Unknown command "${cmd}".`); 26071 continue; 26072 } 26073 26074 const fn = opSpec.id; 26075 const numArgs = opSpec.numArgs; 26076 let argsLength = args !== null ? args.length : 0; 26077 26078 if (!opSpec.variableArgs) { 26079 if (argsLength !== numArgs) { 26080 const nonProcessedArgs = this.nonProcessedArgs; 26081 26082 while (argsLength > numArgs) { 26083 nonProcessedArgs.push(args.shift()); 26084 argsLength--; 26085 } 26086 26087 while (argsLength < numArgs && nonProcessedArgs.length !== 0) { 26088 if (args === null) { 26089 args = []; 26090 } 26091 26092 args.unshift(nonProcessedArgs.pop()); 26093 argsLength++; 26094 } 26095 } 26096 26097 if (argsLength < numArgs) { 26098 const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`; 26099 26100 if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) { 26101 throw new _util.FormatError(`Invalid ${partialMsg}`); 26102 } 26103 26104 (0, _util.warn)(`Skipping ${partialMsg}`); 26105 26106 if (args !== null) { 26107 args.length = 0; 26108 } 26109 26110 continue; 26111 } 26112 } else if (argsLength > numArgs) { 26113 (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`); 26114 } 26115 26116 this.preprocessCommand(fn, args); 26117 operation.fn = fn; 26118 operation.args = args; 26119 return true; 26120 } 26121 26122 if (obj === _primitives.EOF) { 26123 return false; 26124 } 26125 26126 if (obj !== null) { 26127 if (args === null) { 26128 args = []; 26129 } 26130 26131 args.push(obj); 26132 26133 if (args.length > 33) { 26134 throw new _util.FormatError("Too many arguments"); 26135 } 26136 } 26137 } 26138 } 26139 26140 preprocessCommand(fn, args) { 26141 switch (fn | 0) { 26142 case _util.OPS.save: 26143 this.stateManager.save(); 26144 break; 26145 26146 case _util.OPS.restore: 26147 this.stateManager.restore(); 26148 break; 26149 26150 case _util.OPS.transform: 26151 this.stateManager.transform(args); 26152 break; 26153 } 26154 } 26155 26156} 26157 26158exports.EvaluatorPreprocessor = EvaluatorPreprocessor; 26159 26160/***/ }), 26161/* 26 */ 26162/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 26163 26164 26165 26166Object.defineProperty(exports, "__esModule", ({ 26167 value: true 26168})); 26169exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0; 26170 26171var _util = __w_pdfjs_require__(2); 26172 26173var _primitives = __w_pdfjs_require__(5); 26174 26175var _parser = __w_pdfjs_require__(27); 26176 26177var _core_utils = __w_pdfjs_require__(9); 26178 26179var _stream = __w_pdfjs_require__(10); 26180 26181const 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"]; 26182const MAX_MAP_RANGE = 2 ** 24 - 1; 26183 26184class CMap { 26185 constructor(builtInCMap = false) { 26186 this.codespaceRanges = [[], [], [], []]; 26187 this.numCodespaceRanges = 0; 26188 this._map = []; 26189 this.name = ""; 26190 this.vertical = false;
vendor: 2,099 bytes, lines 26191-26292
26191 this.useCMap = null; 26192 this.builtInCMap = builtInCMap; 26193 } 26194 26195 addCodespaceRange(n, low, high) { 26196 this.codespaceRanges[n - 1].push(low, high); 26197 this.numCodespaceRanges++; 26198 } 26199 26200 mapCidRange(low, high, dstLow) { 26201 if (high - low > MAX_MAP_RANGE) { 26202 throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE."); 26203 } 26204 26205 while (low <= high) { 26206 this._map[low++] = dstLow++; 26207 } 26208 } 26209 26210 mapBfRange(low, high, dstLow) { 26211 if (high - low > MAX_MAP_RANGE) { 26212 throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE."); 26213 } 26214 26215 const lastByte = dstLow.length - 1; 26216 26217 while (low <= high) { 26218 this._map[low++] = dstLow; 26219 const nextCharCode = dstLow.charCodeAt(lastByte) + 1; 26220 26221 if (nextCharCode > 0xff) { 26222 dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00"; 26223 continue; 26224 } 26225 26226 dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode); 26227 } 26228 } 26229 26230 mapBfRangeToArray(low, high, array) { 26231 if (high - low > MAX_MAP_RANGE) { 26232 throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE."); 26233 } 26234 26235 const ii = array.length; 26236 let i = 0; 26237 26238 while (low <= high && i < ii) { 26239 this._map[low] = array[i++]; 26240 ++low; 26241 } 26242 } 26243 26244 mapOne(src, dst) { 26245 this._map[src] = dst; 26246 } 26247 26248 lookup(code) { 26249 return this._map[code]; 26250 } 26251 26252 contains(code) { 26253 return this._map[code] !== undefined; 26254 } 26255 26256 forEach(callback) { 26257 const map = this._map; 26258 const length = map.length; 26259 26260 if (length <= 0x10000) { 26261 for (let i = 0; i < length; i++) { 26262 if (map[i] !== undefined) { 26263 callback(i, map[i]); 26264 } 26265 } 26266 } else { 26267 for (const i in map) { 26268 callback(i, map[i]); 26269 } 26270 } 26271 } 26272 26273 charCodeOf(value) { 26274 const map = this._map; 26275 26276 if (map.length <= 0x10000) { 26277 return map.indexOf(value); 26278 } 26279 26280 for (const charCode in map) { 26281 if (map[charCode] === value) { 26282 return charCode | 0; 26283 } 26284 } 26285 26286 return -1; 26287 } 26288 26289 getMap() { 26290 return this._map; 26291 } 26292
vendor: 5,862 bytes, lines 26293-26580
26293 readCharCode(str, offset, out) { 26294 let c = 0; 26295 const codespaceRanges = this.codespaceRanges; 26296 26297 for (let n = 0, nn = codespaceRanges.length; n < nn; n++) { 26298 c = (c << 8 | str.charCodeAt(offset + n)) >>> 0; 26299 const codespaceRange = codespaceRanges[n]; 26300 26301 for (let k = 0, kk = codespaceRange.length; k < kk;) { 26302 const low = codespaceRange[k++]; 26303 const high = codespaceRange[k++]; 26304 26305 if (c >= low && c <= high) { 26306 out.charcode = c; 26307 out.length = n + 1; 26308 return; 26309 } 26310 } 26311 } 26312 26313 out.charcode = 0; 26314 out.length = 1; 26315 } 26316 26317 getCharCodeLength(charCode) { 26318 const codespaceRanges = this.codespaceRanges; 26319 26320 for (let n = 0, nn = codespaceRanges.length; n < nn; n++) { 26321 const codespaceRange = codespaceRanges[n]; 26322 26323 for (let k = 0, kk = codespaceRange.length; k < kk;) { 26324 const low = codespaceRange[k++]; 26325 const high = codespaceRange[k++]; 26326 26327 if (charCode >= low && charCode <= high) { 26328 return n + 1; 26329 } 26330 } 26331 } 26332 26333 return 1; 26334 } 26335 26336 get length() { 26337 return this._map.length; 26338 } 26339 26340 get isIdentityCMap() { 26341 if (!(this.name === "Identity-H" || this.name === "Identity-V")) { 26342 return false; 26343 } 26344 26345 if (this._map.length !== 0x10000) { 26346 return false; 26347 } 26348 26349 for (let i = 0; i < 0x10000; i++) { 26350 if (this._map[i] !== i) { 26351 return false; 26352 } 26353 } 26354 26355 return true; 26356 } 26357 26358} 26359 26360exports.CMap = CMap; 26361 26362class IdentityCMap extends CMap { 26363 constructor(vertical, n) { 26364 super(); 26365 this.vertical = vertical; 26366 this.addCodespaceRange(n, 0, 0xffff); 26367 } 26368 26369 mapCidRange(low, high, dstLow) { 26370 (0, _util.unreachable)("should not call mapCidRange"); 26371 } 26372 26373 mapBfRange(low, high, dstLow) { 26374 (0, _util.unreachable)("should not call mapBfRange"); 26375 } 26376 26377 mapBfRangeToArray(low, high, array) { 26378 (0, _util.unreachable)("should not call mapBfRangeToArray"); 26379 } 26380 26381 mapOne(src, dst) { 26382 (0, _util.unreachable)("should not call mapCidOne"); 26383 } 26384 26385 lookup(code) { 26386 return Number.isInteger(code) && code <= 0xffff ? code : undefined; 26387 } 26388 26389 contains(code) { 26390 return Number.isInteger(code) && code <= 0xffff; 26391 } 26392 26393 forEach(callback) { 26394 for (let i = 0; i <= 0xffff; i++) { 26395 callback(i, i); 26396 } 26397 } 26398 26399 charCodeOf(value) { 26400 return Number.isInteger(value) && value <= 0xffff ? value : -1; 26401 } 26402 26403 getMap() { 26404 const map = new Array(0x10000); 26405 26406 for (let i = 0; i <= 0xffff; i++) { 26407 map[i] = i; 26408 } 26409 26410 return map; 26411 } 26412 26413 get length() { 26414 return 0x10000; 26415 } 26416 26417 get isIdentityCMap() { 26418 (0, _util.unreachable)("should not access .isIdentityCMap"); 26419 } 26420 26421} 26422 26423exports.IdentityCMap = IdentityCMap; 26424 26425const BinaryCMapReader = function BinaryCMapReaderClosure() { 26426 function hexToInt(a, size) { 26427 let n = 0; 26428 26429 for (let i = 0; i <= size; i++) { 26430 n = n << 8 | a[i]; 26431 } 26432 26433 return n >>> 0; 26434 } 26435 26436 function hexToStr(a, size) { 26437 if (size === 1) { 26438 return String.fromCharCode(a[0], a[1]); 26439 } 26440 26441 if (size === 3) { 26442 return String.fromCharCode(a[0], a[1], a[2], a[3]); 26443 } 26444 26445 return String.fromCharCode.apply(null, a.subarray(0, size + 1)); 26446 } 26447 26448 function addHex(a, b, size) { 26449 let c = 0; 26450 26451 for (let i = size; i >= 0; i--) { 26452 c += a[i] + b[i]; 26453 a[i] = c & 255; 26454 c >>= 8; 26455 } 26456 } 26457 26458 function incHex(a, size) { 26459 let c = 1; 26460 26461 for (let i = size; i >= 0 && c > 0; i--) { 26462 c += a[i]; 26463 a[i] = c & 255; 26464 c >>= 8; 26465 } 26466 } 26467 26468 const MAX_NUM_SIZE = 16; 26469 const MAX_ENCODED_NUM_SIZE = 19; 26470 26471 class BinaryCMapStream { 26472 constructor(data) { 26473 this.buffer = data; 26474 this.pos = 0; 26475 this.end = data.length; 26476 this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE); 26477 } 26478 26479 readByte() { 26480 if (this.pos >= this.end) { 26481 return -1; 26482 } 26483 26484 return this.buffer[this.pos++]; 26485 } 26486 26487 readNumber() { 26488 let n = 0; 26489 let last; 26490 26491 do { 26492 const b = this.readByte(); 26493 26494 if (b < 0) { 26495 throw new _util.FormatError("unexpected EOF in bcmap"); 26496 } 26497 26498 last = !(b & 0x80); 26499 n = n << 7 | b & 0x7f; 26500 } while (!last); 26501 26502 return n; 26503 } 26504 26505 readSigned() { 26506 const n = this.readNumber(); 26507 return n & 1 ? ~(n >>> 1) : n >>> 1; 26508 } 26509 26510 readHex(num, size) { 26511 num.set(this.buffer.subarray(this.pos, this.pos + size + 1)); 26512 this.pos += size + 1; 26513 } 26514 26515 readHexNumber(num, size) { 26516 let last; 26517 const stack = this.tmpBuf; 26518 let sp = 0; 26519 26520 do { 26521 const b = this.readByte(); 26522 26523 if (b < 0) { 26524 throw new _util.FormatError("unexpected EOF in bcmap"); 26525 } 26526 26527 last = !(b & 0x80); 26528 stack[sp++] = b & 0x7f; 26529 } while (!last); 26530 26531 let i = size, 26532 buffer = 0, 26533 bufferSize = 0; 26534 26535 while (i >= 0) { 26536 while (bufferSize < 8 && stack.length > 0) { 26537 buffer |= stack[--sp] << bufferSize; 26538 bufferSize += 7; 26539 } 26540 26541 num[i] = buffer & 255; 26542 i--; 26543 buffer >>= 8; 26544 bufferSize -= 8; 26545 } 26546 } 26547 26548 readHexSigned(num, size) { 26549 this.readHexNumber(num, size); 26550 const sign = num[size] & 1 ? 255 : 0; 26551 let c = 0; 26552 26553 for (let i = 0; i <= size; i++) { 26554 c = (c & 1) << 8 | num[i]; 26555 num[i] = c >> 1 ^ sign; 26556 } 26557 } 26558 26559 readString() { 26560 const len = this.readNumber(); 26561 let s = ""; 26562 26563 for (let i = 0; i < len; i++) { 26564 s += String.fromCharCode(this.readNumber()); 26565 } 26566 26567 return s; 26568 } 26569 26570 } 26571 26572 class BinaryCMapReader { 26573 async process(data, cMap, extend) { 26574 const stream = new BinaryCMapStream(data); 26575 const header = stream.readByte(); 26576 cMap.vertical = !!(header & 1); 26577 let useCMap = null; 26578 const start = new Uint8Array(MAX_NUM_SIZE); 26579 const end = new Uint8Array(MAX_NUM_SIZE); 26580 const char = new Uint8Array(MAX_NUM_SIZE);
26581 const charCode = new Uint8Array(MAX_NUM_SIZE); 26582 const tmp = new Uint8Array(MAX_NUM_SIZE); 26583 let code; 26584 let b; 26585 26586 while ((b = stream.readByte()) >= 0) { 26587 const type = b >> 5; 26588 26589 if (type === 7) { 26590 switch (b & 0x1f) { 26591 case 0: 26592 stream.readString(); 26593 break; 26594 26595 case 1: 26596 useCMap = stream.readString(); 26597 break; 26598 } 26599 26600 continue; 26601 } 26602 26603 const sequence = !!(b & 0x10); 26604 const dataSize = b & 15; 26605 26606 if (dataSize + 1 > MAX_NUM_SIZE) { 26607 throw new Error("BinaryCMapReader.process: Invalid dataSize."); 26608 } 26609 26610 const ucs2DataSize = 1; 26611 const subitemsCount = stream.readNumber(); 26612 26613 switch (type) { 26614 case 0: 26615 stream.readHex(start, dataSize); 26616 stream.readHexNumber(end, dataSize); 26617 addHex(end, start, dataSize); 26618 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 26619 26620 for (let i = 1; i < subitemsCount; i++) { 26621 incHex(end, dataSize); 26622 stream.readHexNumber(start, dataSize); 26623 addHex(start, end, dataSize); 26624 stream.readHexNumber(end, dataSize); 26625 addHex(end, start, dataSize); 26626 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 26627 } 26628 26629 break; 26630 26631 case 1: 26632 stream.readHex(start, dataSize); 26633 stream.readHexNumber(end, dataSize); 26634 addHex(end, start, dataSize); 26635 stream.readNumber(); 26636 26637 for (let i = 1; i < subitemsCount; i++) { 26638 incHex(end, dataSize); 26639 stream.readHexNumber(start, dataSize); 26640 addHex(start, end, dataSize); 26641 stream.readHexNumber(end, dataSize); 26642 addHex(end, start, dataSize); 26643 stream.readNumber(); 26644 } 26645 26646 break; 26647 26648 case 2: 26649 stream.readHex(char, dataSize); 26650 code = stream.readNumber(); 26651 cMap.mapOne(hexToInt(char, dataSize), code); 26652 26653 for (let i = 1; i < subitemsCount; i++) { 26654 incHex(char, dataSize); 26655 26656 if (!sequence) { 26657 stream.readHexNumber(tmp, dataSize); 26658 addHex(char, tmp, dataSize); 26659 } 26660 26661 code = stream.readSigned() + (code + 1); 26662 cMap.mapOne(hexToInt(char, dataSize), code); 26663 } 26664 26665 break; 26666 26667 case 3: 26668 stream.readHex(start, dataSize); 26669 stream.readHexNumber(end, dataSize); 26670 addHex(end, start, dataSize); 26671 code = stream.readNumber(); 26672 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 26673 26674 for (let i = 1; i < subitemsCount; i++) { 26675 incHex(end, dataSize); 26676 26677 if (!sequence) { 26678 stream.readHexNumber(start, dataSize); 26679 addHex(start, end, dataSize); 26680 } else { 26681 start.set(end); 26682 } 26683 26684 stream.readHexNumber(end, dataSize); 26685 addHex(end, start, dataSize); 26686 code = stream.readNumber(); 26687 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 26688 } 26689 26690 break; 26691 26692 case 4: 26693 stream.readHex(char, ucs2DataSize); 26694 stream.readHex(charCode, dataSize); 26695 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 26696 26697 for (let i = 1; i < subitemsCount; i++) { 26698 incHex(char, ucs2DataSize); 26699 26700 if (!sequence) { 26701 stream.readHexNumber(tmp, ucs2DataSize); 26702 addHex(char, tmp, ucs2DataSize); 26703 } 26704 26705 incHex(charCode, dataSize); 26706 stream.readHexSigned(tmp, dataSize); 26707 addHex(charCode, tmp, dataSize); 26708 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 26709 } 26710 26711 break; 26712 26713 case 5: 26714 stream.readHex(start, ucs2DataSize); 26715 stream.readHexNumber(end, ucs2DataSize); 26716 addHex(end, start, ucs2DataSize); 26717 stream.readHex(charCode, dataSize); 26718 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 26719 26720 for (let i = 1; i < subitemsCount; i++) { 26721 incHex(end, ucs2DataSize); 26722 26723 if (!sequence) { 26724 stream.readHexNumber(start, ucs2DataSize); 26725 addHex(start, end, ucs2DataSize); 26726 } else { 26727 start.set(end); 26728 } 26729 26730 stream.readHexNumber(end, ucs2DataSize); 26731 addHex(end, start, ucs2DataSize); 26732 stream.readHex(charCode, dataSize); 26733 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 26734 } 26735 26736 break; 26737 26738 default: 26739 throw new Error(`BinaryCMapReader.process - unknown type: ${type}`); 26740 } 26741 } 26742 26743 if (useCMap) { 26744 return extend(useCMap); 26745 } 26746 26747 return cMap; 26748 } 26749 26750 } 26751 26752 return BinaryCMapReader; 26753}(); 26754 26755const CMapFactory = function CMapFactoryClosure() { 26756 function strToInt(str) { 26757 let a = 0; 26758 26759 for (let i = 0; i < str.length; i++) { 26760 a = a << 8 | str.charCodeAt(i); 26761 } 26762 26763 return a >>> 0; 26764 } 26765 26766 function expectString(obj) { 26767 if (!(0, _util.isString)(obj)) { 26768 throw new _util.FormatError("Malformed CMap: expected string."); 26769 } 26770 } 26771 26772 function expectInt(obj) { 26773 if (!Number.isInteger(obj)) { 26774 throw new _util.FormatError("Malformed CMap: expected int."); 26775 } 26776 } 26777 26778 function parseBfChar(cMap, lexer) { 26779 while (true) { 26780 let obj = lexer.getObj(); 26781 26782 if (obj === _primitives.EOF) { 26783 break; 26784 } 26785 26786 if ((0, _primitives.isCmd)(obj, "endbfchar")) { 26787 return; 26788 } 26789 26790 expectString(obj); 26791 const src = strToInt(obj); 26792 obj = lexer.getObj(); 26793 expectString(obj); 26794 const dst = obj; 26795 cMap.mapOne(src, dst); 26796 } 26797 } 26798 26799 function parseBfRange(cMap, lexer) { 26800 while (true) { 26801 let obj = lexer.getObj(); 26802 26803 if (obj === _primitives.EOF) { 26804 break; 26805 } 26806 26807 if ((0, _primitives.isCmd)(obj, "endbfrange")) { 26808 return; 26809 } 26810 26811 expectString(obj); 26812 const low = strToInt(obj); 26813 obj = lexer.getObj(); 26814 expectString(obj); 26815 const high = strToInt(obj); 26816 obj = lexer.getObj(); 26817 26818 if (Number.isInteger(obj) || (0, _util.isString)(obj)) { 26819 const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj; 26820 cMap.mapBfRange(low, high, dstLow); 26821 } else if ((0, _primitives.isCmd)(obj, "[")) { 26822 obj = lexer.getObj(); 26823 const array = []; 26824 26825 while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) { 26826 array.push(obj); 26827 obj = lexer.getObj(); 26828 } 26829 26830 cMap.mapBfRangeToArray(low, high, array); 26831 } else { 26832 break; 26833 } 26834 } 26835 26836 throw new _util.FormatError("Invalid bf range."); 26837 } 26838 26839 function parseCidChar(cMap, lexer) { 26840 while (true) { 26841 let obj = lexer.getObj(); 26842 26843 if (obj === _primitives.EOF) { 26844 break; 26845 } 26846 26847 if ((0, _primitives.isCmd)(obj, "endcidchar")) { 26848 return; 26849 } 26850 26851 expectString(obj); 26852 const src = strToInt(obj); 26853 obj = lexer.getObj(); 26854 expectInt(obj); 26855 const dst = obj; 26856 cMap.mapOne(src, dst); 26857 } 26858 } 26859 26860 function parseCidRange(cMap, lexer) { 26861 while (true) { 26862 let obj = lexer.getObj(); 26863 26864 if (obj === _primitives.EOF) { 26865 break; 26866 } 26867 26868 if ((0, _primitives.isCmd)(obj, "endcidrange")) { 26869 return; 26870 } 26871 26872 expectString(obj); 26873 const low = strToInt(obj); 26874 obj = lexer.getObj(); 26875 expectString(obj); 26876 const high = strToInt(obj); 26877 obj = lexer.getObj(); 26878 expectInt(obj); 26879 const dstLow = obj; 26880 cMap.mapCidRange(low, high, dstLow); 26881 } 26882 } 26883 26884 function parseCodespaceRange(cMap, lexer) { 26885 while (true) { 26886 let obj = lexer.getObj(); 26887 26888 if (obj === _primitives.EOF) { 26889 break; 26890 } 26891 26892 if ((0, _primitives.isCmd)(obj, "endcodespacerange")) { 26893 return; 26894 } 26895 26896 if (!(0, _util.isString)(obj)) { 26897 break; 26898 } 26899 26900 const low = strToInt(obj); 26901 obj = lexer.getObj(); 26902 26903 if (!(0, _util.isString)(obj)) { 26904 break; 26905 } 26906 26907 const high = strToInt(obj); 26908 cMap.addCodespaceRange(obj.length, low, high); 26909 } 26910 26911 throw new _util.FormatError("Invalid codespace range."); 26912 } 26913 26914 function parseWMode(cMap, lexer) { 26915 const obj = lexer.getObj(); 26916 26917 if (Number.isInteger(obj)) { 26918 cMap.vertical = !!obj; 26919 } 26920 } 26921 26922 function parseCMapName(cMap, lexer) { 26923 const obj = lexer.getObj(); 26924 26925 if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) { 26926 cMap.name = obj.name; 26927 } 26928 } 26929 26930 async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) { 26931 let previous, embeddedUseCMap; 26932 26933 objLoop: while (true) {
26934 try { 26935 const obj = lexer.getObj(); 26936 26937 if (obj === _primitives.EOF) { 26938 break; 26939 } else if ((0, _primitives.isName)(obj)) { 26940 if (obj.name === "WMode") { 26941 parseWMode(cMap, lexer); 26942 } else if (obj.name === "CMapName") { 26943 parseCMapName(cMap, lexer); 26944 } 26945 26946 previous = obj; 26947 } else if ((0, _primitives.isCmd)(obj)) { 26948 switch (obj.cmd) { 26949 case "endcmap": 26950 break objLoop; 26951 26952 case "usecmap": 26953 if ((0, _primitives.isName)(previous)) { 26954 embeddedUseCMap = previous.name; 26955 } 26956 26957 break; 26958 26959 case "begincodespacerange": 26960 parseCodespaceRange(cMap, lexer); 26961 break; 26962 26963 case "beginbfchar": 26964 parseBfChar(cMap, lexer); 26965 break; 26966 26967 case "begincidchar": 26968 parseCidChar(cMap, lexer); 26969 break; 26970 26971 case "beginbfrange": 26972 parseBfRange(cMap, lexer); 26973 break; 26974 26975 case "begincidrange": 26976 parseCidRange(cMap, lexer); 26977 break; 26978 } 26979 } 26980 } catch (ex) { 26981 if (ex instanceof _core_utils.MissingDataException) { 26982 throw ex; 26983 } 26984 26985 (0, _util.warn)("Invalid cMap data: " + ex); 26986 continue; 26987 } 26988 } 26989 26990 if (!useCMap && embeddedUseCMap) { 26991 useCMap = embeddedUseCMap; 26992 } 26993 26994 if (useCMap) { 26995 return extendCMap(cMap, fetchBuiltInCMap, useCMap); 26996 } 26997 26998 return cMap; 26999 } 27000 27001 async function extendCMap(cMap, fetchBuiltInCMap, useCMap) { 27002 cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap); 27003 27004 if (cMap.numCodespaceRanges === 0) { 27005 const useCodespaceRanges = cMap.useCMap.codespaceRanges; 27006 27007 for (let i = 0; i < useCodespaceRanges.length; i++) { 27008 cMap.codespaceRanges[i] = useCodespaceRanges[i].slice(); 27009 } 27010 27011 cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges; 27012 } 27013 27014 cMap.useCMap.forEach(function (key, value) { 27015 if (!cMap.contains(key)) { 27016 cMap.mapOne(key, cMap.useCMap.lookup(key)); 27017 } 27018 }); 27019 return cMap; 27020 } 27021 27022 async function createBuiltInCMap(name, fetchBuiltInCMap) { 27023 if (name === "Identity-H") { 27024 return new IdentityCMap(false, 2); 27025 } else if (name === "Identity-V") { 27026 return new IdentityCMap(true, 2); 27027 } 27028 27029 if (!BUILT_IN_CMAPS.includes(name)) { 27030 throw new Error("Unknown CMap name: " + name); 27031 } 27032 27033 if (!fetchBuiltInCMap) { 27034 throw new Error("Built-in CMap parameters are not provided."); 27035 } 27036 27037 const { 27038 cMapData, 27039 compressionType 27040 } = await fetchBuiltInCMap(name); 27041 const cMap = new CMap(true); 27042 27043 if (compressionType === _util.CMapCompressionType.BINARY) { 27044 return new BinaryCMapReader().process(cMapData, cMap, useCMap => { 27045 return extendCMap(cMap, fetchBuiltInCMap, useCMap); 27046 }); 27047 } 27048 27049 if (compressionType === _util.CMapCompressionType.NONE) { 27050 const lexer = new _parser.Lexer(new _stream.Stream(cMapData)); 27051 return parseCMap(cMap, lexer, fetchBuiltInCMap, null); 27052 } 27053 27054 throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported."); 27055 } 27056 27057 return { 27058 async create(params) { 27059 const encoding = params.encoding; 27060 const fetchBuiltInCMap = params.fetchBuiltInCMap; 27061 const useCMap = params.useCMap; 27062 27063 if ((0, _primitives.isName)(encoding)) { 27064 return createBuiltInCMap(encoding.name, fetchBuiltInCMap); 27065 } else if ((0, _primitives.isStream)(encoding)) { 27066 const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap); 27067 27068 if (parsedCMap.isIdentityCMap) { 27069 return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap); 27070 } 27071 27072 return parsedCMap; 27073 } 27074 27075 throw new Error("Encoding required."); 27076 } 27077 27078 }; 27079}(); 27080 27081exports.CMapFactory = CMapFactory; 27082 27083/***/ }), 27084/* 27 */ 27085/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 27086 27087 27088 27089Object.defineProperty(exports, "__esModule", ({ 27090 value: true 27091})); 27092exports.Parser = exports.Linearization = exports.Lexer = void 0; 27093 27094var _util = __w_pdfjs_require__(2); 27095 27096var _primitives = __w_pdfjs_require__(5); 27097 27098var _core_utils = __w_pdfjs_require__(9); 27099 27100var _ascii_85_stream = __w_pdfjs_require__(28); 27101 27102var _ascii_hex_stream = __w_pdfjs_require__(30); 27103 27104var _ccitt_stream = __w_pdfjs_require__(31); 27105 27106var _flate_stream = __w_pdfjs_require__(33); 27107 27108var _jbig2_stream = __w_pdfjs_require__(34); 27109 27110var _jpeg_stream = __w_pdfjs_require__(37); 27111 27112var _jpx_stream = __w_pdfjs_require__(39); 27113 27114var _lzw_stream = __w_pdfjs_require__(41); 27115 27116var _stream = __w_pdfjs_require__(10); 27117 27118var _predictor_stream = __w_pdfjs_require__(42); 27119 27120var _run_length_stream = __w_pdfjs_require__(43); 27121 27122const MAX_LENGTH_TO_CACHE = 1000; 27123const MAX_ADLER32_LENGTH = 5552; 27124 27125function computeAdler32(bytes) { 27126 const bytesLength = bytes.length; 27127 let a = 1, 27128 b = 0; 27129 27130 for (let i = 0; i < bytesLength; ++i) { 27131 a += bytes[i] & 0xff;
27132 b += a; 27133 } 27134 27135 return b % 65521 << 16 | a % 65521; 27136} 27137 27138class Parser { 27139 constructor({ 27140 lexer, 27141 xref, 27142 allowStreams = false, 27143 recoveryMode = false 27144 }) { 27145 this.lexer = lexer; 27146 this.xref = xref; 27147 this.allowStreams = allowStreams; 27148 this.recoveryMode = recoveryMode; 27149 this.imageCache = Object.create(null); 27150 this.refill(); 27151 } 27152 27153 refill() { 27154 this.buf1 = this.lexer.getObj(); 27155 this.buf2 = this.lexer.getObj(); 27156 } 27157 27158 shift() { 27159 if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") { 27160 this.buf1 = this.buf2; 27161 this.buf2 = null; 27162 } else { 27163 this.buf1 = this.buf2; 27164 this.buf2 = this.lexer.getObj(); 27165 } 27166 } 27167 27168 tryShift() { 27169 try { 27170 this.shift(); 27171 return true; 27172 } catch (e) { 27173 if (e instanceof _core_utils.MissingDataException) { 27174 throw e; 27175 } 27176 27177 return false; 27178 } 27179 } 27180 27181 getObj(cipherTransform = null) { 27182 const buf1 = this.buf1; 27183 this.shift(); 27184 27185 if (buf1 instanceof _primitives.Cmd) { 27186 switch (buf1.cmd) { 27187 case "BI": 27188 return this.makeInlineImage(cipherTransform); 27189 27190 case "[": 27191 const array = []; 27192 27193 while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) { 27194 array.push(this.getObj(cipherTransform)); 27195 } 27196 27197 if (this.buf1 === _primitives.EOF) { 27198 if (this.recoveryMode) { 27199 return array; 27200 } 27201 27202 throw new _core_utils.ParserEOFException("End of file inside array."); 27203 } 27204 27205 this.shift(); 27206 return array; 27207 27208 case "<<": 27209 const dict = new _primitives.Dict(this.xref); 27210 27211 while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) { 27212 if (!(0, _primitives.isName)(this.buf1)) { 27213 (0, _util.info)("Malformed dictionary: key must be a name object"); 27214 this.shift(); 27215 continue; 27216 } 27217 27218 const key = this.buf1.name; 27219 this.shift(); 27220 27221 if (this.buf1 === _primitives.EOF) { 27222 break; 27223 } 27224 27225 dict.set(key, this.getObj(cipherTransform)); 27226 } 27227 27228 if (this.buf1 === _primitives.EOF) { 27229 if (this.recoveryMode) { 27230 return dict; 27231 } 27232 27233 throw new _core_utils.ParserEOFException("End of file inside dictionary."); 27234 } 27235 27236 if ((0, _primitives.isCmd)(this.buf2, "stream")) { 27237 return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict; 27238 } 27239 27240 this.shift(); 27241 return dict; 27242 27243 default: 27244 return buf1; 27245 } 27246 } 27247 27248 if (Number.isInteger(buf1)) { 27249 if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) { 27250 const ref = _primitives.Ref.get(buf1, this.buf1); 27251 27252 this.shift(); 27253 this.shift(); 27254 return ref; 27255 } 27256 27257 return buf1; 27258 } 27259 27260 if (typeof buf1 === "string") { 27261 if (cipherTransform) { 27262 return cipherTransform.decryptString(buf1); 27263 } 27264 27265 return buf1; 27266 } 27267 27268 return buf1; 27269 } 27270 27271 findDefaultInlineStreamEnd(stream) { 27272 const E = 0x45, 27273 I = 0x49, 27274 SPACE = 0x20, 27275 LF = 0xa, 27276 CR = 0xd, 27277 NUL = 0x0; 27278 const lexer = this.lexer, 27279 startPos = stream.pos, 27280 n = 10; 27281 let state = 0, 27282 ch, 27283 maybeEIPos; 27284 27285 while ((ch = stream.getByte()) !== -1) { 27286 if (state === 0) { 27287 state = ch === E ? 1 : 0; 27288 } else if (state === 1) { 27289 state = ch === I ? 2 : 0; 27290 } else { 27291 (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state."); 27292 27293 if (ch === SPACE || ch === LF || ch === CR) { 27294 maybeEIPos = stream.pos; 27295 const followingBytes = stream.peekBytes(n); 27296 27297 for (let i = 0, ii = followingBytes.length; i < ii; i++) { 27298 ch = followingBytes[i]; 27299 27300 if (ch === NUL && followingBytes[i + 1] !== NUL) { 27301 continue; 27302 } 27303 27304 if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) { 27305 state = 0; 27306 break; 27307 } 27308 } 27309 27310 if (state !== 2) { 27311 continue; 27312 } 27313 27314 if (lexer.knownCommands) { 27315 const nextObj = lexer.peekObj(); 27316 27317 if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) { 27318 state = 0; 27319 } 27320 } else { 27321 (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined."); 27322 } 27323 27324 if (state === 2) { 27325 break; 27326 } 27327 } else { 27328 state = 0; 27329 } 27330 } 27331 } 27332 27333 if (ch === -1) { 27334 (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker"); 27335 27336 if (maybeEIPos) {
27337 (0, _util.warn)('... trying to recover by using the last "EI" occurrence.'); 27338 stream.skip(-(stream.pos - maybeEIPos)); 27339 } 27340 } 27341 27342 let endOffset = 4; 27343 stream.skip(-endOffset); 27344 ch = stream.peekByte(); 27345 stream.skip(endOffset); 27346 27347 if (!(0, _core_utils.isWhiteSpace)(ch)) { 27348 endOffset--; 27349 } 27350 27351 return stream.pos - endOffset - startPos; 27352 } 27353 27354 findDCTDecodeInlineStreamEnd(stream) { 27355 const startPos = stream.pos; 27356 let foundEOI = false, 27357 b, 27358 markerLength; 27359 27360 while ((b = stream.getByte()) !== -1) { 27361 if (b !== 0xff) { 27362 continue; 27363 } 27364 27365 switch (stream.getByte()) { 27366 case 0x00: 27367 break; 27368 27369 case 0xff: 27370 stream.skip(-1); 27371 break; 27372 27373 case 0xd9: 27374 foundEOI = true; 27375 break; 27376 27377 case 0xc0: 27378 case 0xc1: 27379 case 0xc2: 27380 case 0xc3: 27381 case 0xc5: 27382 case 0xc6: 27383 case 0xc7: 27384 case 0xc9: 27385 case 0xca: 27386 case 0xcb: 27387 case 0xcd: 27388 case 0xce: 27389 case 0xcf: 27390 case 0xc4: 27391 case 0xcc: 27392 case 0xda: 27393 case 0xdb: 27394 case 0xdc: 27395 case 0xdd: 27396 case 0xde: 27397 case 0xdf: 27398 case 0xe0: 27399 case 0xe1: 27400 case 0xe2: 27401 case 0xe3: 27402 case 0xe4: 27403 case 0xe5: 27404 case 0xe6: 27405 case 0xe7: 27406 case 0xe8: 27407 case 0xe9: 27408 case 0xea: 27409 case 0xeb: 27410 case 0xec: 27411 case 0xed: 27412 case 0xee: 27413 case 0xef: 27414 case 0xfe: 27415 markerLength = stream.getUint16(); 27416 27417 if (markerLength > 2) { 27418 stream.skip(markerLength - 2); 27419 } else { 27420 stream.skip(-2); 27421 } 27422 27423 break; 27424 } 27425 27426 if (foundEOI) { 27427 break; 27428 } 27429 } 27430 27431 const length = stream.pos - startPos; 27432 27433 if (b === -1) { 27434 (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead."); 27435 stream.skip(-length); 27436 return this.findDefaultInlineStreamEnd(stream); 27437 } 27438 27439 this.inlineStreamSkipEI(stream); 27440 return length; 27441 } 27442 27443 findASCII85DecodeInlineStreamEnd(stream) { 27444 const TILDE = 0x7e, 27445 GT = 0x3e; 27446 const startPos = stream.pos; 27447 let ch; 27448 27449 while ((ch = stream.getByte()) !== -1) { 27450 if (ch === TILDE) { 27451 const tildePos = stream.pos; 27452 ch = stream.peekByte(); 27453 27454 while ((0, _core_utils.isWhiteSpace)(ch)) { 27455 stream.skip(); 27456 ch = stream.peekByte(); 27457 } 27458 27459 if (ch === GT) { 27460 stream.skip(); 27461 break; 27462 } 27463 27464 if (stream.pos > tildePos) { 27465 const maybeEI = stream.peekBytes(2); 27466 27467 if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) { 27468 break; 27469 } 27470 } 27471 } 27472 } 27473 27474 const length = stream.pos - startPos; 27475 27476 if (ch === -1) { 27477 (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead."); 27478 stream.skip(-length); 27479 return this.findDefaultInlineStreamEnd(stream); 27480 } 27481 27482 this.inlineStreamSkipEI(stream); 27483 return length; 27484 } 27485 27486 findASCIIHexDecodeInlineStreamEnd(stream) { 27487 const GT = 0x3e; 27488 const startPos = stream.pos; 27489 let ch; 27490 27491 while ((ch = stream.getByte()) !== -1) { 27492 if (ch === GT) { 27493 break; 27494 } 27495 } 27496 27497 const length = stream.pos - startPos; 27498 27499 if (ch === -1) { 27500 (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead."); 27501 stream.skip(-length); 27502 return this.findDefaultInlineStreamEnd(stream); 27503 } 27504 27505 this.inlineStreamSkipEI(stream); 27506 return length; 27507 } 27508 27509 inlineStreamSkipEI(stream) { 27510 const E = 0x45, 27511 I = 0x49; 27512 let state = 0, 27513 ch; 27514 27515 while ((ch = stream.getByte()) !== -1) { 27516 if (state === 0) { 27517 state = ch === E ? 1 : 0; 27518 } else if (state === 1) { 27519 state = ch === I ? 2 : 0; 27520 } else if (state === 2) { 27521 break; 27522 } 27523 } 27524 } 27525 27526 makeInlineImage(cipherTransform) { 27527 const lexer = this.lexer; 27528 const stream = lexer.stream; 27529 const dict = new _primitives.Dict(this.xref); 27530 let dictLength; 27531 27532 while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) { 27533 if (!(0, _primitives.isName)(this.buf1)) { 27534 throw new _util.FormatError("Dictionary key must be a name object"); 27535 } 27536
27537 const key = this.buf1.name; 27538 this.shift(); 27539 27540 if (this.buf1 === _primitives.EOF) { 27541 break; 27542 } 27543 27544 dict.set(key, this.getObj(cipherTransform)); 27545 } 27546 27547 if (lexer.beginInlineImagePos !== -1) { 27548 dictLength = stream.pos - lexer.beginInlineImagePos; 27549 } 27550 27551 const filter = dict.get("F", "Filter"); 27552 let filterName; 27553 27554 if ((0, _primitives.isName)(filter)) { 27555 filterName = filter.name; 27556 } else if (Array.isArray(filter)) { 27557 const filterZero = this.xref.fetchIfRef(filter[0]); 27558 27559 if ((0, _primitives.isName)(filterZero)) { 27560 filterName = filterZero.name; 27561 } 27562 } 27563 27564 const startPos = stream.pos; 27565 let length; 27566 27567 switch (filterName) { 27568 case "DCT": 27569 case "DCTDecode": 27570 length = this.findDCTDecodeInlineStreamEnd(stream); 27571 break; 27572 27573 case "A85": 27574 case "ASCII85Decode": 27575 length = this.findASCII85DecodeInlineStreamEnd(stream); 27576 break; 27577 27578 case "AHx": 27579 case "ASCIIHexDecode": 27580 length = this.findASCIIHexDecodeInlineStreamEnd(stream); 27581 break; 27582 27583 default: 27584 length = this.findDefaultInlineStreamEnd(stream); 27585 } 27586 27587 let imageStream = stream.makeSubStream(startPos, length, dict); 27588 let cacheKey; 27589 27590 if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) { 27591 const imageBytes = imageStream.getBytes(); 27592 imageStream.reset(); 27593 const initialStreamPos = stream.pos; 27594 stream.pos = lexer.beginInlineImagePos; 27595 const dictBytes = stream.getBytes(dictLength); 27596 stream.pos = initialStreamPos; 27597 cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes); 27598 const cacheEntry = this.imageCache[cacheKey]; 27599 27600 if (cacheEntry !== undefined) { 27601 this.buf2 = _primitives.Cmd.get("EI"); 27602 this.shift(); 27603 cacheEntry.reset(); 27604 return cacheEntry; 27605 } 27606 } 27607 27608 if (cipherTransform) { 27609 imageStream = cipherTransform.createStream(imageStream, length); 27610 } 27611 27612 imageStream = this.filter(imageStream, dict, length); 27613 imageStream.dict = dict; 27614 27615 if (cacheKey !== undefined) { 27616 imageStream.cacheKey = `inline_${length}_${cacheKey}`; 27617 this.imageCache[cacheKey] = imageStream; 27618 } 27619 27620 this.buf2 = _primitives.Cmd.get("EI"); 27621 this.shift(); 27622 return imageStream; 27623 } 27624 27625 _findStreamLength(startPos, signature) { 27626 const { 27627 stream 27628 } = this.lexer; 27629 stream.pos = startPos; 27630 const SCAN_BLOCK_LENGTH = 2048; 27631 const signatureLength = signature.length; 27632 27633 while (stream.pos < stream.end) { 27634 const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 27635 const scanLength = scanBytes.length - signatureLength; 27636 27637 if (scanLength <= 0) { 27638 break; 27639 } 27640 27641 let pos = 0; 27642 27643 while (pos < scanLength) { 27644 let j = 0; 27645 27646 while (j < signatureLength && scanBytes[pos + j] === signature[j]) { 27647 j++; 27648 } 27649 27650 if (j >= signatureLength) { 27651 stream.pos += pos; 27652 return stream.pos - startPos; 27653 } 27654 27655 pos++; 27656 } 27657 27658 stream.pos += scanLength; 27659 } 27660 27661 return -1; 27662 } 27663 27664 makeStream(dict, cipherTransform) { 27665 const lexer = this.lexer; 27666 let stream = lexer.stream; 27667 lexer.skipToNextLine(); 27668 const startPos = stream.pos - 1; 27669 let length = dict.get("Length"); 27670 27671 if (!Number.isInteger(length)) { 27672 (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`); 27673 length = 0; 27674 } 27675 27676 stream.pos = startPos + length; 27677 lexer.nextChar(); 27678 27679 if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) { 27680 this.shift(); 27681 } else { 27682 const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]); 27683 27684 let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE); 27685 27686 if (actualLength < 0) { 27687 const MAX_TRUNCATION = 1; 27688 27689 for (let i = 1; i <= MAX_TRUNCATION; i++) { 27690 const end = ENDSTREAM_SIGNATURE.length - i; 27691 const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end); 27692
27693 const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE); 27694 27695 if (maybeLength >= 0) { 27696 const lastByte = stream.peekBytes(end + 1)[end]; 27697 27698 if (!(0, _core_utils.isWhiteSpace)(lastByte)) { 27699 break; 27700 } 27701 27702 (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command."); 27703 actualLength = maybeLength; 27704 break; 27705 } 27706 } 27707 27708 if (actualLength < 0) { 27709 throw new _util.FormatError("Missing endstream command."); 27710 } 27711 } 27712 27713 length = actualLength; 27714 lexer.nextChar(); 27715 this.shift(); 27716 this.shift(); 27717 } 27718 27719 this.shift(); 27720 stream = stream.makeSubStream(startPos, length, dict); 27721 27722 if (cipherTransform) { 27723 stream = cipherTransform.createStream(stream, length); 27724 } 27725 27726 stream = this.filter(stream, dict, length); 27727 stream.dict = dict; 27728 return stream; 27729 } 27730 27731 filter(stream, dict, length) { 27732 let filter = dict.get("F", "Filter"); 27733 let params = dict.get("DP", "DecodeParms"); 27734 27735 if ((0, _primitives.isName)(filter)) { 27736 if (Array.isArray(params)) { 27737 (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name."); 27738 } 27739 27740 return this.makeFilter(stream, filter.name, length, params); 27741 } 27742 27743 let maybeLength = length; 27744 27745 if (Array.isArray(filter)) { 27746 const filterArray = filter; 27747 const paramsArray = params; 27748 27749 for (let i = 0, ii = filterArray.length; i < ii; ++i) { 27750 filter = this.xref.fetchIfRef(filterArray[i]); 27751 27752 if (!(0, _primitives.isName)(filter)) { 27753 throw new _util.FormatError(`Bad filter name "${filter}"`); 27754 } 27755 27756 params = null; 27757 27758 if (Array.isArray(paramsArray) && i in paramsArray) { 27759 params = this.xref.fetchIfRef(paramsArray[i]); 27760 } 27761 27762 stream = this.makeFilter(stream, filter.name, maybeLength, params); 27763 maybeLength = null; 27764 } 27765 } 27766 27767 return stream; 27768 } 27769 27770 makeFilter(stream, name, maybeLength, params) { 27771 if (maybeLength === 0) { 27772 (0, _util.warn)(`Empty "${name}" stream.`); 27773 return new _stream.NullStream(); 27774 } 27775 27776 const xrefStats = this.xref.stats; 27777 27778 try { 27779 switch (name) { 27780 case "Fl": 27781 case "FlateDecode": 27782 xrefStats.addStreamType(_util.StreamType.FLATE); 27783 27784 if (params) { 27785 return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params); 27786 } 27787 27788 return new _flate_stream.FlateStream(stream, maybeLength); 27789 27790 case "LZW": 27791 case "LZWDecode": 27792 xrefStats.addStreamType(_util.StreamType.LZW); 27793 let earlyChange = 1; 27794 27795 if (params) { 27796 if (params.has("EarlyChange")) { 27797 earlyChange = params.get("EarlyChange"); 27798 } 27799 27800 return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params); 27801 } 27802 27803 return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange); 27804 27805 case "DCT": 27806 case "DCTDecode": 27807 xrefStats.addStreamType(_util.StreamType.DCT); 27808 return new _jpeg_stream.JpegStream(stream, maybeLength, params); 27809 27810 case "JPX": 27811 case "JPXDecode": 27812 xrefStats.addStreamType(_util.StreamType.JPX); 27813 return new _jpx_stream.JpxStream(stream, maybeLength, params); 27814 27815 case "A85": 27816 case "ASCII85Decode": 27817 xrefStats.addStreamType(_util.StreamType.A85); 27818 return new _ascii_85_stream.Ascii85Stream(stream, maybeLength); 27819 27820 case "AHx": 27821 case "ASCIIHexDecode": 27822 xrefStats.addStreamType(_util.StreamType.AHX); 27823 return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength); 27824 27825 case "CCF": 27826 case "CCITTFaxDecode": 27827 xrefStats.addStreamType(_util.StreamType.CCF); 27828 return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params); 27829 27830 case "RL": 27831 case "RunLengthDecode": 27832 xrefStats.addStreamType(_util.StreamType.RLX); 27833 return new _run_length_stream.RunLengthStream(stream, maybeLength); 27834 27835 case "JBIG2Decode": 27836 xrefStats.addStreamType(_util.StreamType.JBIG); 27837 return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params); 27838 } 27839 27840 (0, _util.warn)(`Filter "${name}" is not supported.`); 27841 return stream; 27842 } catch (ex) { 27843 if (ex instanceof _core_utils.MissingDataException) { 27844 throw ex; 27845 } 27846 27847 (0, _util.warn)(`Invalid stream: "${ex}"`); 27848 return new _stream.NullStream(); 27849 } 27850 } 27851 27852} 27853 27854exports.Parser = Parser; 27855const 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]; 27856 27857function toHexDigit(ch) { 27858 if (ch >= 0x30 && ch <= 0x39) { 27859 return ch & 0x0f; 27860 } 27861 27862 if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 27863 return (ch & 0x0f) + 9; 27864 } 27865 27866 return -1; 27867} 27868 27869class Lexer { 27870 constructor(stream, knownCommands = null) { 27871 this.stream = stream; 27872 this.nextChar(); 27873 this.strBuf = []; 27874 this.knownCommands = knownCommands; 27875 this._hexStringNumWarn = 0; 27876 this.beginInlineImagePos = -1; 27877 } 27878 27879 nextChar() { 27880 return this.currentChar = this.stream.getByte(); 27881 } 27882 27883 peekChar() { 27884 return this.stream.peekByte(); 27885 } 27886 27887 getNumber() {
vendor: 4,648 bytes, lines 27888-28103
27888 let ch = this.currentChar; 27889 let eNotation = false; 27890 let divideBy = 0; 27891 let sign = 0; 27892 27893 if (ch === 0x2d) { 27894 sign = -1; 27895 ch = this.nextChar(); 27896 27897 if (ch === 0x2d) { 27898 ch = this.nextChar(); 27899 } 27900 } else if (ch === 0x2b) { 27901 sign = 1; 27902 ch = this.nextChar(); 27903 } 27904 27905 if (ch === 0x0a || ch === 0x0d) { 27906 do { 27907 ch = this.nextChar(); 27908 } while (ch === 0x0a || ch === 0x0d); 27909 } 27910 27911 if (ch === 0x2e) { 27912 divideBy = 10; 27913 ch = this.nextChar(); 27914 } 27915 27916 if (ch < 0x30 || ch > 0x39) { 27917 if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) { 27918 (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero."); 27919 return 0; 27920 } 27921 27922 throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`); 27923 } 27924 27925 sign = sign || 1; 27926 let baseValue = ch - 0x30; 27927 let powerValue = 0; 27928 let powerValueSign = 1; 27929 27930 while ((ch = this.nextChar()) >= 0) { 27931 if (ch >= 0x30 && ch <= 0x39) { 27932 const currentDigit = ch - 0x30; 27933 27934 if (eNotation) { 27935 powerValue = powerValue * 10 + currentDigit; 27936 } else { 27937 if (divideBy !== 0) { 27938 divideBy *= 10; 27939 } 27940 27941 baseValue = baseValue * 10 + currentDigit; 27942 } 27943 } else if (ch === 0x2e) { 27944 if (divideBy === 0) { 27945 divideBy = 1; 27946 } else { 27947 break; 27948 } 27949 } else if (ch === 0x2d) { 27950 (0, _util.warn)("Badly formatted number: minus sign in the middle"); 27951 } else if (ch === 0x45 || ch === 0x65) { 27952 ch = this.peekChar(); 27953 27954 if (ch === 0x2b || ch === 0x2d) { 27955 powerValueSign = ch === 0x2d ? -1 : 1; 27956 this.nextChar(); 27957 } else if (ch < 0x30 || ch > 0x39) { 27958 break; 27959 } 27960 27961 eNotation = true; 27962 } else { 27963 break; 27964 } 27965 } 27966 27967 if (divideBy !== 0) { 27968 baseValue /= divideBy; 27969 } 27970 27971 if (eNotation) { 27972 baseValue *= 10 ** (powerValueSign * powerValue); 27973 } 27974 27975 return sign * baseValue; 27976 } 27977 27978 getString() { 27979 let numParen = 1; 27980 let done = false; 27981 const strBuf = this.strBuf; 27982 strBuf.length = 0; 27983 let ch = this.nextChar(); 27984 27985 while (true) { 27986 let charBuffered = false; 27987 27988 switch (ch | 0) { 27989 case -1: 27990 (0, _util.warn)("Unterminated string"); 27991 done = true; 27992 break; 27993 27994 case 0x28: 27995 ++numParen; 27996 strBuf.push("("); 27997 break; 27998 27999 case 0x29: 28000 if (--numParen === 0) { 28001 this.nextChar(); 28002 done = true; 28003 } else { 28004 strBuf.push(")"); 28005 } 28006 28007 break; 28008 28009 case 0x5c: 28010 ch = this.nextChar(); 28011 28012 switch (ch) { 28013 case -1: 28014 (0, _util.warn)("Unterminated string"); 28015 done = true; 28016 break; 28017 28018 case 0x6e: 28019 strBuf.push("\n"); 28020 break; 28021 28022 case 0x72: 28023 strBuf.push("\r"); 28024 break; 28025 28026 case 0x74: 28027 strBuf.push("\t"); 28028 break; 28029 28030 case 0x62: 28031 strBuf.push("\b"); 28032 break; 28033 28034 case 0x66: 28035 strBuf.push("\f"); 28036 break; 28037 28038 case 0x5c: 28039 case 0x28: 28040 case 0x29: 28041 strBuf.push(String.fromCharCode(ch)); 28042 break; 28043 28044 case 0x30: 28045 case 0x31: 28046 case 0x32: 28047 case 0x33: 28048 case 0x34: 28049 case 0x35: 28050 case 0x36: 28051 case 0x37: 28052 let x = ch & 0x0f; 28053 ch = this.nextChar(); 28054 charBuffered = true; 28055 28056 if (ch >= 0x30 && ch <= 0x37) { 28057 x = (x << 3) + (ch & 0x0f); 28058 ch = this.nextChar(); 28059 28060 if (ch >= 0x30 && ch <= 0x37) { 28061 charBuffered = false; 28062 x = (x << 3) + (ch & 0x0f); 28063 } 28064 } 28065 28066 strBuf.push(String.fromCharCode(x)); 28067 break; 28068 28069 case 0x0d: 28070 if (this.peekChar() === 0x0a) { 28071 this.nextChar(); 28072 } 28073 28074 break; 28075 28076 case 0x0a: 28077 break; 28078 28079 default: 28080 strBuf.push(String.fromCharCode(ch)); 28081 break; 28082 } 28083 28084 break; 28085 28086 default: 28087 strBuf.push(String.fromCharCode(ch)); 28088 break; 28089 } 28090 28091 if (done) { 28092 break; 28093 } 28094 28095 if (!charBuffered) { 28096 ch = this.nextChar(); 28097 } 28098 } 28099 28100 return strBuf.join(""); 28101 } 28102 28103 getName() {
28104 let ch, previousCh; 28105 const strBuf = this.strBuf; 28106 strBuf.length = 0; 28107 28108 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 28109 if (ch === 0x23) { 28110 ch = this.nextChar(); 28111 28112 if (specialChars[ch]) { 28113 (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number."); 28114 strBuf.push("#"); 28115 break; 28116 } 28117 28118 const x = toHexDigit(ch); 28119 28120 if (x !== -1) { 28121 previousCh = ch; 28122 ch = this.nextChar(); 28123 const x2 = toHexDigit(ch); 28124 28125 if (x2 === -1) { 28126 (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number."); 28127 strBuf.push("#", String.fromCharCode(previousCh)); 28128 28129 if (specialChars[ch]) { 28130 break; 28131 } 28132 28133 strBuf.push(String.fromCharCode(ch)); 28134 continue; 28135 } 28136 28137 strBuf.push(String.fromCharCode(x << 4 | x2)); 28138 } else { 28139 strBuf.push("#", String.fromCharCode(ch)); 28140 } 28141 } else { 28142 strBuf.push(String.fromCharCode(ch)); 28143 } 28144 } 28145 28146 if (strBuf.length > 127) { 28147 (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`); 28148 } 28149 28150 return _primitives.Name.get(strBuf.join("")); 28151 } 28152 28153 _hexStringWarn(ch) { 28154 const MAX_HEX_STRING_NUM_WARN = 5; 28155 28156 if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) { 28157 (0, _util.warn)("getHexString - ignoring additional invalid characters."); 28158 return; 28159 } 28160 28161 if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) { 28162 return; 28163 } 28164 28165 (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`); 28166 } 28167 28168 getHexString() { 28169 const strBuf = this.strBuf; 28170 strBuf.length = 0; 28171 let ch = this.currentChar; 28172 let isFirstHex = true; 28173 let firstDigit, secondDigit; 28174 this._hexStringNumWarn = 0; 28175 28176 while (true) { 28177 if (ch < 0) { 28178 (0, _util.warn)("Unterminated hex string"); 28179 break; 28180 } else if (ch === 0x3e) { 28181 this.nextChar(); 28182 break; 28183 } else if (specialChars[ch] === 1) { 28184 ch = this.nextChar(); 28185 continue; 28186 } else { 28187 if (isFirstHex) { 28188 firstDigit = toHexDigit(ch); 28189 28190 if (firstDigit === -1) { 28191 this._hexStringWarn(ch); 28192 28193 ch = this.nextChar(); 28194 continue; 28195 } 28196 } else { 28197 secondDigit = toHexDigit(ch); 28198 28199 if (secondDigit === -1) { 28200 this._hexStringWarn(ch); 28201 28202 ch = this.nextChar(); 28203 continue; 28204 } 28205 28206 strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit)); 28207 } 28208 28209 isFirstHex = !isFirstHex; 28210 ch = this.nextChar(); 28211 } 28212 } 28213 28214 return strBuf.join(""); 28215 } 28216 28217 getObj() {
28218 let comment = false; 28219 let ch = this.currentChar; 28220 28221 while (true) { 28222 if (ch < 0) { 28223 return _primitives.EOF; 28224 } 28225 28226 if (comment) { 28227 if (ch === 0x0a || ch === 0x0d) { 28228 comment = false; 28229 } 28230 } else if (ch === 0x25) { 28231 comment = true; 28232 } else if (specialChars[ch] !== 1) { 28233 break; 28234 } 28235 28236 ch = this.nextChar(); 28237 } 28238 28239 switch (ch | 0) { 28240 case 0x30: 28241 case 0x31: 28242 case 0x32: 28243 case 0x33: 28244 case 0x34: 28245 case 0x35: 28246 case 0x36: 28247 case 0x37: 28248 case 0x38: 28249 case 0x39: 28250 case 0x2b: 28251 case 0x2d: 28252 case 0x2e: 28253 return this.getNumber(); 28254 28255 case 0x28: 28256 return this.getString(); 28257 28258 case 0x2f: 28259 return this.getName(); 28260 28261 case 0x5b: 28262 this.nextChar(); 28263 return _primitives.Cmd.get("["); 28264 28265 case 0x5d: 28266 this.nextChar(); 28267 return _primitives.Cmd.get("]"); 28268 28269 case 0x3c: 28270 ch = this.nextChar(); 28271 28272 if (ch === 0x3c) { 28273 this.nextChar(); 28274 return _primitives.Cmd.get("<<"); 28275 } 28276 28277 return this.getHexString(); 28278 28279 case 0x3e: 28280 ch = this.nextChar(); 28281 28282 if (ch === 0x3e) { 28283 this.nextChar(); 28284 return _primitives.Cmd.get(">>"); 28285 } 28286 28287 return _primitives.Cmd.get(">"); 28288 28289 case 0x7b: 28290 this.nextChar(); 28291 return _primitives.Cmd.get("{"); 28292 28293 case 0x7d: 28294 this.nextChar(); 28295 return _primitives.Cmd.get("}"); 28296 28297 case 0x29: 28298 this.nextChar(); 28299 throw new _util.FormatError(`Illegal character: ${ch}`); 28300 } 28301 28302 let str = String.fromCharCode(ch); 28303 28304 if (ch < 0x20 || ch > 0x7f) { 28305 const nextCh = this.peekChar(); 28306 28307 if (nextCh >= 0x20 && nextCh <= 0x7f) { 28308 this.nextChar(); 28309 return _primitives.Cmd.get(str); 28310 } 28311 } 28312 28313 const knownCommands = this.knownCommands; 28314 let knownCommandFound = knownCommands && knownCommands[str] !== undefined; 28315 28316 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 28317 const possibleCommand = str + String.fromCharCode(ch); 28318 28319 if (knownCommandFound && knownCommands[possibleCommand] === undefined) { 28320 break; 28321 } 28322 28323 if (str.length === 128) { 28324 throw new _util.FormatError(`Command token too long: ${str.length}`); 28325 } 28326 28327 str = possibleCommand; 28328 knownCommandFound = knownCommands && knownCommands[str] !== undefined; 28329 } 28330 28331 if (str === "true") { 28332 return true; 28333 } 28334 28335 if (str === "false") { 28336 return false; 28337 } 28338 28339 if (str === "null") { 28340 return null; 28341 } 28342 28343 if (str === "BI") { 28344 this.beginInlineImagePos = this.stream.pos; 28345 } 28346 28347 return _primitives.Cmd.get(str); 28348 } 28349 28350 peekObj() { 28351 const streamPos = this.stream.pos, 28352 currentChar = this.currentChar, 28353 beginInlineImagePos = this.beginInlineImagePos; 28354 let nextObj; 28355 28356 try { 28357 nextObj = this.getObj(); 28358 } catch (ex) { 28359 if (ex instanceof _core_utils.MissingDataException) { 28360 throw ex; 28361 } 28362 28363 (0, _util.warn)(`peekObj: ${ex}`); 28364 } 28365 28366 this.stream.pos = streamPos; 28367 this.currentChar = currentChar; 28368 this.beginInlineImagePos = beginInlineImagePos; 28369 return nextObj; 28370 } 28371 28372 skipToNextLine() {
28373 let ch = this.currentChar; 28374 28375 while (ch >= 0) { 28376 if (ch === 0x0d) { 28377 ch = this.nextChar(); 28378 28379 if (ch === 0x0a) { 28380 this.nextChar(); 28381 } 28382 28383 break; 28384 } else if (ch === 0x0a) { 28385 this.nextChar(); 28386 break; 28387 } 28388 28389 ch = this.nextChar(); 28390 } 28391 } 28392 28393} 28394 28395exports.Lexer = Lexer; 28396 28397class Linearization { 28398 static create(stream) { 28399 function getInt(linDict, name, allowZeroValue = false) { 28400 const obj = linDict.get(name); 28401 28402 if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) { 28403 return obj; 28404 } 28405 28406 throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid."); 28407 } 28408 28409 function getHints(linDict) { 28410 const hints = linDict.get("H"); 28411 let hintsLength; 28412 28413 if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) { 28414 for (let index = 0; index < hintsLength; index++) { 28415 const hint = hints[index]; 28416 28417 if (!(Number.isInteger(hint) && hint > 0)) { 28418 throw new Error(`Hint (${index}
28418) in the linearization dictionary is invalid.`); 28419 } 28420 } 28421 28422 return hints; 28423 } 28424 28425 throw new Error("Hint array in the linearization dictionary is invalid."); 28426 } 28427 28428 const parser = new Parser({ 28429 lexer: new Lexer(stream), 28430 xref: null 28431 }); 28432 const obj1 = parser.getObj(); 28433 const obj2 = parser.getObj(); 28434 const obj3 = parser.getObj(); 28435 const linDict = parser.getObj(); 28436 let obj, length; 28437 28438 if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get("Linearized")) && obj > 0)) { 28439 return null; 28440 } else if ((length = getInt(linDict, "L")) !== stream.length) { 28441 throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length."); 28442 } 28443 28444 return { 28445 length, 28446 hints: getHints(linDict), 28447 objectNumberFirst: getInt(linDict, "O"), 28448 endFirst: getInt(linDict, "E"), 28449 numPages: getInt(linDict, "N"), 28450 mainXRefEntriesOffset: getInt(linDict, "T"), 28451 pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0 28452 }; 28453 } 28454 28455} 28456 28457exports.Linearization = Linearization; 28458 28459/***/ }), 28460/* 28 */ 28461/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 28462 28463 28464 28465Object.defineProperty(exports, "__esModule", ({ 28466 value: true 28467})); 28468exports.Ascii85Stream = void 0; 28469 28470var _decode_stream = __w_pdfjs_require__(29); 28471 28472var _core_utils = __w_pdfjs_require__(9); 28473 28474class Ascii85Stream extends _decode_stream.DecodeStream { 28475 constructor(str, maybeLength) { 28476 if (maybeLength) { 28477 maybeLength *= 0.8; 28478 } 28479 28480 super(maybeLength); 28481 this.str = str; 28482 this.dict = str.dict; 28483 this.input = new Uint8Array(5); 28484 } 28485 28486 readBlock() { 28487 const TILDA_CHAR = 0x7e; 28488 const Z_LOWER_CHAR = 0x7a; 28489 const EOF = -1; 28490 const str = this.str; 28491 let c = str.getByte(); 28492 28493 while ((0, _core_utils.isWhiteSpace)(c)) { 28494 c = str.getByte(); 28495 } 28496 28497 if (c === EOF || c === TILDA_CHAR) { 28498 this.eof = true; 28499 return; 28500 } 28501 28502 const bufferLength = this.bufferLength; 28503 let buffer, i; 28504 28505 if (c === Z_LOWER_CHAR) { 28506 buffer = this.ensureBuffer(bufferLength + 4); 28507 28508 for (i = 0; i < 4; ++i) { 28509 buffer[bufferLength + i] = 0; 28510 } 28511 28512 this.bufferLength += 4; 28513 } else { 28514 const input = this.input; 28515 input[0] = c; 28516 28517 for (i = 1; i < 5; ++i) { 28518 c = str.getByte(); 28519 28520 while ((0, _core_utils.isWhiteSpace)(c)) { 28521 c = str.getByte(); 28522 } 28523 28524 input[i] = c; 28525 28526 if (c === EOF || c === TILDA_CHAR) { 28527 break; 28528 } 28529 } 28530 28531 buffer = this.ensureBuffer(bufferLength + i - 1); 28532 this.bufferLength += i - 1; 28533 28534 if (i < 5) { 28535 for (; i < 5; ++i) { 28536 input[i] = 0x21 + 84; 28537 } 28538 28539 this.eof = true; 28540 } 28541 28542 let t = 0; 28543 28544 for (i = 0; i < 5; ++i) { 28545 t = t * 85 + (input[i] - 0x21); 28546 } 28547 28548 for (i = 3; i >= 0; --i) { 28549 buffer[bufferLength + i] = t & 0xff; 28550 t >>= 8; 28551 } 28552 } 28553 } 28554 28555} 28556 28557exports.Ascii85Stream = Ascii85Stream; 28558 28559/***/ }), 28560/* 29 */ 28561/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 28562 28563 28564 28565Object.defineProperty(exports, "__esModule", ({ 28566 value: true 28567})); 28568exports.StreamsSequenceStream = exports.DecodeStream = void 0; 28569 28570var _base_stream = __w_pdfjs_require__(6); 28571 28572var _stream = __w_pdfjs_require__(10); 28573 28574const emptyBuffer = new Uint8Array(0); 28575 28576class DecodeStream extends _base_stream.BaseStream { 28577 constructor(maybeMinBufferLength) { 28578 super(); 28579 this._rawMinBufferLength = maybeMinBufferLength || 0; 28580 this.pos = 0; 28581 this.bufferLength = 0; 28582 this.eof = false; 28583 this.buffer = emptyBuffer; 28584 this.minBufferLength = 512; 28585 28586 if (maybeMinBufferLength) { 28587 while (this.minBufferLength < maybeMinBufferLength) { 28588 this.minBufferLength *= 2; 28589 } 28590 } 28591 } 28592 28593 get isEmpty() { 28594 while (!this.eof && this.bufferLength === 0) { 28595 this.readBlock(); 28596 } 28597 28598 return this.bufferLength === 0; 28599 } 28600 28601 ensureBuffer(requested) { 28602 const buffer = this.buffer; 28603 28604 if (requested <= buffer.byteLength) { 28605 return buffer; 28606 } 28607 28608 let size = this.minBufferLength; 28609 28610 while (size < requested) { 28611 size *= 2; 28612 } 28613 28614 const buffer2 = new Uint8Array(size); 28615 buffer2.set(buffer); 28616 return this.buffer = buffer2; 28617 } 28618 28619 getByte() { 28620 const pos = this.pos; 28621 28622 while (this.bufferLength <= pos) { 28623 if (this.eof) { 28624 return -1; 28625 } 28626 28627 this.readBlock(); 28628 } 28629 28630 return this.buffer[this.pos++]; 28631 } 28632 28633 getBytes(length, forceClamped = false) { 28634 const pos = this.pos; 28635 let end; 28636 28637 if (length) { 28638 this.ensureBuffer(pos + length); 28639 end = pos + length; 28640 28641 while (!this.eof && this.bufferLength < end) { 28642 this.readBlock(); 28643 } 28644 28645 const bufEnd = this.bufferLength; 28646 28647 if (end > bufEnd) { 28648 end = bufEnd; 28649 } 28650 } else { 28651 while (!this.eof) { 28652 this.readBlock(); 28653 } 28654 28655 end = this.bufferLength; 28656 } 28657 28658 this.pos = end; 28659 const subarray = this.buffer.subarray(pos, end); 28660 return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray; 28661 } 28662 28663 reset() { 28664 this.pos = 0; 28665 } 28666 28667 makeSubStream(start, length, dict = null) { 28668 if (length === undefined) { 28669 while (!this.eof) { 28670 this.readBlock(); 28671 } 28672 } else { 28673 const end = start + length; 28674 28675 while (this.bufferLength <= end && !this.eof) { 28676 this.readBlock(); 28677 } 28678 } 28679 28680 return new _stream.Stream(this.buffer, start, length, dict); 28681 } 28682 28683 getBaseStreams() { 28684 return this.str ? this.str.getBaseStreams() : null; 28685 } 28686 28687} 28688 28689exports.DecodeStream = DecodeStream; 28690 28691class StreamsSequenceStream extends DecodeStream { 28692 constructor(streams, onError = null) { 28693 let maybeLength = 0; 28694 28695 for (const stream of streams) { 28696 maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length; 28697 } 28698 28699 super(maybeLength); 28700 this.streams = streams; 28701 this._onError = onError; 28702 } 28703 28704 readBlock() { 28705 const streams = this.streams; 28706 28707 if (streams.length === 0) { 28708 this.eof = true; 28709 return; 28710 } 28711 28712 const stream = streams.shift();
28713 let chunk; 28714 28715 try { 28716 chunk = stream.getBytes(); 28717 } catch (reason) { 28718 if (this._onError) { 28719 this._onError(reason, stream.dict && stream.dict.objId); 28720 28721 return; 28722 } 28723 28724 throw reason; 28725 } 28726 28727 const bufferLength = this.bufferLength; 28728 const newLength = bufferLength + chunk.length; 28729 const buffer = this.ensureBuffer(newLength); 28730 buffer.set(chunk, bufferLength); 28731 this.bufferLength = newLength; 28732 } 28733 28734 getBaseStreams() { 28735 const baseStreamsBuf = []; 28736 28737 for (const stream of this.streams) { 28738 const baseStreams = stream.getBaseStreams(); 28739 28740 if (baseStreams) { 28741 baseStreamsBuf.push(...baseStreams); 28742 } 28743 } 28744 28745 return baseStreamsBuf.length > 0 ? baseStreamsBuf : null; 28746 } 28747 28748} 28749 28750exports.StreamsSequenceStream = StreamsSequenceStream; 28751 28752/***/ }), 28753/* 30 */ 28754/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 28755 28756 28757 28758Object.defineProperty(exports, "__esModule", ({ 28759 value: true 28760})); 28761exports.AsciiHexStream = void 0; 28762 28763var _decode_stream = __w_pdfjs_require__(29); 28764 28765class AsciiHexStream extends _decode_stream.DecodeStream { 28766 constructor(str, maybeLength) { 28767 if (maybeLength) { 28768 maybeLength *= 0.5; 28769 } 28770 28771 super(maybeLength); 28772 this.str = str; 28773 this.dict = str.dict; 28774 this.firstDigit = -1; 28775 } 28776 28777 readBlock() { 28778 const UPSTREAM_BLOCK_SIZE = 8000; 28779 const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE); 28780 28781 if (!bytes.length) { 28782 this.eof = true; 28783 return; 28784 } 28785 28786 const maxDecodeLength = bytes.length + 1 >> 1; 28787 const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength); 28788 let bufferLength = this.bufferLength; 28789 let firstDigit = this.firstDigit; 28790 28791 for (const ch of bytes) { 28792 let digit; 28793 28794 if (ch >= 0x30 && ch <= 0x39) { 28795 digit = ch & 0x0f; 28796 } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 28797 digit = (ch & 0x0f) + 9; 28798 } else if (ch === 0x3e) { 28799 this.eof = true; 28800 break; 28801 } else { 28802 continue; 28803 } 28804 28805 if (firstDigit < 0) { 28806 firstDigit = digit; 28807 } else { 28808 buffer[bufferLength++] = firstDigit << 4 | digit; 28809 firstDigit = -1; 28810 } 28811 } 28812 28813 if (firstDigit >= 0 && this.eof) { 28814 buffer[bufferLength++] = firstDigit << 4; 28815 firstDigit = -1; 28816 } 28817 28818 this.firstDigit = firstDigit; 28819 this.bufferLength = bufferLength; 28820 } 28821 28822} 28823 28824exports.AsciiHexStream = AsciiHexStream; 28825 28826/***/ }), 28827/* 31 */ 28828/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 28829 28830 28831 28832Object.defineProperty(exports, "__esModule", ({ 28833 value: true 28834})); 28835exports.CCITTFaxStream = void 0; 28836 28837var _primitives = __w_pdfjs_require__(5); 28838 28839var _ccitt = __w_pdfjs_require__(32); 28840 28841var _decode_stream = __w_pdfjs_require__(29); 28842 28843class CCITTFaxStream extends _decode_stream.DecodeStream { 28844 constructor(str, maybeLength, params) { 28845 super(maybeLength); 28846 this.str = str; 28847 this.dict = str.dict; 28848 28849 if (!(0, _primitives.isDict)(params)) { 28850 params = _primitives.Dict.empty; 28851 } 28852 28853 const source = { 28854 next() { 28855 return str.getByte(); 28856 } 28857 28858 }; 28859 this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, { 28860 K: params.get("K"), 28861 EndOfLine: params.get("EndOfLine"), 28862 EncodedByteAlign: params.get("EncodedByteAlign"), 28863 Columns: params.get("Columns"), 28864 Rows: params.get("Rows"), 28865 EndOfBlock: params.get("EndOfBlock"), 28866 BlackIs1: params.get("BlackIs1") 28867 }); 28868 } 28869 28870 readBlock() { 28871 while (!this.eof) { 28872 const c = this.ccittFaxDecoder.readNextChar(); 28873 28874 if (c === -1) { 28875 this.eof = true; 28876 return; 28877 } 28878 28879 this.ensureBuffer(this.bufferLength + 1); 28880 this.buffer[this.bufferLength++] = c; 28881 } 28882 } 28883 28884} 28885 28886exports.CCITTFaxStream = CCITTFaxStream; 28887 28888/***/ }), 28889/* 32 */ 28890/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 28891 28892 28893 28894Object.defineProperty(exports, "__esModule", ({ 28895 value: true 28896})); 28897exports.CCITTFaxDecoder = void 0; 28898 28899var _util = __w_pdfjs_require__(2); 28900 28901const ccittEOL = -2; 28902const ccittEOF = -1; 28903const twoDimPass = 0; 28904const twoDimHoriz = 1; 28905const twoDimVert0 = 2; 28906const twoDimVertR1 = 3; 28907const twoDimVertL1 = 4; 28908const twoDimVertR2 = 5; 28909const twoDimVertL2 = 6; 28910const twoDimVertR3 = 7; 28911const twoDimVertL3 = 8;
28912const 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]]; 28913const 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]]; 28914const 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]];
28915const 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]]; 28916const 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]]; 28917const 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]]; 28918 28919class CCITTFaxDecoder { 28920 constructor(source, options = {}) { 28921 if (!source || typeof source.next !== "function") { 28922 throw new Error('CCITTFaxDecoder - invalid "source" parameter.'); 28923 } 28924 28925 this.source = source; 28926 this.eof = false; 28927 this.encoding = options.K || 0; 28928 this.eoline = options.EndOfLine || false; 28929 this.byteAlign = options.EncodedByteAlign || false; 28930 this.columns = options.Columns || 1728; 28931 this.rows = options.Rows || 0; 28932 let eoblock = options.EndOfBlock; 28933 28934 if (eoblock === null || eoblock === undefined) { 28935 eoblock = true; 28936 } 28937 28938 this.eoblock = eoblock; 28939 this.black = options.BlackIs1 || false; 28940 this.codingLine = new Uint32Array(this.columns + 1); 28941 this.refLine = new Uint32Array(this.columns + 2); 28942 this.codingLine[0] = this.columns; 28943 this.codingPos = 0; 28944 this.row = 0; 28945 this.nextLine2D = this.encoding < 0; 28946 this.inputBits = 0; 28947 this.inputBuf = 0; 28948 this.outputBits = 0; 28949 this.rowsDone = false;
vendor: 12,719 bytes, lines 28950-29514
28950 let code1; 28951 28952 while ((code1 = this._lookBits(12)) === 0) { 28953 this._eatBits(1); 28954 } 28955 28956 if (code1 === 1) { 28957 this._eatBits(12); 28958 } 28959 28960 if (this.encoding > 0) { 28961 this.nextLine2D = !this._lookBits(1); 28962 28963 this._eatBits(1); 28964 } 28965 } 28966 28967 readNextChar() { 28968 if (this.eof) { 28969 return -1; 28970 } 28971 28972 const refLine = this.refLine; 28973 const codingLine = this.codingLine; 28974 const columns = this.columns; 28975 let refPos, blackPixels, bits, i; 28976 28977 if (this.outputBits === 0) { 28978 if (this.rowsDone) { 28979 this.eof = true; 28980 } 28981 28982 if (this.eof) { 28983 return -1; 28984 } 28985 28986 this.err = false; 28987 let code1, code2, code3; 28988 28989 if (this.nextLine2D) { 28990 for (i = 0; codingLine[i] < columns; ++i) { 28991 refLine[i] = codingLine[i]; 28992 } 28993 28994 refLine[i++] = columns; 28995 refLine[i] = columns; 28996 codingLine[0] = 0; 28997 this.codingPos = 0; 28998 refPos = 0; 28999 blackPixels = 0; 29000 29001 while (codingLine[this.codingPos] < columns) { 29002 code1 = this._getTwoDimCode(); 29003 29004 switch (code1) { 29005 case twoDimPass: 29006 this._addPixels(refLine[refPos + 1], blackPixels); 29007 29008 if (refLine[refPos + 1] < columns) { 29009 refPos += 2; 29010 } 29011 29012 break; 29013 29014 case twoDimHoriz: 29015 code1 = code2 = 0; 29016 29017 if (blackPixels) { 29018 do { 29019 code1 += code3 = this._getBlackCode(); 29020 } while (code3 >= 64); 29021 29022 do { 29023 code2 += code3 = this._getWhiteCode(); 29024 } while (code3 >= 64); 29025 } else { 29026 do { 29027 code1 += code3 = this._getWhiteCode(); 29028 } while (code3 >= 64); 29029 29030 do { 29031 code2 += code3 = this._getBlackCode(); 29032 } while (code3 >= 64); 29033 } 29034 29035 this._addPixels(codingLine[this.codingPos] + code1, blackPixels); 29036 29037 if (codingLine[this.codingPos] < columns) { 29038 this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1); 29039 } 29040 29041 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29042 refPos += 2; 29043 } 29044 29045 break; 29046 29047 case twoDimVertR3: 29048 this._addPixels(refLine[refPos] + 3, blackPixels); 29049 29050 blackPixels ^= 1; 29051 29052 if (codingLine[this.codingPos] < columns) { 29053 ++refPos; 29054 29055 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29056 refPos += 2; 29057 } 29058 } 29059 29060 break; 29061 29062 case twoDimVertR2: 29063 this._addPixels(refLine[refPos] + 2, blackPixels); 29064 29065 blackPixels ^= 1; 29066 29067 if (codingLine[this.codingPos] < columns) { 29068 ++refPos; 29069 29070 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29071 refPos += 2; 29072 } 29073 } 29074 29075 break; 29076 29077 case twoDimVertR1: 29078 this._addPixels(refLine[refPos] + 1, blackPixels); 29079 29080 blackPixels ^= 1; 29081 29082 if (codingLine[this.codingPos] < columns) { 29083 ++refPos; 29084 29085 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29086 refPos += 2; 29087 } 29088 } 29089 29090 break; 29091 29092 case twoDimVert0: 29093 this._addPixels(refLine[refPos], blackPixels); 29094 29095 blackPixels ^= 1; 29096 29097 if (codingLine[this.codingPos] < columns) { 29098 ++refPos; 29099 29100 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29101 refPos += 2; 29102 } 29103 } 29104 29105 break; 29106 29107 case twoDimVertL3: 29108 this._addPixelsNeg(refLine[refPos] - 3, blackPixels); 29109 29110 blackPixels ^= 1; 29111 29112 if (codingLine[this.codingPos] < columns) { 29113 if (refPos > 0) { 29114 --refPos; 29115 } else { 29116 ++refPos; 29117 } 29118 29119 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29120 refPos += 2; 29121 } 29122 } 29123 29124 break; 29125 29126 case twoDimVertL2: 29127 this._addPixelsNeg(refLine[refPos] - 2, blackPixels); 29128 29129 blackPixels ^= 1; 29130 29131 if (codingLine[this.codingPos] < columns) { 29132 if (refPos > 0) { 29133 --refPos; 29134 } else { 29135 ++refPos; 29136 } 29137 29138 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29139 refPos += 2; 29140 } 29141 } 29142 29143 break; 29144 29145 case twoDimVertL1: 29146 this._addPixelsNeg(refLine[refPos] - 1, blackPixels); 29147 29148 blackPixels ^= 1; 29149 29150 if (codingLine[this.codingPos] < columns) { 29151 if (refPos > 0) { 29152 --refPos; 29153 } else { 29154 ++refPos; 29155 } 29156 29157 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29158 refPos += 2; 29159 } 29160 } 29161 29162 break; 29163 29164 case ccittEOF: 29165 this._addPixels(columns, 0); 29166 29167 this.eof = true; 29168 break; 29169 29170 default: 29171 (0, _util.info)("bad 2d code"); 29172 29173 this._addPixels(columns, 0); 29174 29175 this.err = true; 29176 } 29177 } 29178 } else { 29179 codingLine[0] = 0; 29180 this.codingPos = 0; 29181 blackPixels = 0; 29182 29183 while (codingLine[this.codingPos] < columns) { 29184 code1 = 0; 29185 29186 if (blackPixels) { 29187 do { 29188 code1 += code3 = this._getBlackCode(); 29189 } while (code3 >= 64); 29190 } else { 29191 do { 29192 code1 += code3 = this._getWhiteCode(); 29193 } while (code3 >= 64); 29194 } 29195 29196 this._addPixels(codingLine[this.codingPos] + code1, blackPixels); 29197 29198 blackPixels ^= 1; 29199 } 29200 } 29201 29202 let gotEOL = false; 29203 29204 if (this.byteAlign) { 29205 this.inputBits &= ~7; 29206 } 29207 29208 if (!this.eoblock && this.row === this.rows - 1) { 29209 this.rowsDone = true; 29210 } else { 29211 code1 = this._lookBits(12); 29212 29213 if (this.eoline) { 29214 while (code1 !== ccittEOF && code1 !== 1) { 29215 this._eatBits(1); 29216 29217 code1 = this._lookBits(12); 29218 } 29219 } else { 29220 while (code1 === 0) { 29221 this._eatBits(1); 29222 29223 code1 = this._lookBits(12); 29224 } 29225 } 29226 29227 if (code1 === 1) { 29228 this._eatBits(12); 29229 29230 gotEOL = true; 29231 } else if (code1 === ccittEOF) { 29232 this.eof = true; 29233 } 29234 } 29235 29236 if (!this.eof && this.encoding > 0 && !this.rowsDone) { 29237 this.nextLine2D = !this._lookBits(1); 29238 29239 this._eatBits(1); 29240 } 29241 29242 if (this.eoblock && gotEOL && this.byteAlign) { 29243 code1 = this._lookBits(12); 29244 29245 if (code1 === 1) { 29246 this._eatBits(12); 29247 29248 if (this.encoding > 0) { 29249 this._lookBits(1); 29250 29251 this._eatBits(1); 29252 } 29253 29254 if (this.encoding >= 0) { 29255 for (i = 0; i < 4; ++i) { 29256 code1 = this._lookBits(12); 29257 29258 if (code1 !== 1) { 29259 (0, _util.info)("bad rtc code: " + code1); 29260 } 29261 29262 this._eatBits(12); 29263 29264 if (this.encoding > 0) { 29265 this._lookBits(1); 29266 29267 this._eatBits(1); 29268 } 29269 } 29270 } 29271 29272 this.eof = true; 29273 } 29274 } else if (this.err && this.eoline) { 29275 while (true) { 29276 code1 = this._lookBits(13); 29277 29278 if (code1 === ccittEOF) { 29279 this.eof = true; 29280 return -1; 29281 } 29282 29283 if (code1 >> 1 === 1) { 29284 break; 29285 } 29286 29287 this._eatBits(1); 29288 } 29289 29290 this._eatBits(12); 29291 29292 if (this.encoding > 0) { 29293 this._eatBits(1); 29294 29295 this.nextLine2D = !(code1 & 1); 29296 } 29297 } 29298 29299 if (codingLine[0] > 0) { 29300 this.outputBits = codingLine[this.codingPos = 0]; 29301 } else { 29302 this.outputBits = codingLine[this.codingPos = 1]; 29303 } 29304 29305 this.row++; 29306 } 29307 29308 let c; 29309 29310 if (this.outputBits >= 8) { 29311 c = this.codingPos & 1 ? 0 : 0xff; 29312 this.outputBits -= 8; 29313 29314 if (this.outputBits === 0 && codingLine[this.codingPos] < columns) { 29315 this.codingPos++; 29316 this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1]; 29317 } 29318 } else { 29319 bits = 8; 29320 c = 0; 29321 29322 do { 29323 if (typeof this.outputBits !== "number") { 29324 throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.'); 29325 } 29326 29327 if (this.outputBits > bits) { 29328 c <<= bits; 29329 29330 if (!(this.codingPos & 1)) { 29331 c |= 0xff >> 8 - bits; 29332 } 29333 29334 this.outputBits -= bits; 29335 bits = 0; 29336 } else { 29337 c <<= this.outputBits; 29338 29339 if (!(this.codingPos & 1)) { 29340 c |= 0xff >> 8 - this.outputBits; 29341 } 29342 29343 bits -= this.outputBits; 29344 this.outputBits = 0; 29345 29346 if (codingLine[this.codingPos] < columns) { 29347 this.codingPos++; 29348 this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1]; 29349 } else if (bits > 0) { 29350 c <<= bits; 29351 bits = 0; 29352 } 29353 } 29354 } while (bits); 29355 } 29356 29357 if (this.black) { 29358 c ^= 0xff; 29359 } 29360 29361 return c; 29362 } 29363 29364 _addPixels(a1, blackPixels) { 29365 const codingLine = this.codingLine; 29366 let codingPos = this.codingPos; 29367 29368 if (a1 > codingLine[codingPos]) { 29369 if (a1 > this.columns) { 29370 (0, _util.info)("row is wrong length"); 29371 this.err = true; 29372 a1 = this.columns; 29373 } 29374 29375 if (codingPos & 1 ^ blackPixels) { 29376 ++codingPos; 29377 } 29378 29379 codingLine[codingPos] = a1; 29380 } 29381 29382 this.codingPos = codingPos; 29383 } 29384 29385 _addPixelsNeg(a1, blackPixels) { 29386 const codingLine = this.codingLine; 29387 let codingPos = this.codingPos; 29388 29389 if (a1 > codingLine[codingPos]) { 29390 if (a1 > this.columns) { 29391 (0, _util.info)("row is wrong length"); 29392 this.err = true; 29393 a1 = this.columns; 29394 } 29395 29396 if (codingPos & 1 ^ blackPixels) { 29397 ++codingPos; 29398 } 29399 29400 codingLine[codingPos] = a1; 29401 } else if (a1 < codingLine[codingPos]) { 29402 if (a1 < 0) { 29403 (0, _util.info)("invalid code"); 29404 this.err = true; 29405 a1 = 0; 29406 } 29407 29408 while (codingPos > 0 && a1 < codingLine[codingPos - 1]) { 29409 --codingPos; 29410 } 29411 29412 codingLine[codingPos] = a1; 29413 } 29414 29415 this.codingPos = codingPos; 29416 } 29417 29418 _findTableCode(start, end, table, limit) { 29419 const limitValue = limit || 0; 29420 29421 for (let i = start; i <= end; ++i) { 29422 let code = this._lookBits(i); 29423 29424 if (code === ccittEOF) { 29425 return [true, 1, false]; 29426 } 29427 29428 if (i < end) { 29429 code <<= end - i; 29430 } 29431 29432 if (!limitValue || code >= limitValue) { 29433 const p = table[code - limitValue]; 29434 29435 if (p[0] === i) { 29436 this._eatBits(i); 29437 29438 return [true, p[1], true]; 29439 } 29440 } 29441 } 29442 29443 return [false, 0, false]; 29444 } 29445 29446 _getTwoDimCode() { 29447 let code = 0; 29448 let p; 29449 29450 if (this.eoblock) { 29451 code = this._lookBits(7); 29452 p = twoDimTable[code]; 29453 29454 if (p && p[0] > 0) { 29455 this._eatBits(p[0]); 29456 29457 return p[1]; 29458 } 29459 } else { 29460 const result = this._findTableCode(1, 7, twoDimTable); 29461 29462 if (result[0] && result[2]) { 29463 return result[1]; 29464 } 29465 } 29466 29467 (0, _util.info)("Bad two dim code"); 29468 return ccittEOF; 29469 } 29470 29471 _getWhiteCode() { 29472 let code = 0; 29473 let p; 29474 29475 if (this.eoblock) { 29476 code = this._lookBits(12); 29477 29478 if (code === ccittEOF) { 29479 return 1; 29480 } 29481 29482 if (code >> 5 === 0) { 29483 p = whiteTable1[code]; 29484 } else { 29485 p = whiteTable2[code >> 3]; 29486 } 29487 29488 if (p[0] > 0) { 29489 this._eatBits(p[0]); 29490 29491 return p[1]; 29492 } 29493 } else { 29494 let result = this._findTableCode(1, 9, whiteTable2); 29495 29496 if (result[0]) { 29497 return result[1]; 29498 } 29499 29500 result = this._findTableCode(11, 12, whiteTable1); 29501 29502 if (result[0]) { 29503 return result[1]; 29504 } 29505 } 29506 29507 (0, _util.info)("bad white code"); 29508 29509 this._eatBits(1); 29510 29511 return 1; 29512 } 29513 29514 _getBlackCode() {
29515 let code, p; 29516 29517 if (this.eoblock) { 29518 code = this._lookBits(13); 29519 29520 if (code === ccittEOF) { 29521 return 1; 29522 } 29523 29524 if (code >> 7 === 0) { 29525 p = blackTable1[code]; 29526 } else if (code >> 9 === 0 && code >> 7 !== 0) { 29527 p = blackTable2[(code >> 1) - 64]; 29528 } else { 29529 p = blackTable3[code >> 7]; 29530 } 29531 29532 if (p[0] > 0) { 29533 this._eatBits(p[0]); 29534 29535 return p[1]; 29536 } 29537 } else { 29538 let result = this._findTableCode(2, 6, blackTable3); 29539 29540 if (result[0]) { 29541 return result[1]; 29542 } 29543 29544 result = this._findTableCode(7, 12, blackTable2, 64); 29545 29546 if (result[0]) { 29547 return result[1]; 29548 } 29549 29550 result = this._findTableCode(10, 13, blackTable1); 29551 29552 if (result[0]) { 29553 return result[1]; 29554 } 29555 } 29556 29557 (0, _util.info)("bad black code"); 29558 29559 this._eatBits(1); 29560 29561 return 1; 29562 } 29563 29564 _lookBits(n) { 29565 let c; 29566 29567 while (this.inputBits < n) { 29568 if ((c = this.source.next()) === -1) { 29569 if (this.inputBits === 0) { 29570 return ccittEOF; 29571 } 29572 29573 return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n; 29574 } 29575 29576 this.inputBuf = this.inputBuf << 8 | c; 29577 this.inputBits += 8; 29578 } 29579 29580 return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n; 29581 } 29582 29583 _eatBits(n) { 29584 if ((this.inputBits -= n) < 0) { 29585 this.inputBits = 0; 29586 } 29587 } 29588 29589} 29590 29591exports.CCITTFaxDecoder = CCITTFaxDecoder; 29592 29593/***/ }), 29594/* 33 */ 29595/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 29596 29597 29598 29599Object.defineProperty(exports, "__esModule", ({ 29600 value: true 29601})); 29602exports.FlateStream = void 0; 29603 29604var _decode_stream = __w_pdfjs_require__(29); 29605 29606var _util = __w_pdfjs_require__(2); 29607 29608const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); 29609const 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]); 29610const 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]); 29611const 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,
296110x900f6, 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]; 29612const 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]; 29613 29614class FlateStream extends _decode_stream.DecodeStream { 29615 constructor(str, maybeLength) { 29616 super(maybeLength); 29617 this.str = str; 29618 this.dict = str.dict; 29619 const cmf = str.getByte(); 29620 const flg = str.getByte(); 29621 29622 if (cmf === -1 || flg === -1) { 29623 throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`); 29624 } 29625 29626 if ((cmf & 0x0f) !== 0x08) { 29627 throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`); 29628 } 29629 29630 if (((cmf << 8) + flg) % 31 !== 0) { 29631 throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`); 29632 } 29633 29634 if (flg & 0x20) { 29635 throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`); 29636 } 29637 29638 this.codeSize = 0; 29639 this.codeBuf = 0; 29640 } 29641 29642 getBits(bits) { 29643 const str = this.str; 29644 let codeSize = this.codeSize; 29645 let codeBuf = this.codeBuf; 29646 let b; 29647 29648 while (codeSize < bits) { 29649 if ((b = str.getByte()) === -1) { 29650 throw new _util.FormatError("Bad encoding in flate stream"); 29651 } 29652 29653 codeBuf |= b << codeSize; 29654 codeSize += 8; 29655 } 29656 29657 b = codeBuf & (1 << bits) - 1; 29658 this.codeBuf = codeBuf >> bits; 29659 this.codeSize = codeSize -= bits; 29660 return b; 29661 } 29662 29663 getCode(table) { 29664 const str = this.str; 29665 const codes = table[0]; 29666 const maxLen = table[1];
vendor: 5,180 bytes, lines 29667-29882
29667 let codeSize = this.codeSize; 29668 let codeBuf = this.codeBuf; 29669 let b; 29670 29671 while (codeSize < maxLen) { 29672 if ((b = str.getByte()) === -1) { 29673 break; 29674 } 29675 29676 codeBuf |= b << codeSize; 29677 codeSize += 8; 29678 } 29679 29680 const code = codes[codeBuf & (1 << maxLen) - 1]; 29681 const codeLen = code >> 16; 29682 const codeVal = code & 0xffff; 29683 29684 if (codeLen < 1 || codeSize < codeLen) { 29685 throw new _util.FormatError("Bad encoding in flate stream"); 29686 } 29687 29688 this.codeBuf = codeBuf >> codeLen; 29689 this.codeSize = codeSize - codeLen; 29690 return codeVal; 29691 } 29692 29693 generateHuffmanTable(lengths) { 29694 const n = lengths.length; 29695 let maxLen = 0; 29696 let i; 29697 29698 for (i = 0; i < n; ++i) { 29699 if (lengths[i] > maxLen) { 29700 maxLen = lengths[i]; 29701 } 29702 } 29703 29704 const size = 1 << maxLen; 29705 const codes = new Int32Array(size); 29706 29707 for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) { 29708 for (let val = 0; val < n; ++val) { 29709 if (lengths[val] === len) { 29710 let code2 = 0; 29711 let t = code; 29712 29713 for (i = 0; i < len; ++i) { 29714 code2 = code2 << 1 | t & 1; 29715 t >>= 1; 29716 } 29717 29718 for (i = code2; i < size; i += skip) { 29719 codes[i] = len << 16 | val; 29720 } 29721 29722 ++code; 29723 } 29724 } 29725 } 29726 29727 return [codes, maxLen]; 29728 } 29729 29730 readBlock() { 29731 let buffer, len; 29732 const str = this.str; 29733 let hdr = this.getBits(3); 29734 29735 if (hdr & 1) { 29736 this.eof = true; 29737 } 29738 29739 hdr >>= 1; 29740 29741 if (hdr === 0) { 29742 let b; 29743 29744 if ((b = str.getByte()) === -1) { 29745 throw new _util.FormatError("Bad block header in flate stream"); 29746 } 29747 29748 let blockLen = b; 29749 29750 if ((b = str.getByte()) === -1) { 29751 throw new _util.FormatError("Bad block header in flate stream"); 29752 } 29753 29754 blockLen |= b << 8; 29755 29756 if ((b = str.getByte()) === -1) { 29757 throw new _util.FormatError("Bad block header in flate stream"); 29758 } 29759 29760 let check = b; 29761 29762 if ((b = str.getByte()) === -1) { 29763 throw new _util.FormatError("Bad block header in flate stream"); 29764 } 29765 29766 check |= b << 8; 29767 29768 if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) { 29769 throw new _util.FormatError("Bad uncompressed block length in flate stream"); 29770 } 29771 29772 this.codeBuf = 0; 29773 this.codeSize = 0; 29774 const bufferLength = this.bufferLength, 29775 end = bufferLength + blockLen; 29776 buffer = this.ensureBuffer(end); 29777 this.bufferLength = end; 29778 29779 if (blockLen === 0) { 29780 if (str.peekByte() === -1) { 29781 this.eof = true; 29782 } 29783 } else { 29784 const block = str.getBytes(blockLen); 29785 buffer.set(block, bufferLength); 29786 29787 if (block.length < blockLen) { 29788 this.eof = true; 29789 } 29790 } 29791 29792 return; 29793 } 29794 29795 let litCodeTable; 29796 let distCodeTable; 29797 29798 if (hdr === 1) { 29799 litCodeTable = fixedLitCodeTab; 29800 distCodeTable = fixedDistCodeTab; 29801 } else if (hdr === 2) { 29802 const numLitCodes = this.getBits(5) + 257; 29803 const numDistCodes = this.getBits(5) + 1; 29804 const numCodeLenCodes = this.getBits(4) + 4; 29805 const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length); 29806 let i; 29807 29808 for (i = 0; i < numCodeLenCodes; ++i) { 29809 codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3); 29810 } 29811 29812 const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths); 29813 len = 0; 29814 i = 0; 29815 const codes = numLitCodes + numDistCodes; 29816 const codeLengths = new Uint8Array(codes); 29817 let bitsLength, bitsOffset, what; 29818 29819 while (i < codes) { 29820 const code = this.getCode(codeLenCodeTab); 29821 29822 if (code === 16) { 29823 bitsLength = 2; 29824 bitsOffset = 3; 29825 what = len; 29826 } else if (code === 17) { 29827 bitsLength = 3; 29828 bitsOffset = 3; 29829 what = len = 0; 29830 } else if (code === 18) { 29831 bitsLength = 7; 29832 bitsOffset = 11; 29833 what = len = 0; 29834 } else { 29835 codeLengths[i++] = len = code; 29836 continue; 29837 } 29838 29839 let repeatLength = this.getBits(bitsLength) + bitsOffset; 29840 29841 while (repeatLength-- > 0) { 29842 codeLengths[i++] = what; 29843 } 29844 } 29845 29846 litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes)); 29847 distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes)); 29848 } else { 29849 throw new _util.FormatError("Unknown block type in flate stream"); 29850 } 29851 29852 buffer = this.buffer; 29853 let limit = buffer ? buffer.length : 0; 29854 let pos = this.bufferLength; 29855 29856 while (true) { 29857 let code1 = this.getCode(litCodeTable); 29858 29859 if (code1 < 256) { 29860 if (pos + 1 >= limit) { 29861 buffer = this.ensureBuffer(pos + 1); 29862 limit = buffer.length; 29863 } 29864 29865 buffer[pos++] = code1; 29866 continue; 29867 } 29868 29869 if (code1 === 256) { 29870 this.bufferLength = pos; 29871 return; 29872 } 29873 29874 code1 -= 257; 29875 code1 = lengthDecode[code1]; 29876 let code2 = code1 >> 16; 29877 29878 if (code2 > 0) { 29879 code2 = this.getBits(code2); 29880 } 29881 29882 len = (code1 & 0xffff) + code2;
29883 code1 = this.getCode(distCodeTable); 29884 code1 = distDecode[code1]; 29885 code2 = code1 >> 16; 29886 29887 if (code2 > 0) { 29888 code2 = this.getBits(code2); 29889 } 29890 29891 const dist = (code1 & 0xffff) + code2; 29892 29893 if (pos + len >= limit) { 29894 buffer = this.ensureBuffer(pos + len); 29895 limit = buffer.length; 29896 } 29897 29898 for (let k = 0; k < len; ++k, ++pos) { 29899 buffer[pos] = buffer[pos - dist]; 29900 } 29901 } 29902 } 29903 29904} 29905 29906exports.FlateStream = FlateStream; 29907 29908/***/ }), 29909/* 34 */ 29910/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 29911 29912 29913 29914Object.defineProperty(exports, "__esModule", ({ 29915 value: true 29916})); 29917exports.Jbig2Stream = void 0; 29918 29919var _primitives = __w_pdfjs_require__(5); 29920 29921var _decode_stream = __w_pdfjs_require__(29); 29922 29923var _jbig = __w_pdfjs_require__(35); 29924 29925var _util = __w_pdfjs_require__(2); 29926 29927class Jbig2Stream extends _decode_stream.DecodeStream { 29928 constructor(stream, maybeLength, params) { 29929 super(maybeLength); 29930 this.stream = stream; 29931 this.dict = stream.dict; 29932 this.maybeLength = maybeLength; 29933 this.params = params; 29934 } 29935 29936 get bytes() { 29937 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 29938 } 29939 29940 ensureBuffer(requested) {} 29941 29942 readBlock() { 29943 if (this.eof) { 29944 return; 29945 } 29946 29947 const jbig2Image = new _jbig.Jbig2Image(); 29948 const chunks = []; 29949 29950 if ((0, _primitives.isDict)(this.params)) { 29951 const globalsStream = this.params.get("JBIG2Globals"); 29952 29953 if ((0, _primitives.isStream)(globalsStream)) { 29954 const globals = globalsStream.getBytes(); 29955 chunks.push({ 29956 data: globals, 29957 start: 0, 29958 end: globals.length 29959 }); 29960 } 29961 } 29962 29963 chunks.push({ 29964 data: this.bytes, 29965 start: 0, 29966 end: this.bytes.length 29967 }); 29968 const data = jbig2Image.parseChunks(chunks); 29969 const dataLength = data.length; 29970 29971 for (let i = 0; i < dataLength; i++) { 29972 data[i] ^= 0xff; 29973 } 29974 29975 this.buffer = data; 29976 this.bufferLength = dataLength; 29977 this.eof = true; 29978 } 29979 29980} 29981 29982exports.Jbig2Stream = Jbig2Stream; 29983 29984/***/ }), 29985/* 35 */ 29986/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 29987 29988 29989 29990Object.defineProperty(exports, "__esModule", ({ 29991 value: true 29992})); 29993exports.Jbig2Image = void 0; 29994 29995var _util = __w_pdfjs_require__(2); 29996 29997var _core_utils = __w_pdfjs_require__(9); 29998 29999var _arithmetic_decoder = __w_pdfjs_require__(36); 30000 30001var _ccitt = __w_pdfjs_require__(32); 30002 30003class Jbig2Error extends _util.BaseException { 30004 constructor(msg) { 30005 super(`JBIG2 error: ${msg}`, "Jbig2Error"); 30006 } 30007 30008} 30009 30010class ContextCache { 30011 getContexts(id) { 30012 if (id in this) { 30013 return this[id]; 30014 } 30015 30016 return this[id] = new Int8Array(1 << 16); 30017 } 30018 30019} 30020 30021class DecodingContext { 30022 constructor(data, start, end) { 30023 this.data = data; 30024 this.start = start; 30025 this.end = end; 30026 } 30027 30028 get decoder() { 30029 const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end); 30030 return (0, _util.shadow)(this, "decoder", decoder); 30031 } 30032 30033 get contextCache() { 30034 const cache = new ContextCache(); 30035 return (0, _util.shadow)(this, "contextCache", cache); 30036 } 30037 30038} 30039 30040function decodeInteger(contextCache, procedure, decoder) { 30041 const contexts = contextCache.getContexts(procedure); 30042 let prev = 1; 30043 30044 function readBits(length) { 30045 let v = 0; 30046 30047 for (let i = 0; i < length; i++) { 30048 const bit = decoder.readBit(contexts, prev); 30049 prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256; 30050 v = v << 1 | bit; 30051 } 30052 30053 return v >>> 0; 30054 } 30055 30056 const sign = readBits(1); 30057 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); 30058 30059 if (sign === 0) { 30060 return value; 30061 } else if (value > 0) { 30062 return -value; 30063 } 30064 30065 return null; 30066} 30067 30068function decodeIAID(contextCache, decoder, codeLength) { 30069 const contexts = contextCache.getContexts("IAID"); 30070 let prev = 1; 30071 30072 for (let i = 0; i < codeLength; i++) { 30073 const bit = decoder.readBit(contexts, prev); 30074 prev = prev << 1 | bit; 30075 } 30076 30077 if (codeLength < 31) { 30078 return prev & (1 << codeLength) - 1; 30079 } 30080 30081 return prev & 0x7fffffff; 30082} 30083 30084const 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"]; 30085const CodingTemplates = [[{ 30086 x: -1, 30087 y: -2 30088}, { 30089 x: 0, 30090 y: -2 30091}, { 30092 x: 1, 30093 y: -2 30094}, { 30095 x: -2, 30096 y: -1 30097}, { 30098 x: -1, 30099 y: -1 30100}, { 30101 x: 0, 30102 y: -1 30103}, { 30104 x: 1, 30105 y: -1 30106}, { 30107 x: 2, 30108 y: -1 30109}, { 30110 x: -4, 30111 y: 0 30112}, { 30113 x: -3, 30114 y: 0 30115}, { 30116 x: -2, 30117 y: 0 30118}, { 30119 x: -1, 30120 y: 0 30121}], [{ 30122 x: -1, 30123 y: -2 30124}, { 30125 x: 0, 30126 y: -2 30127}, { 30128 x: 1, 30129 y: -2 30130}, { 30131 x: 2, 30132 y: -2 30133}, { 30134 x: -2, 30135 y: -1 30136}, { 30137 x: -1, 30138 y: -1 30139}, { 30140 x: 0, 30141 y: -1 30142}, { 30143 x: 1, 30144 y: -1 30145}, { 30146 x: 2, 30147 y: -1 30148}, { 30149 x: -3, 30150 y: 0 30151}, { 30152 x: -2, 30153 y: 0 30154}, { 30155 x: -1, 30156 y: 0 30157}], [{ 30158 x: -1, 30159 y: -2 30160}, { 30161 x: 0, 30162 y: -2 30163}, { 30164 x: 1, 30165 y: -2 30166}, { 30167 x: -2, 30168 y: -1 30169}, { 30170 x: -1, 30171 y: -1 30172}, { 30173 x: 0, 30174 y: -1 30175}, { 30176 x: 1, 30177 y: -1 30178}, { 30179 x: -2, 30180 y: 0 30181}, { 30182 x: -1, 30183 y: 0 30184}], [{ 30185 x: -3, 30186 y: -1 30187}, { 30188 x: -2, 30189 y: -1 30190}, { 30191 x: -1, 30192 y: -1 30193}, { 30194 x: 0, 30195 y: -1 30196}, { 30197 x: 1, 30198 y: -1 30199}, { 30200 x: -4, 30201 y: 0 30202}, { 30203 x: -3, 30204 y: 0 30205}, { 30206 x: -2, 30207 y: 0 30208}, { 30209 x: -1, 30210 y: 0 30211}]]; 30212const RefinementTemplates = [{ 30213 coding: [{ 30214 x: 0, 30215 y: -1 30216 }, { 30217 x: 1, 30218 y: -1 30219 }, { 30220 x: -1, 30221 y: 0 30222 }], 30223 reference: [{ 30224 x: 0, 30225 y: -1 30226 }, { 30227 x: 1, 30228 y: -1 30229 }, { 30230 x: -1, 30231 y: 0 30232 }, { 30233 x: 0, 30234 y: 0 30235 }, { 30236 x: 1, 30237 y: 0 30238 }, { 30239 x: -1, 30240 y: 1 30241 }, { 30242 x: 0, 30243 y: 1 30244 }, { 30245 x: 1, 30246 y: 1 30247 }] 30248}, { 30249 coding: [{ 30250 x: -1, 30251 y: -1 30252 }, { 30253 x: 0, 30254 y: -1 30255 }, { 30256 x: 1, 30257 y: -1 30258 }, { 30259 x: -1, 30260 y: 0 30261 }], 30262 reference: [{ 30263 x: 0, 30264 y: -1 30265 }, { 30266 x: -1, 30267 y: 0 30268 }, { 30269 x: 0, 30270 y: 0 30271 }, { 30272 x: 1, 30273 y: 0 30274 }, { 30275 x: 0, 30276 y: 1 30277 }, { 30278 x: 1, 30279 y: 1 30280 }] 30281}]; 30282const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195]; 30283const RefinementReusedContexts = [0x0020, 0x0008]; 30284 30285function decodeBitmapTemplate0(width, height, decodingContext) { 30286 const decoder = decodingContext.decoder; 30287 const contexts = decodingContext.contextCache.getContexts("GB"); 30288 const bitmap = []; 30289 let contextLabel, i, j, pixel, row, row1, row2; 30290 const OLD_PIXEL_MASK = 0x7bf7; 30291 30292 for (i = 0; i < height; i++) {
vendor: 29,505 bytes, lines 30293-31249
30293 row = bitmap[i] = new Uint8Array(width); 30294 row1 = i < 1 ? row : bitmap[i - 1]; 30295 row2 = i < 2 ? row : bitmap[i - 2]; 30296 contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4; 30297 30298 for (j = 0; j < width; j++) { 30299 row[j] = pixel = decoder.readBit(contexts, contextLabel); 30300 contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel; 30301 } 30302 } 30303 30304 return bitmap; 30305} 30306 30307function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) { 30308 if (mmr) { 30309 const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end); 30310 return decodeMMRBitmap(input, width, height, false); 30311 } 30312 30313 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) { 30314 return decodeBitmapTemplate0(width, height, decodingContext); 30315 } 30316 30317 const useskip = !!skip; 30318 const template = CodingTemplates[templateIndex].concat(at); 30319 template.sort(function (a, b) { 30320 return a.y - b.y || a.x - b.x; 30321 }); 30322 const templateLength = template.length; 30323 const templateX = new Int8Array(templateLength); 30324 const templateY = new Int8Array(templateLength); 30325 const changingTemplateEntries = []; 30326 let reuseMask = 0, 30327 minX = 0, 30328 maxX = 0, 30329 minY = 0; 30330 let c, k; 30331 30332 for (k = 0; k < templateLength; k++) { 30333 templateX[k] = template[k].x; 30334 templateY[k] = template[k].y; 30335 minX = Math.min(minX, template[k].x); 30336 maxX = Math.max(maxX, template[k].x); 30337 minY = Math.min(minY, template[k].y); 30338 30339 if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) { 30340 reuseMask |= 1 << templateLength - 1 - k; 30341 } else { 30342 changingTemplateEntries.push(k); 30343 } 30344 } 30345 30346 const changingEntriesLength = changingTemplateEntries.length; 30347 const changingTemplateX = new Int8Array(changingEntriesLength); 30348 const changingTemplateY = new Int8Array(changingEntriesLength); 30349 const changingTemplateBit = new Uint16Array(changingEntriesLength); 30350 30351 for (c = 0; c < changingEntriesLength; c++) { 30352 k = changingTemplateEntries[c]; 30353 changingTemplateX[c] = template[k].x; 30354 changingTemplateY[c] = template[k].y; 30355 changingTemplateBit[c] = 1 << templateLength - 1 - k; 30356 } 30357 30358 const sbb_left = -minX; 30359 const sbb_top = -minY; 30360 const sbb_right = width - maxX; 30361 const pseudoPixelContext = ReusedContexts[templateIndex]; 30362 let row = new Uint8Array(width); 30363 const bitmap = []; 30364 const decoder = decodingContext.decoder; 30365 const contexts = decodingContext.contextCache.getContexts("GB"); 30366 let ltp = 0, 30367 j, 30368 i0, 30369 j0, 30370 contextLabel = 0, 30371 bit, 30372 shift; 30373 30374 for (let i = 0; i < height; i++) { 30375 if (prediction) { 30376 const sltp = decoder.readBit(contexts, pseudoPixelContext); 30377 ltp ^= sltp; 30378 30379 if (ltp) { 30380 bitmap.push(row); 30381 continue; 30382 } 30383 } 30384 30385 row = new Uint8Array(row); 30386 bitmap.push(row); 30387 30388 for (j = 0; j < width; j++) { 30389 if (useskip && skip[i][j]) { 30390 row[j] = 0; 30391 continue; 30392 } 30393 30394 if (j >= sbb_left && j < sbb_right && i >= sbb_top) { 30395 contextLabel = contextLabel << 1 & reuseMask; 30396 30397 for (k = 0; k < changingEntriesLength; k++) { 30398 i0 = i + changingTemplateY[k]; 30399 j0 = j + changingTemplateX[k]; 30400 bit = bitmap[i0][j0]; 30401 30402 if (bit) { 30403 bit = changingTemplateBit[k]; 30404 contextLabel |= bit; 30405 } 30406 } 30407 } else { 30408 contextLabel = 0; 30409 shift = templateLength - 1; 30410 30411 for (k = 0; k < templateLength; k++, shift--) { 30412 j0 = j + templateX[k]; 30413 30414 if (j0 >= 0 && j0 < width) { 30415 i0 = i + templateY[k]; 30416 30417 if (i0 >= 0) { 30418 bit = bitmap[i0][j0]; 30419 30420 if (bit) { 30421 contextLabel |= bit << shift; 30422 } 30423 } 30424 } 30425 } 30426 } 30427 30428 const pixel = decoder.readBit(contexts, contextLabel); 30429 row[j] = pixel; 30430 } 30431 } 30432 30433 return bitmap; 30434} 30435 30436function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) { 30437 let codingTemplate = RefinementTemplates[templateIndex].coding; 30438 30439 if (templateIndex === 0) { 30440 codingTemplate = codingTemplate.concat([at[0]]); 30441 } 30442 30443 const codingTemplateLength = codingTemplate.length; 30444 const codingTemplateX = new Int32Array(codingTemplateLength); 30445 const codingTemplateY = new Int32Array(codingTemplateLength); 30446 let k; 30447 30448 for (k = 0; k < codingTemplateLength; k++) { 30449 codingTemplateX[k] = codingTemplate[k].x; 30450 codingTemplateY[k] = codingTemplate[k].y; 30451 } 30452 30453 let referenceTemplate = RefinementTemplates[templateIndex].reference; 30454 30455 if (templateIndex === 0) { 30456 referenceTemplate = referenceTemplate.concat([at[1]]); 30457 } 30458 30459 const referenceTemplateLength = referenceTemplate.length; 30460 const referenceTemplateX = new Int32Array(referenceTemplateLength); 30461 const referenceTemplateY = new Int32Array(referenceTemplateLength); 30462 30463 for (k = 0; k < referenceTemplateLength; k++) { 30464 referenceTemplateX[k] = referenceTemplate[k].x; 30465 referenceTemplateY[k] = referenceTemplate[k].y; 30466 } 30467 30468 const referenceWidth = referenceBitmap[0].length; 30469 const referenceHeight = referenceBitmap.length; 30470 const pseudoPixelContext = RefinementReusedContexts[templateIndex]; 30471 const bitmap = []; 30472 const decoder = decodingContext.decoder; 30473 const contexts = decodingContext.contextCache.getContexts("GR"); 30474 let ltp = 0; 30475 30476 for (let i = 0; i < height; i++) { 30477 if (prediction) { 30478 const sltp = decoder.readBit(contexts, pseudoPixelContext); 30479 ltp ^= sltp; 30480 30481 if (ltp) { 30482 throw new Jbig2Error("prediction is not supported"); 30483 } 30484 } 30485 30486 const row = new Uint8Array(width); 30487 bitmap.push(row); 30488 30489 for (let j = 0; j < width; j++) { 30490 let i0, j0; 30491 let contextLabel = 0; 30492 30493 for (k = 0; k < codingTemplateLength; k++) { 30494 i0 = i + codingTemplateY[k]; 30495 j0 = j + codingTemplateX[k]; 30496 30497 if (i0 < 0 || j0 < 0 || j0 >= width) { 30498 contextLabel <<= 1; 30499 } else { 30500 contextLabel = contextLabel << 1 | bitmap[i0][j0]; 30501 } 30502 } 30503 30504 for (k = 0; k < referenceTemplateLength; k++) { 30505 i0 = i + referenceTemplateY[k] - offsetY; 30506 j0 = j + referenceTemplateX[k] - offsetX; 30507 30508 if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) { 30509 contextLabel <<= 1; 30510 } else { 30511 contextLabel = contextLabel << 1 | referenceBitmap[i0][j0]; 30512 } 30513 } 30514 30515 const pixel = decoder.readBit(contexts, contextLabel); 30516 row[j] = pixel; 30517 } 30518 } 30519 30520 return bitmap; 30521} 30522 30523function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) { 30524 if (huffman && refinement) { 30525 throw new Jbig2Error("symbol refinement with Huffman is not supported"); 30526 } 30527 30528 const newSymbols = []; 30529 let currentHeight = 0; 30530 let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols); 30531 const decoder = decodingContext.decoder; 30532 const contextCache = decodingContext.contextCache; 30533 let tableB1, symbolWidths; 30534 30535 if (huffman) { 30536 tableB1 = getStandardTable(1); 30537 symbolWidths = []; 30538 symbolCodeLength = Math.max(symbolCodeLength, 1); 30539 } 30540 30541 while (newSymbols.length < numberOfNewSymbols) { 30542 const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder); 30543 currentHeight += deltaHeight; 30544 let currentWidth = 0, 30545 totalWidth = 0; 30546 const firstSymbol = huffman ? symbolWidths.length : 0; 30547 30548 while (true) { 30549 const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder); 30550 30551 if (deltaWidth === null) { 30552 break; 30553 } 30554 30555 currentWidth += deltaWidth; 30556 totalWidth += currentWidth; 30557 let bitmap; 30558 30559 if (refinement) { 30560 const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder); 30561 30562 if (numberOfInstances > 1) { 30563 bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput); 30564 } else { 30565 const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength); 30566 const rdx = decodeInteger(contextCache, "IARDX", decoder); 30567 const rdy = decodeInteger(contextCache, "IARDY", decoder); 30568 const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length]; 30569 bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext); 30570 } 30571 30572 newSymbols.push(bitmap); 30573 } else if (huffman) { 30574 symbolWidths.push(currentWidth); 30575 } else { 30576 bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext); 30577 newSymbols.push(bitmap); 30578 } 30579 } 30580 30581 if (huffman && !refinement) { 30582 const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput); 30583 huffmanInput.byteAlign(); 30584 let collectiveBitmap; 30585 30586 if (bitmapSize === 0) { 30587 collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight); 30588 } else { 30589 const originalEnd = huffmanInput.end; 30590 const bitmapEnd = huffmanInput.position + bitmapSize; 30591 huffmanInput.end = bitmapEnd; 30592 collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false); 30593 huffmanInput.end = originalEnd; 30594 huffmanInput.position = bitmapEnd; 30595 } 30596 30597 const numberOfSymbolsDecoded = symbolWidths.length; 30598 30599 if (firstSymbol === numberOfSymbolsDecoded - 1) { 30600 newSymbols.push(collectiveBitmap); 30601 } else { 30602 let i, 30603 y, 30604 xMin = 0, 30605 xMax, 30606 bitmapWidth, 30607 symbolBitmap; 30608 30609 for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) { 30610 bitmapWidth = symbolWidths[i]; 30611 xMax = xMin + bitmapWidth; 30612 symbolBitmap = []; 30613 30614 for (y = 0; y < currentHeight; y++) { 30615 symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax)); 30616 } 30617 30618 newSymbols.push(symbolBitmap); 30619 xMin = xMax; 30620 } 30621 } 30622 } 30623 } 30624 30625 const exportedSymbols = [], 30626 flags = []; 30627 let currentFlag = false, 30628 i, 30629 ii; 30630 const totalSymbolsLength = symbols.length + numberOfNewSymbols; 30631 30632 while (flags.length < totalSymbolsLength) { 30633 let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder); 30634 30635 while (runLength--) { 30636 flags.push(currentFlag); 30637 } 30638 30639 currentFlag = !currentFlag; 30640 } 30641 30642 for (i = 0, ii = symbols.length; i < ii; i++) { 30643 if (flags[i]) { 30644 exportedSymbols.push(symbols[i]); 30645 } 30646 } 30647 30648 for (let j = 0; j < numberOfNewSymbols; i++, j++) { 30649 if (flags[i]) { 30650 exportedSymbols.push(newSymbols[j]); 30651 } 30652 } 30653 30654 return exportedSymbols; 30655} 30656 30657function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) { 30658 if (huffman && refinement) { 30659 throw new Jbig2Error("refinement with Huffman is not supported"); 30660 } 30661 30662 const bitmap = []; 30663 let i, row; 30664 30665 for (i = 0; i < height; i++) { 30666 row = new Uint8Array(width); 30667 30668 if (defaultPixelValue) { 30669 for (let j = 0; j < width; j++) { 30670 row[j] = defaultPixelValue; 30671 } 30672 } 30673 30674 bitmap.push(row); 30675 } 30676 30677 const decoder = decodingContext.decoder; 30678 const contextCache = decodingContext.contextCache; 30679 let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder); 30680 let firstS = 0; 30681 i = 0; 30682 30683 while (i < numberOfSymbolInstances) { 30684 const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder); 30685 stripT += deltaT; 30686 const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder); 30687 firstS += deltaFirstS; 30688 let currentS = firstS; 30689 30690 do { 30691 let currentT = 0; 30692 30693 if (stripSize > 1) { 30694 currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder); 30695 } 30696 30697 const t = stripSize * stripT + currentT; 30698 const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength); 30699 const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder)); 30700 let symbolBitmap = inputSymbols[symbolId]; 30701 let symbolWidth = symbolBitmap[0].length; 30702 let symbolHeight = symbolBitmap.length; 30703 30704 if (applyRefinement) { 30705 const rdw = decodeInteger(contextCache, "IARDW", decoder); 30706 const rdh = decodeInteger(contextCache, "IARDH", decoder); 30707 const rdx = decodeInteger(contextCache, "IARDX", decoder); 30708 const rdy = decodeInteger(contextCache, "IARDY", decoder); 30709 symbolWidth += rdw; 30710 symbolHeight += rdh; 30711 symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext); 30712 } 30713 30714 const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1); 30715 const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0); 30716 let s2, t2, symbolRow; 30717 30718 if (transposed) { 30719 for (s2 = 0; s2 < symbolHeight; s2++) { 30720 row = bitmap[offsetS + s2]; 30721 30722 if (!row) { 30723 continue; 30724 } 30725 30726 symbolRow = symbolBitmap[s2]; 30727 const maxWidth = Math.min(width - offsetT, symbolWidth); 30728 30729 switch (combinationOperator) { 30730 case 0: 30731 for (t2 = 0; t2 < maxWidth; t2++) { 30732 row[offsetT + t2] |= symbolRow[t2]; 30733 } 30734 30735 break; 30736 30737 case 2: 30738 for (t2 = 0; t2 < maxWidth; t2++) { 30739 row[offsetT + t2] ^= symbolRow[t2]; 30740 } 30741 30742 break; 30743 30744 default: 30745 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 30746 } 30747 } 30748 30749 currentS += symbolHeight - 1; 30750 } else { 30751 for (t2 = 0; t2 < symbolHeight; t2++) { 30752 row = bitmap[offsetT + t2]; 30753 30754 if (!row) { 30755 continue; 30756 } 30757 30758 symbolRow = symbolBitmap[t2]; 30759 30760 switch (combinationOperator) { 30761 case 0: 30762 for (s2 = 0; s2 < symbolWidth; s2++) { 30763 row[offsetS + s2] |= symbolRow[s2]; 30764 } 30765 30766 break; 30767 30768 case 2: 30769 for (s2 = 0; s2 < symbolWidth; s2++) { 30770 row[offsetS + s2] ^= symbolRow[s2]; 30771 } 30772 30773 break; 30774 30775 default: 30776 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 30777 } 30778 } 30779 30780 currentS += symbolWidth - 1; 30781 } 30782 30783 i++; 30784 const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder); 30785 30786 if (deltaS === null) { 30787 break; 30788 } 30789 30790 currentS += deltaS + dsOffset; 30791 } while (true); 30792 } 30793 30794 return bitmap; 30795} 30796 30797function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) { 30798 const at = []; 30799 30800 if (!mmr) { 30801 at.push({ 30802 x: -patternWidth, 30803 y: 0 30804 }); 30805 30806 if (template === 0) { 30807 at.push({ 30808 x: -3, 30809 y: -1 30810 }, { 30811 x: 2, 30812 y: -2 30813 }, { 30814 x: -2, 30815 y: -2 30816 }); 30817 } 30818 } 30819 30820 const collectiveWidth = (maxPatternIndex + 1) * patternWidth; 30821 const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext); 30822 const patterns = []; 30823 30824 for (let i = 0; i <= maxPatternIndex; i++) { 30825 const patternBitmap = []; 30826 const xMin = patternWidth * i; 30827 const xMax = xMin + patternWidth; 30828 30829 for (let y = 0; y < patternHeight; y++) { 30830 patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax)); 30831 } 30832 30833 patterns.push(patternBitmap); 30834 } 30835 30836 return patterns; 30837} 30838 30839function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) { 30840 const skip = null; 30841 30842 if (enableSkip) { 30843 throw new Jbig2Error("skip is not supported"); 30844 } 30845 30846 if (combinationOperator !== 0) { 30847 throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`); 30848 } 30849 30850 const regionBitmap = []; 30851 let i, j, row; 30852 30853 for (i = 0; i < regionHeight; i++) { 30854 row = new Uint8Array(regionWidth); 30855 30856 if (defaultPixelValue) { 30857 for (j = 0; j < regionWidth; j++) { 30858 row[j] = defaultPixelValue; 30859 } 30860 } 30861 30862 regionBitmap.push(row); 30863 } 30864 30865 const numberOfPatterns = patterns.length; 30866 const pattern0 = patterns[0]; 30867 const patternWidth = pattern0[0].length, 30868 patternHeight = pattern0.length; 30869 const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns); 30870 const at = []; 30871 30872 if (!mmr) { 30873 at.push({ 30874 x: template <= 1 ? 3 : 2, 30875 y: -1 30876 }); 30877 30878 if (template === 0) { 30879 at.push({ 30880 x: -3, 30881 y: -1 30882 }, { 30883 x: 2, 30884 y: -2 30885 }, { 30886 x: -2, 30887 y: -2 30888 }); 30889 } 30890 } 30891 30892 const grayScaleBitPlanes = []; 30893 let mmrInput, bitmap; 30894 30895 if (mmr) { 30896 mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end); 30897 } 30898 30899 for (i = bitsPerValue - 1; i >= 0; i--) { 30900 if (mmr) { 30901 bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true); 30902 } else { 30903 bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext); 30904 } 30905 30906 grayScaleBitPlanes[i] = bitmap; 30907 } 30908 30909 let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow; 30910 30911 for (mg = 0; mg < gridHeight; mg++) { 30912 for (ng = 0; ng < gridWidth; ng++) { 30913 bit = 0; 30914 patternIndex = 0; 30915 30916 for (j = bitsPerValue - 1; j >= 0; j--) { 30917 bit ^= grayScaleBitPlanes[j][mg][ng]; 30918 patternIndex |= bit << j; 30919 } 30920 30921 patternBitmap = patterns[patternIndex]; 30922 x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8; 30923 y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8; 30924 30925 if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) { 30926 for (i = 0; i < patternHeight; i++) { 30927 regionRow = regionBitmap[y + i]; 30928 patternRow = patternBitmap[i]; 30929 30930 for (j = 0; j < patternWidth; j++) { 30931 regionRow[x + j] |= patternRow[j]; 30932 } 30933 } 30934 } else { 30935 let regionX, regionY; 30936 30937 for (i = 0; i < patternHeight; i++) { 30938 regionY = y + i; 30939 30940 if (regionY < 0 || regionY >= regionHeight) { 30941 continue; 30942 } 30943 30944 regionRow = regionBitmap[regionY]; 30945 patternRow = patternBitmap[i]; 30946 30947 for (j = 0; j < patternWidth; j++) { 30948 regionX = x + j; 30949 30950 if (regionX >= 0 && regionX < regionWidth) { 30951 regionRow[regionX] |= patternRow[j]; 30952 } 30953 } 30954 } 30955 } 30956 } 30957 } 30958 30959 return regionBitmap; 30960} 30961 30962function readSegmentHeader(data, start) { 30963 const segmentHeader = {}; 30964 segmentHeader.number = (0, _core_utils.readUint32)(data, start); 30965 const flags = data[start + 4]; 30966 const segmentType = flags & 0x3f; 30967 30968 if (!SegmentTypes[segmentType]) { 30969 throw new Jbig2Error("invalid segment type: " + segmentType); 30970 } 30971 30972 segmentHeader.type = segmentType; 30973 segmentHeader.typeName = SegmentTypes[segmentType]; 30974 segmentHeader.deferredNonRetain = !!(flags & 0x80); 30975 const pageAssociationFieldSize = !!(flags & 0x40); 30976 const referredFlags = data[start + 5]; 30977 let referredToCount = referredFlags >> 5 & 7; 30978 const retainBits = [referredFlags & 31]; 30979 let position = start + 6; 30980 30981 if (referredFlags === 7) { 30982 referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff; 30983 position += 3; 30984 let bytes = referredToCount + 7 >> 3; 30985 retainBits[0] = data[position++]; 30986 30987 while (--bytes > 0) { 30988 retainBits.push(data[position++]); 30989 } 30990 } else if (referredFlags === 5 || referredFlags === 6) { 30991 throw new Jbig2Error("invalid referred-to flags"); 30992 } 30993 30994 segmentHeader.retainBits = retainBits; 30995 let referredToSegmentNumberSize = 4; 30996 30997 if (segmentHeader.number <= 256) { 30998 referredToSegmentNumberSize = 1; 30999 } else if (segmentHeader.number <= 65536) { 31000 referredToSegmentNumberSize = 2; 31001 } 31002 31003 const referredTo = []; 31004 let i, ii; 31005 31006 for (i = 0; i < referredToCount; i++) { 31007 let number; 31008 31009 if (referredToSegmentNumberSize === 1) { 31010 number = data[position]; 31011 } else if (referredToSegmentNumberSize === 2) { 31012 number = (0, _core_utils.readUint16)(data, position); 31013 } else { 31014 number = (0, _core_utils.readUint32)(data, position); 31015 } 31016 31017 referredTo.push(number); 31018 position += referredToSegmentNumberSize; 31019 } 31020 31021 segmentHeader.referredTo = referredTo; 31022 31023 if (!pageAssociationFieldSize) { 31024 segmentHeader.pageAssociation = data[position++]; 31025 } else { 31026 segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position); 31027 position += 4; 31028 } 31029 31030 segmentHeader.length = (0, _core_utils.readUint32)(data, position); 31031 position += 4; 31032 31033 if (segmentHeader.length === 0xffffffff) { 31034 if (segmentType === 38) { 31035 const genericRegionInfo = readRegionSegmentInformation(data, position); 31036 const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength]; 31037 const genericRegionMmr = !!(genericRegionSegmentFlags & 1); 31038 const searchPatternLength = 6; 31039 const searchPattern = new Uint8Array(searchPatternLength); 31040 31041 if (!genericRegionMmr) { 31042 searchPattern[0] = 0xff; 31043 searchPattern[1] = 0xac; 31044 } 31045 31046 searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff; 31047 searchPattern[3] = genericRegionInfo.height >> 16 & 0xff; 31048 searchPattern[4] = genericRegionInfo.height >> 8 & 0xff; 31049 searchPattern[5] = genericRegionInfo.height & 0xff; 31050 31051 for (i = position, ii = data.length; i < ii; i++) { 31052 let j = 0; 31053 31054 while (j < searchPatternLength && searchPattern[j] === data[i + j]) { 31055 j++; 31056 } 31057 31058 if (j === searchPatternLength) { 31059 segmentHeader.length = i + searchPatternLength; 31060 break; 31061 } 31062 } 31063 31064 if (segmentHeader.length === 0xffffffff) { 31065 throw new Jbig2Error("segment end was not found"); 31066 } 31067 } else { 31068 throw new Jbig2Error("invalid unknown segment length"); 31069 } 31070 } 31071 31072 segmentHeader.headerEnd = position; 31073 return segmentHeader; 31074} 31075 31076function readSegments(header, data, start, end) { 31077 const segments = []; 31078 let position = start; 31079 31080 while (position < end) { 31081 const segmentHeader = readSegmentHeader(data, position); 31082 position = segmentHeader.headerEnd; 31083 const segment = { 31084 header: segmentHeader, 31085 data 31086 }; 31087 31088 if (!header.randomAccess) { 31089 segment.start = position; 31090 position += segmentHeader.length; 31091 segment.end = position; 31092 } 31093 31094 segments.push(segment); 31095 31096 if (segmentHeader.type === 51) { 31097 break; 31098 } 31099 } 31100 31101 if (header.randomAccess) { 31102 for (let i = 0, ii = segments.length; i < ii; i++) { 31103 segments[i].start = position; 31104 position += segments[i].header.length; 31105 segments[i].end = position; 31106 } 31107 } 31108 31109 return segments; 31110} 31111 31112function readRegionSegmentInformation(data, start) { 31113 return { 31114 width: (0, _core_utils.readUint32)(data, start), 31115 height: (0, _core_utils.readUint32)(data, start + 4), 31116 x: (0, _core_utils.readUint32)(data, start + 8), 31117 y: (0, _core_utils.readUint32)(data, start + 12), 31118 combinationOperator: data[start + 16] & 7 31119 }; 31120} 31121 31122const RegionSegmentInformationFieldLength = 17; 31123 31124function processSegment(segment, visitor) { 31125 const header = segment.header; 31126 const data = segment.data, 31127 end = segment.end; 31128 let position = segment.start; 31129 let args, at, i, atLength; 31130 31131 switch (header.type) { 31132 case 0: 31133 const dictionary = {}; 31134 const dictionaryFlags = (0, _core_utils.readUint16)(data, position); 31135 dictionary.huffman = !!(dictionaryFlags & 1); 31136 dictionary.refinement = !!(dictionaryFlags & 2); 31137 dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3; 31138 dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3; 31139 dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1; 31140 dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1; 31141 dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256); 31142 dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512); 31143 dictionary.template = dictionaryFlags >> 10 & 3; 31144 dictionary.refinementTemplate = dictionaryFlags >> 12 & 1; 31145 position += 2; 31146 31147 if (!dictionary.huffman) { 31148 atLength = dictionary.template === 0 ? 4 : 1; 31149 at = []; 31150 31151 for (i = 0; i < atLength; i++) { 31152 at.push({ 31153 x: (0, _core_utils.readInt8)(data, position), 31154 y: (0, _core_utils.readInt8)(data, position + 1) 31155 }); 31156 position += 2; 31157 } 31158 31159 dictionary.at = at; 31160 } 31161 31162 if (dictionary.refinement && !dictionary.refinementTemplate) { 31163 at = []; 31164 31165 for (i = 0; i < 2; i++) { 31166 at.push({ 31167 x: (0, _core_utils.readInt8)(data, position), 31168 y: (0, _core_utils.readInt8)(data, position + 1) 31169 }); 31170 position += 2; 31171 } 31172 31173 dictionary.refinementAt = at; 31174 } 31175 31176 dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position); 31177 position += 4; 31178 dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position); 31179 position += 4; 31180 args = [dictionary, header.number, header.referredTo, data, position, end]; 31181 break; 31182 31183 case 6: 31184 case 7: 31185 const textRegion = {}; 31186 textRegion.info = readRegionSegmentInformation(data, position); 31187 position += RegionSegmentInformationFieldLength; 31188 const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position); 31189 position += 2; 31190 textRegion.huffman = !!(textRegionSegmentFlags & 1); 31191 textRegion.refinement = !!(textRegionSegmentFlags & 2); 31192 textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3; 31193 textRegion.stripSize = 1 << textRegion.logStripSize; 31194 textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3; 31195 textRegion.transposed = !!(textRegionSegmentFlags & 64); 31196 textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3; 31197 textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1; 31198 textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27; 31199 textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1; 31200 31201 if (textRegion.huffman) { 31202 const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position); 31203 position += 2; 31204 textRegion.huffmanFS = textRegionHuffmanFlags & 3; 31205 textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3; 31206 textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3; 31207 textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3; 31208 textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3; 31209 textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3; 31210 textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3; 31211 textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000); 31212 } 31213 31214 if (textRegion.refinement && !textRegion.refinementTemplate) { 31215 at = []; 31216 31217 for (i = 0; i < 2; i++) { 31218 at.push({ 31219 x: (0, _core_utils.readInt8)(data, position), 31220 y: (0, _core_utils.readInt8)(data, position + 1) 31221 }); 31222 position += 2; 31223 } 31224 31225 textRegion.refinementAt = at; 31226 } 31227 31228 textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position); 31229 position += 4; 31230 args = [textRegion, header.referredTo, data, position, end]; 31231 break; 31232 31233 case 16: 31234 const patternDictionary = {}; 31235 const patternDictionaryFlags = data[position++]; 31236 patternDictionary.mmr = !!(patternDictionaryFlags & 1); 31237 patternDictionary.template = patternDictionaryFlags >> 1 & 3; 31238 patternDictionary.patternWidth = data[position++]; 31239 patternDictionary.patternHeight = data[position++]; 31240 patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position); 31241 position += 4; 31242 args = [patternDictionary, header.number, data, position, end]; 31243 break; 31244 31245 case 22: 31246 case 23: 31247 const halftoneRegion = {}; 31248 halftoneRegion.info = readRegionSegmentInformation(data, position); 31249 position += RegionSegmentInformationFieldLength;
31250 const halftoneRegionFlags = data[position++]; 31251 halftoneRegion.mmr = !!(halftoneRegionFlags & 1); 31252 halftoneRegion.template = halftoneRegionFlags >> 1 & 3; 31253 halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8); 31254 halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7; 31255 halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1; 31256 halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position); 31257 position += 4; 31258 halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position); 31259 position += 4; 31260 halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff; 31261 position += 4; 31262 halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff; 31263 position += 4; 31264 halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position); 31265 position += 2; 31266 halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position); 31267 position += 2; 31268 args = [halftoneRegion, header.referredTo, data, position, end]; 31269 break; 31270 31271 case 38: 31272 case 39: 31273 const genericRegion = {}; 31274 genericRegion.info = readRegionSegmentInformation(data, position); 31275 position += RegionSegmentInformationFieldLength; 31276 const genericRegionSegmentFlags = data[position++]; 31277 genericRegion.mmr = !!(genericRegionSegmentFlags & 1); 31278 genericRegion.template = genericRegionSegmentFlags >> 1 & 3; 31279 genericRegion.prediction = !!(genericRegionSegmentFlags & 8); 31280 31281 if (!genericRegion.mmr) { 31282 atLength = genericRegion.template === 0 ? 4 : 1; 31283 at = []; 31284 31285 for (i = 0; i < atLength; i++) { 31286 at.push({ 31287 x: (0, _core_utils.readInt8)(data, position), 31288 y: (0, _core_utils.readInt8)(data, position + 1) 31289 }); 31290 position += 2; 31291 } 31292 31293 genericRegion.at = at; 31294 } 31295 31296 args = [genericRegion, data, position, end]; 31297 break; 31298 31299 case 48: 31300 const pageInfo = { 31301 width: (0, _core_utils.readUint32)(data, position), 31302 height: (0, _core_utils.readUint32)(data, position + 4), 31303 resolutionX: (0, _core_utils.readUint32)(data, position + 8), 31304 resolutionY: (0, _core_utils.readUint32)(data, position + 12) 31305 }; 31306 31307 if (pageInfo.height === 0xffffffff) { 31308 delete pageInfo.height; 31309 } 31310 31311 const pageSegmentFlags = data[position + 16]; 31312 (0, _core_utils.readUint16)(data, position + 17); 31313 pageInfo.lossless = !!(pageSegmentFlags & 1); 31314 pageInfo.refinement = !!(pageSegmentFlags & 2); 31315 pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1; 31316 pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3; 31317 pageInfo.requiresBuffer = !!(pageSegmentFlags & 32); 31318 pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64); 31319 args = [pageInfo]; 31320 break; 31321 31322 case 49: 31323 break; 31324 31325 case 50: 31326 break; 31327 31328 case 51: 31329 break; 31330 31331 case 53: 31332 args = [header.number, data, position, end]; 31333 break; 31334 31335 case 62: 31336 break; 31337 31338 default: 31339 throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented"); 31340 } 31341 31342 const callbackName = "on" + header.typeName; 31343 31344 if (callbackName in visitor) { 31345 visitor[callbackName].apply(visitor, args); 31346 } 31347} 31348 31349function processSegments(segments, visitor) { 31350 for (let i = 0, ii = segments.length; i < ii; i++) { 31351 processSegment(segments[i], visitor); 31352 } 31353} 31354 31355function parseJbig2Chunks(chunks) { 31356 const visitor = new SimpleSegmentVisitor(); 31357 31358 for (let i = 0, ii = chunks.length; i < ii; i++) { 31359 const chunk = chunks[i]; 31360 const segments = readSegments({}, chunk.data, chunk.start, chunk.end); 31361 processSegments(segments, visitor); 31362 } 31363 31364 return visitor.buffer; 31365} 31366 31367function parseJbig2(data) { 31368 const end = data.length; 31369 let position = 0; 31370 31371 if (data[position] !== 0x97 || data[position + 1] !== 0x4a || data[position + 2] !== 0x42 || data[position + 3] !== 0x32 || data[position + 4] !== 0x0d || data[position + 5] !== 0x0a || data[position + 6] !== 0x1a || data[position + 7] !== 0x0a) { 31372 throw new Jbig2Error("parseJbig2 - invalid header."); 31373 } 31374 31375 const header = Object.create(null); 31376 position += 8; 31377 const flags = data[position++]; 31378 header.randomAccess = !(flags & 1); 31379 31380 if (!(flags & 2)) { 31381 header.numberOfPages = (0, _core_utils.readUint32)(data, position); 31382 position += 4; 31383 } 31384 31385 const segments = readSegments(header, data, position, end); 31386 const visitor = new SimpleSegmentVisitor(); 31387 processSegments(segments, visitor); 31388 const { 31389 width, 31390 height 31391 } = visitor.currentPageInfo; 31392 const bitPacked = visitor.buffer; 31393 const imgData = new Uint8ClampedArray(width * height); 31394 let q = 0, 31395 k = 0; 31396 31397 for (let i = 0; i < height; i++) { 31398 let mask = 0, 31399 buffer; 31400 31401 for (let j = 0; j < width; j++) { 31402 if (!mask) { 31403 mask = 128; 31404 buffer = bitPacked[k++]; 31405 } 31406
vendor: 27,341 bytes, lines 31407-32556
31407 imgData[q++] = buffer & mask ? 0 : 255; 31408 mask >>= 1; 31409 } 31410 } 31411 31412 return { 31413 imgData, 31414 width, 31415 height 31416 }; 31417} 31418 31419class SimpleSegmentVisitor { 31420 onPageInformation(info) { 31421 this.currentPageInfo = info; 31422 const rowSize = info.width + 7 >> 3; 31423 const buffer = new Uint8ClampedArray(rowSize * info.height); 31424 31425 if (info.defaultPixelValue) { 31426 for (let i = 0, ii = buffer.length; i < ii; i++) { 31427 buffer[i] = 0xff; 31428 } 31429 } 31430 31431 this.buffer = buffer; 31432 } 31433 31434 drawBitmap(regionInfo, bitmap) { 31435 const pageInfo = this.currentPageInfo; 31436 const width = regionInfo.width, 31437 height = regionInfo.height; 31438 const rowSize = pageInfo.width + 7 >> 3; 31439 const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator; 31440 const buffer = this.buffer; 31441 const mask0 = 128 >> (regionInfo.x & 7); 31442 let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3); 31443 let i, j, mask, offset; 31444 31445 switch (combinationOperator) { 31446 case 0: 31447 for (i = 0; i < height; i++) { 31448 mask = mask0; 31449 offset = offset0; 31450 31451 for (j = 0; j < width; j++) { 31452 if (bitmap[i][j]) { 31453 buffer[offset] |= mask; 31454 } 31455 31456 mask >>= 1; 31457 31458 if (!mask) { 31459 mask = 128; 31460 offset++; 31461 } 31462 } 31463 31464 offset0 += rowSize; 31465 } 31466 31467 break; 31468 31469 case 2: 31470 for (i = 0; i < height; i++) { 31471 mask = mask0; 31472 offset = offset0; 31473 31474 for (j = 0; j < width; j++) { 31475 if (bitmap[i][j]) { 31476 buffer[offset] ^= mask; 31477 } 31478 31479 mask >>= 1; 31480 31481 if (!mask) { 31482 mask = 128; 31483 offset++; 31484 } 31485 } 31486 31487 offset0 += rowSize; 31488 } 31489 31490 break; 31491 31492 default: 31493 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 31494 } 31495 } 31496 31497 onImmediateGenericRegion(region, data, start, end) { 31498 const regionInfo = region.info; 31499 const decodingContext = new DecodingContext(data, start, end); 31500 const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext); 31501 this.drawBitmap(regionInfo, bitmap); 31502 } 31503 31504 onImmediateLosslessGenericRegion() { 31505 this.onImmediateGenericRegion.apply(this, arguments); 31506 } 31507 31508 onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) { 31509 let huffmanTables, huffmanInput; 31510 31511 if (dictionary.huffman) { 31512 huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables); 31513 huffmanInput = new Reader(data, start, end); 31514 } 31515 31516 let symbols = this.symbols; 31517 31518 if (!symbols) { 31519 this.symbols = symbols = {}; 31520 } 31521 31522 let inputSymbols = []; 31523 31524 for (let i = 0, ii = referredSegments.length; i < ii; i++) { 31525 const referredSymbols = symbols[referredSegments[i]]; 31526 31527 if (referredSymbols) { 31528 inputSymbols = inputSymbols.concat(referredSymbols); 31529 } 31530 } 31531 31532 const decodingContext = new DecodingContext(data, start, end); 31533 symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput); 31534 } 31535 31536 onImmediateTextRegion(region, referredSegments, data, start, end) { 31537 const regionInfo = region.info; 31538 let huffmanTables, huffmanInput; 31539 const symbols = this.symbols; 31540 let inputSymbols = []; 31541 31542 for (let i = 0, ii = referredSegments.length; i < ii; i++) { 31543 const referredSymbols = symbols[referredSegments[i]]; 31544 31545 if (referredSymbols) { 31546 inputSymbols = inputSymbols.concat(referredSymbols); 31547 } 31548 } 31549 31550 const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length); 31551 31552 if (region.huffman) { 31553 huffmanInput = new Reader(data, start, end); 31554 huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput); 31555 } 31556 31557 const decodingContext = new DecodingContext(data, start, end); 31558 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); 31559 this.drawBitmap(regionInfo, bitmap); 31560 } 31561 31562 onImmediateLosslessTextRegion() { 31563 this.onImmediateTextRegion.apply(this, arguments); 31564 } 31565 31566 onPatternDictionary(dictionary, currentSegment, data, start, end) { 31567 let patterns = this.patterns; 31568 31569 if (!patterns) { 31570 this.patterns = patterns = {}; 31571 } 31572 31573 const decodingContext = new DecodingContext(data, start, end); 31574 patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext); 31575 } 31576 31577 onImmediateHalftoneRegion(region, referredSegments, data, start, end) { 31578 const patterns = this.patterns[referredSegments[0]]; 31579 const regionInfo = region.info; 31580 const decodingContext = new DecodingContext(data, start, end); 31581 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); 31582 this.drawBitmap(regionInfo, bitmap); 31583 } 31584 31585 onImmediateLosslessHalftoneRegion() { 31586 this.onImmediateHalftoneRegion.apply(this, arguments); 31587 } 31588 31589 onTables(currentSegment, data, start, end) { 31590 let customTables = this.customTables; 31591 31592 if (!customTables) { 31593 this.customTables = customTables = {}; 31594 } 31595 31596 customTables[currentSegment] = decodeTablesSegment(data, start, end); 31597 } 31598 31599} 31600 31601class HuffmanLine { 31602 constructor(lineData) { 31603 if (lineData.length === 2) { 31604 this.isOOB = true; 31605 this.rangeLow = 0; 31606 this.prefixLength = lineData[0]; 31607 this.rangeLength = 0; 31608 this.prefixCode = lineData[1]; 31609 this.isLowerRange = false; 31610 } else { 31611 this.isOOB = false; 31612 this.rangeLow = lineData[0]; 31613 this.prefixLength = lineData[1]; 31614 this.rangeLength = lineData[2]; 31615 this.prefixCode = lineData[3]; 31616 this.isLowerRange = lineData[4] === "lower"; 31617 } 31618 } 31619 31620} 31621 31622class HuffmanTreeNode { 31623 constructor(line) { 31624 this.children = []; 31625 31626 if (line) { 31627 this.isLeaf = true; 31628 this.rangeLength = line.rangeLength; 31629 this.rangeLow = line.rangeLow; 31630 this.isLowerRange = line.isLowerRange; 31631 this.isOOB = line.isOOB; 31632 } else { 31633 this.isLeaf = false; 31634 } 31635 } 31636 31637 buildTree(line, shift) { 31638 const bit = line.prefixCode >> shift & 1; 31639 31640 if (shift <= 0) { 31641 this.children[bit] = new HuffmanTreeNode(line); 31642 } else { 31643 let node = this.children[bit]; 31644 31645 if (!node) { 31646 this.children[bit] = node = new HuffmanTreeNode(null); 31647 } 31648 31649 node.buildTree(line, shift - 1); 31650 } 31651 } 31652 31653 decodeNode(reader) { 31654 if (this.isLeaf) { 31655 if (this.isOOB) { 31656 return null; 31657 } 31658 31659 const htOffset = reader.readBits(this.rangeLength); 31660 return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset); 31661 } 31662 31663 const node = this.children[reader.readBit()]; 31664 31665 if (!node) { 31666 throw new Jbig2Error("invalid Huffman data"); 31667 } 31668 31669 return node.decodeNode(reader); 31670 } 31671 31672} 31673 31674class HuffmanTable { 31675 constructor(lines, prefixCodesDone) { 31676 if (!prefixCodesDone) { 31677 this.assignPrefixCodes(lines); 31678 } 31679 31680 this.rootNode = new HuffmanTreeNode(null); 31681 31682 for (let i = 0, ii = lines.length; i < ii; i++) { 31683 const line = lines[i]; 31684 31685 if (line.prefixLength > 0) { 31686 this.rootNode.buildTree(line, line.prefixLength - 1); 31687 } 31688 } 31689 } 31690 31691 decode(reader) { 31692 return this.rootNode.decodeNode(reader); 31693 } 31694 31695 assignPrefixCodes(lines) { 31696 const linesLength = lines.length; 31697 let prefixLengthMax = 0; 31698 31699 for (let i = 0; i < linesLength; i++) { 31700 prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength); 31701 } 31702 31703 const histogram = new Uint32Array(prefixLengthMax + 1); 31704 31705 for (let i = 0; i < linesLength; i++) { 31706 histogram[lines[i].prefixLength]++; 31707 } 31708 31709 let currentLength = 1, 31710 firstCode = 0, 31711 currentCode, 31712 currentTemp, 31713 line; 31714 histogram[0] = 0; 31715 31716 while (currentLength <= prefixLengthMax) { 31717 firstCode = firstCode + histogram[currentLength - 1] << 1; 31718 currentCode = firstCode; 31719 currentTemp = 0; 31720 31721 while (currentTemp < linesLength) { 31722 line = lines[currentTemp]; 31723 31724 if (line.prefixLength === currentLength) { 31725 line.prefixCode = currentCode; 31726 currentCode++; 31727 } 31728 31729 currentTemp++; 31730 } 31731 31732 currentLength++; 31733 } 31734 } 31735 31736} 31737 31738function decodeTablesSegment(data, start, end) { 31739 const flags = data[start]; 31740 const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff; 31741 const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff; 31742 const reader = new Reader(data, start + 9, end); 31743 const prefixSizeBits = (flags >> 1 & 7) + 1; 31744 const rangeSizeBits = (flags >> 4 & 7) + 1; 31745 const lines = []; 31746 let prefixLength, 31747 rangeLength, 31748 currentRangeLow = lowestValue; 31749 31750 do { 31751 prefixLength = reader.readBits(prefixSizeBits); 31752 rangeLength = reader.readBits(rangeSizeBits); 31753 lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0])); 31754 currentRangeLow += 1 << rangeLength; 31755 } while (currentRangeLow < highestValue); 31756 31757 prefixLength = reader.readBits(prefixSizeBits); 31758 lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"])); 31759 prefixLength = reader.readBits(prefixSizeBits); 31760 lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0])); 31761 31762 if (flags & 1) { 31763 prefixLength = reader.readBits(prefixSizeBits); 31764 lines.push(new HuffmanLine([prefixLength, 0])); 31765 } 31766 31767 return new HuffmanTable(lines, false); 31768} 31769 31770const standardTablesCache = {}; 31771 31772function getStandardTable(number) { 31773 let table = standardTablesCache[number]; 31774 31775 if (table) { 31776 return table; 31777 } 31778 31779 let lines; 31780 31781 switch (number) { 31782 case 1: 31783 lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]]; 31784 break; 31785 31786 case 2: 31787 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]]; 31788 break; 31789 31790 case 3: 31791 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]]; 31792 break; 31793 31794 case 4: 31795 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]]; 31796 break; 31797 31798 case 5: 31799 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]]; 31800 break; 31801 31802 case 6: 31803 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]]; 31804 break; 31805 31806 case 7: 31807 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]]; 31808 break; 31809 31810 case 8: 31811 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]]; 31812 break; 31813 31814 case 9: 31815 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]]; 31816 break; 31817 31818 case 10: 31819 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]]; 31820 break; 31821 31822 case 11: 31823 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]]; 31824 break; 31825 31826 case 12: 31827 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]]; 31828 break; 31829 31830 case 13: 31831 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]]; 31832 break; 31833 31834 case 14: 31835 lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]]; 31836 break; 31837 31838 case 15: 31839 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]]; 31840 break; 31841 31842 default: 31843 throw new Jbig2Error(`standard table B.${number} does not exist`); 31844 } 31845 31846 for (let i = 0, ii = lines.length; i < ii; i++) { 31847 lines[i] = new HuffmanLine(lines[i]); 31848 } 31849 31850 table = new HuffmanTable(lines, true); 31851 standardTablesCache[number] = table; 31852 return table; 31853} 31854 31855class Reader { 31856 constructor(data, start, end) { 31857 this.data = data; 31858 this.start = start; 31859 this.end = end; 31860 this.position = start; 31861 this.shift = -1; 31862 this.currentByte = 0; 31863 } 31864 31865 readBit() { 31866 if (this.shift < 0) { 31867 if (this.position >= this.end) { 31868 throw new Jbig2Error("end of data while reading bit"); 31869 } 31870 31871 this.currentByte = this.data[this.position++]; 31872 this.shift = 7; 31873 } 31874 31875 const bit = this.currentByte >> this.shift & 1; 31876 this.shift--; 31877 return bit; 31878 } 31879 31880 readBits(numBits) { 31881 let result = 0, 31882 i; 31883 31884 for (i = numBits - 1; i >= 0; i--) { 31885 result |= this.readBit() << i; 31886 } 31887 31888 return result; 31889 } 31890 31891 byteAlign() { 31892 this.shift = -1; 31893 } 31894 31895 next() { 31896 if (this.position >= this.end) { 31897 return -1; 31898 } 31899 31900 return this.data[this.position++]; 31901 } 31902 31903} 31904 31905function getCustomHuffmanTable(index, referredTo, customTables) { 31906 let currentIndex = 0; 31907 31908 for (let i = 0, ii = referredTo.length; i < ii; i++) { 31909 const table = customTables[referredTo[i]]; 31910 31911 if (table) { 31912 if (index === currentIndex) { 31913 return table; 31914 } 31915 31916 currentIndex++; 31917 } 31918 } 31919 31920 throw new Jbig2Error("can't find custom Huffman table"); 31921} 31922 31923function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) { 31924 const codes = []; 31925 31926 for (let i = 0; i <= 34; i++) { 31927 const codeLength = reader.readBits(4); 31928 codes.push(new HuffmanLine([i, codeLength, 0, 0])); 31929 } 31930 31931 const runCodesTable = new HuffmanTable(codes, false); 31932 codes.length = 0; 31933 31934 for (let i = 0; i < numberOfSymbols;) { 31935 const codeLength = runCodesTable.decode(reader); 31936 31937 if (codeLength >= 32) { 31938 let repeatedLength, numberOfRepeats, j; 31939 31940 switch (codeLength) { 31941 case 32: 31942 if (i === 0) { 31943 throw new Jbig2Error("no previous value in symbol ID table"); 31944 } 31945 31946 numberOfRepeats = reader.readBits(2) + 3; 31947 repeatedLength = codes[i - 1].prefixLength; 31948 break; 31949 31950 case 33: 31951 numberOfRepeats = reader.readBits(3) + 3; 31952 repeatedLength = 0; 31953 break; 31954 31955 case 34: 31956 numberOfRepeats = reader.readBits(7) + 11; 31957 repeatedLength = 0; 31958 break; 31959 31960 default: 31961 throw new Jbig2Error("invalid code length in symbol ID table"); 31962 } 31963 31964 for (j = 0; j < numberOfRepeats; j++) { 31965 codes.push(new HuffmanLine([i, repeatedLength, 0, 0])); 31966 i++; 31967 } 31968 } else { 31969 codes.push(new HuffmanLine([i, codeLength, 0, 0])); 31970 i++; 31971 } 31972 } 31973 31974 reader.byteAlign(); 31975 const symbolIDTable = new HuffmanTable(codes, false); 31976 let customIndex = 0, 31977 tableFirstS, 31978 tableDeltaS, 31979 tableDeltaT; 31980 31981 switch (textRegion.huffmanFS) { 31982 case 0: 31983 case 1: 31984 tableFirstS = getStandardTable(textRegion.huffmanFS + 6); 31985 break; 31986 31987 case 3: 31988 tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables); 31989 customIndex++; 31990 break; 31991 31992 default: 31993 throw new Jbig2Error("invalid Huffman FS selector"); 31994 } 31995 31996 switch (textRegion.huffmanDS) { 31997 case 0: 31998 case 1: 31999 case 2: 32000 tableDeltaS = getStandardTable(textRegion.huffmanDS + 8); 32001 break; 32002 32003 case 3: 32004 tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables); 32005 customIndex++; 32006 break; 32007 32008 default: 32009 throw new Jbig2Error("invalid Huffman DS selector"); 32010 } 32011 32012 switch (textRegion.huffmanDT) { 32013 case 0: 32014 case 1: 32015 case 2: 32016 tableDeltaT = getStandardTable(textRegion.huffmanDT + 11); 32017 break; 32018 32019 case 3: 32020 tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables); 32021 customIndex++; 32022 break; 32023 32024 default: 32025 throw new Jbig2Error("invalid Huffman DT selector"); 32026 } 32027 32028 if (textRegion.refinement) { 32029 throw new Jbig2Error("refinement with Huffman is not supported"); 32030 } 32031 32032 return { 32033 symbolIDTable, 32034 tableFirstS, 32035 tableDeltaS, 32036 tableDeltaT 32037 }; 32038} 32039 32040function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) { 32041 let customIndex = 0, 32042 tableDeltaHeight, 32043 tableDeltaWidth; 32044 32045 switch (dictionary.huffmanDHSelector) { 32046 case 0: 32047 case 1: 32048 tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4); 32049 break; 32050 32051 case 3: 32052 tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables); 32053 customIndex++; 32054 break; 32055 32056 default: 32057 throw new Jbig2Error("invalid Huffman DH selector"); 32058 } 32059 32060 switch (dictionary.huffmanDWSelector) { 32061 case 0: 32062 case 1: 32063 tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2); 32064 break; 32065 32066 case 3: 32067 tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables); 32068 customIndex++; 32069 break; 32070 32071 default: 32072 throw new Jbig2Error("invalid Huffman DW selector"); 32073 } 32074 32075 let tableBitmapSize, tableAggregateInstances; 32076 32077 if (dictionary.bitmapSizeSelector) { 32078 tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables); 32079 customIndex++; 32080 } else { 32081 tableBitmapSize = getStandardTable(1); 32082 } 32083 32084 if (dictionary.aggregationInstancesSelector) { 32085 tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables); 32086 } else { 32087 tableAggregateInstances = getStandardTable(1); 32088 } 32089 32090 return { 32091 tableDeltaHeight, 32092 tableDeltaWidth, 32093 tableBitmapSize, 32094 tableAggregateInstances 32095 }; 32096} 32097 32098function readUncompressedBitmap(reader, width, height) { 32099 const bitmap = []; 32100 32101 for (let y = 0; y < height; y++) { 32102 const row = new Uint8Array(width); 32103 bitmap.push(row); 32104 32105 for (let x = 0; x < width; x++) { 32106 row[x] = reader.readBit(); 32107 } 32108 32109 reader.byteAlign(); 32110 } 32111 32112 return bitmap; 32113} 32114 32115function decodeMMRBitmap(input, width, height, endOfBlock) { 32116 const params = { 32117 K: -1, 32118 Columns: width, 32119 Rows: height, 32120 BlackIs1: true, 32121 EndOfBlock: endOfBlock 32122 }; 32123 const decoder = new _ccitt.CCITTFaxDecoder(input, params); 32124 const bitmap = []; 32125 let currentByte, 32126 eof = false; 32127 32128 for (let y = 0; y < height; y++) { 32129 const row = new Uint8Array(width); 32130 bitmap.push(row); 32131 let shift = -1; 32132 32133 for (let x = 0; x < width; x++) { 32134 if (shift < 0) { 32135 currentByte = decoder.readNextChar(); 32136 32137 if (currentByte === -1) { 32138 currentByte = 0; 32139 eof = true; 32140 } 32141 32142 shift = 7; 32143 } 32144 32145 row[x] = currentByte >> shift & 1; 32146 shift--; 32147 } 32148 } 32149 32150 if (endOfBlock && !eof) { 32151 const lookForEOFLimit = 5; 32152 32153 for (let i = 0; i < lookForEOFLimit; i++) { 32154 if (decoder.readNextChar() === -1) { 32155 break; 32156 } 32157 } 32158 } 32159 32160 return bitmap; 32161} 32162 32163class Jbig2Image { 32164 parseChunks(chunks) { 32165 return parseJbig2Chunks(chunks); 32166 } 32167 32168 parse(data) { 32169 const { 32170 imgData, 32171 width, 32172 height 32173 } = parseJbig2(data); 32174 this.width = width; 32175 this.height = height; 32176 return imgData; 32177 } 32178 32179} 32180 32181exports.Jbig2Image = Jbig2Image; 32182 32183/***/ }), 32184/* 36 */ 32185/***/ ((__unused_webpack_module, exports) => { 32186 32187 32188 32189Object.defineProperty(exports, "__esModule", ({ 32190 value: true 32191})); 32192exports.ArithmeticDecoder = void 0; 32193const QeTable = [{ 32194 qe: 0x5601, 32195 nmps: 1, 32196 nlps: 1, 32197 switchFlag: 1 32198}, { 32199 qe: 0x3401, 32200 nmps: 2, 32201 nlps: 6, 32202 switchFlag: 0 32203}, { 32204 qe: 0x1801, 32205 nmps: 3, 32206 nlps: 9, 32207 switchFlag: 0 32208}, { 32209 qe: 0x0ac1, 32210 nmps: 4, 32211 nlps: 12, 32212 switchFlag: 0 32213}, { 32214 qe: 0x0521, 32215 nmps: 5, 32216 nlps: 29, 32217 switchFlag: 0 32218}, { 32219 qe: 0x0221, 32220 nmps: 38, 32221 nlps: 33, 32222 switchFlag: 0 32223}, { 32224 qe: 0x5601, 32225 nmps: 7, 32226 nlps: 6, 32227 switchFlag: 1 32228}, { 32229 qe: 0x5401, 32230 nmps: 8, 32231 nlps: 14, 32232 switchFlag: 0 32233}, { 32234 qe: 0x4801, 32235 nmps: 9, 32236 nlps: 14, 32237 switchFlag: 0 32238}, { 32239 qe: 0x3801, 32240 nmps: 10, 32241 nlps: 14, 32242 switchFlag: 0 32243}, { 32244 qe: 0x3001, 32245 nmps: 11, 32246 nlps: 17, 32247 switchFlag: 0 32248}, { 32249 qe: 0x2401, 32250 nmps: 12, 32251 nlps: 18, 32252 switchFlag: 0 32253}, { 32254 qe: 0x1c01, 32255 nmps: 13, 32256 nlps: 20, 32257 switchFlag: 0 32258}, { 32259 qe: 0x1601, 32260 nmps: 29, 32261 nlps: 21, 32262 switchFlag: 0 32263}, { 32264 qe: 0x5601, 32265 nmps: 15, 32266 nlps: 14, 32267 switchFlag: 1 32268}, { 32269 qe: 0x5401, 32270 nmps: 16, 32271 nlps: 14, 32272 switchFlag: 0 32273}, { 32274 qe: 0x5101, 32275 nmps: 17, 32276 nlps: 15, 32277 switchFlag: 0 32278}, { 32279 qe: 0x4801, 32280 nmps: 18, 32281 nlps: 16, 32282 switchFlag: 0 32283}, { 32284 qe: 0x3801, 32285 nmps: 19, 32286 nlps: 17, 32287 switchFlag: 0 32288}, { 32289 qe: 0x3401, 32290 nmps: 20, 32291 nlps: 18, 32292 switchFlag: 0 32293}, { 32294 qe: 0x3001, 32295 nmps: 21, 32296 nlps: 19, 32297 switchFlag: 0 32298}, { 32299 qe: 0x2801, 32300 nmps: 22, 32301 nlps: 19, 32302 switchFlag: 0 32303}, { 32304 qe: 0x2401, 32305 nmps: 23, 32306 nlps: 20, 32307 switchFlag: 0 32308}, { 32309 qe: 0x2201, 32310 nmps: 24, 32311 nlps: 21, 32312 switchFlag: 0 32313}, { 32314 qe: 0x1c01, 32315 nmps: 25, 32316 nlps: 22, 32317 switchFlag: 0 32318}, { 32319 qe: 0x1801, 32320 nmps: 26, 32321 nlps: 23, 32322 switchFlag: 0 32323}, { 32324 qe: 0x1601, 32325 nmps: 27, 32326 nlps: 24, 32327 switchFlag: 0 32328}, { 32329 qe: 0x1401, 32330 nmps: 28, 32331 nlps: 25, 32332 switchFlag: 0 32333}, { 32334 qe: 0x1201, 32335 nmps: 29, 32336 nlps: 26, 32337 switchFlag: 0 32338}, { 32339 qe: 0x1101, 32340 nmps: 30, 32341 nlps: 27, 32342 switchFlag: 0 32343}, { 32344 qe: 0x0ac1, 32345 nmps: 31, 32346 nlps: 28, 32347 switchFlag: 0 32348}, { 32349 qe: 0x09c1, 32350 nmps: 32, 32351 nlps: 29, 32352 switchFlag: 0 32353}, { 32354 qe: 0x08a1, 32355 nmps: 33, 32356 nlps: 30, 32357 switchFlag: 0 32358}, { 32359 qe: 0x0521, 32360 nmps: 34, 32361 nlps: 31, 32362 switchFlag: 0 32363}, { 32364 qe: 0x0441, 32365 nmps: 35, 32366 nlps: 32, 32367 switchFlag: 0 32368}, { 32369 qe: 0x02a1, 32370 nmps: 36, 32371 nlps: 33, 32372 switchFlag: 0 32373}, { 32374 qe: 0x0221, 32375 nmps: 37, 32376 nlps: 34, 32377 switchFlag: 0 32378}, { 32379 qe: 0x0141, 32380 nmps: 38, 32381 nlps: 35, 32382 switchFlag: 0 32383}, { 32384 qe: 0x0111, 32385 nmps: 39, 32386 nlps: 36, 32387 switchFlag: 0 32388}, { 32389 qe: 0x0085, 32390 nmps: 40, 32391 nlps: 37, 32392 switchFlag: 0 32393}, { 32394 qe: 0x0049, 32395 nmps: 41, 32396 nlps: 38, 32397 switchFlag: 0 32398}, { 32399 qe: 0x0025, 32400 nmps: 42, 32401 nlps: 39, 32402 switchFlag: 0 32403}, { 32404 qe: 0x0015, 32405 nmps: 43, 32406 nlps: 40, 32407 switchFlag: 0 32408}, { 32409 qe: 0x0009, 32410 nmps: 44, 32411 nlps: 41, 32412 switchFlag: 0 32413}, { 32414 qe: 0x0005, 32415 nmps: 45, 32416 nlps: 42, 32417 switchFlag: 0 32418}, { 32419 qe: 0x0001, 32420 nmps: 45, 32421 nlps: 43, 32422 switchFlag: 0 32423}, { 32424 qe: 0x5601, 32425 nmps: 46, 32426 nlps: 46, 32427 switchFlag: 0 32428}]; 32429 32430class ArithmeticDecoder { 32431 constructor(data, start, end) { 32432 this.data = data; 32433 this.bp = start; 32434 this.dataEnd = end; 32435 this.chigh = data[start]; 32436 this.clow = 0; 32437 this.byteIn(); 32438 this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f; 32439 this.clow = this.clow << 7 & 0xffff; 32440 this.ct -= 7; 32441 this.a = 0x8000; 32442 } 32443 32444 byteIn() { 32445 const data = this.data; 32446 let bp = this.bp; 32447 32448 if (data[bp] === 0xff) { 32449 if (data[bp + 1] > 0x8f) { 32450 this.clow += 0xff00; 32451 this.ct = 8; 32452 } else { 32453 bp++; 32454 this.clow += data[bp] << 9; 32455 this.ct = 7; 32456 this.bp = bp; 32457 } 32458 } else { 32459 bp++; 32460 this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00; 32461 this.ct = 8; 32462 this.bp = bp; 32463 } 32464 32465 if (this.clow > 0xffff) { 32466 this.chigh += this.clow >> 16; 32467 this.clow &= 0xffff; 32468 } 32469 } 32470 32471 readBit(contexts, pos) { 32472 let cx_index = contexts[pos] >> 1, 32473 cx_mps = contexts[pos] & 1; 32474 const qeTableIcx = QeTable[cx_index]; 32475 const qeIcx = qeTableIcx.qe; 32476 let d; 32477 let a = this.a - qeIcx; 32478 32479 if (this.chigh < qeIcx) { 32480 if (a < qeIcx) { 32481 a = qeIcx; 32482 d = cx_mps; 32483 cx_index = qeTableIcx.nmps; 32484 } else { 32485 a = qeIcx; 32486 d = 1 ^ cx_mps; 32487 32488 if (qeTableIcx.switchFlag === 1) { 32489 cx_mps = d; 32490 } 32491 32492 cx_index = qeTableIcx.nlps; 32493 } 32494 } else { 32495 this.chigh -= qeIcx; 32496 32497 if ((a & 0x8000) !== 0) { 32498 this.a = a; 32499 return cx_mps; 32500 } 32501 32502 if (a < qeIcx) { 32503 d = 1 ^ cx_mps; 32504 32505 if (qeTableIcx.switchFlag === 1) { 32506 cx_mps = d; 32507 } 32508 32509 cx_index = qeTableIcx.nlps; 32510 } else { 32511 d = cx_mps; 32512 cx_index = qeTableIcx.nmps; 32513 } 32514 } 32515 32516 do { 32517 if (this.ct === 0) { 32518 this.byteIn(); 32519 } 32520 32521 a <<= 1; 32522 this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1; 32523 this.clow = this.clow << 1 & 0xffff; 32524 this.ct--; 32525 } while ((a & 0x8000) === 0); 32526 32527 this.a = a; 32528 contexts[pos] = cx_index << 1 | cx_mps; 32529 return d; 32530 } 32531 32532} 32533 32534exports.ArithmeticDecoder = ArithmeticDecoder; 32535 32536/***/ }), 32537/* 37 */ 32538/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 32539 32540 32541 32542Object.defineProperty(exports, "__esModule", ({ 32543 value: true 32544})); 32545exports.JpegStream = void 0; 32546 32547var _decode_stream = __w_pdfjs_require__(29); 32548 32549var _primitives = __w_pdfjs_require__(5); 32550 32551var _jpg = __w_pdfjs_require__(38); 32552 32553var _util = __w_pdfjs_require__(2); 32554 32555class JpegStream extends _decode_stream.DecodeStream { 32556 constructor(stream, maybeLength, params) {
32557 let ch; 32558 32559 while ((ch = stream.getByte()) !== -1) { 32560 if (ch === 0xff) { 32561 stream.skip(-1); 32562 break; 32563 } 32564 } 32565 32566 super(maybeLength); 32567 this.stream = stream; 32568 this.dict = stream.dict; 32569 this.maybeLength = maybeLength; 32570 this.params = params; 32571 } 32572 32573 get bytes() { 32574 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 32575 } 32576 32577 ensureBuffer(requested) {} 32578 32579 readBlock() { 32580 if (this.eof) { 32581 return; 32582 } 32583 32584 const jpegOptions = { 32585 decodeTransform: undefined, 32586 colorTransform: undefined 32587 }; 32588 const decodeArr = this.dict.getArray("D", "Decode"); 32589 32590 if (this.forceRGB && Array.isArray(decodeArr)) { 32591 const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8; 32592 const decodeArrLength = decodeArr.length; 32593 const transform = new Int32Array(decodeArrLength); 32594 let transformNeeded = false; 32595 const maxValue = (1 << bitsPerComponent) - 1; 32596 32597 for (let i = 0; i < decodeArrLength; i += 2) { 32598 transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0; 32599 transform[i + 1] = decodeArr[i] * maxValue | 0; 32600 32601 if (transform[i] !== 256 || transform[i + 1] !== 0) { 32602 transformNeeded = true; 32603 } 32604 } 32605 32606 if (transformNeeded) { 32607 jpegOptions.decodeTransform = transform; 32608 } 32609 } 32610 32611 if ((0, _primitives.isDict)(this.params)) { 32612 const colorTransform = this.params.get("ColorTransform"); 32613 32614 if (Number.isInteger(colorTransform)) { 32615 jpegOptions.colorTransform = colorTransform; 32616 } 32617 } 32618 32619 const jpegImage = new _jpg.JpegImage(jpegOptions); 32620 jpegImage.parse(this.bytes); 32621 const data = jpegImage.getData({ 32622 width: this.drawWidth, 32623 height: this.drawHeight, 32624 forceRGB: this.forceRGB, 32625 isSourcePDF: true 32626 }); 32627 this.buffer = data; 32628 this.bufferLength = data.length; 32629 this.eof = true; 32630 } 32631 32632} 32633 32634exports.JpegStream = JpegStream; 32635 32636/***/ }), 32637/* 38 */ 32638/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 32639 32640 32641 32642Object.defineProperty(exports, "__esModule", ({ 32643 value: true 32644})); 32645exports.JpegImage = void 0; 32646 32647var _util = __w_pdfjs_require__(2); 32648 32649var _core_utils = __w_pdfjs_require__(9); 32650 32651class JpegError extends _util.BaseException { 32652 constructor(msg) { 32653 super(`JPEG error: ${msg}`, "JpegError"); 32654 } 32655 32656} 32657 32658class DNLMarkerError extends _util.BaseException { 32659 constructor(message, scanLines) { 32660 super(message, "DNLMarkerError"); 32661 this.scanLines = scanLines; 32662 } 32663 32664} 32665 32666class EOIMarkerError extends _util.BaseException { 32667 constructor(msg) { 32668 super(msg, "EOIMarkerError"); 32669 } 32670 32671} 32672 32673const 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]); 32674const dctCos1 = 4017; 32675const dctSin1 = 799; 32676const dctCos3 = 3406; 32677const dctSin3 = 2276; 32678const dctCos6 = 1567; 32679const dctSin6 = 3784; 32680const dctSqrt2 = 5793; 32681const dctSqrt1d2 = 2896; 32682 32683function buildHuffmanTable(codeLengths, values) { 32684 let k = 0, 32685 i, 32686 j, 32687 length = 16; 32688 32689 while (length > 0 && !codeLengths[length - 1]) { 32690 length--; 32691 } 32692 32693 const code = [{ 32694 children: [], 32695 index: 0 32696 }]; 32697 let p = code[0], 32698 q; 32699 32700 for (i = 0; i < length; i++) { 32701 for (j = 0; j < codeLengths[i]; j++) { 32702 p = code.pop(); 32703 p.children[p.index] = values[k]; 32704 32705 while (p.index > 0) { 32706 p = code.pop(); 32707 } 32708 32709 p.index++; 32710 code.push(p); 32711 32712 while (code.length <= i) { 32713 code.push(q = { 32714 children: [], 32715 index: 0 32716 }); 32717 p.children[p.index] = q.children; 32718 p = q; 32719 } 32720 32721 k++; 32722 } 32723 32724 if (i + 1 < length) { 32725 code.push(q = { 32726 children: [], 32727 index: 0 32728 }); 32729 p.children[p.index] = q.children; 32730 p = q; 32731 } 32732 } 32733 32734 return code[0].children; 32735} 32736 32737function getBlockBufferOffset(component, row, col) { 32738 return 64 * ((component.blocksPerLine + 1) * row + col); 32739} 32740 32741function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) { 32742 const mcusPerLine = frame.mcusPerLine;
vendor: 9,959 bytes, lines 32743-33146
32743 const progressive = frame.progressive; 32744 const startOffset = offset; 32745 let bitsData = 0, 32746 bitsCount = 0; 32747 32748 function readBit() { 32749 if (bitsCount > 0) { 32750 bitsCount--; 32751 return bitsData >> bitsCount & 1; 32752 } 32753 32754 bitsData = data[offset++]; 32755 32756 if (bitsData === 0xff) { 32757 const nextByte = data[offset++]; 32758 32759 if (nextByte) { 32760 if (nextByte === 0xdc && parseDNLMarker) { 32761 offset += 2; 32762 const scanLines = (0, _core_utils.readUint16)(data, offset); 32763 offset += 2; 32764 32765 if (scanLines > 0 && scanLines !== frame.scanLines) { 32766 throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines); 32767 } 32768 } else if (nextByte === 0xd9) { 32769 if (parseDNLMarker) { 32770 const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0); 32771 32772 if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) { 32773 throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines); 32774 } 32775 } 32776 32777 throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data"); 32778 } 32779 32780 throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`); 32781 } 32782 } 32783 32784 bitsCount = 7; 32785 return bitsData >>> 7; 32786 } 32787 32788 function decodeHuffman(tree) { 32789 let node = tree; 32790 32791 while (true) { 32792 node = node[readBit()]; 32793 32794 switch (typeof node) { 32795 case "number": 32796 return node; 32797 32798 case "object": 32799 continue; 32800 } 32801 32802 throw new JpegError("invalid huffman sequence"); 32803 } 32804 } 32805 32806 function receive(length) { 32807 let n = 0; 32808 32809 while (length > 0) { 32810 n = n << 1 | readBit(); 32811 length--; 32812 } 32813 32814 return n; 32815 } 32816 32817 function receiveAndExtend(length) { 32818 if (length === 1) { 32819 return readBit() === 1 ? 1 : -1; 32820 } 32821 32822 const n = receive(length); 32823 32824 if (n >= 1 << length - 1) { 32825 return n; 32826 } 32827 32828 return n + (-1 << length) + 1; 32829 } 32830 32831 function decodeBaseline(component, blockOffset) { 32832 const t = decodeHuffman(component.huffmanTableDC); 32833 const diff = t === 0 ? 0 : receiveAndExtend(t); 32834 component.blockData[blockOffset] = component.pred += diff; 32835 let k = 1; 32836 32837 while (k < 64) { 32838 const rs = decodeHuffman(component.huffmanTableAC); 32839 const s = rs & 15, 32840 r = rs >> 4; 32841 32842 if (s === 0) { 32843 if (r < 15) { 32844 break; 32845 } 32846 32847 k += 16; 32848 continue; 32849 } 32850 32851 k += r; 32852 const z = dctZigZag[k]; 32853 component.blockData[blockOffset + z] = receiveAndExtend(s); 32854 k++; 32855 } 32856 } 32857 32858 function decodeDCFirst(component, blockOffset) { 32859 const t = decodeHuffman(component.huffmanTableDC); 32860 const diff = t === 0 ? 0 : receiveAndExtend(t) << successive; 32861 component.blockData[blockOffset] = component.pred += diff; 32862 } 32863 32864 function decodeDCSuccessive(component, blockOffset) { 32865 component.blockData[blockOffset] |= readBit() << successive; 32866 } 32867 32868 let eobrun = 0; 32869 32870 function decodeACFirst(component, blockOffset) { 32871 if (eobrun > 0) { 32872 eobrun--; 32873 return; 32874 } 32875 32876 let k = spectralStart; 32877 const e = spectralEnd; 32878 32879 while (k <= e) { 32880 const rs = decodeHuffman(component.huffmanTableAC); 32881 const s = rs & 15, 32882 r = rs >> 4; 32883 32884 if (s === 0) { 32885 if (r < 15) { 32886 eobrun = receive(r) + (1 << r) - 1; 32887 break; 32888 } 32889 32890 k += 16; 32891 continue; 32892 } 32893 32894 k += r; 32895 const z = dctZigZag[k]; 32896 component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive); 32897 k++; 32898 } 32899 } 32900 32901 let successiveACState = 0, 32902 successiveACNextValue; 32903 32904 function decodeACSuccessive(component, blockOffset) { 32905 let k = spectralStart; 32906 const e = spectralEnd; 32907 let r = 0; 32908 let s; 32909 let rs; 32910 32911 while (k <= e) { 32912 const offsetZ = blockOffset + dctZigZag[k]; 32913 const sign = component.blockData[offsetZ] < 0 ? -1 : 1; 32914 32915 switch (successiveACState) { 32916 case 0: 32917 rs = decodeHuffman(component.huffmanTableAC); 32918 s = rs & 15; 32919 r = rs >> 4; 32920 32921 if (s === 0) { 32922 if (r < 15) { 32923 eobrun = receive(r) + (1 << r); 32924 successiveACState = 4; 32925 } else { 32926 r = 16; 32927 successiveACState = 1; 32928 } 32929 } else { 32930 if (s !== 1) { 32931 throw new JpegError("invalid ACn encoding"); 32932 } 32933 32934 successiveACNextValue = receiveAndExtend(s); 32935 successiveACState = r ? 2 : 3; 32936 } 32937 32938 continue; 32939 32940 case 1: 32941 case 2: 32942 if (component.blockData[offsetZ]) { 32943 component.blockData[offsetZ] += sign * (readBit() << successive); 32944 } else { 32945 r--; 32946 32947 if (r === 0) { 32948 successiveACState = successiveACState === 2 ? 3 : 0; 32949 } 32950 } 32951 32952 break; 32953 32954 case 3: 32955 if (component.blockData[offsetZ]) { 32956 component.blockData[offsetZ] += sign * (readBit() << successive); 32957 } else { 32958 component.blockData[offsetZ] = successiveACNextValue << successive; 32959 successiveACState = 0; 32960 } 32961 32962 break; 32963 32964 case 4: 32965 if (component.blockData[offsetZ]) { 32966 component.blockData[offsetZ] += sign * (readBit() << successive); 32967 } 32968 32969 break; 32970 } 32971 32972 k++; 32973 } 32974 32975 if (successiveACState === 4) { 32976 eobrun--; 32977 32978 if (eobrun === 0) { 32979 successiveACState = 0; 32980 } 32981 } 32982 } 32983 32984 let blockRow = 0; 32985 32986 function decodeMcu(component, decode, mcu, row, col) { 32987 const mcuRow = mcu / mcusPerLine | 0; 32988 const mcuCol = mcu % mcusPerLine; 32989 blockRow = mcuRow * component.v + row; 32990 const blockCol = mcuCol * component.h + col; 32991 const blockOffset = getBlockBufferOffset(component, blockRow, blockCol); 32992 decode(component, blockOffset); 32993 } 32994 32995 function decodeBlock(component, decode, mcu) { 32996 blockRow = mcu / component.blocksPerLine | 0; 32997 const blockCol = mcu % component.blocksPerLine; 32998 const blockOffset = getBlockBufferOffset(component, blockRow, blockCol); 32999 decode(component, blockOffset); 33000 } 33001 33002 const componentsLength = components.length; 33003 let component, i, j, k, n; 33004 let decodeFn; 33005 33006 if (progressive) { 33007 if (spectralStart === 0) { 33008 decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive; 33009 } else { 33010 decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive; 33011 } 33012 } else { 33013 decodeFn = decodeBaseline; 33014 } 33015 33016 let mcu = 0, 33017 fileMarker; 33018 let mcuExpected; 33019 33020 if (componentsLength === 1) { 33021 mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn; 33022 } else { 33023 mcuExpected = mcusPerLine * frame.mcusPerColumn; 33024 } 33025 33026 let h, v; 33027 33028 while (mcu <= mcuExpected) { 33029 const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected; 33030 33031 if (mcuToRead > 0) { 33032 for (i = 0; i < componentsLength; i++) { 33033 components[i].pred = 0; 33034 } 33035 33036 eobrun = 0; 33037 33038 if (componentsLength === 1) { 33039 component = components[0]; 33040 33041 for (n = 0; n < mcuToRead; n++) { 33042 decodeBlock(component, decodeFn, mcu); 33043 mcu++; 33044 } 33045 } else { 33046 for (n = 0; n < mcuToRead; n++) { 33047 for (i = 0; i < componentsLength; i++) { 33048 component = components[i]; 33049 h = component.h; 33050 v = component.v; 33051 33052 for (j = 0; j < v; j++) { 33053 for (k = 0; k < h; k++) { 33054 decodeMcu(component, decodeFn, mcu, j, k); 33055 } 33056 } 33057 } 33058 33059 mcu++; 33060 } 33061 } 33062 } 33063 33064 bitsCount = 0; 33065 fileMarker = findNextFileMarker(data, offset); 33066 33067 if (!fileMarker) { 33068 break; 33069 } 33070 33071 if (fileMarker.invalid) { 33072 const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive"; 33073 (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`); 33074 offset = fileMarker.offset; 33075 } 33076 33077 if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) { 33078 offset += 2; 33079 } else { 33080 break; 33081 } 33082 } 33083 33084 return offset - startOffset; 33085} 33086 33087function quantizeAndInverse(component, blockBufferOffset, p) { 33088 const qt = component.quantizationTable, 33089 blockData = component.blockData; 33090 let v0, v1, v2, v3, v4, v5, v6, v7; 33091 let p0, p1, p2, p3, p4, p5, p6, p7; 33092 let t; 33093 33094 if (!qt) { 33095 throw new JpegError("missing required Quantization Table."); 33096 } 33097 33098 for (let row = 0; row < 64; row += 8) { 33099 p0 = blockData[blockBufferOffset + row]; 33100 p1 = blockData[blockBufferOffset + row + 1]; 33101 p2 = blockData[blockBufferOffset + row + 2]; 33102 p3 = blockData[blockBufferOffset + row + 3]; 33103 p4 = blockData[blockBufferOffset + row + 4]; 33104 p5 = blockData[blockBufferOffset + row + 5]; 33105 p6 = blockData[blockBufferOffset + row + 6]; 33106 p7 = blockData[blockBufferOffset + row + 7]; 33107 p0 *= qt[row]; 33108 33109 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 33110 t = dctSqrt2 * p0 + 512 >> 10; 33111 p[row] = t; 33112 p[row + 1] = t; 33113 p[row + 2] = t; 33114 p[row + 3] = t; 33115 p[row + 4] = t; 33116 p[row + 5] = t; 33117 p[row + 6] = t; 33118 p[row + 7] = t; 33119 continue; 33120 } 33121 33122 p1 *= qt[row + 1]; 33123 p2 *= qt[row + 2]; 33124 p3 *= qt[row + 3]; 33125 p4 *= qt[row + 4]; 33126 p5 *= qt[row + 5]; 33127 p6 *= qt[row + 6]; 33128 p7 *= qt[row + 7]; 33129 v0 = dctSqrt2 * p0 + 128 >> 8; 33130 v1 = dctSqrt2 * p4 + 128 >> 8; 33131 v2 = p2; 33132 v3 = p6; 33133 v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8; 33134 v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8; 33135 v5 = p3 << 4; 33136 v6 = p5 << 4; 33137 v0 = v0 + v1 + 1 >> 1; 33138 v1 = v0 - v1; 33139 t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8; 33140 v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8; 33141 v3 = t; 33142 v4 = v4 + v6 + 1 >> 1; 33143 v6 = v4 - v6; 33144 v7 = v7 + v5 + 1 >> 1; 33145 v5 = v7 - v5; 33146 v0 = v0 + v3 + 1 >> 1;
vendor: 1,969 bytes, lines 33147-33219
33147 v3 = v0 - v3; 33148 v1 = v1 + v2 + 1 >> 1; 33149 v2 = v1 - v2; 33150 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12; 33151 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 33152 v7 = t; 33153 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 33154 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 33155 v6 = t; 33156 p[row] = v0 + v7; 33157 p[row + 7] = v0 - v7; 33158 p[row + 1] = v1 + v6; 33159 p[row + 6] = v1 - v6; 33160 p[row + 2] = v2 + v5; 33161 p[row + 5] = v2 - v5; 33162 p[row + 3] = v3 + v4; 33163 p[row + 4] = v3 - v4; 33164 } 33165 33166 for (let col = 0; col < 8; ++col) { 33167 p0 = p[col]; 33168 p1 = p[col + 8]; 33169 p2 = p[col + 16]; 33170 p3 = p[col + 24]; 33171 p4 = p[col + 32]; 33172 p5 = p[col + 40]; 33173 p6 = p[col + 48]; 33174 p7 = p[col + 56]; 33175 33176 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 33177 t = dctSqrt2 * p0 + 8192 >> 14; 33178 33179 if (t < -2040) { 33180 t = 0; 33181 } else if (t >= 2024) { 33182 t = 255; 33183 } else { 33184 t = t + 2056 >> 4; 33185 } 33186 33187 blockData[blockBufferOffset + col] = t; 33188 blockData[blockBufferOffset + col + 8] = t; 33189 blockData[blockBufferOffset + col + 16] = t; 33190 blockData[blockBufferOffset + col + 24] = t; 33191 blockData[blockBufferOffset + col + 32] = t; 33192 blockData[blockBufferOffset + col + 40] = t; 33193 blockData[blockBufferOffset + col + 48] = t; 33194 blockData[blockBufferOffset + col + 56] = t; 33195 continue; 33196 } 33197 33198 v0 = dctSqrt2 * p0 + 2048 >> 12; 33199 v1 = dctSqrt2 * p4 + 2048 >> 12; 33200 v2 = p2; 33201 v3 = p6; 33202 v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12; 33203 v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12; 33204 v5 = p3; 33205 v6 = p5; 33206 v0 = (v0 + v1 + 1 >> 1) + 4112; 33207 v1 = v0 - v1; 33208 t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12; 33209 v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12; 33210 v3 = t; 33211 v4 = v4 + v6 + 1 >> 1; 33212 v6 = v4 - v6; 33213 v7 = v7 + v5 + 1 >> 1; 33214 v5 = v7 - v5; 33215 v0 = v0 + v3 + 1 >> 1; 33216 v3 = v0 - v3; 33217 v1 = v1 + v2 + 1 >> 1; 33218 v2 = v1 - v2; 33219 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >>
33219 12; 33220 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 33221 v7 = t; 33222 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 33223 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 33224 v6 = t; 33225 p0 = v0 + v7; 33226 p7 = v0 - v7; 33227 p1 = v1 + v6; 33228 p6 = v1 - v6; 33229 p2 = v2 + v5; 33230 p5 = v2 - v5; 33231 p3 = v3 + v4; 33232 p4 = v3 - v4; 33233 33234 if (p0 < 16) { 33235 p0 = 0; 33236 } else if (p0 >= 4080) { 33237 p0 = 255; 33238 } else { 33239 p0 >>= 4; 33240 } 33241 33242 if (p1 < 16) { 33243 p1 = 0; 33244 } else if (p1 >= 4080) { 33245 p1 = 255; 33246 } else { 33247 p1 >>= 4; 33248 } 33249 33250 if (p2 < 16) { 33251 p2 = 0; 33252 } else if (p2 >= 4080) { 33253 p2 = 255; 33254 } else { 33255 p2 >>= 4; 33256 } 33257 33258 if (p3 < 16) { 33259 p3 = 0; 33260 } else if (p3 >= 4080) { 33261 p3 = 255; 33262 } else { 33263 p3 >>= 4; 33264 } 33265 33266 if (p4 < 16) { 33267 p4 = 0; 33268 } else if (p4 >= 4080) { 33269 p4 = 255; 33270 } else { 33271 p4 >>= 4; 33272 } 33273 33274 if (p5 < 16) { 33275 p5 = 0; 33276 } else if (p5 >= 4080) { 33277 p5 = 255; 33278 } else { 33279 p5 >>= 4; 33280 } 33281 33282 if (p6 < 16) { 33283 p6 = 0; 33284 } else if (p6 >= 4080) { 33285 p6 = 255; 33286 } else { 33287 p6 >>= 4; 33288 } 33289 33290 if (p7 < 16) { 33291 p7 = 0; 33292 } else if (p7 >= 4080) { 33293 p7 = 255; 33294 } else { 33295 p7 >>= 4; 33296 } 33297 33298 blockData[blockBufferOffset + col] = p0; 33299 blockData[blockBufferOffset + col + 8] = p1; 33300 blockData[blockBufferOffset + col + 16] = p2; 33301 blockData[blockBufferOffset + col + 24] = p3; 33302 blockData[blockBufferOffset + col + 32] = p4; 33303 blockData[blockBufferOffset + col + 40] = p5; 33304 blockData[blockBufferOffset + col + 48] = p6; 33305 blockData[blockBufferOffset + col + 56] = p7; 33306 } 33307} 33308 33309function buildComponentData(frame, component) { 33310 const blocksPerLine = component.blocksPerLine; 33311 const blocksPerColumn = component.blocksPerColumn; 33312 const computationBuffer = new Int16Array(64); 33313 33314 for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) { 33315 for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) { 33316 const offset = getBlockBufferOffset(component, blockRow, blockCol); 33317 quantizeAndInverse(component, offset, computationBuffer); 33318 } 33319 } 33320 33321 return component.blockData; 33322} 33323 33324function findNextFileMarker(data, currentPos, startPos = currentPos) { 33325 const maxPos = data.length - 1; 33326 let newPos = startPos < currentPos ? startPos : currentPos; 33327 33328 if (currentPos >= maxPos) { 33329 return null; 33330 } 33331 33332 const currentMarker = (0, _core_utils.readUint16)(data, currentPos); 33333 33334 if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) { 33335 return { 33336 invalid: null, 33337 marker: currentMarker, 33338 offset: currentPos 33339 }; 33340 } 33341 33342 let newMarker = (0, _core_utils.readUint16)(data, newPos); 33343 33344 while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) { 33345 if (++newPos >= maxPos) { 33346 return null; 33347 } 33348 33349 newMarker = (0, _core_utils.readUint16)(data, newPos); 33350 } 33351 33352 return { 33353 invalid: currentMarker.toString(16), 33354 marker: newMarker, 33355 offset: newPos 33356 }; 33357} 33358 33359class JpegImage { 33360 constructor({ 33361 decodeTransform = null, 33362 colorTransform = -1 33363 } = {}) { 33364 this._decodeTransform = decodeTransform; 33365 this._colorTransform = colorTransform; 33366 } 33367 33368 parse(data, { 33369 dnlScanLines = null 33370 } = {}) { 33371 function readDataBlock() { 33372 const length = (0, _core_utils.readUint16)(data, offset); 33373 offset += 2; 33374 let endOffset = offset + length - 2; 33375 const fileMarker = findNextFileMarker(data, endOffset, offset); 33376 33377 if (fileMarker && fileMarker.invalid) { 33378 (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid); 33379 endOffset = fileMarker.offset; 33380 } 33381 33382 const array = data.subarray(offset, endOffset); 33383 offset += array.length; 33384 return array; 33385 } 33386 33387 function prepareComponents(frame) { 33388 const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH); 33389 const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV); 33390 33391 for (let i = 0, ii = frame.components.length; i < ii; i++) { 33392 const component = frame.components[i]; 33393 const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH); 33394 const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV); 33395 const blocksPerLineForMcu = mcusPerLine * component.h; 33396 const blocksPerColumnForMcu = mcusPerColumn * component.v; 33397 const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1); 33398 component.blockData = new Int16Array(blocksBufferSize); 33399 component.blocksPerLine = blocksPerLine; 33400 component.blocksPerColumn = blocksPerColumn; 33401 } 33402 33403 frame.mcusPerLine = mcusPerLine; 33404 frame.mcusPerColumn = mcusPerColumn; 33405 } 33406 33407 let offset = 0; 33408 let jfif = null; 33409 let adobe = null; 33410 let frame, resetInterval; 33411 let numSOSMarkers = 0; 33412 const quantizationTables = []; 33413 const huffmanTablesAC = [], 33414 huffmanTablesDC = []; 33415 let fileMarker = (0, _core_utils.readUint16)(data, offset); 33416 offset += 2; 33417 33418 if (fileMarker !== 0xffd8) { 33419 throw new JpegError("SOI not found"); 33420 } 33421 33422 fileMarker = (0, _core_utils.readUint16)(data, offset); 33423 offset += 2; 33424 33425 markerLoop: while (fileMarker !== 0xffd9) { 33426 let i, j, l; 33427 33428 switch (fileMarker) { 33429 case 0xffe0: 33430 case 0xffe1: 33431 case 0xffe2: 33432 case 0xffe3: 33433 case 0xffe4: 33434 case 0xffe5: 33435 case 0xffe6: 33436 case 0xffe7: 33437 case 0xffe8: 33438 case 0xffe9: 33439 case 0xffea: 33440 case 0xffeb: 33441 case 0xffec: 33442 case 0xffed: 33443 case 0xffee: 33444 case 0xffef: 33445 case 0xfffe: 33446 const appData = readDataBlock(); 33447 33448 if (fileMarker === 0xffe0) { 33449 if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) { 33450 jfif = { 33451 version: { 33452 major: appData[5], 33453 minor: appData[6] 33454 }, 33455 densityUnits: appData[7], 33456 xDensity: appData[8] << 8 | appData[9], 33457 yDensity: appData[10] << 8 | appData[11], 33458 thumbWidth: appData[12],
vendor: 9,863 bytes, lines 33459-33770
33459 thumbHeight: appData[13], 33460 thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13]) 33461 }; 33462 } 33463 } 33464 33465 if (fileMarker === 0xffee) { 33466 if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) { 33467 adobe = { 33468 version: appData[5] << 8 | appData[6], 33469 flags0: appData[7] << 8 | appData[8], 33470 flags1: appData[9] << 8 | appData[10], 33471 transformCode: appData[11] 33472 }; 33473 } 33474 } 33475 33476 break; 33477 33478 case 0xffdb: 33479 const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset); 33480 offset += 2; 33481 const quantizationTablesEnd = quantizationTablesLength + offset - 2; 33482 let z; 33483 33484 while (offset < quantizationTablesEnd) { 33485 const quantizationTableSpec = data[offset++]; 33486 const tableData = new Uint16Array(64); 33487 33488 if (quantizationTableSpec >> 4 === 0) { 33489 for (j = 0; j < 64; j++) { 33490 z = dctZigZag[j]; 33491 tableData[z] = data[offset++]; 33492 } 33493 } else if (quantizationTableSpec >> 4 === 1) { 33494 for (j = 0; j < 64; j++) { 33495 z = dctZigZag[j]; 33496 tableData[z] = (0, _core_utils.readUint16)(data, offset); 33497 offset += 2; 33498 } 33499 } else { 33500 throw new JpegError("DQT - invalid table spec"); 33501 } 33502 33503 quantizationTables[quantizationTableSpec & 15] = tableData; 33504 } 33505 33506 break; 33507 33508 case 0xffc0: 33509 case 0xffc1: 33510 case 0xffc2: 33511 if (frame) { 33512 throw new JpegError("Only single frame JPEGs supported"); 33513 } 33514 33515 offset += 2; 33516 frame = {}; 33517 frame.extended = fileMarker === 0xffc1; 33518 frame.progressive = fileMarker === 0xffc2; 33519 frame.precision = data[offset++]; 33520 const sofScanLines = (0, _core_utils.readUint16)(data, offset); 33521 offset += 2; 33522 frame.scanLines = dnlScanLines || sofScanLines; 33523 frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset); 33524 offset += 2; 33525 frame.components = []; 33526 frame.componentIds = {}; 33527 const componentsCount = data[offset++]; 33528 let maxH = 0, 33529 maxV = 0; 33530 33531 for (i = 0; i < componentsCount; i++) { 33532 const componentId = data[offset]; 33533 const h = data[offset + 1] >> 4; 33534 const v = data[offset + 1] & 15; 33535 33536 if (maxH < h) { 33537 maxH = h; 33538 } 33539 33540 if (maxV < v) { 33541 maxV = v; 33542 } 33543 33544 const qId = data[offset + 2]; 33545 l = frame.components.push({ 33546 h, 33547 v, 33548 quantizationId: qId, 33549 quantizationTable: null 33550 }); 33551 frame.componentIds[componentId] = l - 1; 33552 offset += 3; 33553 } 33554 33555 frame.maxH = maxH; 33556 frame.maxV = maxV; 33557 prepareComponents(frame); 33558 break; 33559 33560 case 0xffc4: 33561 const huffmanLength = (0, _core_utils.readUint16)(data, offset); 33562 offset += 2; 33563 33564 for (i = 2; i < huffmanLength;) { 33565 const huffmanTableSpec = data[offset++]; 33566 const codeLengths = new Uint8Array(16); 33567 let codeLengthSum = 0; 33568 33569 for (j = 0; j < 16; j++, offset++) { 33570 codeLengthSum += codeLengths[j] = data[offset]; 33571 } 33572 33573 const huffmanValues = new Uint8Array(codeLengthSum); 33574 33575 for (j = 0; j < codeLengthSum; j++, offset++) { 33576 huffmanValues[j] = data[offset]; 33577 } 33578 33579 i += 17 + codeLengthSum; 33580 (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues); 33581 } 33582 33583 break; 33584 33585 case 0xffdd: 33586 offset += 2; 33587 resetInterval = (0, _core_utils.readUint16)(data, offset); 33588 offset += 2; 33589 break; 33590 33591 case 0xffda: 33592 const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines; 33593 offset += 2; 33594 const selectorsCount = data[offset++], 33595 components = []; 33596 33597 for (i = 0; i < selectorsCount; i++) { 33598 const index = data[offset++]; 33599 const componentIndex = frame.componentIds[index]; 33600 const component = frame.components[componentIndex]; 33601 component.index = index; 33602 const tableSpec = data[offset++]; 33603 component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4]; 33604 component.huffmanTableAC = huffmanTablesAC[tableSpec & 15]; 33605 components.push(component); 33606 } 33607 33608 const spectralStart = data[offset++], 33609 spectralEnd = data[offset++], 33610 successiveApproximation = data[offset++]; 33611 33612 try { 33613 const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker); 33614 offset += processed; 33615 } catch (ex) { 33616 if (ex instanceof DNLMarkerError) { 33617 (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`); 33618 return this.parse(data, { 33619 dnlScanLines: ex.scanLines 33620 }); 33621 } else if (ex instanceof EOIMarkerError) { 33622 (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`); 33623 break markerLoop; 33624 } 33625 33626 throw ex; 33627 } 33628 33629 break; 33630 33631 case 0xffdc: 33632 offset += 4; 33633 break; 33634 33635 case 0xffff: 33636 if (data[offset] !== 0xff) { 33637 offset--; 33638 } 33639 33640 break; 33641 33642 default: 33643 const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3); 33644 33645 if (nextFileMarker && nextFileMarker.invalid) { 33646 (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid); 33647 offset = nextFileMarker.offset; 33648 break; 33649 } 33650 33651 if (!nextFileMarker || offset >= data.length - 1) { 33652 (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9)."); 33653 break markerLoop; 33654 } 33655 33656 throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16)); 33657 } 33658 33659 fileMarker = (0, _core_utils.readUint16)(data, offset); 33660 offset += 2; 33661 } 33662 33663 this.width = frame.samplesPerLine; 33664 this.height = frame.scanLines; 33665 this.jfif = jfif; 33666 this.adobe = adobe; 33667 this.components = []; 33668 33669 for (let i = 0, ii = frame.components.length; i < ii; i++) { 33670 const component = frame.components[i]; 33671 const quantizationTable = quantizationTables[component.quantizationId]; 33672 33673 if (quantizationTable) { 33674 component.quantizationTable = quantizationTable; 33675 } 33676 33677 this.components.push({ 33678 index: component.index, 33679 output: buildComponentData(frame, component), 33680 scaleX: component.h / frame.maxH, 33681 scaleY: component.v / frame.maxV, 33682 blocksPerLine: component.blocksPerLine, 33683 blocksPerColumn: component.blocksPerColumn 33684 }); 33685 } 33686 33687 this.numComponents = this.components.length; 33688 return undefined; 33689 } 33690 33691 _getLinearizedBlockData(width, height, isSourcePDF = false) { 33692 const scaleX = this.width / width, 33693 scaleY = this.height / height; 33694 let component, componentScaleX, componentScaleY, blocksPerScanline; 33695 let x, y, i, j, k; 33696 let index; 33697 let offset = 0; 33698 let output; 33699 const numComponents = this.components.length; 33700 const dataLength = width * height * numComponents; 33701 const data = new Uint8ClampedArray(dataLength); 33702 const xScaleBlockOffset = new Uint32Array(width); 33703 const mask3LSB = 0xfffffff8; 33704 let lastComponentScaleX; 33705 33706 for (i = 0; i < numComponents; i++) { 33707 component = this.components[i]; 33708 componentScaleX = component.scaleX * scaleX; 33709 componentScaleY = component.scaleY * scaleY; 33710 offset = i; 33711 output = component.output; 33712 blocksPerScanline = component.blocksPerLine + 1 << 3; 33713 33714 if (componentScaleX !== lastComponentScaleX) { 33715 for (x = 0; x < width; x++) { 33716 j = 0 | x * componentScaleX; 33717 xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7; 33718 } 33719 33720 lastComponentScaleX = componentScaleX; 33721 } 33722 33723 for (y = 0; y < height; y++) { 33724 j = 0 | y * componentScaleY; 33725 index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3; 33726 33727 for (x = 0; x < width; x++) { 33728 data[offset] = output[index + xScaleBlockOffset[x]]; 33729 offset += numComponents; 33730 } 33731 } 33732 } 33733 33734 let transform = this._decodeTransform; 33735 33736 if (!isSourcePDF && numComponents === 4 && !transform) { 33737 transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]); 33738 } 33739 33740 if (transform) { 33741 for (i = 0; i < dataLength;) { 33742 for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) { 33743 data[i] = (data[i] * transform[k] >> 8) + transform[k + 1]; 33744 } 33745 } 33746 } 33747 33748 return data; 33749 } 33750 33751 get _isColorConversionNeeded() { 33752 if (this.adobe) { 33753 return !!this.adobe.transformCode; 33754 } 33755 33756 if (this.numComponents === 3) { 33757 if (this._colorTransform === 0) { 33758 return false; 33759 } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) { 33760 return false; 33761 } 33762 33763 return true; 33764 } 33765 33766 if (this._colorTransform === 1) { 33767 return true; 33768 } 33769 33770 return false;
33771 } 33772 33773 _convertYccToRgb(data) { 33774 let Y, Cb, Cr; 33775 33776 for (let i = 0, length = data.length; i < length; i += 3) { 33777 Y = data[i]; 33778 Cb = data[i + 1]; 33779 Cr = data[i + 2]; 33780 data[i] = Y - 179.456 + 1.402 * Cr; 33781 data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr; 33782 data[i + 2] = Y - 226.816 + 1.772 * Cb; 33783 } 33784 33785 return data; 33786 } 33787 33788 _convertYcckToRgb(data) { 33789 let Y, Cb, Cr, k; 33790 let offset = 0; 33791 33792 for (let i = 0, length = data.length; i < length; i += 4) { 33793 Y = data[i]; 33794 Cb = data[i + 1]; 33795 Cr = data[i + 2]; 33796 k = data[i + 3]; 33797 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); 33798 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); 33799 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); 33800 } 33801 33802 return data.subarray(0, offset); 33803 } 33804 33805 _convertYcckToCmyk(data) { 33806 let Y, Cb, Cr; 33807 33808 for (let i = 0, length = data.length; i < length; i += 4) { 33809 Y = data[i]; 33810 Cb = data[i + 1]; 33811 Cr = data[i + 2]; 33812 data[i] = 434.456 - Y - 1.402 * Cr; 33813 data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr; 33814 data[i + 2] = 481.816 - Y - 1.772 * Cb; 33815 } 33816 33817 return data; 33818 } 33819 33820 _convertCmykToRgb(data) {
33821 let c, m, y, k; 33822 let offset = 0; 33823 33824 for (let i = 0, length = data.length; i < length; i += 4) { 33825 c = data[i]; 33826 m = data[i + 1]; 33827 y = data[i + 2]; 33828 k = data[i + 3]; 33829 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); 33830 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); 33831 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); 33832 } 33833 33834 return data.subarray(0, offset); 33835 } 33836 33837 getData({ 33838 width, 33839 height, 33840 forceRGB = false, 33841 isSourcePDF = false 33842 }) { 33843 if (this.numComponents > 4) { 33844 throw new JpegError("Unsupported color mode"); 33845 } 33846 33847 const data = this._getLinearizedBlockData(width, height, isSourcePDF); 33848 33849 if (this.numComponents === 1 && forceRGB) { 33850 const dataLength = data.length; 33851 const rgbData = new Uint8ClampedArray(dataLength * 3); 33852 let offset = 0; 33853 33854 for (let i = 0; i < dataLength; i++) { 33855 const grayColor = data[i]; 33856 rgbData[offset++] = grayColor; 33857 rgbData[offset++] = grayColor; 33858 rgbData[offset++] = grayColor; 33859 } 33860 33861 return rgbData; 33862 } else if (this.numComponents === 3 && this._isColorConversionNeeded) { 33863 return this._convertYccToRgb(data); 33864 } else if (this.numComponents === 4) { 33865 if (this._isColorConversionNeeded) { 33866 if (forceRGB) { 33867 return this._convertYcckToRgb(data); 33868 } 33869 33870 return this._convertYcckToCmyk(data); 33871 } else if (forceRGB) { 33872 return this._convertCmykToRgb(data); 33873 } 33874 } 33875 33876 return data; 33877 } 33878 33879} 33880 33881exports.JpegImage = JpegImage; 33882 33883/***/ }), 33884/* 39 */ 33885/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 33886 33887 33888 33889Object.defineProperty(exports, "__esModule", ({ 33890 value: true 33891})); 33892exports.JpxStream = void 0; 33893 33894var _decode_stream = __w_pdfjs_require__(29); 33895 33896var _jpx = __w_pdfjs_require__(40); 33897 33898var _util = __w_pdfjs_require__(2); 33899 33900class JpxStream extends _decode_stream.DecodeStream { 33901 constructor(stream, maybeLength, params) { 33902 super(maybeLength); 33903 this.stream = stream; 33904 this.dict = stream.dict; 33905 this.maybeLength = maybeLength; 33906 this.params = params; 33907 } 33908 33909 get bytes() { 33910 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 33911 } 33912 33913 ensureBuffer(requested) {} 33914 33915 readBlock() { 33916 if (this.eof) { 33917 return; 33918 } 33919 33920 const jpxImage = new _jpx.JpxImage(); 33921 jpxImage.parse(this.bytes); 33922 const width = jpxImage.width; 33923 const height = jpxImage.height; 33924 const componentsCount = jpxImage.componentsCount; 33925 const tileCount = jpxImage.tiles.length; 33926 33927 if (tileCount === 1) { 33928 this.buffer = jpxImage.tiles[0].items; 33929 } else { 33930 const data = new Uint8ClampedArray(width * height * componentsCount); 33931 33932 for (let k = 0; k < tileCount; k++) { 33933 const tileComponents = jpxImage.tiles[k]; 33934 const tileWidth = tileComponents.width; 33935 const tileHeight = tileComponents.height; 33936 const tileLeft = tileComponents.left; 33937 const tileTop = tileComponents.top; 33938 const src = tileComponents.items; 33939 let srcPosition = 0; 33940 let dataPosition = (width * tileTop + tileLeft) * componentsCount; 33941 const imgRowSize = width * componentsCount; 33942 const tileRowSize = tileWidth * componentsCount; 33943 33944 for (let j = 0; j < tileHeight; j++) { 33945 const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize); 33946 data.set(rowBytes, dataPosition); 33947 srcPosition += tileRowSize; 33948 dataPosition += imgRowSize; 33949 } 33950 } 33951 33952 this.buffer = data; 33953 } 33954 33955 this.bufferLength = this.buffer.length; 33956 this.eof = true; 33957 } 33958 33959} 33960 33961exports.JpxStream = JpxStream; 33962 33963/***/ }), 33964/* 40 */ 33965/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 33966 33967 33968 33969Object.defineProperty(exports, "__esModule", ({ 33970 value: true 33971})); 33972exports.JpxImage = void 0; 33973 33974var _util = __w_pdfjs_require__(2); 33975 33976var _core_utils = __w_pdfjs_require__(9); 33977 33978var _arithmetic_decoder = __w_pdfjs_require__(36); 33979 33980class JpxError extends _util.BaseException { 33981 constructor(msg) { 33982 super(`JPX error: ${msg}`, "JpxError"); 33983 } 33984 33985} 33986 33987const SubbandsGainLog2 = { 33988 LL: 0, 33989 LH: 1, 33990 HL: 1, 33991 HH: 2 33992}; 33993 33994class JpxImage { 33995 constructor() { 33996 this.failOnCorruptedImage = false;
33997 } 33998 33999 parse(data) { 34000 const head = (0, _core_utils.readUint16)(data, 0); 34001 34002 if (head === 0xff4f) { 34003 this.parseCodestream(data, 0, data.length); 34004 return; 34005 } 34006 34007 const length = data.length; 34008 let position = 0; 34009 34010 while (position < length) { 34011 let headerSize = 8; 34012 let lbox = (0, _core_utils.readUint32)(data, position); 34013 const tbox = (0, _core_utils.readUint32)(data, position + 4); 34014 position += headerSize; 34015 34016 if (lbox === 1) { 34017 lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4); 34018 position += 8; 34019 headerSize += 8; 34020 } 34021 34022 if (lbox === 0) { 34023 lbox = length - position + headerSize; 34024 } 34025 34026 if (lbox < headerSize) { 34027 throw new JpxError("Invalid box field size"); 34028 } 34029 34030 const dataLength = lbox - headerSize; 34031 let jumpDataLength = true; 34032 34033 switch (tbox) { 34034 case 0x6a703268: 34035 jumpDataLength = false; 34036 break; 34037 34038 case 0x636f6c72: 34039 const method = data[position]; 34040 34041 if (method === 1) { 34042 const colorspace = (0, _core_utils.readUint32)(data, position + 3); 34043 34044 switch (colorspace) { 34045 case 16: 34046 case 17: 34047 case 18: 34048 break; 34049 34050 default: 34051 (0, _util.warn)("Unknown colorspace " + colorspace); 34052 break; 34053 } 34054 } else if (method === 2) { 34055 (0, _util.info)("ICC profile not supported"); 34056 } 34057 34058 break; 34059 34060 case 0x6a703263: 34061 this.parseCodestream(data, position, position + dataLength); 34062 break; 34063 34064 case 0x6a502020: 34065 if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) { 34066 (0, _util.warn)("Invalid JP2 signature"); 34067 } 34068 34069 break; 34070 34071 case 0x6a501a1a: 34072 case 0x66747970: 34073 case 0x72726571: 34074 case 0x72657320: 34075 case 0x69686472: 34076 break; 34077 34078 default: 34079 const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff); 34080 (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`); 34081 break; 34082 } 34083 34084 if (jumpDataLength) { 34085 position += dataLength; 34086 } 34087 } 34088 } 34089 34090 parseImageProperties(stream) { 34091 let newByte = stream.getByte(); 34092 34093 while (newByte >= 0) { 34094 const oldByte = newByte; 34095 newByte = stream.getByte(); 34096 const code = oldByte << 8 | newByte; 34097 34098 if (code === 0xff51) { 34099 stream.skip(4); 34100 const Xsiz = stream.getInt32() >>> 0; 34101 const Ysiz = stream.getInt32() >>> 0; 34102 const XOsiz = stream.getInt32() >>> 0; 34103 const YOsiz = stream.getInt32() >>> 0; 34104 stream.skip(16); 34105 const Csiz = stream.getUint16(); 34106 this.width = Xsiz - XOsiz; 34107 this.height = Ysiz - YOsiz; 34108 this.componentsCount = Csiz; 34109 this.bitsPerComponent = 8; 34110 return; 34111 } 34112 } 34113 34114 throw new JpxError("No size marker found in JPX stream"); 34115 } 34116 34117 parseCodestream(data, start, end) { 34118 const context = {}; 34119 let doNotRecover = false; 34120 34121 try { 34122 let position = start; 34123 34124 while (position + 1 < end) { 34125 const code = (0, _core_utils.readUint16)(data, position); 34126 position += 2; 34127 let length = 0, 34128 j, 34129 sqcd, 34130 spqcds, 34131 spqcdSize, 34132 scalarExpounded, 34133 tile; 34134 34135 switch (code) { 34136 case 0xff4f: 34137 context.mainHeader = true; 34138 break; 34139 34140 case 0xffd9: 34141 break; 34142 34143 case 0xff51: 34144 length = (0, _core_utils.readUint16)(data, position); 34145 const siz = {}; 34146 siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4); 34147 siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8); 34148 siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12); 34149 siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16); 34150 siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20); 34151 siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24); 34152 siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28); 34153 siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32); 34154 const componentsCount = (0, _core_utils.readUint16)(data, position + 36); 34155 siz.Csiz = componentsCount; 34156 const components = []; 34157 j = position + 38; 34158 34159 for (let i = 0; i < componentsCount; i++) { 34160 const component = { 34161 precision: (data[j] & 0x7f) + 1, 34162 isSigned: !!(data[j] & 0x80), 34163 XRsiz: data[j + 1], 34164 YRsiz: data[j + 2] 34165 }; 34166 j += 3; 34167 calculateComponentDimensions(component, siz); 34168 components.push(component); 34169 } 34170 34171 context.SIZ = siz; 34172 context.components = components; 34173 calculateTileGrids(context, components); 34174 context.QCC = []; 34175 context.COC = []; 34176 break; 34177 34178 case 0xff5c: 34179 length = (0, _core_utils.readUint16)(data, position); 34180 const qcd = {}; 34181 j = position + 2; 34182 sqcd = data[j++]; 34183 34184 switch (sqcd & 0x1f) { 34185 case 0: 34186 spqcdSize = 8; 34187 scalarExpounded = true; 34188 break; 34189 34190 case 1: 34191 spqcdSize = 16; 34192 scalarExpounded = false;
34193 break; 34194 34195 case 2: 34196 spqcdSize = 16; 34197 scalarExpounded = true; 34198 break; 34199 34200 default: 34201 throw new Error("Invalid SQcd value " + sqcd); 34202 } 34203 34204 qcd.noQuantization = spqcdSize === 8; 34205 qcd.scalarExpounded = scalarExpounded; 34206 qcd.guardBits = sqcd >> 5; 34207 spqcds = []; 34208 34209 while (j < length + position) { 34210 const spqcd = {}; 34211 34212 if (spqcdSize === 8) { 34213 spqcd.epsilon = data[j++] >> 3; 34214 spqcd.mu = 0; 34215 } else { 34216 spqcd.epsilon = data[j] >> 3; 34217 spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1]; 34218 j += 2; 34219 } 34220 34221 spqcds.push(spqcd); 34222 } 34223 34224 qcd.SPqcds = spqcds; 34225 34226 if (context.mainHeader) { 34227 context.QCD = qcd; 34228 } else { 34229 context.currentTile.QCD = qcd; 34230 context.currentTile.QCC = []; 34231 } 34232 34233 break; 34234 34235 case 0xff5d: 34236 length = (0, _core_utils.readUint16)(data, position); 34237 const qcc = {}; 34238 j = position + 2; 34239 let cqcc; 34240 34241 if (context.SIZ.Csiz < 257) { 34242 cqcc = data[j++]; 34243 } else { 34244 cqcc = (0, _core_utils.readUint16)(data, j); 34245 j += 2; 34246 } 34247 34248 sqcd = data[j++]; 34249 34250 switch (sqcd & 0x1f) { 34251 case 0: 34252 spqcdSize = 8; 34253 scalarExpounded = true; 34254 break; 34255 34256 case 1: 34257 spqcdSize = 16; 34258 scalarExpounded = false; 34259 break; 34260 34261 case 2: 34262 spqcdSize = 16; 34263 scalarExpounded = true; 34264 break; 34265 34266 default: 34267 throw new Error("Invalid SQcd value " + sqcd); 34268 } 34269 34270 qcc.noQuantization = spqcdSize === 8; 34271 qcc.scalarExpounded = scalarExpounded; 34272 qcc.guardBits = sqcd >> 5; 34273 spqcds = []; 34274 34275 while (j < length + position) { 34276 const spqcd = {}; 34277 34278 if (spqcdSize === 8) { 34279 spqcd.epsilon = data[j++] >> 3; 34280 spqcd.mu = 0; 34281 } else { 34282 spqcd.epsilon = data[j] >> 3; 34283 spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1]; 34284 j += 2; 34285 } 34286 34287 spqcds.push(spqcd); 34288 } 34289 34290 qcc.SPqcds = spqcds; 34291 34292 if (context.mainHeader) { 34293 context.QCC[cqcc] = qcc; 34294 } else { 34295 context.currentTile.QCC[cqcc] = qcc; 34296 } 34297 34298 break; 34299 34300 case 0xff52: 34301 length = (0, _core_utils.readUint16)(data, position); 34302 const cod = {}; 34303 j = position + 2; 34304 const scod = data[j++]; 34305 cod.entropyCoderWithCustomPrecincts = !!(scod & 1); 34306 cod.sopMarkerUsed = !!(scod & 2); 34307 cod.ephMarkerUsed = !!(scod & 4); 34308 cod.progressionOrder = data[j++]; 34309 cod.layersCount = (0, _core_utils.readUint16)(data, j); 34310 j += 2; 34311 cod.multipleComponentTransform = data[j++]; 34312 cod.decompositionLevelsCount = data[j++]; 34313 cod.xcb = (data[j++] & 0xf) + 2; 34314 cod.ycb = (data[j++] & 0xf) + 2; 34315 const blockStyle = data[j++]; 34316 cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1); 34317 cod.resetContextProbabilities = !!(blockStyle & 2); 34318 cod.terminationOnEachCodingPass = !!(blockStyle & 4); 34319 cod.verticallyStripe = !!(blockStyle & 8); 34320 cod.predictableTermination = !!(blockStyle & 16); 34321 cod.segmentationSymbolUsed = !!(blockStyle & 32); 34322 cod.reversibleTransformation = data[j++]; 34323 34324 if (cod.entropyCoderWithCustomPrecincts) { 34325 const precinctsSizes = []; 34326 34327 while (j < length + position) { 34328 const precinctsSize = data[j++]; 34329 precinctsSizes.push({ 34330 PPx: precinctsSize & 0xf, 34331 PPy: precinctsSize >> 4 34332 }); 34333 } 34334 34335 cod.precinctsSizes = precinctsSizes; 34336 } 34337 34338 const unsupported = []; 34339 34340 if (cod.selectiveArithmeticCodingBypass) { 34341 unsupported.push("selectiveArithmeticCodingBypass"); 34342 } 34343 34344 if (cod.resetContextProbabilities) { 34345 unsupported.push("resetContextProbabilities"); 34346 } 34347 34348 if (cod.terminationOnEachCodingPass) { 34349 unsupported.push("terminationOnEachCodingPass"); 34350 } 34351 34352 if (cod.verticallyStripe) { 34353 unsupported.push("verticallyStripe"); 34354 } 34355 34356 if (cod.predictableTermination) { 34357 unsupported.push("predictableTermination"); 34358 } 34359 34360 if (unsupported.length > 0) { 34361 doNotRecover = true; 34362 (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`); 34363 } 34364 34365 if (context.mainHeader) { 34366 context.COD = cod; 34367 } else { 34368 context.currentTile.COD = cod; 34369 context.currentTile.COC = []; 34370 } 34371 34372 break; 34373 34374 case 0xff90: 34375 length = (0, _core_utils.readUint16)(data, position); 34376 tile = {}; 34377 tile.index = (0, _core_utils.readUint16)(data, position + 2); 34378 tile.length = (0, _core_utils.readUint32)(data, position + 4); 34379 tile.dataEnd = tile.length + position - 2; 34380 tile.partIndex = data[position + 8]; 34381 tile.partsCount = data[position + 9]; 34382 context.mainHeader = false;
34383 34384 if (tile.partIndex === 0) { 34385 tile.COD = context.COD; 34386 tile.COC = context.COC.slice(0); 34387 tile.QCD = context.QCD; 34388 tile.QCC = context.QCC.slice(0); 34389 } 34390 34391 context.currentTile = tile; 34392 break; 34393 34394 case 0xff93: 34395 tile = context.currentTile; 34396 34397 if (tile.partIndex === 0) { 34398 initializeTile(context, tile.index); 34399 buildPackets(context); 34400 } 34401 34402 length = tile.dataEnd - position; 34403 parseTilePackets(context, data, position, length); 34404 break; 34405 34406 case 0xff53: 34407 (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented."); 34408 34409 case 0xff55: 34410 case 0xff57: 34411 case 0xff58: 34412 case 0xff64: 34413 length = (0, _core_utils.readUint16)(data, position); 34414 break; 34415 34416 default: 34417 throw new Error("Unknown codestream code: " + code.toString(16)); 34418 } 34419 34420 position += length; 34421 } 34422 } catch (e) { 34423 if (doNotRecover || this.failOnCorruptedImage) { 34424 throw new JpxError(e.message); 34425 } else { 34426 (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`); 34427 } 34428 } 34429 34430 this.tiles = transformComponents(context); 34431 this.width = context.SIZ.Xsiz - context.SIZ.XOsiz; 34432 this.height = context.SIZ.Ysiz - context.SIZ.YOsiz; 34433 this.componentsCount = context.SIZ.Csiz; 34434 } 34435 34436} 34437 34438exports.JpxImage = JpxImage; 34439 34440function calculateComponentDimensions(component, siz) { 34441 component.x0 = Math.ceil(siz.XOsiz / component.XRsiz); 34442 component.x1 = Math.ceil(siz.Xsiz / component.XRsiz); 34443 component.y0 = Math.ceil(siz.YOsiz / component.YRsiz); 34444 component.y1 = Math.ceil(siz.Ysiz / component.YRsiz); 34445 component.width = component.x1 - component.x0; 34446 component.height = component.y1 - component.y0; 34447} 34448 34449function calculateTileGrids(context, components) { 34450 const siz = context.SIZ; 34451 const tiles = []; 34452 let tile; 34453 const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz); 34454 const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz); 34455 34456 for (let q = 0; q < numYtiles; q++) { 34457 for (let p = 0; p < numXtiles; p++) { 34458 tile = {}; 34459 tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz); 34460 tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz); 34461 tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz); 34462 tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz); 34463 tile.width = tile.tx1 - tile.tx0; 34464 tile.height = tile.ty1 - tile.ty0; 34465 tile.components = []; 34466 tiles.push(tile); 34467 } 34468 } 34469 34470 context.tiles = tiles; 34471 const componentsCount = siz.Csiz; 34472 34473 for (let i = 0, ii = componentsCount; i < ii; i++) { 34474 const component = components[i]; 34475 34476 for (let j = 0, jj = tiles.length; j < jj; j++) { 34477 const tileComponent = {}; 34478 tile = tiles[j]; 34479 tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz); 34480 tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz); 34481 tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz); 34482 tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz); 34483 tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0; 34484 tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0; 34485 tile.components[i] = tileComponent; 34486 } 34487 } 34488} 34489 34490function getBlocksDimensions(context, component, r) { 34491 const codOrCoc = component.codingStyleParameters; 34492 const result = {}; 34493 34494 if (!codOrCoc.entropyCoderWithCustomPrecincts) { 34495 result.PPx = 15; 34496 result.PPy = 15; 34497 } else { 34498 result.PPx = codOrCoc.precinctsSizes[r].PPx; 34499 result.PPy = codOrCoc.precinctsSizes[r].PPy; 34500 } 34501 34502 result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx); 34503 result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy); 34504 return result; 34505} 34506 34507function buildPrecincts(context, resolution, dimensions) { 34508 const precinctWidth = 1 << dimensions.PPx; 34509 const precinctHeight = 1 << dimensions.PPy; 34510 const isZeroRes = resolution.resLevel === 0; 34511 const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1); 34512 const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1); 34513 const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0; 34514 const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0; 34515 const numprecincts = numprecinctswide * numprecinctshigh; 34516 resolution.precinctParameters = { 34517 precinctWidth, 34518 precinctHeight, 34519 numprecinctswide, 34520 numprecinctshigh, 34521 numprecincts, 34522 precinctWidthInSubband, 34523 precinctHeightInSubband 34524 }; 34525} 34526 34527function buildCodeblocks(context, subband, dimensions) { 34528 const xcb_ = dimensions.xcb_; 34529 const ycb_ = dimensions.ycb_; 34530 const codeblockWidth = 1 << xcb_; 34531 const codeblockHeight = 1 << ycb_; 34532 const cbx0 = subband.tbx0 >> xcb_; 34533 const cby0 = subband.tby0 >> ycb_; 34534 const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_; 34535 const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_; 34536 const precinctParameters = subband.resolution.precinctParameters; 34537 const codeblocks = []; 34538 const precincts = []; 34539 let i, j, codeblock, precinctNumber; 34540 34541 for (j = cby0; j < cby1; j++) { 34542 for (i = cbx0; i < cbx1; i++) { 34543 codeblock = { 34544 cbx: i, 34545 cby: j, 34546 tbx0: codeblockWidth * i, 34547 tby0: codeblockHeight * j, 34548 tbx1: codeblockWidth * (i + 1), 34549 tby1: codeblockHeight * (j + 1) 34550 }; 34551 codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0); 34552 codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0); 34553 codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1); 34554 codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1); 34555 const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband); 34556 const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband); 34557 precinctNumber = pi + pj * precinctParameters.numprecinctswide; 34558 codeblock.precinctNumber = precinctNumber; 34559 codeblock.subbandType = subband.type; 34560 codeblock.Lblock = 3; 34561 34562 if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) { 34563 continue; 34564 } 34565 34566 codeblocks.push(codeblock); 34567 let precinct = precincts[precinctNumber]; 34568 34569 if (precinct !== undefined) { 34570 if (i < precinct.cbxMin) { 34571 precinct.cbxMin = i; 34572 } else if (i > precinct.cbxMax) { 34573 precinct.cbxMax = i; 34574 } 34575 34576 if (j < precinct.cbyMin) { 34577 precinct.cbxMin = j; 34578 } else if (j >
34578 precinct.cbyMax) { 34579 precinct.cbyMax = j; 34580 } 34581 } else { 34582 precincts[precinctNumber] = precinct = { 34583 cbxMin: i, 34584 cbyMin: j, 34585 cbxMax: i, 34586 cbyMax: j 34587 }; 34588 } 34589 34590 codeblock.precinct = precinct; 34591 } 34592 } 34593 34594 subband.codeblockParameters = { 34595 codeblockWidth: xcb_, 34596 codeblockHeight: ycb_, 34597 numcodeblockwide: cbx1 - cbx0 + 1, 34598 numcodeblockhigh: cby1 - cby0 + 1 34599 }; 34600 subband.codeblocks = codeblocks; 34601 subband.precincts = precincts; 34602} 34603 34604function createPacket(resolution, precinctNumber, layerNumber) { 34605 const precinctCodeblocks = []; 34606 const subbands = resolution.subbands; 34607 34608 for (let i = 0, ii = subbands.length; i < ii; i++) { 34609 const subband = subbands[i]; 34610 const codeblocks = subband.codeblocks; 34611 34612 for (let j = 0, jj = codeblocks.length; j < jj; j++) { 34613 const codeblock = codeblocks[j]; 34614 34615 if (codeblock.precinctNumber !== precinctNumber) { 34616 continue; 34617 } 34618 34619 precinctCodeblocks.push(codeblock); 34620 } 34621 } 34622 34623 return { 34624 layerNumber, 34625 codeblocks: precinctCodeblocks 34626 }; 34627} 34628 34629function LayerResolutionComponentPositionIterator(context) { 34630 const siz = context.SIZ; 34631 const tileIndex = context.currentTile.index; 34632 const tile = context.tiles[tileIndex]; 34633 const layersCount = tile.codingStyleDefaultParameters.layersCount; 34634 const componentsCount = siz.Csiz; 34635 let maxDecompositionLevelsCount = 0; 34636 34637 for (let q = 0; q < componentsCount; q++) { 34638 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount); 34639 } 34640 34641 let l = 0, 34642 r = 0, 34643 i = 0, 34644 k = 0; 34645 34646 this.nextPacket = function JpxImage_nextPacket() { 34647 for (; l < layersCount; l++) { 34648 for (; r <= maxDecompositionLevelsCount; r++) { 34649 for (; i < componentsCount; i++) { 34650 const component = tile.components[i]; 34651 34652 if (r > component.codingStyleParameters.decompositionLevelsCount) { 34653 continue; 34654 } 34655 34656 const resolution = component.resolutions[r]; 34657 const numprecincts = resolution.precinctParameters.numprecincts; 34658 34659 for (; k < numprecincts;) { 34660 const packet = createPacket(resolution, k, l); 34661 k++; 34662 return packet; 34663 } 34664 34665 k = 0; 34666 } 34667 34668 i = 0; 34669 } 34670 34671 r = 0; 34672 } 34673 34674 throw new JpxError("Out of packets"); 34675 }; 34676} 34677 34678function ResolutionLayerComponentPositionIterator(context) { 34679 const siz = context.SIZ; 34680 const tileIndex = context.currentTile.index; 34681 const tile = context.tiles[tileIndex]; 34682 const layersCount = tile.codingStyleDefaultParameters.layersCount; 34683 const componentsCount = siz.Csiz; 34684 let maxDecompositionLevelsCount = 0; 34685 34686 for (let q = 0; q < componentsCount; q++) { 34687 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount); 34688 } 34689 34690 let r = 0, 34691 l = 0, 34692 i = 0, 34693 k = 0; 34694 34695 this.nextPacket = function JpxImage_nextPacket() { 34696 for (; r <= maxDecompositionLevelsCount; r++) { 34697 for (; l < layersCount; l++) { 34698 for (; i < componentsCount; i++) { 34699 const component = tile.components[i]; 34700 34701 if (r > component.codingStyleParameters.decompositionLevelsCount) { 34702 continue; 34703 } 34704 34705 const resolution = component.resolutions[r]; 34706 const numprecincts = resolution.precinctParameters.numprecincts; 34707 34708 for (; k < numprecincts;) { 34709 const packet = createPacket(resolution, k, l); 34710 k++; 34711 return packet; 34712 } 34713 34714 k = 0; 34715 } 34716 34717 i = 0; 34718 } 34719 34720 l = 0; 34721 } 34722 34723 throw new JpxError("Out of packets"); 34724 }; 34725} 34726 34727function ResolutionPositionComponentLayerIterator(context) { 34728 const siz = context.SIZ; 34729 const tileIndex = context.currentTile.index; 34730 const tile = context.tiles[tileIndex]; 34731 const layersCount = tile.codingStyleDefaultParameters.layersCount; 34732 const componentsCount = siz.Csiz; 34733 let l, r, c, p; 34734 let maxDecompositionLevelsCount = 0; 34735 34736 for (c = 0; c < componentsCount; c++) { 34737 const component = tile.components[c]; 34738 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount); 34739 } 34740 34741 const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1); 34742 34743 for (r = 0; r <= maxDecompositionLevelsCount; ++r) { 34744 let maxNumPrecincts = 0; 34745 34746 for (c = 0; c < componentsCount; ++c) { 34747 const resolutions = tile.components[c].resolutions; 34748 34749 if (r < resolutions.length) { 34750 maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts); 34751 } 34752 } 34753 34754 maxNumPrecinctsInLevel[r] = maxNumPrecincts; 34755 } 34756 34757 l = 0; 34758 r = 0; 34759 c = 0; 34760 p = 0; 34761 34762 this.nextPacket = function JpxImage_nextPacket() { 34763 for (; r <= maxDecompositionLevelsCount; r++) { 34764 for (; p < maxNumPrecinctsInLevel[r]; p++) { 34765 for (; c < componentsCount; c++) { 34766 const component = tile.components[c]; 34767 34768 if (r > component.codingStyleParameters.decompositionLevelsCount) { 34769 continue; 34770 } 34771 34772 const resolution = component.resolutions[r]; 34773 const numprecincts = resolution.precinctParameters.numprecincts; 34774 34775 if (p >= numprecincts) { 34776 continue; 34777 } 34778 34779 for (; l < layersCount;) { 34780 const packet = createPacket(resolution, p, l); 34781 l++; 34782 return packet; 34783 } 34784 34785 l = 0; 34786 } 34787 34788 c = 0; 34789 } 34790 34791 p = 0; 34792 } 34793 34794 throw new JpxError("Out of packets"); 34795 }; 34796} 34797 34798function PositionComponentResolutionLayerIterator(context) { 34799 const siz = context.SIZ; 34800 const tileIndex = context.currentTile.index; 34801 const tile = context.tiles[tileIndex]; 34802 const layersCount = tile.codingStyleDefaultParameters.layersCount; 34803 const componentsCount = siz.Csiz; 34804 const precinctsSizes = getPrecinctSizesInImageScale(tile); 34805 const precinctsIterationSizes = precinctsSizes; 34806 let l = 0, 34807 r = 0, 34808 c = 0, 34809 px = 0, 34810 py = 0; 34811 34812 this.nextPacket = function JpxImage_nextPacket() { 34813 for (; py < precinctsIterationSizes.maxNumHigh; py++) { 34814 for (; px < precinctsIterationSizes.maxNumWide; px++) { 34815 for (; c < componentsCount; c++) { 34816 const component = tile.components[c]; 34817 const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 34818 34819 for (; r <= decompositionLevelsCount; r++) { 34820 const resolution = component.resolutions[r]; 34821 const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
34822 const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution); 34823 34824 if (k === null) { 34825 continue; 34826 } 34827 34828 for (; l < layersCount;) { 34829 const packet = createPacket(resolution, k, l); 34830 l++; 34831 return packet; 34832 } 34833 34834 l = 0; 34835 } 34836 34837 r = 0; 34838 } 34839 34840 c = 0; 34841 } 34842 34843 px = 0; 34844 } 34845 34846 throw new JpxError("Out of packets"); 34847 }; 34848} 34849 34850function ComponentPositionResolutionLayerIterator(context) { 34851 const siz = context.SIZ; 34852 const tileIndex = context.currentTile.index; 34853 const tile = context.tiles[tileIndex]; 34854 const layersCount = tile.codingStyleDefaultParameters.layersCount; 34855 const componentsCount = siz.Csiz; 34856 const precinctsSizes = getPrecinctSizesInImageScale(tile); 34857 let l = 0, 34858 r = 0, 34859 c = 0, 34860 px = 0, 34861 py = 0; 34862 34863 this.nextPacket = function JpxImage_nextPacket() { 34864 for (; c < componentsCount; ++c) { 34865 const component = tile.components[c]; 34866 const precinctsIterationSizes = precinctsSizes.components[c]; 34867 const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 34868 34869 for (; py < precinctsIterationSizes.maxNumHigh; py++) { 34870 for (; px < precinctsIterationSizes.maxNumWide; px++) { 34871 for (; r <= decompositionLevelsCount; r++) { 34872 const resolution = component.resolutions[r]; 34873 const sizeInImageScale = precinctsIterationSizes.resolutions[r]; 34874 const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution); 34875 34876 if (k === null) { 34877 continue; 34878 } 34879 34880 for (; l < layersCount;) { 34881 const packet = createPacket(resolution, k, l); 34882 l++; 34883 return packet; 34884 } 34885 34886 l = 0; 34887 } 34888 34889 r = 0; 34890 } 34891 34892 px = 0; 34893 } 34894 34895 py = 0; 34896 } 34897 34898 throw new JpxError("Out of packets"); 34899 }; 34900} 34901 34902function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) { 34903 const posX = pxIndex * precinctIterationSizes.minWidth; 34904 const posY = pyIndex * precinctIterationSizes.minHeight; 34905 34906 if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) { 34907 return null; 34908 } 34909 34910 const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide; 34911 return posX / sizeInImageScale.height + startPrecinctRowIndex; 34912} 34913 34914function getPrecinctSizesInImageScale(tile) { 34915 const componentsCount = tile.components.length; 34916 let minWidth = Number.MAX_VALUE; 34917 let minHeight = Number.MAX_VALUE; 34918 let maxNumWide = 0; 34919 let maxNumHigh = 0; 34920 const sizePerComponent = new Array(componentsCount); 34921 34922 for (let c = 0; c < componentsCount; c++) { 34923 const component = tile.components[c]; 34924 const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 34925 const sizePerResolution = new Array(decompositionLevelsCount + 1); 34926 let minWidthCurrentComponent = Number.MAX_VALUE; 34927 let minHeightCurrentComponent = Number.MAX_VALUE; 34928 let maxNumWideCurrentComponent = 0; 34929 let maxNumHighCurrentComponent = 0; 34930 let scale = 1; 34931 34932 for (let r = decompositionLevelsCount; r >= 0; --r) { 34933 const resolution = component.resolutions[r]; 34934 const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth; 34935 const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight; 34936 minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution); 34937 minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution); 34938 maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide); 34939 maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh); 34940 sizePerResolution[r] = { 34941 width: widthCurrentResolution, 34942 height: heightCurrentResolution 34943 }; 34944 scale <<= 1; 34945 } 34946 34947 minWidth = Math.min(minWidth, minWidthCurrentComponent); 34948 minHeight = Math.min(minHeight, minHeightCurrentComponent); 34949 maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent); 34950 maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent); 34951 sizePerComponent[c] = { 34952 resolutions: sizePerResolution, 34953 minWidth: minWidthCurrentComponent, 34954 minHeight: minHeightCurrentComponent, 34955 maxNumWide: maxNumWideCurrentComponent, 34956 maxNumHigh: maxNumHighCurrentComponent 34957 }; 34958 } 34959 34960 return { 34961 components: sizePerComponent, 34962 minWidth, 34963 minHeight, 34964 maxNumWide, 34965 maxNumHigh 34966 }; 34967} 34968 34969function buildPackets(context) { 34970 const siz = context.SIZ; 34971 const tileIndex = context.currentTile.index; 34972 const tile = context.tiles[tileIndex]; 34973 const componentsCount = siz.Csiz; 34974 34975 for (let c = 0; c < componentsCount; c++) { 34976 const component = tile.components[c]; 34977 const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 34978 const resolutions = []; 34979 const subbands = []; 34980 34981 for (let r = 0; r <= decompositionLevelsCount; r++) { 34982 const blocksDimensions = getBlocksDimensions(context, component, r); 34983 const resolution = {}; 34984 const scale = 1 << decompositionLevelsCount - r;
34985 resolution.trx0 = Math.ceil(component.tcx0 / scale); 34986 resolution.try0 = Math.ceil(component.tcy0 / scale); 34987 resolution.trx1 = Math.ceil(component.tcx1 / scale); 34988 resolution.try1 = Math.ceil(component.tcy1 / scale); 34989 resolution.resLevel = r; 34990 buildPrecincts(context, resolution, blocksDimensions); 34991 resolutions.push(resolution); 34992 let subband; 34993 34994 if (r === 0) { 34995 subband = {}; 34996 subband.type = "LL"; 34997 subband.tbx0 = Math.ceil(component.tcx0 / scale); 34998 subband.tby0 = Math.ceil(component.tcy0 / scale); 34999 subband.tbx1 = Math.ceil(component.tcx1 / scale); 35000 subband.tby1 = Math.ceil(component.tcy1 / scale); 35001 subband.resolution = resolution; 35002 buildCodeblocks(context, subband, blocksDimensions); 35003 subbands.push(subband); 35004 resolution.subbands = [subband]; 35005 } else { 35006 const bscale = 1 << decompositionLevelsCount - r + 1; 35007 const resolutionSubbands = []; 35008 subband = {}; 35009 subband.type = "HL"; 35010 subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); 35011 subband.tby0 = Math.ceil(component.tcy0 / bscale); 35012 subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); 35013 subband.tby1 = Math.ceil(component.tcy1 / bscale); 35014 subband.resolution = resolution; 35015 buildCodeblocks(context, subband, blocksDimensions); 35016 subbands.push(subband); 35017 resolutionSubbands.push(subband); 35018 subband = {}; 35019 subband.type = "LH"; 35020 subband.tbx0 = Math.ceil(component.tcx0 / bscale); 35021 subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); 35022 subband.tbx1 = Math.ceil(component.tcx1 / bscale); 35023 subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); 35024 subband.resolution = resolution; 35025 buildCodeblocks(context, subband, blocksDimensions); 35026 subbands.push(subband); 35027 resolutionSubbands.push(subband); 35028 subband = {}; 35029 subband.type = "HH"; 35030 subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); 35031 subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); 35032 subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); 35033 subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); 35034 subband.resolution = resolution; 35035 buildCodeblocks(context, subband, blocksDimensions); 35036 subbands.push(subband); 35037 resolutionSubbands.push(subband); 35038 resolution.subbands = resolutionSubbands; 35039 } 35040 } 35041 35042 component.resolutions = resolutions; 35043 component.subbands = subbands; 35044 } 35045 35046 const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder; 35047 35048 switch (progressionOrder) { 35049 case 0: 35050 tile.packetsIterator = new LayerResolutionComponentPositionIterator(context); 35051 break; 35052 35053 case 1: 35054 tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context); 35055 break; 35056 35057 case 2: 35058 tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context); 35059 break; 35060 35061 case 3: 35062 tile.packetsIterator = new PositionComponentResolutionLayerIterator(context); 35063 break; 35064 35065 case 4: 35066 tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context); 35067 break; 35068 35069 default: 35070 throw new JpxError(`Unsupported progression order ${progressionOrder}`); 35071 } 35072} 35073 35074function parseTilePackets(context, data, offset, dataLength) { 35075 let position = 0; 35076 let buffer, 35077 bufferSize = 0, 35078 skipNextBit = false; 35079 35080 function readBits(count) { 35081 while (bufferSize < count) { 35082 const b = data[offset + position]; 35083 position++; 35084 35085 if (skipNextBit) { 35086 buffer = buffer << 7 | b; 35087 bufferSize += 7; 35088 skipNextBit = false; 35089 } else { 35090 buffer = buffer << 8 | b; 35091 bufferSize += 8; 35092 } 35093 35094 if (b === 0xff) { 35095 skipNextBit = true; 35096 } 35097 } 35098 35099 bufferSize -= count; 35100 return buffer >>> bufferSize & (1 << count) - 1; 35101 } 35102 35103 function skipMarkerIfEqual(value) { 35104 if (data[offset + position - 1] === 0xff && data[offset + position] === value) { 35105 skipBytes(1); 35106 return true; 35107 } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) { 35108 skipBytes(2); 35109 return true; 35110 } 35111 35112 return false;
35113 } 35114 35115 function skipBytes(count) { 35116 position += count; 35117 } 35118 35119 function alignToByte() { 35120 bufferSize = 0; 35121 35122 if (skipNextBit) { 35123 position++; 35124 skipNextBit = false; 35125 } 35126 } 35127 35128 function readCodingpasses() { 35129 if (readBits(1) === 0) { 35130 return 1; 35131 } 35132 35133 if (readBits(1) === 0) { 35134 return 2; 35135 } 35136 35137 let value = readBits(2); 35138 35139 if (value < 3) { 35140 return value + 3; 35141 } 35142 35143 value = readBits(5); 35144 35145 if (value < 31) { 35146 return value + 6; 35147 } 35148 35149 value = readBits(7); 35150 return value + 37; 35151 } 35152 35153 const tileIndex = context.currentTile.index; 35154 const tile = context.tiles[tileIndex]; 35155 const sopMarkerUsed = context.COD.sopMarkerUsed; 35156 const ephMarkerUsed = context.COD.ephMarkerUsed; 35157 const packetsIterator = tile.packetsIterator; 35158 35159 while (position < dataLength) { 35160 alignToByte(); 35161 35162 if (sopMarkerUsed && skipMarkerIfEqual(0x91)) { 35163 skipBytes(4); 35164 } 35165 35166 const packet = packetsIterator.nextPacket(); 35167 35168 if (!readBits(1)) { 35169 continue; 35170 } 35171 35172 const layerNumber = packet.layerNumber, 35173 queue = []; 35174 let codeblock; 35175 35176 for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) { 35177 codeblock = packet.codeblocks[i]; 35178 let precinct = codeblock.precinct; 35179 const codeblockColumn = codeblock.cbx - precinct.cbxMin; 35180 const codeblockRow = codeblock.cby - precinct.cbyMin; 35181 let codeblockIncluded = false; 35182 let firstTimeInclusion = false; 35183 let valueReady, zeroBitPlanesTree; 35184 35185 if (codeblock.included !== undefined) { 35186 codeblockIncluded = !!readBits(1); 35187 } else { 35188 precinct = codeblock.precinct; 35189 let inclusionTree; 35190 35191 if (precinct.inclusionTree !== undefined) { 35192 inclusionTree = precinct.inclusionTree; 35193 } else { 35194 const width = precinct.cbxMax - precinct.cbxMin + 1; 35195 const height = precinct.cbyMax - precinct.cbyMin + 1; 35196 inclusionTree = new InclusionTree(width, height, layerNumber); 35197 zeroBitPlanesTree = new TagTree(width, height); 35198 precinct.inclusionTree = inclusionTree; 35199 precinct.zeroBitPlanesTree = zeroBitPlanesTree; 35200 35201 for (let l = 0; l < layerNumber; l++) { 35202 if (readBits(1) !== 0) { 35203 throw new JpxError("Invalid tag tree"); 35204 } 35205 } 35206 } 35207 35208 if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) { 35209 while (true) { 35210 if (readBits(1)) { 35211 valueReady = !inclusionTree.nextLevel(); 35212 35213 if (valueReady) { 35214 codeblock.included = true; 35215 codeblockIncluded = firstTimeInclusion = true; 35216 break; 35217 } 35218 } else { 35219 inclusionTree.incrementValue(layerNumber); 35220 break; 35221 } 35222 } 35223 } 35224 } 35225 35226 if (!codeblockIncluded) { 35227 continue; 35228 } 35229 35230 if (firstTimeInclusion) { 35231 zeroBitPlanesTree = precinct.zeroBitPlanesTree; 35232 zeroBitPlanesTree.reset(codeblockColumn, codeblockRow); 35233 35234 while (true) { 35235 if (readBits(1)) { 35236 valueReady = !zeroBitPlanesTree.nextLevel(); 35237 35238 if (valueReady) { 35239 break; 35240 } 35241 } else { 35242 zeroBitPlanesTree.incrementValue(); 35243 } 35244 } 35245 35246 codeblock.zeroBitPlanes = zeroBitPlanesTree.value; 35247 } 35248 35249 const codingpasses = readCodingpasses(); 35250 35251 while (readBits(1)) { 35252 codeblock.Lblock++; 35253 } 35254 35255 const codingpassesLog2 = (0, _core_utils.log2)(codingpasses); 35256 const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock; 35257 const codedDataLength = readBits(bits); 35258 queue.push({ 35259 codeblock, 35260 codingpasses, 35261 dataLength: codedDataLength 35262 }); 35263 } 35264 35265 alignToByte(); 35266 35267 if (ephMarkerUsed) { 35268 skipMarkerIfEqual(0x92); 35269 } 35270 35271 while (queue.length > 0) { 35272 const packetItem = queue.shift(); 35273 codeblock = packetItem.codeblock; 35274 35275 if (codeblock.data === undefined) { 35276 codeblock.data = []; 35277 } 35278 35279 codeblock.data.push({ 35280 data, 35281 start: offset + position, 35282 end: offset + position + packetItem.dataLength, 35283 codingpasses: packetItem.codingpasses 35284 }); 35285 position += packetItem.dataLength; 35286 } 35287 } 35288 35289 return position; 35290} 35291 35292function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) { 35293 const x0 = subband.tbx0; 35294 const y0 = subband.tby0; 35295 const width = subband.tbx1 - subband.tbx0; 35296 const codeblocks = subband.codeblocks; 35297 const right = subband.type.charAt(0) === "H" ? 1 : 0; 35298 const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0; 35299 35300 for (let i = 0, ii = codeblocks.length; i < ii; ++i) { 35301 const codeblock = codeblocks[i]; 35302 const blockWidth = codeblock.tbx1_ - codeblock.tbx0_; 35303 const blockHeight = codeblock.tby1_ - codeblock.tby0_; 35304 35305 if (blockWidth === 0 || blockHeight === 0) { 35306 continue; 35307 } 35308 35309 if (codeblock.data === undefined) { 35310 continue; 35311 } 35312 35313 const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
35314 let currentCodingpassType = 2; 35315 const data = codeblock.data; 35316 let totalLength = 0, 35317 codingpasses = 0; 35318 let j, jj, dataItem; 35319 35320 for (j = 0, jj = data.length; j < jj; j++) { 35321 dataItem = data[j]; 35322 totalLength += dataItem.end - dataItem.start; 35323 codingpasses += dataItem.codingpasses; 35324 } 35325 35326 const encodedData = new Uint8Array(totalLength); 35327 let position = 0; 35328 35329 for (j = 0, jj = data.length; j < jj; j++) { 35330 dataItem = data[j]; 35331 const chunk = dataItem.data.subarray(dataItem.start, dataItem.end); 35332 encodedData.set(chunk, position); 35333 position += chunk.length; 35334 } 35335 35336 const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength); 35337 bitModel.setDecoder(decoder); 35338 35339 for (j = 0; j < codingpasses; j++) { 35340 switch (currentCodingpassType) { 35341 case 0: 35342 bitModel.runSignificancePropagationPass(); 35343 break; 35344 35345 case 1: 35346 bitModel.runMagnitudeRefinementPass(); 35347 break; 35348 35349 case 2: 35350 bitModel.runCleanupPass(); 35351 35352 if (segmentationSymbolUsed) { 35353 bitModel.checkSegmentationSymbol(); 35354 } 35355 35356 break; 35357 } 35358 35359 currentCodingpassType = (currentCodingpassType + 1) % 3; 35360 } 35361 35362 let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width; 35363 const sign = bitModel.coefficentsSign; 35364 const magnitude = bitModel.coefficentsMagnitude; 35365 const bitsDecoded = bitModel.bitsDecoded; 35366 const magnitudeCorrection = reversible ? 0 : 0.5; 35367 let k, n, nb; 35368 position = 0; 35369 const interleave = subband.type !== "LL"; 35370 35371 for (j = 0; j < blockHeight; j++) { 35372 const row = offset / width | 0; 35373 const levelOffset = 2 * row * (levelWidth - width) + right + bottom; 35374 35375 for (k = 0; k < blockWidth; k++) { 35376 n = magnitude[position]; 35377 35378 if (n !== 0) { 35379 n = (n + magnitudeCorrection) * delta; 35380 35381 if (sign[position] !== 0) { 35382 n = -n; 35383 } 35384 35385 nb = bitsDecoded[position]; 35386 const pos = interleave ? levelOffset + (offset << 1) : offset; 35387 35388 if (reversible && nb >= mb) { 35389 coefficients[pos] = n; 35390 } else { 35391 coefficients[pos] = n * (1 << mb - nb); 35392 } 35393 } 35394 35395 offset++; 35396 position++; 35397 } 35398 35399 offset += width - blockWidth; 35400 } 35401 } 35402} 35403 35404function transformTile(context, tile, c) { 35405 const component = tile.components[c]; 35406 const codingStyleParameters = component.codingStyleParameters; 35407 const quantizationParameters = component.quantizationParameters; 35408 const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount; 35409 const spqcds = quantizationParameters.SPqcds; 35410 const scalarExpounded = quantizationParameters.scalarExpounded; 35411 const guardBits = quantizationParameters.guardBits; 35412 const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed; 35413 const precision = context.components[c].precision; 35414 const reversible = codingStyleParameters.reversibleTransformation; 35415 const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform(); 35416 const subbandCoefficients = []; 35417 let b = 0; 35418 35419 for (let i = 0; i <= decompositionLevelsCount; i++) { 35420 const resolution = component.resolutions[i]; 35421 const width = resolution.trx1 - resolution.trx0; 35422 const height = resolution.try1 - resolution.try0; 35423 const coefficients = new Float32Array(width * height); 35424 35425 for (let j = 0, jj = resolution.subbands.length; j < jj; j++) { 35426 let mu, epsilon; 35427 35428 if (!scalarExpounded) { 35429 mu = spqcds[0].mu; 35430 epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0); 35431 } else { 35432 mu = spqcds[b].mu; 35433 epsilon = spqcds[b].epsilon; 35434 b++; 35435 } 35436 35437 const subband = resolution.subbands[j]; 35438 const gainLog2 = SubbandsGainLog2[subband.type]; 35439 const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048); 35440 const mb = guardBits + epsilon - 1; 35441 copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed); 35442 } 35443 35444 subbandCoefficients.push({ 35445 width, 35446 height, 35447 items: coefficients 35448 }); 35449 } 35450 35451 const result = transform.calculate(subbandCoefficients, component.tc
35451x0, component.tcy0); 35452 return { 35453 left: component.tcx0, 35454 top: component.tcy0, 35455 width: result.width, 35456 height: result.height, 35457 items: result.items 35458 }; 35459} 35460 35461function transformComponents(context) { 35462 const siz = context.SIZ; 35463 const components = context.components; 35464 const componentsCount = siz.Csiz; 35465 const resultImages = []; 35466 35467 for (let i = 0, ii = context.tiles.length; i < ii; i++) { 35468 const tile = context.tiles[i]; 35469 const transformedTiles = []; 35470 35471 for (let c = 0; c < componentsCount; c++) { 35472 transformedTiles[c] = transformTile(context, tile, c); 35473 } 35474 35475 const tile0 = transformedTiles[0]; 35476 const out = new Uint8ClampedArray(tile0.items.length * componentsCount); 35477 const result = { 35478 left: tile0.left, 35479 top: tile0.top, 35480 width: tile0.width, 35481 height: tile0.height, 35482 items: out 35483 }; 35484 let shift, offset; 35485 let pos = 0, 35486 j, 35487 jj, 35488 y0, 35489 y1, 35490 y2; 35491 35492 if (tile.codingStyleDefaultParameters.multipleComponentTransform) { 35493 const fourComponents = componentsCount === 4; 35494 const y0items = transformedTiles[0].items; 35495 const y1items = transformedTiles[1].items; 35496 const y2items = transformedTiles[2].items; 35497 const y3items = fourComponents ? transformedTiles[3].items : null; 35498 shift = components[0].precision - 8; 35499 offset = (128 << shift) + 0.5; 35500 const component0 = tile.components[0]; 35501 const alpha01 = componentsCount - 3; 35502 jj = y0items.length; 35503 35504 if (!component0.codingStyleParameters.reversibleTransformation) { 35505 for (j = 0; j < jj; j++, pos += alpha01) { 35506 y0 = y0items[j] + offset; 35507 y1 = y1items[j]; 35508 y2 = y2items[j]; 35509 out[pos++] = y0 + 1.402 * y2 >> shift; 35510 out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift; 35511 out[pos++] = y0 + 1.772 * y1 >> shift; 35512 } 35513 } else { 35514 for (j = 0; j < jj; j++, pos += alpha01) { 35515 y0 = y0items[j] + offset; 35516 y1 = y1items[j]; 35517 y2 = y2items[j]; 35518 const g = y0 - (y2 + y1 >> 2); 35519 out[pos++] = g + y2 >> shift; 35520 out[pos++] = g >> shift; 35521 out[pos++] = g + y1 >> shift; 35522 } 35523 } 35524 35525 if (fourComponents) { 35526 for (j = 0, pos = 3; j < jj; j++, pos += 4) { 35527 out[pos] = y3items[j] + offset >> shift; 35528 } 35529 } 35530 } else { 35531 for (let c = 0; c < componentsCount; c++) { 35532 const items = transformedTiles[c].items; 35533 shift = components[c].precision - 8; 35534 offset = (128 << shift) + 0.5; 35535 35536 for (pos = c, j = 0, jj = items.length; j < jj; j++) { 35537 out[pos] = items[j] + offset >> shift; 35538 pos += componentsCount; 35539 } 35540 } 35541 } 35542 35543 resultImages.push(result); 35544 } 35545 35546 return resultImages; 35547} 35548 35549function initializeTile(context, tileIndex) { 35550 const siz = context.SIZ; 35551 const componentsCount = siz.Csiz; 35552 const tile = context.tiles[tileIndex]; 35553 35554 for (let c = 0; c < componentsCount; c++) { 35555 const component = tile.components[c]; 35556 const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD; 35557 component.quantizationParameters = qcdOrQcc; 35558 const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD; 35559 component.codingStyleParameters = codOrCoc; 35560 } 35561 35562 tile.codingStyleDefaultParameters = context.currentTile.COD; 35563} 35564 35565class TagTree { 35566 constructor(width, height) { 35567 const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1; 35568 this.levels = []; 35569 35570 for (let i = 0; i < levelsLength; i++) { 35571 const level = { 35572 width, 35573 height, 35574 items: [] 35575 }; 35576 this.levels.push(level); 35577 width = Math.ceil(width / 2); 35578 height = Math.ceil(height / 2); 35579 } 35580 } 35581 35582 reset(i, j) {
35583 let currentLevel = 0, 35584 value = 0, 35585 level; 35586 35587 while (currentLevel < this.levels.length) { 35588 level = this.levels[currentLevel]; 35589 const index = i + j * level.width; 35590 35591 if (level.items[index] !== undefined) { 35592 value = level.items[index]; 35593 break; 35594 } 35595 35596 level.index = index; 35597 i >>= 1; 35598 j >>= 1; 35599 currentLevel++; 35600 } 35601 35602 currentLevel--; 35603 level = this.levels[currentLevel]; 35604 level.items[level.index] = value; 35605 this.currentLevel = currentLevel; 35606 delete this.value; 35607 } 35608 35609 incrementValue() { 35610 const level = this.levels[this.currentLevel]; 35611 level.items[level.index]++; 35612 } 35613 35614 nextLevel() { 35615 let currentLevel = this.currentLevel; 35616 let level = this.levels[currentLevel]; 35617 const value = level.items[level.index]; 35618 currentLevel--; 35619 35620 if (currentLevel < 0) { 35621 this.value = value; 35622 return false; 35623 } 35624 35625 this.currentLevel = currentLevel; 35626 level = this.levels[currentLevel]; 35627 level.items[level.index] = value; 35628 return true; 35629 } 35630 35631} 35632 35633class InclusionTree { 35634 constructor(width, height, defaultValue) { 35635 const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1; 35636 this.levels = []; 35637 35638 for (let i = 0; i < levelsLength; i++) { 35639 const items = new Uint8Array(width * height); 35640 35641 for (let j = 0, jj = items.length; j < jj; j++) { 35642 items[j] = defaultValue; 35643 } 35644 35645 const level = { 35646 width, 35647 height, 35648 items 35649 }; 35650 this.levels.push(level); 35651 width = Math.ceil(width / 2); 35652 height = Math.ceil(height / 2); 35653 } 35654 } 35655 35656 reset(i, j, stopValue) { 35657 let currentLevel = 0; 35658 35659 while (currentLevel < this.levels.length) { 35660 const level = this.levels[currentLevel]; 35661 const index = i + j * level.width; 35662 level.index = index; 35663 const value = level.items[index]; 35664 35665 if (value === 0xff) { 35666 break; 35667 } 35668 35669 if (value > stopValue) { 35670 this.currentLevel = currentLevel; 35671 this.propagateValues(); 35672 return false; 35673 } 35674 35675 i >>= 1; 35676 j >>= 1; 35677 currentLevel++; 35678 } 35679 35680 this.currentLevel = currentLevel - 1; 35681 return true; 35682 } 35683 35684 incrementValue(stopValue) { 35685 const level = this.levels[this.currentLevel]; 35686 level.items[level.index] = stopValue + 1; 35687 this.propagateValues(); 35688 } 35689 35690 propagateValues() { 35691 let levelIndex = this.currentLevel; 35692 let level = this.levels[levelIndex]; 35693 const currentValue = level.items[level.index]; 35694 35695 while (--levelIndex >= 0) { 35696 level = this.levels[levelIndex]; 35697 level.items[level.index] = currentValue; 35698 } 35699 } 35700 35701 nextLevel() {
35702 let currentLevel = this.currentLevel; 35703 let level = this.levels[currentLevel]; 35704 const value = level.items[level.index]; 35705 level.items[level.index] = 0xff; 35706 currentLevel--; 35707 35708 if (currentLevel < 0) { 35709 return false; 35710 } 35711 35712 this.currentLevel = currentLevel; 35713 level = this.levels[currentLevel]; 35714 level.items[level.index] = value; 35715 return true; 35716 } 35717 35718} 35719 35720const BitModel = function BitModelClosure() { 35721 const UNIFORM_CONTEXT = 17; 35722 const RUNLENGTH_CONTEXT = 18; 35723 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]); 35724 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]); 35725 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]); 35726 35727 class BitModel { 35728 constructor(width, height, subband, zeroBitPlanes, mb) { 35729 this.width = width; 35730 this.height = height; 35731 let contextLabelTable; 35732 35733 if (subband === "HH") { 35734 contextLabelTable = HHContextLabel; 35735 } else if (subband === "HL") { 35736 contextLabelTable = HLContextLabel; 35737 } else { 35738 contextLabelTable = LLAndLHContextsLabel; 35739 } 35740 35741 this.contextLabelTable = contextLabelTable; 35742 const coefficientCount = width * height; 35743 this.neighborsSignificance = new Uint8Array(coefficientCount); 35744 this.coefficentsSign = new Uint8Array(coefficientCount); 35745 let coefficentsMagnitude; 35746 35747 if (mb > 14) { 35748 coefficentsMagnitude = new Uint32Array(coefficientCount); 35749 } else if (mb > 6) { 35750 coefficentsMagnitude = new Uint16Array(coefficientCount); 35751 } else { 35752 coefficentsMagnitude = new Uint8Array(coefficientCount); 35753 } 35754 35755 this.coefficentsMagnitude = coefficentsMagnitude; 35756 this.processingFlags = new Uint8Array(coefficientCount); 35757 const bitsDecoded = new Uint8Array(coefficientCount); 35758 35759 if (zeroBitPlanes !== 0) { 35760 for (let i = 0; i < coefficientCount; i++) { 35761 bitsDecoded[i] = zeroBitPlanes; 35762 } 35763 } 35764 35765 this.bitsDecoded = bitsDecoded; 35766 this.reset(); 35767 } 35768 35769 setDecoder(decoder) { 35770 this.decoder = decoder; 35771 } 35772 35773 reset() { 35774 this.contexts = new Int8Array(19); 35775 this.contexts[0] = 4 << 1 | 0; 35776 this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0; 35777 this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0; 35778 } 35779 35780 setNeighborsSignificance(row, column, index) { 35781 const neighborsSignificance = this.neighborsSignificance; 35782 const width = this.width, 35783 height = this.height; 35784 const left = column > 0; 35785 const right = column + 1 < width; 35786 let i; 35787 35788 if (row > 0) { 35789 i = index - width; 35790 35791 if (left) { 35792 neighborsSignificance[i - 1] += 0x10; 35793 } 35794 35795 if (right) { 35796 neighborsSignificance[i + 1] += 0x10; 35797 } 35798 35799 neighborsSignificance[i] += 0x04; 35800 } 35801 35802 if (row + 1 < height) { 35803 i = index + width; 35804 35805 if (left) { 35806 neighborsSignificance[i - 1] += 0x10; 35807 } 35808 35809 if (right) { 35810 neighborsSignificance[i + 1] += 0x10; 35811 } 35812 35813 neighborsSignificance[i] += 0x04; 35814 } 35815 35816 if (left) { 35817 neighborsSignificance[index - 1] += 0x01; 35818 } 35819 35820 if (right) { 35821 neighborsSignificance[index + 1] += 0x01; 35822 } 35823 35824 neighborsSignificance[index] |= 0x80; 35825 } 35826 35827 runSignificancePropagationPass() { 35828 const decoder = this.decoder; 35829 const width = this.width, 35830 height = this.height; 35831 const coefficentsMagnitude = this.coefficentsMagnitude; 35832 const coefficentsSign = this.coefficentsSign; 35833 const neighborsSignificance = this.neighborsSignificance; 35834 const processingFlags = this.processingFlags; 35835 const contexts = this.contexts; 35836 const labels = this.contextLabelTable; 35837 const bitsDecoded = this.bitsDecoded; 35838 const processedInverseMask = ~1; 35839 const processedMask = 1; 35840 const firstMagnitudeBitMask = 2; 35841 35842 for (let i0 = 0; i0 < height; i0 += 4) { 35843 for (let j = 0; j < width; j++) { 35844 let index = i0 * width + j; 35845 35846 for (let i1 = 0; i1 < 4; i1++, index += width) { 35847 const i = i0 + i1; 35848 35849 if (i >= height) { 35850 break; 35851 } 35852 35853 processingFlags[index] &= processedInverseMask; 35854 35855 if (coefficentsMagnitude[index] || !neighborsSignificance[index]) { 35856 continue; 35857 } 35858 35859 const contextLabel = labels[neighborsSignificance[index]]; 35860 const decision = decoder.readBit(contexts, contextLabel); 35861 35862 if (decision) { 35863 const sign = this.decodeSignBit(i, j, index); 35864 coefficentsSign[index] = sign; 35865 coefficentsMagnitude[index] = 1; 35866 this.setNeighborsSignificance(i, j, index);
35867 processingFlags[index] |= firstMagnitudeBitMask; 35868 } 35869 35870 bitsDecoded[index]++; 35871 processingFlags[index] |= processedMask; 35872 } 35873 } 35874 } 35875 } 35876 35877 decodeSignBit(row, column, index) { 35878 const width = this.width, 35879 height = this.height; 35880 const coefficentsMagnitude = this.coefficentsMagnitude; 35881 const coefficentsSign = this.coefficentsSign; 35882 let contribution, sign0, sign1, significance1; 35883 let contextLabel, decoded; 35884 significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0; 35885 35886 if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) { 35887 sign1 = coefficentsSign[index + 1]; 35888 35889 if (significance1) { 35890 sign0 = coefficentsSign[index - 1]; 35891 contribution = 1 - sign1 - sign0; 35892 } else { 35893 contribution = 1 - sign1 - sign1; 35894 } 35895 } else if (significance1) { 35896 sign0 = coefficentsSign[index - 1]; 35897 contribution = 1 - sign0 - sign0; 35898 } else { 35899 contribution = 0; 35900 } 35901 35902 const horizontalContribution = 3 * contribution; 35903 significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0; 35904 35905 if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) { 35906 sign1 = coefficentsSign[index + width]; 35907 35908 if (significance1) { 35909 sign0 = coefficentsSign[index - width]; 35910 contribution = 1 - sign1 - sign0 + horizontalContribution; 35911 } else { 35912 contribution = 1 - sign1 - sign1 + horizontalContribution; 35913 } 35914 } else if (significance1) { 35915 sign0 = coefficentsSign[index - width]; 35916 contribution = 1 - sign0 - sign0 + horizontalContribution; 35917 } else { 35918 contribution = horizontalContribution; 35919 } 35920 35921 if (contribution >= 0) { 35922 contextLabel = 9 + contribution; 35923 decoded = this.decoder.readBit(this.contexts, contextLabel); 35924 } else { 35925 contextLabel = 9 - contribution; 35926 decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1; 35927 } 35928 35929 return decoded; 35930 } 35931 35932 runMagnitudeRefinementPass() { 35933 const decoder = this.decoder; 35934 const width = this.width, 35935 height = this.height; 35936 const coefficentsMagnitude = this.coefficentsMagnitude; 35937 const neighborsSignificance = this.neighborsSignificance; 35938 const contexts = this.contexts; 35939 const bitsDecoded = this.bitsDecoded; 35940 const processingFlags = this.processingFlags; 35941 const processedMask = 1; 35942 const firstMagnitudeBitMask = 2; 35943 const length = width * height; 35944 const width4 = width * 4; 35945 35946 for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) { 35947 indexNext = Math.min(length, index0 + width4); 35948 35949 for (let j = 0; j < width; j++) { 35950 for (let index = index0 + j; index < indexNext; index += width) { 35951 if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) { 35952 continue; 35953 } 35954 35955 let contextLabel = 16; 35956 35957 if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) { 35958 processingFlags[index] ^= firstMagnitudeBitMask; 35959 const significance = neighborsSignificance[index] & 127; 35960 contextLabel = significance === 0 ? 15 : 14; 35961 } 35962 35963 const bit = decoder.readBit(contexts, contextLabel); 35964 coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit; 35965 bitsDecoded[index]++; 35966 processingFlags[index] |= processedMask; 35967 } 35968 } 35969 } 35970 } 35971 35972 runCleanupPass() { 35973 const decoder = this.decoder; 35974 const width = this.width, 35975 height = this.height; 35976 const neighborsSignificance = this.neighborsSignificance; 35977 const coefficentsMagnitude = this.coefficentsMagnitude; 35978 const coefficentsSign = this.coefficentsSign; 35979 const contexts = this.contexts; 35980 const labels = this.contextLabelTable; 35981 const bitsDecoded = this.bitsDecoded; 35982 const processingFlags = this.processingFlags; 35983 const processedMask = 1; 35984 const firstMagnitudeBitMask = 2; 35985 const oneRowDown = width; 35986 const twoRowsDown = width * 2; 35987 const threeRowsDown = width * 3; 35988 let iNext; 35989 35990 for (let i0 = 0; i0 < height; i0 = iNext) { 35991 iNext = Math.min(i0 + 4, height); 35992 const indexBase = i0 * width; 35993 const checkAllEmpty = i0 + 3 < height; 35994 35995 for (let j = 0; j < width; j++) { 35996 const index0 = indexBase + j; 35997 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; 35998 let i1 = 0, 35999 index = index0; 36000 let i = i0, 36001 sign; 36002 36003 if (allEmpty) { 36004 const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT); 36005 36006 if (!hasSignificantCoefficent) { 36007 bitsDecoded[index0]++; 36008 bitsDecoded[index0 + oneRowDown]++; 36009 bitsDecoded[index0 + twoRowsDown]++; 36010 bitsDecoded[index0 + threeRowsDown]++; 36011 continue; 36012 } 36013 36014 i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT); 36015 36016 if (i1 !== 0) { 36017 i = i0 + i1; 36018 index += i1 * width; 36019 } 36020 36021 sign = this.decodeSignBit(i, j, index); 36022 coefficentsSign[index] = sign; 36023 coefficentsMagnitude[index] = 1; 36024 this.setNeighborsSignificance(i, j, index);
36025 processingFlags[index] |= firstMagnitudeBitMask; 36026 index = index0; 36027 36028 for (let i2 = i0; i2 <= i; i2++, index += width) { 36029 bitsDecoded[index]++; 36030 } 36031 36032 i1++; 36033 } 36034 36035 for (i = i0 + i1; i < iNext; i++, index += width) { 36036 if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) { 36037 continue; 36038 } 36039 36040 const contextLabel = labels[neighborsSignificance[index]]; 36041 const decision = decoder.readBit(contexts, contextLabel); 36042 36043 if (decision === 1) { 36044 sign = this.decodeSignBit(i, j, index); 36045 coefficentsSign[index] = sign; 36046 coefficentsMagnitude[index] = 1; 36047 this.setNeighborsSignificance(i, j, index); 36048 processingFlags[index] |= firstMagnitudeBitMask; 36049 } 36050 36051 bitsDecoded[index]++; 36052 } 36053 } 36054 } 36055 } 36056 36057 checkSegmentationSymbol() { 36058 const decoder = this.decoder; 36059 const contexts = this.contexts; 36060 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); 36061 36062 if (symbol !== 0xa) { 36063 throw new JpxError("Invalid segmentation symbol"); 36064 } 36065 } 36066 36067 } 36068 36069 return BitModel; 36070}(); 36071 36072class Transform { 36073 constructor() { 36074 if (this.constructor === Transform) { 36075 (0, _util.unreachable)("Cannot initialize Transform."); 36076 } 36077 } 36078 36079 calculate(subbands, u0, v0) { 36080 let ll = subbands[0]; 36081 36082 for (let i = 1, ii = subbands.length; i < ii; i++) { 36083 ll = this.iterate(ll, subbands[i], u0, v0); 36084 } 36085 36086 return ll; 36087 } 36088 36089 extend(buffer, offset, size) { 36090 let i1 = offset - 1, 36091 j1 = offset + 1; 36092 let i2 = offset + size - 2, 36093 j2 = offset + size; 36094 buffer[i1--] = buffer[j1++]; 36095 buffer[j2++] = buffer[i2--]; 36096 buffer[i1--] = buffer[j1++]; 36097 buffer[j2++] = buffer[i2--]; 36098 buffer[i1--] = buffer[j1++]; 36099 buffer[j2++] = buffer[i2--]; 36100 buffer[i1] = buffer[j1]; 36101 buffer[j2] = buffer[i2]; 36102 } 36103 36104 filter(x, offset, length) { 36105 (0, _util.unreachable)("Abstract method `filter` called"); 36106 } 36107 36108 iterate(ll, hl_lh_hh, u0, v0) { 36109 const llWidth = ll.width, 36110 llHeight = ll.height; 36111 let llItems = ll.items; 36112 const width = hl_lh_hh.width; 36113 const height = hl_lh_hh.height; 36114 const items = hl_lh_hh.items; 36115 let i, j, k, l, u, v; 36116 36117 for (k = 0, i = 0; i < llHeight; i++) { 36118 l = i * 2 * width; 36119 36120 for (j = 0; j < llWidth; j++, k++, l += 2) { 36121 items[l] = llItems[k]; 36122 } 36123 } 36124 36125 llItems = ll.items = null; 36126 const bufferPadding = 4; 36127 const rowBuffer = new Float32Array(width + 2 * bufferPadding); 36128 36129 if (width === 1) { 36130 if ((u0 & 1) !== 0) { 36131 for (v = 0, k = 0; v < height; v++, k += width) { 36132 items[k] *= 0.5; 36133 } 36134 } 36135 } else { 36136 for (v = 0, k = 0; v < height; v++, k += width) { 36137 rowBuffer.set(items.subarray(k, k + width), bufferPadding); 36138 this.extend(rowBuffer, bufferPadding, width); 36139 this.filter(rowBuffer, bufferPadding, width); 36140 items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k); 36141 } 36142 } 36143 36144 let numBuffers = 16; 36145 const colBuffers = []; 36146 36147 for (i = 0; i < numBuffers; i++) { 36148 colBuffers.push(new Float32Array(height + 2 * bufferPadding)); 36149 } 36150 36151 let b, 36152 currentBuffer = 0; 36153 ll = bufferPadding + height; 36154 36155 if (height === 1) { 36156 if ((v0 & 1) !== 0) { 36157 for (u = 0; u < width; u++) { 36158 items[u] *= 0.5; 36159 } 36160 } 36161 } else { 36162 for (u = 0; u < width; u++) { 36163 if (currentBuffer === 0) { 36164 numBuffers = Math.min(width - u, numBuffers); 36165 36166 for (k = u, l = bufferPadding; l < ll; k += width, l++) { 36167 for (b = 0; b < numBuffers; b++) { 36168 colBuffers[b][l] = items[k + b]; 36169 } 36170 } 36171 36172 currentBuffer = numBuffers; 36173 } 36174 36175 currentBuffer--; 36176 const buffer = colBuffers[currentBuffer]; 36177 this.extend(buffer, bufferPadding, height); 36178 this.filter(buffer, bufferPadding, height); 36179 36180 if (currentBuffer === 0) { 36181 k = u - numBuffers + 1; 36182 36183 for (l = bufferPadding; l < ll; k += width, l++) { 36184 for (b = 0; b < numBuffers; b++) { 36185 items[k + b] = colBuffers[b][l]; 36186 } 36187 } 36188 } 36189 } 36190 } 36191 36192 return { 36193 width, 36194 height, 36195 items 36196 }; 36197 } 36198 36199} 36200 36201class IrreversibleTransform extends Transform { 36202 filter(x, offset, length) { 36203 const len = length >> 1; 36204 offset |= 0; 36205 let j, n, current, next;
36206 const alpha = -1.586134342059924; 36207 const beta = -0.052980118572961; 36208 const gamma = 0.882911075530934; 36209 const delta = 0.443506852043971; 36210 const K = 1.230174104914001; 36211 const K_ = 1 / K; 36212 j = offset - 3; 36213 36214 for (n = len + 4; n--; j += 2) { 36215 x[j] *= K_; 36216 } 36217 36218 j = offset - 2; 36219 current = delta * x[j - 1]; 36220 36221 for (n = len + 3; n--; j += 2) { 36222 next = delta * x[j + 1]; 36223 x[j] = K * x[j] - current - next; 36224 36225 if (n--) { 36226 j += 2; 36227 current = delta * x[j + 1]; 36228 x[j] = K * x[j] - current - next; 36229 } else { 36230 break; 36231 } 36232 } 36233 36234 j = offset - 1; 36235 current = gamma * x[j - 1]; 36236 36237 for (n = len + 2; n--; j += 2) { 36238 next = gamma * x[j + 1]; 36239 x[j] -= current + next; 36240 36241 if (n--) { 36242 j += 2; 36243 current = gamma * x[j + 1]; 36244 x[j] -= current + next; 36245 } else { 36246 break; 36247 } 36248 } 36249 36250 j = offset; 36251 current = beta * x[j - 1]; 36252 36253 for (n = len + 1; n--; j += 2) { 36254 next = beta * x[j + 1]; 36255 x[j] -= current + next; 36256 36257 if (n--) { 36258 j += 2; 36259 current = beta * x[j + 1]; 36260 x[j] -= current + next; 36261 } else { 36262 break; 36263 } 36264 } 36265 36266 if (len !== 0) { 36267 j = offset + 1; 36268 current = alpha * x[j - 1]; 36269 36270 for (n = len; n--; j += 2) { 36271 next = alpha * x[j + 1]; 36272 x[j] -= current + next; 36273 36274 if (n--) { 36275 j += 2; 36276 current = alpha * x[j + 1]; 36277 x[j] -= current + next; 36278 } else { 36279 break; 36280 } 36281 } 36282 } 36283 } 36284 36285} 36286 36287class ReversibleTransform extends Transform { 36288 filter(x, offset, length) { 36289 const len = length >> 1; 36290 offset |= 0; 36291 let j, n; 36292 36293 for (j = offset, n = len + 1; n--; j += 2) { 36294 x[j] -= x[j - 1] + x[j + 1] + 2 >> 2; 36295 } 36296 36297 for (j = offset + 1, n = len; n--; j += 2) { 36298 x[j] += x[j - 1] + x[j + 1] >> 1; 36299 } 36300 } 36301 36302} 36303 36304/***/ }), 36305/* 41 */ 36306/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 36307 36308 36309 36310Object.defineProperty(exports, "__esModule", ({ 36311 value: true 36312})); 36313exports.LZWStream = void 0; 36314 36315var _decode_stream = __w_pdfjs_require__(29); 36316 36317class LZWStream extends _decode_stream.DecodeStream { 36318 constructor(str, maybeLength, earlyChange) { 36319 super(maybeLength); 36320 this.str = str; 36321 this.dict = str.dict; 36322 this.cachedData = 0; 36323 this.bitsCached = 0; 36324 const maxLzwDictionarySize = 4096; 36325 const lzwState = { 36326 earlyChange, 36327 codeLength: 9, 36328 nextCode: 258, 36329 dictionaryValues: new Uint8Array(maxLzwDictionarySize), 36330 dictionaryLengths: new Uint16Array(maxLzwDictionarySize), 36331 dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize), 36332 currentSequence: new Uint8Array(maxLzwDictionarySize), 36333 currentSequenceLength: 0 36334 }; 36335 36336 for (let i = 0; i < 256; ++i) { 36337 lzwState.dictionaryValues[i] = i; 36338 lzwState.dictionaryLengths[i] = 1; 36339 } 36340 36341 this.lzwState = lzwState; 36342 } 36343 36344 readBits(n) { 36345 let bitsCached = this.bitsCached; 36346 let cachedData = this.cachedData; 36347 36348 while (bitsCached < n) { 36349 const c = this.str.getByte(); 36350 36351 if (c === -1) { 36352 this.eof = true; 36353 return null; 36354 } 36355 36356 cachedData = cachedData << 8 | c; 36357 bitsCached += 8; 36358 } 36359 36360 this.bitsCached = bitsCached -= n; 36361 this.cachedData = cachedData; 36362 this.lastCode = null; 36363 return cachedData >>> bitsCached & (1 << n) - 1; 36364 } 36365 36366 readBlock() { 36367 const blockSize = 512, 36368 decodedSizeDelta = blockSize; 36369 let estimatedDecodedSize = blockSize * 2; 36370 let i, j, q; 36371 const lzwState = this.lzwState; 36372 36373 if (!lzwState) { 36374 return; 36375 } 36376 36377 const earlyChange = lzwState.earlyChange; 36378 let nextCode = lzwState.nextCode; 36379 const dictionaryValues = lzwState.dictionaryValues; 36380 const dictionaryLengths = lzwState.dictionaryLengths; 36381 const dictionaryPrevCodes = lzwState.dictionaryPrevCodes; 36382 let codeLength = lzwState.codeLength; 36383 let prevCode = lzwState.prevCode; 36384 const currentSequence = lzwState.currentSequence; 36385 let currentSequenceLength = lzwState.currentSequenceLength; 36386 let decodedLength = 0;
vendor: 11,604 bytes, lines 36387-36846
36387 let currentBufferLength = this.bufferLength; 36388 let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 36389 36390 for (i = 0; i < blockSize; i++) { 36391 const code = this.readBits(codeLength); 36392 const hasPrev = currentSequenceLength > 0; 36393 36394 if (code < 256) { 36395 currentSequence[0] = code; 36396 currentSequenceLength = 1; 36397 } else if (code >= 258) { 36398 if (code < nextCode) { 36399 currentSequenceLength = dictionaryLengths[code]; 36400 36401 for (j = currentSequenceLength - 1, q = code; j >= 0; j--) { 36402 currentSequence[j] = dictionaryValues[q]; 36403 q = dictionaryPrevCodes[q]; 36404 } 36405 } else { 36406 currentSequence[currentSequenceLength++] = currentSequence[0]; 36407 } 36408 } else if (code === 256) { 36409 codeLength = 9; 36410 nextCode = 258; 36411 currentSequenceLength = 0; 36412 continue; 36413 } else { 36414 this.eof = true; 36415 delete this.lzwState; 36416 break; 36417 } 36418 36419 if (hasPrev) { 36420 dictionaryPrevCodes[nextCode] = prevCode; 36421 dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1; 36422 dictionaryValues[nextCode] = currentSequence[0]; 36423 nextCode++; 36424 codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0; 36425 } 36426 36427 prevCode = code; 36428 decodedLength += currentSequenceLength; 36429 36430 if (estimatedDecodedSize < decodedLength) { 36431 do { 36432 estimatedDecodedSize += decodedSizeDelta; 36433 } while (estimatedDecodedSize < decodedLength); 36434 36435 buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 36436 } 36437 36438 for (j = 0; j < currentSequenceLength; j++) { 36439 buffer[currentBufferLength++] = currentSequence[j]; 36440 } 36441 } 36442 36443 lzwState.nextCode = nextCode; 36444 lzwState.codeLength = codeLength; 36445 lzwState.prevCode = prevCode; 36446 lzwState.currentSequenceLength = currentSequenceLength; 36447 this.bufferLength = currentBufferLength; 36448 } 36449 36450} 36451 36452exports.LZWStream = LZWStream; 36453 36454/***/ }), 36455/* 42 */ 36456/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 36457 36458 36459 36460Object.defineProperty(exports, "__esModule", ({ 36461 value: true 36462})); 36463exports.PredictorStream = void 0; 36464 36465var _decode_stream = __w_pdfjs_require__(29); 36466 36467var _util = __w_pdfjs_require__(2); 36468 36469var _primitives = __w_pdfjs_require__(5); 36470 36471class PredictorStream extends _decode_stream.DecodeStream { 36472 constructor(str, maybeLength, params) { 36473 super(maybeLength); 36474 36475 if (!(0, _primitives.isDict)(params)) { 36476 return str; 36477 } 36478 36479 const predictor = this.predictor = params.get("Predictor") || 1; 36480 36481 if (predictor <= 1) { 36482 return str; 36483 } 36484 36485 if (predictor !== 2 && (predictor < 10 || predictor > 15)) { 36486 throw new _util.FormatError(`Unsupported predictor: ${predictor}`); 36487 } 36488 36489 if (predictor === 2) { 36490 this.readBlock = this.readBlockTiff; 36491 } else { 36492 this.readBlock = this.readBlockPng; 36493 } 36494 36495 this.str = str; 36496 this.dict = str.dict; 36497 const colors = this.colors = params.get("Colors") || 1; 36498 const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8; 36499 const columns = this.columns = params.get("Columns") || 1; 36500 this.pixBytes = colors * bits + 7 >> 3; 36501 this.rowBytes = columns * colors * bits + 7 >> 3; 36502 return this; 36503 } 36504 36505 readBlockTiff() { 36506 const rowBytes = this.rowBytes; 36507 const bufferLength = this.bufferLength; 36508 const buffer = this.ensureBuffer(bufferLength + rowBytes); 36509 const bits = this.bits; 36510 const colors = this.colors; 36511 const rawBytes = this.str.getBytes(rowBytes); 36512 this.eof = !rawBytes.length; 36513 36514 if (this.eof) { 36515 return; 36516 } 36517 36518 let inbuf = 0, 36519 outbuf = 0; 36520 let inbits = 0, 36521 outbits = 0; 36522 let pos = bufferLength; 36523 let i; 36524 36525 if (bits === 1 && colors === 1) { 36526 for (i = 0; i < rowBytes; ++i) { 36527 let c = rawBytes[i] ^ inbuf; 36528 c ^= c >> 1; 36529 c ^= c >> 2; 36530 c ^= c >> 4; 36531 inbuf = (c & 1) << 7; 36532 buffer[pos++] = c; 36533 } 36534 } else if (bits === 8) { 36535 for (i = 0; i < colors; ++i) { 36536 buffer[pos++] = rawBytes[i]; 36537 } 36538 36539 for (; i < rowBytes; ++i) { 36540 buffer[pos] = buffer[pos - colors] + rawBytes[i]; 36541 pos++; 36542 } 36543 } else if (bits === 16) { 36544 const bytesPerPixel = colors * 2; 36545 36546 for (i = 0; i < bytesPerPixel; ++i) { 36547 buffer[pos++] = rawBytes[i]; 36548 } 36549 36550 for (; i < rowBytes; i += 2) { 36551 const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff); 36552 buffer[pos++] = sum >> 8 & 0xff; 36553 buffer[pos++] = sum & 0xff; 36554 } 36555 } else { 36556 const compArray = new Uint8Array(colors + 1); 36557 const bitMask = (1 << bits) - 1; 36558 let j = 0, 36559 k = bufferLength; 36560 const columns = this.columns; 36561 36562 for (i = 0; i < columns; ++i) { 36563 for (let kk = 0; kk < colors; ++kk) { 36564 if (inbits < bits) { 36565 inbuf = inbuf << 8 | rawBytes[j++] & 0xff; 36566 inbits += 8; 36567 } 36568 36569 compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask; 36570 inbits -= bits; 36571 outbuf = outbuf << bits | compArray[kk]; 36572 outbits += bits; 36573 36574 if (outbits >= 8) { 36575 buffer[k++] = outbuf >> outbits - 8 & 0xff; 36576 outbits -= 8; 36577 } 36578 } 36579 } 36580 36581 if (outbits > 0) { 36582 buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1); 36583 } 36584 } 36585 36586 this.bufferLength += rowBytes; 36587 } 36588 36589 readBlockPng() { 36590 const rowBytes = this.rowBytes; 36591 const pixBytes = this.pixBytes; 36592 const predictor = this.str.getByte(); 36593 const rawBytes = this.str.getBytes(rowBytes); 36594 this.eof = !rawBytes.length; 36595 36596 if (this.eof) { 36597 return; 36598 } 36599 36600 const bufferLength = this.bufferLength; 36601 const buffer = this.ensureBuffer(bufferLength + rowBytes); 36602 let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength); 36603 36604 if (prevRow.length === 0) { 36605 prevRow = new Uint8Array(rowBytes); 36606 } 36607 36608 let i, 36609 j = bufferLength, 36610 up, 36611 c; 36612 36613 switch (predictor) { 36614 case 0: 36615 for (i = 0; i < rowBytes; ++i) { 36616 buffer[j++] = rawBytes[i]; 36617 } 36618 36619 break; 36620 36621 case 1: 36622 for (i = 0; i < pixBytes; ++i) { 36623 buffer[j++] = rawBytes[i]; 36624 } 36625 36626 for (; i < rowBytes; ++i) { 36627 buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff; 36628 j++; 36629 } 36630 36631 break; 36632 36633 case 2: 36634 for (i = 0; i < rowBytes; ++i) { 36635 buffer[j++] = prevRow[i] + rawBytes[i] & 0xff; 36636 } 36637 36638 break; 36639 36640 case 3: 36641 for (i = 0; i < pixBytes; ++i) { 36642 buffer[j++] = (prevRow[i] >> 1) + rawBytes[i]; 36643 } 36644 36645 for (; i < rowBytes; ++i) { 36646 buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff; 36647 j++; 36648 } 36649 36650 break; 36651 36652 case 4: 36653 for (i = 0; i < pixBytes; ++i) { 36654 up = prevRow[i]; 36655 c = rawBytes[i]; 36656 buffer[j++] = up + c; 36657 } 36658 36659 for (; i < rowBytes; ++i) { 36660 up = prevRow[i]; 36661 const upLeft = prevRow[i - pixBytes]; 36662 const left = buffer[j - pixBytes]; 36663 const p = left + up - upLeft; 36664 let pa = p - left; 36665 36666 if (pa < 0) { 36667 pa = -pa; 36668 } 36669 36670 let pb = p - up; 36671 36672 if (pb < 0) { 36673 pb = -pb; 36674 } 36675 36676 let pc = p - upLeft; 36677 36678 if (pc < 0) { 36679 pc = -pc; 36680 } 36681 36682 c = rawBytes[i]; 36683 36684 if (pa <= pb && pa <= pc) { 36685 buffer[j++] = left + c; 36686 } else if (pb <= pc) { 36687 buffer[j++] = up + c; 36688 } else { 36689 buffer[j++] = upLeft + c; 36690 } 36691 } 36692 36693 break; 36694 36695 default: 36696 throw new _util.FormatError(`Unsupported predictor: ${predictor}`); 36697 } 36698 36699 this.bufferLength += rowBytes; 36700 } 36701 36702} 36703 36704exports.PredictorStream = PredictorStream; 36705 36706/***/ }), 36707/* 43 */ 36708/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 36709 36710 36711 36712Object.defineProperty(exports, "__esModule", ({ 36713 value: true 36714})); 36715exports.RunLengthStream = void 0; 36716 36717var _decode_stream = __w_pdfjs_require__(29); 36718 36719class RunLengthStream extends _decode_stream.DecodeStream { 36720 constructor(str, maybeLength) { 36721 super(maybeLength); 36722 this.str = str; 36723 this.dict = str.dict; 36724 } 36725 36726 readBlock() { 36727 const repeatHeader = this.str.getBytes(2); 36728 36729 if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) { 36730 this.eof = true; 36731 return; 36732 } 36733 36734 let buffer; 36735 let bufferLength = this.bufferLength; 36736 let n = repeatHeader[0]; 36737 36738 if (n < 128) { 36739 buffer = this.ensureBuffer(bufferLength + n + 1); 36740 buffer[bufferLength++] = repeatHeader[1]; 36741 36742 if (n > 0) { 36743 const source = this.str.getBytes(n); 36744 buffer.set(source, bufferLength); 36745 bufferLength += n; 36746 } 36747 } else { 36748 n = 257 - n; 36749 const b = repeatHeader[1]; 36750 buffer = this.ensureBuffer(bufferLength + n + 1); 36751 36752 for (let i = 0; i < n; i++) { 36753 buffer[bufferLength++] = b; 36754 } 36755 } 36756 36757 this.bufferLength = bufferLength; 36758 } 36759 36760} 36761 36762exports.RunLengthStream = RunLengthStream; 36763 36764/***/ }), 36765/* 44 */ 36766/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 36767 36768 36769 36770Object.defineProperty(exports, "__esModule", ({ 36771 value: true 36772})); 36773exports.Font = exports.ErrorFont = void 0; 36774 36775var _util = __w_pdfjs_require__(2); 36776 36777var _cff_parser = __w_pdfjs_require__(45); 36778 36779var _fonts_utils = __w_pdfjs_require__(18); 36780 36781var _glyphlist = __w_pdfjs_require__(20); 36782 36783var _encodings = __w_pdfjs_require__(19); 36784 36785var _standard_fonts = __w_pdfjs_require__(47); 36786 36787var _unicode = __w_pdfjs_require__(21); 36788 36789var _to_unicode_map = __w_pdfjs_require__(48); 36790 36791var _cff_font = __w_pdfjs_require__(49); 36792 36793var _font_renderer = __w_pdfjs_require__(50); 36794 36795var _glyf = __w_pdfjs_require__(51); 36796 36797var _cmap = __w_pdfjs_require__(26); 36798 36799var _opentype_file_builder = __w_pdfjs_require__(52); 36800 36801var _core_utils = __w_pdfjs_require__(9); 36802 36803var _stream = __w_pdfjs_require__(10); 36804 36805var _type1_font = __w_pdfjs_require__(53); 36806 36807const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]]; 36808const PDF_GLYPH_SPACE_UNITS = 1000; 36809const 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"]; 36810const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"]; 36811 36812function adjustWidths(properties) { 36813 if (!properties.fontMatrix) { 36814 return; 36815 } 36816 36817 if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) { 36818 return; 36819 } 36820 36821 const scale = 0.001 / properties.fontMatrix[0]; 36822 const glyphsWidths = properties.widths; 36823 36824 for (const glyph in glyphsWidths) { 36825 glyphsWidths[glyph] *= scale; 36826 } 36827 36828 properties.defaultWidth *= scale; 36829} 36830 36831function adjustToUnicode(properties, builtInEncoding) { 36832 if (properties.isInternalFont) { 36833 return; 36834 } 36835 36836 if (builtInEncoding === properties.defaultEncoding) { 36837 return; 36838 } 36839 36840 if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 36841 return; 36842 } 36843 36844 const toUnicode = [], 36845 glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 36846
36847 for (const charCode in builtInEncoding) { 36848 if (properties.hasIncludedToUnicodeMap) { 36849 if (properties.toUnicode.has(charCode)) { 36850 continue; 36851 } 36852 } else if (properties.hasEncoding) { 36853 if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) { 36854 continue; 36855 } 36856 } 36857 36858 const glyphName = builtInEncoding[charCode]; 36859 const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 36860 36861 if (unicode !== -1) { 36862 toUnicode[charCode] = String.fromCharCode(unicode); 36863 } 36864 } 36865 36866 if (toUnicode.length > 0) { 36867 properties.toUnicode.amend(toUnicode); 36868 } 36869} 36870 36871function amendFallbackToUnicode(properties) { 36872 if (!properties.fallbackToUnicode) { 36873 return; 36874 } 36875 36876 if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 36877 return; 36878 } 36879 36880 const toUnicode = []; 36881 36882 for (const charCode in properties.fallbackToUnicode) { 36883 if (properties.toUnicode.has(charCode)) { 36884 continue; 36885 } 36886 36887 toUnicode[charCode] = properties.fallbackToUnicode[charCode]; 36888 } 36889 36890 if (toUnicode.length > 0) { 36891 properties.toUnicode.amend(toUnicode); 36892 } 36893} 36894 36895class Glyph { 36896 constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { 36897 this.originalCharCode = originalCharCode; 36898 this.fontChar = fontChar; 36899 this.unicode = unicode; 36900 this.accent = accent; 36901 this.width = width; 36902 this.vmetric = vmetric; 36903 this.operatorListId = operatorListId; 36904 this.isSpace = isSpace; 36905 this.isInFont = isInFont; 36906 } 36907 36908 matchesForCache(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { 36909 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; 36910 } 36911 36912} 36913 36914function int16(b0, b1) { 36915 return (b0 << 8) + b1; 36916} 36917 36918function writeSignedInt16(bytes, index, value) { 36919 bytes[index + 1] = value; 36920 bytes[index] = value >>> 8; 36921} 36922 36923function signedInt16(b0, b1) { 36924 const value = (b0 << 8) + b1; 36925 return value & 1 << 15 ? value - 0x10000 : value; 36926} 36927 36928function int32(b0, b1, b2, b3) { 36929 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 36930} 36931 36932function string16(value) { 36933 return String.fromCharCode(value >> 8 & 0xff, value & 0xff); 36934} 36935 36936function safeString16(value) { 36937 if (value > 0x7fff) { 36938 value = 0x7fff; 36939 } else if (value < -0x8000) { 36940 value = -0x8000; 36941 } 36942 36943 return String.fromCharCode(value >> 8 & 0xff, value & 0xff); 36944} 36945 36946function isTrueTypeFile(file) { 36947 const header = file.peekBytes(4); 36948 return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true"; 36949} 36950 36951function isTrueTypeCollectionFile(file) { 36952 const header = file.peekBytes(4); 36953 return (0, _util.bytesToString)(header) === "ttcf"; 36954} 36955 36956function isOpenTypeFile(file) { 36957 const header = file.peekBytes(4); 36958 return (0, _util.bytesToString)(header) === "OTTO"; 36959} 36960 36961function isType1File(file) { 36962 const header = file.peekBytes(2); 36963 36964 if (header[0] === 0x25 && header[1] === 0x21) { 36965 return true; 36966 } 36967 36968 if (header[0] === 0x80 && header[1] === 0x01) { 36969 return true; 36970 } 36971 36972 return false; 36973} 36974 36975function isCFFFile(file) { 36976 const header = file.peekBytes(4); 36977 36978 if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) { 36979 return true; 36980 } 36981 36982 return false; 36983} 36984 36985function getFontFileType(file, { 36986 type, 36987 subtype, 36988 composite 36989}) { 36990 let fileType, fileSubtype; 36991 36992 if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) { 36993 if (composite) { 36994 fileType = "CIDFontType2"; 36995 } else { 36996 fileType = "TrueType"; 36997 } 36998 } else if (isOpenTypeFile(file)) { 36999 if (composite) { 37000 fileType = "CIDFontType2"; 37001 } else { 37002 fileType = "OpenType"; 37003 } 37004 } else if (isType1File(file)) { 37005 if (composite) { 37006 fileType = "CIDFontType0"; 37007 } else { 37008 fileType = type === "MMType1" ? "MMType1" : "Type1"; 37009 } 37010 } else if (isCFFFile(file)) { 37011 if (composite) { 37012 fileType = "CIDFontType0"; 37013 fileSubtype = "CIDFontType0C"; 37014 } else { 37015 fileType = type === "MMType1" ? "MMType1" : "Type1"; 37016 fileSubtype = "Type1C"; 37017 } 37018 } else { 37019 (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype."); 37020 fileType = type; 37021 fileSubtype = subtype; 37022 } 37023 37024 return [fileType, fileSubtype]; 37025} 37026 37027function applyStandardFontGlyphMap(map, glyphMap) {
37028 for (const charCode in glyphMap) { 37029 map[+charCode] = glyphMap[charCode]; 37030 } 37031} 37032 37033function buildToFontChar(encoding, glyphsUnicodeMap, differences) { 37034 const toFontChar = []; 37035 let unicode; 37036 37037 for (let i = 0, ii = encoding.length; i < ii; i++) { 37038 unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap); 37039 37040 if (unicode !== -1) { 37041 toFontChar[i] = unicode; 37042 } 37043 } 37044 37045 for (const charCode in differences) { 37046 unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap); 37047 37048 if (unicode !== -1) { 37049 toFontChar[+charCode] = unicode; 37050 } 37051 } 37052 37053 return toFontChar; 37054} 37055 37056function convertCidString(charCode, cid, shouldThrow = false) { 37057 switch (cid.length) { 37058 case 1: 37059 return cid.charCodeAt(0); 37060 37061 case 2: 37062 return cid.charCodeAt(0) << 8 | cid.charCodeAt(1); 37063 } 37064 37065 const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`; 37066 37067 if (shouldThrow) { 37068 throw new _util.FormatError(msg); 37069 } 37070 37071 (0, _util.warn)(msg); 37072 return cid; 37073} 37074 37075function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) { 37076 const newMap = Object.create(null); 37077 const toFontChar = []; 37078 let privateUseAreaIndex = 0; 37079 let nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; 37080 let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; 37081 37082 for (let originalCharCode in charCodeToGlyphId) { 37083 originalCharCode |= 0; 37084 let glyphId = charCodeToGlyphId[originalCharCode]; 37085 37086 if (!hasGlyph(glyphId)) { 37087 continue; 37088 } 37089 37090 if (nextAvailableFontCharCode > privateUseOffetEnd) { 37091 privateUseAreaIndex++; 37092 37093 if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) { 37094 (0, _util.warn)("Ran out of space in font private use area."); 37095 break; 37096 } 37097 37098 nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; 37099 privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; 37100 } 37101 37102 const fontCharCode = nextAvailableFontCharCode++; 37103 37104 if (glyphId === 0) { 37105 glyphId = newGlyphZeroId; 37106 } 37107 37108 newMap[fontCharCode] = glyphId; 37109 toFontChar[originalCharCode] = fontCharCode; 37110 } 37111 37112 return { 37113 toFontChar, 37114 charCodeToGlyphId: newMap, 37115 nextAvailableFontCharCode 37116 }; 37117} 37118 37119function getRanges(glyphs, numGlyphs) { 37120 const codes = []; 37121 37122 for (const charCode in glyphs) { 37123 if (glyphs[charCode] >= numGlyphs) { 37124 continue; 37125 } 37126 37127 codes.push({ 37128 fontCharCode: charCode | 0, 37129 glyphId: glyphs[charCode] 37130 }); 37131 } 37132 37133 if (codes.length === 0) { 37134 codes.push({ 37135 fontCharCode: 0, 37136 glyphId: 0 37137 }); 37138 } 37139 37140 codes.sort(function fontGetRangesSort(a, b) { 37141 return a.fontCharCode - b.fontCharCode; 37142 }); 37143 const ranges = []; 37144 const length = codes.length; 37145 37146 for (let n = 0; n < length;) { 37147 const start = codes[n].fontCharCode; 37148 const codeIndices = [codes[n].glyphId]; 37149 ++n; 37150 let end = start; 37151 37152 while (n < length && end + 1 === codes[n].fontCharCode) { 37153 codeIndices.push(codes[n].glyphId); 37154 ++end; 37155 ++n; 37156 37157 if (end === 0xffff) { 37158 break; 37159 } 37160 } 37161 37162 ranges.push([start, end, codeIndices]); 37163 } 37164 37165 return ranges; 37166} 37167 37168function createCmapTable(glyphs, numGlyphs) { 37169 const ranges = getRanges(glyphs, numGlyphs); 37170 const numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1; 37171 let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8); 37172 let i, ii, j, jj; 37173 37174 for (i = ranges.length - 1; i >= 0; --i) { 37175 if (ranges[i][0] <= 0xffff) { 37176 break; 37177 } 37178 } 37179 37180 const bmpLength = i + 1; 37181 37182 if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) { 37183 ranges[i][1] = 0xfffe; 37184 } 37185 37186 const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0; 37187 const segCount = bmpLength + trailingRangesCount; 37188 37189 const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2); 37190 37191 let startCount = ""; 37192 let endCount = ""; 37193 let idDeltas = ""; 37194 let idRangeOffsets = ""; 37195 let glyphsIds = ""; 37196 let bias = 0; 37197 let range, start, end, codes; 37198 37199 for (i = 0, ii = bmpLength; i < ii; i++) { 37200 range = ranges[i]; 37201 start = range[0]; 37202 end = range[1]; 37203 startCount += string16(start); 37204 endCount += string16(end); 37205 codes = range[2];
vendor: 7,461 bytes, lines 37206-37420
37206 let contiguous = true; 37207 37208 for (j = 1, jj = codes.length; j < jj; ++j) { 37209 if (codes[j] !== codes[j - 1] + 1) { 37210 contiguous = false; 37211 break; 37212 } 37213 } 37214 37215 if (!contiguous) { 37216 const offset = (segCount - i) * 2 + bias * 2; 37217 bias += end - start + 1; 37218 idDeltas += string16(0); 37219 idRangeOffsets += string16(offset); 37220 37221 for (j = 0, jj = codes.length; j < jj; ++j) { 37222 glyphsIds += string16(codes[j]); 37223 } 37224 } else { 37225 const startCode = codes[0]; 37226 idDeltas += string16(startCode - start & 0xffff); 37227 idRangeOffsets += string16(0); 37228 } 37229 } 37230 37231 if (trailingRangesCount > 0) { 37232 endCount += "\xFF\xFF"; 37233 startCount += "\xFF\xFF"; 37234 idDeltas += "\x00\x01"; 37235 idRangeOffsets += "\x00\x00"; 37236 } 37237 37238 const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds; 37239 let format31012 = ""; 37240 let header31012 = ""; 37241 37242 if (numTables > 1) { 37243 cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length); 37244 format31012 = ""; 37245 37246 for (i = 0, ii = ranges.length; i < ii; i++) { 37247 range = ranges[i]; 37248 start = range[0]; 37249 codes = range[2]; 37250 let code = codes[0]; 37251 37252 for (j = 1, jj = codes.length; j < jj; ++j) { 37253 if (codes[j] !== codes[j - 1] + 1) { 37254 end = range[0] + j - 1; 37255 format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code); 37256 start = end + 1; 37257 code = codes[j]; 37258 } 37259 } 37260 37261 format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code); 37262 } 37263 37264 header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12); 37265 } 37266 37267 return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012; 37268} 37269 37270function validateOS2Table(os2, file) { 37271 file.pos = (file.start || 0) + os2.offset; 37272 const version = file.getUint16(); 37273 file.skip(60); 37274 const selection = file.getUint16(); 37275 37276 if (version < 4 && selection & 0x0300) { 37277 return false; 37278 } 37279 37280 const firstChar = file.getUint16(); 37281 const lastChar = file.getUint16(); 37282 37283 if (firstChar > lastChar) { 37284 return false; 37285 } 37286 37287 file.skip(6); 37288 const usWinAscent = file.getUint16(); 37289 37290 if (usWinAscent === 0) { 37291 return false; 37292 } 37293 37294 os2.data[8] = os2.data[9] = 0; 37295 return true; 37296} 37297 37298function createOS2Table(properties, charstrings, override) { 37299 override = override || { 37300 unitsPerEm: 0, 37301 yMax: 0, 37302 yMin: 0, 37303 ascent: 0, 37304 descent: 0 37305 }; 37306 let ulUnicodeRange1 = 0; 37307 let ulUnicodeRange2 = 0; 37308 let ulUnicodeRange3 = 0; 37309 let ulUnicodeRange4 = 0; 37310 let firstCharIndex = null; 37311 let lastCharIndex = 0; 37312 37313 if (charstrings) { 37314 for (let code in charstrings) { 37315 code |= 0; 37316 37317 if (firstCharIndex > code || !firstCharIndex) { 37318 firstCharIndex = code; 37319 } 37320 37321 if (lastCharIndex < code) { 37322 lastCharIndex = code; 37323 } 37324 37325 const position = (0, _unicode.getUnicodeRangeFor)(code); 37326 37327 if (position < 32) { 37328 ulUnicodeRange1 |= 1 << position; 37329 } else if (position < 64) { 37330 ulUnicodeRange2 |= 1 << position - 32; 37331 } else if (position < 96) { 37332 ulUnicodeRange3 |= 1 << position - 64; 37333 } else if (position < 123) { 37334 ulUnicodeRange4 |= 1 << position - 96; 37335 } else { 37336 throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage"); 37337 } 37338 } 37339 37340 if (lastCharIndex > 0xffff) { 37341 lastCharIndex = 0xffff; 37342 } 37343 } else { 37344 firstCharIndex = 0; 37345 lastCharIndex = 255; 37346 } 37347 37348 const bbox = properties.bbox || [0, 0, 0, 0]; 37349 const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0]; 37350 const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS; 37351 const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3])); 37352 let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1])); 37353 37354 if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) { 37355 typoDescent = -typoDescent; 37356 } 37357 37358 const winAscent = override.yMax || typoAscent; 37359 const winDescent = -override.yMin || -typoDescent; 37360 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"; 37361} 37362 37363function createPostTable(properties) { 37364 const angle = Math.floor(properties.italicAngle * 2 ** 16); 37365 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"; 37366} 37367 37368function createPostscriptName(name) { 37369 return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63); 37370} 37371 37372function createNameTable(name, proto) { 37373 if (!proto) { 37374 proto = [[], []]; 37375 } 37376 37377 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"]; 37378 const stringsUnicode = []; 37379 let i, ii, j, jj, str; 37380 37381 for (i = 0, ii = strings.length; i < ii; i++) { 37382 str = proto[1][i] || strings[i]; 37383 const strBufUnicode = []; 37384 37385 for (j = 0, jj = str.length; j < jj; j++) { 37386 strBufUnicode.push(string16(str.charCodeAt(j))); 37387 } 37388 37389 stringsUnicode.push(strBufUnicode.join("")); 37390 } 37391 37392 const names = [strings, stringsUnicode]; 37393 const platforms = ["\x00\x01", "\x00\x03"]; 37394 const encodings = ["\x00\x00", "\x00\x01"]; 37395 const languages = ["\x00\x00", "\x04\x09"]; 37396 const namesRecordCount = strings.length * platforms.length; 37397 let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6); 37398 let strOffset = 0; 37399 37400 for (i = 0, ii = platforms.length; i < ii; i++) { 37401 const strs = names[i]; 37402 37403 for (j = 0, jj = strs.length; j < jj; j++) { 37404 str = strs[j]; 37405 const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset); 37406 nameTable += nameRecord; 37407 strOffset += str.length; 37408 } 37409 } 37410 37411 nameTable += strings.join("") + stringsUnicode.join(""); 37412 return nameTable; 37413} 37414 37415class Font { 37416 constructor(name, file, properties) { 37417 this.name = name; 37418 this.psName = null; 37419 this.mimetype = null; 37420 this.disableFontFace = false;
37421 this.loadedName = properties.loadedName; 37422 this.isType3Font = properties.isType3Font; 37423 this.missingFile = false; 37424 this.cssFontInfo = properties.cssFontInfo; 37425 this._charsCache = Object.create(null); 37426 this._glyphCache = Object.create(null); 37427 let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif); 37428 37429 if (!isSerifFont && !properties.isSimulatedFlags) { 37430 const baseName = name.replace(/[,_]/g, "-").split("-")[0], 37431 serifFonts = (0, _standard_fonts.getSerifFonts)(); 37432 37433 for (const namePart of baseName.split("+")) { 37434 if (serifFonts[namePart]) { 37435 isSerifFont = true; 37436 break; 37437 } 37438 } 37439 } 37440 37441 this.isSerifFont = isSerifFont; 37442 this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic); 37443 this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch); 37444 let type = properties.type; 37445 let subtype = properties.subtype; 37446 this.type = type; 37447 this.subtype = subtype; 37448 let fallbackName = "sans-serif"; 37449 37450 if (this.isMonospace) { 37451 fallbackName = "monospace"; 37452 } else if (this.isSerifFont) { 37453 fallbackName = "serif"; 37454 } 37455 37456 this.fallbackName = fallbackName; 37457 this.differences = properties.differences; 37458 this.widths = properties.widths; 37459 this.defaultWidth = properties.defaultWidth; 37460 this.composite = properties.composite; 37461 this.cMap = properties.cMap; 37462 this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS; 37463 this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS; 37464 this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; 37465 this.lineHeight = this.ascent - this.descent; 37466 this.fontMatrix = properties.fontMatrix; 37467 this.bbox = properties.bbox; 37468 this.defaultEncoding = properties.defaultEncoding; 37469 this.toUnicode = properties.toUnicode; 37470 this.toFontChar = []; 37471 37472 if (properties.type === "Type3") { 37473 for (let charCode = 0; charCode < 256; charCode++) { 37474 this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode]; 37475 } 37476 37477 this.fontType = _util.FontType.TYPE3; 37478 return; 37479 } 37480 37481 this.cidEncoding = properties.cidEncoding || ""; 37482 this.vertical = !!properties.vertical; 37483 37484 if (this.vertical) { 37485 this.vmetrics = properties.vmetrics; 37486 this.defaultVMetrics = properties.defaultVMetrics; 37487 } 37488 37489 if (!file || file.isEmpty) { 37490 if (file) { 37491 (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")"); 37492 } 37493 37494 this.fallbackToSystemFont(properties); 37495 return; 37496 } 37497 37498 [type, subtype] = getFontFileType(file, properties); 37499 37500 if (type !== this.type || subtype !== this.subtype) { 37501 (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`); 37502 } 37503 37504 let data; 37505 37506 try { 37507 switch (type) { 37508 case "MMType1": 37509 (0, _util.info)("MMType1 font (" + name + "), falling back to Type1."); 37510 37511 case "Type1": 37512 case "CIDFontType0": 37513 this.mimetype = "font/opentype"; 37514 const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties); 37515 adjustWidths(properties); 37516 data = this.convert(name, cff, properties); 37517 break; 37518 37519 case "OpenType": 37520 case "TrueType": 37521 case "CIDFontType2": 37522 this.mimetype = "font/opentype"; 37523 data = this.checkAndRepair(name, file, properties); 37524 37525 if (this.isOpenType) { 37526 adjustWidths(properties); 37527 type = "OpenType"; 37528 } 37529 37530 break; 37531 37532 default: 37533 throw new _util.FormatError(`Font ${type} is not supported`); 37534 } 37535 } catch (e) { 37536 (0, _util.warn)(e); 37537 this.fallbackToSystemFont(properties); 37538 return; 37539 } 37540 37541 amendFallbackToUnicode(properties); 37542 this.data = data; 37543 this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont); 37544 this.fontMatrix = properties.fontMatrix; 37545 this.widths = properties.widths; 37546 this.defaultWidth = properties.defaultWidth; 37547 this.toUnicode = properties.toUnicode; 37548 this.seacMap = properties.seacMap; 37549 } 37550 37551 get renderer() { 37552 const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED); 37553 37554 return (0, _util.shadow)(this, "renderer", renderer); 37555 } 37556 37557 exportData(extraProperties = false) { 37558 const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES; 37559 const data = Object.create(null); 37560 let property, value; 37561 37562 for (property of exportDataProperties) { 37563 value = this[property]; 37564 37565 if (value !== undefined) { 37566 data[property] = value; 37567 } 37568 } 37569 37570 return data; 37571 } 37572 37573 fallbackToSystemFont(properties) { 37574 this.missingFile = true; 37575 const name = this.name; 37576 const type = this.type; 37577 const subtype = this.subtype; 37578 let fontName = (0, _fonts_utils.normalizeFontName)(name); 37579 const stdFontMap = (0, _standard_fonts.getStdFontMap)(), 37580 nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)(); 37581 const isStandardFont = !!stdFontMap[fontName]; 37582 const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]); 37583 fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; 37584 this.bold = fontName.search(/bold/gi) !== -1; 37585 this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1; 37586 this.black = name.search(/Black/g) !== -1;
37587 const isNarrow = name.search(/Narrow/g) !== -1; 37588 this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0; 37589 37590 if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) { 37591 const cidToGidMap = properties.cidToGidMap; 37592 const map = []; 37593 applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)()); 37594 37595 if (/Arial-?Black/i.test(name)) { 37596 applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)()); 37597 } else if (/Calibri/i.test(name)) { 37598 applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)()); 37599 } 37600 37601 if (cidToGidMap) { 37602 for (const charCode in map) { 37603 const cid = map[charCode]; 37604 37605 if (cidToGidMap[cid] !== undefined) { 37606 map[+charCode] = cidToGidMap[cid]; 37607 } 37608 } 37609 37610 if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 37611 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 37612 const cid = map[charCode]; 37613 37614 if (cidToGidMap[cid] === undefined) { 37615 map[+charCode] = unicodeCharCode; 37616 } 37617 }); 37618 } 37619 } 37620 37621 if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) { 37622 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 37623 map[+charCode] = unicodeCharCode; 37624 }); 37625 } 37626 37627 this.toFontChar = map; 37628 this.toUnicode = new _to_unicode_map.ToUnicodeMap(map); 37629 } else if (/Symbol/i.test(fontName)) { 37630 this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences); 37631 } else if (/Dingbats/i.test(fontName)) { 37632 if (/Wingdings/i.test(name)) { 37633 (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats."); 37634 } 37635 37636 this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences); 37637 } else if (isStandardFont) { 37638 const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences); 37639 37640 if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) { 37641 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 37642 map[+charCode] = unicodeCharCode; 37643 }); 37644 } 37645 37646 this.toFontChar = map; 37647 } else { 37648 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 37649 const map = []; 37650 this.toUnicode.forEach((charCode, unicodeCharCode) => { 37651 if (!this.composite) { 37652 const glyphName = this.differences[charCode] || this.defaultEncoding[charCode]; 37653 const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 37654 37655 if (unicode !== -1) { 37656 unicodeCharCode = unicode; 37657 } 37658 } 37659 37660 map[+charCode] = unicodeCharCode; 37661 }); 37662 37663 if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 37664 if (/Verdana/i.test(name)) { 37665 applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)()); 37666 } 37667 } 37668 37669 this.toFontChar = map; 37670 } 37671 37672 amendFallbackToUnicode(properties); 37673 this.loadedName = fontName.split("-")[0]; 37674 this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont); 37675 } 37676 37677 checkAndRepair(name, font, properties) { 37678 const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "]; 37679 37680 function readTables(file, numTables) { 37681 const tables = Object.create(null); 37682 tables["OS/2"] = null; 37683 tables.cmap = null; 37684 tables.head = null; 37685 tables.hhea = null; 37686 tables.hmtx = null; 37687 tables.maxp = null; 37688 tables.name = null; 37689 tables.post = null; 37690 37691 for (let i = 0; i < numTables; i++) { 37692 const table = readTableEntry(file); 37693 37694 if (!VALID_TABLES.includes(table.tag)) { 37695 continue; 37696 } 37697 37698 if (table.length === 0) { 37699 continue; 37700 } 37701 37702 tables[table.tag] = table; 37703 } 37704 37705 return tables; 37706 } 37707 37708 function readTableEntry(file) { 37709 const tag = file.getString(4); 37710 const checksum = file.getInt32() >>> 0; 37711 const offset = file.getInt32() >>> 0; 37712 const length = file.getInt32() >>> 0; 37713 const previousPosition = file.pos; 37714 file.pos = file.start ? file.start : 0; 37715 file.skip(offset); 37716 const data = file.getBytes(length); 37717 file.pos = previousPosition; 37718 37719 if (tag === "head") { 37720 data[8] = data[9] = data[10] = data[11] = 0; 37721 data[17] |= 0x20; 37722 } 37723 37724 return { 37725 tag, 37726 checksum, 37727 length, 37728 offset, 37729 data 37730 }; 37731 } 37732 37733 function readOpenTypeHeader(ttf) { 37734 return { 37735 version: ttf.getString(4), 37736 numTables: ttf.getUint16(), 37737 searchRange: ttf.getUint16(), 37738 entrySelector: ttf.getUint16(), 37739 rangeShift: ttf.getUint16() 37740 }; 37741 } 37742 37743 function readTrueTypeCollectionHeader(ttc) { 37744 const ttcTag = ttc.getString(4); 37745 (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font."); 37746 const majorVersion = ttc.getUint16(); 37747 const minorVersion = ttc.getUint16(); 37748 const numFonts = ttc.getInt32() >>> 0; 37749 const offsetTable = []; 37750 37751 for (let i = 0; i < numFonts; i++) { 37752 offsetTable.push(ttc.getInt32() >>> 0); 37753 } 37754 37755 const header = { 37756 ttcTag, 37757 majorVersion, 37758 minorVersion, 37759 numFonts, 37760 offsetTable 37761 }; 37762 37763 switch (majorVersion) { 37764 case 1: 37765 return header; 37766 37767 case 2: 37768 header.dsigTag = ttc.getInt32() >>> 0; 37769 header.dsigLength = ttc.getInt32() >>> 0; 37770 header.dsigOffset = ttc.getInt32() >>> 0; 37771 return header; 37772 } 37773 37774 throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`); 37775 } 37776 37777 function readTrueTypeCollectionData(ttc, fontName) { 37778 const { 37779 numFonts, 37780 offsetTable 37781 } = readTrueTypeCollectionHeader(ttc); 37782 const fontNameParts = fontName.split("+"); 37783 let fallbackData; 37784 37785 for (let i = 0; i < numFonts; i++) { 37786 ttc.pos = (ttc.start || 0) + offsetTable[i]; 37787 const potentialHeader = readOpenTypeHeader(ttc); 37788 const potentialTables = readTables(ttc, potentialHeader.numTables); 37789 37790 if (!potentialTables.name) { 37791 throw new _util.FormatError('TrueType Collection font must contain a "name" table.'); 37792 } 37793 37794 const nameTable = readNameTable(potentialTables.name); 37795 37796 for (let j = 0, jj = nameTable.length; j < jj; j++) { 37797 for (let k = 0, kk = nameTable[j].length; k < kk; k++) { 37798 const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, ""); 37799 37800 if (!nameEntry) { 37801 continue; 37802 } 37803 37804 if (nameEntry === fontName) { 37805 return { 37806 header: potentialHeader, 37807 tables: potentialTables 37808 }; 37809 } 37810 37811 if (fontNameParts.length < 2) { 37812 continue; 37813 } 37814 37815 for (const part of fontNameParts) { 37816 if (nameEntry === part) { 37817 fallbackData = { 37818 name: part, 37819 header: potentialHeader, 37820 tables: potentialTables 37821 }; 37822 } 37823 } 37824 } 37825 } 37826 } 37827 37828 if (fallbackData) { 37829 (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`); 37830 return { 37831 header: fallbackData.header, 37832 tables: fallbackData.tables 37833 }; 37834 } 37835 37836 throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`); 37837 } 37838 37839 function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) { 37840 if (!cmap) { 37841 (0, _util.warn)("No cmap table available."); 37842 return { 37843 platformId: -1, 37844 encodingId: -1, 37845 mappings: [], 37846 hasShortCmap: false 37847 }; 37848 } 37849 37850 let segment; 37851 let start = (file.start ? file.start : 0) + cmap.offset; 37852 file.pos = start; 37853 file.skip(2); 37854 const numTables = file.getUint16(); 37855 let potentialTable; 37856 let canBreak = false;
vendor: 5,458 bytes, lines 37857-38051
37857 37858 for (let i = 0; i < numTables; i++) { 37859 const platformId = file.getUint16(); 37860 const encodingId = file.getUint16(); 37861 const offset = file.getInt32() >>> 0; 37862 let useTable = false; 37863 37864 if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) { 37865 continue; 37866 } 37867 37868 if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) { 37869 useTable = true; 37870 } else if (platformId === 1 && encodingId === 0) { 37871 useTable = true; 37872 } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) { 37873 useTable = true; 37874 37875 if (!isSymbolicFont) { 37876 canBreak = true; 37877 } 37878 } else if (isSymbolicFont && platformId === 3 && encodingId === 0) { 37879 useTable = true; 37880 let correctlySorted = true; 37881 37882 if (i < numTables - 1) { 37883 const nextBytes = file.peekBytes(2), 37884 nextPlatformId = int16(nextBytes[0], nextBytes[1]); 37885 37886 if (nextPlatformId < platformId) { 37887 correctlySorted = false; 37888 } 37889 } 37890 37891 if (correctlySorted) { 37892 canBreak = true; 37893 } 37894 } 37895 37896 if (useTable) { 37897 potentialTable = { 37898 platformId, 37899 encodingId, 37900 offset 37901 }; 37902 } 37903 37904 if (canBreak) { 37905 break; 37906 } 37907 } 37908 37909 if (potentialTable) { 37910 file.pos = start + potentialTable.offset; 37911 } 37912 37913 if (!potentialTable || file.peekByte() === -1) { 37914 (0, _util.warn)("Could not find a preferred cmap table."); 37915 return { 37916 platformId: -1, 37917 encodingId: -1, 37918 mappings: [], 37919 hasShortCmap: false 37920 }; 37921 } 37922 37923 const format = file.getUint16(); 37924 file.skip(2 + 2); 37925 let hasShortCmap = false; 37926 const mappings = []; 37927 let j, glyphId; 37928 37929 if (format === 0) { 37930 for (j = 0; j < 256; j++) { 37931 const index = file.getByte(); 37932 37933 if (!index) { 37934 continue; 37935 } 37936 37937 mappings.push({ 37938 charCode: j, 37939 glyphId: index 37940 }); 37941 } 37942 37943 hasShortCmap = true; 37944 } else if (format === 2) { 37945 const subHeaderKeys = []; 37946 let maxSubHeaderKey = 0; 37947 37948 for (let i = 0; i < 256; i++) { 37949 const subHeaderKey = file.getUint16() >> 3; 37950 subHeaderKeys.push(subHeaderKey); 37951 maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey); 37952 } 37953 37954 const subHeaders = []; 37955 37956 for (let i = 0; i <= maxSubHeaderKey; i++) { 37957 subHeaders.push({ 37958 firstCode: file.getUint16(), 37959 entryCount: file.getUint16(), 37960 idDelta: signedInt16(file.getByte(), file.getByte()), 37961 idRangePos: file.pos + file.getUint16() 37962 }); 37963 } 37964 37965 for (let i = 0; i < 256; i++) { 37966 if (subHeaderKeys[i] === 0) { 37967 file.pos = subHeaders[0].idRangePos + 2 * i; 37968 glyphId = file.getUint16(); 37969 mappings.push({ 37970 charCode: i, 37971 glyphId 37972 }); 37973 } else { 37974 const s = subHeaders[subHeaderKeys[i]]; 37975 37976 for (j = 0; j < s.entryCount; j++) { 37977 const charCode = (i << 8) + j + s.firstCode; 37978 file.pos = s.idRangePos + 2 * j; 37979 glyphId = file.getUint16(); 37980 37981 if (glyphId !== 0) { 37982 glyphId = (glyphId + s.idDelta) % 65536; 37983 } 37984 37985 mappings.push({ 37986 charCode, 37987 glyphId 37988 }); 37989 } 37990 } 37991 } 37992 } else if (format === 4) { 37993 const segCount = file.getUint16() >> 1; 37994 file.skip(6); 37995 const segments = []; 37996 let segIndex; 37997 37998 for (segIndex = 0; segIndex < segCount; segIndex++) { 37999 segments.push({ 38000 end: file.getUint16() 38001 }); 38002 } 38003 38004 file.skip(2); 38005 38006 for (segIndex = 0; segIndex < segCount; segIndex++) { 38007 segments[segIndex].start = file.getUint16(); 38008 } 38009 38010 for (segIndex = 0; segIndex < segCount; segIndex++) { 38011 segments[segIndex].delta = file.getUint16(); 38012 } 38013 38014 let offsetsCount = 0, 38015 offsetIndex; 38016 38017 for (segIndex = 0; segIndex < segCount; segIndex++) { 38018 segment = segments[segIndex]; 38019 const rangeOffset = file.getUint16(); 38020 38021 if (!rangeOffset) { 38022 segment.offsetIndex = -1; 38023 continue; 38024 } 38025 38026 offsetIndex = (rangeOffset >> 1) - (segCount - segIndex); 38027 segment.offsetIndex = offsetIndex; 38028 offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1); 38029 } 38030 38031 const offsets = []; 38032 38033 for (j = 0; j < offsetsCount; j++) { 38034 offsets.push(file.getUint16()); 38035 } 38036 38037 for (segIndex = 0; segIndex < segCount; segIndex++) { 38038 segment = segments[segIndex]; 38039 start = segment.start; 38040 const end = segment.end; 38041 const delta = segment.delta; 38042 offsetIndex = segment.offsetIndex; 38043 38044 for (j = start; j <= end; j++) { 38045 if (j === 0xffff) { 38046 continue; 38047 } 38048 38049 glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start]; 38050 glyphId = glyphId + delta & 0xffff; 38051 mappings.push({
38052 charCode: j, 38053 glyphId 38054 }); 38055 } 38056 } 38057 } else if (format === 6) { 38058 const firstCode = file.getUint16(); 38059 const entryCount = file.getUint16(); 38060 38061 for (j = 0; j < entryCount; j++) { 38062 glyphId = file.getUint16(); 38063 const charCode = firstCode + j; 38064 mappings.push({ 38065 charCode, 38066 glyphId 38067 }); 38068 } 38069 } else { 38070 (0, _util.warn)("cmap table has unsupported format: " + format); 38071 return { 38072 platformId: -1, 38073 encodingId: -1, 38074 mappings: [], 38075 hasShortCmap: false 38076 }; 38077 } 38078 38079 mappings.sort(function (a, b) { 38080 return a.charCode - b.charCode; 38081 }); 38082 38083 for (let i = 1; i < mappings.length; i++) { 38084 if (mappings[i - 1].charCode === mappings[i].charCode) { 38085 mappings.splice(i, 1); 38086 i--; 38087 } 38088 } 38089 38090 return { 38091 platformId: potentialTable.platformId, 38092 encodingId: potentialTable.encodingId, 38093 mappings, 38094 hasShortCmap 38095 }; 38096 } 38097 38098 function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) { 38099 if (!header) { 38100 if (metrics) { 38101 metrics.data = null; 38102 } 38103 38104 return; 38105 } 38106 38107 file.pos = (file.start ? file.start : 0) + header.offset; 38108 file.pos += 4; 38109 file.pos += 2; 38110 file.pos += 2; 38111 file.pos += 2; 38112 file.pos += 2; 38113 file.pos += 2; 38114 file.pos += 2; 38115 file.pos += 2; 38116 file.pos += 2; 38117 file.pos += 2; 38118 const caretOffset = file.getUint16(); 38119 file.pos += 8; 38120 file.pos += 2; 38121 let numOfMetrics = file.getUint16(); 38122 38123 if (caretOffset !== 0) { 38124 const macStyle = int16(headTable.data[44], headTable.data[45]); 38125 38126 if (!(macStyle & 2)) { 38127 header.data[22] = 0; 38128 header.data[23] = 0; 38129 } 38130 } 38131 38132 if (numOfMetrics > numGlyphs) { 38133 (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`); 38134 numOfMetrics = numGlyphs; 38135 header.data[34] = (numOfMetrics & 0xff00) >> 8; 38136 header.data[35] = numOfMetrics & 0x00ff; 38137 } 38138 38139 const numOfSidebearings = numGlyphs - numOfMetrics; 38140 const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1); 38141 38142 if (numMissing > 0) { 38143 const entries = new Uint8Array(metrics.length + numMissing * 2); 38144 entries.set(metrics.data); 38145 38146 if (dupFirstEntry) { 38147 entries[metrics.length] = metrics.data[2]; 38148 entries[metrics.length + 1] = metrics.data[3]; 38149 } 38150 38151 metrics.data = entries; 38152 } 38153 } 38154 38155 function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) { 38156 const glyphProfile = { 38157 length: 0, 38158 sizeOfInstructions: 0 38159 }; 38160 38161 if (sourceEnd - sourceStart <= 12) { 38162 return glyphProfile; 38163 } 38164 38165 const glyf = source.subarray(sourceStart, sourceEnd); 38166 let contoursCount = signedInt16(glyf[0], glyf[1]); 38167 38168 if (contoursCount < 0) { 38169 contoursCount = -1; 38170 writeSignedInt16(glyf, 0, contoursCount); 38171 dest.set(glyf, destStart); 38172 glyphProfile.length = glyf.length; 38173 return glyphProfile; 38174 } 38175 38176 let i, 38177 j = 10, 38178 flagsCount = 0; 38179 38180 for (i = 0; i < contoursCount; i++) { 38181 const endPoint = glyf[j] << 8 | glyf[j + 1]; 38182 flagsCount = endPoint + 1; 38183 j += 2; 38184 } 38185 38186 const instructionsStart = j; 38187 const instructionsLength = glyf[j] << 8 | glyf[j + 1]; 38188 glyphProfile.sizeOfInstructions = instructionsLength; 38189 j += 2 + instructionsLength; 38190 const instructionsEnd = j; 38191 let coordinatesLength = 0; 38192 38193 for (i = 0; i < flagsCount; i++) { 38194 const flag = glyf[j++]; 38195 38196 if (flag & 0xc0) { 38197 glyf[j - 1] = flag & 0x3f; 38198 } 38199 38200 let xLength = 2; 38201 38202 if (flag & 2) { 38203 xLength = 1; 38204 } else if (flag & 16) { 38205 xLength = 0; 38206 } 38207 38208 let yLength = 2; 38209 38210 if (flag & 4) { 38211 yLength = 1; 38212 } else if (flag & 32) { 38213 yLength = 0; 38214 } 38215 38216 const xyLength = xLength + yLength; 38217 coordinatesLength += xyLength; 38218 38219 if (flag & 8) { 38220 const repeat = glyf[j++]; 38221 i += repeat;
vendor: 16,635 bytes, lines 38222-38784
38222 coordinatesLength += repeat * xyLength; 38223 } 38224 } 38225 38226 if (coordinatesLength === 0) { 38227 return glyphProfile; 38228 } 38229 38230 let glyphDataLength = j + coordinatesLength; 38231 38232 if (glyphDataLength > glyf.length) { 38233 return glyphProfile; 38234 } 38235 38236 if (!hintsValid && instructionsLength > 0) { 38237 dest.set(glyf.subarray(0, instructionsStart), destStart); 38238 dest.set([0, 0], destStart + instructionsStart); 38239 dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2); 38240 glyphDataLength -= instructionsLength; 38241 38242 if (glyf.length - glyphDataLength > 3) { 38243 glyphDataLength = glyphDataLength + 3 & ~3; 38244 } 38245 38246 glyphProfile.length = glyphDataLength; 38247 return glyphProfile; 38248 } 38249 38250 if (glyf.length - glyphDataLength > 3) { 38251 glyphDataLength = glyphDataLength + 3 & ~3; 38252 dest.set(glyf.subarray(0, glyphDataLength), destStart); 38253 glyphProfile.length = glyphDataLength; 38254 return glyphProfile; 38255 } 38256 38257 dest.set(glyf, destStart); 38258 glyphProfile.length = glyf.length; 38259 return glyphProfile; 38260 } 38261 38262 function sanitizeHead(head, numGlyphs, locaLength) { 38263 const data = head.data; 38264 const version = int32(data[0], data[1], data[2], data[3]); 38265 38266 if (version >> 16 !== 1) { 38267 (0, _util.info)("Attempting to fix invalid version in head table: " + version); 38268 data[0] = 0; 38269 data[1] = 1; 38270 data[2] = 0; 38271 data[3] = 0; 38272 } 38273 38274 const indexToLocFormat = int16(data[50], data[51]); 38275 38276 if (indexToLocFormat < 0 || indexToLocFormat > 1) { 38277 (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat); 38278 const numGlyphsPlusOne = numGlyphs + 1; 38279 38280 if (locaLength === numGlyphsPlusOne << 1) { 38281 data[50] = 0; 38282 data[51] = 0; 38283 } else if (locaLength === numGlyphsPlusOne << 2) { 38284 data[50] = 0; 38285 data[51] = 1; 38286 } else { 38287 throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat); 38288 } 38289 } 38290 } 38291 38292 function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) { 38293 let itemSize, itemDecode, itemEncode; 38294 38295 if (isGlyphLocationsLong) { 38296 itemSize = 4; 38297 38298 itemDecode = function fontItemDecodeLong(data, offset) { 38299 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 38300 }; 38301 38302 itemEncode = function fontItemEncodeLong(data, offset, value) { 38303 data[offset] = value >>> 24 & 0xff; 38304 data[offset + 1] = value >> 16 & 0xff; 38305 data[offset + 2] = value >> 8 & 0xff; 38306 data[offset + 3] = value & 0xff; 38307 }; 38308 } else { 38309 itemSize = 2; 38310 38311 itemDecode = function fontItemDecode(data, offset) { 38312 return data[offset] << 9 | data[offset + 1] << 1; 38313 }; 38314 38315 itemEncode = function fontItemEncode(data, offset, value) { 38316 data[offset] = value >> 9 & 0xff; 38317 data[offset + 1] = value >> 1 & 0xff; 38318 }; 38319 } 38320 38321 const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs; 38322 const locaDataSize = itemSize * (1 + numGlyphsOut); 38323 const locaData = new Uint8Array(locaDataSize); 38324 locaData.set(loca.data.subarray(0, locaDataSize)); 38325 loca.data = locaData; 38326 const oldGlyfData = glyf.data; 38327 const oldGlyfDataLength = oldGlyfData.length; 38328 const newGlyfData = new Uint8Array(oldGlyfDataLength); 38329 let i, j; 38330 const locaEntries = []; 38331 38332 for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) { 38333 let offset = itemDecode(locaData, j); 38334 38335 if (offset > oldGlyfDataLength) { 38336 offset = oldGlyfDataLength; 38337 } 38338 38339 locaEntries.push({ 38340 index: i, 38341 offset, 38342 endOffset: 0 38343 }); 38344 } 38345 38346 locaEntries.sort((a, b) => { 38347 return a.offset - b.offset; 38348 }); 38349 38350 for (i = 0; i < numGlyphs; i++) { 38351 locaEntries[i].endOffset = locaEntries[i + 1].offset; 38352 } 38353 38354 locaEntries.sort((a, b) => { 38355 return a.index - b.index; 38356 }); 38357 const missingGlyphs = Object.create(null); 38358 let writeOffset = 0; 38359 itemEncode(locaData, 0, writeOffset); 38360 38361 for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) { 38362 const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid); 38363 const newLength = glyphProfile.length; 38364 38365 if (newLength === 0) { 38366 missingGlyphs[i] = true; 38367 } 38368 38369 if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) { 38370 maxSizeOfInstructions = glyphProfile.sizeOfInstructions; 38371 } 38372 38373 writeOffset += newLength; 38374 itemEncode(locaData, j, writeOffset); 38375 } 38376 38377 if (writeOffset === 0) { 38378 const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]); 38379 38380 for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) { 38381 itemEncode(locaData, j, simpleGlyph.length); 38382 } 38383 38384 glyf.data = simpleGlyph; 38385 } else if (dupFirstEntry) { 38386 const firstEntryLength = itemDecode(locaData, itemSize); 38387 38388 if (newGlyfData.length > firstEntryLength + writeOffset) { 38389 glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset); 38390 } else { 38391 glyf.data = new Uint8Array(firstEntryLength + writeOffset); 38392 glyf.data.set(newGlyfData.subarray(0, writeOffset)); 38393 } 38394 38395 glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset); 38396 itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength); 38397 } else { 38398 glyf.data = newGlyfData.subarray(0, writeOffset); 38399 } 38400 38401 return { 38402 missingGlyphs, 38403 maxSizeOfInstructions 38404 }; 38405 } 38406 38407 function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) { 38408 const start = (font.start ? font.start : 0) + post.offset; 38409 font.pos = start; 38410 const length = post.length, 38411 end = start + length; 38412 const version = font.getInt32(); 38413 font.skip(28); 38414 let glyphNames; 38415 let valid = true; 38416 let i; 38417 38418 switch (version) { 38419 case 0x00010000: 38420 glyphNames = _fonts_utils.MacStandardGlyphOrdering; 38421 break; 38422 38423 case 0x00020000: 38424 const numGlyphs = font.getUint16(); 38425 38426 if (numGlyphs !== maxpNumGlyphs) { 38427 valid = false; 38428 break; 38429 } 38430 38431 const glyphNameIndexes = []; 38432 38433 for (i = 0; i < numGlyphs; ++i) { 38434 const index = font.getUint16(); 38435 38436 if (index >= 32768) { 38437 valid = false; 38438 break; 38439 } 38440 38441 glyphNameIndexes.push(index); 38442 } 38443 38444 if (!valid) { 38445 break; 38446 } 38447 38448 const customNames = [], 38449 strBuf = []; 38450 38451 while (font.pos < end) { 38452 const stringLength = font.getByte(); 38453 strBuf.length = stringLength; 38454 38455 for (i = 0; i < stringLength; ++i) { 38456 strBuf[i] = String.fromCharCode(font.getByte()); 38457 } 38458 38459 customNames.push(strBuf.join("")); 38460 } 38461 38462 glyphNames = []; 38463 38464 for (i = 0; i < numGlyphs; ++i) { 38465 const j = glyphNameIndexes[i]; 38466 38467 if (j < 258) { 38468 glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]); 38469 continue; 38470 } 38471 38472 glyphNames.push(customNames[j - 258]); 38473 } 38474 38475 break; 38476 38477 case 0x00030000: 38478 break; 38479 38480 default: 38481 (0, _util.warn)("Unknown/unsupported post table version " + version); 38482 valid = false; 38483 38484 if (propertiesObj.defaultEncoding) { 38485 glyphNames = propertiesObj.defaultEncoding; 38486 } 38487 38488 break; 38489 } 38490 38491 propertiesObj.glyphNames = glyphNames; 38492 return valid; 38493 } 38494 38495 function readNameTable(nameTable) { 38496 const start = (font.start ? font.start : 0) + nameTable.offset; 38497 font.pos = start; 38498 const names = [[], []]; 38499 const length = nameTable.length, 38500 end = start + length; 38501 const format = font.getUint16(); 38502 const FORMAT_0_HEADER_LENGTH = 6; 38503 38504 if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) { 38505 return names; 38506 } 38507 38508 const numRecords = font.getUint16(); 38509 const stringsStart = font.getUint16(); 38510 const records = []; 38511 const NAME_RECORD_LENGTH = 12; 38512 let i, ii; 38513 38514 for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) { 38515 const r = { 38516 platform: font.getUint16(), 38517 encoding: font.getUint16(), 38518 language: font.getUint16(), 38519 name: font.getUint16(), 38520 length: font.getUint16(), 38521 offset: font.getUint16() 38522 }; 38523 38524 if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) { 38525 records.push(r); 38526 } 38527 } 38528 38529 for (i = 0, ii = records.length; i < ii; i++) { 38530 const record = records[i]; 38531 38532 if (record.length <= 0) { 38533 continue; 38534 } 38535 38536 const pos = start + stringsStart + record.offset; 38537 38538 if (pos + record.length > end) { 38539 continue; 38540 } 38541 38542 font.pos = pos; 38543 const nameIndex = record.name; 38544 38545 if (record.encoding) { 38546 let str = ""; 38547 38548 for (let j = 0, jj = record.length; j < jj; j += 2) { 38549 str += String.fromCharCode(font.getUint16()); 38550 } 38551 38552 names[1][nameIndex] = str; 38553 } else { 38554 names[0][nameIndex] = font.getString(record.length); 38555 } 38556 } 38557 38558 return names; 38559 } 38560 38561 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]; 38562 38563 function sanitizeTTProgram(table, ttContext) { 38564 let data = table.data; 38565 let i = 0, 38566 j, 38567 n, 38568 b, 38569 funcId, 38570 pc, 38571 lastEndf = 0, 38572 lastDeff = 0; 38573 const stack = []; 38574 const callstack = []; 38575 const functionsCalled = []; 38576 let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions; 38577 let inFDEF = false, 38578 ifLevel = 0, 38579 inELSE = 0; 38580 38581 for (let ii = data.length; i < ii;) { 38582 const op = data[i++]; 38583 38584 if (op === 0x40) { 38585 n = data[i++]; 38586 38587 if (inFDEF || inELSE) { 38588 i += n; 38589 } else { 38590 for (j = 0; j < n; j++) { 38591 stack.push(data[i++]); 38592 } 38593 } 38594 } else if (op === 0x41) { 38595 n = data[i++]; 38596 38597 if (inFDEF || inELSE) { 38598 i += n * 2; 38599 } else { 38600 for (j = 0; j < n; j++) { 38601 b = data[i++]; 38602 stack.push(b << 8 | data[i++]); 38603 } 38604 } 38605 } else if ((op & 0xf8) === 0xb0) { 38606 n = op - 0xb0 + 1; 38607 38608 if (inFDEF || inELSE) { 38609 i += n; 38610 } else { 38611 for (j = 0; j < n; j++) { 38612 stack.push(data[i++]); 38613 } 38614 } 38615 } else if ((op & 0xf8) === 0xb8) { 38616 n = op - 0xb8 + 1; 38617 38618 if (inFDEF || inELSE) { 38619 i += n * 2; 38620 } else { 38621 for (j = 0; j < n; j++) { 38622 b = data[i++]; 38623 stack.push(b << 8 | data[i++]); 38624 } 38625 } 38626 } else if (op === 0x2b && !tooComplexToFollowFunctions) { 38627 if (!inFDEF && !inELSE) { 38628 funcId = stack[stack.length - 1]; 38629 38630 if (isNaN(funcId)) { 38631 (0, _util.info)("TT: CALL empty stack (or invalid entry)."); 38632 } else { 38633 ttContext.functionsUsed[funcId] = true; 38634 38635 if (funcId in ttContext.functionsStackDeltas) { 38636 const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId]; 38637 38638 if (newStackLength < 0) { 38639 (0, _util.warn)("TT: CALL invalid functions stack delta."); 38640 ttContext.hintsValid = false; 38641 return; 38642 } 38643 38644 stack.length = newStackLength; 38645 } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) { 38646 callstack.push({ 38647 data, 38648 i, 38649 stackTop: stack.length - 1 38650 }); 38651 functionsCalled.push(funcId); 38652 pc = ttContext.functionsDefined[funcId]; 38653 38654 if (!pc) { 38655 (0, _util.warn)("TT: CALL non-existent function"); 38656 ttContext.hintsValid = false; 38657 return; 38658 } 38659 38660 data = pc.data; 38661 i = pc.i; 38662 } 38663 } 38664 } 38665 } else if (op === 0x2c && !tooComplexToFollowFunctions) { 38666 if (inFDEF || inELSE) { 38667 (0, _util.warn)("TT: nested FDEFs not allowed"); 38668 tooComplexToFollowFunctions = true; 38669 } 38670 38671 inFDEF = true; 38672 lastDeff = i; 38673 funcId = stack.pop(); 38674 ttContext.functionsDefined[funcId] = { 38675 data, 38676 i 38677 }; 38678 } else if (op === 0x2d) { 38679 if (inFDEF) { 38680 inFDEF = false; 38681 lastEndf = i; 38682 } else { 38683 pc = callstack.pop(); 38684 38685 if (!pc) { 38686 (0, _util.warn)("TT: ENDF bad stack"); 38687 ttContext.hintsValid = false; 38688 return; 38689 } 38690 38691 funcId = functionsCalled.pop(); 38692 data = pc.data; 38693 i = pc.i; 38694 ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop; 38695 } 38696 } else if (op === 0x89) { 38697 if (inFDEF || inELSE) { 38698 (0, _util.warn)("TT: nested IDEFs not allowed"); 38699 tooComplexToFollowFunctions = true; 38700 } 38701 38702 inFDEF = true; 38703 lastDeff = i; 38704 } else if (op === 0x58) { 38705 ++ifLevel; 38706 } else if (op === 0x1b) { 38707 inELSE = ifLevel; 38708 } else if (op === 0x59) { 38709 if (inELSE === ifLevel) { 38710 inELSE = 0; 38711 } 38712 38713 --ifLevel; 38714 } else if (op === 0x1c) { 38715 if (!inFDEF && !inELSE) { 38716 const offset = stack[stack.length - 1]; 38717 38718 if (offset > 0) { 38719 i += offset - 1; 38720 } 38721 } 38722 } 38723 38724 if (!inFDEF && !inELSE) { 38725 let stackDelta = 0; 38726 38727 if (op <= 0x8e) { 38728 stackDelta = TTOpsStackDeltas[op]; 38729 } else if (op >= 0xc0 && op <= 0xdf) { 38730 stackDelta = -1; 38731 } else if (op >= 0xe0) { 38732 stackDelta = -2; 38733 } 38734 38735 if (op >= 0x71 && op <= 0x75) { 38736 n = stack.pop(); 38737 38738 if (!isNaN(n)) { 38739 stackDelta = -n * 2; 38740 } 38741 } 38742 38743 while (stackDelta < 0 && stack.length > 0) { 38744 stack.pop(); 38745 stackDelta++; 38746 } 38747 38748 while (stackDelta > 0) { 38749 stack.push(NaN); 38750 stackDelta--; 38751 } 38752 } 38753 } 38754 38755 ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions; 38756 const content = [data]; 38757 38758 if (i > data.length) { 38759 content.push(new Uint8Array(i - data.length)); 38760 } 38761 38762 if (lastDeff > lastEndf) { 38763 (0, _util.warn)("TT: complementing a missing function tail"); 38764 content.push(new Uint8Array([0x22, 0x2d])); 38765 } 38766 38767 foldTTTable(table, content); 38768 } 38769 38770 function checkInvalidFunctions(ttContext, maxFunctionDefs) { 38771 if (ttContext.tooComplexToFollowFunctions) { 38772 return; 38773 } 38774 38775 if (ttContext.functionsDefined.length > maxFunctionDefs) { 38776 (0, _util.warn)("TT: more functions defined than expected"); 38777 ttContext.hintsValid = false; 38778 return; 38779 } 38780 38781 for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) { 38782 if (j > maxFunctionDefs) { 38783 (0, _util.warn)("TT: invalid function id: " + j); 38784 ttContext.hintsValid = false;
38785 return; 38786 } 38787 38788 if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) { 38789 (0, _util.warn)("TT: undefined function: " + j); 38790 ttContext.hintsValid = false; 38791 return; 38792 } 38793 } 38794 } 38795 38796 function foldTTTable(table, content) { 38797 if (content.length > 1) { 38798 let newLength = 0; 38799 let j, jj; 38800 38801 for (j = 0, jj = content.length; j < jj; j++) { 38802 newLength += content[j].length; 38803 } 38804 38805 newLength = newLength + 3 & ~3; 38806 const result = new Uint8Array(newLength); 38807 let pos = 0; 38808 38809 for (j = 0, jj = content.length; j < jj; j++) { 38810 result.set(content[j], pos); 38811 pos += content[j].length; 38812 } 38813 38814 table.data = result; 38815 table.length = newLength; 38816 } 38817 } 38818 38819 function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) { 38820 const ttContext = { 38821 functionsDefined: [], 38822 functionsUsed: [], 38823 functionsStackDeltas: [], 38824 tooComplexToFollowFunctions: false, 38825 hintsValid: true 38826 }; 38827 38828 if (fpgm) { 38829 sanitizeTTProgram(fpgm, ttContext); 38830 } 38831 38832 if (prep) { 38833 sanitizeTTProgram(prep, ttContext); 38834 } 38835 38836 if (fpgm) { 38837 checkInvalidFunctions(ttContext, maxFunctionDefs); 38838 } 38839 38840 if (cvt && cvt.length & 1) { 38841 const cvtData = new Uint8Array(cvt.length + 1); 38842 cvtData.set(cvt.data); 38843 cvt.data = cvtData; 38844 } 38845 38846 return ttContext.hintsValid; 38847 } 38848 38849 font = new _stream.Stream(new Uint8Array(font.getBytes())); 38850 let header, tables; 38851 38852 if (isTrueTypeCollectionFile(font)) { 38853 const ttcData = readTrueTypeCollectionData(font, this.name); 38854 header = ttcData.header; 38855 tables = ttcData.tables; 38856 } else { 38857 header = readOpenTypeHeader(font); 38858 tables = readTables(font, header.numTables); 38859 } 38860 38861 let cff, cffFile; 38862 const isTrueType = !tables["CFF "]; 38863 38864 if (!isTrueType) { 38865 const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap)); 38866 38867 if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) { 38868 cffFile = new _stream.Stream(tables["CFF "].data); 38869 cff = new _cff_font.CFFFont(cffFile, properties); 38870 adjustWidths(properties); 38871 return this.convert(name, cff, properties); 38872 } 38873 38874 delete tables.glyf; 38875 delete tables.loca; 38876 delete tables.fpgm; 38877 delete tables.prep; 38878 delete tables["cvt "]; 38879 this.isOpenType = true; 38880 } else { 38881 if (!tables.loca) { 38882 throw new _util.FormatError('Required "loca" table is not found'); 38883 } 38884 38885 if (!tables.glyf) { 38886 (0, _util.warn)('Required "glyf" table is not found -- trying to recover.'); 38887 tables.glyf = { 38888 tag: "glyf", 38889 data: new Uint8Array(0) 38890 }; 38891 } 38892 38893 this.isOpenType = false;
vendor: 4,651 bytes, lines 38894-39033
38894 } 38895 38896 if (!tables.maxp) { 38897 throw new _util.FormatError('Required "maxp" table is not found'); 38898 } 38899 38900 font.pos = (font.start || 0) + tables.maxp.offset; 38901 const version = font.getInt32(); 38902 const numGlyphs = font.getUint16(); 38903 38904 if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) { 38905 const { 38906 scaleFactors 38907 } = properties; 38908 const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]); 38909 const glyphs = new _glyf.GlyfTable({ 38910 glyfTable: tables.glyf.data, 38911 isGlyphLocationsLong, 38912 locaTable: tables.loca.data, 38913 numGlyphs 38914 }); 38915 glyphs.scale(scaleFactors); 38916 const { 38917 glyf, 38918 loca, 38919 isLocationLong 38920 } = glyphs.write(); 38921 tables.glyf.data = glyf; 38922 tables.loca.data = loca; 38923 38924 if (isLocationLong !== !!isGlyphLocationsLong) { 38925 tables.head.data[50] = 0; 38926 tables.head.data[51] = isLocationLong ? 1 : 0; 38927 } 38928 38929 const metrics = tables.hmtx.data; 38930 38931 for (let i = 0; i < numGlyphs; i++) { 38932 const j = 4 * i; 38933 const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1])); 38934 metrics[j] = advanceWidth >> 8 & 0xff; 38935 metrics[j + 1] = advanceWidth & 0xff; 38936 const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3])); 38937 writeSignedInt16(metrics, j + 2, lsb); 38938 } 38939 } 38940 38941 let numGlyphsOut = numGlyphs + 1; 38942 let dupFirstEntry = true; 38943 38944 if (numGlyphsOut > 0xffff) { 38945 dupFirstEntry = false; 38946 numGlyphsOut = numGlyphs; 38947 (0, _util.warn)("Not enough space in glyfs to duplicate first glyph."); 38948 } 38949 38950 let maxFunctionDefs = 0; 38951 let maxSizeOfInstructions = 0; 38952 38953 if (version >= 0x00010000 && tables.maxp.length >= 22) { 38954 font.pos += 8; 38955 const maxZones = font.getUint16(); 38956 38957 if (maxZones > 2) { 38958 tables.maxp.data[14] = 0; 38959 tables.maxp.data[15] = 2; 38960 } 38961 38962 font.pos += 4; 38963 maxFunctionDefs = font.getUint16(); 38964 font.pos += 4; 38965 maxSizeOfInstructions = font.getUint16(); 38966 } 38967 38968 tables.maxp.data[4] = numGlyphsOut >> 8; 38969 tables.maxp.data[5] = numGlyphsOut & 255; 38970 const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs); 38971 38972 if (!hintsValid) { 38973 delete tables.fpgm; 38974 delete tables.prep; 38975 delete tables["cvt "]; 38976 } 38977 38978 sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry); 38979 38980 if (!tables.head) { 38981 throw new _util.FormatError('Required "head" table is not found'); 38982 } 38983 38984 sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0); 38985 let missingGlyphs = Object.create(null); 38986 38987 if (isTrueType) { 38988 const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]); 38989 const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions); 38990 missingGlyphs = glyphsInfo.missingGlyphs; 38991 38992 if (version >= 0x00010000 && tables.maxp.length >= 22) { 38993 tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8; 38994 tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255; 38995 } 38996 } 38997 38998 if (!tables.hhea) { 38999 throw new _util.FormatError('Required "hhea" table is not found'); 39000 } 39001 39002 if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) { 39003 tables.hhea.data[10] = 0xff; 39004 tables.hhea.data[11] = 0xff; 39005 } 39006 39007 const metricsOverride = { 39008 unitsPerEm: int16(tables.head.data[18], tables.head.data[19]), 39009 yMax: int16(tables.head.data[42], tables.head.data[43]), 39010 yMin: signedInt16(tables.head.data[38], tables.head.data[39]), 39011 ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]), 39012 descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]), 39013 lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9]) 39014 }; 39015 this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm; 39016 this.descent = metricsOverride.descent / metricsOverride.unitsPerEm; 39017 this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm; 39018 39019 if (this.cssFontInfo && this.cssFontInfo.lineHeight) { 39020 this.lineHeight = this.cssFontInfo.metrics.lineHeight; 39021 this.lineGap = this.cssFontInfo.metrics.lineGap; 39022 } else { 39023 this.lineHeight = this.ascent - this.descent + this.lineGap; 39024 } 39025 39026 if (tables.post) { 39027 readPostScriptTable(tables.post, properties, numGlyphs); 39028 } 39029 39030 tables.post = { 39031 tag: "post", 39032 data: createPostTable(properties) 39033 };
39034 const charCodeToGlyphId = []; 39035 39036 function hasGlyph(glyphId) { 39037 return !missingGlyphs[glyphId]; 39038 } 39039 39040 if (properties.composite) { 39041 const cidToGidMap = properties.cidToGidMap || []; 39042 const isCidToGidMapEmpty = cidToGidMap.length === 0; 39043 properties.cMap.forEach(function (charCode, cid) { 39044 if (typeof cid === "string") { 39045 cid = convertCidString(charCode, cid, true); 39046 } 39047 39048 if (cid > 0xffff) { 39049 throw new _util.FormatError("Max size of CID is 65,535"); 39050 } 39051 39052 let glyphId = -1; 39053 39054 if (isCidToGidMapEmpty) { 39055 glyphId = cid; 39056 } else if (cidToGidMap[cid] !== undefined) { 39057 glyphId = cidToGidMap[cid]; 39058 } 39059 39060 if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) { 39061 charCodeToGlyphId[charCode] = glyphId; 39062 } 39063 }); 39064 } else { 39065 const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding); 39066 const cmapPlatformId = cmapTable.platformId; 39067 const cmapEncodingId = cmapTable.encodingId; 39068 const cmapMappings = cmapTable.mappings; 39069 const cmapMappingsLength = cmapMappings.length; 39070 let baseEncoding = [], 39071 forcePostTable = false; 39072 39073 if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) { 39074 baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName); 39075 } 39076 39077 if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) { 39078 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 39079 39080 for (let charCode = 0; charCode < 256; charCode++) { 39081 let glyphName; 39082 39083 if (this.differences[charCode] !== undefined) { 39084 glyphName = this.differences[charCode]; 39085 } else if (baseEncoding.length && baseEncoding[charCode] !== "") { 39086 glyphName = baseEncoding[charCode]; 39087 } else { 39088 glyphName = _encodings.StandardEncoding[charCode]; 39089 } 39090 39091 if (!glyphName) { 39092 continue; 39093 } 39094 39095 const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap); 39096 let unicodeOrCharCode; 39097 39098 if (cmapPlatformId === 3 && cmapEncodingId === 1) { 39099 unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName]; 39100 } else if (cmapPlatformId === 1 && cmapEncodingId === 0) { 39101 unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName); 39102 } 39103 39104 if (unicodeOrCharCode === undefined) { 39105 if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) { 39106 const unicode = this.toUnicode.get(charCode); 39107 39108 if (unicode) { 39109 unicodeOrCharCode = unicode.codePointAt(0); 39110 } 39111 } 39112 39113 if (unicodeOrCharCode === undefined) { 39114 continue; 39115 } 39116 } 39117 39118 for (let i = 0; i < cmapMappingsLength; ++i) { 39119 if (cmapMappings[i].charCode !== unicodeOrCharCode) { 39120 continue; 39121 } 39122 39123 charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; 39124 break; 39125 } 39126 } 39127 } else if (cmapPlatformId === 0) { 39128 for (let i = 0; i < cmapMappingsLength; ++i) { 39129 charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId; 39130 } 39131 39132 forcePostTable = true; 39133 } else { 39134 for (let i = 0; i < cmapMappingsLength; ++i) { 39135 let charCode = cmapMappings[i].charCode; 39136 39137 if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) { 39138 charCode &= 0xff; 39139 } 39140 39141 charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; 39142 } 39143 } 39144 39145 if (properties.glyphNames && (baseEncoding.length || this.differences.length)) { 39146 for (let i = 0; i < 256; ++i) { 39147 if (!forcePostTable && charCodeToGlyphId[i] !== undefined) { 39148 continue; 39149 } 39150 39151 const glyphName = this.differences[i] || baseEncoding[i]; 39152 39153 if (!glyphName) { 39154 continue; 39155 } 39156 39157 const glyphId = properties.glyphNames.indexOf(glyphName); 39158 39159 if (glyphId > 0 && hasGlyph(glyphId)) {
39160 charCodeToGlyphId[i] = glyphId; 39161 } 39162 } 39163 } 39164 } 39165 39166 if (charCodeToGlyphId.length === 0) { 39167 charCodeToGlyphId[0] = 0; 39168 } 39169 39170 let glyphZeroId = numGlyphsOut - 1; 39171 39172 if (!dupFirstEntry) { 39173 glyphZeroId = 0; 39174 } 39175 39176 if (!properties.cssFontInfo) { 39177 const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId); 39178 this.toFontChar = newMapping.toFontChar; 39179 tables.cmap = { 39180 tag: "cmap", 39181 data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut) 39182 }; 39183 39184 if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) { 39185 tables["OS/2"] = { 39186 tag: "OS/2", 39187 data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride) 39188 }; 39189 } 39190 } 39191 39192 if (!isTrueType) { 39193 try { 39194 cffFile = new _stream.Stream(tables["CFF "].data); 39195 const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED); 39196 cff = parser.parse(); 39197 cff.duplicateFirstGlyph(); 39198 const compiler = new _cff_parser.CFFCompiler(cff); 39199 tables["CFF "].data = compiler.compile(); 39200 } catch (e) { 39201 (0, _util.warn)("Failed to compile font " + properties.loadedName); 39202 } 39203 } 39204 39205 if (!tables.name) { 39206 tables.name = { 39207 tag: "name", 39208 data: createNameTable(this.name) 39209 }; 39210 } else { 39211 const namePrototype = readNameTable(tables.name); 39212 tables.name.data = createNameTable(name, namePrototype); 39213 this.psName = namePrototype[0][6] || null; 39214 } 39215 39216 const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version); 39217 39218 for (const tableTag in tables) { 39219 builder.addTable(tableTag, tables[tableTag].data); 39220 } 39221 39222 return builder.toArray(); 39223 } 39224 39225 convert(fontName, font, properties) { 39226 properties.fixedPitch = false; 39227 39228 if (properties.builtInEncoding) { 39229 adjustToUnicode(properties, properties.builtInEncoding); 39230 } 39231 39232 let glyphZeroId = 1; 39233 39234 if (font instanceof _cff_font.CFFFont) { 39235 glyphZeroId = font.numGlyphs - 1; 39236 } 39237 39238 const mapping = font.getGlyphMapping(properties); 39239 let newMapping = null; 39240 let newCharCodeToGlyphId = mapping; 39241 39242 if (!properties.cssFontInfo) { 39243 newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId); 39244 this.toFontChar = newMapping.toFontChar; 39245 newCharCodeToGlyphId = newMapping.charCodeToGlyphId; 39246 } 39247 39248 const numGlyphs = font.numGlyphs; 39249 39250 function getCharCodes(charCodeToGlyphId, glyphId) { 39251 let charCodes = null; 39252 39253 for (const charCode in charCodeToGlyphId) { 39254 if (glyphId === charCodeToGlyphId[charCode]) { 39255 if (!charCodes) { 39256 charCodes = []; 39257 } 39258 39259 charCodes.push(charCode | 0); 39260 } 39261 } 39262 39263 return charCodes; 39264 } 39265 39266 function createCharCode(charCodeToGlyphId, glyphId) { 39267 for (const charCode in charCodeToGlyphId) { 39268 if (glyphId === charCodeToGlyphId[charCode]) { 39269 return charCode | 0; 39270 } 39271 } 39272 39273 newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId; 39274 return newMapping.nextAvailableFontCharCode++; 39275 } 39276 39277 const seacs = font.seacs; 39278 39279 if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) { 39280 const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX; 39281 const charset = font.getCharset(); 39282 const seacMap = Object.create(null); 39283 39284 for (let glyphId in seacs) { 39285 glyphId |= 0; 39286 const seac = seacs[glyphId]; 39287 const baseGlyphName = _encodings.StandardEncoding[seac[2]]; 39288 const accentGlyphName = _encodings.StandardEncoding[seac[3]]; 39289 const baseGlyphId = charset.indexOf(baseGlyphName); 39290 const accentGlyphId = charset.indexOf(accentGlyphName); 39291 39292 if (baseGlyphId < 0 || accentGlyphId < 0) { 39293 continue; 39294 } 39295 39296 const accentOffset = { 39297 x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4], 39298 y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5] 39299 };
39300 const charCodes = getCharCodes(mapping, glyphId); 39301 39302 if (!charCodes) { 39303 continue; 39304 } 39305 39306 for (let i = 0, ii = charCodes.length; i < ii; i++) { 39307 const charCode = charCodes[i]; 39308 const charCodeToGlyphId = newMapping.charCodeToGlyphId; 39309 const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId); 39310 const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId); 39311 seacMap[charCode] = { 39312 baseFontCharCode, 39313 accentFontCharCode, 39314 accentOffset 39315 }; 39316 } 39317 } 39318 39319 properties.seacMap = seacMap; 39320 } 39321 39322 const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0]; 39323 const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F"); 39324 builder.addTable("CFF ", font.data); 39325 builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId)); 39326 builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, numGlyphs)); 39327 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"); 39328 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)); 39329 builder.addTable("hmtx", function fontFieldsHmtx() { 39330 const charstrings = font.charstrings; 39331 const cffWidths = font.cff ? font.cff.widths : null; 39332 let hmtx = "\x00\x00\x00\x00"; 39333 39334 for (let i = 1, ii = numGlyphs; i < ii; i++) { 39335 let width = 0; 39336 39337 if (charstrings) { 39338 const charstring = charstrings[i - 1]; 39339 width = "width" in charstring ? charstring.width : 0; 39340 } else if (cffWidths) { 39341 width = Math.ceil(cffWidths[i] || 0); 39342 } 39343 39344 hmtx += string16(width) + string16(0); 39345 } 39346 39347 return hmtx; 39348 }()); 39349 builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs)); 39350 builder.addTable("name", createNameTable(fontName)); 39351 builder.addTable("post", createPostTable(properties)); 39352 return builder.toArray(); 39353 } 39354 39355 get spaceWidth() { 39356 const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"]; 39357 let width; 39358 39359 for (let i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) { 39360 const glyphName = possibleSpaceReplacements[i]; 39361 39362 if (glyphName in this.widths) { 39363 width = this.widths[glyphName]; 39364 break; 39365 } 39366 39367 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 39368 const glyphUnicode = glyphsUnicodeMap[glyphName]; 39369 let charcode = 0; 39370 39371 if (this.composite && this.cMap.contains(glyphUnicode)) { 39372 charcode = this.cMap.lookup(glyphUnicode); 39373 39374 if (typeof charcode === "string") { 39375 charcode = convertCidString(glyphUnicode, charcode); 39376 } 39377 } 39378 39379 if (!charcode && this.toUnicode) { 39380 charcode = this.toUnicode.charCodeOf(glyphUnicode); 39381 } 39382 39383 if (charcode <= 0) { 39384 charcode = glyphUnicode; 39385 } 39386 39387 width = this.widths[charcode]; 39388 39389 if (width) { 39390 break; 39391 } 39392 } 39393 39394 width = width || this.defaultWidth; 39395 return (0, _util.shadow)(this, "spaceWidth", width); 39396 } 39397 39398 _charToGlyph(charcode, isSpace = false) { 39399 let fontCharCode, width, operatorListId; 39400 let widthCode = charcode; 39401 39402 if (this.cMap && this.cMap.contains(charcode)) { 39403 widthCode = this.cMap.lookup(charcode); 39404 39405 if (typeof widthCode === "string") { 39406 widthCode = convertCidString(charcode, widthCode); 39407 } 39408 } 39409 39410 width = this.widths[widthCode]; 39411 width = (0, _util.isNum)(width) ? width : this.defaultWidth; 39412 const vmetric = this.vmetrics && this.vmetrics[widthCode]; 39413 let unicode = this.toUnicode.get(charcode) || charcode; 39414 39415 if (typeof unicode === "number") { 39416 unicode = String.fromCharCode(unicode); 39417 } 39418 39419 let isInFont = this.toFontChar[charcode] !== undefined; 39420 fontCharCode = this.toFontChar[charcode] || charcode; 39421 39422 if (this.missingFile) { 39423 const glyphName = this.differences[charcode] || this.defaultEncoding[charcode]; 39424 39425 if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") { 39426 fontCharCode = 0x20; 39427 } 39428 39429 fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode); 39430 } 39431 39432 if (this.isType3Font) { 39433 operatorListId = fontCharCode; 39434 } 39435 39436 let accent = null; 39437 39438 if (this.seacMap && this.seacMap[charcode]) { 39439 isInFont = true; 39440 const seac = this.seacMap[charcode]; 39441 fontCharCode = seac.baseFontCharCode; 39442 accent = { 39443 fontChar: String.fromCodePoint(seac.accentFontCharCode),
39444 offset: seac.accentOffset 39445 }; 39446 } 39447 39448 let fontChar = ""; 39449 39450 if (typeof fontCharCode === "number") { 39451 if (fontCharCode <= 0x10ffff) { 39452 fontChar = String.fromCodePoint(fontCharCode); 39453 } else { 39454 (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`); 39455 } 39456 } 39457 39458 let glyph = this._glyphCache[charcode]; 39459 39460 if (!glyph || !glyph.matchesForCache(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) { 39461 glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont); 39462 this._glyphCache[charcode] = glyph; 39463 } 39464 39465 return glyph; 39466 } 39467 39468 charsToGlyphs(chars) { 39469 let glyphs = this._charsCache[chars]; 39470 39471 if (glyphs) { 39472 return glyphs; 39473 } 39474 39475 glyphs = []; 39476 39477 if (this.cMap) { 39478 const c = Object.create(null), 39479 ii = chars.length; 39480 let i = 0; 39481 39482 while (i < ii) { 39483 this.cMap.readCharCode(chars, i, c); 39484 const { 39485 charcode, 39486 length 39487 } = c; 39488 i += length; 39489 39490 const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20); 39491 39492 glyphs.push(glyph); 39493 } 39494 } else { 39495 for (let i = 0, ii = chars.length; i < ii; ++i) { 39496 const charcode = chars.charCodeAt(i); 39497 39498 const glyph = this._charToGlyph(charcode, charcode === 0x20); 39499 39500 glyphs.push(glyph); 39501 } 39502 } 39503 39504 return this._charsCache[chars] = glyphs; 39505 } 39506 39507 getCharPositions(chars) { 39508 const positions = []; 39509 39510 if (this.cMap) { 39511 const c = Object.create(null); 39512 let i = 0; 39513 39514 while (i < chars.length) { 39515 this.cMap.readCharCode(chars, i, c); 39516 const length = c.length; 39517 positions.push([i, i + length]); 39518 i += length; 39519 } 39520 } else { 39521 for (let i = 0, ii = chars.length; i < ii; ++i) { 39522 positions.push([i, i + 1]); 39523 } 39524 } 39525 39526 return positions; 39527 } 39528 39529 get glyphCacheValues() { 39530 return Object.values(this._glyphCache); 39531 } 39532 39533 encodeString(str) { 39534 const buffers = []; 39535 const currentBuf = []; 39536 39537 const hasCurrentBufErrors = () => buffers.length % 2 === 1; 39538 39539 const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode)); 39540 39541 for (let i = 0, ii = str.length; i < ii; i++) { 39542 const unicode = str.codePointAt(i); 39543 39544 if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) { 39545 i++; 39546 } 39547 39548 if (this.toUnicode) { 39549 const charCode = getCharCode(unicode); 39550 39551 if (charCode !== -1) { 39552 if (hasCurrentBufErrors()) { 39553 buffers.push(currentBuf.join("")); 39554 currentBuf.length = 0; 39555 } 39556 39557 const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1; 39558 39559 for (let j = charCodeLength - 1; j >= 0; j--) { 39560 currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff)); 39561 } 39562 39563 continue; 39564 } 39565 } 39566 39567 if (!hasCurrentBufErrors()) { 39568 buffers.push(currentBuf.join("")); 39569 currentBuf.length = 0; 39570 } 39571 39572 currentBuf.push(String.fromCodePoint(unicode)); 39573 } 39574 39575 buffers.push(currentBuf.join("")); 39576 return buffers; 39577 } 39578 39579} 39580 39581exports.Font = Font; 39582 39583class ErrorFont { 39584 constructor(error) { 39585 this.error = error; 39586 this.loadedName = "g_font_error"; 39587 this.missingFile = true; 39588 } 39589 39590 charsToGlyphs() { 39591 return []; 39592 } 39593 39594 encodeString(chars) { 39595 return [chars]; 39596 } 39597 39598 exportData(extraProperties = false) { 39599 return { 39600 error: this.error 39601 }; 39602 } 39603 39604} 39605 39606exports.ErrorFont = ErrorFont; 39607 39608/***/ }), 39609/* 45 */ 39610/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 39611 39612 39613 39614Object.defineProperty(exports, "__esModule", ({ 39615 value: true 39616})); 39617exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0; 39618 39619var _util = __w_pdfjs_require__(2); 39620 39621var _charsets = __w_pdfjs_require__(46); 39622 39623var _encodings = __w_pdfjs_require__(19); 39624 39625const MAX_SUBR_NESTING = 10; 39626const 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: 31,329 bytes, lines 39626-40721
39626ntered", "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"]; 39627exports.CFFStandardStrings = CFFStandardStrings; 39628const NUM_STANDARD_CFF_STRINGS = 391; 39629 39630const CFFParser = function CFFParserClosure() { 39631 const CharstringValidationData = [null, { 39632 id: "hstem", 39633 min: 2, 39634 stackClearing: true, 39635 stem: true 39636 }, null, { 39637 id: "vstem", 39638 min: 2, 39639 stackClearing: true, 39640 stem: true 39641 }, { 39642 id: "vmoveto", 39643 min: 1, 39644 stackClearing: true 39645 }, { 39646 id: "rlineto", 39647 min: 2, 39648 resetStack: true 39649 }, { 39650 id: "hlineto", 39651 min: 1, 39652 resetStack: true 39653 }, { 39654 id: "vlineto", 39655 min: 1, 39656 resetStack: true 39657 }, { 39658 id: "rrcurveto", 39659 min: 6, 39660 resetStack: true 39661 }, null, { 39662 id: "callsubr", 39663 min: 1, 39664 undefStack: true 39665 }, { 39666 id: "return", 39667 min: 0, 39668 undefStack: true 39669 }, null, null, { 39670 id: "endchar", 39671 min: 0, 39672 stackClearing: true 39673 }, null, null, null, { 39674 id: "hstemhm", 39675 min: 2, 39676 stackClearing: true, 39677 stem: true 39678 }, { 39679 id: "hintmask", 39680 min: 0, 39681 stackClearing: true 39682 }, { 39683 id: "cntrmask", 39684 min: 0, 39685 stackClearing: true 39686 }, { 39687 id: "rmoveto", 39688 min: 2, 39689 stackClearing: true 39690 }, { 39691 id: "hmoveto", 39692 min: 1, 39693 stackClearing: true 39694 }, { 39695 id: "vstemhm", 39696 min: 2, 39697 stackClearing: true, 39698 stem: true 39699 }, { 39700 id: "rcurveline", 39701 min: 8, 39702 resetStack: true 39703 }, { 39704 id: "rlinecurve", 39705 min: 8, 39706 resetStack: true 39707 }, { 39708 id: "vvcurveto", 39709 min: 4, 39710 resetStack: true 39711 }, { 39712 id: "hhcurveto", 39713 min: 4, 39714 resetStack: true 39715 }, null, { 39716 id: "callgsubr", 39717 min: 1, 39718 undefStack: true 39719 }, { 39720 id: "vhcurveto", 39721 min: 4, 39722 resetStack: true 39723 }, { 39724 id: "hvcurveto", 39725 min: 4, 39726 resetStack: true 39727 }]; 39728 const CharstringValidationData12 = [null, null, null, { 39729 id: "and", 39730 min: 2, 39731 stackDelta: -1 39732 }, { 39733 id: "or", 39734 min: 2, 39735 stackDelta: -1 39736 }, { 39737 id: "not", 39738 min: 1, 39739 stackDelta: 0 39740 }, null, null, null, { 39741 id: "abs", 39742 min: 1, 39743 stackDelta: 0 39744 }, { 39745 id: "add", 39746 min: 2, 39747 stackDelta: -1, 39748 stackFn: function stack_div(stack, index) { 39749 stack[index - 2] = stack[index - 2] + stack[index - 1]; 39750 } 39751 }, { 39752 id: "sub", 39753 min: 2, 39754 stackDelta: -1, 39755 stackFn: function stack_div(stack, index) { 39756 stack[index - 2] = stack[index - 2] - stack[index - 1]; 39757 } 39758 }, { 39759 id: "div", 39760 min: 2, 39761 stackDelta: -1, 39762 stackFn: function stack_div(stack, index) { 39763 stack[index - 2] = stack[index - 2] / stack[index - 1]; 39764 } 39765 }, null, { 39766 id: "neg", 39767 min: 1, 39768 stackDelta: 0, 39769 stackFn: function stack_div(stack, index) { 39770 stack[index - 1] = -stack[index - 1]; 39771 } 39772 }, { 39773 id: "eq", 39774 min: 2, 39775 stackDelta: -1 39776 }, null, null, { 39777 id: "drop", 39778 min: 1, 39779 stackDelta: -1 39780 }, null, { 39781 id: "put", 39782 min: 2, 39783 stackDelta: -2 39784 }, { 39785 id: "get", 39786 min: 1, 39787 stackDelta: 0 39788 }, { 39789 id: "ifelse", 39790 min: 4, 39791 stackDelta: -3 39792 }, { 39793 id: "random", 39794 min: 0, 39795 stackDelta: 1 39796 }, { 39797 id: "mul", 39798 min: 2, 39799 stackDelta: -1, 39800 stackFn: function stack_div(stack, index) { 39801 stack[index - 2] = stack[index - 2] * stack[index - 1]; 39802 } 39803 }, null, { 39804 id: "sqrt", 39805 min: 1, 39806 stackDelta: 0 39807 }, { 39808 id: "dup", 39809 min: 1, 39810 stackDelta: 1 39811 }, { 39812 id: "exch", 39813 min: 2, 39814 stackDelta: 0 39815 }, { 39816 id: "index", 39817 min: 2, 39818 stackDelta: 0 39819 }, { 39820 id: "roll", 39821 min: 3, 39822 stackDelta: -2 39823 }, null, null, null, { 39824 id: "hflex", 39825 min: 7, 39826 resetStack: true 39827 }, { 39828 id: "flex", 39829 min: 13, 39830 resetStack: true 39831 }, { 39832 id: "hflex1", 39833 min: 9, 39834 resetStack: true 39835 }, { 39836 id: "flex1", 39837 min: 11, 39838 resetStack: true 39839 }]; 39840 39841 class CFFParser { 39842 constructor(file, properties, seacAnalysisEnabled) { 39843 this.bytes = file.getBytes(); 39844 this.properties = properties; 39845 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 39846 } 39847 39848 parse() { 39849 const properties = this.properties; 39850 const cff = new CFF(); 39851 this.cff = cff; 39852 const header = this.parseHeader(); 39853 const nameIndex = this.parseIndex(header.endPos); 39854 const topDictIndex = this.parseIndex(nameIndex.endPos); 39855 const stringIndex = this.parseIndex(topDictIndex.endPos); 39856 const globalSubrIndex = this.parseIndex(stringIndex.endPos); 39857 const topDictParsed = this.parseDict(topDictIndex.obj.get(0)); 39858 const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings); 39859 cff.header = header.obj; 39860 cff.names = this.parseNameIndex(nameIndex.obj); 39861 cff.strings = this.parseStringIndex(stringIndex.obj); 39862 cff.topDict = topDict; 39863 cff.globalSubrIndex = globalSubrIndex.obj; 39864 this.parsePrivateDict(cff.topDict); 39865 cff.isCIDFont = topDict.hasName("ROS"); 39866 const charStringOffset = topDict.getByName("CharStrings"); 39867 const charStringIndex = this.parseIndex(charStringOffset).obj; 39868 const fontMatrix = topDict.getByName("FontMatrix"); 39869 39870 if (fontMatrix) { 39871 properties.fontMatrix = fontMatrix; 39872 } 39873 39874 const fontBBox = topDict.getByName("FontBBox"); 39875 39876 if (fontBBox) { 39877 properties.ascent = Math.max(fontBBox[3], fontBBox[1]); 39878 properties.descent = Math.min(fontBBox[1], fontBBox[3]); 39879 properties.ascentScaled = true; 39880 } 39881 39882 let charset, encoding; 39883 39884 if (cff.isCIDFont) { 39885 const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj; 39886 39887 for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) { 39888 const dictRaw = fdArrayIndex.get(i); 39889 const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings); 39890 this.parsePrivateDict(fontDict); 39891 cff.fdArray.push(fontDict); 39892 } 39893 39894 encoding = null; 39895 charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true); 39896 cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count); 39897 } else { 39898 charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false); 39899 encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset); 39900 } 39901 39902 cff.charset = charset; 39903 cff.encoding = encoding; 39904 const charStringsAndSeacs = this.parseCharStrings({ 39905 charStrings: charStringIndex, 39906 localSubrIndex: topDict.privateDict.subrsIndex, 39907 globalSubrIndex: globalSubrIndex.obj, 39908 fdSelect: cff.fdSelect, 39909 fdArray: cff.fdArray, 39910 privateDict: topDict.privateDict 39911 }); 39912 cff.charStrings = charStringsAndSeacs.charStrings; 39913 cff.seacs = charStringsAndSeacs.seacs; 39914 cff.widths = charStringsAndSeacs.widths; 39915 return cff; 39916 } 39917 39918 parseHeader() { 39919 let bytes = this.bytes; 39920 const bytesLength = bytes.length; 39921 let offset = 0; 39922 39923 while (offset < bytesLength && bytes[offset] !== 1) { 39924 ++offset; 39925 } 39926 39927 if (offset >= bytesLength) { 39928 throw new _util.FormatError("Invalid CFF header"); 39929 } 39930 39931 if (offset !== 0) { 39932 (0, _util.info)("cff data is shifted"); 39933 bytes = bytes.subarray(offset); 39934 this.bytes = bytes; 39935 } 39936 39937 const major = bytes[0]; 39938 const minor = bytes[1]; 39939 const hdrSize = bytes[2]; 39940 const offSize = bytes[3]; 39941 const header = new CFFHeader(major, minor, hdrSize, offSize); 39942 return { 39943 obj: header, 39944 endPos: hdrSize 39945 }; 39946 } 39947 39948 parseDict(dict) { 39949 let pos = 0; 39950 39951 function parseOperand() { 39952 let value = dict[pos++]; 39953 39954 if (value === 30) { 39955 return parseFloatOperand(); 39956 } else if (value === 28) { 39957 value = dict[pos++]; 39958 value = (value << 24 | dict[pos++] << 16) >> 16; 39959 return value; 39960 } else if (value === 29) { 39961 value = dict[pos++]; 39962 value = value << 8 | dict[pos++]; 39963 value = value << 8 | dict[pos++]; 39964 value = value << 8 | dict[pos++]; 39965 return value; 39966 } else if (value >= 32 && value <= 246) { 39967 return value - 139; 39968 } else if (value >= 247 && value <= 250) { 39969 return (value - 247) * 256 + dict[pos++] + 108; 39970 } else if (value >= 251 && value <= 254) { 39971 return -((value - 251) * 256) - dict[pos++] - 108; 39972 } 39973 39974 (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.'); 39975 return NaN; 39976 } 39977 39978 function parseFloatOperand() { 39979 let str = ""; 39980 const eof = 15; 39981 const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"]; 39982 const length = dict.length; 39983 39984 while (pos < length) { 39985 const b = dict[pos++]; 39986 const b1 = b >> 4; 39987 const b2 = b & 15; 39988 39989 if (b1 === eof) { 39990 break; 39991 } 39992 39993 str += lookup[b1]; 39994 39995 if (b2 === eof) { 39996 break; 39997 } 39998 39999 str += lookup[b2]; 40000 } 40001 40002 return parseFloat(str); 40003 } 40004 40005 let operands = []; 40006 const entries = []; 40007 pos = 0; 40008 const end = dict.length; 40009 40010 while (pos < end) { 40011 let b = dict[pos]; 40012 40013 if (b <= 21) { 40014 if (b === 12) { 40015 b = b << 8 | dict[++pos]; 40016 } 40017 40018 entries.push([b, operands]); 40019 operands = []; 40020 ++pos; 40021 } else { 40022 operands.push(parseOperand()); 40023 } 40024 } 40025 40026 return entries; 40027 } 40028 40029 parseIndex(pos) { 40030 const cffIndex = new CFFIndex(); 40031 const bytes = this.bytes; 40032 const count = bytes[pos++] << 8 | bytes[pos++]; 40033 const offsets = []; 40034 let end = pos; 40035 let i, ii; 40036 40037 if (count !== 0) { 40038 const offsetSize = bytes[pos++]; 40039 const startPos = pos + (count + 1) * offsetSize - 1; 40040 40041 for (i = 0, ii = count + 1; i < ii; ++i) { 40042 let offset = 0; 40043 40044 for (let j = 0; j < offsetSize; ++j) { 40045 offset <<= 8; 40046 offset += bytes[pos++]; 40047 } 40048 40049 offsets.push(startPos + offset); 40050 } 40051 40052 end = offsets[count]; 40053 } 40054 40055 for (i = 0, ii = offsets.length - 1; i < ii; ++i) { 40056 const offsetStart = offsets[i]; 40057 const offsetEnd = offsets[i + 1]; 40058 cffIndex.add(bytes.subarray(offsetStart, offsetEnd)); 40059 } 40060 40061 return { 40062 obj: cffIndex, 40063 endPos: end 40064 }; 40065 } 40066 40067 parseNameIndex(index) { 40068 const names = []; 40069 40070 for (let i = 0, ii = index.count; i < ii; ++i) { 40071 const name = index.get(i); 40072 names.push((0, _util.bytesToString)(name)); 40073 } 40074 40075 return names; 40076 } 40077 40078 parseStringIndex(index) { 40079 const strings = new CFFStrings(); 40080 40081 for (let i = 0, ii = index.count; i < ii; ++i) { 40082 const data = index.get(i); 40083 strings.add((0, _util.bytesToString)(data)); 40084 } 40085 40086 return strings; 40087 } 40088 40089 createDict(Type, dict, strings) { 40090 const cffDict = new Type(strings); 40091 40092 for (let i = 0, ii = dict.length; i < ii; ++i) { 40093 const pair = dict[i]; 40094 const key = pair[0]; 40095 const value = pair[1]; 40096 cffDict.setByKey(key, value); 40097 } 40098 40099 return cffDict; 40100 } 40101 40102 parseCharString(state, data, localSubrIndex, globalSubrIndex) { 40103 if (!data || state.callDepth > MAX_SUBR_NESTING) { 40104 return false; 40105 } 40106 40107 let stackSize = state.stackSize; 40108 const stack = state.stack; 40109 const length = data.length; 40110 40111 for (let j = 0; j < length;) { 40112 const value = data[j++]; 40113 let validationCommand = null; 40114 40115 if (value === 12) { 40116 const q = data[j++]; 40117 40118 if (q === 0) { 40119 data[j - 2] = 139; 40120 data[j - 1] = 22; 40121 stackSize = 0; 40122 } else { 40123 validationCommand = CharstringValidationData12[q]; 40124 } 40125 } else if (value === 28) { 40126 stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16; 40127 j += 2; 40128 stackSize++; 40129 } else if (value === 14) { 40130 if (stackSize >= 4) { 40131 stackSize -= 4; 40132 40133 if (this.seacAnalysisEnabled) { 40134 state.seac = stack.slice(stackSize, stackSize + 4); 40135 return false; 40136 } 40137 } 40138 40139 validationCommand = CharstringValidationData[value]; 40140 } else if (value >= 32 && value <= 246) { 40141 stack[stackSize] = value - 139; 40142 stackSize++; 40143 } else if (value >= 247 && value <= 254) { 40144 stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108; 40145 j++; 40146 stackSize++; 40147 } else if (value === 255) { 40148 stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536; 40149 j += 4; 40150 stackSize++; 40151 } else if (value === 19 || value === 20) { 40152 state.hints += stackSize >> 1; 40153 j += state.hints + 7 >> 3; 40154 stackSize %= 2; 40155 validationCommand = CharstringValidationData[value]; 40156 } else if (value === 10 || value === 29) { 40157 let subrsIndex; 40158 40159 if (value === 10) { 40160 subrsIndex = localSubrIndex; 40161 } else { 40162 subrsIndex = globalSubrIndex; 40163 } 40164 40165 if (!subrsIndex) { 40166 validationCommand = CharstringValidationData[value]; 40167 (0, _util.warn)("Missing subrsIndex for " + validationCommand.id); 40168 return false; 40169 } 40170 40171 let bias = 32768; 40172 40173 if (subrsIndex.count < 1240) { 40174 bias = 107; 40175 } else if (subrsIndex.count < 33900) { 40176 bias = 1131; 40177 } 40178 40179 const subrNumber = stack[--stackSize] + bias; 40180 40181 if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) { 40182 validationCommand = CharstringValidationData[value]; 40183 (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id); 40184 return false; 40185 } 40186 40187 state.stackSize = stackSize; 40188 state.callDepth++; 40189 const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex); 40190 40191 if (!valid) { 40192 return false; 40193 } 40194 40195 state.callDepth--; 40196 stackSize = state.stackSize; 40197 continue; 40198 } else if (value === 11) { 40199 state.stackSize = stackSize; 40200 return true; 40201 } else if (value === 0 && j === data.length) { 40202 data[j - 1] = 14; 40203 validationCommand = CharstringValidationData[14]; 40204 } else { 40205 validationCommand = CharstringValidationData[value]; 40206 } 40207 40208 if (validationCommand) { 40209 if (validationCommand.stem) { 40210 state.hints += stackSize >> 1; 40211 40212 if (value === 3 || value === 23) { 40213 state.hasVStems = true; 40214 } else if (state.hasVStems && (value === 1 || value === 18)) { 40215 (0, _util.warn)("CFF stem hints are in wrong order"); 40216 data[j - 1] = value === 1 ? 3 : 23; 40217 } 40218 } 40219 40220 if ("min" in validationCommand) { 40221 if (!state.undefStack && stackSize < validationCommand.min) { 40222 (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min); 40223 40224 if (stackSize === 0) { 40225 data[j - 1] = 14; 40226 return true; 40227 } 40228 40229 return false; 40230 } 40231 } 40232 40233 if (state.firstStackClearing && validationCommand.stackClearing) { 40234 state.firstStackClearing = false; 40235 stackSize -= validationCommand.min; 40236 40237 if (stackSize >= 2 && validationCommand.stem) { 40238 stackSize %= 2; 40239 } else if (stackSize > 1) { 40240 (0, _util.warn)("Found too many parameters for stack-clearing command"); 40241 } 40242 40243 if (stackSize > 0) { 40244 state.width = stack[stackSize - 1]; 40245 } 40246 } 40247 40248 if ("stackDelta" in validationCommand) { 40249 if ("stackFn" in validationCommand) { 40250 validationCommand.stackFn(stack, stackSize); 40251 } 40252 40253 stackSize += validationCommand.stackDelta; 40254 } else if (validationCommand.stackClearing) { 40255 stackSize = 0; 40256 } else if (validationCommand.resetStack) { 40257 stackSize = 0; 40258 state.undefStack = false; 40259 } else if (validationCommand.undefStack) { 40260 stackSize = 0; 40261 state.undefStack = true; 40262 state.firstStackClearing = false; 40263 } 40264 } 40265 } 40266 40267 state.stackSize = stackSize; 40268 return true; 40269 } 40270 40271 parseCharStrings({ 40272 charStrings, 40273 localSubrIndex, 40274 globalSubrIndex, 40275 fdSelect, 40276 fdArray, 40277 privateDict 40278 }) { 40279 const seacs = []; 40280 const widths = []; 40281 const count = charStrings.count; 40282 40283 for (let i = 0; i < count; i++) { 40284 const charstring = charStrings.get(i); 40285 const state = { 40286 callDepth: 0, 40287 stackSize: 0, 40288 stack: [], 40289 undefStack: true, 40290 hints: 0, 40291 firstStackClearing: true, 40292 seac: null, 40293 width: null, 40294 hasVStems: false 40295 }; 40296 let valid = true; 40297 let localSubrToUse = null; 40298 let privateDictToUse = privateDict; 40299 40300 if (fdSelect && fdArray.length) { 40301 const fdIndex = fdSelect.getFDIndex(i); 40302 40303 if (fdIndex === -1) { 40304 (0, _util.warn)("Glyph index is not in fd select."); 40305 valid = false; 40306 } 40307 40308 if (fdIndex >= fdArray.length) { 40309 (0, _util.warn)("Invalid fd index for glyph index."); 40310 valid = false; 40311 } 40312 40313 if (valid) { 40314 privateDictToUse = fdArray[fdIndex].privateDict; 40315 localSubrToUse = privateDictToUse.subrsIndex; 40316 } 40317 } else if (localSubrIndex) { 40318 localSubrToUse = localSubrIndex; 40319 } 40320 40321 if (valid) { 40322 valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex); 40323 } 40324 40325 if (state.width !== null) { 40326 const nominalWidth = privateDictToUse.getByName("nominalWidthX"); 40327 widths[i] = nominalWidth + state.width; 40328 } else { 40329 const defaultWidth = privateDictToUse.getByName("defaultWidthX"); 40330 widths[i] = defaultWidth; 40331 } 40332 40333 if (state.seac !== null) { 40334 seacs[i] = state.seac; 40335 } 40336 40337 if (!valid) { 40338 charStrings.set(i, new Uint8Array([14])); 40339 } 40340 } 40341 40342 return { 40343 charStrings, 40344 seacs, 40345 widths 40346 }; 40347 } 40348 40349 emptyPrivateDictionary(parentDict) { 40350 const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings); 40351 parentDict.setByKey(18, [0, 0]); 40352 parentDict.privateDict = privateDict; 40353 } 40354 40355 parsePrivateDict(parentDict) { 40356 if (!parentDict.hasName("Private")) { 40357 this.emptyPrivateDictionary(parentDict); 40358 return; 40359 } 40360 40361 const privateOffset = parentDict.getByName("Private"); 40362 40363 if (!Array.isArray(privateOffset) || privateOffset.length !== 2) { 40364 parentDict.removeByName("Private"); 40365 return; 40366 } 40367 40368 const size = privateOffset[0]; 40369 const offset = privateOffset[1]; 40370 40371 if (size === 0 || offset >= this.bytes.length) { 40372 this.emptyPrivateDictionary(parentDict); 40373 return; 40374 } 40375 40376 const privateDictEnd = offset + size; 40377 const dictData = this.bytes.subarray(offset, privateDictEnd); 40378 const dict = this.parseDict(dictData); 40379 const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings); 40380 parentDict.privateDict = privateDict; 40381 40382 if (!privateDict.getByName("Subrs")) { 40383 return; 40384 } 40385 40386 const subrsOffset = privateDict.getByName("Subrs"); 40387 const relativeOffset = offset + subrsOffset; 40388 40389 if (subrsOffset === 0 || relativeOffset >= this.bytes.length) { 40390 this.emptyPrivateDictionary(parentDict); 40391 return; 40392 } 40393 40394 const subrsIndex = this.parseIndex(relativeOffset); 40395 privateDict.subrsIndex = subrsIndex.obj; 40396 } 40397 40398 parseCharsets(pos, length, strings, cid) { 40399 if (pos === 0) { 40400 return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset); 40401 } else if (pos === 1) { 40402 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset); 40403 } else if (pos === 2) { 40404 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset); 40405 } 40406 40407 const bytes = this.bytes; 40408 const start = pos; 40409 const format = bytes[pos++]; 40410 const charset = [cid ? 0 : ".notdef"]; 40411 let id, count, i; 40412 length -= 1; 40413 40414 switch (format) { 40415 case 0: 40416 for (i = 0; i < length; i++) { 40417 id = bytes[pos++] << 8 | bytes[pos++]; 40418 charset.push(cid ? id : strings.get(id)); 40419 } 40420 40421 break; 40422 40423 case 1: 40424 while (charset.length <= length) { 40425 id = bytes[pos++] << 8 | bytes[pos++]; 40426 count = bytes[pos++]; 40427 40428 for (i = 0; i <= count; i++) { 40429 charset.push(cid ? id++ : strings.get(id++)); 40430 } 40431 } 40432 40433 break; 40434 40435 case 2: 40436 while (charset.length <= length) { 40437 id = bytes[pos++] << 8 | bytes[pos++]; 40438 count = bytes[pos++] << 8 | bytes[pos++]; 40439 40440 for (i = 0; i <= count; i++) { 40441 charset.push(cid ? id++ : strings.get(id++)); 40442 } 40443 } 40444 40445 break; 40446 40447 default: 40448 throw new _util.FormatError("Unknown charset format"); 40449 } 40450 40451 const end = pos; 40452 const raw = bytes.subarray(start, end); 40453 return new CFFCharset(false, format, charset, raw); 40454 } 40455 40456 parseEncoding(pos, properties, strings, charset) { 40457 const encoding = Object.create(null); 40458 const bytes = this.bytes; 40459 let predefined = false; 40460 let format, i, ii; 40461 let raw = null; 40462 40463 function readSupplement() { 40464 const supplementsCount = bytes[pos++]; 40465 40466 for (i = 0; i < supplementsCount; i++) { 40467 const code = bytes[pos++]; 40468 const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff); 40469 encoding[code] = charset.indexOf(strings.get(sid)); 40470 } 40471 } 40472 40473 if (pos === 0 || pos === 1) { 40474 predefined = true; 40475 format = pos; 40476 const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding; 40477 40478 for (i = 0, ii = charset.length; i < ii; i++) { 40479 const index = baseEncoding.indexOf(charset[i]); 40480 40481 if (index !== -1) { 40482 encoding[index] = i; 40483 } 40484 } 40485 } else { 40486 const dataStart = pos; 40487 format = bytes[pos++]; 40488 40489 switch (format & 0x7f) { 40490 case 0: 40491 const glyphsCount = bytes[pos++]; 40492 40493 for (i = 1; i <= glyphsCount; i++) { 40494 encoding[bytes[pos++]] = i; 40495 } 40496 40497 break; 40498 40499 case 1: 40500 const rangesCount = bytes[pos++]; 40501 let gid = 1; 40502 40503 for (i = 0; i < rangesCount; i++) { 40504 const start = bytes[pos++]; 40505 const left = bytes[pos++]; 40506 40507 for (let j = start; j <= start + left; j++) { 40508 encoding[j] = gid++; 40509 } 40510 } 40511 40512 break; 40513 40514 default: 40515 throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`); 40516 } 40517 40518 const dataEnd = pos; 40519 40520 if (format & 0x80) { 40521 bytes[dataStart] &= 0x7f; 40522 readSupplement(); 40523 } 40524 40525 raw = bytes.subarray(dataStart, dataEnd); 40526 } 40527 40528 format &= 0x7f; 40529 return new CFFEncoding(predefined, format, encoding, raw); 40530 } 40531 40532 parseFDSelect(pos, length) { 40533 const bytes = this.bytes; 40534 const format = bytes[pos++]; 40535 const fdSelect = []; 40536 let i; 40537 40538 switch (format) { 40539 case 0: 40540 for (i = 0; i < length; ++i) { 40541 const id = bytes[pos++]; 40542 fdSelect.push(id); 40543 } 40544 40545 break; 40546 40547 case 3: 40548 const rangesCount = bytes[pos++] << 8 | bytes[pos++]; 40549 40550 for (i = 0; i < rangesCount; ++i) { 40551 let first = bytes[pos++] << 8 | bytes[pos++]; 40552 40553 if (i === 0 && first !== 0) { 40554 (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover."); 40555 first = 0; 40556 } 40557 40558 const fdIndex = bytes[pos++]; 40559 const next = bytes[pos] << 8 | bytes[pos + 1]; 40560 40561 for (let j = first; j < next; ++j) { 40562 fdSelect.push(fdIndex); 40563 } 40564 } 40565 40566 pos += 2; 40567 break; 40568 40569 default: 40570 throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`); 40571 } 40572 40573 if (fdSelect.length !== length) { 40574 throw new _util.FormatError("parseFDSelect: Invalid font data."); 40575 } 40576 40577 return new CFFFDSelect(format, fdSelect); 40578 } 40579 40580 } 40581 40582 return CFFParser; 40583}(); 40584 40585exports.CFFParser = CFFParser; 40586 40587class CFF { 40588 constructor() { 40589 this.header = null; 40590 this.names = []; 40591 this.topDict = null; 40592 this.strings = new CFFStrings(); 40593 this.globalSubrIndex = null; 40594 this.encoding = null; 40595 this.charset = null; 40596 this.charStrings = null; 40597 this.fdArray = []; 40598 this.fdSelect = null; 40599 this.isCIDFont = false; 40600 } 40601 40602 duplicateFirstGlyph() { 40603 if (this.charStrings.count >= 65535) { 40604 (0, _util.warn)("Not enough space in charstrings to duplicate first glyph."); 40605 return; 40606 } 40607 40608 const glyphZero = this.charStrings.get(0); 40609 this.charStrings.add(glyphZero); 40610 40611 if (this.isCIDFont) { 40612 this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]); 40613 } 40614 } 40615 40616 hasGlyphId(id) { 40617 if (id < 0 || id >= this.charStrings.count) { 40618 return false; 40619 } 40620 40621 const glyph = this.charStrings.get(id); 40622 return glyph.length > 0; 40623 } 40624 40625} 40626 40627exports.CFF = CFF; 40628 40629class CFFHeader { 40630 constructor(major, minor, hdrSize, offSize) { 40631 this.major = major; 40632 this.minor = minor; 40633 this.hdrSize = hdrSize; 40634 this.offSize = offSize; 40635 } 40636 40637} 40638 40639exports.CFFHeader = CFFHeader; 40640 40641class CFFStrings { 40642 constructor() { 40643 this.strings = []; 40644 } 40645 40646 get(index) { 40647 if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) { 40648 return CFFStandardStrings[index]; 40649 } 40650 40651 if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) { 40652 return this.strings[index - NUM_STANDARD_CFF_STRINGS]; 40653 } 40654 40655 return CFFStandardStrings[0]; 40656 } 40657 40658 getSID(str) { 40659 let index = CFFStandardStrings.indexOf(str); 40660 40661 if (index !== -1) { 40662 return index; 40663 } 40664 40665 index = this.strings.indexOf(str); 40666 40667 if (index !== -1) { 40668 return index + NUM_STANDARD_CFF_STRINGS; 40669 } 40670 40671 return -1; 40672 } 40673 40674 add(value) { 40675 this.strings.push(value); 40676 } 40677 40678 get count() { 40679 return this.strings.length; 40680 } 40681 40682} 40683 40684exports.CFFStrings = CFFStrings; 40685 40686class CFFIndex { 40687 constructor() { 40688 this.objects = []; 40689 this.length = 0; 40690 } 40691 40692 add(data) { 40693 this.length += data.length; 40694 this.objects.push(data); 40695 } 40696 40697 set(index, data) { 40698 this.length += data.length - this.objects[index].length; 40699 this.objects[index] = data; 40700 } 40701 40702 get(index) { 40703 return this.objects[index]; 40704 } 40705 40706 get count() { 40707 return this.objects.length; 40708 } 40709 40710} 40711 40712exports.CFFIndex = CFFIndex; 40713 40714class CFFDict { 40715 constructor(tables, strings) { 40716 this.keyToNameMap = tables.keyToNameMap; 40717 this.nameToKeyMap = tables.nameToKeyMap; 40718 this.defaults = tables.defaults; 40719 this.types = tables.types; 40720 this.opcodes = tables.opcodes; 40721 this.order = tables.order;
40722 this.strings = strings; 40723 this.values = Object.create(null); 40724 } 40725 40726 setByKey(key, value) { 40727 if (!(key in this.keyToNameMap)) { 40728 return false; 40729 } 40730 40731 const valueLength = value.length; 40732 40733 if (valueLength === 0) { 40734 return true; 40735 } 40736 40737 for (let i = 0; i < valueLength; i++) { 40738 if (isNaN(value[i])) { 40739 (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".'); 40740 return true; 40741 } 40742 } 40743 40744 const type = this.types[key]; 40745 40746 if (type === "num" || type === "sid" || type === "offset") { 40747 value = value[0]; 40748 } 40749 40750 this.values[key] = value; 40751 return true; 40752 } 40753 40754 setByName(name, value) { 40755 if (!(name in this.nameToKeyMap)) { 40756 throw new _util.FormatError(`Invalid dictionary name "${name}"`); 40757 } 40758 40759 this.values[this.nameToKeyMap[name]] = value; 40760 } 40761 40762 hasName(name) { 40763 return this.nameToKeyMap[name] in this.values; 40764 } 40765 40766 getByName(name) { 40767 if (!(name in this.nameToKeyMap)) { 40768 throw new _util.FormatError(`Invalid dictionary name ${name}"`); 40769 } 40770 40771 const key = this.nameToKeyMap[name]; 40772 40773 if (!(key in this.values)) { 40774 return this.defaults[key]; 40775 } 40776 40777 return this.values[key]; 40778 } 40779 40780 removeByName(name) { 40781 delete this.values[this.nameToKeyMap[name]]; 40782 } 40783 40784 static createTables(layout) { 40785 const tables = { 40786 keyToNameMap: {}, 40787 nameToKeyMap: {}, 40788 defaults: {}, 40789 types: {}, 40790 opcodes: {}, 40791 order: [] 40792 }; 40793 40794 for (let i = 0, ii = layout.length; i < ii; ++i) { 40795 const entry = layout[i]; 40796 const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0]; 40797 tables.keyToNameMap[key] = entry[1]; 40798 tables.nameToKeyMap[entry[1]] = key; 40799 tables.types[key] = entry[2]; 40800 tables.defaults[key] = entry[3]; 40801 tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]]; 40802 tables.order.push(key); 40803 } 40804 40805 return tables; 40806 } 40807 40808} 40809 40810const CFFTopDict = function CFFTopDictClosure() { 40811 const layout = [[[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]]; 40812 let tables = null; 40813 40814 class CFFTopDict extends CFFDict { 40815 constructor(strings) { 40816 if (tables === null) { 40817 tables = CFFDict.createTables(layout); 40818 } 40819 40820 super(tables, strings); 40821 this.privateDict = null; 40822 } 40823 40824 } 40825 40826 return CFFTopDict; 40827}(); 40828 40829exports.CFFTopDict = CFFTopDict; 40830 40831const CFFPrivateDict = function CFFPrivateDictClosure() { 40832 const layout = [[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, "n
vendor: 6,619 bytes, lines 40832-41085
40832ominalWidthX", "num", 0], [19, "Subrs", "offset", null]]; 40833 let tables = null; 40834 40835 class CFFPrivateDict extends CFFDict { 40836 constructor(strings) { 40837 if (tables === null) { 40838 tables = CFFDict.createTables(layout); 40839 } 40840 40841 super(tables, strings); 40842 this.subrsIndex = null; 40843 } 40844 40845 } 40846 40847 return CFFPrivateDict; 40848}(); 40849 40850exports.CFFPrivateDict = CFFPrivateDict; 40851const CFFCharsetPredefinedTypes = { 40852 ISO_ADOBE: 0, 40853 EXPERT: 1, 40854 EXPERT_SUBSET: 2 40855}; 40856 40857class CFFCharset { 40858 constructor(predefined, format, charset, raw) { 40859 this.predefined = predefined; 40860 this.format = format; 40861 this.charset = charset; 40862 this.raw = raw; 40863 } 40864 40865} 40866 40867exports.CFFCharset = CFFCharset; 40868 40869class CFFEncoding { 40870 constructor(predefined, format, encoding, raw) { 40871 this.predefined = predefined; 40872 this.format = format; 40873 this.encoding = encoding; 40874 this.raw = raw; 40875 } 40876 40877} 40878 40879class CFFFDSelect { 40880 constructor(format, fdSelect) { 40881 this.format = format; 40882 this.fdSelect = fdSelect; 40883 } 40884 40885 getFDIndex(glyphIndex) { 40886 if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) { 40887 return -1; 40888 } 40889 40890 return this.fdSelect[glyphIndex]; 40891 } 40892 40893} 40894 40895exports.CFFFDSelect = CFFFDSelect; 40896 40897class CFFOffsetTracker { 40898 constructor() { 40899 this.offsets = Object.create(null); 40900 } 40901 40902 isTracking(key) { 40903 return key in this.offsets; 40904 } 40905 40906 track(key, location) { 40907 if (key in this.offsets) { 40908 throw new _util.FormatError(`Already tracking location of ${key}`); 40909 } 40910 40911 this.offsets[key] = location; 40912 } 40913 40914 offset(value) { 40915 for (const key in this.offsets) { 40916 this.offsets[key] += value; 40917 } 40918 } 40919 40920 setEntryLocation(key, values, output) { 40921 if (!(key in this.offsets)) { 40922 throw new _util.FormatError(`Not tracking location of ${key}`); 40923 } 40924 40925 const data = output.data; 40926 const dataOffset = this.offsets[key]; 40927 const size = 5; 40928 40929 for (let i = 0, ii = values.length; i < ii; ++i) { 40930 const offset0 = i * size + dataOffset; 40931 const offset1 = offset0 + 1; 40932 const offset2 = offset0 + 2; 40933 const offset3 = offset0 + 3; 40934 const offset4 = offset0 + 4; 40935 40936 if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) { 40937 throw new _util.FormatError("writing to an offset that is not empty"); 40938 } 40939 40940 const value = values[i]; 40941 data[offset0] = 0x1d; 40942 data[offset1] = value >> 24 & 0xff; 40943 data[offset2] = value >> 16 & 0xff; 40944 data[offset3] = value >> 8 & 0xff; 40945 data[offset4] = value & 0xff; 40946 } 40947 } 40948 40949} 40950 40951class CFFCompiler { 40952 constructor(cff) { 40953 this.cff = cff; 40954 } 40955 40956 compile() { 40957 const cff = this.cff; 40958 const output = { 40959 data: [], 40960 length: 0, 40961 add: function CFFCompiler_add(data) { 40962 this.data = this.data.concat(data); 40963 this.length = this.data.length; 40964 } 40965 }; 40966 const header = this.compileHeader(cff.header); 40967 output.add(header); 40968 const nameIndex = this.compileNameIndex(cff.names); 40969 output.add(nameIndex); 40970 40971 if (cff.isCIDFont) { 40972 if (cff.topDict.hasName("FontMatrix")) { 40973 const base = cff.topDict.getByName("FontMatrix"); 40974 cff.topDict.removeByName("FontMatrix"); 40975 40976 for (let i = 0, ii = cff.fdArray.length; i < ii; i++) { 40977 const subDict = cff.fdArray[i]; 40978 let matrix = base.slice(0); 40979 40980 if (subDict.hasName("FontMatrix")) { 40981 matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix")); 40982 } 40983 40984 subDict.setByName("FontMatrix", matrix); 40985 } 40986 } 40987 } 40988 40989 const xuid = cff.topDict.getByName("XUID"); 40990 40991 if (xuid && xuid.length > 16) { 40992 cff.topDict.removeByName("XUID"); 40993 } 40994 40995 cff.topDict.setByName("charset", 0); 40996 let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont); 40997 output.add(compiled.output); 40998 const topDictTracker = compiled.trackers[0]; 40999 const stringIndex = this.compileStringIndex(cff.strings.strings); 41000 output.add(stringIndex); 41001 const globalSubrIndex = this.compileIndex(cff.globalSubrIndex); 41002 output.add(globalSubrIndex); 41003 41004 if (cff.encoding && cff.topDict.hasName("Encoding")) { 41005 if (cff.encoding.predefined) { 41006 topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output); 41007 } else { 41008 const encoding = this.compileEncoding(cff.encoding); 41009 topDictTracker.setEntryLocation("Encoding", [output.length], output); 41010 output.add(encoding); 41011 } 41012 } 41013 41014 const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont); 41015 topDictTracker.setEntryLocation("charset", [output.length], output); 41016 output.add(charset); 41017 const charStrings = this.compileCharStrings(cff.charStrings); 41018 topDictTracker.setEntryLocation("CharStrings", [output.length], output); 41019 output.add(charStrings); 41020 41021 if (cff.isCIDFont) { 41022 topDictTracker.setEntryLocation("FDSelect", [output.length], output); 41023 const fdSelect = this.compileFDSelect(cff.fdSelect); 41024 output.add(fdSelect); 41025 compiled = this.compileTopDicts(cff.fdArray, output.length, true); 41026 topDictTracker.setEntryLocation("FDArray", [output.length], output); 41027 output.add(compiled.output); 41028 const fontDictTrackers = compiled.trackers; 41029 this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output); 41030 } 41031 41032 this.compilePrivateDicts([cff.topDict], [topDictTracker], output); 41033 output.add([0]); 41034 return output.data; 41035 } 41036 41037 encodeNumber(value) { 41038 if (Number.isInteger(value)) { 41039 return this.encodeInteger(value); 41040 } 41041 41042 return this.encodeFloat(value); 41043 } 41044 41045 static get EncodeFloatRegExp() { 41046 return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/); 41047 } 41048 41049 encodeFloat(num) { 41050 let value = num.toString(); 41051 const m = CFFCompiler.EncodeFloatRegExp.exec(value); 41052 41053 if (m) { 41054 const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length)); 41055 value = (Math.round(num * epsilon) / epsilon).toString(); 41056 } 41057 41058 let nibbles = ""; 41059 let i, ii; 41060 41061 for (i = 0, ii = value.length; i < ii; ++i) { 41062 const a = value[i]; 41063 41064 if (a === "e") { 41065 nibbles += value[++i] === "-" ? "c" : "b"; 41066 } else if (a === ".") { 41067 nibbles += "a"; 41068 } else if (a === "-") { 41069 nibbles += "e"; 41070 } else { 41071 nibbles += a; 41072 } 41073 } 41074 41075 nibbles += nibbles.length & 1 ? "f" : "ff"; 41076 const out = [30]; 41077 41078 for (i = 0, ii = nibbles.length; i < ii; i += 2) { 41079 out.push(parseInt(nibbles.substring(i, i + 2), 16)); 41080 } 41081 41082 return out; 41083 } 41084 41085 encodeInteger(value) {
41086 let code; 41087 41088 if (value >= -107 && value <= 107) { 41089 code = [value + 139]; 41090 } else if (value >= 108 && value <= 1131) { 41091 value -= 108; 41092 code = [(value >> 8) + 247, value & 0xff]; 41093 } else if (value >= -1131 && value <= -108) { 41094 value = -value - 108; 41095 code = [(value >> 8) + 251, value & 0xff]; 41096 } else if (value >= -32768 && value <= 32767) { 41097 code = [0x1c, value >> 8 & 0xff, value & 0xff]; 41098 } else { 41099 code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff]; 41100 } 41101 41102 return code; 41103 } 41104 41105 compileHeader(header) { 41106 return [header.major, header.minor, 4, header.offSize]; 41107 } 41108 41109 compileNameIndex(names) { 41110 const nameIndex = new CFFIndex(); 41111 41112 for (let i = 0, ii = names.length; i < ii; ++i) { 41113 const name = names[i]; 41114 const length = Math.min(name.length, 127); 41115 let sanitizedName = new Array(length); 41116 41117 for (let j = 0; j < length; j++) { 41118 let char = name[j]; 41119 41120 if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") { 41121 char = "_"; 41122 } 41123 41124 sanitizedName[j] = char; 41125 } 41126 41127 sanitizedName = sanitizedName.join(""); 41128 41129 if (sanitizedName === "") { 41130 sanitizedName = "Bad_Font_Name"; 41131 } 41132 41133 nameIndex.add((0, _util.stringToBytes)(sanitizedName)); 41134 } 41135 41136 return this.compileIndex(nameIndex); 41137 } 41138 41139 compileTopDicts(dicts, length, removeCidKeys) { 41140 const fontDictTrackers = []; 41141 let fdArrayIndex = new CFFIndex(); 41142 41143 for (let i = 0, ii = dicts.length; i < ii; ++i) { 41144 const fontDict = dicts[i]; 41145 41146 if (removeCidKeys) { 41147 fontDict.removeByName("CIDFontVersion"); 41148 fontDict.removeByName("CIDFontRevision"); 41149 fontDict.removeByName("CIDFontType"); 41150 fontDict.removeByName("CIDCount"); 41151 fontDict.removeByName("UIDBase"); 41152 } 41153 41154 const fontDictTracker = new CFFOffsetTracker(); 41155 const fontDictData = this.compileDict(fontDict, fontDictTracker); 41156 fontDictTrackers.push(fontDictTracker); 41157 fdArrayIndex.add(fontDictData); 41158 fontDictTracker.offset(length); 41159 } 41160 41161 fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers); 41162 return { 41163 trackers: fontDictTrackers, 41164 output: fdArrayIndex 41165 }; 41166 } 41167 41168 compilePrivateDicts(dicts, trackers, output) { 41169 for (let i = 0, ii = dicts.length; i < ii; ++i) { 41170 const fontDict = dicts[i]; 41171 const privateDict = fontDict.privateDict; 41172 41173 if (!privateDict || !fontDict.hasName("Private")) { 41174 throw new _util.FormatError("There must be a private dictionary."); 41175 } 41176 41177 const privateDictTracker = new CFFOffsetTracker(); 41178 const privateDictData = this.compileDict(privateDict, privateDictTracker); 41179 let outputLength = output.length; 41180 privateDictTracker.offset(outputLength); 41181 41182 if (!privateDictData.length) { 41183 outputLength = 0; 41184 } 41185 41186 trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output); 41187 output.add(privateDictData); 41188 41189 if (privateDict.subrsIndex && privateDict.hasName("Subrs")) { 41190 const subrs = this.compileIndex(privateDict.subrsIndex); 41191 privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output); 41192 output.add(subrs); 41193 } 41194 } 41195 } 41196 41197 compileDict(dict, offsetTracker) { 41198 let out = []; 41199 const order = dict.order; 41200 41201 for (let i = 0; i < order.length; ++i) { 41202 const key = order[i]; 41203 41204 if (!(key in dict.values)) { 41205 continue; 41206 } 41207 41208 let values = dict.values[key]; 41209 let types = dict.types[key]; 41210 41211 if (!Array.isArray(types)) { 41212 types = [types]; 41213 } 41214 41215 if (!Array.isArray(values)) { 41216 values = [values]; 41217 } 41218 41219 if (values.length === 0) { 41220 continue; 41221 } 41222 41223 for (let j = 0, jj = types.length; j < jj; ++j) { 41224 const type = types[j]; 41225 const value = values[j]; 41226 41227 switch (type) { 41228 case "num": 41229 case "sid": 41230 out = out.concat(this.encodeNumber(value)); 41231 break; 41232 41233 case "offset": 41234 const name = dict.keyToNameMap[key]; 41235 41236 if (!offsetTracker.isTracking(name)) { 41237 offsetTracker.track(name, out.length); 41238 } 41239 41240 out = out.concat([0x1d, 0, 0, 0, 0]); 41241 break; 41242 41243 case "array": 41244 case "delta": 41245 out = out.concat(this.encodeNumber(value)); 41246 41247 for (let k = 1, kk = values.length; k < kk; ++k) { 41248 out = out.concat(this.encodeNumber(values[k])); 41249 } 41250 41251 break; 41252 41253 default: 41254 throw new _util.FormatError(`Unknown data type of ${type}`); 41255 } 41256 } 41257 41258 out = out.concat(dict.opcodes[key]); 41259 } 41260 41261 return out; 41262 } 41263 41264 compileStringIndex(strings) { 41265 const stringIndex = new CFFIndex(); 41266 41267 for (let i = 0, ii = strings.length; i < ii; ++i) {
vendor: 4,462 bytes, lines 41268-41454
41268 stringIndex.add((0, _util.stringToBytes)(strings[i])); 41269 } 41270 41271 return this.compileIndex(stringIndex); 41272 } 41273 41274 compileGlobalSubrIndex() { 41275 const globalSubrIndex = this.cff.globalSubrIndex; 41276 this.out.writeByteArray(this.compileIndex(globalSubrIndex)); 41277 } 41278 41279 compileCharStrings(charStrings) { 41280 const charStringsIndex = new CFFIndex(); 41281 41282 for (let i = 0; i < charStrings.count; i++) { 41283 const glyph = charStrings.get(i); 41284 41285 if (glyph.length === 0) { 41286 charStringsIndex.add(new Uint8Array([0x8b, 0x0e])); 41287 continue; 41288 } 41289 41290 charStringsIndex.add(glyph); 41291 } 41292 41293 return this.compileIndex(charStringsIndex); 41294 } 41295 41296 compileCharset(charset, numGlyphs, strings, isCIDFont) { 41297 let out; 41298 const numGlyphsLessNotDef = numGlyphs - 1; 41299 41300 if (isCIDFont) { 41301 out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]); 41302 } else { 41303 const length = 1 + numGlyphsLessNotDef * 2; 41304 out = new Uint8Array(length); 41305 out[0] = 0; 41306 let charsetIndex = 0; 41307 const numCharsets = charset.charset.length; 41308 let warned = false; 41309 41310 for (let i = 1; i < out.length; i += 2) { 41311 let sid = 0; 41312 41313 if (charsetIndex < numCharsets) { 41314 const name = charset.charset[charsetIndex++]; 41315 sid = strings.getSID(name); 41316 41317 if (sid === -1) { 41318 sid = 0; 41319 41320 if (!warned) { 41321 warned = true; 41322 (0, _util.warn)(`Couldn't find ${name} in CFF strings`); 41323 } 41324 } 41325 } 41326 41327 out[i] = sid >> 8 & 0xff; 41328 out[i + 1] = sid & 0xff; 41329 } 41330 } 41331 41332 return this.compileTypedArray(out); 41333 } 41334 41335 compileEncoding(encoding) { 41336 return this.compileTypedArray(encoding.raw); 41337 } 41338 41339 compileFDSelect(fdSelect) { 41340 const format = fdSelect.format; 41341 let out, i; 41342 41343 switch (format) { 41344 case 0: 41345 out = new Uint8Array(1 + fdSelect.fdSelect.length); 41346 out[0] = format; 41347 41348 for (i = 0; i < fdSelect.fdSelect.length; i++) { 41349 out[i + 1] = fdSelect.fdSelect[i]; 41350 } 41351 41352 break; 41353 41354 case 3: 41355 const start = 0; 41356 let lastFD = fdSelect.fdSelect[0]; 41357 const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD]; 41358 41359 for (i = 1; i < fdSelect.fdSelect.length; i++) { 41360 const currentFD = fdSelect.fdSelect[i]; 41361 41362 if (currentFD !== lastFD) { 41363 ranges.push(i >> 8 & 0xff, i & 0xff, currentFD); 41364 lastFD = currentFD; 41365 } 41366 } 41367 41368 const numRanges = (ranges.length - 3) / 3; 41369 ranges[1] = numRanges >> 8 & 0xff; 41370 ranges[2] = numRanges & 0xff; 41371 ranges.push(i >> 8 & 0xff, i & 0xff); 41372 out = new Uint8Array(ranges); 41373 break; 41374 } 41375 41376 return this.compileTypedArray(out); 41377 } 41378 41379 compileTypedArray(data) { 41380 const out = []; 41381 41382 for (let i = 0, ii = data.length; i < ii; ++i) { 41383 out[i] = data[i]; 41384 } 41385 41386 return out; 41387 } 41388 41389 compileIndex(index, trackers = []) { 41390 const objects = index.objects; 41391 const count = objects.length; 41392 41393 if (count === 0) { 41394 return [0, 0, 0]; 41395 } 41396 41397 const data = [count >> 8 & 0xff, count & 0xff]; 41398 let lastOffset = 1, 41399 i; 41400 41401 for (i = 0; i < count; ++i) { 41402 lastOffset += objects[i].length; 41403 } 41404 41405 let offsetSize; 41406 41407 if (lastOffset < 0x100) { 41408 offsetSize = 1; 41409 } else if (lastOffset < 0x10000) { 41410 offsetSize = 2; 41411 } else if (lastOffset < 0x1000000) { 41412 offsetSize = 3; 41413 } else { 41414 offsetSize = 4; 41415 } 41416 41417 data.push(offsetSize); 41418 let relativeOffset = 1; 41419 41420 for (i = 0; i < count + 1; i++) { 41421 if (offsetSize === 1) { 41422 data.push(relativeOffset & 0xff); 41423 } else if (offsetSize === 2) { 41424 data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 41425 } else if (offsetSize === 3) { 41426 data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 41427 } else { 41428 data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 41429 } 41430 41431 if (objects[i]) { 41432 relativeOffset += objects[i].length; 41433 } 41434 } 41435 41436 for (i = 0; i < count; i++) { 41437 if (trackers[i]) { 41438 trackers[i].offset(data.length); 41439 } 41440 41441 for (let j = 0, jj = objects[i].length; j < jj; j++) { 41442 data.push(objects[i][j]); 41443 } 41444 } 41445 41446 return data; 41447 } 41448 41449} 41450 41451exports.CFFCompiler = CFFCompiler; 41452 41453/***/ }), 41454/* 46 */
41455/***/ ((__unused_webpack_module, exports) => { 41456 41457 41458 41459Object.defineProperty(exports, "__esModule", ({ 41460 value: true 41461})); 41462exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0; 41463const 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", "periodce
41463ntered", "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"]; 41464exports.ISOAdobeCharset = ISOAdobeCharset; 41465const 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"]; 41466exports.ExpertCharset = ExpertCharset; 41467const 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"]; 41468exports.ExpertSubsetCharset = ExpertSubsetCharset; 41469 41470/***/ }), 41471/* 47 */ 41472/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 41473 41474 41475 41476Object.defineProperty(exports, "__esModule", ({ 41477 value: true 41478}));
41479exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0; 41480exports.getStandardFontName = getStandardFontName; 41481exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0; 41482 41483var _core_utils = __w_pdfjs_require__(9); 41484 41485var _fonts_utils = __w_pdfjs_require__(18); 41486 41487const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 41488 t["Times-Roman"] = "Times-Roman"; 41489 t.Helvetica = "Helvetica"; 41490 t.Courier = "Courier"; 41491 t.Symbol = "Symbol"; 41492 t["Times-Bold"] = "Times-Bold"; 41493 t["Helvetica-Bold"] = "Helvetica-Bold"; 41494 t["Courier-Bold"] = "Courier-Bold"; 41495 t.ZapfDingbats = "ZapfDingbats"; 41496 t["Times-Italic"] = "Times-Italic"; 41497 t["Helvetica-Oblique"] = "Helvetica-Oblique"; 41498 t["Courier-Oblique"] = "Courier-Oblique"; 41499 t["Times-BoldItalic"] = "Times-BoldItalic"; 41500 t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique"; 41501 t["Courier-BoldOblique"] = "Courier-BoldOblique"; 41502 t.ArialNarrow = "Helvetica"; 41503 t["ArialNarrow-Bold"] = "Helvetica-Bold"; 41504 t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique"; 41505 t["ArialNarrow-Italic"] = "Helvetica-Oblique"; 41506 t.ArialBlack = "Helvetica"; 41507 t["ArialBlack-Bold"] = "Helvetica-Bold"; 41508 t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique"; 41509 t["ArialBlack-Italic"] = "Helvetica-Oblique"; 41510 t["Arial-Black"] = "Helvetica"; 41511 t["Arial-Black-Bold"] = "Helvetica-Bold"; 41512 t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique"; 41513 t["Arial-Black-Italic"] = "Helvetica-Oblique"; 41514 t.Arial = "Helvetica"; 41515 t["Arial-Bold"] = "Helvetica-Bold"; 41516 t["Arial-BoldItalic"] = "Helvetica-BoldOblique"; 41517 t["Arial-Italic"] = "Helvetica-Oblique"; 41518 t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique"; 41519 t["Arial-BoldMT"] = "Helvetica-Bold"; 41520 t["Arial-ItalicMT"] = "Helvetica-Oblique"; 41521 t.ArialMT = "Helvetica"; 41522 t["Courier-BoldItalic"] = "Courier-BoldOblique"; 41523 t["Courier-Italic"] = "Courier-Oblique"; 41524 t.CourierNew = "Courier"; 41525 t["CourierNew-Bold"] = "Courier-Bold"; 41526 t["CourierNew-BoldItalic"] = "Courier-BoldOblique"; 41527 t["CourierNew-Italic"] = "Courier-Oblique"; 41528 t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique"; 41529 t["CourierNewPS-BoldMT"] = "Courier-Bold"; 41530 t["CourierNewPS-ItalicMT"] = "Courier-Oblique"; 41531 t.CourierNewPSMT = "Courier"; 41532 t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique"; 41533 t["Helvetica-Italic"] = "Helvetica-Oblique"; 41534 t["Symbol-Bold"] = "Symbol"; 41535 t["Symbol-BoldItalic"] = "Symbol"; 41536 t["Symbol-Italic"] = "Symbol"; 41537 t.TimesNewRoman = "Times-Roman"; 41538 t["TimesNewRoman-Bold"] = "Times-Bold"; 41539 t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic"; 41540 t["TimesNewRoman-Italic"] = "Times-Italic"; 41541 t.TimesNewRomanPS = "Times-Roman"; 41542 t["TimesNewRomanPS-Bold"] = "Times-Bold"; 41543 t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic"; 41544 t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic"; 41545 t["TimesNewRomanPS-BoldMT"] = "Times-Bold"; 41546 t["TimesNewRomanPS-Italic"] = "Times-Italic"; 41547 t["TimesNewRomanPS-ItalicMT"] = "Times-Italic"; 41548 t.TimesNewRomanPSMT = "Times-Roman"; 41549 t["TimesNewRomanPSMT-Bold"] = "Times-Bold"; 41550 t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic"; 41551 t["TimesNewRomanPSMT-Italic"] = "Times-Italic"; 41552}); 41553exports.getStdFontMap = getStdFontMap; 41554const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) { 41555 t.Courier = "FoxitFixed.pfb"; 41556 t["Courier-Bold"] = "FoxitFixedBold.pfb"; 41557 t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb"; 41558 t["Courier-Oblique"] = "FoxitFixedItalic.pfb"; 41559 t.Helvetica = "FoxitSans.pfb"; 41560 t["Helvetica-Bold"] = "FoxitSansBold.pfb"; 41561 t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb"; 41562 t["Helvetica-Oblique"] = "FoxitSansItalic.pfb"; 41563 t["Times-Roman"] = "FoxitSerif.pfb"; 41564 t["Times-Bold"] = "FoxitSerifBold.pfb"; 41565 t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb"; 41566 t["Times-Italic"] = "FoxitSerifItalic.pfb"; 41567 t.Symbol = "FoxitSymbol.pfb"; 41568 t.ZapfDingbats = "FoxitDingbats.pfb"; 41569 t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf"; 41570 t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf"; 41571 t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf"; 41572 t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf"; 41573}); 41574exports.getFontNameToFileMap = getFontNameToFileMap; 41575const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 41576 t.Calibri = "Helvetica"; 41577 t["Calibri-Bold"] = "Helvetica-Bold"; 41578 t["Calibri-BoldItalic"] = "Helvetica-BoldOblique"; 41579 t["Calibri-Italic"] = "Helvetica-Oblique"; 41580 t.CenturyGothic = "Helvetica"; 41581 t["CenturyGothic-Bold"] = "Helvetica-Bold"; 41582 t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique"; 41583 t["CenturyGothic-Italic"] = "Helvetica-Oblique"; 41584 t.ComicSansMS = "Comic Sans MS"; 41585 t["ComicSansMS-Bold"] = "Comic Sans MS-Bold"; 41586 t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic"; 41587 t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
41588 t["ItcSymbol-Bold"] = "Helvetica-Bold"; 41589 t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique"; 41590 t["ItcSymbol-Book"] = "Helvetica"; 41591 t["ItcSymbol-BookItalic"] = "Helvetica-Oblique"; 41592 t["ItcSymbol-Medium"] = "Helvetica"; 41593 t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique"; 41594 t.LucidaConsole = "Courier"; 41595 t["LucidaConsole-Bold"] = "Courier-Bold"; 41596 t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique"; 41597 t["LucidaConsole-Italic"] = "Courier-Oblique"; 41598 t["LucidaSans-Demi"] = "Helvetica-Bold"; 41599 t["MS-Gothic"] = "MS Gothic"; 41600 t["MS-Gothic-Bold"] = "MS Gothic-Bold"; 41601 t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic"; 41602 t["MS-Gothic-Italic"] = "MS Gothic-Italic"; 41603 t["MS-Mincho"] = "MS Mincho"; 41604 t["MS-Mincho-Bold"] = "MS Mincho-Bold"; 41605 t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic"; 41606 t["MS-Mincho-Italic"] = "MS Mincho-Italic"; 41607 t["MS-PGothic"] = "MS PGothic"; 41608 t["MS-PGothic-Bold"] = "MS PGothic-Bold"; 41609 t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic"; 41610 t["MS-PGothic-Italic"] = "MS PGothic-Italic"; 41611 t["MS-PMincho"] = "MS PMincho"; 41612 t["MS-PMincho-Bold"] = "MS PMincho-Bold"; 41613 t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic"; 41614 t["MS-PMincho-Italic"] = "MS PMincho-Italic"; 41615 t.NuptialScript = "Times-Italic"; 41616 t.SegoeUISymbol = "Helvetica"; 41617 t.Wingdings = "ZapfDingbats"; 41618 t["Wingdings-Regular"] = "ZapfDingbats"; 41619}); 41620exports.getNonStdFontMap = getNonStdFontMap; 41621const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 41622 t["Adobe Jenson"] = true; 41623 t["Adobe Text"] = true; 41624 t.Albertus = true; 41625 t.Aldus = true; 41626 t.Alexandria = true; 41627 t.Algerian = true; 41628 t["American Typewriter"] = true; 41629 t.Antiqua = true; 41630 t.Apex = true; 41631 t.Arno = true; 41632 t.Aster = true; 41633 t.Aurora = true; 41634 t.Baskerville = true; 41635 t.Bell = true; 41636 t.Bembo = true; 41637 t["Bembo Schoolbook"] = true; 41638 t.Benguiat = true; 41639 t["Berkeley Old Style"] = true; 41640 t["Bernhard Modern"] = true; 41641 t["Berthold City"] = true; 41642 t.Bodoni = true; 41643 t["Bauer Bodoni"] = true; 41644 t["Book Antiqua"] = true; 41645 t.Bookman = true; 41646 t["Bordeaux Roman"] = true; 41647 t["Californian FB"] = true; 41648 t.Calisto = true; 41649 t.Calvert = true; 41650 t.Capitals = true; 41651 t.Cambria = true; 41652 t.Cartier = true; 41653 t.Caslon = true; 41654 t.Catull = true; 41655 t.Centaur = true; 41656 t["Century Old Style"] = true; 41657 t["Century Schoolbook"] = true; 41658 t.Chaparral = true; 41659 t["Charis SIL"] = true; 41660 t.Cheltenham = true; 41661 t["Cholla Slab"] = true; 41662 t.Clarendon = true; 41663 t.Clearface = true; 41664 t.Cochin = true; 41665 t.Colonna = true; 41666 t["Computer Modern"] = true; 41667 t["Concrete Roman"] = true; 41668 t.Constantia = true; 41669 t["Cooper Black"] = true; 41670 t.Corona = true; 41671 t.Ecotype = true; 41672 t.Egyptienne = true; 41673 t.Elephant = true; 41674 t.Excelsior = true; 41675 t.Fairfield = true; 41676 t["FF Scala"] = true; 41677 t.Folkard = true; 41678 t.Footlight = true; 41679 t.FreeSerif = true; 41680 t["Friz Quadrata"] = true; 41681 t.Garamond = true; 41682 t.Gentium = true; 41683 t.Georgia = true; 41684 t.Gloucester = true; 41685 t["Goudy Old Style"] = true; 41686 t["Goudy Schoolbook"] = true; 41687 t["Goudy Pro Font"] = true; 41688 t.Granjon = true; 41689 t["Guardian Egyptian"] = true; 41690 t.Heather = true; 41691 t.Hercules = true; 41692 t["High Tower Text"] = true; 41693 t.Hiroshige = true; 41694 t["Hoefler Text"] = true; 41695 t["Humana Serif"] = true; 41696 t.Imprint = true; 41697 t["Ionic No. 5"] = true; 41698 t.Janson = true; 41699 t.Joanna = true; 41700 t.Korinna = true; 41701 t.Lexicon = true; 41702 t.LiberationSerif = true; 41703 t["Liberation Serif"] = true; 41704 t["Linux Libertine"] = true; 41705 t.Literaturnaya = true; 41706 t.Lucida = true; 41707 t["Lucida Bright"] = true; 41708 t.Melior = true; 41709 t.Memphis = true; 41710 t.Miller = true; 41711 t.Minion = true; 41712 t.Modern = true; 41713 t["Mona Lisa"] = true; 41714 t["Mrs Eaves"] = true; 41715 t["MS Serif"] = true; 41716 t["Museo Slab"] = true; 41717 t["New York"] = true; 41718 t["Nimbus Roman"] = true; 41719 t["NPS Rawlinson Roadway"] = true; 41720 t.NuptialScript = true; 41721 t.Palatino = true; 41722 t.Perpetua = true; 41723 t.Plantin = true; 41724 t["Plantin Schoolbook"] = true; 41725 t.Playbill = true; 41726 t["Poor Richard"] = true; 41727 t["Rawlinson Roadway"] = true; 41728 t.Renault = true; 41729 t.Requiem = true; 41730 t.Rockwell = true; 41731 t.Roman = true; 41732 t["Rotis Serif"] = true; 41733 t.Sabon = true; 41734 t.Scala = true; 41735 t.Seagull = true; 41736 t.Sistina = true; 41737 t.Souvenir = true; 41738 t.STIX = true; 41739 t["Stone Informal"] = true; 41740 t["Stone Serif"] = true; 41741 t.Sylfaen = true; 41742 t.Times = true; 41743 t.Trajan = true; 41744 t["Trinité"] = true; 41745 t["Trump Mediaeval"] = true; 41746 t.Utopia = true; 41747 t["Vale Type"] = true;
41748 t["Bitstream Vera"] = true; 41749 t["Vera Serif"] = true; 41750 t.Versailles = true; 41751 t.Wanted = true; 41752 t.Weiss = true; 41753 t["Wide Latin"] = true; 41754 t.Windsor = true; 41755 t.XITS = true; 41756}); 41757exports.getSerifFonts = getSerifFonts; 41758const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 41759 t.Dingbats = true; 41760 t.Symbol = true; 41761 t.ZapfDingbats = true; 41762}); 41763exports.getSymbolsFonts = getSymbolsFonts; 41764const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 41765 t[2] = 10; 41766 t[3] = 32; 41767 t[4] = 33; 41768 t[5] = 34; 41769 t[6] = 35; 41770 t[7] = 36; 41771 t[8] = 37; 41772 t[9] = 38; 41773 t[10] = 39; 41774 t[11] = 40; 41775 t[12] = 41; 41776 t[13] = 42; 41777 t[14] = 43; 41778 t[15] = 44; 41779 t[16] = 45; 41780 t[17] = 46; 41781 t[18] = 47; 41782 t[19] = 48; 41783 t[20] = 49; 41784 t[21] = 50; 41785 t[22] = 51; 41786 t[23] = 52; 41787 t[24] = 53; 41788 t[25] = 54; 41789 t[26] = 55; 41790 t[27] = 56; 41791 t[28] = 57; 41792 t[29] = 58; 41793 t[30] = 894; 41794 t[31] = 60; 41795 t[32] = 61; 41796 t[33] = 62; 41797 t[34] = 63; 41798 t[35] = 64; 41799 t[36] = 65; 41800 t[37] = 66; 41801 t[38] = 67; 41802 t[39] = 68; 41803 t[40] = 69; 41804 t[41] = 70; 41805 t[42] = 71; 41806 t[43] = 72; 41807 t[44] = 73; 41808 t[45] = 74; 41809 t[46] = 75; 41810 t[47] = 76; 41811 t[48] = 77; 41812 t[49] = 78; 41813 t[50] = 79; 41814 t[51] = 80; 41815 t[52] = 81; 41816 t[53] = 82; 41817 t[54] = 83; 41818 t[55] = 84; 41819 t[56] = 85; 41820 t[57] = 86; 41821 t[58] = 87; 41822 t[59] = 88; 41823 t[60] = 89; 41824 t[61] = 90; 41825 t[62] = 91; 41826 t[63] = 92; 41827 t[64] = 93; 41828 t[65] = 94; 41829 t[66] = 95; 41830 t[67] = 96; 41831 t[68] = 97; 41832 t[69] = 98; 41833 t[70] = 99; 41834 t[71] = 100; 41835 t[72] = 101; 41836 t[73] = 102; 41837 t[74] = 103; 41838 t[75] = 104; 41839 t[76] = 105; 41840 t[77] = 106; 41841 t[78] = 107; 41842 t[79] = 108; 41843 t[80] = 109; 41844 t[81] = 110; 41845 t[82] = 111; 41846 t[83] = 112; 41847 t[84] = 113; 41848 t[85] = 114; 41849 t[86] = 115; 41850 t[87] = 116; 41851 t[88] = 117; 41852 t[89] = 118; 41853 t[90] = 119; 41854 t[91] = 120; 41855 t[92] = 121; 41856 t[93] = 122; 41857 t[94] = 123; 41858 t[95] = 124; 41859 t[96] = 125; 41860 t[97] = 126; 41861 t[98] = 196; 41862 t[99] = 197; 41863 t[100] = 199; 41864 t[101] = 201; 41865 t[102] = 209; 41866 t[103] = 214; 41867 t[104] = 220; 41868 t[105] = 225; 41869 t[106] = 224; 41870 t[107] = 226; 41871 t[108] = 228; 41872 t[109] = 227; 41873 t[110] = 229; 41874 t[111] = 231; 41875 t[112] = 233; 41876 t[113] = 232; 41877 t[114] = 234; 41878 t[115] = 235; 41879 t[116] = 237; 41880 t[117] = 236; 41881 t[118] = 238; 41882 t[119] = 239; 41883 t[120] = 241; 41884 t[121] = 243; 41885 t[122] = 242; 41886 t[123] = 244; 41887 t[124] = 246; 41888 t[125] = 245; 41889 t[126] = 250; 41890 t[127] = 249; 41891 t[128] = 251; 41892 t[129] = 252; 41893 t[130] = 8224; 41894 t[131] = 176; 41895 t[132] = 162; 41896 t[133] = 163; 41897 t[134] = 167; 41898 t[135] = 8226; 41899 t[136] = 182; 41900 t[137] = 223; 41901 t[138] = 174; 41902 t[139] = 169; 41903 t[140] = 8482; 41904 t[141] = 180; 41905 t[142] = 168; 41906 t[143] = 8800; 41907 t[144] = 198; 41908 t[145] = 216; 41909 t[146] = 8734; 41910 t[147] = 177; 41911 t[148] = 8804; 41912 t[149] = 8805; 41913 t[150] = 165; 41914 t[151] = 181; 41915 t[152] = 8706; 41916 t[153] = 8721; 41917 t[154] = 8719; 41918 t[156] = 8747; 41919 t[157] = 170; 41920 t[158] = 186; 41921 t[159] = 8486; 41922 t[160] = 230; 41923 t[161] = 248; 41924 t[162] = 191; 41925 t[163] = 161; 41926 t[164] = 172; 41927 t[165] = 8730; 41928 t[166] = 402; 41929 t[167] = 8776; 41930 t[168] = 8710; 41931 t[169] = 171; 41932 t[170] = 187; 41933 t[171] = 8230; 41934 t[200] = 193; 41935 t[203] = 205; 41936 t[210] = 218; 41937 t[223] = 711; 41938 t[224] = 321; 41939 t[225] = 322; 41940 t[226] = 352; 41941 t[227] = 353; 41942 t[228] = 381; 41943 t[229] = 382; 41944 t[233] = 221; 41945 t[234] = 253; 41946 t[252] = 263; 41947 t[253] = 268; 41948 t[254] = 269; 41949 t[258] = 258; 41950 t[260] = 260; 41951 t[261] = 261; 41952 t[265] = 280; 41953 t[266] = 281; 41954 t[267] = 282; 41955 t[268] = 283; 41956 t[269] = 313; 41957 t[275] = 323; 41958 t[276] = 324; 41959 t[278] = 328; 41960 t[283] = 344; 41961 t[284] = 345; 41962 t[285] = 346; 41963 t[286] = 347; 41964 t[292] = 367; 41965 t[295] = 377; 41966 t[296] = 378; 41967 t[298] = 380; 41968 t[305] = 963; 41969 t[306] = 964; 41970 t[307] = 966; 41971 t[308] = 8215; 41972 t[309] = 8252; 41973 t[310] = 8319; 41974 t[311] = 8359; 41975 t[312] = 8592; 41976 t[313] = 8593; 41977 t[337] = 9552; 41978 t[493] = 1039; 41979 t[494] = 1040; 41980 t[705] = 1524; 41981 t[706] = 8362; 41982 t[710] = 64288; 41983 t[711] = 64298; 41984 t[759] = 1617; 41985 t[761] = 1776; 41986 t[763] = 1778; 41987 t[775] = 1652; 41988 t[777] = 1764; 41989 t[778] = 1780; 41990 t[779] = 1781; 41991 t[780] = 1782; 41992 t[782] = 771; 41993 t[783] = 64726; 41994 t[786] = 8363; 41995 t[788] = 8532; 41996 t[790] = 768; 41997 t[791] = 769; 41998 t[792] = 768; 41999 t[795] = 803; 42000 t[797] = 64336; 42001 t[798] = 64337; 42002 t[799] = 64342; 42003 t[800] = 64343;
42004 t[801] = 64344; 42005 t[802] = 64345; 42006 t[803] = 64362; 42007 t[804] = 64363; 42008 t[805] = 64364; 42009 t[2424] = 7821; 42010 t[2425] = 7822; 42011 t[2426] = 7823; 42012 t[2427] = 7824; 42013 t[2428] = 7825; 42014 t[2429] = 7826; 42015 t[2430] = 7827; 42016 t[2433] = 7682; 42017 t[2678] = 8045; 42018 t[2679] = 8046; 42019 t[2830] = 1552; 42020 t[2838] = 686; 42021 t[2840] = 751; 42022 t[2842] = 753; 42023 t[2843] = 754; 42024 t[2844] = 755; 42025 t[2846] = 757; 42026 t[2856] = 767; 42027 t[2857] = 848; 42028 t[2858] = 849; 42029 t[2862] = 853; 42030 t[2863] = 854; 42031 t[2864] = 855; 42032 t[2865] = 861; 42033 t[2866] = 862; 42034 t[2906] = 7460; 42035 t[2908] = 7462; 42036 t[2909] = 7463; 42037 t[2910] = 7464; 42038 t[2912] = 7466; 42039 t[2913] = 7467; 42040 t[2914] = 7468; 42041 t[2916] = 7470; 42042 t[2917] = 7471; 42043 t[2918] = 7472; 42044 t[2920] = 7474; 42045 t[2921] = 7475; 42046 t[2922] = 7476; 42047 t[2924] = 7478; 42048 t[2925] = 7479; 42049 t[2926] = 7480; 42050 t[2928] = 7482; 42051 t[2929] = 7483; 42052 t[2930] = 7484; 42053 t[2932] = 7486; 42054 t[2933] = 7487; 42055 t[2934] = 7488; 42056 t[2936] = 7490; 42057 t[2937] = 7491; 42058 t[2938] = 7492; 42059 t[2940] = 7494; 42060 t[2941] = 7495; 42061 t[2942] = 7496; 42062 t[2944] = 7498; 42063 t[2946] = 7500; 42064 t[2948] = 7502; 42065 t[2950] = 7504; 42066 t[2951] = 7505; 42067 t[2952] = 7506; 42068 t[2954] = 7508; 42069 t[2955] = 7509; 42070 t[2956] = 7510; 42071 t[2958] = 7512; 42072 t[2959] = 7513; 42073 t[2960] = 7514; 42074 t[2962] = 7516; 42075 t[2963] = 7517; 42076 t[2964] = 7518; 42077 t[2966] = 7520; 42078 t[2967] = 7521; 42079 t[2968] = 7522; 42080 t[2970] = 7524; 42081 t[2971] = 7525; 42082 t[2972] = 7526; 42083 t[2974] = 7528; 42084 t[2975] = 7529; 42085 t[2976] = 7530; 42086 t[2978] = 1537; 42087 t[2979] = 1538; 42088 t[2980] = 1539; 42089 t[2982] = 1549; 42090 t[2983] = 1551; 42091 t[2984] = 1552; 42092 t[2986] = 1554; 42093 t[2987] = 1555; 42094 t[2988] = 1556; 42095 t[2990] = 1623; 42096 t[2991] = 1624; 42097 t[2995] = 1775; 42098 t[2999] = 1791; 42099 t[3002] = 64290; 42100 t[3003] = 64291; 42101 t[3004] = 64292; 42102 t[3006] = 64294; 42103 t[3007] = 64295; 42104 t[3008] = 64296; 42105 t[3011] = 1900; 42106 t[3014] = 8223; 42107 t[3015] = 8244; 42108 t[3017] = 7532; 42109 t[3018] = 7533; 42110 t[3019] = 7534; 42111 t[3075] = 7590; 42112 t[3076] = 7591; 42113 t[3079] = 7594; 42114 t[3080] = 7595; 42115 t[3083] = 7598; 42116 t[3084] = 7599; 42117 t[3087] = 7602; 42118 t[3088] = 7603; 42119 t[3091] = 7606; 42120 t[3092] = 7607; 42121 t[3095] = 7610; 42122 t[3096] = 7611; 42123 t[3099] = 7614; 42124 t[3100] = 7615; 42125 t[3103] = 7618; 42126 t[3104] = 7619; 42127 t[3107] = 8337; 42128 t[3108] = 8338; 42129 t[3116] = 1884; 42130 t[3119] = 1885; 42131 t[3120] = 1885; 42132 t[3123] = 1886; 42133 t[3124] = 1886; 42134 t[3127] = 1887; 42135 t[3128] = 1887; 42136 t[3131] = 1888; 42137 t[3132] = 1888; 42138 t[3135] = 1889; 42139 t[3136] = 1889; 42140 t[3139] = 1890; 42141 t[3140] = 1890; 42142 t[3143] = 1891; 42143 t[3144] = 1891; 42144 t[3147] = 1892; 42145 t[3148] = 1892; 42146 t[3153] = 580; 42147 t[3154] = 581; 42148 t[3157] = 584; 42149 t[3158] = 585; 42150 t[3161] = 588; 42151 t[3162] = 589; 42152 t[3165] = 891; 42153 t[3166] = 892; 42154 t[3169] = 1274; 42155 t[3170] = 1275; 42156 t[3173] = 1278; 42157 t[3174] = 1279; 42158 t[3181] = 7622; 42159 t[3182] = 7623; 42160 t[3282] = 11799; 42161 t[3316] = 578; 42162 t[3379] = 42785; 42163 t[3393] = 1159; 42164 t[3416] = 8377; 42165}); 42166exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts; 42167const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) { 42168 t[227] = 322; 42169 t[264] = 261; 42170 t[291] = 346; 42171}); 42172exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack; 42173const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) { 42174 t[1] = 32; 42175 t[4] = 65; 42176 t[6] = 193; 42177 t[17] = 66; 42178 t[18] = 67; 42179 t[21] = 268; 42180 t[24] = 68; 42181 t[28] = 69; 42182 t[30] = 201; 42183 t[32] = 282; 42184 t[38] = 70; 42185 t[39] = 71; 42186 t[44] = 72; 42187 t[47] = 73; 42188 t[49] = 205; 42189 t[58] = 74; 42190 t[60] = 75; 42191 t[62] = 76; 42192 t[68] = 77; 42193 t[69] = 78; 42194 t[75] = 79; 42195 t[87] = 80; 42196 t[89] = 81; 42197 t[90] = 82; 42198 t[92] = 344; 42199 t[94] = 83; 42200 t[97] = 352; 42201 t[100] = 84; 42202 t[104] = 85; 42203 t[115] = 86; 42204 t[116] = 87; 42205 t[121] = 88; 42206 t[122] = 89; 42207 t[124] = 221; 42208 t[127] = 90; 42209 t[129] = 381; 42210 t[258] = 97; 42211 t[260] = 225; 42212 t[268] = 261; 42213 t[271] = 98; 42214 t[272] = 99; 42215 t[273] = 263; 42216 t[275] = 269; 42217 t[282] = 100; 42218 t[286] = 101; 42219 t[288] = 233; 42220 t[290] = 283; 42221 t[295] = 281; 42222 t[296] = 102; 42223 t[336] = 103; 42224 t[346] = 104; 42225 t[349] = 105; 42226 t[351] = 237; 42227 t[361] = 106; 42228 t[364] = 107; 42229 t[367] = 108; 42230 t[371] = 322; 42231 t[373] = 109; 42232 t[374] = 110; 42233 t[381] = 111; 42234 t[383] = 243; 42235 t[393] = 112; 42236 t[395] = 113; 42237 t[396] = 114; 42238 t[398] = 345; 42239 t[400] = 115;
42240 t[401] = 347; 42241 t[403] = 353; 42242 t[410] = 116; 42243 t[437] = 117; 42244 t[448] = 118; 42245 t[449] = 119; 42246 t[454] = 120; 42247 t[455] = 121; 42248 t[457] = 253; 42249 t[460] = 122; 42250 t[462] = 382; 42251 t[463] = 380; 42252 t[853] = 44; 42253 t[855] = 58; 42254 t[856] = 46; 42255 t[876] = 47; 42256 t[878] = 45; 42257 t[882] = 45; 42258 t[894] = 40; 42259 t[895] = 41; 42260 t[896] = 91; 42261 t[897] = 93; 42262 t[923] = 64; 42263 t[1004] = 48; 42264 t[1005] = 49; 42265 t[1006] = 50; 42266 t[1007] = 51; 42267 t[1008] = 52; 42268 t[1009] = 53; 42269 t[1010] = 54; 42270 t[1011] = 55; 42271 t[1012] = 56; 42272 t[1013] = 57; 42273 t[1081] = 37; 42274 t[1085] = 43; 42275 t[1086] = 45; 42276}); 42277exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri; 42278 42279function getStandardFontName(name) { 42280 const fontName = (0, _fonts_utils.normalizeFontName)(name); 42281 const stdFontMap = getStdFontMap(); 42282 return stdFontMap[fontName]; 42283} 42284 42285/***/ }), 42286/* 48 */ 42287/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 42288 42289 42290 42291Object.defineProperty(exports, "__esModule", ({ 42292 value: true 42293})); 42294exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0; 42295 42296var _util = __w_pdfjs_require__(2); 42297 42298class ToUnicodeMap { 42299 constructor(cmap = []) { 42300 this._map = cmap; 42301 } 42302 42303 get length() { 42304 return this._map.length; 42305 } 42306 42307 forEach(callback) { 42308 for (const charCode in this._map) { 42309 callback(charCode, this._map[charCode].charCodeAt(0)); 42310 } 42311 } 42312 42313 has(i) { 42314 return this._map[i] !== undefined; 42315 } 42316 42317 get(i) { 42318 return this._map[i]; 42319 } 42320 42321 charCodeOf(value) { 42322 const map = this._map; 42323 42324 if (map.length <= 0x10000) { 42325 return map.indexOf(value); 42326 } 42327 42328 for (const charCode in map) { 42329 if (map[charCode] === value) { 42330 return charCode | 0; 42331 } 42332 } 42333 42334 return -1; 42335 } 42336 42337 amend(map) { 42338 for (const charCode in map) { 42339 this._map[charCode] = map[charCode]; 42340 } 42341 } 42342 42343} 42344 42345exports.ToUnicodeMap = ToUnicodeMap; 42346 42347class IdentityToUnicodeMap { 42348 constructor(firstChar, lastChar) { 42349 this.firstChar = firstChar; 42350 this.lastChar = lastChar; 42351 } 42352 42353 get length() { 42354 return this.lastChar + 1 - this.firstChar; 42355 } 42356 42357 forEach(callback) { 42358 for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) { 42359 callback(i, i); 42360 } 42361 } 42362 42363 has(i) { 42364 return this.firstChar <= i && i <= this.lastChar; 42365 } 42366 42367 get(i) { 42368 if (this.firstChar <= i && i <= this.lastChar) { 42369 return String.fromCharCode(i); 42370 } 42371 42372 return undefined; 42373 } 42374 42375 charCodeOf(v) { 42376 return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1; 42377 } 42378 42379 amend(map) { 42380 (0, _util.unreachable)("Should not call amend()"); 42381 } 42382 42383} 42384 42385exports.IdentityToUnicodeMap = IdentityToUnicodeMap; 42386 42387/***/ }), 42388/* 49 */ 42389/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 42390 42391 42392 42393Object.defineProperty(exports, "__esModule", ({ 42394 value: true 42395})); 42396exports.CFFFont = void 0; 42397 42398var _cff_parser = __w_pdfjs_require__(45); 42399 42400var _fonts_utils = __w_pdfjs_require__(18); 42401 42402var _util = __w_pdfjs_require__(2); 42403 42404class CFFFont { 42405 constructor(file, properties) { 42406 this.properties = properties; 42407 const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED); 42408 this.cff = parser.parse(); 42409 this.cff.duplicateFirstGlyph(); 42410 const compiler = new _cff_parser.CFFCompiler(this.cff); 42411 this.seacs = this.cff.seacs; 42412 42413 try { 42414 this.data = compiler.compile(); 42415 } catch (e) { 42416 (0, _util.warn)("Failed to compile font " + properties.loadedName); 42417 this.data = file; 42418 } 42419 42420 this._createBuiltInEncoding(); 42421 } 42422 42423 get numGlyphs() { 42424 return this.cff.charStrings.count; 42425 } 42426 42427 getCharset() { 42428 return this.cff.charset.charset; 42429 } 42430 42431 getGlyphMapping() { 42432 const cff = this.cff; 42433 const properties = this.properties; 42434 const charsets = cff.charset.charset; 42435 let charCodeToGlyphId; 42436 let glyphId; 42437 42438 if (properties.composite) { 42439 charCodeToGlyphId = Object.create(null); 42440 let charCode; 42441 42442 if (cff.isCIDFont) { 42443 for (glyphId = 0; glyphId < charsets.length; glyphId++) { 42444 const cid = charsets[glyphId]; 42445 charCode = properties.cMap.charCodeOf(cid); 42446 charCodeToGlyphId[charCode] = glyphId; 42447 } 42448 } else { 42449 for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
vendor: 5,230 bytes, lines 42450-42676
42450 charCode = properties.cMap.charCodeOf(glyphId); 42451 charCodeToGlyphId[charCode] = glyphId; 42452 } 42453 } 42454 42455 return charCodeToGlyphId; 42456 } 42457 42458 let encoding = cff.encoding ? cff.encoding.encoding : null; 42459 42460 if (properties.isInternalFont) { 42461 encoding = properties.defaultEncoding; 42462 } 42463 42464 charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets); 42465 return charCodeToGlyphId; 42466 } 42467 42468 hasGlyphId(id) { 42469 return this.cff.hasGlyphId(id); 42470 } 42471 42472 _createBuiltInEncoding() { 42473 const { 42474 charset, 42475 encoding 42476 } = this.cff; 42477 42478 if (!charset || !encoding) { 42479 return; 42480 } 42481 42482 const charsets = charset.charset, 42483 encodings = encoding.encoding; 42484 const map = []; 42485 42486 for (const charCode in encodings) { 42487 const glyphId = encodings[charCode]; 42488 42489 if (glyphId >= 0) { 42490 const glyphName = charsets[glyphId]; 42491 42492 if (glyphName) { 42493 map[charCode] = glyphName; 42494 } 42495 } 42496 } 42497 42498 if (map.length > 0) { 42499 this.properties.builtInEncoding = map; 42500 } 42501 } 42502 42503} 42504 42505exports.CFFFont = CFFFont; 42506 42507/***/ }), 42508/* 50 */ 42509/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 42510 42511 42512 42513Object.defineProperty(exports, "__esModule", ({ 42514 value: true 42515})); 42516exports.FontRendererFactory = void 0; 42517 42518var _util = __w_pdfjs_require__(2); 42519 42520var _cff_parser = __w_pdfjs_require__(45); 42521 42522var _glyphlist = __w_pdfjs_require__(20); 42523 42524var _encodings = __w_pdfjs_require__(19); 42525 42526var _stream = __w_pdfjs_require__(10); 42527 42528function getLong(data, offset) { 42529 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 42530} 42531 42532function getUshort(data, offset) { 42533 return data[offset] << 8 | data[offset + 1]; 42534} 42535 42536function getSubroutineBias(subrs) { 42537 const numSubrs = subrs.length; 42538 let bias = 32768; 42539 42540 if (numSubrs < 1240) { 42541 bias = 107; 42542 } else if (numSubrs < 33900) { 42543 bias = 1131; 42544 } 42545 42546 return bias; 42547} 42548 42549function parseCmap(data, start, end) { 42550 const offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16); 42551 const format = getUshort(data, start + offset); 42552 let ranges, p, i; 42553 42554 if (format === 4) { 42555 getUshort(data, start + offset + 2); 42556 const segCount = getUshort(data, start + offset + 6) >> 1; 42557 p = start + offset + 14; 42558 ranges = []; 42559 42560 for (i = 0; i < segCount; i++, p += 2) { 42561 ranges[i] = { 42562 end: getUshort(data, p) 42563 }; 42564 } 42565 42566 p += 2; 42567 42568 for (i = 0; i < segCount; i++, p += 2) { 42569 ranges[i].start = getUshort(data, p); 42570 } 42571 42572 for (i = 0; i < segCount; i++, p += 2) { 42573 ranges[i].idDelta = getUshort(data, p); 42574 } 42575 42576 for (i = 0; i < segCount; i++, p += 2) { 42577 let idOffset = getUshort(data, p); 42578 42579 if (idOffset === 0) { 42580 continue; 42581 } 42582 42583 ranges[i].ids = []; 42584 42585 for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) { 42586 ranges[i].ids[j] = getUshort(data, p + idOffset); 42587 idOffset += 2; 42588 } 42589 } 42590 42591 return ranges; 42592 } else if (format === 12) { 42593 getLong(data, start + offset + 4); 42594 const groups = getLong(data, start + offset + 12); 42595 p = start + offset + 16; 42596 ranges = []; 42597 42598 for (i = 0; i < groups; i++) { 42599 ranges.push({ 42600 start: getLong(data, p), 42601 end: getLong(data, p + 4), 42602 idDelta: getLong(data, p + 8) - getLong(data, p) 42603 }); 42604 p += 12; 42605 } 42606 42607 return ranges; 42608 } 42609 42610 throw new _util.FormatError(`unsupported cmap: ${format}`); 42611} 42612 42613function parseCff(data, start, end, seacAnalysisEnabled) { 42614 const properties = {}; 42615 const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled); 42616 const cff = parser.parse(); 42617 return { 42618 glyphs: cff.charStrings.objects, 42619 subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects, 42620 gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects, 42621 isCFFCIDFont: cff.isCIDFont, 42622 fdSelect: cff.fdSelect, 42623 fdArray: cff.fdArray 42624 }; 42625} 42626 42627function parseGlyfTable(glyf, loca, isGlyphLocationsLong) { 42628 let itemSize, itemDecode; 42629 42630 if (isGlyphLocationsLong) { 42631 itemSize = 4; 42632 42633 itemDecode = function fontItemDecodeLong(data, offset) { 42634 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 42635 }; 42636 } else { 42637 itemSize = 2; 42638 42639 itemDecode = function fontItemDecode(data, offset) { 42640 return data[offset] << 9 | data[offset + 1] << 1; 42641 }; 42642 } 42643 42644 const glyphs = []; 42645 let startOffset = itemDecode(loca, 0); 42646 42647 for (let j = itemSize; j < loca.length; j += itemSize) { 42648 const endOffset = itemDecode(loca, j); 42649 glyphs.push(glyf.subarray(startOffset, endOffset)); 42650 startOffset = endOffset; 42651 } 42652 42653 return glyphs; 42654} 42655 42656function lookupCmap(ranges, unicode) { 42657 const code = unicode.codePointAt(0); 42658 let gid = 0, 42659 l = 0, 42660 r = ranges.length - 1; 42661 42662 while (l < r) { 42663 const c = l + r + 1 >> 1; 42664 42665 if (code < ranges[c].start) { 42666 r = c - 1; 42667 } else { 42668 l = c; 42669 } 42670 } 42671 42672 if (ranges[l].start <= code && code <= ranges[l].end) { 42673 gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff; 42674 } 42675 42676 return {
42677 charCode: code, 42678 glyphId: gid 42679 }; 42680} 42681 42682function compileGlyf(code, cmds, font) { 42683 function moveTo(x, y) { 42684 cmds.push({ 42685 cmd: "moveTo", 42686 args: [x, y] 42687 }); 42688 } 42689 42690 function lineTo(x, y) { 42691 cmds.push({ 42692 cmd: "lineTo", 42693 args: [x, y] 42694 }); 42695 } 42696 42697 function quadraticCurveTo(xa, ya, x, y) { 42698 cmds.push({ 42699 cmd: "quadraticCurveTo", 42700 args: [xa, ya, x, y] 42701 }); 42702 } 42703 42704 let i = 0; 42705 const numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16; 42706 let flags; 42707 let x = 0, 42708 y = 0; 42709 i += 10; 42710 42711 if (numberOfContours < 0) { 42712 do { 42713 flags = code[i] << 8 | code[i + 1]; 42714 const glyphIndex = code[i + 2] << 8 | code[i + 3]; 42715 i += 4; 42716 let arg1, arg2; 42717 42718 if (flags & 0x01) { 42719 arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16; 42720 arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16; 42721 i += 4; 42722 } else { 42723 arg1 = code[i++]; 42724 arg2 = code[i++]; 42725 } 42726 42727 if (flags & 0x02) { 42728 x = arg1; 42729 y = arg2; 42730 } else { 42731 x = 0; 42732 y = 0; 42733 } 42734 42735 let scaleX = 1, 42736 scaleY = 1, 42737 scale01 = 0, 42738 scale10 = 0; 42739 42740 if (flags & 0x08) { 42741 scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824; 42742 i += 2; 42743 } else if (flags & 0x40) { 42744 scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824; 42745 scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824; 42746 i += 4; 42747 } else if (flags & 0x80) { 42748 scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824; 42749 scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824; 42750 scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824; 42751 scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824; 42752 i += 8; 42753 } 42754 42755 const subglyph = font.glyphs[glyphIndex]; 42756 42757 if (subglyph) { 42758 cmds.push({ 42759 cmd: "save" 42760 }, { 42761 cmd: "transform", 42762 args: [scaleX, scale01, scale10, scaleY, x, y] 42763 }); 42764 compileGlyf(subglyph, cmds, font); 42765 cmds.push({ 42766 cmd: "restore" 42767 }); 42768 } 42769 } while (flags & 0x20); 42770 } else { 42771 const endPtsOfContours = []; 42772 let j, jj; 42773 42774 for (j = 0; j < numberOfContours; j++) { 42775 endPtsOfContours.push(code[i] << 8 | code[i + 1]); 42776 i += 2; 42777 } 42778 42779 const instructionLength = code[i] << 8 | code[i + 1]; 42780 i += 2 + instructionLength; 42781 const numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1; 42782 const points = []; 42783 42784 while (points.length < numberOfPoints) { 42785 flags = code[i++]; 42786 let repeat = 1; 42787 42788 if (flags & 0x08) { 42789 repeat += code[i++]; 42790 } 42791 42792 while (repeat-- > 0) { 42793 points.push({ 42794 flags 42795 }); 42796 } 42797 } 42798 42799 for (j = 0; j < numberOfPoints; j++) { 42800 switch (points[j].flags & 0x12) { 42801 case 0x00: 42802 x += (code[i] << 24 | code[i + 1] << 16) >> 16; 42803 i += 2; 42804 break; 42805 42806 case 0x02: 42807 x -= code[i++]; 42808 break; 42809 42810 case 0x12: 42811 x += code[i++]; 42812 break; 42813 } 42814 42815 points[j].x = x; 42816 } 42817 42818 for (j = 0; j < numberOfPoints; j++) { 42819 switch (points[j].flags & 0x24) { 42820 case 0x00: 42821 y += (code[i] << 24 | code[i + 1] << 16) >> 16; 42822 i += 2; 42823 break; 42824 42825 case 0x04: 42826 y -= code[i++]; 42827 break; 42828 42829 case 0x24: 42830 y += code[i++]; 42831 break; 42832 } 42833 42834 points[j].y = y; 42835 } 42836 42837 let startPoint = 0; 42838 42839 for (i = 0; i < numberOfContours; i++) { 42840 const endPoint = endPtsOfContours[i]; 42841 const contour = points.slice(startPoint, endPoint + 1); 42842 42843 if (contour[0].flags & 1) { 42844 contour.push(contour[0]); 42845 } else if (contour[contour.length - 1].flags & 1) { 42846 contour.unshift(contour[contour.length - 1]); 42847 } else { 42848 const p = { 42849 flags: 1, 42850 x: (contour[0].x + contour[contour.length - 1].x) / 2, 42851 y: (contour[0].y + contour[contour.length - 1].y) / 2 42852 }; 42853 contour.unshift(p); 42854 contour.push(p); 42855 } 42856 42857 moveTo(contour[0].x, contour[0].y); 42858 42859 for (j = 1, jj = contour.length; j < jj; j++) { 42860 if (contour[j].flags & 1) { 42861 lineTo(contour[j].x, contour[j].y); 42862 } else if (contour[j + 1].flags & 1) { 42863 quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y); 42864 j++; 42865 } else { 42866 quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2); 42867 } 42868 } 42869 42870 startPoint = endPoint + 1; 42871 } 42872 } 42873} 42874 42875function compileCharString(charStringCode, cmds, font, glyphId) { 42876 function moveTo(x, y) { 42877 cmds.push({ 42878 cmd: "moveTo", 42879 args: [x, y] 42880 }); 42881 } 42882 42883 function lineTo(x, y) { 42884 cmds.push({ 42885 cmd: "lineTo", 42886 args: [x, y] 42887 }); 42888 } 42889 42890 function bezierCurveTo(x1, y1, x2, y2, x, y) { 42891 cmds.push({ 42892 cmd: "bezierCurveTo", 42893 args: [x1, y1, x2, y2, x, y] 42894 }); 42895 } 42896 42897 const stack = []; 42898 let x = 0, 42899 y = 0; 42900 let stems = 0; 42901 42902 function parse(code) { 42903 let i = 0; 42904 42905 while (i < code.length) { 42906 let stackClean = false;
vendor: 10,196 bytes, lines 42907-43292
42907 let v = code[i++]; 42908 let xa, xb, ya, yb, y1, y2, y3, n, subrCode; 42909 42910 switch (v) { 42911 case 1: 42912 stems += stack.length >> 1; 42913 stackClean = true; 42914 break; 42915 42916 case 3: 42917 stems += stack.length >> 1; 42918 stackClean = true; 42919 break; 42920 42921 case 4: 42922 y += stack.pop(); 42923 moveTo(x, y); 42924 stackClean = true; 42925 break; 42926 42927 case 5: 42928 while (stack.length > 0) { 42929 x += stack.shift(); 42930 y += stack.shift(); 42931 lineTo(x, y); 42932 } 42933 42934 break; 42935 42936 case 6: 42937 while (stack.length > 0) { 42938 x += stack.shift(); 42939 lineTo(x, y); 42940 42941 if (stack.length === 0) { 42942 break; 42943 } 42944 42945 y += stack.shift(); 42946 lineTo(x, y); 42947 } 42948 42949 break; 42950 42951 case 7: 42952 while (stack.length > 0) { 42953 y += stack.shift(); 42954 lineTo(x, y); 42955 42956 if (stack.length === 0) { 42957 break; 42958 } 42959 42960 x += stack.shift(); 42961 lineTo(x, y); 42962 } 42963 42964 break; 42965 42966 case 8: 42967 while (stack.length > 0) { 42968 xa = x + stack.shift(); 42969 ya = y + stack.shift(); 42970 xb = xa + stack.shift(); 42971 yb = ya + stack.shift(); 42972 x = xb + stack.shift(); 42973 y = yb + stack.shift(); 42974 bezierCurveTo(xa, ya, xb, yb, x, y); 42975 } 42976 42977 break; 42978 42979 case 10: 42980 n = stack.pop(); 42981 subrCode = null; 42982 42983 if (font.isCFFCIDFont) { 42984 const fdIndex = font.fdSelect.getFDIndex(glyphId); 42985 42986 if (fdIndex >= 0 && fdIndex < font.fdArray.length) { 42987 const fontDict = font.fdArray[fdIndex]; 42988 let subrs; 42989 42990 if (fontDict.privateDict && fontDict.privateDict.subrsIndex) { 42991 subrs = fontDict.privateDict.subrsIndex.objects; 42992 } 42993 42994 if (subrs) { 42995 n += getSubroutineBias(subrs); 42996 subrCode = subrs[n]; 42997 } 42998 } else { 42999 (0, _util.warn)("Invalid fd index for glyph index."); 43000 } 43001 } else { 43002 subrCode = font.subrs[n + font.subrsBias]; 43003 } 43004 43005 if (subrCode) { 43006 parse(subrCode); 43007 } 43008 43009 break; 43010 43011 case 11: 43012 return; 43013 43014 case 12: 43015 v = code[i++]; 43016 43017 switch (v) { 43018 case 34: 43019 xa = x + stack.shift(); 43020 xb = xa + stack.shift(); 43021 y1 = y + stack.shift(); 43022 x = xb + stack.shift(); 43023 bezierCurveTo(xa, y, xb, y1, x, y1); 43024 xa = x + stack.shift(); 43025 xb = xa + stack.shift(); 43026 x = xb + stack.shift(); 43027 bezierCurveTo(xa, y1, xb, y, x, y); 43028 break; 43029 43030 case 35: 43031 xa = x + stack.shift(); 43032 ya = y + stack.shift(); 43033 xb = xa + stack.shift(); 43034 yb = ya + stack.shift(); 43035 x = xb + stack.shift(); 43036 y = yb + stack.shift(); 43037 bezierCurveTo(xa, ya, xb, yb, x, y); 43038 xa = x + stack.shift(); 43039 ya = y + stack.shift(); 43040 xb = xa + stack.shift(); 43041 yb = ya + stack.shift(); 43042 x = xb + stack.shift(); 43043 y = yb + stack.shift(); 43044 bezierCurveTo(xa, ya, xb, yb, x, y); 43045 stack.pop(); 43046 break; 43047 43048 case 36: 43049 xa = x + stack.shift(); 43050 y1 = y + stack.shift(); 43051 xb = xa + stack.shift(); 43052 y2 = y1 + stack.shift(); 43053 x = xb + stack.shift(); 43054 bezierCurveTo(xa, y1, xb, y2, x, y2); 43055 xa = x + stack.shift(); 43056 xb = xa + stack.shift(); 43057 y3 = y2 + stack.shift(); 43058 x = xb + stack.shift(); 43059 bezierCurveTo(xa, y2, xb, y3, x, y); 43060 break; 43061 43062 case 37: 43063 const x0 = x, 43064 y0 = y; 43065 xa = x + stack.shift(); 43066 ya = y + stack.shift(); 43067 xb = xa + stack.shift(); 43068 yb = ya + stack.shift(); 43069 x = xb + stack.shift(); 43070 y = yb + stack.shift(); 43071 bezierCurveTo(xa, ya, xb, yb, x, y); 43072 xa = x + stack.shift(); 43073 ya = y + stack.shift(); 43074 xb = xa + stack.shift(); 43075 yb = ya + stack.shift(); 43076 x = xb; 43077 y = yb; 43078 43079 if (Math.abs(x - x0) > Math.abs(y - y0)) { 43080 x += stack.shift(); 43081 } else { 43082 y += stack.shift(); 43083 } 43084 43085 bezierCurveTo(xa, ya, xb, yb, x, y); 43086 break; 43087 43088 default: 43089 throw new _util.FormatError(`unknown operator: 12 ${v}`); 43090 } 43091 43092 break; 43093 43094 case 14: 43095 if (stack.length >= 4) { 43096 const achar = stack.pop(); 43097 const bchar = stack.pop(); 43098 y = stack.pop(); 43099 x = stack.pop(); 43100 cmds.push({ 43101 cmd: "save" 43102 }, { 43103 cmd: "translate", 43104 args: [x, y] 43105 }); 43106 let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]])); 43107 compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); 43108 cmds.push({ 43109 cmd: "restore" 43110 }); 43111 cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]])); 43112 compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); 43113 } 43114 43115 return; 43116 43117 case 18: 43118 stems += stack.length >> 1; 43119 stackClean = true; 43120 break; 43121 43122 case 19: 43123 stems += stack.length >> 1; 43124 i += stems + 7 >> 3; 43125 stackClean = true; 43126 break; 43127 43128 case 20: 43129 stems += stack.length >> 1; 43130 i += stems + 7 >> 3; 43131 stackClean = true; 43132 break; 43133 43134 case 21: 43135 y += stack.pop(); 43136 x += stack.pop(); 43137 moveTo(x, y); 43138 stackClean = true; 43139 break; 43140 43141 case 22: 43142 x += stack.pop(); 43143 moveTo(x, y); 43144 stackClean = true; 43145 break; 43146 43147 case 23: 43148 stems += stack.length >> 1; 43149 stackClean = true; 43150 break; 43151 43152 case 24: 43153 while (stack.length > 2) { 43154 xa = x + stack.shift(); 43155 ya = y + stack.shift(); 43156 xb = xa + stack.shift(); 43157 yb = ya + stack.shift(); 43158 x = xb + stack.shift(); 43159 y = yb + stack.shift(); 43160 bezierCurveTo(xa, ya, xb, yb, x, y); 43161 } 43162 43163 x += stack.shift(); 43164 y += stack.shift(); 43165 lineTo(x, y); 43166 break; 43167 43168 case 25: 43169 while (stack.length > 6) { 43170 x += stack.shift(); 43171 y += stack.shift(); 43172 lineTo(x, y); 43173 } 43174 43175 xa = x + stack.shift(); 43176 ya = y + stack.shift(); 43177 xb = xa + stack.shift(); 43178 yb = ya + stack.shift(); 43179 x = xb + stack.shift(); 43180 y = yb + stack.shift(); 43181 bezierCurveTo(xa, ya, xb, yb, x, y); 43182 break; 43183 43184 case 26: 43185 if (stack.length % 2) { 43186 x += stack.shift(); 43187 } 43188 43189 while (stack.length > 0) { 43190 xa = x; 43191 ya = y + stack.shift(); 43192 xb = xa + stack.shift(); 43193 yb = ya + stack.shift(); 43194 x = xb; 43195 y = yb + stack.shift(); 43196 bezierCurveTo(xa, ya, xb, yb, x, y); 43197 } 43198 43199 break; 43200 43201 case 27: 43202 if (stack.length % 2) { 43203 y += stack.shift(); 43204 } 43205 43206 while (stack.length > 0) { 43207 xa = x + stack.shift(); 43208 ya = y; 43209 xb = xa + stack.shift(); 43210 yb = ya + stack.shift(); 43211 x = xb + stack.shift(); 43212 y = yb; 43213 bezierCurveTo(xa, ya, xb, yb, x, y); 43214 } 43215 43216 break; 43217 43218 case 28: 43219 stack.push((code[i] << 24 | code[i + 1] << 16) >> 16); 43220 i += 2; 43221 break; 43222 43223 case 29: 43224 n = stack.pop() + font.gsubrsBias; 43225 subrCode = font.gsubrs[n]; 43226 43227 if (subrCode) { 43228 parse(subrCode); 43229 } 43230 43231 break; 43232 43233 case 30: 43234 while (stack.length > 0) { 43235 xa = x; 43236 ya = y + stack.shift(); 43237 xb = xa + stack.shift(); 43238 yb = ya + stack.shift(); 43239 x = xb + stack.shift(); 43240 y = yb + (stack.length === 1 ? stack.shift() : 0); 43241 bezierCurveTo(xa, ya, xb, yb, x, y); 43242 43243 if (stack.length === 0) { 43244 break; 43245 } 43246 43247 xa = x + stack.shift(); 43248 ya = y; 43249 xb = xa + stack.shift(); 43250 yb = ya + stack.shift(); 43251 y = yb + stack.shift(); 43252 x = xb + (stack.length === 1 ? stack.shift() : 0); 43253 bezierCurveTo(xa, ya, xb, yb, x, y); 43254 } 43255 43256 break; 43257 43258 case 31: 43259 while (stack.length > 0) { 43260 xa = x + stack.shift(); 43261 ya = y; 43262 xb = xa + stack.shift(); 43263 yb = ya + stack.shift(); 43264 y = yb + stack.shift(); 43265 x = xb + (stack.length === 1 ? stack.shift() : 0); 43266 bezierCurveTo(xa, ya, xb, yb, x, y); 43267 43268 if (stack.length === 0) { 43269 break; 43270 } 43271 43272 xa = x; 43273 ya = y + stack.shift(); 43274 xb = xa + stack.shift(); 43275 yb = ya + stack.shift(); 43276 x = xb + stack.shift(); 43277 y = yb + (stack.length === 1 ? stack.shift() : 0); 43278 bezierCurveTo(xa, ya, xb, yb, x, y); 43279 } 43280 43281 break; 43282 43283 default: 43284 if (v < 32) { 43285 throw new _util.FormatError(`unknown operator: ${v}`); 43286 } 43287 43288 if (v < 247) { 43289 stack.push(v - 139); 43290 } else if (v < 251) { 43291 stack.push((v - 247) * 256 + code[i++] + 108); 43292 } else if (v < 255) {
43293 stack.push(-(v - 251) * 256 - code[i++] - 108); 43294 } else { 43295 stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536); 43296 i += 4; 43297 } 43298 43299 break; 43300 } 43301 43302 if (stackClean) { 43303 stack.length = 0; 43304 } 43305 } 43306 } 43307 43308 parse(charStringCode); 43309} 43310 43311const NOOP = []; 43312 43313class CompiledFont { 43314 constructor(fontMatrix) { 43315 if (this.constructor === CompiledFont) { 43316 (0, _util.unreachable)("Cannot initialize CompiledFont."); 43317 } 43318 43319 this.fontMatrix = fontMatrix; 43320 this.compiledGlyphs = Object.create(null); 43321 this.compiledCharCodeToGlyphId = Object.create(null); 43322 } 43323 43324 getPathJs(unicode) { 43325 const { 43326 charCode, 43327 glyphId 43328 } = lookupCmap(this.cmap, unicode); 43329 let fn = this.compiledGlyphs[glyphId]; 43330 43331 if (!fn) { 43332 try { 43333 fn = this.compileGlyph(this.glyphs[glyphId], glyphId); 43334 this.compiledGlyphs[glyphId] = fn; 43335 } catch (ex) { 43336 this.compiledGlyphs[glyphId] = NOOP; 43337 43338 if (this.compiledCharCodeToGlyphId[charCode] === undefined) { 43339 this.compiledCharCodeToGlyphId[charCode] = glyphId; 43340 } 43341 43342 throw ex; 43343 } 43344 } 43345 43346 if (this.compiledCharCodeToGlyphId[charCode] === undefined) { 43347 this.compiledCharCodeToGlyphId[charCode] = glyphId; 43348 } 43349 43350 return fn; 43351 } 43352 43353 compileGlyph(code, glyphId) { 43354 if (!code || code.length === 0 || code[0] === 14) { 43355 return NOOP; 43356 } 43357 43358 let fontMatrix = this.fontMatrix; 43359 43360 if (this.isCFFCIDFont) { 43361 const fdIndex = this.fdSelect.getFDIndex(glyphId); 43362 43363 if (fdIndex >= 0 && fdIndex < this.fdArray.length) { 43364 const fontDict = this.fdArray[fdIndex]; 43365 fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX; 43366 } else { 43367 (0, _util.warn)("Invalid fd index for glyph index."); 43368 } 43369 } 43370 43371 const cmds = [{ 43372 cmd: "save" 43373 }, {
43374 cmd: "transform", 43375 args: fontMatrix.slice() 43376 }, { 43377 cmd: "scale", 43378 args: ["size", "-size"] 43379 }]; 43380 this.compileGlyphImpl(code, cmds, glyphId); 43381 cmds.push({ 43382 cmd: "restore" 43383 }); 43384 return cmds; 43385 } 43386 43387 compileGlyphImpl() { 43388 (0, _util.unreachable)("Children classes should implement this."); 43389 } 43390 43391 hasBuiltPath(unicode) { 43392 const { 43393 charCode, 43394 glyphId 43395 } = lookupCmap(this.cmap, unicode); 43396 return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined; 43397 } 43398 43399} 43400 43401class TrueTypeCompiled extends CompiledFont { 43402 constructor(glyphs, cmap, fontMatrix) { 43403 super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]); 43404 this.glyphs = glyphs; 43405 this.cmap = cmap; 43406 } 43407 43408 compileGlyphImpl(code, cmds) { 43409 compileGlyf(code, cmds, this); 43410 } 43411 43412} 43413 43414class Type2Compiled extends CompiledFont { 43415 constructor(cffInfo, cmap, fontMatrix, glyphNameMap) { 43416 super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]); 43417 this.glyphs = cffInfo.glyphs; 43418 this.gsubrs = cffInfo.gsubrs || []; 43419 this.subrs = cffInfo.subrs || []; 43420 this.cmap = cmap; 43421 this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)(); 43422 this.gsubrsBias = getSubroutineBias(this.gsubrs); 43423 this.subrsBias = getSubroutineBias(this.subrs); 43424 this.isCFFCIDFont = cffInfo.isCFFCIDFont; 43425 this.fdSelect = cffInfo.fdSelect; 43426 this.fdArray = cffInfo.fdArray; 43427 } 43428 43429 compileGlyphImpl(code, cmds, glyphId) { 43430 compileCharString(code, cmds, this, glyphId); 43431 } 43432 43433} 43434 43435class FontRendererFactory { 43436 static create(font, seacAnalysisEnabled) { 43437 const data = new Uint8Array(font.data); 43438 let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm; 43439 const numTables = getUshort(data, 4); 43440 43441 for (let i = 0, p = 12; i < numTables; i++, p += 16) { 43442 const tag = (0, _util.bytesToString)(data.subarray(p, p + 4)); 43443 const offset = getLong(data, p + 8); 43444 const length = getLong(data, p + 12); 43445 43446 switch (tag) { 43447 case "cmap": 43448 cmap = parseCmap(data, offset, offset + length); 43449 break; 43450 43451 case "glyf": 43452 glyf = data.subarray(offset, offset + length); 43453 break; 43454 43455 case "loca": 43456 loca = data.subarray(offset, offset + length); 43457 break; 43458 43459 case "head": 43460 unitsPerEm = getUshort(data, offset + 18); 43461 indexToLocFormat = getUshort(data, offset + 50); 43462 break; 43463 43464 case "CFF ": 43465 cff = parseCff(data, offset, offset + length, seacAnalysisEnabled); 43466 break; 43467 } 43468 } 43469 43470 if (glyf) { 43471 const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0]; 43472 return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix); 43473 } 43474 43475 return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap); 43476 } 43477 43478} 43479 43480exports.FontRendererFactory = FontRendererFactory; 43481 43482/***/ }), 43483/* 51 */ 43484/***/ ((__unused_webpack_module, exports) => { 43485 43486 43487 43488Object.defineProperty(exports, "__esModule", ({ 43489 value: true 43490})); 43491exports.GlyfTable = void 0; 43492const ON_CURVE_POINT = 1 << 0; 43493const X_SHORT_VECTOR = 1 << 1; 43494const Y_SHORT_VECTOR = 1 << 2; 43495const REPEAT_FLAG = 1 << 3; 43496const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4; 43497const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5; 43498const OVERLAP_SIMPLE = 1 << 6; 43499const ARG_1_AND_2_ARE_WORDS = 1 << 0; 43500const ARGS_ARE_XY_VALUES = 1 << 1; 43501const WE_HAVE_A_SCALE = 1 << 3; 43502const MORE_COMPONENTS = 1 << 5; 43503const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6; 43504const WE_HAVE_A_TWO_BY_TWO = 1 << 7; 43505const WE_HAVE_INSTRUCTIONS = 1 << 8; 43506 43507class GlyfTable { 43508 constructor({ 43509 glyfTable, 43510 isGlyphLocationsLong, 43511 locaTable, 43512 numGlyphs 43513 }) { 43514 this.glyphs = []; 43515 const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength); 43516 const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength); 43517 const offsetSize = isGlyphLocationsLong ? 4 : 2; 43518 let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0); 43519 let pos = 0; 43520 43521 for (let i = 0; i < numGlyphs; i++) { 43522 pos += offsetSize; 43523 const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos); 43524 43525 if (next === prev) { 43526 this.glyphs.push(new Glyph({})); 43527 continue; 43528 } 43529 43530 const glyph = Glyph.parse(prev, glyf); 43531 this.glyphs.push(glyph); 43532 prev = next; 43533 } 43534 } 43535 43536 getSize() { 43537 return this.glyphs.reduce((a, g) => { 43538 const size = g.getSize(); 43539 return a + (size + 3 & ~3); 43540 }, 0); 43541 } 43542 43543 write() {
vendor: 16,530 bytes, lines 43544-44235
43544 const totalSize = this.getSize(); 43545 const glyfTable = new DataView(new ArrayBuffer(totalSize)); 43546 const isLocationLong = totalSize > 0x1fffe; 43547 const offsetSize = isLocationLong ? 4 : 2; 43548 const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize)); 43549 43550 if (isLocationLong) { 43551 locaTable.setUint32(0, 0); 43552 } else { 43553 locaTable.setUint16(0, 0); 43554 } 43555 43556 let pos = 0; 43557 let locaIndex = 0; 43558 43559 for (const glyph of this.glyphs) { 43560 pos += glyph.write(pos, glyfTable); 43561 pos = pos + 3 & ~3; 43562 locaIndex += offsetSize; 43563 43564 if (isLocationLong) { 43565 locaTable.setUint32(locaIndex, pos); 43566 } else { 43567 locaTable.setUint16(locaIndex, pos >> 1); 43568 } 43569 } 43570 43571 return { 43572 isLocationLong, 43573 loca: new Uint8Array(locaTable.buffer), 43574 glyf: new Uint8Array(glyfTable.buffer) 43575 }; 43576 } 43577 43578 scale(factors) { 43579 for (let i = 0, ii = this.glyphs.length; i < ii; i++) { 43580 this.glyphs[i].scale(factors[i]); 43581 } 43582 } 43583 43584} 43585 43586exports.GlyfTable = GlyfTable; 43587 43588class Glyph { 43589 constructor({ 43590 header = null, 43591 simple = null, 43592 composites = null 43593 }) { 43594 this.header = header; 43595 this.simple = simple; 43596 this.composites = composites; 43597 } 43598 43599 static parse(pos, glyf) { 43600 const [read, header] = GlyphHeader.parse(pos, glyf); 43601 pos += read; 43602 43603 if (header.numberOfContours < 0) { 43604 const composites = []; 43605 43606 while (true) { 43607 const [n, composite] = CompositeGlyph.parse(pos, glyf); 43608 pos += n; 43609 composites.push(composite); 43610 43611 if (!(composite.flags & MORE_COMPONENTS)) { 43612 break; 43613 } 43614 } 43615 43616 return new Glyph({ 43617 header, 43618 composites 43619 }); 43620 } 43621 43622 const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours); 43623 return new Glyph({ 43624 header, 43625 simple 43626 }); 43627 } 43628 43629 getSize() { 43630 if (!this.header) { 43631 return 0; 43632 } 43633 43634 const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0); 43635 return this.header.getSize() + size; 43636 } 43637 43638 write(pos, buf) { 43639 if (!this.header) { 43640 return 0; 43641 } 43642 43643 const spos = pos; 43644 pos += this.header.write(pos, buf); 43645 43646 if (this.simple) { 43647 pos += this.simple.write(pos, buf); 43648 } else { 43649 for (const composite of this.composites) { 43650 pos += composite.write(pos, buf); 43651 } 43652 } 43653 43654 return pos - spos; 43655 } 43656 43657 scale(factor) { 43658 if (!this.header) { 43659 return; 43660 } 43661 43662 const xMiddle = (this.header.xMin + this.header.xMax) / 2; 43663 this.header.scale(xMiddle, factor); 43664 43665 if (this.simple) { 43666 this.simple.scale(xMiddle, factor); 43667 } else { 43668 for (const composite of this.composites) { 43669 composite.scale(xMiddle, factor); 43670 } 43671 } 43672 } 43673 43674} 43675 43676class GlyphHeader { 43677 constructor({ 43678 numberOfContours, 43679 xMin, 43680 yMin, 43681 xMax, 43682 yMax 43683 }) { 43684 this.numberOfContours = numberOfContours; 43685 this.xMin = xMin; 43686 this.yMin = yMin; 43687 this.xMax = xMax; 43688 this.yMax = yMax; 43689 } 43690 43691 static parse(pos, glyf) { 43692 return [10, new GlyphHeader({ 43693 numberOfContours: glyf.getInt16(pos), 43694 xMin: glyf.getInt16(pos + 2), 43695 yMin: glyf.getInt16(pos + 4), 43696 xMax: glyf.getInt16(pos + 6), 43697 yMax: glyf.getInt16(pos + 8) 43698 })]; 43699 } 43700 43701 getSize() { 43702 return 10; 43703 } 43704 43705 write(pos, buf) { 43706 buf.setInt16(pos, this.numberOfContours); 43707 buf.setInt16(pos + 2, this.xMin); 43708 buf.setInt16(pos + 4, this.yMin); 43709 buf.setInt16(pos + 6, this.xMax); 43710 buf.setInt16(pos + 8, this.yMax); 43711 return 10; 43712 } 43713 43714 scale(x, factor) { 43715 this.xMin = Math.round(x + (this.xMin - x) * factor); 43716 this.xMax = Math.round(x + (this.xMax - x) * factor); 43717 } 43718 43719} 43720 43721class Contour { 43722 constructor({ 43723 flags, 43724 xCoordinates, 43725 yCoordinates 43726 }) { 43727 this.xCoordinates = xCoordinates; 43728 this.yCoordinates = yCoordinates; 43729 this.flags = flags; 43730 } 43731 43732} 43733 43734class SimpleGlyph { 43735 constructor({ 43736 contours, 43737 instructions 43738 }) { 43739 this.contours = contours; 43740 this.instructions = instructions; 43741 } 43742 43743 static parse(pos, glyf, numberOfContours) { 43744 const endPtsOfContours = []; 43745 43746 for (let i = 0; i < numberOfContours; i++) { 43747 const endPt = glyf.getUint16(pos); 43748 pos += 2; 43749 endPtsOfContours.push(endPt); 43750 } 43751 43752 const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1; 43753 const instructionLength = glyf.getUint16(pos); 43754 pos += 2; 43755 const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); 43756 pos += instructionLength; 43757 const flags = []; 43758 43759 for (let i = 0; i < numberOfPt; pos++, i++) { 43760 let flag = glyf.getUint8(pos); 43761 flags.push(flag); 43762 43763 if (flag & REPEAT_FLAG) { 43764 const count = glyf.getUint8(++pos); 43765 flag ^= REPEAT_FLAG; 43766 43767 for (let m = 0; m < count; m++) { 43768 flags.push(flag); 43769 } 43770 43771 i += count; 43772 } 43773 } 43774 43775 const allXCoordinates = []; 43776 let xCoordinates = []; 43777 let yCoordinates = []; 43778 let pointFlags = []; 43779 const contours = []; 43780 let endPtsOfContoursIndex = 0; 43781 let lastCoordinate = 0; 43782 43783 for (let i = 0; i < numberOfPt; i++) { 43784 const flag = flags[i]; 43785 43786 if (flag & X_SHORT_VECTOR) { 43787 const x = glyf.getUint8(pos++); 43788 lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x; 43789 xCoordinates.push(lastCoordinate); 43790 } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) { 43791 xCoordinates.push(lastCoordinate); 43792 } else { 43793 lastCoordinate += glyf.getInt16(pos); 43794 pos += 2; 43795 xCoordinates.push(lastCoordinate); 43796 } 43797 43798 if (endPtsOfContours[endPtsOfContoursIndex] === i) { 43799 endPtsOfContoursIndex++; 43800 allXCoordinates.push(xCoordinates); 43801 xCoordinates = []; 43802 } 43803 } 43804 43805 lastCoordinate = 0; 43806 endPtsOfContoursIndex = 0; 43807 43808 for (let i = 0; i < numberOfPt; i++) { 43809 const flag = flags[i]; 43810 43811 if (flag & Y_SHORT_VECTOR) { 43812 const y = glyf.getUint8(pos++); 43813 lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y; 43814 yCoordinates.push(lastCoordinate); 43815 } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) { 43816 yCoordinates.push(lastCoordinate); 43817 } else { 43818 lastCoordinate += glyf.getInt16(pos); 43819 pos += 2; 43820 yCoordinates.push(lastCoordinate); 43821 } 43822 43823 pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE); 43824 43825 if (endPtsOfContours[endPtsOfContoursIndex] === i) { 43826 xCoordinates = allXCoordinates[endPtsOfContoursIndex]; 43827 endPtsOfContoursIndex++; 43828 contours.push(new Contour({ 43829 flags: pointFlags, 43830 xCoordinates, 43831 yCoordinates 43832 })); 43833 yCoordinates = []; 43834 pointFlags = []; 43835 } 43836 } 43837 43838 return new SimpleGlyph({ 43839 contours, 43840 instructions 43841 }); 43842 } 43843 43844 getSize() { 43845 let size = this.contours.length * 2 + 2 + this.instructions.length; 43846 let lastX = 0; 43847 let lastY = 0; 43848 43849 for (const contour of this.contours) { 43850 size += contour.flags.length; 43851 43852 for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { 43853 const x = contour.xCoordinates[i]; 43854 const y = contour.yCoordinates[i]; 43855 let abs = Math.abs(x - lastX); 43856 43857 if (abs > 255) { 43858 size += 2; 43859 } else if (abs > 0) { 43860 size += 1; 43861 } 43862 43863 lastX = x; 43864 abs = Math.abs(y - lastY); 43865 43866 if (abs > 255) { 43867 size += 2; 43868 } else if (abs > 0) { 43869 size += 1; 43870 } 43871 43872 lastY = y; 43873 } 43874 } 43875 43876 return size; 43877 } 43878 43879 write(pos, buf) { 43880 const spos = pos; 43881 const xCoordinates = []; 43882 const yCoordinates = []; 43883 const flags = []; 43884 let lastX = 0; 43885 let lastY = 0; 43886 43887 for (const contour of this.contours) { 43888 for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { 43889 let flag = contour.flags[i]; 43890 const x = contour.xCoordinates[i]; 43891 let delta = x - lastX; 43892 43893 if (delta === 0) { 43894 flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR; 43895 xCoordinates.push(0); 43896 } else { 43897 const abs = Math.abs(delta); 43898 43899 if (abs <= 255) { 43900 flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR; 43901 xCoordinates.push(abs); 43902 } else { 43903 xCoordinates.push(delta); 43904 } 43905 } 43906 43907 lastX = x; 43908 const y = contour.yCoordinates[i]; 43909 delta = y - lastY; 43910 43911 if (delta === 0) { 43912 flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR; 43913 yCoordinates.push(0); 43914 } else { 43915 const abs = Math.abs(delta); 43916 43917 if (abs <= 255) { 43918 flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR; 43919 yCoordinates.push(abs); 43920 } else { 43921 yCoordinates.push(delta); 43922 } 43923 } 43924 43925 lastY = y; 43926 flags.push(flag); 43927 } 43928 43929 buf.setUint16(pos, xCoordinates.length - 1); 43930 pos += 2; 43931 } 43932 43933 buf.setUint16(pos, this.instructions.length); 43934 pos += 2; 43935 43936 if (this.instructions.length) { 43937 new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos); 43938 pos += this.instructions.length; 43939 } 43940 43941 for (const flag of flags) { 43942 buf.setUint8(pos++, flag); 43943 } 43944 43945 for (let i = 0, ii = xCoordinates.length; i < ii; i++) { 43946 const x = xCoordinates[i]; 43947 const flag = flags[i]; 43948 43949 if (flag & X_SHORT_VECTOR) { 43950 buf.setUint8(pos++, x); 43951 } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) { 43952 buf.setInt16(pos, x); 43953 pos += 2; 43954 } 43955 } 43956 43957 for (let i = 0, ii = yCoordinates.length; i < ii; i++) { 43958 const y = yCoordinates[i]; 43959 const flag = flags[i]; 43960 43961 if (flag & Y_SHORT_VECTOR) { 43962 buf.setUint8(pos++, y); 43963 } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) { 43964 buf.setInt16(pos, y); 43965 pos += 2; 43966 } 43967 } 43968 43969 return pos - spos; 43970 } 43971 43972 scale(x, factor) { 43973 for (const contour of this.contours) { 43974 if (contour.xCoordinates.length === 0) { 43975 continue; 43976 } 43977 43978 for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { 43979 contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor); 43980 } 43981 } 43982 } 43983 43984} 43985 43986class CompositeGlyph { 43987 constructor({ 43988 flags, 43989 glyphIndex, 43990 argument1, 43991 argument2, 43992 transf, 43993 instructions 43994 }) { 43995 this.flags = flags; 43996 this.glyphIndex = glyphIndex; 43997 this.argument1 = argument1; 43998 this.argument2 = argument2; 43999 this.transf = transf; 44000 this.instructions = instructions; 44001 } 44002 44003 static parse(pos, glyf) { 44004 const spos = pos; 44005 const transf = []; 44006 let flags = glyf.getUint16(pos); 44007 const glyphIndex = glyf.getUint16(pos + 2); 44008 pos += 4; 44009 let argument1, argument2; 44010 44011 if (flags & ARG_1_AND_2_ARE_WORDS) { 44012 if (flags & ARGS_ARE_XY_VALUES) { 44013 argument1 = glyf.getInt16(pos); 44014 argument2 = glyf.getInt16(pos + 2); 44015 } else { 44016 argument1 = glyf.getUint16(pos); 44017 argument2 = glyf.getUint16(pos + 2); 44018 } 44019 44020 pos += 4; 44021 flags ^= ARG_1_AND_2_ARE_WORDS; 44022 } else { 44023 argument1 = glyf.getUint8(pos); 44024 argument2 = glyf.getUint8(pos + 1); 44025 44026 if (flags & ARGS_ARE_XY_VALUES) { 44027 const abs1 = argument1 & 0x7f; 44028 argument1 = argument1 & 0x80 ? -abs1 : abs1; 44029 const abs2 = argument2 & 0x7f; 44030 argument2 = argument2 & 0x80 ? -abs2 : abs2; 44031 } 44032 44033 pos += 2; 44034 } 44035 44036 if (flags & WE_HAVE_A_SCALE) { 44037 transf.push(glyf.getUint16(pos)); 44038 pos += 2; 44039 } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { 44040 transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2)); 44041 pos += 4; 44042 } else if (flags & WE_HAVE_A_TWO_BY_TWO) { 44043 transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6)); 44044 pos += 8; 44045 } 44046 44047 let instructions = null; 44048 44049 if (flags & WE_HAVE_INSTRUCTIONS) { 44050 const instructionLength = glyf.getUint16(pos); 44051 pos += 2; 44052 instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); 44053 pos += instructionLength; 44054 } 44055 44056 return [pos - spos, new CompositeGlyph({ 44057 flags, 44058 glyphIndex, 44059 argument1, 44060 argument2, 44061 transf, 44062 instructions 44063 })]; 44064 } 44065 44066 getSize() { 44067 let size = 2 + 2 + this.transf.length * 2; 44068 44069 if (this.flags & WE_HAVE_INSTRUCTIONS) { 44070 size += 2 + this.instructions.length; 44071 } 44072 44073 size += 2; 44074 44075 if (this.flags & 2) { 44076 if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) { 44077 size += 2; 44078 } 44079 } else { 44080 if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) { 44081 size += 2; 44082 } 44083 } 44084 44085 return size; 44086 } 44087 44088 write(pos, buf) { 44089 const spos = pos; 44090 44091 if (this.flags & ARGS_ARE_XY_VALUES) { 44092 if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) { 44093 this.flags |= ARG_1_AND_2_ARE_WORDS; 44094 } 44095 } else { 44096 if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) { 44097 this.flags |= ARG_1_AND_2_ARE_WORDS; 44098 } 44099 } 44100 44101 buf.setUint16(pos, this.flags); 44102 buf.setUint16(pos + 2, this.glyphIndex); 44103 pos += 4; 44104 44105 if (this.flags & ARG_1_AND_2_ARE_WORDS) { 44106 if (this.flags & ARGS_ARE_XY_VALUES) { 44107 buf.setInt16(pos, this.argument1); 44108 buf.setInt16(pos + 2, this.argument2); 44109 } else { 44110 buf.setUint16(pos, this.argument1); 44111 buf.setUint16(pos + 2, this.argument2); 44112 } 44113 44114 pos += 4; 44115 } else { 44116 buf.setUint8(pos, this.argument1); 44117 buf.setUint8(pos + 1, this.argument2); 44118 pos += 2; 44119 } 44120 44121 if (this.flags & WE_HAVE_INSTRUCTIONS) { 44122 buf.setUint16(pos, this.instructions.length); 44123 pos += 2; 44124 44125 if (this.instructions.length) { 44126 new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos); 44127 pos += this.instructions.length; 44128 } 44129 } 44130 44131 return pos - spos; 44132 } 44133 44134 scale(x, factor) {} 44135 44136} 44137 44138/***/ }), 44139/* 52 */ 44140/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 44141 44142 44143 44144Object.defineProperty(exports, "__esModule", ({ 44145 value: true 44146})); 44147exports.OpenTypeFileBuilder = void 0; 44148 44149var _core_utils = __w_pdfjs_require__(9); 44150 44151var _util = __w_pdfjs_require__(2); 44152 44153function writeInt16(dest, offset, num) { 44154 dest[offset] = num >> 8 & 0xff; 44155 dest[offset + 1] = num & 0xff; 44156} 44157 44158function writeInt32(dest, offset, num) { 44159 dest[offset] = num >> 24 & 0xff; 44160 dest[offset + 1] = num >> 16 & 0xff; 44161 dest[offset + 2] = num >> 8 & 0xff; 44162 dest[offset + 3] = num & 0xff; 44163} 44164 44165function writeData(dest, offset, data) { 44166 if (data instanceof Uint8Array) { 44167 dest.set(data, offset); 44168 } else if (typeof data === "string") { 44169 for (let i = 0, ii = data.length; i < ii; i++) { 44170 dest[offset++] = data.charCodeAt(i) & 0xff; 44171 } 44172 } else { 44173 for (let i = 0, ii = data.length; i < ii; i++) { 44174 dest[offset++] = data[i] & 0xff; 44175 } 44176 } 44177} 44178 44179const OTF_HEADER_SIZE = 12; 44180const OTF_TABLE_ENTRY_SIZE = 16; 44181 44182class OpenTypeFileBuilder { 44183 constructor(sfnt) { 44184 this.sfnt = sfnt; 44185 this.tables = Object.create(null); 44186 } 44187 44188 static getSearchParams(entriesCount, entrySize) { 44189 let maxPower2 = 1, 44190 log2 = 0; 44191 44192 while ((maxPower2 ^ entriesCount) > maxPower2) { 44193 maxPower2 <<= 1; 44194 log2++; 44195 } 44196 44197 const searchRange = maxPower2 * entrySize; 44198 return { 44199 range: searchRange, 44200 entry: log2, 44201 rangeShift: entrySize * entriesCount - searchRange 44202 }; 44203 } 44204 44205 toArray() { 44206 let sfnt = this.sfnt; 44207 const tables = this.tables; 44208 const tablesNames = Object.keys(tables); 44209 tablesNames.sort(); 44210 const numTables = tablesNames.length; 44211 let i, j, jj, table, tableName; 44212 let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE; 44213 const tableOffsets = [offset]; 44214 44215 for (i = 0; i < numTables; i++) { 44216 table = tables[tablesNames[i]]; 44217 const paddedLength = (table.length + 3 & ~3) >>> 0; 44218 offset += paddedLength; 44219 tableOffsets.push(offset); 44220 } 44221 44222 const file = new Uint8Array(offset); 44223 44224 for (i = 0; i < numTables; i++) { 44225 table = tables[tablesNames[i]]; 44226 writeData(file, tableOffsets[i], table); 44227 } 44228 44229 if (sfnt === "true") { 44230 sfnt = (0, _util.string32)(0x00010000); 44231 } 44232 44233 file[0] = sfnt.charCodeAt(0) & 0xff; 44234 file[1] = sfnt.charCodeAt(1) & 0xff; 44235 file[2] = sfnt.charCodeAt(2) & 0xff;
44236 file[3] = sfnt.charCodeAt(3) & 0xff; 44237 writeInt16(file, 4, numTables); 44238 const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16); 44239 writeInt16(file, 6, searchParams.range); 44240 writeInt16(file, 8, searchParams.entry); 44241 writeInt16(file, 10, searchParams.rangeShift); 44242 offset = OTF_HEADER_SIZE; 44243 44244 for (i = 0; i < numTables; i++) { 44245 tableName = tablesNames[i]; 44246 file[offset] = tableName.charCodeAt(0) & 0xff; 44247 file[offset + 1] = tableName.charCodeAt(1) & 0xff; 44248 file[offset + 2] = tableName.charCodeAt(2) & 0xff; 44249 file[offset + 3] = tableName.charCodeAt(3) & 0xff; 44250 let checksum = 0; 44251 44252 for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) { 44253 const quad = (0, _core_utils.readUint32)(file, j); 44254 checksum = checksum + quad >>> 0; 44255 } 44256 44257 writeInt32(file, offset + 4, checksum); 44258 writeInt32(file, offset + 8, tableOffsets[i]); 44259 writeInt32(file, offset + 12, tables[tableName].length); 44260 offset += OTF_TABLE_ENTRY_SIZE; 44261 } 44262 44263 return file; 44264 } 44265 44266 addTable(tag, data) { 44267 if (tag in this.tables) { 44268 throw new Error("Table " + tag + " already exists"); 44269 } 44270 44271 this.tables[tag] = data; 44272 } 44273 44274} 44275 44276exports.OpenTypeFileBuilder = OpenTypeFileBuilder; 44277 44278/***/ }), 44279/* 53 */ 44280/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 44281 44282 44283 44284Object.defineProperty(exports, "__esModule", ({ 44285 value: true 44286})); 44287exports.Type1Font = void 0; 44288 44289var _cff_parser = __w_pdfjs_require__(45); 44290 44291var _fonts_utils = __w_pdfjs_require__(18); 44292 44293var _core_utils = __w_pdfjs_require__(9); 44294 44295var _stream = __w_pdfjs_require__(10); 44296 44297var _type1_parser = __w_pdfjs_require__(54); 44298 44299var _util = __w_pdfjs_require__(2); 44300 44301function findBlock(streamBytes, signature, startIndex) { 44302 const streamBytesLength = streamBytes.length; 44303 const signatureLength = signature.length; 44304 const scanLength = streamBytesLength - signatureLength; 44305 let i = startIndex, 44306 found = false; 44307 44308 while (i < scanLength) { 44309 let j = 0; 44310 44311 while (j < signatureLength && streamBytes[i + j] === signature[j]) { 44312 j++; 44313 } 44314 44315 if (j >= signatureLength) { 44316 i += j; 44317 44318 while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) { 44319 i++; 44320 } 44321 44322 found = true; 44323 break; 44324 } 44325 44326 i++; 44327 } 44328 44329 return { 44330 found, 44331 length: i 44332 }; 44333} 44334 44335function getHeaderBlock(stream, suggestedLength) { 44336 const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63]; 44337 const streamStartPos = stream.pos; 44338 let headerBytes, headerBytesLength, block; 44339 44340 try { 44341 headerBytes = stream.getBytes(suggestedLength); 44342 headerBytesLength = headerBytes.length; 44343 } catch (ex) {} 44344 44345 if (headerBytesLength === suggestedLength) { 44346 block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length); 44347 44348 if (block.found && block.length === suggestedLength) { 44349 return { 44350 stream: new _stream.Stream(headerBytes), 44351 length: suggestedLength 44352 }; 44353 } 44354 } 44355 44356 (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.'); 44357 stream.pos = streamStartPos; 44358 const SCAN_BLOCK_LENGTH = 2048; 44359 let actualLength; 44360 44361 while (true) { 44362 const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 44363 block = findBlock(scanBytes, EEXEC_SIGNATURE, 0); 44364 44365 if (block.length === 0) { 44366 break; 44367 } 44368 44369 stream.pos += block.length; 44370 44371 if (block.found) { 44372 actualLength = stream.pos - streamStartPos; 44373 break; 44374 } 44375 } 44376 44377 stream.pos = streamStartPos; 44378 44379 if (actualLength) { 44380 return { 44381 stream: new _stream.Stream(stream.getBytes(actualLength)), 44382 length: actualLength 44383 }; 44384 } 44385 44386 (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.'); 44387 return { 44388 stream: new _stream.Stream(stream.getBytes(suggestedLength)), 44389 length: suggestedLength 44390 }; 44391} 44392 44393function getEexecBlock(stream, suggestedLength) { 44394 const eexecBytes = stream.getBytes(); 44395 return { 44396 stream: new _stream.Stream(eexecBytes), 44397 length: eexecBytes.length 44398 }; 44399} 44400 44401class Type1Font { 44402 constructor(name, file, properties) { 44403 const PFB_HEADER_SIZE = 6; 44404 let headerBlockLength = properties.length1; 44405 let eexecBlockLength = properties.length2; 44406 let pfbHeader = file.peekBytes(PFB_HEADER_SIZE); 44407 const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01; 44408 44409 if (pfbHeaderPresent) { 44410 file.skip(PFB_HEADER_SIZE); 44411 headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 44412 } 44413 44414 const headerBlock = getHeaderBlock(file, headerBlockLength); 44415 const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED); 44416 headerBlockParser.extractFontHeader(properties); 44417 44418 if (pfbHeaderPresent) { 44419 pfbHeader = file.getBytes(PFB_HEADER_SIZE); 44420 eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 44421 } 44422 44423 const eexecBlock = getEexecBlock(file, eexecBlockLength); 44424 const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED); 44425 const data = eexecBlockParser.extractFontProgram(properties); 44426 44427 for (const key in data.properties) { 44428 properties[key] = data.properties[key]; 44429 } 44430 44431 const charstrings = data.charstrings; 44432 const type2Charstrings = this.getType2Charstrings(charstrings); 44433 const subrs = this.getType2Subrs(data.subrs); 44434 this.charstrings = charstrings; 44435 this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
44436 this.seacs = this.getSeacs(data.charstrings); 44437 } 44438 44439 get numGlyphs() { 44440 return this.charstrings.length + 1; 44441 } 44442 44443 getCharset() { 44444 const charset = [".notdef"]; 44445 const charstrings = this.charstrings; 44446 44447 for (let glyphId = 0; glyphId < charstrings.length; glyphId++) { 44448 charset.push(charstrings[glyphId].glyphName); 44449 } 44450 44451 return charset; 44452 } 44453 44454 getGlyphMapping(properties) { 44455 const charstrings = this.charstrings; 44456 44457 if (properties.composite) { 44458 const charCodeToGlyphId = Object.create(null); 44459 44460 for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) { 44461 const charCode = properties.cMap.charCodeOf(glyphId); 44462 charCodeToGlyphId[charCode] = glyphId + 1; 44463 } 44464 44465 return charCodeToGlyphId; 44466 } 44467 44468 const glyphNames = [".notdef"]; 44469 let builtInEncoding, glyphId; 44470 44471 for (glyphId = 0; glyphId < charstrings.length; glyphId++) { 44472 glyphNames.push(charstrings[glyphId].glyphName); 44473 } 44474 44475 const encoding = properties.builtInEncoding; 44476 44477 if (encoding) { 44478 builtInEncoding = Object.create(null); 44479 44480 for (const charCode in encoding) { 44481 glyphId = glyphNames.indexOf(encoding[charCode]); 44482 44483 if (glyphId >= 0) { 44484 builtInEncoding[charCode] = glyphId; 44485 } 44486 } 44487 } 44488 44489 return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames); 44490 } 44491 44492 hasGlyphId(id) { 44493 if (id < 0 || id >= this.numGlyphs) { 44494 return false; 44495 } 44496 44497 if (id === 0) { 44498 return true; 44499 } 44500 44501 const glyph = this.charstrings[id - 1]; 44502 return glyph.charstring.length > 0; 44503 } 44504 44505 getSeacs(charstrings) { 44506 const seacMap = []; 44507 44508 for (let i = 0, ii = charstrings.length; i < ii; i++) { 44509 const charstring = charstrings[i]; 44510 44511 if (charstring.seac) { 44512 seacMap[i + 1] = charstring.seac; 44513 } 44514 } 44515 44516 return seacMap; 44517 } 44518 44519 getType2Charstrings(type1Charstrings) { 44520 const type2Charstrings = []; 44521 44522 for (let i = 0, ii = type1Charstrings.length; i < ii; i++) { 44523 type2Charstrings.push(type1Charstrings[i].charstring); 44524 } 44525 44526 return type2Charstrings; 44527 } 44528 44529 getType2Subrs(type1Subrs) { 44530 let bias = 0; 44531 const count = type1Subrs.length; 44532 44533 if (count < 1133) { 44534 bias = 107; 44535 } else if (count < 33769) { 44536 bias = 1131; 44537 } else { 44538 bias = 32768; 44539 } 44540 44541 const type2Subrs = []; 44542 let i; 44543 44544 for (i = 0; i < bias; i++) { 44545 type2Subrs.push([0x0b]); 44546 } 44547 44548 for (i = 0; i < count; i++) { 44549 type2Subrs.push(type1Subrs[i]); 44550 } 44551 44552 return type2Subrs; 44553 } 44554 44555 wrap(name, glyphs, charstrings, subrs, properties) { 44556 const cff = new _cff_parser.CFF(); 44557 cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4); 44558 cff.names = [name]; 44559 const topDict = new _cff_parser.CFFTopDict(); 44560 topDict.setByName("version", 391); 44561 topDict.setByName("Notice", 392); 44562 topDict.setByName("FullName", 393); 44563 topDict.setByName("FamilyName", 394); 44564 topDict.setByName("Weight", 395); 44565 topDict.setByName("Encoding", null); 44566 topDict.setByName("FontMatrix", properties.fontMatrix); 44567 topDict.setByName("FontBBox", properties.bbox); 44568 topDict.setByName("charset", null); 44569 topDict.setByName("CharStrings", null); 44570 topDict.setByName("Private", null); 44571 cff.topDict = topDict; 44572 const strings = new _cff_parser.CFFStrings(); 44573 strings.add("Version 0.11"); 44574 strings.add("See original notice"); 44575 strings.add(name); 44576 strings.add(name); 44577 strings.add("Medium"); 44578 cff.strings = strings; 44579 cff.globalSubrIndex = new _cff_parser.CFFIndex(); 44580 const count = glyphs.length; 44581 const charsetArray = [".notdef"]; 44582 let i, ii; 44583 44584 for (i = 0; i < count; i++) { 44585 const glyphName = charstrings[i].glyphName; 44586 44587 const index = _cff_parser.CFFStandardStrings.indexOf(glyphName); 44588 44589 if (index === -1) { 44590 strings.add(glyphName); 44591 } 44592 44593 charsetArray.push(glyphName); 44594 } 44595 44596 cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray); 44597 const charStringsIndex = new _cff_parser.CFFIndex(); 44598 charStringsIndex.add([0x8b, 0x0e]); 44599 44600 for (i = 0; i < count; i++) { 44601 charStringsIndex.add(glyphs[i]); 44602 } 44603 44604 cff.charStrings = charStringsIndex; 44605 const privateDict = new _cff_parser.CFFPrivateDict(); 44606 privateDict.setByName("Subrs", null); 44607 const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"]; 44608 44609 for (i = 0, ii = fields.length; i < ii; i++) { 44610 const field = fields[i]; 44611 44612 if (!(field in properties.privateData)) { 44613 continue; 44614 } 44615 44616 const value = properties.privateData[field]; 44617 44618 if (Array.isArray(value)) { 44619 for (let j = value.length - 1; j > 0; j--) { 44620 value[j] -= value[j - 1]; 44621 } 44622 } 44623 44624 privateDict.setByName(field, value); 44625 } 44626 44627 cff.topDict.privateDict = privateDict; 44628 const subrIndex = new _cff_parser.CFFIndex(); 44629 44630 for (i = 0, ii = subrs.length; i < ii; i++) { 44631 subrIndex.add(subrs[i]); 44632 } 44633 44634 privateDict.subrsIndex = subrIndex; 44635 const compiler = new _cff_parser.CFFCompiler(cff); 44636 return compiler.compile(); 44637 } 44638 44639} 44640 44641exports.Type1Font = Type1Font; 44642 44643/***/ }), 44644/* 54 */ 44645/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 44646 44647 44648 44649Object.defineProperty(exports, "__esModule", ({ 44650 value: true 44651})); 44652exports.Type1Parser = void 0; 44653 44654var _encodings = __w_pdfjs_require__(19); 44655 44656var _core_utils = __w_pdfjs_require__(9); 44657 44658var _stream = __w_pdfjs_require__(10); 44659 44660var _util = __w_pdfjs_require__(2); 44661 44662const HINTING_ENABLED = false;
vendor: 6,309 bytes, lines 44663-44895
44663 44664const Type1CharString = function Type1CharStringClosure() { 44665 const COMMAND_MAP = { 44666 hstem: [1], 44667 vstem: [3], 44668 vmoveto: [4], 44669 rlineto: [5], 44670 hlineto: [6], 44671 vlineto: [7], 44672 rrcurveto: [8], 44673 callsubr: [10], 44674 flex: [12, 35], 44675 drop: [12, 18], 44676 endchar: [14], 44677 rmoveto: [21], 44678 hmoveto: [22], 44679 vhcurveto: [30], 44680 hvcurveto: [31] 44681 }; 44682 44683 class Type1CharString { 44684 constructor() { 44685 this.width = 0; 44686 this.lsb = 0; 44687 this.flexing = false; 44688 this.output = []; 44689 this.stack = []; 44690 } 44691 44692 convert(encoded, subrs, seacAnalysisEnabled) { 44693 const count = encoded.length; 44694 let error = false; 44695 let wx, sbx, subrNumber; 44696 44697 for (let i = 0; i < count; i++) { 44698 let value = encoded[i]; 44699 44700 if (value < 32) { 44701 if (value === 12) { 44702 value = (value << 8) + encoded[++i]; 44703 } 44704 44705 switch (value) { 44706 case 1: 44707 if (!HINTING_ENABLED) { 44708 this.stack = []; 44709 break; 44710 } 44711 44712 error = this.executeCommand(2, COMMAND_MAP.hstem); 44713 break; 44714 44715 case 3: 44716 if (!HINTING_ENABLED) { 44717 this.stack = []; 44718 break; 44719 } 44720 44721 error = this.executeCommand(2, COMMAND_MAP.vstem); 44722 break; 44723 44724 case 4: 44725 if (this.flexing) { 44726 if (this.stack.length < 1) { 44727 error = true; 44728 break; 44729 } 44730 44731 const dy = this.stack.pop(); 44732 this.stack.push(0, dy); 44733 break; 44734 } 44735 44736 error = this.executeCommand(1, COMMAND_MAP.vmoveto); 44737 break; 44738 44739 case 5: 44740 error = this.executeCommand(2, COMMAND_MAP.rlineto); 44741 break; 44742 44743 case 6: 44744 error = this.executeCommand(1, COMMAND_MAP.hlineto); 44745 break; 44746 44747 case 7: 44748 error = this.executeCommand(1, COMMAND_MAP.vlineto); 44749 break; 44750 44751 case 8: 44752 error = this.executeCommand(6, COMMAND_MAP.rrcurveto); 44753 break; 44754 44755 case 9: 44756 this.stack = []; 44757 break; 44758 44759 case 10: 44760 if (this.stack.length < 1) { 44761 error = true; 44762 break; 44763 } 44764 44765 subrNumber = this.stack.pop(); 44766 44767 if (!subrs[subrNumber]) { 44768 error = true; 44769 break; 44770 } 44771 44772 error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled); 44773 break; 44774 44775 case 11: 44776 return error; 44777 44778 case 13: 44779 if (this.stack.length < 2) { 44780 error = true; 44781 break; 44782 } 44783 44784 wx = this.stack.pop(); 44785 sbx = this.stack.pop(); 44786 this.lsb = sbx; 44787 this.width = wx; 44788 this.stack.push(wx, sbx); 44789 error = this.executeCommand(2, COMMAND_MAP.hmoveto); 44790 break; 44791 44792 case 14: 44793 this.output.push(COMMAND_MAP.endchar[0]); 44794 break; 44795 44796 case 21: 44797 if (this.flexing) { 44798 break; 44799 } 44800 44801 error = this.executeCommand(2, COMMAND_MAP.rmoveto); 44802 break; 44803 44804 case 22: 44805 if (this.flexing) { 44806 this.stack.push(0); 44807 break; 44808 } 44809 44810 error = this.executeCommand(1, COMMAND_MAP.hmoveto); 44811 break; 44812 44813 case 30: 44814 error = this.executeCommand(4, COMMAND_MAP.vhcurveto); 44815 break; 44816 44817 case 31: 44818 error = this.executeCommand(4, COMMAND_MAP.hvcurveto); 44819 break; 44820 44821 case (12 << 8) + 0: 44822 this.stack = []; 44823 break; 44824 44825 case (12 << 8) + 1: 44826 if (!HINTING_ENABLED) { 44827 this.stack = []; 44828 break; 44829 } 44830 44831 error = this.executeCommand(2, COMMAND_MAP.vstem); 44832 break; 44833 44834 case (12 << 8) + 2: 44835 if (!HINTING_ENABLED) { 44836 this.stack = []; 44837 break; 44838 } 44839 44840 error = this.executeCommand(2, COMMAND_MAP.hstem); 44841 break; 44842 44843 case (12 << 8) + 6: 44844 if (seacAnalysisEnabled) { 44845 const asb = this.stack[this.stack.length - 5]; 44846 this.seac = this.stack.splice(-4, 4); 44847 this.seac[0] += this.lsb - asb; 44848 error = this.executeCommand(0, COMMAND_MAP.endchar); 44849 } else { 44850 error = this.executeCommand(4, COMMAND_MAP.endchar); 44851 } 44852 44853 break; 44854 44855 case (12 << 8) + 7: 44856 if (this.stack.length < 4) { 44857 error = true; 44858 break; 44859 } 44860 44861 this.stack.pop(); 44862 wx = this.stack.pop(); 44863 const sby = this.stack.pop(); 44864 sbx = this.stack.pop(); 44865 this.lsb = sbx; 44866 this.width = wx; 44867 this.stack.push(wx, sbx, sby); 44868 error = this.executeCommand(3, COMMAND_MAP.rmoveto); 44869 break; 44870 44871 case (12 << 8) + 12: 44872 if (this.stack.length < 2) { 44873 error = true; 44874 break; 44875 } 44876 44877 const num2 = this.stack.pop(); 44878 const num1 = this.stack.pop(); 44879 this.stack.push(num1 / num2); 44880 break; 44881 44882 case (12 << 8) + 16: 44883 if (this.stack.length < 2) { 44884 error = true; 44885 break; 44886 } 44887 44888 subrNumber = this.stack.pop(); 44889 const numArgs = this.stack.pop(); 44890 44891 if (subrNumber === 0 && numArgs === 3) { 44892 const flexArgs = this.stack.splice(this.stack.length - 17, 17); 44893 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]); 44894 error = this.executeCommand(13, COMMAND_MAP.flex, true); 44895 this.flexing = false;
vendor: 5,005 bytes, lines 44896-45094
44896 this.stack.push(flexArgs[15], flexArgs[16]); 44897 } else if (subrNumber === 1 && numArgs === 0) { 44898 this.flexing = true; 44899 } 44900 44901 break; 44902 44903 case (12 << 8) + 17: 44904 break; 44905 44906 case (12 << 8) + 33: 44907 this.stack = []; 44908 break; 44909 44910 default: 44911 (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"'); 44912 break; 44913 } 44914 44915 if (error) { 44916 break; 44917 } 44918 44919 continue; 44920 } else if (value <= 246) { 44921 value -= 139; 44922 } else if (value <= 250) { 44923 value = (value - 247) * 256 + encoded[++i] + 108; 44924 } else if (value <= 254) { 44925 value = -((value - 251) * 256) - encoded[++i] - 108; 44926 } else { 44927 value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0; 44928 } 44929 44930 this.stack.push(value); 44931 } 44932 44933 return error; 44934 } 44935 44936 executeCommand(howManyArgs, command, keepStack) { 44937 const stackLength = this.stack.length; 44938 44939 if (howManyArgs > stackLength) { 44940 return true; 44941 } 44942 44943 const start = stackLength - howManyArgs; 44944 44945 for (let i = start; i < stackLength; i++) { 44946 let value = this.stack[i]; 44947 44948 if (Number.isInteger(value)) { 44949 this.output.push(28, value >> 8 & 0xff, value & 0xff); 44950 } else { 44951 value = 65536 * value | 0; 44952 this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 44953 } 44954 } 44955 44956 this.output.push.apply(this.output, command); 44957 44958 if (keepStack) { 44959 this.stack.splice(start, howManyArgs); 44960 } else { 44961 this.stack.length = 0; 44962 } 44963 44964 return false; 44965 } 44966 44967 } 44968 44969 return Type1CharString; 44970}(); 44971 44972const Type1Parser = function Type1ParserClosure() { 44973 const EEXEC_ENCRYPT_KEY = 55665; 44974 const CHAR_STRS_ENCRYPT_KEY = 4330; 44975 44976 function isHexDigit(code) { 44977 return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102; 44978 } 44979 44980 function decrypt(data, key, discardNumber) { 44981 if (discardNumber >= data.length) { 44982 return new Uint8Array(0); 44983 } 44984 44985 const c1 = 52845, 44986 c2 = 22719; 44987 let r = key | 0, 44988 i, 44989 j; 44990 44991 for (i = 0; i < discardNumber; i++) { 44992 r = (data[i] + r) * c1 + c2 & (1 << 16) - 1; 44993 } 44994 44995 const count = data.length - discardNumber; 44996 const decrypted = new Uint8Array(count); 44997 44998 for (i = discardNumber, j = 0; j < count; i++, j++) { 44999 const value = data[i]; 45000 decrypted[j] = value ^ r >> 8; 45001 r = (value + r) * c1 + c2 & (1 << 16) - 1; 45002 } 45003 45004 return decrypted; 45005 } 45006 45007 function decryptAscii(data, key, discardNumber) { 45008 const c1 = 52845, 45009 c2 = 22719; 45010 let r = key | 0; 45011 const count = data.length, 45012 maybeLength = count >>> 1; 45013 const decrypted = new Uint8Array(maybeLength); 45014 let i, j; 45015 45016 for (i = 0, j = 0; i < count; i++) { 45017 const digit1 = data[i]; 45018 45019 if (!isHexDigit(digit1)) { 45020 continue; 45021 } 45022 45023 i++; 45024 let digit2; 45025 45026 while (i < count && !isHexDigit(digit2 = data[i])) { 45027 i++; 45028 } 45029 45030 if (i < count) { 45031 const value = parseInt(String.fromCharCode(digit1, digit2), 16); 45032 decrypted[j++] = value ^ r >> 8; 45033 r = (value + r) * c1 + c2 & (1 << 16) - 1; 45034 } 45035 } 45036 45037 return decrypted.slice(discardNumber, j); 45038 } 45039 45040 function isSpecial(c) { 45041 return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29; 45042 } 45043 45044 class Type1Parser { 45045 constructor(stream, encrypted, seacAnalysisEnabled) { 45046 if (encrypted) { 45047 const data = stream.getBytes(); 45048 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])); 45049 stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4)); 45050 } 45051 45052 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 45053 this.stream = stream; 45054 this.nextChar(); 45055 } 45056 45057 readNumberArray() { 45058 this.getToken(); 45059 const array = []; 45060 45061 while (true) { 45062 const token = this.getToken(); 45063 45064 if (token === null || token === "]" || token === "}") { 45065 break; 45066 } 45067 45068 array.push(parseFloat(token || 0)); 45069 } 45070 45071 return array; 45072 } 45073 45074 readNumber() { 45075 const token = this.getToken(); 45076 return parseFloat(token || 0); 45077 } 45078 45079 readInt() { 45080 const token = this.getToken(); 45081 return parseInt(token || 0, 10) | 0; 45082 } 45083 45084 readBoolean() { 45085 const token = this.getToken(); 45086 return token === "true" ? 1 : 0; 45087 } 45088 45089 nextChar() { 45090 return this.currentChar = this.stream.getByte(); 45091 } 45092 45093 getToken() { 45094 let comment = false;
45095 let ch = this.currentChar; 45096 45097 while (true) { 45098 if (ch === -1) { 45099 return null; 45100 } 45101 45102 if (comment) { 45103 if (ch === 0x0a || ch === 0x0d) { 45104 comment = false; 45105 } 45106 } else if (ch === 0x25) { 45107 comment = true; 45108 } else if (!(0, _core_utils.isWhiteSpace)(ch)) { 45109 break; 45110 } 45111 45112 ch = this.nextChar(); 45113 } 45114 45115 if (isSpecial(ch)) { 45116 this.nextChar(); 45117 return String.fromCharCode(ch); 45118 } 45119 45120 let token = ""; 45121 45122 do { 45123 token += String.fromCharCode(ch); 45124 ch = this.nextChar(); 45125 } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch)); 45126 45127 return token; 45128 } 45129 45130 readCharStrings(bytes, lenIV) { 45131 if (lenIV === -1) { 45132 return bytes; 45133 } 45134 45135 return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV); 45136 } 45137 45138 extractFontProgram(properties) { 45139 const stream = this.stream; 45140 const subrs = [], 45141 charstrings = []; 45142 const privateData = Object.create(null); 45143 privateData.lenIV = 4; 45144 const program = { 45145 subrs: [], 45146 charstrings: [], 45147 properties: { 45148 privateData 45149 } 45150 }; 45151 let token, length, data, lenIV, encoded; 45152 45153 while ((token = this.getToken()) !== null) { 45154 if (token !== "/") { 45155 continue; 45156 } 45157 45158 token = this.getToken(); 45159 45160 switch (token) { 45161 case "CharStrings": 45162 this.getToken(); 45163 this.getToken(); 45164 this.getToken(); 45165 this.getToken(); 45166 45167 while (true) { 45168 token = this.getToken(); 45169 45170 if (token === null || token === "end") { 45171 break; 45172 } 45173 45174 if (token !== "/") { 45175 continue; 45176 } 45177 45178 const glyph = this.getToken(); 45179 length = this.readInt(); 45180 this.getToken(); 45181 data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); 45182 lenIV = program.properties.privateData.lenIV; 45183 encoded = this.readCharStrings(data, lenIV); 45184 this.nextChar(); 45185 token = this.getToken(); 45186 45187 if (token === "noaccess") { 45188 this.getToken(); 45189 } 45190 45191 charstrings.push({ 45192 glyph, 45193 encoded 45194 }); 45195 } 45196 45197 break; 45198 45199 case "Subrs": 45200 this.readInt(); 45201 this.getToken(); 45202 45203 while (this.getToken() === "dup") { 45204 const index = this.readInt(); 45205 length = this.readInt(); 45206 this.getToken(); 45207 data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); 45208 lenIV = program.properties.privateData.lenIV; 45209 encoded = this.readCharStrings(data, lenIV); 45210 this.nextChar(); 45211 token = this.getToken(); 45212 45213 if (token === "noaccess") { 45214 this.getToken(); 45215 } 45216 45217 subrs[index] = encoded; 45218 } 45219 45220 break; 45221 45222 case "BlueValues": 45223 case "OtherBlues": 45224 case "FamilyBlues": 45225 case "FamilyOtherBlues": 45226 const blueArray = this.readNumberArray(); 45227 45228 if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) { 45229 program.properties.privateData[token] = blueArray; 45230 } 45231 45232 break; 45233 45234 case "StemSnapH": 45235 case "StemSnapV": 45236 program.properties.privateData[token] = this.readNumberArray(); 45237 break; 45238 45239 case "StdHW": 45240 case "StdVW": 45241 program.properties.privateData[token] = this.readNumberArray()[0]; 45242 break; 45243 45244 case "BlueShift": 45245 case "lenIV": 45246 case "BlueFuzz": 45247 case "BlueScale": 45248 case "LanguageGroup": 45249 case "ExpansionFactor": 45250 program.properties.privateData[token] = this.readNumber(); 45251 break; 45252 45253 case "ForceBold": 45254 program.properties.privateData[token] = this.readBoolean(); 45255 break; 45256 } 45257 } 45258 45259 for (let i = 0; i < charstrings.length; i++) { 45260 const glyph = charstrings[i].glyph; 45261 encoded = charstrings[i].encoded; 45262 const charString = new Type1CharString(); 45263 const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled); 45264 let output = charString.output; 45265 45266 if (error) { 45267 output = [14]; 45268 } 45269 45270 const charStringObject = { 45271 glyphName: glyph, 45272 charstring: output, 45273 width: charString.width, 45274 lsb: charString.lsb, 45275 seac: charString.seac 45276 }; 45277 45278 if (glyph === ".notdef") { 45279 program.charstrings.unshift(charStringObject); 45280 } else { 45281 program.charstrings.push(charStringObject); 45282 } 45283 45284 if (properties.builtInEncoding) { 45285 const index = properties.builtInEncoding.indexOf(glyph); 45286 45287 if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) { 45288 properties.widths[index] = charString.width; 45289 } 45290 } 45291 } 45292 45293 return program; 45294 } 45295 45296 extractFontHeader(properties) { 45297 let token; 45298 45299 while ((token = this.getToken()) !== null) { 45300 if (token !== "/") { 45301 continue; 45302 } 45303 45304 token = this.getToken(); 45305 45306 switch (token) { 45307 case "FontMatrix": 45308 const matrix = this.readNumberArray(); 45309 properties.fontMatrix = matrix; 45310 break; 45311 45312 case "Encoding": 45313 const encodingArg = this.getToken(); 45314 let encoding; 45315 45316 if (!/^\d+$/.test(encodingArg)) { 45317 encoding = (0, _encodings.getEncoding)(encodingArg); 45318 } else { 45319 encoding = []; 45320 const size = parseInt(encodingArg, 10) | 0; 45321 this.getToken(); 45322 45323 for (let j = 0; j < size; j++) { 45324 token = this.getToken(); 45325 45326 while (token !== "dup" && token !== "def") { 45327 token = this.getToken(); 45328 45329 if (token === null) { 45330 return; 45331 } 45332 } 45333 45334 if (token === "def") { 45335 break; 45336 } 45337 45338 const index = this.readInt(); 45339 this.getToken(); 45340 const glyph = this.getToken(); 45341 encoding[index] = glyph; 45342 this.getToken(); 45343 } 45344 } 45345 45346 properties.builtInEncoding = encoding; 45347 break; 45348 45349 case "FontBBox": 45350 const fontBBox = this.readNumberArray(); 45351 properties.ascent = Math.max(fontBBox[3], fontBBox[1]); 45352 properties.descent = Math.min(fontBBox[1], fontBBox[3]); 45353 properties.ascentScaled = true; 45354 break; 45355 } 45356 } 45357 } 45358 45359 } 45360 45361 return Type1Parser; 45362}(); 45363 45364exports.Type1Parser = Type1Parser; 45365 45366/***/ }), 45367/* 55 */ 45368/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 45369 45370 45371 45372Object.defineProperty(exports, "__esModule", ({ 45373 value: true 45374})); 45375exports.Pattern = void 0; 45376exports.getTilingPatternIR = getTilingPatternIR; 45377 45378var _util = __w_pdfjs_require__(2); 45379 45380var _colorspace = __w_pdfjs_require__(24); 45381 45382var _primitives = __w_pdfjs_require__(5); 45383 45384var _core_utils = __w_pdfjs_require__(9); 45385 45386const ShadingType = { 45387 FUNCTION_BASED: 1, 45388 AXIAL: 2, 45389 RADIAL: 3, 45390 FREE_FORM_MESH: 4, 45391 LATTICE_FORM_MESH: 5, 45392 COONS_PATCH_MESH: 6, 45393 TENSOR_PATCH_MESH: 7 45394}; 45395 45396class Pattern { 45397 constructor() { 45398 (0, _util.unreachable)("Cannot initialize Pattern."); 45399 } 45400 45401 static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) { 45402 const dict = (0, _primitives.isStream)(shading) ? shading.dict : shading; 45403 const type = dict.get("ShadingType"); 45404 45405 try { 45406 switch (type) { 45407 case ShadingType.AXIAL: 45408 case ShadingType.RADIAL: 45409 return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache); 45410 45411 case ShadingType.FREE_FORM_MESH: 45412 case ShadingType.LATTICE_FORM_MESH: 45413 case ShadingType.COONS_PATCH_MESH: 45414 case ShadingType.TENSOR_PATCH_MESH: 45415 return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache); 45416 45417 default: 45418 throw new _util.FormatError("Unsupported ShadingType: " + type); 45419 } 45420 } catch (ex) { 45421 if (ex instanceof _core_utils.MissingDataException) { 45422 throw ex; 45423 } 45424 45425 handler.send("UnsupportedFeature", { 45426 featureId: _util.UNSUPPORTED_FEATURES.shadingPattern 45427 }); 45428 (0, _util.warn)(ex); 45429 return new DummyShading(); 45430 } 45431 } 45432 45433} 45434 45435exports.Pattern = Pattern; 45436 45437class BaseShading { 45438 static get SMALL_NUMBER() { 45439 return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6); 45440 } 45441 45442 constructor() { 45443 if (this.constructor === BaseShading) { 45444 (0, _util.unreachable)("Cannot initialize BaseShading."); 45445 } 45446 } 45447 45448 getIR() { 45449 (0, _util.unreachable)("Abstract method `getIR` called."); 45450 } 45451 45452} 45453 45454class RadialAxialShading extends BaseShading { 45455 constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) { 45456 super(); 45457 this.coordsArr = dict.getArray("Coords"); 45458 this.shadingType = dict.get("ShadingType"); 45459 45460 const cs = _colorspace.ColorSpace.parse({ 45461 cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"), 45462 xref, 45463 resources, 45464 pdfFunctionFactory, 45465 localColorSpaceCache 45466 }); 45467 45468 const bbox = dict.getArray("BBox"); 45469 45470 if (Array.isArray(bbox) && bbox.length === 4) { 45471 this.bbox = _util.Util.normalizeRect(bbox); 45472 } else { 45473 this.bbox = null; 45474 } 45475 45476 let t0 = 0.0, 45477 t1 = 1.0; 45478 45479 if (dict.has("Domain")) { 45480 const domainArr = dict.getArray("Domain"); 45481 t0 = domainArr[0]; 45482 t1 = domainArr[1]; 45483 } 45484 45485 let extendStart = false, 45486 extendEnd = false;
45487 45488 if (dict.has("Extend")) { 45489 const extendArr = dict.getArray("Extend"); 45490 extendStart = extendArr[0]; 45491 extendEnd = extendArr[1]; 45492 } 45493 45494 if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) { 45495 const [x1, y1, r1, x2, y2, r2] = this.coordsArr; 45496 const distance = Math.hypot(x1 - x2, y1 - y2); 45497 45498 if (r1 <= r2 + distance && r2 <= r1 + distance) { 45499 (0, _util.warn)("Unsupported radial gradient."); 45500 } 45501 } 45502 45503 this.extendStart = extendStart; 45504 this.extendEnd = extendEnd; 45505 const fnObj = dict.getRaw("Function"); 45506 const fn = pdfFunctionFactory.createFromArray(fnObj); 45507 const NUMBER_OF_SAMPLES = 10; 45508 const step = (t1 - t0) / NUMBER_OF_SAMPLES; 45509 const colorStops = this.colorStops = []; 45510 45511 if (t0 >= t1 || step <= 0) { 45512 (0, _util.info)("Bad shading domain."); 45513 return; 45514 } 45515 45516 const color = new Float32Array(cs.numComps), 45517 ratio = new Float32Array(1); 45518 let rgbColor; 45519 45520 for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) { 45521 ratio[0] = t0 + i * step; 45522 fn(ratio, 0, color, 0); 45523 rgbColor = cs.getRgb(color, 0); 45524 45525 const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]); 45526 45527 colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]); 45528 } 45529 45530 let background = "transparent"; 45531
45532 if (dict.has("Background")) { 45533 rgbColor = cs.getRgb(dict.get("Background"), 0); 45534 background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]); 45535 } 45536 45537 if (!extendStart) { 45538 colorStops.unshift([0, background]); 45539 colorStops[1][0] += BaseShading.SMALL_NUMBER; 45540 } 45541 45542 if (!extendEnd) { 45543 colorStops[colorStops.length - 1][0] -= BaseShading.SMALL_NUMBER; 45544 colorStops.push([1, background]); 45545 } 45546 45547 this.colorStops = colorStops; 45548 } 45549 45550 getIR() { 45551 const coordsArr = this.coordsArr; 45552 const shadingType = this.shadingType; 45553 let type, p0, p1, r0, r1; 45554 45555 if (shadingType === ShadingType.AXIAL) { 45556 p0 = [coordsArr[0], coordsArr[1]]; 45557 p1 = [coordsArr[2], coordsArr[3]]; 45558 r0 = null; 45559 r1 = null; 45560 type = "axial"; 45561 } else if (shadingType === ShadingType.RADIAL) { 45562 p0 = [coordsArr[0], coordsArr[1]]; 45563 p1 = [coordsArr[3], coordsArr[4]]; 45564 r0 = coordsArr[2]; 45565 r1 = coordsArr[5]; 45566 type = "radial"; 45567 } else { 45568 (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`); 45569 } 45570 45571 return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1]; 45572 } 45573 45574} 45575 45576class MeshStreamReader { 45577 constructor(stream, context) { 45578 this.stream = stream; 45579 this.context = context; 45580 this.buffer = 0; 45581 this.bufferLength = 0; 45582 const numComps = context.numComps; 45583 this.tmpCompsBuf = new Float32Array(numComps); 45584 const csNumComps = context.colorSpace.numComps; 45585 this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf; 45586 } 45587 45588 get hasData() { 45589 if (this.stream.end) { 45590 return this.stream.pos < this.stream.end; 45591 } 45592 45593 if (this.bufferLength > 0) { 45594 return true; 45595 } 45596 45597 const nextByte = this.stream.getByte(); 45598 45599 if (nextByte < 0) { 45600 return false; 45601 } 45602 45603 this.buffer = nextByte; 45604 this.bufferLength = 8; 45605 return true; 45606 } 45607 45608 readBits(n) { 45609 let buffer = this.buffer; 45610 let bufferLength = this.bufferLength; 45611 45612 if (n === 32) { 45613 if (bufferLength === 0) { 45614 return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0; 45615 } 45616 45617 buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte(); 45618 const nextByte = this.stream.getByte(); 45619 this.buffer = nextByte & (1 << bufferLength) - 1; 45620 return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0; 45621 } 45622 45623 if (n === 8 && bufferLength === 0) { 45624 return this.stream.getByte(); 45625 } 45626 45627 while (bufferLength < n) { 45628 buffer = buffer << 8 | this.stream.getByte(); 45629 bufferLength += 8; 45630 } 45631 45632 bufferLength -= n; 45633 this.bufferLength = bufferLength; 45634 this.buffer = buffer & (1 << bufferLength) - 1; 45635 return buffer >> bufferLength; 45636 } 45637 45638 align() { 45639 this.buffer = 0; 45640 this.bufferLength = 0; 45641 } 45642 45643 readFlag() { 45644 return this.readBits(this.context.bitsPerFlag); 45645 } 45646 45647 readCoordinate() { 45648 const bitsPerCoordinate = this.context.bitsPerCoordinate; 45649 const xi = this.readBits(bitsPerCoordinate); 45650 const yi = this.readBits(bitsPerCoordinate); 45651 const decode = this.context.decode; 45652 const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10; 45653 return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]]; 45654 } 45655 45656 readComponents() { 45657 const numComps = this.context.numComps; 45658 const bitsPerComponent = this.context.bitsPerComponent; 45659 const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10; 45660 const decode = this.context.decode; 45661 const components = this.tmpCompsBuf; 45662 45663 for (let i = 0, j = 4; i < numComps; i++, j += 2) { 45664 const ci = this.readBits(bitsPerComponent); 45665 components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j]; 45666 } 45667 45668 const color = this.tmpCsCompsBuf; 45669 45670 if (this.context.colorFn) { 45671 this.context.colorFn(components, 0, color, 0); 45672 } 45673 45674 return this.context.colorSpace.getRgb(color, 0); 45675 } 45676 45677} 45678 45679const getB = function getBClosure() { 45680 function buildB(count) { 45681 const lut = []; 45682 45683 for (let i = 0; i <= count; i++) { 45684 const t = i / count, 45685 t_ = 1 - t; 45686 lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t])); 45687 } 45688 45689 return lut; 45690 } 45691 45692 const cache = []; 45693 return function (count) { 45694 if (!cache[count]) { 45695 cache[count] = buildB(count); 45696 } 45697 45698 return cache[count]; 45699 }; 45700}(); 45701 45702class MeshShading extends BaseShading { 45703 static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() { 45704 return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3); 45705 } 45706 45707 static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() { 45708 return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20); 45709 } 45710 45711 static get TRIANGLE_DENSITY() { 45712 return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20); 45713 } 45714 45715 constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) { 45716 super(); 45717 45718 if (!(0, _primitives.isStream)(stream)) { 45719 throw new _util.FormatError("Mesh data is not a stream"); 45720 } 45721 45722 const dict = stream.dict; 45723 this.shadingType = dict.get("ShadingType"); 45724 const bbox = dict.getArray("BBox"); 45725 45726 if (Array.isArray(bbox) && bbox.length === 4) { 45727 this.bbox = _util.Util.normalizeRect(bbox); 45728 } else { 45729 this.bbox = null; 45730 } 45731 45732 const cs = _colorspace.ColorSpace.parse({ 45733 cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"), 45734 xref, 45735 resources, 45736 pdfFunctionFactory, 45737 localColorSpaceCache 45738 }); 45739
vendor: 14,163 bytes, lines 45740-46210
45740 this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null; 45741 const fnObj = dict.getRaw("Function"); 45742 const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null; 45743 this.coords = []; 45744 this.colors = []; 45745 this.figures = []; 45746 const decodeContext = { 45747 bitsPerCoordinate: dict.get("BitsPerCoordinate"), 45748 bitsPerComponent: dict.get("BitsPerComponent"), 45749 bitsPerFlag: dict.get("BitsPerFlag"), 45750 decode: dict.getArray("Decode"), 45751 colorFn: fn, 45752 colorSpace: cs, 45753 numComps: fn ? 1 : cs.numComps 45754 }; 45755 const reader = new MeshStreamReader(stream, decodeContext); 45756 let patchMesh = false; 45757 45758 switch (this.shadingType) { 45759 case ShadingType.FREE_FORM_MESH: 45760 this._decodeType4Shading(reader); 45761 45762 break; 45763 45764 case ShadingType.LATTICE_FORM_MESH: 45765 const verticesPerRow = dict.get("VerticesPerRow") | 0; 45766 45767 if (verticesPerRow < 2) { 45768 throw new _util.FormatError("Invalid VerticesPerRow"); 45769 } 45770 45771 this._decodeType5Shading(reader, verticesPerRow); 45772 45773 break; 45774 45775 case ShadingType.COONS_PATCH_MESH: 45776 this._decodeType6Shading(reader); 45777 45778 patchMesh = true; 45779 break; 45780 45781 case ShadingType.TENSOR_PATCH_MESH: 45782 this._decodeType7Shading(reader); 45783 45784 patchMesh = true; 45785 break; 45786 45787 default: 45788 (0, _util.unreachable)("Unsupported mesh type."); 45789 break; 45790 } 45791 45792 if (patchMesh) { 45793 this._updateBounds(); 45794 45795 for (let i = 0, ii = this.figures.length; i < ii; i++) { 45796 this._buildFigureFromPatch(i); 45797 } 45798 } 45799 45800 this._updateBounds(); 45801 45802 this._packData(); 45803 } 45804 45805 _decodeType4Shading(reader) { 45806 const coords = this.coords; 45807 const colors = this.colors; 45808 const operators = []; 45809 const ps = []; 45810 let verticesLeft = 0; 45811 45812 while (reader.hasData) { 45813 const f = reader.readFlag(); 45814 const coord = reader.readCoordinate(); 45815 const color = reader.readComponents(); 45816 45817 if (verticesLeft === 0) { 45818 if (!(0 <= f && f <= 2)) { 45819 throw new _util.FormatError("Unknown type4 flag"); 45820 } 45821 45822 switch (f) { 45823 case 0: 45824 verticesLeft = 3; 45825 break; 45826 45827 case 1: 45828 ps.push(ps[ps.length - 2], ps[ps.length - 1]); 45829 verticesLeft = 1; 45830 break; 45831 45832 case 2: 45833 ps.push(ps[ps.length - 3], ps[ps.length - 1]); 45834 verticesLeft = 1; 45835 break; 45836 } 45837 45838 operators.push(f); 45839 } 45840 45841 ps.push(coords.length); 45842 coords.push(coord); 45843 colors.push(color); 45844 verticesLeft--; 45845 reader.align(); 45846 } 45847 45848 this.figures.push({ 45849 type: "triangles", 45850 coords: new Int32Array(ps), 45851 colors: new Int32Array(ps) 45852 }); 45853 } 45854 45855 _decodeType5Shading(reader, verticesPerRow) { 45856 const coords = this.coords; 45857 const colors = this.colors; 45858 const ps = []; 45859 45860 while (reader.hasData) { 45861 const coord = reader.readCoordinate(); 45862 const color = reader.readComponents(); 45863 ps.push(coords.length); 45864 coords.push(coord); 45865 colors.push(color); 45866 } 45867 45868 this.figures.push({ 45869 type: "lattice", 45870 coords: new Int32Array(ps), 45871 colors: new Int32Array(ps), 45872 verticesPerRow 45873 }); 45874 } 45875 45876 _decodeType6Shading(reader) { 45877 const coords = this.coords; 45878 const colors = this.colors; 45879 const ps = new Int32Array(16); 45880 const cs = new Int32Array(4); 45881 45882 while (reader.hasData) { 45883 const f = reader.readFlag(); 45884 45885 if (!(0 <= f && f <= 3)) { 45886 throw new _util.FormatError("Unknown type6 flag"); 45887 } 45888 45889 const pi = coords.length; 45890 45891 for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) { 45892 coords.push(reader.readCoordinate()); 45893 } 45894 45895 const ci = colors.length; 45896 45897 for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 45898 colors.push(reader.readComponents()); 45899 } 45900 45901 let tmp1, tmp2, tmp3, tmp4; 45902 45903 switch (f) { 45904 case 0: 45905 ps[12] = pi + 3; 45906 ps[13] = pi + 4; 45907 ps[14] = pi + 5; 45908 ps[15] = pi + 6; 45909 ps[8] = pi + 2; 45910 ps[11] = pi + 7; 45911 ps[4] = pi + 1; 45912 ps[7] = pi + 8; 45913 ps[0] = pi; 45914 ps[1] = pi + 11; 45915 ps[2] = pi + 10; 45916 ps[3] = pi + 9; 45917 cs[2] = ci + 1; 45918 cs[3] = ci + 2; 45919 cs[0] = ci; 45920 cs[1] = ci + 3; 45921 break; 45922 45923 case 1: 45924 tmp1 = ps[12]; 45925 tmp2 = ps[13]; 45926 tmp3 = ps[14]; 45927 tmp4 = ps[15]; 45928 ps[12] = tmp4; 45929 ps[13] = pi + 0; 45930 ps[14] = pi + 1; 45931 ps[15] = pi + 2; 45932 ps[8] = tmp3; 45933 ps[11] = pi + 3; 45934 ps[4] = tmp2; 45935 ps[7] = pi + 4; 45936 ps[0] = tmp1; 45937 ps[1] = pi + 7; 45938 ps[2] = pi + 6; 45939 ps[3] = pi + 5; 45940 tmp1 = cs[2]; 45941 tmp2 = cs[3]; 45942 cs[2] = tmp2; 45943 cs[3] = ci; 45944 cs[0] = tmp1; 45945 cs[1] = ci + 1; 45946 break; 45947 45948 case 2: 45949 tmp1 = ps[15]; 45950 tmp2 = ps[11]; 45951 ps[12] = ps[3]; 45952 ps[13] = pi + 0; 45953 ps[14] = pi + 1; 45954 ps[15] = pi + 2; 45955 ps[8] = ps[7]; 45956 ps[11] = pi + 3; 45957 ps[4] = tmp2; 45958 ps[7] = pi + 4; 45959 ps[0] = tmp1; 45960 ps[1] = pi + 7; 45961 ps[2] = pi + 6; 45962 ps[3] = pi + 5; 45963 tmp1 = cs[3]; 45964 cs[2] = cs[1]; 45965 cs[3] = ci; 45966 cs[0] = tmp1; 45967 cs[1] = ci + 1; 45968 break; 45969 45970 case 3: 45971 ps[12] = ps[0]; 45972 ps[13] = pi + 0; 45973 ps[14] = pi + 1; 45974 ps[15] = pi + 2; 45975 ps[8] = ps[1]; 45976 ps[11] = pi + 3; 45977 ps[4] = ps[2]; 45978 ps[7] = pi + 4; 45979 ps[0] = ps[3]; 45980 ps[1] = pi + 7; 45981 ps[2] = pi + 6; 45982 ps[3] = pi + 5; 45983 cs[2] = cs[0]; 45984 cs[3] = ci; 45985 cs[0] = cs[1]; 45986 cs[1] = ci + 1; 45987 break; 45988 } 45989 45990 ps[5] = coords.length; 45991 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]); 45992 ps[6] = coords.length; 45993 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]); 45994 ps[9] = coords.length; 45995 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]); 45996 ps[10] = coords.length; 45997 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]); 45998 this.figures.push({ 45999 type: "patch", 46000 coords: new Int32Array(ps), 46001 colors: new Int32Array(cs) 46002 }); 46003 } 46004 } 46005 46006 _decodeType7Shading(reader) { 46007 const coords = this.coords; 46008 const colors = this.colors; 46009 const ps = new Int32Array(16); 46010 const cs = new Int32Array(4); 46011 46012 while (reader.hasData) { 46013 const f = reader.readFlag(); 46014 46015 if (!(0 <= f && f <= 3)) { 46016 throw new _util.FormatError("Unknown type7 flag"); 46017 } 46018 46019 const pi = coords.length; 46020 46021 for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) { 46022 coords.push(reader.readCoordinate()); 46023 } 46024 46025 const ci = colors.length; 46026 46027 for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 46028 colors.push(reader.readComponents()); 46029 } 46030 46031 let tmp1, tmp2, tmp3, tmp4; 46032 46033 switch (f) { 46034 case 0: 46035 ps[12] = pi + 3; 46036 ps[13] = pi + 4; 46037 ps[14] = pi + 5; 46038 ps[15] = pi + 6; 46039 ps[8] = pi + 2; 46040 ps[9] = pi + 13; 46041 ps[10] = pi + 14; 46042 ps[11] = pi + 7; 46043 ps[4] = pi + 1; 46044 ps[5] = pi + 12; 46045 ps[6] = pi + 15; 46046 ps[7] = pi + 8; 46047 ps[0] = pi; 46048 ps[1] = pi + 11; 46049 ps[2] = pi + 10; 46050 ps[3] = pi + 9; 46051 cs[2] = ci + 1; 46052 cs[3] = ci + 2; 46053 cs[0] = ci; 46054 cs[1] = ci + 3; 46055 break; 46056 46057 case 1: 46058 tmp1 = ps[12]; 46059 tmp2 = ps[13]; 46060 tmp3 = ps[14]; 46061 tmp4 = ps[15]; 46062 ps[12] = tmp4; 46063 ps[13] = pi + 0; 46064 ps[14] = pi + 1; 46065 ps[15] = pi + 2; 46066 ps[8] = tmp3; 46067 ps[9] = pi + 9; 46068 ps[10] = pi + 10; 46069 ps[11] = pi + 3; 46070 ps[4] = tmp2; 46071 ps[5] = pi + 8; 46072 ps[6] = pi + 11; 46073 ps[7] = pi + 4; 46074 ps[0] = tmp1; 46075 ps[1] = pi + 7; 46076 ps[2] = pi + 6; 46077 ps[3] = pi + 5; 46078 tmp1 = cs[2]; 46079 tmp2 = cs[3]; 46080 cs[2] = tmp2; 46081 cs[3] = ci; 46082 cs[0] = tmp1; 46083 cs[1] = ci + 1; 46084 break; 46085 46086 case 2: 46087 tmp1 = ps[15]; 46088 tmp2 = ps[11]; 46089 ps[12] = ps[3]; 46090 ps[13] = pi + 0; 46091 ps[14] = pi + 1; 46092 ps[15] = pi + 2; 46093 ps[8] = ps[7]; 46094 ps[9] = pi + 9; 46095 ps[10] = pi + 10; 46096 ps[11] = pi + 3; 46097 ps[4] = tmp2; 46098 ps[5] = pi + 8; 46099 ps[6] = pi + 11; 46100 ps[7] = pi + 4; 46101 ps[0] = tmp1; 46102 ps[1] = pi + 7; 46103 ps[2] = pi + 6; 46104 ps[3] = pi + 5; 46105 tmp1 = cs[3]; 46106 cs[2] = cs[1]; 46107 cs[3] = ci; 46108 cs[0] = tmp1; 46109 cs[1] = ci + 1; 46110 break; 46111 46112 case 3: 46113 ps[12] = ps[0]; 46114 ps[13] = pi + 0; 46115 ps[14] = pi + 1; 46116 ps[15] = pi + 2; 46117 ps[8] = ps[1]; 46118 ps[9] = pi + 9; 46119 ps[10] = pi + 10; 46120 ps[11] = pi + 3; 46121 ps[4] = ps[2]; 46122 ps[5] = pi + 8; 46123 ps[6] = pi + 11; 46124 ps[7] = pi + 4; 46125 ps[0] = ps[3]; 46126 ps[1] = pi + 7; 46127 ps[2] = pi + 6; 46128 ps[3] = pi + 5; 46129 cs[2] = cs[0]; 46130 cs[3] = ci; 46131 cs[0] = cs[1]; 46132 cs[1] = ci + 1; 46133 break; 46134 } 46135 46136 this.figures.push({ 46137 type: "patch", 46138 coords: new Int32Array(ps), 46139 colors: new Int32Array(cs) 46140 }); 46141 } 46142 } 46143 46144 _buildFigureFromPatch(index) { 46145 const figure = this.figures[index]; 46146 (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure"); 46147 const coords = this.coords, 46148 colors = this.colors; 46149 const pi = figure.coords; 46150 const ci = figure.colors; 46151 const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 46152 const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 46153 const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 46154 const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 46155 let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0])); 46156 splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy)); 46157 let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1])); 46158 splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy)); 46159 const verticesPerRow = splitXBy + 1; 46160 const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow); 46161 const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow); 46162 let k = 0; 46163 const cl = new Uint8Array(3), 46164 cr = new Uint8Array(3); 46165 const c0 = colors[ci[0]], 46166 c1 = colors[ci[1]], 46167 c2 = colors[ci[2]], 46168 c3 = colors[ci[3]]; 46169 const bRow = getB(splitYBy), 46170 bCol = getB(splitXBy); 46171 46172 for (let row = 0; row <= splitYBy; row++) { 46173 cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0; 46174 cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0; 46175 cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0; 46176 cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0; 46177 cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0; 46178 cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0; 46179 46180 for (let col = 0; col <= splitXBy; col++, k++) { 46181 if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) { 46182 continue; 46183 } 46184 46185 let x = 0, 46186 y = 0; 46187 let q = 0; 46188 46189 for (let i = 0; i <= 3; i++) { 46190 for (let j = 0; j <= 3; j++, q++) { 46191 const m = bRow[row][i] * bCol[col][j]; 46192 x += coords[pi[q]][0] * m; 46193 y += coords[pi[q]][1] * m; 46194 } 46195 } 46196 46197 figureCoords[k] = coords.length; 46198 coords.push([x, y]); 46199 figureColors[k] = colors.length; 46200 const newColor = new Uint8Array(3); 46201 newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0; 46202 newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0; 46203 newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0; 46204 colors.push(newColor); 46205 } 46206 } 46207 46208 figureCoords[0] = pi[0]; 46209 figureColors[0] = ci[0]; 46210 figureCoords[splitXBy] = pi[3];
46211 figureColors[splitXBy] = ci[1]; 46212 figureCoords[verticesPerRow * splitYBy] = pi[12]; 46213 figureColors[verticesPerRow * splitYBy] = ci[2]; 46214 figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15]; 46215 figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3]; 46216 this.figures[index] = { 46217 type: "lattice", 46218 coords: figureCoords, 46219 colors: figureColors, 46220 verticesPerRow 46221 }; 46222 } 46223 46224 _updateBounds() { 46225 let minX = this.coords[0][0], 46226 minY = this.coords[0][1], 46227 maxX = minX, 46228 maxY = minY; 46229 46230 for (let i = 1, ii = this.coords.length; i < ii; i++) { 46231 const x = this.coords[i][0], 46232 y = this.coords[i][1]; 46233 minX = minX > x ? x : minX; 46234 minY = minY > y ? y : minY; 46235 maxX = maxX < x ? x : maxX; 46236 maxY = maxY < y ? y : maxY; 46237 } 46238 46239 this.bounds = [minX, minY, maxX, maxY]; 46240 } 46241 46242 _packData() { 46243 let i, ii, j, jj; 46244 const coords = this.coords; 46245 const coordsPacked = new Float32Array(coords.length * 2); 46246 46247 for (i = 0, j = 0, ii = coords.length; i < ii; i++) { 46248 const xy = coords[i]; 46249 coordsPacked[j++] = xy[0]; 46250 coordsPacked[j++] = xy[1]; 46251 } 46252 46253 this.coords = coordsPacked; 46254 const colors = this.colors; 46255 const colorsPacked = new Uint8Array(colors.length * 3); 46256 46257 for (i = 0, j = 0, ii = colors.length; i < ii; i++) { 46258 const c = colors[i]; 46259 colorsPacked[j++] = c[0]; 46260 colorsPacked[j++] = c[1]; 46261 colorsPacked[j++] = c[2]; 46262 } 46263 46264 this.colors = colorsPacked; 46265 const figures = this.figures; 46266 46267 for (i = 0, ii = figures.length; i < ii; i++) { 46268 const figure = figures[i], 46269 ps = figure.coords, 46270 cs = figure.colors; 46271 46272 for (j = 0, jj = ps.length; j < jj; j++) { 46273 ps[j] *= 2; 46274 cs[j] *= 3; 46275 } 46276 } 46277 } 46278 46279 getIR() { 46280 return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background]; 46281 } 46282 46283} 46284 46285class DummyShading extends BaseShading { 46286 getIR() { 46287 return ["Dummy"]; 46288 } 46289 46290} 46291 46292function getTilingPatternIR(operatorList, dict, color) { 46293 const matrix = dict.getArray("Matrix"); 46294 46295 const bbox = _util.Util.normalizeRect(dict.getArray("BBox")); 46296 46297 const xstep = dict.get("XStep"); 46298 const ystep = dict.get("YStep"); 46299 const paintType = dict.get("PaintType"); 46300 const tilingType = dict.get("TilingType"); 46301 46302 if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) { 46303 throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`); 46304 } 46305 46306 return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType]; 46307} 46308 46309/***/ }), 46310/* 56 */ 46311/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 46312 46313 46314 46315Object.defineProperty(exports, "__esModule", ({ 46316 value: true 46317})); 46318exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0; 46319exports.isPDFFunction = isPDFFunction; 46320 46321var _primitives = __w_pdfjs_require__(5); 46322 46323var _util = __w_pdfjs_require__(2); 46324 46325var _ps_parser = __w_pdfjs_require__(57); 46326 46327var _image_utils = __w_pdfjs_require__(58); 46328 46329class PDFFunctionFactory { 46330 constructor({ 46331 xref, 46332 isEvalSupported = true 46333 }) { 46334 this.xref = xref; 46335 this.isEvalSupported = isEvalSupported !== false; 46336 } 46337 46338 create(fn) { 46339 const cachedFunction = this.getCached(fn); 46340 46341 if (cachedFunction) { 46342 return cachedFunction; 46343 } 46344 46345 const parsedFunction = PDFFunction.parse({ 46346 xref: this.xref, 46347 isEvalSupported: this.isEvalSupported, 46348 fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn 46349 }); 46350 46351 this._cache(fn, parsedFunction); 46352 46353 return parsedFunction; 46354 } 46355 46356 createFromArray(fnObj) { 46357 const cachedFunction = this.getCached(fnObj); 46358 46359 if (cachedFunction) { 46360 return cachedFunction; 46361 } 46362 46363 const parsedFunction = PDFFunction.parseArray({ 46364 xref: this.xref, 46365 isEvalSupported: this.isEvalSupported, 46366 fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj 46367 }); 46368 46369 this._cache(fnObj, parsedFunction); 46370 46371 return parsedFunction; 46372 } 46373 46374 getCached(cacheKey) { 46375 let fnRef; 46376 46377 if (cacheKey instanceof _primitives.Ref) { 46378 fnRef = cacheKey; 46379 } else if (cacheKey instanceof _primitives.Dict) { 46380 fnRef = cacheKey.objId; 46381 } else if ((0, _primitives.isStream)(cacheKey)) { 46382 fnRef = cacheKey.dict && cacheKey.dict.objId; 46383 } 46384 46385 if (fnRef) { 46386 const localFunction = this._localFunctionCache.getByRef(fnRef); 46387 46388 if (localFunction) { 46389 return localFunction; 46390 } 46391 } 46392 46393 return null; 46394 } 46395 46396 _cache(cacheKey, parsedFunction) { 46397 if (!parsedFunction) { 46398 throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.'); 46399 } 46400 46401 let fnRef; 46402 46403 if (cacheKey instanceof _primitives.Ref) { 46404 fnRef = cacheKey; 46405 } else if (cacheKey instanceof _primitives.Dict) { 46406 fnRef = cacheKey.objId; 46407 } else if ((0, _primitives.isStream)(cacheKey)) { 46408 fnRef = cacheKey.dict && cacheKey.dict.objId; 46409 } 46410 46411 if (fnRef) { 46412 this._localFunctionCache.set(null, fnRef, parsedFunction); 46413 } 46414 } 46415 46416 get _localFunctionCache() { 46417 return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache()); 46418 } 46419 46420} 46421 46422exports.PDFFunctionFactory = PDFFunctionFactory; 46423 46424function toNumberArray(arr) { 46425 if (!Array.isArray(arr)) { 46426 return null; 46427 } 46428 46429 const length = arr.length; 46430 46431 for (let i = 0; i < length; i++) { 46432 if (typeof arr[i] !== "number") { 46433 const result = new Array(length); 46434 46435 for (let j = 0; j < length; j++) { 46436 result[j] = +arr[j]; 46437 } 46438 46439 return result; 46440 } 46441 } 46442 46443 return arr; 46444} 46445 46446class PDFFunction { 46447 static getSampleArray(size, outputSize, bps, stream) { 46448 let i, ii; 46449 let length = 1; 46450 46451 for (i = 0, ii = size.length; i < ii; i++) { 46452 length *= size[i]; 46453 } 46454 46455 length *= outputSize; 46456 const array = new Array(length);
46457 let codeSize = 0; 46458 let codeBuf = 0; 46459 const sampleMul = 1.0 / (2.0 ** bps - 1); 46460 const strBytes = stream.getBytes((length * bps + 7) / 8); 46461 let strIdx = 0; 46462 46463 for (i = 0; i < length; i++) { 46464 while (codeSize < bps) { 46465 codeBuf <<= 8; 46466 codeBuf |= strBytes[strIdx++]; 46467 codeSize += 8; 46468 } 46469 46470 codeSize -= bps; 46471 array[i] = (codeBuf >> codeSize) * sampleMul; 46472 codeBuf &= (1 << codeSize) - 1; 46473 } 46474 46475 return array; 46476 } 46477 46478 static parse({ 46479 xref, 46480 isEvalSupported, 46481 fn 46482 }) { 46483 const dict = fn.dict || fn; 46484 const typeNum = dict.get("FunctionType"); 46485 46486 switch (typeNum) { 46487 case 0: 46488 return this.constructSampled({ 46489 xref, 46490 isEvalSupported, 46491 fn, 46492 dict 46493 }); 46494 46495 case 1: 46496 break; 46497 46498 case 2: 46499 return this.constructInterpolated({ 46500 xref, 46501 isEvalSupported, 46502 dict 46503 }); 46504 46505 case 3: 46506 return this.constructStiched({ 46507 xref, 46508 isEvalSupported, 46509 dict 46510 }); 46511 46512 case 4: 46513 return this.constructPostScript({ 46514 xref, 46515 isEvalSupported, 46516 fn, 46517 dict 46518 }); 46519 } 46520 46521 throw new _util.FormatError("Unknown type of function"); 46522 } 46523 46524 static parseArray({ 46525 xref, 46526 isEvalSupported, 46527 fnObj 46528 }) { 46529 if (!Array.isArray(fnObj)) { 46530 return this.parse({ 46531 xref, 46532 isEvalSupported, 46533 fn: fnObj 46534 }); 46535 } 46536 46537 const fnArray = []; 46538 46539 for (let j = 0, jj = fnObj.length; j < jj; j++) { 46540 fnArray.push(this.parse({ 46541 xref, 46542 isEvalSupported, 46543 fn: xref.fetchIfRef(fnObj[j]) 46544 })); 46545 } 46546 46547 return function (src, srcOffset, dest, destOffset) { 46548 for (let i = 0, ii = fnArray.length; i < ii; i++) { 46549 fnArray[i](src, srcOffset, dest, destOffset + i); 46550 } 46551 }; 46552 } 46553 46554 static constructSampled({ 46555 xref, 46556 isEvalSupported, 46557 fn, 46558 dict 46559 }) { 46560 function toMultiArray(arr) { 46561 const inputLength = arr.length; 46562 const out = []; 46563 let index = 0; 46564 46565 for (let i = 0; i < inputLength; i += 2) { 46566 out[index++] = [arr[i], arr[i + 1]]; 46567 } 46568 46569 return out; 46570 } 46571 46572 function interpolate(x, xmin, xmax, ymin, ymax) { 46573 return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin)); 46574 } 46575 46576 let domain = toNumberArray(dict.getArray("Domain")); 46577 let range = toNumberArray(dict.getArray("Range")); 46578 46579 if (!domain || !range) { 46580 throw new _util.FormatError("No domain or range"); 46581 } 46582 46583 const inputSize = domain.length / 2; 46584 const outputSize = range.length / 2; 46585 domain = toMultiArray(domain); 46586 range = toMultiArray(range); 46587 const size = toNumberArray(dict.getArray("Size")); 46588 const bps = dict.get("BitsPerSample"); 46589 const order = dict.get("Order") || 1; 46590 46591 if (order !== 1) { 46592 (0, _util.info)("No support for cubic spline interpolation: " + order); 46593 } 46594 46595 let encode = toNumberArray(dict.getArray("Encode")); 46596 46597 if (!encode) { 46598 encode = []; 46599 46600 for (let i = 0; i < inputSize; ++i) { 46601 encode.push([0, size[i] - 1]); 46602 } 46603 } else { 46604 encode = toMultiArray(encode); 46605 } 46606 46607 let decode = toNumberArray(dict.getArray("Decode")); 46608 46609 if (!decode) { 46610 decode = range; 46611 } else { 46612 decode = toMultiArray(decode); 46613 } 46614 46615 const samples = this.getSampleArray(size, outputSize, bps, fn); 46616 return function constructSampledFn(src, srcOffset, dest, destOffset) { 46617 const cubeVertices = 1 << inputSize; 46618 const cubeN = new Float64Array(cubeVertices); 46619 const cubeVertex = new Uint32Array(cubeVertices); 46620 let i, j; 46621 46622 for (j = 0; j < cubeVertices; j++) { 46623 cubeN[j] = 1; 46624 } 46625 46626 let k = outputSize, 46627 pos = 1; 46628 46629 for (i = 0; i < inputSize; ++i) { 46630 const domain_2i = domain[i][0]; 46631 const domain_2i_1 = domain[i][1]; 46632 const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1); 46633 let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]); 46634 const size_i = size[i]; 46635 e = Math.min(Math.max(e, 0), size_i - 1); 46636 const e0 = e < size_i - 1 ? Math.floor(e) : e - 1; 46637 const n0 = e0 + 1 - e; 46638 const n1 = e - e0; 46639 const offset0 = e0 * k; 46640 const offset1 = offset0 + k; 46641 46642 for (j = 0; j < cubeVertices; j++) { 46643 if (j & pos) { 46644 cubeN[j] *= n1; 46645 cubeVertex[j] += offset1; 46646 } else { 46647 cubeN[j] *= n0; 46648 cubeVertex[j] += offset0; 46649 } 46650 } 46651 46652 k *= size_i; 46653 pos <<= 1; 46654 } 46655 46656 for (j = 0; j < outputSize; ++j) { 46657 let rj = 0; 46658 46659 for (i = 0; i < cubeVertices; i++) { 46660 rj += samples[cubeVertex[i] + j] * cubeN[i]; 46661 } 46662 46663 rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]); 46664 dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]); 46665 } 46666 }; 46667 } 46668 46669 static constructInterpolated({ 46670 xref, 46671 isEvalSupported, 46672 dict 46673 }) { 46674 const c0 = toNumberArray(dict.getArray("C0")) || [0]; 46675 const c1 = toNumberArray(dict.getArray("C1")) || [1]; 46676 const n = dict.get("N"); 46677 const diff = []; 46678 46679 for (let i = 0, ii = c0.length; i < ii; ++i) { 46680 diff.push(c1[i] - c0[i]); 46681 } 46682 46683 const length = diff.length; 46684 return function constructInterpolatedFn(src, srcOffset, dest, destOff
46684set) { 46685 const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n; 46686 46687 for (let j = 0; j < length; ++j) { 46688 dest[destOffset + j] = c0[j] + x * diff[j]; 46689 } 46690 }; 46691 } 46692 46693 static constructStiched({ 46694 xref, 46695 isEvalSupported, 46696 dict 46697 }) { 46698 const domain = toNumberArray(dict.getArray("Domain")); 46699 46700 if (!domain) { 46701 throw new _util.FormatError("No domain"); 46702 } 46703 46704 const inputSize = domain.length / 2; 46705 46706 if (inputSize !== 1) { 46707 throw new _util.FormatError("Bad domain for stiched function"); 46708 } 46709 46710 const fnRefs = dict.get("Functions"); 46711 const fns = []; 46712 46713 for (let i = 0, ii = fnRefs.length; i < ii; ++i) { 46714 fns.push(this.parse({ 46715 xref, 46716 isEvalSupported, 46717 fn: xref.fetchIfRef(fnRefs[i]) 46718 })); 46719 } 46720 46721 const bounds = toNumberArray(dict.getArray("Bounds")); 46722 const encode = toNumberArray(dict.getArray("Encode")); 46723 const tmpBuf = new Float32Array(1); 46724 return function constructStichedFn(src, srcOffset, dest, destOffset) { 46725 const clip = function constructStichedFromIRClip(v, min, max) { 46726 if (v > max) { 46727 v = max; 46728 } else if (v < min) { 46729 v = min; 46730 } 46731 46732 return v; 46733 }; 46734 46735 const v = clip(src[srcOffset], domain[0], domain[1]); 46736 const length = bounds.length; 46737 let i; 46738 46739 for (i = 0; i < length; ++i) { 46740 if (v < bounds[i]) { 46741 break; 46742 } 46743 } 46744 46745 let dmin = domain[0]; 46746 46747 if (i > 0) { 46748 dmin = bounds[i - 1]; 46749 } 46750 46751 let dmax = domain[1]; 46752 46753 if (i < bounds.length) { 46754 dmax = bounds[i]; 46755 } 46756 46757 const rmin = encode[2 * i]; 46758 const rmax = encode[2 * i + 1]; 46759 tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin); 46760 fns[i](tmpBuf, 0, dest, destOffset); 46761 }; 46762 } 46763 46764 static constructPostScript({ 46765 xref, 46766 isEvalSupported, 46767 fn, 46768 dict 46769 }) { 46770 const domain = toNumberArray(dict.getArray("Domain")); 46771 const range = toNumberArray(dict.getArray("Range")); 46772 46773 if (!domain) { 46774 throw new _util.FormatError("No domain."); 46775 } 46776 46777 if (!range) { 46778 throw new _util.FormatError("No range."); 46779 } 46780 46781 const lexer = new _ps_parser.PostScriptLexer(fn); 46782 const parser = new _ps_parser.PostScriptParser(lexer); 46783 const code = parser.parse(); 46784 46785 if (isEvalSupported && _util.IsEvalSupportedCached.value) { 46786 const compiled = new PostScriptCompiler().compile(code, domain, range); 46787 46788 if (compiled) { 46789 return new Function("src", "srcOffset", "dest", "destOffset", compiled); 46790 } 46791 } 46792 46793 (0, _util.info)("Unable to compile PS function"); 46794 const numOutputs = range.length >> 1; 46795 const numInputs = domain.length >> 1; 46796 const evaluator = new PostScriptEvaluator(code); 46797 const cache = Object.create(null); 46798 const MAX_CACHE_SIZE = 2048 * 4; 46799 let cache_available = MAX_CACHE_SIZE; 46800 const tmpBuf = new Float32Array(numInputs); 46801 return function constructPostScriptFn(src, srcOffset, dest, destOffset) { 46802 let i, value; 46803 let key = ""; 46804 const input = tmpBuf; 46805 46806 for (i = 0; i < numInputs; i++) { 46807 value = src[srcOffset + i]; 46808 input[i] = value; 46809 key += value + "_"; 46810 } 46811 46812 const cachedValue = cache[key]; 46813 46814 if (cachedValue !== undefined) { 46815 dest.set(cachedValue, destOffset); 46816 return; 46817 } 46818 46819 const output = new Float32Array(numOutputs); 46820 const stack = evaluator.execute(input); 46821 const stackIndex = stack.length - numOutputs; 46822 46823 for (i = 0; i < numOutputs; i++) { 46824 value = stack[stackIndex + i]; 46825 let bound = range[i * 2]; 46826 46827 if (value < bound) { 46828 value = bound; 46829 } else { 46830 bound = range[i * 2 + 1]; 46831 46832 if (value > bound) { 46833 value = bound; 46834 } 46835 } 46836 46837 output[i] = value; 46838 } 46839 46840 if (cache_available > 0) { 46841 cache_available--; 46842 cache[key] = output; 46843 } 46844 46845 dest.set(output, destOffset); 46846 }; 46847 } 46848 46849} 46850 46851function isPDFFunction(v) { 46852 let fnDict; 46853 46854 if (typeof v !== "object") { 46855 return false;
vendor: 22,514 bytes, lines 46856-47868
46856 } else if ((0, _primitives.isDict)(v)) { 46857 fnDict = v; 46858 } else if ((0, _primitives.isStream)(v)) { 46859 fnDict = v.dict; 46860 } else { 46861 return false; 46862 } 46863 46864 return fnDict.has("FunctionType"); 46865} 46866 46867class PostScriptStack { 46868 static get MAX_STACK_SIZE() { 46869 return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100); 46870 } 46871 46872 constructor(initialStack) { 46873 this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0); 46874 } 46875 46876 push(value) { 46877 if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) { 46878 throw new Error("PostScript function stack overflow."); 46879 } 46880 46881 this.stack.push(value); 46882 } 46883 46884 pop() { 46885 if (this.stack.length <= 0) { 46886 throw new Error("PostScript function stack underflow."); 46887 } 46888 46889 return this.stack.pop(); 46890 } 46891 46892 copy(n) { 46893 if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) { 46894 throw new Error("PostScript function stack overflow."); 46895 } 46896 46897 const stack = this.stack; 46898 46899 for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) { 46900 stack.push(stack[i]); 46901 } 46902 } 46903 46904 index(n) { 46905 this.push(this.stack[this.stack.length - n - 1]); 46906 } 46907 46908 roll(n, p) { 46909 const stack = this.stack; 46910 const l = stack.length - n; 46911 const r = stack.length - 1; 46912 const c = l + (p - Math.floor(p / n) * n); 46913 46914 for (let i = l, j = r; i < j; i++, j--) { 46915 const t = stack[i]; 46916 stack[i] = stack[j]; 46917 stack[j] = t; 46918 } 46919 46920 for (let i = l, j = c - 1; i < j; i++, j--) { 46921 const t = stack[i]; 46922 stack[i] = stack[j]; 46923 stack[j] = t; 46924 } 46925 46926 for (let i = c, j = r; i < j; i++, j--) { 46927 const t = stack[i]; 46928 stack[i] = stack[j]; 46929 stack[j] = t; 46930 } 46931 } 46932 46933} 46934 46935class PostScriptEvaluator { 46936 constructor(operators) { 46937 this.operators = operators; 46938 } 46939 46940 execute(initialStack) { 46941 const stack = new PostScriptStack(initialStack); 46942 let counter = 0; 46943 const operators = this.operators; 46944 const length = operators.length; 46945 let operator, a, b; 46946 46947 while (counter < length) { 46948 operator = operators[counter++]; 46949 46950 if (typeof operator === "number") { 46951 stack.push(operator); 46952 continue; 46953 } 46954 46955 switch (operator) { 46956 case "jz": 46957 b = stack.pop(); 46958 a = stack.pop(); 46959 46960 if (!a) { 46961 counter = b; 46962 } 46963 46964 break; 46965 46966 case "j": 46967 a = stack.pop(); 46968 counter = a; 46969 break; 46970 46971 case "abs": 46972 a = stack.pop(); 46973 stack.push(Math.abs(a)); 46974 break; 46975 46976 case "add": 46977 b = stack.pop(); 46978 a = stack.pop(); 46979 stack.push(a + b); 46980 break; 46981 46982 case "and": 46983 b = stack.pop(); 46984 a = stack.pop(); 46985 46986 if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) { 46987 stack.push(a && b); 46988 } else { 46989 stack.push(a & b); 46990 } 46991 46992 break; 46993 46994 case "atan": 46995 a = stack.pop(); 46996 stack.push(Math.atan(a)); 46997 break; 46998 46999 case "bitshift": 47000 b = stack.pop(); 47001 a = stack.pop(); 47002 47003 if (a > 0) { 47004 stack.push(a << b); 47005 } else { 47006 stack.push(a >> b); 47007 } 47008 47009 break; 47010 47011 case "ceiling": 47012 a = stack.pop(); 47013 stack.push(Math.ceil(a)); 47014 break; 47015 47016 case "copy": 47017 a = stack.pop(); 47018 stack.copy(a); 47019 break; 47020 47021 case "cos": 47022 a = stack.pop(); 47023 stack.push(Math.cos(a)); 47024 break; 47025 47026 case "cvi": 47027 a = stack.pop() | 0; 47028 stack.push(a); 47029 break; 47030 47031 case "cvr": 47032 break; 47033 47034 case "div": 47035 b = stack.pop(); 47036 a = stack.pop(); 47037 stack.push(a / b); 47038 break; 47039 47040 case "dup": 47041 stack.copy(1); 47042 break; 47043 47044 case "eq": 47045 b = stack.pop(); 47046 a = stack.pop(); 47047 stack.push(a === b); 47048 break; 47049 47050 case "exch": 47051 stack.roll(2, 1); 47052 break; 47053 47054 case "exp": 47055 b = stack.pop(); 47056 a = stack.pop(); 47057 stack.push(a ** b); 47058 break; 47059 47060 case "false": 47061 stack.push(false); 47062 break; 47063 47064 case "floor": 47065 a = stack.pop(); 47066 stack.push(Math.floor(a)); 47067 break; 47068 47069 case "ge": 47070 b = stack.pop(); 47071 a = stack.pop(); 47072 stack.push(a >= b); 47073 break; 47074 47075 case "gt": 47076 b = stack.pop(); 47077 a = stack.pop(); 47078 stack.push(a > b); 47079 break; 47080 47081 case "idiv": 47082 b = stack.pop(); 47083 a = stack.pop(); 47084 stack.push(a / b | 0); 47085 break; 47086 47087 case "index": 47088 a = stack.pop(); 47089 stack.index(a); 47090 break; 47091 47092 case "le": 47093 b = stack.pop(); 47094 a = stack.pop(); 47095 stack.push(a <= b); 47096 break; 47097 47098 case "ln": 47099 a = stack.pop(); 47100 stack.push(Math.log(a)); 47101 break; 47102 47103 case "log": 47104 a = stack.pop(); 47105 stack.push(Math.log(a) / Math.LN10); 47106 break; 47107 47108 case "lt": 47109 b = stack.pop(); 47110 a = stack.pop(); 47111 stack.push(a < b); 47112 break; 47113 47114 case "mod": 47115 b = stack.pop(); 47116 a = stack.pop(); 47117 stack.push(a % b); 47118 break; 47119 47120 case "mul": 47121 b = stack.pop(); 47122 a = stack.pop(); 47123 stack.push(a * b); 47124 break; 47125 47126 case "ne": 47127 b = stack.pop(); 47128 a = stack.pop(); 47129 stack.push(a !== b); 47130 break; 47131 47132 case "neg": 47133 a = stack.pop(); 47134 stack.push(-a); 47135 break; 47136 47137 case "not": 47138 a = stack.pop(); 47139 47140 if ((0, _util.isBool)(a)) { 47141 stack.push(!a); 47142 } else { 47143 stack.push(~a); 47144 } 47145 47146 break; 47147 47148 case "or": 47149 b = stack.pop(); 47150 a = stack.pop(); 47151 47152 if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) { 47153 stack.push(a || b); 47154 } else { 47155 stack.push(a | b); 47156 } 47157 47158 break; 47159 47160 case "pop": 47161 stack.pop(); 47162 break; 47163 47164 case "roll": 47165 b = stack.pop(); 47166 a = stack.pop(); 47167 stack.roll(a, b); 47168 break; 47169 47170 case "round": 47171 a = stack.pop(); 47172 stack.push(Math.round(a)); 47173 break; 47174 47175 case "sin": 47176 a = stack.pop(); 47177 stack.push(Math.sin(a)); 47178 break; 47179 47180 case "sqrt": 47181 a = stack.pop(); 47182 stack.push(Math.sqrt(a)); 47183 break; 47184 47185 case "sub": 47186 b = stack.pop(); 47187 a = stack.pop(); 47188 stack.push(a - b); 47189 break; 47190 47191 case "true": 47192 stack.push(true); 47193 break; 47194 47195 case "truncate": 47196 a = stack.pop(); 47197 a = a < 0 ? Math.ceil(a) : Math.floor(a); 47198 stack.push(a); 47199 break; 47200 47201 case "xor": 47202 b = stack.pop(); 47203 a = stack.pop(); 47204 47205 if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) { 47206 stack.push(a !== b); 47207 } else { 47208 stack.push(a ^ b); 47209 } 47210 47211 break; 47212 47213 default: 47214 throw new _util.FormatError(`Unknown operator ${operator}`); 47215 } 47216 } 47217 47218 return stack.stack; 47219 } 47220 47221} 47222 47223exports.PostScriptEvaluator = PostScriptEvaluator; 47224 47225const PostScriptCompiler = function PostScriptCompilerClosure() { 47226 class AstNode { 47227 constructor(type) { 47228 this.type = type; 47229 } 47230 47231 visit(visitor) { 47232 (0, _util.unreachable)("abstract method"); 47233 } 47234 47235 } 47236 47237 class AstArgument extends AstNode { 47238 constructor(index, min, max) { 47239 super("args"); 47240 this.index = index; 47241 this.min = min; 47242 this.max = max; 47243 } 47244 47245 visit(visitor) { 47246 visitor.visitArgument(this); 47247 } 47248 47249 } 47250 47251 class AstLiteral extends AstNode { 47252 constructor(number) { 47253 super("literal"); 47254 this.number = number; 47255 this.min = number; 47256 this.max = number; 47257 } 47258 47259 visit(visitor) { 47260 visitor.visitLiteral(this); 47261 } 47262 47263 } 47264 47265 class AstBinaryOperation extends AstNode { 47266 constructor(op, arg1, arg2, min, max) { 47267 super("binary"); 47268 this.op = op; 47269 this.arg1 = arg1; 47270 this.arg2 = arg2; 47271 this.min = min; 47272 this.max = max; 47273 } 47274 47275 visit(visitor) { 47276 visitor.visitBinaryOperation(this); 47277 } 47278 47279 } 47280 47281 class AstMin extends AstNode { 47282 constructor(arg, max) { 47283 super("max"); 47284 this.arg = arg; 47285 this.min = arg.min; 47286 this.max = max; 47287 } 47288 47289 visit(visitor) { 47290 visitor.visitMin(this); 47291 } 47292 47293 } 47294 47295 class AstVariable extends AstNode { 47296 constructor(index, min, max) { 47297 super("var"); 47298 this.index = index; 47299 this.min = min; 47300 this.max = max; 47301 } 47302 47303 visit(visitor) { 47304 visitor.visitVariable(this); 47305 } 47306 47307 } 47308 47309 class AstVariableDefinition extends AstNode { 47310 constructor(variable, arg) { 47311 super("definition"); 47312 this.variable = variable; 47313 this.arg = arg; 47314 } 47315 47316 visit(visitor) { 47317 visitor.visitVariableDefinition(this); 47318 } 47319 47320 } 47321 47322 class ExpressionBuilderVisitor { 47323 constructor() { 47324 this.parts = []; 47325 } 47326 47327 visitArgument(arg) { 47328 this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))"); 47329 } 47330 47331 visitVariable(variable) { 47332 this.parts.push("v", variable.index); 47333 } 47334 47335 visitLiteral(literal) { 47336 this.parts.push(literal.number); 47337 } 47338 47339 visitBinaryOperation(operation) { 47340 this.parts.push("("); 47341 operation.arg1.visit(this); 47342 this.parts.push(" ", operation.op, " "); 47343 operation.arg2.visit(this); 47344 this.parts.push(")"); 47345 } 47346 47347 visitVariableDefinition(definition) { 47348 this.parts.push("var "); 47349 definition.variable.visit(this); 47350 this.parts.push(" = "); 47351 definition.arg.visit(this); 47352 this.parts.push(";"); 47353 } 47354 47355 visitMin(max) { 47356 this.parts.push("Math.min("); 47357 max.arg.visit(this); 47358 this.parts.push(", ", max.max, ")"); 47359 } 47360 47361 toString() { 47362 return this.parts.join(""); 47363 } 47364 47365 } 47366 47367 function buildAddOperation(num1, num2) { 47368 if (num2.type === "literal" && num2.number === 0) { 47369 return num1; 47370 } 47371 47372 if (num1.type === "literal" && num1.number === 0) { 47373 return num2; 47374 } 47375 47376 if (num2.type === "literal" && num1.type === "literal") { 47377 return new AstLiteral(num1.number + num2.number); 47378 } 47379 47380 return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max); 47381 } 47382 47383 function buildMulOperation(num1, num2) { 47384 if (num2.type === "literal") { 47385 if (num2.number === 0) { 47386 return new AstLiteral(0); 47387 } else if (num2.number === 1) { 47388 return num1; 47389 } else if (num1.type === "literal") { 47390 return new AstLiteral(num1.number * num2.number); 47391 } 47392 } 47393 47394 if (num1.type === "literal") { 47395 if (num1.number === 0) { 47396 return new AstLiteral(0); 47397 } else if (num1.number === 1) { 47398 return num2; 47399 } 47400 } 47401 47402 const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max); 47403 const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max); 47404 return new AstBinaryOperation("*", num1, num2, min, max); 47405 } 47406 47407 function buildSubOperation(num1, num2) { 47408 if (num2.type === "literal") { 47409 if (num2.number === 0) { 47410 return num1; 47411 } else if (num1.type === "literal") { 47412 return new AstLiteral(num1.number - num2.number); 47413 } 47414 } 47415 47416 if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) { 47417 return num2.arg2; 47418 } 47419 47420 return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min); 47421 } 47422 47423 function buildMinOperation(num1, max) { 47424 if (num1.min >= max) { 47425 return new AstLiteral(max); 47426 } else if (num1.max <= max) { 47427 return num1; 47428 } 47429 47430 return new AstMin(num1, max); 47431 } 47432 47433 class PostScriptCompiler { 47434 compile(code, domain, range) { 47435 const stack = []; 47436 const instructions = []; 47437 const inputSize = domain.length >> 1, 47438 outputSize = range.length >> 1; 47439 let lastRegister = 0; 47440 let n, j; 47441 let num1, num2, ast1, ast2, tmpVar, item; 47442 47443 for (let i = 0; i < inputSize; i++) { 47444 stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1])); 47445 } 47446 47447 for (let i = 0, ii = code.length; i < ii; i++) { 47448 item = code[i]; 47449 47450 if (typeof item === "number") { 47451 stack.push(new AstLiteral(item)); 47452 continue; 47453 } 47454 47455 switch (item) { 47456 case "add": 47457 if (stack.length < 2) { 47458 return null; 47459 } 47460 47461 num2 = stack.pop(); 47462 num1 = stack.pop(); 47463 stack.push(buildAddOperation(num1, num2)); 47464 break; 47465 47466 case "cvr": 47467 if (stack.length < 1) { 47468 return null; 47469 } 47470 47471 break; 47472 47473 case "mul": 47474 if (stack.length < 2) { 47475 return null; 47476 } 47477 47478 num2 = stack.pop(); 47479 num1 = stack.pop(); 47480 stack.push(buildMulOperation(num1, num2)); 47481 break; 47482 47483 case "sub": 47484 if (stack.length < 2) { 47485 return null; 47486 } 47487 47488 num2 = stack.pop(); 47489 num1 = stack.pop(); 47490 stack.push(buildSubOperation(num1, num2)); 47491 break; 47492 47493 case "exch": 47494 if (stack.length < 2) { 47495 return null; 47496 } 47497 47498 ast1 = stack.pop(); 47499 ast2 = stack.pop(); 47500 stack.push(ast1, ast2); 47501 break; 47502 47503 case "pop": 47504 if (stack.length < 1) { 47505 return null; 47506 } 47507 47508 stack.pop(); 47509 break; 47510 47511 case "index": 47512 if (stack.length < 1) { 47513 return null; 47514 } 47515 47516 num1 = stack.pop(); 47517 47518 if (num1.type !== "literal") { 47519 return null; 47520 } 47521 47522 n = num1.number; 47523 47524 if (n < 0 || !Number.isInteger(n) || stack.length < n) { 47525 return null; 47526 } 47527 47528 ast1 = stack[stack.length - n - 1]; 47529 47530 if (ast1.type === "literal" || ast1.type === "var") { 47531 stack.push(ast1); 47532 break; 47533 } 47534 47535 tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); 47536 stack[stack.length - n - 1] = tmpVar; 47537 stack.push(tmpVar); 47538 instructions.push(new AstVariableDefinition(tmpVar, ast1)); 47539 break; 47540 47541 case "dup": 47542 if (stack.length < 1) { 47543 return null; 47544 } 47545 47546 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]) { 47547 num1 = stack.pop(); 47548 stack.push(buildMinOperation(num1, code[i + 1])); 47549 i += 6; 47550 break; 47551 } 47552 47553 ast1 = stack[stack.length - 1]; 47554 47555 if (ast1.type === "literal" || ast1.type === "var") { 47556 stack.push(ast1); 47557 break; 47558 } 47559 47560 tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); 47561 stack[stack.length - 1] = tmpVar; 47562 stack.push(tmpVar); 47563 instructions.push(new AstVariableDefinition(tmpVar, ast1)); 47564 break; 47565 47566 case "roll": 47567 if (stack.length < 2) { 47568 return null; 47569 } 47570 47571 num2 = stack.pop(); 47572 num1 = stack.pop(); 47573 47574 if (num2.type !== "literal" || num1.type !== "literal") { 47575 return null; 47576 } 47577 47578 j = num2.number; 47579 n = num1.number; 47580 47581 if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) { 47582 return null; 47583 } 47584 47585 j = (j % n + n) % n; 47586 47587 if (j === 0) { 47588 break; 47589 } 47590 47591 Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j)); 47592 break; 47593 47594 default: 47595 return null; 47596 } 47597 } 47598 47599 if (stack.length !== outputSize) { 47600 return null; 47601 } 47602 47603 const result = []; 47604 47605 for (const instruction of instructions) { 47606 const statementBuilder = new ExpressionBuilderVisitor(); 47607 instruction.visit(statementBuilder); 47608 result.push(statementBuilder.toString()); 47609 } 47610 47611 for (let i = 0, ii = stack.length; i < ii; i++) { 47612 const expr = stack[i], 47613 statementBuilder = new ExpressionBuilderVisitor(); 47614 expr.visit(statementBuilder); 47615 const min = range[i * 2], 47616 max = range[i * 2 + 1]; 47617 const out = [statementBuilder.toString()]; 47618 47619 if (min > expr.min) { 47620 out.unshift("Math.max(", min, ", "); 47621 out.push(")"); 47622 } 47623 47624 if (max < expr.max) { 47625 out.unshift("Math.min(", max, ", "); 47626 out.push(")"); 47627 } 47628 47629 out.unshift("dest[destOffset + ", i, "] = "); 47630 out.push(";"); 47631 result.push(out.join("")); 47632 } 47633 47634 return result.join("\n"); 47635 } 47636 47637 } 47638 47639 return PostScriptCompiler; 47640}(); 47641 47642exports.PostScriptCompiler = PostScriptCompiler; 47643 47644/***/ }), 47645/* 57 */ 47646/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 47647 47648 47649 47650Object.defineProperty(exports, "__esModule", ({ 47651 value: true 47652})); 47653exports.PostScriptParser = exports.PostScriptLexer = void 0; 47654 47655var _util = __w_pdfjs_require__(2); 47656 47657var _primitives = __w_pdfjs_require__(5); 47658 47659var _core_utils = __w_pdfjs_require__(9); 47660 47661class PostScriptParser { 47662 constructor(lexer) { 47663 this.lexer = lexer; 47664 this.operators = []; 47665 this.token = null; 47666 this.prev = null; 47667 } 47668 47669 nextToken() { 47670 this.prev = this.token; 47671 this.token = this.lexer.getToken(); 47672 } 47673 47674 accept(type) { 47675 if (this.token.type === type) { 47676 this.nextToken(); 47677 return true; 47678 } 47679 47680 return false; 47681 } 47682 47683 expect(type) { 47684 if (this.accept(type)) { 47685 return true; 47686 } 47687 47688 throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`); 47689 } 47690 47691 parse() { 47692 this.nextToken(); 47693 this.expect(PostScriptTokenTypes.LBRACE); 47694 this.parseBlock(); 47695 this.expect(PostScriptTokenTypes.RBRACE); 47696 return this.operators; 47697 } 47698 47699 parseBlock() { 47700 while (true) { 47701 if (this.accept(PostScriptTokenTypes.NUMBER)) { 47702 this.operators.push(this.prev.value); 47703 } else if (this.accept(PostScriptTokenTypes.OPERATOR)) { 47704 this.operators.push(this.prev.value); 47705 } else if (this.accept(PostScriptTokenTypes.LBRACE)) { 47706 this.parseCondition(); 47707 } else { 47708 return; 47709 } 47710 } 47711 } 47712 47713 parseCondition() { 47714 const conditionLocation = this.operators.length; 47715 this.operators.push(null, null); 47716 this.parseBlock(); 47717 this.expect(PostScriptTokenTypes.RBRACE); 47718 47719 if (this.accept(PostScriptTokenTypes.IF)) { 47720 this.operators[conditionLocation] = this.operators.length; 47721 this.operators[conditionLocation + 1] = "jz"; 47722 } else if (this.accept(PostScriptTokenTypes.LBRACE)) { 47723 const jumpLocation = this.operators.length; 47724 this.operators.push(null, null); 47725 const endOfTrue = this.operators.length; 47726 this.parseBlock(); 47727 this.expect(PostScriptTokenTypes.RBRACE); 47728 this.expect(PostScriptTokenTypes.IFELSE); 47729 this.operators[jumpLocation] = this.operators.length; 47730 this.operators[jumpLocation + 1] = "j"; 47731 this.operators[conditionLocation] = endOfTrue; 47732 this.operators[conditionLocation + 1] = "jz"; 47733 } else { 47734 throw new _util.FormatError("PS Function: error parsing conditional."); 47735 } 47736 } 47737 47738} 47739 47740exports.PostScriptParser = PostScriptParser; 47741const PostScriptTokenTypes = { 47742 LBRACE: 0, 47743 RBRACE: 1, 47744 NUMBER: 2, 47745 OPERATOR: 3, 47746 IF: 4, 47747 IFELSE: 5 47748}; 47749 47750class PostScriptToken { 47751 static get opCache() { 47752 return (0, _util.shadow)(this, "opCache", Object.create(null)); 47753 } 47754 47755 constructor(type, value) { 47756 this.type = type; 47757 this.value = value; 47758 } 47759 47760 static getOperator(op) { 47761 const opValue = PostScriptToken.opCache[op]; 47762 47763 if (opValue) { 47764 return opValue; 47765 } 47766 47767 return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op); 47768 } 47769 47770 static get LBRACE() { 47771 return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{")); 47772 } 47773 47774 static get RBRACE() { 47775 return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}")); 47776 } 47777 47778 static get IF() { 47779 return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF")); 47780 } 47781 47782 static get IFELSE() { 47783 return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE")); 47784 } 47785 47786} 47787 47788class PostScriptLexer { 47789 constructor(stream) { 47790 this.stream = stream; 47791 this.nextChar(); 47792 this.strBuf = []; 47793 } 47794 47795 nextChar() { 47796 return this.currentChar = this.stream.getByte(); 47797 } 47798 47799 getToken() { 47800 let comment = false; 47801 let ch = this.currentChar; 47802 47803 while (true) { 47804 if (ch < 0) { 47805 return _primitives.EOF; 47806 } 47807 47808 if (comment) { 47809 if (ch === 0x0a || ch === 0x0d) { 47810 comment = false; 47811 } 47812 } else if (ch === 0x25) { 47813 comment = true; 47814 } else if (!(0, _core_utils.isWhiteSpace)(ch)) { 47815 break; 47816 } 47817 47818 ch = this.nextChar(); 47819 } 47820 47821 switch (ch | 0) { 47822 case 0x30: 47823 case 0x31: 47824 case 0x32: 47825 case 0x33: 47826 case 0x34: 47827 case 0x35: 47828 case 0x36: 47829 case 0x37: 47830 case 0x38: 47831 case 0x39: 47832 case 0x2b: 47833 case 0x2d: 47834 case 0x2e: 47835 return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber()); 47836 47837 case 0x7b: 47838 this.nextChar(); 47839 return PostScriptToken.LBRACE; 47840 47841 case 0x7d: 47842 this.nextChar(); 47843 return PostScriptToken.RBRACE; 47844 } 47845 47846 const strBuf = this.strBuf; 47847 strBuf.length = 0; 47848 strBuf[0] = String.fromCharCode(ch); 47849 47850 while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) { 47851 strBuf.push(String.fromCharCode(ch)); 47852 } 47853 47854 const str = strBuf.join(""); 47855 47856 switch (str.toLowerCase()) { 47857 case "if": 47858 return PostScriptToken.IF; 47859 47860 case "ifelse": 47861 return PostScriptToken.IFELSE; 47862 47863 default: 47864 return PostScriptToken.getOperator(str); 47865 } 47866 } 47867 47868 getNumber() {
47869 let ch = this.currentChar; 47870 const strBuf = this.strBuf; 47871 strBuf.length = 0; 47872 strBuf[0] = String.fromCharCode(ch); 47873 47874 while ((ch = this.nextChar()) >= 0) { 47875 if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) { 47876 strBuf.push(String.fromCharCode(ch)); 47877 } else { 47878 break; 47879 } 47880 } 47881 47882 const value = parseFloat(strBuf.join("")); 47883 47884 if (isNaN(value)) { 47885 throw new _util.FormatError(`Invalid floating point number: ${value}`); 47886 } 47887 47888 return value; 47889 } 47890 47891} 47892 47893exports.PostScriptLexer = PostScriptLexer; 47894 47895/***/ }), 47896/* 58 */ 47897/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 47898 47899 47900 47901Object.defineProperty(exports, "__esModule", ({ 47902 value: true 47903})); 47904exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0; 47905 47906var _util = __w_pdfjs_require__(2); 47907 47908var _primitives = __w_pdfjs_require__(5); 47909 47910class BaseLocalCache { 47911 constructor(options) { 47912 if (this.constructor === BaseLocalCache) { 47913 (0, _util.unreachable)("Cannot initialize BaseLocalCache."); 47914 } 47915 47916 this._onlyRefs = (options && options.onlyRefs) === true; 47917 47918 if (!this._onlyRefs) { 47919 this._nameRefMap = new Map(); 47920 this._imageMap = new Map(); 47921 } 47922 47923 this._imageCache = new _primitives.RefSetCache(); 47924 } 47925 47926 getByName(name) { 47927 if (this._onlyRefs) { 47928 (0, _util.unreachable)("Should not call `getByName` method."); 47929 } 47930 47931 const ref = this._nameRefMap.get(name); 47932 47933 if (ref) { 47934 return this.getByRef(ref); 47935 } 47936 47937 return this._imageMap.get(name) || null; 47938 } 47939 47940 getByRef(ref) { 47941 return this._imageCache.get(ref) || null; 47942 } 47943 47944 set(name, ref, data) { 47945 (0, _util.unreachable)("Abstract method `set` called."); 47946 } 47947 47948} 47949 47950class LocalImageCache extends BaseLocalCache { 47951 set(name, ref = null, data) { 47952 if (typeof name !== "string") { 47953 throw new Error('LocalImageCache.set - expected "name" argument.'); 47954 } 47955 47956 if (ref) { 47957 if (this._imageCache.has(ref)) { 47958 return; 47959 } 47960 47961 this._nameRefMap.set(name, ref); 47962 47963 this._imageCache.put(ref, data); 47964 47965 return; 47966 } 47967 47968 if (this._imageMap.has(name)) { 47969 return; 47970 } 47971 47972 this._imageMap.set(name, data); 47973 } 47974 47975} 47976 47977exports.LocalImageCache = LocalImageCache; 47978 47979class LocalColorSpaceCache extends BaseLocalCache { 47980 set(name = null, ref = null, data) { 47981 if (typeof name !== "string" && !ref) { 47982 throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.'); 47983 } 47984 47985 if (ref) { 47986 if (this._imageCache.has(ref)) { 47987 return; 47988 } 47989 47990 if (name !== null) { 47991 this._nameRefMap.set(name, ref); 47992 } 47993 47994 this._imageCache.put(ref, data); 47995 47996 return; 47997 } 47998 47999 if (this._imageMap.has(name)) { 48000 return; 48001 } 48002 48003 this._imageMap.set(name, data); 48004 } 48005 48006} 48007 48008exports.LocalColorSpaceCache = LocalColorSpaceCache; 48009 48010class LocalFunctionCache extends BaseLocalCache { 48011 constructor(options) { 48012 super({ 48013 onlyRefs: true 48014 }); 48015 } 48016 48017 set(name = null, ref, data) { 48018 if (!ref) { 48019 throw new Error('LocalFunctionCache.set - expected "ref" argument.'); 48020 } 48021 48022 if (this._imageCache.has(ref)) { 48023 return; 48024 } 48025 48026 this._imageCache.put(ref, data); 48027 } 48028 48029} 48030 48031exports.LocalFunctionCache = LocalFunctionCache; 48032 48033class LocalGStateCache extends BaseLocalCache { 48034 set(name, ref = null, data) { 48035 if (typeof name !== "string") { 48036 throw new Error('LocalGStateCache.set - expected "name" argument.'); 48037 } 48038 48039 if (ref) { 48040 if (this._imageCache.has(ref)) { 48041 return; 48042 } 48043 48044 this._nameRefMap.set(name, ref); 48045 48046 this._imageCache.put(ref, data); 48047 48048 return; 48049 } 48050 48051 if (this._imageMap.has(name)) { 48052 return; 48053 } 48054 48055 this._imageMap.set(name, data); 48056 } 48057 48058} 48059 48060exports.LocalGStateCache = LocalGStateCache; 48061 48062class LocalTilingPatternCache extends BaseLocalCache { 48063 constructor(options) { 48064 super({ 48065 onlyRefs: true 48066 }); 48067 } 48068 48069 set(name = null, ref, data) { 48070 if (!ref) { 48071 throw new Error('LocalTilingPatternCache.set - expected "ref" argument.'); 48072 } 48073 48074 if (this._imageCache.has(ref)) { 48075 return; 48076 } 48077 48078 this._imageCache.put(ref, data); 48079 } 48080 48081} 48082 48083exports.LocalTilingPatternCache = LocalTilingPatternCache; 48084 48085class GlobalImageCache { 48086 static get NUM_PAGES_THRESHOLD() { 48087 return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2); 48088 } 48089 48090 static get MIN_IMAGES_TO_CACHE() { 48091 return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10); 48092 } 48093 48094 static get MAX_BYTE_SIZE() { 48095 return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6); 48096 } 48097 48098 constructor() { 48099 this._refCache = new _primitives.RefSetCache(); 48100 this._imageCache = new _primitives.RefSetCache(); 48101 } 48102 48103 get _byteSize() { 48104 let byteSize = 0; 48105 48106 this._imageCache.forEach(imageData => { 48107 byteSize += imageData.byteSize; 48108 }); 48109 48110 return byteSize; 48111 } 48112 48113 get _cacheLimitReached() { 48114 if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) { 48115 return false;
48116 } 48117 48118 if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) { 48119 return false; 48120 } 48121 48122 return true; 48123 } 48124 48125 shouldCache(ref, pageIndex) { 48126 const pageIndexSet = this._refCache.get(ref); 48127 48128 const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1; 48129 48130 if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) { 48131 return false; 48132 } 48133 48134 if (!this._imageCache.has(ref) && this._cacheLimitReached) { 48135 return false; 48136 } 48137 48138 return true; 48139 } 48140 48141 addPageIndex(ref, pageIndex) { 48142 let pageIndexSet = this._refCache.get(ref); 48143 48144 if (!pageIndexSet) { 48145 pageIndexSet = new Set(); 48146 48147 this._refCache.put(ref, pageIndexSet); 48148 } 48149 48150 pageIndexSet.add(pageIndex); 48151 } 48152 48153 addByteSize(ref, byteSize) { 48154 const imageData = this._imageCache.get(ref); 48155 48156 if (!imageData) { 48157 return; 48158 } 48159 48160 if (imageData.byteSize) { 48161 return; 48162 } 48163 48164 imageData.byteSize = byteSize; 48165 } 48166 48167 getData(ref, pageIndex) { 48168 const pageIndexSet = this._refCache.get(ref); 48169 48170 if (!pageIndexSet) { 48171 return null; 48172 } 48173 48174 if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) { 48175 return null; 48176 } 48177 48178 const imageData = this._imageCache.get(ref); 48179 48180 if (!imageData) { 48181 return null; 48182 } 48183 48184 pageIndexSet.add(pageIndex); 48185 return imageData; 48186 } 48187 48188 setData(ref, data) { 48189 if (!this._refCache.has(ref)) { 48190 throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.'); 48191 } 48192 48193 if (this._imageCache.has(ref)) { 48194 return; 48195 } 48196 48197 if (this._cacheLimitReached) { 48198 (0, _util.warn)("GlobalImageCache.setData - cache limit reached."); 48199 return; 48200 } 48201 48202 this._imageCache.put(ref, data); 48203 } 48204 48205 clear(onlyData = false) { 48206 if (!onlyData) { 48207 this._refCache.clear(); 48208 } 48209 48210 this._imageCache.clear(); 48211 } 48212 48213} 48214 48215exports.GlobalImageCache = GlobalImageCache; 48216 48217/***/ }), 48218/* 59 */ 48219/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 48220 48221 48222 48223Object.defineProperty(exports, "__esModule", ({ 48224 value: true 48225})); 48226exports.bidi = bidi; 48227 48228var _util = __w_pdfjs_require__(2); 48229 48230const 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"]; 48231const 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"]; 48232 48233function isOdd(i) { 48234 return (i & 1) !== 0; 48235} 48236 48237function isEven(i) { 48238 return (i & 1) === 0; 48239} 48240 48241function findUnequal(arr, start, value) { 48242 let j, jj; 48243 48244 for (j = start, jj = arr.length; j < jj; ++j) { 48245 if (arr[j] !== value) { 48246 return j; 48247 } 48248 } 48249 48250 return j; 48251} 48252 48253function setValues(arr, start, end, value) { 48254 for (let j = start; j < end; ++j) { 48255 arr[j] = value; 48256 } 48257} 48258 48259function reverseValues(arr, start, end) { 48260 for (let i = start, j = end - 1; i < j; ++i, --j) { 48261 const temp = arr[i]; 48262 arr[i] = arr[j]; 48263 arr[j] = temp; 48264 } 48265} 48266 48267function createBidiText(str, isLTR, vertical = false) { 48268 let dir = "ltr"; 48269 48270 if (vertical) { 48271 dir = "ttb"; 48272 } else if (!isLTR) { 48273 dir = "rtl";
vendor: 4,181 bytes, lines 48274-48489
48274 } 48275 48276 return { 48277 str, 48278 dir 48279 }; 48280} 48281 48282const chars = []; 48283const types = []; 48284 48285function bidi(str, startLevel = -1, vertical = false) { 48286 let isLTR = true; 48287 const strLength = str.length; 48288 48289 if (strLength === 0 || vertical) { 48290 return createBidiText(str, isLTR, vertical); 48291 } 48292 48293 chars.length = strLength; 48294 types.length = strLength; 48295 let numBidi = 0; 48296 let i, ii; 48297 48298 for (i = 0; i < strLength; ++i) { 48299 chars[i] = str.charAt(i); 48300 const charCode = str.charCodeAt(i); 48301 let charType = "L"; 48302 48303 if (charCode <= 0x00ff) { 48304 charType = baseTypes[charCode]; 48305 } else if (0x0590 <= charCode && charCode <= 0x05f4) { 48306 charType = "R"; 48307 } else if (0x0600 <= charCode && charCode <= 0x06ff) { 48308 charType = arabicTypes[charCode & 0xff]; 48309 48310 if (!charType) { 48311 (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16)); 48312 } 48313 } else if (0x0700 <= charCode && charCode <= 0x08ac) { 48314 charType = "AL"; 48315 } 48316 48317 if (charType === "R" || charType === "AL" || charType === "AN") { 48318 numBidi++; 48319 } 48320 48321 types[i] = charType; 48322 } 48323 48324 if (numBidi === 0) { 48325 isLTR = true; 48326 return createBidiText(str, isLTR); 48327 } 48328 48329 if (startLevel === -1) { 48330 if (numBidi / strLength < 0.3 && strLength > 4) { 48331 isLTR = true; 48332 startLevel = 0; 48333 } else { 48334 isLTR = false; 48335 startLevel = 1; 48336 } 48337 } 48338 48339 const levels = []; 48340 48341 for (i = 0; i < strLength; ++i) { 48342 levels[i] = startLevel; 48343 } 48344 48345 const e = isOdd(startLevel) ? "R" : "L"; 48346 const sor = e; 48347 const eor = sor; 48348 let lastType = sor; 48349 48350 for (i = 0; i < strLength; ++i) { 48351 if (types[i] === "NSM") { 48352 types[i] = lastType; 48353 } else { 48354 lastType = types[i]; 48355 } 48356 } 48357 48358 lastType = sor; 48359 let t; 48360 48361 for (i = 0; i < strLength; ++i) { 48362 t = types[i]; 48363 48364 if (t === "EN") { 48365 types[i] = lastType === "AL" ? "AN" : "EN"; 48366 } else if (t === "R" || t === "L" || t === "AL") { 48367 lastType = t; 48368 } 48369 } 48370 48371 for (i = 0; i < strLength; ++i) { 48372 t = types[i]; 48373 48374 if (t === "AL") { 48375 types[i] = "R"; 48376 } 48377 } 48378 48379 for (i = 1; i < strLength - 1; ++i) { 48380 if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") { 48381 types[i] = "EN"; 48382 } 48383 48384 if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) { 48385 types[i] = types[i - 1]; 48386 } 48387 } 48388 48389 for (i = 0; i < strLength; ++i) { 48390 if (types[i] === "EN") { 48391 for (let j = i - 1; j >= 0; --j) { 48392 if (types[j] !== "ET") { 48393 break; 48394 } 48395 48396 types[j] = "EN"; 48397 } 48398 48399 for (let j = i + 1; j < strLength; ++j) { 48400 if (types[j] !== "ET") { 48401 break; 48402 } 48403 48404 types[j] = "EN"; 48405 } 48406 } 48407 } 48408 48409 for (i = 0; i < strLength; ++i) { 48410 t = types[i]; 48411 48412 if (t === "WS" || t === "ES" || t === "ET" || t === "CS") { 48413 types[i] = "ON"; 48414 } 48415 } 48416 48417 lastType = sor; 48418 48419 for (i = 0; i < strLength; ++i) { 48420 t = types[i]; 48421 48422 if (t === "EN") { 48423 types[i] = lastType === "L" ? "L" : "EN"; 48424 } else if (t === "R" || t === "L") { 48425 lastType = t; 48426 } 48427 } 48428 48429 for (i = 0; i < strLength; ++i) { 48430 if (types[i] === "ON") { 48431 const end = findUnequal(types, i + 1, "ON"); 48432 let before = sor; 48433 48434 if (i > 0) { 48435 before = types[i - 1]; 48436 } 48437 48438 let after = eor; 48439 48440 if (end + 1 < strLength) { 48441 after = types[end + 1]; 48442 } 48443 48444 if (before !== "L") { 48445 before = "R"; 48446 } 48447 48448 if (after !== "L") { 48449 after = "R"; 48450 } 48451 48452 if (before === after) { 48453 setValues(types, i, end, before); 48454 } 48455 48456 i = end - 1; 48457 } 48458 } 48459 48460 for (i = 0; i < strLength; ++i) { 48461 if (types[i] === "ON") { 48462 types[i] = e; 48463 } 48464 } 48465 48466 for (i = 0; i < strLength; ++i) { 48467 t = types[i]; 48468 48469 if (isEven(levels[i])) { 48470 if (t === "R") { 48471 levels[i] += 1; 48472 } else if (t === "AN" || t === "EN") { 48473 levels[i] += 2; 48474 } 48475 } else { 48476 if (t === "L" || t === "AN" || t === "EN") { 48477 levels[i] += 1; 48478 } 48479 } 48480 } 48481 48482 let highestLevel = -1; 48483 let lowestOddLevel = 99; 48484 let level; 48485 48486 for (i = 0, ii = levels.length; i < ii; ++i) { 48487 level = levels[i]; 48488 48489 if (highestLevel < level) {
48490 highestLevel = level; 48491 } 48492 48493 if (lowestOddLevel > level && isOdd(level)) { 48494 lowestOddLevel = level; 48495 } 48496 } 48497 48498 for (level = highestLevel; level >= lowestOddLevel; --level) { 48499 let start = -1; 48500 48501 for (i = 0, ii = levels.length; i < ii; ++i) { 48502 if (levels[i] < level) { 48503 if (start >= 0) { 48504 reverseValues(chars, start, i); 48505 start = -1; 48506 } 48507 } else if (start < 0) { 48508 start = i; 48509 } 48510 } 48511 48512 if (start >= 0) { 48513 reverseValues(chars, start, levels.length); 48514 } 48515 } 48516 48517 for (i = 0, ii = chars.length; i < ii; ++i) { 48518 const ch = chars[i]; 48519 48520 if (ch === "<" || ch === ">") { 48521 chars[i] = ""; 48522 } 48523 } 48524 48525 return createBidiText(chars.join(""), isLTR); 48526} 48527 48528/***/ }), 48529/* 60 */ 48530/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 48531 48532 48533 48534Object.defineProperty(exports, "__esModule", ({ 48535 value: true 48536})); 48537exports.getMetrics = void 0; 48538 48539var _core_utils = __w_pdfjs_require__(9); 48540 48541const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) { 48542 t.Courier = 600; 48543 t["Courier-Bold"] = 600; 48544 t["Courier-BoldOblique"] = 600; 48545 t["Courier-Oblique"] = 600; 48546 t.Helvetica = (0, _core_utils.getLookupTableFactory)
vendor: 6,500 bytes, lines 48546-48863
48546(function (t) { 48547 t.space = 278; 48548 t.exclam = 278; 48549 t.quotedbl = 355; 48550 t.numbersign = 556; 48551 t.dollar = 556; 48552 t.percent = 889; 48553 t.ampersand = 667; 48554 t.quoteright = 222; 48555 t.parenleft = 333; 48556 t.parenright = 333; 48557 t.asterisk = 389; 48558 t.plus = 584; 48559 t.comma = 278; 48560 t.hyphen = 333; 48561 t.period = 278; 48562 t.slash = 278; 48563 t.zero = 556; 48564 t.one = 556; 48565 t.two = 556; 48566 t.three = 556; 48567 t.four = 556; 48568 t.five = 556; 48569 t.six = 556; 48570 t.seven = 556; 48571 t.eight = 556; 48572 t.nine = 556; 48573 t.colon = 278; 48574 t.semicolon = 278; 48575 t.less = 584; 48576 t.equal = 584; 48577 t.greater = 584; 48578 t.question = 556; 48579 t.at = 1015; 48580 t.A = 667; 48581 t.B = 667; 48582 t.C = 722; 48583 t.D = 722; 48584 t.E = 667; 48585 t.F = 611; 48586 t.G = 778; 48587 t.H = 722; 48588 t.I = 278; 48589 t.J = 500; 48590 t.K = 667; 48591 t.L = 556; 48592 t.M = 833; 48593 t.N = 722; 48594 t.O = 778; 48595 t.P = 667; 48596 t.Q = 778; 48597 t.R = 722; 48598 t.S = 667; 48599 t.T = 611; 48600 t.U = 722; 48601 t.V = 667; 48602 t.W = 944; 48603 t.X = 667; 48604 t.Y = 667; 48605 t.Z = 611; 48606 t.bracketleft = 278; 48607 t.backslash = 278; 48608 t.bracketright = 278; 48609 t.asciicircum = 469; 48610 t.underscore = 556; 48611 t.quoteleft = 222; 48612 t.a = 556; 48613 t.b = 556; 48614 t.c = 500; 48615 t.d = 556; 48616 t.e = 556; 48617 t.f = 278; 48618 t.g = 556; 48619 t.h = 556; 48620 t.i = 222; 48621 t.j = 222; 48622 t.k = 500; 48623 t.l = 222; 48624 t.m = 833; 48625 t.n = 556; 48626 t.o = 556; 48627 t.p = 556; 48628 t.q = 556; 48629 t.r = 333; 48630 t.s = 500; 48631 t.t = 278; 48632 t.u = 556; 48633 t.v = 500; 48634 t.w = 722; 48635 t.x = 500; 48636 t.y = 500; 48637 t.z = 500; 48638 t.braceleft = 334; 48639 t.bar = 260; 48640 t.braceright = 334; 48641 t.asciitilde = 584; 48642 t.exclamdown = 333; 48643 t.cent = 556; 48644 t.sterling = 556; 48645 t.fraction = 167; 48646 t.yen = 556; 48647 t.florin = 556; 48648 t.section = 556; 48649 t.currency = 556; 48650 t.quotesingle = 191; 48651 t.quotedblleft = 333; 48652 t.guillemotleft = 556; 48653 t.guilsinglleft = 333; 48654 t.guilsinglright = 333; 48655 t.fi = 500; 48656 t.fl = 500; 48657 t.endash = 556; 48658 t.dagger = 556; 48659 t.daggerdbl = 556; 48660 t.periodcentered = 278; 48661 t.paragraph = 537; 48662 t.bullet = 350; 48663 t.quotesinglbase = 222; 48664 t.quotedblbase = 333; 48665 t.quotedblright = 333; 48666 t.guillemotright = 556; 48667 t.ellipsis = 1000; 48668 t.perthousand = 1000; 48669 t.questiondown = 611; 48670 t.grave = 333; 48671 t.acute = 333; 48672 t.circumflex = 333; 48673 t.tilde = 333; 48674 t.macron = 333; 48675 t.breve = 333; 48676 t.dotaccent = 333; 48677 t.dieresis = 333; 48678 t.ring = 333; 48679 t.cedilla = 333; 48680 t.hungarumlaut = 333; 48681 t.ogonek = 333; 48682 t.caron = 333; 48683 t.emdash = 1000; 48684 t.AE = 1000; 48685 t.ordfeminine = 370; 48686 t.Lslash = 556; 48687 t.Oslash = 778; 48688 t.OE = 1000; 48689 t.ordmasculine = 365; 48690 t.ae = 889; 48691 t.dotlessi = 278; 48692 t.lslash = 222; 48693 t.oslash = 611; 48694 t.oe = 944; 48695 t.germandbls = 611; 48696 t.Idieresis = 278; 48697 t.eacute = 556; 48698 t.abreve = 556; 48699 t.uhungarumlaut = 556; 48700 t.ecaron = 556; 48701 t.Ydieresis = 667; 48702 t.divide = 584; 48703 t.Yacute = 667; 48704 t.Acircumflex = 667; 48705 t.aacute = 556; 48706 t.Ucircumflex = 722; 48707 t.yacute = 500; 48708 t.scommaaccent = 500; 48709 t.ecircumflex = 556; 48710 t.Uring = 722; 48711 t.Udieresis = 722; 48712 t.aogonek = 556; 48713 t.Uacute = 722; 48714 t.uogonek = 556; 48715 t.Edieresis = 667; 48716 t.Dcroat = 722; 48717 t.commaaccent = 250; 48718 t.copyright = 737; 48719 t.Emacron = 667; 48720 t.ccaron = 500; 48721 t.aring = 556; 48722 t.Ncommaaccent = 722; 48723 t.lacute = 222; 48724 t.agrave = 556; 48725 t.Tcommaaccent = 611; 48726 t.Cacute = 722; 48727 t.atilde = 556; 48728 t.Edotaccent = 667; 48729 t.scaron = 500; 48730 t.scedilla = 500; 48731 t.iacute = 278; 48732 t.lozenge = 471; 48733 t.Rcaron = 722; 48734 t.Gcommaaccent = 778; 48735 t.ucircumflex = 556; 48736 t.acircumflex = 556; 48737 t.Amacron = 667; 48738 t.rcaron = 333; 48739 t.ccedilla = 500; 48740 t.Zdotaccent = 611; 48741 t.Thorn = 667; 48742 t.Omacron = 778; 48743 t.Racute = 722; 48744 t.Sacute = 667; 48745 t.dcaron = 643; 48746 t.Umacron = 722; 48747 t.uring = 556; 48748 t.threesuperior = 333; 48749 t.Ograve = 778; 48750 t.Agrave = 667; 48751 t.Abreve = 667; 48752 t.multiply = 584; 48753 t.uacute = 556; 48754 t.Tcaron = 611; 48755 t.partialdiff = 476; 48756 t.ydieresis = 500; 48757 t.Nacute = 722; 48758 t.icircumflex = 278; 48759 t.Ecircumflex = 667; 48760 t.adieresis = 556; 48761 t.edieresis = 556; 48762 t.cacute = 500; 48763 t.nacute = 556; 48764 t.umacron = 556; 48765 t.Ncaron = 722; 48766 t.Iacute = 278; 48767 t.plusminus = 584; 48768 t.brokenbar = 260; 48769 t.registered = 737; 48770 t.Gbreve = 778; 48771 t.Idotaccent = 278; 48772 t.summation = 600; 48773 t.Egrave = 667; 48774 t.racute = 333; 48775 t.omacron = 556; 48776 t.Zacute = 611; 48777 t.Zcaron = 611; 48778 t.greaterequal = 549; 48779 t.Eth = 722; 48780 t.Ccedilla = 722; 48781 t.lcommaaccent = 222; 48782 t.tcaron = 317; 48783 t.eogonek = 556; 48784 t.Uogonek = 722; 48785 t.Aacute = 667; 48786 t.Adieresis = 667; 48787 t.egrave = 556; 48788 t.zacute = 500; 48789 t.iogonek = 222; 48790 t.Oacute = 778; 48791 t.oacute = 556; 48792 t.amacron = 556; 48793 t.sacute = 500; 48794 t.idieresis = 278; 48795 t.Ocircumflex = 778; 48796 t.Ugrave = 722; 48797 t.Delta = 612; 48798 t.thorn = 556; 48799 t.twosuperior = 333; 48800 t.Odieresis = 778; 48801 t.mu = 556; 48802 t.igrave = 278; 48803 t.ohungarumlaut = 556; 48804 t.Eogonek = 667; 48805 t.dcroat = 556; 48806 t.threequarters = 834; 48807 t.Scedilla = 667; 48808 t.lcaron = 299; 48809 t.Kcommaaccent = 667; 48810 t.Lacute = 556; 48811 t.trademark = 1000; 48812 t.edotaccent = 556; 48813 t.Igrave = 278; 48814 t.Imacron = 278; 48815 t.Lcaron = 556; 48816 t.onehalf = 834; 48817 t.lessequal = 549; 48818 t.ocircumflex = 556; 48819 t.ntilde = 556; 48820 t.Uhungarumlaut = 722; 48821 t.Eacute = 667; 48822 t.emacron = 556; 48823 t.gbreve = 556; 48824 t.onequarter = 834; 48825 t.Scaron = 667; 48826 t.Scommaaccent = 667; 48827 t.Ohungarumlaut = 778; 48828 t.degree = 400; 48829 t.ograve = 556; 48830 t.Ccaron = 722; 48831 t.ugrave = 556; 48832 t.radical = 453; 48833 t.Dcaron = 722; 48834 t.rcommaaccent = 333; 48835 t.Ntilde = 722; 48836 t.otilde = 556; 48837 t.Rcommaaccent = 722; 48838 t.Lcommaaccent = 556; 48839 t.Atilde = 667; 48840 t.Aogonek = 667; 48841 t.Aring = 667; 48842 t.Otilde = 778; 48843 t.zdotaccent = 500; 48844 t.Ecaron = 667; 48845 t.Iogonek = 278; 48846 t.kcommaaccent = 500; 48847 t.minus = 584; 48848 t.Icircumflex = 278; 48849 t.ncaron = 556; 48850 t.tcommaaccent = 278; 48851 t.logicalnot = 584; 48852 t.odieresis = 556; 48853 t.udieresis = 556; 48854 t.notequal = 549; 48855 t.gcommaaccent = 556; 48856 t.eth = 556; 48857 t.zcaron = 500; 48858 t.ncommaaccent = 556; 48859 t.onesuperior = 333; 48860 t.imacron = 278; 48861 t.Euro = 556; 48862 }); 48863 t
48863["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) { 48864 t.space = 278; 48865 t.exclam = 333; 48866 t.quotedbl = 474; 48867 t.numbersign = 556; 48868 t.dollar = 556; 48869 t.percent = 889; 48870 t.ampersand = 722; 48871 t.quoteright = 278; 48872 t.parenleft = 333; 48873 t.parenright = 333; 48874 t.asterisk = 389; 48875 t.plus = 584; 48876 t.comma = 278; 48877 t.hyphen = 333; 48878 t.period = 278; 48879 t.slash = 278; 48880 t.zero = 556; 48881 t.one = 556; 48882 t.two = 556; 48883 t.three = 556; 48884 t.four = 556; 48885 t.five = 556; 48886 t.six = 556; 48887 t.seven = 556; 48888 t.eight = 556; 48889 t.nine = 556; 48890 t.colon = 333; 48891 t.semicolon = 333; 48892 t.less = 584; 48893 t.equal = 584; 48894 t.greater = 584; 48895 t.question = 611; 48896 t.at = 975; 48897 t.A = 722; 48898 t.B = 722; 48899 t.C = 722; 48900 t.D = 722; 48901 t.E = 667; 48902 t.F = 611; 48903 t.G = 778; 48904 t.H = 722; 48905 t.I = 278; 48906 t.J = 556; 48907 t.K = 722; 48908 t.L = 611; 48909 t.M = 833; 48910 t.N = 722; 48911 t.O = 778; 48912 t.P = 667; 48913 t.Q = 778; 48914 t.R = 722; 48915 t.S = 667; 48916 t.T = 611; 48917 t.U = 722; 48918 t.V = 667; 48919 t.W = 944; 48920 t.X = 667; 48921 t.Y = 667; 48922 t.Z = 611; 48923 t.bracketleft = 333; 48924 t.backslash = 278; 48925 t.bracketright = 333; 48926 t.asciicircum = 584; 48927 t.underscore = 556; 48928 t.quoteleft = 278; 48929 t.a = 556; 48930 t.b = 611; 48931 t.c = 556; 48932 t.d = 611; 48933 t.e = 556; 48934 t.f = 333; 48935 t.g = 611; 48936 t.h = 611; 48937 t.i = 278; 48938 t.j = 278; 48939 t.k = 556; 48940 t.l = 278; 48941 t.m = 889; 48942 t.n = 611; 48943 t.o = 611; 48944 t.p = 611; 48945 t.q = 611; 48946 t.r = 389; 48947 t.s = 556; 48948 t.t = 333; 48949 t.u = 611; 48950 t.v = 556; 48951 t.w = 778; 48952 t.x = 556; 48953 t.y = 556; 48954 t.z = 500; 48955 t.braceleft = 389; 48956 t.bar = 280; 48957 t.braceright = 389; 48958 t.asciitilde = 584; 48959 t.exclamdown = 333; 48960 t.cent = 556; 48961 t.sterling = 556; 48962 t.fraction = 167; 48963 t.yen = 556; 48964 t.florin = 556; 48965 t.section = 556; 48966 t.currency = 556; 48967 t.quotesingle = 238; 48968 t.quotedblleft = 500; 48969 t.guillemotleft = 556; 48970 t.guilsinglleft = 333; 48971 t.guilsinglright = 333; 48972 t.fi = 611; 48973 t.fl = 611; 48974 t.endash = 556; 48975 t.dagger = 556; 48976 t.daggerdbl = 556; 48977 t.periodcentered = 278; 48978 t.paragraph = 556; 48979 t.bullet = 350; 48980 t.quotesinglbase = 278; 48981 t.quotedblbase = 500; 48982 t.quotedblright = 500; 48983 t.guillemotright = 556; 48984 t.ellipsis = 1000; 48985 t.perthousand = 1000; 48986 t.questiondown = 611; 48987 t.grave = 333; 48988 t.acute = 333; 48989 t.circumflex = 333; 48990 t.tilde = 333; 48991 t.macron = 333; 48992 t.breve = 333; 48993 t.dotaccent = 333; 48994 t.dieresis = 333; 48995 t.ring = 333; 48996 t.cedilla = 333; 48997 t.hungarumlaut = 333; 48998 t.ogonek = 333; 48999 t.caron = 333; 49000 t.emdash = 1000; 49001 t.AE = 1000; 49002 t.ordfeminine = 370; 49003 t.Lslash = 611; 49004 t.Oslash = 778; 49005 t.OE = 1000; 49006 t.ordmasculine = 365; 49007 t.ae = 889; 49008 t.dotlessi = 278; 49009 t.lslash = 278; 49010 t.oslash = 611; 49011 t.oe = 944; 49012 t.germandbls = 611; 49013 t.Idieresis = 278; 49014 t.eacute = 556; 49015 t.abreve = 556; 49016 t.uhungarumlaut = 611; 49017 t.ecaron = 556; 49018 t.Ydieresis = 667; 49019 t.divide = 584; 49020 t.Yacute = 667; 49021 t.Acircumflex = 722; 49022 t.aacute = 556; 49023 t.Ucircumflex = 722; 49024 t.yacute = 556; 49025 t.scommaaccent = 556; 49026 t.ecircumflex = 556; 49027 t.Uring = 722; 49028 t.Udieresis = 722; 49029 t.aogonek = 556; 49030 t.Uacute = 722; 49031 t.uogonek = 611; 49032 t.Edieresis = 667; 49033 t.Dcroat = 722; 49034 t.commaaccent = 250; 49035 t.copyright = 737; 49036 t.Emacron = 667; 49037 t.ccaron = 556; 49038 t.aring = 556; 49039 t.Ncommaaccent = 722; 49040 t.lacute = 278; 49041 t.agrave = 556; 49042 t.Tcommaaccent = 611; 49043 t.Cacute = 722; 49044 t.atilde = 556; 49045 t.Edotaccent = 667; 49046 t.scaron = 556; 49047 t.scedilla = 556; 49048 t.iacute = 278; 49049 t.lozenge = 494; 49050 t.Rcaron = 722; 49051 t.Gcommaaccent = 778; 49052 t.ucircumflex = 611; 49053 t.acircumflex = 556; 49054 t.Amacron = 722; 49055 t.rcaron = 389; 49056 t.ccedilla = 556; 49057 t.Zdotaccent = 611; 49058 t.Thorn = 667; 49059 t.Omacron = 778; 49060 t.Racute = 722; 49061 t.Sacute = 667; 49062 t.dcaron = 743; 49063 t.Umacron = 722; 49064 t.uring = 611; 49065 t.threesuperior = 333; 49066 t.Ograve = 778; 49067 t.Agrave = 722; 49068 t.Abreve = 722; 49069 t.multiply = 584; 49070 t.uacute = 611; 49071 t.Tcaron = 611; 49072 t.partialdiff = 494; 49073 t.ydieresis = 556; 49074 t.Nacute = 722; 49075 t.icircumflex = 278; 49076 t.Ecircumflex = 667; 49077 t.adieresis = 556; 49078 t.edieresis = 556; 49079 t.cacute = 556; 49080 t.nacute = 611; 49081 t.umacron = 611; 49082 t.Ncaron = 722; 49083 t.Iacute = 278; 49084 t.plusminus = 584; 49085 t.brokenbar = 280; 49086 t.registered = 737; 49087 t.Gbreve = 778; 49088 t.Idotaccent = 278; 49089 t.summation = 600; 49090 t.Egrave = 667; 49091 t.racute = 389; 49092 t.omacron = 611; 49093 t.Zacute = 611; 49094 t.Zcaron = 611; 49095 t.greaterequal = 549; 49096 t.Eth = 722; 49097 t.Ccedilla = 722; 49098 t.lcommaaccent = 278; 49099 t.tcaron = 389; 49100 t.eogonek = 556; 49101 t.Uogonek = 722; 49102 t.Aacute = 722; 49103 t.Adieresis = 722; 49104 t.egrave = 556; 49105 t.zacute = 500; 49106 t.iogonek = 278; 49107 t.Oacute = 778; 49108 t.oacute = 611; 49109 t.amacron = 556; 49110 t.sacute = 556; 49111 t.idieresis = 278; 49112 t.Ocircumflex = 778; 49113 t.Ugrave = 722; 49114 t.Delta = 612; 49115 t.thorn = 611; 49116 t.twosuperior = 333; 49117 t.Odieresis = 778; 49118 t.mu = 611; 49119 t.igrave = 278; 49120 t.ohungarumlaut = 611; 49121 t.Eogonek = 667; 49122 t.dcroat = 611; 49123 t.threequarters = 834; 49124 t.Scedilla = 667; 49125 t.lcaron = 400; 49126 t.Kcommaaccent = 722; 49127 t.Lacute = 611; 49128 t.trademark = 1000; 49129 t.edotaccent = 556; 49130 t.Igrave = 278; 49131 t.Imacron = 278; 49132 t.Lcaron = 611; 49133 t.onehalf = 834; 49134 t.lessequal = 549; 49135 t.ocircumflex = 611; 49136 t.ntilde = 611; 49137 t.Uhungarumlaut = 722; 49138 t.Eacute = 667; 49139 t.emacron = 556; 49140 t.gbreve = 611; 49141 t.onequarter = 834; 49142 t.Scaron = 667; 49143 t.Scommaaccent = 667;
49144 t.Ohungarumlaut = 778; 49145 t.degree = 400; 49146 t.ograve = 611; 49147 t.Ccaron = 722; 49148 t.ugrave = 611; 49149 t.radical = 549; 49150 t.Dcaron = 722; 49151 t.rcommaaccent = 389; 49152 t.Ntilde = 722; 49153 t.otilde = 611; 49154 t.Rcommaaccent = 722; 49155 t.Lcommaaccent = 611; 49156 t.Atilde = 722; 49157 t.Aogonek = 722; 49158 t.Aring = 722; 49159 t.Otilde = 778; 49160 t.zdotaccent = 500; 49161 t.Ecaron = 667; 49162 t.Iogonek = 278; 49163 t.kcommaaccent = 556; 49164 t.minus = 584; 49165 t.Icircumflex = 278; 49166 t.ncaron = 611; 49167 t.tcommaaccent = 333; 49168 t.logicalnot = 584; 49169 t.odieresis = 611; 49170 t.udieresis = 611; 49171 t.notequal = 549; 49172 t.gcommaaccent = 611; 49173 t.eth = 611; 49174 t.zcaron = 500; 49175 t.ncommaaccent = 611; 49176 t.onesuperior = 333; 49177 t.imacron = 278; 49178 t.Euro = 556; 49179 }); 49180 t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) { 49181 t.space = 278; 49182 t.exclam = 333; 49183 t.quotedbl = 474; 49184 t.numbersign = 556; 49185 t.dollar = 556; 49186 t.percent = 889; 49187 t.ampersand = 722; 49188 t.quoteright = 278; 49189 t.parenleft = 333; 49190 t.parenright = 333; 49191 t.asterisk = 389; 49192 t.plus = 584; 49193 t.comma = 278; 49194 t.hyphen = 333; 49195 t.period = 278; 49196 t.slash = 278; 49197 t.zero = 556; 49198 t.one = 556; 49199 t.two = 556; 49200 t.three = 556; 49201 t.four = 556; 49202 t.five = 556; 49203 t.six = 556; 49204 t.seven = 556; 49205 t.eight = 556; 49206 t.nine = 556; 49207 t.colon = 333; 49208 t.semicolon = 333; 49209 t.less = 584; 49210 t.equal = 584; 49211 t.greater = 584; 49212 t.question = 611; 49213 t.at = 975; 49214 t.A = 722; 49215 t.B = 722; 49216 t.C = 722; 49217 t.D = 722; 49218 t.E = 667; 49219 t.F = 611; 49220 t.G = 778; 49221 t.H = 722; 49222 t.I = 278; 49223 t.J = 556; 49224 t.K = 722; 49225 t.L = 611; 49226 t.M = 833; 49227 t.N = 722; 49228 t.O = 778; 49229 t.P = 667; 49230 t.Q = 778; 49231 t.R = 722; 49232 t.S = 667; 49233 t.T = 611; 49234 t.U = 722; 49235 t.V = 667; 49236 t.W = 944; 49237 t.X = 667; 49238 t.Y = 667; 49239 t.Z = 611; 49240 t.bracketleft = 333; 49241 t.backslash = 278; 49242 t.bracketright = 333; 49243 t.asciicircum = 584; 49244 t.underscore = 556; 49245 t.quoteleft = 278; 49246 t.a = 556; 49247 t.b = 611; 49248 t.c = 556; 49249 t.d = 611; 49250 t.e = 556; 49251 t.f = 333; 49252 t.g = 611; 49253 t.h = 611; 49254 t.i = 278; 49255 t.j = 278; 49256 t.k = 556; 49257 t.l = 278; 49258 t.m = 889; 49259 t.n = 611; 49260 t.o = 611; 49261 t.p = 611; 49262 t.q = 611; 49263 t.r = 389; 49264 t.s = 556; 49265 t.t = 333; 49266 t.u = 611; 49267 t.v = 556; 49268 t.w = 778; 49269 t.x = 556; 49270 t.y = 556; 49271 t.z = 500; 49272 t.braceleft = 389; 49273 t.bar = 280; 49274 t.braceright = 389; 49275 t.asciitilde = 584; 49276 t.exclamdown = 333; 49277 t.cent = 556; 49278 t.sterling = 556; 49279 t.fraction = 167; 49280 t.yen = 556; 49281 t.florin = 556; 49282 t.section = 556; 49283 t.currency = 556; 49284 t.quotesingle = 238; 49285 t.quotedblleft = 500; 49286 t.guillemotleft = 556; 49287 t.guilsinglleft = 333; 49288 t.guilsinglright = 333; 49289 t.fi = 611; 49290 t.fl = 611; 49291 t.endash = 556; 49292 t.dagger = 556; 49293 t.daggerdbl = 556; 49294 t.periodcentered = 278; 49295 t.paragraph = 556; 49296 t.bullet = 350; 49297 t.quotesinglbase = 278; 49298 t.quotedblbase = 500; 49299 t.quotedblright = 500; 49300 t.guillemotright = 556; 49301 t.ellipsis = 1000; 49302 t.perthousand = 1000; 49303 t.questiondown = 611; 49304 t.grave = 333; 49305 t.acute = 333; 49306 t.circumflex = 333; 49307 t.tilde = 333; 49308 t.macron = 333; 49309 t.breve = 333; 49310 t.dotaccent = 333; 49311 t.dieresis = 333; 49312 t.ring = 333; 49313 t.cedilla = 333; 49314 t.hungarumlaut = 333; 49315 t.ogonek = 333; 49316 t.caron = 333; 49317 t.emdash = 1000; 49318 t.AE = 1000; 49319 t.ordfeminine = 370; 49320 t.Lslash = 611; 49321 t.Oslash = 778; 49322 t.OE = 1000; 49323 t.ordmasculine = 365; 49324 t.ae = 889; 49325 t.dotlessi = 278; 49326 t.lslash = 278; 49327 t.oslash = 611; 49328 t.oe = 944; 49329 t.germandbls = 611; 49330 t.Idieresis = 278; 49331 t.eacute = 556; 49332 t.abreve = 556; 49333 t.uhungarumlaut = 611; 49334 t.ecaron = 556; 49335 t.Ydieresis = 667; 49336 t.divide = 584; 49337 t.Yacute = 667; 49338 t.Acircumflex = 722; 49339 t.aacute = 556; 49340 t.Ucircumflex = 722; 49341 t.yacute = 556; 49342 t.scommaaccent = 556; 49343 t.ecircumflex = 556; 49344 t.Uring = 722; 49345 t.Udieresis = 722; 49346 t.aogonek = 556; 49347 t.Uacute = 722; 49348 t.uogonek = 611; 49349 t.Edieresis = 667; 49350 t.Dcroat = 722; 49351 t.commaaccent = 250; 49352 t.copyright = 737; 49353 t.Emacron = 667; 49354 t.ccaron = 556; 49355 t.aring = 556; 49356 t.Ncommaaccent = 722; 49357 t.lacute = 278; 49358 t.agrave = 556; 49359 t.Tcommaaccent = 611; 49360 t.Cacute = 722; 49361 t.atilde = 556; 49362 t.Edotaccent = 667; 49363 t.scaron = 556; 49364 t.scedilla = 556; 49365 t.iacute = 278; 49366 t.lozenge = 494; 49367 t.Rcaron = 722; 49368 t.Gcommaaccent = 778; 49369 t.ucircumflex = 611; 49370 t.acircumflex = 556; 49371 t.Amacron = 722; 49372 t.rcaron = 389; 49373 t.ccedilla = 556; 49374 t.Zdotaccent = 611; 49375 t.Thorn = 667; 49376 t.Omacron = 778; 49377 t.Racute = 722; 49378 t.Sacute = 667; 49379 t.dcaron = 743; 49380 t.Umacron = 722; 49381 t.uring = 611; 49382 t.threesuperior = 333; 49383 t.Ograve = 778; 49384 t.Agrave = 722; 49385 t.Abreve = 722; 49386 t.multiply = 584; 49387 t.uacute = 611; 49388 t.Tcaron = 611; 49389 t.partialdiff = 494; 49390 t.ydieresis = 556; 49391 t.Nacute = 722; 49392 t.icircumflex = 278; 49393 t.Ecircumflex = 667; 49394 t.adieresis = 556; 49395 t.edieresis = 556; 49396 t.cacute = 556; 49397 t.nacute = 611; 49398 t.umacron = 611; 49399 t.Ncaron = 722; 49400 t.Iacute = 278; 49401 t.plusminus = 584; 49402 t.brokenbar = 280; 49403 t.registered = 737; 49404 t.Gbreve = 778; 49405 t.Idotaccent = 278; 49406 t.summation = 600; 49407 t.Egrave = 667; 49408 t.racute = 389; 49409 t.omacron = 611; 49410 t.Zacute = 611; 49411 t.Zcaron = 611; 49412 t.greaterequal = 549; 49413 t.Eth = 722; 49414 t.Ccedilla = 722; 49415 t.lcommaaccent = 278; 49416 t.tcaron = 389; 49417 t.eogonek = 556; 49418 t.Uogonek = 722; 49419 t.Aacute = 722; 49420 t.Adieresis = 722; 49421 t.egrave = 556; 49422 t.zacute = 500; 49423 t.iogonek = 278; 49424 t.Oacute = 778; 49425 t.oacute = 611; 49426 t.amacron = 556; 49427 t.sacute = 556; 49428 t.idieresis = 278; 49429 t.Ocircumflex = 778; 49430 t.Ugrave = 722; 49431 t.Delta = 612; 49432 t.thorn = 611; 49433 t.twosuperior = 333; 49434 t.Odieresis = 778; 49435 t.mu = 611; 49436 t.igrave = 278; 49437 t.ohungarumlaut = 611; 49438 t.Eogonek = 667; 49439 t.dcroat = 611; 49440 t.threequarters = 834; 49441 t.Scedilla = 667; 49442 t.lcaron = 400; 49443 t.Kcommaaccent = 722; 49444 t.Lacute = 611; 49445 t.trademark = 1000; 49446 t.edotaccent = 556; 49447 t.Igrave = 278; 49448 t.Imacron = 278; 49449 t.Lcaron = 611; 49450 t.onehalf = 834; 49451 t.lessequal = 549; 49452 t.ocircumflex = 611; 49453 t.ntilde = 611; 49454 t.Uhungarumlaut = 722; 49455 t.Eacute = 667; 49456 t.emacron = 556; 49457 t.gbreve = 611; 49458 t.onequarter = 834; 49459 t.Scaron = 667; 49460 t.Scommaaccent = 667;
49461 t.Ohungarumlaut = 778; 49462 t.degree = 400; 49463 t.ograve = 611; 49464 t.Ccaron = 722; 49465 t.ugrave = 611; 49466 t.radical = 549; 49467 t.Dcaron = 722; 49468 t.rcommaaccent = 389; 49469 t.Ntilde = 722; 49470 t.otilde = 611; 49471 t.Rcommaaccent = 722; 49472 t.Lcommaaccent = 611; 49473 t.Atilde = 722; 49474 t.Aogonek = 722; 49475 t.Aring = 722; 49476 t.Otilde = 778; 49477 t.zdotaccent = 500; 49478 t.Ecaron = 667; 49479 t.Iogonek = 278; 49480 t.kcommaaccent = 556; 49481 t.minus = 584; 49482 t.Icircumflex = 278; 49483 t.ncaron = 611; 49484 t.tcommaaccent = 333; 49485 t.logicalnot = 584; 49486 t.odieresis = 611; 49487 t.udieresis = 611; 49488 t.notequal = 549; 49489 t.gcommaaccent = 611; 49490 t.eth = 611; 49491 t.zcaron = 500; 49492 t.ncommaaccent = 611; 49493 t.onesuperior = 333; 49494 t.imacron = 278; 49495 t.Euro = 556; 49496 }); 49497 t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)
vendor: 6,510 bytes, lines 49497-49814
49497(function (t) { 49498 t.space = 278; 49499 t.exclam = 278; 49500 t.quotedbl = 355; 49501 t.numbersign = 556; 49502 t.dollar = 556; 49503 t.percent = 889; 49504 t.ampersand = 667; 49505 t.quoteright = 222; 49506 t.parenleft = 333; 49507 t.parenright = 333; 49508 t.asterisk = 389; 49509 t.plus = 584; 49510 t.comma = 278; 49511 t.hyphen = 333; 49512 t.period = 278; 49513 t.slash = 278; 49514 t.zero = 556; 49515 t.one = 556; 49516 t.two = 556; 49517 t.three = 556; 49518 t.four = 556; 49519 t.five = 556; 49520 t.six = 556; 49521 t.seven = 556; 49522 t.eight = 556; 49523 t.nine = 556; 49524 t.colon = 278; 49525 t.semicolon = 278; 49526 t.less = 584; 49527 t.equal = 584; 49528 t.greater = 584; 49529 t.question = 556; 49530 t.at = 1015; 49531 t.A = 667; 49532 t.B = 667; 49533 t.C = 722; 49534 t.D = 722; 49535 t.E = 667; 49536 t.F = 611; 49537 t.G = 778; 49538 t.H = 722; 49539 t.I = 278; 49540 t.J = 500; 49541 t.K = 667; 49542 t.L = 556; 49543 t.M = 833; 49544 t.N = 722; 49545 t.O = 778; 49546 t.P = 667; 49547 t.Q = 778; 49548 t.R = 722; 49549 t.S = 667; 49550 t.T = 611; 49551 t.U = 722; 49552 t.V = 667; 49553 t.W = 944; 49554 t.X = 667; 49555 t.Y = 667; 49556 t.Z = 611; 49557 t.bracketleft = 278; 49558 t.backslash = 278; 49559 t.bracketright = 278; 49560 t.asciicircum = 469; 49561 t.underscore = 556; 49562 t.quoteleft = 222; 49563 t.a = 556; 49564 t.b = 556; 49565 t.c = 500; 49566 t.d = 556; 49567 t.e = 556; 49568 t.f = 278; 49569 t.g = 556; 49570 t.h = 556; 49571 t.i = 222; 49572 t.j = 222; 49573 t.k = 500; 49574 t.l = 222; 49575 t.m = 833; 49576 t.n = 556; 49577 t.o = 556; 49578 t.p = 556; 49579 t.q = 556; 49580 t.r = 333; 49581 t.s = 500; 49582 t.t = 278; 49583 t.u = 556; 49584 t.v = 500; 49585 t.w = 722; 49586 t.x = 500; 49587 t.y = 500; 49588 t.z = 500; 49589 t.braceleft = 334; 49590 t.bar = 260; 49591 t.braceright = 334; 49592 t.asciitilde = 584; 49593 t.exclamdown = 333; 49594 t.cent = 556; 49595 t.sterling = 556; 49596 t.fraction = 167; 49597 t.yen = 556; 49598 t.florin = 556; 49599 t.section = 556; 49600 t.currency = 556; 49601 t.quotesingle = 191; 49602 t.quotedblleft = 333; 49603 t.guillemotleft = 556; 49604 t.guilsinglleft = 333; 49605 t.guilsinglright = 333; 49606 t.fi = 500; 49607 t.fl = 500; 49608 t.endash = 556; 49609 t.dagger = 556; 49610 t.daggerdbl = 556; 49611 t.periodcentered = 278; 49612 t.paragraph = 537; 49613 t.bullet = 350; 49614 t.quotesinglbase = 222; 49615 t.quotedblbase = 333; 49616 t.quotedblright = 333; 49617 t.guillemotright = 556; 49618 t.ellipsis = 1000; 49619 t.perthousand = 1000; 49620 t.questiondown = 611; 49621 t.grave = 333; 49622 t.acute = 333; 49623 t.circumflex = 333; 49624 t.tilde = 333; 49625 t.macron = 333; 49626 t.breve = 333; 49627 t.dotaccent = 333; 49628 t.dieresis = 333; 49629 t.ring = 333; 49630 t.cedilla = 333; 49631 t.hungarumlaut = 333; 49632 t.ogonek = 333; 49633 t.caron = 333; 49634 t.emdash = 1000; 49635 t.AE = 1000; 49636 t.ordfeminine = 370; 49637 t.Lslash = 556; 49638 t.Oslash = 778; 49639 t.OE = 1000; 49640 t.ordmasculine = 365; 49641 t.ae = 889; 49642 t.dotlessi = 278; 49643 t.lslash = 222; 49644 t.oslash = 611; 49645 t.oe = 944; 49646 t.germandbls = 611; 49647 t.Idieresis = 278; 49648 t.eacute = 556; 49649 t.abreve = 556; 49650 t.uhungarumlaut = 556; 49651 t.ecaron = 556; 49652 t.Ydieresis = 667; 49653 t.divide = 584; 49654 t.Yacute = 667; 49655 t.Acircumflex = 667; 49656 t.aacute = 556; 49657 t.Ucircumflex = 722; 49658 t.yacute = 500; 49659 t.scommaaccent = 500; 49660 t.ecircumflex = 556; 49661 t.Uring = 722; 49662 t.Udieresis = 722; 49663 t.aogonek = 556; 49664 t.Uacute = 722; 49665 t.uogonek = 556; 49666 t.Edieresis = 667; 49667 t.Dcroat = 722; 49668 t.commaaccent = 250; 49669 t.copyright = 737; 49670 t.Emacron = 667; 49671 t.ccaron = 500; 49672 t.aring = 556; 49673 t.Ncommaaccent = 722; 49674 t.lacute = 222; 49675 t.agrave = 556; 49676 t.Tcommaaccent = 611; 49677 t.Cacute = 722; 49678 t.atilde = 556; 49679 t.Edotaccent = 667; 49680 t.scaron = 500; 49681 t.scedilla = 500; 49682 t.iacute = 278; 49683 t.lozenge = 471; 49684 t.Rcaron = 722; 49685 t.Gcommaaccent = 778; 49686 t.ucircumflex = 556; 49687 t.acircumflex = 556; 49688 t.Amacron = 667; 49689 t.rcaron = 333; 49690 t.ccedilla = 500; 49691 t.Zdotaccent = 611; 49692 t.Thorn = 667; 49693 t.Omacron = 778; 49694 t.Racute = 722; 49695 t.Sacute = 667; 49696 t.dcaron = 643; 49697 t.Umacron = 722; 49698 t.uring = 556; 49699 t.threesuperior = 333; 49700 t.Ograve = 778; 49701 t.Agrave = 667; 49702 t.Abreve = 667; 49703 t.multiply = 584; 49704 t.uacute = 556; 49705 t.Tcaron = 611; 49706 t.partialdiff = 476; 49707 t.ydieresis = 500; 49708 t.Nacute = 722; 49709 t.icircumflex = 278; 49710 t.Ecircumflex = 667; 49711 t.adieresis = 556; 49712 t.edieresis = 556; 49713 t.cacute = 500; 49714 t.nacute = 556; 49715 t.umacron = 556; 49716 t.Ncaron = 722; 49717 t.Iacute = 278; 49718 t.plusminus = 584; 49719 t.brokenbar = 260; 49720 t.registered = 737; 49721 t.Gbreve = 778; 49722 t.Idotaccent = 278; 49723 t.summation = 600; 49724 t.Egrave = 667; 49725 t.racute = 333; 49726 t.omacron = 556; 49727 t.Zacute = 611; 49728 t.Zcaron = 611; 49729 t.greaterequal = 549; 49730 t.Eth = 722; 49731 t.Ccedilla = 722; 49732 t.lcommaaccent = 222; 49733 t.tcaron = 317; 49734 t.eogonek = 556; 49735 t.Uogonek = 722; 49736 t.Aacute = 667; 49737 t.Adieresis = 667; 49738 t.egrave = 556; 49739 t.zacute = 500; 49740 t.iogonek = 222; 49741 t.Oacute = 778; 49742 t.oacute = 556; 49743 t.amacron = 556; 49744 t.sacute = 500; 49745 t.idieresis = 278; 49746 t.Ocircumflex = 778; 49747 t.Ugrave = 722; 49748 t.Delta = 612; 49749 t.thorn = 556; 49750 t.twosuperior = 333; 49751 t.Odieresis = 778; 49752 t.mu = 556; 49753 t.igrave = 278; 49754 t.ohungarumlaut = 556; 49755 t.Eogonek = 667; 49756 t.dcroat = 556; 49757 t.threequarters = 834; 49758 t.Scedilla = 667; 49759 t.lcaron = 299; 49760 t.Kcommaaccent = 667; 49761 t.Lacute = 556; 49762 t.trademark = 1000; 49763 t.edotaccent = 556; 49764 t.Igrave = 278; 49765 t.Imacron = 278; 49766 t.Lcaron = 556; 49767 t.onehalf = 834; 49768 t.lessequal = 549; 49769 t.ocircumflex = 556; 49770 t.ntilde = 556; 49771 t.Uhungarumlaut = 722; 49772 t.Eacute = 667; 49773 t.emacron = 556; 49774 t.gbreve = 556; 49775 t.onequarter = 834; 49776 t.Scaron = 667; 49777 t.Scommaaccent = 667; 49778 t.Ohungarumlaut = 778; 49779 t.degree = 400; 49780 t.ograve = 556; 49781 t.Ccaron = 722; 49782 t.ugrave = 556; 49783 t.radical = 453; 49784 t.Dcaron = 722; 49785 t.rcommaaccent = 333; 49786 t.Ntilde = 722; 49787 t.otilde = 556; 49788 t.Rcommaaccent = 722; 49789 t.Lcommaaccent = 556; 49790 t.Atilde = 667; 49791 t.Aogonek = 667; 49792 t.Aring = 667; 49793 t.Otilde = 778; 49794 t.zdotaccent = 500; 49795 t.Ecaron = 667; 49796 t.Iogonek = 278; 49797 t.kcommaaccent = 500; 49798 t.minus = 584; 49799 t.Icircumflex = 278; 49800 t.ncaron = 556; 49801 t.tcommaaccent = 278; 49802 t.logicalnot = 584; 49803 t.odieresis = 556; 49804 t.udieresis = 556; 49805 t.notequal = 549; 49806 t.gcommaaccent = 556; 49807 t.eth = 556; 49808 t.zcaron = 500; 49809 t.ncommaaccent = 556; 49810 t.onesuperior = 333; 49811 t.imacron = 278; 49812 t.Euro = 556; 49813 }); 49814 t.Symbol =
49814(0, _core_utils.getLookupTableFactory)(function (t) { 49815 t.space = 250; 49816 t.exclam = 333; 49817 t.universal = 713; 49818 t.numbersign = 500; 49819 t.existential = 549; 49820 t.percent = 833; 49821 t.ampersand = 778; 49822 t.suchthat = 439; 49823 t.parenleft = 333; 49824 t.parenright = 333; 49825 t.asteriskmath = 500; 49826 t.plus = 549; 49827 t.comma = 250; 49828 t.minus = 549; 49829 t.period = 250; 49830 t.slash = 278; 49831 t.zero = 500; 49832 t.one = 500; 49833 t.two = 500; 49834 t.three = 500; 49835 t.four = 500; 49836 t.five = 500; 49837 t.six = 500; 49838 t.seven = 500; 49839 t.eight = 500; 49840 t.nine = 500; 49841 t.colon = 278; 49842 t.semicolon = 278; 49843 t.less = 549; 49844 t.equal = 549; 49845 t.greater = 549; 49846 t.question = 444; 49847 t.congruent = 549; 49848 t.Alpha = 722; 49849 t.Beta = 667; 49850 t.Chi = 722; 49851 t.Delta = 612; 49852 t.Epsilon = 611; 49853 t.Phi = 763; 49854 t.Gamma = 603; 49855 t.Eta = 722; 49856 t.Iota = 333; 49857 t.theta1 = 631; 49858 t.Kappa = 722; 49859 t.Lambda = 686; 49860 t.Mu = 889; 49861 t.Nu = 722; 49862 t.Omicron = 722; 49863 t.Pi = 768; 49864 t.Theta = 741; 49865 t.Rho = 556; 49866 t.Sigma = 592; 49867 t.Tau = 611; 49868 t.Upsilon = 690; 49869 t.sigma1 = 439; 49870 t.Omega = 768; 49871 t.Xi = 645; 49872 t.Psi = 795; 49873 t.Zeta = 611; 49874 t.bracketleft = 333; 49875 t.therefore = 863; 49876 t.bracketright = 333; 49877 t.perpendicular = 658; 49878 t.underscore = 500; 49879 t.radicalex = 500; 49880 t.alpha = 631; 49881 t.beta = 549; 49882 t.chi = 549; 49883 t.delta = 494; 49884 t.epsilon = 439; 49885 t.phi = 521; 49886 t.gamma = 411; 49887 t.eta = 603; 49888 t.iota = 329; 49889 t.phi1 = 603; 49890 t.kappa = 549; 49891 t.lambda = 549; 49892 t.mu = 576; 49893 t.nu = 521; 49894 t.omicron = 549; 49895 t.pi = 549; 49896 t.theta = 521; 49897 t.rho = 549; 49898 t.sigma = 603; 49899 t.tau = 439; 49900 t.upsilon = 576; 49901 t.omega1 = 713; 49902 t.omega = 686; 49903 t.xi = 493; 49904 t.psi = 686; 49905 t.zeta = 494; 49906 t.braceleft = 480; 49907 t.bar = 200; 49908 t.braceright = 480; 49909 t.similar = 549; 49910 t.Euro = 750; 49911 t.Upsilon1 = 620; 49912 t.minute = 247; 49913 t.lessequal = 549; 49914 t.fraction = 167; 49915 t.infinity = 713; 49916 t.florin = 500; 49917 t.club = 753; 49918 t.diamond = 753; 49919 t.heart = 753; 49920 t.spade = 753; 49921 t.arrowboth = 1042; 49922 t.arrowleft = 987; 49923 t.arrowup = 603; 49924 t.arrowright = 987; 49925 t.arrowdown = 603; 49926 t.degree = 400; 49927 t.plusminus = 549; 49928 t.second = 411; 49929 t.greaterequal = 549; 49930 t.multiply = 549; 49931 t.proportional = 713; 49932 t.partialdiff = 494; 49933 t.bullet = 460; 49934 t.divide = 549; 49935 t.notequal = 549; 49936 t.equivalence = 549; 49937 t.approxequal = 549; 49938 t.ellipsis = 1000; 49939 t.arrowvertex = 603; 49940 t.arrowhorizex = 1000; 49941 t.carriagereturn = 658; 49942 t.aleph = 823; 49943 t.Ifraktur = 686; 49944 t.Rfraktur = 795; 49945 t.weierstrass = 987; 49946 t.circlemultiply = 768; 49947 t.circleplus = 768; 49948 t.emptyset = 823; 49949 t.intersection = 768; 49950 t.union = 768; 49951 t.propersuperset = 713; 49952 t.reflexsuperset = 713; 49953 t.notsubset = 713; 49954 t.propersubset = 713; 49955 t.reflexsubset = 713; 49956 t.element = 713; 49957 t.notelement = 713; 49958 t.angle = 768; 49959 t.gradient = 713; 49960 t.registerserif = 790; 49961 t.copyrightserif = 790; 49962 t.trademarkserif = 890; 49963 t.product = 823; 49964 t.radical = 549; 49965 t.dotmath = 250; 49966 t.logicalnot = 713; 49967 t.logicaland = 603; 49968 t.logicalor = 603; 49969 t.arrowdblboth = 1042; 49970 t.arrowdblleft = 987; 49971 t.arrowdblup = 603; 49972 t.arrowdblright = 987; 49973 t.arrowdbldown = 603; 49974 t.lozenge = 494; 49975 t.angleleft = 329; 49976 t.registersans = 790; 49977 t.copyrightsans = 790; 49978 t.trademarksans = 786; 49979 t.summation = 713; 49980 t.parenlefttp = 384; 49981 t.parenleftex = 384; 49982 t.parenleftbt = 384; 49983 t.bracketlefttp = 384; 49984 t.bracketleftex = 384; 49985 t.bracketleftbt = 384; 49986 t.bracelefttp = 494; 49987 t.braceleftmid = 494; 49988 t.braceleftbt = 494; 49989 t.braceex = 494; 49990 t.angleright = 329; 49991 t.integral = 274; 49992 t.integraltp = 686; 49993 t.integralex = 686; 49994 t.integralbt = 686; 49995 t.parenrighttp = 384; 49996 t.parenrightex = 384; 49997 t.parenrightbt = 384; 49998 t.bracketrighttp = 384; 49999 t.bracketrightex = 384; 50000 t.bracketrightbt = 384; 50001 t.bracerighttp = 494; 50002 t.bracerightmid = 494; 50003 t.bracerightbt = 494; 50004 t.apple = 790; 50005 }); 50006 t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) { 50007 t.space = 250; 50008 t.exclam = 333; 50009 t.quotedbl = 408; 50010 t.numbersign = 500; 50011 t.dollar = 500; 50012 t.percent = 833; 50013 t.ampersand = 778; 50014 t.quoteright = 333; 50015 t.parenleft = 333; 50016 t.parenright = 333; 50017 t.asterisk = 500; 50018 t.plus = 564; 50019 t.comma = 250; 50020 t.hyphen = 333; 50021 t.period = 250; 50022 t.slash = 278; 50023 t.zero = 500; 50024 t.one = 500; 50025 t.two = 500; 50026 t.three = 500; 50027 t.four = 500; 50028 t.five = 500; 50029 t.six = 500; 50030 t.seven = 500; 50031 t.eight = 500; 50032 t.nine = 500; 50033 t.colon = 278; 50034 t.semicolon = 278; 50035 t.less = 564; 50036 t.equal = 564; 50037 t.greater = 564; 50038 t.question = 444; 50039 t.at = 921; 50040 t.A = 722; 50041 t.B = 667; 50042 t.C = 667; 50043 t.D = 722; 50044 t.E = 611; 50045 t.F = 556; 50046 t.G = 722; 50047 t.H = 722; 50048 t.I = 333; 50049 t.J = 389; 50050 t.K = 722; 50051 t.L = 611;
50052 t.M = 889; 50053 t.N = 722; 50054 t.O = 722; 50055 t.P = 556; 50056 t.Q = 722; 50057 t.R = 667; 50058 t.S = 556; 50059 t.T = 611; 50060 t.U = 722; 50061 t.V = 722; 50062 t.W = 944; 50063 t.X = 722; 50064 t.Y = 722; 50065 t.Z = 611; 50066 t.bracketleft = 333; 50067 t.backslash = 278; 50068 t.bracketright = 333; 50069 t.asciicircum = 469; 50070 t.underscore = 500; 50071 t.quoteleft = 333; 50072 t.a = 444; 50073 t.b = 500; 50074 t.c = 444; 50075 t.d = 500; 50076 t.e = 444; 50077 t.f = 333; 50078 t.g = 500; 50079 t.h = 500; 50080 t.i = 278; 50081 t.j = 278; 50082 t.k = 500; 50083 t.l = 278; 50084 t.m = 778; 50085 t.n = 500; 50086 t.o = 500; 50087 t.p = 500; 50088 t.q = 500; 50089 t.r = 333; 50090 t.s = 389; 50091 t.t = 278; 50092 t.u = 500; 50093 t.v = 500; 50094 t.w = 722; 50095 t.x = 500; 50096 t.y = 500; 50097 t.z = 444; 50098 t.braceleft = 480; 50099 t.bar = 200; 50100 t.braceright = 480; 50101 t.asciitilde = 541; 50102 t.exclamdown = 333; 50103 t.cent = 500; 50104 t.sterling = 500; 50105 t.fraction = 167; 50106 t.yen = 500; 50107 t.florin = 500; 50108 t.section = 500; 50109 t.currency = 500; 50110 t.quotesingle = 180; 50111 t.quotedblleft = 444; 50112 t.guillemotleft = 500; 50113 t.guilsinglleft = 333; 50114 t.guilsinglright = 333; 50115 t.fi = 556; 50116 t.fl = 556; 50117 t.endash = 500; 50118 t.dagger = 500; 50119 t.daggerdbl = 500; 50120 t.periodcentered = 250; 50121 t.paragraph = 453; 50122 t.bullet = 350; 50123 t.quotesinglbase = 333; 50124 t.quotedblbase = 444; 50125 t.quotedblright = 444; 50126 t.guillemotright = 500; 50127 t.ellipsis = 1000; 50128 t.perthousand = 1000; 50129 t.questiondown = 444; 50130 t.grave = 333; 50131 t.acute = 333; 50132 t.circumflex = 333; 50133 t.tilde = 333; 50134 t.macron = 333; 50135 t.breve = 333; 50136 t.dotaccent = 333; 50137 t.dieresis = 333; 50138 t.ring = 333; 50139 t.cedilla = 333; 50140 t.hungarumlaut = 333; 50141 t.ogonek = 333; 50142 t.caron = 333; 50143 t.emdash = 1000; 50144 t.AE = 889; 50145 t.ordfeminine = 276; 50146 t.Lslash = 611; 50147 t.Oslash = 722; 50148 t.OE = 889; 50149 t.ordmasculine = 310; 50150 t.ae = 667; 50151 t.dotlessi = 278; 50152 t.lslash = 278; 50153 t.oslash = 500; 50154 t.oe = 722; 50155 t.germandbls = 500; 50156 t.Idieresis = 333; 50157 t.eacute = 444; 50158 t.abreve = 444; 50159 t.uhungarumlaut = 500; 50160 t.ecaron = 444; 50161 t.Ydieresis = 722; 50162 t.divide = 564; 50163 t.Yacute = 722; 50164 t.Acircumflex = 722; 50165 t.aacute = 444; 50166 t.Ucircumflex = 722; 50167 t.yacute = 500; 50168 t.scommaaccent = 389; 50169 t.ecircumflex = 444; 50170 t.Uring = 722; 50171 t.Udieresis = 722; 50172 t.aogonek = 444; 50173 t.Uacute = 722; 50174 t.uogonek = 500; 50175 t.Edieresis = 611; 50176 t.Dcroat = 722; 50177 t.commaaccent = 250; 50178 t.copyright = 760; 50179 t.Emacron = 611; 50180 t.ccaron = 444; 50181 t.aring = 444; 50182 t.Ncommaaccent = 722; 50183 t.lacute = 278; 50184 t.agrave = 444; 50185 t.Tcommaaccent = 611; 50186 t.Cacute = 667; 50187 t.atilde = 444; 50188 t.Edotaccent = 611; 50189 t.scaron = 389; 50190 t.scedilla = 389; 50191 t.iacute = 278; 50192 t.lozenge = 471; 50193 t.Rcaron = 667; 50194 t.Gcommaaccent = 722; 50195 t.ucircumflex = 500; 50196 t.acircumflex = 444; 50197 t.Amacron = 722; 50198 t.rcaron = 333; 50199 t.ccedilla = 444; 50200 t.Zdotaccent = 611; 50201 t.Thorn = 556; 50202 t.Omacron = 722; 50203 t.Racute = 667; 50204 t.Sacute = 556; 50205 t.dcaron = 588; 50206 t.Umacron = 722; 50207 t.uring = 500; 50208 t.threesuperior = 300; 50209 t.Ograve = 722; 50210 t.Agrave = 722; 50211 t.Abreve = 722; 50212 t.multiply = 564; 50213 t.uacute = 500; 50214 t.Tcaron = 611; 50215 t.partialdiff = 476; 50216 t.ydieresis = 500; 50217 t.Nacute = 722; 50218 t.icircumflex = 278; 50219 t.Ecircumflex = 611; 50220 t.adieresis = 444; 50221 t.edieresis = 444; 50222 t.cacute = 444; 50223 t.nacute = 500; 50224 t.umacron = 500; 50225 t.Ncaron = 722; 50226 t.Iacute = 333; 50227 t.plusminus = 564; 50228 t.brokenbar = 200; 50229 t.registered = 760; 50230 t.Gbreve = 722; 50231 t.Idotaccent = 333; 50232 t.summation = 600; 50233 t.Egrave = 611; 50234 t.racute = 333; 50235 t.omacron = 500; 50236 t.Zacute = 611; 50237 t.Zcaron = 611; 50238 t.greaterequal = 549; 50239 t.Eth = 722; 50240 t.Ccedilla = 667; 50241 t.lcommaaccent = 278; 50242 t.tcaron = 326; 50243 t.eogonek = 444; 50244 t.Uogonek = 722; 50245 t.Aacute = 722; 50246 t.Adieresis = 722; 50247 t.egrave = 444; 50248 t.zacute = 444; 50249 t.iogonek = 278; 50250 t.Oacute = 722; 50251 t.oacute = 500; 50252 t.amacron = 444; 50253 t.sacute = 389; 50254 t.idieresis = 278; 50255 t.Ocircumflex = 722; 50256 t.Ugrave = 722; 50257 t.Delta = 612; 50258 t.thorn = 500; 50259 t.twosuperior = 300; 50260 t.Odieresis = 722; 50261 t.mu = 500; 50262 t.igrave = 278; 50263 t.ohungarumlaut = 500; 50264 t.Eogonek = 611; 50265 t.dcroat = 500; 50266 t.threequarters = 750; 50267 t.Scedilla = 556; 50268 t.lcaron = 344; 50269 t.Kcommaaccent = 722; 50270 t.Lacute = 611; 50271 t.trademark = 980; 50272 t.edotaccent = 444; 50273 t.Igrave = 333; 50274 t.Imacron = 333; 50275 t.Lcaron = 611; 50276 t.onehalf = 750; 50277 t.lessequal = 549; 50278 t.ocircumflex = 500; 50279 t.ntilde = 500; 50280 t.Uhungarumlaut = 722; 50281 t.Eacute = 611; 50282 t.emacron = 444; 50283 t.gbreve = 500; 50284 t.onequarter = 750; 50285 t.Scaron = 556; 50286 t.Scommaaccent = 556;
50287 t.Ohungarumlaut = 722; 50288 t.degree = 400; 50289 t.ograve = 500; 50290 t.Ccaron = 667; 50291 t.ugrave = 500; 50292 t.radical = 453; 50293 t.Dcaron = 722; 50294 t.rcommaaccent = 333; 50295 t.Ntilde = 722; 50296 t.otilde = 500; 50297 t.Rcommaaccent = 667; 50298 t.Lcommaaccent = 611; 50299 t.Atilde = 722; 50300 t.Aogonek = 722; 50301 t.Aring = 722; 50302 t.Otilde = 722; 50303 t.zdotaccent = 444; 50304 t.Ecaron = 611; 50305 t.Iogonek = 333; 50306 t.kcommaaccent = 500; 50307 t.minus = 564; 50308 t.Icircumflex = 333; 50309 t.ncaron = 500; 50310 t.tcommaaccent = 278; 50311 t.logicalnot = 564; 50312 t.odieresis = 500; 50313 t.udieresis = 500; 50314 t.notequal = 549; 50315 t.gcommaaccent = 500; 50316 t.eth = 500; 50317 t.zcaron = 444; 50318 t.ncommaaccent = 500; 50319 t.onesuperior = 300; 50320 t.imacron = 278; 50321 t.Euro = 500; 50322 }); 50323 t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) { 50324 t.space = 250; 50325 t.exclam = 333; 50326 t.quotedbl = 555; 50327 t.numbersign = 500; 50328 t.dollar = 500; 50329 t.percent = 1000; 50330 t.ampersand = 833; 50331 t.quoteright = 333; 50332 t.parenleft = 333; 50333 t.parenright = 333; 50334 t.asterisk = 500; 50335 t.plus = 570; 50336 t.comma = 250; 50337 t.hyphen = 333; 50338 t.period = 250; 50339 t.slash = 278; 50340 t.zero = 500; 50341 t.one = 500; 50342 t.two = 500; 50343 t.three = 500; 50344 t.four = 500; 50345 t.five = 500; 50346 t.six = 500; 50347 t.seven = 500; 50348 t.eight = 500; 50349 t.nine = 500; 50350 t.colon = 333; 50351 t.semicolon = 333; 50352 t.less = 570; 50353 t.equal = 570; 50354 t.greater = 570; 50355 t.question = 500; 50356 t.at = 930; 50357 t.A = 722; 50358 t.B = 667; 50359 t.C = 722; 50360 t.D = 722; 50361 t.E = 667; 50362 t.F = 611; 50363 t.G = 778; 50364 t.H = 778; 50365 t.I = 389; 50366 t.J = 500; 50367 t.K = 778; 50368 t.L = 667; 50369 t.M = 944; 50370 t.N = 722; 50371 t.O = 778; 50372 t.P = 611; 50373 t.Q = 778; 50374 t.R = 722; 50375 t.S = 556; 50376 t.T = 667; 50377 t.U = 722; 50378 t.V = 722; 50379 t.W = 1000; 50380 t.X = 722; 50381 t.Y = 722; 50382 t.Z = 667; 50383 t.bracketleft = 333; 50384 t.backslash = 278; 50385 t.bracketright = 333; 50386 t.asciicircum = 581; 50387 t.underscore = 500; 50388 t.quoteleft = 333; 50389 t.a = 500; 50390 t.b = 556; 50391 t.c = 444; 50392 t.d = 556; 50393 t.e = 444; 50394 t.f = 333; 50395 t.g = 500; 50396 t.h = 556; 50397 t.i = 278; 50398 t.j = 333; 50399 t.k = 556; 50400 t.l = 278; 50401 t.m = 833; 50402 t.n = 556; 50403 t.o = 500; 50404 t.p = 556; 50405 t.q = 556; 50406 t.r = 444; 50407 t.s = 389; 50408 t.t = 333; 50409 t.u = 556; 50410 t.v = 500; 50411 t.w = 722; 50412 t.x = 500; 50413 t.y = 500; 50414 t.z = 444; 50415 t.braceleft = 394; 50416 t.bar = 220; 50417 t.braceright = 394; 50418 t.asciitilde = 520; 50419 t.exclamdown = 333; 50420 t.cent = 500; 50421 t.sterling = 500; 50422 t.fraction = 167; 50423 t.yen = 500; 50424 t.florin = 500; 50425 t.section = 500; 50426 t.currency = 500; 50427 t.quotesingle = 278; 50428 t.quotedblleft = 500; 50429 t.guillemotleft = 500; 50430 t.guilsinglleft = 333; 50431 t.guilsinglright = 333; 50432 t.fi = 556; 50433 t.fl = 556; 50434 t.endash = 500; 50435 t.dagger = 500; 50436 t.daggerdbl = 500; 50437 t.periodcentered = 250; 50438 t.paragraph = 540; 50439 t.bullet = 350; 50440 t.quotesinglbase = 333; 50441 t.quotedblbase = 500; 50442 t.quotedblright = 500; 50443 t.guillemotright = 500; 50444 t.ellipsis = 1000; 50445 t.perthousand = 1000; 50446 t.questiondown = 500; 50447 t.grave = 333; 50448 t.acute = 333; 50449 t.circumflex = 333; 50450 t.tilde = 333; 50451 t.macron = 333; 50452 t.breve = 333; 50453 t.dotaccent = 333; 50454 t.dieresis = 333; 50455 t.ring = 333; 50456 t.cedilla = 333; 50457 t.hungarumlaut = 333; 50458 t.ogonek = 333; 50459 t.caron = 333; 50460 t.emdash = 1000; 50461 t.AE = 1000; 50462 t.ordfeminine = 300; 50463 t.Lslash = 667; 50464 t.Oslash = 778; 50465 t.OE = 1000; 50466 t.ordmasculine = 330; 50467 t.ae = 722; 50468 t.dotlessi = 278; 50469 t.lslash = 278; 50470 t.oslash = 500; 50471 t.oe = 722; 50472 t.germandbls = 556; 50473 t.Idieresis = 389; 50474 t.eacute = 444; 50475 t.abreve = 500; 50476 t.uhungarumlaut = 556; 50477 t.ecaron = 444; 50478 t.Ydieresis = 722; 50479 t.divide = 570; 50480 t.Yacute = 722; 50481 t.Acircumflex = 722; 50482 t.aacute = 500; 50483 t.Ucircumflex = 722; 50484 t.yacute = 500; 50485 t.scommaaccent = 389; 50486 t.ecircumflex = 444; 50487 t.Uring = 722; 50488 t.Udieresis = 722; 50489 t.aogonek = 500; 50490 t.Uacute = 722; 50491 t.uogonek = 556; 50492 t.Edieresis = 667; 50493 t.Dcroat = 722; 50494 t.commaaccent = 250; 50495 t.copyright = 747; 50496 t.Emacron = 667; 50497 t.ccaron = 444; 50498 t.aring = 500; 50499 t.Ncommaaccent = 722; 50500 t.lacute = 278; 50501 t.agrave = 500; 50502 t.Tcommaaccent = 667; 50503 t.Cacute = 722; 50504 t.atilde = 500; 50505 t.Edotaccent = 667; 50506 t.scaron = 389; 50507 t.scedilla = 389; 50508 t.iacute = 278; 50509 t.lozenge = 494; 50510 t.Rcaron = 722; 50511 t.Gcommaaccent = 778; 50512 t.ucircumflex = 556; 50513 t.acircumflex = 500; 50514 t.Amacron = 722; 50515 t.rcaron = 444; 50516 t.ccedilla = 444; 50517 t.Zdotaccent = 667; 50518 t.Thorn = 611; 50519 t.Omacron = 778; 50520 t.Racute = 722; 50521 t.Sacute = 556; 50522 t.dcaron = 672; 50523 t.Umacron = 722; 50524 t.uring = 556; 50525 t.threesuperior = 300; 50526 t.Ograve = 778; 50527 t.Agrave = 722; 50528 t.Abreve = 722; 50529 t.multiply = 570; 50530 t.uacute = 556; 50531 t.Tcaron = 667; 50532 t.partialdiff = 494; 50533 t.ydieresis = 500; 50534 t.Nacute = 722; 50535 t.icircumflex = 278; 50536 t.Ecircumflex = 667; 50537 t.adieresis = 500; 50538 t.edieresis = 444; 50539 t.cacute = 444; 50540 t.nacute = 556; 50541 t.umacron = 556; 50542 t.Ncaron = 722; 50543 t.Iacute = 389; 50544 t.plusminus = 570; 50545 t.brokenbar = 220; 50546 t.registered = 747; 50547 t.Gbreve = 778; 50548 t.Idotaccent = 389; 50549 t.summation = 600; 50550 t.Egrave = 667; 50551 t.racute = 444; 50552 t.omacron = 500; 50553 t.Zacute = 667; 50554 t.Zcaron = 667; 50555 t.greaterequal = 549; 50556 t.Eth = 722; 50557 t.Ccedilla = 722; 50558 t.lcommaaccent = 278; 50559 t.tcaron = 416; 50560 t.eogonek = 444; 50561 t.Uogonek = 722; 50562 t.Aacute = 722; 50563 t.Adieresis = 722; 50564 t.egrave = 444; 50565 t.zacute = 444; 50566 t.iogonek = 278; 50567 t.Oacute = 778; 50568 t.oacute = 500; 50569 t.amacron = 500; 50570 t.sacute = 389; 50571 t.idieresis = 278; 50572 t.Ocircumflex = 778; 50573 t.Ugrave = 722; 50574 t.Delta = 612; 50575 t.thorn = 556; 50576 t.twosuperior = 300; 50577 t.Odieresis = 778; 50578 t.mu = 556; 50579 t.igrave = 278; 50580 t.ohungarumlaut = 500; 50581 t.Eogonek = 667; 50582 t.dcroat = 556; 50583 t.threequarters = 750; 50584 t.Scedilla = 556; 50585 t.lcaron = 394; 50586 t.Kcommaaccent = 778; 50587 t.Lacute = 667; 50588 t.trademark = 1000; 50589 t.edotaccent = 444; 50590 t.Igrave = 389; 50591 t.Imacron = 389; 50592 t.Lcaron = 667; 50593 t.onehalf = 750; 50594 t.lessequal = 549; 50595 t.ocircumflex = 500; 50596 t.ntilde = 556; 50597 t.Uhungarumlaut = 722; 50598 t.Eacute = 667; 50599 t.emacron = 444; 50600 t.gbreve = 500; 50601 t.onequarter = 750; 50602 t.Scaron = 556; 50603 t.Scommaaccent = 556;
50604 t.Ohungarumlaut = 778; 50605 t.degree = 400; 50606 t.ograve = 500; 50607 t.Ccaron = 722; 50608 t.ugrave = 556; 50609 t.radical = 549; 50610 t.Dcaron = 722; 50611 t.rcommaaccent = 444; 50612 t.Ntilde = 722; 50613 t.otilde = 500; 50614 t.Rcommaaccent = 722; 50615 t.Lcommaaccent = 667; 50616 t.Atilde = 722; 50617 t.Aogonek = 722; 50618 t.Aring = 722; 50619 t.Otilde = 778; 50620 t.zdotaccent = 444; 50621 t.Ecaron = 667; 50622 t.Iogonek = 389; 50623 t.kcommaaccent = 556; 50624 t.minus = 570; 50625 t.Icircumflex = 389; 50626 t.ncaron = 556; 50627 t.tcommaaccent = 333; 50628 t.logicalnot = 570; 50629 t.odieresis = 500; 50630 t.udieresis = 556; 50631 t.notequal = 549; 50632 t.gcommaaccent = 500; 50633 t.eth = 500; 50634 t.zcaron = 444; 50635 t.ncommaaccent = 556; 50636 t.onesuperior = 300; 50637 t.imacron = 278; 50638 t.Euro = 500; 50639 }); 50640 t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) { 50641 t.space = 250; 50642 t.exclam = 389; 50643 t.quotedbl = 555; 50644 t.numbersign = 500; 50645 t.dollar = 500; 50646 t.percent = 833; 50647 t.ampersand = 778; 50648 t.quoteright = 333; 50649 t.parenleft = 333; 50650 t.parenright = 333; 50651 t.asterisk = 500; 50652 t.plus = 570; 50653 t.comma = 250; 50654 t.hyphen = 333; 50655 t.period = 250; 50656 t.slash = 278; 50657 t.zero = 500; 50658 t.one = 500; 50659 t.two = 500; 50660 t.three = 500; 50661 t.four = 500; 50662 t.five = 500; 50663 t.six = 500; 50664 t.seven = 500; 50665 t.eight = 500; 50666 t.nine = 500; 50667 t.colon = 333; 50668 t.semicolon = 333; 50669 t.less = 570; 50670 t.equal = 570; 50671 t.greater = 570; 50672 t.question = 500; 50673 t.at = 832; 50674 t.A = 667; 50675 t.B = 667; 50676 t.C = 667; 50677 t.D = 722; 50678 t.E = 667; 50679 t.F = 667; 50680 t.G = 722; 50681 t.H = 778; 50682 t.I = 389; 50683 t.J = 500; 50684 t.K = 667; 50685 t.L = 611; 50686 t.M = 889; 50687 t.N = 722; 50688 t.O = 722; 50689 t.P = 611; 50690 t.Q = 722; 50691 t.R = 667; 50692 t.S = 556; 50693 t.T = 611; 50694 t.U = 722; 50695 t.V = 667; 50696 t.W = 889; 50697 t.X = 667; 50698 t.Y = 611; 50699 t.Z = 611; 50700 t.bracketleft = 333; 50701 t.backslash = 278; 50702 t.bracketright = 333; 50703 t.asciicircum = 570; 50704 t.underscore = 500; 50705 t.quoteleft = 333; 50706 t.a = 500; 50707 t.b = 500; 50708 t.c = 444; 50709 t.d = 500; 50710 t.e = 444; 50711 t.f = 333; 50712 t.g = 500; 50713 t.h = 556; 50714 t.i = 278; 50715 t.j = 278; 50716 t.k = 500; 50717 t.l = 278; 50718 t.m = 778; 50719 t.n = 556; 50720 t.o = 500; 50721 t.p = 500; 50722 t.q = 500; 50723 t.r = 389; 50724 t.s = 389; 50725 t.t = 278; 50726 t.u = 556; 50727 t.v = 444; 50728 t.w = 667; 50729 t.x = 500; 50730 t.y = 444; 50731 t.z = 389; 50732 t.braceleft = 348; 50733 t.bar = 220; 50734 t.braceright = 348; 50735 t.asciitilde = 570; 50736 t.exclamdown = 389; 50737 t.cent = 500; 50738 t.sterling = 500; 50739 t.fraction = 167; 50740 t.yen = 500; 50741 t.florin = 500; 50742 t.section = 500; 50743 t.currency = 500; 50744 t.quotesingle = 278; 50745 t.quotedblleft = 500; 50746 t.guillemotleft = 500; 50747 t.guilsinglleft = 333; 50748 t.guilsinglright = 333; 50749 t.fi = 556; 50750 t.fl = 556; 50751 t.endash = 500; 50752 t.dagger = 500; 50753 t.daggerdbl = 500; 50754 t.periodcentered = 250; 50755 t.paragraph = 500; 50756 t.bullet = 350; 50757 t.quotesinglbase = 333; 50758 t.quotedblbase = 500; 50759 t.quotedblright = 500; 50760 t.guillemotright = 500; 50761 t.ellipsis = 1000; 50762 t.perthousand = 1000; 50763 t.questiondown = 500; 50764 t.grave = 333; 50765 t.acute = 333; 50766 t.circumflex = 333; 50767 t.tilde = 333; 50768 t.macron = 333; 50769 t.breve = 333; 50770 t.dotaccent = 333; 50771 t.dieresis = 333; 50772 t.ring = 333; 50773 t.cedilla = 333; 50774 t.hungarumlaut = 333; 50775 t.ogonek = 333; 50776 t.caron = 333; 50777 t.emdash = 1000; 50778 t.AE = 944; 50779 t.ordfeminine = 266; 50780 t.Lslash = 611; 50781 t.Oslash = 722; 50782 t.OE = 944; 50783 t.ordmasculine = 300; 50784 t.ae = 722; 50785 t.dotlessi = 278; 50786 t.lslash = 278; 50787 t.oslash = 500; 50788 t.oe = 722; 50789 t.germandbls = 500; 50790 t.Idieresis = 389; 50791 t.eacute = 444; 50792 t.abreve = 500; 50793 t.uhungarumlaut = 556; 50794 t.ecaron = 444; 50795 t.Ydieresis = 611; 50796 t.divide = 570; 50797 t.Yacute = 611; 50798 t.Acircumflex = 667; 50799 t.aacute = 500; 50800 t.Ucircumflex = 722; 50801 t.yacute = 444; 50802 t.scommaaccent = 389; 50803 t.ecircumflex = 444; 50804 t.Uring = 722; 50805 t.Udieresis = 722; 50806 t.aogonek = 500; 50807 t.Uacute = 722; 50808 t.uogonek = 556; 50809 t.Edieresis = 667; 50810 t.Dcroat = 722; 50811 t.commaaccent = 250; 50812 t.copyright = 747; 50813 t.Emacron = 667; 50814 t.ccaron = 444; 50815 t.aring = 500; 50816 t.Ncommaaccent = 722; 50817 t.lacute = 278; 50818 t.agrave = 500; 50819 t.Tcommaaccent = 611; 50820 t.Cacute = 667; 50821 t.atilde = 500; 50822 t.Edotaccent = 667; 50823 t.scaron = 389; 50824 t.scedilla = 389; 50825 t.iacute = 278; 50826 t.lozenge = 494; 50827 t.Rcaron = 667; 50828 t.Gcommaaccent = 722; 50829 t.ucircumflex = 556; 50830 t.acircumflex = 500; 50831 t.Amacron = 667; 50832 t.rcaron = 389; 50833 t.ccedilla = 444; 50834 t.Zdotaccent = 611; 50835 t.Thorn = 611; 50836 t.Omacron = 722; 50837 t.Racute = 667; 50838 t.Sacute = 556; 50839 t.dcaron = 608; 50840 t.Umacron = 722; 50841 t.uring = 556; 50842 t.threesuperior = 300; 50843 t.Ograve = 722; 50844 t.Agrave = 667; 50845 t.Abreve = 667; 50846 t.multiply = 570; 50847 t.uacute = 556; 50848 t.Tcaron = 611; 50849 t.partialdiff = 494; 50850 t.ydieresis = 444; 50851 t.Nacute = 722; 50852 t.icircumflex = 278; 50853 t.Ecircumflex = 667; 50854 t.adieresis = 500; 50855 t.edieresis = 444; 50856 t.cacute = 444; 50857 t.nacute = 556; 50858 t.umacron = 556; 50859 t.Ncaron = 722; 50860 t.Iacute = 389; 50861 t.plusminus = 570; 50862 t.brokenbar = 220; 50863 t.registered = 747; 50864 t.Gbreve = 722; 50865 t.Idotaccent = 389; 50866 t.summation = 600; 50867 t.Egrave = 667; 50868 t.racute = 389; 50869 t.omacron = 500; 50870 t.Zacute = 611; 50871 t.Zcaron = 611; 50872 t.greaterequal = 549; 50873 t.Eth = 722; 50874 t.Ccedilla = 667; 50875 t.lcommaaccent = 278; 50876 t.tcaron = 366; 50877 t.eogonek = 444; 50878 t.Uogonek = 722; 50879 t.Aacute = 667; 50880 t.Adieresis = 667; 50881 t.egrave = 444; 50882 t.zacute = 389; 50883 t.iogonek = 278; 50884 t.Oacute = 722; 50885 t.oacute = 500; 50886 t.amacron = 500; 50887 t.sacute = 389; 50888 t.idieresis = 278; 50889 t.Ocircumflex = 722; 50890 t.Ugrave = 722; 50891 t.Delta = 612; 50892 t.thorn = 500; 50893 t.twosuperior = 300; 50894 t.Odieresis = 722; 50895 t.mu = 576; 50896 t.igrave = 278; 50897 t.ohungarumlaut = 500; 50898 t.Eogonek = 667; 50899 t.dcroat = 500; 50900 t.threequarters = 750; 50901 t.Scedilla = 556; 50902 t.lcaron = 382; 50903 t.Kcommaaccent = 667; 50904 t.Lacute = 611; 50905 t.trademark = 1000; 50906 t.edotaccent = 444; 50907 t.Igrave = 389; 50908 t.Imacron = 389; 50909 t.Lcaron = 611; 50910 t.onehalf = 750; 50911 t.lessequal = 549; 50912 t.ocircumflex = 500; 50913 t.ntilde = 556; 50914 t.Uhungarumlaut = 722; 50915 t.Eacute = 667; 50916 t.emacron = 444; 50917 t.gbreve = 500; 50918 t.onequarter = 750; 50919 t.Scaron = 556; 50920 t.Scommaaccent = 556;
50921 t.Ohungarumlaut = 722; 50922 t.degree = 400; 50923 t.ograve = 500; 50924 t.Ccaron = 667; 50925 t.ugrave = 556; 50926 t.radical = 549; 50927 t.Dcaron = 722; 50928 t.rcommaaccent = 389; 50929 t.Ntilde = 722; 50930 t.otilde = 500; 50931 t.Rcommaaccent = 667; 50932 t.Lcommaaccent = 611; 50933 t.Atilde = 667; 50934 t.Aogonek = 667; 50935 t.Aring = 667; 50936 t.Otilde = 722; 50937 t.zdotaccent = 389; 50938 t.Ecaron = 667; 50939 t.Iogonek = 389; 50940 t.kcommaaccent = 500; 50941 t.minus = 606; 50942 t.Icircumflex = 389; 50943 t.ncaron = 556; 50944 t.tcommaaccent = 278; 50945 t.logicalnot = 606; 50946 t.odieresis = 500; 50947 t.udieresis = 556; 50948 t.notequal = 549; 50949 t.gcommaaccent = 500; 50950 t.eth = 500; 50951 t.zcaron = 389; 50952 t.ncommaaccent = 556; 50953 t.onesuperior = 300; 50954 t.imacron = 278; 50955 t.Euro = 500; 50956 }); 50957 t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)
vendor: 6,510 bytes, lines 50957-51274
50957(function (t) { 50958 t.space = 250; 50959 t.exclam = 333; 50960 t.quotedbl = 420; 50961 t.numbersign = 500; 50962 t.dollar = 500; 50963 t.percent = 833; 50964 t.ampersand = 778; 50965 t.quoteright = 333; 50966 t.parenleft = 333; 50967 t.parenright = 333; 50968 t.asterisk = 500; 50969 t.plus = 675; 50970 t.comma = 250; 50971 t.hyphen = 333; 50972 t.period = 250; 50973 t.slash = 278; 50974 t.zero = 500; 50975 t.one = 500; 50976 t.two = 500; 50977 t.three = 500; 50978 t.four = 500; 50979 t.five = 500; 50980 t.six = 500; 50981 t.seven = 500; 50982 t.eight = 500; 50983 t.nine = 500; 50984 t.colon = 333; 50985 t.semicolon = 333; 50986 t.less = 675; 50987 t.equal = 675; 50988 t.greater = 675; 50989 t.question = 500; 50990 t.at = 920; 50991 t.A = 611; 50992 t.B = 611; 50993 t.C = 667; 50994 t.D = 722; 50995 t.E = 611; 50996 t.F = 611; 50997 t.G = 722; 50998 t.H = 722; 50999 t.I = 333; 51000 t.J = 444; 51001 t.K = 667; 51002 t.L = 556; 51003 t.M = 833; 51004 t.N = 667; 51005 t.O = 722; 51006 t.P = 611; 51007 t.Q = 722; 51008 t.R = 611; 51009 t.S = 500; 51010 t.T = 556; 51011 t.U = 722; 51012 t.V = 611; 51013 t.W = 833; 51014 t.X = 611; 51015 t.Y = 556; 51016 t.Z = 556; 51017 t.bracketleft = 389; 51018 t.backslash = 278; 51019 t.bracketright = 389; 51020 t.asciicircum = 422; 51021 t.underscore = 500; 51022 t.quoteleft = 333; 51023 t.a = 500; 51024 t.b = 500; 51025 t.c = 444; 51026 t.d = 500; 51027 t.e = 444; 51028 t.f = 278; 51029 t.g = 500; 51030 t.h = 500; 51031 t.i = 278; 51032 t.j = 278; 51033 t.k = 444; 51034 t.l = 278; 51035 t.m = 722; 51036 t.n = 500; 51037 t.o = 500; 51038 t.p = 500; 51039 t.q = 500; 51040 t.r = 389; 51041 t.s = 389; 51042 t.t = 278; 51043 t.u = 500; 51044 t.v = 444; 51045 t.w = 667; 51046 t.x = 444; 51047 t.y = 444; 51048 t.z = 389; 51049 t.braceleft = 400; 51050 t.bar = 275; 51051 t.braceright = 400; 51052 t.asciitilde = 541; 51053 t.exclamdown = 389; 51054 t.cent = 500; 51055 t.sterling = 500; 51056 t.fraction = 167; 51057 t.yen = 500; 51058 t.florin = 500; 51059 t.section = 500; 51060 t.currency = 500; 51061 t.quotesingle = 214; 51062 t.quotedblleft = 556; 51063 t.guillemotleft = 500; 51064 t.guilsinglleft = 333; 51065 t.guilsinglright = 333; 51066 t.fi = 500; 51067 t.fl = 500; 51068 t.endash = 500; 51069 t.dagger = 500; 51070 t.daggerdbl = 500; 51071 t.periodcentered = 250; 51072 t.paragraph = 523; 51073 t.bullet = 350; 51074 t.quotesinglbase = 333; 51075 t.quotedblbase = 556; 51076 t.quotedblright = 556; 51077 t.guillemotright = 500; 51078 t.ellipsis = 889; 51079 t.perthousand = 1000; 51080 t.questiondown = 500; 51081 t.grave = 333; 51082 t.acute = 333; 51083 t.circumflex = 333; 51084 t.tilde = 333; 51085 t.macron = 333; 51086 t.breve = 333; 51087 t.dotaccent = 333; 51088 t.dieresis = 333; 51089 t.ring = 333; 51090 t.cedilla = 333; 51091 t.hungarumlaut = 333; 51092 t.ogonek = 333; 51093 t.caron = 333; 51094 t.emdash = 889; 51095 t.AE = 889; 51096 t.ordfeminine = 276; 51097 t.Lslash = 556; 51098 t.Oslash = 722; 51099 t.OE = 944; 51100 t.ordmasculine = 310; 51101 t.ae = 667; 51102 t.dotlessi = 278; 51103 t.lslash = 278; 51104 t.oslash = 500; 51105 t.oe = 667; 51106 t.germandbls = 500; 51107 t.Idieresis = 333; 51108 t.eacute = 444; 51109 t.abreve = 500; 51110 t.uhungarumlaut = 500; 51111 t.ecaron = 444; 51112 t.Ydieresis = 556; 51113 t.divide = 675; 51114 t.Yacute = 556; 51115 t.Acircumflex = 611; 51116 t.aacute = 500; 51117 t.Ucircumflex = 722; 51118 t.yacute = 444; 51119 t.scommaaccent = 389; 51120 t.ecircumflex = 444; 51121 t.Uring = 722; 51122 t.Udieresis = 722; 51123 t.aogonek = 500; 51124 t.Uacute = 722; 51125 t.uogonek = 500; 51126 t.Edieresis = 611; 51127 t.Dcroat = 722; 51128 t.commaaccent = 250; 51129 t.copyright = 760; 51130 t.Emacron = 611; 51131 t.ccaron = 444; 51132 t.aring = 500; 51133 t.Ncommaaccent = 667; 51134 t.lacute = 278; 51135 t.agrave = 500; 51136 t.Tcommaaccent = 556; 51137 t.Cacute = 667; 51138 t.atilde = 500; 51139 t.Edotaccent = 611; 51140 t.scaron = 389; 51141 t.scedilla = 389; 51142 t.iacute = 278; 51143 t.lozenge = 471; 51144 t.Rcaron = 611; 51145 t.Gcommaaccent = 722; 51146 t.ucircumflex = 500; 51147 t.acircumflex = 500; 51148 t.Amacron = 611; 51149 t.rcaron = 389; 51150 t.ccedilla = 444; 51151 t.Zdotaccent = 556; 51152 t.Thorn = 611; 51153 t.Omacron = 722; 51154 t.Racute = 611; 51155 t.Sacute = 500; 51156 t.dcaron = 544; 51157 t.Umacron = 722; 51158 t.uring = 500; 51159 t.threesuperior = 300; 51160 t.Ograve = 722; 51161 t.Agrave = 611; 51162 t.Abreve = 611; 51163 t.multiply = 675; 51164 t.uacute = 500; 51165 t.Tcaron = 556; 51166 t.partialdiff = 476; 51167 t.ydieresis = 444; 51168 t.Nacute = 667; 51169 t.icircumflex = 278; 51170 t.Ecircumflex = 611; 51171 t.adieresis = 500; 51172 t.edieresis = 444; 51173 t.cacute = 444; 51174 t.nacute = 500; 51175 t.umacron = 500; 51176 t.Ncaron = 667; 51177 t.Iacute = 333; 51178 t.plusminus = 675; 51179 t.brokenbar = 275; 51180 t.registered = 760; 51181 t.Gbreve = 722; 51182 t.Idotaccent = 333; 51183 t.summation = 600; 51184 t.Egrave = 611; 51185 t.racute = 389; 51186 t.omacron = 500; 51187 t.Zacute = 556; 51188 t.Zcaron = 556; 51189 t.greaterequal = 549; 51190 t.Eth = 722; 51191 t.Ccedilla = 667; 51192 t.lcommaaccent = 278; 51193 t.tcaron = 300; 51194 t.eogonek = 444; 51195 t.Uogonek = 722; 51196 t.Aacute = 611; 51197 t.Adieresis = 611; 51198 t.egrave = 444; 51199 t.zacute = 389; 51200 t.iogonek = 278; 51201 t.Oacute = 722; 51202 t.oacute = 500; 51203 t.amacron = 500; 51204 t.sacute = 389; 51205 t.idieresis = 278; 51206 t.Ocircumflex = 722; 51207 t.Ugrave = 722; 51208 t.Delta = 612; 51209 t.thorn = 500; 51210 t.twosuperior = 300; 51211 t.Odieresis = 722; 51212 t.mu = 500; 51213 t.igrave = 278; 51214 t.ohungarumlaut = 500; 51215 t.Eogonek = 611; 51216 t.dcroat = 500; 51217 t.threequarters = 750; 51218 t.Scedilla = 500; 51219 t.lcaron = 300; 51220 t.Kcommaaccent = 667; 51221 t.Lacute = 556; 51222 t.trademark = 980; 51223 t.edotaccent = 444; 51224 t.Igrave = 333; 51225 t.Imacron = 333; 51226 t.Lcaron = 611; 51227 t.onehalf = 750; 51228 t.lessequal = 549; 51229 t.ocircumflex = 500; 51230 t.ntilde = 500; 51231 t.Uhungarumlaut = 722; 51232 t.Eacute = 611; 51233 t.emacron = 444; 51234 t.gbreve = 500; 51235 t.onequarter = 750; 51236 t.Scaron = 500; 51237 t.Scommaaccent = 500; 51238 t.Ohungarumlaut = 722; 51239 t.degree = 400; 51240 t.ograve = 500; 51241 t.Ccaron = 667; 51242 t.ugrave = 500; 51243 t.radical = 453; 51244 t.Dcaron = 722; 51245 t.rcommaaccent = 389; 51246 t.Ntilde = 667; 51247 t.otilde = 500; 51248 t.Rcommaaccent = 611; 51249 t.Lcommaaccent = 556; 51250 t.Atilde = 611; 51251 t.Aogonek = 611; 51252 t.Aring = 611; 51253 t.Otilde = 722; 51254 t.zdotaccent = 389; 51255 t.Ecaron = 611; 51256 t.Iogonek = 333; 51257 t.kcommaaccent = 444; 51258 t.minus = 675; 51259 t.Icircumflex = 333; 51260 t.ncaron = 500; 51261 t.tcommaaccent = 278; 51262 t.logicalnot = 675; 51263 t.odieresis = 500; 51264 t.udieresis = 500; 51265 t.notequal = 549; 51266 t.gcommaaccent = 500; 51267 t.eth = 500; 51268 t.zcaron = 389; 51269 t.ncommaaccent = 500; 51270 t.onesuperior = 300; 51271 t.imacron = 278; 51272 t.Euro = 500; 51273 }); 51274 t.ZapfDingbats =
51274(0, _core_utils.getLookupTableFactory)(function (t) { 51275 t.space = 278; 51276 t.a1 = 974; 51277 t.a2 = 961; 51278 t.a202 = 974; 51279 t.a3 = 980; 51280 t.a4 = 719; 51281 t.a5 = 789; 51282 t.a119 = 790; 51283 t.a118 = 791; 51284 t.a117 = 690; 51285 t.a11 = 960; 51286 t.a12 = 939; 51287 t.a13 = 549; 51288 t.a14 = 855; 51289 t.a15 = 911; 51290 t.a16 = 933; 51291 t.a105 = 911; 51292 t.a17 = 945; 51293 t.a18 = 974; 51294 t.a19 = 755; 51295 t.a20 = 846; 51296 t.a21 = 762; 51297 t.a22 = 761; 51298 t.a23 = 571; 51299 t.a24 = 677; 51300 t.a25 = 763; 51301 t.a26 = 760; 51302 t.a27 = 759; 51303 t.a28 = 754; 51304 t.a6 = 494; 51305 t.a7 = 552; 51306 t.a8 = 537; 51307 t.a9 = 577; 51308 t.a10 = 692; 51309 t.a29 = 786; 51310 t.a30 = 788; 51311 t.a31 = 788; 51312 t.a32 = 790; 51313 t.a33 = 793; 51314 t.a34 = 794; 51315 t.a35 = 816; 51316 t.a36 = 823; 51317 t.a37 = 789; 51318 t.a38 = 841; 51319 t.a39 = 823; 51320 t.a40 = 833; 51321 t.a41 = 816; 51322 t.a42 = 831; 51323 t.a43 = 923; 51324 t.a44 = 744; 51325 t.a45 = 723; 51326 t.a46 = 749; 51327 t.a47 = 790; 51328 t.a48 = 792; 51329 t.a49 = 695; 51330 t.a50 = 776; 51331 t.a51 = 768; 51332 t.a52 = 792; 51333 t.a53 = 759; 51334 t.a54 = 707; 51335 t.a55 = 708; 51336 t.a56 = 682; 51337 t.a57 = 701; 51338 t.a58 = 826; 51339 t.a59 = 815; 51340 t.a60 = 789; 51341 t.a61 = 789; 51342 t.a62 = 707; 51343 t.a63 = 687; 51344 t.a64 = 696; 51345 t.a65 = 689; 51346 t.a66 = 786; 51347 t.a67 = 787; 51348 t.a68 = 713; 51349 t.a69 = 791; 51350 t.a70 = 785; 51351 t.a71 = 791; 51352 t.a72 = 873; 51353 t.a73 = 761; 51354 t.a74 = 762; 51355 t.a203 = 762; 51356 t.a75 = 759; 51357 t.a204 = 759; 51358 t.a76 = 892; 51359 t.a77 = 892; 51360 t.a78 = 788; 51361 t.a79 = 784; 51362 t.a81 = 438; 51363 t.a82 = 138; 51364 t.a83 = 277; 51365 t.a84 = 415; 51366 t.a97 = 392; 51367 t.a98 = 392; 51368 t.a99 = 668; 51369 t.a100 = 668; 51370 t.a89 = 390; 51371 t.a90 = 390; 51372 t.a93 = 317; 51373 t.a94 = 317; 51374 t.a91 = 276; 51375 t.a92 = 276; 51376 t.a205 = 509; 51377 t.a85 = 509; 51378 t.a206 = 410; 51379 t.a86 = 410; 51380 t.a87 = 234; 51381 t.a88 = 234; 51382 t.a95 = 334; 51383 t.a96 = 334; 51384 t.a101 = 732; 51385 t.a102 = 544; 51386 t.a103 = 544; 51387 t.a104 = 910; 51388 t.a106 = 667; 51389 t.a107 = 760; 51390 t.a108 = 760; 51391 t.a112 = 776; 51392 t.a111 = 595; 51393 t.a110 = 694; 51394 t.a109 = 626; 51395 t.a120 = 788; 51396 t.a121 = 788; 51397 t.a122 = 788; 51398 t.a123 = 788; 51399 t.a124 = 788; 51400 t.a125 = 788; 51401 t.a126 = 788; 51402 t.a127 = 788; 51403 t.a128 = 788; 51404 t.a129 = 788; 51405 t.a130 = 788; 51406 t.a131 = 788; 51407 t.a132 = 788; 51408 t.a133 = 788; 51409 t.a134 = 788; 51410 t.a135 = 788; 51411 t.a136 = 788; 51412 t.a137 = 788; 51413 t.a138 = 788; 51414 t.a139 = 788; 51415 t.a140 = 788; 51416 t.a141 = 788; 51417 t.a142 = 788; 51418 t.a143 = 788; 51419 t.a144 = 788; 51420 t.a145 = 788; 51421 t.a146 = 788; 51422 t.a147 = 788; 51423 t.a148 = 788; 51424 t.a149 = 788; 51425 t.a150 = 788; 51426 t.a151 = 788; 51427 t.a152 = 788; 51428 t.a153 = 788; 51429 t.a154 = 788; 51430 t.a155 = 788; 51431 t.a156 = 788; 51432 t.a157 = 788; 51433 t.a158 = 788; 51434 t.a159 = 788; 51435 t.a160 = 894; 51436 t.a161 = 838; 51437 t.a163 = 1016; 51438 t.a164 = 458; 51439 t.a196 = 748; 51440 t.a165 = 924; 51441 t.a192 = 748; 51442 t.a166 = 918; 51443 t.a167 = 927; 51444 t.a168 = 928; 51445 t.a169 = 928; 51446 t.a170 = 834; 51447 t.a171 = 873; 51448 t.a172 = 828; 51449 t.a173 = 924; 51450 t.a162 = 924; 51451 t.a174 = 917; 51452 t.a175 = 930; 51453 t.a176 = 931; 51454 t.a177 = 463; 51455 t.a178 = 883; 51456 t.a179 = 836; 51457 t.a193 = 836; 51458 t.a180 = 867; 51459 t.a199 = 867; 51460 t.a181 = 696; 51461 t.a200 = 696; 51462 t.a182 = 874; 51463 t.a201 = 874; 51464 t.a183 = 760; 51465 t.a184 = 946; 51466 t.a197 = 771; 51467 t.a185 = 865; 51468 t.a194 = 771; 51469 t.a198 = 888; 51470 t.a186 = 967; 51471 t.a195 = 888; 51472 t.a187 = 831; 51473 t.a188 = 873; 51474 t.a189 = 927; 51475 t.a190 = 970; 51476 t.a191 = 918; 51477 }); 51478}); 51479exports.getMetrics = getMetrics; 51480 51481/***/ }), 51482/* 61 */ 51483/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 51484 51485 51486 51487Object.defineProperty(exports, "__esModule", ({ 51488 value: true 51489})); 51490exports.MurmurHash3_64 = void 0; 51491 51492var _util = __w_pdfjs_require__(2); 51493 51494const SEED = 0xc3d2e1f0; 51495const MASK_HIGH = 0xffff0000; 51496const MASK_LOW = 0xffff; 51497 51498class MurmurHash3_64 { 51499 constructor(seed) { 51500 this.h1 = seed ? seed & 0xffffffff : SEED; 51501 this.h2 = seed ? seed & 0xffffffff : SEED; 51502 } 51503 51504 update(input) { 51505 let data, length; 51506 51507 if ((0, _util.isString)(input)) { 51508 data = new Uint8Array(input.length * 2); 51509 length = 0; 51510 51511 for (let i = 0, ii = input.length; i < ii; i++) { 51512 const code = input.charCodeAt(i); 51513 51514 if (code <= 0xff) { 51515 data[length++] = code; 51516 } else { 51517 data[length++] = code >>> 8; 51518 data[length++] = code & 0xff; 51519 } 51520 } 51521 } else if ((0, _util.isArrayBuffer)(input)) { 51522 data = input.slice(); 51523 length = data.byteLength; 51524 } else { 51525 throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array."); 51526 } 51527 51528 const blockCounts = length >> 2; 51529 const tailLength = length - blockCounts * 4; 51530 const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts); 51531 let k1 = 0, 51532 k2 = 0; 51533 let h1 = this.h1, 51534 h2 = this.h2; 51535 const C1 = 0xcc9e2d51, 51536 C2 = 0x1b873593; 51537 const C1_LOW = C1 & MASK_LOW, 51538 C2_LOW = C2 & MASK_LOW; 51539 51540 for (let i = 0; i < blockCounts; i++) { 51541 if (i & 1) {
51542 k1 = dataUint32[i]; 51543 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 51544 k1 = k1 << 15 | k1 >>> 17; 51545 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 51546 h1 ^= k1; 51547 h1 = h1 << 13 | h1 >>> 19; 51548 h1 = h1 * 5 + 0xe6546b64; 51549 } else { 51550 k2 = dataUint32[i]; 51551 k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW; 51552 k2 = k2 << 15 | k2 >>> 17; 51553 k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW; 51554 h2 ^= k2; 51555 h2 = h2 << 13 | h2 >>> 19; 51556 h2 = h2 * 5 + 0xe6546b64; 51557 } 51558 } 51559 51560 k1 = 0; 51561 51562 switch (tailLength) { 51563 case 3: 51564 k1 ^= data[blockCounts * 4 + 2] << 16; 51565 51566 case 2: 51567 k1 ^= data[blockCounts * 4 + 1] << 8; 51568 51569 case 1: 51570 k1 ^= data[blockCounts * 4]; 51571 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 51572 k1 = k1 << 15 | k1 >>> 17; 51573 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 51574 51575 if (blockCounts & 1) { 51576 h1 ^= k1; 51577 } else { 51578 h2 ^= k1; 51579 } 51580 51581 } 51582 51583 this.h1 = h1; 51584 this.h2 = h2; 51585 } 51586 51587 hexdigest() { 51588 let h1 = this.h1, 51589 h2 = this.h2; 51590 h1 ^= h2 >>> 1; 51591 h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW; 51592 h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16; 51593 h1 ^= h2 >>> 1; 51594 h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW; 51595 h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16; 51596 h1 ^= h2 >>> 1; 51597 const hex1 = (h1 >>> 0).toString(16), 51598 hex2 = (h2 >>> 0).toString(16); 51599 return hex1.padStart(8, "0") + hex2.padStart(8, "0"); 51600 } 51601 51602} 51603 51604exports.MurmurHash3_64 = MurmurHash3_64; 51605 51606/***/ }), 51607/* 62 */ 51608/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 51609 51610 51611 51612Object.defineProperty(exports, "__esModule", ({ 51613 value: true 51614})); 51615exports.OperatorList = void 0; 51616 51617var _util = __w_pdfjs_require__(2); 51618 51619function addState(parentState, pattern, checkFn, iterateFn, processFn) { 51620 let state = parentState; 51621 51622 for (let i = 0, ii = pattern.length - 1; i < ii; i++) { 51623 const item = pattern[i]; 51624 state = state[item] || (state[item] = []); 51625 } 51626 51627 state[pattern[pattern.length - 1]] = { 51628 checkFn, 51629 iterateFn, 51630 processFn 51631 }; 51632} 51633 51634function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) { 51635 const iFirstPIMXO = iFirstSave + 2; 51636 let i; 51637 51638 for (i = 0; i < count; i++) { 51639 const arg = argsArray[iFirstPIMXO + 4 * i]; 51640 const imageMask = arg.length === 1 && arg[0]; 51641 51642 if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) { 51643 fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask; 51644 continue; 51645 } 51646 51647 break; 51648 } 51649 51650 return count - i; 51651} 51652 51653const InitialState = []; 51654addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) { 51655 const fnArray = context.fnArray;
vendor: 14,894 bytes, lines 51656-52178
51656 const iFirstSave = context.iCurr - 3; 51657 const pos = (i - iFirstSave) % 4; 51658 51659 switch (pos) { 51660 case 0: 51661 return fnArray[i] === _util.OPS.save; 51662 51663 case 1: 51664 return fnArray[i] === _util.OPS.transform; 51665 51666 case 2: 51667 return fnArray[i] === _util.OPS.paintInlineImageXObject; 51668 51669 case 3: 51670 return fnArray[i] === _util.OPS.restore; 51671 } 51672 51673 throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`); 51674}, function foundInlineImageGroup(context, i) { 51675 const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10; 51676 const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200; 51677 const MAX_WIDTH = 1000; 51678 const IMAGE_PADDING = 1; 51679 const fnArray = context.fnArray, 51680 argsArray = context.argsArray; 51681 const curr = context.iCurr; 51682 const iFirstSave = curr - 3; 51683 const iFirstTransform = curr - 2; 51684 const iFirstPIIXO = curr - 1; 51685 const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK); 51686 51687 if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) { 51688 return i - (i - iFirstSave) % 4; 51689 } 51690 51691 let maxX = 0; 51692 const map = []; 51693 let maxLineHeight = 0; 51694 let currentX = IMAGE_PADDING, 51695 currentY = IMAGE_PADDING; 51696 51697 for (let q = 0; q < count; q++) { 51698 const transform = argsArray[iFirstTransform + (q << 2)]; 51699 const img = argsArray[iFirstPIIXO + (q << 2)][0]; 51700 51701 if (currentX + img.width > MAX_WIDTH) { 51702 maxX = Math.max(maxX, currentX); 51703 currentY += maxLineHeight + 2 * IMAGE_PADDING; 51704 currentX = 0; 51705 maxLineHeight = 0; 51706 } 51707 51708 map.push({ 51709 transform, 51710 x: currentX, 51711 y: currentY, 51712 w: img.width, 51713 h: img.height 51714 }); 51715 currentX += img.width + 2 * IMAGE_PADDING; 51716 maxLineHeight = Math.max(maxLineHeight, img.height); 51717 } 51718 51719 const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING; 51720 const imgHeight = currentY + maxLineHeight + IMAGE_PADDING; 51721 const imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4); 51722 const imgRowSize = imgWidth << 2; 51723 51724 for (let q = 0; q < count; q++) { 51725 const data = argsArray[iFirstPIIXO + (q << 2)][0].data; 51726 const rowSize = map[q].w << 2; 51727 let dataOffset = 0; 51728 let offset = map[q].x + map[q].y * imgWidth << 2; 51729 imgData.set(data.subarray(0, rowSize), offset - imgRowSize); 51730 51731 for (let k = 0, kk = map[q].h; k < kk; k++) { 51732 imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset); 51733 dataOffset += rowSize; 51734 offset += imgRowSize; 51735 } 51736 51737 imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset); 51738 51739 while (offset >= 0) { 51740 data[offset - 4] = data[offset]; 51741 data[offset - 3] = data[offset + 1]; 51742 data[offset - 2] = data[offset + 2]; 51743 data[offset - 1] = data[offset + 3]; 51744 data[offset + rowSize] = data[offset + rowSize - 4]; 51745 data[offset + rowSize + 1] = data[offset + rowSize - 3]; 51746 data[offset + rowSize + 2] = data[offset + rowSize - 2]; 51747 data[offset + rowSize + 3] = data[offset + rowSize - 1]; 51748 offset -= imgRowSize; 51749 } 51750 } 51751 51752 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup); 51753 argsArray.splice(iFirstSave, count * 4, [{ 51754 width: imgWidth, 51755 height: imgHeight, 51756 kind: _util.ImageKind.RGBA_32BPP, 51757 data: imgData 51758 }, map]); 51759 return iFirstSave + 1; 51760}); 51761addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) { 51762 const fnArray = context.fnArray; 51763 const iFirstSave = context.iCurr - 3; 51764 const pos = (i - iFirstSave) % 4; 51765 51766 switch (pos) { 51767 case 0: 51768 return fnArray[i] === _util.OPS.save; 51769 51770 case 1: 51771 return fnArray[i] === _util.OPS.transform; 51772 51773 case 2: 51774 return fnArray[i] === _util.OPS.paintImageMaskXObject; 51775 51776 case 3: 51777 return fnArray[i] === _util.OPS.restore; 51778 } 51779 51780 throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`); 51781}, function foundImageMaskGroup(context, i) { 51782 const MIN_IMAGES_IN_MASKS_BLOCK = 10; 51783 const MAX_IMAGES_IN_MASKS_BLOCK = 100; 51784 const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000; 51785 const fnArray = context.fnArray, 51786 argsArray = context.argsArray; 51787 const curr = context.iCurr; 51788 const iFirstSave = curr - 3; 51789 const iFirstTransform = curr - 2; 51790 const iFirstPIMXO = curr - 1; 51791 let count = Math.floor((i - iFirstSave) / 4); 51792 count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray); 51793 51794 if (count < MIN_IMAGES_IN_MASKS_BLOCK) { 51795 return i - (i - iFirstSave) % 4; 51796 } 51797 51798 let isSameImage = false; 51799 let iTransform, transformArgs; 51800 const firstPIMXOArg0 = argsArray[iFirstPIMXO][0]; 51801 const firstTransformArg0 = argsArray[iFirstTransform][0], 51802 firstTransformArg1 = argsArray[iFirstTransform][1], 51803 firstTransformArg2 = argsArray[iFirstTransform][2], 51804 firstTransformArg3 = argsArray[iFirstTransform][3]; 51805 51806 if (firstTransformArg1 === firstTransformArg2) { 51807 isSameImage = true; 51808 iTransform = iFirstTransform + 4; 51809 let iPIMXO = iFirstPIMXO + 4; 51810 51811 for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) { 51812 transformArgs = argsArray[iTransform]; 51813 51814 if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) { 51815 if (q < MIN_IMAGES_IN_MASKS_BLOCK) { 51816 isSameImage = false; 51817 } else { 51818 count = q; 51819 } 51820 51821 break; 51822 } 51823 } 51824 } 51825 51826 if (isSameImage) { 51827 count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK); 51828 const positions = new Float32Array(count * 2); 51829 iTransform = iFirstTransform; 51830 51831 for (let q = 0; q < count; q++, iTransform += 4) { 51832 transformArgs = argsArray[iTransform]; 51833 positions[q << 1] = transformArgs[4]; 51834 positions[(q << 1) + 1] = transformArgs[5]; 51835 } 51836 51837 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat); 51838 argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]); 51839 } else { 51840 count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK); 51841 const images = []; 51842 51843 for (let q = 0; q < count; q++) { 51844 transformArgs = argsArray[iFirstTransform + (q << 2)]; 51845 const maskParams = argsArray[iFirstPIMXO + (q << 2)][0]; 51846 images.push({ 51847 data: maskParams.data, 51848 width: maskParams.width, 51849 height: maskParams.height, 51850 transform: transformArgs 51851 }); 51852 } 51853 51854 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup); 51855 argsArray.splice(iFirstSave, count * 4, [images]); 51856 } 51857 51858 return iFirstSave + 1; 51859}); 51860addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) { 51861 const argsArray = context.argsArray; 51862 const iFirstTransform = context.iCurr - 2; 51863 return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0; 51864}, function iterateImageGroup(context, i) { 51865 const fnArray = context.fnArray, 51866 argsArray = context.argsArray; 51867 const iFirstSave = context.iCurr - 3; 51868 const pos = (i - iFirstSave) % 4; 51869 51870 switch (pos) { 51871 case 0: 51872 return fnArray[i] === _util.OPS.save; 51873 51874 case 1: 51875 if (fnArray[i] !== _util.OPS.transform) { 51876 return false; 51877 } 51878 51879 const iFirstTransform = context.iCurr - 2; 51880 const firstTransformArg0 = argsArray[iFirstTransform][0]; 51881 const firstTransformArg3 = argsArray[iFirstTransform][3]; 51882 51883 if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) { 51884 return false; 51885 } 51886 51887 return true; 51888 51889 case 2: 51890 if (fnArray[i] !== _util.OPS.paintImageXObject) { 51891 return false; 51892 } 51893 51894 const iFirstPIXO = context.iCurr - 1; 51895 const firstPIXOArg0 = argsArray[iFirstPIXO][0]; 51896 51897 if (argsArray[i][0] !== firstPIXOArg0) { 51898 return false; 51899 } 51900 51901 return true; 51902 51903 case 3: 51904 return fnArray[i] === _util.OPS.restore; 51905 } 51906 51907 throw new Error(`iterateImageGroup - invalid pos: ${pos}`); 51908}, function (context, i) { 51909 const MIN_IMAGES_IN_BLOCK = 3; 51910 const MAX_IMAGES_IN_BLOCK = 1000; 51911 const fnArray = context.fnArray, 51912 argsArray = context.argsArray; 51913 const curr = context.iCurr; 51914 const iFirstSave = curr - 3; 51915 const iFirstTransform = curr - 2; 51916 const iFirstPIXO = curr - 1; 51917 const firstPIXOArg0 = argsArray[iFirstPIXO][0]; 51918 const firstTransformArg0 = argsArray[iFirstTransform][0]; 51919 const firstTransformArg3 = argsArray[iFirstTransform][3]; 51920 const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK); 51921 51922 if (count < MIN_IMAGES_IN_BLOCK) { 51923 return i - (i - iFirstSave) % 4; 51924 } 51925 51926 const positions = new Float32Array(count * 2); 51927 let iTransform = iFirstTransform; 51928 51929 for (let q = 0; q < count; q++, iTransform += 4) { 51930 const transformArgs = argsArray[iTransform]; 51931 positions[q << 1] = transformArgs[4]; 51932 positions[(q << 1) + 1] = transformArgs[5]; 51933 } 51934 51935 const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions]; 51936 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat); 51937 argsArray.splice(iFirstSave, count * 4, args); 51938 return iFirstSave + 1; 51939}); 51940addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) { 51941 const fnArray = context.fnArray, 51942 argsArray = context.argsArray; 51943 const iFirstSave = context.iCurr - 4; 51944 const pos = (i - iFirstSave) % 5; 51945 51946 switch (pos) { 51947 case 0: 51948 return fnArray[i] === _util.OPS.beginText; 51949 51950 case 1: 51951 return fnArray[i] === _util.OPS.setFont; 51952 51953 case 2: 51954 return fnArray[i] === _util.OPS.setTextMatrix; 51955 51956 case 3: 51957 if (fnArray[i] !== _util.OPS.showText) { 51958 return false; 51959 } 51960 51961 const iFirstSetFont = context.iCurr - 3; 51962 const firstSetFontArg0 = argsArray[iFirstSetFont][0]; 51963 const firstSetFontArg1 = argsArray[iFirstSetFont][1]; 51964 51965 if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) { 51966 return false; 51967 } 51968 51969 return true; 51970 51971 case 4: 51972 return fnArray[i] === _util.OPS.endText; 51973 } 51974 51975 throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`); 51976}, function (context, i) { 51977 const MIN_CHARS_IN_BLOCK = 3; 51978 const MAX_CHARS_IN_BLOCK = 1000; 51979 const fnArray = context.fnArray, 51980 argsArray = context.argsArray; 51981 const curr = context.iCurr; 51982 const iFirstBeginText = curr - 4; 51983 const iFirstSetFont = curr - 3; 51984 const iFirstSetTextMatrix = curr - 2; 51985 const iFirstShowText = curr - 1; 51986 const iFirstEndText = curr; 51987 const firstSetFontArg0 = argsArray[iFirstSetFont][0]; 51988 const firstSetFontArg1 = argsArray[iFirstSetFont][1]; 51989 let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK); 51990 51991 if (count < MIN_CHARS_IN_BLOCK) { 51992 return i - (i - iFirstBeginText) % 5; 51993 } 51994 51995 let iFirst = iFirstBeginText; 51996 51997 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) { 51998 count++; 51999 iFirst -= 5; 52000 } 52001 52002 let iEndText = iFirst + 4; 52003 52004 for (let q = 1; q < count; q++) { 52005 fnArray.splice(iEndText, 3); 52006 argsArray.splice(iEndText, 3); 52007 iEndText += 2; 52008 } 52009 52010 return iEndText + 1; 52011}); 52012 52013class NullOptimizer { 52014 constructor(queue) { 52015 this.queue = queue; 52016 } 52017 52018 _optimize() {} 52019 52020 push(fn, args) { 52021 this.queue.fnArray.push(fn); 52022 this.queue.argsArray.push(args); 52023 52024 this._optimize(); 52025 } 52026 52027 flush() {} 52028 52029 reset() {} 52030 52031} 52032 52033class QueueOptimizer extends NullOptimizer { 52034 constructor(queue) { 52035 super(queue); 52036 this.state = null; 52037 this.context = { 52038 iCurr: 0, 52039 fnArray: queue.fnArray, 52040 argsArray: queue.argsArray 52041 }; 52042 this.match = null; 52043 this.lastProcessed = 0; 52044 } 52045 52046 _optimize() { 52047 const fnArray = this.queue.fnArray; 52048 let i = this.lastProcessed, 52049 ii = fnArray.length; 52050 let state = this.state; 52051 let match = this.match; 52052 52053 if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) { 52054 this.lastProcessed = ii; 52055 return; 52056 } 52057 52058 const context = this.context; 52059 52060 while (i < ii) { 52061 if (match) { 52062 const iterate = (0, match.iterateFn)(context, i); 52063 52064 if (iterate) { 52065 i++; 52066 continue; 52067 } 52068 52069 i = (0, match.processFn)(context, i + 1); 52070 ii = fnArray.length; 52071 match = null; 52072 state = null; 52073 52074 if (i >= ii) { 52075 break; 52076 } 52077 } 52078 52079 state = (state || InitialState)[fnArray[i]]; 52080 52081 if (!state || Array.isArray(state)) { 52082 i++; 52083 continue; 52084 } 52085 52086 context.iCurr = i; 52087 i++; 52088 52089 if (state.checkFn && !(0, state.checkFn)(context)) { 52090 state = null; 52091 continue; 52092 } 52093 52094 match = state; 52095 state = null; 52096 } 52097 52098 this.state = state; 52099 this.match = match; 52100 this.lastProcessed = i; 52101 } 52102 52103 flush() { 52104 while (this.match) { 52105 const length = this.queue.fnArray.length; 52106 this.lastProcessed = (0, this.match.processFn)(this.context, length); 52107 this.match = null; 52108 this.state = null; 52109 52110 this._optimize(); 52111 } 52112 } 52113 52114 reset() { 52115 this.state = null; 52116 this.match = null; 52117 this.lastProcessed = 0; 52118 } 52119 52120} 52121 52122class OperatorList { 52123 static get CHUNK_SIZE() { 52124 return (0, _util.shadow)(this, "CHUNK_SIZE", 1000); 52125 } 52126 52127 static get CHUNK_SIZE_ABOUT() { 52128 return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5); 52129 } 52130 52131 constructor(intent = 0, streamSink) { 52132 this._streamSink = streamSink; 52133 this.fnArray = []; 52134 this.argsArray = []; 52135 52136 if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) { 52137 this.optimizer = new QueueOptimizer(this); 52138 } else { 52139 this.optimizer = new NullOptimizer(this); 52140 } 52141 52142 this.dependencies = new Set(); 52143 this._totalLength = 0; 52144 this.weight = 0; 52145 this._resolved = streamSink ? null : Promise.resolve(); 52146 } 52147 52148 get length() { 52149 return this.argsArray.length; 52150 } 52151 52152 get ready() { 52153 return this._resolved || this._streamSink.ready; 52154 } 52155 52156 get totalLength() { 52157 return this._totalLength + this.length; 52158 } 52159 52160 addOp(fn, args) { 52161 this.optimizer.push(fn, args); 52162 this.weight++; 52163 52164 if (this._streamSink) { 52165 if (this.weight >= OperatorList.CHUNK_SIZE) { 52166 this.flush(); 52167 } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) { 52168 this.flush(); 52169 } 52170 } 52171 } 52172 52173 addDependency(dependency) { 52174 if (this.dependencies.has(dependency)) { 52175 return; 52176 } 52177 52178 this.dependencies.add(dependency);
52179 this.addOp(_util.OPS.dependency, [dependency]); 52180 } 52181 52182 addDependencies(dependencies) { 52183 for (const dependency of dependencies) { 52184 this.addDependency(dependency); 52185 } 52186 } 52187 52188 addOpList(opList) { 52189 if (!(opList instanceof OperatorList)) { 52190 (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.'); 52191 return; 52192 } 52193 52194 for (const dependency of opList.dependencies) { 52195 this.dependencies.add(dependency); 52196 } 52197 52198 for (let i = 0, ii = opList.length; i < ii; i++) { 52199 this.addOp(opList.fnArray[i], opList.argsArray[i]); 52200 } 52201 } 52202 52203 getIR() { 52204 return { 52205 fnArray: this.fnArray, 52206 argsArray: this.argsArray, 52207 length: this.length 52208 }; 52209 } 52210 52211 get _transfers() { 52212 const transfers = []; 52213 const { 52214 fnArray, 52215 argsArray, 52216 length 52217 } = this; 52218 52219 for (let i = 0; i < length; i++) { 52220 switch (fnArray[i]) { 52221 case _util.OPS.paintInlineImageXObject: 52222 case _util.OPS.paintInlineImageXObjectGroup: 52223 case _util.OPS.paintImageMaskXObject: 52224 const arg = argsArray[i][0]; 52225 ; 52226 52227 if (!arg.cached) { 52228 transfers.push(arg.data.buffer); 52229 } 52230 52231 break; 52232 } 52233 } 52234 52235 return transfers; 52236 } 52237 52238 flush(lastChunk = false) { 52239 this.optimizer.flush(); 52240 const length = this.length; 52241 this._totalLength += length; 52242 52243 this._streamSink.enqueue({ 52244 fnArray: this.fnArray, 52245 argsArray: this.argsArray, 52246 lastChunk, 52247 length 52248 }, 1, this._transfers); 52249 52250 this.dependencies.clear(); 52251 this.fnArray.length = 0; 52252 this.argsArray.length = 0; 52253 this.weight = 0; 52254 this.optimizer.reset(); 52255 } 52256 52257} 52258 52259exports.OperatorList = OperatorList; 52260 52261/***/ }), 52262/* 63 */ 52263/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 52264 52265 52266 52267Object.defineProperty(exports, "__esModule", ({ 52268 value: true 52269})); 52270exports.PDFImage = void 0; 52271 52272var _util = __w_pdfjs_require__(2); 52273 52274var _primitives = __w_pdfjs_require__(5); 52275 52276var _colorspace = __w_pdfjs_require__(24); 52277 52278var _decode_stream = __w_pdfjs_require__(29); 52279 52280var _jpeg_stream = __w_pdfjs_require__(37); 52281 52282var _jpx = __w_pdfjs_require__(40); 52283 52284function decodeAndClamp(value, addend, coefficient, max) { 52285 value = addend + value * coefficient; 52286 52287 if (value < 0) { 52288 value = 0; 52289 } else if (value > max) { 52290 value = max; 52291 } 52292 52293 return value; 52294} 52295 52296function resizeImageMask(src, bpc, w1, h1, w2, h2) { 52297 const length = w2 * h2; 52298 let dest; 52299 52300 if (bpc <= 8) { 52301 dest = new Uint8Array(length); 52302 } else if (bpc <= 16) { 52303 dest = new Uint16Array(length); 52304 } else { 52305 dest = new Uint32Array(length); 52306 } 52307 52308 const xRatio = w1 / w2; 52309 const yRatio = h1 / h2; 52310 let i, 52311 j, 52312 py, 52313 newIndex = 0, 52314 oldIndex; 52315 const xScaled = new Uint16Array(w2); 52316 const w1Scanline = w1; 52317 52318 for (i = 0; i < w2; i++) { 52319 xScaled[i] = Math.floor(i * xRatio); 52320 } 52321 52322 for (i = 0; i < h2; i++) { 52323 py = Math.floor(i * yRatio) * w1Scanline; 52324 52325 for (j = 0; j < w2; j++) { 52326 oldIndex = py + xScaled[j]; 52327 dest[newIndex++] = src[oldIndex]; 52328 } 52329 } 52330 52331 return dest; 52332} 52333 52334class PDFImage { 52335 constructor({ 52336 xref, 52337 res, 52338 image, 52339 isInline = false, 52340 smask = null, 52341 mask = null, 52342 isMask = false, 52343 pdfFunctionFactory, 52344 localColorSpaceCache 52345 }) { 52346 this.image = image; 52347 const dict = image.dict; 52348 const filter = dict.get("F", "Filter"); 52349 52350 if ((0, _primitives.isName)(filter)) { 52351 switch (filter.name) { 52352 case "JPXDecode": 52353 const jpxImage = new _jpx.JpxImage(); 52354 jpxImage.parseImageProperties(image.stream); 52355 image.stream.reset(); 52356 image.width = jpxImage.width; 52357 image.height = jpxImage.height; 52358 image.bitsPerComponent = jpxImage.bitsPerComponent; 52359 image.numComps = jpxImage.componentsCount; 52360 break; 52361 52362 case "JBIG2Decode": 52363 image.bitsPerComponent = 1; 52364 image.numComps = 1; 52365 break; 52366 } 52367 } 52368 52369 let width = dict.get("W", "Width"); 52370 let height = dict.get("H", "Height"); 52371 52372 if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) { 52373 (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary."); 52374 width = image.width; 52375 height = image.height; 52376 } 52377 52378 if (width < 1 || height < 1) { 52379 throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`); 52380 } 52381 52382 this.width = width; 52383 this.height = height; 52384 this.interpolate = dict.get("I", "Interpolate"); 52385 this.imageMask = dict.get("IM", "ImageMask") || false; 52386 this.matte = dict.get("Matte") || false; 52387 let bitsPerComponent = image.bitsPerComponent; 52388 52389 if (!bitsPerComponent) { 52390 bitsPerComponent = dict.get("BPC", "BitsPerComponent"); 52391 52392 if (!bitsPerComponent) { 52393 if (this.imageMask) { 52394 bitsPerComponent = 1; 52395 } else { 52396 throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`); 52397 } 52398 } 52399 } 52400 52401 this.bpc = bitsPerComponent; 52402 52403 if (!this.imageMask) { 52404 let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace"); 52405 52406 if (!colorSpace) { 52407 (0, _util.info)("JPX images (which do not require color spaces)"); 52408 52409 switch (image.numComps) { 52410 case 1: 52411 colorSpace = _primitives.Name.get("DeviceGray"); 52412 break; 52413 52414 case 3: 52415 colorSpace = _primitives.Name.get("DeviceRGB"); 52416 break; 52417 52418 case 4: 52419 colorSpace = _primitives.Name.get("DeviceCMYK"); 52420 break; 52421 52422 default: 52423 throw new Error(`JPX images with ${image.numComps} color components not supported.`); 52424 } 52425 } 52426 52427 this.colorSpace = _colorspace.ColorSpace.parse({ 52428 cs: colorSpace, 52429 xref, 52430 resources: isInline ? res : null, 52431 pdfFunctionFactory, 52432 localColorSpaceCache 52433 }); 52434 this.numComps = this.colorSpace.numComps; 52435 } 52436 52437 this.decode = dict.getArray("D", "Decode"); 52438 this.needsDecode = false;
52439 52440 if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) { 52441 this.needsDecode = true; 52442 const max = (1 << bitsPerComponent) - 1; 52443 this.decodeCoefficients = []; 52444 this.decodeAddends = []; 52445 const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed"; 52446 52447 for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) { 52448 const dmin = this.decode[i]; 52449 const dmax = this.decode[i + 1]; 52450 this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin; 52451 this.decodeAddends[j] = isIndexed ? dmin : max * dmin; 52452 } 52453 } 52454 52455 if (smask) { 52456 this.smask = new PDFImage({ 52457 xref, 52458 res, 52459 image: smask, 52460 isInline, 52461 pdfFunctionFactory, 52462 localColorSpaceCache 52463 }); 52464 } else if (mask) { 52465 if ((0, _primitives.isStream)(mask)) { 52466 const maskDict = mask.dict, 52467 imageMask = maskDict.get("IM", "ImageMask"); 52468 52469 if (!imageMask) { 52470 (0, _util.warn)("Ignoring /Mask in image without /ImageMask."); 52471 } else { 52472 this.mask = new PDFImage({ 52473 xref, 52474 res, 52475 image: mask, 52476 isInline, 52477 isMask: true, 52478 pdfFunctionFactory, 52479 localColorSpaceCache 52480 }); 52481 } 52482 } else { 52483 this.mask = mask; 52484 } 52485 } 52486 } 52487 52488 static async buildImage({ 52489 xref, 52490 res, 52491 image, 52492 isInline = false, 52493 pdfFunctionFactory, 52494 localColorSpaceCache 52495 }) { 52496 const imageData = image; 52497 let smaskData = null; 52498 let maskData = null; 52499 const smask = image.dict.get("SMask"); 52500 const mask = image.dict.get("Mask"); 52501 52502 if (smask) { 52503 smaskData = smask; 52504 } else if (mask) { 52505 if ((0, _primitives.isStream)(mask) || Array.isArray(mask)) { 52506 maskData = mask; 52507 } else { 52508 (0, _util.warn)("Unsupported mask format."); 52509 } 52510 } 52511 52512 return new PDFImage({ 52513 xref, 52514 res, 52515 image: imageData, 52516 isInline, 52517 smask: smaskData, 52518 mask: maskData, 52519 pdfFunctionFactory, 52520 localColorSpaceCache 52521 }); 52522 } 52523 52524 static createMask({ 52525 imgArray, 52526 width, 52527 height, 52528 imageIsFromDecodeStream, 52529 inverseDecode, 52530 interpolate 52531 }) { 52532 const computedLength = (width + 7 >> 3) * height; 52533 const actualLength = imgArray.byteLength; 52534 const haveFullData = computedLength === actualLength; 52535 let data, i; 52536 52537 if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) { 52538 data = imgArray; 52539 } else if (!inverseDecode) { 52540 data = new Uint8ClampedArray(actualLength); 52541 data.set(imgArray); 52542 } else { 52543 data = new Uint8ClampedArray(computedLength); 52544 data.set(imgArray); 52545 52546 for (i = actualLength; i < computedLength; i++) { 52547 data[i] = 0xff; 52548 } 52549 } 52550 52551 if (inverseDecode) { 52552 for (i = 0; i < actualLength; i++) { 52553 data[i] ^= 0xff; 52554 } 52555 } 52556 52557 return { 52558 data, 52559 width, 52560 height, 52561 interpolate 52562 }; 52563 } 52564 52565 get drawWidth() { 52566 return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0); 52567 } 52568 52569 get drawHeight() { 52570 return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0); 52571 } 52572 52573 decodeBuffer(buffer) { 52574 const bpc = this.bpc; 52575 const numComps = this.numComps; 52576 const decodeAddends = this.decodeAddends; 52577 const decodeCoefficients = this.decodeCoefficients; 52578 const max = (1 << bpc) - 1; 52579 let i, ii; 52580 52581 if (bpc === 1) { 52582 for (i = 0, ii = buffer.length; i < ii; i++) { 52583 buffer[i] = +!buffer[i]; 52584 } 52585 52586 return; 52587 } 52588 52589 let index = 0; 52590 52591 for (i = 0, ii = this.width * this.height; i < ii; i++) { 52592 for (let j = 0; j < numComps; j++) { 52593 buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max); 52594 index++; 52595 } 52596 } 52597 } 52598 52599 getComponents(buffer) { 52600 const bpc = this.bpc; 52601 52602 if (bpc === 8) { 52603 return buffer; 52604 } 52605 52606 const width = this.width; 52607 const height = this.height; 52608 const numComps = this.numComps;
vendor: 4,208 bytes, lines 52609-52777
52609 const length = width * height * numComps; 52610 let bufferPos = 0; 52611 let output; 52612 52613 if (bpc <= 8) { 52614 output = new Uint8Array(length); 52615 } else if (bpc <= 16) { 52616 output = new Uint16Array(length); 52617 } else { 52618 output = new Uint32Array(length); 52619 } 52620 52621 const rowComps = width * numComps; 52622 const max = (1 << bpc) - 1; 52623 let i = 0, 52624 ii, 52625 buf; 52626 52627 if (bpc === 1) { 52628 let mask, loop1End, loop2End; 52629 52630 for (let j = 0; j < height; j++) { 52631 loop1End = i + (rowComps & ~7); 52632 loop2End = i + rowComps; 52633 52634 while (i < loop1End) { 52635 buf = buffer[bufferPos++]; 52636 output[i] = buf >> 7 & 1; 52637 output[i + 1] = buf >> 6 & 1; 52638 output[i + 2] = buf >> 5 & 1; 52639 output[i + 3] = buf >> 4 & 1; 52640 output[i + 4] = buf >> 3 & 1; 52641 output[i + 5] = buf >> 2 & 1; 52642 output[i + 6] = buf >> 1 & 1; 52643 output[i + 7] = buf & 1; 52644 i += 8; 52645 } 52646 52647 if (i < loop2End) { 52648 buf = buffer[bufferPos++]; 52649 mask = 128; 52650 52651 while (i < loop2End) { 52652 output[i++] = +!!(buf & mask); 52653 mask >>= 1; 52654 } 52655 } 52656 } 52657 } else { 52658 let bits = 0; 52659 buf = 0; 52660 52661 for (i = 0, ii = length; i < ii; ++i) { 52662 if (i % rowComps === 0) { 52663 buf = 0; 52664 bits = 0; 52665 } 52666 52667 while (bits < bpc) { 52668 buf = buf << 8 | buffer[bufferPos++]; 52669 bits += 8; 52670 } 52671 52672 const remainingBits = bits - bpc; 52673 let value = buf >> remainingBits; 52674 52675 if (value < 0) { 52676 value = 0; 52677 } else if (value > max) { 52678 value = max; 52679 } 52680 52681 output[i] = value; 52682 buf &= (1 << remainingBits) - 1; 52683 bits = remainingBits; 52684 } 52685 } 52686 52687 return output; 52688 } 52689 52690 fillOpacity(rgbaBuf, width, height, actualHeight, image) { 52691 const smask = this.smask; 52692 const mask = this.mask; 52693 let alphaBuf, sw, sh, i, ii, j; 52694 52695 if (smask) { 52696 sw = smask.width; 52697 sh = smask.height; 52698 alphaBuf = new Uint8ClampedArray(sw * sh); 52699 smask.fillGrayBuffer(alphaBuf); 52700 52701 if (sw !== width || sh !== height) { 52702 alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height); 52703 } 52704 } else if (mask) { 52705 if (mask instanceof PDFImage) { 52706 sw = mask.width; 52707 sh = mask.height; 52708 alphaBuf = new Uint8ClampedArray(sw * sh); 52709 mask.numComps = 1; 52710 mask.fillGrayBuffer(alphaBuf); 52711 52712 for (i = 0, ii = sw * sh; i < ii; ++i) { 52713 alphaBuf[i] = 255 - alphaBuf[i]; 52714 } 52715 52716 if (sw !== width || sh !== height) { 52717 alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height); 52718 } 52719 } else if (Array.isArray(mask)) { 52720 alphaBuf = new Uint8ClampedArray(width * height); 52721 const numComps = this.numComps; 52722 52723 for (i = 0, ii = width * height; i < ii; ++i) { 52724 let opacity = 0; 52725 const imageOffset = i * numComps; 52726 52727 for (j = 0; j < numComps; ++j) { 52728 const color = image[imageOffset + j]; 52729 const maskOffset = j * 2; 52730 52731 if (color < mask[maskOffset] || color > mask[maskOffset + 1]) { 52732 opacity = 255; 52733 break; 52734 } 52735 } 52736 52737 alphaBuf[i] = opacity; 52738 } 52739 } else { 52740 throw new _util.FormatError("Unknown mask format."); 52741 } 52742 } 52743 52744 if (alphaBuf) { 52745 for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { 52746 rgbaBuf[j] = alphaBuf[i]; 52747 } 52748 } else { 52749 for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { 52750 rgbaBuf[j] = 255; 52751 } 52752 } 52753 } 52754 52755 undoPreblend(buffer, width, height) { 52756 const matte = this.smask && this.smask.matte; 52757 52758 if (!matte) { 52759 return; 52760 } 52761 52762 const matteRgb = this.colorSpace.getRgb(matte, 0); 52763 const matteR = matteRgb[0]; 52764 const matteG = matteRgb[1]; 52765 const matteB = matteRgb[2]; 52766 const length = width * height * 4; 52767 52768 for (let i = 0; i < length; i += 4) { 52769 const alpha = buffer[i + 3]; 52770 52771 if (alpha === 0) { 52772 buffer[i] = 255; 52773 buffer[i + 1] = 255; 52774 buffer[i + 2] = 255; 52775 continue; 52776 } 52777
52778 const k = 255 / alpha; 52779 buffer[i] = (buffer[i] - matteR) * k + matteR; 52780 buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG; 52781 buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB; 52782 } 52783 } 52784 52785 createImageData(forceRGBA = false) { 52786 const drawWidth = this.drawWidth; 52787 const drawHeight = this.drawHeight; 52788 const imgData = { 52789 width: drawWidth, 52790 height: drawHeight, 52791 interpolate: this.interpolate, 52792 kind: 0, 52793 data: null 52794 }; 52795 const numComps = this.numComps; 52796 const originalWidth = this.width; 52797 const originalHeight = this.height; 52798 const bpc = this.bpc; 52799 const rowBytes = originalWidth * numComps * bpc + 7 >> 3; 52800 let imgArray; 52801 52802 if (!forceRGBA) { 52803 let kind; 52804 52805 if (this.colorSpace.name === "DeviceGray" && bpc === 1) { 52806 kind = _util.ImageKind.GRAYSCALE_1BPP; 52807 } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) { 52808 kind = _util.ImageKind.RGB_24BPP; 52809 } 52810 52811 if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) { 52812 imgData.kind = kind; 52813 imgArray = this.getImageBytes(originalHeight * rowBytes); 52814 52815 if (this.image instanceof _decode_stream.DecodeStream) { 52816 imgData.data = imgArray; 52817 } else { 52818 const newArray = new Uint8ClampedArray(imgArray.length); 52819 newArray.set(imgArray); 52820 imgData.data = newArray; 52821 } 52822 52823 if (this.needsDecode) { 52824 (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale."); 52825 const buffer = imgData.data; 52826 52827 for (let i = 0, ii = buffer.length; i < ii; i++) { 52828 buffer[i] ^= 0xff; 52829 } 52830 } 52831 52832 return imgData; 52833 } 52834 52835 if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) { 52836 let imageLength = originalHeight * rowBytes; 52837 52838 switch (this.colorSpace.name) { 52839 case "DeviceGray": 52840 imageLength *= 3; 52841 52842 case "DeviceRGB": 52843 case "DeviceCMYK": 52844 imgData.kind = _util.ImageKind.RGB_24BPP; 52845 imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true); 52846 return imgData; 52847 } 52848 } 52849 } 52850 52851 imgArray = this.getImageBytes(originalHeight * rowBytes); 52852 const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight; 52853 const comps = this.getComponents(imgArray); 52854 let alpha01, maybeUndoPreblend; 52855 52856 if (!forceRGBA && !this.smask && !this.mask) { 52857 imgData.kind = _util.ImageKind.RGB_24BPP; 52858 imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3); 52859 alpha01 = 0; 52860 maybeUndoPreblend = false; 52861 } else { 52862 imgData.kind = _util.ImageKind.RGBA_32BPP; 52863 imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4); 52864 alpha01 = 1; 52865 maybeUndoPreblend = true; 52866 this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps); 52867 } 52868 52869 if (this.needsDecode) { 52870 this.decodeBuffer(comps); 52871 } 52872 52873 this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01); 52874 52875 if (maybeUndoPreblend) { 52876 this.undoPreblend(imgData.data, drawWidth, actualHeight); 52877 } 52878 52879 return imgData; 52880 } 52881 52882 fillGrayBuffer(buffer) { 52883 const numComps = this.numComps; 52884 52885 if (numComps !== 1) { 52886 throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`); 52887 } 52888 52889 const width = this.width; 52890 const height = this.height; 52891 const bpc = this.bpc; 52892 const rowBytes = width * numComps * bpc + 7 >> 3; 52893 const imgArray = this.getImageBytes(height * rowBytes); 52894 const comps = this.getComponents(imgArray); 52895 let i, length; 52896 52897 if (bpc === 1) { 52898 length = width * height; 52899 52900 if (this.needsDecode) { 52901 for (i = 0; i < length; ++i) { 52902 buffer[i] = comps[i] - 1 & 255; 52903 } 52904 } else { 52905 for (i = 0; i < length; ++i) { 52906 buffer[i] = -comps[i] & 255; 52907 } 52908 } 52909 52910 return; 52911 } 52912 52913 if (this.needsDecode) { 52914 this.decodeBuffer(comps); 52915 } 52916 52917 length = width * height; 52918 const scale = 255 / ((1 << bpc) - 1); 52919 52920 for (i = 0; i < length; ++i) { 52921 buffer[i] = scale * comps[i]; 52922 } 52923 } 52924 52925 getImageBytes(length, drawWidth, drawHeight, forceRGB = false) { 52926 this.image.reset(); 52927 this.image.drawWidth = drawWidth || this.width; 52928 this.image.drawHeight = drawHeight || this.height; 52929 this.image.forceRGB = !!forceRGB; 52930 return this.image.getBytes(length, true); 52931 } 52932 52933} 52934 52935exports.PDFImage = PDFImage; 52936 52937/***/ }), 52938/* 64 */ 52939/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 52940 52941 52942 52943Object.defineProperty(exports, "__esModule", ({ 52944 value: true 52945})); 52946exports.Catalog = void 0; 52947 52948var _primitives = __w_pdfjs_require__(5); 52949 52950var _core_utils = __w_pdfjs_require__(9); 52951 52952var _util = __w_pdfjs_require__(2); 52953 52954var _name_number_tree = __w_pdfjs_require__(65); 52955 52956var _base_stream = __w_pdfjs_require__(6); 52957 52958var _colorspace = __w_pdfjs_require__(24); 52959 52960var _file_spec = __w_pdfjs_require__(66); 52961 52962var _image_utils = __w_pdfjs_require__(58); 52963 52964var _metadata_parser = __w_pdfjs_require__(67); 52965 52966var _struct_tree = __w_pdfjs_require__(69); 52967 52968function fetchDestination(dest) { 52969 if (dest instanceof _primitives.Dict) { 52970 dest = dest.get("D"); 52971 } 52972 52973 return Array.isArray(dest) ? dest : null; 52974} 52975 52976class Catalog { 52977 constructor(pdfManager, xref) { 52978 this.pdfManager = pdfManager; 52979 this.xref = xref; 52980 this._catDict = xref.getCatalogObj(); 52981 52982 if (!(this._catDict instanceof _primitives.Dict)) { 52983 throw new _util.FormatError("Catalog object is not a dictionary."); 52984 } 52985 52986 this.toplevelPagesDict; 52987 this._actualNumPages = null; 52988 this.fontCache = new _primitives.RefSetCache(); 52989 this.builtInCMapCache = new Map(); 52990 this.standardFontDataCache = new Map(); 52991 this.globalImageCache = new _image_utils.GlobalImageCache(); 52992 this.pageKidsCountCache = new _primitives.RefSetCache(); 52993 this.pageIndexCache = new _primitives.RefSetCache(); 52994 this.nonBlendModesSet = new _primitives.RefSet(); 52995 } 52996 52997 get version() { 52998 const version = this._catDict.get("Version"); 52999 53000 return (0, _util.shadow)(this, "version", version instanceof _primitives.Name ? version.name : null); 53001 } 53002 53003 get lang() { 53004 const lang = this._catDict.get("Lang"); 53005 53006 return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null); 53007 } 53008 53009 get needsRendering() { 53010 const needsRendering = this._catDict.get("NeedsRendering"); 53011 53012 return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false); 53013 } 53014 53015 get collection() {
53016 let collection = null; 53017 53018 try { 53019 const obj = this._catDict.get("Collection"); 53020 53021 if ((0, _primitives.isDict)(obj) && obj.size > 0) { 53022 collection = obj; 53023 } 53024 } catch (ex) { 53025 if (ex instanceof _core_utils.MissingDataException) { 53026 throw ex; 53027 } 53028 53029 (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present."); 53030 } 53031 53032 return (0, _util.shadow)(this, "collection", collection); 53033 } 53034 53035 get acroForm() { 53036 let acroForm = null; 53037 53038 try { 53039 const obj = this._catDict.get("AcroForm"); 53040 53041 if ((0, _primitives.isDict)(obj) && obj.size > 0) { 53042 acroForm = obj; 53043 } 53044 } catch (ex) { 53045 if (ex instanceof _core_utils.MissingDataException) { 53046 throw ex; 53047 } 53048 53049 (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present."); 53050 } 53051 53052 return (0, _util.shadow)(this, "acroForm", acroForm); 53053 } 53054 53055 get acroFormRef() { 53056 const value = this._catDict.getRaw("AcroForm"); 53057 53058 return (0, _util.shadow)(this, "acroFormRef", (0, _primitives.isRef)(value) ? value : null); 53059 } 53060 53061 get metadata() { 53062 const streamRef = this._catDict.getRaw("Metadata"); 53063 53064 if (!(streamRef instanceof _primitives.Ref)) { 53065 return (0, _util.shadow)(this, "metadata", null); 53066 } 53067 53068 let metadata = null; 53069 53070 try { 53071 const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata); 53072 const stream = this.xref.fetch(streamRef, suppressEncryption); 53073 53074 if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) { 53075 const type = stream.dict.get("Type"); 53076 const subtype = stream.dict.get("Subtype"); 53077 53078 if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) { 53079 const data = (0, _util.stringToUTF8String)(stream.getString()); 53080 53081 if (data) { 53082 metadata = new _metadata_parser.MetadataParser(data).serializable; 53083 } 53084 } 53085 } 53086 } catch (ex) { 53087 if (ex instanceof _core_utils.MissingDataException) { 53088 throw ex; 53089 } 53090 53091 (0, _util.info)(`Skipping invalid Metadata: "${ex}".`); 53092 } 53093 53094 return (0, _util.shadow)(this, "metadata", metadata); 53095 } 53096 53097 get markInfo() { 53098 let markInfo = null; 53099 53100 try { 53101 markInfo = this._readMarkInfo(); 53102 } catch (ex) { 53103 if (ex instanceof _core_utils.MissingDataException) { 53104 throw ex; 53105 } 53106 53107 (0, _util.warn)("Unable to read mark info."); 53108 } 53109 53110 return (0, _util.shadow)(this, "markInfo", markInfo); 53111 } 53112 53113 _readMarkInfo() { 53114 const obj = this._catDict.get("MarkInfo"); 53115 53116 if (!(0, _primitives.isDict)(obj)) { 53117 return null; 53118 } 53119 53120 const markInfo = Object.assign(Object.create(null), { 53121 Marked: false, 53122 UserProperties: false, 53123 Suspects: false 53124 }); 53125 53126 for (const key in markInfo) { 53127 if (!obj.has(key)) { 53128 continue; 53129 } 53130 53131 const value = obj.get(key); 53132 53133 if (!(0, _util.isBool)(value)) { 53134 continue; 53135 } 53136 53137 markInfo[key] = value; 53138 } 53139 53140 return markInfo; 53141 } 53142 53143 get structTreeRoot() { 53144 let structTree = null; 53145 53146 try { 53147 structTree = this._readStructTreeRoot(); 53148 } catch (ex) { 53149 if (ex instanceof _core_utils.MissingDataException) { 53150 throw ex; 53151 } 53152 53153 (0, _util.warn)("Unable read to structTreeRoot info."); 53154 } 53155 53156 return (0, _util.shadow)(this, "structTreeRoot", structTree); 53157 } 53158 53159 _readStructTreeRoot() { 53160 const obj = this._catDict.get("StructTreeRoot"); 53161 53162 if (!(0, _primitives.isDict)(obj)) { 53163 return null; 53164 } 53165 53166 const root = new _struct_tree.StructTreeRoot(obj); 53167 root.init(); 53168 return root; 53169 } 53170 53171 get toplevelPagesDict() { 53172 const pagesObj = this._catDict.get("Pages"); 53173 53174 if (!(0, _primitives.isDict)(pagesObj)) { 53175 throw new _util.FormatError("Invalid top-level pages dictionary."); 53176 } 53177 53178 return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj); 53179 } 53180 53181 get documentOutline() { 53182 let obj = null; 53183 53184 try { 53185 obj = this._readDocumentOutline(); 53186 } catch (ex) { 53187 if (ex instanceof _core_utils.MissingDataException) { 53188 throw ex; 53189 } 53190 53191 (0, _util.warn)("Unable to read document outline."); 53192 } 53193 53194 return (0, _util.shadow)(this, "documentOutline", obj); 53195 } 53196 53197 _readDocumentOutline() { 53198 let obj = this._catDict.get("Outlines"); 53199 53200 if (!(0, _primitives.isDict)(obj)) { 53201 return null; 53202 } 53203 53204 obj = obj.getRaw("First"); 53205 53206 if (!(0, _primitives.isRef)(obj)) { 53207 return null; 53208 } 53209 53210 const root = { 53211 items: [] 53212 }; 53213 const queue = [{ 53214 obj, 53215 parent: root 53216 }]; 53217 const processed = new _primitives.RefSet(); 53218 processed.put(obj); 53219 const xref = this.xref, 53220 blackColor = new Uint8ClampedArray(3); 53221 53222 while (queue.length > 0) { 53223 const i = queue.shift(); 53224 const outlineDict = xref.fetchIfRef(i.obj); 53225 53226 if (outlineDict === null) { 53227 continue; 53228 } 53229 53230 if (!outlineDict.has("Title")) { 53231 throw new _util.FormatError("Invalid outline item encountered."); 53232 } 53233 53234 const data = { 53235 url: null, 53236 dest: null 53237 }; 53238 Catalog.parseDestDictionary({ 53239 destDict: outlineDict, 53240 resultObj: data, 53241 docBaseUrl: this.pdfManager.docBaseUrl 53242 }); 53243 const title = outlineDict.get("Title"); 53244 const flags = outlineDict.get("F") || 0; 53245 const color = outlineDict.getArray("C"); 53246 const count = outlineDict.get("Count"); 53247 let rgbColor = blackColor; 53248 53249 if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) { 53250 rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0); 53251 } 53252 53253 const outlineItem = { 53254 dest: data.dest, 53255 url: data.url, 53256 unsafeUrl: data.unsafeUrl, 53257 newWindow: data.newWindow, 53258 title: (0, _util.stringToPDFString)(title), 53259 color: rgbColor, 53260 count: Number.isInteger(count) ? count : undefined, 53261 bold: !!(flags & 2), 53262 italic: !!(flags & 1), 53263 items: [] 53264 }; 53265 i.parent.items.push(outlineItem); 53266 obj = outlineDict.getRaw("First"); 53267 53268 if ((0, _primitives.isRef)(obj) && !processed.has(obj)) { 53269 queue.push({ 53270 obj, 53271 parent: outlineItem 53272 }); 53273 processed.put(obj); 53274 } 53275 53276 obj = outlineDict.getRaw("Next"); 53277 53278 if ((0, _primitives.isRef)(obj) && !processed.has(obj)) { 53279 queue.push({ 53280 obj, 53281 parent: i.parent 53282 }); 53283 processed.put(obj); 53284 } 53285 } 53286 53287 return root.items.length > 0 ? root.items : null; 53288 } 53289 53290 get permissions() { 53291 let permissions = null; 53292 53293 try { 53294 permissions = this._readPermissions(); 53295 } catch (ex) { 53296 if (ex instanceof _core_utils.MissingDataException) { 53297 throw ex; 53298 } 53299 53300 (0, _util.warn)("Unable to read permissions."); 53301 } 53302 53303 return (0, _util.shadow)(this, "permissions", permissions); 53304 } 53305 53306 _readPermissions() { 53307 const encrypt = this.xref.trailer.get("Encrypt"); 53308 53309 if (!(0, _primitives.isDict)(encrypt)) { 53310 return null; 53311 } 53312 53313 let flags = encrypt.get("P"); 53314 53315 if (!(0, _util.isNum)(flags)) { 53316 return null; 53317 } 53318 53319 flags += 2 ** 32; 53320 const permissions = []; 53321 53322 for (const key in _util.PermissionFlag) { 53323 const value = _util.PermissionFlag[key]; 53324 53325 if (flags & value) { 53326 permissions.push(value); 53327 } 53328 } 53329 53330 return permissions; 53331 } 53332 53333 get optionalContentConfig() {
53334 let config = null; 53335 53336 try { 53337 const properties = this._catDict.get("OCProperties"); 53338 53339 if (!properties) { 53340 return (0, _util.shadow)(this, "optionalContentConfig", null); 53341 } 53342 53343 const defaultConfig = properties.get("D"); 53344 53345 if (!defaultConfig) { 53346 return (0, _util.shadow)(this, "optionalContentConfig", null); 53347 } 53348 53349 const groupsData = properties.get("OCGs"); 53350 53351 if (!Array.isArray(groupsData)) { 53352 return (0, _util.shadow)(this, "optionalContentConfig", null); 53353 } 53354 53355 const groups = []; 53356 const groupRefs = []; 53357 53358 for (const groupRef of groupsData) { 53359 if (!(0, _primitives.isRef)(groupRef)) { 53360 continue; 53361 } 53362 53363 groupRefs.push(groupRef); 53364 const group = this.xref.fetchIfRef(groupRef); 53365 groups.push({ 53366 id: groupRef.toString(), 53367 name: (0, _util.isString)(group.get("Name")) ? (0, _util.stringToPDFString)(group.get("Name")) : null, 53368 intent: (0, _util.isString)(group.get("Intent")) ? (0, _util.stringToPDFString)(group.get("Intent")) : null 53369 }); 53370 } 53371 53372 config = this._readOptionalContentConfig(defaultConfig, groupRefs); 53373 config.groups = groups; 53374 } catch (ex) { 53375 if (ex instanceof _core_utils.MissingDataException) { 53376 throw ex; 53377 } 53378 53379 (0, _util.warn)(`Unable to read optional content config: ${ex}`); 53380 } 53381 53382 return (0, _util.shadow)(this, "optionalContentConfig", config); 53383 } 53384 53385 _readOptionalContentConfig(config, contentGroupRefs) { 53386 function parseOnOff(refs) { 53387 const onParsed = []; 53388 53389 if (Array.isArray(refs)) { 53390 for (const value of refs) { 53391 if (!(0, _primitives.isRef)(value)) { 53392 continue; 53393 } 53394 53395 if (contentGroupRefs.includes(value)) { 53396 onParsed.push(value.toString()); 53397 } 53398 } 53399 } 53400 53401 return onParsed; 53402 } 53403 53404 function parseOrder(refs, nestedLevels = 0) { 53405 if (!Array.isArray(refs)) { 53406 return null; 53407 } 53408 53409 const order = []; 53410 53411 for (const value of refs) { 53412 if ((0, _primitives.isRef)(value) && contentGroupRefs.includes(value)) { 53413 parsedOrderRefs.put(value); 53414 order.push(value.toString()); 53415 continue; 53416 } 53417 53418 const nestedOrder = parseNestedOrder(value, nestedLevels); 53419 53420 if (nestedOrder) { 53421 order.push(nestedOrder); 53422 } 53423 } 53424 53425 if (nestedLevels > 0) { 53426 return order; 53427 } 53428 53429 const hiddenGroups = []; 53430 53431 for (const groupRef of contentGroupRefs) { 53432 if (parsedOrderRefs.has(groupRef)) { 53433 continue; 53434 } 53435 53436 hiddenGroups.push(groupRef.toString()); 53437 } 53438 53439 if (hiddenGroups.length) { 53440 order.push({ 53441 name: null, 53442 order: hiddenGroups 53443 }); 53444 } 53445 53446 return order; 53447 } 53448 53449 function parseNestedOrder(ref, nestedLevels) { 53450 if (++nestedLevels > MAX_NESTED_LEVELS) { 53451 (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS."); 53452 return null; 53453 } 53454 53455 const value = xref.fetchIfRef(ref); 53456 53457 if (!Array.isArray(value)) { 53458 return null; 53459 } 53460 53461 const nestedName = xref.fetchIfRef(value[0]); 53462 53463 if (typeof nestedName !== "string") { 53464 return null; 53465 } 53466 53467 const nestedOrder = parseOrder(value.slice(1), nestedLevels); 53468 53469 if (!nestedOrder || !nestedOrder.length) { 53470 return null; 53471 } 53472 53473 return { 53474 name: (0, _util.stringToPDFString)(nestedName), 53475 order: nestedOrder 53476 }; 53477 } 53478 53479 const xref = this.xref, 53480 parsedOrderRefs = new _primitives.RefSet(), 53481 MAX_NESTED_LEVELS = 10; 53482 return { 53483 name: (0, _util.isString)(config.get("Name")) ? (0, _util.stringToPDFString)(config.get("Name")) : null, 53484 creator: (0, _util.isString)(config.get("Creator")) ? (0, _util.stringToPDFString)(config.get("Creator")) : null, 53485 baseState: (0, _primitives.isName)(config.get("BaseState")) ? config.get("BaseState").name : null, 53486 on: parseOnOff(config.get("ON")), 53487 off: parseOnOff(config.get("OFF")), 53488 order: parseOrder(config.get("Order")), 53489 groups: null 53490 }; 53491 } 53492 53493 setActualNumPages(num = null) { 53494 this._actualNumPages = num; 53495 } 53496 53497 get hasActualNumPages() { 53498 return this._actualNumPages !== null; 53499 } 53500 53501 get _pagesCount() { 53502 const obj = this.toplevelPagesDict.get("Count"); 53503 53504 if (!Number.isInteger(obj)) { 53505 throw new _util.FormatError("Page count in top-level pages dictionary is not an integer."); 53506 } 53507 53508 return (0, _util.shadow)(this, "_pagesCount", obj); 53509 } 53510 53511 get numPages() { 53512 return this.hasActualNumPages ? this._actualNumPages : this._pagesCount; 53513 } 53514 53515 get destinations() { 53516 const obj = this._readDests(), 53517 dests = Object.create(null); 53518 53519 if (obj instanceof _name_number_tree.NameTree) { 53520 for (const [key, value] of obj.getAll()) { 53521 const dest = fetchDestination(value); 53522 53523 if (dest) { 53524 dests[key] = dest; 53525 } 53526 } 53527 } else if (obj instanceof _primitives.Dict) {
53528 obj.forEach(function (key, value) { 53529 const dest = fetchDestination(value); 53530 53531 if (dest) { 53532 dests[key] = dest; 53533 } 53534 }); 53535 } 53536 53537 return (0, _util.shadow)(this, "destinations", dests); 53538 } 53539 53540 getDestination(id) { 53541 const obj = this._readDests(); 53542 53543 if (obj instanceof _name_number_tree.NameTree) { 53544 const dest = fetchDestination(obj.get(id)); 53545 53546 if (dest) { 53547 return dest; 53548 } 53549 53550 const allDest = this.destinations[id]; 53551 53552 if (allDest) { 53553 (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`); 53554 return allDest; 53555 } 53556 } else if (obj instanceof _primitives.Dict) { 53557 const dest = fetchDestination(obj.get(id)); 53558 53559 if (dest) { 53560 return dest; 53561 } 53562 } 53563 53564 return null; 53565 } 53566 53567 _readDests() { 53568 const obj = this._catDict.get("Names"); 53569 53570 if (obj && obj.has("Dests")) { 53571 return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref); 53572 } else if (this._catDict.has("Dests")) { 53573 return this._catDict.get("Dests"); 53574 } 53575 53576 return undefined; 53577 } 53578 53579 get pageLabels() { 53580 let obj = null; 53581 53582 try { 53583 obj = this._readPageLabels(); 53584 } catch (ex) { 53585 if (ex instanceof _core_utils.MissingDataException) { 53586 throw ex; 53587 } 53588 53589 (0, _util.warn)("Unable to read page labels."); 53590 } 53591 53592 return (0, _util.shadow)(this, "pageLabels", obj); 53593 } 53594 53595 _readPageLabels() { 53596 const obj = this._catDict.getRaw("PageLabels"); 53597 53598 if (!obj) { 53599 return null; 53600 } 53601 53602 const pageLabels = new Array(this.numPages); 53603 let style = null, 53604 prefix = ""; 53605 const numberTree = new _name_number_tree.NumberTree(obj, this.xref); 53606 const nums = numberTree.getAll(); 53607 let currentLabel = "", 53608 currentIndex = 1; 53609 53610 for (let i = 0, ii = this.numPages; i < ii; i++) { 53611 const labelDict = nums.get(i); 53612 53613 if (labelDict !== undefined) { 53614 if (!(0, _primitives.isDict)(labelDict)) { 53615 throw new _util.FormatError("PageLabel is not a dictionary."); 53616 } 53617 53618 if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) { 53619 throw new _util.FormatError("Invalid type in PageLabel dictionary."); 53620 } 53621 53622 if (labelDict.has("S")) { 53623 const s = labelDict.get("S"); 53624 53625 if (!(0, _primitives.isName)(s)) { 53626 throw new _util.FormatError("Invalid style in PageLabel dictionary."); 53627 } 53628 53629 style = s.name; 53630 } else { 53631 style = null; 53632 } 53633 53634 if (labelDict.has("P")) { 53635 const p = labelDict.get("P"); 53636 53637 if (!(0, _util.isString)(p)) { 53638 throw new _util.FormatError("Invalid prefix in PageLabel dictionary."); 53639 } 53640 53641 prefix = (0, _util.stringToPDFString)(p); 53642 } else { 53643 prefix = ""; 53644 } 53645 53646 if (labelDict.has("St")) { 53647 const st = labelDict.get("St"); 53648 53649 if (!(Number.isInteger(st) && st >= 1)) { 53650 throw new _util.FormatError("Invalid start in PageLabel dictionary."); 53651 } 53652 53653 currentIndex = st; 53654 } else { 53655 currentIndex = 1; 53656 } 53657 } 53658 53659 switch (style) { 53660 case "D": 53661 currentLabel = currentIndex; 53662 break; 53663 53664 case "R": 53665 case "r": 53666 currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r"); 53667 break; 53668 53669 case "A": 53670 case "a": 53671 const LIMIT = 26; 53672 const A_UPPER_CASE = 0x41, 53673 A_LOWER_CASE = 0x61; 53674 const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE; 53675 const letterIndex = currentIndex - 1; 53676 const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT); 53677 const charBuf = []; 53678 53679 for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) { 53680 charBuf.push(character); 53681 } 53682 53683 currentLabel = charBuf.join(""); 53684 break; 53685 53686 default: 53687 if (style) { 53688 throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`); 53689 } 53690 53691 currentLabel = ""; 53692 } 53693 53694 pageLabels[i] = prefix + currentLabel; 53695 currentIndex++; 53696 } 53697 53698 return pageLabels; 53699 } 53700 53701 get pageLayout() { 53702 const obj = this._catDict.get("PageLayout"); 53703 53704 let pageLayout = ""; 53705 53706 if ((0, _primitives.isName)(obj)) { 53707 switch (obj.name) { 53708 case "SinglePage": 53709 case "OneColumn": 53710 case "TwoColumnLeft": 53711 case "TwoColumnRight": 53712 case "TwoPageLeft": 53713 case "TwoPageRight": 53714 pageLayout = obj.name; 53715 } 53716 } 53717 53718 return (0, _util.shadow)(this, "pageLayout", pageLayout); 53719 } 53720 53721 get pageMode() { 53722 const obj = this._catDict.get("PageMode"); 53723 53724 let pageMode = "UseNone"; 53725 53726 if ((0, _primitives.isName)(obj)) { 53727 switch (obj.name) { 53728 case "UseNone": 53729 case "UseOutlines": 53730 case "UseThumbs": 53731 case "FullScreen": 53732 case "UseOC": 53733 case "UseAttachments": 53734 pageMode = obj.name; 53735 } 53736 } 53737 53738 return (0, _util.shadow)(this, "pageMode", pageMode); 53739 } 53740 53741 get viewerPreferences() { 53742 const ViewerPreferencesValidators = { 53743 HideToolbar: _util.isBool, 53744 HideMenubar: _util.isBool, 53745 HideWindowUI: _util.isBool, 53746 FitWindow: _util.isBool, 53747 CenterWindow: _util.isBool, 53748 DisplayDocTitle: _util.isBool, 53749 NonFullScreenPageMode: _primitives.isName, 53750 Direction: _primitives.isName, 53751 ViewArea: _primitives.isName, 53752 ViewClip: _primitives.isName, 53753 PrintArea: _primitives.isName, 53754 PrintClip: _primitives.isName, 53755 PrintScaling: _primitives.isName, 53756 Duplex: _primitives.isName, 53757 PickTrayByPDFSize: _util.isBool, 53758 PrintPageRange: Array.isArray, 53759 NumCopies: Number.isInteger 53760 }; 53761 53762 const obj = this._catDict.get("ViewerPreferences"); 53763 53764 let prefs = null; 53765 53766 if ((0, _primitives.isDict)(obj)) { 53767 for (const key in ViewerPreferencesValidators) { 53768 if (!obj.has(key)) { 53769 continue; 53770 } 53771 53772 const value = obj.get(key); 53773 53774 if (!ViewerPreferencesValidators[key](value)) { 53775 (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`); 53776 continue; 53777 } 53778 53779 let prefValue; 53780 53781 switch (key) { 53782 case "NonFullScreenPageMode": 53783 switch (value.name) { 53784 case "UseNone": 53785 case "UseOutlines": 53786 case "UseThumbs": 53787 case "UseOC": 53788 prefValue = value.name; 53789 break; 53790 53791 default: 53792 prefValue = "UseNone"; 53793 } 53794 53795 break; 53796 53797 case "Direction": 53798 switch (value.name) { 53799 case "L2R": 53800 case "R2L": 53801 prefValue = value.name; 53802 break; 53803 53804 default: 53805 prefValue = "L2R"; 53806 } 53807 53808 break; 53809 53810 case "ViewArea": 53811 case "ViewClip": 53812 case "PrintArea": 53813 case "PrintClip": 53814 switch (value.name) { 53815 case "MediaBox": 53816 case "CropBox": 53817 case "BleedBox": 53818 case "TrimBox": 53819 case "ArtBox": 53820 prefValue = value.name; 53821 break; 53822 53823 default: 53824 prefValue = "CropBox"; 53825 } 53826 53827 break; 53828 53829 case "PrintScaling": 53830 switch (value.name) { 53831 case "None": 53832 case "AppDefault": 53833 prefValue = value.name; 53834 break; 53835 53836 default: 53837 prefValue = "AppDefault"; 53838 } 53839 53840 break; 53841 53842 case "Duplex": 53843 switch (value.name) { 53844 case "Simplex": 53845 case "DuplexFlipShortEdge": 53846 case "DuplexFlipLongEdge": 53847 prefValue = value.name; 53848 break; 53849 53850 default: 53851 prefValue = "None"; 53852 } 53853 53854 break; 53855 53856 case "PrintPageRange": 53857 const length = value.length; 53858 53859 if (length % 2 !== 0) { 53860 break; 53861 } 53862 53863 const isValid = value.every((page, i, arr) => { 53864 return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages; 53865 }); 53866 53867 if (isValid) { 53868 prefValue = value; 53869 } 53870 53871 break; 53872 53873 case "NumCopies": 53874 if (value > 0) { 53875 prefValue = value; 53876 } 53877 53878 break; 53879 53880 default: 53881 if (typeof value !== "boolean") { 53882 throw new _util.FormatError(`viewerPreferences - expected a boolean value for: ${key}`); 53883 } 53884 53885 prefValue = value; 53886 } 53887 53888 if (prefValue !== undefined) { 53889 if (!prefs) { 53890 prefs = Object.create(null); 53891 } 53892 53893 prefs[key] = prefValue; 53894 } else { 53895 (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`); 53896 } 53897 } 53898 } 53899 53900 return (0, _util.shadow)(this, "viewerPreferences", prefs); 53901 } 53902 53903 get openAction() { 53904 const obj = this._catDict.get("OpenAction"); 53905 53906 const openAction = Object.create(null); 53907 53908 if ((0, _primitives.isDict)(obj)) { 53909 const destDict = new _primitives.Dict(this.xref); 53910 destDict.set("A", obj); 53911 const resultObj = { 53912 url: null, 53913 dest: null, 53914 action: null 53915 }; 53916 Catalog.parseDestDictionary({ 53917 destDict, 53918 resultObj 53919 }); 53920 53921 if (Array.isArray(resultObj.dest)) { 53922 openAction.dest = resultObj.dest; 53923 } else if (resultObj.action) { 53924 openAction.action = resultObj.action; 53925 } 53926 } else if (Array.isArray(obj)) { 53927 openAction.dest = obj; 53928 } 53929 53930 return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null); 53931 } 53932 53933 get attachments() { 53934 const obj = this._catDict.get("Names"); 53935 53936 let attachments = null; 53937 53938 if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) { 53939 const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref); 53940 53941 for (const [key, value] of nameTree.getAll()) { 53942 const fs = new _file_spec.FileSpec(value, this.xref); 53943 53944 if (!attachments) { 53945 attachments = Object.create(null); 53946 } 53947 53948 attachments[(0, _util.stringToPDFString)(key)] = fs.serializable; 53949 } 53950 } 53951 53952 return (0, _util.shadow)(this, "attachments", attachments); 53953 } 53954 53955 get xfaImages() { 53956 const obj = this._catDict.get("Names"); 53957 53958 let xfaImages = null; 53959 53960 if (obj instanceof _primitives.Dict && obj.has("XFAImages")) { 53961 const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref); 53962 53963 for (const [key, value] of nameTree.getAll()) { 53964 if (!xfaImages) { 53965 xfaImages = new _primitives.Dict(this.xref); 53966 } 53967 53968 xfaImages.set(key, value); 53969 } 53970 } 53971 53972 return (0, _util.shadow)(this, "xfaImages", xfaImages); 53973 } 53974 53975 _collectJavaScript() { 53976 const obj = this._catDict.get("Names"); 53977 53978 let javaScript = null; 53979 53980 function appendIfJavaScriptDict(name, jsDict) { 53981 if (!(jsDict instanceof _primitives.Dict)) { 53982 return; 53983 } 53984 53985 if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) { 53986 return; 53987 } 53988 53989 let js = jsDict.get("JS"); 53990 53991 if ((0, _primitives.isStream)(js)) { 53992 js = js.getString(); 53993 } else if (typeof js !== "string") { 53994 return; 53995 } 53996 53997 if (javaScript === null) { 53998 javaScript = new Map(); 53999 } 54000 54001 javaScript.set(name, (0, _util.stringToPDFString)(js)); 54002 } 54003 54004 if (obj instanceof _primitives.Dict && obj.has("JavaScript")) { 54005 const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref); 54006 54007 for (const [key, value] of nameTree.getAll()) { 54008 appendIfJavaScriptDict(key, value); 54009 } 54010 } 54011 54012 const openAction = this._catDict.get("OpenAction"); 54013 54014 if (openAction) { 54015 appendIfJavaScriptDict("OpenAction", openAction); 54016 } 54017 54018 return javaScript; 54019 } 54020 54021 get javaScript() { 54022 const javaScript = this._collectJavaScript(); 54023 54024 return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null); 54025 } 54026 54027 get jsActions() { 54028 const javaScript = this._collectJavaScript(); 54029 54030 let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType); 54031 54032 if (javaScript) { 54033 if (!actions) { 54034 actions = Object.create(null); 54035 } 54036 54037 for (const [key, val] of javaScript) { 54038 if (key in actions) { 54039 actions[key].push(val); 54040 } else { 54041 actions[key] = [val]; 54042 } 54043 } 54044 } 54045 54046 return (0, _util.shadow)(this, "jsActions", actions); 54047 } 54048 54049 fontFallback(id, handler) { 54050 const promises = []; 54051 this.fontCache.forEach(function (promise) { 54052 promises.push(promise); 54053 }); 54054 return Promise.all(promises).then(translatedFonts => { 54055 for (const translatedFont of translatedFonts) { 54056 if (translatedFont.loadedName === id) { 54057 translatedFont.fallback(handler); 54058 return; 54059 } 54060 } 54061 }); 54062 } 54063 54064 cleanup(manuallyTriggered = false) { 54065 (0, _primitives.clearPrimitiveCaches)(); 54066 this.globalImageCache.clear(manuallyTriggered); 54067 this.pageKidsCountCache.clear(); 54068 this.pageIndexCache.clear(); 54069 this.nonBlendModesSet.clear(); 54070 const promises = []; 54071 this.fontCache.forEach(function (promise) { 54072 promises.push(promise); 54073 }); 54074 return Promise.all(promises).then(translatedFonts => { 54075 for (const { 54076 dict 54077 } of translatedFonts) { 54078 delete dict.cacheKey; 54079 } 54080 54081 this.fontCache.clear(); 54082 this.builtInCMapCache.clear(); 54083 this.standardFontDataCache.clear(); 54084 }); 54085 } 54086 54087 getPageDict(pageIndex) { 54088 const capability = (0, _util.createPromiseCapability)(); 54089 const nodesToVisit = [this.toplevelPagesDict]; 54090 const visitedNodes = new _primitives.RefSet(); 54091 54092 const pagesRef = this._catDict.getRaw("Pages"); 54093 54094 if (pagesRef instanceof _primitives.Ref) { 54095 visitedNodes.put(pagesRef); 54096 } 54097 54098 const xref = this.xref, 54099 pageKidsCountCache = this.pageKidsCountCache;
54100 let currentPageIndex = 0; 54101 54102 function next() { 54103 while (nodesToVisit.length) { 54104 const currentNode = nodesToVisit.pop(); 54105 54106 if (currentNode instanceof _primitives.Ref) { 54107 const count = pageKidsCountCache.get(currentNode); 54108 54109 if (count >= 0 && currentPageIndex + count <= pageIndex) { 54110 currentPageIndex += count; 54111 continue; 54112 } 54113 54114 if (visitedNodes.has(currentNode)) { 54115 capability.reject(new _util.FormatError("Pages tree contains circular reference.")); 54116 return; 54117 } 54118 54119 visitedNodes.put(currentNode); 54120 xref.fetchAsync(currentNode).then(function (obj) { 54121 if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) { 54122 if (currentNode && !pageKidsCountCache.has(currentNode)) { 54123 pageKidsCountCache.put(currentNode, 1); 54124 } 54125 54126 if (pageIndex === currentPageIndex) { 54127 capability.resolve([obj, currentNode]); 54128 } else { 54129 currentPageIndex++; 54130 next(); 54131 } 54132 54133 return; 54134 } 54135 54136 nodesToVisit.push(obj); 54137 next(); 54138 }, capability.reject); 54139 return; 54140 } 54141 54142 if (!(currentNode instanceof _primitives.Dict)) { 54143 capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object.")); 54144 return; 54145 } 54146 54147 let count; 54148 54149 try { 54150 count = currentNode.get("Count"); 54151 } catch (ex) { 54152 if (ex instanceof _core_utils.MissingDataException) { 54153 throw ex; 54154 } 54155 } 54156 54157 if (Number.isInteger(count) && count >= 0) { 54158 const objId = currentNode.objId; 54159 54160 if (objId && !pageKidsCountCache.has(objId)) { 54161 pageKidsCountCache.put(objId, count); 54162 } 54163 54164 if (currentPageIndex + count <= pageIndex) { 54165 currentPageIndex += count; 54166 continue; 54167 } 54168 } 54169 54170 let kids; 54171 54172 try { 54173 kids = currentNode.get("Kids"); 54174 } catch (ex) { 54175 if (ex instanceof _core_utils.MissingDataException) { 54176 throw ex; 54177 } 54178 } 54179 54180 if (!Array.isArray(kids)) { 54181 let type; 54182 54183 try { 54184 type = currentNode.get("Type"); 54185 } catch (ex) { 54186 if (ex instanceof _core_utils.MissingDataException) { 54187 throw ex; 54188 } 54189 } 54190 54191 if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Type") && currentNode.has("Contents")) { 54192 if (currentPageIndex === pageIndex) { 54193 capability.resolve([currentNode, null]); 54194 return; 54195 } 54196 54197 currentPageIndex++; 54198 continue; 54199 } 54200 54201 capability.reject(new _util.FormatError("Page dictionary kids object is not an array.")); 54202 return; 54203 } 54204 54205 for (let last = kids.length - 1; last >= 0; last--) { 54206 nodesToVisit.push(kids[last]); 54207 } 54208 } 54209 54210 capability.reject(new Error(`Page index ${pageIndex} not found.`)); 54211 } 54212 54213 next(); 54214 return capability.promise; 54215 } 54216 54217 getAllPageDicts(recoveryMode = false) { 54218 const queue = [{ 54219 currentNode: this.toplevelPagesDict, 54220 posInKids: 0 54221 }]; 54222 const visitedNodes = new _primitives.RefSet(); 54223 54224 const pagesRef = this._catDict.getRaw("Pages"); 54225 54226 if (pagesRef instanceof _primitives.Ref) { 54227 visitedNodes.put(pagesRef); 54228 } 54229 54230 const map = new Map(); 54231 let pageIndex = 0; 54232 54233 function addPageDict(pageDict, pageRef) { 54234 map.set(pageIndex++, [pageDict, pageRef]); 54235 } 54236 54237 function addPageError(error) { 54238 map.set(pageIndex++, [error, null]); 54239 } 54240 54241 while (queue.length > 0) { 54242 const queueItem = queue[queue.length - 1]; 54243 const { 54244 currentNode, 54245 posInKids 54246 } = queueItem; 54247 let kids; 54248 54249 try { 54250 kids = currentNode.get("Kids"); 54251 } catch (ex) { 54252 if (ex instanceof _core_utils.MissingDataException) { 54253 throw ex; 54254 } 54255 54256 if (ex instanceof _core_utils.XRefEntryException && !recoveryMode) { 54257 throw ex; 54258 } 54259 54260 addPageError(ex); 54261 break; 54262 } 54263 54264 if (!Array.isArray(kids)) { 54265 addPageError(new _util.FormatError("Page dictionary kids object is not an array.")); 54266 break; 54267 } 54268 54269 if (posInKids >= kids.length) { 54270 queue.pop(); 54271 continue; 54272 } 54273
54274 const kidObj = kids[posInKids]; 54275 let obj; 54276 54277 if (kidObj instanceof _primitives.Ref) { 54278 try { 54279 obj = this.xref.fetch(kidObj); 54280 } catch (ex) { 54281 if (ex instanceof _core_utils.MissingDataException) { 54282 throw ex; 54283 } 54284 54285 if (ex instanceof _core_utils.XRefEntryException && !recoveryMode) { 54286 throw ex; 54287 } 54288 54289 addPageError(ex); 54290 break; 54291 } 54292 54293 if (visitedNodes.has(kidObj)) { 54294 addPageError(new _util.FormatError("Pages tree contains circular reference.")); 54295 break; 54296 } 54297 54298 visitedNodes.put(kidObj); 54299 } else { 54300 obj = kidObj; 54301 } 54302 54303 if (!(obj instanceof _primitives.Dict)) { 54304 addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object.")); 54305 break; 54306 } 54307 54308 if ((0, _primitives.isDict)(obj, "Page") || !obj.has("Kids")) { 54309 addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null); 54310 } else { 54311 queue.push({ 54312 currentNode: obj, 54313 posInKids: 0 54314 }); 54315 } 54316 54317 queueItem.posInKids++; 54318 } 54319 54320 return map; 54321 } 54322 54323 getPageIndex(pageRef) { 54324 const cachedPageIndex = this.pageIndexCache.get(pageRef); 54325 54326 if (cachedPageIndex !== undefined) { 54327 return Promise.resolve(cachedPageIndex); 54328 } 54329 54330 const xref = this.xref; 54331 54332 function pagesBeforeRef(kidRef) { 54333 let total = 0, 54334 parentRef; 54335 return xref.fetchAsync(kidRef).then(function (node) { 54336 if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) { 54337 throw new _util.FormatError("The reference does not point to a /Page dictionary."); 54338 } 54339 54340 if (!node) { 54341 return null; 54342 } 54343 54344 if (!(0, _primitives.isDict)(node)) { 54345 throw new _util.FormatError("Node must be a dictionary."); 54346 } 54347 54348 parentRef = node.getRaw("Parent"); 54349 return node.getAsync("Parent"); 54350 }).then(function (parent) { 54351 if (!parent) { 54352 return null; 54353 } 54354 54355 if (!(0, _primitives.isDict)(parent)) { 54356 throw new _util.FormatError("Parent must be a dictionary."); 54357 } 54358 54359 return parent.getAsync("Kids"); 54360 }).then(function (kids) { 54361 if (!kids) { 54362 return null; 54363 } 54364 54365 const kidPromises = []; 54366 let found = false; 54367 54368 for (let i = 0, ii = kids.length; i < ii; i++) { 54369 const kid = kids[i]; 54370 54371 if (!(0, _primitives.isRef)(kid)) { 54372 throw new _util.FormatError("Kid must be a reference."); 54373 } 54374 54375 if ((0, _primitives.isRefsEqual)(kid, kidRef)) { 54376 found = true; 54377 break; 54378 } 54379 54380 kidPromises.push(xref.fetchAsync(kid).then(function (obj) { 54381 if (!(0, _primitives.isDict)(obj)) { 54382 throw new _util.FormatError("Kid node must be a dictionary."); 54383 } 54384 54385 if (obj.has("Count")) { 54386 total += obj.get("Count"); 54387 } else { 54388 total++; 54389 } 54390 })); 54391 } 54392 54393 if (!found) { 54394 throw new _util.FormatError("Kid reference not found in parent's kids."); 54395 } 54396 54397 return Promise.all(kidPromises).then(function () { 54398 return [total, parentRef]; 54399 }); 54400 }); 54401 } 54402 54403 let total = 0; 54404 54405 const next = ref => pagesBeforeRef(ref).then(args => { 54406 if (!args) { 54407 this.pageIndexCache.put(pageRef, total); 54408 return total; 54409 } 54410 54411 const [count, parentRef] = args; 54412 total += count; 54413 return next(parentRef); 54414 }); 54415 54416 return next(pageRef); 54417 } 54418 54419 static parseDestDictionary(params) { 54420 const destDict = params.destDict; 54421 54422 if (!(0, _primitives.isDict)(destDict)) { 54423 (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary."); 54424 return; 54425 } 54426 54427 const resultObj = params.resultObj; 54428 54429 if (typeof resultObj !== "object") { 54430 (0, _util.warn)("parseDestDictionary: `resultObj` must be an object."); 54431 return; 54432 } 54433 54434 const docBaseUrl = params.docBaseUrl || null; 54435 let action = destDict.get("A"), 54436 url, 54437 dest; 54438 54439 if (!(0, _primitives.isDict)(action)) { 54440 if (destDict.has("Dest")) { 54441 action = destDict.get("Dest"); 54442 } else { 54443 action = destDict.get("AA"); 54444 54445 if ((0, _primitives.isDict)(action)) { 54446 if (action.has("D")) { 54447 action = action.get("D"); 54448 } else if (action.has("U")) { 54449 action = action.get("U"); 54450 } 54451 } 54452 } 54453 } 54454 54455 if ((0, _primitives.isDict)(action)) { 54456 const actionType = action.get("S"); 54457 54458 if (!(0, _primitives.isName)(actionType)) { 54459 (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary."); 54460 return; 54461 } 54462
54463 const actionName = actionType.name; 54464 54465 switch (actionName) { 54466 case "ResetForm": 54467 const flags = action.get("Flags"); 54468 const include = (((0, _util.isNum)(flags) ? flags : 0) & 1) === 0; 54469 const fields = []; 54470 const refs = []; 54471 54472 for (const obj of action.get("Fields") || []) { 54473 if ((0, _primitives.isRef)(obj)) { 54474 refs.push(obj.toString()); 54475 } else if ((0, _util.isString)(obj)) { 54476 fields.push((0, _util.stringToPDFString)(obj)); 54477 } 54478 } 54479 54480 resultObj.resetForm = { 54481 fields, 54482 refs, 54483 include 54484 }; 54485 break; 54486 54487 case "URI": 54488 url = action.get("URI"); 54489 54490 if (url instanceof _primitives.Name) { 54491 url = "/" + url.name; 54492 } 54493 54494 break; 54495 54496 case "GoTo": 54497 dest = action.get("D"); 54498 break; 54499 54500 case "Launch": 54501 case "GoToR": 54502 const urlDict = action.get("F"); 54503 54504 if ((0, _primitives.isDict)(urlDict)) { 54505 url = urlDict.get("F") || null; 54506 } else if ((0, _util.isString)(urlDict)) { 54507 url = urlDict; 54508 } 54509 54510 let remoteDest = action.get("D"); 54511 54512 if (remoteDest) { 54513 if ((0, _primitives.isName)(remoteDest)) { 54514 remoteDest = remoteDest.name; 54515 } 54516 54517 if ((0, _util.isString)(url)) { 54518 const baseUrl = url.split("#")[0]; 54519 54520 if ((0, _util.isString)(remoteDest)) { 54521 url = baseUrl + "#" + remoteDest; 54522 } else if (Array.isArray(remoteDest)) { 54523 url = baseUrl + "#" + JSON.stringify(remoteDest); 54524 } 54525 } 54526 } 54527 54528 const newWindow = action.get("NewWindow"); 54529 54530 if ((0, _util.isBool)(newWindow)) { 54531 resultObj.newWindow = newWindow; 54532 } 54533 54534 break; 54535 54536 case "Named": 54537 const namedAction = action.get("N"); 54538 54539 if ((0, _primitives.isName)(namedAction)) { 54540 resultObj.action = namedAction.name; 54541 } 54542 54543 break; 54544 54545 case "JavaScript": 54546 const jsAction = action.get("JS"); 54547 let js; 54548 54549 if ((0, _primitives.isStream)(jsAction)) { 54550 js = jsAction.getString(); 54551 } else if ((0, _util.isString)(jsAction)) { 54552 js = jsAction; 54553 } 54554 54555 const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js)); 54556 54557 if (jsURL) { 54558 url = jsURL.url; 54559 resultObj.newWindow = jsURL.newWindow; 54560 break; 54561 } 54562 54563 default: 54564 if (actionName === "JavaScript" || actionName === "SubmitForm") { 54565 break; 54566 } 54567 54568 (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`); 54569 break; 54570 } 54571 } else if (destDict.has("Dest")) { 54572 dest = destDict.get("Dest"); 54573 } 54574 54575 if ((0, _util.isString)(url)) { 54576 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, { 54577 addDefaultProtocol: true, 54578 tryConvertEncoding: true 54579 }); 54580 54581 if (absoluteUrl) { 54582 resultObj.url = absoluteUrl.href; 54583 } 54584 54585 resultObj.unsafeUrl = url; 54586 } 54587 54588 if (dest) { 54589 if ((0, _primitives.isName)(dest)) { 54590 dest = dest.name; 54591 } 54592 54593 if ((0, _util.isString)(dest) || Array.isArray(dest)) { 54594 resultObj.dest = dest; 54595 } 54596 } 54597 } 54598 54599} 54600 54601exports.Catalog = Catalog; 54602 54603/***/ }), 54604/* 65 */ 54605/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 54606 54607 54608 54609Object.defineProperty(exports, "__esModule", ({ 54610 value: true 54611})); 54612exports.NumberTree = exports.NameTree = void 0; 54613 54614var _util = __w_pdfjs_require__(2); 54615 54616var _primitives = __w_pdfjs_require__(5); 54617 54618class NameOrNumberTree { 54619 constructor(root, xref, type) { 54620 if (this.constructor === NameOrNumberTree) { 54621 (0, _util.unreachable)("Cannot initialize NameOrNumberTree."); 54622 } 54623 54624 this.root = root; 54625 this.xref = xref; 54626 this._type = type; 54627 } 54628 54629 getAll() { 54630 const map = new Map(); 54631 54632 if (!this.root) { 54633 return map; 54634 } 54635 54636 const xref = this.xref; 54637 const processed = new _primitives.RefSet(); 54638 processed.put(this.root); 54639 const queue = [this.root]; 54640 54641 while (queue.length > 0) { 54642 const obj = xref.fetchIfRef(queue.shift()); 54643 54644 if (!(0, _primitives.isDict)(obj)) { 54645 continue; 54646 } 54647 54648 if (obj.has("Kids")) {
54649 const kids = obj.get("Kids"); 54650 54651 for (let i = 0, ii = kids.length; i < ii; i++) { 54652 const kid = kids[i]; 54653 54654 if (processed.has(kid)) { 54655 throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`); 54656 } 54657 54658 queue.push(kid); 54659 processed.put(kid); 54660 } 54661 54662 continue; 54663 } 54664 54665 const entries = obj.get(this._type); 54666 54667 if (!Array.isArray(entries)) { 54668 continue; 54669 } 54670 54671 for (let i = 0, ii = entries.length; i < ii; i += 2) { 54672 map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1])); 54673 } 54674 } 54675 54676 return map; 54677 } 54678 54679 get(key) { 54680 if (!this.root) { 54681 return null; 54682 } 54683 54684 const xref = this.xref; 54685 let kidsOrEntries = xref.fetchIfRef(this.root); 54686 let loopCount = 0; 54687 const MAX_LEVELS = 10; 54688 54689 while (kidsOrEntries.has("Kids")) { 54690 if (++loopCount > MAX_LEVELS) { 54691 (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`); 54692 return null; 54693 } 54694 54695 const kids = kidsOrEntries.get("Kids"); 54696 54697 if (!Array.isArray(kids)) { 54698 return null; 54699 } 54700 54701 let l = 0, 54702 r = kids.length - 1; 54703 54704 while (l <= r) { 54705 const m = l + r >> 1; 54706 const kid = xref.fetchIfRef(kids[m]); 54707 const limits = kid.get("Limits"); 54708 54709 if (key < xref.fetchIfRef(limits[0])) { 54710 r = m - 1; 54711 } else if (key > xref.fetchIfRef(limits[1])) { 54712 l = m + 1; 54713 } else { 54714 kidsOrEntries = xref.fetchIfRef(kids[m]); 54715 break; 54716 } 54717 } 54718 54719 if (l > r) { 54720 return null; 54721 } 54722 } 54723 54724 const entries = kidsOrEntries.get(this._type); 54725 54726 if (Array.isArray(entries)) { 54727 let l = 0, 54728 r = entries.length - 2; 54729 54730 while (l <= r) { 54731 const tmp = l + r >> 1, 54732 m = tmp + (tmp & 1); 54733 const currentKey = xref.fetchIfRef(entries[m]); 54734 54735 if (key < currentKey) { 54736 r = m - 2; 54737 } else if (key > currentKey) { 54738 l = m + 2; 54739 } else { 54740 return xref.fetchIfRef(entries[m + 1]); 54741 } 54742 } 54743 } 54744 54745 return null; 54746 } 54747 54748} 54749 54750class NameTree extends NameOrNumberTree { 54751 constructor(root, xref) { 54752 super(root, xref, "Names"); 54753 } 54754 54755} 54756 54757exports.NameTree = NameTree; 54758 54759class NumberTree extends NameOrNumberTree { 54760 constructor(root, xref) { 54761 super(root, xref, "Nums"); 54762 } 54763 54764} 54765 54766exports.NumberTree = NumberTree; 54767 54768/***/ }), 54769/* 66 */ 54770/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 54771 54772 54773 54774Object.defineProperty(exports, "__esModule", ({ 54775 value: true 54776})); 54777exports.FileSpec = void 0; 54778 54779var _primitives = __w_pdfjs_require__(5); 54780 54781var _util = __w_pdfjs_require__(2); 54782 54783function pickPlatformItem(dict) { 54784 if (dict.has("UF")) { 54785 return dict.get("UF"); 54786 } else if (dict.has("F")) { 54787 return dict.get("F"); 54788 } else if (dict.has("Unix")) { 54789 return dict.get("Unix"); 54790 } else if (dict.has("Mac")) { 54791 return dict.get("Mac"); 54792 } else if (dict.has("DOS")) { 54793 return dict.get("DOS"); 54794 } 54795 54796 return null; 54797} 54798 54799class FileSpec { 54800 constructor(root, xref) { 54801 if (!root || !(0, _primitives.isDict)(root)) { 54802 return; 54803 } 54804 54805 this.xref = xref; 54806 this.root = root; 54807 54808 if (root.has("FS")) { 54809 this.fs = root.get("FS"); 54810 } 54811 54812 this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : ""; 54813 54814 if (root.has("RF")) { 54815 (0, _util.warn)("Related file specifications are not supported"); 54816 } 54817 54818 this.contentAvailable = true; 54819 54820 if (!root.has("EF")) { 54821 this.contentAvailable = false; 54822 (0, _util.warn)("Non-embedded file specifications are not supported"); 54823 } 54824 } 54825 54826 get filename() { 54827 if (!this._filename && this.root) { 54828 const filename = pickPlatformItem(this.root) || "unnamed"; 54829 this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/"); 54830 } 54831 54832 return this._filename; 54833 } 54834 54835 get content() { 54836 if (!this.contentAvailable) { 54837 return null; 54838 } 54839 54840 if (!this.contentRef && this.root) { 54841 this.contentRef = pickPlatformItem(this.root.get("EF")); 54842 } 54843
54844 let content = null; 54845 54846 if (this.contentRef) { 54847 const fileObj = this.xref.fetchIfRef(this.contentRef); 54848 54849 if (fileObj && (0, _primitives.isStream)(fileObj)) { 54850 content = fileObj.getBytes(); 54851 } else { 54852 (0, _util.warn)("Embedded file specification points to non-existing/invalid content"); 54853 } 54854 } else { 54855 (0, _util.warn)("Embedded file specification does not have a content"); 54856 } 54857 54858 return content; 54859 } 54860 54861 get serializable() { 54862 return { 54863 filename: this.filename, 54864 content: this.content 54865 }; 54866 } 54867 54868} 54869 54870exports.FileSpec = FileSpec; 54871 54872/***/ }), 54873/* 67 */ 54874/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 54875 54876 54877 54878Object.defineProperty(exports, "__esModule", ({ 54879 value: true 54880})); 54881exports.MetadataParser = void 0; 54882 54883var _xml_parser = __w_pdfjs_require__(68); 54884 54885class MetadataParser { 54886 constructor(data) { 54887 data = this._repair(data); 54888 const parser = new _xml_parser.SimpleXMLParser({ 54889 lowerCaseName: true 54890 }); 54891 const xmlDocument = parser.parseFromString(data); 54892 this._metadataMap = new Map(); 54893 this._data = data; 54894 54895 if (xmlDocument) { 54896 this._parse(xmlDocument); 54897 } 54898 } 54899 54900 _repair(data) { 54901 return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) { 54902 const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) { 54903 return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1); 54904 }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) { 54905 switch (name) { 54906 case "amp": 54907 return "&"; 54908 54909 case "apos": 54910 return "'"; 54911 54912 case "gt": 54913 return ">"; 54914 54915 case "lt": 54916 return "<"; 54917 54918 case "quot": 54919 return '"'; 54920 } 54921 54922 throw new Error(`_repair: ${name} isn't defined.`); 54923 }); 54924 const charBuf = []; 54925 54926 for (let i = 0, ii = bytes.length; i < ii; i += 2) { 54927 const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1); 54928 54929 if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) { 54930 charBuf.push(String.fromCharCode(code)); 54931 } else { 54932 charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";"); 54933 } 54934 } 54935 54936 return ">" + charBuf.join(""); 54937 }); 54938 } 54939 54940 _getSequence(entry) { 54941 const name = entry.nodeName; 54942 54943 if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") { 54944 return null; 54945 } 54946 54947 return entry.childNodes.filter(node => node.nodeName === "rdf:li"); 54948 } 54949 54950 _parseArray(entry) { 54951 if (!entry.hasChildNodes()) { 54952 return; 54953 } 54954 54955 const [seqNode] = entry.childNodes; 54956 const sequence = this._getSequence(seqNode) || []; 54957 54958 this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim())); 54959 } 54960 54961 _parse(xmlDocument) { 54962 let rdf = xmlDocument.documentElement; 54963 54964 if (rdf.nodeName !== "rdf:rdf") { 54965 rdf = rdf.firstChild; 54966 54967 while (rdf && rdf.nodeName !== "rdf:rdf") { 54968 rdf = rdf.nextSibling; 54969 } 54970 } 54971 54972 if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) { 54973 return; 54974 } 54975 54976 for (const desc of rdf.childNodes) { 54977 if (desc.nodeName !== "rdf:description") { 54978 continue; 54979 } 54980 54981 for (const entry of desc.childNodes) { 54982 const name = entry.nodeName; 54983 54984 switch (name) { 54985 case "#text": 54986 continue; 54987 54988 case "dc:creator": 54989 case "dc:subject": 54990 this._parseArray(entry); 54991 54992 continue; 54993 } 54994 54995 this._metadataMap.set(name, entry.textContent.trim()); 54996 } 54997 } 54998 } 54999 55000 get serializable() { 55001 return { 55002 parsedData: this._metadataMap, 55003 rawData: this._data 55004 }; 55005 } 55006 55007} 55008 55009exports.MetadataParser = MetadataParser; 55010 55011/***/ }), 55012/* 68 */ 55013/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 55014 55015 55016 55017Object.defineProperty(exports, "__esModule", ({ 55018 value: true 55019})); 55020exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0; 55021 55022var _core_utils = __w_pdfjs_require__(9); 55023 55024const XMLParserErrorCode = { 55025 NoError: 0, 55026 EndOfDocument: -1, 55027 UnterminatedCdat: -2, 55028 UnterminatedXmlDeclaration: -3, 55029 UnterminatedDoctypeDeclaration: -4, 55030 UnterminatedComment: -5, 55031 MalformedElement: -6, 55032 OutOfMemory: -7, 55033 UnterminatedAttributeValue: -8, 55034 UnterminatedElement: -9, 55035 ElementNeverBegun: -10 55036}; 55037exports.XMLParserErrorCode = XMLParserErrorCode; 55038 55039function isWhitespace(s, index) { 55040 const ch = s[index]; 55041 return ch === " " || ch === "\n" || ch === "\r" || ch === "\t"; 55042} 55043 55044function isWhitespaceString(s) { 55045 for (let i = 0, ii = s.length; i < ii; i++) { 55046 if (!isWhitespace(s, i)) { 55047 return false;
vendor: 9,438 bytes, lines 55048-55464
55048 } 55049 } 55050 55051 return true; 55052} 55053 55054class XMLParserBase { 55055 _resolveEntities(s) { 55056 return s.replace(/&([^;]+);/g, (all, entity) => { 55057 if (entity.substring(0, 2) === "#x") { 55058 return String.fromCodePoint(parseInt(entity.substring(2), 16)); 55059 } else if (entity.substring(0, 1) === "#") { 55060 return String.fromCodePoint(parseInt(entity.substring(1), 10)); 55061 } 55062 55063 switch (entity) { 55064 case "lt": 55065 return "<"; 55066 55067 case "gt": 55068 return ">"; 55069 55070 case "amp": 55071 return "&"; 55072 55073 case "quot": 55074 return '"'; 55075 55076 case "apos": 55077 return "'"; 55078 } 55079 55080 return this.onResolveEntity(entity); 55081 }); 55082 } 55083 55084 _parseContent(s, start) { 55085 const attributes = []; 55086 let pos = start; 55087 55088 function skipWs() { 55089 while (pos < s.length && isWhitespace(s, pos)) { 55090 ++pos; 55091 } 55092 } 55093 55094 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") { 55095 ++pos; 55096 } 55097 55098 const name = s.substring(start, pos); 55099 skipWs(); 55100 55101 while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") { 55102 skipWs(); 55103 let attrName = "", 55104 attrValue = ""; 55105 55106 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") { 55107 attrName += s[pos]; 55108 ++pos; 55109 } 55110 55111 skipWs(); 55112 55113 if (s[pos] !== "=") { 55114 return null; 55115 } 55116 55117 ++pos; 55118 skipWs(); 55119 const attrEndChar = s[pos]; 55120 55121 if (attrEndChar !== '"' && attrEndChar !== "'") { 55122 return null; 55123 } 55124 55125 const attrEndIndex = s.indexOf(attrEndChar, ++pos); 55126 55127 if (attrEndIndex < 0) { 55128 return null; 55129 } 55130 55131 attrValue = s.substring(pos, attrEndIndex); 55132 attributes.push({ 55133 name: attrName, 55134 value: this._resolveEntities(attrValue) 55135 }); 55136 pos = attrEndIndex + 1; 55137 skipWs(); 55138 } 55139 55140 return { 55141 name, 55142 attributes, 55143 parsed: pos - start 55144 }; 55145 } 55146 55147 _parseProcessingInstruction(s, start) { 55148 let pos = start; 55149 55150 function skipWs() { 55151 while (pos < s.length && isWhitespace(s, pos)) { 55152 ++pos; 55153 } 55154 } 55155 55156 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") { 55157 ++pos; 55158 } 55159 55160 const name = s.substring(start, pos); 55161 skipWs(); 55162 const attrStart = pos; 55163 55164 while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) { 55165 ++pos; 55166 } 55167 55168 const value = s.substring(attrStart, pos); 55169 return { 55170 name, 55171 value, 55172 parsed: pos - start 55173 }; 55174 } 55175 55176 parseXml(s) { 55177 let i = 0; 55178 55179 while (i < s.length) { 55180 const ch = s[i]; 55181 let j = i; 55182 55183 if (ch === "<") { 55184 ++j; 55185 const ch2 = s[j]; 55186 let q; 55187 55188 switch (ch2) { 55189 case "/": 55190 ++j; 55191 q = s.indexOf(">", j); 55192 55193 if (q < 0) { 55194 this.onError(XMLParserErrorCode.UnterminatedElement); 55195 return; 55196 } 55197 55198 this.onEndElement(s.substring(j, q)); 55199 j = q + 1; 55200 break; 55201 55202 case "?": 55203 ++j; 55204 55205 const pi = this._parseProcessingInstruction(s, j); 55206 55207 if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") { 55208 this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration); 55209 return; 55210 } 55211 55212 this.onPi(pi.name, pi.value); 55213 j += pi.parsed + 2; 55214 break; 55215 55216 case "!": 55217 if (s.substring(j + 1, j + 3) === "--") { 55218 q = s.indexOf("-->", j + 3); 55219 55220 if (q < 0) { 55221 this.onError(XMLParserErrorCode.UnterminatedComment); 55222 return; 55223 } 55224 55225 this.onComment(s.substring(j + 3, q)); 55226 j = q + 3; 55227 } else if (s.substring(j + 1, j + 8) === "[CDATA[") { 55228 q = s.indexOf("]]>", j + 8); 55229 55230 if (q < 0) { 55231 this.onError(XMLParserErrorCode.UnterminatedCdat); 55232 return; 55233 } 55234 55235 this.onCdata(s.substring(j + 8, q)); 55236 j = q + 3; 55237 } else if (s.substring(j + 1, j + 8) === "DOCTYPE") { 55238 const q2 = s.indexOf("[", j + 8); 55239 let complexDoctype = false; 55240 q = s.indexOf(">", j + 8); 55241 55242 if (q < 0) { 55243 this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); 55244 return; 55245 } 55246 55247 if (q2 > 0 && q > q2) { 55248 q = s.indexOf("]>", j + 8); 55249 55250 if (q < 0) { 55251 this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); 55252 return; 55253 } 55254 55255 complexDoctype = true; 55256 } 55257 55258 const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0)); 55259 this.onDoctype(doctypeContent); 55260 j = q + (complexDoctype ? 2 : 1); 55261 } else { 55262 this.onError(XMLParserErrorCode.MalformedElement); 55263 return; 55264 } 55265 55266 break; 55267 55268 default: 55269 const content = this._parseContent(s, j); 55270 55271 if (content === null) { 55272 this.onError(XMLParserErrorCode.MalformedElement); 55273 return; 55274 } 55275 55276 let isClosed = false; 55277 55278 if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") { 55279 isClosed = true; 55280 } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") { 55281 this.onError(XMLParserErrorCode.UnterminatedElement); 55282 return; 55283 } 55284 55285 this.onBeginElement(content.name, content.attributes, isClosed); 55286 j += content.parsed + (isClosed ? 2 : 1); 55287 break; 55288 } 55289 } else { 55290 while (j < s.length && s[j] !== "<") { 55291 j++; 55292 } 55293 55294 const text = s.substring(i, j); 55295 this.onText(this._resolveEntities(text)); 55296 } 55297 55298 i = j; 55299 } 55300 } 55301 55302 onResolveEntity(name) { 55303 return `&${name};`; 55304 } 55305 55306 onPi(name, value) {} 55307 55308 onComment(text) {} 55309 55310 onCdata(text) {} 55311 55312 onDoctype(doctypeContent) {} 55313 55314 onText(text) {} 55315 55316 onBeginElement(name, attributes, isEmpty) {} 55317 55318 onEndElement(name) {} 55319 55320 onError(code) {} 55321 55322} 55323 55324exports.XMLParserBase = XMLParserBase; 55325 55326class SimpleDOMNode { 55327 constructor(nodeName, nodeValue) { 55328 this.nodeName = nodeName; 55329 this.nodeValue = nodeValue; 55330 Object.defineProperty(this, "parentNode", { 55331 value: null, 55332 writable: true 55333 }); 55334 } 55335 55336 get firstChild() { 55337 return this.childNodes && this.childNodes[0]; 55338 } 55339 55340 get nextSibling() { 55341 const childNodes = this.parentNode.childNodes; 55342 55343 if (!childNodes) { 55344 return undefined; 55345 } 55346 55347 const index = childNodes.indexOf(this); 55348 55349 if (index === -1) { 55350 return undefined; 55351 } 55352 55353 return childNodes[index + 1]; 55354 } 55355 55356 get textContent() { 55357 if (!this.childNodes) { 55358 return this.nodeValue || ""; 55359 } 55360 55361 return this.childNodes.map(function (child) { 55362 return child.textContent; 55363 }).join(""); 55364 } 55365 55366 hasChildNodes() { 55367 return this.childNodes && this.childNodes.length > 0; 55368 } 55369 55370 searchNode(paths, pos) { 55371 if (pos >= paths.length) { 55372 return this; 55373 } 55374 55375 const component = paths[pos]; 55376 const stack = []; 55377 let node = this; 55378 55379 while (true) { 55380 if (component.name === node.nodeName) { 55381 if (component.pos === 0) { 55382 const res = node.searchNode(paths, pos + 1); 55383 55384 if (res !== null) { 55385 return res; 55386 } 55387 } else if (stack.length === 0) { 55388 return null; 55389 } else { 55390 const [parent] = stack.pop(); 55391 let siblingPos = 0; 55392 55393 for (const child of parent.childNodes) { 55394 if (component.name === child.nodeName) { 55395 if (siblingPos === component.pos) { 55396 return child.searchNode(paths, pos + 1); 55397 } 55398 55399 siblingPos++; 55400 } 55401 } 55402 55403 return node.searchNode(paths, pos + 1); 55404 } 55405 } 55406 55407 if (node.childNodes && node.childNodes.length !== 0) { 55408 stack.push([node, 0]); 55409 node = node.childNodes[0]; 55410 } else if (stack.length === 0) { 55411 return null; 55412 } else { 55413 while (stack.length !== 0) { 55414 const [parent, currentPos] = stack.pop(); 55415 const newPos = currentPos + 1; 55416 55417 if (newPos < parent.childNodes.length) { 55418 stack.push([parent, newPos]); 55419 node = parent.childNodes[newPos]; 55420 break; 55421 } 55422 } 55423 55424 if (stack.length === 0) { 55425 return null; 55426 } 55427 } 55428 } 55429 } 55430 55431 dump(buffer) { 55432 if (this.nodeName === "#text") { 55433 buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue)); 55434 return; 55435 } 55436 55437 buffer.push(`<${this.nodeName}`); 55438 55439 if (this.attributes) { 55440 for (const attribute of this.attributes) { 55441 buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`); 55442 } 55443 } 55444 55445 if (this.hasChildNodes()) { 55446 buffer.push(">"); 55447 55448 for (const child of this.childNodes) { 55449 child.dump(buffer); 55450 } 55451 55452 buffer.push(`</${this.nodeName}>`); 55453 } else if (this.nodeValue) { 55454 buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`); 55455 } else { 55456 buffer.push("/>"); 55457 } 55458 } 55459 55460} 55461 55462exports.SimpleDOMNode = SimpleDOMNode; 55463 55464class SimpleXMLParser extends XMLParserBase {
55465 constructor({ 55466 hasAttributes = false, 55467 lowerCaseName = false 55468 }) { 55469 super(); 55470 this._currentFragment = null; 55471 this._stack = null; 55472 this._errorCode = XMLParserErrorCode.NoError; 55473 this._hasAttributes = hasAttributes; 55474 this._lowerCaseName = lowerCaseName; 55475 } 55476 55477 parseFromString(data) { 55478 this._currentFragment = []; 55479 this._stack = []; 55480 this._errorCode = XMLParserErrorCode.NoError; 55481 this.parseXml(data); 55482 55483 if (this._errorCode !== XMLParserErrorCode.NoError) { 55484 return undefined; 55485 } 55486 55487 const [documentElement] = this._currentFragment; 55488 55489 if (!documentElement) { 55490 return undefined; 55491 } 55492 55493 return { 55494 documentElement 55495 }; 55496 } 55497 55498 onText(text) { 55499 if (isWhitespaceString(text)) { 55500 return; 55501 } 55502 55503 const node = new SimpleDOMNode("#text", text); 55504 55505 this._currentFragment.push(node); 55506 } 55507 55508 onCdata(text) { 55509 const node = new SimpleDOMNode("#text", text); 55510 55511 this._currentFragment.push(node); 55512 } 55513 55514 onBeginElement(name, attributes, isEmpty) { 55515 if (this._lowerCaseName) { 55516 name = name.toLowerCase(); 55517 } 55518 55519 const node = new SimpleDOMNode(name); 55520 node.childNodes = []; 55521 55522 if (this._hasAttributes) { 55523 node.attributes = attributes; 55524 } 55525 55526 this._currentFragment.push(node); 55527 55528 if (isEmpty) { 55529 return; 55530 } 55531 55532 this._stack.push(this._currentFragment); 55533 55534 this._currentFragment = node.childNodes; 55535 } 55536 55537 onEndElement(name) { 55538 this._currentFragment = this._stack.pop() || []; 55539 const lastElement = this._currentFragment[this._currentFragment.length - 1]; 55540 55541 if (!lastElement) { 55542 return; 55543 } 55544 55545 for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) { 55546 lastElement.childNodes[i].parentNode = lastElement; 55547 } 55548 } 55549 55550 onError(code) { 55551 this._errorCode = code; 55552 } 55553 55554} 55555 55556exports.SimpleXMLParser = SimpleXMLParser; 55557 55558/***/ }), 55559/* 69 */ 55560/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 55561 55562 55563 55564Object.defineProperty(exports, "__esModule", ({ 55565 value: true 55566})); 55567exports.StructTreeRoot = exports.StructTreePage = void 0; 55568 55569var _primitives = __w_pdfjs_require__(5); 55570 55571var _util = __w_pdfjs_require__(2); 55572 55573var _name_number_tree = __w_pdfjs_require__(65); 55574 55575const MAX_DEPTH = 40; 55576const StructElementType = { 55577 PAGE_CONTENT: "PAGE_CONTENT", 55578 STREAM_CONTENT: "STREAM_CONTENT", 55579 OBJECT: "OBJECT", 55580 ELEMENT: "ELEMENT" 55581}; 55582 55583class StructTreeRoot { 55584 constructor(rootDict) { 55585 this.dict = rootDict; 55586 this.roleMap = new Map(); 55587 } 55588 55589 init() { 55590 this.readRoleMap(); 55591 } 55592 55593 readRoleMap() { 55594 const roleMapDict = this.dict.get("RoleMap"); 55595 55596 if (!(0, _primitives.isDict)(roleMapDict)) { 55597 return; 55598 } 55599 55600 roleMapDict.forEach((key, value) => { 55601 if (!(0, _primitives.isName)(value)) { 55602 return; 55603 } 55604 55605 this.roleMap.set(key, value.name); 55606 }); 55607 } 55608 55609} 55610 55611exports.StructTreeRoot = StructTreeRoot; 55612 55613class StructElementNode { 55614 constructor(tree, dict) { 55615 this.tree = tree; 55616 this.dict = dict; 55617 this.kids = []; 55618 this.parseKids(); 55619 } 55620 55621 get role() { 55622 const nameObj = this.dict.get("S"); 55623 const name = (0, _primitives.isName)(nameObj) ? nameObj.name : ""; 55624 const { 55625 root 55626 } = this.tree; 55627 55628 if (root.roleMap.has(name)) { 55629 return root.roleMap.get(name); 55630 } 55631 55632 return name; 55633 } 55634 55635 parseKids() { 55636 let pageObjId = null; 55637 const objRef = this.dict.getRaw("Pg"); 55638 55639 if ((0, _primitives.isRef)(objRef)) { 55640 pageObjId = objRef.toString(); 55641 } 55642 55643 const kids = this.dict.get("K"); 55644 55645 if (Array.isArray(kids)) { 55646 for (const kid of kids) { 55647 const element = this.parseKid(pageObjId, kid); 55648 55649 if (element) { 55650 this.kids.push(element); 55651 } 55652 } 55653 } else { 55654 const element = this.parseKid(pageObjId, kids); 55655 55656 if (element) { 55657 this.kids.push(element); 55658 } 55659 } 55660 } 55661 55662 parseKid(pageObjId, kid) { 55663 if (Number.isInteger(kid)) { 55664 if (this.tree.pageDict.objId !== pageObjId) { 55665 return null; 55666 } 55667 55668 return new StructElement({ 55669 type: StructElementType.PAGE_CONTENT, 55670 mcid: kid, 55671 pageObjId 55672 }); 55673 } 55674 55675 let kidDict = null; 55676 55677 if ((0, _primitives.isRef)(kid)) { 55678 kidDict = this.dict.xref.fetch(kid); 55679 } else if ((0, _primitives.isDict)(kid)) { 55680 kidDict = kid; 55681 } 55682 55683 if (!kidDict) { 55684 return null; 55685 } 55686 55687 const pageRef = kidDict.getRaw("Pg"); 55688 55689 if ((0, _primitives.isRef)(pageRef)) { 55690 pageObjId = pageRef.toString(); 55691 } 55692 55693 const type = (0, _primitives.isName)(kidDict.get("Type")) ? kidDict.get("Type").name : null; 55694 55695 if (type === "MCR") { 55696 if (this.tree.pageDict.objId !== pageObjId) { 55697 return null; 55698 } 55699 55700 return new StructElement({ 55701 type: StructElementType.STREAM_CONTENT, 55702 refObjId: (0, _primitives.isRef)(kidDict.getRaw("Stm")) ? kidDict.getRaw("Stm").toString() : null, 55703 pageObjId, 55704 mcid: kidDict.get("MCID") 55705 }); 55706 } 55707 55708 if (type === "OBJR") { 55709 if (this.tree.pageDict.objId !== pageObjId) { 55710 return null; 55711 } 55712 55713 return new StructElement({ 55714 type: StructElementType.OBJECT, 55715 refObjId: (0, _primitives.isRef)(kidDict.getRaw("Obj")) ? kidDict.getRaw("Obj").toString() : null, 55716 pageObjId 55717 }); 55718 } 55719 55720 return new StructElement({ 55721 type: StructElementType.ELEMENT, 55722 dict: kidDict 55723 }); 55724 } 55725 55726} 55727 55728class StructElement { 55729 constructor({ 55730 type, 55731 dict = null, 55732 mcid = null, 55733 pageObjId = null, 55734 refObjId = null 55735 }) { 55736 this.type = type; 55737 this.dict = dict; 55738 this.mcid = mcid; 55739 this.pageObjId = pageObjId; 55740 this.refObjId = refObjId; 55741 this.parentNode = null; 55742 } 55743 55744} 55745 55746class StructTreePage { 55747 constructor(structTreeRoot, pageDict) { 55748 this.root = structTreeRoot; 55749 this.rootDict = structTreeRoot ? structTreeRoot.dict : null; 55750 this.pageDict = pageDict; 55751 this.nodes = []; 55752 } 55753 55754 parse() { 55755 if (!this.root || !this.rootDict) { 55756 return; 55757 } 55758 55759 const parentTree = this.rootDict.get("ParentTree"); 55760 55761 if (!parentTree) { 55762 return; 55763 } 55764 55765 const id = this.pageDict.get("StructParents"); 55766 55767 if (!Number.isInteger(id)) { 55768 return; 55769 } 55770 55771 const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref); 55772 const parentArray = numberTree.get(id); 55773 55774 if (!Array.isArray(parentArray)) { 55775 return; 55776 } 55777 55778 const map = new Map(); 55779 55780 for (const ref of parentArray) { 55781 if ((0, _primitives.isRef)(ref)) { 55782 this.addNode(this.rootDict.xref.fetch(ref), map); 55783 } 55784 } 55785 } 55786 55787 addNode(dict, map, level = 0) { 55788 if (level > MAX_DEPTH) { 55789 (0, _util.warn)("StructTree MAX_DEPTH reached."); 55790 return null; 55791 } 55792 55793 if (map.has(dict)) { 55794 return map.get(dict); 55795 } 55796 55797 const element = new StructElementNode(this, dict); 55798 map.set(dict, element); 55799 const parent = dict.get("P"); 55800 55801 if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) { 55802 if (!this.addTopLevelNode(dict, element)) {
55803 map.delete(dict); 55804 } 55805 55806 return element; 55807 } 55808 55809 const parentNode = this.addNode(parent, map, level + 1); 55810 55811 if (!parentNode) { 55812 return element; 55813 } 55814 55815 let save = false; 55816 55817 for (const kid of parentNode.kids) { 55818 if (kid.type === StructElementType.ELEMENT && kid.dict === dict) { 55819 kid.parentNode = element; 55820 save = true; 55821 } 55822 } 55823 55824 if (!save) { 55825 map.delete(dict); 55826 } 55827 55828 return element; 55829 } 55830 55831 addTopLevelNode(dict, element) { 55832 const obj = this.rootDict.get("K"); 55833 55834 if (!obj) { 55835 return false; 55836 } 55837 55838 if ((0, _primitives.isDict)(obj)) { 55839 if (obj.objId !== dict.objId) { 55840 return false; 55841 } 55842 55843 this.nodes[0] = element; 55844 return true; 55845 } 55846 55847 if (!Array.isArray(obj)) { 55848 return true; 55849 } 55850 55851 let save = false; 55852 55853 for (let i = 0; i < obj.length; i++) { 55854 const kidRef = obj[i]; 55855 55856 if (kidRef && kidRef.toString() === dict.objId) { 55857 this.nodes[i] = element; 55858 save = true; 55859 } 55860 } 55861 55862 return save; 55863 } 55864 55865 get serializable() { 55866 function nodeToSerializable(node, parent, level = 0) { 55867 if (level > MAX_DEPTH) { 55868 (0, _util.warn)("StructTree too deep to be fully serialized."); 55869 return; 55870 } 55871 55872 const obj = Object.create(null); 55873 obj.role = node.role; 55874 obj.children = []; 55875 parent.children.push(obj); 55876 const alt = node.dict.get("Alt"); 55877 55878 if ((0, _util.isString)(alt)) { 55879 obj.alt = (0, _util.stringToPDFString)(alt); 55880 } 55881 55882 const lang = node.dict.get("Lang"); 55883 55884 if ((0, _util.isString)(lang)) { 55885 obj.lang = (0, _util.stringToPDFString)(lang); 55886 } 55887 55888 for (const kid of node.kids) { 55889 const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null; 55890 55891 if (kidElement) {
55892 nodeToSerializable(kidElement, obj, level + 1); 55893 continue; 55894 } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) { 55895 obj.children.push({ 55896 type: "content", 55897 id: `page${kid.pageObjId}_mcid${kid.mcid}` 55898 }); 55899 } else if (kid.type === StructElementType.OBJECT) { 55900 obj.children.push({ 55901 type: "object", 55902 id: kid.refObjId 55903 }); 55904 } 55905 } 55906 } 55907 55908 const root = Object.create(null); 55909 root.children = []; 55910 root.role = "Root"; 55911 55912 for (const child of this.nodes) { 55913 if (!child) { 55914 continue; 55915 } 55916 55917 nodeToSerializable(child, root); 55918 } 55919 55920 return root; 55921 } 55922 55923} 55924 55925exports.StructTreePage = StructTreePage; 55926 55927/***/ }), 55928/* 70 */ 55929/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 55930 55931 55932 55933Object.defineProperty(exports, "__esModule", ({ 55934 value: true 55935})); 55936exports.ObjectLoader = void 0; 55937 55938var _primitives = __w_pdfjs_require__(5); 55939 55940var _core_utils = __w_pdfjs_require__(9); 55941 55942var _util = __w_pdfjs_require__(2); 55943 55944function mayHaveChildren(value) { 55945 return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value); 55946} 55947 55948function addChildren(node, nodesToVisit) { 55949 if (node instanceof _primitives.Dict) { 55950 node = node.getRawValues(); 55951 } else if ((0, _primitives.isStream)(node)) { 55952 node = node.dict.getRawValues(); 55953 } else if (!Array.isArray(node)) { 55954 return; 55955 } 55956 55957 for (const rawValue of node) { 55958 if (mayHaveChildren(rawValue)) { 55959 nodesToVisit.push(rawValue); 55960 } 55961 } 55962} 55963 55964class ObjectLoader { 55965 constructor(dict, keys, xref) { 55966 this.dict = dict; 55967 this.keys = keys; 55968 this.xref = xref; 55969 this.refSet = null; 55970 } 55971 55972 async load() { 55973 if (this.xref.stream.isDataLoaded) { 55974 return undefined; 55975 } 55976 55977 const { 55978 keys, 55979 dict 55980 } = this; 55981 this.refSet = new _primitives.RefSet(); 55982 const nodesToVisit = []; 55983 55984 for (let i = 0, ii = keys.length; i < ii; i++) { 55985 const rawValue = dict.getRaw(keys[i]); 55986 55987 if (rawValue !== undefined) { 55988 nodesToVisit.push(rawValue); 55989 } 55990 } 55991 55992 return this._walk(nodesToVisit); 55993 } 55994 55995 async _walk(nodesToVisit) { 55996 const nodesToRevisit = []; 55997 const pendingRequests = []; 55998 55999 while (nodesToVisit.length) { 56000 let currentNode = nodesToVisit.pop(); 56001 56002 if (currentNode instanceof _primitives.Ref) { 56003 if (this.refSet.has(currentNode)) { 56004 continue; 56005 } 56006 56007 try { 56008 this.refSet.put(currentNode); 56009 currentNode = this.xref.fetch(currentNode); 56010 } catch (ex) { 56011 if (!(ex instanceof _core_utils.MissingDataException)) { 56012 (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`); 56013 this.refSet = null; 56014 const { 56015 manager 56016 } = this.xref.stream; 56017 return manager.requestAllChunks(); 56018 } 56019 56020 nodesToRevisit.push(currentNode); 56021 pendingRequests.push({ 56022 begin: ex.begin, 56023 end: ex.end 56024 }); 56025 } 56026 } 56027 56028 if ((0, _primitives.isStream)(currentNode)) { 56029 const baseStreams = currentNode.getBaseStreams(); 56030 56031 if (baseStreams) { 56032 let foundMissingData = false; 56033 56034 for (const stream of baseStreams) { 56035 if (stream.isDataLoaded) { 56036 continue; 56037 } 56038 56039 foundMissingData = true; 56040 pendingRequests.push({ 56041 begin: stream.start, 56042 end: stream.end 56043 }); 56044 } 56045 56046 if (foundMissingData) { 56047 nodesToRevisit.push(currentNode); 56048 } 56049 } 56050 } 56051 56052 addChildren(currentNode, nodesToVisit); 56053 } 56054 56055 if (pendingRequests.length) { 56056 await this.xref.stream.manager.requestRanges(pendingRequests); 56057 56058 for (const node of nodesToRevisit) { 56059 if (node instanceof _primitives.Ref) { 56060 this.refSet.remove(node); 56061 } 56062 } 56063 56064 return this._walk(nodesToRevisit); 56065 } 56066 56067 this.refSet = null; 56068 return undefined; 56069 } 56070 56071} 56072 56073exports.ObjectLoader = ObjectLoader; 56074 56075/***/ }), 56076/* 71 */ 56077/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 56078 56079 56080 56081Object.defineProperty(exports, "__esModule", ({ 56082 value: true 56083})); 56084exports.incrementalUpdate = incrementalUpdate; 56085exports.writeDict = writeDict; 56086 56087var _util = __w_pdfjs_require__(2); 56088 56089var _primitives = __w_pdfjs_require__(5); 56090 56091var _core_utils = __w_pdfjs_require__(9); 56092 56093var _xml_parser = __w_pdfjs_require__(68); 56094 56095var _crypto = __w_pdfjs_require__(72); 56096 56097function writeDict(dict, buffer, transform) { 56098 buffer.push("<<"); 56099 56100 for (const key of dict.getKeys()) { 56101 buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `); 56102 writeValue(dict.getRaw(key), buffer, transform); 56103 } 56104 56105 buffer.push(">>"); 56106} 56107 56108function writeStream(stream, buffer, transform) { 56109 writeDict(stream.dict, buffer, transform); 56110 buffer.push(" stream\n"); 56111 let string = stream.getString(); 56112 56113 if (transform !== null) { 56114 string = transform.encryptString(string); 56115 } 56116 56117 buffer.push(string, "\nendstream\n"); 56118} 56119 56120function writeArray(array, buffer, transform) { 56121 buffer.push("["); 56122 let first = true; 56123 56124 for (const val of array) { 56125 if (!first) { 56126 buffer.push(" "); 56127 } else { 56128 first = false;
56129 } 56130 56131 writeValue(val, buffer, transform); 56132 } 56133 56134 buffer.push("]"); 56135} 56136 56137function numberToString(value) { 56138 if (Number.isInteger(value)) { 56139 return value.toString(); 56140 } 56141 56142 const roundedValue = Math.round(value * 100); 56143 56144 if (roundedValue % 100 === 0) { 56145 return (roundedValue / 100).toString(); 56146 } 56147 56148 if (roundedValue % 10 === 0) { 56149 return value.toFixed(1); 56150 } 56151 56152 return value.toFixed(2); 56153} 56154 56155function writeValue(value, buffer, transform) { 56156 if ((0, _primitives.isName)(value)) { 56157 buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`); 56158 } else if ((0, _primitives.isRef)(value)) { 56159 buffer.push(`${value.num} ${value.gen} R`); 56160 } else if (Array.isArray(value)) { 56161 writeArray(value, buffer, transform); 56162 } else if (typeof value === "string") { 56163 if (transform !== null) { 56164 value = transform.encryptString(value); 56165 } 56166 56167 buffer.push(`(${(0, _util.escapeString)(value)})`); 56168 } else if (typeof value === "number") { 56169 buffer.push(numberToString(value)); 56170 } else if (typeof value === "boolean") { 56171 buffer.push(value.toString()); 56172 } else if ((0, _primitives.isDict)(value)) { 56173 writeDict(value, buffer, transform); 56174 } else if ((0, _primitives.isStream)(value)) { 56175 writeStream(value, buffer, transform); 56176 } else if (value === null) { 56177 buffer.push("null"); 56178 } else { 56179 (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`); 56180 } 56181} 56182 56183function writeInt(number, size, offset, buffer) { 56184 for (let i = size + offset - 1; i > offset - 1; i--) { 56185 buffer[i] = number & 0xff; 56186 number >>= 8; 56187 } 56188 56189 return offset + size; 56190} 56191 56192function writeString(string, offset, buffer) { 56193 for (let i = 0, len = string.length; i < len; i++) { 56194 buffer[offset + i] = string.charCodeAt(i) & 0xff; 56195 } 56196} 56197 56198function computeMD5(filesize, xrefInfo) { 56199 const time = Math.floor(Date.now() / 1000); 56200 const filename = xrefInfo.filename || ""; 56201 const md5Buffer = [time.toString(), filename, filesize.toString()]; 56202 let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0); 56203 56204 for (const value of Object.values(xrefInfo.info)) { 56205 md5Buffer.push(value); 56206 md5BufferLen += value.length; 56207 } 56208 56209 const array = new Uint8Array(md5BufferLen); 56210 let offset = 0; 56211 56212 for (const str of md5Buffer) { 56213 writeString(str, offset, array); 56214 offset += str.length; 56215 } 56216 56217 return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array)); 56218} 56219 56220function writeXFADataForAcroform(str, newRefs) { 56221 const xml = new _xml_parser.SimpleXMLParser({ 56222 hasAttributes: true 56223 }).parseFromString(str); 56224 56225 for (const { 56226 xfa 56227 } of newRefs) { 56228 if (!xfa) { 56229 continue; 56230 } 56231 56232 const { 56233 path, 56234 value 56235 } = xfa; 56236 56237 if (!path) { 56238 continue; 56239 } 56240 56241 const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0); 56242 56243 if (node) { 56244 node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)]; 56245 } else { 56246 (0, _util.warn)(`Node not found for path: ${path}`); 56247 } 56248 } 56249 56250 const buffer = []; 56251 xml.documentElement.dump(buffer); 56252 return buffer.join(""); 56253} 56254 56255function updateXFA({ 56256 xfaData, 56257 xfaDatasetsRef, 56258 hasXfaDatasetsEntry, 56259 acroFormRef, 56260 acroForm, 56261 newRefs, 56262 xref, 56263 xrefInfo 56264}) { 56265 if (xref === null) { 56266 return; 56267 } 56268 56269 if (!hasXfaDatasetsEntry) { 56270 if (!acroFormRef) { 56271 (0, _util.warn)("XFA - Cannot save it"); 56272 return; 56273 } 56274 56275 const oldXfa = acroForm.get("XFA"); 56276 const newXfa = oldXfa.slice(); 56277 newXfa.splice(2, 0, "datasets"); 56278 newXfa.splice(3, 0, xfaDatasetsRef); 56279 acroForm.set("XFA", newXfa); 56280 const encrypt = xref.encrypt; 56281 let transform = null; 56282 56283 if (encrypt) { 56284 transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen); 56285 } 56286 56287 const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`]; 56288 writeDict(acroForm, buffer, transform); 56289 buffer.push("\n"); 56290 acroForm.set("XFA", oldXfa); 56291 newRefs.push({ 56292 ref: acroFormRef, 56293 data: buffer.join("") 56294 }); 56295 } 56296 56297 if (xfaData === null) { 56298 const datasets = xref.fetchIfRef(xfaDatasetsRef); 56299 xfaData = writeXFADataForAcroform(datasets.getString(), newRefs); 56300 } 56301 56302 const encrypt = xref.encrypt; 56303 56304 if (encrypt) { 56305 const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen); 56306 xfaData = transform.encryptString(xfaData); 56307 } 56308 56309 const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n"; 56310 newRefs.push({ 56311 ref: xfaDatasetsRef, 56312 data 56313 }); 56314} 56315 56316function incrementalUpdate({ 56317 originalData, 56318 xrefInfo, 56319 newRefs, 56320 xref = null, 56321 hasXfa = false, 56322 xfaDatasetsRef = null, 56323 hasXfaDatasetsEntry = false, 56324 acroFormRef = null, 56325 acroForm = null, 56326 xfaData = null 56327}) { 56328 if (hasXfa) { 56329 updateXFA({ 56330 xfaData, 56331 xfaDatasetsRef, 56332 hasXfaDatasetsEntry, 56333 acroFormRef, 56334 acroForm, 56335 newRefs, 56336 xref, 56337 xrefInfo 56338 }); 56339 } 56340 56341 const newXref = new _primitives.Dict(null); 56342 const refForXrefTable = xrefInfo.newRef; 56343 let buffer, baseOffset;
56344 const lastByte = originalData[originalData.length - 1]; 56345 56346 if (lastByte === 0x0a || lastByte === 0x0d) { 56347 buffer = []; 56348 baseOffset = originalData.length; 56349 } else { 56350 buffer = ["\n"]; 56351 baseOffset = originalData.length + 1; 56352 } 56353 56354 newXref.set("Size", refForXrefTable.num + 1); 56355 newXref.set("Prev", xrefInfo.startXRef); 56356 newXref.set("Type", _primitives.Name.get("XRef")); 56357 56358 if (xrefInfo.rootRef !== null) { 56359 newXref.set("Root", xrefInfo.rootRef); 56360 } 56361 56362 if (xrefInfo.infoRef !== null) { 56363 newXref.set("Info", xrefInfo.infoRef); 56364 } 56365 56366 if (xrefInfo.encryptRef !== null) { 56367 newXref.set("Encrypt", xrefInfo.encryptRef); 56368 } 56369 56370 newRefs.push({ 56371 ref: refForXrefTable, 56372 data: "" 56373 }); 56374 newRefs = newRefs.sort((a, b) => { 56375 return a.ref.num - b.ref.num; 56376 }); 56377 const xrefTableData = [[0, 1, 0xffff]]; 56378 const indexes = [0, 1]; 56379 let maxOffset = 0; 56380 56381 for (const { 56382 ref, 56383 data 56384 } of newRefs) { 56385 maxOffset = Math.max(maxOffset, baseOffset); 56386 xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]); 56387 baseOffset += data.length; 56388 indexes.push(ref.num, 1); 56389 buffer.push(data); 56390 } 56391 56392 newXref.set("Index", indexes); 56393 56394 if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) { 56395 const md5 = computeMD5(baseOffset, xrefInfo); 56396 newXref.set("ID", [xrefInfo.fileIds[0], md5]); 56397 } 56398 56399 const offsetSize = Math.ceil(Math.log2(maxOffset) / 8); 56400 const sizes = [1, offsetSize, 2]; 56401 const structSize = sizes[0] + sizes[1] + sizes[2]; 56402 const tableLength = structSize * xrefTableData.length; 56403 newXref.set("W", sizes); 56404 newXref.set("Length", tableLength); 56405 buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`); 56406 writeDict(newXref, buffer, null); 56407 buffer.push(" stream\n"); 56408 const bufferLen = buffer.reduce((a, str) => a + str.length, 0); 56409 const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`; 56410 const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length); 56411 array.set(originalData); 56412 let offset = originalData.length; 56413 56414 for (const str of buffer) { 56415 writeString(str, offset, array); 56416 offset += str.length; 56417 } 56418 56419 for (const [type, objOffset, gen] of xrefTableData) { 56420 offset = writeInt(type, sizes[0], offset, array); 56421 offset = writeInt(objOffset, sizes[1], offset, array); 56422 offset = writeInt(gen, sizes[2], offset, array); 56423 } 56424 56425 writeString(footer, offset, array); 56426 return array; 56427} 56428 56429/***/ }), 56430/* 72 */ 56431/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 56432 56433 56434 56435Object.defineProperty(exports, "__esModule", ({ 56436 value: true 56437})); 56438exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0; 56439exports.calculateSHA384 = calculateSHA384; 56440exports.calculateSHA512 = void 0; 56441 56442var _util = __w_pdfjs_require__(2); 56443 56444var _primitives = __w_pdfjs_require__(5); 56445 56446var _decrypt_stream = __w_pdfjs_require__(73); 56447 56448class ARCFourCipher { 56449 constructor(key) { 56450 this.a = 0; 56451 this.b = 0; 56452 const s = new Uint8Array(256); 56453 const keyLength = key.length; 56454 56455 for (let i = 0; i < 256; ++i) { 56456 s[i] = i; 56457 } 56458 56459 for (let i = 0, j = 0; i < 256; ++i) { 56460 const tmp = s[i]; 56461 j = j + tmp + key[i % keyLength] & 0xff; 56462 s[i] = s[j]; 56463 s[j] = tmp; 56464 } 56465 56466 this.s = s; 56467 } 56468 56469 encryptBlock(data) { 56470 let a = this.a, 56471 b = this.b; 56472 const s = this.s; 56473 const n = data.length; 56474 const output = new Uint8Array(n); 56475 56476 for (let i = 0; i < n; ++i) { 56477 a = a + 1 & 0xff; 56478 const tmp = s[a]; 56479 b = b + tmp & 0xff; 56480 const tmp2 = s[b]; 56481 s[a] = tmp2; 56482 s[b] = tmp; 56483 output[i] = data[i] ^ s[tmp + tmp2 & 0xff]; 56484 } 56485 56486 this.a = a; 56487 this.b = b; 56488 return output; 56489 } 56490 56491 decryptBlock(data) { 56492 return this.encryptBlock(data); 56493 } 56494 56495 encrypt(data) { 56496 return this.encryptBlock(data); 56497 } 56498 56499} 56500 56501exports.ARCFourCipher = ARCFourCipher; 56502 56503const calculateMD5 = function calculateMD5Closure() { 56504 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]); 56505 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, -64
vendor: 4,099 bytes, lines 56505-56669
565050364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]); 56506 56507 function hash(data, offset, length) { 56508 let h0 = 1732584193, 56509 h1 = -271733879, 56510 h2 = -1732584194, 56511 h3 = 271733878; 56512 const paddedLength = length + 72 & ~63; 56513 const padded = new Uint8Array(paddedLength); 56514 let i, j; 56515 56516 for (i = 0; i < length; ++i) { 56517 padded[i] = data[offset++]; 56518 } 56519 56520 padded[i++] = 0x80; 56521 const n = paddedLength - 8; 56522 56523 while (i < n) { 56524 padded[i++] = 0; 56525 } 56526 56527 padded[i++] = length << 3 & 0xff; 56528 padded[i++] = length >> 5 & 0xff; 56529 padded[i++] = length >> 13 & 0xff; 56530 padded[i++] = length >> 21 & 0xff; 56531 padded[i++] = length >>> 29 & 0xff; 56532 padded[i++] = 0; 56533 padded[i++] = 0; 56534 padded[i++] = 0; 56535 const w = new Int32Array(16); 56536 56537 for (i = 0; i < paddedLength;) { 56538 for (j = 0; j < 16; ++j, i += 4) { 56539 w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24; 56540 } 56541 56542 let a = h0, 56543 b = h1, 56544 c = h2, 56545 d = h3, 56546 f, 56547 g; 56548 56549 for (j = 0; j < 64; ++j) { 56550 if (j < 16) { 56551 f = b & c | ~b & d; 56552 g = j; 56553 } else if (j < 32) { 56554 f = d & b | ~d & c; 56555 g = 5 * j + 1 & 15; 56556 } else if (j < 48) { 56557 f = b ^ c ^ d; 56558 g = 3 * j + 5 & 15; 56559 } else { 56560 f = c ^ (b | ~d); 56561 g = 7 * j & 15; 56562 } 56563 56564 const tmp = d, 56565 rotateArg = a + f + k[j] + w[g] | 0, 56566 rotate = r[j]; 56567 d = c; 56568 c = b; 56569 b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0; 56570 a = tmp; 56571 } 56572 56573 h0 = h0 + a | 0; 56574 h1 = h1 + b | 0; 56575 h2 = h2 + c | 0; 56576 h3 = h3 + d | 0; 56577 } 56578 56579 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]); 56580 } 56581 56582 return hash; 56583}(); 56584 56585exports.calculateMD5 = calculateMD5; 56586 56587class Word64 { 56588 constructor(highInteger, lowInteger) { 56589 this.high = highInteger | 0; 56590 this.low = lowInteger | 0; 56591 } 56592 56593 and(word) { 56594 this.high &= word.high; 56595 this.low &= word.low; 56596 } 56597 56598 xor(word) { 56599 this.high ^= word.high; 56600 this.low ^= word.low; 56601 } 56602 56603 or(word) { 56604 this.high |= word.high; 56605 this.low |= word.low; 56606 } 56607 56608 shiftRight(places) { 56609 if (places >= 32) { 56610 this.low = this.high >>> places - 32 | 0; 56611 this.high = 0; 56612 } else { 56613 this.low = this.low >>> places | this.high << 32 - places; 56614 this.high = this.high >>> places | 0; 56615 } 56616 } 56617 56618 shiftLeft(places) { 56619 if (places >= 32) { 56620 this.high = this.low << places - 32; 56621 this.low = 0; 56622 } else { 56623 this.high = this.high << places | this.low >>> 32 - places; 56624 this.low <<= places; 56625 } 56626 } 56627 56628 rotateRight(places) { 56629 let low, high; 56630 56631 if (places & 32) { 56632 high = this.low; 56633 low = this.high; 56634 } else { 56635 low = this.low; 56636 high = this.high; 56637 } 56638 56639 places &= 31; 56640 this.low = low >>> places | high << 32 - places; 56641 this.high = high >>> places | low << 32 - places; 56642 } 56643 56644 not() { 56645 this.high = ~this.high; 56646 this.low = ~this.low; 56647 } 56648 56649 add(word) { 56650 const lowAdd = (this.low >>> 0) + (word.low >>> 0); 56651 let highAdd = (this.high >>> 0) + (word.high >>> 0); 56652 56653 if (lowAdd > 0xffffffff) { 56654 highAdd += 1; 56655 } 56656 56657 this.low = lowAdd | 0; 56658 this.high = highAdd | 0; 56659 } 56660 56661 copyTo(bytes, offset) { 56662 bytes[offset] = this.high >>> 24 & 0xff; 56663 bytes[offset + 1] = this.high >> 16 & 0xff; 56664 bytes[offset + 2] = this.high >> 8 & 0xff; 56665 bytes[offset + 3] = this.high & 0xff; 56666 bytes[offset + 4] = this.low >>> 24 & 0xff; 56667 bytes[offset + 5] = this.low >> 16 & 0xff; 56668 bytes[offset + 6] = this.low >> 8 & 0xff; 56669 bytes[offset + 7] = this.low & 0xff;
56670 } 56671 56672 assign(word) { 56673 this.high = word.high; 56674 this.low = word.low; 56675 } 56676 56677} 56678 56679const calculateSHA256 = function calculateSHA256Closure() { 56680 function rotr(x, n) { 56681 return x >>> n | x << 32 - n; 56682 } 56683 56684 function ch(x, y, z) { 56685 return x & y ^ ~x & z; 56686 } 56687 56688 function maj(x, y, z) { 56689 return x & y ^ x & z ^ y & z; 56690 } 56691 56692 function sigma(x) { 56693 return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); 56694 } 56695 56696 function sigmaPrime(x) { 56697 return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); 56698 } 56699 56700 function littleSigma(x) { 56701 return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3; 56702 } 56703 56704 function littleSigmaPrime(x) { 56705 return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10; 56706 } 56707 56708 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]; 56709 56710 function hash(data, offset, length) { 56711 let h0 = 0x6a09e667, 56712 h1 = 0xbb67ae85, 56713 h2 = 0x3c6ef372, 56714 h3 = 0xa54ff53a, 56715 h4 = 0x510e527f, 56716 h5 = 0x9b05688c, 56717 h6 = 0x1f83d9ab, 56718 h7 = 0x5be0cd19; 56719 const paddedLength = Math.ceil((length + 9) / 64) * 64; 56720 const padded = new Uint8Array(paddedLength); 56721 let i, j; 56722 56723 for (i = 0; i < length; ++i) { 56724 padded[i] = data[offset++]; 56725 } 56726 56727 padded[i++] = 0x80; 56728 const n = paddedLength - 8; 56729 56730 while (i < n) { 56731 padded[i++] = 0; 56732 } 56733 56734 padded[i++] = 0; 56735 padded[i++] = 0; 56736 padded[i++] = 0; 56737 padded[i++] = length >>> 29 & 0xff; 56738 padded[i++] = length >> 21 & 0xff; 56739 padded[i++] = length >> 13 & 0xff; 56740 padded[i++] = length >> 5 & 0xff;
vendor: 4,304 bytes, lines 56741-56861
56741 padded[i++] = length << 3 & 0xff; 56742 const w = new Uint32Array(64); 56743 56744 for (i = 0; i < paddedLength;) { 56745 for (j = 0; j < 16; ++j) { 56746 w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 56747 i += 4; 56748 } 56749 56750 for (j = 16; j < 64; ++j) { 56751 w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0; 56752 } 56753 56754 let a = h0, 56755 b = h1, 56756 c = h2, 56757 d = h3, 56758 e = h4, 56759 f = h5, 56760 g = h6, 56761 h = h7, 56762 t1, 56763 t2; 56764 56765 for (j = 0; j < 64; ++j) { 56766 t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j]; 56767 t2 = sigma(a) + maj(a, b, c); 56768 h = g; 56769 g = f; 56770 f = e; 56771 e = d + t1 | 0; 56772 d = c; 56773 c = b; 56774 b = a; 56775 a = t1 + t2 | 0; 56776 } 56777 56778 h0 = h0 + a | 0; 56779 h1 = h1 + b | 0; 56780 h2 = h2 + c | 0; 56781 h3 = h3 + d | 0; 56782 h4 = h4 + e | 0; 56783 h5 = h5 + f | 0; 56784 h6 = h6 + g | 0; 56785 h7 = h7 + h | 0; 56786 } 56787 56788 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]); 56789 } 56790 56791 return hash; 56792}(); 56793 56794exports.calculateSHA256 = calculateSHA256; 56795 56796const calculateSHA512 = function calculateSHA512Closure() { 56797 function ch(result, x, y, z, tmp) { 56798 result.assign(x); 56799 result.and(y); 56800 tmp.assign(x); 56801 tmp.not(); 56802 tmp.and(z); 56803 result.xor(tmp); 56804 } 56805 56806 function maj(result, x, y, z, tmp) { 56807 result.assign(x); 56808 result.and(y); 56809 tmp.assign(x); 56810 tmp.and(z); 56811 result.xor(tmp); 56812 tmp.assign(y); 56813 tmp.and(z); 56814 result.xor(tmp); 56815 } 56816 56817 function sigma(result, x, tmp) { 56818 result.assign(x); 56819 result.rotateRight(28); 56820 tmp.assign(x); 56821 tmp.rotateRight(34); 56822 result.xor(tmp); 56823 tmp.assign(x); 56824 tmp.rotateRight(39); 56825 result.xor(tmp); 56826 } 56827 56828 function sigmaPrime(result, x, tmp) { 56829 result.assign(x); 56830 result.rotateRight(14); 56831 tmp.assign(x); 56832 tmp.rotateRight(18); 56833 result.xor(tmp); 56834 tmp.assign(x); 56835 tmp.rotateRight(41); 56836 result.xor(tmp); 56837 } 56838 56839 function littleSigma(result, x, tmp) { 56840 result.assign(x); 56841 result.rotateRight(1); 56842 tmp.assign(x); 56843 tmp.rotateRight(8); 56844 result.xor(tmp); 56845 tmp.assign(x); 56846 tmp.shiftRight(7); 56847 result.xor(tmp); 56848 } 56849 56850 function littleSigmaPrime(result, x, tmp) { 56851 result.assign(x); 56852 result.rotateRight(19); 56853 tmp.assign(x); 56854 tmp.rotateRight(61); 56855 result.xor(tmp); 56856 tmp.assign(x); 56857 tmp.shiftRight(6); 56858 result.xor(tmp); 56859 } 56860 56861 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,
568610x3c77b2a8), 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)]; 56862 56863 function hash(data, offset, length, mode384 = false) { 56864 let h0, h1, h2, h3, h4, h5, h6, h7; 56865 56866 if (!mode384) { 56867 h0 = new Word64(0x6a09e667, 0xf3bcc908); 56868 h1 = new Word64(0xbb67ae85, 0x84caa73b); 56869 h2 = new Word64(0x3c6ef372, 0xfe94f82b); 56870 h3 = new Word64(0xa54ff53a, 0x5f1d36f1); 56871 h4 = new Word64(0x510e527f, 0xade682d1); 56872 h5 = new Word64(0x9b05688c, 0x2b3e6c1f); 56873 h6 = new Word64(0x1f83d9ab, 0xfb41bd6b); 56874 h7 = new Word64(0x5be0cd19, 0x137e2179); 56875 } else { 56876 h0 = new Word64(0xcbbb9d5d, 0xc1059ed8); 56877 h1 = new Word64(0x629a292a, 0x367cd507); 56878 h2 = new Word64(0x9159015a, 0x3070dd17); 56879 h3 = new Word64(0x152fecd8, 0xf70e5939); 56880 h4 = new Word64(0x67332667, 0xffc00b31); 56881 h5 = new Word64(0x8eb44a87, 0x68581511); 56882 h6 = new Word64(0xdb0c2e0d, 0x64f98fa7); 56883 h7 = new Word64(0x47b5481d, 0xbefa4fa4); 56884 } 56885 56886 const paddedLength = Math.ceil((length + 17) / 128) * 128; 56887 const padded = new Uint8Array(paddedLength); 56888 let i, j; 56889 56890 for (i = 0; i < length; ++i) { 56891 padded[i] = data[offset++]; 56892 } 56893 56894 padded[i++] = 0x80; 56895 const n = paddedLength - 16; 56896 56897 while (i < n) { 56898 padded[i++] = 0; 56899 } 56900 56901 padded[i++] = 0; 56902 padded[i++] = 0; 56903 padded[i++] = 0; 56904 padded[i++] = 0; 56905 padded[i++] = 0; 56906 padded[i++] = 0; 56907 padded[i++] = 0; 56908 padded[i++] = 0; 56909 padded[i++] = 0; 56910 padded[i++] = 0; 56911 padded[i++] = 0; 56912 padded[i++] = length >>> 29 & 0xff; 56913 padded[i++] = length >> 21 & 0xff; 56914 padded[i++] = length >> 13 & 0xff; 56915 padded[i++] = length >> 5 & 0xff;
56916 padded[i++] = length << 3 & 0xff; 56917 const w = new Array(80); 56918 56919 for (i = 0; i < 80; i++) { 56920 w[i] = new Word64(0, 0); 56921 } 56922 56923 let a = new Word64(0, 0), 56924 b = new Word64(0, 0), 56925 c = new Word64(0, 0); 56926 let d = new Word64(0, 0), 56927 e = new Word64(0, 0), 56928 f = new Word64(0, 0); 56929 let g = new Word64(0, 0), 56930 h = new Word64(0, 0); 56931 const t1 = new Word64(0, 0), 56932 t2 = new Word64(0, 0); 56933 const tmp1 = new Word64(0, 0), 56934 tmp2 = new Word64(0, 0); 56935 let tmp3; 56936 56937 for (i = 0; i < paddedLength;) { 56938 for (j = 0; j < 16; ++j) { 56939 w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 56940 w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7]; 56941 i += 8; 56942 } 56943 56944 for (j = 16; j < 80; ++j) { 56945 tmp3 = w[j]; 56946 littleSigmaPrime(tmp3, w[j - 2], tmp2); 56947 tmp3.add(w[j - 7]); 56948 littleSigma(tmp1, w[j - 15], tmp2); 56949 tmp3.add(tmp1); 56950 tmp3.add(w[j - 16]); 56951 } 56952 56953 a.assign(h0); 56954 b.assign(h1); 56955 c.assign(h2); 56956 d.assign(h3); 56957 e.assign(h4); 56958 f.assign(h5); 56959 g.assign(h6); 56960 h.assign(h7); 56961 56962 for (j = 0; j < 80; ++j) { 56963 t1.assign(h); 56964 sigmaPrime(tmp1, e, tmp2); 56965 t1.add(tmp1); 56966 ch(tmp1, e, f, g, tmp2); 56967 t1.add(tmp1); 56968 t1.add(k[j]); 56969 t1.add(w[j]); 56970 sigma(t2, a, tmp2); 56971 maj(tmp1, a, b, c, tmp2); 56972 t2.add(tmp1); 56973 tmp3 = h; 56974 h = g; 56975 g = f; 56976 f = e; 56977 d.add(t1); 56978 e = d; 56979 d = c; 56980 c = b; 56981 b = a; 56982 tmp3.assign(t1); 56983 tmp3.add(t2); 56984 a = tmp3; 56985 } 56986 56987 h0.add(a); 56988 h1.add(b); 56989 h2.add(c); 56990 h3.add(d); 56991 h4.add(e); 56992 h5.add(f); 56993 h6.add(g); 56994 h7.add(h); 56995 } 56996 56997 let result; 56998 56999 if (!mode384) { 57000 result = new Uint8Array(64); 57001 h0.copyTo(result, 0); 57002 h1.copyTo(result, 8); 57003 h2.copyTo(result, 16); 57004 h3.copyTo(result, 24); 57005 h4.copyTo(result, 32); 57006 h5.copyTo(result, 40); 57007 h6.copyTo(result, 48); 57008 h7.copyTo(result, 56); 57009 } else { 57010 result = new Uint8Array(48); 57011 h0.copyTo(result, 0); 57012 h1.copyTo(result, 8); 57013 h2.copyTo(result, 16); 57014 h3.copyTo(result, 24); 57015 h4.copyTo(result, 32); 57016 h5.copyTo(result, 40); 57017 } 57018 57019 return result; 57020 } 57021 57022 return hash; 57023}(); 57024 57025exports.calculateSHA512 = calculateSHA512; 57026 57027function calculateSHA384(data, offset, length) { 57028 return calculateSHA512(data, offset, length, true); 57029} 57030 57031class NullCipher { 57032 decryptBlock(data) { 57033 return data; 57034 } 57035 57036 encrypt(data) { 57037 return data; 57038 } 57039 57040} 57041 57042class AESBaseCipher { 57043 constructor() { 57044 if (this.constructor === AESBaseCipher) { 57045 (0, _util.unreachable)("Cannot initialize AESBaseCipher."); 57046 } 57047 57048 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]); 57049 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,
570490xfa, 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]); 57050 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: 6,242 bytes, lines 57050-57316
57050c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]); 57051 this._mixCol = new Uint8Array(256); 57052 57053 for (let i = 0; i < 256; i++) { 57054 if (i < 128) { 57055 this._mixCol[i] = i << 1; 57056 } else { 57057 this._mixCol[i] = i << 1 ^ 0x1b; 57058 } 57059 } 57060 57061 this.buffer = new Uint8Array(16); 57062 this.bufferPosition = 0; 57063 } 57064 57065 _expandKey(cipherKey) { 57066 (0, _util.unreachable)("Cannot call `_expandKey` on the base class"); 57067 } 57068 57069 _decrypt(input, key) { 57070 let t, u, v; 57071 const state = new Uint8Array(16); 57072 state.set(input); 57073 57074 for (let j = 0, k = this._keySize; j < 16; ++j, ++k) { 57075 state[j] ^= key[k]; 57076 } 57077 57078 for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) { 57079 t = state[13]; 57080 state[13] = state[9]; 57081 state[9] = state[5]; 57082 state[5] = state[1]; 57083 state[1] = t; 57084 t = state[14]; 57085 u = state[10]; 57086 state[14] = state[6]; 57087 state[10] = state[2]; 57088 state[6] = t; 57089 state[2] = u; 57090 t = state[15]; 57091 u = state[11]; 57092 v = state[7]; 57093 state[15] = state[3]; 57094 state[11] = t; 57095 state[7] = u; 57096 state[3] = v; 57097 57098 for (let j = 0; j < 16; ++j) { 57099 state[j] = this._inv_s[state[j]]; 57100 } 57101 57102 for (let j = 0, k = i * 16; j < 16; ++j, ++k) { 57103 state[j] ^= key[k]; 57104 } 57105 57106 for (let j = 0; j < 16; j += 4) { 57107 const s0 = this._mix[state[j]]; 57108 const s1 = this._mix[state[j + 1]]; 57109 const s2 = this._mix[state[j + 2]]; 57110 const s3 = this._mix[state[j + 3]]; 57111 t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8; 57112 state[j] = t >>> 24 & 0xff; 57113 state[j + 1] = t >> 16 & 0xff; 57114 state[j + 2] = t >> 8 & 0xff; 57115 state[j + 3] = t & 0xff; 57116 } 57117 } 57118 57119 t = state[13]; 57120 state[13] = state[9]; 57121 state[9] = state[5]; 57122 state[5] = state[1]; 57123 state[1] = t; 57124 t = state[14]; 57125 u = state[10]; 57126 state[14] = state[6]; 57127 state[10] = state[2]; 57128 state[6] = t; 57129 state[2] = u; 57130 t = state[15]; 57131 u = state[11]; 57132 v = state[7]; 57133 state[15] = state[3]; 57134 state[11] = t; 57135 state[7] = u; 57136 state[3] = v; 57137 57138 for (let j = 0; j < 16; ++j) { 57139 state[j] = this._inv_s[state[j]]; 57140 state[j] ^= key[j]; 57141 } 57142 57143 return state; 57144 } 57145 57146 _encrypt(input, key) { 57147 const s = this._s; 57148 let t, u, v; 57149 const state = new Uint8Array(16); 57150 state.set(input); 57151 57152 for (let j = 0; j < 16; ++j) { 57153 state[j] ^= key[j]; 57154 } 57155 57156 for (let i = 1; i < this._cyclesOfRepetition; i++) { 57157 for (let j = 0; j < 16; ++j) { 57158 state[j] = s[state[j]]; 57159 } 57160 57161 v = state[1]; 57162 state[1] = state[5]; 57163 state[5] = state[9]; 57164 state[9] = state[13]; 57165 state[13] = v; 57166 v = state[2]; 57167 u = state[6]; 57168 state[2] = state[10]; 57169 state[6] = state[14]; 57170 state[10] = v; 57171 state[14] = u; 57172 v = state[3]; 57173 u = state[7]; 57174 t = state[11]; 57175 state[3] = state[15]; 57176 state[7] = v; 57177 state[11] = u; 57178 state[15] = t; 57179 57180 for (let j = 0; j < 16; j += 4) { 57181 const s0 = state[j + 0]; 57182 const s1 = state[j + 1]; 57183 const s2 = state[j + 2]; 57184 const s3 = state[j + 3]; 57185 t = s0 ^ s1 ^ s2 ^ s3; 57186 state[j + 0] ^= t ^ this._mixCol[s0 ^ s1]; 57187 state[j + 1] ^= t ^ this._mixCol[s1 ^ s2]; 57188 state[j + 2] ^= t ^ this._mixCol[s2 ^ s3]; 57189 state[j + 3] ^= t ^ this._mixCol[s3 ^ s0]; 57190 } 57191 57192 for (let j = 0, k = i * 16; j < 16; ++j, ++k) { 57193 state[j] ^= key[k]; 57194 } 57195 } 57196 57197 for (let j = 0; j < 16; ++j) { 57198 state[j] = s[state[j]]; 57199 } 57200 57201 v = state[1]; 57202 state[1] = state[5]; 57203 state[5] = state[9]; 57204 state[9] = state[13]; 57205 state[13] = v; 57206 v = state[2]; 57207 u = state[6]; 57208 state[2] = state[10]; 57209 state[6] = state[14]; 57210 state[10] = v; 57211 state[14] = u; 57212 v = state[3]; 57213 u = state[7]; 57214 t = state[11]; 57215 state[3] = state[15]; 57216 state[7] = v; 57217 state[11] = u; 57218 state[15] = t; 57219 57220 for (let j = 0, k = this._keySize; j < 16; ++j, ++k) { 57221 state[j] ^= key[k]; 57222 } 57223 57224 return state; 57225 } 57226 57227 _decryptBlock2(data, finalize) { 57228 const sourceLength = data.length; 57229 let buffer = this.buffer, 57230 bufferLength = this.bufferPosition; 57231 const result = []; 57232 let iv = this.iv; 57233 57234 for (let i = 0; i < sourceLength; ++i) { 57235 buffer[bufferLength] = data[i]; 57236 ++bufferLength; 57237 57238 if (bufferLength < 16) { 57239 continue; 57240 } 57241 57242 const plain = this._decrypt(buffer, this._key); 57243 57244 for (let j = 0; j < 16; ++j) { 57245 plain[j] ^= iv[j]; 57246 } 57247 57248 iv = buffer; 57249 result.push(plain); 57250 buffer = new Uint8Array(16); 57251 bufferLength = 0; 57252 } 57253 57254 this.buffer = buffer; 57255 this.bufferLength = bufferLength; 57256 this.iv = iv; 57257 57258 if (result.length === 0) { 57259 return new Uint8Array(0); 57260 } 57261 57262 let outputLength = 16 * result.length; 57263 57264 if (finalize) { 57265 const lastBlock = result[result.length - 1]; 57266 let psLen = lastBlock[15]; 57267 57268 if (psLen <= 16) { 57269 for (let i = 15, ii = 16 - psLen; i >= ii; --i) { 57270 if (lastBlock[i] !== psLen) { 57271 psLen = 0; 57272 break; 57273 } 57274 } 57275 57276 outputLength -= psLen; 57277 result[result.length - 1] = lastBlock.subarray(0, 16 - psLen); 57278 } 57279 } 57280 57281 const output = new Uint8Array(outputLength); 57282 57283 for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 57284 output.set(result[i], j); 57285 } 57286 57287 return output; 57288 } 57289 57290 decryptBlock(data, finalize, iv = null) { 57291 const sourceLength = data.length; 57292 const buffer = this.buffer; 57293 let bufferLength = this.bufferPosition; 57294 57295 if (iv) { 57296 this.iv = iv; 57297 } else { 57298 for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) { 57299 buffer[bufferLength] = data[i]; 57300 } 57301 57302 if (bufferLength < 16) { 57303 this.bufferLength = bufferLength; 57304 return new Uint8Array(0); 57305 } 57306 57307 this.iv = buffer; 57308 data = data.subarray(16); 57309 } 57310 57311 this.buffer = new Uint8Array(16); 57312 this.bufferLength = 0; 57313 this.decryptBlock = this._decryptBlock2; 57314 return this.decryptBlock(data, finalize); 57315 } 57316
vendor: 4,318 bytes, lines 57317-57447
57317 encrypt(data, iv) { 57318 const sourceLength = data.length; 57319 let buffer = this.buffer, 57320 bufferLength = this.bufferPosition; 57321 const result = []; 57322 57323 if (!iv) { 57324 iv = new Uint8Array(16); 57325 } 57326 57327 for (let i = 0; i < sourceLength; ++i) { 57328 buffer[bufferLength] = data[i]; 57329 ++bufferLength; 57330 57331 if (bufferLength < 16) { 57332 continue; 57333 } 57334 57335 for (let j = 0; j < 16; ++j) { 57336 buffer[j] ^= iv[j]; 57337 } 57338 57339 const cipher = this._encrypt(buffer, this._key); 57340 57341 iv = cipher; 57342 result.push(cipher); 57343 buffer = new Uint8Array(16); 57344 bufferLength = 0; 57345 } 57346 57347 this.buffer = buffer; 57348 this.bufferLength = bufferLength; 57349 this.iv = iv; 57350 57351 if (result.length === 0) { 57352 return new Uint8Array(0); 57353 } 57354 57355 const outputLength = 16 * result.length; 57356 const output = new Uint8Array(outputLength); 57357 57358 for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 57359 output.set(result[i], j); 57360 } 57361 57362 return output; 57363 } 57364 57365} 57366 57367class AES128Cipher extends AESBaseCipher { 57368 constructor(key) { 57369 super(); 57370 this._cyclesOfRepetition = 10; 57371 this._keySize = 160; 57372 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]); 57373 this._key = this._expandKey(key); 57374 } 57375 57376 _expandKey(cipherKey) { 57377 const b = 176; 57378 const s = this._s; 57379 const rcon = this._rcon; 57380 const result = new Uint8Array(b); 57381 result.set(cipherKey); 57382 57383 for (let j = 16, i = 1; j < b; ++i) { 57384 let t1 = result[j - 3]; 57385 let t2 = result[j - 2]; 57386 let t3 = result[j - 1]; 57387 let t4 = result[j - 4]; 57388 t1 = s[t1]; 57389 t2 = s[t2]; 57390 t3 = s[t3]; 57391 t4 = s[t4]; 57392 t1 ^= rcon[i]; 57393 57394 for (let n = 0; n < 4; ++n) { 57395 result[j] = t1 ^= result[j - 16]; 57396 j++; 57397 result[j] = t2 ^= result[j - 16]; 57398 j++; 57399 result[j] = t3 ^= result[j - 16]; 57400 j++; 57401 result[j] = t4 ^= result[j - 16]; 57402 j++; 57403 } 57404 } 57405 57406 return result; 57407 } 57408 57409} 57410 57411exports.AES128Cipher = AES128Cipher; 57412 57413class AES256Cipher extends AESBaseCipher { 57414 constructor(key) { 57415 super(); 57416 this._cyclesOfRepetition = 14; 57417 this._keySize = 224; 57418 this._key = this._expandKey(key); 57419 } 57420 57421 _expandKey(cipherKey) { 57422 const b = 240; 57423 const s = this._s; 57424 const result = new Uint8Array(b); 57425 result.set(cipherKey); 57426 let r = 1; 57427 let t1, t2, t3, t4; 57428 57429 for (let j = 32, i = 1; j < b; ++i) { 57430 if (j % 32 === 16) { 57431 t1 = s[t1]; 57432 t2 = s[t2]; 57433 t3 = s[t3]; 57434 t4 = s[t4]; 57435 } else if (j % 32 === 0) { 57436 t1 = result[j - 3]; 57437 t2 = result[j - 2]; 57438 t3 = result[j - 1]; 57439 t4 = result[j - 4]; 57440 t1 = s[t1]; 57441 t2 = s[t2]; 57442 t3 = s[t3]; 57443 t4 = s[t4]; 57444 t1 ^= r; 57445 57446 if ((r <<= 1) >= 256) { 57447 r = (r ^ 0x1b) & 0xff;
57448 } 57449 } 57450 57451 for (let n = 0; n < 4; ++n) { 57452 result[j] = t1 ^= result[j - 32]; 57453 j++; 57454 result[j] = t2 ^= result[j - 32]; 57455 j++; 57456 result[j] = t3 ^= result[j - 32]; 57457 j++; 57458 result[j] = t4 ^= result[j - 32]; 57459 j++; 57460 } 57461 } 57462 57463 return result; 57464 } 57465 57466} 57467 57468exports.AES256Cipher = AES256Cipher; 57469 57470class PDF17 { 57471 checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 57472 const hashData = new Uint8Array(password.length + 56); 57473 hashData.set(password, 0); 57474 hashData.set(ownerValidationSalt, password.length); 57475 hashData.set(userBytes, password.length + ownerValidationSalt.length); 57476 const result = calculateSHA256(hashData, 0, hashData.length); 57477 return (0, _util.isArrayEqual)(result, ownerPassword); 57478 } 57479 57480 checkUserPassword(password, userValidationSalt, userPassword) { 57481 const hashData = new Uint8Array(password.length + 8); 57482 hashData.set(password, 0); 57483 hashData.set(userValidationSalt, password.length); 57484 const result = calculateSHA256(hashData, 0, hashData.length); 57485 return (0, _util.isArrayEqual)(result, userPassword); 57486 } 57487 57488 getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 57489 const hashData = new Uint8Array(password.length + 56); 57490 hashData.set(password, 0); 57491 hashData.set(ownerKeySalt, password.length); 57492 hashData.set(userBytes, password.length + ownerKeySalt.length); 57493 const key = calculateSHA256(hashData, 0, hashData.length); 57494 const cipher = new AES256Cipher(key); 57495 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 57496 } 57497 57498 getUserKey(password, userKeySalt, userEncryption) { 57499 const hashData = new Uint8Array(password.length + 8); 57500 hashData.set(password, 0); 57501 hashData.set(userKeySalt, password.length); 57502 const key = calculateSHA256(hashData, 0, hashData.length); 57503 const cipher = new AES256Cipher(key); 57504 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 57505 } 57506 57507} 57508 57509exports.PDF17 = PDF17; 57510 57511const PDF20 = function PDF20Closure() { 57512 function calculatePDF20Hash(password, input, userBytes) { 57513 let k = calculateSHA256(input, 0, input.length).subarray(0, 32); 57514 let e = [0]; 57515 let i = 0; 57516 57517 while (i < 64 || e[e.length - 1] > i - 32) { 57518 const combinedLength = password.length + k.length + userBytes.length, 57519 combinedArray = new Uint8Array(combinedLength); 57520 let writeOffset = 0; 57521 combinedArray.set(password, writeOffset); 57522 writeOffset += password.length; 57523 combinedArray.set(k, writeOffset); 57524 writeOffset += k.length; 57525 combinedArray.set(userBytes, writeOffset); 57526 const k1 = new Uint8Array(combinedLength * 64); 57527 57528 for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) { 57529 k1.set(combinedArray, pos); 57530 } 57531 57532 const cipher = new AES128Cipher(k.subarray(0, 16)); 57533 e = cipher.encrypt(k1, k.subarray(16, 32)); 57534 let remainder = 0; 57535 57536 for (let z = 0; z < 16; z++) { 57537 remainder *= 256 % 3; 57538 remainder %= 3; 57539 remainder += (e[z] >>> 0) % 3; 57540 remainder %= 3; 57541 } 57542 57543 if (remainder === 0) { 57544 k = calculateSHA256(e, 0, e.length); 57545 } else if (remainder === 1) { 57546 k = calculateSHA384(e, 0, e.length); 57547 } else if (remainder === 2) { 57548 k = calculateSHA512(e, 0, e.length); 57549 } 57550 57551 i++; 57552 } 57553 57554 return k.subarray(0, 32); 57555 } 57556 57557 class PDF20 { 57558 hash(password, concatBytes, userBytes) { 57559 return calculatePDF20Hash(password, concatBytes, userBytes); 57560 } 57561 57562 checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 57563 const hashData = new Uint8Array(password.length + 56); 57564 hashData.set(password, 0); 57565 hashData.set(ownerValidationSalt, password.length); 57566 hashData.set(userBytes, password.length + ownerValidationSalt.length); 57567 const result = calculatePDF20Hash(password, hashData, userBytes); 57568 return (0, _util.isArrayEqual)(result, ownerPassword); 57569 } 57570 57571 checkUserPassword(password, userValidationSalt, userPassword) { 57572 const hashData = new Uint8Array(password.length + 8); 57573 hashData.set(password, 0); 57574 hashData.set(userValidationSalt, password.length); 57575 const result = calculatePDF20Hash(password, hashData, []); 57576 return (0, _util.isArrayEqual)(result, userPassword); 57577 } 57578
57579 getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 57580 const hashData = new Uint8Array(password.length + 56); 57581 hashData.set(password, 0); 57582 hashData.set(ownerKeySalt, password.length); 57583 hashData.set(userBytes, password.length + ownerKeySalt.length); 57584 const key = calculatePDF20Hash(password, hashData, userBytes); 57585 const cipher = new AES256Cipher(key); 57586 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 57587 } 57588 57589 getUserKey(password, userKeySalt, userEncryption) { 57590 const hashData = new Uint8Array(password.length + 8); 57591 hashData.set(password, 0); 57592 hashData.set(userKeySalt, password.length); 57593 const key = calculatePDF20Hash(password, hashData, []); 57594 const cipher = new AES256Cipher(key); 57595 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 57596 } 57597 57598 } 57599 57600 return PDF20; 57601}(); 57602 57603exports.PDF20 = PDF20; 57604 57605class CipherTransform { 57606 constructor(stringCipherConstructor, streamCipherConstructor) { 57607 this.StringCipherConstructor = stringCipherConstructor; 57608 this.StreamCipherConstructor = streamCipherConstructor; 57609 } 57610 57611 createStream(stream, length) { 57612 const cipher = new this.StreamCipherConstructor(); 57613 return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) { 57614 return cipher.decryptBlock(data, finalize); 57615 }); 57616 } 57617 57618 decryptString(s) { 57619 const cipher = new this.StringCipherConstructor(); 57620 let data = (0, _util.stringToBytes)(s); 57621 data = cipher.decryptBlock(data, true); 57622 return (0, _util.bytesToString)(data); 57623 } 57624 57625 encryptString(s) { 57626 const cipher = new this.StringCipherConstructor(); 57627 57628 if (cipher instanceof AESBaseCipher) { 57629 const strLen = s.length; 57630 const pad = 16 - strLen % 16; 57631 s += String.fromCharCode(pad).repeat(pad); 57632 const iv = new Uint8Array(16); 57633 57634 if (typeof crypto !== "undefined") { 57635 crypto.getRandomValues(iv); 57636 } else { 57637 for (let i = 0; i < 16; i++) { 57638 iv[i] = Math.floor(256 * Math.random()); 57639 } 57640 } 57641 57642 let data = (0, _util.stringToBytes)(s); 57643 data = cipher.encrypt(data, iv); 57644 const buf = new Uint8Array(16 + data.length); 57645 buf.set(iv); 57646 buf.set(data, 16); 57647 return (0, _util.bytesToString)(buf); 57648 } 57649 57650 let data = (0, _util.stringToBytes)(s); 57651 data = cipher.encrypt(data); 57652 return (0, _util.bytesToString)(data); 57653 } 57654 57655} 57656 57657const CipherTransformFactory = function CipherTransformFactoryClosure() { 57658 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]); 57659 57660 function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) { 57661 if (password) { 57662 const passwordLength = Math.min(127, password.length); 57663 password = password.subarray(0, passwordLength); 57664 } else { 57665 password = []; 57666 } 57667 57668 let pdfAlgorithm; 57669 57670 if (revision === 6) { 57671 pdfAlgorithm = new PDF20(); 57672 } else { 57673 pdfAlgorithm = new PDF17(); 57674 } 57675 57676 if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) { 57677 return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption); 57678 } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) { 57679 return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption); 57680 } 57681 57682 return null; 57683 } 57684 57685 function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) { 57686 const hashDataSize = 40 + ownerPassword.length + fileId.length; 57687 const hashData = new Uint8Array(hashDataSize); 57688 let i = 0, 57689 j, 57690 n; 57691 57692 if (password) { 57693 n = Math.min(32, password.length); 57694 57695 for (; i < n; ++i) { 57696 hashData[i] = password[i]; 57697 } 57698 } 57699 57700 j = 0; 57701 57702 while (i < 32) { 57703 hashData[i++] = defaultPasswordBytes[j++]; 57704 } 57705 57706 for (j = 0, n = ownerPassword.length; j < n; ++j) { 57707 hashData[i++] = ownerPassword[j]; 57708 } 57709 57710 hashData[i++] = flags & 0xff;
57711 hashData[i++] = flags >> 8 & 0xff; 57712 hashData[i++] = flags >> 16 & 0xff; 57713 hashData[i++] = flags >>> 24 & 0xff; 57714 57715 for (j = 0, n = fileId.length; j < n; ++j) { 57716 hashData[i++] = fileId[j]; 57717 } 57718 57719 if (revision >= 4 && !encryptMetadata) { 57720 hashData[i++] = 0xff; 57721 hashData[i++] = 0xff; 57722 hashData[i++] = 0xff; 57723 hashData[i++] = 0xff; 57724 } 57725 57726 let hash = calculateMD5(hashData, 0, i); 57727 const keyLengthInBytes = keyLength >> 3; 57728 57729 if (revision >= 3) { 57730 for (j = 0; j < 50; ++j) { 57731 hash = calculateMD5(hash, 0, keyLengthInBytes); 57732 } 57733 } 57734 57735 const encryptionKey = hash.subarray(0, keyLengthInBytes); 57736 let cipher, checkData; 57737 57738 if (revision >= 3) { 57739 for (i = 0; i < 32; ++i) { 57740 hashData[i] = defaultPasswordBytes[i]; 57741 } 57742 57743 for (j = 0, n = fileId.length; j < n; ++j) { 57744 hashData[i++] = fileId[j]; 57745 } 57746 57747 cipher = new ARCFourCipher(encryptionKey); 57748 checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i)); 57749 n = encryptionKey.length; 57750 const derivedKey = new Uint8Array(n); 57751 57752 for (j = 1; j <= 19; ++j) { 57753 for (let k = 0; k < n; ++k) { 57754 derivedKey[k] = encryptionKey[k] ^ j; 57755 } 57756 57757 cipher = new ARCFourCipher(derivedKey); 57758 checkData = cipher.encryptBlock(checkData); 57759 } 57760 57761 for (j = 0, n = checkData.length; j < n; ++j) { 57762 if (userPassword[j] !== checkData[j]) { 57763 return null; 57764 } 57765 } 57766 } else { 57767 cipher = new ARCFourCipher(encryptionKey); 57768 checkData = cipher.encryptBlock(defaultPasswordBytes); 57769 57770 for (j = 0, n = checkData.length; j < n; ++j) { 57771 if (userPassword[j] !== checkData[j]) { 57772 return null; 57773 } 57774 } 57775 } 57776 57777 return encryptionKey; 57778 } 57779 57780 function decodeUserPassword(password, ownerPassword, revision, keyLength) { 57781 const hashData = new Uint8Array(32); 57782 let i = 0; 57783 const n = Math.min(32, password.length); 57784 57785 for (; i < n; ++i) { 57786 hashData[i] = password[i]; 57787 } 57788 57789 let j = 0; 57790 57791 while (i < 32) { 57792 hashData[i++] = defaultPasswordBytes[j++]; 57793 } 57794 57795 let hash = calculateMD5(hashData, 0, i); 57796 const keyLengthInBytes = keyLength >> 3; 57797 57798 if (revision >= 3) { 57799 for (j = 0; j < 50; ++j) { 57800 hash = calculateMD5(hash, 0, hash.length); 57801 } 57802 } 57803 57804 let cipher, userPassword; 57805 57806 if (revision >= 3) { 57807 userPassword = ownerPassword; 57808 const derivedKey = new Uint8Array(keyLengthInBytes); 57809 57810 for (j = 19; j >= 0; j--) { 57811 for (let k = 0; k < keyLengthInBytes; ++k) { 57812 derivedKey[k] = hash[k] ^ j; 57813 } 57814 57815 cipher = new ARCFourCipher(derivedKey); 57816 userPassword = cipher.encryptBlock(userPassword); 57817 } 57818 } else { 57819 cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes)); 57820 userPassword = cipher.encryptBlock(ownerPassword); 57821 } 57822 57823 return userPassword; 57824 } 57825 57826 const identityName = _primitives.Name.get("Identity"); 57827 57828 function buildObjectKey(num, gen, encryptionKey, isAes = false) { 57829 const key = new Uint8Array(encryptionKey.length + 9); 57830 const n = encryptionKey.length; 57831 let i; 57832 57833 for (i = 0; i < n; ++i) { 57834 key[i] = encryptionKey[i]; 57835 } 57836 57837 key[i++] = num & 0xff; 57838 key[i++] = num >> 8 & 0xff; 57839 key[i++] = num >> 16 & 0xff; 57840 key[i++] = gen & 0xff; 57841 key[i++] = gen >> 8 & 0xff; 57842 57843 if (isAes) { 57844 key[i++] = 0x73; 57845 key[i++] = 0x41; 57846 key[i++] = 0x6c; 57847 key[i++] = 0x54; 57848 } 57849 57850 const hash = calculateMD5(key, 0, i); 57851 return hash.subarray(0, Math.min(encryptionKey.length + 5, 16)); 57852 } 57853 57854 function buildCipherConstructor(cf, name, num, gen, key) { 57855 if (!(0, _primitives.isName)(name)) { 57856 throw new _util.FormatError("Invalid crypt filter name."); 57857 } 57858 57859 const cryptFilter = cf.get(name.name); 57860 let cfm; 57861
57862 if (cryptFilter !== null && cryptFilter !== undefined) { 57863 cfm = cryptFilter.get("CFM"); 57864 } 57865 57866 if (!cfm || cfm.name === "None") { 57867 return function cipherTransformFactoryBuildCipherConstructorNone() { 57868 return new NullCipher(); 57869 }; 57870 } 57871 57872 if (cfm.name === "V2") { 57873 return function cipherTransformFactoryBuildCipherConstructorV2() { 57874 return new ARCFourCipher(buildObjectKey(num, gen, key, false)); 57875 }; 57876 } 57877 57878 if (cfm.name === "AESV2") { 57879 return function cipherTransformFactoryBuildCipherConstructorAESV2() { 57880 return new AES128Cipher(buildObjectKey(num, gen, key, true)); 57881 }; 57882 } 57883 57884 if (cfm.name === "AESV3") { 57885 return function cipherTransformFactoryBuildCipherConstructorAESV3() { 57886 return new AES256Cipher(key); 57887 }; 57888 } 57889 57890 throw new _util.FormatError("Unknown crypto method"); 57891 } 57892 57893 class CipherTransformFactory { 57894 constructor(dict, fileId, password) { 57895 const filter = dict.get("Filter"); 57896 57897 if (!(0, _primitives.isName)(filter, "Standard")) { 57898 throw new _util.FormatError("unknown encryption method"); 57899 } 57900 57901 this.filterName = filter.name; 57902 this.dict = dict; 57903 const algorithm = dict.get("V"); 57904 57905 if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) { 57906 throw new _util.FormatError("unsupported encryption algorithm"); 57907 } 57908 57909 this.algorithm = algorithm; 57910 let keyLength = dict.get("Length"); 57911 57912 if (!keyLength) { 57913 if (algorithm <= 3) { 57914 keyLength = 40; 57915 } else { 57916 const cfDict = dict.get("CF"); 57917 const streamCryptoName = dict.get("StmF"); 57918 57919 if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) { 57920 cfDict.suppressEncryption = true; 57921 const handlerDict = cfDict.get(streamCryptoName.name); 57922 keyLength = handlerDict && handlerDict.get("Length") || 128; 57923 57924 if (keyLength < 40) { 57925 keyLength <<= 3; 57926 } 57927 } 57928 } 57929 } 57930 57931 if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) { 57932 throw new _util.FormatError("invalid key length"); 57933 } 57934 57935 const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32); 57936 const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32); 57937 const flags = dict.get("P"); 57938 const revision = dict.get("R"); 57939 const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false; 57940 this.encryptMetadata = encryptMetadata; 57941 const fileIdBytes = (0, _util.stringToBytes)(fileId); 57942 let passwordBytes; 57943 57944 if (password) { 57945 if (revision === 6) { 57946 try { 57947 password = (0, _util.utf8StringToString)(password); 57948 } catch (ex) { 57949 (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password."); 57950 } 57951 } 57952 57953 passwordBytes = (0, _util.stringToBytes)(password); 57954 } 57955 57956 let encryptionKey; 57957 57958 if (algorithm !== 5) { 57959 encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 57960 } else { 57961 const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40); 57962 const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48); 57963 const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48); 57964 const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40); 57965 const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48); 57966 const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE")); 57967 const userEncryption = (0, _util.stringToBytes)(dict.get("UE")); 57968 const perms = (0, _util.stringToBytes)(dict.get("Perms")); 57969 encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms); 57970 } 57971 57972 if (!encryptionKey && !password) { 57973 throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD); 57974 } else if (!encryptionKey && password) { 57975 const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength); 57976 encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 57977 } 57978 57979 if (!encryptionKey) { 57980 throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD); 57981 } 57982 57983 this.encryptionKey = encryptionKey; 57984 57985 if (algorithm >= 4) { 57986 const cf = dict.get("CF"); 57987 57988 if ((0, _primitives.isDict)(cf)) {
57989 cf.suppressEncryption = true; 57990 } 57991 57992 this.cf = cf; 57993 this.stmf = dict.get("StmF") || identityName; 57994 this.strf = dict.get("StrF") || identityName; 57995 this.eff = dict.get("EFF") || this.stmf; 57996 } 57997 } 57998 57999 createCipherTransform(num, gen) { 58000 if (this.algorithm === 4 || this.algorithm === 5) { 58001 return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey)); 58002 } 58003 58004 const key = buildObjectKey(num, gen, this.encryptionKey, false); 58005 58006 const cipherConstructor = function buildCipherCipherConstructor() { 58007 return new ARCFourCipher(key); 58008 }; 58009 58010 return new CipherTransform(cipherConstructor, cipherConstructor); 58011 } 58012 58013 } 58014 58015 return CipherTransformFactory; 58016}(); 58017 58018exports.CipherTransformFactory = CipherTransformFactory; 58019 58020/***/ }), 58021/* 73 */ 58022/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 58023 58024 58025 58026Object.defineProperty(exports, "__esModule", ({ 58027 value: true 58028})); 58029exports.DecryptStream = void 0; 58030 58031var _decode_stream = __w_pdfjs_require__(29); 58032 58033const chunkSize = 512; 58034 58035class DecryptStream extends _decode_stream.DecodeStream { 58036 constructor(str, maybeLength, decrypt) { 58037 super(maybeLength); 58038 this.str = str; 58039 this.dict = str.dict; 58040 this.decrypt = decrypt; 58041 this.nextChunk = null; 58042 this.initialized = false; 58043 } 58044 58045 readBlock() {
58046 let chunk; 58047 58048 if (this.initialized) { 58049 chunk = this.nextChunk; 58050 } else { 58051 chunk = this.str.getBytes(chunkSize); 58052 this.initialized = true; 58053 } 58054 58055 if (!chunk || chunk.length === 0) { 58056 this.eof = true; 58057 return; 58058 } 58059 58060 this.nextChunk = this.str.getBytes(chunkSize); 58061 const hasMoreData = this.nextChunk && this.nextChunk.length > 0; 58062 const decrypt = this.decrypt; 58063 chunk = decrypt(chunk, !hasMoreData); 58064 let bufferLength = this.bufferLength; 58065 const n = chunk.length, 58066 buffer = this.ensureBuffer(bufferLength + n); 58067 58068 for (let i = 0; i < n; i++) { 58069 buffer[bufferLength++] = chunk[i]; 58070 } 58071 58072 this.bufferLength = bufferLength; 58073 } 58074 58075} 58076 58077exports.DecryptStream = DecryptStream; 58078 58079/***/ }), 58080/* 74 */ 58081/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 58082 58083 58084 58085Object.defineProperty(exports, "__esModule", ({ 58086 value: true 58087})); 58088exports.XFAFactory = void 0; 58089 58090var _xfa_object = __w_pdfjs_require__(75); 58091 58092var _bind = __w_pdfjs_require__(79); 58093 58094var _data = __w_pdfjs_require__(85); 58095 58096var _fonts = __w_pdfjs_require__(83); 58097 58098var _utils = __w_pdfjs_require__(76); 58099 58100var _util = __w_pdfjs_require__(2); 58101 58102var _parser = __w_pdfjs_require__(86); 58103 58104var _xhtml = __w_pdfjs_require__(96); 58105 58106class XFAFactory { 58107 constructor(data) { 58108 try { 58109 this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data)); 58110 const binder = new _bind.Binder(this.root); 58111 this.form = binder.bind(); 58112 this.dataHandler = new _data.DataHandler(this.root, binder.getData()); 58113 this.form[_xfa_object.$globalData].template = this.form; 58114 } catch (e) { 58115 (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`); 58116 } 58117 } 58118 58119 isValid() { 58120 return this.root && this.form; 58121 } 58122 58123 _createPagesHelper() { 58124 const iterator = this.form[_xfa_object.$toPages](); 58125 58126 return new Promise((resolve, reject) => { 58127 const nextIteration = () => { 58128 try { 58129 const value = iterator.next(); 58130 58131 if (value.done) { 58132 resolve(value.value); 58133 } else { 58134 setTimeout(nextIteration, 0); 58135 } 58136 } catch (e) { 58137 reject(e); 58138 } 58139 }; 58140 58141 setTimeout(nextIteration, 0); 58142 }); 58143 } 58144 58145 async _createPages() { 58146 try { 58147 this.pages = await this._createPagesHelper(); 58148 this.dims = this.pages.children.map(c => { 58149 const { 58150 width, 58151 height 58152 } = c.attributes.style; 58153 return [0, 0, parseInt(width), parseInt(height)]; 58154 }); 58155 } catch (e) { 58156 (0, _util.warn)(`XFA - an error occurred during layout: ${e}`); 58157 } 58158 } 58159 58160 getBoundingBox(pageIndex) { 58161 return this.dims[pageIndex]; 58162 } 58163 58164 async getNumPages() { 58165 if (!this.pages) { 58166 await this._createPages(); 58167 } 58168 58169 return this.dims.length; 58170 } 58171 58172 setImages(images) { 58173 this.form[_xfa_object.$globalData].images = images; 58174 } 58175 58176 setFonts(fonts) { 58177 this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts); 58178 const missingFonts = []; 58179 58180 for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) { 58181 typeface = (0, _utils.stripQuotes)(typeface); 58182 58183 const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface); 58184 58185 if (!font) { 58186 missingFonts.push(typeface); 58187 } 58188 } 58189 58190 if (missingFonts.length > 0) { 58191 return missingFonts; 58192 } 58193 58194 return null; 58195 } 58196 58197 appendFonts(fonts, reallyMissingFonts) { 58198 this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts); 58199 } 58200 58201 async getPages() { 58202 if (!this.pages) { 58203 await this._createPages(); 58204 } 58205 58206 const pages = this.pages; 58207 this.pages = null; 58208 return pages; 58209 } 58210 58211 serializeData(storage) { 58212 return this.dataHandler.serialize(storage); 58213 } 58214 58215 static _createDocument(data) { 58216 if (!data["/xdp:xdp"]) { 58217 return data["xdp:xdp"]; 58218 } 58219 58220 return Object.values(data).join(""); 58221 } 58222 58223 static getRichTextAsHtml(rc) { 58224 if (!rc || typeof rc !== "string") { 58225 return null; 58226 } 58227 58228 try { 58229 let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc
58229); 58230 58231 if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) { 58232 const newRoot = _xhtml.XhtmlNamespace.body({}); 58233 58234 newRoot[_xfa_object.$appendChild](root); 58235 58236 root = newRoot; 58237 } 58238 58239 const result = root[_xfa_object.$toHTML](); 58240 58241 if (!result.success) { 58242 return null; 58243 } 58244 58245 const { 58246 html 58247 } = result; 58248 const { 58249 attributes 58250 } = html; 58251 58252 if (attributes) { 58253 if (attributes.class) { 58254 attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa")); 58255 } 58256 58257 attributes.dir = "auto"; 58258 } 58259 58260 return { 58261 html, 58262 str: root[_xfa_object.$text]() 58263 }; 58264 } catch (e) { 58265 (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`); 58266 } 58267 58268 return null; 58269 } 58270 58271} 58272 58273exports.XFAFactory = XFAFactory; 58274 58275/***/ }), 58276/* 75 */ 58277/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 58278 58279 58280 58281Object.defineProperty(exports, "__esModule", ({ 58282 value: true 58283})); 58284exports.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; 58285 58286var _utils = __w_pdfjs_require__(76); 58287 58288var _util = __w_pdfjs_require__(2); 58289 58290var _core_utils = __w_pdfjs_require__(9); 58291 58292var _namespaces = __w_pdfjs_require__(77); 58293 58294var _som = __w_pdfjs_require__(78); 58295 58296const $acceptWhitespace = Symbol(); 58297exports.$acceptWhitespace = $acceptWhitespace; 58298const $addHTML = Symbol(); 58299exports.$addHTML = $addHTML; 58300const $appendChild = Symbol(); 58301exports.$appendChild = $appendChild; 58302const $childrenToHTML = Symbol(); 58303exports.$childrenToHTML = $childrenToHTML; 58304const $clean = Symbol(); 58305exports.$clean = $clean; 58306const $cleanPage = Symbol(); 58307exports.$cleanPage = $cleanPage; 58308const $cleanup = Symbol(); 58309exports.$cleanup = $cleanup; 58310const $clone = Symbol(); 58311exports.$clone = $clone; 58312const $consumed = Symbol(); 58313exports.$consumed = $consumed; 58314const $content = Symbol("content"); 58315exports.$content = $content; 58316const $data = Symbol("data"); 58317exports.$data = $data; 58318const $dump = Symbol(); 58319exports.$dump = $dump; 58320const $extra = Symbol("extra"); 58321exports.$extra = $extra; 58322const $finalize = Symbol(); 58323exports.$finalize = $finalize; 58324const $flushHTML = Symbol(); 58325exports.$flushHTML = $flushHTML; 58326const $getAttributeIt = Symbol(); 58327exports.$getAttributeIt = $getAttributeIt; 58328const $getAttributes = Symbol(); 58329exports.$getAttributes = $getAttributes; 58330const $getAvailableSpace = Symbol(); 58331exports.$getAvailableSpace = $getAvailableSpace; 58332const $getChildrenByClass = Symbol(); 58333exports.$getChildrenByClass = $getChildrenByClass; 58334const $getChildrenByName = Symbol(); 58335exports.$getChildrenByName = $getChildrenByName; 58336const $getChildrenByNameIt = Symbol(); 58337exports.$getChildrenByNameIt = $getChildrenByNameIt; 58338const $getDataValue = Symbol(); 58339exports.$getDataValue = $getDataValue; 58340const $getExtra = Symbol(); 58341exports.$getExtra = $getExtra; 58342const $getRealChildrenByNameIt = Symbol(); 58343exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt; 58344const $getChildren = Symbol(); 58345exports.$getChildren = $getChildren; 58346const $getContainedChildren = Symbol(); 58347exports.$getContainedChildren = $getContainedChildren; 58348const $getNextPage = Symbol(); 58349exports.$getNextPage = $getNextPage; 58350const $getSubformParent = Symbol(); 58351exports.$getSubformParent = $getSubformParent; 58352const $getParent = Symbol(); 58353exports.$getParent = $getParent; 58354const $getTemplateRoot = Symbol(); 58355exports.$getTemplateRoot = $getTemplateRoot; 58356const $globalData = Symbol(); 58357exports.$globalData = $globalData; 58358const $hasSettableValue = Symbol(); 58359exports.$hasSettableValue = $hasSettableValue; 58360const $ids = Symbol(); 58361exports.$ids = $ids; 58362const $indexOf = Symbol(); 58363exports.$indexOf = $indexOf; 58364const $insertAt = Symbol(); 58365exports.$insertAt = $insertAt; 58366const $isCDATAXml = Symbol(); 58367exports.$isCDATAXml = $isCDATAXml; 58368const $isBindable = Symbol(); 58369exports.$isBindable = $isBindable; 58370const $isDataValue = Symbol(); 58371exports.$isDataValue = $isDataValue; 58372const $isDescendent = Symbol(); 58373exports.$isDescendent = $isDescendent; 58374const $isNsAgnostic = Symbol(); 58375exports.$isNsAgnostic = $isNsAgnostic; 58376const $isSplittable = Symbol(); 58377exports.$isSplittable = $isSplittable; 58378const $isThereMoreWidth = Symbol(); 58379exports.$isThereMoreWidth = $isThereMoreWidth; 58380const $isTransparent = Symbol(); 58381exports.$isTransparent = $isTransparent; 58382const $isUsable = Symbol(); 58383exports.$isUsable = $isUsable; 58384const $lastAttribute = Symbol(); 58385const $namespaceId = Symbol("namespaceId"); 58386exports.$namespaceId = $namespaceId; 58387const $nodeName = Symbol("nodeName"); 58388exports.$nodeName = $nodeName; 58389const $nsAttributes = Symbol(); 58390exports.$nsAttributes = $nsAttributes;
vendor: 33,228 bytes, lines 58391-59990
58391const $onChild = Symbol(); 58392exports.$onChild = $onChild; 58393const $onChildCheck = Symbol(); 58394exports.$onChildCheck = $onChildCheck; 58395const $onText = Symbol(); 58396exports.$onText = $onText; 58397const $pushGlyphs = Symbol(); 58398exports.$pushGlyphs = $pushGlyphs; 58399const $popPara = Symbol(); 58400exports.$popPara = $popPara; 58401const $pushPara = Symbol(); 58402exports.$pushPara = $pushPara; 58403const $removeChild = Symbol(); 58404exports.$removeChild = $removeChild; 58405const $root = Symbol("root"); 58406exports.$root = $root; 58407const $resolvePrototypes = Symbol(); 58408exports.$resolvePrototypes = $resolvePrototypes; 58409const $searchNode = Symbol(); 58410exports.$searchNode = $searchNode; 58411const $setId = Symbol(); 58412exports.$setId = $setId; 58413const $setSetAttributes = Symbol(); 58414exports.$setSetAttributes = $setSetAttributes; 58415const $setValue = Symbol(); 58416exports.$setValue = $setValue; 58417const $tabIndex = Symbol(); 58418exports.$tabIndex = $tabIndex; 58419const $text = Symbol(); 58420exports.$text = $text; 58421const $toPages = Symbol(); 58422exports.$toPages = $toPages; 58423const $toHTML = Symbol(); 58424exports.$toHTML = $toHTML; 58425const $toString = Symbol(); 58426exports.$toString = $toString; 58427const $toStyle = Symbol(); 58428exports.$toStyle = $toStyle; 58429const $uid = Symbol("uid"); 58430exports.$uid = $uid; 58431 58432const _applyPrototype = Symbol(); 58433 58434const _attributes = Symbol(); 58435 58436const _attributeNames = Symbol(); 58437 58438const _children = Symbol("_children"); 58439 58440const _cloneAttribute = Symbol(); 58441 58442const _dataValue = Symbol(); 58443 58444const _defaultValue = Symbol(); 58445 58446const _filteredChildrenGenerator = Symbol(); 58447 58448const _getPrototype = Symbol(); 58449 58450const _getUnsetAttributes = Symbol(); 58451 58452const _hasChildren = Symbol(); 58453 58454const _max = Symbol(); 58455 58456const _options = Symbol(); 58457 58458const _parent = Symbol("parent"); 58459 58460const _resolvePrototypesHelper = Symbol(); 58461 58462const _setAttributes = Symbol(); 58463 58464const _validator = Symbol(); 58465 58466let uid = 0; 58467const NS_DATASETS = _namespaces.NamespaceIds.datasets.id; 58468 58469class XFAObject { 58470 constructor(nsId, name, hasChildren = false) { 58471 this[$namespaceId] = nsId; 58472 this[$nodeName] = name; 58473 this[_hasChildren] = hasChildren; 58474 this[_parent] = null; 58475 this[_children] = []; 58476 this[$uid] = `${name}${uid++}`; 58477 this[$globalData] = null; 58478 } 58479 58480 [$onChild](child) { 58481 if (!this[_hasChildren] || !this[$onChildCheck](child)) { 58482 return false; 58483 } 58484 58485 const name = child[$nodeName]; 58486 const node = this[name]; 58487 58488 if (node instanceof XFAObjectArray) { 58489 if (node.push(child)) { 58490 this[$appendChild](child); 58491 return true; 58492 } 58493 } else { 58494 if (node !== null) { 58495 this[$removeChild](node); 58496 } 58497 58498 this[name] = child; 58499 this[$appendChild](child); 58500 return true; 58501 } 58502 58503 let id = ""; 58504 58505 if (this.id) { 58506 id = ` (id: ${this.id})`; 58507 } else if (this.name) { 58508 id = ` (name: ${this.name} ${this.h.value})`; 58509 } 58510 58511 (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`); 58512 return false; 58513 } 58514 58515 [$onChildCheck](child) { 58516 return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId]; 58517 } 58518 58519 [$isNsAgnostic]() { 58520 return false; 58521 } 58522 58523 [$acceptWhitespace]() { 58524 return false; 58525 } 58526 58527 [$isCDATAXml]() { 58528 return false; 58529 } 58530 58531 [$isBindable]() { 58532 return false; 58533 } 58534 58535 [$popPara]() { 58536 if (this.para) { 58537 this[$getTemplateRoot]()[$extra].paraStack.pop(); 58538 } 58539 } 58540 58541 [$pushPara]() { 58542 this[$getTemplateRoot]()[$extra].paraStack.push(this.para); 58543 } 58544 58545 [$setId](ids) { 58546 if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) { 58547 ids.set(this.id, this); 58548 } 58549 } 58550 58551 [$getTemplateRoot]() { 58552 return this[$globalData].template; 58553 } 58554 58555 [$isSplittable]() { 58556 return false; 58557 } 58558 58559 [$isThereMoreWidth]() { 58560 return false; 58561 } 58562 58563 [$appendChild](child) { 58564 child[_parent] = this; 58565 58566 this[_children].push(child); 58567 58568 if (!child[$globalData] && this[$globalData]) { 58569 child[$globalData] = this[$globalData]; 58570 } 58571 } 58572 58573 [$removeChild](child) { 58574 const i = this[_children].indexOf(child); 58575 58576 this[_children].splice(i, 1); 58577 } 58578 58579 [$hasSettableValue]() { 58580 return this.hasOwnProperty("value"); 58581 } 58582 58583 [$setValue](_) {} 58584 58585 [$onText](_) {} 58586 58587 [$finalize]() {} 58588 58589 [$clean](builder) { 58590 delete this[_hasChildren]; 58591 58592 if (this[$cleanup]) { 58593 builder.clean(this[$cleanup]); 58594 delete this[$cleanup]; 58595 } 58596 } 58597 58598 [$indexOf](child) { 58599 return this[_children].indexOf(child); 58600 } 58601 58602 [$insertAt](i, child) { 58603 child[_parent] = this; 58604 58605 this[_children].splice(i, 0, child); 58606 58607 if (!child[$globalData] && this[$globalData]) { 58608 child[$globalData] = this[$globalData]; 58609 } 58610 } 58611 58612 [$isTransparent]() { 58613 return !this.name; 58614 } 58615 58616 [$lastAttribute]() { 58617 return ""; 58618 } 58619 58620 [$text]() { 58621 if (this[_children].length === 0) { 58622 return this[$content]; 58623 } 58624 58625 return this[_children].map(c => c[$text]()).join(""); 58626 } 58627 58628 get [_attributeNames]() { 58629 const proto = Object.getPrototypeOf(this); 58630 58631 if (!proto._attributes) { 58632 const attributes = proto._attributes = new Set(); 58633 58634 for (const name of Object.getOwnPropertyNames(this)) { 58635 if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) { 58636 break; 58637 } 58638 58639 attributes.add(name); 58640 } 58641 } 58642 58643 return (0, _util.shadow)(this, _attributeNames, proto._attributes); 58644 } 58645 58646 [$isDescendent](parent) { 58647 let node = this; 58648 58649 while (node) { 58650 if (node === parent) { 58651 return true; 58652 } 58653 58654 node = node[$getParent](); 58655 } 58656 58657 return false; 58658 } 58659 58660 [$getParent]() { 58661 return this[_parent]; 58662 } 58663 58664 [$getSubformParent]() { 58665 return this[$getParent](); 58666 } 58667 58668 [$getChildren](name = null) { 58669 if (!name) { 58670 return this[_children]; 58671 } 58672 58673 return this[name]; 58674 } 58675 58676 [$dump]() { 58677 const dumped = Object.create(null); 58678 58679 if (this[$content]) { 58680 dumped.$content = this[$content]; 58681 } 58682 58683 for (const name of Object.getOwnPropertyNames(this)) { 58684 const value = this[name]; 58685 58686 if (value === null) { 58687 continue; 58688 } 58689 58690 if (value instanceof XFAObject) { 58691 dumped[name] = value[$dump](); 58692 } else if (value instanceof XFAObjectArray) { 58693 if (!value.isEmpty()) { 58694 dumped[name] = value.dump(); 58695 } 58696 } else { 58697 dumped[name] = value; 58698 } 58699 } 58700 58701 return dumped; 58702 } 58703 58704 [$toStyle]() { 58705 return null; 58706 } 58707 58708 [$toHTML]() { 58709 return _utils.HTMLResult.EMPTY; 58710 } 58711 58712 *[$getContainedChildren]() { 58713 for (const node of this[$getChildren]()) { 58714 yield node; 58715 } 58716 } 58717 58718 *[_filteredChildrenGenerator](filter, include) { 58719 for (const node of this[$getContainedChildren]()) { 58720 if (!filter || include === filter.has(node[$nodeName])) { 58721 const availableSpace = this[$getAvailableSpace](); 58722 const res = node[$toHTML](availableSpace); 58723 58724 if (!res.success) { 58725 this[$extra].failingNode = node; 58726 } 58727 58728 yield res; 58729 } 58730 } 58731 } 58732 58733 [$flushHTML]() { 58734 return null; 58735 } 58736 58737 [$addHTML](html, bbox) { 58738 this[$extra].children.push(html); 58739 } 58740 58741 [$getAvailableSpace]() {} 58742 58743 [$childrenToHTML]({ 58744 filter = null, 58745 include = true 58746 }) { 58747 if (!this[$extra].generator) { 58748 this[$extra].generator = this[_filteredChildrenGenerator](filter, include); 58749 } else { 58750 const availableSpace = this[$getAvailableSpace](); 58751 const res = this[$extra].failingNode[$toHTML](availableSpace); 58752 58753 if (!res.success) { 58754 return res; 58755 } 58756 58757 if (res.html) { 58758 this[$addHTML](res.html, res.bbox); 58759 } 58760 58761 delete this[$extra].failingNode; 58762 } 58763 58764 while (true) { 58765 const gen = this[$extra].generator.next(); 58766 58767 if (gen.done) { 58768 break; 58769 } 58770 58771 const res = gen.value; 58772 58773 if (!res.success) { 58774 return res; 58775 } 58776 58777 if (res.html) { 58778 this[$addHTML](res.html, res.bbox); 58779 } 58780 } 58781 58782 this[$extra].generator = null; 58783 return _utils.HTMLResult.EMPTY; 58784 } 58785 58786 [$setSetAttributes](attributes) { 58787 this[_setAttributes] = new Set(Object.keys(attributes)); 58788 } 58789 58790 [_getUnsetAttributes](protoAttributes) { 58791 const allAttr = this[_attributeNames]; 58792 const setAttr = this[_setAttributes]; 58793 return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x)); 58794 } 58795 58796 [$resolvePrototypes](ids, ancestors = new Set()) { 58797 for (const child of this[_children]) { 58798 child[_resolvePrototypesHelper](ids, ancestors); 58799 } 58800 } 58801 58802 [_resolvePrototypesHelper](ids, ancestors) { 58803 const proto = this[_getPrototype](ids, ancestors); 58804 58805 if (proto) { 58806 this[_applyPrototype](proto, ids, ancestors); 58807 } else { 58808 this[$resolvePrototypes](ids, ancestors); 58809 } 58810 } 58811 58812 [_getPrototype](ids, ancestors) { 58813 const { 58814 use, 58815 usehref 58816 } = this; 58817 58818 if (!use && !usehref) { 58819 return null; 58820 } 58821 58822 let proto = null; 58823 let somExpression = null; 58824 let id = null; 58825 let ref = use; 58826 58827 if (usehref) { 58828 ref = usehref; 58829 58830 if (usehref.startsWith("#som(") && usehref.endsWith(")")) { 58831 somExpression = usehref.slice("#som(".length, usehref.length - 1); 58832 } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) { 58833 somExpression = usehref.slice(".#som(".length, usehref.length - 1); 58834 } else if (usehref.startsWith("#")) { 58835 id = usehref.slice(1); 58836 } else if (usehref.startsWith(".#")) { 58837 id = usehref.slice(2); 58838 } 58839 } else if (use.startsWith("#")) { 58840 id = use.slice(1); 58841 } else { 58842 somExpression = use; 58843 } 58844 58845 this.use = this.usehref = ""; 58846 58847 if (id) { 58848 proto = ids.get(id); 58849 } else { 58850 proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false); 58851 58852 if (proto) { 58853 proto = proto[0]; 58854 } 58855 } 58856 58857 if (!proto) { 58858 (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`); 58859 return null; 58860 } 58861 58862 if (proto[$nodeName] !== this[$nodeName]) { 58863 (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`); 58864 return null; 58865 } 58866 58867 if (ancestors.has(proto)) { 58868 (0, _util.warn)(`XFA - Cycle detected in prototypes use.`); 58869 return null; 58870 } 58871 58872 ancestors.add(proto); 58873 58874 const protoProto = proto[_getPrototype](ids, ancestors); 58875 58876 if (protoProto) { 58877 proto[_applyPrototype](protoProto, ids, ancestors); 58878 } 58879 58880 proto[$resolvePrototypes](ids, ancestors); 58881 ancestors.delete(proto); 58882 return proto; 58883 } 58884 58885 [_applyPrototype](proto, ids, ancestors) { 58886 if (ancestors.has(proto)) { 58887 (0, _util.warn)(`XFA - Cycle detected in prototypes use.`); 58888 return; 58889 } 58890 58891 if (!this[$content] && proto[$content]) { 58892 this[$content] = proto[$content]; 58893 } 58894 58895 const newAncestors = new Set(ancestors); 58896 newAncestors.add(proto); 58897 58898 for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) { 58899 this[unsetAttrName] = proto[unsetAttrName]; 58900 58901 if (this[_setAttributes]) { 58902 this[_setAttributes].add(unsetAttrName); 58903 } 58904 } 58905 58906 for (const name of Object.getOwnPropertyNames(this)) { 58907 if (this[_attributeNames].has(name)) { 58908 continue; 58909 } 58910 58911 const value = this[name]; 58912 const protoValue = proto[name]; 58913 58914 if (value instanceof XFAObjectArray) { 58915 for (const child of value[_children]) { 58916 child[_resolvePrototypesHelper](ids, ancestors); 58917 } 58918 58919 for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) { 58920 const child = proto[_children][i][$clone](); 58921 58922 if (value.push(child)) { 58923 child[_parent] = this; 58924 58925 this[_children].push(child); 58926 58927 child[_resolvePrototypesHelper](ids, ancestors); 58928 } else { 58929 break; 58930 } 58931 } 58932 58933 continue; 58934 } 58935 58936 if (value !== null) { 58937 value[$resolvePrototypes](ids, ancestors); 58938 58939 if (protoValue) { 58940 value[_applyPrototype](protoValue, ids, ancestors); 58941 } 58942 58943 continue; 58944 } 58945 58946 if (protoValue !== null) { 58947 const child = protoValue[$clone](); 58948 child[_parent] = this; 58949 this[name] = child; 58950 58951 this[_children].push(child); 58952 58953 child[_resolvePrototypesHelper](ids, ancestors); 58954 } 58955 } 58956 } 58957 58958 static [_cloneAttribute](obj) { 58959 if (Array.isArray(obj)) { 58960 return obj.map(x => XFAObject[_cloneAttribute](x)); 58961 } 58962 58963 if (typeof obj === "object" && obj !== null) { 58964 return Object.assign({}, obj); 58965 } 58966 58967 return obj; 58968 } 58969 58970 [$clone]() { 58971 const clone = Object.create(Object.getPrototypeOf(this)); 58972 58973 for (const $symbol of Object.getOwnPropertySymbols(this)) { 58974 try { 58975 clone[$symbol] = this[$symbol]; 58976 } catch (_) { 58977 (0, _util.shadow)(clone, $symbol, this[$symbol]); 58978 } 58979 } 58980 58981 clone[$uid] = `${clone[$nodeName]}${uid++}`; 58982 clone[_children] = []; 58983 58984 for (const name of Object.getOwnPropertyNames(this)) { 58985 if (this[_attributeNames].has(name)) { 58986 clone[name] = XFAObject[_cloneAttribute](this[name]); 58987 continue; 58988 } 58989 58990 const value = this[name]; 58991 58992 if (value instanceof XFAObjectArray) { 58993 clone[name] = new XFAObjectArray(value[_max]); 58994 } else { 58995 clone[name] = null; 58996 } 58997 } 58998 58999 for (const child of this[_children]) { 59000 const name = child[$nodeName]; 59001 const clonedChild = child[$clone](); 59002 59003 clone[_children].push(clonedChild); 59004 59005 clonedChild[_parent] = clone; 59006 59007 if (clone[name] === null) { 59008 clone[name] = clonedChild; 59009 } else { 59010 clone[name][_children].push(clonedChild); 59011 } 59012 } 59013 59014 return clone; 59015 } 59016 59017 [$getChildren](name = null) { 59018 if (!name) { 59019 return this[_children]; 59020 } 59021 59022 return this[_children].filter(c => c[$nodeName] === name); 59023 } 59024 59025 [$getChildrenByClass](name) { 59026 return this[name]; 59027 } 59028 59029 [$getChildrenByName](name, allTransparent, first = true) { 59030 return Array.from(this[$getChildrenByNameIt](name, allTransparent, first)); 59031 } 59032 59033 *[$getChildrenByNameIt](name, allTransparent, first = true) { 59034 if (name === "parent") { 59035 yield this[_parent]; 59036 return; 59037 } 59038 59039 for (const child of this[_children]) { 59040 if (child[$nodeName] === name) { 59041 yield child; 59042 } 59043 59044 if (child.name === name) { 59045 yield child; 59046 } 59047 59048 if (allTransparent || child[$isTransparent]()) { 59049 yield* child[$getChildrenByNameIt](name, allTransparent, false); 59050 } 59051 } 59052 59053 if (first && this[_attributeNames].has(name)) { 59054 yield new XFAAttribute(this, name, this[name]); 59055 } 59056 } 59057 59058} 59059 59060exports.XFAObject = XFAObject; 59061 59062class XFAObjectArray { 59063 constructor(max = Infinity) { 59064 this[_max] = max; 59065 this[_children] = []; 59066 } 59067 59068 push(child) { 59069 const len = this[_children].length; 59070 59071 if (len <= this[_max]) { 59072 this[_children].push(child); 59073 59074 return true; 59075 } 59076 59077 (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`); 59078 return false; 59079 } 59080 59081 isEmpty() { 59082 return this[_children].length === 0; 59083 } 59084 59085 dump() { 59086 return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]()); 59087 } 59088 59089 [$clone]() { 59090 const clone = new XFAObjectArray(this[_max]); 59091 clone[_children] = this[_children].map(c => c[$clone]()); 59092 return clone; 59093 } 59094 59095 get children() { 59096 return this[_children]; 59097 } 59098 59099 clear() { 59100 this[_children].length = 0; 59101 } 59102 59103} 59104 59105exports.XFAObjectArray = XFAObjectArray; 59106 59107class XFAAttribute { 59108 constructor(node, name, value) { 59109 this[_parent] = node; 59110 this[$nodeName] = name; 59111 this[$content] = value; 59112 this[$consumed] = false; 59113 this[$uid] = `attribute${uid++}`; 59114 } 59115 59116 [$getParent]() { 59117 return this[_parent]; 59118 } 59119 59120 [$isDataValue]() { 59121 return true; 59122 } 59123 59124 [$getDataValue]() { 59125 return this[$content].trim(); 59126 } 59127 59128 [$setValue](value) { 59129 value = value.value || ""; 59130 this[$content] = value.toString(); 59131 } 59132 59133 [$text]() { 59134 return this[$content]; 59135 } 59136 59137 [$isDescendent](parent) { 59138 return this[_parent] === parent || this[_parent][$isDescendent](parent); 59139 } 59140 59141} 59142 59143exports.XFAAttribute = XFAAttribute; 59144 59145class XmlObject extends XFAObject { 59146 constructor(nsId, name, attributes = {}) { 59147 super(nsId, name); 59148 this[$content] = ""; 59149 this[_dataValue] = null; 59150 59151 if (name !== "#text") { 59152 const map = new Map(); 59153 this[_attributes] = map; 59154 59155 for (const [attrName, value] of Object.entries(attributes)) { 59156 map.set(attrName, new XFAAttribute(this, attrName, value)); 59157 } 59158 59159 if (attributes.hasOwnProperty($nsAttributes)) { 59160 const dataNode = attributes[$nsAttributes].xfa.dataNode; 59161 59162 if (dataNode !== undefined) { 59163 if (dataNode === "dataGroup") { 59164 this[_dataValue] = false; 59165 } else if (dataNode === "dataValue") { 59166 this[_dataValue] = true; 59167 } 59168 } 59169 } 59170 } 59171 59172 this[$consumed] = false; 59173 } 59174 59175 [$toString](buf) { 59176 const tagName = this[$nodeName]; 59177 59178 if (tagName === "#text") { 59179 buf.push((0, _core_utils.encodeToXmlString)(this[$content])); 59180 return; 59181 } 59182 59183 const utf8TagName = (0, _util.utf8StringToString)(tagName); 59184 const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : ""; 59185 buf.push(`<${prefix}${utf8TagName}`); 59186 59187 for (const [name, value] of this[_attributes].entries()) { 59188 const utf8Name = (0, _util.utf8StringToString)(name); 59189 buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`); 59190 } 59191 59192 if (this[_dataValue] !== null) { 59193 if (this[_dataValue]) { 59194 buf.push(` xfa:dataNode="dataValue"`); 59195 } else { 59196 buf.push(` xfa:dataNode="dataGroup"`); 59197 } 59198 } 59199 59200 if (!this[$content] && this[_children].length === 0) { 59201 buf.push("/>"); 59202 return; 59203 } 59204 59205 buf.push(">"); 59206 59207 if (this[$content]) { 59208 if (typeof this[$content] === "string") { 59209 buf.push((0, _core_utils.encodeToXmlString)(this[$content])); 59210 } else { 59211 this[$content][$toString](buf); 59212 } 59213 } else { 59214 for (const child of this[_children]) { 59215 child[$toString](buf); 59216 } 59217 } 59218 59219 buf.push(`</${prefix}${utf8TagName}>`); 59220 } 59221 59222 [$onChild](child) { 59223 if (this[$content]) { 59224 const node = new XmlObject(this[$namespaceId], "#text"); 59225 this[$appendChild](node); 59226 node[$content] = this[$content]; 59227 this[$content] = ""; 59228 } 59229 59230 this[$appendChild](child); 59231 return true; 59232 } 59233 59234 [$onText](str) { 59235 this[$content] += str; 59236 } 59237 59238 [$finalize]() { 59239 if (this[$content] && this[_children].length > 0) { 59240 const node = new XmlObject(this[$namespaceId], "#text"); 59241 this[$appendChild](node); 59242 node[$content] = this[$content]; 59243 delete this[$content]; 59244 } 59245 } 59246 59247 [$toHTML]() { 59248 if (this[$nodeName] === "#text") { 59249 return _utils.HTMLResult.success({ 59250 name: "#text", 59251 value: this[$content] 59252 }); 59253 } 59254 59255 return _utils.HTMLResult.EMPTY; 59256 } 59257 59258 [$getChildren](name = null) { 59259 if (!name) { 59260 return this[_children]; 59261 } 59262 59263 return this[_children].filter(c => c[$nodeName] === name); 59264 } 59265 59266 [$getAttributes]() { 59267 return this[_attributes]; 59268 } 59269 59270 [$getChildrenByClass](name) { 59271 const value = this[_attributes].get(name); 59272 59273 if (value !== undefined) { 59274 return value; 59275 } 59276 59277 return this[$getChildren](name); 59278 } 59279 59280 *[$getChildrenByNameIt](name, allTransparent) { 59281 const value = this[_attributes].get(name); 59282 59283 if (value) { 59284 yield value; 59285 } 59286 59287 for (const child of this[_children]) { 59288 if (child[$nodeName] === name) { 59289 yield child; 59290 } 59291 59292 if (allTransparent) { 59293 yield* child[$getChildrenByNameIt](name, allTransparent); 59294 } 59295 } 59296 } 59297 59298 *[$getAttributeIt](name, skipConsumed) { 59299 const value = this[_attributes].get(name); 59300 59301 if (value && (!skipConsumed || !value[$consumed])) { 59302 yield value; 59303 } 59304 59305 for (const child of this[_children]) { 59306 yield* child[$getAttributeIt](name, skipConsumed); 59307 } 59308 } 59309 59310 *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) { 59311 for (const child of this[_children]) { 59312 if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) { 59313 yield child; 59314 } 59315 59316 if (allTransparent) { 59317 yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed); 59318 } 59319 } 59320 } 59321 59322 [$isDataValue]() { 59323 if (this[_dataValue] === null) { 59324 return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id; 59325 } 59326 59327 return this[_dataValue]; 59328 } 59329 59330 [$getDataValue]() { 59331 if (this[_dataValue] === null) { 59332 if (this[_children].length === 0) { 59333 return this[$content].trim(); 59334 } 59335 59336 if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) { 59337 return this[_children][0][$text]().trim(); 59338 } 59339 59340 return null; 59341 } 59342 59343 return this[$content].trim(); 59344 } 59345 59346 [$setValue](value) { 59347 value = value.value || ""; 59348 this[$content] = value.toString(); 59349 } 59350 59351 [$dump](hasNS = false) { 59352 const dumped = Object.create(null); 59353 59354 if (hasNS) { 59355 dumped.$ns = this[$namespaceId]; 59356 } 59357 59358 if (this[$content]) { 59359 dumped.$content = this[$content]; 59360 } 59361 59362 dumped.$name = this[$nodeName]; 59363 dumped.children = []; 59364 59365 for (const child of this[_children]) { 59366 dumped.children.push(child[$dump](hasNS)); 59367 } 59368 59369 dumped.attributes = Object.create(null); 59370 59371 for (const [name, value] of this[_attributes]) { 59372 dumped.attributes[name] = value[$content]; 59373 } 59374 59375 return dumped; 59376 } 59377 59378} 59379 59380exports.XmlObject = XmlObject; 59381 59382class ContentObject extends XFAObject { 59383 constructor(nsId, name) { 59384 super(nsId, name); 59385 this[$content] = ""; 59386 } 59387 59388 [$onText](text) { 59389 this[$content] += text; 59390 } 59391 59392 [$finalize]() {} 59393 59394} 59395 59396exports.ContentObject = ContentObject; 59397 59398class OptionObject extends ContentObject { 59399 constructor(nsId, name, options) { 59400 super(nsId, name); 59401 this[_options] = options; 59402 } 59403 59404 [$finalize]() { 59405 this[$content] = (0, _utils.getKeyword)({ 59406 data: this[$content], 59407 defaultValue: this[_options][0], 59408 validate: k => this[_options].includes(k) 59409 }); 59410 } 59411 59412 [$clean](builder) { 59413 super[$clean](builder); 59414 delete this[_options]; 59415 } 59416 59417} 59418 59419exports.OptionObject = OptionObject; 59420 59421class StringObject extends ContentObject { 59422 [$finalize]() { 59423 this[$content] = this[$content].trim(); 59424 } 59425 59426} 59427 59428exports.StringObject = StringObject; 59429 59430class IntegerObject extends ContentObject { 59431 constructor(nsId, name, defaultValue, validator) { 59432 super(nsId, name); 59433 this[_defaultValue] = defaultValue; 59434 this[_validator] = validator; 59435 } 59436 59437 [$finalize]() { 59438 this[$content] = (0, _utils.getInteger)({ 59439 data: this[$content], 59440 defaultValue: this[_defaultValue], 59441 validate: this[_validator] 59442 }); 59443 } 59444 59445 [$clean](builder) { 59446 super[$clean](builder); 59447 delete this[_defaultValue]; 59448 delete this[_validator]; 59449 } 59450 59451} 59452 59453exports.IntegerObject = IntegerObject; 59454 59455class Option01 extends IntegerObject { 59456 constructor(nsId, name) { 59457 super(nsId, name, 0, n => n === 1); 59458 } 59459 59460} 59461 59462exports.Option01 = Option01; 59463 59464class Option10 extends IntegerObject { 59465 constructor(nsId, name) { 59466 super(nsId, name, 1, n => n === 0); 59467 } 59468 59469} 59470 59471exports.Option10 = Option10; 59472 59473/***/ }), 59474/* 76 */ 59475/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 59476 59477 59478 59479Object.defineProperty(exports, "__esModule", ({ 59480 value: true 59481})); 59482exports.HTMLResult = void 0; 59483exports.getBBox = getBBox; 59484exports.getColor = getColor; 59485exports.getFloat = getFloat; 59486exports.getInteger = getInteger; 59487exports.getKeyword = getKeyword; 59488exports.getMeasurement = getMeasurement; 59489exports.getRatio = getRatio; 59490exports.getRelevant = getRelevant; 59491exports.getStringOption = getStringOption; 59492exports.stripQuotes = stripQuotes; 59493 59494var _util = __w_pdfjs_require__(2); 59495 59496const dimConverters = { 59497 pt: x => x, 59498 cm: x => x / 2.54 * 72, 59499 mm: x => x / (10 * 2.54) * 72, 59500 in: x => x * 72, 59501 px: x => x 59502}; 59503const measurementPattern = /([+-]?\d+\.?\d*)(.*)/; 59504 59505function stripQuotes(str) { 59506 if (str.startsWith("'") || str.startsWith('"')) { 59507 return str.slice(1, str.length - 1); 59508 } 59509 59510 return str; 59511} 59512 59513function getInteger({ 59514 data, 59515 defaultValue, 59516 validate 59517}) { 59518 if (!data) { 59519 return defaultValue; 59520 } 59521 59522 data = data.trim(); 59523 const n = parseInt(data, 10); 59524 59525 if (!isNaN(n) && validate(n)) { 59526 return n; 59527 } 59528 59529 return defaultValue; 59530} 59531 59532function getFloat({ 59533 data, 59534 defaultValue, 59535 validate 59536}) { 59537 if (!data) { 59538 return defaultValue; 59539 } 59540 59541 data = data.trim(); 59542 const n = parseFloat(data); 59543 59544 if (!isNaN(n) && validate(n)) { 59545 return n; 59546 } 59547 59548 return defaultValue; 59549} 59550 59551function getKeyword({ 59552 data, 59553 defaultValue, 59554 validate 59555}) { 59556 if (!data) { 59557 return defaultValue; 59558 } 59559 59560 data = data.trim(); 59561 59562 if (validate(data)) { 59563 return data; 59564 } 59565 59566 return defaultValue; 59567} 59568 59569function getStringOption(data, options) { 59570 return getKeyword({ 59571 data, 59572 defaultValue: options[0], 59573 validate: k => options.includes(k) 59574 }); 59575} 59576 59577function getMeasurement(str, def = "0") { 59578 def = def || "0"; 59579 59580 if (!str) { 59581 return getMeasurement(def); 59582 } 59583 59584 const match = str.trim().match(measurementPattern); 59585 59586 if (!match) { 59587 return getMeasurement(def); 59588 } 59589 59590 const [, valueStr, unit] = match; 59591 const value = parseFloat(valueStr); 59592 59593 if (isNaN(value)) { 59594 return getMeasurement(def); 59595 } 59596 59597 if (value === 0) { 59598 return 0; 59599 } 59600 59601 const conv = dimConverters[unit]; 59602 59603 if (conv) { 59604 return conv(value); 59605 } 59606 59607 return value; 59608} 59609 59610function getRatio(data) { 59611 if (!data) { 59612 return { 59613 num: 1, 59614 den: 1 59615 }; 59616 } 59617 59618 const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x)); 59619 59620 if (ratio.length === 1) { 59621 ratio.push(1); 59622 } 59623 59624 if (ratio.length === 0) { 59625 return { 59626 num: 1, 59627 den: 1 59628 }; 59629 } 59630 59631 const [num, den] = ratio; 59632 return { 59633 num, 59634 den 59635 }; 59636} 59637 59638function getRelevant(data) { 59639 if (!data) { 59640 return []; 59641 } 59642 59643 return data.trim().split(/\s+/).map(e => { 59644 return { 59645 excluded: e[0] === "-", 59646 viewname: e.substring(1) 59647 }; 59648 }); 59649} 59650 59651function getColor(data, def = [0, 0, 0]) { 59652 let [r, g, b] = def; 59653 59654 if (!data) { 59655 return { 59656 r, 59657 g, 59658 b 59659 }; 59660 } 59661 59662 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); 59663 59664 if (color.length < 3) { 59665 return { 59666 r, 59667 g, 59668 b 59669 }; 59670 } 59671 59672 [r, g, b] = color; 59673 return { 59674 r, 59675 g, 59676 b 59677 }; 59678} 59679 59680function getBBox(data) { 59681 const def = -1; 59682 59683 if (!data) { 59684 return { 59685 x: def, 59686 y: def, 59687 width: def, 59688 height: def 59689 }; 59690 } 59691 59692 const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1")); 59693 59694 if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) { 59695 return { 59696 x: def, 59697 y: def, 59698 width: def, 59699 height: def 59700 }; 59701 } 59702 59703 const [x, y, width, height] = bbox; 59704 return { 59705 x, 59706 y, 59707 width, 59708 height 59709 }; 59710} 59711 59712class HTMLResult { 59713 static get FAILURE() { 59714 return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null)); 59715 } 59716 59717 static get EMPTY() { 59718 return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null)); 59719 } 59720 59721 constructor(success, html, bbox, breakNode) { 59722 this.success = success; 59723 this.html = html; 59724 this.bbox = bbox; 59725 this.breakNode = breakNode; 59726 } 59727 59728 isBreak() { 59729 return !!this.breakNode; 59730 } 59731 59732 static breakNode(node) { 59733 return new HTMLResult(false, null, null, node); 59734 } 59735 59736 static success(html, bbox = null) { 59737 return new HTMLResult(true, html, bbox, null); 59738 } 59739 59740} 59741 59742exports.HTMLResult = HTMLResult; 59743 59744/***/ }), 59745/* 77 */ 59746/***/ ((__unused_webpack_module, exports) => { 59747 59748 59749 59750Object.defineProperty(exports, "__esModule", ({ 59751 value: true 59752})); 59753exports.NamespaceIds = exports.$buildXFAObject = void 0; 59754const $buildXFAObject = Symbol(); 59755exports.$buildXFAObject = $buildXFAObject; 59756const NamespaceIds = { 59757 config: { 59758 id: 0, 59759 check: ns => ns.startsWith("http://www.xfa.org/schema/xci/") 59760 }, 59761 connectionSet: { 59762 id: 1, 59763 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/") 59764 }, 59765 datasets: { 59766 id: 2, 59767 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/") 59768 }, 59769 form: { 59770 id: 3, 59771 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/") 59772 }, 59773 localeSet: { 59774 id: 4, 59775 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/") 59776 }, 59777 pdf: { 59778 id: 5, 59779 check: ns => ns === "http://ns.adobe.com/xdp/pdf/" 59780 }, 59781 signature: { 59782 id: 6, 59783 check: ns => ns === "http://www.w3.org/2000/09/xmldsig#" 59784 }, 59785 sourceSet: { 59786 id: 7, 59787 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/") 59788 }, 59789 stylesheet: { 59790 id: 8, 59791 check: ns => ns === "http://www.w3.org/1999/XSL/Transform" 59792 }, 59793 template: { 59794 id: 9, 59795 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/") 59796 }, 59797 xdc: { 59798 id: 10, 59799 check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/") 59800 }, 59801 xdp: { 59802 id: 11, 59803 check: ns => ns === "http://ns.adobe.com/xdp/" 59804 }, 59805 xfdf: { 59806 id: 12, 59807 check: ns => ns === "http://ns.adobe.com/xfdf/" 59808 }, 59809 xhtml: { 59810 id: 13, 59811 check: ns => ns === "http://www.w3.org/1999/xhtml" 59812 }, 59813 xmpmeta: { 59814 id: 14, 59815 check: ns => ns === "http://ns.adobe.com/xmpmeta/" 59816 } 59817}; 59818exports.NamespaceIds = NamespaceIds; 59819 59820/***/ }), 59821/* 78 */ 59822/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 59823 59824 59825 59826Object.defineProperty(exports, "__esModule", ({ 59827 value: true 59828})); 59829exports.createDataNode = createDataNode; 59830exports.searchNode = searchNode; 59831 59832var _xfa_object = __w_pdfjs_require__(75); 59833 59834var _namespaces = __w_pdfjs_require__(77); 59835 59836var _util = __w_pdfjs_require__(2); 59837 59838const namePattern = /^[^.[]+/; 59839const indexPattern = /^[^\]]+/; 59840const operators = { 59841 dot: 0, 59842 dotDot: 1, 59843 dotHash: 2, 59844 dotBracket: 3, 59845 dotParen: 4 59846}; 59847const 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]]); 59848const somCache = new WeakMap(); 59849const NS_DATASETS = _namespaces.NamespaceIds.datasets.id; 59850 59851function parseIndex(index) { 59852 index = index.trim(); 59853 59854 if (index === "*") { 59855 return Infinity; 59856 } 59857 59858 return parseInt(index, 10) || 0; 59859} 59860 59861function parseExpression(expr, dotDotAllowed, noExpr = true) { 59862 let match = expr.match(namePattern); 59863 59864 if (!match) { 59865 return null; 59866 } 59867 59868 let [name] = match; 59869 const parsed = [{ 59870 name, 59871 cacheName: "." + name, 59872 index: 0, 59873 js: null, 59874 formCalc: null, 59875 operator: operators.dot 59876 }]; 59877 let pos = name.length; 59878 59879 while (pos < expr.length) { 59880 const spos = pos; 59881 const char = expr.charAt(pos++); 59882 59883 if (char === "[") { 59884 match = expr.slice(pos).match(indexPattern); 59885 59886 if (!match) { 59887 (0, _util.warn)("XFA - Invalid index in SOM expression"); 59888 return null; 59889 } 59890 59891 parsed[parsed.length - 1].index = parseIndex(match[0]); 59892 pos += match[0].length + 1; 59893 continue; 59894 } 59895 59896 let operator; 59897 59898 switch (expr.charAt(pos)) { 59899 case ".": 59900 if (!dotDotAllowed) { 59901 return null; 59902 } 59903 59904 pos++; 59905 operator = operators.dotDot; 59906 break; 59907 59908 case "#": 59909 pos++; 59910 operator = operators.dotHash; 59911 break; 59912 59913 case "[": 59914 if (noExpr) { 59915 (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now."); 59916 return null; 59917 } 59918 59919 operator = operators.dotBracket; 59920 break; 59921 59922 case "(": 59923 if (noExpr) { 59924 (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now."); 59925 return null; 59926 } 59927 59928 operator = operators.dotParen; 59929 break; 59930 59931 default: 59932 operator = operators.dot; 59933 break; 59934 } 59935 59936 match = expr.slice(pos).match(namePattern); 59937 59938 if (!match) { 59939 break; 59940 } 59941 59942 [name] = match; 59943 pos += name.length; 59944 parsed.push({ 59945 name, 59946 cacheName: expr.slice(spos, pos), 59947 operator, 59948 index: 0, 59949 js: null, 59950 formCalc: null 59951 }); 59952 } 59953 59954 return parsed; 59955} 59956 59957function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) { 59958 const parsed = parseExpression(expr, dotDotAllowed); 59959 59960 if (!parsed) { 59961 return null; 59962 } 59963 59964 const fn = shortcuts.get(parsed[0].name); 59965 let i = 0; 59966 let isQualified; 59967 59968 if (fn) { 59969 isQualified = true; 59970 root = [fn(root, container)]; 59971 i = 1; 59972 } else { 59973 isQualified = container === null; 59974 root = [container || root]; 59975 } 59976 59977 for (let ii = parsed.length; i < ii; i++) { 59978 const { 59979 name, 59980 cacheName, 59981 operator, 59982 index 59983 } = parsed[i]; 59984 const nodes = []; 59985 59986 for (const node of root) { 59987 if (!(node instanceof _xfa_object.XFAObject)) { 59988 continue; 59989 } 59990
59991 let children, cached; 59992 59993 if (useCache) { 59994 cached = somCache.get(node); 59995 59996 if (!cached) { 59997 cached = new Map(); 59998 somCache.set(node, cached); 59999 } 60000 60001 children = cached.get(cacheName); 60002 } 60003 60004 if (!children) { 60005 switch (operator) { 60006 case operators.dot: 60007 children = node[_xfa_object.$getChildrenByName](name, false); 60008 break; 60009 60010 case operators.dotDot: 60011 children = node[_xfa_object.$getChildrenByName](name, true); 60012 break; 60013 60014 case operators.dotHash: 60015 children = node[_xfa_object.$getChildrenByClass](name); 60016 60017 if (children instanceof _xfa_object.XFAObjectArray) { 60018 children = children.children; 60019 } else { 60020 children = [children]; 60021 } 60022 60023 break; 60024 60025 default: 60026 break; 60027 } 60028 60029 if (useCache) { 60030 cached.set(cacheName, children); 60031 } 60032 } 60033 60034 if (children.length > 0) { 60035 nodes.push(children); 60036 } 60037 } 60038 60039 if (nodes.length === 0 && !isQualified && i === 0) { 60040 const parent = container[_xfa_object.$getParent](); 60041 60042 container = parent; 60043 60044 if (!container) { 60045 return null; 60046 } 60047 60048 i = -1; 60049 root = [container]; 60050 continue; 60051 } 60052 60053 if (isFinite(index)) { 60054 root = nodes.filter(node => index < node.length).map(node => node[index]); 60055 } else { 60056 root = nodes.reduce((acc, node) => acc.concat(node), []); 60057 } 60058 } 60059 60060 if (root.length === 0) { 60061 return null; 60062 } 60063 60064 return root; 60065} 60066 60067function createNodes(root, path) { 60068 let node = null; 60069 60070 for (const { 60071 name, 60072 index 60073 } of path) { 60074 for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) { 60075 const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId]; 60076 node = new _xfa_object.XmlObject(nsId, name); 60077 60078 root[_xfa_object.$appendChild](node); 60079 } 60080 60081 root = node; 60082 } 60083 60084 return node; 60085} 60086 60087function createDataNode(root, container, expr) { 60088 const parsed = parseExpression(expr); 60089 60090 if (!parsed) { 60091 return null; 60092 } 60093 60094 if (parsed.some(x => x.operator === operators.dotDot)) { 60095 return null; 60096 } 60097 60098 const fn = shortcuts.get(parsed[0].name); 60099 let i = 0; 60100 60101 if (fn) { 60102 root = fn(root, container); 60103 i = 1; 60104 } else { 60105 root = container || root; 60106 } 60107 60108 for (let ii = parsed.length; i < ii; i++) { 60109 const { 60110 name, 60111 operator, 60112 index 60113 } = parsed[i]; 60114 60115 if (!isFinite(index)) { 60116 parsed[i].index = 0; 60117 return createNodes(root, parsed.slice(i)); 60118 } 60119 60120 let children; 60121 60122 switch (operator) { 60123 case operators.dot: 60124 children = root[_xfa_object.$getChildrenByName](name, false); 60125 break; 60126 60127 case operators.dotDot: 60128 children = root[_xfa_object.$getChildrenByName](name, true); 60129 break; 60130 60131 case operators.dotHash: 60132 children = root[_xfa_object.$getChildrenByClass](name); 60133 60134 if (children instanceof _xfa_object.XFAObjectArray) { 60135 children = children.children; 60136 } else { 60137 children = [children]; 60138 } 60139 60140 break; 60141 60142 default: 60143 break; 60144 } 60145 60146 if (children.length === 0) { 60147 return createNodes(root, parsed.slice(i)); 60148 } 60149 60150 if (index < children.length) { 60151 const child = children[index]; 60152 60153 if (!(child instanceof _xfa_object.XFAObject)) { 60154 (0, _util.warn)(`XFA - Cannot create a node.`); 60155 return null; 60156 } 60157 60158 root = child; 60159 } else { 60160 parsed[i].index = index - children.length; 60161 return createNodes(root, parsed.slice(i)); 60162 } 60163 } 60164 60165 return null; 60166} 60167 60168/***/ }), 60169/* 79 */ 60170/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 60171 60172 60173 60174Object.defineProperty(exports, "__esModule", ({ 60175 value: true 60176})); 60177exports.Binder = void 0; 60178 60179var _xfa_object = __w_pdfjs_require__(75); 60180 60181var _template = __w_pdfjs_require__(80); 60182 60183var _som = __w_pdfjs_require__(78); 60184 60185var _namespaces = __w_pdfjs_require__(77); 60186 60187var _util = __w_pdfjs_require__(2); 60188 60189const NS_DATASETS = _namespaces.NamespaceIds.datasets.id; 60190 60191function createText(content) { 60192 const node = new _template.Text({}); 60193 node[_xfa_object.$content] = content; 60194 return node; 60195} 60196 60197class Binder { 60198 constructor(root) { 60199 this.root = root; 60200 this.datasets = root.datasets; 60201 60202 if (root.datasets && root.datasets.data) { 60203 this.data = root.datasets.data; 60204 } else { 60205 this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data"); 60206 } 60207 60208 this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0; 60209 this.root.form = this.form = root.template[_xfa_object.$clone](); 60210 } 60211 60212 _isConsumeData() { 60213 return !this.emptyMerge && this._mergeMode; 60214 } 60215 60216 _isMatchTemplate() { 60217 return !this._isConsumeData(); 60218 } 60219 60220 bind() { 60221 this._bindElement(this.form, this.data); 60222 60223 return this.form; 60224 } 60225 60226 getData() { 60227 return this.data; 60228 } 60229 60230 _bindValue(formNode, data, picture) { 60231 formNode[_xfa_object.$data] = data; 60232 60233 if (formNode[_xfa_object.$hasSettableValue]()) { 60234 if (data[_xfa_object.$isDataValue]()) { 60235 const value = data[_xfa_object.$getDataValue](); 60236 60237 formNode[_xfa_object.$setValue](createText(value)); 60238 } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") { 60239 const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n"); 60240 60241 formNode[_xfa_object.$setValue](createText(value)); 60242 } else if (this._isConsumeData()) { 60243 (0, _util.warn)(`XFA - Nodes haven't the same type.`); 60244 } 60245 } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) { 60246 this._bindElement(formNode, data); 60247 } else { 60248 (0, _util.warn)(`XFA - Nodes haven't the same type.`); 60249 } 60250 } 60251 60252 _findDataByNameToConsume(name, isValue, dataNode, global) { 60253 if (!name) { 60254 return null; 60255 } 60256 60257 let generator, match; 60258 60259 for (let i = 0; i < 3; i++) { 60260 generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true); 60261 60262 while (true) { 60263 match = generator.next().value; 60264 60265 if (!match) { 60266 break; 60267 } 60268 60269 if (isValue === match[_xfa_object.$isDataValue]()) { 60270 return match; 60271 } 60272 } 60273 60274 if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") { 60275 break; 60276 } 60277 60278 dataNode = dataNode[_xfa_object.$getParent](); 60279 } 60280 60281 if (!global) { 60282 return null; 60283 } 60284 60285 generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false); 60286 match = generator.next().value; 60287 60288 if (match) { 60289 return match; 60290 } 60291 60292 generator = this.data[_xfa_object.$getAttributeIt](name, true); 60293 match = generator.next().value; 60294 60295 if (match && match[_xfa_object.$isDataValue]()) { 60296 return match; 60297 } 60298 60299 return null; 60300 } 60301 60302 _setProperties(formNode, dataNode) { 60303 if (!formNode.hasOwnProperty("setProperty")) { 60304 return; 60305 } 60306 60307 for (const { 60308 ref, 60309 target, 60310 connection 60311 } of formNode.setProperty.children) { 60312 if (connection) { 60313 continue; 60314 } 60315 60316 if (!ref) { 60317 continue; 60318 } 60319 60320 const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false); 60321
60322 if (!nodes) { 60323 (0, _util.warn)(`XFA - Invalid reference: ${ref}.`); 60324 continue; 60325 } 60326 60327 const [node] = nodes; 60328 60329 if (!node[_xfa_object.$isDescendent](this.data)) { 60330 (0, _util.warn)(`XFA - Invalid node: must be a data node.`); 60331 continue; 60332 } 60333 60334 const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false); 60335 60336 if (!targetNodes) { 60337 (0, _util.warn)(`XFA - Invalid target: ${target}.`); 60338 continue; 60339 } 60340 60341 const [targetNode] = targetNodes; 60342 60343 if (!targetNode[_xfa_object.$isDescendent](formNode)) { 60344 (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`); 60345 continue; 60346 } 60347 60348 const targetParent = targetNode[_xfa_object.$getParent](); 60349 60350 if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) { 60351 (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`); 60352 continue; 60353 } 60354 60355 if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) { 60356 (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`); 60357 continue; 60358 } 60359 60360 const content = node[_xfa_object.$text](); 60361 60362 const name = targetNode[_xfa_object.$nodeName]; 60363 60364 if (targetNode instanceof _xfa_object.XFAAttribute) { 60365 const attrs = Object.create(null); 60366 attrs[name] = content; 60367 const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]); 60368 targetParent[name] = obj[name]; 60369 continue; 60370 } 60371 60372 if (!targetNode.hasOwnProperty(_xfa_object.$content)) { 60373 (0, _util.warn)(`XFA - Invalid node to use in setProperty`); 60374 continue; 60375 } 60376 60377 targetNode[_xfa_object.$data] = node; 60378 targetNode[_xfa_object.$content] = content; 60379 60380 targetNode[_xfa_object.$finalize](); 60381 } 60382 } 60383 60384 _bindItems(formNode, dataNode) { 60385 if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) { 60386 return; 60387 } 60388 60389 for (const item of formNode.items.children) { 60390 formNode[_xfa_object.$removeChild](item); 60391 } 60392 60393 formNode.items.clear(); 60394 const labels = new _template.Items({}); 60395 const values = new _template.Items({}); 60396 60397 formNode[_xfa_object.$appendChild](labels); 60398 60399 formNode.items.push(labels); 60400 60401 formNode[_xfa_object.$appendChild](values); 60402 60403 formNode.items.push(values); 60404 60405 for (const { 60406 ref, 60407 labelRef, 60408 valueRef, 60409 connection 60410 } of formNode.bindItems.children) { 60411 if (connection) { 60412 continue; 60413 } 60414 60415 if (!ref) { 60416 continue; 60417 } 60418 60419 const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false); 60420 60421 if (!nodes) { 60422 (0, _util.warn)(`XFA - Invalid reference: ${ref}.`); 60423 continue; 60424 } 60425 60426 for (const node of nodes) { 60427 if (!node[_xfa_object.$isDescendent](this.datasets)) { 60428 (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`); 60429 continue; 60430 } 60431 60432 const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false); 60433 60434 if (!labelNodes) { 60435 (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`); 60436 continue; 60437 } 60438 60439 const [labelNode] = labelNodes; 60440 60441 if (!labelNode[_xfa_object.$isDescendent](this.datasets)) { 60442 (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`); 60443 continue; 60444 } 60445 60446 const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false); 60447 60448 if (!valueNodes) { 60449 (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`); 60450 continue; 60451 } 60452 60453 const [valueNode] = valueNodes; 60454 60455 if (!valueNode[_xfa_object.$isDescendent](this.datasets)) { 60456 (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`); 60457 continue; 60458 } 60459 60460 const label = createText(labelNode[_xfa_object.$text]()); 60461 const value = createText(valueNode[_xfa_object.$text]()); 60462 60463 labels[_xfa_object.$appendChild](label); 60464 60465 labels.text.push(label); 60466 60467 values[_xfa_object.$appendChild](value); 60468 60469 values.text.push(value); 60470 } 60471 } 60472 } 60473 60474 _bindOccurrences(formNode, matches, picture) { 60475 let baseClone; 60476 60477 if (matches.length > 1) { 60478 baseClone = formNode[_xfa_object.$clone](); 60479 60480 baseClone[_xfa_object.$removeChild](baseClone.occur); 60481 60482 baseClone.occur = null; 60483 } 60484 60485 this._bindValue(formNode, matches[0], picture); 60486 60487 this._setProperties(formNode, matches[0]); 60488 60489 this._bindItems(formNode, matches[0]); 60490 60491 if (matches.length === 1) { 60492 return; 60493 } 60494 60495 const parent = formNode[_xfa_object.$getParent](); 60496 60497 const name = formNode[_xfa_object.$nodeName]; 60498 60499 const pos = parent[_xfa_object.$indexOf](formNode); 60500 60501 for (let i = 1, ii = matches.length; i < ii; i++) { 60502 const match = matches[i]; 60503 60504 const clone = baseClone[_xfa_object.$clone](); 60505 60506 parent[name].push(clone); 60507 60508 parent[_xfa_object.$insertAt](pos + i, clone); 60509 60510 this._bindValue(clone, match, picture); 60511 60512 this._setProperties(clone, match); 60513 60514 this._bindItems(clone, match); 60515 } 60516 } 60517 60518 _createOccurrences(formNode) { 60519 if (!this.emptyMerge) { 60520 return; 60521 } 60522 60523 const { 60524 occur 60525 } = formNode; 60526 60527 if (!occur || occur.initial <= 1) { 60528 return; 60529 } 60530 60531 const parent = formNode[_xfa_object.$getParent](); 60532 60533 const name = formNode[_xfa_object.$nodeName]; 60534 60535 if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) { 60536 return; 60537 } 60538
60539 let currentNumber; 60540 60541 if (formNode.name) { 60542 currentNumber = parent[name].children.filter(e => e.name === formNode.name).length; 60543 } else { 60544 currentNumber = parent[name].children.length; 60545 } 60546 60547 const pos = parent[_xfa_object.$indexOf](formNode) + 1; 60548 const ii = occur.initial - currentNumber; 60549 60550 if (ii) { 60551 const nodeClone = formNode[_xfa_object.$clone](); 60552 60553 nodeClone[_xfa_object.$removeChild](nodeClone.occur); 60554 60555 nodeClone.occur = null; 60556 parent[name].push(nodeClone); 60557 60558 parent[_xfa_object.$insertAt](pos, nodeClone); 60559 60560 for (let i = 1; i < ii; i++) { 60561 const clone = nodeClone[_xfa_object.$clone](); 60562 60563 parent[name].push(clone); 60564 60565 parent[_xfa_object.$insertAt](pos + i, clone); 60566 } 60567 } 60568 } 60569 60570 _getOccurInfo(formNode) { 60571 const { 60572 name, 60573 occur 60574 } = formNode; 60575 60576 if (!occur || !name) { 60577 return [1, 1]; 60578 } 60579 60580 const max = occur.max === -1 ? Infinity : occur.max; 60581 return [occur.min, max]; 60582 } 60583 60584 _setAndBind(formNode, dataNode) { 60585 this._setProperties(formNode, dataNode); 60586 60587 this._bindItems(formNode, dataNode); 60588 60589 this._bindElement(formNode, dataNode); 60590 } 60591 60592 _bindElement(formNode, dataNode) { 60593 const uselessNodes = []; 60594 60595 this._createOccurrences(formNode); 60596 60597 for (const child of formNode[_xfa_object.$getChildren]()) { 60598 if (child[_xfa_object.$data]) { 60599 continue; 60600 } 60601 60602 if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") { 60603 this._mergeMode = child.mergeMode === "consumeData"; 60604 60605 const dataChildren = dataNode[_xfa_object.$getChildren](); 60606 60607 if (dataChildren.length > 0) { 60608 this._bindOccurrences(child, [dataChildren[0]], null); 60609 } else if (this.emptyMerge) { 60610 const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId]; 60611 const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root"); 60612 60613 dataNode[_xfa_object.$appendChild](dataChild); 60614 60615 this._bindElement(child, dataChild); 60616 } 60617 60618 continue; 60619 } 60620 60621 if (!child[_xfa_object.$isBindable]()) { 60622 continue; 60623 } 60624 60625 let global = false; 60626 let picture = null; 60627 let ref = null; 60628 let match = null; 60629 60630 if (child.bind) { 60631 switch (child.bind.match) { 60632 case "none": 60633 this._setAndBind(child, dataNode); 60634 60635 continue; 60636 60637 case "global": 60638 global = true; 60639 break; 60640 60641 case "dataRef": 60642 if (!child.bind.ref) { 60643 (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`); 60644 60645 this._setAndBind(child, dataNode); 60646 60647 continue; 60648 } 60649 60650 ref = child.bind.ref; 60651 break; 60652 60653 default: 60654 break; 60655 } 60656 60657 if (child.bind.picture) { 60658 picture = child.bind.picture[_xfa_object.$content]; 60659 } 60660 } 60661 60662 const [min, max] = this._getOccurInfo(child); 60663 60664 if (ref) { 60665 match = (0, _som.searchNode)(this.root, dataNode, ref, true, false); 60666 60667 if (match === null) { 60668 match = (0, _som.createDataNode)(this.data, dataNode, ref); 60669 60670 if (!match) { 60671 continue; 60672 } 60673 60674 if (this._isConsumeData()) { 60675 match[_xfa_object.$consumed] = true; 60676 } 60677 60678 this._setAndBind(child, match); 60679 60680 continue; 60681 } else { 60682 if (this._isConsumeData()) { 60683 match = match.filter(node => !node[_xfa_object.$consumed]); 60684 } 60685 60686 if (match.length > max) { 60687 match = match.slice(0, max); 60688 } else if (match.length === 0) { 60689 match = null; 60690 } 60691 60692 if (match && this._isConsumeData()) { 60693 match.forEach(node => { 60694 node[_xfa_object.$consumed] = true; 60695 }); 60696 } 60697 } 60698 } else { 60699 if (!child.name) { 60700 this._setAndBind(child, dataNode); 60701 60702 continue; 60703 } 60704 60705 if (this._isConsumeData()) { 60706 const matches = []; 60707 60708 while (matches.length < max) { 60709 const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global); 60710 60711 if (!found) { 60712 break; 60713 } 60714 60715 found[_xfa_object.$consumed] = true; 60716 matches.push(found); 60717 } 60718 60719 match = matches.length > 0 ? matches : null; 60720 } else { 60721 match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value; 60722 60723 if (!match) { 60724 if (min === 0) { 60725 uselessNodes.push(child); 60726 continue; 60727 } 60728 60729 const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId]; 60730 match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name); 60731 60732 if (this.emptyMerge) { 60733 match[_xfa_object.$consumed] = true; 60734 } 60735 60736 dataNode[_xfa_object.$appendChild](match); 60737 60738 this._setAndBind(child, match); 60739 60740 continue; 60741 } 60742 60743 if (this.emptyMerge) { 60744 match[_xfa_object.$consumed] = true; 60745 } 60746 60747 match = [match]; 60748 } 60749 } 60750 60751 if (match) { 60752 this._bindOccurrences(child, match, picture); 60753 } else if (min > 0) { 60754 this._setAndBind(child, dataNode); 60755 } else { 60756 uselessNodes.push(child); 60757 } 60758 } 60759
60760 uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node)); 60761 } 60762 60763} 60764 60765exports.Binder = Binder; 60766 60767/***/ }), 60768/* 80 */ 60769/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 60770 60771 60772 60773Object.defineProperty(exports, "__esModule", ({ 60774 value: true 60775})); 60776exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0; 60777 60778var _xfa_object = __w_pdfjs_require__(75); 60779 60780var _namespaces = __w_pdfjs_require__(77); 60781 60782var _layout = __w_pdfjs_require__(81); 60783 60784var _html_utils = __w_pdfjs_require__(82); 60785 60786var _utils = __w_pdfjs_require__(76); 60787 60788var _util = __w_pdfjs_require__(2); 60789 60790var _fonts = __w_pdfjs_require__(83); 60791 60792var _core_utils = __w_pdfjs_require__(9); 60793 60794var _som = __w_pdfjs_require__(78); 60795 60796const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id; 60797const SVG_NS = "http://www.w3.org/2000/svg"; 60798const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2; 60799const MAX_EMPTY_PAGES = 3; 60800const DEFAULT_TAB_INDEX = 5000; 60801const HEADING_PATTERN = /^H(\d+)$/;
60802const 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"]); 60803const 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"]]; 60804 60805function getBorderDims(node) { 60806 if (!node || !node.border) { 60807 return { 60808 w: 0, 60809 h: 0 60810 }; 60811 } 60812 60813 const borderExtra = node.border[_xfa_object.$getExtra](); 60814 60815 if (!borderExtra) { 60816 return { 60817 w: 0, 60818 h: 0 60819 }; 60820 } 60821 60822 return { 60823 w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2], 60824 h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3] 60825 }; 60826} 60827 60828function hasMargin(node) { 60829 return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset); 60830} 60831 60832function _setValue(templateNode, value) { 60833 if (!templateNode.value) { 60834 const nodeValue = new Value({}); 60835 60836 templateNode[_xfa_object.$appendChild](nodeValue); 60837 60838 templateNode.value = nodeValue; 60839 } 60840 60841 templateNode.value[_xfa_object.$setValue](value); 60842} 60843 60844function* getContainedChildren(node) { 60845 for (const child of node[_xfa_object.$getChildren]()) { 60846 if (child instanceof SubformSet) { 60847 yield* child[_xfa_object.$getContainedChildren](); 60848 continue; 60849 } 60850 60851 yield child; 60852 } 60853} 60854 60855function setTabIndex(node) { 60856 while (node) { 60857 if (!node.traversal) { 60858 node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex]; 60859 return; 60860 } 60861 60862 if (node[_xfa_object.$tabIndex]) { 60863 return; 60864 } 60865 60866 let next = null; 60867 60868 for (const child of node.traversal[_xfa_object.$getChildren]()) { 60869 if (child.operation === "next") { 60870 next = child; 60871 break; 60872 } 60873 } 60874 60875 if (!next || !next.ref) { 60876 node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex]; 60877 return; 60878 } 60879 60880 const root = node[_xfa_object.$getTemplateRoot](); 60881 60882 node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex]; 60883 60884 const ref = root[_xfa_object.$searchNode](next.ref, node); 60885 60886 if (!ref) { 60887 return; 60888 } 60889 60890 node = ref[0]; 60891 } 60892} 60893 60894function applyAssist(obj, attributes) { 60895 const assist = obj.assist; 60896 60897 if (assist) { 60898 const assistTitle = assist[_xfa_object.$toHTML](); 60899 60900 if (assistTitle) { 60901 attributes.title = assistTitle; 60902 } 60903 60904 const role = assist.role; 60905 const match = role.match(HEADING_PATTERN); 60906 60907 if (match) { 60908 const ariaRole = "heading"; 60909 const ariaLevel = match[1]; 60910 attributes.role = ariaRole; 60911 attributes["aria-level"] = ariaLevel; 60912 } 60913 } 60914 60915 if (obj.layout === "table") { 60916 attributes.role = "table"; 60917 } else if (obj.layout === "row") { 60918 attributes.role = "row"; 60919 } else { 60920 const parent = obj[_xfa_object.$getParent](); 60921 60922 if (parent.layout === "row") { 60923 if (parent.assist && parent.assist.role === "TH") { 60924 attributes.role = "columnheader"; 60925 } else { 60926 attributes.role = "cell"; 60927 } 60928 } 60929 } 60930} 60931 60932function ariaLabel(obj) { 60933 if (!obj.assist) { 60934 return null; 60935 } 60936 60937 const assist = obj.assist; 60938 60939 if (assist.speak && assist.speak[_xfa_object.$content] !== "") { 60940 return assist.speak[_xfa_object.$content]; 60941 } 60942 60943 if (assist.toolTip) { 60944 return assist.toolTip[_xfa_object.$content]; 60945 } 60946 60947 return null; 60948} 60949 60950function valueToHtml(value) { 60951 return _utils.HTMLResult.success({ 60952 name: "div", 60953 attributes: { 60954 class: ["xfaRich"], 60955 style: Object.create(null) 60956 }, 60957 children: [{ 60958 name: "span", 60959 attributes: { 60960 style: Object.create(null) 60961 }, 60962 value 60963 }] 60964 }); 60965} 60966 60967function setFirstUnsplittable(node) { 60968 const root = node[_xfa_object.$getTemplateRoot](); 60969 60970 if (root[_xfa_object.$extra].firstUnsplittable === null) { 60971 root[_xfa_object.$extra].firstUnsplittable = node; 60972 root[_xfa_object.$extra].noLayoutFailure = true; 60973 } 60974} 60975 60976function unsetFirstUnsplittable(node) { 60977 const root = node[_xfa_object.$getTemplateRoot](); 60978 60979 if (root[_xfa_object.$extra].firstUnsplittable === node) { 60980 root[_xfa_object.$extra].noLayoutFailure = false;
60981 } 60982} 60983 60984function handleBreak(node) { 60985 if (node[_xfa_object.$extra]) { 60986 return false; 60987 } 60988 60989 node[_xfa_object.$extra] = Object.create(null); 60990 60991 if (node.targetType === "auto") { 60992 return false; 60993 } 60994 60995 const root = node[_xfa_object.$getTemplateRoot](); 60996 60997 let target = null; 60998 60999 if (node.target) { 61000 target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]()); 61001 61002 if (!target) { 61003 return false; 61004 } 61005 61006 target = target[0]; 61007 } 61008 61009 const { 61010 currentPageArea, 61011 currentContentArea 61012 } = root[_xfa_object.$extra]; 61013 61014 if (node.targetType === "pageArea") { 61015 if (!(target instanceof PageArea)) { 61016 target = null; 61017 } 61018 61019 if (node.startNew) { 61020 node[_xfa_object.$extra].target = target || currentPageArea; 61021 return true; 61022 } else if (target && target !== currentPageArea) { 61023 node[_xfa_object.$extra].target = target; 61024 return true; 61025 } 61026 61027 return false; 61028 } 61029 61030 if (!(target instanceof ContentArea)) { 61031 target = null; 61032 } 61033 61034 const pageArea = target && target[_xfa_object.$getParent](); 61035 61036 let index; 61037 let nextPageArea = pageArea; 61038 61039 if (node.startNew) { 61040 if (target) { 61041 const contentAreas = pageArea.contentArea.children; 61042 const indexForCurrent = contentAreas.indexOf(currentContentArea); 61043 const indexForTarget = contentAreas.indexOf(target); 61044 61045 if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) { 61046 nextPageArea = null; 61047 } 61048 61049 index = indexForTarget - 1; 61050 } else { 61051 index = currentPageArea.contentArea.children.indexOf(currentContentArea); 61052 } 61053 } else if (target && target !== currentContentArea) { 61054 const contentAreas = pageArea.contentArea.children; 61055 index = contentAreas.indexOf(target) - 1; 61056 nextPageArea = pageArea === currentPageArea ? null : pageArea; 61057 } else { 61058 return false; 61059 } 61060 61061 node[_xfa_object.$extra].target = nextPageArea; 61062 node[_xfa_object.$extra].index = index; 61063 return true; 61064} 61065 61066function handleOverflow(node, extraNode, space) { 61067 const root = node[_xfa_object.$getTemplateRoot](); 61068 61069 const saved = root[_xfa_object.$extra].noLayoutFailure; 61070 const savedMethod = extraNode[_xfa_object.$getSubformParent]; 61071 61072 extraNode[_xfa_object.$getSubformParent] = () => node; 61073 61074 root[_xfa_object.$extra].noLayoutFailure = true; 61075 61076 const res = extraNode[_xfa_object.$toHTML](space); 61077 61078 node[_xfa_object.$addHTML](res.html, res.bbox); 61079 61080 root[_xfa_object.$extra].noLayoutFailure = saved; 61081 extraNode[_xfa_object.$getSubformParent] = savedMethod; 61082} 61083 61084class AppearanceFilter extends _xfa_object.StringObject { 61085 constructor(attributes) { 61086 super(TEMPLATE_NS_ID, "appearanceFilter"); 61087 this.id = attributes.id || ""; 61088 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 61089 this.use = attributes.use || ""; 61090 this.usehref = attributes.usehref || ""; 61091 } 61092 61093} 61094 61095class Arc extends _xfa_object.XFAObject { 61096 constructor(attributes) { 61097 super(TEMPLATE_NS_ID, "arc", true); 61098 this.circular = (0, _utils.getInteger)({ 61099 data: attributes.circular, 61100 defaultValue: 0, 61101 validate: x => x === 1 61102 }); 61103 this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]); 61104 this.id = attributes.id || ""; 61105 this.startAngle = (0, _utils.getFloat)({ 61106 data: attributes.startAngle, 61107 defaultValue: 0, 61108 validate: x => true 61109 }); 61110 this.sweepAngle = (0, _utils.getFloat)({ 61111 data: attributes.sweepAngle, 61112 defaultValue: 360, 61113 validate: x => true 61114 }); 61115 this.use = attributes.use || ""; 61116 this.usehref = attributes.usehref || ""; 61117 this.edge = null; 61118 this.fill = null; 61119 } 61120 61121 [_xfa_object.$toHTML]() { 61122 const edge = this.edge ? this.edge : new Edge({}); 61123 61124 const edgeStyle = edge[_xfa_object.$toStyle](); 61125 61126 const style = Object.create(null); 61127 61128 if (this.fill && this.fill.presence === "visible") { 61129 Object.assign(style, this.fill[_xfa_object.$toStyle]()); 61130 } else { 61131 style.fill = "transparent"; 61132 } 61133 61134 style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0); 61135 style.stroke = edgeStyle.color; 61136 let arc; 61137 const attributes = { 61138 xmlns: SVG_NS, 61139 style: { 61140 width: "100%", 61141 height: "100%", 61142 overflow: "visible" 61143 } 61144 }; 61145 61146 if (this.sweepAngle === 360) { 61147 arc = { 61148 name: "ellipse", 61149 attributes: { 61150 xmlns: SVG_NS, 61151 cx: "50%", 61152 cy: "50%", 61153 rx: "50%", 61154 ry: "50%", 61155 style 61156 } 61157 }; 61158 } else { 61159 const startAngle = this.startAngle * Math.PI / 180; 61160 const sweepAngle = this.sweepAngle * Math.PI / 180; 61161 const largeArc = this.sweepAngle > 180 ? 1 : 0;
61162 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))]; 61163 arc = { 61164 name: "path", 61165 attributes: { 61166 xmlns: SVG_NS, 61167 d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`, 61168 vectorEffect: "non-scaling-stroke", 61169 style 61170 } 61171 }; 61172 Object.assign(attributes, { 61173 viewBox: "0 0 100 100", 61174 preserveAspectRatio: "none" 61175 }); 61176 } 61177 61178 const svg = { 61179 name: "svg", 61180 children: [arc], 61181 attributes 61182 }; 61183 61184 const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 61185 61186 if (hasMargin(parent)) { 61187 return _utils.HTMLResult.success({ 61188 name: "div", 61189 attributes: { 61190 style: { 61191 display: "inline", 61192 width: "100%", 61193 height: "100%" 61194 } 61195 }, 61196 children: [svg] 61197 }); 61198 } 61199 61200 svg.attributes.style.position = "absolute"; 61201 return _utils.HTMLResult.success(svg); 61202 } 61203 61204} 61205 61206class Area extends _xfa_object.XFAObject { 61207 constructor(attributes) { 61208 super(TEMPLATE_NS_ID, "area", true); 61209 this.colSpan = (0, _utils.getInteger)({ 61210 data: attributes.colSpan, 61211 defaultValue: 1, 61212 validate: n => n >= 1 || n === -1 61213 }); 61214 this.id = attributes.id || ""; 61215 this.name = attributes.name || ""; 61216 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 61217 this.use = attributes.use || ""; 61218 this.usehref = attributes.usehref || ""; 61219 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 61220 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 61221 this.desc = null; 61222 this.extras = null; 61223 this.area = new _xfa_object.XFAObjectArray(); 61224 this.draw = new _xfa_object.XFAObjectArray(); 61225 this.exObject = new _xfa_object.XFAObjectArray(); 61226 this.exclGroup = new _xfa_object.XFAObjectArray(); 61227 this.field = new _xfa_object.XFAObjectArray(); 61228 this.subform = new _xfa_object.XFAObjectArray(); 61229 this.subformSet = new _xfa_object.XFAObjectArray(); 61230 } 61231 61232 *[_xfa_object.$getContainedChildren]() { 61233 yield* getContainedChildren(this); 61234 } 61235 61236 [_xfa_object.$isTransparent]() { 61237 return true; 61238 } 61239 61240 [_xfa_object.$isBindable]() { 61241 return true; 61242 } 61243 61244 [_xfa_object.$addHTML](html, bbox) { 61245 const [x, y, w, h] = bbox; 61246 this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w); 61247 this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h); 61248 61249 this[_xfa_object.$extra].children.push(html); 61250 } 61251 61252 [_xfa_object.$getAvailableSpace]() { 61253 return this[_xfa_object.$extra].availableSpace; 61254 } 61255 61256 [_xfa_object.$toHTML](availableSpace) { 61257 const style = (0, _html_utils.toStyle)(this, "position"); 61258 const attributes = { 61259 style, 61260 id: this[_xfa_object.$uid], 61261 class: ["xfaArea"] 61262 }; 61263 61264 if ((0, _html_utils.isPrintOnly)(this)) { 61265 attributes.class.push("xfaPrintOnly"); 61266 } 61267 61268 if (this.name) { 61269 attributes.xfaName = this.name; 61270 } 61271 61272 const children = []; 61273 this[_xfa_object.$extra] = { 61274 children, 61275 width: 0, 61276 height: 0, 61277 availableSpace 61278 }; 61279 61280 const result = this[_xfa_object.$childrenToHTML]({ 61281 filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]), 61282 include: true 61283 }); 61284 61285 if (!result.success) { 61286 if (result.isBreak()) { 61287 return result; 61288 } 61289 61290 delete this[_xfa_object.$extra]; 61291 return _utils.HTMLResult.FAILURE; 61292 } 61293 61294 style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width); 61295 style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height); 61296 const html = { 61297 name: "div", 61298 attributes, 61299 children 61300 }; 61301 const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height]; 61302 delete this[_xfa_object.$extra]; 61303 return _utils.HTMLResult.success(html, bbox); 61304 } 61305 61306} 61307 61308class Assist extends _xfa_object.XFAObject { 61309 constructor(attributes) { 61310 super(TEMPLATE_NS_ID, "assist", true); 61311 this.id = attributes.id || ""; 61312 this.role = attributes.role || ""; 61313 this.use = attributes.use || ""; 61314 this.usehref = attributes.usehref || ""; 61315 this.speak = null; 61316 this.toolTip = null; 61317 } 61318 61319 [_xfa_object.$toHTML]() { 61320 return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null; 61321 } 61322 61323} 61324 61325class Barcode extends _xfa_object.XFAObject { 61326 constructor(attributes) { 61327 super(TEMPLATE_NS_ID, "barcode", true); 61328 this.charEncoding = (0, _utils.getKeyword)({ 61329 data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "", 61330 defaultValue: "", 61331 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}/) 61332 }); 61333 this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]); 61334 this.dataColumnCount = (0, _utils.getInteger)({ 61335 data: attributes.dataColumnCount, 61336 defaultValue: -1, 61337 validate: x => x >= 0 61338 }); 61339 this.dataLength = (0, _utils.getInteger)({ 61340 data: attributes.dataLength, 61341 defaultValue: -1, 61342 validate: x => x >= 0 61343 }); 61344 this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]); 61345 this.dataRowCount = (0, _utils.getInteger)({ 61346 data: attributes.dataRowCount, 61347 defaultValue: -1, 61348 validate: x => x >= 0 61349 }); 61350 this.endChar = attributes.endChar || ""; 61351 this.errorCorrectionLevel = (0, _utils.getInteger)({ 61352 data: attributes.errorCorrectionLevel, 61353 defaultValue: -1, 61354 validate: x => x >= 0 && x <= 8 61355 }); 61356 this.id = attributes.id || ""; 61357 this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm"); 61358 this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm"); 61359 this.printCheckDigit = (0, _utils.getInteger)({ 61360 data: attributes.printCheckDigit, 61361 defaultValue: 0, 61362 validate: x => x === 1 61363 }); 61364 this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio); 61365 this.startChar = attributes.startChar || ""; 61366 this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]); 61367 this.truncate = (0, _utils.getInteger)({ 61368 data: attributes.truncate, 61369 defaultValue: 0, 61370 validate: x => x === 1 61371 }); 61372 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", "postau
61372scust2", "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"]); 61373 this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]); 61374 this.use = attributes.use || ""; 61375 this.usehref = attributes.usehref || ""; 61376 this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio); 61377 this.encrypt = null; 61378 this.extras = null; 61379 } 61380 61381} 61382 61383class Bind extends _xfa_object.XFAObject { 61384 constructor(attributes) { 61385 super(TEMPLATE_NS_ID, "bind", true); 61386 this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]); 61387 this.ref = attributes.ref || ""; 61388 this.picture = null; 61389 } 61390 61391} 61392 61393class BindItems extends _xfa_object.XFAObject { 61394 constructor(attributes) { 61395 super(TEMPLATE_NS_ID, "bindItems"); 61396 this.connection = attributes.connection || ""; 61397 this.labelRef = attributes.labelRef || ""; 61398 this.ref = attributes.ref || ""; 61399 this.valueRef = attributes.valueRef || ""; 61400 } 61401 61402} 61403 61404exports.BindItems = BindItems; 61405 61406class Bookend extends _xfa_object.XFAObject { 61407 constructor(attributes) { 61408 super(TEMPLATE_NS_ID, "bookend"); 61409 this.id = attributes.id || ""; 61410 this.leader = attributes.leader || ""; 61411 this.trailer = attributes.trailer || ""; 61412 this.use = attributes.use || ""; 61413 this.usehref = attributes.usehref || ""; 61414 } 61415 61416} 61417 61418class BooleanElement extends _xfa_object.Option01 { 61419 constructor(attributes) { 61420 super(TEMPLATE_NS_ID, "boolean"); 61421 this.id = attributes.id || ""; 61422 this.name = attributes.name || ""; 61423 this.use = attributes.use || ""; 61424 this.usehref = attributes.usehref || ""; 61425 } 61426 61427 [_xfa_object.$toHTML](availableSpace) { 61428 return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0"); 61429 } 61430 61431} 61432 61433class Border extends _xfa_object.XFAObject { 61434 constructor(attributes) { 61435 super(TEMPLATE_NS_ID, "border", true); 61436 this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]); 61437 this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]); 61438 this.id = attributes.id || ""; 61439 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 61440 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 61441 this.use = attributes.use || ""; 61442 this.usehref = attributes.usehref || ""; 61443 this.corner = new _xfa_object.XFAObjectArray(4); 61444 this.edge = new _xfa_object.XFAObjectArray(4); 61445 this.extras = null; 61446 this.fill = null; 61447 this.margin = null; 61448 } 61449 61450 [_xfa_object.$getExtra]() { 61451 if (!this[_xfa_object.$extra]) { 61452 const edges = this.edge.children.slice(); 61453 61454 if (edges.length < 4) { 61455 const defaultEdge = edges[edges.length - 1] || new Edge({}); 61456 61457 for (let i = edges.length; i < 4; i++) { 61458 edges.push(defaultEdge); 61459 } 61460 } 61461 61462 const widths = edges.map(edge => edge.thickness); 61463 const insets = [0, 0, 0, 0]; 61464 61465 if (this.margin) { 61466 insets[0] = this.margin.topInset; 61467 insets[1] = this.margin.rightInset; 61468 insets[2] = this.margin.bottomInset; 61469 insets[3] = this.margin.leftInset; 61470 } 61471 61472 this[_xfa_object.$extra] = { 61473 widths, 61474 insets, 61475 edges 61476 }; 61477 } 61478 61479 return this[_xfa_object.$extra]; 61480 } 61481 61482 [_xfa_object.$toStyle]() { 61483 const { 61484 edges 61485 } = this[_xfa_object.$getExtra](); 61486 61487 const edgeStyles = edges.map(node => { 61488 const style = node[_xfa_object.$toStyle](); 61489 61490 style.color = style.color || "#000000"; 61491 return style; 61492 }); 61493 const style = Object.create(null); 61494 61495 if (this.margin) { 61496 Object.assign(style, this.margin[_xfa_object.$toStyle]()); 61497 } 61498 61499 if (this.fill && this.fill.presence === "visible") { 61500 Object.assign(style, this.fill[_xfa_object.$toStyle]()); 61501 } 61502 61503 if (this.corner.children.some(node =>
61503 node.radius !== 0)) { 61504 const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]()); 61505 61506 if (cornerStyles.length === 2 || cornerStyles.length === 3) { 61507 const last = cornerStyles[cornerStyles.length - 1]; 61508 61509 for (let i = cornerStyles.length; i < 4; i++) { 61510 cornerStyles.push(last); 61511 } 61512 } 61513 61514 style.borderRadius = cornerStyles.map(s => s.radius).join(" "); 61515 } 61516 61517 switch (this.presence) { 61518 case "invisible": 61519 case "hidden": 61520 style.borderStyle = ""; 61521 break; 61522 61523 case "inactive": 61524 style.borderStyle = "none"; 61525 break; 61526 61527 default: 61528 style.borderStyle = edgeStyles.map(s => s.style).join(" "); 61529 break; 61530 } 61531 61532 style.borderWidth = edgeStyles.map(s => s.width).join(" "); 61533 style.borderColor = edgeStyles.map(s => s.color).join(" "); 61534 return style; 61535 } 61536 61537} 61538 61539class Break extends _xfa_object.XFAObject { 61540 constructor(attributes) { 61541 super(TEMPLATE_NS_ID, "break", true); 61542 this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]); 61543 this.afterTarget = attributes.afterTarget || ""; 61544 this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]); 61545 this.beforeTarget = attributes.beforeTarget || ""; 61546 this.bookendLeader = attributes.bookendLeader || ""; 61547 this.bookendTrailer = attributes.bookendTrailer || ""; 61548 this.id = attributes.id || ""; 61549 this.overflowLeader = attributes.overflowLeader || ""; 61550 this.overflowTarget = attributes.overflowTarget || ""; 61551 this.overflowTrailer = attributes.overflowTrailer || ""; 61552 this.startNew = (0, _utils.getInteger)({ 61553 data: attributes.startNew, 61554 defaultValue: 0, 61555 validate: x => x === 1 61556 }); 61557 this.use = attributes.use || ""; 61558 this.usehref = attributes.usehref || ""; 61559 this.extras = null; 61560 } 61561 61562} 61563 61564class BreakAfter extends _xfa_object.XFAObject { 61565 constructor(attributes) { 61566 super(TEMPLATE_NS_ID, "breakAfter", true); 61567 this.id = attributes.id || ""; 61568 this.leader = attributes.leader || ""; 61569 this.startNew = (0, _utils.getInteger)({ 61570 data: attributes.startNew, 61571 defaultValue: 0, 61572 validate: x => x === 1 61573 }); 61574 this.target = attributes.target || ""; 61575 this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]); 61576 this.trailer = attributes.trailer || ""; 61577 this.use = attributes.use || ""; 61578 this.usehref = attributes.usehref || ""; 61579 this.script = null; 61580 } 61581 61582} 61583 61584class BreakBefore extends _xfa_object.XFAObject { 61585 constructor(attributes) { 61586 super(TEMPLATE_NS_ID, "breakBefore", true); 61587 this.id = attributes.id || ""; 61588 this.leader = attributes.leader || ""; 61589 this.startNew = (0, _utils.getInteger)({ 61590 data: attributes.startNew, 61591 defaultValue: 0, 61592 validate: x => x === 1 61593 }); 61594 this.target = attributes.target || ""; 61595 this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]); 61596 this.trailer = attributes.trailer || ""; 61597 this.use = attributes.use || ""; 61598 this.usehref = attributes.usehref || ""; 61599 this.script = null; 61600 } 61601 61602 [_xfa_object.$toHTML](availableSpace) { 61603 this[_xfa_object.$extra] = {}; 61604 return _utils.HTMLResult.FAILURE; 61605 } 61606 61607} 61608 61609class Button extends _xfa_object.XFAObject { 61610 constructor(attributes) { 61611 super(TEMPLATE_NS_ID, "button", true); 61612 this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]); 61613 this.id = attributes.id || ""; 61614 this.use = attributes.use || ""; 61615 this.usehref = attributes.usehref || ""; 61616 this.extras = null; 61617 } 61618 61619 [_xfa_object.$toHTML](availableSpace) { 61620 const parent = this[_xfa_object.$getParent](); 61621 61622 const grandpa = parent[_xfa_object.$getParent](); 61623 61624 const htmlButton = { 61625 name: "button", 61626 attributes: { 61627 id: this[_xfa_object.$uid], 61628 class: ["xfaButton"], 61629 style: {} 61630 }, 61631 children: [] 61632 }; 61633 61634 for (const event of grandpa.event.children) { 61635 if (event.activity !== "click" || !event.script) { 61636 continue; 61637 } 61638 61639 const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]); 61640 61641 if (!jsURL) { 61642 continue; 61643 } 61644 61645 const href = (0, _html_utils.fixURL)(jsURL.url); 61646 61647 if (!href) { 61648 continue; 61649 } 61650 61651 htmlButton.children.push({ 61652 name: "a", 61653 attributes: { 61654 id: "link" + this[_xfa_object.$uid], 61655 href, 61656 newWindow: jsURL.newWindow, 61657 class: ["xfaLink"], 61658 style: {} 61659 }, 61660 children: [] 61661 }); 61662 } 61663 61664 return _utils.HTMLResult.success(htmlButton); 61665 } 61666 61667} 61668 61669class Calculate extends _xfa_object.XFAObject { 61670 constructor(attributes) { 61671 super(TEMPLATE_NS_ID, "calculate", true); 61672 this.id = attributes.id || ""; 61673 this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]); 61674 this.use = attributes.use || ""; 61675 this.usehref = attributes.usehref || ""; 61676 this.extras = null; 61677 this.message = null; 61678 this.script = null; 61679 } 61680 61681} 61682 61683class Caption extends _xfa_object.XFAObject { 61684 constructor(attributes) { 61685 super(TEMPLATE_NS_ID, "caption", true); 61686 this.id = attributes.id || ""; 61687 this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]); 61688 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
61689 this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve)); 61690 this.use = attributes.use || ""; 61691 this.usehref = attributes.usehref || ""; 61692 this.extras = null; 61693 this.font = null; 61694 this.margin = null; 61695 this.para = null; 61696 this.value = null; 61697 } 61698 61699 [_xfa_object.$setValue](value) { 61700 _setValue(this, value); 61701 } 61702 61703 [_xfa_object.$getExtra](availableSpace) { 61704 if (!this[_xfa_object.$extra]) { 61705 let { 61706 width, 61707 height 61708 } = availableSpace; 61709 61710 switch (this.placement) { 61711 case "left": 61712 case "right": 61713 case "inline": 61714 width = this.reserve <= 0 ? width : this.reserve; 61715 break; 61716 61717 case "top": 61718 case "bottom": 61719 height = this.reserve <= 0 ? height : this.reserve; 61720 break; 61721 } 61722 61723 this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, { 61724 width, 61725 height 61726 }); 61727 } 61728 61729 return this[_xfa_object.$extra]; 61730 } 61731 61732 [_xfa_object.$toHTML](availableSpace) { 61733 if (!this.value) { 61734 return _utils.HTMLResult.EMPTY; 61735 } 61736 61737 this[_xfa_object.$pushPara](); 61738 61739 const value = this.value[_xfa_object.$toHTML](availableSpace).html; 61740 61741 if (!value) { 61742 this[_xfa_object.$popPara](); 61743 61744 return _utils.HTMLResult.EMPTY; 61745 } 61746 61747 const savedReserve = this.reserve; 61748 61749 if (this.reserve <= 0) { 61750 const { 61751 w, 61752 h 61753 } = this[_xfa_object.$getExtra](availableSpace); 61754 61755 switch (this.placement) { 61756 case "left": 61757 case "right": 61758 case "inline": 61759 this.reserve = w; 61760 break; 61761 61762 case "top": 61763 case "bottom": 61764 this.reserve = h; 61765 break; 61766 } 61767 } 61768 61769 const children = []; 61770 61771 if (typeof value === "string") { 61772 children.push({ 61773 name: "#text", 61774 value 61775 }); 61776 } else { 61777 children.push(value); 61778 } 61779 61780 const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility"); 61781 61782 switch (this.placement) { 61783 case "left": 61784 case "right": 61785 if (this.reserve > 0) { 61786 style.width = (0, _html_utils.measureToString)(this.reserve); 61787 } 61788 61789 break; 61790 61791 case "top": 61792 case "bottom": 61793 if (this.reserve > 0) { 61794 style.height = (0, _html_utils.measureToString)(this.reserve); 61795 } 61796 61797 break; 61798 } 61799 61800 (0, _html_utils.setPara)(this, null, value); 61801 61802 this[_xfa_object.$popPara](); 61803 61804 this.reserve = savedReserve; 61805 return _utils.HTMLResult.success({ 61806 name: "div", 61807 attributes: { 61808 style, 61809 class: ["xfaCaption"] 61810 }, 61811 children 61812 }); 61813 } 61814 61815} 61816 61817class Certificate extends _xfa_object.StringObject { 61818 constructor(attributes) { 61819 super(TEMPLATE_NS_ID, "certificate"); 61820 this.id = attributes.id || ""; 61821 this.name = attributes.name || ""; 61822 this.use = attributes.use || ""; 61823 this.usehref = attributes.usehref || ""; 61824 } 61825 61826} 61827 61828class Certificates extends _xfa_object.XFAObject { 61829 constructor(attributes) { 61830 super(TEMPLATE_NS_ID, "certificates", true); 61831 this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]); 61832 this.id = attributes.id || ""; 61833 this.url = attributes.url || ""; 61834 this.urlPolicy = attributes.urlPolicy || ""; 61835 this.use = attributes.use || ""; 61836 this.usehref = attributes.usehref || ""; 61837 this.encryption = null; 61838 this.issuers = null; 61839 this.keyUsage = null; 61840 this.oids = null; 61841 this.signing = null; 61842 this.subjectDNs = null; 61843 } 61844 61845} 61846 61847class CheckButton extends _xfa_object.XFAObject { 61848 constructor(attributes) { 61849 super(TEMPLATE_NS_ID, "checkButton", true); 61850 this.id = attributes.id || ""; 61851 this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]); 61852 this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]); 61853 this.size = (0, _utils.getMeasurement)(attributes.size, "10pt"); 61854 this.use = attributes.use || ""; 61855 this.usehref = attributes.usehref || ""; 61856 this.border = null; 61857 this.extras = null; 61858 this.margin = null; 61859 } 61860 61861 [_xfa_object.$toHTML](availableSpace) { 61862 const style = (0, _html_utils.toStyle)("margin"); 61863 const size = (0, _html_utils.measureToString)(this.size); 61864 style.width = style.height = size; 61865 let type;
61866 let className; 61867 let groupId; 61868 61869 const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 61870 61871 const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || []; 61872 const exportedValue = { 61873 on: (items[0] !== undefined ? items[0] : "on").toString(), 61874 off: (items[1] !== undefined ? items[1] : "off").toString() 61875 }; 61876 const value = field.value && field.value[_xfa_object.$text]() || "off"; 61877 const checked = value === exportedValue.on || undefined; 61878 61879 const container = field[_xfa_object.$getSubformParent](); 61880 61881 const fieldId = field[_xfa_object.$uid]; 61882 let dataId; 61883 61884 if (container instanceof ExclGroup) { 61885 groupId = container[_xfa_object.$uid]; 61886 type = "radio"; 61887 className = "xfaRadio"; 61888 dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid]; 61889 } else { 61890 type = "checkbox"; 61891 className = "xfaCheckbox"; 61892 dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid]; 61893 } 61894 61895 const input = { 61896 name: "input", 61897 attributes: { 61898 class: [className], 61899 style, 61900 fieldId, 61901 dataId, 61902 type, 61903 checked, 61904 xfaOn: exportedValue.on, 61905 xfaOff: exportedValue.off, 61906 "aria-label": ariaLabel(field) 61907 } 61908 }; 61909 61910 if (groupId) { 61911 input.attributes.name = groupId; 61912 } 61913 61914 return _utils.HTMLResult.success({ 61915 name: "label", 61916 attributes: { 61917 class: ["xfaLabel"] 61918 }, 61919 children: [input] 61920 }); 61921 } 61922 61923} 61924 61925class ChoiceList extends _xfa_object.XFAObject { 61926 constructor(attributes) { 61927 super(TEMPLATE_NS_ID, "choiceList", true); 61928 this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]); 61929 this.id = attributes.id || ""; 61930 this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]); 61931 this.textEntry = (0, _utils.getInteger)({ 61932 data: attributes.textEntry, 61933 defaultValue: 0, 61934 validate: x => x === 1 61935 }); 61936 this.use = attributes.use || ""; 61937 this.usehref = attributes.usehref || ""; 61938 this.border = null; 61939 this.extras = null; 61940 this.margin = null; 61941 } 61942 61943 [_xfa_object.$toHTML](availableSpace) { 61944 const style = (0, _html_utils.toStyle)(this, "border", "margin"); 61945 61946 const ui = this[_xfa_object.$getParent](); 61947 61948 const field = ui[_xfa_object.$getParent](); 61949 61950 const fontSize = field.font && field.font.size || 10; 61951 const optionStyle = { 61952 fontSize: `calc(${fontSize}px * var(--zoom-factor))` 61953 }; 61954 const children = []; 61955 61956 if (field.items.children.length > 0) { 61957 const items = field.items; 61958 let displayedIndex = 0; 61959 let saveIndex = 0; 61960 61961 if (items.children.length === 2) { 61962 displayedIndex = items.children[0].save; 61963 saveIndex = 1 - displayedIndex; 61964 } 61965 61966 const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html; 61967 61968 const values = items.children[saveIndex][_xfa_object.$toHTML]().html; 61969 61970 let selected = false; 61971 const value = field.value && field.value[_xfa_object.$text]() || ""; 61972 61973 for (let i = 0, ii = displayed.length; i < ii; i++) { 61974 const option = { 61975 name: "option", 61976 attributes: { 61977 value: values[i] || displayed[i], 61978 style: optionStyle 61979 }, 61980 value: displayed[i] 61981 }; 61982 61983 if (values[i] === value) { 61984 option.attributes.selected = selected = true; 61985 } 61986 61987 children.push(option); 61988 } 61989 61990 if (!selected) { 61991 children.splice(0, 0, { 61992 name: "option", 61993 attributes: { 61994 hidden: true, 61995 selected: true 61996 }, 61997 value: " " 61998 }); 61999 } 62000 } 62001 62002 const selectAttributes = { 62003 class: ["xfaSelect"], 62004 fieldId: field[_xfa_object.$uid], 62005 dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], 62006 style, 62007 "aria-label": ariaLabel(field) 62008 }; 62009 62010 if (this.open === "multiSelect") { 62011 selectAttributes.multiple = true; 62012 } 62013 62014 return _utils.HTMLResult.success({ 62015 name: "label", 62016 attributes: { 62017 class: ["xfaLabel"] 62018 }, 62019 children: [{ 62020 name: "select", 62021 children, 62022 attributes: selectAttributes 62023 }] 62024 }); 62025 } 62026 62027} 62028 62029class Color extends _xfa_object.XFAObject { 62030 constructor(attributes) { 62031 super(TEMPLATE_NS_ID, "color", true); 62032 this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]); 62033 this.id = attributes.id || ""; 62034 this.use = attributes.use || ""; 62035 this.usehref = attributes.usehref || ""; 62036 this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : ""; 62037 this.extras = null; 62038 } 62039 62040 [_xfa_object.$hasSettableValue]() { 62041 return false;
62042 } 62043 62044 [_xfa_object.$toStyle]() { 62045 return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null; 62046 } 62047 62048} 62049 62050class Comb extends _xfa_object.XFAObject { 62051 constructor(attributes) { 62052 super(TEMPLATE_NS_ID, "comb"); 62053 this.id = attributes.id || ""; 62054 this.numberOfCells = (0, _utils.getInteger)({ 62055 data: attributes.numberOfCells, 62056 defaultValue: 0, 62057 validate: x => x >= 0 62058 }); 62059 this.use = attributes.use || ""; 62060 this.usehref = attributes.usehref || ""; 62061 } 62062 62063} 62064 62065class Connect extends _xfa_object.XFAObject { 62066 constructor(attributes) { 62067 super(TEMPLATE_NS_ID, "connect", true); 62068 this.connection = attributes.connection || ""; 62069 this.id = attributes.id || ""; 62070 this.ref = attributes.ref || ""; 62071 this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]); 62072 this.use = attributes.use || ""; 62073 this.usehref = attributes.usehref || ""; 62074 this.picture = null; 62075 } 62076 62077} 62078 62079class ContentArea extends _xfa_object.XFAObject { 62080 constructor(attributes) { 62081 super(TEMPLATE_NS_ID, "contentArea", true); 62082 this.h = (0, _utils.getMeasurement)(attributes.h); 62083 this.id = attributes.id || ""; 62084 this.name = attributes.name || ""; 62085 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 62086 this.use = attributes.use || ""; 62087 this.usehref = attributes.usehref || ""; 62088 this.w = (0, _utils.getMeasurement)(attributes.w); 62089 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 62090 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 62091 this.desc = null; 62092 this.extras = null; 62093 } 62094 62095 [_xfa_object.$toHTML](availableSpace) { 62096 const left = (0, _html_utils.measureToString)(this.x); 62097 const top = (0, _html_utils.measureToString)(this.y); 62098 const style = { 62099 left, 62100 top, 62101 width: (0, _html_utils.measureToString)(this.w), 62102 height: (0, _html_utils.measureToString)(this.h) 62103 }; 62104 const classNames = ["xfaContentarea"]; 62105 62106 if ((0, _html_utils.isPrintOnly)(this)) { 62107 classNames.push("xfaPrintOnly"); 62108 } 62109 62110 return _utils.HTMLResult.success({ 62111 name: "div", 62112 children: [], 62113 attributes: { 62114 style, 62115 class: classNames, 62116 id: this[_xfa_object.$uid] 62117 } 62118 }); 62119 } 62120 62121} 62122 62123class Corner extends _xfa_object.XFAObject { 62124 constructor(attributes) { 62125 super(TEMPLATE_NS_ID, "corner", true); 62126 this.id = attributes.id || ""; 62127 this.inverted = (0, _utils.getInteger)({ 62128 data: attributes.inverted, 62129 defaultValue: 0, 62130 validate: x => x === 1 62131 }); 62132 this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]); 62133 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 62134 this.radius = (0, _utils.getMeasurement)(attributes.radius); 62135 this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]); 62136 this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt"); 62137 this.use = attributes.use || ""; 62138 this.usehref = attributes.usehref || ""; 62139 this.color = null; 62140 this.extras = null; 62141 } 62142 62143 [_xfa_object.$toStyle]() { 62144 const style = (0, _html_utils.toStyle)(this, "visibility"); 62145 style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius); 62146 return style; 62147 } 62148 62149} 62150 62151class DateElement extends _xfa_object.ContentObject { 62152 constructor(attributes) { 62153 super(TEMPLATE_NS_ID, "date"); 62154 this.id = attributes.id || ""; 62155 this.name = attributes.name || ""; 62156 this.use = attributes.use || ""; 62157 this.usehref = attributes.usehref || ""; 62158 } 62159 62160 [_xfa_object.$finalize]() { 62161 const date = this[_xfa_object.$content].trim(); 62162 62163 this[_xfa_object.$content] = date ? new Date(date) : null; 62164 } 62165 62166 [_xfa_object.$toHTML](availableSpace) { 62167 return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : ""); 62168 } 62169 62170} 62171 62172class DateTime extends _xfa_object.ContentObject { 62173 constructor(attributes) { 62174 super(TEMPLATE_NS_ID, "dateTime"); 62175 this.id = attributes.id || ""; 62176 this.name = attributes.name || ""; 62177 this.use = attributes.use || ""; 62178 this.usehref = attributes.usehref || ""; 62179 } 62180 62181 [_xfa_object.$finalize]() { 62182 const date = this[_xfa_object.$content].trim(); 62183 62184 this[_xfa_object.$content] = date ? new Date(date) : null; 62185 } 62186 62187 [_xfa_object.$toHTML](availableSpace) { 62188 return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : ""); 62189 } 62190 62191} 62192 62193class DateTimeEdit extends _xfa_object.XFAObject { 62194 constructor(attributes) { 62195 super(TEMPLATE_NS_ID, "dateTimeEdit", true); 62196 this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); 62197 this.id = attributes.id || ""; 62198 this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]); 62199 this.use = attributes.use || ""; 62200 this.usehref = attributes.usehref || ""; 62201 this.border = null; 62202 this.comb = null; 62203 this.extras = null; 62204 this.margin = null; 62205 } 62206 62207 [_xfa_object.$toHTML](availableSpace) { 62208 const style = (0, _html_utils.toStyle)(this, "border", "font", "margin"); 62209 62210 const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 62211 62212 const html = { 62213 name: "input", 62214 attributes: { 62215 type: "text", 62216 fieldId: field[_xfa_object.$uid], 62217 dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], 62218 class: ["xfaTextfield"], 62219 style, 62220 "aria-label": ariaLabel(field) 62221 } 62222 }; 62223 return _utils.HTMLResult.success({ 62224 name: "label", 62225 attributes: { 62226 class: ["xfaLabel"] 62227 }, 62228 children: [html] 62229 }); 62230 } 62231 62232} 62233 62234class Decimal extends _xfa_object.ContentObject { 62235 constructor(attributes) { 62236 super(TEMPLATE_NS_ID, "decimal"); 62237 this.fracDigits = (0, _utils.getInteger)({ 62238 data: attributes.fracDigits, 62239 defaultValue: 2, 62240 validate: x => true 62241 }); 62242 this.id = attributes.id || ""; 62243 this.leadDigits = (0, _utils.getInteger)({ 62244 data: attributes.leadDigits, 62245 defaultValue: -1, 62246 validate: x => true 62247 }); 62248 this.name = attributes.name || ""; 62249 this.use = attributes.use || ""; 62250 this.usehref = attributes.usehref || ""; 62251 } 62252 62253 [_xfa_object.$finalize]() { 62254 const number = parseFloat(this[_xfa_object.$content].trim()); 62255 this[_xfa_object.$content] = isNaN(number) ? null : number; 62256 } 62257 62258 [_xfa_object.$toHTML](availableSpace) { 62259 return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : ""); 62260 } 62261 62262} 62263 62264class DefaultUi extends _xfa_object.XFAObject { 62265 constructor(attributes) { 62266 super(TEMPLATE_NS_ID, "defaultUi", true); 62267 this.id = attributes.id || ""; 62268 this.use = attributes.use || ""; 62269 this.usehref = attributes.usehref || ""; 62270 this.extras = null; 62271 } 62272 62273} 62274 62275class Desc extends _xfa_object.XFAObject { 62276 constructor(attributes) { 62277 super(TEMPLATE_NS_ID, "desc", true); 62278 this.id = attributes.id || ""; 62279 this.use = attributes.use || ""; 62280 this.usehref = attributes.usehref || ""; 62281 this.boolean = new _xfa_object.XFAObjectArray(); 62282 this.date = new _xfa_object.XFAObjectArray(); 62283 this.dateTime = new _xfa_object.XFAObjectArray(); 62284 this.decimal = new _xfa_object.XFAObjectArray(); 62285 this.exData = new _xfa_object.XFAObjectArray(); 62286 this.float = new _xfa_object.XFAObjectArray(); 62287 this.image = new _xfa_object.XFAObjectArray(); 62288 this.integer = new _xfa_object.XFAObjectArray(); 62289 this.text = new _xfa_object.XFAObjectArray(); 62290 this.time = new _xfa_object.XFAObjectArray(); 62291 } 62292 62293} 62294 62295class DigestMethod extends _xfa_object.OptionObject { 62296 constructor(attributes) { 62297 super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]); 62298 this.id = attributes.id || ""; 62299 this.use = attributes.use || ""; 62300 this.usehref = attributes.usehref || ""; 62301 } 62302 62303} 62304 62305class DigestMethods extends _xfa_object.XFAObject { 62306 constructor(attributes) { 62307 super(TEMPLATE_NS_ID, "digestMethods", true); 62308 this.id = attributes.id || ""; 62309 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 62310 this.use = attributes.use || ""; 62311 this.usehref = attributes.usehref || ""; 62312 this.digestMethod = new _xfa_object.XFAObjectArray(); 62313 } 62314 62315} 62316 62317class Draw extends _xfa_object.XFAObject { 62318 constructor(attributes) { 62319 super(TEMPLATE_NS_ID, "draw", true); 62320 this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 62321 this.colSpan = (0, _utils.getInteger)({ 62322 data: attributes.colSpan, 62323 defaultValue: 1, 62324 validate: n => n >= 1 || n === -1 62325 }); 62326 this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : ""; 62327 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 62328 this.id = attributes.id || ""; 62329 this.locale = attributes.locale || ""; 62330 this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt"); 62331 this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt"); 62332 this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt"); 62333 this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt"); 62334 this.name = attributes.name || ""; 62335 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 62336 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 62337 this.rotate = (0, _utils.getInteger)({ 62338 data: attributes.rotate, 62339 defaultValue: 0, 62340 validate: x => x % 90 === 0 62341 }); 62342 this.use = attributes.use || ""; 62343 this.usehref = attributes.usehref || ""; 62344 this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : ""; 62345 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 62346 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 62347 this.assist = null; 62348 this.border = null; 62349 this.caption = null; 62350 this.desc = null; 62351 this.extras = null; 62352 this.font = null; 62353 this.keep = null; 62354 this.margin = null; 62355 this.para = null; 62356 this.traversal = null; 62357 this.ui = null; 62358 this.value = null; 62359 this.setProperty = new _xfa_object.XFAObjectArray(); 62360 } 62361 62362 [_xfa_object.$setValue](value) { 62363 _setValue(this, value); 62364 } 62365 62366 [_xfa_object.$toHTML](availableSpace) { 62367 setTabIndex(this); 62368 62369 if (this.presence === "hidden" || this.presence === "inactive") { 62370 return _utils.HTMLResult.EMPTY; 62371 } 62372 62373 (0, _html_utils.fixDimensions)(this); 62374 62375 this[_xfa_object.$pushPara](); 62376 62377 const savedW = this.w; 62378 const savedH = this.h; 62379 const { 62380 w, 62381 h, 62382 isBroken 62383 } = (0, _html_utils.layoutNode)(this, availableSpace); 62384 62385 if (w && this.w === "") { 62386 if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) { 62387 this[_xfa_object.$popPara](); 62388 62389 return _utils.HTMLResult.FAILURE; 62390 } 62391 62392 this.w = w; 62393 } 62394 62395 if (h && this.h === "") { 62396 this.h = h; 62397 } 62398 62399 setFirstUnsplittable(this); 62400 62401 if (!(0, _layout.checkDimensions)(this, availableSpace)) { 62402 this.w = savedW; 62403 this.h = savedH; 62404 62405 this[_xfa_object.$popPara](); 62406 62407 return _utils.HTMLResult.FAILURE; 62408 } 62409 62410 unsetFirstUnsplittable(this); 62411 const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin"); 62412 (0, _html_utils.setMinMaxDimensions)(this, style); 62413 62414 if (style.margin) { 62415 style.padding = style.margin; 62416 delete style.margin; 62417 } 62418 62419 const classNames = ["xfaDraw"]; 62420 62421 if (this.font) { 62422 classNames.push("xfaFont"); 62423 } 62424 62425 if ((0, _html_utils.isPrintOnly)(this)) { 62426 classNames.push("xfaPrintOnly"); 62427 } 62428 62429 const attributes = { 62430 style, 62431 id: this[_xfa_object.$uid], 62432 class: classNames 62433 }; 62434 62435 if (this.name) { 62436 attributes.xfaName = this.name; 62437 } 62438 62439 const html = { 62440 name: "div", 62441 attributes, 62442 children: [] 62443 }; 62444 applyAssist(this, attributes); 62445 const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace); 62446 const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null; 62447 62448 if (value === null) { 62449 this.w = savedW; 62450 this.h = savedH; 62451 62452 this[_xfa_object.$popPara](); 62453 62454 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 62455 } 62456 62457 html.children.push(value); 62458 (0, _html_utils.setPara)(this, style, value); 62459 this.w = savedW; 62460 this.h = savedH; 62461 62462 this[_xfa_object.$popPara](); 62463 62464 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 62465 } 62466 62467} 62468 62469class Edge extends _xfa_object.XFAObject { 62470 constructor(attributes) { 62471 super(TEMPLATE_NS_ID, "edge", true); 62472 this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]); 62473 this.id = attributes.id || ""; 62474 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 62475 this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]); 62476 this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt"); 62477 this.use = attributes.use || ""; 62478 this.usehref = attributes.usehref || ""; 62479 this.color = null; 62480 this.extras = null; 62481 } 62482 62483 [_xfa_object.$toStyle]() { 62484 const style = (0, _html_utils.toStyle)(this, "visibility");
62485 Object.assign(style, { 62486 linecap: this.cap, 62487 width: (0, _html_utils.measureToString)(this.thickness), 62488 color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000", 62489 style: "" 62490 }); 62491 62492 if (this.presence !== "visible") { 62493 style.style = "none"; 62494 } else { 62495 switch (this.stroke) { 62496 case "solid": 62497 style.style = "solid"; 62498 break; 62499 62500 case "dashDot": 62501 style.style = "dashed"; 62502 break; 62503 62504 case "dashDotDot": 62505 style.style = "dashed"; 62506 break; 62507 62508 case "dashed": 62509 style.style = "dashed"; 62510 break; 62511 62512 case "dotted": 62513 style.style = "dotted"; 62514 break; 62515 62516 case "embossed": 62517 style.style = "ridge"; 62518 break; 62519 62520 case "etched": 62521 style.style = "groove"; 62522 break; 62523 62524 case "lowered": 62525 style.style = "inset"; 62526 break; 62527 62528 case "raised": 62529 style.style = "outset"; 62530 break; 62531 } 62532 } 62533 62534 return style; 62535 } 62536 62537} 62538 62539class Encoding extends _xfa_object.OptionObject { 62540 constructor(attributes) { 62541 super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]); 62542 this.id = attributes.id || ""; 62543 this.use = attributes.use || ""; 62544 this.usehref = attributes.usehref || ""; 62545 } 62546 62547} 62548 62549class Encodings extends _xfa_object.XFAObject { 62550 constructor(attributes) { 62551 super(TEMPLATE_NS_ID, "encodings", true); 62552 this.id = attributes.id || ""; 62553 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 62554 this.use = attributes.use || ""; 62555 this.usehref = attributes.usehref || ""; 62556 this.encoding = new _xfa_object.XFAObjectArray(); 62557 } 62558 62559} 62560 62561class Encrypt extends _xfa_object.XFAObject { 62562 constructor(attributes) { 62563 super(TEMPLATE_NS_ID, "encrypt", true); 62564 this.id = attributes.id || ""; 62565 this.use = attributes.use || ""; 62566 this.usehref = attributes.usehref || ""; 62567 this.certificate = null; 62568 } 62569 62570} 62571 62572class EncryptData extends _xfa_object.XFAObject { 62573 constructor(attributes) { 62574 super(TEMPLATE_NS_ID, "encryptData", true); 62575 this.id = attributes.id || ""; 62576 this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]); 62577 this.target = attributes.target || ""; 62578 this.use = attributes.use || ""; 62579 this.usehref = attributes.usehref || ""; 62580 this.filter = null; 62581 this.manifest = null; 62582 } 62583 62584} 62585 62586class Encryption extends _xfa_object.XFAObject { 62587 constructor(attributes) { 62588 super(TEMPLATE_NS_ID, "encryption", true); 62589 this.id = attributes.id || ""; 62590 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 62591 this.use = attributes.use || ""; 62592 this.usehref = attributes.usehref || ""; 62593 this.certificate = new _xfa_object.XFAObjectArray(); 62594 } 62595 62596} 62597 62598class EncryptionMethod extends _xfa_object.OptionObject { 62599 constructor(attributes) { 62600 super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]); 62601 this.id = attributes.id || ""; 62602 this.use = attributes.use || ""; 62603 this.usehref = attributes.usehref || ""; 62604 } 62605 62606} 62607 62608class EncryptionMethods extends _xfa_object.XFAObject { 62609 constructor(attributes) { 62610 super(TEMPLATE_NS_ID, "encryptionMethods", true); 62611 this.id = attributes.id || ""; 62612 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 62613 this.use = attributes.use || ""; 62614 this.usehref = attributes.usehref || ""; 62615 this.encryptionMethod = new _xfa_object.XFAObjectArray(); 62616 } 62617 62618} 62619 62620class Event extends _xfa_object.XFAObject { 62621 constructor(attributes) { 62622 super(TEMPLATE_NS_ID, "event", true); 62623 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"]); 62624 this.id = attributes.id || ""; 62625 this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]); 62626 this.name = attributes.name || ""; 62627 this.ref = attributes.ref || ""; 62628 this.use = attributes.use || ""; 62629 this.usehref = attributes.usehref || ""; 62630 this.extras = null; 62631 this.encryptData = null; 62632 this.execute = null; 62633 this.script = null; 62634 this.signData = null; 62635 this.submit = null; 62636 } 62637 62638} 62639 62640class ExData extends _xfa_object.ContentObject { 62641 constructor(attributes) { 62642 super(TEMPLATE_NS_ID, "exData"); 62643 this.contentType = attributes.contentType || ""; 62644 this.href = attributes.href || ""; 62645 this.id = attributes.id || ""; 62646 this.maxLength = (0, _utils.getInteger)({ 62647 data: attributes.maxLength,
62648 defaultValue: -1, 62649 validate: x => x >= -1 62650 }); 62651 this.name = attributes.name || ""; 62652 this.rid = attributes.rid || ""; 62653 this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]); 62654 this.use = attributes.use || ""; 62655 this.usehref = attributes.usehref || ""; 62656 } 62657 62658 [_xfa_object.$isCDATAXml]() { 62659 return this.contentType === "text/html"; 62660 } 62661 62662 [_xfa_object.$onChild](child) { 62663 if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) { 62664 this[_xfa_object.$content] = child; 62665 return true; 62666 } 62667 62668 if (this.contentType === "text/xml") { 62669 this[_xfa_object.$content] = child; 62670 return true; 62671 } 62672 62673 return false; 62674 } 62675 62676 [_xfa_object.$toHTML](availableSpace) { 62677 if (this.contentType !== "text/html" || !this[_xfa_object.$content]) { 62678 return _utils.HTMLResult.EMPTY; 62679 } 62680 62681 return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace); 62682 } 62683 62684} 62685 62686class ExObject extends _xfa_object.XFAObject { 62687 constructor(attributes) { 62688 super(TEMPLATE_NS_ID, "exObject", true); 62689 this.archive = attributes.archive || ""; 62690 this.classId = attributes.classId || ""; 62691 this.codeBase = attributes.codeBase || ""; 62692 this.codeType = attributes.codeType || ""; 62693 this.id = attributes.id || ""; 62694 this.name = attributes.name || ""; 62695 this.use = attributes.use || ""; 62696 this.usehref = attributes.usehref || ""; 62697 this.extras = null; 62698 this.boolean = new _xfa_object.XFAObjectArray(); 62699 this.date = new _xfa_object.XFAObjectArray(); 62700 this.dateTime = new _xfa_object.XFAObjectArray(); 62701 this.decimal = new _xfa_object.XFAObjectArray(); 62702 this.exData = new _xfa_object.XFAObjectArray(); 62703 this.exObject = new _xfa_object.XFAObjectArray(); 62704 this.float = new _xfa_object.XFAObjectArray(); 62705 this.image = new _xfa_object.XFAObjectArray(); 62706 this.integer = new _xfa_object.XFAObjectArray(); 62707 this.text = new _xfa_object.XFAObjectArray(); 62708 this.time = new _xfa_object.XFAObjectArray(); 62709 } 62710 62711} 62712 62713class ExclGroup extends _xfa_object.XFAObject { 62714 constructor(attributes) { 62715 super(TEMPLATE_NS_ID, "exclGroup", true); 62716 this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]); 62717 this.accessKey = attributes.accessKey || ""; 62718 this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 62719 this.colSpan = (0, _utils.getInteger)({ 62720 data: attributes.colSpan, 62721 defaultValue: 1, 62722 validate: n => n >= 1 || n === -1 62723 }); 62724 this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : ""; 62725 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 62726 this.id = attributes.id || ""; 62727 this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]); 62728 this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt"); 62729 this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt"); 62730 this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt"); 62731 this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt"); 62732 this.name = attributes.name || ""; 62733 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 62734 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 62735 this.use = attributes.use || ""; 62736 this.usehref = attributes.usehref || ""; 62737 this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : ""; 62738 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 62739 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 62740 this.assist = null; 62741 this.bind = null; 62742 this.border = null; 62743 this.calculate = null; 62744 this.caption = null; 62745 this.desc = null; 62746 this.extras = null; 62747 this.margin = null; 62748 this.para = null; 62749 this.traversal = null; 62750 this.validate = null; 62751 this.connect = new _xfa_object.XFAObjectArray(); 62752 this.event = new _xfa_object.XFAObjectArray(); 62753 this.field = new _xfa_object.XFAObjectArray(); 62754 this.setProperty = new _xfa_object.XFAObjectArray(); 62755 } 62756 62757 [_xfa_object.$isBindable]() { 62758 return true; 62759 } 62760 62761 [_xfa_object.$hasSettableValue]() { 62762 return true; 62763 } 62764 62765 [_xfa_object.$setValue](value) { 62766 for (const field of this.field.children) { 62767 if (!field.value) { 62768 const nodeValue = new Value({}); 62769 62770 field[_xfa_object.$appendChild](nodeValue); 62771 62772 field.value = nodeValue; 62773 } 62774 62775 field.value[_xfa_object.$setValue](value); 62776 } 62777 } 62778 62779 [_xfa_object.$isThereMoreWidth]() { 62780 return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth](); 62781 } 62782 62783 [_xfa_object.$isSplittable]() { 62784 const parent = this[_xfa_object.$getSubformParent](); 62785 62786 if (!parent[_xfa_object.$isSplittable]()) { 62787 return false;
62788 } 62789 62790 if (this[_xfa_object.$extra]._isSplittable !== undefined) { 62791 return this[_xfa_object.$extra]._isSplittable; 62792 } 62793 62794 if (this.layout === "position" || this.layout.includes("row")) { 62795 this[_xfa_object.$extra]._isSplittable = false; 62796 return false; 62797 } 62798 62799 if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) { 62800 return false; 62801 } 62802 62803 this[_xfa_object.$extra]._isSplittable = true; 62804 return true; 62805 } 62806 62807 [_xfa_object.$flushHTML]() { 62808 return (0, _layout.flushHTML)(this); 62809 } 62810 62811 [_xfa_object.$addHTML](html, bbox) { 62812 (0, _layout.addHTML)(this, html, bbox); 62813 } 62814 62815 [_xfa_object.$getAvailableSpace]() { 62816 return (0, _layout.getAvailableSpace)(this); 62817 } 62818 62819 [_xfa_object.$toHTML](availableSpace) { 62820 setTabIndex(this); 62821 62822 if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) { 62823 return _utils.HTMLResult.EMPTY; 62824 } 62825 62826 (0, _html_utils.fixDimensions)(this); 62827 const children = []; 62828 const attributes = { 62829 id: this[_xfa_object.$uid], 62830 class: [] 62831 }; 62832 (0, _html_utils.setAccess)(this, attributes.class); 62833 62834 if (!this[_xfa_object.$extra]) { 62835 this[_xfa_object.$extra] = Object.create(null); 62836 } 62837 62838 Object.assign(this[_xfa_object.$extra], { 62839 children, 62840 attributes, 62841 attempt: 0, 62842 line: null, 62843 numberInLine: 0, 62844 availableSpace: { 62845 width: Math.min(this.w || Infinity, availableSpace.width), 62846 height: Math.min(this.h || Infinity, availableSpace.height) 62847 }, 62848 width: 0, 62849 height: 0, 62850 prevHeight: 0, 62851 currentWidth: 0 62852 }); 62853 62854 const isSplittable = this[_xfa_object.$isSplittable](); 62855 62856 if (!isSplittable) { 62857 setFirstUnsplittable(this); 62858 } 62859 62860 if (!(0, _layout.checkDimensions)(this, availableSpace)) { 62861 return _utils.HTMLResult.FAILURE; 62862 } 62863 62864 const filter = new Set(["field"]); 62865 62866 if (this.layout.includes("row")) { 62867 const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths; 62868 62869 if (Array.isArray(columnWidths) && columnWidths.length > 0) { 62870 this[_xfa_object.$extra].columnWidths = columnWidths; 62871 this[_xfa_object.$extra].currentColumn = 0; 62872 } 62873 } 62874 62875 const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign"); 62876 const classNames = ["xfaExclgroup"]; 62877 const cl = (0, _html_utils.layoutClass)(this); 62878 62879 if (cl) { 62880 classNames.push(cl); 62881 } 62882 62883 if ((0, _html_utils.isPrintOnly)(this)) { 62884 classNames.push("xfaPrintOnly"); 62885 } 62886 62887 attributes.style = style; 62888 attributes.class = classNames; 62889 62890 if (this.name) { 62891 attributes.xfaName = this.name; 62892 } 62893 62894 this[_xfa_object.$pushPara](); 62895 62896 const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb"; 62897 const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1; 62898 62899 for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) { 62900 if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) { 62901 this[_xfa_object.$extra].numberInLine = 0; 62902 } 62903 62904 const result = this[_xfa_object.$childrenToHTML]({ 62905 filter, 62906 include: true 62907 }); 62908 62909 if (result.success) { 62910 break; 62911 } 62912 62913 if (result.isBreak()) { 62914 this[_xfa_object.$popPara](); 62915 62916 return result; 62917 } 62918 62919 if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { 62920 this[_xfa_object.$extra].attempt = maxRun; 62921 break; 62922 } 62923 } 62924 62925 this[_xfa_object.$popPara](); 62926 62927 if (!isSplittable) { 62928 unsetFirstUnsplittable(this); 62929 } 62930 62931 if (this[_xfa_object.$extra].attempt === maxRun) { 62932 if (!isSplittable) { 62933 delete this[_xfa_object.$extra]; 62934 } 62935 62936 return _utils.HTMLResult.FAILURE; 62937 } 62938 62939 let marginH = 0; 62940 let marginV = 0; 62941 62942 if (this.margin) { 62943 marginH = this.margin.leftInset + this.margin.rightInset; 62944 marginV = this.margin.topInset + this.margin.bottomInset; 62945 } 62946 62947 const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0); 62948 const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0); 62949 const bbox = [this.x, this.y, width, height]; 62950 62951 if (this.w === "") { 62952 style.width = (0, _html_utils.measureToString)(width); 62953 } 62954 62955 if (this.h === "") { 62956 style.height = (0, _html_utils.measureToString)(height); 62957 } 62958 62959 const html = { 62960 name: "div", 62961 attributes, 62962 children 62963 }; 62964 applyAssist(this, attributes); 62965 delete this[_xfa_object.$extra]; 62966 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 62967 } 62968 62969} 62970 62971class Execute extends _xfa_object.XFAObject { 62972 constructor(attributes) { 62973 super(TEMPLATE_NS_ID, "execute"); 62974 this.connection = attributes.connection || ""; 62975 this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]); 62976 this.id = attributes.id || ""; 62977 this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]); 62978 this.use = attributes.use || ""; 62979 this.usehref = attributes.usehref || ""; 62980 } 62981 62982} 62983 62984class Extras extends _xfa_object.XFAObject { 62985 constructor(attributes) { 62986 super(TEMPLATE_NS_ID, "extras", true); 62987 this.id = attributes.id || ""; 62988 this.name = attributes.name || ""; 62989 this.use = attributes.use || ""; 62990 this.usehref = attributes.usehref || ""; 62991 this.boolean = new _xfa_object.XFAObjectArray(); 62992 this.date = new _xfa_object.XFAObjectArray(); 62993 this.dateTime = new _xfa_object.XFAObjectArray(); 62994 this.decimal = new _xfa_object.XFAObjectArray(); 62995 this.exData = new _xfa_object.XFAObjectArray(); 62996 this.extras = new _xfa_object.XFAObjectArray(); 62997 this.float = new _xfa_object.XFAObjectArray(); 62998 this.image = new _xfa_object.XFAObjectArray(); 62999 this.integer = new _xfa_object.XFAObjectArray(); 63000 this.text = new _xfa_object.XFAObjectArray(); 63001 this.time = new _xfa_object.XFAObjectArray(); 63002 } 63003 63004} 63005 63006class Field extends _xfa_object.XFAObject { 63007 constructor(attributes) { 63008 super(TEMPLATE_NS_ID, "field", true); 63009 this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]); 63010 this.accessKey = attributes.accessKey || ""; 63011 this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 63012 this.colSpan = (0, _utils.getInteger)({ 63013 data: attributes.colSpan, 63014 defaultValue: 1, 63015 validate: n => n >= 1 || n === -1 63016 }); 63017 this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : ""; 63018 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 63019 this.id = attributes.id || ""; 63020 this.locale = attributes.locale || ""; 63021 this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt"); 63022 this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt"); 63023 this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt"); 63024 this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt"); 63025 this.name = attributes.name || ""; 63026 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 63027 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 63028 this.rotate = (0, _utils.getInteger)({ 63029 data: attributes.rotate, 63030 defaultValue: 0, 63031 validate: x => x % 90 === 0 63032 }); 63033 this.use = attributes.use || ""; 63034 this.usehref = attributes.usehref || ""; 63035 this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : ""; 63036 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 63037 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 63038 this.assist = null; 63039 this.bind = null; 63040 this.border = null; 63041 this.calculate = null; 63042 this.caption = null; 63043 this.desc = null; 63044 this.extras = null; 63045 this.font = null; 63046 this.format = null; 63047 this.items = new _xfa_object.XFAObjectArray(2); 63048 this.keep = null; 63049 this.margin = null; 63050 this.para = null; 63051 this.traversal = null; 63052 this.ui = null; 63053 this.validate = null; 63054 this.value = null; 63055 this.bindItems = new _xfa_object.XFAObjectArray(); 63056 this.connect = new _xfa_object.XFAObjectArray(); 63057 this.event = new _xfa_object.XFAObjectArray(); 63058 this.setProperty = new _xfa_object.XFAObjectArray(); 63059 } 63060 63061 [_xfa_object.$isBindable]() { 63062 return true; 63063 } 63064 63065 [_xfa_object.$setValue](value) { 63066 _setValue(this, value); 63067 } 63068 63069 [_xfa_object.$toHTML](availableSpace) { 63070 setTabIndex(this); 63071 63072 if (!this.ui) { 63073 this.ui = new Ui({}); 63074 this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData]; 63075 63076 this[_xfa_object.$appendChild](this.ui); 63077 63078 let node; 63079 63080 switch (this.items.children.length) { 63081 case 0: 63082 node = new TextEdit({}); 63083 this.ui.textEdit = node; 63084 break; 63085 63086 case 1: 63087 node = new CheckButton({}); 63088 this.ui.checkButton = node; 63089 break; 63090 63091 case 2: 63092 node = new ChoiceList({}); 63093 this.ui.choiceList = node; 63094 break; 63095 } 63096 63097 this.ui[_xfa_object.$appendChild](node); 63098 } 63099 63100 if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) { 63101 return _utils.HTMLResult.EMPTY; 63102 } 63103 63104 if (this.caption) { 63105 delete this.caption[_xfa_object.$extra]; 63106 } 63107 63108 this[_xfa_object.$pushPara](); 63109 63110 const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null; 63111 const savedW = this.w; 63112 const savedH = this.h; 63113 let marginH = 0; 63114 let marginV = 0; 63115 63116 if (this.margin) { 63117 marginH = this.margin.leftInset + this.margin.rightInset; 63118 marginV = this.margin.topInset + this.margin.bottomInset; 63119 } 63120 63121 let borderDims = null; 63122 63123 if (this.w === "" || this.h === "") { 63124 let width = null; 63125 let height = null; 63126 let uiW = 0; 63127 let uiH = 0; 63128 63129 if (this.ui.checkButton) { 63130 uiW = uiH = this.ui.checkButton.size; 63131 } else { 63132 const { 63133 w, 63134 h 63135 } = (0, _html_utils.layoutNode)(this, availableSpace); 63136 63137 if (w !== null) { 63138 uiW = w; 63139 uiH = h; 63140 } else { 63141 uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap; 63142 } 63143 } 63144 63145 borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]()); 63146 uiW += borderDims.w; 63147 uiH += borderDims.h; 63148 63149 if (this.caption) { 63150 const { 63151 w, 63152 h, 63153 isBroken 63154 } = this.caption[_xfa_object.$getExtra](availableSpace); 63155 63156 if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) { 63157 this[_xfa_object.$popPara](); 63158 63159 return _utils.HTMLResult.FAILURE; 63160 } 63161 63162 width = w; 63163 height = h; 63164 63165 switch (this.caption.placement) {
63166 case "left": 63167 case "right": 63168 case "inline": 63169 width += uiW; 63170 break; 63171 63172 case "top": 63173 case "bottom": 63174 height += uiH; 63175 break; 63176 } 63177 } else { 63178 width = uiW; 63179 height = uiH; 63180 } 63181 63182 if (width && this.w === "") { 63183 width += marginH; 63184 this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW); 63185 } 63186 63187 if (height && this.h === "") { 63188 height += marginV; 63189 this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH); 63190 } 63191 } 63192 63193 this[_xfa_object.$popPara](); 63194 63195 (0, _html_utils.fixDimensions)(this); 63196 setFirstUnsplittable(this); 63197 63198 if (!(0, _layout.checkDimensions)(this, availableSpace)) { 63199 this.w = savedW; 63200 this.h = savedH; 63201 63202 this[_xfa_object.$popPara](); 63203 63204 return _utils.HTMLResult.FAILURE; 63205 } 63206 63207 unsetFirstUnsplittable(this); 63208 const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign"); 63209 (0, _html_utils.setMinMaxDimensions)(this, style); 63210 const classNames = ["xfaField"]; 63211 63212 if (this.font) { 63213 classNames.push("xfaFont"); 63214 } 63215 63216 if ((0, _html_utils.isPrintOnly)(this)) { 63217 classNames.push("xfaPrintOnly"); 63218 } 63219 63220 const attributes = { 63221 style, 63222 id: this[_xfa_object.$uid], 63223 class: classNames 63224 }; 63225 63226 if (style.margin) { 63227 style.padding = style.margin; 63228 delete style.margin; 63229 } 63230 63231 (0, _html_utils.setAccess)(this, classNames); 63232 63233 if (this.name) { 63234 attributes.xfaName = this.name; 63235 } 63236 63237 const children = []; 63238 const html = { 63239 name: "div", 63240 attributes, 63241 children 63242 }; 63243 applyAssist(this, attributes); 63244 const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null; 63245 const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace); 63246 63247 const ui = this.ui[_xfa_object.$toHTML]().html; 63248 63249 if (!ui) { 63250 Object.assign(style, borderStyle); 63251 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 63252 } 63253 63254 if (this[_xfa_object.$tabIndex]) { 63255 if (ui.children && ui.children[0]) { 63256 ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex]; 63257 } else { 63258 ui.attributes.tabindex = this[_xfa_object.$tabIndex]; 63259 } 63260 } 63261 63262 if (!ui.attributes.style) { 63263 ui.attributes.style = Object.create(null); 63264 } 63265 63266 let aElement = null; 63267 63268 if (this.ui.button) { 63269 if (ui.children.length === 1) { 63270 [aElement] = ui.children.splice(0, 1); 63271 } 63272 63273 Object.assign(ui.attributes.style, borderStyle); 63274 } else { 63275 Object.assign(style, borderStyle); 63276 } 63277 63278 children.push(ui); 63279 63280 if (this.value) { 63281 if (this.ui.imageEdit) { 63282 ui.children.push(this.value[_xfa_object.$toHTML]().html); 63283 } else if (!this.ui.button) { 63284 let value = ""; 63285 63286 if (this.value.exData) { 63287 value = this.value.exData[_xfa_object.$text](); 63288 } else if (this.value.text) { 63289 value = this.value.text[_xfa_object.$getExtra](); 63290 } else { 63291 const htmlValue = this.value[_xfa_object.$toHTML]().html; 63292 63293 if (htmlValue !== null) { 63294 value = htmlValue.children[0].value; 63295 } 63296 } 63297 63298 if (this.ui.textEdit && this.value.text && this.value.text.maxChars) { 63299 ui.children[0].attributes.maxLength = this.value.text.maxChars; 63300 } 63301 63302 if (value) { 63303 if (this.ui.numericEdit) { 63304 value = parseFloat(value); 63305 value = isNaN(value) ? "" : value.toString(); 63306 } 63307 63308 if (ui.children[0].name === "textarea") { 63309 ui.children[0].attributes.textContent = value; 63310 } else { 63311 ui.children[0].attributes.value = value; 63312 } 63313 } 63314 } 63315 } 63316 63317 if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) { 63318 borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]()); 63319 let captionHeight = 0; 63320 63321 if (this.caption && ["top", "bottom"].includes(this.caption.placement)) { 63322 captionHeight = this.caption.reserve; 63323 63324 if (captionHeight <= 0) { 63325 captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h; 63326 } 63327 63328 const inputHeight = this.h - captionHeight - marginV - borderDims.h; 63329 ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight); 63330 } else { 63331 ui.children[0].attributes.style.height = "100%"; 63332 } 63333 } 63334 63335 if (aElement) { 63336 ui.children.push(aElement); 63337 } 63338 63339 if (!caption) { 63340 if (ui.attributes.class) { 63341 ui.attributes.class.push("xfaLeft"); 63342 } 63343 63344 this.w = savedW; 63345 this.h = savedH; 63346 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 63347 } 63348 63349 if (this.ui.button) { 63350 if (style.padding) { 63351 delete style.padding; 63352 } 63353 63354 if (caption.name === "div") { 63355 caption.name = "span"; 63356 } 63357 63358 ui.children.push(caption); 63359 return _utils.HTMLResult.success(html, bbox); 63360 } else if (this.ui.checkButton) { 63361 caption.attributes.class[0] = "xfaCaptionForCheckButton"; 63362 } 63363 63364 if (!ui.attributes.class) { 63365 ui.attributes.class = []; 63366 } 63367 63368 ui.children.splice(0, 0, caption); 63369 63370 switch (this.caption.placement) {
63371 case "left": 63372 ui.attributes.class.push("xfaLeft"); 63373 break; 63374 63375 case "right": 63376 ui.attributes.class.push("xfaRight"); 63377 break; 63378 63379 case "top": 63380 ui.attributes.class.push("xfaTop"); 63381 break; 63382 63383 case "bottom": 63384 ui.attributes.class.push("xfaBottom"); 63385 break; 63386 63387 case "inline": 63388 ui.attributes.class.push("xfaLeft"); 63389 break; 63390 } 63391 63392 this.w = savedW; 63393 this.h = savedH; 63394 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 63395 } 63396 63397} 63398 63399exports.Field = Field; 63400 63401class Fill extends _xfa_object.XFAObject { 63402 constructor(attributes) { 63403 super(TEMPLATE_NS_ID, "fill", true); 63404 this.id = attributes.id || ""; 63405 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 63406 this.use = attributes.use || ""; 63407 this.usehref = attributes.usehref || ""; 63408 this.color = null; 63409 this.extras = null; 63410 this.linear = null; 63411 this.pattern = null; 63412 this.radial = null; 63413 this.solid = null; 63414 this.stipple = null; 63415 } 63416 63417 [_xfa_object.$toStyle]() { 63418 const parent = this[_xfa_object.$getParent](); 63419 63420 const grandpa = parent[_xfa_object.$getParent](); 63421 63422 const ggrandpa = grandpa[_xfa_object.$getParent](); 63423 63424 const style = Object.create(null); 63425 let propName = "color"; 63426 let altPropName = propName; 63427 63428 if (parent instanceof Border) { 63429 propName = "background-color"; 63430 altPropName = "background"; 63431 63432 if (ggrandpa instanceof Ui) { 63433 style.backgroundColor = "white"; 63434 } 63435 } 63436 63437 if (parent instanceof Rectangle || parent instanceof Arc) { 63438 propName = altPropName = "fill"; 63439 style.fill = "white"; 63440 } 63441 63442 for (const name of Object.getOwnPropertyNames(this)) { 63443 if (name === "extras" || name === "color") { 63444 continue; 63445 } 63446 63447 const obj = this[name]; 63448 63449 if (!(obj instanceof _xfa_object.XFAObject)) { 63450 continue; 63451 } 63452 63453 const color = obj[_xfa_object.$toStyle](this.color); 63454 63455 if (color) { 63456 style[color.startsWith("#") ? propName : altPropName] = color; 63457 } 63458 63459 return style; 63460 } 63461 63462 if (this.color && this.color.value) { 63463 const color = this.color[_xfa_object.$toStyle](); 63464 63465 style[color.startsWith("#") ? propName : altPropName] = color; 63466 } 63467 63468 return style; 63469 } 63470 63471} 63472 63473class Filter extends _xfa_object.XFAObject { 63474 constructor(attributes) { 63475 super(TEMPLATE_NS_ID, "filter", true); 63476 this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]); 63477 this.id = attributes.id || ""; 63478 this.name = attributes.name || ""; 63479 this.use = attributes.use || ""; 63480 this.usehref = attributes.usehref || ""; 63481 this.version = (0, _utils.getInteger)({ 63482 data: this.version, 63483 defaultValue: 5, 63484 validate: x => x >= 1 && x <= 5 63485 }); 63486 this.appearanceFilter = null; 63487 this.certificates = null; 63488 this.digestMethods = null; 63489 this.encodings = null; 63490 this.encryptionMethods = null; 63491 this.handler = null; 63492 this.lockDocument = null; 63493 this.mdp = null; 63494 this.reasons = null; 63495 this.timeStamp = null; 63496 } 63497 63498} 63499 63500class Float extends _xfa_object.ContentObject { 63501 constructor(attributes) { 63502 super(TEMPLATE_NS_ID, "float"); 63503 this.id = attributes.id || ""; 63504 this.name = attributes.name || ""; 63505 this.use = attributes.use || ""; 63506 this.usehref = attributes.usehref || ""; 63507 } 63508 63509 [_xfa_object.$finalize]() { 63510 const number = parseFloat(this[_xfa_object.$content].trim()); 63511 this[_xfa_object.$content] = isNaN(number) ? null : number; 63512 } 63513 63514 [_xfa_object.$toHTML](availableSpace) { 63515 return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : ""); 63516 } 63517 63518} 63519 63520class Font extends _xfa_object.XFAObject { 63521 constructor(attributes) { 63522 super(TEMPLATE_NS_ID, "font", true); 63523 this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift); 63524 this.fontHorizontalScale = (0, _utils.getFloat)({ 63525 data: attributes.fontHorizontalScale, 63526 defaultValue: 100, 63527 validate: x => x >= 0 63528 }); 63529 this.fontVerticalScale = (0, _utils.getFloat)({ 63530 data: attributes.fontVerticalScale, 63531 defaultValue: 100, 63532 validate: x => x >= 0 63533 }); 63534 this.id = attributes.id || ""; 63535 this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]); 63536 this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0"); 63537 this.lineThrough = (0, _utils.getInteger)({ 63538 data: attributes.lineThrough, 63539 defaultValue: 0, 63540 validate: x => x === 1 || x === 2 63541 }); 63542 this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]); 63543 this.overline = (0, _utils.getInteger)({ 63544 data: attributes.overline, 63545 defaultValue: 0, 63546 validate: x => x === 1 || x === 2 63547 }); 63548 this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]); 63549 this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]); 63550 this.size = (0, _utils.getMeasurement)(attributes.size, "10pt"); 63551 this.typeface = attributes.typeface || "Courier"; 63552 this.underline = (0, _utils.getInteger)({ 63553 data: attributes.underline, 63554 defaultValue: 0, 63555 validate: x => x === 1 || x === 2 63556 }); 63557 this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]); 63558 this.use = attributes.use || ""; 63559 this.usehref = attributes.usehref || ""; 63560 this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]); 63561 this.extras = null; 63562 this.fill = null; 63563 } 63564 63565 [_xfa_object.$clean](builder) { 63566 super[_xfa_object.$clean](builder); 63567 63568 this[_xfa_object.$globalData].usedTypefaces.add(this.typeface); 63569 } 63570 63571 [_xfa_object.$toStyle]() { 63572 const style = (0, _html_utils.toStyle)(this, "fill"); 63573 const color = style.color; 63574 63575 if (color) { 63576 if (color === "#000000") { 63577 delete style.color; 63578 } else if (!color.startsWith("#")) { 63579 style.background = color; 63580 style.backgroundClip = "text"; 63581 style.color = "transparent";
63582 } 63583 } 63584 63585 if (this.baselineShift) { 63586 style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift); 63587 } 63588 63589 style.fontKerning = this.kerningMode === "none" ? "none" : "normal"; 63590 style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing); 63591 63592 if (this.lineThrough !== 0) { 63593 style.textDecoration = "line-through"; 63594 63595 if (this.lineThrough === 2) { 63596 style.textDecorationStyle = "double"; 63597 } 63598 } 63599 63600 if (this.overline !== 0) { 63601 style.textDecoration = "overline"; 63602 63603 if (this.overline === 2) { 63604 style.textDecorationStyle = "double"; 63605 } 63606 } 63607 63608 style.fontStyle = this.posture; 63609 style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size); 63610 (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style); 63611 63612 if (this.underline !== 0) { 63613 style.textDecoration = "underline"; 63614 63615 if (this.underline === 2) { 63616 style.textDecorationStyle = "double"; 63617 } 63618 } 63619 63620 style.fontWeight = this.weight; 63621 return style; 63622 } 63623 63624} 63625 63626class Format extends _xfa_object.XFAObject { 63627 constructor(attributes) { 63628 super(TEMPLATE_NS_ID, "format", true); 63629 this.id = attributes.id || ""; 63630 this.use = attributes.use || ""; 63631 this.usehref = attributes.usehref || ""; 63632 this.extras = null; 63633 this.picture = null; 63634 } 63635 63636} 63637 63638class Handler extends _xfa_object.StringObject { 63639 constructor(attributes) { 63640 super(TEMPLATE_NS_ID, "handler"); 63641 this.id = attributes.id || ""; 63642 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 63643 this.use = attributes.use || ""; 63644 this.usehref = attributes.usehref || ""; 63645 } 63646 63647} 63648 63649class Hyphenation extends _xfa_object.XFAObject { 63650 constructor(attributes) { 63651 super(TEMPLATE_NS_ID, "hyphenation"); 63652 this.excludeAllCaps = (0, _utils.getInteger)({ 63653 data: attributes.excludeAllCaps, 63654 defaultValue: 0, 63655 validate: x => x === 1 63656 }); 63657 this.excludeInitialCap = (0, _utils.getInteger)({ 63658 data: attributes.excludeInitialCap, 63659 defaultValue: 0, 63660 validate: x => x === 1 63661 }); 63662 this.hyphenate = (0, _utils.getInteger)({ 63663 data: attributes.hyphenate, 63664 defaultValue: 0, 63665 validate: x => x === 1 63666 }); 63667 this.id = attributes.id || ""; 63668 this.pushCharacterCount = (0, _utils.getInteger)({ 63669 data: attributes.pushCharacterCount, 63670 defaultValue: 3, 63671 validate: x => x >= 0 63672 }); 63673 this.remainCharacterCount = (0, _utils.getInteger)({ 63674 data: attributes.remainCharacterCount, 63675 defaultValue: 3, 63676 validate: x => x >= 0 63677 }); 63678 this.use = attributes.use || ""; 63679 this.usehref = attributes.usehref || ""; 63680 this.wordCharacterCount = (0, _utils.getInteger)({ 63681 data: attributes.wordCharacterCount, 63682 defaultValue: 7, 63683 validate: x => x >= 0 63684 }); 63685 } 63686 63687} 63688 63689class Image extends _xfa_object.StringObject { 63690 constructor(attributes) { 63691 super(TEMPLATE_NS_ID, "image"); 63692 this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]); 63693 this.contentType = attributes.contentType || ""; 63694 this.href = attributes.href || ""; 63695 this.id = attributes.id || ""; 63696 this.name = attributes.name || ""; 63697 this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]); 63698 this.use = attributes.use || ""; 63699 this.usehref = attributes.usehref || ""; 63700 } 63701 63702 [_xfa_object.$toHTML]() { 63703 if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) { 63704 return _utils.HTMLResult.EMPTY; 63705 } 63706 63707 let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href); 63708 63709 if (!buffer && (this.href || !this[_xfa_object.$content])) { 63710 return _utils.HTMLResult.EMPTY; 63711 } 63712 63713 if (!buffer && this.transferEncoding === "base64") { 63714 buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content])); 63715 } 63716 63717 if (!buffer) { 63718 return _utils.HTMLResult.EMPTY; 63719 } 63720 63721 if (!this.contentType) { 63722 for (const [header, type] of IMAGES_HEADERS) { 63723 if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) { 63724 this.contentType = type; 63725 break; 63726 } 63727 } 63728 63729 if (!this.contentType) { 63730 return _utils.HTMLResult.EMPTY; 63731 } 63732 } 63733 63734 const blob = new Blob([buffer], { 63735 type: this.contentType 63736 }); 63737 let style; 63738 63739 switch (this.aspect) { 63740 case "fit": 63741 case "actual": 63742 break; 63743 63744 case "height": 63745 style = { 63746 height: "100%", 63747 objectFit: "fill" 63748 }; 63749 break; 63750 63751 case "none": 63752 style = { 63753 width: "100%", 63754 height: "100%", 63755 objectFit: "fill" 63756 }; 63757 break; 63758 63759 case "width": 63760 style = { 63761 width: "100%", 63762 objectFit: "fill" 63763 }; 63764 break; 63765 } 63766 63767 const parent = this[_xfa_object.$getParent](); 63768 63769 return _utils.HTMLResult.success({ 63770 name: "img", 63771 attributes: { 63772 class: ["xfaImage"], 63773 style, 63774 src: URL.createObjectURL(blob), 63775 alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null 63776 } 63777 }); 63778 } 63779 63780} 63781 63782class ImageEdit extends _xfa_object.XFAObject { 63783 constructor(attributes) { 63784 super(TEMPLATE_NS_ID, "imageEdit", true); 63785 this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]); 63786 this.id = attributes.id || ""; 63787 this.use = attributes.use || ""; 63788 this.usehref = attributes.usehref || ""; 63789 this.border = null; 63790 this.extras = null; 63791 this.margin = null; 63792 } 63793 63794 [_xfa_object.$toHTML](availableSpace) { 63795 if (this.data === "embed") { 63796 return _utils.HTMLResult.success({ 63797 name: "div", 63798 children: [], 63799 attributes: {} 63800 }); 63801 } 63802 63803 return _utils.HTMLResult.EMPTY; 63804 } 63805 63806} 63807 63808class Integer extends _xfa_object.ContentObject { 63809 constructor(attributes) { 63810 super(TEMPLATE_NS_ID, "integer"); 63811 this.id = attributes.id || ""; 63812 this.name = attributes.name || ""; 63813 this.use = attributes.use || ""; 63814 this.usehref = attributes.usehref || ""; 63815 } 63816 63817 [_xfa_object.$finalize]() { 63818 const number = parseInt(this[_xfa_object.$content].trim(), 10); 63819 this[_xfa_object.$content] = isNaN(number) ? null : number; 63820 } 63821 63822 [_xfa_object.$toHTML](availableSpace) { 63823 return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : ""); 63824 } 63825 63826} 63827 63828class Issuers extends _xfa_object.XFAObject { 63829 constructor(attributes) { 63830 super(TEMPLATE_NS_ID, "issuers", true); 63831 this.id = attributes.id || ""; 63832 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 63833 this.use = attributes.use || ""; 63834 this.usehref = attributes.usehref || ""; 63835 this.certificate = new _xfa_object.XFAObjectArray(); 63836 } 63837 63838} 63839 63840class Items extends _xfa_object.XFAObject { 63841 constructor(attributes) { 63842 super(TEMPLATE_NS_ID, "items", true); 63843 this.id = attributes.id || ""; 63844 this.name = attributes.name || ""; 63845 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 63846 this.ref = attributes.ref || ""; 63847 this.save = (0, _utils.getInteger)({ 63848 data: attributes.save, 63849 defaultValue: 0, 63850 validate: x => x === 1 63851 }); 63852 this.use = attributes.use || ""; 63853 this.usehref = attributes.usehref || ""; 63854 this.boolean = new _xfa_object.XFAObjectArray(); 63855 this.date = new _xfa_object.XFAObjectArray(); 63856 this.dateTime = new _xfa_object.XFAObjectArray(); 63857 this.decimal = new _xfa_object.XFAObjectArray(); 63858 this.exData = new _xfa_object.XFAObjectArray(); 63859 this.float = new _xfa_object.XFAObjectArray(); 63860 this.image = new _xfa_object.XFAObjectArray(); 63861 this.integer = new _xfa_object.XFAObjectArray(); 63862 this.text = new _xfa_object.XFAObjectArray(); 63863 this.time = new _xfa_object.XFAObjectArray(); 63864 } 63865 63866 [_xfa_object.$toHTML]() { 63867 const output = []; 63868 63869 for (const child of this[_xfa_object.$getChildren]()) { 63870 output.push(child[_xfa_object.$text]()); 63871 } 63872 63873 return _utils.HTMLResult.success(output); 63874 } 63875 63876} 63877 63878exports.Items = Items; 63879 63880class Keep extends _xfa_object.XFAObject { 63881 constructor(attributes) { 63882 super(TEMPLATE_NS_ID, "keep", true); 63883 this.id = attributes.id || ""; 63884 const options = ["none", "contentArea", "pageArea"]; 63885 this.intact = (0, _utils.getStringOption)(attributes.intact, options); 63886 this.next = (0, _utils.getStringOption)(attributes.next, options); 63887 this.previous = (0, _utils.getStringOption)(attributes.previous, options); 63888 this.use = attributes.use || ""; 63889 this.usehref = attributes.usehref || ""; 63890 this.extras = null; 63891 } 63892 63893} 63894 63895class KeyUsage extends _xfa_object.XFAObject { 63896 constructor(attributes) { 63897 super(TEMPLATE_NS_ID, "keyUsage"); 63898 const options = ["", "yes", "no"]; 63899 this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options); 63900 this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options); 63901 this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options); 63902 this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options); 63903 this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options); 63904 this.id = attributes.id || ""; 63905 this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options); 63906 this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options); 63907 this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options); 63908 this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options); 63909 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 63910 this.use = attributes.use || ""; 63911 this.usehref = attributes.usehref || ""; 63912 } 63913 63914} 63915 63916class Line extends _xfa_object.XFAObject { 63917 constructor(attributes) { 63918 super(TEMPLATE_NS_ID, "line", true); 63919 this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]); 63920 this.id = attributes.id || ""; 63921 this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]); 63922 this.use = attributes.use || ""; 63923 this.usehref = attributes.usehref || ""; 63924 this.edge = null; 63925 } 63926 63927 [_xfa_object.$toHTML]() { 63928 const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 63929 63930 const edge = this.edge ? this.edge : new Edge({}); 63931 63932 const edgeStyle = edge[_xfa_object.$toStyle](); 63933 63934 const style = Object.create(null); 63935 const thickness = edge.presence === "visible" ? edge.thickness : 0; 63936 style.strokeWidth = (0, _html_utils.measureToString)(thickness); 63937 style.stroke = edgeStyle.color; 63938 let x1, y1, x2, y2; 63939 let width = "100%"; 63940 let height = "100%"; 63941 63942 if (parent.w <= thickness) { 63943 [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"]; 63944 width = style.strokeWidth; 63945 } else if (parent.h <= thickness) { 63946 [x1, y1, x2, y2] = [0, "50%", "100%", "50%"]; 63947 height = style.strokeWidth; 63948 } else { 63949 if (this.slope === "\\") { 63950 [x1, y1, x2, y2] = [0, 0, "100%", "100%"]; 63951 } else { 63952 [x1, y1, x2, y2] = [0, "100%", "100%", 0]; 63953 } 63954 } 63955 63956 const line = { 63957 name: "line", 63958 attributes: { 63959 xmlns: SVG_NS, 63960 x1, 63961 y1, 63962 x2, 63963 y2, 63964 style 63965 } 63966 }; 63967 const svg = { 63968 name: "svg", 63969 children: [line], 63970 attributes: { 63971 xmlns: SVG_NS, 63972 width, 63973 height, 63974 style: { 63975 overflow: "visible" 63976 } 63977 } 63978 }; 63979 63980 if (hasMargin(parent)) { 63981 return _utils.HTMLResult.success({ 63982 name: "div", 63983 attributes: { 63984 style: { 63985 display: "inline", 63986 width: "100%", 63987 height: "100%" 63988 } 63989 }, 63990 children: [svg] 63991 }); 63992 } 63993 63994 svg.attributes.style.position = "absolute"; 63995 return _utils.HTMLResult.success(svg); 63996 } 63997 63998} 63999 64000class Linear extends _xfa_object.XFAObject { 64001 constructor(attributes) { 64002 super(TEMPLATE_NS_ID, "linear", true); 64003 this.id = attributes.id || ""; 64004 this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]); 64005 this.use = attributes.use || ""; 64006 this.usehref = attributes.usehref || ""; 64007 this.color = null; 64008 this.extras = null; 64009 } 64010 64011 [_xfa_object.$toStyle](startColor) { 64012 startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF"; 64013 const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase(); 64014 const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000"; 64015 return `linear-gradient(${transf}, ${startColor}, ${endColor})`; 64016 } 64017 64018} 64019 64020class LockDocument extends _xfa_object.ContentObject { 64021 constructor(attributes) { 64022 super(TEMPLATE_NS_ID, "lockDocument"); 64023 this.id = attributes.id || ""; 64024 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 64025 this.use = attributes.use || ""; 64026 this.usehref = attributes.usehref || ""; 64027 } 64028 64029 [_xfa_object.$finalize]() { 64030 this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]); 64031 } 64032 64033} 64034 64035class Manifest extends _xfa_object.XFAObject { 64036 constructor(attributes) { 64037 super(TEMPLATE_NS_ID, "manifest", true); 64038 this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]); 64039 this.id = attributes.id || ""; 64040 this.name = attributes.name || ""; 64041 this.use = attributes.use || ""; 64042 this.usehref = attributes.usehref || ""; 64043 this.extras = null; 64044 this.ref = new _xfa_object.XFAObjectArray(); 64045 } 64046 64047} 64048 64049class Margin extends _xfa_object.XFAObject { 64050 constructor(attributes) { 64051 super(TEMPLATE_NS_ID, "margin", true); 64052 this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0"); 64053 this.id = attributes.id || ""; 64054 this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0"); 64055 this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0"); 64056 this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0"); 64057 this.use = attributes.use || ""; 64058 this.usehref = attributes.usehref || ""; 64059 this.extras = null; 64060 } 64061 64062 [_xfa_object.$toStyle]() { 64063 return { 64064 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) 64065 }; 64066 } 64067 64068} 64069 64070class Mdp extends _xfa_object.XFAObject { 64071 constructor(attributes) { 64072 super(TEMPLATE_NS_ID, "mdp"); 64073 this.id = attributes.id || ""; 64074 this.permissions = (0, _utils.getInteger)({ 64075 data: attributes.permissions, 64076 defaultValue: 2, 64077 validate: x => x === 1 || x === 3 64078 }); 64079 this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]); 64080 this.use = attributes.use || ""; 64081 this.usehref = attributes.usehref || ""; 64082 } 64083 64084} 64085 64086class Medium extends _xfa_object.XFAObject { 64087 constructor(attributes) { 64088 super(TEMPLATE_NS_ID, "medium"); 64089 this.id = attributes.id || ""; 64090 this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox); 64091 this.long = (0, _utils.getMeasurement)(attributes.long); 64092 this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]); 64093 this.short = (0, _utils.getMeasurement)(attributes.short); 64094 this.stock = attributes.stock || ""; 64095 this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]); 64096 this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]); 64097 this.use = attributes.use || ""; 64098 this.usehref = attributes.usehref || ""; 64099 } 64100 64101} 64102 64103class Message extends _xfa_object.XFAObject { 64104 constructor(attributes) { 64105 super(TEMPLATE_NS_ID, "message", true); 64106 this.id = attributes.id || ""; 64107 this.use = attributes.use || ""; 64108 this.usehref = attributes.usehref || ""; 64109 this.text = new _xfa_object.XFAObjectArray(); 64110 } 64111 64112} 64113 64114class NumericEdit extends _xfa_object.XFAObject { 64115 constructor(attributes) { 64116 super(TEMPLATE_NS_ID, "numericEdit", true); 64117 this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); 64118 this.id = attributes.id || ""; 64119 this.use = attributes.use || ""; 64120 this.usehref = attributes.usehr
64120ef || ""; 64121 this.border = null; 64122 this.comb = null; 64123 this.extras = null; 64124 this.margin = null; 64125 } 64126 64127 [_xfa_object.$toHTML](availableSpace) { 64128 const style = (0, _html_utils.toStyle)(this, "border", "font", "margin"); 64129 64130 const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 64131 64132 const html = { 64133 name: "input", 64134 attributes: { 64135 type: "text", 64136 fieldId: field[_xfa_object.$uid], 64137 dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], 64138 class: ["xfaTextfield"], 64139 style, 64140 "aria-label": ariaLabel(field) 64141 } 64142 }; 64143 return _utils.HTMLResult.success({ 64144 name: "label", 64145 attributes: { 64146 class: ["xfaLabel"] 64147 }, 64148 children: [html] 64149 }); 64150 } 64151 64152} 64153 64154class Occur extends _xfa_object.XFAObject { 64155 constructor(attributes) { 64156 super(TEMPLATE_NS_ID, "occur", true); 64157 this.id = attributes.id || ""; 64158 this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({ 64159 data: attributes.initial, 64160 defaultValue: "", 64161 validate: x => true 64162 }) : ""; 64163 this.max = attributes.max !== "" ? (0, _utils.getInteger)({ 64164 data: attributes.max, 64165 defaultValue: 1, 64166 validate: x => true 64167 }) : ""; 64168 this.min = attributes.min !== "" ? (0, _utils.getInteger)({ 64169 data: attributes.min, 64170 defaultValue: 1, 64171 validate: x => true 64172 }) : ""; 64173 this.use = attributes.use || ""; 64174 this.usehref = attributes.usehref || ""; 64175 this.extras = null; 64176 } 64177 64178 [_xfa_object.$clean]() { 64179 const parent = this[_xfa_object.$getParent](); 64180 64181 const originalMin = this.min; 64182 64183 if (this.min === "") { 64184 this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1; 64185 } 64186 64187 if (this.max === "") { 64188 if (originalMin === "") { 64189 this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1; 64190 } else { 64191 this.max = this.min; 64192 } 64193 } 64194 64195 if (this.max !== -1 && this.max < this.min) { 64196 this.max = this.min; 64197 } 64198 64199 if (this.initial === "") { 64200 this.initial = parent instanceof Template ? 1 : this.min; 64201 } 64202 } 64203 64204} 64205 64206class Oid extends _xfa_object.StringObject { 64207 constructor(attributes) { 64208 super(TEMPLATE_NS_ID, "oid"); 64209 this.id = attributes.id || ""; 64210 this.name = attributes.name || ""; 64211 this.use = attributes.use || ""; 64212 this.usehref = attributes.usehref || ""; 64213 } 64214 64215} 64216 64217class Oids extends _xfa_object.XFAObject { 64218 constructor(attributes) { 64219 super(TEMPLATE_NS_ID, "oids", true); 64220 this.id = attributes.id || ""; 64221 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 64222 this.use = attributes.use || ""; 64223 this.usehref = attributes.usehref || ""; 64224 this.oid = new _xfa_object.XFAObjectArray(); 64225 } 64226 64227} 64228 64229class Overflow extends _xfa_object.XFAObject { 64230 constructor(attributes) { 64231 super(TEMPLATE_NS_ID, "overflow"); 64232 this.id = attributes.id || ""; 64233 this.leader = attributes.leader || ""; 64234 this.target = attributes.target || ""; 64235 this.trailer = attributes.trailer || ""; 64236 this.use = attributes.use || ""; 64237 this.usehref = attributes.usehref || ""; 64238 } 64239 64240 [_xfa_object.$getExtra]() { 64241 if (!this[_xfa_object.$extra]) { 64242 const parent = this[_xfa_object.$getParent](); 64243 64244 const root = this[_xfa_object.$getTemplateRoot](); 64245 64246 const target = root[_xfa_object.$searchNode](this.target, parent); 64247 64248 const leader = root[_xfa_object.$searchNode](this.leader, parent); 64249 64250 const trailer = root[_xfa_object.$searchNode](this.trailer, parent); 64251 64252 this[_xfa_object.$extra] = { 64253 target: target && target[0] || null, 64254 leader: leader && leader[0] || null, 64255 trailer: trailer && trailer[0] || null, 64256 addLeader: false, 64257 addTrailer: false 64258 }; 64259 } 64260 64261 return this[_xfa_object.$extra]; 64262 } 64263 64264} 64265 64266class PageArea extends _xfa_object.XFAObject { 64267 constructor(attributes) { 64268 super(TEMPLATE_NS_ID, "pageArea", true); 64269 this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]); 64270 this.id = attributes.id || ""; 64271 this.initialNumber = (0, _utils.getInteger)({ 64272 data: attributes.initialNumber, 64273 defaultValue: 1, 64274 validate: x => true 64275 }); 64276 this.name = attributes.name || ""; 64277 this.numbered = (0, _utils.getInteger)({ 64278 data: attributes.numbered, 64279 defaultValue: 1, 64280 validate: x => true 64281 }); 64282 this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]); 64283 this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]); 64284 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 64285 this.use = attributes.use || ""; 64286 this.usehref = attributes.usehref || ""; 64287 this.desc = null; 64288 this.extras = null; 64289 this.medium = null; 64290 this.occur = null; 64291 this.area = new _xfa_object.XFAObjectArray(); 64292 this.contentArea = new _xfa_object.XFAObjectArray(); 64293 this.draw = new _xfa_object.XFAObjectArray(); 64294 this.exclGroup = new _xfa_object.XFAObjectArray(); 64295 this.field = new _xfa_object.XFAObjectArray(); 64296 this.subform = new _xfa_object.XFAObjectArray(); 64297 } 64298 64299 [_xfa_object.$isUsable]() { 64300 if (!this[_xfa_object.$extra]) { 64301 this[_xfa_object.$extra] = { 64302 numberOfUse: 0 64303 }; 64304 return true; 64305 } 64306 64307 return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max; 64308 } 64309 64310 [_xfa_object.$cleanPage]() { 64311 delete this[_xfa_object.$extra]; 64312 } 64313 64314 [_xfa_object.$getNextPage]() { 64315 if (!this[_xfa_object.$extra]) { 64316 this[_xfa_object.$extra] = { 64317 numberOfUse: 0 64318 }; 64319 } 64320 64321 const parent = this[_xfa_object.$getParent](); 64322
64323 if (parent.relation === "orderedOccurrence") { 64324 if (this[_xfa_object.$isUsable]()) { 64325 this[_xfa_object.$extra].numberOfUse += 1; 64326 return this; 64327 } 64328 } 64329 64330 return parent[_xfa_object.$getNextPage](); 64331 } 64332 64333 [_xfa_object.$getAvailableSpace]() { 64334 return this[_xfa_object.$extra].space || { 64335 width: 0, 64336 height: 0 64337 }; 64338 } 64339 64340 [_xfa_object.$toHTML]() { 64341 if (!this[_xfa_object.$extra]) { 64342 this[_xfa_object.$extra] = { 64343 numberOfUse: 1 64344 }; 64345 } 64346 64347 const children = []; 64348 this[_xfa_object.$extra].children = children; 64349 const style = Object.create(null); 64350 64351 if (this.medium && this.medium.short && this.medium.long) { 64352 style.width = (0, _html_utils.measureToString)(this.medium.short); 64353 style.height = (0, _html_utils.measureToString)(this.medium.long); 64354 this[_xfa_object.$extra].space = { 64355 width: this.medium.short, 64356 height: this.medium.long 64357 }; 64358 64359 if (this.medium.orientation === "landscape") { 64360 const x = style.width; 64361 style.width = style.height; 64362 style.height = x; 64363 this[_xfa_object.$extra].space = { 64364 width: this.medium.long, 64365 height: this.medium.short 64366 }; 64367 } 64368 } else { 64369 (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug."); 64370 } 64371 64372 this[_xfa_object.$childrenToHTML]({ 64373 filter: new Set(["area", "draw", "field", "subform"]), 64374 include: true 64375 }); 64376 64377 this[_xfa_object.$childrenToHTML]({ 64378 filter: new Set(["contentArea"]), 64379 include: true 64380 }); 64381 64382 return _utils.HTMLResult.success({ 64383 name: "div", 64384 children, 64385 attributes: { 64386 class: ["xfaPage"], 64387 id: this[_xfa_object.$uid], 64388 style, 64389 xfaName: this.name 64390 } 64391 }); 64392 } 64393 64394} 64395 64396class PageSet extends _xfa_object.XFAObject { 64397 constructor(attributes) { 64398 super(TEMPLATE_NS_ID, "pageSet", true); 64399 this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]); 64400 this.id = attributes.id || ""; 64401 this.name = attributes.name || ""; 64402 this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]); 64403 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 64404 this.use = attributes.use || ""; 64405 this.usehref = attributes.usehref || ""; 64406 this.extras = null; 64407 this.occur = null; 64408 this.pageArea = new _xfa_object.XFAObjectArray(); 64409 this.pageSet = new _xfa_object.XFAObjectArray(); 64410 } 64411 64412 [_xfa_object.$cleanPage]() { 64413 for (const page of this.pageArea.children) { 64414 page[_xfa_object.$cleanPage](); 64415 } 64416 64417 for (const page of this.pageSet.children) { 64418 page[_xfa_object.$cleanPage](); 64419 } 64420 } 64421 64422 [_xfa_object.$isUsable]() { 64423 return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max; 64424 } 64425 64426 [_xfa_object.$getNextPage]() { 64427 if (!this[_xfa_object.$extra]) { 64428 this[_xfa_object.$extra] = { 64429 numberOfUse: 1, 64430 pageIndex: -1, 64431 pageSetIndex: -1 64432 }; 64433 } 64434 64435 if (this.relation === "orderedOccurrence") { 64436 if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) { 64437 this[_xfa_object.$extra].pageIndex += 1; 64438 const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex]; 64439 return pageArea[_xfa_object.$getNextPage](); 64440 } 64441 64442 if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) { 64443 this[_xfa_object.$extra].pageSetIndex += 1; 64444 return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage](); 64445 } 64446 64447 if (this[_xfa_object.$isUsable]()) { 64448 this[_xfa_object.$extra].numberOfUse += 1; 64449 this[_xfa_object.$extra].pageIndex = -1; 64450 this[_xfa_object.$extra].pageSetIndex = -1; 64451 return this[_xfa_object.$getNextPage](); 64452 } 64453 64454 const parent = this[_xfa_object.$getParent](); 64455 64456 if (parent instanceof PageSet) { 64457 return parent[_xfa_object.$getNextPage](); 64458 } 64459 64460 this[_xfa_object.$cleanPage](); 64461 64462 return this[_xfa_object.$getNextPage](); 64463 } 64464 64465 const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber; 64466 64467 const parity = pageNumber % 2 === 0 ? "even" : "odd"; 64468 const position = pageNumber === 0 ? "first" : "rest"; 64469 let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position); 64470 64471 if (page) { 64472 return page; 64473 } 64474 64475 page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position); 64476 64477 if (page) { 64478 return page; 64479 } 64480 64481 page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any"); 64482 64483 if (page) { 64484 return page; 64485 } 64486 64487 return this.pageArea.children[0]; 64488 } 64489 64490} 64491 64492class Para extends _xfa_object.XFAObject { 64493 constructor(attributes) { 64494 super(TEMPLATE_NS_ID, "para", true); 64495 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 64496 this.id = attributes.id || ""; 64497 this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : ""; 64498 this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : ""; 64499 this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : ""; 64500 this.orphans = (0, _utils.getInteger)({ 64501 data: attributes.orphans, 64502 defaultValue: 0, 64503 validate: x => x >= 0 64504 }); 64505 this.preserve = attributes.preserve || ""; 64506 this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : ""; 64507 this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : ""; 64508 this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : ""; 64509 this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : ""; 64510 this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x); 64511 this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : ""; 64512 this.use = attributes.use || ""; 64513 this.usehref = attributes.usehref || ""; 64514 this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]); 64515 this.widows = (0, _utils.getInteger)({ 64516 data: attributes.widows, 64517 defaultValue: 0, 64518 validate: x => x >= 0 64519 }); 64520 this.hyphenation = null; 64521 } 64522 64523 [_xfa_object.$toStyle]() { 64524 const style = (0, _html_utils.toStyle)(this, "hAlign"); 64525 64526 if (this.marginLeft !== "") { 64527 style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft); 64528 } 64529 64530 if (this.marginRight !== "") { 64531 style.paddingight = (0, _html_utils.measureToString)(this.marginRight); 64532 } 64533 64534 if (this.spaceAbove !== "") { 64535 style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove); 64536 } 64537 64538 if (this.spaceBelow !== "") { 64539 style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow); 64540 } 64541 64542 if (this.textIndent !== "") { 64543 style.textIndent = (0, _html_utils.measureToString)(this.textIndent); 64544 (0, _html_utils.fixTextIndent)(style); 64545 } 64546 64547 if (this.lineHeight > 0) { 64548 style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight); 64549 } 64550 64551 if (this.tabDefault !== "") { 64552 style.tabSize = (0, _html_utils.measureToString)(this.tabDefault); 64553 } 64554 64555 if (this.tabStops.length > 0) {} 64556 64557 if (this.hyphenatation) { 64558 Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]()); 64559 } 64560 64561 return style; 64562 } 64563 64564} 64565 64566class PasswordEdit extends _xfa_object.XFAObject { 64567 constructor(attributes) { 64568 super(TEMPLATE_NS_ID, "passwordEdit", true); 64569 this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); 64570 this.id = attributes.id || ""; 64571 this.passwordChar = attributes.passwordChar || "*"; 64572 this.use = attributes.use || ""; 64573 this.usehref = attributes.usehref || ""; 64574 this.border = null; 64575 this.extras = null; 64576 this.margin = null; 64577 } 64578 64579} 64580 64581class Pattern extends _xfa_object.XFAObject { 64582 constructor(attributes) { 64583 super(TEMPLATE_NS_ID, "pattern", true); 64584 this.id = attributes.id || ""; 64585 this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]); 64586 this.use = attributes.use || ""; 64587 this.usehref = attributes.usehref || ""; 64588 this.color = null; 64589 this.extras = null; 64590 } 64591 64592 [_xfa_object.$toStyle](startColor) { 64593 startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF"; 64594 const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000"; 64595 const width = 5; 64596 const cmd = "repeating-linear-gradient"; 64597 const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`; 64598 64599 switch (this.type) { 64600 case "crossHatch": 64601 return `${cmd}
64601(to top,${colors}) ${cmd}(to right,${colors})`; 64602 64603 case "crossDiagonal": 64604 return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`; 64605 64606 case "diagonalLeft": 64607 return `${cmd}(45deg,${colors})`; 64608 64609 case "diagonalRight": 64610 return `${cmd}(-45deg,${colors})`; 64611 64612 case "horizontal": 64613 return `${cmd}(to top,${colors})`; 64614 64615 case "vertical": 64616 return `${cmd}(to right,${colors})`; 64617 } 64618 64619 return ""; 64620 } 64621 64622} 64623 64624class Picture extends _xfa_object.StringObject { 64625 constructor(attributes) { 64626 super(TEMPLATE_NS_ID, "picture"); 64627 this.id = attributes.id || ""; 64628 this.use = attributes.use || ""; 64629 this.usehref = attributes.usehref || ""; 64630 } 64631 64632} 64633 64634class Proto extends _xfa_object.XFAObject { 64635 constructor(attributes) { 64636 super(TEMPLATE_NS_ID, "proto", true); 64637 this.appearanceFilter = new _xfa_object.XFAObjectArray(); 64638 this.arc = new _xfa_object.XFAObjectArray(); 64639 this.area = new _xfa_object.XFAObjectArray(); 64640 this.assist = new _xfa_object.XFAObjectArray(); 64641 this.barcode = new _xfa_object.XFAObjectArray(); 64642 this.bindItems = new _xfa_object.XFAObjectArray(); 64643 this.bookend = new _xfa_object.XFAObjectArray(); 64644 this.boolean = new _xfa_object.XFAObjectArray(); 64645 this.border = new _xfa_object.XFAObjectArray(); 64646 this.break = new _xfa_object.XFAObjectArray(); 64647 this.breakAfter = new _xfa_object.XFAObjectArray(); 64648 this.breakBefore = new _xfa_object.XFAObjectArray(); 64649 this.button = new _xfa_object.XFAObjectArray(); 64650 this.calculate = new _xfa_object.XFAObjectArray(); 64651 this.caption = new _xfa_object.XFAObjectArray(); 64652 this.certificate = new _xfa_object.XFAObjectArray(); 64653 this.certificates = new _xfa_object.XFAObjectArray(); 64654 this.checkButton = new _xfa_object.XFAObjectArray(); 64655 this.choiceList = new _xfa_object.XFAObjectArray(); 64656 this.color = new _xfa_object.XFAObjectArray(); 64657 this.comb = new _xfa_object.XFAObjectArray(); 64658 this.connect = new _xfa_object.XFAObjectArray(); 64659 this.contentArea = new _xfa_object.XFAObjectArray(); 64660 this.corner = new _xfa_object.XFAObjectArray(); 64661 this.date = new _xfa_object.XFAObjectArray(); 64662 this.dateTime = new _xfa_object.XFAObjectArray(); 64663 this.dateTimeEdit = new _xfa_object.XFAObjectArray(); 64664 this.decimal = new _xfa_object.XFAObjectArray(); 64665 this.defaultUi = new _xfa_object.XFAObjectArray(); 64666 this.desc = new _xfa_object.XFAObjectArray(); 64667 this.digestMethod = new _xfa_object.XFAObjectArray(); 64668 this.digestMethods = new _xfa_object.XFAObjectArray(); 64669 this.draw = new _xfa_object.XFAObjectArray(); 64670 this.edge = new _xfa_object.XFAObjectArray(); 64671 this.encoding = new _xfa_object.XFAObjectArray(); 64672 this.encodings = new _xfa_object.XFAObjectArray(); 64673 this.encrypt = new _xfa_object.XFAObjectArray(); 64674 this.encryptData = new _xfa_object.XFAObjectArray(); 64675 this.encryption = new _xfa_object.XFAObjectArray(); 64676 this.encryptionMethod = new _xfa_object.XFAObjectArray(); 64677 this.encryptionMethods = new _xfa_object.XFAObjectArray(); 64678 this.event = new _xfa_object.XFAObjectArray(); 64679 this.exData = new _xfa_object.XFAObjectArray(); 64680 this.exObject = new _xfa_object.XFAObjectArray(); 64681 this.exclGroup = new _xfa_object.XFAObjectArray(); 64682 this.execute = new _xfa_object.XFAObjectArray(); 64683 this.extras = new _xfa_object.XFAObjectArray(); 64684 this.field = new _xfa_object.XFAObjectArray(); 64685 this.fill = new _xfa_object.XFAObjectArray(); 64686 this.filter = new _xfa_object.XFAObjectArray(); 64687 this.float = new _xfa_object.XFAObjectArray(); 64688 this.font = new _xfa_object.XFAObjectArray(); 64689 this.format = new _xfa_object.XFAObjectArray(); 64690 this.handler = new _xfa_object.XFAObjectArray(); 64691 this.hyphenation = new _xfa_object.XFAObjectArray(); 64692 this.image = new _xfa_object.XFAObjectArray(); 64693 this.imageEdit = new _xfa_object.XFAObjectArray(); 64694 this.integer = new _xfa_object.XFAObjectArray(); 64695 this.issuers = new _xfa_object.XFAObjectArray(); 64696 this.items = new _xfa_object.XFAObjectArray(); 64697 this.keep = new _xfa_object.XFAObjectArray(); 64698 this.keyUsage = new _xfa_object.XFAObjectArray(); 64699 this.line = new _xfa_object.XFAObjectArray(); 64700 this.linear = new _xfa_object.XFAObjectArray(); 64701 this.lockDocument = new _xfa_object.XFAObjectArray(); 64702 this.manifest = new _xfa_object.XFAObjectArray(); 64703 this.margin = new _xfa_object.XFAObjectArray(); 64704 this.mdp = new _xfa_object.XFAObjectArray(); 64705 this.medium = new _xfa_object.XFAObjectArray(); 64706 this.message = new _xfa_object.XFAObjectArray(); 64707 this.numericEdit = new _xfa_object.XFAObjectArray(); 64708 this.occur = new _xfa_object.XFAObjectArray(); 64709 this.oid = new _xfa_object.XFAObjectArray(); 64710 this.oids = new _xfa_object.XFAObjectArray(); 64711 this.overflow = new _xfa_object.XFAObjectArray(); 64712 this.pageArea = new _xfa_object.XFAObjectArray(); 64713 this.pageSet = new _xfa_object.XFAObjectArray(); 64714 this.para = new _xfa_object.XFAObjectArray(); 64715 this.passwordEdit = new _xfa_object.XFAObjectArray(); 64716 this.pattern = new _xfa_object.XFAObjectArray(); 64717 this.picture = new _xfa_object.XFAObjectArray(); 64718 this.radial = new _xfa_object.XFAObjectArray(); 64719 this.reason = new _xfa_object.XFAObjectArray(); 64720 this.reasons = new _xfa_object.XFAObjectArray(); 64721 this.rectangle = new _xfa_object.XFAObjectArray(); 64722 this.ref = new _xfa_object.XFAObjectArray(); 64723 this.script = new _xfa_object.XFAObjectArray(); 64724 this.setProperty = new _xfa_object.XFAObjectArray(); 64725 this.signData = new _xfa_object.XFAObjectArray(); 64726 this.signature = new _xfa_object.XFAObjectArray(); 64727 this.signing = new _xfa_object.XFAObjectArray(); 64728 this.solid = new _xfa_object.XFAObjectArray(); 64729 this.speak = new _xfa_object.XFAObjectArray(); 64730 this.stipple = new _xfa_object.XFAObjectArray(); 64731 this.subform = new _xfa_object.XFAObjectArray(); 64732 this.subformSet = new _xfa_object.XFAObjectArray(); 64733 this.subjectDN = new _xfa_object.XFAObjectArray(); 64734 this.subjectDNs = new _xfa_object.XFAObjectArray(); 64735 this.submit = new _xfa_object.XFAObjectArray(); 64736 this.text = new _xfa_object.XFAObjectArray(); 64737 this.textEdit = new _xfa_object.XFAObjectArray(); 64738 this.time = new _xfa_object.XFAObjectArray(); 64739 this.timeStamp = new _xfa_object.XFAObjectArray(); 64740 this.toolTip = new _xfa_object.XFAObjectArray(); 64741 this.traversal = new _xfa_object.XFAObjectArray(); 64742 this.traverse = new _xfa_object.XFAObjectArray(); 64743 this.ui = new _xfa_object.XFAObjectArray(); 64744 this.validate = new _xfa_object.XFAObjectArray(); 64745 this.value = new _xfa_object.XFAObjectArray(); 64746 this.variables = new _xfa_object.XFAObjectArray(); 64747 } 64748 64749} 64750 64751class Radial extends _xfa_object.XFAObject { 64752 constructor(attributes) { 64753 super(TEMPLATE_NS_ID, "radial", true); 64754 this.id = attributes.id || ""; 64755 this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]); 64756 this.use = attributes.use || ""; 64757 this.usehref = attributes.usehref || ""; 64758 this.color = null; 64759 this.extras = null; 64760 } 64761 64762 [_xfa_object.$toStyle](startColor) { 64763 startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF"; 64764 const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000"; 64765 const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`; 64766 return `radial-gradient(circle at center, ${colors})`; 64767 } 64768 64769} 64770 64771class Reason extends _xfa_object.StringObject { 64772 constructor(attributes) { 64773 super(TEMPLATE_NS_ID, "reason"); 64774 this.id = attributes.id || ""; 64775 this.name = attributes.name || ""; 64776 this.use = attributes.use || ""; 64777 this.usehref = attributes.usehref || ""; 64778 } 64779 64780} 64781 64782class Reasons extends _xfa_object.XFAObject { 64783 constructor(attributes) { 64784 super(TEMPLATE_NS_ID, "reasons", true); 64785 this.id = attributes.id || ""; 64786 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 64787 this.use = attributes.use || ""; 64788 this.usehref = attributes.usehref || ""; 64789 this.reason = new _xfa_object.XFAObjectArray(); 64790 } 64791 64792} 64793 64794class Rectangle extends _xfa_object.XFAObject { 64795 constructor(attributes) { 64796 super(TEMPLATE_NS_ID, "rectangle", true); 64797 this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]); 64798 this.id = attributes.id || ""; 64799 this.use = attributes.use || ""; 64800 this.usehref = attributes.usehref || ""; 64801 this.corner = new _xfa_object.XFAObjectArray(4); 64802 this.edge = new _xfa_object.XFAObjectArray(4); 64803 this.fill = null; 64804 } 64805 64806 [_xfa_object.$toHTML]() { 64807 const edge = this.edge.children.length ? this.edge.children[0] : new Edge({}); 64808 64809 const edgeStyle = edge[_xfa_object.$toStyle](); 64810 64811 const style = Object.create(null); 64812 64813 if (this.fill && this.fill.presence === "visible") { 64814 Object.assign(style, this.fill[_xfa_object.$toStyle]()); 64815 } else { 64816 style.fill = "transparent";
64817 } 64818 64819 style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0); 64820 style.stroke = edgeStyle.color; 64821 const corner = this.corner.children.length ? this.corner.children[0] : new Corner({}); 64822 64823 const cornerStyle = corner[_xfa_object.$toStyle](); 64824 64825 const rect = { 64826 name: "rect", 64827 attributes: { 64828 xmlns: SVG_NS, 64829 width: "100%", 64830 height: "100%", 64831 x: 0, 64832 y: 0, 64833 rx: cornerStyle.radius, 64834 ry: cornerStyle.radius, 64835 style 64836 } 64837 }; 64838 const svg = { 64839 name: "svg", 64840 children: [rect], 64841 attributes: { 64842 xmlns: SVG_NS, 64843 style: { 64844 overflow: "visible" 64845 }, 64846 width: "100%", 64847 height: "100%" 64848 } 64849 }; 64850 64851 const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 64852 64853 if (hasMargin(parent)) { 64854 return _utils.HTMLResult.success({ 64855 name: "div", 64856 attributes: { 64857 style: { 64858 display: "inline", 64859 width: "100%", 64860 height: "100%" 64861 } 64862 }, 64863 children: [svg] 64864 }); 64865 } 64866 64867 svg.attributes.style.position = "absolute"; 64868 return _utils.HTMLResult.success(svg); 64869 } 64870 64871} 64872 64873class RefElement extends _xfa_object.StringObject { 64874 constructor(attributes) { 64875 super(TEMPLATE_NS_ID, "ref"); 64876 this.id = attributes.id || ""; 64877 this.use = attributes.use || ""; 64878 this.usehref = attributes.usehref || ""; 64879 } 64880 64881} 64882 64883class Script extends _xfa_object.StringObject { 64884 constructor(attributes) { 64885 super(TEMPLATE_NS_ID, "script"); 64886 this.binding = attributes.binding || ""; 64887 this.contentType = attributes.contentType || ""; 64888 this.id = attributes.id || ""; 64889 this.name = attributes.name || ""; 64890 this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]); 64891 this.use = attributes.use || ""; 64892 this.usehref = attributes.usehref || ""; 64893 } 64894 64895} 64896 64897class SetProperty extends _xfa_object.XFAObject { 64898 constructor(attributes) { 64899 super(TEMPLATE_NS_ID, "setProperty"); 64900 this.connection = attributes.connection || ""; 64901 this.ref = attributes.ref || ""; 64902 this.target = attributes.target || ""; 64903 } 64904 64905} 64906 64907exports.SetProperty = SetProperty; 64908 64909class SignData extends _xfa_object.XFAObject { 64910 constructor(attributes) { 64911 super(TEMPLATE_NS_ID, "signData", true); 64912 this.id = attributes.id || ""; 64913 this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]); 64914 this.ref = attributes.ref || ""; 64915 this.target = attributes.target || ""; 64916 this.use = attributes.use || ""; 64917 this.usehref = attributes.usehref || ""; 64918 this.filter = null; 64919 this.manifest = null; 64920 } 64921 64922} 64923 64924class Signature extends _xfa_object.XFAObject { 64925 constructor(attributes) { 64926 super(TEMPLATE_NS_ID, "signature", true); 64927 this.id = attributes.id || ""; 64928 this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]); 64929 this.use = attributes.use || ""; 64930 this.usehref = attributes.usehref || ""; 64931 this.border = null; 64932 this.extras = null; 64933 this.filter = null; 64934 this.manifest = null; 64935 this.margin = null; 64936 } 64937 64938} 64939 64940class Signing extends _xfa_object.XFAObject { 64941 constructor(attributes) { 64942 super(TEMPLATE_NS_ID, "signing", true); 64943 this.id = attributes.id || ""; 64944 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 64945 this.use = attributes.use || ""; 64946 this.usehref = attributes.usehref || ""; 64947 this.certificate = new _xfa_object.XFAObjectArray(); 64948 } 64949 64950} 64951 64952class Solid extends _xfa_object.XFAObject { 64953 constructor(attributes) { 64954 super(TEMPLATE_NS_ID, "solid", true); 64955 this.id = attributes.id || ""; 64956 this.use = attributes.use || ""; 64957 this.usehref = attributes.usehref || ""; 64958 this.extras = null; 64959 } 64960 64961 [_xfa_object.$toStyle](startColor) { 64962 return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF"; 64963 } 64964 64965} 64966 64967class Speak extends _xfa_object.StringObject { 64968 constructor(attributes) { 64969 super(TEMPLATE_NS_ID, "speak"); 64970 this.disable = (0, _utils.getInteger)({ 64971 data: attributes.disable, 64972 defaultValue: 0, 64973 validate: x => x === 1 64974 }); 64975 this.id = attributes.id || ""; 64976 this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]); 64977 this.rid = attributes.rid || ""; 64978 this.use = attributes.use || ""; 64979 this.usehref = attributes.usehref || ""; 64980 } 64981 64982} 64983 64984class Stipple extends _xfa_object.XFAObject { 64985 constructor(attributes) { 64986 super(TEMPLATE_NS_ID, "stipple", true); 64987 this.id = attributes.id || ""; 64988 this.rate = (0, _utils.getInteger)({ 64989 data: attributes.rate, 64990 defaultValue: 50, 64991 validate: x => x >= 0 && x <= 100 64992 }); 64993 this.use = attributes.use || ""; 64994 this.usehref = attributes.usehref || ""; 64995 this.color = null; 64996 this.extras = null; 64997 } 64998 64999 [_xfa_object.$toStyle](bgColor) {
65000 const alpha = this.rate / 100; 65001 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)); 65002 } 65003 65004} 65005 65006class Subform extends _xfa_object.XFAObject { 65007 constructor(attributes) { 65008 super(TEMPLATE_NS_ID, "subform", true); 65009 this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]); 65010 this.allowMacro = (0, _utils.getInteger)({ 65011 data: attributes.allowMacro, 65012 defaultValue: 0, 65013 validate: x => x === 1 65014 }); 65015 this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 65016 this.colSpan = (0, _utils.getInteger)({ 65017 data: attributes.colSpan, 65018 defaultValue: 1, 65019 validate: n => n >= 1 || n === -1 65020 }); 65021 this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x)); 65022 this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : ""; 65023 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 65024 this.id = attributes.id || ""; 65025 this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]); 65026 this.locale = attributes.locale || ""; 65027 this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt"); 65028 this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt"); 65029 this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]); 65030 this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt"); 65031 this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt"); 65032 this.name = attributes.name || ""; 65033 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 65034 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 65035 this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]); 65036 this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]); 65037 this.use = attributes.use || ""; 65038 this.usehref = attributes.usehref || ""; 65039 this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : ""; 65040 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 65041 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 65042 this.assist = null; 65043 this.bind = null; 65044 this.bookend = null; 65045 this.border = null; 65046 this.break = null; 65047 this.calculate = null; 65048 this.desc = null; 65049 this.extras = null; 65050 this.keep = null; 65051 this.margin = null; 65052 this.occur = null; 65053 this.overflow = null; 65054 this.pageSet = null; 65055 this.para = null; 65056 this.traversal = null; 65057 this.validate = null; 65058 this.variables = null; 65059 this.area = new _xfa_object.XFAObjectArray(); 65060 this.breakAfter = new _xfa_object.XFAObjectArray(); 65061 this.breakBefore = new _xfa_object.XFAObjectArray(); 65062 this.connect = new _xfa_object.XFAObjectArray(); 65063 this.draw = new _xfa_object.XFAObjectArray(); 65064 this.event = new _xfa_object.XFAObjectArray(); 65065 this.exObject = new _xfa_object.XFAObjectArray(); 65066 this.exclGroup = new _xfa_object.XFAObjectArray(); 65067 this.field = new _xfa_object.XFAObjectArray(); 65068 this.proto = new _xfa_object.XFAObjectArray(); 65069 this.setProperty = new _xfa_object.XFAObjectArray(); 65070 this.subform = new _xfa_object.XFAObjectArray(); 65071 this.subformSet = new _xfa_object.XFAObjectArray(); 65072 } 65073 65074 [_xfa_object.$getSubformParent]() { 65075 const parent = this[_xfa_object.$getParent](); 65076 65077 if (parent instanceof SubformSet) { 65078 return parent[_xfa_object.$getSubformParent](); 65079 } 65080 65081 return parent; 65082 } 65083 65084 [_xfa_object.$isBindable]() { 65085 return true; 65086 } 65087 65088 [_xfa_object.$isThereMoreWidth]() { 65089 return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth](); 65090 } 65091 65092 *[_xfa_object.$getContainedChildren]() { 65093 yield* getContainedChildren(this); 65094 } 65095 65096 [_xfa_object.$flushHTML]() { 65097 return (0, _layout.flushHTML)(this); 65098 } 65099 65100 [_xfa_object.$addHTML](html, bbox) { 65101 (0, _layout.addHTML)(this, html, bbox); 65102 } 65103 65104 [_xfa_object.$getAvailableSpace]() { 65105 return (0, _layout.getAvailableSpace)(this); 65106 } 65107 65108 [_xfa_object.$isSplittable]() { 65109 const parent = this[_xfa_object.$getSubformParent](); 65110 65111 if (!parent[_xfa_object.$isSplittable]()) { 65112 return false;
65113 } 65114 65115 if (this[_xfa_object.$extra]._isSplittable !== undefined) { 65116 return this[_xfa_object.$extra]._isSplittable; 65117 } 65118 65119 if (this.layout === "position" || this.layout.includes("row")) { 65120 this[_xfa_object.$extra]._isSplittable = false; 65121 return false; 65122 } 65123 65124 if (this.keep && this.keep.intact !== "none") { 65125 this[_xfa_object.$extra]._isSplittable = false; 65126 return false; 65127 } 65128 65129 if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) { 65130 return false; 65131 } 65132 65133 this[_xfa_object.$extra]._isSplittable = true; 65134 return true; 65135 } 65136 65137 [_xfa_object.$toHTML](availableSpace) { 65138 setTabIndex(this); 65139 65140 if (this.break) { 65141 if (this.break.after !== "auto" || this.break.afterTarget !== "") { 65142 const node = new BreakAfter({ 65143 targetType: this.break.after, 65144 target: this.break.afterTarget, 65145 startNew: this.break.startNew.toString() 65146 }); 65147 node[_xfa_object.$globalData] = this[_xfa_object.$globalData]; 65148 65149 this[_xfa_object.$appendChild](node); 65150 65151 this.breakAfter.push(node); 65152 } 65153 65154 if (this.break.before !== "auto" || this.break.beforeTarget !== "") { 65155 const node = new BreakBefore({ 65156 targetType: this.break.before, 65157 target: this.break.beforeTarget, 65158 startNew: this.break.startNew.toString() 65159 }); 65160 node[_xfa_object.$globalData] = this[_xfa_object.$globalData]; 65161 65162 this[_xfa_object.$appendChild](node); 65163 65164 this.breakBefore.push(node); 65165 } 65166 65167 if (this.break.overflowTarget !== "") { 65168 const node = new Overflow({ 65169 target: this.break.overflowTarget, 65170 leader: this.break.overflowLeader, 65171 trailer: this.break.overflowTrailer 65172 }); 65173 node[_xfa_object.$globalData] = this[_xfa_object.$globalData]; 65174 65175 this[_xfa_object.$appendChild](node); 65176 65177 this.overflow.push(node); 65178 } 65179 65180 this[_xfa_object.$removeChild](this.break); 65181 65182 this.break = null; 65183 } 65184 65185 if (this.presence === "hidden" || this.presence === "inactive") { 65186 return _utils.HTMLResult.EMPTY; 65187 } 65188 65189 if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) { 65190 (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug."); 65191 } 65192 65193 if (this.breakBefore.children.length >= 1) { 65194 const breakBefore = this.breakBefore.children[0]; 65195 65196 if (handleBreak(breakBefore)) { 65197 return _utils.HTMLResult.breakNode(breakBefore); 65198 } 65199 } 65200 65201 if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) { 65202 return _utils.HTMLResult.EMPTY; 65203 } 65204 65205 (0, _html_utils.fixDimensions)(this); 65206 const children = []; 65207 const attributes = { 65208 id: this[_xfa_object.$uid], 65209 class: [] 65210 }; 65211 (0, _html_utils.setAccess)(this, attributes.class); 65212 65213 if (!this[_xfa_object.$extra]) { 65214 this[_xfa_object.$extra] = Object.create(null); 65215 } 65216 65217 Object.assign(this[_xfa_object.$extra], { 65218 children, 65219 line: null, 65220 attributes, 65221 attempt: 0, 65222 numberInLine: 0, 65223 availableSpace: { 65224 width: Math.min(this.w || Infinity, availableSpace.width), 65225 height: Math.min(this.h || Infinity, availableSpace.height) 65226 }, 65227 width: 0, 65228 height: 0, 65229 prevHeight: 0, 65230 currentWidth: 0 65231 }); 65232 65233 const root = this[_xfa_object.$getTemplateRoot](); 65234 65235 const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure; 65236 65237 const isSplittable = this[_xfa_object.$isSplittable](); 65238 65239 if (!isSplittable) { 65240 setFirstUnsplittable(this); 65241 } 65242 65243 if (!(0, _layout.checkDimensions)(this, availableSpace)) { 65244 return _utils.HTMLResult.FAILURE; 65245 } 65246 65247 const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]); 65248 65249 if (this.layout.includes("row")) { 65250 const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths; 65251 65252 if (Array.isArray(columnWidths) && columnWidths.length > 0) { 65253 this[_xfa_object.$extra].columnWidths = columnWidths; 65254 this[_xfa_object.$extra].currentColumn = 0; 65255 } 65256 } 65257 65258 const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign"); 65259 const classNames = ["xfaSubform"]; 65260 const cl = (0, _html_utils.layoutClass)(this); 65261 65262 if (cl) { 65263 classNames.push(cl); 65264 } 65265 65266 attributes.style = style; 65267 attributes.class = classNames; 65268 65269 if (this.name) { 65270 attributes.xfaName = this.name; 65271 } 65272 65273 if (this.overflow) { 65274 const overflowExtra = this.overflow[_xfa_object.$getExtra](); 65275 65276 if (overflowExtra.addLeader) { 65277 overflowExtra.addLeader = false;
65278 handleOverflow(this, overflowExtra.leader, availableSpace); 65279 } 65280 } 65281 65282 this[_xfa_object.$pushPara](); 65283 65284 const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb"; 65285 const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1; 65286 65287 for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) { 65288 if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) { 65289 this[_xfa_object.$extra].numberInLine = 0; 65290 } 65291 65292 const result = this[_xfa_object.$childrenToHTML]({ 65293 filter, 65294 include: true 65295 }); 65296 65297 if (result.success) { 65298 break; 65299 } 65300 65301 if (result.isBreak()) { 65302 this[_xfa_object.$popPara](); 65303 65304 return result; 65305 } 65306 65307 if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) { 65308 this[_xfa_object.$extra].attempt = maxRun; 65309 break; 65310 } 65311 } 65312 65313 this[_xfa_object.$popPara](); 65314 65315 if (!isSplittable) { 65316 unsetFirstUnsplittable(this); 65317 } 65318 65319 root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure; 65320 65321 if (this[_xfa_object.$extra].attempt === maxRun) { 65322 if (this.overflow) { 65323 this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow; 65324 } 65325 65326 if (!isSplittable) { 65327 delete this[_xfa_object.$extra]; 65328 } 65329 65330 return _utils.HTMLResult.FAILURE; 65331 } 65332 65333 if (this.overflow) { 65334 const overflowExtra = this.overflow[_xfa_object.$getExtra](); 65335 65336 if (overflowExtra.addTrailer) { 65337 overflowExtra.addTrailer = false; 65338 handleOverflow(this, overflowExtra.trailer, availableSpace); 65339 } 65340 } 65341 65342 let marginH = 0; 65343 let marginV = 0; 65344 65345 if (this.margin) { 65346 marginH = this.margin.leftInset + this.margin.rightInset; 65347 marginV = this.margin.topInset + this.margin.bottomInset; 65348 } 65349 65350 const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0); 65351 const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0); 65352 const bbox = [this.x, this.y, width, height]; 65353 65354 if (this.w === "") { 65355 style.width = (0, _html_utils.measureToString)(width); 65356 } 65357 65358 if (this.h === "") { 65359 style.height = (0, _html_utils.measureToString)(height); 65360 } 65361 65362 if ((style.width === "0px" || style.height === "0px") && children.length === 0) { 65363 return _utils.HTMLResult.EMPTY; 65364 } 65365 65366 const html = { 65367 name: "div", 65368 attributes, 65369 children 65370 }; 65371 applyAssist(this, attributes); 65372 65373 const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 65374 65375 if (this.breakAfter.children.length >= 1) { 65376 const breakAfter = this.breakAfter.children[0]; 65377 65378 if (handleBreak(breakAfter)) { 65379 this[_xfa_object.$extra].afterBreakAfter = result; 65380 return _utils.HTMLResult.breakNode(breakAfter); 65381 } 65382 } 65383 65384 delete this[_xfa_object.$extra]; 65385 return result; 65386 } 65387 65388} 65389 65390class SubformSet extends _xfa_object.XFAObject { 65391 constructor(attributes) { 65392 super(TEMPLATE_NS_ID, "subformSet", true); 65393 this.id = attributes.id || ""; 65394 this.name = attributes.name || ""; 65395 this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]); 65396 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 65397 this.use = attributes.use || ""; 65398 this.usehref = attributes.usehref || ""; 65399 this.bookend = null; 65400 this.break = null; 65401 this.desc = null; 65402 this.extras = null; 65403 this.occur = null; 65404 this.overflow = null; 65405 this.breakAfter = new _xfa_object.XFAObjectArray(); 65406 this.breakBefore = new _xfa_object.XFAObjectArray(); 65407 this.subform = new _xfa_object.XFAObjectArray(); 65408 this.subformSet = new _xfa_object.XFAObjectArray(); 65409 } 65410 65411 *[_xfa_object.$getContainedChildren]() { 65412 yield* getContainedChildren(this); 65413 } 65414 65415 [_xfa_object.$getSubformParent]() { 65416 let parent = this[_xfa_object.$getParent](); 65417 65418 while (!(parent instanceof Subform)) { 65419 parent = parent[_xfa_object.$getParent](); 65420 } 65421 65422 return parent; 65423 } 65424 65425 [_xfa_object.$isBindable]() { 65426 return true; 65427 } 65428 65429} 65430 65431class SubjectDN extends _xfa_object.ContentObject { 65432 constructor(attributes) { 65433 super(TEMPLATE_NS_ID, "subjectDN"); 65434 this.delimiter = attributes.delimiter || ","; 65435 this.id = attributes.id || ""; 65436 this.name = attributes.name || ""; 65437 this.use = attributes.use || ""; 65438 this.usehref = attributes.usehref || ""; 65439 } 65440 65441 [_xfa_object.$finalize]() { 65442 this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => { 65443 kv = kv.split("=", 2); 65444 kv[0] = kv[0].trim(); 65445 return kv; 65446 })); 65447 } 65448 65449} 65450 65451class SubjectDNs extends _xfa_object.XFAObject { 65452 constructor(attributes) { 65453 super(TEMPLATE_NS_ID, "subjectDNs", true); 65454 this.id = attributes.id || ""; 65455 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 65456 this.use = attributes.use || ""; 65457 this.usehref = attributes.usehref || ""; 65458 this.subjectDN = new _xfa_object.XFAObjectArray(); 65459 } 65460 65461} 65462 65463class Submit extends _xfa_object.XFAObject { 65464 constructor(attributes) { 65465 super(TEMPLATE_NS_ID, "submit", true); 65466 this.embedPDF = (0, _utils.getInteger)({ 65467 data: attributes.embedPDF, 65468 defaultValue: 0, 65469 validate: x => x === 1 65470 }); 65471 this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]); 65472 this.id = attributes.id || ""; 65473 this.target = attributes.target || ""; 65474 this.textEncoding = (0, _utils.getKeyword)({ 65475 data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "", 65476 defaultValue: "", 65477 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}/) 65478 }); 65479 this.use = attributes.use || ""; 65480 this.usehref = attributes.usehref || ""; 65481 this.xdpContent = attributes.xdpContent || ""; 65482 this.encrypt = null; 65483 this.encryptData = new _xfa_object.XFAObjectArray(); 65484 this.signData = new _xfa_object.XFAObjectArray(); 65485 } 65486 65487} 65488 65489class Template extends _xfa_object.XFAObject { 65490 constructor(attributes) { 65491 super(TEMPLATE_NS_ID, "template", true); 65492 this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]); 65493 this.extras = null; 65494 this.subform = new _xfa_object.XFAObjectArray(); 65495 } 65496 65497 [_xfa_object.$finalize]() { 65498 if (this.subform.children.length === 0) { 65499 (0, _util.warn)("XFA - No subforms in template node."); 65500 } 65501 65502 if (this.subform.children.length >= 2) { 65503 (0, _util.warn)("XFA - Several subforms in template node: please file a bug."); 65504 } 65505 65506 this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX; 65507 } 65508 65509 [_xfa_object.$isSplittable]() { 65510 return true; 65511 } 65512 65513 [_xfa_object.$searchNode](expr, container) { 65514 if (expr.startsWith("#")) { 65515 return [this[_xfa_object.$ids].get(expr.slice(1))]; 65516 } 65517 65518 return (0, _som.searchNode)(this, container, expr, true, true); 65519 } 65520 65521 *[_xfa_object.$toPages]() { 65522 if (!this.subform.children.length) { 65523 return _utils.HTMLResult.success({ 65524 name: "div", 65525 children: [] 65526 }); 65527 } 65528 65529 this[_xfa_object.$extra] = { 65530 overflowNode: null, 65531 firstUnsplittable: null, 65532 currentContentArea: null, 65533 currentPageArea: null, 65534 noLayoutFailure: false, 65535 pageNumber: 1, 65536 pagePosition: "first", 65537 oddOrEven: "odd", 65538 blankOrNotBlank: "nonBlank", 65539 paraStack: [] 65540 }; 65541 const root = this.subform.children[0]; 65542 65543 root.pageSet[_xfa_object.$cleanPage](); 65544 65545 const pageAreas = root.pageSet.pageArea.children; 65546 const mainHtml = { 65547 name: "div", 65548 children: [] 65549 }; 65550 let pageArea = null; 65551 let breakBefore = null; 65552 let breakBeforeTarget = null; 65553 65554 if (root.breakBefore.children.length >= 1) { 65555 breakBefore = root.breakBefore.children[0]; 65556 breakBeforeTarget = breakBefore.target; 65557 } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) { 65558 breakBefore = root.subform.children[0].breakBefore.children[0]; 65559 breakBeforeTarget = breakBefore.target; 65560 } else if (root.break && root.break.beforeTarget) { 65561 breakBefore = root.break; 65562 breakBeforeTarget = breakBefore.beforeTarget; 65563 } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) { 65564 breakBefore = root.subform.children[0].break; 65565 breakBeforeTarget = breakBefore.beforeTarget; 65566 } 65567 65568 if (breakBefore) { 65569 const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]()); 65570 65571 if (target instanceof PageArea) { 65572 pageArea = target; 65573 breakBefore[_xfa_object.$extra] = {}; 65574 } 65575 } 65576 65577 if (!pageArea) { 65578 pageArea = pageAreas[0]; 65579 } 65580 65581 pageArea[_xfa_object.$extra] = { 65582 numberOfUse: 1 65583 }; 65584 65585 const pageAreaParent = pageArea[_xfa_object.$getParent](); 65586 65587 pageAreaParent[_xfa_object.$extra] = { 65588 numberOfUse: 1, 65589 pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea), 65590 pageSetIndex: 0 65591 }; 65592 let targetPageArea; 65593 let leader = null; 65594 let trailer = null; 65595 let hasSomething = true; 65596 let hasSomethingCounter = 0; 65597 let startIndex = 0; 65598 65599 while (true) { 65600 if (!hasSomething) { 65601 mainHtml.children.pop(); 65602 65603 if (++hasSomethingCounter === MAX_EMPTY_PAGES) { 65604 (0, _util.warn)("XFA - Something goes wrong: please file a bug."); 65605 return mainHtml; 65606 } 65607 } else { 65608 hasSomethingCounter = 0; 65609 } 65610 65611 targetPageArea = null; 65612 this[_xfa_object.$extra].currentPageArea = pageArea; 65613 65614 const page = pageArea[_xfa_object.$toHTML]().html; 65615 65616 mainHtml.children.push(page); 65617 65618 if (leader) { 65619 this[_xfa_object.$extra].noLayoutFailure = true; 65620 page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html); 65621 leader = null; 65622 } 65623 65624 if (trailer) { 65625 this[_xfa_object.$extra].noLayoutFailure = true; 65626 page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html); 65627 trailer = null; 65628 } 65629 65630 const contentAreas = pageArea.contentArea.children; 65631 const htmlContentAreas = page.children.filter(node =>
65631 node.attributes.class.includes("xfaContentarea")); 65632 hasSomething = false; 65633 this[_xfa_object.$extra].firstUnsplittable = null; 65634 this[_xfa_object.$extra].noLayoutFailure = false; 65635 65636 const flush = index => { 65637 const html = root[_xfa_object.$flushHTML](); 65638 65639 if (html) { 65640 hasSomething = hasSomething || html.children && html.children.length !== 0; 65641 htmlContentAreas[index].children.push(html); 65642 } 65643 }; 65644 65645 for (let i = startIndex, ii = contentAreas.length; i < ii; i++) { 65646 const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i]; 65647 const space = { 65648 width: contentArea.w, 65649 height: contentArea.h 65650 }; 65651 startIndex = 0; 65652 65653 if (leader) { 65654 htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html); 65655 leader = null; 65656 } 65657 65658 if (trailer) { 65659 htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html); 65660 trailer = null; 65661 } 65662 65663 const html = root[_xfa_object.$toHTML](space); 65664 65665 if (html.success) { 65666 if (html.html) { 65667 hasSomething = hasSomething || html.html.children && html.html.children.length !== 0; 65668 htmlContentAreas[i].children.push(html.html); 65669 } else if (!hasSomething && mainHtml.children.length > 1) { 65670 mainHtml.children.pop(); 65671 } 65672 65673 return mainHtml; 65674 } 65675 65676 if (html.isBreak()) { 65677 const node = html.breakNode; 65678 flush(i); 65679 65680 if (node.targetType === "auto") { 65681 continue; 65682 } 65683 65684 if (node.leader) { 65685 leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]()); 65686 leader = leader ? leader[0] : null; 65687 } 65688 65689 if (node.trailer) { 65690 trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]()); 65691 trailer = trailer ? trailer[0] : null; 65692 } 65693 65694 if (node.targetType === "pageArea") { 65695 targetPageArea = node[_xfa_object.$extra].target; 65696 i = Infinity; 65697 } else if (!node[_xfa_object.$extra].target) { 65698 i = node[_xfa_object.$extra].index; 65699 } else { 65700 targetPageArea = node[_xfa_object.$extra].target; 65701 startIndex = node[_xfa_object.$extra].index + 1; 65702 i = Infinity; 65703 } 65704 65705 continue; 65706 } 65707 65708 if (this[_xfa_object.$extra].overflowNode) { 65709 const node = this[_xfa_object.$extra].overflowNode; 65710 this[_xfa_object.$extra].overflowNode = null; 65711 65712 const overflowExtra = node[_xfa_object.$getExtra](); 65713 65714 const target = overflowExtra.target; 65715 overflowExtra.addLeader = overflowExtra.leader !== null; 65716 overflowExtra.addTrailer = overflowExtra.trailer !== null; 65717 flush(i); 65718 const currentIndex = i; 65719 i = Infinity; 65720 65721 if (target instanceof PageArea) { 65722 targetPageArea = target; 65723 } else if (target instanceof ContentArea) { 65724 const index = contentAreas.findIndex(e => e === target); 65725 65726 if (index !== -1) { 65727 if (index > currentIndex) { 65728 i = index - 1; 65729 } else { 65730 startIndex = index; 65731 } 65732 } else { 65733 targetPageArea = target[_xfa_object.$getParent](); 65734 startIndex = targetPageArea.contentArea.children.findIndex(e => e === target); 65735 } 65736 } 65737 65738 continue; 65739 } 65740 65741 flush(i); 65742 } 65743 65744 this[_xfa_object.$extra].pageNumber += 1; 65745 65746 if (targetPageArea) { 65747 if (targetPageArea[_xfa_object.$isUsable]()) { 65748 targetPageArea[_xfa_object.$extra].numberOfUse += 1; 65749 } else { 65750 targetPageArea = null; 65751 } 65752 } 65753 65754 pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage](); 65755 yield null; 65756 } 65757 } 65758 65759} 65760 65761exports.Template = Template; 65762 65763class Text extends _xfa_object.ContentObject { 65764 constructor(attributes) { 65765 super(TEMPLATE_NS_ID, "text"); 65766 this.id = attributes.id || ""; 65767 this.maxChars = (0, _utils.getInteger)({ 65768 data: attributes.maxChars, 65769 defaultValue: 0, 65770 validate: x => x >= 0 65771 }); 65772 this.name = attributes.name || ""; 65773 this.rid = attributes.rid || ""; 65774 this.use = attributes.use || ""; 65775 this.usehref = attributes.usehref || ""; 65776 } 65777 65778 [_xfa_object.$acceptWhitespace]() { 65779 return true; 65780 } 65781 65782 [_xfa_object.$onChild](child) { 65783 if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) { 65784 this[_xfa_object.$content] = child; 65785 return true; 65786 } 65787 65788 (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`); 65789 return false;
65790 } 65791 65792 [_xfa_object.$onText](str) { 65793 if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) { 65794 return; 65795 } 65796 65797 super[_xfa_object.$onText](str); 65798 } 65799 65800 [_xfa_object.$finalize]() { 65801 if (typeof this[_xfa_object.$content] === "string") { 65802 this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n"); 65803 } 65804 } 65805 65806 [_xfa_object.$getExtra]() { 65807 if (typeof this[_xfa_object.$content] === "string") { 65808 return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => { 65809 if (line) { 65810 acc.push(line); 65811 } 65812 65813 return acc; 65814 }, []).join("\n"); 65815 } 65816 65817 return this[_xfa_object.$content][_xfa_object.$text](); 65818 } 65819 65820 [_xfa_object.$toHTML](availableSpace) { 65821 if (typeof this[_xfa_object.$content] === "string") { 65822 const html = valueToHtml(this[_xfa_object.$content]).html; 65823 65824 if (this[_xfa_object.$content].includes("\u2029")) { 65825 html.name = "div"; 65826 html.children = []; 65827 65828 this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => { 65829 acc.push({ 65830 name: "span", 65831 value: line 65832 }, { 65833 name: "br" 65834 }); 65835 return acc; 65836 }, [])).forEach(lines => { 65837 html.children.push({ 65838 name: "p", 65839 children: lines 65840 }); 65841 }); 65842 } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) { 65843 html.name = "div"; 65844 html.children = []; 65845 65846 this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => { 65847 html.children.push({ 65848 name: "span", 65849 value: line 65850 }, { 65851 name: "br" 65852 }); 65853 }); 65854 } 65855 65856 return _utils.HTMLResult.success(html); 65857 } 65858 65859 return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace); 65860 } 65861 65862} 65863 65864exports.Text = Text; 65865 65866class TextEdit extends _xfa_object.XFAObject { 65867 constructor(attributes) { 65868 super(TEMPLATE_NS_ID, "textEdit", true); 65869 this.allowRichText = (0, _utils.getInteger)({ 65870 data: attributes.allowRichText, 65871 defaultValue: 0, 65872 validate: x => x === 1 65873 }); 65874 this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); 65875 this.id = attributes.id || ""; 65876 this.multiLine = (0, _utils.getInteger)({ 65877 data: attributes.multiLine, 65878 defaultValue: "", 65879 validate: x => x === 0 || x === 1 65880 }); 65881 this.use = attributes.use || ""; 65882 this.usehref = attributes.usehref || ""; 65883 this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]); 65884 this.border = null; 65885 this.comb = null; 65886 this.extras = null; 65887 this.margin = null; 65888 } 65889 65890 [_xfa_object.$toHTML](availableSpace) { 65891 const style = (0, _html_utils.toStyle)(this, "border", "font", "margin"); 65892 let html; 65893 65894 const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); 65895 65896 if (this.multiLine === "") { 65897 this.multiLine = field instanceof Draw ? 1 : 0; 65898 } 65899 65900 if (this.multiLine === 1) { 65901 html = { 65902 name: "textarea", 65903 attributes: { 65904 dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], 65905 fieldId: field[_xfa_object.$uid], 65906 class: ["xfaTextfield"], 65907 style, 65908 "aria-label": ariaLabel(field) 65909 } 65910 }; 65911 } else { 65912 html = { 65913 name: "input", 65914 attributes: { 65915 type: "text", 65916 dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], 65917 fieldId: field[_xfa_object.$uid], 65918 class: ["xfaTextfield"], 65919 style, 65920 "aria-label": ariaLabel(field) 65921 } 65922 }; 65923 } 65924 65925 return _utils.HTMLResult.success({ 65926 name: "label", 65927 attributes: { 65928 class: ["xfaLabel"] 65929 }, 65930 children: [html] 65931 }); 65932 } 65933 65934} 65935 65936class Time extends _xfa_object.StringObject { 65937 constructor(attributes) { 65938 super(TEMPLATE_NS_ID, "time"); 65939 this.id = attributes.id || ""; 65940 this.name = attributes.name || ""; 65941 this.use = attributes.use || ""; 65942 this.usehref = attributes.usehref || ""; 65943 } 65944 65945 [_xfa_object.$finalize]() { 65946 const date = this[_xfa_object.$content].trim(); 65947 65948 this[_xfa_object.$content] = date ? new Date(date) : null; 65949 } 65950 65951 [_xfa_object.$toHTML](availableSpace) { 65952 return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : ""); 65953 } 65954 65955} 65956 65957class TimeStamp extends _xfa_object.XFAObject { 65958 constructor(attributes) { 65959 super(TEMPLATE_NS_ID, "timeStamp"); 65960 this.id = attributes.id || ""; 65961 this.server = attributes.server || ""; 65962 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 65963 this.use = attributes.use || ""; 65964 this.usehref = attributes.usehref || ""; 65965 } 65966 65967} 65968 65969class ToolTip extends _xfa_object.StringObject { 65970 constructor(attributes) { 65971 super(TEMPLATE_NS_ID, "toolTip"); 65972 this.id = attributes.id || ""; 65973 this.rid = attributes.rid || ""; 65974 this.use = attributes.use || ""; 65975 this.usehref = attributes.usehref || ""; 65976 } 65977 65978} 65979 65980class Traversal extends _xfa_object.XFAObject { 65981 constructor(attributes) { 65982 super(TEMPLATE_NS_ID, "traversal", true); 65983 this.id = attributes.id || ""; 65984 this.use = attributes.use || ""; 65985 this.usehref = attributes.usehref || ""; 65986 this.extras = null; 65987 this.traverse = new _xfa_object.XFAObjectArray(); 65988 } 65989 65990} 65991 65992class Traverse extends _xfa_object.XFAObject { 65993 constructor(attributes) { 65994 super(TEMPLATE_NS_ID, "traverse", true); 65995 this.id = attributes.id || ""; 65996 this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]); 65997 this.ref = attributes.ref || ""; 65998 this.use = attributes.use || ""; 65999 this.usehref = attributes.usehref || ""; 66000 this.extras = null; 66001 this.script = null; 66002 } 66003 66004 get name() { 66005 return this.operation; 66006 } 66007 66008 [_xfa_object.$isTransparent]() { 66009 return false;
66010 } 66011 66012} 66013 66014class Ui extends _xfa_object.XFAObject { 66015 constructor(attributes) { 66016 super(TEMPLATE_NS_ID, "ui", true); 66017 this.id = attributes.id || ""; 66018 this.use = attributes.use || ""; 66019 this.usehref = attributes.usehref || ""; 66020 this.extras = null; 66021 this.picture = null; 66022 this.barcode = null; 66023 this.button = null; 66024 this.checkButton = null; 66025 this.choiceList = null; 66026 this.dateTimeEdit = null; 66027 this.defaultUi = null; 66028 this.imageEdit = null; 66029 this.numericEdit = null; 66030 this.passwordEdit = null; 66031 this.signature = null; 66032 this.textEdit = null; 66033 } 66034 66035 [_xfa_object.$getExtra]() { 66036 if (this[_xfa_object.$extra] === undefined) { 66037 for (const name of Object.getOwnPropertyNames(this)) { 66038 if (name === "extras" || name === "picture") { 66039 continue; 66040 } 66041 66042 const obj = this[name]; 66043 66044 if (!(obj instanceof _xfa_object.XFAObject)) { 66045 continue; 66046 } 66047 66048 this[_xfa_object.$extra] = obj; 66049 return obj; 66050 } 66051 66052 this[_xfa_object.$extra] = null; 66053 } 66054 66055 return this[_xfa_object.$extra]; 66056 } 66057 66058 [_xfa_object.$toHTML](availableSpace) { 66059 const obj = this[_xfa_object.$getExtra](); 66060 66061 if (obj) { 66062 return obj[_xfa_object.$toHTML](availableSpace); 66063 } 66064 66065 return _utils.HTMLResult.EMPTY; 66066 } 66067 66068} 66069 66070class Validate extends _xfa_object.XFAObject { 66071 constructor(attributes) { 66072 super(TEMPLATE_NS_ID, "validate", true); 66073 this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]); 66074 this.id = attributes.id || ""; 66075 this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]); 66076 this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]); 66077 this.use = attributes.use || ""; 66078 this.usehref = attributes.usehref || ""; 66079 this.extras = null; 66080 this.message = null; 66081 this.picture = null; 66082 this.script = null; 66083 } 66084 66085} 66086 66087class Value extends _xfa_object.XFAObject { 66088 constructor(attributes) { 66089 super(TEMPLATE_NS_ID, "value", true); 66090 this.id = attributes.id || ""; 66091 this.override = (0, _utils.getInteger)({ 66092 data: attributes.override, 66093 defaultValue: 0, 66094 validate: x => x === 1 66095 }); 66096 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 66097 this.use = attributes.use || ""; 66098 this.usehref = attributes.usehref || ""; 66099 this.arc = null; 66100 this.boolean = null; 66101 this.date = null; 66102 this.dateTime = null; 66103 this.decimal = null; 66104 this.exData = null; 66105 this.float = null; 66106 this.image = null; 66107 this.integer = null; 66108 this.line = null; 66109 this.rectangle = null; 66110 this.text = null; 66111 this.time = null; 66112 } 66113 66114 [_xfa_object.$setValue](value) { 66115 const parent = this[_xfa_object.$getParent](); 66116 66117 if (parent instanceof Field) { 66118 if (parent.ui && parent.ui.imageEdit) { 66119 if (!this.image) { 66120 this.image = new Image({}); 66121 66122 this[_xfa_object.$appendChild](this.image); 66123 } 66124 66125 this.image[_xfa_object.$content] = value[_xfa_object.$content]; 66126 return; 66127 } 66128 } 66129 66130 const valueName = value[_xfa_object.$nodeName]; 66131 66132 if (this[valueName] !== null) { 66133 this[valueName][_xfa_object.$content] = value[_xfa_object.$content]; 66134 return; 66135 } 66136 66137 for (const name of Object.getOwnPropertyNames(this)) { 66138 const obj = this[name]; 66139 66140 if (obj instanceof _xfa_object.XFAObject) { 66141 this[name] = null; 66142 66143 this[_xfa_object.$removeChild](obj); 66144 } 66145 } 66146 66147 this[value[_xfa_object.$nodeName]] = value; 66148 66149 this[_xfa_object.$appendChild](value); 66150 } 66151 66152 [_xfa_object.$text]() { 66153 if (this.exData) { 66154 if (typeof this.exData[_xfa_object.$content] === "string") { 66155 return this.exData[_xfa_object.$content].trim(); 66156 } 66157 66158 return this.exData[_xfa_object.$content][_xfa_object.$text]().trim(); 66159 } 66160 66161 for (const name of Object.getOwnPropertyNames(this)) { 66162 if (name === "image") { 66163 continue; 66164 } 66165 66166 const obj = this[name]; 66167 66168 if (obj instanceof _xfa_object.XFAObject) { 66169 return (obj[_xfa_object.$content] || "").toString().trim(); 66170 } 66171 } 66172 66173 return null; 66174 } 66175 66176 [_xfa_object.$toHTML](availableSpace) {
66177 for (const name of Object.getOwnPropertyNames(this)) { 66178 const obj = this[name]; 66179 66180 if (!(obj instanceof _xfa_object.XFAObject)) { 66181 continue; 66182 } 66183 66184 return obj[_xfa_object.$toHTML](availableSpace); 66185 } 66186 66187 return _utils.HTMLResult.EMPTY; 66188 } 66189 66190} 66191 66192exports.Value = Value; 66193 66194class Variables extends _xfa_object.XFAObject { 66195 constructor(attributes) { 66196 super(TEMPLATE_NS_ID, "variables", true); 66197 this.id = attributes.id || ""; 66198 this.use = attributes.use || ""; 66199 this.usehref = attributes.usehref || ""; 66200 this.boolean = new _xfa_object.XFAObjectArray(); 66201 this.date = new _xfa_object.XFAObjectArray(); 66202 this.dateTime = new _xfa_object.XFAObjectArray(); 66203 this.decimal = new _xfa_object.XFAObjectArray(); 66204 this.exData = new _xfa_object.XFAObjectArray(); 66205 this.float = new _xfa_object.XFAObjectArray(); 66206 this.image = new _xfa_object.XFAObjectArray(); 66207 this.integer = new _xfa_object.XFAObjectArray(); 66208 this.manifest = new _xfa_object.XFAObjectArray(); 66209 this.script = new _xfa_object.XFAObjectArray(); 66210 this.text = new _xfa_object.XFAObjectArray(); 66211 this.time = new _xfa_object.XFAObjectArray(); 66212 } 66213 66214 [_xfa_object.$isTransparent]() { 66215 return true; 66216 } 66217 66218} 66219 66220class TemplateNamespace { 66221 static [_namespaces.$buildXFAObject](name, attributes) { 66222 if (TemplateNamespace.hasOwnProperty(name)) { 66223 const node = TemplateNamespace[name](attributes); 66224 66225 node[_xfa_object.$setSetAttributes](attributes); 66226 66227 return node; 66228 } 66229 66230 return undefined; 66231 } 66232 66233 static appearanceFilter(attrs) { 66234 return new AppearanceFilter(attrs); 66235 } 66236 66237 static arc(attrs) { 66238 return new Arc(attrs); 66239 } 66240 66241 static area(attrs) { 66242 return new Area(attrs); 66243 } 66244 66245 static assist(attrs) { 66246 return new Assist(attrs); 66247 } 66248 66249 static barcode(attrs) { 66250 return new Barcode(attrs); 66251 } 66252 66253 static bind(attrs) { 66254 return new Bind(attrs); 66255 } 66256 66257 static bindItems(attrs) { 66258 return new BindItems(attrs); 66259 } 66260 66261 static bookend(attrs) { 66262 return new Bookend(attrs); 66263 } 66264 66265 static boolean(attrs) { 66266 return new BooleanElement(attrs); 66267 } 66268 66269 static border(attrs) { 66270 return new Border(attrs); 66271 } 66272 66273 static break(attrs) { 66274 return new Break(attrs); 66275 } 66276 66277 static breakAfter(attrs) { 66278 return new BreakAfter(attrs); 66279 } 66280 66281 static breakBefore(attrs) { 66282 return new BreakBefore(attrs); 66283 } 66284 66285 static button(attrs) { 66286 return new Button(attrs); 66287 } 66288 66289 static calculate(attrs) { 66290 return new Calculate(attrs); 66291 } 66292 66293 static caption(attrs) { 66294 return new Caption(attrs); 66295 } 66296 66297 static certificate(attrs) { 66298 return new Certificate(attrs); 66299 } 66300 66301 static certificates(attrs) { 66302 return new Certificates(attrs); 66303 } 66304 66305 static checkButton(attrs) { 66306 return new CheckButton(attrs); 66307 } 66308 66309 static choiceList(attrs) { 66310 return new ChoiceList(attrs); 66311 } 66312 66313 static color(attrs) { 66314 return new Color(attrs); 66315 } 66316 66317 static comb(attrs) { 66318 return new Comb(attrs); 66319 } 66320 66321 static connect(attrs) { 66322 return new Connect(attrs); 66323 } 66324 66325 static contentArea(attrs) { 66326 return new ContentArea(attrs); 66327 } 66328 66329 static corner(attrs) { 66330 return new Corner(attrs); 66331 } 66332 66333 static date(attrs) { 66334 return new DateElement(attrs); 66335 } 66336 66337 static dateTime(attrs) { 66338 return new DateTime(attrs); 66339 } 66340 66341 static dateTimeEdit(attrs) { 66342 return new DateTimeEdit(attrs); 66343 } 66344 66345 static decimal(attrs) { 66346 return new Decimal(attrs); 66347 } 66348 66349 static defaultUi(attrs) { 66350 return new DefaultUi(attrs); 66351 } 66352 66353 static desc(attrs) { 66354 return new Desc(attrs); 66355 } 66356 66357 static digestMethod(attrs) { 66358 return new DigestMethod(attrs); 66359 } 66360 66361 static digestMethods(attrs) { 66362 return new DigestMethods(attrs); 66363 } 66364 66365 static draw(attrs) { 66366 return new Draw(attrs); 66367 } 66368 66369 static edge(attrs) { 66370 return new Edge(attrs); 66371 } 66372 66373 static encoding(attrs) { 66374 return new Encoding(attrs); 66375 } 66376 66377 static encodings(attrs) { 66378 return new Encodings(attrs); 66379 } 66380 66381 static encrypt(attrs) { 66382 return new Encrypt(attrs); 66383 } 66384 66385 static encryptData(attrs) { 66386 return new EncryptData(attrs); 66387 } 66388 66389 static encryption(attrs) { 66390 return new Encryption(attrs); 66391 } 66392 66393 static encryptionMethod(attrs) { 66394 return new EncryptionMethod(attrs); 66395 } 66396 66397 static encryptionMethods(attrs) { 66398 return new EncryptionMethods(attrs); 66399 } 66400 66401 static event(attrs) { 66402 return new Event(attrs); 66403 } 66404 66405 static exData(attrs) { 66406 return new ExData(attrs); 66407 } 66408 66409 static exObject(attrs) { 66410 return new ExObject(attrs); 66411 } 66412 66413 static exclGroup(attrs) { 66414 return new ExclGroup(attrs); 66415 } 66416 66417 static execute(attrs) { 66418 return new Execute(attrs); 66419 } 66420 66421 static extras(attrs) { 66422 return new Extras(attrs); 66423 } 66424 66425 static field(attrs) { 66426 return new Field(attrs); 66427 } 66428 66429 static fill(attrs) { 66430 return new Fill(attrs); 66431 } 66432 66433 static filter(attrs) { 66434 return new Filter(attrs); 66435 } 66436 66437 static float(attrs) { 66438 return new Float(attrs); 66439 } 66440 66441 static font(attrs) { 66442 return new Font(attrs); 66443 } 66444 66445 static format(attrs) { 66446 return new Format(attrs); 66447 } 66448 66449 static handler(attrs) { 66450 return new Handler(attrs); 66451 } 66452 66453 static hyphenation(attrs) { 66454 return new Hyphenation(attrs); 66455 } 66456 66457 static image(attrs) { 66458 return new Image(attrs); 66459 } 66460 66461 static imageEdit(attrs) { 66462 return new ImageEdit(attrs); 66463 } 66464 66465 static integer(attrs) { 66466 return new Integer(attrs); 66467 } 66468 66469 static issuers(attrs) { 66470 return new Issuers(attrs); 66471 } 66472 66473 static items(attrs) { 66474 return new Items(attrs); 66475 } 66476 66477 static keep(attrs) { 66478 return new Keep(attrs); 66479 } 66480 66481 static keyUsage(attrs) { 66482 return new KeyUsage(attrs); 66483 } 66484 66485 static line(attrs) { 66486 return new Line(attrs); 66487 } 66488 66489 static linear(attrs) { 66490 return new Linear(attrs); 66491 } 66492 66493 static lockDocument(attrs) { 66494 return new LockDocument(attrs); 66495 } 66496 66497 static manifest(attrs) { 66498 return new Manifest(attrs); 66499 } 66500 66501 static margin(attrs) { 66502 return new Margin(attrs); 66503 } 66504 66505 static mdp(attrs) { 66506 return new Mdp(attrs); 66507 } 66508 66509 static medium(attrs) { 66510 return new Medium(attrs); 66511 } 66512 66513 static message(attrs) {
66514 return new Message(attrs); 66515 } 66516 66517 static numericEdit(attrs) { 66518 return new NumericEdit(attrs); 66519 } 66520 66521 static occur(attrs) { 66522 return new Occur(attrs); 66523 } 66524 66525 static oid(attrs) { 66526 return new Oid(attrs); 66527 } 66528 66529 static oids(attrs) { 66530 return new Oids(attrs); 66531 } 66532 66533 static overflow(attrs) { 66534 return new Overflow(attrs); 66535 } 66536 66537 static pageArea(attrs) { 66538 return new PageArea(attrs); 66539 } 66540 66541 static pageSet(attrs) { 66542 return new PageSet(attrs); 66543 } 66544 66545 static para(attrs) { 66546 return new Para(attrs); 66547 } 66548 66549 static passwordEdit(attrs) { 66550 return new PasswordEdit(attrs); 66551 } 66552 66553 static pattern(attrs) { 66554 return new Pattern(attrs); 66555 } 66556 66557 static picture(attrs) { 66558 return new Picture(attrs); 66559 } 66560 66561 static proto(attrs) { 66562 return new Proto(attrs); 66563 } 66564 66565 static radial(attrs) { 66566 return new Radial(attrs); 66567 } 66568 66569 static reason(attrs) { 66570 return new Reason(attrs); 66571 } 66572 66573 static reasons(attrs) { 66574 return new Reasons(attrs); 66575 } 66576 66577 static rectangle(attrs) { 66578 return new Rectangle(attrs); 66579 } 66580 66581 static ref(attrs) { 66582 return new RefElement(attrs); 66583 } 66584 66585 static script(attrs) { 66586 return new Script(attrs); 66587 } 66588 66589 static setProperty(attrs) { 66590 return new SetProperty(attrs); 66591 } 66592 66593 static signData(attrs) { 66594 return new SignData(attrs); 66595 } 66596 66597 static signature(attrs) { 66598 return new Signature(attrs); 66599 } 66600 66601 static signing(attrs) { 66602 return new Signing(attrs); 66603 } 66604 66605 static solid(attrs) { 66606 return new Solid(attrs); 66607 } 66608 66609 static speak(attrs) { 66610 return new Speak(attrs); 66611 } 66612 66613 static stipple(attrs) { 66614 return new Stipple(attrs); 66615 } 66616 66617 static subform(attrs) { 66618 return new Subform(attrs); 66619 } 66620 66621 static subformSet(attrs) { 66622 return new SubformSet(attrs); 66623 } 66624 66625 static subjectDN(attrs) { 66626 return new SubjectDN(attrs); 66627 } 66628 66629 static subjectDNs(attrs) { 66630 return new SubjectDNs(attrs); 66631 } 66632 66633 static submit(attrs) { 66634 return new Submit(attrs); 66635 } 66636 66637 static template(attrs) { 66638 return new Template(attrs); 66639 } 66640 66641 static text(attrs) { 66642 return new Text(attrs); 66643 } 66644 66645 static textEdit(attrs) { 66646 return new TextEdit(attrs); 66647 } 66648 66649 static time(attrs) { 66650 return new Time(attrs); 66651 } 66652 66653 static timeStamp(attrs) { 66654 return new TimeStamp(attrs); 66655 } 66656 66657 static toolTip(attrs) { 66658 return new ToolTip(attrs); 66659 } 66660 66661 static traversal(attrs) { 66662 return new Traversal(attrs); 66663 } 66664 66665 static traverse(attrs) { 66666 return new Traverse(attrs); 66667 } 66668 66669 static ui(attrs) { 66670 return new Ui(attrs); 66671 } 66672 66673 static validate(attrs) { 66674 return new Validate(attrs); 66675 } 66676 66677 static value(attrs) { 66678 return new Value(attrs); 66679 } 66680 66681 static variables(attrs) { 66682 return new Variables(attrs); 66683 } 66684 66685} 66686 66687exports.TemplateNamespace = TemplateNamespace; 66688 66689/***/ }), 66690/* 81 */ 66691/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 66692 66693 66694 66695Object.defineProperty(exports, "__esModule", ({ 66696 value: true 66697})); 66698exports.addHTML = addHTML; 66699exports.checkDimensions = checkDimensions; 66700exports.flushHTML = flushHTML; 66701exports.getAvailableSpace = getAvailableSpace; 66702 66703var _xfa_object = __w_pdfjs_require__(75); 66704 66705var _html_utils = __w_pdfjs_require__(82); 66706 66707function createLine(node, children) { 66708 return { 66709 name: "div", 66710 attributes: { 66711 class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"] 66712 }, 66713 children 66714 }; 66715} 66716 66717function flushHTML(node) { 66718 if (!node[_xfa_object.$extra]) { 66719 return null; 66720 } 66721 66722 const attributes = node[_xfa_object.$extra].attributes; 66723 const html = { 66724 name: "div", 66725 attributes, 66726 children: node[_xfa_object.$extra].children 66727 }; 66728 66729 if (node[_xfa_object.$extra].failingNode) { 66730 const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML](); 66731 66732 if (htmlFromFailing) { 66733 if (node.layout.endsWith("-tb")) { 66734 html.children.push(createLine(node, [htmlFromFailing])); 66735 } else { 66736 html.children.push(htmlFromFailing); 66737 } 66738 } 66739 } 66740 66741 if (html.children.length === 0) { 66742 return null; 66743 } 66744 66745 return html; 66746} 66747 66748function addHTML(node, html, bbox) { 66749 const extra = node[_xfa_object.$extra]; 66750 const availableSpace = extra.availableSpace; 66751 const [x, y, w, h] = bbox; 66752 66753 switch (node.layout) { 66754 case "position": 66755 { 66756 extra.width = Math.max(extra.width, x + w); 66757 extra.height = Math.max(extra.height, y + h); 66758 extra.children.push(html); 66759 break; 66760 } 66761 66762 case "lr-tb": 66763 case "rl-tb": 66764 if (!extra.line || extra.attempt === 1) { 66765 extra.line = createLine(node, []); 66766 extra.children.push(extra.line); 66767 extra.numberInLine = 0; 66768 } 66769 66770 extra.numberInLine += 1; 66771 extra.line.children.push(html); 66772 66773 if (extra.attempt === 0) { 66774 extra.currentWidth += w; 66775 extra.height = Math.max(extra.height, extra.prevHeight + h); 66776 } else { 66777 extra.currentWidth = w; 66778 extra.prevHeight = extra.height; 66779 extra.height += h; 66780 extra.attempt = 0; 66781 } 66782 66783 extra.width = Math.max(extra.width, extra.currentWidth); 66784 break; 66785 66786 case "rl-row": 66787 case "row": 66788 { 66789 extra.children.push(html); 66790 extra.width += w; 66791 extra.height = Math.max(extra.height, h); 66792 const height = (0, _html_utils.measureToString)(extra.height); 66793 66794 for (const child of extra.children) { 66795 child.attributes.style.height = height; 66796 } 66797 66798 break; 66799 } 66800 66801 case "table": 66802 { 66803 extra.width = Math.min(availableSpace.width, Math.max(extra.width, w)); 66804 extra.height += h; 66805 extra.children.push(html); 66806 break; 66807 } 66808 66809 case "tb": 66810 { 66811 extra.width = Math.min(availableSpace.width, Math.max(extra.width, w)); 66812 extra.height += h; 66813 extra.children.push(html); 66814 break; 66815 } 66816 } 66817} 66818 66819function getAvailableSpace(node) { 66820 const availableSpace = node[_xfa_object.$extra].availableSpace; 66821 const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0; 66822 const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0; 66823 66824 switch (node.layout) { 66825 case "lr-tb": 66826 case "rl-tb": 66827 if (node[_xfa_object.$extra].attempt === 0) { 66828 return { 66829 width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth, 66830 height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight 66831 }; 66832 } 66833 66834 return { 66835 width: availableSpace.width - marginH, 66836 height: availableSpace.height - marginV - node[_xfa_object.$extra].height 66837 }; 66838 66839 case "rl-row": 66840 case "row": 66841 const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x); 66842 66843 return { 66844 width, 66845 height: availableSpace.height - marginH 66846 }; 66847 66848 case "table": 66849 case "tb": 66850 return { 66851 width: availableSpace.width - marginH, 66852 height: availableSpace.height - marginV - node[_xfa_object.$extra].height 66853 }; 66854 66855 case "position": 66856 default: 66857 return availableSpace; 66858 } 66859} 66860 66861function getTransformedBBox(node) { 66862 let w = node.w === "" ? NaN : node.w; 66863 let h = node.h === "" ? NaN : node.h; 66864 let [centerX, centerY] = [0, 0]; 66865 66866 switch (node.anchorType || "") { 66867 case "bottomCenter": 66868 [centerX, centerY] = [w / 2, h]; 66869 break; 66870 66871 case "bottomLeft": 66872 [centerX, centerY] = [0, h]; 66873 break; 66874 66875 case "bottomRight": 66876 [centerX, centerY] = [w, h]; 66877 break; 66878
66879 case "middleCenter": 66880 [centerX, centerY] = [w / 2, h / 2]; 66881 break; 66882 66883 case "middleLeft": 66884 [centerX, centerY] = [0, h / 2]; 66885 break; 66886 66887 case "middleRight": 66888 [centerX, centerY] = [w, h / 2]; 66889 break; 66890 66891 case "topCenter": 66892 [centerX, centerY] = [w / 2, 0]; 66893 break; 66894 66895 case "topRight": 66896 [centerX, centerY] = [w, 0]; 66897 break; 66898 } 66899 66900 let x, y; 66901 66902 switch (node.rotate || 0) { 66903 case 0: 66904 [x, y] = [-centerX, -centerY]; 66905 break; 66906 66907 case 90: 66908 [x, y] = [-centerY, centerX]; 66909 [w, h] = [h, -w]; 66910 break; 66911 66912 case 180: 66913 [x, y] = [centerX, centerY]; 66914 [w, h] = [-w, -h]; 66915 break; 66916 66917 case 270: 66918 [x, y] = [centerY, -centerX]; 66919 [w, h] = [-h, w]; 66920 break; 66921 } 66922 66923 return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)]; 66924} 66925 66926function checkDimensions(node, space) { 66927 if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) { 66928 return true; 66929 } 66930 66931 if (node.w === 0 || node.h === 0) { 66932 return true; 66933 } 66934 66935 const ERROR = 2; 66936 66937 const parent = node[_xfa_object.$getSubformParent](); 66938 66939 const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0; 66940 const [, y, w, h] = getTransformedBBox(node); 66941 66942 switch (parent.layout) { 66943 case "lr-tb": 66944 case "rl-tb": 66945 if (attempt === 0) { 66946 if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { 66947 if (node.h !== "" && Math.round(h - space.height) > ERROR) { 66948 return false; 66949 } 66950 66951 if (node.w !== "") { 66952 if (Math.round(w - space.width) <= ERROR) { 66953 return true; 66954 } 66955 66956 if (parent[_xfa_object.$extra].numberInLine === 0) { 66957 return space.height > ERROR; 66958 } 66959 66960 return false; 66961 } 66962 66963 return space.width > ERROR; 66964 } 66965 66966 if (node.w !== "") { 66967 return Math.round(w - space.width) <= ERROR; 66968 } 66969 66970 return space.width > ERROR; 66971 } 66972 66973 if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { 66974 return true; 66975 } 66976 66977 if (node.h !== "" && Math.round(h - space.height) > ERROR) { 66978 return false; 66979 } 66980 66981 if (node.w === "" || Math.round(w - space.width) <= ERROR) { 66982 return space.height > ERROR; 66983 } 66984 66985 if (parent[_xfa_object.$isThereMoreWidth]()) { 66986 return false; 66987 } 66988 66989 return space.height > ERROR; 66990 66991 case "table": 66992 case "tb": 66993 if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { 66994 return true; 66995 } 66996 66997 if (node.h !== "" && !node[_xfa_object.$isSplittable]()) { 66998 return Math.round(h - space.height) <= ERROR; 66999 } 67000 67001 if (node.w === "" || Math.round(w - space.width) <= ERROR) { 67002 return space.height > ERROR; 67003 } 67004 67005 if (parent[_xfa_object.$isThereMoreWidth]()) { 67006 return false; 67007 } 67008 67009 return space.height > ERROR; 67010 67011 case "position": 67012 if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { 67013 return true; 67014 } 67015 67016 if (node.h === "" || Math.round(h + y - space.height) <= ERROR) { 67017 return true; 67018 } 67019 67020 const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea; 67021 67022 return h + y > area.h; 67023 67024 case "rl-row": 67025 case "row": 67026 if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { 67027 return true; 67028 } 67029 67030 if (node.h !== "") { 67031 return Math.round(h - space.height) <= ERROR; 67032 } 67033 67034 return true; 67035 67036 default: 67037 return true; 67038 } 67039} 67040 67041/***/ }), 67042/* 82 */ 67043/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 67044 67045 67046 67047Object.defineProperty(exports, "__esModule", ({ 67048 value: true 67049})); 67050exports.computeBbox = computeBbox; 67051exports.createWrapper = createWrapper; 67052exports.fixDimensions = fixDimensions; 67053exports.fixTextIndent = fixTextIndent; 67054exports.fixURL = fixURL; 67055exports.isPrintOnly = isPrintOnly; 67056exports.layoutClass = layoutClass; 67057exports.layoutNode = layoutNode; 67058exports.measureToString = measureToString; 67059exports.setAccess = setAccess; 67060exports.setFontFamily = setFontFamily; 67061exports.setMinMaxDimensions = setMinMaxDimensions; 67062exports.setPara = setPara; 67063exports.toStyle = toStyle; 67064 67065var _xfa_object = __w_pdfjs_require__(75); 67066 67067var _util = __w_pdfjs_require__(2); 67068 67069var _utils = __w_pdfjs_require__(76); 67070 67071var _fonts = __w_pdfjs_require__(83); 67072 67073var _text = __w_pdfjs_require__(84); 67074 67075function measureToString(m) { 67076 if (typeof m === "string") { 67077 return "0px"; 67078 } 67079 67080 return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`; 67081} 67082 67083const converters = { 67084 anchorType(node, style) { 67085 const parent = node[_xfa_object.$getSubformParent](); 67086 67087 if (!parent || parent.layout && parent.layout !== "position") { 67088 return; 67089 } 67090 67091 if (!("transform" in style)) { 67092 style.transform = ""; 67093 } 67094 67095 switch (node.anchorType) { 67096 case "bottomCenter": 67097 style.transform += "translate(-50%, -100%)"; 67098 break; 67099 67100 case "bottomLeft": 67101 style.transform += "translate(0,-100%)"; 67102 break; 67103 67104 case "bottomRight": 67105 style.transform += "translate(-100%,-100%)"; 67106 break; 67107
67108 case "middleCenter": 67109 style.transform += "translate(-50%,-50%)"; 67110 break; 67111 67112 case "middleLeft": 67113 style.transform += "translate(0,-50%)"; 67114 break; 67115 67116 case "middleRight": 67117 style.transform += "translate(-100%,-50%)"; 67118 break; 67119 67120 case "topCenter": 67121 style.transform += "translate(-50%,0)"; 67122 break; 67123 67124 case "topRight": 67125 style.transform += "translate(-100%,0)"; 67126 break; 67127 } 67128 }, 67129 67130 dimensions(node, style) { 67131 const parent = node[_xfa_object.$getSubformParent](); 67132 67133 let width = node.w; 67134 const height = node.h; 67135 67136 if (parent.layout && parent.layout.includes("row")) { 67137 const extra = parent[_xfa_object.$extra]; 67138 const colSpan = node.colSpan; 67139 let w; 67140 67141 if (colSpan === -1) { 67142 w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0); 67143 extra.currentColumn = 0; 67144 } else { 67145 w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0); 67146 extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length; 67147 } 67148 67149 if (!isNaN(w)) { 67150 width = node.w = w; 67151 } 67152 } 67153 67154 if (width !== "") { 67155 style.width = measureToString(width); 67156 } else { 67157 style.width = "auto"; 67158 } 67159 67160 if (height !== "") { 67161 style.height = measureToString(height); 67162 } else { 67163 style.height = "auto"; 67164 } 67165 }, 67166 67167 position(node, style) { 67168 const parent = node[_xfa_object.$getSubformParent](); 67169 67170 if (parent && parent.layout && parent.layout !== "position") { 67171 return; 67172 } 67173 67174 style.position = "absolute"; 67175 style.left = measureToString(node.x); 67176 style.top = measureToString(node.y); 67177 }, 67178 67179 rotate(node, style) { 67180 if (node.rotate) { 67181 if (!("transform" in style)) { 67182 style.transform = ""; 67183 } 67184 67185 style.transform += `rotate(-${node.rotate}deg)`; 67186 style.transformOrigin = "top left"; 67187 } 67188 }, 67189 67190 presence(node, style) { 67191 switch (node.presence) { 67192 case "invisible": 67193 style.visibility = "hidden"; 67194 break; 67195 67196 case "hidden": 67197 case "inactive": 67198 style.display = "none"; 67199 break; 67200 } 67201 }, 67202 67203 hAlign(node, style) { 67204 if (node[_xfa_object.$nodeName] === "para") { 67205 switch (node.hAlign) { 67206 case "justifyAll": 67207 style.textAlign = "justify-all"; 67208 break; 67209 67210 case "radix": 67211 style.textAlign = "left"; 67212 break; 67213 67214 default: 67215 style.textAlign = node.hAlign; 67216 } 67217 } else { 67218 switch (node.hAlign) { 67219 case "left": 67220 style.alignSelf = "start"; 67221 break; 67222 67223 case "center": 67224 style.alignSelf = "center"; 67225 break; 67226 67227 case "right": 67228 style.alignSelf = "end"; 67229 break; 67230 } 67231 } 67232 }, 67233 67234 margin(node, style) { 67235 if (node.margin) { 67236 style.margin = node.margin[_xfa_object.$toStyle]().margin; 67237 } 67238 } 67239 67240}; 67241 67242function setMinMaxDimensions(node, style) { 67243 const parent = node[_xfa_object.$getSubformParent](); 67244 67245 if (parent.layout === "position") { 67246 if (node.minW > 0) { 67247 style.minWidth = measureToString(node.minW); 67248 } 67249 67250 if (node.maxW > 0) { 67251 style.maxWidth = measureToString(node.maxW); 67252 } 67253 67254 if (node.minH > 0) { 67255 style.minHeight = measureToString(node.minH); 67256 } 67257 67258 if (node.maxH > 0) { 67259 style.maxHeight = measureToString(node.maxH); 67260 } 67261 } 67262} 67263 67264function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) { 67265 const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder); 67266 67267 if (typeof text === "string") { 67268 measure.addString(text); 67269 } else { 67270 text[_xfa_object.$pushGlyphs](measure); 67271 } 67272 67273 return measure.compute(width); 67274} 67275 67276function layoutNode(node, availableSpace) { 67277 let height = null; 67278 let width = null; 67279 let isBroken = false; 67280 67281 if ((!node.w || !node.h) && node.value) { 67282 let marginH = 0; 67283 let marginV = 0; 67284 67285 if (node.margin) { 67286 marginH = node.margin.leftInset + node.margin.rightInset; 67287 marginV = node.margin.topInset + node.margin.bottomInset; 67288 } 67289 67290 let lineHeight = null; 67291 let margin = null; 67292 67293 if (node.para) { 67294 margin = Object.create(null); 67295 lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight; 67296 margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove; 67297 margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow; 67298 margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft; 67299 margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight; 67300 } 67301 67302 let font = node.font; 67303 67304 if (!font) { 67305 const root = node[_xfa_object.$getTemplateRoot](); 67306 67307 let parent = node[_xfa_object.$getParent](); 67308 67309 while (parent && parent !== root) { 67310 if (parent.font) { 67311 font = parent.font; 67312 break; 67313 } 67314 67315 parent = parent[_xfa_object.$getParent](); 67316 } 67317 } 67318 67319 const maxWidth = (!node.w ? availableSpace.width : node.w) - marginH; 67320 const fontFinder = node[_xfa_object.$globalData].fontFinder; 67321 67322 if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") { 67323 const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth); 67324 width = res.width; 67325 height = res.height; 67326 isBroken = res.isBroken; 67327 } else { 67328 const text = node.value[_xfa_object.$text](); 67329 67330 if (text) { 67331 const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth); 67332 width = res.width; 67333 height = res.height; 67334 isBroken = res.isBroken; 67335 } 67336 } 67337 67338 if (width !== null && !node.w) { 67339 width += marginH; 67340 } 67341 67342 if (height !== null && !node.h) { 67343 height += marginV; 67344 } 67345 } 67346 67347 return { 67348 w: width, 67349 h: height, 67350 isBroken 67351 }; 67352} 67353 67354function computeBbox(node, html, availableSpace) { 67355 let bbox; 67356 67357 if (node.w !== "" && node.h !== "") { 67358 bbox = [node.x, node.y, node.w, node.h]; 67359 } else { 67360 if (!availableSpace) { 67361 return null; 67362 } 67363 67364 let width = node.w; 67365 67366 if (width === "") { 67367 if (node.maxW === 0) { 67368 const parent = node[_xfa_object.$getSubformParent](); 67369 67370 if (parent.layout === "position" && parent.w !== "") { 67371 width = 0; 67372 } else { 67373 width = node.minW; 67374 } 67375 } else { 67376 width = Math.min(node.maxW, availableSpace.width); 67377 } 67378 67379 html.attributes.style.width = measureToString(width); 67380 } 67381 67382 let height = node.h; 67383 67384 if (height === "") { 67385 if (node.maxH === 0) { 67386 const parent = node[_xfa_object.$getSubformParent](); 67387 67388 if (parent.layout === "position" && parent.h !== "") { 67389 height = 0; 67390 } else { 67391 height = node.minH; 67392 } 67393 } else { 67394 height = Math.min(node.maxH, availableSpace.height); 67395 } 67396 67397 html.attributes.style.height = measureToString(height); 67398 } 67399 67400 bbox = [node.x, node.y, width, height]; 67401 } 67402 67403 return bbox; 67404} 67405 67406function fixDimensions(node) { 67407 const parent = node[_xfa_object.$getSubformParent](); 67408 67409 if (parent.layout && parent.layout.includes("row")) { 67410 const extra = parent[_xfa_object.$extra]; 67411 const colSpan = node.colSpan; 67412 let width; 67413 67414 if (colSpan === -1) { 67415 width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0); 67416 } else { 67417 width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0); 67418 } 67419 67420 if (!isNaN(width)) { 67421 node.w = width; 67422 } 67423 } 67424 67425 if (parent.layout && parent.layout !== "position") { 67426 node.x = node.y = 0; 67427 } 67428 67429 if (node.layout === "table") { 67430 if (node.w === "" && Array.isArray(node.columnWidths)) { 67431 node.w = node.columnWidths.reduce((a, x) => a + x, 0); 67432 } 67433 } 67434} 67435 67436function layoutClass(node) { 67437 switch (node.layout) { 67438 case "position": 67439 return "xfaPosition"; 67440 67441 case "lr-tb": 67442 return "xfaLrTb"; 67443 67444 case "rl-row": 67445 return "xfaRlRow"; 67446 67447 case "rl-tb": 67448 return "xfaRlTb"; 67449 67450 case "row": 67451 return "xfaRow"; 67452 67453 case "table": 67454 return "xfaTable"; 67455 67456 case "tb": 67457 return "xfaTb"; 67458 67459 default: 67460 return "xfaPosition"; 67461 } 67462} 67463 67464function toStyle(node, ...names) { 67465 const style = Object.create(null); 67466 67467 for (const name of names) { 67468 const value = node[name]; 67469 67470 if (value === null) { 67471 continue; 67472 } 67473 67474 if (converters.hasOwnProperty(name)) { 67475 converters[name](node, style); 67476 continue; 67477 } 67478 67479 if (value instanceof _xfa_object.XFAObject) { 67480 const newStyle = value[_xfa_object.$toStyle](); 67481 67482 if (newStyle) { 67483 Object.assign(style, newStyle); 67484 } else { 67485 (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`); 67486 } 67487 } 67488 } 67489 67490 return style; 67491} 67492 67493function createWrapper(node, html) { 67494 const { 67495 attributes 67496 } = html; 67497 const { 67498 style 67499 } = attributes; 67500 const wrapper = { 67501 name: "div", 67502 attributes: { 67503 class: ["xfaWrapper"], 67504 style: Object.create(null) 67505 }, 67506 children: [] 67507 }; 67508 attributes.class.push("xfaWrapped"); 67509 67510 if (node.border) { 67511 const { 67512 widths, 67513 insets 67514 } = node.border[_xfa_object.$extra]; 67515 let width, height; 67516 let top = insets[0]; 67517 let left = insets[3]; 67518 const insetsH = insets[0] + insets[2]; 67519 const insetsW = insets[1] + insets[3]; 67520 67521 switch (node.border.hand) { 67522 case "even": 67523 top -= widths[0] / 2; 67524 left -= widths[3] / 2; 67525 width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
67526 height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`; 67527 break; 67528 67529 case "left": 67530 top -= widths[0]; 67531 left -= widths[3]; 67532 width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`; 67533 height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`; 67534 break; 67535 67536 case "right": 67537 width = insetsW ? `calc(100% - ${insetsW}px)` : "100%"; 67538 height = insetsH ? `calc(100% - ${insetsH}px)` : "100%"; 67539 break; 67540 } 67541 67542 const classNames = ["xfaBorder"]; 67543 67544 if (isPrintOnly(node.border)) { 67545 classNames.push("xfaPrintOnly"); 67546 } 67547 67548 const border = { 67549 name: "div", 67550 attributes: { 67551 class: classNames, 67552 style: { 67553 top: `${top}px`, 67554 left: `${left}px`, 67555 width, 67556 height 67557 } 67558 }, 67559 children: [] 67560 }; 67561 67562 for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) { 67563 if (style[key] !== undefined) { 67564 border.attributes.style[key] = style[key]; 67565 delete style[key]; 67566 } 67567 } 67568 67569 wrapper.children.push(border, html); 67570 } else { 67571 wrapper.children.push(html); 67572 } 67573 67574 for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) { 67575 if (style[key] !== undefined) { 67576 wrapper.attributes.style[key] = style[key]; 67577 delete style[key]; 67578 } 67579 } 67580 67581 if (style.position === "absolute") { 67582 wrapper.attributes.style.position = "absolute"; 67583 } else { 67584 wrapper.attributes.style.position = "relative"; 67585 } 67586 67587 delete style.position; 67588 67589 if (style.alignSelf) { 67590 wrapper.attributes.style.alignSelf = style.alignSelf; 67591 delete style.alignSelf; 67592 } 67593 67594 return wrapper; 67595} 67596 67597function fixTextIndent(styles) { 67598 const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px"); 67599 67600 if (indent >= 0) { 67601 return; 67602 } 67603 67604 const align = styles.textAlign === "right" ? "right" : "left"; 67605 const name = "padding" + (align === "left" ? "Left" : "Right"); 67606 const padding = (0, _utils.getMeasurement)(styles[name], "0px"); 67607 styles[name] = `${padding - indent}px`; 67608} 67609 67610function setAccess(node, classNames) { 67611 switch (node.access) { 67612 case "nonInteractive": 67613 classNames.push("xfaNonInteractive"); 67614 break; 67615 67616 case "readOnly": 67617 classNames.push("xfaReadOnly"); 67618 break; 67619 67620 case "protected": 67621 classNames.push("xfaDisabled"); 67622 break; 67623 } 67624} 67625 67626function isPrintOnly(node) { 67627 return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print"; 67628} 67629 67630function getCurrentPara(node) { 67631 const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack; 67632 67633 return stack.length ? stack[stack.length - 1] : null; 67634} 67635 67636function setPara(node, nodeStyle, value) { 67637 if (value.attributes.class && value.attributes.class.includes("xfaRich")) { 67638 if (nodeStyle) { 67639 if (node.h === "") { 67640 nodeStyle.height = "auto"; 67641 } 67642 67643 if (node.w === "") { 67644 nodeStyle.width = "auto"; 67645 } 67646 } 67647 67648 const para = getCurrentPara(node); 67649 67650 if (para) { 67651 const valueStyle = value.attributes.style; 67652 valueStyle.display = "flex"; 67653 valueStyle.flexDirection = "column"; 67654 67655 switch (para.vAlign) { 67656 case "top": 67657 valueStyle.justifyContent = "start"; 67658 break; 67659 67660 case "bottom": 67661 valueStyle.justifyContent = "end"; 67662 break; 67663 67664 case "middle": 67665 valueStyle.justifyContent = "center"; 67666 break; 67667 } 67668 67669 const paraStyle = para[_xfa_object.$toStyle](); 67670 67671 for (const [key, val] of Object.entries(paraStyle)) { 67672 if (!(key in valueStyle)) { 67673 valueStyle[key] = val; 67674 } 67675 } 67676 } 67677 } 67678} 67679 67680function setFontFamily(xfaFont, node, fontFinder, style) { 67681 if (!fontFinder) { 67682 delete style.fontFamily; 67683 return; 67684 } 67685 67686 const name = (0, _utils.stripQuotes)(xfaFont.typeface); 67687 style.fontFamily = `"${name}"`; 67688 const typeface = fontFinder.find(name); 67689 67690 if (typeface) { 67691 const { 67692 fontFamily 67693 } = typeface.regular.cssFontInfo; 67694 67695 if (fontFamily !== name) { 67696 style.fontFamily = `"${fontFamily}"`; 67697 } 67698 67699 const para = getCurrentPara(node); 67700 67701 if (para && para.lineHeight !== "") { 67702 return; 67703 } 67704 67705 if (style.lineHeight) { 67706 return; 67707 } 67708 67709 const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface); 67710 67711 if (pdfFont) { 67712 style.lineHeight = Math.max(1.2, pdfFont.lineHeight); 67713 } 67714 } 67715} 67716 67717function fixURL(str) { 67718 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, { 67719 addDefaultProtocol: true, 67720 tryConvertEncoding: true 67721 }); 67722 return absoluteUrl ? absoluteUrl.href : null; 67723} 67724 67725/***/ }), 67726/* 83 */ 67727/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 67728 67729 67730 67731Object.defineProperty(exports, "__esModule", ({ 67732 value: true 67733})); 67734exports.FontFinder = void 0; 67735exports.getMetrics = getMetrics;
67736exports.selectFont = selectFont; 67737 67738var _xfa_object = __w_pdfjs_require__(75); 67739 67740var _utils = __w_pdfjs_require__(76); 67741 67742var _util = __w_pdfjs_require__(2); 67743 67744class FontFinder { 67745 constructor(pdfFonts) { 67746 this.fonts = new Map(); 67747 this.cache = new Map(); 67748 this.warned = new Set(); 67749 this.defaultFont = null; 67750 this.add(pdfFonts); 67751 } 67752 67753 add(pdfFonts, reallyMissingFonts = null) { 67754 for (const pdfFont of pdfFonts) { 67755 this.addPdfFont(pdfFont); 67756 } 67757 67758 for (const pdfFont of this.fonts.values()) { 67759 if (!pdfFont.regular) { 67760 pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic; 67761 } 67762 } 67763 67764 if (!reallyMissingFonts || reallyMissingFonts.size === 0) { 67765 return; 67766 } 67767 67768 const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA"); 67769 67770 for (const missing of reallyMissingFonts) { 67771 this.fonts.set(missing, myriad); 67772 } 67773 } 67774 67775 addPdfFont(pdfFont) { 67776 const cssFontInfo = pdfFont.cssFontInfo; 67777 const name = cssFontInfo.fontFamily; 67778 let font = this.fonts.get(name); 67779 67780 if (!font) { 67781 font = Object.create(null); 67782 this.fonts.set(name, font); 67783 67784 if (!this.defaultFont) { 67785 this.defaultFont = font; 67786 } 67787 } 67788 67789 let property = ""; 67790 const fontWeight = parseFloat(cssFontInfo.fontWeight); 67791 67792 if (parseFloat(cssFontInfo.italicAngle) !== 0) { 67793 property = fontWeight >= 700 ? "bolditalic" : "italic"; 67794 } else if (fontWeight >= 700) { 67795 property = "bold"; 67796 } 67797 67798 if (!property) { 67799 if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) { 67800 property = "bold"; 67801 } 67802 67803 if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) { 67804 property += "italic"; 67805 } 67806 } 67807 67808 if (!property) { 67809 property = "regular"; 67810 } 67811 67812 font[property] = pdfFont; 67813 } 67814 67815 getDefault() { 67816 return this.defaultFont; 67817 } 67818 67819 find(fontName, mustWarn = true) { 67820 let font = this.fonts.get(fontName) || this.cache.get(fontName); 67821 67822 if (font) { 67823 return font; 67824 } 67825 67826 const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi; 67827 let name = fontName.replace(pattern, ""); 67828 font = this.fonts.get(name); 67829 67830 if (font) { 67831 this.cache.set(fontName, font); 67832 return font; 67833 } 67834 67835 name = name.toLowerCase(); 67836 const maybe = []; 67837 67838 for (const [family, pdfFont] of this.fonts.entries()) { 67839 if (family.replace(pattern, "").toLowerCase().startsWith(name)) { 67840 maybe.push(pdfFont); 67841 } 67842 } 67843 67844 if (maybe.length === 0) { 67845 for (const [, pdfFont] of this.fonts.entries()) { 67846 if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) { 67847 maybe.push(pdfFont); 67848 } 67849 } 67850 } 67851 67852 if (maybe.length === 0) { 67853 name = name.replace(/psmt|mt/gi, ""); 67854 67855 for (const [family, pdfFont] of this.fonts.entries()) { 67856 if (family.replace(pattern, "").toLowerCase().startsWith(name)) { 67857 maybe.push(pdfFont); 67858 } 67859 } 67860 } 67861 67862 if (maybe.length === 0) { 67863 for (const pdfFont of this.fonts.values()) { 67864 if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) { 67865 maybe.push(pdfFont); 67866 } 67867 } 67868 } 67869 67870 if (maybe.length >= 1) { 67871 if (maybe.length !== 1 && mustWarn) { 67872 (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`); 67873 } 67874 67875 this.cache.set(fontName, maybe[0]); 67876 return maybe[0]; 67877 } 67878 67879 if (mustWarn && !this.warned.has(fontName)) { 67880 this.warned.add(fontName); 67881 (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`); 67882 } 67883 67884 return null; 67885 } 67886 67887} 67888 67889exports.FontFinder = FontFinder; 67890 67891function selectFont(xfaFont, typeface) { 67892 if (xfaFont.posture === "italic") { 67893 if (xfaFont.weight === "bold") { 67894 return typeface.bolditalic; 67895 } 67896 67897 return typeface.italic; 67898 } else if (xfaFont.weight === "bold") { 67899 return typeface.bold; 67900 } 67901 67902 return typeface.regular; 67903} 67904 67905function getMetrics(xfaFont, real = false) { 67906 let pdfFont = null; 67907 67908 if (xfaFont) { 67909 const name = (0, _utils.stripQuotes)(xfaFont.typeface); 67910 67911 const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name); 67912 67913 pdfFont = selectFont(xfaFont, typeface); 67914 } 67915 67916 if (!pdfFont) { 67917 return { 67918 lineHeight: 12, 67919 lineGap: 2, 67920 lineNoGap: 10 67921 }; 67922 } 67923 67924 const size = xfaFont.size || 10; 67925 const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2; 67926 const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap; 67927 return { 67928 lineHeight: lineHeight * size, 67929 lineGap: lineGap * size, 67930 lineNoGap: Math.max(1, lineHeight - lineGap) * size 67931 }; 67932} 67933 67934/***/ }), 67935/* 84 */ 67936/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 67937 67938 67939 67940Object.defineProperty(exports, "__esModule", ({ 67941 value: true 67942})); 67943exports.TextMeasure = void 0; 67944 67945var _fonts = __w_pdfjs_require__(83); 67946 67947const WIDTH_FACTOR = 1.02; 67948 67949class FontInfo { 67950 constructor(xfaFont, margin, lineHeight, fontFinder) { 67951 this.lineHeight = lineHeight; 67952 this.paraMargin = margin || { 67953 top: 0, 67954 bottom: 0, 67955 left: 0, 67956 right: 0 67957 }; 67958 67959 if (!xfaFont) {
vendor: 4,564 bytes, lines 67960-68126
67960 [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); 67961 return; 67962 } 67963 67964 this.xfaFont = { 67965 typeface: xfaFont.typeface, 67966 posture: xfaFont.posture, 67967 weight: xfaFont.weight, 67968 size: xfaFont.size, 67969 letterSpacing: xfaFont.letterSpacing 67970 }; 67971 const typeface = fontFinder.find(xfaFont.typeface); 67972 67973 if (!typeface) { 67974 [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); 67975 return; 67976 } 67977 67978 this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface); 67979 67980 if (!this.pdfFont) { 67981 [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); 67982 } 67983 } 67984 67985 defaultFont(fontFinder) { 67986 const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault(); 67987 67988 if (font && font.regular) { 67989 const pdfFont = font.regular; 67990 const info = pdfFont.cssFontInfo; 67991 const xfaFont = { 67992 typeface: info.fontFamily, 67993 posture: "normal", 67994 weight: "normal", 67995 size: 10, 67996 letterSpacing: 0 67997 }; 67998 return [pdfFont, xfaFont]; 67999 } 68000 68001 const xfaFont = { 68002 typeface: "Courier", 68003 posture: "normal", 68004 weight: "normal", 68005 size: 10, 68006 letterSpacing: 0 68007 }; 68008 return [null, xfaFont]; 68009 } 68010 68011} 68012 68013class FontSelector { 68014 constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) { 68015 this.fontFinder = fontFinder; 68016 this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)]; 68017 } 68018 68019 pushData(xfaFont, margin, lineHeight) { 68020 const lastFont = this.stack[this.stack.length - 1]; 68021 68022 for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) { 68023 if (!xfaFont[name]) { 68024 xfaFont[name] = lastFont.xfaFont[name]; 68025 } 68026 } 68027 68028 for (const name of ["top", "bottom", "left", "right"]) { 68029 if (isNaN(margin[name])) { 68030 margin[name] = lastFont.paraMargin[name]; 68031 } 68032 } 68033 68034 const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder); 68035 68036 if (!fontInfo.pdfFont) { 68037 fontInfo.pdfFont = lastFont.pdfFont; 68038 } 68039 68040 this.stack.push(fontInfo); 68041 } 68042 68043 popFont() { 68044 this.stack.pop(); 68045 } 68046 68047 topFont() { 68048 return this.stack[this.stack.length - 1]; 68049 } 68050 68051} 68052 68053class TextMeasure { 68054 constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) { 68055 this.glyphs = []; 68056 this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts); 68057 this.extraHeight = 0; 68058 } 68059 68060 pushData(xfaFont, margin, lineHeight) { 68061 this.fontSelector.pushData(xfaFont, margin, lineHeight); 68062 } 68063 68064 popFont(xfaFont) { 68065 return this.fontSelector.popFont(); 68066 } 68067 68068 addPara() { 68069 const lastFont = this.fontSelector.topFont(); 68070 this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom; 68071 } 68072 68073 addString(str) { 68074 if (!str) { 68075 return; 68076 } 68077 68078 const lastFont = this.fontSelector.topFont(); 68079 const fontSize = lastFont.xfaFont.size; 68080 68081 if (lastFont.pdfFont) { 68082 const letterSpacing = lastFont.xfaFont.letterSpacing; 68083 const pdfFont = lastFont.pdfFont; 68084 const fontLineHeight = pdfFont.lineHeight || 1.2; 68085 const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize; 68086 const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap; 68087 const noGap = fontLineHeight - lineGap; 68088 const firstLineHeight = Math.max(1, noGap) * fontSize; 68089 const scale = fontSize / 1000; 68090 const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width; 68091 68092 for (const line of str.split(/[\u2029\n]/)) { 68093 const encodedLine = pdfFont.encodeString(line).join(""); 68094 const glyphs = pdfFont.charsToGlyphs(encodedLine); 68095 68096 for (const glyph of glyphs) { 68097 const width = glyph.width || fallbackWidth; 68098 this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]); 68099 } 68100 68101 this.glyphs.push([0, 0, 0, "\n", true]); 68102 } 68103 68104 this.glyphs.pop(); 68105 return; 68106 } 68107 68108 for (const line of str.split(/[\u2029\n]/)) { 68109 for (const char of line.split("")) { 68110 this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]); 68111 } 68112 68113 this.glyphs.push([0, 0, 0, "\n", true]); 68114 } 68115 68116 this.glyphs.pop(); 68117 } 68118 68119 compute(maxWidth) { 68120 let lastSpacePos = -1, 68121 lastSpaceWidth = 0, 68122 width = 0, 68123 height = 0, 68124 currentLineWidth = 0, 68125 currentLineHeight = 0; 68126 let isBroken = false;
68127 let isFirstLine = true; 68128 68129 for (let i = 0, ii = this.glyphs.length; i < ii; i++) { 68130 const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i]; 68131 const isSpace = char === " "; 68132 const glyphHeight = isFirstLine ? firstLineHeight : lineHeight; 68133 68134 if (isEOL) { 68135 width = Math.max(width, currentLineWidth); 68136 currentLineWidth = 0; 68137 height += currentLineHeight; 68138 currentLineHeight = glyphHeight; 68139 lastSpacePos = -1; 68140 lastSpaceWidth = 0; 68141 isFirstLine = false; 68142 continue; 68143 } 68144 68145 if (isSpace) { 68146 if (currentLineWidth + glyphWidth > maxWidth) { 68147 width = Math.max(width, currentLineWidth); 68148 currentLineWidth = 0; 68149 height += currentLineHeight; 68150 currentLineHeight = glyphHeight; 68151 lastSpacePos = -1; 68152 lastSpaceWidth = 0; 68153 isBroken = true; 68154 isFirstLine = false; 68155 } else { 68156 currentLineHeight = Math.max(glyphHeight, currentLineHeight); 68157 lastSpaceWidth = currentLineWidth; 68158 currentLineWidth += glyphWidth; 68159 lastSpacePos = i; 68160 } 68161 68162 continue; 68163 } 68164 68165 if (currentLineWidth + glyphWidth > maxWidth) { 68166 height += currentLineHeight; 68167 currentLineHeight = glyphHeight; 68168 68169 if (lastSpacePos !== -1) { 68170 i = lastSpacePos; 68171 width = Math.max(width, lastSpaceWidth); 68172 currentLineWidth = 0; 68173 lastSpacePos = -1; 68174 lastSpaceWidth = 0; 68175 } else { 68176 width = Math.max(width, currentLineWidth); 68177 currentLineWidth = glyphWidth; 68178 } 68179 68180 isBroken = true; 68181 isFirstLine = false; 68182 continue; 68183 } 68184 68185 currentLineWidth += glyphWidth; 68186 currentLineHeight = Math.max(glyphHeight, currentLineHeight); 68187 } 68188 68189 width = Math.max(width, currentLineWidth); 68190 height += currentLineHeight + this.extraHeight; 68191 return { 68192 width: WIDTH_FACTOR * width, 68193 height, 68194 isBroken 68195 }; 68196 } 68197 68198} 68199 68200exports.TextMeasure = TextMeasure; 68201 68202/***/ }), 68203/* 85 */ 68204/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 68205 68206 68207 68208Object.defineProperty(exports, "__esModule", ({ 68209 value: true 68210})); 68211exports.DataHandler = void 0; 68212 68213var _xfa_object = __w_pdfjs_require__(75); 68214 68215class DataHandler { 68216 constructor(root, data) { 68217 this.data = data; 68218 this.dataset = root.datasets || null; 68219 } 68220 68221 serialize(storage) { 68222 const stack = [[-1, this.data[_xfa_object.$getChildren]()]]; 68223 68224 while (stack.length > 0) { 68225 const last = stack[stack.length - 1]; 68226 const [i, children] = last; 68227 68228 if (i + 1 === children.length) { 68229 stack.pop(); 68230 continue; 68231 } 68232 68233 const child = children[++last[0]]; 68234 const storageEntry = storage.get(child[_xfa_object.$uid]); 68235 68236 if (storageEntry) { 68237 child[_xfa_object.$setValue](storageEntry); 68238 } else { 68239 const attributes = child[_xfa_object.$getAttributes](); 68240 68241 for (const value of attributes.values()) { 68242 const entry = storage.get(value[_xfa_object.$uid]); 68243 68244 if (entry) { 68245 value[_xfa_object.$setValue](entry); 68246 68247 break; 68248 } 68249 } 68250 } 68251 68252 const nodes = child[_xfa_object.$getChildren](); 68253 68254 if (nodes.length > 0) { 68255 stack.push([-1, nodes]); 68256 } 68257 } 68258 68259 const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`]; 68260 68261 if (this.dataset) { 68262 for (const child of this.dataset[_xfa_object.$getChildren]()) { 68263 if (child[_xfa_object.$nodeName] !== "data") { 68264 child[_xfa_object.$toString](buf); 68265 } 68266 } 68267 } 68268 68269 this.data[_xfa_object.$toString](buf); 68270 68271 buf.push("</xfa:datasets>"); 68272 return buf.join(""); 68273 } 68274 68275} 68276 68277exports.DataHandler = DataHandler; 68278 68279/***/ }), 68280/* 86 */ 68281/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 68282 68283 68284 68285Object.defineProperty(exports, "__esModule", ({ 68286 value: true 68287})); 68288exports.XFAParser = void 0; 68289 68290var _xfa_object = __w_pdfjs_require__(75); 68291 68292var _xml_parser = __w_pdfjs_require__(68); 68293 68294var _builder = __w_pdfjs_require__(87); 68295 68296var _util = __w_pdfjs_require__(2); 68297 68298class XFAParser extends _xml_parser.XMLParserBase {
68299 constructor(rootNameSpace = null, richText = false) { 68300 super(); 68301 this._builder = new _builder.Builder(rootNameSpace); 68302 this._stack = []; 68303 this._globalData = { 68304 usedTypefaces: new Set() 68305 }; 68306 this._ids = new Map(); 68307 this._current = this._builder.buildRoot(this._ids); 68308 this._errorCode = _xml_parser.XMLParserErrorCode.NoError; 68309 this._whiteRegex = /^\s+$/; 68310 this._nbsps = /\xa0+/g; 68311 this._richText = richText; 68312 } 68313 68314 parse(data) { 68315 this.parseXml(data); 68316 68317 if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) { 68318 return undefined; 68319 } 68320 68321 this._current[_xfa_object.$finalize](); 68322 68323 return this._current.element; 68324 } 68325 68326 onText(text) { 68327 text = text.replace(this._nbsps, match => match.slice(1) + " "); 68328 68329 if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) { 68330 this._current[_xfa_object.$onText](text, this._richText); 68331 68332 return; 68333 } 68334 68335 if (this._whiteRegex.test(text)) { 68336 return; 68337 } 68338 68339 this._current[_xfa_object.$onText](text.trim()); 68340 } 68341 68342 onCdata(text) { 68343 this._current[_xfa_object.$onText](text); 68344 } 68345 68346 _mkAttributes(attributes, tagName) { 68347 let namespace = null; 68348 let prefixes = null; 68349 const attributeObj = Object.create({}); 68350 68351 for (const { 68352 name, 68353 value 68354 } of attributes) { 68355 if (name === "xmlns") { 68356 if (!namespace) { 68357 namespace = value; 68358 } else { 68359 (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`); 68360 } 68361 } else if (name.startsWith("xmlns:")) { 68362 const prefix = name.substring("xmlns:".length); 68363 68364 if (!prefixes) { 68365 prefixes = []; 68366 } 68367 68368 prefixes.push({ 68369 prefix, 68370 value 68371 }); 68372 } else { 68373 const i = name.indexOf(":"); 68374 68375 if (i === -1) { 68376 attributeObj[name] = value; 68377 } else { 68378 let nsAttrs = attributeObj[_xfa_object.$nsAttributes]; 68379 68380 if (!nsAttrs) { 68381 nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null); 68382 } 68383 68384 const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)]; 68385 let attrs = nsAttrs[ns]; 68386 68387 if (!attrs) { 68388 attrs = nsAttrs[ns] = Object.create(null); 68389 } 68390 68391 attrs[attrName] = value; 68392 } 68393 } 68394 } 68395 68396 return [namespace, prefixes, attributeObj]; 68397 } 68398 68399 _getNameAndPrefix(name, nsAgnostic) { 68400 const i = name.indexOf(":"); 68401 68402 if (i === -1) { 68403 return [name, null]; 68404 } 68405 68406 return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)]; 68407 } 68408 68409 onBeginElement(tagName, attributes, isEmpty) { 68410 const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName); 68411 68412 const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic()); 68413 68414 const node = this._builder.build({ 68415 nsPrefix, 68416 name, 68417 attributes: attributesObj, 68418 namespace, 68419 prefixes 68420 }); 68421 68422 node[_xfa_object.$globalData] = this._globalData; 68423 68424 if (isEmpty) { 68425 node[_xfa_object.$finalize](); 68426 68427 if (this._current[_xfa_object.$onChild](node)) { 68428 node[_xfa_object.$setId](this._ids); 68429 } 68430 68431 node[_xfa_object.$clean](this._builder); 68432 68433 return; 68434 } 68435 68436 this._stack.push(this._current); 68437 68438 this._current = node; 68439 } 68440 68441 onEndElement(name) { 68442 const node = this._current; 68443 68444 if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") { 68445 const parser = new XFAParser(); 68446 parser._globalData = this._globalData; 68447 const root = parser.parse(node[_xfa_object.$content]); 68448 node[_xfa_object.$content] = null; 68449 68450 node[_xfa_object.$onChild](root); 68451 } 68452 68453 node[_xfa_object.$finalize](); 68454 68455 this._current = this._stack.pop(); 68456 68457 if (this._current[_xfa_object.$onChild](node)) { 68458 node[_xfa_object.$setId](this._ids); 68459 } 68460 68461 node[_xfa_object.$clean](this._builder); 68462 } 68463 68464 onError(code) { 68465 this._errorCode = code; 68466 } 68467 68468} 68469 68470exports.XFAParser = XFAParser; 68471 68472/***/ }), 68473/* 87 */ 68474/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 68475 68476 68477 68478Object.defineProperty(exports, "__esModule", ({ 68479 value: true 68480})); 68481exports.Builder = void 0; 68482 68483var _namespaces = __w_pdfjs_require__(77); 68484 68485var _xfa_object = __w_pdfjs_require__(75); 68486 68487var _setup = __w_pdfjs_require__(88); 68488 68489var _template = __w_pdfjs_require__(80); 68490 68491var _unknown = __w_pdfjs_require__(97); 68492 68493var _util = __w_pdfjs_require__(2); 68494 68495class Root extends _xfa_object.XFAObject { 68496 constructor(ids) { 68497 super(-1, "root", Object.create(null)); 68498 this.element = null; 68499 this[_xfa_object.$ids] = ids; 68500 } 68501 68502 [_xfa_object.$onChild](child) { 68503 this.element = child; 68504 return true; 68505 } 68506 68507 [_xfa_object.$finalize]() { 68508 super[_xfa_object.$finalize](); 68509 68510 if (this.element.template instanceof _template.Template) { 68511 this[_xfa_object.$ids].set(_xfa_object.$root, this.element); 68512 68513 this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]); 68514 68515 this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids]; 68516 } 68517 } 68518 68519} 68520 68521class Empty extends _xfa_object.XFAObject { 68522 constructor() { 68523 super(-1, "", Object.create(null)); 68524 } 68525 68526 [_xfa_object.$onChild](_) { 68527 return false;
68528 } 68529 68530} 68531 68532class Builder { 68533 constructor(rootNameSpace = null) { 68534 this._namespaceStack = []; 68535 this._nsAgnosticLevel = 0; 68536 this._namespacePrefixes = new Map(); 68537 this._namespaces = new Map(); 68538 this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({ 68539 id 68540 }) => id)); 68541 this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId); 68542 } 68543 68544 buildRoot(ids) { 68545 return new Root(ids); 68546 } 68547 68548 build({ 68549 nsPrefix, 68550 name, 68551 attributes, 68552 namespace, 68553 prefixes 68554 }) { 68555 const hasNamespaceDef = namespace !== null; 68556 68557 if (hasNamespaceDef) { 68558 this._namespaceStack.push(this._currentNamespace); 68559 68560 this._currentNamespace = this._searchNamespace(namespace); 68561 } 68562 68563 if (prefixes) { 68564 this._addNamespacePrefix(prefixes); 68565 } 68566 68567 if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) { 68568 const dataTemplate = _setup.NamespaceSetUp.datasets; 68569 const nsAttrs = attributes[_xfa_object.$nsAttributes]; 68570 let xfaAttrs = null; 68571 68572 for (const [ns, attrs] of Object.entries(nsAttrs)) { 68573 const nsToUse = this._getNamespaceToUse(ns); 68574 68575 if (nsToUse === dataTemplate) { 68576 xfaAttrs = { 68577 xfa: attrs 68578 }; 68579 break; 68580 } 68581 } 68582 68583 if (xfaAttrs) { 68584 attributes[_xfa_object.$nsAttributes] = xfaAttrs; 68585 } else { 68586 delete attributes[_xfa_object.$nsAttributes]; 68587 } 68588 } 68589 68590 const namespaceToUse = this._getNamespaceToUse(nsPrefix); 68591 68592 const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty(); 68593 68594 if (node[_xfa_object.$isNsAgnostic]()) { 68595 this._nsAgnosticLevel++; 68596 } 68597 68598 if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) { 68599 node[_xfa_object.$cleanup] = { 68600 hasNamespace: hasNamespaceDef, 68601 prefixes, 68602 nsAgnostic: node[_xfa_object.$isNsAgnostic]() 68603 }; 68604 } 68605 68606 return node; 68607 } 68608 68609 isNsAgnostic() { 68610 return this._nsAgnosticLevel > 0; 68611 } 68612 68613 _searchNamespace(nsName) { 68614 let ns = this._namespaces.get(nsName); 68615 68616 if (ns) { 68617 return ns; 68618 } 68619 68620 for (const [name, { 68621 check 68622 }] of Object.entries(_namespaces.NamespaceIds)) { 68623 if (check(nsName)) { 68624 ns = _setup.NamespaceSetUp[name]; 68625 68626 if (ns) { 68627 this._namespaces.set(nsName, ns); 68628 68629 return ns; 68630 } 68631 68632 break; 68633 } 68634 } 68635 68636 ns = new _unknown.UnknownNamespace(++this._nextNsId); 68637 68638 this._namespaces.set(nsName, ns); 68639 68640 return ns; 68641 } 68642 68643 _addNamespacePrefix(prefixes) { 68644 for (const { 68645 prefix, 68646 value 68647 } of prefixes) { 68648 const namespace = this._searchNamespace(value); 68649 68650 let prefixStack = this._namespacePrefixes.get(prefix); 68651 68652 if (!prefixStack) { 68653 prefixStack = []; 68654 68655 this._namespacePrefixes.set(prefix, prefixStack); 68656 } 68657 68658 prefixStack.push(namespace); 68659 } 68660 } 68661 68662 _getNamespaceToUse(prefix) { 68663 if (!prefix) { 68664 return this._currentNamespace; 68665 } 68666 68667 const prefixStack = this._namespacePrefixes.get(prefix); 68668 68669 if (prefixStack && prefixStack.length > 0) { 68670 return prefixStack[prefixStack.length - 1]; 68671 } 68672 68673 (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`); 68674 return null; 68675 } 68676 68677 clean(data) { 68678 const { 68679 hasNamespace, 68680 prefixes, 68681 nsAgnostic 68682 } = data; 68683 68684 if (hasNamespace) { 68685 this._currentNamespace = this._namespaceStack.pop(); 68686 } 68687 68688 if (prefixes) { 68689 prefixes.forEach(({ 68690 prefix 68691 }) => { 68692 this._namespacePrefixes.get(prefix).pop(); 68693 }); 68694 } 68695 68696 if (nsAgnostic) { 68697 this._nsAgnosticLevel--; 68698 } 68699 } 68700 68701} 68702 68703exports.Builder = Builder; 68704 68705/***/ }), 68706/* 88 */ 68707/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 68708 68709 68710 68711Object.defineProperty(exports, "__esModule", ({ 68712 value: true 68713})); 68714exports.NamespaceSetUp = void 0; 68715 68716var _config = __w_pdfjs_require__(89); 68717 68718var _connection_set = __w_pdfjs_require__(90); 68719 68720var _datasets = __w_pdfjs_require__(91); 68721 68722var _locale_set = __w_pdfjs_require__(92); 68723 68724var _signature = __w_pdfjs_require__(93); 68725 68726var _stylesheet = __w_pdfjs_require__(94); 68727 68728var _template = __w_pdfjs_require__(80); 68729 68730var _xdp = __w_pdfjs_require__(95); 68731 68732var _xhtml = __w_pdfjs_require__(96); 68733 68734const NamespaceSetUp = { 68735 config: _config.ConfigNamespace, 68736 connection: _connection_set.ConnectionSetNamespace, 68737 datasets: _datasets.DatasetsNamespace,
68738 localeSet: _locale_set.LocaleSetNamespace, 68739 signature: _signature.SignatureNamespace, 68740 stylesheet: _stylesheet.StylesheetNamespace, 68741 template: _template.TemplateNamespace, 68742 xdp: _xdp.XdpNamespace, 68743 xhtml: _xhtml.XhtmlNamespace 68744}; 68745exports.NamespaceSetUp = NamespaceSetUp; 68746 68747/***/ }), 68748/* 89 */ 68749/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 68750 68751 68752 68753Object.defineProperty(exports, "__esModule", ({ 68754 value: true 68755})); 68756exports.ConfigNamespace = void 0; 68757 68758var _namespaces = __w_pdfjs_require__(77); 68759 68760var _xfa_object = __w_pdfjs_require__(75); 68761 68762var _utils = __w_pdfjs_require__(76); 68763 68764var _util = __w_pdfjs_require__(2); 68765 68766const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id; 68767 68768class Acrobat extends _xfa_object.XFAObject { 68769 constructor(attributes) { 68770 super(CONFIG_NS_ID, "acrobat", true); 68771 this.acrobat7 = null; 68772 this.autoSave = null; 68773 this.common = null; 68774 this.validate = null; 68775 this.validateApprovalSignatures = null; 68776 this.submitUrl = new _xfa_object.XFAObjectArray(); 68777 } 68778 68779} 68780 68781class Acrobat7 extends _xfa_object.XFAObject { 68782 constructor(attributes) { 68783 super(CONFIG_NS_ID, "acrobat7", true); 68784 this.dynamicRender = null; 68785 } 68786 68787} 68788 68789class ADBE_JSConsole extends _xfa_object.OptionObject { 68790 constructor(attributes) { 68791 super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]); 68792 } 68793 68794} 68795 68796class ADBE_JSDebugger extends _xfa_object.OptionObject { 68797 constructor(attributes) { 68798 super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]); 68799 } 68800 68801} 68802 68803class AddSilentPrint extends _xfa_object.Option01 { 68804 constructor(attributes) { 68805 super(CONFIG_NS_ID, "addSilentPrint"); 68806 } 68807 68808} 68809 68810class AddViewerPreferences extends _xfa_object.Option01 { 68811 constructor(attributes) { 68812 super(CONFIG_NS_ID, "addViewerPreferences"); 68813 } 68814 68815} 68816 68817class AdjustData extends _xfa_object.Option10 { 68818 constructor(attributes) { 68819 super(CONFIG_NS_ID, "adjustData"); 68820 } 68821 68822} 68823 68824class AdobeExtensionLevel extends _xfa_object.IntegerObject { 68825 constructor(attributes) { 68826 super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8); 68827 } 68828 68829} 68830 68831class Agent extends _xfa_object.XFAObject { 68832 constructor(attributes) { 68833 super(CONFIG_NS_ID, "agent", true); 68834 this.name = attributes.name ? attributes.name.trim() : ""; 68835 this.common = new _xfa_object.XFAObjectArray(); 68836 } 68837 68838} 68839 68840class AlwaysEmbed extends _xfa_object.ContentObject { 68841 constructor(attributes) { 68842 super(CONFIG_NS_ID, "alwaysEmbed"); 68843 } 68844 68845} 68846 68847class Amd extends _xfa_object.StringObject { 68848 constructor(attributes) { 68849 super(CONFIG_NS_ID, "amd"); 68850 } 68851 68852} 68853 68854class Area extends _xfa_object.XFAObject { 68855 constructor(attributes) { 68856 super(CONFIG_NS_ID, "area"); 68857 this.level = (0, _utils.getInteger)({ 68858 data: attributes.level, 68859 defaultValue: 0, 68860 validate: n => n >= 1 && n <= 3 68861 }); 68862 this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]); 68863 } 68864 68865} 68866 68867class Attributes extends _xfa_object.OptionObject { 68868 constructor(attributes) { 68869 super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]); 68870 } 68871 68872} 68873 68874class AutoSave extends _xfa_object.OptionObject { 68875 constructor(attributes) { 68876 super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]); 68877 } 68878 68879} 68880 68881class Base extends _xfa_object.StringObject { 68882 constructor(attributes) { 68883 super(CONFIG_NS_ID, "base"); 68884 } 68885 68886} 68887 68888class BatchOutput extends _xfa_object.XFAObject { 68889 constructor(attributes) { 68890 super(CONFIG_NS_ID, "batchOutput"); 68891 this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]); 68892 } 68893 68894} 68895 68896class BehaviorOverride extends _xfa_object.ContentObject { 68897 constructor(attributes) { 68898 super(CONFIG_NS_ID, "behaviorOverride"); 68899 } 68900 68901 [_xfa_object.$finalize]() { 68902 this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2))); 68903 } 68904 68905} 68906 68907class Cache extends _xfa_object.XFAObject { 68908 constructor(attributes) { 68909 super(CONFIG_NS_ID, "cache", true); 68910 this.templateCache = null; 68911 } 68912 68913} 68914 68915class Change extends _xfa_object.Option01 { 68916 constructor(attributes) { 68917 super(CONFIG_NS_ID, "change"); 68918 } 68919 68920} 68921 68922class Common extends _xfa_object.XFAObject { 68923 constructor(attributes) { 68924 super(CONFIG_NS_ID, "common", true); 68925 this.data = null; 68926 this.locale = null; 68927 this.localeSet = null; 68928 this.messaging = null; 68929 this.suppressBanner = null; 68930 this.template = null; 68931 this.validationMessaging = null; 68932 this.versionControl = null; 68933 this.log = new _xfa_object.XFAObjectArray(); 68934 } 68935 68936} 68937 68938class Compress extends _xfa_object.XFAObject { 68939 constructor(attributes) { 68940 super(CONFIG_NS_ID, "compress"); 68941 this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]); 68942 } 68943 68944} 68945 68946class CompressLogicalStructure extends _xfa_object.Option01 { 68947 constructor(attributes) { 68948 super(CONFIG_NS_ID, "compressLogicalStructure"); 68949 } 68950 68951} 68952 68953class CompressObjectStream extends _xfa_object.Option10 { 68954 constructor(attributes) { 68955 super(CONFIG_NS_ID, "compressObjectStream"); 68956 } 68957 68958} 68959 68960class Compression extends _xfa_object.XFAObject { 68961 constructor(attributes) { 68962 super(CONFIG_NS_ID, "compression", true); 68963 this.compressLogicalStructure = null; 68964 this.compressObjectStream = null; 68965 this.level = null; 68966 this.type = null; 68967 } 68968 68969} 68970 68971class Config extends _xfa_object.XFAObject { 68972 constructor(attributes) { 68973 super(CONFIG_NS_ID, "config", true); 68974 this.acrobat = null; 68975 this.present = null; 68976 this.trace = null; 68977 this.agent = new _xfa_object.XFAObjectArray(); 68978 } 68979 68980} 68981 68982class Conformance extends _xfa_object.OptionObject { 68983 constructor(attributes) { 68984 super(CONFIG_NS_ID, "conformance", ["A", "B"]); 68985 } 68986 68987} 68988 68989class ContentCopy extends _xfa_object.Option01 { 68990 constructor(attributes) { 68991 super(CONFIG_NS_ID, "contentCopy"); 68992 } 68993 68994} 68995 68996class Copies extends _xfa_object.IntegerObject { 68997 constructor(attributes) { 68998 super(CONFIG_NS_ID, "copies", 1, n => n >= 1); 68999 } 69000 69001} 69002 69003class Creator extends _xfa_object.StringObject { 69004 constructor(attributes) { 69005 super(CONFIG_NS_ID, "creator"); 69006 } 69007 69008} 69009 69010class CurrentPage extends _xfa_object.IntegerObject { 69011 constructor(attributes) { 69012 super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0); 69013 } 69014 69015} 69016 69017class Data extends _xfa_object.XFAObject { 69018 constructor(attributes) { 69019 super(CONFIG_NS_ID, "data", true); 69020 this.adjustData = null; 69021 this.attributes = null; 69022 this.incrementalLoad = null; 69023 this.outputXSL = null; 69024 this.range = null; 69025 this.record = null; 69026 this.startNode = null; 69027 this.uri = null; 69028 this.window = null; 69029 this.xsl = null; 69030 this.excludeNS = new _xfa_object.XFAObjectArray(); 69031 this.transform = new _xfa_object.XFAObjectArray(); 69032 } 69033 69034} 69035 69036class Debug extends _xfa_object.XFAObject { 69037 constructor(attributes) { 69038 super(CONFIG_NS_ID, "debug", true); 69039 this.uri = null; 69040 } 69041 69042} 69043 69044class DefaultTypeface extends _xfa_object.ContentObject { 69045 constructor(attributes) { 69046 super(CONFIG_NS_ID, "defaultTypeface"); 69047 this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]); 69048 } 69049 69050} 69051 69052class Destination extends _xfa_object.OptionObject { 69053 constructor(attributes) { 69054 super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]); 69055 } 69056 69057} 69058 69059class DocumentAssembly extends _xfa_object.Option01 { 69060 constructor(attributes) { 69061 super(CONFIG_NS_ID, "documentAssembly"); 69062 } 69063 69064} 69065 69066class Driver extends _xfa_object.XFAObject { 69067 constructor(attributes) { 69068 super(CONFIG_NS_ID, "driver", true); 69069 this.name = attributes.name ? attributes.name.trim() : ""; 69070 this.fontInfo = null; 69071 this.xdc = null; 69072 } 69073 69074} 69075 69076class DuplexOption extends _xfa_object.OptionObject { 69077 constructor(attributes) { 69078 super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]); 69079 } 69080 69081} 69082 69083class DynamicRender extends _xfa_object.OptionObject { 69084 constructor(attributes) { 69085 super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]); 69086 } 69087 69088} 69089 69090class Embed extends _xfa_object.Option01 { 69091 constructor(attributes) { 69092 super(CONFIG_NS_ID, "embed"); 69093 } 69094 69095} 69096 69097class Encrypt extends _xfa_object.Option01 { 69098 constructor(attributes) { 69099 super(CONFIG_NS_ID, "encrypt"); 69100 } 69101 69102} 69103 69104class Encryption extends _xfa_object.XFAObject { 69105 constructor(attributes) { 69106 super(CONFIG_NS_ID, "encryption", true); 69107 this.encrypt = null; 69108 this.encryptionLevel = null; 69109 this.permissions = null; 69110 } 69111 69112} 69113 69114class EncryptionLevel extends _xfa_object.OptionObject { 69115 constructor(attributes) { 69116 super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]); 69117 } 69118 69119} 69120 69121class Enforce extends _xfa_object.StringObject { 69122 constructor(attributes) { 69123 super(CONFIG_NS_ID, "enforce"); 69124 } 69125 69126} 69127 69128class Equate extends _xfa_object.XFAObject { 69129 constructor(attributes) { 69130 super(CONFIG_NS_ID, "equate"); 69131 this.force = (0, _utils.getInteger)({ 69132 data: attributes.force, 69133 defaultValue: 1, 69134 validate: n => n === 0 69135 }); 69136 this.from = attributes.from || ""; 69137 this.to = attributes.to || ""; 69138 } 69139 69140} 69141 69142class EquateRange extends _xfa_object.XFAObject { 69143 constructor(attributes) { 69144 super(CONFIG_NS_ID, "equateRange"); 69145 this.from = attributes.from || ""; 69146 this.to = attributes.to || ""; 69147 this._unicodeRange = attributes.unicodeRange || ""; 69148 } 69149 69150 get unicodeRange() { 69151 const ranges = []; 69152 const unicodeRegex = /U\+([0-9a-fA-F]+)/; 69153 const unicodeRange = this._unicodeRange; 69154 69155 for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) { 69156 range = range.split("-", 2).map(x => { 69157 const found = x.match(unicodeRegex); 69158 69159 if (!found) { 69160 return 0; 69161 } 69162 69163 return parseInt(found[1], 16); 69164 }); 69165 69166 if (range.length === 1) { 69167 range.push(range[0]); 69168 } 69169 69170 ranges.push(range); 69171 } 69172 69173 return (0, _util.shadow)(this, "unicodeRange", ranges); 69174 } 69175 69176} 69177 69178class Exclude extends _xfa_object.ContentObject { 69179 constructor(attributes) { 69180 super(CONFIG_NS_ID, "exclude"); 69181 } 69182 69183 [_xfa_object.$finalize]() { 69184 this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x)); 69185 } 69186 69187} 69188 69189class ExcludeNS extends _xfa_object.StringObject { 69190 constructor(attributes) { 69191 super(CONFIG_NS_ID, "excludeNS"); 69192 } 69193 69194} 69195 69196class FlipLabel extends _xfa_object.OptionObject { 69197 constructor(attributes) { 69198 super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]); 69199 } 69200 69201} 69202 69203class FontInfo extends _xfa_object.XFAObject { 69204 constructor(attributes) { 69205 super(CONFIG_NS_ID, "fontInfo", true); 69206 this.embed = null; 69207 this.map = null; 69208 this.subsetBelow = null; 69209 this.alwaysEmbed = new _xfa_object.XFAObjectArray(); 69210 this.defaultTypeface = new _xfa_object.XFAObjectArray(); 69211 this.neverEmbed = new _xfa_object.XFAObjectArray(); 69212 } 69213 69214} 69215
69216class FormFieldFilling extends _xfa_object.Option01 { 69217 constructor(attributes) { 69218 super(CONFIG_NS_ID, "formFieldFilling"); 69219 } 69220 69221} 69222 69223class GroupParent extends _xfa_object.StringObject { 69224 constructor(attributes) { 69225 super(CONFIG_NS_ID, "groupParent"); 69226 } 69227 69228} 69229 69230class IfEmpty extends _xfa_object.OptionObject { 69231 constructor(attributes) { 69232 super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]); 69233 } 69234 69235} 69236 69237class IncludeXDPContent extends _xfa_object.StringObject { 69238 constructor(attributes) { 69239 super(CONFIG_NS_ID, "includeXDPContent"); 69240 } 69241 69242} 69243 69244class IncrementalLoad extends _xfa_object.OptionObject { 69245 constructor(attributes) { 69246 super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]); 69247 } 69248 69249} 69250 69251class IncrementalMerge extends _xfa_object.Option01 { 69252 constructor(attributes) { 69253 super(CONFIG_NS_ID, "incrementalMerge"); 69254 } 69255 69256} 69257 69258class Interactive extends _xfa_object.Option01 { 69259 constructor(attributes) { 69260 super(CONFIG_NS_ID, "interactive"); 69261 } 69262 69263} 69264 69265class Jog extends _xfa_object.OptionObject { 69266 constructor(attributes) { 69267 super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]); 69268 } 69269 69270} 69271 69272class LabelPrinter extends _xfa_object.XFAObject { 69273 constructor(attributes) { 69274 super(CONFIG_NS_ID, "labelPrinter", true); 69275 this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]); 69276 this.batchOutput = null; 69277 this.flipLabel = null; 69278 this.fontInfo = null; 69279 this.xdc = null; 69280 } 69281 69282} 69283 69284class Layout extends _xfa_object.OptionObject { 69285 constructor(attributes) { 69286 super(CONFIG_NS_ID, "layout", ["paginate", "panel"]); 69287 } 69288 69289} 69290 69291class Level extends _xfa_object.IntegerObject { 69292 constructor(attributes) { 69293 super(CONFIG_NS_ID, "level", 0, n => n > 0); 69294 } 69295 69296} 69297 69298class Linearized extends _xfa_object.Option01 { 69299 constructor(attributes) { 69300 super(CONFIG_NS_ID, "linearized"); 69301 } 69302 69303} 69304 69305class Locale extends _xfa_object.StringObject { 69306 constructor(attributes) { 69307 super(CONFIG_NS_ID, "locale"); 69308 } 69309 69310} 69311 69312class LocaleSet extends _xfa_object.StringObject { 69313 constructor(attributes) { 69314 super(CONFIG_NS_ID, "localeSet"); 69315 } 69316 69317} 69318 69319class Log extends _xfa_object.XFAObject { 69320 constructor(attributes) { 69321 super(CONFIG_NS_ID, "log", true); 69322 this.mode = null; 69323 this.threshold = null; 69324 this.to = null; 69325 this.uri = null; 69326 } 69327 69328} 69329 69330class MapElement extends _xfa_object.XFAObject { 69331 constructor(attributes) { 69332 super(CONFIG_NS_ID, "map", true); 69333 this.equate = new _xfa_object.XFAObjectArray(); 69334 this.equateRange = new _xfa_object.XFAObjectArray(); 69335 } 69336 69337} 69338 69339class MediumInfo extends _xfa_object.XFAObject { 69340 constructor(attributes) { 69341 super(CONFIG_NS_ID, "mediumInfo", true); 69342 this.map = null; 69343 } 69344 69345} 69346 69347class Message extends _xfa_object.XFAObject { 69348 constructor(attributes) { 69349 super(CONFIG_NS_ID, "message", true); 69350 this.msgId = null; 69351 this.severity = null; 69352 } 69353 69354} 69355 69356class Messaging extends _xfa_object.XFAObject { 69357 constructor(attributes) { 69358 super(CONFIG_NS_ID, "messaging", true); 69359 this.message = new _xfa_object.XFAObjectArray(); 69360 } 69361 69362} 69363 69364class Mode extends _xfa_object.OptionObject { 69365 constructor(attributes) { 69366 super(CONFIG_NS_ID, "mode", ["append", "overwrite"]); 69367 } 69368 69369} 69370 69371class ModifyAnnots extends _xfa_object.Option01 { 69372 constructor(attributes) { 69373 super(CONFIG_NS_ID, "modifyAnnots"); 69374 } 69375 69376} 69377 69378class MsgId extends _xfa_object.IntegerObject { 69379 constructor(attributes) { 69380 super(CONFIG_NS_ID, "msgId", 1, n => n >= 1); 69381 } 69382 69383} 69384 69385class NameAttr extends _xfa_object.StringObject { 69386 constructor(attributes) { 69387 super(CONFIG_NS_ID, "nameAttr"); 69388 } 69389 69390} 69391 69392class NeverEmbed extends _xfa_object.ContentObject { 69393 constructor(attributes) { 69394 super(CONFIG_NS_ID, "neverEmbed"); 69395 } 69396 69397} 69398 69399class NumberOfCopies extends _xfa_object.IntegerObject { 69400 constructor(attributes) { 69401 super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5); 69402 } 69403 69404} 69405 69406class OpenAction extends _xfa_object.XFAObject { 69407 constructor(attributes) { 69408 super(CONFIG_NS_ID, "openAction", true); 69409 this.destination = null; 69410 } 69411 69412} 69413 69414class Output extends _xfa_object.XFAObject { 69415 constructor(attributes) { 69416 super(CONFIG_NS_ID, "output", true); 69417 this.to = null; 69418 this.type = null; 69419 this.uri = null; 69420 } 69421 69422} 69423 69424class OutputBin extends _xfa_object.StringObject { 69425 constructor(attributes) { 69426 super(CONFIG_NS_ID, "outputBin"); 69427 } 69428 69429} 69430 69431class OutputXSL extends _xfa_object.XFAObject { 69432 constructor(attributes) { 69433 super(CONFIG_NS_ID, "outputXSL", true); 69434 this.uri = null; 69435 } 69436 69437} 69438 69439class Overprint extends _xfa_object.OptionObject { 69440 constructor(attributes) { 69441 super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]); 69442 } 69443 69444} 69445 69446class Packets extends _xfa_object.StringObject { 69447 constructor(attributes) { 69448 super(CONFIG_NS_ID, "packets"); 69449 } 69450 69451 [_xfa_object.$finalize]() { 69452 if (this[_xfa_object.$content] === "*") { 69453 return; 69454 } 69455 69456 this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x)); 69457 } 69458 69459} 69460 69461class PageOffset extends _xfa_object.XFAObject { 69462 constructor(attributes) { 69463 super(CONFIG_NS_ID, "pageOffset"); 69464 this.x = (0, _utils.getInteger)({ 69465 data: attributes.x, 69466 defaultValue: "useXDCSetting", 69467 validate: n => true 69468 }); 69469 this.y = (0, _utils.getInteger)({ 69470 data: attributes.y, 69471 defaultValue: "useXDCSetting", 69472 validate: n => true 69473 }); 69474 } 69475 69476} 69477 69478class PageRange extends _xfa_object.StringObject { 69479 constructor(attributes) { 69480 super(CONFIG_NS_ID, "pageRange"); 69481 } 69482 69483 [_xfa_object.$finalize]() { 69484 const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10)); 69485 69486 const ranges = []; 69487 69488 for (let i = 0, ii = numbers.length; i < ii; i += 2) { 69489 ranges.push(numbers.slice(i, i + 2)); 69490 } 69491 69492 this[_xfa_object.$content] = ranges; 69493 } 69494 69495} 69496 69497class Pagination extends _xfa_object.OptionObject { 69498 constructor(attributes) { 69499 super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]); 69500 } 69501 69502} 69503 69504class PaginationOverride extends _xfa_object.OptionObject { 69505 constructor(attributes) { 69506 super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]); 69507 } 69508 69509} 69510 69511class Part extends _xfa_object.IntegerObject { 69512 constructor(attributes) { 69513 super(CONFIG_NS_ID, "part", 1, n => false); 69514 } 69515 69516} 69517 69518class Pcl extends _xfa_object.XFAObject { 69519 constructor(attributes) { 69520 super(CONFIG_NS_ID, "pcl", true); 69521 this.name = attributes.name || ""; 69522 this.batchOutput = null; 69523 this.fontInfo = null; 69524 this.jog = null; 69525 this.mediumInfo = null; 69526 this.outputBin = null; 69527 this.pageOffset = null; 69528 this.staple = null; 69529 this.xdc = null; 69530 } 69531 69532} 69533 69534class Pdf extends _xfa_object.XFAObject { 69535 constructor(attributes) { 69536 super(CONFIG_NS_ID, "pdf", true); 69537 this.name = attributes.name || ""; 69538 this.adobeExtensionLevel = null; 69539 this.batchOutput = null; 69540 this.compression = null; 69541 this.creator = null; 69542 this.encryption = null; 69543 this.fontInfo = null; 69544 this.interactive = null; 69545 this.linearized = null; 69546 this.openAction = null; 69547 this.pdfa = null; 69548 this.producer = null; 69549 this.renderPolicy = null; 69550 this.scriptModel = null; 69551 this.silentPrint = null; 69552 this.submitFormat = null; 69553 this.tagged = null; 69554 this.version = null; 69555 this.viewerPreferences = null; 69556 this.xdc = null; 69557 } 69558 69559} 69560 69561class Pdfa extends _xfa_object.XFAObject { 69562 constructor(attributes) { 69563 super(CONFIG_NS_ID, "pdfa", true); 69564 this.amd = null; 69565 this.conformance = null; 69566 this.includeXDPContent = null; 69567 this.part = null; 69568 } 69569 69570} 69571 69572class Permissions extends _xfa_object.XFAObject { 69573 constructor(attributes) { 69574 super(CONFIG_NS_ID, "permissions", true); 69575 this.accessibleContent = null; 69576 this.change = null; 69577 this.contentCopy = null; 69578 this.documentAssembly = null; 69579 this.formFieldFilling = null; 69580 this.modifyAnnots = null; 69581 this.plaintextMetadata = null; 69582 this.print = null; 69583 this.printHighQuality = null; 69584 } 69585 69586} 69587 69588class PickTrayByPDFSize extends _xfa_object.Option01 { 69589 constructor(attributes) { 69590 super(CONFIG_NS_ID, "pickTrayByPDFSize"); 69591 } 69592 69593} 69594 69595class Picture extends _xfa_object.StringObject { 69596 constructor(attributes) { 69597 super(CONFIG_NS_ID, "picture"); 69598 } 69599 69600} 69601 69602class PlaintextMetadata extends _xfa_object.Option01 { 69603 constructor(attributes) { 69604 super(CONFIG_NS_ID, "plaintextMetadata"); 69605 } 69606 69607} 69608 69609class Presence extends _xfa_object.OptionObject { 69610 constructor(attributes) { 69611 super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]); 69612 } 69613 69614} 69615 69616class Present extends _xfa_object.XFAObject { 69617 constructor(attributes) { 69618 super(CONFIG_NS_ID, "present", true); 69619 this.behaviorOverride = null; 69620 this.cache = null; 69621 this.common = null; 69622 this.copies = null; 69623 this.destination = null; 69624 this.incrementalMerge = null; 69625 this.layout = null; 69626 this.output = null; 69627 this.overprint = null; 69628 this.pagination = null; 69629 this.paginationOverride = null; 69630 this.script = null; 69631 this.validate = null; 69632 this.xdp = null; 69633 this.driver = new _xfa_object.XFAObjectArray(); 69634 this.labelPrinter = new _xfa_object.XFAObjectArray(); 69635 this.pcl = new _xfa_object.XFAObjectArray(); 69636 this.pdf = new _xfa_object.XFAObjectArray(); 69637 this.ps = new _xfa_object.XFAObjectArray(); 69638 this.submitUrl = new _xfa_object.XFAObjectArray(); 69639 this.webClient = new _xfa_object.XFAObjectArray(); 69640 this.zpl = new _xfa_object.XFAObjectArray(); 69641 } 69642 69643} 69644 69645class Print extends _xfa_object.Option01 { 69646 constructor(attributes) { 69647 super(CONFIG_NS_ID, "print"); 69648 } 69649 69650} 69651 69652class PrintHighQuality extends _xfa_object.Option01 { 69653 constructor(attributes) { 69654 super(CONFIG_NS_ID, "printHighQuality"); 69655 } 69656 69657} 69658 69659class PrintScaling extends _xfa_object.OptionObject { 69660 constructor(attributes) { 69661 super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]); 69662 } 69663 69664} 69665 69666class PrinterName extends _xfa_object.StringObject { 69667 constructor(attributes) { 69668 super(CONFIG_NS_ID, "printerName"); 69669 } 69670 69671} 69672 69673class Producer extends _xfa_object.StringObject { 69674 constructor(attributes) { 69675 super(CONFIG_NS_ID, "producer"); 69676 } 69677 69678} 69679 69680class Ps extends _xfa_object.XFAObject { 69681 constructor(attributes) { 69682 super(CONFIG_NS_ID, "ps", true); 69683 this.name = attributes.name || ""; 69684 this.batchOutput = null; 69685 this.fontInfo = null; 69686 this.jog = null; 69687 this.mediumInfo = null; 69688 this.outputBin = null; 69689 this.staple = null; 69690 this.xdc = null; 69691 } 69692 69693} 69694 69695class Range extends _xfa_object.ContentObject { 69696 constructor(attributes) { 69697 super(CONFIG_NS_ID, "range"); 69698 } 69699 69700 [_xfa_object.$finalize]() { 69701 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 => { 69702 if (range.length === 1) { 69703 range.push(range[0]); 69704 } 69705 69706 return range; 69707 }); 69708 } 69709 69710} 69711 69712class Record extends _xfa_object.ContentObject { 69713 constructor(attributes) { 69714 super(CONFIG_NS_ID, "record"); 69715 } 69716 69717 [_xfa_object.$finalize]() { 69718 this[_xfa_object.$content] = this[_xfa_object.$content].trim(); 69719 const n = parseInt(this[_xfa_object.$content], 10); 69720 69721 if (!isNaN(n) && n >= 0) { 69722 this[_xfa_object.$content] = n; 69723 } 69724 } 69725 69726} 69727 69728class Relevant extends _xfa_object.ContentObject { 69729 constructor(attributes) { 69730 super(CONFIG_NS_ID, "relevant"); 69731 } 69732 69733 [_xfa_object.$finalize]() { 69734 this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/); 69735 } 69736 69737} 69738 69739class Rename extends _xfa_object.ContentObject { 69740 constructor(attributes) { 69741 super(CONFIG_NS_ID, "rename"); 69742 } 69743 69744 [_xfa_object.$finalize]() { 69745 this[_xfa_object.$content] = this[_xfa_object.$content].trim(); 69746 69747 if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) { 69748 (0, _util.warn)("XFA - Rename: invalid XFA name"); 69749 } 69750 } 69751 69752} 69753 69754class RenderPolicy extends _xfa_object.OptionObject { 69755 constructor(attributes) { 69756 super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]); 69757 } 69758 69759} 69760 69761class RunScripts extends _xfa_object.OptionObject { 69762 constructor(attributes) { 69763 super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]); 69764 } 69765 69766} 69767 69768class Script extends _xfa_object.XFAObject { 69769 constructor(attributes) { 69770 super(CONFIG_NS_ID, "script", true); 69771 this.currentPage = null; 69772 this.exclude = null; 69773 this.runScripts = null; 69774 } 69775 69776} 69777 69778class ScriptModel extends _xfa_object.OptionObject { 69779 constructor(attributes) { 69780 super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]); 69781 } 69782 69783} 69784 69785class Severity extends _xfa_object.OptionObject { 69786 constructor(attributes) { 69787 super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]); 69788 } 69789 69790} 69791 69792class SilentPrint extends _xfa_object.XFAObject { 69793 constructor(attributes) { 69794 super(CONFIG_NS_ID, "silentPrint", true); 69795 this.addSilentPrint = null; 69796 this.printerName = null; 69797 } 69798 69799} 69800 69801class Staple extends _xfa_object.XFAObject { 69802 constructor(attributes) { 69803 super(CONFIG_NS_ID, "staple"); 69804 this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]); 69805 } 69806 69807} 69808 69809class StartNode extends _xfa_object.StringObject { 69810 constructor(attributes) { 69811 super(CONFIG_NS_ID, "startNode"); 69812 } 69813 69814} 69815 69816class StartPage extends _xfa_object.IntegerObject { 69817 constructor(attributes) { 69818 super(CONFIG_NS_ID, "startPage", 0, n => true); 69819 } 69820 69821} 69822 69823class SubmitFormat extends _xfa_object.OptionObject { 69824 constructor(attributes) { 69825 super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]); 69826 } 69827 69828} 69829 69830class SubmitUrl extends _xfa_object.StringObject { 69831 constructor(attributes) { 69832 super(CONFIG_NS_ID, "submitUrl"); 69833 } 69834 69835} 69836 69837class SubsetBelow extends _xfa_object.IntegerObject { 69838 constructor(attributes) { 69839 super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100); 69840 } 69841 69842} 69843 69844class SuppressBanner extends _xfa_object.Option01 { 69845 constructor(attributes) { 69846 super(CONFIG_NS_ID, "suppressBanner"); 69847 } 69848 69849} 69850 69851class Tagged extends _xfa_object.Option01 { 69852 constructor(attributes) { 69853 super(CONFIG_NS_ID, "tagged"); 69854 } 69855 69856} 69857 69858class Template extends _xfa_object.XFAObject { 69859 constructor(attributes) { 69860 super(CONFIG_NS_ID, "template", true); 69861 this.base = null; 69862 this.relevant = null; 69863 this.startPage = null; 69864 this.uri = null; 69865 this.xsl = null; 69866 } 69867 69868} 69869 69870class Threshold extends _xfa_object.OptionObject { 69871 constructor(attributes) { 69872 super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]); 69873 } 69874 69875} 69876 69877class To extends _xfa_object.OptionObject { 69878 constructor(attributes) { 69879 super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]); 69880 } 69881 69882} 69883 69884class TemplateCache extends _xfa_object.XFAObject { 69885 constructor(attributes) { 69886 super(CONFIG_NS_ID, "templateCache"); 69887 this.maxEntries = (0, _utils.getInteger)({ 69888 data: attributes.maxEntries, 69889 defaultValue: 5, 69890 validate: n => n >= 0 69891 }); 69892 } 69893 69894} 69895 69896class Trace extends _xfa_object.XFAObject { 69897 constructor(attributes) { 69898 super(CONFIG_NS_ID, "trace", true); 69899 this.area = new _xfa_object.XFAObjectArray(); 69900 } 69901 69902} 69903 69904class Transform extends _xfa_object.XFAObject { 69905 constructor(attributes) { 69906 super(CONFIG_NS_ID, "transform", true); 69907 this.groupParent = null; 69908 this.ifEmpty = null; 69909 this.nameAttr = null; 69910 this.picture = null; 69911 this.presence = null; 69912 this.rename = null; 69913 this.whitespace = null; 69914 } 69915 69916} 69917 69918class Type extends _xfa_object.OptionObject { 69919 constructor(attributes) { 69920 super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]); 69921 } 69922 69923} 69924 69925class Uri extends _xfa_object.StringObject { 69926 constructor(attributes) { 69927 super(CONFIG_NS_ID, "uri"); 69928 } 69929 69930} 69931 69932class Validate extends _xfa_object.OptionObject { 69933 constructor(attributes) { 69934 super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]); 69935 } 69936 69937} 69938 69939class ValidateApprovalSignatures extends _xfa_object.ContentObject { 69940 constructor(attributes) { 69941 super(CONFIG_NS_ID, "validateApprovalSignatures"); 69942 } 69943 69944 [_xfa_object.$finalize]() { 69945 this[_xfa_object.$content] = this[_xfa_object.$conte
69945nt].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x)); 69946 } 69947 69948} 69949 69950class ValidationMessaging extends _xfa_object.OptionObject { 69951 constructor(attributes) { 69952 super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]); 69953 } 69954 69955} 69956 69957class Version extends _xfa_object.OptionObject { 69958 constructor(attributes) { 69959 super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]); 69960 } 69961 69962} 69963 69964class VersionControl extends _xfa_object.XFAObject { 69965 constructor(attributes) { 69966 super(CONFIG_NS_ID, "VersionControl"); 69967 this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]); 69968 this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]); 69969 this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]); 69970 } 69971 69972} 69973 69974class ViewerPreferences extends _xfa_object.XFAObject { 69975 constructor(attributes) { 69976 super(CONFIG_NS_ID, "viewerPreferences", true); 69977 this.ADBE_JSConsole = null; 69978 this.ADBE_JSDebugger = null; 69979 this.addViewerPreferences = null; 69980 this.duplexOption = null; 69981 this.enforce = null; 69982 this.numberOfCopies = null; 69983 this.pageRange = null; 69984 this.pickTrayByPDFSize = null; 69985 this.printScaling = null; 69986 } 69987 69988} 69989 69990class WebClient extends _xfa_object.XFAObject { 69991 constructor(attributes) { 69992 super(CONFIG_NS_ID, "webClient", true); 69993 this.name = attributes.name ? attributes.name.trim() : ""; 69994 this.fontInfo = null; 69995 this.xdc = null; 69996 } 69997 69998} 69999 70000class Whitespace extends _xfa_object.OptionObject { 70001 constructor(attributes) { 70002 super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]); 70003 } 70004 70005} 70006 70007class Window extends _xfa_object.ContentObject { 70008 constructor(attributes) { 70009 super(CONFIG_NS_ID, "window"); 70010 } 70011 70012 [_xfa_object.$finalize]() { 70013 const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10)); 70014 70015 if (pair.some(x => isNaN(x))) { 70016 this[_xfa_object.$content] = [0, 0]; 70017 return; 70018 } 70019 70020 if (pair.length === 1) { 70021 pair.push(pair[0]); 70022 } 70023 70024 this[_xfa_object.$content] = pair; 70025 } 70026 70027} 70028 70029class Xdc extends _xfa_object.XFAObject { 70030 constructor(attributes) { 70031 super(CONFIG_NS_ID, "xdc", true); 70032 this.uri = new _xfa_object.XFAObjectArray(); 70033 this.xsl = new _xfa_object.XFAObjectArray(); 70034 } 70035 70036} 70037 70038class Xdp extends _xfa_object.XFAObject { 70039 constructor(attributes) { 70040 super(CONFIG_NS_ID, "xdp", true); 70041 this.packets = null; 70042 } 70043 70044} 70045 70046class Xsl extends _xfa_object.XFAObject { 70047 constructor(attributes) { 70048 super(CONFIG_NS_ID, "xsl", true); 70049 this.debug = null; 70050 this.uri = null; 70051 } 70052 70053} 70054 70055class Zpl extends _xfa_object.XFAObject { 70056 constructor(attributes) { 70057 super(CONFIG_NS_ID, "zpl", true); 70058 this.name = attributes.name ? attributes.name.trim() : ""; 70059 this.batchOutput = null; 70060 this.flipLabel = null; 70061 this.fontInfo = null; 70062 this.xdc = null; 70063 } 70064 70065} 70066 70067class ConfigNamespace { 70068 static [_namespaces.$buildXFAObject](name, attributes) { 70069 if (ConfigNamespace.hasOwnProperty(name)) { 70070 return ConfigNamespace[name](attributes); 70071 } 70072 70073 return undefined; 70074 } 70075 70076 static acrobat(attrs) { 70077 return new Acrobat(attrs); 70078 } 70079 70080 static acrobat7(attrs) { 70081 return new Acrobat7(attrs); 70082 } 70083 70084 static ADBE_JSConsole(attrs) { 70085 return new ADBE_JSConsole(attrs); 70086 } 70087 70088 static ADBE_JSDebugger(attrs) { 70089 return new ADBE_JSDebugger(attrs); 70090 } 70091 70092 static addSilentPrint(attrs) { 70093 return new AddSilentPrint(attrs); 70094 } 70095 70096 static addViewerPreferences(attrs) { 70097 return new AddViewerPreferences(attrs); 70098 } 70099 70100 static adjustData(attrs) { 70101 return new AdjustData(attrs); 70102 } 70103 70104 static adobeExtensionLevel(attrs) { 70105 return new AdobeExtensionLevel(attrs); 70106 } 70107 70108 static agent(attrs) { 70109 return new Agent(attrs); 70110 } 70111 70112 static alwaysEmbed(attrs) { 70113 return new AlwaysEmbed(attrs); 70114 } 70115 70116 static amd(attrs) { 70117 return new Amd(attrs); 70118 } 70119 70120 static area(attrs) { 70121 return new Area(attrs); 70122 } 70123 70124 static attributes(attrs) { 70125 return new Attributes(attrs); 70126 } 70127 70128 static autoSave(attrs) { 70129 return new AutoSave(attrs); 70130 } 70131 70132 static base(attrs) { 70133 return new Base(attrs); 70134 } 70135 70136 static batchOutput(attrs) { 70137 return new BatchOutput(attrs); 70138 } 70139 70140 static behaviorOverride(attrs) { 70141 return new BehaviorOverride(attrs); 70142 } 70143 70144 static cache(attrs) { 70145 return new Cache(attrs); 70146 } 70147 70148 static change(attrs) { 70149 return new Change(attrs); 70150 } 70151 70152 static common(attrs) { 70153 return new Common(attrs); 70154 } 70155 70156 static compress(attrs) { 70157 return new Compress(attrs); 70158 } 70159 70160 static compressLogicalStructure(attrs) { 70161 return new CompressLogicalStructure(attrs); 70162 } 70163 70164 static compressObjectStream(attrs) { 70165 return new CompressObjectStream(attrs); 70166 } 70167 70168 static compression(attrs) { 70169 return new Compression(attrs); 70170 } 70171 70172 static config(attrs) { 70173 return new Config(attrs); 70174 } 70175 70176 static conformance(attrs) { 70177 return new Conformance(attrs); 70178 } 70179 70180 static contentCopy(attrs) { 70181 return new ContentCopy(attrs); 70182 } 70183 70184 static copies(attrs) { 70185 return new Copies(attrs); 70186 } 70187 70188 static creator(attrs) { 70189 return new Creator(attrs); 70190 } 70191 70192 static currentPage(attrs) { 70193 return new CurrentPage(attrs); 70194 } 70195 70196 static data(attrs) { 70197 return new Data(attrs); 70198 } 70199 70200 static debug(attrs) { 70201 return new Debug(attrs); 70202 } 70203 70204 static defaultTypeface(attrs) { 70205 return new DefaultTypeface(attrs); 70206 } 70207 70208 static destination(attrs) { 70209 return new Destination(attrs); 70210 } 70211 70212 static documentAssembly(attrs) { 70213 return new DocumentAssembly(attrs); 70214 } 70215 70216 static driver(attrs) { 70217 return new Driver(attrs); 70218 } 70219 70220 static duplexOption(attrs) { 70221 return new DuplexOption(attrs); 70222 } 70223 70224 static dynamicRender(attrs) { 70225 return new DynamicRender(attrs); 70226 } 70227 70228 static embed(attrs) { 70229 return new Embed(attrs); 70230 } 70231 70232 static encrypt(attrs) { 70233 return new Encrypt(attrs); 70234 } 70235 70236 static encryption(attrs) { 70237 return new Encryption(attrs); 70238 } 70239 70240 static encryptionLevel(attrs) { 70241 return new EncryptionLevel(attrs); 70242 } 70243 70244 static enforce(attrs) { 70245 return new Enforce(attrs); 70246 } 70247 70248 static equate(attrs) { 70249 return new Equate(attrs); 70250 } 70251 70252 static equateRange(attrs) { 70253 return new EquateRange(attrs); 70254 } 70255 70256 static exclude(attrs) { 70257 return new Exclude(attrs); 70258 } 70259 70260 static excludeNS(attrs) { 70261 return new ExcludeNS(attrs); 70262 } 70263 70264 static flipLabel(attrs) { 70265 return new FlipLabel(attrs); 70266 } 70267 70268 static fontInfo(attrs) { 70269 return new FontInfo(attrs); 70270 } 70271 70272 static formFieldFilling(attrs) {
70273 return new FormFieldFilling(attrs); 70274 } 70275 70276 static groupParent(attrs) { 70277 return new GroupParent(attrs); 70278 } 70279 70280 static ifEmpty(attrs) { 70281 return new IfEmpty(attrs); 70282 } 70283 70284 static includeXDPContent(attrs) { 70285 return new IncludeXDPContent(attrs); 70286 } 70287 70288 static incrementalLoad(attrs) { 70289 return new IncrementalLoad(attrs); 70290 } 70291 70292 static incrementalMerge(attrs) { 70293 return new IncrementalMerge(attrs); 70294 } 70295 70296 static interactive(attrs) { 70297 return new Interactive(attrs); 70298 } 70299 70300 static jog(attrs) { 70301 return new Jog(attrs); 70302 } 70303 70304 static labelPrinter(attrs) { 70305 return new LabelPrinter(attrs); 70306 } 70307 70308 static layout(attrs) { 70309 return new Layout(attrs); 70310 } 70311 70312 static level(attrs) { 70313 return new Level(attrs); 70314 } 70315 70316 static linearized(attrs) { 70317 return new Linearized(attrs); 70318 } 70319 70320 static locale(attrs) { 70321 return new Locale(attrs); 70322 } 70323 70324 static localeSet(attrs) { 70325 return new LocaleSet(attrs); 70326 } 70327 70328 static log(attrs) { 70329 return new Log(attrs); 70330 } 70331 70332 static map(attrs) { 70333 return new MapElement(attrs); 70334 } 70335 70336 static mediumInfo(attrs) { 70337 return new MediumInfo(attrs); 70338 } 70339 70340 static message(attrs) { 70341 return new Message(attrs); 70342 } 70343 70344 static messaging(attrs) { 70345 return new Messaging(attrs); 70346 } 70347 70348 static mode(attrs) { 70349 return new Mode(attrs); 70350 } 70351 70352 static modifyAnnots(attrs) { 70353 return new ModifyAnnots(attrs); 70354 } 70355 70356 static msgId(attrs) { 70357 return new MsgId(attrs); 70358 } 70359 70360 static nameAttr(attrs) { 70361 return new NameAttr(attrs); 70362 } 70363 70364 static neverEmbed(attrs) { 70365 return new NeverEmbed(attrs); 70366 } 70367 70368 static numberOfCopies(attrs) { 70369 return new NumberOfCopies(attrs); 70370 } 70371 70372 static openAction(attrs) { 70373 return new OpenAction(attrs); 70374 } 70375 70376 static output(attrs) { 70377 return new Output(attrs); 70378 } 70379 70380 static outputBin(attrs) { 70381 return new OutputBin(attrs); 70382 } 70383 70384 static outputXSL(attrs) { 70385 return new OutputXSL(attrs); 70386 } 70387 70388 static overprint(attrs) { 70389 return new Overprint(attrs); 70390 } 70391 70392 static packets(attrs) { 70393 return new Packets(attrs); 70394 } 70395 70396 static pageOffset(attrs) { 70397 return new PageOffset(attrs); 70398 } 70399 70400 static pageRange(attrs) { 70401 return new PageRange(attrs); 70402 } 70403 70404 static pagination(attrs) { 70405 return new Pagination(attrs); 70406 } 70407 70408 static paginationOverride(attrs) { 70409 return new PaginationOverride(attrs); 70410 } 70411 70412 static part(attrs) { 70413 return new Part(attrs); 70414 } 70415 70416 static pcl(attrs) { 70417 return new Pcl(attrs); 70418 } 70419 70420 static pdf(attrs) { 70421 return new Pdf(attrs); 70422 } 70423 70424 static pdfa(attrs) { 70425 return new Pdfa(attrs); 70426 } 70427 70428 static permissions(attrs) { 70429 return new Permissions(attrs); 70430 } 70431 70432 static pickTrayByPDFSize(attrs) { 70433 return new PickTrayByPDFSize(attrs); 70434 } 70435 70436 static picture(attrs) { 70437 return new Picture(attrs); 70438 } 70439 70440 static plaintextMetadata(attrs) { 70441 return new PlaintextMetadata(attrs); 70442 } 70443 70444 static presence(attrs) { 70445 return new Presence(attrs); 70446 } 70447 70448 static present(attrs) { 70449 return new Present(attrs); 70450 } 70451 70452 static print(attrs) { 70453 return new Print(attrs); 70454 } 70455 70456 static printHighQuality(attrs) { 70457 return new PrintHighQuality(attrs); 70458 } 70459 70460 static printScaling(attrs) { 70461 return new PrintScaling(attrs); 70462 } 70463 70464 static printerName(attrs) { 70465 return new PrinterName(attrs); 70466 } 70467 70468 static producer(attrs) { 70469 return new Producer(attrs); 70470 } 70471 70472 static ps(attrs) { 70473 return new Ps(attrs); 70474 } 70475 70476 static range(attrs) { 70477 return new Range(attrs); 70478 } 70479 70480 static record(attrs) { 70481 return new Record(attrs); 70482 } 70483 70484 static relevant(attrs) { 70485 return new Relevant(attrs); 70486 } 70487 70488 static rename(attrs) { 70489 return new Rename(attrs); 70490 } 70491 70492 static renderPolicy(attrs) { 70493 return new RenderPolicy(attrs); 70494 } 70495 70496 static runScripts(attrs) { 70497 return new RunScripts(attrs); 70498 } 70499 70500 static script(attrs) { 70501 return new Script(attrs); 70502 } 70503 70504 static scriptModel(attrs) { 70505 return new ScriptModel(attrs); 70506 } 70507 70508 static severity(attrs) { 70509 return new Severity(attrs); 70510 } 70511 70512 static silentPrint(attrs) { 70513 return new SilentPrint(attrs); 70514 } 70515 70516 static staple(attrs) { 70517 return new Staple(attrs); 70518 } 70519 70520 static startNode(attrs) { 70521 return new StartNode(attrs); 70522 } 70523 70524 static startPage(attrs) { 70525 return new StartPage(attrs); 70526 } 70527 70528 static submitFormat(attrs) { 70529 return new SubmitFormat(attrs); 70530 } 70531 70532 static submitUrl(attrs) { 70533 return new SubmitUrl(attrs); 70534 } 70535 70536 static subsetBelow(attrs) { 70537 return new SubsetBelow(attrs); 70538 } 70539 70540 static suppressBanner(attrs) { 70541 return new SuppressBanner(attrs); 70542 } 70543 70544 static tagged(attrs) { 70545 return new Tagged(attrs); 70546 } 70547 70548 static template(attrs) { 70549 return new Template(attrs); 70550 } 70551 70552 static templateCache(attrs) { 70553 return new TemplateCache(attrs); 70554 } 70555 70556 static threshold(attrs) { 70557 return new Threshold(attrs); 70558 } 70559 70560 static to(attrs) { 70561 return new To(attrs); 70562 } 70563 70564 static trace(attrs) { 70565 return new Trace(attrs); 70566 } 70567 70568 static transform(attrs) { 70569 return new Transform(attrs); 70570 } 70571 70572 static type(attrs) { 70573 return new Type(attrs); 70574 } 70575 70576 static uri(attrs) { 70577 return new Uri(attrs); 70578 } 70579 70580 static validate(attrs) {
70581 return new Validate(attrs); 70582 } 70583 70584 static validateApprovalSignatures(attrs) { 70585 return new ValidateApprovalSignatures(attrs); 70586 } 70587 70588 static validationMessaging(attrs) { 70589 return new ValidationMessaging(attrs); 70590 } 70591 70592 static version(attrs) { 70593 return new Version(attrs); 70594 } 70595 70596 static versionControl(attrs) { 70597 return new VersionControl(attrs); 70598 } 70599 70600 static viewerPreferences(attrs) { 70601 return new ViewerPreferences(attrs); 70602 } 70603 70604 static webClient(attrs) { 70605 return new WebClient(attrs); 70606 } 70607 70608 static whitespace(attrs) { 70609 return new Whitespace(attrs); 70610 } 70611 70612 static window(attrs) { 70613 return new Window(attrs); 70614 } 70615 70616 static xdc(attrs) { 70617 return new Xdc(attrs); 70618 } 70619 70620 static xdp(attrs) { 70621 return new Xdp(attrs); 70622 } 70623 70624 static xsl(attrs) { 70625 return new Xsl(attrs); 70626 } 70627 70628 static zpl(attrs) { 70629 return new Zpl(attrs); 70630 } 70631 70632} 70633 70634exports.ConfigNamespace = ConfigNamespace; 70635 70636/***/ }), 70637/* 90 */ 70638/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 70639 70640 70641 70642Object.defineProperty(exports, "__esModule", ({ 70643 value: true 70644})); 70645exports.ConnectionSetNamespace = void 0; 70646 70647var _namespaces = __w_pdfjs_require__(77); 70648 70649var _xfa_object = __w_pdfjs_require__(75); 70650 70651const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id; 70652 70653class ConnectionSet extends _xfa_object.XFAObject { 70654 constructor(attributes) { 70655 super(CONNECTION_SET_NS_ID, "connectionSet", true); 70656 this.wsdlConnection = new _xfa_object.XFAObjectArray(); 70657 this.xmlConnection = new _xfa_object.XFAObjectArray(); 70658 this.xsdConnection = new _xfa_object.XFAObjectArray(); 70659 } 70660 70661} 70662 70663class EffectiveInputPolicy extends _xfa_object.XFAObject { 70664 constructor(attributes) { 70665 super(CONNECTION_SET_NS_ID, "effectiveInputPolicy"); 70666 this.id = attributes.id || ""; 70667 this.name = attributes.name || ""; 70668 this.use = attributes.use || ""; 70669 this.usehref = attributes.usehref || ""; 70670 } 70671 70672} 70673 70674class EffectiveOutputPolicy extends _xfa_object.XFAObject { 70675 constructor(attributes) { 70676 super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy"); 70677 this.id = attributes.id || ""; 70678 this.name = attributes.name || ""; 70679 this.use = attributes.use || ""; 70680 this.usehref = attributes.usehref || ""; 70681 } 70682 70683} 70684 70685class Operation extends _xfa_object.StringObject { 70686 constructor(attributes) { 70687 super(CONNECTION_SET_NS_ID, "operation"); 70688 this.id = attributes.id || ""; 70689 this.input = attributes.input || ""; 70690 this.name = attributes.name || ""; 70691 this.output = attributes.output || ""; 70692 this.use = attributes.use || ""; 70693 this.usehref = attributes.usehref || ""; 70694 } 70695 70696} 70697 70698class RootElement extends _xfa_object.StringObject { 70699 constructor(attributes) { 70700 super(CONNECTION_SET_NS_ID, "rootElement"); 70701 this.id = attributes.id || ""; 70702 this.name = attributes.name || ""; 70703 this.use = attributes.use || ""; 70704 this.usehref = attributes.usehref || ""; 70705 } 70706 70707} 70708 70709class SoapAction extends _xfa_object.StringObject { 70710 constructor(attributes) { 70711 super(CONNECTION_SET_NS_ID, "soapAction"); 70712 this.id = attributes.id || ""; 70713 this.name = attributes.name || ""; 70714 this.use = attributes.use || ""; 70715 this.usehref = attributes.usehref || ""; 70716 } 70717 70718} 70719 70720class SoapAddress extends _xfa_object.StringObject { 70721 constructor(attributes) { 70722 super(CONNECTION_SET_NS_ID, "soapAddress"); 70723 this.id = attributes.id || ""; 70724 this.name = attributes.name || ""; 70725 this.use = attributes.use || ""; 70726 this.usehref = attributes.usehref || ""; 70727 } 70728 70729} 70730 70731class Uri extends _xfa_object.StringObject { 70732 constructor(attributes) { 70733 super(CONNECTION_SET_NS_ID, "uri"); 70734 this.id = attributes.id || ""; 70735 this.name = attributes.name || ""; 70736 this.use = attributes.use || ""; 70737 this.usehref = attributes.usehref || ""; 70738 } 70739 70740} 70741 70742class WsdlAddress extends _xfa_object.StringObject { 70743 constructor(attributes) { 70744 super(CONNECTION_SET_NS_ID, "wsdlAddress"); 70745 this.id = attributes.id || ""; 70746 this.name = attributes.name || ""; 70747 this.use = attributes.use || ""; 70748 this.usehref = attributes.usehref || ""; 70749 } 70750 70751} 70752 70753class WsdlConnection extends _xfa_object.XFAObject { 70754 constructor(attributes) { 70755 super(CONNECTION_SET_NS_ID, "wsdlConnection", true); 70756 this.dataDescription = attributes.dataDescription || ""; 70757 this.name = attributes.name || ""; 70758 this.effectiveInputPolicy = null; 70759 this.effectiveOutputPolicy = null; 70760 this.operation = null; 70761 this.soapAction = null; 70762 this.soapAddress = null; 70763 this.wsdlAddress = null; 70764 } 70765 70766} 70767 70768class XmlConnection extends _xfa_object.XFAObject { 70769 constructor(attributes) { 70770 super(CONNECTION_SET_NS_ID, "xmlConnection", true); 70771 this.dataDescription = attributes.dataDescription || ""; 70772 this.name = attributes.name || ""; 70773 this.uri = null; 70774 } 70775 70776} 70777 70778class XsdConnection extends _xfa_object.XFAObject { 70779 constructor(attributes) { 70780 super(CONNECTION_SET_NS_ID, "xsdConnection", true); 70781 this.dataDescription = attributes.dataDescription || ""; 70782 this.name = attributes.name || ""; 70783 this.rootElement = null; 70784 this.uri = null; 70785 } 70786 70787} 70788 70789class ConnectionSetNamespace { 70790 static [_namespaces.$buildXFAObject](name, attributes) { 70791 if (ConnectionSetNamespace.hasOwnProperty(name)) { 70792 return ConnectionSetNamespace[name](attributes); 70793 } 70794 70795 return undefined; 70796 } 70797 70798 static connectionSet(attrs) { 70799 return new ConnectionSet(attrs); 70800 } 70801 70802 static effectiveInputPolicy(attrs) { 70803 return new EffectiveInputPolicy(attrs); 70804 } 70805 70806 static effectiveOutputPolicy(attrs) { 70807 return new EffectiveOutputPolicy(attrs); 70808 } 70809 70810 static operation(attrs) { 70811 return new Operation(attrs); 70812 } 70813 70814 static rootElement(attrs) { 70815 return new RootElement(attrs); 70816 } 70817 70818 static soapAction(attrs) { 70819 return new SoapAction(attrs); 70820 } 70821 70822 static soapAddress(attrs) { 70823 return new SoapAddress(attrs); 70824 } 70825 70826 static uri(attrs) { 70827 return new Uri(attrs); 70828 } 70829 70830 static wsdlAddress(attrs) { 70831 return new WsdlAddress(attrs); 70832 } 70833 70834 static wsdlConnection(attrs) { 70835 return new WsdlConnection(attrs); 70836 } 70837 70838 static xmlConnection(attrs) { 70839 return new XmlConnection(attrs); 70840 } 70841 70842 static xsdConnection(attrs) { 70843 return new XsdConnection(attrs); 70844 } 70845 70846} 70847 70848exports.ConnectionSetNamespace = ConnectionSetNamespace; 70849 70850/***/ }), 70851/* 91 */ 70852/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 70853 70854 70855 70856Object.defineProperty(exports, "__esModule", ({ 70857 value: true 70858})); 70859exports.DatasetsNamespace = void 0; 70860 70861var _xfa_object = __w_pdfjs_require__(75); 70862 70863var _namespaces = __w_pdfjs_require__(77); 70864 70865const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id; 70866 70867class Data extends _xfa_object.XmlObject { 70868 constructor(attributes) { 70869 super(DATASETS_NS_ID, "data", attributes); 70870 } 70871 70872 [_xfa_object.$isNsAgnostic]() { 70873 return true; 70874 } 70875 70876} 70877 70878class Datasets extends _xfa_object.XFAObject { 70879 constructor(attributes) { 70880 super(DATASETS_NS_ID, "datasets", true); 70881 this.data = null; 70882 this.Signature = null; 70883 } 70884 70885 [_xfa_object.$onChild](child) { 70886 const name = child[_xfa_object.$nodeName]; 70887 70888 if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) { 70889 this[name] = child; 70890 } 70891 70892 this[_xfa_object.$appendChild](child); 70893 } 70894 70895} 70896 70897class DatasetsNamespace { 70898 static [_namespaces.$buildXFAObject](name, attributes) { 70899 if (DatasetsNamespace.hasOwnProperty(name)) { 70900 return DatasetsNamespace[name](attributes); 70901 } 70902 70903 return undefined; 70904 } 70905 70906 static datasets(attributes) { 70907 return new Datasets(attributes); 70908 } 70909 70910 static data(attributes) { 70911 return new Data(attributes); 70912 } 70913 70914} 70915 70916exports.DatasetsNamespace = DatasetsNamespace; 70917 70918/***/ }), 70919/* 92 */ 70920/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 70921 70922 70923 70924Object.defineProperty(exports, "__esModule", ({ 70925 value: true 70926})); 70927exports.LocaleSetNamespace = void 0; 70928 70929var _namespaces = __w_pdfjs_require__(77); 70930 70931var _xfa_object = __w_pdfjs_require__(75); 70932 70933var _utils = __w_pdfjs_require__(76); 70934 70935const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id; 70936 70937class CalendarSymbols extends _xfa_object.XFAObject { 70938 constructor(attributes) { 70939 super(LOCALE_SET_NS_ID, "calendarSymbols", true); 70940 this.name = "gregorian"; 70941 this.dayNames = new _xfa_object.XFAObjectArray(2); 70942 this.eraNames = null; 70943 this.meridiemNames = null; 70944 this.monthNames = new _xfa_object.XFAObjectArray(2); 70945 } 70946 70947} 70948 70949class CurrencySymbol extends _xfa_object.StringObject { 70950 constructor(attributes) { 70951 super(LOCALE_SET_NS_ID, "currencySymbol"); 70952 this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]); 70953 } 70954 70955} 70956
70957class CurrencySymbols extends _xfa_object.XFAObject { 70958 constructor(attributes) { 70959 super(LOCALE_SET_NS_ID, "currencySymbols", true); 70960 this.currencySymbol = new _xfa_object.XFAObjectArray(3); 70961 } 70962 70963} 70964 70965class DatePattern extends _xfa_object.StringObject { 70966 constructor(attributes) { 70967 super(LOCALE_SET_NS_ID, "datePattern"); 70968 this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]); 70969 } 70970 70971} 70972 70973class DatePatterns extends _xfa_object.XFAObject { 70974 constructor(attributes) { 70975 super(LOCALE_SET_NS_ID, "datePatterns", true); 70976 this.datePattern = new _xfa_object.XFAObjectArray(4); 70977 } 70978 70979} 70980 70981class DateTimeSymbols extends _xfa_object.ContentObject { 70982 constructor(attributes) { 70983 super(LOCALE_SET_NS_ID, "dateTimeSymbols"); 70984 } 70985 70986} 70987 70988class Day extends _xfa_object.StringObject { 70989 constructor(attributes) { 70990 super(LOCALE_SET_NS_ID, "day"); 70991 } 70992 70993} 70994 70995class DayNames extends _xfa_object.XFAObject { 70996 constructor(attributes) { 70997 super(LOCALE_SET_NS_ID, "dayNames", true); 70998 this.abbr = (0, _utils.getInteger)({ 70999 data: attributes.abbr, 71000 defaultValue: 0, 71001 validate: x => x === 1 71002 }); 71003 this.day = new _xfa_object.XFAObjectArray(7); 71004 } 71005 71006} 71007 71008class Era extends _xfa_object.StringObject { 71009 constructor(attributes) { 71010 super(LOCALE_SET_NS_ID, "era"); 71011 } 71012 71013} 71014 71015class EraNames extends _xfa_object.XFAObject { 71016 constructor(attributes) { 71017 super(LOCALE_SET_NS_ID, "eraNames", true); 71018 this.era = new _xfa_object.XFAObjectArray(2); 71019 } 71020 71021} 71022 71023class Locale extends _xfa_object.XFAObject { 71024 constructor(attributes) { 71025 super(LOCALE_SET_NS_ID, "locale", true); 71026 this.desc = attributes.desc || ""; 71027 this.name = "isoname"; 71028 this.calendarSymbols = null; 71029 this.currencySymbols = null; 71030 this.datePatterns = null; 71031 this.dateTimeSymbols = null; 71032 this.numberPatterns = null; 71033 this.numberSymbols = null; 71034 this.timePatterns = null; 71035 this.typeFaces = null; 71036 } 71037 71038} 71039 71040class LocaleSet extends _xfa_object.XFAObject { 71041 constructor(attributes) { 71042 super(LOCALE_SET_NS_ID, "localeSet", true); 71043 this.locale = new _xfa_object.XFAObjectArray(); 71044 } 71045 71046} 71047 71048class Meridiem extends _xfa_object.StringObject { 71049 constructor(attributes) { 71050 super(LOCALE_SET_NS_ID, "meridiem"); 71051 } 71052 71053} 71054 71055class MeridiemNames extends _xfa_object.XFAObject { 71056 constructor(attributes) { 71057 super(LOCALE_SET_NS_ID, "meridiemNames", true); 71058 this.meridiem = new _xfa_object.XFAObjectArray(2); 71059 } 71060 71061} 71062 71063class Month extends _xfa_object.StringObject { 71064 constructor(attributes) { 71065 super(LOCALE_SET_NS_ID, "month"); 71066 } 71067 71068} 71069 71070class MonthNames extends _xfa_object.XFAObject { 71071 constructor(attributes) { 71072 super(LOCALE_SET_NS_ID, "monthNames", true); 71073 this.abbr = (0, _utils.getInteger)({ 71074 data: attributes.abbr, 71075 defaultValue: 0, 71076 validate: x => x === 1 71077 }); 71078 this.month = new _xfa_object.XFAObjectArray(12); 71079 } 71080 71081} 71082 71083class NumberPattern extends _xfa_object.StringObject { 71084 constructor(attributes) { 71085 super(LOCALE_SET_NS_ID, "numberPattern"); 71086 this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]); 71087 } 71088 71089} 71090 71091class NumberPatterns extends _xfa_object.XFAObject { 71092 constructor(attributes) { 71093 super(LOCALE_SET_NS_ID, "numberPatterns", true); 71094 this.numberPattern = new _xfa_object.XFAObjectArray(4); 71095 } 71096 71097} 71098 71099class NumberSymbol extends _xfa_object.StringObject { 71100 constructor(attributes) { 71101 super(LOCALE_SET_NS_ID, "numberSymbol"); 71102 this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]); 71103 } 71104 71105} 71106 71107class NumberSymbols extends _xfa_object.XFAObject { 71108 constructor(attributes) { 71109 super(LOCALE_SET_NS_ID, "numberSymbols", true); 71110 this.numberSymbol = new _xfa_object.XFAObjectArray(5); 71111 } 71112 71113} 71114 71115class TimePattern extends _xfa_object.StringObject { 71116 constructor(attributes) { 71117 super(LOCALE_SET_NS_ID, "timePattern"); 71118 this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]); 71119 } 71120 71121} 71122 71123class TimePatterns extends _xfa_object.XFAObject { 71124 constructor(attributes) { 71125 super(LOCALE_SET_NS_ID, "timePatterns", true); 71126 this.timePattern = new _xfa_object.XFAObjectArray(4); 71127 } 71128 71129} 71130 71131class TypeFace extends _xfa_object.XFAObject { 71132 constructor(attributes) { 71133 super(LOCALE_SET_NS_ID, "typeFace", true); 71134 this.name = attributes.name | ""; 71135 } 71136 71137} 71138 71139class TypeFaces extends _xfa_object.XFAObject { 71140 constructor(attributes) { 71141 super(LOCALE_SET_NS_ID, "typeFaces", true); 71142 this.typeFace = new _xfa_object.XFAObjectArray(); 71143 } 71144 71145} 71146 71147class LocaleSetNamespace { 71148 static [_namespaces.$buildXFAObject](name, attributes) { 71149 if (LocaleSetNamespace.hasOwnProperty(name)) { 71150 return LocaleSetNamespace[name](attributes); 71151 } 71152 71153 return undefined; 71154 } 71155 71156 static calendarSymbols(attrs) { 71157 return new CalendarSymbols(attrs); 71158 } 71159 71160 static currencySymbol(attrs) { 71161 return new CurrencySymbol(attrs); 71162 } 71163
71164 static currencySymbols(attrs) { 71165 return new CurrencySymbols(attrs); 71166 } 71167 71168 static datePattern(attrs) { 71169 return new DatePattern(attrs); 71170 } 71171 71172 static datePatterns(attrs) { 71173 return new DatePatterns(attrs); 71174 } 71175 71176 static dateTimeSymbols(attrs) { 71177 return new DateTimeSymbols(attrs); 71178 } 71179 71180 static day(attrs) { 71181 return new Day(attrs); 71182 } 71183 71184 static dayNames(attrs) { 71185 return new DayNames(attrs); 71186 } 71187 71188 static era(attrs) { 71189 return new Era(attrs); 71190 } 71191 71192 static eraNames(attrs) { 71193 return new EraNames(attrs); 71194 } 71195 71196 static locale(attrs) { 71197 return new Locale(attrs); 71198 } 71199 71200 static localeSet(attrs) { 71201 return new LocaleSet(attrs); 71202 } 71203 71204 static meridiem(attrs) { 71205 return new Meridiem(attrs); 71206 } 71207 71208 static meridiemNames(attrs) { 71209 return new MeridiemNames(attrs); 71210 } 71211 71212 static month(attrs) { 71213 return new Month(attrs); 71214 } 71215 71216 static monthNames(attrs) { 71217 return new MonthNames(attrs); 71218 } 71219 71220 static numberPattern(attrs) { 71221 return new NumberPattern(attrs); 71222 } 71223 71224 static numberPatterns(attrs) { 71225 return new NumberPatterns(attrs); 71226 } 71227 71228 static numberSymbol(attrs) { 71229 return new NumberSymbol(attrs); 71230 } 71231 71232 static numberSymbols(attrs) { 71233 return new NumberSymbols(attrs); 71234 } 71235 71236 static timePattern(attrs) { 71237 return new TimePattern(attrs); 71238 } 71239 71240 static timePatterns(attrs) { 71241 return new TimePatterns(attrs); 71242 } 71243 71244 static typeFace(attrs) { 71245 return new TypeFace(attrs); 71246 } 71247 71248 static typeFaces(attrs) { 71249 return new TypeFaces(attrs); 71250 } 71251 71252} 71253 71254exports.LocaleSetNamespace = LocaleSetNamespace; 71255 71256/***/ }), 71257/* 93 */ 71258/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 71259 71260 71261 71262Object.defineProperty(exports, "__esModule", ({ 71263 value: true 71264})); 71265exports.SignatureNamespace = void 0; 71266 71267var _namespaces = __w_pdfjs_require__(77); 71268 71269var _xfa_object = __w_pdfjs_require__(75); 71270 71271const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id; 71272 71273class Signature extends _xfa_object.XFAObject { 71274 constructor(attributes) { 71275 super(SIGNATURE_NS_ID, "signature", true); 71276 } 71277 71278} 71279 71280class SignatureNamespace { 71281 static [_namespaces.$buildXFAObject](name, attributes) { 71282 if (SignatureNamespace.hasOwnProperty(name)) { 71283 return SignatureNamespace[name](attributes); 71284 } 71285 71286 return undefined; 71287 } 71288 71289 static signature(attributes) { 71290 return new Signature(attributes); 71291 } 71292 71293} 71294 71295exports.SignatureNamespace = SignatureNamespace; 71296 71297/***/ }), 71298/* 94 */ 71299/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 71300 71301 71302 71303Object.defineProperty(exports, "__esModule", ({ 71304 value: true 71305})); 71306exports.StylesheetNamespace = void 0; 71307 71308var _namespaces = __w_pdfjs_require__(77); 71309 71310var _xfa_object = __w_pdfjs_require__(75); 71311 71312const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id; 71313 71314class Stylesheet extends _xfa_object.XFAObject { 71315 constructor(attributes) { 71316 super(STYLESHEET_NS_ID, "stylesheet", true); 71317 } 71318 71319} 71320 71321class StylesheetNamespace { 71322 static [_namespaces.$buildXFAObject](name, attributes) { 71323 if (StylesheetNamespace.hasOwnProperty(name)) { 71324 return StylesheetNamespace[name](attributes); 71325 } 71326 71327 return undefined; 71328 } 71329 71330 static stylesheet(attributes) { 71331 return new Stylesheet(attributes); 71332 } 71333 71334} 71335 71336exports.StylesheetNamespace = StylesheetNamespace; 71337 71338/***/ }), 71339/* 95 */ 71340/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 71341 71342 71343 71344Object.defineProperty(exports, "__esModule", ({ 71345 value: true 71346})); 71347exports.XdpNamespace = void 0; 71348 71349var _namespaces = __w_pdfjs_require__(77); 71350 71351var _xfa_object = __w_pdfjs_require__(75); 71352 71353const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id; 71354 71355class Xdp extends _xfa_object.XFAObject { 71356 constructor(attributes) { 71357 super(XDP_NS_ID, "xdp", true); 71358 this.uuid = attributes.uuid || ""; 71359 this.timeStamp = attributes.timeStamp || ""; 71360 this.config = null; 71361 this.connectionSet = null; 71362 this.datasets = null; 71363 this.localeSet = null; 71364 this.stylesheet = new _xfa_object.XFAObjectArray(); 71365 this.template = null; 71366 } 71367 71368 [_xfa_object.$onChildCheck](child) { 71369 const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]]; 71370 return ns && child[_xfa_object.$namespaceId] === ns.id; 71371 } 71372 71373} 71374 71375class XdpNamespace { 71376 static [_namespaces.$buildXFAObject](name, attributes) { 71377 if (XdpNamespace.hasOwnProperty(name)) { 71378 return XdpNamespace[name](attributes); 71379 } 71380 71381 return undefined; 71382 } 71383 71384 static xdp(attributes) { 71385 return new Xdp(attributes); 71386 } 71387 71388} 71389 71390exports.XdpNamespace = XdpNamespace; 71391 71392/***/ }), 71393/* 96 */ 71394/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 71395 71396 71397 71398Object.defineProperty(exports, "__esModule", ({ 71399 value: true 71400})); 71401exports.XhtmlNamespace = void 0; 71402 71403var _xfa_object = __w_pdfjs_require__(75); 71404 71405var _namespaces = __w_pdfjs_require__(77); 71406 71407var _html_utils = __w_pdfjs_require__(82); 71408 71409var _utils = __w_pdfjs_require__(76); 71410 71411const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id; 71412const $richText = Symbol(); 71413const 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"]); 71414const 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) => { 71415 value = original.fontSize = (0, _utils.getMeasurement)(value); 71416 return (0, _html_utils.measureToString)(0.99 * value); 71417}], ["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))]]);
71418const spacesRegExp = /\s+/g; 71419const crlfRegExp = /[\r\n]+/g; 71420const crlfForRichTextRegExp = /\r\n?/g; 71421 71422function mapStyle(styleStr, node, richText) { 71423 const style = Object.create(null); 71424 71425 if (!styleStr) { 71426 return style; 71427 } 71428 71429 const original = Object.create(null); 71430 71431 for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) { 71432 const mapping = StyleMapping.get(key); 71433 71434 if (mapping === "") { 71435 continue; 71436 } 71437 71438 let newValue = value; 71439 71440 if (mapping) { 71441 if (typeof mapping === "string") { 71442 newValue = mapping; 71443 } else { 71444 newValue = mapping(value, original); 71445 } 71446 } 71447 71448 if (key.endsWith("scale")) { 71449 if (style.transform) { 71450 style.transform = `${style[key]} ${newValue}`; 71451 } else { 71452 style.transform = newValue; 71453 } 71454 } else { 71455 style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue; 71456 } 71457 } 71458 71459 if (style.fontFamily) { 71460 (0, _html_utils.setFontFamily)({ 71461 typeface: style.fontFamily, 71462 weight: style.fontWeight || "normal", 71463 posture: style.fontStyle || "normal", 71464 size: original.fontSize || 0 71465 }, node, node[_xfa_object.$globalData].fontFinder, style); 71466 } 71467 71468 if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) { 71469 const SUB_SUPER_SCRIPT_FACTOR = 0.583; 71470 const VERTICAL_FACTOR = 0.333; 71471 const fontSize = (0, _utils.getMeasurement)(style.fontSize); 71472 style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR); 71473 style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR); 71474 } 71475 71476 (0, _html_utils.fixTextIndent)(style); 71477 return style; 71478} 71479 71480function checkStyle(node) { 71481 if (!node.style) { 71482 return ""; 71483 } 71484 71485 return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => { 71486 if (key === "font-family") { 71487 node[_xfa_object.$globalData].usedTypefaces.add(value); 71488 } 71489 71490 return VALID_STYLES.has(key); 71491 }).map(kv => kv.join(":")).join(";"); 71492} 71493 71494const NoWhites = new Set(["body", "html"]); 71495 71496class XhtmlObject extends _xfa_object.XmlObject { 71497 constructor(attributes, name) { 71498 super(XHTML_NS_ID, name); 71499 this[$richText] = false; 71500 this.style = attributes.style || ""; 71501 } 71502 71503 [_xfa_object.$clean](builder) { 71504 super[_xfa_object.$clean](builder); 71505 71506 this.style = checkStyle(this); 71507 } 71508 71509 [_xfa_object.$acceptWhitespace]() { 71510 return !NoWhites.has(this[_xfa_object.$nodeName]); 71511 } 71512 71513 [_xfa_object.$onText](str, richText = false) { 71514 if (!richText) { 71515 str = str.replace(crlfRegExp, ""); 71516 71517 if (!this.style.includes("xfa-spacerun:yes")) { 71518 str = str.replace(spacesRegExp, " "); 71519 } 71520 } else { 71521 this[$richText] = true; 71522 } 71523 71524 if (str) { 71525 this[_xfa_object.$content] += str; 71526 } 71527 } 71528 71529 [_xfa_object.$pushGlyphs](measure, mustPop = true) { 71530 const xfaFont = Object.create(null); 71531 const margin = { 71532 top: NaN, 71533 bottom: NaN, 71534 left: NaN, 71535 right: NaN 71536 }; 71537 let lineHeight = null; 71538 71539 for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) { 71540 switch (key) { 71541 case "font-family": 71542 xfaFont.typeface = (0, _utils.stripQuotes)(value); 71543 break; 71544 71545 case "font-size": 71546 xfaFont.size = (0, _utils.getMeasurement)(value); 71547 break; 71548 71549 case "font-weight": 71550 xfaFont.weight = value; 71551 break; 71552 71553 case "font-style": 71554 xfaFont.posture = value; 71555 break; 71556 71557 case "letter-spacing": 71558 xfaFont.letterSpacing = (0, _utils.getMeasurement)(value); 71559 break; 71560 71561 case "margin": 71562 const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x)); 71563 71564 switch (values.length) { 71565 case 1: 71566 margin.top = margin.bottom = margin.left = margin.right = values[0]; 71567 break; 71568 71569 case 2: 71570 margin.top = margin.bottom = values[0]; 71571 margin.left = margin.right = values[1]; 71572 break; 71573 71574 case 3: 71575 margin.top = values[0]; 71576 margin.bottom = values[2]; 71577 margin.left = margin.right = values[1]; 71578 break; 71579 71580 case 4: 71581 margin.top = values[0]; 71582 margin.left = values[1]; 71583 margin.bottom = values[2]; 71584 margin.right = values[3]; 71585 break; 71586 } 71587 71588 break; 71589 71590 case "margin-top": 71591 margin.top = (0, _utils.getMeasurement)(value); 71592 break; 71593 71594 case "margin-bottom": 71595 margin.bottom = (0, _utils.getMeasurement)(value); 71596 break; 71597 71598 case "margin-left": 71599 margin.left = (0, _utils.getMeasurement)(value); 71600 break; 71601 71602 case "margin-right": 71603 margin.right = (0, _utils.getMeasurement)(value); 71604 break; 71605 71606 case "line-height": 71607 lineHeight = (0, _utils.getMeasurement)(value); 71608 break; 71609 } 71610 } 71611
71612 measure.pushData(xfaFont, margin, lineHeight); 71613 71614 if (this[_xfa_object.$content]) { 71615 measure.addString(this[_xfa_object.$content]); 71616 } else { 71617 for (const child of this[_xfa_object.$getChildren]()) { 71618 if (child[_xfa_object.$nodeName] === "#text") { 71619 measure.addString(child[_xfa_object.$content]); 71620 continue; 71621 } 71622 71623 child[_xfa_object.$pushGlyphs](measure); 71624 } 71625 } 71626 71627 if (mustPop) { 71628 measure.popFont(); 71629 } 71630 } 71631 71632 [_xfa_object.$toHTML](availableSpace) { 71633 const children = []; 71634 this[_xfa_object.$extra] = { 71635 children 71636 }; 71637 71638 this[_xfa_object.$childrenToHTML]({}); 71639 71640 if (children.length === 0 && !this[_xfa_object.$content]) { 71641 return _utils.HTMLResult.EMPTY; 71642 } 71643 71644 let value; 71645 71646 if (this[$richText]) { 71647 value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined; 71648 } else { 71649 value = this[_xfa_object.$content] || undefined; 71650 } 71651 71652 return _utils.HTMLResult.success({ 71653 name: this[_xfa_object.$nodeName], 71654 attributes: { 71655 href: this.href, 71656 style: mapStyle(this.style, this, this[$richText]) 71657 }, 71658 children, 71659 value 71660 }); 71661 } 71662 71663} 71664 71665class A extends XhtmlObject { 71666 constructor(attributes) { 71667 super(attributes, "a"); 71668 this.href = (0, _html_utils.fixURL)(attributes.href) || ""; 71669 } 71670 71671} 71672 71673class B extends XhtmlObject { 71674 constructor(attributes) { 71675 super(attributes, "b"); 71676 } 71677 71678 [_xfa_object.$pushGlyphs](measure) { 71679 measure.pushFont({ 71680 weight: "bold" 71681 }); 71682 71683 super[_xfa_object.$pushGlyphs](measure); 71684 71685 measure.popFont(); 71686 } 71687 71688} 71689 71690class Body extends XhtmlObject { 71691 constructor(attributes) { 71692 super(attributes, "body"); 71693 } 71694 71695 [_xfa_object.$toHTML](availableSpace) { 71696 const res = super[_xfa_object.$toHTML](availableSpace); 71697 71698 const { 71699 html 71700 } = res; 71701 71702 if (!html) { 71703 return _utils.HTMLResult.EMPTY; 71704 } 71705 71706 html.name = "div"; 71707 html.attributes.class = ["xfaRich"]; 71708 return res; 71709 } 71710 71711} 71712 71713class Br extends XhtmlObject { 71714 constructor(attributes) { 71715 super(attributes, "br"); 71716 } 71717 71718 [_xfa_object.$text]() { 71719 return "\n"; 71720 } 71721 71722 [_xfa_object.$pushGlyphs](measure) { 71723 measure.addString("\n"); 71724 } 71725 71726 [_xfa_object.$toHTML](availableSpace) { 71727 return _utils.HTMLResult.success({ 71728 name: "br" 71729 }); 71730 } 71731 71732} 71733 71734class Html extends XhtmlObject { 71735 constructor(attributes) { 71736 super(attributes, "html"); 71737 } 71738 71739 [_xfa_object.$toHTML](availableSpace) { 71740 const children = []; 71741 this[_xfa_object.$extra] = { 71742 children 71743 }; 71744 71745 this[_xfa_object.$childrenToHTML]({}); 71746 71747 if (children.length === 0) { 71748 return _utils.HTMLResult.success({ 71749 name: "div", 71750 attributes: { 71751 class: ["xfaRich"], 71752 style: {} 71753 }, 71754 value: this[_xfa_object.$content] || "" 71755 }); 71756 } 71757 71758 if (children.length === 1) { 71759 const child = children[0]; 71760 71761 if (child.attributes && child.attributes.class.includes("xfaRich")) { 71762 return _utils.HTMLResult.success(child); 71763 } 71764 } 71765 71766 return _utils.HTMLResult.success({ 71767 name: "div", 71768 attributes: { 71769 class: ["xfaRich"], 71770 style: {} 71771 }, 71772 children 71773 }); 71774 } 71775 71776} 71777 71778class I extends XhtmlObject { 71779 constructor(attributes) { 71780 super(attributes, "i"); 71781 } 71782 71783 [_xfa_object.$pushGlyphs](measure) { 71784 measure.pushFont({ 71785 posture: "italic" 71786 }); 71787 71788 super[_xfa_object.$pushGlyphs](measure); 71789 71790 measure.popFont(); 71791 } 71792 71793} 71794 71795class Li extends XhtmlObject { 71796 constructor(attributes) { 71797 super(attributes, "li"); 71798 } 71799 71800} 71801 71802class Ol extends XhtmlObject { 71803 constructor(attributes) { 71804 super(attributes, "ol"); 71805 } 71806 71807} 71808 71809class P extends XhtmlObject { 71810 constructor(attributes) { 71811 super(attributes, "p"); 71812 } 71813 71814 [_xfa_object.$pushGlyphs](measure) { 71815 super[_xfa_object.$pushGlyphs](measure, false); 71816 71817 measure.addString("\n"); 71818 measure.addPara(); 71819 measure.popFont(); 71820 } 71821 71822 [_xfa_object.$text]() { 71823 const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren](); 71824 71825 if (siblings[siblings.length - 1] === this) { 71826 return super[_xfa_object.$text](); 71827 } 71828 71829 return super[_xfa_object.$text]() + "\n"; 71830 } 71831 71832} 71833 71834class Span extends XhtmlObject { 71835 constructor(attributes) { 71836 super(attributes, "span"); 71837 } 71838 71839} 71840 71841class Sub extends XhtmlObject { 71842 constructor(attributes) { 71843 super(attributes, "sub"); 71844 } 71845 71846} 71847 71848class Sup extends XhtmlObject { 71849 constructor(attributes) { 71850 super(attributes, "sup"); 71851 } 71852 71853} 71854 71855class Ul extends XhtmlObject { 71856 constructor(attributes) { 71857 super(attributes, "ul"); 71858 } 71859 71860} 71861 71862class XhtmlNamespace { 71863 static [_namespaces.$buildXFAObject](name, attributes) { 71864 if (XhtmlNamespace.hasOwnProperty(name)) { 71865 return XhtmlNamespace[name](attributes); 71866 } 71867 71868 return undefined; 71869 } 71870 71871 static a(attributes) { 71872 return new A(attributes); 71873 } 71874 71875 static b(attributes) { 71876 return new B(attributes); 71877 } 71878 71879 static body(attributes) { 71880 return new Body(attributes); 71881 } 71882 71883 static br(attributes) { 71884 return new Br(attributes); 71885 } 71886 71887 static html(attributes) { 71888 return new Html(attributes); 71889 } 71890 71891 static i(attributes) { 71892 return new I(attributes); 71893 } 71894 71895 static li(attributes) { 71896 return new Li(attributes); 71897 } 71898 71899 static ol(attributes) { 71900 return new Ol(attributes); 71901 } 71902 71903 static p(attributes) { 71904 return new P(attributes); 71905 } 71906 71907 static span(attributes) { 71908 return new Span(attributes); 71909 } 71910 71911 static sub(attributes) { 71912 return new Sub(attributes); 71913 } 71914 71915 static sup(attributes) { 71916 return new Sup(attributes); 71917 } 71918 71919 static ul(attributes) { 71920 return new Ul(attributes); 71921 } 71922 71923} 71924 71925exports.XhtmlNamespace = XhtmlNamespace; 71926 71927/***/ }), 71928/* 97 */ 71929/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 71930 71931 71932 71933Object.defineProperty(exports, "__esModule", ({ 71934 value: true 71935})); 71936exports.UnknownNamespace = void 0; 71937 71938var _namespaces = __w_pdfjs_require__(77); 71939 71940var _xfa_object = __w_pdfjs_require__(75); 71941 71942class UnknownNamespace { 71943 constructor(nsId) { 71944 this.namespaceId = nsId; 71945 } 71946 71947 [_namespaces.$buildXFAObject](name, attributes) { 71948 return new _xfa_object.XmlObject(this.namespaceId, name, attributes); 71949 } 71950 71951} 71952 71953exports.UnknownNamespace = UnknownNamespace; 71954 71955/***/ }), 71956/* 98 */ 71957/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 71958 71959 71960 71961Object.defineProperty(exports, "__esModule", ({ 71962 value: true 71963})); 71964exports.XRef = void 0; 71965 71966var _util = __w_pdfjs_require__(2); 71967 71968var _primitives = __w_pdfjs_require__(5); 71969 71970var _core_utils = __w_pdfjs_require__(9); 71971 71972var _parser = __w_pdfjs_require__(27); 71973 71974var _base_stream = __w_pdfjs_require__(6); 71975 71976var _crypto = __w_pdfjs_require__(72); 71977 71978class XRef {
71979 constructor(stream, pdfManager) { 71980 this.stream = stream; 71981 this.pdfManager = pdfManager; 71982 this.entries = []; 71983 this.xrefstms = Object.create(null); 71984 this._cacheMap = new Map(); 71985 this._pendingRefs = new _primitives.RefSet(); 71986 this.stats = new _core_utils.DocStats(pdfManager.msgHandler); 71987 this._newRefNum = null; 71988 } 71989 71990 getNewRef() { 71991 if (this._newRefNum === null) { 71992 this._newRefNum = this.entries.length; 71993 } 71994 71995 return _primitives.Ref.get(this._newRefNum++, 0); 71996 } 71997 71998 resetNewRef() { 71999 this._newRefNum = null; 72000 } 72001 72002 setStartXRef(startXRef) { 72003 this.startXRefQueue = [startXRef]; 72004 } 72005 72006 parse(recoveryMode = false) { 72007 let trailerDict; 72008 72009 if (!recoveryMode) { 72010 trailerDict = this.readXRef(); 72011 } else { 72012 (0, _util.warn)("Indexing all PDF objects"); 72013 trailerDict = this.indexObjects(); 72014 } 72015 72016 trailerDict.assignXref(this); 72017 this.trailer = trailerDict; 72018 let encrypt; 72019 72020 try { 72021 encrypt = trailerDict.get("Encrypt"); 72022 } catch (ex) { 72023 if (ex instanceof _core_utils.MissingDataException) { 72024 throw ex; 72025 } 72026 72027 (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`); 72028 } 72029 72030 if (encrypt instanceof _primitives.Dict) { 72031 const ids = trailerDict.get("ID"); 72032 const fileId = ids && ids.length ? ids[0] : ""; 72033 encrypt.suppressEncryption = true; 72034 this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password); 72035 } 72036 72037 let root; 72038 72039 try { 72040 root = trailerDict.get("Root"); 72041 } catch (ex) { 72042 if (ex instanceof _core_utils.MissingDataException) { 72043 throw ex; 72044 } 72045 72046 (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`); 72047 } 72048 72049 if (root instanceof _primitives.Dict) { 72050 try { 72051 const pages = root.get("Pages"); 72052 72053 if (pages instanceof _primitives.Dict) { 72054 this.root = root; 72055 return; 72056 } 72057 } catch (ex) { 72058 if (ex instanceof _core_utils.MissingDataException) { 72059 throw ex; 72060 } 72061 72062 (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`); 72063 } 72064 } 72065 72066 if (!recoveryMode) { 72067 throw new _core_utils.XRefParseException(); 72068 } 72069 72070 throw new _util.InvalidPDFException("Invalid Root reference."); 72071 } 72072 72073 processXRefTable(parser) { 72074 if (!("tableState" in this)) { 72075 this.tableState = { 72076 entryNum: 0, 72077 streamPos: parser.lexer.stream.pos, 72078 parserBuf1: parser.buf1, 72079 parserBuf2: parser.buf2 72080 }; 72081 } 72082 72083 const obj = this.readXRefTable(parser); 72084 72085 if (!(0, _primitives.isCmd)(obj, "trailer")) { 72086 throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary"); 72087 } 72088 72089 let dict = parser.getObj(); 72090 72091 if (!(dict instanceof _primitives.Dict) && dict.dict) { 72092 dict = dict.dict; 72093 } 72094 72095 if (!(dict instanceof _primitives.Dict)) { 72096 throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary"); 72097 } 72098 72099 delete this.tableState; 72100 return dict; 72101 } 72102 72103 readXRefTable(parser) { 72104 const stream = parser.lexer.stream; 72105 const tableState = this.tableState; 72106 stream.pos = tableState.streamPos; 72107 parser.buf1 = tableState.parserBuf1; 72108 parser.buf2 = tableState.parserBuf2; 72109 let obj; 72110 72111 while (true) { 72112 if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) { 72113 if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) { 72114 break; 72115 } 72116 72117 tableState.firstEntryNum = obj; 72118 tableState.entryCount = parser.getObj(); 72119 } 72120 72121 let first = tableState.firstEntryNum; 72122 const count = tableState.entryCount; 72123 72124 if (!Number.isInteger(first) || !Number.isInteger(count)) { 72125 throw new _util.FormatError("Invalid XRef table: wrong types in subsection header"); 72126 } 72127 72128 for (let i = tableState.entryNum; i < count; i++) { 72129 tableState.streamPos = stream.pos; 72130 tableState.entryNum = i; 72131 tableState.parserBuf1 = parser.buf1; 72132 tableState.parserBuf2 = parser.buf2; 72133 const entry = {}; 72134 entry.offset = parser.getObj(); 72135 entry.gen = parser.getObj(); 72136 const type = parser.getObj(); 72137 72138 if (type instanceof _primitives.Cmd) { 72139 switch (type.cmd) { 72140 case "f": 72141 entry.free = true; 72142 break; 72143 72144 case "n": 72145 entry.uncompressed = true; 72146 break; 72147 } 72148 } 72149 72150 if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) { 72151 throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`); 72152 } 72153 72154 if (i === 0 && entry.free && first === 1) { 72155 first = 0; 72156 } 72157 72158 if (!this.entries[i + first]) { 72159 this.entries[i + first] = entry; 72160 } 72161 } 72162 72163 tableState.entryNum = 0; 72164 tableState.streamPos = stream.pos; 72165 tableState.parserBuf1 = parser.buf1; 72166 tableState.parserBuf2 = parser.buf2; 72167 delete tableState.firstEntryNum; 72168 delete tableState.entryCount; 72169 } 72170 72171 if (this.entries[0] && !this.entries[0].free) { 72172 throw new _util.FormatError("Invalid XRef table: unexpected first object"); 72173 } 72174 72175 return obj; 72176 } 72177 72178 processXRefStream(stream) { 72179 if (!("streamState" in this)) { 72180 const streamParameters = stream.dict;
vendor: 5,442 bytes, lines 72181-72391
72181 const byteWidths = streamParameters.get("W"); 72182 let range = streamParameters.get("Index"); 72183 72184 if (!range) { 72185 range = [0, streamParameters.get("Size")]; 72186 } 72187 72188 this.streamState = { 72189 entryRanges: range, 72190 byteWidths, 72191 entryNum: 0, 72192 streamPos: stream.pos 72193 }; 72194 } 72195 72196 this.readXRefStream(stream); 72197 delete this.streamState; 72198 return stream.dict; 72199 } 72200 72201 readXRefStream(stream) { 72202 const streamState = this.streamState; 72203 stream.pos = streamState.streamPos; 72204 const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths; 72205 const entryRanges = streamState.entryRanges; 72206 72207 while (entryRanges.length > 0) { 72208 const [first, n] = entryRanges; 72209 72210 if (!Number.isInteger(first) || !Number.isInteger(n)) { 72211 throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`); 72212 } 72213 72214 if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) { 72215 throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`); 72216 } 72217 72218 for (let i = streamState.entryNum; i < n; ++i) { 72219 streamState.entryNum = i; 72220 streamState.streamPos = stream.pos; 72221 let type = 0, 72222 offset = 0, 72223 generation = 0; 72224 72225 for (let j = 0; j < typeFieldWidth; ++j) { 72226 const typeByte = stream.getByte(); 72227 72228 if (typeByte === -1) { 72229 throw new _util.FormatError("Invalid XRef byteWidths 'type'."); 72230 } 72231 72232 type = type << 8 | typeByte; 72233 } 72234 72235 if (typeFieldWidth === 0) { 72236 type = 1; 72237 } 72238 72239 for (let j = 0; j < offsetFieldWidth; ++j) { 72240 const offsetByte = stream.getByte(); 72241 72242 if (offsetByte === -1) { 72243 throw new _util.FormatError("Invalid XRef byteWidths 'offset'."); 72244 } 72245 72246 offset = offset << 8 | offsetByte; 72247 } 72248 72249 for (let j = 0; j < generationFieldWidth; ++j) { 72250 const generationByte = stream.getByte(); 72251 72252 if (generationByte === -1) { 72253 throw new _util.FormatError("Invalid XRef byteWidths 'generation'."); 72254 } 72255 72256 generation = generation << 8 | generationByte; 72257 } 72258 72259 const entry = {}; 72260 entry.offset = offset; 72261 entry.gen = generation; 72262 72263 switch (type) { 72264 case 0: 72265 entry.free = true; 72266 break; 72267 72268 case 1: 72269 entry.uncompressed = true; 72270 break; 72271 72272 case 2: 72273 break; 72274 72275 default: 72276 throw new _util.FormatError(`Invalid XRef entry type: ${type}`); 72277 } 72278 72279 if (!this.entries[first + i]) { 72280 this.entries[first + i] = entry; 72281 } 72282 } 72283 72284 streamState.entryNum = 0; 72285 streamState.streamPos = stream.pos; 72286 entryRanges.splice(0, 2); 72287 } 72288 } 72289 72290 indexObjects() { 72291 const TAB = 0x9, 72292 LF = 0xa, 72293 CR = 0xd, 72294 SPACE = 0x20; 72295 const PERCENT = 0x25, 72296 LT = 0x3c; 72297 72298 function readToken(data, offset) { 72299 let token = "", 72300 ch = data[offset]; 72301 72302 while (ch !== LF && ch !== CR && ch !== LT) { 72303 if (++offset >= data.length) { 72304 break; 72305 } 72306 72307 token += String.fromCharCode(ch); 72308 ch = data[offset]; 72309 } 72310 72311 return token; 72312 } 72313 72314 function skipUntil(data, offset, what) { 72315 const length = what.length, 72316 dataLength = data.length; 72317 let skipped = 0; 72318 72319 while (offset < dataLength) { 72320 let i = 0; 72321 72322 while (i < length && data[offset + i] === what[i]) { 72323 ++i; 72324 } 72325 72326 if (i >= length) { 72327 break; 72328 } 72329 72330 offset++; 72331 skipped++; 72332 } 72333 72334 return skipped; 72335 } 72336 72337 const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/; 72338 const endobjRegExp = /\bendobj[\b\s]$/; 72339 const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/; 72340 const CHECK_CONTENT_LENGTH = 25; 72341 const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]); 72342 const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]); 72343 const objBytes = new Uint8Array([111, 98, 106]); 72344 const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]); 72345 this.entries.length = 0; 72346 72347 this._cacheMap.clear(); 72348 72349 const stream = this.stream; 72350 stream.pos = 0; 72351 const buffer = stream.getBytes(), 72352 length = buffer.length; 72353 let position = stream.start; 72354 const trailers = [], 72355 xrefStms = []; 72356 72357 while (position < length) { 72358 let ch = buffer[position]; 72359 72360 if (ch === TAB || ch === LF || ch === CR || ch === SPACE) { 72361 ++position; 72362 continue; 72363 } 72364 72365 if (ch === PERCENT) { 72366 do { 72367 ++position; 72368 72369 if (position >= length) { 72370 break; 72371 } 72372 72373 ch = buffer[position]; 72374 } while (ch !== LF && ch !== CR); 72375 72376 continue; 72377 } 72378 72379 const token = readToken(buffer, position); 72380 let m; 72381 72382 if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) { 72383 position += skipUntil(buffer, position, trailerBytes); 72384 trailers.push(position); 72385 position += skipUntil(buffer, position, startxrefBytes); 72386 } else if (m = objRegExp.exec(token)) { 72387 const num = m[1] | 0, 72388 gen = m[2] | 0; 72389 let contentLength, 72390 startPos = position + token.length, 72391 updateEntries = false;
72392 72393 if (!this.entries[num]) { 72394 updateEntries = true; 72395 } else if (this.entries[num].gen === gen) { 72396 try { 72397 const parser = new _parser.Parser({ 72398 lexer: new _parser.Lexer(stream.makeSubStream(startPos)) 72399 }); 72400 parser.getObj(); 72401 updateEntries = true; 72402 } catch (ex) { 72403 if (ex instanceof _core_utils.ParserEOFException) { 72404 (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`); 72405 } else { 72406 updateEntries = true; 72407 } 72408 } 72409 } 72410 72411 if (updateEntries) { 72412 this.entries[num] = { 72413 offset: position - stream.start, 72414 gen, 72415 uncompressed: true 72416 }; 72417 } 72418 72419 while (startPos < buffer.length) { 72420 const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4; 72421 contentLength = endPos - position; 72422 const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos); 72423 const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos)); 72424 72425 if (endobjRegExp.test(tokenStr)) { 72426 break; 72427 } else { 72428 const objToken = nestedObjRegExp.exec(tokenStr); 72429 72430 if (objToken && objToken[1]) { 72431 (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.'); 72432 contentLength -= objToken[1].length; 72433 break; 72434 } 72435 } 72436 72437 startPos = endPos; 72438 } 72439 72440 const content = buffer.subarray(position, position + contentLength); 72441 const xrefTagOffset = skipUntil(content, 0, xrefBytes); 72442 72443 if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) { 72444 xrefStms.push(position - stream.start); 72445 this.xrefstms[position - stream.start] = 1; 72446 } 72447 72448 position += contentLength; 72449 } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) { 72450 trailers.push(position); 72451 position += skipUntil(buffer, position, startxrefBytes); 72452 } else { 72453 position += token.length + 1; 72454 } 72455 } 72456 72457 for (let i = 0, ii = xrefStms.length; i < ii; ++i) { 72458 this.startXRefQueue.push(xrefStms[i]); 72459 this.readXRef(true); 72460 } 72461 72462 let trailerDict; 72463 72464 for (let i = 0, ii = trailers.length; i < ii; ++i) { 72465 stream.pos = trailers[i]; 72466 const parser = new _parser.Parser({ 72467 lexer: new _parser.Lexer(stream), 72468 xref: this, 72469 allowStreams: true, 72470 recoveryMode: true 72471 }); 72472 const obj = parser.getObj(); 72473 72474 if (!(0, _primitives.isCmd)(obj, "trailer")) { 72475 continue; 72476 } 72477 72478 const dict = parser.getObj(); 72479 72480 if (!(dict instanceof _primitives.Dict)) { 72481 continue; 72482 } 72483 72484 try { 72485 const rootDict = dict.get("Root"); 72486 72487 if (!(rootDict instanceof _primitives.Dict)) { 72488 continue; 72489 } 72490 72491 const pagesDict = rootDict.get("Pages"); 72492 72493 if (!(pagesDict instanceof _primitives.Dict)) { 72494 continue; 72495 } 72496 72497 const pagesCount = pagesDict.get("Count"); 72498 72499 if (!Number.isInteger(pagesCount)) { 72500 continue; 72501 } 72502 } catch (ex) { 72503 continue; 72504 } 72505 72506 if (dict.has("ID")) { 72507 return dict; 72508 } 72509 72510 trailerDict = dict; 72511 } 72512 72513 if (trailerDict) { 72514 return trailerDict; 72515 } 72516 72517 if (this.topDict) { 72518 return this.topDict; 72519 } 72520 72521 throw new _util.InvalidPDFException("Invalid PDF structure."); 72522 } 72523 72524 readXRef(recoveryMode = false) { 72525 const stream = this.stream; 72526 const startXRefParsedCache = new Set(); 72527 72528 try { 72529 while (this.startXRefQueue.length) { 72530 const startXRef = this.startXRefQueue[0]; 72531 72532 if (startXRefParsedCache.has(startXRef)) { 72533 (0, _util.warn)("readXRef - skipping XRef table since it was already parsed."); 72534 this.startXRefQueue.shift(); 72535 continue; 72536 } 72537 72538 startXRefParsedCache.add(startXRef); 72539 stream.pos = startXRef + stream.start; 72540 const parser = new _parser.Parser({ 72541 lexer: new _parser.Lexer(stream), 72542 xref: this, 72543 allowStreams: true 72544 }); 72545 let obj = parser.getObj(); 72546 let dict; 72547 72548 if ((0, _primitives.isCmd)(obj, "xref")) { 72549 dict = this.processXRefTable(parser); 72550 72551 if (!this.topDict) { 72552 this.topDict = dict; 72553 } 72554 72555 obj = dict.get("XRefStm"); 72556 72557 if (Number.isInteger(obj)) { 72558 const pos = obj; 72559 72560 if (!(pos in this.xrefstms)) { 72561 this.xrefstms[pos] = 1; 72562 this.startXRefQueue.push(pos); 72563 } 72564 } 72565 } else if (Number.isInteger(obj)) { 72566 if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) { 72567 throw new _util.FormatError("Invalid XRef stream"); 72568 } 72569 72570 dict = this.processXRefStream(obj); 72571 72572 if (!this.topDict) { 72573 this.topDict = dict; 72574 } 72575 72576 if (!dict) { 72577 throw new _util.FormatError("Failed to read XRef stream"); 72578 } 72579 } else { 72580 throw new _util.FormatError("Invalid XRef stream header"); 72581 } 72582 72583 obj = dict.get("Prev"); 72584 72585 if (Number.isInteger(obj)) { 72586 this.startXRefQueue.push(obj); 72587 } else if (obj instanceof _primitives.Ref) { 72588 this.startXRefQueue.push(obj.num); 72589 } 72590 72591 this.startXRefQueue.shift(); 72592 } 72593 72594 return this.topDict; 72595 } catch (e) { 72596 if (e instanceof _core_utils.MissingDataException) { 72597 throw e; 72598 } 72599 72600 (0, _util.info)("(while reading XRef): " + e); 72601 this.startXRefQueue.shift(); 72602 } 72603 72604 if (recoveryMode) { 72605 return undefined; 72606 } 72607 72608 throw new _core_utils.XRefParseException(); 72609 } 72610 72611 getEntry(i) { 72612 const xrefEntry = this.entries[i]; 72613 72614 if (xrefEntry && !xrefEntry.free && xrefEntry.offset) { 72615 return xrefEntry; 72616 } 72617 72618 return null; 72619 } 72620 72621 fetchIfRef(obj, suppressEncryption = false) { 72622 if (obj instanceof _primitives.Ref) { 72623 return this.fetch(obj, suppressEncryption); 72624 } 72625 72626 return obj; 72627 } 72628 72629 fetch(ref, suppressEncryption = false) { 72630 if (!(ref instanceof _primitives.Ref)) { 72631 throw new Error("ref object is not a reference"); 72632 } 72633 72634 const num = ref.num; 72635 72636 const cacheEntry = this._cacheMap.get(num); 72637 72638 if (cacheEntry !== undefined) { 72639 if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) { 72640 cacheEntry.objId = ref.toString(); 72641 } 72642 72643 return cacheEntry; 72644 } 72645 72646 let xrefEntry = this.getEntry(num); 72647 72648 if (xrefEntry === null) { 72649 this._cacheMap.set(num, xrefEntry); 72650 72651 return xrefEntry; 72652 } 72653
72654 if (this._pendingRefs.has(ref)) { 72655 this._pendingRefs.remove(ref); 72656 72657 (0, _util.warn)(`Ignoring circular reference: ${ref}.`); 72658 return _primitives.CIRCULAR_REF; 72659 } 72660 72661 this._pendingRefs.put(ref); 72662 72663 try { 72664 if (xrefEntry.uncompressed) { 72665 xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption); 72666 } else { 72667 xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption); 72668 } 72669 72670 this._pendingRefs.remove(ref); 72671 } catch (ex) { 72672 this._pendingRefs.remove(ref); 72673 72674 throw ex; 72675 } 72676 72677 if (xrefEntry instanceof _primitives.Dict) { 72678 xrefEntry.objId = ref.toString(); 72679 } else if (xrefEntry instanceof _base_stream.BaseStream) { 72680 xrefEntry.dict.objId = ref.toString(); 72681 } 72682 72683 return xrefEntry; 72684 } 72685 72686 fetchUncompressed(ref, xrefEntry, suppressEncryption = false) { 72687 const gen = ref.gen; 72688 let num = ref.num; 72689 72690 if (xrefEntry.gen !== gen) { 72691 throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`); 72692 } 72693 72694 const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start); 72695 const parser = new _parser.Parser({ 72696 lexer: new _parser.Lexer(stream), 72697 xref: this, 72698 allowStreams: true 72699 }); 72700 const obj1 = parser.getObj(); 72701 const obj2 = parser.getObj(); 72702 const obj3 = parser.getObj(); 72703 72704 if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) { 72705 throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`); 72706 } 72707 72708 if (obj3.cmd !== "obj") { 72709 if (obj3.cmd.startsWith("obj")) { 72710 num = parseInt(obj3.cmd.substring(3), 10); 72711 72712 if (!Number.isNaN(num)) { 72713 return num; 72714 } 72715 } 72716 72717 throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`); 72718 } 72719 72720 if (this.encrypt && !suppressEncryption) { 72721 xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen)); 72722 } else { 72723 xrefEntry = parser.getObj(); 72724 } 72725 72726 if (!(xrefEntry instanceof _base_stream.BaseStream)) { 72727 this._cacheMap.set(num, xrefEntry); 72728 } 72729 72730 return xrefEntry; 72731 } 72732 72733 fetchCompressed(ref, xrefEntry, suppressEncryption = false) { 72734 const tableOffset = xrefEntry.offset; 72735 const stream = this.fetch(_primitives.Ref.get(tableOffset, 0)); 72736 72737 if (!(stream instanceof _base_stream.BaseStream)) { 72738 throw new _util.FormatError("bad ObjStm stream"); 72739 } 72740 72741 const first = stream.dict.get("First"); 72742 const n = stream.dict.get("N"); 72743 72744 if (!Number.isInteger(first) || !Number.isInteger(n)) { 72745 throw new _util.FormatError("invalid first and n parameters for ObjStm stream"); 72746 } 72747 72748 let parser = new _parser.Parser({ 72749 lexer: new _parser.Lexer(stream), 72750 xref: this, 72751 allowStreams: true 72752 }); 72753 const nums = new Array(n); 72754 const offsets = new Array(n); 72755 72756 for (let i = 0; i < n; ++i) { 72757 const num = parser.getObj(); 72758 72759 if (!Number.isInteger(num)) { 72760 throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`); 72761 } 72762 72763 const offset = parser.getObj(); 72764 72765 if (!Number.isInteger(offset)) { 72766 throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`); 72767 } 72768 72769 nums[i] = num; 72770 offsets[i] = offset; 72771 } 72772 72773 const start = (stream.start || 0) + first; 72774 const entries = new Array(n); 72775 72776 for (let i = 0; i < n; ++i) { 72777 const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined; 72778 72779 if (length < 0) { 72780 throw new _util.FormatError("Invalid offset in the ObjStm stream."); 72781 } 72782 72783 parser = new _parser.Parser({ 72784 lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)), 72785 xref: this, 72786 allowStreams: true 72787 }); 72788 const obj = parser.getObj(); 72789 entries[i] = obj; 72790 72791 if (obj instanceof _base_stream.BaseStream) { 72792 continue; 72793 } 72794 72795 const num = nums[i], 72796 entry = this.entries[num]; 72797 72798 if (entry && entry.offset === tableOffset && entry.gen === i) { 72799 this._cacheMap.set(num, obj); 72800 } 72801 } 72802 72803 xrefEntry = entries[xrefEntry.gen]; 72804 72805 if (xrefEntry === undefined) { 72806 throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`); 72807 } 72808 72809 return xrefEntry; 72810 } 72811 72812 async fetchIfRefAsync(obj, suppressEncryption) { 72813 if (obj instanceof _primitives.Ref) { 72814 return this.fetchAsync(obj, suppressEncryption); 72815 } 72816 72817 return obj; 72818 } 72819 72820 async fetchAsync(ref, suppressEncryption) { 72821 try { 72822 return this.fetch(ref, suppressEncryption); 72823 } catch (ex) { 72824 if (!(ex instanceof _core_utils.MissingDataException)) { 72825 throw ex; 72826 } 72827 72828 await this.pdfManager.requestRange(ex.begin, ex.end); 72829 return this.fetchAsync(ref, suppressEncryption); 72830 } 72831 } 72832 72833 getCatalogObj() { 72834 return this.root; 72835 } 72836 72837} 72838 72839exports.XRef = XRef; 72840 72841/***/ }), 72842/* 99 */ 72843/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 72844 72845 72846 72847Object.defineProperty(exports, "__esModule", ({ 72848 value: true 72849})); 72850exports.MessageHandler = void 0; 72851 72852var _util = __w_pdfjs_require__(2); 72853 72854const CallbackKind = { 72855 UNKNOWN: 0, 72856 DATA: 1, 72857 ERROR: 2 72858}; 72859const StreamKind = { 72860 UNKNOWN: 0, 72861 CANCEL: 1, 72862 CANCEL_COMPLETE: 2, 72863 CLOSE: 3, 72864 ENQUEUE: 4, 72865 ERROR: 5, 72866 PULL: 6, 72867 PULL_COMPLETE: 7, 72868 START_COMPLETE: 8 72869}; 72870 72871function wrapReason(reason) { 72872 if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) { 72873 (0, _util.warn)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'); 72874 return reason; 72875 } 72876 72877 switch (reason.name) { 72878 case "AbortException": 72879 return new _util.AbortException(reason.message); 72880 72881 case "MissingPDFException": 72882 return new _util.MissingPDFException(reason.message); 72883 72884 case "PasswordException": 72885 return new _util.PasswordException(reason.message, reason.code); 72886 72887 case "UnexpectedResponseException": 72888 return new _util.UnexpectedResponseException(reason.message, reason.status); 72889 72890 case "UnknownErrorException": 72891 return new _util.UnknownErrorException(reason.message, reason.details); 72892 72893 default: 72894 return new _util.UnknownErrorException(reason.message, reason.toString()); 72895 } 72896} 72897 72898class MessageHandler {
72899 constructor(sourceName, targetName, comObj) { 72900 this.sourceName = sourceName; 72901 this.targetName = targetName; 72902 this.comObj = comObj; 72903 this.callbackId = 1; 72904 this.streamId = 1; 72905 this.streamSinks = Object.create(null); 72906 this.streamControllers = Object.create(null); 72907 this.callbackCapabilities = Object.create(null); 72908 this.actionHandler = Object.create(null); 72909 72910 this._onComObjOnMessage = event => { 72911 const data = event.data; 72912 72913 if (data.targetName !== this.sourceName) { 72914 return; 72915 } 72916 72917 if (data.stream) { 72918 this._processStreamMessage(data); 72919 72920 return; 72921 } 72922 72923 if (data.callback) { 72924 const callbackId = data.callbackId; 72925 const capability = this.callbackCapabilities[callbackId]; 72926 72927 if (!capability) { 72928 throw new Error(`Cannot resolve callback ${callbackId}`); 72929 } 72930 72931 delete this.callbackCapabilities[callbackId]; 72932 72933 if (data.callback === CallbackKind.DATA) { 72934 capability.resolve(data.data); 72935 } else if (data.callback === CallbackKind.ERROR) { 72936 capability.reject(wrapReason(data.reason)); 72937 } else { 72938 throw new Error("Unexpected callback case"); 72939 } 72940 72941 return; 72942 } 72943 72944 const action = this.actionHandler[data.action]; 72945 72946 if (!action) { 72947 throw new Error(`Unknown action from worker: ${data.action}`); 72948 } 72949 72950 if (data.callbackId) { 72951 const cbSourceName = this.sourceName; 72952 const cbTargetName = data.sourceName; 72953 new Promise(function (resolve) { 72954 resolve(action(data.data)); 72955 }).then(function (result) { 72956 comObj.postMessage({ 72957 sourceName: cbSourceName, 72958 targetName: cbTargetName, 72959 callback: CallbackKind.DATA, 72960 callbackId: data.callbackId, 72961 data: result 72962 }); 72963 }, function (reason) { 72964 comObj.postMessage({ 72965 sourceName: cbSourceName, 72966 targetName: cbTargetName, 72967 callback: CallbackKind.ERROR, 72968 callbackId: data.callbackId, 72969 reason: wrapReason(reason) 72970 }); 72971 }); 72972 return; 72973 } 72974 72975 if (data.streamId) { 72976 this._createStreamSink(data); 72977 72978 return; 72979 } 72980 72981 action(data.data); 72982 }; 72983 72984 comObj.addEventListener("message", this._onComObjOnMessage); 72985 } 72986 72987 on(actionName, handler) { 72988 const ah = this.actionHandler; 72989 72990 if (ah[actionName]) { 72991 throw new Error(`There is already an actionName called "${actionName}"`); 72992 } 72993 72994 ah[actionName] = handler; 72995 } 72996 72997 send(actionName, data, transfers) { 72998 this.comObj.postMessage({ 72999 sourceName: this.sourceName, 73000 targetName: this.targetName, 73001 action: actionName, 73002 data 73003 }, transfers); 73004 } 73005 73006 sendWithPromise(actionName, data, transfers) { 73007 const callbackId = this.callbackId++; 73008 const capability = (0, _util.createPromiseCapability)(); 73009 this.callbackCapabilities[callbackId] = capability; 73010 73011 try { 73012 this.comObj.postMessage({ 73013 sourceName: this.sourceName, 73014 targetName: this.targetName, 73015 action: actionName, 73016 callbackId, 73017 data 73018 }, transfers); 73019 } catch (ex) { 73020 capability.reject(ex); 73021 } 73022 73023 return capability.promise; 73024 } 73025 73026 sendWithStream(actionName, data, queueingStrategy, transfers) { 73027 const streamId = this.streamId++, 73028 sourceName = this.sourceName, 73029 targetName = this.targetName, 73030 comObj = this.comObj; 73031 return new ReadableStream({ 73032 start: controller => { 73033 const startCapability = (0, _util.createPromiseCapability)(); 73034 this.streamControllers[streamId] = { 73035 controller, 73036 startCall: startCapability, 73037 pullCall: null, 73038 cancelCall: null, 73039 isClosed: false 73040 }; 73041 comObj.postMessage({ 73042 sourceName, 73043 targetName, 73044 action: actionName, 73045 streamId, 73046 data, 73047 desiredSize: controller.desiredSize 73048 }, transfers); 73049 return startCapability.promise; 73050 }, 73051 pull: controller => { 73052 const pullCapability = (0, _util.createPromiseCapability)(); 73053 this.streamControllers[streamId].pullCall = pullCapability; 73054 comObj.postMessage({ 73055 sourceName, 73056 targetName, 73057 stream: StreamKind.PULL, 73058 streamId, 73059 desiredSize: controller.desiredSize 73060 }); 73061 return pullCapability.promise; 73062 }, 73063 cancel: reason => { 73064 (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason"); 73065 const cancelCapability = (0, _util.createPromiseCapability)(); 73066 this.streamControllers[streamId].cancelCall = cancelCapability; 73067 this.streamControllers[streamId].isClosed = true; 73068 comObj.postMessage({ 73069 sourceName, 73070 targetName, 73071 stream: StreamKind.CANCEL, 73072 streamId, 73073 reason: wrapReason(reason) 73074 }); 73075 return cancelCapability.promise; 73076 } 73077 }, queueingStrategy); 73078 } 73079 73080 _createStreamSink(data) { 73081 const streamId = data.streamId, 73082 sourceName = this.sourceName, 73083 targetName = data.sourceName, 73084 comObj = this.comObj; 73085 const self = this, 73086 action = this.actionHandler[data.action]; 73087 const streamSink = { 73088 enqueue(chunk, size = 1, transfers) { 73089 if (this.isCancelled) { 73090 return; 73091 } 73092 73093 const lastDesiredSize = this.desiredSize; 73094 this.desiredSize -= size; 73095 73096 if (lastDesiredSize > 0 && this.desiredSize <= 0) { 73097 this.sinkCapability = (0, _util.createPromiseCapability)(); 73098 this.ready = this.sinkCapability.promise; 73099 } 73100 73101 comObj.postMessage({ 73102 sourceName, 73103 targetName, 73104 stream: StreamKind.ENQUEUE, 73105 streamId, 73106 chunk 73107 }, transfers); 73108 }, 73109 73110 close() { 73111 if (this.isCancelled) { 73112 return; 73113 } 73114 73115 this.isCancelled = true; 73116 comObj.postMessage({ 73117 sourceName, 73118 targetName, 73119 stream: StreamKind.CLOSE, 73120 streamId 73121 }); 73122 delete self.streamSinks[streamId]; 73123 }, 73124 73125 error(reason) { 73126 (0, _util.assert)(reason instanceof Error, "error must have a valid reason"); 73127 73128 if (this.isCancelled) { 73129 return; 73130 } 73131 73132 this.isCancelled = true; 73133 comObj.postMessage({ 73134 sourceName, 73135 targetName, 73136 stream: StreamKind.ERROR, 73137 streamId, 73138 reason: wrapReason(reason) 73139 }); 73140 }, 73141 73142 sinkCapability: (0, _util.createPromiseCapability)(), 73143 onPull: null, 73144 onCancel: null, 73145 isCancelled: false, 73146 desiredSize: data.desiredSize, 73147 ready: null 73148 }; 73149 streamSink.sinkCapability.resolve(); 73150 streamSink.ready = streamSink.sinkCapability.promise; 73151 this.streamSinks[streamId] = streamSink; 73152 new Promise(function (resolve) { 73153 resolve(action(data.data, streamSink)); 73154 }).then(function () { 73155 comObj.postMessage({ 73156 sourceName, 73157 targetName, 73158 stream: StreamKind.START_COMPLETE, 73159 streamId, 73160 success: true 73161 }); 73162 }, function (reason) { 73163 comObj.postMessage({ 73164 sourceName, 73165 targetName, 73166 stream: StreamKind.START_COMPLETE, 73167 streamId, 73168 reason: wrapReason(reason) 73169 }); 73170 }); 73171 } 73172 73173 _processStreamMessage(data) { 73174 const streamId = data.streamId, 73175 sourceName = this.sourceName, 73176 targetName = data.sourceName, 73177 comObj = this.comObj; 73178 const streamController = this.streamControllers[streamId], 73179 streamSink = this.streamSinks[streamId]; 73180 73181 switch (data.stream) { 73182 case StreamKind.START_COMPLETE: 73183 if (data.success) { 73184 streamController.startCall.resolve(); 73185 } else { 73186 streamController.startCall.reject(wrapReason(data.reason)); 73187 } 73188 73189 break; 73190 73191 case StreamKind.PULL_COMPLETE: 73192 if (data.success) { 73193 streamController.pullCall.resolve(); 73194 } else { 73195 streamController.pullCall.reject(wrapReason(data.reason)); 73196 } 73197 73198 break; 73199 73200 case StreamKind.PULL: 73201 if (!streamSink) { 73202 comObj.postMessage({ 73203 sourceName, 73204 targetName, 73205 stream: StreamKind.PULL_COMPLETE, 73206 streamId, 73207 success: true 73208 }); 73209 break; 73210 } 73211 73212 if (streamSink.desiredSize <= 0 && data.desiredSize > 0) { 73213 streamSink.sinkCapability.resolve(); 73214 } 73215 73216 streamSink.desiredSize = data.desiredSize; 73217 new Promise(function (resolve) { 73218 resolve(streamSink.onPull && streamSink.onPull()); 73219 }).then(function () { 73220 comObj.postMessage({ 73221 sourceName, 73222 targetName, 73223 stream: StreamKind.PULL_COMPLETE, 73224 streamId, 73225 success: true 73226 }); 73227 }, function (reason) { 73228 comObj.postMessage({ 73229 sourceName, 73230 targetName, 73231 stream: StreamKind.PULL_COMPLETE, 73232 streamId, 73233 reason: wrapReason(reason) 73234 }); 73235 }); 73236 break; 73237 73238 case StreamKind.ENQUEUE: 73239 (0, _util.assert)(streamController, "enqueue should have stream controller"); 73240 73241 if (streamController.isClosed) { 73242 break; 73243 } 73244 73245 streamController.controller.enqueue(data.chunk); 73246 break; 73247 73248 case StreamKind.CLOSE: 73249 (0, _util.assert)(streamController, "close should have stream controller"); 73250 73251 if (streamController.isClosed) { 73252 break; 73253 } 73254 73255 streamController.isClosed = true; 73256 streamController.controller.close(); 73257 73258 this._deleteStreamController(streamController, streamId); 73259 73260 break; 73261 73262 case StreamKind.ERROR: 73263 (0, _util.assert)(streamController, "error should have stream controller"); 73264 streamController.controller.error(wrapReason(data.reason)); 73265 73266 this._deleteStreamController(streamController, streamId); 73267 73268 break; 73269 73270 case StreamKind.CANCEL_COMPLETE: 73271 if (data.success) { 73272 streamController.cancelCall.resolve(); 73273 } else { 73274 streamController.cancelCall.reject(wrapReason(data.reason)); 73275 } 73276 73277 this._deleteStreamController(streamController, streamId); 73278 73279 break; 73280 73281 case StreamKind.CANCEL: 73282 if (!streamSink) { 73283 break; 73284 } 73285 73286 new Promise(function (resolve) { 73287 resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason))); 73288 }).then(function () { 73289 comObj.postMessage({ 73290 sourceName, 73291 targetName, 73292 stream: StreamKind.CANCEL_COMPLETE, 73293 streamId, 73294 success: true 73295 }); 73296 }, function (reason) { 73297 comObj.postMessage({ 73298 sourceName, 73299 targetName, 73300 stream: StreamKind.CANCEL_COMPLETE, 73301 streamId, 73302 reason: wrapReason(reason) 73303 }); 73304 }); 73305 streamSink.sinkCapability.reject(wrapReason(data.reason)); 73306 streamSink.isCancelled = true; 73307 delete this.streamSinks[streamId]; 73308 break; 73309 73310 default: 73311 throw new Error("Unexpected stream case"); 73312 } 73313 } 73314 73315 async _deleteStreamController(streamController, streamId) { 73316 await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]); 73317 delete this.streamControllers[streamId]; 73318 } 73319 73320 destroy() { 73321 this.comObj.removeEventListener("message", this._onComObjOnMessage); 73322 } 73323 73324} 73325 73326exports.MessageHandler = MessageHandler; 73327 73328/***/ }), 73329/* 100 */ 73330/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 73331 73332 73333 73334Object.defineProperty(exports, "__esModule", ({ 73335 value: true 73336})); 73337exports.PDFWorkerStream = void 0; 73338 73339var _util = __w_pdfjs_require__(2); 73340 73341class PDFWorkerStream { 73342 constructor(msgHandler) { 73343 this._msgHandler = msgHandler; 73344 this._contentLength = null; 73345 this._fullRequestReader = null; 73346 this._rangeRequestReaders = []; 73347 } 73348 73349 getFullReader() { 73350 (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once."); 73351 this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler); 73352 return this._fullRequestReader; 73353 } 73354 73355 getRangeReader(begin, end) { 73356 const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler); 73357 73358 this._rangeRequestReaders.push(reader); 73359 73360 return reader; 73361 } 73362 73363 cancelAllRequests(reason) { 73364 if (this._fullRequestReader) { 73365 this._fullRequestReader.cancel(reason); 73366 } 73367 73368 for (const reader of this._rangeRequestReaders.slice(0)) { 73369 reader.cancel(reason); 73370 } 73371 } 73372 73373} 73374 73375exports.PDFWorkerStream = PDFWorkerStream; 73376 73377class PDFWorkerStreamReader { 73378 constructor(msgHandler) { 73379 this._msgHandler = msgHandler; 73380 this.onProgress = null; 73381 this._contentLength = null; 73382 this._isRangeSupported = false;
73383 this._isStreamingSupported = false; 73384 73385 const readableStream = this._msgHandler.sendWithStream("GetReader"); 73386 73387 this._reader = readableStream.getReader(); 73388 this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => { 73389 this._isStreamingSupported = data.isStreamingSupported; 73390 this._isRangeSupported = data.isRangeSupported; 73391 this._contentLength = data.contentLength; 73392 }); 73393 } 73394 73395 get headersReady() { 73396 return this._headersReady; 73397 } 73398 73399 get contentLength() { 73400 return this._contentLength; 73401 } 73402 73403 get isStreamingSupported() { 73404 return this._isStreamingSupported; 73405 } 73406 73407 get isRangeSupported() { 73408 return this._isRangeSupported; 73409 } 73410 73411 async read() { 73412 const { 73413 value, 73414 done 73415 } = await this._reader.read(); 73416 73417 if (done) { 73418 return { 73419 value: undefined, 73420 done: true 73421 }; 73422 } 73423 73424 return { 73425 value: value.buffer, 73426 done: false 73427 }; 73428 } 73429 73430 cancel(reason) { 73431 this._reader.cancel(reason); 73432 } 73433 73434} 73435 73436class PDFWorkerStreamRangeReader { 73437 constructor(begin, end, msgHandler) { 73438 this._msgHandler = msgHandler; 73439 this.onProgress = null; 73440 73441 const readableStream = this._msgHandler.sendWithStream("GetRangeReader", { 73442 begin, 73443 end 73444 }); 73445 73446 this._reader = readableStream.getReader(); 73447 } 73448 73449 get isStreamingSupported() { 73450 return false; 73451 } 73452 73453 async read() { 73454 const { 73455 value, 73456 done 73457 } = await this._reader.read(); 73458 73459 if (done) { 73460 return { 73461 value: undefined, 73462 done: true 73463 }; 73464 } 73465 73466 return { 73467 value: value.buffer, 73468 done: false 73469 }; 73470 } 73471 73472 cancel(reason) { 73473 this._reader.cancel(reason); 73474 } 73475 73476} 73477 73478/***/ }) 73479/******/ ]); 73480/************************************************************************/ 73481/******/ // The module cache 73482/******/ var __webpack_module_cache__ = {}; 73483/******/ 73484/******/ // The require function 73485/******/ function __w_pdfjs_require__(moduleId) { 73486/******/ // Check if module is in cache 73487/******/ var cachedModule = __webpack_module_cache__[moduleId]; 73488/******/ if (cachedModule !== undefined) { 73489/******/ return cachedModule.exports; 73490/******/ } 73491/******/ // Create a new module (and put it into the cache) 73492/******/ var module = __webpack_module_cache__[moduleId] = { 73493/******/ // no module.id needed 73494/******/ // no module.loaded needed 73495/******/ exports: {} 73496/******/ }; 73497/******/ 73498/******/ // Execute the module function 73499/******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__); 73500/******/ 73501/******/ // Return the exports of the module 73502/******/ return module.exports; 73503/******/ } 73504/******/ 73505/************************************************************************/ 73506/******/ /* webpack/runtime/define property getters */ 73507/******/ (() => { 73508/******/ // define getter functions for harmony exports 73509/******/ __w_pdfjs_require__.d = (exports, definition) => { 73510/******/ for(var key in definition) { 73511/******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) { 73512/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 73513/******/ } 73514/******/ } 73515/******/ }; 73516/******/ })(); 73517/******/ 73518/******/ /* webpack/runtime/hasOwnProperty shorthand */ 73519/******/ (() => { 73520/******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 73521/******/ })(); 73522/******/ 73523/******/ /* webpack/runtime/make namespace object */ 73524/******/ (() => { 73525/******/ // define __esModule on exports 73526/******/ __w_pdfjs_require__.r = (exports) => { 73527/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 73528/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 73529/******/ } 73530/******/ Object.defineProperty(exports, '__esModule', { value: true }); 73531/******/ }; 73532/******/ })(); 73533/******/ 73534/************************************************************************/ 73535var __webpack_exports__ = {}; 73536// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 73537(() => { 73538var exports = __webpack_exports__; 73539 73540 73541Object.defineProperty(exports, "__esModule", ({ 73542 value: true 73543})); 73544Object.defineProperty(exports, "WorkerMessageHandler", ({ 73545 enumerable: true, 73546 get: function () { 73547 return _worker.WorkerMessageHandler; 73548 } 73549})); 73550 73551var _worker = __w_pdfjs_require__(1); 73552 73553const pdfjsVersion = '2.12.313'; 73554const pdfjsBuild = 'a2ae56f39'; 73555})(); 73556 73557/******/ return __webpack_exports__; 73558/******/ })() 73559; 73560});
73561//# 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.